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, 2006, 2007, 2008, 2009, 2010
4 ;; Free Software Foundation, Inc.
5 ;; Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
7 ;; This file is part of GCC.
9 ;; GCC is free software; you can redistribute it and/or modify it
10 ;; under the terms of the GNU General Public License as published
11 ;; by the Free Software Foundation; either version 3, or (at your
12 ;; option) any later version.
14 ;; GCC is distributed in the hope that it will be useful, but WITHOUT
15 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
17 ;; License for more details.
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GCC; see the file COPYING3. If not see
21 ;; <http://www.gnu.org/licenses/>.
23 ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
43 (FIRST_ALTIVEC_REGNO 77)
44 (LAST_ALTIVEC_REGNO 108)
57 [(UNSPEC_FRSP 0) ; frsp for POWER machines
58 (UNSPEC_PROBE_STACK 4) ; probe stack memory reference
59 (UNSPEC_TIE 5) ; tie stack contents and stack pointer
60 (UNSPEC_TOCPTR 6) ; address of a word pointing to the TOC
61 (UNSPEC_TOC 7) ; address of the TOC (more-or-less)
63 (UNSPEC_MV_CR_OV 9) ; move_from_CR_ov_bit
69 (UNSPEC_LD_MPIC 15) ; load_macho_picbase
70 (UNSPEC_MPIC_CORRECT 16) ; macho_correct_pic
73 (UNSPEC_MOVESI_FROM_CR 19)
74 (UNSPEC_MOVESI_TO_CR 20)
76 (UNSPEC_TLSDTPRELHA 22)
77 (UNSPEC_TLSDTPRELLO 23)
78 (UNSPEC_TLSGOTDTPREL 24)
80 (UNSPEC_TLSTPRELHA 26)
81 (UNSPEC_TLSTPRELLO 27)
82 (UNSPEC_TLSGOTTPREL 28)
84 (UNSPEC_FIX_TRUNC_TF 30) ; fadd, rounding towards zero
85 (UNSPEC_MV_CR_GT 31) ; move_from_CR_gt_bit
101 (UNSPEC_DLMZB_STRLEN 47)
104 (UNSPEC_MACHOPIC_OFFSET 50)
109 ;; UNSPEC_VOLATILE usage
114 (UNSPECV_LL 1) ; load-locked
115 (UNSPECV_SC 2) ; store-conditional
116 (UNSPECV_EH_RR 9) ; eh_reg_restore
119 ;; Define an insn type attribute. This is used in function unit delay
121 (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,var_delayed_compare,delayed_compare,imul_compare,lmul_compare,fpcompare,cr_logical,delayed_cr,mfcr,mfcrf,mtcr,mfjmpr,mtjmpr,fp,fpsimple,dmul,sdiv,ddiv,ssqrt,dsqrt,jmpreg,brinc,vecsimple,veccomplex,vecdiv,veccmp,veccmpsimple,vecperm,vecfloat,vecfdiv,isync,sync,load_l,store_c,shift,trap,insert_dword,var_shift_rotate,cntlz,exts,mffgpr,mftgpr,isel"
122 (const_string "integer"))
124 ;; Define floating point instruction sub-types for use with Xfpu.md
125 (define_attr "fp_type" "fp_default,fp_addsub_s,fp_addsub_d,fp_mul_s,fp_mul_d,fp_div_s,fp_div_d,fp_maddsub_s,fp_maddsub_d,fp_sqrt_s,fp_sqrt_d" (const_string "fp_default"))
127 ;; Length (in bytes).
128 ; '(pc)' in the following doesn't include the instruction itself; it is
129 ; calculated as if the instruction had zero size.
130 (define_attr "length" ""
131 (if_then_else (eq_attr "type" "branch")
132 (if_then_else (and (ge (minus (match_dup 0) (pc))
134 (lt (minus (match_dup 0) (pc))
140 ;; Processor type -- this attribute must exactly match the processor_type
141 ;; enumeration in rs6000.h.
143 (define_attr "cpu" "rios1,rios2,rs64a,mpccore,ppc403,ppc405,ppc440,ppc476,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630,ppc750,ppc7400,ppc7450,ppc8540,ppce300c2,ppce300c3,ppce500mc,ppce500mc64,power4,power5,power6,power7,cell,ppca2"
144 (const (symbol_ref "rs6000_cpu_attr")))
147 ;; If this instruction is microcoded on the CELL processor
148 ; The default for load extended, the recorded instructions and rotate/shifts by a variable is always microcoded
149 (define_attr "cell_micro" "not,conditional,always"
150 (if_then_else (eq_attr "type" "compare,delayed_compare,imul_compare,lmul_compare,load_ext,load_ext_ux,var_shift_rotate,var_delayed_compare")
151 (const_string "always")
152 (const_string "not")))
154 (automata_option "ndfa")
168 (include "e300c2c3.md")
169 (include "e500mc.md")
170 (include "e500mc64.md")
171 (include "power4.md")
172 (include "power5.md")
173 (include "power6.md")
174 (include "power7.md")
179 (include "predicates.md")
180 (include "constraints.md")
182 (include "darwin.md")
187 ; This mode iterator allows :GPR to be used to indicate the allowable size
188 ; of whole values in GPRs.
189 (define_mode_iterator GPR [SI (DI "TARGET_POWERPC64")])
191 ; Any supported integer mode.
192 (define_mode_iterator INT [QI HI SI DI TI])
194 ; Any supported integer mode that fits in one register.
195 (define_mode_iterator INT1 [QI HI SI (DI "TARGET_POWERPC64")])
197 ; extend modes for DImode
198 (define_mode_iterator QHSI [QI HI SI])
200 ; SImode or DImode, even if DImode doesn't fit in GPRs.
201 (define_mode_iterator SDI [SI DI])
203 ; The size of a pointer. Also, the size of the value that a record-condition
204 ; (one with a '.') will compare.
205 (define_mode_iterator P [(SI "TARGET_32BIT") (DI "TARGET_64BIT")])
207 ; Any hardware-supported floating-point mode
208 (define_mode_iterator FP [
209 (SF "TARGET_HARD_FLOAT
210 && ((TARGET_FPRS && TARGET_SINGLE_FLOAT) || TARGET_E500_SINGLE)")
211 (DF "TARGET_HARD_FLOAT
212 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)")
213 (TF "!TARGET_IEEEQUAD
215 && (TARGET_FPRS || TARGET_E500_DOUBLE)
216 && TARGET_LONG_DOUBLE_128")
220 ; Various instructions that come in SI and DI forms.
221 ; A generic w/d attribute, for things like cmpw/cmpd.
222 (define_mode_attr wd [(QI "b") (HI "h") (SI "w") (DI "d")])
225 (define_mode_attr dbits [(QI "56") (HI "48") (SI "32")])
227 ;; ISEL/ISEL64 target selection
228 (define_mode_attr sel [(SI "") (DI "64")])
230 ;; Suffix for reload patterns
231 (define_mode_attr ptrsize [(SI "32bit")
234 (define_mode_attr tptrsize [(SI "TARGET_32BIT")
235 (DI "TARGET_64BIT")])
237 (define_mode_attr mptrsize [(SI "si")
241 ;; Start with fixed-point load and store insns. Here we put only the more
242 ;; complex forms. Basic data transfer is done later.
244 (define_expand "zero_extend<mode>di2"
245 [(set (match_operand:DI 0 "gpc_reg_operand" "")
246 (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "")))]
250 (define_insn "*zero_extend<mode>di2_internal1"
251 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
252 (zero_extend:DI (match_operand:QHSI 1 "reg_or_mem_operand" "m,r")))]
256 rldicl %0,%1,0,<dbits>"
257 [(set_attr "type" "load,*")])
259 (define_insn "*zero_extend<mode>di2_internal2"
260 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
261 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "r,r"))
263 (clobber (match_scratch:DI 2 "=r,r"))]
266 rldicl. %2,%1,0,<dbits>
268 [(set_attr "type" "compare")
269 (set_attr "length" "4,8")])
272 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
273 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" ""))
275 (clobber (match_scratch:DI 2 ""))]
276 "TARGET_POWERPC64 && reload_completed"
278 (zero_extend:DI (match_dup 1)))
280 (compare:CC (match_dup 2)
284 (define_insn "*zero_extend<mode>di2_internal3"
285 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
286 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "r,r"))
288 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
289 (zero_extend:DI (match_dup 1)))]
292 rldicl. %0,%1,0,<dbits>
294 [(set_attr "type" "compare")
295 (set_attr "length" "4,8")])
298 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
299 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" ""))
301 (set (match_operand:DI 0 "gpc_reg_operand" "")
302 (zero_extend:DI (match_dup 1)))]
303 "TARGET_POWERPC64 && reload_completed"
305 (zero_extend:DI (match_dup 1)))
307 (compare:CC (match_dup 0)
311 (define_insn "extendqidi2"
312 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
313 (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r")))]
316 [(set_attr "type" "exts")])
319 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
320 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
322 (clobber (match_scratch:DI 2 "=r,r"))]
327 [(set_attr "type" "compare")
328 (set_attr "length" "4,8")])
331 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
332 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
334 (clobber (match_scratch:DI 2 ""))]
335 "TARGET_POWERPC64 && reload_completed"
337 (sign_extend:DI (match_dup 1)))
339 (compare:CC (match_dup 2)
344 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
345 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
347 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
348 (sign_extend:DI (match_dup 1)))]
353 [(set_attr "type" "compare")
354 (set_attr "length" "4,8")])
357 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
358 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
360 (set (match_operand:DI 0 "gpc_reg_operand" "")
361 (sign_extend:DI (match_dup 1)))]
362 "TARGET_POWERPC64 && reload_completed"
364 (sign_extend:DI (match_dup 1)))
366 (compare:CC (match_dup 0)
370 (define_expand "extendhidi2"
371 [(set (match_operand:DI 0 "gpc_reg_operand" "")
372 (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "")))]
377 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
378 (sign_extend:DI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
379 "TARGET_POWERPC64 && rs6000_gen_cell_microcode"
383 [(set_attr "type" "load_ext,exts")])
386 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
387 (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r")))]
388 "TARGET_POWERPC64 && !rs6000_gen_cell_microcode"
390 [(set_attr "type" "exts")])
393 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
394 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
396 (clobber (match_scratch:DI 2 "=r,r"))]
401 [(set_attr "type" "compare")
402 (set_attr "length" "4,8")])
405 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
406 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
408 (clobber (match_scratch:DI 2 ""))]
409 "TARGET_POWERPC64 && reload_completed"
411 (sign_extend:DI (match_dup 1)))
413 (compare:CC (match_dup 2)
418 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
419 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
421 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
422 (sign_extend:DI (match_dup 1)))]
427 [(set_attr "type" "compare")
428 (set_attr "length" "4,8")])
431 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
432 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
434 (set (match_operand:DI 0 "gpc_reg_operand" "")
435 (sign_extend:DI (match_dup 1)))]
436 "TARGET_POWERPC64 && reload_completed"
438 (sign_extend:DI (match_dup 1)))
440 (compare:CC (match_dup 0)
444 (define_expand "extendsidi2"
445 [(set (match_operand:DI 0 "gpc_reg_operand" "")
446 (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")))]
451 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
452 (sign_extend:DI (match_operand:SI 1 "lwa_operand" "m,r")))]
453 "TARGET_POWERPC64 && rs6000_gen_cell_microcode"
457 [(set_attr "type" "load_ext,exts")])
460 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
461 (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r")))]
462 "TARGET_POWERPC64 && !rs6000_gen_cell_microcode"
464 [(set_attr "type" "exts")])
467 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
468 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
470 (clobber (match_scratch:DI 2 "=r,r"))]
475 [(set_attr "type" "compare")
476 (set_attr "length" "4,8")])
479 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
480 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
482 (clobber (match_scratch:DI 2 ""))]
483 "TARGET_POWERPC64 && reload_completed"
485 (sign_extend:DI (match_dup 1)))
487 (compare:CC (match_dup 2)
492 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
493 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
495 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
496 (sign_extend:DI (match_dup 1)))]
501 [(set_attr "type" "compare")
502 (set_attr "length" "4,8")])
505 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
506 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
508 (set (match_operand:DI 0 "gpc_reg_operand" "")
509 (sign_extend:DI (match_dup 1)))]
510 "TARGET_POWERPC64 && reload_completed"
512 (sign_extend:DI (match_dup 1)))
514 (compare:CC (match_dup 0)
518 (define_expand "zero_extendqisi2"
519 [(set (match_operand:SI 0 "gpc_reg_operand" "")
520 (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "")))]
525 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
526 (zero_extend:SI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
530 {rlinm|rlwinm} %0,%1,0,0xff"
531 [(set_attr "type" "load,*")])
534 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
535 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
537 (clobber (match_scratch:SI 2 "=r,r"))]
540 {andil.|andi.} %2,%1,0xff
542 [(set_attr "type" "fast_compare,compare")
543 (set_attr "length" "4,8")])
546 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
547 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
549 (clobber (match_scratch:SI 2 ""))]
552 (zero_extend:SI (match_dup 1)))
554 (compare:CC (match_dup 2)
559 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
560 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
562 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
563 (zero_extend:SI (match_dup 1)))]
566 {andil.|andi.} %0,%1,0xff
568 [(set_attr "type" "fast_compare,compare")
569 (set_attr "length" "4,8")])
572 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
573 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
575 (set (match_operand:SI 0 "gpc_reg_operand" "")
576 (zero_extend:SI (match_dup 1)))]
579 (zero_extend:SI (match_dup 1)))
581 (compare:CC (match_dup 0)
585 (define_expand "extendqisi2"
586 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
587 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
592 emit_insn (gen_extendqisi2_ppc (operands[0], operands[1]));
593 else if (TARGET_POWER)
594 emit_insn (gen_extendqisi2_power (operands[0], operands[1]));
596 emit_insn (gen_extendqisi2_no_power (operands[0], operands[1]));
600 (define_insn "extendqisi2_ppc"
601 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
602 (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r")))]
605 [(set_attr "type" "exts")])
608 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
609 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
611 (clobber (match_scratch:SI 2 "=r,r"))]
616 [(set_attr "type" "compare")
617 (set_attr "length" "4,8")])
620 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
621 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
623 (clobber (match_scratch:SI 2 ""))]
624 "TARGET_POWERPC && reload_completed"
626 (sign_extend:SI (match_dup 1)))
628 (compare:CC (match_dup 2)
633 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
634 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
636 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
637 (sign_extend:SI (match_dup 1)))]
642 [(set_attr "type" "compare")
643 (set_attr "length" "4,8")])
646 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
647 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
649 (set (match_operand:SI 0 "gpc_reg_operand" "")
650 (sign_extend:SI (match_dup 1)))]
651 "TARGET_POWERPC && reload_completed"
653 (sign_extend:SI (match_dup 1)))
655 (compare:CC (match_dup 0)
659 (define_expand "extendqisi2_power"
660 [(parallel [(set (match_dup 2)
661 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
663 (clobber (scratch:SI))])
664 (parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
665 (ashiftrt:SI (match_dup 2)
667 (clobber (scratch:SI))])]
670 { operands[1] = gen_lowpart (SImode, operands[1]);
671 operands[2] = gen_reg_rtx (SImode); }")
673 (define_expand "extendqisi2_no_power"
675 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
677 (set (match_operand:SI 0 "gpc_reg_operand" "")
678 (ashiftrt:SI (match_dup 2)
680 "! TARGET_POWER && ! TARGET_POWERPC"
682 { operands[1] = gen_lowpart (SImode, operands[1]);
683 operands[2] = gen_reg_rtx (SImode); }")
685 (define_expand "zero_extendqihi2"
686 [(set (match_operand:HI 0 "gpc_reg_operand" "")
687 (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "")))]
692 [(set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
693 (zero_extend:HI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
697 {rlinm|rlwinm} %0,%1,0,0xff"
698 [(set_attr "type" "load,*")])
701 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
702 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
704 (clobber (match_scratch:HI 2 "=r,r"))]
707 {andil.|andi.} %2,%1,0xff
709 [(set_attr "type" "fast_compare,compare")
710 (set_attr "length" "4,8")])
713 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
714 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
716 (clobber (match_scratch:HI 2 ""))]
719 (zero_extend:HI (match_dup 1)))
721 (compare:CC (match_dup 2)
726 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
727 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
729 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
730 (zero_extend:HI (match_dup 1)))]
733 {andil.|andi.} %0,%1,0xff
735 [(set_attr "type" "fast_compare,compare")
736 (set_attr "length" "4,8")])
739 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
740 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
742 (set (match_operand:HI 0 "gpc_reg_operand" "")
743 (zero_extend:HI (match_dup 1)))]
746 (zero_extend:HI (match_dup 1)))
748 (compare:CC (match_dup 0)
752 (define_expand "extendqihi2"
753 [(use (match_operand:HI 0 "gpc_reg_operand" ""))
754 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
759 emit_insn (gen_extendqihi2_ppc (operands[0], operands[1]));
760 else if (TARGET_POWER)
761 emit_insn (gen_extendqihi2_power (operands[0], operands[1]));
763 emit_insn (gen_extendqihi2_no_power (operands[0], operands[1]));
767 (define_insn "extendqihi2_ppc"
768 [(set (match_operand:HI 0 "gpc_reg_operand" "=r")
769 (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r")))]
772 [(set_attr "type" "exts")])
775 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
776 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
778 (clobber (match_scratch:HI 2 "=r,r"))]
783 [(set_attr "type" "compare")
784 (set_attr "length" "4,8")])
787 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
788 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
790 (clobber (match_scratch:HI 2 ""))]
791 "TARGET_POWERPC && reload_completed"
793 (sign_extend:HI (match_dup 1)))
795 (compare:CC (match_dup 2)
800 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
801 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
803 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
804 (sign_extend:HI (match_dup 1)))]
809 [(set_attr "type" "compare")
810 (set_attr "length" "4,8")])
813 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
814 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
816 (set (match_operand:HI 0 "gpc_reg_operand" "")
817 (sign_extend:HI (match_dup 1)))]
818 "TARGET_POWERPC && reload_completed"
820 (sign_extend:HI (match_dup 1)))
822 (compare:CC (match_dup 0)
826 (define_expand "extendqihi2_power"
827 [(parallel [(set (match_dup 2)
828 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
830 (clobber (scratch:SI))])
831 (parallel [(set (match_operand:HI 0 "gpc_reg_operand" "")
832 (ashiftrt:SI (match_dup 2)
834 (clobber (scratch:SI))])]
837 { operands[0] = gen_lowpart (SImode, operands[0]);
838 operands[1] = gen_lowpart (SImode, operands[1]);
839 operands[2] = gen_reg_rtx (SImode); }")
841 (define_expand "extendqihi2_no_power"
843 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
845 (set (match_operand:HI 0 "gpc_reg_operand" "")
846 (ashiftrt:SI (match_dup 2)
848 "! TARGET_POWER && ! TARGET_POWERPC"
850 { operands[0] = gen_lowpart (SImode, operands[0]);
851 operands[1] = gen_lowpart (SImode, operands[1]);
852 operands[2] = gen_reg_rtx (SImode); }")
854 (define_expand "zero_extendhisi2"
855 [(set (match_operand:SI 0 "gpc_reg_operand" "")
856 (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
861 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
862 (zero_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
866 {rlinm|rlwinm} %0,%1,0,0xffff"
867 [(set_attr "type" "load,*")])
870 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
871 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
873 (clobber (match_scratch:SI 2 "=r,r"))]
876 {andil.|andi.} %2,%1,0xffff
878 [(set_attr "type" "fast_compare,compare")
879 (set_attr "length" "4,8")])
882 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
883 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
885 (clobber (match_scratch:SI 2 ""))]
888 (zero_extend:SI (match_dup 1)))
890 (compare:CC (match_dup 2)
895 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
896 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
898 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
899 (zero_extend:SI (match_dup 1)))]
902 {andil.|andi.} %0,%1,0xffff
904 [(set_attr "type" "fast_compare,compare")
905 (set_attr "length" "4,8")])
908 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
909 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
911 (set (match_operand:SI 0 "gpc_reg_operand" "")
912 (zero_extend:SI (match_dup 1)))]
915 (zero_extend:SI (match_dup 1)))
917 (compare:CC (match_dup 0)
921 (define_expand "extendhisi2"
922 [(set (match_operand:SI 0 "gpc_reg_operand" "")
923 (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
928 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
929 (sign_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
930 "rs6000_gen_cell_microcode"
934 [(set_attr "type" "load_ext,exts")])
937 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
938 (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r")))]
939 "!rs6000_gen_cell_microcode"
941 [(set_attr "type" "exts")])
944 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
945 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
947 (clobber (match_scratch:SI 2 "=r,r"))]
952 [(set_attr "type" "compare")
953 (set_attr "length" "4,8")])
956 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
957 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
959 (clobber (match_scratch:SI 2 ""))]
962 (sign_extend:SI (match_dup 1)))
964 (compare:CC (match_dup 2)
969 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
970 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
972 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
973 (sign_extend:SI (match_dup 1)))]
978 [(set_attr "type" "compare")
979 (set_attr "length" "4,8")])
981 ;; IBM 405, 440, 464 and 476 half-word multiplication operations.
983 (define_insn "*macchwc"
984 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
985 (compare:CC (plus:SI (mult:SI (ashiftrt:SI
986 (match_operand:SI 2 "gpc_reg_operand" "r")
989 (match_operand:HI 1 "gpc_reg_operand" "r")))
990 (match_operand:SI 4 "gpc_reg_operand" "0"))
992 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
993 (plus:SI (mult:SI (ashiftrt:SI
1000 "macchw. %0, %1, %2"
1001 [(set_attr "type" "imul3")])
1003 (define_insn "*macchw"
1004 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1005 (plus:SI (mult:SI (ashiftrt:SI
1006 (match_operand:SI 2 "gpc_reg_operand" "r")
1009 (match_operand:HI 1 "gpc_reg_operand" "r")))
1010 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1013 [(set_attr "type" "imul3")])
1015 (define_insn "*macchwuc"
1016 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1017 (compare:CC (plus:SI (mult:SI (lshiftrt:SI
1018 (match_operand:SI 2 "gpc_reg_operand" "r")
1021 (match_operand:HI 1 "gpc_reg_operand" "r")))
1022 (match_operand:SI 4 "gpc_reg_operand" "0"))
1024 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1025 (plus:SI (mult:SI (lshiftrt:SI
1032 "macchwu. %0, %1, %2"
1033 [(set_attr "type" "imul3")])
1035 (define_insn "*macchwu"
1036 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1037 (plus:SI (mult:SI (lshiftrt:SI
1038 (match_operand:SI 2 "gpc_reg_operand" "r")
1041 (match_operand:HI 1 "gpc_reg_operand" "r")))
1042 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1044 "macchwu %0, %1, %2"
1045 [(set_attr "type" "imul3")])
1047 (define_insn "*machhwc"
1048 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1049 (compare:CC (plus:SI (mult:SI (ashiftrt:SI
1050 (match_operand:SI 1 "gpc_reg_operand" "%r")
1053 (match_operand:SI 2 "gpc_reg_operand" "r")
1055 (match_operand:SI 4 "gpc_reg_operand" "0"))
1057 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1058 (plus:SI (mult:SI (ashiftrt:SI
1066 "machhw. %0, %1, %2"
1067 [(set_attr "type" "imul3")])
1069 (define_insn "*machhw"
1070 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1071 (plus:SI (mult:SI (ashiftrt:SI
1072 (match_operand:SI 1 "gpc_reg_operand" "%r")
1075 (match_operand:SI 2 "gpc_reg_operand" "r")
1077 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1080 [(set_attr "type" "imul3")])
1082 (define_insn "*machhwuc"
1083 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1084 (compare:CC (plus:SI (mult:SI (lshiftrt:SI
1085 (match_operand:SI 1 "gpc_reg_operand" "%r")
1088 (match_operand:SI 2 "gpc_reg_operand" "r")
1090 (match_operand:SI 4 "gpc_reg_operand" "0"))
1092 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1093 (plus:SI (mult:SI (lshiftrt:SI
1101 "machhwu. %0, %1, %2"
1102 [(set_attr "type" "imul3")])
1104 (define_insn "*machhwu"
1105 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1106 (plus:SI (mult:SI (lshiftrt:SI
1107 (match_operand:SI 1 "gpc_reg_operand" "%r")
1110 (match_operand:SI 2 "gpc_reg_operand" "r")
1112 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1114 "machhwu %0, %1, %2"
1115 [(set_attr "type" "imul3")])
1117 (define_insn "*maclhwc"
1118 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1119 (compare:CC (plus:SI (mult:SI (sign_extend:SI
1120 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1122 (match_operand:HI 2 "gpc_reg_operand" "r")))
1123 (match_operand:SI 4 "gpc_reg_operand" "0"))
1125 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1126 (plus:SI (mult:SI (sign_extend:SI
1132 "maclhw. %0, %1, %2"
1133 [(set_attr "type" "imul3")])
1135 (define_insn "*maclhw"
1136 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1137 (plus:SI (mult:SI (sign_extend:SI
1138 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1140 (match_operand:HI 2 "gpc_reg_operand" "r")))
1141 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1144 [(set_attr "type" "imul3")])
1146 (define_insn "*maclhwuc"
1147 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1148 (compare:CC (plus:SI (mult:SI (zero_extend:SI
1149 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1151 (match_operand:HI 2 "gpc_reg_operand" "r")))
1152 (match_operand:SI 4 "gpc_reg_operand" "0"))
1154 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1155 (plus:SI (mult:SI (zero_extend:SI
1161 "maclhwu. %0, %1, %2"
1162 [(set_attr "type" "imul3")])
1164 (define_insn "*maclhwu"
1165 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1166 (plus:SI (mult:SI (zero_extend:SI
1167 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1169 (match_operand:HI 2 "gpc_reg_operand" "r")))
1170 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1172 "maclhwu %0, %1, %2"
1173 [(set_attr "type" "imul3")])
1175 (define_insn "*nmacchwc"
1176 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1177 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1178 (mult:SI (ashiftrt:SI
1179 (match_operand:SI 2 "gpc_reg_operand" "r")
1182 (match_operand:HI 1 "gpc_reg_operand" "r"))))
1184 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1185 (minus:SI (match_dup 4)
1186 (mult:SI (ashiftrt:SI
1192 "nmacchw. %0, %1, %2"
1193 [(set_attr "type" "imul3")])
1195 (define_insn "*nmacchw"
1196 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1197 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1198 (mult:SI (ashiftrt:SI
1199 (match_operand:SI 2 "gpc_reg_operand" "r")
1202 (match_operand:HI 1 "gpc_reg_operand" "r")))))]
1204 "nmacchw %0, %1, %2"
1205 [(set_attr "type" "imul3")])
1207 (define_insn "*nmachhwc"
1208 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1209 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1210 (mult:SI (ashiftrt:SI
1211 (match_operand:SI 1 "gpc_reg_operand" "%r")
1214 (match_operand:SI 2 "gpc_reg_operand" "r")
1217 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1218 (minus:SI (match_dup 4)
1219 (mult:SI (ashiftrt:SI
1226 "nmachhw. %0, %1, %2"
1227 [(set_attr "type" "imul3")])
1229 (define_insn "*nmachhw"
1230 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1231 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1232 (mult:SI (ashiftrt:SI
1233 (match_operand:SI 1 "gpc_reg_operand" "%r")
1236 (match_operand:SI 2 "gpc_reg_operand" "r")
1239 "nmachhw %0, %1, %2"
1240 [(set_attr "type" "imul3")])
1242 (define_insn "*nmaclhwc"
1243 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1244 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1245 (mult:SI (sign_extend:SI
1246 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1248 (match_operand:HI 2 "gpc_reg_operand" "r"))))
1250 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1251 (minus:SI (match_dup 4)
1252 (mult:SI (sign_extend:SI
1257 "nmaclhw. %0, %1, %2"
1258 [(set_attr "type" "imul3")])
1260 (define_insn "*nmaclhw"
1261 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1262 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1263 (mult:SI (sign_extend:SI
1264 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1266 (match_operand:HI 2 "gpc_reg_operand" "r")))))]
1268 "nmaclhw %0, %1, %2"
1269 [(set_attr "type" "imul3")])
1271 (define_insn "*mulchwc"
1272 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1273 (compare:CC (mult:SI (ashiftrt:SI
1274 (match_operand:SI 2 "gpc_reg_operand" "r")
1277 (match_operand:HI 1 "gpc_reg_operand" "r")))
1279 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1280 (mult:SI (ashiftrt:SI
1286 "mulchw. %0, %1, %2"
1287 [(set_attr "type" "imul3")])
1289 (define_insn "*mulchw"
1290 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1291 (mult:SI (ashiftrt:SI
1292 (match_operand:SI 2 "gpc_reg_operand" "r")
1295 (match_operand:HI 1 "gpc_reg_operand" "r"))))]
1298 [(set_attr "type" "imul3")])
1300 (define_insn "*mulchwuc"
1301 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1302 (compare:CC (mult:SI (lshiftrt:SI
1303 (match_operand:SI 2 "gpc_reg_operand" "r")
1306 (match_operand:HI 1 "gpc_reg_operand" "r")))
1308 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1309 (mult:SI (lshiftrt:SI
1315 "mulchwu. %0, %1, %2"
1316 [(set_attr "type" "imul3")])
1318 (define_insn "*mulchwu"
1319 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1320 (mult:SI (lshiftrt:SI
1321 (match_operand:SI 2 "gpc_reg_operand" "r")
1324 (match_operand:HI 1 "gpc_reg_operand" "r"))))]
1326 "mulchwu %0, %1, %2"
1327 [(set_attr "type" "imul3")])
1329 (define_insn "*mulhhwc"
1330 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1331 (compare:CC (mult:SI (ashiftrt:SI
1332 (match_operand:SI 1 "gpc_reg_operand" "%r")
1335 (match_operand:SI 2 "gpc_reg_operand" "r")
1338 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1339 (mult:SI (ashiftrt:SI
1346 "mulhhw. %0, %1, %2"
1347 [(set_attr "type" "imul3")])
1349 (define_insn "*mulhhw"
1350 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1351 (mult:SI (ashiftrt:SI
1352 (match_operand:SI 1 "gpc_reg_operand" "%r")
1355 (match_operand:SI 2 "gpc_reg_operand" "r")
1359 [(set_attr "type" "imul3")])
1361 (define_insn "*mulhhwuc"
1362 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1363 (compare:CC (mult:SI (lshiftrt:SI
1364 (match_operand:SI 1 "gpc_reg_operand" "%r")
1367 (match_operand:SI 2 "gpc_reg_operand" "r")
1370 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1371 (mult:SI (lshiftrt:SI
1378 "mulhhwu. %0, %1, %2"
1379 [(set_attr "type" "imul3")])
1381 (define_insn "*mulhhwu"
1382 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1383 (mult:SI (lshiftrt:SI
1384 (match_operand:SI 1 "gpc_reg_operand" "%r")
1387 (match_operand:SI 2 "gpc_reg_operand" "r")
1390 "mulhhwu %0, %1, %2"
1391 [(set_attr "type" "imul3")])
1393 (define_insn "*mullhwc"
1394 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1395 (compare:CC (mult:SI (sign_extend:SI
1396 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1398 (match_operand:HI 2 "gpc_reg_operand" "r")))
1400 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1401 (mult:SI (sign_extend:SI
1406 "mullhw. %0, %1, %2"
1407 [(set_attr "type" "imul3")])
1409 (define_insn "*mullhw"
1410 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1411 (mult:SI (sign_extend:SI
1412 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1414 (match_operand:HI 2 "gpc_reg_operand" "r"))))]
1417 [(set_attr "type" "imul3")])
1419 (define_insn "*mullhwuc"
1420 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1421 (compare:CC (mult:SI (zero_extend:SI
1422 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1424 (match_operand:HI 2 "gpc_reg_operand" "r")))
1426 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1427 (mult:SI (zero_extend:SI
1432 "mullhwu. %0, %1, %2"
1433 [(set_attr "type" "imul3")])
1435 (define_insn "*mullhwu"
1436 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1437 (mult:SI (zero_extend:SI
1438 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1440 (match_operand:HI 2 "gpc_reg_operand" "r"))))]
1442 "mullhwu %0, %1, %2"
1443 [(set_attr "type" "imul3")])
1445 ;; IBM 405, 440, 464 and 476 string-search dlmzb instruction support.
1446 (define_insn "dlmzb"
1447 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1448 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
1449 (match_operand:SI 2 "gpc_reg_operand" "r")]
1451 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1452 (unspec:SI [(match_dup 1)
1456 "dlmzb. %0, %1, %2")
1458 (define_expand "strlensi"
1459 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1460 (unspec:SI [(match_operand:BLK 1 "general_operand" "")
1461 (match_operand:QI 2 "const_int_operand" "")
1462 (match_operand 3 "const_int_operand" "")]
1463 UNSPEC_DLMZB_STRLEN))
1464 (clobber (match_scratch:CC 4 "=x"))]
1465 "TARGET_DLMZB && WORDS_BIG_ENDIAN && !optimize_size"
1467 rtx result = operands[0];
1468 rtx src = operands[1];
1469 rtx search_char = operands[2];
1470 rtx align = operands[3];
1471 rtx addr, scratch_string, word1, word2, scratch_dlmzb;
1472 rtx loop_label, end_label, mem, cr0, cond;
1473 if (search_char != const0_rtx
1474 || GET_CODE (align) != CONST_INT
1475 || INTVAL (align) < 8)
1477 word1 = gen_reg_rtx (SImode);
1478 word2 = gen_reg_rtx (SImode);
1479 scratch_dlmzb = gen_reg_rtx (SImode);
1480 scratch_string = gen_reg_rtx (Pmode);
1481 loop_label = gen_label_rtx ();
1482 end_label = gen_label_rtx ();
1483 addr = force_reg (Pmode, XEXP (src, 0));
1484 emit_move_insn (scratch_string, addr);
1485 emit_label (loop_label);
1486 mem = change_address (src, SImode, scratch_string);
1487 emit_move_insn (word1, mem);
1488 emit_move_insn (word2, adjust_address (mem, SImode, 4));
1489 cr0 = gen_rtx_REG (CCmode, CR0_REGNO);
1490 emit_insn (gen_dlmzb (scratch_dlmzb, word1, word2, cr0));
1491 cond = gen_rtx_NE (VOIDmode, cr0, const0_rtx);
1492 emit_jump_insn (gen_rtx_SET (VOIDmode,
1494 gen_rtx_IF_THEN_ELSE (VOIDmode,
1500 emit_insn (gen_addsi3 (scratch_string, scratch_string, GEN_INT (8)));
1501 emit_jump_insn (gen_rtx_SET (VOIDmode,
1503 gen_rtx_LABEL_REF (VOIDmode, loop_label)));
1505 emit_label (end_label);
1506 emit_insn (gen_addsi3 (scratch_string, scratch_string, scratch_dlmzb));
1507 emit_insn (gen_subsi3 (result, scratch_string, addr));
1508 emit_insn (gen_subsi3 (result, result, const1_rtx));
1513 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
1514 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1516 (set (match_operand:SI 0 "gpc_reg_operand" "")
1517 (sign_extend:SI (match_dup 1)))]
1520 (sign_extend:SI (match_dup 1)))
1522 (compare:CC (match_dup 0)
1526 ;; Fixed-point arithmetic insns.
1528 (define_expand "add<mode>3"
1529 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1530 (plus:SDI (match_operand:SDI 1 "gpc_reg_operand" "")
1531 (match_operand:SDI 2 "reg_or_add_cint_operand" "")))]
1534 if (<MODE>mode == DImode && ! TARGET_POWERPC64)
1536 if (non_short_cint_operand (operands[2], DImode))
1539 else if (GET_CODE (operands[2]) == CONST_INT
1540 && ! add_operand (operands[2], <MODE>mode))
1542 rtx tmp = ((!can_create_pseudo_p ()
1543 || rtx_equal_p (operands[0], operands[1]))
1544 ? operands[0] : gen_reg_rtx (<MODE>mode));
1546 HOST_WIDE_INT val = INTVAL (operands[2]);
1547 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1548 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, <MODE>mode);
1550 if (<MODE>mode == DImode && !satisfies_constraint_L (GEN_INT (rest)))
1553 /* The ordering here is important for the prolog expander.
1554 When space is allocated from the stack, adding 'low' first may
1555 produce a temporary deallocation (which would be bad). */
1556 emit_insn (gen_add<mode>3 (tmp, operands[1], GEN_INT (rest)));
1557 emit_insn (gen_add<mode>3 (operands[0], tmp, GEN_INT (low)));
1562 ;; Discourage ai/addic because of carry but provide it in an alternative
1563 ;; allowing register zero as source.
1564 (define_insn "*add<mode>3_internal1"
1565 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r,?r,r")
1566 (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "%r,b,r,b")
1567 (match_operand:GPR 2 "add_operand" "r,I,I,L")))]
1568 "!DECIMAL_FLOAT_MODE_P (GET_MODE (operands[0])) && !DECIMAL_FLOAT_MODE_P (GET_MODE (operands[1]))"
1571 {cal %0,%2(%1)|addi %0,%1,%2}
1573 {cau|addis} %0,%1,%v2"
1574 [(set_attr "length" "4,4,4,4")])
1576 (define_insn "addsi3_high"
1577 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
1578 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
1579 (high:SI (match_operand 2 "" ""))))]
1580 "TARGET_MACHO && !TARGET_64BIT"
1581 "{cau|addis} %0,%1,ha16(%2)"
1582 [(set_attr "length" "4")])
1584 (define_insn "*add<mode>3_internal2"
1585 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
1586 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "%r,r,r,r")
1587 (match_operand:P 2 "reg_or_short_operand" "r,I,r,I"))
1589 (clobber (match_scratch:P 3 "=r,r,r,r"))]
1592 {cax.|add.} %3,%1,%2
1593 {ai.|addic.} %3,%1,%2
1596 [(set_attr "type" "fast_compare,compare,compare,compare")
1597 (set_attr "length" "4,4,8,8")])
1600 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1601 (compare:CC (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1602 (match_operand:GPR 2 "reg_or_short_operand" ""))
1604 (clobber (match_scratch:GPR 3 ""))]
1607 (plus:GPR (match_dup 1)
1610 (compare:CC (match_dup 3)
1614 (define_insn "*add<mode>3_internal3"
1615 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
1616 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "%r,r,r,r")
1617 (match_operand:P 2 "reg_or_short_operand" "r,I,r,I"))
1619 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
1620 (plus:P (match_dup 1)
1624 {cax.|add.} %0,%1,%2
1625 {ai.|addic.} %0,%1,%2
1628 [(set_attr "type" "fast_compare,compare,compare,compare")
1629 (set_attr "length" "4,4,8,8")])
1632 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1633 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "")
1634 (match_operand:P 2 "reg_or_short_operand" ""))
1636 (set (match_operand:P 0 "gpc_reg_operand" "")
1637 (plus:P (match_dup 1) (match_dup 2)))]
1640 (plus:P (match_dup 1)
1643 (compare:CC (match_dup 0)
1647 ;; Split an add that we can't do in one insn into two insns, each of which
1648 ;; does one 16-bit part. This is used by combine. Note that the low-order
1649 ;; add should be last in case the result gets used in an address.
1652 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
1653 (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1654 (match_operand:GPR 2 "non_add_cint_operand" "")))]
1656 [(set (match_dup 0) (plus:GPR (match_dup 1) (match_dup 3)))
1657 (set (match_dup 0) (plus:GPR (match_dup 0) (match_dup 4)))]
1659 HOST_WIDE_INT val = INTVAL (operands[2]);
1660 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1661 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, <MODE>mode);
1663 operands[4] = GEN_INT (low);
1664 if (<MODE>mode == SImode || satisfies_constraint_L (GEN_INT (rest)))
1665 operands[3] = GEN_INT (rest);
1666 else if (can_create_pseudo_p ())
1668 operands[3] = gen_reg_rtx (DImode);
1669 emit_move_insn (operands[3], operands[2]);
1670 emit_insn (gen_adddi3 (operands[0], operands[1], operands[3]));
1677 (define_insn "one_cmpl<mode>2"
1678 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1679 (not:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
1684 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1685 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1687 (clobber (match_scratch:P 2 "=r,r"))]
1692 [(set_attr "type" "fast_compare,compare")
1693 (set_attr "length" "4,8")])
1696 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
1697 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" ""))
1699 (clobber (match_scratch:P 2 ""))]
1702 (not:P (match_dup 1)))
1704 (compare:CC (match_dup 2)
1709 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1710 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1712 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
1713 (not:P (match_dup 1)))]
1718 [(set_attr "type" "fast_compare,compare")
1719 (set_attr "length" "4,8")])
1722 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
1723 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" ""))
1725 (set (match_operand:P 0 "gpc_reg_operand" "")
1726 (not:P (match_dup 1)))]
1729 (not:P (match_dup 1)))
1731 (compare:CC (match_dup 0)
1736 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1737 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "rI")
1738 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1740 "{sf%I1|subf%I1c} %0,%2,%1")
1743 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
1744 (minus:GPR (match_operand:GPR 1 "reg_or_short_operand" "r,I")
1745 (match_operand:GPR 2 "gpc_reg_operand" "r,r")))]
1752 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1753 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1754 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1756 (clobber (match_scratch:SI 3 "=r,r"))]
1759 {sf.|subfc.} %3,%2,%1
1761 [(set_attr "type" "compare")
1762 (set_attr "length" "4,8")])
1765 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1766 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "r,r")
1767 (match_operand:P 2 "gpc_reg_operand" "r,r"))
1769 (clobber (match_scratch:P 3 "=r,r"))]
1774 [(set_attr "type" "fast_compare")
1775 (set_attr "length" "4,8")])
1778 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1779 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "")
1780 (match_operand:P 2 "gpc_reg_operand" ""))
1782 (clobber (match_scratch:P 3 ""))]
1785 (minus:P (match_dup 1)
1788 (compare:CC (match_dup 3)
1793 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1794 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1795 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1797 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1798 (minus:SI (match_dup 1) (match_dup 2)))]
1801 {sf.|subfc.} %0,%2,%1
1803 [(set_attr "type" "compare")
1804 (set_attr "length" "4,8")])
1807 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1808 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "r,r")
1809 (match_operand:P 2 "gpc_reg_operand" "r,r"))
1811 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
1812 (minus:P (match_dup 1)
1818 [(set_attr "type" "fast_compare")
1819 (set_attr "length" "4,8")])
1822 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1823 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "")
1824 (match_operand:P 2 "gpc_reg_operand" ""))
1826 (set (match_operand:P 0 "gpc_reg_operand" "")
1827 (minus:P (match_dup 1)
1831 (minus:P (match_dup 1)
1834 (compare:CC (match_dup 0)
1838 (define_expand "sub<mode>3"
1839 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1840 (minus:SDI (match_operand:SDI 1 "reg_or_short_operand" "")
1841 (match_operand:SDI 2 "reg_or_sub_cint_operand" "")))]
1845 if (GET_CODE (operands[2]) == CONST_INT)
1847 emit_insn (gen_add<mode>3 (operands[0], operands[1],
1848 negate_rtx (<MODE>mode, operands[2])));
1853 ;; For SMIN, SMAX, UMIN, and UMAX, we use DEFINE_EXPAND's that involve a doz[i]
1854 ;; instruction and some auxiliary computations. Then we just have a single
1855 ;; DEFINE_INSN for doz[i] and the define_splits to make them if made by
1858 (define_expand "sminsi3"
1860 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1861 (match_operand:SI 2 "reg_or_short_operand" ""))
1863 (minus:SI (match_dup 2) (match_dup 1))))
1864 (set (match_operand:SI 0 "gpc_reg_operand" "")
1865 (minus:SI (match_dup 2) (match_dup 3)))]
1866 "TARGET_POWER || TARGET_ISEL"
1871 operands[2] = force_reg (SImode, operands[2]);
1872 rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]);
1876 operands[3] = gen_reg_rtx (SImode);
1880 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1881 (smin:SI (match_operand:SI 1 "gpc_reg_operand" "")
1882 (match_operand:SI 2 "reg_or_short_operand" "")))
1883 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1886 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1888 (minus:SI (match_dup 2) (match_dup 1))))
1889 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 3)))]
1892 (define_expand "smaxsi3"
1894 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1895 (match_operand:SI 2 "reg_or_short_operand" ""))
1897 (minus:SI (match_dup 2) (match_dup 1))))
1898 (set (match_operand:SI 0 "gpc_reg_operand" "")
1899 (plus:SI (match_dup 3) (match_dup 1)))]
1900 "TARGET_POWER || TARGET_ISEL"
1905 operands[2] = force_reg (SImode, operands[2]);
1906 rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]);
1909 operands[3] = gen_reg_rtx (SImode);
1913 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1914 (smax:SI (match_operand:SI 1 "gpc_reg_operand" "")
1915 (match_operand:SI 2 "reg_or_short_operand" "")))
1916 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1919 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1921 (minus:SI (match_dup 2) (match_dup 1))))
1922 (set (match_dup 0) (plus:SI (match_dup 3) (match_dup 1)))]
1925 (define_expand "uminsi3"
1926 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1928 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
1930 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
1932 (minus:SI (match_dup 4) (match_dup 3))))
1933 (set (match_operand:SI 0 "gpc_reg_operand" "")
1934 (minus:SI (match_dup 2) (match_dup 3)))]
1935 "TARGET_POWER || TARGET_ISEL"
1940 rs6000_emit_minmax (operands[0], UMIN, operands[1], operands[2]);
1943 operands[3] = gen_reg_rtx (SImode);
1944 operands[4] = gen_reg_rtx (SImode);
1945 operands[5] = GEN_INT (-2147483647 - 1);
1948 (define_expand "umaxsi3"
1949 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1951 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
1953 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
1955 (minus:SI (match_dup 4) (match_dup 3))))
1956 (set (match_operand:SI 0 "gpc_reg_operand" "")
1957 (plus:SI (match_dup 3) (match_dup 1)))]
1958 "TARGET_POWER || TARGET_ISEL"
1963 rs6000_emit_minmax (operands[0], UMAX, operands[1], operands[2]);
1966 operands[3] = gen_reg_rtx (SImode);
1967 operands[4] = gen_reg_rtx (SImode);
1968 operands[5] = GEN_INT (-2147483647 - 1);
1972 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1973 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r")
1974 (match_operand:SI 2 "reg_or_short_operand" "rI"))
1976 (minus:SI (match_dup 2) (match_dup 1))))]
1981 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1983 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
1984 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
1986 (minus:SI (match_dup 2) (match_dup 1)))
1988 (clobber (match_scratch:SI 3 "=r,r"))]
1993 [(set_attr "type" "delayed_compare")
1994 (set_attr "length" "4,8")])
1997 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1999 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "")
2000 (match_operand:SI 2 "reg_or_short_operand" ""))
2002 (minus:SI (match_dup 2) (match_dup 1)))
2004 (clobber (match_scratch:SI 3 ""))]
2005 "TARGET_POWER && reload_completed"
2007 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
2009 (minus:SI (match_dup 2) (match_dup 1))))
2011 (compare:CC (match_dup 3)
2016 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2018 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
2019 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
2021 (minus:SI (match_dup 2) (match_dup 1)))
2023 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2024 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
2026 (minus:SI (match_dup 2) (match_dup 1))))]
2031 [(set_attr "type" "delayed_compare")
2032 (set_attr "length" "4,8")])
2035 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2037 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "")
2038 (match_operand:SI 2 "reg_or_short_operand" ""))
2040 (minus:SI (match_dup 2) (match_dup 1)))
2042 (set (match_operand:SI 0 "gpc_reg_operand" "")
2043 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
2045 (minus:SI (match_dup 2) (match_dup 1))))]
2046 "TARGET_POWER && reload_completed"
2048 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
2050 (minus:SI (match_dup 2) (match_dup 1))))
2052 (compare:CC (match_dup 0)
2056 ;; We don't need abs with condition code because such comparisons should
2058 (define_expand "abssi2"
2059 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2060 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))]
2066 emit_insn (gen_abssi2_isel (operands[0], operands[1]));
2069 else if (! TARGET_POWER)
2071 emit_insn (gen_abssi2_nopower (operands[0], operands[1]));
2076 (define_insn "*abssi2_power"
2077 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2078 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
2082 (define_insn_and_split "abs<mode>2_isel"
2083 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2084 (abs:GPR (match_operand:GPR 1 "gpc_reg_operand" "b")))
2085 (clobber (match_scratch:GPR 2 "=&b"))
2086 (clobber (match_scratch:CC 3 "=y"))]
2089 "&& reload_completed"
2090 [(set (match_dup 2) (neg:GPR (match_dup 1)))
2092 (compare:CC (match_dup 1)
2095 (if_then_else:GPR (ge (match_dup 3)
2101 (define_insn_and_split "nabs<mode>2_isel"
2102 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2103 (neg:GPR (abs:GPR (match_operand:GPR 1 "gpc_reg_operand" "b"))))
2104 (clobber (match_scratch:GPR 2 "=&b"))
2105 (clobber (match_scratch:CC 3 "=y"))]
2108 "&& reload_completed"
2109 [(set (match_dup 2) (neg:GPR (match_dup 1)))
2111 (compare:CC (match_dup 1)
2114 (if_then_else:GPR (ge (match_dup 3)
2120 (define_insn_and_split "abssi2_nopower"
2121 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
2122 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0")))
2123 (clobber (match_scratch:SI 2 "=&r,&r"))]
2124 "! TARGET_POWER && ! TARGET_ISEL"
2126 "&& reload_completed"
2127 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
2128 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
2129 (set (match_dup 0) (minus:SI (match_dup 0) (match_dup 2)))]
2132 (define_insn "*nabs_power"
2133 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2134 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r"))))]
2138 (define_insn_and_split "*nabs_nopower"
2139 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
2140 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0"))))
2141 (clobber (match_scratch:SI 2 "=&r,&r"))]
2144 "&& reload_completed"
2145 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
2146 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
2147 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 0)))]
2150 (define_expand "neg<mode>2"
2151 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
2152 (neg:SDI (match_operand:SDI 1 "gpc_reg_operand" "")))]
2156 (define_insn "*neg<mode>2_internal"
2157 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2158 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
2163 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2164 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
2166 (clobber (match_scratch:P 2 "=r,r"))]
2171 [(set_attr "type" "fast_compare")
2172 (set_attr "length" "4,8")])
2175 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2176 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" ""))
2178 (clobber (match_scratch:P 2 ""))]
2181 (neg:P (match_dup 1)))
2183 (compare:CC (match_dup 2)
2188 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
2189 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
2191 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
2192 (neg:P (match_dup 1)))]
2197 [(set_attr "type" "fast_compare")
2198 (set_attr "length" "4,8")])
2201 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
2202 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" ""))
2204 (set (match_operand:P 0 "gpc_reg_operand" "")
2205 (neg:P (match_dup 1)))]
2208 (neg:P (match_dup 1)))
2210 (compare:CC (match_dup 0)
2214 (define_insn "clz<mode>2"
2215 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2216 (clz:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
2218 "{cntlz|cntlz<wd>} %0,%1"
2219 [(set_attr "type" "cntlz")])
2221 (define_expand "ctz<mode>2"
2223 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))
2224 (parallel [(set (match_dup 3) (and:GPR (match_dup 1)
2226 (clobber (scratch:CC))])
2227 (set (match_dup 4) (clz:GPR (match_dup 3)))
2228 (set (match_operand:GPR 0 "gpc_reg_operand" "")
2229 (minus:GPR (match_dup 5) (match_dup 4)))]
2232 operands[2] = gen_reg_rtx (<MODE>mode);
2233 operands[3] = gen_reg_rtx (<MODE>mode);
2234 operands[4] = gen_reg_rtx (<MODE>mode);
2235 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode) - 1);
2238 (define_expand "ffs<mode>2"
2240 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))
2241 (parallel [(set (match_dup 3) (and:GPR (match_dup 1)
2243 (clobber (scratch:CC))])
2244 (set (match_dup 4) (clz:GPR (match_dup 3)))
2245 (set (match_operand:GPR 0 "gpc_reg_operand" "")
2246 (minus:GPR (match_dup 5) (match_dup 4)))]
2249 operands[2] = gen_reg_rtx (<MODE>mode);
2250 operands[3] = gen_reg_rtx (<MODE>mode);
2251 operands[4] = gen_reg_rtx (<MODE>mode);
2252 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode));
2255 (define_insn "popcntb<mode>2"
2256 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2257 (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")]
2262 (define_insn "popcntwsi2"
2263 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2264 (popcount:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
2268 (define_insn "popcntddi2"
2269 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
2270 (popcount:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
2271 "TARGET_POPCNTD && TARGET_POWERPC64"
2274 (define_expand "popcount<mode>2"
2275 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2276 (popcount:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))]
2277 "TARGET_POPCNTB || TARGET_POPCNTD"
2279 rs6000_emit_popcount (operands[0], operands[1]);
2283 (define_expand "parity<mode>2"
2284 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2285 (parity:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))]
2288 rs6000_emit_parity (operands[0], operands[1]);
2292 ;; Since the hardware zeros the upper part of the register, save generating the
2293 ;; AND immediate if we are converting to unsigned
2294 (define_insn "*bswaphi2_extenddi"
2295 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
2297 (bswap:HI (match_operand:HI 1 "memory_operand" "Z"))))]
2300 [(set_attr "length" "4")
2301 (set_attr "type" "load")])
2303 (define_insn "*bswaphi2_extendsi"
2304 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2306 (bswap:HI (match_operand:HI 1 "memory_operand" "Z"))))]
2309 [(set_attr "length" "4")
2310 (set_attr "type" "load")])
2312 (define_expand "bswaphi2"
2313 [(parallel [(set (match_operand:HI 0 "reg_or_mem_operand" "")
2315 (match_operand:HI 1 "reg_or_mem_operand" "")))
2316 (clobber (match_scratch:SI 2 ""))])]
2319 if (!REG_P (operands[0]) && !REG_P (operands[1]))
2320 operands[1] = force_reg (HImode, operands[1]);
2323 (define_insn "bswaphi2_internal"
2324 [(set (match_operand:HI 0 "reg_or_mem_operand" "=r,Z,&r")
2326 (match_operand:HI 1 "reg_or_mem_operand" "Z,r,r")))
2327 (clobber (match_scratch:SI 2 "=X,X,&r"))]
2333 [(set_attr "length" "4,4,12")
2334 (set_attr "type" "load,store,*")])
2337 [(set (match_operand:HI 0 "gpc_reg_operand" "")
2338 (bswap:HI (match_operand:HI 1 "gpc_reg_operand" "")))
2339 (clobber (match_operand:SI 2 "gpc_reg_operand" ""))]
2340 "TARGET_POWERPC && reload_completed"
2342 (zero_extract:SI (match_dup 4)
2346 (and:SI (ashift:SI (match_dup 4)
2348 (const_int 65280))) ;; 0xff00
2350 (ior:SI (match_dup 3)
2354 operands[3] = simplify_gen_subreg (SImode, operands[0], HImode, 0);
2355 operands[4] = simplify_gen_subreg (SImode, operands[1], HImode, 0);
2358 (define_insn "*bswapsi2_extenddi"
2359 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
2361 (bswap:SI (match_operand:SI 1 "memory_operand" "Z"))))]
2364 [(set_attr "length" "4")
2365 (set_attr "type" "load")])
2367 (define_expand "bswapsi2"
2368 [(set (match_operand:SI 0 "reg_or_mem_operand" "")
2370 (match_operand:SI 1 "reg_or_mem_operand" "")))]
2373 if (!REG_P (operands[0]) && !REG_P (operands[1]))
2374 operands[1] = force_reg (SImode, operands[1]);
2377 (define_insn "*bswapsi2_internal"
2378 [(set (match_operand:SI 0 "reg_or_mem_operand" "=r,Z,&r")
2380 (match_operand:SI 1 "reg_or_mem_operand" "Z,r,r")))]
2384 {stbrx|stwbrx} %1,%y0
2386 [(set_attr "length" "4,4,12")
2387 (set_attr "type" "load,store,*")])
2390 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2391 (bswap:SI (match_operand:SI 1 "gpc_reg_operand" "")))]
2394 (rotate:SI (match_dup 1) (const_int 8)))
2395 (set (zero_extract:SI (match_dup 0)
2399 (set (zero_extract:SI (match_dup 0)
2402 (rotate:SI (match_dup 1)
2406 (define_expand "bswapdi2"
2407 [(parallel [(set (match_operand:DI 0 "reg_or_mem_operand" "")
2409 (match_operand:DI 1 "reg_or_mem_operand" "")))
2410 (clobber (match_scratch:DI 2 ""))
2411 (clobber (match_scratch:DI 3 ""))
2412 (clobber (match_scratch:DI 4 ""))])]
2415 if (!REG_P (operands[0]) && !REG_P (operands[1]))
2416 operands[1] = force_reg (DImode, operands[1]);
2418 if (!TARGET_POWERPC64)
2420 /* 32-bit mode needs fewer scratch registers, but 32-bit addressing mode
2421 that uses 64-bit registers needs the same scratch registers as 64-bit
2423 emit_insn (gen_bswapdi2_32bit (operands[0], operands[1]));
2428 ;; Power7/cell has ldbrx/stdbrx, so use it directly
2429 (define_insn "*bswapdi2_ldbrx"
2430 [(set (match_operand:DI 0 "reg_or_mem_operand" "=&r,Z,??&r")
2431 (bswap:DI (match_operand:DI 1 "reg_or_mem_operand" "Z,r,r")))
2432 (clobber (match_scratch:DI 2 "=X,X,&r"))
2433 (clobber (match_scratch:DI 3 "=X,X,&r"))
2434 (clobber (match_scratch:DI 4 "=X,X,&r"))]
2435 "TARGET_POWERPC64 && TARGET_LDBRX
2436 && (REG_P (operands[0]) || REG_P (operands[1]))"
2441 [(set_attr "length" "4,4,36")
2442 (set_attr "type" "load,store,*")])
2444 ;; Non-power7/cell, fall back to use lwbrx/stwbrx
2445 (define_insn "*bswapdi2_64bit"
2446 [(set (match_operand:DI 0 "reg_or_mem_operand" "=&r,Z,??&r")
2447 (bswap:DI (match_operand:DI 1 "reg_or_mem_operand" "Z,r,r")))
2448 (clobber (match_scratch:DI 2 "=&b,&b,&r"))
2449 (clobber (match_scratch:DI 3 "=&r,&r,&r"))
2450 (clobber (match_scratch:DI 4 "=&r,X,&r"))]
2451 "TARGET_POWERPC64 && !TARGET_LDBRX
2452 && (REG_P (operands[0]) || REG_P (operands[1]))"
2454 [(set_attr "length" "16,12,36")])
2457 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2458 (bswap:DI (match_operand:DI 1 "indexed_or_indirect_operand" "")))
2459 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
2460 (clobber (match_operand:DI 3 "gpc_reg_operand" ""))
2461 (clobber (match_operand:DI 4 "gpc_reg_operand" ""))]
2462 "TARGET_POWERPC64 && !TARGET_LDBRX && reload_completed"
2466 rtx dest = operands[0];
2467 rtx src = operands[1];
2468 rtx op2 = operands[2];
2469 rtx op3 = operands[3];
2470 rtx op4 = operands[4];
2471 rtx op3_32 = simplify_gen_subreg (SImode, op3, DImode, 4);
2472 rtx op4_32 = simplify_gen_subreg (SImode, op4, DImode, 4);
2478 addr1 = XEXP (src, 0);
2479 if (GET_CODE (addr1) == PLUS)
2481 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2482 addr2 = gen_rtx_PLUS (Pmode, op2, XEXP (addr1, 1));
2486 emit_move_insn (op2, GEN_INT (4));
2487 addr2 = gen_rtx_PLUS (Pmode, op2, addr1);
2490 if (BYTES_BIG_ENDIAN)
2492 word_high = change_address (src, SImode, addr1);
2493 word_low = change_address (src, SImode, addr2);
2497 word_high = change_address (src, SImode, addr2);
2498 word_low = change_address (src, SImode, addr1);
2501 emit_insn (gen_bswapsi2 (op3_32, word_low));
2502 emit_insn (gen_bswapsi2 (op4_32, word_high));
2503 emit_insn (gen_ashldi3 (dest, op3, GEN_INT (32)));
2504 emit_insn (gen_iordi3 (dest, dest, op4));
2508 [(set (match_operand:DI 0 "indexed_or_indirect_operand" "")
2509 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2510 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
2511 (clobber (match_operand:DI 3 "gpc_reg_operand" ""))
2512 (clobber (match_operand:DI 4 "" ""))]
2513 "TARGET_POWERPC64 && !TARGET_LDBRX && reload_completed"
2517 rtx dest = operands[0];
2518 rtx src = operands[1];
2519 rtx op2 = operands[2];
2520 rtx op3 = operands[3];
2521 rtx src_si = simplify_gen_subreg (SImode, src, DImode, 4);
2522 rtx op3_si = simplify_gen_subreg (SImode, op3, DImode, 4);
2528 addr1 = XEXP (dest, 0);
2529 if (GET_CODE (addr1) == PLUS)
2531 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2532 addr2 = gen_rtx_PLUS (Pmode, op2, XEXP (addr1, 1));
2536 emit_move_insn (op2, GEN_INT (4));
2537 addr2 = gen_rtx_PLUS (Pmode, op2, addr1);
2540 emit_insn (gen_lshrdi3 (op3, src, GEN_INT (32)));
2541 if (BYTES_BIG_ENDIAN)
2543 word_high = change_address (dest, SImode, addr1);
2544 word_low = change_address (dest, SImode, addr2);
2545 emit_insn (gen_bswapsi2 (word_high, src_si));
2546 emit_insn (gen_bswapsi2 (word_low, op3_si));
2550 word_high = change_address (dest, SImode, addr2);
2551 word_low = change_address (dest, SImode, addr1);
2552 emit_insn (gen_bswapsi2 (word_low, src_si));
2553 emit_insn (gen_bswapsi2 (word_high, op3_si));
2558 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2559 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2560 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
2561 (clobber (match_operand:DI 3 "gpc_reg_operand" ""))
2562 (clobber (match_operand:DI 4 "" ""))]
2563 "TARGET_POWERPC64 && reload_completed"
2567 rtx dest = operands[0];
2568 rtx src = operands[1];
2569 rtx op2 = operands[2];
2570 rtx op3 = operands[3];
2571 rtx dest_si = simplify_gen_subreg (SImode, dest, DImode, 4);
2572 rtx src_si = simplify_gen_subreg (SImode, src, DImode, 4);
2573 rtx op2_si = simplify_gen_subreg (SImode, op2, DImode, 4);
2574 rtx op3_si = simplify_gen_subreg (SImode, op3, DImode, 4);
2576 emit_insn (gen_lshrdi3 (op2, src, GEN_INT (32)));
2577 emit_insn (gen_bswapsi2 (dest_si, src_si));
2578 emit_insn (gen_bswapsi2 (op3_si, op2_si));
2579 emit_insn (gen_ashldi3 (dest, dest, GEN_INT (32)));
2580 emit_insn (gen_iordi3 (dest, dest, op3));
2583 (define_insn "bswapdi2_32bit"
2584 [(set (match_operand:DI 0 "reg_or_mem_operand" "=&r,Z,??&r")
2585 (bswap:DI (match_operand:DI 1 "reg_or_mem_operand" "Z,r,r")))
2586 (clobber (match_scratch:SI 2 "=&b,&b,X"))]
2587 "!TARGET_POWERPC64 && (REG_P (operands[0]) || REG_P (operands[1]))"
2589 [(set_attr "length" "16,12,36")])
2592 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2593 (bswap:DI (match_operand:DI 1 "indexed_or_indirect_operand" "")))
2594 (clobber (match_operand:SI 2 "gpc_reg_operand" ""))]
2595 "!TARGET_POWERPC64 && reload_completed"
2599 rtx dest = operands[0];
2600 rtx src = operands[1];
2601 rtx op2 = operands[2];
2602 rtx dest_hi = simplify_gen_subreg (SImode, dest, DImode, 0);
2603 rtx dest_lo = simplify_gen_subreg (SImode, dest, DImode, 4);
2609 addr1 = XEXP (src, 0);
2610 if (GET_CODE (addr1) == PLUS)
2612 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2613 addr2 = gen_rtx_PLUS (SImode, op2, XEXP (addr1, 1));
2617 emit_move_insn (op2, GEN_INT (4));
2618 addr2 = gen_rtx_PLUS (SImode, op2, addr1);
2621 if (BYTES_BIG_ENDIAN)
2623 word_high = change_address (src, SImode, addr1);
2624 word_low = change_address (src, SImode, addr2);
2628 word_high = change_address (src, SImode, addr2);
2629 word_low = change_address (src, SImode, addr1);
2632 emit_insn (gen_bswapsi2 (dest_hi, word_low));
2633 emit_insn (gen_bswapsi2 (dest_lo, word_high));
2637 [(set (match_operand:DI 0 "indexed_or_indirect_operand" "")
2638 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2639 (clobber (match_operand:SI 2 "gpc_reg_operand" ""))]
2640 "!TARGET_POWERPC64 && reload_completed"
2644 rtx dest = operands[0];
2645 rtx src = operands[1];
2646 rtx op2 = operands[2];
2647 rtx src_high = simplify_gen_subreg (SImode, src, DImode, 0);
2648 rtx src_low = simplify_gen_subreg (SImode, src, DImode, 4);
2654 addr1 = XEXP (dest, 0);
2655 if (GET_CODE (addr1) == PLUS)
2657 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2658 addr2 = gen_rtx_PLUS (SImode, op2, XEXP (addr1, 1));
2662 emit_move_insn (op2, GEN_INT (4));
2663 addr2 = gen_rtx_PLUS (SImode, op2, addr1);
2666 if (BYTES_BIG_ENDIAN)
2668 word_high = change_address (dest, SImode, addr1);
2669 word_low = change_address (dest, SImode, addr2);
2673 word_high = change_address (dest, SImode, addr2);
2674 word_low = change_address (dest, SImode, addr1);
2677 emit_insn (gen_bswapsi2 (word_high, src_low));
2678 emit_insn (gen_bswapsi2 (word_low, src_high));
2682 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2683 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2684 (clobber (match_operand:SI 2 "" ""))]
2685 "!TARGET_POWERPC64 && reload_completed"
2689 rtx dest = operands[0];
2690 rtx src = operands[1];
2691 rtx src_high = simplify_gen_subreg (SImode, src, DImode, 0);
2692 rtx src_low = simplify_gen_subreg (SImode, src, DImode, 4);
2693 rtx dest_high = simplify_gen_subreg (SImode, dest, DImode, 0);
2694 rtx dest_low = simplify_gen_subreg (SImode, dest, DImode, 4);
2696 emit_insn (gen_bswapsi2 (dest_high, src_low));
2697 emit_insn (gen_bswapsi2 (dest_low, src_high));
2700 (define_expand "mulsi3"
2701 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
2702 (use (match_operand:SI 1 "gpc_reg_operand" ""))
2703 (use (match_operand:SI 2 "reg_or_short_operand" ""))]
2708 emit_insn (gen_mulsi3_mq (operands[0], operands[1], operands[2]));
2710 emit_insn (gen_mulsi3_no_mq (operands[0], operands[1], operands[2]));
2714 (define_insn "mulsi3_mq"
2715 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2716 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2717 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
2718 (clobber (match_scratch:SI 3 "=q,q"))]
2721 {muls|mullw} %0,%1,%2
2722 {muli|mulli} %0,%1,%2"
2724 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
2725 (const_string "imul3")
2726 (match_operand:SI 2 "short_cint_operand" "")
2727 (const_string "imul2")]
2728 (const_string "imul")))])
2730 (define_insn "mulsi3_no_mq"
2731 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2732 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2733 (match_operand:SI 2 "reg_or_short_operand" "r,I")))]
2736 {muls|mullw} %0,%1,%2
2737 {muli|mulli} %0,%1,%2"
2739 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
2740 (const_string "imul3")
2741 (match_operand:SI 2 "short_cint_operand" "")
2742 (const_string "imul2")]
2743 (const_string "imul")))])
2745 (define_insn "*mulsi3_mq_internal1"
2746 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2747 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2748 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2750 (clobber (match_scratch:SI 3 "=r,r"))
2751 (clobber (match_scratch:SI 4 "=q,q"))]
2754 {muls.|mullw.} %3,%1,%2
2756 [(set_attr "type" "imul_compare")
2757 (set_attr "length" "4,8")])
2760 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2761 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2762 (match_operand:SI 2 "gpc_reg_operand" ""))
2764 (clobber (match_scratch:SI 3 ""))
2765 (clobber (match_scratch:SI 4 ""))]
2766 "TARGET_POWER && reload_completed"
2767 [(parallel [(set (match_dup 3)
2768 (mult:SI (match_dup 1) (match_dup 2)))
2769 (clobber (match_dup 4))])
2771 (compare:CC (match_dup 3)
2775 (define_insn "*mulsi3_no_mq_internal1"
2776 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2777 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2778 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2780 (clobber (match_scratch:SI 3 "=r,r"))]
2783 {muls.|mullw.} %3,%1,%2
2785 [(set_attr "type" "imul_compare")
2786 (set_attr "length" "4,8")])
2789 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
2790 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2791 (match_operand:SI 2 "gpc_reg_operand" ""))
2793 (clobber (match_scratch:SI 3 ""))]
2794 "! TARGET_POWER && reload_completed"
2796 (mult:SI (match_dup 1) (match_dup 2)))
2798 (compare:CC (match_dup 3)
2802 (define_insn "*mulsi3_mq_internal2"
2803 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2804 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2805 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2807 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2808 (mult:SI (match_dup 1) (match_dup 2)))
2809 (clobber (match_scratch:SI 4 "=q,q"))]
2812 {muls.|mullw.} %0,%1,%2
2814 [(set_attr "type" "imul_compare")
2815 (set_attr "length" "4,8")])
2818 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2819 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2820 (match_operand:SI 2 "gpc_reg_operand" ""))
2822 (set (match_operand:SI 0 "gpc_reg_operand" "")
2823 (mult:SI (match_dup 1) (match_dup 2)))
2824 (clobber (match_scratch:SI 4 ""))]
2825 "TARGET_POWER && reload_completed"
2826 [(parallel [(set (match_dup 0)
2827 (mult:SI (match_dup 1) (match_dup 2)))
2828 (clobber (match_dup 4))])
2830 (compare:CC (match_dup 0)
2834 (define_insn "*mulsi3_no_mq_internal2"
2835 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2836 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2837 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2839 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2840 (mult:SI (match_dup 1) (match_dup 2)))]
2843 {muls.|mullw.} %0,%1,%2
2845 [(set_attr "type" "imul_compare")
2846 (set_attr "length" "4,8")])
2849 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
2850 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2851 (match_operand:SI 2 "gpc_reg_operand" ""))
2853 (set (match_operand:SI 0 "gpc_reg_operand" "")
2854 (mult:SI (match_dup 1) (match_dup 2)))]
2855 "! TARGET_POWER && reload_completed"
2857 (mult:SI (match_dup 1) (match_dup 2)))
2859 (compare:CC (match_dup 0)
2863 ;; Operand 1 is divided by operand 2; quotient goes to operand
2864 ;; 0 and remainder to operand 3.
2865 ;; ??? At some point, see what, if anything, we can do about if (x % y == 0).
2867 (define_expand "divmodsi4"
2868 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
2869 (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
2870 (match_operand:SI 2 "gpc_reg_operand" "")))
2871 (set (match_operand:SI 3 "register_operand" "")
2872 (mod:SI (match_dup 1) (match_dup 2)))])]
2873 "TARGET_POWER || (! TARGET_POWER && ! TARGET_POWERPC)"
2876 if (! TARGET_POWER && ! TARGET_POWERPC)
2878 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2879 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2880 emit_insn (gen_divss_call ());
2881 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2882 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
2887 (define_insn "*divmodsi4_internal"
2888 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2889 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2890 (match_operand:SI 2 "gpc_reg_operand" "r")))
2891 (set (match_operand:SI 3 "register_operand" "=q")
2892 (mod:SI (match_dup 1) (match_dup 2)))]
2895 [(set_attr "type" "idiv")])
2897 (define_expand "udiv<mode>3"
2898 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2899 (udiv:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2900 (match_operand:GPR 2 "gpc_reg_operand" "")))]
2901 "TARGET_POWERPC || (! TARGET_POWER && ! TARGET_POWERPC)"
2904 if (! TARGET_POWER && ! TARGET_POWERPC)
2906 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2907 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2908 emit_insn (gen_quous_call ());
2909 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2912 else if (TARGET_POWER)
2914 emit_insn (gen_udivsi3_mq (operands[0], operands[1], operands[2]));
2919 (define_insn "udivsi3_mq"
2920 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2921 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2922 (match_operand:SI 2 "gpc_reg_operand" "r")))
2923 (clobber (match_scratch:SI 3 "=q"))]
2924 "TARGET_POWERPC && TARGET_POWER"
2926 [(set_attr "type" "idiv")])
2928 (define_insn "*udivsi3_no_mq"
2929 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2930 (udiv:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2931 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
2932 "TARGET_POWERPC && ! TARGET_POWER"
2935 (cond [(match_operand:SI 0 "" "")
2936 (const_string "idiv")]
2937 (const_string "ldiv")))])
2940 ;; For powers of two we can do srai/aze for divide and then adjust for
2941 ;; modulus. If it isn't a power of two, FAIL on POWER so divmodsi4 will be
2942 ;; used; for PowerPC, force operands into register and do a normal divide;
2943 ;; for AIX common-mode, use quoss call on register operands.
2944 (define_expand "div<mode>3"
2945 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2946 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2947 (match_operand:GPR 2 "reg_or_cint_operand" "")))]
2951 if (GET_CODE (operands[2]) == CONST_INT
2952 && INTVAL (operands[2]) > 0
2953 && exact_log2 (INTVAL (operands[2])) >= 0)
2955 else if (TARGET_POWERPC)
2957 operands[2] = force_reg (<MODE>mode, operands[2]);
2960 emit_insn (gen_divsi3_mq (operands[0], operands[1], operands[2]));
2964 else if (TARGET_POWER)
2968 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2969 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2970 emit_insn (gen_quoss_call ());
2971 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2976 (define_insn "divsi3_mq"
2977 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2978 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2979 (match_operand:SI 2 "gpc_reg_operand" "r")))
2980 (clobber (match_scratch:SI 3 "=q"))]
2981 "TARGET_POWERPC && TARGET_POWER"
2983 [(set_attr "type" "idiv")])
2985 (define_insn "*div<mode>3_no_mq"
2986 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2987 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2988 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
2989 "TARGET_POWERPC && ! TARGET_POWER"
2992 (cond [(match_operand:SI 0 "" "")
2993 (const_string "idiv")]
2994 (const_string "ldiv")))])
2996 (define_expand "mod<mode>3"
2997 [(use (match_operand:GPR 0 "gpc_reg_operand" ""))
2998 (use (match_operand:GPR 1 "gpc_reg_operand" ""))
2999 (use (match_operand:GPR 2 "reg_or_cint_operand" ""))]
3007 if (GET_CODE (operands[2]) != CONST_INT
3008 || INTVAL (operands[2]) <= 0
3009 || (i = exact_log2 (INTVAL (operands[2]))) < 0)
3012 temp1 = gen_reg_rtx (<MODE>mode);
3013 temp2 = gen_reg_rtx (<MODE>mode);
3015 emit_insn (gen_div<mode>3 (temp1, operands[1], operands[2]));
3016 emit_insn (gen_ashl<mode>3 (temp2, temp1, GEN_INT (i)));
3017 emit_insn (gen_sub<mode>3 (operands[0], operands[1], temp2));
3022 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
3023 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
3024 (match_operand:GPR 2 "exact_log2_cint_operand" "N")))]
3026 "{srai|sra<wd>i} %0,%1,%p2\;{aze|addze} %0,%0"
3027 [(set_attr "type" "two")
3028 (set_attr "length" "8")])
3031 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3032 (compare:CC (div:P (match_operand:P 1 "gpc_reg_operand" "r,r")
3033 (match_operand:P 2 "exact_log2_cint_operand" "N,N"))
3035 (clobber (match_scratch:P 3 "=r,r"))]
3038 {srai|sra<wd>i} %3,%1,%p2\;{aze.|addze.} %3,%3
3040 [(set_attr "type" "compare")
3041 (set_attr "length" "8,12")
3042 (set_attr "cell_micro" "not")])
3045 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3046 (compare:CC (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
3047 (match_operand:GPR 2 "exact_log2_cint_operand"
3050 (clobber (match_scratch:GPR 3 ""))]
3053 (div:<MODE> (match_dup 1) (match_dup 2)))
3055 (compare:CC (match_dup 3)
3060 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3061 (compare:CC (div:P (match_operand:P 1 "gpc_reg_operand" "r,r")
3062 (match_operand:P 2 "exact_log2_cint_operand" "N,N"))
3064 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
3065 (div:P (match_dup 1) (match_dup 2)))]
3068 {srai|sra<wd>i} %0,%1,%p2\;{aze.|addze.} %0,%0
3070 [(set_attr "type" "compare")
3071 (set_attr "length" "8,12")
3072 (set_attr "cell_micro" "not")])
3075 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3076 (compare:CC (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
3077 (match_operand:GPR 2 "exact_log2_cint_operand"
3080 (set (match_operand:GPR 0 "gpc_reg_operand" "")
3081 (div:GPR (match_dup 1) (match_dup 2)))]
3084 (div:<MODE> (match_dup 1) (match_dup 2)))
3086 (compare:CC (match_dup 0)
3091 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3094 (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
3096 (zero_extend:DI (match_operand:SI 4 "register_operand" "2")))
3097 (match_operand:SI 3 "gpc_reg_operand" "r")))
3098 (set (match_operand:SI 2 "register_operand" "=*q")
3101 (zero_extend:DI (match_dup 1)) (const_int 32))
3102 (zero_extend:DI (match_dup 4)))
3106 [(set_attr "type" "idiv")])
3108 ;; To do unsigned divide we handle the cases of the divisor looking like a
3109 ;; negative number. If it is a constant that is less than 2**31, we don't
3110 ;; have to worry about the branches. So make a few subroutines here.
3112 ;; First comes the normal case.
3113 (define_expand "udivmodsi4_normal"
3114 [(set (match_dup 4) (const_int 0))
3115 (parallel [(set (match_operand:SI 0 "" "")
3116 (udiv:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
3118 (zero_extend:DI (match_operand:SI 1 "" "")))
3119 (match_operand:SI 2 "" "")))
3120 (set (match_operand:SI 3 "" "")
3121 (umod:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
3123 (zero_extend:DI (match_dup 1)))
3127 { operands[4] = gen_reg_rtx (SImode); }")
3129 ;; This handles the branches.
3130 (define_expand "udivmodsi4_tests"
3131 [(set (match_operand:SI 0 "" "") (const_int 0))
3132 (set (match_operand:SI 3 "" "") (match_operand:SI 1 "" ""))
3133 (set (match_dup 5) (compare:CCUNS (match_dup 1) (match_operand:SI 2 "" "")))
3134 (set (pc) (if_then_else (ltu (match_dup 5) (const_int 0))
3135 (label_ref (match_operand:SI 4 "" "")) (pc)))
3136 (set (match_dup 0) (const_int 1))
3137 (set (match_dup 3) (minus:SI (match_dup 1) (match_dup 2)))
3138 (set (match_dup 6) (compare:CC (match_dup 2) (const_int 0)))
3139 (set (pc) (if_then_else (lt (match_dup 6) (const_int 0))
3140 (label_ref (match_dup 4)) (pc)))]
3143 { operands[5] = gen_reg_rtx (CCUNSmode);
3144 operands[6] = gen_reg_rtx (CCmode);
3147 (define_expand "udivmodsi4"
3148 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
3149 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "")
3150 (match_operand:SI 2 "reg_or_cint_operand" "")))
3151 (set (match_operand:SI 3 "gpc_reg_operand" "")
3152 (umod:SI (match_dup 1) (match_dup 2)))])]
3160 if (! TARGET_POWERPC)
3162 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
3163 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
3164 emit_insn (gen_divus_call ());
3165 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
3166 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
3173 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) < 0)
3175 operands[2] = force_reg (SImode, operands[2]);
3176 label = gen_label_rtx ();
3177 emit (gen_udivmodsi4_tests (operands[0], operands[1], operands[2],
3178 operands[3], label));
3181 operands[2] = force_reg (SImode, operands[2]);
3183 emit (gen_udivmodsi4_normal (operands[0], operands[1], operands[2],
3191 ;; AIX architecture-independent common-mode multiply (DImode),
3192 ;; divide/modulus, and quotient subroutine calls. Input operands in R3 and
3193 ;; R4; results in R3 and sometimes R4; link register always clobbered by bla
3194 ;; instruction; R0 sometimes clobbered; also, MQ sometimes clobbered but
3195 ;; assumed unused if generating common-mode, so ignore.
3196 (define_insn "mulh_call"
3199 (lshiftrt:DI (mult:DI (sign_extend:DI (reg:SI 3))
3200 (sign_extend:DI (reg:SI 4)))
3202 (clobber (reg:SI LR_REGNO))]
3203 "! TARGET_POWER && ! TARGET_POWERPC"
3205 [(set_attr "type" "imul")])
3207 (define_insn "mull_call"
3209 (mult:DI (sign_extend:DI (reg:SI 3))
3210 (sign_extend:DI (reg:SI 4))))
3211 (clobber (reg:SI LR_REGNO))
3212 (clobber (reg:SI 0))]
3213 "! TARGET_POWER && ! TARGET_POWERPC"
3215 [(set_attr "type" "imul")])
3217 (define_insn "divss_call"
3219 (div:SI (reg:SI 3) (reg:SI 4)))
3221 (mod:SI (reg:SI 3) (reg:SI 4)))
3222 (clobber (reg:SI LR_REGNO))
3223 (clobber (reg:SI 0))]
3224 "! TARGET_POWER && ! TARGET_POWERPC"
3226 [(set_attr "type" "idiv")])
3228 (define_insn "divus_call"
3230 (udiv:SI (reg:SI 3) (reg:SI 4)))
3232 (umod:SI (reg:SI 3) (reg:SI 4)))
3233 (clobber (reg:SI LR_REGNO))
3234 (clobber (reg:SI 0))
3235 (clobber (match_scratch:CC 0 "=x"))
3236 (clobber (reg:CC CR1_REGNO))]
3237 "! TARGET_POWER && ! TARGET_POWERPC"
3239 [(set_attr "type" "idiv")])
3241 (define_insn "quoss_call"
3243 (div:SI (reg:SI 3) (reg:SI 4)))
3244 (clobber (reg:SI LR_REGNO))]
3245 "! TARGET_POWER && ! TARGET_POWERPC"
3247 [(set_attr "type" "idiv")])
3249 (define_insn "quous_call"
3251 (udiv:SI (reg:SI 3) (reg:SI 4)))
3252 (clobber (reg:SI LR_REGNO))
3253 (clobber (reg:SI 0))
3254 (clobber (match_scratch:CC 0 "=x"))
3255 (clobber (reg:CC CR1_REGNO))]
3256 "! TARGET_POWER && ! TARGET_POWERPC"
3258 [(set_attr "type" "idiv")])
3260 ;; Logical instructions
3261 ;; The logical instructions are mostly combined by using match_operator,
3262 ;; but the plain AND insns are somewhat different because there is no
3263 ;; plain 'andi' (only 'andi.'), no plain 'andis', and there are all
3264 ;; those rotate-and-mask operations. Thus, the AND insns come first.
3266 (define_expand "andsi3"
3268 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3269 (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
3270 (match_operand:SI 2 "and_operand" "")))
3271 (clobber (match_scratch:CC 3 ""))])]
3275 (define_insn "andsi3_mc"
3276 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
3277 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
3278 (match_operand:SI 2 "and_operand" "?r,T,K,L")))
3279 (clobber (match_scratch:CC 3 "=X,X,x,x"))]
3280 "rs6000_gen_cell_microcode"
3283 {rlinm|rlwinm} %0,%1,0,%m2,%M2
3284 {andil.|andi.} %0,%1,%b2
3285 {andiu.|andis.} %0,%1,%u2"
3286 [(set_attr "type" "*,*,fast_compare,fast_compare")])
3288 (define_insn "andsi3_nomc"
3289 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3290 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
3291 (match_operand:SI 2 "and_operand" "?r,T")))
3292 (clobber (match_scratch:CC 3 "=X,X"))]
3293 "!rs6000_gen_cell_microcode"
3296 {rlinm|rlwinm} %0,%1,0,%m2,%M2")
3298 (define_insn "andsi3_internal0_nomc"
3299 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3300 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
3301 (match_operand:SI 2 "and_operand" "?r,T")))]
3302 "!rs6000_gen_cell_microcode"
3305 {rlinm|rlwinm} %0,%1,0,%m2,%M2")
3308 ;; Note to set cr's other than cr0 we do the and immediate and then
3309 ;; the test again -- this avoids a mfcr which on the higher end
3310 ;; machines causes an execution serialization
3312 (define_insn "*andsi3_internal2_mc"
3313 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
3314 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
3315 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
3317 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
3318 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
3319 "TARGET_32BIT && rs6000_gen_cell_microcode"
3322 {andil.|andi.} %3,%1,%b2
3323 {andiu.|andis.} %3,%1,%u2
3324 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
3329 [(set_attr "type" "fast_compare,fast_compare,fast_compare,delayed_compare,\
3330 compare,compare,compare,compare")
3331 (set_attr "length" "4,4,4,4,8,8,8,8")])
3333 (define_insn "*andsi3_internal3_mc"
3334 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
3335 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
3336 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
3338 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
3339 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
3340 "TARGET_64BIT && rs6000_gen_cell_microcode"
3343 {andil.|andi.} %3,%1,%b2
3344 {andiu.|andis.} %3,%1,%u2
3345 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
3350 [(set_attr "type" "compare,fast_compare,fast_compare,delayed_compare,compare,\
3351 compare,compare,compare")
3352 (set_attr "length" "8,4,4,4,8,8,8,8")])
3355 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3356 (compare:CC (and:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
3357 (match_operand:GPR 2 "and_operand" ""))
3359 (clobber (match_scratch:GPR 3 ""))
3360 (clobber (match_scratch:CC 4 ""))]
3362 [(parallel [(set (match_dup 3)
3363 (and:<MODE> (match_dup 1)
3365 (clobber (match_dup 4))])
3367 (compare:CC (match_dup 3)
3371 ;; We don't have a 32 bit "and. rt,ra,rb" for ppc64. cr is set from the
3372 ;; whole 64 bit reg, and we don't know what is in the high 32 bits.
3375 [(set (match_operand:CC 0 "cc_reg_operand" "")
3376 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
3377 (match_operand:SI 2 "gpc_reg_operand" ""))
3379 (clobber (match_scratch:SI 3 ""))
3380 (clobber (match_scratch:CC 4 ""))]
3381 "TARGET_POWERPC64 && reload_completed"
3382 [(parallel [(set (match_dup 3)
3383 (and:SI (match_dup 1)
3385 (clobber (match_dup 4))])
3387 (compare:CC (match_dup 3)
3391 (define_insn "*andsi3_internal4"
3392 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
3393 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
3394 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
3396 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
3397 (and:SI (match_dup 1)
3399 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
3400 "TARGET_32BIT && rs6000_gen_cell_microcode"
3403 {andil.|andi.} %0,%1,%b2
3404 {andiu.|andis.} %0,%1,%u2
3405 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
3410 [(set_attr "type" "fast_compare,fast_compare,fast_compare,delayed_compare,\
3411 compare,compare,compare,compare")
3412 (set_attr "length" "4,4,4,4,8,8,8,8")])
3414 (define_insn "*andsi3_internal5_mc"
3415 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
3416 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
3417 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
3419 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
3420 (and:SI (match_dup 1)
3422 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
3423 "TARGET_64BIT && rs6000_gen_cell_microcode"
3426 {andil.|andi.} %0,%1,%b2
3427 {andiu.|andis.} %0,%1,%u2
3428 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
3433 [(set_attr "type" "compare,fast_compare,fast_compare,delayed_compare,compare,\
3434 compare,compare,compare")
3435 (set_attr "length" "8,4,4,4,8,8,8,8")])
3438 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3439 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
3440 (match_operand:SI 2 "and_operand" ""))
3442 (set (match_operand:SI 0 "gpc_reg_operand" "")
3443 (and:SI (match_dup 1)
3445 (clobber (match_scratch:CC 4 ""))]
3447 [(parallel [(set (match_dup 0)
3448 (and:SI (match_dup 1)
3450 (clobber (match_dup 4))])
3452 (compare:CC (match_dup 0)
3457 [(set (match_operand:CC 3 "cc_reg_operand" "")
3458 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
3459 (match_operand:SI 2 "gpc_reg_operand" ""))
3461 (set (match_operand:SI 0 "gpc_reg_operand" "")
3462 (and:SI (match_dup 1)
3464 (clobber (match_scratch:CC 4 ""))]
3465 "TARGET_POWERPC64 && reload_completed"
3466 [(parallel [(set (match_dup 0)
3467 (and:SI (match_dup 1)
3469 (clobber (match_dup 4))])
3471 (compare:CC (match_dup 0)
3475 ;; Handle the PowerPC64 rlwinm corner case
3477 (define_insn_and_split "*andsi3_internal6"
3478 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3479 (and:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3480 (match_operand:SI 2 "mask_operand_wrap" "i")))]
3485 (and:SI (rotate:SI (match_dup 1) (match_dup 3))
3488 (rotate:SI (match_dup 0) (match_dup 5)))]
3491 int mb = extract_MB (operands[2]);
3492 int me = extract_ME (operands[2]);
3493 operands[3] = GEN_INT (me + 1);
3494 operands[5] = GEN_INT (32 - (me + 1));
3495 operands[4] = GEN_INT (~((HOST_WIDE_INT) -1 << (33 + me - mb)));
3497 [(set_attr "length" "8")])
3499 (define_expand "iorsi3"
3500 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3501 (ior:SI (match_operand:SI 1 "gpc_reg_operand" "")
3502 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
3506 if (GET_CODE (operands[2]) == CONST_INT
3507 && ! logical_operand (operands[2], SImode))
3509 HOST_WIDE_INT value = INTVAL (operands[2]);
3510 rtx tmp = ((!can_create_pseudo_p ()
3511 || rtx_equal_p (operands[0], operands[1]))
3512 ? operands[0] : gen_reg_rtx (SImode));
3514 emit_insn (gen_iorsi3 (tmp, operands[1],
3515 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
3516 emit_insn (gen_iorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
3521 (define_expand "xorsi3"
3522 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3523 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
3524 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
3528 if (GET_CODE (operands[2]) == CONST_INT
3529 && ! logical_operand (operands[2], SImode))
3531 HOST_WIDE_INT value = INTVAL (operands[2]);
3532 rtx tmp = ((!can_create_pseudo_p ()
3533 || rtx_equal_p (operands[0], operands[1]))
3534 ? operands[0] : gen_reg_rtx (SImode));
3536 emit_insn (gen_xorsi3 (tmp, operands[1],
3537 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
3538 emit_insn (gen_xorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
3543 (define_insn "*boolsi3_internal1"
3544 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
3545 (match_operator:SI 3 "boolean_or_operator"
3546 [(match_operand:SI 1 "gpc_reg_operand" "%r,r,r")
3547 (match_operand:SI 2 "logical_operand" "r,K,L")]))]
3551 {%q3il|%q3i} %0,%1,%b2
3552 {%q3iu|%q3is} %0,%1,%u2")
3554 (define_insn "*boolsi3_internal2"
3555 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3556 (compare:CC (match_operator:SI 4 "boolean_or_operator"
3557 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
3558 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3560 (clobber (match_scratch:SI 3 "=r,r"))]
3565 [(set_attr "type" "fast_compare,compare")
3566 (set_attr "length" "4,8")])
3569 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3570 (compare:CC (match_operator:SI 4 "boolean_operator"
3571 [(match_operand:SI 1 "gpc_reg_operand" "")
3572 (match_operand:SI 2 "gpc_reg_operand" "")])
3574 (clobber (match_scratch:SI 3 ""))]
3575 "TARGET_32BIT && reload_completed"
3576 [(set (match_dup 3) (match_dup 4))
3578 (compare:CC (match_dup 3)
3582 (define_insn "*boolsi3_internal3"
3583 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3584 (compare:CC (match_operator:SI 4 "boolean_operator"
3585 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
3586 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3588 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3594 [(set_attr "type" "fast_compare,compare")
3595 (set_attr "length" "4,8")])
3598 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3599 (compare:CC (match_operator:SI 4 "boolean_operator"
3600 [(match_operand:SI 1 "gpc_reg_operand" "")
3601 (match_operand:SI 2 "gpc_reg_operand" "")])
3603 (set (match_operand:SI 0 "gpc_reg_operand" "")
3605 "TARGET_32BIT && reload_completed"
3606 [(set (match_dup 0) (match_dup 4))
3608 (compare:CC (match_dup 0)
3612 ;; Split a logical operation that we can't do in one insn into two insns,
3613 ;; each of which does one 16-bit part. This is used by combine.
3616 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3617 (match_operator:SI 3 "boolean_or_operator"
3618 [(match_operand:SI 1 "gpc_reg_operand" "")
3619 (match_operand:SI 2 "non_logical_cint_operand" "")]))]
3621 [(set (match_dup 0) (match_dup 4))
3622 (set (match_dup 0) (match_dup 5))]
3626 i = GEN_INT (INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff));
3627 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
3629 i = GEN_INT (INTVAL (operands[2]) & 0xffff);
3630 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
3634 (define_insn "*boolcsi3_internal1"
3635 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3636 (match_operator:SI 3 "boolean_operator"
3637 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
3638 (match_operand:SI 2 "gpc_reg_operand" "r")]))]
3642 (define_insn "*boolcsi3_internal2"
3643 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3644 (compare:CC (match_operator:SI 4 "boolean_operator"
3645 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
3646 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3648 (clobber (match_scratch:SI 3 "=r,r"))]
3653 [(set_attr "type" "compare")
3654 (set_attr "length" "4,8")])
3657 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3658 (compare:CC (match_operator:SI 4 "boolean_operator"
3659 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3660 (match_operand:SI 2 "gpc_reg_operand" "")])
3662 (clobber (match_scratch:SI 3 ""))]
3663 "TARGET_32BIT && reload_completed"
3664 [(set (match_dup 3) (match_dup 4))
3666 (compare:CC (match_dup 3)
3670 (define_insn "*boolcsi3_internal3"
3671 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3672 (compare:CC (match_operator:SI 4 "boolean_operator"
3673 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
3674 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3676 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3682 [(set_attr "type" "compare")
3683 (set_attr "length" "4,8")])
3686 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3687 (compare:CC (match_operator:SI 4 "boolean_operator"
3688 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3689 (match_operand:SI 2 "gpc_reg_operand" "")])
3691 (set (match_operand:SI 0 "gpc_reg_operand" "")
3693 "TARGET_32BIT && reload_completed"
3694 [(set (match_dup 0) (match_dup 4))
3696 (compare:CC (match_dup 0)
3700 (define_insn "*boolccsi3_internal1"
3701 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3702 (match_operator:SI 3 "boolean_operator"
3703 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
3704 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))]))]
3708 (define_insn "*boolccsi3_internal2"
3709 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3710 (compare:CC (match_operator:SI 4 "boolean_operator"
3711 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
3712 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
3714 (clobber (match_scratch:SI 3 "=r,r"))]
3719 [(set_attr "type" "fast_compare,compare")
3720 (set_attr "length" "4,8")])
3723 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3724 (compare:CC (match_operator:SI 4 "boolean_operator"
3725 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3726 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
3728 (clobber (match_scratch:SI 3 ""))]
3729 "TARGET_32BIT && reload_completed"
3730 [(set (match_dup 3) (match_dup 4))
3732 (compare:CC (match_dup 3)
3736 (define_insn "*boolccsi3_internal3"
3737 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3738 (compare:CC (match_operator:SI 4 "boolean_operator"
3739 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
3740 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
3742 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3748 [(set_attr "type" "fast_compare,compare")
3749 (set_attr "length" "4,8")])
3752 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3753 (compare:CC (match_operator:SI 4 "boolean_operator"
3754 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3755 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
3757 (set (match_operand:SI 0 "gpc_reg_operand" "")
3759 "TARGET_32BIT && reload_completed"
3760 [(set (match_dup 0) (match_dup 4))
3762 (compare:CC (match_dup 0)
3766 ;; maskir insn. We need four forms because things might be in arbitrary
3767 ;; orders. Don't define forms that only set CR fields because these
3768 ;; would modify an input register.
3770 (define_insn "*maskir_internal1"
3771 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3772 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
3773 (match_operand:SI 1 "gpc_reg_operand" "0"))
3774 (and:SI (match_dup 2)
3775 (match_operand:SI 3 "gpc_reg_operand" "r"))))]
3779 (define_insn "*maskir_internal2"
3780 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3781 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
3782 (match_operand:SI 1 "gpc_reg_operand" "0"))
3783 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3788 (define_insn "*maskir_internal3"
3789 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3790 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r")
3791 (match_operand:SI 3 "gpc_reg_operand" "r"))
3792 (and:SI (not:SI (match_dup 2))
3793 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
3797 (define_insn "*maskir_internal4"
3798 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3799 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3800 (match_operand:SI 2 "gpc_reg_operand" "r"))
3801 (and:SI (not:SI (match_dup 2))
3802 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
3806 (define_insn "*maskir_internal5"
3807 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3809 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3810 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
3811 (and:SI (match_dup 2)
3812 (match_operand:SI 3 "gpc_reg_operand" "r,r")))
3814 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3815 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3816 (and:SI (match_dup 2) (match_dup 3))))]
3821 [(set_attr "type" "compare")
3822 (set_attr "length" "4,8")])
3825 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3827 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
3828 (match_operand:SI 1 "gpc_reg_operand" ""))
3829 (and:SI (match_dup 2)
3830 (match_operand:SI 3 "gpc_reg_operand" "")))
3832 (set (match_operand:SI 0 "gpc_reg_operand" "")
3833 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3834 (and:SI (match_dup 2) (match_dup 3))))]
3835 "TARGET_POWER && reload_completed"
3837 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3838 (and:SI (match_dup 2) (match_dup 3))))
3840 (compare:CC (match_dup 0)
3844 (define_insn "*maskir_internal6"
3845 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3847 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3848 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
3849 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
3852 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3853 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3854 (and:SI (match_dup 3) (match_dup 2))))]
3859 [(set_attr "type" "compare")
3860 (set_attr "length" "4,8")])
3863 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3865 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
3866 (match_operand:SI 1 "gpc_reg_operand" ""))
3867 (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
3870 (set (match_operand:SI 0 "gpc_reg_operand" "")
3871 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3872 (and:SI (match_dup 3) (match_dup 2))))]
3873 "TARGET_POWER && reload_completed"
3875 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3876 (and:SI (match_dup 3) (match_dup 2))))
3878 (compare:CC (match_dup 0)
3882 (define_insn "*maskir_internal7"
3883 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3885 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r,r")
3886 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
3887 (and:SI (not:SI (match_dup 2))
3888 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
3890 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3891 (ior:SI (and:SI (match_dup 2) (match_dup 3))
3892 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3897 [(set_attr "type" "compare")
3898 (set_attr "length" "4,8")])
3901 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3903 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "")
3904 (match_operand:SI 3 "gpc_reg_operand" ""))
3905 (and:SI (not:SI (match_dup 2))
3906 (match_operand:SI 1 "gpc_reg_operand" "")))
3908 (set (match_operand:SI 0 "gpc_reg_operand" "")
3909 (ior:SI (and:SI (match_dup 2) (match_dup 3))
3910 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3911 "TARGET_POWER && reload_completed"
3913 (ior:SI (and:SI (match_dup 2) (match_dup 3))
3914 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
3916 (compare:CC (match_dup 0)
3920 (define_insn "*maskir_internal8"
3921 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3923 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
3924 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3925 (and:SI (not:SI (match_dup 2))
3926 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
3928 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3929 (ior:SI (and:SI (match_dup 3) (match_dup 2))
3930 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3935 [(set_attr "type" "compare")
3936 (set_attr "length" "4,8")])
3939 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3941 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
3942 (match_operand:SI 2 "gpc_reg_operand" ""))
3943 (and:SI (not:SI (match_dup 2))
3944 (match_operand:SI 1 "gpc_reg_operand" "")))
3946 (set (match_operand:SI 0 "gpc_reg_operand" "")
3947 (ior:SI (and:SI (match_dup 3) (match_dup 2))
3948 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3949 "TARGET_POWER && reload_completed"
3951 (ior:SI (and:SI (match_dup 3) (match_dup 2))
3952 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
3954 (compare:CC (match_dup 0)
3958 ;; Rotate and shift insns, in all their variants. These support shifts,
3959 ;; field inserts and extracts, and various combinations thereof.
3960 (define_expand "insv"
3961 [(set (zero_extract (match_operand 0 "gpc_reg_operand" "")
3962 (match_operand:SI 1 "const_int_operand" "")
3963 (match_operand:SI 2 "const_int_operand" ""))
3964 (match_operand 3 "gpc_reg_operand" ""))]
3968 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3969 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3970 compiler if the address of the structure is taken later. Likewise, do
3971 not handle invalid E500 subregs. */
3972 if (GET_CODE (operands[0]) == SUBREG
3973 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD
3974 || ((TARGET_E500_DOUBLE || TARGET_SPE)
3975 && invalid_e500_subreg (operands[0], GET_MODE (operands[0])))))
3978 if (TARGET_POWERPC64 && GET_MODE (operands[0]) == DImode)
3979 emit_insn (gen_insvdi (operands[0], operands[1], operands[2], operands[3]));
3981 emit_insn (gen_insvsi (operands[0], operands[1], operands[2], operands[3]));
3985 (define_insn "insvsi"
3986 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3987 (match_operand:SI 1 "const_int_operand" "i")
3988 (match_operand:SI 2 "const_int_operand" "i"))
3989 (match_operand:SI 3 "gpc_reg_operand" "r"))]
3993 int start = INTVAL (operands[2]) & 31;
3994 int size = INTVAL (operands[1]) & 31;
3996 operands[4] = GEN_INT (32 - start - size);
3997 operands[1] = GEN_INT (start + size - 1);
3998 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
4000 [(set_attr "type" "insert_word")])
4002 (define_insn "*insvsi_internal1"
4003 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4004 (match_operand:SI 1 "const_int_operand" "i")
4005 (match_operand:SI 2 "const_int_operand" "i"))
4006 (rotate:SI (match_operand:SI 3 "gpc_reg_operand" "r")
4007 (match_operand:SI 4 "const_int_operand" "i")))]
4008 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
4011 int shift = INTVAL (operands[4]) & 31;
4012 int start = INTVAL (operands[2]) & 31;
4013 int size = INTVAL (operands[1]) & 31;
4015 operands[4] = GEN_INT (shift - start - size);
4016 operands[1] = GEN_INT (start + size - 1);
4017 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
4019 [(set_attr "type" "insert_word")])
4021 (define_insn "*insvsi_internal2"
4022 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4023 (match_operand:SI 1 "const_int_operand" "i")
4024 (match_operand:SI 2 "const_int_operand" "i"))
4025 (ashiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
4026 (match_operand:SI 4 "const_int_operand" "i")))]
4027 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
4030 int shift = INTVAL (operands[4]) & 31;
4031 int start = INTVAL (operands[2]) & 31;
4032 int size = INTVAL (operands[1]) & 31;
4034 operands[4] = GEN_INT (32 - shift - start - size);
4035 operands[1] = GEN_INT (start + size - 1);
4036 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
4038 [(set_attr "type" "insert_word")])
4040 (define_insn "*insvsi_internal3"
4041 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4042 (match_operand:SI 1 "const_int_operand" "i")
4043 (match_operand:SI 2 "const_int_operand" "i"))
4044 (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
4045 (match_operand:SI 4 "const_int_operand" "i")))]
4046 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
4049 int shift = INTVAL (operands[4]) & 31;
4050 int start = INTVAL (operands[2]) & 31;
4051 int size = INTVAL (operands[1]) & 31;
4053 operands[4] = GEN_INT (32 - shift - start - size);
4054 operands[1] = GEN_INT (start + size - 1);
4055 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
4057 [(set_attr "type" "insert_word")])
4059 (define_insn "*insvsi_internal4"
4060 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4061 (match_operand:SI 1 "const_int_operand" "i")
4062 (match_operand:SI 2 "const_int_operand" "i"))
4063 (zero_extract:SI (match_operand:SI 3 "gpc_reg_operand" "r")
4064 (match_operand:SI 4 "const_int_operand" "i")
4065 (match_operand:SI 5 "const_int_operand" "i")))]
4066 "INTVAL (operands[4]) >= INTVAL (operands[1])"
4069 int extract_start = INTVAL (operands[5]) & 31;
4070 int extract_size = INTVAL (operands[4]) & 31;
4071 int insert_start = INTVAL (operands[2]) & 31;
4072 int insert_size = INTVAL (operands[1]) & 31;
4074 /* Align extract field with insert field */
4075 operands[5] = GEN_INT (extract_start + extract_size - insert_start - insert_size);
4076 operands[1] = GEN_INT (insert_start + insert_size - 1);
4077 return \"{rlimi|rlwimi} %0,%3,%h5,%h2,%h1\";
4079 [(set_attr "type" "insert_word")])
4081 ;; combine patterns for rlwimi
4082 (define_insn "*insvsi_internal5"
4083 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4084 (ior:SI (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
4085 (match_operand:SI 1 "mask_operand" "i"))
4086 (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
4087 (match_operand:SI 2 "const_int_operand" "i"))
4088 (match_operand:SI 5 "mask_operand" "i"))))]
4089 "TARGET_POWERPC && INTVAL(operands[1]) == ~INTVAL(operands[5])"
4092 int me = extract_ME(operands[5]);
4093 int mb = extract_MB(operands[5]);
4094 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
4095 operands[2] = GEN_INT(mb);
4096 operands[1] = GEN_INT(me);
4097 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
4099 [(set_attr "type" "insert_word")])
4101 (define_insn "*insvsi_internal6"
4102 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4103 (ior:SI (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
4104 (match_operand:SI 2 "const_int_operand" "i"))
4105 (match_operand:SI 5 "mask_operand" "i"))
4106 (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
4107 (match_operand:SI 1 "mask_operand" "i"))))]
4108 "TARGET_POWERPC && INTVAL(operands[1]) == ~INTVAL(operands[5])"
4111 int me = extract_ME(operands[5]);
4112 int mb = extract_MB(operands[5]);
4113 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
4114 operands[2] = GEN_INT(mb);
4115 operands[1] = GEN_INT(me);
4116 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
4118 [(set_attr "type" "insert_word")])
4120 (define_insn "insvdi"
4121 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
4122 (match_operand:SI 1 "const_int_operand" "i")
4123 (match_operand:SI 2 "const_int_operand" "i"))
4124 (match_operand:DI 3 "gpc_reg_operand" "r"))]
4128 int start = INTVAL (operands[2]) & 63;
4129 int size = INTVAL (operands[1]) & 63;
4131 operands[1] = GEN_INT (64 - start - size);
4132 return \"rldimi %0,%3,%H1,%H2\";
4134 [(set_attr "type" "insert_dword")])
4136 (define_insn "*insvdi_internal2"
4137 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
4138 (match_operand:SI 1 "const_int_operand" "i")
4139 (match_operand:SI 2 "const_int_operand" "i"))
4140 (ashiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
4141 (match_operand:SI 4 "const_int_operand" "i")))]
4143 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
4146 int shift = INTVAL (operands[4]) & 63;
4147 int start = (INTVAL (operands[2]) & 63) - 32;
4148 int size = INTVAL (operands[1]) & 63;
4150 operands[4] = GEN_INT (64 - shift - start - size);
4151 operands[2] = GEN_INT (start);
4152 operands[1] = GEN_INT (start + size - 1);
4153 return \"rlwimi %0,%3,%h4,%h2,%h1\";
4156 (define_insn "*insvdi_internal3"
4157 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
4158 (match_operand:SI 1 "const_int_operand" "i")
4159 (match_operand:SI 2 "const_int_operand" "i"))
4160 (lshiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
4161 (match_operand:SI 4 "const_int_operand" "i")))]
4163 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
4166 int shift = INTVAL (operands[4]) & 63;
4167 int start = (INTVAL (operands[2]) & 63) - 32;
4168 int size = INTVAL (operands[1]) & 63;
4170 operands[4] = GEN_INT (64 - shift - start - size);
4171 operands[2] = GEN_INT (start);
4172 operands[1] = GEN_INT (start + size - 1);
4173 return \"rlwimi %0,%3,%h4,%h2,%h1\";
4176 (define_expand "extzv"
4177 [(set (match_operand 0 "gpc_reg_operand" "")
4178 (zero_extract (match_operand 1 "gpc_reg_operand" "")
4179 (match_operand:SI 2 "const_int_operand" "")
4180 (match_operand:SI 3 "const_int_operand" "")))]
4184 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
4185 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
4186 compiler if the address of the structure is taken later. */
4187 if (GET_CODE (operands[0]) == SUBREG
4188 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
4191 if (TARGET_POWERPC64 && GET_MODE (operands[1]) == DImode)
4192 emit_insn (gen_extzvdi (operands[0], operands[1], operands[2], operands[3]));
4194 emit_insn (gen_extzvsi (operands[0], operands[1], operands[2], operands[3]));
4198 (define_insn "extzvsi"
4199 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4200 (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4201 (match_operand:SI 2 "const_int_operand" "i")
4202 (match_operand:SI 3 "const_int_operand" "i")))]
4206 int start = INTVAL (operands[3]) & 31;
4207 int size = INTVAL (operands[2]) & 31;
4209 if (start + size >= 32)
4210 operands[3] = const0_rtx;
4212 operands[3] = GEN_INT (start + size);
4213 return \"{rlinm|rlwinm} %0,%1,%3,%s2,31\";
4216 (define_insn "*extzvsi_internal1"
4217 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4218 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4219 (match_operand:SI 2 "const_int_operand" "i,i")
4220 (match_operand:SI 3 "const_int_operand" "i,i"))
4222 (clobber (match_scratch:SI 4 "=r,r"))]
4226 int start = INTVAL (operands[3]) & 31;
4227 int size = INTVAL (operands[2]) & 31;
4229 /* Force split for non-cc0 compare. */
4230 if (which_alternative == 1)
4233 /* If the bit-field being tested fits in the upper or lower half of a
4234 word, it is possible to use andiu. or andil. to test it. This is
4235 useful because the condition register set-use delay is smaller for
4236 andi[ul]. than for rlinm. This doesn't work when the starting bit
4237 position is 0 because the LT and GT bits may be set wrong. */
4239 if ((start > 0 && start + size <= 16) || start >= 16)
4241 operands[3] = GEN_INT (((1 << (16 - (start & 15)))
4242 - (1 << (16 - (start & 15) - size))));
4244 return \"{andiu.|andis.} %4,%1,%3\";
4246 return \"{andil.|andi.} %4,%1,%3\";
4249 if (start + size >= 32)
4250 operands[3] = const0_rtx;
4252 operands[3] = GEN_INT (start + size);
4253 return \"{rlinm.|rlwinm.} %4,%1,%3,%s2,31\";
4255 [(set_attr "type" "delayed_compare")
4256 (set_attr "length" "4,8")])
4259 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4260 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
4261 (match_operand:SI 2 "const_int_operand" "")
4262 (match_operand:SI 3 "const_int_operand" ""))
4264 (clobber (match_scratch:SI 4 ""))]
4267 (zero_extract:SI (match_dup 1) (match_dup 2)
4270 (compare:CC (match_dup 4)
4274 (define_insn "*extzvsi_internal2"
4275 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4276 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4277 (match_operand:SI 2 "const_int_operand" "i,i")
4278 (match_operand:SI 3 "const_int_operand" "i,i"))
4280 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4281 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
4285 int start = INTVAL (operands[3]) & 31;
4286 int size = INTVAL (operands[2]) & 31;
4288 /* Force split for non-cc0 compare. */
4289 if (which_alternative == 1)
4292 /* Since we are using the output value, we can't ignore any need for
4293 a shift. The bit-field must end at the LSB. */
4294 if (start >= 16 && start + size == 32)
4296 operands[3] = GEN_INT ((1 << size) - 1);
4297 return \"{andil.|andi.} %0,%1,%3\";
4300 if (start + size >= 32)
4301 operands[3] = const0_rtx;
4303 operands[3] = GEN_INT (start + size);
4304 return \"{rlinm.|rlwinm.} %0,%1,%3,%s2,31\";
4306 [(set_attr "type" "delayed_compare")
4307 (set_attr "length" "4,8")])
4310 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
4311 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
4312 (match_operand:SI 2 "const_int_operand" "")
4313 (match_operand:SI 3 "const_int_operand" ""))
4315 (set (match_operand:SI 0 "gpc_reg_operand" "")
4316 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
4319 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))
4321 (compare:CC (match_dup 0)
4325 (define_insn "extzvdi"
4326 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4327 (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4328 (match_operand:SI 2 "const_int_operand" "i")
4329 (match_operand:SI 3 "const_int_operand" "i")))]
4333 int start = INTVAL (operands[3]) & 63;
4334 int size = INTVAL (operands[2]) & 63;
4336 if (start + size >= 64)
4337 operands[3] = const0_rtx;
4339 operands[3] = GEN_INT (start + size);
4340 operands[2] = GEN_INT (64 - size);
4341 return \"rldicl %0,%1,%3,%2\";
4344 (define_insn "*extzvdi_internal1"
4345 [(set (match_operand:CC 0 "gpc_reg_operand" "=x")
4346 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4347 (match_operand:SI 2 "const_int_operand" "i")
4348 (match_operand:SI 3 "const_int_operand" "i"))
4350 (clobber (match_scratch:DI 4 "=r"))]
4351 "TARGET_64BIT && rs6000_gen_cell_microcode"
4354 int start = INTVAL (operands[3]) & 63;
4355 int size = INTVAL (operands[2]) & 63;
4357 if (start + size >= 64)
4358 operands[3] = const0_rtx;
4360 operands[3] = GEN_INT (start + size);
4361 operands[2] = GEN_INT (64 - size);
4362 return \"rldicl. %4,%1,%3,%2\";
4364 [(set_attr "type" "compare")])
4366 (define_insn "*extzvdi_internal2"
4367 [(set (match_operand:CC 4 "gpc_reg_operand" "=x")
4368 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4369 (match_operand:SI 2 "const_int_operand" "i")
4370 (match_operand:SI 3 "const_int_operand" "i"))
4372 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
4373 (zero_extract:DI (match_dup 1) (match_dup 2) (match_dup 3)))]
4374 "TARGET_64BIT && rs6000_gen_cell_microcode"
4377 int start = INTVAL (operands[3]) & 63;
4378 int size = INTVAL (operands[2]) & 63;
4380 if (start + size >= 64)
4381 operands[3] = const0_rtx;
4383 operands[3] = GEN_INT (start + size);
4384 operands[2] = GEN_INT (64 - size);
4385 return \"rldicl. %0,%1,%3,%2\";
4387 [(set_attr "type" "compare")])
4389 (define_insn "rotlsi3"
4390 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4391 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4392 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
4395 {rlnm|rlwnm} %0,%1,%2,0xffffffff
4396 {rlinm|rlwinm} %0,%1,%h2,0xffffffff"
4397 [(set_attr "type" "var_shift_rotate,integer")])
4399 (define_insn "*rotlsi3_64"
4400 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
4402 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4403 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))))]
4406 {rlnm|rlwnm} %0,%1,%2,0xffffffff
4407 {rlinm|rlwinm} %0,%1,%h2,0xffffffff"
4408 [(set_attr "type" "var_shift_rotate,integer")])
4410 (define_insn "*rotlsi3_internal2"
4411 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4412 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4413 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4415 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4418 {rlnm.|rlwnm.} %3,%1,%2,0xffffffff
4419 {rlinm.|rlwinm.} %3,%1,%h2,0xffffffff
4422 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4423 (set_attr "length" "4,4,8,8")])
4426 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4427 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4428 (match_operand:SI 2 "reg_or_cint_operand" ""))
4430 (clobber (match_scratch:SI 3 ""))]
4433 (rotate:SI (match_dup 1) (match_dup 2)))
4435 (compare:CC (match_dup 3)
4439 (define_insn "*rotlsi3_internal3"
4440 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4441 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4442 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4444 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4445 (rotate:SI (match_dup 1) (match_dup 2)))]
4448 {rlnm.|rlwnm.} %0,%1,%2,0xffffffff
4449 {rlinm.|rlwinm.} %0,%1,%h2,0xffffffff
4452 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4453 (set_attr "length" "4,4,8,8")])
4456 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4457 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4458 (match_operand:SI 2 "reg_or_cint_operand" ""))
4460 (set (match_operand:SI 0 "gpc_reg_operand" "")
4461 (rotate:SI (match_dup 1) (match_dup 2)))]
4464 (rotate:SI (match_dup 1) (match_dup 2)))
4466 (compare:CC (match_dup 0)
4470 (define_insn "*rotlsi3_internal4"
4471 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4472 (and:SI (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4473 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
4474 (match_operand:SI 3 "mask_operand" "n,n")))]
4477 {rlnm|rlwnm} %0,%1,%2,%m3,%M3
4478 {rlinm|rlwinm} %0,%1,%h2,%m3,%M3"
4479 [(set_attr "type" "var_shift_rotate,integer")])
4481 (define_insn "*rotlsi3_internal5"
4482 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4484 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4485 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4486 (match_operand:SI 3 "mask_operand" "n,n,n,n"))
4488 (clobber (match_scratch:SI 4 "=r,r,r,r"))]
4491 {rlnm.|rlwnm.} %4,%1,%2,%m3,%M3
4492 {rlinm.|rlwinm.} %4,%1,%h2,%m3,%M3
4495 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4496 (set_attr "length" "4,4,8,8")])
4499 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4501 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4502 (match_operand:SI 2 "reg_or_cint_operand" ""))
4503 (match_operand:SI 3 "mask_operand" ""))
4505 (clobber (match_scratch:SI 4 ""))]
4508 (and:SI (rotate:SI (match_dup 1)
4512 (compare:CC (match_dup 4)
4516 (define_insn "*rotlsi3_internal6"
4517 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
4519 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4520 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4521 (match_operand:SI 3 "mask_operand" "n,n,n,n"))
4523 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4524 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4527 {rlnm.|rlwnm.} %0,%1,%2,%m3,%M3
4528 {rlinm.|rlwinm.} %0,%1,%h2,%m3,%M3
4531 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4532 (set_attr "length" "4,4,8,8")])
4535 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
4537 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4538 (match_operand:SI 2 "reg_or_cint_operand" ""))
4539 (match_operand:SI 3 "mask_operand" ""))
4541 (set (match_operand:SI 0 "gpc_reg_operand" "")
4542 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4545 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4547 (compare:CC (match_dup 0)
4551 (define_insn "*rotlsi3_internal7"
4552 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4555 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4556 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
4558 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xff"
4559 [(set (attr "cell_micro")
4560 (if_then_else (match_operand:SI 2 "const_int_operand" "")
4561 (const_string "not")
4562 (const_string "always")))])
4564 (define_insn "*rotlsi3_internal8"
4565 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4566 (compare:CC (zero_extend:SI
4568 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4569 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4571 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4574 {rlnm.|rlwnm.} %3,%1,%2,0xff
4575 {rlinm.|rlwinm.} %3,%1,%h2,0xff
4578 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4579 (set_attr "length" "4,4,8,8")])
4582 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4583 (compare:CC (zero_extend:SI
4585 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4586 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4588 (clobber (match_scratch:SI 3 ""))]
4591 (zero_extend:SI (subreg:QI
4592 (rotate:SI (match_dup 1)
4595 (compare:CC (match_dup 3)
4599 (define_insn "*rotlsi3_internal9"
4600 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4601 (compare:CC (zero_extend:SI
4603 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4604 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4606 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4607 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4610 {rlnm.|rlwnm.} %0,%1,%2,0xff
4611 {rlinm.|rlwinm.} %0,%1,%h2,0xff
4614 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4615 (set_attr "length" "4,4,8,8")])
4618 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4619 (compare:CC (zero_extend:SI
4621 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4622 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4624 (set (match_operand:SI 0 "gpc_reg_operand" "")
4625 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4628 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
4630 (compare:CC (match_dup 0)
4634 (define_insn "*rotlsi3_internal10"
4635 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4638 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4639 (match_operand:SI 2 "reg_or_cint_operand" "r,i")) 0)))]
4642 {rlnm|rlwnm} %0,%1,%2,0xffff
4643 {rlinm|rlwinm} %0,%1,%h2,0xffff"
4644 [(set_attr "type" "var_shift_rotate,integer")])
4647 (define_insn "*rotlsi3_internal11"
4648 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4649 (compare:CC (zero_extend:SI
4651 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4652 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4654 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4657 {rlnm.|rlwnm.} %3,%1,%2,0xffff
4658 {rlinm.|rlwinm.} %3,%1,%h2,0xffff
4661 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4662 (set_attr "length" "4,4,8,8")])
4665 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4666 (compare:CC (zero_extend:SI
4668 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4669 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4671 (clobber (match_scratch:SI 3 ""))]
4674 (zero_extend:SI (subreg:HI
4675 (rotate:SI (match_dup 1)
4678 (compare:CC (match_dup 3)
4682 (define_insn "*rotlsi3_internal12"
4683 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4684 (compare:CC (zero_extend:SI
4686 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4687 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4689 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4690 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4693 {rlnm.|rlwnm.} %0,%1,%2,0xffff
4694 {rlinm.|rlwinm.} %0,%1,%h2,0xffff
4697 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4698 (set_attr "length" "4,4,8,8")])
4701 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4702 (compare:CC (zero_extend:SI
4704 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4705 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4707 (set (match_operand:SI 0 "gpc_reg_operand" "")
4708 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4711 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
4713 (compare:CC (match_dup 0)
4717 ;; Note that we use "sle." instead of "sl." so that we can set
4718 ;; SHIFT_COUNT_TRUNCATED.
4720 (define_expand "ashlsi3"
4721 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
4722 (use (match_operand:SI 1 "gpc_reg_operand" ""))
4723 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
4728 emit_insn (gen_ashlsi3_power (operands[0], operands[1], operands[2]));
4730 emit_insn (gen_ashlsi3_no_power (operands[0], operands[1], operands[2]));
4734 (define_insn "ashlsi3_power"
4735 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4736 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4737 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
4738 (clobber (match_scratch:SI 3 "=q,X"))]
4742 {sli|slwi} %0,%1,%h2")
4744 (define_insn "ashlsi3_no_power"
4745 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4746 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4747 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
4751 {sli|slwi} %0,%1,%h2"
4752 [(set_attr "type" "var_shift_rotate,shift")])
4754 (define_insn "*ashlsi3_64"
4755 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
4757 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4758 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))))]
4762 {sli|slwi} %0,%1,%h2"
4763 [(set_attr "type" "var_shift_rotate,shift")])
4766 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4767 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4768 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4770 (clobber (match_scratch:SI 3 "=r,r,r,r"))
4771 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4775 {sli.|slwi.} %3,%1,%h2
4778 [(set_attr "type" "delayed_compare")
4779 (set_attr "length" "4,4,8,8")])
4782 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4783 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4784 (match_operand:SI 2 "reg_or_cint_operand" ""))
4786 (clobber (match_scratch:SI 3 ""))
4787 (clobber (match_scratch:SI 4 ""))]
4788 "TARGET_POWER && reload_completed"
4789 [(parallel [(set (match_dup 3)
4790 (ashift:SI (match_dup 1) (match_dup 2)))
4791 (clobber (match_dup 4))])
4793 (compare:CC (match_dup 3)
4798 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4799 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4800 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4802 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4803 "! TARGET_POWER && TARGET_32BIT"
4806 {sli.|slwi.} %3,%1,%h2
4809 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4810 (set_attr "length" "4,4,8,8")])
4813 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4814 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4815 (match_operand:SI 2 "reg_or_cint_operand" ""))
4817 (clobber (match_scratch:SI 3 ""))]
4818 "! TARGET_POWER && TARGET_32BIT && reload_completed"
4820 (ashift:SI (match_dup 1) (match_dup 2)))
4822 (compare:CC (match_dup 3)
4827 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4828 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4829 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4831 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4832 (ashift:SI (match_dup 1) (match_dup 2)))
4833 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4837 {sli.|slwi.} %0,%1,%h2
4840 [(set_attr "type" "delayed_compare")
4841 (set_attr "length" "4,4,8,8")])
4844 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4845 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4846 (match_operand:SI 2 "reg_or_cint_operand" ""))
4848 (set (match_operand:SI 0 "gpc_reg_operand" "")
4849 (ashift:SI (match_dup 1) (match_dup 2)))
4850 (clobber (match_scratch:SI 4 ""))]
4851 "TARGET_POWER && reload_completed"
4852 [(parallel [(set (match_dup 0)
4853 (ashift:SI (match_dup 1) (match_dup 2)))
4854 (clobber (match_dup 4))])
4856 (compare:CC (match_dup 0)
4861 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4862 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4863 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4865 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4866 (ashift:SI (match_dup 1) (match_dup 2)))]
4867 "! TARGET_POWER && TARGET_32BIT"
4870 {sli.|slwi.} %0,%1,%h2
4873 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4874 (set_attr "length" "4,4,8,8")])
4877 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4878 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4879 (match_operand:SI 2 "reg_or_cint_operand" ""))
4881 (set (match_operand:SI 0 "gpc_reg_operand" "")
4882 (ashift:SI (match_dup 1) (match_dup 2)))]
4883 "! TARGET_POWER && TARGET_32BIT && reload_completed"
4885 (ashift:SI (match_dup 1) (match_dup 2)))
4887 (compare:CC (match_dup 0)
4891 (define_insn "rlwinm"
4892 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4893 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4894 (match_operand:SI 2 "const_int_operand" "i"))
4895 (match_operand:SI 3 "mask_operand" "n")))]
4896 "includes_lshift_p (operands[2], operands[3])"
4897 "{rlinm|rlwinm} %0,%1,%h2,%m3,%M3")
4900 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4902 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4903 (match_operand:SI 2 "const_int_operand" "i,i"))
4904 (match_operand:SI 3 "mask_operand" "n,n"))
4906 (clobber (match_scratch:SI 4 "=r,r"))]
4907 "includes_lshift_p (operands[2], operands[3])"
4909 {rlinm.|rlwinm.} %4,%1,%h2,%m3,%M3
4911 [(set_attr "type" "delayed_compare")
4912 (set_attr "length" "4,8")])
4915 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4917 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4918 (match_operand:SI 2 "const_int_operand" ""))
4919 (match_operand:SI 3 "mask_operand" ""))
4921 (clobber (match_scratch:SI 4 ""))]
4922 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
4924 (and:SI (ashift:SI (match_dup 1) (match_dup 2))
4927 (compare:CC (match_dup 4)
4932 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4934 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4935 (match_operand:SI 2 "const_int_operand" "i,i"))
4936 (match_operand:SI 3 "mask_operand" "n,n"))
4938 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4939 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4940 "includes_lshift_p (operands[2], operands[3])"
4942 {rlinm.|rlwinm.} %0,%1,%h2,%m3,%M3
4944 [(set_attr "type" "delayed_compare")
4945 (set_attr "length" "4,8")])
4948 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
4950 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4951 (match_operand:SI 2 "const_int_operand" ""))
4952 (match_operand:SI 3 "mask_operand" ""))
4954 (set (match_operand:SI 0 "gpc_reg_operand" "")
4955 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4956 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
4958 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4960 (compare:CC (match_dup 0)
4964 ;; The AIX assembler mis-handles "sri x,x,0", so write that case as
4966 (define_expand "lshrsi3"
4967 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
4968 (use (match_operand:SI 1 "gpc_reg_operand" ""))
4969 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
4974 emit_insn (gen_lshrsi3_power (operands[0], operands[1], operands[2]));
4976 emit_insn (gen_lshrsi3_no_power (operands[0], operands[1], operands[2]));
4980 (define_insn "lshrsi3_power"
4981 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
4982 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
4983 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i")))
4984 (clobber (match_scratch:SI 3 "=q,X,X"))]
4989 {s%A2i|s%A2wi} %0,%1,%h2")
4991 (define_insn "lshrsi3_no_power"
4992 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
4993 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
4994 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i")))]
4999 {sri|srwi} %0,%1,%h2"
5000 [(set_attr "type" "integer,var_shift_rotate,shift")])
5002 (define_insn "*lshrsi3_64"
5003 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
5005 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5006 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))))]
5010 {sri|srwi} %0,%1,%h2"
5011 [(set_attr "type" "var_shift_rotate,shift")])
5014 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,?y,?y,?y")
5015 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
5016 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
5018 (clobber (match_scratch:SI 3 "=r,X,r,r,X,r"))
5019 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
5024 {s%A2i.|s%A2wi.} %3,%1,%h2
5028 [(set_attr "type" "delayed_compare")
5029 (set_attr "length" "4,4,4,8,8,8")])
5032 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
5033 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5034 (match_operand:SI 2 "reg_or_cint_operand" ""))
5036 (clobber (match_scratch:SI 3 ""))
5037 (clobber (match_scratch:SI 4 ""))]
5038 "TARGET_POWER && reload_completed"
5039 [(parallel [(set (match_dup 3)
5040 (lshiftrt:SI (match_dup 1) (match_dup 2)))
5041 (clobber (match_dup 4))])
5043 (compare:CC (match_dup 3)
5048 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,?y,?y,?y")
5049 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
5050 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i,O,r,i"))
5052 (clobber (match_scratch:SI 3 "=X,r,r,X,r,r"))]
5053 "! TARGET_POWER && TARGET_32BIT"
5057 {sri.|srwi.} %3,%1,%h2
5061 [(set_attr "type" "delayed_compare,var_delayed_compare,delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
5062 (set_attr "length" "4,4,4,8,8,8")])
5065 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
5066 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5067 (match_operand:SI 2 "reg_or_cint_operand" ""))
5069 (clobber (match_scratch:SI 3 ""))]
5070 "! TARGET_POWER && TARGET_32BIT && reload_completed"
5072 (lshiftrt:SI (match_dup 1) (match_dup 2)))
5074 (compare:CC (match_dup 3)
5079 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,?y,?y,?y")
5080 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
5081 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
5083 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
5084 (lshiftrt:SI (match_dup 1) (match_dup 2)))
5085 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
5090 {s%A2i.|s%A2wi.} %0,%1,%h2
5094 [(set_attr "type" "delayed_compare")
5095 (set_attr "length" "4,4,4,8,8,8")])
5098 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
5099 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5100 (match_operand:SI 2 "reg_or_cint_operand" ""))
5102 (set (match_operand:SI 0 "gpc_reg_operand" "")
5103 (lshiftrt:SI (match_dup 1) (match_dup 2)))
5104 (clobber (match_scratch:SI 4 ""))]
5105 "TARGET_POWER && reload_completed"
5106 [(parallel [(set (match_dup 0)
5107 (lshiftrt:SI (match_dup 1) (match_dup 2)))
5108 (clobber (match_dup 4))])
5110 (compare:CC (match_dup 0)
5115 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,?y,?y,?y")
5116 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
5117 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i,O,r,i"))
5119 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
5120 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
5121 "! TARGET_POWER && TARGET_32BIT"
5125 {sri.|srwi.} %0,%1,%h2
5129 [(set_attr "type" "delayed_compare,var_delayed_compare,delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
5130 (set_attr "length" "4,4,4,8,8,8")])
5133 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
5134 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5135 (match_operand:SI 2 "reg_or_cint_operand" ""))
5137 (set (match_operand:SI 0 "gpc_reg_operand" "")
5138 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
5139 "! TARGET_POWER && TARGET_32BIT && reload_completed"
5141 (lshiftrt:SI (match_dup 1) (match_dup 2)))
5143 (compare:CC (match_dup 0)
5148 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5149 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
5150 (match_operand:SI 2 "const_int_operand" "i"))
5151 (match_operand:SI 3 "mask_operand" "n")))]
5152 "includes_rshift_p (operands[2], operands[3])"
5153 "{rlinm|rlwinm} %0,%1,%s2,%m3,%M3")
5156 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
5158 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5159 (match_operand:SI 2 "const_int_operand" "i,i"))
5160 (match_operand:SI 3 "mask_operand" "n,n"))
5162 (clobber (match_scratch:SI 4 "=r,r"))]
5163 "includes_rshift_p (operands[2], operands[3])"
5165 {rlinm.|rlwinm.} %4,%1,%s2,%m3,%M3
5167 [(set_attr "type" "delayed_compare")
5168 (set_attr "length" "4,8")])
5171 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
5173 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5174 (match_operand:SI 2 "const_int_operand" ""))
5175 (match_operand:SI 3 "mask_operand" ""))
5177 (clobber (match_scratch:SI 4 ""))]
5178 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
5180 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2))
5183 (compare:CC (match_dup 4)
5188 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
5190 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5191 (match_operand:SI 2 "const_int_operand" "i,i"))
5192 (match_operand:SI 3 "mask_operand" "n,n"))
5194 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
5195 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
5196 "includes_rshift_p (operands[2], operands[3])"
5198 {rlinm.|rlwinm.} %0,%1,%s2,%m3,%M3
5200 [(set_attr "type" "delayed_compare")
5201 (set_attr "length" "4,8")])
5204 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
5206 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5207 (match_operand:SI 2 "const_int_operand" ""))
5208 (match_operand:SI 3 "mask_operand" ""))
5210 (set (match_operand:SI 0 "gpc_reg_operand" "")
5211 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
5212 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
5214 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
5216 (compare:CC (match_dup 0)
5221 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5224 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
5225 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
5226 "includes_rshift_p (operands[2], GEN_INT (255))"
5227 "{rlinm|rlwinm} %0,%1,%s2,0xff")
5230 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
5234 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5235 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
5237 (clobber (match_scratch:SI 3 "=r,r"))]
5238 "includes_rshift_p (operands[2], GEN_INT (255))"
5240 {rlinm.|rlwinm.} %3,%1,%s2,0xff
5242 [(set_attr "type" "delayed_compare")
5243 (set_attr "length" "4,8")])
5246 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
5250 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5251 (match_operand:SI 2 "const_int_operand" "")) 0))
5253 (clobber (match_scratch:SI 3 ""))]
5254 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
5256 (zero_extend:SI (subreg:QI
5257 (lshiftrt:SI (match_dup 1)
5260 (compare:CC (match_dup 3)
5265 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
5269 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5270 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
5272 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
5273 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
5274 "includes_rshift_p (operands[2], GEN_INT (255))"
5276 {rlinm.|rlwinm.} %0,%1,%s2,0xff
5278 [(set_attr "type" "delayed_compare")
5279 (set_attr "length" "4,8")])
5282 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
5286 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5287 (match_operand:SI 2 "const_int_operand" "")) 0))
5289 (set (match_operand:SI 0 "gpc_reg_operand" "")
5290 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
5291 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
5293 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
5295 (compare:CC (match_dup 0)
5300 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5303 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
5304 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
5305 "includes_rshift_p (operands[2], GEN_INT (65535))"
5306 "{rlinm|rlwinm} %0,%1,%s2,0xffff")
5309 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
5313 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5314 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
5316 (clobber (match_scratch:SI 3 "=r,r"))]
5317 "includes_rshift_p (operands[2], GEN_INT (65535))"
5319 {rlinm.|rlwinm.} %3,%1,%s2,0xffff
5321 [(set_attr "type" "delayed_compare")
5322 (set_attr "length" "4,8")])
5325 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
5329 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5330 (match_operand:SI 2 "const_int_operand" "")) 0))
5332 (clobber (match_scratch:SI 3 ""))]
5333 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
5335 (zero_extend:SI (subreg:HI
5336 (lshiftrt:SI (match_dup 1)
5339 (compare:CC (match_dup 3)
5344 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
5348 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5349 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
5351 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
5352 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
5353 "includes_rshift_p (operands[2], GEN_INT (65535))"
5355 {rlinm.|rlwinm.} %0,%1,%s2,0xffff
5357 [(set_attr "type" "delayed_compare")
5358 (set_attr "length" "4,8")])
5361 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
5365 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5366 (match_operand:SI 2 "const_int_operand" "")) 0))
5368 (set (match_operand:SI 0 "gpc_reg_operand" "")
5369 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
5370 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
5372 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
5374 (compare:CC (match_dup 0)
5379 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
5381 (match_operand:SI 1 "gpc_reg_operand" "r"))
5382 (ashiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
5388 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
5390 (match_operand:SI 1 "gpc_reg_operand" "r"))
5391 (lshiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
5397 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
5399 (match_operand:SI 1 "gpc_reg_operand" "r"))
5400 (zero_extract:SI (match_operand:SI 2 "gpc_reg_operand" "r")
5406 (define_expand "ashrsi3"
5407 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5408 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5409 (match_operand:SI 2 "reg_or_cint_operand" "")))]
5414 emit_insn (gen_ashrsi3_power (operands[0], operands[1], operands[2]));
5416 emit_insn (gen_ashrsi3_no_power (operands[0], operands[1], operands[2]));
5420 (define_insn "ashrsi3_power"
5421 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
5422 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5423 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
5424 (clobber (match_scratch:SI 3 "=q,X"))]
5428 {srai|srawi} %0,%1,%h2"
5429 [(set_attr "type" "shift")])
5431 (define_insn "ashrsi3_no_power"
5432 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
5433 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5434 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
5438 {srai|srawi} %0,%1,%h2"
5439 [(set_attr "type" "var_shift_rotate,shift")])
5441 (define_insn "*ashrsi3_64"
5442 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
5444 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5445 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))))]
5449 {srai|srawi} %0,%1,%h2"
5450 [(set_attr "type" "var_shift_rotate,shift")])
5453 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
5454 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
5455 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
5457 (clobber (match_scratch:SI 3 "=r,r,r,r"))
5458 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
5462 {srai.|srawi.} %3,%1,%h2
5465 [(set_attr "type" "delayed_compare")
5466 (set_attr "length" "4,4,8,8")])
5469 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
5470 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5471 (match_operand:SI 2 "reg_or_cint_operand" ""))
5473 (clobber (match_scratch:SI 3 ""))
5474 (clobber (match_scratch:SI 4 ""))]
5475 "TARGET_POWER && reload_completed"
5476 [(parallel [(set (match_dup 3)
5477 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5478 (clobber (match_dup 4))])
5480 (compare:CC (match_dup 3)
5485 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
5486 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
5487 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
5489 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
5492 {sra.|sraw.} %3,%1,%2
5493 {srai.|srawi.} %3,%1,%h2
5496 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
5497 (set_attr "length" "4,4,8,8")])
5500 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
5501 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5502 (match_operand:SI 2 "reg_or_cint_operand" ""))
5504 (clobber (match_scratch:SI 3 ""))]
5505 "! TARGET_POWER && reload_completed"
5507 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5509 (compare:CC (match_dup 3)
5514 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
5515 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
5516 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
5518 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
5519 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5520 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
5524 {srai.|srawi.} %0,%1,%h2
5527 [(set_attr "type" "delayed_compare")
5528 (set_attr "length" "4,4,8,8")])
5531 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
5532 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5533 (match_operand:SI 2 "reg_or_cint_operand" ""))
5535 (set (match_operand:SI 0 "gpc_reg_operand" "")
5536 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5537 (clobber (match_scratch:SI 4 ""))]
5538 "TARGET_POWER && reload_completed"
5539 [(parallel [(set (match_dup 0)
5540 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5541 (clobber (match_dup 4))])
5543 (compare:CC (match_dup 0)
5548 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
5549 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
5550 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
5552 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
5553 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
5556 {sra.|sraw.} %0,%1,%2
5557 {srai.|srawi.} %0,%1,%h2
5560 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
5561 (set_attr "length" "4,4,8,8")])
5564 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
5565 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5566 (match_operand:SI 2 "reg_or_cint_operand" ""))
5568 (set (match_operand:SI 0 "gpc_reg_operand" "")
5569 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
5570 "! TARGET_POWER && reload_completed"
5572 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5574 (compare:CC (match_dup 0)
5578 ;; Floating-point insns, excluding normal data motion.
5580 ;; PowerPC has a full set of single-precision floating point instructions.
5582 ;; For the POWER architecture, we pretend that we have both SFmode and
5583 ;; DFmode insns, while, in fact, all fp insns are actually done in double.
5584 ;; The only conversions we will do will be when storing to memory. In that
5585 ;; case, we will use the "frsp" instruction before storing.
5587 ;; Note that when we store into a single-precision memory location, we need to
5588 ;; use the frsp insn first. If the register being stored isn't dead, we
5589 ;; need a scratch register for the frsp. But this is difficult when the store
5590 ;; is done by reload. It is not incorrect to do the frsp on the register in
5591 ;; this case, we just lose precision that we would have otherwise gotten but
5592 ;; is not guaranteed. Perhaps this should be tightened up at some point.
5594 (define_expand "extendsfdf2"
5595 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5596 (float_extend:DF (match_operand:SF 1 "reg_or_none500mem_operand" "")))]
5597 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5600 (define_insn_and_split "*extendsfdf2_fpr"
5601 [(set (match_operand:DF 0 "gpc_reg_operand" "=d,?d,d")
5602 (float_extend:DF (match_operand:SF 1 "reg_or_mem_operand" "0,f,m")))]
5603 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5608 "&& reload_completed && REG_P (operands[1]) && REGNO (operands[0]) == REGNO (operands[1])"
5611 emit_note (NOTE_INSN_DELETED);
5614 [(set_attr "type" "fp,fp,fpload")])
5616 (define_expand "truncdfsf2"
5617 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5618 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "")))]
5619 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5622 (define_insn "*truncdfsf2_fpr"
5623 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5624 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "d")))]
5625 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5627 [(set_attr "type" "fp")])
5629 (define_insn "aux_truncdfsf2"
5630 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5631 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRSP))]
5632 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5634 [(set_attr "type" "fp")])
5636 (define_expand "negsf2"
5637 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5638 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
5639 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
5642 (define_insn "*negsf2"
5643 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5644 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5645 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5647 [(set_attr "type" "fp")])
5649 (define_expand "abssf2"
5650 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5651 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
5652 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
5655 (define_insn "*abssf2"
5656 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5657 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5658 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5660 [(set_attr "type" "fp")])
5663 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5664 (neg:SF (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f"))))]
5665 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5667 [(set_attr "type" "fp")])
5669 (define_expand "addsf3"
5670 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5671 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "")
5672 (match_operand:SF 2 "gpc_reg_operand" "")))]
5673 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
5677 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5678 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5679 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5680 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5682 [(set_attr "type" "fp")
5683 (set_attr "fp_type" "fp_addsub_s")])
5686 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5687 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5688 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5689 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5690 "{fa|fadd} %0,%1,%2"
5691 [(set_attr "type" "fp")])
5693 (define_expand "subsf3"
5694 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5695 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "")
5696 (match_operand:SF 2 "gpc_reg_operand" "")))]
5697 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
5701 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5702 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5703 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5704 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5706 [(set_attr "type" "fp")
5707 (set_attr "fp_type" "fp_addsub_s")])
5710 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5711 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5712 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5713 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5714 "{fs|fsub} %0,%1,%2"
5715 [(set_attr "type" "fp")])
5717 (define_expand "mulsf3"
5718 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5719 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "")
5720 (match_operand:SF 2 "gpc_reg_operand" "")))]
5721 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
5725 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5726 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5727 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5728 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5730 [(set_attr "type" "fp")
5731 (set_attr "fp_type" "fp_mul_s")])
5734 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5735 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5736 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5737 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5738 "{fm|fmul} %0,%1,%2"
5739 [(set_attr "type" "dmul")])
5741 (define_expand "divsf3"
5742 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5743 (div:SF (match_operand:SF 1 "gpc_reg_operand" "")
5744 (match_operand:SF 2 "gpc_reg_operand" "")))]
5745 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
5749 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5750 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5751 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5752 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS
5753 && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
5755 [(set_attr "type" "sdiv")])
5758 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5759 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5760 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5761 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS
5762 && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
5763 "{fd|fdiv} %0,%1,%2"
5764 [(set_attr "type" "ddiv")])
5766 (define_expand "recipsf3"
5767 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5768 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")
5769 (match_operand:SF 2 "gpc_reg_operand" "f")]
5771 "TARGET_RECIP && TARGET_HARD_FLOAT && TARGET_PPC_GFXOPT && !optimize_size
5772 && flag_finite_math_only && !flag_trapping_math"
5774 rs6000_emit_swdivsf (operands[0], operands[1], operands[2]);
5779 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5780 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))]
5781 "TARGET_PPC_GFXOPT && flag_finite_math_only"
5783 [(set_attr "type" "fp")])
5785 (define_insn "*fmaddsf4_powerpc"
5786 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5787 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5788 (match_operand:SF 2 "gpc_reg_operand" "f"))
5789 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5790 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS
5791 && TARGET_SINGLE_FLOAT && TARGET_FUSED_MADD"
5792 "fmadds %0,%1,%2,%3"
5793 [(set_attr "type" "fp")
5794 (set_attr "fp_type" "fp_maddsub_s")])
5796 (define_insn "*fmaddsf4_power"
5797 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5798 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5799 (match_operand:SF 2 "gpc_reg_operand" "f"))
5800 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5801 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5802 "{fma|fmadd} %0,%1,%2,%3"
5803 [(set_attr "type" "dmul")])
5805 (define_insn "*fmsubsf4_powerpc"
5806 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5807 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5808 (match_operand:SF 2 "gpc_reg_operand" "f"))
5809 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5810 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS
5811 && TARGET_SINGLE_FLOAT && TARGET_FUSED_MADD"
5812 "fmsubs %0,%1,%2,%3"
5813 [(set_attr "type" "fp")
5814 (set_attr "fp_type" "fp_maddsub_s")])
5816 (define_insn "*fmsubsf4_power"
5817 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5818 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5819 (match_operand:SF 2 "gpc_reg_operand" "f"))
5820 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5821 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5822 "{fms|fmsub} %0,%1,%2,%3"
5823 [(set_attr "type" "dmul")])
5825 (define_insn "*fnmaddsf4_powerpc_1"
5826 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5827 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5828 (match_operand:SF 2 "gpc_reg_operand" "f"))
5829 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5830 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5831 && TARGET_SINGLE_FLOAT"
5832 "fnmadds %0,%1,%2,%3"
5833 [(set_attr "type" "fp")
5834 (set_attr "fp_type" "fp_maddsub_s")])
5836 (define_insn "*fnmaddsf4_powerpc_2"
5837 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5838 (minus:SF (mult:SF (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f"))
5839 (match_operand:SF 2 "gpc_reg_operand" "f"))
5840 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5841 "TARGET_POWERPC && TARGET_SINGLE_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5842 && ! HONOR_SIGNED_ZEROS (SFmode)"
5843 "fnmadds %0,%1,%2,%3"
5844 [(set_attr "type" "fp")
5845 (set_attr "fp_type" "fp_maddsub_s")])
5847 (define_insn "*fnmaddsf4_power_1"
5848 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5849 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5850 (match_operand:SF 2 "gpc_reg_operand" "f"))
5851 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5852 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5853 "{fnma|fnmadd} %0,%1,%2,%3"
5854 [(set_attr "type" "dmul")])
5856 (define_insn "*fnmaddsf4_power_2"
5857 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5858 (minus:SF (mult:SF (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f"))
5859 (match_operand:SF 2 "gpc_reg_operand" "f"))
5860 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5861 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5862 && ! HONOR_SIGNED_ZEROS (SFmode)"
5863 "{fnma|fnmadd} %0,%1,%2,%3"
5864 [(set_attr "type" "dmul")])
5866 (define_insn "*fnmsubsf4_powerpc_1"
5867 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5868 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5869 (match_operand:SF 2 "gpc_reg_operand" "f"))
5870 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5871 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5872 && TARGET_SINGLE_FLOAT"
5873 "fnmsubs %0,%1,%2,%3"
5874 [(set_attr "type" "fp")
5875 (set_attr "fp_type" "fp_maddsub_s")])
5877 (define_insn "*fnmsubsf4_powerpc_2"
5878 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5879 (minus:SF (match_operand:SF 3 "gpc_reg_operand" "f")
5880 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5881 (match_operand:SF 2 "gpc_reg_operand" "f"))))]
5882 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5883 && TARGET_SINGLE_FLOAT && ! HONOR_SIGNED_ZEROS (SFmode)"
5884 "fnmsubs %0,%1,%2,%3"
5885 [(set_attr "type" "fp")
5886 (set_attr "fp_type" "fp_maddsub_s")])
5888 (define_insn "*fnmsubsf4_power_1"
5889 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5890 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5891 (match_operand:SF 2 "gpc_reg_operand" "f"))
5892 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5893 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5894 "{fnms|fnmsub} %0,%1,%2,%3"
5895 [(set_attr "type" "dmul")])
5897 (define_insn "*fnmsubsf4_power_2"
5898 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5899 (minus:SF (match_operand:SF 3 "gpc_reg_operand" "f")
5900 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5901 (match_operand:SF 2 "gpc_reg_operand" "f"))))]
5902 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5903 && ! HONOR_SIGNED_ZEROS (SFmode)"
5904 "{fnms|fnmsub} %0,%1,%2,%3"
5905 [(set_attr "type" "dmul")])
5907 (define_expand "sqrtsf2"
5908 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5909 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
5910 "(TARGET_PPC_GPOPT || TARGET_POWER2 || TARGET_XILINX_FPU)
5911 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
5912 && !TARGET_SIMPLE_FPU"
5916 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5917 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5918 "(TARGET_PPC_GPOPT || TARGET_XILINX_FPU) && TARGET_HARD_FLOAT
5919 && TARGET_FPRS && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
5921 [(set_attr "type" "ssqrt")])
5924 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5925 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5926 "TARGET_POWER2 && TARGET_HARD_FLOAT && TARGET_FPRS
5927 && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
5929 [(set_attr "type" "dsqrt")])
5931 (define_expand "rsqrtsf2"
5932 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5933 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")]
5935 "TARGET_RECIP && TARGET_HARD_FLOAT && TARGET_PPC_GFXOPT && !optimize_size
5936 && flag_finite_math_only && !flag_trapping_math"
5938 rs6000_emit_swrsqrtsf (operands[0], operands[1]);
5942 (define_insn "*rsqrt_internal1"
5943 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5944 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")]
5946 "TARGET_HARD_FLOAT && TARGET_PPC_GFXOPT"
5948 [(set_attr "type" "fp")])
5950 (define_expand "copysignsf3"
5952 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "")))
5954 (neg:SF (abs:SF (match_dup 1))))
5955 (set (match_operand:SF 0 "gpc_reg_operand" "")
5956 (if_then_else:SF (ge (match_operand:SF 2 "gpc_reg_operand" "")
5960 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
5961 && !HONOR_NANS (SFmode) && !HONOR_SIGNED_ZEROS (SFmode)"
5963 operands[3] = gen_reg_rtx (SFmode);
5964 operands[4] = gen_reg_rtx (SFmode);
5965 operands[5] = CONST0_RTX (SFmode);
5968 (define_expand "copysigndf3"
5970 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "")))
5972 (neg:DF (abs:DF (match_dup 1))))
5973 (set (match_operand:DF 0 "gpc_reg_operand" "")
5974 (if_then_else:DF (ge (match_operand:DF 2 "gpc_reg_operand" "")
5978 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5979 && ((TARGET_PPC_GFXOPT
5980 && !HONOR_NANS (DFmode)
5981 && !HONOR_SIGNED_ZEROS (DFmode))
5982 || VECTOR_UNIT_VSX_P (DFmode))"
5984 if (VECTOR_UNIT_VSX_P (DFmode))
5986 emit_insn (gen_vsx_copysigndf3 (operands[0], operands[1],
5987 operands[2], CONST0_RTX (DFmode)));
5990 operands[3] = gen_reg_rtx (DFmode);
5991 operands[4] = gen_reg_rtx (DFmode);
5992 operands[5] = CONST0_RTX (DFmode);
5995 ;; For MIN, MAX, and conditional move, we use DEFINE_EXPAND's that involve a
5996 ;; fsel instruction and some auxiliary computations. Then we just have a
5997 ;; single DEFINE_INSN for fsel and the define_splits to make them if made by
5999 (define_expand "smaxsf3"
6000 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6001 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
6002 (match_operand:SF 2 "gpc_reg_operand" ""))
6005 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
6006 && TARGET_SINGLE_FLOAT && !flag_trapping_math"
6007 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
6009 (define_expand "sminsf3"
6010 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6011 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
6012 (match_operand:SF 2 "gpc_reg_operand" ""))
6015 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
6016 && TARGET_SINGLE_FLOAT && !flag_trapping_math"
6017 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
6020 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6021 (match_operator:SF 3 "min_max_operator"
6022 [(match_operand:SF 1 "gpc_reg_operand" "")
6023 (match_operand:SF 2 "gpc_reg_operand" "")]))]
6024 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
6025 && TARGET_SINGLE_FLOAT && !flag_trapping_math"
6028 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
6029 operands[1], operands[2]);
6033 (define_expand "mov<mode>cc"
6034 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
6035 (if_then_else:GPR (match_operand 1 "comparison_operator" "")
6036 (match_operand:GPR 2 "gpc_reg_operand" "")
6037 (match_operand:GPR 3 "gpc_reg_operand" "")))]
6041 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
6047 ;; We use the BASE_REGS for the isel input operands because, if rA is
6048 ;; 0, the value of 0 is placed in rD upon truth. Similarly for rB
6049 ;; because we may switch the operands and rB may end up being rA.
6051 ;; We need 2 patterns: an unsigned and a signed pattern. We could
6052 ;; leave out the mode in operand 4 and use one pattern, but reload can
6053 ;; change the mode underneath our feet and then gets confused trying
6054 ;; to reload the value.
6055 (define_insn "isel_signed_<mode>"
6056 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
6058 (match_operator 1 "comparison_operator"
6059 [(match_operand:CC 4 "cc_reg_operand" "y")
6061 (match_operand:GPR 2 "gpc_reg_operand" "b")
6062 (match_operand:GPR 3 "gpc_reg_operand" "b")))]
6065 { return output_isel (operands); }"
6066 [(set_attr "type" "isel")
6067 (set_attr "length" "4")])
6069 (define_insn "isel_unsigned_<mode>"
6070 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
6072 (match_operator 1 "comparison_operator"
6073 [(match_operand:CCUNS 4 "cc_reg_operand" "y")
6075 (match_operand:GPR 2 "gpc_reg_operand" "b")
6076 (match_operand:GPR 3 "gpc_reg_operand" "b")))]
6079 { return output_isel (operands); }"
6080 [(set_attr "type" "isel")
6081 (set_attr "length" "4")])
6083 (define_expand "movsfcc"
6084 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6085 (if_then_else:SF (match_operand 1 "comparison_operator" "")
6086 (match_operand:SF 2 "gpc_reg_operand" "")
6087 (match_operand:SF 3 "gpc_reg_operand" "")))]
6088 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
6091 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
6097 (define_insn "*fselsfsf4"
6098 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6099 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
6100 (match_operand:SF 4 "zero_fp_constant" "F"))
6101 (match_operand:SF 2 "gpc_reg_operand" "f")
6102 (match_operand:SF 3 "gpc_reg_operand" "f")))]
6103 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
6105 [(set_attr "type" "fp")])
6107 (define_insn "*fseldfsf4"
6108 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6109 (if_then_else:SF (ge (match_operand:DF 1 "gpc_reg_operand" "d")
6110 (match_operand:DF 4 "zero_fp_constant" "F"))
6111 (match_operand:SF 2 "gpc_reg_operand" "f")
6112 (match_operand:SF 3 "gpc_reg_operand" "f")))]
6113 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_SINGLE_FLOAT"
6115 [(set_attr "type" "fp")])
6117 (define_expand "negdf2"
6118 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6119 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
6120 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6123 (define_insn "*negdf2_fpr"
6124 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6125 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "d")))]
6126 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6127 && !VECTOR_UNIT_VSX_P (DFmode)"
6129 [(set_attr "type" "fp")])
6131 (define_expand "absdf2"
6132 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6133 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
6134 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6137 (define_insn "*absdf2_fpr"
6138 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6139 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "d")))]
6140 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6141 && !VECTOR_UNIT_VSX_P (DFmode)"
6143 [(set_attr "type" "fp")])
6145 (define_insn "*nabsdf2_fpr"
6146 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6147 (neg:DF (abs:DF (match_operand:DF 1 "gpc_reg_operand" "d"))))]
6148 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6149 && !VECTOR_UNIT_VSX_P (DFmode)"
6151 [(set_attr "type" "fp")])
6153 (define_expand "adddf3"
6154 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6155 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "")
6156 (match_operand:DF 2 "gpc_reg_operand" "")))]
6157 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6160 (define_insn "*adddf3_fpr"
6161 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6162 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
6163 (match_operand:DF 2 "gpc_reg_operand" "d")))]
6164 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6165 && !VECTOR_UNIT_VSX_P (DFmode)"
6166 "{fa|fadd} %0,%1,%2"
6167 [(set_attr "type" "fp")
6168 (set_attr "fp_type" "fp_addsub_d")])
6170 (define_expand "subdf3"
6171 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6172 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "")
6173 (match_operand:DF 2 "gpc_reg_operand" "")))]
6174 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6177 (define_insn "*subdf3_fpr"
6178 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6179 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "d")
6180 (match_operand:DF 2 "gpc_reg_operand" "d")))]
6181 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6182 && !VECTOR_UNIT_VSX_P (DFmode)"
6183 "{fs|fsub} %0,%1,%2"
6184 [(set_attr "type" "fp")
6185 (set_attr "fp_type" "fp_addsub_d")])
6187 (define_expand "muldf3"
6188 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6189 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "")
6190 (match_operand:DF 2 "gpc_reg_operand" "")))]
6191 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6194 (define_insn "*muldf3_fpr"
6195 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6196 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
6197 (match_operand:DF 2 "gpc_reg_operand" "d")))]
6198 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6199 && !VECTOR_UNIT_VSX_P (DFmode)"
6200 "{fm|fmul} %0,%1,%2"
6201 [(set_attr "type" "dmul")
6202 (set_attr "fp_type" "fp_mul_d")])
6204 (define_expand "divdf3"
6205 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6206 (div:DF (match_operand:DF 1 "gpc_reg_operand" "")
6207 (match_operand:DF 2 "gpc_reg_operand" "")))]
6209 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)
6210 && !TARGET_SIMPLE_FPU"
6213 (define_insn "*divdf3_fpr"
6214 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6215 (div:DF (match_operand:DF 1 "gpc_reg_operand" "d")
6216 (match_operand:DF 2 "gpc_reg_operand" "d")))]
6217 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && !TARGET_SIMPLE_FPU
6218 && !VECTOR_UNIT_VSX_P (DFmode)"
6219 "{fd|fdiv} %0,%1,%2"
6220 [(set_attr "type" "ddiv")])
6222 (define_expand "recipdf3"
6223 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6224 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "d")
6225 (match_operand:DF 2 "gpc_reg_operand" "d")]
6227 "TARGET_RECIP && TARGET_HARD_FLOAT && TARGET_POPCNTB && !optimize_size
6228 && flag_finite_math_only && !flag_trapping_math"
6230 rs6000_emit_swdivdf (operands[0], operands[1], operands[2]);
6234 (define_expand "fred"
6235 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6236 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "d")] UNSPEC_FRES))]
6237 "(TARGET_POPCNTB || VECTOR_UNIT_VSX_P (DFmode)) && flag_finite_math_only"
6240 (define_insn "*fred_fpr"
6241 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6242 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))]
6243 "TARGET_POPCNTB && flag_finite_math_only && !VECTOR_UNIT_VSX_P (DFmode)"
6245 [(set_attr "type" "fp")])
6247 (define_insn "*fmadddf4_fpr"
6248 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6249 (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
6250 (match_operand:DF 2 "gpc_reg_operand" "d"))
6251 (match_operand:DF 3 "gpc_reg_operand" "d")))]
6252 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD && TARGET_DOUBLE_FLOAT
6253 && VECTOR_UNIT_NONE_P (DFmode)"
6254 "{fma|fmadd} %0,%1,%2,%3"
6255 [(set_attr "type" "dmul")
6256 (set_attr "fp_type" "fp_maddsub_d")])
6258 (define_insn "*fmsubdf4_fpr"
6259 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6260 (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
6261 (match_operand:DF 2 "gpc_reg_operand" "d"))
6262 (match_operand:DF 3 "gpc_reg_operand" "d")))]
6263 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD && TARGET_DOUBLE_FLOAT
6264 && VECTOR_UNIT_NONE_P (DFmode)"
6265 "{fms|fmsub} %0,%1,%2,%3"
6266 [(set_attr "type" "dmul")
6267 (set_attr "fp_type" "fp_maddsub_d")])
6269 (define_insn "*fnmadddf4_fpr_1"
6270 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6271 (neg:DF (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
6272 (match_operand:DF 2 "gpc_reg_operand" "d"))
6273 (match_operand:DF 3 "gpc_reg_operand" "d"))))]
6274 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD && TARGET_DOUBLE_FLOAT
6275 && VECTOR_UNIT_NONE_P (DFmode)"
6276 "{fnma|fnmadd} %0,%1,%2,%3"
6277 [(set_attr "type" "dmul")
6278 (set_attr "fp_type" "fp_maddsub_d")])
6280 (define_insn "*fnmadddf4_fpr_2"
6281 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6282 (minus:DF (mult:DF (neg:DF (match_operand:DF 1 "gpc_reg_operand" "d"))
6283 (match_operand:DF 2 "gpc_reg_operand" "d"))
6284 (match_operand:DF 3 "gpc_reg_operand" "d")))]
6285 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD && TARGET_DOUBLE_FLOAT
6286 && ! HONOR_SIGNED_ZEROS (DFmode) && VECTOR_UNIT_NONE_P (DFmode)"
6287 "{fnma|fnmadd} %0,%1,%2,%3"
6288 [(set_attr "type" "dmul")
6289 (set_attr "fp_type" "fp_maddsub_d")])
6291 (define_insn "*fnmsubdf4_fpr_1"
6292 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6293 (neg:DF (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
6294 (match_operand:DF 2 "gpc_reg_operand" "d"))
6295 (match_operand:DF 3 "gpc_reg_operand" "d"))))]
6296 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD && TARGET_DOUBLE_FLOAT
6297 && VECTOR_UNIT_NONE_P (DFmode)"
6298 "{fnms|fnmsub} %0,%1,%2,%3"
6299 [(set_attr "type" "dmul")
6300 (set_attr "fp_type" "fp_maddsub_d")])
6302 (define_insn "*fnmsubdf4_fpr_2"
6303 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6304 (minus:DF (match_operand:DF 3 "gpc_reg_operand" "d")
6305 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
6306 (match_operand:DF 2 "gpc_reg_operand" "d"))))]
6307 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD && TARGET_DOUBLE_FLOAT
6308 && ! HONOR_SIGNED_ZEROS (DFmode) && VECTOR_UNIT_NONE_P (DFmode)"
6309 "{fnms|fnmsub} %0,%1,%2,%3"
6310 [(set_attr "type" "dmul")
6311 (set_attr "fp_type" "fp_maddsub_d")])
6313 (define_expand "sqrtdf2"
6314 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6315 (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
6316 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS
6317 && TARGET_DOUBLE_FLOAT"
6320 (define_insn "*sqrtdf2_fpr"
6321 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6322 (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "d")))]
6323 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS
6324 && TARGET_DOUBLE_FLOAT
6325 && !VECTOR_UNIT_VSX_P (DFmode)"
6327 [(set_attr "type" "dsqrt")])
6329 ;; The conditional move instructions allow us to perform max and min
6330 ;; operations even when
6332 (define_expand "smaxdf3"
6333 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6334 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
6335 (match_operand:DF 2 "gpc_reg_operand" ""))
6338 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6339 && !flag_trapping_math"
6340 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
6342 (define_expand "smindf3"
6343 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6344 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
6345 (match_operand:DF 2 "gpc_reg_operand" ""))
6348 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6349 && !flag_trapping_math"
6350 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
6353 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6354 (match_operator:DF 3 "min_max_operator"
6355 [(match_operand:DF 1 "gpc_reg_operand" "")
6356 (match_operand:DF 2 "gpc_reg_operand" "")]))]
6357 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6358 && !flag_trapping_math"
6361 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
6362 operands[1], operands[2]);
6366 (define_expand "movdfcc"
6367 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6368 (if_then_else:DF (match_operand 1 "comparison_operator" "")
6369 (match_operand:DF 2 "gpc_reg_operand" "")
6370 (match_operand:DF 3 "gpc_reg_operand" "")))]
6371 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6374 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
6380 (define_insn "*fseldfdf4"
6381 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6382 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "d")
6383 (match_operand:DF 4 "zero_fp_constant" "F"))
6384 (match_operand:DF 2 "gpc_reg_operand" "d")
6385 (match_operand:DF 3 "gpc_reg_operand" "d")))]
6386 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6388 [(set_attr "type" "fp")])
6390 (define_insn "*fselsfdf4"
6391 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6392 (if_then_else:DF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
6393 (match_operand:SF 4 "zero_fp_constant" "F"))
6394 (match_operand:DF 2 "gpc_reg_operand" "d")
6395 (match_operand:DF 3 "gpc_reg_operand" "d")))]
6396 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_SINGLE_FLOAT"
6398 [(set_attr "type" "fp")])
6400 ;; Conversions to and from floating-point.
6402 (define_expand "fixuns_truncsfsi2"
6403 [(set (match_operand:SI 0 "gpc_reg_operand" "")
6404 (unsigned_fix:SI (match_operand:SF 1 "gpc_reg_operand" "")))]
6405 "TARGET_HARD_FLOAT && !TARGET_FPRS && TARGET_SINGLE_FLOAT"
6408 (define_expand "fix_truncsfsi2"
6409 [(set (match_operand:SI 0 "gpc_reg_operand" "")
6410 (fix:SI (match_operand:SF 1 "gpc_reg_operand" "")))]
6411 "TARGET_HARD_FLOAT && !TARGET_FPRS && TARGET_SINGLE_FLOAT"
6414 (define_expand "fixuns_truncdfsi2"
6415 [(set (match_operand:SI 0 "gpc_reg_operand" "")
6416 (unsigned_fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))]
6417 "TARGET_HARD_FLOAT && TARGET_E500_DOUBLE"
6420 (define_expand "fixuns_truncdfdi2"
6421 [(set (match_operand:DI 0 "register_operand" "")
6422 (unsigned_fix:DI (match_operand:DF 1 "register_operand" "")))]
6423 "TARGET_HARD_FLOAT && TARGET_VSX"
6426 ; For each of these conversions, there is a define_expand, a define_insn
6427 ; with a '#' template, and a define_split (with C code). The idea is
6428 ; to allow constant folding with the template of the define_insn,
6429 ; then to have the insns split later (between sched1 and final).
6431 (define_expand "floatsidf2"
6432 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
6433 (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
6436 (clobber (match_dup 4))
6437 (clobber (match_dup 5))
6438 (clobber (match_dup 6))])]
6440 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6443 if (TARGET_E500_DOUBLE)
6445 emit_insn (gen_spe_floatsidf2 (operands[0], operands[1]));
6448 if (TARGET_POWERPC64)
6450 rtx x = convert_to_mode (DImode, operands[1], 0);
6451 emit_insn (gen_floatdidf2 (operands[0], x));
6455 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
6456 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503601774854144\", DFmode));
6457 operands[4] = assign_stack_temp (DFmode, GET_MODE_SIZE (DFmode), 0);
6458 operands[5] = gen_reg_rtx (DFmode);
6459 operands[6] = gen_reg_rtx (SImode);
6462 (define_insn_and_split "*floatsidf2_internal"
6463 [(set (match_operand:DF 0 "gpc_reg_operand" "=&d")
6464 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
6465 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
6466 (use (match_operand:DF 3 "gpc_reg_operand" "d"))
6467 (clobber (match_operand:DF 4 "offsettable_mem_operand" "=o"))
6468 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&d"))
6469 (clobber (match_operand:SI 6 "gpc_reg_operand" "=&r"))]
6470 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6476 rtx lowword, highword;
6477 gcc_assert (MEM_P (operands[4]));
6478 highword = adjust_address (operands[4], SImode, 0);
6479 lowword = adjust_address (operands[4], SImode, 4);
6480 if (! WORDS_BIG_ENDIAN)
6483 tmp = highword; highword = lowword; lowword = tmp;
6486 emit_insn (gen_xorsi3 (operands[6], operands[1],
6487 GEN_INT (~ (HOST_WIDE_INT) 0x7fffffff)));
6488 emit_move_insn (lowword, operands[6]);
6489 emit_move_insn (highword, operands[2]);
6490 emit_move_insn (operands[5], operands[4]);
6491 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
6494 [(set_attr "length" "24")])
6496 (define_expand "floatunssisf2"
6497 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6498 (unsigned_float:SF (match_operand:SI 1 "gpc_reg_operand" "")))]
6499 "TARGET_HARD_FLOAT && !TARGET_FPRS && TARGET_SINGLE_FLOAT"
6502 (define_expand "floatunssidf2"
6503 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
6504 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
6507 (clobber (match_dup 4))
6508 (clobber (match_dup 5))])]
6509 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6512 if (TARGET_E500_DOUBLE)
6514 emit_insn (gen_spe_floatunssidf2 (operands[0], operands[1]));
6517 if (TARGET_POWERPC64)
6519 rtx x = convert_to_mode (DImode, operands[1], 1);
6520 emit_insn (gen_floatdidf2 (operands[0], x));
6524 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
6525 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503599627370496\", DFmode));
6526 operands[4] = assign_stack_temp (DFmode, GET_MODE_SIZE (DFmode), 0);
6527 operands[5] = gen_reg_rtx (DFmode);
6530 (define_insn_and_split "*floatunssidf2_internal"
6531 [(set (match_operand:DF 0 "gpc_reg_operand" "=&d")
6532 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
6533 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
6534 (use (match_operand:DF 3 "gpc_reg_operand" "d"))
6535 (clobber (match_operand:DF 4 "offsettable_mem_operand" "=o"))
6536 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&d"))]
6537 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6543 rtx lowword, highword;
6544 gcc_assert (MEM_P (operands[4]));
6545 highword = adjust_address (operands[4], SImode, 0);
6546 lowword = adjust_address (operands[4], SImode, 4);
6547 if (! WORDS_BIG_ENDIAN)
6550 tmp = highword; highword = lowword; lowword = tmp;
6553 emit_move_insn (lowword, operands[1]);
6554 emit_move_insn (highword, operands[2]);
6555 emit_move_insn (operands[5], operands[4]);
6556 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
6559 [(set_attr "length" "20")])
6561 (define_expand "fix_truncdfsi2"
6562 [(parallel [(set (match_operand:SI 0 "fix_trunc_dest_operand" "")
6563 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))
6564 (clobber (match_dup 2))
6565 (clobber (match_dup 3))])]
6566 "(TARGET_POWER2 || TARGET_POWERPC)
6567 && TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6570 if (TARGET_E500_DOUBLE)
6572 emit_insn (gen_spe_fix_truncdfsi2 (operands[0], operands[1]));
6575 operands[2] = gen_reg_rtx (DImode);
6576 if (TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
6577 && gpc_reg_operand(operands[0], GET_MODE (operands[0])))
6579 operands[3] = gen_reg_rtx (DImode);
6580 emit_insn (gen_fix_truncdfsi2_mfpgpr (operands[0], operands[1],
6581 operands[2], operands[3]));
6584 if (TARGET_PPC_GFXOPT)
6586 rtx orig_dest = operands[0];
6587 if (! memory_operand (orig_dest, GET_MODE (orig_dest)))
6588 operands[0] = assign_stack_temp (SImode, GET_MODE_SIZE (SImode), 0);
6589 emit_insn (gen_fix_truncdfsi2_internal_gfxopt (operands[0], operands[1],
6591 if (operands[0] != orig_dest)
6592 emit_move_insn (orig_dest, operands[0]);
6595 operands[3] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
6598 (define_insn_and_split "*fix_truncdfsi2_internal"
6599 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6600 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "d")))
6601 (clobber (match_operand:DI 2 "gpc_reg_operand" "=d"))
6602 (clobber (match_operand:DI 3 "offsettable_mem_operand" "=o"))]
6603 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS
6604 && TARGET_DOUBLE_FLOAT"
6611 gcc_assert (MEM_P (operands[3]));
6612 lowword = adjust_address (operands[3], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
6614 emit_insn (gen_fctiwz (operands[2], operands[1]));
6615 emit_move_insn (operands[3], operands[2]);
6616 emit_move_insn (operands[0], lowword);
6619 [(set_attr "length" "16")])
6621 (define_insn_and_split "fix_truncdfsi2_internal_gfxopt"
6622 [(set (match_operand:SI 0 "memory_operand" "=Z")
6623 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "d")))
6624 (clobber (match_operand:DI 2 "gpc_reg_operand" "=d"))]
6625 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS
6626 && TARGET_DOUBLE_FLOAT
6627 && TARGET_PPC_GFXOPT"
6633 emit_insn (gen_fctiwz (operands[2], operands[1]));
6634 emit_insn (gen_stfiwx (operands[0], operands[2]));
6637 [(set_attr "length" "16")])
6639 (define_insn_and_split "fix_truncdfsi2_mfpgpr"
6640 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6641 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "d")))
6642 (clobber (match_operand:DI 2 "gpc_reg_operand" "=d"))
6643 (clobber (match_operand:DI 3 "gpc_reg_operand" "=r"))]
6644 "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
6645 && TARGET_DOUBLE_FLOAT"
6648 [(set (match_dup 2) (unspec:DI [(fix:SI (match_dup 1))] UNSPEC_FCTIWZ))
6649 (set (match_dup 3) (match_dup 2))
6650 (set (match_dup 0) (subreg:SI (match_dup 3) 4))]
6652 [(set_attr "length" "12")])
6654 ; Here, we use (set (reg) (unspec:DI [(fix:SI ...)] UNSPEC_FCTIWZ))
6655 ; rather than (set (subreg:SI (reg)) (fix:SI ...))
6656 ; because the first makes it clear that operand 0 is not live
6657 ; before the instruction.
6658 (define_insn "fctiwz"
6659 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6660 (unspec:DI [(fix:SI (match_operand:DF 1 "gpc_reg_operand" "d"))]
6662 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS
6663 && TARGET_DOUBLE_FLOAT"
6664 "{fcirz|fctiwz} %0,%1"
6665 [(set_attr "type" "fp")])
6667 (define_expand "btruncdf2"
6668 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6669 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "d")] UNSPEC_FRIZ))]
6670 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6673 (define_insn "*btruncdf2_fpr"
6674 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6675 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRIZ))]
6676 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6677 && !VECTOR_UNIT_VSX_P (DFmode)"
6679 [(set_attr "type" "fp")])
6681 (define_insn "btruncsf2"
6682 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6683 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIZ))]
6684 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
6686 [(set_attr "type" "fp")])
6688 (define_expand "ceildf2"
6689 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6690 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "")] UNSPEC_FRIP))]
6691 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6694 (define_insn "*ceildf2_fpr"
6695 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6696 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "d")] UNSPEC_FRIP))]
6697 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6698 && !VECTOR_UNIT_VSX_P (DFmode)"
6700 [(set_attr "type" "fp")])
6702 (define_insn "ceilsf2"
6703 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6704 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIP))]
6705 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT "
6707 [(set_attr "type" "fp")])
6709 (define_expand "floordf2"
6710 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6711 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "")] UNSPEC_FRIM))]
6712 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6715 (define_insn "*floordf2_fpr"
6716 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6717 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "d")] UNSPEC_FRIM))]
6718 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6719 && !VECTOR_UNIT_VSX_P (DFmode)"
6721 [(set_attr "type" "fp")])
6723 (define_insn "floorsf2"
6724 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6725 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIM))]
6726 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT "
6728 [(set_attr "type" "fp")])
6730 ;; No VSX equivalent to frin
6731 (define_insn "rounddf2"
6732 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6733 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "d")] UNSPEC_FRIN))]
6734 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6736 [(set_attr "type" "fp")])
6738 (define_insn "roundsf2"
6739 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6740 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIN))]
6741 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT "
6743 [(set_attr "type" "fp")])
6745 (define_expand "ftruncdf2"
6746 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6747 (fix:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
6748 "VECTOR_UNIT_VSX_P (DFmode)"
6751 ; An UNSPEC is used so we don't have to support SImode in FP registers.
6752 (define_insn "stfiwx"
6753 [(set (match_operand:SI 0 "memory_operand" "=Z")
6754 (unspec:SI [(match_operand:DI 1 "gpc_reg_operand" "d")]
6758 [(set_attr "type" "fpstore")])
6760 (define_expand "floatsisf2"
6761 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6762 (float:SF (match_operand:SI 1 "gpc_reg_operand" "")))]
6763 "TARGET_HARD_FLOAT && !TARGET_FPRS"
6766 (define_expand "floatdidf2"
6767 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6768 (float:DF (match_operand:DI 1 "gpc_reg_operand" "")))]
6769 "(TARGET_POWERPC64 || TARGET_XILINX_FPU || VECTOR_UNIT_VSX_P (DFmode))
6770 && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS"
6773 (define_insn "*floatdidf2_fpr"
6774 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6775 (float:DF (match_operand:DI 1 "gpc_reg_operand" "!d#r")))]
6776 "(TARGET_POWERPC64 || TARGET_XILINX_FPU)
6777 && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
6778 && !VECTOR_UNIT_VSX_P (DFmode)"
6780 [(set_attr "type" "fp")])
6782 (define_expand "floatunsdidf2"
6783 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6784 (unsigned_float:DF (match_operand:DI 1 "gpc_reg_operand" "")))]
6788 (define_expand "fix_truncdfdi2"
6789 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6790 (fix:DI (match_operand:DF 1 "gpc_reg_operand" "")))]
6791 "(TARGET_POWERPC64 || TARGET_XILINX_FPU || VECTOR_UNIT_VSX_P (DFmode))
6792 && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS"
6795 (define_insn "*fix_truncdfdi2_fpr"
6796 [(set (match_operand:DI 0 "gpc_reg_operand" "=!d#r")
6797 (fix:DI (match_operand:DF 1 "gpc_reg_operand" "d")))]
6798 "(TARGET_POWERPC64 || TARGET_XILINX_FPU)
6799 && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
6800 && !VECTOR_UNIT_VSX_P (DFmode)"
6802 [(set_attr "type" "fp")])
6804 (define_expand "floatdisf2"
6805 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6806 (float:SF (match_operand:DI 1 "gpc_reg_operand" "")))]
6807 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT "
6810 rtx val = operands[1];
6811 if (!flag_unsafe_math_optimizations)
6813 rtx label = gen_label_rtx ();
6814 val = gen_reg_rtx (DImode);
6815 emit_insn (gen_floatdisf2_internal2 (val, operands[1], label));
6818 emit_insn (gen_floatdisf2_internal1 (operands[0], val));
6822 ;; This is not IEEE compliant if rounding mode is "round to nearest".
6823 ;; If the DI->DF conversion is inexact, then it's possible to suffer
6824 ;; from double rounding.
6825 (define_insn_and_split "floatdisf2_internal1"
6826 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6827 (float:SF (match_operand:DI 1 "gpc_reg_operand" "!d#r")))
6828 (clobber (match_scratch:DF 2 "=d"))]
6829 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
6831 "&& reload_completed"
6833 (float:DF (match_dup 1)))
6835 (float_truncate:SF (match_dup 2)))]
6838 ;; Twiddles bits to avoid double rounding.
6839 ;; Bits that might be truncated when converting to DFmode are replaced
6840 ;; by a bit that won't be lost at that stage, but is below the SFmode
6841 ;; rounding position.
6842 (define_expand "floatdisf2_internal2"
6843 [(set (match_dup 3) (ashiftrt:DI (match_operand:DI 1 "" "")
6845 (parallel [(set (match_operand:DI 0 "" "") (and:DI (match_dup 1)
6847 (clobber (scratch:CC))])
6848 (set (match_dup 3) (plus:DI (match_dup 3)
6850 (set (match_dup 0) (plus:DI (match_dup 0)
6852 (set (match_dup 4) (compare:CCUNS (match_dup 3)
6854 (set (match_dup 0) (ior:DI (match_dup 0)
6856 (parallel [(set (match_dup 0) (and:DI (match_dup 0)
6858 (clobber (scratch:CC))])
6859 (set (pc) (if_then_else (geu (match_dup 4) (const_int 0))
6860 (label_ref (match_operand:DI 2 "" ""))
6862 (set (match_dup 0) (match_dup 1))]
6863 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
6866 operands[3] = gen_reg_rtx (DImode);
6867 operands[4] = gen_reg_rtx (CCUNSmode);
6870 ;; Define the DImode operations that can be done in a small number
6871 ;; of instructions. The & constraints are to prevent the register
6872 ;; allocator from allocating registers that overlap with the inputs
6873 ;; (for example, having an input in 7,8 and an output in 6,7). We
6874 ;; also allow for the output being the same as one of the inputs.
6876 (define_insn "*adddi3_noppc64"
6877 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r")
6878 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,0,0")
6879 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I")))]
6880 "! TARGET_POWERPC64"
6883 if (WORDS_BIG_ENDIAN)
6884 return (GET_CODE (operands[2])) != CONST_INT
6885 ? \"{a|addc} %L0,%L1,%L2\;{ae|adde} %0,%1,%2\"
6886 : \"{ai|addic} %L0,%L1,%2\;{a%G2e|add%G2e} %0,%1\";
6888 return (GET_CODE (operands[2])) != CONST_INT
6889 ? \"{a|addc} %0,%1,%2\;{ae|adde} %L0,%L1,%L2\"
6890 : \"{ai|addic} %0,%1,%2\;{a%G2e|add%G2e} %L0,%L1\";
6892 [(set_attr "type" "two")
6893 (set_attr "length" "8")])
6895 (define_insn "*subdi3_noppc64"
6896 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r,r")
6897 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I,0,r,I")
6898 (match_operand:DI 2 "gpc_reg_operand" "r,r,r,0,0")))]
6899 "! TARGET_POWERPC64"
6902 if (WORDS_BIG_ENDIAN)
6903 return (GET_CODE (operands[1]) != CONST_INT)
6904 ? \"{sf|subfc} %L0,%L2,%L1\;{sfe|subfe} %0,%2,%1\"
6905 : \"{sfi|subfic} %L0,%L2,%1\;{sf%G1e|subf%G1e} %0,%2\";
6907 return (GET_CODE (operands[1]) != CONST_INT)
6908 ? \"{sf|subfc} %0,%2,%1\;{sfe|subfe} %L0,%L2,%L1\"
6909 : \"{sfi|subfic} %0,%2,%1\;{sf%G1e|subf%G1e} %L0,%L2\";
6911 [(set_attr "type" "two")
6912 (set_attr "length" "8")])
6914 (define_insn "*negdi2_noppc64"
6915 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6916 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))]
6917 "! TARGET_POWERPC64"
6920 return (WORDS_BIG_ENDIAN)
6921 ? \"{sfi|subfic} %L0,%L1,0\;{sfze|subfze} %0,%1\"
6922 : \"{sfi|subfic} %0,%1,0\;{sfze|subfze} %L0,%L1\";
6924 [(set_attr "type" "two")
6925 (set_attr "length" "8")])
6927 (define_expand "mulsidi3"
6928 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6929 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6930 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6931 "! TARGET_POWERPC64"
6934 if (! TARGET_POWER && ! TARGET_POWERPC)
6936 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
6937 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
6938 emit_insn (gen_mull_call ());
6939 if (WORDS_BIG_ENDIAN)
6940 emit_move_insn (operands[0], gen_rtx_REG (DImode, 3));
6943 emit_move_insn (operand_subword (operands[0], 0, 0, DImode),
6944 gen_rtx_REG (SImode, 3));
6945 emit_move_insn (operand_subword (operands[0], 1, 0, DImode),
6946 gen_rtx_REG (SImode, 4));
6950 else if (TARGET_POWER)
6952 emit_insn (gen_mulsidi3_mq (operands[0], operands[1], operands[2]));
6957 (define_insn "mulsidi3_mq"
6958 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6959 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6960 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
6961 (clobber (match_scratch:SI 3 "=q"))]
6963 "mul %0,%1,%2\;mfmq %L0"
6964 [(set_attr "type" "imul")
6965 (set_attr "length" "8")])
6967 (define_insn "*mulsidi3_no_mq"
6968 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6969 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6970 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
6971 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
6974 return (WORDS_BIG_ENDIAN)
6975 ? \"mulhw %0,%1,%2\;mullw %L0,%1,%2\"
6976 : \"mulhw %L0,%1,%2\;mullw %0,%1,%2\";
6978 [(set_attr "type" "imul")
6979 (set_attr "length" "8")])
6982 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6983 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6984 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6985 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
6988 (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
6989 (sign_extend:DI (match_dup 2)))
6992 (mult:SI (match_dup 1)
6996 int endian = (WORDS_BIG_ENDIAN == 0);
6997 operands[3] = operand_subword (operands[0], endian, 0, DImode);
6998 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
7001 (define_expand "umulsidi3"
7002 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7003 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
7004 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
7005 "TARGET_POWERPC && ! TARGET_POWERPC64"
7010 emit_insn (gen_umulsidi3_mq (operands[0], operands[1], operands[2]));
7015 (define_insn "umulsidi3_mq"
7016 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
7017 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
7018 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
7019 (clobber (match_scratch:SI 3 "=q"))]
7020 "TARGET_POWERPC && TARGET_POWER"
7023 return (WORDS_BIG_ENDIAN)
7024 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
7025 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
7027 [(set_attr "type" "imul")
7028 (set_attr "length" "8")])
7030 (define_insn "*umulsidi3_no_mq"
7031 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
7032 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
7033 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
7034 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
7037 return (WORDS_BIG_ENDIAN)
7038 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
7039 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
7041 [(set_attr "type" "imul")
7042 (set_attr "length" "8")])
7045 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7046 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
7047 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
7048 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
7051 (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
7052 (zero_extend:DI (match_dup 2)))
7055 (mult:SI (match_dup 1)
7059 int endian = (WORDS_BIG_ENDIAN == 0);
7060 operands[3] = operand_subword (operands[0], endian, 0, DImode);
7061 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
7064 (define_expand "smulsi3_highpart"
7065 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7067 (lshiftrt:DI (mult:DI (sign_extend:DI
7068 (match_operand:SI 1 "gpc_reg_operand" ""))
7070 (match_operand:SI 2 "gpc_reg_operand" "")))
7075 if (! TARGET_POWER && ! TARGET_POWERPC)
7077 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
7078 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
7079 emit_insn (gen_mulh_call ());
7080 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
7083 else if (TARGET_POWER)
7085 emit_insn (gen_smulsi3_highpart_mq (operands[0], operands[1], operands[2]));
7090 (define_insn "smulsi3_highpart_mq"
7091 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7093 (lshiftrt:DI (mult:DI (sign_extend:DI
7094 (match_operand:SI 1 "gpc_reg_operand" "%r"))
7096 (match_operand:SI 2 "gpc_reg_operand" "r")))
7098 (clobber (match_scratch:SI 3 "=q"))]
7101 [(set_attr "type" "imul")])
7103 (define_insn "*smulsi3_highpart_no_mq"
7104 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7106 (lshiftrt:DI (mult:DI (sign_extend:DI
7107 (match_operand:SI 1 "gpc_reg_operand" "%r"))
7109 (match_operand:SI 2 "gpc_reg_operand" "r")))
7111 "TARGET_POWERPC && ! TARGET_POWER"
7113 [(set_attr "type" "imul")])
7115 (define_expand "umulsi3_highpart"
7116 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7118 (lshiftrt:DI (mult:DI (zero_extend:DI
7119 (match_operand:SI 1 "gpc_reg_operand" ""))
7121 (match_operand:SI 2 "gpc_reg_operand" "")))
7128 emit_insn (gen_umulsi3_highpart_mq (operands[0], operands[1], operands[2]));
7133 (define_insn "umulsi3_highpart_mq"
7134 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7136 (lshiftrt:DI (mult:DI (zero_extend:DI
7137 (match_operand:SI 1 "gpc_reg_operand" "%r"))
7139 (match_operand:SI 2 "gpc_reg_operand" "r")))
7141 (clobber (match_scratch:SI 3 "=q"))]
7142 "TARGET_POWERPC && TARGET_POWER"
7144 [(set_attr "type" "imul")])
7146 (define_insn "*umulsi3_highpart_no_mq"
7147 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7149 (lshiftrt:DI (mult:DI (zero_extend:DI
7150 (match_operand:SI 1 "gpc_reg_operand" "%r"))
7152 (match_operand:SI 2 "gpc_reg_operand" "r")))
7154 "TARGET_POWERPC && ! TARGET_POWER"
7156 [(set_attr "type" "imul")])
7158 ;; If operands 0 and 2 are in the same register, we have a problem. But
7159 ;; operands 0 and 1 (the usual case) can be in the same register. That's
7160 ;; why we have the strange constraints below.
7161 (define_insn "ashldi3_power"
7162 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
7163 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
7164 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
7165 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
7168 {sli|slwi} %0,%L1,%h2\;{cal %L0,0(0)|li %L0,0}
7169 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
7170 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
7171 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2"
7172 [(set_attr "length" "8")])
7174 (define_insn "lshrdi3_power"
7175 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
7176 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
7177 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
7178 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
7181 {s%A2i|s%A2wi} %L0,%1,%h2\;{cal %0,0(0)|li %0,0}
7182 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
7183 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
7184 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2"
7185 [(set_attr "length" "8")])
7187 ;; Shift by a variable amount is too complex to be worth open-coding. We
7188 ;; just handle shifts by constants.
7189 (define_insn "ashrdi3_power"
7190 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
7191 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7192 (match_operand:SI 2 "const_int_operand" "M,i")))
7193 (clobber (match_scratch:SI 3 "=X,q"))]
7196 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
7197 sraiq %0,%1,%h2\;srliq %L0,%L1,%h2"
7198 [(set_attr "type" "shift")
7199 (set_attr "length" "8")])
7201 (define_insn "ashrdi3_no_power"
7202 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
7203 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7204 (match_operand:SI 2 "const_int_operand" "M,i")))]
7205 "TARGET_32BIT && !TARGET_POWERPC64 && !TARGET_POWER && WORDS_BIG_ENDIAN"
7207 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
7208 {sri|srwi} %L0,%L1,%h2\;insrwi %L0,%1,%h2,0\;{srai|srawi} %0,%1,%h2"
7209 [(set_attr "type" "two,three")
7210 (set_attr "length" "8,12")])
7212 (define_insn "*ashrdisi3_noppc64"
7213 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7214 (subreg:SI (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7215 (const_int 32)) 4))]
7216 "TARGET_32BIT && !TARGET_POWERPC64"
7219 if (REGNO (operands[0]) == REGNO (operands[1]))
7222 return \"mr %0,%1\";
7224 [(set_attr "length" "4")])
7227 ;; PowerPC64 DImode operations.
7229 (define_expand "absdi2"
7230 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7231 (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))]
7236 emit_insn (gen_absdi2_isel (operands[0], operands[1]));
7238 emit_insn (gen_absdi2_internal (operands[0], operands[1]));
7242 (define_insn_and_split "absdi2_internal"
7243 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
7244 (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))
7245 (clobber (match_scratch:DI 2 "=&r,&r"))]
7246 "TARGET_POWERPC64 && !TARGET_ISEL"
7248 "&& reload_completed"
7249 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
7250 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
7251 (set (match_dup 0) (minus:DI (match_dup 0) (match_dup 2)))]
7254 (define_insn_and_split "*nabsdi2"
7255 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
7256 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0"))))
7257 (clobber (match_scratch:DI 2 "=&r,&r"))]
7258 "TARGET_POWERPC64 && !TARGET_ISEL"
7260 "&& reload_completed"
7261 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
7262 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
7263 (set (match_dup 0) (minus:DI (match_dup 2) (match_dup 0)))]
7266 (define_insn "muldi3"
7267 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7268 (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
7269 (match_operand:DI 2 "reg_or_short_operand" "r,I")))]
7275 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
7276 (const_string "imul3")
7277 (match_operand:SI 2 "short_cint_operand" "")
7278 (const_string "imul2")]
7279 (const_string "lmul")))])
7281 (define_insn "*muldi3_internal1"
7282 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7283 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
7284 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
7286 (clobber (match_scratch:DI 3 "=r,r"))]
7291 [(set_attr "type" "lmul_compare")
7292 (set_attr "length" "4,8")])
7295 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7296 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
7297 (match_operand:DI 2 "gpc_reg_operand" ""))
7299 (clobber (match_scratch:DI 3 ""))]
7300 "TARGET_POWERPC64 && reload_completed"
7302 (mult:DI (match_dup 1) (match_dup 2)))
7304 (compare:CC (match_dup 3)
7308 (define_insn "*muldi3_internal2"
7309 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7310 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
7311 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
7313 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7314 (mult:DI (match_dup 1) (match_dup 2)))]
7319 [(set_attr "type" "lmul_compare")
7320 (set_attr "length" "4,8")])
7323 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7324 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
7325 (match_operand:DI 2 "gpc_reg_operand" ""))
7327 (set (match_operand:DI 0 "gpc_reg_operand" "")
7328 (mult:DI (match_dup 1) (match_dup 2)))]
7329 "TARGET_POWERPC64 && reload_completed"
7331 (mult:DI (match_dup 1) (match_dup 2)))
7333 (compare:CC (match_dup 0)
7337 (define_insn "smuldi3_highpart"
7338 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7340 (lshiftrt:TI (mult:TI (sign_extend:TI
7341 (match_operand:DI 1 "gpc_reg_operand" "%r"))
7343 (match_operand:DI 2 "gpc_reg_operand" "r")))
7347 [(set_attr "type" "lmul")])
7349 (define_insn "umuldi3_highpart"
7350 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7352 (lshiftrt:TI (mult:TI (zero_extend:TI
7353 (match_operand:DI 1 "gpc_reg_operand" "%r"))
7355 (match_operand:DI 2 "gpc_reg_operand" "r")))
7359 [(set_attr "type" "lmul")])
7361 (define_insn "rotldi3"
7362 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7363 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7364 (match_operand:DI 2 "reg_or_cint_operand" "r,i")))]
7369 [(set_attr "type" "var_shift_rotate,integer")])
7371 (define_insn "*rotldi3_internal2"
7372 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7373 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7374 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
7376 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7383 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7384 (set_attr "length" "4,4,8,8")])
7387 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7388 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7389 (match_operand:DI 2 "reg_or_cint_operand" ""))
7391 (clobber (match_scratch:DI 3 ""))]
7392 "TARGET_POWERPC64 && reload_completed"
7394 (rotate:DI (match_dup 1) (match_dup 2)))
7396 (compare:CC (match_dup 3)
7400 (define_insn "*rotldi3_internal3"
7401 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7402 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7403 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
7405 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7406 (rotate:DI (match_dup 1) (match_dup 2)))]
7413 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7414 (set_attr "length" "4,4,8,8")])
7417 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7418 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7419 (match_operand:DI 2 "reg_or_cint_operand" ""))
7421 (set (match_operand:DI 0 "gpc_reg_operand" "")
7422 (rotate:DI (match_dup 1) (match_dup 2)))]
7423 "TARGET_POWERPC64 && reload_completed"
7425 (rotate:DI (match_dup 1) (match_dup 2)))
7427 (compare:CC (match_dup 0)
7431 (define_insn "*rotldi3_internal4"
7432 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7433 (and:DI (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7434 (match_operand:DI 2 "reg_or_cint_operand" "r,i"))
7435 (match_operand:DI 3 "mask64_operand" "n,n")))]
7438 rldc%B3 %0,%1,%2,%S3
7439 rldic%B3 %0,%1,%H2,%S3"
7440 [(set_attr "type" "var_shift_rotate,integer")])
7442 (define_insn "*rotldi3_internal5"
7443 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7445 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7446 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
7447 (match_operand:DI 3 "mask64_operand" "n,n,n,n"))
7449 (clobber (match_scratch:DI 4 "=r,r,r,r"))]
7452 rldc%B3. %4,%1,%2,%S3
7453 rldic%B3. %4,%1,%H2,%S3
7456 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7457 (set_attr "length" "4,4,8,8")])
7460 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7462 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7463 (match_operand:DI 2 "reg_or_cint_operand" ""))
7464 (match_operand:DI 3 "mask64_operand" ""))
7466 (clobber (match_scratch:DI 4 ""))]
7467 "TARGET_POWERPC64 && reload_completed"
7469 (and:DI (rotate:DI (match_dup 1)
7473 (compare:CC (match_dup 4)
7477 (define_insn "*rotldi3_internal6"
7478 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
7480 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7481 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
7482 (match_operand:DI 3 "mask64_operand" "n,n,n,n"))
7484 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7485 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7488 rldc%B3. %0,%1,%2,%S3
7489 rldic%B3. %0,%1,%H2,%S3
7492 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7493 (set_attr "length" "4,4,8,8")])
7496 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
7498 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7499 (match_operand:DI 2 "reg_or_cint_operand" ""))
7500 (match_operand:DI 3 "mask64_operand" ""))
7502 (set (match_operand:DI 0 "gpc_reg_operand" "")
7503 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7504 "TARGET_POWERPC64 && reload_completed"
7506 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
7508 (compare:CC (match_dup 0)
7512 (define_insn "*rotldi3_internal7"
7513 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7516 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7517 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
7521 rldicl %0,%1,%H2,56"
7522 [(set_attr "type" "var_shift_rotate,integer")])
7524 (define_insn "*rotldi3_internal8"
7525 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7526 (compare:CC (zero_extend:DI
7528 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7529 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7531 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7535 rldicl. %3,%1,%H2,56
7538 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7539 (set_attr "length" "4,4,8,8")])
7542 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7543 (compare:CC (zero_extend:DI
7545 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7546 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7548 (clobber (match_scratch:DI 3 ""))]
7549 "TARGET_POWERPC64 && reload_completed"
7551 (zero_extend:DI (subreg:QI
7552 (rotate:DI (match_dup 1)
7555 (compare:CC (match_dup 3)
7559 (define_insn "*rotldi3_internal9"
7560 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7561 (compare:CC (zero_extend:DI
7563 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7564 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7566 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7567 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7571 rldicl. %0,%1,%H2,56
7574 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7575 (set_attr "length" "4,4,8,8")])
7578 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7579 (compare:CC (zero_extend:DI
7581 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7582 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7584 (set (match_operand:DI 0 "gpc_reg_operand" "")
7585 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7586 "TARGET_POWERPC64 && reload_completed"
7588 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
7590 (compare:CC (match_dup 0)
7594 (define_insn "*rotldi3_internal10"
7595 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7598 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7599 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
7603 rldicl %0,%1,%H2,48"
7604 [(set_attr "type" "var_shift_rotate,integer")])
7606 (define_insn "*rotldi3_internal11"
7607 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7608 (compare:CC (zero_extend:DI
7610 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7611 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7613 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7617 rldicl. %3,%1,%H2,48
7620 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7621 (set_attr "length" "4,4,8,8")])
7624 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7625 (compare:CC (zero_extend:DI
7627 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7628 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7630 (clobber (match_scratch:DI 3 ""))]
7631 "TARGET_POWERPC64 && reload_completed"
7633 (zero_extend:DI (subreg:HI
7634 (rotate:DI (match_dup 1)
7637 (compare:CC (match_dup 3)
7641 (define_insn "*rotldi3_internal12"
7642 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7643 (compare:CC (zero_extend:DI
7645 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7646 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7648 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7649 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7653 rldicl. %0,%1,%H2,48
7656 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7657 (set_attr "length" "4,4,8,8")])
7660 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7661 (compare:CC (zero_extend:DI
7663 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7664 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7666 (set (match_operand:DI 0 "gpc_reg_operand" "")
7667 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7668 "TARGET_POWERPC64 && reload_completed"
7670 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
7672 (compare:CC (match_dup 0)
7676 (define_insn "*rotldi3_internal13"
7677 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7680 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7681 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
7685 rldicl %0,%1,%H2,32"
7686 [(set_attr "type" "var_shift_rotate,integer")])
7688 (define_insn "*rotldi3_internal14"
7689 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7690 (compare:CC (zero_extend:DI
7692 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7693 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7695 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7699 rldicl. %3,%1,%H2,32
7702 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7703 (set_attr "length" "4,4,8,8")])
7706 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7707 (compare:CC (zero_extend:DI
7709 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7710 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7712 (clobber (match_scratch:DI 3 ""))]
7713 "TARGET_POWERPC64 && reload_completed"
7715 (zero_extend:DI (subreg:SI
7716 (rotate:DI (match_dup 1)
7719 (compare:CC (match_dup 3)
7723 (define_insn "*rotldi3_internal15"
7724 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7725 (compare:CC (zero_extend:DI
7727 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7728 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7730 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7731 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7735 rldicl. %0,%1,%H2,32
7738 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7739 (set_attr "length" "4,4,8,8")])
7742 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7743 (compare:CC (zero_extend:DI
7745 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7746 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7748 (set (match_operand:DI 0 "gpc_reg_operand" "")
7749 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7750 "TARGET_POWERPC64 && reload_completed"
7752 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
7754 (compare:CC (match_dup 0)
7758 (define_expand "ashldi3"
7759 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7760 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7761 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7762 "TARGET_POWERPC64 || TARGET_POWER"
7765 if (TARGET_POWERPC64)
7767 else if (TARGET_POWER)
7769 emit_insn (gen_ashldi3_power (operands[0], operands[1], operands[2]));
7776 (define_insn "*ashldi3_internal1"
7777 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7778 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7779 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
7784 [(set_attr "type" "var_shift_rotate,shift")])
7786 (define_insn "*ashldi3_internal2"
7787 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7788 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7789 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7791 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7798 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7799 (set_attr "length" "4,4,8,8")])
7802 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7803 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7804 (match_operand:SI 2 "reg_or_cint_operand" ""))
7806 (clobber (match_scratch:DI 3 ""))]
7807 "TARGET_POWERPC64 && reload_completed"
7809 (ashift:DI (match_dup 1) (match_dup 2)))
7811 (compare:CC (match_dup 3)
7815 (define_insn "*ashldi3_internal3"
7816 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7817 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7818 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7820 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7821 (ashift:DI (match_dup 1) (match_dup 2)))]
7828 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7829 (set_attr "length" "4,4,8,8")])
7832 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7833 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7834 (match_operand:SI 2 "reg_or_cint_operand" ""))
7836 (set (match_operand:DI 0 "gpc_reg_operand" "")
7837 (ashift:DI (match_dup 1) (match_dup 2)))]
7838 "TARGET_POWERPC64 && reload_completed"
7840 (ashift:DI (match_dup 1) (match_dup 2)))
7842 (compare:CC (match_dup 0)
7846 (define_insn "*ashldi3_internal4"
7847 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7848 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7849 (match_operand:SI 2 "const_int_operand" "i"))
7850 (match_operand:DI 3 "const_int_operand" "n")))]
7851 "TARGET_POWERPC64 && includes_rldic_lshift_p (operands[2], operands[3])"
7852 "rldic %0,%1,%H2,%W3")
7854 (define_insn "ashldi3_internal5"
7855 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7857 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7858 (match_operand:SI 2 "const_int_operand" "i,i"))
7859 (match_operand:DI 3 "const_int_operand" "n,n"))
7861 (clobber (match_scratch:DI 4 "=r,r"))]
7862 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
7864 rldic. %4,%1,%H2,%W3
7866 [(set_attr "type" "compare")
7867 (set_attr "length" "4,8")])
7870 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7872 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7873 (match_operand:SI 2 "const_int_operand" ""))
7874 (match_operand:DI 3 "const_int_operand" ""))
7876 (clobber (match_scratch:DI 4 ""))]
7877 "TARGET_POWERPC64 && reload_completed
7878 && includes_rldic_lshift_p (operands[2], operands[3])"
7880 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7883 (compare:CC (match_dup 4)
7887 (define_insn "*ashldi3_internal6"
7888 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
7890 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7891 (match_operand:SI 2 "const_int_operand" "i,i"))
7892 (match_operand:DI 3 "const_int_operand" "n,n"))
7894 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7895 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7896 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
7898 rldic. %0,%1,%H2,%W3
7900 [(set_attr "type" "compare")
7901 (set_attr "length" "4,8")])
7904 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
7906 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7907 (match_operand:SI 2 "const_int_operand" ""))
7908 (match_operand:DI 3 "const_int_operand" ""))
7910 (set (match_operand:DI 0 "gpc_reg_operand" "")
7911 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7912 "TARGET_POWERPC64 && reload_completed
7913 && includes_rldic_lshift_p (operands[2], operands[3])"
7915 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7918 (compare:CC (match_dup 0)
7922 (define_insn "*ashldi3_internal7"
7923 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7924 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7925 (match_operand:SI 2 "const_int_operand" "i"))
7926 (match_operand:DI 3 "mask64_operand" "n")))]
7927 "TARGET_POWERPC64 && includes_rldicr_lshift_p (operands[2], operands[3])"
7928 "rldicr %0,%1,%H2,%S3")
7930 (define_insn "ashldi3_internal8"
7931 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7933 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7934 (match_operand:SI 2 "const_int_operand" "i,i"))
7935 (match_operand:DI 3 "mask64_operand" "n,n"))
7937 (clobber (match_scratch:DI 4 "=r,r"))]
7938 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
7940 rldicr. %4,%1,%H2,%S3
7942 [(set_attr "type" "compare")
7943 (set_attr "length" "4,8")])
7946 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7948 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7949 (match_operand:SI 2 "const_int_operand" ""))
7950 (match_operand:DI 3 "mask64_operand" ""))
7952 (clobber (match_scratch:DI 4 ""))]
7953 "TARGET_POWERPC64 && reload_completed
7954 && includes_rldicr_lshift_p (operands[2], operands[3])"
7956 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7959 (compare:CC (match_dup 4)
7963 (define_insn "*ashldi3_internal9"
7964 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
7966 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7967 (match_operand:SI 2 "const_int_operand" "i,i"))
7968 (match_operand:DI 3 "mask64_operand" "n,n"))
7970 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7971 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7972 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
7974 rldicr. %0,%1,%H2,%S3
7976 [(set_attr "type" "compare")
7977 (set_attr "length" "4,8")])
7980 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
7982 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7983 (match_operand:SI 2 "const_int_operand" ""))
7984 (match_operand:DI 3 "mask64_operand" ""))
7986 (set (match_operand:DI 0 "gpc_reg_operand" "")
7987 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7988 "TARGET_POWERPC64 && reload_completed
7989 && includes_rldicr_lshift_p (operands[2], operands[3])"
7991 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7994 (compare:CC (match_dup 0)
7998 (define_expand "lshrdi3"
7999 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8000 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
8001 (match_operand:SI 2 "reg_or_cint_operand" "")))]
8002 "TARGET_POWERPC64 || TARGET_POWER"
8005 if (TARGET_POWERPC64)
8007 else if (TARGET_POWER)
8009 emit_insn (gen_lshrdi3_power (operands[0], operands[1], operands[2]));
8016 (define_insn "*lshrdi3_internal1"
8017 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8018 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
8019 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
8024 [(set_attr "type" "var_shift_rotate,shift")])
8026 (define_insn "*lshrdi3_internal2"
8027 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
8028 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8029 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
8031 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
8038 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8039 (set_attr "length" "4,4,8,8")])
8042 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8043 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
8044 (match_operand:SI 2 "reg_or_cint_operand" ""))
8046 (clobber (match_scratch:DI 3 ""))]
8047 "TARGET_POWERPC64 && reload_completed"
8049 (lshiftrt:DI (match_dup 1) (match_dup 2)))
8051 (compare:CC (match_dup 3)
8055 (define_insn "*lshrdi3_internal3"
8056 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
8057 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8058 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
8060 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
8061 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
8068 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8069 (set_attr "length" "4,4,8,8")])
8072 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8073 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
8074 (match_operand:SI 2 "reg_or_cint_operand" ""))
8076 (set (match_operand:DI 0 "gpc_reg_operand" "")
8077 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
8078 "TARGET_POWERPC64 && reload_completed"
8080 (lshiftrt:DI (match_dup 1) (match_dup 2)))
8082 (compare:CC (match_dup 0)
8086 (define_expand "ashrdi3"
8087 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8088 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
8089 (match_operand:SI 2 "reg_or_cint_operand" "")))]
8093 if (TARGET_POWERPC64)
8095 else if (TARGET_POWER && GET_CODE (operands[2]) == CONST_INT)
8097 emit_insn (gen_ashrdi3_power (operands[0], operands[1], operands[2]));
8100 else if (TARGET_32BIT && GET_CODE (operands[2]) == CONST_INT
8101 && WORDS_BIG_ENDIAN)
8103 emit_insn (gen_ashrdi3_no_power (operands[0], operands[1], operands[2]));
8110 (define_insn "*ashrdi3_internal1"
8111 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8112 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
8113 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
8118 [(set_attr "type" "var_shift_rotate,shift")])
8120 (define_insn "*ashrdi3_internal2"
8121 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
8122 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8123 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
8125 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
8132 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8133 (set_attr "length" "4,4,8,8")])
8136 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
8137 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
8138 (match_operand:SI 2 "reg_or_cint_operand" ""))
8140 (clobber (match_scratch:DI 3 ""))]
8141 "TARGET_POWERPC64 && reload_completed"
8143 (ashiftrt:DI (match_dup 1) (match_dup 2)))
8145 (compare:CC (match_dup 3)
8149 (define_insn "*ashrdi3_internal3"
8150 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
8151 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8152 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
8154 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
8155 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
8162 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8163 (set_attr "length" "4,4,8,8")])
8166 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
8167 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
8168 (match_operand:SI 2 "reg_or_cint_operand" ""))
8170 (set (match_operand:DI 0 "gpc_reg_operand" "")
8171 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
8172 "TARGET_POWERPC64 && reload_completed"
8174 (ashiftrt:DI (match_dup 1) (match_dup 2)))
8176 (compare:CC (match_dup 0)
8180 (define_expand "anddi3"
8182 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8183 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8184 (match_operand:DI 2 "and64_2_operand" "")))
8185 (clobber (match_scratch:CC 3 ""))])]
8189 (define_insn "anddi3_mc"
8190 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
8191 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r")
8192 (match_operand:DI 2 "and64_2_operand" "?r,S,T,K,J,t")))
8193 (clobber (match_scratch:CC 3 "=X,X,X,x,x,X"))]
8194 "TARGET_POWERPC64 && rs6000_gen_cell_microcode"
8197 rldic%B2 %0,%1,0,%S2
8198 rlwinm %0,%1,0,%m2,%M2
8202 [(set_attr "type" "*,*,*,fast_compare,fast_compare,*")
8203 (set_attr "length" "4,4,4,4,4,8")])
8205 (define_insn "anddi3_nomc"
8206 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
8207 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r")
8208 (match_operand:DI 2 "and64_2_operand" "?r,S,T,t")))
8209 (clobber (match_scratch:CC 3 "=X,X,X,X"))]
8210 "TARGET_POWERPC64 && !rs6000_gen_cell_microcode"
8213 rldic%B2 %0,%1,0,%S2
8214 rlwinm %0,%1,0,%m2,%M2
8216 [(set_attr "length" "4,4,4,8")])
8219 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8220 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8221 (match_operand:DI 2 "mask64_2_operand" "")))
8222 (clobber (match_scratch:CC 3 ""))]
8224 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
8225 && !mask_operand (operands[2], DImode)
8226 && !mask64_operand (operands[2], DImode)"
8228 (and:DI (rotate:DI (match_dup 1)
8232 (and:DI (rotate:DI (match_dup 0)
8236 build_mask64_2_operands (operands[2], &operands[4]);
8239 (define_insn "*anddi3_internal2_mc"
8240 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,x,?y,?y,?y,??y,??y,?y")
8241 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r,r,r")
8242 (match_operand:DI 2 "and64_2_operand" "r,S,T,K,J,t,r,S,T,K,J,t"))
8244 (clobber (match_scratch:DI 3 "=r,r,r,r,r,r,r,r,r,r,r,r"))
8245 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,X,X,x,x,X"))]
8246 "TARGET_64BIT && rs6000_gen_cell_microcode"
8249 rldic%B2. %3,%1,0,%S2
8250 rlwinm. %3,%1,0,%m2,%M2
8260 [(set_attr "type" "fast_compare,compare,delayed_compare,fast_compare,\
8261 fast_compare,compare,compare,compare,compare,compare,\
8263 (set_attr "length" "4,4,4,4,4,8,8,8,8,8,8,12")])
8266 [(set (match_operand:CC 0 "cc_reg_operand" "")
8267 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8268 (match_operand:DI 2 "mask64_2_operand" ""))
8270 (clobber (match_scratch:DI 3 ""))
8271 (clobber (match_scratch:CC 4 ""))]
8272 "TARGET_64BIT && reload_completed
8273 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
8274 && !mask_operand (operands[2], DImode)
8275 && !mask64_operand (operands[2], DImode)"
8277 (and:DI (rotate:DI (match_dup 1)
8280 (parallel [(set (match_dup 0)
8281 (compare:CC (and:DI (rotate:DI (match_dup 3)
8285 (clobber (match_dup 3))])]
8288 build_mask64_2_operands (operands[2], &operands[5]);
8291 (define_insn "*anddi3_internal3_mc"
8292 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,x,x,?y,?y,?y,??y,??y,?y")
8293 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r,r,r")
8294 (match_operand:DI 2 "and64_2_operand" "r,S,T,K,J,t,r,S,T,K,J,t"))
8296 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r,r,r")
8297 (and:DI (match_dup 1) (match_dup 2)))
8298 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,X,X,x,x,X"))]
8299 "TARGET_64BIT && rs6000_gen_cell_microcode"
8302 rldic%B2. %0,%1,0,%S2
8303 rlwinm. %0,%1,0,%m2,%M2
8313 [(set_attr "type" "fast_compare,compare,delayed_compare,fast_compare,\
8314 fast_compare,compare,compare,compare,compare,compare,\
8316 (set_attr "length" "4,4,4,4,4,8,8,8,8,8,8,12")])
8319 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8320 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8321 (match_operand:DI 2 "and64_2_operand" ""))
8323 (set (match_operand:DI 0 "gpc_reg_operand" "")
8324 (and:DI (match_dup 1) (match_dup 2)))
8325 (clobber (match_scratch:CC 4 ""))]
8326 "TARGET_64BIT && reload_completed"
8327 [(parallel [(set (match_dup 0)
8328 (and:DI (match_dup 1) (match_dup 2)))
8329 (clobber (match_dup 4))])
8331 (compare:CC (match_dup 0)
8336 [(set (match_operand:CC 3 "cc_reg_operand" "")
8337 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8338 (match_operand:DI 2 "mask64_2_operand" ""))
8340 (set (match_operand:DI 0 "gpc_reg_operand" "")
8341 (and:DI (match_dup 1) (match_dup 2)))
8342 (clobber (match_scratch:CC 4 ""))]
8343 "TARGET_64BIT && reload_completed
8344 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
8345 && !mask_operand (operands[2], DImode)
8346 && !mask64_operand (operands[2], DImode)"
8348 (and:DI (rotate:DI (match_dup 1)
8351 (parallel [(set (match_dup 3)
8352 (compare:CC (and:DI (rotate:DI (match_dup 0)
8357 (and:DI (rotate:DI (match_dup 0)
8362 build_mask64_2_operands (operands[2], &operands[5]);
8365 (define_expand "iordi3"
8366 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8367 (ior:DI (match_operand:DI 1 "gpc_reg_operand" "")
8368 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
8372 if (non_logical_cint_operand (operands[2], DImode))
8374 HOST_WIDE_INT value;
8375 rtx tmp = ((!can_create_pseudo_p ()
8376 || rtx_equal_p (operands[0], operands[1]))
8377 ? operands[0] : gen_reg_rtx (DImode));
8379 if (GET_CODE (operands[2]) == CONST_INT)
8381 value = INTVAL (operands[2]);
8382 emit_insn (gen_iordi3 (tmp, operands[1],
8383 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
8387 value = CONST_DOUBLE_LOW (operands[2]);
8388 emit_insn (gen_iordi3 (tmp, operands[1],
8389 immed_double_const (value
8390 & (~ (HOST_WIDE_INT) 0xffff),
8394 emit_insn (gen_iordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
8399 (define_expand "xordi3"
8400 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8401 (xor:DI (match_operand:DI 1 "gpc_reg_operand" "")
8402 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
8406 if (non_logical_cint_operand (operands[2], DImode))
8408 HOST_WIDE_INT value;
8409 rtx tmp = ((!can_create_pseudo_p ()
8410 || rtx_equal_p (operands[0], operands[1]))
8411 ? operands[0] : gen_reg_rtx (DImode));
8413 if (GET_CODE (operands[2]) == CONST_INT)
8415 value = INTVAL (operands[2]);
8416 emit_insn (gen_xordi3 (tmp, operands[1],
8417 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
8421 value = CONST_DOUBLE_LOW (operands[2]);
8422 emit_insn (gen_xordi3 (tmp, operands[1],
8423 immed_double_const (value
8424 & (~ (HOST_WIDE_INT) 0xffff),
8428 emit_insn (gen_xordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
8433 (define_insn "*booldi3_internal1"
8434 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
8435 (match_operator:DI 3 "boolean_or_operator"
8436 [(match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
8437 (match_operand:DI 2 "logical_operand" "r,K,JF")]))]
8444 (define_insn "*booldi3_internal2"
8445 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
8446 (compare:CC (match_operator:DI 4 "boolean_or_operator"
8447 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
8448 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
8450 (clobber (match_scratch:DI 3 "=r,r"))]
8455 [(set_attr "type" "fast_compare,compare")
8456 (set_attr "length" "4,8")])
8459 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8460 (compare:CC (match_operator:DI 4 "boolean_operator"
8461 [(match_operand:DI 1 "gpc_reg_operand" "")
8462 (match_operand:DI 2 "gpc_reg_operand" "")])
8464 (clobber (match_scratch:DI 3 ""))]
8465 "TARGET_POWERPC64 && reload_completed"
8466 [(set (match_dup 3) (match_dup 4))
8468 (compare:CC (match_dup 3)
8472 (define_insn "*booldi3_internal3"
8473 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
8474 (compare:CC (match_operator:DI 4 "boolean_or_operator"
8475 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
8476 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
8478 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8484 [(set_attr "type" "fast_compare,compare")
8485 (set_attr "length" "4,8")])
8488 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8489 (compare:CC (match_operator:DI 4 "boolean_operator"
8490 [(match_operand:DI 1 "gpc_reg_operand" "")
8491 (match_operand:DI 2 "gpc_reg_operand" "")])
8493 (set (match_operand:DI 0 "gpc_reg_operand" "")
8495 "TARGET_POWERPC64 && reload_completed"
8496 [(set (match_dup 0) (match_dup 4))
8498 (compare:CC (match_dup 0)
8502 ;; Split a logical operation that we can't do in one insn into two insns,
8503 ;; each of which does one 16-bit part. This is used by combine.
8506 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8507 (match_operator:DI 3 "boolean_or_operator"
8508 [(match_operand:DI 1 "gpc_reg_operand" "")
8509 (match_operand:DI 2 "non_logical_cint_operand" "")]))]
8511 [(set (match_dup 0) (match_dup 4))
8512 (set (match_dup 0) (match_dup 5))]
8517 if (GET_CODE (operands[2]) == CONST_DOUBLE)
8519 HOST_WIDE_INT value = CONST_DOUBLE_LOW (operands[2]);
8520 i3 = immed_double_const (value & (~ (HOST_WIDE_INT) 0xffff),
8522 i4 = GEN_INT (value & 0xffff);
8526 i3 = GEN_INT (INTVAL (operands[2])
8527 & (~ (HOST_WIDE_INT) 0xffff));
8528 i4 = GEN_INT (INTVAL (operands[2]) & 0xffff);
8530 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
8532 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
8536 (define_insn "*boolcdi3_internal1"
8537 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
8538 (match_operator:DI 3 "boolean_operator"
8539 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
8540 (match_operand:DI 2 "gpc_reg_operand" "r")]))]
8544 (define_insn "*boolcdi3_internal2"
8545 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
8546 (compare:CC (match_operator:DI 4 "boolean_operator"
8547 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
8548 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
8550 (clobber (match_scratch:DI 3 "=r,r"))]
8555 [(set_attr "type" "fast_compare,compare")
8556 (set_attr "length" "4,8")])
8559 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8560 (compare:CC (match_operator:DI 4 "boolean_operator"
8561 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
8562 (match_operand:DI 2 "gpc_reg_operand" "")])
8564 (clobber (match_scratch:DI 3 ""))]
8565 "TARGET_POWERPC64 && reload_completed"
8566 [(set (match_dup 3) (match_dup 4))
8568 (compare:CC (match_dup 3)
8572 (define_insn "*boolcdi3_internal3"
8573 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
8574 (compare:CC (match_operator:DI 4 "boolean_operator"
8575 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
8576 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
8578 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8584 [(set_attr "type" "fast_compare,compare")
8585 (set_attr "length" "4,8")])
8588 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8589 (compare:CC (match_operator:DI 4 "boolean_operator"
8590 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
8591 (match_operand:DI 2 "gpc_reg_operand" "")])
8593 (set (match_operand:DI 0 "gpc_reg_operand" "")
8595 "TARGET_POWERPC64 && reload_completed"
8596 [(set (match_dup 0) (match_dup 4))
8598 (compare:CC (match_dup 0)
8602 (define_insn "*boolccdi3_internal1"
8603 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
8604 (match_operator:DI 3 "boolean_operator"
8605 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
8606 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r"))]))]
8610 (define_insn "*boolccdi3_internal2"
8611 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
8612 (compare:CC (match_operator:DI 4 "boolean_operator"
8613 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
8614 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
8616 (clobber (match_scratch:DI 3 "=r,r"))]
8621 [(set_attr "type" "fast_compare,compare")
8622 (set_attr "length" "4,8")])
8625 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8626 (compare:CC (match_operator:DI 4 "boolean_operator"
8627 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
8628 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
8630 (clobber (match_scratch:DI 3 ""))]
8631 "TARGET_POWERPC64 && reload_completed"
8632 [(set (match_dup 3) (match_dup 4))
8634 (compare:CC (match_dup 3)
8638 (define_insn "*boolccdi3_internal3"
8639 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
8640 (compare:CC (match_operator:DI 4 "boolean_operator"
8641 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
8642 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
8644 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8650 [(set_attr "type" "fast_compare,compare")
8651 (set_attr "length" "4,8")])
8654 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8655 (compare:CC (match_operator:DI 4 "boolean_operator"
8656 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
8657 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
8659 (set (match_operand:DI 0 "gpc_reg_operand" "")
8661 "TARGET_POWERPC64 && reload_completed"
8662 [(set (match_dup 0) (match_dup 4))
8664 (compare:CC (match_dup 0)
8668 (define_expand "smindi3"
8669 [(match_operand:DI 0 "gpc_reg_operand" "")
8670 (match_operand:DI 1 "gpc_reg_operand" "")
8671 (match_operand:DI 2 "gpc_reg_operand" "")]
8675 rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]);
8679 (define_expand "smaxdi3"
8680 [(match_operand:DI 0 "gpc_reg_operand" "")
8681 (match_operand:DI 1 "gpc_reg_operand" "")
8682 (match_operand:DI 2 "gpc_reg_operand" "")]
8686 rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]);
8690 (define_expand "umindi3"
8691 [(match_operand:DI 0 "gpc_reg_operand" "")
8692 (match_operand:DI 1 "gpc_reg_operand" "")
8693 (match_operand:DI 2 "gpc_reg_operand" "")]
8697 rs6000_emit_minmax (operands[0], UMIN, operands[1], operands[2]);
8701 (define_expand "umaxdi3"
8702 [(match_operand:DI 0 "gpc_reg_operand" "")
8703 (match_operand:DI 1 "gpc_reg_operand" "")
8704 (match_operand:DI 2 "gpc_reg_operand" "")]
8708 rs6000_emit_minmax (operands[0], UMAX, operands[1], operands[2]);
8713 ;; Now define ways of moving data around.
8715 ;; Set up a register with a value from the GOT table
8717 (define_expand "movsi_got"
8718 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8719 (unspec:SI [(match_operand:SI 1 "got_operand" "")
8720 (match_dup 2)] UNSPEC_MOVSI_GOT))]
8721 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
8724 if (GET_CODE (operands[1]) == CONST)
8726 rtx offset = const0_rtx;
8727 HOST_WIDE_INT value;
8729 operands[1] = eliminate_constant_term (XEXP (operands[1], 0), &offset);
8730 value = INTVAL (offset);
8733 rtx tmp = (!can_create_pseudo_p ()
8735 : gen_reg_rtx (Pmode));
8736 emit_insn (gen_movsi_got (tmp, operands[1]));
8737 emit_insn (gen_addsi3 (operands[0], tmp, offset));
8742 operands[2] = rs6000_got_register (operands[1]);
8745 (define_insn "*movsi_got_internal"
8746 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8747 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
8748 (match_operand:SI 2 "gpc_reg_operand" "b")]
8750 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
8751 "{l|lwz} %0,%a1@got(%2)"
8752 [(set_attr "type" "load")])
8754 ;; Used by sched, shorten_branches and final when the GOT pseudo reg
8755 ;; didn't get allocated to a hard register.
8757 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8758 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
8759 (match_operand:SI 2 "memory_operand" "")]
8761 "DEFAULT_ABI == ABI_V4
8763 && (reload_in_progress || reload_completed)"
8764 [(set (match_dup 0) (match_dup 2))
8765 (set (match_dup 0) (unspec:SI [(match_dup 1)(match_dup 0)]
8769 ;; For SI, we special-case integers that can't be loaded in one insn. We
8770 ;; do the load 16-bits at a time. We could do this by loading from memory,
8771 ;; and this is even supposed to be faster, but it is simpler not to get
8772 ;; integers in the TOC.
8773 (define_insn "movsi_low"
8774 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8775 (mem:SI (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
8776 (match_operand 2 "" ""))))]
8777 "TARGET_MACHO && ! TARGET_64BIT"
8778 "{l|lwz} %0,lo16(%2)(%1)"
8779 [(set_attr "type" "load")
8780 (set_attr "length" "4")])
8782 (define_insn "*movsi_internal1"
8783 [(set (match_operand:SI 0 "rs6000_nonimmediate_operand" "=r,r,r,m,r,r,r,r,r,*q,*c*l,*h,*h")
8784 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,R,*h,r,r,r,0"))]
8785 "!TARGET_SINGLE_FPU &&
8786 (gpc_reg_operand (operands[0], SImode) || gpc_reg_operand (operands[1], SImode))"
8790 {l%U1%X1|lwz%U1%X1} %0,%1
8791 {st%U0%X0|stw%U0%X0} %1,%0
8801 [(set_attr "type" "*,*,load,store,*,*,*,*,mfjmpr,*,mtjmpr,*,*")
8802 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4,4,4")])
8804 (define_insn "*movsi_internal1_single"
8805 [(set (match_operand:SI 0 "rs6000_nonimmediate_operand" "=r,r,r,m,r,r,r,r,r,*q,*c*l,*h,*h,m,*f")
8806 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,R,*h,r,r,r,0,f,m"))]
8807 "TARGET_SINGLE_FPU &&
8808 (gpc_reg_operand (operands[0], SImode) || gpc_reg_operand (operands[1], SImode))"
8812 {l%U1%X1|lwz%U1%X1} %0,%1
8813 {st%U0%X0|stw%U0%X0} %1,%0
8825 [(set_attr "type" "*,*,load,store,*,*,*,*,mfjmpr,*,mtjmpr,*,*,*,*")
8826 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4,4,4,4,4")])
8828 ;; Split a load of a large constant into the appropriate two-insn
8832 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8833 (match_operand:SI 1 "const_int_operand" ""))]
8834 "(unsigned HOST_WIDE_INT) (INTVAL (operands[1]) + 0x8000) >= 0x10000
8835 && (INTVAL (operands[1]) & 0xffff) != 0"
8839 (ior:SI (match_dup 0)
8842 { rtx tem = rs6000_emit_set_const (operands[0], SImode, operands[1], 2);
8844 if (tem == operands[0])
8850 (define_insn "*mov<mode>_internal2"
8851 [(set (match_operand:CC 2 "cc_reg_operand" "=y,x,?y")
8852 (compare:CC (match_operand:P 1 "gpc_reg_operand" "0,r,r")
8854 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r") (match_dup 1))]
8857 {cmpi|cmp<wd>i} %2,%0,0
8860 [(set_attr "type" "cmp,compare,cmp")
8861 (set_attr "length" "4,4,8")])
8864 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
8865 (compare:CC (match_operand:P 1 "gpc_reg_operand" "")
8867 (set (match_operand:P 0 "gpc_reg_operand" "") (match_dup 1))]
8869 [(set (match_dup 0) (match_dup 1))
8871 (compare:CC (match_dup 0)
8875 (define_insn "*movhi_internal"
8876 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
8877 (match_operand:HI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
8878 "gpc_reg_operand (operands[0], HImode)
8879 || gpc_reg_operand (operands[1], HImode)"
8889 [(set_attr "type" "*,load,store,*,mfjmpr,*,mtjmpr,*")])
8891 (define_expand "mov<mode>"
8892 [(set (match_operand:INT 0 "general_operand" "")
8893 (match_operand:INT 1 "any_operand" ""))]
8895 "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
8897 (define_insn "*movqi_internal"
8898 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
8899 (match_operand:QI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
8900 "gpc_reg_operand (operands[0], QImode)
8901 || gpc_reg_operand (operands[1], QImode)"
8911 [(set_attr "type" "*,load,store,*,mfjmpr,*,mtjmpr,*")])
8913 ;; Here is how to move condition codes around. When we store CC data in
8914 ;; an integer register or memory, we store just the high-order 4 bits.
8915 ;; This lets us not shift in the most common case of CR0.
8916 (define_expand "movcc"
8917 [(set (match_operand:CC 0 "nonimmediate_operand" "")
8918 (match_operand:CC 1 "nonimmediate_operand" ""))]
8922 (define_insn "*movcc_internal1"
8923 [(set (match_operand:CC 0 "nonimmediate_operand" "=y,x,?y,y,r,r,r,r,r,q,cl,r,m")
8924 (match_operand:CC 1 "general_operand" "y,r,r,O,x,y,r,I,h,r,r,m,r"))]
8925 "register_operand (operands[0], CCmode)
8926 || register_operand (operands[1], CCmode)"
8930 {rlinm|rlwinm} %1,%1,%F0,0xffffffff\;mtcrf %R0,%1\;{rlinm|rlwinm} %1,%1,%f0,0xffffffff
8933 mfcr %0%Q1\;{rlinm|rlwinm} %0,%0,%f1,0xf0000000
8939 {l%U1%X1|lwz%U1%X1} %0,%1
8940 {st%U0%U1|stw%U0%U1} %1,%0"
8942 (cond [(eq_attr "alternative" "0,3")
8943 (const_string "cr_logical")
8944 (eq_attr "alternative" "1,2")
8945 (const_string "mtcr")
8946 (eq_attr "alternative" "6,7,9")
8947 (const_string "integer")
8948 (eq_attr "alternative" "8")
8949 (const_string "mfjmpr")
8950 (eq_attr "alternative" "10")
8951 (const_string "mtjmpr")
8952 (eq_attr "alternative" "11")
8953 (const_string "load")
8954 (eq_attr "alternative" "12")
8955 (const_string "store")
8956 (ne (symbol_ref "TARGET_MFCRF") (const_int 0))
8957 (const_string "mfcrf")
8959 (const_string "mfcr")))
8960 (set_attr "length" "4,4,12,4,4,8,4,4,4,4,4,4,4")])
8962 ;; For floating-point, we normally deal with the floating-point registers
8963 ;; unless -msoft-float is used. The sole exception is that parameter passing
8964 ;; can produce floating-point values in fixed-point registers. Unless the
8965 ;; value is a simple constant or already in memory, we deal with this by
8966 ;; allocating memory and copying the value explicitly via that memory location.
8967 (define_expand "movsf"
8968 [(set (match_operand:SF 0 "nonimmediate_operand" "")
8969 (match_operand:SF 1 "any_operand" ""))]
8971 "{ rs6000_emit_move (operands[0], operands[1], SFmode); DONE; }")
8974 [(set (match_operand:SF 0 "gpc_reg_operand" "")
8975 (match_operand:SF 1 "const_double_operand" ""))]
8977 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8978 || (GET_CODE (operands[0]) == SUBREG
8979 && GET_CODE (SUBREG_REG (operands[0])) == REG
8980 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8981 [(set (match_dup 2) (match_dup 3))]
8987 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8988 REAL_VALUE_TO_TARGET_SINGLE (rv, l);
8990 if (! TARGET_POWERPC64)
8991 operands[2] = operand_subword (operands[0], 0, 0, SFmode);
8993 operands[2] = gen_lowpart (SImode, operands[0]);
8995 operands[3] = gen_int_mode (l, SImode);
8998 (define_insn "*movsf_hardfloat"
8999 [(set (match_operand:SF 0 "nonimmediate_operand" "=!r,!r,m,f,f,m,*c*l,*q,!r,*h,!r,!r")
9000 (match_operand:SF 1 "input_operand" "r,m,r,f,m,f,r,r,h,0,G,Fn"))]
9001 "(gpc_reg_operand (operands[0], SFmode)
9002 || gpc_reg_operand (operands[1], SFmode))
9003 && (TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT)"
9006 {l%U1%X1|lwz%U1%X1} %0,%1
9007 {st%U0%X0|stw%U0%X0} %1,%0
9017 [(set_attr "type" "*,load,store,fp,fpload,fpstore,mtjmpr,*,mfjmpr,*,*,*")
9018 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,8")])
9020 (define_insn "*movsf_softfloat"
9021 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,cl,q,r,r,m,r,r,r,r,r,*h")
9022 (match_operand:SF 1 "input_operand" "r,r,r,h,m,r,I,L,R,G,Fn,0"))]
9023 "(gpc_reg_operand (operands[0], SFmode)
9024 || gpc_reg_operand (operands[1], SFmode))
9025 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)"
9031 {l%U1%X1|lwz%U1%X1} %0,%1
9032 {st%U0%X0|stw%U0%X0} %1,%0
9039 [(set_attr "type" "*,mtjmpr,*,mfjmpr,load,store,*,*,*,*,*,*")
9040 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,8,4")])
9043 (define_expand "movdf"
9044 [(set (match_operand:DF 0 "nonimmediate_operand" "")
9045 (match_operand:DF 1 "any_operand" ""))]
9047 "{ rs6000_emit_move (operands[0], operands[1], DFmode); DONE; }")
9050 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9051 (match_operand:DF 1 "const_int_operand" ""))]
9052 "! TARGET_POWERPC64 && reload_completed
9053 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
9054 || (GET_CODE (operands[0]) == SUBREG
9055 && GET_CODE (SUBREG_REG (operands[0])) == REG
9056 && REGNO (SUBREG_REG (operands[0])) <= 31))"
9057 [(set (match_dup 2) (match_dup 4))
9058 (set (match_dup 3) (match_dup 1))]
9061 int endian = (WORDS_BIG_ENDIAN == 0);
9062 HOST_WIDE_INT value = INTVAL (operands[1]);
9064 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
9065 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
9066 #if HOST_BITS_PER_WIDE_INT == 32
9067 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
9069 operands[4] = GEN_INT (value >> 32);
9070 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
9075 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9076 (match_operand:DF 1 "const_double_operand" ""))]
9077 "! TARGET_POWERPC64 && reload_completed
9078 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
9079 || (GET_CODE (operands[0]) == SUBREG
9080 && GET_CODE (SUBREG_REG (operands[0])) == REG
9081 && REGNO (SUBREG_REG (operands[0])) <= 31))"
9082 [(set (match_dup 2) (match_dup 4))
9083 (set (match_dup 3) (match_dup 5))]
9086 int endian = (WORDS_BIG_ENDIAN == 0);
9090 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
9091 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
9093 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
9094 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
9095 operands[4] = gen_int_mode (l[endian], SImode);
9096 operands[5] = gen_int_mode (l[1 - endian], SImode);
9100 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9101 (match_operand:DF 1 "const_double_operand" ""))]
9102 "TARGET_POWERPC64 && reload_completed
9103 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
9104 || (GET_CODE (operands[0]) == SUBREG
9105 && GET_CODE (SUBREG_REG (operands[0])) == REG
9106 && REGNO (SUBREG_REG (operands[0])) <= 31))"
9107 [(set (match_dup 2) (match_dup 3))]
9110 int endian = (WORDS_BIG_ENDIAN == 0);
9113 #if HOST_BITS_PER_WIDE_INT >= 64
9117 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
9118 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
9120 operands[2] = gen_lowpart (DImode, operands[0]);
9121 /* HIGHPART is lower memory address when WORDS_BIG_ENDIAN. */
9122 #if HOST_BITS_PER_WIDE_INT >= 64
9123 val = ((HOST_WIDE_INT)(unsigned long)l[endian] << 32
9124 | ((HOST_WIDE_INT)(unsigned long)l[1 - endian]));
9126 operands[3] = gen_int_mode (val, DImode);
9128 operands[3] = immed_double_const (l[1 - endian], l[endian], DImode);
9132 ;; Don't have reload use general registers to load a constant. First,
9133 ;; it might not work if the output operand is the equivalent of
9134 ;; a non-offsettable memref, but also it is less efficient than loading
9135 ;; the constant into an FP register, since it will probably be used there.
9136 ;; The "??" is a kludge until we can figure out a more reasonable way
9137 ;; of handling these non-offsettable values.
9138 (define_insn "*movdf_hardfloat32"
9139 [(set (match_operand:DF 0 "nonimmediate_operand" "=!r,??r,m,ws,?wa,ws,?wa,Z,?Z,d,d,m,wa,!r,!r,!r")
9140 (match_operand:DF 1 "input_operand" "r,m,r,ws,wa,Z,Z,ws,wa,d,m,d,j,G,H,F"))]
9141 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9142 && (gpc_reg_operand (operands[0], DFmode)
9143 || gpc_reg_operand (operands[1], DFmode))"
9146 switch (which_alternative)
9151 /* We normally copy the low-numbered register first. However, if
9152 the first register operand 0 is the same as the second register
9153 of operand 1, we must copy in the opposite order. */
9154 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
9155 return \"mr %L0,%L1\;mr %0,%1\";
9157 return \"mr %0,%1\;mr %L0,%L1\";
9159 if (rs6000_offsettable_memref_p (operands[1])
9160 || (GET_CODE (operands[1]) == MEM
9161 && (GET_CODE (XEXP (operands[1], 0)) == LO_SUM
9162 || GET_CODE (XEXP (operands[1], 0)) == PRE_INC
9163 || GET_CODE (XEXP (operands[1], 0)) == PRE_DEC
9164 || GET_CODE (XEXP (operands[1], 0)) == PRE_MODIFY)))
9166 /* If the low-address word is used in the address, we must load
9167 it last. Otherwise, load it first. Note that we cannot have
9168 auto-increment in that case since the address register is
9169 known to be dead. */
9170 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
9172 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
9174 return \"{l%U1%X1|lwz%U1%X1} %0,%1\;{l|lwz} %L0,%L1\";
9180 addreg = find_addr_reg (XEXP (operands[1], 0));
9181 if (refers_to_regno_p (REGNO (operands[0]),
9182 REGNO (operands[0]) + 1,
9185 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
9186 output_asm_insn (\"{l%X1|lwz%X1} %L0,%1\", operands);
9187 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
9188 return \"{l%X1|lwz%X1} %0,%1\";
9192 output_asm_insn (\"{l%X1|lwz%X1} %0,%1\", operands);
9193 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
9194 output_asm_insn (\"{l%X1|lwz%X1} %L0,%1\", operands);
9195 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
9200 if (rs6000_offsettable_memref_p (operands[0])
9201 || (GET_CODE (operands[0]) == MEM
9202 && (GET_CODE (XEXP (operands[0], 0)) == LO_SUM
9203 || GET_CODE (XEXP (operands[0], 0)) == PRE_INC
9204 || GET_CODE (XEXP (operands[0], 0)) == PRE_DEC
9205 || GET_CODE (XEXP (operands[0], 0)) == PRE_MODIFY)))
9206 return \"{st%U0%X0|stw%U0%X0} %1,%0\;{st|stw} %L1,%L0\";
9211 addreg = find_addr_reg (XEXP (operands[0], 0));
9212 output_asm_insn (\"{st%X0|stw%X0} %1,%0\", operands);
9213 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
9214 output_asm_insn (\"{st%X0|stw%X0} %L1,%0\", operands);
9215 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
9220 return \"xxlor %x0,%x1,%x1\";
9223 return \"lxsd%U1x %x0,%y1\";
9226 return \"stxsd%U0x %x1,%y0\";
9228 return \"fmr %0,%1\";
9230 return \"lfd%U1%X1 %0,%1\";
9232 return \"stfd%U0%X0 %1,%0\";
9234 return \"xxlxor %x0,%x0,%x0\";
9241 [(set_attr "type" "two,load,store,fp,fp,fpload,fpload,fpstore,fpstore,fp,fpload,fpstore,vecsimple,*,*,*")
9242 (set_attr "length" "8,16,16,4,4,4,4,4,4,4,4,4,4,8,12,16")])
9244 (define_insn "*movdf_softfloat32"
9245 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,m,r,r,r")
9246 (match_operand:DF 1 "input_operand" "r,m,r,G,H,F"))]
9248 && ((TARGET_FPRS && TARGET_SINGLE_FLOAT)
9249 || TARGET_SOFT_FLOAT || TARGET_E500_SINGLE)
9250 && (gpc_reg_operand (operands[0], DFmode)
9251 || gpc_reg_operand (operands[1], DFmode))"
9254 switch (which_alternative)
9259 /* We normally copy the low-numbered register first. However, if
9260 the first register operand 0 is the same as the second register of
9261 operand 1, we must copy in the opposite order. */
9262 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
9263 return \"mr %L0,%L1\;mr %0,%1\";
9265 return \"mr %0,%1\;mr %L0,%L1\";
9267 /* If the low-address word is used in the address, we must load
9268 it last. Otherwise, load it first. Note that we cannot have
9269 auto-increment in that case since the address register is
9270 known to be dead. */
9271 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
9273 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
9275 return \"{l%U1%X1|lwz%U1%X1} %0,%1\;{l|lwz} %L0,%L1\";
9277 return \"{st%U0%X0|stw%U0%X0} %1,%0\;{st|stw} %L1,%L0\";
9284 [(set_attr "type" "two,load,store,*,*,*")
9285 (set_attr "length" "8,8,8,8,12,16")])
9287 ; ld/std require word-aligned displacements -> 'Y' constraint.
9288 ; List Y->r and r->Y before r->r for reload.
9289 (define_insn "*movdf_hardfloat64_mfpgpr"
9290 [(set (match_operand:DF 0 "nonimmediate_operand" "=Y,r,!r,ws,?wa,ws,?wa,Z,?Z,d,d,m,wa,*c*l,!r,*h,!r,!r,!r,r,d")
9291 (match_operand:DF 1 "input_operand" "r,Y,r,ws,?wa,Z,Z,ws,wa,d,m,d,j,r,h,0,G,H,F,d,r"))]
9292 "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
9293 && TARGET_DOUBLE_FLOAT
9294 && (gpc_reg_operand (operands[0], DFmode)
9295 || gpc_reg_operand (operands[1], DFmode))"
9318 [(set_attr "type" "store,load,*,fp,fp,fpload,fpload,fpstore,fpstore,fp,fpload,fpstore,vecsimple,mtjmpr,mfjmpr,*,*,*,*,mftgpr,mffgpr")
9319 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,8,12,16,4,4")])
9321 ; ld/std require word-aligned displacements -> 'Y' constraint.
9322 ; List Y->r and r->Y before r->r for reload.
9323 (define_insn "*movdf_hardfloat64"
9324 [(set (match_operand:DF 0 "nonimmediate_operand" "=Y,r,!r,ws,?wa,ws,?wa,Z,?Z,d,d,m,wa,*c*l,!r,*h,!r,!r,!r")
9325 (match_operand:DF 1 "input_operand" "r,Y,r,ws,wa,Z,Z,ws,wa,d,m,d,j,r,h,0,G,H,F"))]
9326 "TARGET_POWERPC64 && !TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
9327 && TARGET_DOUBLE_FLOAT
9328 && (gpc_reg_operand (operands[0], DFmode)
9329 || gpc_reg_operand (operands[1], DFmode))"
9350 [(set_attr "type" "store,load,*,fp,fp,fpload,fpload,fpstore,fpstore,fp,fpload,fpstore,vecsimple,mtjmpr,mfjmpr,*,*,*,*")
9351 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,8,12,16")])
9353 (define_insn "*movdf_softfloat64"
9354 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,Y,r,cl,r,r,r,r,*h")
9355 (match_operand:DF 1 "input_operand" "Y,r,r,r,h,G,H,F,0"))]
9356 "TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)
9357 && (gpc_reg_operand (operands[0], DFmode)
9358 || gpc_reg_operand (operands[1], DFmode))"
9369 [(set_attr "type" "load,store,*,mtjmpr,mfjmpr,*,*,*,*")
9370 (set_attr "length" "4,4,4,4,4,8,12,16,4")])
9372 (define_expand "movtf"
9373 [(set (match_operand:TF 0 "general_operand" "")
9374 (match_operand:TF 1 "any_operand" ""))]
9375 "!TARGET_IEEEQUAD && TARGET_LONG_DOUBLE_128"
9376 "{ rs6000_emit_move (operands[0], operands[1], TFmode); DONE; }")
9378 ; It's important to list the o->f and f->o moves before f->f because
9379 ; otherwise reload, given m->f, will try to pick f->f and reload it,
9380 ; which doesn't make progress. Likewise r->Y must be before r->r.
9381 (define_insn_and_split "*movtf_internal"
9382 [(set (match_operand:TF 0 "nonimmediate_operand" "=o,d,d,r,Y,r")
9383 (match_operand:TF 1 "input_operand" "d,o,d,YGHF,r,r"))]
9385 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128
9386 && (gpc_reg_operand (operands[0], TFmode)
9387 || gpc_reg_operand (operands[1], TFmode))"
9389 "&& reload_completed"
9391 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
9392 [(set_attr "length" "8,8,8,20,20,16")])
9394 (define_insn_and_split "*movtf_softfloat"
9395 [(set (match_operand:TF 0 "rs6000_nonimmediate_operand" "=r,Y,r")
9396 (match_operand:TF 1 "input_operand" "YGHF,r,r"))]
9398 && (TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_LONG_DOUBLE_128
9399 && (gpc_reg_operand (operands[0], TFmode)
9400 || gpc_reg_operand (operands[1], TFmode))"
9402 "&& reload_completed"
9404 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
9405 [(set_attr "length" "20,20,16")])
9407 (define_expand "extenddftf2"
9408 [(set (match_operand:TF 0 "nonimmediate_operand" "")
9409 (float_extend:TF (match_operand:DF 1 "input_operand" "")))]
9411 && TARGET_HARD_FLOAT
9412 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9413 && TARGET_LONG_DOUBLE_128"
9415 if (TARGET_E500_DOUBLE)
9416 emit_insn (gen_spe_extenddftf2 (operands[0], operands[1]));
9418 emit_insn (gen_extenddftf2_fprs (operands[0], operands[1]));
9422 (define_expand "extenddftf2_fprs"
9423 [(parallel [(set (match_operand:TF 0 "nonimmediate_operand" "")
9424 (float_extend:TF (match_operand:DF 1 "input_operand" "")))
9425 (use (match_dup 2))])]
9427 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9428 && TARGET_LONG_DOUBLE_128"
9430 operands[2] = CONST0_RTX (DFmode);
9431 /* Generate GOT reference early for SVR4 PIC. */
9432 if (DEFAULT_ABI == ABI_V4 && flag_pic)
9433 operands[2] = validize_mem (force_const_mem (DFmode, operands[2]));
9436 (define_insn_and_split "*extenddftf2_internal"
9437 [(set (match_operand:TF 0 "nonimmediate_operand" "=o,d,&d,r")
9438 (float_extend:TF (match_operand:DF 1 "input_operand" "dr,md,md,rmGHF")))
9439 (use (match_operand:DF 2 "zero_reg_mem_operand" "rd,m,d,n"))]
9441 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9442 && TARGET_LONG_DOUBLE_128"
9444 "&& reload_completed"
9447 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
9448 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
9449 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word),
9451 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word),
9456 (define_expand "extendsftf2"
9457 [(set (match_operand:TF 0 "nonimmediate_operand" "")
9458 (float_extend:TF (match_operand:SF 1 "gpc_reg_operand" "")))]
9460 && TARGET_HARD_FLOAT
9461 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9462 && TARGET_LONG_DOUBLE_128"
9464 rtx tmp = gen_reg_rtx (DFmode);
9465 emit_insn (gen_extendsfdf2 (tmp, operands[1]));
9466 emit_insn (gen_extenddftf2 (operands[0], tmp));
9470 (define_expand "trunctfdf2"
9471 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9472 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "")))]
9474 && TARGET_HARD_FLOAT
9475 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9476 && TARGET_LONG_DOUBLE_128"
9479 (define_insn_and_split "trunctfdf2_internal1"
9480 [(set (match_operand:DF 0 "gpc_reg_operand" "=d,?d")
9481 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "0,d")))]
9482 "!TARGET_IEEEQUAD && !TARGET_XL_COMPAT
9483 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9487 "&& reload_completed && REGNO (operands[0]) == REGNO (operands[1])"
9490 emit_note (NOTE_INSN_DELETED);
9493 [(set_attr "type" "fp")])
9495 (define_insn "trunctfdf2_internal2"
9496 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
9497 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "d")))]
9498 "!TARGET_IEEEQUAD && TARGET_XL_COMPAT
9499 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9500 && TARGET_LONG_DOUBLE_128"
9502 [(set_attr "type" "fp")
9503 (set_attr "fp_type" "fp_addsub_d")])
9505 (define_expand "trunctfsf2"
9506 [(set (match_operand:SF 0 "gpc_reg_operand" "")
9507 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "")))]
9509 && TARGET_HARD_FLOAT
9510 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9511 && TARGET_LONG_DOUBLE_128"
9513 if (TARGET_E500_DOUBLE)
9514 emit_insn (gen_spe_trunctfsf2 (operands[0], operands[1]));
9516 emit_insn (gen_trunctfsf2_fprs (operands[0], operands[1]));
9520 (define_insn_and_split "trunctfsf2_fprs"
9521 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
9522 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "d")))
9523 (clobber (match_scratch:DF 2 "=d"))]
9525 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
9526 && TARGET_LONG_DOUBLE_128"
9528 "&& reload_completed"
9530 (float_truncate:DF (match_dup 1)))
9532 (float_truncate:SF (match_dup 2)))]
9535 (define_expand "floatsitf2"
9536 [(set (match_operand:TF 0 "gpc_reg_operand" "")
9537 (float:TF (match_operand:SI 1 "gpc_reg_operand" "")))]
9539 && TARGET_HARD_FLOAT
9540 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9541 && TARGET_LONG_DOUBLE_128"
9543 rtx tmp = gen_reg_rtx (DFmode);
9544 expand_float (tmp, operands[1], false);
9545 emit_insn (gen_extenddftf2 (operands[0], tmp));
9549 ; fadd, but rounding towards zero.
9550 ; This is probably not the optimal code sequence.
9551 (define_insn "fix_trunc_helper"
9552 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
9553 (unspec:DF [(match_operand:TF 1 "gpc_reg_operand" "d")]
9554 UNSPEC_FIX_TRUNC_TF))
9555 (clobber (match_operand:DF 2 "gpc_reg_operand" "=&d"))]
9556 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
9557 "mffs %2\n\tmtfsb1 31\n\tmtfsb0 30\n\tfadd %0,%1,%L1\n\tmtfsf 1,%2"
9558 [(set_attr "type" "fp")
9559 (set_attr "length" "20")])
9561 (define_expand "fix_trunctfsi2"
9562 [(set (match_operand:SI 0 "gpc_reg_operand" "")
9563 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))]
9565 && (TARGET_POWER2 || TARGET_POWERPC)
9566 && TARGET_HARD_FLOAT
9567 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9568 && TARGET_LONG_DOUBLE_128"
9570 if (TARGET_E500_DOUBLE)
9571 emit_insn (gen_spe_fix_trunctfsi2 (operands[0], operands[1]));
9573 emit_insn (gen_fix_trunctfsi2_fprs (operands[0], operands[1]));
9577 (define_expand "fix_trunctfsi2_fprs"
9578 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
9579 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))
9580 (clobber (match_dup 2))
9581 (clobber (match_dup 3))
9582 (clobber (match_dup 4))
9583 (clobber (match_dup 5))])]
9585 && (TARGET_POWER2 || TARGET_POWERPC)
9586 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9588 operands[2] = gen_reg_rtx (DFmode);
9589 operands[3] = gen_reg_rtx (DFmode);
9590 operands[4] = gen_reg_rtx (DImode);
9591 operands[5] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
9594 (define_insn_and_split "*fix_trunctfsi2_internal"
9595 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9596 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "d")))
9597 (clobber (match_operand:DF 2 "gpc_reg_operand" "=d"))
9598 (clobber (match_operand:DF 3 "gpc_reg_operand" "=&d"))
9599 (clobber (match_operand:DI 4 "gpc_reg_operand" "=d"))
9600 (clobber (match_operand:DI 5 "offsettable_mem_operand" "=o"))]
9602 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9608 emit_insn (gen_fix_trunc_helper (operands[2], operands[1], operands[3]));
9610 gcc_assert (MEM_P (operands[5]));
9611 lowword = adjust_address (operands[5], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
9613 emit_insn (gen_fctiwz (operands[4], operands[2]));
9614 emit_move_insn (operands[5], operands[4]);
9615 emit_move_insn (operands[0], lowword);
9619 (define_expand "negtf2"
9620 [(set (match_operand:TF 0 "gpc_reg_operand" "")
9621 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "")))]
9623 && TARGET_HARD_FLOAT
9624 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9625 && TARGET_LONG_DOUBLE_128"
9628 (define_insn "negtf2_internal"
9629 [(set (match_operand:TF 0 "gpc_reg_operand" "=d")
9630 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "d")))]
9632 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9635 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
9636 return \"fneg %L0,%L1\;fneg %0,%1\";
9638 return \"fneg %0,%1\;fneg %L0,%L1\";
9640 [(set_attr "type" "fp")
9641 (set_attr "length" "8")])
9643 (define_expand "abstf2"
9644 [(set (match_operand:TF 0 "gpc_reg_operand" "")
9645 (abs:TF (match_operand:TF 1 "gpc_reg_operand" "")))]
9647 && TARGET_HARD_FLOAT
9648 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9649 && TARGET_LONG_DOUBLE_128"
9652 rtx label = gen_label_rtx ();
9653 if (TARGET_E500_DOUBLE)
9655 if (flag_finite_math_only && !flag_trapping_math)
9656 emit_insn (gen_spe_abstf2_tst (operands[0], operands[1], label));
9658 emit_insn (gen_spe_abstf2_cmp (operands[0], operands[1], label));
9661 emit_insn (gen_abstf2_internal (operands[0], operands[1], label));
9666 (define_expand "abstf2_internal"
9667 [(set (match_operand:TF 0 "gpc_reg_operand" "")
9668 (match_operand:TF 1 "gpc_reg_operand" ""))
9669 (set (match_dup 3) (match_dup 5))
9670 (set (match_dup 5) (abs:DF (match_dup 5)))
9671 (set (match_dup 4) (compare:CCFP (match_dup 3) (match_dup 5)))
9672 (set (pc) (if_then_else (eq (match_dup 4) (const_int 0))
9673 (label_ref (match_operand 2 "" ""))
9675 (set (match_dup 6) (neg:DF (match_dup 6)))]
9677 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9678 && TARGET_LONG_DOUBLE_128"
9681 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
9682 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
9683 operands[3] = gen_reg_rtx (DFmode);
9684 operands[4] = gen_reg_rtx (CCFPmode);
9685 operands[5] = simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word);
9686 operands[6] = simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word);
9689 ;; Next come the multi-word integer load and store and the load and store
9692 ; List r->r after r->"o<>", otherwise reload will try to reload a
9693 ; non-offsettable address by using r->r which won't make progress.
9694 (define_insn "*movdi_internal32"
9695 [(set (match_operand:DI 0 "rs6000_nonimmediate_operand" "=o<>,r,r,*d,*d,m,r")
9696 (match_operand:DI 1 "input_operand" "r,r,m,d,m,d,IJKnGHF"))]
9698 && (gpc_reg_operand (operands[0], DImode)
9699 || gpc_reg_operand (operands[1], DImode))"
9708 [(set_attr "type" "load,*,store,fp,fpload,fpstore,*")])
9711 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9712 (match_operand:DI 1 "const_int_operand" ""))]
9713 "! TARGET_POWERPC64 && reload_completed"
9714 [(set (match_dup 2) (match_dup 4))
9715 (set (match_dup 3) (match_dup 1))]
9718 HOST_WIDE_INT value = INTVAL (operands[1]);
9719 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
9721 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
9723 #if HOST_BITS_PER_WIDE_INT == 32
9724 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
9726 operands[4] = GEN_INT (value >> 32);
9727 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
9732 [(set (match_operand:DI 0 "rs6000_nonimmediate_operand" "")
9733 (match_operand:DI 1 "input_operand" ""))]
9734 "reload_completed && !TARGET_POWERPC64
9735 && gpr_or_gpr_p (operands[0], operands[1])"
9737 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
9739 (define_insn "*movdi_mfpgpr"
9740 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,*d,*d,m,r,*h,*h,r,*d")
9741 (match_operand:DI 1 "input_operand" "r,m,r,I,L,nF,R,d,m,d,*h,r,0,*d,r"))]
9742 "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
9743 && (gpc_reg_operand (operands[0], DImode)
9744 || gpc_reg_operand (operands[1], DImode))"
9761 [(set_attr "type" "*,load,store,*,*,*,*,fp,fpload,fpstore,mfjmpr,mtjmpr,*,mftgpr,mffgpr")
9762 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4,4,4")])
9764 (define_insn "*movdi_internal64"
9765 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,*d,*d,m,r,*h,*h")
9766 (match_operand:DI 1 "input_operand" "r,m,r,I,L,nF,R,d,m,d,*h,r,0"))]
9767 "TARGET_POWERPC64 && (!TARGET_MFPGPR || !TARGET_HARD_FLOAT || !TARGET_FPRS)
9768 && (gpc_reg_operand (operands[0], DImode)
9769 || gpc_reg_operand (operands[1], DImode))"
9784 [(set_attr "type" "*,load,store,*,*,*,*,fp,fpload,fpstore,mfjmpr,mtjmpr,*")
9785 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4")])
9787 ;; immediate value valid for a single instruction hiding in a const_double
9789 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9790 (match_operand:DI 1 "const_double_operand" "F"))]
9791 "HOST_BITS_PER_WIDE_INT == 32 && TARGET_POWERPC64
9792 && GET_CODE (operands[1]) == CONST_DOUBLE
9793 && num_insns_constant (operands[1], DImode) == 1"
9796 return ((unsigned HOST_WIDE_INT)
9797 (CONST_DOUBLE_LOW (operands[1]) + 0x8000) < 0x10000)
9798 ? \"li %0,%1\" : \"lis %0,%v1\";
9801 ;; Generate all one-bits and clear left or right.
9802 ;; Use (and:DI (rotate:DI ...)) to avoid anddi3 unnecessary clobber.
9804 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9805 (match_operand:DI 1 "mask64_operand" ""))]
9806 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
9807 [(set (match_dup 0) (const_int -1))
9809 (and:DI (rotate:DI (match_dup 0)
9814 ;; Split a load of a large constant into the appropriate five-instruction
9815 ;; sequence. Handle anything in a constant number of insns.
9816 ;; When non-easy constants can go in the TOC, this should use
9817 ;; easy_fp_constant predicate.
9819 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9820 (match_operand:DI 1 "const_int_operand" ""))]
9821 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
9822 [(set (match_dup 0) (match_dup 2))
9823 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
9825 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
9827 if (tem == operands[0])
9834 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9835 (match_operand:DI 1 "const_double_operand" ""))]
9836 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
9837 [(set (match_dup 0) (match_dup 2))
9838 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
9840 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
9842 if (tem == operands[0])
9848 ;; TImode is similar, except that we usually want to compute the address into
9849 ;; a register and use lsi/stsi (the exception is during reload). MQ is also
9850 ;; clobbered in stsi for POWER, so we need a SCRATCH for it.
9852 ;; We say that MQ is clobbered in the last alternative because the first
9853 ;; alternative would never get used otherwise since it would need a reload
9854 ;; while the 2nd alternative would not. We put memory cases first so they
9855 ;; are preferred. Otherwise, we'd try to reload the output instead of
9856 ;; giving the SCRATCH mq.
9858 (define_insn "*movti_power"
9859 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,m,????r,????r,????r,r")
9860 (match_operand:TI 1 "input_operand" "r,r,r,Q,m,n"))
9861 (clobber (match_scratch:SI 2 "=q,q#X,X,X,X,X"))]
9862 "TARGET_POWER && ! TARGET_POWERPC64
9863 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
9866 switch (which_alternative)
9873 return \"{stsi|stswi} %1,%P0,16\";
9878 /* If the address is not used in the output, we can use lsi. Otherwise,
9879 fall through to generating four loads. */
9881 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
9882 return \"{lsi|lswi} %0,%P1,16\";
9883 /* ... fall through ... */
9889 [(set_attr "type" "store,store,*,load,load,*")])
9891 (define_insn "*movti_string"
9892 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,o<>,????r,????r,????r,r")
9893 (match_operand:TI 1 "input_operand" "r,r,r,Q,m,n"))]
9894 "! TARGET_POWER && ! TARGET_POWERPC64
9895 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
9898 switch (which_alternative)
9904 return \"{stsi|stswi} %1,%P0,16\";
9909 /* If the address is not used in the output, we can use lsi. Otherwise,
9910 fall through to generating four loads. */
9912 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
9913 return \"{lsi|lswi} %0,%P1,16\";
9914 /* ... fall through ... */
9920 [(set_attr "type" "store_ux,store_ux,*,load_ux,load_ux,*")
9921 (set (attr "cell_micro") (if_then_else (eq (symbol_ref "TARGET_STRING") (const_int 1))
9922 (const_string "always")
9923 (const_string "conditional")))])
9925 (define_insn "*movti_ppc64"
9926 [(set (match_operand:TI 0 "nonimmediate_operand" "=r,o<>,r")
9927 (match_operand:TI 1 "input_operand" "r,r,m"))]
9928 "(TARGET_POWERPC64 && (gpc_reg_operand (operands[0], TImode)
9929 || gpc_reg_operand (operands[1], TImode)))
9930 && VECTOR_MEM_NONE_P (TImode)"
9932 [(set_attr "type" "*,store,load")])
9935 [(set (match_operand:TI 0 "gpc_reg_operand" "")
9936 (match_operand:TI 1 "const_double_operand" ""))]
9937 "TARGET_POWERPC64 && VECTOR_MEM_NONE_P (TImode)"
9938 [(set (match_dup 2) (match_dup 4))
9939 (set (match_dup 3) (match_dup 5))]
9942 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
9944 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
9946 if (GET_CODE (operands[1]) == CONST_DOUBLE)
9948 operands[4] = GEN_INT (CONST_DOUBLE_HIGH (operands[1]));
9949 operands[5] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
9951 else if (GET_CODE (operands[1]) == CONST_INT)
9953 operands[4] = GEN_INT (- (INTVAL (operands[1]) < 0));
9954 operands[5] = operands[1];
9961 [(set (match_operand:TI 0 "nonimmediate_operand" "")
9962 (match_operand:TI 1 "input_operand" ""))]
9963 "reload_completed && VECTOR_MEM_NONE_P (TImode)
9964 && gpr_or_gpr_p (operands[0], operands[1])"
9966 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
9968 (define_expand "load_multiple"
9969 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
9970 (match_operand:SI 1 "" ""))
9971 (use (match_operand:SI 2 "" ""))])]
9972 "TARGET_STRING && !TARGET_POWERPC64"
9980 /* Support only loading a constant number of fixed-point registers from
9981 memory and only bother with this if more than two; the machine
9982 doesn't support more than eight. */
9983 if (GET_CODE (operands[2]) != CONST_INT
9984 || INTVAL (operands[2]) <= 2
9985 || INTVAL (operands[2]) > 8
9986 || GET_CODE (operands[1]) != MEM
9987 || GET_CODE (operands[0]) != REG
9988 || REGNO (operands[0]) >= 32)
9991 count = INTVAL (operands[2]);
9992 regno = REGNO (operands[0]);
9994 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
9995 op1 = replace_equiv_address (operands[1],
9996 force_reg (SImode, XEXP (operands[1], 0)));
9998 for (i = 0; i < count; i++)
9999 XVECEXP (operands[3], 0, i)
10000 = gen_rtx_SET (VOIDmode, gen_rtx_REG (SImode, regno + i),
10001 adjust_address_nv (op1, SImode, i * 4));
10004 (define_insn "*ldmsi8"
10005 [(match_parallel 0 "load_multiple_operation"
10006 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10007 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10008 (set (match_operand:SI 3 "gpc_reg_operand" "")
10009 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10010 (set (match_operand:SI 4 "gpc_reg_operand" "")
10011 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
10012 (set (match_operand:SI 5 "gpc_reg_operand" "")
10013 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
10014 (set (match_operand:SI 6 "gpc_reg_operand" "")
10015 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
10016 (set (match_operand:SI 7 "gpc_reg_operand" "")
10017 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
10018 (set (match_operand:SI 8 "gpc_reg_operand" "")
10019 (mem:SI (plus:SI (match_dup 1) (const_int 24))))
10020 (set (match_operand:SI 9 "gpc_reg_operand" "")
10021 (mem:SI (plus:SI (match_dup 1) (const_int 28))))])]
10022 "TARGET_STRING && XVECLEN (operands[0], 0) == 8"
10024 { return rs6000_output_load_multiple (operands); }"
10025 [(set_attr "type" "load_ux")
10026 (set_attr "length" "32")])
10028 (define_insn "*ldmsi7"
10029 [(match_parallel 0 "load_multiple_operation"
10030 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10031 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10032 (set (match_operand:SI 3 "gpc_reg_operand" "")
10033 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10034 (set (match_operand:SI 4 "gpc_reg_operand" "")
10035 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
10036 (set (match_operand:SI 5 "gpc_reg_operand" "")
10037 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
10038 (set (match_operand:SI 6 "gpc_reg_operand" "")
10039 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
10040 (set (match_operand:SI 7 "gpc_reg_operand" "")
10041 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
10042 (set (match_operand:SI 8 "gpc_reg_operand" "")
10043 (mem:SI (plus:SI (match_dup 1) (const_int 24))))])]
10044 "TARGET_STRING && XVECLEN (operands[0], 0) == 7"
10046 { return rs6000_output_load_multiple (operands); }"
10047 [(set_attr "type" "load_ux")
10048 (set_attr "length" "32")])
10050 (define_insn "*ldmsi6"
10051 [(match_parallel 0 "load_multiple_operation"
10052 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10053 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10054 (set (match_operand:SI 3 "gpc_reg_operand" "")
10055 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10056 (set (match_operand:SI 4 "gpc_reg_operand" "")
10057 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
10058 (set (match_operand:SI 5 "gpc_reg_operand" "")
10059 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
10060 (set (match_operand:SI 6 "gpc_reg_operand" "")
10061 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
10062 (set (match_operand:SI 7 "gpc_reg_operand" "")
10063 (mem:SI (plus:SI (match_dup 1) (const_int 20))))])]
10064 "TARGET_STRING && XVECLEN (operands[0], 0) == 6"
10066 { return rs6000_output_load_multiple (operands); }"
10067 [(set_attr "type" "load_ux")
10068 (set_attr "length" "32")])
10070 (define_insn "*ldmsi5"
10071 [(match_parallel 0 "load_multiple_operation"
10072 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10073 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10074 (set (match_operand:SI 3 "gpc_reg_operand" "")
10075 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10076 (set (match_operand:SI 4 "gpc_reg_operand" "")
10077 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
10078 (set (match_operand:SI 5 "gpc_reg_operand" "")
10079 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
10080 (set (match_operand:SI 6 "gpc_reg_operand" "")
10081 (mem:SI (plus:SI (match_dup 1) (const_int 16))))])]
10082 "TARGET_STRING && XVECLEN (operands[0], 0) == 5"
10084 { return rs6000_output_load_multiple (operands); }"
10085 [(set_attr "type" "load_ux")
10086 (set_attr "length" "32")])
10088 (define_insn "*ldmsi4"
10089 [(match_parallel 0 "load_multiple_operation"
10090 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10091 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10092 (set (match_operand:SI 3 "gpc_reg_operand" "")
10093 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10094 (set (match_operand:SI 4 "gpc_reg_operand" "")
10095 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
10096 (set (match_operand:SI 5 "gpc_reg_operand" "")
10097 (mem:SI (plus:SI (match_dup 1) (const_int 12))))])]
10098 "TARGET_STRING && XVECLEN (operands[0], 0) == 4"
10100 { return rs6000_output_load_multiple (operands); }"
10101 [(set_attr "type" "load_ux")
10102 (set_attr "length" "32")])
10104 (define_insn "*ldmsi3"
10105 [(match_parallel 0 "load_multiple_operation"
10106 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10107 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10108 (set (match_operand:SI 3 "gpc_reg_operand" "")
10109 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10110 (set (match_operand:SI 4 "gpc_reg_operand" "")
10111 (mem:SI (plus:SI (match_dup 1) (const_int 8))))])]
10112 "TARGET_STRING && XVECLEN (operands[0], 0) == 3"
10114 { return rs6000_output_load_multiple (operands); }"
10115 [(set_attr "type" "load_ux")
10116 (set_attr "length" "32")])
10118 (define_expand "store_multiple"
10119 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
10120 (match_operand:SI 1 "" ""))
10121 (clobber (scratch:SI))
10122 (use (match_operand:SI 2 "" ""))])]
10123 "TARGET_STRING && !TARGET_POWERPC64"
10132 /* Support only storing a constant number of fixed-point registers to
10133 memory and only bother with this if more than two; the machine
10134 doesn't support more than eight. */
10135 if (GET_CODE (operands[2]) != CONST_INT
10136 || INTVAL (operands[2]) <= 2
10137 || INTVAL (operands[2]) > 8
10138 || GET_CODE (operands[0]) != MEM
10139 || GET_CODE (operands[1]) != REG
10140 || REGNO (operands[1]) >= 32)
10143 count = INTVAL (operands[2]);
10144 regno = REGNO (operands[1]);
10146 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count + 1));
10147 to = force_reg (SImode, XEXP (operands[0], 0));
10148 op0 = replace_equiv_address (operands[0], to);
10150 XVECEXP (operands[3], 0, 0)
10151 = gen_rtx_SET (VOIDmode, adjust_address_nv (op0, SImode, 0), operands[1]);
10152 XVECEXP (operands[3], 0, 1) = gen_rtx_CLOBBER (VOIDmode,
10153 gen_rtx_SCRATCH (SImode));
10155 for (i = 1; i < count; i++)
10156 XVECEXP (operands[3], 0, i + 1)
10157 = gen_rtx_SET (VOIDmode,
10158 adjust_address_nv (op0, SImode, i * 4),
10159 gen_rtx_REG (SImode, regno + i));
10162 (define_insn "*stmsi8"
10163 [(match_parallel 0 "store_multiple_operation"
10164 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10165 (match_operand:SI 2 "gpc_reg_operand" "r"))
10166 (clobber (match_scratch:SI 3 "=X"))
10167 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10168 (match_operand:SI 4 "gpc_reg_operand" "r"))
10169 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10170 (match_operand:SI 5 "gpc_reg_operand" "r"))
10171 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10172 (match_operand:SI 6 "gpc_reg_operand" "r"))
10173 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10174 (match_operand:SI 7 "gpc_reg_operand" "r"))
10175 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10176 (match_operand:SI 8 "gpc_reg_operand" "r"))
10177 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
10178 (match_operand:SI 9 "gpc_reg_operand" "r"))
10179 (set (mem:SI (plus:SI (match_dup 1) (const_int 28)))
10180 (match_operand:SI 10 "gpc_reg_operand" "r"))])]
10181 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 9"
10182 "{stsi|stswi} %2,%1,%O0"
10183 [(set_attr "type" "store_ux")
10184 (set_attr "cell_micro" "always")])
10186 (define_insn "*stmsi7"
10187 [(match_parallel 0 "store_multiple_operation"
10188 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10189 (match_operand:SI 2 "gpc_reg_operand" "r"))
10190 (clobber (match_scratch:SI 3 "=X"))
10191 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10192 (match_operand:SI 4 "gpc_reg_operand" "r"))
10193 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10194 (match_operand:SI 5 "gpc_reg_operand" "r"))
10195 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10196 (match_operand:SI 6 "gpc_reg_operand" "r"))
10197 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10198 (match_operand:SI 7 "gpc_reg_operand" "r"))
10199 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10200 (match_operand:SI 8 "gpc_reg_operand" "r"))
10201 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
10202 (match_operand:SI 9 "gpc_reg_operand" "r"))])]
10203 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 8"
10204 "{stsi|stswi} %2,%1,%O0"
10205 [(set_attr "type" "store_ux")
10206 (set_attr "cell_micro" "always")])
10208 (define_insn "*stmsi6"
10209 [(match_parallel 0 "store_multiple_operation"
10210 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10211 (match_operand:SI 2 "gpc_reg_operand" "r"))
10212 (clobber (match_scratch:SI 3 "=X"))
10213 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10214 (match_operand:SI 4 "gpc_reg_operand" "r"))
10215 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10216 (match_operand:SI 5 "gpc_reg_operand" "r"))
10217 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10218 (match_operand:SI 6 "gpc_reg_operand" "r"))
10219 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10220 (match_operand:SI 7 "gpc_reg_operand" "r"))
10221 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10222 (match_operand:SI 8 "gpc_reg_operand" "r"))])]
10223 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 7"
10224 "{stsi|stswi} %2,%1,%O0"
10225 [(set_attr "type" "store_ux")
10226 (set_attr "cell_micro" "always")])
10228 (define_insn "*stmsi5"
10229 [(match_parallel 0 "store_multiple_operation"
10230 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10231 (match_operand:SI 2 "gpc_reg_operand" "r"))
10232 (clobber (match_scratch:SI 3 "=X"))
10233 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10234 (match_operand:SI 4 "gpc_reg_operand" "r"))
10235 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10236 (match_operand:SI 5 "gpc_reg_operand" "r"))
10237 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10238 (match_operand:SI 6 "gpc_reg_operand" "r"))
10239 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10240 (match_operand:SI 7 "gpc_reg_operand" "r"))])]
10241 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 6"
10242 "{stsi|stswi} %2,%1,%O0"
10243 [(set_attr "type" "store_ux")
10244 (set_attr "cell_micro" "always")])
10246 (define_insn "*stmsi4"
10247 [(match_parallel 0 "store_multiple_operation"
10248 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10249 (match_operand:SI 2 "gpc_reg_operand" "r"))
10250 (clobber (match_scratch:SI 3 "=X"))
10251 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10252 (match_operand:SI 4 "gpc_reg_operand" "r"))
10253 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10254 (match_operand:SI 5 "gpc_reg_operand" "r"))
10255 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10256 (match_operand:SI 6 "gpc_reg_operand" "r"))])]
10257 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 5"
10258 "{stsi|stswi} %2,%1,%O0"
10259 [(set_attr "type" "store_ux")
10260 (set_attr "cell_micro" "always")])
10262 (define_insn "*stmsi3"
10263 [(match_parallel 0 "store_multiple_operation"
10264 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10265 (match_operand:SI 2 "gpc_reg_operand" "r"))
10266 (clobber (match_scratch:SI 3 "=X"))
10267 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10268 (match_operand:SI 4 "gpc_reg_operand" "r"))
10269 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10270 (match_operand:SI 5 "gpc_reg_operand" "r"))])]
10271 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 4"
10272 "{stsi|stswi} %2,%1,%O0"
10273 [(set_attr "type" "store_ux")
10274 (set_attr "cell_micro" "always")])
10276 (define_insn "*stmsi8_power"
10277 [(match_parallel 0 "store_multiple_operation"
10278 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10279 (match_operand:SI 2 "gpc_reg_operand" "r"))
10280 (clobber (match_scratch:SI 3 "=q"))
10281 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10282 (match_operand:SI 4 "gpc_reg_operand" "r"))
10283 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10284 (match_operand:SI 5 "gpc_reg_operand" "r"))
10285 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10286 (match_operand:SI 6 "gpc_reg_operand" "r"))
10287 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10288 (match_operand:SI 7 "gpc_reg_operand" "r"))
10289 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10290 (match_operand:SI 8 "gpc_reg_operand" "r"))
10291 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
10292 (match_operand:SI 9 "gpc_reg_operand" "r"))
10293 (set (mem:SI (plus:SI (match_dup 1) (const_int 28)))
10294 (match_operand:SI 10 "gpc_reg_operand" "r"))])]
10295 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 9"
10296 "{stsi|stswi} %2,%1,%O0"
10297 [(set_attr "type" "store_ux")
10298 (set_attr "cell_micro" "always")])
10300 (define_insn "*stmsi7_power"
10301 [(match_parallel 0 "store_multiple_operation"
10302 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10303 (match_operand:SI 2 "gpc_reg_operand" "r"))
10304 (clobber (match_scratch:SI 3 "=q"))
10305 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10306 (match_operand:SI 4 "gpc_reg_operand" "r"))
10307 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10308 (match_operand:SI 5 "gpc_reg_operand" "r"))
10309 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10310 (match_operand:SI 6 "gpc_reg_operand" "r"))
10311 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10312 (match_operand:SI 7 "gpc_reg_operand" "r"))
10313 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10314 (match_operand:SI 8 "gpc_reg_operand" "r"))
10315 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
10316 (match_operand:SI 9 "gpc_reg_operand" "r"))])]
10317 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 8"
10318 "{stsi|stswi} %2,%1,%O0"
10319 [(set_attr "type" "store_ux")
10320 (set_attr "cell_micro" "always")])
10322 (define_insn "*stmsi6_power"
10323 [(match_parallel 0 "store_multiple_operation"
10324 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10325 (match_operand:SI 2 "gpc_reg_operand" "r"))
10326 (clobber (match_scratch:SI 3 "=q"))
10327 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10328 (match_operand:SI 4 "gpc_reg_operand" "r"))
10329 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10330 (match_operand:SI 5 "gpc_reg_operand" "r"))
10331 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10332 (match_operand:SI 6 "gpc_reg_operand" "r"))
10333 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10334 (match_operand:SI 7 "gpc_reg_operand" "r"))
10335 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10336 (match_operand:SI 8 "gpc_reg_operand" "r"))])]
10337 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 7"
10338 "{stsi|stswi} %2,%1,%O0"
10339 [(set_attr "type" "store_ux")
10340 (set_attr "cell_micro" "always")])
10342 (define_insn "*stmsi5_power"
10343 [(match_parallel 0 "store_multiple_operation"
10344 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10345 (match_operand:SI 2 "gpc_reg_operand" "r"))
10346 (clobber (match_scratch:SI 3 "=q"))
10347 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10348 (match_operand:SI 4 "gpc_reg_operand" "r"))
10349 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10350 (match_operand:SI 5 "gpc_reg_operand" "r"))
10351 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10352 (match_operand:SI 6 "gpc_reg_operand" "r"))
10353 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10354 (match_operand:SI 7 "gpc_reg_operand" "r"))])]
10355 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 6"
10356 "{stsi|stswi} %2,%1,%O0"
10357 [(set_attr "type" "store_ux")
10358 (set_attr "cell_micro" "always")])
10360 (define_insn "*stmsi4_power"
10361 [(match_parallel 0 "store_multiple_operation"
10362 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10363 (match_operand:SI 2 "gpc_reg_operand" "r"))
10364 (clobber (match_scratch:SI 3 "=q"))
10365 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10366 (match_operand:SI 4 "gpc_reg_operand" "r"))
10367 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10368 (match_operand:SI 5 "gpc_reg_operand" "r"))
10369 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10370 (match_operand:SI 6 "gpc_reg_operand" "r"))])]
10371 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 5"
10372 "{stsi|stswi} %2,%1,%O0"
10373 [(set_attr "type" "store_ux")
10374 (set_attr "cell_micro" "always")])
10376 (define_insn "*stmsi3_power"
10377 [(match_parallel 0 "store_multiple_operation"
10378 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10379 (match_operand:SI 2 "gpc_reg_operand" "r"))
10380 (clobber (match_scratch:SI 3 "=q"))
10381 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10382 (match_operand:SI 4 "gpc_reg_operand" "r"))
10383 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10384 (match_operand:SI 5 "gpc_reg_operand" "r"))])]
10385 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 4"
10386 "{stsi|stswi} %2,%1,%O0"
10387 [(set_attr "type" "store_ux")
10388 (set_attr "cell_micro" "always")])
10390 (define_expand "setmemsi"
10391 [(parallel [(set (match_operand:BLK 0 "" "")
10392 (match_operand 2 "const_int_operand" ""))
10393 (use (match_operand:SI 1 "" ""))
10394 (use (match_operand:SI 3 "" ""))])]
10398 /* If value to set is not zero, use the library routine. */
10399 if (operands[2] != const0_rtx)
10402 if (expand_block_clear (operands))
10408 ;; String/block move insn.
10409 ;; Argument 0 is the destination
10410 ;; Argument 1 is the source
10411 ;; Argument 2 is the length
10412 ;; Argument 3 is the alignment
10414 (define_expand "movmemsi"
10415 [(parallel [(set (match_operand:BLK 0 "" "")
10416 (match_operand:BLK 1 "" ""))
10417 (use (match_operand:SI 2 "" ""))
10418 (use (match_operand:SI 3 "" ""))])]
10422 if (expand_block_move (operands))
10428 ;; Move up to 32 bytes at a time. The fixed registers are needed because the
10429 ;; register allocator doesn't have a clue about allocating 8 word registers.
10430 ;; rD/rS = r5 is preferred, efficient form.
10431 (define_expand "movmemsi_8reg"
10432 [(parallel [(set (match_operand 0 "" "")
10433 (match_operand 1 "" ""))
10434 (use (match_operand 2 "" ""))
10435 (use (match_operand 3 "" ""))
10436 (clobber (reg:SI 5))
10437 (clobber (reg:SI 6))
10438 (clobber (reg:SI 7))
10439 (clobber (reg:SI 8))
10440 (clobber (reg:SI 9))
10441 (clobber (reg:SI 10))
10442 (clobber (reg:SI 11))
10443 (clobber (reg:SI 12))
10444 (clobber (match_scratch:SI 4 ""))])]
10449 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
10450 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
10451 (use (match_operand:SI 2 "immediate_operand" "i"))
10452 (use (match_operand:SI 3 "immediate_operand" "i"))
10453 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10454 (clobber (reg:SI 6))
10455 (clobber (reg:SI 7))
10456 (clobber (reg:SI 8))
10457 (clobber (reg:SI 9))
10458 (clobber (reg:SI 10))
10459 (clobber (reg:SI 11))
10460 (clobber (reg:SI 12))
10461 (clobber (match_scratch:SI 5 "=q"))]
10462 "TARGET_STRING && TARGET_POWER
10463 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
10464 || INTVAL (operands[2]) == 0)
10465 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
10466 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
10467 && REGNO (operands[4]) == 5"
10468 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10469 [(set_attr "type" "store_ux")
10470 (set_attr "cell_micro" "always")
10471 (set_attr "length" "8")])
10474 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
10475 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
10476 (use (match_operand:SI 2 "immediate_operand" "i"))
10477 (use (match_operand:SI 3 "immediate_operand" "i"))
10478 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10479 (clobber (reg:SI 6))
10480 (clobber (reg:SI 7))
10481 (clobber (reg:SI 8))
10482 (clobber (reg:SI 9))
10483 (clobber (reg:SI 10))
10484 (clobber (reg:SI 11))
10485 (clobber (reg:SI 12))
10486 (clobber (match_scratch:SI 5 "=X"))]
10487 "TARGET_STRING && ! TARGET_POWER
10488 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
10489 || INTVAL (operands[2]) == 0)
10490 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
10491 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
10492 && REGNO (operands[4]) == 5"
10493 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10494 [(set_attr "type" "store_ux")
10495 (set_attr "cell_micro" "always")
10496 (set_attr "length" "8")])
10498 ;; Move up to 24 bytes at a time. The fixed registers are needed because the
10499 ;; register allocator doesn't have a clue about allocating 6 word registers.
10500 ;; rD/rS = r5 is preferred, efficient form.
10501 (define_expand "movmemsi_6reg"
10502 [(parallel [(set (match_operand 0 "" "")
10503 (match_operand 1 "" ""))
10504 (use (match_operand 2 "" ""))
10505 (use (match_operand 3 "" ""))
10506 (clobber (reg:SI 5))
10507 (clobber (reg:SI 6))
10508 (clobber (reg:SI 7))
10509 (clobber (reg:SI 8))
10510 (clobber (reg:SI 9))
10511 (clobber (reg:SI 10))
10512 (clobber (match_scratch:SI 4 ""))])]
10517 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
10518 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
10519 (use (match_operand:SI 2 "immediate_operand" "i"))
10520 (use (match_operand:SI 3 "immediate_operand" "i"))
10521 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10522 (clobber (reg:SI 6))
10523 (clobber (reg:SI 7))
10524 (clobber (reg:SI 8))
10525 (clobber (reg:SI 9))
10526 (clobber (reg:SI 10))
10527 (clobber (match_scratch:SI 5 "=q"))]
10528 "TARGET_STRING && TARGET_POWER
10529 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 24
10530 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
10531 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
10532 && REGNO (operands[4]) == 5"
10533 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10534 [(set_attr "type" "store_ux")
10535 (set_attr "cell_micro" "always")
10536 (set_attr "length" "8")])
10539 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
10540 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
10541 (use (match_operand:SI 2 "immediate_operand" "i"))
10542 (use (match_operand:SI 3 "immediate_operand" "i"))
10543 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10544 (clobber (reg:SI 6))
10545 (clobber (reg:SI 7))
10546 (clobber (reg:SI 8))
10547 (clobber (reg:SI 9))
10548 (clobber (reg:SI 10))
10549 (clobber (match_scratch:SI 5 "=X"))]
10550 "TARGET_STRING && ! TARGET_POWER
10551 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
10552 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
10553 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
10554 && REGNO (operands[4]) == 5"
10555 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10556 [(set_attr "type" "store_ux")
10557 (set_attr "cell_micro" "always")
10558 (set_attr "length" "8")])
10560 ;; Move up to 16 bytes at a time, using 4 fixed registers to avoid spill
10561 ;; problems with TImode.
10562 ;; rD/rS = r5 is preferred, efficient form.
10563 (define_expand "movmemsi_4reg"
10564 [(parallel [(set (match_operand 0 "" "")
10565 (match_operand 1 "" ""))
10566 (use (match_operand 2 "" ""))
10567 (use (match_operand 3 "" ""))
10568 (clobber (reg:SI 5))
10569 (clobber (reg:SI 6))
10570 (clobber (reg:SI 7))
10571 (clobber (reg:SI 8))
10572 (clobber (match_scratch:SI 4 ""))])]
10577 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
10578 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
10579 (use (match_operand:SI 2 "immediate_operand" "i"))
10580 (use (match_operand:SI 3 "immediate_operand" "i"))
10581 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10582 (clobber (reg:SI 6))
10583 (clobber (reg:SI 7))
10584 (clobber (reg:SI 8))
10585 (clobber (match_scratch:SI 5 "=q"))]
10586 "TARGET_STRING && TARGET_POWER
10587 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
10588 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
10589 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
10590 && REGNO (operands[4]) == 5"
10591 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10592 [(set_attr "type" "store_ux")
10593 (set_attr "cell_micro" "always")
10594 (set_attr "length" "8")])
10597 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
10598 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
10599 (use (match_operand:SI 2 "immediate_operand" "i"))
10600 (use (match_operand:SI 3 "immediate_operand" "i"))
10601 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10602 (clobber (reg:SI 6))
10603 (clobber (reg:SI 7))
10604 (clobber (reg:SI 8))
10605 (clobber (match_scratch:SI 5 "=X"))]
10606 "TARGET_STRING && ! TARGET_POWER
10607 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
10608 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
10609 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
10610 && REGNO (operands[4]) == 5"
10611 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10612 [(set_attr "type" "store_ux")
10613 (set_attr "cell_micro" "always")
10614 (set_attr "length" "8")])
10616 ;; Move up to 8 bytes at a time.
10617 (define_expand "movmemsi_2reg"
10618 [(parallel [(set (match_operand 0 "" "")
10619 (match_operand 1 "" ""))
10620 (use (match_operand 2 "" ""))
10621 (use (match_operand 3 "" ""))
10622 (clobber (match_scratch:DI 4 ""))
10623 (clobber (match_scratch:SI 5 ""))])]
10624 "TARGET_STRING && ! TARGET_POWERPC64"
10628 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
10629 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
10630 (use (match_operand:SI 2 "immediate_operand" "i"))
10631 (use (match_operand:SI 3 "immediate_operand" "i"))
10632 (clobber (match_scratch:DI 4 "=&r"))
10633 (clobber (match_scratch:SI 5 "=q"))]
10634 "TARGET_STRING && TARGET_POWER && ! TARGET_POWERPC64
10635 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
10636 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10637 [(set_attr "type" "store_ux")
10638 (set_attr "cell_micro" "always")
10639 (set_attr "length" "8")])
10642 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
10643 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
10644 (use (match_operand:SI 2 "immediate_operand" "i"))
10645 (use (match_operand:SI 3 "immediate_operand" "i"))
10646 (clobber (match_scratch:DI 4 "=&r"))
10647 (clobber (match_scratch:SI 5 "=X"))]
10648 "TARGET_STRING && ! TARGET_POWER && ! TARGET_POWERPC64
10649 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
10650 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10651 [(set_attr "type" "store_ux")
10652 (set_attr "cell_micro" "always")
10653 (set_attr "length" "8")])
10655 ;; Move up to 4 bytes at a time.
10656 (define_expand "movmemsi_1reg"
10657 [(parallel [(set (match_operand 0 "" "")
10658 (match_operand 1 "" ""))
10659 (use (match_operand 2 "" ""))
10660 (use (match_operand 3 "" ""))
10661 (clobber (match_scratch:SI 4 ""))
10662 (clobber (match_scratch:SI 5 ""))])]
10667 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
10668 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
10669 (use (match_operand:SI 2 "immediate_operand" "i"))
10670 (use (match_operand:SI 3 "immediate_operand" "i"))
10671 (clobber (match_scratch:SI 4 "=&r"))
10672 (clobber (match_scratch:SI 5 "=q"))]
10673 "TARGET_STRING && TARGET_POWER
10674 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
10675 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10676 [(set_attr "type" "store_ux")
10677 (set_attr "cell_micro" "always")
10678 (set_attr "length" "8")])
10681 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
10682 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
10683 (use (match_operand:SI 2 "immediate_operand" "i"))
10684 (use (match_operand:SI 3 "immediate_operand" "i"))
10685 (clobber (match_scratch:SI 4 "=&r"))
10686 (clobber (match_scratch:SI 5 "=X"))]
10687 "TARGET_STRING && ! TARGET_POWER
10688 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
10689 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10690 [(set_attr "type" "store_ux")
10691 (set_attr "cell_micro" "always")
10692 (set_attr "length" "8")])
10694 ;; Define insns that do load or store with update. Some of these we can
10695 ;; get by using pre-decrement or pre-increment, but the hardware can also
10696 ;; do cases where the increment is not the size of the object.
10698 ;; In all these cases, we use operands 0 and 1 for the register being
10699 ;; incremented because those are the operands that local-alloc will
10700 ;; tie and these are the pair most likely to be tieable (and the ones
10701 ;; that will benefit the most).
10703 (define_insn "*movdi_update1"
10704 [(set (match_operand:DI 3 "gpc_reg_operand" "=r,r")
10705 (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
10706 (match_operand:DI 2 "reg_or_aligned_short_operand" "r,I"))))
10707 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
10708 (plus:DI (match_dup 1) (match_dup 2)))]
10709 "TARGET_POWERPC64 && TARGET_UPDATE
10710 && (!avoiding_indexed_address_p (DImode)
10711 || !gpc_reg_operand (operands[2], DImode))"
10715 [(set_attr "type" "load_ux,load_u")])
10717 (define_insn "movdi_<mode>_update"
10718 [(set (mem:DI (plus:P (match_operand:P 1 "gpc_reg_operand" "0,0")
10719 (match_operand:P 2 "reg_or_aligned_short_operand" "r,I")))
10720 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
10721 (set (match_operand:P 0 "gpc_reg_operand" "=b,b")
10722 (plus:P (match_dup 1) (match_dup 2)))]
10723 "TARGET_POWERPC64 && TARGET_UPDATE
10724 && (!avoiding_indexed_address_p (Pmode)
10725 || !gpc_reg_operand (operands[2], Pmode)
10726 || (REG_P (operands[0])
10727 && REGNO (operands[0]) == STACK_POINTER_REGNUM))"
10731 [(set_attr "type" "store_ux,store_u")])
10733 ;; This pattern is only conditional on TARGET_POWERPC64, as it is
10734 ;; needed for stack allocation, even if the user passes -mno-update.
10735 (define_insn "movdi_<mode>_update_stack"
10736 [(set (mem:DI (plus:P (match_operand:P 1 "gpc_reg_operand" "0,0")
10737 (match_operand:P 2 "reg_or_aligned_short_operand" "r,I")))
10738 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
10739 (set (match_operand:P 0 "gpc_reg_operand" "=b,b")
10740 (plus:P (match_dup 1) (match_dup 2)))]
10745 [(set_attr "type" "store_ux,store_u")])
10747 (define_insn "*movsi_update1"
10748 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
10749 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10750 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10751 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10752 (plus:SI (match_dup 1) (match_dup 2)))]
10754 && (!avoiding_indexed_address_p (SImode)
10755 || !gpc_reg_operand (operands[2], SImode))"
10757 {lux|lwzux} %3,%0,%2
10758 {lu|lwzu} %3,%2(%0)"
10759 [(set_attr "type" "load_ux,load_u")])
10761 (define_insn "*movsi_update2"
10762 [(set (match_operand:DI 3 "gpc_reg_operand" "=r")
10764 (mem:SI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0")
10765 (match_operand:DI 2 "gpc_reg_operand" "r")))))
10766 (set (match_operand:DI 0 "gpc_reg_operand" "=b")
10767 (plus:DI (match_dup 1) (match_dup 2)))]
10768 "TARGET_POWERPC64 && rs6000_gen_cell_microcode
10769 && !avoiding_indexed_address_p (DImode)"
10771 [(set_attr "type" "load_ext_ux")])
10773 (define_insn "movsi_update"
10774 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10775 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10776 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
10777 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10778 (plus:SI (match_dup 1) (match_dup 2)))]
10780 && (!avoiding_indexed_address_p (SImode)
10781 || !gpc_reg_operand (operands[2], SImode)
10782 || (REG_P (operands[0])
10783 && REGNO (operands[0]) == STACK_POINTER_REGNUM))"
10785 {stux|stwux} %3,%0,%2
10786 {stu|stwu} %3,%2(%0)"
10787 [(set_attr "type" "store_ux,store_u")])
10789 ;; This is an unconditional pattern; needed for stack allocation, even
10790 ;; if the user passes -mno-update.
10791 (define_insn "movsi_update_stack"
10792 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10793 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10794 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
10795 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10796 (plus:SI (match_dup 1) (match_dup 2)))]
10799 {stux|stwux} %3,%0,%2
10800 {stu|stwu} %3,%2(%0)"
10801 [(set_attr "type" "store_ux,store_u")])
10803 (define_insn "*movhi_update1"
10804 [(set (match_operand:HI 3 "gpc_reg_operand" "=r,r")
10805 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10806 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10807 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10808 (plus:SI (match_dup 1) (match_dup 2)))]
10810 && (!avoiding_indexed_address_p (SImode)
10811 || !gpc_reg_operand (operands[2], SImode))"
10815 [(set_attr "type" "load_ux,load_u")])
10817 (define_insn "*movhi_update2"
10818 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
10820 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10821 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
10822 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10823 (plus:SI (match_dup 1) (match_dup 2)))]
10825 && (!avoiding_indexed_address_p (SImode)
10826 || !gpc_reg_operand (operands[2], SImode))"
10830 [(set_attr "type" "load_ux,load_u")])
10832 (define_insn "*movhi_update3"
10833 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
10835 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10836 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
10837 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10838 (plus:SI (match_dup 1) (match_dup 2)))]
10839 "TARGET_UPDATE && rs6000_gen_cell_microcode
10840 && (!avoiding_indexed_address_p (SImode)
10841 || !gpc_reg_operand (operands[2], SImode))"
10845 [(set_attr "type" "load_ext_ux,load_ext_u")])
10847 (define_insn "*movhi_update4"
10848 [(set (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10849 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10850 (match_operand:HI 3 "gpc_reg_operand" "r,r"))
10851 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10852 (plus:SI (match_dup 1) (match_dup 2)))]
10854 && (!avoiding_indexed_address_p (SImode)
10855 || !gpc_reg_operand (operands[2], SImode))"
10859 [(set_attr "type" "store_ux,store_u")])
10861 (define_insn "*movqi_update1"
10862 [(set (match_operand:QI 3 "gpc_reg_operand" "=r,r")
10863 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10864 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10865 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10866 (plus:SI (match_dup 1) (match_dup 2)))]
10868 && (!avoiding_indexed_address_p (SImode)
10869 || !gpc_reg_operand (operands[2], SImode))"
10873 [(set_attr "type" "load_ux,load_u")])
10875 (define_insn "*movqi_update2"
10876 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
10878 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10879 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
10880 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10881 (plus:SI (match_dup 1) (match_dup 2)))]
10883 && (!avoiding_indexed_address_p (SImode)
10884 || !gpc_reg_operand (operands[2], SImode))"
10888 [(set_attr "type" "load_ux,load_u")])
10890 (define_insn "*movqi_update3"
10891 [(set (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10892 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10893 (match_operand:QI 3 "gpc_reg_operand" "r,r"))
10894 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10895 (plus:SI (match_dup 1) (match_dup 2)))]
10897 && (!avoiding_indexed_address_p (SImode)
10898 || !gpc_reg_operand (operands[2], SImode))"
10902 [(set_attr "type" "store_ux,store_u")])
10904 (define_insn "*movsf_update1"
10905 [(set (match_operand:SF 3 "gpc_reg_operand" "=f,f")
10906 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10907 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10908 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10909 (plus:SI (match_dup 1) (match_dup 2)))]
10910 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT && TARGET_UPDATE
10911 && (!avoiding_indexed_address_p (SImode)
10912 || !gpc_reg_operand (operands[2], SImode))"
10916 [(set_attr "type" "fpload_ux,fpload_u")])
10918 (define_insn "*movsf_update2"
10919 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10920 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10921 (match_operand:SF 3 "gpc_reg_operand" "f,f"))
10922 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10923 (plus:SI (match_dup 1) (match_dup 2)))]
10924 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT && TARGET_UPDATE
10925 && (!avoiding_indexed_address_p (SImode)
10926 || !gpc_reg_operand (operands[2], SImode))"
10930 [(set_attr "type" "fpstore_ux,fpstore_u")])
10932 (define_insn "*movsf_update3"
10933 [(set (match_operand:SF 3 "gpc_reg_operand" "=r,r")
10934 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10935 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10936 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10937 (plus:SI (match_dup 1) (match_dup 2)))]
10938 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE
10939 && (!avoiding_indexed_address_p (SImode)
10940 || !gpc_reg_operand (operands[2], SImode))"
10942 {lux|lwzux} %3,%0,%2
10943 {lu|lwzu} %3,%2(%0)"
10944 [(set_attr "type" "load_ux,load_u")])
10946 (define_insn "*movsf_update4"
10947 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10948 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10949 (match_operand:SF 3 "gpc_reg_operand" "r,r"))
10950 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10951 (plus:SI (match_dup 1) (match_dup 2)))]
10952 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE
10953 && (!avoiding_indexed_address_p (SImode)
10954 || !gpc_reg_operand (operands[2], SImode))"
10956 {stux|stwux} %3,%0,%2
10957 {stu|stwu} %3,%2(%0)"
10958 [(set_attr "type" "store_ux,store_u")])
10960 (define_insn "*movdf_update1"
10961 [(set (match_operand:DF 3 "gpc_reg_operand" "=d,d")
10962 (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10963 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10964 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10965 (plus:SI (match_dup 1) (match_dup 2)))]
10966 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_UPDATE
10967 && (!avoiding_indexed_address_p (SImode)
10968 || !gpc_reg_operand (operands[2], SImode))"
10972 [(set_attr "type" "fpload_ux,fpload_u")])
10974 (define_insn "*movdf_update2"
10975 [(set (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10976 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10977 (match_operand:DF 3 "gpc_reg_operand" "d,d"))
10978 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10979 (plus:SI (match_dup 1) (match_dup 2)))]
10980 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_UPDATE
10981 && (!avoiding_indexed_address_p (SImode)
10982 || !gpc_reg_operand (operands[2], SImode))"
10986 [(set_attr "type" "fpstore_ux,fpstore_u")])
10988 ;; Peephole to convert two consecutive FP loads or stores into lfq/stfq.
10990 (define_insn "*lfq_power2"
10991 [(set (match_operand:V2DF 0 "gpc_reg_operand" "=f")
10992 (match_operand:V2DF 1 "memory_operand" ""))]
10994 && TARGET_HARD_FLOAT && TARGET_FPRS"
10998 [(set (match_operand:DF 0 "gpc_reg_operand" "")
10999 (match_operand:DF 1 "memory_operand" ""))
11000 (set (match_operand:DF 2 "gpc_reg_operand" "")
11001 (match_operand:DF 3 "memory_operand" ""))]
11003 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
11004 && registers_ok_for_quad_peep (operands[0], operands[2])
11005 && mems_ok_for_quad_peep (operands[1], operands[3])"
11006 [(set (match_dup 0)
11008 "operands[1] = widen_memory_access (operands[1], V2DFmode, 0);
11009 operands[0] = gen_rtx_REG (V2DFmode, REGNO (operands[0]));")
11011 (define_insn "*stfq_power2"
11012 [(set (match_operand:V2DF 0 "memory_operand" "")
11013 (match_operand:V2DF 1 "gpc_reg_operand" "f"))]
11015 && TARGET_HARD_FLOAT && TARGET_FPRS"
11016 "stfq%U0%X0 %1,%0")
11020 [(set (match_operand:DF 0 "memory_operand" "")
11021 (match_operand:DF 1 "gpc_reg_operand" ""))
11022 (set (match_operand:DF 2 "memory_operand" "")
11023 (match_operand:DF 3 "gpc_reg_operand" ""))]
11025 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
11026 && registers_ok_for_quad_peep (operands[1], operands[3])
11027 && mems_ok_for_quad_peep (operands[0], operands[2])"
11028 [(set (match_dup 0)
11030 "operands[0] = widen_memory_access (operands[0], V2DFmode, 0);
11031 operands[1] = gen_rtx_REG (V2DFmode, REGNO (operands[1]));")
11033 ;; After inserting conditional returns we can sometimes have
11034 ;; unnecessary register moves. Unfortunately we cannot have a
11035 ;; modeless peephole here, because some single SImode sets have early
11036 ;; clobber outputs. Although those sets expand to multi-ppc-insn
11037 ;; sequences, using get_attr_length here will smash the operands
11038 ;; array. Neither is there an early_cobbler_p predicate.
11039 ;; Disallow subregs for E500 so we don't munge frob_di_df_2.
11041 [(set (match_operand:DF 0 "gpc_reg_operand" "")
11042 (match_operand:DF 1 "any_operand" ""))
11043 (set (match_operand:DF 2 "gpc_reg_operand" "")
11045 "!(TARGET_E500_DOUBLE && GET_CODE (operands[2]) == SUBREG)
11046 && peep2_reg_dead_p (2, operands[0])"
11047 [(set (match_dup 2) (match_dup 1))])
11050 [(set (match_operand:SF 0 "gpc_reg_operand" "")
11051 (match_operand:SF 1 "any_operand" ""))
11052 (set (match_operand:SF 2 "gpc_reg_operand" "")
11054 "peep2_reg_dead_p (2, operands[0])"
11055 [(set (match_dup 2) (match_dup 1))])
11060 ;; Mode attributes for different ABIs.
11061 (define_mode_iterator TLSmode [(SI "! TARGET_64BIT") (DI "TARGET_64BIT")])
11062 (define_mode_attr tls_abi_suffix [(SI "32") (DI "64")])
11063 (define_mode_attr tls_sysv_suffix [(SI "si") (DI "di")])
11064 (define_mode_attr tls_insn_suffix [(SI "wz") (DI "d")])
11066 (define_insn_and_split "tls_gd_aix<TLSmode:tls_abi_suffix>"
11067 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11068 (call (mem:TLSmode (match_operand:TLSmode 3 "symbol_ref_operand" "s"))
11069 (match_operand 4 "" "g")))
11070 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11071 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11073 (clobber (reg:SI LR_REGNO))]
11074 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX"
11075 "addi %0,%1,%2@got@tlsgd\;bl %z3\;%."
11076 "&& TARGET_TLS_MARKERS"
11077 [(set (match_dup 0)
11078 (unspec:TLSmode [(match_dup 1)
11081 (parallel [(set (match_dup 0)
11082 (call (mem:TLSmode (match_dup 3))
11084 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD)
11085 (clobber (reg:SI LR_REGNO))])]
11087 [(set_attr "type" "two")
11088 (set_attr "length" "12")])
11090 (define_insn_and_split "tls_gd_sysv<TLSmode:tls_sysv_suffix>"
11091 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11092 (call (mem:TLSmode (match_operand:TLSmode 3 "symbol_ref_operand" "s"))
11093 (match_operand 4 "" "g")))
11094 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11095 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11097 (clobber (reg:SI LR_REGNO))]
11098 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4"
11102 if (TARGET_SECURE_PLT && flag_pic == 2)
11103 return "addi %0,%1,%2@got@tlsgd\;bl %z3+32768@plt";
11105 return "addi %0,%1,%2@got@tlsgd\;bl %z3@plt";
11108 return "addi %0,%1,%2@got@tlsgd\;bl %z3";
11110 "&& TARGET_TLS_MARKERS"
11111 [(set (match_dup 0)
11112 (unspec:TLSmode [(match_dup 1)
11115 (parallel [(set (match_dup 0)
11116 (call (mem:TLSmode (match_dup 3))
11118 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD)
11119 (clobber (reg:SI LR_REGNO))])]
11121 [(set_attr "type" "two")
11122 (set_attr "length" "8")])
11124 (define_insn "*tls_gd<TLSmode:tls_abi_suffix>"
11125 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11126 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11127 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11129 "HAVE_AS_TLS && TARGET_TLS_MARKERS"
11130 "addi %0,%1,%2@got@tlsgd"
11131 [(set_attr "length" "4")])
11133 (define_insn "*tls_gd_call_aix<TLSmode:tls_abi_suffix>"
11134 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11135 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
11136 (match_operand 2 "" "g")))
11137 (unspec:TLSmode [(match_operand:TLSmode 3 "rs6000_tls_symbol_ref" "")]
11139 (clobber (reg:SI LR_REGNO))]
11140 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX && TARGET_TLS_MARKERS"
11141 "bl %z1(%3@tlsgd)\;%."
11142 [(set_attr "type" "branch")
11143 (set_attr "length" "8")])
11145 (define_insn "*tls_gd_call_sysv<TLSmode:tls_abi_suffix>"
11146 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11147 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
11148 (match_operand 2 "" "g")))
11149 (unspec:TLSmode [(match_operand:TLSmode 3 "rs6000_tls_symbol_ref" "")]
11151 (clobber (reg:SI LR_REGNO))]
11152 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4 && TARGET_TLS_MARKERS"
11156 if (TARGET_SECURE_PLT && flag_pic == 2)
11157 return "bl %z1+32768(%3@tlsgd)@plt";
11158 return "bl %z1(%3@tlsgd)@plt";
11160 return "bl %z1(%3@tlsgd)";
11162 [(set_attr "type" "branch")
11163 (set_attr "length" "4")])
11165 (define_insn_and_split "tls_ld_aix<TLSmode:tls_abi_suffix>"
11166 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11167 (call (mem:TLSmode (match_operand:TLSmode 2 "symbol_ref_operand" "s"))
11168 (match_operand 3 "" "g")))
11169 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
11171 (clobber (reg:SI LR_REGNO))]
11172 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX"
11173 "addi %0,%1,%&@got@tlsld\;bl %z2\;%."
11174 "&& TARGET_TLS_MARKERS"
11175 [(set (match_dup 0)
11176 (unspec:TLSmode [(match_dup 1)]
11178 (parallel [(set (match_dup 0)
11179 (call (mem:TLSmode (match_dup 2))
11181 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
11182 (clobber (reg:SI LR_REGNO))])]
11184 [(set_attr "length" "12")])
11186 (define_insn_and_split "tls_ld_sysv<TLSmode:tls_sysv_suffix>"
11187 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11188 (call (mem:TLSmode (match_operand:TLSmode 2 "symbol_ref_operand" "s"))
11189 (match_operand 3 "" "g")))
11190 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
11192 (clobber (reg:SI LR_REGNO))]
11193 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4"
11197 if (TARGET_SECURE_PLT && flag_pic == 2)
11198 return "addi %0,%1,%&@got@tlsld\;bl %z2+32768@plt";
11200 return "addi %0,%1,%&@got@tlsld\;bl %z2@plt";
11203 return "addi %0,%1,%&@got@tlsld\;bl %z2";
11205 "&& TARGET_TLS_MARKERS"
11206 [(set (match_dup 0)
11207 (unspec:TLSmode [(match_dup 1)]
11209 (parallel [(set (match_dup 0)
11210 (call (mem:TLSmode (match_dup 2))
11212 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
11213 (clobber (reg:SI LR_REGNO))])]
11215 [(set_attr "length" "8")])
11217 (define_insn "*tls_ld<TLSmode:tls_abi_suffix>"
11218 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11219 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
11221 "HAVE_AS_TLS && TARGET_TLS_MARKERS"
11222 "addi %0,%1,%&@got@tlsld"
11223 [(set_attr "length" "4")])
11225 (define_insn "*tls_ld_call_aix<TLSmode:tls_abi_suffix>"
11226 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11227 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
11228 (match_operand 2 "" "g")))
11229 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
11230 (clobber (reg:SI LR_REGNO))]
11231 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX && TARGET_TLS_MARKERS"
11232 "bl %z1(%&@tlsld)\;%."
11233 [(set_attr "type" "branch")
11234 (set_attr "length" "8")])
11236 (define_insn "*tls_ld_call_sysv<TLSmode:tls_abi_suffix>"
11237 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11238 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
11239 (match_operand 2 "" "g")))
11240 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
11241 (clobber (reg:SI LR_REGNO))]
11242 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4 && TARGET_TLS_MARKERS"
11246 if (TARGET_SECURE_PLT && flag_pic == 2)
11247 return "bl %z1+32768(%&@tlsld)@plt";
11248 return "bl %z1(%&@tlsld)@plt";
11250 return "bl %z1(%&@tlsld)";
11252 [(set_attr "type" "branch")
11253 (set_attr "length" "4")])
11255 (define_insn "tls_dtprel_<TLSmode:tls_abi_suffix>"
11256 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11257 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11258 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11259 UNSPEC_TLSDTPREL))]
11261 "addi %0,%1,%2@dtprel")
11263 (define_insn "tls_dtprel_ha_<TLSmode:tls_abi_suffix>"
11264 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11265 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11266 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11267 UNSPEC_TLSDTPRELHA))]
11269 "addis %0,%1,%2@dtprel@ha")
11271 (define_insn "tls_dtprel_lo_<TLSmode:tls_abi_suffix>"
11272 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11273 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11274 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11275 UNSPEC_TLSDTPRELLO))]
11277 "addi %0,%1,%2@dtprel@l")
11279 (define_insn "tls_got_dtprel_<TLSmode:tls_abi_suffix>"
11280 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11281 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11282 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11283 UNSPEC_TLSGOTDTPREL))]
11285 "l<TLSmode:tls_insn_suffix> %0,%2@got@dtprel(%1)")
11287 (define_insn "tls_tprel_<TLSmode:tls_abi_suffix>"
11288 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11289 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11290 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11293 "addi %0,%1,%2@tprel")
11295 (define_insn "tls_tprel_ha_<TLSmode:tls_abi_suffix>"
11296 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11297 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11298 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11299 UNSPEC_TLSTPRELHA))]
11301 "addis %0,%1,%2@tprel@ha")
11303 (define_insn "tls_tprel_lo_<TLSmode:tls_abi_suffix>"
11304 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11305 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11306 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11307 UNSPEC_TLSTPRELLO))]
11309 "addi %0,%1,%2@tprel@l")
11311 ;; "b" output constraint here and on tls_tls input to support linker tls
11312 ;; optimization. The linker may edit the instructions emitted by a
11313 ;; tls_got_tprel/tls_tls pair to addis,addi.
11314 (define_insn "tls_got_tprel_<TLSmode:tls_abi_suffix>"
11315 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11316 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11317 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11318 UNSPEC_TLSGOTTPREL))]
11320 "l<TLSmode:tls_insn_suffix> %0,%2@got@tprel(%1)")
11322 (define_insn "tls_tls_<TLSmode:tls_abi_suffix>"
11323 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11324 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11325 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11328 "add %0,%1,%2@tls")
11331 ;; Next come insns related to the calling sequence.
11333 ;; First, an insn to allocate new stack space for dynamic use (e.g., alloca).
11334 ;; We move the back-chain and decrement the stack pointer.
11336 (define_expand "allocate_stack"
11337 [(set (match_operand 0 "gpc_reg_operand" "")
11338 (minus (reg 1) (match_operand 1 "reg_or_short_operand" "")))
11340 (minus (reg 1) (match_dup 1)))]
11343 { rtx chain = gen_reg_rtx (Pmode);
11344 rtx stack_bot = gen_rtx_MEM (Pmode, stack_pointer_rtx);
11346 rtx insn, par, set, mem;
11348 emit_move_insn (chain, stack_bot);
11350 /* Check stack bounds if necessary. */
11351 if (crtl->limit_stack)
11354 available = expand_binop (Pmode, sub_optab,
11355 stack_pointer_rtx, stack_limit_rtx,
11356 NULL_RTX, 1, OPTAB_WIDEN);
11357 emit_insn (gen_cond_trap (LTU, available, operands[1], const0_rtx));
11360 if (GET_CODE (operands[1]) != CONST_INT
11361 || INTVAL (operands[1]) < -32767
11362 || INTVAL (operands[1]) > 32768)
11364 neg_op0 = gen_reg_rtx (Pmode);
11366 emit_insn (gen_negsi2 (neg_op0, operands[1]));
11368 emit_insn (gen_negdi2 (neg_op0, operands[1]));
11371 neg_op0 = GEN_INT (- INTVAL (operands[1]));
11373 insn = emit_insn ((* ((TARGET_32BIT) ? gen_movsi_update_stack
11374 : gen_movdi_di_update_stack))
11375 (stack_pointer_rtx, stack_pointer_rtx, neg_op0,
11377 /* Since we didn't use gen_frame_mem to generate the MEM, grab
11378 it now and set the alias set/attributes. The above gen_*_update
11379 calls will generate a PARALLEL with the MEM set being the first
11381 par = PATTERN (insn);
11382 gcc_assert (GET_CODE (par) == PARALLEL);
11383 set = XVECEXP (par, 0, 0);
11384 gcc_assert (GET_CODE (set) == SET);
11385 mem = SET_DEST (set);
11386 gcc_assert (MEM_P (mem));
11387 MEM_NOTRAP_P (mem) = 1;
11388 set_mem_alias_set (mem, get_frame_alias_set ());
11390 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
11394 ;; These patterns say how to save and restore the stack pointer. We need not
11395 ;; save the stack pointer at function level since we are careful to
11396 ;; preserve the backchain. At block level, we have to restore the backchain
11397 ;; when we restore the stack pointer.
11399 ;; For nonlocal gotos, we must save both the stack pointer and its
11400 ;; backchain and restore both. Note that in the nonlocal case, the
11401 ;; save area is a memory location.
11403 (define_expand "save_stack_function"
11404 [(match_operand 0 "any_operand" "")
11405 (match_operand 1 "any_operand" "")]
11409 (define_expand "restore_stack_function"
11410 [(match_operand 0 "any_operand" "")
11411 (match_operand 1 "any_operand" "")]
11415 ;; Adjust stack pointer (op0) to a new value (op1).
11416 ;; First copy old stack backchain to new location, and ensure that the
11417 ;; scheduler won't reorder the sp assignment before the backchain write.
11418 (define_expand "restore_stack_block"
11419 [(set (match_dup 2) (match_dup 3))
11420 (set (match_dup 4) (match_dup 2))
11421 (set (match_dup 5) (unspec:BLK [(match_dup 5)] UNSPEC_TIE))
11422 (set (match_operand 0 "register_operand" "")
11423 (match_operand 1 "register_operand" ""))]
11427 operands[1] = force_reg (Pmode, operands[1]);
11428 operands[2] = gen_reg_rtx (Pmode);
11429 operands[3] = gen_frame_mem (Pmode, operands[0]);
11430 operands[4] = gen_frame_mem (Pmode, operands[1]);
11431 operands[5] = gen_frame_mem (BLKmode, operands[0]);
11434 (define_expand "save_stack_nonlocal"
11435 [(set (match_dup 3) (match_dup 4))
11436 (set (match_operand 0 "memory_operand" "") (match_dup 3))
11437 (set (match_dup 2) (match_operand 1 "register_operand" ""))]
11441 int units_per_word = (TARGET_32BIT) ? 4 : 8;
11443 /* Copy the backchain to the first word, sp to the second. */
11444 operands[0] = adjust_address_nv (operands[0], Pmode, 0);
11445 operands[2] = adjust_address_nv (operands[0], Pmode, units_per_word);
11446 operands[3] = gen_reg_rtx (Pmode);
11447 operands[4] = gen_frame_mem (Pmode, operands[1]);
11450 (define_expand "restore_stack_nonlocal"
11451 [(set (match_dup 2) (match_operand 1 "memory_operand" ""))
11452 (set (match_dup 3) (match_dup 4))
11453 (set (match_dup 5) (match_dup 2))
11454 (set (match_dup 6) (unspec:BLK [(match_dup 6)] UNSPEC_TIE))
11455 (set (match_operand 0 "register_operand" "") (match_dup 3))]
11459 int units_per_word = (TARGET_32BIT) ? 4 : 8;
11461 /* Restore the backchain from the first word, sp from the second. */
11462 operands[2] = gen_reg_rtx (Pmode);
11463 operands[3] = gen_reg_rtx (Pmode);
11464 operands[1] = adjust_address_nv (operands[1], Pmode, 0);
11465 operands[4] = adjust_address_nv (operands[1], Pmode, units_per_word);
11466 operands[5] = gen_frame_mem (Pmode, operands[3]);
11467 operands[6] = gen_frame_mem (BLKmode, operands[0]);
11470 ;; TOC register handling.
11472 ;; Code to initialize the TOC register...
11474 (define_insn "load_toc_aix_si"
11475 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11476 (unspec:SI [(const_int 0)] UNSPEC_TOC))
11477 (use (reg:SI 2))])]
11478 "DEFAULT_ABI == ABI_AIX && TARGET_32BIT"
11482 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
11483 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
11484 operands[2] = gen_rtx_REG (Pmode, 2);
11485 return \"{l|lwz} %0,%1(%2)\";
11487 [(set_attr "type" "load")])
11489 (define_insn "load_toc_aix_di"
11490 [(parallel [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11491 (unspec:DI [(const_int 0)] UNSPEC_TOC))
11492 (use (reg:DI 2))])]
11493 "DEFAULT_ABI == ABI_AIX && TARGET_64BIT"
11497 #ifdef TARGET_RELOCATABLE
11498 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\",
11499 !TARGET_MINIMAL_TOC || TARGET_RELOCATABLE);
11501 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
11504 strcat (buf, \"@toc\");
11505 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
11506 operands[2] = gen_rtx_REG (Pmode, 2);
11507 return \"ld %0,%1(%2)\";
11509 [(set_attr "type" "load")])
11511 (define_insn "load_toc_v4_pic_si"
11512 [(set (reg:SI LR_REGNO)
11513 (unspec:SI [(const_int 0)] UNSPEC_TOC))]
11514 "DEFAULT_ABI == ABI_V4 && flag_pic == 1 && TARGET_32BIT"
11515 "bl _GLOBAL_OFFSET_TABLE_@local-4"
11516 [(set_attr "type" "branch")
11517 (set_attr "length" "4")])
11519 (define_insn "load_toc_v4_PIC_1"
11520 [(set (reg:SI LR_REGNO)
11521 (match_operand:SI 0 "immediate_operand" "s"))
11522 (use (unspec [(match_dup 0)] UNSPEC_TOC))]
11523 "TARGET_ELF && DEFAULT_ABI != ABI_AIX
11524 && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
11525 "bcl 20,31,%0\\n%0:"
11526 [(set_attr "type" "branch")
11527 (set_attr "length" "4")])
11529 (define_insn "load_toc_v4_PIC_1b"
11530 [(set (reg:SI LR_REGNO)
11531 (unspec:SI [(match_operand:SI 0 "immediate_operand" "s")]
11533 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
11534 "bcl 20,31,$+8\\n\\t.long %0-$"
11535 [(set_attr "type" "branch")
11536 (set_attr "length" "8")])
11538 (define_insn "load_toc_v4_PIC_2"
11539 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11540 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
11541 (minus:SI (match_operand:SI 2 "immediate_operand" "s")
11542 (match_operand:SI 3 "immediate_operand" "s")))))]
11543 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
11544 "{l|lwz} %0,%2-%3(%1)"
11545 [(set_attr "type" "load")])
11547 (define_insn "load_toc_v4_PIC_3b"
11548 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
11549 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "r")
11551 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
11552 (match_operand:SI 3 "symbol_ref_operand" "s")))))]
11553 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
11554 "{cau|addis} %0,%1,%2-%3@ha")
11556 (define_insn "load_toc_v4_PIC_3c"
11557 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11558 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
11559 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
11560 (match_operand:SI 3 "symbol_ref_operand" "s"))))]
11561 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
11562 "{cal %0,%2-%3@l(%1)|addi %0,%1,%2-%3@l}")
11564 ;; If the TOC is shared over a translation unit, as happens with all
11565 ;; the kinds of PIC that we support, we need to restore the TOC
11566 ;; pointer only when jumping over units of translation.
11567 ;; On Darwin, we need to reload the picbase.
11569 (define_expand "builtin_setjmp_receiver"
11570 [(use (label_ref (match_operand 0 "" "")))]
11571 "(DEFAULT_ABI == ABI_V4 && flag_pic == 1)
11572 || (TARGET_TOC && TARGET_MINIMAL_TOC)
11573 || (DEFAULT_ABI == ABI_DARWIN && flag_pic)"
11577 if (DEFAULT_ABI == ABI_DARWIN)
11579 rtx picrtx = gen_rtx_SYMBOL_REF (Pmode, MACHOPIC_FUNCTION_BASE_NAME);
11580 rtx picreg = gen_rtx_REG (Pmode, RS6000_PIC_OFFSET_TABLE_REGNUM);
11584 crtl->uses_pic_offset_table = 1;
11585 ASM_GENERATE_INTERNAL_LABEL(tmplab, \"LSJR\",
11586 CODE_LABEL_NUMBER (operands[0]));
11587 tmplabrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (tmplab));
11589 emit_insn (gen_load_macho_picbase (tmplabrtx));
11590 emit_move_insn (picreg, gen_rtx_REG (Pmode, LR_REGNO));
11591 emit_insn (gen_macho_correct_pic (picreg, picreg, picrtx, tmplabrtx));
11595 rs6000_emit_load_toc_table (FALSE);
11599 ;; Elf specific ways of loading addresses for non-PIC code.
11600 ;; The output of this could be r0, but we make a very strong
11601 ;; preference for a base register because it will usually
11602 ;; be needed there.
11603 (define_insn "elf_high"
11604 [(set (match_operand:SI 0 "gpc_reg_operand" "=b*r")
11605 (high:SI (match_operand 1 "" "")))]
11606 "TARGET_ELF && ! TARGET_64BIT"
11607 "{liu|lis} %0,%1@ha")
11609 (define_insn "elf_low"
11610 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11611 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,!*r")
11612 (match_operand 2 "" "")))]
11613 "TARGET_ELF && ! TARGET_64BIT"
11615 {cal|la} %0,%2@l(%1)
11616 {ai|addic} %0,%1,%K2")
11618 ;; A function pointer under AIX is a pointer to a data area whose first word
11619 ;; contains the actual address of the function, whose second word contains a
11620 ;; pointer to its TOC, and whose third word contains a value to place in the
11621 ;; static chain register (r11). Note that if we load the static chain, our
11622 ;; "trampoline" need not have any executable code.
11624 (define_expand "call_indirect_aix32"
11625 [(set (match_dup 2)
11626 (mem:SI (match_operand:SI 0 "gpc_reg_operand" "")))
11627 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
11630 (mem:SI (plus:SI (match_dup 0)
11632 (parallel [(call (mem:SI (match_dup 2))
11633 (match_operand 1 "" ""))
11634 (use (mem:SI (plus:SI (match_dup 0) (const_int 4))))
11636 (use (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
11637 (clobber (reg:SI LR_REGNO))])]
11640 { operands[2] = gen_reg_rtx (SImode); }")
11642 (define_expand "call_indirect_aix64"
11643 [(set (match_dup 2)
11644 (mem:DI (match_operand:DI 0 "gpc_reg_operand" "")))
11645 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
11648 (mem:DI (plus:DI (match_dup 0)
11650 (parallel [(call (mem:SI (match_dup 2))
11651 (match_operand 1 "" ""))
11652 (use (mem:DI (plus:DI (match_dup 0) (const_int 8))))
11654 (use (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
11655 (clobber (reg:SI LR_REGNO))])]
11658 { operands[2] = gen_reg_rtx (DImode); }")
11660 (define_expand "call_value_indirect_aix32"
11661 [(set (match_dup 3)
11662 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "")))
11663 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
11666 (mem:SI (plus:SI (match_dup 1)
11668 (parallel [(set (match_operand 0 "" "")
11669 (call (mem:SI (match_dup 3))
11670 (match_operand 2 "" "")))
11671 (use (mem:SI (plus:SI (match_dup 1) (const_int 4))))
11673 (use (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
11674 (clobber (reg:SI LR_REGNO))])]
11677 { operands[3] = gen_reg_rtx (SImode); }")
11679 (define_expand "call_value_indirect_aix64"
11680 [(set (match_dup 3)
11681 (mem:DI (match_operand:DI 1 "gpc_reg_operand" "")))
11682 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
11685 (mem:DI (plus:DI (match_dup 1)
11687 (parallel [(set (match_operand 0 "" "")
11688 (call (mem:SI (match_dup 3))
11689 (match_operand 2 "" "")))
11690 (use (mem:DI (plus:DI (match_dup 1) (const_int 8))))
11692 (use (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
11693 (clobber (reg:SI LR_REGNO))])]
11696 { operands[3] = gen_reg_rtx (DImode); }")
11698 ;; Now the definitions for the call and call_value insns
11699 (define_expand "call"
11700 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
11701 (match_operand 1 "" ""))
11702 (use (match_operand 2 "" ""))
11703 (clobber (reg:SI LR_REGNO))])]
11708 if (MACHOPIC_INDIRECT)
11709 operands[0] = machopic_indirect_call_target (operands[0]);
11712 gcc_assert (GET_CODE (operands[0]) == MEM);
11713 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
11715 operands[0] = XEXP (operands[0], 0);
11717 if (GET_CODE (operands[0]) != SYMBOL_REF
11718 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[0]))
11719 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[2]) & CALL_LONG) != 0))
11721 if (INTVAL (operands[2]) & CALL_LONG)
11722 operands[0] = rs6000_longcall_ref (operands[0]);
11724 switch (DEFAULT_ABI)
11728 operands[0] = force_reg (Pmode, operands[0]);
11732 /* AIX function pointers are really pointers to a three word
11734 emit_call_insn (TARGET_32BIT
11735 ? gen_call_indirect_aix32 (force_reg (SImode,
11738 : gen_call_indirect_aix64 (force_reg (DImode,
11744 gcc_unreachable ();
11749 (define_expand "call_value"
11750 [(parallel [(set (match_operand 0 "" "")
11751 (call (mem:SI (match_operand 1 "address_operand" ""))
11752 (match_operand 2 "" "")))
11753 (use (match_operand 3 "" ""))
11754 (clobber (reg:SI LR_REGNO))])]
11759 if (MACHOPIC_INDIRECT)
11760 operands[1] = machopic_indirect_call_target (operands[1]);
11763 gcc_assert (GET_CODE (operands[1]) == MEM);
11764 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
11766 operands[1] = XEXP (operands[1], 0);
11768 if (GET_CODE (operands[1]) != SYMBOL_REF
11769 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[1]))
11770 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[3]) & CALL_LONG) != 0))
11772 if (INTVAL (operands[3]) & CALL_LONG)
11773 operands[1] = rs6000_longcall_ref (operands[1]);
11775 switch (DEFAULT_ABI)
11779 operands[1] = force_reg (Pmode, operands[1]);
11783 /* AIX function pointers are really pointers to a three word
11785 emit_call_insn (TARGET_32BIT
11786 ? gen_call_value_indirect_aix32 (operands[0],
11790 : gen_call_value_indirect_aix64 (operands[0],
11797 gcc_unreachable ();
11802 ;; Call to function in current module. No TOC pointer reload needed.
11803 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
11804 ;; either the function was not prototyped, or it was prototyped as a
11805 ;; variable argument function. It is > 0 if FP registers were passed
11806 ;; and < 0 if they were not.
11808 (define_insn "*call_local32"
11809 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
11810 (match_operand 1 "" "g,g"))
11811 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11812 (clobber (reg:SI LR_REGNO))]
11813 "(INTVAL (operands[2]) & CALL_LONG) == 0"
11816 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11817 output_asm_insn (\"crxor 6,6,6\", operands);
11819 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11820 output_asm_insn (\"creqv 6,6,6\", operands);
11822 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
11824 [(set_attr "type" "branch")
11825 (set_attr "length" "4,8")])
11827 (define_insn "*call_local64"
11828 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
11829 (match_operand 1 "" "g,g"))
11830 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11831 (clobber (reg:SI LR_REGNO))]
11832 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
11835 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11836 output_asm_insn (\"crxor 6,6,6\", operands);
11838 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11839 output_asm_insn (\"creqv 6,6,6\", operands);
11841 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
11843 [(set_attr "type" "branch")
11844 (set_attr "length" "4,8")])
11846 (define_insn "*call_value_local32"
11847 [(set (match_operand 0 "" "")
11848 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
11849 (match_operand 2 "" "g,g")))
11850 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11851 (clobber (reg:SI LR_REGNO))]
11852 "(INTVAL (operands[3]) & CALL_LONG) == 0"
11855 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11856 output_asm_insn (\"crxor 6,6,6\", operands);
11858 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11859 output_asm_insn (\"creqv 6,6,6\", operands);
11861 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
11863 [(set_attr "type" "branch")
11864 (set_attr "length" "4,8")])
11867 (define_insn "*call_value_local64"
11868 [(set (match_operand 0 "" "")
11869 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
11870 (match_operand 2 "" "g,g")))
11871 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11872 (clobber (reg:SI LR_REGNO))]
11873 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
11876 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11877 output_asm_insn (\"crxor 6,6,6\", operands);
11879 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11880 output_asm_insn (\"creqv 6,6,6\", operands);
11882 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
11884 [(set_attr "type" "branch")
11885 (set_attr "length" "4,8")])
11887 ;; Call to function which may be in another module. Restore the TOC
11888 ;; pointer (r2) after the call unless this is System V.
11889 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
11890 ;; either the function was not prototyped, or it was prototyped as a
11891 ;; variable argument function. It is > 0 if FP registers were passed
11892 ;; and < 0 if they were not.
11894 (define_insn_and_split "*call_indirect_nonlocal_aix32_internal"
11895 [(call (mem:SI (match_operand:SI 0 "register_operand" "c,*l"))
11896 (match_operand 1 "" "g,g"))
11897 (use (mem:SI (plus:SI (match_operand:SI 2 "register_operand" "b,b") (const_int 4))))
11899 (use (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
11900 (clobber (reg:SI LR_REGNO))]
11901 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
11903 "&& reload_completed"
11905 (mem:SI (plus:SI (match_dup 2) (const_int 4))))
11906 (parallel [(call (mem:SI (match_dup 0))
11911 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
11912 (clobber (reg:SI LR_REGNO))])]
11914 [(set_attr "type" "jmpreg")
11915 (set_attr "length" "12")])
11917 (define_insn "*call_indirect_nonlocal_aix32"
11918 [(call (mem:SI (match_operand:SI 0 "register_operand" "c,*l"))
11919 (match_operand 1 "" "g,g"))
11923 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
11924 (clobber (reg:SI LR_REGNO))]
11925 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX && reload_completed"
11926 "b%T0l\;{l|lwz} 2,20(1)"
11927 [(set_attr "type" "jmpreg")
11928 (set_attr "length" "8")])
11930 (define_insn "*call_nonlocal_aix32"
11931 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
11932 (match_operand 1 "" "g"))
11933 (use (match_operand:SI 2 "immediate_operand" "O"))
11934 (clobber (reg:SI LR_REGNO))]
11936 && DEFAULT_ABI == ABI_AIX
11937 && (INTVAL (operands[2]) & CALL_LONG) == 0"
11939 [(set_attr "type" "branch")
11940 (set_attr "length" "8")])
11942 (define_insn_and_split "*call_indirect_nonlocal_aix64_internal"
11943 [(call (mem:SI (match_operand:DI 0 "register_operand" "c,*l"))
11944 (match_operand 1 "" "g,g"))
11945 (use (mem:DI (plus:DI (match_operand:DI 2 "register_operand" "b,b")
11948 (use (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
11949 (clobber (reg:SI LR_REGNO))]
11950 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
11952 "&& reload_completed"
11954 (mem:DI (plus:DI (match_dup 2) (const_int 8))))
11955 (parallel [(call (mem:SI (match_dup 0))
11960 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
11961 (clobber (reg:SI LR_REGNO))])]
11963 [(set_attr "type" "jmpreg")
11964 (set_attr "length" "12")])
11966 (define_insn "*call_indirect_nonlocal_aix64"
11967 [(call (mem:SI (match_operand:DI 0 "register_operand" "c,*l"))
11968 (match_operand 1 "" "g,g"))
11972 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
11973 (clobber (reg:SI LR_REGNO))]
11974 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX && reload_completed"
11975 "b%T0l\;ld 2,40(1)"
11976 [(set_attr "type" "jmpreg")
11977 (set_attr "length" "8")])
11979 (define_insn "*call_nonlocal_aix64"
11980 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
11981 (match_operand 1 "" "g"))
11982 (use (match_operand:SI 2 "immediate_operand" "O"))
11983 (clobber (reg:SI LR_REGNO))]
11985 && DEFAULT_ABI == ABI_AIX
11986 && (INTVAL (operands[2]) & CALL_LONG) == 0"
11988 [(set_attr "type" "branch")
11989 (set_attr "length" "8")])
11991 (define_insn_and_split "*call_value_indirect_nonlocal_aix32_internal"
11992 [(set (match_operand 0 "" "")
11993 (call (mem:SI (match_operand:SI 1 "register_operand" "c,*l"))
11994 (match_operand 2 "" "g,g")))
11995 (use (mem:SI (plus:SI (match_operand:SI 3 "register_operand" "b,b")
11998 (use (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
11999 (clobber (reg:SI LR_REGNO))]
12000 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
12002 "&& reload_completed"
12004 (mem:SI (plus:SI (match_dup 3) (const_int 4))))
12005 (parallel [(set (match_dup 0) (call (mem:SI (match_dup 1))
12010 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
12011 (clobber (reg:SI LR_REGNO))])]
12013 [(set_attr "type" "jmpreg")
12014 (set_attr "length" "12")])
12016 (define_insn "*call_value_indirect_nonlocal_aix32"
12017 [(set (match_operand 0 "" "")
12018 (call (mem:SI (match_operand:SI 1 "register_operand" "c,*l"))
12019 (match_operand 2 "" "g,g")))
12023 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
12024 (clobber (reg:SI LR_REGNO))]
12025 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX && reload_completed"
12026 "b%T1l\;{l|lwz} 2,20(1)"
12027 [(set_attr "type" "jmpreg")
12028 (set_attr "length" "8")])
12030 (define_insn "*call_value_nonlocal_aix32"
12031 [(set (match_operand 0 "" "")
12032 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
12033 (match_operand 2 "" "g")))
12034 (use (match_operand:SI 3 "immediate_operand" "O"))
12035 (clobber (reg:SI LR_REGNO))]
12037 && DEFAULT_ABI == ABI_AIX
12038 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12040 [(set_attr "type" "branch")
12041 (set_attr "length" "8")])
12043 (define_insn_and_split "*call_value_indirect_nonlocal_aix64_internal"
12044 [(set (match_operand 0 "" "")
12045 (call (mem:SI (match_operand:DI 1 "register_operand" "c,*l"))
12046 (match_operand 2 "" "g,g")))
12047 (use (mem:DI (plus:DI (match_operand:DI 3 "register_operand" "b,b")
12050 (use (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
12051 (clobber (reg:SI LR_REGNO))]
12052 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
12054 "&& reload_completed"
12056 (mem:DI (plus:DI (match_dup 3) (const_int 8))))
12057 (parallel [(set (match_dup 0) (call (mem:SI (match_dup 1))
12062 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
12063 (clobber (reg:SI LR_REGNO))])]
12065 [(set_attr "type" "jmpreg")
12066 (set_attr "length" "12")])
12068 (define_insn "*call_value_indirect_nonlocal_aix64"
12069 [(set (match_operand 0 "" "")
12070 (call (mem:SI (match_operand:DI 1 "register_operand" "c,*l"))
12071 (match_operand 2 "" "g,g")))
12075 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
12076 (clobber (reg:SI LR_REGNO))]
12077 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX && reload_completed"
12078 "b%T1l\;ld 2,40(1)"
12079 [(set_attr "type" "jmpreg")
12080 (set_attr "length" "8")])
12082 (define_insn "*call_value_nonlocal_aix64"
12083 [(set (match_operand 0 "" "")
12084 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
12085 (match_operand 2 "" "g")))
12086 (use (match_operand:SI 3 "immediate_operand" "O"))
12087 (clobber (reg:SI LR_REGNO))]
12089 && DEFAULT_ABI == ABI_AIX
12090 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12092 [(set_attr "type" "branch")
12093 (set_attr "length" "8")])
12095 ;; A function pointer under System V is just a normal pointer
12096 ;; operands[0] is the function pointer
12097 ;; operands[1] is the stack size to clean up
12098 ;; operands[2] is the value FUNCTION_ARG returns for the VOID argument
12099 ;; which indicates how to set cr1
12101 (define_insn "*call_indirect_nonlocal_sysv<mode>"
12102 [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l,c,*l"))
12103 (match_operand 1 "" "g,g,g,g"))
12104 (use (match_operand:SI 2 "immediate_operand" "O,O,n,n"))
12105 (clobber (reg:SI LR_REGNO))]
12106 "DEFAULT_ABI == ABI_V4
12107 || DEFAULT_ABI == ABI_DARWIN"
12109 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12110 output_asm_insn ("crxor 6,6,6", operands);
12112 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12113 output_asm_insn ("creqv 6,6,6", operands);
12117 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
12118 (set_attr "length" "4,4,8,8")])
12120 (define_insn_and_split "*call_nonlocal_sysv<mode>"
12121 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
12122 (match_operand 1 "" "g,g"))
12123 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12124 (clobber (reg:SI LR_REGNO))]
12125 "(DEFAULT_ABI == ABI_DARWIN
12126 || (DEFAULT_ABI == ABI_V4
12127 && (INTVAL (operands[2]) & CALL_LONG) == 0))"
12129 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12130 output_asm_insn ("crxor 6,6,6", operands);
12132 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12133 output_asm_insn ("creqv 6,6,6", operands);
12136 return output_call(insn, operands, 0, 2);
12138 if (DEFAULT_ABI == ABI_V4 && flag_pic)
12140 gcc_assert (!TARGET_SECURE_PLT);
12141 return "bl %z0@plt";
12147 "DEFAULT_ABI == ABI_V4
12148 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[0])
12149 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12150 [(parallel [(call (mem:SI (match_dup 0))
12152 (use (match_dup 2))
12153 (use (match_dup 3))
12154 (clobber (reg:SI LR_REGNO))])]
12156 operands[3] = pic_offset_table_rtx;
12158 [(set_attr "type" "branch,branch")
12159 (set_attr "length" "4,8")])
12161 (define_insn "*call_nonlocal_sysv_secure<mode>"
12162 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
12163 (match_operand 1 "" "g,g"))
12164 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12165 (use (match_operand:SI 3 "register_operand" "r,r"))
12166 (clobber (reg:SI LR_REGNO))]
12167 "(DEFAULT_ABI == ABI_V4
12168 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[0])
12169 && (INTVAL (operands[2]) & CALL_LONG) == 0)"
12171 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12172 output_asm_insn ("crxor 6,6,6", operands);
12174 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12175 output_asm_insn ("creqv 6,6,6", operands);
12178 /* The magic 32768 offset here and in the other sysv call insns
12179 corresponds to the offset of r30 in .got2, as given by LCTOC1.
12180 See sysv4.h:toc_section. */
12181 return "bl %z0+32768@plt";
12183 return "bl %z0@plt";
12185 [(set_attr "type" "branch,branch")
12186 (set_attr "length" "4,8")])
12188 (define_insn "*call_value_indirect_nonlocal_sysv<mode>"
12189 [(set (match_operand 0 "" "")
12190 (call (mem:SI (match_operand:P 1 "register_operand" "c,*l,c,*l"))
12191 (match_operand 2 "" "g,g,g,g")))
12192 (use (match_operand:SI 3 "immediate_operand" "O,O,n,n"))
12193 (clobber (reg:SI LR_REGNO))]
12194 "DEFAULT_ABI == ABI_V4
12195 || DEFAULT_ABI == ABI_DARWIN"
12197 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12198 output_asm_insn ("crxor 6,6,6", operands);
12200 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12201 output_asm_insn ("creqv 6,6,6", operands);
12205 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
12206 (set_attr "length" "4,4,8,8")])
12208 (define_insn_and_split "*call_value_nonlocal_sysv<mode>"
12209 [(set (match_operand 0 "" "")
12210 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
12211 (match_operand 2 "" "g,g")))
12212 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12213 (clobber (reg:SI LR_REGNO))]
12214 "(DEFAULT_ABI == ABI_DARWIN
12215 || (DEFAULT_ABI == ABI_V4
12216 && (INTVAL (operands[3]) & CALL_LONG) == 0))"
12218 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12219 output_asm_insn ("crxor 6,6,6", operands);
12221 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12222 output_asm_insn ("creqv 6,6,6", operands);
12225 return output_call(insn, operands, 1, 3);
12227 if (DEFAULT_ABI == ABI_V4 && flag_pic)
12229 gcc_assert (!TARGET_SECURE_PLT);
12230 return "bl %z1@plt";
12236 "DEFAULT_ABI == ABI_V4
12237 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[1])
12238 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12239 [(parallel [(set (match_dup 0)
12240 (call (mem:SI (match_dup 1))
12242 (use (match_dup 3))
12243 (use (match_dup 4))
12244 (clobber (reg:SI LR_REGNO))])]
12246 operands[4] = pic_offset_table_rtx;
12248 [(set_attr "type" "branch,branch")
12249 (set_attr "length" "4,8")])
12251 (define_insn "*call_value_nonlocal_sysv_secure<mode>"
12252 [(set (match_operand 0 "" "")
12253 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
12254 (match_operand 2 "" "g,g")))
12255 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12256 (use (match_operand:SI 4 "register_operand" "r,r"))
12257 (clobber (reg:SI LR_REGNO))]
12258 "(DEFAULT_ABI == ABI_V4
12259 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[1])
12260 && (INTVAL (operands[3]) & CALL_LONG) == 0)"
12262 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12263 output_asm_insn ("crxor 6,6,6", operands);
12265 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12266 output_asm_insn ("creqv 6,6,6", operands);
12269 return "bl %z1+32768@plt";
12271 return "bl %z1@plt";
12273 [(set_attr "type" "branch,branch")
12274 (set_attr "length" "4,8")])
12276 ;; Call subroutine returning any type.
12277 (define_expand "untyped_call"
12278 [(parallel [(call (match_operand 0 "" "")
12280 (match_operand 1 "" "")
12281 (match_operand 2 "" "")])]
12287 emit_call_insn (GEN_CALL (operands[0], const0_rtx, const0_rtx, const0_rtx));
12289 for (i = 0; i < XVECLEN (operands[2], 0); i++)
12291 rtx set = XVECEXP (operands[2], 0, i);
12292 emit_move_insn (SET_DEST (set), SET_SRC (set));
12295 /* The optimizer does not know that the call sets the function value
12296 registers we stored in the result block. We avoid problems by
12297 claiming that all hard registers are used and clobbered at this
12299 emit_insn (gen_blockage ());
12304 ;; sibling call patterns
12305 (define_expand "sibcall"
12306 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
12307 (match_operand 1 "" ""))
12308 (use (match_operand 2 "" ""))
12309 (use (reg:SI LR_REGNO))
12315 if (MACHOPIC_INDIRECT)
12316 operands[0] = machopic_indirect_call_target (operands[0]);
12319 gcc_assert (GET_CODE (operands[0]) == MEM);
12320 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
12322 operands[0] = XEXP (operands[0], 0);
12325 ;; this and similar patterns must be marked as using LR, otherwise
12326 ;; dataflow will try to delete the store into it. This is true
12327 ;; even when the actual reg to jump to is in CTR, when LR was
12328 ;; saved and restored around the PIC-setting BCL.
12329 (define_insn "*sibcall_local32"
12330 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
12331 (match_operand 1 "" "g,g"))
12332 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12333 (use (reg:SI LR_REGNO))
12335 "(INTVAL (operands[2]) & CALL_LONG) == 0"
12338 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12339 output_asm_insn (\"crxor 6,6,6\", operands);
12341 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12342 output_asm_insn (\"creqv 6,6,6\", operands);
12344 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
12346 [(set_attr "type" "branch")
12347 (set_attr "length" "4,8")])
12349 (define_insn "*sibcall_local64"
12350 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
12351 (match_operand 1 "" "g,g"))
12352 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12353 (use (reg:SI LR_REGNO))
12355 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
12358 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12359 output_asm_insn (\"crxor 6,6,6\", operands);
12361 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12362 output_asm_insn (\"creqv 6,6,6\", operands);
12364 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
12366 [(set_attr "type" "branch")
12367 (set_attr "length" "4,8")])
12369 (define_insn "*sibcall_value_local32"
12370 [(set (match_operand 0 "" "")
12371 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
12372 (match_operand 2 "" "g,g")))
12373 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12374 (use (reg:SI LR_REGNO))
12376 "(INTVAL (operands[3]) & CALL_LONG) == 0"
12379 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12380 output_asm_insn (\"crxor 6,6,6\", operands);
12382 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12383 output_asm_insn (\"creqv 6,6,6\", operands);
12385 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
12387 [(set_attr "type" "branch")
12388 (set_attr "length" "4,8")])
12391 (define_insn "*sibcall_value_local64"
12392 [(set (match_operand 0 "" "")
12393 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
12394 (match_operand 2 "" "g,g")))
12395 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12396 (use (reg:SI LR_REGNO))
12398 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
12401 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12402 output_asm_insn (\"crxor 6,6,6\", operands);
12404 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12405 output_asm_insn (\"creqv 6,6,6\", operands);
12407 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
12409 [(set_attr "type" "branch")
12410 (set_attr "length" "4,8")])
12412 (define_insn "*sibcall_nonlocal_aix32"
12413 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
12414 (match_operand 1 "" "g"))
12415 (use (match_operand:SI 2 "immediate_operand" "O"))
12416 (use (reg:SI LR_REGNO))
12419 && DEFAULT_ABI == ABI_AIX
12420 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12422 [(set_attr "type" "branch")
12423 (set_attr "length" "4")])
12425 (define_insn "*sibcall_nonlocal_aix64"
12426 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
12427 (match_operand 1 "" "g"))
12428 (use (match_operand:SI 2 "immediate_operand" "O"))
12429 (use (reg:SI LR_REGNO))
12432 && DEFAULT_ABI == ABI_AIX
12433 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12435 [(set_attr "type" "branch")
12436 (set_attr "length" "4")])
12438 (define_insn "*sibcall_value_nonlocal_aix32"
12439 [(set (match_operand 0 "" "")
12440 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
12441 (match_operand 2 "" "g")))
12442 (use (match_operand:SI 3 "immediate_operand" "O"))
12443 (use (reg:SI LR_REGNO))
12446 && DEFAULT_ABI == ABI_AIX
12447 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12449 [(set_attr "type" "branch")
12450 (set_attr "length" "4")])
12452 (define_insn "*sibcall_value_nonlocal_aix64"
12453 [(set (match_operand 0 "" "")
12454 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
12455 (match_operand 2 "" "g")))
12456 (use (match_operand:SI 3 "immediate_operand" "O"))
12457 (use (reg:SI LR_REGNO))
12460 && DEFAULT_ABI == ABI_AIX
12461 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12463 [(set_attr "type" "branch")
12464 (set_attr "length" "4")])
12466 (define_insn "*sibcall_nonlocal_sysv<mode>"
12467 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
12468 (match_operand 1 "" ""))
12469 (use (match_operand 2 "immediate_operand" "O,n"))
12470 (use (reg:SI LR_REGNO))
12472 "(DEFAULT_ABI == ABI_DARWIN
12473 || DEFAULT_ABI == ABI_V4)
12474 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12477 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12478 output_asm_insn (\"crxor 6,6,6\", operands);
12480 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12481 output_asm_insn (\"creqv 6,6,6\", operands);
12483 if (DEFAULT_ABI == ABI_V4 && flag_pic)
12485 gcc_assert (!TARGET_SECURE_PLT);
12486 return \"b %z0@plt\";
12491 [(set_attr "type" "branch,branch")
12492 (set_attr "length" "4,8")])
12494 (define_expand "sibcall_value"
12495 [(parallel [(set (match_operand 0 "register_operand" "")
12496 (call (mem:SI (match_operand 1 "address_operand" ""))
12497 (match_operand 2 "" "")))
12498 (use (match_operand 3 "" ""))
12499 (use (reg:SI LR_REGNO))
12505 if (MACHOPIC_INDIRECT)
12506 operands[1] = machopic_indirect_call_target (operands[1]);
12509 gcc_assert (GET_CODE (operands[1]) == MEM);
12510 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
12512 operands[1] = XEXP (operands[1], 0);
12515 (define_insn "*sibcall_value_nonlocal_sysv<mode>"
12516 [(set (match_operand 0 "" "")
12517 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
12518 (match_operand 2 "" "")))
12519 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12520 (use (reg:SI LR_REGNO))
12522 "(DEFAULT_ABI == ABI_DARWIN
12523 || DEFAULT_ABI == ABI_V4)
12524 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12527 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12528 output_asm_insn (\"crxor 6,6,6\", operands);
12530 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12531 output_asm_insn (\"creqv 6,6,6\", operands);
12533 if (DEFAULT_ABI == ABI_V4 && flag_pic)
12535 gcc_assert (!TARGET_SECURE_PLT);
12536 return \"b %z1@plt\";
12541 [(set_attr "type" "branch,branch")
12542 (set_attr "length" "4,8")])
12544 (define_expand "sibcall_epilogue"
12545 [(use (const_int 0))]
12546 "TARGET_SCHED_PROLOG"
12549 rs6000_emit_epilogue (TRUE);
12553 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
12554 ;; all of memory. This blocks insns from being moved across this point.
12556 (define_insn "blockage"
12557 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCK)]
12561 (define_insn "probe_stack"
12562 [(set (match_operand 0 "memory_operand" "=m")
12563 (unspec [(const_int 0)] UNSPEC_PROBE_STACK))]
12565 "{st%U0%X0|stw%U0%X0} 0,%0"
12566 [(set_attr "type" "store")
12567 (set_attr "length" "4")])
12569 ;; Compare insns are next. Note that the RS/6000 has two types of compares,
12570 ;; signed & unsigned, and one type of branch.
12572 ;; Start with the DEFINE_EXPANDs to generate the rtl for compares, scc
12573 ;; insns, and branches.
12575 (define_expand "cbranch<mode>4"
12576 [(use (match_operator 0 "rs6000_cbranch_operator"
12577 [(match_operand:GPR 1 "gpc_reg_operand" "")
12578 (match_operand:GPR 2 "reg_or_short_operand" "")]))
12579 (use (match_operand 3 ""))]
12583 /* Take care of the possibility that operands[2] might be negative but
12584 this might be a logical operation. That insn doesn't exist. */
12585 if (GET_CODE (operands[2]) == CONST_INT
12586 && INTVAL (operands[2]) < 0)
12588 operands[2] = force_reg (<MODE>mode, operands[2]);
12589 operands[0] = gen_rtx_fmt_ee (GET_CODE (operands[0]),
12590 GET_MODE (operands[0]),
12591 operands[1], operands[2]);
12594 rs6000_emit_cbranch (<MODE>mode, operands);
12598 (define_expand "cbranch<mode>4"
12599 [(use (match_operator 0 "rs6000_cbranch_operator"
12600 [(match_operand:FP 1 "gpc_reg_operand" "")
12601 (match_operand:FP 2 "gpc_reg_operand" "")]))
12602 (use (match_operand 3 ""))]
12606 rs6000_emit_cbranch (<MODE>mode, operands);
12610 (define_expand "cstore<mode>4"
12611 [(use (match_operator 1 "rs6000_cbranch_operator"
12612 [(match_operand:GPR 2 "gpc_reg_operand" "")
12613 (match_operand:GPR 3 "reg_or_short_operand" "")]))
12614 (clobber (match_operand:SI 0 "register_operand"))]
12618 /* Take care of the possibility that operands[3] might be negative but
12619 this might be a logical operation. That insn doesn't exist. */
12620 if (GET_CODE (operands[3]) == CONST_INT
12621 && INTVAL (operands[3]) < 0)
12623 operands[3] = force_reg (<MODE>mode, operands[3]);
12624 operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]),
12625 GET_MODE (operands[1]),
12626 operands[2], operands[3]);
12629 /* For SNE, we would prefer that the xor/abs sequence be used for integers.
12630 For SEQ, likewise, except that comparisons with zero should be done
12631 with an scc insns. However, due to the order that combine see the
12632 resulting insns, we must, in fact, allow SEQ for integers. Fail in
12633 the cases we don't want to handle or are best handled by portable
12635 if (GET_CODE (operands[1]) == NE)
12637 if ((GET_CODE (operands[1]) == LT || GET_CODE (operands[1]) == LE
12638 || GET_CODE (operands[1]) == GT || GET_CODE (operands[1]) == GE)
12639 && operands[3] == const0_rtx)
12641 rs6000_emit_sCOND (<MODE>mode, operands);
12645 (define_expand "cstore<mode>4"
12646 [(use (match_operator 1 "rs6000_cbranch_operator"
12647 [(match_operand:FP 2 "gpc_reg_operand" "")
12648 (match_operand:FP 3 "gpc_reg_operand" "")]))
12649 (clobber (match_operand:SI 0 "register_operand"))]
12653 rs6000_emit_sCOND (<MODE>mode, operands);
12658 (define_expand "stack_protect_set"
12659 [(match_operand 0 "memory_operand" "")
12660 (match_operand 1 "memory_operand" "")]
12663 #ifdef TARGET_THREAD_SSP_OFFSET
12664 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
12665 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
12666 operands[1] = gen_rtx_MEM (Pmode, addr);
12669 emit_insn (gen_stack_protect_setdi (operands[0], operands[1]));
12671 emit_insn (gen_stack_protect_setsi (operands[0], operands[1]));
12675 (define_insn "stack_protect_setsi"
12676 [(set (match_operand:SI 0 "memory_operand" "=m")
12677 (unspec:SI [(match_operand:SI 1 "memory_operand" "m")] UNSPEC_SP_SET))
12678 (set (match_scratch:SI 2 "=&r") (const_int 0))]
12680 "{l%U1%X1|lwz%U1%X1} %2,%1\;{st%U0%X0|stw%U0%X0} %2,%0\;{lil|li} %2,0"
12681 [(set_attr "type" "three")
12682 (set_attr "length" "12")])
12684 (define_insn "stack_protect_setdi"
12685 [(set (match_operand:DI 0 "memory_operand" "=m")
12686 (unspec:DI [(match_operand:DI 1 "memory_operand" "m")] UNSPEC_SP_SET))
12687 (set (match_scratch:DI 2 "=&r") (const_int 0))]
12689 "ld%U1%X1 %2,%1\;std%U0%X0 %2,%0\;{lil|li} %2,0"
12690 [(set_attr "type" "three")
12691 (set_attr "length" "12")])
12693 (define_expand "stack_protect_test"
12694 [(match_operand 0 "memory_operand" "")
12695 (match_operand 1 "memory_operand" "")
12696 (match_operand 2 "" "")]
12699 rtx test, op0, op1;
12700 #ifdef TARGET_THREAD_SSP_OFFSET
12701 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
12702 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
12703 operands[1] = gen_rtx_MEM (Pmode, addr);
12706 op1 = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, operands[1]), UNSPEC_SP_TEST);
12707 test = gen_rtx_EQ (VOIDmode, op0, op1);
12708 emit_jump_insn (gen_cbranchsi4 (test, op0, op1, operands[2]));
12712 (define_insn "stack_protect_testsi"
12713 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
12714 (unspec:CCEQ [(match_operand:SI 1 "memory_operand" "m,m")
12715 (match_operand:SI 2 "memory_operand" "m,m")]
12717 (set (match_scratch:SI 4 "=r,r") (const_int 0))
12718 (clobber (match_scratch:SI 3 "=&r,&r"))]
12721 {l%U1%X1|lwz%U1%X1} %3,%1\;{l%U2%X2|lwz%U2%X2} %4,%2\;xor. %3,%3,%4\;{lil|li} %4,0
12722 {l%U1%X1|lwz%U1%X1} %3,%1\;{l%U2%X2|lwz%U2%X2} %4,%2\;{cmpl|cmplw} %0,%3,%4\;{lil|li} %3,0\;{lil|li} %4,0"
12723 [(set_attr "length" "16,20")])
12725 (define_insn "stack_protect_testdi"
12726 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
12727 (unspec:CCEQ [(match_operand:DI 1 "memory_operand" "m,m")
12728 (match_operand:DI 2 "memory_operand" "m,m")]
12730 (set (match_scratch:DI 4 "=r,r") (const_int 0))
12731 (clobber (match_scratch:DI 3 "=&r,&r"))]
12734 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;xor. %3,%3,%4\;{lil|li} %4,0
12735 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;cmpld %0,%3,%4\;{lil|li} %3,0\;{lil|li} %4,0"
12736 [(set_attr "length" "16,20")])
12739 ;; Here are the actual compare insns.
12740 (define_insn "*cmp<mode>_internal1"
12741 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
12742 (compare:CC (match_operand:GPR 1 "gpc_reg_operand" "r")
12743 (match_operand:GPR 2 "reg_or_short_operand" "rI")))]
12745 "{cmp%I2|cmp<wd>%I2} %0,%1,%2"
12746 [(set_attr "type" "cmp")])
12748 ;; If we are comparing a register for equality with a large constant,
12749 ;; we can do this with an XOR followed by a compare. But this is profitable
12750 ;; only if the large constant is only used for the comparison (and in this
12751 ;; case we already have a register to reuse as scratch).
12753 ;; For 64-bit registers, we could only do so if the constant's bit 15 is clear:
12754 ;; otherwise we'd need to XOR with FFFFFFFF????0000 which is not available.
12757 [(set (match_operand:SI 0 "register_operand")
12758 (match_operand:SI 1 "logical_const_operand" ""))
12759 (set (match_dup 0) (match_operator:SI 3 "boolean_or_operator"
12761 (match_operand:SI 2 "logical_const_operand" "")]))
12762 (set (match_operand:CC 4 "cc_reg_operand" "")
12763 (compare:CC (match_operand:SI 5 "gpc_reg_operand" "")
12766 (if_then_else (match_operator 6 "equality_operator"
12767 [(match_dup 4) (const_int 0)])
12768 (match_operand 7 "" "")
12769 (match_operand 8 "" "")))]
12770 "peep2_reg_dead_p (3, operands[0])
12771 && peep2_reg_dead_p (4, operands[4])"
12772 [(set (match_dup 0) (xor:SI (match_dup 5) (match_dup 9)))
12773 (set (match_dup 4) (compare:CC (match_dup 0) (match_dup 10)))
12774 (set (pc) (if_then_else (match_dup 6) (match_dup 7) (match_dup 8)))]
12777 /* Get the constant we are comparing against, and see what it looks like
12778 when sign-extended from 16 to 32 bits. Then see what constant we could
12779 XOR with SEXTC to get the sign-extended value. */
12780 rtx cnst = simplify_const_binary_operation (GET_CODE (operands[3]),
12782 operands[1], operands[2]);
12783 HOST_WIDE_INT c = INTVAL (cnst);
12784 HOST_WIDE_INT sextc = ((c & 0xffff) ^ 0x8000) - 0x8000;
12785 HOST_WIDE_INT xorv = c ^ sextc;
12787 operands[9] = GEN_INT (xorv);
12788 operands[10] = GEN_INT (sextc);
12791 (define_insn "*cmpsi_internal2"
12792 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
12793 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
12794 (match_operand:SI 2 "reg_or_u_short_operand" "rK")))]
12796 "{cmpl%I2|cmplw%I2} %0,%1,%b2"
12797 [(set_attr "type" "cmp")])
12799 (define_insn "*cmpdi_internal2"
12800 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
12801 (compare:CCUNS (match_operand:DI 1 "gpc_reg_operand" "r")
12802 (match_operand:DI 2 "reg_or_u_short_operand" "rK")))]
12804 "cmpld%I2 %0,%1,%b2"
12805 [(set_attr "type" "cmp")])
12807 ;; The following two insns don't exist as single insns, but if we provide
12808 ;; them, we can swap an add and compare, which will enable us to overlap more
12809 ;; of the required delay between a compare and branch. We generate code for
12810 ;; them by splitting.
12813 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
12814 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
12815 (match_operand:SI 2 "short_cint_operand" "i")))
12816 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
12817 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
12820 [(set_attr "length" "8")])
12823 [(set (match_operand:CCUNS 3 "cc_reg_operand" "=y")
12824 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
12825 (match_operand:SI 2 "u_short_cint_operand" "i")))
12826 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
12827 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
12830 [(set_attr "length" "8")])
12833 [(set (match_operand:CC 3 "cc_reg_operand" "")
12834 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
12835 (match_operand:SI 2 "short_cint_operand" "")))
12836 (set (match_operand:SI 0 "gpc_reg_operand" "")
12837 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
12839 [(set (match_dup 3) (compare:CC (match_dup 1) (match_dup 2)))
12840 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
12843 [(set (match_operand:CCUNS 3 "cc_reg_operand" "")
12844 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "")
12845 (match_operand:SI 2 "u_short_cint_operand" "")))
12846 (set (match_operand:SI 0 "gpc_reg_operand" "")
12847 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
12849 [(set (match_dup 3) (compare:CCUNS (match_dup 1) (match_dup 2)))
12850 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
12852 (define_insn "*cmpsf_internal1"
12853 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
12854 (compare:CCFP (match_operand:SF 1 "gpc_reg_operand" "f")
12855 (match_operand:SF 2 "gpc_reg_operand" "f")))]
12856 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
12858 [(set_attr "type" "fpcompare")])
12860 (define_insn "*cmpdf_internal1"
12861 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
12862 (compare:CCFP (match_operand:DF 1 "gpc_reg_operand" "d")
12863 (match_operand:DF 2 "gpc_reg_operand" "d")))]
12864 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
12865 && !VECTOR_UNIT_VSX_P (DFmode)"
12867 [(set_attr "type" "fpcompare")])
12869 ;; Only need to compare second words if first words equal
12870 (define_insn "*cmptf_internal1"
12871 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
12872 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "d")
12873 (match_operand:TF 2 "gpc_reg_operand" "d")))]
12874 "!TARGET_IEEEQUAD && !TARGET_XL_COMPAT
12875 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LONG_DOUBLE_128"
12876 "fcmpu %0,%1,%2\;bne %0,$+8\;fcmpu %0,%L1,%L2"
12877 [(set_attr "type" "fpcompare")
12878 (set_attr "length" "12")])
12880 (define_insn_and_split "*cmptf_internal2"
12881 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
12882 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "d")
12883 (match_operand:TF 2 "gpc_reg_operand" "d")))
12884 (clobber (match_scratch:DF 3 "=d"))
12885 (clobber (match_scratch:DF 4 "=d"))
12886 (clobber (match_scratch:DF 5 "=d"))
12887 (clobber (match_scratch:DF 6 "=d"))
12888 (clobber (match_scratch:DF 7 "=d"))
12889 (clobber (match_scratch:DF 8 "=d"))
12890 (clobber (match_scratch:DF 9 "=d"))
12891 (clobber (match_scratch:DF 10 "=d"))]
12892 "!TARGET_IEEEQUAD && TARGET_XL_COMPAT
12893 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LONG_DOUBLE_128"
12895 "&& reload_completed"
12896 [(set (match_dup 3) (match_dup 13))
12897 (set (match_dup 4) (match_dup 14))
12898 (set (match_dup 9) (abs:DF (match_dup 5)))
12899 (set (match_dup 0) (compare:CCFP (match_dup 9) (match_dup 3)))
12900 (set (pc) (if_then_else (ne (match_dup 0) (const_int 0))
12901 (label_ref (match_dup 11))
12903 (set (match_dup 0) (compare:CCFP (match_dup 5) (match_dup 7)))
12904 (set (pc) (label_ref (match_dup 12)))
12906 (set (match_dup 10) (minus:DF (match_dup 5) (match_dup 7)))
12907 (set (match_dup 9) (minus:DF (match_dup 6) (match_dup 8)))
12908 (set (match_dup 9) (plus:DF (match_dup 10) (match_dup 9)))
12909 (set (match_dup 0) (compare:CCFP (match_dup 7) (match_dup 4)))
12912 REAL_VALUE_TYPE rv;
12913 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
12914 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
12916 operands[5] = simplify_gen_subreg (DFmode, operands[1], TFmode, hi_word);
12917 operands[6] = simplify_gen_subreg (DFmode, operands[1], TFmode, lo_word);
12918 operands[7] = simplify_gen_subreg (DFmode, operands[2], TFmode, hi_word);
12919 operands[8] = simplify_gen_subreg (DFmode, operands[2], TFmode, lo_word);
12920 operands[11] = gen_label_rtx ();
12921 operands[12] = gen_label_rtx ();
12923 operands[13] = force_const_mem (DFmode,
12924 CONST_DOUBLE_FROM_REAL_VALUE (rv, DFmode));
12925 operands[14] = force_const_mem (DFmode,
12926 CONST_DOUBLE_FROM_REAL_VALUE (dconst0,
12930 operands[13] = gen_const_mem (DFmode,
12931 create_TOC_reference (XEXP (operands[13], 0)));
12932 operands[14] = gen_const_mem (DFmode,
12933 create_TOC_reference (XEXP (operands[14], 0)));
12934 set_mem_alias_set (operands[13], get_TOC_alias_set ());
12935 set_mem_alias_set (operands[14], get_TOC_alias_set ());
12939 ;; Now we have the scc insns. We can do some combinations because of the
12940 ;; way the machine works.
12942 ;; Note that this is probably faster if we can put an insn between the
12943 ;; mfcr and rlinm, but this is tricky. Let's leave it for now. In most
12944 ;; cases the insns below which don't use an intermediate CR field will
12945 ;; be used instead.
12947 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12948 (match_operator:SI 1 "scc_comparison_operator"
12949 [(match_operand 2 "cc_reg_operand" "y")
12952 "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1"
12953 [(set (attr "type")
12954 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
12955 (const_string "mfcrf")
12957 (const_string "mfcr")))
12958 (set_attr "length" "8")])
12960 ;; Same as above, but get the GT bit.
12961 (define_insn "move_from_CR_gt_bit"
12962 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12963 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_GT))]
12964 "TARGET_HARD_FLOAT && !TARGET_FPRS"
12965 "mfcr %0\;{rlinm|rlwinm} %0,%0,%D1,31,31"
12966 [(set_attr "type" "mfcr")
12967 (set_attr "length" "8")])
12969 ;; Same as above, but get the OV/ORDERED bit.
12970 (define_insn "move_from_CR_ov_bit"
12971 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12972 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_OV))]
12974 "mfcr %0\;{rlinm|rlwinm} %0,%0,%t1,1"
12975 [(set_attr "type" "mfcr")
12976 (set_attr "length" "8")])
12979 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12980 (match_operator:DI 1 "scc_comparison_operator"
12981 [(match_operand 2 "cc_reg_operand" "y")
12984 "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1"
12985 [(set (attr "type")
12986 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
12987 (const_string "mfcrf")
12989 (const_string "mfcr")))
12990 (set_attr "length" "8")])
12993 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12994 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
12995 [(match_operand 2 "cc_reg_operand" "y,y")
12998 (set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
12999 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
13002 mfcr %3%Q2\;{rlinm.|rlwinm.} %3,%3,%J1,1
13004 [(set_attr "type" "delayed_compare")
13005 (set_attr "length" "8,16")])
13008 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13009 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
13010 [(match_operand 2 "cc_reg_operand" "")
13013 (set (match_operand:SI 3 "gpc_reg_operand" "")
13014 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
13015 "TARGET_32BIT && reload_completed"
13016 [(set (match_dup 3)
13017 (match_op_dup 1 [(match_dup 2) (const_int 0)]))
13019 (compare:CC (match_dup 3)
13024 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13025 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
13026 [(match_operand 2 "cc_reg_operand" "y")
13028 (match_operand:SI 3 "const_int_operand" "n")))]
13032 int is_bit = ccr_bit (operands[1], 1);
13033 int put_bit = 31 - (INTVAL (operands[3]) & 31);
13036 if (is_bit >= put_bit)
13037 count = is_bit - put_bit;
13039 count = 32 - (put_bit - is_bit);
13041 operands[4] = GEN_INT (count);
13042 operands[5] = GEN_INT (put_bit);
13044 return \"mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%4,%5,%5\";
13046 [(set (attr "type")
13047 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
13048 (const_string "mfcrf")
13050 (const_string "mfcr")))
13051 (set_attr "length" "8")])
13054 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13056 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
13057 [(match_operand 2 "cc_reg_operand" "y,y")
13059 (match_operand:SI 3 "const_int_operand" "n,n"))
13061 (set (match_operand:SI 4 "gpc_reg_operand" "=r,r")
13062 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
13067 int is_bit = ccr_bit (operands[1], 1);
13068 int put_bit = 31 - (INTVAL (operands[3]) & 31);
13071 /* Force split for non-cc0 compare. */
13072 if (which_alternative == 1)
13075 if (is_bit >= put_bit)
13076 count = is_bit - put_bit;
13078 count = 32 - (put_bit - is_bit);
13080 operands[5] = GEN_INT (count);
13081 operands[6] = GEN_INT (put_bit);
13083 return \"mfcr %4%Q2\;{rlinm.|rlwinm.} %4,%4,%5,%6,%6\";
13085 [(set_attr "type" "delayed_compare")
13086 (set_attr "length" "8,16")])
13089 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
13091 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
13092 [(match_operand 2 "cc_reg_operand" "")
13094 (match_operand:SI 3 "const_int_operand" ""))
13096 (set (match_operand:SI 4 "gpc_reg_operand" "")
13097 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
13100 [(set (match_dup 4)
13101 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
13104 (compare:CC (match_dup 4)
13108 ;; There is a 3 cycle delay between consecutive mfcr instructions
13109 ;; so it is useful to combine 2 scc instructions to use only one mfcr.
13112 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13113 (match_operator:SI 1 "scc_comparison_operator"
13114 [(match_operand 2 "cc_reg_operand" "y")
13116 (set (match_operand:SI 3 "gpc_reg_operand" "=r")
13117 (match_operator:SI 4 "scc_comparison_operator"
13118 [(match_operand 5 "cc_reg_operand" "y")
13120 "REGNO (operands[2]) != REGNO (operands[5])"
13121 "mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
13122 [(set_attr "type" "mfcr")
13123 (set_attr "length" "12")])
13126 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13127 (match_operator:DI 1 "scc_comparison_operator"
13128 [(match_operand 2 "cc_reg_operand" "y")
13130 (set (match_operand:DI 3 "gpc_reg_operand" "=r")
13131 (match_operator:DI 4 "scc_comparison_operator"
13132 [(match_operand 5 "cc_reg_operand" "y")
13134 "TARGET_POWERPC64 && REGNO (operands[2]) != REGNO (operands[5])"
13135 "mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
13136 [(set_attr "type" "mfcr")
13137 (set_attr "length" "12")])
13139 ;; There are some scc insns that can be done directly, without a compare.
13140 ;; These are faster because they don't involve the communications between
13141 ;; the FXU and branch units. In fact, we will be replacing all of the
13142 ;; integer scc insns here or in the portable methods in emit_store_flag.
13144 ;; Also support (neg (scc ..)) since that construct is used to replace
13145 ;; branches, (plus (scc ..) ..) since that construct is common and
13146 ;; takes no more insns than scc, and (and (neg (scc ..)) ..) in the
13147 ;; cases where it is no more expensive than (neg (scc ..)).
13149 ;; Have reload force a constant into a register for the simple insns that
13150 ;; otherwise won't accept constants. We do this because it is faster than
13151 ;; the cmp/mfcr sequence we would otherwise generate.
13153 (define_mode_attr scc_eq_op2 [(SI "rKLI")
13156 (define_insn_and_split "*eq<mode>"
13157 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
13158 (eq:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
13159 (match_operand:GPR 2 "scc_eq_operand" "<scc_eq_op2>")))]
13163 [(set (match_dup 0)
13164 (clz:GPR (match_dup 3)))
13166 (lshiftrt:GPR (match_dup 0) (match_dup 4)))]
13168 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
13170 /* Use output operand as intermediate. */
13171 operands[3] = operands[0];
13173 if (logical_operand (operands[2], <MODE>mode))
13174 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13175 gen_rtx_XOR (<MODE>mode,
13176 operands[1], operands[2])));
13178 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13179 gen_rtx_PLUS (<MODE>mode, operands[1],
13180 negate_rtx (<MODE>mode,
13184 operands[3] = operands[1];
13186 operands[4] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
13189 (define_insn_and_split "*eq<mode>_compare"
13190 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
13192 (eq:P (match_operand:P 1 "gpc_reg_operand" "=r")
13193 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))
13195 (set (match_operand:P 0 "gpc_reg_operand" "=r")
13196 (eq:P (match_dup 1) (match_dup 2)))]
13197 "!TARGET_POWER && optimize_size"
13199 "!TARGET_POWER && optimize_size"
13200 [(set (match_dup 0)
13201 (clz:P (match_dup 4)))
13202 (parallel [(set (match_dup 3)
13203 (compare:CC (lshiftrt:P (match_dup 0) (match_dup 5))
13206 (lshiftrt:P (match_dup 0) (match_dup 5)))])]
13208 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
13210 /* Use output operand as intermediate. */
13211 operands[4] = operands[0];
13213 if (logical_operand (operands[2], <MODE>mode))
13214 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
13215 gen_rtx_XOR (<MODE>mode,
13216 operands[1], operands[2])));
13218 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
13219 gen_rtx_PLUS (<MODE>mode, operands[1],
13220 negate_rtx (<MODE>mode,
13224 operands[4] = operands[1];
13226 operands[5] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
13229 (define_insn "*eqsi_power"
13230 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
13231 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
13232 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I")))
13233 (clobber (match_scratch:SI 3 "=r,&r,r,r,r"))]
13236 xor %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
13237 {sfi|subfic} %3,%1,0\;{ae|adde} %0,%3,%1
13238 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
13239 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
13240 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0"
13241 [(set_attr "type" "three,two,three,three,three")
13242 (set_attr "length" "12,8,12,12,12")])
13244 ;; We have insns of the form shown by the first define_insn below. If
13245 ;; there is something inside the comparison operation, we must split it.
13247 [(set (match_operand:SI 0 "gpc_reg_operand" "")
13248 (plus:SI (match_operator 1 "comparison_operator"
13249 [(match_operand:SI 2 "" "")
13250 (match_operand:SI 3
13251 "reg_or_cint_operand" "")])
13252 (match_operand:SI 4 "gpc_reg_operand" "")))
13253 (clobber (match_operand:SI 5 "register_operand" ""))]
13254 "! gpc_reg_operand (operands[2], SImode)"
13255 [(set (match_dup 5) (match_dup 2))
13256 (set (match_dup 2) (plus:SI (match_op_dup 1 [(match_dup 2) (match_dup 3)])
13259 (define_insn "*plus_eqsi"
13260 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r")
13261 (plus:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
13262 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I"))
13263 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r")))]
13266 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
13267 {sfi|subfic} %0,%1,0\;{aze|addze} %0,%3
13268 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
13269 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
13270 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
13271 [(set_attr "type" "three,two,three,three,three")
13272 (set_attr "length" "12,8,12,12,12")])
13274 (define_insn "*compare_plus_eqsi"
13275 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
13278 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
13279 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
13280 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
13282 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r"))]
13283 "TARGET_32BIT && optimize_size"
13285 xor %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
13286 {sfi|subfic} %4,%1,0\;{aze.|addze.} %4,%3
13287 {xoril|xori} %4,%1,%b2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
13288 {xoriu|xoris} %4,%1,%u2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
13289 {sfi|subfic} %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
13295 [(set_attr "type" "compare")
13296 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
13299 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13302 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
13303 (match_operand:SI 2 "scc_eq_operand" ""))
13304 (match_operand:SI 3 "gpc_reg_operand" ""))
13306 (clobber (match_scratch:SI 4 ""))]
13307 "TARGET_32BIT && optimize_size && reload_completed"
13308 [(set (match_dup 4)
13309 (plus:SI (eq:SI (match_dup 1)
13313 (compare:CC (match_dup 4)
13317 (define_insn "*plus_eqsi_compare"
13318 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
13321 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
13322 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
13323 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
13325 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r")
13326 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13327 "TARGET_32BIT && optimize_size"
13329 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
13330 {sfi|subfic} %0,%1,0\;{aze.|addze.} %0,%3
13331 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
13332 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
13333 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
13339 [(set_attr "type" "compare")
13340 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
13343 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13346 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
13347 (match_operand:SI 2 "scc_eq_operand" ""))
13348 (match_operand:SI 3 "gpc_reg_operand" ""))
13350 (set (match_operand:SI 0 "gpc_reg_operand" "")
13351 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13352 "TARGET_32BIT && optimize_size && reload_completed"
13353 [(set (match_dup 0)
13354 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13356 (compare:CC (match_dup 0)
13360 (define_insn "*neg_eq0<mode>"
13361 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13362 (neg:P (eq:P (match_operand:P 1 "gpc_reg_operand" "r")
13365 "{ai|addic} %0,%1,-1\;{sfe|subfe} %0,%0,%0"
13366 [(set_attr "type" "two")
13367 (set_attr "length" "8")])
13369 (define_insn_and_split "*neg_eq<mode>"
13370 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13371 (neg:P (eq:P (match_operand:P 1 "gpc_reg_operand" "%r")
13372 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))))]
13376 [(set (match_dup 0) (neg:P (eq:P (match_dup 3) (const_int 0))))]
13378 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
13380 /* Use output operand as intermediate. */
13381 operands[3] = operands[0];
13383 if (logical_operand (operands[2], <MODE>mode))
13384 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13385 gen_rtx_XOR (<MODE>mode,
13386 operands[1], operands[2])));
13388 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13389 gen_rtx_PLUS (<MODE>mode, operands[1],
13390 negate_rtx (<MODE>mode,
13394 operands[3] = operands[1];
13397 ;; Simplify (ne X (const_int 0)) on the PowerPC. No need to on the Power,
13398 ;; since it nabs/sr is just as fast.
13399 (define_insn "*ne0si"
13400 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
13401 (lshiftrt:SI (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
13403 (clobber (match_scratch:SI 2 "=&r"))]
13404 "! TARGET_POWER && TARGET_32BIT && !TARGET_ISEL"
13405 "{ai|addic} %2,%1,-1\;{sfe|subfe} %0,%2,%1"
13406 [(set_attr "type" "two")
13407 (set_attr "length" "8")])
13409 (define_insn "*ne0di"
13410 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13411 (lshiftrt:DI (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
13413 (clobber (match_scratch:DI 2 "=&r"))]
13415 "addic %2,%1,-1\;subfe %0,%2,%1"
13416 [(set_attr "type" "two")
13417 (set_attr "length" "8")])
13419 ;; This is what (plus (ne X (const_int 0)) Y) looks like.
13420 (define_insn "*plus_ne0si"
13421 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13422 (plus:SI (lshiftrt:SI
13423 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
13425 (match_operand:SI 2 "gpc_reg_operand" "r")))
13426 (clobber (match_scratch:SI 3 "=&r"))]
13428 "{ai|addic} %3,%1,-1\;{aze|addze} %0,%2"
13429 [(set_attr "type" "two")
13430 (set_attr "length" "8")])
13432 (define_insn "*plus_ne0di"
13433 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13434 (plus:DI (lshiftrt:DI
13435 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
13437 (match_operand:DI 2 "gpc_reg_operand" "r")))
13438 (clobber (match_scratch:DI 3 "=&r"))]
13440 "addic %3,%1,-1\;addze %0,%2"
13441 [(set_attr "type" "two")
13442 (set_attr "length" "8")])
13444 (define_insn "*compare_plus_ne0si"
13445 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13447 (plus:SI (lshiftrt:SI
13448 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
13450 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
13452 (clobber (match_scratch:SI 3 "=&r,&r"))
13453 (clobber (match_scratch:SI 4 "=X,&r"))]
13456 {ai|addic} %3,%1,-1\;{aze.|addze.} %3,%2
13458 [(set_attr "type" "compare")
13459 (set_attr "length" "8,12")])
13462 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13464 (plus:SI (lshiftrt:SI
13465 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
13467 (match_operand:SI 2 "gpc_reg_operand" ""))
13469 (clobber (match_scratch:SI 3 ""))
13470 (clobber (match_scratch:SI 4 ""))]
13471 "TARGET_32BIT && reload_completed"
13472 [(parallel [(set (match_dup 3)
13473 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1)))
13476 (clobber (match_dup 4))])
13478 (compare:CC (match_dup 3)
13482 (define_insn "*compare_plus_ne0di"
13483 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13485 (plus:DI (lshiftrt:DI
13486 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
13488 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
13490 (clobber (match_scratch:DI 3 "=&r,&r"))]
13493 addic %3,%1,-1\;addze. %3,%2
13495 [(set_attr "type" "compare")
13496 (set_attr "length" "8,12")])
13499 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
13501 (plus:DI (lshiftrt:DI
13502 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
13504 (match_operand:DI 2 "gpc_reg_operand" ""))
13506 (clobber (match_scratch:DI 3 ""))]
13507 "TARGET_64BIT && reload_completed"
13508 [(set (match_dup 3)
13509 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1)))
13513 (compare:CC (match_dup 3)
13517 (define_insn "*plus_ne0si_compare"
13518 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13520 (plus:SI (lshiftrt:SI
13521 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
13523 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
13525 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13526 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
13528 (clobber (match_scratch:SI 3 "=&r,&r"))]
13531 {ai|addic} %3,%1,-1\;{aze.|addze.} %0,%2
13533 [(set_attr "type" "compare")
13534 (set_attr "length" "8,12")])
13537 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13539 (plus:SI (lshiftrt:SI
13540 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
13542 (match_operand:SI 2 "gpc_reg_operand" ""))
13544 (set (match_operand:SI 0 "gpc_reg_operand" "")
13545 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
13547 (clobber (match_scratch:SI 3 ""))]
13548 "TARGET_32BIT && reload_completed"
13549 [(parallel [(set (match_dup 0)
13550 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
13552 (clobber (match_dup 3))])
13554 (compare:CC (match_dup 0)
13558 (define_insn "*plus_ne0di_compare"
13559 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13561 (plus:DI (lshiftrt:DI
13562 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
13564 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
13566 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
13567 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
13569 (clobber (match_scratch:DI 3 "=&r,&r"))]
13572 addic %3,%1,-1\;addze. %0,%2
13574 [(set_attr "type" "compare")
13575 (set_attr "length" "8,12")])
13578 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
13580 (plus:DI (lshiftrt:DI
13581 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
13583 (match_operand:DI 2 "gpc_reg_operand" ""))
13585 (set (match_operand:DI 0 "gpc_reg_operand" "")
13586 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
13588 (clobber (match_scratch:DI 3 ""))]
13589 "TARGET_64BIT && reload_completed"
13590 [(parallel [(set (match_dup 0)
13591 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
13593 (clobber (match_dup 3))])
13595 (compare:CC (match_dup 0)
13600 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13601 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13602 (match_operand:SI 2 "reg_or_short_operand" "r,O")))
13603 (clobber (match_scratch:SI 3 "=r,X"))]
13606 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3
13607 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri|srwi} %0,%0,31"
13608 [(set_attr "length" "12")])
13611 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13613 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13614 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
13616 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
13617 (le:SI (match_dup 1) (match_dup 2)))
13618 (clobber (match_scratch:SI 3 "=r,X,r,X"))]
13621 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
13622 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri.|srwi.} %0,%0,31
13625 [(set_attr "type" "compare,delayed_compare,compare,delayed_compare")
13626 (set_attr "length" "12,12,16,16")])
13629 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13631 (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
13632 (match_operand:SI 2 "reg_or_short_operand" ""))
13634 (set (match_operand:SI 0 "gpc_reg_operand" "")
13635 (le:SI (match_dup 1) (match_dup 2)))
13636 (clobber (match_scratch:SI 3 ""))]
13637 "TARGET_POWER && reload_completed"
13638 [(parallel [(set (match_dup 0)
13639 (le:SI (match_dup 1) (match_dup 2)))
13640 (clobber (match_dup 3))])
13642 (compare:CC (match_dup 0)
13647 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13648 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13649 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
13650 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
13653 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
13654 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze|addze} %0,%3"
13655 [(set_attr "length" "12")])
13658 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13660 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13661 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
13662 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13664 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
13667 doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
13668 {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze.|addze.} %4,%3
13671 [(set_attr "type" "compare")
13672 (set_attr "length" "12,12,16,16")])
13675 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13677 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
13678 (match_operand:SI 2 "reg_or_short_operand" ""))
13679 (match_operand:SI 3 "gpc_reg_operand" ""))
13681 (clobber (match_scratch:SI 4 ""))]
13682 "TARGET_POWER && reload_completed"
13683 [(set (match_dup 4)
13684 (plus:SI (le:SI (match_dup 1) (match_dup 2))
13687 (compare:CC (match_dup 4)
13692 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13694 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13695 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
13696 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13698 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13699 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13702 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
13703 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze.|addze.} %0,%3
13706 [(set_attr "type" "compare")
13707 (set_attr "length" "12,12,16,16")])
13710 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13712 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
13713 (match_operand:SI 2 "reg_or_short_operand" ""))
13714 (match_operand:SI 3 "gpc_reg_operand" ""))
13716 (set (match_operand:SI 0 "gpc_reg_operand" "")
13717 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13718 "TARGET_POWER && reload_completed"
13719 [(set (match_dup 0)
13720 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13722 (compare:CC (match_dup 0)
13727 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13728 (neg:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13729 (match_operand:SI 2 "reg_or_short_operand" "r,O"))))]
13732 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
13733 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{srai|srawi} %0,%0,31"
13734 [(set_attr "length" "12")])
13736 (define_insn "*leu<mode>"
13737 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13738 (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
13739 (match_operand:P 2 "reg_or_short_operand" "rI")))]
13741 "{sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
13742 [(set_attr "type" "three")
13743 (set_attr "length" "12")])
13745 (define_insn "*leu<mode>_compare"
13746 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13748 (leu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13749 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
13751 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13752 (leu:P (match_dup 1) (match_dup 2)))]
13755 {sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
13757 [(set_attr "type" "compare")
13758 (set_attr "length" "12,16")])
13761 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13763 (leu:P (match_operand:P 1 "gpc_reg_operand" "")
13764 (match_operand:P 2 "reg_or_short_operand" ""))
13766 (set (match_operand:P 0 "gpc_reg_operand" "")
13767 (leu:P (match_dup 1) (match_dup 2)))]
13769 [(set (match_dup 0)
13770 (leu:P (match_dup 1) (match_dup 2)))
13772 (compare:CC (match_dup 0)
13776 (define_insn "*plus_leu<mode>"
13777 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
13778 (plus:P (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
13779 (match_operand:P 2 "reg_or_short_operand" "rI"))
13780 (match_operand:P 3 "gpc_reg_operand" "r")))]
13782 "{sf%I2|subf%I2c} %0,%1,%2\;{aze|addze} %0,%3"
13783 [(set_attr "type" "two")
13784 (set_attr "length" "8")])
13787 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13789 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13790 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13791 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13793 (clobber (match_scratch:SI 4 "=&r,&r"))]
13796 {sf%I2|subf%I2c} %4,%1,%2\;{aze.|addze.} %4,%3
13798 [(set_attr "type" "compare")
13799 (set_attr "length" "8,12")])
13802 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13804 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13805 (match_operand:SI 2 "reg_or_short_operand" ""))
13806 (match_operand:SI 3 "gpc_reg_operand" ""))
13808 (clobber (match_scratch:SI 4 ""))]
13809 "TARGET_32BIT && reload_completed"
13810 [(set (match_dup 4)
13811 (plus:SI (leu:SI (match_dup 1) (match_dup 2))
13814 (compare:CC (match_dup 4)
13819 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13821 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13822 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13823 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13825 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13826 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13829 {sf%I2|subf%I2c} %0,%1,%2\;{aze.|addze.} %0,%3
13831 [(set_attr "type" "compare")
13832 (set_attr "length" "8,12")])
13835 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13837 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13838 (match_operand:SI 2 "reg_or_short_operand" ""))
13839 (match_operand:SI 3 "gpc_reg_operand" ""))
13841 (set (match_operand:SI 0 "gpc_reg_operand" "")
13842 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13843 "TARGET_32BIT && reload_completed"
13844 [(set (match_dup 0)
13845 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13847 (compare:CC (match_dup 0)
13851 (define_insn "*neg_leu<mode>"
13852 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13853 (neg:P (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
13854 (match_operand:P 2 "reg_or_short_operand" "rI"))))]
13856 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0"
13857 [(set_attr "type" "three")
13858 (set_attr "length" "12")])
13860 (define_insn "*and_neg_leu<mode>"
13861 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
13863 (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
13864 (match_operand:P 2 "reg_or_short_operand" "rI")))
13865 (match_operand:P 3 "gpc_reg_operand" "r")))]
13867 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
13868 [(set_attr "type" "three")
13869 (set_attr "length" "12")])
13872 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13875 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13876 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
13877 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13879 (clobber (match_scratch:SI 4 "=&r,&r"))]
13882 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
13884 [(set_attr "type" "compare")
13885 (set_attr "length" "12,16")])
13888 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13891 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13892 (match_operand:SI 2 "reg_or_short_operand" "")))
13893 (match_operand:SI 3 "gpc_reg_operand" ""))
13895 (clobber (match_scratch:SI 4 ""))]
13896 "TARGET_32BIT && reload_completed"
13897 [(set (match_dup 4)
13898 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
13901 (compare:CC (match_dup 4)
13906 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13909 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13910 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
13911 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13913 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13914 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13917 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
13919 [(set_attr "type" "compare")
13920 (set_attr "length" "12,16")])
13923 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13926 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13927 (match_operand:SI 2 "reg_or_short_operand" "")))
13928 (match_operand:SI 3 "gpc_reg_operand" ""))
13930 (set (match_operand:SI 0 "gpc_reg_operand" "")
13931 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13932 "TARGET_32BIT && reload_completed"
13933 [(set (match_dup 0)
13934 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
13937 (compare:CC (match_dup 0)
13942 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13943 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13944 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
13946 "doz%I2 %0,%1,%2\;nabs %0,%0\;{sri|srwi} %0,%0,31"
13947 [(set_attr "length" "12")])
13950 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13952 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13953 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13955 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13956 (lt:SI (match_dup 1) (match_dup 2)))]
13959 doz%I2 %0,%1,%2\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
13961 [(set_attr "type" "delayed_compare")
13962 (set_attr "length" "12,16")])
13965 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13967 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13968 (match_operand:SI 2 "reg_or_short_operand" ""))
13970 (set (match_operand:SI 0 "gpc_reg_operand" "")
13971 (lt:SI (match_dup 1) (match_dup 2)))]
13972 "TARGET_POWER && reload_completed"
13973 [(set (match_dup 0)
13974 (lt:SI (match_dup 1) (match_dup 2)))
13976 (compare:CC (match_dup 0)
13981 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
13982 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13983 (match_operand:SI 2 "reg_or_short_operand" "rI"))
13984 (match_operand:SI 3 "gpc_reg_operand" "r")))]
13986 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
13987 [(set_attr "length" "12")])
13990 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13992 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13993 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13994 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13996 (clobber (match_scratch:SI 4 "=&r,&r"))]
13999 doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
14001 [(set_attr "type" "compare")
14002 (set_attr "length" "12,16")])
14005 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14007 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14008 (match_operand:SI 2 "reg_or_short_operand" ""))
14009 (match_operand:SI 3 "gpc_reg_operand" ""))
14011 (clobber (match_scratch:SI 4 ""))]
14012 "TARGET_POWER && reload_completed"
14013 [(set (match_dup 4)
14014 (plus:SI (lt:SI (match_dup 1) (match_dup 2))
14017 (compare:CC (match_dup 4)
14022 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
14024 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14025 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14026 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14028 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
14029 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14032 doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
14034 [(set_attr "type" "compare")
14035 (set_attr "length" "12,16")])
14038 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14040 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14041 (match_operand:SI 2 "reg_or_short_operand" ""))
14042 (match_operand:SI 3 "gpc_reg_operand" ""))
14044 (set (match_operand:SI 0 "gpc_reg_operand" "")
14045 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14046 "TARGET_POWER && reload_completed"
14047 [(set (match_dup 0)
14048 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
14050 (compare:CC (match_dup 0)
14055 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14056 (neg:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14057 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
14059 "doz%I2 %0,%1,%2\;nabs %0,%0\;{srai|srawi} %0,%0,31"
14060 [(set_attr "length" "12")])
14062 (define_insn_and_split "*ltu<mode>"
14063 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
14064 (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14065 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))]
14069 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
14070 (set (match_dup 0) (neg:P (match_dup 0)))]
14073 (define_insn_and_split "*ltu<mode>_compare"
14074 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
14076 (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
14077 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
14079 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
14080 (ltu:P (match_dup 1) (match_dup 2)))]
14084 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
14085 (parallel [(set (match_dup 3)
14086 (compare:CC (neg:P (match_dup 0)) (const_int 0)))
14087 (set (match_dup 0) (neg:P (match_dup 0)))])]
14090 (define_insn_and_split "*plus_ltu<mode>"
14091 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,r")
14092 (plus:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14093 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))
14094 (match_operand:P 3 "reg_or_short_operand" "rI,rI")))]
14097 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
14098 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
14099 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))]
14102 (define_insn_and_split "*plus_ltu<mode>_compare"
14103 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
14105 (plus:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
14106 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
14107 (match_operand:P 3 "gpc_reg_operand" "r,r,r,r"))
14109 (set (match_operand:P 0 "gpc_reg_operand" "=&r,&r,&r,&r")
14110 (plus:P (ltu:P (match_dup 1) (match_dup 2)) (match_dup 3)))]
14113 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
14114 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
14115 (parallel [(set (match_dup 4)
14116 (compare:CC (minus:P (match_dup 3) (match_dup 0))
14118 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))])]
14121 (define_insn "*neg_ltu<mode>"
14122 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
14123 (neg:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14124 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))))]
14127 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0
14128 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0"
14129 [(set_attr "type" "two")
14130 (set_attr "length" "8")])
14133 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14134 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14135 (match_operand:SI 2 "reg_or_short_operand" "rI")))
14136 (clobber (match_scratch:SI 3 "=r"))]
14138 "doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3"
14139 [(set_attr "length" "12")])
14142 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
14144 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14145 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14147 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
14148 (ge:SI (match_dup 1) (match_dup 2)))
14149 (clobber (match_scratch:SI 3 "=r,r"))]
14152 doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
14154 [(set_attr "type" "compare")
14155 (set_attr "length" "12,16")])
14158 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14160 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
14161 (match_operand:SI 2 "reg_or_short_operand" ""))
14163 (set (match_operand:SI 0 "gpc_reg_operand" "")
14164 (ge:SI (match_dup 1) (match_dup 2)))
14165 (clobber (match_scratch:SI 3 ""))]
14166 "TARGET_POWER && reload_completed"
14167 [(parallel [(set (match_dup 0)
14168 (ge:SI (match_dup 1) (match_dup 2)))
14169 (clobber (match_dup 3))])
14171 (compare:CC (match_dup 0)
14176 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
14177 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14178 (match_operand:SI 2 "reg_or_short_operand" "rI"))
14179 (match_operand:SI 3 "gpc_reg_operand" "r")))]
14181 "doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
14182 [(set_attr "length" "12")])
14185 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
14187 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14188 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14189 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14191 (clobber (match_scratch:SI 4 "=&r,&r"))]
14194 doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
14196 [(set_attr "type" "compare")
14197 (set_attr "length" "12,16")])
14200 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14202 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
14203 (match_operand:SI 2 "reg_or_short_operand" ""))
14204 (match_operand:SI 3 "gpc_reg_operand" ""))
14206 (clobber (match_scratch:SI 4 ""))]
14207 "TARGET_POWER && reload_completed"
14208 [(set (match_dup 4)
14209 (plus:SI (ge:SI (match_dup 1) (match_dup 2))
14212 (compare:CC (match_dup 4)
14217 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
14219 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14220 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14221 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14223 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
14224 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14227 doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
14229 [(set_attr "type" "compare")
14230 (set_attr "length" "12,16")])
14233 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14235 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
14236 (match_operand:SI 2 "reg_or_short_operand" ""))
14237 (match_operand:SI 3 "gpc_reg_operand" ""))
14239 (set (match_operand:SI 0 "gpc_reg_operand" "")
14240 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14241 "TARGET_POWER && reload_completed"
14242 [(set (match_dup 0)
14243 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
14245 (compare:CC (match_dup 0)
14250 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14251 (neg:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14252 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
14254 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
14255 [(set_attr "length" "12")])
14257 (define_insn "*geu<mode>"
14258 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
14259 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14260 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))]
14263 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0
14264 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
14265 [(set_attr "type" "three")
14266 (set_attr "length" "12")])
14268 (define_insn "*geu<mode>_compare"
14269 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
14271 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
14272 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
14274 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
14275 (geu:P (match_dup 1) (match_dup 2)))]
14278 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
14279 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
14282 [(set_attr "type" "compare")
14283 (set_attr "length" "12,12,16,16")])
14286 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
14288 (geu:P (match_operand:P 1 "gpc_reg_operand" "")
14289 (match_operand:P 2 "reg_or_neg_short_operand" ""))
14291 (set (match_operand:P 0 "gpc_reg_operand" "")
14292 (geu:P (match_dup 1) (match_dup 2)))]
14294 [(set (match_dup 0)
14295 (geu:P (match_dup 1) (match_dup 2)))
14297 (compare:CC (match_dup 0)
14301 (define_insn "*plus_geu<mode>"
14302 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,&r")
14303 (plus:P (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14304 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))
14305 (match_operand:P 3 "gpc_reg_operand" "r,r")))]
14308 {sf|subfc} %0,%2,%1\;{aze|addze} %0,%3
14309 {ai|addic} %0,%1,%n2\;{aze|addze} %0,%3"
14310 [(set_attr "type" "two")
14311 (set_attr "length" "8")])
14314 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
14316 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14317 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
14318 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
14320 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
14323 {sf|subfc} %4,%2,%1\;{aze.|addze.} %4,%3
14324 {ai|addic} %4,%1,%n2\;{aze.|addze.} %4,%3
14327 [(set_attr "type" "compare")
14328 (set_attr "length" "8,8,12,12")])
14331 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14333 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14334 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
14335 (match_operand:SI 3 "gpc_reg_operand" ""))
14337 (clobber (match_scratch:SI 4 ""))]
14338 "TARGET_32BIT && reload_completed"
14339 [(set (match_dup 4)
14340 (plus:SI (geu:SI (match_dup 1) (match_dup 2))
14343 (compare:CC (match_dup 4)
14348 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
14350 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14351 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
14352 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
14354 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
14355 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14358 {sf|subfc} %0,%2,%1\;{aze.|addze.} %0,%3
14359 {ai|addic} %0,%1,%n2\;{aze.|addze.} %0,%3
14362 [(set_attr "type" "compare")
14363 (set_attr "length" "8,8,12,12")])
14366 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14368 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14369 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
14370 (match_operand:SI 3 "gpc_reg_operand" ""))
14372 (set (match_operand:SI 0 "gpc_reg_operand" "")
14373 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14374 "TARGET_32BIT && reload_completed"
14375 [(set (match_dup 0)
14376 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
14378 (compare:CC (match_dup 0)
14382 (define_insn "*neg_geu<mode>"
14383 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
14384 (neg:P (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14385 (match_operand:P 2 "reg_or_short_operand" "r,I"))))]
14388 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0
14389 {sfi|subfic} %0,%1,-1\;{a%I2|add%I2c} %0,%0,%2\;{sfe|subfe} %0,%0,%0"
14390 [(set_attr "type" "three")
14391 (set_attr "length" "12")])
14393 (define_insn "*and_neg_geu<mode>"
14394 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,&r")
14396 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14397 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))
14398 (match_operand:P 3 "gpc_reg_operand" "r,r")))]
14401 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0
14402 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
14403 [(set_attr "type" "three")
14404 (set_attr "length" "12")])
14407 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
14410 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14411 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
14412 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
14414 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
14417 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
14418 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
14421 [(set_attr "type" "compare")
14422 (set_attr "length" "12,12,16,16")])
14425 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14428 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14429 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
14430 (match_operand:SI 3 "gpc_reg_operand" ""))
14432 (clobber (match_scratch:SI 4 ""))]
14433 "TARGET_32BIT && reload_completed"
14434 [(set (match_dup 4)
14435 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2)))
14438 (compare:CC (match_dup 4)
14443 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
14446 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14447 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
14448 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
14450 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
14451 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
14454 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
14455 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
14458 [(set_attr "type" "compare")
14459 (set_attr "length" "12,12,16,16")])
14462 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14465 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14466 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
14467 (match_operand:SI 3 "gpc_reg_operand" ""))
14469 (set (match_operand:SI 0 "gpc_reg_operand" "")
14470 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
14471 "TARGET_32BIT && reload_completed"
14472 [(set (match_dup 0)
14473 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
14475 (compare:CC (match_dup 0)
14480 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14481 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14482 (match_operand:SI 2 "reg_or_short_operand" "r")))]
14484 "doz %0,%2,%1\;nabs %0,%0\;{sri|srwi} %0,%0,31"
14485 [(set_attr "length" "12")])
14488 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
14490 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14491 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
14493 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
14494 (gt:SI (match_dup 1) (match_dup 2)))]
14497 doz %0,%2,%1\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
14499 [(set_attr "type" "delayed_compare")
14500 (set_attr "length" "12,16")])
14503 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
14505 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14506 (match_operand:SI 2 "reg_or_short_operand" ""))
14508 (set (match_operand:SI 0 "gpc_reg_operand" "")
14509 (gt:SI (match_dup 1) (match_dup 2)))]
14510 "TARGET_POWER && reload_completed"
14511 [(set (match_dup 0)
14512 (gt:SI (match_dup 1) (match_dup 2)))
14514 (compare:CC (match_dup 0)
14518 (define_insn "*plus_gt0<mode>"
14519 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
14520 (plus:P (gt:P (match_operand:P 1 "gpc_reg_operand" "r")
14522 (match_operand:P 2 "gpc_reg_operand" "r")))]
14524 "{a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze|addze} %0,%2"
14525 [(set_attr "type" "three")
14526 (set_attr "length" "12")])
14529 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
14531 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14533 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
14535 (clobber (match_scratch:SI 3 "=&r,&r"))]
14538 {a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze.|addze.} %3,%2
14540 [(set_attr "type" "compare")
14541 (set_attr "length" "12,16")])
14544 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14546 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14548 (match_operand:SI 2 "gpc_reg_operand" ""))
14550 (clobber (match_scratch:SI 3 ""))]
14551 "TARGET_32BIT && reload_completed"
14552 [(set (match_dup 3)
14553 (plus:SI (gt:SI (match_dup 1) (const_int 0))
14556 (compare:CC (match_dup 3)
14561 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
14563 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
14565 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
14567 (clobber (match_scratch:DI 3 "=&r,&r"))]
14570 addc %3,%1,%1\;subfe %3,%1,%3\;addze. %3,%2
14572 [(set_attr "type" "compare")
14573 (set_attr "length" "12,16")])
14576 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
14578 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
14580 (match_operand:DI 2 "gpc_reg_operand" ""))
14582 (clobber (match_scratch:DI 3 ""))]
14583 "TARGET_64BIT && reload_completed"
14584 [(set (match_dup 3)
14585 (plus:DI (gt:DI (match_dup 1) (const_int 0))
14588 (compare:CC (match_dup 3)
14593 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
14595 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14597 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
14599 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
14600 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
14603 {a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze.|addze.} %0,%2
14605 [(set_attr "type" "compare")
14606 (set_attr "length" "12,16")])
14609 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
14611 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14613 (match_operand:SI 2 "gpc_reg_operand" ""))
14615 (set (match_operand:SI 0 "gpc_reg_operand" "")
14616 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
14617 "TARGET_32BIT && reload_completed"
14618 [(set (match_dup 0)
14619 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))
14621 (compare:CC (match_dup 0)
14626 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
14628 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
14630 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
14632 (set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
14633 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
14636 addc %0,%1,%1\;subfe %0,%1,%0\;addze. %0,%2
14638 [(set_attr "type" "compare")
14639 (set_attr "length" "12,16")])
14642 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
14644 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
14646 (match_operand:DI 2 "gpc_reg_operand" ""))
14648 (set (match_operand:DI 0 "gpc_reg_operand" "")
14649 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
14650 "TARGET_64BIT && reload_completed"
14651 [(set (match_dup 0)
14652 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))
14654 (compare:CC (match_dup 0)
14659 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
14660 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14661 (match_operand:SI 2 "reg_or_short_operand" "r"))
14662 (match_operand:SI 3 "gpc_reg_operand" "r")))]
14664 "doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
14665 [(set_attr "length" "12")])
14668 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
14670 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14671 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
14672 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14674 (clobber (match_scratch:SI 4 "=&r,&r"))]
14677 doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
14679 [(set_attr "type" "compare")
14680 (set_attr "length" "12,16")])
14683 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14685 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14686 (match_operand:SI 2 "reg_or_short_operand" ""))
14687 (match_operand:SI 3 "gpc_reg_operand" ""))
14689 (clobber (match_scratch:SI 4 ""))]
14690 "TARGET_POWER && reload_completed"
14691 [(set (match_dup 4)
14692 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
14694 (compare:CC (match_dup 4)
14699 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
14701 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14702 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
14703 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14705 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
14706 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14709 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
14711 [(set_attr "type" "compare")
14712 (set_attr "length" "12,16")])
14715 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14717 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14718 (match_operand:SI 2 "reg_or_short_operand" ""))
14719 (match_operand:SI 3 "gpc_reg_operand" ""))
14721 (set (match_operand:SI 0 "gpc_reg_operand" "")
14722 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14723 "TARGET_POWER && reload_completed"
14724 [(set (match_dup 0)
14725 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
14727 (compare:CC (match_dup 0)
14732 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14733 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14734 (match_operand:SI 2 "reg_or_short_operand" "r"))))]
14736 "doz %0,%2,%1\;nabs %0,%0\;{srai|srawi} %0,%0,31"
14737 [(set_attr "length" "12")])
14739 (define_insn_and_split "*gtu<mode>"
14740 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
14741 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
14742 (match_operand:P 2 "reg_or_short_operand" "rI")))]
14746 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
14747 (set (match_dup 0) (neg:P (match_dup 0)))]
14750 (define_insn_and_split "*gtu<mode>_compare"
14751 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
14753 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14754 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
14756 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
14757 (gtu:P (match_dup 1) (match_dup 2)))]
14761 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
14762 (parallel [(set (match_dup 3)
14763 (compare:CC (neg:P (match_dup 0)) (const_int 0)))
14764 (set (match_dup 0) (neg:P (match_dup 0)))])]
14767 (define_insn_and_split "*plus_gtu<mode>"
14768 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
14769 (plus:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
14770 (match_operand:P 2 "reg_or_short_operand" "rI"))
14771 (match_operand:P 3 "reg_or_short_operand" "rI")))]
14774 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
14775 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
14776 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))]
14779 (define_insn_and_split "*plus_gtu<mode>_compare"
14780 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
14782 (plus:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
14783 (match_operand:P 2 "reg_or_short_operand" "I,r,I,r"))
14784 (match_operand:P 3 "gpc_reg_operand" "r,r,r,r"))
14786 (set (match_operand:P 0 "gpc_reg_operand" "=&r,&r,&r,&r")
14787 (plus:P (gtu:P (match_dup 1) (match_dup 2)) (match_dup 3)))]
14790 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
14791 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
14792 (parallel [(set (match_dup 4)
14793 (compare:CC (minus:P (match_dup 3) (match_dup 0))
14795 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))])]
14798 (define_insn "*neg_gtu<mode>"
14799 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
14800 (neg:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
14801 (match_operand:P 2 "reg_or_short_operand" "rI"))))]
14803 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0"
14804 [(set_attr "type" "two")
14805 (set_attr "length" "8")])
14808 ;; Define both directions of branch and return. If we need a reload
14809 ;; register, we'd rather use CR0 since it is much easier to copy a
14810 ;; register CC value to there.
14814 (if_then_else (match_operator 1 "branch_comparison_operator"
14816 "cc_reg_operand" "y")
14818 (label_ref (match_operand 0 "" ""))
14823 return output_cbranch (operands[1], \"%l0\", 0, insn);
14825 [(set_attr "type" "branch")])
14829 (if_then_else (match_operator 0 "branch_comparison_operator"
14831 "cc_reg_operand" "y")
14838 return output_cbranch (operands[0], NULL, 0, insn);
14840 [(set_attr "type" "jmpreg")
14841 (set_attr "length" "4")])
14845 (if_then_else (match_operator 1 "branch_comparison_operator"
14847 "cc_reg_operand" "y")
14850 (label_ref (match_operand 0 "" ""))))]
14854 return output_cbranch (operands[1], \"%l0\", 1, insn);
14856 [(set_attr "type" "branch")])
14860 (if_then_else (match_operator 0 "branch_comparison_operator"
14862 "cc_reg_operand" "y")
14869 return output_cbranch (operands[0], NULL, 1, insn);
14871 [(set_attr "type" "jmpreg")
14872 (set_attr "length" "4")])
14874 ;; Logic on condition register values.
14876 ; This pattern matches things like
14877 ; (set (reg:CCEQ 68) (compare:CCEQ (ior:SI (gt:SI (reg:CCFP 68) (const_int 0))
14878 ; (eq:SI (reg:CCFP 68) (const_int 0)))
14880 ; which are generated by the branch logic.
14881 ; Prefer destructive operations where BT = BB (for crXX BT,BA,BB)
14883 (define_insn "*cceq_ior_compare"
14884 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
14885 (compare:CCEQ (match_operator:SI 1 "boolean_operator"
14886 [(match_operator:SI 2
14887 "branch_positive_comparison_operator"
14889 "cc_reg_operand" "y,y")
14891 (match_operator:SI 4
14892 "branch_positive_comparison_operator"
14894 "cc_reg_operand" "0,y")
14898 "cr%q1 %E0,%j2,%j4"
14899 [(set_attr "type" "cr_logical,delayed_cr")])
14901 ; Why is the constant -1 here, but 1 in the previous pattern?
14902 ; Because ~1 has all but the low bit set.
14904 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
14905 (compare:CCEQ (match_operator:SI 1 "boolean_or_operator"
14906 [(not:SI (match_operator:SI 2
14907 "branch_positive_comparison_operator"
14909 "cc_reg_operand" "y,y")
14911 (match_operator:SI 4
14912 "branch_positive_comparison_operator"
14914 "cc_reg_operand" "0,y")
14918 "cr%q1 %E0,%j2,%j4"
14919 [(set_attr "type" "cr_logical,delayed_cr")])
14921 (define_insn "*cceq_rev_compare"
14922 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
14923 (compare:CCEQ (match_operator:SI 1
14924 "branch_positive_comparison_operator"
14926 "cc_reg_operand" "0,y")
14930 "{crnor %E0,%j1,%j1|crnot %E0,%j1}"
14931 [(set_attr "type" "cr_logical,delayed_cr")])
14933 ;; If we are comparing the result of two comparisons, this can be done
14934 ;; using creqv or crxor.
14936 (define_insn_and_split ""
14937 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
14938 (compare:CCEQ (match_operator 1 "branch_comparison_operator"
14939 [(match_operand 2 "cc_reg_operand" "y")
14941 (match_operator 3 "branch_comparison_operator"
14942 [(match_operand 4 "cc_reg_operand" "y")
14947 [(set (match_dup 0) (compare:CCEQ (xor:SI (match_dup 1) (match_dup 3))
14951 int positive_1, positive_2;
14953 positive_1 = branch_positive_comparison_operator (operands[1],
14954 GET_MODE (operands[1]));
14955 positive_2 = branch_positive_comparison_operator (operands[3],
14956 GET_MODE (operands[3]));
14959 operands[1] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[2]),
14960 GET_CODE (operands[1])),
14962 operands[2], const0_rtx);
14963 else if (GET_MODE (operands[1]) != SImode)
14964 operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]), SImode,
14965 operands[2], const0_rtx);
14968 operands[3] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[4]),
14969 GET_CODE (operands[3])),
14971 operands[4], const0_rtx);
14972 else if (GET_MODE (operands[3]) != SImode)
14973 operands[3] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
14974 operands[4], const0_rtx);
14976 if (positive_1 == positive_2)
14978 operands[1] = gen_rtx_NOT (SImode, operands[1]);
14979 operands[5] = constm1_rtx;
14983 operands[5] = const1_rtx;
14987 ;; Unconditional branch and return.
14989 (define_insn "jump"
14991 (label_ref (match_operand 0 "" "")))]
14994 [(set_attr "type" "branch")])
14996 (define_insn "return"
15000 [(set_attr "type" "jmpreg")])
15002 (define_expand "indirect_jump"
15003 [(set (pc) (match_operand 0 "register_operand" ""))])
15005 (define_insn "*indirect_jump<mode>"
15006 [(set (pc) (match_operand:P 0 "register_operand" "c,*l"))]
15011 [(set_attr "type" "jmpreg")])
15013 ;; Table jump for switch statements:
15014 (define_expand "tablejump"
15015 [(use (match_operand 0 "" ""))
15016 (use (label_ref (match_operand 1 "" "")))]
15021 emit_jump_insn (gen_tablejumpsi (operands[0], operands[1]));
15023 emit_jump_insn (gen_tablejumpdi (operands[0], operands[1]));
15027 (define_expand "tablejumpsi"
15028 [(set (match_dup 3)
15029 (plus:SI (match_operand:SI 0 "" "")
15031 (parallel [(set (pc) (match_dup 3))
15032 (use (label_ref (match_operand 1 "" "")))])]
15035 { operands[0] = force_reg (SImode, operands[0]);
15036 operands[2] = force_reg (SImode, gen_rtx_LABEL_REF (SImode, operands[1]));
15037 operands[3] = gen_reg_rtx (SImode);
15040 (define_expand "tablejumpdi"
15041 [(set (match_dup 4)
15042 (sign_extend:DI (match_operand:SI 0 "lwa_operand" "")))
15044 (plus:DI (match_dup 4)
15046 (parallel [(set (pc) (match_dup 3))
15047 (use (label_ref (match_operand 1 "" "")))])]
15050 { operands[2] = force_reg (DImode, gen_rtx_LABEL_REF (DImode, operands[1]));
15051 operands[3] = gen_reg_rtx (DImode);
15052 operands[4] = gen_reg_rtx (DImode);
15055 (define_insn "*tablejump<mode>_internal1"
15057 (match_operand:P 0 "register_operand" "c,*l"))
15058 (use (label_ref (match_operand 1 "" "")))]
15063 [(set_attr "type" "jmpreg")])
15068 "{cror 0,0,0|nop}")
15070 ;; Define the subtract-one-and-jump insns, starting with the template
15071 ;; so loop.c knows what to generate.
15073 (define_expand "doloop_end"
15074 [(use (match_operand 0 "" "")) ; loop pseudo
15075 (use (match_operand 1 "" "")) ; iterations; zero if unknown
15076 (use (match_operand 2 "" "")) ; max iterations
15077 (use (match_operand 3 "" "")) ; loop level
15078 (use (match_operand 4 "" ""))] ; label
15082 /* Only use this on innermost loops. */
15083 if (INTVAL (operands[3]) > 1)
15087 if (GET_MODE (operands[0]) != DImode)
15089 emit_jump_insn (gen_ctrdi (operands[0], operands[4]));
15093 if (GET_MODE (operands[0]) != SImode)
15095 emit_jump_insn (gen_ctrsi (operands[0], operands[4]));
15100 (define_expand "ctr<mode>"
15101 [(parallel [(set (pc)
15102 (if_then_else (ne (match_operand:P 0 "register_operand" "")
15104 (label_ref (match_operand 1 "" ""))
15107 (plus:P (match_dup 0)
15109 (clobber (match_scratch:CC 2 ""))
15110 (clobber (match_scratch:P 3 ""))])]
15114 ;; We need to be able to do this for any operand, including MEM, or we
15115 ;; will cause reload to blow up since we don't allow output reloads on
15117 ;; For the length attribute to be calculated correctly, the
15118 ;; label MUST be operand 0.
15120 (define_insn "*ctr<mode>_internal1"
15122 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
15124 (label_ref (match_operand 0 "" ""))
15126 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
15127 (plus:P (match_dup 1)
15129 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
15130 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
15134 if (which_alternative != 0)
15136 else if (get_attr_length (insn) == 4)
15137 return \"{bdn|bdnz} %l0\";
15139 return \"bdz $+8\;b %l0\";
15141 [(set_attr "type" "branch")
15142 (set_attr "length" "*,12,16,16")])
15144 (define_insn "*ctr<mode>_internal2"
15146 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
15149 (label_ref (match_operand 0 "" ""))))
15150 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
15151 (plus:P (match_dup 1)
15153 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
15154 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
15158 if (which_alternative != 0)
15160 else if (get_attr_length (insn) == 4)
15161 return \"bdz %l0\";
15163 return \"{bdn|bdnz} $+8\;b %l0\";
15165 [(set_attr "type" "branch")
15166 (set_attr "length" "*,12,16,16")])
15168 ;; Similar but use EQ
15170 (define_insn "*ctr<mode>_internal5"
15172 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
15174 (label_ref (match_operand 0 "" ""))
15176 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
15177 (plus:P (match_dup 1)
15179 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
15180 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
15184 if (which_alternative != 0)
15186 else if (get_attr_length (insn) == 4)
15187 return \"bdz %l0\";
15189 return \"{bdn|bdnz} $+8\;b %l0\";
15191 [(set_attr "type" "branch")
15192 (set_attr "length" "*,12,16,16")])
15194 (define_insn "*ctr<mode>_internal6"
15196 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
15199 (label_ref (match_operand 0 "" ""))))
15200 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
15201 (plus:P (match_dup 1)
15203 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
15204 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
15208 if (which_alternative != 0)
15210 else if (get_attr_length (insn) == 4)
15211 return \"{bdn|bdnz} %l0\";
15213 return \"bdz $+8\;b %l0\";
15215 [(set_attr "type" "branch")
15216 (set_attr "length" "*,12,16,16")])
15218 ;; Now the splitters if we could not allocate the CTR register
15222 (if_then_else (match_operator 2 "comparison_operator"
15223 [(match_operand:P 1 "gpc_reg_operand" "")
15225 (match_operand 5 "" "")
15226 (match_operand 6 "" "")))
15227 (set (match_operand:P 0 "gpc_reg_operand" "")
15228 (plus:P (match_dup 1) (const_int -1)))
15229 (clobber (match_scratch:CC 3 ""))
15230 (clobber (match_scratch:P 4 ""))]
15232 [(parallel [(set (match_dup 3)
15233 (compare:CC (plus:P (match_dup 1)
15237 (plus:P (match_dup 1)
15239 (set (pc) (if_then_else (match_dup 7)
15243 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
15244 operands[3], const0_rtx); }")
15248 (if_then_else (match_operator 2 "comparison_operator"
15249 [(match_operand:P 1 "gpc_reg_operand" "")
15251 (match_operand 5 "" "")
15252 (match_operand 6 "" "")))
15253 (set (match_operand:P 0 "nonimmediate_operand" "")
15254 (plus:P (match_dup 1) (const_int -1)))
15255 (clobber (match_scratch:CC 3 ""))
15256 (clobber (match_scratch:P 4 ""))]
15257 "reload_completed && ! gpc_reg_operand (operands[0], SImode)"
15258 [(parallel [(set (match_dup 3)
15259 (compare:CC (plus:P (match_dup 1)
15263 (plus:P (match_dup 1)
15267 (set (pc) (if_then_else (match_dup 7)
15271 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
15272 operands[3], const0_rtx); }")
15274 (define_insn "trap"
15275 [(trap_if (const_int 1) (const_int 0))]
15278 [(set_attr "type" "trap")])
15280 (define_expand "ctrap<mode>4"
15281 [(trap_if (match_operator 0 "ordered_comparison_operator"
15282 [(match_operand:GPR 1 "register_operand")
15283 (match_operand:GPR 2 "reg_or_short_operand")])
15284 (match_operand 3 "zero_constant" ""))]
15289 [(trap_if (match_operator 0 "ordered_comparison_operator"
15290 [(match_operand:GPR 1 "register_operand" "r")
15291 (match_operand:GPR 2 "reg_or_short_operand" "rI")])
15294 "{t|t<wd>}%V0%I2 %1,%2"
15295 [(set_attr "type" "trap")])
15297 ;; Insns related to generating the function prologue and epilogue.
15299 (define_expand "prologue"
15300 [(use (const_int 0))]
15301 "TARGET_SCHED_PROLOG"
15304 rs6000_emit_prologue ();
15308 (define_insn "*movesi_from_cr_one"
15309 [(match_parallel 0 "mfcr_operation"
15310 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
15311 (unspec:SI [(match_operand:CC 2 "cc_reg_operand" "y")
15312 (match_operand 3 "immediate_operand" "n")]
15313 UNSPEC_MOVESI_FROM_CR))])]
15319 for (i = 0; i < XVECLEN (operands[0], 0); i++)
15321 mask = INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
15322 operands[4] = GEN_INT (mask);
15323 output_asm_insn (\"mfcr %1,%4\", operands);
15327 [(set_attr "type" "mfcrf")])
15329 (define_insn "movesi_from_cr"
15330 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
15331 (unspec:SI [(reg:CC CR0_REGNO) (reg:CC CR1_REGNO)
15332 (reg:CC CR2_REGNO) (reg:CC CR3_REGNO)
15333 (reg:CC CR4_REGNO) (reg:CC CR5_REGNO)
15334 (reg:CC CR6_REGNO) (reg:CC CR7_REGNO)]
15335 UNSPEC_MOVESI_FROM_CR))]
15338 [(set_attr "type" "mfcr")])
15340 (define_insn "*stmw"
15341 [(match_parallel 0 "stmw_operation"
15342 [(set (match_operand:SI 1 "memory_operand" "=m")
15343 (match_operand:SI 2 "gpc_reg_operand" "r"))])]
15346 [(set_attr "type" "store_ux")])
15348 (define_insn "*save_gpregs_<mode>"
15349 [(match_parallel 0 "any_parallel_operand"
15350 [(clobber (reg:P 65))
15351 (use (match_operand:P 1 "symbol_ref_operand" "s"))
15352 (use (match_operand:P 2 "gpc_reg_operand" "r"))
15353 (set (match_operand:P 3 "memory_operand" "=m")
15354 (match_operand:P 4 "gpc_reg_operand" "r"))])]
15357 [(set_attr "type" "branch")
15358 (set_attr "length" "4")])
15360 (define_insn "*save_fpregs_<mode>"
15361 [(match_parallel 0 "any_parallel_operand"
15362 [(clobber (reg:P 65))
15363 (use (match_operand:P 1 "symbol_ref_operand" "s"))
15364 (use (match_operand:P 2 "gpc_reg_operand" "r"))
15365 (set (match_operand:DF 3 "memory_operand" "=m")
15366 (match_operand:DF 4 "gpc_reg_operand" "d"))])]
15369 [(set_attr "type" "branch")
15370 (set_attr "length" "4")])
15372 ; These are to explain that changes to the stack pointer should
15373 ; not be moved over stores to stack memory.
15374 (define_insn "stack_tie"
15375 [(set (match_operand:BLK 0 "memory_operand" "+m")
15376 (unspec:BLK [(match_dup 0)] UNSPEC_TIE))]
15379 [(set_attr "length" "0")])
15382 (define_expand "epilogue"
15383 [(use (const_int 0))]
15384 "TARGET_SCHED_PROLOG"
15387 rs6000_emit_epilogue (FALSE);
15391 ; On some processors, doing the mtcrf one CC register at a time is
15392 ; faster (like on the 604e). On others, doing them all at once is
15393 ; faster; for instance, on the 601 and 750.
15395 (define_expand "movsi_to_cr_one"
15396 [(set (match_operand:CC 0 "cc_reg_operand" "")
15397 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "")
15398 (match_dup 2)] UNSPEC_MOVESI_TO_CR))]
15400 "operands[2] = GEN_INT (1 << (75 - REGNO (operands[0])));")
15402 (define_insn "*movsi_to_cr"
15403 [(match_parallel 0 "mtcrf_operation"
15404 [(set (match_operand:CC 1 "cc_reg_operand" "=y")
15405 (unspec:CC [(match_operand:SI 2 "gpc_reg_operand" "r")
15406 (match_operand 3 "immediate_operand" "n")]
15407 UNSPEC_MOVESI_TO_CR))])]
15413 for (i = 0; i < XVECLEN (operands[0], 0); i++)
15414 mask |= INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
15415 operands[4] = GEN_INT (mask);
15416 return \"mtcrf %4,%2\";
15418 [(set_attr "type" "mtcr")])
15420 (define_insn "*mtcrfsi"
15421 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
15422 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
15423 (match_operand 2 "immediate_operand" "n")]
15424 UNSPEC_MOVESI_TO_CR))]
15425 "GET_CODE (operands[0]) == REG
15426 && CR_REGNO_P (REGNO (operands[0]))
15427 && GET_CODE (operands[2]) == CONST_INT
15428 && INTVAL (operands[2]) == 1 << (75 - REGNO (operands[0]))"
15430 [(set_attr "type" "mtcr")])
15432 ; The load-multiple instructions have similar properties.
15433 ; Note that "load_multiple" is a name known to the machine-independent
15434 ; code that actually corresponds to the PowerPC load-string.
15436 (define_insn "*lmw"
15437 [(match_parallel 0 "lmw_operation"
15438 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
15439 (match_operand:SI 2 "memory_operand" "m"))])]
15442 [(set_attr "type" "load_ux")
15443 (set_attr "cell_micro" "always")])
15445 (define_insn "*return_internal_<mode>"
15447 (use (match_operand:P 0 "register_operand" "lc"))]
15450 [(set_attr "type" "jmpreg")])
15452 ; FIXME: This would probably be somewhat simpler if the Cygnus sibcall
15453 ; stuff was in GCC. Oh, and "any_parallel_operand" is a bit flexible...
15455 (define_insn "*restore_gpregs_<mode>"
15456 [(match_parallel 0 "any_parallel_operand"
15457 [(clobber (match_operand:P 1 "register_operand" "=l"))
15458 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15459 (use (match_operand:P 3 "gpc_reg_operand" "r"))
15460 (set (match_operand:P 4 "gpc_reg_operand" "=r")
15461 (match_operand:P 5 "memory_operand" "m"))])]
15464 [(set_attr "type" "branch")
15465 (set_attr "length" "4")])
15467 (define_insn "*return_and_restore_gpregs_<mode>"
15468 [(match_parallel 0 "any_parallel_operand"
15470 (clobber (match_operand:P 1 "register_operand" "=l"))
15471 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15472 (use (match_operand:P 3 "gpc_reg_operand" "r"))
15473 (set (match_operand:P 4 "gpc_reg_operand" "=r")
15474 (match_operand:P 5 "memory_operand" "m"))])]
15477 [(set_attr "type" "branch")
15478 (set_attr "length" "4")])
15480 (define_insn "*return_and_restore_fpregs_<mode>"
15481 [(match_parallel 0 "any_parallel_operand"
15483 (clobber (match_operand:P 1 "register_operand" "=l"))
15484 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15485 (use (match_operand:P 3 "gpc_reg_operand" "r"))
15486 (set (match_operand:DF 4 "gpc_reg_operand" "=d")
15487 (match_operand:DF 5 "memory_operand" "m"))])]
15490 [(set_attr "type" "branch")
15491 (set_attr "length" "4")])
15493 (define_insn "*return_and_restore_fpregs_aix_<mode>"
15494 [(match_parallel 0 "any_parallel_operand"
15496 (use (match_operand:P 1 "register_operand" "l"))
15497 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15498 (use (match_operand:P 3 "gpc_reg_operand" "r"))
15499 (set (match_operand:DF 4 "gpc_reg_operand" "=d")
15500 (match_operand:DF 5 "memory_operand" "m"))])]
15503 [(set_attr "type" "branch")
15504 (set_attr "length" "4")])
15506 ; This is used in compiling the unwind routines.
15507 (define_expand "eh_return"
15508 [(use (match_operand 0 "general_operand" ""))]
15513 emit_insn (gen_eh_set_lr_si (operands[0]));
15515 emit_insn (gen_eh_set_lr_di (operands[0]));
15519 ; We can't expand this before we know where the link register is stored.
15520 (define_insn "eh_set_lr_<mode>"
15521 [(unspec_volatile [(match_operand:P 0 "register_operand" "r")]
15523 (clobber (match_scratch:P 1 "=&b"))]
15528 [(unspec_volatile [(match_operand 0 "register_operand" "")] UNSPECV_EH_RR)
15529 (clobber (match_scratch 1 ""))]
15534 rs6000_emit_eh_reg_restore (operands[0], operands[1]);
15538 (define_insn "prefetch"
15539 [(prefetch (match_operand 0 "indexed_or_indirect_address" "a")
15540 (match_operand:SI 1 "const_int_operand" "n")
15541 (match_operand:SI 2 "const_int_operand" "n"))]
15545 if (GET_CODE (operands[0]) == REG)
15546 return INTVAL (operands[1]) ? \"dcbtst 0,%0\" : \"dcbt 0,%0\";
15547 return INTVAL (operands[1]) ? \"dcbtst %a0\" : \"dcbt %a0\";
15549 [(set_attr "type" "load")])
15551 (define_insn "bpermd_<mode>"
15552 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
15553 (unspec:P [(match_operand:P 1 "gpc_reg_operand" "r")
15554 (match_operand:P 2 "gpc_reg_operand" "r")] UNSPEC_BPERM))]
15557 [(set_attr "type" "integer")])
15561 (include "sync.md")
15562 (include "vector.md")
15564 (include "altivec.md")
15567 (include "paired.md")