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
65 ;; UNSPEC_VOLATILE usage
70 (UNSPECV_EH_RR 9) ; eh_reg_restore
73 ;; Define an insn type attribute. This is used in function unit delay
75 (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"
76 (const_string "integer"))
79 ; '(pc)' in the following doesn't include the instruction itself; it is
80 ; calculated as if the instruction had zero size.
81 (define_attr "length" ""
82 (if_then_else (eq_attr "type" "branch")
83 (if_then_else (and (ge (minus (match_dup 0) (pc))
85 (lt (minus (match_dup 0) (pc))
91 ;; Processor type -- this attribute must exactly match the processor_type
92 ;; enumeration in rs6000.h.
94 (define_attr "cpu" "rios1,rios2,rs64a,mpccore,ppc403,ppc405,ppc440,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630,ppc750,ppc7400,ppc7450,ppc8540,power4,power5"
95 (const (symbol_ref "rs6000_cpu_attr")))
97 (automata_option "ndfa")
110 (include "power4.md")
111 (include "power5.md")
113 (include "predicates.md")
115 (include "darwin.md")
120 ; This mode macro allows :GPR to be used to indicate the allowable size
121 ; of whole values in GPRs.
122 (define_mode_macro GPR [SI (DI "TARGET_POWERPC64")])
124 ; Any supported integer mode.
125 (define_mode_macro INT [QI HI SI DI TI])
127 ; Any supported integer mode that fits in one register.
128 (define_mode_macro INT1 [QI HI SI (DI "TARGET_POWERPC64")])
130 ; SImode or DImode, even if DImode doesn't fit in GPRs.
131 (define_mode_macro SDI [SI DI])
133 ; The size of a pointer. Also, the size of the value that a record-condition
134 ; (one with a '.') will compare.
135 (define_mode_macro P [(SI "TARGET_32BIT") (DI "TARGET_64BIT")])
137 ; Any hardware-supported floating-point mode
138 (define_mode_macro FP [(SF "TARGET_HARD_FLOAT")
139 (DF "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)")
140 (TF "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
141 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128")])
143 ; Various instructions that come in SI and DI forms.
144 ; A generic w/d attribute, for things like cmpw/cmpd.
145 (define_mode_attr wd [(SI "w") (DI "d")])
148 ;; Start with fixed-point load and store insns. Here we put only the more
149 ;; complex forms. Basic data transfer is done later.
151 (define_expand "zero_extendqidi2"
152 [(set (match_operand:DI 0 "gpc_reg_operand" "")
153 (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" "")))]
158 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
159 (zero_extend:DI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
164 [(set_attr "type" "load,*")])
167 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
168 (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
170 (clobber (match_scratch:DI 2 "=r,r"))]
175 [(set_attr "type" "compare")
176 (set_attr "length" "4,8")])
179 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
180 (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
182 (clobber (match_scratch:DI 2 ""))]
183 "TARGET_POWERPC64 && reload_completed"
185 (zero_extend:DI (match_dup 1)))
187 (compare:CC (match_dup 2)
192 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
193 (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
195 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
196 (zero_extend:DI (match_dup 1)))]
201 [(set_attr "type" "compare")
202 (set_attr "length" "4,8")])
205 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
206 (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
208 (set (match_operand:DI 0 "gpc_reg_operand" "")
209 (zero_extend:DI (match_dup 1)))]
210 "TARGET_POWERPC64 && reload_completed"
212 (zero_extend:DI (match_dup 1)))
214 (compare:CC (match_dup 0)
218 (define_insn "extendqidi2"
219 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
220 (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r")))]
225 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
226 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
228 (clobber (match_scratch:DI 2 "=r,r"))]
233 [(set_attr "type" "compare")
234 (set_attr "length" "4,8")])
237 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
238 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
240 (clobber (match_scratch:DI 2 ""))]
241 "TARGET_POWERPC64 && reload_completed"
243 (sign_extend:DI (match_dup 1)))
245 (compare:CC (match_dup 2)
250 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
251 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
253 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
254 (sign_extend:DI (match_dup 1)))]
259 [(set_attr "type" "compare")
260 (set_attr "length" "4,8")])
263 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
264 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
266 (set (match_operand:DI 0 "gpc_reg_operand" "")
267 (sign_extend:DI (match_dup 1)))]
268 "TARGET_POWERPC64 && reload_completed"
270 (sign_extend:DI (match_dup 1)))
272 (compare:CC (match_dup 0)
276 (define_expand "zero_extendhidi2"
277 [(set (match_operand:DI 0 "gpc_reg_operand" "")
278 (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" "")))]
283 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
284 (zero_extend:DI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
289 [(set_attr "type" "load,*")])
292 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
293 (compare:CC (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
295 (clobber (match_scratch:DI 2 "=r,r"))]
300 [(set_attr "type" "compare")
301 (set_attr "length" "4,8")])
304 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
305 (compare:CC (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
307 (clobber (match_scratch:DI 2 ""))]
308 "TARGET_POWERPC64 && reload_completed"
310 (zero_extend:DI (match_dup 1)))
312 (compare:CC (match_dup 2)
317 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
318 (compare:CC (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
320 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
321 (zero_extend:DI (match_dup 1)))]
326 [(set_attr "type" "compare")
327 (set_attr "length" "4,8")])
330 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
331 (compare:CC (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
333 (set (match_operand:DI 0 "gpc_reg_operand" "")
334 (zero_extend:DI (match_dup 1)))]
335 "TARGET_POWERPC64 && reload_completed"
337 (zero_extend:DI (match_dup 1)))
339 (compare:CC (match_dup 0)
343 (define_expand "extendhidi2"
344 [(set (match_operand:DI 0 "gpc_reg_operand" "")
345 (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "")))]
350 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
351 (sign_extend:DI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
356 [(set_attr "type" "load_ext,*")])
359 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
360 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
362 (clobber (match_scratch:DI 2 "=r,r"))]
367 [(set_attr "type" "compare")
368 (set_attr "length" "4,8")])
371 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
372 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
374 (clobber (match_scratch:DI 2 ""))]
375 "TARGET_POWERPC64 && reload_completed"
377 (sign_extend:DI (match_dup 1)))
379 (compare:CC (match_dup 2)
384 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
385 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
387 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
388 (sign_extend:DI (match_dup 1)))]
393 [(set_attr "type" "compare")
394 (set_attr "length" "4,8")])
397 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
398 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
400 (set (match_operand:DI 0 "gpc_reg_operand" "")
401 (sign_extend:DI (match_dup 1)))]
402 "TARGET_POWERPC64 && reload_completed"
404 (sign_extend:DI (match_dup 1)))
406 (compare:CC (match_dup 0)
410 (define_expand "zero_extendsidi2"
411 [(set (match_operand:DI 0 "gpc_reg_operand" "")
412 (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")))]
417 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
418 (zero_extend:DI (match_operand:SI 1 "reg_or_mem_operand" "m,r")))]
423 [(set_attr "type" "load,*")])
426 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
427 (compare:CC (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
429 (clobber (match_scratch:DI 2 "=r,r"))]
434 [(set_attr "type" "compare")
435 (set_attr "length" "4,8")])
438 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
439 (compare:CC (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
441 (clobber (match_scratch:DI 2 ""))]
442 "TARGET_POWERPC64 && reload_completed"
444 (zero_extend:DI (match_dup 1)))
446 (compare:CC (match_dup 2)
451 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
452 (compare:CC (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
454 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
455 (zero_extend:DI (match_dup 1)))]
460 [(set_attr "type" "compare")
461 (set_attr "length" "4,8")])
464 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
465 (compare:CC (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
467 (set (match_operand:DI 0 "gpc_reg_operand" "")
468 (zero_extend:DI (match_dup 1)))]
469 "TARGET_POWERPC64 && reload_completed"
471 (zero_extend:DI (match_dup 1)))
473 (compare:CC (match_dup 0)
477 (define_expand "extendsidi2"
478 [(set (match_operand:DI 0 "gpc_reg_operand" "")
479 (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")))]
484 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
485 (sign_extend:DI (match_operand:SI 1 "lwa_operand" "m,r")))]
490 [(set_attr "type" "load_ext,*")])
493 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
494 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
496 (clobber (match_scratch:DI 2 "=r,r"))]
501 [(set_attr "type" "compare")
502 (set_attr "length" "4,8")])
505 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
506 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
508 (clobber (match_scratch:DI 2 ""))]
509 "TARGET_POWERPC64 && reload_completed"
511 (sign_extend:DI (match_dup 1)))
513 (compare:CC (match_dup 2)
518 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
519 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
521 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
522 (sign_extend:DI (match_dup 1)))]
527 [(set_attr "type" "compare")
528 (set_attr "length" "4,8")])
531 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
532 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
534 (set (match_operand:DI 0 "gpc_reg_operand" "")
535 (sign_extend:DI (match_dup 1)))]
536 "TARGET_POWERPC64 && reload_completed"
538 (sign_extend:DI (match_dup 1)))
540 (compare:CC (match_dup 0)
544 (define_expand "zero_extendqisi2"
545 [(set (match_operand:SI 0 "gpc_reg_operand" "")
546 (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "")))]
551 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
552 (zero_extend:SI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
556 {rlinm|rlwinm} %0,%1,0,0xff"
557 [(set_attr "type" "load,*")])
560 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
561 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
563 (clobber (match_scratch:SI 2 "=r,r"))]
566 {andil.|andi.} %2,%1,0xff
568 [(set_attr "type" "compare")
569 (set_attr "length" "4,8")])
572 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
573 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
575 (clobber (match_scratch:SI 2 ""))]
578 (zero_extend:SI (match_dup 1)))
580 (compare:CC (match_dup 2)
585 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
586 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
588 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
589 (zero_extend:SI (match_dup 1)))]
592 {andil.|andi.} %0,%1,0xff
594 [(set_attr "type" "compare")
595 (set_attr "length" "4,8")])
598 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
599 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
601 (set (match_operand:SI 0 "gpc_reg_operand" "")
602 (zero_extend:SI (match_dup 1)))]
605 (zero_extend:SI (match_dup 1)))
607 (compare:CC (match_dup 0)
611 (define_expand "extendqisi2"
612 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
613 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
618 emit_insn (gen_extendqisi2_ppc (operands[0], operands[1]));
619 else if (TARGET_POWER)
620 emit_insn (gen_extendqisi2_power (operands[0], operands[1]));
622 emit_insn (gen_extendqisi2_no_power (operands[0], operands[1]));
626 (define_insn "extendqisi2_ppc"
627 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
628 (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r")))]
633 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
634 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
636 (clobber (match_scratch:SI 2 "=r,r"))]
641 [(set_attr "type" "compare")
642 (set_attr "length" "4,8")])
645 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
646 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
648 (clobber (match_scratch:SI 2 ""))]
649 "TARGET_POWERPC && reload_completed"
651 (sign_extend:SI (match_dup 1)))
653 (compare:CC (match_dup 2)
658 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
659 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
661 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
662 (sign_extend:SI (match_dup 1)))]
667 [(set_attr "type" "compare")
668 (set_attr "length" "4,8")])
671 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
672 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
674 (set (match_operand:SI 0 "gpc_reg_operand" "")
675 (sign_extend:SI (match_dup 1)))]
676 "TARGET_POWERPC && reload_completed"
678 (sign_extend:SI (match_dup 1)))
680 (compare:CC (match_dup 0)
684 (define_expand "extendqisi2_power"
685 [(parallel [(set (match_dup 2)
686 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
688 (clobber (scratch:SI))])
689 (parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
690 (ashiftrt:SI (match_dup 2)
692 (clobber (scratch:SI))])]
695 { operands[1] = gen_lowpart (SImode, operands[1]);
696 operands[2] = gen_reg_rtx (SImode); }")
698 (define_expand "extendqisi2_no_power"
700 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
702 (set (match_operand:SI 0 "gpc_reg_operand" "")
703 (ashiftrt:SI (match_dup 2)
705 "! TARGET_POWER && ! TARGET_POWERPC"
707 { operands[1] = gen_lowpart (SImode, operands[1]);
708 operands[2] = gen_reg_rtx (SImode); }")
710 (define_expand "zero_extendqihi2"
711 [(set (match_operand:HI 0 "gpc_reg_operand" "")
712 (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "")))]
717 [(set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
718 (zero_extend:HI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
722 {rlinm|rlwinm} %0,%1,0,0xff"
723 [(set_attr "type" "load,*")])
726 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
727 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
729 (clobber (match_scratch:HI 2 "=r,r"))]
732 {andil.|andi.} %2,%1,0xff
734 [(set_attr "type" "compare")
735 (set_attr "length" "4,8")])
738 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
739 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
741 (clobber (match_scratch:HI 2 ""))]
744 (zero_extend:HI (match_dup 1)))
746 (compare:CC (match_dup 2)
751 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
752 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
754 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
755 (zero_extend:HI (match_dup 1)))]
758 {andil.|andi.} %0,%1,0xff
760 [(set_attr "type" "compare")
761 (set_attr "length" "4,8")])
764 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
765 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
767 (set (match_operand:HI 0 "gpc_reg_operand" "")
768 (zero_extend:HI (match_dup 1)))]
771 (zero_extend:HI (match_dup 1)))
773 (compare:CC (match_dup 0)
777 (define_expand "extendqihi2"
778 [(use (match_operand:HI 0 "gpc_reg_operand" ""))
779 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
784 emit_insn (gen_extendqihi2_ppc (operands[0], operands[1]));
785 else if (TARGET_POWER)
786 emit_insn (gen_extendqihi2_power (operands[0], operands[1]));
788 emit_insn (gen_extendqihi2_no_power (operands[0], operands[1]));
792 (define_insn "extendqihi2_ppc"
793 [(set (match_operand:HI 0 "gpc_reg_operand" "=r")
794 (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r")))]
799 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
800 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
802 (clobber (match_scratch:HI 2 "=r,r"))]
807 [(set_attr "type" "compare")
808 (set_attr "length" "4,8")])
811 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
812 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
814 (clobber (match_scratch:HI 2 ""))]
815 "TARGET_POWERPC && reload_completed"
817 (sign_extend:HI (match_dup 1)))
819 (compare:CC (match_dup 2)
824 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
825 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
827 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
828 (sign_extend:HI (match_dup 1)))]
833 [(set_attr "type" "compare")
834 (set_attr "length" "4,8")])
837 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
838 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
840 (set (match_operand:HI 0 "gpc_reg_operand" "")
841 (sign_extend:HI (match_dup 1)))]
842 "TARGET_POWERPC && reload_completed"
844 (sign_extend:HI (match_dup 1)))
846 (compare:CC (match_dup 0)
850 (define_expand "extendqihi2_power"
851 [(parallel [(set (match_dup 2)
852 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
854 (clobber (scratch:SI))])
855 (parallel [(set (match_operand:HI 0 "gpc_reg_operand" "")
856 (ashiftrt:SI (match_dup 2)
858 (clobber (scratch:SI))])]
861 { operands[0] = gen_lowpart (SImode, operands[0]);
862 operands[1] = gen_lowpart (SImode, operands[1]);
863 operands[2] = gen_reg_rtx (SImode); }")
865 (define_expand "extendqihi2_no_power"
867 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
869 (set (match_operand:HI 0 "gpc_reg_operand" "")
870 (ashiftrt:SI (match_dup 2)
872 "! TARGET_POWER && ! TARGET_POWERPC"
874 { operands[0] = gen_lowpart (SImode, operands[0]);
875 operands[1] = gen_lowpart (SImode, operands[1]);
876 operands[2] = gen_reg_rtx (SImode); }")
878 (define_expand "zero_extendhisi2"
879 [(set (match_operand:SI 0 "gpc_reg_operand" "")
880 (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
885 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
886 (zero_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
890 {rlinm|rlwinm} %0,%1,0,0xffff"
891 [(set_attr "type" "load,*")])
894 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
895 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
897 (clobber (match_scratch:SI 2 "=r,r"))]
900 {andil.|andi.} %2,%1,0xffff
902 [(set_attr "type" "compare")
903 (set_attr "length" "4,8")])
906 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
907 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
909 (clobber (match_scratch:SI 2 ""))]
912 (zero_extend:SI (match_dup 1)))
914 (compare:CC (match_dup 2)
919 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
920 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
922 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
923 (zero_extend:SI (match_dup 1)))]
926 {andil.|andi.} %0,%1,0xffff
928 [(set_attr "type" "compare")
929 (set_attr "length" "4,8")])
932 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
933 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
935 (set (match_operand:SI 0 "gpc_reg_operand" "")
936 (zero_extend:SI (match_dup 1)))]
939 (zero_extend:SI (match_dup 1)))
941 (compare:CC (match_dup 0)
945 (define_expand "extendhisi2"
946 [(set (match_operand:SI 0 "gpc_reg_operand" "")
947 (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
952 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
953 (sign_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
958 [(set_attr "type" "load_ext,*")])
961 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
962 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
964 (clobber (match_scratch:SI 2 "=r,r"))]
969 [(set_attr "type" "compare")
970 (set_attr "length" "4,8")])
973 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
974 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
976 (clobber (match_scratch:SI 2 ""))]
979 (sign_extend:SI (match_dup 1)))
981 (compare:CC (match_dup 2)
986 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
987 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
989 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
990 (sign_extend:SI (match_dup 1)))]
995 [(set_attr "type" "compare")
996 (set_attr "length" "4,8")])
999 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1000 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1002 (set (match_operand:SI 0 "gpc_reg_operand" "")
1003 (sign_extend:SI (match_dup 1)))]
1006 (sign_extend:SI (match_dup 1)))
1008 (compare:CC (match_dup 0)
1012 ;; Fixed-point arithmetic insns.
1014 (define_expand "add<mode>3"
1015 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1016 (plus:SDI (match_operand:SDI 1 "gpc_reg_operand" "")
1017 (match_operand:SDI 2 "reg_or_add_cint_operand" "")))]
1021 if (<MODE>mode == DImode && ! TARGET_POWERPC64)
1023 if (non_short_cint_operand (operands[2], DImode))
1026 else if (GET_CODE (operands[2]) == CONST_INT
1027 && ! add_operand (operands[2], <MODE>mode))
1029 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
1030 ? operands[0] : gen_reg_rtx (<MODE>mode));
1032 HOST_WIDE_INT val = INTVAL (operands[2]);
1033 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1034 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, <MODE>mode);
1036 if (<MODE>mode == DImode && !CONST_OK_FOR_LETTER_P (rest, 'L'))
1039 /* The ordering here is important for the prolog expander.
1040 When space is allocated from the stack, adding 'low' first may
1041 produce a temporary deallocation (which would be bad). */
1042 emit_insn (gen_add<mode>3 (tmp, operands[1], GEN_INT (rest)));
1043 emit_insn (gen_add<mode>3 (operands[0], tmp, GEN_INT (low)));
1048 ;; Discourage ai/addic because of carry but provide it in an alternative
1049 ;; allowing register zero as source.
1050 (define_insn "*add<mode>3_internal1"
1051 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r,?r,r")
1052 (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "%r,b,r,b")
1053 (match_operand:GPR 2 "add_operand" "r,I,I,L")))]
1057 {cal %0,%2(%1)|addi %0,%1,%2}
1059 {cau|addis} %0,%1,%v2"
1060 [(set_attr "length" "4,4,4,4")])
1062 (define_insn "addsi3_high"
1063 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
1064 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
1065 (high:SI (match_operand 2 "" ""))))]
1066 "TARGET_MACHO && !TARGET_64BIT"
1067 "{cau|addis} %0,%1,ha16(%2)"
1068 [(set_attr "length" "4")])
1070 (define_insn "*add<mode>3_internal2"
1071 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
1072 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "%r,r,r,r")
1073 (match_operand:P 2 "reg_or_short_operand" "r,I,r,I"))
1075 (clobber (match_scratch:P 3 "=r,r,r,r"))]
1078 {cax.|add.} %3,%1,%2
1079 {ai.|addic.} %3,%1,%2
1082 [(set_attr "type" "fast_compare,compare,compare,compare")
1083 (set_attr "length" "4,4,8,8")])
1086 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1087 (compare:CC (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1088 (match_operand:GPR 2 "reg_or_short_operand" ""))
1090 (clobber (match_scratch:GPR 3 ""))]
1093 (plus:GPR (match_dup 1)
1096 (compare:CC (match_dup 3)
1100 (define_insn "*add<mode>3_internal3"
1101 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
1102 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "%r,r,r,r")
1103 (match_operand:P 2 "reg_or_short_operand" "r,I,r,I"))
1105 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
1106 (plus:P (match_dup 1)
1110 {cax.|add.} %0,%1,%2
1111 {ai.|addic.} %0,%1,%2
1114 [(set_attr "type" "fast_compare,compare,compare,compare")
1115 (set_attr "length" "4,4,8,8")])
1118 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1119 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "")
1120 (match_operand:P 2 "reg_or_short_operand" ""))
1122 (set (match_operand:P 0 "gpc_reg_operand" "")
1123 (plus:P (match_dup 1) (match_dup 2)))]
1126 (plus:P (match_dup 1)
1129 (compare:CC (match_dup 0)
1133 ;; Split an add that we can't do in one insn into two insns, each of which
1134 ;; does one 16-bit part. This is used by combine. Note that the low-order
1135 ;; add should be last in case the result gets used in an address.
1138 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
1139 (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1140 (match_operand:GPR 2 "non_add_cint_operand" "")))]
1142 [(set (match_dup 0) (plus:GPR (match_dup 1) (match_dup 3)))
1143 (set (match_dup 0) (plus:GPR (match_dup 0) (match_dup 4)))]
1146 HOST_WIDE_INT val = INTVAL (operands[2]);
1147 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1148 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, <MODE>mode);
1150 operands[4] = GEN_INT (low);
1151 if (<MODE>mode == SImode || CONST_OK_FOR_LETTER_P (rest, 'L'))
1152 operands[3] = GEN_INT (rest);
1153 else if (! no_new_pseudos)
1155 operands[3] = gen_reg_rtx (DImode);
1156 emit_move_insn (operands[3], operands[2]);
1157 emit_insn (gen_adddi3 (operands[0], operands[1], operands[3]));
1164 (define_insn "one_cmpl<mode>2"
1165 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1166 (not:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
1171 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1172 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1174 (clobber (match_scratch:P 2 "=r,r"))]
1179 [(set_attr "type" "compare")
1180 (set_attr "length" "4,8")])
1183 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1184 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" ""))
1186 (clobber (match_scratch:P 2 ""))]
1189 (not:P (match_dup 1)))
1191 (compare:CC (match_dup 2)
1196 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1197 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1199 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
1200 (not:P (match_dup 1)))]
1205 [(set_attr "type" "compare")
1206 (set_attr "length" "4,8")])
1209 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1210 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" ""))
1212 (set (match_operand:P 0 "gpc_reg_operand" "")
1213 (not:P (match_dup 1)))]
1216 (not:P (match_dup 1)))
1218 (compare:CC (match_dup 0)
1223 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1224 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "rI")
1225 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1227 "{sf%I1|subf%I1c} %0,%2,%1")
1230 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
1231 (minus:GPR (match_operand:GPR 1 "reg_or_short_operand" "r,I")
1232 (match_operand:GPR 2 "gpc_reg_operand" "r,r")))]
1239 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1240 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1241 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1243 (clobber (match_scratch:SI 3 "=r,r"))]
1246 {sf.|subfc.} %3,%2,%1
1248 [(set_attr "type" "compare")
1249 (set_attr "length" "4,8")])
1252 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1253 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "r,r")
1254 (match_operand:P 2 "gpc_reg_operand" "r,r"))
1256 (clobber (match_scratch:P 3 "=r,r"))]
1261 [(set_attr "type" "fast_compare")
1262 (set_attr "length" "4,8")])
1265 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1266 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "")
1267 (match_operand:P 2 "gpc_reg_operand" ""))
1269 (clobber (match_scratch:P 3 ""))]
1272 (minus:P (match_dup 1)
1275 (compare:CC (match_dup 3)
1280 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1281 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1282 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1284 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1285 (minus:SI (match_dup 1) (match_dup 2)))]
1288 {sf.|subfc.} %0,%2,%1
1290 [(set_attr "type" "compare")
1291 (set_attr "length" "4,8")])
1294 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1295 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "r,r")
1296 (match_operand:P 2 "gpc_reg_operand" "r,r"))
1298 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
1299 (minus:P (match_dup 1)
1305 [(set_attr "type" "fast_compare")
1306 (set_attr "length" "4,8")])
1309 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1310 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "")
1311 (match_operand:P 2 "gpc_reg_operand" ""))
1313 (set (match_operand:P 0 "gpc_reg_operand" "")
1314 (minus:P (match_dup 1)
1318 (minus:P (match_dup 1)
1321 (compare:CC (match_dup 0)
1325 (define_expand "sub<mode>3"
1326 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1327 (minus:SDI (match_operand:SDI 1 "reg_or_short_operand" "")
1328 (match_operand:SDI 2 "reg_or_sub_cint_operand" "")))]
1332 if (GET_CODE (operands[2]) == CONST_INT)
1334 emit_insn (gen_add<mode>3 (operands[0], operands[1],
1335 negate_rtx (<MODE>mode, operands[2])));
1340 ;; For SMIN, SMAX, UMIN, and UMAX, we use DEFINE_EXPAND's that involve a doz[i]
1341 ;; instruction and some auxiliary computations. Then we just have a single
1342 ;; DEFINE_INSN for doz[i] and the define_splits to make them if made by
1345 (define_expand "sminsi3"
1347 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1348 (match_operand:SI 2 "reg_or_short_operand" ""))
1350 (minus:SI (match_dup 2) (match_dup 1))))
1351 (set (match_operand:SI 0 "gpc_reg_operand" "")
1352 (minus:SI (match_dup 2) (match_dup 3)))]
1353 "TARGET_POWER || TARGET_ISEL"
1358 operands[2] = force_reg (SImode, operands[2]);
1359 rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]);
1363 operands[3] = gen_reg_rtx (SImode);
1367 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1368 (smin:SI (match_operand:SI 1 "gpc_reg_operand" "")
1369 (match_operand:SI 2 "reg_or_short_operand" "")))
1370 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1373 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1375 (minus:SI (match_dup 2) (match_dup 1))))
1376 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 3)))]
1379 (define_expand "smaxsi3"
1381 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1382 (match_operand:SI 2 "reg_or_short_operand" ""))
1384 (minus:SI (match_dup 2) (match_dup 1))))
1385 (set (match_operand:SI 0 "gpc_reg_operand" "")
1386 (plus:SI (match_dup 3) (match_dup 1)))]
1387 "TARGET_POWER || TARGET_ISEL"
1392 operands[2] = force_reg (SImode, operands[2]);
1393 rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]);
1396 operands[3] = gen_reg_rtx (SImode);
1400 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1401 (smax:SI (match_operand:SI 1 "gpc_reg_operand" "")
1402 (match_operand:SI 2 "reg_or_short_operand" "")))
1403 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1406 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1408 (minus:SI (match_dup 2) (match_dup 1))))
1409 (set (match_dup 0) (plus:SI (match_dup 3) (match_dup 1)))]
1412 (define_expand "uminsi3"
1413 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1415 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
1417 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
1419 (minus:SI (match_dup 4) (match_dup 3))))
1420 (set (match_operand:SI 0 "gpc_reg_operand" "")
1421 (minus:SI (match_dup 2) (match_dup 3)))]
1422 "TARGET_POWER || TARGET_ISEL"
1427 rs6000_emit_minmax (operands[0], UMIN, operands[1], operands[2]);
1430 operands[3] = gen_reg_rtx (SImode);
1431 operands[4] = gen_reg_rtx (SImode);
1432 operands[5] = GEN_INT (-2147483647 - 1);
1435 (define_expand "umaxsi3"
1436 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1438 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
1440 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
1442 (minus:SI (match_dup 4) (match_dup 3))))
1443 (set (match_operand:SI 0 "gpc_reg_operand" "")
1444 (plus:SI (match_dup 3) (match_dup 1)))]
1445 "TARGET_POWER || TARGET_ISEL"
1450 rs6000_emit_minmax (operands[0], UMAX, operands[1], operands[2]);
1453 operands[3] = gen_reg_rtx (SImode);
1454 operands[4] = gen_reg_rtx (SImode);
1455 operands[5] = GEN_INT (-2147483647 - 1);
1459 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1460 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r")
1461 (match_operand:SI 2 "reg_or_short_operand" "rI"))
1463 (minus:SI (match_dup 2) (match_dup 1))))]
1468 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1470 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
1471 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
1473 (minus:SI (match_dup 2) (match_dup 1)))
1475 (clobber (match_scratch:SI 3 "=r,r"))]
1480 [(set_attr "type" "delayed_compare")
1481 (set_attr "length" "4,8")])
1484 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1486 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "")
1487 (match_operand:SI 2 "reg_or_short_operand" ""))
1489 (minus:SI (match_dup 2) (match_dup 1)))
1491 (clobber (match_scratch:SI 3 ""))]
1492 "TARGET_POWER && reload_completed"
1494 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1496 (minus:SI (match_dup 2) (match_dup 1))))
1498 (compare:CC (match_dup 3)
1503 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1505 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
1506 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
1508 (minus:SI (match_dup 2) (match_dup 1)))
1510 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1511 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1513 (minus:SI (match_dup 2) (match_dup 1))))]
1518 [(set_attr "type" "delayed_compare")
1519 (set_attr "length" "4,8")])
1522 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1524 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "")
1525 (match_operand:SI 2 "reg_or_short_operand" ""))
1527 (minus:SI (match_dup 2) (match_dup 1)))
1529 (set (match_operand:SI 0 "gpc_reg_operand" "")
1530 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1532 (minus:SI (match_dup 2) (match_dup 1))))]
1533 "TARGET_POWER && reload_completed"
1535 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1537 (minus:SI (match_dup 2) (match_dup 1))))
1539 (compare:CC (match_dup 0)
1543 ;; We don't need abs with condition code because such comparisons should
1545 (define_expand "abssi2"
1546 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1547 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))]
1553 emit_insn (gen_abssi2_isel (operands[0], operands[1]));
1556 else if (! TARGET_POWER)
1558 emit_insn (gen_abssi2_nopower (operands[0], operands[1]));
1563 (define_insn "*abssi2_power"
1564 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1565 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
1569 (define_insn_and_split "abssi2_isel"
1570 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1571 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
1572 (clobber (match_scratch:SI 2 "=&b"))
1573 (clobber (match_scratch:CC 3 "=y"))]
1576 "&& reload_completed"
1577 [(set (match_dup 2) (neg:SI (match_dup 1)))
1579 (compare:CC (match_dup 1)
1582 (if_then_else:SI (ge (match_dup 3)
1588 (define_insn_and_split "abssi2_nopower"
1589 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
1590 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0")))
1591 (clobber (match_scratch:SI 2 "=&r,&r"))]
1592 "! TARGET_POWER && ! TARGET_ISEL"
1594 "&& reload_completed"
1595 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
1596 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
1597 (set (match_dup 0) (minus:SI (match_dup 0) (match_dup 2)))]
1600 (define_insn "*nabs_power"
1601 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1602 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r"))))]
1606 (define_insn_and_split "*nabs_nopower"
1607 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
1608 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0"))))
1609 (clobber (match_scratch:SI 2 "=&r,&r"))]
1612 "&& reload_completed"
1613 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
1614 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
1615 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 0)))]
1618 (define_expand "neg<mode>2"
1619 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1620 (neg:SDI (match_operand:SDI 1 "gpc_reg_operand" "")))]
1624 (define_insn "*neg<mode>2_internal"
1625 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1626 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
1631 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1632 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1634 (clobber (match_scratch:P 2 "=r,r"))]
1639 [(set_attr "type" "fast_compare")
1640 (set_attr "length" "4,8")])
1643 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1644 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" ""))
1646 (clobber (match_scratch:P 2 ""))]
1649 (neg:P (match_dup 1)))
1651 (compare:CC (match_dup 2)
1656 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1657 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1659 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
1660 (neg:P (match_dup 1)))]
1665 [(set_attr "type" "fast_compare")
1666 (set_attr "length" "4,8")])
1669 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1670 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" ""))
1672 (set (match_operand:P 0 "gpc_reg_operand" "")
1673 (neg:P (match_dup 1)))]
1676 (neg:P (match_dup 1)))
1678 (compare:CC (match_dup 0)
1682 (define_insn "clz<mode>2"
1683 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1684 (clz:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
1686 "{cntlz|cntlz<wd>} %0,%1")
1688 (define_expand "ctz<mode>2"
1690 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))
1691 (parallel [(set (match_dup 3) (and:GPR (match_dup 1)
1693 (clobber (scratch:CC))])
1694 (set (match_dup 4) (clz:GPR (match_dup 3)))
1695 (set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1696 (minus:GPR (match_dup 5) (match_dup 4)))]
1699 operands[2] = gen_reg_rtx (<MODE>mode);
1700 operands[3] = gen_reg_rtx (<MODE>mode);
1701 operands[4] = gen_reg_rtx (<MODE>mode);
1702 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode) - 1);
1705 (define_expand "ffs<mode>2"
1707 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))
1708 (parallel [(set (match_dup 3) (and:GPR (match_dup 1)
1710 (clobber (scratch:CC))])
1711 (set (match_dup 4) (clz:GPR (match_dup 3)))
1712 (set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1713 (minus:GPR (match_dup 5) (match_dup 4)))]
1716 operands[2] = gen_reg_rtx (<MODE>mode);
1717 operands[3] = gen_reg_rtx (<MODE>mode);
1718 operands[4] = gen_reg_rtx (<MODE>mode);
1719 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode));
1722 (define_expand "popcount<mode>2"
1724 (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")]
1727 (mult:GPR (match_dup 2) (match_dup 4)))
1728 (set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1729 (lshiftrt:GPR (match_dup 3) (match_dup 5)))]
1732 operands[2] = gen_reg_rtx (<MODE>mode);
1733 operands[3] = gen_reg_rtx (<MODE>mode);
1734 operands[4] = force_reg (<MODE>mode,
1735 <MODE>mode == SImode
1736 ? GEN_INT (0x01010101)
1737 : GEN_INT ((HOST_WIDE_INT)
1738 0x01010101 << 32 | 0x01010101));
1739 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode) - 8);
1742 (define_insn "popcntb<mode>2"
1743 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1744 (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")]
1749 (define_expand "mulsi3"
1750 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
1751 (use (match_operand:SI 1 "gpc_reg_operand" ""))
1752 (use (match_operand:SI 2 "reg_or_short_operand" ""))]
1757 emit_insn (gen_mulsi3_mq (operands[0], operands[1], operands[2]));
1759 emit_insn (gen_mulsi3_no_mq (operands[0], operands[1], operands[2]));
1763 (define_insn "mulsi3_mq"
1764 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1765 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1766 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
1767 (clobber (match_scratch:SI 3 "=q,q"))]
1770 {muls|mullw} %0,%1,%2
1771 {muli|mulli} %0,%1,%2"
1773 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
1774 (const_string "imul3")
1775 (match_operand:SI 2 "short_cint_operand" "")
1776 (const_string "imul2")]
1777 (const_string "imul")))])
1779 (define_insn "mulsi3_no_mq"
1780 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1781 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1782 (match_operand:SI 2 "reg_or_short_operand" "r,I")))]
1785 {muls|mullw} %0,%1,%2
1786 {muli|mulli} %0,%1,%2"
1788 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
1789 (const_string "imul3")
1790 (match_operand:SI 2 "short_cint_operand" "")
1791 (const_string "imul2")]
1792 (const_string "imul")))])
1794 (define_insn "*mulsi3_mq_internal1"
1795 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1796 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1797 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1799 (clobber (match_scratch:SI 3 "=r,r"))
1800 (clobber (match_scratch:SI 4 "=q,q"))]
1803 {muls.|mullw.} %3,%1,%2
1805 [(set_attr "type" "imul_compare")
1806 (set_attr "length" "4,8")])
1809 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1810 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
1811 (match_operand:SI 2 "gpc_reg_operand" ""))
1813 (clobber (match_scratch:SI 3 ""))
1814 (clobber (match_scratch:SI 4 ""))]
1815 "TARGET_POWER && reload_completed"
1816 [(parallel [(set (match_dup 3)
1817 (mult:SI (match_dup 1) (match_dup 2)))
1818 (clobber (match_dup 4))])
1820 (compare:CC (match_dup 3)
1824 (define_insn "*mulsi3_no_mq_internal1"
1825 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1826 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1827 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1829 (clobber (match_scratch:SI 3 "=r,r"))]
1832 {muls.|mullw.} %3,%1,%2
1834 [(set_attr "type" "imul_compare")
1835 (set_attr "length" "4,8")])
1838 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1839 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
1840 (match_operand:SI 2 "gpc_reg_operand" ""))
1842 (clobber (match_scratch:SI 3 ""))]
1843 "! TARGET_POWER && reload_completed"
1845 (mult:SI (match_dup 1) (match_dup 2)))
1847 (compare:CC (match_dup 3)
1851 (define_insn "*mulsi3_mq_internal2"
1852 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1853 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1854 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1856 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1857 (mult:SI (match_dup 1) (match_dup 2)))
1858 (clobber (match_scratch:SI 4 "=q,q"))]
1861 {muls.|mullw.} %0,%1,%2
1863 [(set_attr "type" "imul_compare")
1864 (set_attr "length" "4,8")])
1867 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1868 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
1869 (match_operand:SI 2 "gpc_reg_operand" ""))
1871 (set (match_operand:SI 0 "gpc_reg_operand" "")
1872 (mult:SI (match_dup 1) (match_dup 2)))
1873 (clobber (match_scratch:SI 4 ""))]
1874 "TARGET_POWER && reload_completed"
1875 [(parallel [(set (match_dup 0)
1876 (mult:SI (match_dup 1) (match_dup 2)))
1877 (clobber (match_dup 4))])
1879 (compare:CC (match_dup 0)
1883 (define_insn "*mulsi3_no_mq_internal2"
1884 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1885 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1886 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1888 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1889 (mult:SI (match_dup 1) (match_dup 2)))]
1892 {muls.|mullw.} %0,%1,%2
1894 [(set_attr "type" "imul_compare")
1895 (set_attr "length" "4,8")])
1898 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1899 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
1900 (match_operand:SI 2 "gpc_reg_operand" ""))
1902 (set (match_operand:SI 0 "gpc_reg_operand" "")
1903 (mult:SI (match_dup 1) (match_dup 2)))]
1904 "! TARGET_POWER && reload_completed"
1906 (mult:SI (match_dup 1) (match_dup 2)))
1908 (compare:CC (match_dup 0)
1912 ;; Operand 1 is divided by operand 2; quotient goes to operand
1913 ;; 0 and remainder to operand 3.
1914 ;; ??? At some point, see what, if anything, we can do about if (x % y == 0).
1916 (define_expand "divmodsi4"
1917 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
1918 (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
1919 (match_operand:SI 2 "gpc_reg_operand" "")))
1920 (set (match_operand:SI 3 "register_operand" "")
1921 (mod:SI (match_dup 1) (match_dup 2)))])]
1922 "TARGET_POWER || (! TARGET_POWER && ! TARGET_POWERPC)"
1925 if (! TARGET_POWER && ! TARGET_POWERPC)
1927 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
1928 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
1929 emit_insn (gen_divss_call ());
1930 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
1931 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
1936 (define_insn "*divmodsi4_internal"
1937 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1938 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1939 (match_operand:SI 2 "gpc_reg_operand" "r")))
1940 (set (match_operand:SI 3 "register_operand" "=q")
1941 (mod:SI (match_dup 1) (match_dup 2)))]
1944 [(set_attr "type" "idiv")])
1946 (define_expand "udiv<mode>3"
1947 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
1948 (udiv:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1949 (match_operand:GPR 2 "gpc_reg_operand" "")))]
1950 "TARGET_POWERPC || (! TARGET_POWER && ! TARGET_POWERPC)"
1953 if (! TARGET_POWER && ! TARGET_POWERPC)
1955 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
1956 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
1957 emit_insn (gen_quous_call ());
1958 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
1961 else if (TARGET_POWER)
1963 emit_insn (gen_udivsi3_mq (operands[0], operands[1], operands[2]));
1968 (define_insn "udivsi3_mq"
1969 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1970 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1971 (match_operand:SI 2 "gpc_reg_operand" "r")))
1972 (clobber (match_scratch:SI 3 "=q"))]
1973 "TARGET_POWERPC && TARGET_POWER"
1975 [(set_attr "type" "idiv")])
1977 (define_insn "*udivsi3_no_mq"
1978 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1979 (udiv:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
1980 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
1981 "TARGET_POWERPC && ! TARGET_POWER"
1983 [(set_attr "type" "idiv")])
1985 ;; For powers of two we can do srai/aze for divide and then adjust for
1986 ;; modulus. If it isn't a power of two, FAIL on POWER so divmodsi4 will be
1987 ;; used; for PowerPC, force operands into register and do a normal divide;
1988 ;; for AIX common-mode, use quoss call on register operands.
1989 (define_expand "div<mode>3"
1990 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
1991 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1992 (match_operand:GPR 2 "reg_or_cint_operand" "")))]
1996 if (GET_CODE (operands[2]) == CONST_INT
1997 && INTVAL (operands[2]) > 0
1998 && exact_log2 (INTVAL (operands[2])) >= 0)
2000 else if (TARGET_POWERPC)
2002 operands[2] = force_reg (SImode, operands[2]);
2005 emit_insn (gen_divsi3_mq (operands[0], operands[1], operands[2]));
2009 else if (TARGET_POWER)
2013 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2014 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2015 emit_insn (gen_quoss_call ());
2016 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2021 (define_insn "divsi3_mq"
2022 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2023 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2024 (match_operand:SI 2 "gpc_reg_operand" "r")))
2025 (clobber (match_scratch:SI 3 "=q"))]
2026 "TARGET_POWERPC && TARGET_POWER"
2028 [(set_attr "type" "idiv")])
2030 (define_insn "*div<mode>3_no_mq"
2031 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2032 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2033 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
2034 "TARGET_POWERPC && ! TARGET_POWER"
2036 [(set_attr "type" "idiv")])
2038 (define_expand "mod<mode>3"
2039 [(use (match_operand:GPR 0 "gpc_reg_operand" ""))
2040 (use (match_operand:GPR 1 "gpc_reg_operand" ""))
2041 (use (match_operand:GPR 2 "reg_or_cint_operand" ""))]
2049 if (GET_CODE (operands[2]) != CONST_INT
2050 || INTVAL (operands[2]) <= 0
2051 || (i = exact_log2 (INTVAL (operands[2]))) < 0)
2054 temp1 = gen_reg_rtx (<MODE>mode);
2055 temp2 = gen_reg_rtx (<MODE>mode);
2057 emit_insn (gen_div<mode>3 (temp1, operands[1], operands[2]));
2058 emit_insn (gen_ashl<mode>3 (temp2, temp1, GEN_INT (i)));
2059 emit_insn (gen_sub<mode>3 (operands[0], operands[1], temp2));
2064 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2065 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2066 (match_operand:GPR 2 "exact_log2_cint_operand" "N")))]
2068 "{srai|sra<wd>i} %0,%1,%p2\;{aze|addze} %0,%0"
2069 [(set_attr "type" "two")
2070 (set_attr "length" "8")])
2073 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2074 (compare:CC (div:P (match_operand:P 1 "gpc_reg_operand" "r,r")
2075 (match_operand:P 2 "exact_log2_cint_operand" "N,N"))
2077 (clobber (match_scratch:P 3 "=r,r"))]
2080 {srai|sra<wd>i} %3,%1,%p2\;{aze.|addze.} %3,%3
2082 [(set_attr "type" "compare")
2083 (set_attr "length" "8,12")])
2086 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2087 (compare:CC (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2088 (match_operand:GPR 2 "exact_log2_cint_operand"
2091 (clobber (match_scratch:GPR 3 ""))]
2094 (div:<MODE> (match_dup 1) (match_dup 2)))
2096 (compare:CC (match_dup 3)
2101 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2102 (compare:CC (div:P (match_operand:P 1 "gpc_reg_operand" "r,r")
2103 (match_operand:P 2 "exact_log2_cint_operand" "N,N"))
2105 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
2106 (div:P (match_dup 1) (match_dup 2)))]
2109 {srai|sra<wd>i} %0,%1,%p2\;{aze.|addze.} %0,%0
2111 [(set_attr "type" "compare")
2112 (set_attr "length" "8,12")])
2115 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2116 (compare:CC (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2117 (match_operand:GPR 2 "exact_log2_cint_operand"
2120 (set (match_operand:GPR 0 "gpc_reg_operand" "")
2121 (div:GPR (match_dup 1) (match_dup 2)))]
2124 (div:<MODE> (match_dup 1) (match_dup 2)))
2126 (compare:CC (match_dup 0)
2131 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2134 (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
2136 (zero_extend:DI (match_operand:SI 4 "register_operand" "2")))
2137 (match_operand:SI 3 "gpc_reg_operand" "r")))
2138 (set (match_operand:SI 2 "register_operand" "=*q")
2141 (zero_extend:DI (match_dup 1)) (const_int 32))
2142 (zero_extend:DI (match_dup 4)))
2146 [(set_attr "type" "idiv")])
2148 ;; To do unsigned divide we handle the cases of the divisor looking like a
2149 ;; negative number. If it is a constant that is less than 2**31, we don't
2150 ;; have to worry about the branches. So make a few subroutines here.
2152 ;; First comes the normal case.
2153 (define_expand "udivmodsi4_normal"
2154 [(set (match_dup 4) (const_int 0))
2155 (parallel [(set (match_operand:SI 0 "" "")
2156 (udiv:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
2158 (zero_extend:DI (match_operand:SI 1 "" "")))
2159 (match_operand:SI 2 "" "")))
2160 (set (match_operand:SI 3 "" "")
2161 (umod:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
2163 (zero_extend:DI (match_dup 1)))
2167 { operands[4] = gen_reg_rtx (SImode); }")
2169 ;; This handles the branches.
2170 (define_expand "udivmodsi4_tests"
2171 [(set (match_operand:SI 0 "" "") (const_int 0))
2172 (set (match_operand:SI 3 "" "") (match_operand:SI 1 "" ""))
2173 (set (match_dup 5) (compare:CCUNS (match_dup 1) (match_operand:SI 2 "" "")))
2174 (set (pc) (if_then_else (ltu (match_dup 5) (const_int 0))
2175 (label_ref (match_operand:SI 4 "" "")) (pc)))
2176 (set (match_dup 0) (const_int 1))
2177 (set (match_dup 3) (minus:SI (match_dup 1) (match_dup 2)))
2178 (set (match_dup 6) (compare:CC (match_dup 2) (const_int 0)))
2179 (set (pc) (if_then_else (lt (match_dup 6) (const_int 0))
2180 (label_ref (match_dup 4)) (pc)))]
2183 { operands[5] = gen_reg_rtx (CCUNSmode);
2184 operands[6] = gen_reg_rtx (CCmode);
2187 (define_expand "udivmodsi4"
2188 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
2189 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "")
2190 (match_operand:SI 2 "reg_or_cint_operand" "")))
2191 (set (match_operand:SI 3 "gpc_reg_operand" "")
2192 (umod:SI (match_dup 1) (match_dup 2)))])]
2200 if (! TARGET_POWERPC)
2202 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2203 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2204 emit_insn (gen_divus_call ());
2205 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2206 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
2213 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) < 0)
2215 operands[2] = force_reg (SImode, operands[2]);
2216 label = gen_label_rtx ();
2217 emit (gen_udivmodsi4_tests (operands[0], operands[1], operands[2],
2218 operands[3], label));
2221 operands[2] = force_reg (SImode, operands[2]);
2223 emit (gen_udivmodsi4_normal (operands[0], operands[1], operands[2],
2231 ;; AIX architecture-independent common-mode multiply (DImode),
2232 ;; divide/modulus, and quotient subroutine calls. Input operands in R3 and
2233 ;; R4; results in R3 and sometimes R4; link register always clobbered by bla
2234 ;; instruction; R0 sometimes clobbered; also, MQ sometimes clobbered but
2235 ;; assumed unused if generating common-mode, so ignore.
2236 (define_insn "mulh_call"
2239 (lshiftrt:DI (mult:DI (sign_extend:DI (reg:SI 3))
2240 (sign_extend:DI (reg:SI 4)))
2242 (clobber (match_scratch:SI 0 "=l"))]
2243 "! TARGET_POWER && ! TARGET_POWERPC"
2245 [(set_attr "type" "imul")])
2247 (define_insn "mull_call"
2249 (mult:DI (sign_extend:DI (reg:SI 3))
2250 (sign_extend:DI (reg:SI 4))))
2251 (clobber (match_scratch:SI 0 "=l"))
2252 (clobber (reg:SI 0))]
2253 "! TARGET_POWER && ! TARGET_POWERPC"
2255 [(set_attr "type" "imul")])
2257 (define_insn "divss_call"
2259 (div:SI (reg:SI 3) (reg:SI 4)))
2261 (mod:SI (reg:SI 3) (reg:SI 4)))
2262 (clobber (match_scratch:SI 0 "=l"))
2263 (clobber (reg:SI 0))]
2264 "! TARGET_POWER && ! TARGET_POWERPC"
2266 [(set_attr "type" "idiv")])
2268 (define_insn "divus_call"
2270 (udiv:SI (reg:SI 3) (reg:SI 4)))
2272 (umod:SI (reg:SI 3) (reg:SI 4)))
2273 (clobber (match_scratch:SI 0 "=l"))
2274 (clobber (reg:SI 0))
2275 (clobber (match_scratch:CC 1 "=x"))
2276 (clobber (reg:CC 69))]
2277 "! TARGET_POWER && ! TARGET_POWERPC"
2279 [(set_attr "type" "idiv")])
2281 (define_insn "quoss_call"
2283 (div:SI (reg:SI 3) (reg:SI 4)))
2284 (clobber (match_scratch:SI 0 "=l"))]
2285 "! TARGET_POWER && ! TARGET_POWERPC"
2287 [(set_attr "type" "idiv")])
2289 (define_insn "quous_call"
2291 (udiv:SI (reg:SI 3) (reg:SI 4)))
2292 (clobber (match_scratch:SI 0 "=l"))
2293 (clobber (reg:SI 0))
2294 (clobber (match_scratch:CC 1 "=x"))
2295 (clobber (reg:CC 69))]
2296 "! TARGET_POWER && ! TARGET_POWERPC"
2298 [(set_attr "type" "idiv")])
2300 ;; Logical instructions
2301 ;; The logical instructions are mostly combined by using match_operator,
2302 ;; but the plain AND insns are somewhat different because there is no
2303 ;; plain 'andi' (only 'andi.'), no plain 'andis', and there are all
2304 ;; those rotate-and-mask operations. Thus, the AND insns come first.
2306 (define_insn "andsi3"
2307 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
2308 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
2309 (match_operand:SI 2 "and_operand" "?r,T,K,L")))
2310 (clobber (match_scratch:CC 3 "=X,X,x,x"))]
2314 {rlinm|rlwinm} %0,%1,0,%m2,%M2
2315 {andil.|andi.} %0,%1,%b2
2316 {andiu.|andis.} %0,%1,%u2"
2317 [(set_attr "type" "*,*,compare,compare")])
2319 ;; Note to set cr's other than cr0 we do the and immediate and then
2320 ;; the test again -- this avoids a mfcr which on the higher end
2321 ;; machines causes an execution serialization
2323 (define_insn "*andsi3_internal2"
2324 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2325 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2326 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2328 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2329 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2333 {andil.|andi.} %3,%1,%b2
2334 {andiu.|andis.} %3,%1,%u2
2335 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
2340 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2341 (set_attr "length" "4,4,4,4,8,8,8,8")])
2343 (define_insn "*andsi3_internal3"
2344 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2345 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2346 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2348 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2349 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2353 {andil.|andi.} %3,%1,%b2
2354 {andiu.|andis.} %3,%1,%u2
2355 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
2360 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2361 (set_attr "length" "8,4,4,4,8,8,8,8")])
2364 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2365 (compare:CC (and:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2366 (match_operand:GPR 2 "and_operand" ""))
2368 (clobber (match_scratch:GPR 3 ""))
2369 (clobber (match_scratch:CC 4 ""))]
2371 [(parallel [(set (match_dup 3)
2372 (and:<MODE> (match_dup 1)
2374 (clobber (match_dup 4))])
2376 (compare:CC (match_dup 3)
2380 ;; We don't have a 32 bit "and. rt,ra,rb" for ppc64. cr is set from the
2381 ;; whole 64 bit reg, and we don't know what is in the high 32 bits.
2384 [(set (match_operand:CC 0 "cc_reg_operand" "")
2385 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2386 (match_operand:SI 2 "gpc_reg_operand" ""))
2388 (clobber (match_scratch:SI 3 ""))
2389 (clobber (match_scratch:CC 4 ""))]
2390 "TARGET_POWERPC64 && reload_completed"
2391 [(parallel [(set (match_dup 3)
2392 (and:SI (match_dup 1)
2394 (clobber (match_dup 4))])
2396 (compare:CC (match_dup 3)
2400 (define_insn "*andsi3_internal4"
2401 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2402 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2403 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2405 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
2406 (and:SI (match_dup 1)
2408 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2412 {andil.|andi.} %0,%1,%b2
2413 {andiu.|andis.} %0,%1,%u2
2414 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
2419 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2420 (set_attr "length" "4,4,4,4,8,8,8,8")])
2422 (define_insn "*andsi3_internal5"
2423 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2424 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2425 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2427 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
2428 (and:SI (match_dup 1)
2430 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2434 {andil.|andi.} %0,%1,%b2
2435 {andiu.|andis.} %0,%1,%u2
2436 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
2441 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2442 (set_attr "length" "8,4,4,4,8,8,8,8")])
2445 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2446 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2447 (match_operand:SI 2 "and_operand" ""))
2449 (set (match_operand:SI 0 "gpc_reg_operand" "")
2450 (and:SI (match_dup 1)
2452 (clobber (match_scratch:CC 4 ""))]
2454 [(parallel [(set (match_dup 0)
2455 (and:SI (match_dup 1)
2457 (clobber (match_dup 4))])
2459 (compare:CC (match_dup 0)
2464 [(set (match_operand:CC 3 "cc_reg_operand" "")
2465 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2466 (match_operand:SI 2 "gpc_reg_operand" ""))
2468 (set (match_operand:SI 0 "gpc_reg_operand" "")
2469 (and:SI (match_dup 1)
2471 (clobber (match_scratch:CC 4 ""))]
2472 "TARGET_POWERPC64 && reload_completed"
2473 [(parallel [(set (match_dup 0)
2474 (and:SI (match_dup 1)
2476 (clobber (match_dup 4))])
2478 (compare:CC (match_dup 0)
2482 ;; Handle the PowerPC64 rlwinm corner case
2484 (define_insn_and_split "*andsi3_internal6"
2485 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2486 (and:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2487 (match_operand:SI 2 "mask_operand_wrap" "i")))]
2492 (and:SI (rotate:SI (match_dup 1) (match_dup 3))
2495 (rotate:SI (match_dup 0) (match_dup 5)))]
2498 int mb = extract_MB (operands[2]);
2499 int me = extract_ME (operands[2]);
2500 operands[3] = GEN_INT (me + 1);
2501 operands[5] = GEN_INT (32 - (me + 1));
2502 operands[4] = GEN_INT (~((HOST_WIDE_INT) -1 << (33 + me - mb)));
2504 [(set_attr "length" "8")])
2506 (define_expand "iorsi3"
2507 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2508 (ior:SI (match_operand:SI 1 "gpc_reg_operand" "")
2509 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
2513 if (GET_CODE (operands[2]) == CONST_INT
2514 && ! logical_operand (operands[2], SImode))
2516 HOST_WIDE_INT value = INTVAL (operands[2]);
2517 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
2518 ? operands[0] : gen_reg_rtx (SImode));
2520 emit_insn (gen_iorsi3 (tmp, operands[1],
2521 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
2522 emit_insn (gen_iorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
2527 (define_expand "xorsi3"
2528 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2529 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
2530 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
2534 if (GET_CODE (operands[2]) == CONST_INT
2535 && ! logical_operand (operands[2], SImode))
2537 HOST_WIDE_INT value = INTVAL (operands[2]);
2538 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
2539 ? operands[0] : gen_reg_rtx (SImode));
2541 emit_insn (gen_xorsi3 (tmp, operands[1],
2542 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
2543 emit_insn (gen_xorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
2548 (define_insn "*boolsi3_internal1"
2549 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
2550 (match_operator:SI 3 "boolean_or_operator"
2551 [(match_operand:SI 1 "gpc_reg_operand" "%r,r,r")
2552 (match_operand:SI 2 "logical_operand" "r,K,L")]))]
2556 {%q3il|%q3i} %0,%1,%b2
2557 {%q3iu|%q3is} %0,%1,%u2")
2559 (define_insn "*boolsi3_internal2"
2560 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2561 (compare:CC (match_operator:SI 4 "boolean_or_operator"
2562 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
2563 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
2565 (clobber (match_scratch:SI 3 "=r,r"))]
2570 [(set_attr "type" "compare")
2571 (set_attr "length" "4,8")])
2574 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2575 (compare:CC (match_operator:SI 4 "boolean_operator"
2576 [(match_operand:SI 1 "gpc_reg_operand" "")
2577 (match_operand:SI 2 "gpc_reg_operand" "")])
2579 (clobber (match_scratch:SI 3 ""))]
2580 "TARGET_32BIT && reload_completed"
2581 [(set (match_dup 3) (match_dup 4))
2583 (compare:CC (match_dup 3)
2587 (define_insn "*boolsi3_internal3"
2588 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2589 (compare:CC (match_operator:SI 4 "boolean_operator"
2590 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
2591 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
2593 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2599 [(set_attr "type" "compare")
2600 (set_attr "length" "4,8")])
2603 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2604 (compare:CC (match_operator:SI 4 "boolean_operator"
2605 [(match_operand:SI 1 "gpc_reg_operand" "")
2606 (match_operand:SI 2 "gpc_reg_operand" "")])
2608 (set (match_operand:SI 0 "gpc_reg_operand" "")
2610 "TARGET_32BIT && reload_completed"
2611 [(set (match_dup 0) (match_dup 4))
2613 (compare:CC (match_dup 0)
2617 ;; Split a logical operation that we can't do in one insn into two insns,
2618 ;; each of which does one 16-bit part. This is used by combine.
2621 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2622 (match_operator:SI 3 "boolean_or_operator"
2623 [(match_operand:SI 1 "gpc_reg_operand" "")
2624 (match_operand:SI 2 "non_logical_cint_operand" "")]))]
2626 [(set (match_dup 0) (match_dup 4))
2627 (set (match_dup 0) (match_dup 5))]
2631 i = GEN_INT (INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff));
2632 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
2634 i = GEN_INT (INTVAL (operands[2]) & 0xffff);
2635 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
2639 (define_insn "*boolcsi3_internal1"
2640 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2641 (match_operator:SI 3 "boolean_operator"
2642 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
2643 (match_operand:SI 2 "gpc_reg_operand" "r")]))]
2647 (define_insn "*boolcsi3_internal2"
2648 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2649 (compare:CC (match_operator:SI 4 "boolean_operator"
2650 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
2651 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
2653 (clobber (match_scratch:SI 3 "=r,r"))]
2658 [(set_attr "type" "compare")
2659 (set_attr "length" "4,8")])
2662 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2663 (compare:CC (match_operator:SI 4 "boolean_operator"
2664 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
2665 (match_operand:SI 2 "gpc_reg_operand" "")])
2667 (clobber (match_scratch:SI 3 ""))]
2668 "TARGET_32BIT && reload_completed"
2669 [(set (match_dup 3) (match_dup 4))
2671 (compare:CC (match_dup 3)
2675 (define_insn "*boolcsi3_internal3"
2676 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2677 (compare:CC (match_operator:SI 4 "boolean_operator"
2678 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
2679 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
2681 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2687 [(set_attr "type" "compare")
2688 (set_attr "length" "4,8")])
2691 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2692 (compare:CC (match_operator:SI 4 "boolean_operator"
2693 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
2694 (match_operand:SI 2 "gpc_reg_operand" "")])
2696 (set (match_operand:SI 0 "gpc_reg_operand" "")
2698 "TARGET_32BIT && reload_completed"
2699 [(set (match_dup 0) (match_dup 4))
2701 (compare:CC (match_dup 0)
2705 (define_insn "*boolccsi3_internal1"
2706 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2707 (match_operator:SI 3 "boolean_operator"
2708 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
2709 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))]))]
2713 (define_insn "*boolccsi3_internal2"
2714 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2715 (compare:CC (match_operator:SI 4 "boolean_operator"
2716 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
2717 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
2719 (clobber (match_scratch:SI 3 "=r,r"))]
2724 [(set_attr "type" "compare")
2725 (set_attr "length" "4,8")])
2728 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2729 (compare:CC (match_operator:SI 4 "boolean_operator"
2730 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
2731 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
2733 (clobber (match_scratch:SI 3 ""))]
2734 "TARGET_32BIT && reload_completed"
2735 [(set (match_dup 3) (match_dup 4))
2737 (compare:CC (match_dup 3)
2741 (define_insn "*boolccsi3_internal3"
2742 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2743 (compare:CC (match_operator:SI 4 "boolean_operator"
2744 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
2745 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
2747 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2753 [(set_attr "type" "compare")
2754 (set_attr "length" "4,8")])
2757 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2758 (compare:CC (match_operator:SI 4 "boolean_operator"
2759 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
2760 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
2762 (set (match_operand:SI 0 "gpc_reg_operand" "")
2764 "TARGET_32BIT && reload_completed"
2765 [(set (match_dup 0) (match_dup 4))
2767 (compare:CC (match_dup 0)
2771 ;; maskir insn. We need four forms because things might be in arbitrary
2772 ;; orders. Don't define forms that only set CR fields because these
2773 ;; would modify an input register.
2775 (define_insn "*maskir_internal1"
2776 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2777 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
2778 (match_operand:SI 1 "gpc_reg_operand" "0"))
2779 (and:SI (match_dup 2)
2780 (match_operand:SI 3 "gpc_reg_operand" "r"))))]
2784 (define_insn "*maskir_internal2"
2785 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2786 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
2787 (match_operand:SI 1 "gpc_reg_operand" "0"))
2788 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2793 (define_insn "*maskir_internal3"
2794 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2795 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r")
2796 (match_operand:SI 3 "gpc_reg_operand" "r"))
2797 (and:SI (not:SI (match_dup 2))
2798 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
2802 (define_insn "*maskir_internal4"
2803 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2804 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2805 (match_operand:SI 2 "gpc_reg_operand" "r"))
2806 (and:SI (not:SI (match_dup 2))
2807 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
2811 (define_insn "*maskir_internal5"
2812 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
2814 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2815 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
2816 (and:SI (match_dup 2)
2817 (match_operand:SI 3 "gpc_reg_operand" "r,r")))
2819 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2820 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2821 (and:SI (match_dup 2) (match_dup 3))))]
2826 [(set_attr "type" "compare")
2827 (set_attr "length" "4,8")])
2830 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
2832 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
2833 (match_operand:SI 1 "gpc_reg_operand" ""))
2834 (and:SI (match_dup 2)
2835 (match_operand:SI 3 "gpc_reg_operand" "")))
2837 (set (match_operand:SI 0 "gpc_reg_operand" "")
2838 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2839 (and:SI (match_dup 2) (match_dup 3))))]
2840 "TARGET_POWER && reload_completed"
2842 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2843 (and:SI (match_dup 2) (match_dup 3))))
2845 (compare:CC (match_dup 0)
2849 (define_insn "*maskir_internal6"
2850 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
2852 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2853 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
2854 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
2857 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2858 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2859 (and:SI (match_dup 3) (match_dup 2))))]
2864 [(set_attr "type" "compare")
2865 (set_attr "length" "4,8")])
2868 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
2870 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
2871 (match_operand:SI 1 "gpc_reg_operand" ""))
2872 (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
2875 (set (match_operand:SI 0 "gpc_reg_operand" "")
2876 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2877 (and:SI (match_dup 3) (match_dup 2))))]
2878 "TARGET_POWER && reload_completed"
2880 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2881 (and:SI (match_dup 3) (match_dup 2))))
2883 (compare:CC (match_dup 0)
2887 (define_insn "*maskir_internal7"
2888 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
2890 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r,r")
2891 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
2892 (and:SI (not:SI (match_dup 2))
2893 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
2895 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2896 (ior:SI (and:SI (match_dup 2) (match_dup 3))
2897 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
2902 [(set_attr "type" "compare")
2903 (set_attr "length" "4,8")])
2906 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
2908 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "")
2909 (match_operand:SI 3 "gpc_reg_operand" ""))
2910 (and:SI (not:SI (match_dup 2))
2911 (match_operand:SI 1 "gpc_reg_operand" "")))
2913 (set (match_operand:SI 0 "gpc_reg_operand" "")
2914 (ior:SI (and:SI (match_dup 2) (match_dup 3))
2915 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
2916 "TARGET_POWER && reload_completed"
2918 (ior:SI (and:SI (match_dup 2) (match_dup 3))
2919 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
2921 (compare:CC (match_dup 0)
2925 (define_insn "*maskir_internal8"
2926 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
2928 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
2929 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2930 (and:SI (not:SI (match_dup 2))
2931 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
2933 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2934 (ior:SI (and:SI (match_dup 3) (match_dup 2))
2935 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
2940 [(set_attr "type" "compare")
2941 (set_attr "length" "4,8")])
2944 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
2946 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
2947 (match_operand:SI 2 "gpc_reg_operand" ""))
2948 (and:SI (not:SI (match_dup 2))
2949 (match_operand:SI 1 "gpc_reg_operand" "")))
2951 (set (match_operand:SI 0 "gpc_reg_operand" "")
2952 (ior:SI (and:SI (match_dup 3) (match_dup 2))
2953 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
2954 "TARGET_POWER && reload_completed"
2956 (ior:SI (and:SI (match_dup 3) (match_dup 2))
2957 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
2959 (compare:CC (match_dup 0)
2963 ;; Rotate and shift insns, in all their variants. These support shifts,
2964 ;; field inserts and extracts, and various combinations thereof.
2965 (define_expand "insv"
2966 [(set (zero_extract (match_operand 0 "gpc_reg_operand" "")
2967 (match_operand:SI 1 "const_int_operand" "")
2968 (match_operand:SI 2 "const_int_operand" ""))
2969 (match_operand 3 "gpc_reg_operand" ""))]
2973 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
2974 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
2975 compiler if the address of the structure is taken later. */
2976 if (GET_CODE (operands[0]) == SUBREG
2977 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
2980 if (TARGET_POWERPC64 && GET_MODE (operands[0]) == DImode)
2981 emit_insn (gen_insvdi (operands[0], operands[1], operands[2], operands[3]));
2983 emit_insn (gen_insvsi (operands[0], operands[1], operands[2], operands[3]));
2987 (define_insn "insvsi"
2988 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2989 (match_operand:SI 1 "const_int_operand" "i")
2990 (match_operand:SI 2 "const_int_operand" "i"))
2991 (match_operand:SI 3 "gpc_reg_operand" "r"))]
2995 int start = INTVAL (operands[2]) & 31;
2996 int size = INTVAL (operands[1]) & 31;
2998 operands[4] = GEN_INT (32 - start - size);
2999 operands[1] = GEN_INT (start + size - 1);
3000 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3002 [(set_attr "type" "insert_word")])
3004 (define_insn "*insvsi_internal1"
3005 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3006 (match_operand:SI 1 "const_int_operand" "i")
3007 (match_operand:SI 2 "const_int_operand" "i"))
3008 (rotate:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3009 (match_operand:SI 4 "const_int_operand" "i")))]
3010 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3013 int shift = INTVAL (operands[4]) & 31;
3014 int start = INTVAL (operands[2]) & 31;
3015 int size = INTVAL (operands[1]) & 31;
3017 operands[4] = GEN_INT (shift - start - size);
3018 operands[1] = GEN_INT (start + size - 1);
3019 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3021 [(set_attr "type" "insert_word")])
3023 (define_insn "*insvsi_internal2"
3024 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3025 (match_operand:SI 1 "const_int_operand" "i")
3026 (match_operand:SI 2 "const_int_operand" "i"))
3027 (ashiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3028 (match_operand:SI 4 "const_int_operand" "i")))]
3029 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3032 int shift = INTVAL (operands[4]) & 31;
3033 int start = INTVAL (operands[2]) & 31;
3034 int size = INTVAL (operands[1]) & 31;
3036 operands[4] = GEN_INT (32 - shift - start - size);
3037 operands[1] = GEN_INT (start + size - 1);
3038 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3040 [(set_attr "type" "insert_word")])
3042 (define_insn "*insvsi_internal3"
3043 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3044 (match_operand:SI 1 "const_int_operand" "i")
3045 (match_operand:SI 2 "const_int_operand" "i"))
3046 (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3047 (match_operand:SI 4 "const_int_operand" "i")))]
3048 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3051 int shift = INTVAL (operands[4]) & 31;
3052 int start = INTVAL (operands[2]) & 31;
3053 int size = INTVAL (operands[1]) & 31;
3055 operands[4] = GEN_INT (32 - shift - start - size);
3056 operands[1] = GEN_INT (start + size - 1);
3057 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3059 [(set_attr "type" "insert_word")])
3061 (define_insn "*insvsi_internal4"
3062 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3063 (match_operand:SI 1 "const_int_operand" "i")
3064 (match_operand:SI 2 "const_int_operand" "i"))
3065 (zero_extract:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3066 (match_operand:SI 4 "const_int_operand" "i")
3067 (match_operand:SI 5 "const_int_operand" "i")))]
3068 "INTVAL (operands[4]) >= INTVAL (operands[1])"
3071 int extract_start = INTVAL (operands[5]) & 31;
3072 int extract_size = INTVAL (operands[4]) & 31;
3073 int insert_start = INTVAL (operands[2]) & 31;
3074 int insert_size = INTVAL (operands[1]) & 31;
3076 /* Align extract field with insert field */
3077 operands[5] = GEN_INT (extract_start + extract_size - insert_start - insert_size);
3078 operands[1] = GEN_INT (insert_start + insert_size - 1);
3079 return \"{rlimi|rlwimi} %0,%3,%h5,%h2,%h1\";
3081 [(set_attr "type" "insert_word")])
3083 ;; combine patterns for rlwimi
3084 (define_insn "*insvsi_internal5"
3085 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3086 (ior:SI (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
3087 (match_operand:SI 1 "mask_operand" "i"))
3088 (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3089 (match_operand:SI 2 "const_int_operand" "i"))
3090 (match_operand:SI 5 "mask_operand" "i"))))]
3091 "TARGET_POWERPC && INTVAL(operands[1]) == ~INTVAL(operands[5])"
3094 int me = extract_ME(operands[5]);
3095 int mb = extract_MB(operands[5]);
3096 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
3097 operands[2] = GEN_INT(mb);
3098 operands[1] = GEN_INT(me);
3099 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3101 [(set_attr "type" "insert_word")])
3103 (define_insn "*insvsi_internal6"
3104 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3105 (ior:SI (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3106 (match_operand:SI 2 "const_int_operand" "i"))
3107 (match_operand:SI 5 "mask_operand" "i"))
3108 (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
3109 (match_operand:SI 1 "mask_operand" "i"))))]
3110 "TARGET_POWERPC && INTVAL(operands[1]) == ~INTVAL(operands[5])"
3113 int me = extract_ME(operands[5]);
3114 int mb = extract_MB(operands[5]);
3115 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
3116 operands[2] = GEN_INT(mb);
3117 operands[1] = GEN_INT(me);
3118 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3120 [(set_attr "type" "insert_word")])
3122 (define_insn "insvdi"
3123 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3124 (match_operand:SI 1 "const_int_operand" "i")
3125 (match_operand:SI 2 "const_int_operand" "i"))
3126 (match_operand:DI 3 "gpc_reg_operand" "r"))]
3130 int start = INTVAL (operands[2]) & 63;
3131 int size = INTVAL (operands[1]) & 63;
3133 operands[1] = GEN_INT (64 - start - size);
3134 return \"rldimi %0,%3,%H1,%H2\";
3137 (define_insn "*insvdi_internal2"
3138 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3139 (match_operand:SI 1 "const_int_operand" "i")
3140 (match_operand:SI 2 "const_int_operand" "i"))
3141 (ashiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
3142 (match_operand:SI 4 "const_int_operand" "i")))]
3144 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
3147 int shift = INTVAL (operands[4]) & 63;
3148 int start = (INTVAL (operands[2]) & 63) - 32;
3149 int size = INTVAL (operands[1]) & 63;
3151 operands[4] = GEN_INT (64 - shift - start - size);
3152 operands[2] = GEN_INT (start);
3153 operands[1] = GEN_INT (start + size - 1);
3154 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3157 (define_insn "*insvdi_internal3"
3158 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3159 (match_operand:SI 1 "const_int_operand" "i")
3160 (match_operand:SI 2 "const_int_operand" "i"))
3161 (lshiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
3162 (match_operand:SI 4 "const_int_operand" "i")))]
3164 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
3167 int shift = INTVAL (operands[4]) & 63;
3168 int start = (INTVAL (operands[2]) & 63) - 32;
3169 int size = INTVAL (operands[1]) & 63;
3171 operands[4] = GEN_INT (64 - shift - start - size);
3172 operands[2] = GEN_INT (start);
3173 operands[1] = GEN_INT (start + size - 1);
3174 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3177 (define_expand "extzv"
3178 [(set (match_operand 0 "gpc_reg_operand" "")
3179 (zero_extract (match_operand 1 "gpc_reg_operand" "")
3180 (match_operand:SI 2 "const_int_operand" "")
3181 (match_operand:SI 3 "const_int_operand" "")))]
3185 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3186 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3187 compiler if the address of the structure is taken later. */
3188 if (GET_CODE (operands[0]) == SUBREG
3189 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
3192 if (TARGET_POWERPC64 && GET_MODE (operands[1]) == DImode)
3193 emit_insn (gen_extzvdi (operands[0], operands[1], operands[2], operands[3]));
3195 emit_insn (gen_extzvsi (operands[0], operands[1], operands[2], operands[3]));
3199 (define_insn "extzvsi"
3200 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3201 (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3202 (match_operand:SI 2 "const_int_operand" "i")
3203 (match_operand:SI 3 "const_int_operand" "i")))]
3207 int start = INTVAL (operands[3]) & 31;
3208 int size = INTVAL (operands[2]) & 31;
3210 if (start + size >= 32)
3211 operands[3] = const0_rtx;
3213 operands[3] = GEN_INT (start + size);
3214 return \"{rlinm|rlwinm} %0,%1,%3,%s2,31\";
3217 (define_insn "*extzvsi_internal1"
3218 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3219 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3220 (match_operand:SI 2 "const_int_operand" "i,i")
3221 (match_operand:SI 3 "const_int_operand" "i,i"))
3223 (clobber (match_scratch:SI 4 "=r,r"))]
3227 int start = INTVAL (operands[3]) & 31;
3228 int size = INTVAL (operands[2]) & 31;
3230 /* Force split for non-cc0 compare. */
3231 if (which_alternative == 1)
3234 /* If the bit-field being tested fits in the upper or lower half of a
3235 word, it is possible to use andiu. or andil. to test it. This is
3236 useful because the condition register set-use delay is smaller for
3237 andi[ul]. than for rlinm. This doesn't work when the starting bit
3238 position is 0 because the LT and GT bits may be set wrong. */
3240 if ((start > 0 && start + size <= 16) || start >= 16)
3242 operands[3] = GEN_INT (((1 << (16 - (start & 15)))
3243 - (1 << (16 - (start & 15) - size))));
3245 return \"{andiu.|andis.} %4,%1,%3\";
3247 return \"{andil.|andi.} %4,%1,%3\";
3250 if (start + size >= 32)
3251 operands[3] = const0_rtx;
3253 operands[3] = GEN_INT (start + size);
3254 return \"{rlinm.|rlwinm.} %4,%1,%3,%s2,31\";
3256 [(set_attr "type" "compare")
3257 (set_attr "length" "4,8")])
3260 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3261 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3262 (match_operand:SI 2 "const_int_operand" "")
3263 (match_operand:SI 3 "const_int_operand" ""))
3265 (clobber (match_scratch:SI 4 ""))]
3268 (zero_extract:SI (match_dup 1) (match_dup 2)
3271 (compare:CC (match_dup 4)
3275 (define_insn "*extzvsi_internal2"
3276 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3277 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3278 (match_operand:SI 2 "const_int_operand" "i,i")
3279 (match_operand:SI 3 "const_int_operand" "i,i"))
3281 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3282 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3286 int start = INTVAL (operands[3]) & 31;
3287 int size = INTVAL (operands[2]) & 31;
3289 /* Force split for non-cc0 compare. */
3290 if (which_alternative == 1)
3293 /* Since we are using the output value, we can't ignore any need for
3294 a shift. The bit-field must end at the LSB. */
3295 if (start >= 16 && start + size == 32)
3297 operands[3] = GEN_INT ((1 << size) - 1);
3298 return \"{andil.|andi.} %0,%1,%3\";
3301 if (start + size >= 32)
3302 operands[3] = const0_rtx;
3304 operands[3] = GEN_INT (start + size);
3305 return \"{rlinm.|rlwinm.} %0,%1,%3,%s2,31\";
3307 [(set_attr "type" "compare")
3308 (set_attr "length" "4,8")])
3311 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3312 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3313 (match_operand:SI 2 "const_int_operand" "")
3314 (match_operand:SI 3 "const_int_operand" ""))
3316 (set (match_operand:SI 0 "gpc_reg_operand" "")
3317 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3320 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))
3322 (compare:CC (match_dup 0)
3326 (define_insn "extzvdi"
3327 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
3328 (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3329 (match_operand:SI 2 "const_int_operand" "i")
3330 (match_operand:SI 3 "const_int_operand" "i")))]
3334 int start = INTVAL (operands[3]) & 63;
3335 int size = INTVAL (operands[2]) & 63;
3337 if (start + size >= 64)
3338 operands[3] = const0_rtx;
3340 operands[3] = GEN_INT (start + size);
3341 operands[2] = GEN_INT (64 - size);
3342 return \"rldicl %0,%1,%3,%2\";
3345 (define_insn "*extzvdi_internal1"
3346 [(set (match_operand:CC 0 "gpc_reg_operand" "=x")
3347 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3348 (match_operand:SI 2 "const_int_operand" "i")
3349 (match_operand:SI 3 "const_int_operand" "i"))
3351 (clobber (match_scratch:DI 4 "=r"))]
3355 int start = INTVAL (operands[3]) & 63;
3356 int size = INTVAL (operands[2]) & 63;
3358 if (start + size >= 64)
3359 operands[3] = const0_rtx;
3361 operands[3] = GEN_INT (start + size);
3362 operands[2] = GEN_INT (64 - size);
3363 return \"rldicl. %4,%1,%3,%2\";
3365 [(set_attr "type" "compare")])
3367 (define_insn "*extzvdi_internal2"
3368 [(set (match_operand:CC 4 "gpc_reg_operand" "=x")
3369 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3370 (match_operand:SI 2 "const_int_operand" "i")
3371 (match_operand:SI 3 "const_int_operand" "i"))
3373 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
3374 (zero_extract:DI (match_dup 1) (match_dup 2) (match_dup 3)))]
3378 int start = INTVAL (operands[3]) & 63;
3379 int size = INTVAL (operands[2]) & 63;
3381 if (start + size >= 64)
3382 operands[3] = const0_rtx;
3384 operands[3] = GEN_INT (start + size);
3385 operands[2] = GEN_INT (64 - size);
3386 return \"rldicl. %0,%1,%3,%2\";
3388 [(set_attr "type" "compare")])
3390 (define_insn "rotlsi3"
3391 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3392 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3393 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
3395 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xffffffff")
3397 (define_insn "*rotlsi3_internal2"
3398 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3399 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3400 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3402 (clobber (match_scratch:SI 3 "=r,r"))]
3405 {rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xffffffff
3407 [(set_attr "type" "delayed_compare")
3408 (set_attr "length" "4,8")])
3411 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3412 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3413 (match_operand:SI 2 "reg_or_cint_operand" ""))
3415 (clobber (match_scratch:SI 3 ""))]
3418 (rotate:SI (match_dup 1) (match_dup 2)))
3420 (compare:CC (match_dup 3)
3424 (define_insn "*rotlsi3_internal3"
3425 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3426 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3427 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3429 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3430 (rotate:SI (match_dup 1) (match_dup 2)))]
3433 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xffffffff
3435 [(set_attr "type" "delayed_compare")
3436 (set_attr "length" "4,8")])
3439 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3440 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3441 (match_operand:SI 2 "reg_or_cint_operand" ""))
3443 (set (match_operand:SI 0 "gpc_reg_operand" "")
3444 (rotate:SI (match_dup 1) (match_dup 2)))]
3447 (rotate:SI (match_dup 1) (match_dup 2)))
3449 (compare:CC (match_dup 0)
3453 (define_insn "*rotlsi3_internal4"
3454 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3455 (and:SI (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3456 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
3457 (match_operand:SI 3 "mask_operand" "n")))]
3459 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,%m3,%M3")
3461 (define_insn "*rotlsi3_internal5"
3462 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3464 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3465 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3466 (match_operand:SI 3 "mask_operand" "n,n"))
3468 (clobber (match_scratch:SI 4 "=r,r"))]
3471 {rl%I2nm.|rlw%I2nm.} %4,%1,%h2,%m3,%M3
3473 [(set_attr "type" "delayed_compare")
3474 (set_attr "length" "4,8")])
3477 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3479 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3480 (match_operand:SI 2 "reg_or_cint_operand" ""))
3481 (match_operand:SI 3 "mask_operand" ""))
3483 (clobber (match_scratch:SI 4 ""))]
3486 (and:SI (rotate:SI (match_dup 1)
3490 (compare:CC (match_dup 4)
3494 (define_insn "*rotlsi3_internal6"
3495 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3497 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3498 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3499 (match_operand:SI 3 "mask_operand" "n,n"))
3501 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3502 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3505 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,%m3,%M3
3507 [(set_attr "type" "delayed_compare")
3508 (set_attr "length" "4,8")])
3511 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3513 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3514 (match_operand:SI 2 "reg_or_cint_operand" ""))
3515 (match_operand:SI 3 "mask_operand" ""))
3517 (set (match_operand:SI 0 "gpc_reg_operand" "")
3518 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3521 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
3523 (compare:CC (match_dup 0)
3527 (define_insn "*rotlsi3_internal7"
3528 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3531 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3532 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
3534 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xff")
3536 (define_insn "*rotlsi3_internal8"
3537 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3538 (compare:CC (zero_extend:SI
3540 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3541 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
3543 (clobber (match_scratch:SI 3 "=r,r"))]
3546 {rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xff
3548 [(set_attr "type" "delayed_compare")
3549 (set_attr "length" "4,8")])
3552 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3553 (compare:CC (zero_extend:SI
3555 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3556 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3558 (clobber (match_scratch:SI 3 ""))]
3561 (zero_extend:SI (subreg:QI
3562 (rotate:SI (match_dup 1)
3565 (compare:CC (match_dup 3)
3569 (define_insn "*rotlsi3_internal9"
3570 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3571 (compare:CC (zero_extend:SI
3573 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3574 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
3576 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3577 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3580 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xff
3582 [(set_attr "type" "delayed_compare")
3583 (set_attr "length" "4,8")])
3586 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3587 (compare:CC (zero_extend:SI
3589 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3590 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3592 (set (match_operand:SI 0 "gpc_reg_operand" "")
3593 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3596 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
3598 (compare:CC (match_dup 0)
3602 (define_insn "*rotlsi3_internal10"
3603 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3606 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3607 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
3609 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xffff")
3611 (define_insn "*rotlsi3_internal11"
3612 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3613 (compare:CC (zero_extend:SI
3615 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3616 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
3618 (clobber (match_scratch:SI 3 "=r,r"))]
3621 {rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xffff
3623 [(set_attr "type" "delayed_compare")
3624 (set_attr "length" "4,8")])
3627 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3628 (compare:CC (zero_extend:SI
3630 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3631 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3633 (clobber (match_scratch:SI 3 ""))]
3636 (zero_extend:SI (subreg:HI
3637 (rotate:SI (match_dup 1)
3640 (compare:CC (match_dup 3)
3644 (define_insn "*rotlsi3_internal12"
3645 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3646 (compare:CC (zero_extend:SI
3648 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3649 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
3651 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3652 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3655 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xffff
3657 [(set_attr "type" "delayed_compare")
3658 (set_attr "length" "4,8")])
3661 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3662 (compare:CC (zero_extend:SI
3664 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3665 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3667 (set (match_operand:SI 0 "gpc_reg_operand" "")
3668 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3671 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
3673 (compare:CC (match_dup 0)
3677 ;; Note that we use "sle." instead of "sl." so that we can set
3678 ;; SHIFT_COUNT_TRUNCATED.
3680 (define_expand "ashlsi3"
3681 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
3682 (use (match_operand:SI 1 "gpc_reg_operand" ""))
3683 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
3688 emit_insn (gen_ashlsi3_power (operands[0], operands[1], operands[2]));
3690 emit_insn (gen_ashlsi3_no_power (operands[0], operands[1], operands[2]));
3694 (define_insn "ashlsi3_power"
3695 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3696 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3697 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
3698 (clobber (match_scratch:SI 3 "=q,X"))]
3702 {sli|slwi} %0,%1,%h2")
3704 (define_insn "ashlsi3_no_power"
3705 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3706 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3707 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
3709 "{sl|slw}%I2 %0,%1,%h2")
3712 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3713 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3714 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3716 (clobber (match_scratch:SI 3 "=r,r,r,r"))
3717 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
3721 {sli.|slwi.} %3,%1,%h2
3724 [(set_attr "type" "delayed_compare")
3725 (set_attr "length" "4,4,8,8")])
3728 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3729 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3730 (match_operand:SI 2 "reg_or_cint_operand" ""))
3732 (clobber (match_scratch:SI 3 ""))
3733 (clobber (match_scratch:SI 4 ""))]
3734 "TARGET_POWER && reload_completed"
3735 [(parallel [(set (match_dup 3)
3736 (ashift:SI (match_dup 1) (match_dup 2)))
3737 (clobber (match_dup 4))])
3739 (compare:CC (match_dup 3)
3744 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3745 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3746 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3748 (clobber (match_scratch:SI 3 "=r,r"))]
3749 "! TARGET_POWER && TARGET_32BIT"
3751 {sl|slw}%I2. %3,%1,%h2
3753 [(set_attr "type" "delayed_compare")
3754 (set_attr "length" "4,8")])
3757 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3758 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3759 (match_operand:SI 2 "reg_or_cint_operand" ""))
3761 (clobber (match_scratch:SI 3 ""))]
3762 "! TARGET_POWER && TARGET_32BIT && reload_completed"
3764 (ashift:SI (match_dup 1) (match_dup 2)))
3766 (compare:CC (match_dup 3)
3771 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
3772 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3773 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3775 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
3776 (ashift:SI (match_dup 1) (match_dup 2)))
3777 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
3781 {sli.|slwi.} %0,%1,%h2
3784 [(set_attr "type" "delayed_compare")
3785 (set_attr "length" "4,4,8,8")])
3788 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3789 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3790 (match_operand:SI 2 "reg_or_cint_operand" ""))
3792 (set (match_operand:SI 0 "gpc_reg_operand" "")
3793 (ashift:SI (match_dup 1) (match_dup 2)))
3794 (clobber (match_scratch:SI 4 ""))]
3795 "TARGET_POWER && reload_completed"
3796 [(parallel [(set (match_dup 0)
3797 (ashift:SI (match_dup 1) (match_dup 2)))
3798 (clobber (match_dup 4))])
3800 (compare:CC (match_dup 0)
3805 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3806 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3807 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3809 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3810 (ashift:SI (match_dup 1) (match_dup 2)))]
3811 "! TARGET_POWER && TARGET_32BIT"
3813 {sl|slw}%I2. %0,%1,%h2
3815 [(set_attr "type" "delayed_compare")
3816 (set_attr "length" "4,8")])
3819 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3820 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3821 (match_operand:SI 2 "reg_or_cint_operand" ""))
3823 (set (match_operand:SI 0 "gpc_reg_operand" "")
3824 (ashift:SI (match_dup 1) (match_dup 2)))]
3825 "! TARGET_POWER && TARGET_32BIT && reload_completed"
3827 (ashift:SI (match_dup 1) (match_dup 2)))
3829 (compare:CC (match_dup 0)
3833 (define_insn "rlwinm"
3834 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3835 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3836 (match_operand:SI 2 "const_int_operand" "i"))
3837 (match_operand:SI 3 "mask_operand" "n")))]
3838 "includes_lshift_p (operands[2], operands[3])"
3839 "{rlinm|rlwinm} %0,%1,%h2,%m3,%M3")
3842 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3844 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3845 (match_operand:SI 2 "const_int_operand" "i,i"))
3846 (match_operand:SI 3 "mask_operand" "n,n"))
3848 (clobber (match_scratch:SI 4 "=r,r"))]
3849 "includes_lshift_p (operands[2], operands[3])"
3851 {rlinm.|rlwinm.} %4,%1,%h2,%m3,%M3
3853 [(set_attr "type" "delayed_compare")
3854 (set_attr "length" "4,8")])
3857 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3859 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3860 (match_operand:SI 2 "const_int_operand" ""))
3861 (match_operand:SI 3 "mask_operand" ""))
3863 (clobber (match_scratch:SI 4 ""))]
3864 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
3866 (and:SI (ashift:SI (match_dup 1) (match_dup 2))
3869 (compare:CC (match_dup 4)
3874 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3876 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3877 (match_operand:SI 2 "const_int_operand" "i,i"))
3878 (match_operand:SI 3 "mask_operand" "n,n"))
3880 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3881 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3882 "includes_lshift_p (operands[2], operands[3])"
3884 {rlinm.|rlwinm.} %0,%1,%h2,%m3,%M3
3886 [(set_attr "type" "delayed_compare")
3887 (set_attr "length" "4,8")])
3890 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3892 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3893 (match_operand:SI 2 "const_int_operand" ""))
3894 (match_operand:SI 3 "mask_operand" ""))
3896 (set (match_operand:SI 0 "gpc_reg_operand" "")
3897 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3898 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
3900 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
3902 (compare:CC (match_dup 0)
3906 ;; The AIX assembler mis-handles "sri x,x,0", so write that case as
3908 (define_expand "lshrsi3"
3909 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
3910 (use (match_operand:SI 1 "gpc_reg_operand" ""))
3911 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
3916 emit_insn (gen_lshrsi3_power (operands[0], operands[1], operands[2]));
3918 emit_insn (gen_lshrsi3_no_power (operands[0], operands[1], operands[2]));
3922 (define_insn "lshrsi3_power"
3923 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
3924 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
3925 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i")))
3926 (clobber (match_scratch:SI 3 "=q,X,X"))]
3931 {s%A2i|s%A2wi} %0,%1,%h2")
3933 (define_insn "lshrsi3_no_power"
3934 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3935 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3936 (match_operand:SI 2 "reg_or_cint_operand" "O,ri")))]
3940 {sr|srw}%I2 %0,%1,%h2")
3943 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,?y,?y,?y")
3944 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
3945 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
3947 (clobber (match_scratch:SI 3 "=r,X,r,r,X,r"))
3948 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
3953 {s%A2i.|s%A2wi.} %3,%1,%h2
3957 [(set_attr "type" "delayed_compare")
3958 (set_attr "length" "4,4,4,8,8,8")])
3961 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3962 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
3963 (match_operand:SI 2 "reg_or_cint_operand" ""))
3965 (clobber (match_scratch:SI 3 ""))
3966 (clobber (match_scratch:SI 4 ""))]
3967 "TARGET_POWER && reload_completed"
3968 [(parallel [(set (match_dup 3)
3969 (lshiftrt:SI (match_dup 1) (match_dup 2)))
3970 (clobber (match_dup 4))])
3972 (compare:CC (match_dup 3)
3977 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3978 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3979 (match_operand:SI 2 "reg_or_cint_operand" "O,ri,O,ri"))
3981 (clobber (match_scratch:SI 3 "=X,r,X,r"))]
3982 "! TARGET_POWER && TARGET_32BIT"
3985 {sr|srw}%I2. %3,%1,%h2
3988 [(set_attr "type" "delayed_compare")
3989 (set_attr "length" "4,4,8,8")])
3992 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3993 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
3994 (match_operand:SI 2 "reg_or_cint_operand" ""))
3996 (clobber (match_scratch:SI 3 ""))]
3997 "! TARGET_POWER && TARGET_32BIT && reload_completed"
3999 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4001 (compare:CC (match_dup 3)
4006 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,?y,?y,?y")
4007 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
4008 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
4010 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
4011 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4012 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
4017 {s%A2i.|s%A2wi.} %0,%1,%h2
4021 [(set_attr "type" "delayed_compare")
4022 (set_attr "length" "4,4,4,8,8,8")])
4025 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4026 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4027 (match_operand:SI 2 "reg_or_cint_operand" ""))
4029 (set (match_operand:SI 0 "gpc_reg_operand" "")
4030 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4031 (clobber (match_scratch:SI 4 ""))]
4032 "TARGET_POWER && reload_completed"
4033 [(parallel [(set (match_dup 0)
4034 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4035 (clobber (match_dup 4))])
4037 (compare:CC (match_dup 0)
4042 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4043 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4044 (match_operand:SI 2 "reg_or_cint_operand" "O,ri,O,ri"))
4046 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4047 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
4048 "! TARGET_POWER && TARGET_32BIT"
4051 {sr|srw}%I2. %0,%1,%h2
4054 [(set_attr "type" "delayed_compare")
4055 (set_attr "length" "4,4,8,8")])
4058 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4059 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4060 (match_operand:SI 2 "reg_or_cint_operand" ""))
4062 (set (match_operand:SI 0 "gpc_reg_operand" "")
4063 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
4064 "! TARGET_POWER && TARGET_32BIT && reload_completed"
4066 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4068 (compare:CC (match_dup 0)
4073 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4074 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4075 (match_operand:SI 2 "const_int_operand" "i"))
4076 (match_operand:SI 3 "mask_operand" "n")))]
4077 "includes_rshift_p (operands[2], operands[3])"
4078 "{rlinm|rlwinm} %0,%1,%s2,%m3,%M3")
4081 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4083 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4084 (match_operand:SI 2 "const_int_operand" "i,i"))
4085 (match_operand:SI 3 "mask_operand" "n,n"))
4087 (clobber (match_scratch:SI 4 "=r,r"))]
4088 "includes_rshift_p (operands[2], operands[3])"
4090 {rlinm.|rlwinm.} %4,%1,%s2,%m3,%M3
4092 [(set_attr "type" "delayed_compare")
4093 (set_attr "length" "4,8")])
4096 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4098 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4099 (match_operand:SI 2 "const_int_operand" ""))
4100 (match_operand:SI 3 "mask_operand" ""))
4102 (clobber (match_scratch:SI 4 ""))]
4103 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
4105 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2))
4108 (compare:CC (match_dup 4)
4113 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4115 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4116 (match_operand:SI 2 "const_int_operand" "i,i"))
4117 (match_operand:SI 3 "mask_operand" "n,n"))
4119 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4120 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4121 "includes_rshift_p (operands[2], operands[3])"
4123 {rlinm.|rlwinm.} %0,%1,%s2,%m3,%M3
4125 [(set_attr "type" "delayed_compare")
4126 (set_attr "length" "4,8")])
4129 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
4131 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4132 (match_operand:SI 2 "const_int_operand" ""))
4133 (match_operand:SI 3 "mask_operand" ""))
4135 (set (match_operand:SI 0 "gpc_reg_operand" "")
4136 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4137 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
4139 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4141 (compare:CC (match_dup 0)
4146 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4149 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4150 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4151 "includes_rshift_p (operands[2], GEN_INT (255))"
4152 "{rlinm|rlwinm} %0,%1,%s2,0xff")
4155 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4159 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4160 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4162 (clobber (match_scratch:SI 3 "=r,r"))]
4163 "includes_rshift_p (operands[2], GEN_INT (255))"
4165 {rlinm.|rlwinm.} %3,%1,%s2,0xff
4167 [(set_attr "type" "delayed_compare")
4168 (set_attr "length" "4,8")])
4171 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4175 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4176 (match_operand:SI 2 "const_int_operand" "")) 0))
4178 (clobber (match_scratch:SI 3 ""))]
4179 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4181 (zero_extend:SI (subreg:QI
4182 (lshiftrt:SI (match_dup 1)
4185 (compare:CC (match_dup 3)
4190 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4194 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4195 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4197 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4198 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4199 "includes_rshift_p (operands[2], GEN_INT (255))"
4201 {rlinm.|rlwinm.} %0,%1,%s2,0xff
4203 [(set_attr "type" "delayed_compare")
4204 (set_attr "length" "4,8")])
4207 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4211 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4212 (match_operand:SI 2 "const_int_operand" "")) 0))
4214 (set (match_operand:SI 0 "gpc_reg_operand" "")
4215 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4216 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4218 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4220 (compare:CC (match_dup 0)
4225 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4228 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4229 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4230 "includes_rshift_p (operands[2], GEN_INT (65535))"
4231 "{rlinm|rlwinm} %0,%1,%s2,0xffff")
4234 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4238 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4239 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4241 (clobber (match_scratch:SI 3 "=r,r"))]
4242 "includes_rshift_p (operands[2], GEN_INT (65535))"
4244 {rlinm.|rlwinm.} %3,%1,%s2,0xffff
4246 [(set_attr "type" "delayed_compare")
4247 (set_attr "length" "4,8")])
4250 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4254 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4255 (match_operand:SI 2 "const_int_operand" "")) 0))
4257 (clobber (match_scratch:SI 3 ""))]
4258 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4260 (zero_extend:SI (subreg:HI
4261 (lshiftrt:SI (match_dup 1)
4264 (compare:CC (match_dup 3)
4269 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4273 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4274 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4276 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4277 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4278 "includes_rshift_p (operands[2], GEN_INT (65535))"
4280 {rlinm.|rlwinm.} %0,%1,%s2,0xffff
4282 [(set_attr "type" "delayed_compare")
4283 (set_attr "length" "4,8")])
4286 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4290 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4291 (match_operand:SI 2 "const_int_operand" "")) 0))
4293 (set (match_operand:SI 0 "gpc_reg_operand" "")
4294 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4295 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4297 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4299 (compare:CC (match_dup 0)
4304 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4306 (match_operand:SI 1 "gpc_reg_operand" "r"))
4307 (ashiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4313 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4315 (match_operand:SI 1 "gpc_reg_operand" "r"))
4316 (lshiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4322 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4324 (match_operand:SI 1 "gpc_reg_operand" "r"))
4325 (zero_extract:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4331 (define_expand "ashrsi3"
4332 [(set (match_operand:SI 0 "gpc_reg_operand" "")
4333 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4334 (match_operand:SI 2 "reg_or_cint_operand" "")))]
4339 emit_insn (gen_ashrsi3_power (operands[0], operands[1], operands[2]));
4341 emit_insn (gen_ashrsi3_no_power (operands[0], operands[1], operands[2]));
4345 (define_insn "ashrsi3_power"
4346 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4347 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4348 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
4349 (clobber (match_scratch:SI 3 "=q,X"))]
4353 {srai|srawi} %0,%1,%h2")
4355 (define_insn "ashrsi3_no_power"
4356 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4357 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4358 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
4360 "{sra|sraw}%I2 %0,%1,%h2")
4363 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4364 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4365 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4367 (clobber (match_scratch:SI 3 "=r,r,r,r"))
4368 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4372 {srai.|srawi.} %3,%1,%h2
4375 [(set_attr "type" "delayed_compare")
4376 (set_attr "length" "4,4,8,8")])
4379 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4380 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4381 (match_operand:SI 2 "reg_or_cint_operand" ""))
4383 (clobber (match_scratch:SI 3 ""))
4384 (clobber (match_scratch:SI 4 ""))]
4385 "TARGET_POWER && reload_completed"
4386 [(parallel [(set (match_dup 3)
4387 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4388 (clobber (match_dup 4))])
4390 (compare:CC (match_dup 3)
4395 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4396 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4397 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
4399 (clobber (match_scratch:SI 3 "=r,r"))]
4402 {sra|sraw}%I2. %3,%1,%h2
4404 [(set_attr "type" "delayed_compare")
4405 (set_attr "length" "4,8")])
4408 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4409 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4410 (match_operand:SI 2 "reg_or_cint_operand" ""))
4412 (clobber (match_scratch:SI 3 ""))]
4413 "! TARGET_POWER && reload_completed"
4415 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4417 (compare:CC (match_dup 3)
4422 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4423 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4424 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4426 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4427 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4428 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4432 {srai.|srawi.} %0,%1,%h2
4435 [(set_attr "type" "delayed_compare")
4436 (set_attr "length" "4,4,8,8")])
4439 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4440 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4441 (match_operand:SI 2 "reg_or_cint_operand" ""))
4443 (set (match_operand:SI 0 "gpc_reg_operand" "")
4444 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4445 (clobber (match_scratch:SI 4 ""))]
4446 "TARGET_POWER && reload_completed"
4447 [(parallel [(set (match_dup 0)
4448 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4449 (clobber (match_dup 4))])
4451 (compare:CC (match_dup 0)
4456 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4457 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4458 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
4460 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4461 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
4464 {sra|sraw}%I2. %0,%1,%h2
4466 [(set_attr "type" "delayed_compare")
4467 (set_attr "length" "4,8")])
4470 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4471 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4472 (match_operand:SI 2 "reg_or_cint_operand" ""))
4474 (set (match_operand:SI 0 "gpc_reg_operand" "")
4475 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
4476 "! TARGET_POWER && reload_completed"
4478 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4480 (compare:CC (match_dup 0)
4484 ;; Floating-point insns, excluding normal data motion.
4486 ;; PowerPC has a full set of single-precision floating point instructions.
4488 ;; For the POWER architecture, we pretend that we have both SFmode and
4489 ;; DFmode insns, while, in fact, all fp insns are actually done in double.
4490 ;; The only conversions we will do will be when storing to memory. In that
4491 ;; case, we will use the "frsp" instruction before storing.
4493 ;; Note that when we store into a single-precision memory location, we need to
4494 ;; use the frsp insn first. If the register being stored isn't dead, we
4495 ;; need a scratch register for the frsp. But this is difficult when the store
4496 ;; is done by reload. It is not incorrect to do the frsp on the register in
4497 ;; this case, we just lose precision that we would have otherwise gotten but
4498 ;; is not guaranteed. Perhaps this should be tightened up at some point.
4500 (define_expand "extendsfdf2"
4501 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4502 (float_extend:DF (match_operand:SF 1 "reg_or_none500mem_operand" "")))]
4503 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
4506 (define_insn_and_split "*extendsfdf2_fpr"
4507 [(set (match_operand:DF 0 "gpc_reg_operand" "=f,?f,f")
4508 (float_extend:DF (match_operand:SF 1 "reg_or_mem_operand" "0,f,m")))]
4509 "TARGET_HARD_FLOAT && TARGET_FPRS"
4514 "&& reload_completed && REG_P (operands[1]) && REGNO (operands[0]) == REGNO (operands[1])"
4517 emit_note (NOTE_INSN_DELETED);
4520 [(set_attr "type" "fp,fp,fpload")])
4522 (define_expand "truncdfsf2"
4523 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4524 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "")))]
4525 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
4528 (define_insn "*truncdfsf2_fpr"
4529 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4530 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "f")))]
4531 "TARGET_HARD_FLOAT && TARGET_FPRS"
4533 [(set_attr "type" "fp")])
4535 (define_insn "aux_truncdfsf2"
4536 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4537 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRSP))]
4538 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4540 [(set_attr "type" "fp")])
4542 (define_expand "negsf2"
4543 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4544 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
4548 (define_insn "*negsf2"
4549 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4550 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4551 "TARGET_HARD_FLOAT && TARGET_FPRS"
4553 [(set_attr "type" "fp")])
4555 (define_expand "abssf2"
4556 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4557 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
4561 (define_insn "*abssf2"
4562 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4563 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4564 "TARGET_HARD_FLOAT && TARGET_FPRS"
4566 [(set_attr "type" "fp")])
4569 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4570 (neg:SF (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f"))))]
4571 "TARGET_HARD_FLOAT && TARGET_FPRS"
4573 [(set_attr "type" "fp")])
4575 (define_expand "addsf3"
4576 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4577 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "")
4578 (match_operand:SF 2 "gpc_reg_operand" "")))]
4583 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4584 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4585 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4586 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4588 [(set_attr "type" "fp")])
4591 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4592 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4593 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4594 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4595 "{fa|fadd} %0,%1,%2"
4596 [(set_attr "type" "fp")])
4598 (define_expand "subsf3"
4599 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4600 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "")
4601 (match_operand:SF 2 "gpc_reg_operand" "")))]
4606 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4607 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4608 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4609 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4611 [(set_attr "type" "fp")])
4614 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4615 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4616 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4617 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4618 "{fs|fsub} %0,%1,%2"
4619 [(set_attr "type" "fp")])
4621 (define_expand "mulsf3"
4622 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4623 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "")
4624 (match_operand:SF 2 "gpc_reg_operand" "")))]
4629 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4630 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4631 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4632 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4634 [(set_attr "type" "fp")])
4637 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4638 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4639 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4640 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4641 "{fm|fmul} %0,%1,%2"
4642 [(set_attr "type" "dmul")])
4645 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4646 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))]
4647 "TARGET_PPC_GFXOPT && flag_finite_math_only"
4649 [(set_attr "type" "fp")])
4651 (define_expand "divsf3"
4652 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4653 (div:SF (match_operand:SF 1 "gpc_reg_operand" "")
4654 (match_operand:SF 2 "gpc_reg_operand" "")))]
4657 if (swdiv && !optimize_size && TARGET_PPC_GFXOPT
4658 && flag_finite_math_only && !flag_trapping_math)
4660 rs6000_emit_swdivsf (operands[0], operands[1], operands[2]);
4666 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4667 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4668 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4669 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4671 [(set_attr "type" "sdiv")])
4674 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4675 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4676 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4677 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4678 "{fd|fdiv} %0,%1,%2"
4679 [(set_attr "type" "ddiv")])
4682 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4683 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4684 (match_operand:SF 2 "gpc_reg_operand" "f"))
4685 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4686 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4687 "fmadds %0,%1,%2,%3"
4688 [(set_attr "type" "fp")])
4691 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4692 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4693 (match_operand:SF 2 "gpc_reg_operand" "f"))
4694 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4695 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4696 "{fma|fmadd} %0,%1,%2,%3"
4697 [(set_attr "type" "dmul")])
4700 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4701 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4702 (match_operand:SF 2 "gpc_reg_operand" "f"))
4703 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4704 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4705 "fmsubs %0,%1,%2,%3"
4706 [(set_attr "type" "fp")])
4709 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4710 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4711 (match_operand:SF 2 "gpc_reg_operand" "f"))
4712 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4713 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4714 "{fms|fmsub} %0,%1,%2,%3"
4715 [(set_attr "type" "dmul")])
4718 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4719 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4720 (match_operand:SF 2 "gpc_reg_operand" "f"))
4721 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
4722 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4723 && HONOR_SIGNED_ZEROS (SFmode)"
4724 "fnmadds %0,%1,%2,%3"
4725 [(set_attr "type" "fp")])
4728 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4729 (minus:SF (mult:SF (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f"))
4730 (match_operand:SF 2 "gpc_reg_operand" "f"))
4731 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4732 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4733 && ! HONOR_SIGNED_ZEROS (SFmode)"
4734 "fnmadds %0,%1,%2,%3"
4735 [(set_attr "type" "fp")])
4738 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4739 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4740 (match_operand:SF 2 "gpc_reg_operand" "f"))
4741 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
4742 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4743 "{fnma|fnmadd} %0,%1,%2,%3"
4744 [(set_attr "type" "dmul")])
4747 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4748 (minus:SF (mult:SF (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f"))
4749 (match_operand:SF 2 "gpc_reg_operand" "f"))
4750 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4751 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4752 && ! HONOR_SIGNED_ZEROS (SFmode)"
4753 "{fnma|fnmadd} %0,%1,%2,%3"
4754 [(set_attr "type" "dmul")])
4757 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4758 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4759 (match_operand:SF 2 "gpc_reg_operand" "f"))
4760 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
4761 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4762 && HONOR_SIGNED_ZEROS (SFmode)"
4763 "fnmsubs %0,%1,%2,%3"
4764 [(set_attr "type" "fp")])
4767 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4768 (minus:SF (match_operand:SF 3 "gpc_reg_operand" "f")
4769 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4770 (match_operand:SF 2 "gpc_reg_operand" "f"))))]
4771 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4772 && ! HONOR_SIGNED_ZEROS (SFmode)"
4773 "fnmsubs %0,%1,%2,%3"
4774 [(set_attr "type" "fp")])
4777 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4778 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4779 (match_operand:SF 2 "gpc_reg_operand" "f"))
4780 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
4781 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4782 "{fnms|fnmsub} %0,%1,%2,%3"
4783 [(set_attr "type" "dmul")])
4786 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4787 (minus:SF (match_operand:SF 3 "gpc_reg_operand" "f")
4788 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4789 (match_operand:SF 2 "gpc_reg_operand" "f"))))]
4790 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4791 && ! HONOR_SIGNED_ZEROS (SFmode)"
4792 "{fnms|fnmsub} %0,%1,%2,%3"
4793 [(set_attr "type" "fp")])
4795 (define_expand "sqrtsf2"
4796 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4797 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
4798 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS"
4802 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4803 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4804 "TARGET_PPC_GPOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4806 [(set_attr "type" "ssqrt")])
4809 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4810 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4811 "TARGET_POWER2 && TARGET_HARD_FLOAT && TARGET_FPRS"
4813 [(set_attr "type" "dsqrt")])
4815 (define_expand "copysignsf3"
4817 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "")))
4819 (neg:SF (abs:SF (match_dup 1))))
4820 (set (match_operand:SF 0 "gpc_reg_operand" "")
4821 (if_then_else:SF (ge (match_operand:SF 2 "gpc_reg_operand" "")
4825 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
4826 && !HONOR_NANS (SFmode) && !HONOR_SIGNED_ZEROS (SFmode)"
4828 operands[3] = gen_reg_rtx (SFmode);
4829 operands[4] = gen_reg_rtx (SFmode);
4830 operands[5] = CONST0_RTX (SFmode);
4833 (define_expand "copysigndf3"
4835 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "")))
4837 (neg:DF (abs:DF (match_dup 1))))
4838 (set (match_operand:DF 0 "gpc_reg_operand" "")
4839 (if_then_else:DF (ge (match_operand:DF 2 "gpc_reg_operand" "")
4843 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
4844 && !HONOR_NANS (DFmode) && !HONOR_SIGNED_ZEROS (DFmode)"
4846 operands[3] = gen_reg_rtx (DFmode);
4847 operands[4] = gen_reg_rtx (DFmode);
4848 operands[5] = CONST0_RTX (DFmode);
4851 ;; For MIN, MAX, and conditional move, we use DEFINE_EXPAND's that involve a
4852 ;; fsel instruction and some auxiliary computations. Then we just have a
4853 ;; single DEFINE_INSN for fsel and the define_splits to make them if made by
4855 (define_expand "smaxsf3"
4856 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4857 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
4858 (match_operand:SF 2 "gpc_reg_operand" ""))
4861 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
4862 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
4864 (define_expand "sminsf3"
4865 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4866 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
4867 (match_operand:SF 2 "gpc_reg_operand" ""))
4870 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
4871 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
4874 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4875 (match_operator:SF 3 "min_max_operator"
4876 [(match_operand:SF 1 "gpc_reg_operand" "")
4877 (match_operand:SF 2 "gpc_reg_operand" "")]))]
4878 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
4881 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
4882 operands[1], operands[2]);
4886 (define_expand "movsicc"
4887 [(set (match_operand:SI 0 "gpc_reg_operand" "")
4888 (if_then_else:SI (match_operand 1 "comparison_operator" "")
4889 (match_operand:SI 2 "gpc_reg_operand" "")
4890 (match_operand:SI 3 "gpc_reg_operand" "")))]
4894 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
4900 ;; We use the BASE_REGS for the isel input operands because, if rA is
4901 ;; 0, the value of 0 is placed in rD upon truth. Similarly for rB
4902 ;; because we may switch the operands and rB may end up being rA.
4904 ;; We need 2 patterns: an unsigned and a signed pattern. We could
4905 ;; leave out the mode in operand 4 and use one pattern, but reload can
4906 ;; change the mode underneath our feet and then gets confused trying
4907 ;; to reload the value.
4908 (define_insn "isel_signed"
4909 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4911 (match_operator 1 "comparison_operator"
4912 [(match_operand:CC 4 "cc_reg_operand" "y")
4914 (match_operand:SI 2 "gpc_reg_operand" "b")
4915 (match_operand:SI 3 "gpc_reg_operand" "b")))]
4918 { return output_isel (operands); }"
4919 [(set_attr "length" "4")])
4921 (define_insn "isel_unsigned"
4922 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4924 (match_operator 1 "comparison_operator"
4925 [(match_operand:CCUNS 4 "cc_reg_operand" "y")
4927 (match_operand:SI 2 "gpc_reg_operand" "b")
4928 (match_operand:SI 3 "gpc_reg_operand" "b")))]
4931 { return output_isel (operands); }"
4932 [(set_attr "length" "4")])
4934 (define_expand "movsfcc"
4935 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4936 (if_then_else:SF (match_operand 1 "comparison_operator" "")
4937 (match_operand:SF 2 "gpc_reg_operand" "")
4938 (match_operand:SF 3 "gpc_reg_operand" "")))]
4939 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4942 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
4948 (define_insn "*fselsfsf4"
4949 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4950 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
4951 (match_operand:SF 4 "zero_fp_constant" "F"))
4952 (match_operand:SF 2 "gpc_reg_operand" "f")
4953 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4954 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4956 [(set_attr "type" "fp")])
4958 (define_insn "*fseldfsf4"
4959 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4960 (if_then_else:SF (ge (match_operand:DF 1 "gpc_reg_operand" "f")
4961 (match_operand:DF 4 "zero_fp_constant" "F"))
4962 (match_operand:SF 2 "gpc_reg_operand" "f")
4963 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4964 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4966 [(set_attr "type" "fp")])
4968 (define_expand "negdf2"
4969 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4970 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
4971 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
4974 (define_insn "*negdf2_fpr"
4975 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4976 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
4977 "TARGET_HARD_FLOAT && TARGET_FPRS"
4979 [(set_attr "type" "fp")])
4981 (define_expand "absdf2"
4982 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4983 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
4984 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
4987 (define_insn "*absdf2_fpr"
4988 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4989 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
4990 "TARGET_HARD_FLOAT && TARGET_FPRS"
4992 [(set_attr "type" "fp")])
4994 (define_insn "*nabsdf2_fpr"
4995 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4996 (neg:DF (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f"))))]
4997 "TARGET_HARD_FLOAT && TARGET_FPRS"
4999 [(set_attr "type" "fp")])
5001 (define_expand "adddf3"
5002 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5003 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "")
5004 (match_operand:DF 2 "gpc_reg_operand" "")))]
5005 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5008 (define_insn "*adddf3_fpr"
5009 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5010 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5011 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5012 "TARGET_HARD_FLOAT && TARGET_FPRS"
5013 "{fa|fadd} %0,%1,%2"
5014 [(set_attr "type" "fp")])
5016 (define_expand "subdf3"
5017 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5018 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "")
5019 (match_operand:DF 2 "gpc_reg_operand" "")))]
5020 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5023 (define_insn "*subdf3_fpr"
5024 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5025 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "f")
5026 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5027 "TARGET_HARD_FLOAT && TARGET_FPRS"
5028 "{fs|fsub} %0,%1,%2"
5029 [(set_attr "type" "fp")])
5031 (define_expand "muldf3"
5032 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5033 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "")
5034 (match_operand:DF 2 "gpc_reg_operand" "")))]
5035 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5038 (define_insn "*muldf3_fpr"
5039 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5040 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5041 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5042 "TARGET_HARD_FLOAT && TARGET_FPRS"
5043 "{fm|fmul} %0,%1,%2"
5044 [(set_attr "type" "dmul")])
5047 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5048 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))]
5049 "TARGET_POPCNTB && flag_finite_math_only"
5051 [(set_attr "type" "fp")])
5053 (define_expand "divdf3"
5054 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5055 (div:DF (match_operand:DF 1 "gpc_reg_operand" "")
5056 (match_operand:DF 2 "gpc_reg_operand" "")))]
5057 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5059 if (swdiv && !optimize_size && TARGET_POPCNTB
5060 && flag_finite_math_only && !flag_trapping_math)
5062 rs6000_emit_swdivdf (operands[0], operands[1], operands[2]);
5067 (define_insn "*divdf3_fpr"
5068 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5069 (div:DF (match_operand:DF 1 "gpc_reg_operand" "f")
5070 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5071 "TARGET_HARD_FLOAT && TARGET_FPRS"
5072 "{fd|fdiv} %0,%1,%2"
5073 [(set_attr "type" "ddiv")])
5076 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5077 (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5078 (match_operand:DF 2 "gpc_reg_operand" "f"))
5079 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5080 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5081 "{fma|fmadd} %0,%1,%2,%3"
5082 [(set_attr "type" "dmul")])
5085 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5086 (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5087 (match_operand:DF 2 "gpc_reg_operand" "f"))
5088 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5089 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5090 "{fms|fmsub} %0,%1,%2,%3"
5091 [(set_attr "type" "dmul")])
5094 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5095 (neg:DF (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5096 (match_operand:DF 2 "gpc_reg_operand" "f"))
5097 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
5098 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5099 && HONOR_SIGNED_ZEROS (DFmode)"
5100 "{fnma|fnmadd} %0,%1,%2,%3"
5101 [(set_attr "type" "dmul")])
5104 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5105 (minus:DF (mult:DF (neg:DF (match_operand:DF 1 "gpc_reg_operand" "f"))
5106 (match_operand:DF 2 "gpc_reg_operand" "f"))
5107 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5108 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5109 && ! HONOR_SIGNED_ZEROS (DFmode)"
5110 "{fnma|fnmadd} %0,%1,%2,%3"
5111 [(set_attr "type" "dmul")])
5114 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5115 (neg:DF (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5116 (match_operand:DF 2 "gpc_reg_operand" "f"))
5117 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
5118 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5119 && HONOR_SIGNED_ZEROS (DFmode)"
5120 "{fnms|fnmsub} %0,%1,%2,%3"
5121 [(set_attr "type" "dmul")])
5124 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5125 (minus:DF (match_operand:DF 3 "gpc_reg_operand" "f")
5126 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5127 (match_operand:DF 2 "gpc_reg_operand" "f"))))]
5128 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5129 && ! HONOR_SIGNED_ZEROS (DFmode)"
5130 "{fnms|fnmsub} %0,%1,%2,%3"
5131 [(set_attr "type" "dmul")])
5133 (define_insn "sqrtdf2"
5134 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5135 (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
5136 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS"
5138 [(set_attr "type" "dsqrt")])
5140 ;; The conditional move instructions allow us to perform max and min
5141 ;; operations even when
5143 (define_expand "smaxdf3"
5144 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5145 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
5146 (match_operand:DF 2 "gpc_reg_operand" ""))
5149 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
5150 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
5152 (define_expand "smindf3"
5153 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5154 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
5155 (match_operand:DF 2 "gpc_reg_operand" ""))
5158 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
5159 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
5162 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5163 (match_operator:DF 3 "min_max_operator"
5164 [(match_operand:DF 1 "gpc_reg_operand" "")
5165 (match_operand:DF 2 "gpc_reg_operand" "")]))]
5166 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
5169 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
5170 operands[1], operands[2]);
5174 (define_expand "movdfcc"
5175 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5176 (if_then_else:DF (match_operand 1 "comparison_operator" "")
5177 (match_operand:DF 2 "gpc_reg_operand" "")
5178 (match_operand:DF 3 "gpc_reg_operand" "")))]
5179 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5182 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5188 (define_insn "*fseldfdf4"
5189 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5190 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "f")
5191 (match_operand:DF 4 "zero_fp_constant" "F"))
5192 (match_operand:DF 2 "gpc_reg_operand" "f")
5193 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5194 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5196 [(set_attr "type" "fp")])
5198 (define_insn "*fselsfdf4"
5199 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5200 (if_then_else:DF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
5201 (match_operand:SF 4 "zero_fp_constant" "F"))
5202 (match_operand:DF 2 "gpc_reg_operand" "f")
5203 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5206 [(set_attr "type" "fp")])
5208 ;; Conversions to and from floating-point.
5210 (define_expand "fixuns_truncsfsi2"
5211 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5212 (unsigned_fix:SI (match_operand:SF 1 "gpc_reg_operand" "")))]
5213 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5216 (define_expand "fix_truncsfsi2"
5217 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5218 (fix:SI (match_operand:SF 1 "gpc_reg_operand" "")))]
5219 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5222 ; For each of these conversions, there is a define_expand, a define_insn
5223 ; with a '#' template, and a define_split (with C code). The idea is
5224 ; to allow constant folding with the template of the define_insn,
5225 ; then to have the insns split later (between sched1 and final).
5227 (define_expand "floatsidf2"
5228 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5229 (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5232 (clobber (match_dup 4))
5233 (clobber (match_dup 5))
5234 (clobber (match_dup 6))])]
5235 "TARGET_HARD_FLOAT && TARGET_FPRS"
5238 if (TARGET_E500_DOUBLE)
5240 emit_insn (gen_spe_floatsidf2 (operands[0], operands[1]));
5243 if (TARGET_POWERPC64)
5245 rtx mem = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
5246 rtx t1 = gen_reg_rtx (DImode);
5247 rtx t2 = gen_reg_rtx (DImode);
5248 emit_insn (gen_floatsidf_ppc64 (operands[0], operands[1], mem, t1, t2));
5252 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5253 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503601774854144\", DFmode));
5254 operands[4] = assign_stack_temp (DFmode, GET_MODE_SIZE (DFmode), 0);
5255 operands[5] = gen_reg_rtx (DFmode);
5256 operands[6] = gen_reg_rtx (SImode);
5259 (define_insn_and_split "*floatsidf2_internal"
5260 [(set (match_operand:DF 0 "gpc_reg_operand" "=&f")
5261 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5262 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5263 (use (match_operand:DF 3 "gpc_reg_operand" "f"))
5264 (clobber (match_operand:DF 4 "memory_operand" "=o"))
5265 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&f"))
5266 (clobber (match_operand:SI 6 "gpc_reg_operand" "=&r"))]
5267 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5269 "&& (!no_new_pseudos || offsettable_nonstrict_memref_p (operands[4]))"
5273 rtx lowword, highword;
5274 gcc_assert (MEM_P (operands[4]));
5275 highword = adjust_address (operands[4], SImode, 0);
5276 lowword = adjust_address (operands[4], SImode, 4);
5277 if (! WORDS_BIG_ENDIAN)
5280 tmp = highword; highword = lowword; lowword = tmp;
5283 emit_insn (gen_xorsi3 (operands[6], operands[1],
5284 GEN_INT (~ (HOST_WIDE_INT) 0x7fffffff)));
5285 emit_move_insn (lowword, operands[6]);
5286 emit_move_insn (highword, operands[2]);
5287 emit_move_insn (operands[5], operands[4]);
5288 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5291 [(set_attr "length" "24")])
5293 (define_expand "floatunssisf2"
5294 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5295 (unsigned_float:SF (match_operand:SI 1 "gpc_reg_operand" "")))]
5296 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5299 (define_expand "floatunssidf2"
5300 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5301 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5304 (clobber (match_dup 4))
5305 (clobber (match_dup 5))])]
5306 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5309 if (TARGET_E500_DOUBLE)
5311 emit_insn (gen_spe_floatunssidf2 (operands[0], operands[1]));
5314 if (TARGET_POWERPC64)
5316 rtx mem = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
5317 rtx t1 = gen_reg_rtx (DImode);
5318 rtx t2 = gen_reg_rtx (DImode);
5319 emit_insn (gen_floatunssidf_ppc64 (operands[0], operands[1], mem,
5324 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5325 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503599627370496\", DFmode));
5326 operands[4] = assign_stack_temp (DFmode, GET_MODE_SIZE (DFmode), 0);
5327 operands[5] = gen_reg_rtx (DFmode);
5330 (define_insn_and_split "*floatunssidf2_internal"
5331 [(set (match_operand:DF 0 "gpc_reg_operand" "=&f")
5332 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5333 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5334 (use (match_operand:DF 3 "gpc_reg_operand" "f"))
5335 (clobber (match_operand:DF 4 "memory_operand" "=o"))
5336 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&f"))]
5337 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5339 "&& (!no_new_pseudos || offsettable_nonstrict_memref_p (operands[4]))"
5343 rtx lowword, highword;
5344 gcc_assert (MEM_P (operands[4]));
5345 highword = adjust_address (operands[4], SImode, 0);
5346 lowword = adjust_address (operands[4], SImode, 4);
5347 if (! WORDS_BIG_ENDIAN)
5350 tmp = highword; highword = lowword; lowword = tmp;
5353 emit_move_insn (lowword, operands[1]);
5354 emit_move_insn (highword, operands[2]);
5355 emit_move_insn (operands[5], operands[4]);
5356 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5359 [(set_attr "length" "20")])
5361 (define_expand "fix_truncdfsi2"
5362 [(parallel [(set (match_operand:SI 0 "fix_trunc_dest_operand" "")
5363 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))
5364 (clobber (match_dup 2))
5365 (clobber (match_dup 3))])]
5366 "(TARGET_POWER2 || TARGET_POWERPC)
5367 && TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5370 if (TARGET_E500_DOUBLE)
5372 emit_insn (gen_spe_fix_truncdfsi2 (operands[0], operands[1]));
5375 operands[2] = gen_reg_rtx (DImode);
5376 if (TARGET_PPC_GFXOPT)
5378 rtx orig_dest = operands[0];
5379 if (! memory_operand (orig_dest, GET_MODE (orig_dest)))
5380 operands[0] = assign_stack_temp (SImode, GET_MODE_SIZE (SImode), 0);
5381 emit_insn (gen_fix_truncdfsi2_internal_gfxopt (operands[0], operands[1],
5383 if (operands[0] != orig_dest)
5384 emit_move_insn (orig_dest, operands[0]);
5387 operands[3] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
5390 (define_insn_and_split "*fix_truncdfsi2_internal"
5391 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5392 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f")))
5393 (clobber (match_operand:DI 2 "gpc_reg_operand" "=f"))
5394 (clobber (match_operand:DI 3 "memory_operand" "=o"))]
5395 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS"
5397 "&& (!no_new_pseudos || offsettable_nonstrict_memref_p (operands[3]))"
5402 gcc_assert (MEM_P (operands[3]));
5403 lowword = adjust_address (operands[3], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
5405 emit_insn (gen_fctiwz (operands[2], operands[1]));
5406 emit_move_insn (operands[3], operands[2]);
5407 emit_move_insn (operands[0], lowword);
5410 [(set_attr "length" "16")])
5412 (define_insn_and_split "fix_truncdfsi2_internal_gfxopt"
5413 [(set (match_operand:SI 0 "memory_operand" "=Z")
5414 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f")))
5415 (clobber (match_operand:DI 2 "gpc_reg_operand" "=f"))]
5416 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS
5417 && TARGET_PPC_GFXOPT"
5423 emit_insn (gen_fctiwz (operands[2], operands[1]));
5424 emit_insn (gen_stfiwx (operands[0], operands[2]));
5427 [(set_attr "length" "16")])
5429 ; Here, we use (set (reg) (unspec:DI [(fix:SI ...)] UNSPEC_FCTIWZ))
5430 ; rather than (set (subreg:SI (reg)) (fix:SI ...))
5431 ; because the first makes it clear that operand 0 is not live
5432 ; before the instruction.
5433 (define_insn "fctiwz"
5434 [(set (match_operand:DI 0 "gpc_reg_operand" "=f")
5435 (unspec:DI [(fix:SI (match_operand:DF 1 "gpc_reg_operand" "f"))]
5437 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS"
5438 "{fcirz|fctiwz} %0,%1"
5439 [(set_attr "type" "fp")])
5441 ; An UNSPEC is used so we don't have to support SImode in FP registers.
5442 (define_insn "stfiwx"
5443 [(set (match_operand:SI 0 "memory_operand" "=Z")
5444 (unspec:SI [(match_operand:DI 1 "gpc_reg_operand" "f")]
5448 [(set_attr "type" "fpstore")])
5450 (define_expand "floatsisf2"
5451 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5452 (float:SF (match_operand:SI 1 "gpc_reg_operand" "")))]
5453 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5456 (define_insn "floatdidf2"
5457 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5458 (float:DF (match_operand:DI 1 "gpc_reg_operand" "*f")))]
5459 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5461 [(set_attr "type" "fp")])
5463 (define_insn_and_split "floatsidf_ppc64"
5464 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5465 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5466 (clobber (match_operand:DI 2 "memory_operand" "=o"))
5467 (clobber (match_operand:DI 3 "gpc_reg_operand" "=r"))
5468 (clobber (match_operand:DI 4 "gpc_reg_operand" "=f"))]
5469 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5472 [(set (match_dup 3) (sign_extend:DI (match_dup 1)))
5473 (set (match_dup 2) (match_dup 3))
5474 (set (match_dup 4) (match_dup 2))
5475 (set (match_dup 0) (float:DF (match_dup 4)))]
5478 (define_insn_and_split "floatunssidf_ppc64"
5479 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5480 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5481 (clobber (match_operand:DI 2 "memory_operand" "=o"))
5482 (clobber (match_operand:DI 3 "gpc_reg_operand" "=r"))
5483 (clobber (match_operand:DI 4 "gpc_reg_operand" "=f"))]
5484 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5487 [(set (match_dup 3) (zero_extend:DI (match_dup 1)))
5488 (set (match_dup 2) (match_dup 3))
5489 (set (match_dup 4) (match_dup 2))
5490 (set (match_dup 0) (float:DF (match_dup 4)))]
5493 (define_insn "fix_truncdfdi2"
5494 [(set (match_operand:DI 0 "gpc_reg_operand" "=*f")
5495 (fix:DI (match_operand:DF 1 "gpc_reg_operand" "f")))]
5496 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5498 [(set_attr "type" "fp")])
5500 (define_expand "floatdisf2"
5501 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5502 (float:SF (match_operand:DI 1 "gpc_reg_operand" "")))]
5503 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5506 rtx val = operands[1];
5507 if (!flag_unsafe_math_optimizations)
5509 rtx label = gen_label_rtx ();
5510 val = gen_reg_rtx (DImode);
5511 emit_insn (gen_floatdisf2_internal2 (val, operands[1], label));
5514 emit_insn (gen_floatdisf2_internal1 (operands[0], val));
5518 ;; This is not IEEE compliant if rounding mode is "round to nearest".
5519 ;; If the DI->DF conversion is inexact, then it's possible to suffer
5520 ;; from double rounding.
5521 (define_insn_and_split "floatdisf2_internal1"
5522 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5523 (float:SF (match_operand:DI 1 "gpc_reg_operand" "*f")))
5524 (clobber (match_scratch:DF 2 "=f"))]
5525 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5527 "&& reload_completed"
5529 (float:DF (match_dup 1)))
5531 (float_truncate:SF (match_dup 2)))]
5534 ;; Twiddles bits to avoid double rounding.
5535 ;; Bits that might be truncated when converting to DFmode are replaced
5536 ;; by a bit that won't be lost at that stage, but is below the SFmode
5537 ;; rounding position.
5538 (define_expand "floatdisf2_internal2"
5539 [(set (match_dup 3) (ashiftrt:DI (match_operand:DI 1 "" "")
5541 (parallel [(set (match_operand:DI 0 "" "") (and:DI (match_dup 1)
5543 (clobber (scratch:CC))])
5544 (set (match_dup 3) (plus:DI (match_dup 3)
5546 (set (match_dup 0) (plus:DI (match_dup 0)
5548 (set (match_dup 4) (compare:CCUNS (match_dup 3)
5550 (set (match_dup 0) (ior:DI (match_dup 0)
5552 (parallel [(set (match_dup 0) (and:DI (match_dup 0)
5554 (clobber (scratch:CC))])
5555 (set (pc) (if_then_else (geu (match_dup 4) (const_int 0))
5556 (label_ref (match_operand:DI 2 "" ""))
5558 (set (match_dup 0) (match_dup 1))]
5559 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5562 operands[3] = gen_reg_rtx (DImode);
5563 operands[4] = gen_reg_rtx (CCUNSmode);
5566 ;; Define the DImode operations that can be done in a small number
5567 ;; of instructions. The & constraints are to prevent the register
5568 ;; allocator from allocating registers that overlap with the inputs
5569 ;; (for example, having an input in 7,8 and an output in 6,7). We
5570 ;; also allow for the output being the same as one of the inputs.
5572 (define_insn "*adddi3_noppc64"
5573 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r")
5574 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,0,0")
5575 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I")))]
5576 "! TARGET_POWERPC64"
5579 if (WORDS_BIG_ENDIAN)
5580 return (GET_CODE (operands[2])) != CONST_INT
5581 ? \"{a|addc} %L0,%L1,%L2\;{ae|adde} %0,%1,%2\"
5582 : \"{ai|addic} %L0,%L1,%2\;{a%G2e|add%G2e} %0,%1\";
5584 return (GET_CODE (operands[2])) != CONST_INT
5585 ? \"{a|addc} %0,%1,%2\;{ae|adde} %L0,%L1,%L2\"
5586 : \"{ai|addic} %0,%1,%2\;{a%G2e|add%G2e} %L0,%L1\";
5588 [(set_attr "type" "two")
5589 (set_attr "length" "8")])
5591 (define_insn "*subdi3_noppc64"
5592 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r,r")
5593 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I,0,r,I")
5594 (match_operand:DI 2 "gpc_reg_operand" "r,r,r,0,0")))]
5595 "! TARGET_POWERPC64"
5598 if (WORDS_BIG_ENDIAN)
5599 return (GET_CODE (operands[1]) != CONST_INT)
5600 ? \"{sf|subfc} %L0,%L2,%L1\;{sfe|subfe} %0,%2,%1\"
5601 : \"{sfi|subfic} %L0,%L2,%1\;{sf%G1e|subf%G1e} %0,%2\";
5603 return (GET_CODE (operands[1]) != CONST_INT)
5604 ? \"{sf|subfc} %0,%2,%1\;{sfe|subfe} %L0,%L2,%L1\"
5605 : \"{sfi|subfic} %0,%2,%1\;{sf%G1e|subf%G1e} %L0,%L2\";
5607 [(set_attr "type" "two")
5608 (set_attr "length" "8")])
5610 (define_insn "*negdi2_noppc64"
5611 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
5612 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))]
5613 "! TARGET_POWERPC64"
5616 return (WORDS_BIG_ENDIAN)
5617 ? \"{sfi|subfic} %L0,%L1,0\;{sfze|subfze} %0,%1\"
5618 : \"{sfi|subfic} %0,%1,0\;{sfze|subfze} %L0,%L1\";
5620 [(set_attr "type" "two")
5621 (set_attr "length" "8")])
5623 (define_expand "mulsidi3"
5624 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5625 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
5626 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
5627 "! TARGET_POWERPC64"
5630 if (! TARGET_POWER && ! TARGET_POWERPC)
5632 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
5633 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
5634 emit_insn (gen_mull_call ());
5635 if (WORDS_BIG_ENDIAN)
5636 emit_move_insn (operands[0], gen_rtx_REG (DImode, 3));
5639 emit_move_insn (operand_subword (operands[0], 0, 0, DImode),
5640 gen_rtx_REG (SImode, 3));
5641 emit_move_insn (operand_subword (operands[0], 1, 0, DImode),
5642 gen_rtx_REG (SImode, 4));
5646 else if (TARGET_POWER)
5648 emit_insn (gen_mulsidi3_mq (operands[0], operands[1], operands[2]));
5653 (define_insn "mulsidi3_mq"
5654 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
5655 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
5656 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
5657 (clobber (match_scratch:SI 3 "=q"))]
5659 "mul %0,%1,%2\;mfmq %L0"
5660 [(set_attr "type" "imul")
5661 (set_attr "length" "8")])
5663 (define_insn "*mulsidi3_no_mq"
5664 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
5665 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
5666 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
5667 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
5670 return (WORDS_BIG_ENDIAN)
5671 ? \"mulhw %0,%1,%2\;mullw %L0,%1,%2\"
5672 : \"mulhw %L0,%1,%2\;mullw %0,%1,%2\";
5674 [(set_attr "type" "imul")
5675 (set_attr "length" "8")])
5678 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5679 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
5680 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
5681 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
5684 (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
5685 (sign_extend:DI (match_dup 2)))
5688 (mult:SI (match_dup 1)
5692 int endian = (WORDS_BIG_ENDIAN == 0);
5693 operands[3] = operand_subword (operands[0], endian, 0, DImode);
5694 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
5697 (define_expand "umulsidi3"
5698 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5699 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
5700 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
5701 "TARGET_POWERPC && ! TARGET_POWERPC64"
5706 emit_insn (gen_umulsidi3_mq (operands[0], operands[1], operands[2]));
5711 (define_insn "umulsidi3_mq"
5712 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
5713 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
5714 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
5715 (clobber (match_scratch:SI 3 "=q"))]
5716 "TARGET_POWERPC && TARGET_POWER"
5719 return (WORDS_BIG_ENDIAN)
5720 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
5721 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
5723 [(set_attr "type" "imul")
5724 (set_attr "length" "8")])
5726 (define_insn "*umulsidi3_no_mq"
5727 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
5728 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
5729 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
5730 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
5733 return (WORDS_BIG_ENDIAN)
5734 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
5735 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
5737 [(set_attr "type" "imul")
5738 (set_attr "length" "8")])
5741 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5742 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
5743 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
5744 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
5747 (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
5748 (zero_extend:DI (match_dup 2)))
5751 (mult:SI (match_dup 1)
5755 int endian = (WORDS_BIG_ENDIAN == 0);
5756 operands[3] = operand_subword (operands[0], endian, 0, DImode);
5757 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
5760 (define_expand "smulsi3_highpart"
5761 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5763 (lshiftrt:DI (mult:DI (sign_extend:DI
5764 (match_operand:SI 1 "gpc_reg_operand" "%r"))
5766 (match_operand:SI 2 "gpc_reg_operand" "r")))
5771 if (! TARGET_POWER && ! TARGET_POWERPC)
5773 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
5774 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
5775 emit_insn (gen_mulh_call ());
5776 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
5779 else if (TARGET_POWER)
5781 emit_insn (gen_smulsi3_highpart_mq (operands[0], operands[1], operands[2]));
5786 (define_insn "smulsi3_highpart_mq"
5787 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5789 (lshiftrt:DI (mult:DI (sign_extend:DI
5790 (match_operand:SI 1 "gpc_reg_operand" "%r"))
5792 (match_operand:SI 2 "gpc_reg_operand" "r")))
5794 (clobber (match_scratch:SI 3 "=q"))]
5797 [(set_attr "type" "imul")])
5799 (define_insn "*smulsi3_highpart_no_mq"
5800 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5802 (lshiftrt:DI (mult:DI (sign_extend:DI
5803 (match_operand:SI 1 "gpc_reg_operand" "%r"))
5805 (match_operand:SI 2 "gpc_reg_operand" "r")))
5807 "TARGET_POWERPC && ! TARGET_POWER"
5809 [(set_attr "type" "imul")])
5811 (define_expand "umulsi3_highpart"
5812 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5814 (lshiftrt:DI (mult:DI (zero_extend:DI
5815 (match_operand:SI 1 "gpc_reg_operand" ""))
5817 (match_operand:SI 2 "gpc_reg_operand" "")))
5824 emit_insn (gen_umulsi3_highpart_mq (operands[0], operands[1], operands[2]));
5829 (define_insn "umulsi3_highpart_mq"
5830 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5832 (lshiftrt:DI (mult:DI (zero_extend:DI
5833 (match_operand:SI 1 "gpc_reg_operand" "%r"))
5835 (match_operand:SI 2 "gpc_reg_operand" "r")))
5837 (clobber (match_scratch:SI 3 "=q"))]
5838 "TARGET_POWERPC && TARGET_POWER"
5840 [(set_attr "type" "imul")])
5842 (define_insn "*umulsi3_highpart_no_mq"
5843 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5845 (lshiftrt:DI (mult:DI (zero_extend:DI
5846 (match_operand:SI 1 "gpc_reg_operand" "%r"))
5848 (match_operand:SI 2 "gpc_reg_operand" "r")))
5850 "TARGET_POWERPC && ! TARGET_POWER"
5852 [(set_attr "type" "imul")])
5854 ;; If operands 0 and 2 are in the same register, we have a problem. But
5855 ;; operands 0 and 1 (the usual case) can be in the same register. That's
5856 ;; why we have the strange constraints below.
5857 (define_insn "ashldi3_power"
5858 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
5859 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
5860 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
5861 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
5864 {sli|slwi} %0,%L1,%h2\;{cal %L0,0(0)|li %L0,0}
5865 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
5866 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
5867 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2"
5868 [(set_attr "length" "8")])
5870 (define_insn "lshrdi3_power"
5871 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
5872 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
5873 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
5874 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
5877 {s%A2i|s%A2wi} %L0,%1,%h2\;{cal %0,0(0)|li %0,0}
5878 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
5879 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
5880 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2"
5881 [(set_attr "length" "8")])
5883 ;; Shift by a variable amount is too complex to be worth open-coding. We
5884 ;; just handle shifts by constants.
5885 (define_insn "ashrdi3_power"
5886 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
5887 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
5888 (match_operand:SI 2 "const_int_operand" "M,i")))
5889 (clobber (match_scratch:SI 3 "=X,q"))]
5892 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
5893 sraiq %0,%1,%h2\;srliq %L0,%L1,%h2"
5894 [(set_attr "length" "8")])
5896 (define_insn "ashrdi3_no_power"
5897 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
5898 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
5899 (match_operand:SI 2 "const_int_operand" "M,i")))]
5900 "TARGET_32BIT && !TARGET_POWERPC64 && !TARGET_POWER && WORDS_BIG_ENDIAN"
5902 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
5903 {sri|srwi} %L0,%L1,%h2\;insrwi %L0,%1,%h2,0\;{srai|srawi} %0,%1,%h2"
5904 [(set_attr "type" "two,three")
5905 (set_attr "length" "8,12")])
5907 (define_insn "*ashrdisi3_noppc64"
5908 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5909 (subreg:SI (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
5910 (const_int 32)) 4))]
5911 "TARGET_32BIT && !TARGET_POWERPC64"
5914 if (REGNO (operands[0]) == REGNO (operands[1]))
5917 return \"mr %0,%1\";
5919 [(set_attr "length" "4")])
5922 ;; PowerPC64 DImode operations.
5924 (define_insn_and_split "absdi2"
5925 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
5926 (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))
5927 (clobber (match_scratch:DI 2 "=&r,&r"))]
5930 "&& reload_completed"
5931 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
5932 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
5933 (set (match_dup 0) (minus:DI (match_dup 0) (match_dup 2)))]
5936 (define_insn_and_split "*nabsdi2"
5937 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
5938 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0"))))
5939 (clobber (match_scratch:DI 2 "=&r,&r"))]
5942 "&& reload_completed"
5943 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
5944 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
5945 (set (match_dup 0) (minus:DI (match_dup 2) (match_dup 0)))]
5948 (define_insn "muldi3"
5949 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
5950 (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
5951 (match_operand:DI 2 "gpc_reg_operand" "r")))]
5954 [(set_attr "type" "lmul")])
5956 (define_insn "*muldi3_internal1"
5957 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
5958 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
5959 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
5961 (clobber (match_scratch:DI 3 "=r,r"))]
5966 [(set_attr "type" "lmul_compare")
5967 (set_attr "length" "4,8")])
5970 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
5971 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
5972 (match_operand:DI 2 "gpc_reg_operand" ""))
5974 (clobber (match_scratch:DI 3 ""))]
5975 "TARGET_POWERPC64 && reload_completed"
5977 (mult:DI (match_dup 1) (match_dup 2)))
5979 (compare:CC (match_dup 3)
5983 (define_insn "*muldi3_internal2"
5984 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
5985 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
5986 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
5988 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
5989 (mult:DI (match_dup 1) (match_dup 2)))]
5994 [(set_attr "type" "lmul_compare")
5995 (set_attr "length" "4,8")])
5998 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
5999 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
6000 (match_operand:DI 2 "gpc_reg_operand" ""))
6002 (set (match_operand:DI 0 "gpc_reg_operand" "")
6003 (mult:DI (match_dup 1) (match_dup 2)))]
6004 "TARGET_POWERPC64 && reload_completed"
6006 (mult:DI (match_dup 1) (match_dup 2)))
6008 (compare:CC (match_dup 0)
6012 (define_insn "smuldi3_highpart"
6013 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6015 (lshiftrt:TI (mult:TI (sign_extend:TI
6016 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6018 (match_operand:DI 2 "gpc_reg_operand" "r")))
6022 [(set_attr "type" "lmul")])
6024 (define_insn "umuldi3_highpart"
6025 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6027 (lshiftrt:TI (mult:TI (zero_extend:TI
6028 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6030 (match_operand:DI 2 "gpc_reg_operand" "r")))
6034 [(set_attr "type" "lmul")])
6036 (define_insn "rotldi3"
6037 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6038 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6039 (match_operand:DI 2 "reg_or_cint_operand" "ri")))]
6041 "rld%I2cl %0,%1,%H2,0")
6043 (define_insn "*rotldi3_internal2"
6044 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6045 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6046 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6048 (clobber (match_scratch:DI 3 "=r,r"))]
6051 rld%I2cl. %3,%1,%H2,0
6053 [(set_attr "type" "delayed_compare")
6054 (set_attr "length" "4,8")])
6057 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6058 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6059 (match_operand:DI 2 "reg_or_cint_operand" ""))
6061 (clobber (match_scratch:DI 3 ""))]
6062 "TARGET_POWERPC64 && reload_completed"
6064 (rotate:DI (match_dup 1) (match_dup 2)))
6066 (compare:CC (match_dup 3)
6070 (define_insn "*rotldi3_internal3"
6071 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6072 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6073 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6075 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6076 (rotate:DI (match_dup 1) (match_dup 2)))]
6079 rld%I2cl. %0,%1,%H2,0
6081 [(set_attr "type" "delayed_compare")
6082 (set_attr "length" "4,8")])
6085 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6086 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6087 (match_operand:DI 2 "reg_or_cint_operand" ""))
6089 (set (match_operand:DI 0 "gpc_reg_operand" "")
6090 (rotate:DI (match_dup 1) (match_dup 2)))]
6091 "TARGET_POWERPC64 && reload_completed"
6093 (rotate:DI (match_dup 1) (match_dup 2)))
6095 (compare:CC (match_dup 0)
6099 (define_insn "*rotldi3_internal4"
6100 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6101 (and:DI (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6102 (match_operand:DI 2 "reg_or_cint_operand" "ri"))
6103 (match_operand:DI 3 "mask_operand" "n")))]
6105 "rld%I2c%B3 %0,%1,%H2,%S3")
6107 (define_insn "*rotldi3_internal5"
6108 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6110 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6111 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6112 (match_operand:DI 3 "mask_operand" "n,n"))
6114 (clobber (match_scratch:DI 4 "=r,r"))]
6117 rld%I2c%B3. %4,%1,%H2,%S3
6119 [(set_attr "type" "delayed_compare")
6120 (set_attr "length" "4,8")])
6123 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6125 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6126 (match_operand:DI 2 "reg_or_cint_operand" ""))
6127 (match_operand:DI 3 "mask_operand" ""))
6129 (clobber (match_scratch:DI 4 ""))]
6130 "TARGET_POWERPC64 && reload_completed"
6132 (and:DI (rotate:DI (match_dup 1)
6136 (compare:CC (match_dup 4)
6140 (define_insn "*rotldi3_internal6"
6141 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
6143 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6144 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6145 (match_operand:DI 3 "mask_operand" "n,n"))
6147 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6148 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6151 rld%I2c%B3. %0,%1,%H2,%S3
6153 [(set_attr "type" "delayed_compare")
6154 (set_attr "length" "4,8")])
6157 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
6159 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6160 (match_operand:DI 2 "reg_or_cint_operand" ""))
6161 (match_operand:DI 3 "mask_operand" ""))
6163 (set (match_operand:DI 0 "gpc_reg_operand" "")
6164 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6165 "TARGET_POWERPC64 && reload_completed"
6167 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
6169 (compare:CC (match_dup 0)
6173 (define_insn "*rotldi3_internal7"
6174 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6177 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6178 (match_operand:DI 2 "reg_or_cint_operand" "ri")) 0)))]
6180 "rld%I2cl %0,%1,%H2,56")
6182 (define_insn "*rotldi3_internal8"
6183 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6184 (compare:CC (zero_extend:DI
6186 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6187 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6189 (clobber (match_scratch:DI 3 "=r,r"))]
6192 rld%I2cl. %3,%1,%H2,56
6194 [(set_attr "type" "delayed_compare")
6195 (set_attr "length" "4,8")])
6198 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6199 (compare:CC (zero_extend:DI
6201 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6202 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6204 (clobber (match_scratch:DI 3 ""))]
6205 "TARGET_POWERPC64 && reload_completed"
6207 (zero_extend:DI (subreg:QI
6208 (rotate:DI (match_dup 1)
6211 (compare:CC (match_dup 3)
6215 (define_insn "*rotldi3_internal9"
6216 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6217 (compare:CC (zero_extend:DI
6219 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6220 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6222 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6223 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6226 rld%I2cl. %0,%1,%H2,56
6228 [(set_attr "type" "delayed_compare")
6229 (set_attr "length" "4,8")])
6232 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6233 (compare:CC (zero_extend:DI
6235 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6236 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6238 (set (match_operand:DI 0 "gpc_reg_operand" "")
6239 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6240 "TARGET_POWERPC64 && reload_completed"
6242 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
6244 (compare:CC (match_dup 0)
6248 (define_insn "*rotldi3_internal10"
6249 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6252 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6253 (match_operand:DI 2 "reg_or_cint_operand" "ri")) 0)))]
6255 "rld%I2cl %0,%1,%H2,48")
6257 (define_insn "*rotldi3_internal11"
6258 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6259 (compare:CC (zero_extend:DI
6261 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6262 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6264 (clobber (match_scratch:DI 3 "=r,r"))]
6267 rld%I2cl. %3,%1,%H2,48
6269 [(set_attr "type" "delayed_compare")
6270 (set_attr "length" "4,8")])
6273 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6274 (compare:CC (zero_extend:DI
6276 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6277 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6279 (clobber (match_scratch:DI 3 ""))]
6280 "TARGET_POWERPC64 && reload_completed"
6282 (zero_extend:DI (subreg:HI
6283 (rotate:DI (match_dup 1)
6286 (compare:CC (match_dup 3)
6290 (define_insn "*rotldi3_internal12"
6291 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6292 (compare:CC (zero_extend:DI
6294 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6295 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6297 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6298 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6301 rld%I2cl. %0,%1,%H2,48
6303 [(set_attr "type" "delayed_compare")
6304 (set_attr "length" "4,8")])
6307 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6308 (compare:CC (zero_extend:DI
6310 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6311 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6313 (set (match_operand:DI 0 "gpc_reg_operand" "")
6314 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6315 "TARGET_POWERPC64 && reload_completed"
6317 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
6319 (compare:CC (match_dup 0)
6323 (define_insn "*rotldi3_internal13"
6324 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6327 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6328 (match_operand:DI 2 "reg_or_cint_operand" "ri")) 0)))]
6330 "rld%I2cl %0,%1,%H2,32")
6332 (define_insn "*rotldi3_internal14"
6333 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6334 (compare:CC (zero_extend:DI
6336 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6337 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6339 (clobber (match_scratch:DI 3 "=r,r"))]
6342 rld%I2cl. %3,%1,%H2,32
6344 [(set_attr "type" "delayed_compare")
6345 (set_attr "length" "4,8")])
6348 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6349 (compare:CC (zero_extend:DI
6351 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6352 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6354 (clobber (match_scratch:DI 3 ""))]
6355 "TARGET_POWERPC64 && reload_completed"
6357 (zero_extend:DI (subreg:SI
6358 (rotate:DI (match_dup 1)
6361 (compare:CC (match_dup 3)
6365 (define_insn "*rotldi3_internal15"
6366 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6367 (compare:CC (zero_extend:DI
6369 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6370 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6372 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6373 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6376 rld%I2cl. %0,%1,%H2,32
6378 [(set_attr "type" "delayed_compare")
6379 (set_attr "length" "4,8")])
6382 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6383 (compare:CC (zero_extend:DI
6385 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6386 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6388 (set (match_operand:DI 0 "gpc_reg_operand" "")
6389 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6390 "TARGET_POWERPC64 && reload_completed"
6392 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
6394 (compare:CC (match_dup 0)
6398 (define_expand "ashldi3"
6399 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6400 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6401 (match_operand:SI 2 "reg_or_cint_operand" "")))]
6402 "TARGET_POWERPC64 || TARGET_POWER"
6405 if (TARGET_POWERPC64)
6407 else if (TARGET_POWER)
6409 emit_insn (gen_ashldi3_power (operands[0], operands[1], operands[2]));
6416 (define_insn "*ashldi3_internal1"
6417 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6418 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6419 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
6423 (define_insn "*ashldi3_internal2"
6424 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6425 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6426 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
6428 (clobber (match_scratch:DI 3 "=r,r"))]
6433 [(set_attr "type" "delayed_compare")
6434 (set_attr "length" "4,8")])
6437 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6438 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6439 (match_operand:SI 2 "reg_or_cint_operand" ""))
6441 (clobber (match_scratch:DI 3 ""))]
6442 "TARGET_POWERPC64 && reload_completed"
6444 (ashift:DI (match_dup 1) (match_dup 2)))
6446 (compare:CC (match_dup 3)
6450 (define_insn "*ashldi3_internal3"
6451 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6452 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6453 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
6455 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6456 (ashift:DI (match_dup 1) (match_dup 2)))]
6461 [(set_attr "type" "delayed_compare")
6462 (set_attr "length" "4,8")])
6465 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6466 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6467 (match_operand:SI 2 "reg_or_cint_operand" ""))
6469 (set (match_operand:DI 0 "gpc_reg_operand" "")
6470 (ashift:DI (match_dup 1) (match_dup 2)))]
6471 "TARGET_POWERPC64 && reload_completed"
6473 (ashift:DI (match_dup 1) (match_dup 2)))
6475 (compare:CC (match_dup 0)
6479 (define_insn "*ashldi3_internal4"
6480 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6481 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6482 (match_operand:SI 2 "const_int_operand" "i"))
6483 (match_operand:DI 3 "const_int_operand" "n")))]
6484 "TARGET_POWERPC64 && includes_rldic_lshift_p (operands[2], operands[3])"
6485 "rldic %0,%1,%H2,%W3")
6487 (define_insn "ashldi3_internal5"
6488 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6490 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6491 (match_operand:SI 2 "const_int_operand" "i,i"))
6492 (match_operand:DI 3 "const_int_operand" "n,n"))
6494 (clobber (match_scratch:DI 4 "=r,r"))]
6495 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
6497 rldic. %4,%1,%H2,%W3
6499 [(set_attr "type" "delayed_compare")
6500 (set_attr "length" "4,8")])
6503 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6505 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6506 (match_operand:SI 2 "const_int_operand" ""))
6507 (match_operand:DI 3 "const_int_operand" ""))
6509 (clobber (match_scratch:DI 4 ""))]
6510 "TARGET_POWERPC64 && reload_completed
6511 && includes_rldic_lshift_p (operands[2], operands[3])"
6513 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
6516 (compare:CC (match_dup 4)
6520 (define_insn "*ashldi3_internal6"
6521 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
6523 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6524 (match_operand:SI 2 "const_int_operand" "i,i"))
6525 (match_operand:DI 3 "const_int_operand" "n,n"))
6527 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6528 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6529 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
6531 rldic. %0,%1,%H2,%W3
6533 [(set_attr "type" "delayed_compare")
6534 (set_attr "length" "4,8")])
6537 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
6539 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6540 (match_operand:SI 2 "const_int_operand" ""))
6541 (match_operand:DI 3 "const_int_operand" ""))
6543 (set (match_operand:DI 0 "gpc_reg_operand" "")
6544 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6545 "TARGET_POWERPC64 && reload_completed
6546 && includes_rldic_lshift_p (operands[2], operands[3])"
6548 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
6551 (compare:CC (match_dup 0)
6555 (define_insn "*ashldi3_internal7"
6556 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6557 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6558 (match_operand:SI 2 "const_int_operand" "i"))
6559 (match_operand:DI 3 "mask_operand" "n")))]
6560 "TARGET_POWERPC64 && includes_rldicr_lshift_p (operands[2], operands[3])"
6561 "rldicr %0,%1,%H2,%S3")
6563 (define_insn "ashldi3_internal8"
6564 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6566 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6567 (match_operand:SI 2 "const_int_operand" "i,i"))
6568 (match_operand:DI 3 "mask_operand" "n,n"))
6570 (clobber (match_scratch:DI 4 "=r,r"))]
6571 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
6573 rldicr. %4,%1,%H2,%S3
6575 [(set_attr "type" "delayed_compare")
6576 (set_attr "length" "4,8")])
6579 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6581 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6582 (match_operand:SI 2 "const_int_operand" ""))
6583 (match_operand:DI 3 "mask_operand" ""))
6585 (clobber (match_scratch:DI 4 ""))]
6586 "TARGET_POWERPC64 && reload_completed
6587 && includes_rldicr_lshift_p (operands[2], operands[3])"
6589 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
6592 (compare:CC (match_dup 4)
6596 (define_insn "*ashldi3_internal9"
6597 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
6599 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6600 (match_operand:SI 2 "const_int_operand" "i,i"))
6601 (match_operand:DI 3 "mask_operand" "n,n"))
6603 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6604 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6605 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
6607 rldicr. %0,%1,%H2,%S3
6609 [(set_attr "type" "delayed_compare")
6610 (set_attr "length" "4,8")])
6613 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
6615 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6616 (match_operand:SI 2 "const_int_operand" ""))
6617 (match_operand:DI 3 "mask_operand" ""))
6619 (set (match_operand:DI 0 "gpc_reg_operand" "")
6620 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6621 "TARGET_POWERPC64 && reload_completed
6622 && includes_rldicr_lshift_p (operands[2], operands[3])"
6624 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
6627 (compare:CC (match_dup 0)
6631 (define_expand "lshrdi3"
6632 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6633 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
6634 (match_operand:SI 2 "reg_or_cint_operand" "")))]
6635 "TARGET_POWERPC64 || TARGET_POWER"
6638 if (TARGET_POWERPC64)
6640 else if (TARGET_POWER)
6642 emit_insn (gen_lshrdi3_power (operands[0], operands[1], operands[2]));
6649 (define_insn "*lshrdi3_internal1"
6650 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6651 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6652 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
6656 (define_insn "*lshrdi3_internal2"
6657 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6658 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6659 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
6661 (clobber (match_scratch:DI 3 "=r,r"))]
6666 [(set_attr "type" "delayed_compare")
6667 (set_attr "length" "4,8")])
6670 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6671 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
6672 (match_operand:SI 2 "reg_or_cint_operand" ""))
6674 (clobber (match_scratch:DI 3 ""))]
6675 "TARGET_POWERPC64 && reload_completed"
6677 (lshiftrt:DI (match_dup 1) (match_dup 2)))
6679 (compare:CC (match_dup 3)
6683 (define_insn "*lshrdi3_internal3"
6684 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6685 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6686 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
6688 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6689 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
6694 [(set_attr "type" "delayed_compare")
6695 (set_attr "length" "4,8")])
6698 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6699 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
6700 (match_operand:SI 2 "reg_or_cint_operand" ""))
6702 (set (match_operand:DI 0 "gpc_reg_operand" "")
6703 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
6704 "TARGET_POWERPC64 && reload_completed"
6706 (lshiftrt:DI (match_dup 1) (match_dup 2)))
6708 (compare:CC (match_dup 0)
6712 (define_expand "ashrdi3"
6713 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6714 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
6715 (match_operand:SI 2 "reg_or_cint_operand" "")))]
6719 if (TARGET_POWERPC64)
6721 else if (TARGET_POWER && GET_CODE (operands[2]) == CONST_INT)
6723 emit_insn (gen_ashrdi3_power (operands[0], operands[1], operands[2]));
6726 else if (TARGET_32BIT && GET_CODE (operands[2]) == CONST_INT
6727 && WORDS_BIG_ENDIAN)
6729 emit_insn (gen_ashrdi3_no_power (operands[0], operands[1], operands[2]));
6736 (define_insn "*ashrdi3_internal1"
6737 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6738 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6739 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
6741 "srad%I2 %0,%1,%H2")
6743 (define_insn "*ashrdi3_internal2"
6744 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6745 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6746 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
6748 (clobber (match_scratch:DI 3 "=r,r"))]
6753 [(set_attr "type" "delayed_compare")
6754 (set_attr "length" "4,8")])
6757 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6758 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
6759 (match_operand:SI 2 "reg_or_cint_operand" ""))
6761 (clobber (match_scratch:DI 3 ""))]
6762 "TARGET_POWERPC64 && reload_completed"
6764 (ashiftrt:DI (match_dup 1) (match_dup 2)))
6766 (compare:CC (match_dup 3)
6770 (define_insn "*ashrdi3_internal3"
6771 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6772 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6773 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
6775 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6776 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
6781 [(set_attr "type" "delayed_compare")
6782 (set_attr "length" "4,8")])
6785 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6786 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
6787 (match_operand:SI 2 "reg_or_cint_operand" ""))
6789 (set (match_operand:DI 0 "gpc_reg_operand" "")
6790 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
6791 "TARGET_POWERPC64 && reload_completed"
6793 (ashiftrt:DI (match_dup 1) (match_dup 2)))
6795 (compare:CC (match_dup 0)
6799 (define_insn "anddi3"
6800 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
6801 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r")
6802 (match_operand:DI 2 "and64_2_operand" "?r,S,T,K,J,t")))
6803 (clobber (match_scratch:CC 3 "=X,X,X,x,x,X"))]
6807 rldic%B2 %0,%1,0,%S2
6808 rlwinm %0,%1,0,%m2,%M2
6812 [(set_attr "type" "*,*,*,compare,compare,*")
6813 (set_attr "length" "4,4,4,4,4,8")])
6816 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6817 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
6818 (match_operand:DI 2 "mask64_2_operand" "")))
6819 (clobber (match_scratch:CC 3 ""))]
6821 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
6822 && !mask_operand (operands[2], DImode)"
6824 (and:DI (rotate:DI (match_dup 1)
6828 (and:DI (rotate:DI (match_dup 0)
6832 build_mask64_2_operands (operands[2], &operands[4]);
6835 (define_insn "*anddi3_internal2"
6836 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,?y,?y,??y,??y,?y")
6837 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
6838 (match_operand:DI 2 "and64_2_operand" "r,S,K,J,t,r,S,K,J,t"))
6840 (clobber (match_scratch:DI 3 "=r,r,r,r,r,r,r,r,r,r"))
6841 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,x,x,X"))]
6845 rldic%B2. %3,%1,0,%S2
6854 [(set_attr "type" "compare,delayed_compare,compare,compare,delayed_compare,compare,compare,compare,compare,compare")
6855 (set_attr "length" "4,4,4,4,8,8,8,8,8,12")])
6858 [(set (match_operand:CC 0 "cc_reg_operand" "")
6859 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
6860 (match_operand:DI 2 "mask64_2_operand" ""))
6862 (clobber (match_scratch:DI 3 ""))
6863 (clobber (match_scratch:CC 4 ""))]
6864 "TARGET_POWERPC64 && reload_completed
6865 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
6866 && !mask_operand (operands[2], DImode)"
6868 (and:DI (rotate:DI (match_dup 1)
6871 (parallel [(set (match_dup 0)
6872 (compare:CC (and:DI (rotate:DI (match_dup 3)
6876 (clobber (match_dup 3))])]
6879 build_mask64_2_operands (operands[2], &operands[5]);
6882 (define_insn "*anddi3_internal3"
6883 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,x,?y,?y,??y,??y,?y")
6884 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
6885 (match_operand:DI 2 "and64_2_operand" "r,S,K,J,t,r,S,K,J,t"))
6887 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r")
6888 (and:DI (match_dup 1) (match_dup 2)))
6889 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,x,x,X"))]
6893 rldic%B2. %0,%1,0,%S2
6902 [(set_attr "type" "compare,delayed_compare,compare,compare,delayed_compare,compare,compare,compare,compare,compare")
6903 (set_attr "length" "4,4,4,4,8,8,8,8,8,12")])
6906 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6907 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
6908 (match_operand:DI 2 "and_operand" ""))
6910 (set (match_operand:DI 0 "gpc_reg_operand" "")
6911 (and:DI (match_dup 1) (match_dup 2)))
6912 (clobber (match_scratch:CC 4 ""))]
6913 "TARGET_POWERPC64 && reload_completed"
6914 [(parallel [(set (match_dup 0)
6915 (and:DI (match_dup 1) (match_dup 2)))
6916 (clobber (match_dup 4))])
6918 (compare:CC (match_dup 0)
6923 [(set (match_operand:CC 3 "cc_reg_operand" "")
6924 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
6925 (match_operand:DI 2 "mask64_2_operand" ""))
6927 (set (match_operand:DI 0 "gpc_reg_operand" "")
6928 (and:DI (match_dup 1) (match_dup 2)))
6929 (clobber (match_scratch:CC 4 ""))]
6930 "TARGET_POWERPC64 && reload_completed
6931 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
6932 && !mask_operand (operands[2], DImode)"
6934 (and:DI (rotate:DI (match_dup 1)
6937 (parallel [(set (match_dup 3)
6938 (compare:CC (and:DI (rotate:DI (match_dup 0)
6943 (and:DI (rotate:DI (match_dup 0)
6948 build_mask64_2_operands (operands[2], &operands[5]);
6951 (define_expand "iordi3"
6952 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6953 (ior:DI (match_operand:DI 1 "gpc_reg_operand" "")
6954 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
6958 if (non_logical_cint_operand (operands[2], DImode))
6960 HOST_WIDE_INT value;
6961 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
6962 ? operands[0] : gen_reg_rtx (DImode));
6964 if (GET_CODE (operands[2]) == CONST_INT)
6966 value = INTVAL (operands[2]);
6967 emit_insn (gen_iordi3 (tmp, operands[1],
6968 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
6972 value = CONST_DOUBLE_LOW (operands[2]);
6973 emit_insn (gen_iordi3 (tmp, operands[1],
6974 immed_double_const (value
6975 & (~ (HOST_WIDE_INT) 0xffff),
6979 emit_insn (gen_iordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
6984 (define_expand "xordi3"
6985 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6986 (xor:DI (match_operand:DI 1 "gpc_reg_operand" "")
6987 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
6991 if (non_logical_cint_operand (operands[2], DImode))
6993 HOST_WIDE_INT value;
6994 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
6995 ? operands[0] : gen_reg_rtx (DImode));
6997 if (GET_CODE (operands[2]) == CONST_INT)
6999 value = INTVAL (operands[2]);
7000 emit_insn (gen_xordi3 (tmp, operands[1],
7001 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
7005 value = CONST_DOUBLE_LOW (operands[2]);
7006 emit_insn (gen_xordi3 (tmp, operands[1],
7007 immed_double_const (value
7008 & (~ (HOST_WIDE_INT) 0xffff),
7012 emit_insn (gen_xordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
7017 (define_insn "*booldi3_internal1"
7018 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
7019 (match_operator:DI 3 "boolean_or_operator"
7020 [(match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
7021 (match_operand:DI 2 "logical_operand" "r,K,JF")]))]
7028 (define_insn "*booldi3_internal2"
7029 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7030 (compare:CC (match_operator:DI 4 "boolean_or_operator"
7031 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
7032 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7034 (clobber (match_scratch:DI 3 "=r,r"))]
7039 [(set_attr "type" "compare")
7040 (set_attr "length" "4,8")])
7043 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7044 (compare:CC (match_operator:DI 4 "boolean_operator"
7045 [(match_operand:DI 1 "gpc_reg_operand" "")
7046 (match_operand:DI 2 "gpc_reg_operand" "")])
7048 (clobber (match_scratch:DI 3 ""))]
7049 "TARGET_POWERPC64 && reload_completed"
7050 [(set (match_dup 3) (match_dup 4))
7052 (compare:CC (match_dup 3)
7056 (define_insn "*booldi3_internal3"
7057 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7058 (compare:CC (match_operator:DI 4 "boolean_operator"
7059 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
7060 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7062 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7068 [(set_attr "type" "compare")
7069 (set_attr "length" "4,8")])
7072 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7073 (compare:CC (match_operator:DI 4 "boolean_operator"
7074 [(match_operand:DI 1 "gpc_reg_operand" "")
7075 (match_operand:DI 2 "gpc_reg_operand" "")])
7077 (set (match_operand:DI 0 "gpc_reg_operand" "")
7079 "TARGET_POWERPC64 && reload_completed"
7080 [(set (match_dup 0) (match_dup 4))
7082 (compare:CC (match_dup 0)
7086 ;; Split a logical operation that we can't do in one insn into two insns,
7087 ;; each of which does one 16-bit part. This is used by combine.
7090 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7091 (match_operator:DI 3 "boolean_or_operator"
7092 [(match_operand:DI 1 "gpc_reg_operand" "")
7093 (match_operand:DI 2 "non_logical_cint_operand" "")]))]
7095 [(set (match_dup 0) (match_dup 4))
7096 (set (match_dup 0) (match_dup 5))]
7101 if (GET_CODE (operands[2]) == CONST_DOUBLE)
7103 HOST_WIDE_INT value = CONST_DOUBLE_LOW (operands[2]);
7104 i3 = immed_double_const (value & (~ (HOST_WIDE_INT) 0xffff),
7106 i4 = GEN_INT (value & 0xffff);
7110 i3 = GEN_INT (INTVAL (operands[2])
7111 & (~ (HOST_WIDE_INT) 0xffff));
7112 i4 = GEN_INT (INTVAL (operands[2]) & 0xffff);
7114 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
7116 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
7120 (define_insn "*boolcdi3_internal1"
7121 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7122 (match_operator:DI 3 "boolean_operator"
7123 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
7124 (match_operand:DI 2 "gpc_reg_operand" "r")]))]
7128 (define_insn "*boolcdi3_internal2"
7129 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7130 (compare:CC (match_operator:DI 4 "boolean_operator"
7131 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
7132 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7134 (clobber (match_scratch:DI 3 "=r,r"))]
7139 [(set_attr "type" "compare")
7140 (set_attr "length" "4,8")])
7143 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7144 (compare:CC (match_operator:DI 4 "boolean_operator"
7145 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7146 (match_operand:DI 2 "gpc_reg_operand" "")])
7148 (clobber (match_scratch:DI 3 ""))]
7149 "TARGET_POWERPC64 && reload_completed"
7150 [(set (match_dup 3) (match_dup 4))
7152 (compare:CC (match_dup 3)
7156 (define_insn "*boolcdi3_internal3"
7157 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7158 (compare:CC (match_operator:DI 4 "boolean_operator"
7159 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
7160 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7162 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7168 [(set_attr "type" "compare")
7169 (set_attr "length" "4,8")])
7172 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7173 (compare:CC (match_operator:DI 4 "boolean_operator"
7174 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7175 (match_operand:DI 2 "gpc_reg_operand" "")])
7177 (set (match_operand:DI 0 "gpc_reg_operand" "")
7179 "TARGET_POWERPC64 && reload_completed"
7180 [(set (match_dup 0) (match_dup 4))
7182 (compare:CC (match_dup 0)
7186 (define_insn "*boolccdi3_internal1"
7187 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7188 (match_operator:DI 3 "boolean_operator"
7189 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
7190 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r"))]))]
7194 (define_insn "*boolccdi3_internal2"
7195 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7196 (compare:CC (match_operator:DI 4 "boolean_operator"
7197 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
7198 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
7200 (clobber (match_scratch:DI 3 "=r,r"))]
7205 [(set_attr "type" "compare")
7206 (set_attr "length" "4,8")])
7209 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7210 (compare:CC (match_operator:DI 4 "boolean_operator"
7211 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7212 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
7214 (clobber (match_scratch:DI 3 ""))]
7215 "TARGET_POWERPC64 && reload_completed"
7216 [(set (match_dup 3) (match_dup 4))
7218 (compare:CC (match_dup 3)
7222 (define_insn "*boolccdi3_internal3"
7223 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7224 (compare:CC (match_operator:DI 4 "boolean_operator"
7225 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
7226 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
7228 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7234 [(set_attr "type" "compare")
7235 (set_attr "length" "4,8")])
7238 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7239 (compare:CC (match_operator:DI 4 "boolean_operator"
7240 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7241 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
7243 (set (match_operand:DI 0 "gpc_reg_operand" "")
7245 "TARGET_POWERPC64 && reload_completed"
7246 [(set (match_dup 0) (match_dup 4))
7248 (compare:CC (match_dup 0)
7252 ;; Now define ways of moving data around.
7254 ;; Set up a register with a value from the GOT table
7256 (define_expand "movsi_got"
7257 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7258 (unspec:SI [(match_operand:SI 1 "got_operand" "")
7259 (match_dup 2)] UNSPEC_MOVSI_GOT))]
7260 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
7263 if (GET_CODE (operands[1]) == CONST)
7265 rtx offset = const0_rtx;
7266 HOST_WIDE_INT value;
7268 operands[1] = eliminate_constant_term (XEXP (operands[1], 0), &offset);
7269 value = INTVAL (offset);
7272 rtx tmp = (no_new_pseudos ? operands[0] : gen_reg_rtx (Pmode));
7273 emit_insn (gen_movsi_got (tmp, operands[1]));
7274 emit_insn (gen_addsi3 (operands[0], tmp, offset));
7279 operands[2] = rs6000_got_register (operands[1]);
7282 (define_insn "*movsi_got_internal"
7283 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7284 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
7285 (match_operand:SI 2 "gpc_reg_operand" "b")]
7287 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
7288 "{l|lwz} %0,%a1@got(%2)"
7289 [(set_attr "type" "load")])
7291 ;; Used by sched, shorten_branches and final when the GOT pseudo reg
7292 ;; didn't get allocated to a hard register.
7294 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7295 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
7296 (match_operand:SI 2 "memory_operand" "")]
7298 "DEFAULT_ABI == ABI_V4
7300 && (reload_in_progress || reload_completed)"
7301 [(set (match_dup 0) (match_dup 2))
7302 (set (match_dup 0) (unspec:SI [(match_dup 1)(match_dup 0)]
7306 ;; For SI, we special-case integers that can't be loaded in one insn. We
7307 ;; do the load 16-bits at a time. We could do this by loading from memory,
7308 ;; and this is even supposed to be faster, but it is simpler not to get
7309 ;; integers in the TOC.
7310 (define_insn "movsi_low"
7311 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7312 (mem:SI (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
7313 (match_operand 2 "" ""))))]
7314 "TARGET_MACHO && ! TARGET_64BIT"
7315 "{l|lwz} %0,lo16(%2)(%1)"
7316 [(set_attr "type" "load")
7317 (set_attr "length" "4")])
7319 (define_insn "*movsi_internal1"
7320 [(set (match_operand:SI 0 "rs6000_nonimmediate_operand" "=r,r,r,m,r,r,r,r,r,*q,*c*l,*h,*h")
7321 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,R,*h,r,r,r,0"))]
7322 "gpc_reg_operand (operands[0], SImode)
7323 || gpc_reg_operand (operands[1], SImode)"
7327 {l%U1%X1|lwz%U1%X1} %0,%1
7328 {st%U0%X0|stw%U0%X0} %1,%0
7338 [(set_attr "type" "*,*,load,store,*,*,*,*,mfjmpr,*,mtjmpr,*,*")
7339 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4,4,4")])
7341 ;; Split a load of a large constant into the appropriate two-insn
7345 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7346 (match_operand:SI 1 "const_int_operand" ""))]
7347 "(unsigned HOST_WIDE_INT) (INTVAL (operands[1]) + 0x8000) >= 0x10000
7348 && (INTVAL (operands[1]) & 0xffff) != 0"
7352 (ior:SI (match_dup 0)
7355 { rtx tem = rs6000_emit_set_const (operands[0], SImode, operands[1], 2);
7357 if (tem == operands[0])
7363 (define_insn "*mov<mode>_internal2"
7364 [(set (match_operand:CC 2 "cc_reg_operand" "=y,x,?y")
7365 (compare:CC (match_operand:P 1 "gpc_reg_operand" "0,r,r")
7367 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r") (match_dup 1))]
7370 {cmpi|cmp<wd>i} %2,%0,0
7373 [(set_attr "type" "cmp,compare,cmp")
7374 (set_attr "length" "4,4,8")])
7377 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
7378 (compare:CC (match_operand:P 1 "gpc_reg_operand" "")
7380 (set (match_operand:P 0 "gpc_reg_operand" "") (match_dup 1))]
7382 [(set (match_dup 0) (match_dup 1))
7384 (compare:CC (match_dup 0)
7388 (define_insn "*movhi_internal"
7389 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
7390 (match_operand:HI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
7391 "gpc_reg_operand (operands[0], HImode)
7392 || gpc_reg_operand (operands[1], HImode)"
7402 [(set_attr "type" "*,load,store,*,mfjmpr,*,mtjmpr,*")])
7404 (define_expand "mov<mode>"
7405 [(set (match_operand:INT 0 "general_operand" "")
7406 (match_operand:INT 1 "any_operand" ""))]
7408 "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
7410 (define_insn "*movqi_internal"
7411 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
7412 (match_operand:QI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
7413 "gpc_reg_operand (operands[0], QImode)
7414 || gpc_reg_operand (operands[1], QImode)"
7424 [(set_attr "type" "*,load,store,*,mfjmpr,*,mtjmpr,*")])
7426 ;; Here is how to move condition codes around. When we store CC data in
7427 ;; an integer register or memory, we store just the high-order 4 bits.
7428 ;; This lets us not shift in the most common case of CR0.
7429 (define_expand "movcc"
7430 [(set (match_operand:CC 0 "nonimmediate_operand" "")
7431 (match_operand:CC 1 "nonimmediate_operand" ""))]
7435 (define_insn "*movcc_internal1"
7436 [(set (match_operand:CC 0 "nonimmediate_operand" "=y,x,?y,r,r,r,r,q,cl,r,m")
7437 (match_operand:CC 1 "nonimmediate_operand" "y,r,r,x,y,r,h,r,r,m,r"))]
7438 "register_operand (operands[0], CCmode)
7439 || register_operand (operands[1], CCmode)"
7443 {rlinm|rlwinm} %1,%1,%F0,0xffffffff\;mtcrf %R0,%1\;{rlinm|rlwinm} %1,%1,%f0,0xffffffff
7445 mfcr %0%Q1\;{rlinm|rlwinm} %0,%0,%f1,0xf0000000
7450 {l%U1%X1|lwz%U1%X1} %0,%1
7451 {st%U0%U1|stw%U0%U1} %1,%0"
7453 (cond [(eq_attr "alternative" "0")
7454 (const_string "cr_logical")
7455 (eq_attr "alternative" "1,2")
7456 (const_string "mtcr")
7457 (eq_attr "alternative" "5,7")
7458 (const_string "integer")
7459 (eq_attr "alternative" "6")
7460 (const_string "mfjmpr")
7461 (eq_attr "alternative" "8")
7462 (const_string "mtjmpr")
7463 (eq_attr "alternative" "9")
7464 (const_string "load")
7465 (eq_attr "alternative" "10")
7466 (const_string "store")
7467 (ne (symbol_ref "TARGET_MFCRF") (const_int 0))
7468 (const_string "mfcrf")
7470 (const_string "mfcr")))
7471 (set_attr "length" "4,4,12,4,8,4,4,4,4,4,4")])
7473 ;; For floating-point, we normally deal with the floating-point registers
7474 ;; unless -msoft-float is used. The sole exception is that parameter passing
7475 ;; can produce floating-point values in fixed-point registers. Unless the
7476 ;; value is a simple constant or already in memory, we deal with this by
7477 ;; allocating memory and copying the value explicitly via that memory location.
7478 (define_expand "movsf"
7479 [(set (match_operand:SF 0 "nonimmediate_operand" "")
7480 (match_operand:SF 1 "any_operand" ""))]
7482 "{ rs6000_emit_move (operands[0], operands[1], SFmode); DONE; }")
7485 [(set (match_operand:SF 0 "gpc_reg_operand" "")
7486 (match_operand:SF 1 "const_double_operand" ""))]
7488 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
7489 || (GET_CODE (operands[0]) == SUBREG
7490 && GET_CODE (SUBREG_REG (operands[0])) == REG
7491 && REGNO (SUBREG_REG (operands[0])) <= 31))"
7492 [(set (match_dup 2) (match_dup 3))]
7498 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
7499 REAL_VALUE_TO_TARGET_SINGLE (rv, l);
7501 if (! TARGET_POWERPC64)
7502 operands[2] = operand_subword (operands[0], 0, 0, SFmode);
7504 operands[2] = gen_lowpart (SImode, operands[0]);
7506 operands[3] = gen_int_mode (l, SImode);
7509 (define_insn "*movsf_hardfloat"
7510 [(set (match_operand:SF 0 "nonimmediate_operand" "=!r,!r,m,f,f,m,!cl,!q,!r,!h,!r,!r")
7511 (match_operand:SF 1 "input_operand" "r,m,r,f,m,f,r,r,h,0,G,Fn"))]
7512 "(gpc_reg_operand (operands[0], SFmode)
7513 || gpc_reg_operand (operands[1], SFmode))
7514 && (TARGET_HARD_FLOAT && TARGET_FPRS)"
7517 {l%U1%X1|lwz%U1%X1} %0,%1
7518 {st%U0%X0|stw%U0%X0} %1,%0
7528 [(set_attr "type" "*,load,store,fp,fpload,fpstore,*,mtjmpr,*,*,*,*")
7529 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,8")])
7531 (define_insn "*movsf_softfloat"
7532 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,cl,q,r,r,m,r,r,r,r,r,*h")
7533 (match_operand:SF 1 "input_operand" "r,r,r,h,m,r,I,L,R,G,Fn,0"))]
7534 "(gpc_reg_operand (operands[0], SFmode)
7535 || gpc_reg_operand (operands[1], SFmode))
7536 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)"
7542 {l%U1%X1|lwz%U1%X1} %0,%1
7543 {st%U0%X0|stw%U0%X0} %1,%0
7550 [(set_attr "type" "*,mtjmpr,*,*,load,store,*,*,*,*,*,*")
7551 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,8,4")])
7554 (define_expand "movdf"
7555 [(set (match_operand:DF 0 "nonimmediate_operand" "")
7556 (match_operand:DF 1 "any_operand" ""))]
7558 "{ rs6000_emit_move (operands[0], operands[1], DFmode); DONE; }")
7561 [(set (match_operand:DF 0 "gpc_reg_operand" "")
7562 (match_operand:DF 1 "const_int_operand" ""))]
7563 "! TARGET_POWERPC64 && reload_completed
7564 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
7565 || (GET_CODE (operands[0]) == SUBREG
7566 && GET_CODE (SUBREG_REG (operands[0])) == REG
7567 && REGNO (SUBREG_REG (operands[0])) <= 31))"
7568 [(set (match_dup 2) (match_dup 4))
7569 (set (match_dup 3) (match_dup 1))]
7572 int endian = (WORDS_BIG_ENDIAN == 0);
7573 HOST_WIDE_INT value = INTVAL (operands[1]);
7575 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
7576 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
7577 #if HOST_BITS_PER_WIDE_INT == 32
7578 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
7580 operands[4] = GEN_INT (value >> 32);
7581 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
7586 [(set (match_operand:DF 0 "gpc_reg_operand" "")
7587 (match_operand:DF 1 "const_double_operand" ""))]
7588 "! TARGET_POWERPC64 && reload_completed
7589 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
7590 || (GET_CODE (operands[0]) == SUBREG
7591 && GET_CODE (SUBREG_REG (operands[0])) == REG
7592 && REGNO (SUBREG_REG (operands[0])) <= 31))"
7593 [(set (match_dup 2) (match_dup 4))
7594 (set (match_dup 3) (match_dup 5))]
7597 int endian = (WORDS_BIG_ENDIAN == 0);
7601 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
7602 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
7604 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
7605 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
7606 operands[4] = gen_int_mode (l[endian], SImode);
7607 operands[5] = gen_int_mode (l[1 - endian], SImode);
7611 [(set (match_operand:DF 0 "gpc_reg_operand" "")
7612 (match_operand:DF 1 "easy_fp_constant" ""))]
7613 "TARGET_POWERPC64 && reload_completed
7614 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
7615 || (GET_CODE (operands[0]) == SUBREG
7616 && GET_CODE (SUBREG_REG (operands[0])) == REG
7617 && REGNO (SUBREG_REG (operands[0])) <= 31))"
7618 [(set (match_dup 2) (match_dup 3))]
7621 int endian = (WORDS_BIG_ENDIAN == 0);
7624 #if HOST_BITS_PER_WIDE_INT >= 64
7628 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
7629 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
7631 operands[2] = gen_lowpart (DImode, operands[0]);
7632 /* HIGHPART is lower memory address when WORDS_BIG_ENDIAN. */
7633 #if HOST_BITS_PER_WIDE_INT >= 64
7634 val = ((HOST_WIDE_INT)(unsigned long)l[endian] << 32
7635 | ((HOST_WIDE_INT)(unsigned long)l[1 - endian]));
7637 operands[3] = gen_int_mode (val, DImode);
7639 operands[3] = immed_double_const (l[1 - endian], l[endian], DImode);
7643 ;; Don't have reload use general registers to load a constant. First,
7644 ;; it might not work if the output operand is the equivalent of
7645 ;; a non-offsettable memref, but also it is less efficient than loading
7646 ;; the constant into an FP register, since it will probably be used there.
7647 ;; The "??" is a kludge until we can figure out a more reasonable way
7648 ;; of handling these non-offsettable values.
7649 (define_insn "*movdf_hardfloat32"
7650 [(set (match_operand:DF 0 "nonimmediate_operand" "=!r,??r,m,f,f,m,!r,!r,!r")
7651 (match_operand:DF 1 "input_operand" "r,m,r,f,m,f,G,H,F"))]
7652 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS
7653 && (gpc_reg_operand (operands[0], DFmode)
7654 || gpc_reg_operand (operands[1], DFmode))"
7657 switch (which_alternative)
7662 /* We normally copy the low-numbered register first. However, if
7663 the first register operand 0 is the same as the second register
7664 of operand 1, we must copy in the opposite order. */
7665 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
7666 return \"mr %L0,%L1\;mr %0,%1\";
7668 return \"mr %0,%1\;mr %L0,%L1\";
7670 if (GET_CODE (operands[1]) == MEM
7671 && (rs6000_legitimate_offset_address_p (DFmode, XEXP (operands[1], 0),
7672 reload_completed || reload_in_progress)
7673 || GET_CODE (XEXP (operands[1], 0)) == REG
7674 || GET_CODE (XEXP (operands[1], 0)) == LO_SUM
7675 || GET_CODE (XEXP (operands[1], 0)) == PRE_INC
7676 || GET_CODE (XEXP (operands[1], 0)) == PRE_DEC))
7678 /* If the low-address word is used in the address, we must load
7679 it last. Otherwise, load it first. Note that we cannot have
7680 auto-increment in that case since the address register is
7681 known to be dead. */
7682 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
7684 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
7686 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
7692 addreg = find_addr_reg (XEXP (operands[1], 0));
7693 if (refers_to_regno_p (REGNO (operands[0]),
7694 REGNO (operands[0]) + 1,
7697 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
7698 output_asm_insn (\"{lx|lwzx} %L0,%1\", operands);
7699 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
7700 return \"{lx|lwzx} %0,%1\";
7704 output_asm_insn (\"{lx|lwzx} %0,%1\", operands);
7705 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
7706 output_asm_insn (\"{lx|lwzx} %L0,%1\", operands);
7707 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
7712 if (GET_CODE (operands[0]) == MEM
7713 && (rs6000_legitimate_offset_address_p (DFmode, XEXP (operands[0], 0),
7714 reload_completed || reload_in_progress)
7715 || GET_CODE (XEXP (operands[0], 0)) == REG
7716 || GET_CODE (XEXP (operands[0], 0)) == LO_SUM
7717 || GET_CODE (XEXP (operands[0], 0)) == PRE_INC
7718 || GET_CODE (XEXP (operands[0], 0)) == PRE_DEC))
7719 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
7724 addreg = find_addr_reg (XEXP (operands[0], 0));
7725 output_asm_insn (\"{stx|stwx} %1,%0\", operands);
7726 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
7727 output_asm_insn (\"{stx|stwx} %L1,%0\", operands);
7728 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
7732 return \"fmr %0,%1\";
7734 return \"lfd%U1%X1 %0,%1\";
7736 return \"stfd%U0%X0 %1,%0\";
7743 [(set_attr "type" "two,load,store,fp,fpload,fpstore,*,*,*")
7744 (set_attr "length" "8,16,16,4,4,4,8,12,16")])
7746 (define_insn "*movdf_softfloat32"
7747 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,m,r,r,r")
7748 (match_operand:DF 1 "input_operand" "r,m,r,G,H,F"))]
7749 "! TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || TARGET_E500_SINGLE)
7750 && (gpc_reg_operand (operands[0], DFmode)
7751 || gpc_reg_operand (operands[1], DFmode))"
7754 switch (which_alternative)
7759 /* We normally copy the low-numbered register first. However, if
7760 the first register operand 0 is the same as the second register of
7761 operand 1, we must copy in the opposite order. */
7762 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
7763 return \"mr %L0,%L1\;mr %0,%1\";
7765 return \"mr %0,%1\;mr %L0,%L1\";
7767 /* If the low-address word is used in the address, we must load
7768 it last. Otherwise, load it first. Note that we cannot have
7769 auto-increment in that case since the address register is
7770 known to be dead. */
7771 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
7773 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
7775 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
7777 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
7784 [(set_attr "type" "two,load,store,*,*,*")
7785 (set_attr "length" "8,8,8,8,12,16")])
7787 ; ld/std require word-aligned displacements -> 'Y' constraint.
7788 ; List Y->r and r->Y before r->r for reload.
7789 (define_insn "*movdf_hardfloat64"
7790 [(set (match_operand:DF 0 "nonimmediate_operand" "=Y,r,!r,f,f,m,!cl,!r,!h,!r,!r,!r")
7791 (match_operand:DF 1 "input_operand" "r,Y,r,f,m,f,r,h,0,G,H,F"))]
7792 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS
7793 && (gpc_reg_operand (operands[0], DFmode)
7794 || gpc_reg_operand (operands[1], DFmode))"
7808 [(set_attr "type" "*,load,store,fp,fpload,fpstore,mtjmpr,*,*,*,*,*")
7809 (set_attr "length" "4,4,4,4,4,4,4,4,4,8,12,16")])
7811 (define_insn "*movdf_softfloat64"
7812 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,Y,r,cl,r,r,r,r,*h")
7813 (match_operand:DF 1 "input_operand" "Y,r,r,r,h,G,H,F,0"))]
7814 "TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)
7815 && (gpc_reg_operand (operands[0], DFmode)
7816 || gpc_reg_operand (operands[1], DFmode))"
7827 [(set_attr "type" "load,store,*,*,*,*,*,*,*")
7828 (set_attr "length" "4,4,4,4,4,8,12,16,4")])
7830 (define_expand "movtf"
7831 [(set (match_operand:TF 0 "general_operand" "")
7832 (match_operand:TF 1 "any_operand" ""))]
7833 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
7834 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
7835 "{ rs6000_emit_move (operands[0], operands[1], TFmode); DONE; }")
7837 ; It's important to list the o->f and f->o moves before f->f because
7838 ; otherwise reload, given m->f, will try to pick f->f and reload it,
7839 ; which doesn't make progress. Likewise r->Y must be before r->r.
7840 (define_insn_and_split "*movtf_internal"
7841 [(set (match_operand:TF 0 "nonimmediate_operand" "=o,f,f,r,Y,r")
7842 (match_operand:TF 1 "input_operand" "f,o,f,YGHF,r,r"))]
7843 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
7844 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128
7845 && (gpc_reg_operand (operands[0], TFmode)
7846 || gpc_reg_operand (operands[1], TFmode))"
7848 "&& reload_completed"
7850 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
7851 [(set_attr "length" "8,8,8,20,20,16")])
7853 (define_expand "extenddftf2"
7854 [(parallel [(set (match_operand:TF 0 "nonimmediate_operand" "")
7855 (float_extend:TF (match_operand:DF 1 "input_operand" "")))
7856 (use (match_dup 2))])]
7857 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
7858 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
7860 operands[2] = CONST0_RTX (DFmode);
7863 (define_insn_and_split "*extenddftf2_internal"
7864 [(set (match_operand:TF 0 "nonimmediate_operand" "=o,f,&f,r")
7865 (float_extend:TF (match_operand:DF 1 "input_operand" "fr,mf,mf,rmGHF")))
7866 (use (match_operand:DF 2 "zero_reg_mem_operand" "rf,m,f,n"))]
7867 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
7868 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
7870 "&& reload_completed"
7873 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
7874 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
7875 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word),
7877 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word),
7882 (define_expand "extendsftf2"
7883 [(set (match_operand:TF 0 "nonimmediate_operand" "")
7884 (float_extend:TF (match_operand:SF 1 "gpc_reg_operand" "")))]
7885 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
7886 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
7888 rtx tmp = gen_reg_rtx (DFmode);
7889 emit_insn (gen_extendsfdf2 (tmp, operands[1]));
7890 emit_insn (gen_extenddftf2 (operands[0], tmp));
7894 (define_expand "trunctfdf2"
7895 [(set (match_operand:DF 0 "gpc_reg_operand" "")
7896 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "")))]
7897 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
7898 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
7901 (define_insn_and_split "trunctfdf2_internal1"
7902 [(set (match_operand:DF 0 "gpc_reg_operand" "=f,?f")
7903 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "0,f")))]
7904 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN) && !TARGET_XL_COMPAT
7905 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
7909 "&& reload_completed && REGNO (operands[0]) == REGNO (operands[1])"
7912 emit_note (NOTE_INSN_DELETED);
7915 [(set_attr "type" "fp")])
7917 (define_insn "trunctfdf2_internal2"
7918 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
7919 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "f")))]
7920 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN) && TARGET_XL_COMPAT
7921 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
7923 [(set_attr "type" "fp")])
7925 (define_insn_and_split "trunctfsf2"
7926 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
7927 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "f")))
7928 (clobber (match_scratch:DF 2 "=f"))]
7929 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
7930 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
7932 "&& reload_completed"
7934 (float_truncate:DF (match_dup 1)))
7936 (float_truncate:SF (match_dup 2)))]
7939 (define_expand "floatsitf2"
7940 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
7941 (float:TF (match_operand:SI 1 "gpc_reg_operand" "r")))]
7942 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
7943 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
7945 rtx tmp = gen_reg_rtx (DFmode);
7946 expand_float (tmp, operands[1], false);
7947 emit_insn (gen_extenddftf2 (operands[0], tmp));
7951 ; fadd, but rounding towards zero.
7952 ; This is probably not the optimal code sequence.
7953 (define_insn "fix_trunc_helper"
7954 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
7955 (unspec:DF [(match_operand:TF 1 "gpc_reg_operand" "f")]
7956 UNSPEC_FIX_TRUNC_TF))
7957 (clobber (match_operand:DF 2 "gpc_reg_operand" "=&f"))]
7958 "TARGET_HARD_FLOAT && TARGET_FPRS"
7959 "mffs %2\n\tmtfsb1 31\n\tmtfsb0 30\n\tfadd %0,%1,%L1\n\tmtfsf 1,%2"
7960 [(set_attr "type" "fp")
7961 (set_attr "length" "20")])
7963 (define_expand "fix_trunctfsi2"
7964 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
7965 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))
7966 (clobber (match_dup 2))
7967 (clobber (match_dup 3))
7968 (clobber (match_dup 4))
7969 (clobber (match_dup 5))])]
7970 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
7971 && (TARGET_POWER2 || TARGET_POWERPC)
7972 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
7974 operands[2] = gen_reg_rtx (DFmode);
7975 operands[3] = gen_reg_rtx (DFmode);
7976 operands[4] = gen_reg_rtx (DImode);
7977 operands[5] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
7980 (define_insn_and_split "*fix_trunctfsi2_internal"
7981 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7982 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "f")))
7983 (clobber (match_operand:DF 2 "gpc_reg_operand" "=f"))
7984 (clobber (match_operand:DF 3 "gpc_reg_operand" "=&f"))
7985 (clobber (match_operand:DI 4 "gpc_reg_operand" "=f"))
7986 (clobber (match_operand:DI 5 "memory_operand" "=o"))]
7987 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
7988 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
7990 "&& (!no_new_pseudos || offsettable_nonstrict_memref_p (operands[5]))"
7994 emit_insn (gen_fix_trunc_helper (operands[2], operands[1], operands[3]));
7996 gcc_assert (MEM_P (operands[5]));
7997 lowword = adjust_address (operands[5], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
7999 emit_insn (gen_fctiwz (operands[4], operands[2]));
8000 emit_move_insn (operands[5], operands[4]);
8001 emit_move_insn (operands[0], lowword);
8005 (define_insn "negtf2"
8006 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8007 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "f")))]
8008 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8009 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8012 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8013 return \"fneg %L0,%L1\;fneg %0,%1\";
8015 return \"fneg %0,%1\;fneg %L0,%L1\";
8017 [(set_attr "type" "fp")
8018 (set_attr "length" "8")])
8020 (define_expand "abstf2"
8021 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8022 (abs:TF (match_operand:TF 1 "gpc_reg_operand" "f")))]
8023 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8024 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8027 rtx label = gen_label_rtx ();
8028 emit_insn (gen_abstf2_internal (operands[0], operands[1], label));
8033 (define_expand "abstf2_internal"
8034 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8035 (match_operand:TF 1 "gpc_reg_operand" "f"))
8036 (set (match_dup 3) (match_dup 5))
8037 (set (match_dup 5) (abs:DF (match_dup 5)))
8038 (set (match_dup 4) (compare:CCFP (match_dup 3) (match_dup 5)))
8039 (set (pc) (if_then_else (eq (match_dup 4) (const_int 0))
8040 (label_ref (match_operand 2 "" ""))
8042 (set (match_dup 6) (neg:DF (match_dup 6)))]
8043 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8044 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8047 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
8048 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
8049 operands[3] = gen_reg_rtx (DFmode);
8050 operands[4] = gen_reg_rtx (CCFPmode);
8051 operands[5] = simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word);
8052 operands[6] = simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word);
8055 ;; Next come the multi-word integer load and store and the load and store
8058 ; List r->r after r->"o<>", otherwise reload will try to reload a
8059 ; non-offsettable address by using r->r which won't make progress.
8060 (define_insn "*movdi_internal32"
8061 [(set (match_operand:DI 0 "nonimmediate_operand" "=o<>,r,r,*f,*f,m,r")
8062 (match_operand:DI 1 "input_operand" "r,r,m,f,m,f,IJKnGHF"))]
8064 && (gpc_reg_operand (operands[0], DImode)
8065 || gpc_reg_operand (operands[1], DImode))"
8074 [(set_attr "type" "load,*,store,fp,fpload,fpstore,*")])
8077 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8078 (match_operand:DI 1 "const_int_operand" ""))]
8079 "! TARGET_POWERPC64 && reload_completed"
8080 [(set (match_dup 2) (match_dup 4))
8081 (set (match_dup 3) (match_dup 1))]
8084 HOST_WIDE_INT value = INTVAL (operands[1]);
8085 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
8087 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
8089 #if HOST_BITS_PER_WIDE_INT == 32
8090 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
8092 operands[4] = GEN_INT (value >> 32);
8093 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
8098 [(set (match_operand:DI 0 "nonimmediate_operand" "")
8099 (match_operand:DI 1 "input_operand" ""))]
8100 "reload_completed && !TARGET_POWERPC64
8101 && gpr_or_gpr_p (operands[0], operands[1])"
8103 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
8105 (define_insn "*movdi_internal64"
8106 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,*f,*f,m,r,*h,*h")
8107 (match_operand:DI 1 "input_operand" "r,m,r,I,L,nF,R,f,m,f,*h,r,0"))]
8109 && (gpc_reg_operand (operands[0], DImode)
8110 || gpc_reg_operand (operands[1], DImode))"
8125 [(set_attr "type" "*,load,store,*,*,*,*,fp,fpload,fpstore,mfjmpr,mtjmpr,*")
8126 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4")])
8128 ;; immediate value valid for a single instruction hiding in a const_double
8130 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
8131 (match_operand:DI 1 "const_double_operand" "F"))]
8132 "HOST_BITS_PER_WIDE_INT == 32 && TARGET_POWERPC64
8133 && GET_CODE (operands[1]) == CONST_DOUBLE
8134 && num_insns_constant (operands[1], DImode) == 1"
8137 return ((unsigned HOST_WIDE_INT)
8138 (CONST_DOUBLE_LOW (operands[1]) + 0x8000) < 0x10000)
8139 ? \"li %0,%1\" : \"lis %0,%v1\";
8142 ;; Generate all one-bits and clear left or right.
8143 ;; Use (and:DI (rotate:DI ...)) to avoid anddi3 unnecessary clobber.
8145 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8146 (match_operand:DI 1 "mask_operand" ""))]
8147 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
8148 [(set (match_dup 0) (const_int -1))
8150 (and:DI (rotate:DI (match_dup 0)
8155 ;; Split a load of a large constant into the appropriate five-instruction
8156 ;; sequence. Handle anything in a constant number of insns.
8157 ;; When non-easy constants can go in the TOC, this should use
8158 ;; easy_fp_constant predicate.
8160 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8161 (match_operand:DI 1 "const_int_operand" ""))]
8162 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
8163 [(set (match_dup 0) (match_dup 2))
8164 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
8166 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
8168 if (tem == operands[0])
8175 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8176 (match_operand:DI 1 "const_double_operand" ""))]
8177 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
8178 [(set (match_dup 0) (match_dup 2))
8179 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
8181 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
8183 if (tem == operands[0])
8189 ;; TImode is similar, except that we usually want to compute the address into
8190 ;; a register and use lsi/stsi (the exception is during reload). MQ is also
8191 ;; clobbered in stsi for POWER, so we need a SCRATCH for it.
8193 ;; We say that MQ is clobbered in the last alternative because the first
8194 ;; alternative would never get used otherwise since it would need a reload
8195 ;; while the 2nd alternative would not. We put memory cases first so they
8196 ;; are preferred. Otherwise, we'd try to reload the output instead of
8197 ;; giving the SCRATCH mq.
8199 (define_insn "*movti_power"
8200 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,m,????r,????r,????r,r")
8201 (match_operand:TI 1 "input_operand" "r,r,r,Q,m,n"))
8202 (clobber (match_scratch:SI 2 "=q,q#X,X,X,X,X"))]
8203 "TARGET_POWER && ! TARGET_POWERPC64
8204 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
8207 switch (which_alternative)
8214 return \"{stsi|stswi} %1,%P0,16\";
8219 /* If the address is not used in the output, we can use lsi. Otherwise,
8220 fall through to generating four loads. */
8222 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
8223 return \"{lsi|lswi} %0,%P1,16\";
8224 /* ... fall through ... */
8230 [(set_attr "type" "store,store,*,load,load,*")])
8232 (define_insn "*movti_string"
8233 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,o<>,????r,????r,????r,r")
8234 (match_operand:TI 1 "input_operand" "r,r,r,Q,m,n"))]
8235 "! TARGET_POWER && ! TARGET_POWERPC64
8236 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
8239 switch (which_alternative)
8245 return \"{stsi|stswi} %1,%P0,16\";
8250 /* If the address is not used in the output, we can use lsi. Otherwise,
8251 fall through to generating four loads. */
8253 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
8254 return \"{lsi|lswi} %0,%P1,16\";
8255 /* ... fall through ... */
8261 [(set_attr "type" "store,store,*,load,load,*")])
8263 (define_insn "*movti_ppc64"
8264 [(set (match_operand:TI 0 "nonimmediate_operand" "=r,o<>,r")
8265 (match_operand:TI 1 "input_operand" "r,r,m"))]
8266 "TARGET_POWERPC64 && (gpc_reg_operand (operands[0], TImode)
8267 || gpc_reg_operand (operands[1], TImode))"
8269 [(set_attr "type" "*,load,store")])
8272 [(set (match_operand:TI 0 "gpc_reg_operand" "")
8273 (match_operand:TI 1 "const_double_operand" ""))]
8275 [(set (match_dup 2) (match_dup 4))
8276 (set (match_dup 3) (match_dup 5))]
8279 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
8281 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
8283 if (GET_CODE (operands[1]) == CONST_DOUBLE)
8285 operands[4] = GEN_INT (CONST_DOUBLE_HIGH (operands[1]));
8286 operands[5] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
8288 else if (GET_CODE (operands[1]) == CONST_INT)
8290 operands[4] = GEN_INT (- (INTVAL (operands[1]) < 0));
8291 operands[5] = operands[1];
8298 [(set (match_operand:TI 0 "nonimmediate_operand" "")
8299 (match_operand:TI 1 "input_operand" ""))]
8301 && gpr_or_gpr_p (operands[0], operands[1])"
8303 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
8305 (define_expand "load_multiple"
8306 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
8307 (match_operand:SI 1 "" ""))
8308 (use (match_operand:SI 2 "" ""))])]
8309 "TARGET_STRING && !TARGET_POWERPC64"
8317 /* Support only loading a constant number of fixed-point registers from
8318 memory and only bother with this if more than two; the machine
8319 doesn't support more than eight. */
8320 if (GET_CODE (operands[2]) != CONST_INT
8321 || INTVAL (operands[2]) <= 2
8322 || INTVAL (operands[2]) > 8
8323 || GET_CODE (operands[1]) != MEM
8324 || GET_CODE (operands[0]) != REG
8325 || REGNO (operands[0]) >= 32)
8328 count = INTVAL (operands[2]);
8329 regno = REGNO (operands[0]);
8331 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
8332 op1 = replace_equiv_address (operands[1],
8333 force_reg (SImode, XEXP (operands[1], 0)));
8335 for (i = 0; i < count; i++)
8336 XVECEXP (operands[3], 0, i)
8337 = gen_rtx_SET (VOIDmode, gen_rtx_REG (SImode, regno + i),
8338 adjust_address_nv (op1, SImode, i * 4));
8341 (define_insn "*ldmsi8"
8342 [(match_parallel 0 "load_multiple_operation"
8343 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8344 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8345 (set (match_operand:SI 3 "gpc_reg_operand" "")
8346 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8347 (set (match_operand:SI 4 "gpc_reg_operand" "")
8348 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8349 (set (match_operand:SI 5 "gpc_reg_operand" "")
8350 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8351 (set (match_operand:SI 6 "gpc_reg_operand" "")
8352 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
8353 (set (match_operand:SI 7 "gpc_reg_operand" "")
8354 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
8355 (set (match_operand:SI 8 "gpc_reg_operand" "")
8356 (mem:SI (plus:SI (match_dup 1) (const_int 24))))
8357 (set (match_operand:SI 9 "gpc_reg_operand" "")
8358 (mem:SI (plus:SI (match_dup 1) (const_int 28))))])]
8359 "TARGET_STRING && XVECLEN (operands[0], 0) == 8"
8361 { return rs6000_output_load_multiple (operands); }"
8362 [(set_attr "type" "load")
8363 (set_attr "length" "32")])
8365 (define_insn "*ldmsi7"
8366 [(match_parallel 0 "load_multiple_operation"
8367 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8368 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8369 (set (match_operand:SI 3 "gpc_reg_operand" "")
8370 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8371 (set (match_operand:SI 4 "gpc_reg_operand" "")
8372 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8373 (set (match_operand:SI 5 "gpc_reg_operand" "")
8374 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8375 (set (match_operand:SI 6 "gpc_reg_operand" "")
8376 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
8377 (set (match_operand:SI 7 "gpc_reg_operand" "")
8378 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
8379 (set (match_operand:SI 8 "gpc_reg_operand" "")
8380 (mem:SI (plus:SI (match_dup 1) (const_int 24))))])]
8381 "TARGET_STRING && XVECLEN (operands[0], 0) == 7"
8383 { return rs6000_output_load_multiple (operands); }"
8384 [(set_attr "type" "load")
8385 (set_attr "length" "32")])
8387 (define_insn "*ldmsi6"
8388 [(match_parallel 0 "load_multiple_operation"
8389 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8390 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8391 (set (match_operand:SI 3 "gpc_reg_operand" "")
8392 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8393 (set (match_operand:SI 4 "gpc_reg_operand" "")
8394 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8395 (set (match_operand:SI 5 "gpc_reg_operand" "")
8396 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8397 (set (match_operand:SI 6 "gpc_reg_operand" "")
8398 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
8399 (set (match_operand:SI 7 "gpc_reg_operand" "")
8400 (mem:SI (plus:SI (match_dup 1) (const_int 20))))])]
8401 "TARGET_STRING && XVECLEN (operands[0], 0) == 6"
8403 { return rs6000_output_load_multiple (operands); }"
8404 [(set_attr "type" "load")
8405 (set_attr "length" "32")])
8407 (define_insn "*ldmsi5"
8408 [(match_parallel 0 "load_multiple_operation"
8409 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8410 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8411 (set (match_operand:SI 3 "gpc_reg_operand" "")
8412 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8413 (set (match_operand:SI 4 "gpc_reg_operand" "")
8414 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8415 (set (match_operand:SI 5 "gpc_reg_operand" "")
8416 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8417 (set (match_operand:SI 6 "gpc_reg_operand" "")
8418 (mem:SI (plus:SI (match_dup 1) (const_int 16))))])]
8419 "TARGET_STRING && XVECLEN (operands[0], 0) == 5"
8421 { return rs6000_output_load_multiple (operands); }"
8422 [(set_attr "type" "load")
8423 (set_attr "length" "32")])
8425 (define_insn "*ldmsi4"
8426 [(match_parallel 0 "load_multiple_operation"
8427 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8428 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8429 (set (match_operand:SI 3 "gpc_reg_operand" "")
8430 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8431 (set (match_operand:SI 4 "gpc_reg_operand" "")
8432 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8433 (set (match_operand:SI 5 "gpc_reg_operand" "")
8434 (mem:SI (plus:SI (match_dup 1) (const_int 12))))])]
8435 "TARGET_STRING && XVECLEN (operands[0], 0) == 4"
8437 { return rs6000_output_load_multiple (operands); }"
8438 [(set_attr "type" "load")
8439 (set_attr "length" "32")])
8441 (define_insn "*ldmsi3"
8442 [(match_parallel 0 "load_multiple_operation"
8443 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8444 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8445 (set (match_operand:SI 3 "gpc_reg_operand" "")
8446 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8447 (set (match_operand:SI 4 "gpc_reg_operand" "")
8448 (mem:SI (plus:SI (match_dup 1) (const_int 8))))])]
8449 "TARGET_STRING && XVECLEN (operands[0], 0) == 3"
8451 { return rs6000_output_load_multiple (operands); }"
8452 [(set_attr "type" "load")
8453 (set_attr "length" "32")])
8455 (define_expand "store_multiple"
8456 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
8457 (match_operand:SI 1 "" ""))
8458 (clobber (scratch:SI))
8459 (use (match_operand:SI 2 "" ""))])]
8460 "TARGET_STRING && !TARGET_POWERPC64"
8469 /* Support only storing a constant number of fixed-point registers to
8470 memory and only bother with this if more than two; the machine
8471 doesn't support more than eight. */
8472 if (GET_CODE (operands[2]) != CONST_INT
8473 || INTVAL (operands[2]) <= 2
8474 || INTVAL (operands[2]) > 8
8475 || GET_CODE (operands[0]) != MEM
8476 || GET_CODE (operands[1]) != REG
8477 || REGNO (operands[1]) >= 32)
8480 count = INTVAL (operands[2]);
8481 regno = REGNO (operands[1]);
8483 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count + 1));
8484 to = force_reg (SImode, XEXP (operands[0], 0));
8485 op0 = replace_equiv_address (operands[0], to);
8487 XVECEXP (operands[3], 0, 0)
8488 = gen_rtx_SET (VOIDmode, adjust_address_nv (op0, SImode, 0), operands[1]);
8489 XVECEXP (operands[3], 0, 1) = gen_rtx_CLOBBER (VOIDmode,
8490 gen_rtx_SCRATCH (SImode));
8492 for (i = 1; i < count; i++)
8493 XVECEXP (operands[3], 0, i + 1)
8494 = gen_rtx_SET (VOIDmode,
8495 adjust_address_nv (op0, SImode, i * 4),
8496 gen_rtx_REG (SImode, regno + i));
8499 (define_insn "*store_multiple_power"
8500 [(match_parallel 0 "store_multiple_operation"
8501 [(set (match_operand:SI 1 "indirect_operand" "=Q")
8502 (match_operand:SI 2 "gpc_reg_operand" "r"))
8503 (clobber (match_scratch:SI 3 "=q"))])]
8504 "TARGET_STRING && TARGET_POWER"
8505 "{stsi|stswi} %2,%P1,%O0"
8506 [(set_attr "type" "store")])
8508 (define_insn "*stmsi8"
8509 [(match_parallel 0 "store_multiple_operation"
8510 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
8511 (match_operand:SI 2 "gpc_reg_operand" "r"))
8512 (clobber (match_scratch:SI 3 "X"))
8513 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
8514 (match_operand:SI 4 "gpc_reg_operand" "r"))
8515 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
8516 (match_operand:SI 5 "gpc_reg_operand" "r"))
8517 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
8518 (match_operand:SI 6 "gpc_reg_operand" "r"))
8519 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
8520 (match_operand:SI 7 "gpc_reg_operand" "r"))
8521 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
8522 (match_operand:SI 8 "gpc_reg_operand" "r"))
8523 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
8524 (match_operand:SI 9 "gpc_reg_operand" "r"))
8525 (set (mem:SI (plus:SI (match_dup 1) (const_int 28)))
8526 (match_operand:SI 10 "gpc_reg_operand" "r"))])]
8527 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 9"
8528 "{stsi|stswi} %2,%1,%O0"
8529 [(set_attr "type" "store")])
8531 (define_insn "*stmsi7"
8532 [(match_parallel 0 "store_multiple_operation"
8533 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
8534 (match_operand:SI 2 "gpc_reg_operand" "r"))
8535 (clobber (match_scratch:SI 3 "X"))
8536 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
8537 (match_operand:SI 4 "gpc_reg_operand" "r"))
8538 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
8539 (match_operand:SI 5 "gpc_reg_operand" "r"))
8540 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
8541 (match_operand:SI 6 "gpc_reg_operand" "r"))
8542 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
8543 (match_operand:SI 7 "gpc_reg_operand" "r"))
8544 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
8545 (match_operand:SI 8 "gpc_reg_operand" "r"))
8546 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
8547 (match_operand:SI 9 "gpc_reg_operand" "r"))])]
8548 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 8"
8549 "{stsi|stswi} %2,%1,%O0"
8550 [(set_attr "type" "store")])
8552 (define_insn "*stmsi6"
8553 [(match_parallel 0 "store_multiple_operation"
8554 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
8555 (match_operand:SI 2 "gpc_reg_operand" "r"))
8556 (clobber (match_scratch:SI 3 "X"))
8557 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
8558 (match_operand:SI 4 "gpc_reg_operand" "r"))
8559 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
8560 (match_operand:SI 5 "gpc_reg_operand" "r"))
8561 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
8562 (match_operand:SI 6 "gpc_reg_operand" "r"))
8563 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
8564 (match_operand:SI 7 "gpc_reg_operand" "r"))
8565 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
8566 (match_operand:SI 8 "gpc_reg_operand" "r"))])]
8567 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 7"
8568 "{stsi|stswi} %2,%1,%O0"
8569 [(set_attr "type" "store")])
8571 (define_insn "*stmsi5"
8572 [(match_parallel 0 "store_multiple_operation"
8573 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
8574 (match_operand:SI 2 "gpc_reg_operand" "r"))
8575 (clobber (match_scratch:SI 3 "X"))
8576 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
8577 (match_operand:SI 4 "gpc_reg_operand" "r"))
8578 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
8579 (match_operand:SI 5 "gpc_reg_operand" "r"))
8580 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
8581 (match_operand:SI 6 "gpc_reg_operand" "r"))
8582 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
8583 (match_operand:SI 7 "gpc_reg_operand" "r"))])]
8584 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 6"
8585 "{stsi|stswi} %2,%1,%O0"
8586 [(set_attr "type" "store")])
8588 (define_insn "*stmsi4"
8589 [(match_parallel 0 "store_multiple_operation"
8590 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
8591 (match_operand:SI 2 "gpc_reg_operand" "r"))
8592 (clobber (match_scratch:SI 3 "X"))
8593 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
8594 (match_operand:SI 4 "gpc_reg_operand" "r"))
8595 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
8596 (match_operand:SI 5 "gpc_reg_operand" "r"))
8597 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
8598 (match_operand:SI 6 "gpc_reg_operand" "r"))])]
8599 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 5"
8600 "{stsi|stswi} %2,%1,%O0"
8601 [(set_attr "type" "store")])
8603 (define_insn "*stmsi3"
8604 [(match_parallel 0 "store_multiple_operation"
8605 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
8606 (match_operand:SI 2 "gpc_reg_operand" "r"))
8607 (clobber (match_scratch:SI 3 "X"))
8608 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
8609 (match_operand:SI 4 "gpc_reg_operand" "r"))
8610 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
8611 (match_operand:SI 5 "gpc_reg_operand" "r"))])]
8612 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 4"
8613 "{stsi|stswi} %2,%1,%O0"
8614 [(set_attr "type" "store")])
8616 (define_expand "setmemsi"
8617 [(parallel [(set (match_operand:BLK 0 "" "")
8618 (match_operand 2 "const_int_operand" ""))
8619 (use (match_operand:SI 1 "" ""))
8620 (use (match_operand:SI 3 "" ""))])]
8624 /* If value to set is not zero, use the library routine. */
8625 if (operands[2] != const0_rtx)
8628 if (expand_block_clear (operands))
8634 ;; String/block move insn.
8635 ;; Argument 0 is the destination
8636 ;; Argument 1 is the source
8637 ;; Argument 2 is the length
8638 ;; Argument 3 is the alignment
8640 (define_expand "movmemsi"
8641 [(parallel [(set (match_operand:BLK 0 "" "")
8642 (match_operand:BLK 1 "" ""))
8643 (use (match_operand:SI 2 "" ""))
8644 (use (match_operand:SI 3 "" ""))])]
8648 if (expand_block_move (operands))
8654 ;; Move up to 32 bytes at a time. The fixed registers are needed because the
8655 ;; register allocator doesn't have a clue about allocating 8 word registers.
8656 ;; rD/rS = r5 is preferred, efficient form.
8657 (define_expand "movmemsi_8reg"
8658 [(parallel [(set (match_operand 0 "" "")
8659 (match_operand 1 "" ""))
8660 (use (match_operand 2 "" ""))
8661 (use (match_operand 3 "" ""))
8662 (clobber (reg:SI 5))
8663 (clobber (reg:SI 6))
8664 (clobber (reg:SI 7))
8665 (clobber (reg:SI 8))
8666 (clobber (reg:SI 9))
8667 (clobber (reg:SI 10))
8668 (clobber (reg:SI 11))
8669 (clobber (reg:SI 12))
8670 (clobber (match_scratch:SI 4 ""))])]
8675 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
8676 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
8677 (use (match_operand:SI 2 "immediate_operand" "i"))
8678 (use (match_operand:SI 3 "immediate_operand" "i"))
8679 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
8680 (clobber (reg:SI 6))
8681 (clobber (reg:SI 7))
8682 (clobber (reg:SI 8))
8683 (clobber (reg:SI 9))
8684 (clobber (reg:SI 10))
8685 (clobber (reg:SI 11))
8686 (clobber (reg:SI 12))
8687 (clobber (match_scratch:SI 5 "=q"))]
8688 "TARGET_STRING && TARGET_POWER
8689 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
8690 || INTVAL (operands[2]) == 0)
8691 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
8692 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
8693 && REGNO (operands[4]) == 5"
8694 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
8695 [(set_attr "type" "load")
8696 (set_attr "length" "8")])
8699 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
8700 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
8701 (use (match_operand:SI 2 "immediate_operand" "i"))
8702 (use (match_operand:SI 3 "immediate_operand" "i"))
8703 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
8704 (clobber (reg:SI 6))
8705 (clobber (reg:SI 7))
8706 (clobber (reg:SI 8))
8707 (clobber (reg:SI 9))
8708 (clobber (reg:SI 10))
8709 (clobber (reg:SI 11))
8710 (clobber (reg:SI 12))
8711 (clobber (match_scratch:SI 5 "X"))]
8712 "TARGET_STRING && ! TARGET_POWER
8713 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
8714 || INTVAL (operands[2]) == 0)
8715 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
8716 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
8717 && REGNO (operands[4]) == 5"
8718 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
8719 [(set_attr "type" "load")
8720 (set_attr "length" "8")])
8722 ;; Move up to 24 bytes at a time. The fixed registers are needed because the
8723 ;; register allocator doesn't have a clue about allocating 6 word registers.
8724 ;; rD/rS = r5 is preferred, efficient form.
8725 (define_expand "movmemsi_6reg"
8726 [(parallel [(set (match_operand 0 "" "")
8727 (match_operand 1 "" ""))
8728 (use (match_operand 2 "" ""))
8729 (use (match_operand 3 "" ""))
8730 (clobber (reg:SI 5))
8731 (clobber (reg:SI 6))
8732 (clobber (reg:SI 7))
8733 (clobber (reg:SI 8))
8734 (clobber (reg:SI 9))
8735 (clobber (reg:SI 10))
8736 (clobber (match_scratch:SI 4 ""))])]
8741 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
8742 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
8743 (use (match_operand:SI 2 "immediate_operand" "i"))
8744 (use (match_operand:SI 3 "immediate_operand" "i"))
8745 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
8746 (clobber (reg:SI 6))
8747 (clobber (reg:SI 7))
8748 (clobber (reg:SI 8))
8749 (clobber (reg:SI 9))
8750 (clobber (reg:SI 10))
8751 (clobber (match_scratch:SI 5 "=q"))]
8752 "TARGET_STRING && TARGET_POWER
8753 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 24
8754 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
8755 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
8756 && REGNO (operands[4]) == 5"
8757 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
8758 [(set_attr "type" "load")
8759 (set_attr "length" "8")])
8762 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
8763 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
8764 (use (match_operand:SI 2 "immediate_operand" "i"))
8765 (use (match_operand:SI 3 "immediate_operand" "i"))
8766 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
8767 (clobber (reg:SI 6))
8768 (clobber (reg:SI 7))
8769 (clobber (reg:SI 8))
8770 (clobber (reg:SI 9))
8771 (clobber (reg:SI 10))
8772 (clobber (match_scratch:SI 5 "X"))]
8773 "TARGET_STRING && ! TARGET_POWER
8774 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
8775 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
8776 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
8777 && REGNO (operands[4]) == 5"
8778 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
8779 [(set_attr "type" "load")
8780 (set_attr "length" "8")])
8782 ;; Move up to 16 bytes at a time, using 4 fixed registers to avoid spill
8783 ;; problems with TImode.
8784 ;; rD/rS = r5 is preferred, efficient form.
8785 (define_expand "movmemsi_4reg"
8786 [(parallel [(set (match_operand 0 "" "")
8787 (match_operand 1 "" ""))
8788 (use (match_operand 2 "" ""))
8789 (use (match_operand 3 "" ""))
8790 (clobber (reg:SI 5))
8791 (clobber (reg:SI 6))
8792 (clobber (reg:SI 7))
8793 (clobber (reg:SI 8))
8794 (clobber (match_scratch:SI 4 ""))])]
8799 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
8800 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
8801 (use (match_operand:SI 2 "immediate_operand" "i"))
8802 (use (match_operand:SI 3 "immediate_operand" "i"))
8803 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
8804 (clobber (reg:SI 6))
8805 (clobber (reg:SI 7))
8806 (clobber (reg:SI 8))
8807 (clobber (match_scratch:SI 5 "=q"))]
8808 "TARGET_STRING && TARGET_POWER
8809 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
8810 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
8811 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
8812 && REGNO (operands[4]) == 5"
8813 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
8814 [(set_attr "type" "load")
8815 (set_attr "length" "8")])
8818 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
8819 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
8820 (use (match_operand:SI 2 "immediate_operand" "i"))
8821 (use (match_operand:SI 3 "immediate_operand" "i"))
8822 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
8823 (clobber (reg:SI 6))
8824 (clobber (reg:SI 7))
8825 (clobber (reg:SI 8))
8826 (clobber (match_scratch:SI 5 "X"))]
8827 "TARGET_STRING && ! TARGET_POWER
8828 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
8829 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
8830 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
8831 && REGNO (operands[4]) == 5"
8832 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
8833 [(set_attr "type" "load")
8834 (set_attr "length" "8")])
8836 ;; Move up to 8 bytes at a time.
8837 (define_expand "movmemsi_2reg"
8838 [(parallel [(set (match_operand 0 "" "")
8839 (match_operand 1 "" ""))
8840 (use (match_operand 2 "" ""))
8841 (use (match_operand 3 "" ""))
8842 (clobber (match_scratch:DI 4 ""))
8843 (clobber (match_scratch:SI 5 ""))])]
8844 "TARGET_STRING && ! TARGET_POWERPC64"
8848 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
8849 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
8850 (use (match_operand:SI 2 "immediate_operand" "i"))
8851 (use (match_operand:SI 3 "immediate_operand" "i"))
8852 (clobber (match_scratch:DI 4 "=&r"))
8853 (clobber (match_scratch:SI 5 "=q"))]
8854 "TARGET_STRING && TARGET_POWER && ! TARGET_POWERPC64
8855 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
8856 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
8857 [(set_attr "type" "load")
8858 (set_attr "length" "8")])
8861 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
8862 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
8863 (use (match_operand:SI 2 "immediate_operand" "i"))
8864 (use (match_operand:SI 3 "immediate_operand" "i"))
8865 (clobber (match_scratch:DI 4 "=&r"))
8866 (clobber (match_scratch:SI 5 "X"))]
8867 "TARGET_STRING && ! TARGET_POWER && ! TARGET_POWERPC64
8868 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
8869 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
8870 [(set_attr "type" "load")
8871 (set_attr "length" "8")])
8873 ;; Move up to 4 bytes at a time.
8874 (define_expand "movmemsi_1reg"
8875 [(parallel [(set (match_operand 0 "" "")
8876 (match_operand 1 "" ""))
8877 (use (match_operand 2 "" ""))
8878 (use (match_operand 3 "" ""))
8879 (clobber (match_scratch:SI 4 ""))
8880 (clobber (match_scratch:SI 5 ""))])]
8885 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
8886 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
8887 (use (match_operand:SI 2 "immediate_operand" "i"))
8888 (use (match_operand:SI 3 "immediate_operand" "i"))
8889 (clobber (match_scratch:SI 4 "=&r"))
8890 (clobber (match_scratch:SI 5 "=q"))]
8891 "TARGET_STRING && TARGET_POWER
8892 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
8893 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
8894 [(set_attr "type" "load")
8895 (set_attr "length" "8")])
8898 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
8899 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
8900 (use (match_operand:SI 2 "immediate_operand" "i"))
8901 (use (match_operand:SI 3 "immediate_operand" "i"))
8902 (clobber (match_scratch:SI 4 "=&r"))
8903 (clobber (match_scratch:SI 5 "X"))]
8904 "TARGET_STRING && ! TARGET_POWER
8905 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
8906 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
8907 [(set_attr "type" "load")
8908 (set_attr "length" "8")])
8910 ;; Define insns that do load or store with update. Some of these we can
8911 ;; get by using pre-decrement or pre-increment, but the hardware can also
8912 ;; do cases where the increment is not the size of the object.
8914 ;; In all these cases, we use operands 0 and 1 for the register being
8915 ;; incremented because those are the operands that local-alloc will
8916 ;; tie and these are the pair most likely to be tieable (and the ones
8917 ;; that will benefit the most).
8919 (define_insn "*movdi_update1"
8920 [(set (match_operand:DI 3 "gpc_reg_operand" "=r,r")
8921 (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
8922 (match_operand:DI 2 "reg_or_aligned_short_operand" "r,I"))))
8923 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
8924 (plus:DI (match_dup 1) (match_dup 2)))]
8925 "TARGET_POWERPC64 && TARGET_UPDATE"
8929 [(set_attr "type" "load_ux,load_u")])
8931 (define_insn "movdi_<mode>_update"
8932 [(set (mem:DI (plus:P (match_operand:P 1 "gpc_reg_operand" "0,0")
8933 (match_operand:P 2 "reg_or_aligned_short_operand" "r,I")))
8934 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
8935 (set (match_operand:P 0 "gpc_reg_operand" "=b,b")
8936 (plus:P (match_dup 1) (match_dup 2)))]
8937 "TARGET_POWERPC64 && TARGET_UPDATE"
8941 [(set_attr "type" "store_ux,store_u")])
8943 (define_insn "*movsi_update1"
8944 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
8945 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
8946 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
8947 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
8948 (plus:SI (match_dup 1) (match_dup 2)))]
8951 {lux|lwzux} %3,%0,%2
8952 {lu|lwzu} %3,%2(%0)"
8953 [(set_attr "type" "load_ux,load_u")])
8955 (define_insn "*movsi_update2"
8956 [(set (match_operand:DI 3 "gpc_reg_operand" "=r")
8958 (mem:SI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0")
8959 (match_operand:DI 2 "gpc_reg_operand" "r")))))
8960 (set (match_operand:DI 0 "gpc_reg_operand" "=b")
8961 (plus:DI (match_dup 1) (match_dup 2)))]
8964 [(set_attr "type" "load_ext_ux")])
8966 (define_insn "movsi_update"
8967 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
8968 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
8969 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
8970 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
8971 (plus:SI (match_dup 1) (match_dup 2)))]
8974 {stux|stwux} %3,%0,%2
8975 {stu|stwu} %3,%2(%0)"
8976 [(set_attr "type" "store_ux,store_u")])
8978 (define_insn "*movhi_update1"
8979 [(set (match_operand:HI 3 "gpc_reg_operand" "=r,r")
8980 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
8981 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
8982 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
8983 (plus:SI (match_dup 1) (match_dup 2)))]
8988 [(set_attr "type" "load_ux,load_u")])
8990 (define_insn "*movhi_update2"
8991 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
8993 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
8994 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
8995 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
8996 (plus:SI (match_dup 1) (match_dup 2)))]
9001 [(set_attr "type" "load_ux,load_u")])
9003 (define_insn "*movhi_update3"
9004 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9006 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9007 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9008 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9009 (plus:SI (match_dup 1) (match_dup 2)))]
9014 [(set_attr "type" "load_ext_ux,load_ext_u")])
9016 (define_insn "*movhi_update4"
9017 [(set (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9018 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9019 (match_operand:HI 3 "gpc_reg_operand" "r,r"))
9020 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9021 (plus:SI (match_dup 1) (match_dup 2)))]
9026 [(set_attr "type" "store_ux,store_u")])
9028 (define_insn "*movqi_update1"
9029 [(set (match_operand:QI 3 "gpc_reg_operand" "=r,r")
9030 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9031 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9032 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9033 (plus:SI (match_dup 1) (match_dup 2)))]
9038 [(set_attr "type" "load_ux,load_u")])
9040 (define_insn "*movqi_update2"
9041 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9043 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9044 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9045 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9046 (plus:SI (match_dup 1) (match_dup 2)))]
9051 [(set_attr "type" "load_ux,load_u")])
9053 (define_insn "*movqi_update3"
9054 [(set (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9055 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9056 (match_operand:QI 3 "gpc_reg_operand" "r,r"))
9057 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9058 (plus:SI (match_dup 1) (match_dup 2)))]
9063 [(set_attr "type" "store_ux,store_u")])
9065 (define_insn "*movsf_update1"
9066 [(set (match_operand:SF 3 "gpc_reg_operand" "=f,f")
9067 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9068 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9069 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9070 (plus:SI (match_dup 1) (match_dup 2)))]
9071 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9075 [(set_attr "type" "fpload_ux,fpload_u")])
9077 (define_insn "*movsf_update2"
9078 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9079 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9080 (match_operand:SF 3 "gpc_reg_operand" "f,f"))
9081 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9082 (plus:SI (match_dup 1) (match_dup 2)))]
9083 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9087 [(set_attr "type" "fpstore_ux,fpstore_u")])
9089 (define_insn "*movsf_update3"
9090 [(set (match_operand:SF 3 "gpc_reg_operand" "=r,r")
9091 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9092 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9093 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9094 (plus:SI (match_dup 1) (match_dup 2)))]
9095 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE"
9097 {lux|lwzux} %3,%0,%2
9098 {lu|lwzu} %3,%2(%0)"
9099 [(set_attr "type" "load_ux,load_u")])
9101 (define_insn "*movsf_update4"
9102 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9103 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9104 (match_operand:SF 3 "gpc_reg_operand" "r,r"))
9105 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9106 (plus:SI (match_dup 1) (match_dup 2)))]
9107 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE"
9109 {stux|stwux} %3,%0,%2
9110 {stu|stwu} %3,%2(%0)"
9111 [(set_attr "type" "store_ux,store_u")])
9113 (define_insn "*movdf_update1"
9114 [(set (match_operand:DF 3 "gpc_reg_operand" "=f,f")
9115 (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9116 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9117 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9118 (plus:SI (match_dup 1) (match_dup 2)))]
9119 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9123 [(set_attr "type" "fpload_ux,fpload_u")])
9125 (define_insn "*movdf_update2"
9126 [(set (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9127 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9128 (match_operand:DF 3 "gpc_reg_operand" "f,f"))
9129 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9130 (plus:SI (match_dup 1) (match_dup 2)))]
9131 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9135 [(set_attr "type" "fpstore_ux,fpstore_u")])
9137 ;; Peephole to convert two consecutive FP loads or stores into lfq/stfq.
9139 (define_insn "*lfq_power2"
9140 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
9141 (match_operand:TF 1 "memory_operand" ""))]
9143 && TARGET_HARD_FLOAT && TARGET_FPRS"
9147 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9148 (match_operand:DF 1 "memory_operand" ""))
9149 (set (match_operand:DF 2 "gpc_reg_operand" "")
9150 (match_operand:DF 3 "memory_operand" ""))]
9152 && TARGET_HARD_FLOAT && TARGET_FPRS
9153 && registers_ok_for_quad_peep (operands[0], operands[2])
9154 && mems_ok_for_quad_peep (operands[1], operands[3])"
9157 "operands[1] = widen_memory_access (operands[1], TFmode, 0);
9158 operands[0] = gen_rtx_REG (TFmode, REGNO (operands[0]));")
9160 (define_insn "*stfq_power2"
9161 [(set (match_operand:TF 0 "memory_operand" "")
9162 (match_operand:TF 1 "gpc_reg_operand" "f"))]
9164 && TARGET_HARD_FLOAT && TARGET_FPRS"
9169 [(set (match_operand:DF 0 "memory_operand" "")
9170 (match_operand:DF 1 "gpc_reg_operand" ""))
9171 (set (match_operand:DF 2 "memory_operand" "")
9172 (match_operand:DF 3 "gpc_reg_operand" ""))]
9174 && TARGET_HARD_FLOAT && TARGET_FPRS
9175 && registers_ok_for_quad_peep (operands[1], operands[3])
9176 && mems_ok_for_quad_peep (operands[0], operands[2])"
9179 "operands[0] = widen_memory_access (operands[0], TFmode, 0);
9180 operands[1] = gen_rtx_REG (TFmode, REGNO (operands[1]));")
9182 ;; after inserting conditional returns we can sometimes have
9183 ;; unnecessary register moves. Unfortunately we cannot have a
9184 ;; modeless peephole here, because some single SImode sets have early
9185 ;; clobber outputs. Although those sets expand to multi-ppc-insn
9186 ;; sequences, using get_attr_length here will smash the operands
9187 ;; array. Neither is there an early_cobbler_p predicate.
9189 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9190 (match_operand:DF 1 "any_operand" ""))
9191 (set (match_operand:DF 2 "gpc_reg_operand" "")
9193 "peep2_reg_dead_p (2, operands[0])"
9194 [(set (match_dup 2) (match_dup 1))])
9197 [(set (match_operand:SF 0 "gpc_reg_operand" "")
9198 (match_operand:SF 1 "any_operand" ""))
9199 (set (match_operand:SF 2 "gpc_reg_operand" "")
9201 "peep2_reg_dead_p (2, operands[0])"
9202 [(set (match_dup 2) (match_dup 1))])
9207 ;; "b" output constraint here and on tls_ld to support tls linker optimization.
9208 (define_insn "tls_gd_32"
9209 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
9210 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9211 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9213 "HAVE_AS_TLS && !TARGET_64BIT"
9214 "addi %0,%1,%2@got@tlsgd")
9216 (define_insn "tls_gd_64"
9217 [(set (match_operand:DI 0 "gpc_reg_operand" "=b")
9218 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9219 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9221 "HAVE_AS_TLS && TARGET_64BIT"
9222 "addi %0,%1,%2@got@tlsgd")
9224 (define_insn "tls_ld_32"
9225 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
9226 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")]
9228 "HAVE_AS_TLS && !TARGET_64BIT"
9229 "addi %0,%1,%&@got@tlsld")
9231 (define_insn "tls_ld_64"
9232 [(set (match_operand:DI 0 "gpc_reg_operand" "=b")
9233 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")]
9235 "HAVE_AS_TLS && TARGET_64BIT"
9236 "addi %0,%1,%&@got@tlsld")
9238 (define_insn "tls_dtprel_32"
9239 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9240 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9241 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9243 "HAVE_AS_TLS && !TARGET_64BIT"
9244 "addi %0,%1,%2@dtprel")
9246 (define_insn "tls_dtprel_64"
9247 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9248 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9249 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9251 "HAVE_AS_TLS && TARGET_64BIT"
9252 "addi %0,%1,%2@dtprel")
9254 (define_insn "tls_dtprel_ha_32"
9255 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9256 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9257 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9258 UNSPEC_TLSDTPRELHA))]
9259 "HAVE_AS_TLS && !TARGET_64BIT"
9260 "addis %0,%1,%2@dtprel@ha")
9262 (define_insn "tls_dtprel_ha_64"
9263 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9264 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9265 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9266 UNSPEC_TLSDTPRELHA))]
9267 "HAVE_AS_TLS && TARGET_64BIT"
9268 "addis %0,%1,%2@dtprel@ha")
9270 (define_insn "tls_dtprel_lo_32"
9271 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9272 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9273 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9274 UNSPEC_TLSDTPRELLO))]
9275 "HAVE_AS_TLS && !TARGET_64BIT"
9276 "addi %0,%1,%2@dtprel@l")
9278 (define_insn "tls_dtprel_lo_64"
9279 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9280 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9281 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9282 UNSPEC_TLSDTPRELLO))]
9283 "HAVE_AS_TLS && TARGET_64BIT"
9284 "addi %0,%1,%2@dtprel@l")
9286 (define_insn "tls_got_dtprel_32"
9287 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9288 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9289 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9290 UNSPEC_TLSGOTDTPREL))]
9291 "HAVE_AS_TLS && !TARGET_64BIT"
9292 "lwz %0,%2@got@dtprel(%1)")
9294 (define_insn "tls_got_dtprel_64"
9295 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9296 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9297 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9298 UNSPEC_TLSGOTDTPREL))]
9299 "HAVE_AS_TLS && TARGET_64BIT"
9300 "ld %0,%2@got@dtprel(%1)")
9302 (define_insn "tls_tprel_32"
9303 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9304 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9305 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9307 "HAVE_AS_TLS && !TARGET_64BIT"
9308 "addi %0,%1,%2@tprel")
9310 (define_insn "tls_tprel_64"
9311 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9312 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9313 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9315 "HAVE_AS_TLS && TARGET_64BIT"
9316 "addi %0,%1,%2@tprel")
9318 (define_insn "tls_tprel_ha_32"
9319 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9320 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9321 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9322 UNSPEC_TLSTPRELHA))]
9323 "HAVE_AS_TLS && !TARGET_64BIT"
9324 "addis %0,%1,%2@tprel@ha")
9326 (define_insn "tls_tprel_ha_64"
9327 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9328 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9329 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9330 UNSPEC_TLSTPRELHA))]
9331 "HAVE_AS_TLS && TARGET_64BIT"
9332 "addis %0,%1,%2@tprel@ha")
9334 (define_insn "tls_tprel_lo_32"
9335 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9336 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9337 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9338 UNSPEC_TLSTPRELLO))]
9339 "HAVE_AS_TLS && !TARGET_64BIT"
9340 "addi %0,%1,%2@tprel@l")
9342 (define_insn "tls_tprel_lo_64"
9343 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9344 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9345 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9346 UNSPEC_TLSTPRELLO))]
9347 "HAVE_AS_TLS && TARGET_64BIT"
9348 "addi %0,%1,%2@tprel@l")
9350 ;; "b" output constraint here and on tls_tls input to support linker tls
9351 ;; optimization. The linker may edit the instructions emitted by a
9352 ;; tls_got_tprel/tls_tls pair to addis,addi.
9353 (define_insn "tls_got_tprel_32"
9354 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
9355 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9356 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9357 UNSPEC_TLSGOTTPREL))]
9358 "HAVE_AS_TLS && !TARGET_64BIT"
9359 "lwz %0,%2@got@tprel(%1)")
9361 (define_insn "tls_got_tprel_64"
9362 [(set (match_operand:DI 0 "gpc_reg_operand" "=b")
9363 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9364 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9365 UNSPEC_TLSGOTTPREL))]
9366 "HAVE_AS_TLS && TARGET_64BIT"
9367 "ld %0,%2@got@tprel(%1)")
9369 (define_insn "tls_tls_32"
9370 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9371 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9372 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9374 "HAVE_AS_TLS && !TARGET_64BIT"
9377 (define_insn "tls_tls_64"
9378 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9379 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9380 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9382 "HAVE_AS_TLS && TARGET_64BIT"
9385 ;; Next come insns related to the calling sequence.
9387 ;; First, an insn to allocate new stack space for dynamic use (e.g., alloca).
9388 ;; We move the back-chain and decrement the stack pointer.
9390 (define_expand "allocate_stack"
9391 [(set (match_operand 0 "gpc_reg_operand" "=r")
9392 (minus (reg 1) (match_operand 1 "reg_or_short_operand" "")))
9394 (minus (reg 1) (match_dup 1)))]
9397 { rtx chain = gen_reg_rtx (Pmode);
9398 rtx stack_bot = gen_rtx_MEM (Pmode, stack_pointer_rtx);
9401 emit_move_insn (chain, stack_bot);
9403 /* Check stack bounds if necessary. */
9404 if (current_function_limit_stack)
9407 available = expand_binop (Pmode, sub_optab,
9408 stack_pointer_rtx, stack_limit_rtx,
9409 NULL_RTX, 1, OPTAB_WIDEN);
9410 emit_insn (gen_cond_trap (LTU, available, operands[1], const0_rtx));
9413 if (GET_CODE (operands[1]) != CONST_INT
9414 || INTVAL (operands[1]) < -32767
9415 || INTVAL (operands[1]) > 32768)
9417 neg_op0 = gen_reg_rtx (Pmode);
9419 emit_insn (gen_negsi2 (neg_op0, operands[1]));
9421 emit_insn (gen_negdi2 (neg_op0, operands[1]));
9424 neg_op0 = GEN_INT (- INTVAL (operands[1]));
9427 emit_insn ((* ((TARGET_32BIT) ? gen_movsi_update : gen_movdi_di_update))
9428 (stack_pointer_rtx, stack_pointer_rtx, neg_op0, chain));
9432 emit_insn ((* ((TARGET_32BIT) ? gen_addsi3 : gen_adddi3))
9433 (stack_pointer_rtx, stack_pointer_rtx, neg_op0));
9434 emit_move_insn (gen_rtx_MEM (Pmode, stack_pointer_rtx), chain);
9437 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
9441 ;; These patterns say how to save and restore the stack pointer. We need not
9442 ;; save the stack pointer at function level since we are careful to
9443 ;; preserve the backchain. At block level, we have to restore the backchain
9444 ;; when we restore the stack pointer.
9446 ;; For nonlocal gotos, we must save both the stack pointer and its
9447 ;; backchain and restore both. Note that in the nonlocal case, the
9448 ;; save area is a memory location.
9450 (define_expand "save_stack_function"
9451 [(match_operand 0 "any_operand" "")
9452 (match_operand 1 "any_operand" "")]
9456 (define_expand "restore_stack_function"
9457 [(match_operand 0 "any_operand" "")
9458 (match_operand 1 "any_operand" "")]
9462 (define_expand "restore_stack_block"
9463 [(use (match_operand 0 "register_operand" ""))
9464 (set (match_dup 2) (match_dup 3))
9465 (set (match_dup 0) (match_operand 1 "register_operand" ""))
9466 (set (match_dup 3) (match_dup 2))]
9470 operands[2] = gen_reg_rtx (Pmode);
9471 operands[3] = gen_rtx_MEM (Pmode, operands[0]);
9474 (define_expand "save_stack_nonlocal"
9475 [(match_operand 0 "memory_operand" "")
9476 (match_operand 1 "register_operand" "")]
9480 rtx temp = gen_reg_rtx (Pmode);
9481 int units_per_word = (TARGET_32BIT) ? 4 : 8;
9483 /* Copy the backchain to the first word, sp to the second. */
9484 emit_move_insn (temp, gen_rtx_MEM (Pmode, operands[1]));
9485 emit_move_insn (adjust_address_nv (operands[0], Pmode, 0), temp);
9486 emit_move_insn (adjust_address_nv (operands[0], Pmode, units_per_word),
9491 (define_expand "restore_stack_nonlocal"
9492 [(match_operand 0 "register_operand" "")
9493 (match_operand 1 "memory_operand" "")]
9497 rtx temp = gen_reg_rtx (Pmode);
9498 int units_per_word = (TARGET_32BIT) ? 4 : 8;
9500 /* Restore the backchain from the first word, sp from the second. */
9501 emit_move_insn (temp,
9502 adjust_address_nv (operands[1], Pmode, 0));
9503 emit_move_insn (operands[0],
9504 adjust_address_nv (operands[1], Pmode, units_per_word));
9505 emit_move_insn (gen_rtx_MEM (Pmode, operands[0]), temp);
9509 ;; TOC register handling.
9511 ;; Code to initialize the TOC register...
9513 (define_insn "load_toc_aix_si"
9514 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9515 (unspec:SI [(const_int 0)] UNSPEC_TOC))
9517 "DEFAULT_ABI == ABI_AIX && TARGET_32BIT"
9521 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
9522 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
9523 operands[2] = gen_rtx_REG (Pmode, 2);
9524 return \"{l|lwz} %0,%1(%2)\";
9526 [(set_attr "type" "load")])
9528 (define_insn "load_toc_aix_di"
9529 [(parallel [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9530 (unspec:DI [(const_int 0)] UNSPEC_TOC))
9532 "DEFAULT_ABI == ABI_AIX && TARGET_64BIT"
9536 #ifdef TARGET_RELOCATABLE
9537 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\",
9538 !TARGET_MINIMAL_TOC || TARGET_RELOCATABLE);
9540 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
9543 strcat (buf, \"@toc\");
9544 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
9545 operands[2] = gen_rtx_REG (Pmode, 2);
9546 return \"ld %0,%1(%2)\";
9548 [(set_attr "type" "load")])
9550 (define_insn "load_toc_v4_pic_si"
9551 [(set (match_operand:SI 0 "register_operand" "=l")
9552 (unspec:SI [(const_int 0)] UNSPEC_TOC))]
9553 "DEFAULT_ABI == ABI_V4 && flag_pic == 1 && TARGET_32BIT"
9554 "bl _GLOBAL_OFFSET_TABLE_@local-4"
9555 [(set_attr "type" "branch")
9556 (set_attr "length" "4")])
9558 (define_insn "load_toc_v4_PIC_1"
9559 [(set (match_operand:SI 0 "register_operand" "=l")
9560 (match_operand:SI 1 "immediate_operand" "s"))
9561 (use (unspec [(match_dup 1)] UNSPEC_TOC))]
9562 "TARGET_ELF && DEFAULT_ABI != ABI_AIX
9563 && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
9564 "bcl 20,31,%1\\n%1:"
9565 [(set_attr "type" "branch")
9566 (set_attr "length" "4")])
9568 (define_insn "load_toc_v4_PIC_1b"
9569 [(set (match_operand:SI 0 "register_operand" "=l")
9570 (unspec:SI [(match_operand:SI 1 "immediate_operand" "s")]
9572 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
9573 "bcl 20,31,$+8\\n\\t.long %1-$"
9574 [(set_attr "type" "branch")
9575 (set_attr "length" "8")])
9577 (define_insn "load_toc_v4_PIC_2"
9578 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9579 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
9580 (minus:SI (match_operand:SI 2 "immediate_operand" "s")
9581 (match_operand:SI 3 "immediate_operand" "s")))))]
9582 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
9583 "{l|lwz} %0,%2-%3(%1)"
9584 [(set_attr "type" "load")])
9586 (define_insn "load_toc_v4_PIC_3b"
9587 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
9588 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "r")
9590 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
9591 (match_operand:SI 3 "symbol_ref_operand" "s")))))]
9592 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
9593 "{cau|addis} %0,%1,%2-%3@ha")
9595 (define_insn "load_toc_v4_PIC_3c"
9596 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9597 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
9598 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
9599 (match_operand:SI 3 "symbol_ref_operand" "s"))))]
9600 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
9601 "{cal|addi} %0,%1,%2-%3@l")
9603 ;; If the TOC is shared over a translation unit, as happens with all
9604 ;; the kinds of PIC that we support, we need to restore the TOC
9605 ;; pointer only when jumping over units of translation.
9606 ;; On Darwin, we need to reload the picbase.
9608 (define_expand "builtin_setjmp_receiver"
9609 [(use (label_ref (match_operand 0 "" "")))]
9610 "(DEFAULT_ABI == ABI_V4 && flag_pic == 1)
9611 || (TARGET_TOC && TARGET_MINIMAL_TOC)
9612 || (DEFAULT_ABI == ABI_DARWIN && flag_pic)"
9616 if (DEFAULT_ABI == ABI_DARWIN)
9618 const char *picbase = machopic_function_base_name ();
9619 rtx picrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (picbase));
9620 rtx picreg = gen_rtx_REG (Pmode, RS6000_PIC_OFFSET_TABLE_REGNUM);
9624 ASM_GENERATE_INTERNAL_LABEL(tmplab, \"LSJR\",
9625 CODE_LABEL_NUMBER (operands[0]));
9626 tmplabrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (tmplab));
9628 emit_insn (gen_load_macho_picbase (picreg, tmplabrtx));
9629 emit_insn (gen_macho_correct_pic (picreg, picreg, picrtx, tmplabrtx));
9633 rs6000_emit_load_toc_table (FALSE);
9637 ;; Elf specific ways of loading addresses for non-PIC code.
9638 ;; The output of this could be r0, but we make a very strong
9639 ;; preference for a base register because it will usually
9641 (define_insn "elf_high"
9642 [(set (match_operand:SI 0 "gpc_reg_operand" "=b*r")
9643 (high:SI (match_operand 1 "" "")))]
9644 "TARGET_ELF && ! TARGET_64BIT"
9645 "{liu|lis} %0,%1@ha")
9647 (define_insn "elf_low"
9648 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
9649 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,!*r")
9650 (match_operand 2 "" "")))]
9651 "TARGET_ELF && ! TARGET_64BIT"
9653 {cal|la} %0,%2@l(%1)
9654 {ai|addic} %0,%1,%K2")
9656 ;; A function pointer under AIX is a pointer to a data area whose first word
9657 ;; contains the actual address of the function, whose second word contains a
9658 ;; pointer to its TOC, and whose third word contains a value to place in the
9659 ;; static chain register (r11). Note that if we load the static chain, our
9660 ;; "trampoline" need not have any executable code.
9662 (define_expand "call_indirect_aix32"
9664 (mem:SI (match_operand:SI 0 "gpc_reg_operand" "")))
9665 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
9668 (mem:SI (plus:SI (match_dup 0)
9671 (mem:SI (plus:SI (match_dup 0)
9673 (parallel [(call (mem:SI (match_dup 2))
9674 (match_operand 1 "" ""))
9678 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
9679 (clobber (scratch:SI))])]
9682 { operands[2] = gen_reg_rtx (SImode); }")
9684 (define_expand "call_indirect_aix64"
9686 (mem:DI (match_operand:DI 0 "gpc_reg_operand" "")))
9687 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
9690 (mem:DI (plus:DI (match_dup 0)
9693 (mem:DI (plus:DI (match_dup 0)
9695 (parallel [(call (mem:SI (match_dup 2))
9696 (match_operand 1 "" ""))
9700 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
9701 (clobber (scratch:SI))])]
9704 { operands[2] = gen_reg_rtx (DImode); }")
9706 (define_expand "call_value_indirect_aix32"
9708 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "")))
9709 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
9712 (mem:SI (plus:SI (match_dup 1)
9715 (mem:SI (plus:SI (match_dup 1)
9717 (parallel [(set (match_operand 0 "" "")
9718 (call (mem:SI (match_dup 3))
9719 (match_operand 2 "" "")))
9723 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
9724 (clobber (scratch:SI))])]
9727 { operands[3] = gen_reg_rtx (SImode); }")
9729 (define_expand "call_value_indirect_aix64"
9731 (mem:DI (match_operand:DI 1 "gpc_reg_operand" "")))
9732 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
9735 (mem:DI (plus:DI (match_dup 1)
9738 (mem:DI (plus:DI (match_dup 1)
9740 (parallel [(set (match_operand 0 "" "")
9741 (call (mem:SI (match_dup 3))
9742 (match_operand 2 "" "")))
9746 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
9747 (clobber (scratch:SI))])]
9750 { operands[3] = gen_reg_rtx (DImode); }")
9752 ;; Now the definitions for the call and call_value insns
9753 (define_expand "call"
9754 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
9755 (match_operand 1 "" ""))
9756 (use (match_operand 2 "" ""))
9757 (clobber (scratch:SI))])]
9762 if (MACHOPIC_INDIRECT)
9763 operands[0] = machopic_indirect_call_target (operands[0]);
9766 gcc_assert (GET_CODE (operands[0]) == MEM);
9767 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
9769 operands[0] = XEXP (operands[0], 0);
9771 if (DEFAULT_ABI == ABI_V4 && TARGET_SECURE_PLT
9773 && GET_CODE (operands[0]) == SYMBOL_REF
9774 && !SYMBOL_REF_LOCAL_P (operands[0]))
9780 gen_rtx_CALL (VOIDmode,
9781 gen_rtx_MEM (SImode, operands[0]),
9783 gen_rtx_USE (VOIDmode, operands[2]),
9784 gen_rtx_CLOBBER (VOIDmode, gen_rtx_SCRATCH (SImode)));
9785 call = emit_call_insn (gen_rtx_PARALLEL (VOIDmode, tmp));
9786 use_reg (&CALL_INSN_FUNCTION_USAGE (call), pic_offset_table_rtx);
9790 if (GET_CODE (operands[0]) != SYMBOL_REF
9791 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[0]))
9792 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[2]) & CALL_LONG) != 0))
9794 if (INTVAL (operands[2]) & CALL_LONG)
9795 operands[0] = rs6000_longcall_ref (operands[0]);
9797 switch (DEFAULT_ABI)
9801 operands[0] = force_reg (Pmode, operands[0]);
9805 /* AIX function pointers are really pointers to a three word
9807 emit_call_insn (TARGET_32BIT
9808 ? gen_call_indirect_aix32 (force_reg (SImode,
9811 : gen_call_indirect_aix64 (force_reg (DImode,
9822 (define_expand "call_value"
9823 [(parallel [(set (match_operand 0 "" "")
9824 (call (mem:SI (match_operand 1 "address_operand" ""))
9825 (match_operand 2 "" "")))
9826 (use (match_operand 3 "" ""))
9827 (clobber (scratch:SI))])]
9832 if (MACHOPIC_INDIRECT)
9833 operands[1] = machopic_indirect_call_target (operands[1]);
9836 gcc_assert (GET_CODE (operands[1]) == MEM);
9837 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
9839 operands[1] = XEXP (operands[1], 0);
9841 if (DEFAULT_ABI == ABI_V4 && TARGET_SECURE_PLT
9843 && GET_CODE (operands[1]) == SYMBOL_REF
9844 && !SYMBOL_REF_LOCAL_P (operands[1]))
9850 gen_rtx_SET (VOIDmode,
9852 gen_rtx_CALL (VOIDmode,
9853 gen_rtx_MEM (SImode,
9856 gen_rtx_USE (VOIDmode, operands[3]),
9857 gen_rtx_CLOBBER (VOIDmode, gen_rtx_SCRATCH (SImode)));
9858 call = emit_call_insn (gen_rtx_PARALLEL (VOIDmode, tmp));
9859 use_reg (&CALL_INSN_FUNCTION_USAGE (call), pic_offset_table_rtx);
9863 if (GET_CODE (operands[1]) != SYMBOL_REF
9864 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[1]))
9865 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[3]) & CALL_LONG) != 0))
9867 if (INTVAL (operands[3]) & CALL_LONG)
9868 operands[1] = rs6000_longcall_ref (operands[1]);
9870 switch (DEFAULT_ABI)
9874 operands[1] = force_reg (Pmode, operands[1]);
9878 /* AIX function pointers are really pointers to a three word
9880 emit_call_insn (TARGET_32BIT
9881 ? gen_call_value_indirect_aix32 (operands[0],
9885 : gen_call_value_indirect_aix64 (operands[0],
9897 ;; Call to function in current module. No TOC pointer reload needed.
9898 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
9899 ;; either the function was not prototyped, or it was prototyped as a
9900 ;; variable argument function. It is > 0 if FP registers were passed
9901 ;; and < 0 if they were not.
9903 (define_insn "*call_local32"
9904 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
9905 (match_operand 1 "" "g,g"))
9906 (use (match_operand:SI 2 "immediate_operand" "O,n"))
9907 (clobber (match_scratch:SI 3 "=l,l"))]
9908 "(INTVAL (operands[2]) & CALL_LONG) == 0"
9911 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
9912 output_asm_insn (\"crxor 6,6,6\", operands);
9914 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
9915 output_asm_insn (\"creqv 6,6,6\", operands);
9917 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
9919 [(set_attr "type" "branch")
9920 (set_attr "length" "4,8")])
9922 (define_insn "*call_local64"
9923 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
9924 (match_operand 1 "" "g,g"))
9925 (use (match_operand:SI 2 "immediate_operand" "O,n"))
9926 (clobber (match_scratch:SI 3 "=l,l"))]
9927 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
9930 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
9931 output_asm_insn (\"crxor 6,6,6\", operands);
9933 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
9934 output_asm_insn (\"creqv 6,6,6\", operands);
9936 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
9938 [(set_attr "type" "branch")
9939 (set_attr "length" "4,8")])
9941 (define_insn "*call_value_local32"
9942 [(set (match_operand 0 "" "")
9943 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
9944 (match_operand 2 "" "g,g")))
9945 (use (match_operand:SI 3 "immediate_operand" "O,n"))
9946 (clobber (match_scratch:SI 4 "=l,l"))]
9947 "(INTVAL (operands[3]) & CALL_LONG) == 0"
9950 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
9951 output_asm_insn (\"crxor 6,6,6\", operands);
9953 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
9954 output_asm_insn (\"creqv 6,6,6\", operands);
9956 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
9958 [(set_attr "type" "branch")
9959 (set_attr "length" "4,8")])
9962 (define_insn "*call_value_local64"
9963 [(set (match_operand 0 "" "")
9964 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
9965 (match_operand 2 "" "g,g")))
9966 (use (match_operand:SI 3 "immediate_operand" "O,n"))
9967 (clobber (match_scratch:SI 4 "=l,l"))]
9968 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
9971 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
9972 output_asm_insn (\"crxor 6,6,6\", operands);
9974 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
9975 output_asm_insn (\"creqv 6,6,6\", operands);
9977 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
9979 [(set_attr "type" "branch")
9980 (set_attr "length" "4,8")])
9982 ;; Call to function which may be in another module. Restore the TOC
9983 ;; pointer (r2) after the call unless this is System V.
9984 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
9985 ;; either the function was not prototyped, or it was prototyped as a
9986 ;; variable argument function. It is > 0 if FP registers were passed
9987 ;; and < 0 if they were not.
9989 (define_insn "*call_indirect_nonlocal_aix32"
9990 [(call (mem:SI (match_operand:SI 0 "register_operand" "c,*l"))
9991 (match_operand 1 "" "g,g"))
9995 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
9996 (clobber (match_scratch:SI 2 "=l,l"))]
9997 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
9998 "b%T0l\;{l|lwz} 2,20(1)"
9999 [(set_attr "type" "jmpreg")
10000 (set_attr "length" "8")])
10002 (define_insn "*call_nonlocal_aix32"
10003 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
10004 (match_operand 1 "" "g"))
10005 (use (match_operand:SI 2 "immediate_operand" "O"))
10006 (clobber (match_scratch:SI 3 "=l"))]
10008 && DEFAULT_ABI == ABI_AIX
10009 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10011 [(set_attr "type" "branch")
10012 (set_attr "length" "8")])
10014 (define_insn "*call_indirect_nonlocal_aix64"
10015 [(call (mem:SI (match_operand:DI 0 "register_operand" "c,*l"))
10016 (match_operand 1 "" "g,g"))
10020 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10021 (clobber (match_scratch:SI 2 "=l,l"))]
10022 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
10023 "b%T0l\;ld 2,40(1)"
10024 [(set_attr "type" "jmpreg")
10025 (set_attr "length" "8")])
10027 (define_insn "*call_nonlocal_aix64"
10028 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
10029 (match_operand 1 "" "g"))
10030 (use (match_operand:SI 2 "immediate_operand" "O"))
10031 (clobber (match_scratch:SI 3 "=l"))]
10033 && DEFAULT_ABI == ABI_AIX
10034 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10036 [(set_attr "type" "branch")
10037 (set_attr "length" "8")])
10039 (define_insn "*call_value_indirect_nonlocal_aix32"
10040 [(set (match_operand 0 "" "")
10041 (call (mem:SI (match_operand:SI 1 "register_operand" "c,*l"))
10042 (match_operand 2 "" "g,g")))
10046 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10047 (clobber (match_scratch:SI 3 "=l,l"))]
10048 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
10049 "b%T1l\;{l|lwz} 2,20(1)"
10050 [(set_attr "type" "jmpreg")
10051 (set_attr "length" "8")])
10053 (define_insn "*call_value_nonlocal_aix32"
10054 [(set (match_operand 0 "" "")
10055 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
10056 (match_operand 2 "" "g")))
10057 (use (match_operand:SI 3 "immediate_operand" "O"))
10058 (clobber (match_scratch:SI 4 "=l"))]
10060 && DEFAULT_ABI == ABI_AIX
10061 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10063 [(set_attr "type" "branch")
10064 (set_attr "length" "8")])
10066 (define_insn "*call_value_indirect_nonlocal_aix64"
10067 [(set (match_operand 0 "" "")
10068 (call (mem:SI (match_operand:DI 1 "register_operand" "c,*l"))
10069 (match_operand 2 "" "g,g")))
10073 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10074 (clobber (match_scratch:SI 3 "=l,l"))]
10075 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
10076 "b%T1l\;ld 2,40(1)"
10077 [(set_attr "type" "jmpreg")
10078 (set_attr "length" "8")])
10080 (define_insn "*call_value_nonlocal_aix64"
10081 [(set (match_operand 0 "" "")
10082 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
10083 (match_operand 2 "" "g")))
10084 (use (match_operand:SI 3 "immediate_operand" "O"))
10085 (clobber (match_scratch:SI 4 "=l"))]
10087 && DEFAULT_ABI == ABI_AIX
10088 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10090 [(set_attr "type" "branch")
10091 (set_attr "length" "8")])
10093 ;; A function pointer under System V is just a normal pointer
10094 ;; operands[0] is the function pointer
10095 ;; operands[1] is the stack size to clean up
10096 ;; operands[2] is the value FUNCTION_ARG returns for the VOID argument
10097 ;; which indicates how to set cr1
10099 (define_insn "*call_indirect_nonlocal_sysv"
10100 [(call (mem:SI (match_operand:SI 0 "register_operand" "c,*l,c,*l"))
10101 (match_operand 1 "" "g,g,g,g"))
10102 (use (match_operand:SI 2 "immediate_operand" "O,O,n,n"))
10103 (clobber (match_scratch:SI 3 "=l,l,l,l"))]
10104 "DEFAULT_ABI == ABI_V4
10105 || DEFAULT_ABI == ABI_DARWIN"
10107 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10108 output_asm_insn ("crxor 6,6,6", operands);
10110 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10111 output_asm_insn ("creqv 6,6,6", operands);
10115 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
10116 (set_attr "length" "4,4,8,8")])
10118 (define_insn "*call_nonlocal_sysv"
10119 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s,s"))
10120 (match_operand 1 "" "g,g"))
10121 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10122 (clobber (match_scratch:SI 3 "=l,l"))]
10123 "(DEFAULT_ABI == ABI_DARWIN
10124 || (DEFAULT_ABI == ABI_V4
10125 && (INTVAL (operands[2]) & CALL_LONG) == 0))"
10127 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10128 output_asm_insn ("crxor 6,6,6", operands);
10130 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10131 output_asm_insn ("creqv 6,6,6", operands);
10134 return output_call(insn, operands, 0, 2);
10136 if (DEFAULT_ABI == ABI_V4 && flag_pic)
10138 if (TARGET_SECURE_PLT && flag_pic == 2)
10139 /* The magic 32768 offset here and in the other sysv call insns
10140 corresponds to the offset of r30 in .got2, as given by LCTOC1.
10141 See sysv4.h:toc_section. */
10142 return "bl %z0+32768@plt";
10144 return "bl %z0@plt";
10150 [(set_attr "type" "branch,branch")
10151 (set_attr "length" "4,8")])
10153 (define_insn "*call_value_indirect_nonlocal_sysv"
10154 [(set (match_operand 0 "" "")
10155 (call (mem:SI (match_operand:SI 1 "register_operand" "c,*l,c,*l"))
10156 (match_operand 2 "" "g,g,g,g")))
10157 (use (match_operand:SI 3 "immediate_operand" "O,O,n,n"))
10158 (clobber (match_scratch:SI 4 "=l,l,l,l"))]
10159 "DEFAULT_ABI == ABI_V4
10160 || DEFAULT_ABI == ABI_DARWIN"
10162 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10163 output_asm_insn ("crxor 6,6,6", operands);
10165 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10166 output_asm_insn ("creqv 6,6,6", operands);
10170 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
10171 (set_attr "length" "4,4,8,8")])
10173 (define_insn "*call_value_nonlocal_sysv"
10174 [(set (match_operand 0 "" "")
10175 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s,s"))
10176 (match_operand 2 "" "g,g")))
10177 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10178 (clobber (match_scratch:SI 4 "=l,l"))]
10179 "(DEFAULT_ABI == ABI_DARWIN
10180 || (DEFAULT_ABI == ABI_V4
10181 && (INTVAL (operands[3]) & CALL_LONG) == 0))"
10183 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10184 output_asm_insn ("crxor 6,6,6", operands);
10186 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10187 output_asm_insn ("creqv 6,6,6", operands);
10190 return output_call(insn, operands, 1, 3);
10192 if (DEFAULT_ABI == ABI_V4 && flag_pic)
10194 if (TARGET_SECURE_PLT && flag_pic == 2)
10195 return "bl %z1+32768@plt";
10197 return "bl %z1@plt";
10203 [(set_attr "type" "branch,branch")
10204 (set_attr "length" "4,8")])
10206 ;; Call subroutine returning any type.
10207 (define_expand "untyped_call"
10208 [(parallel [(call (match_operand 0 "" "")
10210 (match_operand 1 "" "")
10211 (match_operand 2 "" "")])]
10217 emit_call_insn (GEN_CALL (operands[0], const0_rtx, const0_rtx, const0_rtx));
10219 for (i = 0; i < XVECLEN (operands[2], 0); i++)
10221 rtx set = XVECEXP (operands[2], 0, i);
10222 emit_move_insn (SET_DEST (set), SET_SRC (set));
10225 /* The optimizer does not know that the call sets the function value
10226 registers we stored in the result block. We avoid problems by
10227 claiming that all hard registers are used and clobbered at this
10229 emit_insn (gen_blockage ());
10234 ;; sibling call patterns
10235 (define_expand "sibcall"
10236 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
10237 (match_operand 1 "" ""))
10238 (use (match_operand 2 "" ""))
10239 (use (match_operand 3 "" ""))
10245 if (MACHOPIC_INDIRECT)
10246 operands[0] = machopic_indirect_call_target (operands[0]);
10249 gcc_assert (GET_CODE (operands[0]) == MEM);
10250 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
10252 operands[0] = XEXP (operands[0], 0);
10253 operands[3] = gen_reg_rtx (SImode);
10257 ;; this and similar patterns must be marked as using LR, otherwise
10258 ;; dataflow will try to delete the store into it. This is true
10259 ;; even when the actual reg to jump to is in CTR, when LR was
10260 ;; saved and restored around the PIC-setting BCL.
10261 (define_insn "*sibcall_local32"
10262 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
10263 (match_operand 1 "" "g,g"))
10264 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10265 (use (match_operand:SI 3 "register_operand" "l,l"))
10267 "(INTVAL (operands[2]) & CALL_LONG) == 0"
10270 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10271 output_asm_insn (\"crxor 6,6,6\", operands);
10273 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10274 output_asm_insn (\"creqv 6,6,6\", operands);
10276 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
10278 [(set_attr "type" "branch")
10279 (set_attr "length" "4,8")])
10281 (define_insn "*sibcall_local64"
10282 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
10283 (match_operand 1 "" "g,g"))
10284 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10285 (use (match_operand:SI 3 "register_operand" "l,l"))
10287 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
10290 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10291 output_asm_insn (\"crxor 6,6,6\", operands);
10293 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10294 output_asm_insn (\"creqv 6,6,6\", operands);
10296 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
10298 [(set_attr "type" "branch")
10299 (set_attr "length" "4,8")])
10301 (define_insn "*sibcall_value_local32"
10302 [(set (match_operand 0 "" "")
10303 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
10304 (match_operand 2 "" "g,g")))
10305 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10306 (use (match_operand:SI 4 "register_operand" "l,l"))
10308 "(INTVAL (operands[3]) & CALL_LONG) == 0"
10311 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10312 output_asm_insn (\"crxor 6,6,6\", operands);
10314 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10315 output_asm_insn (\"creqv 6,6,6\", operands);
10317 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
10319 [(set_attr "type" "branch")
10320 (set_attr "length" "4,8")])
10323 (define_insn "*sibcall_value_local64"
10324 [(set (match_operand 0 "" "")
10325 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
10326 (match_operand 2 "" "g,g")))
10327 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10328 (use (match_operand:SI 4 "register_operand" "l,l"))
10330 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
10333 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10334 output_asm_insn (\"crxor 6,6,6\", operands);
10336 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10337 output_asm_insn (\"creqv 6,6,6\", operands);
10339 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
10341 [(set_attr "type" "branch")
10342 (set_attr "length" "4,8")])
10344 (define_insn "*sibcall_nonlocal_aix32"
10345 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
10346 (match_operand 1 "" "g"))
10347 (use (match_operand:SI 2 "immediate_operand" "O"))
10348 (use (match_operand:SI 3 "register_operand" "l"))
10351 && DEFAULT_ABI == ABI_AIX
10352 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10354 [(set_attr "type" "branch")
10355 (set_attr "length" "4")])
10357 (define_insn "*sibcall_nonlocal_aix64"
10358 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
10359 (match_operand 1 "" "g"))
10360 (use (match_operand:SI 2 "immediate_operand" "O"))
10361 (use (match_operand:SI 3 "register_operand" "l"))
10364 && DEFAULT_ABI == ABI_AIX
10365 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10367 [(set_attr "type" "branch")
10368 (set_attr "length" "4")])
10370 (define_insn "*sibcall_value_nonlocal_aix32"
10371 [(set (match_operand 0 "" "")
10372 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
10373 (match_operand 2 "" "g")))
10374 (use (match_operand:SI 3 "immediate_operand" "O"))
10375 (use (match_operand:SI 4 "register_operand" "l"))
10378 && DEFAULT_ABI == ABI_AIX
10379 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10381 [(set_attr "type" "branch")
10382 (set_attr "length" "4")])
10384 (define_insn "*sibcall_value_nonlocal_aix64"
10385 [(set (match_operand 0 "" "")
10386 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
10387 (match_operand 2 "" "g")))
10388 (use (match_operand:SI 3 "immediate_operand" "O"))
10389 (use (match_operand:SI 4 "register_operand" "l"))
10392 && DEFAULT_ABI == ABI_AIX
10393 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10395 [(set_attr "type" "branch")
10396 (set_attr "length" "4")])
10398 (define_insn "*sibcall_nonlocal_sysv"
10399 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s,s"))
10400 (match_operand 1 "" ""))
10401 (use (match_operand 2 "immediate_operand" "O,n"))
10402 (use (match_operand:SI 3 "register_operand" "l,l"))
10404 "(DEFAULT_ABI == ABI_DARWIN
10405 || DEFAULT_ABI == ABI_V4)
10406 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10409 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10410 output_asm_insn (\"crxor 6,6,6\", operands);
10412 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10413 output_asm_insn (\"creqv 6,6,6\", operands);
10415 if (DEFAULT_ABI == ABI_V4 && flag_pic)
10417 if (TARGET_SECURE_PLT && flag_pic == 2)
10418 return \"b %z0+32768@plt\";
10420 return \"b %z0@plt\";
10425 [(set_attr "type" "branch,branch")
10426 (set_attr "length" "4,8")])
10428 (define_expand "sibcall_value"
10429 [(parallel [(set (match_operand 0 "register_operand" "")
10430 (call (mem:SI (match_operand 1 "address_operand" ""))
10431 (match_operand 2 "" "")))
10432 (use (match_operand 3 "" ""))
10433 (use (match_operand 4 "" ""))
10439 if (MACHOPIC_INDIRECT)
10440 operands[1] = machopic_indirect_call_target (operands[1]);
10443 gcc_assert (GET_CODE (operands[1]) == MEM);
10444 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
10446 operands[1] = XEXP (operands[1], 0);
10447 operands[4] = gen_reg_rtx (SImode);
10451 (define_insn "*sibcall_value_nonlocal_sysv"
10452 [(set (match_operand 0 "" "")
10453 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s,s"))
10454 (match_operand 2 "" "")))
10455 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10456 (use (match_operand:SI 4 "register_operand" "l,l"))
10458 "(DEFAULT_ABI == ABI_DARWIN
10459 || DEFAULT_ABI == ABI_V4)
10460 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10463 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10464 output_asm_insn (\"crxor 6,6,6\", operands);
10466 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10467 output_asm_insn (\"creqv 6,6,6\", operands);
10469 if (DEFAULT_ABI == ABI_V4 && flag_pic)
10471 if (TARGET_SECURE_PLT && flag_pic == 2)
10472 return \"b %z1+32768@plt\";
10474 return \"b %z1@plt\";
10479 [(set_attr "type" "branch,branch")
10480 (set_attr "length" "4,8")])
10482 (define_expand "sibcall_epilogue"
10483 [(use (const_int 0))]
10484 "TARGET_SCHED_PROLOG"
10487 rs6000_emit_epilogue (TRUE);
10491 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
10492 ;; all of memory. This blocks insns from being moved across this point.
10494 (define_insn "blockage"
10495 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCK)]
10499 ;; Compare insns are next. Note that the RS/6000 has two types of compares,
10500 ;; signed & unsigned, and one type of branch.
10502 ;; Start with the DEFINE_EXPANDs to generate the rtl for compares, scc
10503 ;; insns, and branches. We store the operands of compares until we see
10505 (define_expand "cmp<mode>"
10507 (compare (match_operand:GPR 0 "gpc_reg_operand" "")
10508 (match_operand:GPR 1 "reg_or_short_operand" "")))]
10512 /* Take care of the possibility that operands[1] might be negative but
10513 this might be a logical operation. That insn doesn't exist. */
10514 if (GET_CODE (operands[1]) == CONST_INT
10515 && INTVAL (operands[1]) < 0)
10516 operands[1] = force_reg (<MODE>mode, operands[1]);
10518 rs6000_compare_op0 = operands[0];
10519 rs6000_compare_op1 = operands[1];
10520 rs6000_compare_fp_p = 0;
10524 (define_expand "cmp<mode>"
10525 [(set (cc0) (compare (match_operand:FP 0 "gpc_reg_operand" "")
10526 (match_operand:FP 1 "gpc_reg_operand" "")))]
10530 rs6000_compare_op0 = operands[0];
10531 rs6000_compare_op1 = operands[1];
10532 rs6000_compare_fp_p = 1;
10536 (define_expand "beq"
10537 [(use (match_operand 0 "" ""))]
10539 "{ rs6000_emit_cbranch (EQ, operands[0]); DONE; }")
10541 (define_expand "bne"
10542 [(use (match_operand 0 "" ""))]
10544 "{ rs6000_emit_cbranch (NE, operands[0]); DONE; }")
10546 (define_expand "bge"
10547 [(use (match_operand 0 "" ""))]
10549 "{ rs6000_emit_cbranch (GE, operands[0]); DONE; }")
10551 (define_expand "bgt"
10552 [(use (match_operand 0 "" ""))]
10554 "{ rs6000_emit_cbranch (GT, operands[0]); DONE; }")
10556 (define_expand "ble"
10557 [(use (match_operand 0 "" ""))]
10559 "{ rs6000_emit_cbranch (LE, operands[0]); DONE; }")
10561 (define_expand "blt"
10562 [(use (match_operand 0 "" ""))]
10564 "{ rs6000_emit_cbranch (LT, operands[0]); DONE; }")
10566 (define_expand "bgeu"
10567 [(use (match_operand 0 "" ""))]
10569 "{ rs6000_emit_cbranch (GEU, operands[0]); DONE; }")
10571 (define_expand "bgtu"
10572 [(use (match_operand 0 "" ""))]
10574 "{ rs6000_emit_cbranch (GTU, operands[0]); DONE; }")
10576 (define_expand "bleu"
10577 [(use (match_operand 0 "" ""))]
10579 "{ rs6000_emit_cbranch (LEU, operands[0]); DONE; }")
10581 (define_expand "bltu"
10582 [(use (match_operand 0 "" ""))]
10584 "{ rs6000_emit_cbranch (LTU, operands[0]); DONE; }")
10586 (define_expand "bunordered"
10587 [(use (match_operand 0 "" ""))]
10588 "! (TARGET_HARD_FLOAT && TARGET_E500 && !TARGET_FPRS)"
10589 "{ rs6000_emit_cbranch (UNORDERED, operands[0]); DONE; }")
10591 (define_expand "bordered"
10592 [(use (match_operand 0 "" ""))]
10593 "! (TARGET_HARD_FLOAT && TARGET_E500 && !TARGET_FPRS)"
10594 "{ rs6000_emit_cbranch (ORDERED, operands[0]); DONE; }")
10596 (define_expand "buneq"
10597 [(use (match_operand 0 "" ""))]
10599 "{ rs6000_emit_cbranch (UNEQ, operands[0]); DONE; }")
10601 (define_expand "bunge"
10602 [(use (match_operand 0 "" ""))]
10604 "{ rs6000_emit_cbranch (UNGE, operands[0]); DONE; }")
10606 (define_expand "bungt"
10607 [(use (match_operand 0 "" ""))]
10609 "{ rs6000_emit_cbranch (UNGT, operands[0]); DONE; }")
10611 (define_expand "bunle"
10612 [(use (match_operand 0 "" ""))]
10614 "{ rs6000_emit_cbranch (UNLE, operands[0]); DONE; }")
10616 (define_expand "bunlt"
10617 [(use (match_operand 0 "" ""))]
10619 "{ rs6000_emit_cbranch (UNLT, operands[0]); DONE; }")
10621 (define_expand "bltgt"
10622 [(use (match_operand 0 "" ""))]
10624 "{ rs6000_emit_cbranch (LTGT, operands[0]); DONE; }")
10626 ;; For SNE, we would prefer that the xor/abs sequence be used for integers.
10627 ;; For SEQ, likewise, except that comparisons with zero should be done
10628 ;; with an scc insns. However, due to the order that combine see the
10629 ;; resulting insns, we must, in fact, allow SEQ for integers. Fail in
10630 ;; the cases we don't want to handle.
10631 (define_expand "seq"
10632 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10634 "{ rs6000_emit_sCOND (EQ, operands[0]); DONE; }")
10636 (define_expand "sne"
10637 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10641 if (! rs6000_compare_fp_p)
10644 rs6000_emit_sCOND (NE, operands[0]);
10648 ;; A >= 0 is best done the portable way for A an integer.
10649 (define_expand "sge"
10650 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10654 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
10657 rs6000_emit_sCOND (GE, operands[0]);
10661 ;; A > 0 is best done using the portable sequence, so fail in that case.
10662 (define_expand "sgt"
10663 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10667 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
10670 rs6000_emit_sCOND (GT, operands[0]);
10674 ;; A <= 0 is best done the portable way for A an integer.
10675 (define_expand "sle"
10676 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10680 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
10683 rs6000_emit_sCOND (LE, operands[0]);
10687 ;; A < 0 is best done in the portable way for A an integer.
10688 (define_expand "slt"
10689 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10693 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
10696 rs6000_emit_sCOND (LT, operands[0]);
10700 (define_expand "sgeu"
10701 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10703 "{ rs6000_emit_sCOND (GEU, operands[0]); DONE; }")
10705 (define_expand "sgtu"
10706 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10708 "{ rs6000_emit_sCOND (GTU, operands[0]); DONE; }")
10710 (define_expand "sleu"
10711 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10713 "{ rs6000_emit_sCOND (LEU, operands[0]); DONE; }")
10715 (define_expand "sltu"
10716 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10718 "{ rs6000_emit_sCOND (LTU, operands[0]); DONE; }")
10720 (define_expand "sunordered"
10721 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10722 "! (TARGET_HARD_FLOAT && TARGET_E500 && !TARGET_FPRS)"
10723 "{ rs6000_emit_sCOND (UNORDERED, operands[0]); DONE; }")
10725 (define_expand "sordered"
10726 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10727 "! (TARGET_HARD_FLOAT && TARGET_E500 && !TARGET_FPRS)"
10728 "{ rs6000_emit_sCOND (ORDERED, operands[0]); DONE; }")
10730 (define_expand "suneq"
10731 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10733 "{ rs6000_emit_sCOND (UNEQ, operands[0]); DONE; }")
10735 (define_expand "sunge"
10736 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10738 "{ rs6000_emit_sCOND (UNGE, operands[0]); DONE; }")
10740 (define_expand "sungt"
10741 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10743 "{ rs6000_emit_sCOND (UNGT, operands[0]); DONE; }")
10745 (define_expand "sunle"
10746 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10748 "{ rs6000_emit_sCOND (UNLE, operands[0]); DONE; }")
10750 (define_expand "sunlt"
10751 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10753 "{ rs6000_emit_sCOND (UNLT, operands[0]); DONE; }")
10755 (define_expand "sltgt"
10756 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10758 "{ rs6000_emit_sCOND (LTGT, operands[0]); DONE; }")
10761 ;; Here are the actual compare insns.
10762 (define_insn "*cmp<mode>_internal1"
10763 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
10764 (compare:CC (match_operand:GPR 1 "gpc_reg_operand" "r")
10765 (match_operand:GPR 2 "reg_or_short_operand" "rI")))]
10767 "{cmp%I2|cmp<wd>%I2} %0,%1,%2"
10768 [(set_attr "type" "cmp")])
10770 ;; If we are comparing a register for equality with a large constant,
10771 ;; we can do this with an XOR followed by a compare. But we need a scratch
10772 ;; register for the result of the XOR.
10775 [(set (match_operand:CC 0 "cc_reg_operand" "")
10776 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
10777 (match_operand:SI 2 "non_short_cint_operand" "")))
10778 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
10779 "find_single_use (operands[0], insn, 0)
10780 && (GET_CODE (*find_single_use (operands[0], insn, 0)) == EQ
10781 || GET_CODE (*find_single_use (operands[0], insn, 0)) == NE)"
10782 [(set (match_dup 3) (xor:SI (match_dup 1) (match_dup 4)))
10783 (set (match_dup 0) (compare:CC (match_dup 3) (match_dup 5)))]
10786 /* Get the constant we are comparing against, C, and see what it looks like
10787 sign-extended to 16 bits. Then see what constant could be XOR'ed
10788 with C to get the sign-extended value. */
10790 HOST_WIDE_INT c = INTVAL (operands[2]);
10791 HOST_WIDE_INT sextc = ((c & 0xffff) ^ 0x8000) - 0x8000;
10792 HOST_WIDE_INT xorv = c ^ sextc;
10794 operands[4] = GEN_INT (xorv);
10795 operands[5] = GEN_INT (sextc);
10798 (define_insn "*cmpsi_internal2"
10799 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
10800 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
10801 (match_operand:SI 2 "reg_or_u_short_operand" "rK")))]
10803 "{cmpl%I2|cmplw%I2} %0,%1,%b2"
10804 [(set_attr "type" "cmp")])
10806 (define_insn "*cmpdi_internal2"
10807 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
10808 (compare:CCUNS (match_operand:DI 1 "gpc_reg_operand" "r")
10809 (match_operand:DI 2 "reg_or_u_short_operand" "rK")))]
10811 "cmpld%I2 %0,%1,%b2"
10812 [(set_attr "type" "cmp")])
10814 ;; The following two insns don't exist as single insns, but if we provide
10815 ;; them, we can swap an add and compare, which will enable us to overlap more
10816 ;; of the required delay between a compare and branch. We generate code for
10817 ;; them by splitting.
10820 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
10821 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
10822 (match_operand:SI 2 "short_cint_operand" "i")))
10823 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
10824 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
10827 [(set_attr "length" "8")])
10830 [(set (match_operand:CCUNS 3 "cc_reg_operand" "=y")
10831 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
10832 (match_operand:SI 2 "u_short_cint_operand" "i")))
10833 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
10834 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
10837 [(set_attr "length" "8")])
10840 [(set (match_operand:CC 3 "cc_reg_operand" "")
10841 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
10842 (match_operand:SI 2 "short_cint_operand" "")))
10843 (set (match_operand:SI 0 "gpc_reg_operand" "")
10844 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
10846 [(set (match_dup 3) (compare:CC (match_dup 1) (match_dup 2)))
10847 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
10850 [(set (match_operand:CCUNS 3 "cc_reg_operand" "")
10851 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "")
10852 (match_operand:SI 2 "u_short_cint_operand" "")))
10853 (set (match_operand:SI 0 "gpc_reg_operand" "")
10854 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
10856 [(set (match_dup 3) (compare:CCUNS (match_dup 1) (match_dup 2)))
10857 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
10859 (define_insn "*cmpsf_internal1"
10860 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
10861 (compare:CCFP (match_operand:SF 1 "gpc_reg_operand" "f")
10862 (match_operand:SF 2 "gpc_reg_operand" "f")))]
10863 "TARGET_HARD_FLOAT && TARGET_FPRS"
10865 [(set_attr "type" "fpcompare")])
10867 (define_insn "*cmpdf_internal1"
10868 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
10869 (compare:CCFP (match_operand:DF 1 "gpc_reg_operand" "f")
10870 (match_operand:DF 2 "gpc_reg_operand" "f")))]
10871 "TARGET_HARD_FLOAT && TARGET_FPRS"
10873 [(set_attr "type" "fpcompare")])
10875 ;; Only need to compare second words if first words equal
10876 (define_insn "*cmptf_internal1"
10877 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
10878 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "f")
10879 (match_operand:TF 2 "gpc_reg_operand" "f")))]
10880 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN) && !TARGET_XL_COMPAT
10881 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
10882 "fcmpu %0,%1,%2\;bne %0,$+8\;fcmpu %0,%L1,%L2"
10883 [(set_attr "type" "fpcompare")
10884 (set_attr "length" "12")])
10886 (define_insn_and_split "*cmptf_internal2"
10887 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
10888 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "f")
10889 (match_operand:TF 2 "gpc_reg_operand" "f")))
10890 (clobber (match_scratch:DF 3 "=f"))
10891 (clobber (match_scratch:DF 4 "=f"))
10892 (clobber (match_scratch:DF 5 "=f"))
10893 (clobber (match_scratch:DF 6 "=f"))
10894 (clobber (match_scratch:DF 7 "=f"))
10895 (clobber (match_scratch:DF 8 "=f"))
10896 (clobber (match_scratch:DF 9 "=f"))
10897 (clobber (match_scratch:DF 10 "=f"))]
10898 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN) && TARGET_XL_COMPAT
10899 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
10901 "&& reload_completed"
10902 [(set (match_dup 3) (match_dup 13))
10903 (set (match_dup 4) (match_dup 14))
10904 (set (match_dup 9) (abs:DF (match_dup 5)))
10905 (set (match_dup 0) (compare:CCFP (match_dup 9) (match_dup 3)))
10906 (set (pc) (if_then_else (ne (match_dup 0) (const_int 0))
10907 (label_ref (match_dup 11))
10909 (set (match_dup 0) (compare:CCFP (match_dup 5) (match_dup 7)))
10910 (set (pc) (label_ref (match_dup 12)))
10912 (set (match_dup 10) (minus:DF (match_dup 5) (match_dup 7)))
10913 (set (match_dup 9) (minus:DF (match_dup 6) (match_dup 8)))
10914 (set (match_dup 9) (plus:DF (match_dup 10) (match_dup 9)))
10915 (set (match_dup 0) (compare:CCFP (match_dup 7) (match_dup 4)))
10918 REAL_VALUE_TYPE rv;
10919 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
10920 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
10922 operands[5] = simplify_gen_subreg (DFmode, operands[1], TFmode, hi_word);
10923 operands[6] = simplify_gen_subreg (DFmode, operands[1], TFmode, lo_word);
10924 operands[7] = simplify_gen_subreg (DFmode, operands[2], TFmode, hi_word);
10925 operands[8] = simplify_gen_subreg (DFmode, operands[2], TFmode, lo_word);
10926 operands[11] = gen_label_rtx ();
10927 operands[12] = gen_label_rtx ();
10929 operands[13] = force_const_mem (DFmode,
10930 CONST_DOUBLE_FROM_REAL_VALUE (rv, DFmode));
10931 operands[14] = force_const_mem (DFmode,
10932 CONST_DOUBLE_FROM_REAL_VALUE (dconst0,
10936 operands[13] = gen_const_mem (DFmode,
10937 create_TOC_reference (XEXP (operands[13], 0)));
10938 operands[14] = gen_const_mem (DFmode,
10939 create_TOC_reference (XEXP (operands[14], 0)));
10940 set_mem_alias_set (operands[13], get_TOC_alias_set ());
10941 set_mem_alias_set (operands[14], get_TOC_alias_set ());
10945 ;; Now we have the scc insns. We can do some combinations because of the
10946 ;; way the machine works.
10948 ;; Note that this is probably faster if we can put an insn between the
10949 ;; mfcr and rlinm, but this is tricky. Let's leave it for now. In most
10950 ;; cases the insns below which don't use an intermediate CR field will
10951 ;; be used instead.
10953 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10954 (match_operator:SI 1 "scc_comparison_operator"
10955 [(match_operand 2 "cc_reg_operand" "y")
10958 "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1"
10959 [(set (attr "type")
10960 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
10961 (const_string "mfcrf")
10963 (const_string "mfcr")))
10964 (set_attr "length" "8")])
10966 ;; Same as above, but get the GT bit.
10967 (define_insn "move_from_CR_gt_bit"
10968 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10969 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_GT))]
10971 "mfcr %0\;{rlinm|rlwinm} %0,%0,%D1,31,31"
10972 [(set_attr "type" "mfcr")
10973 (set_attr "length" "8")])
10975 ;; Same as above, but get the OV/ORDERED bit.
10976 (define_insn "move_from_CR_ov_bit"
10977 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10978 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_OV))]
10980 "mfcr %0\;{rlinm|rlwinm} %0,%0,%t1,1"
10981 [(set_attr "type" "mfcr")
10982 (set_attr "length" "8")])
10985 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10986 (match_operator:DI 1 "scc_comparison_operator"
10987 [(match_operand 2 "cc_reg_operand" "y")
10990 "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1"
10991 [(set (attr "type")
10992 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
10993 (const_string "mfcrf")
10995 (const_string "mfcr")))
10996 (set_attr "length" "8")])
10999 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11000 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
11001 [(match_operand 2 "cc_reg_operand" "y,y")
11004 (set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
11005 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
11008 mfcr %3%Q2\;{rlinm.|rlwinm.} %3,%3,%J1,1
11010 [(set_attr "type" "delayed_compare")
11011 (set_attr "length" "8,16")])
11014 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11015 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
11016 [(match_operand 2 "cc_reg_operand" "")
11019 (set (match_operand:SI 3 "gpc_reg_operand" "")
11020 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
11021 "TARGET_32BIT && reload_completed"
11022 [(set (match_dup 3)
11023 (match_op_dup 1 [(match_dup 2) (const_int 0)]))
11025 (compare:CC (match_dup 3)
11030 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11031 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
11032 [(match_operand 2 "cc_reg_operand" "y")
11034 (match_operand:SI 3 "const_int_operand" "n")))]
11038 int is_bit = ccr_bit (operands[1], 1);
11039 int put_bit = 31 - (INTVAL (operands[3]) & 31);
11042 if (is_bit >= put_bit)
11043 count = is_bit - put_bit;
11045 count = 32 - (put_bit - is_bit);
11047 operands[4] = GEN_INT (count);
11048 operands[5] = GEN_INT (put_bit);
11050 return \"mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%4,%5,%5\";
11052 [(set (attr "type")
11053 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
11054 (const_string "mfcrf")
11056 (const_string "mfcr")))
11057 (set_attr "length" "8")])
11060 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11062 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
11063 [(match_operand 2 "cc_reg_operand" "y,y")
11065 (match_operand:SI 3 "const_int_operand" "n,n"))
11067 (set (match_operand:SI 4 "gpc_reg_operand" "=r,r")
11068 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
11073 int is_bit = ccr_bit (operands[1], 1);
11074 int put_bit = 31 - (INTVAL (operands[3]) & 31);
11077 /* Force split for non-cc0 compare. */
11078 if (which_alternative == 1)
11081 if (is_bit >= put_bit)
11082 count = is_bit - put_bit;
11084 count = 32 - (put_bit - is_bit);
11086 operands[5] = GEN_INT (count);
11087 operands[6] = GEN_INT (put_bit);
11089 return \"mfcr %4%Q2\;{rlinm.|rlwinm.} %4,%4,%5,%6,%6\";
11091 [(set_attr "type" "delayed_compare")
11092 (set_attr "length" "8,16")])
11095 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11097 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
11098 [(match_operand 2 "cc_reg_operand" "")
11100 (match_operand:SI 3 "const_int_operand" ""))
11102 (set (match_operand:SI 4 "gpc_reg_operand" "")
11103 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
11106 [(set (match_dup 4)
11107 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
11110 (compare:CC (match_dup 4)
11114 ;; There is a 3 cycle delay between consecutive mfcr instructions
11115 ;; so it is useful to combine 2 scc instructions to use only one mfcr.
11118 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11119 (match_operator:SI 1 "scc_comparison_operator"
11120 [(match_operand 2 "cc_reg_operand" "y")
11122 (set (match_operand:SI 3 "gpc_reg_operand" "=r")
11123 (match_operator:SI 4 "scc_comparison_operator"
11124 [(match_operand 5 "cc_reg_operand" "y")
11126 "REGNO (operands[2]) != REGNO (operands[5])"
11127 "mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
11128 [(set_attr "type" "mfcr")
11129 (set_attr "length" "12")])
11132 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11133 (match_operator:DI 1 "scc_comparison_operator"
11134 [(match_operand 2 "cc_reg_operand" "y")
11136 (set (match_operand:DI 3 "gpc_reg_operand" "=r")
11137 (match_operator:DI 4 "scc_comparison_operator"
11138 [(match_operand 5 "cc_reg_operand" "y")
11140 "TARGET_POWERPC64 && REGNO (operands[2]) != REGNO (operands[5])"
11141 "mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
11142 [(set_attr "type" "mfcr")
11143 (set_attr "length" "12")])
11145 ;; There are some scc insns that can be done directly, without a compare.
11146 ;; These are faster because they don't involve the communications between
11147 ;; the FXU and branch units. In fact, we will be replacing all of the
11148 ;; integer scc insns here or in the portable methods in emit_store_flag.
11150 ;; Also support (neg (scc ..)) since that construct is used to replace
11151 ;; branches, (plus (scc ..) ..) since that construct is common and
11152 ;; takes no more insns than scc, and (and (neg (scc ..)) ..) in the
11153 ;; cases where it is no more expensive than (neg (scc ..)).
11155 ;; Have reload force a constant into a register for the simple insns that
11156 ;; otherwise won't accept constants. We do this because it is faster than
11157 ;; the cmp/mfcr sequence we would otherwise generate.
11159 (define_mode_attr scc_eq_op2 [(SI "rKLI")
11162 (define_insn_and_split "*eq<mode>"
11163 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
11164 (eq:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
11165 (match_operand:GPR 2 "scc_eq_operand" "<scc_eq_op2>")))
11166 (clobber (match_scratch:GPR 3 "=r"))
11167 (clobber (match_scratch:GPR 4 "=r"))]
11171 [(set (match_dup 3)
11172 (clz:GPR (match_dup 4)))
11174 (lshiftrt:GPR (match_dup 3) (match_dup 5)))]
11176 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
11178 if (logical_operand (operands[2], <MODE>mode))
11179 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
11180 gen_rtx_XOR (<MODE>mode,
11181 operands[1], operands[2])));
11183 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
11184 gen_rtx_PLUS (<MODE>mode, operands[1],
11185 negate_rtx (<MODE>mode,
11189 operands[4] = operands[1];
11191 operands[5] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
11194 (define_insn_and_split "*eq<mode>_compare"
11195 [(set (match_operand:CC 5 "cc_reg_operand" "=y")
11197 (eq:P (match_operand:P 1 "gpc_reg_operand" "=r")
11198 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))
11200 (set (match_operand:P 0 "gpc_reg_operand" "=r")
11201 (eq:P (match_dup 1) (match_dup 2)))
11202 (clobber (match_scratch:P 3 "=r"))
11203 (clobber (match_scratch:P 4 "=r"))]
11207 [(set (match_dup 3)
11208 (clz:P (match_dup 4)))
11209 (parallel [(set (match_dup 5)
11210 (compare:CC (lshiftrt:P (match_dup 3) (match_dup 6))
11213 (lshiftrt:P (match_dup 3) (match_dup 6)))])]
11215 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
11217 if (logical_operand (operands[2], <MODE>mode))
11218 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
11219 gen_rtx_XOR (<MODE>mode,
11220 operands[1], operands[2])));
11222 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
11223 gen_rtx_PLUS (<MODE>mode, operands[1],
11224 negate_rtx (<MODE>mode,
11228 operands[4] = operands[1];
11230 operands[6] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
11233 ;; We have insns of the form shown by the first define_insn below. If
11234 ;; there is something inside the comparison operation, we must split it.
11236 [(set (match_operand:SI 0 "gpc_reg_operand" "")
11237 (plus:SI (match_operator 1 "comparison_operator"
11238 [(match_operand:SI 2 "" "")
11239 (match_operand:SI 3
11240 "reg_or_cint_operand" "")])
11241 (match_operand:SI 4 "gpc_reg_operand" "")))
11242 (clobber (match_operand:SI 5 "register_operand" ""))]
11243 "! gpc_reg_operand (operands[2], SImode)"
11244 [(set (match_dup 5) (match_dup 2))
11245 (set (match_dup 2) (plus:SI (match_op_dup 1 [(match_dup 2) (match_dup 3)])
11249 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r")
11250 (plus:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
11251 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I"))
11252 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r")))]
11255 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
11256 {sfi|subfic} %0,%1,0\;{aze|addze} %0,%3
11257 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
11258 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
11259 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
11260 [(set_attr "type" "three,two,three,three,three")
11261 (set_attr "length" "12,8,12,12,12")])
11264 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
11267 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
11268 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
11269 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
11271 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r"))]
11274 xor %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11275 {sfi|subfic} %4,%1,0\;{aze.|addze.} %4,%3
11276 {xoril|xori} %4,%1,%b2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11277 {xoriu|xoris} %4,%1,%u2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11278 {sfi|subfic} %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11284 [(set_attr "type" "compare")
11285 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
11288 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11291 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
11292 (match_operand:SI 2 "scc_eq_operand" ""))
11293 (match_operand:SI 3 "gpc_reg_operand" ""))
11295 (clobber (match_scratch:SI 4 ""))]
11296 "TARGET_32BIT && reload_completed"
11297 [(set (match_dup 4)
11298 (plus:SI (eq:SI (match_dup 1)
11302 (compare:CC (match_dup 4)
11307 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
11310 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
11311 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
11312 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
11314 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r")
11315 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
11318 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11319 {sfi|subfic} %0,%1,0\;{aze.|addze.} %0,%3
11320 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11321 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11322 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11328 [(set_attr "type" "compare")
11329 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
11332 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11335 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
11336 (match_operand:SI 2 "scc_eq_operand" ""))
11337 (match_operand:SI 3 "gpc_reg_operand" ""))
11339 (set (match_operand:SI 0 "gpc_reg_operand" "")
11340 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
11341 "TARGET_32BIT && reload_completed"
11342 [(set (match_dup 0)
11343 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
11345 (compare:CC (match_dup 0)
11350 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
11351 (neg:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
11352 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I"))))]
11355 xor %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
11356 {ai|addic} %0,%1,-1\;{sfe|subfe} %0,%0,%0
11357 {xoril|xori} %0,%1,%b2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
11358 {xoriu|xoris} %0,%1,%u2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
11359 {sfi|subfic} %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
11360 [(set_attr "type" "three,two,three,three,three")
11361 (set_attr "length" "12,8,12,12,12")])
11363 ;; Simplify (ne X (const_int 0)) on the PowerPC. No need to on the Power,
11364 ;; since it nabs/sr is just as fast.
11365 (define_insn "*ne0"
11366 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
11367 (lshiftrt:SI (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
11369 (clobber (match_scratch:SI 2 "=&r"))]
11370 "! TARGET_POWER && TARGET_32BIT && !TARGET_ISEL"
11371 "{ai|addic} %2,%1,-1\;{sfe|subfe} %0,%2,%1"
11372 [(set_attr "type" "two")
11373 (set_attr "length" "8")])
11376 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11377 (lshiftrt:DI (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
11379 (clobber (match_scratch:DI 2 "=&r"))]
11381 "addic %2,%1,-1\;subfe %0,%2,%1"
11382 [(set_attr "type" "two")
11383 (set_attr "length" "8")])
11385 ;; This is what (plus (ne X (const_int 0)) Y) looks like.
11387 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11388 (plus:SI (lshiftrt:SI
11389 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
11391 (match_operand:SI 2 "gpc_reg_operand" "r")))
11392 (clobber (match_scratch:SI 3 "=&r"))]
11394 "{ai|addic} %3,%1,-1\;{aze|addze} %0,%2"
11395 [(set_attr "type" "two")
11396 (set_attr "length" "8")])
11399 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11400 (plus:DI (lshiftrt:DI
11401 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
11403 (match_operand:DI 2 "gpc_reg_operand" "r")))
11404 (clobber (match_scratch:DI 3 "=&r"))]
11406 "addic %3,%1,-1\;addze %0,%2"
11407 [(set_attr "type" "two")
11408 (set_attr "length" "8")])
11411 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11413 (plus:SI (lshiftrt:SI
11414 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
11416 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
11418 (clobber (match_scratch:SI 3 "=&r,&r"))
11419 (clobber (match_scratch:SI 4 "=X,&r"))]
11422 {ai|addic} %3,%1,-1\;{aze.|addze.} %3,%2
11424 [(set_attr "type" "compare")
11425 (set_attr "length" "8,12")])
11428 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11430 (plus:SI (lshiftrt:SI
11431 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
11433 (match_operand:SI 2 "gpc_reg_operand" ""))
11435 (clobber (match_scratch:SI 3 ""))
11436 (clobber (match_scratch:SI 4 ""))]
11437 "TARGET_32BIT && reload_completed"
11438 [(parallel [(set (match_dup 3)
11439 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1)))
11442 (clobber (match_dup 4))])
11444 (compare:CC (match_dup 3)
11449 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11451 (plus:DI (lshiftrt:DI
11452 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
11454 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
11456 (clobber (match_scratch:DI 3 "=&r,&r"))]
11459 addic %3,%1,-1\;addze. %3,%2
11461 [(set_attr "type" "compare")
11462 (set_attr "length" "8,12")])
11465 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11467 (plus:DI (lshiftrt:DI
11468 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
11470 (match_operand:DI 2 "gpc_reg_operand" ""))
11472 (clobber (match_scratch:DI 3 ""))]
11473 "TARGET_64BIT && reload_completed"
11474 [(set (match_dup 3)
11475 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1)))
11479 (compare:CC (match_dup 3)
11484 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
11486 (plus:SI (lshiftrt:SI
11487 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
11489 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
11491 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11492 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
11494 (clobber (match_scratch:SI 3 "=&r,&r"))]
11497 {ai|addic} %3,%1,-1\;{aze.|addze.} %0,%2
11499 [(set_attr "type" "compare")
11500 (set_attr "length" "8,12")])
11503 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11505 (plus:SI (lshiftrt:SI
11506 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
11508 (match_operand:SI 2 "gpc_reg_operand" ""))
11510 (set (match_operand:SI 0 "gpc_reg_operand" "")
11511 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
11513 (clobber (match_scratch:SI 3 ""))]
11514 "TARGET_32BIT && reload_completed"
11515 [(parallel [(set (match_dup 0)
11516 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
11518 (clobber (match_dup 3))])
11520 (compare:CC (match_dup 0)
11525 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
11527 (plus:DI (lshiftrt:DI
11528 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
11530 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
11532 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
11533 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
11535 (clobber (match_scratch:DI 3 "=&r,&r"))]
11538 addic %3,%1,-1\;addze. %0,%2
11540 [(set_attr "type" "compare")
11541 (set_attr "length" "8,12")])
11544 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11546 (plus:DI (lshiftrt:DI
11547 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
11549 (match_operand:DI 2 "gpc_reg_operand" ""))
11551 (set (match_operand:DI 0 "gpc_reg_operand" "")
11552 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
11554 (clobber (match_scratch:DI 3 ""))]
11555 "TARGET_64BIT && reload_completed"
11556 [(parallel [(set (match_dup 0)
11557 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
11559 (clobber (match_dup 3))])
11561 (compare:CC (match_dup 0)
11566 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11567 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11568 (match_operand:SI 2 "reg_or_short_operand" "r,O")))
11569 (clobber (match_scratch:SI 3 "=r,X"))]
11572 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3
11573 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri|srwi} %0,%0,31"
11574 [(set_attr "length" "12")])
11577 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
11579 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
11580 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
11582 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
11583 (le:SI (match_dup 1) (match_dup 2)))
11584 (clobber (match_scratch:SI 3 "=r,X,r,X"))]
11587 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
11588 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri.|srwi.} %0,%0,31
11591 [(set_attr "type" "compare,delayed_compare,compare,delayed_compare")
11592 (set_attr "length" "12,12,16,16")])
11595 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11597 (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
11598 (match_operand:SI 2 "reg_or_short_operand" ""))
11600 (set (match_operand:SI 0 "gpc_reg_operand" "")
11601 (le:SI (match_dup 1) (match_dup 2)))
11602 (clobber (match_scratch:SI 3 ""))]
11603 "TARGET_POWER && reload_completed"
11604 [(parallel [(set (match_dup 0)
11605 (le:SI (match_dup 1) (match_dup 2)))
11606 (clobber (match_dup 3))])
11608 (compare:CC (match_dup 0)
11613 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
11614 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11615 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
11616 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
11619 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
11620 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze|addze} %0,%3"
11621 [(set_attr "length" "12")])
11624 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
11626 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
11627 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
11628 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
11630 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
11633 doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11634 {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze.|addze.} %4,%3
11637 [(set_attr "type" "compare")
11638 (set_attr "length" "12,12,16,16")])
11641 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11643 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
11644 (match_operand:SI 2 "reg_or_short_operand" ""))
11645 (match_operand:SI 3 "gpc_reg_operand" ""))
11647 (clobber (match_scratch:SI 4 ""))]
11648 "TARGET_POWER && reload_completed"
11649 [(set (match_dup 4)
11650 (plus:SI (le:SI (match_dup 1) (match_dup 2))
11653 (compare:CC (match_dup 4)
11658 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
11660 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
11661 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
11662 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
11664 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
11665 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
11668 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11669 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze.|addze.} %0,%3
11672 [(set_attr "type" "compare")
11673 (set_attr "length" "12,12,16,16")])
11676 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11678 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
11679 (match_operand:SI 2 "reg_or_short_operand" ""))
11680 (match_operand:SI 3 "gpc_reg_operand" ""))
11682 (set (match_operand:SI 0 "gpc_reg_operand" "")
11683 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
11684 "TARGET_POWER && reload_completed"
11685 [(set (match_dup 0)
11686 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
11688 (compare:CC (match_dup 0)
11693 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11694 (neg:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11695 (match_operand:SI 2 "reg_or_short_operand" "r,O"))))]
11698 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
11699 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{srai|srawi} %0,%0,31"
11700 [(set_attr "length" "12")])
11703 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11704 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
11705 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
11707 "{sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
11708 [(set_attr "type" "three")
11709 (set_attr "length" "12")])
11712 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11713 (leu:DI (match_operand:DI 1 "gpc_reg_operand" "r")
11714 (match_operand:DI 2 "reg_or_short_operand" "rI")))]
11716 "subf%I2c %0,%1,%2\;li %0,0\;adde %0,%0,%0"
11717 [(set_attr "type" "three")
11718 (set_attr "length" "12")])
11721 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
11723 (leu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
11724 (match_operand:DI 2 "reg_or_short_operand" "rI,rI"))
11726 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
11727 (leu:DI (match_dup 1) (match_dup 2)))]
11730 subf%I2c %0,%1,%2\;li %0,0\;adde. %0,%0,%0
11732 [(set_attr "type" "compare")
11733 (set_attr "length" "12,16")])
11736 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
11738 (leu:DI (match_operand:DI 1 "gpc_reg_operand" "")
11739 (match_operand:DI 2 "reg_or_short_operand" ""))
11741 (set (match_operand:DI 0 "gpc_reg_operand" "")
11742 (leu:DI (match_dup 1) (match_dup 2)))]
11743 "TARGET_64BIT && reload_completed"
11744 [(set (match_dup 0)
11745 (leu:DI (match_dup 1) (match_dup 2)))
11747 (compare:CC (match_dup 0)
11752 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
11754 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11755 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
11757 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11758 (leu:SI (match_dup 1) (match_dup 2)))]
11761 {sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
11763 [(set_attr "type" "compare")
11764 (set_attr "length" "12,16")])
11767 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
11769 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
11770 (match_operand:SI 2 "reg_or_short_operand" ""))
11772 (set (match_operand:SI 0 "gpc_reg_operand" "")
11773 (leu:SI (match_dup 1) (match_dup 2)))]
11774 "TARGET_32BIT && reload_completed"
11775 [(set (match_dup 0)
11776 (leu:SI (match_dup 1) (match_dup 2)))
11778 (compare:CC (match_dup 0)
11783 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
11784 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
11785 (match_operand:SI 2 "reg_or_short_operand" "rI"))
11786 (match_operand:SI 3 "gpc_reg_operand" "r")))]
11788 "{sf%I2|subf%I2c} %0,%1,%2\;{aze|addze} %0,%3"
11789 [(set_attr "type" "two")
11790 (set_attr "length" "8")])
11793 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11795 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11796 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
11797 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
11799 (clobber (match_scratch:SI 4 "=&r,&r"))]
11802 {sf%I2|subf%I2c} %4,%1,%2\;{aze.|addze.} %4,%3
11804 [(set_attr "type" "compare")
11805 (set_attr "length" "8,12")])
11808 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11810 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
11811 (match_operand:SI 2 "reg_or_short_operand" ""))
11812 (match_operand:SI 3 "gpc_reg_operand" ""))
11814 (clobber (match_scratch:SI 4 ""))]
11815 "TARGET_32BIT && reload_completed"
11816 [(set (match_dup 4)
11817 (plus:SI (leu:SI (match_dup 1) (match_dup 2))
11820 (compare:CC (match_dup 4)
11825 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
11827 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11828 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
11829 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
11831 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
11832 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
11835 {sf%I2|subf%I2c} %0,%1,%2\;{aze.|addze.} %0,%3
11837 [(set_attr "type" "compare")
11838 (set_attr "length" "8,12")])
11841 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11843 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
11844 (match_operand:SI 2 "reg_or_short_operand" ""))
11845 (match_operand:SI 3 "gpc_reg_operand" ""))
11847 (set (match_operand:SI 0 "gpc_reg_operand" "")
11848 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
11849 "TARGET_32BIT && reload_completed"
11850 [(set (match_dup 0)
11851 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
11853 (compare:CC (match_dup 0)
11858 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11859 (neg:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
11860 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
11862 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0"
11863 [(set_attr "type" "three")
11864 (set_attr "length" "12")])
11867 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
11869 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
11870 (match_operand:SI 2 "reg_or_short_operand" "rI")))
11871 (match_operand:SI 3 "gpc_reg_operand" "r")))]
11873 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
11874 [(set_attr "type" "three")
11875 (set_attr "length" "12")])
11878 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11881 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11882 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
11883 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
11885 (clobber (match_scratch:SI 4 "=&r,&r"))]
11888 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
11890 [(set_attr "type" "compare")
11891 (set_attr "length" "12,16")])
11894 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11897 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
11898 (match_operand:SI 2 "reg_or_short_operand" "")))
11899 (match_operand:SI 3 "gpc_reg_operand" ""))
11901 (clobber (match_scratch:SI 4 ""))]
11902 "TARGET_32BIT && reload_completed"
11903 [(set (match_dup 4)
11904 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
11907 (compare:CC (match_dup 4)
11912 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
11915 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11916 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
11917 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
11919 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
11920 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
11923 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
11925 [(set_attr "type" "compare")
11926 (set_attr "length" "12,16")])
11929 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11932 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
11933 (match_operand:SI 2 "reg_or_short_operand" "")))
11934 (match_operand:SI 3 "gpc_reg_operand" ""))
11936 (set (match_operand:SI 0 "gpc_reg_operand" "")
11937 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
11938 "TARGET_32BIT && reload_completed"
11939 [(set (match_dup 0)
11940 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
11943 (compare:CC (match_dup 0)
11948 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11949 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
11950 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
11952 "doz%I2 %0,%1,%2\;nabs %0,%0\;{sri|srwi} %0,%0,31"
11953 [(set_attr "length" "12")])
11956 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
11958 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11959 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
11961 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11962 (lt:SI (match_dup 1) (match_dup 2)))]
11965 doz%I2 %0,%1,%2\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
11967 [(set_attr "type" "delayed_compare")
11968 (set_attr "length" "12,16")])
11971 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
11973 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
11974 (match_operand:SI 2 "reg_or_short_operand" ""))
11976 (set (match_operand:SI 0 "gpc_reg_operand" "")
11977 (lt:SI (match_dup 1) (match_dup 2)))]
11978 "TARGET_POWER && reload_completed"
11979 [(set (match_dup 0)
11980 (lt:SI (match_dup 1) (match_dup 2)))
11982 (compare:CC (match_dup 0)
11987 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
11988 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
11989 (match_operand:SI 2 "reg_or_short_operand" "rI"))
11990 (match_operand:SI 3 "gpc_reg_operand" "r")))]
11992 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
11993 [(set_attr "length" "12")])
11996 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11998 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11999 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12000 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12002 (clobber (match_scratch:SI 4 "=&r,&r"))]
12005 doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
12007 [(set_attr "type" "compare")
12008 (set_attr "length" "12,16")])
12011 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12013 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12014 (match_operand:SI 2 "reg_or_short_operand" ""))
12015 (match_operand:SI 3 "gpc_reg_operand" ""))
12017 (clobber (match_scratch:SI 4 ""))]
12018 "TARGET_POWER && reload_completed"
12019 [(set (match_dup 4)
12020 (plus:SI (lt:SI (match_dup 1) (match_dup 2))
12023 (compare:CC (match_dup 4)
12028 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12030 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12031 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12032 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12034 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12035 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12038 doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
12040 [(set_attr "type" "compare")
12041 (set_attr "length" "12,16")])
12044 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12046 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12047 (match_operand:SI 2 "reg_or_short_operand" ""))
12048 (match_operand:SI 3 "gpc_reg_operand" ""))
12050 (set (match_operand:SI 0 "gpc_reg_operand" "")
12051 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12052 "TARGET_POWER && reload_completed"
12053 [(set (match_dup 0)
12054 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12056 (compare:CC (match_dup 0)
12061 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12062 (neg:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12063 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
12065 "doz%I2 %0,%1,%2\;nabs %0,%0\;{srai|srawi} %0,%0,31"
12066 [(set_attr "length" "12")])
12068 (define_insn_and_split ""
12069 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12070 (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12071 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))]
12075 [(set (match_dup 0) (neg:SI (ltu:SI (match_dup 1) (match_dup 2))))
12076 (set (match_dup 0) (neg:SI (match_dup 0)))]
12079 (define_insn_and_split ""
12080 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
12081 (ltu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12082 (match_operand:DI 2 "reg_or_neg_short_operand" "r,P")))]
12086 [(set (match_dup 0) (neg:DI (ltu:DI (match_dup 1) (match_dup 2))))
12087 (set (match_dup 0) (neg:DI (match_dup 0)))]
12091 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
12093 (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12094 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12096 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
12097 (ltu:SI (match_dup 1) (match_dup 2)))]
12100 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;neg. %0,%0
12101 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;neg. %0,%0
12104 [(set_attr "type" "compare")
12105 (set_attr "length" "12,12,16,16")])
12108 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12110 (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12111 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12113 (set (match_operand:SI 0 "gpc_reg_operand" "")
12114 (ltu:SI (match_dup 1) (match_dup 2)))]
12115 "TARGET_32BIT && reload_completed"
12116 [(set (match_dup 0)
12117 (ltu:SI (match_dup 1) (match_dup 2)))
12119 (compare:CC (match_dup 0)
12123 (define_insn_and_split ""
12124 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
12125 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12126 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
12127 (match_operand:SI 3 "reg_or_short_operand" "rI,rI")))]
12130 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
12131 [(set (match_dup 0) (neg:SI (ltu:SI (match_dup 1) (match_dup 2))))
12132 (set (match_dup 0) (minus:SI (match_dup 3) (match_dup 0)))]
12135 (define_insn_and_split ""
12136 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
12137 (plus:DI (ltu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12138 (match_operand:DI 2 "reg_or_neg_short_operand" "r,P"))
12139 (match_operand:DI 3 "reg_or_short_operand" "rI,rI")))]
12142 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
12143 [(set (match_dup 0) (neg:DI (ltu:DI (match_dup 1) (match_dup 2))))
12144 (set (match_dup 0) (minus:DI (match_dup 3) (match_dup 0)))]
12148 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12150 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12151 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12152 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12154 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12157 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;{sf.|subf.} %4,%4,%3
12158 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;{sf.|subf.} %4,%4,%3
12161 [(set_attr "type" "compare")
12162 (set_attr "length" "12,12,16,16")])
12165 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12167 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12168 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12169 (match_operand:SI 3 "gpc_reg_operand" ""))
12171 (clobber (match_scratch:SI 4 ""))]
12172 "TARGET_32BIT && reload_completed"
12173 [(set (match_dup 4)
12174 (plus:SI (ltu:SI (match_dup 1) (match_dup 2))
12177 (compare:CC (match_dup 4)
12182 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12184 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12185 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12186 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12188 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12189 (plus:SI (ltu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12192 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;{sf.|subf.} %0,%0,%3
12193 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;{sf.|subf.} %0,%0,%3
12196 [(set_attr "type" "compare")
12197 (set_attr "length" "12,12,16,16")])
12200 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12202 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12203 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12204 (match_operand:SI 3 "gpc_reg_operand" ""))
12206 (set (match_operand:SI 0 "gpc_reg_operand" "")
12207 (plus:SI (ltu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12208 "TARGET_32BIT && reload_completed"
12209 [(set (match_dup 0)
12210 (plus:SI (ltu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12212 (compare:CC (match_dup 0)
12217 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12218 (neg:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12219 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))))]
12222 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0
12223 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0"
12224 [(set_attr "type" "two")
12225 (set_attr "length" "8")])
12228 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
12229 (neg:DI (ltu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12230 (match_operand:DI 2 "reg_or_neg_short_operand" "r,P"))))]
12233 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0
12234 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0"
12235 [(set_attr "type" "two")
12236 (set_attr "length" "8")])
12239 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12240 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12241 (match_operand:SI 2 "reg_or_short_operand" "rI")))
12242 (clobber (match_scratch:SI 3 "=r"))]
12244 "doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3"
12245 [(set_attr "length" "12")])
12248 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12250 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12251 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12253 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12254 (ge:SI (match_dup 1) (match_dup 2)))
12255 (clobber (match_scratch:SI 3 "=r,r"))]
12258 doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
12260 [(set_attr "type" "compare")
12261 (set_attr "length" "12,16")])
12264 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12266 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
12267 (match_operand:SI 2 "reg_or_short_operand" ""))
12269 (set (match_operand:SI 0 "gpc_reg_operand" "")
12270 (ge:SI (match_dup 1) (match_dup 2)))
12271 (clobber (match_scratch:SI 3 ""))]
12272 "TARGET_POWER && reload_completed"
12273 [(parallel [(set (match_dup 0)
12274 (ge:SI (match_dup 1) (match_dup 2)))
12275 (clobber (match_dup 3))])
12277 (compare:CC (match_dup 0)
12282 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12283 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12284 (match_operand:SI 2 "reg_or_short_operand" "rI"))
12285 (match_operand:SI 3 "gpc_reg_operand" "r")))]
12287 "doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
12288 [(set_attr "length" "12")])
12291 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12293 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12294 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12295 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12297 (clobber (match_scratch:SI 4 "=&r,&r"))]
12300 doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12302 [(set_attr "type" "compare")
12303 (set_attr "length" "12,16")])
12306 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12308 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
12309 (match_operand:SI 2 "reg_or_short_operand" ""))
12310 (match_operand:SI 3 "gpc_reg_operand" ""))
12312 (clobber (match_scratch:SI 4 ""))]
12313 "TARGET_POWER && reload_completed"
12314 [(set (match_dup 4)
12315 (plus:SI (ge:SI (match_dup 1) (match_dup 2))
12318 (compare:CC (match_dup 4)
12323 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12325 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12326 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12327 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12329 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12330 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12333 doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12335 [(set_attr "type" "compare")
12336 (set_attr "length" "12,16")])
12339 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12341 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
12342 (match_operand:SI 2 "reg_or_short_operand" ""))
12343 (match_operand:SI 3 "gpc_reg_operand" ""))
12345 (set (match_operand:SI 0 "gpc_reg_operand" "")
12346 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12347 "TARGET_POWER && reload_completed"
12348 [(set (match_dup 0)
12349 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12351 (compare:CC (match_dup 0)
12356 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12357 (neg:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12358 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
12360 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
12361 [(set_attr "length" "12")])
12364 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12365 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12366 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))]
12369 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0
12370 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
12371 [(set_attr "type" "three")
12372 (set_attr "length" "12")])
12375 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
12376 (geu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12377 (match_operand:DI 2 "reg_or_neg_short_operand" "r,P")))]
12380 subfc %0,%2,%1\;li %0,0\;adde %0,%0,%0
12381 addic %0,%1,%n2\;li %0,0\;adde %0,%0,%0"
12382 [(set_attr "type" "three")
12383 (set_attr "length" "12")])
12386 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
12388 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12389 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12391 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
12392 (geu:SI (match_dup 1) (match_dup 2)))]
12395 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
12396 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
12399 [(set_attr "type" "compare")
12400 (set_attr "length" "12,12,16,16")])
12403 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12405 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12406 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12408 (set (match_operand:SI 0 "gpc_reg_operand" "")
12409 (geu:SI (match_dup 1) (match_dup 2)))]
12410 "TARGET_32BIT && reload_completed"
12411 [(set (match_dup 0)
12412 (geu:SI (match_dup 1) (match_dup 2)))
12414 (compare:CC (match_dup 0)
12419 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
12421 (geu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
12422 (match_operand:DI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12424 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
12425 (geu:DI (match_dup 1) (match_dup 2)))]
12428 subfc %0,%2,%1\;li %0,0\;adde. %0,%0,%0
12429 addic %0,%1,%n2\;li %0,0\;adde. %0,%0,%0
12432 [(set_attr "type" "compare")
12433 (set_attr "length" "12,12,16,16")])
12436 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12438 (geu:DI (match_operand:DI 1 "gpc_reg_operand" "")
12439 (match_operand:DI 2 "reg_or_neg_short_operand" ""))
12441 (set (match_operand:DI 0 "gpc_reg_operand" "")
12442 (geu:DI (match_dup 1) (match_dup 2)))]
12443 "TARGET_64BIT && reload_completed"
12444 [(set (match_dup 0)
12445 (geu:DI (match_dup 1) (match_dup 2)))
12447 (compare:CC (match_dup 0)
12452 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12453 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12454 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
12455 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
12458 {sf|subfc} %0,%2,%1\;{aze|addze} %0,%3
12459 {ai|addic} %0,%1,%n2\;{aze|addze} %0,%3"
12460 [(set_attr "type" "two")
12461 (set_attr "length" "8")])
12464 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12466 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12467 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12468 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12470 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12473 {sf|subfc} %4,%2,%1\;{aze.|addze.} %4,%3
12474 {ai|addic} %4,%1,%n2\;{aze.|addze.} %4,%3
12477 [(set_attr "type" "compare")
12478 (set_attr "length" "8,8,12,12")])
12481 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12483 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12484 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12485 (match_operand:SI 3 "gpc_reg_operand" ""))
12487 (clobber (match_scratch:SI 4 ""))]
12488 "TARGET_32BIT && reload_completed"
12489 [(set (match_dup 4)
12490 (plus:SI (geu:SI (match_dup 1) (match_dup 2))
12493 (compare:CC (match_dup 4)
12498 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12500 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12501 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12502 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12504 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12505 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12508 {sf|subfc} %0,%2,%1\;{aze.|addze.} %0,%3
12509 {ai|addic} %0,%1,%n2\;{aze.|addze.} %0,%3
12512 [(set_attr "type" "compare")
12513 (set_attr "length" "8,8,12,12")])
12516 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12518 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12519 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12520 (match_operand:SI 3 "gpc_reg_operand" ""))
12522 (set (match_operand:SI 0 "gpc_reg_operand" "")
12523 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12524 "TARGET_32BIT && reload_completed"
12525 [(set (match_dup 0)
12526 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12528 (compare:CC (match_dup 0)
12533 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12534 (neg:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12535 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))]
12538 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0
12539 {sfi|subfic} %0,%1,-1\;{a%I2|add%I2c} %0,%0,%2\;{sfe|subfe} %0,%0,%0"
12540 [(set_attr "type" "three")
12541 (set_attr "length" "12")])
12544 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12546 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12547 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))
12548 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
12551 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0
12552 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
12553 [(set_attr "type" "three")
12554 (set_attr "length" "12")])
12557 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12560 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12561 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
12562 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12564 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12567 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
12568 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
12571 [(set_attr "type" "compare")
12572 (set_attr "length" "12,12,16,16")])
12575 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12578 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12579 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
12580 (match_operand:SI 3 "gpc_reg_operand" ""))
12582 (clobber (match_scratch:SI 4 ""))]
12583 "TARGET_32BIT && reload_completed"
12584 [(set (match_dup 4)
12585 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2)))
12588 (compare:CC (match_dup 4)
12593 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12596 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12597 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
12598 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12600 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12601 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12604 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
12605 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
12608 [(set_attr "type" "compare")
12609 (set_attr "length" "12,12,16,16")])
12612 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12615 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12616 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
12617 (match_operand:SI 3 "gpc_reg_operand" ""))
12619 (set (match_operand:SI 0 "gpc_reg_operand" "")
12620 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12621 "TARGET_32BIT && reload_completed"
12622 [(set (match_dup 0)
12623 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
12625 (compare:CC (match_dup 0)
12630 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12631 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12634 "{sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{sri|srwi} %0,%0,31"
12635 [(set_attr "type" "three")
12636 (set_attr "length" "12")])
12639 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12640 (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
12643 "subfic %0,%1,0\;addme %0,%0\;srdi %0,%0,63"
12644 [(set_attr "type" "three")
12645 (set_attr "length" "12")])
12648 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
12650 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12653 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12654 (gt:SI (match_dup 1) (const_int 0)))]
12657 {sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{sri.|srwi.} %0,%0,31
12659 [(set_attr "type" "delayed_compare")
12660 (set_attr "length" "12,16")])
12663 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
12665 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12668 (set (match_operand:SI 0 "gpc_reg_operand" "")
12669 (gt:SI (match_dup 1) (const_int 0)))]
12670 "TARGET_32BIT && reload_completed"
12671 [(set (match_dup 0)
12672 (gt:SI (match_dup 1) (const_int 0)))
12674 (compare:CC (match_dup 0)
12679 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
12681 (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12684 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
12685 (gt:DI (match_dup 1) (const_int 0)))]
12688 subfic %0,%1,0\;addme %0,%0\;srdi. %0,%0,63
12690 [(set_attr "type" "delayed_compare")
12691 (set_attr "length" "12,16")])
12694 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
12696 (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
12699 (set (match_operand:DI 0 "gpc_reg_operand" "")
12700 (gt:DI (match_dup 1) (const_int 0)))]
12701 "TARGET_64BIT && reload_completed"
12702 [(set (match_dup 0)
12703 (gt:DI (match_dup 1) (const_int 0)))
12705 (compare:CC (match_dup 0)
12710 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12711 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12712 (match_operand:SI 2 "reg_or_short_operand" "r")))]
12714 "doz %0,%2,%1\;nabs %0,%0\;{sri|srwi} %0,%0,31"
12715 [(set_attr "length" "12")])
12718 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12720 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12721 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
12723 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12724 (gt:SI (match_dup 1) (match_dup 2)))]
12727 doz %0,%2,%1\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
12729 [(set_attr "type" "delayed_compare")
12730 (set_attr "length" "12,16")])
12733 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12735 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12736 (match_operand:SI 2 "reg_or_short_operand" ""))
12738 (set (match_operand:SI 0 "gpc_reg_operand" "")
12739 (gt:SI (match_dup 1) (match_dup 2)))]
12740 "TARGET_POWER && reload_completed"
12741 [(set (match_dup 0)
12742 (gt:SI (match_dup 1) (match_dup 2)))
12744 (compare:CC (match_dup 0)
12749 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12750 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12752 (match_operand:SI 2 "gpc_reg_operand" "r")))]
12754 "{a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze|addze} %0,%2"
12755 [(set_attr "type" "three")
12756 (set_attr "length" "12")])
12759 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
12760 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
12762 (match_operand:DI 2 "gpc_reg_operand" "r")))]
12764 "addc %0,%1,%1\;subfe %0,%1,%0\;addze %0,%2"
12765 [(set_attr "type" "three")
12766 (set_attr "length" "12")])
12769 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12771 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12773 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
12775 (clobber (match_scratch:SI 3 "=&r,&r"))]
12778 {a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze.|addze.} %3,%2
12780 [(set_attr "type" "compare")
12781 (set_attr "length" "12,16")])
12784 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12786 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12788 (match_operand:SI 2 "gpc_reg_operand" ""))
12790 (clobber (match_scratch:SI 3 ""))]
12791 "TARGET_32BIT && reload_completed"
12792 [(set (match_dup 3)
12793 (plus:SI (gt:SI (match_dup 1) (const_int 0))
12796 (compare:CC (match_dup 3)
12801 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12803 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12805 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
12807 (clobber (match_scratch:DI 3 "=&r,&r"))]
12810 addc %3,%1,%1\;subfe %3,%1,%3\;addze. %3,%2
12812 [(set_attr "type" "compare")
12813 (set_attr "length" "12,16")])
12816 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12818 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
12820 (match_operand:DI 2 "gpc_reg_operand" ""))
12822 (clobber (match_scratch:DI 3 ""))]
12823 "TARGET_64BIT && reload_completed"
12824 [(set (match_dup 3)
12825 (plus:DI (gt:DI (match_dup 1) (const_int 0))
12828 (compare:CC (match_dup 3)
12833 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12835 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12837 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
12839 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12840 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
12843 {a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze.|addze.} %0,%2
12845 [(set_attr "type" "compare")
12846 (set_attr "length" "12,16")])
12849 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12851 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12853 (match_operand:SI 2 "gpc_reg_operand" ""))
12855 (set (match_operand:SI 0 "gpc_reg_operand" "")
12856 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
12857 "TARGET_32BIT && reload_completed"
12858 [(set (match_dup 0)
12859 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))
12861 (compare:CC (match_dup 0)
12866 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12868 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12870 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
12872 (set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
12873 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
12876 addc %0,%1,%1\;subfe %0,%1,%0\;addze. %0,%2
12878 [(set_attr "type" "compare")
12879 (set_attr "length" "12,16")])
12882 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12884 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
12886 (match_operand:DI 2 "gpc_reg_operand" ""))
12888 (set (match_operand:DI 0 "gpc_reg_operand" "")
12889 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
12890 "TARGET_64BIT && reload_completed"
12891 [(set (match_dup 0)
12892 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))
12894 (compare:CC (match_dup 0)
12899 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12900 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12901 (match_operand:SI 2 "reg_or_short_operand" "r"))
12902 (match_operand:SI 3 "gpc_reg_operand" "r")))]
12904 "doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
12905 [(set_attr "length" "12")])
12908 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12910 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12911 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
12912 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12914 (clobber (match_scratch:SI 4 "=&r,&r"))]
12917 doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
12919 [(set_attr "type" "compare")
12920 (set_attr "length" "12,16")])
12923 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12925 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12926 (match_operand:SI 2 "reg_or_short_operand" ""))
12927 (match_operand:SI 3 "gpc_reg_operand" ""))
12929 (clobber (match_scratch:SI 4 ""))]
12930 "TARGET_POWER && reload_completed"
12931 [(set (match_dup 4)
12932 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12934 (compare:CC (match_dup 4)
12939 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12941 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12942 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
12943 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12945 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12946 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12949 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
12951 [(set_attr "type" "compare")
12952 (set_attr "length" "12,16")])
12955 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12957 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12958 (match_operand:SI 2 "reg_or_short_operand" ""))
12959 (match_operand:SI 3 "gpc_reg_operand" ""))
12961 (set (match_operand:SI 0 "gpc_reg_operand" "")
12962 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12963 "TARGET_POWER && reload_completed"
12964 [(set (match_dup 0)
12965 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12967 (compare:CC (match_dup 0)
12972 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12973 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12976 "{sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{srai|srawi} %0,%0,31"
12977 [(set_attr "type" "three")
12978 (set_attr "length" "12")])
12981 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12982 (neg:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
12985 "subfic %0,%1,0\;addme %0,%0\;sradi %0,%0,63"
12986 [(set_attr "type" "three")
12987 (set_attr "length" "12")])
12990 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12991 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12992 (match_operand:SI 2 "reg_or_short_operand" "r"))))]
12994 "doz %0,%2,%1\;nabs %0,%0\;{srai|srawi} %0,%0,31"
12995 [(set_attr "length" "12")])
12997 (define_insn_and_split ""
12998 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12999 (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13000 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
13004 [(set (match_dup 0) (neg:SI (gtu:SI (match_dup 1) (match_dup 2))))
13005 (set (match_dup 0) (neg:SI (match_dup 0)))]
13008 (define_insn_and_split ""
13009 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13010 (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r")
13011 (match_operand:DI 2 "reg_or_short_operand" "rI")))]
13015 [(set (match_dup 0) (neg:DI (gtu:DI (match_dup 1) (match_dup 2))))
13016 (set (match_dup 0) (neg:DI (match_dup 0)))]
13020 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13022 (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13023 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13025 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13026 (gtu:SI (match_dup 1) (match_dup 2)))]
13029 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;neg. %0,%0
13031 [(set_attr "type" "compare")
13032 (set_attr "length" "12,16")])
13035 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13037 (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13038 (match_operand:SI 2 "reg_or_short_operand" ""))
13040 (set (match_operand:SI 0 "gpc_reg_operand" "")
13041 (gtu:SI (match_dup 1) (match_dup 2)))]
13042 "TARGET_32BIT && reload_completed"
13043 [(set (match_dup 0)
13044 (gtu:SI (match_dup 1) (match_dup 2)))
13046 (compare:CC (match_dup 0)
13051 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13053 (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13054 (match_operand:DI 2 "reg_or_short_operand" "rI,rI"))
13056 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
13057 (gtu:DI (match_dup 1) (match_dup 2)))]
13060 subf%I2c %0,%1,%2\;subfe %0,%0,%0\;neg. %0,%0
13062 [(set_attr "type" "compare")
13063 (set_attr "length" "12,16")])
13066 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13068 (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "")
13069 (match_operand:DI 2 "reg_or_short_operand" ""))
13071 (set (match_operand:DI 0 "gpc_reg_operand" "")
13072 (gtu:DI (match_dup 1) (match_dup 2)))]
13073 "TARGET_64BIT && reload_completed"
13074 [(set (match_dup 0)
13075 (gtu:DI (match_dup 1) (match_dup 2)))
13077 (compare:CC (match_dup 0)
13081 (define_insn_and_split ""
13082 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
13083 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13084 (match_operand:SI 2 "reg_or_short_operand" "rI"))
13085 (match_operand:SI 3 "reg_or_short_operand" "rI")))]
13088 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13089 [(set (match_dup 0) (neg:SI (gtu:SI (match_dup 1) (match_dup 2))))
13090 (set (match_dup 0) (minus:SI (match_dup 3) (match_dup 0)))]
13093 (define_insn_and_split ""
13094 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
13095 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r")
13096 (match_operand:DI 2 "reg_or_short_operand" "rI"))
13097 (match_operand:DI 3 "reg_or_short_operand" "rI")))]
13100 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13101 [(set (match_dup 0) (neg:DI (gtu:DI (match_dup 1) (match_dup 2))))
13102 (set (match_dup 0) (minus:DI (match_dup 3) (match_dup 0)))]
13106 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13108 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13109 (match_operand:SI 2 "reg_or_short_operand" "I,r,I,r"))
13110 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13112 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
13115 {ai|addic} %4,%1,%k2\;{aze.|addze.} %4,%3
13116 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;{sf.|subf.} %4,%4,%3
13119 [(set_attr "type" "compare")
13120 (set_attr "length" "8,12,12,16")])
13123 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13125 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13126 (match_operand:SI 2 "reg_or_short_operand" ""))
13127 (match_operand:SI 3 "gpc_reg_operand" ""))
13129 (clobber (match_scratch:SI 4 ""))]
13130 "TARGET_32BIT && reload_completed"
13131 [(set (match_dup 4)
13132 (plus:SI (gtu:SI (match_dup 1) (match_dup 2))
13135 (compare:CC (match_dup 4)
13140 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13142 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
13143 (match_operand:DI 2 "reg_or_short_operand" "I,r,I,r"))
13144 (match_operand:DI 3 "gpc_reg_operand" "r,r,r,r"))
13146 (clobber (match_scratch:DI 4 "=&r,&r,&r,&r"))]
13149 addic %4,%1,%k2\;addze. %4,%3
13150 subf%I2c %4,%1,%2\;subfe %4,%4,%4\;subf. %4,%4,%3
13153 [(set_attr "type" "compare")
13154 (set_attr "length" "8,12,12,16")])
13157 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13159 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "")
13160 (match_operand:DI 2 "reg_or_short_operand" ""))
13161 (match_operand:DI 3 "gpc_reg_operand" ""))
13163 (clobber (match_scratch:DI 4 ""))]
13164 "TARGET_64BIT && reload_completed"
13165 [(set (match_dup 4)
13166 (plus:DI (gtu:DI (match_dup 1) (match_dup 2))
13169 (compare:CC (match_dup 4)
13174 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13176 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13177 (match_operand:SI 2 "reg_or_short_operand" "I,r,I,r"))
13178 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13180 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13181 (plus:SI (gtu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13184 {ai|addic} %0,%1,%k2\;{aze.|addze.} %0,%3
13185 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;{sf.|subf.} %0,%0,%3
13188 [(set_attr "type" "compare")
13189 (set_attr "length" "8,12,12,16")])
13192 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13194 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13195 (match_operand:SI 2 "reg_or_short_operand" ""))
13196 (match_operand:SI 3 "gpc_reg_operand" ""))
13198 (set (match_operand:SI 0 "gpc_reg_operand" "")
13199 (plus:SI (gtu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13200 "TARGET_32BIT && reload_completed"
13201 [(set (match_dup 0)
13202 (plus:SI (gtu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13204 (compare:CC (match_dup 0)
13209 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13211 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
13212 (match_operand:DI 2 "reg_or_short_operand" "I,r,I,r"))
13213 (match_operand:DI 3 "gpc_reg_operand" "r,r,r,r"))
13215 (set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13216 (plus:DI (gtu:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13219 addic %0,%1,%k2\;addze. %0,%3
13220 subf%I2c %0,%1,%2\;subfe %0,%0,%0\;subf. %0,%0,%3
13223 [(set_attr "type" "compare")
13224 (set_attr "length" "8,12,12,16")])
13227 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13229 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "")
13230 (match_operand:DI 2 "reg_or_short_operand" ""))
13231 (match_operand:DI 3 "gpc_reg_operand" ""))
13233 (set (match_operand:DI 0 "gpc_reg_operand" "")
13234 (plus:DI (gtu:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13235 "TARGET_64BIT && reload_completed"
13236 [(set (match_dup 0)
13237 (plus:DI (gtu:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
13239 (compare:CC (match_dup 0)
13244 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13245 (neg:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13246 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
13248 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0"
13249 [(set_attr "type" "two")
13250 (set_attr "length" "8")])
13253 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13254 (neg:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r")
13255 (match_operand:DI 2 "reg_or_short_operand" "rI"))))]
13257 "subf%I2c %0,%1,%2\;subfe %0,%0,%0"
13258 [(set_attr "type" "two")
13259 (set_attr "length" "8")])
13261 ;; Define both directions of branch and return. If we need a reload
13262 ;; register, we'd rather use CR0 since it is much easier to copy a
13263 ;; register CC value to there.
13267 (if_then_else (match_operator 1 "branch_comparison_operator"
13269 "cc_reg_operand" "y")
13271 (label_ref (match_operand 0 "" ""))
13276 return output_cbranch (operands[1], \"%l0\", 0, insn);
13278 [(set_attr "type" "branch")])
13282 (if_then_else (match_operator 0 "branch_comparison_operator"
13284 "cc_reg_operand" "y")
13291 return output_cbranch (operands[0], NULL, 0, insn);
13293 [(set_attr "type" "branch")
13294 (set_attr "length" "4")])
13298 (if_then_else (match_operator 1 "branch_comparison_operator"
13300 "cc_reg_operand" "y")
13303 (label_ref (match_operand 0 "" ""))))]
13307 return output_cbranch (operands[1], \"%l0\", 1, insn);
13309 [(set_attr "type" "branch")])
13313 (if_then_else (match_operator 0 "branch_comparison_operator"
13315 "cc_reg_operand" "y")
13322 return output_cbranch (operands[0], NULL, 1, insn);
13324 [(set_attr "type" "branch")
13325 (set_attr "length" "4")])
13327 ;; Logic on condition register values.
13329 ; This pattern matches things like
13330 ; (set (reg:CCEQ 68) (compare:CCEQ (ior:SI (gt:SI (reg:CCFP 68) (const_int 0))
13331 ; (eq:SI (reg:CCFP 68) (const_int 0)))
13333 ; which are generated by the branch logic.
13334 ; Prefer destructive operations where BT = BB (for crXX BT,BA,BB)
13336 (define_insn "*cceq_ior_compare"
13337 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13338 (compare:CCEQ (match_operator:SI 1 "boolean_operator"
13339 [(match_operator:SI 2
13340 "branch_positive_comparison_operator"
13342 "cc_reg_operand" "y,y")
13344 (match_operator:SI 4
13345 "branch_positive_comparison_operator"
13347 "cc_reg_operand" "0,y")
13351 "cr%q1 %E0,%j2,%j4"
13352 [(set_attr "type" "cr_logical,delayed_cr")])
13354 ; Why is the constant -1 here, but 1 in the previous pattern?
13355 ; Because ~1 has all but the low bit set.
13357 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13358 (compare:CCEQ (match_operator:SI 1 "boolean_or_operator"
13359 [(not:SI (match_operator:SI 2
13360 "branch_positive_comparison_operator"
13362 "cc_reg_operand" "y,y")
13364 (match_operator:SI 4
13365 "branch_positive_comparison_operator"
13367 "cc_reg_operand" "0,y")
13371 "cr%q1 %E0,%j2,%j4"
13372 [(set_attr "type" "cr_logical,delayed_cr")])
13374 (define_insn "*cceq_rev_compare"
13375 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13376 (compare:CCEQ (match_operator:SI 1
13377 "branch_positive_comparison_operator"
13379 "cc_reg_operand" "0,y")
13383 "{crnor %E0,%j1,%j1|crnot %E0,%j1}"
13384 [(set_attr "type" "cr_logical,delayed_cr")])
13386 ;; If we are comparing the result of two comparisons, this can be done
13387 ;; using creqv or crxor.
13389 (define_insn_and_split ""
13390 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
13391 (compare:CCEQ (match_operator 1 "branch_comparison_operator"
13392 [(match_operand 2 "cc_reg_operand" "y")
13394 (match_operator 3 "branch_comparison_operator"
13395 [(match_operand 4 "cc_reg_operand" "y")
13400 [(set (match_dup 0) (compare:CCEQ (xor:SI (match_dup 1) (match_dup 3))
13404 int positive_1, positive_2;
13406 positive_1 = branch_positive_comparison_operator (operands[1],
13407 GET_MODE (operands[1]));
13408 positive_2 = branch_positive_comparison_operator (operands[3],
13409 GET_MODE (operands[3]));
13412 operands[1] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[2]),
13413 GET_CODE (operands[1])),
13415 operands[2], const0_rtx);
13416 else if (GET_MODE (operands[1]) != SImode)
13417 operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]), SImode,
13418 operands[2], const0_rtx);
13421 operands[3] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[4]),
13422 GET_CODE (operands[3])),
13424 operands[4], const0_rtx);
13425 else if (GET_MODE (operands[3]) != SImode)
13426 operands[3] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
13427 operands[4], const0_rtx);
13429 if (positive_1 == positive_2)
13431 operands[1] = gen_rtx_NOT (SImode, operands[1]);
13432 operands[5] = constm1_rtx;
13436 operands[5] = const1_rtx;
13440 ;; Unconditional branch and return.
13442 (define_insn "jump"
13444 (label_ref (match_operand 0 "" "")))]
13447 [(set_attr "type" "branch")])
13449 (define_insn "return"
13453 [(set_attr "type" "jmpreg")])
13455 (define_expand "indirect_jump"
13456 [(set (pc) (match_operand 0 "register_operand" ""))])
13458 (define_insn "*indirect_jump<mode>"
13459 [(set (pc) (match_operand:P 0 "register_operand" "c,*l"))]
13464 [(set_attr "type" "jmpreg")])
13466 ;; Table jump for switch statements:
13467 (define_expand "tablejump"
13468 [(use (match_operand 0 "" ""))
13469 (use (label_ref (match_operand 1 "" "")))]
13474 emit_jump_insn (gen_tablejumpsi (operands[0], operands[1]));
13476 emit_jump_insn (gen_tablejumpdi (operands[0], operands[1]));
13480 (define_expand "tablejumpsi"
13481 [(set (match_dup 3)
13482 (plus:SI (match_operand:SI 0 "" "")
13484 (parallel [(set (pc) (match_dup 3))
13485 (use (label_ref (match_operand 1 "" "")))])]
13488 { operands[0] = force_reg (SImode, operands[0]);
13489 operands[2] = force_reg (SImode, gen_rtx_LABEL_REF (SImode, operands[1]));
13490 operands[3] = gen_reg_rtx (SImode);
13493 (define_expand "tablejumpdi"
13494 [(set (match_dup 4)
13495 (sign_extend:DI (match_operand:SI 0 "lwa_operand" "rm")))
13497 (plus:DI (match_dup 4)
13499 (parallel [(set (pc) (match_dup 3))
13500 (use (label_ref (match_operand 1 "" "")))])]
13503 { operands[2] = force_reg (DImode, gen_rtx_LABEL_REF (DImode, operands[1]));
13504 operands[3] = gen_reg_rtx (DImode);
13505 operands[4] = gen_reg_rtx (DImode);
13510 (match_operand:P 0 "register_operand" "c,*l"))
13511 (use (label_ref (match_operand 1 "" "")))]
13516 [(set_attr "type" "jmpreg")])
13521 "{cror 0,0,0|nop}")
13523 ;; Define the subtract-one-and-jump insns, starting with the template
13524 ;; so loop.c knows what to generate.
13526 (define_expand "doloop_end"
13527 [(use (match_operand 0 "" "")) ; loop pseudo
13528 (use (match_operand 1 "" "")) ; iterations; zero if unknown
13529 (use (match_operand 2 "" "")) ; max iterations
13530 (use (match_operand 3 "" "")) ; loop level
13531 (use (match_operand 4 "" ""))] ; label
13535 /* Only use this on innermost loops. */
13536 if (INTVAL (operands[3]) > 1)
13540 if (GET_MODE (operands[0]) != DImode)
13542 emit_jump_insn (gen_ctrdi (operands[0], operands[4]));
13546 if (GET_MODE (operands[0]) != SImode)
13548 emit_jump_insn (gen_ctrsi (operands[0], operands[4]));
13553 (define_expand "ctr<mode>"
13554 [(parallel [(set (pc)
13555 (if_then_else (ne (match_operand:P 0 "register_operand" "")
13557 (label_ref (match_operand 1 "" ""))
13560 (plus:P (match_dup 0)
13562 (clobber (match_scratch:CC 2 ""))
13563 (clobber (match_scratch:P 3 ""))])]
13567 ;; We need to be able to do this for any operand, including MEM, or we
13568 ;; will cause reload to blow up since we don't allow output reloads on
13570 ;; For the length attribute to be calculated correctly, the
13571 ;; label MUST be operand 0.
13573 (define_insn "*ctr<mode>_internal1"
13575 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
13577 (label_ref (match_operand 0 "" ""))
13579 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
13580 (plus:P (match_dup 1)
13582 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
13583 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
13587 if (which_alternative != 0)
13589 else if (get_attr_length (insn) == 4)
13590 return \"{bdn|bdnz} %l0\";
13592 return \"bdz $+8\;b %l0\";
13594 [(set_attr "type" "branch")
13595 (set_attr "length" "*,12,16,16")])
13597 (define_insn "*ctr<mode>_internal2"
13599 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
13602 (label_ref (match_operand 0 "" ""))))
13603 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
13604 (plus:P (match_dup 1)
13606 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
13607 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
13611 if (which_alternative != 0)
13613 else if (get_attr_length (insn) == 4)
13614 return \"bdz %l0\";
13616 return \"{bdn|bdnz} $+8\;b %l0\";
13618 [(set_attr "type" "branch")
13619 (set_attr "length" "*,12,16,16")])
13621 ;; Similar but use EQ
13623 (define_insn "*ctr<mode>_internal5"
13625 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
13627 (label_ref (match_operand 0 "" ""))
13629 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
13630 (plus:P (match_dup 1)
13632 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
13633 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
13637 if (which_alternative != 0)
13639 else if (get_attr_length (insn) == 4)
13640 return \"bdz %l0\";
13642 return \"{bdn|bdnz} $+8\;b %l0\";
13644 [(set_attr "type" "branch")
13645 (set_attr "length" "*,12,16,16")])
13647 (define_insn "*ctr<mode>_internal6"
13649 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
13652 (label_ref (match_operand 0 "" ""))))
13653 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
13654 (plus:P (match_dup 1)
13656 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
13657 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
13661 if (which_alternative != 0)
13663 else if (get_attr_length (insn) == 4)
13664 return \"{bdn|bdnz} %l0\";
13666 return \"bdz $+8\;b %l0\";
13668 [(set_attr "type" "branch")
13669 (set_attr "length" "*,12,16,16")])
13671 ;; Now the splitters if we could not allocate the CTR register
13675 (if_then_else (match_operator 2 "comparison_operator"
13676 [(match_operand:P 1 "gpc_reg_operand" "")
13678 (match_operand 5 "" "")
13679 (match_operand 6 "" "")))
13680 (set (match_operand:P 0 "gpc_reg_operand" "")
13681 (plus:P (match_dup 1) (const_int -1)))
13682 (clobber (match_scratch:CC 3 ""))
13683 (clobber (match_scratch:P 4 ""))]
13685 [(parallel [(set (match_dup 3)
13686 (compare:CC (plus:P (match_dup 1)
13690 (plus:P (match_dup 1)
13692 (set (pc) (if_then_else (match_dup 7)
13696 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
13697 operands[3], const0_rtx); }")
13701 (if_then_else (match_operator 2 "comparison_operator"
13702 [(match_operand:P 1 "gpc_reg_operand" "")
13704 (match_operand 5 "" "")
13705 (match_operand 6 "" "")))
13706 (set (match_operand:P 0 "nonimmediate_operand" "")
13707 (plus:P (match_dup 1) (const_int -1)))
13708 (clobber (match_scratch:CC 3 ""))
13709 (clobber (match_scratch:P 4 ""))]
13710 "reload_completed && ! gpc_reg_operand (operands[0], SImode)"
13711 [(parallel [(set (match_dup 3)
13712 (compare:CC (plus:P (match_dup 1)
13716 (plus:P (match_dup 1)
13720 (set (pc) (if_then_else (match_dup 7)
13724 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
13725 operands[3], const0_rtx); }")
13727 (define_insn "trap"
13728 [(trap_if (const_int 1) (const_int 0))]
13732 (define_expand "conditional_trap"
13733 [(trap_if (match_operator 0 "trap_comparison_operator"
13734 [(match_dup 2) (match_dup 3)])
13735 (match_operand 1 "const_int_operand" ""))]
13737 "if (rs6000_compare_fp_p || operands[1] != const0_rtx) FAIL;
13738 operands[2] = rs6000_compare_op0;
13739 operands[3] = rs6000_compare_op1;")
13742 [(trap_if (match_operator 0 "trap_comparison_operator"
13743 [(match_operand:GPR 1 "register_operand" "r")
13744 (match_operand:GPR 2 "reg_or_short_operand" "rI")])
13747 "{t|t<wd>}%V0%I2 %1,%2")
13749 ;; Insns related to generating the function prologue and epilogue.
13751 (define_expand "prologue"
13752 [(use (const_int 0))]
13753 "TARGET_SCHED_PROLOG"
13756 rs6000_emit_prologue ();
13760 (define_insn "*movesi_from_cr_one"
13761 [(match_parallel 0 "mfcr_operation"
13762 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
13763 (unspec:SI [(match_operand:CC 2 "cc_reg_operand" "y")
13764 (match_operand 3 "immediate_operand" "n")]
13765 UNSPEC_MOVESI_FROM_CR))])]
13771 for (i = 0; i < XVECLEN (operands[0], 0); i++)
13773 mask = INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
13774 operands[4] = GEN_INT (mask);
13775 output_asm_insn (\"mfcr %1,%4\", operands);
13779 [(set_attr "type" "mfcrf")])
13781 (define_insn "movesi_from_cr"
13782 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13783 (unspec:SI [(reg:CC 68) (reg:CC 69) (reg:CC 70) (reg:CC 71)
13784 (reg:CC 72) (reg:CC 73) (reg:CC 74) (reg:CC 75)]
13785 UNSPEC_MOVESI_FROM_CR))]
13788 [(set_attr "type" "mfcr")])
13790 (define_insn "*stmw"
13791 [(match_parallel 0 "stmw_operation"
13792 [(set (match_operand:SI 1 "memory_operand" "=m")
13793 (match_operand:SI 2 "gpc_reg_operand" "r"))])]
13795 "{stm|stmw} %2,%1")
13797 (define_insn "*save_fpregs_<mode>"
13798 [(match_parallel 0 "any_parallel_operand"
13799 [(clobber (match_operand:P 1 "register_operand" "=l"))
13800 (use (match_operand:P 2 "call_operand" "s"))
13801 (set (match_operand:DF 3 "memory_operand" "=m")
13802 (match_operand:DF 4 "gpc_reg_operand" "f"))])]
13805 [(set_attr "type" "branch")
13806 (set_attr "length" "4")])
13808 ; These are to explain that changes to the stack pointer should
13809 ; not be moved over stores to stack memory.
13810 (define_insn "stack_tie"
13811 [(set (match_operand:BLK 0 "memory_operand" "+m")
13812 (unspec:BLK [(match_dup 0)] UNSPEC_TIE))]
13815 [(set_attr "length" "0")])
13818 (define_expand "epilogue"
13819 [(use (const_int 0))]
13820 "TARGET_SCHED_PROLOG"
13823 rs6000_emit_epilogue (FALSE);
13827 ; On some processors, doing the mtcrf one CC register at a time is
13828 ; faster (like on the 604e). On others, doing them all at once is
13829 ; faster; for instance, on the 601 and 750.
13831 (define_expand "movsi_to_cr_one"
13832 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
13833 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
13834 (match_dup 2)] UNSPEC_MOVESI_TO_CR))]
13836 "operands[2] = GEN_INT (1 << (75 - REGNO (operands[0])));")
13838 (define_insn "*movsi_to_cr"
13839 [(match_parallel 0 "mtcrf_operation"
13840 [(set (match_operand:CC 1 "cc_reg_operand" "=y")
13841 (unspec:CC [(match_operand:SI 2 "gpc_reg_operand" "r")
13842 (match_operand 3 "immediate_operand" "n")]
13843 UNSPEC_MOVESI_TO_CR))])]
13849 for (i = 0; i < XVECLEN (operands[0], 0); i++)
13850 mask |= INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
13851 operands[4] = GEN_INT (mask);
13852 return \"mtcrf %4,%2\";
13854 [(set_attr "type" "mtcr")])
13856 (define_insn "*mtcrfsi"
13857 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
13858 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
13859 (match_operand 2 "immediate_operand" "n")]
13860 UNSPEC_MOVESI_TO_CR))]
13861 "GET_CODE (operands[0]) == REG
13862 && CR_REGNO_P (REGNO (operands[0]))
13863 && GET_CODE (operands[2]) == CONST_INT
13864 && INTVAL (operands[2]) == 1 << (75 - REGNO (operands[0]))"
13866 [(set_attr "type" "mtcr")])
13868 ; The load-multiple instructions have similar properties.
13869 ; Note that "load_multiple" is a name known to the machine-independent
13870 ; code that actually corresponds to the powerpc load-string.
13872 (define_insn "*lmw"
13873 [(match_parallel 0 "lmw_operation"
13874 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
13875 (match_operand:SI 2 "memory_operand" "m"))])]
13879 (define_insn "*return_internal_<mode>"
13881 (use (match_operand:P 0 "register_operand" "lc"))]
13884 [(set_attr "type" "jmpreg")])
13886 ; FIXME: This would probably be somewhat simpler if the Cygnus sibcall
13887 ; stuff was in GCC. Oh, and "any_parallel_operand" is a bit flexible...
13889 (define_insn "*return_and_restore_fpregs_<mode>"
13890 [(match_parallel 0 "any_parallel_operand"
13892 (use (match_operand:P 1 "register_operand" "l"))
13893 (use (match_operand:P 2 "call_operand" "s"))
13894 (set (match_operand:DF 3 "gpc_reg_operand" "=f")
13895 (match_operand:DF 4 "memory_operand" "m"))])]
13899 ; This is used in compiling the unwind routines.
13900 (define_expand "eh_return"
13901 [(use (match_operand 0 "general_operand" ""))]
13906 emit_insn (gen_eh_set_lr_si (operands[0]));
13908 emit_insn (gen_eh_set_lr_di (operands[0]));
13912 ; We can't expand this before we know where the link register is stored.
13913 (define_insn "eh_set_lr_<mode>"
13914 [(unspec_volatile [(match_operand:P 0 "register_operand" "r")]
13916 (clobber (match_scratch:P 1 "=&b"))]
13921 [(unspec_volatile [(match_operand 0 "register_operand" "")] UNSPECV_EH_RR)
13922 (clobber (match_scratch 1 ""))]
13927 rs6000_emit_eh_reg_restore (operands[0], operands[1]);
13931 (define_insn "prefetch"
13932 [(prefetch (match_operand:V4SI 0 "address_operand" "p")
13933 (match_operand:SI 1 "const_int_operand" "n")
13934 (match_operand:SI 2 "const_int_operand" "n"))]
13938 if (GET_CODE (operands[0]) == REG)
13939 return INTVAL (operands[1]) ? \"dcbtst 0,%0\" : \"dcbt 0,%0\";
13940 return INTVAL (operands[1]) ? \"dcbtst %a0\" : \"dcbt %a0\";
13942 [(set_attr "type" "load")])
13945 (include "sync.md")
13946 (include "altivec.md")