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
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_insn "sqrtdf2"
6314 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6315 (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "d")))]
6316 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS
6317 && TARGET_DOUBLE_FLOAT
6318 && !VECTOR_UNIT_VSX_P (DFmode)"
6320 [(set_attr "type" "dsqrt")])
6322 ;; The conditional move instructions allow us to perform max and min
6323 ;; operations even when
6325 (define_expand "smaxdf3"
6326 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6327 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
6328 (match_operand:DF 2 "gpc_reg_operand" ""))
6331 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6332 && !flag_trapping_math"
6333 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
6335 (define_expand "smindf3"
6336 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6337 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
6338 (match_operand:DF 2 "gpc_reg_operand" ""))
6341 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6342 && !flag_trapping_math"
6343 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
6346 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6347 (match_operator:DF 3 "min_max_operator"
6348 [(match_operand:DF 1 "gpc_reg_operand" "")
6349 (match_operand:DF 2 "gpc_reg_operand" "")]))]
6350 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6351 && !flag_trapping_math"
6354 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
6355 operands[1], operands[2]);
6359 (define_expand "movdfcc"
6360 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6361 (if_then_else:DF (match_operand 1 "comparison_operator" "")
6362 (match_operand:DF 2 "gpc_reg_operand" "")
6363 (match_operand:DF 3 "gpc_reg_operand" "")))]
6364 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6367 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
6373 (define_insn "*fseldfdf4"
6374 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6375 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "d")
6376 (match_operand:DF 4 "zero_fp_constant" "F"))
6377 (match_operand:DF 2 "gpc_reg_operand" "d")
6378 (match_operand:DF 3 "gpc_reg_operand" "d")))]
6379 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6381 [(set_attr "type" "fp")])
6383 (define_insn "*fselsfdf4"
6384 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6385 (if_then_else:DF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
6386 (match_operand:SF 4 "zero_fp_constant" "F"))
6387 (match_operand:DF 2 "gpc_reg_operand" "d")
6388 (match_operand:DF 3 "gpc_reg_operand" "d")))]
6389 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_SINGLE_FLOAT"
6391 [(set_attr "type" "fp")])
6393 ;; Conversions to and from floating-point.
6395 (define_expand "fixuns_truncsfsi2"
6396 [(set (match_operand:SI 0 "gpc_reg_operand" "")
6397 (unsigned_fix:SI (match_operand:SF 1 "gpc_reg_operand" "")))]
6398 "TARGET_HARD_FLOAT && !TARGET_FPRS && TARGET_SINGLE_FLOAT"
6401 (define_expand "fix_truncsfsi2"
6402 [(set (match_operand:SI 0 "gpc_reg_operand" "")
6403 (fix:SI (match_operand:SF 1 "gpc_reg_operand" "")))]
6404 "TARGET_HARD_FLOAT && !TARGET_FPRS && TARGET_SINGLE_FLOAT"
6407 (define_expand "fixuns_truncdfsi2"
6408 [(set (match_operand:SI 0 "gpc_reg_operand" "")
6409 (unsigned_fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))]
6410 "TARGET_HARD_FLOAT && TARGET_E500_DOUBLE"
6413 (define_expand "fixuns_truncdfdi2"
6414 [(set (match_operand:DI 0 "register_operand" "")
6415 (unsigned_fix:DI (match_operand:DF 1 "register_operand" "")))]
6416 "TARGET_HARD_FLOAT && TARGET_VSX"
6419 ; For each of these conversions, there is a define_expand, a define_insn
6420 ; with a '#' template, and a define_split (with C code). The idea is
6421 ; to allow constant folding with the template of the define_insn,
6422 ; then to have the insns split later (between sched1 and final).
6424 (define_expand "floatsidf2"
6425 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
6426 (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
6429 (clobber (match_dup 4))
6430 (clobber (match_dup 5))
6431 (clobber (match_dup 6))])]
6433 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6436 if (TARGET_E500_DOUBLE)
6438 emit_insn (gen_spe_floatsidf2 (operands[0], operands[1]));
6441 if (TARGET_POWERPC64)
6443 rtx x = convert_to_mode (DImode, operands[1], 0);
6444 emit_insn (gen_floatdidf2 (operands[0], x));
6448 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
6449 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503601774854144\", DFmode));
6450 operands[4] = assign_stack_temp (DFmode, GET_MODE_SIZE (DFmode), 0);
6451 operands[5] = gen_reg_rtx (DFmode);
6452 operands[6] = gen_reg_rtx (SImode);
6455 (define_insn_and_split "*floatsidf2_internal"
6456 [(set (match_operand:DF 0 "gpc_reg_operand" "=&d")
6457 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
6458 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
6459 (use (match_operand:DF 3 "gpc_reg_operand" "d"))
6460 (clobber (match_operand:DF 4 "offsettable_mem_operand" "=o"))
6461 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&d"))
6462 (clobber (match_operand:SI 6 "gpc_reg_operand" "=&r"))]
6463 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6469 rtx lowword, highword;
6470 gcc_assert (MEM_P (operands[4]));
6471 highword = adjust_address (operands[4], SImode, 0);
6472 lowword = adjust_address (operands[4], SImode, 4);
6473 if (! WORDS_BIG_ENDIAN)
6476 tmp = highword; highword = lowword; lowword = tmp;
6479 emit_insn (gen_xorsi3 (operands[6], operands[1],
6480 GEN_INT (~ (HOST_WIDE_INT) 0x7fffffff)));
6481 emit_move_insn (lowword, operands[6]);
6482 emit_move_insn (highword, operands[2]);
6483 emit_move_insn (operands[5], operands[4]);
6484 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
6487 [(set_attr "length" "24")])
6489 (define_expand "floatunssisf2"
6490 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6491 (unsigned_float:SF (match_operand:SI 1 "gpc_reg_operand" "")))]
6492 "TARGET_HARD_FLOAT && !TARGET_FPRS && TARGET_SINGLE_FLOAT"
6495 (define_expand "floatunssidf2"
6496 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
6497 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
6500 (clobber (match_dup 4))
6501 (clobber (match_dup 5))])]
6502 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6505 if (TARGET_E500_DOUBLE)
6507 emit_insn (gen_spe_floatunssidf2 (operands[0], operands[1]));
6510 if (TARGET_POWERPC64)
6512 rtx x = convert_to_mode (DImode, operands[1], 1);
6513 emit_insn (gen_floatdidf2 (operands[0], x));
6517 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
6518 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503599627370496\", DFmode));
6519 operands[4] = assign_stack_temp (DFmode, GET_MODE_SIZE (DFmode), 0);
6520 operands[5] = gen_reg_rtx (DFmode);
6523 (define_insn_and_split "*floatunssidf2_internal"
6524 [(set (match_operand:DF 0 "gpc_reg_operand" "=&d")
6525 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
6526 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
6527 (use (match_operand:DF 3 "gpc_reg_operand" "d"))
6528 (clobber (match_operand:DF 4 "offsettable_mem_operand" "=o"))
6529 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&d"))]
6530 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6536 rtx lowword, highword;
6537 gcc_assert (MEM_P (operands[4]));
6538 highword = adjust_address (operands[4], SImode, 0);
6539 lowword = adjust_address (operands[4], SImode, 4);
6540 if (! WORDS_BIG_ENDIAN)
6543 tmp = highword; highword = lowword; lowword = tmp;
6546 emit_move_insn (lowword, operands[1]);
6547 emit_move_insn (highword, operands[2]);
6548 emit_move_insn (operands[5], operands[4]);
6549 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
6552 [(set_attr "length" "20")])
6554 (define_expand "fix_truncdfsi2"
6555 [(parallel [(set (match_operand:SI 0 "fix_trunc_dest_operand" "")
6556 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))
6557 (clobber (match_dup 2))
6558 (clobber (match_dup 3))])]
6559 "(TARGET_POWER2 || TARGET_POWERPC)
6560 && TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6563 if (TARGET_E500_DOUBLE)
6565 emit_insn (gen_spe_fix_truncdfsi2 (operands[0], operands[1]));
6568 operands[2] = gen_reg_rtx (DImode);
6569 if (TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
6570 && gpc_reg_operand(operands[0], GET_MODE (operands[0])))
6572 operands[3] = gen_reg_rtx (DImode);
6573 emit_insn (gen_fix_truncdfsi2_mfpgpr (operands[0], operands[1],
6574 operands[2], operands[3]));
6577 if (TARGET_PPC_GFXOPT)
6579 rtx orig_dest = operands[0];
6580 if (! memory_operand (orig_dest, GET_MODE (orig_dest)))
6581 operands[0] = assign_stack_temp (SImode, GET_MODE_SIZE (SImode), 0);
6582 emit_insn (gen_fix_truncdfsi2_internal_gfxopt (operands[0], operands[1],
6584 if (operands[0] != orig_dest)
6585 emit_move_insn (orig_dest, operands[0]);
6588 operands[3] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
6591 (define_insn_and_split "*fix_truncdfsi2_internal"
6592 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6593 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "d")))
6594 (clobber (match_operand:DI 2 "gpc_reg_operand" "=d"))
6595 (clobber (match_operand:DI 3 "offsettable_mem_operand" "=o"))]
6596 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS
6597 && TARGET_DOUBLE_FLOAT"
6604 gcc_assert (MEM_P (operands[3]));
6605 lowword = adjust_address (operands[3], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
6607 emit_insn (gen_fctiwz (operands[2], operands[1]));
6608 emit_move_insn (operands[3], operands[2]);
6609 emit_move_insn (operands[0], lowword);
6612 [(set_attr "length" "16")])
6614 (define_insn_and_split "fix_truncdfsi2_internal_gfxopt"
6615 [(set (match_operand:SI 0 "memory_operand" "=Z")
6616 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "d")))
6617 (clobber (match_operand:DI 2 "gpc_reg_operand" "=d"))]
6618 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS
6619 && TARGET_DOUBLE_FLOAT
6620 && TARGET_PPC_GFXOPT"
6626 emit_insn (gen_fctiwz (operands[2], operands[1]));
6627 emit_insn (gen_stfiwx (operands[0], operands[2]));
6630 [(set_attr "length" "16")])
6632 (define_insn_and_split "fix_truncdfsi2_mfpgpr"
6633 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6634 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "d")))
6635 (clobber (match_operand:DI 2 "gpc_reg_operand" "=d"))
6636 (clobber (match_operand:DI 3 "gpc_reg_operand" "=r"))]
6637 "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
6638 && TARGET_DOUBLE_FLOAT"
6641 [(set (match_dup 2) (unspec:DI [(fix:SI (match_dup 1))] UNSPEC_FCTIWZ))
6642 (set (match_dup 3) (match_dup 2))
6643 (set (match_dup 0) (subreg:SI (match_dup 3) 4))]
6645 [(set_attr "length" "12")])
6647 ; Here, we use (set (reg) (unspec:DI [(fix:SI ...)] UNSPEC_FCTIWZ))
6648 ; rather than (set (subreg:SI (reg)) (fix:SI ...))
6649 ; because the first makes it clear that operand 0 is not live
6650 ; before the instruction.
6651 (define_insn "fctiwz"
6652 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6653 (unspec:DI [(fix:SI (match_operand:DF 1 "gpc_reg_operand" "d"))]
6655 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS
6656 && TARGET_DOUBLE_FLOAT"
6657 "{fcirz|fctiwz} %0,%1"
6658 [(set_attr "type" "fp")])
6660 (define_expand "btruncdf2"
6661 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6662 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "d")] UNSPEC_FRIZ))]
6663 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6666 (define_insn "*btruncdf2_fpr"
6667 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6668 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRIZ))]
6669 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6670 && !VECTOR_UNIT_VSX_P (DFmode)"
6672 [(set_attr "type" "fp")])
6674 (define_insn "btruncsf2"
6675 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6676 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIZ))]
6677 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
6679 [(set_attr "type" "fp")])
6681 (define_expand "ceildf2"
6682 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6683 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "")] UNSPEC_FRIP))]
6684 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6687 (define_insn "*ceildf2_fpr"
6688 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6689 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "d")] UNSPEC_FRIP))]
6690 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6691 && !VECTOR_UNIT_VSX_P (DFmode)"
6693 [(set_attr "type" "fp")])
6695 (define_insn "ceilsf2"
6696 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6697 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIP))]
6698 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT "
6700 [(set_attr "type" "fp")])
6702 (define_expand "floordf2"
6703 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6704 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "")] UNSPEC_FRIM))]
6705 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6708 (define_insn "*floordf2_fpr"
6709 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6710 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "d")] UNSPEC_FRIM))]
6711 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6712 && !VECTOR_UNIT_VSX_P (DFmode)"
6714 [(set_attr "type" "fp")])
6716 (define_insn "floorsf2"
6717 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6718 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIM))]
6719 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT "
6721 [(set_attr "type" "fp")])
6723 ;; No VSX equivalent to frin
6724 (define_insn "rounddf2"
6725 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6726 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "d")] UNSPEC_FRIN))]
6727 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6729 [(set_attr "type" "fp")])
6731 (define_insn "roundsf2"
6732 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6733 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIN))]
6734 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT "
6736 [(set_attr "type" "fp")])
6738 (define_expand "ftruncdf2"
6739 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6740 (fix:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
6741 "VECTOR_UNIT_VSX_P (DFmode)"
6744 ; An UNSPEC is used so we don't have to support SImode in FP registers.
6745 (define_insn "stfiwx"
6746 [(set (match_operand:SI 0 "memory_operand" "=Z")
6747 (unspec:SI [(match_operand:DI 1 "gpc_reg_operand" "d")]
6751 [(set_attr "type" "fpstore")])
6753 (define_expand "floatsisf2"
6754 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6755 (float:SF (match_operand:SI 1 "gpc_reg_operand" "")))]
6756 "TARGET_HARD_FLOAT && !TARGET_FPRS"
6759 (define_expand "floatdidf2"
6760 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6761 (float:DF (match_operand:DI 1 "gpc_reg_operand" "")))]
6762 "(TARGET_POWERPC64 || TARGET_XILINX_FPU || VECTOR_UNIT_VSX_P (DFmode))
6763 && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS"
6766 (define_insn "*floatdidf2_fpr"
6767 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6768 (float:DF (match_operand:DI 1 "gpc_reg_operand" "!d#r")))]
6769 "(TARGET_POWERPC64 || TARGET_XILINX_FPU)
6770 && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
6771 && !VECTOR_UNIT_VSX_P (DFmode)"
6773 [(set_attr "type" "fp")])
6775 (define_expand "floatunsdidf2"
6776 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6777 (unsigned_float:DF (match_operand:DI 1 "gpc_reg_operand" "")))]
6781 (define_expand "fix_truncdfdi2"
6782 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6783 (fix:DI (match_operand:DF 1 "gpc_reg_operand" "")))]
6784 "(TARGET_POWERPC64 || TARGET_XILINX_FPU || VECTOR_UNIT_VSX_P (DFmode))
6785 && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS"
6788 (define_insn "*fix_truncdfdi2_fpr"
6789 [(set (match_operand:DI 0 "gpc_reg_operand" "=!d#r")
6790 (fix:DI (match_operand:DF 1 "gpc_reg_operand" "d")))]
6791 "(TARGET_POWERPC64 || TARGET_XILINX_FPU)
6792 && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
6793 && !VECTOR_UNIT_VSX_P (DFmode)"
6795 [(set_attr "type" "fp")])
6797 (define_expand "floatdisf2"
6798 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6799 (float:SF (match_operand:DI 1 "gpc_reg_operand" "")))]
6800 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT "
6803 rtx val = operands[1];
6804 if (!flag_unsafe_math_optimizations)
6806 rtx label = gen_label_rtx ();
6807 val = gen_reg_rtx (DImode);
6808 emit_insn (gen_floatdisf2_internal2 (val, operands[1], label));
6811 emit_insn (gen_floatdisf2_internal1 (operands[0], val));
6815 ;; This is not IEEE compliant if rounding mode is "round to nearest".
6816 ;; If the DI->DF conversion is inexact, then it's possible to suffer
6817 ;; from double rounding.
6818 (define_insn_and_split "floatdisf2_internal1"
6819 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6820 (float:SF (match_operand:DI 1 "gpc_reg_operand" "!d#r")))
6821 (clobber (match_scratch:DF 2 "=d"))]
6822 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
6824 "&& reload_completed"
6826 (float:DF (match_dup 1)))
6828 (float_truncate:SF (match_dup 2)))]
6831 ;; Twiddles bits to avoid double rounding.
6832 ;; Bits that might be truncated when converting to DFmode are replaced
6833 ;; by a bit that won't be lost at that stage, but is below the SFmode
6834 ;; rounding position.
6835 (define_expand "floatdisf2_internal2"
6836 [(set (match_dup 3) (ashiftrt:DI (match_operand:DI 1 "" "")
6838 (parallel [(set (match_operand:DI 0 "" "") (and:DI (match_dup 1)
6840 (clobber (scratch:CC))])
6841 (set (match_dup 3) (plus:DI (match_dup 3)
6843 (set (match_dup 0) (plus:DI (match_dup 0)
6845 (set (match_dup 4) (compare:CCUNS (match_dup 3)
6847 (set (match_dup 0) (ior:DI (match_dup 0)
6849 (parallel [(set (match_dup 0) (and:DI (match_dup 0)
6851 (clobber (scratch:CC))])
6852 (set (pc) (if_then_else (geu (match_dup 4) (const_int 0))
6853 (label_ref (match_operand:DI 2 "" ""))
6855 (set (match_dup 0) (match_dup 1))]
6856 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
6859 operands[3] = gen_reg_rtx (DImode);
6860 operands[4] = gen_reg_rtx (CCUNSmode);
6863 ;; Define the DImode operations that can be done in a small number
6864 ;; of instructions. The & constraints are to prevent the register
6865 ;; allocator from allocating registers that overlap with the inputs
6866 ;; (for example, having an input in 7,8 and an output in 6,7). We
6867 ;; also allow for the output being the same as one of the inputs.
6869 (define_insn "*adddi3_noppc64"
6870 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r")
6871 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,0,0")
6872 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I")))]
6873 "! TARGET_POWERPC64"
6876 if (WORDS_BIG_ENDIAN)
6877 return (GET_CODE (operands[2])) != CONST_INT
6878 ? \"{a|addc} %L0,%L1,%L2\;{ae|adde} %0,%1,%2\"
6879 : \"{ai|addic} %L0,%L1,%2\;{a%G2e|add%G2e} %0,%1\";
6881 return (GET_CODE (operands[2])) != CONST_INT
6882 ? \"{a|addc} %0,%1,%2\;{ae|adde} %L0,%L1,%L2\"
6883 : \"{ai|addic} %0,%1,%2\;{a%G2e|add%G2e} %L0,%L1\";
6885 [(set_attr "type" "two")
6886 (set_attr "length" "8")])
6888 (define_insn "*subdi3_noppc64"
6889 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r,r")
6890 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I,0,r,I")
6891 (match_operand:DI 2 "gpc_reg_operand" "r,r,r,0,0")))]
6892 "! TARGET_POWERPC64"
6895 if (WORDS_BIG_ENDIAN)
6896 return (GET_CODE (operands[1]) != CONST_INT)
6897 ? \"{sf|subfc} %L0,%L2,%L1\;{sfe|subfe} %0,%2,%1\"
6898 : \"{sfi|subfic} %L0,%L2,%1\;{sf%G1e|subf%G1e} %0,%2\";
6900 return (GET_CODE (operands[1]) != CONST_INT)
6901 ? \"{sf|subfc} %0,%2,%1\;{sfe|subfe} %L0,%L2,%L1\"
6902 : \"{sfi|subfic} %0,%2,%1\;{sf%G1e|subf%G1e} %L0,%L2\";
6904 [(set_attr "type" "two")
6905 (set_attr "length" "8")])
6907 (define_insn "*negdi2_noppc64"
6908 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6909 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))]
6910 "! TARGET_POWERPC64"
6913 return (WORDS_BIG_ENDIAN)
6914 ? \"{sfi|subfic} %L0,%L1,0\;{sfze|subfze} %0,%1\"
6915 : \"{sfi|subfic} %0,%1,0\;{sfze|subfze} %L0,%L1\";
6917 [(set_attr "type" "two")
6918 (set_attr "length" "8")])
6920 (define_expand "mulsidi3"
6921 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6922 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6923 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6924 "! TARGET_POWERPC64"
6927 if (! TARGET_POWER && ! TARGET_POWERPC)
6929 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
6930 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
6931 emit_insn (gen_mull_call ());
6932 if (WORDS_BIG_ENDIAN)
6933 emit_move_insn (operands[0], gen_rtx_REG (DImode, 3));
6936 emit_move_insn (operand_subword (operands[0], 0, 0, DImode),
6937 gen_rtx_REG (SImode, 3));
6938 emit_move_insn (operand_subword (operands[0], 1, 0, DImode),
6939 gen_rtx_REG (SImode, 4));
6943 else if (TARGET_POWER)
6945 emit_insn (gen_mulsidi3_mq (operands[0], operands[1], operands[2]));
6950 (define_insn "mulsidi3_mq"
6951 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6952 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6953 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
6954 (clobber (match_scratch:SI 3 "=q"))]
6956 "mul %0,%1,%2\;mfmq %L0"
6957 [(set_attr "type" "imul")
6958 (set_attr "length" "8")])
6960 (define_insn "*mulsidi3_no_mq"
6961 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6962 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6963 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
6964 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
6967 return (WORDS_BIG_ENDIAN)
6968 ? \"mulhw %0,%1,%2\;mullw %L0,%1,%2\"
6969 : \"mulhw %L0,%1,%2\;mullw %0,%1,%2\";
6971 [(set_attr "type" "imul")
6972 (set_attr "length" "8")])
6975 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6976 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6977 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6978 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
6981 (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
6982 (sign_extend:DI (match_dup 2)))
6985 (mult:SI (match_dup 1)
6989 int endian = (WORDS_BIG_ENDIAN == 0);
6990 operands[3] = operand_subword (operands[0], endian, 0, DImode);
6991 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
6994 (define_expand "umulsidi3"
6995 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6996 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6997 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6998 "TARGET_POWERPC && ! TARGET_POWERPC64"
7003 emit_insn (gen_umulsidi3_mq (operands[0], operands[1], operands[2]));
7008 (define_insn "umulsidi3_mq"
7009 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
7010 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
7011 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
7012 (clobber (match_scratch:SI 3 "=q"))]
7013 "TARGET_POWERPC && TARGET_POWER"
7016 return (WORDS_BIG_ENDIAN)
7017 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
7018 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
7020 [(set_attr "type" "imul")
7021 (set_attr "length" "8")])
7023 (define_insn "*umulsidi3_no_mq"
7024 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
7025 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
7026 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
7027 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
7030 return (WORDS_BIG_ENDIAN)
7031 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
7032 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
7034 [(set_attr "type" "imul")
7035 (set_attr "length" "8")])
7038 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7039 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
7040 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
7041 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
7044 (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
7045 (zero_extend:DI (match_dup 2)))
7048 (mult:SI (match_dup 1)
7052 int endian = (WORDS_BIG_ENDIAN == 0);
7053 operands[3] = operand_subword (operands[0], endian, 0, DImode);
7054 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
7057 (define_expand "smulsi3_highpart"
7058 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7060 (lshiftrt:DI (mult:DI (sign_extend:DI
7061 (match_operand:SI 1 "gpc_reg_operand" ""))
7063 (match_operand:SI 2 "gpc_reg_operand" "")))
7068 if (! TARGET_POWER && ! TARGET_POWERPC)
7070 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
7071 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
7072 emit_insn (gen_mulh_call ());
7073 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
7076 else if (TARGET_POWER)
7078 emit_insn (gen_smulsi3_highpart_mq (operands[0], operands[1], operands[2]));
7083 (define_insn "smulsi3_highpart_mq"
7084 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7086 (lshiftrt:DI (mult:DI (sign_extend:DI
7087 (match_operand:SI 1 "gpc_reg_operand" "%r"))
7089 (match_operand:SI 2 "gpc_reg_operand" "r")))
7091 (clobber (match_scratch:SI 3 "=q"))]
7094 [(set_attr "type" "imul")])
7096 (define_insn "*smulsi3_highpart_no_mq"
7097 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7099 (lshiftrt:DI (mult:DI (sign_extend:DI
7100 (match_operand:SI 1 "gpc_reg_operand" "%r"))
7102 (match_operand:SI 2 "gpc_reg_operand" "r")))
7104 "TARGET_POWERPC && ! TARGET_POWER"
7106 [(set_attr "type" "imul")])
7108 (define_expand "umulsi3_highpart"
7109 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7111 (lshiftrt:DI (mult:DI (zero_extend:DI
7112 (match_operand:SI 1 "gpc_reg_operand" ""))
7114 (match_operand:SI 2 "gpc_reg_operand" "")))
7121 emit_insn (gen_umulsi3_highpart_mq (operands[0], operands[1], operands[2]));
7126 (define_insn "umulsi3_highpart_mq"
7127 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7129 (lshiftrt:DI (mult:DI (zero_extend:DI
7130 (match_operand:SI 1 "gpc_reg_operand" "%r"))
7132 (match_operand:SI 2 "gpc_reg_operand" "r")))
7134 (clobber (match_scratch:SI 3 "=q"))]
7135 "TARGET_POWERPC && TARGET_POWER"
7137 [(set_attr "type" "imul")])
7139 (define_insn "*umulsi3_highpart_no_mq"
7140 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7142 (lshiftrt:DI (mult:DI (zero_extend:DI
7143 (match_operand:SI 1 "gpc_reg_operand" "%r"))
7145 (match_operand:SI 2 "gpc_reg_operand" "r")))
7147 "TARGET_POWERPC && ! TARGET_POWER"
7149 [(set_attr "type" "imul")])
7151 ;; If operands 0 and 2 are in the same register, we have a problem. But
7152 ;; operands 0 and 1 (the usual case) can be in the same register. That's
7153 ;; why we have the strange constraints below.
7154 (define_insn "ashldi3_power"
7155 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
7156 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
7157 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
7158 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
7161 {sli|slwi} %0,%L1,%h2\;{cal %L0,0(0)|li %L0,0}
7162 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
7163 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
7164 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2"
7165 [(set_attr "length" "8")])
7167 (define_insn "lshrdi3_power"
7168 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
7169 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
7170 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
7171 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
7174 {s%A2i|s%A2wi} %L0,%1,%h2\;{cal %0,0(0)|li %0,0}
7175 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
7176 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
7177 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2"
7178 [(set_attr "length" "8")])
7180 ;; Shift by a variable amount is too complex to be worth open-coding. We
7181 ;; just handle shifts by constants.
7182 (define_insn "ashrdi3_power"
7183 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
7184 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7185 (match_operand:SI 2 "const_int_operand" "M,i")))
7186 (clobber (match_scratch:SI 3 "=X,q"))]
7189 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
7190 sraiq %0,%1,%h2\;srliq %L0,%L1,%h2"
7191 [(set_attr "type" "shift")
7192 (set_attr "length" "8")])
7194 (define_insn "ashrdi3_no_power"
7195 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
7196 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7197 (match_operand:SI 2 "const_int_operand" "M,i")))]
7198 "TARGET_32BIT && !TARGET_POWERPC64 && !TARGET_POWER && WORDS_BIG_ENDIAN"
7200 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
7201 {sri|srwi} %L0,%L1,%h2\;insrwi %L0,%1,%h2,0\;{srai|srawi} %0,%1,%h2"
7202 [(set_attr "type" "two,three")
7203 (set_attr "length" "8,12")])
7205 (define_insn "*ashrdisi3_noppc64"
7206 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7207 (subreg:SI (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7208 (const_int 32)) 4))]
7209 "TARGET_32BIT && !TARGET_POWERPC64"
7212 if (REGNO (operands[0]) == REGNO (operands[1]))
7215 return \"mr %0,%1\";
7217 [(set_attr "length" "4")])
7220 ;; PowerPC64 DImode operations.
7222 (define_expand "absdi2"
7223 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7224 (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))]
7229 emit_insn (gen_absdi2_isel (operands[0], operands[1]));
7231 emit_insn (gen_absdi2_internal (operands[0], operands[1]));
7235 (define_insn_and_split "absdi2_internal"
7236 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
7237 (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))
7238 (clobber (match_scratch:DI 2 "=&r,&r"))]
7239 "TARGET_POWERPC64 && !TARGET_ISEL"
7241 "&& reload_completed"
7242 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
7243 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
7244 (set (match_dup 0) (minus:DI (match_dup 0) (match_dup 2)))]
7247 (define_insn_and_split "*nabsdi2"
7248 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
7249 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0"))))
7250 (clobber (match_scratch:DI 2 "=&r,&r"))]
7251 "TARGET_POWERPC64 && !TARGET_ISEL"
7253 "&& reload_completed"
7254 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
7255 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
7256 (set (match_dup 0) (minus:DI (match_dup 2) (match_dup 0)))]
7259 (define_insn "muldi3"
7260 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7261 (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
7262 (match_operand:DI 2 "reg_or_short_operand" "r,I")))]
7268 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
7269 (const_string "imul3")
7270 (match_operand:SI 2 "short_cint_operand" "")
7271 (const_string "imul2")]
7272 (const_string "lmul")))])
7274 (define_insn "*muldi3_internal1"
7275 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7276 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
7277 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
7279 (clobber (match_scratch:DI 3 "=r,r"))]
7284 [(set_attr "type" "lmul_compare")
7285 (set_attr "length" "4,8")])
7288 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7289 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
7290 (match_operand:DI 2 "gpc_reg_operand" ""))
7292 (clobber (match_scratch:DI 3 ""))]
7293 "TARGET_POWERPC64 && reload_completed"
7295 (mult:DI (match_dup 1) (match_dup 2)))
7297 (compare:CC (match_dup 3)
7301 (define_insn "*muldi3_internal2"
7302 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7303 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
7304 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
7306 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7307 (mult:DI (match_dup 1) (match_dup 2)))]
7312 [(set_attr "type" "lmul_compare")
7313 (set_attr "length" "4,8")])
7316 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7317 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
7318 (match_operand:DI 2 "gpc_reg_operand" ""))
7320 (set (match_operand:DI 0 "gpc_reg_operand" "")
7321 (mult:DI (match_dup 1) (match_dup 2)))]
7322 "TARGET_POWERPC64 && reload_completed"
7324 (mult:DI (match_dup 1) (match_dup 2)))
7326 (compare:CC (match_dup 0)
7330 (define_insn "smuldi3_highpart"
7331 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7333 (lshiftrt:TI (mult:TI (sign_extend:TI
7334 (match_operand:DI 1 "gpc_reg_operand" "%r"))
7336 (match_operand:DI 2 "gpc_reg_operand" "r")))
7340 [(set_attr "type" "lmul")])
7342 (define_insn "umuldi3_highpart"
7343 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7345 (lshiftrt:TI (mult:TI (zero_extend:TI
7346 (match_operand:DI 1 "gpc_reg_operand" "%r"))
7348 (match_operand:DI 2 "gpc_reg_operand" "r")))
7352 [(set_attr "type" "lmul")])
7354 (define_insn "rotldi3"
7355 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7356 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7357 (match_operand:DI 2 "reg_or_cint_operand" "r,i")))]
7362 [(set_attr "type" "var_shift_rotate,integer")])
7364 (define_insn "*rotldi3_internal2"
7365 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7366 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7367 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
7369 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7376 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7377 (set_attr "length" "4,4,8,8")])
7380 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7381 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7382 (match_operand:DI 2 "reg_or_cint_operand" ""))
7384 (clobber (match_scratch:DI 3 ""))]
7385 "TARGET_POWERPC64 && reload_completed"
7387 (rotate:DI (match_dup 1) (match_dup 2)))
7389 (compare:CC (match_dup 3)
7393 (define_insn "*rotldi3_internal3"
7394 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7395 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7396 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
7398 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7399 (rotate:DI (match_dup 1) (match_dup 2)))]
7406 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7407 (set_attr "length" "4,4,8,8")])
7410 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7411 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7412 (match_operand:DI 2 "reg_or_cint_operand" ""))
7414 (set (match_operand:DI 0 "gpc_reg_operand" "")
7415 (rotate:DI (match_dup 1) (match_dup 2)))]
7416 "TARGET_POWERPC64 && reload_completed"
7418 (rotate:DI (match_dup 1) (match_dup 2)))
7420 (compare:CC (match_dup 0)
7424 (define_insn "*rotldi3_internal4"
7425 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7426 (and:DI (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7427 (match_operand:DI 2 "reg_or_cint_operand" "r,i"))
7428 (match_operand:DI 3 "mask64_operand" "n,n")))]
7431 rldc%B3 %0,%1,%2,%S3
7432 rldic%B3 %0,%1,%H2,%S3"
7433 [(set_attr "type" "var_shift_rotate,integer")])
7435 (define_insn "*rotldi3_internal5"
7436 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7438 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7439 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
7440 (match_operand:DI 3 "mask64_operand" "n,n,n,n"))
7442 (clobber (match_scratch:DI 4 "=r,r,r,r"))]
7445 rldc%B3. %4,%1,%2,%S3
7446 rldic%B3. %4,%1,%H2,%S3
7449 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7450 (set_attr "length" "4,4,8,8")])
7453 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7455 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7456 (match_operand:DI 2 "reg_or_cint_operand" ""))
7457 (match_operand:DI 3 "mask64_operand" ""))
7459 (clobber (match_scratch:DI 4 ""))]
7460 "TARGET_POWERPC64 && reload_completed"
7462 (and:DI (rotate:DI (match_dup 1)
7466 (compare:CC (match_dup 4)
7470 (define_insn "*rotldi3_internal6"
7471 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
7473 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7474 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
7475 (match_operand:DI 3 "mask64_operand" "n,n,n,n"))
7477 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7478 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7481 rldc%B3. %0,%1,%2,%S3
7482 rldic%B3. %0,%1,%H2,%S3
7485 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7486 (set_attr "length" "4,4,8,8")])
7489 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
7491 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7492 (match_operand:DI 2 "reg_or_cint_operand" ""))
7493 (match_operand:DI 3 "mask64_operand" ""))
7495 (set (match_operand:DI 0 "gpc_reg_operand" "")
7496 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7497 "TARGET_POWERPC64 && reload_completed"
7499 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
7501 (compare:CC (match_dup 0)
7505 (define_insn "*rotldi3_internal7"
7506 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7509 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7510 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
7514 rldicl %0,%1,%H2,56"
7515 [(set_attr "type" "var_shift_rotate,integer")])
7517 (define_insn "*rotldi3_internal8"
7518 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7519 (compare:CC (zero_extend:DI
7521 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7522 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7524 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7528 rldicl. %3,%1,%H2,56
7531 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7532 (set_attr "length" "4,4,8,8")])
7535 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7536 (compare:CC (zero_extend:DI
7538 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7539 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7541 (clobber (match_scratch:DI 3 ""))]
7542 "TARGET_POWERPC64 && reload_completed"
7544 (zero_extend:DI (subreg:QI
7545 (rotate:DI (match_dup 1)
7548 (compare:CC (match_dup 3)
7552 (define_insn "*rotldi3_internal9"
7553 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7554 (compare:CC (zero_extend:DI
7556 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7557 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7559 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7560 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7564 rldicl. %0,%1,%H2,56
7567 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7568 (set_attr "length" "4,4,8,8")])
7571 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7572 (compare:CC (zero_extend:DI
7574 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7575 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7577 (set (match_operand:DI 0 "gpc_reg_operand" "")
7578 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7579 "TARGET_POWERPC64 && reload_completed"
7581 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
7583 (compare:CC (match_dup 0)
7587 (define_insn "*rotldi3_internal10"
7588 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7591 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7592 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
7596 rldicl %0,%1,%H2,48"
7597 [(set_attr "type" "var_shift_rotate,integer")])
7599 (define_insn "*rotldi3_internal11"
7600 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7601 (compare:CC (zero_extend:DI
7603 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7604 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7606 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7610 rldicl. %3,%1,%H2,48
7613 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7614 (set_attr "length" "4,4,8,8")])
7617 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7618 (compare:CC (zero_extend:DI
7620 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7621 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7623 (clobber (match_scratch:DI 3 ""))]
7624 "TARGET_POWERPC64 && reload_completed"
7626 (zero_extend:DI (subreg:HI
7627 (rotate:DI (match_dup 1)
7630 (compare:CC (match_dup 3)
7634 (define_insn "*rotldi3_internal12"
7635 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7636 (compare:CC (zero_extend:DI
7638 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7639 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7641 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7642 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7646 rldicl. %0,%1,%H2,48
7649 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7650 (set_attr "length" "4,4,8,8")])
7653 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7654 (compare:CC (zero_extend:DI
7656 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7657 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7659 (set (match_operand:DI 0 "gpc_reg_operand" "")
7660 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7661 "TARGET_POWERPC64 && reload_completed"
7663 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
7665 (compare:CC (match_dup 0)
7669 (define_insn "*rotldi3_internal13"
7670 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7673 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7674 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
7678 rldicl %0,%1,%H2,32"
7679 [(set_attr "type" "var_shift_rotate,integer")])
7681 (define_insn "*rotldi3_internal14"
7682 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7683 (compare:CC (zero_extend:DI
7685 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7686 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7688 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7692 rldicl. %3,%1,%H2,32
7695 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7696 (set_attr "length" "4,4,8,8")])
7699 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7700 (compare:CC (zero_extend:DI
7702 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7703 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7705 (clobber (match_scratch:DI 3 ""))]
7706 "TARGET_POWERPC64 && reload_completed"
7708 (zero_extend:DI (subreg:SI
7709 (rotate:DI (match_dup 1)
7712 (compare:CC (match_dup 3)
7716 (define_insn "*rotldi3_internal15"
7717 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7718 (compare:CC (zero_extend:DI
7720 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7721 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7723 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7724 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7728 rldicl. %0,%1,%H2,32
7731 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7732 (set_attr "length" "4,4,8,8")])
7735 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7736 (compare:CC (zero_extend:DI
7738 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7739 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7741 (set (match_operand:DI 0 "gpc_reg_operand" "")
7742 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7743 "TARGET_POWERPC64 && reload_completed"
7745 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
7747 (compare:CC (match_dup 0)
7751 (define_expand "ashldi3"
7752 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7753 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7754 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7755 "TARGET_POWERPC64 || TARGET_POWER"
7758 if (TARGET_POWERPC64)
7760 else if (TARGET_POWER)
7762 emit_insn (gen_ashldi3_power (operands[0], operands[1], operands[2]));
7769 (define_insn "*ashldi3_internal1"
7770 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7771 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7772 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
7777 [(set_attr "type" "var_shift_rotate,shift")])
7779 (define_insn "*ashldi3_internal2"
7780 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7781 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7782 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7784 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7791 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7792 (set_attr "length" "4,4,8,8")])
7795 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7796 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7797 (match_operand:SI 2 "reg_or_cint_operand" ""))
7799 (clobber (match_scratch:DI 3 ""))]
7800 "TARGET_POWERPC64 && reload_completed"
7802 (ashift:DI (match_dup 1) (match_dup 2)))
7804 (compare:CC (match_dup 3)
7808 (define_insn "*ashldi3_internal3"
7809 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7810 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7811 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7813 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7814 (ashift:DI (match_dup 1) (match_dup 2)))]
7821 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7822 (set_attr "length" "4,4,8,8")])
7825 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7826 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7827 (match_operand:SI 2 "reg_or_cint_operand" ""))
7829 (set (match_operand:DI 0 "gpc_reg_operand" "")
7830 (ashift:DI (match_dup 1) (match_dup 2)))]
7831 "TARGET_POWERPC64 && reload_completed"
7833 (ashift:DI (match_dup 1) (match_dup 2)))
7835 (compare:CC (match_dup 0)
7839 (define_insn "*ashldi3_internal4"
7840 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7841 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7842 (match_operand:SI 2 "const_int_operand" "i"))
7843 (match_operand:DI 3 "const_int_operand" "n")))]
7844 "TARGET_POWERPC64 && includes_rldic_lshift_p (operands[2], operands[3])"
7845 "rldic %0,%1,%H2,%W3")
7847 (define_insn "ashldi3_internal5"
7848 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7850 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7851 (match_operand:SI 2 "const_int_operand" "i,i"))
7852 (match_operand:DI 3 "const_int_operand" "n,n"))
7854 (clobber (match_scratch:DI 4 "=r,r"))]
7855 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
7857 rldic. %4,%1,%H2,%W3
7859 [(set_attr "type" "compare")
7860 (set_attr "length" "4,8")])
7863 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7865 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7866 (match_operand:SI 2 "const_int_operand" ""))
7867 (match_operand:DI 3 "const_int_operand" ""))
7869 (clobber (match_scratch:DI 4 ""))]
7870 "TARGET_POWERPC64 && reload_completed
7871 && includes_rldic_lshift_p (operands[2], operands[3])"
7873 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7876 (compare:CC (match_dup 4)
7880 (define_insn "*ashldi3_internal6"
7881 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
7883 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7884 (match_operand:SI 2 "const_int_operand" "i,i"))
7885 (match_operand:DI 3 "const_int_operand" "n,n"))
7887 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7888 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7889 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
7891 rldic. %0,%1,%H2,%W3
7893 [(set_attr "type" "compare")
7894 (set_attr "length" "4,8")])
7897 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
7899 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7900 (match_operand:SI 2 "const_int_operand" ""))
7901 (match_operand:DI 3 "const_int_operand" ""))
7903 (set (match_operand:DI 0 "gpc_reg_operand" "")
7904 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7905 "TARGET_POWERPC64 && reload_completed
7906 && includes_rldic_lshift_p (operands[2], operands[3])"
7908 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7911 (compare:CC (match_dup 0)
7915 (define_insn "*ashldi3_internal7"
7916 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7917 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7918 (match_operand:SI 2 "const_int_operand" "i"))
7919 (match_operand:DI 3 "mask64_operand" "n")))]
7920 "TARGET_POWERPC64 && includes_rldicr_lshift_p (operands[2], operands[3])"
7921 "rldicr %0,%1,%H2,%S3")
7923 (define_insn "ashldi3_internal8"
7924 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7926 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7927 (match_operand:SI 2 "const_int_operand" "i,i"))
7928 (match_operand:DI 3 "mask64_operand" "n,n"))
7930 (clobber (match_scratch:DI 4 "=r,r"))]
7931 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
7933 rldicr. %4,%1,%H2,%S3
7935 [(set_attr "type" "compare")
7936 (set_attr "length" "4,8")])
7939 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7941 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7942 (match_operand:SI 2 "const_int_operand" ""))
7943 (match_operand:DI 3 "mask64_operand" ""))
7945 (clobber (match_scratch:DI 4 ""))]
7946 "TARGET_POWERPC64 && reload_completed
7947 && includes_rldicr_lshift_p (operands[2], operands[3])"
7949 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7952 (compare:CC (match_dup 4)
7956 (define_insn "*ashldi3_internal9"
7957 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
7959 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7960 (match_operand:SI 2 "const_int_operand" "i,i"))
7961 (match_operand:DI 3 "mask64_operand" "n,n"))
7963 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7964 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7965 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
7967 rldicr. %0,%1,%H2,%S3
7969 [(set_attr "type" "compare")
7970 (set_attr "length" "4,8")])
7973 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
7975 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7976 (match_operand:SI 2 "const_int_operand" ""))
7977 (match_operand:DI 3 "mask64_operand" ""))
7979 (set (match_operand:DI 0 "gpc_reg_operand" "")
7980 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7981 "TARGET_POWERPC64 && reload_completed
7982 && includes_rldicr_lshift_p (operands[2], operands[3])"
7984 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7987 (compare:CC (match_dup 0)
7991 (define_expand "lshrdi3"
7992 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7993 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7994 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7995 "TARGET_POWERPC64 || TARGET_POWER"
7998 if (TARGET_POWERPC64)
8000 else if (TARGET_POWER)
8002 emit_insn (gen_lshrdi3_power (operands[0], operands[1], operands[2]));
8009 (define_insn "*lshrdi3_internal1"
8010 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8011 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
8012 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
8017 [(set_attr "type" "var_shift_rotate,shift")])
8019 (define_insn "*lshrdi3_internal2"
8020 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
8021 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8022 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
8024 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
8031 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8032 (set_attr "length" "4,4,8,8")])
8035 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8036 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
8037 (match_operand:SI 2 "reg_or_cint_operand" ""))
8039 (clobber (match_scratch:DI 3 ""))]
8040 "TARGET_POWERPC64 && reload_completed"
8042 (lshiftrt:DI (match_dup 1) (match_dup 2)))
8044 (compare:CC (match_dup 3)
8048 (define_insn "*lshrdi3_internal3"
8049 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
8050 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8051 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
8053 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
8054 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
8061 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8062 (set_attr "length" "4,4,8,8")])
8065 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8066 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
8067 (match_operand:SI 2 "reg_or_cint_operand" ""))
8069 (set (match_operand:DI 0 "gpc_reg_operand" "")
8070 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
8071 "TARGET_POWERPC64 && reload_completed"
8073 (lshiftrt:DI (match_dup 1) (match_dup 2)))
8075 (compare:CC (match_dup 0)
8079 (define_expand "ashrdi3"
8080 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8081 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
8082 (match_operand:SI 2 "reg_or_cint_operand" "")))]
8086 if (TARGET_POWERPC64)
8088 else if (TARGET_POWER && GET_CODE (operands[2]) == CONST_INT)
8090 emit_insn (gen_ashrdi3_power (operands[0], operands[1], operands[2]));
8093 else if (TARGET_32BIT && GET_CODE (operands[2]) == CONST_INT
8094 && WORDS_BIG_ENDIAN)
8096 emit_insn (gen_ashrdi3_no_power (operands[0], operands[1], operands[2]));
8103 (define_insn "*ashrdi3_internal1"
8104 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8105 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
8106 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
8111 [(set_attr "type" "var_shift_rotate,shift")])
8113 (define_insn "*ashrdi3_internal2"
8114 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
8115 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8116 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
8118 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
8125 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8126 (set_attr "length" "4,4,8,8")])
8129 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
8130 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
8131 (match_operand:SI 2 "reg_or_cint_operand" ""))
8133 (clobber (match_scratch:DI 3 ""))]
8134 "TARGET_POWERPC64 && reload_completed"
8136 (ashiftrt:DI (match_dup 1) (match_dup 2)))
8138 (compare:CC (match_dup 3)
8142 (define_insn "*ashrdi3_internal3"
8143 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
8144 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8145 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
8147 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
8148 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
8155 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8156 (set_attr "length" "4,4,8,8")])
8159 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
8160 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
8161 (match_operand:SI 2 "reg_or_cint_operand" ""))
8163 (set (match_operand:DI 0 "gpc_reg_operand" "")
8164 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
8165 "TARGET_POWERPC64 && reload_completed"
8167 (ashiftrt:DI (match_dup 1) (match_dup 2)))
8169 (compare:CC (match_dup 0)
8173 (define_expand "anddi3"
8175 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8176 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8177 (match_operand:DI 2 "and64_2_operand" "")))
8178 (clobber (match_scratch:CC 3 ""))])]
8182 (define_insn "anddi3_mc"
8183 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
8184 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r")
8185 (match_operand:DI 2 "and64_2_operand" "?r,S,T,K,J,t")))
8186 (clobber (match_scratch:CC 3 "=X,X,X,x,x,X"))]
8187 "TARGET_POWERPC64 && rs6000_gen_cell_microcode"
8190 rldic%B2 %0,%1,0,%S2
8191 rlwinm %0,%1,0,%m2,%M2
8195 [(set_attr "type" "*,*,*,fast_compare,fast_compare,*")
8196 (set_attr "length" "4,4,4,4,4,8")])
8198 (define_insn "anddi3_nomc"
8199 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
8200 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r")
8201 (match_operand:DI 2 "and64_2_operand" "?r,S,T,t")))
8202 (clobber (match_scratch:CC 3 "=X,X,X,X"))]
8203 "TARGET_POWERPC64 && !rs6000_gen_cell_microcode"
8206 rldic%B2 %0,%1,0,%S2
8207 rlwinm %0,%1,0,%m2,%M2
8209 [(set_attr "length" "4,4,4,8")])
8212 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8213 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8214 (match_operand:DI 2 "mask64_2_operand" "")))
8215 (clobber (match_scratch:CC 3 ""))]
8217 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
8218 && !mask_operand (operands[2], DImode)
8219 && !mask64_operand (operands[2], DImode)"
8221 (and:DI (rotate:DI (match_dup 1)
8225 (and:DI (rotate:DI (match_dup 0)
8229 build_mask64_2_operands (operands[2], &operands[4]);
8232 (define_insn "*anddi3_internal2_mc"
8233 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,x,?y,?y,?y,??y,??y,?y")
8234 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r,r,r")
8235 (match_operand:DI 2 "and64_2_operand" "r,S,T,K,J,t,r,S,T,K,J,t"))
8237 (clobber (match_scratch:DI 3 "=r,r,r,r,r,r,r,r,r,r,r,r"))
8238 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,X,X,x,x,X"))]
8239 "TARGET_64BIT && rs6000_gen_cell_microcode"
8242 rldic%B2. %3,%1,0,%S2
8243 rlwinm. %3,%1,0,%m2,%M2
8253 [(set_attr "type" "fast_compare,compare,delayed_compare,fast_compare,\
8254 fast_compare,compare,compare,compare,compare,compare,\
8256 (set_attr "length" "4,4,4,4,4,8,8,8,8,8,8,12")])
8259 [(set (match_operand:CC 0 "cc_reg_operand" "")
8260 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8261 (match_operand:DI 2 "mask64_2_operand" ""))
8263 (clobber (match_scratch:DI 3 ""))
8264 (clobber (match_scratch:CC 4 ""))]
8265 "TARGET_64BIT && reload_completed
8266 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
8267 && !mask_operand (operands[2], DImode)
8268 && !mask64_operand (operands[2], DImode)"
8270 (and:DI (rotate:DI (match_dup 1)
8273 (parallel [(set (match_dup 0)
8274 (compare:CC (and:DI (rotate:DI (match_dup 3)
8278 (clobber (match_dup 3))])]
8281 build_mask64_2_operands (operands[2], &operands[5]);
8284 (define_insn "*anddi3_internal3_mc"
8285 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,x,x,?y,?y,?y,??y,??y,?y")
8286 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r,r,r")
8287 (match_operand:DI 2 "and64_2_operand" "r,S,T,K,J,t,r,S,T,K,J,t"))
8289 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r,r,r")
8290 (and:DI (match_dup 1) (match_dup 2)))
8291 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,X,X,x,x,X"))]
8292 "TARGET_64BIT && rs6000_gen_cell_microcode"
8295 rldic%B2. %0,%1,0,%S2
8296 rlwinm. %0,%1,0,%m2,%M2
8306 [(set_attr "type" "fast_compare,compare,delayed_compare,fast_compare,\
8307 fast_compare,compare,compare,compare,compare,compare,\
8309 (set_attr "length" "4,4,4,4,4,8,8,8,8,8,8,12")])
8312 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8313 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8314 (match_operand:DI 2 "and64_2_operand" ""))
8316 (set (match_operand:DI 0 "gpc_reg_operand" "")
8317 (and:DI (match_dup 1) (match_dup 2)))
8318 (clobber (match_scratch:CC 4 ""))]
8319 "TARGET_64BIT && reload_completed"
8320 [(parallel [(set (match_dup 0)
8321 (and:DI (match_dup 1) (match_dup 2)))
8322 (clobber (match_dup 4))])
8324 (compare:CC (match_dup 0)
8329 [(set (match_operand:CC 3 "cc_reg_operand" "")
8330 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8331 (match_operand:DI 2 "mask64_2_operand" ""))
8333 (set (match_operand:DI 0 "gpc_reg_operand" "")
8334 (and:DI (match_dup 1) (match_dup 2)))
8335 (clobber (match_scratch:CC 4 ""))]
8336 "TARGET_64BIT && reload_completed
8337 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
8338 && !mask_operand (operands[2], DImode)
8339 && !mask64_operand (operands[2], DImode)"
8341 (and:DI (rotate:DI (match_dup 1)
8344 (parallel [(set (match_dup 3)
8345 (compare:CC (and:DI (rotate:DI (match_dup 0)
8350 (and:DI (rotate:DI (match_dup 0)
8355 build_mask64_2_operands (operands[2], &operands[5]);
8358 (define_expand "iordi3"
8359 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8360 (ior:DI (match_operand:DI 1 "gpc_reg_operand" "")
8361 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
8365 if (non_logical_cint_operand (operands[2], DImode))
8367 HOST_WIDE_INT value;
8368 rtx tmp = ((!can_create_pseudo_p ()
8369 || rtx_equal_p (operands[0], operands[1]))
8370 ? operands[0] : gen_reg_rtx (DImode));
8372 if (GET_CODE (operands[2]) == CONST_INT)
8374 value = INTVAL (operands[2]);
8375 emit_insn (gen_iordi3 (tmp, operands[1],
8376 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
8380 value = CONST_DOUBLE_LOW (operands[2]);
8381 emit_insn (gen_iordi3 (tmp, operands[1],
8382 immed_double_const (value
8383 & (~ (HOST_WIDE_INT) 0xffff),
8387 emit_insn (gen_iordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
8392 (define_expand "xordi3"
8393 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8394 (xor:DI (match_operand:DI 1 "gpc_reg_operand" "")
8395 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
8399 if (non_logical_cint_operand (operands[2], DImode))
8401 HOST_WIDE_INT value;
8402 rtx tmp = ((!can_create_pseudo_p ()
8403 || rtx_equal_p (operands[0], operands[1]))
8404 ? operands[0] : gen_reg_rtx (DImode));
8406 if (GET_CODE (operands[2]) == CONST_INT)
8408 value = INTVAL (operands[2]);
8409 emit_insn (gen_xordi3 (tmp, operands[1],
8410 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
8414 value = CONST_DOUBLE_LOW (operands[2]);
8415 emit_insn (gen_xordi3 (tmp, operands[1],
8416 immed_double_const (value
8417 & (~ (HOST_WIDE_INT) 0xffff),
8421 emit_insn (gen_xordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
8426 (define_insn "*booldi3_internal1"
8427 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
8428 (match_operator:DI 3 "boolean_or_operator"
8429 [(match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
8430 (match_operand:DI 2 "logical_operand" "r,K,JF")]))]
8437 (define_insn "*booldi3_internal2"
8438 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
8439 (compare:CC (match_operator:DI 4 "boolean_or_operator"
8440 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
8441 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
8443 (clobber (match_scratch:DI 3 "=r,r"))]
8448 [(set_attr "type" "fast_compare,compare")
8449 (set_attr "length" "4,8")])
8452 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8453 (compare:CC (match_operator:DI 4 "boolean_operator"
8454 [(match_operand:DI 1 "gpc_reg_operand" "")
8455 (match_operand:DI 2 "gpc_reg_operand" "")])
8457 (clobber (match_scratch:DI 3 ""))]
8458 "TARGET_POWERPC64 && reload_completed"
8459 [(set (match_dup 3) (match_dup 4))
8461 (compare:CC (match_dup 3)
8465 (define_insn "*booldi3_internal3"
8466 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
8467 (compare:CC (match_operator:DI 4 "boolean_or_operator"
8468 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
8469 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
8471 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8477 [(set_attr "type" "fast_compare,compare")
8478 (set_attr "length" "4,8")])
8481 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8482 (compare:CC (match_operator:DI 4 "boolean_operator"
8483 [(match_operand:DI 1 "gpc_reg_operand" "")
8484 (match_operand:DI 2 "gpc_reg_operand" "")])
8486 (set (match_operand:DI 0 "gpc_reg_operand" "")
8488 "TARGET_POWERPC64 && reload_completed"
8489 [(set (match_dup 0) (match_dup 4))
8491 (compare:CC (match_dup 0)
8495 ;; Split a logical operation that we can't do in one insn into two insns,
8496 ;; each of which does one 16-bit part. This is used by combine.
8499 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8500 (match_operator:DI 3 "boolean_or_operator"
8501 [(match_operand:DI 1 "gpc_reg_operand" "")
8502 (match_operand:DI 2 "non_logical_cint_operand" "")]))]
8504 [(set (match_dup 0) (match_dup 4))
8505 (set (match_dup 0) (match_dup 5))]
8510 if (GET_CODE (operands[2]) == CONST_DOUBLE)
8512 HOST_WIDE_INT value = CONST_DOUBLE_LOW (operands[2]);
8513 i3 = immed_double_const (value & (~ (HOST_WIDE_INT) 0xffff),
8515 i4 = GEN_INT (value & 0xffff);
8519 i3 = GEN_INT (INTVAL (operands[2])
8520 & (~ (HOST_WIDE_INT) 0xffff));
8521 i4 = GEN_INT (INTVAL (operands[2]) & 0xffff);
8523 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
8525 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
8529 (define_insn "*boolcdi3_internal1"
8530 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
8531 (match_operator:DI 3 "boolean_operator"
8532 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
8533 (match_operand:DI 2 "gpc_reg_operand" "r")]))]
8537 (define_insn "*boolcdi3_internal2"
8538 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
8539 (compare:CC (match_operator:DI 4 "boolean_operator"
8540 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
8541 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
8543 (clobber (match_scratch:DI 3 "=r,r"))]
8548 [(set_attr "type" "fast_compare,compare")
8549 (set_attr "length" "4,8")])
8552 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8553 (compare:CC (match_operator:DI 4 "boolean_operator"
8554 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
8555 (match_operand:DI 2 "gpc_reg_operand" "")])
8557 (clobber (match_scratch:DI 3 ""))]
8558 "TARGET_POWERPC64 && reload_completed"
8559 [(set (match_dup 3) (match_dup 4))
8561 (compare:CC (match_dup 3)
8565 (define_insn "*boolcdi3_internal3"
8566 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
8567 (compare:CC (match_operator:DI 4 "boolean_operator"
8568 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
8569 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
8571 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8577 [(set_attr "type" "fast_compare,compare")
8578 (set_attr "length" "4,8")])
8581 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8582 (compare:CC (match_operator:DI 4 "boolean_operator"
8583 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
8584 (match_operand:DI 2 "gpc_reg_operand" "")])
8586 (set (match_operand:DI 0 "gpc_reg_operand" "")
8588 "TARGET_POWERPC64 && reload_completed"
8589 [(set (match_dup 0) (match_dup 4))
8591 (compare:CC (match_dup 0)
8595 (define_insn "*boolccdi3_internal1"
8596 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
8597 (match_operator:DI 3 "boolean_operator"
8598 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
8599 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r"))]))]
8603 (define_insn "*boolccdi3_internal2"
8604 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
8605 (compare:CC (match_operator:DI 4 "boolean_operator"
8606 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
8607 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
8609 (clobber (match_scratch:DI 3 "=r,r"))]
8614 [(set_attr "type" "fast_compare,compare")
8615 (set_attr "length" "4,8")])
8618 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8619 (compare:CC (match_operator:DI 4 "boolean_operator"
8620 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
8621 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
8623 (clobber (match_scratch:DI 3 ""))]
8624 "TARGET_POWERPC64 && reload_completed"
8625 [(set (match_dup 3) (match_dup 4))
8627 (compare:CC (match_dup 3)
8631 (define_insn "*boolccdi3_internal3"
8632 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
8633 (compare:CC (match_operator:DI 4 "boolean_operator"
8634 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
8635 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
8637 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8643 [(set_attr "type" "fast_compare,compare")
8644 (set_attr "length" "4,8")])
8647 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8648 (compare:CC (match_operator:DI 4 "boolean_operator"
8649 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
8650 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
8652 (set (match_operand:DI 0 "gpc_reg_operand" "")
8654 "TARGET_POWERPC64 && reload_completed"
8655 [(set (match_dup 0) (match_dup 4))
8657 (compare:CC (match_dup 0)
8661 (define_expand "smindi3"
8662 [(match_operand:DI 0 "gpc_reg_operand" "")
8663 (match_operand:DI 1 "gpc_reg_operand" "")
8664 (match_operand:DI 2 "gpc_reg_operand" "")]
8668 rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]);
8672 (define_expand "smaxdi3"
8673 [(match_operand:DI 0 "gpc_reg_operand" "")
8674 (match_operand:DI 1 "gpc_reg_operand" "")
8675 (match_operand:DI 2 "gpc_reg_operand" "")]
8679 rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]);
8683 (define_expand "umindi3"
8684 [(match_operand:DI 0 "gpc_reg_operand" "")
8685 (match_operand:DI 1 "gpc_reg_operand" "")
8686 (match_operand:DI 2 "gpc_reg_operand" "")]
8690 rs6000_emit_minmax (operands[0], UMIN, operands[1], operands[2]);
8694 (define_expand "umaxdi3"
8695 [(match_operand:DI 0 "gpc_reg_operand" "")
8696 (match_operand:DI 1 "gpc_reg_operand" "")
8697 (match_operand:DI 2 "gpc_reg_operand" "")]
8701 rs6000_emit_minmax (operands[0], UMAX, operands[1], operands[2]);
8706 ;; Now define ways of moving data around.
8708 ;; Set up a register with a value from the GOT table
8710 (define_expand "movsi_got"
8711 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8712 (unspec:SI [(match_operand:SI 1 "got_operand" "")
8713 (match_dup 2)] UNSPEC_MOVSI_GOT))]
8714 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
8717 if (GET_CODE (operands[1]) == CONST)
8719 rtx offset = const0_rtx;
8720 HOST_WIDE_INT value;
8722 operands[1] = eliminate_constant_term (XEXP (operands[1], 0), &offset);
8723 value = INTVAL (offset);
8726 rtx tmp = (!can_create_pseudo_p ()
8728 : gen_reg_rtx (Pmode));
8729 emit_insn (gen_movsi_got (tmp, operands[1]));
8730 emit_insn (gen_addsi3 (operands[0], tmp, offset));
8735 operands[2] = rs6000_got_register (operands[1]);
8738 (define_insn "*movsi_got_internal"
8739 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8740 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
8741 (match_operand:SI 2 "gpc_reg_operand" "b")]
8743 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
8744 "{l|lwz} %0,%a1@got(%2)"
8745 [(set_attr "type" "load")])
8747 ;; Used by sched, shorten_branches and final when the GOT pseudo reg
8748 ;; didn't get allocated to a hard register.
8750 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8751 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
8752 (match_operand:SI 2 "memory_operand" "")]
8754 "DEFAULT_ABI == ABI_V4
8756 && (reload_in_progress || reload_completed)"
8757 [(set (match_dup 0) (match_dup 2))
8758 (set (match_dup 0) (unspec:SI [(match_dup 1)(match_dup 0)]
8762 ;; For SI, we special-case integers that can't be loaded in one insn. We
8763 ;; do the load 16-bits at a time. We could do this by loading from memory,
8764 ;; and this is even supposed to be faster, but it is simpler not to get
8765 ;; integers in the TOC.
8766 (define_insn "movsi_low"
8767 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8768 (mem:SI (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
8769 (match_operand 2 "" ""))))]
8770 "TARGET_MACHO && ! TARGET_64BIT"
8771 "{l|lwz} %0,lo16(%2)(%1)"
8772 [(set_attr "type" "load")
8773 (set_attr "length" "4")])
8775 (define_insn "*movsi_internal1"
8776 [(set (match_operand:SI 0 "rs6000_nonimmediate_operand" "=r,r,r,m,r,r,r,r,r,*q,*c*l,*h,*h")
8777 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,R,*h,r,r,r,0"))]
8778 "!TARGET_SINGLE_FPU &&
8779 (gpc_reg_operand (operands[0], SImode) || gpc_reg_operand (operands[1], SImode))"
8783 {l%U1%X1|lwz%U1%X1} %0,%1
8784 {st%U0%X0|stw%U0%X0} %1,%0
8794 [(set_attr "type" "*,*,load,store,*,*,*,*,mfjmpr,*,mtjmpr,*,*")
8795 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4,4,4")])
8797 (define_insn "*movsi_internal1_single"
8798 [(set (match_operand:SI 0 "rs6000_nonimmediate_operand" "=r,r,r,m,r,r,r,r,r,*q,*c*l,*h,*h,m,*f")
8799 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,R,*h,r,r,r,0,f,m"))]
8800 "TARGET_SINGLE_FPU &&
8801 (gpc_reg_operand (operands[0], SImode) || gpc_reg_operand (operands[1], SImode))"
8805 {l%U1%X1|lwz%U1%X1} %0,%1
8806 {st%U0%X0|stw%U0%X0} %1,%0
8818 [(set_attr "type" "*,*,load,store,*,*,*,*,mfjmpr,*,mtjmpr,*,*,*,*")
8819 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4,4,4,4,4")])
8821 ;; Split a load of a large constant into the appropriate two-insn
8825 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8826 (match_operand:SI 1 "const_int_operand" ""))]
8827 "(unsigned HOST_WIDE_INT) (INTVAL (operands[1]) + 0x8000) >= 0x10000
8828 && (INTVAL (operands[1]) & 0xffff) != 0"
8832 (ior:SI (match_dup 0)
8835 { rtx tem = rs6000_emit_set_const (operands[0], SImode, operands[1], 2);
8837 if (tem == operands[0])
8843 (define_insn "*mov<mode>_internal2"
8844 [(set (match_operand:CC 2 "cc_reg_operand" "=y,x,?y")
8845 (compare:CC (match_operand:P 1 "gpc_reg_operand" "0,r,r")
8847 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r") (match_dup 1))]
8850 {cmpi|cmp<wd>i} %2,%0,0
8853 [(set_attr "type" "cmp,compare,cmp")
8854 (set_attr "length" "4,4,8")])
8857 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
8858 (compare:CC (match_operand:P 1 "gpc_reg_operand" "")
8860 (set (match_operand:P 0 "gpc_reg_operand" "") (match_dup 1))]
8862 [(set (match_dup 0) (match_dup 1))
8864 (compare:CC (match_dup 0)
8868 (define_insn "*movhi_internal"
8869 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
8870 (match_operand:HI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
8871 "gpc_reg_operand (operands[0], HImode)
8872 || gpc_reg_operand (operands[1], HImode)"
8882 [(set_attr "type" "*,load,store,*,mfjmpr,*,mtjmpr,*")])
8884 (define_expand "mov<mode>"
8885 [(set (match_operand:INT 0 "general_operand" "")
8886 (match_operand:INT 1 "any_operand" ""))]
8888 "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
8890 (define_insn "*movqi_internal"
8891 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
8892 (match_operand:QI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
8893 "gpc_reg_operand (operands[0], QImode)
8894 || gpc_reg_operand (operands[1], QImode)"
8904 [(set_attr "type" "*,load,store,*,mfjmpr,*,mtjmpr,*")])
8906 ;; Here is how to move condition codes around. When we store CC data in
8907 ;; an integer register or memory, we store just the high-order 4 bits.
8908 ;; This lets us not shift in the most common case of CR0.
8909 (define_expand "movcc"
8910 [(set (match_operand:CC 0 "nonimmediate_operand" "")
8911 (match_operand:CC 1 "nonimmediate_operand" ""))]
8915 (define_insn "*movcc_internal1"
8916 [(set (match_operand:CC 0 "nonimmediate_operand" "=y,x,?y,y,r,r,r,r,r,q,cl,r,m")
8917 (match_operand:CC 1 "general_operand" "y,r,r,O,x,y,r,I,h,r,r,m,r"))]
8918 "register_operand (operands[0], CCmode)
8919 || register_operand (operands[1], CCmode)"
8923 {rlinm|rlwinm} %1,%1,%F0,0xffffffff\;mtcrf %R0,%1\;{rlinm|rlwinm} %1,%1,%f0,0xffffffff
8926 mfcr %0%Q1\;{rlinm|rlwinm} %0,%0,%f1,0xf0000000
8932 {l%U1%X1|lwz%U1%X1} %0,%1
8933 {st%U0%U1|stw%U0%U1} %1,%0"
8935 (cond [(eq_attr "alternative" "0,3")
8936 (const_string "cr_logical")
8937 (eq_attr "alternative" "1,2")
8938 (const_string "mtcr")
8939 (eq_attr "alternative" "6,7,9")
8940 (const_string "integer")
8941 (eq_attr "alternative" "8")
8942 (const_string "mfjmpr")
8943 (eq_attr "alternative" "10")
8944 (const_string "mtjmpr")
8945 (eq_attr "alternative" "11")
8946 (const_string "load")
8947 (eq_attr "alternative" "12")
8948 (const_string "store")
8949 (ne (symbol_ref "TARGET_MFCRF") (const_int 0))
8950 (const_string "mfcrf")
8952 (const_string "mfcr")))
8953 (set_attr "length" "4,4,12,4,4,8,4,4,4,4,4,4,4")])
8955 ;; For floating-point, we normally deal with the floating-point registers
8956 ;; unless -msoft-float is used. The sole exception is that parameter passing
8957 ;; can produce floating-point values in fixed-point registers. Unless the
8958 ;; value is a simple constant or already in memory, we deal with this by
8959 ;; allocating memory and copying the value explicitly via that memory location.
8960 (define_expand "movsf"
8961 [(set (match_operand:SF 0 "nonimmediate_operand" "")
8962 (match_operand:SF 1 "any_operand" ""))]
8964 "{ rs6000_emit_move (operands[0], operands[1], SFmode); DONE; }")
8967 [(set (match_operand:SF 0 "gpc_reg_operand" "")
8968 (match_operand:SF 1 "const_double_operand" ""))]
8970 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8971 || (GET_CODE (operands[0]) == SUBREG
8972 && GET_CODE (SUBREG_REG (operands[0])) == REG
8973 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8974 [(set (match_dup 2) (match_dup 3))]
8980 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8981 REAL_VALUE_TO_TARGET_SINGLE (rv, l);
8983 if (! TARGET_POWERPC64)
8984 operands[2] = operand_subword (operands[0], 0, 0, SFmode);
8986 operands[2] = gen_lowpart (SImode, operands[0]);
8988 operands[3] = gen_int_mode (l, SImode);
8991 (define_insn "*movsf_hardfloat"
8992 [(set (match_operand:SF 0 "nonimmediate_operand" "=!r,!r,m,f,f,m,*c*l,*q,!r,*h,!r,!r")
8993 (match_operand:SF 1 "input_operand" "r,m,r,f,m,f,r,r,h,0,G,Fn"))]
8994 "(gpc_reg_operand (operands[0], SFmode)
8995 || gpc_reg_operand (operands[1], SFmode))
8996 && (TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT)"
8999 {l%U1%X1|lwz%U1%X1} %0,%1
9000 {st%U0%X0|stw%U0%X0} %1,%0
9010 [(set_attr "type" "*,load,store,fp,fpload,fpstore,mtjmpr,*,mfjmpr,*,*,*")
9011 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,8")])
9013 (define_insn "*movsf_softfloat"
9014 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,cl,q,r,r,m,r,r,r,r,r,*h")
9015 (match_operand:SF 1 "input_operand" "r,r,r,h,m,r,I,L,R,G,Fn,0"))]
9016 "(gpc_reg_operand (operands[0], SFmode)
9017 || gpc_reg_operand (operands[1], SFmode))
9018 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)"
9024 {l%U1%X1|lwz%U1%X1} %0,%1
9025 {st%U0%X0|stw%U0%X0} %1,%0
9032 [(set_attr "type" "*,mtjmpr,*,mfjmpr,load,store,*,*,*,*,*,*")
9033 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,8,4")])
9036 (define_expand "movdf"
9037 [(set (match_operand:DF 0 "nonimmediate_operand" "")
9038 (match_operand:DF 1 "any_operand" ""))]
9040 "{ rs6000_emit_move (operands[0], operands[1], DFmode); DONE; }")
9043 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9044 (match_operand:DF 1 "const_int_operand" ""))]
9045 "! TARGET_POWERPC64 && reload_completed
9046 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
9047 || (GET_CODE (operands[0]) == SUBREG
9048 && GET_CODE (SUBREG_REG (operands[0])) == REG
9049 && REGNO (SUBREG_REG (operands[0])) <= 31))"
9050 [(set (match_dup 2) (match_dup 4))
9051 (set (match_dup 3) (match_dup 1))]
9054 int endian = (WORDS_BIG_ENDIAN == 0);
9055 HOST_WIDE_INT value = INTVAL (operands[1]);
9057 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
9058 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
9059 #if HOST_BITS_PER_WIDE_INT == 32
9060 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
9062 operands[4] = GEN_INT (value >> 32);
9063 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
9068 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9069 (match_operand:DF 1 "const_double_operand" ""))]
9070 "! TARGET_POWERPC64 && reload_completed
9071 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
9072 || (GET_CODE (operands[0]) == SUBREG
9073 && GET_CODE (SUBREG_REG (operands[0])) == REG
9074 && REGNO (SUBREG_REG (operands[0])) <= 31))"
9075 [(set (match_dup 2) (match_dup 4))
9076 (set (match_dup 3) (match_dup 5))]
9079 int endian = (WORDS_BIG_ENDIAN == 0);
9083 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
9084 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
9086 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
9087 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
9088 operands[4] = gen_int_mode (l[endian], SImode);
9089 operands[5] = gen_int_mode (l[1 - endian], SImode);
9093 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9094 (match_operand:DF 1 "const_double_operand" ""))]
9095 "TARGET_POWERPC64 && reload_completed
9096 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
9097 || (GET_CODE (operands[0]) == SUBREG
9098 && GET_CODE (SUBREG_REG (operands[0])) == REG
9099 && REGNO (SUBREG_REG (operands[0])) <= 31))"
9100 [(set (match_dup 2) (match_dup 3))]
9103 int endian = (WORDS_BIG_ENDIAN == 0);
9106 #if HOST_BITS_PER_WIDE_INT >= 64
9110 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
9111 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
9113 operands[2] = gen_lowpart (DImode, operands[0]);
9114 /* HIGHPART is lower memory address when WORDS_BIG_ENDIAN. */
9115 #if HOST_BITS_PER_WIDE_INT >= 64
9116 val = ((HOST_WIDE_INT)(unsigned long)l[endian] << 32
9117 | ((HOST_WIDE_INT)(unsigned long)l[1 - endian]));
9119 operands[3] = gen_int_mode (val, DImode);
9121 operands[3] = immed_double_const (l[1 - endian], l[endian], DImode);
9125 ;; Don't have reload use general registers to load a constant. First,
9126 ;; it might not work if the output operand is the equivalent of
9127 ;; a non-offsettable memref, but also it is less efficient than loading
9128 ;; the constant into an FP register, since it will probably be used there.
9129 ;; The "??" is a kludge until we can figure out a more reasonable way
9130 ;; of handling these non-offsettable values.
9131 (define_insn "*movdf_hardfloat32"
9132 [(set (match_operand:DF 0 "nonimmediate_operand" "=!r,??r,m,ws,?wa,ws,?wa,Z,?Z,d,d,m,wa,!r,!r,!r")
9133 (match_operand:DF 1 "input_operand" "r,m,r,ws,wa,Z,Z,ws,wa,d,m,d,j,G,H,F"))]
9134 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9135 && (gpc_reg_operand (operands[0], DFmode)
9136 || gpc_reg_operand (operands[1], DFmode))"
9139 switch (which_alternative)
9144 /* We normally copy the low-numbered register first. However, if
9145 the first register operand 0 is the same as the second register
9146 of operand 1, we must copy in the opposite order. */
9147 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
9148 return \"mr %L0,%L1\;mr %0,%1\";
9150 return \"mr %0,%1\;mr %L0,%L1\";
9152 if (rs6000_offsettable_memref_p (operands[1])
9153 || (GET_CODE (operands[1]) == MEM
9154 && (GET_CODE (XEXP (operands[1], 0)) == LO_SUM
9155 || GET_CODE (XEXP (operands[1], 0)) == PRE_INC
9156 || GET_CODE (XEXP (operands[1], 0)) == PRE_DEC
9157 || GET_CODE (XEXP (operands[1], 0)) == PRE_MODIFY)))
9159 /* If the low-address word is used in the address, we must load
9160 it last. Otherwise, load it first. Note that we cannot have
9161 auto-increment in that case since the address register is
9162 known to be dead. */
9163 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
9165 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
9167 return \"{l%U1%X1|lwz%U1%X1} %0,%1\;{l|lwz} %L0,%L1\";
9173 addreg = find_addr_reg (XEXP (operands[1], 0));
9174 if (refers_to_regno_p (REGNO (operands[0]),
9175 REGNO (operands[0]) + 1,
9178 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
9179 output_asm_insn (\"{l%X1|lwz%X1} %L0,%1\", operands);
9180 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
9181 return \"{l%X1|lwz%X1} %0,%1\";
9185 output_asm_insn (\"{l%X1|lwz%X1} %0,%1\", operands);
9186 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
9187 output_asm_insn (\"{l%X1|lwz%X1} %L0,%1\", operands);
9188 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
9193 if (rs6000_offsettable_memref_p (operands[0])
9194 || (GET_CODE (operands[0]) == MEM
9195 && (GET_CODE (XEXP (operands[0], 0)) == LO_SUM
9196 || GET_CODE (XEXP (operands[0], 0)) == PRE_INC
9197 || GET_CODE (XEXP (operands[0], 0)) == PRE_DEC
9198 || GET_CODE (XEXP (operands[0], 0)) == PRE_MODIFY)))
9199 return \"{st%U0%X0|stw%U0%X0} %1,%0\;{st|stw} %L1,%L0\";
9204 addreg = find_addr_reg (XEXP (operands[0], 0));
9205 output_asm_insn (\"{st%X0|stw%X0} %1,%0\", operands);
9206 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
9207 output_asm_insn (\"{st%X0|stw%X0} %L1,%0\", operands);
9208 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
9213 return \"xxlor %x0,%x1,%x1\";
9216 return \"lxsd%U1x %x0,%y1\";
9219 return \"stxsd%U0x %x1,%y0\";
9221 return \"fmr %0,%1\";
9223 return \"lfd%U1%X1 %0,%1\";
9225 return \"stfd%U0%X0 %1,%0\";
9227 return \"xxlxor %x0,%x0,%x0\";
9234 [(set_attr "type" "two,load,store,fp,fp,fpload,fpload,fpstore,fpstore,fp,fpload,fpstore,vecsimple,*,*,*")
9235 (set_attr "length" "8,16,16,4,4,4,4,4,4,4,4,4,4,8,12,16")])
9237 (define_insn "*movdf_softfloat32"
9238 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,m,r,r,r")
9239 (match_operand:DF 1 "input_operand" "r,m,r,G,H,F"))]
9241 && ((TARGET_FPRS && TARGET_SINGLE_FLOAT)
9242 || TARGET_SOFT_FLOAT || TARGET_E500_SINGLE)
9243 && (gpc_reg_operand (operands[0], DFmode)
9244 || gpc_reg_operand (operands[1], DFmode))"
9247 switch (which_alternative)
9252 /* We normally copy the low-numbered register first. However, if
9253 the first register operand 0 is the same as the second register of
9254 operand 1, we must copy in the opposite order. */
9255 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
9256 return \"mr %L0,%L1\;mr %0,%1\";
9258 return \"mr %0,%1\;mr %L0,%L1\";
9260 /* If the low-address word is used in the address, we must load
9261 it last. Otherwise, load it first. Note that we cannot have
9262 auto-increment in that case since the address register is
9263 known to be dead. */
9264 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
9266 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
9268 return \"{l%U1%X1|lwz%U1%X1} %0,%1\;{l|lwz} %L0,%L1\";
9270 return \"{st%U0%X0|stw%U0%X0} %1,%0\;{st|stw} %L1,%L0\";
9277 [(set_attr "type" "two,load,store,*,*,*")
9278 (set_attr "length" "8,8,8,8,12,16")])
9280 ; ld/std require word-aligned displacements -> 'Y' constraint.
9281 ; List Y->r and r->Y before r->r for reload.
9282 (define_insn "*movdf_hardfloat64_mfpgpr"
9283 [(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")
9284 (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"))]
9285 "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
9286 && TARGET_DOUBLE_FLOAT
9287 && (gpc_reg_operand (operands[0], DFmode)
9288 || gpc_reg_operand (operands[1], DFmode))"
9311 [(set_attr "type" "store,load,*,fp,fp,fpload,fpload,fpstore,fpstore,fp,fpload,fpstore,vecsimple,mtjmpr,mfjmpr,*,*,*,*,mftgpr,mffgpr")
9312 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,8,12,16,4,4")])
9314 ; ld/std require word-aligned displacements -> 'Y' constraint.
9315 ; List Y->r and r->Y before r->r for reload.
9316 (define_insn "*movdf_hardfloat64"
9317 [(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")
9318 (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"))]
9319 "TARGET_POWERPC64 && !TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
9320 && TARGET_DOUBLE_FLOAT
9321 && (gpc_reg_operand (operands[0], DFmode)
9322 || gpc_reg_operand (operands[1], DFmode))"
9343 [(set_attr "type" "store,load,*,fp,fp,fpload,fpload,fpstore,fpstore,fp,fpload,fpstore,vecsimple,mtjmpr,mfjmpr,*,*,*,*")
9344 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,8,12,16")])
9346 (define_insn "*movdf_softfloat64"
9347 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,Y,r,cl,r,r,r,r,*h")
9348 (match_operand:DF 1 "input_operand" "Y,r,r,r,h,G,H,F,0"))]
9349 "TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)
9350 && (gpc_reg_operand (operands[0], DFmode)
9351 || gpc_reg_operand (operands[1], DFmode))"
9362 [(set_attr "type" "load,store,*,mtjmpr,mfjmpr,*,*,*,*")
9363 (set_attr "length" "4,4,4,4,4,8,12,16,4")])
9365 (define_expand "movtf"
9366 [(set (match_operand:TF 0 "general_operand" "")
9367 (match_operand:TF 1 "any_operand" ""))]
9368 "!TARGET_IEEEQUAD && TARGET_LONG_DOUBLE_128"
9369 "{ rs6000_emit_move (operands[0], operands[1], TFmode); DONE; }")
9371 ; It's important to list the o->f and f->o moves before f->f because
9372 ; otherwise reload, given m->f, will try to pick f->f and reload it,
9373 ; which doesn't make progress. Likewise r->Y must be before r->r.
9374 (define_insn_and_split "*movtf_internal"
9375 [(set (match_operand:TF 0 "nonimmediate_operand" "=o,d,d,r,Y,r")
9376 (match_operand:TF 1 "input_operand" "d,o,d,YGHF,r,r"))]
9378 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128
9379 && (gpc_reg_operand (operands[0], TFmode)
9380 || gpc_reg_operand (operands[1], TFmode))"
9382 "&& reload_completed"
9384 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
9385 [(set_attr "length" "8,8,8,20,20,16")])
9387 (define_insn_and_split "*movtf_softfloat"
9388 [(set (match_operand:TF 0 "rs6000_nonimmediate_operand" "=r,Y,r")
9389 (match_operand:TF 1 "input_operand" "YGHF,r,r"))]
9391 && (TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_LONG_DOUBLE_128
9392 && (gpc_reg_operand (operands[0], TFmode)
9393 || gpc_reg_operand (operands[1], TFmode))"
9395 "&& reload_completed"
9397 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
9398 [(set_attr "length" "20,20,16")])
9400 (define_expand "extenddftf2"
9401 [(set (match_operand:TF 0 "nonimmediate_operand" "")
9402 (float_extend:TF (match_operand:DF 1 "input_operand" "")))]
9404 && TARGET_HARD_FLOAT
9405 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9406 && TARGET_LONG_DOUBLE_128"
9408 if (TARGET_E500_DOUBLE)
9409 emit_insn (gen_spe_extenddftf2 (operands[0], operands[1]));
9411 emit_insn (gen_extenddftf2_fprs (operands[0], operands[1]));
9415 (define_expand "extenddftf2_fprs"
9416 [(parallel [(set (match_operand:TF 0 "nonimmediate_operand" "")
9417 (float_extend:TF (match_operand:DF 1 "input_operand" "")))
9418 (use (match_dup 2))])]
9420 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9421 && TARGET_LONG_DOUBLE_128"
9423 operands[2] = CONST0_RTX (DFmode);
9424 /* Generate GOT reference early for SVR4 PIC. */
9425 if (DEFAULT_ABI == ABI_V4 && flag_pic)
9426 operands[2] = validize_mem (force_const_mem (DFmode, operands[2]));
9429 (define_insn_and_split "*extenddftf2_internal"
9430 [(set (match_operand:TF 0 "nonimmediate_operand" "=o,d,&d,r")
9431 (float_extend:TF (match_operand:DF 1 "input_operand" "dr,md,md,rmGHF")))
9432 (use (match_operand:DF 2 "zero_reg_mem_operand" "rd,m,d,n"))]
9434 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9435 && TARGET_LONG_DOUBLE_128"
9437 "&& reload_completed"
9440 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
9441 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
9442 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word),
9444 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word),
9449 (define_expand "extendsftf2"
9450 [(set (match_operand:TF 0 "nonimmediate_operand" "")
9451 (float_extend:TF (match_operand:SF 1 "gpc_reg_operand" "")))]
9453 && TARGET_HARD_FLOAT
9454 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9455 && TARGET_LONG_DOUBLE_128"
9457 rtx tmp = gen_reg_rtx (DFmode);
9458 emit_insn (gen_extendsfdf2 (tmp, operands[1]));
9459 emit_insn (gen_extenddftf2 (operands[0], tmp));
9463 (define_expand "trunctfdf2"
9464 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9465 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "")))]
9467 && TARGET_HARD_FLOAT
9468 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9469 && TARGET_LONG_DOUBLE_128"
9472 (define_insn_and_split "trunctfdf2_internal1"
9473 [(set (match_operand:DF 0 "gpc_reg_operand" "=d,?d")
9474 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "0,d")))]
9475 "!TARGET_IEEEQUAD && !TARGET_XL_COMPAT
9476 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9480 "&& reload_completed && REGNO (operands[0]) == REGNO (operands[1])"
9483 emit_note (NOTE_INSN_DELETED);
9486 [(set_attr "type" "fp")])
9488 (define_insn "trunctfdf2_internal2"
9489 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
9490 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "d")))]
9491 "!TARGET_IEEEQUAD && TARGET_XL_COMPAT
9492 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9493 && TARGET_LONG_DOUBLE_128"
9495 [(set_attr "type" "fp")
9496 (set_attr "fp_type" "fp_addsub_d")])
9498 (define_expand "trunctfsf2"
9499 [(set (match_operand:SF 0 "gpc_reg_operand" "")
9500 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "")))]
9502 && TARGET_HARD_FLOAT
9503 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9504 && TARGET_LONG_DOUBLE_128"
9506 if (TARGET_E500_DOUBLE)
9507 emit_insn (gen_spe_trunctfsf2 (operands[0], operands[1]));
9509 emit_insn (gen_trunctfsf2_fprs (operands[0], operands[1]));
9513 (define_insn_and_split "trunctfsf2_fprs"
9514 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
9515 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "d")))
9516 (clobber (match_scratch:DF 2 "=d"))]
9518 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
9519 && TARGET_LONG_DOUBLE_128"
9521 "&& reload_completed"
9523 (float_truncate:DF (match_dup 1)))
9525 (float_truncate:SF (match_dup 2)))]
9528 (define_expand "floatsitf2"
9529 [(set (match_operand:TF 0 "gpc_reg_operand" "")
9530 (float:TF (match_operand:SI 1 "gpc_reg_operand" "")))]
9532 && TARGET_HARD_FLOAT
9533 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9534 && TARGET_LONG_DOUBLE_128"
9536 rtx tmp = gen_reg_rtx (DFmode);
9537 expand_float (tmp, operands[1], false);
9538 emit_insn (gen_extenddftf2 (operands[0], tmp));
9542 ; fadd, but rounding towards zero.
9543 ; This is probably not the optimal code sequence.
9544 (define_insn "fix_trunc_helper"
9545 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
9546 (unspec:DF [(match_operand:TF 1 "gpc_reg_operand" "d")]
9547 UNSPEC_FIX_TRUNC_TF))
9548 (clobber (match_operand:DF 2 "gpc_reg_operand" "=&d"))]
9549 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
9550 "mffs %2\n\tmtfsb1 31\n\tmtfsb0 30\n\tfadd %0,%1,%L1\n\tmtfsf 1,%2"
9551 [(set_attr "type" "fp")
9552 (set_attr "length" "20")])
9554 (define_expand "fix_trunctfsi2"
9555 [(set (match_operand:SI 0 "gpc_reg_operand" "")
9556 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))]
9558 && (TARGET_POWER2 || TARGET_POWERPC)
9559 && TARGET_HARD_FLOAT
9560 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9561 && TARGET_LONG_DOUBLE_128"
9563 if (TARGET_E500_DOUBLE)
9564 emit_insn (gen_spe_fix_trunctfsi2 (operands[0], operands[1]));
9566 emit_insn (gen_fix_trunctfsi2_fprs (operands[0], operands[1]));
9570 (define_expand "fix_trunctfsi2_fprs"
9571 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
9572 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))
9573 (clobber (match_dup 2))
9574 (clobber (match_dup 3))
9575 (clobber (match_dup 4))
9576 (clobber (match_dup 5))])]
9578 && (TARGET_POWER2 || TARGET_POWERPC)
9579 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9581 operands[2] = gen_reg_rtx (DFmode);
9582 operands[3] = gen_reg_rtx (DFmode);
9583 operands[4] = gen_reg_rtx (DImode);
9584 operands[5] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
9587 (define_insn_and_split "*fix_trunctfsi2_internal"
9588 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9589 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "d")))
9590 (clobber (match_operand:DF 2 "gpc_reg_operand" "=d"))
9591 (clobber (match_operand:DF 3 "gpc_reg_operand" "=&d"))
9592 (clobber (match_operand:DI 4 "gpc_reg_operand" "=d"))
9593 (clobber (match_operand:DI 5 "offsettable_mem_operand" "=o"))]
9595 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9601 emit_insn (gen_fix_trunc_helper (operands[2], operands[1], operands[3]));
9603 gcc_assert (MEM_P (operands[5]));
9604 lowword = adjust_address (operands[5], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
9606 emit_insn (gen_fctiwz (operands[4], operands[2]));
9607 emit_move_insn (operands[5], operands[4]);
9608 emit_move_insn (operands[0], lowword);
9612 (define_expand "negtf2"
9613 [(set (match_operand:TF 0 "gpc_reg_operand" "")
9614 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "")))]
9616 && TARGET_HARD_FLOAT
9617 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9618 && TARGET_LONG_DOUBLE_128"
9621 (define_insn "negtf2_internal"
9622 [(set (match_operand:TF 0 "gpc_reg_operand" "=d")
9623 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "d")))]
9625 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9628 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
9629 return \"fneg %L0,%L1\;fneg %0,%1\";
9631 return \"fneg %0,%1\;fneg %L0,%L1\";
9633 [(set_attr "type" "fp")
9634 (set_attr "length" "8")])
9636 (define_expand "abstf2"
9637 [(set (match_operand:TF 0 "gpc_reg_operand" "")
9638 (abs:TF (match_operand:TF 1 "gpc_reg_operand" "")))]
9640 && TARGET_HARD_FLOAT
9641 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9642 && TARGET_LONG_DOUBLE_128"
9645 rtx label = gen_label_rtx ();
9646 if (TARGET_E500_DOUBLE)
9648 if (flag_finite_math_only && !flag_trapping_math)
9649 emit_insn (gen_spe_abstf2_tst (operands[0], operands[1], label));
9651 emit_insn (gen_spe_abstf2_cmp (operands[0], operands[1], label));
9654 emit_insn (gen_abstf2_internal (operands[0], operands[1], label));
9659 (define_expand "abstf2_internal"
9660 [(set (match_operand:TF 0 "gpc_reg_operand" "")
9661 (match_operand:TF 1 "gpc_reg_operand" ""))
9662 (set (match_dup 3) (match_dup 5))
9663 (set (match_dup 5) (abs:DF (match_dup 5)))
9664 (set (match_dup 4) (compare:CCFP (match_dup 3) (match_dup 5)))
9665 (set (pc) (if_then_else (eq (match_dup 4) (const_int 0))
9666 (label_ref (match_operand 2 "" ""))
9668 (set (match_dup 6) (neg:DF (match_dup 6)))]
9670 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9671 && TARGET_LONG_DOUBLE_128"
9674 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
9675 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
9676 operands[3] = gen_reg_rtx (DFmode);
9677 operands[4] = gen_reg_rtx (CCFPmode);
9678 operands[5] = simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word);
9679 operands[6] = simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word);
9682 ;; Next come the multi-word integer load and store and the load and store
9685 ; List r->r after r->"o<>", otherwise reload will try to reload a
9686 ; non-offsettable address by using r->r which won't make progress.
9687 (define_insn "*movdi_internal32"
9688 [(set (match_operand:DI 0 "rs6000_nonimmediate_operand" "=o<>,r,r,*d,*d,m,r")
9689 (match_operand:DI 1 "input_operand" "r,r,m,d,m,d,IJKnGHF"))]
9691 && (gpc_reg_operand (operands[0], DImode)
9692 || gpc_reg_operand (operands[1], DImode))"
9701 [(set_attr "type" "load,*,store,fp,fpload,fpstore,*")])
9704 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9705 (match_operand:DI 1 "const_int_operand" ""))]
9706 "! TARGET_POWERPC64 && reload_completed"
9707 [(set (match_dup 2) (match_dup 4))
9708 (set (match_dup 3) (match_dup 1))]
9711 HOST_WIDE_INT value = INTVAL (operands[1]);
9712 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
9714 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
9716 #if HOST_BITS_PER_WIDE_INT == 32
9717 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
9719 operands[4] = GEN_INT (value >> 32);
9720 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
9725 [(set (match_operand:DI 0 "rs6000_nonimmediate_operand" "")
9726 (match_operand:DI 1 "input_operand" ""))]
9727 "reload_completed && !TARGET_POWERPC64
9728 && gpr_or_gpr_p (operands[0], operands[1])"
9730 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
9732 (define_insn "*movdi_mfpgpr"
9733 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,*d,*d,m,r,*h,*h,r,*d")
9734 (match_operand:DI 1 "input_operand" "r,m,r,I,L,nF,R,d,m,d,*h,r,0,*d,r"))]
9735 "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
9736 && (gpc_reg_operand (operands[0], DImode)
9737 || gpc_reg_operand (operands[1], DImode))"
9754 [(set_attr "type" "*,load,store,*,*,*,*,fp,fpload,fpstore,mfjmpr,mtjmpr,*,mftgpr,mffgpr")
9755 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4,4,4")])
9757 (define_insn "*movdi_internal64"
9758 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,*d,*d,m,r,*h,*h")
9759 (match_operand:DI 1 "input_operand" "r,m,r,I,L,nF,R,d,m,d,*h,r,0"))]
9760 "TARGET_POWERPC64 && (!TARGET_MFPGPR || !TARGET_HARD_FLOAT || !TARGET_FPRS)
9761 && (gpc_reg_operand (operands[0], DImode)
9762 || gpc_reg_operand (operands[1], DImode))"
9777 [(set_attr "type" "*,load,store,*,*,*,*,fp,fpload,fpstore,mfjmpr,mtjmpr,*")
9778 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4")])
9780 ;; immediate value valid for a single instruction hiding in a const_double
9782 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9783 (match_operand:DI 1 "const_double_operand" "F"))]
9784 "HOST_BITS_PER_WIDE_INT == 32 && TARGET_POWERPC64
9785 && GET_CODE (operands[1]) == CONST_DOUBLE
9786 && num_insns_constant (operands[1], DImode) == 1"
9789 return ((unsigned HOST_WIDE_INT)
9790 (CONST_DOUBLE_LOW (operands[1]) + 0x8000) < 0x10000)
9791 ? \"li %0,%1\" : \"lis %0,%v1\";
9794 ;; Generate all one-bits and clear left or right.
9795 ;; Use (and:DI (rotate:DI ...)) to avoid anddi3 unnecessary clobber.
9797 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9798 (match_operand:DI 1 "mask64_operand" ""))]
9799 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
9800 [(set (match_dup 0) (const_int -1))
9802 (and:DI (rotate:DI (match_dup 0)
9807 ;; Split a load of a large constant into the appropriate five-instruction
9808 ;; sequence. Handle anything in a constant number of insns.
9809 ;; When non-easy constants can go in the TOC, this should use
9810 ;; easy_fp_constant predicate.
9812 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9813 (match_operand:DI 1 "const_int_operand" ""))]
9814 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
9815 [(set (match_dup 0) (match_dup 2))
9816 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
9818 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
9820 if (tem == operands[0])
9827 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9828 (match_operand:DI 1 "const_double_operand" ""))]
9829 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
9830 [(set (match_dup 0) (match_dup 2))
9831 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
9833 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
9835 if (tem == operands[0])
9841 ;; TImode is similar, except that we usually want to compute the address into
9842 ;; a register and use lsi/stsi (the exception is during reload). MQ is also
9843 ;; clobbered in stsi for POWER, so we need a SCRATCH for it.
9845 ;; We say that MQ is clobbered in the last alternative because the first
9846 ;; alternative would never get used otherwise since it would need a reload
9847 ;; while the 2nd alternative would not. We put memory cases first so they
9848 ;; are preferred. Otherwise, we'd try to reload the output instead of
9849 ;; giving the SCRATCH mq.
9851 (define_insn "*movti_power"
9852 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,m,????r,????r,????r,r")
9853 (match_operand:TI 1 "input_operand" "r,r,r,Q,m,n"))
9854 (clobber (match_scratch:SI 2 "=q,q#X,X,X,X,X"))]
9855 "TARGET_POWER && ! TARGET_POWERPC64
9856 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
9859 switch (which_alternative)
9866 return \"{stsi|stswi} %1,%P0,16\";
9871 /* If the address is not used in the output, we can use lsi. Otherwise,
9872 fall through to generating four loads. */
9874 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
9875 return \"{lsi|lswi} %0,%P1,16\";
9876 /* ... fall through ... */
9882 [(set_attr "type" "store,store,*,load,load,*")])
9884 (define_insn "*movti_string"
9885 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,o<>,????r,????r,????r,r")
9886 (match_operand:TI 1 "input_operand" "r,r,r,Q,m,n"))]
9887 "! TARGET_POWER && ! TARGET_POWERPC64
9888 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
9891 switch (which_alternative)
9897 return \"{stsi|stswi} %1,%P0,16\";
9902 /* If the address is not used in the output, we can use lsi. Otherwise,
9903 fall through to generating four loads. */
9905 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
9906 return \"{lsi|lswi} %0,%P1,16\";
9907 /* ... fall through ... */
9913 [(set_attr "type" "store_ux,store_ux,*,load_ux,load_ux,*")
9914 (set (attr "cell_micro") (if_then_else (eq (symbol_ref "TARGET_STRING") (const_int 1))
9915 (const_string "always")
9916 (const_string "conditional")))])
9918 (define_insn "*movti_ppc64"
9919 [(set (match_operand:TI 0 "nonimmediate_operand" "=r,o<>,r")
9920 (match_operand:TI 1 "input_operand" "r,r,m"))]
9921 "(TARGET_POWERPC64 && (gpc_reg_operand (operands[0], TImode)
9922 || gpc_reg_operand (operands[1], TImode)))
9923 && VECTOR_MEM_NONE_P (TImode)"
9925 [(set_attr "type" "*,store,load")])
9928 [(set (match_operand:TI 0 "gpc_reg_operand" "")
9929 (match_operand:TI 1 "const_double_operand" ""))]
9930 "TARGET_POWERPC64 && VECTOR_MEM_NONE_P (TImode)"
9931 [(set (match_dup 2) (match_dup 4))
9932 (set (match_dup 3) (match_dup 5))]
9935 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
9937 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
9939 if (GET_CODE (operands[1]) == CONST_DOUBLE)
9941 operands[4] = GEN_INT (CONST_DOUBLE_HIGH (operands[1]));
9942 operands[5] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
9944 else if (GET_CODE (operands[1]) == CONST_INT)
9946 operands[4] = GEN_INT (- (INTVAL (operands[1]) < 0));
9947 operands[5] = operands[1];
9954 [(set (match_operand:TI 0 "nonimmediate_operand" "")
9955 (match_operand:TI 1 "input_operand" ""))]
9956 "reload_completed && VECTOR_MEM_NONE_P (TImode)
9957 && gpr_or_gpr_p (operands[0], operands[1])"
9959 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
9961 (define_expand "load_multiple"
9962 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
9963 (match_operand:SI 1 "" ""))
9964 (use (match_operand:SI 2 "" ""))])]
9965 "TARGET_STRING && !TARGET_POWERPC64"
9973 /* Support only loading a constant number of fixed-point registers from
9974 memory and only bother with this if more than two; the machine
9975 doesn't support more than eight. */
9976 if (GET_CODE (operands[2]) != CONST_INT
9977 || INTVAL (operands[2]) <= 2
9978 || INTVAL (operands[2]) > 8
9979 || GET_CODE (operands[1]) != MEM
9980 || GET_CODE (operands[0]) != REG
9981 || REGNO (operands[0]) >= 32)
9984 count = INTVAL (operands[2]);
9985 regno = REGNO (operands[0]);
9987 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
9988 op1 = replace_equiv_address (operands[1],
9989 force_reg (SImode, XEXP (operands[1], 0)));
9991 for (i = 0; i < count; i++)
9992 XVECEXP (operands[3], 0, i)
9993 = gen_rtx_SET (VOIDmode, gen_rtx_REG (SImode, regno + i),
9994 adjust_address_nv (op1, SImode, i * 4));
9997 (define_insn "*ldmsi8"
9998 [(match_parallel 0 "load_multiple_operation"
9999 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10000 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10001 (set (match_operand:SI 3 "gpc_reg_operand" "")
10002 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10003 (set (match_operand:SI 4 "gpc_reg_operand" "")
10004 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
10005 (set (match_operand:SI 5 "gpc_reg_operand" "")
10006 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
10007 (set (match_operand:SI 6 "gpc_reg_operand" "")
10008 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
10009 (set (match_operand:SI 7 "gpc_reg_operand" "")
10010 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
10011 (set (match_operand:SI 8 "gpc_reg_operand" "")
10012 (mem:SI (plus:SI (match_dup 1) (const_int 24))))
10013 (set (match_operand:SI 9 "gpc_reg_operand" "")
10014 (mem:SI (plus:SI (match_dup 1) (const_int 28))))])]
10015 "TARGET_STRING && XVECLEN (operands[0], 0) == 8"
10017 { return rs6000_output_load_multiple (operands); }"
10018 [(set_attr "type" "load_ux")
10019 (set_attr "length" "32")])
10021 (define_insn "*ldmsi7"
10022 [(match_parallel 0 "load_multiple_operation"
10023 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10024 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10025 (set (match_operand:SI 3 "gpc_reg_operand" "")
10026 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10027 (set (match_operand:SI 4 "gpc_reg_operand" "")
10028 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
10029 (set (match_operand:SI 5 "gpc_reg_operand" "")
10030 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
10031 (set (match_operand:SI 6 "gpc_reg_operand" "")
10032 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
10033 (set (match_operand:SI 7 "gpc_reg_operand" "")
10034 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
10035 (set (match_operand:SI 8 "gpc_reg_operand" "")
10036 (mem:SI (plus:SI (match_dup 1) (const_int 24))))])]
10037 "TARGET_STRING && XVECLEN (operands[0], 0) == 7"
10039 { return rs6000_output_load_multiple (operands); }"
10040 [(set_attr "type" "load_ux")
10041 (set_attr "length" "32")])
10043 (define_insn "*ldmsi6"
10044 [(match_parallel 0 "load_multiple_operation"
10045 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10046 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10047 (set (match_operand:SI 3 "gpc_reg_operand" "")
10048 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10049 (set (match_operand:SI 4 "gpc_reg_operand" "")
10050 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
10051 (set (match_operand:SI 5 "gpc_reg_operand" "")
10052 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
10053 (set (match_operand:SI 6 "gpc_reg_operand" "")
10054 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
10055 (set (match_operand:SI 7 "gpc_reg_operand" "")
10056 (mem:SI (plus:SI (match_dup 1) (const_int 20))))])]
10057 "TARGET_STRING && XVECLEN (operands[0], 0) == 6"
10059 { return rs6000_output_load_multiple (operands); }"
10060 [(set_attr "type" "load_ux")
10061 (set_attr "length" "32")])
10063 (define_insn "*ldmsi5"
10064 [(match_parallel 0 "load_multiple_operation"
10065 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10066 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10067 (set (match_operand:SI 3 "gpc_reg_operand" "")
10068 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10069 (set (match_operand:SI 4 "gpc_reg_operand" "")
10070 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
10071 (set (match_operand:SI 5 "gpc_reg_operand" "")
10072 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
10073 (set (match_operand:SI 6 "gpc_reg_operand" "")
10074 (mem:SI (plus:SI (match_dup 1) (const_int 16))))])]
10075 "TARGET_STRING && XVECLEN (operands[0], 0) == 5"
10077 { return rs6000_output_load_multiple (operands); }"
10078 [(set_attr "type" "load_ux")
10079 (set_attr "length" "32")])
10081 (define_insn "*ldmsi4"
10082 [(match_parallel 0 "load_multiple_operation"
10083 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10084 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10085 (set (match_operand:SI 3 "gpc_reg_operand" "")
10086 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10087 (set (match_operand:SI 4 "gpc_reg_operand" "")
10088 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
10089 (set (match_operand:SI 5 "gpc_reg_operand" "")
10090 (mem:SI (plus:SI (match_dup 1) (const_int 12))))])]
10091 "TARGET_STRING && XVECLEN (operands[0], 0) == 4"
10093 { return rs6000_output_load_multiple (operands); }"
10094 [(set_attr "type" "load_ux")
10095 (set_attr "length" "32")])
10097 (define_insn "*ldmsi3"
10098 [(match_parallel 0 "load_multiple_operation"
10099 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10100 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10101 (set (match_operand:SI 3 "gpc_reg_operand" "")
10102 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10103 (set (match_operand:SI 4 "gpc_reg_operand" "")
10104 (mem:SI (plus:SI (match_dup 1) (const_int 8))))])]
10105 "TARGET_STRING && XVECLEN (operands[0], 0) == 3"
10107 { return rs6000_output_load_multiple (operands); }"
10108 [(set_attr "type" "load_ux")
10109 (set_attr "length" "32")])
10111 (define_expand "store_multiple"
10112 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
10113 (match_operand:SI 1 "" ""))
10114 (clobber (scratch:SI))
10115 (use (match_operand:SI 2 "" ""))])]
10116 "TARGET_STRING && !TARGET_POWERPC64"
10125 /* Support only storing a constant number of fixed-point registers to
10126 memory and only bother with this if more than two; the machine
10127 doesn't support more than eight. */
10128 if (GET_CODE (operands[2]) != CONST_INT
10129 || INTVAL (operands[2]) <= 2
10130 || INTVAL (operands[2]) > 8
10131 || GET_CODE (operands[0]) != MEM
10132 || GET_CODE (operands[1]) != REG
10133 || REGNO (operands[1]) >= 32)
10136 count = INTVAL (operands[2]);
10137 regno = REGNO (operands[1]);
10139 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count + 1));
10140 to = force_reg (SImode, XEXP (operands[0], 0));
10141 op0 = replace_equiv_address (operands[0], to);
10143 XVECEXP (operands[3], 0, 0)
10144 = gen_rtx_SET (VOIDmode, adjust_address_nv (op0, SImode, 0), operands[1]);
10145 XVECEXP (operands[3], 0, 1) = gen_rtx_CLOBBER (VOIDmode,
10146 gen_rtx_SCRATCH (SImode));
10148 for (i = 1; i < count; i++)
10149 XVECEXP (operands[3], 0, i + 1)
10150 = gen_rtx_SET (VOIDmode,
10151 adjust_address_nv (op0, SImode, i * 4),
10152 gen_rtx_REG (SImode, regno + i));
10155 (define_insn "*stmsi8"
10156 [(match_parallel 0 "store_multiple_operation"
10157 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10158 (match_operand:SI 2 "gpc_reg_operand" "r"))
10159 (clobber (match_scratch:SI 3 "=X"))
10160 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10161 (match_operand:SI 4 "gpc_reg_operand" "r"))
10162 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10163 (match_operand:SI 5 "gpc_reg_operand" "r"))
10164 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10165 (match_operand:SI 6 "gpc_reg_operand" "r"))
10166 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10167 (match_operand:SI 7 "gpc_reg_operand" "r"))
10168 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10169 (match_operand:SI 8 "gpc_reg_operand" "r"))
10170 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
10171 (match_operand:SI 9 "gpc_reg_operand" "r"))
10172 (set (mem:SI (plus:SI (match_dup 1) (const_int 28)))
10173 (match_operand:SI 10 "gpc_reg_operand" "r"))])]
10174 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 9"
10175 "{stsi|stswi} %2,%1,%O0"
10176 [(set_attr "type" "store_ux")
10177 (set_attr "cell_micro" "always")])
10179 (define_insn "*stmsi7"
10180 [(match_parallel 0 "store_multiple_operation"
10181 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10182 (match_operand:SI 2 "gpc_reg_operand" "r"))
10183 (clobber (match_scratch:SI 3 "=X"))
10184 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10185 (match_operand:SI 4 "gpc_reg_operand" "r"))
10186 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10187 (match_operand:SI 5 "gpc_reg_operand" "r"))
10188 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10189 (match_operand:SI 6 "gpc_reg_operand" "r"))
10190 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10191 (match_operand:SI 7 "gpc_reg_operand" "r"))
10192 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10193 (match_operand:SI 8 "gpc_reg_operand" "r"))
10194 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
10195 (match_operand:SI 9 "gpc_reg_operand" "r"))])]
10196 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 8"
10197 "{stsi|stswi} %2,%1,%O0"
10198 [(set_attr "type" "store_ux")
10199 (set_attr "cell_micro" "always")])
10201 (define_insn "*stmsi6"
10202 [(match_parallel 0 "store_multiple_operation"
10203 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10204 (match_operand:SI 2 "gpc_reg_operand" "r"))
10205 (clobber (match_scratch:SI 3 "=X"))
10206 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10207 (match_operand:SI 4 "gpc_reg_operand" "r"))
10208 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10209 (match_operand:SI 5 "gpc_reg_operand" "r"))
10210 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10211 (match_operand:SI 6 "gpc_reg_operand" "r"))
10212 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10213 (match_operand:SI 7 "gpc_reg_operand" "r"))
10214 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10215 (match_operand:SI 8 "gpc_reg_operand" "r"))])]
10216 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 7"
10217 "{stsi|stswi} %2,%1,%O0"
10218 [(set_attr "type" "store_ux")
10219 (set_attr "cell_micro" "always")])
10221 (define_insn "*stmsi5"
10222 [(match_parallel 0 "store_multiple_operation"
10223 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10224 (match_operand:SI 2 "gpc_reg_operand" "r"))
10225 (clobber (match_scratch:SI 3 "=X"))
10226 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10227 (match_operand:SI 4 "gpc_reg_operand" "r"))
10228 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10229 (match_operand:SI 5 "gpc_reg_operand" "r"))
10230 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10231 (match_operand:SI 6 "gpc_reg_operand" "r"))
10232 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10233 (match_operand:SI 7 "gpc_reg_operand" "r"))])]
10234 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 6"
10235 "{stsi|stswi} %2,%1,%O0"
10236 [(set_attr "type" "store_ux")
10237 (set_attr "cell_micro" "always")])
10239 (define_insn "*stmsi4"
10240 [(match_parallel 0 "store_multiple_operation"
10241 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10242 (match_operand:SI 2 "gpc_reg_operand" "r"))
10243 (clobber (match_scratch:SI 3 "=X"))
10244 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10245 (match_operand:SI 4 "gpc_reg_operand" "r"))
10246 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10247 (match_operand:SI 5 "gpc_reg_operand" "r"))
10248 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10249 (match_operand:SI 6 "gpc_reg_operand" "r"))])]
10250 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 5"
10251 "{stsi|stswi} %2,%1,%O0"
10252 [(set_attr "type" "store_ux")
10253 (set_attr "cell_micro" "always")])
10255 (define_insn "*stmsi3"
10256 [(match_parallel 0 "store_multiple_operation"
10257 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10258 (match_operand:SI 2 "gpc_reg_operand" "r"))
10259 (clobber (match_scratch:SI 3 "=X"))
10260 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10261 (match_operand:SI 4 "gpc_reg_operand" "r"))
10262 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10263 (match_operand:SI 5 "gpc_reg_operand" "r"))])]
10264 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 4"
10265 "{stsi|stswi} %2,%1,%O0"
10266 [(set_attr "type" "store_ux")
10267 (set_attr "cell_micro" "always")])
10269 (define_insn "*stmsi8_power"
10270 [(match_parallel 0 "store_multiple_operation"
10271 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10272 (match_operand:SI 2 "gpc_reg_operand" "r"))
10273 (clobber (match_scratch:SI 3 "=q"))
10274 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10275 (match_operand:SI 4 "gpc_reg_operand" "r"))
10276 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10277 (match_operand:SI 5 "gpc_reg_operand" "r"))
10278 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10279 (match_operand:SI 6 "gpc_reg_operand" "r"))
10280 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10281 (match_operand:SI 7 "gpc_reg_operand" "r"))
10282 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10283 (match_operand:SI 8 "gpc_reg_operand" "r"))
10284 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
10285 (match_operand:SI 9 "gpc_reg_operand" "r"))
10286 (set (mem:SI (plus:SI (match_dup 1) (const_int 28)))
10287 (match_operand:SI 10 "gpc_reg_operand" "r"))])]
10288 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 9"
10289 "{stsi|stswi} %2,%1,%O0"
10290 [(set_attr "type" "store_ux")
10291 (set_attr "cell_micro" "always")])
10293 (define_insn "*stmsi7_power"
10294 [(match_parallel 0 "store_multiple_operation"
10295 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10296 (match_operand:SI 2 "gpc_reg_operand" "r"))
10297 (clobber (match_scratch:SI 3 "=q"))
10298 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10299 (match_operand:SI 4 "gpc_reg_operand" "r"))
10300 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10301 (match_operand:SI 5 "gpc_reg_operand" "r"))
10302 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10303 (match_operand:SI 6 "gpc_reg_operand" "r"))
10304 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10305 (match_operand:SI 7 "gpc_reg_operand" "r"))
10306 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10307 (match_operand:SI 8 "gpc_reg_operand" "r"))
10308 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
10309 (match_operand:SI 9 "gpc_reg_operand" "r"))])]
10310 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 8"
10311 "{stsi|stswi} %2,%1,%O0"
10312 [(set_attr "type" "store_ux")
10313 (set_attr "cell_micro" "always")])
10315 (define_insn "*stmsi6_power"
10316 [(match_parallel 0 "store_multiple_operation"
10317 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10318 (match_operand:SI 2 "gpc_reg_operand" "r"))
10319 (clobber (match_scratch:SI 3 "=q"))
10320 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10321 (match_operand:SI 4 "gpc_reg_operand" "r"))
10322 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10323 (match_operand:SI 5 "gpc_reg_operand" "r"))
10324 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10325 (match_operand:SI 6 "gpc_reg_operand" "r"))
10326 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10327 (match_operand:SI 7 "gpc_reg_operand" "r"))
10328 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10329 (match_operand:SI 8 "gpc_reg_operand" "r"))])]
10330 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 7"
10331 "{stsi|stswi} %2,%1,%O0"
10332 [(set_attr "type" "store_ux")
10333 (set_attr "cell_micro" "always")])
10335 (define_insn "*stmsi5_power"
10336 [(match_parallel 0 "store_multiple_operation"
10337 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10338 (match_operand:SI 2 "gpc_reg_operand" "r"))
10339 (clobber (match_scratch:SI 3 "=q"))
10340 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10341 (match_operand:SI 4 "gpc_reg_operand" "r"))
10342 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10343 (match_operand:SI 5 "gpc_reg_operand" "r"))
10344 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10345 (match_operand:SI 6 "gpc_reg_operand" "r"))
10346 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10347 (match_operand:SI 7 "gpc_reg_operand" "r"))])]
10348 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 6"
10349 "{stsi|stswi} %2,%1,%O0"
10350 [(set_attr "type" "store_ux")
10351 (set_attr "cell_micro" "always")])
10353 (define_insn "*stmsi4_power"
10354 [(match_parallel 0 "store_multiple_operation"
10355 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10356 (match_operand:SI 2 "gpc_reg_operand" "r"))
10357 (clobber (match_scratch:SI 3 "=q"))
10358 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10359 (match_operand:SI 4 "gpc_reg_operand" "r"))
10360 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10361 (match_operand:SI 5 "gpc_reg_operand" "r"))
10362 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10363 (match_operand:SI 6 "gpc_reg_operand" "r"))])]
10364 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 5"
10365 "{stsi|stswi} %2,%1,%O0"
10366 [(set_attr "type" "store_ux")
10367 (set_attr "cell_micro" "always")])
10369 (define_insn "*stmsi3_power"
10370 [(match_parallel 0 "store_multiple_operation"
10371 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10372 (match_operand:SI 2 "gpc_reg_operand" "r"))
10373 (clobber (match_scratch:SI 3 "=q"))
10374 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10375 (match_operand:SI 4 "gpc_reg_operand" "r"))
10376 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10377 (match_operand:SI 5 "gpc_reg_operand" "r"))])]
10378 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 4"
10379 "{stsi|stswi} %2,%1,%O0"
10380 [(set_attr "type" "store_ux")
10381 (set_attr "cell_micro" "always")])
10383 (define_expand "setmemsi"
10384 [(parallel [(set (match_operand:BLK 0 "" "")
10385 (match_operand 2 "const_int_operand" ""))
10386 (use (match_operand:SI 1 "" ""))
10387 (use (match_operand:SI 3 "" ""))])]
10391 /* If value to set is not zero, use the library routine. */
10392 if (operands[2] != const0_rtx)
10395 if (expand_block_clear (operands))
10401 ;; String/block move insn.
10402 ;; Argument 0 is the destination
10403 ;; Argument 1 is the source
10404 ;; Argument 2 is the length
10405 ;; Argument 3 is the alignment
10407 (define_expand "movmemsi"
10408 [(parallel [(set (match_operand:BLK 0 "" "")
10409 (match_operand:BLK 1 "" ""))
10410 (use (match_operand:SI 2 "" ""))
10411 (use (match_operand:SI 3 "" ""))])]
10415 if (expand_block_move (operands))
10421 ;; Move up to 32 bytes at a time. The fixed registers are needed because the
10422 ;; register allocator doesn't have a clue about allocating 8 word registers.
10423 ;; rD/rS = r5 is preferred, efficient form.
10424 (define_expand "movmemsi_8reg"
10425 [(parallel [(set (match_operand 0 "" "")
10426 (match_operand 1 "" ""))
10427 (use (match_operand 2 "" ""))
10428 (use (match_operand 3 "" ""))
10429 (clobber (reg:SI 5))
10430 (clobber (reg:SI 6))
10431 (clobber (reg:SI 7))
10432 (clobber (reg:SI 8))
10433 (clobber (reg:SI 9))
10434 (clobber (reg:SI 10))
10435 (clobber (reg:SI 11))
10436 (clobber (reg:SI 12))
10437 (clobber (match_scratch:SI 4 ""))])]
10442 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
10443 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
10444 (use (match_operand:SI 2 "immediate_operand" "i"))
10445 (use (match_operand:SI 3 "immediate_operand" "i"))
10446 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10447 (clobber (reg:SI 6))
10448 (clobber (reg:SI 7))
10449 (clobber (reg:SI 8))
10450 (clobber (reg:SI 9))
10451 (clobber (reg:SI 10))
10452 (clobber (reg:SI 11))
10453 (clobber (reg:SI 12))
10454 (clobber (match_scratch:SI 5 "=q"))]
10455 "TARGET_STRING && TARGET_POWER
10456 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
10457 || INTVAL (operands[2]) == 0)
10458 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
10459 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
10460 && REGNO (operands[4]) == 5"
10461 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10462 [(set_attr "type" "store_ux")
10463 (set_attr "cell_micro" "always")
10464 (set_attr "length" "8")])
10467 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
10468 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
10469 (use (match_operand:SI 2 "immediate_operand" "i"))
10470 (use (match_operand:SI 3 "immediate_operand" "i"))
10471 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10472 (clobber (reg:SI 6))
10473 (clobber (reg:SI 7))
10474 (clobber (reg:SI 8))
10475 (clobber (reg:SI 9))
10476 (clobber (reg:SI 10))
10477 (clobber (reg:SI 11))
10478 (clobber (reg:SI 12))
10479 (clobber (match_scratch:SI 5 "=X"))]
10480 "TARGET_STRING && ! TARGET_POWER
10481 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
10482 || INTVAL (operands[2]) == 0)
10483 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
10484 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
10485 && REGNO (operands[4]) == 5"
10486 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10487 [(set_attr "type" "store_ux")
10488 (set_attr "cell_micro" "always")
10489 (set_attr "length" "8")])
10491 ;; Move up to 24 bytes at a time. The fixed registers are needed because the
10492 ;; register allocator doesn't have a clue about allocating 6 word registers.
10493 ;; rD/rS = r5 is preferred, efficient form.
10494 (define_expand "movmemsi_6reg"
10495 [(parallel [(set (match_operand 0 "" "")
10496 (match_operand 1 "" ""))
10497 (use (match_operand 2 "" ""))
10498 (use (match_operand 3 "" ""))
10499 (clobber (reg:SI 5))
10500 (clobber (reg:SI 6))
10501 (clobber (reg:SI 7))
10502 (clobber (reg:SI 8))
10503 (clobber (reg:SI 9))
10504 (clobber (reg:SI 10))
10505 (clobber (match_scratch:SI 4 ""))])]
10510 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
10511 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
10512 (use (match_operand:SI 2 "immediate_operand" "i"))
10513 (use (match_operand:SI 3 "immediate_operand" "i"))
10514 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10515 (clobber (reg:SI 6))
10516 (clobber (reg:SI 7))
10517 (clobber (reg:SI 8))
10518 (clobber (reg:SI 9))
10519 (clobber (reg:SI 10))
10520 (clobber (match_scratch:SI 5 "=q"))]
10521 "TARGET_STRING && TARGET_POWER
10522 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 24
10523 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
10524 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
10525 && REGNO (operands[4]) == 5"
10526 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10527 [(set_attr "type" "store_ux")
10528 (set_attr "cell_micro" "always")
10529 (set_attr "length" "8")])
10532 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
10533 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
10534 (use (match_operand:SI 2 "immediate_operand" "i"))
10535 (use (match_operand:SI 3 "immediate_operand" "i"))
10536 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10537 (clobber (reg:SI 6))
10538 (clobber (reg:SI 7))
10539 (clobber (reg:SI 8))
10540 (clobber (reg:SI 9))
10541 (clobber (reg:SI 10))
10542 (clobber (match_scratch:SI 5 "=X"))]
10543 "TARGET_STRING && ! TARGET_POWER
10544 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
10545 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
10546 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
10547 && REGNO (operands[4]) == 5"
10548 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10549 [(set_attr "type" "store_ux")
10550 (set_attr "cell_micro" "always")
10551 (set_attr "length" "8")])
10553 ;; Move up to 16 bytes at a time, using 4 fixed registers to avoid spill
10554 ;; problems with TImode.
10555 ;; rD/rS = r5 is preferred, efficient form.
10556 (define_expand "movmemsi_4reg"
10557 [(parallel [(set (match_operand 0 "" "")
10558 (match_operand 1 "" ""))
10559 (use (match_operand 2 "" ""))
10560 (use (match_operand 3 "" ""))
10561 (clobber (reg:SI 5))
10562 (clobber (reg:SI 6))
10563 (clobber (reg:SI 7))
10564 (clobber (reg:SI 8))
10565 (clobber (match_scratch:SI 4 ""))])]
10570 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
10571 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
10572 (use (match_operand:SI 2 "immediate_operand" "i"))
10573 (use (match_operand:SI 3 "immediate_operand" "i"))
10574 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10575 (clobber (reg:SI 6))
10576 (clobber (reg:SI 7))
10577 (clobber (reg:SI 8))
10578 (clobber (match_scratch:SI 5 "=q"))]
10579 "TARGET_STRING && TARGET_POWER
10580 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
10581 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
10582 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
10583 && REGNO (operands[4]) == 5"
10584 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10585 [(set_attr "type" "store_ux")
10586 (set_attr "cell_micro" "always")
10587 (set_attr "length" "8")])
10590 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
10591 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
10592 (use (match_operand:SI 2 "immediate_operand" "i"))
10593 (use (match_operand:SI 3 "immediate_operand" "i"))
10594 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10595 (clobber (reg:SI 6))
10596 (clobber (reg:SI 7))
10597 (clobber (reg:SI 8))
10598 (clobber (match_scratch:SI 5 "=X"))]
10599 "TARGET_STRING && ! TARGET_POWER
10600 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
10601 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
10602 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
10603 && REGNO (operands[4]) == 5"
10604 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10605 [(set_attr "type" "store_ux")
10606 (set_attr "cell_micro" "always")
10607 (set_attr "length" "8")])
10609 ;; Move up to 8 bytes at a time.
10610 (define_expand "movmemsi_2reg"
10611 [(parallel [(set (match_operand 0 "" "")
10612 (match_operand 1 "" ""))
10613 (use (match_operand 2 "" ""))
10614 (use (match_operand 3 "" ""))
10615 (clobber (match_scratch:DI 4 ""))
10616 (clobber (match_scratch:SI 5 ""))])]
10617 "TARGET_STRING && ! TARGET_POWERPC64"
10621 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
10622 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
10623 (use (match_operand:SI 2 "immediate_operand" "i"))
10624 (use (match_operand:SI 3 "immediate_operand" "i"))
10625 (clobber (match_scratch:DI 4 "=&r"))
10626 (clobber (match_scratch:SI 5 "=q"))]
10627 "TARGET_STRING && TARGET_POWER && ! TARGET_POWERPC64
10628 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
10629 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10630 [(set_attr "type" "store_ux")
10631 (set_attr "cell_micro" "always")
10632 (set_attr "length" "8")])
10635 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
10636 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
10637 (use (match_operand:SI 2 "immediate_operand" "i"))
10638 (use (match_operand:SI 3 "immediate_operand" "i"))
10639 (clobber (match_scratch:DI 4 "=&r"))
10640 (clobber (match_scratch:SI 5 "=X"))]
10641 "TARGET_STRING && ! TARGET_POWER && ! TARGET_POWERPC64
10642 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
10643 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10644 [(set_attr "type" "store_ux")
10645 (set_attr "cell_micro" "always")
10646 (set_attr "length" "8")])
10648 ;; Move up to 4 bytes at a time.
10649 (define_expand "movmemsi_1reg"
10650 [(parallel [(set (match_operand 0 "" "")
10651 (match_operand 1 "" ""))
10652 (use (match_operand 2 "" ""))
10653 (use (match_operand 3 "" ""))
10654 (clobber (match_scratch:SI 4 ""))
10655 (clobber (match_scratch:SI 5 ""))])]
10660 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
10661 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
10662 (use (match_operand:SI 2 "immediate_operand" "i"))
10663 (use (match_operand:SI 3 "immediate_operand" "i"))
10664 (clobber (match_scratch:SI 4 "=&r"))
10665 (clobber (match_scratch:SI 5 "=q"))]
10666 "TARGET_STRING && TARGET_POWER
10667 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
10668 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10669 [(set_attr "type" "store_ux")
10670 (set_attr "cell_micro" "always")
10671 (set_attr "length" "8")])
10674 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
10675 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
10676 (use (match_operand:SI 2 "immediate_operand" "i"))
10677 (use (match_operand:SI 3 "immediate_operand" "i"))
10678 (clobber (match_scratch:SI 4 "=&r"))
10679 (clobber (match_scratch:SI 5 "=X"))]
10680 "TARGET_STRING && ! TARGET_POWER
10681 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
10682 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10683 [(set_attr "type" "store_ux")
10684 (set_attr "cell_micro" "always")
10685 (set_attr "length" "8")])
10687 ;; Define insns that do load or store with update. Some of these we can
10688 ;; get by using pre-decrement or pre-increment, but the hardware can also
10689 ;; do cases where the increment is not the size of the object.
10691 ;; In all these cases, we use operands 0 and 1 for the register being
10692 ;; incremented because those are the operands that local-alloc will
10693 ;; tie and these are the pair most likely to be tieable (and the ones
10694 ;; that will benefit the most).
10696 (define_insn "*movdi_update1"
10697 [(set (match_operand:DI 3 "gpc_reg_operand" "=r,r")
10698 (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
10699 (match_operand:DI 2 "reg_or_aligned_short_operand" "r,I"))))
10700 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
10701 (plus:DI (match_dup 1) (match_dup 2)))]
10702 "TARGET_POWERPC64 && TARGET_UPDATE
10703 && (!avoiding_indexed_address_p (DImode)
10704 || !gpc_reg_operand (operands[2], DImode))"
10708 [(set_attr "type" "load_ux,load_u")])
10710 (define_insn "movdi_<mode>_update"
10711 [(set (mem:DI (plus:P (match_operand:P 1 "gpc_reg_operand" "0,0")
10712 (match_operand:P 2 "reg_or_aligned_short_operand" "r,I")))
10713 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
10714 (set (match_operand:P 0 "gpc_reg_operand" "=b,b")
10715 (plus:P (match_dup 1) (match_dup 2)))]
10716 "TARGET_POWERPC64 && TARGET_UPDATE
10717 && (!avoiding_indexed_address_p (Pmode)
10718 || !gpc_reg_operand (operands[2], Pmode)
10719 || (REG_P (operands[0])
10720 && REGNO (operands[0]) == STACK_POINTER_REGNUM))"
10724 [(set_attr "type" "store_ux,store_u")])
10726 ;; This pattern is only conditional on TARGET_POWERPC64, as it is
10727 ;; needed for stack allocation, even if the user passes -mno-update.
10728 (define_insn "movdi_<mode>_update_stack"
10729 [(set (mem:DI (plus:P (match_operand:P 1 "gpc_reg_operand" "0,0")
10730 (match_operand:P 2 "reg_or_aligned_short_operand" "r,I")))
10731 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
10732 (set (match_operand:P 0 "gpc_reg_operand" "=b,b")
10733 (plus:P (match_dup 1) (match_dup 2)))]
10738 [(set_attr "type" "store_ux,store_u")])
10740 (define_insn "*movsi_update1"
10741 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
10742 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10743 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10744 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10745 (plus:SI (match_dup 1) (match_dup 2)))]
10747 && (!avoiding_indexed_address_p (SImode)
10748 || !gpc_reg_operand (operands[2], SImode))"
10750 {lux|lwzux} %3,%0,%2
10751 {lu|lwzu} %3,%2(%0)"
10752 [(set_attr "type" "load_ux,load_u")])
10754 (define_insn "*movsi_update2"
10755 [(set (match_operand:DI 3 "gpc_reg_operand" "=r")
10757 (mem:SI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0")
10758 (match_operand:DI 2 "gpc_reg_operand" "r")))))
10759 (set (match_operand:DI 0 "gpc_reg_operand" "=b")
10760 (plus:DI (match_dup 1) (match_dup 2)))]
10761 "TARGET_POWERPC64 && rs6000_gen_cell_microcode
10762 && !avoiding_indexed_address_p (DImode)"
10764 [(set_attr "type" "load_ext_ux")])
10766 (define_insn "movsi_update"
10767 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10768 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10769 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
10770 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10771 (plus:SI (match_dup 1) (match_dup 2)))]
10773 && (!avoiding_indexed_address_p (SImode)
10774 || !gpc_reg_operand (operands[2], SImode)
10775 || (REG_P (operands[0])
10776 && REGNO (operands[0]) == STACK_POINTER_REGNUM))"
10778 {stux|stwux} %3,%0,%2
10779 {stu|stwu} %3,%2(%0)"
10780 [(set_attr "type" "store_ux,store_u")])
10782 ;; This is an unconditional pattern; needed for stack allocation, even
10783 ;; if the user passes -mno-update.
10784 (define_insn "movsi_update_stack"
10785 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10786 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10787 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
10788 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10789 (plus:SI (match_dup 1) (match_dup 2)))]
10792 {stux|stwux} %3,%0,%2
10793 {stu|stwu} %3,%2(%0)"
10794 [(set_attr "type" "store_ux,store_u")])
10796 (define_insn "*movhi_update1"
10797 [(set (match_operand:HI 3 "gpc_reg_operand" "=r,r")
10798 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10799 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10800 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10801 (plus:SI (match_dup 1) (match_dup 2)))]
10803 && (!avoiding_indexed_address_p (SImode)
10804 || !gpc_reg_operand (operands[2], SImode))"
10808 [(set_attr "type" "load_ux,load_u")])
10810 (define_insn "*movhi_update2"
10811 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
10813 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10814 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
10815 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10816 (plus:SI (match_dup 1) (match_dup 2)))]
10818 && (!avoiding_indexed_address_p (SImode)
10819 || !gpc_reg_operand (operands[2], SImode))"
10823 [(set_attr "type" "load_ux,load_u")])
10825 (define_insn "*movhi_update3"
10826 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
10828 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10829 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
10830 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10831 (plus:SI (match_dup 1) (match_dup 2)))]
10832 "TARGET_UPDATE && rs6000_gen_cell_microcode
10833 && (!avoiding_indexed_address_p (SImode)
10834 || !gpc_reg_operand (operands[2], SImode))"
10838 [(set_attr "type" "load_ext_ux,load_ext_u")])
10840 (define_insn "*movhi_update4"
10841 [(set (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10842 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10843 (match_operand:HI 3 "gpc_reg_operand" "r,r"))
10844 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10845 (plus:SI (match_dup 1) (match_dup 2)))]
10847 && (!avoiding_indexed_address_p (SImode)
10848 || !gpc_reg_operand (operands[2], SImode))"
10852 [(set_attr "type" "store_ux,store_u")])
10854 (define_insn "*movqi_update1"
10855 [(set (match_operand:QI 3 "gpc_reg_operand" "=r,r")
10856 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10857 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10858 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10859 (plus:SI (match_dup 1) (match_dup 2)))]
10861 && (!avoiding_indexed_address_p (SImode)
10862 || !gpc_reg_operand (operands[2], SImode))"
10866 [(set_attr "type" "load_ux,load_u")])
10868 (define_insn "*movqi_update2"
10869 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
10871 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10872 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
10873 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10874 (plus:SI (match_dup 1) (match_dup 2)))]
10876 && (!avoiding_indexed_address_p (SImode)
10877 || !gpc_reg_operand (operands[2], SImode))"
10881 [(set_attr "type" "load_ux,load_u")])
10883 (define_insn "*movqi_update3"
10884 [(set (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10885 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10886 (match_operand:QI 3 "gpc_reg_operand" "r,r"))
10887 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10888 (plus:SI (match_dup 1) (match_dup 2)))]
10890 && (!avoiding_indexed_address_p (SImode)
10891 || !gpc_reg_operand (operands[2], SImode))"
10895 [(set_attr "type" "store_ux,store_u")])
10897 (define_insn "*movsf_update1"
10898 [(set (match_operand:SF 3 "gpc_reg_operand" "=f,f")
10899 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10900 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10901 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10902 (plus:SI (match_dup 1) (match_dup 2)))]
10903 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT && TARGET_UPDATE
10904 && (!avoiding_indexed_address_p (SImode)
10905 || !gpc_reg_operand (operands[2], SImode))"
10909 [(set_attr "type" "fpload_ux,fpload_u")])
10911 (define_insn "*movsf_update2"
10912 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10913 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10914 (match_operand:SF 3 "gpc_reg_operand" "f,f"))
10915 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10916 (plus:SI (match_dup 1) (match_dup 2)))]
10917 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT && TARGET_UPDATE
10918 && (!avoiding_indexed_address_p (SImode)
10919 || !gpc_reg_operand (operands[2], SImode))"
10923 [(set_attr "type" "fpstore_ux,fpstore_u")])
10925 (define_insn "*movsf_update3"
10926 [(set (match_operand:SF 3 "gpc_reg_operand" "=r,r")
10927 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10928 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10929 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10930 (plus:SI (match_dup 1) (match_dup 2)))]
10931 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE
10932 && (!avoiding_indexed_address_p (SImode)
10933 || !gpc_reg_operand (operands[2], SImode))"
10935 {lux|lwzux} %3,%0,%2
10936 {lu|lwzu} %3,%2(%0)"
10937 [(set_attr "type" "load_ux,load_u")])
10939 (define_insn "*movsf_update4"
10940 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10941 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10942 (match_operand:SF 3 "gpc_reg_operand" "r,r"))
10943 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10944 (plus:SI (match_dup 1) (match_dup 2)))]
10945 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE
10946 && (!avoiding_indexed_address_p (SImode)
10947 || !gpc_reg_operand (operands[2], SImode))"
10949 {stux|stwux} %3,%0,%2
10950 {stu|stwu} %3,%2(%0)"
10951 [(set_attr "type" "store_ux,store_u")])
10953 (define_insn "*movdf_update1"
10954 [(set (match_operand:DF 3 "gpc_reg_operand" "=d,d")
10955 (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10956 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10957 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10958 (plus:SI (match_dup 1) (match_dup 2)))]
10959 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_UPDATE
10960 && (!avoiding_indexed_address_p (SImode)
10961 || !gpc_reg_operand (operands[2], SImode))"
10965 [(set_attr "type" "fpload_ux,fpload_u")])
10967 (define_insn "*movdf_update2"
10968 [(set (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10969 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10970 (match_operand:DF 3 "gpc_reg_operand" "d,d"))
10971 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10972 (plus:SI (match_dup 1) (match_dup 2)))]
10973 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_UPDATE
10974 && (!avoiding_indexed_address_p (SImode)
10975 || !gpc_reg_operand (operands[2], SImode))"
10979 [(set_attr "type" "fpstore_ux,fpstore_u")])
10981 ;; Peephole to convert two consecutive FP loads or stores into lfq/stfq.
10983 (define_insn "*lfq_power2"
10984 [(set (match_operand:V2DF 0 "gpc_reg_operand" "=f")
10985 (match_operand:V2DF 1 "memory_operand" ""))]
10987 && TARGET_HARD_FLOAT && TARGET_FPRS"
10991 [(set (match_operand:DF 0 "gpc_reg_operand" "")
10992 (match_operand:DF 1 "memory_operand" ""))
10993 (set (match_operand:DF 2 "gpc_reg_operand" "")
10994 (match_operand:DF 3 "memory_operand" ""))]
10996 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
10997 && registers_ok_for_quad_peep (operands[0], operands[2])
10998 && mems_ok_for_quad_peep (operands[1], operands[3])"
10999 [(set (match_dup 0)
11001 "operands[1] = widen_memory_access (operands[1], V2DFmode, 0);
11002 operands[0] = gen_rtx_REG (V2DFmode, REGNO (operands[0]));")
11004 (define_insn "*stfq_power2"
11005 [(set (match_operand:V2DF 0 "memory_operand" "")
11006 (match_operand:V2DF 1 "gpc_reg_operand" "f"))]
11008 && TARGET_HARD_FLOAT && TARGET_FPRS"
11009 "stfq%U0%X0 %1,%0")
11013 [(set (match_operand:DF 0 "memory_operand" "")
11014 (match_operand:DF 1 "gpc_reg_operand" ""))
11015 (set (match_operand:DF 2 "memory_operand" "")
11016 (match_operand:DF 3 "gpc_reg_operand" ""))]
11018 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
11019 && registers_ok_for_quad_peep (operands[1], operands[3])
11020 && mems_ok_for_quad_peep (operands[0], operands[2])"
11021 [(set (match_dup 0)
11023 "operands[0] = widen_memory_access (operands[0], V2DFmode, 0);
11024 operands[1] = gen_rtx_REG (V2DFmode, REGNO (operands[1]));")
11026 ;; After inserting conditional returns we can sometimes have
11027 ;; unnecessary register moves. Unfortunately we cannot have a
11028 ;; modeless peephole here, because some single SImode sets have early
11029 ;; clobber outputs. Although those sets expand to multi-ppc-insn
11030 ;; sequences, using get_attr_length here will smash the operands
11031 ;; array. Neither is there an early_cobbler_p predicate.
11032 ;; Disallow subregs for E500 so we don't munge frob_di_df_2.
11034 [(set (match_operand:DF 0 "gpc_reg_operand" "")
11035 (match_operand:DF 1 "any_operand" ""))
11036 (set (match_operand:DF 2 "gpc_reg_operand" "")
11038 "!(TARGET_E500_DOUBLE && GET_CODE (operands[2]) == SUBREG)
11039 && peep2_reg_dead_p (2, operands[0])"
11040 [(set (match_dup 2) (match_dup 1))])
11043 [(set (match_operand:SF 0 "gpc_reg_operand" "")
11044 (match_operand:SF 1 "any_operand" ""))
11045 (set (match_operand:SF 2 "gpc_reg_operand" "")
11047 "peep2_reg_dead_p (2, operands[0])"
11048 [(set (match_dup 2) (match_dup 1))])
11053 ;; Mode attributes for different ABIs.
11054 (define_mode_iterator TLSmode [(SI "! TARGET_64BIT") (DI "TARGET_64BIT")])
11055 (define_mode_attr tls_abi_suffix [(SI "32") (DI "64")])
11056 (define_mode_attr tls_sysv_suffix [(SI "si") (DI "di")])
11057 (define_mode_attr tls_insn_suffix [(SI "wz") (DI "d")])
11059 (define_insn_and_split "tls_gd_aix<TLSmode:tls_abi_suffix>"
11060 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11061 (call (mem:TLSmode (match_operand:TLSmode 3 "symbol_ref_operand" "s"))
11062 (match_operand 4 "" "g")))
11063 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11064 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11066 (clobber (reg:SI LR_REGNO))]
11067 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX"
11068 "addi %0,%1,%2@got@tlsgd\;bl %z3\;%."
11069 "&& TARGET_TLS_MARKERS"
11070 [(set (match_dup 0)
11071 (unspec:TLSmode [(match_dup 1)
11074 (parallel [(set (match_dup 0)
11075 (call (mem:TLSmode (match_dup 3))
11077 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD)
11078 (clobber (reg:SI LR_REGNO))])]
11080 [(set_attr "type" "two")
11081 (set_attr "length" "12")])
11083 (define_insn_and_split "tls_gd_sysv<TLSmode:tls_sysv_suffix>"
11084 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11085 (call (mem:TLSmode (match_operand:TLSmode 3 "symbol_ref_operand" "s"))
11086 (match_operand 4 "" "g")))
11087 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11088 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11090 (clobber (reg:SI LR_REGNO))]
11091 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4"
11095 if (TARGET_SECURE_PLT && flag_pic == 2)
11096 return "addi %0,%1,%2@got@tlsgd\;bl %z3+32768@plt";
11098 return "addi %0,%1,%2@got@tlsgd\;bl %z3@plt";
11101 return "addi %0,%1,%2@got@tlsgd\;bl %z3";
11103 "&& TARGET_TLS_MARKERS"
11104 [(set (match_dup 0)
11105 (unspec:TLSmode [(match_dup 1)
11108 (parallel [(set (match_dup 0)
11109 (call (mem:TLSmode (match_dup 3))
11111 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD)
11112 (clobber (reg:SI LR_REGNO))])]
11114 [(set_attr "type" "two")
11115 (set_attr "length" "8")])
11117 (define_insn "*tls_gd<TLSmode:tls_abi_suffix>"
11118 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11119 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11120 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11122 "HAVE_AS_TLS && TARGET_TLS_MARKERS"
11123 "addi %0,%1,%2@got@tlsgd"
11124 [(set_attr "length" "4")])
11126 (define_insn "*tls_gd_call_aix<TLSmode:tls_abi_suffix>"
11127 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11128 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
11129 (match_operand 2 "" "g")))
11130 (unspec:TLSmode [(match_operand:TLSmode 3 "rs6000_tls_symbol_ref" "")]
11132 (clobber (reg:SI LR_REGNO))]
11133 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX && TARGET_TLS_MARKERS"
11134 "bl %z1(%3@tlsgd)\;%."
11135 [(set_attr "type" "branch")
11136 (set_attr "length" "8")])
11138 (define_insn "*tls_gd_call_sysv<TLSmode:tls_abi_suffix>"
11139 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11140 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
11141 (match_operand 2 "" "g")))
11142 (unspec:TLSmode [(match_operand:TLSmode 3 "rs6000_tls_symbol_ref" "")]
11144 (clobber (reg:SI LR_REGNO))]
11145 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4 && TARGET_TLS_MARKERS"
11149 if (TARGET_SECURE_PLT && flag_pic == 2)
11150 return "bl %z1+32768(%3@tlsgd)@plt";
11151 return "bl %z1(%3@tlsgd)@plt";
11153 return "bl %z1(%3@tlsgd)";
11155 [(set_attr "type" "branch")
11156 (set_attr "length" "4")])
11158 (define_insn_and_split "tls_ld_aix<TLSmode:tls_abi_suffix>"
11159 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11160 (call (mem:TLSmode (match_operand:TLSmode 2 "symbol_ref_operand" "s"))
11161 (match_operand 3 "" "g")))
11162 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
11164 (clobber (reg:SI LR_REGNO))]
11165 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX"
11166 "addi %0,%1,%&@got@tlsld\;bl %z2\;%."
11167 "&& TARGET_TLS_MARKERS"
11168 [(set (match_dup 0)
11169 (unspec:TLSmode [(match_dup 1)]
11171 (parallel [(set (match_dup 0)
11172 (call (mem:TLSmode (match_dup 2))
11174 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
11175 (clobber (reg:SI LR_REGNO))])]
11177 [(set_attr "length" "12")])
11179 (define_insn_and_split "tls_ld_sysv<TLSmode:tls_sysv_suffix>"
11180 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11181 (call (mem:TLSmode (match_operand:TLSmode 2 "symbol_ref_operand" "s"))
11182 (match_operand 3 "" "g")))
11183 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
11185 (clobber (reg:SI LR_REGNO))]
11186 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4"
11190 if (TARGET_SECURE_PLT && flag_pic == 2)
11191 return "addi %0,%1,%&@got@tlsld\;bl %z2+32768@plt";
11193 return "addi %0,%1,%&@got@tlsld\;bl %z2@plt";
11196 return "addi %0,%1,%&@got@tlsld\;bl %z2";
11198 "&& TARGET_TLS_MARKERS"
11199 [(set (match_dup 0)
11200 (unspec:TLSmode [(match_dup 1)]
11202 (parallel [(set (match_dup 0)
11203 (call (mem:TLSmode (match_dup 2))
11205 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
11206 (clobber (reg:SI LR_REGNO))])]
11208 [(set_attr "length" "8")])
11210 (define_insn "*tls_ld<TLSmode:tls_abi_suffix>"
11211 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11212 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
11214 "HAVE_AS_TLS && TARGET_TLS_MARKERS"
11215 "addi %0,%1,%&@got@tlsld"
11216 [(set_attr "length" "4")])
11218 (define_insn "*tls_ld_call_aix<TLSmode:tls_abi_suffix>"
11219 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11220 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
11221 (match_operand 2 "" "g")))
11222 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
11223 (clobber (reg:SI LR_REGNO))]
11224 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX && TARGET_TLS_MARKERS"
11225 "bl %z1(%&@tlsld)\;%."
11226 [(set_attr "type" "branch")
11227 (set_attr "length" "8")])
11229 (define_insn "*tls_ld_call_sysv<TLSmode:tls_abi_suffix>"
11230 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11231 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
11232 (match_operand 2 "" "g")))
11233 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
11234 (clobber (reg:SI LR_REGNO))]
11235 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4 && TARGET_TLS_MARKERS"
11239 if (TARGET_SECURE_PLT && flag_pic == 2)
11240 return "bl %z1+32768(%&@tlsld)@plt";
11241 return "bl %z1(%&@tlsld)@plt";
11243 return "bl %z1(%&@tlsld)";
11245 [(set_attr "type" "branch")
11246 (set_attr "length" "4")])
11248 (define_insn "tls_dtprel_<TLSmode:tls_abi_suffix>"
11249 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11250 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11251 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11252 UNSPEC_TLSDTPREL))]
11254 "addi %0,%1,%2@dtprel")
11256 (define_insn "tls_dtprel_ha_<TLSmode:tls_abi_suffix>"
11257 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11258 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11259 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11260 UNSPEC_TLSDTPRELHA))]
11262 "addis %0,%1,%2@dtprel@ha")
11264 (define_insn "tls_dtprel_lo_<TLSmode:tls_abi_suffix>"
11265 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11266 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11267 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11268 UNSPEC_TLSDTPRELLO))]
11270 "addi %0,%1,%2@dtprel@l")
11272 (define_insn "tls_got_dtprel_<TLSmode:tls_abi_suffix>"
11273 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11274 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11275 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11276 UNSPEC_TLSGOTDTPREL))]
11278 "l<TLSmode:tls_insn_suffix> %0,%2@got@dtprel(%1)")
11280 (define_insn "tls_tprel_<TLSmode:tls_abi_suffix>"
11281 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11282 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11283 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11286 "addi %0,%1,%2@tprel")
11288 (define_insn "tls_tprel_ha_<TLSmode:tls_abi_suffix>"
11289 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11290 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11291 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11292 UNSPEC_TLSTPRELHA))]
11294 "addis %0,%1,%2@tprel@ha")
11296 (define_insn "tls_tprel_lo_<TLSmode:tls_abi_suffix>"
11297 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11298 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11299 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11300 UNSPEC_TLSTPRELLO))]
11302 "addi %0,%1,%2@tprel@l")
11304 ;; "b" output constraint here and on tls_tls input to support linker tls
11305 ;; optimization. The linker may edit the instructions emitted by a
11306 ;; tls_got_tprel/tls_tls pair to addis,addi.
11307 (define_insn "tls_got_tprel_<TLSmode:tls_abi_suffix>"
11308 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11309 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11310 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11311 UNSPEC_TLSGOTTPREL))]
11313 "l<TLSmode:tls_insn_suffix> %0,%2@got@tprel(%1)")
11315 (define_insn "tls_tls_<TLSmode:tls_abi_suffix>"
11316 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11317 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11318 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11321 "add %0,%1,%2@tls")
11324 ;; Next come insns related to the calling sequence.
11326 ;; First, an insn to allocate new stack space for dynamic use (e.g., alloca).
11327 ;; We move the back-chain and decrement the stack pointer.
11329 (define_expand "allocate_stack"
11330 [(set (match_operand 0 "gpc_reg_operand" "")
11331 (minus (reg 1) (match_operand 1 "reg_or_short_operand" "")))
11333 (minus (reg 1) (match_dup 1)))]
11336 { rtx chain = gen_reg_rtx (Pmode);
11337 rtx stack_bot = gen_rtx_MEM (Pmode, stack_pointer_rtx);
11339 rtx insn, par, set, mem;
11341 emit_move_insn (chain, stack_bot);
11343 /* Check stack bounds if necessary. */
11344 if (crtl->limit_stack)
11347 available = expand_binop (Pmode, sub_optab,
11348 stack_pointer_rtx, stack_limit_rtx,
11349 NULL_RTX, 1, OPTAB_WIDEN);
11350 emit_insn (gen_cond_trap (LTU, available, operands[1], const0_rtx));
11353 if (GET_CODE (operands[1]) != CONST_INT
11354 || INTVAL (operands[1]) < -32767
11355 || INTVAL (operands[1]) > 32768)
11357 neg_op0 = gen_reg_rtx (Pmode);
11359 emit_insn (gen_negsi2 (neg_op0, operands[1]));
11361 emit_insn (gen_negdi2 (neg_op0, operands[1]));
11364 neg_op0 = GEN_INT (- INTVAL (operands[1]));
11366 insn = emit_insn ((* ((TARGET_32BIT) ? gen_movsi_update_stack
11367 : gen_movdi_di_update_stack))
11368 (stack_pointer_rtx, stack_pointer_rtx, neg_op0,
11370 /* Since we didn't use gen_frame_mem to generate the MEM, grab
11371 it now and set the alias set/attributes. The above gen_*_update
11372 calls will generate a PARALLEL with the MEM set being the first
11374 par = PATTERN (insn);
11375 gcc_assert (GET_CODE (par) == PARALLEL);
11376 set = XVECEXP (par, 0, 0);
11377 gcc_assert (GET_CODE (set) == SET);
11378 mem = SET_DEST (set);
11379 gcc_assert (MEM_P (mem));
11380 MEM_NOTRAP_P (mem) = 1;
11381 set_mem_alias_set (mem, get_frame_alias_set ());
11383 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
11387 ;; These patterns say how to save and restore the stack pointer. We need not
11388 ;; save the stack pointer at function level since we are careful to
11389 ;; preserve the backchain. At block level, we have to restore the backchain
11390 ;; when we restore the stack pointer.
11392 ;; For nonlocal gotos, we must save both the stack pointer and its
11393 ;; backchain and restore both. Note that in the nonlocal case, the
11394 ;; save area is a memory location.
11396 (define_expand "save_stack_function"
11397 [(match_operand 0 "any_operand" "")
11398 (match_operand 1 "any_operand" "")]
11402 (define_expand "restore_stack_function"
11403 [(match_operand 0 "any_operand" "")
11404 (match_operand 1 "any_operand" "")]
11408 ;; Adjust stack pointer (op0) to a new value (op1).
11409 ;; First copy old stack backchain to new location, and ensure that the
11410 ;; scheduler won't reorder the sp assignment before the backchain write.
11411 (define_expand "restore_stack_block"
11412 [(set (match_dup 2) (match_dup 3))
11413 (set (match_dup 4) (match_dup 2))
11414 (set (match_dup 5) (unspec:BLK [(match_dup 5)] UNSPEC_TIE))
11415 (set (match_operand 0 "register_operand" "")
11416 (match_operand 1 "register_operand" ""))]
11420 operands[1] = force_reg (Pmode, operands[1]);
11421 operands[2] = gen_reg_rtx (Pmode);
11422 operands[3] = gen_frame_mem (Pmode, operands[0]);
11423 operands[4] = gen_frame_mem (Pmode, operands[1]);
11424 operands[5] = gen_frame_mem (BLKmode, operands[0]);
11427 (define_expand "save_stack_nonlocal"
11428 [(set (match_dup 3) (match_dup 4))
11429 (set (match_operand 0 "memory_operand" "") (match_dup 3))
11430 (set (match_dup 2) (match_operand 1 "register_operand" ""))]
11434 int units_per_word = (TARGET_32BIT) ? 4 : 8;
11436 /* Copy the backchain to the first word, sp to the second. */
11437 operands[0] = adjust_address_nv (operands[0], Pmode, 0);
11438 operands[2] = adjust_address_nv (operands[0], Pmode, units_per_word);
11439 operands[3] = gen_reg_rtx (Pmode);
11440 operands[4] = gen_frame_mem (Pmode, operands[1]);
11443 (define_expand "restore_stack_nonlocal"
11444 [(set (match_dup 2) (match_operand 1 "memory_operand" ""))
11445 (set (match_dup 3) (match_dup 4))
11446 (set (match_dup 5) (match_dup 2))
11447 (set (match_dup 6) (unspec:BLK [(match_dup 6)] UNSPEC_TIE))
11448 (set (match_operand 0 "register_operand" "") (match_dup 3))]
11452 int units_per_word = (TARGET_32BIT) ? 4 : 8;
11454 /* Restore the backchain from the first word, sp from the second. */
11455 operands[2] = gen_reg_rtx (Pmode);
11456 operands[3] = gen_reg_rtx (Pmode);
11457 operands[1] = adjust_address_nv (operands[1], Pmode, 0);
11458 operands[4] = adjust_address_nv (operands[1], Pmode, units_per_word);
11459 operands[5] = gen_frame_mem (Pmode, operands[3]);
11460 operands[6] = gen_frame_mem (BLKmode, operands[0]);
11463 ;; TOC register handling.
11465 ;; Code to initialize the TOC register...
11467 (define_insn "load_toc_aix_si"
11468 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11469 (unspec:SI [(const_int 0)] UNSPEC_TOC))
11470 (use (reg:SI 2))])]
11471 "DEFAULT_ABI == ABI_AIX && TARGET_32BIT"
11475 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
11476 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
11477 operands[2] = gen_rtx_REG (Pmode, 2);
11478 return \"{l|lwz} %0,%1(%2)\";
11480 [(set_attr "type" "load")])
11482 (define_insn "load_toc_aix_di"
11483 [(parallel [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11484 (unspec:DI [(const_int 0)] UNSPEC_TOC))
11485 (use (reg:DI 2))])]
11486 "DEFAULT_ABI == ABI_AIX && TARGET_64BIT"
11490 #ifdef TARGET_RELOCATABLE
11491 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\",
11492 !TARGET_MINIMAL_TOC || TARGET_RELOCATABLE);
11494 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
11497 strcat (buf, \"@toc\");
11498 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
11499 operands[2] = gen_rtx_REG (Pmode, 2);
11500 return \"ld %0,%1(%2)\";
11502 [(set_attr "type" "load")])
11504 (define_insn "load_toc_v4_pic_si"
11505 [(set (reg:SI LR_REGNO)
11506 (unspec:SI [(const_int 0)] UNSPEC_TOC))]
11507 "DEFAULT_ABI == ABI_V4 && flag_pic == 1 && TARGET_32BIT"
11508 "bl _GLOBAL_OFFSET_TABLE_@local-4"
11509 [(set_attr "type" "branch")
11510 (set_attr "length" "4")])
11512 (define_insn "load_toc_v4_PIC_1"
11513 [(set (reg:SI LR_REGNO)
11514 (match_operand:SI 0 "immediate_operand" "s"))
11515 (use (unspec [(match_dup 0)] UNSPEC_TOC))]
11516 "TARGET_ELF && DEFAULT_ABI != ABI_AIX
11517 && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
11518 "bcl 20,31,%0\\n%0:"
11519 [(set_attr "type" "branch")
11520 (set_attr "length" "4")])
11522 (define_insn "load_toc_v4_PIC_1b"
11523 [(set (reg:SI LR_REGNO)
11524 (unspec:SI [(match_operand:SI 0 "immediate_operand" "s")]
11526 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
11527 "bcl 20,31,$+8\\n\\t.long %0-$"
11528 [(set_attr "type" "branch")
11529 (set_attr "length" "8")])
11531 (define_insn "load_toc_v4_PIC_2"
11532 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11533 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
11534 (minus:SI (match_operand:SI 2 "immediate_operand" "s")
11535 (match_operand:SI 3 "immediate_operand" "s")))))]
11536 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
11537 "{l|lwz} %0,%2-%3(%1)"
11538 [(set_attr "type" "load")])
11540 (define_insn "load_toc_v4_PIC_3b"
11541 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
11542 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "r")
11544 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
11545 (match_operand:SI 3 "symbol_ref_operand" "s")))))]
11546 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
11547 "{cau|addis} %0,%1,%2-%3@ha")
11549 (define_insn "load_toc_v4_PIC_3c"
11550 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11551 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
11552 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
11553 (match_operand:SI 3 "symbol_ref_operand" "s"))))]
11554 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
11555 "{cal %0,%2-%3@l(%1)|addi %0,%1,%2-%3@l}")
11557 ;; If the TOC is shared over a translation unit, as happens with all
11558 ;; the kinds of PIC that we support, we need to restore the TOC
11559 ;; pointer only when jumping over units of translation.
11560 ;; On Darwin, we need to reload the picbase.
11562 (define_expand "builtin_setjmp_receiver"
11563 [(use (label_ref (match_operand 0 "" "")))]
11564 "(DEFAULT_ABI == ABI_V4 && flag_pic == 1)
11565 || (TARGET_TOC && TARGET_MINIMAL_TOC)
11566 || (DEFAULT_ABI == ABI_DARWIN && flag_pic)"
11570 if (DEFAULT_ABI == ABI_DARWIN)
11572 rtx picrtx = gen_rtx_SYMBOL_REF (Pmode, MACHOPIC_FUNCTION_BASE_NAME);
11573 rtx picreg = gen_rtx_REG (Pmode, RS6000_PIC_OFFSET_TABLE_REGNUM);
11577 crtl->uses_pic_offset_table = 1;
11578 ASM_GENERATE_INTERNAL_LABEL(tmplab, \"LSJR\",
11579 CODE_LABEL_NUMBER (operands[0]));
11580 tmplabrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (tmplab));
11582 emit_insn (gen_load_macho_picbase (tmplabrtx));
11583 emit_move_insn (picreg, gen_rtx_REG (Pmode, LR_REGNO));
11584 emit_insn (gen_macho_correct_pic (picreg, picreg, picrtx, tmplabrtx));
11588 rs6000_emit_load_toc_table (FALSE);
11592 ;; Elf specific ways of loading addresses for non-PIC code.
11593 ;; The output of this could be r0, but we make a very strong
11594 ;; preference for a base register because it will usually
11595 ;; be needed there.
11596 (define_insn "elf_high"
11597 [(set (match_operand:SI 0 "gpc_reg_operand" "=b*r")
11598 (high:SI (match_operand 1 "" "")))]
11599 "TARGET_ELF && ! TARGET_64BIT"
11600 "{liu|lis} %0,%1@ha")
11602 (define_insn "elf_low"
11603 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11604 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,!*r")
11605 (match_operand 2 "" "")))]
11606 "TARGET_ELF && ! TARGET_64BIT"
11608 {cal|la} %0,%2@l(%1)
11609 {ai|addic} %0,%1,%K2")
11611 ;; A function pointer under AIX is a pointer to a data area whose first word
11612 ;; contains the actual address of the function, whose second word contains a
11613 ;; pointer to its TOC, and whose third word contains a value to place in the
11614 ;; static chain register (r11). Note that if we load the static chain, our
11615 ;; "trampoline" need not have any executable code.
11617 (define_expand "call_indirect_aix32"
11618 [(set (match_dup 2)
11619 (mem:SI (match_operand:SI 0 "gpc_reg_operand" "")))
11620 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
11623 (mem:SI (plus:SI (match_dup 0)
11625 (parallel [(call (mem:SI (match_dup 2))
11626 (match_operand 1 "" ""))
11627 (use (mem:SI (plus:SI (match_dup 0) (const_int 4))))
11629 (use (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
11630 (clobber (reg:SI LR_REGNO))])]
11633 { operands[2] = gen_reg_rtx (SImode); }")
11635 (define_expand "call_indirect_aix64"
11636 [(set (match_dup 2)
11637 (mem:DI (match_operand:DI 0 "gpc_reg_operand" "")))
11638 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
11641 (mem:DI (plus:DI (match_dup 0)
11643 (parallel [(call (mem:SI (match_dup 2))
11644 (match_operand 1 "" ""))
11645 (use (mem:DI (plus:DI (match_dup 0) (const_int 8))))
11647 (use (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
11648 (clobber (reg:SI LR_REGNO))])]
11651 { operands[2] = gen_reg_rtx (DImode); }")
11653 (define_expand "call_value_indirect_aix32"
11654 [(set (match_dup 3)
11655 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "")))
11656 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
11659 (mem:SI (plus:SI (match_dup 1)
11661 (parallel [(set (match_operand 0 "" "")
11662 (call (mem:SI (match_dup 3))
11663 (match_operand 2 "" "")))
11664 (use (mem:SI (plus:SI (match_dup 1) (const_int 4))))
11666 (use (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
11667 (clobber (reg:SI LR_REGNO))])]
11670 { operands[3] = gen_reg_rtx (SImode); }")
11672 (define_expand "call_value_indirect_aix64"
11673 [(set (match_dup 3)
11674 (mem:DI (match_operand:DI 1 "gpc_reg_operand" "")))
11675 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
11678 (mem:DI (plus:DI (match_dup 1)
11680 (parallel [(set (match_operand 0 "" "")
11681 (call (mem:SI (match_dup 3))
11682 (match_operand 2 "" "")))
11683 (use (mem:DI (plus:DI (match_dup 1) (const_int 8))))
11685 (use (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
11686 (clobber (reg:SI LR_REGNO))])]
11689 { operands[3] = gen_reg_rtx (DImode); }")
11691 ;; Now the definitions for the call and call_value insns
11692 (define_expand "call"
11693 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
11694 (match_operand 1 "" ""))
11695 (use (match_operand 2 "" ""))
11696 (clobber (reg:SI LR_REGNO))])]
11701 if (MACHOPIC_INDIRECT)
11702 operands[0] = machopic_indirect_call_target (operands[0]);
11705 gcc_assert (GET_CODE (operands[0]) == MEM);
11706 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
11708 operands[0] = XEXP (operands[0], 0);
11710 if (GET_CODE (operands[0]) != SYMBOL_REF
11711 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[0]))
11712 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[2]) & CALL_LONG) != 0))
11714 if (INTVAL (operands[2]) & CALL_LONG)
11715 operands[0] = rs6000_longcall_ref (operands[0]);
11717 switch (DEFAULT_ABI)
11721 operands[0] = force_reg (Pmode, operands[0]);
11725 /* AIX function pointers are really pointers to a three word
11727 emit_call_insn (TARGET_32BIT
11728 ? gen_call_indirect_aix32 (force_reg (SImode,
11731 : gen_call_indirect_aix64 (force_reg (DImode,
11737 gcc_unreachable ();
11742 (define_expand "call_value"
11743 [(parallel [(set (match_operand 0 "" "")
11744 (call (mem:SI (match_operand 1 "address_operand" ""))
11745 (match_operand 2 "" "")))
11746 (use (match_operand 3 "" ""))
11747 (clobber (reg:SI LR_REGNO))])]
11752 if (MACHOPIC_INDIRECT)
11753 operands[1] = machopic_indirect_call_target (operands[1]);
11756 gcc_assert (GET_CODE (operands[1]) == MEM);
11757 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
11759 operands[1] = XEXP (operands[1], 0);
11761 if (GET_CODE (operands[1]) != SYMBOL_REF
11762 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[1]))
11763 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[3]) & CALL_LONG) != 0))
11765 if (INTVAL (operands[3]) & CALL_LONG)
11766 operands[1] = rs6000_longcall_ref (operands[1]);
11768 switch (DEFAULT_ABI)
11772 operands[1] = force_reg (Pmode, operands[1]);
11776 /* AIX function pointers are really pointers to a three word
11778 emit_call_insn (TARGET_32BIT
11779 ? gen_call_value_indirect_aix32 (operands[0],
11783 : gen_call_value_indirect_aix64 (operands[0],
11790 gcc_unreachable ();
11795 ;; Call to function in current module. No TOC pointer reload needed.
11796 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
11797 ;; either the function was not prototyped, or it was prototyped as a
11798 ;; variable argument function. It is > 0 if FP registers were passed
11799 ;; and < 0 if they were not.
11801 (define_insn "*call_local32"
11802 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
11803 (match_operand 1 "" "g,g"))
11804 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11805 (clobber (reg:SI LR_REGNO))]
11806 "(INTVAL (operands[2]) & CALL_LONG) == 0"
11809 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11810 output_asm_insn (\"crxor 6,6,6\", operands);
11812 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11813 output_asm_insn (\"creqv 6,6,6\", operands);
11815 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
11817 [(set_attr "type" "branch")
11818 (set_attr "length" "4,8")])
11820 (define_insn "*call_local64"
11821 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
11822 (match_operand 1 "" "g,g"))
11823 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11824 (clobber (reg:SI LR_REGNO))]
11825 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
11828 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11829 output_asm_insn (\"crxor 6,6,6\", operands);
11831 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11832 output_asm_insn (\"creqv 6,6,6\", operands);
11834 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
11836 [(set_attr "type" "branch")
11837 (set_attr "length" "4,8")])
11839 (define_insn "*call_value_local32"
11840 [(set (match_operand 0 "" "")
11841 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
11842 (match_operand 2 "" "g,g")))
11843 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11844 (clobber (reg:SI LR_REGNO))]
11845 "(INTVAL (operands[3]) & CALL_LONG) == 0"
11848 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11849 output_asm_insn (\"crxor 6,6,6\", operands);
11851 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11852 output_asm_insn (\"creqv 6,6,6\", operands);
11854 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
11856 [(set_attr "type" "branch")
11857 (set_attr "length" "4,8")])
11860 (define_insn "*call_value_local64"
11861 [(set (match_operand 0 "" "")
11862 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
11863 (match_operand 2 "" "g,g")))
11864 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11865 (clobber (reg:SI LR_REGNO))]
11866 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
11869 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11870 output_asm_insn (\"crxor 6,6,6\", operands);
11872 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11873 output_asm_insn (\"creqv 6,6,6\", operands);
11875 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
11877 [(set_attr "type" "branch")
11878 (set_attr "length" "4,8")])
11880 ;; Call to function which may be in another module. Restore the TOC
11881 ;; pointer (r2) after the call unless this is System V.
11882 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
11883 ;; either the function was not prototyped, or it was prototyped as a
11884 ;; variable argument function. It is > 0 if FP registers were passed
11885 ;; and < 0 if they were not.
11887 (define_insn_and_split "*call_indirect_nonlocal_aix32_internal"
11888 [(call (mem:SI (match_operand:SI 0 "register_operand" "c,*l"))
11889 (match_operand 1 "" "g,g"))
11890 (use (mem:SI (plus:SI (match_operand:SI 2 "register_operand" "b,b") (const_int 4))))
11892 (use (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
11893 (clobber (reg:SI LR_REGNO))]
11894 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
11896 "&& reload_completed"
11898 (mem:SI (plus:SI (match_dup 2) (const_int 4))))
11899 (parallel [(call (mem:SI (match_dup 0))
11904 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
11905 (clobber (reg:SI LR_REGNO))])]
11907 [(set_attr "type" "jmpreg")
11908 (set_attr "length" "12")])
11910 (define_insn "*call_indirect_nonlocal_aix32"
11911 [(call (mem:SI (match_operand:SI 0 "register_operand" "c,*l"))
11912 (match_operand 1 "" "g,g"))
11916 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
11917 (clobber (reg:SI LR_REGNO))]
11918 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX && reload_completed"
11919 "b%T0l\;{l|lwz} 2,20(1)"
11920 [(set_attr "type" "jmpreg")
11921 (set_attr "length" "8")])
11923 (define_insn "*call_nonlocal_aix32"
11924 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
11925 (match_operand 1 "" "g"))
11926 (use (match_operand:SI 2 "immediate_operand" "O"))
11927 (clobber (reg:SI LR_REGNO))]
11929 && DEFAULT_ABI == ABI_AIX
11930 && (INTVAL (operands[2]) & CALL_LONG) == 0"
11932 [(set_attr "type" "branch")
11933 (set_attr "length" "8")])
11935 (define_insn_and_split "*call_indirect_nonlocal_aix64_internal"
11936 [(call (mem:SI (match_operand:DI 0 "register_operand" "c,*l"))
11937 (match_operand 1 "" "g,g"))
11938 (use (mem:DI (plus:DI (match_operand:DI 2 "register_operand" "b,b")
11941 (use (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
11942 (clobber (reg:SI LR_REGNO))]
11943 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
11945 "&& reload_completed"
11947 (mem:DI (plus:DI (match_dup 2) (const_int 8))))
11948 (parallel [(call (mem:SI (match_dup 0))
11953 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
11954 (clobber (reg:SI LR_REGNO))])]
11956 [(set_attr "type" "jmpreg")
11957 (set_attr "length" "12")])
11959 (define_insn "*call_indirect_nonlocal_aix64"
11960 [(call (mem:SI (match_operand:DI 0 "register_operand" "c,*l"))
11961 (match_operand 1 "" "g,g"))
11965 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
11966 (clobber (reg:SI LR_REGNO))]
11967 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX && reload_completed"
11968 "b%T0l\;ld 2,40(1)"
11969 [(set_attr "type" "jmpreg")
11970 (set_attr "length" "8")])
11972 (define_insn "*call_nonlocal_aix64"
11973 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
11974 (match_operand 1 "" "g"))
11975 (use (match_operand:SI 2 "immediate_operand" "O"))
11976 (clobber (reg:SI LR_REGNO))]
11978 && DEFAULT_ABI == ABI_AIX
11979 && (INTVAL (operands[2]) & CALL_LONG) == 0"
11981 [(set_attr "type" "branch")
11982 (set_attr "length" "8")])
11984 (define_insn_and_split "*call_value_indirect_nonlocal_aix32_internal"
11985 [(set (match_operand 0 "" "")
11986 (call (mem:SI (match_operand:SI 1 "register_operand" "c,*l"))
11987 (match_operand 2 "" "g,g")))
11988 (use (mem:SI (plus:SI (match_operand:SI 3 "register_operand" "b,b")
11991 (use (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
11992 (clobber (reg:SI LR_REGNO))]
11993 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
11995 "&& reload_completed"
11997 (mem:SI (plus:SI (match_dup 3) (const_int 4))))
11998 (parallel [(set (match_dup 0) (call (mem:SI (match_dup 1))
12003 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
12004 (clobber (reg:SI LR_REGNO))])]
12006 [(set_attr "type" "jmpreg")
12007 (set_attr "length" "12")])
12009 (define_insn "*call_value_indirect_nonlocal_aix32"
12010 [(set (match_operand 0 "" "")
12011 (call (mem:SI (match_operand:SI 1 "register_operand" "c,*l"))
12012 (match_operand 2 "" "g,g")))
12016 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
12017 (clobber (reg:SI LR_REGNO))]
12018 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX && reload_completed"
12019 "b%T1l\;{l|lwz} 2,20(1)"
12020 [(set_attr "type" "jmpreg")
12021 (set_attr "length" "8")])
12023 (define_insn "*call_value_nonlocal_aix32"
12024 [(set (match_operand 0 "" "")
12025 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
12026 (match_operand 2 "" "g")))
12027 (use (match_operand:SI 3 "immediate_operand" "O"))
12028 (clobber (reg:SI LR_REGNO))]
12030 && DEFAULT_ABI == ABI_AIX
12031 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12033 [(set_attr "type" "branch")
12034 (set_attr "length" "8")])
12036 (define_insn_and_split "*call_value_indirect_nonlocal_aix64_internal"
12037 [(set (match_operand 0 "" "")
12038 (call (mem:SI (match_operand:DI 1 "register_operand" "c,*l"))
12039 (match_operand 2 "" "g,g")))
12040 (use (mem:DI (plus:DI (match_operand:DI 3 "register_operand" "b,b")
12043 (use (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
12044 (clobber (reg:SI LR_REGNO))]
12045 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
12047 "&& reload_completed"
12049 (mem:DI (plus:DI (match_dup 3) (const_int 8))))
12050 (parallel [(set (match_dup 0) (call (mem:SI (match_dup 1))
12055 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
12056 (clobber (reg:SI LR_REGNO))])]
12058 [(set_attr "type" "jmpreg")
12059 (set_attr "length" "12")])
12061 (define_insn "*call_value_indirect_nonlocal_aix64"
12062 [(set (match_operand 0 "" "")
12063 (call (mem:SI (match_operand:DI 1 "register_operand" "c,*l"))
12064 (match_operand 2 "" "g,g")))
12068 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
12069 (clobber (reg:SI LR_REGNO))]
12070 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX && reload_completed"
12071 "b%T1l\;ld 2,40(1)"
12072 [(set_attr "type" "jmpreg")
12073 (set_attr "length" "8")])
12075 (define_insn "*call_value_nonlocal_aix64"
12076 [(set (match_operand 0 "" "")
12077 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
12078 (match_operand 2 "" "g")))
12079 (use (match_operand:SI 3 "immediate_operand" "O"))
12080 (clobber (reg:SI LR_REGNO))]
12082 && DEFAULT_ABI == ABI_AIX
12083 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12085 [(set_attr "type" "branch")
12086 (set_attr "length" "8")])
12088 ;; A function pointer under System V is just a normal pointer
12089 ;; operands[0] is the function pointer
12090 ;; operands[1] is the stack size to clean up
12091 ;; operands[2] is the value FUNCTION_ARG returns for the VOID argument
12092 ;; which indicates how to set cr1
12094 (define_insn "*call_indirect_nonlocal_sysv<mode>"
12095 [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l,c,*l"))
12096 (match_operand 1 "" "g,g,g,g"))
12097 (use (match_operand:SI 2 "immediate_operand" "O,O,n,n"))
12098 (clobber (reg:SI LR_REGNO))]
12099 "DEFAULT_ABI == ABI_V4
12100 || DEFAULT_ABI == ABI_DARWIN"
12102 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12103 output_asm_insn ("crxor 6,6,6", operands);
12105 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12106 output_asm_insn ("creqv 6,6,6", operands);
12110 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
12111 (set_attr "length" "4,4,8,8")])
12113 (define_insn_and_split "*call_nonlocal_sysv<mode>"
12114 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
12115 (match_operand 1 "" "g,g"))
12116 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12117 (clobber (reg:SI LR_REGNO))]
12118 "(DEFAULT_ABI == ABI_DARWIN
12119 || (DEFAULT_ABI == ABI_V4
12120 && (INTVAL (operands[2]) & CALL_LONG) == 0))"
12122 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12123 output_asm_insn ("crxor 6,6,6", operands);
12125 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12126 output_asm_insn ("creqv 6,6,6", operands);
12129 return output_call(insn, operands, 0, 2);
12131 if (DEFAULT_ABI == ABI_V4 && flag_pic)
12133 gcc_assert (!TARGET_SECURE_PLT);
12134 return "bl %z0@plt";
12140 "DEFAULT_ABI == ABI_V4
12141 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[0])
12142 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12143 [(parallel [(call (mem:SI (match_dup 0))
12145 (use (match_dup 2))
12146 (use (match_dup 3))
12147 (clobber (reg:SI LR_REGNO))])]
12149 operands[3] = pic_offset_table_rtx;
12151 [(set_attr "type" "branch,branch")
12152 (set_attr "length" "4,8")])
12154 (define_insn "*call_nonlocal_sysv_secure<mode>"
12155 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
12156 (match_operand 1 "" "g,g"))
12157 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12158 (use (match_operand:SI 3 "register_operand" "r,r"))
12159 (clobber (reg:SI LR_REGNO))]
12160 "(DEFAULT_ABI == ABI_V4
12161 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[0])
12162 && (INTVAL (operands[2]) & CALL_LONG) == 0)"
12164 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12165 output_asm_insn ("crxor 6,6,6", operands);
12167 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12168 output_asm_insn ("creqv 6,6,6", operands);
12171 /* The magic 32768 offset here and in the other sysv call insns
12172 corresponds to the offset of r30 in .got2, as given by LCTOC1.
12173 See sysv4.h:toc_section. */
12174 return "bl %z0+32768@plt";
12176 return "bl %z0@plt";
12178 [(set_attr "type" "branch,branch")
12179 (set_attr "length" "4,8")])
12181 (define_insn "*call_value_indirect_nonlocal_sysv<mode>"
12182 [(set (match_operand 0 "" "")
12183 (call (mem:SI (match_operand:P 1 "register_operand" "c,*l,c,*l"))
12184 (match_operand 2 "" "g,g,g,g")))
12185 (use (match_operand:SI 3 "immediate_operand" "O,O,n,n"))
12186 (clobber (reg:SI LR_REGNO))]
12187 "DEFAULT_ABI == ABI_V4
12188 || DEFAULT_ABI == ABI_DARWIN"
12190 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12191 output_asm_insn ("crxor 6,6,6", operands);
12193 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12194 output_asm_insn ("creqv 6,6,6", operands);
12198 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
12199 (set_attr "length" "4,4,8,8")])
12201 (define_insn_and_split "*call_value_nonlocal_sysv<mode>"
12202 [(set (match_operand 0 "" "")
12203 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
12204 (match_operand 2 "" "g,g")))
12205 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12206 (clobber (reg:SI LR_REGNO))]
12207 "(DEFAULT_ABI == ABI_DARWIN
12208 || (DEFAULT_ABI == ABI_V4
12209 && (INTVAL (operands[3]) & CALL_LONG) == 0))"
12211 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12212 output_asm_insn ("crxor 6,6,6", operands);
12214 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12215 output_asm_insn ("creqv 6,6,6", operands);
12218 return output_call(insn, operands, 1, 3);
12220 if (DEFAULT_ABI == ABI_V4 && flag_pic)
12222 gcc_assert (!TARGET_SECURE_PLT);
12223 return "bl %z1@plt";
12229 "DEFAULT_ABI == ABI_V4
12230 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[1])
12231 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12232 [(parallel [(set (match_dup 0)
12233 (call (mem:SI (match_dup 1))
12235 (use (match_dup 3))
12236 (use (match_dup 4))
12237 (clobber (reg:SI LR_REGNO))])]
12239 operands[4] = pic_offset_table_rtx;
12241 [(set_attr "type" "branch,branch")
12242 (set_attr "length" "4,8")])
12244 (define_insn "*call_value_nonlocal_sysv_secure<mode>"
12245 [(set (match_operand 0 "" "")
12246 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
12247 (match_operand 2 "" "g,g")))
12248 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12249 (use (match_operand:SI 4 "register_operand" "r,r"))
12250 (clobber (reg:SI LR_REGNO))]
12251 "(DEFAULT_ABI == ABI_V4
12252 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[1])
12253 && (INTVAL (operands[3]) & CALL_LONG) == 0)"
12255 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12256 output_asm_insn ("crxor 6,6,6", operands);
12258 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12259 output_asm_insn ("creqv 6,6,6", operands);
12262 return "bl %z1+32768@plt";
12264 return "bl %z1@plt";
12266 [(set_attr "type" "branch,branch")
12267 (set_attr "length" "4,8")])
12269 ;; Call subroutine returning any type.
12270 (define_expand "untyped_call"
12271 [(parallel [(call (match_operand 0 "" "")
12273 (match_operand 1 "" "")
12274 (match_operand 2 "" "")])]
12280 emit_call_insn (GEN_CALL (operands[0], const0_rtx, const0_rtx, const0_rtx));
12282 for (i = 0; i < XVECLEN (operands[2], 0); i++)
12284 rtx set = XVECEXP (operands[2], 0, i);
12285 emit_move_insn (SET_DEST (set), SET_SRC (set));
12288 /* The optimizer does not know that the call sets the function value
12289 registers we stored in the result block. We avoid problems by
12290 claiming that all hard registers are used and clobbered at this
12292 emit_insn (gen_blockage ());
12297 ;; sibling call patterns
12298 (define_expand "sibcall"
12299 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
12300 (match_operand 1 "" ""))
12301 (use (match_operand 2 "" ""))
12302 (use (reg:SI LR_REGNO))
12308 if (MACHOPIC_INDIRECT)
12309 operands[0] = machopic_indirect_call_target (operands[0]);
12312 gcc_assert (GET_CODE (operands[0]) == MEM);
12313 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
12315 operands[0] = XEXP (operands[0], 0);
12318 ;; this and similar patterns must be marked as using LR, otherwise
12319 ;; dataflow will try to delete the store into it. This is true
12320 ;; even when the actual reg to jump to is in CTR, when LR was
12321 ;; saved and restored around the PIC-setting BCL.
12322 (define_insn "*sibcall_local32"
12323 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
12324 (match_operand 1 "" "g,g"))
12325 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12326 (use (reg:SI LR_REGNO))
12328 "(INTVAL (operands[2]) & CALL_LONG) == 0"
12331 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12332 output_asm_insn (\"crxor 6,6,6\", operands);
12334 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12335 output_asm_insn (\"creqv 6,6,6\", operands);
12337 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
12339 [(set_attr "type" "branch")
12340 (set_attr "length" "4,8")])
12342 (define_insn "*sibcall_local64"
12343 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
12344 (match_operand 1 "" "g,g"))
12345 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12346 (use (reg:SI LR_REGNO))
12348 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
12351 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12352 output_asm_insn (\"crxor 6,6,6\", operands);
12354 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12355 output_asm_insn (\"creqv 6,6,6\", operands);
12357 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
12359 [(set_attr "type" "branch")
12360 (set_attr "length" "4,8")])
12362 (define_insn "*sibcall_value_local32"
12363 [(set (match_operand 0 "" "")
12364 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
12365 (match_operand 2 "" "g,g")))
12366 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12367 (use (reg:SI LR_REGNO))
12369 "(INTVAL (operands[3]) & CALL_LONG) == 0"
12372 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12373 output_asm_insn (\"crxor 6,6,6\", operands);
12375 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12376 output_asm_insn (\"creqv 6,6,6\", operands);
12378 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
12380 [(set_attr "type" "branch")
12381 (set_attr "length" "4,8")])
12384 (define_insn "*sibcall_value_local64"
12385 [(set (match_operand 0 "" "")
12386 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
12387 (match_operand 2 "" "g,g")))
12388 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12389 (use (reg:SI LR_REGNO))
12391 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
12394 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12395 output_asm_insn (\"crxor 6,6,6\", operands);
12397 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12398 output_asm_insn (\"creqv 6,6,6\", operands);
12400 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
12402 [(set_attr "type" "branch")
12403 (set_attr "length" "4,8")])
12405 (define_insn "*sibcall_nonlocal_aix32"
12406 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
12407 (match_operand 1 "" "g"))
12408 (use (match_operand:SI 2 "immediate_operand" "O"))
12409 (use (reg:SI LR_REGNO))
12412 && DEFAULT_ABI == ABI_AIX
12413 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12415 [(set_attr "type" "branch")
12416 (set_attr "length" "4")])
12418 (define_insn "*sibcall_nonlocal_aix64"
12419 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
12420 (match_operand 1 "" "g"))
12421 (use (match_operand:SI 2 "immediate_operand" "O"))
12422 (use (reg:SI LR_REGNO))
12425 && DEFAULT_ABI == ABI_AIX
12426 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12428 [(set_attr "type" "branch")
12429 (set_attr "length" "4")])
12431 (define_insn "*sibcall_value_nonlocal_aix32"
12432 [(set (match_operand 0 "" "")
12433 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
12434 (match_operand 2 "" "g")))
12435 (use (match_operand:SI 3 "immediate_operand" "O"))
12436 (use (reg:SI LR_REGNO))
12439 && DEFAULT_ABI == ABI_AIX
12440 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12442 [(set_attr "type" "branch")
12443 (set_attr "length" "4")])
12445 (define_insn "*sibcall_value_nonlocal_aix64"
12446 [(set (match_operand 0 "" "")
12447 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
12448 (match_operand 2 "" "g")))
12449 (use (match_operand:SI 3 "immediate_operand" "O"))
12450 (use (reg:SI LR_REGNO))
12453 && DEFAULT_ABI == ABI_AIX
12454 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12456 [(set_attr "type" "branch")
12457 (set_attr "length" "4")])
12459 (define_insn "*sibcall_nonlocal_sysv<mode>"
12460 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
12461 (match_operand 1 "" ""))
12462 (use (match_operand 2 "immediate_operand" "O,n"))
12463 (use (reg:SI LR_REGNO))
12465 "(DEFAULT_ABI == ABI_DARWIN
12466 || DEFAULT_ABI == ABI_V4)
12467 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12470 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12471 output_asm_insn (\"crxor 6,6,6\", operands);
12473 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12474 output_asm_insn (\"creqv 6,6,6\", operands);
12476 if (DEFAULT_ABI == ABI_V4 && flag_pic)
12478 gcc_assert (!TARGET_SECURE_PLT);
12479 return \"b %z0@plt\";
12484 [(set_attr "type" "branch,branch")
12485 (set_attr "length" "4,8")])
12487 (define_expand "sibcall_value"
12488 [(parallel [(set (match_operand 0 "register_operand" "")
12489 (call (mem:SI (match_operand 1 "address_operand" ""))
12490 (match_operand 2 "" "")))
12491 (use (match_operand 3 "" ""))
12492 (use (reg:SI LR_REGNO))
12498 if (MACHOPIC_INDIRECT)
12499 operands[1] = machopic_indirect_call_target (operands[1]);
12502 gcc_assert (GET_CODE (operands[1]) == MEM);
12503 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
12505 operands[1] = XEXP (operands[1], 0);
12508 (define_insn "*sibcall_value_nonlocal_sysv<mode>"
12509 [(set (match_operand 0 "" "")
12510 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
12511 (match_operand 2 "" "")))
12512 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12513 (use (reg:SI LR_REGNO))
12515 "(DEFAULT_ABI == ABI_DARWIN
12516 || DEFAULT_ABI == ABI_V4)
12517 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12520 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12521 output_asm_insn (\"crxor 6,6,6\", operands);
12523 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12524 output_asm_insn (\"creqv 6,6,6\", operands);
12526 if (DEFAULT_ABI == ABI_V4 && flag_pic)
12528 gcc_assert (!TARGET_SECURE_PLT);
12529 return \"b %z1@plt\";
12534 [(set_attr "type" "branch,branch")
12535 (set_attr "length" "4,8")])
12537 (define_expand "sibcall_epilogue"
12538 [(use (const_int 0))]
12539 "TARGET_SCHED_PROLOG"
12542 rs6000_emit_epilogue (TRUE);
12546 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
12547 ;; all of memory. This blocks insns from being moved across this point.
12549 (define_insn "blockage"
12550 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCK)]
12554 (define_insn "probe_stack"
12555 [(unspec [(match_operand 0 "memory_operand" "=m")] UNSPEC_PROBE_STACK)]
12557 "{st%U0%X0|stw%U0%X0} 0,%0"
12558 [(set_attr "type" "store")
12559 (set_attr "length" "4")])
12561 ;; Compare insns are next. Note that the RS/6000 has two types of compares,
12562 ;; signed & unsigned, and one type of branch.
12564 ;; Start with the DEFINE_EXPANDs to generate the rtl for compares, scc
12565 ;; insns, and branches.
12567 (define_expand "cbranch<mode>4"
12568 [(use (match_operator 0 "rs6000_cbranch_operator"
12569 [(match_operand:GPR 1 "gpc_reg_operand" "")
12570 (match_operand:GPR 2 "reg_or_short_operand" "")]))
12571 (use (match_operand 3 ""))]
12575 /* Take care of the possibility that operands[2] might be negative but
12576 this might be a logical operation. That insn doesn't exist. */
12577 if (GET_CODE (operands[2]) == CONST_INT
12578 && INTVAL (operands[2]) < 0)
12580 operands[2] = force_reg (<MODE>mode, operands[2]);
12581 operands[0] = gen_rtx_fmt_ee (GET_CODE (operands[0]),
12582 GET_MODE (operands[0]),
12583 operands[1], operands[2]);
12586 rs6000_emit_cbranch (<MODE>mode, operands);
12590 (define_expand "cbranch<mode>4"
12591 [(use (match_operator 0 "rs6000_cbranch_operator"
12592 [(match_operand:FP 1 "gpc_reg_operand" "")
12593 (match_operand:FP 2 "gpc_reg_operand" "")]))
12594 (use (match_operand 3 ""))]
12598 rs6000_emit_cbranch (<MODE>mode, operands);
12602 (define_expand "cstore<mode>4"
12603 [(use (match_operator 1 "rs6000_cbranch_operator"
12604 [(match_operand:GPR 2 "gpc_reg_operand" "")
12605 (match_operand:GPR 3 "reg_or_short_operand" "")]))
12606 (clobber (match_operand:SI 0 "register_operand"))]
12610 /* Take care of the possibility that operands[3] might be negative but
12611 this might be a logical operation. That insn doesn't exist. */
12612 if (GET_CODE (operands[3]) == CONST_INT
12613 && INTVAL (operands[3]) < 0)
12615 operands[3] = force_reg (<MODE>mode, operands[3]);
12616 operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]),
12617 GET_MODE (operands[1]),
12618 operands[2], operands[3]);
12621 /* For SNE, we would prefer that the xor/abs sequence be used for integers.
12622 For SEQ, likewise, except that comparisons with zero should be done
12623 with an scc insns. However, due to the order that combine see the
12624 resulting insns, we must, in fact, allow SEQ for integers. Fail in
12625 the cases we don't want to handle or are best handled by portable
12627 if (GET_CODE (operands[1]) == NE)
12629 if ((GET_CODE (operands[1]) == LT || GET_CODE (operands[1]) == LE
12630 || GET_CODE (operands[1]) == GT || GET_CODE (operands[1]) == GE)
12631 && operands[3] == const0_rtx)
12633 rs6000_emit_sCOND (<MODE>mode, operands);
12637 (define_expand "cstore<mode>4"
12638 [(use (match_operator 1 "rs6000_cbranch_operator"
12639 [(match_operand:FP 2 "gpc_reg_operand" "")
12640 (match_operand:FP 3 "gpc_reg_operand" "")]))
12641 (clobber (match_operand:SI 0 "register_operand"))]
12645 rs6000_emit_sCOND (<MODE>mode, operands);
12650 (define_expand "stack_protect_set"
12651 [(match_operand 0 "memory_operand" "")
12652 (match_operand 1 "memory_operand" "")]
12655 #ifdef TARGET_THREAD_SSP_OFFSET
12656 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
12657 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
12658 operands[1] = gen_rtx_MEM (Pmode, addr);
12661 emit_insn (gen_stack_protect_setdi (operands[0], operands[1]));
12663 emit_insn (gen_stack_protect_setsi (operands[0], operands[1]));
12667 (define_insn "stack_protect_setsi"
12668 [(set (match_operand:SI 0 "memory_operand" "=m")
12669 (unspec:SI [(match_operand:SI 1 "memory_operand" "m")] UNSPEC_SP_SET))
12670 (set (match_scratch:SI 2 "=&r") (const_int 0))]
12672 "{l%U1%X1|lwz%U1%X1} %2,%1\;{st%U0%X0|stw%U0%X0} %2,%0\;{lil|li} %2,0"
12673 [(set_attr "type" "three")
12674 (set_attr "length" "12")])
12676 (define_insn "stack_protect_setdi"
12677 [(set (match_operand:DI 0 "memory_operand" "=m")
12678 (unspec:DI [(match_operand:DI 1 "memory_operand" "m")] UNSPEC_SP_SET))
12679 (set (match_scratch:DI 2 "=&r") (const_int 0))]
12681 "ld%U1%X1 %2,%1\;std%U0%X0 %2,%0\;{lil|li} %2,0"
12682 [(set_attr "type" "three")
12683 (set_attr "length" "12")])
12685 (define_expand "stack_protect_test"
12686 [(match_operand 0 "memory_operand" "")
12687 (match_operand 1 "memory_operand" "")
12688 (match_operand 2 "" "")]
12691 rtx test, op0, op1;
12692 #ifdef TARGET_THREAD_SSP_OFFSET
12693 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
12694 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
12695 operands[1] = gen_rtx_MEM (Pmode, addr);
12698 op1 = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, operands[1]), UNSPEC_SP_TEST);
12699 test = gen_rtx_EQ (VOIDmode, op0, op1);
12700 emit_jump_insn (gen_cbranchsi4 (test, op0, op1, operands[2]));
12704 (define_insn "stack_protect_testsi"
12705 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
12706 (unspec:CCEQ [(match_operand:SI 1 "memory_operand" "m,m")
12707 (match_operand:SI 2 "memory_operand" "m,m")]
12709 (set (match_scratch:SI 4 "=r,r") (const_int 0))
12710 (clobber (match_scratch:SI 3 "=&r,&r"))]
12713 {l%U1%X1|lwz%U1%X1} %3,%1\;{l%U2%X2|lwz%U2%X2} %4,%2\;xor. %3,%3,%4\;{lil|li} %4,0
12714 {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"
12715 [(set_attr "length" "16,20")])
12717 (define_insn "stack_protect_testdi"
12718 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
12719 (unspec:CCEQ [(match_operand:DI 1 "memory_operand" "m,m")
12720 (match_operand:DI 2 "memory_operand" "m,m")]
12722 (set (match_scratch:DI 4 "=r,r") (const_int 0))
12723 (clobber (match_scratch:DI 3 "=&r,&r"))]
12726 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;xor. %3,%3,%4\;{lil|li} %4,0
12727 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;cmpld %0,%3,%4\;{lil|li} %3,0\;{lil|li} %4,0"
12728 [(set_attr "length" "16,20")])
12731 ;; Here are the actual compare insns.
12732 (define_insn "*cmp<mode>_internal1"
12733 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
12734 (compare:CC (match_operand:GPR 1 "gpc_reg_operand" "r")
12735 (match_operand:GPR 2 "reg_or_short_operand" "rI")))]
12737 "{cmp%I2|cmp<wd>%I2} %0,%1,%2"
12738 [(set_attr "type" "cmp")])
12740 ;; If we are comparing a register for equality with a large constant,
12741 ;; we can do this with an XOR followed by a compare. But this is profitable
12742 ;; only if the large constant is only used for the comparison (and in this
12743 ;; case we already have a register to reuse as scratch).
12745 ;; For 64-bit registers, we could only do so if the constant's bit 15 is clear:
12746 ;; otherwise we'd need to XOR with FFFFFFFF????0000 which is not available.
12749 [(set (match_operand:SI 0 "register_operand")
12750 (match_operand:SI 1 "logical_const_operand" ""))
12751 (set (match_dup 0) (match_operator:SI 3 "boolean_or_operator"
12753 (match_operand:SI 2 "logical_const_operand" "")]))
12754 (set (match_operand:CC 4 "cc_reg_operand" "")
12755 (compare:CC (match_operand:SI 5 "gpc_reg_operand" "")
12758 (if_then_else (match_operator 6 "equality_operator"
12759 [(match_dup 4) (const_int 0)])
12760 (match_operand 7 "" "")
12761 (match_operand 8 "" "")))]
12762 "peep2_reg_dead_p (3, operands[0])
12763 && peep2_reg_dead_p (4, operands[4])"
12764 [(set (match_dup 0) (xor:SI (match_dup 5) (match_dup 9)))
12765 (set (match_dup 4) (compare:CC (match_dup 0) (match_dup 10)))
12766 (set (pc) (if_then_else (match_dup 6) (match_dup 7) (match_dup 8)))]
12769 /* Get the constant we are comparing against, and see what it looks like
12770 when sign-extended from 16 to 32 bits. Then see what constant we could
12771 XOR with SEXTC to get the sign-extended value. */
12772 rtx cnst = simplify_const_binary_operation (GET_CODE (operands[3]),
12774 operands[1], operands[2]);
12775 HOST_WIDE_INT c = INTVAL (cnst);
12776 HOST_WIDE_INT sextc = ((c & 0xffff) ^ 0x8000) - 0x8000;
12777 HOST_WIDE_INT xorv = c ^ sextc;
12779 operands[9] = GEN_INT (xorv);
12780 operands[10] = GEN_INT (sextc);
12783 (define_insn "*cmpsi_internal2"
12784 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
12785 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
12786 (match_operand:SI 2 "reg_or_u_short_operand" "rK")))]
12788 "{cmpl%I2|cmplw%I2} %0,%1,%b2"
12789 [(set_attr "type" "cmp")])
12791 (define_insn "*cmpdi_internal2"
12792 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
12793 (compare:CCUNS (match_operand:DI 1 "gpc_reg_operand" "r")
12794 (match_operand:DI 2 "reg_or_u_short_operand" "rK")))]
12796 "cmpld%I2 %0,%1,%b2"
12797 [(set_attr "type" "cmp")])
12799 ;; The following two insns don't exist as single insns, but if we provide
12800 ;; them, we can swap an add and compare, which will enable us to overlap more
12801 ;; of the required delay between a compare and branch. We generate code for
12802 ;; them by splitting.
12805 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
12806 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
12807 (match_operand:SI 2 "short_cint_operand" "i")))
12808 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
12809 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
12812 [(set_attr "length" "8")])
12815 [(set (match_operand:CCUNS 3 "cc_reg_operand" "=y")
12816 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
12817 (match_operand:SI 2 "u_short_cint_operand" "i")))
12818 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
12819 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
12822 [(set_attr "length" "8")])
12825 [(set (match_operand:CC 3 "cc_reg_operand" "")
12826 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
12827 (match_operand:SI 2 "short_cint_operand" "")))
12828 (set (match_operand:SI 0 "gpc_reg_operand" "")
12829 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
12831 [(set (match_dup 3) (compare:CC (match_dup 1) (match_dup 2)))
12832 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
12835 [(set (match_operand:CCUNS 3 "cc_reg_operand" "")
12836 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "")
12837 (match_operand:SI 2 "u_short_cint_operand" "")))
12838 (set (match_operand:SI 0 "gpc_reg_operand" "")
12839 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
12841 [(set (match_dup 3) (compare:CCUNS (match_dup 1) (match_dup 2)))
12842 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
12844 (define_insn "*cmpsf_internal1"
12845 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
12846 (compare:CCFP (match_operand:SF 1 "gpc_reg_operand" "f")
12847 (match_operand:SF 2 "gpc_reg_operand" "f")))]
12848 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
12850 [(set_attr "type" "fpcompare")])
12852 (define_insn "*cmpdf_internal1"
12853 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
12854 (compare:CCFP (match_operand:DF 1 "gpc_reg_operand" "d")
12855 (match_operand:DF 2 "gpc_reg_operand" "d")))]
12856 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
12857 && !VECTOR_UNIT_VSX_P (DFmode)"
12859 [(set_attr "type" "fpcompare")])
12861 ;; Only need to compare second words if first words equal
12862 (define_insn "*cmptf_internal1"
12863 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
12864 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "d")
12865 (match_operand:TF 2 "gpc_reg_operand" "d")))]
12866 "!TARGET_IEEEQUAD && !TARGET_XL_COMPAT
12867 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LONG_DOUBLE_128"
12868 "fcmpu %0,%1,%2\;bne %0,$+8\;fcmpu %0,%L1,%L2"
12869 [(set_attr "type" "fpcompare")
12870 (set_attr "length" "12")])
12872 (define_insn_and_split "*cmptf_internal2"
12873 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
12874 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "d")
12875 (match_operand:TF 2 "gpc_reg_operand" "d")))
12876 (clobber (match_scratch:DF 3 "=d"))
12877 (clobber (match_scratch:DF 4 "=d"))
12878 (clobber (match_scratch:DF 5 "=d"))
12879 (clobber (match_scratch:DF 6 "=d"))
12880 (clobber (match_scratch:DF 7 "=d"))
12881 (clobber (match_scratch:DF 8 "=d"))
12882 (clobber (match_scratch:DF 9 "=d"))
12883 (clobber (match_scratch:DF 10 "=d"))]
12884 "!TARGET_IEEEQUAD && TARGET_XL_COMPAT
12885 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LONG_DOUBLE_128"
12887 "&& reload_completed"
12888 [(set (match_dup 3) (match_dup 13))
12889 (set (match_dup 4) (match_dup 14))
12890 (set (match_dup 9) (abs:DF (match_dup 5)))
12891 (set (match_dup 0) (compare:CCFP (match_dup 9) (match_dup 3)))
12892 (set (pc) (if_then_else (ne (match_dup 0) (const_int 0))
12893 (label_ref (match_dup 11))
12895 (set (match_dup 0) (compare:CCFP (match_dup 5) (match_dup 7)))
12896 (set (pc) (label_ref (match_dup 12)))
12898 (set (match_dup 10) (minus:DF (match_dup 5) (match_dup 7)))
12899 (set (match_dup 9) (minus:DF (match_dup 6) (match_dup 8)))
12900 (set (match_dup 9) (plus:DF (match_dup 10) (match_dup 9)))
12901 (set (match_dup 0) (compare:CCFP (match_dup 7) (match_dup 4)))
12904 REAL_VALUE_TYPE rv;
12905 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
12906 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
12908 operands[5] = simplify_gen_subreg (DFmode, operands[1], TFmode, hi_word);
12909 operands[6] = simplify_gen_subreg (DFmode, operands[1], TFmode, lo_word);
12910 operands[7] = simplify_gen_subreg (DFmode, operands[2], TFmode, hi_word);
12911 operands[8] = simplify_gen_subreg (DFmode, operands[2], TFmode, lo_word);
12912 operands[11] = gen_label_rtx ();
12913 operands[12] = gen_label_rtx ();
12915 operands[13] = force_const_mem (DFmode,
12916 CONST_DOUBLE_FROM_REAL_VALUE (rv, DFmode));
12917 operands[14] = force_const_mem (DFmode,
12918 CONST_DOUBLE_FROM_REAL_VALUE (dconst0,
12922 operands[13] = gen_const_mem (DFmode,
12923 create_TOC_reference (XEXP (operands[13], 0)));
12924 operands[14] = gen_const_mem (DFmode,
12925 create_TOC_reference (XEXP (operands[14], 0)));
12926 set_mem_alias_set (operands[13], get_TOC_alias_set ());
12927 set_mem_alias_set (operands[14], get_TOC_alias_set ());
12931 ;; Now we have the scc insns. We can do some combinations because of the
12932 ;; way the machine works.
12934 ;; Note that this is probably faster if we can put an insn between the
12935 ;; mfcr and rlinm, but this is tricky. Let's leave it for now. In most
12936 ;; cases the insns below which don't use an intermediate CR field will
12937 ;; be used instead.
12939 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12940 (match_operator:SI 1 "scc_comparison_operator"
12941 [(match_operand 2 "cc_reg_operand" "y")
12944 "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1"
12945 [(set (attr "type")
12946 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
12947 (const_string "mfcrf")
12949 (const_string "mfcr")))
12950 (set_attr "length" "8")])
12952 ;; Same as above, but get the GT bit.
12953 (define_insn "move_from_CR_gt_bit"
12954 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12955 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_GT))]
12956 "TARGET_HARD_FLOAT && !TARGET_FPRS"
12957 "mfcr %0\;{rlinm|rlwinm} %0,%0,%D1,31,31"
12958 [(set_attr "type" "mfcr")
12959 (set_attr "length" "8")])
12961 ;; Same as above, but get the OV/ORDERED bit.
12962 (define_insn "move_from_CR_ov_bit"
12963 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12964 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_OV))]
12966 "mfcr %0\;{rlinm|rlwinm} %0,%0,%t1,1"
12967 [(set_attr "type" "mfcr")
12968 (set_attr "length" "8")])
12971 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12972 (match_operator:DI 1 "scc_comparison_operator"
12973 [(match_operand 2 "cc_reg_operand" "y")
12976 "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1"
12977 [(set (attr "type")
12978 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
12979 (const_string "mfcrf")
12981 (const_string "mfcr")))
12982 (set_attr "length" "8")])
12985 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12986 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
12987 [(match_operand 2 "cc_reg_operand" "y,y")
12990 (set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
12991 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
12994 mfcr %3%Q2\;{rlinm.|rlwinm.} %3,%3,%J1,1
12996 [(set_attr "type" "delayed_compare")
12997 (set_attr "length" "8,16")])
13000 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13001 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
13002 [(match_operand 2 "cc_reg_operand" "")
13005 (set (match_operand:SI 3 "gpc_reg_operand" "")
13006 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
13007 "TARGET_32BIT && reload_completed"
13008 [(set (match_dup 3)
13009 (match_op_dup 1 [(match_dup 2) (const_int 0)]))
13011 (compare:CC (match_dup 3)
13016 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13017 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
13018 [(match_operand 2 "cc_reg_operand" "y")
13020 (match_operand:SI 3 "const_int_operand" "n")))]
13024 int is_bit = ccr_bit (operands[1], 1);
13025 int put_bit = 31 - (INTVAL (operands[3]) & 31);
13028 if (is_bit >= put_bit)
13029 count = is_bit - put_bit;
13031 count = 32 - (put_bit - is_bit);
13033 operands[4] = GEN_INT (count);
13034 operands[5] = GEN_INT (put_bit);
13036 return \"mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%4,%5,%5\";
13038 [(set (attr "type")
13039 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
13040 (const_string "mfcrf")
13042 (const_string "mfcr")))
13043 (set_attr "length" "8")])
13046 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13048 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
13049 [(match_operand 2 "cc_reg_operand" "y,y")
13051 (match_operand:SI 3 "const_int_operand" "n,n"))
13053 (set (match_operand:SI 4 "gpc_reg_operand" "=r,r")
13054 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
13059 int is_bit = ccr_bit (operands[1], 1);
13060 int put_bit = 31 - (INTVAL (operands[3]) & 31);
13063 /* Force split for non-cc0 compare. */
13064 if (which_alternative == 1)
13067 if (is_bit >= put_bit)
13068 count = is_bit - put_bit;
13070 count = 32 - (put_bit - is_bit);
13072 operands[5] = GEN_INT (count);
13073 operands[6] = GEN_INT (put_bit);
13075 return \"mfcr %4%Q2\;{rlinm.|rlwinm.} %4,%4,%5,%6,%6\";
13077 [(set_attr "type" "delayed_compare")
13078 (set_attr "length" "8,16")])
13081 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
13083 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
13084 [(match_operand 2 "cc_reg_operand" "")
13086 (match_operand:SI 3 "const_int_operand" ""))
13088 (set (match_operand:SI 4 "gpc_reg_operand" "")
13089 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
13092 [(set (match_dup 4)
13093 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
13096 (compare:CC (match_dup 4)
13100 ;; There is a 3 cycle delay between consecutive mfcr instructions
13101 ;; so it is useful to combine 2 scc instructions to use only one mfcr.
13104 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13105 (match_operator:SI 1 "scc_comparison_operator"
13106 [(match_operand 2 "cc_reg_operand" "y")
13108 (set (match_operand:SI 3 "gpc_reg_operand" "=r")
13109 (match_operator:SI 4 "scc_comparison_operator"
13110 [(match_operand 5 "cc_reg_operand" "y")
13112 "REGNO (operands[2]) != REGNO (operands[5])"
13113 "mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
13114 [(set_attr "type" "mfcr")
13115 (set_attr "length" "12")])
13118 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13119 (match_operator:DI 1 "scc_comparison_operator"
13120 [(match_operand 2 "cc_reg_operand" "y")
13122 (set (match_operand:DI 3 "gpc_reg_operand" "=r")
13123 (match_operator:DI 4 "scc_comparison_operator"
13124 [(match_operand 5 "cc_reg_operand" "y")
13126 "TARGET_POWERPC64 && REGNO (operands[2]) != REGNO (operands[5])"
13127 "mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
13128 [(set_attr "type" "mfcr")
13129 (set_attr "length" "12")])
13131 ;; There are some scc insns that can be done directly, without a compare.
13132 ;; These are faster because they don't involve the communications between
13133 ;; the FXU and branch units. In fact, we will be replacing all of the
13134 ;; integer scc insns here or in the portable methods in emit_store_flag.
13136 ;; Also support (neg (scc ..)) since that construct is used to replace
13137 ;; branches, (plus (scc ..) ..) since that construct is common and
13138 ;; takes no more insns than scc, and (and (neg (scc ..)) ..) in the
13139 ;; cases where it is no more expensive than (neg (scc ..)).
13141 ;; Have reload force a constant into a register for the simple insns that
13142 ;; otherwise won't accept constants. We do this because it is faster than
13143 ;; the cmp/mfcr sequence we would otherwise generate.
13145 (define_mode_attr scc_eq_op2 [(SI "rKLI")
13148 (define_insn_and_split "*eq<mode>"
13149 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
13150 (eq:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
13151 (match_operand:GPR 2 "scc_eq_operand" "<scc_eq_op2>")))]
13155 [(set (match_dup 0)
13156 (clz:GPR (match_dup 3)))
13158 (lshiftrt:GPR (match_dup 0) (match_dup 4)))]
13160 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
13162 /* Use output operand as intermediate. */
13163 operands[3] = operands[0];
13165 if (logical_operand (operands[2], <MODE>mode))
13166 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13167 gen_rtx_XOR (<MODE>mode,
13168 operands[1], operands[2])));
13170 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13171 gen_rtx_PLUS (<MODE>mode, operands[1],
13172 negate_rtx (<MODE>mode,
13176 operands[3] = operands[1];
13178 operands[4] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
13181 (define_insn_and_split "*eq<mode>_compare"
13182 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
13184 (eq:P (match_operand:P 1 "gpc_reg_operand" "=r")
13185 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))
13187 (set (match_operand:P 0 "gpc_reg_operand" "=r")
13188 (eq:P (match_dup 1) (match_dup 2)))]
13189 "!TARGET_POWER && optimize_size"
13191 "!TARGET_POWER && optimize_size"
13192 [(set (match_dup 0)
13193 (clz:P (match_dup 4)))
13194 (parallel [(set (match_dup 3)
13195 (compare:CC (lshiftrt:P (match_dup 0) (match_dup 5))
13198 (lshiftrt:P (match_dup 0) (match_dup 5)))])]
13200 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
13202 /* Use output operand as intermediate. */
13203 operands[4] = operands[0];
13205 if (logical_operand (operands[2], <MODE>mode))
13206 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
13207 gen_rtx_XOR (<MODE>mode,
13208 operands[1], operands[2])));
13210 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
13211 gen_rtx_PLUS (<MODE>mode, operands[1],
13212 negate_rtx (<MODE>mode,
13216 operands[4] = operands[1];
13218 operands[5] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
13221 (define_insn "*eqsi_power"
13222 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
13223 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
13224 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I")))
13225 (clobber (match_scratch:SI 3 "=r,&r,r,r,r"))]
13228 xor %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
13229 {sfi|subfic} %3,%1,0\;{ae|adde} %0,%3,%1
13230 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
13231 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
13232 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0"
13233 [(set_attr "type" "three,two,three,three,three")
13234 (set_attr "length" "12,8,12,12,12")])
13236 ;; We have insns of the form shown by the first define_insn below. If
13237 ;; there is something inside the comparison operation, we must split it.
13239 [(set (match_operand:SI 0 "gpc_reg_operand" "")
13240 (plus:SI (match_operator 1 "comparison_operator"
13241 [(match_operand:SI 2 "" "")
13242 (match_operand:SI 3
13243 "reg_or_cint_operand" "")])
13244 (match_operand:SI 4 "gpc_reg_operand" "")))
13245 (clobber (match_operand:SI 5 "register_operand" ""))]
13246 "! gpc_reg_operand (operands[2], SImode)"
13247 [(set (match_dup 5) (match_dup 2))
13248 (set (match_dup 2) (plus:SI (match_op_dup 1 [(match_dup 2) (match_dup 3)])
13251 (define_insn "*plus_eqsi"
13252 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r")
13253 (plus:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
13254 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I"))
13255 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r")))]
13258 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
13259 {sfi|subfic} %0,%1,0\;{aze|addze} %0,%3
13260 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
13261 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
13262 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
13263 [(set_attr "type" "three,two,three,three,three")
13264 (set_attr "length" "12,8,12,12,12")])
13266 (define_insn "*compare_plus_eqsi"
13267 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
13270 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
13271 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
13272 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
13274 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r"))]
13275 "TARGET_32BIT && optimize_size"
13277 xor %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
13278 {sfi|subfic} %4,%1,0\;{aze.|addze.} %4,%3
13279 {xoril|xori} %4,%1,%b2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
13280 {xoriu|xoris} %4,%1,%u2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
13281 {sfi|subfic} %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
13287 [(set_attr "type" "compare")
13288 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
13291 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13294 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
13295 (match_operand:SI 2 "scc_eq_operand" ""))
13296 (match_operand:SI 3 "gpc_reg_operand" ""))
13298 (clobber (match_scratch:SI 4 ""))]
13299 "TARGET_32BIT && optimize_size && reload_completed"
13300 [(set (match_dup 4)
13301 (plus:SI (eq:SI (match_dup 1)
13305 (compare:CC (match_dup 4)
13309 (define_insn "*plus_eqsi_compare"
13310 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
13313 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
13314 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
13315 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
13317 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r")
13318 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13319 "TARGET_32BIT && optimize_size"
13321 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
13322 {sfi|subfic} %0,%1,0\;{aze.|addze.} %0,%3
13323 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
13324 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
13325 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
13331 [(set_attr "type" "compare")
13332 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
13335 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13338 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
13339 (match_operand:SI 2 "scc_eq_operand" ""))
13340 (match_operand:SI 3 "gpc_reg_operand" ""))
13342 (set (match_operand:SI 0 "gpc_reg_operand" "")
13343 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13344 "TARGET_32BIT && optimize_size && reload_completed"
13345 [(set (match_dup 0)
13346 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13348 (compare:CC (match_dup 0)
13352 (define_insn "*neg_eq0<mode>"
13353 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13354 (neg:P (eq:P (match_operand:P 1 "gpc_reg_operand" "r")
13357 "{ai|addic} %0,%1,-1\;{sfe|subfe} %0,%0,%0"
13358 [(set_attr "type" "two")
13359 (set_attr "length" "8")])
13361 (define_insn_and_split "*neg_eq<mode>"
13362 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13363 (neg:P (eq:P (match_operand:P 1 "gpc_reg_operand" "%r")
13364 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))))]
13368 [(set (match_dup 0) (neg:P (eq:P (match_dup 3) (const_int 0))))]
13370 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
13372 /* Use output operand as intermediate. */
13373 operands[3] = operands[0];
13375 if (logical_operand (operands[2], <MODE>mode))
13376 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13377 gen_rtx_XOR (<MODE>mode,
13378 operands[1], operands[2])));
13380 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13381 gen_rtx_PLUS (<MODE>mode, operands[1],
13382 negate_rtx (<MODE>mode,
13386 operands[3] = operands[1];
13389 ;; Simplify (ne X (const_int 0)) on the PowerPC. No need to on the Power,
13390 ;; since it nabs/sr is just as fast.
13391 (define_insn "*ne0si"
13392 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
13393 (lshiftrt:SI (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
13395 (clobber (match_scratch:SI 2 "=&r"))]
13396 "! TARGET_POWER && TARGET_32BIT && !TARGET_ISEL"
13397 "{ai|addic} %2,%1,-1\;{sfe|subfe} %0,%2,%1"
13398 [(set_attr "type" "two")
13399 (set_attr "length" "8")])
13401 (define_insn "*ne0di"
13402 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13403 (lshiftrt:DI (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
13405 (clobber (match_scratch:DI 2 "=&r"))]
13407 "addic %2,%1,-1\;subfe %0,%2,%1"
13408 [(set_attr "type" "two")
13409 (set_attr "length" "8")])
13411 ;; This is what (plus (ne X (const_int 0)) Y) looks like.
13412 (define_insn "*plus_ne0si"
13413 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13414 (plus:SI (lshiftrt:SI
13415 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
13417 (match_operand:SI 2 "gpc_reg_operand" "r")))
13418 (clobber (match_scratch:SI 3 "=&r"))]
13420 "{ai|addic} %3,%1,-1\;{aze|addze} %0,%2"
13421 [(set_attr "type" "two")
13422 (set_attr "length" "8")])
13424 (define_insn "*plus_ne0di"
13425 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13426 (plus:DI (lshiftrt:DI
13427 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
13429 (match_operand:DI 2 "gpc_reg_operand" "r")))
13430 (clobber (match_scratch:DI 3 "=&r"))]
13432 "addic %3,%1,-1\;addze %0,%2"
13433 [(set_attr "type" "two")
13434 (set_attr "length" "8")])
13436 (define_insn "*compare_plus_ne0si"
13437 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13439 (plus:SI (lshiftrt:SI
13440 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
13442 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
13444 (clobber (match_scratch:SI 3 "=&r,&r"))
13445 (clobber (match_scratch:SI 4 "=X,&r"))]
13448 {ai|addic} %3,%1,-1\;{aze.|addze.} %3,%2
13450 [(set_attr "type" "compare")
13451 (set_attr "length" "8,12")])
13454 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13456 (plus:SI (lshiftrt:SI
13457 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
13459 (match_operand:SI 2 "gpc_reg_operand" ""))
13461 (clobber (match_scratch:SI 3 ""))
13462 (clobber (match_scratch:SI 4 ""))]
13463 "TARGET_32BIT && reload_completed"
13464 [(parallel [(set (match_dup 3)
13465 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1)))
13468 (clobber (match_dup 4))])
13470 (compare:CC (match_dup 3)
13474 (define_insn "*compare_plus_ne0di"
13475 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13477 (plus:DI (lshiftrt:DI
13478 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
13480 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
13482 (clobber (match_scratch:DI 3 "=&r,&r"))]
13485 addic %3,%1,-1\;addze. %3,%2
13487 [(set_attr "type" "compare")
13488 (set_attr "length" "8,12")])
13491 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
13493 (plus:DI (lshiftrt:DI
13494 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
13496 (match_operand:DI 2 "gpc_reg_operand" ""))
13498 (clobber (match_scratch:DI 3 ""))]
13499 "TARGET_64BIT && reload_completed"
13500 [(set (match_dup 3)
13501 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1)))
13505 (compare:CC (match_dup 3)
13509 (define_insn "*plus_ne0si_compare"
13510 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13512 (plus:SI (lshiftrt:SI
13513 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
13515 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
13517 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13518 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
13520 (clobber (match_scratch:SI 3 "=&r,&r"))]
13523 {ai|addic} %3,%1,-1\;{aze.|addze.} %0,%2
13525 [(set_attr "type" "compare")
13526 (set_attr "length" "8,12")])
13529 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13531 (plus:SI (lshiftrt:SI
13532 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
13534 (match_operand:SI 2 "gpc_reg_operand" ""))
13536 (set (match_operand:SI 0 "gpc_reg_operand" "")
13537 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
13539 (clobber (match_scratch:SI 3 ""))]
13540 "TARGET_32BIT && reload_completed"
13541 [(parallel [(set (match_dup 0)
13542 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
13544 (clobber (match_dup 3))])
13546 (compare:CC (match_dup 0)
13550 (define_insn "*plus_ne0di_compare"
13551 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13553 (plus:DI (lshiftrt:DI
13554 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
13556 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
13558 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
13559 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
13561 (clobber (match_scratch:DI 3 "=&r,&r"))]
13564 addic %3,%1,-1\;addze. %0,%2
13566 [(set_attr "type" "compare")
13567 (set_attr "length" "8,12")])
13570 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
13572 (plus:DI (lshiftrt:DI
13573 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
13575 (match_operand:DI 2 "gpc_reg_operand" ""))
13577 (set (match_operand:DI 0 "gpc_reg_operand" "")
13578 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
13580 (clobber (match_scratch:DI 3 ""))]
13581 "TARGET_64BIT && reload_completed"
13582 [(parallel [(set (match_dup 0)
13583 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
13585 (clobber (match_dup 3))])
13587 (compare:CC (match_dup 0)
13592 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13593 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13594 (match_operand:SI 2 "reg_or_short_operand" "r,O")))
13595 (clobber (match_scratch:SI 3 "=r,X"))]
13598 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3
13599 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri|srwi} %0,%0,31"
13600 [(set_attr "length" "12")])
13603 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13605 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13606 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
13608 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
13609 (le:SI (match_dup 1) (match_dup 2)))
13610 (clobber (match_scratch:SI 3 "=r,X,r,X"))]
13613 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
13614 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri.|srwi.} %0,%0,31
13617 [(set_attr "type" "compare,delayed_compare,compare,delayed_compare")
13618 (set_attr "length" "12,12,16,16")])
13621 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13623 (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
13624 (match_operand:SI 2 "reg_or_short_operand" ""))
13626 (set (match_operand:SI 0 "gpc_reg_operand" "")
13627 (le:SI (match_dup 1) (match_dup 2)))
13628 (clobber (match_scratch:SI 3 ""))]
13629 "TARGET_POWER && reload_completed"
13630 [(parallel [(set (match_dup 0)
13631 (le:SI (match_dup 1) (match_dup 2)))
13632 (clobber (match_dup 3))])
13634 (compare:CC (match_dup 0)
13639 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13640 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13641 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
13642 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
13645 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
13646 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze|addze} %0,%3"
13647 [(set_attr "length" "12")])
13650 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13652 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13653 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
13654 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13656 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
13659 doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
13660 {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze.|addze.} %4,%3
13663 [(set_attr "type" "compare")
13664 (set_attr "length" "12,12,16,16")])
13667 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13669 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
13670 (match_operand:SI 2 "reg_or_short_operand" ""))
13671 (match_operand:SI 3 "gpc_reg_operand" ""))
13673 (clobber (match_scratch:SI 4 ""))]
13674 "TARGET_POWER && reload_completed"
13675 [(set (match_dup 4)
13676 (plus:SI (le:SI (match_dup 1) (match_dup 2))
13679 (compare:CC (match_dup 4)
13684 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13686 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13687 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
13688 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13690 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13691 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13694 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
13695 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze.|addze.} %0,%3
13698 [(set_attr "type" "compare")
13699 (set_attr "length" "12,12,16,16")])
13702 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13704 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
13705 (match_operand:SI 2 "reg_or_short_operand" ""))
13706 (match_operand:SI 3 "gpc_reg_operand" ""))
13708 (set (match_operand:SI 0 "gpc_reg_operand" "")
13709 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13710 "TARGET_POWER && reload_completed"
13711 [(set (match_dup 0)
13712 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13714 (compare:CC (match_dup 0)
13719 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13720 (neg:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13721 (match_operand:SI 2 "reg_or_short_operand" "r,O"))))]
13724 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
13725 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{srai|srawi} %0,%0,31"
13726 [(set_attr "length" "12")])
13728 (define_insn "*leu<mode>"
13729 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13730 (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
13731 (match_operand:P 2 "reg_or_short_operand" "rI")))]
13733 "{sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
13734 [(set_attr "type" "three")
13735 (set_attr "length" "12")])
13737 (define_insn "*leu<mode>_compare"
13738 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13740 (leu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13741 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
13743 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13744 (leu:P (match_dup 1) (match_dup 2)))]
13747 {sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
13749 [(set_attr "type" "compare")
13750 (set_attr "length" "12,16")])
13753 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13755 (leu:P (match_operand:P 1 "gpc_reg_operand" "")
13756 (match_operand:P 2 "reg_or_short_operand" ""))
13758 (set (match_operand:P 0 "gpc_reg_operand" "")
13759 (leu:P (match_dup 1) (match_dup 2)))]
13761 [(set (match_dup 0)
13762 (leu:P (match_dup 1) (match_dup 2)))
13764 (compare:CC (match_dup 0)
13768 (define_insn "*plus_leu<mode>"
13769 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
13770 (plus:P (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
13771 (match_operand:P 2 "reg_or_short_operand" "rI"))
13772 (match_operand:P 3 "gpc_reg_operand" "r")))]
13774 "{sf%I2|subf%I2c} %0,%1,%2\;{aze|addze} %0,%3"
13775 [(set_attr "type" "two")
13776 (set_attr "length" "8")])
13779 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13781 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13782 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13783 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13785 (clobber (match_scratch:SI 4 "=&r,&r"))]
13788 {sf%I2|subf%I2c} %4,%1,%2\;{aze.|addze.} %4,%3
13790 [(set_attr "type" "compare")
13791 (set_attr "length" "8,12")])
13794 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13796 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13797 (match_operand:SI 2 "reg_or_short_operand" ""))
13798 (match_operand:SI 3 "gpc_reg_operand" ""))
13800 (clobber (match_scratch:SI 4 ""))]
13801 "TARGET_32BIT && reload_completed"
13802 [(set (match_dup 4)
13803 (plus:SI (leu:SI (match_dup 1) (match_dup 2))
13806 (compare:CC (match_dup 4)
13811 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13813 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13814 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13815 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13817 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13818 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13821 {sf%I2|subf%I2c} %0,%1,%2\;{aze.|addze.} %0,%3
13823 [(set_attr "type" "compare")
13824 (set_attr "length" "8,12")])
13827 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13829 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13830 (match_operand:SI 2 "reg_or_short_operand" ""))
13831 (match_operand:SI 3 "gpc_reg_operand" ""))
13833 (set (match_operand:SI 0 "gpc_reg_operand" "")
13834 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13835 "TARGET_32BIT && reload_completed"
13836 [(set (match_dup 0)
13837 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13839 (compare:CC (match_dup 0)
13843 (define_insn "*neg_leu<mode>"
13844 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13845 (neg:P (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
13846 (match_operand:P 2 "reg_or_short_operand" "rI"))))]
13848 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0"
13849 [(set_attr "type" "three")
13850 (set_attr "length" "12")])
13852 (define_insn "*and_neg_leu<mode>"
13853 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
13855 (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
13856 (match_operand:P 2 "reg_or_short_operand" "rI")))
13857 (match_operand:P 3 "gpc_reg_operand" "r")))]
13859 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
13860 [(set_attr "type" "three")
13861 (set_attr "length" "12")])
13864 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13867 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13868 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
13869 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13871 (clobber (match_scratch:SI 4 "=&r,&r"))]
13874 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
13876 [(set_attr "type" "compare")
13877 (set_attr "length" "12,16")])
13880 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13883 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13884 (match_operand:SI 2 "reg_or_short_operand" "")))
13885 (match_operand:SI 3 "gpc_reg_operand" ""))
13887 (clobber (match_scratch:SI 4 ""))]
13888 "TARGET_32BIT && reload_completed"
13889 [(set (match_dup 4)
13890 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
13893 (compare:CC (match_dup 4)
13898 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13901 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13902 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
13903 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13905 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13906 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13909 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
13911 [(set_attr "type" "compare")
13912 (set_attr "length" "12,16")])
13915 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13918 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13919 (match_operand:SI 2 "reg_or_short_operand" "")))
13920 (match_operand:SI 3 "gpc_reg_operand" ""))
13922 (set (match_operand:SI 0 "gpc_reg_operand" "")
13923 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13924 "TARGET_32BIT && reload_completed"
13925 [(set (match_dup 0)
13926 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
13929 (compare:CC (match_dup 0)
13934 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13935 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13936 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
13938 "doz%I2 %0,%1,%2\;nabs %0,%0\;{sri|srwi} %0,%0,31"
13939 [(set_attr "length" "12")])
13942 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13944 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13945 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13947 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13948 (lt:SI (match_dup 1) (match_dup 2)))]
13951 doz%I2 %0,%1,%2\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
13953 [(set_attr "type" "delayed_compare")
13954 (set_attr "length" "12,16")])
13957 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13959 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13960 (match_operand:SI 2 "reg_or_short_operand" ""))
13962 (set (match_operand:SI 0 "gpc_reg_operand" "")
13963 (lt:SI (match_dup 1) (match_dup 2)))]
13964 "TARGET_POWER && reload_completed"
13965 [(set (match_dup 0)
13966 (lt:SI (match_dup 1) (match_dup 2)))
13968 (compare:CC (match_dup 0)
13973 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
13974 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13975 (match_operand:SI 2 "reg_or_short_operand" "rI"))
13976 (match_operand:SI 3 "gpc_reg_operand" "r")))]
13978 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
13979 [(set_attr "length" "12")])
13982 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13984 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13985 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13986 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13988 (clobber (match_scratch:SI 4 "=&r,&r"))]
13991 doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
13993 [(set_attr "type" "compare")
13994 (set_attr "length" "12,16")])
13997 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13999 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14000 (match_operand:SI 2 "reg_or_short_operand" ""))
14001 (match_operand:SI 3 "gpc_reg_operand" ""))
14003 (clobber (match_scratch:SI 4 ""))]
14004 "TARGET_POWER && reload_completed"
14005 [(set (match_dup 4)
14006 (plus:SI (lt:SI (match_dup 1) (match_dup 2))
14009 (compare:CC (match_dup 4)
14014 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
14016 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14017 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14018 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14020 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
14021 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14024 doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
14026 [(set_attr "type" "compare")
14027 (set_attr "length" "12,16")])
14030 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14032 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14033 (match_operand:SI 2 "reg_or_short_operand" ""))
14034 (match_operand:SI 3 "gpc_reg_operand" ""))
14036 (set (match_operand:SI 0 "gpc_reg_operand" "")
14037 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14038 "TARGET_POWER && reload_completed"
14039 [(set (match_dup 0)
14040 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
14042 (compare:CC (match_dup 0)
14047 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14048 (neg:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14049 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
14051 "doz%I2 %0,%1,%2\;nabs %0,%0\;{srai|srawi} %0,%0,31"
14052 [(set_attr "length" "12")])
14054 (define_insn_and_split "*ltu<mode>"
14055 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
14056 (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14057 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))]
14061 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
14062 (set (match_dup 0) (neg:P (match_dup 0)))]
14065 (define_insn_and_split "*ltu<mode>_compare"
14066 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
14068 (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
14069 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
14071 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
14072 (ltu:P (match_dup 1) (match_dup 2)))]
14076 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
14077 (parallel [(set (match_dup 3)
14078 (compare:CC (neg:P (match_dup 0)) (const_int 0)))
14079 (set (match_dup 0) (neg:P (match_dup 0)))])]
14082 (define_insn_and_split "*plus_ltu<mode>"
14083 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,r")
14084 (plus:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14085 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))
14086 (match_operand:P 3 "reg_or_short_operand" "rI,rI")))]
14089 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
14090 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
14091 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))]
14094 (define_insn_and_split "*plus_ltu<mode>_compare"
14095 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
14097 (plus:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
14098 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
14099 (match_operand:P 3 "gpc_reg_operand" "r,r,r,r"))
14101 (set (match_operand:P 0 "gpc_reg_operand" "=&r,&r,&r,&r")
14102 (plus:P (ltu:P (match_dup 1) (match_dup 2)) (match_dup 3)))]
14105 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
14106 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
14107 (parallel [(set (match_dup 4)
14108 (compare:CC (minus:P (match_dup 3) (match_dup 0))
14110 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))])]
14113 (define_insn "*neg_ltu<mode>"
14114 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
14115 (neg:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14116 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))))]
14119 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0
14120 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0"
14121 [(set_attr "type" "two")
14122 (set_attr "length" "8")])
14125 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14126 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14127 (match_operand:SI 2 "reg_or_short_operand" "rI")))
14128 (clobber (match_scratch:SI 3 "=r"))]
14130 "doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3"
14131 [(set_attr "length" "12")])
14134 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
14136 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14137 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14139 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
14140 (ge:SI (match_dup 1) (match_dup 2)))
14141 (clobber (match_scratch:SI 3 "=r,r"))]
14144 doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
14146 [(set_attr "type" "compare")
14147 (set_attr "length" "12,16")])
14150 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14152 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
14153 (match_operand:SI 2 "reg_or_short_operand" ""))
14155 (set (match_operand:SI 0 "gpc_reg_operand" "")
14156 (ge:SI (match_dup 1) (match_dup 2)))
14157 (clobber (match_scratch:SI 3 ""))]
14158 "TARGET_POWER && reload_completed"
14159 [(parallel [(set (match_dup 0)
14160 (ge:SI (match_dup 1) (match_dup 2)))
14161 (clobber (match_dup 3))])
14163 (compare:CC (match_dup 0)
14168 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
14169 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14170 (match_operand:SI 2 "reg_or_short_operand" "rI"))
14171 (match_operand:SI 3 "gpc_reg_operand" "r")))]
14173 "doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
14174 [(set_attr "length" "12")])
14177 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
14179 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14180 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14181 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14183 (clobber (match_scratch:SI 4 "=&r,&r"))]
14186 doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
14188 [(set_attr "type" "compare")
14189 (set_attr "length" "12,16")])
14192 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14194 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
14195 (match_operand:SI 2 "reg_or_short_operand" ""))
14196 (match_operand:SI 3 "gpc_reg_operand" ""))
14198 (clobber (match_scratch:SI 4 ""))]
14199 "TARGET_POWER && reload_completed"
14200 [(set (match_dup 4)
14201 (plus:SI (ge:SI (match_dup 1) (match_dup 2))
14204 (compare:CC (match_dup 4)
14209 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
14211 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14212 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14213 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14215 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
14216 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14219 doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
14221 [(set_attr "type" "compare")
14222 (set_attr "length" "12,16")])
14225 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14227 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
14228 (match_operand:SI 2 "reg_or_short_operand" ""))
14229 (match_operand:SI 3 "gpc_reg_operand" ""))
14231 (set (match_operand:SI 0 "gpc_reg_operand" "")
14232 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14233 "TARGET_POWER && reload_completed"
14234 [(set (match_dup 0)
14235 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
14237 (compare:CC (match_dup 0)
14242 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14243 (neg:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14244 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
14246 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
14247 [(set_attr "length" "12")])
14249 (define_insn "*geu<mode>"
14250 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
14251 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14252 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))]
14255 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0
14256 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
14257 [(set_attr "type" "three")
14258 (set_attr "length" "12")])
14260 (define_insn "*geu<mode>_compare"
14261 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
14263 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
14264 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
14266 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
14267 (geu:P (match_dup 1) (match_dup 2)))]
14270 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
14271 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
14274 [(set_attr "type" "compare")
14275 (set_attr "length" "12,12,16,16")])
14278 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
14280 (geu:P (match_operand:P 1 "gpc_reg_operand" "")
14281 (match_operand:P 2 "reg_or_neg_short_operand" ""))
14283 (set (match_operand:P 0 "gpc_reg_operand" "")
14284 (geu:P (match_dup 1) (match_dup 2)))]
14286 [(set (match_dup 0)
14287 (geu:P (match_dup 1) (match_dup 2)))
14289 (compare:CC (match_dup 0)
14293 (define_insn "*plus_geu<mode>"
14294 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,&r")
14295 (plus:P (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14296 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))
14297 (match_operand:P 3 "gpc_reg_operand" "r,r")))]
14300 {sf|subfc} %0,%2,%1\;{aze|addze} %0,%3
14301 {ai|addic} %0,%1,%n2\;{aze|addze} %0,%3"
14302 [(set_attr "type" "two")
14303 (set_attr "length" "8")])
14306 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
14308 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14309 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
14310 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
14312 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
14315 {sf|subfc} %4,%2,%1\;{aze.|addze.} %4,%3
14316 {ai|addic} %4,%1,%n2\;{aze.|addze.} %4,%3
14319 [(set_attr "type" "compare")
14320 (set_attr "length" "8,8,12,12")])
14323 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14325 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14326 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
14327 (match_operand:SI 3 "gpc_reg_operand" ""))
14329 (clobber (match_scratch:SI 4 ""))]
14330 "TARGET_32BIT && reload_completed"
14331 [(set (match_dup 4)
14332 (plus:SI (geu:SI (match_dup 1) (match_dup 2))
14335 (compare:CC (match_dup 4)
14340 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
14342 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14343 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
14344 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
14346 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
14347 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14350 {sf|subfc} %0,%2,%1\;{aze.|addze.} %0,%3
14351 {ai|addic} %0,%1,%n2\;{aze.|addze.} %0,%3
14354 [(set_attr "type" "compare")
14355 (set_attr "length" "8,8,12,12")])
14358 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14360 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14361 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
14362 (match_operand:SI 3 "gpc_reg_operand" ""))
14364 (set (match_operand:SI 0 "gpc_reg_operand" "")
14365 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14366 "TARGET_32BIT && reload_completed"
14367 [(set (match_dup 0)
14368 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
14370 (compare:CC (match_dup 0)
14374 (define_insn "*neg_geu<mode>"
14375 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
14376 (neg:P (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14377 (match_operand:P 2 "reg_or_short_operand" "r,I"))))]
14380 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0
14381 {sfi|subfic} %0,%1,-1\;{a%I2|add%I2c} %0,%0,%2\;{sfe|subfe} %0,%0,%0"
14382 [(set_attr "type" "three")
14383 (set_attr "length" "12")])
14385 (define_insn "*and_neg_geu<mode>"
14386 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,&r")
14388 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14389 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))
14390 (match_operand:P 3 "gpc_reg_operand" "r,r")))]
14393 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0
14394 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
14395 [(set_attr "type" "three")
14396 (set_attr "length" "12")])
14399 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
14402 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14403 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
14404 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
14406 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
14409 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
14410 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
14413 [(set_attr "type" "compare")
14414 (set_attr "length" "12,12,16,16")])
14417 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14420 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14421 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
14422 (match_operand:SI 3 "gpc_reg_operand" ""))
14424 (clobber (match_scratch:SI 4 ""))]
14425 "TARGET_32BIT && reload_completed"
14426 [(set (match_dup 4)
14427 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2)))
14430 (compare:CC (match_dup 4)
14435 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
14438 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14439 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
14440 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
14442 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
14443 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
14446 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
14447 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
14450 [(set_attr "type" "compare")
14451 (set_attr "length" "12,12,16,16")])
14454 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14457 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14458 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
14459 (match_operand:SI 3 "gpc_reg_operand" ""))
14461 (set (match_operand:SI 0 "gpc_reg_operand" "")
14462 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
14463 "TARGET_32BIT && reload_completed"
14464 [(set (match_dup 0)
14465 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
14467 (compare:CC (match_dup 0)
14472 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14473 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14474 (match_operand:SI 2 "reg_or_short_operand" "r")))]
14476 "doz %0,%2,%1\;nabs %0,%0\;{sri|srwi} %0,%0,31"
14477 [(set_attr "length" "12")])
14480 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
14482 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14483 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
14485 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
14486 (gt:SI (match_dup 1) (match_dup 2)))]
14489 doz %0,%2,%1\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
14491 [(set_attr "type" "delayed_compare")
14492 (set_attr "length" "12,16")])
14495 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
14497 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14498 (match_operand:SI 2 "reg_or_short_operand" ""))
14500 (set (match_operand:SI 0 "gpc_reg_operand" "")
14501 (gt:SI (match_dup 1) (match_dup 2)))]
14502 "TARGET_POWER && reload_completed"
14503 [(set (match_dup 0)
14504 (gt:SI (match_dup 1) (match_dup 2)))
14506 (compare:CC (match_dup 0)
14510 (define_insn "*plus_gt0<mode>"
14511 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
14512 (plus:P (gt:P (match_operand:P 1 "gpc_reg_operand" "r")
14514 (match_operand:P 2 "gpc_reg_operand" "r")))]
14516 "{a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze|addze} %0,%2"
14517 [(set_attr "type" "three")
14518 (set_attr "length" "12")])
14521 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
14523 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14525 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
14527 (clobber (match_scratch:SI 3 "=&r,&r"))]
14530 {a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze.|addze.} %3,%2
14532 [(set_attr "type" "compare")
14533 (set_attr "length" "12,16")])
14536 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14538 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14540 (match_operand:SI 2 "gpc_reg_operand" ""))
14542 (clobber (match_scratch:SI 3 ""))]
14543 "TARGET_32BIT && reload_completed"
14544 [(set (match_dup 3)
14545 (plus:SI (gt:SI (match_dup 1) (const_int 0))
14548 (compare:CC (match_dup 3)
14553 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
14555 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
14557 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
14559 (clobber (match_scratch:DI 3 "=&r,&r"))]
14562 addc %3,%1,%1\;subfe %3,%1,%3\;addze. %3,%2
14564 [(set_attr "type" "compare")
14565 (set_attr "length" "12,16")])
14568 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
14570 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
14572 (match_operand:DI 2 "gpc_reg_operand" ""))
14574 (clobber (match_scratch:DI 3 ""))]
14575 "TARGET_64BIT && reload_completed"
14576 [(set (match_dup 3)
14577 (plus:DI (gt:DI (match_dup 1) (const_int 0))
14580 (compare:CC (match_dup 3)
14585 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
14587 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14589 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
14591 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
14592 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
14595 {a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze.|addze.} %0,%2
14597 [(set_attr "type" "compare")
14598 (set_attr "length" "12,16")])
14601 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
14603 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14605 (match_operand:SI 2 "gpc_reg_operand" ""))
14607 (set (match_operand:SI 0 "gpc_reg_operand" "")
14608 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
14609 "TARGET_32BIT && reload_completed"
14610 [(set (match_dup 0)
14611 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))
14613 (compare:CC (match_dup 0)
14618 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
14620 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
14622 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
14624 (set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
14625 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
14628 addc %0,%1,%1\;subfe %0,%1,%0\;addze. %0,%2
14630 [(set_attr "type" "compare")
14631 (set_attr "length" "12,16")])
14634 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
14636 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
14638 (match_operand:DI 2 "gpc_reg_operand" ""))
14640 (set (match_operand:DI 0 "gpc_reg_operand" "")
14641 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
14642 "TARGET_64BIT && reload_completed"
14643 [(set (match_dup 0)
14644 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))
14646 (compare:CC (match_dup 0)
14651 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
14652 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14653 (match_operand:SI 2 "reg_or_short_operand" "r"))
14654 (match_operand:SI 3 "gpc_reg_operand" "r")))]
14656 "doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
14657 [(set_attr "length" "12")])
14660 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
14662 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14663 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
14664 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14666 (clobber (match_scratch:SI 4 "=&r,&r"))]
14669 doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
14671 [(set_attr "type" "compare")
14672 (set_attr "length" "12,16")])
14675 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14677 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14678 (match_operand:SI 2 "reg_or_short_operand" ""))
14679 (match_operand:SI 3 "gpc_reg_operand" ""))
14681 (clobber (match_scratch:SI 4 ""))]
14682 "TARGET_POWER && reload_completed"
14683 [(set (match_dup 4)
14684 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
14686 (compare:CC (match_dup 4)
14691 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
14693 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14694 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
14695 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14697 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
14698 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14701 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
14703 [(set_attr "type" "compare")
14704 (set_attr "length" "12,16")])
14707 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14709 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14710 (match_operand:SI 2 "reg_or_short_operand" ""))
14711 (match_operand:SI 3 "gpc_reg_operand" ""))
14713 (set (match_operand:SI 0 "gpc_reg_operand" "")
14714 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14715 "TARGET_POWER && reload_completed"
14716 [(set (match_dup 0)
14717 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
14719 (compare:CC (match_dup 0)
14724 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14725 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14726 (match_operand:SI 2 "reg_or_short_operand" "r"))))]
14728 "doz %0,%2,%1\;nabs %0,%0\;{srai|srawi} %0,%0,31"
14729 [(set_attr "length" "12")])
14731 (define_insn_and_split "*gtu<mode>"
14732 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
14733 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
14734 (match_operand:P 2 "reg_or_short_operand" "rI")))]
14738 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
14739 (set (match_dup 0) (neg:P (match_dup 0)))]
14742 (define_insn_and_split "*gtu<mode>_compare"
14743 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
14745 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14746 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
14748 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
14749 (gtu:P (match_dup 1) (match_dup 2)))]
14753 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
14754 (parallel [(set (match_dup 3)
14755 (compare:CC (neg:P (match_dup 0)) (const_int 0)))
14756 (set (match_dup 0) (neg:P (match_dup 0)))])]
14759 (define_insn_and_split "*plus_gtu<mode>"
14760 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
14761 (plus:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
14762 (match_operand:P 2 "reg_or_short_operand" "rI"))
14763 (match_operand:P 3 "reg_or_short_operand" "rI")))]
14766 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
14767 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
14768 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))]
14771 (define_insn_and_split "*plus_gtu<mode>_compare"
14772 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
14774 (plus:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
14775 (match_operand:P 2 "reg_or_short_operand" "I,r,I,r"))
14776 (match_operand:P 3 "gpc_reg_operand" "r,r,r,r"))
14778 (set (match_operand:P 0 "gpc_reg_operand" "=&r,&r,&r,&r")
14779 (plus:P (gtu:P (match_dup 1) (match_dup 2)) (match_dup 3)))]
14782 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
14783 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
14784 (parallel [(set (match_dup 4)
14785 (compare:CC (minus:P (match_dup 3) (match_dup 0))
14787 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))])]
14790 (define_insn "*neg_gtu<mode>"
14791 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
14792 (neg:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
14793 (match_operand:P 2 "reg_or_short_operand" "rI"))))]
14795 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0"
14796 [(set_attr "type" "two")
14797 (set_attr "length" "8")])
14800 ;; Define both directions of branch and return. If we need a reload
14801 ;; register, we'd rather use CR0 since it is much easier to copy a
14802 ;; register CC value to there.
14806 (if_then_else (match_operator 1 "branch_comparison_operator"
14808 "cc_reg_operand" "y")
14810 (label_ref (match_operand 0 "" ""))
14815 return output_cbranch (operands[1], \"%l0\", 0, insn);
14817 [(set_attr "type" "branch")])
14821 (if_then_else (match_operator 0 "branch_comparison_operator"
14823 "cc_reg_operand" "y")
14830 return output_cbranch (operands[0], NULL, 0, insn);
14832 [(set_attr "type" "jmpreg")
14833 (set_attr "length" "4")])
14837 (if_then_else (match_operator 1 "branch_comparison_operator"
14839 "cc_reg_operand" "y")
14842 (label_ref (match_operand 0 "" ""))))]
14846 return output_cbranch (operands[1], \"%l0\", 1, insn);
14848 [(set_attr "type" "branch")])
14852 (if_then_else (match_operator 0 "branch_comparison_operator"
14854 "cc_reg_operand" "y")
14861 return output_cbranch (operands[0], NULL, 1, insn);
14863 [(set_attr "type" "jmpreg")
14864 (set_attr "length" "4")])
14866 ;; Logic on condition register values.
14868 ; This pattern matches things like
14869 ; (set (reg:CCEQ 68) (compare:CCEQ (ior:SI (gt:SI (reg:CCFP 68) (const_int 0))
14870 ; (eq:SI (reg:CCFP 68) (const_int 0)))
14872 ; which are generated by the branch logic.
14873 ; Prefer destructive operations where BT = BB (for crXX BT,BA,BB)
14875 (define_insn "*cceq_ior_compare"
14876 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
14877 (compare:CCEQ (match_operator:SI 1 "boolean_operator"
14878 [(match_operator:SI 2
14879 "branch_positive_comparison_operator"
14881 "cc_reg_operand" "y,y")
14883 (match_operator:SI 4
14884 "branch_positive_comparison_operator"
14886 "cc_reg_operand" "0,y")
14890 "cr%q1 %E0,%j2,%j4"
14891 [(set_attr "type" "cr_logical,delayed_cr")])
14893 ; Why is the constant -1 here, but 1 in the previous pattern?
14894 ; Because ~1 has all but the low bit set.
14896 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
14897 (compare:CCEQ (match_operator:SI 1 "boolean_or_operator"
14898 [(not:SI (match_operator:SI 2
14899 "branch_positive_comparison_operator"
14901 "cc_reg_operand" "y,y")
14903 (match_operator:SI 4
14904 "branch_positive_comparison_operator"
14906 "cc_reg_operand" "0,y")
14910 "cr%q1 %E0,%j2,%j4"
14911 [(set_attr "type" "cr_logical,delayed_cr")])
14913 (define_insn "*cceq_rev_compare"
14914 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
14915 (compare:CCEQ (match_operator:SI 1
14916 "branch_positive_comparison_operator"
14918 "cc_reg_operand" "0,y")
14922 "{crnor %E0,%j1,%j1|crnot %E0,%j1}"
14923 [(set_attr "type" "cr_logical,delayed_cr")])
14925 ;; If we are comparing the result of two comparisons, this can be done
14926 ;; using creqv or crxor.
14928 (define_insn_and_split ""
14929 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
14930 (compare:CCEQ (match_operator 1 "branch_comparison_operator"
14931 [(match_operand 2 "cc_reg_operand" "y")
14933 (match_operator 3 "branch_comparison_operator"
14934 [(match_operand 4 "cc_reg_operand" "y")
14939 [(set (match_dup 0) (compare:CCEQ (xor:SI (match_dup 1) (match_dup 3))
14943 int positive_1, positive_2;
14945 positive_1 = branch_positive_comparison_operator (operands[1],
14946 GET_MODE (operands[1]));
14947 positive_2 = branch_positive_comparison_operator (operands[3],
14948 GET_MODE (operands[3]));
14951 operands[1] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[2]),
14952 GET_CODE (operands[1])),
14954 operands[2], const0_rtx);
14955 else if (GET_MODE (operands[1]) != SImode)
14956 operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]), SImode,
14957 operands[2], const0_rtx);
14960 operands[3] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[4]),
14961 GET_CODE (operands[3])),
14963 operands[4], const0_rtx);
14964 else if (GET_MODE (operands[3]) != SImode)
14965 operands[3] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
14966 operands[4], const0_rtx);
14968 if (positive_1 == positive_2)
14970 operands[1] = gen_rtx_NOT (SImode, operands[1]);
14971 operands[5] = constm1_rtx;
14975 operands[5] = const1_rtx;
14979 ;; Unconditional branch and return.
14981 (define_insn "jump"
14983 (label_ref (match_operand 0 "" "")))]
14986 [(set_attr "type" "branch")])
14988 (define_insn "return"
14992 [(set_attr "type" "jmpreg")])
14994 (define_expand "indirect_jump"
14995 [(set (pc) (match_operand 0 "register_operand" ""))])
14997 (define_insn "*indirect_jump<mode>"
14998 [(set (pc) (match_operand:P 0 "register_operand" "c,*l"))]
15003 [(set_attr "type" "jmpreg")])
15005 ;; Table jump for switch statements:
15006 (define_expand "tablejump"
15007 [(use (match_operand 0 "" ""))
15008 (use (label_ref (match_operand 1 "" "")))]
15013 emit_jump_insn (gen_tablejumpsi (operands[0], operands[1]));
15015 emit_jump_insn (gen_tablejumpdi (operands[0], operands[1]));
15019 (define_expand "tablejumpsi"
15020 [(set (match_dup 3)
15021 (plus:SI (match_operand:SI 0 "" "")
15023 (parallel [(set (pc) (match_dup 3))
15024 (use (label_ref (match_operand 1 "" "")))])]
15027 { operands[0] = force_reg (SImode, operands[0]);
15028 operands[2] = force_reg (SImode, gen_rtx_LABEL_REF (SImode, operands[1]));
15029 operands[3] = gen_reg_rtx (SImode);
15032 (define_expand "tablejumpdi"
15033 [(set (match_dup 4)
15034 (sign_extend:DI (match_operand:SI 0 "lwa_operand" "")))
15036 (plus:DI (match_dup 4)
15038 (parallel [(set (pc) (match_dup 3))
15039 (use (label_ref (match_operand 1 "" "")))])]
15042 { operands[2] = force_reg (DImode, gen_rtx_LABEL_REF (DImode, operands[1]));
15043 operands[3] = gen_reg_rtx (DImode);
15044 operands[4] = gen_reg_rtx (DImode);
15047 (define_insn "*tablejump<mode>_internal1"
15049 (match_operand:P 0 "register_operand" "c,*l"))
15050 (use (label_ref (match_operand 1 "" "")))]
15055 [(set_attr "type" "jmpreg")])
15060 "{cror 0,0,0|nop}")
15062 ;; Define the subtract-one-and-jump insns, starting with the template
15063 ;; so loop.c knows what to generate.
15065 (define_expand "doloop_end"
15066 [(use (match_operand 0 "" "")) ; loop pseudo
15067 (use (match_operand 1 "" "")) ; iterations; zero if unknown
15068 (use (match_operand 2 "" "")) ; max iterations
15069 (use (match_operand 3 "" "")) ; loop level
15070 (use (match_operand 4 "" ""))] ; label
15074 /* Only use this on innermost loops. */
15075 if (INTVAL (operands[3]) > 1)
15079 if (GET_MODE (operands[0]) != DImode)
15081 emit_jump_insn (gen_ctrdi (operands[0], operands[4]));
15085 if (GET_MODE (operands[0]) != SImode)
15087 emit_jump_insn (gen_ctrsi (operands[0], operands[4]));
15092 (define_expand "ctr<mode>"
15093 [(parallel [(set (pc)
15094 (if_then_else (ne (match_operand:P 0 "register_operand" "")
15096 (label_ref (match_operand 1 "" ""))
15099 (plus:P (match_dup 0)
15101 (clobber (match_scratch:CC 2 ""))
15102 (clobber (match_scratch:P 3 ""))])]
15106 ;; We need to be able to do this for any operand, including MEM, or we
15107 ;; will cause reload to blow up since we don't allow output reloads on
15109 ;; For the length attribute to be calculated correctly, the
15110 ;; label MUST be operand 0.
15112 (define_insn "*ctr<mode>_internal1"
15114 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
15116 (label_ref (match_operand 0 "" ""))
15118 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
15119 (plus:P (match_dup 1)
15121 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
15122 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
15126 if (which_alternative != 0)
15128 else if (get_attr_length (insn) == 4)
15129 return \"{bdn|bdnz} %l0\";
15131 return \"bdz $+8\;b %l0\";
15133 [(set_attr "type" "branch")
15134 (set_attr "length" "*,12,16,16")])
15136 (define_insn "*ctr<mode>_internal2"
15138 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
15141 (label_ref (match_operand 0 "" ""))))
15142 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
15143 (plus:P (match_dup 1)
15145 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
15146 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
15150 if (which_alternative != 0)
15152 else if (get_attr_length (insn) == 4)
15153 return \"bdz %l0\";
15155 return \"{bdn|bdnz} $+8\;b %l0\";
15157 [(set_attr "type" "branch")
15158 (set_attr "length" "*,12,16,16")])
15160 ;; Similar but use EQ
15162 (define_insn "*ctr<mode>_internal5"
15164 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
15166 (label_ref (match_operand 0 "" ""))
15168 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
15169 (plus:P (match_dup 1)
15171 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
15172 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
15176 if (which_alternative != 0)
15178 else if (get_attr_length (insn) == 4)
15179 return \"bdz %l0\";
15181 return \"{bdn|bdnz} $+8\;b %l0\";
15183 [(set_attr "type" "branch")
15184 (set_attr "length" "*,12,16,16")])
15186 (define_insn "*ctr<mode>_internal6"
15188 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
15191 (label_ref (match_operand 0 "" ""))))
15192 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
15193 (plus:P (match_dup 1)
15195 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
15196 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
15200 if (which_alternative != 0)
15202 else if (get_attr_length (insn) == 4)
15203 return \"{bdn|bdnz} %l0\";
15205 return \"bdz $+8\;b %l0\";
15207 [(set_attr "type" "branch")
15208 (set_attr "length" "*,12,16,16")])
15210 ;; Now the splitters if we could not allocate the CTR register
15214 (if_then_else (match_operator 2 "comparison_operator"
15215 [(match_operand:P 1 "gpc_reg_operand" "")
15217 (match_operand 5 "" "")
15218 (match_operand 6 "" "")))
15219 (set (match_operand:P 0 "gpc_reg_operand" "")
15220 (plus:P (match_dup 1) (const_int -1)))
15221 (clobber (match_scratch:CC 3 ""))
15222 (clobber (match_scratch:P 4 ""))]
15224 [(parallel [(set (match_dup 3)
15225 (compare:CC (plus:P (match_dup 1)
15229 (plus:P (match_dup 1)
15231 (set (pc) (if_then_else (match_dup 7)
15235 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
15236 operands[3], const0_rtx); }")
15240 (if_then_else (match_operator 2 "comparison_operator"
15241 [(match_operand:P 1 "gpc_reg_operand" "")
15243 (match_operand 5 "" "")
15244 (match_operand 6 "" "")))
15245 (set (match_operand:P 0 "nonimmediate_operand" "")
15246 (plus:P (match_dup 1) (const_int -1)))
15247 (clobber (match_scratch:CC 3 ""))
15248 (clobber (match_scratch:P 4 ""))]
15249 "reload_completed && ! gpc_reg_operand (operands[0], SImode)"
15250 [(parallel [(set (match_dup 3)
15251 (compare:CC (plus:P (match_dup 1)
15255 (plus:P (match_dup 1)
15259 (set (pc) (if_then_else (match_dup 7)
15263 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
15264 operands[3], const0_rtx); }")
15266 (define_insn "trap"
15267 [(trap_if (const_int 1) (const_int 0))]
15270 [(set_attr "type" "trap")])
15272 (define_expand "ctrap<mode>4"
15273 [(trap_if (match_operator 0 "ordered_comparison_operator"
15274 [(match_operand:GPR 1 "register_operand")
15275 (match_operand:GPR 2 "reg_or_short_operand")])
15276 (match_operand 3 "zero_constant" ""))]
15281 [(trap_if (match_operator 0 "ordered_comparison_operator"
15282 [(match_operand:GPR 1 "register_operand" "r")
15283 (match_operand:GPR 2 "reg_or_short_operand" "rI")])
15286 "{t|t<wd>}%V0%I2 %1,%2"
15287 [(set_attr "type" "trap")])
15289 ;; Insns related to generating the function prologue and epilogue.
15291 (define_expand "prologue"
15292 [(use (const_int 0))]
15293 "TARGET_SCHED_PROLOG"
15296 rs6000_emit_prologue ();
15300 (define_insn "*movesi_from_cr_one"
15301 [(match_parallel 0 "mfcr_operation"
15302 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
15303 (unspec:SI [(match_operand:CC 2 "cc_reg_operand" "y")
15304 (match_operand 3 "immediate_operand" "n")]
15305 UNSPEC_MOVESI_FROM_CR))])]
15311 for (i = 0; i < XVECLEN (operands[0], 0); i++)
15313 mask = INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
15314 operands[4] = GEN_INT (mask);
15315 output_asm_insn (\"mfcr %1,%4\", operands);
15319 [(set_attr "type" "mfcrf")])
15321 (define_insn "movesi_from_cr"
15322 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
15323 (unspec:SI [(reg:CC CR0_REGNO) (reg:CC CR1_REGNO)
15324 (reg:CC CR2_REGNO) (reg:CC CR3_REGNO)
15325 (reg:CC CR4_REGNO) (reg:CC CR5_REGNO)
15326 (reg:CC CR6_REGNO) (reg:CC CR7_REGNO)]
15327 UNSPEC_MOVESI_FROM_CR))]
15330 [(set_attr "type" "mfcr")])
15332 (define_insn "*stmw"
15333 [(match_parallel 0 "stmw_operation"
15334 [(set (match_operand:SI 1 "memory_operand" "=m")
15335 (match_operand:SI 2 "gpc_reg_operand" "r"))])]
15338 [(set_attr "type" "store_ux")])
15340 (define_insn "*save_gpregs_<mode>"
15341 [(match_parallel 0 "any_parallel_operand"
15342 [(clobber (reg:P 65))
15343 (use (match_operand:P 1 "symbol_ref_operand" "s"))
15344 (use (match_operand:P 2 "gpc_reg_operand" "r"))
15345 (set (match_operand:P 3 "memory_operand" "=m")
15346 (match_operand:P 4 "gpc_reg_operand" "r"))])]
15349 [(set_attr "type" "branch")
15350 (set_attr "length" "4")])
15352 (define_insn "*save_fpregs_<mode>"
15353 [(match_parallel 0 "any_parallel_operand"
15354 [(clobber (reg:P 65))
15355 (use (match_operand:P 1 "symbol_ref_operand" "s"))
15356 (use (match_operand:P 2 "gpc_reg_operand" "r"))
15357 (set (match_operand:DF 3 "memory_operand" "=m")
15358 (match_operand:DF 4 "gpc_reg_operand" "d"))])]
15361 [(set_attr "type" "branch")
15362 (set_attr "length" "4")])
15364 ; These are to explain that changes to the stack pointer should
15365 ; not be moved over stores to stack memory.
15366 (define_insn "stack_tie"
15367 [(set (match_operand:BLK 0 "memory_operand" "+m")
15368 (unspec:BLK [(match_dup 0)] UNSPEC_TIE))]
15371 [(set_attr "length" "0")])
15374 (define_expand "epilogue"
15375 [(use (const_int 0))]
15376 "TARGET_SCHED_PROLOG"
15379 rs6000_emit_epilogue (FALSE);
15383 ; On some processors, doing the mtcrf one CC register at a time is
15384 ; faster (like on the 604e). On others, doing them all at once is
15385 ; faster; for instance, on the 601 and 750.
15387 (define_expand "movsi_to_cr_one"
15388 [(set (match_operand:CC 0 "cc_reg_operand" "")
15389 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "")
15390 (match_dup 2)] UNSPEC_MOVESI_TO_CR))]
15392 "operands[2] = GEN_INT (1 << (75 - REGNO (operands[0])));")
15394 (define_insn "*movsi_to_cr"
15395 [(match_parallel 0 "mtcrf_operation"
15396 [(set (match_operand:CC 1 "cc_reg_operand" "=y")
15397 (unspec:CC [(match_operand:SI 2 "gpc_reg_operand" "r")
15398 (match_operand 3 "immediate_operand" "n")]
15399 UNSPEC_MOVESI_TO_CR))])]
15405 for (i = 0; i < XVECLEN (operands[0], 0); i++)
15406 mask |= INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
15407 operands[4] = GEN_INT (mask);
15408 return \"mtcrf %4,%2\";
15410 [(set_attr "type" "mtcr")])
15412 (define_insn "*mtcrfsi"
15413 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
15414 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
15415 (match_operand 2 "immediate_operand" "n")]
15416 UNSPEC_MOVESI_TO_CR))]
15417 "GET_CODE (operands[0]) == REG
15418 && CR_REGNO_P (REGNO (operands[0]))
15419 && GET_CODE (operands[2]) == CONST_INT
15420 && INTVAL (operands[2]) == 1 << (75 - REGNO (operands[0]))"
15422 [(set_attr "type" "mtcr")])
15424 ; The load-multiple instructions have similar properties.
15425 ; Note that "load_multiple" is a name known to the machine-independent
15426 ; code that actually corresponds to the PowerPC load-string.
15428 (define_insn "*lmw"
15429 [(match_parallel 0 "lmw_operation"
15430 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
15431 (match_operand:SI 2 "memory_operand" "m"))])]
15434 [(set_attr "type" "load_ux")
15435 (set_attr "cell_micro" "always")])
15437 (define_insn "*return_internal_<mode>"
15439 (use (match_operand:P 0 "register_operand" "lc"))]
15442 [(set_attr "type" "jmpreg")])
15444 ; FIXME: This would probably be somewhat simpler if the Cygnus sibcall
15445 ; stuff was in GCC. Oh, and "any_parallel_operand" is a bit flexible...
15447 (define_insn "*restore_gpregs_<mode>"
15448 [(match_parallel 0 "any_parallel_operand"
15449 [(clobber (match_operand:P 1 "register_operand" "=l"))
15450 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15451 (use (match_operand:P 3 "gpc_reg_operand" "r"))
15452 (set (match_operand:P 4 "gpc_reg_operand" "=r")
15453 (match_operand:P 5 "memory_operand" "m"))])]
15456 [(set_attr "type" "branch")
15457 (set_attr "length" "4")])
15459 (define_insn "*return_and_restore_gpregs_<mode>"
15460 [(match_parallel 0 "any_parallel_operand"
15462 (clobber (match_operand:P 1 "register_operand" "=l"))
15463 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15464 (use (match_operand:P 3 "gpc_reg_operand" "r"))
15465 (set (match_operand:P 4 "gpc_reg_operand" "=r")
15466 (match_operand:P 5 "memory_operand" "m"))])]
15469 [(set_attr "type" "branch")
15470 (set_attr "length" "4")])
15472 (define_insn "*return_and_restore_fpregs_<mode>"
15473 [(match_parallel 0 "any_parallel_operand"
15475 (clobber (match_operand:P 1 "register_operand" "=l"))
15476 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15477 (use (match_operand:P 3 "gpc_reg_operand" "r"))
15478 (set (match_operand:DF 4 "gpc_reg_operand" "=d")
15479 (match_operand:DF 5 "memory_operand" "m"))])]
15482 [(set_attr "type" "branch")
15483 (set_attr "length" "4")])
15485 (define_insn "*return_and_restore_fpregs_aix_<mode>"
15486 [(match_parallel 0 "any_parallel_operand"
15488 (use (match_operand:P 1 "register_operand" "l"))
15489 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15490 (use (match_operand:P 3 "gpc_reg_operand" "r"))
15491 (set (match_operand:DF 4 "gpc_reg_operand" "=d")
15492 (match_operand:DF 5 "memory_operand" "m"))])]
15495 [(set_attr "type" "branch")
15496 (set_attr "length" "4")])
15498 ; This is used in compiling the unwind routines.
15499 (define_expand "eh_return"
15500 [(use (match_operand 0 "general_operand" ""))]
15505 emit_insn (gen_eh_set_lr_si (operands[0]));
15507 emit_insn (gen_eh_set_lr_di (operands[0]));
15511 ; We can't expand this before we know where the link register is stored.
15512 (define_insn "eh_set_lr_<mode>"
15513 [(unspec_volatile [(match_operand:P 0 "register_operand" "r")]
15515 (clobber (match_scratch:P 1 "=&b"))]
15520 [(unspec_volatile [(match_operand 0 "register_operand" "")] UNSPECV_EH_RR)
15521 (clobber (match_scratch 1 ""))]
15526 rs6000_emit_eh_reg_restore (operands[0], operands[1]);
15530 (define_insn "prefetch"
15531 [(prefetch (match_operand 0 "indexed_or_indirect_address" "a")
15532 (match_operand:SI 1 "const_int_operand" "n")
15533 (match_operand:SI 2 "const_int_operand" "n"))]
15537 if (GET_CODE (operands[0]) == REG)
15538 return INTVAL (operands[1]) ? \"dcbtst 0,%0\" : \"dcbt 0,%0\";
15539 return INTVAL (operands[1]) ? \"dcbtst %a0\" : \"dcbt %a0\";
15541 [(set_attr "type" "load")])
15543 (define_insn "bpermd_<mode>"
15544 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
15545 (unspec:P [(match_operand:P 1 "gpc_reg_operand" "r")
15546 (match_operand:P 2 "gpc_reg_operand" "r")] UNSPEC_BPERM))]
15549 [(set_attr "type" "integer")])
15553 (include "sync.md")
15554 (include "vector.md")
15556 (include "altivec.md")
15559 (include "paired.md")