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 "clrmemsi"
8617 [(parallel [(set (match_operand:BLK 0 "" "")
8619 (use (match_operand:SI 1 "" ""))
8620 (use (match_operand:SI 2 "" ""))])]
8624 if (expand_block_clear (operands))
8630 ;; String/block move insn.
8631 ;; Argument 0 is the destination
8632 ;; Argument 1 is the source
8633 ;; Argument 2 is the length
8634 ;; Argument 3 is the alignment
8636 (define_expand "movmemsi"
8637 [(parallel [(set (match_operand:BLK 0 "" "")
8638 (match_operand:BLK 1 "" ""))
8639 (use (match_operand:SI 2 "" ""))
8640 (use (match_operand:SI 3 "" ""))])]
8644 if (expand_block_move (operands))
8650 ;; Move up to 32 bytes at a time. The fixed registers are needed because the
8651 ;; register allocator doesn't have a clue about allocating 8 word registers.
8652 ;; rD/rS = r5 is preferred, efficient form.
8653 (define_expand "movmemsi_8reg"
8654 [(parallel [(set (match_operand 0 "" "")
8655 (match_operand 1 "" ""))
8656 (use (match_operand 2 "" ""))
8657 (use (match_operand 3 "" ""))
8658 (clobber (reg:SI 5))
8659 (clobber (reg:SI 6))
8660 (clobber (reg:SI 7))
8661 (clobber (reg:SI 8))
8662 (clobber (reg:SI 9))
8663 (clobber (reg:SI 10))
8664 (clobber (reg:SI 11))
8665 (clobber (reg:SI 12))
8666 (clobber (match_scratch:SI 4 ""))])]
8671 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
8672 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
8673 (use (match_operand:SI 2 "immediate_operand" "i"))
8674 (use (match_operand:SI 3 "immediate_operand" "i"))
8675 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
8676 (clobber (reg:SI 6))
8677 (clobber (reg:SI 7))
8678 (clobber (reg:SI 8))
8679 (clobber (reg:SI 9))
8680 (clobber (reg:SI 10))
8681 (clobber (reg:SI 11))
8682 (clobber (reg:SI 12))
8683 (clobber (match_scratch:SI 5 "=q"))]
8684 "TARGET_STRING && TARGET_POWER
8685 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
8686 || INTVAL (operands[2]) == 0)
8687 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
8688 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
8689 && REGNO (operands[4]) == 5"
8690 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
8691 [(set_attr "type" "load")
8692 (set_attr "length" "8")])
8695 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
8696 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
8697 (use (match_operand:SI 2 "immediate_operand" "i"))
8698 (use (match_operand:SI 3 "immediate_operand" "i"))
8699 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
8700 (clobber (reg:SI 6))
8701 (clobber (reg:SI 7))
8702 (clobber (reg:SI 8))
8703 (clobber (reg:SI 9))
8704 (clobber (reg:SI 10))
8705 (clobber (reg:SI 11))
8706 (clobber (reg:SI 12))
8707 (clobber (match_scratch:SI 5 "X"))]
8708 "TARGET_STRING && ! TARGET_POWER
8709 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
8710 || INTVAL (operands[2]) == 0)
8711 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
8712 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
8713 && REGNO (operands[4]) == 5"
8714 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
8715 [(set_attr "type" "load")
8716 (set_attr "length" "8")])
8718 ;; Move up to 24 bytes at a time. The fixed registers are needed because the
8719 ;; register allocator doesn't have a clue about allocating 6 word registers.
8720 ;; rD/rS = r5 is preferred, efficient form.
8721 (define_expand "movmemsi_6reg"
8722 [(parallel [(set (match_operand 0 "" "")
8723 (match_operand 1 "" ""))
8724 (use (match_operand 2 "" ""))
8725 (use (match_operand 3 "" ""))
8726 (clobber (reg:SI 5))
8727 (clobber (reg:SI 6))
8728 (clobber (reg:SI 7))
8729 (clobber (reg:SI 8))
8730 (clobber (reg:SI 9))
8731 (clobber (reg:SI 10))
8732 (clobber (match_scratch:SI 4 ""))])]
8737 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
8738 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
8739 (use (match_operand:SI 2 "immediate_operand" "i"))
8740 (use (match_operand:SI 3 "immediate_operand" "i"))
8741 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
8742 (clobber (reg:SI 6))
8743 (clobber (reg:SI 7))
8744 (clobber (reg:SI 8))
8745 (clobber (reg:SI 9))
8746 (clobber (reg:SI 10))
8747 (clobber (match_scratch:SI 5 "=q"))]
8748 "TARGET_STRING && TARGET_POWER
8749 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 24
8750 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
8751 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
8752 && REGNO (operands[4]) == 5"
8753 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
8754 [(set_attr "type" "load")
8755 (set_attr "length" "8")])
8758 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
8759 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
8760 (use (match_operand:SI 2 "immediate_operand" "i"))
8761 (use (match_operand:SI 3 "immediate_operand" "i"))
8762 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
8763 (clobber (reg:SI 6))
8764 (clobber (reg:SI 7))
8765 (clobber (reg:SI 8))
8766 (clobber (reg:SI 9))
8767 (clobber (reg:SI 10))
8768 (clobber (match_scratch:SI 5 "X"))]
8769 "TARGET_STRING && ! TARGET_POWER
8770 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
8771 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
8772 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
8773 && REGNO (operands[4]) == 5"
8774 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
8775 [(set_attr "type" "load")
8776 (set_attr "length" "8")])
8778 ;; Move up to 16 bytes at a time, using 4 fixed registers to avoid spill
8779 ;; problems with TImode.
8780 ;; rD/rS = r5 is preferred, efficient form.
8781 (define_expand "movmemsi_4reg"
8782 [(parallel [(set (match_operand 0 "" "")
8783 (match_operand 1 "" ""))
8784 (use (match_operand 2 "" ""))
8785 (use (match_operand 3 "" ""))
8786 (clobber (reg:SI 5))
8787 (clobber (reg:SI 6))
8788 (clobber (reg:SI 7))
8789 (clobber (reg:SI 8))
8790 (clobber (match_scratch:SI 4 ""))])]
8795 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
8796 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
8797 (use (match_operand:SI 2 "immediate_operand" "i"))
8798 (use (match_operand:SI 3 "immediate_operand" "i"))
8799 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
8800 (clobber (reg:SI 6))
8801 (clobber (reg:SI 7))
8802 (clobber (reg:SI 8))
8803 (clobber (match_scratch:SI 5 "=q"))]
8804 "TARGET_STRING && TARGET_POWER
8805 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
8806 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
8807 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
8808 && REGNO (operands[4]) == 5"
8809 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
8810 [(set_attr "type" "load")
8811 (set_attr "length" "8")])
8814 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
8815 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
8816 (use (match_operand:SI 2 "immediate_operand" "i"))
8817 (use (match_operand:SI 3 "immediate_operand" "i"))
8818 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
8819 (clobber (reg:SI 6))
8820 (clobber (reg:SI 7))
8821 (clobber (reg:SI 8))
8822 (clobber (match_scratch:SI 5 "X"))]
8823 "TARGET_STRING && ! TARGET_POWER
8824 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
8825 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
8826 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
8827 && REGNO (operands[4]) == 5"
8828 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
8829 [(set_attr "type" "load")
8830 (set_attr "length" "8")])
8832 ;; Move up to 8 bytes at a time.
8833 (define_expand "movmemsi_2reg"
8834 [(parallel [(set (match_operand 0 "" "")
8835 (match_operand 1 "" ""))
8836 (use (match_operand 2 "" ""))
8837 (use (match_operand 3 "" ""))
8838 (clobber (match_scratch:DI 4 ""))
8839 (clobber (match_scratch:SI 5 ""))])]
8840 "TARGET_STRING && ! TARGET_POWERPC64"
8844 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
8845 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
8846 (use (match_operand:SI 2 "immediate_operand" "i"))
8847 (use (match_operand:SI 3 "immediate_operand" "i"))
8848 (clobber (match_scratch:DI 4 "=&r"))
8849 (clobber (match_scratch:SI 5 "=q"))]
8850 "TARGET_STRING && TARGET_POWER && ! TARGET_POWERPC64
8851 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
8852 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
8853 [(set_attr "type" "load")
8854 (set_attr "length" "8")])
8857 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
8858 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
8859 (use (match_operand:SI 2 "immediate_operand" "i"))
8860 (use (match_operand:SI 3 "immediate_operand" "i"))
8861 (clobber (match_scratch:DI 4 "=&r"))
8862 (clobber (match_scratch:SI 5 "X"))]
8863 "TARGET_STRING && ! TARGET_POWER && ! TARGET_POWERPC64
8864 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
8865 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
8866 [(set_attr "type" "load")
8867 (set_attr "length" "8")])
8869 ;; Move up to 4 bytes at a time.
8870 (define_expand "movmemsi_1reg"
8871 [(parallel [(set (match_operand 0 "" "")
8872 (match_operand 1 "" ""))
8873 (use (match_operand 2 "" ""))
8874 (use (match_operand 3 "" ""))
8875 (clobber (match_scratch:SI 4 ""))
8876 (clobber (match_scratch:SI 5 ""))])]
8881 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
8882 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
8883 (use (match_operand:SI 2 "immediate_operand" "i"))
8884 (use (match_operand:SI 3 "immediate_operand" "i"))
8885 (clobber (match_scratch:SI 4 "=&r"))
8886 (clobber (match_scratch:SI 5 "=q"))]
8887 "TARGET_STRING && TARGET_POWER
8888 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
8889 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
8890 [(set_attr "type" "load")
8891 (set_attr "length" "8")])
8894 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
8895 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
8896 (use (match_operand:SI 2 "immediate_operand" "i"))
8897 (use (match_operand:SI 3 "immediate_operand" "i"))
8898 (clobber (match_scratch:SI 4 "=&r"))
8899 (clobber (match_scratch:SI 5 "X"))]
8900 "TARGET_STRING && ! TARGET_POWER
8901 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
8902 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
8903 [(set_attr "type" "load")
8904 (set_attr "length" "8")])
8906 ;; Define insns that do load or store with update. Some of these we can
8907 ;; get by using pre-decrement or pre-increment, but the hardware can also
8908 ;; do cases where the increment is not the size of the object.
8910 ;; In all these cases, we use operands 0 and 1 for the register being
8911 ;; incremented because those are the operands that local-alloc will
8912 ;; tie and these are the pair most likely to be tieable (and the ones
8913 ;; that will benefit the most).
8915 (define_insn "*movdi_update1"
8916 [(set (match_operand:DI 3 "gpc_reg_operand" "=r,r")
8917 (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
8918 (match_operand:DI 2 "reg_or_aligned_short_operand" "r,I"))))
8919 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
8920 (plus:DI (match_dup 1) (match_dup 2)))]
8921 "TARGET_POWERPC64 && TARGET_UPDATE"
8925 [(set_attr "type" "load_ux,load_u")])
8927 (define_insn "movdi_<mode>_update"
8928 [(set (mem:DI (plus:P (match_operand:P 1 "gpc_reg_operand" "0,0")
8929 (match_operand:P 2 "reg_or_aligned_short_operand" "r,I")))
8930 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
8931 (set (match_operand:P 0 "gpc_reg_operand" "=b,b")
8932 (plus:P (match_dup 1) (match_dup 2)))]
8933 "TARGET_POWERPC64 && TARGET_UPDATE"
8937 [(set_attr "type" "store_ux,store_u")])
8939 (define_insn "*movsi_update1"
8940 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
8941 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
8942 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
8943 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
8944 (plus:SI (match_dup 1) (match_dup 2)))]
8947 {lux|lwzux} %3,%0,%2
8948 {lu|lwzu} %3,%2(%0)"
8949 [(set_attr "type" "load_ux,load_u")])
8951 (define_insn "*movsi_update2"
8952 [(set (match_operand:DI 3 "gpc_reg_operand" "=r")
8954 (mem:SI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0")
8955 (match_operand:DI 2 "gpc_reg_operand" "r")))))
8956 (set (match_operand:DI 0 "gpc_reg_operand" "=b")
8957 (plus:DI (match_dup 1) (match_dup 2)))]
8960 [(set_attr "type" "load_ext_ux")])
8962 (define_insn "movsi_update"
8963 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
8964 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
8965 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
8966 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
8967 (plus:SI (match_dup 1) (match_dup 2)))]
8970 {stux|stwux} %3,%0,%2
8971 {stu|stwu} %3,%2(%0)"
8972 [(set_attr "type" "store_ux,store_u")])
8974 (define_insn "*movhi_update1"
8975 [(set (match_operand:HI 3 "gpc_reg_operand" "=r,r")
8976 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
8977 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
8978 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
8979 (plus:SI (match_dup 1) (match_dup 2)))]
8984 [(set_attr "type" "load_ux,load_u")])
8986 (define_insn "*movhi_update2"
8987 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
8989 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
8990 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
8991 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
8992 (plus:SI (match_dup 1) (match_dup 2)))]
8997 [(set_attr "type" "load_ux,load_u")])
8999 (define_insn "*movhi_update3"
9000 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9002 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9003 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9004 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9005 (plus:SI (match_dup 1) (match_dup 2)))]
9010 [(set_attr "type" "load_ext_ux,load_ext_u")])
9012 (define_insn "*movhi_update4"
9013 [(set (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9014 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9015 (match_operand:HI 3 "gpc_reg_operand" "r,r"))
9016 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9017 (plus:SI (match_dup 1) (match_dup 2)))]
9022 [(set_attr "type" "store_ux,store_u")])
9024 (define_insn "*movqi_update1"
9025 [(set (match_operand:QI 3 "gpc_reg_operand" "=r,r")
9026 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9027 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9028 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9029 (plus:SI (match_dup 1) (match_dup 2)))]
9034 [(set_attr "type" "load_ux,load_u")])
9036 (define_insn "*movqi_update2"
9037 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9039 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9040 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9041 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9042 (plus:SI (match_dup 1) (match_dup 2)))]
9047 [(set_attr "type" "load_ux,load_u")])
9049 (define_insn "*movqi_update3"
9050 [(set (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9051 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9052 (match_operand:QI 3 "gpc_reg_operand" "r,r"))
9053 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9054 (plus:SI (match_dup 1) (match_dup 2)))]
9059 [(set_attr "type" "store_ux,store_u")])
9061 (define_insn "*movsf_update1"
9062 [(set (match_operand:SF 3 "gpc_reg_operand" "=f,f")
9063 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9064 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9065 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9066 (plus:SI (match_dup 1) (match_dup 2)))]
9067 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9071 [(set_attr "type" "fpload_ux,fpload_u")])
9073 (define_insn "*movsf_update2"
9074 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9075 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9076 (match_operand:SF 3 "gpc_reg_operand" "f,f"))
9077 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9078 (plus:SI (match_dup 1) (match_dup 2)))]
9079 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9083 [(set_attr "type" "fpstore_ux,fpstore_u")])
9085 (define_insn "*movsf_update3"
9086 [(set (match_operand:SF 3 "gpc_reg_operand" "=r,r")
9087 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9088 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9089 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9090 (plus:SI (match_dup 1) (match_dup 2)))]
9091 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE"
9093 {lux|lwzux} %3,%0,%2
9094 {lu|lwzu} %3,%2(%0)"
9095 [(set_attr "type" "load_ux,load_u")])
9097 (define_insn "*movsf_update4"
9098 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9099 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9100 (match_operand:SF 3 "gpc_reg_operand" "r,r"))
9101 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9102 (plus:SI (match_dup 1) (match_dup 2)))]
9103 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE"
9105 {stux|stwux} %3,%0,%2
9106 {stu|stwu} %3,%2(%0)"
9107 [(set_attr "type" "store_ux,store_u")])
9109 (define_insn "*movdf_update1"
9110 [(set (match_operand:DF 3 "gpc_reg_operand" "=f,f")
9111 (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9112 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9113 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9114 (plus:SI (match_dup 1) (match_dup 2)))]
9115 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9119 [(set_attr "type" "fpload_ux,fpload_u")])
9121 (define_insn "*movdf_update2"
9122 [(set (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9123 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9124 (match_operand:DF 3 "gpc_reg_operand" "f,f"))
9125 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9126 (plus:SI (match_dup 1) (match_dup 2)))]
9127 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9131 [(set_attr "type" "fpstore_ux,fpstore_u")])
9133 ;; Peephole to convert two consecutive FP loads or stores into lfq/stfq.
9135 (define_insn "*lfq_power2"
9136 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
9137 (match_operand:TF 1 "memory_operand" ""))]
9139 && TARGET_HARD_FLOAT && TARGET_FPRS"
9143 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9144 (match_operand:DF 1 "memory_operand" ""))
9145 (set (match_operand:DF 2 "gpc_reg_operand" "")
9146 (match_operand:DF 3 "memory_operand" ""))]
9148 && TARGET_HARD_FLOAT && TARGET_FPRS
9149 && registers_ok_for_quad_peep (operands[0], operands[2])
9150 && mems_ok_for_quad_peep (operands[1], operands[3])"
9153 "operands[1] = widen_memory_access (operands[1], TFmode, 0);
9154 operands[0] = gen_rtx_REG (TFmode, REGNO (operands[0]));")
9156 (define_insn "*stfq_power2"
9157 [(set (match_operand:TF 0 "memory_operand" "")
9158 (match_operand:TF 1 "gpc_reg_operand" "f"))]
9160 && TARGET_HARD_FLOAT && TARGET_FPRS"
9165 [(set (match_operand:DF 0 "memory_operand" "")
9166 (match_operand:DF 1 "gpc_reg_operand" ""))
9167 (set (match_operand:DF 2 "memory_operand" "")
9168 (match_operand:DF 3 "gpc_reg_operand" ""))]
9170 && TARGET_HARD_FLOAT && TARGET_FPRS
9171 && registers_ok_for_quad_peep (operands[1], operands[3])
9172 && mems_ok_for_quad_peep (operands[0], operands[2])"
9175 "operands[0] = widen_memory_access (operands[0], TFmode, 0);
9176 operands[1] = gen_rtx_REG (TFmode, REGNO (operands[1]));")
9178 ;; after inserting conditional returns we can sometimes have
9179 ;; unnecessary register moves. Unfortunately we cannot have a
9180 ;; modeless peephole here, because some single SImode sets have early
9181 ;; clobber outputs. Although those sets expand to multi-ppc-insn
9182 ;; sequences, using get_attr_length here will smash the operands
9183 ;; array. Neither is there an early_cobbler_p predicate.
9185 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9186 (match_operand:DF 1 "any_operand" ""))
9187 (set (match_operand:DF 2 "gpc_reg_operand" "")
9189 "peep2_reg_dead_p (2, operands[0])"
9190 [(set (match_dup 2) (match_dup 1))])
9193 [(set (match_operand:SF 0 "gpc_reg_operand" "")
9194 (match_operand:SF 1 "any_operand" ""))
9195 (set (match_operand:SF 2 "gpc_reg_operand" "")
9197 "peep2_reg_dead_p (2, operands[0])"
9198 [(set (match_dup 2) (match_dup 1))])
9203 ;; "b" output constraint here and on tls_ld to support tls linker optimization.
9204 (define_insn "tls_gd_32"
9205 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
9206 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9207 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9209 "HAVE_AS_TLS && !TARGET_64BIT"
9210 "addi %0,%1,%2@got@tlsgd")
9212 (define_insn "tls_gd_64"
9213 [(set (match_operand:DI 0 "gpc_reg_operand" "=b")
9214 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9215 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9217 "HAVE_AS_TLS && TARGET_64BIT"
9218 "addi %0,%1,%2@got@tlsgd")
9220 (define_insn "tls_ld_32"
9221 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
9222 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")]
9224 "HAVE_AS_TLS && !TARGET_64BIT"
9225 "addi %0,%1,%&@got@tlsld")
9227 (define_insn "tls_ld_64"
9228 [(set (match_operand:DI 0 "gpc_reg_operand" "=b")
9229 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")]
9231 "HAVE_AS_TLS && TARGET_64BIT"
9232 "addi %0,%1,%&@got@tlsld")
9234 (define_insn "tls_dtprel_32"
9235 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9236 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9237 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9239 "HAVE_AS_TLS && !TARGET_64BIT"
9240 "addi %0,%1,%2@dtprel")
9242 (define_insn "tls_dtprel_64"
9243 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9244 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9245 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9247 "HAVE_AS_TLS && TARGET_64BIT"
9248 "addi %0,%1,%2@dtprel")
9250 (define_insn "tls_dtprel_ha_32"
9251 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9252 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9253 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9254 UNSPEC_TLSDTPRELHA))]
9255 "HAVE_AS_TLS && !TARGET_64BIT"
9256 "addis %0,%1,%2@dtprel@ha")
9258 (define_insn "tls_dtprel_ha_64"
9259 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9260 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9261 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9262 UNSPEC_TLSDTPRELHA))]
9263 "HAVE_AS_TLS && TARGET_64BIT"
9264 "addis %0,%1,%2@dtprel@ha")
9266 (define_insn "tls_dtprel_lo_32"
9267 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9268 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9269 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9270 UNSPEC_TLSDTPRELLO))]
9271 "HAVE_AS_TLS && !TARGET_64BIT"
9272 "addi %0,%1,%2@dtprel@l")
9274 (define_insn "tls_dtprel_lo_64"
9275 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9276 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9277 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9278 UNSPEC_TLSDTPRELLO))]
9279 "HAVE_AS_TLS && TARGET_64BIT"
9280 "addi %0,%1,%2@dtprel@l")
9282 (define_insn "tls_got_dtprel_32"
9283 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9284 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9285 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9286 UNSPEC_TLSGOTDTPREL))]
9287 "HAVE_AS_TLS && !TARGET_64BIT"
9288 "lwz %0,%2@got@dtprel(%1)")
9290 (define_insn "tls_got_dtprel_64"
9291 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9292 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9293 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9294 UNSPEC_TLSGOTDTPREL))]
9295 "HAVE_AS_TLS && TARGET_64BIT"
9296 "ld %0,%2@got@dtprel(%1)")
9298 (define_insn "tls_tprel_32"
9299 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9300 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9301 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9303 "HAVE_AS_TLS && !TARGET_64BIT"
9304 "addi %0,%1,%2@tprel")
9306 (define_insn "tls_tprel_64"
9307 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9308 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9309 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9311 "HAVE_AS_TLS && TARGET_64BIT"
9312 "addi %0,%1,%2@tprel")
9314 (define_insn "tls_tprel_ha_32"
9315 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9316 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9317 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9318 UNSPEC_TLSTPRELHA))]
9319 "HAVE_AS_TLS && !TARGET_64BIT"
9320 "addis %0,%1,%2@tprel@ha")
9322 (define_insn "tls_tprel_ha_64"
9323 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9324 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9325 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9326 UNSPEC_TLSTPRELHA))]
9327 "HAVE_AS_TLS && TARGET_64BIT"
9328 "addis %0,%1,%2@tprel@ha")
9330 (define_insn "tls_tprel_lo_32"
9331 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9332 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9333 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9334 UNSPEC_TLSTPRELLO))]
9335 "HAVE_AS_TLS && !TARGET_64BIT"
9336 "addi %0,%1,%2@tprel@l")
9338 (define_insn "tls_tprel_lo_64"
9339 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9340 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9341 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9342 UNSPEC_TLSTPRELLO))]
9343 "HAVE_AS_TLS && TARGET_64BIT"
9344 "addi %0,%1,%2@tprel@l")
9346 ;; "b" output constraint here and on tls_tls input to support linker tls
9347 ;; optimization. The linker may edit the instructions emitted by a
9348 ;; tls_got_tprel/tls_tls pair to addis,addi.
9349 (define_insn "tls_got_tprel_32"
9350 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
9351 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9352 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9353 UNSPEC_TLSGOTTPREL))]
9354 "HAVE_AS_TLS && !TARGET_64BIT"
9355 "lwz %0,%2@got@tprel(%1)")
9357 (define_insn "tls_got_tprel_64"
9358 [(set (match_operand:DI 0 "gpc_reg_operand" "=b")
9359 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9360 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9361 UNSPEC_TLSGOTTPREL))]
9362 "HAVE_AS_TLS && TARGET_64BIT"
9363 "ld %0,%2@got@tprel(%1)")
9365 (define_insn "tls_tls_32"
9366 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9367 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9368 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9370 "HAVE_AS_TLS && !TARGET_64BIT"
9373 (define_insn "tls_tls_64"
9374 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9375 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9376 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9378 "HAVE_AS_TLS && TARGET_64BIT"
9381 ;; Next come insns related to the calling sequence.
9383 ;; First, an insn to allocate new stack space for dynamic use (e.g., alloca).
9384 ;; We move the back-chain and decrement the stack pointer.
9386 (define_expand "allocate_stack"
9387 [(set (match_operand 0 "gpc_reg_operand" "=r")
9388 (minus (reg 1) (match_operand 1 "reg_or_short_operand" "")))
9390 (minus (reg 1) (match_dup 1)))]
9393 { rtx chain = gen_reg_rtx (Pmode);
9394 rtx stack_bot = gen_rtx_MEM (Pmode, stack_pointer_rtx);
9397 emit_move_insn (chain, stack_bot);
9399 /* Check stack bounds if necessary. */
9400 if (current_function_limit_stack)
9403 available = expand_binop (Pmode, sub_optab,
9404 stack_pointer_rtx, stack_limit_rtx,
9405 NULL_RTX, 1, OPTAB_WIDEN);
9406 emit_insn (gen_cond_trap (LTU, available, operands[1], const0_rtx));
9409 if (GET_CODE (operands[1]) != CONST_INT
9410 || INTVAL (operands[1]) < -32767
9411 || INTVAL (operands[1]) > 32768)
9413 neg_op0 = gen_reg_rtx (Pmode);
9415 emit_insn (gen_negsi2 (neg_op0, operands[1]));
9417 emit_insn (gen_negdi2 (neg_op0, operands[1]));
9420 neg_op0 = GEN_INT (- INTVAL (operands[1]));
9423 emit_insn ((* ((TARGET_32BIT) ? gen_movsi_update : gen_movdi_di_update))
9424 (stack_pointer_rtx, stack_pointer_rtx, neg_op0, chain));
9428 emit_insn ((* ((TARGET_32BIT) ? gen_addsi3 : gen_adddi3))
9429 (stack_pointer_rtx, stack_pointer_rtx, neg_op0));
9430 emit_move_insn (gen_rtx_MEM (Pmode, stack_pointer_rtx), chain);
9433 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
9437 ;; These patterns say how to save and restore the stack pointer. We need not
9438 ;; save the stack pointer at function level since we are careful to
9439 ;; preserve the backchain. At block level, we have to restore the backchain
9440 ;; when we restore the stack pointer.
9442 ;; For nonlocal gotos, we must save both the stack pointer and its
9443 ;; backchain and restore both. Note that in the nonlocal case, the
9444 ;; save area is a memory location.
9446 (define_expand "save_stack_function"
9447 [(match_operand 0 "any_operand" "")
9448 (match_operand 1 "any_operand" "")]
9452 (define_expand "restore_stack_function"
9453 [(match_operand 0 "any_operand" "")
9454 (match_operand 1 "any_operand" "")]
9458 (define_expand "restore_stack_block"
9459 [(use (match_operand 0 "register_operand" ""))
9460 (set (match_dup 2) (match_dup 3))
9461 (set (match_dup 0) (match_operand 1 "register_operand" ""))
9462 (set (match_dup 3) (match_dup 2))]
9466 operands[2] = gen_reg_rtx (Pmode);
9467 operands[3] = gen_rtx_MEM (Pmode, operands[0]);
9470 (define_expand "save_stack_nonlocal"
9471 [(match_operand 0 "memory_operand" "")
9472 (match_operand 1 "register_operand" "")]
9476 rtx temp = gen_reg_rtx (Pmode);
9477 int units_per_word = (TARGET_32BIT) ? 4 : 8;
9479 /* Copy the backchain to the first word, sp to the second. */
9480 emit_move_insn (temp, gen_rtx_MEM (Pmode, operands[1]));
9481 emit_move_insn (adjust_address_nv (operands[0], Pmode, 0), temp);
9482 emit_move_insn (adjust_address_nv (operands[0], Pmode, units_per_word),
9487 (define_expand "restore_stack_nonlocal"
9488 [(match_operand 0 "register_operand" "")
9489 (match_operand 1 "memory_operand" "")]
9493 rtx temp = gen_reg_rtx (Pmode);
9494 int units_per_word = (TARGET_32BIT) ? 4 : 8;
9496 /* Restore the backchain from the first word, sp from the second. */
9497 emit_move_insn (temp,
9498 adjust_address_nv (operands[1], Pmode, 0));
9499 emit_move_insn (operands[0],
9500 adjust_address_nv (operands[1], Pmode, units_per_word));
9501 emit_move_insn (gen_rtx_MEM (Pmode, operands[0]), temp);
9505 ;; TOC register handling.
9507 ;; Code to initialize the TOC register...
9509 (define_insn "load_toc_aix_si"
9510 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9511 (unspec:SI [(const_int 0)] UNSPEC_TOC))
9513 "DEFAULT_ABI == ABI_AIX && TARGET_32BIT"
9517 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
9518 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
9519 operands[2] = gen_rtx_REG (Pmode, 2);
9520 return \"{l|lwz} %0,%1(%2)\";
9522 [(set_attr "type" "load")])
9524 (define_insn "load_toc_aix_di"
9525 [(parallel [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9526 (unspec:DI [(const_int 0)] UNSPEC_TOC))
9528 "DEFAULT_ABI == ABI_AIX && TARGET_64BIT"
9532 #ifdef TARGET_RELOCATABLE
9533 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\",
9534 !TARGET_MINIMAL_TOC || TARGET_RELOCATABLE);
9536 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
9539 strcat (buf, \"@toc\");
9540 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
9541 operands[2] = gen_rtx_REG (Pmode, 2);
9542 return \"ld %0,%1(%2)\";
9544 [(set_attr "type" "load")])
9546 (define_insn "load_toc_v4_pic_si"
9547 [(set (match_operand:SI 0 "register_operand" "=l")
9548 (unspec:SI [(const_int 0)] UNSPEC_TOC))]
9549 "DEFAULT_ABI == ABI_V4 && flag_pic == 1 && TARGET_32BIT"
9550 "bl _GLOBAL_OFFSET_TABLE_@local-4"
9551 [(set_attr "type" "branch")
9552 (set_attr "length" "4")])
9554 (define_insn "load_toc_v4_PIC_1"
9555 [(set (match_operand:SI 0 "register_operand" "=l")
9556 (match_operand:SI 1 "immediate_operand" "s"))
9557 (use (unspec [(match_dup 1)] UNSPEC_TOC))]
9558 "TARGET_ELF && DEFAULT_ABI != ABI_AIX
9559 && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
9560 "bcl 20,31,%1\\n%1:"
9561 [(set_attr "type" "branch")
9562 (set_attr "length" "4")])
9564 (define_insn "load_toc_v4_PIC_1b"
9565 [(set (match_operand:SI 0 "register_operand" "=l")
9566 (unspec:SI [(match_operand:SI 1 "immediate_operand" "s")]
9568 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
9569 "bcl 20,31,$+8\\n\\t.long %1-$"
9570 [(set_attr "type" "branch")
9571 (set_attr "length" "8")])
9573 (define_insn "load_toc_v4_PIC_2"
9574 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9575 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
9576 (minus:SI (match_operand:SI 2 "immediate_operand" "s")
9577 (match_operand:SI 3 "immediate_operand" "s")))))]
9578 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
9579 "{l|lwz} %0,%2-%3(%1)"
9580 [(set_attr "type" "load")])
9582 (define_insn "load_toc_v4_PIC_3b"
9583 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
9584 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "r")
9586 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
9587 (match_operand:SI 3 "symbol_ref_operand" "s")))))]
9588 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
9589 "{cau|addis} %0,%1,%2-%3@ha")
9591 (define_insn "load_toc_v4_PIC_3c"
9592 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9593 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
9594 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
9595 (match_operand:SI 3 "symbol_ref_operand" "s"))))]
9596 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
9597 "{cal|addi} %0,%1,%2-%3@l")
9599 ;; If the TOC is shared over a translation unit, as happens with all
9600 ;; the kinds of PIC that we support, we need to restore the TOC
9601 ;; pointer only when jumping over units of translation.
9602 ;; On Darwin, we need to reload the picbase.
9604 (define_expand "builtin_setjmp_receiver"
9605 [(use (label_ref (match_operand 0 "" "")))]
9606 "(DEFAULT_ABI == ABI_V4 && flag_pic == 1)
9607 || (TARGET_TOC && TARGET_MINIMAL_TOC)
9608 || (DEFAULT_ABI == ABI_DARWIN && flag_pic)"
9612 if (DEFAULT_ABI == ABI_DARWIN)
9614 const char *picbase = machopic_function_base_name ();
9615 rtx picrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (picbase));
9616 rtx picreg = gen_rtx_REG (Pmode, RS6000_PIC_OFFSET_TABLE_REGNUM);
9620 ASM_GENERATE_INTERNAL_LABEL(tmplab, \"LSJR\",
9621 CODE_LABEL_NUMBER (operands[0]));
9622 tmplabrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (tmplab));
9624 emit_insn (gen_load_macho_picbase (picreg, tmplabrtx));
9625 emit_insn (gen_macho_correct_pic (picreg, picreg, picrtx, tmplabrtx));
9629 rs6000_emit_load_toc_table (FALSE);
9633 ;; Elf specific ways of loading addresses for non-PIC code.
9634 ;; The output of this could be r0, but we make a very strong
9635 ;; preference for a base register because it will usually
9637 (define_insn "elf_high"
9638 [(set (match_operand:SI 0 "gpc_reg_operand" "=b*r")
9639 (high:SI (match_operand 1 "" "")))]
9640 "TARGET_ELF && ! TARGET_64BIT"
9641 "{liu|lis} %0,%1@ha")
9643 (define_insn "elf_low"
9644 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
9645 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,!*r")
9646 (match_operand 2 "" "")))]
9647 "TARGET_ELF && ! TARGET_64BIT"
9649 {cal|la} %0,%2@l(%1)
9650 {ai|addic} %0,%1,%K2")
9652 ;; A function pointer under AIX is a pointer to a data area whose first word
9653 ;; contains the actual address of the function, whose second word contains a
9654 ;; pointer to its TOC, and whose third word contains a value to place in the
9655 ;; static chain register (r11). Note that if we load the static chain, our
9656 ;; "trampoline" need not have any executable code.
9658 (define_expand "call_indirect_aix32"
9660 (mem:SI (match_operand:SI 0 "gpc_reg_operand" "")))
9661 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
9664 (mem:SI (plus:SI (match_dup 0)
9667 (mem:SI (plus:SI (match_dup 0)
9669 (parallel [(call (mem:SI (match_dup 2))
9670 (match_operand 1 "" ""))
9674 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
9675 (clobber (scratch:SI))])]
9678 { operands[2] = gen_reg_rtx (SImode); }")
9680 (define_expand "call_indirect_aix64"
9682 (mem:DI (match_operand:DI 0 "gpc_reg_operand" "")))
9683 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
9686 (mem:DI (plus:DI (match_dup 0)
9689 (mem:DI (plus:DI (match_dup 0)
9691 (parallel [(call (mem:SI (match_dup 2))
9692 (match_operand 1 "" ""))
9696 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
9697 (clobber (scratch:SI))])]
9700 { operands[2] = gen_reg_rtx (DImode); }")
9702 (define_expand "call_value_indirect_aix32"
9704 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "")))
9705 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
9708 (mem:SI (plus:SI (match_dup 1)
9711 (mem:SI (plus:SI (match_dup 1)
9713 (parallel [(set (match_operand 0 "" "")
9714 (call (mem:SI (match_dup 3))
9715 (match_operand 2 "" "")))
9719 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
9720 (clobber (scratch:SI))])]
9723 { operands[3] = gen_reg_rtx (SImode); }")
9725 (define_expand "call_value_indirect_aix64"
9727 (mem:DI (match_operand:DI 1 "gpc_reg_operand" "")))
9728 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
9731 (mem:DI (plus:DI (match_dup 1)
9734 (mem:DI (plus:DI (match_dup 1)
9736 (parallel [(set (match_operand 0 "" "")
9737 (call (mem:SI (match_dup 3))
9738 (match_operand 2 "" "")))
9742 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
9743 (clobber (scratch:SI))])]
9746 { operands[3] = gen_reg_rtx (DImode); }")
9748 ;; Now the definitions for the call and call_value insns
9749 (define_expand "call"
9750 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
9751 (match_operand 1 "" ""))
9752 (use (match_operand 2 "" ""))
9753 (clobber (scratch:SI))])]
9758 if (MACHOPIC_INDIRECT)
9759 operands[0] = machopic_indirect_call_target (operands[0]);
9762 gcc_assert (GET_CODE (operands[0]) == MEM);
9763 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
9765 operands[0] = XEXP (operands[0], 0);
9767 if (DEFAULT_ABI == ABI_V4 && TARGET_SECURE_PLT
9769 && GET_CODE (operands[0]) == SYMBOL_REF
9770 && !SYMBOL_REF_LOCAL_P (operands[0]))
9776 gen_rtx_CALL (VOIDmode,
9777 gen_rtx_MEM (SImode, operands[0]),
9779 gen_rtx_USE (VOIDmode, operands[2]),
9780 gen_rtx_CLOBBER (VOIDmode, gen_rtx_SCRATCH (SImode)));
9781 call = emit_call_insn (gen_rtx_PARALLEL (VOIDmode, tmp));
9782 use_reg (&CALL_INSN_FUNCTION_USAGE (call), pic_offset_table_rtx);
9786 if (GET_CODE (operands[0]) != SYMBOL_REF
9787 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[0]))
9788 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[2]) & CALL_LONG) != 0))
9790 if (INTVAL (operands[2]) & CALL_LONG)
9791 operands[0] = rs6000_longcall_ref (operands[0]);
9793 switch (DEFAULT_ABI)
9797 operands[0] = force_reg (Pmode, operands[0]);
9801 /* AIX function pointers are really pointers to a three word
9803 emit_call_insn (TARGET_32BIT
9804 ? gen_call_indirect_aix32 (force_reg (SImode,
9807 : gen_call_indirect_aix64 (force_reg (DImode,
9818 (define_expand "call_value"
9819 [(parallel [(set (match_operand 0 "" "")
9820 (call (mem:SI (match_operand 1 "address_operand" ""))
9821 (match_operand 2 "" "")))
9822 (use (match_operand 3 "" ""))
9823 (clobber (scratch:SI))])]
9828 if (MACHOPIC_INDIRECT)
9829 operands[1] = machopic_indirect_call_target (operands[1]);
9832 gcc_assert (GET_CODE (operands[1]) == MEM);
9833 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
9835 operands[1] = XEXP (operands[1], 0);
9837 if (DEFAULT_ABI == ABI_V4 && TARGET_SECURE_PLT
9839 && GET_CODE (operands[1]) == SYMBOL_REF
9840 && !SYMBOL_REF_LOCAL_P (operands[1]))
9846 gen_rtx_SET (VOIDmode,
9848 gen_rtx_CALL (VOIDmode,
9849 gen_rtx_MEM (SImode,
9852 gen_rtx_USE (VOIDmode, operands[3]),
9853 gen_rtx_CLOBBER (VOIDmode, gen_rtx_SCRATCH (SImode)));
9854 call = emit_call_insn (gen_rtx_PARALLEL (VOIDmode, tmp));
9855 use_reg (&CALL_INSN_FUNCTION_USAGE (call), pic_offset_table_rtx);
9859 if (GET_CODE (operands[1]) != SYMBOL_REF
9860 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[1]))
9861 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[3]) & CALL_LONG) != 0))
9863 if (INTVAL (operands[3]) & CALL_LONG)
9864 operands[1] = rs6000_longcall_ref (operands[1]);
9866 switch (DEFAULT_ABI)
9870 operands[1] = force_reg (Pmode, operands[1]);
9874 /* AIX function pointers are really pointers to a three word
9876 emit_call_insn (TARGET_32BIT
9877 ? gen_call_value_indirect_aix32 (operands[0],
9881 : gen_call_value_indirect_aix64 (operands[0],
9893 ;; Call to function in current module. No TOC pointer reload needed.
9894 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
9895 ;; either the function was not prototyped, or it was prototyped as a
9896 ;; variable argument function. It is > 0 if FP registers were passed
9897 ;; and < 0 if they were not.
9899 (define_insn "*call_local32"
9900 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
9901 (match_operand 1 "" "g,g"))
9902 (use (match_operand:SI 2 "immediate_operand" "O,n"))
9903 (clobber (match_scratch:SI 3 "=l,l"))]
9904 "(INTVAL (operands[2]) & CALL_LONG) == 0"
9907 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
9908 output_asm_insn (\"crxor 6,6,6\", operands);
9910 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
9911 output_asm_insn (\"creqv 6,6,6\", operands);
9913 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
9915 [(set_attr "type" "branch")
9916 (set_attr "length" "4,8")])
9918 (define_insn "*call_local64"
9919 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
9920 (match_operand 1 "" "g,g"))
9921 (use (match_operand:SI 2 "immediate_operand" "O,n"))
9922 (clobber (match_scratch:SI 3 "=l,l"))]
9923 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
9926 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
9927 output_asm_insn (\"crxor 6,6,6\", operands);
9929 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
9930 output_asm_insn (\"creqv 6,6,6\", operands);
9932 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
9934 [(set_attr "type" "branch")
9935 (set_attr "length" "4,8")])
9937 (define_insn "*call_value_local32"
9938 [(set (match_operand 0 "" "")
9939 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
9940 (match_operand 2 "" "g,g")))
9941 (use (match_operand:SI 3 "immediate_operand" "O,n"))
9942 (clobber (match_scratch:SI 4 "=l,l"))]
9943 "(INTVAL (operands[3]) & CALL_LONG) == 0"
9946 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
9947 output_asm_insn (\"crxor 6,6,6\", operands);
9949 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
9950 output_asm_insn (\"creqv 6,6,6\", operands);
9952 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
9954 [(set_attr "type" "branch")
9955 (set_attr "length" "4,8")])
9958 (define_insn "*call_value_local64"
9959 [(set (match_operand 0 "" "")
9960 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
9961 (match_operand 2 "" "g,g")))
9962 (use (match_operand:SI 3 "immediate_operand" "O,n"))
9963 (clobber (match_scratch:SI 4 "=l,l"))]
9964 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
9967 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
9968 output_asm_insn (\"crxor 6,6,6\", operands);
9970 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
9971 output_asm_insn (\"creqv 6,6,6\", operands);
9973 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
9975 [(set_attr "type" "branch")
9976 (set_attr "length" "4,8")])
9978 ;; Call to function which may be in another module. Restore the TOC
9979 ;; pointer (r2) after the call unless this is System V.
9980 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
9981 ;; either the function was not prototyped, or it was prototyped as a
9982 ;; variable argument function. It is > 0 if FP registers were passed
9983 ;; and < 0 if they were not.
9985 (define_insn "*call_indirect_nonlocal_aix32"
9986 [(call (mem:SI (match_operand:SI 0 "register_operand" "c,*l"))
9987 (match_operand 1 "" "g,g"))
9991 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
9992 (clobber (match_scratch:SI 2 "=l,l"))]
9993 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
9994 "b%T0l\;{l|lwz} 2,20(1)"
9995 [(set_attr "type" "jmpreg")
9996 (set_attr "length" "8")])
9998 (define_insn "*call_nonlocal_aix32"
9999 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
10000 (match_operand 1 "" "g"))
10001 (use (match_operand:SI 2 "immediate_operand" "O"))
10002 (clobber (match_scratch:SI 3 "=l"))]
10004 && DEFAULT_ABI == ABI_AIX
10005 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10007 [(set_attr "type" "branch")
10008 (set_attr "length" "8")])
10010 (define_insn "*call_indirect_nonlocal_aix64"
10011 [(call (mem:SI (match_operand:DI 0 "register_operand" "c,*l"))
10012 (match_operand 1 "" "g,g"))
10016 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10017 (clobber (match_scratch:SI 2 "=l,l"))]
10018 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
10019 "b%T0l\;ld 2,40(1)"
10020 [(set_attr "type" "jmpreg")
10021 (set_attr "length" "8")])
10023 (define_insn "*call_nonlocal_aix64"
10024 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
10025 (match_operand 1 "" "g"))
10026 (use (match_operand:SI 2 "immediate_operand" "O"))
10027 (clobber (match_scratch:SI 3 "=l"))]
10029 && DEFAULT_ABI == ABI_AIX
10030 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10032 [(set_attr "type" "branch")
10033 (set_attr "length" "8")])
10035 (define_insn "*call_value_indirect_nonlocal_aix32"
10036 [(set (match_operand 0 "" "")
10037 (call (mem:SI (match_operand:SI 1 "register_operand" "c,*l"))
10038 (match_operand 2 "" "g,g")))
10042 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10043 (clobber (match_scratch:SI 3 "=l,l"))]
10044 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
10045 "b%T1l\;{l|lwz} 2,20(1)"
10046 [(set_attr "type" "jmpreg")
10047 (set_attr "length" "8")])
10049 (define_insn "*call_value_nonlocal_aix32"
10050 [(set (match_operand 0 "" "")
10051 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
10052 (match_operand 2 "" "g")))
10053 (use (match_operand:SI 3 "immediate_operand" "O"))
10054 (clobber (match_scratch:SI 4 "=l"))]
10056 && DEFAULT_ABI == ABI_AIX
10057 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10059 [(set_attr "type" "branch")
10060 (set_attr "length" "8")])
10062 (define_insn "*call_value_indirect_nonlocal_aix64"
10063 [(set (match_operand 0 "" "")
10064 (call (mem:SI (match_operand:DI 1 "register_operand" "c,*l"))
10065 (match_operand 2 "" "g,g")))
10069 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10070 (clobber (match_scratch:SI 3 "=l,l"))]
10071 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
10072 "b%T1l\;ld 2,40(1)"
10073 [(set_attr "type" "jmpreg")
10074 (set_attr "length" "8")])
10076 (define_insn "*call_value_nonlocal_aix64"
10077 [(set (match_operand 0 "" "")
10078 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
10079 (match_operand 2 "" "g")))
10080 (use (match_operand:SI 3 "immediate_operand" "O"))
10081 (clobber (match_scratch:SI 4 "=l"))]
10083 && DEFAULT_ABI == ABI_AIX
10084 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10086 [(set_attr "type" "branch")
10087 (set_attr "length" "8")])
10089 ;; A function pointer under System V is just a normal pointer
10090 ;; operands[0] is the function pointer
10091 ;; operands[1] is the stack size to clean up
10092 ;; operands[2] is the value FUNCTION_ARG returns for the VOID argument
10093 ;; which indicates how to set cr1
10095 (define_insn "*call_indirect_nonlocal_sysv"
10096 [(call (mem:SI (match_operand:SI 0 "register_operand" "c,*l,c,*l"))
10097 (match_operand 1 "" "g,g,g,g"))
10098 (use (match_operand:SI 2 "immediate_operand" "O,O,n,n"))
10099 (clobber (match_scratch:SI 3 "=l,l,l,l"))]
10100 "DEFAULT_ABI == ABI_V4
10101 || DEFAULT_ABI == ABI_DARWIN"
10103 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10104 output_asm_insn ("crxor 6,6,6", operands);
10106 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10107 output_asm_insn ("creqv 6,6,6", operands);
10111 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
10112 (set_attr "length" "4,4,8,8")])
10114 (define_insn "*call_nonlocal_sysv"
10115 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s,s"))
10116 (match_operand 1 "" "g,g"))
10117 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10118 (clobber (match_scratch:SI 3 "=l,l"))]
10119 "(DEFAULT_ABI == ABI_DARWIN
10120 || (DEFAULT_ABI == ABI_V4
10121 && (INTVAL (operands[2]) & CALL_LONG) == 0))"
10123 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10124 output_asm_insn ("crxor 6,6,6", operands);
10126 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10127 output_asm_insn ("creqv 6,6,6", operands);
10130 return output_call(insn, operands, 0, 2);
10132 if (DEFAULT_ABI == ABI_V4 && flag_pic)
10134 if (TARGET_SECURE_PLT && flag_pic == 2)
10135 /* The magic 32768 offset here and in the other sysv call insns
10136 corresponds to the offset of r30 in .got2, as given by LCTOC1.
10137 See sysv4.h:toc_section. */
10138 return "bl %z0+32768@plt";
10140 return "bl %z0@plt";
10146 [(set_attr "type" "branch,branch")
10147 (set_attr "length" "4,8")])
10149 (define_insn "*call_value_indirect_nonlocal_sysv"
10150 [(set (match_operand 0 "" "")
10151 (call (mem:SI (match_operand:SI 1 "register_operand" "c,*l,c,*l"))
10152 (match_operand 2 "" "g,g,g,g")))
10153 (use (match_operand:SI 3 "immediate_operand" "O,O,n,n"))
10154 (clobber (match_scratch:SI 4 "=l,l,l,l"))]
10155 "DEFAULT_ABI == ABI_V4
10156 || DEFAULT_ABI == ABI_DARWIN"
10158 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10159 output_asm_insn ("crxor 6,6,6", operands);
10161 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10162 output_asm_insn ("creqv 6,6,6", operands);
10166 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
10167 (set_attr "length" "4,4,8,8")])
10169 (define_insn "*call_value_nonlocal_sysv"
10170 [(set (match_operand 0 "" "")
10171 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s,s"))
10172 (match_operand 2 "" "g,g")))
10173 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10174 (clobber (match_scratch:SI 4 "=l,l"))]
10175 "(DEFAULT_ABI == ABI_DARWIN
10176 || (DEFAULT_ABI == ABI_V4
10177 && (INTVAL (operands[3]) & CALL_LONG) == 0))"
10179 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10180 output_asm_insn ("crxor 6,6,6", operands);
10182 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10183 output_asm_insn ("creqv 6,6,6", operands);
10186 return output_call(insn, operands, 1, 3);
10188 if (DEFAULT_ABI == ABI_V4 && flag_pic)
10190 if (TARGET_SECURE_PLT && flag_pic == 2)
10191 return "bl %z1+32768@plt";
10193 return "bl %z1@plt";
10199 [(set_attr "type" "branch,branch")
10200 (set_attr "length" "4,8")])
10202 ;; Call subroutine returning any type.
10203 (define_expand "untyped_call"
10204 [(parallel [(call (match_operand 0 "" "")
10206 (match_operand 1 "" "")
10207 (match_operand 2 "" "")])]
10213 emit_call_insn (GEN_CALL (operands[0], const0_rtx, const0_rtx, const0_rtx));
10215 for (i = 0; i < XVECLEN (operands[2], 0); i++)
10217 rtx set = XVECEXP (operands[2], 0, i);
10218 emit_move_insn (SET_DEST (set), SET_SRC (set));
10221 /* The optimizer does not know that the call sets the function value
10222 registers we stored in the result block. We avoid problems by
10223 claiming that all hard registers are used and clobbered at this
10225 emit_insn (gen_blockage ());
10230 ;; sibling call patterns
10231 (define_expand "sibcall"
10232 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
10233 (match_operand 1 "" ""))
10234 (use (match_operand 2 "" ""))
10235 (use (match_operand 3 "" ""))
10241 if (MACHOPIC_INDIRECT)
10242 operands[0] = machopic_indirect_call_target (operands[0]);
10245 gcc_assert (GET_CODE (operands[0]) == MEM);
10246 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
10248 operands[0] = XEXP (operands[0], 0);
10249 operands[3] = gen_reg_rtx (SImode);
10253 ;; this and similar patterns must be marked as using LR, otherwise
10254 ;; dataflow will try to delete the store into it. This is true
10255 ;; even when the actual reg to jump to is in CTR, when LR was
10256 ;; saved and restored around the PIC-setting BCL.
10257 (define_insn "*sibcall_local32"
10258 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
10259 (match_operand 1 "" "g,g"))
10260 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10261 (use (match_operand:SI 3 "register_operand" "l,l"))
10263 "(INTVAL (operands[2]) & CALL_LONG) == 0"
10266 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10267 output_asm_insn (\"crxor 6,6,6\", operands);
10269 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10270 output_asm_insn (\"creqv 6,6,6\", operands);
10272 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
10274 [(set_attr "type" "branch")
10275 (set_attr "length" "4,8")])
10277 (define_insn "*sibcall_local64"
10278 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
10279 (match_operand 1 "" "g,g"))
10280 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10281 (use (match_operand:SI 3 "register_operand" "l,l"))
10283 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
10286 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10287 output_asm_insn (\"crxor 6,6,6\", operands);
10289 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10290 output_asm_insn (\"creqv 6,6,6\", operands);
10292 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
10294 [(set_attr "type" "branch")
10295 (set_attr "length" "4,8")])
10297 (define_insn "*sibcall_value_local32"
10298 [(set (match_operand 0 "" "")
10299 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
10300 (match_operand 2 "" "g,g")))
10301 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10302 (use (match_operand:SI 4 "register_operand" "l,l"))
10304 "(INTVAL (operands[3]) & CALL_LONG) == 0"
10307 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10308 output_asm_insn (\"crxor 6,6,6\", operands);
10310 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10311 output_asm_insn (\"creqv 6,6,6\", operands);
10313 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
10315 [(set_attr "type" "branch")
10316 (set_attr "length" "4,8")])
10319 (define_insn "*sibcall_value_local64"
10320 [(set (match_operand 0 "" "")
10321 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
10322 (match_operand 2 "" "g,g")))
10323 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10324 (use (match_operand:SI 4 "register_operand" "l,l"))
10326 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
10329 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10330 output_asm_insn (\"crxor 6,6,6\", operands);
10332 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10333 output_asm_insn (\"creqv 6,6,6\", operands);
10335 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
10337 [(set_attr "type" "branch")
10338 (set_attr "length" "4,8")])
10340 (define_insn "*sibcall_nonlocal_aix32"
10341 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
10342 (match_operand 1 "" "g"))
10343 (use (match_operand:SI 2 "immediate_operand" "O"))
10344 (use (match_operand:SI 3 "register_operand" "l"))
10347 && DEFAULT_ABI == ABI_AIX
10348 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10350 [(set_attr "type" "branch")
10351 (set_attr "length" "4")])
10353 (define_insn "*sibcall_nonlocal_aix64"
10354 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
10355 (match_operand 1 "" "g"))
10356 (use (match_operand:SI 2 "immediate_operand" "O"))
10357 (use (match_operand:SI 3 "register_operand" "l"))
10360 && DEFAULT_ABI == ABI_AIX
10361 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10363 [(set_attr "type" "branch")
10364 (set_attr "length" "4")])
10366 (define_insn "*sibcall_value_nonlocal_aix32"
10367 [(set (match_operand 0 "" "")
10368 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
10369 (match_operand 2 "" "g")))
10370 (use (match_operand:SI 3 "immediate_operand" "O"))
10371 (use (match_operand:SI 4 "register_operand" "l"))
10374 && DEFAULT_ABI == ABI_AIX
10375 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10377 [(set_attr "type" "branch")
10378 (set_attr "length" "4")])
10380 (define_insn "*sibcall_value_nonlocal_aix64"
10381 [(set (match_operand 0 "" "")
10382 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
10383 (match_operand 2 "" "g")))
10384 (use (match_operand:SI 3 "immediate_operand" "O"))
10385 (use (match_operand:SI 4 "register_operand" "l"))
10388 && DEFAULT_ABI == ABI_AIX
10389 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10391 [(set_attr "type" "branch")
10392 (set_attr "length" "4")])
10394 (define_insn "*sibcall_nonlocal_sysv"
10395 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s,s"))
10396 (match_operand 1 "" ""))
10397 (use (match_operand 2 "immediate_operand" "O,n"))
10398 (use (match_operand:SI 3 "register_operand" "l,l"))
10400 "(DEFAULT_ABI == ABI_DARWIN
10401 || DEFAULT_ABI == ABI_V4)
10402 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10405 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10406 output_asm_insn (\"crxor 6,6,6\", operands);
10408 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10409 output_asm_insn (\"creqv 6,6,6\", operands);
10411 if (DEFAULT_ABI == ABI_V4 && flag_pic)
10413 if (TARGET_SECURE_PLT && flag_pic == 2)
10414 return \"b %z0+32768@plt\";
10416 return \"b %z0@plt\";
10421 [(set_attr "type" "branch,branch")
10422 (set_attr "length" "4,8")])
10424 (define_expand "sibcall_value"
10425 [(parallel [(set (match_operand 0 "register_operand" "")
10426 (call (mem:SI (match_operand 1 "address_operand" ""))
10427 (match_operand 2 "" "")))
10428 (use (match_operand 3 "" ""))
10429 (use (match_operand 4 "" ""))
10435 if (MACHOPIC_INDIRECT)
10436 operands[1] = machopic_indirect_call_target (operands[1]);
10439 gcc_assert (GET_CODE (operands[1]) == MEM);
10440 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
10442 operands[1] = XEXP (operands[1], 0);
10443 operands[4] = gen_reg_rtx (SImode);
10447 (define_insn "*sibcall_value_nonlocal_sysv"
10448 [(set (match_operand 0 "" "")
10449 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s,s"))
10450 (match_operand 2 "" "")))
10451 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10452 (use (match_operand:SI 4 "register_operand" "l,l"))
10454 "(DEFAULT_ABI == ABI_DARWIN
10455 || DEFAULT_ABI == ABI_V4)
10456 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10459 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10460 output_asm_insn (\"crxor 6,6,6\", operands);
10462 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10463 output_asm_insn (\"creqv 6,6,6\", operands);
10465 if (DEFAULT_ABI == ABI_V4 && flag_pic)
10467 if (TARGET_SECURE_PLT && flag_pic == 2)
10468 return \"b %z1+32768@plt\";
10470 return \"b %z1@plt\";
10475 [(set_attr "type" "branch,branch")
10476 (set_attr "length" "4,8")])
10478 (define_expand "sibcall_epilogue"
10479 [(use (const_int 0))]
10480 "TARGET_SCHED_PROLOG"
10483 rs6000_emit_epilogue (TRUE);
10487 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
10488 ;; all of memory. This blocks insns from being moved across this point.
10490 (define_insn "blockage"
10491 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCK)]
10495 ;; Compare insns are next. Note that the RS/6000 has two types of compares,
10496 ;; signed & unsigned, and one type of branch.
10498 ;; Start with the DEFINE_EXPANDs to generate the rtl for compares, scc
10499 ;; insns, and branches. We store the operands of compares until we see
10501 (define_expand "cmp<mode>"
10503 (compare (match_operand:GPR 0 "gpc_reg_operand" "")
10504 (match_operand:GPR 1 "reg_or_short_operand" "")))]
10508 /* Take care of the possibility that operands[1] might be negative but
10509 this might be a logical operation. That insn doesn't exist. */
10510 if (GET_CODE (operands[1]) == CONST_INT
10511 && INTVAL (operands[1]) < 0)
10512 operands[1] = force_reg (<MODE>mode, operands[1]);
10514 rs6000_compare_op0 = operands[0];
10515 rs6000_compare_op1 = operands[1];
10516 rs6000_compare_fp_p = 0;
10520 (define_expand "cmp<mode>"
10521 [(set (cc0) (compare (match_operand:FP 0 "gpc_reg_operand" "")
10522 (match_operand:FP 1 "gpc_reg_operand" "")))]
10526 rs6000_compare_op0 = operands[0];
10527 rs6000_compare_op1 = operands[1];
10528 rs6000_compare_fp_p = 1;
10532 (define_expand "beq"
10533 [(use (match_operand 0 "" ""))]
10535 "{ rs6000_emit_cbranch (EQ, operands[0]); DONE; }")
10537 (define_expand "bne"
10538 [(use (match_operand 0 "" ""))]
10540 "{ rs6000_emit_cbranch (NE, operands[0]); DONE; }")
10542 (define_expand "bge"
10543 [(use (match_operand 0 "" ""))]
10545 "{ rs6000_emit_cbranch (GE, operands[0]); DONE; }")
10547 (define_expand "bgt"
10548 [(use (match_operand 0 "" ""))]
10550 "{ rs6000_emit_cbranch (GT, operands[0]); DONE; }")
10552 (define_expand "ble"
10553 [(use (match_operand 0 "" ""))]
10555 "{ rs6000_emit_cbranch (LE, operands[0]); DONE; }")
10557 (define_expand "blt"
10558 [(use (match_operand 0 "" ""))]
10560 "{ rs6000_emit_cbranch (LT, operands[0]); DONE; }")
10562 (define_expand "bgeu"
10563 [(use (match_operand 0 "" ""))]
10565 "{ rs6000_emit_cbranch (GEU, operands[0]); DONE; }")
10567 (define_expand "bgtu"
10568 [(use (match_operand 0 "" ""))]
10570 "{ rs6000_emit_cbranch (GTU, operands[0]); DONE; }")
10572 (define_expand "bleu"
10573 [(use (match_operand 0 "" ""))]
10575 "{ rs6000_emit_cbranch (LEU, operands[0]); DONE; }")
10577 (define_expand "bltu"
10578 [(use (match_operand 0 "" ""))]
10580 "{ rs6000_emit_cbranch (LTU, operands[0]); DONE; }")
10582 (define_expand "bunordered"
10583 [(use (match_operand 0 "" ""))]
10584 "! (TARGET_HARD_FLOAT && TARGET_E500 && !TARGET_FPRS)"
10585 "{ rs6000_emit_cbranch (UNORDERED, operands[0]); DONE; }")
10587 (define_expand "bordered"
10588 [(use (match_operand 0 "" ""))]
10589 "! (TARGET_HARD_FLOAT && TARGET_E500 && !TARGET_FPRS)"
10590 "{ rs6000_emit_cbranch (ORDERED, operands[0]); DONE; }")
10592 (define_expand "buneq"
10593 [(use (match_operand 0 "" ""))]
10595 "{ rs6000_emit_cbranch (UNEQ, operands[0]); DONE; }")
10597 (define_expand "bunge"
10598 [(use (match_operand 0 "" ""))]
10600 "{ rs6000_emit_cbranch (UNGE, operands[0]); DONE; }")
10602 (define_expand "bungt"
10603 [(use (match_operand 0 "" ""))]
10605 "{ rs6000_emit_cbranch (UNGT, operands[0]); DONE; }")
10607 (define_expand "bunle"
10608 [(use (match_operand 0 "" ""))]
10610 "{ rs6000_emit_cbranch (UNLE, operands[0]); DONE; }")
10612 (define_expand "bunlt"
10613 [(use (match_operand 0 "" ""))]
10615 "{ rs6000_emit_cbranch (UNLT, operands[0]); DONE; }")
10617 (define_expand "bltgt"
10618 [(use (match_operand 0 "" ""))]
10620 "{ rs6000_emit_cbranch (LTGT, operands[0]); DONE; }")
10622 ;; For SNE, we would prefer that the xor/abs sequence be used for integers.
10623 ;; For SEQ, likewise, except that comparisons with zero should be done
10624 ;; with an scc insns. However, due to the order that combine see the
10625 ;; resulting insns, we must, in fact, allow SEQ for integers. Fail in
10626 ;; the cases we don't want to handle.
10627 (define_expand "seq"
10628 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10630 "{ rs6000_emit_sCOND (EQ, operands[0]); DONE; }")
10632 (define_expand "sne"
10633 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10637 if (! rs6000_compare_fp_p)
10640 rs6000_emit_sCOND (NE, operands[0]);
10644 ;; A >= 0 is best done the portable way for A an integer.
10645 (define_expand "sge"
10646 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10650 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
10653 rs6000_emit_sCOND (GE, operands[0]);
10657 ;; A > 0 is best done using the portable sequence, so fail in that case.
10658 (define_expand "sgt"
10659 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10663 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
10666 rs6000_emit_sCOND (GT, operands[0]);
10670 ;; A <= 0 is best done the portable way for A an integer.
10671 (define_expand "sle"
10672 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10676 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
10679 rs6000_emit_sCOND (LE, operands[0]);
10683 ;; A < 0 is best done in the portable way for A an integer.
10684 (define_expand "slt"
10685 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10689 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
10692 rs6000_emit_sCOND (LT, operands[0]);
10696 (define_expand "sgeu"
10697 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10699 "{ rs6000_emit_sCOND (GEU, operands[0]); DONE; }")
10701 (define_expand "sgtu"
10702 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10704 "{ rs6000_emit_sCOND (GTU, operands[0]); DONE; }")
10706 (define_expand "sleu"
10707 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10709 "{ rs6000_emit_sCOND (LEU, operands[0]); DONE; }")
10711 (define_expand "sltu"
10712 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10714 "{ rs6000_emit_sCOND (LTU, operands[0]); DONE; }")
10716 (define_expand "sunordered"
10717 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10718 "! (TARGET_HARD_FLOAT && TARGET_E500 && !TARGET_FPRS)"
10719 "{ rs6000_emit_sCOND (UNORDERED, operands[0]); DONE; }")
10721 (define_expand "sordered"
10722 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10723 "! (TARGET_HARD_FLOAT && TARGET_E500 && !TARGET_FPRS)"
10724 "{ rs6000_emit_sCOND (ORDERED, operands[0]); DONE; }")
10726 (define_expand "suneq"
10727 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10729 "{ rs6000_emit_sCOND (UNEQ, operands[0]); DONE; }")
10731 (define_expand "sunge"
10732 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10734 "{ rs6000_emit_sCOND (UNGE, operands[0]); DONE; }")
10736 (define_expand "sungt"
10737 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10739 "{ rs6000_emit_sCOND (UNGT, operands[0]); DONE; }")
10741 (define_expand "sunle"
10742 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10744 "{ rs6000_emit_sCOND (UNLE, operands[0]); DONE; }")
10746 (define_expand "sunlt"
10747 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10749 "{ rs6000_emit_sCOND (UNLT, operands[0]); DONE; }")
10751 (define_expand "sltgt"
10752 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10754 "{ rs6000_emit_sCOND (LTGT, operands[0]); DONE; }")
10757 ;; Here are the actual compare insns.
10758 (define_insn "*cmp<mode>_internal1"
10759 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
10760 (compare:CC (match_operand:GPR 1 "gpc_reg_operand" "r")
10761 (match_operand:GPR 2 "reg_or_short_operand" "rI")))]
10763 "{cmp%I2|cmp<wd>%I2} %0,%1,%2"
10764 [(set_attr "type" "cmp")])
10766 ;; If we are comparing a register for equality with a large constant,
10767 ;; we can do this with an XOR followed by a compare. But we need a scratch
10768 ;; register for the result of the XOR.
10771 [(set (match_operand:CC 0 "cc_reg_operand" "")
10772 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
10773 (match_operand:SI 2 "non_short_cint_operand" "")))
10774 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
10775 "find_single_use (operands[0], insn, 0)
10776 && (GET_CODE (*find_single_use (operands[0], insn, 0)) == EQ
10777 || GET_CODE (*find_single_use (operands[0], insn, 0)) == NE)"
10778 [(set (match_dup 3) (xor:SI (match_dup 1) (match_dup 4)))
10779 (set (match_dup 0) (compare:CC (match_dup 3) (match_dup 5)))]
10782 /* Get the constant we are comparing against, C, and see what it looks like
10783 sign-extended to 16 bits. Then see what constant could be XOR'ed
10784 with C to get the sign-extended value. */
10786 HOST_WIDE_INT c = INTVAL (operands[2]);
10787 HOST_WIDE_INT sextc = ((c & 0xffff) ^ 0x8000) - 0x8000;
10788 HOST_WIDE_INT xorv = c ^ sextc;
10790 operands[4] = GEN_INT (xorv);
10791 operands[5] = GEN_INT (sextc);
10794 (define_insn "*cmpsi_internal2"
10795 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
10796 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
10797 (match_operand:SI 2 "reg_or_u_short_operand" "rK")))]
10799 "{cmpl%I2|cmplw%I2} %0,%1,%b2"
10800 [(set_attr "type" "cmp")])
10802 (define_insn "*cmpdi_internal2"
10803 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
10804 (compare:CCUNS (match_operand:DI 1 "gpc_reg_operand" "r")
10805 (match_operand:DI 2 "reg_or_u_short_operand" "rK")))]
10807 "cmpld%I2 %0,%1,%b2"
10808 [(set_attr "type" "cmp")])
10810 ;; The following two insns don't exist as single insns, but if we provide
10811 ;; them, we can swap an add and compare, which will enable us to overlap more
10812 ;; of the required delay between a compare and branch. We generate code for
10813 ;; them by splitting.
10816 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
10817 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
10818 (match_operand:SI 2 "short_cint_operand" "i")))
10819 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
10820 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
10823 [(set_attr "length" "8")])
10826 [(set (match_operand:CCUNS 3 "cc_reg_operand" "=y")
10827 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
10828 (match_operand:SI 2 "u_short_cint_operand" "i")))
10829 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
10830 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
10833 [(set_attr "length" "8")])
10836 [(set (match_operand:CC 3 "cc_reg_operand" "")
10837 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
10838 (match_operand:SI 2 "short_cint_operand" "")))
10839 (set (match_operand:SI 0 "gpc_reg_operand" "")
10840 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
10842 [(set (match_dup 3) (compare:CC (match_dup 1) (match_dup 2)))
10843 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
10846 [(set (match_operand:CCUNS 3 "cc_reg_operand" "")
10847 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "")
10848 (match_operand:SI 2 "u_short_cint_operand" "")))
10849 (set (match_operand:SI 0 "gpc_reg_operand" "")
10850 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
10852 [(set (match_dup 3) (compare:CCUNS (match_dup 1) (match_dup 2)))
10853 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
10855 (define_insn "*cmpsf_internal1"
10856 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
10857 (compare:CCFP (match_operand:SF 1 "gpc_reg_operand" "f")
10858 (match_operand:SF 2 "gpc_reg_operand" "f")))]
10859 "TARGET_HARD_FLOAT && TARGET_FPRS"
10861 [(set_attr "type" "fpcompare")])
10863 (define_insn "*cmpdf_internal1"
10864 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
10865 (compare:CCFP (match_operand:DF 1 "gpc_reg_operand" "f")
10866 (match_operand:DF 2 "gpc_reg_operand" "f")))]
10867 "TARGET_HARD_FLOAT && TARGET_FPRS"
10869 [(set_attr "type" "fpcompare")])
10871 ;; Only need to compare second words if first words equal
10872 (define_insn "*cmptf_internal1"
10873 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
10874 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "f")
10875 (match_operand:TF 2 "gpc_reg_operand" "f")))]
10876 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN) && !TARGET_XL_COMPAT
10877 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
10878 "fcmpu %0,%1,%2\;bne %0,$+8\;fcmpu %0,%L1,%L2"
10879 [(set_attr "type" "fpcompare")
10880 (set_attr "length" "12")])
10882 (define_insn_and_split "*cmptf_internal2"
10883 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
10884 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "f")
10885 (match_operand:TF 2 "gpc_reg_operand" "f")))
10886 (clobber (match_scratch:DF 3 "=f"))
10887 (clobber (match_scratch:DF 4 "=f"))
10888 (clobber (match_scratch:DF 5 "=f"))
10889 (clobber (match_scratch:DF 6 "=f"))
10890 (clobber (match_scratch:DF 7 "=f"))
10891 (clobber (match_scratch:DF 8 "=f"))
10892 (clobber (match_scratch:DF 9 "=f"))
10893 (clobber (match_scratch:DF 10 "=f"))]
10894 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN) && TARGET_XL_COMPAT
10895 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
10897 "&& reload_completed"
10898 [(set (match_dup 3) (match_dup 13))
10899 (set (match_dup 4) (match_dup 14))
10900 (set (match_dup 9) (abs:DF (match_dup 5)))
10901 (set (match_dup 0) (compare:CCFP (match_dup 9) (match_dup 3)))
10902 (set (pc) (if_then_else (ne (match_dup 0) (const_int 0))
10903 (label_ref (match_dup 11))
10905 (set (match_dup 0) (compare:CCFP (match_dup 5) (match_dup 7)))
10906 (set (pc) (label_ref (match_dup 12)))
10908 (set (match_dup 10) (minus:DF (match_dup 5) (match_dup 7)))
10909 (set (match_dup 9) (minus:DF (match_dup 6) (match_dup 8)))
10910 (set (match_dup 9) (plus:DF (match_dup 10) (match_dup 9)))
10911 (set (match_dup 0) (compare:CCFP (match_dup 7) (match_dup 4)))
10914 REAL_VALUE_TYPE rv;
10915 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
10916 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
10918 operands[5] = simplify_gen_subreg (DFmode, operands[1], TFmode, hi_word);
10919 operands[6] = simplify_gen_subreg (DFmode, operands[1], TFmode, lo_word);
10920 operands[7] = simplify_gen_subreg (DFmode, operands[2], TFmode, hi_word);
10921 operands[8] = simplify_gen_subreg (DFmode, operands[2], TFmode, lo_word);
10922 operands[11] = gen_label_rtx ();
10923 operands[12] = gen_label_rtx ();
10925 operands[13] = force_const_mem (DFmode,
10926 CONST_DOUBLE_FROM_REAL_VALUE (rv, DFmode));
10927 operands[14] = force_const_mem (DFmode,
10928 CONST_DOUBLE_FROM_REAL_VALUE (dconst0,
10932 operands[13] = gen_const_mem (DFmode,
10933 create_TOC_reference (XEXP (operands[13], 0)));
10934 operands[14] = gen_const_mem (DFmode,
10935 create_TOC_reference (XEXP (operands[14], 0)));
10936 set_mem_alias_set (operands[13], get_TOC_alias_set ());
10937 set_mem_alias_set (operands[14], get_TOC_alias_set ());
10941 ;; Now we have the scc insns. We can do some combinations because of the
10942 ;; way the machine works.
10944 ;; Note that this is probably faster if we can put an insn between the
10945 ;; mfcr and rlinm, but this is tricky. Let's leave it for now. In most
10946 ;; cases the insns below which don't use an intermediate CR field will
10947 ;; be used instead.
10949 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10950 (match_operator:SI 1 "scc_comparison_operator"
10951 [(match_operand 2 "cc_reg_operand" "y")
10954 "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1"
10955 [(set (attr "type")
10956 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
10957 (const_string "mfcrf")
10959 (const_string "mfcr")))
10960 (set_attr "length" "8")])
10962 ;; Same as above, but get the GT bit.
10963 (define_insn "move_from_CR_gt_bit"
10964 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10965 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_GT))]
10967 "mfcr %0\;{rlinm|rlwinm} %0,%0,%D1,31,31"
10968 [(set_attr "type" "mfcr")
10969 (set_attr "length" "8")])
10971 ;; Same as above, but get the OV/ORDERED bit.
10972 (define_insn "move_from_CR_ov_bit"
10973 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10974 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_OV))]
10976 "mfcr %0\;{rlinm|rlwinm} %0,%0,%t1,1"
10977 [(set_attr "type" "mfcr")
10978 (set_attr "length" "8")])
10981 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10982 (match_operator:DI 1 "scc_comparison_operator"
10983 [(match_operand 2 "cc_reg_operand" "y")
10986 "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1"
10987 [(set (attr "type")
10988 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
10989 (const_string "mfcrf")
10991 (const_string "mfcr")))
10992 (set_attr "length" "8")])
10995 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
10996 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
10997 [(match_operand 2 "cc_reg_operand" "y,y")
11000 (set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
11001 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
11004 mfcr %3%Q2\;{rlinm.|rlwinm.} %3,%3,%J1,1
11006 [(set_attr "type" "delayed_compare")
11007 (set_attr "length" "8,16")])
11010 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11011 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
11012 [(match_operand 2 "cc_reg_operand" "")
11015 (set (match_operand:SI 3 "gpc_reg_operand" "")
11016 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
11017 "TARGET_32BIT && reload_completed"
11018 [(set (match_dup 3)
11019 (match_op_dup 1 [(match_dup 2) (const_int 0)]))
11021 (compare:CC (match_dup 3)
11026 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11027 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
11028 [(match_operand 2 "cc_reg_operand" "y")
11030 (match_operand:SI 3 "const_int_operand" "n")))]
11034 int is_bit = ccr_bit (operands[1], 1);
11035 int put_bit = 31 - (INTVAL (operands[3]) & 31);
11038 if (is_bit >= put_bit)
11039 count = is_bit - put_bit;
11041 count = 32 - (put_bit - is_bit);
11043 operands[4] = GEN_INT (count);
11044 operands[5] = GEN_INT (put_bit);
11046 return \"mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%4,%5,%5\";
11048 [(set (attr "type")
11049 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
11050 (const_string "mfcrf")
11052 (const_string "mfcr")))
11053 (set_attr "length" "8")])
11056 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11058 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
11059 [(match_operand 2 "cc_reg_operand" "y,y")
11061 (match_operand:SI 3 "const_int_operand" "n,n"))
11063 (set (match_operand:SI 4 "gpc_reg_operand" "=r,r")
11064 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
11069 int is_bit = ccr_bit (operands[1], 1);
11070 int put_bit = 31 - (INTVAL (operands[3]) & 31);
11073 /* Force split for non-cc0 compare. */
11074 if (which_alternative == 1)
11077 if (is_bit >= put_bit)
11078 count = is_bit - put_bit;
11080 count = 32 - (put_bit - is_bit);
11082 operands[5] = GEN_INT (count);
11083 operands[6] = GEN_INT (put_bit);
11085 return \"mfcr %4%Q2\;{rlinm.|rlwinm.} %4,%4,%5,%6,%6\";
11087 [(set_attr "type" "delayed_compare")
11088 (set_attr "length" "8,16")])
11091 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11093 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
11094 [(match_operand 2 "cc_reg_operand" "")
11096 (match_operand:SI 3 "const_int_operand" ""))
11098 (set (match_operand:SI 4 "gpc_reg_operand" "")
11099 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
11102 [(set (match_dup 4)
11103 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
11106 (compare:CC (match_dup 4)
11110 ;; There is a 3 cycle delay between consecutive mfcr instructions
11111 ;; so it is useful to combine 2 scc instructions to use only one mfcr.
11114 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11115 (match_operator:SI 1 "scc_comparison_operator"
11116 [(match_operand 2 "cc_reg_operand" "y")
11118 (set (match_operand:SI 3 "gpc_reg_operand" "=r")
11119 (match_operator:SI 4 "scc_comparison_operator"
11120 [(match_operand 5 "cc_reg_operand" "y")
11122 "REGNO (operands[2]) != REGNO (operands[5])"
11123 "mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
11124 [(set_attr "type" "mfcr")
11125 (set_attr "length" "12")])
11128 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11129 (match_operator:DI 1 "scc_comparison_operator"
11130 [(match_operand 2 "cc_reg_operand" "y")
11132 (set (match_operand:DI 3 "gpc_reg_operand" "=r")
11133 (match_operator:DI 4 "scc_comparison_operator"
11134 [(match_operand 5 "cc_reg_operand" "y")
11136 "TARGET_POWERPC64 && REGNO (operands[2]) != REGNO (operands[5])"
11137 "mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
11138 [(set_attr "type" "mfcr")
11139 (set_attr "length" "12")])
11141 ;; There are some scc insns that can be done directly, without a compare.
11142 ;; These are faster because they don't involve the communications between
11143 ;; the FXU and branch units. In fact, we will be replacing all of the
11144 ;; integer scc insns here or in the portable methods in emit_store_flag.
11146 ;; Also support (neg (scc ..)) since that construct is used to replace
11147 ;; branches, (plus (scc ..) ..) since that construct is common and
11148 ;; takes no more insns than scc, and (and (neg (scc ..)) ..) in the
11149 ;; cases where it is no more expensive than (neg (scc ..)).
11151 ;; Have reload force a constant into a register for the simple insns that
11152 ;; otherwise won't accept constants. We do this because it is faster than
11153 ;; the cmp/mfcr sequence we would otherwise generate.
11155 (define_mode_attr scc_eq_op2 [(SI "rKLI")
11158 (define_insn_and_split "*eq<mode>"
11159 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
11160 (eq:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
11161 (match_operand:GPR 2 "scc_eq_operand" "<scc_eq_op2>")))
11162 (clobber (match_scratch:GPR 3 "=r"))
11163 (clobber (match_scratch:GPR 4 "=r"))]
11167 [(set (match_dup 3)
11168 (clz:GPR (match_dup 4)))
11170 (lshiftrt:GPR (match_dup 3) (match_dup 5)))]
11172 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
11174 if (logical_operand (operands[2], <MODE>mode))
11175 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
11176 gen_rtx_XOR (<MODE>mode,
11177 operands[1], operands[2])));
11179 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
11180 gen_rtx_PLUS (<MODE>mode, operands[1],
11181 negate_rtx (<MODE>mode,
11185 operands[4] = operands[1];
11187 operands[5] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
11190 (define_insn_and_split "*eq<mode>_compare"
11191 [(set (match_operand:CC 5 "cc_reg_operand" "=y")
11193 (eq:P (match_operand:P 1 "gpc_reg_operand" "=r")
11194 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))
11196 (set (match_operand:P 0 "gpc_reg_operand" "=r")
11197 (eq:P (match_dup 1) (match_dup 2)))
11198 (clobber (match_scratch:P 3 "=r"))
11199 (clobber (match_scratch:P 4 "=r"))]
11203 [(set (match_dup 3)
11204 (clz:P (match_dup 4)))
11205 (parallel [(set (match_dup 5)
11206 (compare:CC (lshiftrt:P (match_dup 3) (match_dup 6))
11209 (lshiftrt:P (match_dup 3) (match_dup 6)))])]
11211 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
11213 if (logical_operand (operands[2], <MODE>mode))
11214 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
11215 gen_rtx_XOR (<MODE>mode,
11216 operands[1], operands[2])));
11218 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
11219 gen_rtx_PLUS (<MODE>mode, operands[1],
11220 negate_rtx (<MODE>mode,
11224 operands[4] = operands[1];
11226 operands[6] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
11229 ;; We have insns of the form shown by the first define_insn below. If
11230 ;; there is something inside the comparison operation, we must split it.
11232 [(set (match_operand:SI 0 "gpc_reg_operand" "")
11233 (plus:SI (match_operator 1 "comparison_operator"
11234 [(match_operand:SI 2 "" "")
11235 (match_operand:SI 3
11236 "reg_or_cint_operand" "")])
11237 (match_operand:SI 4 "gpc_reg_operand" "")))
11238 (clobber (match_operand:SI 5 "register_operand" ""))]
11239 "! gpc_reg_operand (operands[2], SImode)"
11240 [(set (match_dup 5) (match_dup 2))
11241 (set (match_dup 2) (plus:SI (match_op_dup 1 [(match_dup 2) (match_dup 3)])
11245 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r")
11246 (plus:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
11247 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I"))
11248 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r")))]
11251 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
11252 {sfi|subfic} %0,%1,0\;{aze|addze} %0,%3
11253 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
11254 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
11255 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
11256 [(set_attr "type" "three,two,three,three,three")
11257 (set_attr "length" "12,8,12,12,12")])
11260 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
11263 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
11264 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
11265 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
11267 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r"))]
11270 xor %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11271 {sfi|subfic} %4,%1,0\;{aze.|addze.} %4,%3
11272 {xoril|xori} %4,%1,%b2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11273 {xoriu|xoris} %4,%1,%u2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11274 {sfi|subfic} %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11280 [(set_attr "type" "compare")
11281 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
11284 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11287 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
11288 (match_operand:SI 2 "scc_eq_operand" ""))
11289 (match_operand:SI 3 "gpc_reg_operand" ""))
11291 (clobber (match_scratch:SI 4 ""))]
11292 "TARGET_32BIT && reload_completed"
11293 [(set (match_dup 4)
11294 (plus:SI (eq:SI (match_dup 1)
11298 (compare:CC (match_dup 4)
11303 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
11306 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
11307 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
11308 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
11310 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r")
11311 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
11314 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11315 {sfi|subfic} %0,%1,0\;{aze.|addze.} %0,%3
11316 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11317 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11318 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11324 [(set_attr "type" "compare")
11325 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
11328 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11331 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
11332 (match_operand:SI 2 "scc_eq_operand" ""))
11333 (match_operand:SI 3 "gpc_reg_operand" ""))
11335 (set (match_operand:SI 0 "gpc_reg_operand" "")
11336 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
11337 "TARGET_32BIT && reload_completed"
11338 [(set (match_dup 0)
11339 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
11341 (compare:CC (match_dup 0)
11346 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
11347 (neg:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
11348 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I"))))]
11351 xor %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
11352 {ai|addic} %0,%1,-1\;{sfe|subfe} %0,%0,%0
11353 {xoril|xori} %0,%1,%b2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
11354 {xoriu|xoris} %0,%1,%u2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
11355 {sfi|subfic} %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
11356 [(set_attr "type" "three,two,three,three,three")
11357 (set_attr "length" "12,8,12,12,12")])
11359 ;; Simplify (ne X (const_int 0)) on the PowerPC. No need to on the Power,
11360 ;; since it nabs/sr is just as fast.
11361 (define_insn "*ne0"
11362 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
11363 (lshiftrt:SI (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
11365 (clobber (match_scratch:SI 2 "=&r"))]
11366 "! TARGET_POWER && TARGET_32BIT && !TARGET_ISEL"
11367 "{ai|addic} %2,%1,-1\;{sfe|subfe} %0,%2,%1"
11368 [(set_attr "type" "two")
11369 (set_attr "length" "8")])
11372 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11373 (lshiftrt:DI (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
11375 (clobber (match_scratch:DI 2 "=&r"))]
11377 "addic %2,%1,-1\;subfe %0,%2,%1"
11378 [(set_attr "type" "two")
11379 (set_attr "length" "8")])
11381 ;; This is what (plus (ne X (const_int 0)) Y) looks like.
11383 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11384 (plus:SI (lshiftrt:SI
11385 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
11387 (match_operand:SI 2 "gpc_reg_operand" "r")))
11388 (clobber (match_scratch:SI 3 "=&r"))]
11390 "{ai|addic} %3,%1,-1\;{aze|addze} %0,%2"
11391 [(set_attr "type" "two")
11392 (set_attr "length" "8")])
11395 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11396 (plus:DI (lshiftrt:DI
11397 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
11399 (match_operand:DI 2 "gpc_reg_operand" "r")))
11400 (clobber (match_scratch:DI 3 "=&r"))]
11402 "addic %3,%1,-1\;addze %0,%2"
11403 [(set_attr "type" "two")
11404 (set_attr "length" "8")])
11407 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11409 (plus:SI (lshiftrt:SI
11410 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
11412 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
11414 (clobber (match_scratch:SI 3 "=&r,&r"))
11415 (clobber (match_scratch:SI 4 "=X,&r"))]
11418 {ai|addic} %3,%1,-1\;{aze.|addze.} %3,%2
11420 [(set_attr "type" "compare")
11421 (set_attr "length" "8,12")])
11424 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11426 (plus:SI (lshiftrt:SI
11427 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
11429 (match_operand:SI 2 "gpc_reg_operand" ""))
11431 (clobber (match_scratch:SI 3 ""))
11432 (clobber (match_scratch:SI 4 ""))]
11433 "TARGET_32BIT && reload_completed"
11434 [(parallel [(set (match_dup 3)
11435 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1)))
11438 (clobber (match_dup 4))])
11440 (compare:CC (match_dup 3)
11445 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11447 (plus:DI (lshiftrt:DI
11448 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
11450 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
11452 (clobber (match_scratch:DI 3 "=&r,&r"))]
11455 addic %3,%1,-1\;addze. %3,%2
11457 [(set_attr "type" "compare")
11458 (set_attr "length" "8,12")])
11461 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11463 (plus:DI (lshiftrt:DI
11464 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
11466 (match_operand:DI 2 "gpc_reg_operand" ""))
11468 (clobber (match_scratch:DI 3 ""))]
11469 "TARGET_64BIT && reload_completed"
11470 [(set (match_dup 3)
11471 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1)))
11475 (compare:CC (match_dup 3)
11480 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
11482 (plus:SI (lshiftrt:SI
11483 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
11485 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
11487 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11488 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
11490 (clobber (match_scratch:SI 3 "=&r,&r"))]
11493 {ai|addic} %3,%1,-1\;{aze.|addze.} %0,%2
11495 [(set_attr "type" "compare")
11496 (set_attr "length" "8,12")])
11499 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11501 (plus:SI (lshiftrt:SI
11502 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
11504 (match_operand:SI 2 "gpc_reg_operand" ""))
11506 (set (match_operand:SI 0 "gpc_reg_operand" "")
11507 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
11509 (clobber (match_scratch:SI 3 ""))]
11510 "TARGET_32BIT && reload_completed"
11511 [(parallel [(set (match_dup 0)
11512 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
11514 (clobber (match_dup 3))])
11516 (compare:CC (match_dup 0)
11521 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
11523 (plus:DI (lshiftrt:DI
11524 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
11526 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
11528 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
11529 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
11531 (clobber (match_scratch:DI 3 "=&r,&r"))]
11534 addic %3,%1,-1\;addze. %0,%2
11536 [(set_attr "type" "compare")
11537 (set_attr "length" "8,12")])
11540 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11542 (plus:DI (lshiftrt:DI
11543 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
11545 (match_operand:DI 2 "gpc_reg_operand" ""))
11547 (set (match_operand:DI 0 "gpc_reg_operand" "")
11548 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
11550 (clobber (match_scratch:DI 3 ""))]
11551 "TARGET_64BIT && reload_completed"
11552 [(parallel [(set (match_dup 0)
11553 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
11555 (clobber (match_dup 3))])
11557 (compare:CC (match_dup 0)
11562 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11563 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11564 (match_operand:SI 2 "reg_or_short_operand" "r,O")))
11565 (clobber (match_scratch:SI 3 "=r,X"))]
11568 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3
11569 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri|srwi} %0,%0,31"
11570 [(set_attr "length" "12")])
11573 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
11575 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
11576 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
11578 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
11579 (le:SI (match_dup 1) (match_dup 2)))
11580 (clobber (match_scratch:SI 3 "=r,X,r,X"))]
11583 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
11584 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri.|srwi.} %0,%0,31
11587 [(set_attr "type" "compare,delayed_compare,compare,delayed_compare")
11588 (set_attr "length" "12,12,16,16")])
11591 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11593 (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
11594 (match_operand:SI 2 "reg_or_short_operand" ""))
11596 (set (match_operand:SI 0 "gpc_reg_operand" "")
11597 (le:SI (match_dup 1) (match_dup 2)))
11598 (clobber (match_scratch:SI 3 ""))]
11599 "TARGET_POWER && reload_completed"
11600 [(parallel [(set (match_dup 0)
11601 (le:SI (match_dup 1) (match_dup 2)))
11602 (clobber (match_dup 3))])
11604 (compare:CC (match_dup 0)
11609 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
11610 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11611 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
11612 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
11615 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
11616 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze|addze} %0,%3"
11617 [(set_attr "length" "12")])
11620 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
11622 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
11623 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
11624 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
11626 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
11629 doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11630 {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze.|addze.} %4,%3
11633 [(set_attr "type" "compare")
11634 (set_attr "length" "12,12,16,16")])
11637 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11639 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
11640 (match_operand:SI 2 "reg_or_short_operand" ""))
11641 (match_operand:SI 3 "gpc_reg_operand" ""))
11643 (clobber (match_scratch:SI 4 ""))]
11644 "TARGET_POWER && reload_completed"
11645 [(set (match_dup 4)
11646 (plus:SI (le:SI (match_dup 1) (match_dup 2))
11649 (compare:CC (match_dup 4)
11654 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
11656 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
11657 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
11658 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
11660 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
11661 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
11664 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11665 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze.|addze.} %0,%3
11668 [(set_attr "type" "compare")
11669 (set_attr "length" "12,12,16,16")])
11672 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11674 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
11675 (match_operand:SI 2 "reg_or_short_operand" ""))
11676 (match_operand:SI 3 "gpc_reg_operand" ""))
11678 (set (match_operand:SI 0 "gpc_reg_operand" "")
11679 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
11680 "TARGET_POWER && reload_completed"
11681 [(set (match_dup 0)
11682 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
11684 (compare:CC (match_dup 0)
11689 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11690 (neg:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11691 (match_operand:SI 2 "reg_or_short_operand" "r,O"))))]
11694 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
11695 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{srai|srawi} %0,%0,31"
11696 [(set_attr "length" "12")])
11699 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11700 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
11701 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
11703 "{sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
11704 [(set_attr "type" "three")
11705 (set_attr "length" "12")])
11708 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11709 (leu:DI (match_operand:DI 1 "gpc_reg_operand" "r")
11710 (match_operand:DI 2 "reg_or_short_operand" "rI")))]
11712 "subf%I2c %0,%1,%2\;li %0,0\;adde %0,%0,%0"
11713 [(set_attr "type" "three")
11714 (set_attr "length" "12")])
11717 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
11719 (leu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
11720 (match_operand:DI 2 "reg_or_short_operand" "rI,rI"))
11722 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
11723 (leu:DI (match_dup 1) (match_dup 2)))]
11726 subf%I2c %0,%1,%2\;li %0,0\;adde. %0,%0,%0
11728 [(set_attr "type" "compare")
11729 (set_attr "length" "12,16")])
11732 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
11734 (leu:DI (match_operand:DI 1 "gpc_reg_operand" "")
11735 (match_operand:DI 2 "reg_or_short_operand" ""))
11737 (set (match_operand:DI 0 "gpc_reg_operand" "")
11738 (leu:DI (match_dup 1) (match_dup 2)))]
11739 "TARGET_64BIT && reload_completed"
11740 [(set (match_dup 0)
11741 (leu:DI (match_dup 1) (match_dup 2)))
11743 (compare:CC (match_dup 0)
11748 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
11750 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11751 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
11753 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11754 (leu:SI (match_dup 1) (match_dup 2)))]
11757 {sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
11759 [(set_attr "type" "compare")
11760 (set_attr "length" "12,16")])
11763 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
11765 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
11766 (match_operand:SI 2 "reg_or_short_operand" ""))
11768 (set (match_operand:SI 0 "gpc_reg_operand" "")
11769 (leu:SI (match_dup 1) (match_dup 2)))]
11770 "TARGET_32BIT && reload_completed"
11771 [(set (match_dup 0)
11772 (leu:SI (match_dup 1) (match_dup 2)))
11774 (compare:CC (match_dup 0)
11779 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
11780 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
11781 (match_operand:SI 2 "reg_or_short_operand" "rI"))
11782 (match_operand:SI 3 "gpc_reg_operand" "r")))]
11784 "{sf%I2|subf%I2c} %0,%1,%2\;{aze|addze} %0,%3"
11785 [(set_attr "type" "two")
11786 (set_attr "length" "8")])
11789 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11791 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11792 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
11793 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
11795 (clobber (match_scratch:SI 4 "=&r,&r"))]
11798 {sf%I2|subf%I2c} %4,%1,%2\;{aze.|addze.} %4,%3
11800 [(set_attr "type" "compare")
11801 (set_attr "length" "8,12")])
11804 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11806 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
11807 (match_operand:SI 2 "reg_or_short_operand" ""))
11808 (match_operand:SI 3 "gpc_reg_operand" ""))
11810 (clobber (match_scratch:SI 4 ""))]
11811 "TARGET_32BIT && reload_completed"
11812 [(set (match_dup 4)
11813 (plus:SI (leu:SI (match_dup 1) (match_dup 2))
11816 (compare:CC (match_dup 4)
11821 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
11823 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11824 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
11825 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
11827 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
11828 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
11831 {sf%I2|subf%I2c} %0,%1,%2\;{aze.|addze.} %0,%3
11833 [(set_attr "type" "compare")
11834 (set_attr "length" "8,12")])
11837 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11839 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
11840 (match_operand:SI 2 "reg_or_short_operand" ""))
11841 (match_operand:SI 3 "gpc_reg_operand" ""))
11843 (set (match_operand:SI 0 "gpc_reg_operand" "")
11844 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
11845 "TARGET_32BIT && reload_completed"
11846 [(set (match_dup 0)
11847 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
11849 (compare:CC (match_dup 0)
11854 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11855 (neg:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
11856 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
11858 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0"
11859 [(set_attr "type" "three")
11860 (set_attr "length" "12")])
11863 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
11865 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
11866 (match_operand:SI 2 "reg_or_short_operand" "rI")))
11867 (match_operand:SI 3 "gpc_reg_operand" "r")))]
11869 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
11870 [(set_attr "type" "three")
11871 (set_attr "length" "12")])
11874 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11877 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11878 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
11879 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
11881 (clobber (match_scratch:SI 4 "=&r,&r"))]
11884 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
11886 [(set_attr "type" "compare")
11887 (set_attr "length" "12,16")])
11890 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11893 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
11894 (match_operand:SI 2 "reg_or_short_operand" "")))
11895 (match_operand:SI 3 "gpc_reg_operand" ""))
11897 (clobber (match_scratch:SI 4 ""))]
11898 "TARGET_32BIT && reload_completed"
11899 [(set (match_dup 4)
11900 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
11903 (compare:CC (match_dup 4)
11908 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
11911 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11912 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
11913 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
11915 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
11916 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
11919 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
11921 [(set_attr "type" "compare")
11922 (set_attr "length" "12,16")])
11925 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11928 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
11929 (match_operand:SI 2 "reg_or_short_operand" "")))
11930 (match_operand:SI 3 "gpc_reg_operand" ""))
11932 (set (match_operand:SI 0 "gpc_reg_operand" "")
11933 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
11934 "TARGET_32BIT && reload_completed"
11935 [(set (match_dup 0)
11936 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
11939 (compare:CC (match_dup 0)
11944 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11945 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
11946 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
11948 "doz%I2 %0,%1,%2\;nabs %0,%0\;{sri|srwi} %0,%0,31"
11949 [(set_attr "length" "12")])
11952 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
11954 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11955 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
11957 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11958 (lt:SI (match_dup 1) (match_dup 2)))]
11961 doz%I2 %0,%1,%2\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
11963 [(set_attr "type" "delayed_compare")
11964 (set_attr "length" "12,16")])
11967 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
11969 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
11970 (match_operand:SI 2 "reg_or_short_operand" ""))
11972 (set (match_operand:SI 0 "gpc_reg_operand" "")
11973 (lt:SI (match_dup 1) (match_dup 2)))]
11974 "TARGET_POWER && reload_completed"
11975 [(set (match_dup 0)
11976 (lt:SI (match_dup 1) (match_dup 2)))
11978 (compare:CC (match_dup 0)
11983 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
11984 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
11985 (match_operand:SI 2 "reg_or_short_operand" "rI"))
11986 (match_operand:SI 3 "gpc_reg_operand" "r")))]
11988 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
11989 [(set_attr "length" "12")])
11992 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11994 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11995 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
11996 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
11998 (clobber (match_scratch:SI 4 "=&r,&r"))]
12001 doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
12003 [(set_attr "type" "compare")
12004 (set_attr "length" "12,16")])
12007 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12009 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12010 (match_operand:SI 2 "reg_or_short_operand" ""))
12011 (match_operand:SI 3 "gpc_reg_operand" ""))
12013 (clobber (match_scratch:SI 4 ""))]
12014 "TARGET_POWER && reload_completed"
12015 [(set (match_dup 4)
12016 (plus:SI (lt:SI (match_dup 1) (match_dup 2))
12019 (compare:CC (match_dup 4)
12024 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12026 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12027 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12028 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12030 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12031 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12034 doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
12036 [(set_attr "type" "compare")
12037 (set_attr "length" "12,16")])
12040 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12042 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12043 (match_operand:SI 2 "reg_or_short_operand" ""))
12044 (match_operand:SI 3 "gpc_reg_operand" ""))
12046 (set (match_operand:SI 0 "gpc_reg_operand" "")
12047 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12048 "TARGET_POWER && reload_completed"
12049 [(set (match_dup 0)
12050 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12052 (compare:CC (match_dup 0)
12057 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12058 (neg:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12059 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
12061 "doz%I2 %0,%1,%2\;nabs %0,%0\;{srai|srawi} %0,%0,31"
12062 [(set_attr "length" "12")])
12064 (define_insn_and_split ""
12065 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12066 (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12067 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))]
12071 [(set (match_dup 0) (neg:SI (ltu:SI (match_dup 1) (match_dup 2))))
12072 (set (match_dup 0) (neg:SI (match_dup 0)))]
12075 (define_insn_and_split ""
12076 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
12077 (ltu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12078 (match_operand:DI 2 "reg_or_neg_short_operand" "r,P")))]
12082 [(set (match_dup 0) (neg:DI (ltu:DI (match_dup 1) (match_dup 2))))
12083 (set (match_dup 0) (neg:DI (match_dup 0)))]
12087 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
12089 (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12090 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12092 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
12093 (ltu:SI (match_dup 1) (match_dup 2)))]
12096 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;neg. %0,%0
12097 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;neg. %0,%0
12100 [(set_attr "type" "compare")
12101 (set_attr "length" "12,12,16,16")])
12104 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12106 (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12107 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12109 (set (match_operand:SI 0 "gpc_reg_operand" "")
12110 (ltu:SI (match_dup 1) (match_dup 2)))]
12111 "TARGET_32BIT && reload_completed"
12112 [(set (match_dup 0)
12113 (ltu:SI (match_dup 1) (match_dup 2)))
12115 (compare:CC (match_dup 0)
12119 (define_insn_and_split ""
12120 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
12121 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12122 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
12123 (match_operand:SI 3 "reg_or_short_operand" "rI,rI")))]
12126 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
12127 [(set (match_dup 0) (neg:SI (ltu:SI (match_dup 1) (match_dup 2))))
12128 (set (match_dup 0) (minus:SI (match_dup 3) (match_dup 0)))]
12131 (define_insn_and_split ""
12132 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
12133 (plus:DI (ltu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12134 (match_operand:DI 2 "reg_or_neg_short_operand" "r,P"))
12135 (match_operand:DI 3 "reg_or_short_operand" "rI,rI")))]
12138 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
12139 [(set (match_dup 0) (neg:DI (ltu:DI (match_dup 1) (match_dup 2))))
12140 (set (match_dup 0) (minus:DI (match_dup 3) (match_dup 0)))]
12144 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12146 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12147 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12148 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12150 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12153 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;{sf.|subf.} %4,%4,%3
12154 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;{sf.|subf.} %4,%4,%3
12157 [(set_attr "type" "compare")
12158 (set_attr "length" "12,12,16,16")])
12161 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12163 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12164 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12165 (match_operand:SI 3 "gpc_reg_operand" ""))
12167 (clobber (match_scratch:SI 4 ""))]
12168 "TARGET_32BIT && reload_completed"
12169 [(set (match_dup 4)
12170 (plus:SI (ltu:SI (match_dup 1) (match_dup 2))
12173 (compare:CC (match_dup 4)
12178 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12180 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12181 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12182 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12184 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12185 (plus:SI (ltu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12188 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;{sf.|subf.} %0,%0,%3
12189 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;{sf.|subf.} %0,%0,%3
12192 [(set_attr "type" "compare")
12193 (set_attr "length" "12,12,16,16")])
12196 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12198 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12199 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12200 (match_operand:SI 3 "gpc_reg_operand" ""))
12202 (set (match_operand:SI 0 "gpc_reg_operand" "")
12203 (plus:SI (ltu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12204 "TARGET_32BIT && reload_completed"
12205 [(set (match_dup 0)
12206 (plus:SI (ltu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12208 (compare:CC (match_dup 0)
12213 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12214 (neg:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12215 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))))]
12218 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0
12219 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0"
12220 [(set_attr "type" "two")
12221 (set_attr "length" "8")])
12224 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
12225 (neg:DI (ltu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12226 (match_operand:DI 2 "reg_or_neg_short_operand" "r,P"))))]
12229 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0
12230 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0"
12231 [(set_attr "type" "two")
12232 (set_attr "length" "8")])
12235 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12236 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12237 (match_operand:SI 2 "reg_or_short_operand" "rI")))
12238 (clobber (match_scratch:SI 3 "=r"))]
12240 "doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3"
12241 [(set_attr "length" "12")])
12244 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12246 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12247 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12249 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12250 (ge:SI (match_dup 1) (match_dup 2)))
12251 (clobber (match_scratch:SI 3 "=r,r"))]
12254 doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
12256 [(set_attr "type" "compare")
12257 (set_attr "length" "12,16")])
12260 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12262 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
12263 (match_operand:SI 2 "reg_or_short_operand" ""))
12265 (set (match_operand:SI 0 "gpc_reg_operand" "")
12266 (ge:SI (match_dup 1) (match_dup 2)))
12267 (clobber (match_scratch:SI 3 ""))]
12268 "TARGET_POWER && reload_completed"
12269 [(parallel [(set (match_dup 0)
12270 (ge:SI (match_dup 1) (match_dup 2)))
12271 (clobber (match_dup 3))])
12273 (compare:CC (match_dup 0)
12278 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12279 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12280 (match_operand:SI 2 "reg_or_short_operand" "rI"))
12281 (match_operand:SI 3 "gpc_reg_operand" "r")))]
12283 "doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
12284 [(set_attr "length" "12")])
12287 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12289 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12290 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12291 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12293 (clobber (match_scratch:SI 4 "=&r,&r"))]
12296 doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12298 [(set_attr "type" "compare")
12299 (set_attr "length" "12,16")])
12302 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12304 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
12305 (match_operand:SI 2 "reg_or_short_operand" ""))
12306 (match_operand:SI 3 "gpc_reg_operand" ""))
12308 (clobber (match_scratch:SI 4 ""))]
12309 "TARGET_POWER && reload_completed"
12310 [(set (match_dup 4)
12311 (plus:SI (ge:SI (match_dup 1) (match_dup 2))
12314 (compare:CC (match_dup 4)
12319 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12321 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12322 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12323 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12325 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12326 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12329 doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12331 [(set_attr "type" "compare")
12332 (set_attr "length" "12,16")])
12335 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12337 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
12338 (match_operand:SI 2 "reg_or_short_operand" ""))
12339 (match_operand:SI 3 "gpc_reg_operand" ""))
12341 (set (match_operand:SI 0 "gpc_reg_operand" "")
12342 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12343 "TARGET_POWER && reload_completed"
12344 [(set (match_dup 0)
12345 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12347 (compare:CC (match_dup 0)
12352 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12353 (neg:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12354 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
12356 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
12357 [(set_attr "length" "12")])
12360 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12361 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12362 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))]
12365 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0
12366 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
12367 [(set_attr "type" "three")
12368 (set_attr "length" "12")])
12371 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
12372 (geu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12373 (match_operand:DI 2 "reg_or_neg_short_operand" "r,P")))]
12376 subfc %0,%2,%1\;li %0,0\;adde %0,%0,%0
12377 addic %0,%1,%n2\;li %0,0\;adde %0,%0,%0"
12378 [(set_attr "type" "three")
12379 (set_attr "length" "12")])
12382 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
12384 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12385 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12387 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
12388 (geu:SI (match_dup 1) (match_dup 2)))]
12391 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
12392 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
12395 [(set_attr "type" "compare")
12396 (set_attr "length" "12,12,16,16")])
12399 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12401 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12402 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12404 (set (match_operand:SI 0 "gpc_reg_operand" "")
12405 (geu:SI (match_dup 1) (match_dup 2)))]
12406 "TARGET_32BIT && reload_completed"
12407 [(set (match_dup 0)
12408 (geu:SI (match_dup 1) (match_dup 2)))
12410 (compare:CC (match_dup 0)
12415 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
12417 (geu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
12418 (match_operand:DI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12420 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
12421 (geu:DI (match_dup 1) (match_dup 2)))]
12424 subfc %0,%2,%1\;li %0,0\;adde. %0,%0,%0
12425 addic %0,%1,%n2\;li %0,0\;adde. %0,%0,%0
12428 [(set_attr "type" "compare")
12429 (set_attr "length" "12,12,16,16")])
12432 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12434 (geu:DI (match_operand:DI 1 "gpc_reg_operand" "")
12435 (match_operand:DI 2 "reg_or_neg_short_operand" ""))
12437 (set (match_operand:DI 0 "gpc_reg_operand" "")
12438 (geu:DI (match_dup 1) (match_dup 2)))]
12439 "TARGET_64BIT && reload_completed"
12440 [(set (match_dup 0)
12441 (geu:DI (match_dup 1) (match_dup 2)))
12443 (compare:CC (match_dup 0)
12448 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12449 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12450 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
12451 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
12454 {sf|subfc} %0,%2,%1\;{aze|addze} %0,%3
12455 {ai|addic} %0,%1,%n2\;{aze|addze} %0,%3"
12456 [(set_attr "type" "two")
12457 (set_attr "length" "8")])
12460 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12462 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12463 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12464 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12466 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12469 {sf|subfc} %4,%2,%1\;{aze.|addze.} %4,%3
12470 {ai|addic} %4,%1,%n2\;{aze.|addze.} %4,%3
12473 [(set_attr "type" "compare")
12474 (set_attr "length" "8,8,12,12")])
12477 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12479 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12480 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12481 (match_operand:SI 3 "gpc_reg_operand" ""))
12483 (clobber (match_scratch:SI 4 ""))]
12484 "TARGET_32BIT && reload_completed"
12485 [(set (match_dup 4)
12486 (plus:SI (geu:SI (match_dup 1) (match_dup 2))
12489 (compare:CC (match_dup 4)
12494 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12496 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12497 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12498 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12500 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12501 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12504 {sf|subfc} %0,%2,%1\;{aze.|addze.} %0,%3
12505 {ai|addic} %0,%1,%n2\;{aze.|addze.} %0,%3
12508 [(set_attr "type" "compare")
12509 (set_attr "length" "8,8,12,12")])
12512 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12514 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12515 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12516 (match_operand:SI 3 "gpc_reg_operand" ""))
12518 (set (match_operand:SI 0 "gpc_reg_operand" "")
12519 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12520 "TARGET_32BIT && reload_completed"
12521 [(set (match_dup 0)
12522 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12524 (compare:CC (match_dup 0)
12529 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12530 (neg:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12531 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))]
12534 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0
12535 {sfi|subfic} %0,%1,-1\;{a%I2|add%I2c} %0,%0,%2\;{sfe|subfe} %0,%0,%0"
12536 [(set_attr "type" "three")
12537 (set_attr "length" "12")])
12540 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12542 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12543 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))
12544 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
12547 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0
12548 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
12549 [(set_attr "type" "three")
12550 (set_attr "length" "12")])
12553 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12556 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12557 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
12558 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12560 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12563 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
12564 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
12567 [(set_attr "type" "compare")
12568 (set_attr "length" "12,12,16,16")])
12571 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12574 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12575 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
12576 (match_operand:SI 3 "gpc_reg_operand" ""))
12578 (clobber (match_scratch:SI 4 ""))]
12579 "TARGET_32BIT && reload_completed"
12580 [(set (match_dup 4)
12581 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2)))
12584 (compare:CC (match_dup 4)
12589 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12592 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12593 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
12594 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12596 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12597 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12600 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
12601 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
12604 [(set_attr "type" "compare")
12605 (set_attr "length" "12,12,16,16")])
12608 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12611 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12612 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
12613 (match_operand:SI 3 "gpc_reg_operand" ""))
12615 (set (match_operand:SI 0 "gpc_reg_operand" "")
12616 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12617 "TARGET_32BIT && reload_completed"
12618 [(set (match_dup 0)
12619 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
12621 (compare:CC (match_dup 0)
12626 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12627 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12630 "{sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{sri|srwi} %0,%0,31"
12631 [(set_attr "type" "three")
12632 (set_attr "length" "12")])
12635 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12636 (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
12639 "subfic %0,%1,0\;addme %0,%0\;srdi %0,%0,63"
12640 [(set_attr "type" "three")
12641 (set_attr "length" "12")])
12644 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
12646 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12649 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12650 (gt:SI (match_dup 1) (const_int 0)))]
12653 {sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{sri.|srwi.} %0,%0,31
12655 [(set_attr "type" "delayed_compare")
12656 (set_attr "length" "12,16")])
12659 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
12661 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12664 (set (match_operand:SI 0 "gpc_reg_operand" "")
12665 (gt:SI (match_dup 1) (const_int 0)))]
12666 "TARGET_32BIT && reload_completed"
12667 [(set (match_dup 0)
12668 (gt:SI (match_dup 1) (const_int 0)))
12670 (compare:CC (match_dup 0)
12675 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
12677 (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12680 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
12681 (gt:DI (match_dup 1) (const_int 0)))]
12684 subfic %0,%1,0\;addme %0,%0\;srdi. %0,%0,63
12686 [(set_attr "type" "delayed_compare")
12687 (set_attr "length" "12,16")])
12690 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
12692 (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
12695 (set (match_operand:DI 0 "gpc_reg_operand" "")
12696 (gt:DI (match_dup 1) (const_int 0)))]
12697 "TARGET_64BIT && reload_completed"
12698 [(set (match_dup 0)
12699 (gt:DI (match_dup 1) (const_int 0)))
12701 (compare:CC (match_dup 0)
12706 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12707 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12708 (match_operand:SI 2 "reg_or_short_operand" "r")))]
12710 "doz %0,%2,%1\;nabs %0,%0\;{sri|srwi} %0,%0,31"
12711 [(set_attr "length" "12")])
12714 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12716 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12717 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
12719 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12720 (gt:SI (match_dup 1) (match_dup 2)))]
12723 doz %0,%2,%1\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
12725 [(set_attr "type" "delayed_compare")
12726 (set_attr "length" "12,16")])
12729 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12731 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12732 (match_operand:SI 2 "reg_or_short_operand" ""))
12734 (set (match_operand:SI 0 "gpc_reg_operand" "")
12735 (gt:SI (match_dup 1) (match_dup 2)))]
12736 "TARGET_POWER && reload_completed"
12737 [(set (match_dup 0)
12738 (gt:SI (match_dup 1) (match_dup 2)))
12740 (compare:CC (match_dup 0)
12745 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12746 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12748 (match_operand:SI 2 "gpc_reg_operand" "r")))]
12750 "{a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze|addze} %0,%2"
12751 [(set_attr "type" "three")
12752 (set_attr "length" "12")])
12755 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
12756 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
12758 (match_operand:DI 2 "gpc_reg_operand" "r")))]
12760 "addc %0,%1,%1\;subfe %0,%1,%0\;addze %0,%2"
12761 [(set_attr "type" "three")
12762 (set_attr "length" "12")])
12765 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12767 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12769 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
12771 (clobber (match_scratch:SI 3 "=&r,&r"))]
12774 {a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze.|addze.} %3,%2
12776 [(set_attr "type" "compare")
12777 (set_attr "length" "12,16")])
12780 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12782 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12784 (match_operand:SI 2 "gpc_reg_operand" ""))
12786 (clobber (match_scratch:SI 3 ""))]
12787 "TARGET_32BIT && reload_completed"
12788 [(set (match_dup 3)
12789 (plus:SI (gt:SI (match_dup 1) (const_int 0))
12792 (compare:CC (match_dup 3)
12797 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12799 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12801 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
12803 (clobber (match_scratch:DI 3 "=&r,&r"))]
12806 addc %3,%1,%1\;subfe %3,%1,%3\;addze. %3,%2
12808 [(set_attr "type" "compare")
12809 (set_attr "length" "12,16")])
12812 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12814 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
12816 (match_operand:DI 2 "gpc_reg_operand" ""))
12818 (clobber (match_scratch:DI 3 ""))]
12819 "TARGET_64BIT && reload_completed"
12820 [(set (match_dup 3)
12821 (plus:DI (gt:DI (match_dup 1) (const_int 0))
12824 (compare:CC (match_dup 3)
12829 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12831 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12833 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
12835 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12836 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
12839 {a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze.|addze.} %0,%2
12841 [(set_attr "type" "compare")
12842 (set_attr "length" "12,16")])
12845 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12847 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12849 (match_operand:SI 2 "gpc_reg_operand" ""))
12851 (set (match_operand:SI 0 "gpc_reg_operand" "")
12852 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
12853 "TARGET_32BIT && reload_completed"
12854 [(set (match_dup 0)
12855 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))
12857 (compare:CC (match_dup 0)
12862 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12864 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12866 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
12868 (set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
12869 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
12872 addc %0,%1,%1\;subfe %0,%1,%0\;addze. %0,%2
12874 [(set_attr "type" "compare")
12875 (set_attr "length" "12,16")])
12878 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12880 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
12882 (match_operand:DI 2 "gpc_reg_operand" ""))
12884 (set (match_operand:DI 0 "gpc_reg_operand" "")
12885 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
12886 "TARGET_64BIT && reload_completed"
12887 [(set (match_dup 0)
12888 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))
12890 (compare:CC (match_dup 0)
12895 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12896 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12897 (match_operand:SI 2 "reg_or_short_operand" "r"))
12898 (match_operand:SI 3 "gpc_reg_operand" "r")))]
12900 "doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
12901 [(set_attr "length" "12")])
12904 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12906 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12907 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
12908 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12910 (clobber (match_scratch:SI 4 "=&r,&r"))]
12913 doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
12915 [(set_attr "type" "compare")
12916 (set_attr "length" "12,16")])
12919 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12921 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12922 (match_operand:SI 2 "reg_or_short_operand" ""))
12923 (match_operand:SI 3 "gpc_reg_operand" ""))
12925 (clobber (match_scratch:SI 4 ""))]
12926 "TARGET_POWER && reload_completed"
12927 [(set (match_dup 4)
12928 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12930 (compare:CC (match_dup 4)
12935 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12937 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12938 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
12939 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12941 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12942 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12945 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
12947 [(set_attr "type" "compare")
12948 (set_attr "length" "12,16")])
12951 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12953 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12954 (match_operand:SI 2 "reg_or_short_operand" ""))
12955 (match_operand:SI 3 "gpc_reg_operand" ""))
12957 (set (match_operand:SI 0 "gpc_reg_operand" "")
12958 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12959 "TARGET_POWER && reload_completed"
12960 [(set (match_dup 0)
12961 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12963 (compare:CC (match_dup 0)
12968 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12969 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12972 "{sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{srai|srawi} %0,%0,31"
12973 [(set_attr "type" "three")
12974 (set_attr "length" "12")])
12977 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12978 (neg:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
12981 "subfic %0,%1,0\;addme %0,%0\;sradi %0,%0,63"
12982 [(set_attr "type" "three")
12983 (set_attr "length" "12")])
12986 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12987 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12988 (match_operand:SI 2 "reg_or_short_operand" "r"))))]
12990 "doz %0,%2,%1\;nabs %0,%0\;{srai|srawi} %0,%0,31"
12991 [(set_attr "length" "12")])
12993 (define_insn_and_split ""
12994 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12995 (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12996 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
13000 [(set (match_dup 0) (neg:SI (gtu:SI (match_dup 1) (match_dup 2))))
13001 (set (match_dup 0) (neg:SI (match_dup 0)))]
13004 (define_insn_and_split ""
13005 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13006 (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r")
13007 (match_operand:DI 2 "reg_or_short_operand" "rI")))]
13011 [(set (match_dup 0) (neg:DI (gtu:DI (match_dup 1) (match_dup 2))))
13012 (set (match_dup 0) (neg:DI (match_dup 0)))]
13016 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13018 (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13019 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13021 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13022 (gtu:SI (match_dup 1) (match_dup 2)))]
13025 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;neg. %0,%0
13027 [(set_attr "type" "compare")
13028 (set_attr "length" "12,16")])
13031 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13033 (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13034 (match_operand:SI 2 "reg_or_short_operand" ""))
13036 (set (match_operand:SI 0 "gpc_reg_operand" "")
13037 (gtu:SI (match_dup 1) (match_dup 2)))]
13038 "TARGET_32BIT && reload_completed"
13039 [(set (match_dup 0)
13040 (gtu:SI (match_dup 1) (match_dup 2)))
13042 (compare:CC (match_dup 0)
13047 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13049 (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13050 (match_operand:DI 2 "reg_or_short_operand" "rI,rI"))
13052 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
13053 (gtu:DI (match_dup 1) (match_dup 2)))]
13056 subf%I2c %0,%1,%2\;subfe %0,%0,%0\;neg. %0,%0
13058 [(set_attr "type" "compare")
13059 (set_attr "length" "12,16")])
13062 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13064 (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "")
13065 (match_operand:DI 2 "reg_or_short_operand" ""))
13067 (set (match_operand:DI 0 "gpc_reg_operand" "")
13068 (gtu:DI (match_dup 1) (match_dup 2)))]
13069 "TARGET_64BIT && reload_completed"
13070 [(set (match_dup 0)
13071 (gtu:DI (match_dup 1) (match_dup 2)))
13073 (compare:CC (match_dup 0)
13077 (define_insn_and_split ""
13078 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
13079 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13080 (match_operand:SI 2 "reg_or_short_operand" "rI"))
13081 (match_operand:SI 3 "reg_or_short_operand" "rI")))]
13084 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13085 [(set (match_dup 0) (neg:SI (gtu:SI (match_dup 1) (match_dup 2))))
13086 (set (match_dup 0) (minus:SI (match_dup 3) (match_dup 0)))]
13089 (define_insn_and_split ""
13090 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
13091 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r")
13092 (match_operand:DI 2 "reg_or_short_operand" "rI"))
13093 (match_operand:DI 3 "reg_or_short_operand" "rI")))]
13096 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13097 [(set (match_dup 0) (neg:DI (gtu:DI (match_dup 1) (match_dup 2))))
13098 (set (match_dup 0) (minus:DI (match_dup 3) (match_dup 0)))]
13102 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13104 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13105 (match_operand:SI 2 "reg_or_short_operand" "I,r,I,r"))
13106 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13108 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
13111 {ai|addic} %4,%1,%k2\;{aze.|addze.} %4,%3
13112 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;{sf.|subf.} %4,%4,%3
13115 [(set_attr "type" "compare")
13116 (set_attr "length" "8,12,12,16")])
13119 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13121 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13122 (match_operand:SI 2 "reg_or_short_operand" ""))
13123 (match_operand:SI 3 "gpc_reg_operand" ""))
13125 (clobber (match_scratch:SI 4 ""))]
13126 "TARGET_32BIT && reload_completed"
13127 [(set (match_dup 4)
13128 (plus:SI (gtu:SI (match_dup 1) (match_dup 2))
13131 (compare:CC (match_dup 4)
13136 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13138 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
13139 (match_operand:DI 2 "reg_or_short_operand" "I,r,I,r"))
13140 (match_operand:DI 3 "gpc_reg_operand" "r,r,r,r"))
13142 (clobber (match_scratch:DI 4 "=&r,&r,&r,&r"))]
13145 addic %4,%1,%k2\;addze. %4,%3
13146 subf%I2c %4,%1,%2\;subfe %4,%4,%4\;subf. %4,%4,%3
13149 [(set_attr "type" "compare")
13150 (set_attr "length" "8,12,12,16")])
13153 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13155 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "")
13156 (match_operand:DI 2 "reg_or_short_operand" ""))
13157 (match_operand:DI 3 "gpc_reg_operand" ""))
13159 (clobber (match_scratch:DI 4 ""))]
13160 "TARGET_64BIT && reload_completed"
13161 [(set (match_dup 4)
13162 (plus:DI (gtu:DI (match_dup 1) (match_dup 2))
13165 (compare:CC (match_dup 4)
13170 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13172 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13173 (match_operand:SI 2 "reg_or_short_operand" "I,r,I,r"))
13174 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13176 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13177 (plus:SI (gtu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13180 {ai|addic} %0,%1,%k2\;{aze.|addze.} %0,%3
13181 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;{sf.|subf.} %0,%0,%3
13184 [(set_attr "type" "compare")
13185 (set_attr "length" "8,12,12,16")])
13188 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13190 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13191 (match_operand:SI 2 "reg_or_short_operand" ""))
13192 (match_operand:SI 3 "gpc_reg_operand" ""))
13194 (set (match_operand:SI 0 "gpc_reg_operand" "")
13195 (plus:SI (gtu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13196 "TARGET_32BIT && reload_completed"
13197 [(set (match_dup 0)
13198 (plus:SI (gtu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13200 (compare:CC (match_dup 0)
13205 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13207 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
13208 (match_operand:DI 2 "reg_or_short_operand" "I,r,I,r"))
13209 (match_operand:DI 3 "gpc_reg_operand" "r,r,r,r"))
13211 (set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13212 (plus:DI (gtu:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13215 addic %0,%1,%k2\;addze. %0,%3
13216 subf%I2c %0,%1,%2\;subfe %0,%0,%0\;subf. %0,%0,%3
13219 [(set_attr "type" "compare")
13220 (set_attr "length" "8,12,12,16")])
13223 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13225 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "")
13226 (match_operand:DI 2 "reg_or_short_operand" ""))
13227 (match_operand:DI 3 "gpc_reg_operand" ""))
13229 (set (match_operand:DI 0 "gpc_reg_operand" "")
13230 (plus:DI (gtu:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13231 "TARGET_64BIT && reload_completed"
13232 [(set (match_dup 0)
13233 (plus:DI (gtu:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
13235 (compare:CC (match_dup 0)
13240 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13241 (neg:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13242 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
13244 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0"
13245 [(set_attr "type" "two")
13246 (set_attr "length" "8")])
13249 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13250 (neg:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r")
13251 (match_operand:DI 2 "reg_or_short_operand" "rI"))))]
13253 "subf%I2c %0,%1,%2\;subfe %0,%0,%0"
13254 [(set_attr "type" "two")
13255 (set_attr "length" "8")])
13257 ;; Define both directions of branch and return. If we need a reload
13258 ;; register, we'd rather use CR0 since it is much easier to copy a
13259 ;; register CC value to there.
13263 (if_then_else (match_operator 1 "branch_comparison_operator"
13265 "cc_reg_operand" "y")
13267 (label_ref (match_operand 0 "" ""))
13272 return output_cbranch (operands[1], \"%l0\", 0, insn);
13274 [(set_attr "type" "branch")])
13278 (if_then_else (match_operator 0 "branch_comparison_operator"
13280 "cc_reg_operand" "y")
13287 return output_cbranch (operands[0], NULL, 0, insn);
13289 [(set_attr "type" "branch")
13290 (set_attr "length" "4")])
13294 (if_then_else (match_operator 1 "branch_comparison_operator"
13296 "cc_reg_operand" "y")
13299 (label_ref (match_operand 0 "" ""))))]
13303 return output_cbranch (operands[1], \"%l0\", 1, insn);
13305 [(set_attr "type" "branch")])
13309 (if_then_else (match_operator 0 "branch_comparison_operator"
13311 "cc_reg_operand" "y")
13318 return output_cbranch (operands[0], NULL, 1, insn);
13320 [(set_attr "type" "branch")
13321 (set_attr "length" "4")])
13323 ;; Logic on condition register values.
13325 ; This pattern matches things like
13326 ; (set (reg:CCEQ 68) (compare:CCEQ (ior:SI (gt:SI (reg:CCFP 68) (const_int 0))
13327 ; (eq:SI (reg:CCFP 68) (const_int 0)))
13329 ; which are generated by the branch logic.
13330 ; Prefer destructive operations where BT = BB (for crXX BT,BA,BB)
13332 (define_insn "*cceq_ior_compare"
13333 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13334 (compare:CCEQ (match_operator:SI 1 "boolean_operator"
13335 [(match_operator:SI 2
13336 "branch_positive_comparison_operator"
13338 "cc_reg_operand" "y,y")
13340 (match_operator:SI 4
13341 "branch_positive_comparison_operator"
13343 "cc_reg_operand" "0,y")
13347 "cr%q1 %E0,%j2,%j4"
13348 [(set_attr "type" "cr_logical,delayed_cr")])
13350 ; Why is the constant -1 here, but 1 in the previous pattern?
13351 ; Because ~1 has all but the low bit set.
13353 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13354 (compare:CCEQ (match_operator:SI 1 "boolean_or_operator"
13355 [(not:SI (match_operator:SI 2
13356 "branch_positive_comparison_operator"
13358 "cc_reg_operand" "y,y")
13360 (match_operator:SI 4
13361 "branch_positive_comparison_operator"
13363 "cc_reg_operand" "0,y")
13367 "cr%q1 %E0,%j2,%j4"
13368 [(set_attr "type" "cr_logical,delayed_cr")])
13370 (define_insn "*cceq_rev_compare"
13371 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13372 (compare:CCEQ (match_operator:SI 1
13373 "branch_positive_comparison_operator"
13375 "cc_reg_operand" "0,y")
13379 "{crnor %E0,%j1,%j1|crnot %E0,%j1}"
13380 [(set_attr "type" "cr_logical,delayed_cr")])
13382 ;; If we are comparing the result of two comparisons, this can be done
13383 ;; using creqv or crxor.
13385 (define_insn_and_split ""
13386 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
13387 (compare:CCEQ (match_operator 1 "branch_comparison_operator"
13388 [(match_operand 2 "cc_reg_operand" "y")
13390 (match_operator 3 "branch_comparison_operator"
13391 [(match_operand 4 "cc_reg_operand" "y")
13396 [(set (match_dup 0) (compare:CCEQ (xor:SI (match_dup 1) (match_dup 3))
13400 int positive_1, positive_2;
13402 positive_1 = branch_positive_comparison_operator (operands[1],
13403 GET_MODE (operands[1]));
13404 positive_2 = branch_positive_comparison_operator (operands[3],
13405 GET_MODE (operands[3]));
13408 operands[1] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[2]),
13409 GET_CODE (operands[1])),
13411 operands[2], const0_rtx);
13412 else if (GET_MODE (operands[1]) != SImode)
13413 operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]), SImode,
13414 operands[2], const0_rtx);
13417 operands[3] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[4]),
13418 GET_CODE (operands[3])),
13420 operands[4], const0_rtx);
13421 else if (GET_MODE (operands[3]) != SImode)
13422 operands[3] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
13423 operands[4], const0_rtx);
13425 if (positive_1 == positive_2)
13427 operands[1] = gen_rtx_NOT (SImode, operands[1]);
13428 operands[5] = constm1_rtx;
13432 operands[5] = const1_rtx;
13436 ;; Unconditional branch and return.
13438 (define_insn "jump"
13440 (label_ref (match_operand 0 "" "")))]
13443 [(set_attr "type" "branch")])
13445 (define_insn "return"
13449 [(set_attr "type" "jmpreg")])
13451 (define_expand "indirect_jump"
13452 [(set (pc) (match_operand 0 "register_operand" ""))])
13454 (define_insn "*indirect_jump<mode>"
13455 [(set (pc) (match_operand:P 0 "register_operand" "c,*l"))]
13460 [(set_attr "type" "jmpreg")])
13462 ;; Table jump for switch statements:
13463 (define_expand "tablejump"
13464 [(use (match_operand 0 "" ""))
13465 (use (label_ref (match_operand 1 "" "")))]
13470 emit_jump_insn (gen_tablejumpsi (operands[0], operands[1]));
13472 emit_jump_insn (gen_tablejumpdi (operands[0], operands[1]));
13476 (define_expand "tablejumpsi"
13477 [(set (match_dup 3)
13478 (plus:SI (match_operand:SI 0 "" "")
13480 (parallel [(set (pc) (match_dup 3))
13481 (use (label_ref (match_operand 1 "" "")))])]
13484 { operands[0] = force_reg (SImode, operands[0]);
13485 operands[2] = force_reg (SImode, gen_rtx_LABEL_REF (SImode, operands[1]));
13486 operands[3] = gen_reg_rtx (SImode);
13489 (define_expand "tablejumpdi"
13490 [(set (match_dup 4)
13491 (sign_extend:DI (match_operand:SI 0 "lwa_operand" "rm")))
13493 (plus:DI (match_dup 4)
13495 (parallel [(set (pc) (match_dup 3))
13496 (use (label_ref (match_operand 1 "" "")))])]
13499 { operands[2] = force_reg (DImode, gen_rtx_LABEL_REF (DImode, operands[1]));
13500 operands[3] = gen_reg_rtx (DImode);
13501 operands[4] = gen_reg_rtx (DImode);
13506 (match_operand:P 0 "register_operand" "c,*l"))
13507 (use (label_ref (match_operand 1 "" "")))]
13512 [(set_attr "type" "jmpreg")])
13517 "{cror 0,0,0|nop}")
13519 ;; Define the subtract-one-and-jump insns, starting with the template
13520 ;; so loop.c knows what to generate.
13522 (define_expand "doloop_end"
13523 [(use (match_operand 0 "" "")) ; loop pseudo
13524 (use (match_operand 1 "" "")) ; iterations; zero if unknown
13525 (use (match_operand 2 "" "")) ; max iterations
13526 (use (match_operand 3 "" "")) ; loop level
13527 (use (match_operand 4 "" ""))] ; label
13531 /* Only use this on innermost loops. */
13532 if (INTVAL (operands[3]) > 1)
13536 if (GET_MODE (operands[0]) != DImode)
13538 emit_jump_insn (gen_ctrdi (operands[0], operands[4]));
13542 if (GET_MODE (operands[0]) != SImode)
13544 emit_jump_insn (gen_ctrsi (operands[0], operands[4]));
13549 (define_expand "ctr<mode>"
13550 [(parallel [(set (pc)
13551 (if_then_else (ne (match_operand:P 0 "register_operand" "")
13553 (label_ref (match_operand 1 "" ""))
13556 (plus:P (match_dup 0)
13558 (clobber (match_scratch:CC 2 ""))
13559 (clobber (match_scratch:P 3 ""))])]
13563 ;; We need to be able to do this for any operand, including MEM, or we
13564 ;; will cause reload to blow up since we don't allow output reloads on
13566 ;; For the length attribute to be calculated correctly, the
13567 ;; label MUST be operand 0.
13569 (define_insn "*ctr<mode>_internal1"
13571 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
13573 (label_ref (match_operand 0 "" ""))
13575 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
13576 (plus:P (match_dup 1)
13578 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
13579 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
13583 if (which_alternative != 0)
13585 else if (get_attr_length (insn) == 4)
13586 return \"{bdn|bdnz} %l0\";
13588 return \"bdz $+8\;b %l0\";
13590 [(set_attr "type" "branch")
13591 (set_attr "length" "*,12,16,16")])
13593 (define_insn "*ctr<mode>_internal2"
13595 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
13598 (label_ref (match_operand 0 "" ""))))
13599 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
13600 (plus:P (match_dup 1)
13602 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
13603 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
13607 if (which_alternative != 0)
13609 else if (get_attr_length (insn) == 4)
13610 return \"bdz %l0\";
13612 return \"{bdn|bdnz} $+8\;b %l0\";
13614 [(set_attr "type" "branch")
13615 (set_attr "length" "*,12,16,16")])
13617 ;; Similar but use EQ
13619 (define_insn "*ctr<mode>_internal5"
13621 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
13623 (label_ref (match_operand 0 "" ""))
13625 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
13626 (plus:P (match_dup 1)
13628 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
13629 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
13633 if (which_alternative != 0)
13635 else if (get_attr_length (insn) == 4)
13636 return \"bdz %l0\";
13638 return \"{bdn|bdnz} $+8\;b %l0\";
13640 [(set_attr "type" "branch")
13641 (set_attr "length" "*,12,16,16")])
13643 (define_insn "*ctr<mode>_internal6"
13645 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
13648 (label_ref (match_operand 0 "" ""))))
13649 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
13650 (plus:P (match_dup 1)
13652 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
13653 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
13657 if (which_alternative != 0)
13659 else if (get_attr_length (insn) == 4)
13660 return \"{bdn|bdnz} %l0\";
13662 return \"bdz $+8\;b %l0\";
13664 [(set_attr "type" "branch")
13665 (set_attr "length" "*,12,16,16")])
13667 ;; Now the splitters if we could not allocate the CTR register
13671 (if_then_else (match_operator 2 "comparison_operator"
13672 [(match_operand:P 1 "gpc_reg_operand" "")
13674 (match_operand 5 "" "")
13675 (match_operand 6 "" "")))
13676 (set (match_operand:P 0 "gpc_reg_operand" "")
13677 (plus:P (match_dup 1) (const_int -1)))
13678 (clobber (match_scratch:CC 3 ""))
13679 (clobber (match_scratch:P 4 ""))]
13681 [(parallel [(set (match_dup 3)
13682 (compare:CC (plus:P (match_dup 1)
13686 (plus:P (match_dup 1)
13688 (set (pc) (if_then_else (match_dup 7)
13692 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
13693 operands[3], const0_rtx); }")
13697 (if_then_else (match_operator 2 "comparison_operator"
13698 [(match_operand:P 1 "gpc_reg_operand" "")
13700 (match_operand 5 "" "")
13701 (match_operand 6 "" "")))
13702 (set (match_operand:P 0 "nonimmediate_operand" "")
13703 (plus:P (match_dup 1) (const_int -1)))
13704 (clobber (match_scratch:CC 3 ""))
13705 (clobber (match_scratch:P 4 ""))]
13706 "reload_completed && ! gpc_reg_operand (operands[0], SImode)"
13707 [(parallel [(set (match_dup 3)
13708 (compare:CC (plus:P (match_dup 1)
13712 (plus:P (match_dup 1)
13716 (set (pc) (if_then_else (match_dup 7)
13720 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
13721 operands[3], const0_rtx); }")
13723 (define_insn "trap"
13724 [(trap_if (const_int 1) (const_int 0))]
13728 (define_expand "conditional_trap"
13729 [(trap_if (match_operator 0 "trap_comparison_operator"
13730 [(match_dup 2) (match_dup 3)])
13731 (match_operand 1 "const_int_operand" ""))]
13733 "if (rs6000_compare_fp_p || operands[1] != const0_rtx) FAIL;
13734 operands[2] = rs6000_compare_op0;
13735 operands[3] = rs6000_compare_op1;")
13738 [(trap_if (match_operator 0 "trap_comparison_operator"
13739 [(match_operand:GPR 1 "register_operand" "r")
13740 (match_operand:GPR 2 "reg_or_short_operand" "rI")])
13743 "{t|t<wd>}%V0%I2 %1,%2")
13745 ;; Insns related to generating the function prologue and epilogue.
13747 (define_expand "prologue"
13748 [(use (const_int 0))]
13749 "TARGET_SCHED_PROLOG"
13752 rs6000_emit_prologue ();
13756 (define_insn "*movesi_from_cr_one"
13757 [(match_parallel 0 "mfcr_operation"
13758 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
13759 (unspec:SI [(match_operand:CC 2 "cc_reg_operand" "y")
13760 (match_operand 3 "immediate_operand" "n")]
13761 UNSPEC_MOVESI_FROM_CR))])]
13767 for (i = 0; i < XVECLEN (operands[0], 0); i++)
13769 mask = INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
13770 operands[4] = GEN_INT (mask);
13771 output_asm_insn (\"mfcr %1,%4\", operands);
13775 [(set_attr "type" "mfcrf")])
13777 (define_insn "movesi_from_cr"
13778 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13779 (unspec:SI [(reg:CC 68) (reg:CC 69) (reg:CC 70) (reg:CC 71)
13780 (reg:CC 72) (reg:CC 73) (reg:CC 74) (reg:CC 75)]
13781 UNSPEC_MOVESI_FROM_CR))]
13784 [(set_attr "type" "mfcr")])
13786 (define_insn "*stmw"
13787 [(match_parallel 0 "stmw_operation"
13788 [(set (match_operand:SI 1 "memory_operand" "=m")
13789 (match_operand:SI 2 "gpc_reg_operand" "r"))])]
13791 "{stm|stmw} %2,%1")
13793 (define_insn "*save_fpregs_<mode>"
13794 [(match_parallel 0 "any_parallel_operand"
13795 [(clobber (match_operand:P 1 "register_operand" "=l"))
13796 (use (match_operand:P 2 "call_operand" "s"))
13797 (set (match_operand:DF 3 "memory_operand" "=m")
13798 (match_operand:DF 4 "gpc_reg_operand" "f"))])]
13801 [(set_attr "type" "branch")
13802 (set_attr "length" "4")])
13804 ; These are to explain that changes to the stack pointer should
13805 ; not be moved over stores to stack memory.
13806 (define_insn "stack_tie"
13807 [(set (match_operand:BLK 0 "memory_operand" "+m")
13808 (unspec:BLK [(match_dup 0)] UNSPEC_TIE))]
13811 [(set_attr "length" "0")])
13814 (define_expand "epilogue"
13815 [(use (const_int 0))]
13816 "TARGET_SCHED_PROLOG"
13819 rs6000_emit_epilogue (FALSE);
13823 ; On some processors, doing the mtcrf one CC register at a time is
13824 ; faster (like on the 604e). On others, doing them all at once is
13825 ; faster; for instance, on the 601 and 750.
13827 (define_expand "movsi_to_cr_one"
13828 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
13829 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
13830 (match_dup 2)] UNSPEC_MOVESI_TO_CR))]
13832 "operands[2] = GEN_INT (1 << (75 - REGNO (operands[0])));")
13834 (define_insn "*movsi_to_cr"
13835 [(match_parallel 0 "mtcrf_operation"
13836 [(set (match_operand:CC 1 "cc_reg_operand" "=y")
13837 (unspec:CC [(match_operand:SI 2 "gpc_reg_operand" "r")
13838 (match_operand 3 "immediate_operand" "n")]
13839 UNSPEC_MOVESI_TO_CR))])]
13845 for (i = 0; i < XVECLEN (operands[0], 0); i++)
13846 mask |= INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
13847 operands[4] = GEN_INT (mask);
13848 return \"mtcrf %4,%2\";
13850 [(set_attr "type" "mtcr")])
13852 (define_insn "*mtcrfsi"
13853 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
13854 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
13855 (match_operand 2 "immediate_operand" "n")]
13856 UNSPEC_MOVESI_TO_CR))]
13857 "GET_CODE (operands[0]) == REG
13858 && CR_REGNO_P (REGNO (operands[0]))
13859 && GET_CODE (operands[2]) == CONST_INT
13860 && INTVAL (operands[2]) == 1 << (75 - REGNO (operands[0]))"
13862 [(set_attr "type" "mtcr")])
13864 ; The load-multiple instructions have similar properties.
13865 ; Note that "load_multiple" is a name known to the machine-independent
13866 ; code that actually corresponds to the powerpc load-string.
13868 (define_insn "*lmw"
13869 [(match_parallel 0 "lmw_operation"
13870 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
13871 (match_operand:SI 2 "memory_operand" "m"))])]
13875 (define_insn "*return_internal_<mode>"
13877 (use (match_operand:P 0 "register_operand" "lc"))]
13880 [(set_attr "type" "jmpreg")])
13882 ; FIXME: This would probably be somewhat simpler if the Cygnus sibcall
13883 ; stuff was in GCC. Oh, and "any_parallel_operand" is a bit flexible...
13885 (define_insn "*return_and_restore_fpregs_<mode>"
13886 [(match_parallel 0 "any_parallel_operand"
13888 (use (match_operand:P 1 "register_operand" "l"))
13889 (use (match_operand:P 2 "call_operand" "s"))
13890 (set (match_operand:DF 3 "gpc_reg_operand" "=f")
13891 (match_operand:DF 4 "memory_operand" "m"))])]
13895 ; This is used in compiling the unwind routines.
13896 (define_expand "eh_return"
13897 [(use (match_operand 0 "general_operand" ""))]
13902 emit_insn (gen_eh_set_lr_si (operands[0]));
13904 emit_insn (gen_eh_set_lr_di (operands[0]));
13908 ; We can't expand this before we know where the link register is stored.
13909 (define_insn "eh_set_lr_<mode>"
13910 [(unspec_volatile [(match_operand:P 0 "register_operand" "r")]
13912 (clobber (match_scratch:P 1 "=&b"))]
13917 [(unspec_volatile [(match_operand 0 "register_operand" "")] UNSPECV_EH_RR)
13918 (clobber (match_scratch 1 ""))]
13923 rs6000_emit_eh_reg_restore (operands[0], operands[1]);
13927 (define_insn "prefetch"
13928 [(prefetch (match_operand:V4SI 0 "address_operand" "p")
13929 (match_operand:SI 1 "const_int_operand" "n")
13930 (match_operand:SI 2 "const_int_operand" "n"))]
13934 if (GET_CODE (operands[0]) == REG)
13935 return INTVAL (operands[1]) ? \"dcbtst 0,%0\" : \"dcbt 0,%0\";
13936 return INTVAL (operands[1]) ? \"dcbtst %a0\" : \"dcbt %a0\";
13938 [(set_attr "type" "load")])
13941 (include "sync.md")
13942 (include "altivec.md")