1 ;; Machine description for IBM RISC System 6000 (POWER) for GNU C compiler
2 ;; Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
3 ;; 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
4 ;; Free Software Foundation, Inc.
5 ;; Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
7 ;; This file is part of GCC.
9 ;; GCC is free software; you can redistribute it and/or modify it
10 ;; under the terms of the GNU General Public License as published
11 ;; by the Free Software Foundation; either version 3, or (at your
12 ;; option) any later version.
14 ;; GCC is distributed in the hope that it will be useful, but WITHOUT
15 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
17 ;; License for more details.
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GCC; see the file COPYING3. If not see
21 ;; <http://www.gnu.org/licenses/>.
23 ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
43 (FIRST_ALTIVEC_REGNO 77)
44 (LAST_ALTIVEC_REGNO 108)
57 [(UNSPEC_FRSP 0) ; frsp for POWER machines
58 (UNSPEC_PROBE_STACK 4) ; probe stack memory reference
59 (UNSPEC_TIE 5) ; tie stack contents and stack pointer
60 (UNSPEC_TOCPTR 6) ; address of a word pointing to the TOC
61 (UNSPEC_TOC 7) ; address of the TOC (more-or-less)
63 (UNSPEC_MV_CR_OV 9) ; move_from_CR_ov_bit
69 (UNSPEC_LD_MPIC 15) ; load_macho_picbase
70 (UNSPEC_MPIC_CORRECT 16) ; macho_correct_pic
73 (UNSPEC_MOVESI_FROM_CR 19)
74 (UNSPEC_MOVESI_TO_CR 20)
76 (UNSPEC_TLSDTPRELHA 22)
77 (UNSPEC_TLSDTPRELLO 23)
78 (UNSPEC_TLSGOTDTPREL 24)
80 (UNSPEC_TLSTPRELHA 26)
81 (UNSPEC_TLSTPRELLO 27)
82 (UNSPEC_TLSGOTTPREL 28)
84 (UNSPEC_FIX_TRUNC_TF 30) ; fadd, rounding towards zero
85 (UNSPEC_MV_CR_GT 31) ; move_from_CR_gt_bit
101 (UNSPEC_DLMZB_STRLEN 47)
104 (UNSPEC_MACHOPIC_OFFSET 50)
109 ;; UNSPEC_VOLATILE usage
114 (UNSPECV_LL 1) ; load-locked
115 (UNSPECV_SC 2) ; store-conditional
116 (UNSPECV_EH_RR 9) ; eh_reg_restore
119 ;; Define an insn type attribute. This is used in function unit delay
121 (define_attr "type" "integer,two,three,load,load_ext,load_ext_u,load_ext_ux,load_ux,load_u,store,store_ux,store_u,fpload,fpload_ux,fpload_u,fpstore,fpstore_ux,fpstore_u,vecload,vecstore,imul,imul2,imul3,lmul,idiv,ldiv,insert_word,branch,cmp,fast_compare,compare,var_delayed_compare,delayed_compare,imul_compare,lmul_compare,fpcompare,cr_logical,delayed_cr,mfcr,mfcrf,mtcr,mfjmpr,mtjmpr,fp,fpsimple,dmul,sdiv,ddiv,ssqrt,dsqrt,jmpreg,brinc,vecsimple,veccomplex,vecdiv,veccmp,veccmpsimple,vecperm,vecfloat,vecfdiv,isync,sync,load_l,store_c,shift,trap,insert_dword,var_shift_rotate,cntlz,exts,mffgpr,mftgpr,isel"
122 (const_string "integer"))
124 ;; Define floating point instruction sub-types for use with Xfpu.md
125 (define_attr "fp_type" "fp_default,fp_addsub_s,fp_addsub_d,fp_mul_s,fp_mul_d,fp_div_s,fp_div_d,fp_maddsub_s,fp_maddsub_d,fp_sqrt_s,fp_sqrt_d" (const_string "fp_default"))
127 ;; Length (in bytes).
128 ; '(pc)' in the following doesn't include the instruction itself; it is
129 ; calculated as if the instruction had zero size.
130 (define_attr "length" ""
131 (if_then_else (eq_attr "type" "branch")
132 (if_then_else (and (ge (minus (match_dup 0) (pc))
134 (lt (minus (match_dup 0) (pc))
140 ;; Processor type -- this attribute must exactly match the processor_type
141 ;; enumeration in rs6000.h.
143 (define_attr "cpu" "rios1,rios2,rs64a,mpccore,ppc403,ppc405,ppc440,ppc476,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630,ppc750,ppc7400,ppc7450,ppc8540,ppce300c2,ppce300c3,ppce500mc,ppce500mc64,power4,power5,power6,power7,cell,ppca2"
144 (const (symbol_ref "rs6000_cpu_attr")))
147 ;; If this instruction is microcoded on the CELL processor
148 ; The default for load extended, the recorded instructions and rotate/shifts by a variable is always microcoded
149 (define_attr "cell_micro" "not,conditional,always"
150 (if_then_else (eq_attr "type" "compare,delayed_compare,imul_compare,lmul_compare,load_ext,load_ext_ux,var_shift_rotate,var_delayed_compare")
151 (const_string "always")
152 (const_string "not")))
154 (automata_option "ndfa")
168 (include "e300c2c3.md")
169 (include "e500mc.md")
170 (include "e500mc64.md")
171 (include "power4.md")
172 (include "power5.md")
173 (include "power6.md")
174 (include "power7.md")
179 (include "predicates.md")
180 (include "constraints.md")
182 (include "darwin.md")
187 ; This mode iterator allows :GPR to be used to indicate the allowable size
188 ; of whole values in GPRs.
189 (define_mode_iterator GPR [SI (DI "TARGET_POWERPC64")])
191 ; Any supported integer mode.
192 (define_mode_iterator INT [QI HI SI DI TI])
194 ; Any supported integer mode that fits in one register.
195 (define_mode_iterator INT1 [QI HI SI (DI "TARGET_POWERPC64")])
197 ; extend modes for DImode
198 (define_mode_iterator QHSI [QI HI SI])
200 ; SImode or DImode, even if DImode doesn't fit in GPRs.
201 (define_mode_iterator SDI [SI DI])
203 ; The size of a pointer. Also, the size of the value that a record-condition
204 ; (one with a '.') will compare.
205 (define_mode_iterator P [(SI "TARGET_32BIT") (DI "TARGET_64BIT")])
207 ; Any hardware-supported floating-point mode
208 (define_mode_iterator FP [
209 (SF "TARGET_HARD_FLOAT
210 && ((TARGET_FPRS && TARGET_SINGLE_FLOAT) || TARGET_E500_SINGLE)")
211 (DF "TARGET_HARD_FLOAT
212 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)")
213 (TF "!TARGET_IEEEQUAD
215 && (TARGET_FPRS || TARGET_E500_DOUBLE)
216 && TARGET_LONG_DOUBLE_128")
220 ; These modes do not fit in integer registers in 32-bit mode.
221 (define_mode_iterator DIFD [DI DF DD])
223 ; Various instructions that come in SI and DI forms.
224 ; A generic w/d attribute, for things like cmpw/cmpd.
225 (define_mode_attr wd [(QI "b") (HI "h") (SI "w") (DI "d")])
228 (define_mode_attr dbits [(QI "56") (HI "48") (SI "32")])
230 ;; ISEL/ISEL64 target selection
231 (define_mode_attr sel [(SI "") (DI "64")])
233 ;; Suffix for reload patterns
234 (define_mode_attr ptrsize [(SI "32bit")
237 (define_mode_attr tptrsize [(SI "TARGET_32BIT")
238 (DI "TARGET_64BIT")])
240 (define_mode_attr mptrsize [(SI "si")
244 ;; Start with fixed-point load and store insns. Here we put only the more
245 ;; complex forms. Basic data transfer is done later.
247 (define_expand "zero_extend<mode>di2"
248 [(set (match_operand:DI 0 "gpc_reg_operand" "")
249 (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "")))]
253 (define_insn "*zero_extend<mode>di2_internal1"
254 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
255 (zero_extend:DI (match_operand:QHSI 1 "reg_or_mem_operand" "m,r")))]
259 rldicl %0,%1,0,<dbits>"
260 [(set_attr "type" "load,*")])
262 (define_insn "*zero_extend<mode>di2_internal2"
263 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
264 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "r,r"))
266 (clobber (match_scratch:DI 2 "=r,r"))]
269 rldicl. %2,%1,0,<dbits>
271 [(set_attr "type" "compare")
272 (set_attr "length" "4,8")])
275 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
276 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" ""))
278 (clobber (match_scratch:DI 2 ""))]
279 "TARGET_POWERPC64 && reload_completed"
281 (zero_extend:DI (match_dup 1)))
283 (compare:CC (match_dup 2)
287 (define_insn "*zero_extend<mode>di2_internal3"
288 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
289 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "r,r"))
291 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
292 (zero_extend:DI (match_dup 1)))]
295 rldicl. %0,%1,0,<dbits>
297 [(set_attr "type" "compare")
298 (set_attr "length" "4,8")])
301 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
302 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" ""))
304 (set (match_operand:DI 0 "gpc_reg_operand" "")
305 (zero_extend:DI (match_dup 1)))]
306 "TARGET_POWERPC64 && reload_completed"
308 (zero_extend:DI (match_dup 1)))
310 (compare:CC (match_dup 0)
314 (define_insn "extendqidi2"
315 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
316 (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r")))]
319 [(set_attr "type" "exts")])
322 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
323 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
325 (clobber (match_scratch:DI 2 "=r,r"))]
330 [(set_attr "type" "compare")
331 (set_attr "length" "4,8")])
334 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
335 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
337 (clobber (match_scratch:DI 2 ""))]
338 "TARGET_POWERPC64 && reload_completed"
340 (sign_extend:DI (match_dup 1)))
342 (compare:CC (match_dup 2)
347 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
348 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
350 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
351 (sign_extend:DI (match_dup 1)))]
356 [(set_attr "type" "compare")
357 (set_attr "length" "4,8")])
360 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
361 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
363 (set (match_operand:DI 0 "gpc_reg_operand" "")
364 (sign_extend:DI (match_dup 1)))]
365 "TARGET_POWERPC64 && reload_completed"
367 (sign_extend:DI (match_dup 1)))
369 (compare:CC (match_dup 0)
373 (define_expand "extendhidi2"
374 [(set (match_operand:DI 0 "gpc_reg_operand" "")
375 (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "")))]
380 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
381 (sign_extend:DI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
382 "TARGET_POWERPC64 && rs6000_gen_cell_microcode"
386 [(set_attr "type" "load_ext,exts")])
389 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
390 (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r")))]
391 "TARGET_POWERPC64 && !rs6000_gen_cell_microcode"
393 [(set_attr "type" "exts")])
396 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
397 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
399 (clobber (match_scratch:DI 2 "=r,r"))]
404 [(set_attr "type" "compare")
405 (set_attr "length" "4,8")])
408 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
409 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
411 (clobber (match_scratch:DI 2 ""))]
412 "TARGET_POWERPC64 && reload_completed"
414 (sign_extend:DI (match_dup 1)))
416 (compare:CC (match_dup 2)
421 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
422 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
424 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
425 (sign_extend:DI (match_dup 1)))]
430 [(set_attr "type" "compare")
431 (set_attr "length" "4,8")])
434 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
435 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
437 (set (match_operand:DI 0 "gpc_reg_operand" "")
438 (sign_extend:DI (match_dup 1)))]
439 "TARGET_POWERPC64 && reload_completed"
441 (sign_extend:DI (match_dup 1)))
443 (compare:CC (match_dup 0)
447 (define_expand "extendsidi2"
448 [(set (match_operand:DI 0 "gpc_reg_operand" "")
449 (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")))]
454 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
455 (sign_extend:DI (match_operand:SI 1 "lwa_operand" "m,r")))]
456 "TARGET_POWERPC64 && rs6000_gen_cell_microcode"
460 [(set_attr "type" "load_ext,exts")])
463 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
464 (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r")))]
465 "TARGET_POWERPC64 && !rs6000_gen_cell_microcode"
467 [(set_attr "type" "exts")])
470 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
471 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
473 (clobber (match_scratch:DI 2 "=r,r"))]
478 [(set_attr "type" "compare")
479 (set_attr "length" "4,8")])
482 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
483 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
485 (clobber (match_scratch:DI 2 ""))]
486 "TARGET_POWERPC64 && reload_completed"
488 (sign_extend:DI (match_dup 1)))
490 (compare:CC (match_dup 2)
495 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
496 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
498 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
499 (sign_extend:DI (match_dup 1)))]
504 [(set_attr "type" "compare")
505 (set_attr "length" "4,8")])
508 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
509 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
511 (set (match_operand:DI 0 "gpc_reg_operand" "")
512 (sign_extend:DI (match_dup 1)))]
513 "TARGET_POWERPC64 && reload_completed"
515 (sign_extend:DI (match_dup 1)))
517 (compare:CC (match_dup 0)
521 (define_expand "zero_extendqisi2"
522 [(set (match_operand:SI 0 "gpc_reg_operand" "")
523 (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "")))]
528 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
529 (zero_extend:SI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
533 {rlinm|rlwinm} %0,%1,0,0xff"
534 [(set_attr "type" "load,*")])
537 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
538 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
540 (clobber (match_scratch:SI 2 "=r,r"))]
543 {andil.|andi.} %2,%1,0xff
545 [(set_attr "type" "fast_compare,compare")
546 (set_attr "length" "4,8")])
549 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
550 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
552 (clobber (match_scratch:SI 2 ""))]
555 (zero_extend:SI (match_dup 1)))
557 (compare:CC (match_dup 2)
562 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
563 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
565 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
566 (zero_extend:SI (match_dup 1)))]
569 {andil.|andi.} %0,%1,0xff
571 [(set_attr "type" "fast_compare,compare")
572 (set_attr "length" "4,8")])
575 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
576 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
578 (set (match_operand:SI 0 "gpc_reg_operand" "")
579 (zero_extend:SI (match_dup 1)))]
582 (zero_extend:SI (match_dup 1)))
584 (compare:CC (match_dup 0)
588 (define_expand "extendqisi2"
589 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
590 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
595 emit_insn (gen_extendqisi2_ppc (operands[0], operands[1]));
596 else if (TARGET_POWER)
597 emit_insn (gen_extendqisi2_power (operands[0], operands[1]));
599 emit_insn (gen_extendqisi2_no_power (operands[0], operands[1]));
603 (define_insn "extendqisi2_ppc"
604 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
605 (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r")))]
608 [(set_attr "type" "exts")])
611 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
612 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
614 (clobber (match_scratch:SI 2 "=r,r"))]
619 [(set_attr "type" "compare")
620 (set_attr "length" "4,8")])
623 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
624 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
626 (clobber (match_scratch:SI 2 ""))]
627 "TARGET_POWERPC && reload_completed"
629 (sign_extend:SI (match_dup 1)))
631 (compare:CC (match_dup 2)
636 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
637 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
639 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
640 (sign_extend:SI (match_dup 1)))]
645 [(set_attr "type" "compare")
646 (set_attr "length" "4,8")])
649 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
650 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
652 (set (match_operand:SI 0 "gpc_reg_operand" "")
653 (sign_extend:SI (match_dup 1)))]
654 "TARGET_POWERPC && reload_completed"
656 (sign_extend:SI (match_dup 1)))
658 (compare:CC (match_dup 0)
662 (define_expand "extendqisi2_power"
663 [(parallel [(set (match_dup 2)
664 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
666 (clobber (scratch:SI))])
667 (parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
668 (ashiftrt:SI (match_dup 2)
670 (clobber (scratch:SI))])]
673 { operands[1] = gen_lowpart (SImode, operands[1]);
674 operands[2] = gen_reg_rtx (SImode); }")
676 (define_expand "extendqisi2_no_power"
678 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
680 (set (match_operand:SI 0 "gpc_reg_operand" "")
681 (ashiftrt:SI (match_dup 2)
683 "! TARGET_POWER && ! TARGET_POWERPC"
685 { operands[1] = gen_lowpart (SImode, operands[1]);
686 operands[2] = gen_reg_rtx (SImode); }")
688 (define_expand "zero_extendqihi2"
689 [(set (match_operand:HI 0 "gpc_reg_operand" "")
690 (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "")))]
695 [(set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
696 (zero_extend:HI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
700 {rlinm|rlwinm} %0,%1,0,0xff"
701 [(set_attr "type" "load,*")])
704 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
705 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
707 (clobber (match_scratch:HI 2 "=r,r"))]
710 {andil.|andi.} %2,%1,0xff
712 [(set_attr "type" "fast_compare,compare")
713 (set_attr "length" "4,8")])
716 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
717 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
719 (clobber (match_scratch:HI 2 ""))]
722 (zero_extend:HI (match_dup 1)))
724 (compare:CC (match_dup 2)
729 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
730 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
732 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
733 (zero_extend:HI (match_dup 1)))]
736 {andil.|andi.} %0,%1,0xff
738 [(set_attr "type" "fast_compare,compare")
739 (set_attr "length" "4,8")])
742 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
743 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
745 (set (match_operand:HI 0 "gpc_reg_operand" "")
746 (zero_extend:HI (match_dup 1)))]
749 (zero_extend:HI (match_dup 1)))
751 (compare:CC (match_dup 0)
755 (define_expand "extendqihi2"
756 [(use (match_operand:HI 0 "gpc_reg_operand" ""))
757 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
762 emit_insn (gen_extendqihi2_ppc (operands[0], operands[1]));
763 else if (TARGET_POWER)
764 emit_insn (gen_extendqihi2_power (operands[0], operands[1]));
766 emit_insn (gen_extendqihi2_no_power (operands[0], operands[1]));
770 (define_insn "extendqihi2_ppc"
771 [(set (match_operand:HI 0 "gpc_reg_operand" "=r")
772 (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r")))]
775 [(set_attr "type" "exts")])
778 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
779 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
781 (clobber (match_scratch:HI 2 "=r,r"))]
786 [(set_attr "type" "compare")
787 (set_attr "length" "4,8")])
790 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
791 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
793 (clobber (match_scratch:HI 2 ""))]
794 "TARGET_POWERPC && reload_completed"
796 (sign_extend:HI (match_dup 1)))
798 (compare:CC (match_dup 2)
803 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
804 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
806 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
807 (sign_extend:HI (match_dup 1)))]
812 [(set_attr "type" "compare")
813 (set_attr "length" "4,8")])
816 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
817 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
819 (set (match_operand:HI 0 "gpc_reg_operand" "")
820 (sign_extend:HI (match_dup 1)))]
821 "TARGET_POWERPC && reload_completed"
823 (sign_extend:HI (match_dup 1)))
825 (compare:CC (match_dup 0)
829 (define_expand "extendqihi2_power"
830 [(parallel [(set (match_dup 2)
831 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
833 (clobber (scratch:SI))])
834 (parallel [(set (match_operand:HI 0 "gpc_reg_operand" "")
835 (ashiftrt:SI (match_dup 2)
837 (clobber (scratch:SI))])]
840 { operands[0] = gen_lowpart (SImode, operands[0]);
841 operands[1] = gen_lowpart (SImode, operands[1]);
842 operands[2] = gen_reg_rtx (SImode); }")
844 (define_expand "extendqihi2_no_power"
846 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
848 (set (match_operand:HI 0 "gpc_reg_operand" "")
849 (ashiftrt:SI (match_dup 2)
851 "! TARGET_POWER && ! TARGET_POWERPC"
853 { operands[0] = gen_lowpart (SImode, operands[0]);
854 operands[1] = gen_lowpart (SImode, operands[1]);
855 operands[2] = gen_reg_rtx (SImode); }")
857 (define_expand "zero_extendhisi2"
858 [(set (match_operand:SI 0 "gpc_reg_operand" "")
859 (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
864 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
865 (zero_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
869 {rlinm|rlwinm} %0,%1,0,0xffff"
870 [(set_attr "type" "load,*")])
873 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
874 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
876 (clobber (match_scratch:SI 2 "=r,r"))]
879 {andil.|andi.} %2,%1,0xffff
881 [(set_attr "type" "fast_compare,compare")
882 (set_attr "length" "4,8")])
885 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
886 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
888 (clobber (match_scratch:SI 2 ""))]
891 (zero_extend:SI (match_dup 1)))
893 (compare:CC (match_dup 2)
898 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
899 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
901 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
902 (zero_extend:SI (match_dup 1)))]
905 {andil.|andi.} %0,%1,0xffff
907 [(set_attr "type" "fast_compare,compare")
908 (set_attr "length" "4,8")])
911 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
912 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
914 (set (match_operand:SI 0 "gpc_reg_operand" "")
915 (zero_extend:SI (match_dup 1)))]
918 (zero_extend:SI (match_dup 1)))
920 (compare:CC (match_dup 0)
924 (define_expand "extendhisi2"
925 [(set (match_operand:SI 0 "gpc_reg_operand" "")
926 (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
931 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
932 (sign_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
933 "rs6000_gen_cell_microcode"
937 [(set_attr "type" "load_ext,exts")])
940 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
941 (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r")))]
942 "!rs6000_gen_cell_microcode"
944 [(set_attr "type" "exts")])
947 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
948 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
950 (clobber (match_scratch:SI 2 "=r,r"))]
955 [(set_attr "type" "compare")
956 (set_attr "length" "4,8")])
959 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
960 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
962 (clobber (match_scratch:SI 2 ""))]
965 (sign_extend:SI (match_dup 1)))
967 (compare:CC (match_dup 2)
972 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
973 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
975 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
976 (sign_extend:SI (match_dup 1)))]
981 [(set_attr "type" "compare")
982 (set_attr "length" "4,8")])
984 ;; IBM 405, 440, 464 and 476 half-word multiplication operations.
986 (define_insn "*macchwc"
987 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
988 (compare:CC (plus:SI (mult:SI (ashiftrt:SI
989 (match_operand:SI 2 "gpc_reg_operand" "r")
992 (match_operand:HI 1 "gpc_reg_operand" "r")))
993 (match_operand:SI 4 "gpc_reg_operand" "0"))
995 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
996 (plus:SI (mult:SI (ashiftrt:SI
1003 "macchw. %0, %1, %2"
1004 [(set_attr "type" "imul3")])
1006 (define_insn "*macchw"
1007 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1008 (plus:SI (mult:SI (ashiftrt:SI
1009 (match_operand:SI 2 "gpc_reg_operand" "r")
1012 (match_operand:HI 1 "gpc_reg_operand" "r")))
1013 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1016 [(set_attr "type" "imul3")])
1018 (define_insn "*macchwuc"
1019 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1020 (compare:CC (plus:SI (mult:SI (lshiftrt:SI
1021 (match_operand:SI 2 "gpc_reg_operand" "r")
1024 (match_operand:HI 1 "gpc_reg_operand" "r")))
1025 (match_operand:SI 4 "gpc_reg_operand" "0"))
1027 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1028 (plus:SI (mult:SI (lshiftrt:SI
1035 "macchwu. %0, %1, %2"
1036 [(set_attr "type" "imul3")])
1038 (define_insn "*macchwu"
1039 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1040 (plus:SI (mult:SI (lshiftrt:SI
1041 (match_operand:SI 2 "gpc_reg_operand" "r")
1044 (match_operand:HI 1 "gpc_reg_operand" "r")))
1045 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1047 "macchwu %0, %1, %2"
1048 [(set_attr "type" "imul3")])
1050 (define_insn "*machhwc"
1051 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1052 (compare:CC (plus:SI (mult:SI (ashiftrt:SI
1053 (match_operand:SI 1 "gpc_reg_operand" "%r")
1056 (match_operand:SI 2 "gpc_reg_operand" "r")
1058 (match_operand:SI 4 "gpc_reg_operand" "0"))
1060 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1061 (plus:SI (mult:SI (ashiftrt:SI
1069 "machhw. %0, %1, %2"
1070 [(set_attr "type" "imul3")])
1072 (define_insn "*machhw"
1073 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1074 (plus:SI (mult:SI (ashiftrt:SI
1075 (match_operand:SI 1 "gpc_reg_operand" "%r")
1078 (match_operand:SI 2 "gpc_reg_operand" "r")
1080 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1083 [(set_attr "type" "imul3")])
1085 (define_insn "*machhwuc"
1086 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1087 (compare:CC (plus:SI (mult:SI (lshiftrt:SI
1088 (match_operand:SI 1 "gpc_reg_operand" "%r")
1091 (match_operand:SI 2 "gpc_reg_operand" "r")
1093 (match_operand:SI 4 "gpc_reg_operand" "0"))
1095 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1096 (plus:SI (mult:SI (lshiftrt:SI
1104 "machhwu. %0, %1, %2"
1105 [(set_attr "type" "imul3")])
1107 (define_insn "*machhwu"
1108 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1109 (plus:SI (mult:SI (lshiftrt:SI
1110 (match_operand:SI 1 "gpc_reg_operand" "%r")
1113 (match_operand:SI 2 "gpc_reg_operand" "r")
1115 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1117 "machhwu %0, %1, %2"
1118 [(set_attr "type" "imul3")])
1120 (define_insn "*maclhwc"
1121 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1122 (compare:CC (plus:SI (mult:SI (sign_extend:SI
1123 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1125 (match_operand:HI 2 "gpc_reg_operand" "r")))
1126 (match_operand:SI 4 "gpc_reg_operand" "0"))
1128 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1129 (plus:SI (mult:SI (sign_extend:SI
1135 "maclhw. %0, %1, %2"
1136 [(set_attr "type" "imul3")])
1138 (define_insn "*maclhw"
1139 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1140 (plus:SI (mult:SI (sign_extend:SI
1141 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1143 (match_operand:HI 2 "gpc_reg_operand" "r")))
1144 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1147 [(set_attr "type" "imul3")])
1149 (define_insn "*maclhwuc"
1150 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1151 (compare:CC (plus:SI (mult:SI (zero_extend:SI
1152 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1154 (match_operand:HI 2 "gpc_reg_operand" "r")))
1155 (match_operand:SI 4 "gpc_reg_operand" "0"))
1157 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1158 (plus:SI (mult:SI (zero_extend:SI
1164 "maclhwu. %0, %1, %2"
1165 [(set_attr "type" "imul3")])
1167 (define_insn "*maclhwu"
1168 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1169 (plus:SI (mult:SI (zero_extend:SI
1170 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1172 (match_operand:HI 2 "gpc_reg_operand" "r")))
1173 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1175 "maclhwu %0, %1, %2"
1176 [(set_attr "type" "imul3")])
1178 (define_insn "*nmacchwc"
1179 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1180 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1181 (mult:SI (ashiftrt:SI
1182 (match_operand:SI 2 "gpc_reg_operand" "r")
1185 (match_operand:HI 1 "gpc_reg_operand" "r"))))
1187 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1188 (minus:SI (match_dup 4)
1189 (mult:SI (ashiftrt:SI
1195 "nmacchw. %0, %1, %2"
1196 [(set_attr "type" "imul3")])
1198 (define_insn "*nmacchw"
1199 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1200 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1201 (mult:SI (ashiftrt:SI
1202 (match_operand:SI 2 "gpc_reg_operand" "r")
1205 (match_operand:HI 1 "gpc_reg_operand" "r")))))]
1207 "nmacchw %0, %1, %2"
1208 [(set_attr "type" "imul3")])
1210 (define_insn "*nmachhwc"
1211 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1212 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1213 (mult:SI (ashiftrt:SI
1214 (match_operand:SI 1 "gpc_reg_operand" "%r")
1217 (match_operand:SI 2 "gpc_reg_operand" "r")
1220 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1221 (minus:SI (match_dup 4)
1222 (mult:SI (ashiftrt:SI
1229 "nmachhw. %0, %1, %2"
1230 [(set_attr "type" "imul3")])
1232 (define_insn "*nmachhw"
1233 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1234 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1235 (mult:SI (ashiftrt:SI
1236 (match_operand:SI 1 "gpc_reg_operand" "%r")
1239 (match_operand:SI 2 "gpc_reg_operand" "r")
1242 "nmachhw %0, %1, %2"
1243 [(set_attr "type" "imul3")])
1245 (define_insn "*nmaclhwc"
1246 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1247 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1248 (mult:SI (sign_extend:SI
1249 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1251 (match_operand:HI 2 "gpc_reg_operand" "r"))))
1253 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1254 (minus:SI (match_dup 4)
1255 (mult:SI (sign_extend:SI
1260 "nmaclhw. %0, %1, %2"
1261 [(set_attr "type" "imul3")])
1263 (define_insn "*nmaclhw"
1264 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1265 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1266 (mult:SI (sign_extend:SI
1267 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1269 (match_operand:HI 2 "gpc_reg_operand" "r")))))]
1271 "nmaclhw %0, %1, %2"
1272 [(set_attr "type" "imul3")])
1274 (define_insn "*mulchwc"
1275 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1276 (compare:CC (mult:SI (ashiftrt:SI
1277 (match_operand:SI 2 "gpc_reg_operand" "r")
1280 (match_operand:HI 1 "gpc_reg_operand" "r")))
1282 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1283 (mult:SI (ashiftrt:SI
1289 "mulchw. %0, %1, %2"
1290 [(set_attr "type" "imul3")])
1292 (define_insn "*mulchw"
1293 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1294 (mult:SI (ashiftrt:SI
1295 (match_operand:SI 2 "gpc_reg_operand" "r")
1298 (match_operand:HI 1 "gpc_reg_operand" "r"))))]
1301 [(set_attr "type" "imul3")])
1303 (define_insn "*mulchwuc"
1304 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1305 (compare:CC (mult:SI (lshiftrt:SI
1306 (match_operand:SI 2 "gpc_reg_operand" "r")
1309 (match_operand:HI 1 "gpc_reg_operand" "r")))
1311 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1312 (mult:SI (lshiftrt:SI
1318 "mulchwu. %0, %1, %2"
1319 [(set_attr "type" "imul3")])
1321 (define_insn "*mulchwu"
1322 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1323 (mult:SI (lshiftrt:SI
1324 (match_operand:SI 2 "gpc_reg_operand" "r")
1327 (match_operand:HI 1 "gpc_reg_operand" "r"))))]
1329 "mulchwu %0, %1, %2"
1330 [(set_attr "type" "imul3")])
1332 (define_insn "*mulhhwc"
1333 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1334 (compare:CC (mult:SI (ashiftrt:SI
1335 (match_operand:SI 1 "gpc_reg_operand" "%r")
1338 (match_operand:SI 2 "gpc_reg_operand" "r")
1341 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1342 (mult:SI (ashiftrt:SI
1349 "mulhhw. %0, %1, %2"
1350 [(set_attr "type" "imul3")])
1352 (define_insn "*mulhhw"
1353 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1354 (mult:SI (ashiftrt:SI
1355 (match_operand:SI 1 "gpc_reg_operand" "%r")
1358 (match_operand:SI 2 "gpc_reg_operand" "r")
1362 [(set_attr "type" "imul3")])
1364 (define_insn "*mulhhwuc"
1365 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1366 (compare:CC (mult:SI (lshiftrt:SI
1367 (match_operand:SI 1 "gpc_reg_operand" "%r")
1370 (match_operand:SI 2 "gpc_reg_operand" "r")
1373 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1374 (mult:SI (lshiftrt:SI
1381 "mulhhwu. %0, %1, %2"
1382 [(set_attr "type" "imul3")])
1384 (define_insn "*mulhhwu"
1385 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1386 (mult:SI (lshiftrt:SI
1387 (match_operand:SI 1 "gpc_reg_operand" "%r")
1390 (match_operand:SI 2 "gpc_reg_operand" "r")
1393 "mulhhwu %0, %1, %2"
1394 [(set_attr "type" "imul3")])
1396 (define_insn "*mullhwc"
1397 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1398 (compare:CC (mult:SI (sign_extend:SI
1399 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1401 (match_operand:HI 2 "gpc_reg_operand" "r")))
1403 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1404 (mult:SI (sign_extend:SI
1409 "mullhw. %0, %1, %2"
1410 [(set_attr "type" "imul3")])
1412 (define_insn "*mullhw"
1413 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1414 (mult:SI (sign_extend:SI
1415 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1417 (match_operand:HI 2 "gpc_reg_operand" "r"))))]
1420 [(set_attr "type" "imul3")])
1422 (define_insn "*mullhwuc"
1423 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1424 (compare:CC (mult:SI (zero_extend:SI
1425 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1427 (match_operand:HI 2 "gpc_reg_operand" "r")))
1429 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1430 (mult:SI (zero_extend:SI
1435 "mullhwu. %0, %1, %2"
1436 [(set_attr "type" "imul3")])
1438 (define_insn "*mullhwu"
1439 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1440 (mult:SI (zero_extend:SI
1441 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1443 (match_operand:HI 2 "gpc_reg_operand" "r"))))]
1445 "mullhwu %0, %1, %2"
1446 [(set_attr "type" "imul3")])
1448 ;; IBM 405, 440, 464 and 476 string-search dlmzb instruction support.
1449 (define_insn "dlmzb"
1450 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1451 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
1452 (match_operand:SI 2 "gpc_reg_operand" "r")]
1454 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1455 (unspec:SI [(match_dup 1)
1459 "dlmzb. %0, %1, %2")
1461 (define_expand "strlensi"
1462 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1463 (unspec:SI [(match_operand:BLK 1 "general_operand" "")
1464 (match_operand:QI 2 "const_int_operand" "")
1465 (match_operand 3 "const_int_operand" "")]
1466 UNSPEC_DLMZB_STRLEN))
1467 (clobber (match_scratch:CC 4 "=x"))]
1468 "TARGET_DLMZB && WORDS_BIG_ENDIAN && !optimize_size"
1470 rtx result = operands[0];
1471 rtx src = operands[1];
1472 rtx search_char = operands[2];
1473 rtx align = operands[3];
1474 rtx addr, scratch_string, word1, word2, scratch_dlmzb;
1475 rtx loop_label, end_label, mem, cr0, cond;
1476 if (search_char != const0_rtx
1477 || GET_CODE (align) != CONST_INT
1478 || INTVAL (align) < 8)
1480 word1 = gen_reg_rtx (SImode);
1481 word2 = gen_reg_rtx (SImode);
1482 scratch_dlmzb = gen_reg_rtx (SImode);
1483 scratch_string = gen_reg_rtx (Pmode);
1484 loop_label = gen_label_rtx ();
1485 end_label = gen_label_rtx ();
1486 addr = force_reg (Pmode, XEXP (src, 0));
1487 emit_move_insn (scratch_string, addr);
1488 emit_label (loop_label);
1489 mem = change_address (src, SImode, scratch_string);
1490 emit_move_insn (word1, mem);
1491 emit_move_insn (word2, adjust_address (mem, SImode, 4));
1492 cr0 = gen_rtx_REG (CCmode, CR0_REGNO);
1493 emit_insn (gen_dlmzb (scratch_dlmzb, word1, word2, cr0));
1494 cond = gen_rtx_NE (VOIDmode, cr0, const0_rtx);
1495 emit_jump_insn (gen_rtx_SET (VOIDmode,
1497 gen_rtx_IF_THEN_ELSE (VOIDmode,
1503 emit_insn (gen_addsi3 (scratch_string, scratch_string, GEN_INT (8)));
1504 emit_jump_insn (gen_rtx_SET (VOIDmode,
1506 gen_rtx_LABEL_REF (VOIDmode, loop_label)));
1508 emit_label (end_label);
1509 emit_insn (gen_addsi3 (scratch_string, scratch_string, scratch_dlmzb));
1510 emit_insn (gen_subsi3 (result, scratch_string, addr));
1511 emit_insn (gen_subsi3 (result, result, const1_rtx));
1516 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
1517 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1519 (set (match_operand:SI 0 "gpc_reg_operand" "")
1520 (sign_extend:SI (match_dup 1)))]
1523 (sign_extend:SI (match_dup 1)))
1525 (compare:CC (match_dup 0)
1529 ;; Fixed-point arithmetic insns.
1531 (define_expand "add<mode>3"
1532 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1533 (plus:SDI (match_operand:SDI 1 "gpc_reg_operand" "")
1534 (match_operand:SDI 2 "reg_or_add_cint_operand" "")))]
1537 if (<MODE>mode == DImode && ! TARGET_POWERPC64)
1539 if (non_short_cint_operand (operands[2], DImode))
1542 else if (GET_CODE (operands[2]) == CONST_INT
1543 && ! add_operand (operands[2], <MODE>mode))
1545 rtx tmp = ((!can_create_pseudo_p ()
1546 || rtx_equal_p (operands[0], operands[1]))
1547 ? operands[0] : gen_reg_rtx (<MODE>mode));
1549 HOST_WIDE_INT val = INTVAL (operands[2]);
1550 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1551 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, <MODE>mode);
1553 if (<MODE>mode == DImode && !satisfies_constraint_L (GEN_INT (rest)))
1556 /* The ordering here is important for the prolog expander.
1557 When space is allocated from the stack, adding 'low' first may
1558 produce a temporary deallocation (which would be bad). */
1559 emit_insn (gen_add<mode>3 (tmp, operands[1], GEN_INT (rest)));
1560 emit_insn (gen_add<mode>3 (operands[0], tmp, GEN_INT (low)));
1565 ;; Discourage ai/addic because of carry but provide it in an alternative
1566 ;; allowing register zero as source.
1567 (define_insn "*add<mode>3_internal1"
1568 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r,?r,r")
1569 (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "%r,b,r,b")
1570 (match_operand:GPR 2 "add_operand" "r,I,I,L")))]
1571 "!DECIMAL_FLOAT_MODE_P (GET_MODE (operands[0])) && !DECIMAL_FLOAT_MODE_P (GET_MODE (operands[1]))"
1574 {cal %0,%2(%1)|addi %0,%1,%2}
1576 {cau|addis} %0,%1,%v2"
1577 [(set_attr "length" "4,4,4,4")])
1579 (define_insn "addsi3_high"
1580 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
1581 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
1582 (high:SI (match_operand 2 "" ""))))]
1583 "TARGET_MACHO && !TARGET_64BIT"
1584 "{cau|addis} %0,%1,ha16(%2)"
1585 [(set_attr "length" "4")])
1587 (define_insn "*add<mode>3_internal2"
1588 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
1589 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "%r,r,r,r")
1590 (match_operand:P 2 "reg_or_short_operand" "r,I,r,I"))
1592 (clobber (match_scratch:P 3 "=r,r,r,r"))]
1595 {cax.|add.} %3,%1,%2
1596 {ai.|addic.} %3,%1,%2
1599 [(set_attr "type" "fast_compare,compare,compare,compare")
1600 (set_attr "length" "4,4,8,8")])
1603 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1604 (compare:CC (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1605 (match_operand:GPR 2 "reg_or_short_operand" ""))
1607 (clobber (match_scratch:GPR 3 ""))]
1610 (plus:GPR (match_dup 1)
1613 (compare:CC (match_dup 3)
1617 (define_insn "*add<mode>3_internal3"
1618 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
1619 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "%r,r,r,r")
1620 (match_operand:P 2 "reg_or_short_operand" "r,I,r,I"))
1622 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
1623 (plus:P (match_dup 1)
1627 {cax.|add.} %0,%1,%2
1628 {ai.|addic.} %0,%1,%2
1631 [(set_attr "type" "fast_compare,compare,compare,compare")
1632 (set_attr "length" "4,4,8,8")])
1635 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1636 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "")
1637 (match_operand:P 2 "reg_or_short_operand" ""))
1639 (set (match_operand:P 0 "gpc_reg_operand" "")
1640 (plus:P (match_dup 1) (match_dup 2)))]
1643 (plus:P (match_dup 1)
1646 (compare:CC (match_dup 0)
1650 ;; Split an add that we can't do in one insn into two insns, each of which
1651 ;; does one 16-bit part. This is used by combine. Note that the low-order
1652 ;; add should be last in case the result gets used in an address.
1655 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
1656 (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1657 (match_operand:GPR 2 "non_add_cint_operand" "")))]
1659 [(set (match_dup 0) (plus:GPR (match_dup 1) (match_dup 3)))
1660 (set (match_dup 0) (plus:GPR (match_dup 0) (match_dup 4)))]
1662 HOST_WIDE_INT val = INTVAL (operands[2]);
1663 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1664 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, <MODE>mode);
1666 operands[4] = GEN_INT (low);
1667 if (<MODE>mode == SImode || satisfies_constraint_L (GEN_INT (rest)))
1668 operands[3] = GEN_INT (rest);
1669 else if (can_create_pseudo_p ())
1671 operands[3] = gen_reg_rtx (DImode);
1672 emit_move_insn (operands[3], operands[2]);
1673 emit_insn (gen_adddi3 (operands[0], operands[1], operands[3]));
1680 (define_insn "one_cmpl<mode>2"
1681 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1682 (not:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
1687 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1688 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1690 (clobber (match_scratch:P 2 "=r,r"))]
1695 [(set_attr "type" "fast_compare,compare")
1696 (set_attr "length" "4,8")])
1699 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
1700 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" ""))
1702 (clobber (match_scratch:P 2 ""))]
1705 (not:P (match_dup 1)))
1707 (compare:CC (match_dup 2)
1712 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1713 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1715 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
1716 (not:P (match_dup 1)))]
1721 [(set_attr "type" "fast_compare,compare")
1722 (set_attr "length" "4,8")])
1725 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
1726 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" ""))
1728 (set (match_operand:P 0 "gpc_reg_operand" "")
1729 (not:P (match_dup 1)))]
1732 (not:P (match_dup 1)))
1734 (compare:CC (match_dup 0)
1739 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1740 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "rI")
1741 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1743 "{sf%I1|subf%I1c} %0,%2,%1")
1746 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
1747 (minus:GPR (match_operand:GPR 1 "reg_or_short_operand" "r,I")
1748 (match_operand:GPR 2 "gpc_reg_operand" "r,r")))]
1755 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1756 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1757 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1759 (clobber (match_scratch:SI 3 "=r,r"))]
1762 {sf.|subfc.} %3,%2,%1
1764 [(set_attr "type" "compare")
1765 (set_attr "length" "4,8")])
1768 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1769 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "r,r")
1770 (match_operand:P 2 "gpc_reg_operand" "r,r"))
1772 (clobber (match_scratch:P 3 "=r,r"))]
1777 [(set_attr "type" "fast_compare")
1778 (set_attr "length" "4,8")])
1781 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1782 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "")
1783 (match_operand:P 2 "gpc_reg_operand" ""))
1785 (clobber (match_scratch:P 3 ""))]
1788 (minus:P (match_dup 1)
1791 (compare:CC (match_dup 3)
1796 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1797 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1798 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1800 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1801 (minus:SI (match_dup 1) (match_dup 2)))]
1804 {sf.|subfc.} %0,%2,%1
1806 [(set_attr "type" "compare")
1807 (set_attr "length" "4,8")])
1810 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1811 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "r,r")
1812 (match_operand:P 2 "gpc_reg_operand" "r,r"))
1814 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
1815 (minus:P (match_dup 1)
1821 [(set_attr "type" "fast_compare")
1822 (set_attr "length" "4,8")])
1825 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1826 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "")
1827 (match_operand:P 2 "gpc_reg_operand" ""))
1829 (set (match_operand:P 0 "gpc_reg_operand" "")
1830 (minus:P (match_dup 1)
1834 (minus:P (match_dup 1)
1837 (compare:CC (match_dup 0)
1841 (define_expand "sub<mode>3"
1842 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1843 (minus:SDI (match_operand:SDI 1 "reg_or_short_operand" "")
1844 (match_operand:SDI 2 "reg_or_sub_cint_operand" "")))]
1848 if (GET_CODE (operands[2]) == CONST_INT)
1850 emit_insn (gen_add<mode>3 (operands[0], operands[1],
1851 negate_rtx (<MODE>mode, operands[2])));
1856 ;; For SMIN, SMAX, UMIN, and UMAX, we use DEFINE_EXPAND's that involve a doz[i]
1857 ;; instruction and some auxiliary computations. Then we just have a single
1858 ;; DEFINE_INSN for doz[i] and the define_splits to make them if made by
1861 (define_expand "sminsi3"
1863 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1864 (match_operand:SI 2 "reg_or_short_operand" ""))
1866 (minus:SI (match_dup 2) (match_dup 1))))
1867 (set (match_operand:SI 0 "gpc_reg_operand" "")
1868 (minus:SI (match_dup 2) (match_dup 3)))]
1869 "TARGET_POWER || TARGET_ISEL"
1874 operands[2] = force_reg (SImode, operands[2]);
1875 rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]);
1879 operands[3] = gen_reg_rtx (SImode);
1883 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1884 (smin:SI (match_operand:SI 1 "gpc_reg_operand" "")
1885 (match_operand:SI 2 "reg_or_short_operand" "")))
1886 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1889 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1891 (minus:SI (match_dup 2) (match_dup 1))))
1892 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 3)))]
1895 (define_expand "smaxsi3"
1897 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1898 (match_operand:SI 2 "reg_or_short_operand" ""))
1900 (minus:SI (match_dup 2) (match_dup 1))))
1901 (set (match_operand:SI 0 "gpc_reg_operand" "")
1902 (plus:SI (match_dup 3) (match_dup 1)))]
1903 "TARGET_POWER || TARGET_ISEL"
1908 operands[2] = force_reg (SImode, operands[2]);
1909 rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]);
1912 operands[3] = gen_reg_rtx (SImode);
1916 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1917 (smax:SI (match_operand:SI 1 "gpc_reg_operand" "")
1918 (match_operand:SI 2 "reg_or_short_operand" "")))
1919 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1922 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1924 (minus:SI (match_dup 2) (match_dup 1))))
1925 (set (match_dup 0) (plus:SI (match_dup 3) (match_dup 1)))]
1928 (define_expand "uminsi3"
1929 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1931 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
1933 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
1935 (minus:SI (match_dup 4) (match_dup 3))))
1936 (set (match_operand:SI 0 "gpc_reg_operand" "")
1937 (minus:SI (match_dup 2) (match_dup 3)))]
1938 "TARGET_POWER || TARGET_ISEL"
1943 rs6000_emit_minmax (operands[0], UMIN, operands[1], operands[2]);
1946 operands[3] = gen_reg_rtx (SImode);
1947 operands[4] = gen_reg_rtx (SImode);
1948 operands[5] = GEN_INT (-2147483647 - 1);
1951 (define_expand "umaxsi3"
1952 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1954 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
1956 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
1958 (minus:SI (match_dup 4) (match_dup 3))))
1959 (set (match_operand:SI 0 "gpc_reg_operand" "")
1960 (plus:SI (match_dup 3) (match_dup 1)))]
1961 "TARGET_POWER || TARGET_ISEL"
1966 rs6000_emit_minmax (operands[0], UMAX, operands[1], operands[2]);
1969 operands[3] = gen_reg_rtx (SImode);
1970 operands[4] = gen_reg_rtx (SImode);
1971 operands[5] = GEN_INT (-2147483647 - 1);
1975 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1976 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r")
1977 (match_operand:SI 2 "reg_or_short_operand" "rI"))
1979 (minus:SI (match_dup 2) (match_dup 1))))]
1984 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1986 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
1987 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
1989 (minus:SI (match_dup 2) (match_dup 1)))
1991 (clobber (match_scratch:SI 3 "=r,r"))]
1996 [(set_attr "type" "delayed_compare")
1997 (set_attr "length" "4,8")])
2000 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2002 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "")
2003 (match_operand:SI 2 "reg_or_short_operand" ""))
2005 (minus:SI (match_dup 2) (match_dup 1)))
2007 (clobber (match_scratch:SI 3 ""))]
2008 "TARGET_POWER && reload_completed"
2010 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
2012 (minus:SI (match_dup 2) (match_dup 1))))
2014 (compare:CC (match_dup 3)
2019 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2021 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
2022 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
2024 (minus:SI (match_dup 2) (match_dup 1)))
2026 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2027 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
2029 (minus:SI (match_dup 2) (match_dup 1))))]
2034 [(set_attr "type" "delayed_compare")
2035 (set_attr "length" "4,8")])
2038 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2040 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "")
2041 (match_operand:SI 2 "reg_or_short_operand" ""))
2043 (minus:SI (match_dup 2) (match_dup 1)))
2045 (set (match_operand:SI 0 "gpc_reg_operand" "")
2046 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
2048 (minus:SI (match_dup 2) (match_dup 1))))]
2049 "TARGET_POWER && reload_completed"
2051 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
2053 (minus:SI (match_dup 2) (match_dup 1))))
2055 (compare:CC (match_dup 0)
2059 ;; We don't need abs with condition code because such comparisons should
2061 (define_expand "abssi2"
2062 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2063 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))]
2069 emit_insn (gen_abssi2_isel (operands[0], operands[1]));
2072 else if (! TARGET_POWER)
2074 emit_insn (gen_abssi2_nopower (operands[0], operands[1]));
2079 (define_insn "*abssi2_power"
2080 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2081 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
2085 (define_insn_and_split "abs<mode>2_isel"
2086 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2087 (abs:GPR (match_operand:GPR 1 "gpc_reg_operand" "b")))
2088 (clobber (match_scratch:GPR 2 "=&b"))
2089 (clobber (match_scratch:CC 3 "=y"))]
2092 "&& reload_completed"
2093 [(set (match_dup 2) (neg:GPR (match_dup 1)))
2095 (compare:CC (match_dup 1)
2098 (if_then_else:GPR (ge (match_dup 3)
2104 (define_insn_and_split "nabs<mode>2_isel"
2105 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2106 (neg:GPR (abs:GPR (match_operand:GPR 1 "gpc_reg_operand" "b"))))
2107 (clobber (match_scratch:GPR 2 "=&b"))
2108 (clobber (match_scratch:CC 3 "=y"))]
2111 "&& reload_completed"
2112 [(set (match_dup 2) (neg:GPR (match_dup 1)))
2114 (compare:CC (match_dup 1)
2117 (if_then_else:GPR (ge (match_dup 3)
2123 (define_insn_and_split "abssi2_nopower"
2124 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
2125 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0")))
2126 (clobber (match_scratch:SI 2 "=&r,&r"))]
2127 "! TARGET_POWER && ! TARGET_ISEL"
2129 "&& reload_completed"
2130 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
2131 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
2132 (set (match_dup 0) (minus:SI (match_dup 0) (match_dup 2)))]
2135 (define_insn "*nabs_power"
2136 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2137 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r"))))]
2141 (define_insn_and_split "*nabs_nopower"
2142 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
2143 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0"))))
2144 (clobber (match_scratch:SI 2 "=&r,&r"))]
2147 "&& reload_completed"
2148 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
2149 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
2150 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 0)))]
2153 (define_expand "neg<mode>2"
2154 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
2155 (neg:SDI (match_operand:SDI 1 "gpc_reg_operand" "")))]
2159 (define_insn "*neg<mode>2_internal"
2160 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2161 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
2166 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2167 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
2169 (clobber (match_scratch:P 2 "=r,r"))]
2174 [(set_attr "type" "fast_compare")
2175 (set_attr "length" "4,8")])
2178 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2179 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" ""))
2181 (clobber (match_scratch:P 2 ""))]
2184 (neg:P (match_dup 1)))
2186 (compare:CC (match_dup 2)
2191 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
2192 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
2194 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
2195 (neg:P (match_dup 1)))]
2200 [(set_attr "type" "fast_compare")
2201 (set_attr "length" "4,8")])
2204 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
2205 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" ""))
2207 (set (match_operand:P 0 "gpc_reg_operand" "")
2208 (neg:P (match_dup 1)))]
2211 (neg:P (match_dup 1)))
2213 (compare:CC (match_dup 0)
2217 (define_insn "clz<mode>2"
2218 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2219 (clz:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
2221 "{cntlz|cntlz<wd>} %0,%1"
2222 [(set_attr "type" "cntlz")])
2224 (define_expand "ctz<mode>2"
2226 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))
2227 (parallel [(set (match_dup 3) (and:GPR (match_dup 1)
2229 (clobber (scratch:CC))])
2230 (set (match_dup 4) (clz:GPR (match_dup 3)))
2231 (set (match_operand:GPR 0 "gpc_reg_operand" "")
2232 (minus:GPR (match_dup 5) (match_dup 4)))]
2235 operands[2] = gen_reg_rtx (<MODE>mode);
2236 operands[3] = gen_reg_rtx (<MODE>mode);
2237 operands[4] = gen_reg_rtx (<MODE>mode);
2238 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode) - 1);
2241 (define_expand "ffs<mode>2"
2243 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))
2244 (parallel [(set (match_dup 3) (and:GPR (match_dup 1)
2246 (clobber (scratch:CC))])
2247 (set (match_dup 4) (clz:GPR (match_dup 3)))
2248 (set (match_operand:GPR 0 "gpc_reg_operand" "")
2249 (minus:GPR (match_dup 5) (match_dup 4)))]
2252 operands[2] = gen_reg_rtx (<MODE>mode);
2253 operands[3] = gen_reg_rtx (<MODE>mode);
2254 operands[4] = gen_reg_rtx (<MODE>mode);
2255 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode));
2258 (define_insn "popcntb<mode>2"
2259 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2260 (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")]
2265 (define_insn "popcntwsi2"
2266 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2267 (popcount:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
2271 (define_insn "popcntddi2"
2272 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
2273 (popcount:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
2274 "TARGET_POPCNTD && TARGET_POWERPC64"
2277 (define_expand "popcount<mode>2"
2278 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2279 (popcount:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))]
2280 "TARGET_POPCNTB || TARGET_POPCNTD"
2282 rs6000_emit_popcount (operands[0], operands[1]);
2286 (define_expand "parity<mode>2"
2287 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2288 (parity:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))]
2291 rs6000_emit_parity (operands[0], operands[1]);
2295 ;; Since the hardware zeros the upper part of the register, save generating the
2296 ;; AND immediate if we are converting to unsigned
2297 (define_insn "*bswaphi2_extenddi"
2298 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
2300 (bswap:HI (match_operand:HI 1 "memory_operand" "Z"))))]
2303 [(set_attr "length" "4")
2304 (set_attr "type" "load")])
2306 (define_insn "*bswaphi2_extendsi"
2307 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2309 (bswap:HI (match_operand:HI 1 "memory_operand" "Z"))))]
2312 [(set_attr "length" "4")
2313 (set_attr "type" "load")])
2315 (define_expand "bswaphi2"
2316 [(parallel [(set (match_operand:HI 0 "reg_or_mem_operand" "")
2318 (match_operand:HI 1 "reg_or_mem_operand" "")))
2319 (clobber (match_scratch:SI 2 ""))])]
2322 if (!REG_P (operands[0]) && !REG_P (operands[1]))
2323 operands[1] = force_reg (HImode, operands[1]);
2326 (define_insn "bswaphi2_internal"
2327 [(set (match_operand:HI 0 "reg_or_mem_operand" "=r,Z,&r")
2329 (match_operand:HI 1 "reg_or_mem_operand" "Z,r,r")))
2330 (clobber (match_scratch:SI 2 "=X,X,&r"))]
2336 [(set_attr "length" "4,4,12")
2337 (set_attr "type" "load,store,*")])
2340 [(set (match_operand:HI 0 "gpc_reg_operand" "")
2341 (bswap:HI (match_operand:HI 1 "gpc_reg_operand" "")))
2342 (clobber (match_operand:SI 2 "gpc_reg_operand" ""))]
2343 "TARGET_POWERPC && reload_completed"
2345 (zero_extract:SI (match_dup 4)
2349 (and:SI (ashift:SI (match_dup 4)
2351 (const_int 65280))) ;; 0xff00
2353 (ior:SI (match_dup 3)
2357 operands[3] = simplify_gen_subreg (SImode, operands[0], HImode, 0);
2358 operands[4] = simplify_gen_subreg (SImode, operands[1], HImode, 0);
2361 (define_insn "*bswapsi2_extenddi"
2362 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
2364 (bswap:SI (match_operand:SI 1 "memory_operand" "Z"))))]
2367 [(set_attr "length" "4")
2368 (set_attr "type" "load")])
2370 (define_expand "bswapsi2"
2371 [(set (match_operand:SI 0 "reg_or_mem_operand" "")
2373 (match_operand:SI 1 "reg_or_mem_operand" "")))]
2376 if (!REG_P (operands[0]) && !REG_P (operands[1]))
2377 operands[1] = force_reg (SImode, operands[1]);
2380 (define_insn "*bswapsi2_internal"
2381 [(set (match_operand:SI 0 "reg_or_mem_operand" "=r,Z,&r")
2383 (match_operand:SI 1 "reg_or_mem_operand" "Z,r,r")))]
2387 {stbrx|stwbrx} %1,%y0
2389 [(set_attr "length" "4,4,12")
2390 (set_attr "type" "load,store,*")])
2393 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2394 (bswap:SI (match_operand:SI 1 "gpc_reg_operand" "")))]
2397 (rotate:SI (match_dup 1) (const_int 8)))
2398 (set (zero_extract:SI (match_dup 0)
2402 (set (zero_extract:SI (match_dup 0)
2405 (rotate:SI (match_dup 1)
2409 (define_expand "bswapdi2"
2410 [(parallel [(set (match_operand:DI 0 "reg_or_mem_operand" "")
2412 (match_operand:DI 1 "reg_or_mem_operand" "")))
2413 (clobber (match_scratch:DI 2 ""))
2414 (clobber (match_scratch:DI 3 ""))
2415 (clobber (match_scratch:DI 4 ""))])]
2418 if (!REG_P (operands[0]) && !REG_P (operands[1]))
2419 operands[1] = force_reg (DImode, operands[1]);
2421 if (!TARGET_POWERPC64)
2423 /* 32-bit mode needs fewer scratch registers, but 32-bit addressing mode
2424 that uses 64-bit registers needs the same scratch registers as 64-bit
2426 emit_insn (gen_bswapdi2_32bit (operands[0], operands[1]));
2431 ;; Power7/cell has ldbrx/stdbrx, so use it directly
2432 (define_insn "*bswapdi2_ldbrx"
2433 [(set (match_operand:DI 0 "reg_or_mem_operand" "=&r,Z,??&r")
2434 (bswap:DI (match_operand:DI 1 "reg_or_mem_operand" "Z,r,r")))
2435 (clobber (match_scratch:DI 2 "=X,X,&r"))
2436 (clobber (match_scratch:DI 3 "=X,X,&r"))
2437 (clobber (match_scratch:DI 4 "=X,X,&r"))]
2438 "TARGET_POWERPC64 && TARGET_LDBRX
2439 && (REG_P (operands[0]) || REG_P (operands[1]))"
2444 [(set_attr "length" "4,4,36")
2445 (set_attr "type" "load,store,*")])
2447 ;; Non-power7/cell, fall back to use lwbrx/stwbrx
2448 (define_insn "*bswapdi2_64bit"
2449 [(set (match_operand:DI 0 "reg_or_mem_operand" "=&r,Z,??&r")
2450 (bswap:DI (match_operand:DI 1 "reg_or_mem_operand" "Z,r,r")))
2451 (clobber (match_scratch:DI 2 "=&b,&b,&r"))
2452 (clobber (match_scratch:DI 3 "=&r,&r,&r"))
2453 (clobber (match_scratch:DI 4 "=&r,X,&r"))]
2454 "TARGET_POWERPC64 && !TARGET_LDBRX
2455 && (REG_P (operands[0]) || REG_P (operands[1]))"
2457 [(set_attr "length" "16,12,36")])
2460 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2461 (bswap:DI (match_operand:DI 1 "indexed_or_indirect_operand" "")))
2462 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
2463 (clobber (match_operand:DI 3 "gpc_reg_operand" ""))
2464 (clobber (match_operand:DI 4 "gpc_reg_operand" ""))]
2465 "TARGET_POWERPC64 && !TARGET_LDBRX && reload_completed"
2469 rtx dest = operands[0];
2470 rtx src = operands[1];
2471 rtx op2 = operands[2];
2472 rtx op3 = operands[3];
2473 rtx op4 = operands[4];
2474 rtx op3_32 = simplify_gen_subreg (SImode, op3, DImode, 4);
2475 rtx op4_32 = simplify_gen_subreg (SImode, op4, DImode, 4);
2481 addr1 = XEXP (src, 0);
2482 if (GET_CODE (addr1) == PLUS)
2484 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2485 addr2 = gen_rtx_PLUS (Pmode, op2, XEXP (addr1, 1));
2489 emit_move_insn (op2, GEN_INT (4));
2490 addr2 = gen_rtx_PLUS (Pmode, op2, addr1);
2493 if (BYTES_BIG_ENDIAN)
2495 word_high = change_address (src, SImode, addr1);
2496 word_low = change_address (src, SImode, addr2);
2500 word_high = change_address (src, SImode, addr2);
2501 word_low = change_address (src, SImode, addr1);
2504 emit_insn (gen_bswapsi2 (op3_32, word_low));
2505 emit_insn (gen_bswapsi2 (op4_32, word_high));
2506 emit_insn (gen_ashldi3 (dest, op3, GEN_INT (32)));
2507 emit_insn (gen_iordi3 (dest, dest, op4));
2511 [(set (match_operand:DI 0 "indexed_or_indirect_operand" "")
2512 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2513 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
2514 (clobber (match_operand:DI 3 "gpc_reg_operand" ""))
2515 (clobber (match_operand:DI 4 "" ""))]
2516 "TARGET_POWERPC64 && !TARGET_LDBRX && reload_completed"
2520 rtx dest = operands[0];
2521 rtx src = operands[1];
2522 rtx op2 = operands[2];
2523 rtx op3 = operands[3];
2524 rtx src_si = simplify_gen_subreg (SImode, src, DImode, 4);
2525 rtx op3_si = simplify_gen_subreg (SImode, op3, DImode, 4);
2531 addr1 = XEXP (dest, 0);
2532 if (GET_CODE (addr1) == PLUS)
2534 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2535 addr2 = gen_rtx_PLUS (Pmode, op2, XEXP (addr1, 1));
2539 emit_move_insn (op2, GEN_INT (4));
2540 addr2 = gen_rtx_PLUS (Pmode, op2, addr1);
2543 emit_insn (gen_lshrdi3 (op3, src, GEN_INT (32)));
2544 if (BYTES_BIG_ENDIAN)
2546 word_high = change_address (dest, SImode, addr1);
2547 word_low = change_address (dest, SImode, addr2);
2548 emit_insn (gen_bswapsi2 (word_high, src_si));
2549 emit_insn (gen_bswapsi2 (word_low, op3_si));
2553 word_high = change_address (dest, SImode, addr2);
2554 word_low = change_address (dest, SImode, addr1);
2555 emit_insn (gen_bswapsi2 (word_low, src_si));
2556 emit_insn (gen_bswapsi2 (word_high, op3_si));
2561 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2562 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2563 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
2564 (clobber (match_operand:DI 3 "gpc_reg_operand" ""))
2565 (clobber (match_operand:DI 4 "" ""))]
2566 "TARGET_POWERPC64 && reload_completed"
2570 rtx dest = operands[0];
2571 rtx src = operands[1];
2572 rtx op2 = operands[2];
2573 rtx op3 = operands[3];
2574 rtx dest_si = simplify_gen_subreg (SImode, dest, DImode, 4);
2575 rtx src_si = simplify_gen_subreg (SImode, src, DImode, 4);
2576 rtx op2_si = simplify_gen_subreg (SImode, op2, DImode, 4);
2577 rtx op3_si = simplify_gen_subreg (SImode, op3, DImode, 4);
2579 emit_insn (gen_lshrdi3 (op2, src, GEN_INT (32)));
2580 emit_insn (gen_bswapsi2 (dest_si, src_si));
2581 emit_insn (gen_bswapsi2 (op3_si, op2_si));
2582 emit_insn (gen_ashldi3 (dest, dest, GEN_INT (32)));
2583 emit_insn (gen_iordi3 (dest, dest, op3));
2586 (define_insn "bswapdi2_32bit"
2587 [(set (match_operand:DI 0 "reg_or_mem_operand" "=&r,Z,??&r")
2588 (bswap:DI (match_operand:DI 1 "reg_or_mem_operand" "Z,r,r")))
2589 (clobber (match_scratch:SI 2 "=&b,&b,X"))]
2590 "!TARGET_POWERPC64 && (REG_P (operands[0]) || REG_P (operands[1]))"
2592 [(set_attr "length" "16,12,36")])
2595 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2596 (bswap:DI (match_operand:DI 1 "indexed_or_indirect_operand" "")))
2597 (clobber (match_operand:SI 2 "gpc_reg_operand" ""))]
2598 "!TARGET_POWERPC64 && reload_completed"
2602 rtx dest = operands[0];
2603 rtx src = operands[1];
2604 rtx op2 = operands[2];
2605 rtx dest_hi = simplify_gen_subreg (SImode, dest, DImode, 0);
2606 rtx dest_lo = simplify_gen_subreg (SImode, dest, DImode, 4);
2612 addr1 = XEXP (src, 0);
2613 if (GET_CODE (addr1) == PLUS)
2615 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2616 addr2 = gen_rtx_PLUS (SImode, op2, XEXP (addr1, 1));
2620 emit_move_insn (op2, GEN_INT (4));
2621 addr2 = gen_rtx_PLUS (SImode, op2, addr1);
2624 if (BYTES_BIG_ENDIAN)
2626 word_high = change_address (src, SImode, addr1);
2627 word_low = change_address (src, SImode, addr2);
2631 word_high = change_address (src, SImode, addr2);
2632 word_low = change_address (src, SImode, addr1);
2635 emit_insn (gen_bswapsi2 (dest_hi, word_low));
2636 emit_insn (gen_bswapsi2 (dest_lo, word_high));
2640 [(set (match_operand:DI 0 "indexed_or_indirect_operand" "")
2641 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2642 (clobber (match_operand:SI 2 "gpc_reg_operand" ""))]
2643 "!TARGET_POWERPC64 && reload_completed"
2647 rtx dest = operands[0];
2648 rtx src = operands[1];
2649 rtx op2 = operands[2];
2650 rtx src_high = simplify_gen_subreg (SImode, src, DImode, 0);
2651 rtx src_low = simplify_gen_subreg (SImode, src, DImode, 4);
2657 addr1 = XEXP (dest, 0);
2658 if (GET_CODE (addr1) == PLUS)
2660 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2661 addr2 = gen_rtx_PLUS (SImode, op2, XEXP (addr1, 1));
2665 emit_move_insn (op2, GEN_INT (4));
2666 addr2 = gen_rtx_PLUS (SImode, op2, addr1);
2669 if (BYTES_BIG_ENDIAN)
2671 word_high = change_address (dest, SImode, addr1);
2672 word_low = change_address (dest, SImode, addr2);
2676 word_high = change_address (dest, SImode, addr2);
2677 word_low = change_address (dest, SImode, addr1);
2680 emit_insn (gen_bswapsi2 (word_high, src_low));
2681 emit_insn (gen_bswapsi2 (word_low, src_high));
2685 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2686 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2687 (clobber (match_operand:SI 2 "" ""))]
2688 "!TARGET_POWERPC64 && reload_completed"
2692 rtx dest = operands[0];
2693 rtx src = operands[1];
2694 rtx src_high = simplify_gen_subreg (SImode, src, DImode, 0);
2695 rtx src_low = simplify_gen_subreg (SImode, src, DImode, 4);
2696 rtx dest_high = simplify_gen_subreg (SImode, dest, DImode, 0);
2697 rtx dest_low = simplify_gen_subreg (SImode, dest, DImode, 4);
2699 emit_insn (gen_bswapsi2 (dest_high, src_low));
2700 emit_insn (gen_bswapsi2 (dest_low, src_high));
2703 (define_expand "mulsi3"
2704 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
2705 (use (match_operand:SI 1 "gpc_reg_operand" ""))
2706 (use (match_operand:SI 2 "reg_or_short_operand" ""))]
2711 emit_insn (gen_mulsi3_mq (operands[0], operands[1], operands[2]));
2713 emit_insn (gen_mulsi3_no_mq (operands[0], operands[1], operands[2]));
2717 (define_insn "mulsi3_mq"
2718 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2719 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2720 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
2721 (clobber (match_scratch:SI 3 "=q,q"))]
2724 {muls|mullw} %0,%1,%2
2725 {muli|mulli} %0,%1,%2"
2727 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
2728 (const_string "imul3")
2729 (match_operand:SI 2 "short_cint_operand" "")
2730 (const_string "imul2")]
2731 (const_string "imul")))])
2733 (define_insn "mulsi3_no_mq"
2734 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2735 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2736 (match_operand:SI 2 "reg_or_short_operand" "r,I")))]
2739 {muls|mullw} %0,%1,%2
2740 {muli|mulli} %0,%1,%2"
2742 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
2743 (const_string "imul3")
2744 (match_operand:SI 2 "short_cint_operand" "")
2745 (const_string "imul2")]
2746 (const_string "imul")))])
2748 (define_insn "*mulsi3_mq_internal1"
2749 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2750 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2751 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2753 (clobber (match_scratch:SI 3 "=r,r"))
2754 (clobber (match_scratch:SI 4 "=q,q"))]
2757 {muls.|mullw.} %3,%1,%2
2759 [(set_attr "type" "imul_compare")
2760 (set_attr "length" "4,8")])
2763 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2764 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2765 (match_operand:SI 2 "gpc_reg_operand" ""))
2767 (clobber (match_scratch:SI 3 ""))
2768 (clobber (match_scratch:SI 4 ""))]
2769 "TARGET_POWER && reload_completed"
2770 [(parallel [(set (match_dup 3)
2771 (mult:SI (match_dup 1) (match_dup 2)))
2772 (clobber (match_dup 4))])
2774 (compare:CC (match_dup 3)
2778 (define_insn "*mulsi3_no_mq_internal1"
2779 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2780 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2781 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2783 (clobber (match_scratch:SI 3 "=r,r"))]
2786 {muls.|mullw.} %3,%1,%2
2788 [(set_attr "type" "imul_compare")
2789 (set_attr "length" "4,8")])
2792 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
2793 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2794 (match_operand:SI 2 "gpc_reg_operand" ""))
2796 (clobber (match_scratch:SI 3 ""))]
2797 "! TARGET_POWER && reload_completed"
2799 (mult:SI (match_dup 1) (match_dup 2)))
2801 (compare:CC (match_dup 3)
2805 (define_insn "*mulsi3_mq_internal2"
2806 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2807 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2808 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2810 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2811 (mult:SI (match_dup 1) (match_dup 2)))
2812 (clobber (match_scratch:SI 4 "=q,q"))]
2815 {muls.|mullw.} %0,%1,%2
2817 [(set_attr "type" "imul_compare")
2818 (set_attr "length" "4,8")])
2821 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2822 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2823 (match_operand:SI 2 "gpc_reg_operand" ""))
2825 (set (match_operand:SI 0 "gpc_reg_operand" "")
2826 (mult:SI (match_dup 1) (match_dup 2)))
2827 (clobber (match_scratch:SI 4 ""))]
2828 "TARGET_POWER && reload_completed"
2829 [(parallel [(set (match_dup 0)
2830 (mult:SI (match_dup 1) (match_dup 2)))
2831 (clobber (match_dup 4))])
2833 (compare:CC (match_dup 0)
2837 (define_insn "*mulsi3_no_mq_internal2"
2838 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2839 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2840 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2842 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2843 (mult:SI (match_dup 1) (match_dup 2)))]
2846 {muls.|mullw.} %0,%1,%2
2848 [(set_attr "type" "imul_compare")
2849 (set_attr "length" "4,8")])
2852 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
2853 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2854 (match_operand:SI 2 "gpc_reg_operand" ""))
2856 (set (match_operand:SI 0 "gpc_reg_operand" "")
2857 (mult:SI (match_dup 1) (match_dup 2)))]
2858 "! TARGET_POWER && reload_completed"
2860 (mult:SI (match_dup 1) (match_dup 2)))
2862 (compare:CC (match_dup 0)
2866 ;; Operand 1 is divided by operand 2; quotient goes to operand
2867 ;; 0 and remainder to operand 3.
2868 ;; ??? At some point, see what, if anything, we can do about if (x % y == 0).
2870 (define_expand "divmodsi4"
2871 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
2872 (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
2873 (match_operand:SI 2 "gpc_reg_operand" "")))
2874 (set (match_operand:SI 3 "register_operand" "")
2875 (mod:SI (match_dup 1) (match_dup 2)))])]
2876 "TARGET_POWER || (! TARGET_POWER && ! TARGET_POWERPC)"
2879 if (! TARGET_POWER && ! TARGET_POWERPC)
2881 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2882 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2883 emit_insn (gen_divss_call ());
2884 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2885 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
2890 (define_insn "*divmodsi4_internal"
2891 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2892 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2893 (match_operand:SI 2 "gpc_reg_operand" "r")))
2894 (set (match_operand:SI 3 "register_operand" "=q")
2895 (mod:SI (match_dup 1) (match_dup 2)))]
2898 [(set_attr "type" "idiv")])
2900 (define_expand "udiv<mode>3"
2901 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2902 (udiv:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2903 (match_operand:GPR 2 "gpc_reg_operand" "")))]
2904 "TARGET_POWERPC || (! TARGET_POWER && ! TARGET_POWERPC)"
2907 if (! TARGET_POWER && ! TARGET_POWERPC)
2909 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2910 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2911 emit_insn (gen_quous_call ());
2912 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2915 else if (TARGET_POWER)
2917 emit_insn (gen_udivsi3_mq (operands[0], operands[1], operands[2]));
2922 (define_insn "udivsi3_mq"
2923 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2924 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2925 (match_operand:SI 2 "gpc_reg_operand" "r")))
2926 (clobber (match_scratch:SI 3 "=q"))]
2927 "TARGET_POWERPC && TARGET_POWER"
2929 [(set_attr "type" "idiv")])
2931 (define_insn "*udivsi3_no_mq"
2932 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2933 (udiv:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2934 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
2935 "TARGET_POWERPC && ! TARGET_POWER"
2938 (cond [(match_operand:SI 0 "" "")
2939 (const_string "idiv")]
2940 (const_string "ldiv")))])
2943 ;; For powers of two we can do srai/aze for divide and then adjust for
2944 ;; modulus. If it isn't a power of two, FAIL on POWER so divmodsi4 will be
2945 ;; used; for PowerPC, force operands into register and do a normal divide;
2946 ;; for AIX common-mode, use quoss call on register operands.
2947 (define_expand "div<mode>3"
2948 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2949 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2950 (match_operand:GPR 2 "reg_or_cint_operand" "")))]
2954 if (GET_CODE (operands[2]) == CONST_INT
2955 && INTVAL (operands[2]) > 0
2956 && exact_log2 (INTVAL (operands[2])) >= 0)
2958 else if (TARGET_POWERPC)
2960 operands[2] = force_reg (<MODE>mode, operands[2]);
2963 emit_insn (gen_divsi3_mq (operands[0], operands[1], operands[2]));
2967 else if (TARGET_POWER)
2971 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2972 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2973 emit_insn (gen_quoss_call ());
2974 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2979 (define_insn "divsi3_mq"
2980 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2981 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2982 (match_operand:SI 2 "gpc_reg_operand" "r")))
2983 (clobber (match_scratch:SI 3 "=q"))]
2984 "TARGET_POWERPC && TARGET_POWER"
2986 [(set_attr "type" "idiv")])
2988 (define_insn "*div<mode>3_no_mq"
2989 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2990 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2991 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
2992 "TARGET_POWERPC && ! TARGET_POWER"
2995 (cond [(match_operand:SI 0 "" "")
2996 (const_string "idiv")]
2997 (const_string "ldiv")))])
2999 (define_expand "mod<mode>3"
3000 [(use (match_operand:GPR 0 "gpc_reg_operand" ""))
3001 (use (match_operand:GPR 1 "gpc_reg_operand" ""))
3002 (use (match_operand:GPR 2 "reg_or_cint_operand" ""))]
3010 if (GET_CODE (operands[2]) != CONST_INT
3011 || INTVAL (operands[2]) <= 0
3012 || (i = exact_log2 (INTVAL (operands[2]))) < 0)
3015 temp1 = gen_reg_rtx (<MODE>mode);
3016 temp2 = gen_reg_rtx (<MODE>mode);
3018 emit_insn (gen_div<mode>3 (temp1, operands[1], operands[2]));
3019 emit_insn (gen_ashl<mode>3 (temp2, temp1, GEN_INT (i)));
3020 emit_insn (gen_sub<mode>3 (operands[0], operands[1], temp2));
3025 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
3026 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
3027 (match_operand:GPR 2 "exact_log2_cint_operand" "N")))]
3029 "{srai|sra<wd>i} %0,%1,%p2\;{aze|addze} %0,%0"
3030 [(set_attr "type" "two")
3031 (set_attr "length" "8")])
3034 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3035 (compare:CC (div:P (match_operand:P 1 "gpc_reg_operand" "r,r")
3036 (match_operand:P 2 "exact_log2_cint_operand" "N,N"))
3038 (clobber (match_scratch:P 3 "=r,r"))]
3041 {srai|sra<wd>i} %3,%1,%p2\;{aze.|addze.} %3,%3
3043 [(set_attr "type" "compare")
3044 (set_attr "length" "8,12")
3045 (set_attr "cell_micro" "not")])
3048 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3049 (compare:CC (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
3050 (match_operand:GPR 2 "exact_log2_cint_operand"
3053 (clobber (match_scratch:GPR 3 ""))]
3056 (div:<MODE> (match_dup 1) (match_dup 2)))
3058 (compare:CC (match_dup 3)
3063 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3064 (compare:CC (div:P (match_operand:P 1 "gpc_reg_operand" "r,r")
3065 (match_operand:P 2 "exact_log2_cint_operand" "N,N"))
3067 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
3068 (div:P (match_dup 1) (match_dup 2)))]
3071 {srai|sra<wd>i} %0,%1,%p2\;{aze.|addze.} %0,%0
3073 [(set_attr "type" "compare")
3074 (set_attr "length" "8,12")
3075 (set_attr "cell_micro" "not")])
3078 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3079 (compare:CC (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
3080 (match_operand:GPR 2 "exact_log2_cint_operand"
3083 (set (match_operand:GPR 0 "gpc_reg_operand" "")
3084 (div:GPR (match_dup 1) (match_dup 2)))]
3087 (div:<MODE> (match_dup 1) (match_dup 2)))
3089 (compare:CC (match_dup 0)
3094 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3097 (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
3099 (zero_extend:DI (match_operand:SI 4 "register_operand" "2")))
3100 (match_operand:SI 3 "gpc_reg_operand" "r")))
3101 (set (match_operand:SI 2 "register_operand" "=*q")
3104 (zero_extend:DI (match_dup 1)) (const_int 32))
3105 (zero_extend:DI (match_dup 4)))
3109 [(set_attr "type" "idiv")])
3111 ;; To do unsigned divide we handle the cases of the divisor looking like a
3112 ;; negative number. If it is a constant that is less than 2**31, we don't
3113 ;; have to worry about the branches. So make a few subroutines here.
3115 ;; First comes the normal case.
3116 (define_expand "udivmodsi4_normal"
3117 [(set (match_dup 4) (const_int 0))
3118 (parallel [(set (match_operand:SI 0 "" "")
3119 (udiv:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
3121 (zero_extend:DI (match_operand:SI 1 "" "")))
3122 (match_operand:SI 2 "" "")))
3123 (set (match_operand:SI 3 "" "")
3124 (umod:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
3126 (zero_extend:DI (match_dup 1)))
3130 { operands[4] = gen_reg_rtx (SImode); }")
3132 ;; This handles the branches.
3133 (define_expand "udivmodsi4_tests"
3134 [(set (match_operand:SI 0 "" "") (const_int 0))
3135 (set (match_operand:SI 3 "" "") (match_operand:SI 1 "" ""))
3136 (set (match_dup 5) (compare:CCUNS (match_dup 1) (match_operand:SI 2 "" "")))
3137 (set (pc) (if_then_else (ltu (match_dup 5) (const_int 0))
3138 (label_ref (match_operand:SI 4 "" "")) (pc)))
3139 (set (match_dup 0) (const_int 1))
3140 (set (match_dup 3) (minus:SI (match_dup 1) (match_dup 2)))
3141 (set (match_dup 6) (compare:CC (match_dup 2) (const_int 0)))
3142 (set (pc) (if_then_else (lt (match_dup 6) (const_int 0))
3143 (label_ref (match_dup 4)) (pc)))]
3146 { operands[5] = gen_reg_rtx (CCUNSmode);
3147 operands[6] = gen_reg_rtx (CCmode);
3150 (define_expand "udivmodsi4"
3151 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
3152 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "")
3153 (match_operand:SI 2 "reg_or_cint_operand" "")))
3154 (set (match_operand:SI 3 "gpc_reg_operand" "")
3155 (umod:SI (match_dup 1) (match_dup 2)))])]
3163 if (! TARGET_POWERPC)
3165 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
3166 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
3167 emit_insn (gen_divus_call ());
3168 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
3169 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
3176 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) < 0)
3178 operands[2] = force_reg (SImode, operands[2]);
3179 label = gen_label_rtx ();
3180 emit (gen_udivmodsi4_tests (operands[0], operands[1], operands[2],
3181 operands[3], label));
3184 operands[2] = force_reg (SImode, operands[2]);
3186 emit (gen_udivmodsi4_normal (operands[0], operands[1], operands[2],
3194 ;; AIX architecture-independent common-mode multiply (DImode),
3195 ;; divide/modulus, and quotient subroutine calls. Input operands in R3 and
3196 ;; R4; results in R3 and sometimes R4; link register always clobbered by bla
3197 ;; instruction; R0 sometimes clobbered; also, MQ sometimes clobbered but
3198 ;; assumed unused if generating common-mode, so ignore.
3199 (define_insn "mulh_call"
3202 (lshiftrt:DI (mult:DI (sign_extend:DI (reg:SI 3))
3203 (sign_extend:DI (reg:SI 4)))
3205 (clobber (reg:SI LR_REGNO))]
3206 "! TARGET_POWER && ! TARGET_POWERPC"
3208 [(set_attr "type" "imul")])
3210 (define_insn "mull_call"
3212 (mult:DI (sign_extend:DI (reg:SI 3))
3213 (sign_extend:DI (reg:SI 4))))
3214 (clobber (reg:SI LR_REGNO))
3215 (clobber (reg:SI 0))]
3216 "! TARGET_POWER && ! TARGET_POWERPC"
3218 [(set_attr "type" "imul")])
3220 (define_insn "divss_call"
3222 (div:SI (reg:SI 3) (reg:SI 4)))
3224 (mod:SI (reg:SI 3) (reg:SI 4)))
3225 (clobber (reg:SI LR_REGNO))
3226 (clobber (reg:SI 0))]
3227 "! TARGET_POWER && ! TARGET_POWERPC"
3229 [(set_attr "type" "idiv")])
3231 (define_insn "divus_call"
3233 (udiv:SI (reg:SI 3) (reg:SI 4)))
3235 (umod:SI (reg:SI 3) (reg:SI 4)))
3236 (clobber (reg:SI LR_REGNO))
3237 (clobber (reg:SI 0))
3238 (clobber (match_scratch:CC 0 "=x"))
3239 (clobber (reg:CC CR1_REGNO))]
3240 "! TARGET_POWER && ! TARGET_POWERPC"
3242 [(set_attr "type" "idiv")])
3244 (define_insn "quoss_call"
3246 (div:SI (reg:SI 3) (reg:SI 4)))
3247 (clobber (reg:SI LR_REGNO))]
3248 "! TARGET_POWER && ! TARGET_POWERPC"
3250 [(set_attr "type" "idiv")])
3252 (define_insn "quous_call"
3254 (udiv:SI (reg:SI 3) (reg:SI 4)))
3255 (clobber (reg:SI LR_REGNO))
3256 (clobber (reg:SI 0))
3257 (clobber (match_scratch:CC 0 "=x"))
3258 (clobber (reg:CC CR1_REGNO))]
3259 "! TARGET_POWER && ! TARGET_POWERPC"
3261 [(set_attr "type" "idiv")])
3263 ;; Logical instructions
3264 ;; The logical instructions are mostly combined by using match_operator,
3265 ;; but the plain AND insns are somewhat different because there is no
3266 ;; plain 'andi' (only 'andi.'), no plain 'andis', and there are all
3267 ;; those rotate-and-mask operations. Thus, the AND insns come first.
3269 (define_expand "andsi3"
3271 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3272 (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
3273 (match_operand:SI 2 "and_operand" "")))
3274 (clobber (match_scratch:CC 3 ""))])]
3278 (define_insn "andsi3_mc"
3279 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
3280 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
3281 (match_operand:SI 2 "and_operand" "?r,T,K,L")))
3282 (clobber (match_scratch:CC 3 "=X,X,x,x"))]
3283 "rs6000_gen_cell_microcode"
3286 {rlinm|rlwinm} %0,%1,0,%m2,%M2
3287 {andil.|andi.} %0,%1,%b2
3288 {andiu.|andis.} %0,%1,%u2"
3289 [(set_attr "type" "*,*,fast_compare,fast_compare")])
3291 (define_insn "andsi3_nomc"
3292 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3293 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
3294 (match_operand:SI 2 "and_operand" "?r,T")))
3295 (clobber (match_scratch:CC 3 "=X,X"))]
3296 "!rs6000_gen_cell_microcode"
3299 {rlinm|rlwinm} %0,%1,0,%m2,%M2")
3301 (define_insn "andsi3_internal0_nomc"
3302 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3303 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
3304 (match_operand:SI 2 "and_operand" "?r,T")))]
3305 "!rs6000_gen_cell_microcode"
3308 {rlinm|rlwinm} %0,%1,0,%m2,%M2")
3311 ;; Note to set cr's other than cr0 we do the and immediate and then
3312 ;; the test again -- this avoids a mfcr which on the higher end
3313 ;; machines causes an execution serialization
3315 (define_insn "*andsi3_internal2_mc"
3316 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
3317 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
3318 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
3320 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
3321 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
3322 "TARGET_32BIT && rs6000_gen_cell_microcode"
3325 {andil.|andi.} %3,%1,%b2
3326 {andiu.|andis.} %3,%1,%u2
3327 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
3332 [(set_attr "type" "fast_compare,fast_compare,fast_compare,delayed_compare,\
3333 compare,compare,compare,compare")
3334 (set_attr "length" "4,4,4,4,8,8,8,8")])
3336 (define_insn "*andsi3_internal3_mc"
3337 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
3338 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
3339 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
3341 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
3342 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
3343 "TARGET_64BIT && rs6000_gen_cell_microcode"
3346 {andil.|andi.} %3,%1,%b2
3347 {andiu.|andis.} %3,%1,%u2
3348 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
3353 [(set_attr "type" "compare,fast_compare,fast_compare,delayed_compare,compare,\
3354 compare,compare,compare")
3355 (set_attr "length" "8,4,4,4,8,8,8,8")])
3358 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3359 (compare:CC (and:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
3360 (match_operand:GPR 2 "and_operand" ""))
3362 (clobber (match_scratch:GPR 3 ""))
3363 (clobber (match_scratch:CC 4 ""))]
3365 [(parallel [(set (match_dup 3)
3366 (and:<MODE> (match_dup 1)
3368 (clobber (match_dup 4))])
3370 (compare:CC (match_dup 3)
3374 ;; We don't have a 32 bit "and. rt,ra,rb" for ppc64. cr is set from the
3375 ;; whole 64 bit reg, and we don't know what is in the high 32 bits.
3378 [(set (match_operand:CC 0 "cc_reg_operand" "")
3379 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
3380 (match_operand:SI 2 "gpc_reg_operand" ""))
3382 (clobber (match_scratch:SI 3 ""))
3383 (clobber (match_scratch:CC 4 ""))]
3384 "TARGET_POWERPC64 && reload_completed"
3385 [(parallel [(set (match_dup 3)
3386 (and:SI (match_dup 1)
3388 (clobber (match_dup 4))])
3390 (compare:CC (match_dup 3)
3394 (define_insn "*andsi3_internal4"
3395 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
3396 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
3397 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
3399 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
3400 (and:SI (match_dup 1)
3402 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
3403 "TARGET_32BIT && rs6000_gen_cell_microcode"
3406 {andil.|andi.} %0,%1,%b2
3407 {andiu.|andis.} %0,%1,%u2
3408 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
3413 [(set_attr "type" "fast_compare,fast_compare,fast_compare,delayed_compare,\
3414 compare,compare,compare,compare")
3415 (set_attr "length" "4,4,4,4,8,8,8,8")])
3417 (define_insn "*andsi3_internal5_mc"
3418 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
3419 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
3420 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
3422 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
3423 (and:SI (match_dup 1)
3425 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
3426 "TARGET_64BIT && rs6000_gen_cell_microcode"
3429 {andil.|andi.} %0,%1,%b2
3430 {andiu.|andis.} %0,%1,%u2
3431 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
3436 [(set_attr "type" "compare,fast_compare,fast_compare,delayed_compare,compare,\
3437 compare,compare,compare")
3438 (set_attr "length" "8,4,4,4,8,8,8,8")])
3441 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3442 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
3443 (match_operand:SI 2 "and_operand" ""))
3445 (set (match_operand:SI 0 "gpc_reg_operand" "")
3446 (and:SI (match_dup 1)
3448 (clobber (match_scratch:CC 4 ""))]
3450 [(parallel [(set (match_dup 0)
3451 (and:SI (match_dup 1)
3453 (clobber (match_dup 4))])
3455 (compare:CC (match_dup 0)
3460 [(set (match_operand:CC 3 "cc_reg_operand" "")
3461 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
3462 (match_operand:SI 2 "gpc_reg_operand" ""))
3464 (set (match_operand:SI 0 "gpc_reg_operand" "")
3465 (and:SI (match_dup 1)
3467 (clobber (match_scratch:CC 4 ""))]
3468 "TARGET_POWERPC64 && reload_completed"
3469 [(parallel [(set (match_dup 0)
3470 (and:SI (match_dup 1)
3472 (clobber (match_dup 4))])
3474 (compare:CC (match_dup 0)
3478 ;; Handle the PowerPC64 rlwinm corner case
3480 (define_insn_and_split "*andsi3_internal6"
3481 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3482 (and:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3483 (match_operand:SI 2 "mask_operand_wrap" "i")))]
3488 (and:SI (rotate:SI (match_dup 1) (match_dup 3))
3491 (rotate:SI (match_dup 0) (match_dup 5)))]
3494 int mb = extract_MB (operands[2]);
3495 int me = extract_ME (operands[2]);
3496 operands[3] = GEN_INT (me + 1);
3497 operands[5] = GEN_INT (32 - (me + 1));
3498 operands[4] = GEN_INT (~((HOST_WIDE_INT) -1 << (33 + me - mb)));
3500 [(set_attr "length" "8")])
3502 (define_expand "iorsi3"
3503 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3504 (ior:SI (match_operand:SI 1 "gpc_reg_operand" "")
3505 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
3509 if (GET_CODE (operands[2]) == CONST_INT
3510 && ! logical_operand (operands[2], SImode))
3512 HOST_WIDE_INT value = INTVAL (operands[2]);
3513 rtx tmp = ((!can_create_pseudo_p ()
3514 || rtx_equal_p (operands[0], operands[1]))
3515 ? operands[0] : gen_reg_rtx (SImode));
3517 emit_insn (gen_iorsi3 (tmp, operands[1],
3518 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
3519 emit_insn (gen_iorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
3524 (define_expand "xorsi3"
3525 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3526 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
3527 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
3531 if (GET_CODE (operands[2]) == CONST_INT
3532 && ! logical_operand (operands[2], SImode))
3534 HOST_WIDE_INT value = INTVAL (operands[2]);
3535 rtx tmp = ((!can_create_pseudo_p ()
3536 || rtx_equal_p (operands[0], operands[1]))
3537 ? operands[0] : gen_reg_rtx (SImode));
3539 emit_insn (gen_xorsi3 (tmp, operands[1],
3540 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
3541 emit_insn (gen_xorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
3546 (define_insn "*boolsi3_internal1"
3547 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
3548 (match_operator:SI 3 "boolean_or_operator"
3549 [(match_operand:SI 1 "gpc_reg_operand" "%r,r,r")
3550 (match_operand:SI 2 "logical_operand" "r,K,L")]))]
3554 {%q3il|%q3i} %0,%1,%b2
3555 {%q3iu|%q3is} %0,%1,%u2")
3557 (define_insn "*boolsi3_internal2"
3558 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3559 (compare:CC (match_operator:SI 4 "boolean_or_operator"
3560 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
3561 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3563 (clobber (match_scratch:SI 3 "=r,r"))]
3568 [(set_attr "type" "fast_compare,compare")
3569 (set_attr "length" "4,8")])
3572 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3573 (compare:CC (match_operator:SI 4 "boolean_operator"
3574 [(match_operand:SI 1 "gpc_reg_operand" "")
3575 (match_operand:SI 2 "gpc_reg_operand" "")])
3577 (clobber (match_scratch:SI 3 ""))]
3578 "TARGET_32BIT && reload_completed"
3579 [(set (match_dup 3) (match_dup 4))
3581 (compare:CC (match_dup 3)
3585 (define_insn "*boolsi3_internal3"
3586 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3587 (compare:CC (match_operator:SI 4 "boolean_operator"
3588 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
3589 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3591 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3597 [(set_attr "type" "fast_compare,compare")
3598 (set_attr "length" "4,8")])
3601 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3602 (compare:CC (match_operator:SI 4 "boolean_operator"
3603 [(match_operand:SI 1 "gpc_reg_operand" "")
3604 (match_operand:SI 2 "gpc_reg_operand" "")])
3606 (set (match_operand:SI 0 "gpc_reg_operand" "")
3608 "TARGET_32BIT && reload_completed"
3609 [(set (match_dup 0) (match_dup 4))
3611 (compare:CC (match_dup 0)
3615 ;; Split a logical operation that we can't do in one insn into two insns,
3616 ;; each of which does one 16-bit part. This is used by combine.
3619 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3620 (match_operator:SI 3 "boolean_or_operator"
3621 [(match_operand:SI 1 "gpc_reg_operand" "")
3622 (match_operand:SI 2 "non_logical_cint_operand" "")]))]
3624 [(set (match_dup 0) (match_dup 4))
3625 (set (match_dup 0) (match_dup 5))]
3629 i = GEN_INT (INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff));
3630 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
3632 i = GEN_INT (INTVAL (operands[2]) & 0xffff);
3633 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
3637 (define_insn "*boolcsi3_internal1"
3638 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3639 (match_operator:SI 3 "boolean_operator"
3640 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
3641 (match_operand:SI 2 "gpc_reg_operand" "r")]))]
3645 (define_insn "*boolcsi3_internal2"
3646 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3647 (compare:CC (match_operator:SI 4 "boolean_operator"
3648 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
3649 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3651 (clobber (match_scratch:SI 3 "=r,r"))]
3656 [(set_attr "type" "compare")
3657 (set_attr "length" "4,8")])
3660 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3661 (compare:CC (match_operator:SI 4 "boolean_operator"
3662 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3663 (match_operand:SI 2 "gpc_reg_operand" "")])
3665 (clobber (match_scratch:SI 3 ""))]
3666 "TARGET_32BIT && reload_completed"
3667 [(set (match_dup 3) (match_dup 4))
3669 (compare:CC (match_dup 3)
3673 (define_insn "*boolcsi3_internal3"
3674 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3675 (compare:CC (match_operator:SI 4 "boolean_operator"
3676 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
3677 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3679 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3685 [(set_attr "type" "compare")
3686 (set_attr "length" "4,8")])
3689 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3690 (compare:CC (match_operator:SI 4 "boolean_operator"
3691 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3692 (match_operand:SI 2 "gpc_reg_operand" "")])
3694 (set (match_operand:SI 0 "gpc_reg_operand" "")
3696 "TARGET_32BIT && reload_completed"
3697 [(set (match_dup 0) (match_dup 4))
3699 (compare:CC (match_dup 0)
3703 (define_insn "*boolccsi3_internal1"
3704 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3705 (match_operator:SI 3 "boolean_operator"
3706 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
3707 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))]))]
3711 (define_insn "*boolccsi3_internal2"
3712 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3713 (compare:CC (match_operator:SI 4 "boolean_operator"
3714 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
3715 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
3717 (clobber (match_scratch:SI 3 "=r,r"))]
3722 [(set_attr "type" "fast_compare,compare")
3723 (set_attr "length" "4,8")])
3726 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3727 (compare:CC (match_operator:SI 4 "boolean_operator"
3728 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3729 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
3731 (clobber (match_scratch:SI 3 ""))]
3732 "TARGET_32BIT && reload_completed"
3733 [(set (match_dup 3) (match_dup 4))
3735 (compare:CC (match_dup 3)
3739 (define_insn "*boolccsi3_internal3"
3740 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3741 (compare:CC (match_operator:SI 4 "boolean_operator"
3742 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
3743 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
3745 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3751 [(set_attr "type" "fast_compare,compare")
3752 (set_attr "length" "4,8")])
3755 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3756 (compare:CC (match_operator:SI 4 "boolean_operator"
3757 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3758 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
3760 (set (match_operand:SI 0 "gpc_reg_operand" "")
3762 "TARGET_32BIT && reload_completed"
3763 [(set (match_dup 0) (match_dup 4))
3765 (compare:CC (match_dup 0)
3769 ;; maskir insn. We need four forms because things might be in arbitrary
3770 ;; orders. Don't define forms that only set CR fields because these
3771 ;; would modify an input register.
3773 (define_insn "*maskir_internal1"
3774 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3775 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
3776 (match_operand:SI 1 "gpc_reg_operand" "0"))
3777 (and:SI (match_dup 2)
3778 (match_operand:SI 3 "gpc_reg_operand" "r"))))]
3782 (define_insn "*maskir_internal2"
3783 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3784 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
3785 (match_operand:SI 1 "gpc_reg_operand" "0"))
3786 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3791 (define_insn "*maskir_internal3"
3792 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3793 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r")
3794 (match_operand:SI 3 "gpc_reg_operand" "r"))
3795 (and:SI (not:SI (match_dup 2))
3796 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
3800 (define_insn "*maskir_internal4"
3801 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3802 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3803 (match_operand:SI 2 "gpc_reg_operand" "r"))
3804 (and:SI (not:SI (match_dup 2))
3805 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
3809 (define_insn "*maskir_internal5"
3810 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3812 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3813 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
3814 (and:SI (match_dup 2)
3815 (match_operand:SI 3 "gpc_reg_operand" "r,r")))
3817 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3818 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3819 (and:SI (match_dup 2) (match_dup 3))))]
3824 [(set_attr "type" "compare")
3825 (set_attr "length" "4,8")])
3828 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3830 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
3831 (match_operand:SI 1 "gpc_reg_operand" ""))
3832 (and:SI (match_dup 2)
3833 (match_operand:SI 3 "gpc_reg_operand" "")))
3835 (set (match_operand:SI 0 "gpc_reg_operand" "")
3836 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3837 (and:SI (match_dup 2) (match_dup 3))))]
3838 "TARGET_POWER && reload_completed"
3840 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3841 (and:SI (match_dup 2) (match_dup 3))))
3843 (compare:CC (match_dup 0)
3847 (define_insn "*maskir_internal6"
3848 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3850 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3851 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
3852 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
3855 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3856 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3857 (and:SI (match_dup 3) (match_dup 2))))]
3862 [(set_attr "type" "compare")
3863 (set_attr "length" "4,8")])
3866 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3868 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
3869 (match_operand:SI 1 "gpc_reg_operand" ""))
3870 (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
3873 (set (match_operand:SI 0 "gpc_reg_operand" "")
3874 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3875 (and:SI (match_dup 3) (match_dup 2))))]
3876 "TARGET_POWER && reload_completed"
3878 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3879 (and:SI (match_dup 3) (match_dup 2))))
3881 (compare:CC (match_dup 0)
3885 (define_insn "*maskir_internal7"
3886 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3888 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r,r")
3889 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
3890 (and:SI (not:SI (match_dup 2))
3891 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
3893 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3894 (ior:SI (and:SI (match_dup 2) (match_dup 3))
3895 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3900 [(set_attr "type" "compare")
3901 (set_attr "length" "4,8")])
3904 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3906 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "")
3907 (match_operand:SI 3 "gpc_reg_operand" ""))
3908 (and:SI (not:SI (match_dup 2))
3909 (match_operand:SI 1 "gpc_reg_operand" "")))
3911 (set (match_operand:SI 0 "gpc_reg_operand" "")
3912 (ior:SI (and:SI (match_dup 2) (match_dup 3))
3913 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3914 "TARGET_POWER && reload_completed"
3916 (ior:SI (and:SI (match_dup 2) (match_dup 3))
3917 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
3919 (compare:CC (match_dup 0)
3923 (define_insn "*maskir_internal8"
3924 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3926 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
3927 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3928 (and:SI (not:SI (match_dup 2))
3929 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
3931 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3932 (ior:SI (and:SI (match_dup 3) (match_dup 2))
3933 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3938 [(set_attr "type" "compare")
3939 (set_attr "length" "4,8")])
3942 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3944 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
3945 (match_operand:SI 2 "gpc_reg_operand" ""))
3946 (and:SI (not:SI (match_dup 2))
3947 (match_operand:SI 1 "gpc_reg_operand" "")))
3949 (set (match_operand:SI 0 "gpc_reg_operand" "")
3950 (ior:SI (and:SI (match_dup 3) (match_dup 2))
3951 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3952 "TARGET_POWER && reload_completed"
3954 (ior:SI (and:SI (match_dup 3) (match_dup 2))
3955 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
3957 (compare:CC (match_dup 0)
3961 ;; Rotate and shift insns, in all their variants. These support shifts,
3962 ;; field inserts and extracts, and various combinations thereof.
3963 (define_expand "insv"
3964 [(set (zero_extract (match_operand 0 "gpc_reg_operand" "")
3965 (match_operand:SI 1 "const_int_operand" "")
3966 (match_operand:SI 2 "const_int_operand" ""))
3967 (match_operand 3 "gpc_reg_operand" ""))]
3971 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3972 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3973 compiler if the address of the structure is taken later. Likewise, do
3974 not handle invalid E500 subregs. */
3975 if (GET_CODE (operands[0]) == SUBREG
3976 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD
3977 || ((TARGET_E500_DOUBLE || TARGET_SPE)
3978 && invalid_e500_subreg (operands[0], GET_MODE (operands[0])))))
3981 if (TARGET_POWERPC64 && GET_MODE (operands[0]) == DImode)
3982 emit_insn (gen_insvdi (operands[0], operands[1], operands[2], operands[3]));
3984 emit_insn (gen_insvsi (operands[0], operands[1], operands[2], operands[3]));
3988 (define_insn "insvsi"
3989 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3990 (match_operand:SI 1 "const_int_operand" "i")
3991 (match_operand:SI 2 "const_int_operand" "i"))
3992 (match_operand:SI 3 "gpc_reg_operand" "r"))]
3996 int start = INTVAL (operands[2]) & 31;
3997 int size = INTVAL (operands[1]) & 31;
3999 operands[4] = GEN_INT (32 - start - size);
4000 operands[1] = GEN_INT (start + size - 1);
4001 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
4003 [(set_attr "type" "insert_word")])
4005 (define_insn "*insvsi_internal1"
4006 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4007 (match_operand:SI 1 "const_int_operand" "i")
4008 (match_operand:SI 2 "const_int_operand" "i"))
4009 (rotate:SI (match_operand:SI 3 "gpc_reg_operand" "r")
4010 (match_operand:SI 4 "const_int_operand" "i")))]
4011 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
4014 int shift = INTVAL (operands[4]) & 31;
4015 int start = INTVAL (operands[2]) & 31;
4016 int size = INTVAL (operands[1]) & 31;
4018 operands[4] = GEN_INT (shift - start - size);
4019 operands[1] = GEN_INT (start + size - 1);
4020 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
4022 [(set_attr "type" "insert_word")])
4024 (define_insn "*insvsi_internal2"
4025 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4026 (match_operand:SI 1 "const_int_operand" "i")
4027 (match_operand:SI 2 "const_int_operand" "i"))
4028 (ashiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
4029 (match_operand:SI 4 "const_int_operand" "i")))]
4030 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
4033 int shift = INTVAL (operands[4]) & 31;
4034 int start = INTVAL (operands[2]) & 31;
4035 int size = INTVAL (operands[1]) & 31;
4037 operands[4] = GEN_INT (32 - shift - start - size);
4038 operands[1] = GEN_INT (start + size - 1);
4039 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
4041 [(set_attr "type" "insert_word")])
4043 (define_insn "*insvsi_internal3"
4044 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4045 (match_operand:SI 1 "const_int_operand" "i")
4046 (match_operand:SI 2 "const_int_operand" "i"))
4047 (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
4048 (match_operand:SI 4 "const_int_operand" "i")))]
4049 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
4052 int shift = INTVAL (operands[4]) & 31;
4053 int start = INTVAL (operands[2]) & 31;
4054 int size = INTVAL (operands[1]) & 31;
4056 operands[4] = GEN_INT (32 - shift - start - size);
4057 operands[1] = GEN_INT (start + size - 1);
4058 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
4060 [(set_attr "type" "insert_word")])
4062 (define_insn "*insvsi_internal4"
4063 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4064 (match_operand:SI 1 "const_int_operand" "i")
4065 (match_operand:SI 2 "const_int_operand" "i"))
4066 (zero_extract:SI (match_operand:SI 3 "gpc_reg_operand" "r")
4067 (match_operand:SI 4 "const_int_operand" "i")
4068 (match_operand:SI 5 "const_int_operand" "i")))]
4069 "INTVAL (operands[4]) >= INTVAL (operands[1])"
4072 int extract_start = INTVAL (operands[5]) & 31;
4073 int extract_size = INTVAL (operands[4]) & 31;
4074 int insert_start = INTVAL (operands[2]) & 31;
4075 int insert_size = INTVAL (operands[1]) & 31;
4077 /* Align extract field with insert field */
4078 operands[5] = GEN_INT (extract_start + extract_size - insert_start - insert_size);
4079 operands[1] = GEN_INT (insert_start + insert_size - 1);
4080 return \"{rlimi|rlwimi} %0,%3,%h5,%h2,%h1\";
4082 [(set_attr "type" "insert_word")])
4084 ;; combine patterns for rlwimi
4085 (define_insn "*insvsi_internal5"
4086 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4087 (ior:SI (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
4088 (match_operand:SI 1 "mask_operand" "i"))
4089 (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
4090 (match_operand:SI 2 "const_int_operand" "i"))
4091 (match_operand:SI 5 "mask_operand" "i"))))]
4092 "TARGET_POWERPC && INTVAL(operands[1]) == ~INTVAL(operands[5])"
4095 int me = extract_ME(operands[5]);
4096 int mb = extract_MB(operands[5]);
4097 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
4098 operands[2] = GEN_INT(mb);
4099 operands[1] = GEN_INT(me);
4100 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
4102 [(set_attr "type" "insert_word")])
4104 (define_insn "*insvsi_internal6"
4105 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4106 (ior:SI (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
4107 (match_operand:SI 2 "const_int_operand" "i"))
4108 (match_operand:SI 5 "mask_operand" "i"))
4109 (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
4110 (match_operand:SI 1 "mask_operand" "i"))))]
4111 "TARGET_POWERPC && INTVAL(operands[1]) == ~INTVAL(operands[5])"
4114 int me = extract_ME(operands[5]);
4115 int mb = extract_MB(operands[5]);
4116 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
4117 operands[2] = GEN_INT(mb);
4118 operands[1] = GEN_INT(me);
4119 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
4121 [(set_attr "type" "insert_word")])
4123 (define_insn "insvdi"
4124 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
4125 (match_operand:SI 1 "const_int_operand" "i")
4126 (match_operand:SI 2 "const_int_operand" "i"))
4127 (match_operand:DI 3 "gpc_reg_operand" "r"))]
4131 int start = INTVAL (operands[2]) & 63;
4132 int size = INTVAL (operands[1]) & 63;
4134 operands[1] = GEN_INT (64 - start - size);
4135 return \"rldimi %0,%3,%H1,%H2\";
4137 [(set_attr "type" "insert_dword")])
4139 (define_insn "*insvdi_internal2"
4140 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
4141 (match_operand:SI 1 "const_int_operand" "i")
4142 (match_operand:SI 2 "const_int_operand" "i"))
4143 (ashiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
4144 (match_operand:SI 4 "const_int_operand" "i")))]
4146 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
4149 int shift = INTVAL (operands[4]) & 63;
4150 int start = (INTVAL (operands[2]) & 63) - 32;
4151 int size = INTVAL (operands[1]) & 63;
4153 operands[4] = GEN_INT (64 - shift - start - size);
4154 operands[2] = GEN_INT (start);
4155 operands[1] = GEN_INT (start + size - 1);
4156 return \"rlwimi %0,%3,%h4,%h2,%h1\";
4159 (define_insn "*insvdi_internal3"
4160 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
4161 (match_operand:SI 1 "const_int_operand" "i")
4162 (match_operand:SI 2 "const_int_operand" "i"))
4163 (lshiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
4164 (match_operand:SI 4 "const_int_operand" "i")))]
4166 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
4169 int shift = INTVAL (operands[4]) & 63;
4170 int start = (INTVAL (operands[2]) & 63) - 32;
4171 int size = INTVAL (operands[1]) & 63;
4173 operands[4] = GEN_INT (64 - shift - start - size);
4174 operands[2] = GEN_INT (start);
4175 operands[1] = GEN_INT (start + size - 1);
4176 return \"rlwimi %0,%3,%h4,%h2,%h1\";
4179 (define_expand "extzv"
4180 [(set (match_operand 0 "gpc_reg_operand" "")
4181 (zero_extract (match_operand 1 "gpc_reg_operand" "")
4182 (match_operand:SI 2 "const_int_operand" "")
4183 (match_operand:SI 3 "const_int_operand" "")))]
4187 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
4188 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
4189 compiler if the address of the structure is taken later. */
4190 if (GET_CODE (operands[0]) == SUBREG
4191 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
4194 if (TARGET_POWERPC64 && GET_MODE (operands[1]) == DImode)
4195 emit_insn (gen_extzvdi (operands[0], operands[1], operands[2], operands[3]));
4197 emit_insn (gen_extzvsi (operands[0], operands[1], operands[2], operands[3]));
4201 (define_insn "extzvsi"
4202 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4203 (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4204 (match_operand:SI 2 "const_int_operand" "i")
4205 (match_operand:SI 3 "const_int_operand" "i")))]
4209 int start = INTVAL (operands[3]) & 31;
4210 int size = INTVAL (operands[2]) & 31;
4212 if (start + size >= 32)
4213 operands[3] = const0_rtx;
4215 operands[3] = GEN_INT (start + size);
4216 return \"{rlinm|rlwinm} %0,%1,%3,%s2,31\";
4219 (define_insn "*extzvsi_internal1"
4220 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4221 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4222 (match_operand:SI 2 "const_int_operand" "i,i")
4223 (match_operand:SI 3 "const_int_operand" "i,i"))
4225 (clobber (match_scratch:SI 4 "=r,r"))]
4229 int start = INTVAL (operands[3]) & 31;
4230 int size = INTVAL (operands[2]) & 31;
4232 /* Force split for non-cc0 compare. */
4233 if (which_alternative == 1)
4236 /* If the bit-field being tested fits in the upper or lower half of a
4237 word, it is possible to use andiu. or andil. to test it. This is
4238 useful because the condition register set-use delay is smaller for
4239 andi[ul]. than for rlinm. This doesn't work when the starting bit
4240 position is 0 because the LT and GT bits may be set wrong. */
4242 if ((start > 0 && start + size <= 16) || start >= 16)
4244 operands[3] = GEN_INT (((1 << (16 - (start & 15)))
4245 - (1 << (16 - (start & 15) - size))));
4247 return \"{andiu.|andis.} %4,%1,%3\";
4249 return \"{andil.|andi.} %4,%1,%3\";
4252 if (start + size >= 32)
4253 operands[3] = const0_rtx;
4255 operands[3] = GEN_INT (start + size);
4256 return \"{rlinm.|rlwinm.} %4,%1,%3,%s2,31\";
4258 [(set_attr "type" "delayed_compare")
4259 (set_attr "length" "4,8")])
4262 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4263 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
4264 (match_operand:SI 2 "const_int_operand" "")
4265 (match_operand:SI 3 "const_int_operand" ""))
4267 (clobber (match_scratch:SI 4 ""))]
4270 (zero_extract:SI (match_dup 1) (match_dup 2)
4273 (compare:CC (match_dup 4)
4277 (define_insn "*extzvsi_internal2"
4278 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4279 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4280 (match_operand:SI 2 "const_int_operand" "i,i")
4281 (match_operand:SI 3 "const_int_operand" "i,i"))
4283 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4284 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
4288 int start = INTVAL (operands[3]) & 31;
4289 int size = INTVAL (operands[2]) & 31;
4291 /* Force split for non-cc0 compare. */
4292 if (which_alternative == 1)
4295 /* Since we are using the output value, we can't ignore any need for
4296 a shift. The bit-field must end at the LSB. */
4297 if (start >= 16 && start + size == 32)
4299 operands[3] = GEN_INT ((1 << size) - 1);
4300 return \"{andil.|andi.} %0,%1,%3\";
4303 if (start + size >= 32)
4304 operands[3] = const0_rtx;
4306 operands[3] = GEN_INT (start + size);
4307 return \"{rlinm.|rlwinm.} %0,%1,%3,%s2,31\";
4309 [(set_attr "type" "delayed_compare")
4310 (set_attr "length" "4,8")])
4313 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
4314 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
4315 (match_operand:SI 2 "const_int_operand" "")
4316 (match_operand:SI 3 "const_int_operand" ""))
4318 (set (match_operand:SI 0 "gpc_reg_operand" "")
4319 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
4322 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))
4324 (compare:CC (match_dup 0)
4328 (define_insn "extzvdi"
4329 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4330 (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4331 (match_operand:SI 2 "const_int_operand" "i")
4332 (match_operand:SI 3 "const_int_operand" "i")))]
4336 int start = INTVAL (operands[3]) & 63;
4337 int size = INTVAL (operands[2]) & 63;
4339 if (start + size >= 64)
4340 operands[3] = const0_rtx;
4342 operands[3] = GEN_INT (start + size);
4343 operands[2] = GEN_INT (64 - size);
4344 return \"rldicl %0,%1,%3,%2\";
4347 (define_insn "*extzvdi_internal1"
4348 [(set (match_operand:CC 0 "gpc_reg_operand" "=x")
4349 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4350 (match_operand:SI 2 "const_int_operand" "i")
4351 (match_operand:SI 3 "const_int_operand" "i"))
4353 (clobber (match_scratch:DI 4 "=r"))]
4354 "TARGET_64BIT && rs6000_gen_cell_microcode"
4357 int start = INTVAL (operands[3]) & 63;
4358 int size = INTVAL (operands[2]) & 63;
4360 if (start + size >= 64)
4361 operands[3] = const0_rtx;
4363 operands[3] = GEN_INT (start + size);
4364 operands[2] = GEN_INT (64 - size);
4365 return \"rldicl. %4,%1,%3,%2\";
4367 [(set_attr "type" "compare")])
4369 (define_insn "*extzvdi_internal2"
4370 [(set (match_operand:CC 4 "gpc_reg_operand" "=x")
4371 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4372 (match_operand:SI 2 "const_int_operand" "i")
4373 (match_operand:SI 3 "const_int_operand" "i"))
4375 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
4376 (zero_extract:DI (match_dup 1) (match_dup 2) (match_dup 3)))]
4377 "TARGET_64BIT && rs6000_gen_cell_microcode"
4380 int start = INTVAL (operands[3]) & 63;
4381 int size = INTVAL (operands[2]) & 63;
4383 if (start + size >= 64)
4384 operands[3] = const0_rtx;
4386 operands[3] = GEN_INT (start + size);
4387 operands[2] = GEN_INT (64 - size);
4388 return \"rldicl. %0,%1,%3,%2\";
4390 [(set_attr "type" "compare")])
4392 (define_insn "rotlsi3"
4393 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4394 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4395 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
4398 {rlnm|rlwnm} %0,%1,%2,0xffffffff
4399 {rlinm|rlwinm} %0,%1,%h2,0xffffffff"
4400 [(set_attr "type" "var_shift_rotate,integer")])
4402 (define_insn "*rotlsi3_64"
4403 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
4405 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4406 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))))]
4409 {rlnm|rlwnm} %0,%1,%2,0xffffffff
4410 {rlinm|rlwinm} %0,%1,%h2,0xffffffff"
4411 [(set_attr "type" "var_shift_rotate,integer")])
4413 (define_insn "*rotlsi3_internal2"
4414 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4415 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4416 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4418 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4421 {rlnm.|rlwnm.} %3,%1,%2,0xffffffff
4422 {rlinm.|rlwinm.} %3,%1,%h2,0xffffffff
4425 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4426 (set_attr "length" "4,4,8,8")])
4429 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4430 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4431 (match_operand:SI 2 "reg_or_cint_operand" ""))
4433 (clobber (match_scratch:SI 3 ""))]
4436 (rotate:SI (match_dup 1) (match_dup 2)))
4438 (compare:CC (match_dup 3)
4442 (define_insn "*rotlsi3_internal3"
4443 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4444 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4445 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4447 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4448 (rotate:SI (match_dup 1) (match_dup 2)))]
4451 {rlnm.|rlwnm.} %0,%1,%2,0xffffffff
4452 {rlinm.|rlwinm.} %0,%1,%h2,0xffffffff
4455 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4456 (set_attr "length" "4,4,8,8")])
4459 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4460 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4461 (match_operand:SI 2 "reg_or_cint_operand" ""))
4463 (set (match_operand:SI 0 "gpc_reg_operand" "")
4464 (rotate:SI (match_dup 1) (match_dup 2)))]
4467 (rotate:SI (match_dup 1) (match_dup 2)))
4469 (compare:CC (match_dup 0)
4473 (define_insn "*rotlsi3_internal4"
4474 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4475 (and:SI (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4476 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
4477 (match_operand:SI 3 "mask_operand" "n,n")))]
4480 {rlnm|rlwnm} %0,%1,%2,%m3,%M3
4481 {rlinm|rlwinm} %0,%1,%h2,%m3,%M3"
4482 [(set_attr "type" "var_shift_rotate,integer")])
4484 (define_insn "*rotlsi3_internal5"
4485 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4487 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4488 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4489 (match_operand:SI 3 "mask_operand" "n,n,n,n"))
4491 (clobber (match_scratch:SI 4 "=r,r,r,r"))]
4494 {rlnm.|rlwnm.} %4,%1,%2,%m3,%M3
4495 {rlinm.|rlwinm.} %4,%1,%h2,%m3,%M3
4498 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4499 (set_attr "length" "4,4,8,8")])
4502 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4504 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4505 (match_operand:SI 2 "reg_or_cint_operand" ""))
4506 (match_operand:SI 3 "mask_operand" ""))
4508 (clobber (match_scratch:SI 4 ""))]
4511 (and:SI (rotate:SI (match_dup 1)
4515 (compare:CC (match_dup 4)
4519 (define_insn "*rotlsi3_internal6"
4520 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
4522 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4523 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4524 (match_operand:SI 3 "mask_operand" "n,n,n,n"))
4526 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4527 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4530 {rlnm.|rlwnm.} %0,%1,%2,%m3,%M3
4531 {rlinm.|rlwinm.} %0,%1,%h2,%m3,%M3
4534 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4535 (set_attr "length" "4,4,8,8")])
4538 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
4540 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4541 (match_operand:SI 2 "reg_or_cint_operand" ""))
4542 (match_operand:SI 3 "mask_operand" ""))
4544 (set (match_operand:SI 0 "gpc_reg_operand" "")
4545 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4548 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4550 (compare:CC (match_dup 0)
4554 (define_insn "*rotlsi3_internal7"
4555 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4558 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4559 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
4561 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xff"
4562 [(set (attr "cell_micro")
4563 (if_then_else (match_operand:SI 2 "const_int_operand" "")
4564 (const_string "not")
4565 (const_string "always")))])
4567 (define_insn "*rotlsi3_internal8"
4568 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4569 (compare:CC (zero_extend:SI
4571 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4572 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4574 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4577 {rlnm.|rlwnm.} %3,%1,%2,0xff
4578 {rlinm.|rlwinm.} %3,%1,%h2,0xff
4581 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4582 (set_attr "length" "4,4,8,8")])
4585 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4586 (compare:CC (zero_extend:SI
4588 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4589 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4591 (clobber (match_scratch:SI 3 ""))]
4594 (zero_extend:SI (subreg:QI
4595 (rotate:SI (match_dup 1)
4598 (compare:CC (match_dup 3)
4602 (define_insn "*rotlsi3_internal9"
4603 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4604 (compare:CC (zero_extend:SI
4606 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4607 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4609 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4610 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4613 {rlnm.|rlwnm.} %0,%1,%2,0xff
4614 {rlinm.|rlwinm.} %0,%1,%h2,0xff
4617 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4618 (set_attr "length" "4,4,8,8")])
4621 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4622 (compare:CC (zero_extend:SI
4624 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4625 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4627 (set (match_operand:SI 0 "gpc_reg_operand" "")
4628 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4631 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
4633 (compare:CC (match_dup 0)
4637 (define_insn "*rotlsi3_internal10"
4638 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4641 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4642 (match_operand:SI 2 "reg_or_cint_operand" "r,i")) 0)))]
4645 {rlnm|rlwnm} %0,%1,%2,0xffff
4646 {rlinm|rlwinm} %0,%1,%h2,0xffff"
4647 [(set_attr "type" "var_shift_rotate,integer")])
4650 (define_insn "*rotlsi3_internal11"
4651 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4652 (compare:CC (zero_extend:SI
4654 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4655 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4657 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4660 {rlnm.|rlwnm.} %3,%1,%2,0xffff
4661 {rlinm.|rlwinm.} %3,%1,%h2,0xffff
4664 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4665 (set_attr "length" "4,4,8,8")])
4668 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4669 (compare:CC (zero_extend:SI
4671 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4672 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4674 (clobber (match_scratch:SI 3 ""))]
4677 (zero_extend:SI (subreg:HI
4678 (rotate:SI (match_dup 1)
4681 (compare:CC (match_dup 3)
4685 (define_insn "*rotlsi3_internal12"
4686 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4687 (compare:CC (zero_extend:SI
4689 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4690 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4692 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4693 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4696 {rlnm.|rlwnm.} %0,%1,%2,0xffff
4697 {rlinm.|rlwinm.} %0,%1,%h2,0xffff
4700 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4701 (set_attr "length" "4,4,8,8")])
4704 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4705 (compare:CC (zero_extend:SI
4707 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4708 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4710 (set (match_operand:SI 0 "gpc_reg_operand" "")
4711 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4714 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
4716 (compare:CC (match_dup 0)
4720 ;; Note that we use "sle." instead of "sl." so that we can set
4721 ;; SHIFT_COUNT_TRUNCATED.
4723 (define_expand "ashlsi3"
4724 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
4725 (use (match_operand:SI 1 "gpc_reg_operand" ""))
4726 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
4731 emit_insn (gen_ashlsi3_power (operands[0], operands[1], operands[2]));
4733 emit_insn (gen_ashlsi3_no_power (operands[0], operands[1], operands[2]));
4737 (define_insn "ashlsi3_power"
4738 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4739 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4740 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
4741 (clobber (match_scratch:SI 3 "=q,X"))]
4745 {sli|slwi} %0,%1,%h2")
4747 (define_insn "ashlsi3_no_power"
4748 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4749 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4750 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
4754 {sli|slwi} %0,%1,%h2"
4755 [(set_attr "type" "var_shift_rotate,shift")])
4757 (define_insn "*ashlsi3_64"
4758 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
4760 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4761 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))))]
4765 {sli|slwi} %0,%1,%h2"
4766 [(set_attr "type" "var_shift_rotate,shift")])
4769 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4770 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4771 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4773 (clobber (match_scratch:SI 3 "=r,r,r,r"))
4774 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4778 {sli.|slwi.} %3,%1,%h2
4781 [(set_attr "type" "delayed_compare")
4782 (set_attr "length" "4,4,8,8")])
4785 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4786 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4787 (match_operand:SI 2 "reg_or_cint_operand" ""))
4789 (clobber (match_scratch:SI 3 ""))
4790 (clobber (match_scratch:SI 4 ""))]
4791 "TARGET_POWER && reload_completed"
4792 [(parallel [(set (match_dup 3)
4793 (ashift:SI (match_dup 1) (match_dup 2)))
4794 (clobber (match_dup 4))])
4796 (compare:CC (match_dup 3)
4801 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4802 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4803 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4805 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4806 "! TARGET_POWER && TARGET_32BIT"
4809 {sli.|slwi.} %3,%1,%h2
4812 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4813 (set_attr "length" "4,4,8,8")])
4816 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4817 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4818 (match_operand:SI 2 "reg_or_cint_operand" ""))
4820 (clobber (match_scratch:SI 3 ""))]
4821 "! TARGET_POWER && TARGET_32BIT && reload_completed"
4823 (ashift:SI (match_dup 1) (match_dup 2)))
4825 (compare:CC (match_dup 3)
4830 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4831 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4832 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4834 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4835 (ashift:SI (match_dup 1) (match_dup 2)))
4836 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4840 {sli.|slwi.} %0,%1,%h2
4843 [(set_attr "type" "delayed_compare")
4844 (set_attr "length" "4,4,8,8")])
4847 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4848 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4849 (match_operand:SI 2 "reg_or_cint_operand" ""))
4851 (set (match_operand:SI 0 "gpc_reg_operand" "")
4852 (ashift:SI (match_dup 1) (match_dup 2)))
4853 (clobber (match_scratch:SI 4 ""))]
4854 "TARGET_POWER && reload_completed"
4855 [(parallel [(set (match_dup 0)
4856 (ashift:SI (match_dup 1) (match_dup 2)))
4857 (clobber (match_dup 4))])
4859 (compare:CC (match_dup 0)
4864 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4865 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4866 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4868 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4869 (ashift:SI (match_dup 1) (match_dup 2)))]
4870 "! TARGET_POWER && TARGET_32BIT"
4873 {sli.|slwi.} %0,%1,%h2
4876 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4877 (set_attr "length" "4,4,8,8")])
4880 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4881 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4882 (match_operand:SI 2 "reg_or_cint_operand" ""))
4884 (set (match_operand:SI 0 "gpc_reg_operand" "")
4885 (ashift:SI (match_dup 1) (match_dup 2)))]
4886 "! TARGET_POWER && TARGET_32BIT && reload_completed"
4888 (ashift:SI (match_dup 1) (match_dup 2)))
4890 (compare:CC (match_dup 0)
4894 (define_insn "rlwinm"
4895 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4896 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4897 (match_operand:SI 2 "const_int_operand" "i"))
4898 (match_operand:SI 3 "mask_operand" "n")))]
4899 "includes_lshift_p (operands[2], operands[3])"
4900 "{rlinm|rlwinm} %0,%1,%h2,%m3,%M3")
4903 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4905 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4906 (match_operand:SI 2 "const_int_operand" "i,i"))
4907 (match_operand:SI 3 "mask_operand" "n,n"))
4909 (clobber (match_scratch:SI 4 "=r,r"))]
4910 "includes_lshift_p (operands[2], operands[3])"
4912 {rlinm.|rlwinm.} %4,%1,%h2,%m3,%M3
4914 [(set_attr "type" "delayed_compare")
4915 (set_attr "length" "4,8")])
4918 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4920 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4921 (match_operand:SI 2 "const_int_operand" ""))
4922 (match_operand:SI 3 "mask_operand" ""))
4924 (clobber (match_scratch:SI 4 ""))]
4925 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
4927 (and:SI (ashift:SI (match_dup 1) (match_dup 2))
4930 (compare:CC (match_dup 4)
4935 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4937 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4938 (match_operand:SI 2 "const_int_operand" "i,i"))
4939 (match_operand:SI 3 "mask_operand" "n,n"))
4941 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4942 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4943 "includes_lshift_p (operands[2], operands[3])"
4945 {rlinm.|rlwinm.} %0,%1,%h2,%m3,%M3
4947 [(set_attr "type" "delayed_compare")
4948 (set_attr "length" "4,8")])
4951 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
4953 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4954 (match_operand:SI 2 "const_int_operand" ""))
4955 (match_operand:SI 3 "mask_operand" ""))
4957 (set (match_operand:SI 0 "gpc_reg_operand" "")
4958 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4959 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
4961 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4963 (compare:CC (match_dup 0)
4967 ;; The AIX assembler mis-handles "sri x,x,0", so write that case as
4969 (define_expand "lshrsi3"
4970 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
4971 (use (match_operand:SI 1 "gpc_reg_operand" ""))
4972 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
4977 emit_insn (gen_lshrsi3_power (operands[0], operands[1], operands[2]));
4979 emit_insn (gen_lshrsi3_no_power (operands[0], operands[1], operands[2]));
4983 (define_insn "lshrsi3_power"
4984 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
4985 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
4986 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i")))
4987 (clobber (match_scratch:SI 3 "=q,X,X"))]
4992 {s%A2i|s%A2wi} %0,%1,%h2")
4994 (define_insn "lshrsi3_no_power"
4995 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
4996 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
4997 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i")))]
5002 {sri|srwi} %0,%1,%h2"
5003 [(set_attr "type" "integer,var_shift_rotate,shift")])
5005 (define_insn "*lshrsi3_64"
5006 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
5008 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5009 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))))]
5013 {sri|srwi} %0,%1,%h2"
5014 [(set_attr "type" "var_shift_rotate,shift")])
5017 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,?y,?y,?y")
5018 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
5019 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
5021 (clobber (match_scratch:SI 3 "=r,X,r,r,X,r"))
5022 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
5027 {s%A2i.|s%A2wi.} %3,%1,%h2
5031 [(set_attr "type" "delayed_compare")
5032 (set_attr "length" "4,4,4,8,8,8")])
5035 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
5036 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5037 (match_operand:SI 2 "reg_or_cint_operand" ""))
5039 (clobber (match_scratch:SI 3 ""))
5040 (clobber (match_scratch:SI 4 ""))]
5041 "TARGET_POWER && reload_completed"
5042 [(parallel [(set (match_dup 3)
5043 (lshiftrt:SI (match_dup 1) (match_dup 2)))
5044 (clobber (match_dup 4))])
5046 (compare:CC (match_dup 3)
5051 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,?y,?y,?y")
5052 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
5053 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i,O,r,i"))
5055 (clobber (match_scratch:SI 3 "=X,r,r,X,r,r"))]
5056 "! TARGET_POWER && TARGET_32BIT"
5060 {sri.|srwi.} %3,%1,%h2
5064 [(set_attr "type" "delayed_compare,var_delayed_compare,delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
5065 (set_attr "length" "4,4,4,8,8,8")])
5068 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
5069 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5070 (match_operand:SI 2 "reg_or_cint_operand" ""))
5072 (clobber (match_scratch:SI 3 ""))]
5073 "! TARGET_POWER && TARGET_32BIT && reload_completed"
5075 (lshiftrt:SI (match_dup 1) (match_dup 2)))
5077 (compare:CC (match_dup 3)
5082 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,?y,?y,?y")
5083 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
5084 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
5086 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
5087 (lshiftrt:SI (match_dup 1) (match_dup 2)))
5088 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
5093 {s%A2i.|s%A2wi.} %0,%1,%h2
5097 [(set_attr "type" "delayed_compare")
5098 (set_attr "length" "4,4,4,8,8,8")])
5101 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
5102 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5103 (match_operand:SI 2 "reg_or_cint_operand" ""))
5105 (set (match_operand:SI 0 "gpc_reg_operand" "")
5106 (lshiftrt:SI (match_dup 1) (match_dup 2)))
5107 (clobber (match_scratch:SI 4 ""))]
5108 "TARGET_POWER && reload_completed"
5109 [(parallel [(set (match_dup 0)
5110 (lshiftrt:SI (match_dup 1) (match_dup 2)))
5111 (clobber (match_dup 4))])
5113 (compare:CC (match_dup 0)
5118 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,?y,?y,?y")
5119 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
5120 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i,O,r,i"))
5122 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
5123 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
5124 "! TARGET_POWER && TARGET_32BIT"
5128 {sri.|srwi.} %0,%1,%h2
5132 [(set_attr "type" "delayed_compare,var_delayed_compare,delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
5133 (set_attr "length" "4,4,4,8,8,8")])
5136 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
5137 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5138 (match_operand:SI 2 "reg_or_cint_operand" ""))
5140 (set (match_operand:SI 0 "gpc_reg_operand" "")
5141 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
5142 "! TARGET_POWER && TARGET_32BIT && reload_completed"
5144 (lshiftrt:SI (match_dup 1) (match_dup 2)))
5146 (compare:CC (match_dup 0)
5151 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5152 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
5153 (match_operand:SI 2 "const_int_operand" "i"))
5154 (match_operand:SI 3 "mask_operand" "n")))]
5155 "includes_rshift_p (operands[2], operands[3])"
5156 "{rlinm|rlwinm} %0,%1,%s2,%m3,%M3")
5159 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
5161 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5162 (match_operand:SI 2 "const_int_operand" "i,i"))
5163 (match_operand:SI 3 "mask_operand" "n,n"))
5165 (clobber (match_scratch:SI 4 "=r,r"))]
5166 "includes_rshift_p (operands[2], operands[3])"
5168 {rlinm.|rlwinm.} %4,%1,%s2,%m3,%M3
5170 [(set_attr "type" "delayed_compare")
5171 (set_attr "length" "4,8")])
5174 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
5176 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5177 (match_operand:SI 2 "const_int_operand" ""))
5178 (match_operand:SI 3 "mask_operand" ""))
5180 (clobber (match_scratch:SI 4 ""))]
5181 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
5183 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2))
5186 (compare:CC (match_dup 4)
5191 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
5193 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5194 (match_operand:SI 2 "const_int_operand" "i,i"))
5195 (match_operand:SI 3 "mask_operand" "n,n"))
5197 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
5198 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
5199 "includes_rshift_p (operands[2], operands[3])"
5201 {rlinm.|rlwinm.} %0,%1,%s2,%m3,%M3
5203 [(set_attr "type" "delayed_compare")
5204 (set_attr "length" "4,8")])
5207 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
5209 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5210 (match_operand:SI 2 "const_int_operand" ""))
5211 (match_operand:SI 3 "mask_operand" ""))
5213 (set (match_operand:SI 0 "gpc_reg_operand" "")
5214 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
5215 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
5217 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
5219 (compare:CC (match_dup 0)
5224 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5227 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
5228 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
5229 "includes_rshift_p (operands[2], GEN_INT (255))"
5230 "{rlinm|rlwinm} %0,%1,%s2,0xff")
5233 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
5237 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5238 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
5240 (clobber (match_scratch:SI 3 "=r,r"))]
5241 "includes_rshift_p (operands[2], GEN_INT (255))"
5243 {rlinm.|rlwinm.} %3,%1,%s2,0xff
5245 [(set_attr "type" "delayed_compare")
5246 (set_attr "length" "4,8")])
5249 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
5253 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5254 (match_operand:SI 2 "const_int_operand" "")) 0))
5256 (clobber (match_scratch:SI 3 ""))]
5257 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
5259 (zero_extend:SI (subreg:QI
5260 (lshiftrt:SI (match_dup 1)
5263 (compare:CC (match_dup 3)
5268 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
5272 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5273 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
5275 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
5276 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
5277 "includes_rshift_p (operands[2], GEN_INT (255))"
5279 {rlinm.|rlwinm.} %0,%1,%s2,0xff
5281 [(set_attr "type" "delayed_compare")
5282 (set_attr "length" "4,8")])
5285 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
5289 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5290 (match_operand:SI 2 "const_int_operand" "")) 0))
5292 (set (match_operand:SI 0 "gpc_reg_operand" "")
5293 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
5294 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
5296 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
5298 (compare:CC (match_dup 0)
5303 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5306 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
5307 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
5308 "includes_rshift_p (operands[2], GEN_INT (65535))"
5309 "{rlinm|rlwinm} %0,%1,%s2,0xffff")
5312 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
5316 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5317 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
5319 (clobber (match_scratch:SI 3 "=r,r"))]
5320 "includes_rshift_p (operands[2], GEN_INT (65535))"
5322 {rlinm.|rlwinm.} %3,%1,%s2,0xffff
5324 [(set_attr "type" "delayed_compare")
5325 (set_attr "length" "4,8")])
5328 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
5332 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5333 (match_operand:SI 2 "const_int_operand" "")) 0))
5335 (clobber (match_scratch:SI 3 ""))]
5336 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
5338 (zero_extend:SI (subreg:HI
5339 (lshiftrt:SI (match_dup 1)
5342 (compare:CC (match_dup 3)
5347 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
5351 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5352 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
5354 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
5355 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
5356 "includes_rshift_p (operands[2], GEN_INT (65535))"
5358 {rlinm.|rlwinm.} %0,%1,%s2,0xffff
5360 [(set_attr "type" "delayed_compare")
5361 (set_attr "length" "4,8")])
5364 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
5368 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5369 (match_operand:SI 2 "const_int_operand" "")) 0))
5371 (set (match_operand:SI 0 "gpc_reg_operand" "")
5372 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
5373 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
5375 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
5377 (compare:CC (match_dup 0)
5382 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
5384 (match_operand:SI 1 "gpc_reg_operand" "r"))
5385 (ashiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
5391 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
5393 (match_operand:SI 1 "gpc_reg_operand" "r"))
5394 (lshiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
5400 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
5402 (match_operand:SI 1 "gpc_reg_operand" "r"))
5403 (zero_extract:SI (match_operand:SI 2 "gpc_reg_operand" "r")
5409 (define_expand "ashrsi3"
5410 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5411 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5412 (match_operand:SI 2 "reg_or_cint_operand" "")))]
5417 emit_insn (gen_ashrsi3_power (operands[0], operands[1], operands[2]));
5419 emit_insn (gen_ashrsi3_no_power (operands[0], operands[1], operands[2]));
5423 (define_insn "ashrsi3_power"
5424 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
5425 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5426 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
5427 (clobber (match_scratch:SI 3 "=q,X"))]
5431 {srai|srawi} %0,%1,%h2"
5432 [(set_attr "type" "shift")])
5434 (define_insn "ashrsi3_no_power"
5435 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
5436 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5437 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
5441 {srai|srawi} %0,%1,%h2"
5442 [(set_attr "type" "var_shift_rotate,shift")])
5444 (define_insn "*ashrsi3_64"
5445 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
5447 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5448 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))))]
5452 {srai|srawi} %0,%1,%h2"
5453 [(set_attr "type" "var_shift_rotate,shift")])
5456 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
5457 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
5458 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
5460 (clobber (match_scratch:SI 3 "=r,r,r,r"))
5461 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
5465 {srai.|srawi.} %3,%1,%h2
5468 [(set_attr "type" "delayed_compare")
5469 (set_attr "length" "4,4,8,8")])
5472 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
5473 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5474 (match_operand:SI 2 "reg_or_cint_operand" ""))
5476 (clobber (match_scratch:SI 3 ""))
5477 (clobber (match_scratch:SI 4 ""))]
5478 "TARGET_POWER && reload_completed"
5479 [(parallel [(set (match_dup 3)
5480 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5481 (clobber (match_dup 4))])
5483 (compare:CC (match_dup 3)
5488 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
5489 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
5490 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
5492 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
5495 {sra.|sraw.} %3,%1,%2
5496 {srai.|srawi.} %3,%1,%h2
5499 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
5500 (set_attr "length" "4,4,8,8")])
5503 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
5504 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5505 (match_operand:SI 2 "reg_or_cint_operand" ""))
5507 (clobber (match_scratch:SI 3 ""))]
5508 "! TARGET_POWER && reload_completed"
5510 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5512 (compare:CC (match_dup 3)
5517 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
5518 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
5519 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
5521 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
5522 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5523 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
5527 {srai.|srawi.} %0,%1,%h2
5530 [(set_attr "type" "delayed_compare")
5531 (set_attr "length" "4,4,8,8")])
5534 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
5535 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5536 (match_operand:SI 2 "reg_or_cint_operand" ""))
5538 (set (match_operand:SI 0 "gpc_reg_operand" "")
5539 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5540 (clobber (match_scratch:SI 4 ""))]
5541 "TARGET_POWER && reload_completed"
5542 [(parallel [(set (match_dup 0)
5543 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5544 (clobber (match_dup 4))])
5546 (compare:CC (match_dup 0)
5551 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
5552 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
5553 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
5555 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
5556 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
5559 {sra.|sraw.} %0,%1,%2
5560 {srai.|srawi.} %0,%1,%h2
5563 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
5564 (set_attr "length" "4,4,8,8")])
5567 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
5568 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5569 (match_operand:SI 2 "reg_or_cint_operand" ""))
5571 (set (match_operand:SI 0 "gpc_reg_operand" "")
5572 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
5573 "! TARGET_POWER && reload_completed"
5575 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5577 (compare:CC (match_dup 0)
5581 ;; Floating-point insns, excluding normal data motion.
5583 ;; PowerPC has a full set of single-precision floating point instructions.
5585 ;; For the POWER architecture, we pretend that we have both SFmode and
5586 ;; DFmode insns, while, in fact, all fp insns are actually done in double.
5587 ;; The only conversions we will do will be when storing to memory. In that
5588 ;; case, we will use the "frsp" instruction before storing.
5590 ;; Note that when we store into a single-precision memory location, we need to
5591 ;; use the frsp insn first. If the register being stored isn't dead, we
5592 ;; need a scratch register for the frsp. But this is difficult when the store
5593 ;; is done by reload. It is not incorrect to do the frsp on the register in
5594 ;; this case, we just lose precision that we would have otherwise gotten but
5595 ;; is not guaranteed. Perhaps this should be tightened up at some point.
5597 (define_expand "extendsfdf2"
5598 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5599 (float_extend:DF (match_operand:SF 1 "reg_or_none500mem_operand" "")))]
5600 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5603 (define_insn_and_split "*extendsfdf2_fpr"
5604 [(set (match_operand:DF 0 "gpc_reg_operand" "=d,?d,d")
5605 (float_extend:DF (match_operand:SF 1 "reg_or_mem_operand" "0,f,m")))]
5606 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5611 "&& reload_completed && REG_P (operands[1]) && REGNO (operands[0]) == REGNO (operands[1])"
5614 emit_note (NOTE_INSN_DELETED);
5617 [(set_attr "type" "fp,fp,fpload")])
5619 (define_expand "truncdfsf2"
5620 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5621 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "")))]
5622 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5625 (define_insn "*truncdfsf2_fpr"
5626 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5627 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "d")))]
5628 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5630 [(set_attr "type" "fp")])
5632 (define_insn "aux_truncdfsf2"
5633 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5634 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRSP))]
5635 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5637 [(set_attr "type" "fp")])
5639 (define_expand "negsf2"
5640 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5641 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
5642 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
5645 (define_insn "*negsf2"
5646 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5647 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5648 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5650 [(set_attr "type" "fp")])
5652 (define_expand "abssf2"
5653 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5654 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
5655 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
5658 (define_insn "*abssf2"
5659 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5660 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5661 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5663 [(set_attr "type" "fp")])
5666 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5667 (neg:SF (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f"))))]
5668 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5670 [(set_attr "type" "fp")])
5672 (define_expand "addsf3"
5673 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5674 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "")
5675 (match_operand:SF 2 "gpc_reg_operand" "")))]
5676 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
5680 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5681 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5682 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5683 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5685 [(set_attr "type" "fp")
5686 (set_attr "fp_type" "fp_addsub_s")])
5689 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5690 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5691 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5692 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5693 "{fa|fadd} %0,%1,%2"
5694 [(set_attr "type" "fp")])
5696 (define_expand "subsf3"
5697 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5698 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "")
5699 (match_operand:SF 2 "gpc_reg_operand" "")))]
5700 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
5704 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5705 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5706 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5707 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5709 [(set_attr "type" "fp")
5710 (set_attr "fp_type" "fp_addsub_s")])
5713 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5714 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5715 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5716 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5717 "{fs|fsub} %0,%1,%2"
5718 [(set_attr "type" "fp")])
5720 (define_expand "mulsf3"
5721 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5722 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "")
5723 (match_operand:SF 2 "gpc_reg_operand" "")))]
5724 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
5728 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5729 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5730 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5731 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5733 [(set_attr "type" "fp")
5734 (set_attr "fp_type" "fp_mul_s")])
5737 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5738 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5739 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5740 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5741 "{fm|fmul} %0,%1,%2"
5742 [(set_attr "type" "dmul")])
5744 (define_expand "divsf3"
5745 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5746 (div:SF (match_operand:SF 1 "gpc_reg_operand" "")
5747 (match_operand:SF 2 "gpc_reg_operand" "")))]
5748 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
5752 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5753 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5754 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5755 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS
5756 && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
5758 [(set_attr "type" "sdiv")])
5761 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5762 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5763 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5764 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS
5765 && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
5766 "{fd|fdiv} %0,%1,%2"
5767 [(set_attr "type" "ddiv")])
5769 (define_expand "recipsf3"
5770 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5771 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")
5772 (match_operand:SF 2 "gpc_reg_operand" "f")]
5774 "TARGET_RECIP && TARGET_HARD_FLOAT && TARGET_PPC_GFXOPT && !optimize_size
5775 && flag_finite_math_only && !flag_trapping_math"
5777 rs6000_emit_swdivsf (operands[0], operands[1], operands[2]);
5782 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5783 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))]
5784 "TARGET_PPC_GFXOPT && flag_finite_math_only"
5786 [(set_attr "type" "fp")])
5788 (define_insn "*fmaddsf4_powerpc"
5789 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5790 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5791 (match_operand:SF 2 "gpc_reg_operand" "f"))
5792 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5793 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS
5794 && TARGET_SINGLE_FLOAT && TARGET_FUSED_MADD"
5795 "fmadds %0,%1,%2,%3"
5796 [(set_attr "type" "fp")
5797 (set_attr "fp_type" "fp_maddsub_s")])
5799 (define_insn "*fmaddsf4_power"
5800 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5801 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5802 (match_operand:SF 2 "gpc_reg_operand" "f"))
5803 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5804 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5805 "{fma|fmadd} %0,%1,%2,%3"
5806 [(set_attr "type" "dmul")])
5808 (define_insn "*fmsubsf4_powerpc"
5809 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5810 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5811 (match_operand:SF 2 "gpc_reg_operand" "f"))
5812 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5813 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS
5814 && TARGET_SINGLE_FLOAT && TARGET_FUSED_MADD"
5815 "fmsubs %0,%1,%2,%3"
5816 [(set_attr "type" "fp")
5817 (set_attr "fp_type" "fp_maddsub_s")])
5819 (define_insn "*fmsubsf4_power"
5820 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5821 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5822 (match_operand:SF 2 "gpc_reg_operand" "f"))
5823 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5824 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5825 "{fms|fmsub} %0,%1,%2,%3"
5826 [(set_attr "type" "dmul")])
5828 (define_insn "*fnmaddsf4_powerpc_1"
5829 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5830 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5831 (match_operand:SF 2 "gpc_reg_operand" "f"))
5832 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5833 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5834 && TARGET_SINGLE_FLOAT"
5835 "fnmadds %0,%1,%2,%3"
5836 [(set_attr "type" "fp")
5837 (set_attr "fp_type" "fp_maddsub_s")])
5839 (define_insn "*fnmaddsf4_powerpc_2"
5840 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5841 (minus:SF (mult:SF (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f"))
5842 (match_operand:SF 2 "gpc_reg_operand" "f"))
5843 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5844 "TARGET_POWERPC && TARGET_SINGLE_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5845 && ! HONOR_SIGNED_ZEROS (SFmode)"
5846 "fnmadds %0,%1,%2,%3"
5847 [(set_attr "type" "fp")
5848 (set_attr "fp_type" "fp_maddsub_s")])
5850 (define_insn "*fnmaddsf4_power_1"
5851 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5852 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5853 (match_operand:SF 2 "gpc_reg_operand" "f"))
5854 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5855 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5856 "{fnma|fnmadd} %0,%1,%2,%3"
5857 [(set_attr "type" "dmul")])
5859 (define_insn "*fnmaddsf4_power_2"
5860 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5861 (minus:SF (mult:SF (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f"))
5862 (match_operand:SF 2 "gpc_reg_operand" "f"))
5863 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5864 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5865 && ! HONOR_SIGNED_ZEROS (SFmode)"
5866 "{fnma|fnmadd} %0,%1,%2,%3"
5867 [(set_attr "type" "dmul")])
5869 (define_insn "*fnmsubsf4_powerpc_1"
5870 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5871 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5872 (match_operand:SF 2 "gpc_reg_operand" "f"))
5873 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5874 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5875 && TARGET_SINGLE_FLOAT"
5876 "fnmsubs %0,%1,%2,%3"
5877 [(set_attr "type" "fp")
5878 (set_attr "fp_type" "fp_maddsub_s")])
5880 (define_insn "*fnmsubsf4_powerpc_2"
5881 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5882 (minus:SF (match_operand:SF 3 "gpc_reg_operand" "f")
5883 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5884 (match_operand:SF 2 "gpc_reg_operand" "f"))))]
5885 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5886 && TARGET_SINGLE_FLOAT && ! HONOR_SIGNED_ZEROS (SFmode)"
5887 "fnmsubs %0,%1,%2,%3"
5888 [(set_attr "type" "fp")
5889 (set_attr "fp_type" "fp_maddsub_s")])
5891 (define_insn "*fnmsubsf4_power_1"
5892 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5893 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5894 (match_operand:SF 2 "gpc_reg_operand" "f"))
5895 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5896 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5897 "{fnms|fnmsub} %0,%1,%2,%3"
5898 [(set_attr "type" "dmul")])
5900 (define_insn "*fnmsubsf4_power_2"
5901 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5902 (minus:SF (match_operand:SF 3 "gpc_reg_operand" "f")
5903 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5904 (match_operand:SF 2 "gpc_reg_operand" "f"))))]
5905 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5906 && ! HONOR_SIGNED_ZEROS (SFmode)"
5907 "{fnms|fnmsub} %0,%1,%2,%3"
5908 [(set_attr "type" "dmul")])
5910 (define_expand "sqrtsf2"
5911 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5912 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
5913 "(TARGET_PPC_GPOPT || TARGET_POWER2 || TARGET_XILINX_FPU)
5914 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
5915 && !TARGET_SIMPLE_FPU"
5919 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5920 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5921 "(TARGET_PPC_GPOPT || TARGET_XILINX_FPU) && TARGET_HARD_FLOAT
5922 && TARGET_FPRS && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
5924 [(set_attr "type" "ssqrt")])
5927 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5928 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5929 "TARGET_POWER2 && TARGET_HARD_FLOAT && TARGET_FPRS
5930 && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
5932 [(set_attr "type" "dsqrt")])
5934 (define_expand "rsqrtsf2"
5935 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5936 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")]
5938 "TARGET_RECIP && TARGET_HARD_FLOAT && TARGET_PPC_GFXOPT && !optimize_size
5939 && flag_finite_math_only && !flag_trapping_math"
5941 rs6000_emit_swrsqrtsf (operands[0], operands[1]);
5945 (define_insn "*rsqrt_internal1"
5946 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5947 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")]
5949 "TARGET_HARD_FLOAT && TARGET_PPC_GFXOPT"
5951 [(set_attr "type" "fp")])
5953 (define_expand "copysignsf3"
5955 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "")))
5957 (neg:SF (abs:SF (match_dup 1))))
5958 (set (match_operand:SF 0 "gpc_reg_operand" "")
5959 (if_then_else:SF (ge (match_operand:SF 2 "gpc_reg_operand" "")
5963 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
5964 && !HONOR_NANS (SFmode) && !HONOR_SIGNED_ZEROS (SFmode)"
5966 operands[3] = gen_reg_rtx (SFmode);
5967 operands[4] = gen_reg_rtx (SFmode);
5968 operands[5] = CONST0_RTX (SFmode);
5971 (define_expand "copysigndf3"
5973 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "")))
5975 (neg:DF (abs:DF (match_dup 1))))
5976 (set (match_operand:DF 0 "gpc_reg_operand" "")
5977 (if_then_else:DF (ge (match_operand:DF 2 "gpc_reg_operand" "")
5981 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5982 && ((TARGET_PPC_GFXOPT
5983 && !HONOR_NANS (DFmode)
5984 && !HONOR_SIGNED_ZEROS (DFmode))
5985 || VECTOR_UNIT_VSX_P (DFmode))"
5987 if (VECTOR_UNIT_VSX_P (DFmode))
5989 emit_insn (gen_vsx_copysigndf3 (operands[0], operands[1],
5990 operands[2], CONST0_RTX (DFmode)));
5993 operands[3] = gen_reg_rtx (DFmode);
5994 operands[4] = gen_reg_rtx (DFmode);
5995 operands[5] = CONST0_RTX (DFmode);
5998 ;; For MIN, MAX, and conditional move, we use DEFINE_EXPAND's that involve a
5999 ;; fsel instruction and some auxiliary computations. Then we just have a
6000 ;; single DEFINE_INSN for fsel and the define_splits to make them if made by
6002 (define_expand "smaxsf3"
6003 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6004 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
6005 (match_operand:SF 2 "gpc_reg_operand" ""))
6008 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
6009 && TARGET_SINGLE_FLOAT && !flag_trapping_math"
6010 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
6012 (define_expand "sminsf3"
6013 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6014 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
6015 (match_operand:SF 2 "gpc_reg_operand" ""))
6018 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
6019 && TARGET_SINGLE_FLOAT && !flag_trapping_math"
6020 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
6023 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6024 (match_operator:SF 3 "min_max_operator"
6025 [(match_operand:SF 1 "gpc_reg_operand" "")
6026 (match_operand:SF 2 "gpc_reg_operand" "")]))]
6027 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
6028 && TARGET_SINGLE_FLOAT && !flag_trapping_math"
6031 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
6032 operands[1], operands[2]);
6036 (define_expand "mov<mode>cc"
6037 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
6038 (if_then_else:GPR (match_operand 1 "comparison_operator" "")
6039 (match_operand:GPR 2 "gpc_reg_operand" "")
6040 (match_operand:GPR 3 "gpc_reg_operand" "")))]
6044 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
6050 ;; We use the BASE_REGS for the isel input operands because, if rA is
6051 ;; 0, the value of 0 is placed in rD upon truth. Similarly for rB
6052 ;; because we may switch the operands and rB may end up being rA.
6054 ;; We need 2 patterns: an unsigned and a signed pattern. We could
6055 ;; leave out the mode in operand 4 and use one pattern, but reload can
6056 ;; change the mode underneath our feet and then gets confused trying
6057 ;; to reload the value.
6058 (define_insn "isel_signed_<mode>"
6059 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
6061 (match_operator 1 "comparison_operator"
6062 [(match_operand:CC 4 "cc_reg_operand" "y")
6064 (match_operand:GPR 2 "gpc_reg_operand" "b")
6065 (match_operand:GPR 3 "gpc_reg_operand" "b")))]
6068 { return output_isel (operands); }"
6069 [(set_attr "type" "isel")
6070 (set_attr "length" "4")])
6072 (define_insn "isel_unsigned_<mode>"
6073 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
6075 (match_operator 1 "comparison_operator"
6076 [(match_operand:CCUNS 4 "cc_reg_operand" "y")
6078 (match_operand:GPR 2 "gpc_reg_operand" "b")
6079 (match_operand:GPR 3 "gpc_reg_operand" "b")))]
6082 { return output_isel (operands); }"
6083 [(set_attr "type" "isel")
6084 (set_attr "length" "4")])
6086 (define_expand "movsfcc"
6087 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6088 (if_then_else:SF (match_operand 1 "comparison_operator" "")
6089 (match_operand:SF 2 "gpc_reg_operand" "")
6090 (match_operand:SF 3 "gpc_reg_operand" "")))]
6091 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
6094 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
6100 (define_insn "*fselsfsf4"
6101 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6102 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
6103 (match_operand:SF 4 "zero_fp_constant" "F"))
6104 (match_operand:SF 2 "gpc_reg_operand" "f")
6105 (match_operand:SF 3 "gpc_reg_operand" "f")))]
6106 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
6108 [(set_attr "type" "fp")])
6110 (define_insn "*fseldfsf4"
6111 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6112 (if_then_else:SF (ge (match_operand:DF 1 "gpc_reg_operand" "d")
6113 (match_operand:DF 4 "zero_fp_constant" "F"))
6114 (match_operand:SF 2 "gpc_reg_operand" "f")
6115 (match_operand:SF 3 "gpc_reg_operand" "f")))]
6116 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_SINGLE_FLOAT"
6118 [(set_attr "type" "fp")])
6120 (define_expand "negdf2"
6121 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6122 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
6123 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6126 (define_insn "*negdf2_fpr"
6127 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6128 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "d")))]
6129 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6130 && !VECTOR_UNIT_VSX_P (DFmode)"
6132 [(set_attr "type" "fp")])
6134 (define_expand "absdf2"
6135 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6136 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
6137 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6140 (define_insn "*absdf2_fpr"
6141 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6142 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "d")))]
6143 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6144 && !VECTOR_UNIT_VSX_P (DFmode)"
6146 [(set_attr "type" "fp")])
6148 (define_insn "*nabsdf2_fpr"
6149 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6150 (neg:DF (abs:DF (match_operand:DF 1 "gpc_reg_operand" "d"))))]
6151 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6152 && !VECTOR_UNIT_VSX_P (DFmode)"
6154 [(set_attr "type" "fp")])
6156 (define_expand "adddf3"
6157 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6158 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "")
6159 (match_operand:DF 2 "gpc_reg_operand" "")))]
6160 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6163 (define_insn "*adddf3_fpr"
6164 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6165 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
6166 (match_operand:DF 2 "gpc_reg_operand" "d")))]
6167 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6168 && !VECTOR_UNIT_VSX_P (DFmode)"
6169 "{fa|fadd} %0,%1,%2"
6170 [(set_attr "type" "fp")
6171 (set_attr "fp_type" "fp_addsub_d")])
6173 (define_expand "subdf3"
6174 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6175 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "")
6176 (match_operand:DF 2 "gpc_reg_operand" "")))]
6177 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6180 (define_insn "*subdf3_fpr"
6181 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6182 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "d")
6183 (match_operand:DF 2 "gpc_reg_operand" "d")))]
6184 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6185 && !VECTOR_UNIT_VSX_P (DFmode)"
6186 "{fs|fsub} %0,%1,%2"
6187 [(set_attr "type" "fp")
6188 (set_attr "fp_type" "fp_addsub_d")])
6190 (define_expand "muldf3"
6191 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6192 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "")
6193 (match_operand:DF 2 "gpc_reg_operand" "")))]
6194 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6197 (define_insn "*muldf3_fpr"
6198 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6199 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
6200 (match_operand:DF 2 "gpc_reg_operand" "d")))]
6201 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6202 && !VECTOR_UNIT_VSX_P (DFmode)"
6203 "{fm|fmul} %0,%1,%2"
6204 [(set_attr "type" "dmul")
6205 (set_attr "fp_type" "fp_mul_d")])
6207 (define_expand "divdf3"
6208 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6209 (div:DF (match_operand:DF 1 "gpc_reg_operand" "")
6210 (match_operand:DF 2 "gpc_reg_operand" "")))]
6212 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)
6213 && !TARGET_SIMPLE_FPU"
6216 (define_insn "*divdf3_fpr"
6217 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6218 (div:DF (match_operand:DF 1 "gpc_reg_operand" "d")
6219 (match_operand:DF 2 "gpc_reg_operand" "d")))]
6220 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && !TARGET_SIMPLE_FPU
6221 && !VECTOR_UNIT_VSX_P (DFmode)"
6222 "{fd|fdiv} %0,%1,%2"
6223 [(set_attr "type" "ddiv")])
6225 (define_expand "recipdf3"
6226 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6227 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "d")
6228 (match_operand:DF 2 "gpc_reg_operand" "d")]
6230 "TARGET_RECIP && TARGET_HARD_FLOAT && TARGET_POPCNTB && !optimize_size
6231 && flag_finite_math_only && !flag_trapping_math"
6233 rs6000_emit_swdivdf (operands[0], operands[1], operands[2]);
6237 (define_expand "fred"
6238 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6239 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "d")] UNSPEC_FRES))]
6240 "(TARGET_POPCNTB || VECTOR_UNIT_VSX_P (DFmode)) && flag_finite_math_only"
6243 (define_insn "*fred_fpr"
6244 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6245 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))]
6246 "TARGET_POPCNTB && flag_finite_math_only && !VECTOR_UNIT_VSX_P (DFmode)"
6248 [(set_attr "type" "fp")])
6250 (define_insn "*fmadddf4_fpr"
6251 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6252 (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
6253 (match_operand:DF 2 "gpc_reg_operand" "d"))
6254 (match_operand:DF 3 "gpc_reg_operand" "d")))]
6255 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD && TARGET_DOUBLE_FLOAT
6256 && VECTOR_UNIT_NONE_P (DFmode)"
6257 "{fma|fmadd} %0,%1,%2,%3"
6258 [(set_attr "type" "dmul")
6259 (set_attr "fp_type" "fp_maddsub_d")])
6261 (define_insn "*fmsubdf4_fpr"
6262 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6263 (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
6264 (match_operand:DF 2 "gpc_reg_operand" "d"))
6265 (match_operand:DF 3 "gpc_reg_operand" "d")))]
6266 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD && TARGET_DOUBLE_FLOAT
6267 && VECTOR_UNIT_NONE_P (DFmode)"
6268 "{fms|fmsub} %0,%1,%2,%3"
6269 [(set_attr "type" "dmul")
6270 (set_attr "fp_type" "fp_maddsub_d")])
6272 (define_insn "*fnmadddf4_fpr_1"
6273 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6274 (neg:DF (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
6275 (match_operand:DF 2 "gpc_reg_operand" "d"))
6276 (match_operand:DF 3 "gpc_reg_operand" "d"))))]
6277 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD && TARGET_DOUBLE_FLOAT
6278 && VECTOR_UNIT_NONE_P (DFmode)"
6279 "{fnma|fnmadd} %0,%1,%2,%3"
6280 [(set_attr "type" "dmul")
6281 (set_attr "fp_type" "fp_maddsub_d")])
6283 (define_insn "*fnmadddf4_fpr_2"
6284 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6285 (minus:DF (mult:DF (neg:DF (match_operand:DF 1 "gpc_reg_operand" "d"))
6286 (match_operand:DF 2 "gpc_reg_operand" "d"))
6287 (match_operand:DF 3 "gpc_reg_operand" "d")))]
6288 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD && TARGET_DOUBLE_FLOAT
6289 && ! HONOR_SIGNED_ZEROS (DFmode) && VECTOR_UNIT_NONE_P (DFmode)"
6290 "{fnma|fnmadd} %0,%1,%2,%3"
6291 [(set_attr "type" "dmul")
6292 (set_attr "fp_type" "fp_maddsub_d")])
6294 (define_insn "*fnmsubdf4_fpr_1"
6295 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6296 (neg:DF (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
6297 (match_operand:DF 2 "gpc_reg_operand" "d"))
6298 (match_operand:DF 3 "gpc_reg_operand" "d"))))]
6299 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD && TARGET_DOUBLE_FLOAT
6300 && VECTOR_UNIT_NONE_P (DFmode)"
6301 "{fnms|fnmsub} %0,%1,%2,%3"
6302 [(set_attr "type" "dmul")
6303 (set_attr "fp_type" "fp_maddsub_d")])
6305 (define_insn "*fnmsubdf4_fpr_2"
6306 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6307 (minus:DF (match_operand:DF 3 "gpc_reg_operand" "d")
6308 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
6309 (match_operand:DF 2 "gpc_reg_operand" "d"))))]
6310 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD && TARGET_DOUBLE_FLOAT
6311 && ! HONOR_SIGNED_ZEROS (DFmode) && VECTOR_UNIT_NONE_P (DFmode)"
6312 "{fnms|fnmsub} %0,%1,%2,%3"
6313 [(set_attr "type" "dmul")
6314 (set_attr "fp_type" "fp_maddsub_d")])
6316 (define_expand "sqrtdf2"
6317 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6318 (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
6319 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS
6320 && TARGET_DOUBLE_FLOAT"
6323 (define_insn "*sqrtdf2_fpr"
6324 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6325 (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "d")))]
6326 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS
6327 && TARGET_DOUBLE_FLOAT
6328 && !VECTOR_UNIT_VSX_P (DFmode)"
6330 [(set_attr "type" "dsqrt")])
6332 ;; The conditional move instructions allow us to perform max and min
6333 ;; operations even when
6335 (define_expand "smaxdf3"
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], SMAX, operands[1], operands[2]); DONE;}")
6345 (define_expand "smindf3"
6346 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6347 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
6348 (match_operand:DF 2 "gpc_reg_operand" ""))
6351 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6352 && !flag_trapping_math"
6353 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
6356 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6357 (match_operator:DF 3 "min_max_operator"
6358 [(match_operand:DF 1 "gpc_reg_operand" "")
6359 (match_operand:DF 2 "gpc_reg_operand" "")]))]
6360 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6361 && !flag_trapping_math"
6364 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
6365 operands[1], operands[2]);
6369 (define_expand "movdfcc"
6370 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6371 (if_then_else:DF (match_operand 1 "comparison_operator" "")
6372 (match_operand:DF 2 "gpc_reg_operand" "")
6373 (match_operand:DF 3 "gpc_reg_operand" "")))]
6374 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6377 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
6383 (define_insn "*fseldfdf4"
6384 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6385 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "d")
6386 (match_operand:DF 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"
6391 [(set_attr "type" "fp")])
6393 (define_insn "*fselsfdf4"
6394 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6395 (if_then_else:DF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
6396 (match_operand:SF 4 "zero_fp_constant" "F"))
6397 (match_operand:DF 2 "gpc_reg_operand" "d")
6398 (match_operand:DF 3 "gpc_reg_operand" "d")))]
6399 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_SINGLE_FLOAT"
6401 [(set_attr "type" "fp")])
6403 ;; Conversions to and from floating-point.
6405 (define_expand "fixuns_truncsfsi2"
6406 [(set (match_operand:SI 0 "gpc_reg_operand" "")
6407 (unsigned_fix:SI (match_operand:SF 1 "gpc_reg_operand" "")))]
6408 "TARGET_HARD_FLOAT && !TARGET_FPRS && TARGET_SINGLE_FLOAT"
6411 (define_expand "fix_truncsfsi2"
6412 [(set (match_operand:SI 0 "gpc_reg_operand" "")
6413 (fix:SI (match_operand:SF 1 "gpc_reg_operand" "")))]
6414 "TARGET_HARD_FLOAT && !TARGET_FPRS && TARGET_SINGLE_FLOAT"
6417 (define_expand "fixuns_truncdfsi2"
6418 [(set (match_operand:SI 0 "gpc_reg_operand" "")
6419 (unsigned_fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))]
6420 "TARGET_HARD_FLOAT && TARGET_E500_DOUBLE"
6423 (define_expand "fixuns_truncdfdi2"
6424 [(set (match_operand:DI 0 "register_operand" "")
6425 (unsigned_fix:DI (match_operand:DF 1 "register_operand" "")))]
6426 "TARGET_HARD_FLOAT && TARGET_VSX"
6429 ; For each of these conversions, there is a define_expand, a define_insn
6430 ; with a '#' template, and a define_split (with C code). The idea is
6431 ; to allow constant folding with the template of the define_insn,
6432 ; then to have the insns split later (between sched1 and final).
6434 (define_expand "floatsidf2"
6435 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
6436 (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
6439 (clobber (match_dup 4))
6440 (clobber (match_dup 5))
6441 (clobber (match_dup 6))])]
6443 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6446 if (TARGET_E500_DOUBLE)
6448 emit_insn (gen_spe_floatsidf2 (operands[0], operands[1]));
6451 if (TARGET_POWERPC64)
6453 rtx x = convert_to_mode (DImode, operands[1], 0);
6454 emit_insn (gen_floatdidf2 (operands[0], x));
6458 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
6459 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503601774854144\", DFmode));
6460 operands[4] = assign_stack_temp (DFmode, GET_MODE_SIZE (DFmode), 0);
6461 operands[5] = gen_reg_rtx (DFmode);
6462 operands[6] = gen_reg_rtx (SImode);
6465 (define_insn_and_split "*floatsidf2_internal"
6466 [(set (match_operand:DF 0 "gpc_reg_operand" "=&d")
6467 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
6468 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
6469 (use (match_operand:DF 3 "gpc_reg_operand" "d"))
6470 (clobber (match_operand:DF 4 "offsettable_mem_operand" "=o"))
6471 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&d"))
6472 (clobber (match_operand:SI 6 "gpc_reg_operand" "=&r"))]
6473 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6479 rtx lowword, highword;
6480 gcc_assert (MEM_P (operands[4]));
6481 highword = adjust_address (operands[4], SImode, 0);
6482 lowword = adjust_address (operands[4], SImode, 4);
6483 if (! WORDS_BIG_ENDIAN)
6486 tmp = highword; highword = lowword; lowword = tmp;
6489 emit_insn (gen_xorsi3 (operands[6], operands[1],
6490 GEN_INT (~ (HOST_WIDE_INT) 0x7fffffff)));
6491 emit_move_insn (lowword, operands[6]);
6492 emit_move_insn (highword, operands[2]);
6493 emit_move_insn (operands[5], operands[4]);
6494 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
6497 [(set_attr "length" "24")])
6499 (define_expand "floatunssisf2"
6500 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6501 (unsigned_float:SF (match_operand:SI 1 "gpc_reg_operand" "")))]
6502 "TARGET_HARD_FLOAT && !TARGET_FPRS && TARGET_SINGLE_FLOAT"
6505 (define_expand "floatunssidf2"
6506 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
6507 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
6510 (clobber (match_dup 4))
6511 (clobber (match_dup 5))])]
6512 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6515 if (TARGET_E500_DOUBLE)
6517 emit_insn (gen_spe_floatunssidf2 (operands[0], operands[1]));
6520 if (TARGET_POWERPC64)
6522 rtx x = convert_to_mode (DImode, operands[1], 1);
6523 emit_insn (gen_floatdidf2 (operands[0], x));
6527 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
6528 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503599627370496\", DFmode));
6529 operands[4] = assign_stack_temp (DFmode, GET_MODE_SIZE (DFmode), 0);
6530 operands[5] = gen_reg_rtx (DFmode);
6533 (define_insn_and_split "*floatunssidf2_internal"
6534 [(set (match_operand:DF 0 "gpc_reg_operand" "=&d")
6535 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
6536 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
6537 (use (match_operand:DF 3 "gpc_reg_operand" "d"))
6538 (clobber (match_operand:DF 4 "offsettable_mem_operand" "=o"))
6539 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&d"))]
6540 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6546 rtx lowword, highword;
6547 gcc_assert (MEM_P (operands[4]));
6548 highword = adjust_address (operands[4], SImode, 0);
6549 lowword = adjust_address (operands[4], SImode, 4);
6550 if (! WORDS_BIG_ENDIAN)
6553 tmp = highword; highword = lowword; lowword = tmp;
6556 emit_move_insn (lowword, operands[1]);
6557 emit_move_insn (highword, operands[2]);
6558 emit_move_insn (operands[5], operands[4]);
6559 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
6562 [(set_attr "length" "20")])
6564 (define_expand "fix_truncdfsi2"
6565 [(parallel [(set (match_operand:SI 0 "fix_trunc_dest_operand" "")
6566 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))
6567 (clobber (match_dup 2))
6568 (clobber (match_dup 3))])]
6569 "(TARGET_POWER2 || TARGET_POWERPC)
6570 && TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6573 if (TARGET_E500_DOUBLE)
6575 emit_insn (gen_spe_fix_truncdfsi2 (operands[0], operands[1]));
6578 operands[2] = gen_reg_rtx (DImode);
6579 if (TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
6580 && gpc_reg_operand(operands[0], GET_MODE (operands[0])))
6582 operands[3] = gen_reg_rtx (DImode);
6583 emit_insn (gen_fix_truncdfsi2_mfpgpr (operands[0], operands[1],
6584 operands[2], operands[3]));
6587 if (TARGET_PPC_GFXOPT)
6589 rtx orig_dest = operands[0];
6590 if (! memory_operand (orig_dest, GET_MODE (orig_dest)))
6591 operands[0] = assign_stack_temp (SImode, GET_MODE_SIZE (SImode), 0);
6592 emit_insn (gen_fix_truncdfsi2_internal_gfxopt (operands[0], operands[1],
6594 if (operands[0] != orig_dest)
6595 emit_move_insn (orig_dest, operands[0]);
6598 operands[3] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
6601 (define_insn_and_split "*fix_truncdfsi2_internal"
6602 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6603 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "d")))
6604 (clobber (match_operand:DI 2 "gpc_reg_operand" "=d"))
6605 (clobber (match_operand:DI 3 "offsettable_mem_operand" "=o"))]
6606 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS
6607 && TARGET_DOUBLE_FLOAT"
6614 gcc_assert (MEM_P (operands[3]));
6615 lowword = adjust_address (operands[3], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
6617 emit_insn (gen_fctiwz (operands[2], operands[1]));
6618 emit_move_insn (operands[3], operands[2]);
6619 emit_move_insn (operands[0], lowword);
6622 [(set_attr "length" "16")])
6624 (define_insn_and_split "fix_truncdfsi2_internal_gfxopt"
6625 [(set (match_operand:SI 0 "memory_operand" "=Z")
6626 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "d")))
6627 (clobber (match_operand:DI 2 "gpc_reg_operand" "=d"))]
6628 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS
6629 && TARGET_DOUBLE_FLOAT
6630 && TARGET_PPC_GFXOPT"
6636 emit_insn (gen_fctiwz (operands[2], operands[1]));
6637 emit_insn (gen_stfiwx (operands[0], operands[2]));
6640 [(set_attr "length" "16")])
6642 (define_insn_and_split "fix_truncdfsi2_mfpgpr"
6643 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6644 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "d")))
6645 (clobber (match_operand:DI 2 "gpc_reg_operand" "=d"))
6646 (clobber (match_operand:DI 3 "gpc_reg_operand" "=r"))]
6647 "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
6648 && TARGET_DOUBLE_FLOAT"
6651 [(set (match_dup 2) (unspec:DI [(fix:SI (match_dup 1))] UNSPEC_FCTIWZ))
6652 (set (match_dup 3) (match_dup 2))
6653 (set (match_dup 0) (subreg:SI (match_dup 3) 4))]
6655 [(set_attr "length" "12")])
6657 ; Here, we use (set (reg) (unspec:DI [(fix:SI ...)] UNSPEC_FCTIWZ))
6658 ; rather than (set (subreg:SI (reg)) (fix:SI ...))
6659 ; because the first makes it clear that operand 0 is not live
6660 ; before the instruction.
6661 (define_insn "fctiwz"
6662 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6663 (unspec:DI [(fix:SI (match_operand:DF 1 "gpc_reg_operand" "d"))]
6665 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS
6666 && TARGET_DOUBLE_FLOAT"
6667 "{fcirz|fctiwz} %0,%1"
6668 [(set_attr "type" "fp")])
6670 (define_expand "btruncdf2"
6671 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6672 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "d")] UNSPEC_FRIZ))]
6673 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6676 (define_insn "*btruncdf2_fpr"
6677 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6678 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRIZ))]
6679 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6680 && !VECTOR_UNIT_VSX_P (DFmode)"
6682 [(set_attr "type" "fp")])
6684 (define_insn "btruncsf2"
6685 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6686 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIZ))]
6687 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
6689 [(set_attr "type" "fp")])
6691 (define_expand "ceildf2"
6692 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6693 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "")] UNSPEC_FRIP))]
6694 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6697 (define_insn "*ceildf2_fpr"
6698 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6699 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "d")] UNSPEC_FRIP))]
6700 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6701 && !VECTOR_UNIT_VSX_P (DFmode)"
6703 [(set_attr "type" "fp")])
6705 (define_insn "ceilsf2"
6706 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6707 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIP))]
6708 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT "
6710 [(set_attr "type" "fp")])
6712 (define_expand "floordf2"
6713 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6714 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "")] UNSPEC_FRIM))]
6715 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6718 (define_insn "*floordf2_fpr"
6719 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6720 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "d")] UNSPEC_FRIM))]
6721 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6722 && !VECTOR_UNIT_VSX_P (DFmode)"
6724 [(set_attr "type" "fp")])
6726 (define_insn "floorsf2"
6727 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6728 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIM))]
6729 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT "
6731 [(set_attr "type" "fp")])
6733 ;; No VSX equivalent to frin
6734 (define_insn "rounddf2"
6735 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6736 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "d")] UNSPEC_FRIN))]
6737 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6739 [(set_attr "type" "fp")])
6741 (define_insn "roundsf2"
6742 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6743 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIN))]
6744 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT "
6746 [(set_attr "type" "fp")])
6748 (define_expand "ftruncdf2"
6749 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6750 (fix:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
6751 "VECTOR_UNIT_VSX_P (DFmode)"
6754 ; An UNSPEC is used so we don't have to support SImode in FP registers.
6755 (define_insn "stfiwx"
6756 [(set (match_operand:SI 0 "memory_operand" "=Z")
6757 (unspec:SI [(match_operand:DI 1 "gpc_reg_operand" "d")]
6761 [(set_attr "type" "fpstore")])
6763 (define_expand "floatsisf2"
6764 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6765 (float:SF (match_operand:SI 1 "gpc_reg_operand" "")))]
6766 "TARGET_HARD_FLOAT && !TARGET_FPRS"
6769 (define_expand "floatdidf2"
6770 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6771 (float:DF (match_operand:DI 1 "gpc_reg_operand" "")))]
6772 "(TARGET_POWERPC64 || TARGET_XILINX_FPU || VECTOR_UNIT_VSX_P (DFmode))
6773 && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS"
6776 (define_insn "*floatdidf2_fpr"
6777 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6778 (float:DF (match_operand:DI 1 "gpc_reg_operand" "!d#r")))]
6779 "(TARGET_POWERPC64 || TARGET_XILINX_FPU)
6780 && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
6781 && !VECTOR_UNIT_VSX_P (DFmode)"
6783 [(set_attr "type" "fp")])
6785 (define_expand "floatunsdidf2"
6786 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6787 (unsigned_float:DF (match_operand:DI 1 "gpc_reg_operand" "")))]
6791 (define_expand "fix_truncdfdi2"
6792 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6793 (fix:DI (match_operand:DF 1 "gpc_reg_operand" "")))]
6794 "(TARGET_POWERPC64 || TARGET_XILINX_FPU || VECTOR_UNIT_VSX_P (DFmode))
6795 && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS"
6798 (define_insn "*fix_truncdfdi2_fpr"
6799 [(set (match_operand:DI 0 "gpc_reg_operand" "=!d#r")
6800 (fix:DI (match_operand:DF 1 "gpc_reg_operand" "d")))]
6801 "(TARGET_POWERPC64 || TARGET_XILINX_FPU)
6802 && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
6803 && !VECTOR_UNIT_VSX_P (DFmode)"
6805 [(set_attr "type" "fp")])
6807 (define_expand "floatdisf2"
6808 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6809 (float:SF (match_operand:DI 1 "gpc_reg_operand" "")))]
6810 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT "
6813 rtx val = operands[1];
6814 if (!flag_unsafe_math_optimizations)
6816 rtx label = gen_label_rtx ();
6817 val = gen_reg_rtx (DImode);
6818 emit_insn (gen_floatdisf2_internal2 (val, operands[1], label));
6821 emit_insn (gen_floatdisf2_internal1 (operands[0], val));
6825 ;; This is not IEEE compliant if rounding mode is "round to nearest".
6826 ;; If the DI->DF conversion is inexact, then it's possible to suffer
6827 ;; from double rounding.
6828 (define_insn_and_split "floatdisf2_internal1"
6829 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6830 (float:SF (match_operand:DI 1 "gpc_reg_operand" "!d#r")))
6831 (clobber (match_scratch:DF 2 "=d"))]
6832 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
6834 "&& reload_completed"
6836 (float:DF (match_dup 1)))
6838 (float_truncate:SF (match_dup 2)))]
6841 ;; Twiddles bits to avoid double rounding.
6842 ;; Bits that might be truncated when converting to DFmode are replaced
6843 ;; by a bit that won't be lost at that stage, but is below the SFmode
6844 ;; rounding position.
6845 (define_expand "floatdisf2_internal2"
6846 [(set (match_dup 3) (ashiftrt:DI (match_operand:DI 1 "" "")
6848 (parallel [(set (match_operand:DI 0 "" "") (and:DI (match_dup 1)
6850 (clobber (scratch:CC))])
6851 (set (match_dup 3) (plus:DI (match_dup 3)
6853 (set (match_dup 0) (plus:DI (match_dup 0)
6855 (set (match_dup 4) (compare:CCUNS (match_dup 3)
6857 (set (match_dup 0) (ior:DI (match_dup 0)
6859 (parallel [(set (match_dup 0) (and:DI (match_dup 0)
6861 (clobber (scratch:CC))])
6862 (set (pc) (if_then_else (geu (match_dup 4) (const_int 0))
6863 (label_ref (match_operand:DI 2 "" ""))
6865 (set (match_dup 0) (match_dup 1))]
6866 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
6869 operands[3] = gen_reg_rtx (DImode);
6870 operands[4] = gen_reg_rtx (CCUNSmode);
6873 ;; Define the DImode operations that can be done in a small number
6874 ;; of instructions. The & constraints are to prevent the register
6875 ;; allocator from allocating registers that overlap with the inputs
6876 ;; (for example, having an input in 7,8 and an output in 6,7). We
6877 ;; also allow for the output being the same as one of the inputs.
6879 (define_insn "*adddi3_noppc64"
6880 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r")
6881 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,0,0")
6882 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I")))]
6883 "! TARGET_POWERPC64"
6886 if (WORDS_BIG_ENDIAN)
6887 return (GET_CODE (operands[2])) != CONST_INT
6888 ? \"{a|addc} %L0,%L1,%L2\;{ae|adde} %0,%1,%2\"
6889 : \"{ai|addic} %L0,%L1,%2\;{a%G2e|add%G2e} %0,%1\";
6891 return (GET_CODE (operands[2])) != CONST_INT
6892 ? \"{a|addc} %0,%1,%2\;{ae|adde} %L0,%L1,%L2\"
6893 : \"{ai|addic} %0,%1,%2\;{a%G2e|add%G2e} %L0,%L1\";
6895 [(set_attr "type" "two")
6896 (set_attr "length" "8")])
6898 (define_insn "*subdi3_noppc64"
6899 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r,r")
6900 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I,0,r,I")
6901 (match_operand:DI 2 "gpc_reg_operand" "r,r,r,0,0")))]
6902 "! TARGET_POWERPC64"
6905 if (WORDS_BIG_ENDIAN)
6906 return (GET_CODE (operands[1]) != CONST_INT)
6907 ? \"{sf|subfc} %L0,%L2,%L1\;{sfe|subfe} %0,%2,%1\"
6908 : \"{sfi|subfic} %L0,%L2,%1\;{sf%G1e|subf%G1e} %0,%2\";
6910 return (GET_CODE (operands[1]) != CONST_INT)
6911 ? \"{sf|subfc} %0,%2,%1\;{sfe|subfe} %L0,%L2,%L1\"
6912 : \"{sfi|subfic} %0,%2,%1\;{sf%G1e|subf%G1e} %L0,%L2\";
6914 [(set_attr "type" "two")
6915 (set_attr "length" "8")])
6917 (define_insn "*negdi2_noppc64"
6918 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6919 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))]
6920 "! TARGET_POWERPC64"
6923 return (WORDS_BIG_ENDIAN)
6924 ? \"{sfi|subfic} %L0,%L1,0\;{sfze|subfze} %0,%1\"
6925 : \"{sfi|subfic} %0,%1,0\;{sfze|subfze} %L0,%L1\";
6927 [(set_attr "type" "two")
6928 (set_attr "length" "8")])
6930 (define_expand "mulsidi3"
6931 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6932 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6933 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6934 "! TARGET_POWERPC64"
6937 if (! TARGET_POWER && ! TARGET_POWERPC)
6939 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
6940 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
6941 emit_insn (gen_mull_call ());
6942 if (WORDS_BIG_ENDIAN)
6943 emit_move_insn (operands[0], gen_rtx_REG (DImode, 3));
6946 emit_move_insn (operand_subword (operands[0], 0, 0, DImode),
6947 gen_rtx_REG (SImode, 3));
6948 emit_move_insn (operand_subword (operands[0], 1, 0, DImode),
6949 gen_rtx_REG (SImode, 4));
6953 else if (TARGET_POWER)
6955 emit_insn (gen_mulsidi3_mq (operands[0], operands[1], operands[2]));
6960 (define_insn "mulsidi3_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 (clobber (match_scratch:SI 3 "=q"))]
6966 "mul %0,%1,%2\;mfmq %L0"
6967 [(set_attr "type" "imul")
6968 (set_attr "length" "8")])
6970 (define_insn "*mulsidi3_no_mq"
6971 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6972 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6973 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
6974 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
6977 return (WORDS_BIG_ENDIAN)
6978 ? \"mulhw %0,%1,%2\;mullw %L0,%1,%2\"
6979 : \"mulhw %L0,%1,%2\;mullw %0,%1,%2\";
6981 [(set_attr "type" "imul")
6982 (set_attr "length" "8")])
6985 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6986 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6987 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6988 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
6991 (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
6992 (sign_extend:DI (match_dup 2)))
6995 (mult:SI (match_dup 1)
6999 int endian = (WORDS_BIG_ENDIAN == 0);
7000 operands[3] = operand_subword (operands[0], endian, 0, DImode);
7001 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
7004 (define_expand "umulsidi3"
7005 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7006 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
7007 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
7008 "TARGET_POWERPC && ! TARGET_POWERPC64"
7013 emit_insn (gen_umulsidi3_mq (operands[0], operands[1], operands[2]));
7018 (define_insn "umulsidi3_mq"
7019 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
7020 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
7021 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
7022 (clobber (match_scratch:SI 3 "=q"))]
7023 "TARGET_POWERPC && TARGET_POWER"
7026 return (WORDS_BIG_ENDIAN)
7027 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
7028 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
7030 [(set_attr "type" "imul")
7031 (set_attr "length" "8")])
7033 (define_insn "*umulsidi3_no_mq"
7034 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
7035 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
7036 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
7037 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
7040 return (WORDS_BIG_ENDIAN)
7041 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
7042 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
7044 [(set_attr "type" "imul")
7045 (set_attr "length" "8")])
7048 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7049 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
7050 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
7051 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
7054 (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
7055 (zero_extend:DI (match_dup 2)))
7058 (mult:SI (match_dup 1)
7062 int endian = (WORDS_BIG_ENDIAN == 0);
7063 operands[3] = operand_subword (operands[0], endian, 0, DImode);
7064 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
7067 (define_expand "smulsi3_highpart"
7068 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7070 (lshiftrt:DI (mult:DI (sign_extend:DI
7071 (match_operand:SI 1 "gpc_reg_operand" ""))
7073 (match_operand:SI 2 "gpc_reg_operand" "")))
7078 if (! TARGET_POWER && ! TARGET_POWERPC)
7080 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
7081 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
7082 emit_insn (gen_mulh_call ());
7083 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
7086 else if (TARGET_POWER)
7088 emit_insn (gen_smulsi3_highpart_mq (operands[0], operands[1], operands[2]));
7093 (define_insn "smulsi3_highpart_mq"
7094 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7096 (lshiftrt:DI (mult:DI (sign_extend:DI
7097 (match_operand:SI 1 "gpc_reg_operand" "%r"))
7099 (match_operand:SI 2 "gpc_reg_operand" "r")))
7101 (clobber (match_scratch:SI 3 "=q"))]
7104 [(set_attr "type" "imul")])
7106 (define_insn "*smulsi3_highpart_no_mq"
7107 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7109 (lshiftrt:DI (mult:DI (sign_extend:DI
7110 (match_operand:SI 1 "gpc_reg_operand" "%r"))
7112 (match_operand:SI 2 "gpc_reg_operand" "r")))
7114 "TARGET_POWERPC && ! TARGET_POWER"
7116 [(set_attr "type" "imul")])
7118 (define_expand "umulsi3_highpart"
7119 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7121 (lshiftrt:DI (mult:DI (zero_extend:DI
7122 (match_operand:SI 1 "gpc_reg_operand" ""))
7124 (match_operand:SI 2 "gpc_reg_operand" "")))
7131 emit_insn (gen_umulsi3_highpart_mq (operands[0], operands[1], operands[2]));
7136 (define_insn "umulsi3_highpart_mq"
7137 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7139 (lshiftrt:DI (mult:DI (zero_extend:DI
7140 (match_operand:SI 1 "gpc_reg_operand" "%r"))
7142 (match_operand:SI 2 "gpc_reg_operand" "r")))
7144 (clobber (match_scratch:SI 3 "=q"))]
7145 "TARGET_POWERPC && TARGET_POWER"
7147 [(set_attr "type" "imul")])
7149 (define_insn "*umulsi3_highpart_no_mq"
7150 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7152 (lshiftrt:DI (mult:DI (zero_extend:DI
7153 (match_operand:SI 1 "gpc_reg_operand" "%r"))
7155 (match_operand:SI 2 "gpc_reg_operand" "r")))
7157 "TARGET_POWERPC && ! TARGET_POWER"
7159 [(set_attr "type" "imul")])
7161 ;; If operands 0 and 2 are in the same register, we have a problem. But
7162 ;; operands 0 and 1 (the usual case) can be in the same register. That's
7163 ;; why we have the strange constraints below.
7164 (define_insn "ashldi3_power"
7165 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
7166 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
7167 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
7168 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
7171 {sli|slwi} %0,%L1,%h2\;{cal %L0,0(0)|li %L0,0}
7172 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
7173 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
7174 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2"
7175 [(set_attr "length" "8")])
7177 (define_insn "lshrdi3_power"
7178 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
7179 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
7180 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
7181 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
7184 {s%A2i|s%A2wi} %L0,%1,%h2\;{cal %0,0(0)|li %0,0}
7185 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
7186 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
7187 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2"
7188 [(set_attr "length" "8")])
7190 ;; Shift by a variable amount is too complex to be worth open-coding. We
7191 ;; just handle shifts by constants.
7192 (define_insn "ashrdi3_power"
7193 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
7194 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7195 (match_operand:SI 2 "const_int_operand" "M,i")))
7196 (clobber (match_scratch:SI 3 "=X,q"))]
7199 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
7200 sraiq %0,%1,%h2\;srliq %L0,%L1,%h2"
7201 [(set_attr "type" "shift")
7202 (set_attr "length" "8")])
7204 (define_insn "ashrdi3_no_power"
7205 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
7206 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7207 (match_operand:SI 2 "const_int_operand" "M,i")))]
7208 "TARGET_32BIT && !TARGET_POWERPC64 && !TARGET_POWER && WORDS_BIG_ENDIAN"
7210 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
7211 {sri|srwi} %L0,%L1,%h2\;insrwi %L0,%1,%h2,0\;{srai|srawi} %0,%1,%h2"
7212 [(set_attr "type" "two,three")
7213 (set_attr "length" "8,12")])
7215 (define_insn "*ashrdisi3_noppc64"
7216 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7217 (subreg:SI (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7218 (const_int 32)) 4))]
7219 "TARGET_32BIT && !TARGET_POWERPC64"
7222 if (REGNO (operands[0]) == REGNO (operands[1]))
7225 return \"mr %0,%1\";
7227 [(set_attr "length" "4")])
7230 ;; PowerPC64 DImode operations.
7232 (define_expand "absdi2"
7233 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7234 (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))]
7239 emit_insn (gen_absdi2_isel (operands[0], operands[1]));
7241 emit_insn (gen_absdi2_internal (operands[0], operands[1]));
7245 (define_insn_and_split "absdi2_internal"
7246 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
7247 (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))
7248 (clobber (match_scratch:DI 2 "=&r,&r"))]
7249 "TARGET_POWERPC64 && !TARGET_ISEL"
7251 "&& reload_completed"
7252 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
7253 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
7254 (set (match_dup 0) (minus:DI (match_dup 0) (match_dup 2)))]
7257 (define_insn_and_split "*nabsdi2"
7258 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
7259 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0"))))
7260 (clobber (match_scratch:DI 2 "=&r,&r"))]
7261 "TARGET_POWERPC64 && !TARGET_ISEL"
7263 "&& reload_completed"
7264 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
7265 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
7266 (set (match_dup 0) (minus:DI (match_dup 2) (match_dup 0)))]
7269 (define_insn "muldi3"
7270 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7271 (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
7272 (match_operand:DI 2 "reg_or_short_operand" "r,I")))]
7278 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
7279 (const_string "imul3")
7280 (match_operand:SI 2 "short_cint_operand" "")
7281 (const_string "imul2")]
7282 (const_string "lmul")))])
7284 (define_insn "*muldi3_internal1"
7285 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7286 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
7287 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
7289 (clobber (match_scratch:DI 3 "=r,r"))]
7294 [(set_attr "type" "lmul_compare")
7295 (set_attr "length" "4,8")])
7298 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7299 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
7300 (match_operand:DI 2 "gpc_reg_operand" ""))
7302 (clobber (match_scratch:DI 3 ""))]
7303 "TARGET_POWERPC64 && reload_completed"
7305 (mult:DI (match_dup 1) (match_dup 2)))
7307 (compare:CC (match_dup 3)
7311 (define_insn "*muldi3_internal2"
7312 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7313 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
7314 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
7316 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7317 (mult:DI (match_dup 1) (match_dup 2)))]
7322 [(set_attr "type" "lmul_compare")
7323 (set_attr "length" "4,8")])
7326 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7327 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
7328 (match_operand:DI 2 "gpc_reg_operand" ""))
7330 (set (match_operand:DI 0 "gpc_reg_operand" "")
7331 (mult:DI (match_dup 1) (match_dup 2)))]
7332 "TARGET_POWERPC64 && reload_completed"
7334 (mult:DI (match_dup 1) (match_dup 2)))
7336 (compare:CC (match_dup 0)
7340 (define_insn "smuldi3_highpart"
7341 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7343 (lshiftrt:TI (mult:TI (sign_extend:TI
7344 (match_operand:DI 1 "gpc_reg_operand" "%r"))
7346 (match_operand:DI 2 "gpc_reg_operand" "r")))
7350 [(set_attr "type" "lmul")])
7352 (define_insn "umuldi3_highpart"
7353 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7355 (lshiftrt:TI (mult:TI (zero_extend:TI
7356 (match_operand:DI 1 "gpc_reg_operand" "%r"))
7358 (match_operand:DI 2 "gpc_reg_operand" "r")))
7362 [(set_attr "type" "lmul")])
7364 (define_insn "rotldi3"
7365 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7366 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7367 (match_operand:DI 2 "reg_or_cint_operand" "r,i")))]
7372 [(set_attr "type" "var_shift_rotate,integer")])
7374 (define_insn "*rotldi3_internal2"
7375 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7376 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7377 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
7379 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7386 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7387 (set_attr "length" "4,4,8,8")])
7390 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7391 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7392 (match_operand:DI 2 "reg_or_cint_operand" ""))
7394 (clobber (match_scratch:DI 3 ""))]
7395 "TARGET_POWERPC64 && reload_completed"
7397 (rotate:DI (match_dup 1) (match_dup 2)))
7399 (compare:CC (match_dup 3)
7403 (define_insn "*rotldi3_internal3"
7404 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7405 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7406 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
7408 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7409 (rotate:DI (match_dup 1) (match_dup 2)))]
7416 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7417 (set_attr "length" "4,4,8,8")])
7420 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7421 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7422 (match_operand:DI 2 "reg_or_cint_operand" ""))
7424 (set (match_operand:DI 0 "gpc_reg_operand" "")
7425 (rotate:DI (match_dup 1) (match_dup 2)))]
7426 "TARGET_POWERPC64 && reload_completed"
7428 (rotate:DI (match_dup 1) (match_dup 2)))
7430 (compare:CC (match_dup 0)
7434 (define_insn "*rotldi3_internal4"
7435 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7436 (and:DI (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7437 (match_operand:DI 2 "reg_or_cint_operand" "r,i"))
7438 (match_operand:DI 3 "mask64_operand" "n,n")))]
7441 rldc%B3 %0,%1,%2,%S3
7442 rldic%B3 %0,%1,%H2,%S3"
7443 [(set_attr "type" "var_shift_rotate,integer")])
7445 (define_insn "*rotldi3_internal5"
7446 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7448 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7449 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
7450 (match_operand:DI 3 "mask64_operand" "n,n,n,n"))
7452 (clobber (match_scratch:DI 4 "=r,r,r,r"))]
7455 rldc%B3. %4,%1,%2,%S3
7456 rldic%B3. %4,%1,%H2,%S3
7459 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7460 (set_attr "length" "4,4,8,8")])
7463 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7465 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7466 (match_operand:DI 2 "reg_or_cint_operand" ""))
7467 (match_operand:DI 3 "mask64_operand" ""))
7469 (clobber (match_scratch:DI 4 ""))]
7470 "TARGET_POWERPC64 && reload_completed"
7472 (and:DI (rotate:DI (match_dup 1)
7476 (compare:CC (match_dup 4)
7480 (define_insn "*rotldi3_internal6"
7481 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
7483 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7484 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
7485 (match_operand:DI 3 "mask64_operand" "n,n,n,n"))
7487 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7488 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7491 rldc%B3. %0,%1,%2,%S3
7492 rldic%B3. %0,%1,%H2,%S3
7495 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7496 (set_attr "length" "4,4,8,8")])
7499 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
7501 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7502 (match_operand:DI 2 "reg_or_cint_operand" ""))
7503 (match_operand:DI 3 "mask64_operand" ""))
7505 (set (match_operand:DI 0 "gpc_reg_operand" "")
7506 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7507 "TARGET_POWERPC64 && reload_completed"
7509 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
7511 (compare:CC (match_dup 0)
7515 (define_insn "*rotldi3_internal7"
7516 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7519 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7520 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
7524 rldicl %0,%1,%H2,56"
7525 [(set_attr "type" "var_shift_rotate,integer")])
7527 (define_insn "*rotldi3_internal8"
7528 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7529 (compare:CC (zero_extend:DI
7531 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7532 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7534 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7538 rldicl. %3,%1,%H2,56
7541 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7542 (set_attr "length" "4,4,8,8")])
7545 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7546 (compare:CC (zero_extend:DI
7548 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7549 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7551 (clobber (match_scratch:DI 3 ""))]
7552 "TARGET_POWERPC64 && reload_completed"
7554 (zero_extend:DI (subreg:QI
7555 (rotate:DI (match_dup 1)
7558 (compare:CC (match_dup 3)
7562 (define_insn "*rotldi3_internal9"
7563 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7564 (compare:CC (zero_extend:DI
7566 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7567 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7569 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7570 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7574 rldicl. %0,%1,%H2,56
7577 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7578 (set_attr "length" "4,4,8,8")])
7581 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7582 (compare:CC (zero_extend:DI
7584 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7585 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7587 (set (match_operand:DI 0 "gpc_reg_operand" "")
7588 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7589 "TARGET_POWERPC64 && reload_completed"
7591 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
7593 (compare:CC (match_dup 0)
7597 (define_insn "*rotldi3_internal10"
7598 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7601 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7602 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
7606 rldicl %0,%1,%H2,48"
7607 [(set_attr "type" "var_shift_rotate,integer")])
7609 (define_insn "*rotldi3_internal11"
7610 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7611 (compare:CC (zero_extend:DI
7613 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7614 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7616 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7620 rldicl. %3,%1,%H2,48
7623 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7624 (set_attr "length" "4,4,8,8")])
7627 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7628 (compare:CC (zero_extend:DI
7630 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7631 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7633 (clobber (match_scratch:DI 3 ""))]
7634 "TARGET_POWERPC64 && reload_completed"
7636 (zero_extend:DI (subreg:HI
7637 (rotate:DI (match_dup 1)
7640 (compare:CC (match_dup 3)
7644 (define_insn "*rotldi3_internal12"
7645 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7646 (compare:CC (zero_extend:DI
7648 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7649 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7651 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7652 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7656 rldicl. %0,%1,%H2,48
7659 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7660 (set_attr "length" "4,4,8,8")])
7663 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7664 (compare:CC (zero_extend:DI
7666 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7667 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7669 (set (match_operand:DI 0 "gpc_reg_operand" "")
7670 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7671 "TARGET_POWERPC64 && reload_completed"
7673 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
7675 (compare:CC (match_dup 0)
7679 (define_insn "*rotldi3_internal13"
7680 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7683 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7684 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
7688 rldicl %0,%1,%H2,32"
7689 [(set_attr "type" "var_shift_rotate,integer")])
7691 (define_insn "*rotldi3_internal14"
7692 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7693 (compare:CC (zero_extend:DI
7695 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7696 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7698 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7702 rldicl. %3,%1,%H2,32
7705 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7706 (set_attr "length" "4,4,8,8")])
7709 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7710 (compare:CC (zero_extend:DI
7712 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7713 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7715 (clobber (match_scratch:DI 3 ""))]
7716 "TARGET_POWERPC64 && reload_completed"
7718 (zero_extend:DI (subreg:SI
7719 (rotate:DI (match_dup 1)
7722 (compare:CC (match_dup 3)
7726 (define_insn "*rotldi3_internal15"
7727 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7728 (compare:CC (zero_extend:DI
7730 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7731 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7733 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7734 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7738 rldicl. %0,%1,%H2,32
7741 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7742 (set_attr "length" "4,4,8,8")])
7745 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7746 (compare:CC (zero_extend:DI
7748 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7749 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7751 (set (match_operand:DI 0 "gpc_reg_operand" "")
7752 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7753 "TARGET_POWERPC64 && reload_completed"
7755 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
7757 (compare:CC (match_dup 0)
7761 (define_expand "ashldi3"
7762 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7763 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7764 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7765 "TARGET_POWERPC64 || TARGET_POWER"
7768 if (TARGET_POWERPC64)
7770 else if (TARGET_POWER)
7772 emit_insn (gen_ashldi3_power (operands[0], operands[1], operands[2]));
7779 (define_insn "*ashldi3_internal1"
7780 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7781 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7782 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
7787 [(set_attr "type" "var_shift_rotate,shift")])
7789 (define_insn "*ashldi3_internal2"
7790 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7791 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7792 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7794 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7801 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7802 (set_attr "length" "4,4,8,8")])
7805 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7806 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7807 (match_operand:SI 2 "reg_or_cint_operand" ""))
7809 (clobber (match_scratch:DI 3 ""))]
7810 "TARGET_POWERPC64 && reload_completed"
7812 (ashift:DI (match_dup 1) (match_dup 2)))
7814 (compare:CC (match_dup 3)
7818 (define_insn "*ashldi3_internal3"
7819 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7820 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7821 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7823 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7824 (ashift:DI (match_dup 1) (match_dup 2)))]
7831 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7832 (set_attr "length" "4,4,8,8")])
7835 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7836 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7837 (match_operand:SI 2 "reg_or_cint_operand" ""))
7839 (set (match_operand:DI 0 "gpc_reg_operand" "")
7840 (ashift:DI (match_dup 1) (match_dup 2)))]
7841 "TARGET_POWERPC64 && reload_completed"
7843 (ashift:DI (match_dup 1) (match_dup 2)))
7845 (compare:CC (match_dup 0)
7849 (define_insn "*ashldi3_internal4"
7850 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7851 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7852 (match_operand:SI 2 "const_int_operand" "i"))
7853 (match_operand:DI 3 "const_int_operand" "n")))]
7854 "TARGET_POWERPC64 && includes_rldic_lshift_p (operands[2], operands[3])"
7855 "rldic %0,%1,%H2,%W3")
7857 (define_insn "ashldi3_internal5"
7858 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7860 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7861 (match_operand:SI 2 "const_int_operand" "i,i"))
7862 (match_operand:DI 3 "const_int_operand" "n,n"))
7864 (clobber (match_scratch:DI 4 "=r,r"))]
7865 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
7867 rldic. %4,%1,%H2,%W3
7869 [(set_attr "type" "compare")
7870 (set_attr "length" "4,8")])
7873 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7875 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7876 (match_operand:SI 2 "const_int_operand" ""))
7877 (match_operand:DI 3 "const_int_operand" ""))
7879 (clobber (match_scratch:DI 4 ""))]
7880 "TARGET_POWERPC64 && reload_completed
7881 && includes_rldic_lshift_p (operands[2], operands[3])"
7883 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7886 (compare:CC (match_dup 4)
7890 (define_insn "*ashldi3_internal6"
7891 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
7893 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7894 (match_operand:SI 2 "const_int_operand" "i,i"))
7895 (match_operand:DI 3 "const_int_operand" "n,n"))
7897 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7898 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7899 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
7901 rldic. %0,%1,%H2,%W3
7903 [(set_attr "type" "compare")
7904 (set_attr "length" "4,8")])
7907 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
7909 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7910 (match_operand:SI 2 "const_int_operand" ""))
7911 (match_operand:DI 3 "const_int_operand" ""))
7913 (set (match_operand:DI 0 "gpc_reg_operand" "")
7914 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7915 "TARGET_POWERPC64 && reload_completed
7916 && includes_rldic_lshift_p (operands[2], operands[3])"
7918 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7921 (compare:CC (match_dup 0)
7925 (define_insn "*ashldi3_internal7"
7926 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7927 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7928 (match_operand:SI 2 "const_int_operand" "i"))
7929 (match_operand:DI 3 "mask64_operand" "n")))]
7930 "TARGET_POWERPC64 && includes_rldicr_lshift_p (operands[2], operands[3])"
7931 "rldicr %0,%1,%H2,%S3")
7933 (define_insn "ashldi3_internal8"
7934 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7936 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7937 (match_operand:SI 2 "const_int_operand" "i,i"))
7938 (match_operand:DI 3 "mask64_operand" "n,n"))
7940 (clobber (match_scratch:DI 4 "=r,r"))]
7941 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
7943 rldicr. %4,%1,%H2,%S3
7945 [(set_attr "type" "compare")
7946 (set_attr "length" "4,8")])
7949 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7951 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7952 (match_operand:SI 2 "const_int_operand" ""))
7953 (match_operand:DI 3 "mask64_operand" ""))
7955 (clobber (match_scratch:DI 4 ""))]
7956 "TARGET_POWERPC64 && reload_completed
7957 && includes_rldicr_lshift_p (operands[2], operands[3])"
7959 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7962 (compare:CC (match_dup 4)
7966 (define_insn "*ashldi3_internal9"
7967 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
7969 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7970 (match_operand:SI 2 "const_int_operand" "i,i"))
7971 (match_operand:DI 3 "mask64_operand" "n,n"))
7973 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7974 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7975 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
7977 rldicr. %0,%1,%H2,%S3
7979 [(set_attr "type" "compare")
7980 (set_attr "length" "4,8")])
7983 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
7985 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7986 (match_operand:SI 2 "const_int_operand" ""))
7987 (match_operand:DI 3 "mask64_operand" ""))
7989 (set (match_operand:DI 0 "gpc_reg_operand" "")
7990 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7991 "TARGET_POWERPC64 && reload_completed
7992 && includes_rldicr_lshift_p (operands[2], operands[3])"
7994 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7997 (compare:CC (match_dup 0)
8001 (define_expand "lshrdi3"
8002 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8003 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
8004 (match_operand:SI 2 "reg_or_cint_operand" "")))]
8005 "TARGET_POWERPC64 || TARGET_POWER"
8008 if (TARGET_POWERPC64)
8010 else if (TARGET_POWER)
8012 emit_insn (gen_lshrdi3_power (operands[0], operands[1], operands[2]));
8019 (define_insn "*lshrdi3_internal1"
8020 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8021 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
8022 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
8027 [(set_attr "type" "var_shift_rotate,shift")])
8029 (define_insn "*lshrdi3_internal2"
8030 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
8031 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8032 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
8034 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
8041 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8042 (set_attr "length" "4,4,8,8")])
8045 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8046 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
8047 (match_operand:SI 2 "reg_or_cint_operand" ""))
8049 (clobber (match_scratch:DI 3 ""))]
8050 "TARGET_POWERPC64 && reload_completed"
8052 (lshiftrt:DI (match_dup 1) (match_dup 2)))
8054 (compare:CC (match_dup 3)
8058 (define_insn "*lshrdi3_internal3"
8059 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
8060 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8061 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
8063 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
8064 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
8071 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8072 (set_attr "length" "4,4,8,8")])
8075 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8076 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
8077 (match_operand:SI 2 "reg_or_cint_operand" ""))
8079 (set (match_operand:DI 0 "gpc_reg_operand" "")
8080 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
8081 "TARGET_POWERPC64 && reload_completed"
8083 (lshiftrt:DI (match_dup 1) (match_dup 2)))
8085 (compare:CC (match_dup 0)
8089 (define_expand "ashrdi3"
8090 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8091 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
8092 (match_operand:SI 2 "reg_or_cint_operand" "")))]
8096 if (TARGET_POWERPC64)
8098 else if (TARGET_POWER && GET_CODE (operands[2]) == CONST_INT)
8100 emit_insn (gen_ashrdi3_power (operands[0], operands[1], operands[2]));
8103 else if (TARGET_32BIT && GET_CODE (operands[2]) == CONST_INT
8104 && WORDS_BIG_ENDIAN)
8106 emit_insn (gen_ashrdi3_no_power (operands[0], operands[1], operands[2]));
8113 (define_insn "*ashrdi3_internal1"
8114 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8115 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
8116 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
8121 [(set_attr "type" "var_shift_rotate,shift")])
8123 (define_insn "*ashrdi3_internal2"
8124 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
8125 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8126 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
8128 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
8135 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8136 (set_attr "length" "4,4,8,8")])
8139 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
8140 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
8141 (match_operand:SI 2 "reg_or_cint_operand" ""))
8143 (clobber (match_scratch:DI 3 ""))]
8144 "TARGET_POWERPC64 && reload_completed"
8146 (ashiftrt:DI (match_dup 1) (match_dup 2)))
8148 (compare:CC (match_dup 3)
8152 (define_insn "*ashrdi3_internal3"
8153 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
8154 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8155 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
8157 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
8158 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
8165 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8166 (set_attr "length" "4,4,8,8")])
8169 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
8170 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
8171 (match_operand:SI 2 "reg_or_cint_operand" ""))
8173 (set (match_operand:DI 0 "gpc_reg_operand" "")
8174 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
8175 "TARGET_POWERPC64 && reload_completed"
8177 (ashiftrt:DI (match_dup 1) (match_dup 2)))
8179 (compare:CC (match_dup 0)
8183 (define_expand "anddi3"
8185 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8186 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8187 (match_operand:DI 2 "and64_2_operand" "")))
8188 (clobber (match_scratch:CC 3 ""))])]
8192 (define_insn "anddi3_mc"
8193 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
8194 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r")
8195 (match_operand:DI 2 "and64_2_operand" "?r,S,T,K,J,t")))
8196 (clobber (match_scratch:CC 3 "=X,X,X,x,x,X"))]
8197 "TARGET_POWERPC64 && rs6000_gen_cell_microcode"
8200 rldic%B2 %0,%1,0,%S2
8201 rlwinm %0,%1,0,%m2,%M2
8205 [(set_attr "type" "*,*,*,fast_compare,fast_compare,*")
8206 (set_attr "length" "4,4,4,4,4,8")])
8208 (define_insn "anddi3_nomc"
8209 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
8210 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r")
8211 (match_operand:DI 2 "and64_2_operand" "?r,S,T,t")))
8212 (clobber (match_scratch:CC 3 "=X,X,X,X"))]
8213 "TARGET_POWERPC64 && !rs6000_gen_cell_microcode"
8216 rldic%B2 %0,%1,0,%S2
8217 rlwinm %0,%1,0,%m2,%M2
8219 [(set_attr "length" "4,4,4,8")])
8222 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8223 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8224 (match_operand:DI 2 "mask64_2_operand" "")))
8225 (clobber (match_scratch:CC 3 ""))]
8227 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
8228 && !mask_operand (operands[2], DImode)
8229 && !mask64_operand (operands[2], DImode)"
8231 (and:DI (rotate:DI (match_dup 1)
8235 (and:DI (rotate:DI (match_dup 0)
8239 build_mask64_2_operands (operands[2], &operands[4]);
8242 (define_insn "*anddi3_internal2_mc"
8243 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,x,?y,?y,?y,??y,??y,?y")
8244 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r,r,r")
8245 (match_operand:DI 2 "and64_2_operand" "r,S,T,K,J,t,r,S,T,K,J,t"))
8247 (clobber (match_scratch:DI 3 "=r,r,r,r,r,r,r,r,r,r,r,r"))
8248 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,X,X,x,x,X"))]
8249 "TARGET_64BIT && rs6000_gen_cell_microcode"
8252 rldic%B2. %3,%1,0,%S2
8253 rlwinm. %3,%1,0,%m2,%M2
8263 [(set_attr "type" "fast_compare,compare,delayed_compare,fast_compare,\
8264 fast_compare,compare,compare,compare,compare,compare,\
8266 (set_attr "length" "4,4,4,4,4,8,8,8,8,8,8,12")])
8269 [(set (match_operand:CC 0 "cc_reg_operand" "")
8270 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8271 (match_operand:DI 2 "mask64_2_operand" ""))
8273 (clobber (match_scratch:DI 3 ""))
8274 (clobber (match_scratch:CC 4 ""))]
8275 "TARGET_64BIT && reload_completed
8276 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
8277 && !mask_operand (operands[2], DImode)
8278 && !mask64_operand (operands[2], DImode)"
8280 (and:DI (rotate:DI (match_dup 1)
8283 (parallel [(set (match_dup 0)
8284 (compare:CC (and:DI (rotate:DI (match_dup 3)
8288 (clobber (match_dup 3))])]
8291 build_mask64_2_operands (operands[2], &operands[5]);
8294 (define_insn "*anddi3_internal3_mc"
8295 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,x,x,?y,?y,?y,??y,??y,?y")
8296 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r,r,r")
8297 (match_operand:DI 2 "and64_2_operand" "r,S,T,K,J,t,r,S,T,K,J,t"))
8299 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r,r,r")
8300 (and:DI (match_dup 1) (match_dup 2)))
8301 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,X,X,x,x,X"))]
8302 "TARGET_64BIT && rs6000_gen_cell_microcode"
8305 rldic%B2. %0,%1,0,%S2
8306 rlwinm. %0,%1,0,%m2,%M2
8316 [(set_attr "type" "fast_compare,compare,delayed_compare,fast_compare,\
8317 fast_compare,compare,compare,compare,compare,compare,\
8319 (set_attr "length" "4,4,4,4,4,8,8,8,8,8,8,12")])
8322 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8323 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8324 (match_operand:DI 2 "and64_2_operand" ""))
8326 (set (match_operand:DI 0 "gpc_reg_operand" "")
8327 (and:DI (match_dup 1) (match_dup 2)))
8328 (clobber (match_scratch:CC 4 ""))]
8329 "TARGET_64BIT && reload_completed"
8330 [(parallel [(set (match_dup 0)
8331 (and:DI (match_dup 1) (match_dup 2)))
8332 (clobber (match_dup 4))])
8334 (compare:CC (match_dup 0)
8339 [(set (match_operand:CC 3 "cc_reg_operand" "")
8340 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8341 (match_operand:DI 2 "mask64_2_operand" ""))
8343 (set (match_operand:DI 0 "gpc_reg_operand" "")
8344 (and:DI (match_dup 1) (match_dup 2)))
8345 (clobber (match_scratch:CC 4 ""))]
8346 "TARGET_64BIT && reload_completed
8347 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
8348 && !mask_operand (operands[2], DImode)
8349 && !mask64_operand (operands[2], DImode)"
8351 (and:DI (rotate:DI (match_dup 1)
8354 (parallel [(set (match_dup 3)
8355 (compare:CC (and:DI (rotate:DI (match_dup 0)
8360 (and:DI (rotate:DI (match_dup 0)
8365 build_mask64_2_operands (operands[2], &operands[5]);
8368 (define_expand "iordi3"
8369 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8370 (ior:DI (match_operand:DI 1 "gpc_reg_operand" "")
8371 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
8375 if (non_logical_cint_operand (operands[2], DImode))
8377 HOST_WIDE_INT value;
8378 rtx tmp = ((!can_create_pseudo_p ()
8379 || rtx_equal_p (operands[0], operands[1]))
8380 ? operands[0] : gen_reg_rtx (DImode));
8382 if (GET_CODE (operands[2]) == CONST_INT)
8384 value = INTVAL (operands[2]);
8385 emit_insn (gen_iordi3 (tmp, operands[1],
8386 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
8390 value = CONST_DOUBLE_LOW (operands[2]);
8391 emit_insn (gen_iordi3 (tmp, operands[1],
8392 immed_double_const (value
8393 & (~ (HOST_WIDE_INT) 0xffff),
8397 emit_insn (gen_iordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
8402 (define_expand "xordi3"
8403 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8404 (xor:DI (match_operand:DI 1 "gpc_reg_operand" "")
8405 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
8409 if (non_logical_cint_operand (operands[2], DImode))
8411 HOST_WIDE_INT value;
8412 rtx tmp = ((!can_create_pseudo_p ()
8413 || rtx_equal_p (operands[0], operands[1]))
8414 ? operands[0] : gen_reg_rtx (DImode));
8416 if (GET_CODE (operands[2]) == CONST_INT)
8418 value = INTVAL (operands[2]);
8419 emit_insn (gen_xordi3 (tmp, operands[1],
8420 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
8424 value = CONST_DOUBLE_LOW (operands[2]);
8425 emit_insn (gen_xordi3 (tmp, operands[1],
8426 immed_double_const (value
8427 & (~ (HOST_WIDE_INT) 0xffff),
8431 emit_insn (gen_xordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
8436 (define_insn "*booldi3_internal1"
8437 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
8438 (match_operator:DI 3 "boolean_or_operator"
8439 [(match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
8440 (match_operand:DI 2 "logical_operand" "r,K,JF")]))]
8447 (define_insn "*booldi3_internal2"
8448 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
8449 (compare:CC (match_operator:DI 4 "boolean_or_operator"
8450 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
8451 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
8453 (clobber (match_scratch:DI 3 "=r,r"))]
8458 [(set_attr "type" "fast_compare,compare")
8459 (set_attr "length" "4,8")])
8462 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8463 (compare:CC (match_operator:DI 4 "boolean_operator"
8464 [(match_operand:DI 1 "gpc_reg_operand" "")
8465 (match_operand:DI 2 "gpc_reg_operand" "")])
8467 (clobber (match_scratch:DI 3 ""))]
8468 "TARGET_POWERPC64 && reload_completed"
8469 [(set (match_dup 3) (match_dup 4))
8471 (compare:CC (match_dup 3)
8475 (define_insn "*booldi3_internal3"
8476 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
8477 (compare:CC (match_operator:DI 4 "boolean_or_operator"
8478 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
8479 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
8481 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8487 [(set_attr "type" "fast_compare,compare")
8488 (set_attr "length" "4,8")])
8491 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8492 (compare:CC (match_operator:DI 4 "boolean_operator"
8493 [(match_operand:DI 1 "gpc_reg_operand" "")
8494 (match_operand:DI 2 "gpc_reg_operand" "")])
8496 (set (match_operand:DI 0 "gpc_reg_operand" "")
8498 "TARGET_POWERPC64 && reload_completed"
8499 [(set (match_dup 0) (match_dup 4))
8501 (compare:CC (match_dup 0)
8505 ;; Split a logical operation that we can't do in one insn into two insns,
8506 ;; each of which does one 16-bit part. This is used by combine.
8509 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8510 (match_operator:DI 3 "boolean_or_operator"
8511 [(match_operand:DI 1 "gpc_reg_operand" "")
8512 (match_operand:DI 2 "non_logical_cint_operand" "")]))]
8514 [(set (match_dup 0) (match_dup 4))
8515 (set (match_dup 0) (match_dup 5))]
8520 if (GET_CODE (operands[2]) == CONST_DOUBLE)
8522 HOST_WIDE_INT value = CONST_DOUBLE_LOW (operands[2]);
8523 i3 = immed_double_const (value & (~ (HOST_WIDE_INT) 0xffff),
8525 i4 = GEN_INT (value & 0xffff);
8529 i3 = GEN_INT (INTVAL (operands[2])
8530 & (~ (HOST_WIDE_INT) 0xffff));
8531 i4 = GEN_INT (INTVAL (operands[2]) & 0xffff);
8533 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
8535 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
8539 (define_insn "*boolcdi3_internal1"
8540 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
8541 (match_operator:DI 3 "boolean_operator"
8542 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
8543 (match_operand:DI 2 "gpc_reg_operand" "r")]))]
8547 (define_insn "*boolcdi3_internal2"
8548 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
8549 (compare:CC (match_operator:DI 4 "boolean_operator"
8550 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
8551 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
8553 (clobber (match_scratch:DI 3 "=r,r"))]
8558 [(set_attr "type" "fast_compare,compare")
8559 (set_attr "length" "4,8")])
8562 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8563 (compare:CC (match_operator:DI 4 "boolean_operator"
8564 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
8565 (match_operand:DI 2 "gpc_reg_operand" "")])
8567 (clobber (match_scratch:DI 3 ""))]
8568 "TARGET_POWERPC64 && reload_completed"
8569 [(set (match_dup 3) (match_dup 4))
8571 (compare:CC (match_dup 3)
8575 (define_insn "*boolcdi3_internal3"
8576 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
8577 (compare:CC (match_operator:DI 4 "boolean_operator"
8578 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
8579 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
8581 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8587 [(set_attr "type" "fast_compare,compare")
8588 (set_attr "length" "4,8")])
8591 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8592 (compare:CC (match_operator:DI 4 "boolean_operator"
8593 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
8594 (match_operand:DI 2 "gpc_reg_operand" "")])
8596 (set (match_operand:DI 0 "gpc_reg_operand" "")
8598 "TARGET_POWERPC64 && reload_completed"
8599 [(set (match_dup 0) (match_dup 4))
8601 (compare:CC (match_dup 0)
8605 (define_insn "*boolccdi3_internal1"
8606 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
8607 (match_operator:DI 3 "boolean_operator"
8608 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
8609 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r"))]))]
8613 (define_insn "*boolccdi3_internal2"
8614 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
8615 (compare:CC (match_operator:DI 4 "boolean_operator"
8616 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
8617 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
8619 (clobber (match_scratch:DI 3 "=r,r"))]
8624 [(set_attr "type" "fast_compare,compare")
8625 (set_attr "length" "4,8")])
8628 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8629 (compare:CC (match_operator:DI 4 "boolean_operator"
8630 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
8631 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
8633 (clobber (match_scratch:DI 3 ""))]
8634 "TARGET_POWERPC64 && reload_completed"
8635 [(set (match_dup 3) (match_dup 4))
8637 (compare:CC (match_dup 3)
8641 (define_insn "*boolccdi3_internal3"
8642 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
8643 (compare:CC (match_operator:DI 4 "boolean_operator"
8644 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
8645 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
8647 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8653 [(set_attr "type" "fast_compare,compare")
8654 (set_attr "length" "4,8")])
8657 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8658 (compare:CC (match_operator:DI 4 "boolean_operator"
8659 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
8660 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
8662 (set (match_operand:DI 0 "gpc_reg_operand" "")
8664 "TARGET_POWERPC64 && reload_completed"
8665 [(set (match_dup 0) (match_dup 4))
8667 (compare:CC (match_dup 0)
8671 (define_expand "smindi3"
8672 [(match_operand:DI 0 "gpc_reg_operand" "")
8673 (match_operand:DI 1 "gpc_reg_operand" "")
8674 (match_operand:DI 2 "gpc_reg_operand" "")]
8678 rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]);
8682 (define_expand "smaxdi3"
8683 [(match_operand:DI 0 "gpc_reg_operand" "")
8684 (match_operand:DI 1 "gpc_reg_operand" "")
8685 (match_operand:DI 2 "gpc_reg_operand" "")]
8689 rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]);
8693 (define_expand "umindi3"
8694 [(match_operand:DI 0 "gpc_reg_operand" "")
8695 (match_operand:DI 1 "gpc_reg_operand" "")
8696 (match_operand:DI 2 "gpc_reg_operand" "")]
8700 rs6000_emit_minmax (operands[0], UMIN, operands[1], operands[2]);
8704 (define_expand "umaxdi3"
8705 [(match_operand:DI 0 "gpc_reg_operand" "")
8706 (match_operand:DI 1 "gpc_reg_operand" "")
8707 (match_operand:DI 2 "gpc_reg_operand" "")]
8711 rs6000_emit_minmax (operands[0], UMAX, operands[1], operands[2]);
8716 ;; Now define ways of moving data around.
8718 ;; Set up a register with a value from the GOT table
8720 (define_expand "movsi_got"
8721 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8722 (unspec:SI [(match_operand:SI 1 "got_operand" "")
8723 (match_dup 2)] UNSPEC_MOVSI_GOT))]
8724 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
8727 if (GET_CODE (operands[1]) == CONST)
8729 rtx offset = const0_rtx;
8730 HOST_WIDE_INT value;
8732 operands[1] = eliminate_constant_term (XEXP (operands[1], 0), &offset);
8733 value = INTVAL (offset);
8736 rtx tmp = (!can_create_pseudo_p ()
8738 : gen_reg_rtx (Pmode));
8739 emit_insn (gen_movsi_got (tmp, operands[1]));
8740 emit_insn (gen_addsi3 (operands[0], tmp, offset));
8745 operands[2] = rs6000_got_register (operands[1]);
8748 (define_insn "*movsi_got_internal"
8749 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8750 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
8751 (match_operand:SI 2 "gpc_reg_operand" "b")]
8753 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
8754 "{l|lwz} %0,%a1@got(%2)"
8755 [(set_attr "type" "load")])
8757 ;; Used by sched, shorten_branches and final when the GOT pseudo reg
8758 ;; didn't get allocated to a hard register.
8760 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8761 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
8762 (match_operand:SI 2 "memory_operand" "")]
8764 "DEFAULT_ABI == ABI_V4
8766 && (reload_in_progress || reload_completed)"
8767 [(set (match_dup 0) (match_dup 2))
8768 (set (match_dup 0) (unspec:SI [(match_dup 1)(match_dup 0)]
8772 ;; For SI, we special-case integers that can't be loaded in one insn. We
8773 ;; do the load 16-bits at a time. We could do this by loading from memory,
8774 ;; and this is even supposed to be faster, but it is simpler not to get
8775 ;; integers in the TOC.
8776 (define_insn "movsi_low"
8777 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8778 (mem:SI (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
8779 (match_operand 2 "" ""))))]
8780 "TARGET_MACHO && ! TARGET_64BIT"
8781 "{l|lwz} %0,lo16(%2)(%1)"
8782 [(set_attr "type" "load")
8783 (set_attr "length" "4")])
8785 (define_insn "*movsi_internal1"
8786 [(set (match_operand:SI 0 "rs6000_nonimmediate_operand" "=r,r,r,m,r,r,r,r,r,*q,*c*l,*h,*h")
8787 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,R,*h,r,r,r,0"))]
8788 "!TARGET_SINGLE_FPU &&
8789 (gpc_reg_operand (operands[0], SImode) || gpc_reg_operand (operands[1], SImode))"
8793 {l%U1%X1|lwz%U1%X1} %0,%1
8794 {st%U0%X0|stw%U0%X0} %1,%0
8804 [(set_attr "type" "*,*,load,store,*,*,*,*,mfjmpr,*,mtjmpr,*,*")
8805 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4,4,4")])
8807 (define_insn "*movsi_internal1_single"
8808 [(set (match_operand:SI 0 "rs6000_nonimmediate_operand" "=r,r,r,m,r,r,r,r,r,*q,*c*l,*h,*h,m,*f")
8809 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,R,*h,r,r,r,0,f,m"))]
8810 "TARGET_SINGLE_FPU &&
8811 (gpc_reg_operand (operands[0], SImode) || gpc_reg_operand (operands[1], SImode))"
8815 {l%U1%X1|lwz%U1%X1} %0,%1
8816 {st%U0%X0|stw%U0%X0} %1,%0
8828 [(set_attr "type" "*,*,load,store,*,*,*,*,mfjmpr,*,mtjmpr,*,*,*,*")
8829 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4,4,4,4,4")])
8831 ;; Split a load of a large constant into the appropriate two-insn
8835 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8836 (match_operand:SI 1 "const_int_operand" ""))]
8837 "(unsigned HOST_WIDE_INT) (INTVAL (operands[1]) + 0x8000) >= 0x10000
8838 && (INTVAL (operands[1]) & 0xffff) != 0"
8842 (ior:SI (match_dup 0)
8845 { rtx tem = rs6000_emit_set_const (operands[0], SImode, operands[1], 2);
8847 if (tem == operands[0])
8853 (define_insn "*mov<mode>_internal2"
8854 [(set (match_operand:CC 2 "cc_reg_operand" "=y,x,?y")
8855 (compare:CC (match_operand:P 1 "gpc_reg_operand" "0,r,r")
8857 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r") (match_dup 1))]
8860 {cmpi|cmp<wd>i} %2,%0,0
8863 [(set_attr "type" "cmp,compare,cmp")
8864 (set_attr "length" "4,4,8")])
8867 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
8868 (compare:CC (match_operand:P 1 "gpc_reg_operand" "")
8870 (set (match_operand:P 0 "gpc_reg_operand" "") (match_dup 1))]
8872 [(set (match_dup 0) (match_dup 1))
8874 (compare:CC (match_dup 0)
8878 (define_insn "*movhi_internal"
8879 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
8880 (match_operand:HI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
8881 "gpc_reg_operand (operands[0], HImode)
8882 || gpc_reg_operand (operands[1], HImode)"
8892 [(set_attr "type" "*,load,store,*,mfjmpr,*,mtjmpr,*")])
8894 (define_expand "mov<mode>"
8895 [(set (match_operand:INT 0 "general_operand" "")
8896 (match_operand:INT 1 "any_operand" ""))]
8898 "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
8900 (define_insn "*movqi_internal"
8901 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
8902 (match_operand:QI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
8903 "gpc_reg_operand (operands[0], QImode)
8904 || gpc_reg_operand (operands[1], QImode)"
8914 [(set_attr "type" "*,load,store,*,mfjmpr,*,mtjmpr,*")])
8916 ;; Here is how to move condition codes around. When we store CC data in
8917 ;; an integer register or memory, we store just the high-order 4 bits.
8918 ;; This lets us not shift in the most common case of CR0.
8919 (define_expand "movcc"
8920 [(set (match_operand:CC 0 "nonimmediate_operand" "")
8921 (match_operand:CC 1 "nonimmediate_operand" ""))]
8925 (define_insn "*movcc_internal1"
8926 [(set (match_operand:CC 0 "nonimmediate_operand" "=y,x,?y,y,r,r,r,r,r,q,cl,r,m")
8927 (match_operand:CC 1 "general_operand" "y,r,r,O,x,y,r,I,h,r,r,m,r"))]
8928 "register_operand (operands[0], CCmode)
8929 || register_operand (operands[1], CCmode)"
8933 {rlinm|rlwinm} %1,%1,%F0,0xffffffff\;mtcrf %R0,%1\;{rlinm|rlwinm} %1,%1,%f0,0xffffffff
8936 mfcr %0%Q1\;{rlinm|rlwinm} %0,%0,%f1,0xf0000000
8942 {l%U1%X1|lwz%U1%X1} %0,%1
8943 {st%U0%U1|stw%U0%U1} %1,%0"
8945 (cond [(eq_attr "alternative" "0,3")
8946 (const_string "cr_logical")
8947 (eq_attr "alternative" "1,2")
8948 (const_string "mtcr")
8949 (eq_attr "alternative" "6,7,9")
8950 (const_string "integer")
8951 (eq_attr "alternative" "8")
8952 (const_string "mfjmpr")
8953 (eq_attr "alternative" "10")
8954 (const_string "mtjmpr")
8955 (eq_attr "alternative" "11")
8956 (const_string "load")
8957 (eq_attr "alternative" "12")
8958 (const_string "store")
8959 (ne (symbol_ref "TARGET_MFCRF") (const_int 0))
8960 (const_string "mfcrf")
8962 (const_string "mfcr")))
8963 (set_attr "length" "4,4,12,4,4,8,4,4,4,4,4,4,4")])
8965 ;; For floating-point, we normally deal with the floating-point registers
8966 ;; unless -msoft-float is used. The sole exception is that parameter passing
8967 ;; can produce floating-point values in fixed-point registers. Unless the
8968 ;; value is a simple constant or already in memory, we deal with this by
8969 ;; allocating memory and copying the value explicitly via that memory location.
8970 (define_expand "movsf"
8971 [(set (match_operand:SF 0 "nonimmediate_operand" "")
8972 (match_operand:SF 1 "any_operand" ""))]
8974 "{ rs6000_emit_move (operands[0], operands[1], SFmode); DONE; }")
8977 [(set (match_operand:SF 0 "gpc_reg_operand" "")
8978 (match_operand:SF 1 "const_double_operand" ""))]
8980 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8981 || (GET_CODE (operands[0]) == SUBREG
8982 && GET_CODE (SUBREG_REG (operands[0])) == REG
8983 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8984 [(set (match_dup 2) (match_dup 3))]
8990 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8991 REAL_VALUE_TO_TARGET_SINGLE (rv, l);
8993 if (! TARGET_POWERPC64)
8994 operands[2] = operand_subword (operands[0], 0, 0, SFmode);
8996 operands[2] = gen_lowpart (SImode, operands[0]);
8998 operands[3] = gen_int_mode (l, SImode);
9001 (define_insn "*movsf_hardfloat"
9002 [(set (match_operand:SF 0 "nonimmediate_operand" "=!r,!r,m,f,f,m,*c*l,*q,!r,*h,!r,!r")
9003 (match_operand:SF 1 "input_operand" "r,m,r,f,m,f,r,r,h,0,G,Fn"))]
9004 "(gpc_reg_operand (operands[0], SFmode)
9005 || gpc_reg_operand (operands[1], SFmode))
9006 && (TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT)"
9009 {l%U1%X1|lwz%U1%X1} %0,%1
9010 {st%U0%X0|stw%U0%X0} %1,%0
9020 [(set_attr "type" "*,load,store,fp,fpload,fpstore,mtjmpr,*,mfjmpr,*,*,*")
9021 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,8")])
9023 (define_insn "*movsf_softfloat"
9024 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,cl,q,r,r,m,r,r,r,r,r,*h")
9025 (match_operand:SF 1 "input_operand" "r,r,r,h,m,r,I,L,R,G,Fn,0"))]
9026 "(gpc_reg_operand (operands[0], SFmode)
9027 || gpc_reg_operand (operands[1], SFmode))
9028 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)"
9034 {l%U1%X1|lwz%U1%X1} %0,%1
9035 {st%U0%X0|stw%U0%X0} %1,%0
9042 [(set_attr "type" "*,mtjmpr,*,mfjmpr,load,store,*,*,*,*,*,*")
9043 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,8,4")])
9046 (define_expand "movdf"
9047 [(set (match_operand:DF 0 "nonimmediate_operand" "")
9048 (match_operand:DF 1 "any_operand" ""))]
9050 "{ rs6000_emit_move (operands[0], operands[1], DFmode); DONE; }")
9053 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9054 (match_operand:DF 1 "const_int_operand" ""))]
9055 "! TARGET_POWERPC64 && reload_completed
9056 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
9057 || (GET_CODE (operands[0]) == SUBREG
9058 && GET_CODE (SUBREG_REG (operands[0])) == REG
9059 && REGNO (SUBREG_REG (operands[0])) <= 31))"
9060 [(set (match_dup 2) (match_dup 4))
9061 (set (match_dup 3) (match_dup 1))]
9064 int endian = (WORDS_BIG_ENDIAN == 0);
9065 HOST_WIDE_INT value = INTVAL (operands[1]);
9067 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
9068 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
9069 #if HOST_BITS_PER_WIDE_INT == 32
9070 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
9072 operands[4] = GEN_INT (value >> 32);
9073 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
9078 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9079 (match_operand:DF 1 "const_double_operand" ""))]
9080 "! TARGET_POWERPC64 && reload_completed
9081 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
9082 || (GET_CODE (operands[0]) == SUBREG
9083 && GET_CODE (SUBREG_REG (operands[0])) == REG
9084 && REGNO (SUBREG_REG (operands[0])) <= 31))"
9085 [(set (match_dup 2) (match_dup 4))
9086 (set (match_dup 3) (match_dup 5))]
9089 int endian = (WORDS_BIG_ENDIAN == 0);
9093 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
9094 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
9096 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
9097 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
9098 operands[4] = gen_int_mode (l[endian], SImode);
9099 operands[5] = gen_int_mode (l[1 - endian], SImode);
9103 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9104 (match_operand:DF 1 "const_double_operand" ""))]
9105 "TARGET_POWERPC64 && reload_completed
9106 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
9107 || (GET_CODE (operands[0]) == SUBREG
9108 && GET_CODE (SUBREG_REG (operands[0])) == REG
9109 && REGNO (SUBREG_REG (operands[0])) <= 31))"
9110 [(set (match_dup 2) (match_dup 3))]
9113 int endian = (WORDS_BIG_ENDIAN == 0);
9116 #if HOST_BITS_PER_WIDE_INT >= 64
9120 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
9121 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
9123 operands[2] = gen_lowpart (DImode, operands[0]);
9124 /* HIGHPART is lower memory address when WORDS_BIG_ENDIAN. */
9125 #if HOST_BITS_PER_WIDE_INT >= 64
9126 val = ((HOST_WIDE_INT)(unsigned long)l[endian] << 32
9127 | ((HOST_WIDE_INT)(unsigned long)l[1 - endian]));
9129 operands[3] = gen_int_mode (val, DImode);
9131 operands[3] = immed_double_const (l[1 - endian], l[endian], DImode);
9135 ;; Don't have reload use general registers to load a constant. First,
9136 ;; it might not work if the output operand is the equivalent of
9137 ;; a non-offsettable memref, but also it is less efficient than loading
9138 ;; the constant into an FP register, since it will probably be used there.
9139 ;; The "??" is a kludge until we can figure out a more reasonable way
9140 ;; of handling these non-offsettable values.
9141 (define_insn "*movdf_hardfloat32"
9142 [(set (match_operand:DF 0 "nonimmediate_operand" "=!r,??r,m,ws,?wa,ws,?wa,Z,?Z,d,d,m,wa,!r,!r,!r")
9143 (match_operand:DF 1 "input_operand" "r,m,r,ws,wa,Z,Z,ws,wa,d,m,d,j,G,H,F"))]
9144 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9145 && (gpc_reg_operand (operands[0], DFmode)
9146 || gpc_reg_operand (operands[1], DFmode))"
9149 switch (which_alternative)
9159 return \"xxlor %x0,%x1,%x1\";
9162 return \"lxsd%U1x %x0,%y1\";
9165 return \"stxsd%U0x %x1,%y0\";
9167 return \"fmr %0,%1\";
9169 return \"lfd%U1%X1 %0,%1\";
9171 return \"stfd%U0%X0 %1,%0\";
9173 return \"xxlxor %x0,%x0,%x0\";
9180 [(set_attr "type" "two,load,store,fp,fp,fpload,fpload,fpstore,fpstore,fp,fpload,fpstore,vecsimple,*,*,*")
9181 (set_attr "length" "8,16,16,4,4,4,4,4,4,4,4,4,4,8,12,16")])
9183 (define_insn "*movdf_softfloat32"
9184 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,m,r,r,r")
9185 (match_operand:DF 1 "input_operand" "r,m,r,G,H,F"))]
9187 && ((TARGET_FPRS && TARGET_SINGLE_FLOAT)
9188 || TARGET_SOFT_FLOAT || TARGET_E500_SINGLE)
9189 && (gpc_reg_operand (operands[0], DFmode)
9190 || gpc_reg_operand (operands[1], DFmode))"
9192 [(set_attr "type" "two,load,store,*,*,*")
9193 (set_attr "length" "8,8,8,8,12,16")])
9195 ; ld/std require word-aligned displacements -> 'Y' constraint.
9196 ; List Y->r and r->Y before r->r for reload.
9197 (define_insn "*movdf_hardfloat64_mfpgpr"
9198 [(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")
9199 (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"))]
9200 "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
9201 && TARGET_DOUBLE_FLOAT
9202 && (gpc_reg_operand (operands[0], DFmode)
9203 || gpc_reg_operand (operands[1], DFmode))"
9226 [(set_attr "type" "store,load,*,fp,fp,fpload,fpload,fpstore,fpstore,fp,fpload,fpstore,vecsimple,mtjmpr,mfjmpr,*,*,*,*,mftgpr,mffgpr")
9227 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,8,12,16,4,4")])
9229 ; ld/std require word-aligned displacements -> 'Y' constraint.
9230 ; List Y->r and r->Y before r->r for reload.
9231 (define_insn "*movdf_hardfloat64"
9232 [(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")
9233 (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"))]
9234 "TARGET_POWERPC64 && !TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
9235 && TARGET_DOUBLE_FLOAT
9236 && (gpc_reg_operand (operands[0], DFmode)
9237 || gpc_reg_operand (operands[1], DFmode))"
9258 [(set_attr "type" "store,load,*,fp,fp,fpload,fpload,fpstore,fpstore,fp,fpload,fpstore,vecsimple,mtjmpr,mfjmpr,*,*,*,*")
9259 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,8,12,16")])
9261 (define_insn "*movdf_softfloat64"
9262 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,Y,r,cl,r,r,r,r,*h")
9263 (match_operand:DF 1 "input_operand" "Y,r,r,r,h,G,H,F,0"))]
9264 "TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)
9265 && (gpc_reg_operand (operands[0], DFmode)
9266 || gpc_reg_operand (operands[1], DFmode))"
9277 [(set_attr "type" "load,store,*,mtjmpr,mfjmpr,*,*,*,*")
9278 (set_attr "length" "4,4,4,4,4,8,12,16,4")])
9280 (define_expand "movtf"
9281 [(set (match_operand:TF 0 "general_operand" "")
9282 (match_operand:TF 1 "any_operand" ""))]
9283 "!TARGET_IEEEQUAD && TARGET_LONG_DOUBLE_128"
9284 "{ rs6000_emit_move (operands[0], operands[1], TFmode); DONE; }")
9286 ; It's important to list the o->f and f->o moves before f->f because
9287 ; otherwise reload, given m->f, will try to pick f->f and reload it,
9288 ; which doesn't make progress. Likewise r->Y must be before r->r.
9289 (define_insn_and_split "*movtf_internal"
9290 [(set (match_operand:TF 0 "nonimmediate_operand" "=o,d,d,r,Y,r")
9291 (match_operand:TF 1 "input_operand" "d,o,d,YGHF,r,r"))]
9293 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128
9294 && (gpc_reg_operand (operands[0], TFmode)
9295 || gpc_reg_operand (operands[1], TFmode))"
9297 "&& reload_completed"
9299 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
9300 [(set_attr "length" "8,8,8,20,20,16")])
9302 (define_insn_and_split "*movtf_softfloat"
9303 [(set (match_operand:TF 0 "rs6000_nonimmediate_operand" "=r,Y,r")
9304 (match_operand:TF 1 "input_operand" "YGHF,r,r"))]
9306 && (TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_LONG_DOUBLE_128
9307 && (gpc_reg_operand (operands[0], TFmode)
9308 || gpc_reg_operand (operands[1], TFmode))"
9310 "&& reload_completed"
9312 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
9313 [(set_attr "length" "20,20,16")])
9315 (define_expand "extenddftf2"
9316 [(set (match_operand:TF 0 "nonimmediate_operand" "")
9317 (float_extend:TF (match_operand:DF 1 "input_operand" "")))]
9319 && TARGET_HARD_FLOAT
9320 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9321 && TARGET_LONG_DOUBLE_128"
9323 if (TARGET_E500_DOUBLE)
9324 emit_insn (gen_spe_extenddftf2 (operands[0], operands[1]));
9326 emit_insn (gen_extenddftf2_fprs (operands[0], operands[1]));
9330 (define_expand "extenddftf2_fprs"
9331 [(parallel [(set (match_operand:TF 0 "nonimmediate_operand" "")
9332 (float_extend:TF (match_operand:DF 1 "input_operand" "")))
9333 (use (match_dup 2))])]
9335 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9336 && TARGET_LONG_DOUBLE_128"
9338 operands[2] = CONST0_RTX (DFmode);
9339 /* Generate GOT reference early for SVR4 PIC. */
9340 if (DEFAULT_ABI == ABI_V4 && flag_pic)
9341 operands[2] = validize_mem (force_const_mem (DFmode, operands[2]));
9344 (define_insn_and_split "*extenddftf2_internal"
9345 [(set (match_operand:TF 0 "nonimmediate_operand" "=o,d,&d,r")
9346 (float_extend:TF (match_operand:DF 1 "input_operand" "dr,md,md,rmGHF")))
9347 (use (match_operand:DF 2 "zero_reg_mem_operand" "rd,m,d,n"))]
9349 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9350 && TARGET_LONG_DOUBLE_128"
9352 "&& reload_completed"
9355 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
9356 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
9357 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word),
9359 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word),
9364 (define_expand "extendsftf2"
9365 [(set (match_operand:TF 0 "nonimmediate_operand" "")
9366 (float_extend:TF (match_operand:SF 1 "gpc_reg_operand" "")))]
9368 && TARGET_HARD_FLOAT
9369 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9370 && TARGET_LONG_DOUBLE_128"
9372 rtx tmp = gen_reg_rtx (DFmode);
9373 emit_insn (gen_extendsfdf2 (tmp, operands[1]));
9374 emit_insn (gen_extenddftf2 (operands[0], tmp));
9378 (define_expand "trunctfdf2"
9379 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9380 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "")))]
9382 && TARGET_HARD_FLOAT
9383 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9384 && TARGET_LONG_DOUBLE_128"
9387 (define_insn_and_split "trunctfdf2_internal1"
9388 [(set (match_operand:DF 0 "gpc_reg_operand" "=d,?d")
9389 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "0,d")))]
9390 "!TARGET_IEEEQUAD && !TARGET_XL_COMPAT
9391 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9395 "&& reload_completed && REGNO (operands[0]) == REGNO (operands[1])"
9398 emit_note (NOTE_INSN_DELETED);
9401 [(set_attr "type" "fp")])
9403 (define_insn "trunctfdf2_internal2"
9404 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
9405 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "d")))]
9406 "!TARGET_IEEEQUAD && TARGET_XL_COMPAT
9407 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9408 && TARGET_LONG_DOUBLE_128"
9410 [(set_attr "type" "fp")
9411 (set_attr "fp_type" "fp_addsub_d")])
9413 (define_expand "trunctfsf2"
9414 [(set (match_operand:SF 0 "gpc_reg_operand" "")
9415 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "")))]
9417 && TARGET_HARD_FLOAT
9418 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9419 && TARGET_LONG_DOUBLE_128"
9421 if (TARGET_E500_DOUBLE)
9422 emit_insn (gen_spe_trunctfsf2 (operands[0], operands[1]));
9424 emit_insn (gen_trunctfsf2_fprs (operands[0], operands[1]));
9428 (define_insn_and_split "trunctfsf2_fprs"
9429 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
9430 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "d")))
9431 (clobber (match_scratch:DF 2 "=d"))]
9433 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
9434 && TARGET_LONG_DOUBLE_128"
9436 "&& reload_completed"
9438 (float_truncate:DF (match_dup 1)))
9440 (float_truncate:SF (match_dup 2)))]
9443 (define_expand "floatsitf2"
9444 [(set (match_operand:TF 0 "gpc_reg_operand" "")
9445 (float:TF (match_operand:SI 1 "gpc_reg_operand" "")))]
9447 && TARGET_HARD_FLOAT
9448 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9449 && TARGET_LONG_DOUBLE_128"
9451 rtx tmp = gen_reg_rtx (DFmode);
9452 expand_float (tmp, operands[1], false);
9453 emit_insn (gen_extenddftf2 (operands[0], tmp));
9457 ; fadd, but rounding towards zero.
9458 ; This is probably not the optimal code sequence.
9459 (define_insn "fix_trunc_helper"
9460 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
9461 (unspec:DF [(match_operand:TF 1 "gpc_reg_operand" "d")]
9462 UNSPEC_FIX_TRUNC_TF))
9463 (clobber (match_operand:DF 2 "gpc_reg_operand" "=&d"))]
9464 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
9465 "mffs %2\n\tmtfsb1 31\n\tmtfsb0 30\n\tfadd %0,%1,%L1\n\tmtfsf 1,%2"
9466 [(set_attr "type" "fp")
9467 (set_attr "length" "20")])
9469 (define_expand "fix_trunctfsi2"
9470 [(set (match_operand:SI 0 "gpc_reg_operand" "")
9471 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))]
9473 && (TARGET_POWER2 || TARGET_POWERPC)
9474 && TARGET_HARD_FLOAT
9475 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9476 && TARGET_LONG_DOUBLE_128"
9478 if (TARGET_E500_DOUBLE)
9479 emit_insn (gen_spe_fix_trunctfsi2 (operands[0], operands[1]));
9481 emit_insn (gen_fix_trunctfsi2_fprs (operands[0], operands[1]));
9485 (define_expand "fix_trunctfsi2_fprs"
9486 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
9487 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))
9488 (clobber (match_dup 2))
9489 (clobber (match_dup 3))
9490 (clobber (match_dup 4))
9491 (clobber (match_dup 5))])]
9493 && (TARGET_POWER2 || TARGET_POWERPC)
9494 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9496 operands[2] = gen_reg_rtx (DFmode);
9497 operands[3] = gen_reg_rtx (DFmode);
9498 operands[4] = gen_reg_rtx (DImode);
9499 operands[5] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
9502 (define_insn_and_split "*fix_trunctfsi2_internal"
9503 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9504 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "d")))
9505 (clobber (match_operand:DF 2 "gpc_reg_operand" "=d"))
9506 (clobber (match_operand:DF 3 "gpc_reg_operand" "=&d"))
9507 (clobber (match_operand:DI 4 "gpc_reg_operand" "=d"))
9508 (clobber (match_operand:DI 5 "offsettable_mem_operand" "=o"))]
9510 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9516 emit_insn (gen_fix_trunc_helper (operands[2], operands[1], operands[3]));
9518 gcc_assert (MEM_P (operands[5]));
9519 lowword = adjust_address (operands[5], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
9521 emit_insn (gen_fctiwz (operands[4], operands[2]));
9522 emit_move_insn (operands[5], operands[4]);
9523 emit_move_insn (operands[0], lowword);
9527 (define_expand "negtf2"
9528 [(set (match_operand:TF 0 "gpc_reg_operand" "")
9529 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "")))]
9531 && TARGET_HARD_FLOAT
9532 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9533 && TARGET_LONG_DOUBLE_128"
9536 (define_insn "negtf2_internal"
9537 [(set (match_operand:TF 0 "gpc_reg_operand" "=d")
9538 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "d")))]
9540 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9543 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
9544 return \"fneg %L0,%L1\;fneg %0,%1\";
9546 return \"fneg %0,%1\;fneg %L0,%L1\";
9548 [(set_attr "type" "fp")
9549 (set_attr "length" "8")])
9551 (define_expand "abstf2"
9552 [(set (match_operand:TF 0 "gpc_reg_operand" "")
9553 (abs:TF (match_operand:TF 1 "gpc_reg_operand" "")))]
9555 && TARGET_HARD_FLOAT
9556 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9557 && TARGET_LONG_DOUBLE_128"
9560 rtx label = gen_label_rtx ();
9561 if (TARGET_E500_DOUBLE)
9563 if (flag_finite_math_only && !flag_trapping_math)
9564 emit_insn (gen_spe_abstf2_tst (operands[0], operands[1], label));
9566 emit_insn (gen_spe_abstf2_cmp (operands[0], operands[1], label));
9569 emit_insn (gen_abstf2_internal (operands[0], operands[1], label));
9574 (define_expand "abstf2_internal"
9575 [(set (match_operand:TF 0 "gpc_reg_operand" "")
9576 (match_operand:TF 1 "gpc_reg_operand" ""))
9577 (set (match_dup 3) (match_dup 5))
9578 (set (match_dup 5) (abs:DF (match_dup 5)))
9579 (set (match_dup 4) (compare:CCFP (match_dup 3) (match_dup 5)))
9580 (set (pc) (if_then_else (eq (match_dup 4) (const_int 0))
9581 (label_ref (match_operand 2 "" ""))
9583 (set (match_dup 6) (neg:DF (match_dup 6)))]
9585 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9586 && TARGET_LONG_DOUBLE_128"
9589 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
9590 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
9591 operands[3] = gen_reg_rtx (DFmode);
9592 operands[4] = gen_reg_rtx (CCFPmode);
9593 operands[5] = simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word);
9594 operands[6] = simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word);
9597 ;; Next come the multi-word integer load and store and the load and store
9600 ; List r->r after r->"o<>", otherwise reload will try to reload a
9601 ; non-offsettable address by using r->r which won't make progress.
9602 (define_insn "*movdi_internal32"
9603 [(set (match_operand:DI 0 "rs6000_nonimmediate_operand" "=o<>,r,r,*d,*d,m,r")
9604 (match_operand:DI 1 "input_operand" "r,r,m,d,m,d,IJKnGHF"))]
9606 && (gpc_reg_operand (operands[0], DImode)
9607 || gpc_reg_operand (operands[1], DImode))"
9616 [(set_attr "type" "load,*,store,fp,fpload,fpstore,*")])
9619 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9620 (match_operand:DI 1 "const_int_operand" ""))]
9621 "! TARGET_POWERPC64 && reload_completed"
9622 [(set (match_dup 2) (match_dup 4))
9623 (set (match_dup 3) (match_dup 1))]
9626 HOST_WIDE_INT value = INTVAL (operands[1]);
9627 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
9629 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
9631 #if HOST_BITS_PER_WIDE_INT == 32
9632 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
9634 operands[4] = GEN_INT (value >> 32);
9635 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
9640 [(set (match_operand:DIFD 0 "rs6000_nonimmediate_operand" "")
9641 (match_operand:DIFD 1 "input_operand" ""))]
9642 "reload_completed && !TARGET_POWERPC64
9643 && gpr_or_gpr_p (operands[0], operands[1])"
9645 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
9647 (define_insn "*movdi_mfpgpr"
9648 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,*d,*d,m,r,*h,*h,r,*d")
9649 (match_operand:DI 1 "input_operand" "r,m,r,I,L,nF,R,d,m,d,*h,r,0,*d,r"))]
9650 "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
9651 && (gpc_reg_operand (operands[0], DImode)
9652 || gpc_reg_operand (operands[1], DImode))"
9669 [(set_attr "type" "*,load,store,*,*,*,*,fp,fpload,fpstore,mfjmpr,mtjmpr,*,mftgpr,mffgpr")
9670 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4,4,4")])
9672 (define_insn "*movdi_internal64"
9673 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,*d,*d,m,r,*h,*h")
9674 (match_operand:DI 1 "input_operand" "r,m,r,I,L,nF,R,d,m,d,*h,r,0"))]
9675 "TARGET_POWERPC64 && (!TARGET_MFPGPR || !TARGET_HARD_FLOAT || !TARGET_FPRS)
9676 && (gpc_reg_operand (operands[0], DImode)
9677 || gpc_reg_operand (operands[1], DImode))"
9692 [(set_attr "type" "*,load,store,*,*,*,*,fp,fpload,fpstore,mfjmpr,mtjmpr,*")
9693 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4")])
9695 ;; immediate value valid for a single instruction hiding in a const_double
9697 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9698 (match_operand:DI 1 "const_double_operand" "F"))]
9699 "HOST_BITS_PER_WIDE_INT == 32 && TARGET_POWERPC64
9700 && GET_CODE (operands[1]) == CONST_DOUBLE
9701 && num_insns_constant (operands[1], DImode) == 1"
9704 return ((unsigned HOST_WIDE_INT)
9705 (CONST_DOUBLE_LOW (operands[1]) + 0x8000) < 0x10000)
9706 ? \"li %0,%1\" : \"lis %0,%v1\";
9709 ;; Generate all one-bits and clear left or right.
9710 ;; Use (and:DI (rotate:DI ...)) to avoid anddi3 unnecessary clobber.
9712 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9713 (match_operand:DI 1 "mask64_operand" ""))]
9714 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
9715 [(set (match_dup 0) (const_int -1))
9717 (and:DI (rotate:DI (match_dup 0)
9722 ;; Split a load of a large constant into the appropriate five-instruction
9723 ;; sequence. Handle anything in a constant number of insns.
9724 ;; When non-easy constants can go in the TOC, this should use
9725 ;; easy_fp_constant predicate.
9727 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9728 (match_operand:DI 1 "const_int_operand" ""))]
9729 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
9730 [(set (match_dup 0) (match_dup 2))
9731 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
9733 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
9735 if (tem == operands[0])
9742 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9743 (match_operand:DI 1 "const_double_operand" ""))]
9744 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
9745 [(set (match_dup 0) (match_dup 2))
9746 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
9748 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
9750 if (tem == operands[0])
9756 ;; TImode is similar, except that we usually want to compute the address into
9757 ;; a register and use lsi/stsi (the exception is during reload). MQ is also
9758 ;; clobbered in stsi for POWER, so we need a SCRATCH for it.
9760 ;; We say that MQ is clobbered in the last alternative because the first
9761 ;; alternative would never get used otherwise since it would need a reload
9762 ;; while the 2nd alternative would not. We put memory cases first so they
9763 ;; are preferred. Otherwise, we'd try to reload the output instead of
9764 ;; giving the SCRATCH mq.
9766 (define_insn "*movti_power"
9767 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,m,????r,????r,????r,r")
9768 (match_operand:TI 1 "input_operand" "r,r,r,Q,m,n"))
9769 (clobber (match_scratch:SI 2 "=q,q#X,X,X,X,X"))]
9770 "TARGET_POWER && ! TARGET_POWERPC64
9771 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
9774 switch (which_alternative)
9781 return \"{stsi|stswi} %1,%P0,16\";
9786 /* If the address is not used in the output, we can use lsi. Otherwise,
9787 fall through to generating four loads. */
9789 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
9790 return \"{lsi|lswi} %0,%P1,16\";
9791 /* ... fall through ... */
9797 [(set_attr "type" "store,store,*,load,load,*")])
9799 (define_insn "*movti_string"
9800 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,o<>,????r,????r,????r,r")
9801 (match_operand:TI 1 "input_operand" "r,r,r,Q,m,n"))]
9802 "! TARGET_POWER && ! TARGET_POWERPC64
9803 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
9806 switch (which_alternative)
9812 return \"{stsi|stswi} %1,%P0,16\";
9817 /* If the address is not used in the output, we can use lsi. Otherwise,
9818 fall through to generating four loads. */
9820 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
9821 return \"{lsi|lswi} %0,%P1,16\";
9822 /* ... fall through ... */
9828 [(set_attr "type" "store_ux,store_ux,*,load_ux,load_ux,*")
9829 (set (attr "cell_micro") (if_then_else (eq (symbol_ref "TARGET_STRING") (const_int 1))
9830 (const_string "always")
9831 (const_string "conditional")))])
9833 (define_insn "*movti_ppc64"
9834 [(set (match_operand:TI 0 "nonimmediate_operand" "=r,o<>,r")
9835 (match_operand:TI 1 "input_operand" "r,r,m"))]
9836 "(TARGET_POWERPC64 && (gpc_reg_operand (operands[0], TImode)
9837 || gpc_reg_operand (operands[1], TImode)))
9838 && VECTOR_MEM_NONE_P (TImode)"
9840 [(set_attr "type" "*,store,load")])
9843 [(set (match_operand:TI 0 "gpc_reg_operand" "")
9844 (match_operand:TI 1 "const_double_operand" ""))]
9845 "TARGET_POWERPC64 && VECTOR_MEM_NONE_P (TImode)"
9846 [(set (match_dup 2) (match_dup 4))
9847 (set (match_dup 3) (match_dup 5))]
9850 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
9852 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
9854 if (GET_CODE (operands[1]) == CONST_DOUBLE)
9856 operands[4] = GEN_INT (CONST_DOUBLE_HIGH (operands[1]));
9857 operands[5] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
9859 else if (GET_CODE (operands[1]) == CONST_INT)
9861 operands[4] = GEN_INT (- (INTVAL (operands[1]) < 0));
9862 operands[5] = operands[1];
9869 [(set (match_operand:TI 0 "nonimmediate_operand" "")
9870 (match_operand:TI 1 "input_operand" ""))]
9871 "reload_completed && VECTOR_MEM_NONE_P (TImode)
9872 && gpr_or_gpr_p (operands[0], operands[1])"
9874 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
9876 (define_expand "load_multiple"
9877 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
9878 (match_operand:SI 1 "" ""))
9879 (use (match_operand:SI 2 "" ""))])]
9880 "TARGET_STRING && !TARGET_POWERPC64"
9888 /* Support only loading a constant number of fixed-point registers from
9889 memory and only bother with this if more than two; the machine
9890 doesn't support more than eight. */
9891 if (GET_CODE (operands[2]) != CONST_INT
9892 || INTVAL (operands[2]) <= 2
9893 || INTVAL (operands[2]) > 8
9894 || GET_CODE (operands[1]) != MEM
9895 || GET_CODE (operands[0]) != REG
9896 || REGNO (operands[0]) >= 32)
9899 count = INTVAL (operands[2]);
9900 regno = REGNO (operands[0]);
9902 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
9903 op1 = replace_equiv_address (operands[1],
9904 force_reg (SImode, XEXP (operands[1], 0)));
9906 for (i = 0; i < count; i++)
9907 XVECEXP (operands[3], 0, i)
9908 = gen_rtx_SET (VOIDmode, gen_rtx_REG (SImode, regno + i),
9909 adjust_address_nv (op1, SImode, i * 4));
9912 (define_insn "*ldmsi8"
9913 [(match_parallel 0 "load_multiple_operation"
9914 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9915 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9916 (set (match_operand:SI 3 "gpc_reg_operand" "")
9917 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9918 (set (match_operand:SI 4 "gpc_reg_operand" "")
9919 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9920 (set (match_operand:SI 5 "gpc_reg_operand" "")
9921 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
9922 (set (match_operand:SI 6 "gpc_reg_operand" "")
9923 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
9924 (set (match_operand:SI 7 "gpc_reg_operand" "")
9925 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
9926 (set (match_operand:SI 8 "gpc_reg_operand" "")
9927 (mem:SI (plus:SI (match_dup 1) (const_int 24))))
9928 (set (match_operand:SI 9 "gpc_reg_operand" "")
9929 (mem:SI (plus:SI (match_dup 1) (const_int 28))))])]
9930 "TARGET_STRING && XVECLEN (operands[0], 0) == 8"
9932 { return rs6000_output_load_multiple (operands); }"
9933 [(set_attr "type" "load_ux")
9934 (set_attr "length" "32")])
9936 (define_insn "*ldmsi7"
9937 [(match_parallel 0 "load_multiple_operation"
9938 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9939 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9940 (set (match_operand:SI 3 "gpc_reg_operand" "")
9941 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9942 (set (match_operand:SI 4 "gpc_reg_operand" "")
9943 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9944 (set (match_operand:SI 5 "gpc_reg_operand" "")
9945 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
9946 (set (match_operand:SI 6 "gpc_reg_operand" "")
9947 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
9948 (set (match_operand:SI 7 "gpc_reg_operand" "")
9949 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
9950 (set (match_operand:SI 8 "gpc_reg_operand" "")
9951 (mem:SI (plus:SI (match_dup 1) (const_int 24))))])]
9952 "TARGET_STRING && XVECLEN (operands[0], 0) == 7"
9954 { return rs6000_output_load_multiple (operands); }"
9955 [(set_attr "type" "load_ux")
9956 (set_attr "length" "32")])
9958 (define_insn "*ldmsi6"
9959 [(match_parallel 0 "load_multiple_operation"
9960 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9961 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9962 (set (match_operand:SI 3 "gpc_reg_operand" "")
9963 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9964 (set (match_operand:SI 4 "gpc_reg_operand" "")
9965 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9966 (set (match_operand:SI 5 "gpc_reg_operand" "")
9967 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
9968 (set (match_operand:SI 6 "gpc_reg_operand" "")
9969 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
9970 (set (match_operand:SI 7 "gpc_reg_operand" "")
9971 (mem:SI (plus:SI (match_dup 1) (const_int 20))))])]
9972 "TARGET_STRING && XVECLEN (operands[0], 0) == 6"
9974 { return rs6000_output_load_multiple (operands); }"
9975 [(set_attr "type" "load_ux")
9976 (set_attr "length" "32")])
9978 (define_insn "*ldmsi5"
9979 [(match_parallel 0 "load_multiple_operation"
9980 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9981 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9982 (set (match_operand:SI 3 "gpc_reg_operand" "")
9983 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9984 (set (match_operand:SI 4 "gpc_reg_operand" "")
9985 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9986 (set (match_operand:SI 5 "gpc_reg_operand" "")
9987 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
9988 (set (match_operand:SI 6 "gpc_reg_operand" "")
9989 (mem:SI (plus:SI (match_dup 1) (const_int 16))))])]
9990 "TARGET_STRING && XVECLEN (operands[0], 0) == 5"
9992 { return rs6000_output_load_multiple (operands); }"
9993 [(set_attr "type" "load_ux")
9994 (set_attr "length" "32")])
9996 (define_insn "*ldmsi4"
9997 [(match_parallel 0 "load_multiple_operation"
9998 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9999 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10000 (set (match_operand:SI 3 "gpc_reg_operand" "")
10001 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10002 (set (match_operand:SI 4 "gpc_reg_operand" "")
10003 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
10004 (set (match_operand:SI 5 "gpc_reg_operand" "")
10005 (mem:SI (plus:SI (match_dup 1) (const_int 12))))])]
10006 "TARGET_STRING && XVECLEN (operands[0], 0) == 4"
10008 { return rs6000_output_load_multiple (operands); }"
10009 [(set_attr "type" "load_ux")
10010 (set_attr "length" "32")])
10012 (define_insn "*ldmsi3"
10013 [(match_parallel 0 "load_multiple_operation"
10014 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10015 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10016 (set (match_operand:SI 3 "gpc_reg_operand" "")
10017 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10018 (set (match_operand:SI 4 "gpc_reg_operand" "")
10019 (mem:SI (plus:SI (match_dup 1) (const_int 8))))])]
10020 "TARGET_STRING && XVECLEN (operands[0], 0) == 3"
10022 { return rs6000_output_load_multiple (operands); }"
10023 [(set_attr "type" "load_ux")
10024 (set_attr "length" "32")])
10026 (define_expand "store_multiple"
10027 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
10028 (match_operand:SI 1 "" ""))
10029 (clobber (scratch:SI))
10030 (use (match_operand:SI 2 "" ""))])]
10031 "TARGET_STRING && !TARGET_POWERPC64"
10040 /* Support only storing a constant number of fixed-point registers to
10041 memory and only bother with this if more than two; the machine
10042 doesn't support more than eight. */
10043 if (GET_CODE (operands[2]) != CONST_INT
10044 || INTVAL (operands[2]) <= 2
10045 || INTVAL (operands[2]) > 8
10046 || GET_CODE (operands[0]) != MEM
10047 || GET_CODE (operands[1]) != REG
10048 || REGNO (operands[1]) >= 32)
10051 count = INTVAL (operands[2]);
10052 regno = REGNO (operands[1]);
10054 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count + 1));
10055 to = force_reg (SImode, XEXP (operands[0], 0));
10056 op0 = replace_equiv_address (operands[0], to);
10058 XVECEXP (operands[3], 0, 0)
10059 = gen_rtx_SET (VOIDmode, adjust_address_nv (op0, SImode, 0), operands[1]);
10060 XVECEXP (operands[3], 0, 1) = gen_rtx_CLOBBER (VOIDmode,
10061 gen_rtx_SCRATCH (SImode));
10063 for (i = 1; i < count; i++)
10064 XVECEXP (operands[3], 0, i + 1)
10065 = gen_rtx_SET (VOIDmode,
10066 adjust_address_nv (op0, SImode, i * 4),
10067 gen_rtx_REG (SImode, regno + i));
10070 (define_insn "*stmsi8"
10071 [(match_parallel 0 "store_multiple_operation"
10072 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10073 (match_operand:SI 2 "gpc_reg_operand" "r"))
10074 (clobber (match_scratch:SI 3 "=X"))
10075 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10076 (match_operand:SI 4 "gpc_reg_operand" "r"))
10077 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10078 (match_operand:SI 5 "gpc_reg_operand" "r"))
10079 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10080 (match_operand:SI 6 "gpc_reg_operand" "r"))
10081 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10082 (match_operand:SI 7 "gpc_reg_operand" "r"))
10083 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10084 (match_operand:SI 8 "gpc_reg_operand" "r"))
10085 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
10086 (match_operand:SI 9 "gpc_reg_operand" "r"))
10087 (set (mem:SI (plus:SI (match_dup 1) (const_int 28)))
10088 (match_operand:SI 10 "gpc_reg_operand" "r"))])]
10089 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 9"
10090 "{stsi|stswi} %2,%1,%O0"
10091 [(set_attr "type" "store_ux")
10092 (set_attr "cell_micro" "always")])
10094 (define_insn "*stmsi7"
10095 [(match_parallel 0 "store_multiple_operation"
10096 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10097 (match_operand:SI 2 "gpc_reg_operand" "r"))
10098 (clobber (match_scratch:SI 3 "=X"))
10099 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10100 (match_operand:SI 4 "gpc_reg_operand" "r"))
10101 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10102 (match_operand:SI 5 "gpc_reg_operand" "r"))
10103 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10104 (match_operand:SI 6 "gpc_reg_operand" "r"))
10105 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10106 (match_operand:SI 7 "gpc_reg_operand" "r"))
10107 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10108 (match_operand:SI 8 "gpc_reg_operand" "r"))
10109 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
10110 (match_operand:SI 9 "gpc_reg_operand" "r"))])]
10111 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 8"
10112 "{stsi|stswi} %2,%1,%O0"
10113 [(set_attr "type" "store_ux")
10114 (set_attr "cell_micro" "always")])
10116 (define_insn "*stmsi6"
10117 [(match_parallel 0 "store_multiple_operation"
10118 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10119 (match_operand:SI 2 "gpc_reg_operand" "r"))
10120 (clobber (match_scratch:SI 3 "=X"))
10121 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10122 (match_operand:SI 4 "gpc_reg_operand" "r"))
10123 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10124 (match_operand:SI 5 "gpc_reg_operand" "r"))
10125 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10126 (match_operand:SI 6 "gpc_reg_operand" "r"))
10127 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10128 (match_operand:SI 7 "gpc_reg_operand" "r"))
10129 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10130 (match_operand:SI 8 "gpc_reg_operand" "r"))])]
10131 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 7"
10132 "{stsi|stswi} %2,%1,%O0"
10133 [(set_attr "type" "store_ux")
10134 (set_attr "cell_micro" "always")])
10136 (define_insn "*stmsi5"
10137 [(match_parallel 0 "store_multiple_operation"
10138 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10139 (match_operand:SI 2 "gpc_reg_operand" "r"))
10140 (clobber (match_scratch:SI 3 "=X"))
10141 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10142 (match_operand:SI 4 "gpc_reg_operand" "r"))
10143 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10144 (match_operand:SI 5 "gpc_reg_operand" "r"))
10145 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10146 (match_operand:SI 6 "gpc_reg_operand" "r"))
10147 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10148 (match_operand:SI 7 "gpc_reg_operand" "r"))])]
10149 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 6"
10150 "{stsi|stswi} %2,%1,%O0"
10151 [(set_attr "type" "store_ux")
10152 (set_attr "cell_micro" "always")])
10154 (define_insn "*stmsi4"
10155 [(match_parallel 0 "store_multiple_operation"
10156 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10157 (match_operand:SI 2 "gpc_reg_operand" "r"))
10158 (clobber (match_scratch:SI 3 "=X"))
10159 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10160 (match_operand:SI 4 "gpc_reg_operand" "r"))
10161 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10162 (match_operand:SI 5 "gpc_reg_operand" "r"))
10163 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10164 (match_operand:SI 6 "gpc_reg_operand" "r"))])]
10165 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 5"
10166 "{stsi|stswi} %2,%1,%O0"
10167 [(set_attr "type" "store_ux")
10168 (set_attr "cell_micro" "always")])
10170 (define_insn "*stmsi3"
10171 [(match_parallel 0 "store_multiple_operation"
10172 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10173 (match_operand:SI 2 "gpc_reg_operand" "r"))
10174 (clobber (match_scratch:SI 3 "=X"))
10175 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10176 (match_operand:SI 4 "gpc_reg_operand" "r"))
10177 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10178 (match_operand:SI 5 "gpc_reg_operand" "r"))])]
10179 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 4"
10180 "{stsi|stswi} %2,%1,%O0"
10181 [(set_attr "type" "store_ux")
10182 (set_attr "cell_micro" "always")])
10184 (define_insn "*stmsi8_power"
10185 [(match_parallel 0 "store_multiple_operation"
10186 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10187 (match_operand:SI 2 "gpc_reg_operand" "r"))
10188 (clobber (match_scratch:SI 3 "=q"))
10189 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10190 (match_operand:SI 4 "gpc_reg_operand" "r"))
10191 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10192 (match_operand:SI 5 "gpc_reg_operand" "r"))
10193 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10194 (match_operand:SI 6 "gpc_reg_operand" "r"))
10195 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10196 (match_operand:SI 7 "gpc_reg_operand" "r"))
10197 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10198 (match_operand:SI 8 "gpc_reg_operand" "r"))
10199 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
10200 (match_operand:SI 9 "gpc_reg_operand" "r"))
10201 (set (mem:SI (plus:SI (match_dup 1) (const_int 28)))
10202 (match_operand:SI 10 "gpc_reg_operand" "r"))])]
10203 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 9"
10204 "{stsi|stswi} %2,%1,%O0"
10205 [(set_attr "type" "store_ux")
10206 (set_attr "cell_micro" "always")])
10208 (define_insn "*stmsi7_power"
10209 [(match_parallel 0 "store_multiple_operation"
10210 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10211 (match_operand:SI 2 "gpc_reg_operand" "r"))
10212 (clobber (match_scratch:SI 3 "=q"))
10213 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10214 (match_operand:SI 4 "gpc_reg_operand" "r"))
10215 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10216 (match_operand:SI 5 "gpc_reg_operand" "r"))
10217 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10218 (match_operand:SI 6 "gpc_reg_operand" "r"))
10219 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10220 (match_operand:SI 7 "gpc_reg_operand" "r"))
10221 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10222 (match_operand:SI 8 "gpc_reg_operand" "r"))
10223 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
10224 (match_operand:SI 9 "gpc_reg_operand" "r"))])]
10225 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 8"
10226 "{stsi|stswi} %2,%1,%O0"
10227 [(set_attr "type" "store_ux")
10228 (set_attr "cell_micro" "always")])
10230 (define_insn "*stmsi6_power"
10231 [(match_parallel 0 "store_multiple_operation"
10232 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10233 (match_operand:SI 2 "gpc_reg_operand" "r"))
10234 (clobber (match_scratch:SI 3 "=q"))
10235 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10236 (match_operand:SI 4 "gpc_reg_operand" "r"))
10237 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10238 (match_operand:SI 5 "gpc_reg_operand" "r"))
10239 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10240 (match_operand:SI 6 "gpc_reg_operand" "r"))
10241 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10242 (match_operand:SI 7 "gpc_reg_operand" "r"))
10243 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10244 (match_operand:SI 8 "gpc_reg_operand" "r"))])]
10245 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 7"
10246 "{stsi|stswi} %2,%1,%O0"
10247 [(set_attr "type" "store_ux")
10248 (set_attr "cell_micro" "always")])
10250 (define_insn "*stmsi5_power"
10251 [(match_parallel 0 "store_multiple_operation"
10252 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10253 (match_operand:SI 2 "gpc_reg_operand" "r"))
10254 (clobber (match_scratch:SI 3 "=q"))
10255 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10256 (match_operand:SI 4 "gpc_reg_operand" "r"))
10257 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10258 (match_operand:SI 5 "gpc_reg_operand" "r"))
10259 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10260 (match_operand:SI 6 "gpc_reg_operand" "r"))
10261 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10262 (match_operand:SI 7 "gpc_reg_operand" "r"))])]
10263 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 6"
10264 "{stsi|stswi} %2,%1,%O0"
10265 [(set_attr "type" "store_ux")
10266 (set_attr "cell_micro" "always")])
10268 (define_insn "*stmsi4_power"
10269 [(match_parallel 0 "store_multiple_operation"
10270 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10271 (match_operand:SI 2 "gpc_reg_operand" "r"))
10272 (clobber (match_scratch:SI 3 "=q"))
10273 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10274 (match_operand:SI 4 "gpc_reg_operand" "r"))
10275 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10276 (match_operand:SI 5 "gpc_reg_operand" "r"))
10277 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10278 (match_operand:SI 6 "gpc_reg_operand" "r"))])]
10279 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 5"
10280 "{stsi|stswi} %2,%1,%O0"
10281 [(set_attr "type" "store_ux")
10282 (set_attr "cell_micro" "always")])
10284 (define_insn "*stmsi3_power"
10285 [(match_parallel 0 "store_multiple_operation"
10286 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10287 (match_operand:SI 2 "gpc_reg_operand" "r"))
10288 (clobber (match_scratch:SI 3 "=q"))
10289 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10290 (match_operand:SI 4 "gpc_reg_operand" "r"))
10291 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10292 (match_operand:SI 5 "gpc_reg_operand" "r"))])]
10293 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 4"
10294 "{stsi|stswi} %2,%1,%O0"
10295 [(set_attr "type" "store_ux")
10296 (set_attr "cell_micro" "always")])
10298 (define_expand "setmemsi"
10299 [(parallel [(set (match_operand:BLK 0 "" "")
10300 (match_operand 2 "const_int_operand" ""))
10301 (use (match_operand:SI 1 "" ""))
10302 (use (match_operand:SI 3 "" ""))])]
10306 /* If value to set is not zero, use the library routine. */
10307 if (operands[2] != const0_rtx)
10310 if (expand_block_clear (operands))
10316 ;; String/block move insn.
10317 ;; Argument 0 is the destination
10318 ;; Argument 1 is the source
10319 ;; Argument 2 is the length
10320 ;; Argument 3 is the alignment
10322 (define_expand "movmemsi"
10323 [(parallel [(set (match_operand:BLK 0 "" "")
10324 (match_operand:BLK 1 "" ""))
10325 (use (match_operand:SI 2 "" ""))
10326 (use (match_operand:SI 3 "" ""))])]
10330 if (expand_block_move (operands))
10336 ;; Move up to 32 bytes at a time. The fixed registers are needed because the
10337 ;; register allocator doesn't have a clue about allocating 8 word registers.
10338 ;; rD/rS = r5 is preferred, efficient form.
10339 (define_expand "movmemsi_8reg"
10340 [(parallel [(set (match_operand 0 "" "")
10341 (match_operand 1 "" ""))
10342 (use (match_operand 2 "" ""))
10343 (use (match_operand 3 "" ""))
10344 (clobber (reg:SI 5))
10345 (clobber (reg:SI 6))
10346 (clobber (reg:SI 7))
10347 (clobber (reg:SI 8))
10348 (clobber (reg:SI 9))
10349 (clobber (reg:SI 10))
10350 (clobber (reg:SI 11))
10351 (clobber (reg:SI 12))
10352 (clobber (match_scratch:SI 4 ""))])]
10357 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
10358 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
10359 (use (match_operand:SI 2 "immediate_operand" "i"))
10360 (use (match_operand:SI 3 "immediate_operand" "i"))
10361 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10362 (clobber (reg:SI 6))
10363 (clobber (reg:SI 7))
10364 (clobber (reg:SI 8))
10365 (clobber (reg:SI 9))
10366 (clobber (reg:SI 10))
10367 (clobber (reg:SI 11))
10368 (clobber (reg:SI 12))
10369 (clobber (match_scratch:SI 5 "=q"))]
10370 "TARGET_STRING && TARGET_POWER
10371 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
10372 || INTVAL (operands[2]) == 0)
10373 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
10374 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
10375 && REGNO (operands[4]) == 5"
10376 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10377 [(set_attr "type" "store_ux")
10378 (set_attr "cell_micro" "always")
10379 (set_attr "length" "8")])
10382 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
10383 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
10384 (use (match_operand:SI 2 "immediate_operand" "i"))
10385 (use (match_operand:SI 3 "immediate_operand" "i"))
10386 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10387 (clobber (reg:SI 6))
10388 (clobber (reg:SI 7))
10389 (clobber (reg:SI 8))
10390 (clobber (reg:SI 9))
10391 (clobber (reg:SI 10))
10392 (clobber (reg:SI 11))
10393 (clobber (reg:SI 12))
10394 (clobber (match_scratch:SI 5 "=X"))]
10395 "TARGET_STRING && ! TARGET_POWER
10396 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
10397 || INTVAL (operands[2]) == 0)
10398 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
10399 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
10400 && REGNO (operands[4]) == 5"
10401 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10402 [(set_attr "type" "store_ux")
10403 (set_attr "cell_micro" "always")
10404 (set_attr "length" "8")])
10406 ;; Move up to 24 bytes at a time. The fixed registers are needed because the
10407 ;; register allocator doesn't have a clue about allocating 6 word registers.
10408 ;; rD/rS = r5 is preferred, efficient form.
10409 (define_expand "movmemsi_6reg"
10410 [(parallel [(set (match_operand 0 "" "")
10411 (match_operand 1 "" ""))
10412 (use (match_operand 2 "" ""))
10413 (use (match_operand 3 "" ""))
10414 (clobber (reg:SI 5))
10415 (clobber (reg:SI 6))
10416 (clobber (reg:SI 7))
10417 (clobber (reg:SI 8))
10418 (clobber (reg:SI 9))
10419 (clobber (reg:SI 10))
10420 (clobber (match_scratch:SI 4 ""))])]
10425 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
10426 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
10427 (use (match_operand:SI 2 "immediate_operand" "i"))
10428 (use (match_operand:SI 3 "immediate_operand" "i"))
10429 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
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 (match_scratch:SI 5 "=q"))]
10436 "TARGET_STRING && TARGET_POWER
10437 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 24
10438 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
10439 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
10440 && REGNO (operands[4]) == 5"
10441 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10442 [(set_attr "type" "store_ux")
10443 (set_attr "cell_micro" "always")
10444 (set_attr "length" "8")])
10447 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
10448 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
10449 (use (match_operand:SI 2 "immediate_operand" "i"))
10450 (use (match_operand:SI 3 "immediate_operand" "i"))
10451 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10452 (clobber (reg:SI 6))
10453 (clobber (reg:SI 7))
10454 (clobber (reg:SI 8))
10455 (clobber (reg:SI 9))
10456 (clobber (reg:SI 10))
10457 (clobber (match_scratch:SI 5 "=X"))]
10458 "TARGET_STRING && ! TARGET_POWER
10459 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
10460 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
10461 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
10462 && REGNO (operands[4]) == 5"
10463 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10464 [(set_attr "type" "store_ux")
10465 (set_attr "cell_micro" "always")
10466 (set_attr "length" "8")])
10468 ;; Move up to 16 bytes at a time, using 4 fixed registers to avoid spill
10469 ;; problems with TImode.
10470 ;; rD/rS = r5 is preferred, efficient form.
10471 (define_expand "movmemsi_4reg"
10472 [(parallel [(set (match_operand 0 "" "")
10473 (match_operand 1 "" ""))
10474 (use (match_operand 2 "" ""))
10475 (use (match_operand 3 "" ""))
10476 (clobber (reg:SI 5))
10477 (clobber (reg:SI 6))
10478 (clobber (reg:SI 7))
10479 (clobber (reg:SI 8))
10480 (clobber (match_scratch:SI 4 ""))])]
10485 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
10486 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
10487 (use (match_operand:SI 2 "immediate_operand" "i"))
10488 (use (match_operand:SI 3 "immediate_operand" "i"))
10489 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10490 (clobber (reg:SI 6))
10491 (clobber (reg:SI 7))
10492 (clobber (reg:SI 8))
10493 (clobber (match_scratch:SI 5 "=q"))]
10494 "TARGET_STRING && TARGET_POWER
10495 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
10496 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
10497 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
10498 && REGNO (operands[4]) == 5"
10499 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10500 [(set_attr "type" "store_ux")
10501 (set_attr "cell_micro" "always")
10502 (set_attr "length" "8")])
10505 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
10506 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
10507 (use (match_operand:SI 2 "immediate_operand" "i"))
10508 (use (match_operand:SI 3 "immediate_operand" "i"))
10509 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10510 (clobber (reg:SI 6))
10511 (clobber (reg:SI 7))
10512 (clobber (reg:SI 8))
10513 (clobber (match_scratch:SI 5 "=X"))]
10514 "TARGET_STRING && ! TARGET_POWER
10515 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
10516 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
10517 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
10518 && REGNO (operands[4]) == 5"
10519 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10520 [(set_attr "type" "store_ux")
10521 (set_attr "cell_micro" "always")
10522 (set_attr "length" "8")])
10524 ;; Move up to 8 bytes at a time.
10525 (define_expand "movmemsi_2reg"
10526 [(parallel [(set (match_operand 0 "" "")
10527 (match_operand 1 "" ""))
10528 (use (match_operand 2 "" ""))
10529 (use (match_operand 3 "" ""))
10530 (clobber (match_scratch:DI 4 ""))
10531 (clobber (match_scratch:SI 5 ""))])]
10532 "TARGET_STRING && ! TARGET_POWERPC64"
10536 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
10537 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
10538 (use (match_operand:SI 2 "immediate_operand" "i"))
10539 (use (match_operand:SI 3 "immediate_operand" "i"))
10540 (clobber (match_scratch:DI 4 "=&r"))
10541 (clobber (match_scratch:SI 5 "=q"))]
10542 "TARGET_STRING && TARGET_POWER && ! TARGET_POWERPC64
10543 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
10544 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10545 [(set_attr "type" "store_ux")
10546 (set_attr "cell_micro" "always")
10547 (set_attr "length" "8")])
10550 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
10551 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
10552 (use (match_operand:SI 2 "immediate_operand" "i"))
10553 (use (match_operand:SI 3 "immediate_operand" "i"))
10554 (clobber (match_scratch:DI 4 "=&r"))
10555 (clobber (match_scratch:SI 5 "=X"))]
10556 "TARGET_STRING && ! TARGET_POWER && ! TARGET_POWERPC64
10557 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
10558 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10559 [(set_attr "type" "store_ux")
10560 (set_attr "cell_micro" "always")
10561 (set_attr "length" "8")])
10563 ;; Move up to 4 bytes at a time.
10564 (define_expand "movmemsi_1reg"
10565 [(parallel [(set (match_operand 0 "" "")
10566 (match_operand 1 "" ""))
10567 (use (match_operand 2 "" ""))
10568 (use (match_operand 3 "" ""))
10569 (clobber (match_scratch:SI 4 ""))
10570 (clobber (match_scratch:SI 5 ""))])]
10575 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
10576 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
10577 (use (match_operand:SI 2 "immediate_operand" "i"))
10578 (use (match_operand:SI 3 "immediate_operand" "i"))
10579 (clobber (match_scratch:SI 4 "=&r"))
10580 (clobber (match_scratch:SI 5 "=q"))]
10581 "TARGET_STRING && TARGET_POWER
10582 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
10583 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10584 [(set_attr "type" "store_ux")
10585 (set_attr "cell_micro" "always")
10586 (set_attr "length" "8")])
10589 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
10590 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
10591 (use (match_operand:SI 2 "immediate_operand" "i"))
10592 (use (match_operand:SI 3 "immediate_operand" "i"))
10593 (clobber (match_scratch:SI 4 "=&r"))
10594 (clobber (match_scratch:SI 5 "=X"))]
10595 "TARGET_STRING && ! TARGET_POWER
10596 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
10597 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10598 [(set_attr "type" "store_ux")
10599 (set_attr "cell_micro" "always")
10600 (set_attr "length" "8")])
10602 ;; Define insns that do load or store with update. Some of these we can
10603 ;; get by using pre-decrement or pre-increment, but the hardware can also
10604 ;; do cases where the increment is not the size of the object.
10606 ;; In all these cases, we use operands 0 and 1 for the register being
10607 ;; incremented because those are the operands that local-alloc will
10608 ;; tie and these are the pair most likely to be tieable (and the ones
10609 ;; that will benefit the most).
10611 (define_insn "*movdi_update1"
10612 [(set (match_operand:DI 3 "gpc_reg_operand" "=r,r")
10613 (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
10614 (match_operand:DI 2 "reg_or_aligned_short_operand" "r,I"))))
10615 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
10616 (plus:DI (match_dup 1) (match_dup 2)))]
10617 "TARGET_POWERPC64 && TARGET_UPDATE
10618 && (!avoiding_indexed_address_p (DImode)
10619 || !gpc_reg_operand (operands[2], DImode))"
10623 [(set_attr "type" "load_ux,load_u")])
10625 (define_insn "movdi_<mode>_update"
10626 [(set (mem:DI (plus:P (match_operand:P 1 "gpc_reg_operand" "0,0")
10627 (match_operand:P 2 "reg_or_aligned_short_operand" "r,I")))
10628 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
10629 (set (match_operand:P 0 "gpc_reg_operand" "=b,b")
10630 (plus:P (match_dup 1) (match_dup 2)))]
10631 "TARGET_POWERPC64 && TARGET_UPDATE
10632 && (!avoiding_indexed_address_p (Pmode)
10633 || !gpc_reg_operand (operands[2], Pmode)
10634 || (REG_P (operands[0])
10635 && REGNO (operands[0]) == STACK_POINTER_REGNUM))"
10639 [(set_attr "type" "store_ux,store_u")])
10641 ;; This pattern is only conditional on TARGET_POWERPC64, as it is
10642 ;; needed for stack allocation, even if the user passes -mno-update.
10643 (define_insn "movdi_<mode>_update_stack"
10644 [(set (mem:DI (plus:P (match_operand:P 1 "gpc_reg_operand" "0,0")
10645 (match_operand:P 2 "reg_or_aligned_short_operand" "r,I")))
10646 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
10647 (set (match_operand:P 0 "gpc_reg_operand" "=b,b")
10648 (plus:P (match_dup 1) (match_dup 2)))]
10653 [(set_attr "type" "store_ux,store_u")])
10655 (define_insn "*movsi_update1"
10656 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
10657 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10658 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10659 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10660 (plus:SI (match_dup 1) (match_dup 2)))]
10662 && (!avoiding_indexed_address_p (SImode)
10663 || !gpc_reg_operand (operands[2], SImode))"
10665 {lux|lwzux} %3,%0,%2
10666 {lu|lwzu} %3,%2(%0)"
10667 [(set_attr "type" "load_ux,load_u")])
10669 (define_insn "*movsi_update2"
10670 [(set (match_operand:DI 3 "gpc_reg_operand" "=r")
10672 (mem:SI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0")
10673 (match_operand:DI 2 "gpc_reg_operand" "r")))))
10674 (set (match_operand:DI 0 "gpc_reg_operand" "=b")
10675 (plus:DI (match_dup 1) (match_dup 2)))]
10676 "TARGET_POWERPC64 && rs6000_gen_cell_microcode
10677 && !avoiding_indexed_address_p (DImode)"
10679 [(set_attr "type" "load_ext_ux")])
10681 (define_insn "movsi_update"
10682 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10683 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10684 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
10685 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10686 (plus:SI (match_dup 1) (match_dup 2)))]
10688 && (!avoiding_indexed_address_p (SImode)
10689 || !gpc_reg_operand (operands[2], SImode)
10690 || (REG_P (operands[0])
10691 && REGNO (operands[0]) == STACK_POINTER_REGNUM))"
10693 {stux|stwux} %3,%0,%2
10694 {stu|stwu} %3,%2(%0)"
10695 [(set_attr "type" "store_ux,store_u")])
10697 ;; This is an unconditional pattern; needed for stack allocation, even
10698 ;; if the user passes -mno-update.
10699 (define_insn "movsi_update_stack"
10700 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10701 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10702 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
10703 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10704 (plus:SI (match_dup 1) (match_dup 2)))]
10707 {stux|stwux} %3,%0,%2
10708 {stu|stwu} %3,%2(%0)"
10709 [(set_attr "type" "store_ux,store_u")])
10711 (define_insn "*movhi_update1"
10712 [(set (match_operand:HI 3 "gpc_reg_operand" "=r,r")
10713 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10714 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10715 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10716 (plus:SI (match_dup 1) (match_dup 2)))]
10718 && (!avoiding_indexed_address_p (SImode)
10719 || !gpc_reg_operand (operands[2], SImode))"
10723 [(set_attr "type" "load_ux,load_u")])
10725 (define_insn "*movhi_update2"
10726 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
10728 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10729 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
10730 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10731 (plus:SI (match_dup 1) (match_dup 2)))]
10733 && (!avoiding_indexed_address_p (SImode)
10734 || !gpc_reg_operand (operands[2], SImode))"
10738 [(set_attr "type" "load_ux,load_u")])
10740 (define_insn "*movhi_update3"
10741 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
10743 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10744 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
10745 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10746 (plus:SI (match_dup 1) (match_dup 2)))]
10747 "TARGET_UPDATE && rs6000_gen_cell_microcode
10748 && (!avoiding_indexed_address_p (SImode)
10749 || !gpc_reg_operand (operands[2], SImode))"
10753 [(set_attr "type" "load_ext_ux,load_ext_u")])
10755 (define_insn "*movhi_update4"
10756 [(set (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10757 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10758 (match_operand:HI 3 "gpc_reg_operand" "r,r"))
10759 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10760 (plus:SI (match_dup 1) (match_dup 2)))]
10762 && (!avoiding_indexed_address_p (SImode)
10763 || !gpc_reg_operand (operands[2], SImode))"
10767 [(set_attr "type" "store_ux,store_u")])
10769 (define_insn "*movqi_update1"
10770 [(set (match_operand:QI 3 "gpc_reg_operand" "=r,r")
10771 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10772 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10773 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10774 (plus:SI (match_dup 1) (match_dup 2)))]
10776 && (!avoiding_indexed_address_p (SImode)
10777 || !gpc_reg_operand (operands[2], SImode))"
10781 [(set_attr "type" "load_ux,load_u")])
10783 (define_insn "*movqi_update2"
10784 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
10786 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10787 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
10788 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10789 (plus:SI (match_dup 1) (match_dup 2)))]
10791 && (!avoiding_indexed_address_p (SImode)
10792 || !gpc_reg_operand (operands[2], SImode))"
10796 [(set_attr "type" "load_ux,load_u")])
10798 (define_insn "*movqi_update3"
10799 [(set (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10800 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10801 (match_operand:QI 3 "gpc_reg_operand" "r,r"))
10802 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10803 (plus:SI (match_dup 1) (match_dup 2)))]
10805 && (!avoiding_indexed_address_p (SImode)
10806 || !gpc_reg_operand (operands[2], SImode))"
10810 [(set_attr "type" "store_ux,store_u")])
10812 (define_insn "*movsf_update1"
10813 [(set (match_operand:SF 3 "gpc_reg_operand" "=f,f")
10814 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10815 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10816 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10817 (plus:SI (match_dup 1) (match_dup 2)))]
10818 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT && TARGET_UPDATE
10819 && (!avoiding_indexed_address_p (SImode)
10820 || !gpc_reg_operand (operands[2], SImode))"
10824 [(set_attr "type" "fpload_ux,fpload_u")])
10826 (define_insn "*movsf_update2"
10827 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10828 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10829 (match_operand:SF 3 "gpc_reg_operand" "f,f"))
10830 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10831 (plus:SI (match_dup 1) (match_dup 2)))]
10832 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT && TARGET_UPDATE
10833 && (!avoiding_indexed_address_p (SImode)
10834 || !gpc_reg_operand (operands[2], SImode))"
10838 [(set_attr "type" "fpstore_ux,fpstore_u")])
10840 (define_insn "*movsf_update3"
10841 [(set (match_operand:SF 3 "gpc_reg_operand" "=r,r")
10842 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10843 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10844 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10845 (plus:SI (match_dup 1) (match_dup 2)))]
10846 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE
10847 && (!avoiding_indexed_address_p (SImode)
10848 || !gpc_reg_operand (operands[2], SImode))"
10850 {lux|lwzux} %3,%0,%2
10851 {lu|lwzu} %3,%2(%0)"
10852 [(set_attr "type" "load_ux,load_u")])
10854 (define_insn "*movsf_update4"
10855 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10856 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10857 (match_operand:SF 3 "gpc_reg_operand" "r,r"))
10858 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10859 (plus:SI (match_dup 1) (match_dup 2)))]
10860 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE
10861 && (!avoiding_indexed_address_p (SImode)
10862 || !gpc_reg_operand (operands[2], SImode))"
10864 {stux|stwux} %3,%0,%2
10865 {stu|stwu} %3,%2(%0)"
10866 [(set_attr "type" "store_ux,store_u")])
10868 (define_insn "*movdf_update1"
10869 [(set (match_operand:DF 3 "gpc_reg_operand" "=d,d")
10870 (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10871 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10872 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10873 (plus:SI (match_dup 1) (match_dup 2)))]
10874 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_UPDATE
10875 && (!avoiding_indexed_address_p (SImode)
10876 || !gpc_reg_operand (operands[2], SImode))"
10880 [(set_attr "type" "fpload_ux,fpload_u")])
10882 (define_insn "*movdf_update2"
10883 [(set (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10884 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10885 (match_operand:DF 3 "gpc_reg_operand" "d,d"))
10886 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10887 (plus:SI (match_dup 1) (match_dup 2)))]
10888 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_UPDATE
10889 && (!avoiding_indexed_address_p (SImode)
10890 || !gpc_reg_operand (operands[2], SImode))"
10894 [(set_attr "type" "fpstore_ux,fpstore_u")])
10896 ;; Peephole to convert two consecutive FP loads or stores into lfq/stfq.
10898 (define_insn "*lfq_power2"
10899 [(set (match_operand:V2DF 0 "gpc_reg_operand" "=f")
10900 (match_operand:V2DF 1 "memory_operand" ""))]
10902 && TARGET_HARD_FLOAT && TARGET_FPRS"
10906 [(set (match_operand:DF 0 "gpc_reg_operand" "")
10907 (match_operand:DF 1 "memory_operand" ""))
10908 (set (match_operand:DF 2 "gpc_reg_operand" "")
10909 (match_operand:DF 3 "memory_operand" ""))]
10911 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
10912 && registers_ok_for_quad_peep (operands[0], operands[2])
10913 && mems_ok_for_quad_peep (operands[1], operands[3])"
10914 [(set (match_dup 0)
10916 "operands[1] = widen_memory_access (operands[1], V2DFmode, 0);
10917 operands[0] = gen_rtx_REG (V2DFmode, REGNO (operands[0]));")
10919 (define_insn "*stfq_power2"
10920 [(set (match_operand:V2DF 0 "memory_operand" "")
10921 (match_operand:V2DF 1 "gpc_reg_operand" "f"))]
10923 && TARGET_HARD_FLOAT && TARGET_FPRS"
10924 "stfq%U0%X0 %1,%0")
10928 [(set (match_operand:DF 0 "memory_operand" "")
10929 (match_operand:DF 1 "gpc_reg_operand" ""))
10930 (set (match_operand:DF 2 "memory_operand" "")
10931 (match_operand:DF 3 "gpc_reg_operand" ""))]
10933 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
10934 && registers_ok_for_quad_peep (operands[1], operands[3])
10935 && mems_ok_for_quad_peep (operands[0], operands[2])"
10936 [(set (match_dup 0)
10938 "operands[0] = widen_memory_access (operands[0], V2DFmode, 0);
10939 operands[1] = gen_rtx_REG (V2DFmode, REGNO (operands[1]));")
10941 ;; After inserting conditional returns we can sometimes have
10942 ;; unnecessary register moves. Unfortunately we cannot have a
10943 ;; modeless peephole here, because some single SImode sets have early
10944 ;; clobber outputs. Although those sets expand to multi-ppc-insn
10945 ;; sequences, using get_attr_length here will smash the operands
10946 ;; array. Neither is there an early_cobbler_p predicate.
10947 ;; Disallow subregs for E500 so we don't munge frob_di_df_2.
10949 [(set (match_operand:DF 0 "gpc_reg_operand" "")
10950 (match_operand:DF 1 "any_operand" ""))
10951 (set (match_operand:DF 2 "gpc_reg_operand" "")
10953 "!(TARGET_E500_DOUBLE && GET_CODE (operands[2]) == SUBREG)
10954 && peep2_reg_dead_p (2, operands[0])"
10955 [(set (match_dup 2) (match_dup 1))])
10958 [(set (match_operand:SF 0 "gpc_reg_operand" "")
10959 (match_operand:SF 1 "any_operand" ""))
10960 (set (match_operand:SF 2 "gpc_reg_operand" "")
10962 "peep2_reg_dead_p (2, operands[0])"
10963 [(set (match_dup 2) (match_dup 1))])
10968 ;; Mode attributes for different ABIs.
10969 (define_mode_iterator TLSmode [(SI "! TARGET_64BIT") (DI "TARGET_64BIT")])
10970 (define_mode_attr tls_abi_suffix [(SI "32") (DI "64")])
10971 (define_mode_attr tls_sysv_suffix [(SI "si") (DI "di")])
10972 (define_mode_attr tls_insn_suffix [(SI "wz") (DI "d")])
10974 (define_insn_and_split "tls_gd_aix<TLSmode:tls_abi_suffix>"
10975 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10976 (call (mem:TLSmode (match_operand:TLSmode 3 "symbol_ref_operand" "s"))
10977 (match_operand 4 "" "g")))
10978 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10979 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10981 (clobber (reg:SI LR_REGNO))]
10982 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX"
10983 "addi %0,%1,%2@got@tlsgd\;bl %z3\;%."
10984 "&& TARGET_TLS_MARKERS"
10985 [(set (match_dup 0)
10986 (unspec:TLSmode [(match_dup 1)
10989 (parallel [(set (match_dup 0)
10990 (call (mem:TLSmode (match_dup 3))
10992 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD)
10993 (clobber (reg:SI LR_REGNO))])]
10995 [(set_attr "type" "two")
10996 (set_attr "length" "12")])
10998 (define_insn_and_split "tls_gd_sysv<TLSmode:tls_sysv_suffix>"
10999 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11000 (call (mem:TLSmode (match_operand:TLSmode 3 "symbol_ref_operand" "s"))
11001 (match_operand 4 "" "g")))
11002 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11003 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11005 (clobber (reg:SI LR_REGNO))]
11006 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4"
11010 if (TARGET_SECURE_PLT && flag_pic == 2)
11011 return "addi %0,%1,%2@got@tlsgd\;bl %z3+32768@plt";
11013 return "addi %0,%1,%2@got@tlsgd\;bl %z3@plt";
11016 return "addi %0,%1,%2@got@tlsgd\;bl %z3";
11018 "&& TARGET_TLS_MARKERS"
11019 [(set (match_dup 0)
11020 (unspec:TLSmode [(match_dup 1)
11023 (parallel [(set (match_dup 0)
11024 (call (mem:TLSmode (match_dup 3))
11026 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD)
11027 (clobber (reg:SI LR_REGNO))])]
11029 [(set_attr "type" "two")
11030 (set_attr "length" "8")])
11032 (define_insn "*tls_gd<TLSmode:tls_abi_suffix>"
11033 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11034 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11035 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11037 "HAVE_AS_TLS && TARGET_TLS_MARKERS"
11038 "addi %0,%1,%2@got@tlsgd"
11039 [(set_attr "length" "4")])
11041 (define_insn "*tls_gd_call_aix<TLSmode:tls_abi_suffix>"
11042 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11043 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
11044 (match_operand 2 "" "g")))
11045 (unspec:TLSmode [(match_operand:TLSmode 3 "rs6000_tls_symbol_ref" "")]
11047 (clobber (reg:SI LR_REGNO))]
11048 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX && TARGET_TLS_MARKERS"
11049 "bl %z1(%3@tlsgd)\;%."
11050 [(set_attr "type" "branch")
11051 (set_attr "length" "8")])
11053 (define_insn "*tls_gd_call_sysv<TLSmode:tls_abi_suffix>"
11054 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11055 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
11056 (match_operand 2 "" "g")))
11057 (unspec:TLSmode [(match_operand:TLSmode 3 "rs6000_tls_symbol_ref" "")]
11059 (clobber (reg:SI LR_REGNO))]
11060 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4 && TARGET_TLS_MARKERS"
11064 if (TARGET_SECURE_PLT && flag_pic == 2)
11065 return "bl %z1+32768(%3@tlsgd)@plt";
11066 return "bl %z1(%3@tlsgd)@plt";
11068 return "bl %z1(%3@tlsgd)";
11070 [(set_attr "type" "branch")
11071 (set_attr "length" "4")])
11073 (define_insn_and_split "tls_ld_aix<TLSmode:tls_abi_suffix>"
11074 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11075 (call (mem:TLSmode (match_operand:TLSmode 2 "symbol_ref_operand" "s"))
11076 (match_operand 3 "" "g")))
11077 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
11079 (clobber (reg:SI LR_REGNO))]
11080 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX"
11081 "addi %0,%1,%&@got@tlsld\;bl %z2\;%."
11082 "&& TARGET_TLS_MARKERS"
11083 [(set (match_dup 0)
11084 (unspec:TLSmode [(match_dup 1)]
11086 (parallel [(set (match_dup 0)
11087 (call (mem:TLSmode (match_dup 2))
11089 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
11090 (clobber (reg:SI LR_REGNO))])]
11092 [(set_attr "length" "12")])
11094 (define_insn_and_split "tls_ld_sysv<TLSmode:tls_sysv_suffix>"
11095 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11096 (call (mem:TLSmode (match_operand:TLSmode 2 "symbol_ref_operand" "s"))
11097 (match_operand 3 "" "g")))
11098 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
11100 (clobber (reg:SI LR_REGNO))]
11101 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4"
11105 if (TARGET_SECURE_PLT && flag_pic == 2)
11106 return "addi %0,%1,%&@got@tlsld\;bl %z2+32768@plt";
11108 return "addi %0,%1,%&@got@tlsld\;bl %z2@plt";
11111 return "addi %0,%1,%&@got@tlsld\;bl %z2";
11113 "&& TARGET_TLS_MARKERS"
11114 [(set (match_dup 0)
11115 (unspec:TLSmode [(match_dup 1)]
11117 (parallel [(set (match_dup 0)
11118 (call (mem:TLSmode (match_dup 2))
11120 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
11121 (clobber (reg:SI LR_REGNO))])]
11123 [(set_attr "length" "8")])
11125 (define_insn "*tls_ld<TLSmode:tls_abi_suffix>"
11126 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11127 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
11129 "HAVE_AS_TLS && TARGET_TLS_MARKERS"
11130 "addi %0,%1,%&@got@tlsld"
11131 [(set_attr "length" "4")])
11133 (define_insn "*tls_ld_call_aix<TLSmode:tls_abi_suffix>"
11134 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11135 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
11136 (match_operand 2 "" "g")))
11137 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
11138 (clobber (reg:SI LR_REGNO))]
11139 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX && TARGET_TLS_MARKERS"
11140 "bl %z1(%&@tlsld)\;%."
11141 [(set_attr "type" "branch")
11142 (set_attr "length" "8")])
11144 (define_insn "*tls_ld_call_sysv<TLSmode:tls_abi_suffix>"
11145 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11146 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
11147 (match_operand 2 "" "g")))
11148 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
11149 (clobber (reg:SI LR_REGNO))]
11150 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4 && TARGET_TLS_MARKERS"
11154 if (TARGET_SECURE_PLT && flag_pic == 2)
11155 return "bl %z1+32768(%&@tlsld)@plt";
11156 return "bl %z1(%&@tlsld)@plt";
11158 return "bl %z1(%&@tlsld)";
11160 [(set_attr "type" "branch")
11161 (set_attr "length" "4")])
11163 (define_insn "tls_dtprel_<TLSmode:tls_abi_suffix>"
11164 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11165 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11166 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11167 UNSPEC_TLSDTPREL))]
11169 "addi %0,%1,%2@dtprel")
11171 (define_insn "tls_dtprel_ha_<TLSmode:tls_abi_suffix>"
11172 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11173 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11174 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11175 UNSPEC_TLSDTPRELHA))]
11177 "addis %0,%1,%2@dtprel@ha")
11179 (define_insn "tls_dtprel_lo_<TLSmode:tls_abi_suffix>"
11180 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11181 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11182 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11183 UNSPEC_TLSDTPRELLO))]
11185 "addi %0,%1,%2@dtprel@l")
11187 (define_insn "tls_got_dtprel_<TLSmode:tls_abi_suffix>"
11188 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11189 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11190 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11191 UNSPEC_TLSGOTDTPREL))]
11193 "l<TLSmode:tls_insn_suffix> %0,%2@got@dtprel(%1)")
11195 (define_insn "tls_tprel_<TLSmode:tls_abi_suffix>"
11196 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11197 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11198 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11201 "addi %0,%1,%2@tprel")
11203 (define_insn "tls_tprel_ha_<TLSmode:tls_abi_suffix>"
11204 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11205 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11206 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11207 UNSPEC_TLSTPRELHA))]
11209 "addis %0,%1,%2@tprel@ha")
11211 (define_insn "tls_tprel_lo_<TLSmode:tls_abi_suffix>"
11212 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11213 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11214 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11215 UNSPEC_TLSTPRELLO))]
11217 "addi %0,%1,%2@tprel@l")
11219 ;; "b" output constraint here and on tls_tls input to support linker tls
11220 ;; optimization. The linker may edit the instructions emitted by a
11221 ;; tls_got_tprel/tls_tls pair to addis,addi.
11222 (define_insn "tls_got_tprel_<TLSmode:tls_abi_suffix>"
11223 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11224 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11225 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11226 UNSPEC_TLSGOTTPREL))]
11228 "l<TLSmode:tls_insn_suffix> %0,%2@got@tprel(%1)")
11230 (define_insn "tls_tls_<TLSmode:tls_abi_suffix>"
11231 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11232 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11233 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11236 "add %0,%1,%2@tls")
11239 ;; Next come insns related to the calling sequence.
11241 ;; First, an insn to allocate new stack space for dynamic use (e.g., alloca).
11242 ;; We move the back-chain and decrement the stack pointer.
11244 (define_expand "allocate_stack"
11245 [(set (match_operand 0 "gpc_reg_operand" "")
11246 (minus (reg 1) (match_operand 1 "reg_or_short_operand" "")))
11248 (minus (reg 1) (match_dup 1)))]
11251 { rtx chain = gen_reg_rtx (Pmode);
11252 rtx stack_bot = gen_rtx_MEM (Pmode, stack_pointer_rtx);
11254 rtx insn, par, set, mem;
11256 emit_move_insn (chain, stack_bot);
11258 /* Check stack bounds if necessary. */
11259 if (crtl->limit_stack)
11262 available = expand_binop (Pmode, sub_optab,
11263 stack_pointer_rtx, stack_limit_rtx,
11264 NULL_RTX, 1, OPTAB_WIDEN);
11265 emit_insn (gen_cond_trap (LTU, available, operands[1], const0_rtx));
11268 if (GET_CODE (operands[1]) != CONST_INT
11269 || INTVAL (operands[1]) < -32767
11270 || INTVAL (operands[1]) > 32768)
11272 neg_op0 = gen_reg_rtx (Pmode);
11274 emit_insn (gen_negsi2 (neg_op0, operands[1]));
11276 emit_insn (gen_negdi2 (neg_op0, operands[1]));
11279 neg_op0 = GEN_INT (- INTVAL (operands[1]));
11281 insn = emit_insn ((* ((TARGET_32BIT) ? gen_movsi_update_stack
11282 : gen_movdi_di_update_stack))
11283 (stack_pointer_rtx, stack_pointer_rtx, neg_op0,
11285 /* Since we didn't use gen_frame_mem to generate the MEM, grab
11286 it now and set the alias set/attributes. The above gen_*_update
11287 calls will generate a PARALLEL with the MEM set being the first
11289 par = PATTERN (insn);
11290 gcc_assert (GET_CODE (par) == PARALLEL);
11291 set = XVECEXP (par, 0, 0);
11292 gcc_assert (GET_CODE (set) == SET);
11293 mem = SET_DEST (set);
11294 gcc_assert (MEM_P (mem));
11295 MEM_NOTRAP_P (mem) = 1;
11296 set_mem_alias_set (mem, get_frame_alias_set ());
11298 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
11302 ;; These patterns say how to save and restore the stack pointer. We need not
11303 ;; save the stack pointer at function level since we are careful to
11304 ;; preserve the backchain. At block level, we have to restore the backchain
11305 ;; when we restore the stack pointer.
11307 ;; For nonlocal gotos, we must save both the stack pointer and its
11308 ;; backchain and restore both. Note that in the nonlocal case, the
11309 ;; save area is a memory location.
11311 (define_expand "save_stack_function"
11312 [(match_operand 0 "any_operand" "")
11313 (match_operand 1 "any_operand" "")]
11317 (define_expand "restore_stack_function"
11318 [(match_operand 0 "any_operand" "")
11319 (match_operand 1 "any_operand" "")]
11323 ;; Adjust stack pointer (op0) to a new value (op1).
11324 ;; First copy old stack backchain to new location, and ensure that the
11325 ;; scheduler won't reorder the sp assignment before the backchain write.
11326 (define_expand "restore_stack_block"
11327 [(set (match_dup 2) (match_dup 3))
11328 (set (match_dup 4) (match_dup 2))
11329 (set (match_dup 5) (unspec:BLK [(match_dup 5)] UNSPEC_TIE))
11330 (set (match_operand 0 "register_operand" "")
11331 (match_operand 1 "register_operand" ""))]
11335 operands[1] = force_reg (Pmode, operands[1]);
11336 operands[2] = gen_reg_rtx (Pmode);
11337 operands[3] = gen_frame_mem (Pmode, operands[0]);
11338 operands[4] = gen_frame_mem (Pmode, operands[1]);
11339 operands[5] = gen_frame_mem (BLKmode, operands[0]);
11342 (define_expand "save_stack_nonlocal"
11343 [(set (match_dup 3) (match_dup 4))
11344 (set (match_operand 0 "memory_operand" "") (match_dup 3))
11345 (set (match_dup 2) (match_operand 1 "register_operand" ""))]
11349 int units_per_word = (TARGET_32BIT) ? 4 : 8;
11351 /* Copy the backchain to the first word, sp to the second. */
11352 operands[0] = adjust_address_nv (operands[0], Pmode, 0);
11353 operands[2] = adjust_address_nv (operands[0], Pmode, units_per_word);
11354 operands[3] = gen_reg_rtx (Pmode);
11355 operands[4] = gen_frame_mem (Pmode, operands[1]);
11358 (define_expand "restore_stack_nonlocal"
11359 [(set (match_dup 2) (match_operand 1 "memory_operand" ""))
11360 (set (match_dup 3) (match_dup 4))
11361 (set (match_dup 5) (match_dup 2))
11362 (set (match_dup 6) (unspec:BLK [(match_dup 6)] UNSPEC_TIE))
11363 (set (match_operand 0 "register_operand" "") (match_dup 3))]
11367 int units_per_word = (TARGET_32BIT) ? 4 : 8;
11369 /* Restore the backchain from the first word, sp from the second. */
11370 operands[2] = gen_reg_rtx (Pmode);
11371 operands[3] = gen_reg_rtx (Pmode);
11372 operands[1] = adjust_address_nv (operands[1], Pmode, 0);
11373 operands[4] = adjust_address_nv (operands[1], Pmode, units_per_word);
11374 operands[5] = gen_frame_mem (Pmode, operands[3]);
11375 operands[6] = gen_frame_mem (BLKmode, operands[0]);
11378 ;; TOC register handling.
11380 ;; Code to initialize the TOC register...
11382 (define_insn "load_toc_aix_si"
11383 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11384 (unspec:SI [(const_int 0)] UNSPEC_TOC))
11385 (use (reg:SI 2))])]
11386 "DEFAULT_ABI == ABI_AIX && TARGET_32BIT"
11390 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
11391 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
11392 operands[2] = gen_rtx_REG (Pmode, 2);
11393 return \"{l|lwz} %0,%1(%2)\";
11395 [(set_attr "type" "load")])
11397 (define_insn "load_toc_aix_di"
11398 [(parallel [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11399 (unspec:DI [(const_int 0)] UNSPEC_TOC))
11400 (use (reg:DI 2))])]
11401 "DEFAULT_ABI == ABI_AIX && TARGET_64BIT"
11405 #ifdef TARGET_RELOCATABLE
11406 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\",
11407 !TARGET_MINIMAL_TOC || TARGET_RELOCATABLE);
11409 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
11412 strcat (buf, \"@toc\");
11413 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
11414 operands[2] = gen_rtx_REG (Pmode, 2);
11415 return \"ld %0,%1(%2)\";
11417 [(set_attr "type" "load")])
11419 (define_insn "load_toc_v4_pic_si"
11420 [(set (reg:SI LR_REGNO)
11421 (unspec:SI [(const_int 0)] UNSPEC_TOC))]
11422 "DEFAULT_ABI == ABI_V4 && flag_pic == 1 && TARGET_32BIT"
11423 "bl _GLOBAL_OFFSET_TABLE_@local-4"
11424 [(set_attr "type" "branch")
11425 (set_attr "length" "4")])
11427 (define_insn "load_toc_v4_PIC_1"
11428 [(set (reg:SI LR_REGNO)
11429 (match_operand:SI 0 "immediate_operand" "s"))
11430 (use (unspec [(match_dup 0)] UNSPEC_TOC))]
11431 "TARGET_ELF && DEFAULT_ABI != ABI_AIX
11432 && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
11433 "bcl 20,31,%0\\n%0:"
11434 [(set_attr "type" "branch")
11435 (set_attr "length" "4")])
11437 (define_insn "load_toc_v4_PIC_1b"
11438 [(set (reg:SI LR_REGNO)
11439 (unspec:SI [(match_operand:SI 0 "immediate_operand" "s")]
11441 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
11442 "bcl 20,31,$+8\\n\\t.long %0-$"
11443 [(set_attr "type" "branch")
11444 (set_attr "length" "8")])
11446 (define_insn "load_toc_v4_PIC_2"
11447 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11448 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
11449 (minus:SI (match_operand:SI 2 "immediate_operand" "s")
11450 (match_operand:SI 3 "immediate_operand" "s")))))]
11451 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
11452 "{l|lwz} %0,%2-%3(%1)"
11453 [(set_attr "type" "load")])
11455 (define_insn "load_toc_v4_PIC_3b"
11456 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
11457 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "r")
11459 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
11460 (match_operand:SI 3 "symbol_ref_operand" "s")))))]
11461 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
11462 "{cau|addis} %0,%1,%2-%3@ha")
11464 (define_insn "load_toc_v4_PIC_3c"
11465 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11466 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
11467 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
11468 (match_operand:SI 3 "symbol_ref_operand" "s"))))]
11469 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
11470 "{cal %0,%2-%3@l(%1)|addi %0,%1,%2-%3@l}")
11472 ;; If the TOC is shared over a translation unit, as happens with all
11473 ;; the kinds of PIC that we support, we need to restore the TOC
11474 ;; pointer only when jumping over units of translation.
11475 ;; On Darwin, we need to reload the picbase.
11477 (define_expand "builtin_setjmp_receiver"
11478 [(use (label_ref (match_operand 0 "" "")))]
11479 "(DEFAULT_ABI == ABI_V4 && flag_pic == 1)
11480 || (TARGET_TOC && TARGET_MINIMAL_TOC)
11481 || (DEFAULT_ABI == ABI_DARWIN && flag_pic)"
11485 if (DEFAULT_ABI == ABI_DARWIN)
11487 rtx picrtx = gen_rtx_SYMBOL_REF (Pmode, MACHOPIC_FUNCTION_BASE_NAME);
11488 rtx picreg = gen_rtx_REG (Pmode, RS6000_PIC_OFFSET_TABLE_REGNUM);
11492 crtl->uses_pic_offset_table = 1;
11493 ASM_GENERATE_INTERNAL_LABEL(tmplab, \"LSJR\",
11494 CODE_LABEL_NUMBER (operands[0]));
11495 tmplabrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (tmplab));
11497 emit_insn (gen_load_macho_picbase (tmplabrtx));
11498 emit_move_insn (picreg, gen_rtx_REG (Pmode, LR_REGNO));
11499 emit_insn (gen_macho_correct_pic (picreg, picreg, picrtx, tmplabrtx));
11503 rs6000_emit_load_toc_table (FALSE);
11507 ;; Elf specific ways of loading addresses for non-PIC code.
11508 ;; The output of this could be r0, but we make a very strong
11509 ;; preference for a base register because it will usually
11510 ;; be needed there.
11511 (define_insn "elf_high"
11512 [(set (match_operand:SI 0 "gpc_reg_operand" "=b*r")
11513 (high:SI (match_operand 1 "" "")))]
11514 "TARGET_ELF && ! TARGET_64BIT"
11515 "{liu|lis} %0,%1@ha")
11517 (define_insn "elf_low"
11518 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11519 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,!*r")
11520 (match_operand 2 "" "")))]
11521 "TARGET_ELF && ! TARGET_64BIT"
11523 {cal|la} %0,%2@l(%1)
11524 {ai|addic} %0,%1,%K2")
11526 ;; A function pointer under AIX is a pointer to a data area whose first word
11527 ;; contains the actual address of the function, whose second word contains a
11528 ;; pointer to its TOC, and whose third word contains a value to place in the
11529 ;; static chain register (r11). Note that if we load the static chain, our
11530 ;; "trampoline" need not have any executable code.
11532 (define_expand "call_indirect_aix32"
11533 [(set (match_dup 2)
11534 (mem:SI (match_operand:SI 0 "gpc_reg_operand" "")))
11535 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
11538 (mem:SI (plus:SI (match_dup 0)
11540 (parallel [(call (mem:SI (match_dup 2))
11541 (match_operand 1 "" ""))
11542 (use (mem:SI (plus:SI (match_dup 0) (const_int 4))))
11544 (use (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
11545 (clobber (reg:SI LR_REGNO))])]
11548 { operands[2] = gen_reg_rtx (SImode); }")
11550 (define_expand "call_indirect_aix64"
11551 [(set (match_dup 2)
11552 (mem:DI (match_operand:DI 0 "gpc_reg_operand" "")))
11553 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
11556 (mem:DI (plus:DI (match_dup 0)
11558 (parallel [(call (mem:SI (match_dup 2))
11559 (match_operand 1 "" ""))
11560 (use (mem:DI (plus:DI (match_dup 0) (const_int 8))))
11562 (use (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
11563 (clobber (reg:SI LR_REGNO))])]
11566 { operands[2] = gen_reg_rtx (DImode); }")
11568 (define_expand "call_value_indirect_aix32"
11569 [(set (match_dup 3)
11570 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "")))
11571 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
11574 (mem:SI (plus:SI (match_dup 1)
11576 (parallel [(set (match_operand 0 "" "")
11577 (call (mem:SI (match_dup 3))
11578 (match_operand 2 "" "")))
11579 (use (mem:SI (plus:SI (match_dup 1) (const_int 4))))
11581 (use (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
11582 (clobber (reg:SI LR_REGNO))])]
11585 { operands[3] = gen_reg_rtx (SImode); }")
11587 (define_expand "call_value_indirect_aix64"
11588 [(set (match_dup 3)
11589 (mem:DI (match_operand:DI 1 "gpc_reg_operand" "")))
11590 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
11593 (mem:DI (plus:DI (match_dup 1)
11595 (parallel [(set (match_operand 0 "" "")
11596 (call (mem:SI (match_dup 3))
11597 (match_operand 2 "" "")))
11598 (use (mem:DI (plus:DI (match_dup 1) (const_int 8))))
11600 (use (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
11601 (clobber (reg:SI LR_REGNO))])]
11604 { operands[3] = gen_reg_rtx (DImode); }")
11606 ;; Now the definitions for the call and call_value insns
11607 (define_expand "call"
11608 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
11609 (match_operand 1 "" ""))
11610 (use (match_operand 2 "" ""))
11611 (clobber (reg:SI LR_REGNO))])]
11616 if (MACHOPIC_INDIRECT)
11617 operands[0] = machopic_indirect_call_target (operands[0]);
11620 gcc_assert (GET_CODE (operands[0]) == MEM);
11621 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
11623 operands[0] = XEXP (operands[0], 0);
11625 if (GET_CODE (operands[0]) != SYMBOL_REF
11626 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[0]))
11627 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[2]) & CALL_LONG) != 0))
11629 if (INTVAL (operands[2]) & CALL_LONG)
11630 operands[0] = rs6000_longcall_ref (operands[0]);
11632 switch (DEFAULT_ABI)
11636 operands[0] = force_reg (Pmode, operands[0]);
11640 /* AIX function pointers are really pointers to a three word
11642 emit_call_insn (TARGET_32BIT
11643 ? gen_call_indirect_aix32 (force_reg (SImode,
11646 : gen_call_indirect_aix64 (force_reg (DImode,
11652 gcc_unreachable ();
11657 (define_expand "call_value"
11658 [(parallel [(set (match_operand 0 "" "")
11659 (call (mem:SI (match_operand 1 "address_operand" ""))
11660 (match_operand 2 "" "")))
11661 (use (match_operand 3 "" ""))
11662 (clobber (reg:SI LR_REGNO))])]
11667 if (MACHOPIC_INDIRECT)
11668 operands[1] = machopic_indirect_call_target (operands[1]);
11671 gcc_assert (GET_CODE (operands[1]) == MEM);
11672 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
11674 operands[1] = XEXP (operands[1], 0);
11676 if (GET_CODE (operands[1]) != SYMBOL_REF
11677 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[1]))
11678 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[3]) & CALL_LONG) != 0))
11680 if (INTVAL (operands[3]) & CALL_LONG)
11681 operands[1] = rs6000_longcall_ref (operands[1]);
11683 switch (DEFAULT_ABI)
11687 operands[1] = force_reg (Pmode, operands[1]);
11691 /* AIX function pointers are really pointers to a three word
11693 emit_call_insn (TARGET_32BIT
11694 ? gen_call_value_indirect_aix32 (operands[0],
11698 : gen_call_value_indirect_aix64 (operands[0],
11705 gcc_unreachable ();
11710 ;; Call to function in current module. No TOC pointer reload needed.
11711 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
11712 ;; either the function was not prototyped, or it was prototyped as a
11713 ;; variable argument function. It is > 0 if FP registers were passed
11714 ;; and < 0 if they were not.
11716 (define_insn "*call_local32"
11717 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
11718 (match_operand 1 "" "g,g"))
11719 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11720 (clobber (reg:SI LR_REGNO))]
11721 "(INTVAL (operands[2]) & CALL_LONG) == 0"
11724 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11725 output_asm_insn (\"crxor 6,6,6\", operands);
11727 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11728 output_asm_insn (\"creqv 6,6,6\", operands);
11730 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
11732 [(set_attr "type" "branch")
11733 (set_attr "length" "4,8")])
11735 (define_insn "*call_local64"
11736 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
11737 (match_operand 1 "" "g,g"))
11738 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11739 (clobber (reg:SI LR_REGNO))]
11740 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
11743 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11744 output_asm_insn (\"crxor 6,6,6\", operands);
11746 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11747 output_asm_insn (\"creqv 6,6,6\", operands);
11749 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
11751 [(set_attr "type" "branch")
11752 (set_attr "length" "4,8")])
11754 (define_insn "*call_value_local32"
11755 [(set (match_operand 0 "" "")
11756 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
11757 (match_operand 2 "" "g,g")))
11758 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11759 (clobber (reg:SI LR_REGNO))]
11760 "(INTVAL (operands[3]) & CALL_LONG) == 0"
11763 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11764 output_asm_insn (\"crxor 6,6,6\", operands);
11766 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11767 output_asm_insn (\"creqv 6,6,6\", operands);
11769 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
11771 [(set_attr "type" "branch")
11772 (set_attr "length" "4,8")])
11775 (define_insn "*call_value_local64"
11776 [(set (match_operand 0 "" "")
11777 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
11778 (match_operand 2 "" "g,g")))
11779 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11780 (clobber (reg:SI LR_REGNO))]
11781 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
11784 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11785 output_asm_insn (\"crxor 6,6,6\", operands);
11787 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11788 output_asm_insn (\"creqv 6,6,6\", operands);
11790 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
11792 [(set_attr "type" "branch")
11793 (set_attr "length" "4,8")])
11795 ;; Call to function which may be in another module. Restore the TOC
11796 ;; pointer (r2) after the call unless this is System V.
11797 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
11798 ;; either the function was not prototyped, or it was prototyped as a
11799 ;; variable argument function. It is > 0 if FP registers were passed
11800 ;; and < 0 if they were not.
11802 (define_insn_and_split "*call_indirect_nonlocal_aix32_internal"
11803 [(call (mem:SI (match_operand:SI 0 "register_operand" "c,*l"))
11804 (match_operand 1 "" "g,g"))
11805 (use (mem:SI (plus:SI (match_operand:SI 2 "register_operand" "b,b") (const_int 4))))
11807 (use (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
11808 (clobber (reg:SI LR_REGNO))]
11809 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
11811 "&& reload_completed"
11813 (mem:SI (plus:SI (match_dup 2) (const_int 4))))
11814 (parallel [(call (mem:SI (match_dup 0))
11819 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
11820 (clobber (reg:SI LR_REGNO))])]
11822 [(set_attr "type" "jmpreg")
11823 (set_attr "length" "12")])
11825 (define_insn "*call_indirect_nonlocal_aix32"
11826 [(call (mem:SI (match_operand:SI 0 "register_operand" "c,*l"))
11827 (match_operand 1 "" "g,g"))
11831 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
11832 (clobber (reg:SI LR_REGNO))]
11833 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX && reload_completed"
11834 "b%T0l\;{l|lwz} 2,20(1)"
11835 [(set_attr "type" "jmpreg")
11836 (set_attr "length" "8")])
11838 (define_insn "*call_nonlocal_aix32"
11839 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
11840 (match_operand 1 "" "g"))
11841 (use (match_operand:SI 2 "immediate_operand" "O"))
11842 (clobber (reg:SI LR_REGNO))]
11844 && DEFAULT_ABI == ABI_AIX
11845 && (INTVAL (operands[2]) & CALL_LONG) == 0"
11847 [(set_attr "type" "branch")
11848 (set_attr "length" "8")])
11850 (define_insn_and_split "*call_indirect_nonlocal_aix64_internal"
11851 [(call (mem:SI (match_operand:DI 0 "register_operand" "c,*l"))
11852 (match_operand 1 "" "g,g"))
11853 (use (mem:DI (plus:DI (match_operand:DI 2 "register_operand" "b,b")
11856 (use (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
11857 (clobber (reg:SI LR_REGNO))]
11858 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
11860 "&& reload_completed"
11862 (mem:DI (plus:DI (match_dup 2) (const_int 8))))
11863 (parallel [(call (mem:SI (match_dup 0))
11868 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
11869 (clobber (reg:SI LR_REGNO))])]
11871 [(set_attr "type" "jmpreg")
11872 (set_attr "length" "12")])
11874 (define_insn "*call_indirect_nonlocal_aix64"
11875 [(call (mem:SI (match_operand:DI 0 "register_operand" "c,*l"))
11876 (match_operand 1 "" "g,g"))
11880 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
11881 (clobber (reg:SI LR_REGNO))]
11882 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX && reload_completed"
11883 "b%T0l\;ld 2,40(1)"
11884 [(set_attr "type" "jmpreg")
11885 (set_attr "length" "8")])
11887 (define_insn "*call_nonlocal_aix64"
11888 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
11889 (match_operand 1 "" "g"))
11890 (use (match_operand:SI 2 "immediate_operand" "O"))
11891 (clobber (reg:SI LR_REGNO))]
11893 && DEFAULT_ABI == ABI_AIX
11894 && (INTVAL (operands[2]) & CALL_LONG) == 0"
11896 [(set_attr "type" "branch")
11897 (set_attr "length" "8")])
11899 (define_insn_and_split "*call_value_indirect_nonlocal_aix32_internal"
11900 [(set (match_operand 0 "" "")
11901 (call (mem:SI (match_operand:SI 1 "register_operand" "c,*l"))
11902 (match_operand 2 "" "g,g")))
11903 (use (mem:SI (plus:SI (match_operand:SI 3 "register_operand" "b,b")
11906 (use (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
11907 (clobber (reg:SI LR_REGNO))]
11908 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
11910 "&& reload_completed"
11912 (mem:SI (plus:SI (match_dup 3) (const_int 4))))
11913 (parallel [(set (match_dup 0) (call (mem:SI (match_dup 1))
11918 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
11919 (clobber (reg:SI LR_REGNO))])]
11921 [(set_attr "type" "jmpreg")
11922 (set_attr "length" "12")])
11924 (define_insn "*call_value_indirect_nonlocal_aix32"
11925 [(set (match_operand 0 "" "")
11926 (call (mem:SI (match_operand:SI 1 "register_operand" "c,*l"))
11927 (match_operand 2 "" "g,g")))
11931 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
11932 (clobber (reg:SI LR_REGNO))]
11933 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX && reload_completed"
11934 "b%T1l\;{l|lwz} 2,20(1)"
11935 [(set_attr "type" "jmpreg")
11936 (set_attr "length" "8")])
11938 (define_insn "*call_value_nonlocal_aix32"
11939 [(set (match_operand 0 "" "")
11940 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
11941 (match_operand 2 "" "g")))
11942 (use (match_operand:SI 3 "immediate_operand" "O"))
11943 (clobber (reg:SI LR_REGNO))]
11945 && DEFAULT_ABI == ABI_AIX
11946 && (INTVAL (operands[3]) & CALL_LONG) == 0"
11948 [(set_attr "type" "branch")
11949 (set_attr "length" "8")])
11951 (define_insn_and_split "*call_value_indirect_nonlocal_aix64_internal"
11952 [(set (match_operand 0 "" "")
11953 (call (mem:SI (match_operand:DI 1 "register_operand" "c,*l"))
11954 (match_operand 2 "" "g,g")))
11955 (use (mem:DI (plus:DI (match_operand:DI 3 "register_operand" "b,b")
11958 (use (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
11959 (clobber (reg:SI LR_REGNO))]
11960 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
11962 "&& reload_completed"
11964 (mem:DI (plus:DI (match_dup 3) (const_int 8))))
11965 (parallel [(set (match_dup 0) (call (mem:SI (match_dup 1))
11970 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
11971 (clobber (reg:SI LR_REGNO))])]
11973 [(set_attr "type" "jmpreg")
11974 (set_attr "length" "12")])
11976 (define_insn "*call_value_indirect_nonlocal_aix64"
11977 [(set (match_operand 0 "" "")
11978 (call (mem:SI (match_operand:DI 1 "register_operand" "c,*l"))
11979 (match_operand 2 "" "g,g")))
11983 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
11984 (clobber (reg:SI LR_REGNO))]
11985 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX && reload_completed"
11986 "b%T1l\;ld 2,40(1)"
11987 [(set_attr "type" "jmpreg")
11988 (set_attr "length" "8")])
11990 (define_insn "*call_value_nonlocal_aix64"
11991 [(set (match_operand 0 "" "")
11992 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
11993 (match_operand 2 "" "g")))
11994 (use (match_operand:SI 3 "immediate_operand" "O"))
11995 (clobber (reg:SI LR_REGNO))]
11997 && DEFAULT_ABI == ABI_AIX
11998 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12000 [(set_attr "type" "branch")
12001 (set_attr "length" "8")])
12003 ;; A function pointer under System V is just a normal pointer
12004 ;; operands[0] is the function pointer
12005 ;; operands[1] is the stack size to clean up
12006 ;; operands[2] is the value FUNCTION_ARG returns for the VOID argument
12007 ;; which indicates how to set cr1
12009 (define_insn "*call_indirect_nonlocal_sysv<mode>"
12010 [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l,c,*l"))
12011 (match_operand 1 "" "g,g,g,g"))
12012 (use (match_operand:SI 2 "immediate_operand" "O,O,n,n"))
12013 (clobber (reg:SI LR_REGNO))]
12014 "DEFAULT_ABI == ABI_V4
12015 || DEFAULT_ABI == ABI_DARWIN"
12017 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12018 output_asm_insn ("crxor 6,6,6", operands);
12020 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12021 output_asm_insn ("creqv 6,6,6", operands);
12025 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
12026 (set_attr "length" "4,4,8,8")])
12028 (define_insn_and_split "*call_nonlocal_sysv<mode>"
12029 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
12030 (match_operand 1 "" "g,g"))
12031 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12032 (clobber (reg:SI LR_REGNO))]
12033 "(DEFAULT_ABI == ABI_DARWIN
12034 || (DEFAULT_ABI == ABI_V4
12035 && (INTVAL (operands[2]) & CALL_LONG) == 0))"
12037 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12038 output_asm_insn ("crxor 6,6,6", operands);
12040 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12041 output_asm_insn ("creqv 6,6,6", operands);
12044 return output_call(insn, operands, 0, 2);
12046 if (DEFAULT_ABI == ABI_V4 && flag_pic)
12048 gcc_assert (!TARGET_SECURE_PLT);
12049 return "bl %z0@plt";
12055 "DEFAULT_ABI == ABI_V4
12056 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[0])
12057 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12058 [(parallel [(call (mem:SI (match_dup 0))
12060 (use (match_dup 2))
12061 (use (match_dup 3))
12062 (clobber (reg:SI LR_REGNO))])]
12064 operands[3] = pic_offset_table_rtx;
12066 [(set_attr "type" "branch,branch")
12067 (set_attr "length" "4,8")])
12069 (define_insn "*call_nonlocal_sysv_secure<mode>"
12070 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
12071 (match_operand 1 "" "g,g"))
12072 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12073 (use (match_operand:SI 3 "register_operand" "r,r"))
12074 (clobber (reg:SI LR_REGNO))]
12075 "(DEFAULT_ABI == ABI_V4
12076 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[0])
12077 && (INTVAL (operands[2]) & CALL_LONG) == 0)"
12079 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12080 output_asm_insn ("crxor 6,6,6", operands);
12082 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12083 output_asm_insn ("creqv 6,6,6", operands);
12086 /* The magic 32768 offset here and in the other sysv call insns
12087 corresponds to the offset of r30 in .got2, as given by LCTOC1.
12088 See sysv4.h:toc_section. */
12089 return "bl %z0+32768@plt";
12091 return "bl %z0@plt";
12093 [(set_attr "type" "branch,branch")
12094 (set_attr "length" "4,8")])
12096 (define_insn "*call_value_indirect_nonlocal_sysv<mode>"
12097 [(set (match_operand 0 "" "")
12098 (call (mem:SI (match_operand:P 1 "register_operand" "c,*l,c,*l"))
12099 (match_operand 2 "" "g,g,g,g")))
12100 (use (match_operand:SI 3 "immediate_operand" "O,O,n,n"))
12101 (clobber (reg:SI LR_REGNO))]
12102 "DEFAULT_ABI == ABI_V4
12103 || DEFAULT_ABI == ABI_DARWIN"
12105 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12106 output_asm_insn ("crxor 6,6,6", operands);
12108 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12109 output_asm_insn ("creqv 6,6,6", operands);
12113 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
12114 (set_attr "length" "4,4,8,8")])
12116 (define_insn_and_split "*call_value_nonlocal_sysv<mode>"
12117 [(set (match_operand 0 "" "")
12118 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
12119 (match_operand 2 "" "g,g")))
12120 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12121 (clobber (reg:SI LR_REGNO))]
12122 "(DEFAULT_ABI == ABI_DARWIN
12123 || (DEFAULT_ABI == ABI_V4
12124 && (INTVAL (operands[3]) & CALL_LONG) == 0))"
12126 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12127 output_asm_insn ("crxor 6,6,6", operands);
12129 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12130 output_asm_insn ("creqv 6,6,6", operands);
12133 return output_call(insn, operands, 1, 3);
12135 if (DEFAULT_ABI == ABI_V4 && flag_pic)
12137 gcc_assert (!TARGET_SECURE_PLT);
12138 return "bl %z1@plt";
12144 "DEFAULT_ABI == ABI_V4
12145 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[1])
12146 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12147 [(parallel [(set (match_dup 0)
12148 (call (mem:SI (match_dup 1))
12150 (use (match_dup 3))
12151 (use (match_dup 4))
12152 (clobber (reg:SI LR_REGNO))])]
12154 operands[4] = pic_offset_table_rtx;
12156 [(set_attr "type" "branch,branch")
12157 (set_attr "length" "4,8")])
12159 (define_insn "*call_value_nonlocal_sysv_secure<mode>"
12160 [(set (match_operand 0 "" "")
12161 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
12162 (match_operand 2 "" "g,g")))
12163 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12164 (use (match_operand:SI 4 "register_operand" "r,r"))
12165 (clobber (reg:SI LR_REGNO))]
12166 "(DEFAULT_ABI == ABI_V4
12167 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[1])
12168 && (INTVAL (operands[3]) & CALL_LONG) == 0)"
12170 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12171 output_asm_insn ("crxor 6,6,6", operands);
12173 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12174 output_asm_insn ("creqv 6,6,6", operands);
12177 return "bl %z1+32768@plt";
12179 return "bl %z1@plt";
12181 [(set_attr "type" "branch,branch")
12182 (set_attr "length" "4,8")])
12184 ;; Call subroutine returning any type.
12185 (define_expand "untyped_call"
12186 [(parallel [(call (match_operand 0 "" "")
12188 (match_operand 1 "" "")
12189 (match_operand 2 "" "")])]
12195 emit_call_insn (GEN_CALL (operands[0], const0_rtx, const0_rtx, const0_rtx));
12197 for (i = 0; i < XVECLEN (operands[2], 0); i++)
12199 rtx set = XVECEXP (operands[2], 0, i);
12200 emit_move_insn (SET_DEST (set), SET_SRC (set));
12203 /* The optimizer does not know that the call sets the function value
12204 registers we stored in the result block. We avoid problems by
12205 claiming that all hard registers are used and clobbered at this
12207 emit_insn (gen_blockage ());
12212 ;; sibling call patterns
12213 (define_expand "sibcall"
12214 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
12215 (match_operand 1 "" ""))
12216 (use (match_operand 2 "" ""))
12217 (use (reg:SI LR_REGNO))
12223 if (MACHOPIC_INDIRECT)
12224 operands[0] = machopic_indirect_call_target (operands[0]);
12227 gcc_assert (GET_CODE (operands[0]) == MEM);
12228 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
12230 operands[0] = XEXP (operands[0], 0);
12233 ;; this and similar patterns must be marked as using LR, otherwise
12234 ;; dataflow will try to delete the store into it. This is true
12235 ;; even when the actual reg to jump to is in CTR, when LR was
12236 ;; saved and restored around the PIC-setting BCL.
12237 (define_insn "*sibcall_local32"
12238 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
12239 (match_operand 1 "" "g,g"))
12240 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12241 (use (reg:SI LR_REGNO))
12243 "(INTVAL (operands[2]) & CALL_LONG) == 0"
12246 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12247 output_asm_insn (\"crxor 6,6,6\", operands);
12249 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12250 output_asm_insn (\"creqv 6,6,6\", operands);
12252 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
12254 [(set_attr "type" "branch")
12255 (set_attr "length" "4,8")])
12257 (define_insn "*sibcall_local64"
12258 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
12259 (match_operand 1 "" "g,g"))
12260 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12261 (use (reg:SI LR_REGNO))
12263 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
12266 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12267 output_asm_insn (\"crxor 6,6,6\", operands);
12269 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12270 output_asm_insn (\"creqv 6,6,6\", operands);
12272 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
12274 [(set_attr "type" "branch")
12275 (set_attr "length" "4,8")])
12277 (define_insn "*sibcall_value_local32"
12278 [(set (match_operand 0 "" "")
12279 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
12280 (match_operand 2 "" "g,g")))
12281 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12282 (use (reg:SI LR_REGNO))
12284 "(INTVAL (operands[3]) & CALL_LONG) == 0"
12287 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12288 output_asm_insn (\"crxor 6,6,6\", operands);
12290 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12291 output_asm_insn (\"creqv 6,6,6\", operands);
12293 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
12295 [(set_attr "type" "branch")
12296 (set_attr "length" "4,8")])
12299 (define_insn "*sibcall_value_local64"
12300 [(set (match_operand 0 "" "")
12301 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
12302 (match_operand 2 "" "g,g")))
12303 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12304 (use (reg:SI LR_REGNO))
12306 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
12309 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12310 output_asm_insn (\"crxor 6,6,6\", operands);
12312 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12313 output_asm_insn (\"creqv 6,6,6\", operands);
12315 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
12317 [(set_attr "type" "branch")
12318 (set_attr "length" "4,8")])
12320 (define_insn "*sibcall_nonlocal_aix32"
12321 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
12322 (match_operand 1 "" "g"))
12323 (use (match_operand:SI 2 "immediate_operand" "O"))
12324 (use (reg:SI LR_REGNO))
12327 && DEFAULT_ABI == ABI_AIX
12328 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12330 [(set_attr "type" "branch")
12331 (set_attr "length" "4")])
12333 (define_insn "*sibcall_nonlocal_aix64"
12334 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
12335 (match_operand 1 "" "g"))
12336 (use (match_operand:SI 2 "immediate_operand" "O"))
12337 (use (reg:SI LR_REGNO))
12340 && DEFAULT_ABI == ABI_AIX
12341 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12343 [(set_attr "type" "branch")
12344 (set_attr "length" "4")])
12346 (define_insn "*sibcall_value_nonlocal_aix32"
12347 [(set (match_operand 0 "" "")
12348 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
12349 (match_operand 2 "" "g")))
12350 (use (match_operand:SI 3 "immediate_operand" "O"))
12351 (use (reg:SI LR_REGNO))
12354 && DEFAULT_ABI == ABI_AIX
12355 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12357 [(set_attr "type" "branch")
12358 (set_attr "length" "4")])
12360 (define_insn "*sibcall_value_nonlocal_aix64"
12361 [(set (match_operand 0 "" "")
12362 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
12363 (match_operand 2 "" "g")))
12364 (use (match_operand:SI 3 "immediate_operand" "O"))
12365 (use (reg:SI LR_REGNO))
12368 && DEFAULT_ABI == ABI_AIX
12369 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12371 [(set_attr "type" "branch")
12372 (set_attr "length" "4")])
12374 (define_insn "*sibcall_nonlocal_sysv<mode>"
12375 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
12376 (match_operand 1 "" ""))
12377 (use (match_operand 2 "immediate_operand" "O,n"))
12378 (use (reg:SI LR_REGNO))
12380 "(DEFAULT_ABI == ABI_DARWIN
12381 || DEFAULT_ABI == ABI_V4)
12382 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12385 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12386 output_asm_insn (\"crxor 6,6,6\", operands);
12388 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12389 output_asm_insn (\"creqv 6,6,6\", operands);
12391 if (DEFAULT_ABI == ABI_V4 && flag_pic)
12393 gcc_assert (!TARGET_SECURE_PLT);
12394 return \"b %z0@plt\";
12399 [(set_attr "type" "branch,branch")
12400 (set_attr "length" "4,8")])
12402 (define_expand "sibcall_value"
12403 [(parallel [(set (match_operand 0 "register_operand" "")
12404 (call (mem:SI (match_operand 1 "address_operand" ""))
12405 (match_operand 2 "" "")))
12406 (use (match_operand 3 "" ""))
12407 (use (reg:SI LR_REGNO))
12413 if (MACHOPIC_INDIRECT)
12414 operands[1] = machopic_indirect_call_target (operands[1]);
12417 gcc_assert (GET_CODE (operands[1]) == MEM);
12418 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
12420 operands[1] = XEXP (operands[1], 0);
12423 (define_insn "*sibcall_value_nonlocal_sysv<mode>"
12424 [(set (match_operand 0 "" "")
12425 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
12426 (match_operand 2 "" "")))
12427 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12428 (use (reg:SI LR_REGNO))
12430 "(DEFAULT_ABI == ABI_DARWIN
12431 || DEFAULT_ABI == ABI_V4)
12432 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12435 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12436 output_asm_insn (\"crxor 6,6,6\", operands);
12438 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12439 output_asm_insn (\"creqv 6,6,6\", operands);
12441 if (DEFAULT_ABI == ABI_V4 && flag_pic)
12443 gcc_assert (!TARGET_SECURE_PLT);
12444 return \"b %z1@plt\";
12449 [(set_attr "type" "branch,branch")
12450 (set_attr "length" "4,8")])
12452 (define_expand "sibcall_epilogue"
12453 [(use (const_int 0))]
12454 "TARGET_SCHED_PROLOG"
12457 rs6000_emit_epilogue (TRUE);
12461 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
12462 ;; all of memory. This blocks insns from being moved across this point.
12464 (define_insn "blockage"
12465 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCK)]
12469 (define_insn "probe_stack"
12470 [(set (match_operand 0 "memory_operand" "=m")
12471 (unspec [(const_int 0)] UNSPEC_PROBE_STACK))]
12473 "{st%U0%X0|stw%U0%X0} 0,%0"
12474 [(set_attr "type" "store")
12475 (set_attr "length" "4")])
12477 ;; Compare insns are next. Note that the RS/6000 has two types of compares,
12478 ;; signed & unsigned, and one type of branch.
12480 ;; Start with the DEFINE_EXPANDs to generate the rtl for compares, scc
12481 ;; insns, and branches.
12483 (define_expand "cbranch<mode>4"
12484 [(use (match_operator 0 "rs6000_cbranch_operator"
12485 [(match_operand:GPR 1 "gpc_reg_operand" "")
12486 (match_operand:GPR 2 "reg_or_short_operand" "")]))
12487 (use (match_operand 3 ""))]
12491 /* Take care of the possibility that operands[2] might be negative but
12492 this might be a logical operation. That insn doesn't exist. */
12493 if (GET_CODE (operands[2]) == CONST_INT
12494 && INTVAL (operands[2]) < 0)
12496 operands[2] = force_reg (<MODE>mode, operands[2]);
12497 operands[0] = gen_rtx_fmt_ee (GET_CODE (operands[0]),
12498 GET_MODE (operands[0]),
12499 operands[1], operands[2]);
12502 rs6000_emit_cbranch (<MODE>mode, operands);
12506 (define_expand "cbranch<mode>4"
12507 [(use (match_operator 0 "rs6000_cbranch_operator"
12508 [(match_operand:FP 1 "gpc_reg_operand" "")
12509 (match_operand:FP 2 "gpc_reg_operand" "")]))
12510 (use (match_operand 3 ""))]
12514 rs6000_emit_cbranch (<MODE>mode, operands);
12518 (define_expand "cstore<mode>4"
12519 [(use (match_operator 1 "rs6000_cbranch_operator"
12520 [(match_operand:GPR 2 "gpc_reg_operand" "")
12521 (match_operand:GPR 3 "reg_or_short_operand" "")]))
12522 (clobber (match_operand:SI 0 "register_operand"))]
12526 /* Take care of the possibility that operands[3] might be negative but
12527 this might be a logical operation. That insn doesn't exist. */
12528 if (GET_CODE (operands[3]) == CONST_INT
12529 && INTVAL (operands[3]) < 0)
12531 operands[3] = force_reg (<MODE>mode, operands[3]);
12532 operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]),
12533 GET_MODE (operands[1]),
12534 operands[2], operands[3]);
12537 /* For SNE, we would prefer that the xor/abs sequence be used for integers.
12538 For SEQ, likewise, except that comparisons with zero should be done
12539 with an scc insns. However, due to the order that combine see the
12540 resulting insns, we must, in fact, allow SEQ for integers. Fail in
12541 the cases we don't want to handle or are best handled by portable
12543 if (GET_CODE (operands[1]) == NE)
12545 if ((GET_CODE (operands[1]) == LT || GET_CODE (operands[1]) == LE
12546 || GET_CODE (operands[1]) == GT || GET_CODE (operands[1]) == GE)
12547 && operands[3] == const0_rtx)
12549 rs6000_emit_sCOND (<MODE>mode, operands);
12553 (define_expand "cstore<mode>4"
12554 [(use (match_operator 1 "rs6000_cbranch_operator"
12555 [(match_operand:FP 2 "gpc_reg_operand" "")
12556 (match_operand:FP 3 "gpc_reg_operand" "")]))
12557 (clobber (match_operand:SI 0 "register_operand"))]
12561 rs6000_emit_sCOND (<MODE>mode, operands);
12566 (define_expand "stack_protect_set"
12567 [(match_operand 0 "memory_operand" "")
12568 (match_operand 1 "memory_operand" "")]
12571 #ifdef TARGET_THREAD_SSP_OFFSET
12572 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
12573 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
12574 operands[1] = gen_rtx_MEM (Pmode, addr);
12577 emit_insn (gen_stack_protect_setdi (operands[0], operands[1]));
12579 emit_insn (gen_stack_protect_setsi (operands[0], operands[1]));
12583 (define_insn "stack_protect_setsi"
12584 [(set (match_operand:SI 0 "memory_operand" "=m")
12585 (unspec:SI [(match_operand:SI 1 "memory_operand" "m")] UNSPEC_SP_SET))
12586 (set (match_scratch:SI 2 "=&r") (const_int 0))]
12588 "{l%U1%X1|lwz%U1%X1} %2,%1\;{st%U0%X0|stw%U0%X0} %2,%0\;{lil|li} %2,0"
12589 [(set_attr "type" "three")
12590 (set_attr "length" "12")])
12592 (define_insn "stack_protect_setdi"
12593 [(set (match_operand:DI 0 "memory_operand" "=m")
12594 (unspec:DI [(match_operand:DI 1 "memory_operand" "m")] UNSPEC_SP_SET))
12595 (set (match_scratch:DI 2 "=&r") (const_int 0))]
12597 "ld%U1%X1 %2,%1\;std%U0%X0 %2,%0\;{lil|li} %2,0"
12598 [(set_attr "type" "three")
12599 (set_attr "length" "12")])
12601 (define_expand "stack_protect_test"
12602 [(match_operand 0 "memory_operand" "")
12603 (match_operand 1 "memory_operand" "")
12604 (match_operand 2 "" "")]
12607 rtx test, op0, op1;
12608 #ifdef TARGET_THREAD_SSP_OFFSET
12609 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
12610 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
12611 operands[1] = gen_rtx_MEM (Pmode, addr);
12614 op1 = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, operands[1]), UNSPEC_SP_TEST);
12615 test = gen_rtx_EQ (VOIDmode, op0, op1);
12616 emit_jump_insn (gen_cbranchsi4 (test, op0, op1, operands[2]));
12620 (define_insn "stack_protect_testsi"
12621 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
12622 (unspec:CCEQ [(match_operand:SI 1 "memory_operand" "m,m")
12623 (match_operand:SI 2 "memory_operand" "m,m")]
12625 (set (match_scratch:SI 4 "=r,r") (const_int 0))
12626 (clobber (match_scratch:SI 3 "=&r,&r"))]
12629 {l%U1%X1|lwz%U1%X1} %3,%1\;{l%U2%X2|lwz%U2%X2} %4,%2\;xor. %3,%3,%4\;{lil|li} %4,0
12630 {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"
12631 [(set_attr "length" "16,20")])
12633 (define_insn "stack_protect_testdi"
12634 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
12635 (unspec:CCEQ [(match_operand:DI 1 "memory_operand" "m,m")
12636 (match_operand:DI 2 "memory_operand" "m,m")]
12638 (set (match_scratch:DI 4 "=r,r") (const_int 0))
12639 (clobber (match_scratch:DI 3 "=&r,&r"))]
12642 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;xor. %3,%3,%4\;{lil|li} %4,0
12643 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;cmpld %0,%3,%4\;{lil|li} %3,0\;{lil|li} %4,0"
12644 [(set_attr "length" "16,20")])
12647 ;; Here are the actual compare insns.
12648 (define_insn "*cmp<mode>_internal1"
12649 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
12650 (compare:CC (match_operand:GPR 1 "gpc_reg_operand" "r")
12651 (match_operand:GPR 2 "reg_or_short_operand" "rI")))]
12653 "{cmp%I2|cmp<wd>%I2} %0,%1,%2"
12654 [(set_attr "type" "cmp")])
12656 ;; If we are comparing a register for equality with a large constant,
12657 ;; we can do this with an XOR followed by a compare. But this is profitable
12658 ;; only if the large constant is only used for the comparison (and in this
12659 ;; case we already have a register to reuse as scratch).
12661 ;; For 64-bit registers, we could only do so if the constant's bit 15 is clear:
12662 ;; otherwise we'd need to XOR with FFFFFFFF????0000 which is not available.
12665 [(set (match_operand:SI 0 "register_operand")
12666 (match_operand:SI 1 "logical_const_operand" ""))
12667 (set (match_dup 0) (match_operator:SI 3 "boolean_or_operator"
12669 (match_operand:SI 2 "logical_const_operand" "")]))
12670 (set (match_operand:CC 4 "cc_reg_operand" "")
12671 (compare:CC (match_operand:SI 5 "gpc_reg_operand" "")
12674 (if_then_else (match_operator 6 "equality_operator"
12675 [(match_dup 4) (const_int 0)])
12676 (match_operand 7 "" "")
12677 (match_operand 8 "" "")))]
12678 "peep2_reg_dead_p (3, operands[0])
12679 && peep2_reg_dead_p (4, operands[4])"
12680 [(set (match_dup 0) (xor:SI (match_dup 5) (match_dup 9)))
12681 (set (match_dup 4) (compare:CC (match_dup 0) (match_dup 10)))
12682 (set (pc) (if_then_else (match_dup 6) (match_dup 7) (match_dup 8)))]
12685 /* Get the constant we are comparing against, and see what it looks like
12686 when sign-extended from 16 to 32 bits. Then see what constant we could
12687 XOR with SEXTC to get the sign-extended value. */
12688 rtx cnst = simplify_const_binary_operation (GET_CODE (operands[3]),
12690 operands[1], operands[2]);
12691 HOST_WIDE_INT c = INTVAL (cnst);
12692 HOST_WIDE_INT sextc = ((c & 0xffff) ^ 0x8000) - 0x8000;
12693 HOST_WIDE_INT xorv = c ^ sextc;
12695 operands[9] = GEN_INT (xorv);
12696 operands[10] = GEN_INT (sextc);
12699 (define_insn "*cmpsi_internal2"
12700 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
12701 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
12702 (match_operand:SI 2 "reg_or_u_short_operand" "rK")))]
12704 "{cmpl%I2|cmplw%I2} %0,%1,%b2"
12705 [(set_attr "type" "cmp")])
12707 (define_insn "*cmpdi_internal2"
12708 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
12709 (compare:CCUNS (match_operand:DI 1 "gpc_reg_operand" "r")
12710 (match_operand:DI 2 "reg_or_u_short_operand" "rK")))]
12712 "cmpld%I2 %0,%1,%b2"
12713 [(set_attr "type" "cmp")])
12715 ;; The following two insns don't exist as single insns, but if we provide
12716 ;; them, we can swap an add and compare, which will enable us to overlap more
12717 ;; of the required delay between a compare and branch. We generate code for
12718 ;; them by splitting.
12721 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
12722 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
12723 (match_operand:SI 2 "short_cint_operand" "i")))
12724 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
12725 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
12728 [(set_attr "length" "8")])
12731 [(set (match_operand:CCUNS 3 "cc_reg_operand" "=y")
12732 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
12733 (match_operand:SI 2 "u_short_cint_operand" "i")))
12734 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
12735 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
12738 [(set_attr "length" "8")])
12741 [(set (match_operand:CC 3 "cc_reg_operand" "")
12742 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
12743 (match_operand:SI 2 "short_cint_operand" "")))
12744 (set (match_operand:SI 0 "gpc_reg_operand" "")
12745 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
12747 [(set (match_dup 3) (compare:CC (match_dup 1) (match_dup 2)))
12748 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
12751 [(set (match_operand:CCUNS 3 "cc_reg_operand" "")
12752 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "")
12753 (match_operand:SI 2 "u_short_cint_operand" "")))
12754 (set (match_operand:SI 0 "gpc_reg_operand" "")
12755 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
12757 [(set (match_dup 3) (compare:CCUNS (match_dup 1) (match_dup 2)))
12758 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
12760 (define_insn "*cmpsf_internal1"
12761 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
12762 (compare:CCFP (match_operand:SF 1 "gpc_reg_operand" "f")
12763 (match_operand:SF 2 "gpc_reg_operand" "f")))]
12764 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
12766 [(set_attr "type" "fpcompare")])
12768 (define_insn "*cmpdf_internal1"
12769 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
12770 (compare:CCFP (match_operand:DF 1 "gpc_reg_operand" "d")
12771 (match_operand:DF 2 "gpc_reg_operand" "d")))]
12772 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
12773 && !VECTOR_UNIT_VSX_P (DFmode)"
12775 [(set_attr "type" "fpcompare")])
12777 ;; Only need to compare second words if first words equal
12778 (define_insn "*cmptf_internal1"
12779 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
12780 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "d")
12781 (match_operand:TF 2 "gpc_reg_operand" "d")))]
12782 "!TARGET_IEEEQUAD && !TARGET_XL_COMPAT
12783 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LONG_DOUBLE_128"
12784 "fcmpu %0,%1,%2\;bne %0,$+8\;fcmpu %0,%L1,%L2"
12785 [(set_attr "type" "fpcompare")
12786 (set_attr "length" "12")])
12788 (define_insn_and_split "*cmptf_internal2"
12789 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
12790 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "d")
12791 (match_operand:TF 2 "gpc_reg_operand" "d")))
12792 (clobber (match_scratch:DF 3 "=d"))
12793 (clobber (match_scratch:DF 4 "=d"))
12794 (clobber (match_scratch:DF 5 "=d"))
12795 (clobber (match_scratch:DF 6 "=d"))
12796 (clobber (match_scratch:DF 7 "=d"))
12797 (clobber (match_scratch:DF 8 "=d"))
12798 (clobber (match_scratch:DF 9 "=d"))
12799 (clobber (match_scratch:DF 10 "=d"))]
12800 "!TARGET_IEEEQUAD && TARGET_XL_COMPAT
12801 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LONG_DOUBLE_128"
12803 "&& reload_completed"
12804 [(set (match_dup 3) (match_dup 13))
12805 (set (match_dup 4) (match_dup 14))
12806 (set (match_dup 9) (abs:DF (match_dup 5)))
12807 (set (match_dup 0) (compare:CCFP (match_dup 9) (match_dup 3)))
12808 (set (pc) (if_then_else (ne (match_dup 0) (const_int 0))
12809 (label_ref (match_dup 11))
12811 (set (match_dup 0) (compare:CCFP (match_dup 5) (match_dup 7)))
12812 (set (pc) (label_ref (match_dup 12)))
12814 (set (match_dup 10) (minus:DF (match_dup 5) (match_dup 7)))
12815 (set (match_dup 9) (minus:DF (match_dup 6) (match_dup 8)))
12816 (set (match_dup 9) (plus:DF (match_dup 10) (match_dup 9)))
12817 (set (match_dup 0) (compare:CCFP (match_dup 7) (match_dup 4)))
12820 REAL_VALUE_TYPE rv;
12821 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
12822 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
12824 operands[5] = simplify_gen_subreg (DFmode, operands[1], TFmode, hi_word);
12825 operands[6] = simplify_gen_subreg (DFmode, operands[1], TFmode, lo_word);
12826 operands[7] = simplify_gen_subreg (DFmode, operands[2], TFmode, hi_word);
12827 operands[8] = simplify_gen_subreg (DFmode, operands[2], TFmode, lo_word);
12828 operands[11] = gen_label_rtx ();
12829 operands[12] = gen_label_rtx ();
12831 operands[13] = force_const_mem (DFmode,
12832 CONST_DOUBLE_FROM_REAL_VALUE (rv, DFmode));
12833 operands[14] = force_const_mem (DFmode,
12834 CONST_DOUBLE_FROM_REAL_VALUE (dconst0,
12838 operands[13] = gen_const_mem (DFmode,
12839 create_TOC_reference (XEXP (operands[13], 0)));
12840 operands[14] = gen_const_mem (DFmode,
12841 create_TOC_reference (XEXP (operands[14], 0)));
12842 set_mem_alias_set (operands[13], get_TOC_alias_set ());
12843 set_mem_alias_set (operands[14], get_TOC_alias_set ());
12847 ;; Now we have the scc insns. We can do some combinations because of the
12848 ;; way the machine works.
12850 ;; Note that this is probably faster if we can put an insn between the
12851 ;; mfcr and rlinm, but this is tricky. Let's leave it for now. In most
12852 ;; cases the insns below which don't use an intermediate CR field will
12853 ;; be used instead.
12855 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12856 (match_operator:SI 1 "scc_comparison_operator"
12857 [(match_operand 2 "cc_reg_operand" "y")
12860 "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1"
12861 [(set (attr "type")
12862 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
12863 (const_string "mfcrf")
12865 (const_string "mfcr")))
12866 (set_attr "length" "8")])
12868 ;; Same as above, but get the GT bit.
12869 (define_insn "move_from_CR_gt_bit"
12870 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12871 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_GT))]
12872 "TARGET_HARD_FLOAT && !TARGET_FPRS"
12873 "mfcr %0\;{rlinm|rlwinm} %0,%0,%D1,31,31"
12874 [(set_attr "type" "mfcr")
12875 (set_attr "length" "8")])
12877 ;; Same as above, but get the OV/ORDERED bit.
12878 (define_insn "move_from_CR_ov_bit"
12879 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12880 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_OV))]
12882 "mfcr %0\;{rlinm|rlwinm} %0,%0,%t1,1"
12883 [(set_attr "type" "mfcr")
12884 (set_attr "length" "8")])
12887 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12888 (match_operator:DI 1 "scc_comparison_operator"
12889 [(match_operand 2 "cc_reg_operand" "y")
12892 "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1"
12893 [(set (attr "type")
12894 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
12895 (const_string "mfcrf")
12897 (const_string "mfcr")))
12898 (set_attr "length" "8")])
12901 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12902 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
12903 [(match_operand 2 "cc_reg_operand" "y,y")
12906 (set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
12907 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
12910 mfcr %3%Q2\;{rlinm.|rlwinm.} %3,%3,%J1,1
12912 [(set_attr "type" "delayed_compare")
12913 (set_attr "length" "8,16")])
12916 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12917 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
12918 [(match_operand 2 "cc_reg_operand" "")
12921 (set (match_operand:SI 3 "gpc_reg_operand" "")
12922 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
12923 "TARGET_32BIT && reload_completed"
12924 [(set (match_dup 3)
12925 (match_op_dup 1 [(match_dup 2) (const_int 0)]))
12927 (compare:CC (match_dup 3)
12932 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12933 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
12934 [(match_operand 2 "cc_reg_operand" "y")
12936 (match_operand:SI 3 "const_int_operand" "n")))]
12940 int is_bit = ccr_bit (operands[1], 1);
12941 int put_bit = 31 - (INTVAL (operands[3]) & 31);
12944 if (is_bit >= put_bit)
12945 count = is_bit - put_bit;
12947 count = 32 - (put_bit - is_bit);
12949 operands[4] = GEN_INT (count);
12950 operands[5] = GEN_INT (put_bit);
12952 return \"mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%4,%5,%5\";
12954 [(set (attr "type")
12955 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
12956 (const_string "mfcrf")
12958 (const_string "mfcr")))
12959 (set_attr "length" "8")])
12962 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12964 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
12965 [(match_operand 2 "cc_reg_operand" "y,y")
12967 (match_operand:SI 3 "const_int_operand" "n,n"))
12969 (set (match_operand:SI 4 "gpc_reg_operand" "=r,r")
12970 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
12975 int is_bit = ccr_bit (operands[1], 1);
12976 int put_bit = 31 - (INTVAL (operands[3]) & 31);
12979 /* Force split for non-cc0 compare. */
12980 if (which_alternative == 1)
12983 if (is_bit >= put_bit)
12984 count = is_bit - put_bit;
12986 count = 32 - (put_bit - is_bit);
12988 operands[5] = GEN_INT (count);
12989 operands[6] = GEN_INT (put_bit);
12991 return \"mfcr %4%Q2\;{rlinm.|rlwinm.} %4,%4,%5,%6,%6\";
12993 [(set_attr "type" "delayed_compare")
12994 (set_attr "length" "8,16")])
12997 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
12999 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
13000 [(match_operand 2 "cc_reg_operand" "")
13002 (match_operand:SI 3 "const_int_operand" ""))
13004 (set (match_operand:SI 4 "gpc_reg_operand" "")
13005 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
13008 [(set (match_dup 4)
13009 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
13012 (compare:CC (match_dup 4)
13016 ;; There is a 3 cycle delay between consecutive mfcr instructions
13017 ;; so it is useful to combine 2 scc instructions to use only one mfcr.
13020 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13021 (match_operator:SI 1 "scc_comparison_operator"
13022 [(match_operand 2 "cc_reg_operand" "y")
13024 (set (match_operand:SI 3 "gpc_reg_operand" "=r")
13025 (match_operator:SI 4 "scc_comparison_operator"
13026 [(match_operand 5 "cc_reg_operand" "y")
13028 "REGNO (operands[2]) != REGNO (operands[5])"
13029 "mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
13030 [(set_attr "type" "mfcr")
13031 (set_attr "length" "12")])
13034 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13035 (match_operator:DI 1 "scc_comparison_operator"
13036 [(match_operand 2 "cc_reg_operand" "y")
13038 (set (match_operand:DI 3 "gpc_reg_operand" "=r")
13039 (match_operator:DI 4 "scc_comparison_operator"
13040 [(match_operand 5 "cc_reg_operand" "y")
13042 "TARGET_POWERPC64 && REGNO (operands[2]) != REGNO (operands[5])"
13043 "mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
13044 [(set_attr "type" "mfcr")
13045 (set_attr "length" "12")])
13047 ;; There are some scc insns that can be done directly, without a compare.
13048 ;; These are faster because they don't involve the communications between
13049 ;; the FXU and branch units. In fact, we will be replacing all of the
13050 ;; integer scc insns here or in the portable methods in emit_store_flag.
13052 ;; Also support (neg (scc ..)) since that construct is used to replace
13053 ;; branches, (plus (scc ..) ..) since that construct is common and
13054 ;; takes no more insns than scc, and (and (neg (scc ..)) ..) in the
13055 ;; cases where it is no more expensive than (neg (scc ..)).
13057 ;; Have reload force a constant into a register for the simple insns that
13058 ;; otherwise won't accept constants. We do this because it is faster than
13059 ;; the cmp/mfcr sequence we would otherwise generate.
13061 (define_mode_attr scc_eq_op2 [(SI "rKLI")
13064 (define_insn_and_split "*eq<mode>"
13065 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
13066 (eq:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
13067 (match_operand:GPR 2 "scc_eq_operand" "<scc_eq_op2>")))]
13071 [(set (match_dup 0)
13072 (clz:GPR (match_dup 3)))
13074 (lshiftrt:GPR (match_dup 0) (match_dup 4)))]
13076 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
13078 /* Use output operand as intermediate. */
13079 operands[3] = operands[0];
13081 if (logical_operand (operands[2], <MODE>mode))
13082 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13083 gen_rtx_XOR (<MODE>mode,
13084 operands[1], operands[2])));
13086 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13087 gen_rtx_PLUS (<MODE>mode, operands[1],
13088 negate_rtx (<MODE>mode,
13092 operands[3] = operands[1];
13094 operands[4] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
13097 (define_insn_and_split "*eq<mode>_compare"
13098 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
13100 (eq:P (match_operand:P 1 "gpc_reg_operand" "=r")
13101 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))
13103 (set (match_operand:P 0 "gpc_reg_operand" "=r")
13104 (eq:P (match_dup 1) (match_dup 2)))]
13105 "!TARGET_POWER && optimize_size"
13107 "!TARGET_POWER && optimize_size"
13108 [(set (match_dup 0)
13109 (clz:P (match_dup 4)))
13110 (parallel [(set (match_dup 3)
13111 (compare:CC (lshiftrt:P (match_dup 0) (match_dup 5))
13114 (lshiftrt:P (match_dup 0) (match_dup 5)))])]
13116 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
13118 /* Use output operand as intermediate. */
13119 operands[4] = operands[0];
13121 if (logical_operand (operands[2], <MODE>mode))
13122 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
13123 gen_rtx_XOR (<MODE>mode,
13124 operands[1], operands[2])));
13126 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
13127 gen_rtx_PLUS (<MODE>mode, operands[1],
13128 negate_rtx (<MODE>mode,
13132 operands[4] = operands[1];
13134 operands[5] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
13137 (define_insn "*eqsi_power"
13138 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
13139 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
13140 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I")))
13141 (clobber (match_scratch:SI 3 "=r,&r,r,r,r"))]
13144 xor %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
13145 {sfi|subfic} %3,%1,0\;{ae|adde} %0,%3,%1
13146 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
13147 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
13148 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0"
13149 [(set_attr "type" "three,two,three,three,three")
13150 (set_attr "length" "12,8,12,12,12")])
13152 ;; We have insns of the form shown by the first define_insn below. If
13153 ;; there is something inside the comparison operation, we must split it.
13155 [(set (match_operand:SI 0 "gpc_reg_operand" "")
13156 (plus:SI (match_operator 1 "comparison_operator"
13157 [(match_operand:SI 2 "" "")
13158 (match_operand:SI 3
13159 "reg_or_cint_operand" "")])
13160 (match_operand:SI 4 "gpc_reg_operand" "")))
13161 (clobber (match_operand:SI 5 "register_operand" ""))]
13162 "! gpc_reg_operand (operands[2], SImode)"
13163 [(set (match_dup 5) (match_dup 2))
13164 (set (match_dup 2) (plus:SI (match_op_dup 1 [(match_dup 2) (match_dup 3)])
13167 (define_insn "*plus_eqsi"
13168 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r")
13169 (plus:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
13170 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I"))
13171 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r")))]
13174 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
13175 {sfi|subfic} %0,%1,0\;{aze|addze} %0,%3
13176 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
13177 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
13178 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
13179 [(set_attr "type" "three,two,three,three,three")
13180 (set_attr "length" "12,8,12,12,12")])
13182 (define_insn "*compare_plus_eqsi"
13183 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
13186 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
13187 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
13188 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
13190 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r"))]
13191 "TARGET_32BIT && optimize_size"
13193 xor %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
13194 {sfi|subfic} %4,%1,0\;{aze.|addze.} %4,%3
13195 {xoril|xori} %4,%1,%b2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
13196 {xoriu|xoris} %4,%1,%u2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
13197 {sfi|subfic} %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
13203 [(set_attr "type" "compare")
13204 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
13207 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13210 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
13211 (match_operand:SI 2 "scc_eq_operand" ""))
13212 (match_operand:SI 3 "gpc_reg_operand" ""))
13214 (clobber (match_scratch:SI 4 ""))]
13215 "TARGET_32BIT && optimize_size && reload_completed"
13216 [(set (match_dup 4)
13217 (plus:SI (eq:SI (match_dup 1)
13221 (compare:CC (match_dup 4)
13225 (define_insn "*plus_eqsi_compare"
13226 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
13229 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
13230 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
13231 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
13233 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r")
13234 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13235 "TARGET_32BIT && optimize_size"
13237 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
13238 {sfi|subfic} %0,%1,0\;{aze.|addze.} %0,%3
13239 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
13240 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
13241 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
13247 [(set_attr "type" "compare")
13248 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
13251 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13254 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
13255 (match_operand:SI 2 "scc_eq_operand" ""))
13256 (match_operand:SI 3 "gpc_reg_operand" ""))
13258 (set (match_operand:SI 0 "gpc_reg_operand" "")
13259 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13260 "TARGET_32BIT && optimize_size && reload_completed"
13261 [(set (match_dup 0)
13262 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13264 (compare:CC (match_dup 0)
13268 (define_insn "*neg_eq0<mode>"
13269 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13270 (neg:P (eq:P (match_operand:P 1 "gpc_reg_operand" "r")
13273 "{ai|addic} %0,%1,-1\;{sfe|subfe} %0,%0,%0"
13274 [(set_attr "type" "two")
13275 (set_attr "length" "8")])
13277 (define_insn_and_split "*neg_eq<mode>"
13278 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13279 (neg:P (eq:P (match_operand:P 1 "gpc_reg_operand" "%r")
13280 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))))]
13284 [(set (match_dup 0) (neg:P (eq:P (match_dup 3) (const_int 0))))]
13286 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
13288 /* Use output operand as intermediate. */
13289 operands[3] = operands[0];
13291 if (logical_operand (operands[2], <MODE>mode))
13292 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13293 gen_rtx_XOR (<MODE>mode,
13294 operands[1], operands[2])));
13296 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13297 gen_rtx_PLUS (<MODE>mode, operands[1],
13298 negate_rtx (<MODE>mode,
13302 operands[3] = operands[1];
13305 ;; Simplify (ne X (const_int 0)) on the PowerPC. No need to on the Power,
13306 ;; since it nabs/sr is just as fast.
13307 (define_insn "*ne0si"
13308 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
13309 (lshiftrt:SI (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
13311 (clobber (match_scratch:SI 2 "=&r"))]
13312 "! TARGET_POWER && TARGET_32BIT && !TARGET_ISEL"
13313 "{ai|addic} %2,%1,-1\;{sfe|subfe} %0,%2,%1"
13314 [(set_attr "type" "two")
13315 (set_attr "length" "8")])
13317 (define_insn "*ne0di"
13318 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13319 (lshiftrt:DI (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
13321 (clobber (match_scratch:DI 2 "=&r"))]
13323 "addic %2,%1,-1\;subfe %0,%2,%1"
13324 [(set_attr "type" "two")
13325 (set_attr "length" "8")])
13327 ;; This is what (plus (ne X (const_int 0)) Y) looks like.
13328 (define_insn "*plus_ne0si"
13329 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13330 (plus:SI (lshiftrt:SI
13331 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
13333 (match_operand:SI 2 "gpc_reg_operand" "r")))
13334 (clobber (match_scratch:SI 3 "=&r"))]
13336 "{ai|addic} %3,%1,-1\;{aze|addze} %0,%2"
13337 [(set_attr "type" "two")
13338 (set_attr "length" "8")])
13340 (define_insn "*plus_ne0di"
13341 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13342 (plus:DI (lshiftrt:DI
13343 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
13345 (match_operand:DI 2 "gpc_reg_operand" "r")))
13346 (clobber (match_scratch:DI 3 "=&r"))]
13348 "addic %3,%1,-1\;addze %0,%2"
13349 [(set_attr "type" "two")
13350 (set_attr "length" "8")])
13352 (define_insn "*compare_plus_ne0si"
13353 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13355 (plus:SI (lshiftrt:SI
13356 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
13358 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
13360 (clobber (match_scratch:SI 3 "=&r,&r"))
13361 (clobber (match_scratch:SI 4 "=X,&r"))]
13364 {ai|addic} %3,%1,-1\;{aze.|addze.} %3,%2
13366 [(set_attr "type" "compare")
13367 (set_attr "length" "8,12")])
13370 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13372 (plus:SI (lshiftrt:SI
13373 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
13375 (match_operand:SI 2 "gpc_reg_operand" ""))
13377 (clobber (match_scratch:SI 3 ""))
13378 (clobber (match_scratch:SI 4 ""))]
13379 "TARGET_32BIT && reload_completed"
13380 [(parallel [(set (match_dup 3)
13381 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1)))
13384 (clobber (match_dup 4))])
13386 (compare:CC (match_dup 3)
13390 (define_insn "*compare_plus_ne0di"
13391 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13393 (plus:DI (lshiftrt:DI
13394 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
13396 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
13398 (clobber (match_scratch:DI 3 "=&r,&r"))]
13401 addic %3,%1,-1\;addze. %3,%2
13403 [(set_attr "type" "compare")
13404 (set_attr "length" "8,12")])
13407 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
13409 (plus:DI (lshiftrt:DI
13410 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
13412 (match_operand:DI 2 "gpc_reg_operand" ""))
13414 (clobber (match_scratch:DI 3 ""))]
13415 "TARGET_64BIT && reload_completed"
13416 [(set (match_dup 3)
13417 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1)))
13421 (compare:CC (match_dup 3)
13425 (define_insn "*plus_ne0si_compare"
13426 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13428 (plus:SI (lshiftrt:SI
13429 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
13431 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
13433 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13434 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
13436 (clobber (match_scratch:SI 3 "=&r,&r"))]
13439 {ai|addic} %3,%1,-1\;{aze.|addze.} %0,%2
13441 [(set_attr "type" "compare")
13442 (set_attr "length" "8,12")])
13445 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13447 (plus:SI (lshiftrt:SI
13448 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
13450 (match_operand:SI 2 "gpc_reg_operand" ""))
13452 (set (match_operand:SI 0 "gpc_reg_operand" "")
13453 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
13455 (clobber (match_scratch:SI 3 ""))]
13456 "TARGET_32BIT && reload_completed"
13457 [(parallel [(set (match_dup 0)
13458 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
13460 (clobber (match_dup 3))])
13462 (compare:CC (match_dup 0)
13466 (define_insn "*plus_ne0di_compare"
13467 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13469 (plus:DI (lshiftrt:DI
13470 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
13472 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
13474 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
13475 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
13477 (clobber (match_scratch:DI 3 "=&r,&r"))]
13480 addic %3,%1,-1\;addze. %0,%2
13482 [(set_attr "type" "compare")
13483 (set_attr "length" "8,12")])
13486 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
13488 (plus:DI (lshiftrt:DI
13489 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
13491 (match_operand:DI 2 "gpc_reg_operand" ""))
13493 (set (match_operand:DI 0 "gpc_reg_operand" "")
13494 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
13496 (clobber (match_scratch:DI 3 ""))]
13497 "TARGET_64BIT && reload_completed"
13498 [(parallel [(set (match_dup 0)
13499 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
13501 (clobber (match_dup 3))])
13503 (compare:CC (match_dup 0)
13508 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13509 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13510 (match_operand:SI 2 "reg_or_short_operand" "r,O")))
13511 (clobber (match_scratch:SI 3 "=r,X"))]
13514 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3
13515 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri|srwi} %0,%0,31"
13516 [(set_attr "length" "12")])
13519 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13521 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13522 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
13524 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
13525 (le:SI (match_dup 1) (match_dup 2)))
13526 (clobber (match_scratch:SI 3 "=r,X,r,X"))]
13529 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
13530 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri.|srwi.} %0,%0,31
13533 [(set_attr "type" "compare,delayed_compare,compare,delayed_compare")
13534 (set_attr "length" "12,12,16,16")])
13537 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13539 (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
13540 (match_operand:SI 2 "reg_or_short_operand" ""))
13542 (set (match_operand:SI 0 "gpc_reg_operand" "")
13543 (le:SI (match_dup 1) (match_dup 2)))
13544 (clobber (match_scratch:SI 3 ""))]
13545 "TARGET_POWER && reload_completed"
13546 [(parallel [(set (match_dup 0)
13547 (le:SI (match_dup 1) (match_dup 2)))
13548 (clobber (match_dup 3))])
13550 (compare:CC (match_dup 0)
13555 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13556 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13557 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
13558 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
13561 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
13562 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze|addze} %0,%3"
13563 [(set_attr "length" "12")])
13566 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13568 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13569 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
13570 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13572 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
13575 doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
13576 {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze.|addze.} %4,%3
13579 [(set_attr "type" "compare")
13580 (set_attr "length" "12,12,16,16")])
13583 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13585 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
13586 (match_operand:SI 2 "reg_or_short_operand" ""))
13587 (match_operand:SI 3 "gpc_reg_operand" ""))
13589 (clobber (match_scratch:SI 4 ""))]
13590 "TARGET_POWER && reload_completed"
13591 [(set (match_dup 4)
13592 (plus:SI (le:SI (match_dup 1) (match_dup 2))
13595 (compare:CC (match_dup 4)
13600 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13602 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13603 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
13604 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13606 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13607 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13610 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
13611 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze.|addze.} %0,%3
13614 [(set_attr "type" "compare")
13615 (set_attr "length" "12,12,16,16")])
13618 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13620 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
13621 (match_operand:SI 2 "reg_or_short_operand" ""))
13622 (match_operand:SI 3 "gpc_reg_operand" ""))
13624 (set (match_operand:SI 0 "gpc_reg_operand" "")
13625 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13626 "TARGET_POWER && reload_completed"
13627 [(set (match_dup 0)
13628 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13630 (compare:CC (match_dup 0)
13635 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13636 (neg:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13637 (match_operand:SI 2 "reg_or_short_operand" "r,O"))))]
13640 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
13641 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{srai|srawi} %0,%0,31"
13642 [(set_attr "length" "12")])
13644 (define_insn "*leu<mode>"
13645 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13646 (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
13647 (match_operand:P 2 "reg_or_short_operand" "rI")))]
13649 "{sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
13650 [(set_attr "type" "three")
13651 (set_attr "length" "12")])
13653 (define_insn "*leu<mode>_compare"
13654 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13656 (leu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13657 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
13659 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13660 (leu:P (match_dup 1) (match_dup 2)))]
13663 {sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
13665 [(set_attr "type" "compare")
13666 (set_attr "length" "12,16")])
13669 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13671 (leu:P (match_operand:P 1 "gpc_reg_operand" "")
13672 (match_operand:P 2 "reg_or_short_operand" ""))
13674 (set (match_operand:P 0 "gpc_reg_operand" "")
13675 (leu:P (match_dup 1) (match_dup 2)))]
13677 [(set (match_dup 0)
13678 (leu:P (match_dup 1) (match_dup 2)))
13680 (compare:CC (match_dup 0)
13684 (define_insn "*plus_leu<mode>"
13685 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
13686 (plus:P (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
13687 (match_operand:P 2 "reg_or_short_operand" "rI"))
13688 (match_operand:P 3 "gpc_reg_operand" "r")))]
13690 "{sf%I2|subf%I2c} %0,%1,%2\;{aze|addze} %0,%3"
13691 [(set_attr "type" "two")
13692 (set_attr "length" "8")])
13695 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13697 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13698 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13699 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13701 (clobber (match_scratch:SI 4 "=&r,&r"))]
13704 {sf%I2|subf%I2c} %4,%1,%2\;{aze.|addze.} %4,%3
13706 [(set_attr "type" "compare")
13707 (set_attr "length" "8,12")])
13710 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13712 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13713 (match_operand:SI 2 "reg_or_short_operand" ""))
13714 (match_operand:SI 3 "gpc_reg_operand" ""))
13716 (clobber (match_scratch:SI 4 ""))]
13717 "TARGET_32BIT && reload_completed"
13718 [(set (match_dup 4)
13719 (plus:SI (leu:SI (match_dup 1) (match_dup 2))
13722 (compare:CC (match_dup 4)
13727 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13729 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13730 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13731 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13733 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13734 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13737 {sf%I2|subf%I2c} %0,%1,%2\;{aze.|addze.} %0,%3
13739 [(set_attr "type" "compare")
13740 (set_attr "length" "8,12")])
13743 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13745 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13746 (match_operand:SI 2 "reg_or_short_operand" ""))
13747 (match_operand:SI 3 "gpc_reg_operand" ""))
13749 (set (match_operand:SI 0 "gpc_reg_operand" "")
13750 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13751 "TARGET_32BIT && reload_completed"
13752 [(set (match_dup 0)
13753 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13755 (compare:CC (match_dup 0)
13759 (define_insn "*neg_leu<mode>"
13760 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13761 (neg:P (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
13762 (match_operand:P 2 "reg_or_short_operand" "rI"))))]
13764 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0"
13765 [(set_attr "type" "three")
13766 (set_attr "length" "12")])
13768 (define_insn "*and_neg_leu<mode>"
13769 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
13771 (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
13772 (match_operand:P 2 "reg_or_short_operand" "rI")))
13773 (match_operand:P 3 "gpc_reg_operand" "r")))]
13775 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
13776 [(set_attr "type" "three")
13777 (set_attr "length" "12")])
13780 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13783 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13784 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
13785 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13787 (clobber (match_scratch:SI 4 "=&r,&r"))]
13790 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
13792 [(set_attr "type" "compare")
13793 (set_attr "length" "12,16")])
13796 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13799 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13800 (match_operand:SI 2 "reg_or_short_operand" "")))
13801 (match_operand:SI 3 "gpc_reg_operand" ""))
13803 (clobber (match_scratch:SI 4 ""))]
13804 "TARGET_32BIT && reload_completed"
13805 [(set (match_dup 4)
13806 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
13809 (compare:CC (match_dup 4)
13814 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13817 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13818 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
13819 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13821 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13822 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13825 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
13827 [(set_attr "type" "compare")
13828 (set_attr "length" "12,16")])
13831 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13834 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13835 (match_operand:SI 2 "reg_or_short_operand" "")))
13836 (match_operand:SI 3 "gpc_reg_operand" ""))
13838 (set (match_operand:SI 0 "gpc_reg_operand" "")
13839 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13840 "TARGET_32BIT && reload_completed"
13841 [(set (match_dup 0)
13842 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
13845 (compare:CC (match_dup 0)
13850 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13851 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13852 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
13854 "doz%I2 %0,%1,%2\;nabs %0,%0\;{sri|srwi} %0,%0,31"
13855 [(set_attr "length" "12")])
13858 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13860 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13861 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13863 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13864 (lt:SI (match_dup 1) (match_dup 2)))]
13867 doz%I2 %0,%1,%2\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
13869 [(set_attr "type" "delayed_compare")
13870 (set_attr "length" "12,16")])
13873 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13875 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13876 (match_operand:SI 2 "reg_or_short_operand" ""))
13878 (set (match_operand:SI 0 "gpc_reg_operand" "")
13879 (lt:SI (match_dup 1) (match_dup 2)))]
13880 "TARGET_POWER && reload_completed"
13881 [(set (match_dup 0)
13882 (lt:SI (match_dup 1) (match_dup 2)))
13884 (compare:CC (match_dup 0)
13889 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
13890 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13891 (match_operand:SI 2 "reg_or_short_operand" "rI"))
13892 (match_operand:SI 3 "gpc_reg_operand" "r")))]
13894 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
13895 [(set_attr "length" "12")])
13898 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13900 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13901 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13902 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13904 (clobber (match_scratch:SI 4 "=&r,&r"))]
13907 doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
13909 [(set_attr "type" "compare")
13910 (set_attr "length" "12,16")])
13913 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13915 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13916 (match_operand:SI 2 "reg_or_short_operand" ""))
13917 (match_operand:SI 3 "gpc_reg_operand" ""))
13919 (clobber (match_scratch:SI 4 ""))]
13920 "TARGET_POWER && reload_completed"
13921 [(set (match_dup 4)
13922 (plus:SI (lt:SI (match_dup 1) (match_dup 2))
13925 (compare:CC (match_dup 4)
13930 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13932 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13933 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13934 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13936 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13937 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13940 doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
13942 [(set_attr "type" "compare")
13943 (set_attr "length" "12,16")])
13946 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13948 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13949 (match_operand:SI 2 "reg_or_short_operand" ""))
13950 (match_operand:SI 3 "gpc_reg_operand" ""))
13952 (set (match_operand:SI 0 "gpc_reg_operand" "")
13953 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13954 "TARGET_POWER && reload_completed"
13955 [(set (match_dup 0)
13956 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13958 (compare:CC (match_dup 0)
13963 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13964 (neg:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13965 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
13967 "doz%I2 %0,%1,%2\;nabs %0,%0\;{srai|srawi} %0,%0,31"
13968 [(set_attr "length" "12")])
13970 (define_insn_and_split "*ltu<mode>"
13971 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13972 (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13973 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))]
13977 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
13978 (set (match_dup 0) (neg:P (match_dup 0)))]
13981 (define_insn_and_split "*ltu<mode>_compare"
13982 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
13984 (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
13985 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
13987 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
13988 (ltu:P (match_dup 1) (match_dup 2)))]
13992 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
13993 (parallel [(set (match_dup 3)
13994 (compare:CC (neg:P (match_dup 0)) (const_int 0)))
13995 (set (match_dup 0) (neg:P (match_dup 0)))])]
13998 (define_insn_and_split "*plus_ltu<mode>"
13999 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,r")
14000 (plus:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14001 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))
14002 (match_operand:P 3 "reg_or_short_operand" "rI,rI")))]
14005 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
14006 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
14007 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))]
14010 (define_insn_and_split "*plus_ltu<mode>_compare"
14011 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
14013 (plus:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
14014 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
14015 (match_operand:P 3 "gpc_reg_operand" "r,r,r,r"))
14017 (set (match_operand:P 0 "gpc_reg_operand" "=&r,&r,&r,&r")
14018 (plus:P (ltu:P (match_dup 1) (match_dup 2)) (match_dup 3)))]
14021 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
14022 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
14023 (parallel [(set (match_dup 4)
14024 (compare:CC (minus:P (match_dup 3) (match_dup 0))
14026 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))])]
14029 (define_insn "*neg_ltu<mode>"
14030 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
14031 (neg:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14032 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))))]
14035 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0
14036 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0"
14037 [(set_attr "type" "two")
14038 (set_attr "length" "8")])
14041 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14042 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14043 (match_operand:SI 2 "reg_or_short_operand" "rI")))
14044 (clobber (match_scratch:SI 3 "=r"))]
14046 "doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3"
14047 [(set_attr "length" "12")])
14050 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
14052 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14053 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14055 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
14056 (ge:SI (match_dup 1) (match_dup 2)))
14057 (clobber (match_scratch:SI 3 "=r,r"))]
14060 doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
14062 [(set_attr "type" "compare")
14063 (set_attr "length" "12,16")])
14066 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14068 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
14069 (match_operand:SI 2 "reg_or_short_operand" ""))
14071 (set (match_operand:SI 0 "gpc_reg_operand" "")
14072 (ge:SI (match_dup 1) (match_dup 2)))
14073 (clobber (match_scratch:SI 3 ""))]
14074 "TARGET_POWER && reload_completed"
14075 [(parallel [(set (match_dup 0)
14076 (ge:SI (match_dup 1) (match_dup 2)))
14077 (clobber (match_dup 3))])
14079 (compare:CC (match_dup 0)
14084 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
14085 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14086 (match_operand:SI 2 "reg_or_short_operand" "rI"))
14087 (match_operand:SI 3 "gpc_reg_operand" "r")))]
14089 "doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
14090 [(set_attr "length" "12")])
14093 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
14095 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14096 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14097 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14099 (clobber (match_scratch:SI 4 "=&r,&r"))]
14102 doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
14104 [(set_attr "type" "compare")
14105 (set_attr "length" "12,16")])
14108 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14110 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
14111 (match_operand:SI 2 "reg_or_short_operand" ""))
14112 (match_operand:SI 3 "gpc_reg_operand" ""))
14114 (clobber (match_scratch:SI 4 ""))]
14115 "TARGET_POWER && reload_completed"
14116 [(set (match_dup 4)
14117 (plus:SI (ge:SI (match_dup 1) (match_dup 2))
14120 (compare:CC (match_dup 4)
14125 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
14127 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14128 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14129 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14131 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
14132 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14135 doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
14137 [(set_attr "type" "compare")
14138 (set_attr "length" "12,16")])
14141 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14143 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
14144 (match_operand:SI 2 "reg_or_short_operand" ""))
14145 (match_operand:SI 3 "gpc_reg_operand" ""))
14147 (set (match_operand:SI 0 "gpc_reg_operand" "")
14148 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14149 "TARGET_POWER && reload_completed"
14150 [(set (match_dup 0)
14151 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
14153 (compare:CC (match_dup 0)
14158 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14159 (neg:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14160 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
14162 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
14163 [(set_attr "length" "12")])
14165 (define_insn "*geu<mode>"
14166 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
14167 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14168 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))]
14171 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0
14172 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
14173 [(set_attr "type" "three")
14174 (set_attr "length" "12")])
14176 (define_insn "*geu<mode>_compare"
14177 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
14179 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
14180 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
14182 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
14183 (geu:P (match_dup 1) (match_dup 2)))]
14186 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
14187 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
14190 [(set_attr "type" "compare")
14191 (set_attr "length" "12,12,16,16")])
14194 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
14196 (geu:P (match_operand:P 1 "gpc_reg_operand" "")
14197 (match_operand:P 2 "reg_or_neg_short_operand" ""))
14199 (set (match_operand:P 0 "gpc_reg_operand" "")
14200 (geu:P (match_dup 1) (match_dup 2)))]
14202 [(set (match_dup 0)
14203 (geu:P (match_dup 1) (match_dup 2)))
14205 (compare:CC (match_dup 0)
14209 (define_insn "*plus_geu<mode>"
14210 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,&r")
14211 (plus:P (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14212 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))
14213 (match_operand:P 3 "gpc_reg_operand" "r,r")))]
14216 {sf|subfc} %0,%2,%1\;{aze|addze} %0,%3
14217 {ai|addic} %0,%1,%n2\;{aze|addze} %0,%3"
14218 [(set_attr "type" "two")
14219 (set_attr "length" "8")])
14222 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
14224 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14225 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
14226 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
14228 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
14231 {sf|subfc} %4,%2,%1\;{aze.|addze.} %4,%3
14232 {ai|addic} %4,%1,%n2\;{aze.|addze.} %4,%3
14235 [(set_attr "type" "compare")
14236 (set_attr "length" "8,8,12,12")])
14239 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14241 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14242 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
14243 (match_operand:SI 3 "gpc_reg_operand" ""))
14245 (clobber (match_scratch:SI 4 ""))]
14246 "TARGET_32BIT && reload_completed"
14247 [(set (match_dup 4)
14248 (plus:SI (geu:SI (match_dup 1) (match_dup 2))
14251 (compare:CC (match_dup 4)
14256 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
14258 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14259 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
14260 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
14262 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
14263 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14266 {sf|subfc} %0,%2,%1\;{aze.|addze.} %0,%3
14267 {ai|addic} %0,%1,%n2\;{aze.|addze.} %0,%3
14270 [(set_attr "type" "compare")
14271 (set_attr "length" "8,8,12,12")])
14274 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14276 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14277 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
14278 (match_operand:SI 3 "gpc_reg_operand" ""))
14280 (set (match_operand:SI 0 "gpc_reg_operand" "")
14281 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14282 "TARGET_32BIT && reload_completed"
14283 [(set (match_dup 0)
14284 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
14286 (compare:CC (match_dup 0)
14290 (define_insn "*neg_geu<mode>"
14291 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
14292 (neg:P (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14293 (match_operand:P 2 "reg_or_short_operand" "r,I"))))]
14296 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0
14297 {sfi|subfic} %0,%1,-1\;{a%I2|add%I2c} %0,%0,%2\;{sfe|subfe} %0,%0,%0"
14298 [(set_attr "type" "three")
14299 (set_attr "length" "12")])
14301 (define_insn "*and_neg_geu<mode>"
14302 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,&r")
14304 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14305 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))
14306 (match_operand:P 3 "gpc_reg_operand" "r,r")))]
14309 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0
14310 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
14311 [(set_attr "type" "three")
14312 (set_attr "length" "12")])
14315 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
14318 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14319 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
14320 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
14322 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
14325 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
14326 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
14329 [(set_attr "type" "compare")
14330 (set_attr "length" "12,12,16,16")])
14333 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14336 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14337 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
14338 (match_operand:SI 3 "gpc_reg_operand" ""))
14340 (clobber (match_scratch:SI 4 ""))]
14341 "TARGET_32BIT && reload_completed"
14342 [(set (match_dup 4)
14343 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2)))
14346 (compare:CC (match_dup 4)
14351 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
14354 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14355 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
14356 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
14358 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
14359 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
14362 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
14363 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
14366 [(set_attr "type" "compare")
14367 (set_attr "length" "12,12,16,16")])
14370 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14373 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14374 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
14375 (match_operand:SI 3 "gpc_reg_operand" ""))
14377 (set (match_operand:SI 0 "gpc_reg_operand" "")
14378 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
14379 "TARGET_32BIT && reload_completed"
14380 [(set (match_dup 0)
14381 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
14383 (compare:CC (match_dup 0)
14388 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14389 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14390 (match_operand:SI 2 "reg_or_short_operand" "r")))]
14392 "doz %0,%2,%1\;nabs %0,%0\;{sri|srwi} %0,%0,31"
14393 [(set_attr "length" "12")])
14396 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
14398 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14399 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
14401 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
14402 (gt:SI (match_dup 1) (match_dup 2)))]
14405 doz %0,%2,%1\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
14407 [(set_attr "type" "delayed_compare")
14408 (set_attr "length" "12,16")])
14411 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
14413 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14414 (match_operand:SI 2 "reg_or_short_operand" ""))
14416 (set (match_operand:SI 0 "gpc_reg_operand" "")
14417 (gt:SI (match_dup 1) (match_dup 2)))]
14418 "TARGET_POWER && reload_completed"
14419 [(set (match_dup 0)
14420 (gt:SI (match_dup 1) (match_dup 2)))
14422 (compare:CC (match_dup 0)
14426 (define_insn "*plus_gt0<mode>"
14427 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
14428 (plus:P (gt:P (match_operand:P 1 "gpc_reg_operand" "r")
14430 (match_operand:P 2 "gpc_reg_operand" "r")))]
14432 "{a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze|addze} %0,%2"
14433 [(set_attr "type" "three")
14434 (set_attr "length" "12")])
14437 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
14439 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14441 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
14443 (clobber (match_scratch:SI 3 "=&r,&r"))]
14446 {a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze.|addze.} %3,%2
14448 [(set_attr "type" "compare")
14449 (set_attr "length" "12,16")])
14452 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14454 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14456 (match_operand:SI 2 "gpc_reg_operand" ""))
14458 (clobber (match_scratch:SI 3 ""))]
14459 "TARGET_32BIT && reload_completed"
14460 [(set (match_dup 3)
14461 (plus:SI (gt:SI (match_dup 1) (const_int 0))
14464 (compare:CC (match_dup 3)
14469 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
14471 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
14473 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
14475 (clobber (match_scratch:DI 3 "=&r,&r"))]
14478 addc %3,%1,%1\;subfe %3,%1,%3\;addze. %3,%2
14480 [(set_attr "type" "compare")
14481 (set_attr "length" "12,16")])
14484 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
14486 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
14488 (match_operand:DI 2 "gpc_reg_operand" ""))
14490 (clobber (match_scratch:DI 3 ""))]
14491 "TARGET_64BIT && reload_completed"
14492 [(set (match_dup 3)
14493 (plus:DI (gt:DI (match_dup 1) (const_int 0))
14496 (compare:CC (match_dup 3)
14501 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
14503 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14505 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
14507 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
14508 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
14511 {a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze.|addze.} %0,%2
14513 [(set_attr "type" "compare")
14514 (set_attr "length" "12,16")])
14517 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
14519 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14521 (match_operand:SI 2 "gpc_reg_operand" ""))
14523 (set (match_operand:SI 0 "gpc_reg_operand" "")
14524 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
14525 "TARGET_32BIT && reload_completed"
14526 [(set (match_dup 0)
14527 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))
14529 (compare:CC (match_dup 0)
14534 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
14536 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
14538 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
14540 (set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
14541 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
14544 addc %0,%1,%1\;subfe %0,%1,%0\;addze. %0,%2
14546 [(set_attr "type" "compare")
14547 (set_attr "length" "12,16")])
14550 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
14552 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
14554 (match_operand:DI 2 "gpc_reg_operand" ""))
14556 (set (match_operand:DI 0 "gpc_reg_operand" "")
14557 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
14558 "TARGET_64BIT && reload_completed"
14559 [(set (match_dup 0)
14560 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))
14562 (compare:CC (match_dup 0)
14567 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
14568 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14569 (match_operand:SI 2 "reg_or_short_operand" "r"))
14570 (match_operand:SI 3 "gpc_reg_operand" "r")))]
14572 "doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
14573 [(set_attr "length" "12")])
14576 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
14578 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14579 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
14580 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14582 (clobber (match_scratch:SI 4 "=&r,&r"))]
14585 doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
14587 [(set_attr "type" "compare")
14588 (set_attr "length" "12,16")])
14591 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14593 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14594 (match_operand:SI 2 "reg_or_short_operand" ""))
14595 (match_operand:SI 3 "gpc_reg_operand" ""))
14597 (clobber (match_scratch:SI 4 ""))]
14598 "TARGET_POWER && reload_completed"
14599 [(set (match_dup 4)
14600 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
14602 (compare:CC (match_dup 4)
14607 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
14609 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14610 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
14611 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14613 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
14614 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14617 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
14619 [(set_attr "type" "compare")
14620 (set_attr "length" "12,16")])
14623 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14625 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14626 (match_operand:SI 2 "reg_or_short_operand" ""))
14627 (match_operand:SI 3 "gpc_reg_operand" ""))
14629 (set (match_operand:SI 0 "gpc_reg_operand" "")
14630 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14631 "TARGET_POWER && reload_completed"
14632 [(set (match_dup 0)
14633 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
14635 (compare:CC (match_dup 0)
14640 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14641 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14642 (match_operand:SI 2 "reg_or_short_operand" "r"))))]
14644 "doz %0,%2,%1\;nabs %0,%0\;{srai|srawi} %0,%0,31"
14645 [(set_attr "length" "12")])
14647 (define_insn_and_split "*gtu<mode>"
14648 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
14649 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
14650 (match_operand:P 2 "reg_or_short_operand" "rI")))]
14654 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
14655 (set (match_dup 0) (neg:P (match_dup 0)))]
14658 (define_insn_and_split "*gtu<mode>_compare"
14659 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
14661 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14662 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
14664 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
14665 (gtu:P (match_dup 1) (match_dup 2)))]
14669 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
14670 (parallel [(set (match_dup 3)
14671 (compare:CC (neg:P (match_dup 0)) (const_int 0)))
14672 (set (match_dup 0) (neg:P (match_dup 0)))])]
14675 (define_insn_and_split "*plus_gtu<mode>"
14676 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
14677 (plus:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
14678 (match_operand:P 2 "reg_or_short_operand" "rI"))
14679 (match_operand:P 3 "reg_or_short_operand" "rI")))]
14682 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
14683 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
14684 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))]
14687 (define_insn_and_split "*plus_gtu<mode>_compare"
14688 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
14690 (plus:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
14691 (match_operand:P 2 "reg_or_short_operand" "I,r,I,r"))
14692 (match_operand:P 3 "gpc_reg_operand" "r,r,r,r"))
14694 (set (match_operand:P 0 "gpc_reg_operand" "=&r,&r,&r,&r")
14695 (plus:P (gtu:P (match_dup 1) (match_dup 2)) (match_dup 3)))]
14698 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
14699 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
14700 (parallel [(set (match_dup 4)
14701 (compare:CC (minus:P (match_dup 3) (match_dup 0))
14703 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))])]
14706 (define_insn "*neg_gtu<mode>"
14707 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
14708 (neg:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
14709 (match_operand:P 2 "reg_or_short_operand" "rI"))))]
14711 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0"
14712 [(set_attr "type" "two")
14713 (set_attr "length" "8")])
14716 ;; Define both directions of branch and return. If we need a reload
14717 ;; register, we'd rather use CR0 since it is much easier to copy a
14718 ;; register CC value to there.
14722 (if_then_else (match_operator 1 "branch_comparison_operator"
14724 "cc_reg_operand" "y")
14726 (label_ref (match_operand 0 "" ""))
14731 return output_cbranch (operands[1], \"%l0\", 0, insn);
14733 [(set_attr "type" "branch")])
14737 (if_then_else (match_operator 0 "branch_comparison_operator"
14739 "cc_reg_operand" "y")
14746 return output_cbranch (operands[0], NULL, 0, insn);
14748 [(set_attr "type" "jmpreg")
14749 (set_attr "length" "4")])
14753 (if_then_else (match_operator 1 "branch_comparison_operator"
14755 "cc_reg_operand" "y")
14758 (label_ref (match_operand 0 "" ""))))]
14762 return output_cbranch (operands[1], \"%l0\", 1, insn);
14764 [(set_attr "type" "branch")])
14768 (if_then_else (match_operator 0 "branch_comparison_operator"
14770 "cc_reg_operand" "y")
14777 return output_cbranch (operands[0], NULL, 1, insn);
14779 [(set_attr "type" "jmpreg")
14780 (set_attr "length" "4")])
14782 ;; Logic on condition register values.
14784 ; This pattern matches things like
14785 ; (set (reg:CCEQ 68) (compare:CCEQ (ior:SI (gt:SI (reg:CCFP 68) (const_int 0))
14786 ; (eq:SI (reg:CCFP 68) (const_int 0)))
14788 ; which are generated by the branch logic.
14789 ; Prefer destructive operations where BT = BB (for crXX BT,BA,BB)
14791 (define_insn "*cceq_ior_compare"
14792 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
14793 (compare:CCEQ (match_operator:SI 1 "boolean_operator"
14794 [(match_operator:SI 2
14795 "branch_positive_comparison_operator"
14797 "cc_reg_operand" "y,y")
14799 (match_operator:SI 4
14800 "branch_positive_comparison_operator"
14802 "cc_reg_operand" "0,y")
14806 "cr%q1 %E0,%j2,%j4"
14807 [(set_attr "type" "cr_logical,delayed_cr")])
14809 ; Why is the constant -1 here, but 1 in the previous pattern?
14810 ; Because ~1 has all but the low bit set.
14812 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
14813 (compare:CCEQ (match_operator:SI 1 "boolean_or_operator"
14814 [(not:SI (match_operator:SI 2
14815 "branch_positive_comparison_operator"
14817 "cc_reg_operand" "y,y")
14819 (match_operator:SI 4
14820 "branch_positive_comparison_operator"
14822 "cc_reg_operand" "0,y")
14826 "cr%q1 %E0,%j2,%j4"
14827 [(set_attr "type" "cr_logical,delayed_cr")])
14829 (define_insn "*cceq_rev_compare"
14830 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
14831 (compare:CCEQ (match_operator:SI 1
14832 "branch_positive_comparison_operator"
14834 "cc_reg_operand" "0,y")
14838 "{crnor %E0,%j1,%j1|crnot %E0,%j1}"
14839 [(set_attr "type" "cr_logical,delayed_cr")])
14841 ;; If we are comparing the result of two comparisons, this can be done
14842 ;; using creqv or crxor.
14844 (define_insn_and_split ""
14845 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
14846 (compare:CCEQ (match_operator 1 "branch_comparison_operator"
14847 [(match_operand 2 "cc_reg_operand" "y")
14849 (match_operator 3 "branch_comparison_operator"
14850 [(match_operand 4 "cc_reg_operand" "y")
14855 [(set (match_dup 0) (compare:CCEQ (xor:SI (match_dup 1) (match_dup 3))
14859 int positive_1, positive_2;
14861 positive_1 = branch_positive_comparison_operator (operands[1],
14862 GET_MODE (operands[1]));
14863 positive_2 = branch_positive_comparison_operator (operands[3],
14864 GET_MODE (operands[3]));
14867 operands[1] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[2]),
14868 GET_CODE (operands[1])),
14870 operands[2], const0_rtx);
14871 else if (GET_MODE (operands[1]) != SImode)
14872 operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]), SImode,
14873 operands[2], const0_rtx);
14876 operands[3] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[4]),
14877 GET_CODE (operands[3])),
14879 operands[4], const0_rtx);
14880 else if (GET_MODE (operands[3]) != SImode)
14881 operands[3] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
14882 operands[4], const0_rtx);
14884 if (positive_1 == positive_2)
14886 operands[1] = gen_rtx_NOT (SImode, operands[1]);
14887 operands[5] = constm1_rtx;
14891 operands[5] = const1_rtx;
14895 ;; Unconditional branch and return.
14897 (define_insn "jump"
14899 (label_ref (match_operand 0 "" "")))]
14902 [(set_attr "type" "branch")])
14904 (define_insn "return"
14908 [(set_attr "type" "jmpreg")])
14910 (define_expand "indirect_jump"
14911 [(set (pc) (match_operand 0 "register_operand" ""))])
14913 (define_insn "*indirect_jump<mode>"
14914 [(set (pc) (match_operand:P 0 "register_operand" "c,*l"))]
14919 [(set_attr "type" "jmpreg")])
14921 ;; Table jump for switch statements:
14922 (define_expand "tablejump"
14923 [(use (match_operand 0 "" ""))
14924 (use (label_ref (match_operand 1 "" "")))]
14929 emit_jump_insn (gen_tablejumpsi (operands[0], operands[1]));
14931 emit_jump_insn (gen_tablejumpdi (operands[0], operands[1]));
14935 (define_expand "tablejumpsi"
14936 [(set (match_dup 3)
14937 (plus:SI (match_operand:SI 0 "" "")
14939 (parallel [(set (pc) (match_dup 3))
14940 (use (label_ref (match_operand 1 "" "")))])]
14943 { operands[0] = force_reg (SImode, operands[0]);
14944 operands[2] = force_reg (SImode, gen_rtx_LABEL_REF (SImode, operands[1]));
14945 operands[3] = gen_reg_rtx (SImode);
14948 (define_expand "tablejumpdi"
14949 [(set (match_dup 4)
14950 (sign_extend:DI (match_operand:SI 0 "lwa_operand" "")))
14952 (plus:DI (match_dup 4)
14954 (parallel [(set (pc) (match_dup 3))
14955 (use (label_ref (match_operand 1 "" "")))])]
14958 { operands[2] = force_reg (DImode, gen_rtx_LABEL_REF (DImode, operands[1]));
14959 operands[3] = gen_reg_rtx (DImode);
14960 operands[4] = gen_reg_rtx (DImode);
14963 (define_insn "*tablejump<mode>_internal1"
14965 (match_operand:P 0 "register_operand" "c,*l"))
14966 (use (label_ref (match_operand 1 "" "")))]
14971 [(set_attr "type" "jmpreg")])
14976 "{cror 0,0,0|nop}")
14978 ;; Define the subtract-one-and-jump insns, starting with the template
14979 ;; so loop.c knows what to generate.
14981 (define_expand "doloop_end"
14982 [(use (match_operand 0 "" "")) ; loop pseudo
14983 (use (match_operand 1 "" "")) ; iterations; zero if unknown
14984 (use (match_operand 2 "" "")) ; max iterations
14985 (use (match_operand 3 "" "")) ; loop level
14986 (use (match_operand 4 "" ""))] ; label
14990 /* Only use this on innermost loops. */
14991 if (INTVAL (operands[3]) > 1)
14995 if (GET_MODE (operands[0]) != DImode)
14997 emit_jump_insn (gen_ctrdi (operands[0], operands[4]));
15001 if (GET_MODE (operands[0]) != SImode)
15003 emit_jump_insn (gen_ctrsi (operands[0], operands[4]));
15008 (define_expand "ctr<mode>"
15009 [(parallel [(set (pc)
15010 (if_then_else (ne (match_operand:P 0 "register_operand" "")
15012 (label_ref (match_operand 1 "" ""))
15015 (plus:P (match_dup 0)
15017 (clobber (match_scratch:CC 2 ""))
15018 (clobber (match_scratch:P 3 ""))])]
15022 ;; We need to be able to do this for any operand, including MEM, or we
15023 ;; will cause reload to blow up since we don't allow output reloads on
15025 ;; For the length attribute to be calculated correctly, the
15026 ;; label MUST be operand 0.
15028 (define_insn "*ctr<mode>_internal1"
15030 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
15032 (label_ref (match_operand 0 "" ""))
15034 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
15035 (plus:P (match_dup 1)
15037 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
15038 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
15042 if (which_alternative != 0)
15044 else if (get_attr_length (insn) == 4)
15045 return \"{bdn|bdnz} %l0\";
15047 return \"bdz $+8\;b %l0\";
15049 [(set_attr "type" "branch")
15050 (set_attr "length" "*,12,16,16")])
15052 (define_insn "*ctr<mode>_internal2"
15054 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
15057 (label_ref (match_operand 0 "" ""))))
15058 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
15059 (plus:P (match_dup 1)
15061 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
15062 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
15066 if (which_alternative != 0)
15068 else if (get_attr_length (insn) == 4)
15069 return \"bdz %l0\";
15071 return \"{bdn|bdnz} $+8\;b %l0\";
15073 [(set_attr "type" "branch")
15074 (set_attr "length" "*,12,16,16")])
15076 ;; Similar but use EQ
15078 (define_insn "*ctr<mode>_internal5"
15080 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
15082 (label_ref (match_operand 0 "" ""))
15084 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
15085 (plus:P (match_dup 1)
15087 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
15088 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
15092 if (which_alternative != 0)
15094 else if (get_attr_length (insn) == 4)
15095 return \"bdz %l0\";
15097 return \"{bdn|bdnz} $+8\;b %l0\";
15099 [(set_attr "type" "branch")
15100 (set_attr "length" "*,12,16,16")])
15102 (define_insn "*ctr<mode>_internal6"
15104 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
15107 (label_ref (match_operand 0 "" ""))))
15108 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
15109 (plus:P (match_dup 1)
15111 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
15112 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
15116 if (which_alternative != 0)
15118 else if (get_attr_length (insn) == 4)
15119 return \"{bdn|bdnz} %l0\";
15121 return \"bdz $+8\;b %l0\";
15123 [(set_attr "type" "branch")
15124 (set_attr "length" "*,12,16,16")])
15126 ;; Now the splitters if we could not allocate the CTR register
15130 (if_then_else (match_operator 2 "comparison_operator"
15131 [(match_operand:P 1 "gpc_reg_operand" "")
15133 (match_operand 5 "" "")
15134 (match_operand 6 "" "")))
15135 (set (match_operand:P 0 "gpc_reg_operand" "")
15136 (plus:P (match_dup 1) (const_int -1)))
15137 (clobber (match_scratch:CC 3 ""))
15138 (clobber (match_scratch:P 4 ""))]
15140 [(parallel [(set (match_dup 3)
15141 (compare:CC (plus:P (match_dup 1)
15145 (plus:P (match_dup 1)
15147 (set (pc) (if_then_else (match_dup 7)
15151 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
15152 operands[3], const0_rtx); }")
15156 (if_then_else (match_operator 2 "comparison_operator"
15157 [(match_operand:P 1 "gpc_reg_operand" "")
15159 (match_operand 5 "" "")
15160 (match_operand 6 "" "")))
15161 (set (match_operand:P 0 "nonimmediate_operand" "")
15162 (plus:P (match_dup 1) (const_int -1)))
15163 (clobber (match_scratch:CC 3 ""))
15164 (clobber (match_scratch:P 4 ""))]
15165 "reload_completed && ! gpc_reg_operand (operands[0], SImode)"
15166 [(parallel [(set (match_dup 3)
15167 (compare:CC (plus:P (match_dup 1)
15171 (plus:P (match_dup 1)
15175 (set (pc) (if_then_else (match_dup 7)
15179 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
15180 operands[3], const0_rtx); }")
15182 (define_insn "trap"
15183 [(trap_if (const_int 1) (const_int 0))]
15186 [(set_attr "type" "trap")])
15188 (define_expand "ctrap<mode>4"
15189 [(trap_if (match_operator 0 "ordered_comparison_operator"
15190 [(match_operand:GPR 1 "register_operand")
15191 (match_operand:GPR 2 "reg_or_short_operand")])
15192 (match_operand 3 "zero_constant" ""))]
15197 [(trap_if (match_operator 0 "ordered_comparison_operator"
15198 [(match_operand:GPR 1 "register_operand" "r")
15199 (match_operand:GPR 2 "reg_or_short_operand" "rI")])
15202 "{t|t<wd>}%V0%I2 %1,%2"
15203 [(set_attr "type" "trap")])
15205 ;; Insns related to generating the function prologue and epilogue.
15207 (define_expand "prologue"
15208 [(use (const_int 0))]
15209 "TARGET_SCHED_PROLOG"
15212 rs6000_emit_prologue ();
15216 (define_insn "*movesi_from_cr_one"
15217 [(match_parallel 0 "mfcr_operation"
15218 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
15219 (unspec:SI [(match_operand:CC 2 "cc_reg_operand" "y")
15220 (match_operand 3 "immediate_operand" "n")]
15221 UNSPEC_MOVESI_FROM_CR))])]
15227 for (i = 0; i < XVECLEN (operands[0], 0); i++)
15229 mask = INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
15230 operands[4] = GEN_INT (mask);
15231 output_asm_insn (\"mfcr %1,%4\", operands);
15235 [(set_attr "type" "mfcrf")])
15237 (define_insn "movesi_from_cr"
15238 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
15239 (unspec:SI [(reg:CC CR0_REGNO) (reg:CC CR1_REGNO)
15240 (reg:CC CR2_REGNO) (reg:CC CR3_REGNO)
15241 (reg:CC CR4_REGNO) (reg:CC CR5_REGNO)
15242 (reg:CC CR6_REGNO) (reg:CC CR7_REGNO)]
15243 UNSPEC_MOVESI_FROM_CR))]
15246 [(set_attr "type" "mfcr")])
15248 (define_insn "*stmw"
15249 [(match_parallel 0 "stmw_operation"
15250 [(set (match_operand:SI 1 "memory_operand" "=m")
15251 (match_operand:SI 2 "gpc_reg_operand" "r"))])]
15254 [(set_attr "type" "store_ux")])
15256 (define_insn "*save_gpregs_<mode>"
15257 [(match_parallel 0 "any_parallel_operand"
15258 [(clobber (reg:P 65))
15259 (use (match_operand:P 1 "symbol_ref_operand" "s"))
15260 (use (match_operand:P 2 "gpc_reg_operand" "r"))
15261 (set (match_operand:P 3 "memory_operand" "=m")
15262 (match_operand:P 4 "gpc_reg_operand" "r"))])]
15265 [(set_attr "type" "branch")
15266 (set_attr "length" "4")])
15268 (define_insn "*save_fpregs_<mode>"
15269 [(match_parallel 0 "any_parallel_operand"
15270 [(clobber (reg:P 65))
15271 (use (match_operand:P 1 "symbol_ref_operand" "s"))
15272 (use (match_operand:P 2 "gpc_reg_operand" "r"))
15273 (set (match_operand:DF 3 "memory_operand" "=m")
15274 (match_operand:DF 4 "gpc_reg_operand" "d"))])]
15277 [(set_attr "type" "branch")
15278 (set_attr "length" "4")])
15280 ; These are to explain that changes to the stack pointer should
15281 ; not be moved over stores to stack memory.
15282 (define_insn "stack_tie"
15283 [(set (match_operand:BLK 0 "memory_operand" "+m")
15284 (unspec:BLK [(match_dup 0)] UNSPEC_TIE))]
15287 [(set_attr "length" "0")])
15290 (define_expand "epilogue"
15291 [(use (const_int 0))]
15292 "TARGET_SCHED_PROLOG"
15295 rs6000_emit_epilogue (FALSE);
15299 ; On some processors, doing the mtcrf one CC register at a time is
15300 ; faster (like on the 604e). On others, doing them all at once is
15301 ; faster; for instance, on the 601 and 750.
15303 (define_expand "movsi_to_cr_one"
15304 [(set (match_operand:CC 0 "cc_reg_operand" "")
15305 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "")
15306 (match_dup 2)] UNSPEC_MOVESI_TO_CR))]
15308 "operands[2] = GEN_INT (1 << (75 - REGNO (operands[0])));")
15310 (define_insn "*movsi_to_cr"
15311 [(match_parallel 0 "mtcrf_operation"
15312 [(set (match_operand:CC 1 "cc_reg_operand" "=y")
15313 (unspec:CC [(match_operand:SI 2 "gpc_reg_operand" "r")
15314 (match_operand 3 "immediate_operand" "n")]
15315 UNSPEC_MOVESI_TO_CR))])]
15321 for (i = 0; i < XVECLEN (operands[0], 0); i++)
15322 mask |= INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
15323 operands[4] = GEN_INT (mask);
15324 return \"mtcrf %4,%2\";
15326 [(set_attr "type" "mtcr")])
15328 (define_insn "*mtcrfsi"
15329 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
15330 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
15331 (match_operand 2 "immediate_operand" "n")]
15332 UNSPEC_MOVESI_TO_CR))]
15333 "GET_CODE (operands[0]) == REG
15334 && CR_REGNO_P (REGNO (operands[0]))
15335 && GET_CODE (operands[2]) == CONST_INT
15336 && INTVAL (operands[2]) == 1 << (75 - REGNO (operands[0]))"
15338 [(set_attr "type" "mtcr")])
15340 ; The load-multiple instructions have similar properties.
15341 ; Note that "load_multiple" is a name known to the machine-independent
15342 ; code that actually corresponds to the PowerPC load-string.
15344 (define_insn "*lmw"
15345 [(match_parallel 0 "lmw_operation"
15346 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
15347 (match_operand:SI 2 "memory_operand" "m"))])]
15350 [(set_attr "type" "load_ux")
15351 (set_attr "cell_micro" "always")])
15353 (define_insn "*return_internal_<mode>"
15355 (use (match_operand:P 0 "register_operand" "lc"))]
15358 [(set_attr "type" "jmpreg")])
15360 ; FIXME: This would probably be somewhat simpler if the Cygnus sibcall
15361 ; stuff was in GCC. Oh, and "any_parallel_operand" is a bit flexible...
15363 (define_insn "*restore_gpregs_<mode>"
15364 [(match_parallel 0 "any_parallel_operand"
15365 [(clobber (match_operand:P 1 "register_operand" "=l"))
15366 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15367 (use (match_operand:P 3 "gpc_reg_operand" "r"))
15368 (set (match_operand:P 4 "gpc_reg_operand" "=r")
15369 (match_operand:P 5 "memory_operand" "m"))])]
15372 [(set_attr "type" "branch")
15373 (set_attr "length" "4")])
15375 (define_insn "*return_and_restore_gpregs_<mode>"
15376 [(match_parallel 0 "any_parallel_operand"
15378 (clobber (match_operand:P 1 "register_operand" "=l"))
15379 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15380 (use (match_operand:P 3 "gpc_reg_operand" "r"))
15381 (set (match_operand:P 4 "gpc_reg_operand" "=r")
15382 (match_operand:P 5 "memory_operand" "m"))])]
15385 [(set_attr "type" "branch")
15386 (set_attr "length" "4")])
15388 (define_insn "*return_and_restore_fpregs_<mode>"
15389 [(match_parallel 0 "any_parallel_operand"
15391 (clobber (match_operand:P 1 "register_operand" "=l"))
15392 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15393 (use (match_operand:P 3 "gpc_reg_operand" "r"))
15394 (set (match_operand:DF 4 "gpc_reg_operand" "=d")
15395 (match_operand:DF 5 "memory_operand" "m"))])]
15398 [(set_attr "type" "branch")
15399 (set_attr "length" "4")])
15401 (define_insn "*return_and_restore_fpregs_aix_<mode>"
15402 [(match_parallel 0 "any_parallel_operand"
15404 (use (match_operand:P 1 "register_operand" "l"))
15405 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15406 (use (match_operand:P 3 "gpc_reg_operand" "r"))
15407 (set (match_operand:DF 4 "gpc_reg_operand" "=d")
15408 (match_operand:DF 5 "memory_operand" "m"))])]
15411 [(set_attr "type" "branch")
15412 (set_attr "length" "4")])
15414 ; This is used in compiling the unwind routines.
15415 (define_expand "eh_return"
15416 [(use (match_operand 0 "general_operand" ""))]
15421 emit_insn (gen_eh_set_lr_si (operands[0]));
15423 emit_insn (gen_eh_set_lr_di (operands[0]));
15427 ; We can't expand this before we know where the link register is stored.
15428 (define_insn "eh_set_lr_<mode>"
15429 [(unspec_volatile [(match_operand:P 0 "register_operand" "r")]
15431 (clobber (match_scratch:P 1 "=&b"))]
15436 [(unspec_volatile [(match_operand 0 "register_operand" "")] UNSPECV_EH_RR)
15437 (clobber (match_scratch 1 ""))]
15442 rs6000_emit_eh_reg_restore (operands[0], operands[1]);
15446 (define_insn "prefetch"
15447 [(prefetch (match_operand 0 "indexed_or_indirect_address" "a")
15448 (match_operand:SI 1 "const_int_operand" "n")
15449 (match_operand:SI 2 "const_int_operand" "n"))]
15453 if (GET_CODE (operands[0]) == REG)
15454 return INTVAL (operands[1]) ? \"dcbtst 0,%0\" : \"dcbt 0,%0\";
15455 return INTVAL (operands[1]) ? \"dcbtst %a0\" : \"dcbt %a0\";
15457 [(set_attr "type" "load")])
15459 (define_insn "bpermd_<mode>"
15460 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
15461 (unspec:P [(match_operand:P 1 "gpc_reg_operand" "r")
15462 (match_operand:P 2 "gpc_reg_operand" "r")] UNSPEC_BPERM))]
15465 [(set_attr "type" "integer")])
15469 (include "sync.md")
15470 (include "vector.md")
15472 (include "altivec.md")
15475 (include "paired.md")