1 ;; Machine description for IBM RISC System 6000 (POWER) for GNU C compiler
2 ;; Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
3 ;; 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
4 ;; Free Software Foundation, Inc.
5 ;; Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
7 ;; This file is part of GCC.
9 ;; GCC is free software; you can redistribute it and/or modify it
10 ;; under the terms of the GNU General Public License as published
11 ;; by the Free Software Foundation; either version 3, or (at your
12 ;; option) any later version.
14 ;; GCC is distributed in the hope that it will be useful, but WITHOUT
15 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
17 ;; License for more details.
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GCC; see the file COPYING3. If not see
21 ;; <http://www.gnu.org/licenses/>.
23 ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
43 (FIRST_ALTIVEC_REGNO 77)
44 (LAST_ALTIVEC_REGNO 108)
57 [(UNSPEC_FRSP 0) ; frsp for POWER machines
58 (UNSPEC_TIE 5) ; tie stack contents and stack pointer
59 (UNSPEC_TOCPTR 6) ; address of a word pointing to the TOC
60 (UNSPEC_TOC 7) ; address of the TOC (more-or-less)
62 (UNSPEC_MV_CR_OV 9) ; move_from_CR_ov_bit
68 (UNSPEC_LD_MPIC 15) ; load_macho_picbase
69 (UNSPEC_MPIC_CORRECT 16) ; macho_correct_pic
72 (UNSPEC_MOVESI_FROM_CR 19)
73 (UNSPEC_MOVESI_TO_CR 20)
75 (UNSPEC_TLSDTPRELHA 22)
76 (UNSPEC_TLSDTPRELLO 23)
77 (UNSPEC_TLSGOTDTPREL 24)
79 (UNSPEC_TLSTPRELHA 26)
80 (UNSPEC_TLSTPRELLO 27)
81 (UNSPEC_TLSGOTTPREL 28)
83 (UNSPEC_FIX_TRUNC_TF 30) ; fadd, rounding towards zero
84 (UNSPEC_MV_CR_GT 31) ; move_from_CR_gt_bit
100 (UNSPEC_DLMZB_STRLEN 47)
103 (UNSPEC_MACHOPIC_OFFSET 50)
107 ;; UNSPEC_VOLATILE usage
112 (UNSPECV_LL 1) ; load-locked
113 (UNSPECV_SC 2) ; store-conditional
114 (UNSPECV_EH_RR 9) ; eh_reg_restore
117 ;; Define an insn type attribute. This is used in function unit delay
119 (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"
120 (const_string "integer"))
122 ;; Define floating point instruction sub-types for use with Xfpu.md
123 (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"))
125 ;; Length (in bytes).
126 ; '(pc)' in the following doesn't include the instruction itself; it is
127 ; calculated as if the instruction had zero size.
128 (define_attr "length" ""
129 (if_then_else (eq_attr "type" "branch")
130 (if_then_else (and (ge (minus (match_dup 0) (pc))
132 (lt (minus (match_dup 0) (pc))
138 ;; Processor type -- this attribute must exactly match the processor_type
139 ;; enumeration in rs6000.h.
141 (define_attr "cpu" "rios1,rios2,rs64a,mpccore,ppc403,ppc405,ppc440,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630,ppc750,ppc7400,ppc7450,ppc8540,ppce300c2,ppce300c3,ppce500mc,power4,power5,power6,cell"
142 (const (symbol_ref "rs6000_cpu_attr")))
145 ;; If this instruction is microcoded on the CELL processor
146 ; The default for load extended, the recorded instructions and rotate/shifts by a variable is always microcoded
147 (define_attr "cell_micro" "not,conditional,always"
148 (if_then_else (eq_attr "type" "compare,delayed_compare,imul_compare,lmul_compare,load_ext,load_ext_ux,var_shift_rotate,var_delayed_compare")
149 (const_string "always")
150 (const_string "not")))
152 (automata_option "ndfa")
165 (include "e300c2c3.md")
166 (include "e500mc.md")
167 (include "power4.md")
168 (include "power5.md")
169 (include "power6.md")
173 (include "predicates.md")
174 (include "constraints.md")
176 (include "darwin.md")
181 ; This mode iterator allows :GPR to be used to indicate the allowable size
182 ; of whole values in GPRs.
183 (define_mode_iterator GPR [SI (DI "TARGET_POWERPC64")])
185 ; Any supported integer mode.
186 (define_mode_iterator INT [QI HI SI DI TI])
188 ; Any supported integer mode that fits in one register.
189 (define_mode_iterator INT1 [QI HI SI (DI "TARGET_POWERPC64")])
191 ; extend modes for DImode
192 (define_mode_iterator QHSI [QI HI SI])
194 ; SImode or DImode, even if DImode doesn't fit in GPRs.
195 (define_mode_iterator SDI [SI DI])
197 ; The size of a pointer. Also, the size of the value that a record-condition
198 ; (one with a '.') will compare.
199 (define_mode_iterator P [(SI "TARGET_32BIT") (DI "TARGET_64BIT")])
201 ; Any hardware-supported floating-point mode
202 (define_mode_iterator FP [
203 (SF "TARGET_HARD_FLOAT
204 && ((TARGET_FPRS && TARGET_SINGLE_FLOAT) || TARGET_E500_SINGLE)")
205 (DF "TARGET_HARD_FLOAT
206 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)")
207 (TF "!TARGET_IEEEQUAD
209 && (TARGET_FPRS || TARGET_E500_DOUBLE)
210 && TARGET_LONG_DOUBLE_128")
214 ; Various instructions that come in SI and DI forms.
215 ; A generic w/d attribute, for things like cmpw/cmpd.
216 (define_mode_attr wd [(QI "b") (HI "h") (SI "w") (DI "d")])
219 (define_mode_attr dbits [(QI "56") (HI "48") (SI "32")])
222 ;; Start with fixed-point load and store insns. Here we put only the more
223 ;; complex forms. Basic data transfer is done later.
225 (define_expand "zero_extend<mode>di2"
226 [(set (match_operand:DI 0 "gpc_reg_operand" "")
227 (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "")))]
231 (define_insn "*zero_extend<mode>di2_internal1"
232 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
233 (zero_extend:DI (match_operand:QHSI 1 "reg_or_mem_operand" "m,r")))]
237 rldicl %0,%1,0,<dbits>"
238 [(set_attr "type" "load,*")])
240 (define_insn "*zero_extend<mode>di2_internal2"
241 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
242 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "r,r"))
244 (clobber (match_scratch:DI 2 "=r,r"))]
247 rldicl. %2,%1,0,<dbits>
249 [(set_attr "type" "compare")
250 (set_attr "length" "4,8")])
253 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
254 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" ""))
256 (clobber (match_scratch:DI 2 ""))]
257 "TARGET_POWERPC64 && reload_completed"
259 (zero_extend:DI (match_dup 1)))
261 (compare:CC (match_dup 2)
265 (define_insn "*zero_extend<mode>di2_internal3"
266 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
267 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "r,r"))
269 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
270 (zero_extend:DI (match_dup 1)))]
273 rldicl. %0,%1,0,<dbits>
275 [(set_attr "type" "compare")
276 (set_attr "length" "4,8")])
279 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
280 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" ""))
282 (set (match_operand:DI 0 "gpc_reg_operand" "")
283 (zero_extend:DI (match_dup 1)))]
284 "TARGET_POWERPC64 && reload_completed"
286 (zero_extend:DI (match_dup 1)))
288 (compare:CC (match_dup 0)
292 (define_insn "extendqidi2"
293 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
294 (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r")))]
297 [(set_attr "type" "exts")])
300 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
301 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
303 (clobber (match_scratch:DI 2 "=r,r"))]
308 [(set_attr "type" "compare")
309 (set_attr "length" "4,8")])
312 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
313 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
315 (clobber (match_scratch:DI 2 ""))]
316 "TARGET_POWERPC64 && reload_completed"
318 (sign_extend:DI (match_dup 1)))
320 (compare:CC (match_dup 2)
325 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
326 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
328 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
329 (sign_extend:DI (match_dup 1)))]
334 [(set_attr "type" "compare")
335 (set_attr "length" "4,8")])
338 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
339 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
341 (set (match_operand:DI 0 "gpc_reg_operand" "")
342 (sign_extend:DI (match_dup 1)))]
343 "TARGET_POWERPC64 && reload_completed"
345 (sign_extend:DI (match_dup 1)))
347 (compare:CC (match_dup 0)
351 (define_expand "extendhidi2"
352 [(set (match_operand:DI 0 "gpc_reg_operand" "")
353 (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "")))]
358 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
359 (sign_extend:DI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
360 "TARGET_POWERPC64 && rs6000_gen_cell_microcode"
364 [(set_attr "type" "load_ext,exts")])
367 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
368 (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r")))]
369 "TARGET_POWERPC64 && !rs6000_gen_cell_microcode"
371 [(set_attr "type" "exts")])
374 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
375 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
377 (clobber (match_scratch:DI 2 "=r,r"))]
382 [(set_attr "type" "compare")
383 (set_attr "length" "4,8")])
386 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
387 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
389 (clobber (match_scratch:DI 2 ""))]
390 "TARGET_POWERPC64 && reload_completed"
392 (sign_extend:DI (match_dup 1)))
394 (compare:CC (match_dup 2)
399 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
400 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
402 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
403 (sign_extend:DI (match_dup 1)))]
408 [(set_attr "type" "compare")
409 (set_attr "length" "4,8")])
412 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
413 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
415 (set (match_operand:DI 0 "gpc_reg_operand" "")
416 (sign_extend:DI (match_dup 1)))]
417 "TARGET_POWERPC64 && reload_completed"
419 (sign_extend:DI (match_dup 1)))
421 (compare:CC (match_dup 0)
425 (define_expand "extendsidi2"
426 [(set (match_operand:DI 0 "gpc_reg_operand" "")
427 (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")))]
432 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
433 (sign_extend:DI (match_operand:SI 1 "lwa_operand" "m,r")))]
434 "TARGET_POWERPC64 && rs6000_gen_cell_microcode"
438 [(set_attr "type" "load_ext,exts")])
441 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
442 (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r")))]
443 "TARGET_POWERPC64 && !rs6000_gen_cell_microcode"
445 [(set_attr "type" "exts")])
448 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
449 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
451 (clobber (match_scratch:DI 2 "=r,r"))]
456 [(set_attr "type" "compare")
457 (set_attr "length" "4,8")])
460 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
461 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
463 (clobber (match_scratch:DI 2 ""))]
464 "TARGET_POWERPC64 && reload_completed"
466 (sign_extend:DI (match_dup 1)))
468 (compare:CC (match_dup 2)
473 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
474 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
476 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
477 (sign_extend:DI (match_dup 1)))]
482 [(set_attr "type" "compare")
483 (set_attr "length" "4,8")])
486 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
487 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
489 (set (match_operand:DI 0 "gpc_reg_operand" "")
490 (sign_extend:DI (match_dup 1)))]
491 "TARGET_POWERPC64 && reload_completed"
493 (sign_extend:DI (match_dup 1)))
495 (compare:CC (match_dup 0)
499 (define_expand "zero_extendqisi2"
500 [(set (match_operand:SI 0 "gpc_reg_operand" "")
501 (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "")))]
506 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
507 (zero_extend:SI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
511 {rlinm|rlwinm} %0,%1,0,0xff"
512 [(set_attr "type" "load,*")])
515 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
516 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
518 (clobber (match_scratch:SI 2 "=r,r"))]
521 {andil.|andi.} %2,%1,0xff
523 [(set_attr "type" "compare")
524 (set_attr "length" "4,8")])
527 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
528 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
530 (clobber (match_scratch:SI 2 ""))]
533 (zero_extend:SI (match_dup 1)))
535 (compare:CC (match_dup 2)
540 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
541 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
543 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
544 (zero_extend:SI (match_dup 1)))]
547 {andil.|andi.} %0,%1,0xff
549 [(set_attr "type" "compare")
550 (set_attr "length" "4,8")])
553 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
554 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
556 (set (match_operand:SI 0 "gpc_reg_operand" "")
557 (zero_extend:SI (match_dup 1)))]
560 (zero_extend:SI (match_dup 1)))
562 (compare:CC (match_dup 0)
566 (define_expand "extendqisi2"
567 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
568 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
573 emit_insn (gen_extendqisi2_ppc (operands[0], operands[1]));
574 else if (TARGET_POWER)
575 emit_insn (gen_extendqisi2_power (operands[0], operands[1]));
577 emit_insn (gen_extendqisi2_no_power (operands[0], operands[1]));
581 (define_insn "extendqisi2_ppc"
582 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
583 (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r")))]
586 [(set_attr "type" "exts")])
589 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
590 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
592 (clobber (match_scratch:SI 2 "=r,r"))]
597 [(set_attr "type" "compare")
598 (set_attr "length" "4,8")])
601 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
602 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
604 (clobber (match_scratch:SI 2 ""))]
605 "TARGET_POWERPC && reload_completed"
607 (sign_extend:SI (match_dup 1)))
609 (compare:CC (match_dup 2)
614 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
615 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
617 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
618 (sign_extend:SI (match_dup 1)))]
623 [(set_attr "type" "compare")
624 (set_attr "length" "4,8")])
627 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
628 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
630 (set (match_operand:SI 0 "gpc_reg_operand" "")
631 (sign_extend:SI (match_dup 1)))]
632 "TARGET_POWERPC && reload_completed"
634 (sign_extend:SI (match_dup 1)))
636 (compare:CC (match_dup 0)
640 (define_expand "extendqisi2_power"
641 [(parallel [(set (match_dup 2)
642 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
644 (clobber (scratch:SI))])
645 (parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
646 (ashiftrt:SI (match_dup 2)
648 (clobber (scratch:SI))])]
651 { operands[1] = gen_lowpart (SImode, operands[1]);
652 operands[2] = gen_reg_rtx (SImode); }")
654 (define_expand "extendqisi2_no_power"
656 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
658 (set (match_operand:SI 0 "gpc_reg_operand" "")
659 (ashiftrt:SI (match_dup 2)
661 "! TARGET_POWER && ! TARGET_POWERPC"
663 { operands[1] = gen_lowpart (SImode, operands[1]);
664 operands[2] = gen_reg_rtx (SImode); }")
666 (define_expand "zero_extendqihi2"
667 [(set (match_operand:HI 0 "gpc_reg_operand" "")
668 (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "")))]
673 [(set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
674 (zero_extend:HI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
678 {rlinm|rlwinm} %0,%1,0,0xff"
679 [(set_attr "type" "load,*")])
682 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
683 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
685 (clobber (match_scratch:HI 2 "=r,r"))]
688 {andil.|andi.} %2,%1,0xff
690 [(set_attr "type" "compare")
691 (set_attr "length" "4,8")])
694 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
695 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
697 (clobber (match_scratch:HI 2 ""))]
700 (zero_extend:HI (match_dup 1)))
702 (compare:CC (match_dup 2)
707 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
708 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
710 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
711 (zero_extend:HI (match_dup 1)))]
714 {andil.|andi.} %0,%1,0xff
716 [(set_attr "type" "compare")
717 (set_attr "length" "4,8")])
720 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
721 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
723 (set (match_operand:HI 0 "gpc_reg_operand" "")
724 (zero_extend:HI (match_dup 1)))]
727 (zero_extend:HI (match_dup 1)))
729 (compare:CC (match_dup 0)
733 (define_expand "extendqihi2"
734 [(use (match_operand:HI 0 "gpc_reg_operand" ""))
735 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
740 emit_insn (gen_extendqihi2_ppc (operands[0], operands[1]));
741 else if (TARGET_POWER)
742 emit_insn (gen_extendqihi2_power (operands[0], operands[1]));
744 emit_insn (gen_extendqihi2_no_power (operands[0], operands[1]));
748 (define_insn "extendqihi2_ppc"
749 [(set (match_operand:HI 0 "gpc_reg_operand" "=r")
750 (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r")))]
753 [(set_attr "type" "exts")])
756 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
757 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
759 (clobber (match_scratch:HI 2 "=r,r"))]
764 [(set_attr "type" "compare")
765 (set_attr "length" "4,8")])
768 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
769 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
771 (clobber (match_scratch:HI 2 ""))]
772 "TARGET_POWERPC && reload_completed"
774 (sign_extend:HI (match_dup 1)))
776 (compare:CC (match_dup 2)
781 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
782 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
784 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
785 (sign_extend:HI (match_dup 1)))]
790 [(set_attr "type" "compare")
791 (set_attr "length" "4,8")])
794 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
795 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
797 (set (match_operand:HI 0 "gpc_reg_operand" "")
798 (sign_extend:HI (match_dup 1)))]
799 "TARGET_POWERPC && reload_completed"
801 (sign_extend:HI (match_dup 1)))
803 (compare:CC (match_dup 0)
807 (define_expand "extendqihi2_power"
808 [(parallel [(set (match_dup 2)
809 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
811 (clobber (scratch:SI))])
812 (parallel [(set (match_operand:HI 0 "gpc_reg_operand" "")
813 (ashiftrt:SI (match_dup 2)
815 (clobber (scratch:SI))])]
818 { operands[0] = gen_lowpart (SImode, operands[0]);
819 operands[1] = gen_lowpart (SImode, operands[1]);
820 operands[2] = gen_reg_rtx (SImode); }")
822 (define_expand "extendqihi2_no_power"
824 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
826 (set (match_operand:HI 0 "gpc_reg_operand" "")
827 (ashiftrt:SI (match_dup 2)
829 "! TARGET_POWER && ! TARGET_POWERPC"
831 { operands[0] = gen_lowpart (SImode, operands[0]);
832 operands[1] = gen_lowpart (SImode, operands[1]);
833 operands[2] = gen_reg_rtx (SImode); }")
835 (define_expand "zero_extendhisi2"
836 [(set (match_operand:SI 0 "gpc_reg_operand" "")
837 (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
842 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
843 (zero_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
847 {rlinm|rlwinm} %0,%1,0,0xffff"
848 [(set_attr "type" "load,*")])
851 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
852 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
854 (clobber (match_scratch:SI 2 "=r,r"))]
857 {andil.|andi.} %2,%1,0xffff
859 [(set_attr "type" "compare")
860 (set_attr "length" "4,8")])
863 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
864 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
866 (clobber (match_scratch:SI 2 ""))]
869 (zero_extend:SI (match_dup 1)))
871 (compare:CC (match_dup 2)
876 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
877 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
879 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
880 (zero_extend:SI (match_dup 1)))]
883 {andil.|andi.} %0,%1,0xffff
885 [(set_attr "type" "compare")
886 (set_attr "length" "4,8")])
889 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
890 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
892 (set (match_operand:SI 0 "gpc_reg_operand" "")
893 (zero_extend:SI (match_dup 1)))]
896 (zero_extend:SI (match_dup 1)))
898 (compare:CC (match_dup 0)
902 (define_expand "extendhisi2"
903 [(set (match_operand:SI 0 "gpc_reg_operand" "")
904 (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
909 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
910 (sign_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
911 "rs6000_gen_cell_microcode"
915 [(set_attr "type" "load_ext,exts")])
918 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
919 (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r")))]
920 "!rs6000_gen_cell_microcode"
922 [(set_attr "type" "exts")])
925 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
926 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
928 (clobber (match_scratch:SI 2 "=r,r"))]
933 [(set_attr "type" "compare")
934 (set_attr "length" "4,8")])
937 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
938 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
940 (clobber (match_scratch:SI 2 ""))]
943 (sign_extend:SI (match_dup 1)))
945 (compare:CC (match_dup 2)
950 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
951 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
953 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
954 (sign_extend:SI (match_dup 1)))]
959 [(set_attr "type" "compare")
960 (set_attr "length" "4,8")])
962 ;; IBM 405, 440 and 464 half-word multiplication operations.
964 (define_insn "*macchwc"
965 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
966 (compare:CC (plus:SI (mult:SI (ashiftrt:SI
967 (match_operand:SI 2 "gpc_reg_operand" "r")
970 (match_operand:HI 1 "gpc_reg_operand" "r")))
971 (match_operand:SI 4 "gpc_reg_operand" "0"))
973 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
974 (plus:SI (mult:SI (ashiftrt:SI
982 [(set_attr "type" "imul3")])
984 (define_insn "*macchw"
985 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
986 (plus:SI (mult:SI (ashiftrt:SI
987 (match_operand:SI 2 "gpc_reg_operand" "r")
990 (match_operand:HI 1 "gpc_reg_operand" "r")))
991 (match_operand:SI 3 "gpc_reg_operand" "0")))]
994 [(set_attr "type" "imul3")])
996 (define_insn "*macchwuc"
997 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
998 (compare:CC (plus:SI (mult:SI (lshiftrt:SI
999 (match_operand:SI 2 "gpc_reg_operand" "r")
1002 (match_operand:HI 1 "gpc_reg_operand" "r")))
1003 (match_operand:SI 4 "gpc_reg_operand" "0"))
1005 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1006 (plus:SI (mult:SI (lshiftrt:SI
1013 "macchwu. %0, %1, %2"
1014 [(set_attr "type" "imul3")])
1016 (define_insn "*macchwu"
1017 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1018 (plus:SI (mult:SI (lshiftrt:SI
1019 (match_operand:SI 2 "gpc_reg_operand" "r")
1022 (match_operand:HI 1 "gpc_reg_operand" "r")))
1023 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1025 "macchwu %0, %1, %2"
1026 [(set_attr "type" "imul3")])
1028 (define_insn "*machhwc"
1029 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1030 (compare:CC (plus:SI (mult:SI (ashiftrt:SI
1031 (match_operand:SI 1 "gpc_reg_operand" "%r")
1034 (match_operand:SI 2 "gpc_reg_operand" "r")
1036 (match_operand:SI 4 "gpc_reg_operand" "0"))
1038 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1039 (plus:SI (mult:SI (ashiftrt:SI
1047 "machhw. %0, %1, %2"
1048 [(set_attr "type" "imul3")])
1050 (define_insn "*machhw"
1051 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1052 (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 3 "gpc_reg_operand" "0")))]
1061 [(set_attr "type" "imul3")])
1063 (define_insn "*machhwuc"
1064 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1065 (compare:CC (plus:SI (mult:SI (lshiftrt:SI
1066 (match_operand:SI 1 "gpc_reg_operand" "%r")
1069 (match_operand:SI 2 "gpc_reg_operand" "r")
1071 (match_operand:SI 4 "gpc_reg_operand" "0"))
1073 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1074 (plus:SI (mult:SI (lshiftrt:SI
1082 "machhwu. %0, %1, %2"
1083 [(set_attr "type" "imul3")])
1085 (define_insn "*machhwu"
1086 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1087 (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 3 "gpc_reg_operand" "0")))]
1095 "machhwu %0, %1, %2"
1096 [(set_attr "type" "imul3")])
1098 (define_insn "*maclhwc"
1099 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1100 (compare:CC (plus:SI (mult:SI (sign_extend:SI
1101 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1103 (match_operand:HI 2 "gpc_reg_operand" "r")))
1104 (match_operand:SI 4 "gpc_reg_operand" "0"))
1106 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1107 (plus:SI (mult:SI (sign_extend:SI
1113 "maclhw. %0, %1, %2"
1114 [(set_attr "type" "imul3")])
1116 (define_insn "*maclhw"
1117 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1118 (plus:SI (mult:SI (sign_extend:SI
1119 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1121 (match_operand:HI 2 "gpc_reg_operand" "r")))
1122 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1125 [(set_attr "type" "imul3")])
1127 (define_insn "*maclhwuc"
1128 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1129 (compare:CC (plus:SI (mult:SI (zero_extend:SI
1130 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1132 (match_operand:HI 2 "gpc_reg_operand" "r")))
1133 (match_operand:SI 4 "gpc_reg_operand" "0"))
1135 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1136 (plus:SI (mult:SI (zero_extend:SI
1142 "maclhwu. %0, %1, %2"
1143 [(set_attr "type" "imul3")])
1145 (define_insn "*maclhwu"
1146 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1147 (plus:SI (mult:SI (zero_extend:SI
1148 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1150 (match_operand:HI 2 "gpc_reg_operand" "r")))
1151 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1153 "maclhwu %0, %1, %2"
1154 [(set_attr "type" "imul3")])
1156 (define_insn "*nmacchwc"
1157 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1158 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1159 (mult:SI (ashiftrt:SI
1160 (match_operand:SI 2 "gpc_reg_operand" "r")
1163 (match_operand:HI 1 "gpc_reg_operand" "r"))))
1165 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1166 (minus:SI (match_dup 4)
1167 (mult:SI (ashiftrt:SI
1173 "nmacchw. %0, %1, %2"
1174 [(set_attr "type" "imul3")])
1176 (define_insn "*nmacchw"
1177 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1178 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1179 (mult:SI (ashiftrt:SI
1180 (match_operand:SI 2 "gpc_reg_operand" "r")
1183 (match_operand:HI 1 "gpc_reg_operand" "r")))))]
1185 "nmacchw %0, %1, %2"
1186 [(set_attr "type" "imul3")])
1188 (define_insn "*nmachhwc"
1189 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1190 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1191 (mult:SI (ashiftrt:SI
1192 (match_operand:SI 1 "gpc_reg_operand" "%r")
1195 (match_operand:SI 2 "gpc_reg_operand" "r")
1198 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1199 (minus:SI (match_dup 4)
1200 (mult:SI (ashiftrt:SI
1207 "nmachhw. %0, %1, %2"
1208 [(set_attr "type" "imul3")])
1210 (define_insn "*nmachhw"
1211 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1212 (minus:SI (match_operand:SI 3 "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 "nmachhw %0, %1, %2"
1221 [(set_attr "type" "imul3")])
1223 (define_insn "*nmaclhwc"
1224 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1225 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1226 (mult:SI (sign_extend:SI
1227 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1229 (match_operand:HI 2 "gpc_reg_operand" "r"))))
1231 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1232 (minus:SI (match_dup 4)
1233 (mult:SI (sign_extend:SI
1238 "nmaclhw. %0, %1, %2"
1239 [(set_attr "type" "imul3")])
1241 (define_insn "*nmaclhw"
1242 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1243 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1244 (mult:SI (sign_extend:SI
1245 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1247 (match_operand:HI 2 "gpc_reg_operand" "r")))))]
1249 "nmaclhw %0, %1, %2"
1250 [(set_attr "type" "imul3")])
1252 (define_insn "*mulchwc"
1253 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1254 (compare:CC (mult:SI (ashiftrt:SI
1255 (match_operand:SI 2 "gpc_reg_operand" "r")
1258 (match_operand:HI 1 "gpc_reg_operand" "r")))
1260 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1261 (mult:SI (ashiftrt:SI
1267 "mulchw. %0, %1, %2"
1268 [(set_attr "type" "imul3")])
1270 (define_insn "*mulchw"
1271 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1272 (mult:SI (ashiftrt:SI
1273 (match_operand:SI 2 "gpc_reg_operand" "r")
1276 (match_operand:HI 1 "gpc_reg_operand" "r"))))]
1279 [(set_attr "type" "imul3")])
1281 (define_insn "*mulchwuc"
1282 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1283 (compare:CC (mult:SI (lshiftrt:SI
1284 (match_operand:SI 2 "gpc_reg_operand" "r")
1287 (match_operand:HI 1 "gpc_reg_operand" "r")))
1289 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1290 (mult:SI (lshiftrt:SI
1296 "mulchwu. %0, %1, %2"
1297 [(set_attr "type" "imul3")])
1299 (define_insn "*mulchwu"
1300 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1301 (mult:SI (lshiftrt:SI
1302 (match_operand:SI 2 "gpc_reg_operand" "r")
1305 (match_operand:HI 1 "gpc_reg_operand" "r"))))]
1307 "mulchwu %0, %1, %2"
1308 [(set_attr "type" "imul3")])
1310 (define_insn "*mulhhwc"
1311 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1312 (compare:CC (mult:SI (ashiftrt:SI
1313 (match_operand:SI 1 "gpc_reg_operand" "%r")
1316 (match_operand:SI 2 "gpc_reg_operand" "r")
1319 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1320 (mult:SI (ashiftrt:SI
1327 "mulhhw. %0, %1, %2"
1328 [(set_attr "type" "imul3")])
1330 (define_insn "*mulhhw"
1331 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1332 (mult:SI (ashiftrt:SI
1333 (match_operand:SI 1 "gpc_reg_operand" "%r")
1336 (match_operand:SI 2 "gpc_reg_operand" "r")
1340 [(set_attr "type" "imul3")])
1342 (define_insn "*mulhhwuc"
1343 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1344 (compare:CC (mult:SI (lshiftrt:SI
1345 (match_operand:SI 1 "gpc_reg_operand" "%r")
1348 (match_operand:SI 2 "gpc_reg_operand" "r")
1351 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1352 (mult:SI (lshiftrt:SI
1359 "mulhhwu. %0, %1, %2"
1360 [(set_attr "type" "imul3")])
1362 (define_insn "*mulhhwu"
1363 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1364 (mult:SI (lshiftrt:SI
1365 (match_operand:SI 1 "gpc_reg_operand" "%r")
1368 (match_operand:SI 2 "gpc_reg_operand" "r")
1371 "mulhhwu %0, %1, %2"
1372 [(set_attr "type" "imul3")])
1374 (define_insn "*mullhwc"
1375 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1376 (compare:CC (mult:SI (sign_extend:SI
1377 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1379 (match_operand:HI 2 "gpc_reg_operand" "r")))
1381 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1382 (mult:SI (sign_extend:SI
1387 "mullhw. %0, %1, %2"
1388 [(set_attr "type" "imul3")])
1390 (define_insn "*mullhw"
1391 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1392 (mult:SI (sign_extend:SI
1393 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1395 (match_operand:HI 2 "gpc_reg_operand" "r"))))]
1398 [(set_attr "type" "imul3")])
1400 (define_insn "*mullhwuc"
1401 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1402 (compare:CC (mult:SI (zero_extend:SI
1403 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1405 (match_operand:HI 2 "gpc_reg_operand" "r")))
1407 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1408 (mult:SI (zero_extend:SI
1413 "mullhwu. %0, %1, %2"
1414 [(set_attr "type" "imul3")])
1416 (define_insn "*mullhwu"
1417 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1418 (mult:SI (zero_extend:SI
1419 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1421 (match_operand:HI 2 "gpc_reg_operand" "r"))))]
1423 "mullhwu %0, %1, %2"
1424 [(set_attr "type" "imul3")])
1426 ;; IBM 405, 440 and 464 string-search dlmzb instruction support.
1427 (define_insn "dlmzb"
1428 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1429 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
1430 (match_operand:SI 2 "gpc_reg_operand" "r")]
1432 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1433 (unspec:SI [(match_dup 1)
1437 "dlmzb. %0, %1, %2")
1439 (define_expand "strlensi"
1440 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1441 (unspec:SI [(match_operand:BLK 1 "general_operand" "")
1442 (match_operand:QI 2 "const_int_operand" "")
1443 (match_operand 3 "const_int_operand" "")]
1444 UNSPEC_DLMZB_STRLEN))
1445 (clobber (match_scratch:CC 4 "=x"))]
1446 "TARGET_DLMZB && WORDS_BIG_ENDIAN && !optimize_size"
1448 rtx result = operands[0];
1449 rtx src = operands[1];
1450 rtx search_char = operands[2];
1451 rtx align = operands[3];
1452 rtx addr, scratch_string, word1, word2, scratch_dlmzb;
1453 rtx loop_label, end_label, mem, cr0, cond;
1454 if (search_char != const0_rtx
1455 || GET_CODE (align) != CONST_INT
1456 || INTVAL (align) < 8)
1458 word1 = gen_reg_rtx (SImode);
1459 word2 = gen_reg_rtx (SImode);
1460 scratch_dlmzb = gen_reg_rtx (SImode);
1461 scratch_string = gen_reg_rtx (Pmode);
1462 loop_label = gen_label_rtx ();
1463 end_label = gen_label_rtx ();
1464 addr = force_reg (Pmode, XEXP (src, 0));
1465 emit_move_insn (scratch_string, addr);
1466 emit_label (loop_label);
1467 mem = change_address (src, SImode, scratch_string);
1468 emit_move_insn (word1, mem);
1469 emit_move_insn (word2, adjust_address (mem, SImode, 4));
1470 cr0 = gen_rtx_REG (CCmode, CR0_REGNO);
1471 emit_insn (gen_dlmzb (scratch_dlmzb, word1, word2, cr0));
1472 cond = gen_rtx_NE (VOIDmode, cr0, const0_rtx);
1473 emit_jump_insn (gen_rtx_SET (VOIDmode,
1475 gen_rtx_IF_THEN_ELSE (VOIDmode,
1481 emit_insn (gen_addsi3 (scratch_string, scratch_string, GEN_INT (8)));
1482 emit_jump_insn (gen_rtx_SET (VOIDmode,
1484 gen_rtx_LABEL_REF (VOIDmode, loop_label)));
1486 emit_label (end_label);
1487 emit_insn (gen_addsi3 (scratch_string, scratch_string, scratch_dlmzb));
1488 emit_insn (gen_subsi3 (result, scratch_string, addr));
1489 emit_insn (gen_subsi3 (result, result, const1_rtx));
1494 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
1495 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1497 (set (match_operand:SI 0 "gpc_reg_operand" "")
1498 (sign_extend:SI (match_dup 1)))]
1501 (sign_extend:SI (match_dup 1)))
1503 (compare:CC (match_dup 0)
1507 ;; Fixed-point arithmetic insns.
1509 (define_expand "add<mode>3"
1510 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1511 (plus:SDI (match_operand:SDI 1 "gpc_reg_operand" "")
1512 (match_operand:SDI 2 "reg_or_add_cint_operand" "")))]
1515 if (<MODE>mode == DImode && ! TARGET_POWERPC64)
1517 if (non_short_cint_operand (operands[2], DImode))
1520 else if (GET_CODE (operands[2]) == CONST_INT
1521 && ! add_operand (operands[2], <MODE>mode))
1523 rtx tmp = ((!can_create_pseudo_p ()
1524 || rtx_equal_p (operands[0], operands[1]))
1525 ? operands[0] : gen_reg_rtx (<MODE>mode));
1527 HOST_WIDE_INT val = INTVAL (operands[2]);
1528 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1529 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, <MODE>mode);
1531 if (<MODE>mode == DImode && !satisfies_constraint_L (GEN_INT (rest)))
1534 /* The ordering here is important for the prolog expander.
1535 When space is allocated from the stack, adding 'low' first may
1536 produce a temporary deallocation (which would be bad). */
1537 emit_insn (gen_add<mode>3 (tmp, operands[1], GEN_INT (rest)));
1538 emit_insn (gen_add<mode>3 (operands[0], tmp, GEN_INT (low)));
1543 ;; Discourage ai/addic because of carry but provide it in an alternative
1544 ;; allowing register zero as source.
1545 (define_insn "*add<mode>3_internal1"
1546 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r,?r,r")
1547 (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "%r,b,r,b")
1548 (match_operand:GPR 2 "add_operand" "r,I,I,L")))]
1549 "!DECIMAL_FLOAT_MODE_P (GET_MODE (operands[0])) && !DECIMAL_FLOAT_MODE_P (GET_MODE (operands[1]))"
1552 {cal %0,%2(%1)|addi %0,%1,%2}
1554 {cau|addis} %0,%1,%v2"
1555 [(set_attr "length" "4,4,4,4")])
1557 (define_insn "addsi3_high"
1558 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
1559 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
1560 (high:SI (match_operand 2 "" ""))))]
1561 "TARGET_MACHO && !TARGET_64BIT"
1562 "{cau|addis} %0,%1,ha16(%2)"
1563 [(set_attr "length" "4")])
1565 (define_insn "*add<mode>3_internal2"
1566 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
1567 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "%r,r,r,r")
1568 (match_operand:P 2 "reg_or_short_operand" "r,I,r,I"))
1570 (clobber (match_scratch:P 3 "=r,r,r,r"))]
1573 {cax.|add.} %3,%1,%2
1574 {ai.|addic.} %3,%1,%2
1577 [(set_attr "type" "fast_compare,compare,compare,compare")
1578 (set_attr "length" "4,4,8,8")])
1581 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1582 (compare:CC (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1583 (match_operand:GPR 2 "reg_or_short_operand" ""))
1585 (clobber (match_scratch:GPR 3 ""))]
1588 (plus:GPR (match_dup 1)
1591 (compare:CC (match_dup 3)
1595 (define_insn "*add<mode>3_internal3"
1596 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
1597 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "%r,r,r,r")
1598 (match_operand:P 2 "reg_or_short_operand" "r,I,r,I"))
1600 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
1601 (plus:P (match_dup 1)
1605 {cax.|add.} %0,%1,%2
1606 {ai.|addic.} %0,%1,%2
1609 [(set_attr "type" "fast_compare,compare,compare,compare")
1610 (set_attr "length" "4,4,8,8")])
1613 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1614 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "")
1615 (match_operand:P 2 "reg_or_short_operand" ""))
1617 (set (match_operand:P 0 "gpc_reg_operand" "")
1618 (plus:P (match_dup 1) (match_dup 2)))]
1621 (plus:P (match_dup 1)
1624 (compare:CC (match_dup 0)
1628 ;; Split an add that we can't do in one insn into two insns, each of which
1629 ;; does one 16-bit part. This is used by combine. Note that the low-order
1630 ;; add should be last in case the result gets used in an address.
1633 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
1634 (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1635 (match_operand:GPR 2 "non_add_cint_operand" "")))]
1637 [(set (match_dup 0) (plus:GPR (match_dup 1) (match_dup 3)))
1638 (set (match_dup 0) (plus:GPR (match_dup 0) (match_dup 4)))]
1640 HOST_WIDE_INT val = INTVAL (operands[2]);
1641 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1642 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, <MODE>mode);
1644 operands[4] = GEN_INT (low);
1645 if (<MODE>mode == SImode || satisfies_constraint_L (GEN_INT (rest)))
1646 operands[3] = GEN_INT (rest);
1647 else if (can_create_pseudo_p ())
1649 operands[3] = gen_reg_rtx (DImode);
1650 emit_move_insn (operands[3], operands[2]);
1651 emit_insn (gen_adddi3 (operands[0], operands[1], operands[3]));
1658 (define_insn "one_cmpl<mode>2"
1659 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1660 (not:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
1665 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1666 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1668 (clobber (match_scratch:P 2 "=r,r"))]
1673 [(set_attr "type" "compare")
1674 (set_attr "length" "4,8")])
1677 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
1678 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" ""))
1680 (clobber (match_scratch:P 2 ""))]
1683 (not:P (match_dup 1)))
1685 (compare:CC (match_dup 2)
1690 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1691 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1693 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
1694 (not:P (match_dup 1)))]
1699 [(set_attr "type" "compare")
1700 (set_attr "length" "4,8")])
1703 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
1704 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" ""))
1706 (set (match_operand:P 0 "gpc_reg_operand" "")
1707 (not:P (match_dup 1)))]
1710 (not:P (match_dup 1)))
1712 (compare:CC (match_dup 0)
1717 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1718 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "rI")
1719 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1721 "{sf%I1|subf%I1c} %0,%2,%1")
1724 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
1725 (minus:GPR (match_operand:GPR 1 "reg_or_short_operand" "r,I")
1726 (match_operand:GPR 2 "gpc_reg_operand" "r,r")))]
1733 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1734 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1735 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1737 (clobber (match_scratch:SI 3 "=r,r"))]
1740 {sf.|subfc.} %3,%2,%1
1742 [(set_attr "type" "compare")
1743 (set_attr "length" "4,8")])
1746 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1747 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "r,r")
1748 (match_operand:P 2 "gpc_reg_operand" "r,r"))
1750 (clobber (match_scratch:P 3 "=r,r"))]
1755 [(set_attr "type" "fast_compare")
1756 (set_attr "length" "4,8")])
1759 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1760 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "")
1761 (match_operand:P 2 "gpc_reg_operand" ""))
1763 (clobber (match_scratch:P 3 ""))]
1766 (minus:P (match_dup 1)
1769 (compare:CC (match_dup 3)
1774 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1775 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1776 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1778 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1779 (minus:SI (match_dup 1) (match_dup 2)))]
1782 {sf.|subfc.} %0,%2,%1
1784 [(set_attr "type" "compare")
1785 (set_attr "length" "4,8")])
1788 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1789 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "r,r")
1790 (match_operand:P 2 "gpc_reg_operand" "r,r"))
1792 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
1793 (minus:P (match_dup 1)
1799 [(set_attr "type" "fast_compare")
1800 (set_attr "length" "4,8")])
1803 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1804 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "")
1805 (match_operand:P 2 "gpc_reg_operand" ""))
1807 (set (match_operand:P 0 "gpc_reg_operand" "")
1808 (minus:P (match_dup 1)
1812 (minus:P (match_dup 1)
1815 (compare:CC (match_dup 0)
1819 (define_expand "sub<mode>3"
1820 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1821 (minus:SDI (match_operand:SDI 1 "reg_or_short_operand" "")
1822 (match_operand:SDI 2 "reg_or_sub_cint_operand" "")))]
1826 if (GET_CODE (operands[2]) == CONST_INT)
1828 emit_insn (gen_add<mode>3 (operands[0], operands[1],
1829 negate_rtx (<MODE>mode, operands[2])));
1834 ;; For SMIN, SMAX, UMIN, and UMAX, we use DEFINE_EXPAND's that involve a doz[i]
1835 ;; instruction and some auxiliary computations. Then we just have a single
1836 ;; DEFINE_INSN for doz[i] and the define_splits to make them if made by
1839 (define_expand "sminsi3"
1841 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1842 (match_operand:SI 2 "reg_or_short_operand" ""))
1844 (minus:SI (match_dup 2) (match_dup 1))))
1845 (set (match_operand:SI 0 "gpc_reg_operand" "")
1846 (minus:SI (match_dup 2) (match_dup 3)))]
1847 "TARGET_POWER || TARGET_ISEL"
1852 operands[2] = force_reg (SImode, operands[2]);
1853 rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]);
1857 operands[3] = gen_reg_rtx (SImode);
1861 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1862 (smin:SI (match_operand:SI 1 "gpc_reg_operand" "")
1863 (match_operand:SI 2 "reg_or_short_operand" "")))
1864 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1867 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1869 (minus:SI (match_dup 2) (match_dup 1))))
1870 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 3)))]
1873 (define_expand "smaxsi3"
1875 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1876 (match_operand:SI 2 "reg_or_short_operand" ""))
1878 (minus:SI (match_dup 2) (match_dup 1))))
1879 (set (match_operand:SI 0 "gpc_reg_operand" "")
1880 (plus:SI (match_dup 3) (match_dup 1)))]
1881 "TARGET_POWER || TARGET_ISEL"
1886 operands[2] = force_reg (SImode, operands[2]);
1887 rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]);
1890 operands[3] = gen_reg_rtx (SImode);
1894 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1895 (smax:SI (match_operand:SI 1 "gpc_reg_operand" "")
1896 (match_operand:SI 2 "reg_or_short_operand" "")))
1897 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1900 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1902 (minus:SI (match_dup 2) (match_dup 1))))
1903 (set (match_dup 0) (plus:SI (match_dup 3) (match_dup 1)))]
1906 (define_expand "uminsi3"
1907 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1909 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
1911 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
1913 (minus:SI (match_dup 4) (match_dup 3))))
1914 (set (match_operand:SI 0 "gpc_reg_operand" "")
1915 (minus:SI (match_dup 2) (match_dup 3)))]
1916 "TARGET_POWER || TARGET_ISEL"
1921 rs6000_emit_minmax (operands[0], UMIN, operands[1], operands[2]);
1924 operands[3] = gen_reg_rtx (SImode);
1925 operands[4] = gen_reg_rtx (SImode);
1926 operands[5] = GEN_INT (-2147483647 - 1);
1929 (define_expand "umaxsi3"
1930 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1932 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
1934 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
1936 (minus:SI (match_dup 4) (match_dup 3))))
1937 (set (match_operand:SI 0 "gpc_reg_operand" "")
1938 (plus:SI (match_dup 3) (match_dup 1)))]
1939 "TARGET_POWER || TARGET_ISEL"
1944 rs6000_emit_minmax (operands[0], UMAX, operands[1], operands[2]);
1947 operands[3] = gen_reg_rtx (SImode);
1948 operands[4] = gen_reg_rtx (SImode);
1949 operands[5] = GEN_INT (-2147483647 - 1);
1953 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1954 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r")
1955 (match_operand:SI 2 "reg_or_short_operand" "rI"))
1957 (minus:SI (match_dup 2) (match_dup 1))))]
1962 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1964 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
1965 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
1967 (minus:SI (match_dup 2) (match_dup 1)))
1969 (clobber (match_scratch:SI 3 "=r,r"))]
1974 [(set_attr "type" "delayed_compare")
1975 (set_attr "length" "4,8")])
1978 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1980 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "")
1981 (match_operand:SI 2 "reg_or_short_operand" ""))
1983 (minus:SI (match_dup 2) (match_dup 1)))
1985 (clobber (match_scratch:SI 3 ""))]
1986 "TARGET_POWER && reload_completed"
1988 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1990 (minus:SI (match_dup 2) (match_dup 1))))
1992 (compare:CC (match_dup 3)
1997 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1999 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
2000 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
2002 (minus:SI (match_dup 2) (match_dup 1)))
2004 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2005 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
2007 (minus:SI (match_dup 2) (match_dup 1))))]
2012 [(set_attr "type" "delayed_compare")
2013 (set_attr "length" "4,8")])
2016 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2018 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "")
2019 (match_operand:SI 2 "reg_or_short_operand" ""))
2021 (minus:SI (match_dup 2) (match_dup 1)))
2023 (set (match_operand:SI 0 "gpc_reg_operand" "")
2024 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
2026 (minus:SI (match_dup 2) (match_dup 1))))]
2027 "TARGET_POWER && reload_completed"
2029 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
2031 (minus:SI (match_dup 2) (match_dup 1))))
2033 (compare:CC (match_dup 0)
2037 ;; We don't need abs with condition code because such comparisons should
2039 (define_expand "abssi2"
2040 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2041 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))]
2047 emit_insn (gen_abssi2_isel (operands[0], operands[1]));
2050 else if (! TARGET_POWER)
2052 emit_insn (gen_abssi2_nopower (operands[0], operands[1]));
2057 (define_insn "*abssi2_power"
2058 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2059 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
2063 (define_insn_and_split "abssi2_isel"
2064 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2065 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
2066 (clobber (match_scratch:SI 2 "=&b"))
2067 (clobber (match_scratch:CC 3 "=y"))]
2070 "&& reload_completed"
2071 [(set (match_dup 2) (neg:SI (match_dup 1)))
2073 (compare:CC (match_dup 1)
2076 (if_then_else:SI (ge (match_dup 3)
2082 (define_insn_and_split "abssi2_nopower"
2083 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
2084 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0")))
2085 (clobber (match_scratch:SI 2 "=&r,&r"))]
2086 "! TARGET_POWER && ! TARGET_ISEL"
2088 "&& reload_completed"
2089 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
2090 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
2091 (set (match_dup 0) (minus:SI (match_dup 0) (match_dup 2)))]
2094 (define_insn "*nabs_power"
2095 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2096 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r"))))]
2100 (define_insn_and_split "*nabs_nopower"
2101 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
2102 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0"))))
2103 (clobber (match_scratch:SI 2 "=&r,&r"))]
2106 "&& reload_completed"
2107 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
2108 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
2109 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 0)))]
2112 (define_expand "neg<mode>2"
2113 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
2114 (neg:SDI (match_operand:SDI 1 "gpc_reg_operand" "")))]
2118 (define_insn "*neg<mode>2_internal"
2119 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2120 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
2125 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2126 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
2128 (clobber (match_scratch:P 2 "=r,r"))]
2133 [(set_attr "type" "fast_compare")
2134 (set_attr "length" "4,8")])
2137 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2138 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" ""))
2140 (clobber (match_scratch:P 2 ""))]
2143 (neg:P (match_dup 1)))
2145 (compare:CC (match_dup 2)
2150 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
2151 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
2153 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
2154 (neg:P (match_dup 1)))]
2159 [(set_attr "type" "fast_compare")
2160 (set_attr "length" "4,8")])
2163 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
2164 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" ""))
2166 (set (match_operand:P 0 "gpc_reg_operand" "")
2167 (neg:P (match_dup 1)))]
2170 (neg:P (match_dup 1)))
2172 (compare:CC (match_dup 0)
2176 (define_insn "clz<mode>2"
2177 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2178 (clz:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
2180 "{cntlz|cntlz<wd>} %0,%1"
2181 [(set_attr "type" "cntlz")])
2183 (define_expand "ctz<mode>2"
2185 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))
2186 (parallel [(set (match_dup 3) (and:GPR (match_dup 1)
2188 (clobber (scratch:CC))])
2189 (set (match_dup 4) (clz:GPR (match_dup 3)))
2190 (set (match_operand:GPR 0 "gpc_reg_operand" "")
2191 (minus:GPR (match_dup 5) (match_dup 4)))]
2194 operands[2] = gen_reg_rtx (<MODE>mode);
2195 operands[3] = gen_reg_rtx (<MODE>mode);
2196 operands[4] = gen_reg_rtx (<MODE>mode);
2197 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode) - 1);
2200 (define_expand "ffs<mode>2"
2202 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))
2203 (parallel [(set (match_dup 3) (and:GPR (match_dup 1)
2205 (clobber (scratch:CC))])
2206 (set (match_dup 4) (clz:GPR (match_dup 3)))
2207 (set (match_operand:GPR 0 "gpc_reg_operand" "")
2208 (minus:GPR (match_dup 5) (match_dup 4)))]
2211 operands[2] = gen_reg_rtx (<MODE>mode);
2212 operands[3] = gen_reg_rtx (<MODE>mode);
2213 operands[4] = gen_reg_rtx (<MODE>mode);
2214 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode));
2217 (define_insn "popcntb<mode>2"
2218 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2219 (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")]
2224 (define_expand "popcount<mode>2"
2225 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2226 (popcount:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))]
2229 rs6000_emit_popcount (operands[0], operands[1]);
2233 (define_expand "parity<mode>2"
2234 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2235 (parity:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))]
2238 rs6000_emit_parity (operands[0], operands[1]);
2242 (define_insn "bswapsi2"
2243 [(set (match_operand:SI 0 "reg_or_mem_operand" "=r,Z,&r")
2244 (bswap:SI (match_operand:SI 1 "reg_or_mem_operand" "Z,r,r")))]
2248 {stbrx|stwbrx} %1,%y0
2250 [(set_attr "length" "4,4,12")])
2253 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2254 (bswap:SI (match_operand:SI 1 "gpc_reg_operand" "")))]
2257 (rotate:SI (match_dup 1) (const_int 8)))
2258 (set (zero_extract:SI (match_dup 0)
2262 (set (zero_extract:SI (match_dup 0)
2265 (rotate:SI (match_dup 1)
2269 (define_expand "mulsi3"
2270 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
2271 (use (match_operand:SI 1 "gpc_reg_operand" ""))
2272 (use (match_operand:SI 2 "reg_or_short_operand" ""))]
2277 emit_insn (gen_mulsi3_mq (operands[0], operands[1], operands[2]));
2279 emit_insn (gen_mulsi3_no_mq (operands[0], operands[1], operands[2]));
2283 (define_insn "mulsi3_mq"
2284 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2285 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2286 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
2287 (clobber (match_scratch:SI 3 "=q,q"))]
2290 {muls|mullw} %0,%1,%2
2291 {muli|mulli} %0,%1,%2"
2293 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
2294 (const_string "imul3")
2295 (match_operand:SI 2 "short_cint_operand" "")
2296 (const_string "imul2")]
2297 (const_string "imul")))])
2299 (define_insn "mulsi3_no_mq"
2300 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2301 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2302 (match_operand:SI 2 "reg_or_short_operand" "r,I")))]
2305 {muls|mullw} %0,%1,%2
2306 {muli|mulli} %0,%1,%2"
2308 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
2309 (const_string "imul3")
2310 (match_operand:SI 2 "short_cint_operand" "")
2311 (const_string "imul2")]
2312 (const_string "imul")))])
2314 (define_insn "*mulsi3_mq_internal1"
2315 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2316 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2317 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2319 (clobber (match_scratch:SI 3 "=r,r"))
2320 (clobber (match_scratch:SI 4 "=q,q"))]
2323 {muls.|mullw.} %3,%1,%2
2325 [(set_attr "type" "imul_compare")
2326 (set_attr "length" "4,8")])
2329 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2330 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2331 (match_operand:SI 2 "gpc_reg_operand" ""))
2333 (clobber (match_scratch:SI 3 ""))
2334 (clobber (match_scratch:SI 4 ""))]
2335 "TARGET_POWER && reload_completed"
2336 [(parallel [(set (match_dup 3)
2337 (mult:SI (match_dup 1) (match_dup 2)))
2338 (clobber (match_dup 4))])
2340 (compare:CC (match_dup 3)
2344 (define_insn "*mulsi3_no_mq_internal1"
2345 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2346 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2347 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2349 (clobber (match_scratch:SI 3 "=r,r"))]
2352 {muls.|mullw.} %3,%1,%2
2354 [(set_attr "type" "imul_compare")
2355 (set_attr "length" "4,8")])
2358 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
2359 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2360 (match_operand:SI 2 "gpc_reg_operand" ""))
2362 (clobber (match_scratch:SI 3 ""))]
2363 "! TARGET_POWER && reload_completed"
2365 (mult:SI (match_dup 1) (match_dup 2)))
2367 (compare:CC (match_dup 3)
2371 (define_insn "*mulsi3_mq_internal2"
2372 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2373 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2374 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2376 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2377 (mult:SI (match_dup 1) (match_dup 2)))
2378 (clobber (match_scratch:SI 4 "=q,q"))]
2381 {muls.|mullw.} %0,%1,%2
2383 [(set_attr "type" "imul_compare")
2384 (set_attr "length" "4,8")])
2387 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2388 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2389 (match_operand:SI 2 "gpc_reg_operand" ""))
2391 (set (match_operand:SI 0 "gpc_reg_operand" "")
2392 (mult:SI (match_dup 1) (match_dup 2)))
2393 (clobber (match_scratch:SI 4 ""))]
2394 "TARGET_POWER && reload_completed"
2395 [(parallel [(set (match_dup 0)
2396 (mult:SI (match_dup 1) (match_dup 2)))
2397 (clobber (match_dup 4))])
2399 (compare:CC (match_dup 0)
2403 (define_insn "*mulsi3_no_mq_internal2"
2404 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2405 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2406 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2408 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2409 (mult:SI (match_dup 1) (match_dup 2)))]
2412 {muls.|mullw.} %0,%1,%2
2414 [(set_attr "type" "imul_compare")
2415 (set_attr "length" "4,8")])
2418 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
2419 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2420 (match_operand:SI 2 "gpc_reg_operand" ""))
2422 (set (match_operand:SI 0 "gpc_reg_operand" "")
2423 (mult:SI (match_dup 1) (match_dup 2)))]
2424 "! TARGET_POWER && reload_completed"
2426 (mult:SI (match_dup 1) (match_dup 2)))
2428 (compare:CC (match_dup 0)
2432 ;; Operand 1 is divided by operand 2; quotient goes to operand
2433 ;; 0 and remainder to operand 3.
2434 ;; ??? At some point, see what, if anything, we can do about if (x % y == 0).
2436 (define_expand "divmodsi4"
2437 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
2438 (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
2439 (match_operand:SI 2 "gpc_reg_operand" "")))
2440 (set (match_operand:SI 3 "register_operand" "")
2441 (mod:SI (match_dup 1) (match_dup 2)))])]
2442 "TARGET_POWER || (! TARGET_POWER && ! TARGET_POWERPC)"
2445 if (! TARGET_POWER && ! TARGET_POWERPC)
2447 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2448 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2449 emit_insn (gen_divss_call ());
2450 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2451 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
2456 (define_insn "*divmodsi4_internal"
2457 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2458 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2459 (match_operand:SI 2 "gpc_reg_operand" "r")))
2460 (set (match_operand:SI 3 "register_operand" "=q")
2461 (mod:SI (match_dup 1) (match_dup 2)))]
2464 [(set_attr "type" "idiv")])
2466 (define_expand "udiv<mode>3"
2467 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2468 (udiv:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2469 (match_operand:GPR 2 "gpc_reg_operand" "")))]
2470 "TARGET_POWERPC || (! TARGET_POWER && ! TARGET_POWERPC)"
2473 if (! TARGET_POWER && ! TARGET_POWERPC)
2475 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2476 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2477 emit_insn (gen_quous_call ());
2478 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2481 else if (TARGET_POWER)
2483 emit_insn (gen_udivsi3_mq (operands[0], operands[1], operands[2]));
2488 (define_insn "udivsi3_mq"
2489 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2490 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2491 (match_operand:SI 2 "gpc_reg_operand" "r")))
2492 (clobber (match_scratch:SI 3 "=q"))]
2493 "TARGET_POWERPC && TARGET_POWER"
2495 [(set_attr "type" "idiv")])
2497 (define_insn "*udivsi3_no_mq"
2498 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2499 (udiv:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2500 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
2501 "TARGET_POWERPC && ! TARGET_POWER"
2504 (cond [(match_operand:SI 0 "" "")
2505 (const_string "idiv")]
2506 (const_string "ldiv")))])
2509 ;; For powers of two we can do srai/aze for divide and then adjust for
2510 ;; modulus. If it isn't a power of two, FAIL on POWER so divmodsi4 will be
2511 ;; used; for PowerPC, force operands into register and do a normal divide;
2512 ;; for AIX common-mode, use quoss call on register operands.
2513 (define_expand "div<mode>3"
2514 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2515 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2516 (match_operand:GPR 2 "reg_or_cint_operand" "")))]
2520 if (GET_CODE (operands[2]) == CONST_INT
2521 && INTVAL (operands[2]) > 0
2522 && exact_log2 (INTVAL (operands[2])) >= 0)
2524 else if (TARGET_POWERPC)
2526 operands[2] = force_reg (<MODE>mode, operands[2]);
2529 emit_insn (gen_divsi3_mq (operands[0], operands[1], operands[2]));
2533 else if (TARGET_POWER)
2537 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2538 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2539 emit_insn (gen_quoss_call ());
2540 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2545 (define_insn "divsi3_mq"
2546 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2547 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2548 (match_operand:SI 2 "gpc_reg_operand" "r")))
2549 (clobber (match_scratch:SI 3 "=q"))]
2550 "TARGET_POWERPC && TARGET_POWER"
2552 [(set_attr "type" "idiv")])
2554 (define_insn "*div<mode>3_no_mq"
2555 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2556 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2557 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
2558 "TARGET_POWERPC && ! TARGET_POWER"
2561 (cond [(match_operand:SI 0 "" "")
2562 (const_string "idiv")]
2563 (const_string "ldiv")))])
2565 (define_expand "mod<mode>3"
2566 [(use (match_operand:GPR 0 "gpc_reg_operand" ""))
2567 (use (match_operand:GPR 1 "gpc_reg_operand" ""))
2568 (use (match_operand:GPR 2 "reg_or_cint_operand" ""))]
2576 if (GET_CODE (operands[2]) != CONST_INT
2577 || INTVAL (operands[2]) <= 0
2578 || (i = exact_log2 (INTVAL (operands[2]))) < 0)
2581 temp1 = gen_reg_rtx (<MODE>mode);
2582 temp2 = gen_reg_rtx (<MODE>mode);
2584 emit_insn (gen_div<mode>3 (temp1, operands[1], operands[2]));
2585 emit_insn (gen_ashl<mode>3 (temp2, temp1, GEN_INT (i)));
2586 emit_insn (gen_sub<mode>3 (operands[0], operands[1], temp2));
2591 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2592 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2593 (match_operand:GPR 2 "exact_log2_cint_operand" "N")))]
2595 "{srai|sra<wd>i} %0,%1,%p2\;{aze|addze} %0,%0"
2596 [(set_attr "type" "two")
2597 (set_attr "length" "8")])
2600 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2601 (compare:CC (div:P (match_operand:P 1 "gpc_reg_operand" "r,r")
2602 (match_operand:P 2 "exact_log2_cint_operand" "N,N"))
2604 (clobber (match_scratch:P 3 "=r,r"))]
2607 {srai|sra<wd>i} %3,%1,%p2\;{aze.|addze.} %3,%3
2609 [(set_attr "type" "compare")
2610 (set_attr "length" "8,12")
2611 (set_attr "cell_micro" "not")])
2614 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2615 (compare:CC (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2616 (match_operand:GPR 2 "exact_log2_cint_operand"
2619 (clobber (match_scratch:GPR 3 ""))]
2622 (div:<MODE> (match_dup 1) (match_dup 2)))
2624 (compare:CC (match_dup 3)
2629 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2630 (compare:CC (div:P (match_operand:P 1 "gpc_reg_operand" "r,r")
2631 (match_operand:P 2 "exact_log2_cint_operand" "N,N"))
2633 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
2634 (div:P (match_dup 1) (match_dup 2)))]
2637 {srai|sra<wd>i} %0,%1,%p2\;{aze.|addze.} %0,%0
2639 [(set_attr "type" "compare")
2640 (set_attr "length" "8,12")
2641 (set_attr "cell_micro" "not")])
2644 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2645 (compare:CC (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2646 (match_operand:GPR 2 "exact_log2_cint_operand"
2649 (set (match_operand:GPR 0 "gpc_reg_operand" "")
2650 (div:GPR (match_dup 1) (match_dup 2)))]
2653 (div:<MODE> (match_dup 1) (match_dup 2)))
2655 (compare:CC (match_dup 0)
2660 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2663 (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
2665 (zero_extend:DI (match_operand:SI 4 "register_operand" "2")))
2666 (match_operand:SI 3 "gpc_reg_operand" "r")))
2667 (set (match_operand:SI 2 "register_operand" "=*q")
2670 (zero_extend:DI (match_dup 1)) (const_int 32))
2671 (zero_extend:DI (match_dup 4)))
2675 [(set_attr "type" "idiv")])
2677 ;; To do unsigned divide we handle the cases of the divisor looking like a
2678 ;; negative number. If it is a constant that is less than 2**31, we don't
2679 ;; have to worry about the branches. So make a few subroutines here.
2681 ;; First comes the normal case.
2682 (define_expand "udivmodsi4_normal"
2683 [(set (match_dup 4) (const_int 0))
2684 (parallel [(set (match_operand:SI 0 "" "")
2685 (udiv:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
2687 (zero_extend:DI (match_operand:SI 1 "" "")))
2688 (match_operand:SI 2 "" "")))
2689 (set (match_operand:SI 3 "" "")
2690 (umod:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
2692 (zero_extend:DI (match_dup 1)))
2696 { operands[4] = gen_reg_rtx (SImode); }")
2698 ;; This handles the branches.
2699 (define_expand "udivmodsi4_tests"
2700 [(set (match_operand:SI 0 "" "") (const_int 0))
2701 (set (match_operand:SI 3 "" "") (match_operand:SI 1 "" ""))
2702 (set (match_dup 5) (compare:CCUNS (match_dup 1) (match_operand:SI 2 "" "")))
2703 (set (pc) (if_then_else (ltu (match_dup 5) (const_int 0))
2704 (label_ref (match_operand:SI 4 "" "")) (pc)))
2705 (set (match_dup 0) (const_int 1))
2706 (set (match_dup 3) (minus:SI (match_dup 1) (match_dup 2)))
2707 (set (match_dup 6) (compare:CC (match_dup 2) (const_int 0)))
2708 (set (pc) (if_then_else (lt (match_dup 6) (const_int 0))
2709 (label_ref (match_dup 4)) (pc)))]
2712 { operands[5] = gen_reg_rtx (CCUNSmode);
2713 operands[6] = gen_reg_rtx (CCmode);
2716 (define_expand "udivmodsi4"
2717 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
2718 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "")
2719 (match_operand:SI 2 "reg_or_cint_operand" "")))
2720 (set (match_operand:SI 3 "gpc_reg_operand" "")
2721 (umod:SI (match_dup 1) (match_dup 2)))])]
2729 if (! TARGET_POWERPC)
2731 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2732 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2733 emit_insn (gen_divus_call ());
2734 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2735 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
2742 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) < 0)
2744 operands[2] = force_reg (SImode, operands[2]);
2745 label = gen_label_rtx ();
2746 emit (gen_udivmodsi4_tests (operands[0], operands[1], operands[2],
2747 operands[3], label));
2750 operands[2] = force_reg (SImode, operands[2]);
2752 emit (gen_udivmodsi4_normal (operands[0], operands[1], operands[2],
2760 ;; AIX architecture-independent common-mode multiply (DImode),
2761 ;; divide/modulus, and quotient subroutine calls. Input operands in R3 and
2762 ;; R4; results in R3 and sometimes R4; link register always clobbered by bla
2763 ;; instruction; R0 sometimes clobbered; also, MQ sometimes clobbered but
2764 ;; assumed unused if generating common-mode, so ignore.
2765 (define_insn "mulh_call"
2768 (lshiftrt:DI (mult:DI (sign_extend:DI (reg:SI 3))
2769 (sign_extend:DI (reg:SI 4)))
2771 (clobber (reg:SI LR_REGNO))]
2772 "! TARGET_POWER && ! TARGET_POWERPC"
2774 [(set_attr "type" "imul")])
2776 (define_insn "mull_call"
2778 (mult:DI (sign_extend:DI (reg:SI 3))
2779 (sign_extend:DI (reg:SI 4))))
2780 (clobber (reg:SI LR_REGNO))
2781 (clobber (reg:SI 0))]
2782 "! TARGET_POWER && ! TARGET_POWERPC"
2784 [(set_attr "type" "imul")])
2786 (define_insn "divss_call"
2788 (div:SI (reg:SI 3) (reg:SI 4)))
2790 (mod:SI (reg:SI 3) (reg:SI 4)))
2791 (clobber (reg:SI LR_REGNO))
2792 (clobber (reg:SI 0))]
2793 "! TARGET_POWER && ! TARGET_POWERPC"
2795 [(set_attr "type" "idiv")])
2797 (define_insn "divus_call"
2799 (udiv:SI (reg:SI 3) (reg:SI 4)))
2801 (umod:SI (reg:SI 3) (reg:SI 4)))
2802 (clobber (reg:SI LR_REGNO))
2803 (clobber (reg:SI 0))
2804 (clobber (match_scratch:CC 0 "=x"))
2805 (clobber (reg:CC CR1_REGNO))]
2806 "! TARGET_POWER && ! TARGET_POWERPC"
2808 [(set_attr "type" "idiv")])
2810 (define_insn "quoss_call"
2812 (div:SI (reg:SI 3) (reg:SI 4)))
2813 (clobber (reg:SI LR_REGNO))]
2814 "! TARGET_POWER && ! TARGET_POWERPC"
2816 [(set_attr "type" "idiv")])
2818 (define_insn "quous_call"
2820 (udiv:SI (reg:SI 3) (reg:SI 4)))
2821 (clobber (reg:SI LR_REGNO))
2822 (clobber (reg:SI 0))
2823 (clobber (match_scratch:CC 0 "=x"))
2824 (clobber (reg:CC CR1_REGNO))]
2825 "! TARGET_POWER && ! TARGET_POWERPC"
2827 [(set_attr "type" "idiv")])
2829 ;; Logical instructions
2830 ;; The logical instructions are mostly combined by using match_operator,
2831 ;; but the plain AND insns are somewhat different because there is no
2832 ;; plain 'andi' (only 'andi.'), no plain 'andis', and there are all
2833 ;; those rotate-and-mask operations. Thus, the AND insns come first.
2835 (define_expand "andsi3"
2837 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2838 (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2839 (match_operand:SI 2 "and_operand" "")))
2840 (clobber (match_scratch:CC 3 ""))])]
2844 (define_insn "andsi3_mc"
2845 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
2846 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
2847 (match_operand:SI 2 "and_operand" "?r,T,K,L")))
2848 (clobber (match_scratch:CC 3 "=X,X,x,x"))]
2849 "rs6000_gen_cell_microcode"
2852 {rlinm|rlwinm} %0,%1,0,%m2,%M2
2853 {andil.|andi.} %0,%1,%b2
2854 {andiu.|andis.} %0,%1,%u2"
2855 [(set_attr "type" "*,*,compare,compare")])
2857 (define_insn "andsi3_nomc"
2858 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2859 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2860 (match_operand:SI 2 "and_operand" "?r,T")))
2861 (clobber (match_scratch:CC 3 "=X,X"))]
2862 "!rs6000_gen_cell_microcode"
2865 {rlinm|rlwinm} %0,%1,0,%m2,%M2")
2867 (define_insn "andsi3_internal0_nomc"
2868 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2869 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2870 (match_operand:SI 2 "and_operand" "?r,T")))]
2871 "!rs6000_gen_cell_microcode"
2874 {rlinm|rlwinm} %0,%1,0,%m2,%M2")
2877 ;; Note to set cr's other than cr0 we do the and immediate and then
2878 ;; the test again -- this avoids a mfcr which on the higher end
2879 ;; machines causes an execution serialization
2881 (define_insn "*andsi3_internal2_mc"
2882 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2883 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2884 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2886 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2887 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2888 "TARGET_32BIT && rs6000_gen_cell_microcode"
2891 {andil.|andi.} %3,%1,%b2
2892 {andiu.|andis.} %3,%1,%u2
2893 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
2898 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2899 (set_attr "length" "4,4,4,4,8,8,8,8")])
2901 (define_insn "*andsi3_internal3_mc"
2902 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2903 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2904 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2906 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2907 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2908 "TARGET_64BIT && rs6000_gen_cell_microcode"
2911 {andil.|andi.} %3,%1,%b2
2912 {andiu.|andis.} %3,%1,%u2
2913 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
2918 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2919 (set_attr "length" "8,4,4,4,8,8,8,8")])
2922 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
2923 (compare:CC (and:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2924 (match_operand:GPR 2 "and_operand" ""))
2926 (clobber (match_scratch:GPR 3 ""))
2927 (clobber (match_scratch:CC 4 ""))]
2929 [(parallel [(set (match_dup 3)
2930 (and:<MODE> (match_dup 1)
2932 (clobber (match_dup 4))])
2934 (compare:CC (match_dup 3)
2938 ;; We don't have a 32 bit "and. rt,ra,rb" for ppc64. cr is set from the
2939 ;; whole 64 bit reg, and we don't know what is in the high 32 bits.
2942 [(set (match_operand:CC 0 "cc_reg_operand" "")
2943 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2944 (match_operand:SI 2 "gpc_reg_operand" ""))
2946 (clobber (match_scratch:SI 3 ""))
2947 (clobber (match_scratch:CC 4 ""))]
2948 "TARGET_POWERPC64 && reload_completed"
2949 [(parallel [(set (match_dup 3)
2950 (and:SI (match_dup 1)
2952 (clobber (match_dup 4))])
2954 (compare:CC (match_dup 3)
2958 (define_insn "*andsi3_internal4"
2959 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2960 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2961 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2963 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
2964 (and:SI (match_dup 1)
2966 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2967 "TARGET_32BIT && rs6000_gen_cell_microcode"
2970 {andil.|andi.} %0,%1,%b2
2971 {andiu.|andis.} %0,%1,%u2
2972 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
2977 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2978 (set_attr "length" "4,4,4,4,8,8,8,8")])
2980 (define_insn "*andsi3_internal5_mc"
2981 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2982 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2983 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2985 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
2986 (and:SI (match_dup 1)
2988 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2989 "TARGET_64BIT && rs6000_gen_cell_microcode"
2992 {andil.|andi.} %0,%1,%b2
2993 {andiu.|andis.} %0,%1,%u2
2994 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
2999 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
3000 (set_attr "length" "8,4,4,4,8,8,8,8")])
3002 (define_insn "*andsi3_internal5_nomc"
3003 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y,??y,??y,?y")
3004 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
3005 (match_operand:SI 2 "and_operand" "r,r,K,L,T"))
3007 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
3008 (and:SI (match_dup 1)
3010 (clobber (match_scratch:CC 4 "=X,X,x,x,X"))]
3011 "TARGET_64BIT && !rs6000_gen_cell_microcode"
3013 [(set_attr "type" "compare")
3014 (set_attr "length" "8,8,8,8,8")])
3017 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3018 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
3019 (match_operand:SI 2 "and_operand" ""))
3021 (set (match_operand:SI 0 "gpc_reg_operand" "")
3022 (and:SI (match_dup 1)
3024 (clobber (match_scratch:CC 4 ""))]
3026 [(parallel [(set (match_dup 0)
3027 (and:SI (match_dup 1)
3029 (clobber (match_dup 4))])
3031 (compare:CC (match_dup 0)
3036 [(set (match_operand:CC 3 "cc_reg_operand" "")
3037 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
3038 (match_operand:SI 2 "gpc_reg_operand" ""))
3040 (set (match_operand:SI 0 "gpc_reg_operand" "")
3041 (and:SI (match_dup 1)
3043 (clobber (match_scratch:CC 4 ""))]
3044 "TARGET_POWERPC64 && reload_completed"
3045 [(parallel [(set (match_dup 0)
3046 (and:SI (match_dup 1)
3048 (clobber (match_dup 4))])
3050 (compare:CC (match_dup 0)
3054 ;; Handle the PowerPC64 rlwinm corner case
3056 (define_insn_and_split "*andsi3_internal6"
3057 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3058 (and:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3059 (match_operand:SI 2 "mask_operand_wrap" "i")))]
3064 (and:SI (rotate:SI (match_dup 1) (match_dup 3))
3067 (rotate:SI (match_dup 0) (match_dup 5)))]
3070 int mb = extract_MB (operands[2]);
3071 int me = extract_ME (operands[2]);
3072 operands[3] = GEN_INT (me + 1);
3073 operands[5] = GEN_INT (32 - (me + 1));
3074 operands[4] = GEN_INT (~((HOST_WIDE_INT) -1 << (33 + me - mb)));
3076 [(set_attr "length" "8")])
3078 (define_expand "iorsi3"
3079 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3080 (ior:SI (match_operand:SI 1 "gpc_reg_operand" "")
3081 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
3085 if (GET_CODE (operands[2]) == CONST_INT
3086 && ! logical_operand (operands[2], SImode))
3088 HOST_WIDE_INT value = INTVAL (operands[2]);
3089 rtx tmp = ((!can_create_pseudo_p ()
3090 || rtx_equal_p (operands[0], operands[1]))
3091 ? operands[0] : gen_reg_rtx (SImode));
3093 emit_insn (gen_iorsi3 (tmp, operands[1],
3094 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
3095 emit_insn (gen_iorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
3100 (define_expand "xorsi3"
3101 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3102 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
3103 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
3107 if (GET_CODE (operands[2]) == CONST_INT
3108 && ! logical_operand (operands[2], SImode))
3110 HOST_WIDE_INT value = INTVAL (operands[2]);
3111 rtx tmp = ((!can_create_pseudo_p ()
3112 || rtx_equal_p (operands[0], operands[1]))
3113 ? operands[0] : gen_reg_rtx (SImode));
3115 emit_insn (gen_xorsi3 (tmp, operands[1],
3116 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
3117 emit_insn (gen_xorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
3122 (define_insn "*boolsi3_internal1"
3123 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
3124 (match_operator:SI 3 "boolean_or_operator"
3125 [(match_operand:SI 1 "gpc_reg_operand" "%r,r,r")
3126 (match_operand:SI 2 "logical_operand" "r,K,L")]))]
3130 {%q3il|%q3i} %0,%1,%b2
3131 {%q3iu|%q3is} %0,%1,%u2")
3133 (define_insn "*boolsi3_internal2"
3134 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3135 (compare:CC (match_operator:SI 4 "boolean_or_operator"
3136 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
3137 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3139 (clobber (match_scratch:SI 3 "=r,r"))]
3144 [(set_attr "type" "compare")
3145 (set_attr "length" "4,8")])
3148 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3149 (compare:CC (match_operator:SI 4 "boolean_operator"
3150 [(match_operand:SI 1 "gpc_reg_operand" "")
3151 (match_operand:SI 2 "gpc_reg_operand" "")])
3153 (clobber (match_scratch:SI 3 ""))]
3154 "TARGET_32BIT && reload_completed"
3155 [(set (match_dup 3) (match_dup 4))
3157 (compare:CC (match_dup 3)
3161 (define_insn "*boolsi3_internal3"
3162 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3163 (compare:CC (match_operator:SI 4 "boolean_operator"
3164 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
3165 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3167 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3173 [(set_attr "type" "compare")
3174 (set_attr "length" "4,8")])
3177 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3178 (compare:CC (match_operator:SI 4 "boolean_operator"
3179 [(match_operand:SI 1 "gpc_reg_operand" "")
3180 (match_operand:SI 2 "gpc_reg_operand" "")])
3182 (set (match_operand:SI 0 "gpc_reg_operand" "")
3184 "TARGET_32BIT && reload_completed"
3185 [(set (match_dup 0) (match_dup 4))
3187 (compare:CC (match_dup 0)
3191 ;; Split a logical operation that we can't do in one insn into two insns,
3192 ;; each of which does one 16-bit part. This is used by combine.
3195 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3196 (match_operator:SI 3 "boolean_or_operator"
3197 [(match_operand:SI 1 "gpc_reg_operand" "")
3198 (match_operand:SI 2 "non_logical_cint_operand" "")]))]
3200 [(set (match_dup 0) (match_dup 4))
3201 (set (match_dup 0) (match_dup 5))]
3205 i = GEN_INT (INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff));
3206 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
3208 i = GEN_INT (INTVAL (operands[2]) & 0xffff);
3209 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
3213 (define_insn "*boolcsi3_internal1"
3214 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3215 (match_operator:SI 3 "boolean_operator"
3216 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
3217 (match_operand:SI 2 "gpc_reg_operand" "r")]))]
3221 (define_insn "*boolcsi3_internal2"
3222 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3223 (compare:CC (match_operator:SI 4 "boolean_operator"
3224 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
3225 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3227 (clobber (match_scratch:SI 3 "=r,r"))]
3232 [(set_attr "type" "compare")
3233 (set_attr "length" "4,8")])
3236 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3237 (compare:CC (match_operator:SI 4 "boolean_operator"
3238 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3239 (match_operand:SI 2 "gpc_reg_operand" "")])
3241 (clobber (match_scratch:SI 3 ""))]
3242 "TARGET_32BIT && reload_completed"
3243 [(set (match_dup 3) (match_dup 4))
3245 (compare:CC (match_dup 3)
3249 (define_insn "*boolcsi3_internal3"
3250 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3251 (compare:CC (match_operator:SI 4 "boolean_operator"
3252 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
3253 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3255 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3261 [(set_attr "type" "compare")
3262 (set_attr "length" "4,8")])
3265 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3266 (compare:CC (match_operator:SI 4 "boolean_operator"
3267 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3268 (match_operand:SI 2 "gpc_reg_operand" "")])
3270 (set (match_operand:SI 0 "gpc_reg_operand" "")
3272 "TARGET_32BIT && reload_completed"
3273 [(set (match_dup 0) (match_dup 4))
3275 (compare:CC (match_dup 0)
3279 (define_insn "*boolccsi3_internal1"
3280 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3281 (match_operator:SI 3 "boolean_operator"
3282 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
3283 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))]))]
3287 (define_insn "*boolccsi3_internal2"
3288 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3289 (compare:CC (match_operator:SI 4 "boolean_operator"
3290 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
3291 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
3293 (clobber (match_scratch:SI 3 "=r,r"))]
3298 [(set_attr "type" "compare")
3299 (set_attr "length" "4,8")])
3302 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3303 (compare:CC (match_operator:SI 4 "boolean_operator"
3304 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3305 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
3307 (clobber (match_scratch:SI 3 ""))]
3308 "TARGET_32BIT && reload_completed"
3309 [(set (match_dup 3) (match_dup 4))
3311 (compare:CC (match_dup 3)
3315 (define_insn "*boolccsi3_internal3"
3316 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3317 (compare:CC (match_operator:SI 4 "boolean_operator"
3318 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
3319 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
3321 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3327 [(set_attr "type" "compare")
3328 (set_attr "length" "4,8")])
3331 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3332 (compare:CC (match_operator:SI 4 "boolean_operator"
3333 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3334 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
3336 (set (match_operand:SI 0 "gpc_reg_operand" "")
3338 "TARGET_32BIT && reload_completed"
3339 [(set (match_dup 0) (match_dup 4))
3341 (compare:CC (match_dup 0)
3345 ;; maskir insn. We need four forms because things might be in arbitrary
3346 ;; orders. Don't define forms that only set CR fields because these
3347 ;; would modify an input register.
3349 (define_insn "*maskir_internal1"
3350 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3351 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
3352 (match_operand:SI 1 "gpc_reg_operand" "0"))
3353 (and:SI (match_dup 2)
3354 (match_operand:SI 3 "gpc_reg_operand" "r"))))]
3358 (define_insn "*maskir_internal2"
3359 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3360 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
3361 (match_operand:SI 1 "gpc_reg_operand" "0"))
3362 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3367 (define_insn "*maskir_internal3"
3368 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3369 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r")
3370 (match_operand:SI 3 "gpc_reg_operand" "r"))
3371 (and:SI (not:SI (match_dup 2))
3372 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
3376 (define_insn "*maskir_internal4"
3377 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3378 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3379 (match_operand:SI 2 "gpc_reg_operand" "r"))
3380 (and:SI (not:SI (match_dup 2))
3381 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
3385 (define_insn "*maskir_internal5"
3386 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3388 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3389 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
3390 (and:SI (match_dup 2)
3391 (match_operand:SI 3 "gpc_reg_operand" "r,r")))
3393 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3394 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3395 (and:SI (match_dup 2) (match_dup 3))))]
3400 [(set_attr "type" "compare")
3401 (set_attr "length" "4,8")])
3404 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3406 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
3407 (match_operand:SI 1 "gpc_reg_operand" ""))
3408 (and:SI (match_dup 2)
3409 (match_operand:SI 3 "gpc_reg_operand" "")))
3411 (set (match_operand:SI 0 "gpc_reg_operand" "")
3412 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3413 (and:SI (match_dup 2) (match_dup 3))))]
3414 "TARGET_POWER && reload_completed"
3416 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3417 (and:SI (match_dup 2) (match_dup 3))))
3419 (compare:CC (match_dup 0)
3423 (define_insn "*maskir_internal6"
3424 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3426 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3427 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
3428 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
3431 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3432 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3433 (and:SI (match_dup 3) (match_dup 2))))]
3438 [(set_attr "type" "compare")
3439 (set_attr "length" "4,8")])
3442 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3444 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
3445 (match_operand:SI 1 "gpc_reg_operand" ""))
3446 (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
3449 (set (match_operand:SI 0 "gpc_reg_operand" "")
3450 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3451 (and:SI (match_dup 3) (match_dup 2))))]
3452 "TARGET_POWER && reload_completed"
3454 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3455 (and:SI (match_dup 3) (match_dup 2))))
3457 (compare:CC (match_dup 0)
3461 (define_insn "*maskir_internal7"
3462 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3464 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r,r")
3465 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
3466 (and:SI (not:SI (match_dup 2))
3467 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
3469 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3470 (ior:SI (and:SI (match_dup 2) (match_dup 3))
3471 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3476 [(set_attr "type" "compare")
3477 (set_attr "length" "4,8")])
3480 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3482 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "")
3483 (match_operand:SI 3 "gpc_reg_operand" ""))
3484 (and:SI (not:SI (match_dup 2))
3485 (match_operand:SI 1 "gpc_reg_operand" "")))
3487 (set (match_operand:SI 0 "gpc_reg_operand" "")
3488 (ior:SI (and:SI (match_dup 2) (match_dup 3))
3489 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3490 "TARGET_POWER && reload_completed"
3492 (ior:SI (and:SI (match_dup 2) (match_dup 3))
3493 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
3495 (compare:CC (match_dup 0)
3499 (define_insn "*maskir_internal8"
3500 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3502 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
3503 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3504 (and:SI (not:SI (match_dup 2))
3505 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
3507 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3508 (ior:SI (and:SI (match_dup 3) (match_dup 2))
3509 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3514 [(set_attr "type" "compare")
3515 (set_attr "length" "4,8")])
3518 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3520 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
3521 (match_operand:SI 2 "gpc_reg_operand" ""))
3522 (and:SI (not:SI (match_dup 2))
3523 (match_operand:SI 1 "gpc_reg_operand" "")))
3525 (set (match_operand:SI 0 "gpc_reg_operand" "")
3526 (ior:SI (and:SI (match_dup 3) (match_dup 2))
3527 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3528 "TARGET_POWER && reload_completed"
3530 (ior:SI (and:SI (match_dup 3) (match_dup 2))
3531 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
3533 (compare:CC (match_dup 0)
3537 ;; Rotate and shift insns, in all their variants. These support shifts,
3538 ;; field inserts and extracts, and various combinations thereof.
3539 (define_expand "insv"
3540 [(set (zero_extract (match_operand 0 "gpc_reg_operand" "")
3541 (match_operand:SI 1 "const_int_operand" "")
3542 (match_operand:SI 2 "const_int_operand" ""))
3543 (match_operand 3 "gpc_reg_operand" ""))]
3547 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3548 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3549 compiler if the address of the structure is taken later. Likewise, do
3550 not handle invalid E500 subregs. */
3551 if (GET_CODE (operands[0]) == SUBREG
3552 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD
3553 || ((TARGET_E500_DOUBLE || TARGET_SPE)
3554 && invalid_e500_subreg (operands[0], GET_MODE (operands[0])))))
3557 if (TARGET_POWERPC64 && GET_MODE (operands[0]) == DImode)
3558 emit_insn (gen_insvdi (operands[0], operands[1], operands[2], operands[3]));
3560 emit_insn (gen_insvsi (operands[0], operands[1], operands[2], operands[3]));
3564 (define_insn "insvsi"
3565 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3566 (match_operand:SI 1 "const_int_operand" "i")
3567 (match_operand:SI 2 "const_int_operand" "i"))
3568 (match_operand:SI 3 "gpc_reg_operand" "r"))]
3572 int start = INTVAL (operands[2]) & 31;
3573 int size = INTVAL (operands[1]) & 31;
3575 operands[4] = GEN_INT (32 - start - size);
3576 operands[1] = GEN_INT (start + size - 1);
3577 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3579 [(set_attr "type" "insert_word")])
3581 (define_insn "*insvsi_internal1"
3582 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3583 (match_operand:SI 1 "const_int_operand" "i")
3584 (match_operand:SI 2 "const_int_operand" "i"))
3585 (rotate:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3586 (match_operand:SI 4 "const_int_operand" "i")))]
3587 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3590 int shift = INTVAL (operands[4]) & 31;
3591 int start = INTVAL (operands[2]) & 31;
3592 int size = INTVAL (operands[1]) & 31;
3594 operands[4] = GEN_INT (shift - start - size);
3595 operands[1] = GEN_INT (start + size - 1);
3596 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3598 [(set_attr "type" "insert_word")])
3600 (define_insn "*insvsi_internal2"
3601 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3602 (match_operand:SI 1 "const_int_operand" "i")
3603 (match_operand:SI 2 "const_int_operand" "i"))
3604 (ashiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3605 (match_operand:SI 4 "const_int_operand" "i")))]
3606 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3609 int shift = INTVAL (operands[4]) & 31;
3610 int start = INTVAL (operands[2]) & 31;
3611 int size = INTVAL (operands[1]) & 31;
3613 operands[4] = GEN_INT (32 - shift - start - size);
3614 operands[1] = GEN_INT (start + size - 1);
3615 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3617 [(set_attr "type" "insert_word")])
3619 (define_insn "*insvsi_internal3"
3620 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3621 (match_operand:SI 1 "const_int_operand" "i")
3622 (match_operand:SI 2 "const_int_operand" "i"))
3623 (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3624 (match_operand:SI 4 "const_int_operand" "i")))]
3625 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3628 int shift = INTVAL (operands[4]) & 31;
3629 int start = INTVAL (operands[2]) & 31;
3630 int size = INTVAL (operands[1]) & 31;
3632 operands[4] = GEN_INT (32 - shift - start - size);
3633 operands[1] = GEN_INT (start + size - 1);
3634 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3636 [(set_attr "type" "insert_word")])
3638 (define_insn "*insvsi_internal4"
3639 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3640 (match_operand:SI 1 "const_int_operand" "i")
3641 (match_operand:SI 2 "const_int_operand" "i"))
3642 (zero_extract:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3643 (match_operand:SI 4 "const_int_operand" "i")
3644 (match_operand:SI 5 "const_int_operand" "i")))]
3645 "INTVAL (operands[4]) >= INTVAL (operands[1])"
3648 int extract_start = INTVAL (operands[5]) & 31;
3649 int extract_size = INTVAL (operands[4]) & 31;
3650 int insert_start = INTVAL (operands[2]) & 31;
3651 int insert_size = INTVAL (operands[1]) & 31;
3653 /* Align extract field with insert field */
3654 operands[5] = GEN_INT (extract_start + extract_size - insert_start - insert_size);
3655 operands[1] = GEN_INT (insert_start + insert_size - 1);
3656 return \"{rlimi|rlwimi} %0,%3,%h5,%h2,%h1\";
3658 [(set_attr "type" "insert_word")])
3660 ;; combine patterns for rlwimi
3661 (define_insn "*insvsi_internal5"
3662 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3663 (ior:SI (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
3664 (match_operand:SI 1 "mask_operand" "i"))
3665 (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3666 (match_operand:SI 2 "const_int_operand" "i"))
3667 (match_operand:SI 5 "mask_operand" "i"))))]
3668 "TARGET_POWERPC && INTVAL(operands[1]) == ~INTVAL(operands[5])"
3671 int me = extract_ME(operands[5]);
3672 int mb = extract_MB(operands[5]);
3673 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
3674 operands[2] = GEN_INT(mb);
3675 operands[1] = GEN_INT(me);
3676 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3678 [(set_attr "type" "insert_word")])
3680 (define_insn "*insvsi_internal6"
3681 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3682 (ior:SI (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3683 (match_operand:SI 2 "const_int_operand" "i"))
3684 (match_operand:SI 5 "mask_operand" "i"))
3685 (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
3686 (match_operand:SI 1 "mask_operand" "i"))))]
3687 "TARGET_POWERPC && INTVAL(operands[1]) == ~INTVAL(operands[5])"
3690 int me = extract_ME(operands[5]);
3691 int mb = extract_MB(operands[5]);
3692 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
3693 operands[2] = GEN_INT(mb);
3694 operands[1] = GEN_INT(me);
3695 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3697 [(set_attr "type" "insert_word")])
3699 (define_insn "insvdi"
3700 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3701 (match_operand:SI 1 "const_int_operand" "i")
3702 (match_operand:SI 2 "const_int_operand" "i"))
3703 (match_operand:DI 3 "gpc_reg_operand" "r"))]
3707 int start = INTVAL (operands[2]) & 63;
3708 int size = INTVAL (operands[1]) & 63;
3710 operands[1] = GEN_INT (64 - start - size);
3711 return \"rldimi %0,%3,%H1,%H2\";
3713 [(set_attr "type" "insert_dword")])
3715 (define_insn "*insvdi_internal2"
3716 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3717 (match_operand:SI 1 "const_int_operand" "i")
3718 (match_operand:SI 2 "const_int_operand" "i"))
3719 (ashiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
3720 (match_operand:SI 4 "const_int_operand" "i")))]
3722 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
3725 int shift = INTVAL (operands[4]) & 63;
3726 int start = (INTVAL (operands[2]) & 63) - 32;
3727 int size = INTVAL (operands[1]) & 63;
3729 operands[4] = GEN_INT (64 - shift - start - size);
3730 operands[2] = GEN_INT (start);
3731 operands[1] = GEN_INT (start + size - 1);
3732 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3735 (define_insn "*insvdi_internal3"
3736 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3737 (match_operand:SI 1 "const_int_operand" "i")
3738 (match_operand:SI 2 "const_int_operand" "i"))
3739 (lshiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
3740 (match_operand:SI 4 "const_int_operand" "i")))]
3742 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
3745 int shift = INTVAL (operands[4]) & 63;
3746 int start = (INTVAL (operands[2]) & 63) - 32;
3747 int size = INTVAL (operands[1]) & 63;
3749 operands[4] = GEN_INT (64 - shift - start - size);
3750 operands[2] = GEN_INT (start);
3751 operands[1] = GEN_INT (start + size - 1);
3752 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3755 (define_expand "extzv"
3756 [(set (match_operand 0 "gpc_reg_operand" "")
3757 (zero_extract (match_operand 1 "gpc_reg_operand" "")
3758 (match_operand:SI 2 "const_int_operand" "")
3759 (match_operand:SI 3 "const_int_operand" "")))]
3763 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3764 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3765 compiler if the address of the structure is taken later. */
3766 if (GET_CODE (operands[0]) == SUBREG
3767 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
3770 if (TARGET_POWERPC64 && GET_MODE (operands[1]) == DImode)
3771 emit_insn (gen_extzvdi (operands[0], operands[1], operands[2], operands[3]));
3773 emit_insn (gen_extzvsi (operands[0], operands[1], operands[2], operands[3]));
3777 (define_insn "extzvsi"
3778 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3779 (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3780 (match_operand:SI 2 "const_int_operand" "i")
3781 (match_operand:SI 3 "const_int_operand" "i")))]
3785 int start = INTVAL (operands[3]) & 31;
3786 int size = INTVAL (operands[2]) & 31;
3788 if (start + size >= 32)
3789 operands[3] = const0_rtx;
3791 operands[3] = GEN_INT (start + size);
3792 return \"{rlinm|rlwinm} %0,%1,%3,%s2,31\";
3795 (define_insn "*extzvsi_internal1"
3796 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3797 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3798 (match_operand:SI 2 "const_int_operand" "i,i")
3799 (match_operand:SI 3 "const_int_operand" "i,i"))
3801 (clobber (match_scratch:SI 4 "=r,r"))]
3805 int start = INTVAL (operands[3]) & 31;
3806 int size = INTVAL (operands[2]) & 31;
3808 /* Force split for non-cc0 compare. */
3809 if (which_alternative == 1)
3812 /* If the bit-field being tested fits in the upper or lower half of a
3813 word, it is possible to use andiu. or andil. to test it. This is
3814 useful because the condition register set-use delay is smaller for
3815 andi[ul]. than for rlinm. This doesn't work when the starting bit
3816 position is 0 because the LT and GT bits may be set wrong. */
3818 if ((start > 0 && start + size <= 16) || start >= 16)
3820 operands[3] = GEN_INT (((1 << (16 - (start & 15)))
3821 - (1 << (16 - (start & 15) - size))));
3823 return \"{andiu.|andis.} %4,%1,%3\";
3825 return \"{andil.|andi.} %4,%1,%3\";
3828 if (start + size >= 32)
3829 operands[3] = const0_rtx;
3831 operands[3] = GEN_INT (start + size);
3832 return \"{rlinm.|rlwinm.} %4,%1,%3,%s2,31\";
3834 [(set_attr "type" "delayed_compare")
3835 (set_attr "length" "4,8")])
3838 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3839 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3840 (match_operand:SI 2 "const_int_operand" "")
3841 (match_operand:SI 3 "const_int_operand" ""))
3843 (clobber (match_scratch:SI 4 ""))]
3846 (zero_extract:SI (match_dup 1) (match_dup 2)
3849 (compare:CC (match_dup 4)
3853 (define_insn "*extzvsi_internal2"
3854 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3855 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3856 (match_operand:SI 2 "const_int_operand" "i,i")
3857 (match_operand:SI 3 "const_int_operand" "i,i"))
3859 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3860 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3864 int start = INTVAL (operands[3]) & 31;
3865 int size = INTVAL (operands[2]) & 31;
3867 /* Force split for non-cc0 compare. */
3868 if (which_alternative == 1)
3871 /* Since we are using the output value, we can't ignore any need for
3872 a shift. The bit-field must end at the LSB. */
3873 if (start >= 16 && start + size == 32)
3875 operands[3] = GEN_INT ((1 << size) - 1);
3876 return \"{andil.|andi.} %0,%1,%3\";
3879 if (start + size >= 32)
3880 operands[3] = const0_rtx;
3882 operands[3] = GEN_INT (start + size);
3883 return \"{rlinm.|rlwinm.} %0,%1,%3,%s2,31\";
3885 [(set_attr "type" "delayed_compare")
3886 (set_attr "length" "4,8")])
3889 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
3890 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3891 (match_operand:SI 2 "const_int_operand" "")
3892 (match_operand:SI 3 "const_int_operand" ""))
3894 (set (match_operand:SI 0 "gpc_reg_operand" "")
3895 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3898 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))
3900 (compare:CC (match_dup 0)
3904 (define_insn "extzvdi"
3905 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
3906 (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3907 (match_operand:SI 2 "const_int_operand" "i")
3908 (match_operand:SI 3 "const_int_operand" "i")))]
3912 int start = INTVAL (operands[3]) & 63;
3913 int size = INTVAL (operands[2]) & 63;
3915 if (start + size >= 64)
3916 operands[3] = const0_rtx;
3918 operands[3] = GEN_INT (start + size);
3919 operands[2] = GEN_INT (64 - size);
3920 return \"rldicl %0,%1,%3,%2\";
3923 (define_insn "*extzvdi_internal1"
3924 [(set (match_operand:CC 0 "gpc_reg_operand" "=x")
3925 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3926 (match_operand:SI 2 "const_int_operand" "i")
3927 (match_operand:SI 3 "const_int_operand" "i"))
3929 (clobber (match_scratch:DI 4 "=r"))]
3930 "TARGET_64BIT && rs6000_gen_cell_microcode"
3933 int start = INTVAL (operands[3]) & 63;
3934 int size = INTVAL (operands[2]) & 63;
3936 if (start + size >= 64)
3937 operands[3] = const0_rtx;
3939 operands[3] = GEN_INT (start + size);
3940 operands[2] = GEN_INT (64 - size);
3941 return \"rldicl. %4,%1,%3,%2\";
3943 [(set_attr "type" "compare")])
3945 (define_insn "*extzvdi_internal2"
3946 [(set (match_operand:CC 4 "gpc_reg_operand" "=x")
3947 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3948 (match_operand:SI 2 "const_int_operand" "i")
3949 (match_operand:SI 3 "const_int_operand" "i"))
3951 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
3952 (zero_extract:DI (match_dup 1) (match_dup 2) (match_dup 3)))]
3953 "TARGET_64BIT && rs6000_gen_cell_microcode"
3956 int start = INTVAL (operands[3]) & 63;
3957 int size = INTVAL (operands[2]) & 63;
3959 if (start + size >= 64)
3960 operands[3] = const0_rtx;
3962 operands[3] = GEN_INT (start + size);
3963 operands[2] = GEN_INT (64 - size);
3964 return \"rldicl. %0,%1,%3,%2\";
3966 [(set_attr "type" "compare")])
3968 (define_insn "rotlsi3"
3969 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3970 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3971 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
3974 {rlnm|rlwnm} %0,%1,%2,0xffffffff
3975 {rlinm|rlwinm} %0,%1,%h2,0xffffffff"
3976 [(set_attr "type" "var_shift_rotate,integer")])
3978 (define_insn "*rotlsi3_internal2"
3979 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3980 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3981 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3983 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
3986 {rlnm.|rlwnm.} %3,%1,%2,0xffffffff
3987 {rlinm.|rlwinm.} %3,%1,%h2,0xffffffff
3990 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3991 (set_attr "length" "4,4,8,8")])
3994 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3995 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3996 (match_operand:SI 2 "reg_or_cint_operand" ""))
3998 (clobber (match_scratch:SI 3 ""))]
4001 (rotate:SI (match_dup 1) (match_dup 2)))
4003 (compare:CC (match_dup 3)
4007 (define_insn "*rotlsi3_internal3"
4008 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4009 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4010 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4012 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4013 (rotate:SI (match_dup 1) (match_dup 2)))]
4016 {rlnm.|rlwnm.} %0,%1,%2,0xffffffff
4017 {rlinm.|rlwinm.} %0,%1,%h2,0xffffffff
4020 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4021 (set_attr "length" "4,4,8,8")])
4024 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4025 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4026 (match_operand:SI 2 "reg_or_cint_operand" ""))
4028 (set (match_operand:SI 0 "gpc_reg_operand" "")
4029 (rotate:SI (match_dup 1) (match_dup 2)))]
4032 (rotate:SI (match_dup 1) (match_dup 2)))
4034 (compare:CC (match_dup 0)
4038 (define_insn "*rotlsi3_internal4"
4039 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4040 (and:SI (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4041 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
4042 (match_operand:SI 3 "mask_operand" "n,n")))]
4045 {rlnm|rlwnm} %0,%1,%2,%m3,%M3
4046 {rlinm|rlwinm} %0,%1,%h2,%m3,%M3"
4047 [(set_attr "type" "var_shift_rotate,integer")])
4049 (define_insn "*rotlsi3_internal5"
4050 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4052 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4053 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4054 (match_operand:SI 3 "mask_operand" "n,n,n,n"))
4056 (clobber (match_scratch:SI 4 "=r,r,r,r"))]
4059 {rlnm.|rlwnm.} %4,%1,%2,%m3,%M3
4060 {rlinm.|rlwinm.} %4,%1,%h2,%m3,%M3
4063 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4064 (set_attr "length" "4,4,8,8")])
4067 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4069 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4070 (match_operand:SI 2 "reg_or_cint_operand" ""))
4071 (match_operand:SI 3 "mask_operand" ""))
4073 (clobber (match_scratch:SI 4 ""))]
4076 (and:SI (rotate:SI (match_dup 1)
4080 (compare:CC (match_dup 4)
4084 (define_insn "*rotlsi3_internal6"
4085 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
4087 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4088 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4089 (match_operand:SI 3 "mask_operand" "n,n,n,n"))
4091 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4092 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4095 {rlnm.|rlwnm.} %0,%1,%2,%m3,%M3
4096 {rlinm.|rlwinm.} %0,%1,%h2,%m3,%M3
4099 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4100 (set_attr "length" "4,4,8,8")])
4103 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
4105 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4106 (match_operand:SI 2 "reg_or_cint_operand" ""))
4107 (match_operand:SI 3 "mask_operand" ""))
4109 (set (match_operand:SI 0 "gpc_reg_operand" "")
4110 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4113 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4115 (compare:CC (match_dup 0)
4119 (define_insn "*rotlsi3_internal7"
4120 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4123 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4124 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
4126 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xff"
4127 [(set (attr "cell_micro")
4128 (if_then_else (match_operand:SI 2 "const_int_operand" "")
4129 (const_string "not")
4130 (const_string "always")))])
4132 (define_insn "*rotlsi3_internal8"
4133 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4134 (compare:CC (zero_extend:SI
4136 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4137 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4139 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4142 {rlnm.|rlwnm.} %3,%1,%2,0xff
4143 {rlinm.|rlwinm.} %3,%1,%h2,0xff
4146 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4147 (set_attr "length" "4,4,8,8")])
4150 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4151 (compare:CC (zero_extend:SI
4153 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4154 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4156 (clobber (match_scratch:SI 3 ""))]
4159 (zero_extend:SI (subreg:QI
4160 (rotate:SI (match_dup 1)
4163 (compare:CC (match_dup 3)
4167 (define_insn "*rotlsi3_internal9"
4168 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4169 (compare:CC (zero_extend:SI
4171 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4172 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4174 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4175 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4178 {rlnm.|rlwnm.} %0,%1,%2,0xff
4179 {rlinm.|rlwinm.} %0,%1,%h2,0xff
4182 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4183 (set_attr "length" "4,4,8,8")])
4186 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4187 (compare:CC (zero_extend:SI
4189 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4190 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4192 (set (match_operand:SI 0 "gpc_reg_operand" "")
4193 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4196 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
4198 (compare:CC (match_dup 0)
4202 (define_insn "*rotlsi3_internal10"
4203 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4206 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4207 (match_operand:SI 2 "reg_or_cint_operand" "r,i")) 0)))]
4210 {rlnm|rlwnm} %0,%1,%2,0xffff
4211 {rlinm|rlwinm} %0,%1,%h2,0xffff"
4212 [(set_attr "type" "var_shift_rotate,integer")])
4215 (define_insn "*rotlsi3_internal11"
4216 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4217 (compare:CC (zero_extend:SI
4219 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4220 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4222 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4225 {rlnm.|rlwnm.} %3,%1,%2,0xffff
4226 {rlinm.|rlwinm.} %3,%1,%h2,0xffff
4229 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4230 (set_attr "length" "4,4,8,8")])
4233 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4234 (compare:CC (zero_extend:SI
4236 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4237 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4239 (clobber (match_scratch:SI 3 ""))]
4242 (zero_extend:SI (subreg:HI
4243 (rotate:SI (match_dup 1)
4246 (compare:CC (match_dup 3)
4250 (define_insn "*rotlsi3_internal12"
4251 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4252 (compare:CC (zero_extend:SI
4254 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4255 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4257 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4258 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4261 {rlnm.|rlwnm.} %0,%1,%2,0xffff
4262 {rlinm.|rlwinm.} %0,%1,%h2,0xffff
4265 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4266 (set_attr "length" "4,4,8,8")])
4269 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4270 (compare:CC (zero_extend:SI
4272 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4273 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4275 (set (match_operand:SI 0 "gpc_reg_operand" "")
4276 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4279 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
4281 (compare:CC (match_dup 0)
4285 ;; Note that we use "sle." instead of "sl." so that we can set
4286 ;; SHIFT_COUNT_TRUNCATED.
4288 (define_expand "ashlsi3"
4289 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
4290 (use (match_operand:SI 1 "gpc_reg_operand" ""))
4291 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
4296 emit_insn (gen_ashlsi3_power (operands[0], operands[1], operands[2]));
4298 emit_insn (gen_ashlsi3_no_power (operands[0], operands[1], operands[2]));
4302 (define_insn "ashlsi3_power"
4303 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4304 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4305 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
4306 (clobber (match_scratch:SI 3 "=q,X"))]
4310 {sli|slwi} %0,%1,%h2")
4312 (define_insn "ashlsi3_no_power"
4313 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4314 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4315 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
4319 {sli|slwi} %0,%1,%h2"
4320 [(set_attr "type" "var_shift_rotate,shift")])
4323 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4324 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4325 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4327 (clobber (match_scratch:SI 3 "=r,r,r,r"))
4328 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4332 {sli.|slwi.} %3,%1,%h2
4335 [(set_attr "type" "delayed_compare")
4336 (set_attr "length" "4,4,8,8")])
4339 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4340 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4341 (match_operand:SI 2 "reg_or_cint_operand" ""))
4343 (clobber (match_scratch:SI 3 ""))
4344 (clobber (match_scratch:SI 4 ""))]
4345 "TARGET_POWER && reload_completed"
4346 [(parallel [(set (match_dup 3)
4347 (ashift:SI (match_dup 1) (match_dup 2)))
4348 (clobber (match_dup 4))])
4350 (compare:CC (match_dup 3)
4355 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4356 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4357 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4359 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4360 "! TARGET_POWER && TARGET_32BIT"
4363 {sli.|slwi.} %3,%1,%h2
4366 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4367 (set_attr "length" "4,4,8,8")])
4370 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4371 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4372 (match_operand:SI 2 "reg_or_cint_operand" ""))
4374 (clobber (match_scratch:SI 3 ""))]
4375 "! TARGET_POWER && TARGET_32BIT && reload_completed"
4377 (ashift:SI (match_dup 1) (match_dup 2)))
4379 (compare:CC (match_dup 3)
4384 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4385 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4386 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4388 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4389 (ashift:SI (match_dup 1) (match_dup 2)))
4390 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4394 {sli.|slwi.} %0,%1,%h2
4397 [(set_attr "type" "delayed_compare")
4398 (set_attr "length" "4,4,8,8")])
4401 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4402 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4403 (match_operand:SI 2 "reg_or_cint_operand" ""))
4405 (set (match_operand:SI 0 "gpc_reg_operand" "")
4406 (ashift:SI (match_dup 1) (match_dup 2)))
4407 (clobber (match_scratch:SI 4 ""))]
4408 "TARGET_POWER && reload_completed"
4409 [(parallel [(set (match_dup 0)
4410 (ashift:SI (match_dup 1) (match_dup 2)))
4411 (clobber (match_dup 4))])
4413 (compare:CC (match_dup 0)
4418 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4419 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4420 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4422 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4423 (ashift:SI (match_dup 1) (match_dup 2)))]
4424 "! TARGET_POWER && TARGET_32BIT"
4427 {sli.|slwi.} %0,%1,%h2
4430 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4431 (set_attr "length" "4,4,8,8")])
4434 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4435 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4436 (match_operand:SI 2 "reg_or_cint_operand" ""))
4438 (set (match_operand:SI 0 "gpc_reg_operand" "")
4439 (ashift:SI (match_dup 1) (match_dup 2)))]
4440 "! TARGET_POWER && TARGET_32BIT && reload_completed"
4442 (ashift:SI (match_dup 1) (match_dup 2)))
4444 (compare:CC (match_dup 0)
4448 (define_insn "rlwinm"
4449 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4450 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4451 (match_operand:SI 2 "const_int_operand" "i"))
4452 (match_operand:SI 3 "mask_operand" "n")))]
4453 "includes_lshift_p (operands[2], operands[3])"
4454 "{rlinm|rlwinm} %0,%1,%h2,%m3,%M3")
4457 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4459 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4460 (match_operand:SI 2 "const_int_operand" "i,i"))
4461 (match_operand:SI 3 "mask_operand" "n,n"))
4463 (clobber (match_scratch:SI 4 "=r,r"))]
4464 "includes_lshift_p (operands[2], operands[3])"
4466 {rlinm.|rlwinm.} %4,%1,%h2,%m3,%M3
4468 [(set_attr "type" "delayed_compare")
4469 (set_attr "length" "4,8")])
4472 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4474 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4475 (match_operand:SI 2 "const_int_operand" ""))
4476 (match_operand:SI 3 "mask_operand" ""))
4478 (clobber (match_scratch:SI 4 ""))]
4479 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
4481 (and:SI (ashift:SI (match_dup 1) (match_dup 2))
4484 (compare:CC (match_dup 4)
4489 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4491 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4492 (match_operand:SI 2 "const_int_operand" "i,i"))
4493 (match_operand:SI 3 "mask_operand" "n,n"))
4495 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4496 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4497 "includes_lshift_p (operands[2], operands[3])"
4499 {rlinm.|rlwinm.} %0,%1,%h2,%m3,%M3
4501 [(set_attr "type" "delayed_compare")
4502 (set_attr "length" "4,8")])
4505 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
4507 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4508 (match_operand:SI 2 "const_int_operand" ""))
4509 (match_operand:SI 3 "mask_operand" ""))
4511 (set (match_operand:SI 0 "gpc_reg_operand" "")
4512 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4513 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
4515 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4517 (compare:CC (match_dup 0)
4521 ;; The AIX assembler mis-handles "sri x,x,0", so write that case as
4523 (define_expand "lshrsi3"
4524 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
4525 (use (match_operand:SI 1 "gpc_reg_operand" ""))
4526 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
4531 emit_insn (gen_lshrsi3_power (operands[0], operands[1], operands[2]));
4533 emit_insn (gen_lshrsi3_no_power (operands[0], operands[1], operands[2]));
4537 (define_insn "lshrsi3_power"
4538 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
4539 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
4540 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i")))
4541 (clobber (match_scratch:SI 3 "=q,X,X"))]
4546 {s%A2i|s%A2wi} %0,%1,%h2")
4548 (define_insn "lshrsi3_no_power"
4549 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
4550 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
4551 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i")))]
4556 {sri|srwi} %0,%1,%h2"
4557 [(set_attr "type" "integer,var_shift_rotate,shift")])
4560 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,?y,?y,?y")
4561 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
4562 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
4564 (clobber (match_scratch:SI 3 "=r,X,r,r,X,r"))
4565 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
4570 {s%A2i.|s%A2wi.} %3,%1,%h2
4574 [(set_attr "type" "delayed_compare")
4575 (set_attr "length" "4,4,4,8,8,8")])
4578 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4579 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4580 (match_operand:SI 2 "reg_or_cint_operand" ""))
4582 (clobber (match_scratch:SI 3 ""))
4583 (clobber (match_scratch:SI 4 ""))]
4584 "TARGET_POWER && reload_completed"
4585 [(parallel [(set (match_dup 3)
4586 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4587 (clobber (match_dup 4))])
4589 (compare:CC (match_dup 3)
4594 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,?y,?y,?y")
4595 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
4596 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i,O,r,i"))
4598 (clobber (match_scratch:SI 3 "=X,r,r,X,r,r"))]
4599 "! TARGET_POWER && TARGET_32BIT"
4603 {sri.|srwi.} %3,%1,%h2
4607 [(set_attr "type" "delayed_compare,var_delayed_compare,delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4608 (set_attr "length" "4,4,4,8,8,8")])
4611 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4612 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4613 (match_operand:SI 2 "reg_or_cint_operand" ""))
4615 (clobber (match_scratch:SI 3 ""))]
4616 "! TARGET_POWER && TARGET_32BIT && reload_completed"
4618 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4620 (compare:CC (match_dup 3)
4625 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,?y,?y,?y")
4626 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
4627 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
4629 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
4630 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4631 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
4636 {s%A2i.|s%A2wi.} %0,%1,%h2
4640 [(set_attr "type" "delayed_compare")
4641 (set_attr "length" "4,4,4,8,8,8")])
4644 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4645 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4646 (match_operand:SI 2 "reg_or_cint_operand" ""))
4648 (set (match_operand:SI 0 "gpc_reg_operand" "")
4649 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4650 (clobber (match_scratch:SI 4 ""))]
4651 "TARGET_POWER && reload_completed"
4652 [(parallel [(set (match_dup 0)
4653 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4654 (clobber (match_dup 4))])
4656 (compare:CC (match_dup 0)
4661 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,?y,?y,?y")
4662 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
4663 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i,O,r,i"))
4665 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
4666 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
4667 "! TARGET_POWER && TARGET_32BIT"
4671 {sri.|srwi.} %0,%1,%h2
4675 [(set_attr "type" "delayed_compare,var_delayed_compare,delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4676 (set_attr "length" "4,4,4,8,8,8")])
4679 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4680 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4681 (match_operand:SI 2 "reg_or_cint_operand" ""))
4683 (set (match_operand:SI 0 "gpc_reg_operand" "")
4684 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
4685 "! TARGET_POWER && TARGET_32BIT && reload_completed"
4687 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4689 (compare:CC (match_dup 0)
4694 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4695 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4696 (match_operand:SI 2 "const_int_operand" "i"))
4697 (match_operand:SI 3 "mask_operand" "n")))]
4698 "includes_rshift_p (operands[2], operands[3])"
4699 "{rlinm|rlwinm} %0,%1,%s2,%m3,%M3")
4702 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4704 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4705 (match_operand:SI 2 "const_int_operand" "i,i"))
4706 (match_operand:SI 3 "mask_operand" "n,n"))
4708 (clobber (match_scratch:SI 4 "=r,r"))]
4709 "includes_rshift_p (operands[2], operands[3])"
4711 {rlinm.|rlwinm.} %4,%1,%s2,%m3,%M3
4713 [(set_attr "type" "delayed_compare")
4714 (set_attr "length" "4,8")])
4717 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4719 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4720 (match_operand:SI 2 "const_int_operand" ""))
4721 (match_operand:SI 3 "mask_operand" ""))
4723 (clobber (match_scratch:SI 4 ""))]
4724 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
4726 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2))
4729 (compare:CC (match_dup 4)
4734 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4736 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4737 (match_operand:SI 2 "const_int_operand" "i,i"))
4738 (match_operand:SI 3 "mask_operand" "n,n"))
4740 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4741 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4742 "includes_rshift_p (operands[2], operands[3])"
4744 {rlinm.|rlwinm.} %0,%1,%s2,%m3,%M3
4746 [(set_attr "type" "delayed_compare")
4747 (set_attr "length" "4,8")])
4750 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
4752 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4753 (match_operand:SI 2 "const_int_operand" ""))
4754 (match_operand:SI 3 "mask_operand" ""))
4756 (set (match_operand:SI 0 "gpc_reg_operand" "")
4757 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4758 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
4760 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4762 (compare:CC (match_dup 0)
4767 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4770 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4771 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4772 "includes_rshift_p (operands[2], GEN_INT (255))"
4773 "{rlinm|rlwinm} %0,%1,%s2,0xff")
4776 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4780 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4781 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4783 (clobber (match_scratch:SI 3 "=r,r"))]
4784 "includes_rshift_p (operands[2], GEN_INT (255))"
4786 {rlinm.|rlwinm.} %3,%1,%s2,0xff
4788 [(set_attr "type" "delayed_compare")
4789 (set_attr "length" "4,8")])
4792 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4796 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4797 (match_operand:SI 2 "const_int_operand" "")) 0))
4799 (clobber (match_scratch:SI 3 ""))]
4800 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4802 (zero_extend:SI (subreg:QI
4803 (lshiftrt:SI (match_dup 1)
4806 (compare:CC (match_dup 3)
4811 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4815 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4816 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4818 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4819 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4820 "includes_rshift_p (operands[2], GEN_INT (255))"
4822 {rlinm.|rlwinm.} %0,%1,%s2,0xff
4824 [(set_attr "type" "delayed_compare")
4825 (set_attr "length" "4,8")])
4828 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4832 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4833 (match_operand:SI 2 "const_int_operand" "")) 0))
4835 (set (match_operand:SI 0 "gpc_reg_operand" "")
4836 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4837 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4839 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4841 (compare:CC (match_dup 0)
4846 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4849 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4850 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4851 "includes_rshift_p (operands[2], GEN_INT (65535))"
4852 "{rlinm|rlwinm} %0,%1,%s2,0xffff")
4855 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4859 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4860 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4862 (clobber (match_scratch:SI 3 "=r,r"))]
4863 "includes_rshift_p (operands[2], GEN_INT (65535))"
4865 {rlinm.|rlwinm.} %3,%1,%s2,0xffff
4867 [(set_attr "type" "delayed_compare")
4868 (set_attr "length" "4,8")])
4871 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4875 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4876 (match_operand:SI 2 "const_int_operand" "")) 0))
4878 (clobber (match_scratch:SI 3 ""))]
4879 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4881 (zero_extend:SI (subreg:HI
4882 (lshiftrt:SI (match_dup 1)
4885 (compare:CC (match_dup 3)
4890 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4894 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4895 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4897 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4898 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4899 "includes_rshift_p (operands[2], GEN_INT (65535))"
4901 {rlinm.|rlwinm.} %0,%1,%s2,0xffff
4903 [(set_attr "type" "delayed_compare")
4904 (set_attr "length" "4,8")])
4907 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4911 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4912 (match_operand:SI 2 "const_int_operand" "")) 0))
4914 (set (match_operand:SI 0 "gpc_reg_operand" "")
4915 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4916 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4918 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4920 (compare:CC (match_dup 0)
4925 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4927 (match_operand:SI 1 "gpc_reg_operand" "r"))
4928 (ashiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4934 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4936 (match_operand:SI 1 "gpc_reg_operand" "r"))
4937 (lshiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4943 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4945 (match_operand:SI 1 "gpc_reg_operand" "r"))
4946 (zero_extract:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4952 (define_expand "ashrsi3"
4953 [(set (match_operand:SI 0 "gpc_reg_operand" "")
4954 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4955 (match_operand:SI 2 "reg_or_cint_operand" "")))]
4960 emit_insn (gen_ashrsi3_power (operands[0], operands[1], operands[2]));
4962 emit_insn (gen_ashrsi3_no_power (operands[0], operands[1], operands[2]));
4966 (define_insn "ashrsi3_power"
4967 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4968 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4969 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
4970 (clobber (match_scratch:SI 3 "=q,X"))]
4974 {srai|srawi} %0,%1,%h2"
4975 [(set_attr "type" "shift")])
4977 (define_insn "ashrsi3_no_power"
4978 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4979 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4980 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
4984 {srai|srawi} %0,%1,%h2"
4985 [(set_attr "type" "var_shift_rotate,shift")])
4988 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4989 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4990 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4992 (clobber (match_scratch:SI 3 "=r,r,r,r"))
4993 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4997 {srai.|srawi.} %3,%1,%h2
5000 [(set_attr "type" "delayed_compare")
5001 (set_attr "length" "4,4,8,8")])
5004 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
5005 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5006 (match_operand:SI 2 "reg_or_cint_operand" ""))
5008 (clobber (match_scratch:SI 3 ""))
5009 (clobber (match_scratch:SI 4 ""))]
5010 "TARGET_POWER && reload_completed"
5011 [(parallel [(set (match_dup 3)
5012 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5013 (clobber (match_dup 4))])
5015 (compare:CC (match_dup 3)
5020 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
5021 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
5022 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
5024 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
5027 {sra.|sraw.} %3,%1,%2
5028 {srai.|srawi.} %3,%1,%h2
5031 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
5032 (set_attr "length" "4,4,8,8")])
5035 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
5036 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5037 (match_operand:SI 2 "reg_or_cint_operand" ""))
5039 (clobber (match_scratch:SI 3 ""))]
5040 "! TARGET_POWER && reload_completed"
5042 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5044 (compare:CC (match_dup 3)
5049 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
5050 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
5051 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
5053 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
5054 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5055 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
5059 {srai.|srawi.} %0,%1,%h2
5062 [(set_attr "type" "delayed_compare")
5063 (set_attr "length" "4,4,8,8")])
5066 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
5067 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5068 (match_operand:SI 2 "reg_or_cint_operand" ""))
5070 (set (match_operand:SI 0 "gpc_reg_operand" "")
5071 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5072 (clobber (match_scratch:SI 4 ""))]
5073 "TARGET_POWER && reload_completed"
5074 [(parallel [(set (match_dup 0)
5075 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5076 (clobber (match_dup 4))])
5078 (compare:CC (match_dup 0)
5083 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
5084 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
5085 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
5087 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
5088 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
5091 {sra.|sraw.} %0,%1,%2
5092 {srai.|srawi.} %0,%1,%h2
5095 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
5096 (set_attr "length" "4,4,8,8")])
5099 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
5100 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5101 (match_operand:SI 2 "reg_or_cint_operand" ""))
5103 (set (match_operand:SI 0 "gpc_reg_operand" "")
5104 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
5105 "! TARGET_POWER && reload_completed"
5107 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5109 (compare:CC (match_dup 0)
5113 ;; Floating-point insns, excluding normal data motion.
5115 ;; PowerPC has a full set of single-precision floating point instructions.
5117 ;; For the POWER architecture, we pretend that we have both SFmode and
5118 ;; DFmode insns, while, in fact, all fp insns are actually done in double.
5119 ;; The only conversions we will do will be when storing to memory. In that
5120 ;; case, we will use the "frsp" instruction before storing.
5122 ;; Note that when we store into a single-precision memory location, we need to
5123 ;; use the frsp insn first. If the register being stored isn't dead, we
5124 ;; need a scratch register for the frsp. But this is difficult when the store
5125 ;; is done by reload. It is not incorrect to do the frsp on the register in
5126 ;; this case, we just lose precision that we would have otherwise gotten but
5127 ;; is not guaranteed. Perhaps this should be tightened up at some point.
5129 (define_expand "extendsfdf2"
5130 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5131 (float_extend:DF (match_operand:SF 1 "reg_or_none500mem_operand" "")))]
5132 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5135 (define_insn_and_split "*extendsfdf2_fpr"
5136 [(set (match_operand:DF 0 "gpc_reg_operand" "=f,?f,f")
5137 (float_extend:DF (match_operand:SF 1 "reg_or_mem_operand" "0,f,m")))]
5138 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5143 "&& reload_completed && REG_P (operands[1]) && REGNO (operands[0]) == REGNO (operands[1])"
5146 emit_note (NOTE_INSN_DELETED);
5149 [(set_attr "type" "fp,fp,fpload")])
5151 (define_expand "truncdfsf2"
5152 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5153 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "")))]
5154 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5157 (define_insn "*truncdfsf2_fpr"
5158 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5159 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "f")))]
5160 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5162 [(set_attr "type" "fp")])
5164 (define_insn "aux_truncdfsf2"
5165 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5166 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRSP))]
5167 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5169 [(set_attr "type" "fp")])
5171 (define_expand "negsf2"
5172 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5173 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
5174 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
5177 (define_insn "*negsf2"
5178 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5179 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5180 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5182 [(set_attr "type" "fp")])
5184 (define_expand "abssf2"
5185 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5186 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
5187 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
5190 (define_insn "*abssf2"
5191 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5192 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5193 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5195 [(set_attr "type" "fp")])
5198 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5199 (neg:SF (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f"))))]
5200 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5202 [(set_attr "type" "fp")])
5204 (define_expand "addsf3"
5205 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5206 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "")
5207 (match_operand:SF 2 "gpc_reg_operand" "")))]
5208 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
5212 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5213 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5214 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5215 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5217 [(set_attr "type" "fp")
5218 (set_attr "fp_type" "fp_addsub_s")])
5221 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5222 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5223 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5224 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5225 "{fa|fadd} %0,%1,%2"
5226 [(set_attr "type" "fp")])
5228 (define_expand "subsf3"
5229 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5230 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "")
5231 (match_operand:SF 2 "gpc_reg_operand" "")))]
5232 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
5236 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5237 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5238 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5239 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5241 [(set_attr "type" "fp")
5242 (set_attr "fp_type" "fp_addsub_s")])
5245 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5246 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5247 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5248 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5249 "{fs|fsub} %0,%1,%2"
5250 [(set_attr "type" "fp")])
5252 (define_expand "mulsf3"
5253 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5254 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "")
5255 (match_operand:SF 2 "gpc_reg_operand" "")))]
5256 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
5260 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5261 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5262 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5263 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5265 [(set_attr "type" "fp")
5266 (set_attr "fp_type" "fp_mul_s")])
5269 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5270 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5271 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5272 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5273 "{fm|fmul} %0,%1,%2"
5274 [(set_attr "type" "dmul")])
5276 (define_expand "divsf3"
5277 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5278 (div:SF (match_operand:SF 1 "gpc_reg_operand" "")
5279 (match_operand:SF 2 "gpc_reg_operand" "")))]
5280 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
5284 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5285 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5286 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5287 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS
5288 && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
5290 [(set_attr "type" "sdiv")])
5293 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5294 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5295 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5296 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS
5297 && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
5298 "{fd|fdiv} %0,%1,%2"
5299 [(set_attr "type" "ddiv")])
5301 (define_expand "recipsf3"
5302 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5303 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")
5304 (match_operand:SF 2 "gpc_reg_operand" "f")]
5306 "TARGET_RECIP && TARGET_HARD_FLOAT && TARGET_PPC_GFXOPT && !optimize_size
5307 && flag_finite_math_only && !flag_trapping_math"
5309 rs6000_emit_swdivsf (operands[0], operands[1], operands[2]);
5314 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5315 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))]
5316 "TARGET_PPC_GFXOPT && flag_finite_math_only"
5318 [(set_attr "type" "fp")])
5321 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5322 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5323 (match_operand:SF 2 "gpc_reg_operand" "f"))
5324 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5325 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS
5326 && TARGET_SINGLE_FLOAT && TARGET_FUSED_MADD"
5327 "fmadds %0,%1,%2,%3"
5328 [(set_attr "type" "fp")
5329 (set_attr "fp_type" "fp_maddsub_s")])
5332 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5333 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5334 (match_operand:SF 2 "gpc_reg_operand" "f"))
5335 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5336 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5337 "{fma|fmadd} %0,%1,%2,%3"
5338 [(set_attr "type" "dmul")])
5341 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5342 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5343 (match_operand:SF 2 "gpc_reg_operand" "f"))
5344 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5345 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS
5346 && TARGET_SINGLE_FLOAT && TARGET_FUSED_MADD"
5347 "fmsubs %0,%1,%2,%3"
5348 [(set_attr "type" "fp")
5349 (set_attr "fp_type" "fp_maddsub_s")])
5352 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5353 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5354 (match_operand:SF 2 "gpc_reg_operand" "f"))
5355 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5356 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5357 "{fms|fmsub} %0,%1,%2,%3"
5358 [(set_attr "type" "dmul")])
5361 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5362 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5363 (match_operand:SF 2 "gpc_reg_operand" "f"))
5364 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5365 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5366 && TARGET_SINGLE_FLOAT && HONOR_SIGNED_ZEROS (SFmode)"
5367 "fnmadds %0,%1,%2,%3"
5368 [(set_attr "type" "fp")
5369 (set_attr "fp_type" "fp_maddsub_s")])
5372 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5373 (minus:SF (mult:SF (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f"))
5374 (match_operand:SF 2 "gpc_reg_operand" "f"))
5375 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5376 "TARGET_POWERPC && TARGET_SINGLE_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5377 && ! HONOR_SIGNED_ZEROS (SFmode)"
5378 "fnmadds %0,%1,%2,%3"
5379 [(set_attr "type" "fp")
5380 (set_attr "fp_type" "fp_maddsub_s")])
5383 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5384 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5385 (match_operand:SF 2 "gpc_reg_operand" "f"))
5386 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5387 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5388 "{fnma|fnmadd} %0,%1,%2,%3"
5389 [(set_attr "type" "dmul")])
5392 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5393 (minus:SF (mult:SF (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f"))
5394 (match_operand:SF 2 "gpc_reg_operand" "f"))
5395 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5396 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5397 && ! HONOR_SIGNED_ZEROS (SFmode)"
5398 "{fnma|fnmadd} %0,%1,%2,%3"
5399 [(set_attr "type" "dmul")])
5402 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5403 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5404 (match_operand:SF 2 "gpc_reg_operand" "f"))
5405 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5406 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5407 && TARGET_SINGLE_FLOAT && HONOR_SIGNED_ZEROS (SFmode)"
5408 "fnmsubs %0,%1,%2,%3"
5409 [(set_attr "type" "fp")
5410 (set_attr "fp_type" "fp_maddsub_s")])
5413 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5414 (minus:SF (match_operand:SF 3 "gpc_reg_operand" "f")
5415 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5416 (match_operand:SF 2 "gpc_reg_operand" "f"))))]
5417 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5418 && TARGET_SINGLE_FLOAT && ! HONOR_SIGNED_ZEROS (SFmode)"
5419 "fnmsubs %0,%1,%2,%3"
5420 [(set_attr "type" "fp")
5421 (set_attr "fp_type" "fp_maddsub_s")])
5424 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5425 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5426 (match_operand:SF 2 "gpc_reg_operand" "f"))
5427 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5428 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5429 "{fnms|fnmsub} %0,%1,%2,%3"
5430 [(set_attr "type" "dmul")])
5433 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5434 (minus:SF (match_operand:SF 3 "gpc_reg_operand" "f")
5435 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5436 (match_operand:SF 2 "gpc_reg_operand" "f"))))]
5437 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5438 && ! HONOR_SIGNED_ZEROS (SFmode)"
5439 "{fnms|fnmsub} %0,%1,%2,%3"
5440 [(set_attr "type" "dmul")])
5442 (define_expand "sqrtsf2"
5443 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5444 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
5445 "(TARGET_PPC_GPOPT || TARGET_POWER2 || TARGET_XILINX_FPU)
5446 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
5447 && !TARGET_SIMPLE_FPU"
5451 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5452 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5453 "(TARGET_PPC_GPOPT || TARGET_XILINX_FPU) && TARGET_HARD_FLOAT
5454 && TARGET_FPRS && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
5456 [(set_attr "type" "ssqrt")])
5459 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5460 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5461 "TARGET_POWER2 && TARGET_HARD_FLOAT && TARGET_FPRS
5462 && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
5464 [(set_attr "type" "dsqrt")])
5466 (define_expand "rsqrtsf2"
5467 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5468 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")]
5470 "TARGET_RECIP && TARGET_HARD_FLOAT && TARGET_PPC_GFXOPT && !optimize_size
5471 && flag_finite_math_only && !flag_trapping_math"
5473 rs6000_emit_swrsqrtsf (operands[0], operands[1]);
5477 (define_insn "*rsqrt_internal1"
5478 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5479 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")]
5481 "TARGET_HARD_FLOAT && TARGET_PPC_GFXOPT"
5483 [(set_attr "type" "fp")])
5485 (define_expand "copysignsf3"
5487 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "")))
5489 (neg:SF (abs:SF (match_dup 1))))
5490 (set (match_operand:SF 0 "gpc_reg_operand" "")
5491 (if_then_else:SF (ge (match_operand:SF 2 "gpc_reg_operand" "")
5495 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
5496 && !HONOR_NANS (SFmode) && !HONOR_SIGNED_ZEROS (SFmode)"
5498 operands[3] = gen_reg_rtx (SFmode);
5499 operands[4] = gen_reg_rtx (SFmode);
5500 operands[5] = CONST0_RTX (SFmode);
5503 (define_expand "copysigndf3"
5505 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "")))
5507 (neg:DF (abs:DF (match_dup 1))))
5508 (set (match_operand:DF 0 "gpc_reg_operand" "")
5509 (if_then_else:DF (ge (match_operand:DF 2 "gpc_reg_operand" "")
5513 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5514 && !HONOR_NANS (DFmode) && !HONOR_SIGNED_ZEROS (DFmode)"
5516 operands[3] = gen_reg_rtx (DFmode);
5517 operands[4] = gen_reg_rtx (DFmode);
5518 operands[5] = CONST0_RTX (DFmode);
5521 ;; For MIN, MAX, and conditional move, we use DEFINE_EXPAND's that involve a
5522 ;; fsel instruction and some auxiliary computations. Then we just have a
5523 ;; single DEFINE_INSN for fsel and the define_splits to make them if made by
5525 (define_expand "smaxsf3"
5526 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5527 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
5528 (match_operand:SF 2 "gpc_reg_operand" ""))
5531 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
5532 && TARGET_SINGLE_FLOAT && !flag_trapping_math"
5533 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
5535 (define_expand "sminsf3"
5536 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5537 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
5538 (match_operand:SF 2 "gpc_reg_operand" ""))
5541 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
5542 && TARGET_SINGLE_FLOAT && !flag_trapping_math"
5543 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
5546 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5547 (match_operator:SF 3 "min_max_operator"
5548 [(match_operand:SF 1 "gpc_reg_operand" "")
5549 (match_operand:SF 2 "gpc_reg_operand" "")]))]
5550 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
5551 && TARGET_SINGLE_FLOAT && !flag_trapping_math"
5554 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
5555 operands[1], operands[2]);
5559 (define_expand "movsicc"
5560 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5561 (if_then_else:SI (match_operand 1 "comparison_operator" "")
5562 (match_operand:SI 2 "gpc_reg_operand" "")
5563 (match_operand:SI 3 "gpc_reg_operand" "")))]
5567 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5573 ;; We use the BASE_REGS for the isel input operands because, if rA is
5574 ;; 0, the value of 0 is placed in rD upon truth. Similarly for rB
5575 ;; because we may switch the operands and rB may end up being rA.
5577 ;; We need 2 patterns: an unsigned and a signed pattern. We could
5578 ;; leave out the mode in operand 4 and use one pattern, but reload can
5579 ;; change the mode underneath our feet and then gets confused trying
5580 ;; to reload the value.
5581 (define_insn "isel_signed"
5582 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5584 (match_operator 1 "comparison_operator"
5585 [(match_operand:CC 4 "cc_reg_operand" "y")
5587 (match_operand:SI 2 "gpc_reg_operand" "b")
5588 (match_operand:SI 3 "gpc_reg_operand" "b")))]
5591 { return output_isel (operands); }"
5592 [(set_attr "length" "4")])
5594 (define_insn "isel_unsigned"
5595 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5597 (match_operator 1 "comparison_operator"
5598 [(match_operand:CCUNS 4 "cc_reg_operand" "y")
5600 (match_operand:SI 2 "gpc_reg_operand" "b")
5601 (match_operand:SI 3 "gpc_reg_operand" "b")))]
5604 { return output_isel (operands); }"
5605 [(set_attr "length" "4")])
5607 (define_expand "movsfcc"
5608 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5609 (if_then_else:SF (match_operand 1 "comparison_operator" "")
5610 (match_operand:SF 2 "gpc_reg_operand" "")
5611 (match_operand:SF 3 "gpc_reg_operand" "")))]
5612 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5615 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5621 (define_insn "*fselsfsf4"
5622 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5623 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
5624 (match_operand:SF 4 "zero_fp_constant" "F"))
5625 (match_operand:SF 2 "gpc_reg_operand" "f")
5626 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5627 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5629 [(set_attr "type" "fp")])
5631 (define_insn "*fseldfsf4"
5632 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5633 (if_then_else:SF (ge (match_operand:DF 1 "gpc_reg_operand" "f")
5634 (match_operand:DF 4 "zero_fp_constant" "F"))
5635 (match_operand:SF 2 "gpc_reg_operand" "f")
5636 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5637 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_SINGLE_FLOAT"
5639 [(set_attr "type" "fp")])
5641 (define_expand "negdf2"
5642 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5643 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
5644 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5647 (define_insn "*negdf2_fpr"
5648 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5649 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
5650 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5652 [(set_attr "type" "fp")])
5654 (define_expand "absdf2"
5655 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5656 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
5657 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5660 (define_insn "*absdf2_fpr"
5661 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5662 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
5663 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5665 [(set_attr "type" "fp")])
5667 (define_insn "*nabsdf2_fpr"
5668 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5669 (neg:DF (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f"))))]
5670 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5672 [(set_attr "type" "fp")])
5674 (define_expand "adddf3"
5675 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5676 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "")
5677 (match_operand:DF 2 "gpc_reg_operand" "")))]
5678 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5681 (define_insn "*adddf3_fpr"
5682 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5683 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5684 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5685 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5686 "{fa|fadd} %0,%1,%2"
5687 [(set_attr "type" "fp")
5688 (set_attr "fp_type" "fp_addsub_d")])
5690 (define_expand "subdf3"
5691 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5692 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "")
5693 (match_operand:DF 2 "gpc_reg_operand" "")))]
5694 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5697 (define_insn "*subdf3_fpr"
5698 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5699 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "f")
5700 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5701 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5702 "{fs|fsub} %0,%1,%2"
5703 [(set_attr "type" "fp")
5704 (set_attr "fp_type" "fp_addsub_d")])
5706 (define_expand "muldf3"
5707 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5708 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "")
5709 (match_operand:DF 2 "gpc_reg_operand" "")))]
5710 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5713 (define_insn "*muldf3_fpr"
5714 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5715 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5716 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5717 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5718 "{fm|fmul} %0,%1,%2"
5719 [(set_attr "type" "dmul")
5720 (set_attr "fp_type" "fp_mul_d")])
5722 (define_expand "divdf3"
5723 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5724 (div:DF (match_operand:DF 1 "gpc_reg_operand" "")
5725 (match_operand:DF 2 "gpc_reg_operand" "")))]
5727 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)
5728 && !TARGET_SIMPLE_FPU"
5731 (define_insn "*divdf3_fpr"
5732 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5733 (div:DF (match_operand:DF 1 "gpc_reg_operand" "f")
5734 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5735 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && !TARGET_SIMPLE_FPU"
5736 "{fd|fdiv} %0,%1,%2"
5737 [(set_attr "type" "ddiv")])
5739 (define_expand "recipdf3"
5740 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5741 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")
5742 (match_operand:DF 2 "gpc_reg_operand" "f")]
5744 "TARGET_RECIP && TARGET_HARD_FLOAT && TARGET_POPCNTB && !optimize_size
5745 && flag_finite_math_only && !flag_trapping_math"
5747 rs6000_emit_swdivdf (operands[0], operands[1], operands[2]);
5752 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5753 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))]
5754 "TARGET_POPCNTB && flag_finite_math_only"
5756 [(set_attr "type" "fp")])
5759 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5760 (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5761 (match_operand:DF 2 "gpc_reg_operand" "f"))
5762 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5763 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD && TARGET_DOUBLE_FLOAT"
5764 "{fma|fmadd} %0,%1,%2,%3"
5765 [(set_attr "type" "dmul")
5766 (set_attr "fp_type" "fp_maddsub_d")])
5769 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5770 (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5771 (match_operand:DF 2 "gpc_reg_operand" "f"))
5772 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5773 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD && TARGET_DOUBLE_FLOAT"
5774 "{fms|fmsub} %0,%1,%2,%3"
5775 [(set_attr "type" "dmul")
5776 (set_attr "fp_type" "fp_maddsub_d")])
5779 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5780 (neg:DF (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5781 (match_operand:DF 2 "gpc_reg_operand" "f"))
5782 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
5783 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD && TARGET_DOUBLE_FLOAT
5784 && HONOR_SIGNED_ZEROS (DFmode)"
5785 "{fnma|fnmadd} %0,%1,%2,%3"
5786 [(set_attr "type" "dmul")
5787 (set_attr "fp_type" "fp_maddsub_d")])
5790 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5791 (minus:DF (mult:DF (neg:DF (match_operand:DF 1 "gpc_reg_operand" "f"))
5792 (match_operand:DF 2 "gpc_reg_operand" "f"))
5793 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5794 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD && TARGET_DOUBLE_FLOAT
5795 && ! HONOR_SIGNED_ZEROS (DFmode)"
5796 "{fnma|fnmadd} %0,%1,%2,%3"
5797 [(set_attr "type" "dmul")
5798 (set_attr "fp_type" "fp_maddsub_d")])
5801 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5802 (neg:DF (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5803 (match_operand:DF 2 "gpc_reg_operand" "f"))
5804 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
5805 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD && TARGET_DOUBLE_FLOAT
5806 && HONOR_SIGNED_ZEROS (DFmode)"
5807 "{fnms|fnmsub} %0,%1,%2,%3"
5808 [(set_attr "type" "dmul")
5809 (set_attr "fp_type" "fp_maddsub_d")])
5812 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5813 (minus:DF (match_operand:DF 3 "gpc_reg_operand" "f")
5814 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5815 (match_operand:DF 2 "gpc_reg_operand" "f"))))]
5816 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD && TARGET_DOUBLE_FLOAT
5817 && ! HONOR_SIGNED_ZEROS (DFmode)"
5818 "{fnms|fnmsub} %0,%1,%2,%3"
5819 [(set_attr "type" "dmul")
5820 (set_attr "fp_type" "fp_maddsub_d")])
5822 (define_insn "sqrtdf2"
5823 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5824 (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
5825 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS
5826 && TARGET_DOUBLE_FLOAT"
5828 [(set_attr "type" "dsqrt")])
5830 ;; The conditional move instructions allow us to perform max and min
5831 ;; operations even when
5833 (define_expand "smaxdf3"
5834 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5835 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
5836 (match_operand:DF 2 "gpc_reg_operand" ""))
5839 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5840 && !flag_trapping_math"
5841 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
5843 (define_expand "smindf3"
5844 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5845 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
5846 (match_operand:DF 2 "gpc_reg_operand" ""))
5849 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5850 && !flag_trapping_math"
5851 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
5854 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5855 (match_operator:DF 3 "min_max_operator"
5856 [(match_operand:DF 1 "gpc_reg_operand" "")
5857 (match_operand:DF 2 "gpc_reg_operand" "")]))]
5858 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5859 && !flag_trapping_math"
5862 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
5863 operands[1], operands[2]);
5867 (define_expand "movdfcc"
5868 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5869 (if_then_else:DF (match_operand 1 "comparison_operator" "")
5870 (match_operand:DF 2 "gpc_reg_operand" "")
5871 (match_operand:DF 3 "gpc_reg_operand" "")))]
5872 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5875 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5881 (define_insn "*fseldfdf4"
5882 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5883 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "f")
5884 (match_operand:DF 4 "zero_fp_constant" "F"))
5885 (match_operand:DF 2 "gpc_reg_operand" "f")
5886 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5887 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5889 [(set_attr "type" "fp")])
5891 (define_insn "*fselsfdf4"
5892 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5893 (if_then_else:DF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
5894 (match_operand:SF 4 "zero_fp_constant" "F"))
5895 (match_operand:DF 2 "gpc_reg_operand" "f")
5896 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5897 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_SINGLE_FLOAT"
5899 [(set_attr "type" "fp")])
5901 ;; Conversions to and from floating-point.
5903 (define_expand "fixuns_truncsfsi2"
5904 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5905 (unsigned_fix:SI (match_operand:SF 1 "gpc_reg_operand" "")))]
5906 "TARGET_HARD_FLOAT && !TARGET_FPRS && TARGET_SINGLE_FLOAT"
5909 (define_expand "fix_truncsfsi2"
5910 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5911 (fix:SI (match_operand:SF 1 "gpc_reg_operand" "")))]
5912 "TARGET_HARD_FLOAT && !TARGET_FPRS && TARGET_SINGLE_FLOAT"
5915 ; For each of these conversions, there is a define_expand, a define_insn
5916 ; with a '#' template, and a define_split (with C code). The idea is
5917 ; to allow constant folding with the template of the define_insn,
5918 ; then to have the insns split later (between sched1 and final).
5920 (define_expand "floatsidf2"
5921 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5922 (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5925 (clobber (match_dup 4))
5926 (clobber (match_dup 5))
5927 (clobber (match_dup 6))])]
5929 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5932 if (TARGET_E500_DOUBLE)
5934 emit_insn (gen_spe_floatsidf2 (operands[0], operands[1]));
5937 if (TARGET_POWERPC64)
5939 rtx x = convert_to_mode (DImode, operands[1], 0);
5940 emit_insn (gen_floatdidf2 (operands[0], x));
5944 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5945 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503601774854144\", DFmode));
5946 operands[4] = assign_stack_temp (DFmode, GET_MODE_SIZE (DFmode), 0);
5947 operands[5] = gen_reg_rtx (DFmode);
5948 operands[6] = gen_reg_rtx (SImode);
5951 (define_insn_and_split "*floatsidf2_internal"
5952 [(set (match_operand:DF 0 "gpc_reg_operand" "=&f")
5953 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5954 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5955 (use (match_operand:DF 3 "gpc_reg_operand" "f"))
5956 (clobber (match_operand:DF 4 "offsettable_mem_operand" "=o"))
5957 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&f"))
5958 (clobber (match_operand:SI 6 "gpc_reg_operand" "=&r"))]
5959 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5961 "&& (can_create_pseudo_p () || offsettable_nonstrict_memref_p (operands[4]))"
5965 rtx lowword, highword;
5966 gcc_assert (MEM_P (operands[4]));
5967 highword = adjust_address (operands[4], SImode, 0);
5968 lowword = adjust_address (operands[4], SImode, 4);
5969 if (! WORDS_BIG_ENDIAN)
5972 tmp = highword; highword = lowword; lowword = tmp;
5975 emit_insn (gen_xorsi3 (operands[6], operands[1],
5976 GEN_INT (~ (HOST_WIDE_INT) 0x7fffffff)));
5977 emit_move_insn (lowword, operands[6]);
5978 emit_move_insn (highword, operands[2]);
5979 emit_move_insn (operands[5], operands[4]);
5980 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5983 [(set_attr "length" "24")])
5985 (define_expand "floatunssisf2"
5986 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5987 (unsigned_float:SF (match_operand:SI 1 "gpc_reg_operand" "")))]
5988 "TARGET_HARD_FLOAT && !TARGET_FPRS && TARGET_SINGLE_FLOAT"
5991 (define_expand "floatunssidf2"
5992 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5993 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5996 (clobber (match_dup 4))
5997 (clobber (match_dup 5))])]
5998 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6001 if (TARGET_E500_DOUBLE)
6003 emit_insn (gen_spe_floatunssidf2 (operands[0], operands[1]));
6006 if (TARGET_POWERPC64)
6008 rtx x = convert_to_mode (DImode, operands[1], 1);
6009 emit_insn (gen_floatdidf2 (operands[0], x));
6013 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
6014 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503599627370496\", DFmode));
6015 operands[4] = assign_stack_temp (DFmode, GET_MODE_SIZE (DFmode), 0);
6016 operands[5] = gen_reg_rtx (DFmode);
6019 (define_insn_and_split "*floatunssidf2_internal"
6020 [(set (match_operand:DF 0 "gpc_reg_operand" "=&f")
6021 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
6022 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
6023 (use (match_operand:DF 3 "gpc_reg_operand" "f"))
6024 (clobber (match_operand:DF 4 "offsettable_mem_operand" "=o"))
6025 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&f"))]
6026 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6028 "&& (can_create_pseudo_p () || offsettable_nonstrict_memref_p (operands[4]))"
6032 rtx lowword, highword;
6033 gcc_assert (MEM_P (operands[4]));
6034 highword = adjust_address (operands[4], SImode, 0);
6035 lowword = adjust_address (operands[4], SImode, 4);
6036 if (! WORDS_BIG_ENDIAN)
6039 tmp = highword; highword = lowword; lowword = tmp;
6042 emit_move_insn (lowword, operands[1]);
6043 emit_move_insn (highword, operands[2]);
6044 emit_move_insn (operands[5], operands[4]);
6045 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
6048 [(set_attr "length" "20")])
6050 (define_expand "fix_truncdfsi2"
6051 [(parallel [(set (match_operand:SI 0 "fix_trunc_dest_operand" "")
6052 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))
6053 (clobber (match_dup 2))
6054 (clobber (match_dup 3))])]
6055 "(TARGET_POWER2 || TARGET_POWERPC)
6056 && TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6059 if (TARGET_E500_DOUBLE)
6061 emit_insn (gen_spe_fix_truncdfsi2 (operands[0], operands[1]));
6064 operands[2] = gen_reg_rtx (DImode);
6065 if (TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
6066 && gpc_reg_operand(operands[0], GET_MODE (operands[0])))
6068 operands[3] = gen_reg_rtx (DImode);
6069 emit_insn (gen_fix_truncdfsi2_mfpgpr (operands[0], operands[1],
6070 operands[2], operands[3]));
6073 if (TARGET_PPC_GFXOPT)
6075 rtx orig_dest = operands[0];
6076 if (! memory_operand (orig_dest, GET_MODE (orig_dest)))
6077 operands[0] = assign_stack_temp (SImode, GET_MODE_SIZE (SImode), 0);
6078 emit_insn (gen_fix_truncdfsi2_internal_gfxopt (operands[0], operands[1],
6080 if (operands[0] != orig_dest)
6081 emit_move_insn (orig_dest, operands[0]);
6084 operands[3] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
6087 (define_insn_and_split "*fix_truncdfsi2_internal"
6088 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6089 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f")))
6090 (clobber (match_operand:DI 2 "gpc_reg_operand" "=f"))
6091 (clobber (match_operand:DI 3 "offsettable_mem_operand" "=o"))]
6092 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS
6093 && TARGET_DOUBLE_FLOAT"
6095 "&& (can_create_pseudo_p () || offsettable_nonstrict_memref_p (operands[3]))"
6100 gcc_assert (MEM_P (operands[3]));
6101 lowword = adjust_address (operands[3], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
6103 emit_insn (gen_fctiwz (operands[2], operands[1]));
6104 emit_move_insn (operands[3], operands[2]);
6105 emit_move_insn (operands[0], lowword);
6108 [(set_attr "length" "16")])
6110 (define_insn_and_split "fix_truncdfsi2_internal_gfxopt"
6111 [(set (match_operand:SI 0 "memory_operand" "=Z")
6112 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f")))
6113 (clobber (match_operand:DI 2 "gpc_reg_operand" "=f"))]
6114 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS
6115 && TARGET_DOUBLE_FLOAT
6116 && TARGET_PPC_GFXOPT"
6122 emit_insn (gen_fctiwz (operands[2], operands[1]));
6123 emit_insn (gen_stfiwx (operands[0], operands[2]));
6126 [(set_attr "length" "16")])
6128 (define_insn_and_split "fix_truncdfsi2_mfpgpr"
6129 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6130 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f")))
6131 (clobber (match_operand:DI 2 "gpc_reg_operand" "=f"))
6132 (clobber (match_operand:DI 3 "gpc_reg_operand" "=r"))]
6133 "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
6134 && TARGET_DOUBLE_FLOAT"
6137 [(set (match_dup 2) (unspec:DI [(fix:SI (match_dup 1))] UNSPEC_FCTIWZ))
6138 (set (match_dup 3) (match_dup 2))
6139 (set (match_dup 0) (subreg:SI (match_dup 3) 4))]
6141 [(set_attr "length" "12")])
6143 ; Here, we use (set (reg) (unspec:DI [(fix:SI ...)] UNSPEC_FCTIWZ))
6144 ; rather than (set (subreg:SI (reg)) (fix:SI ...))
6145 ; because the first makes it clear that operand 0 is not live
6146 ; before the instruction.
6147 (define_insn "fctiwz"
6148 [(set (match_operand:DI 0 "gpc_reg_operand" "=f")
6149 (unspec:DI [(fix:SI (match_operand:DF 1 "gpc_reg_operand" "f"))]
6151 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS
6152 && TARGET_DOUBLE_FLOAT"
6153 "{fcirz|fctiwz} %0,%1"
6154 [(set_attr "type" "fp")])
6156 (define_insn "btruncdf2"
6157 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6158 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRIZ))]
6159 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6161 [(set_attr "type" "fp")])
6163 (define_insn "btruncsf2"
6164 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6165 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIZ))]
6166 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT "
6168 [(set_attr "type" "fp")])
6170 (define_insn "ceildf2"
6171 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6172 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRIP))]
6173 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6175 [(set_attr "type" "fp")])
6177 (define_insn "ceilsf2"
6178 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6179 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIP))]
6180 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT "
6182 [(set_attr "type" "fp")])
6184 (define_insn "floordf2"
6185 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6186 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRIM))]
6187 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6189 [(set_attr "type" "fp")])
6191 (define_insn "floorsf2"
6192 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6193 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIM))]
6194 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT "
6196 [(set_attr "type" "fp")])
6198 (define_insn "rounddf2"
6199 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6200 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRIN))]
6201 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6203 [(set_attr "type" "fp")])
6205 (define_insn "roundsf2"
6206 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6207 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIN))]
6208 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT "
6210 [(set_attr "type" "fp")])
6212 ; An UNSPEC is used so we don't have to support SImode in FP registers.
6213 (define_insn "stfiwx"
6214 [(set (match_operand:SI 0 "memory_operand" "=Z")
6215 (unspec:SI [(match_operand:DI 1 "gpc_reg_operand" "f")]
6219 [(set_attr "type" "fpstore")])
6221 (define_expand "floatsisf2"
6222 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6223 (float:SF (match_operand:SI 1 "gpc_reg_operand" "")))]
6224 "TARGET_HARD_FLOAT && !TARGET_FPRS"
6227 (define_insn "floatdidf2"
6228 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6229 (float:DF (match_operand:DI 1 "gpc_reg_operand" "!f#r")))]
6230 "(TARGET_POWERPC64 || TARGET_XILINX_FPU) && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS"
6232 [(set_attr "type" "fp")])
6234 (define_insn "fix_truncdfdi2"
6235 [(set (match_operand:DI 0 "gpc_reg_operand" "=!f#r")
6236 (fix:DI (match_operand:DF 1 "gpc_reg_operand" "f")))]
6237 "(TARGET_POWERPC64 || TARGET_XILINX_FPU) && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS"
6239 [(set_attr "type" "fp")])
6241 (define_expand "floatdisf2"
6242 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6243 (float:SF (match_operand:DI 1 "gpc_reg_operand" "")))]
6244 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT "
6247 rtx val = operands[1];
6248 if (!flag_unsafe_math_optimizations)
6250 rtx label = gen_label_rtx ();
6251 val = gen_reg_rtx (DImode);
6252 emit_insn (gen_floatdisf2_internal2 (val, operands[1], label));
6255 emit_insn (gen_floatdisf2_internal1 (operands[0], val));
6259 ;; This is not IEEE compliant if rounding mode is "round to nearest".
6260 ;; If the DI->DF conversion is inexact, then it's possible to suffer
6261 ;; from double rounding.
6262 (define_insn_and_split "floatdisf2_internal1"
6263 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6264 (float:SF (match_operand:DI 1 "gpc_reg_operand" "!f#r")))
6265 (clobber (match_scratch:DF 2 "=f"))]
6266 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
6268 "&& reload_completed"
6270 (float:DF (match_dup 1)))
6272 (float_truncate:SF (match_dup 2)))]
6275 ;; Twiddles bits to avoid double rounding.
6276 ;; Bits that might be truncated when converting to DFmode are replaced
6277 ;; by a bit that won't be lost at that stage, but is below the SFmode
6278 ;; rounding position.
6279 (define_expand "floatdisf2_internal2"
6280 [(set (match_dup 3) (ashiftrt:DI (match_operand:DI 1 "" "")
6282 (parallel [(set (match_operand:DI 0 "" "") (and:DI (match_dup 1)
6284 (clobber (scratch:CC))])
6285 (set (match_dup 3) (plus:DI (match_dup 3)
6287 (set (match_dup 0) (plus:DI (match_dup 0)
6289 (set (match_dup 4) (compare:CCUNS (match_dup 3)
6291 (set (match_dup 0) (ior:DI (match_dup 0)
6293 (parallel [(set (match_dup 0) (and:DI (match_dup 0)
6295 (clobber (scratch:CC))])
6296 (set (pc) (if_then_else (geu (match_dup 4) (const_int 0))
6297 (label_ref (match_operand:DI 2 "" ""))
6299 (set (match_dup 0) (match_dup 1))]
6300 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
6303 operands[3] = gen_reg_rtx (DImode);
6304 operands[4] = gen_reg_rtx (CCUNSmode);
6307 ;; Define the DImode operations that can be done in a small number
6308 ;; of instructions. The & constraints are to prevent the register
6309 ;; allocator from allocating registers that overlap with the inputs
6310 ;; (for example, having an input in 7,8 and an output in 6,7). We
6311 ;; also allow for the output being the same as one of the inputs.
6313 (define_insn "*adddi3_noppc64"
6314 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r")
6315 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,0,0")
6316 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I")))]
6317 "! TARGET_POWERPC64"
6320 if (WORDS_BIG_ENDIAN)
6321 return (GET_CODE (operands[2])) != CONST_INT
6322 ? \"{a|addc} %L0,%L1,%L2\;{ae|adde} %0,%1,%2\"
6323 : \"{ai|addic} %L0,%L1,%2\;{a%G2e|add%G2e} %0,%1\";
6325 return (GET_CODE (operands[2])) != CONST_INT
6326 ? \"{a|addc} %0,%1,%2\;{ae|adde} %L0,%L1,%L2\"
6327 : \"{ai|addic} %0,%1,%2\;{a%G2e|add%G2e} %L0,%L1\";
6329 [(set_attr "type" "two")
6330 (set_attr "length" "8")])
6332 (define_insn "*subdi3_noppc64"
6333 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r,r")
6334 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I,0,r,I")
6335 (match_operand:DI 2 "gpc_reg_operand" "r,r,r,0,0")))]
6336 "! TARGET_POWERPC64"
6339 if (WORDS_BIG_ENDIAN)
6340 return (GET_CODE (operands[1]) != CONST_INT)
6341 ? \"{sf|subfc} %L0,%L2,%L1\;{sfe|subfe} %0,%2,%1\"
6342 : \"{sfi|subfic} %L0,%L2,%1\;{sf%G1e|subf%G1e} %0,%2\";
6344 return (GET_CODE (operands[1]) != CONST_INT)
6345 ? \"{sf|subfc} %0,%2,%1\;{sfe|subfe} %L0,%L2,%L1\"
6346 : \"{sfi|subfic} %0,%2,%1\;{sf%G1e|subf%G1e} %L0,%L2\";
6348 [(set_attr "type" "two")
6349 (set_attr "length" "8")])
6351 (define_insn "*negdi2_noppc64"
6352 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6353 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))]
6354 "! TARGET_POWERPC64"
6357 return (WORDS_BIG_ENDIAN)
6358 ? \"{sfi|subfic} %L0,%L1,0\;{sfze|subfze} %0,%1\"
6359 : \"{sfi|subfic} %0,%1,0\;{sfze|subfze} %L0,%L1\";
6361 [(set_attr "type" "two")
6362 (set_attr "length" "8")])
6364 (define_expand "mulsidi3"
6365 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6366 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6367 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6368 "! TARGET_POWERPC64"
6371 if (! TARGET_POWER && ! TARGET_POWERPC)
6373 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
6374 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
6375 emit_insn (gen_mull_call ());
6376 if (WORDS_BIG_ENDIAN)
6377 emit_move_insn (operands[0], gen_rtx_REG (DImode, 3));
6380 emit_move_insn (operand_subword (operands[0], 0, 0, DImode),
6381 gen_rtx_REG (SImode, 3));
6382 emit_move_insn (operand_subword (operands[0], 1, 0, DImode),
6383 gen_rtx_REG (SImode, 4));
6387 else if (TARGET_POWER)
6389 emit_insn (gen_mulsidi3_mq (operands[0], operands[1], operands[2]));
6394 (define_insn "mulsidi3_mq"
6395 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6396 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6397 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
6398 (clobber (match_scratch:SI 3 "=q"))]
6400 "mul %0,%1,%2\;mfmq %L0"
6401 [(set_attr "type" "imul")
6402 (set_attr "length" "8")])
6404 (define_insn "*mulsidi3_no_mq"
6405 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6406 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6407 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
6408 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
6411 return (WORDS_BIG_ENDIAN)
6412 ? \"mulhw %0,%1,%2\;mullw %L0,%1,%2\"
6413 : \"mulhw %L0,%1,%2\;mullw %0,%1,%2\";
6415 [(set_attr "type" "imul")
6416 (set_attr "length" "8")])
6419 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6420 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6421 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6422 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
6425 (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
6426 (sign_extend:DI (match_dup 2)))
6429 (mult:SI (match_dup 1)
6433 int endian = (WORDS_BIG_ENDIAN == 0);
6434 operands[3] = operand_subword (operands[0], endian, 0, DImode);
6435 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
6438 (define_expand "umulsidi3"
6439 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6440 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6441 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6442 "TARGET_POWERPC && ! TARGET_POWERPC64"
6447 emit_insn (gen_umulsidi3_mq (operands[0], operands[1], operands[2]));
6452 (define_insn "umulsidi3_mq"
6453 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6454 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6455 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
6456 (clobber (match_scratch:SI 3 "=q"))]
6457 "TARGET_POWERPC && TARGET_POWER"
6460 return (WORDS_BIG_ENDIAN)
6461 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
6462 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
6464 [(set_attr "type" "imul")
6465 (set_attr "length" "8")])
6467 (define_insn "*umulsidi3_no_mq"
6468 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6469 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6470 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
6471 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
6474 return (WORDS_BIG_ENDIAN)
6475 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
6476 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
6478 [(set_attr "type" "imul")
6479 (set_attr "length" "8")])
6482 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6483 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6484 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6485 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
6488 (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
6489 (zero_extend:DI (match_dup 2)))
6492 (mult:SI (match_dup 1)
6496 int endian = (WORDS_BIG_ENDIAN == 0);
6497 operands[3] = operand_subword (operands[0], endian, 0, DImode);
6498 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
6501 (define_expand "smulsi3_highpart"
6502 [(set (match_operand:SI 0 "gpc_reg_operand" "")
6504 (lshiftrt:DI (mult:DI (sign_extend:DI
6505 (match_operand:SI 1 "gpc_reg_operand" ""))
6507 (match_operand:SI 2 "gpc_reg_operand" "")))
6512 if (! TARGET_POWER && ! TARGET_POWERPC)
6514 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
6515 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
6516 emit_insn (gen_mulh_call ());
6517 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
6520 else if (TARGET_POWER)
6522 emit_insn (gen_smulsi3_highpart_mq (operands[0], operands[1], operands[2]));
6527 (define_insn "smulsi3_highpart_mq"
6528 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6530 (lshiftrt:DI (mult:DI (sign_extend:DI
6531 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6533 (match_operand:SI 2 "gpc_reg_operand" "r")))
6535 (clobber (match_scratch:SI 3 "=q"))]
6538 [(set_attr "type" "imul")])
6540 (define_insn "*smulsi3_highpart_no_mq"
6541 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6543 (lshiftrt:DI (mult:DI (sign_extend:DI
6544 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6546 (match_operand:SI 2 "gpc_reg_operand" "r")))
6548 "TARGET_POWERPC && ! TARGET_POWER"
6550 [(set_attr "type" "imul")])
6552 (define_expand "umulsi3_highpart"
6553 [(set (match_operand:SI 0 "gpc_reg_operand" "")
6555 (lshiftrt:DI (mult:DI (zero_extend:DI
6556 (match_operand:SI 1 "gpc_reg_operand" ""))
6558 (match_operand:SI 2 "gpc_reg_operand" "")))
6565 emit_insn (gen_umulsi3_highpart_mq (operands[0], operands[1], operands[2]));
6570 (define_insn "umulsi3_highpart_mq"
6571 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6573 (lshiftrt:DI (mult:DI (zero_extend:DI
6574 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6576 (match_operand:SI 2 "gpc_reg_operand" "r")))
6578 (clobber (match_scratch:SI 3 "=q"))]
6579 "TARGET_POWERPC && TARGET_POWER"
6581 [(set_attr "type" "imul")])
6583 (define_insn "*umulsi3_highpart_no_mq"
6584 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6586 (lshiftrt:DI (mult:DI (zero_extend:DI
6587 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6589 (match_operand:SI 2 "gpc_reg_operand" "r")))
6591 "TARGET_POWERPC && ! TARGET_POWER"
6593 [(set_attr "type" "imul")])
6595 ;; If operands 0 and 2 are in the same register, we have a problem. But
6596 ;; operands 0 and 1 (the usual case) can be in the same register. That's
6597 ;; why we have the strange constraints below.
6598 (define_insn "ashldi3_power"
6599 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
6600 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
6601 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
6602 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
6605 {sli|slwi} %0,%L1,%h2\;{cal %L0,0(0)|li %L0,0}
6606 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
6607 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
6608 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2"
6609 [(set_attr "length" "8")])
6611 (define_insn "lshrdi3_power"
6612 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
6613 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
6614 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
6615 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
6618 {s%A2i|s%A2wi} %L0,%1,%h2\;{cal %0,0(0)|li %0,0}
6619 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
6620 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
6621 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2"
6622 [(set_attr "length" "8")])
6624 ;; Shift by a variable amount is too complex to be worth open-coding. We
6625 ;; just handle shifts by constants.
6626 (define_insn "ashrdi3_power"
6627 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6628 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6629 (match_operand:SI 2 "const_int_operand" "M,i")))
6630 (clobber (match_scratch:SI 3 "=X,q"))]
6633 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
6634 sraiq %0,%1,%h2\;srliq %L0,%L1,%h2"
6635 [(set_attr "type" "shift")
6636 (set_attr "length" "8")])
6638 (define_insn "ashrdi3_no_power"
6639 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
6640 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6641 (match_operand:SI 2 "const_int_operand" "M,i")))]
6642 "TARGET_32BIT && !TARGET_POWERPC64 && !TARGET_POWER && WORDS_BIG_ENDIAN"
6644 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
6645 {sri|srwi} %L0,%L1,%h2\;insrwi %L0,%1,%h2,0\;{srai|srawi} %0,%1,%h2"
6646 [(set_attr "type" "two,three")
6647 (set_attr "length" "8,12")])
6649 (define_insn "*ashrdisi3_noppc64"
6650 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6651 (subreg:SI (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6652 (const_int 32)) 4))]
6653 "TARGET_32BIT && !TARGET_POWERPC64"
6656 if (REGNO (operands[0]) == REGNO (operands[1]))
6659 return \"mr %0,%1\";
6661 [(set_attr "length" "4")])
6664 ;; PowerPC64 DImode operations.
6666 (define_insn_and_split "absdi2"
6667 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6668 (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))
6669 (clobber (match_scratch:DI 2 "=&r,&r"))]
6672 "&& reload_completed"
6673 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
6674 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
6675 (set (match_dup 0) (minus:DI (match_dup 0) (match_dup 2)))]
6678 (define_insn_and_split "*nabsdi2"
6679 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6680 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0"))))
6681 (clobber (match_scratch:DI 2 "=&r,&r"))]
6684 "&& reload_completed"
6685 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
6686 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
6687 (set (match_dup 0) (minus:DI (match_dup 2) (match_dup 0)))]
6690 (define_insn "muldi3"
6691 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6692 (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6693 (match_operand:DI 2 "reg_or_short_operand" "r,I")))]
6699 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
6700 (const_string "imul3")
6701 (match_operand:SI 2 "short_cint_operand" "")
6702 (const_string "imul2")]
6703 (const_string "lmul")))])
6705 (define_insn "*muldi3_internal1"
6706 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6707 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6708 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6710 (clobber (match_scratch:DI 3 "=r,r"))]
6715 [(set_attr "type" "lmul_compare")
6716 (set_attr "length" "4,8")])
6719 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6720 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
6721 (match_operand:DI 2 "gpc_reg_operand" ""))
6723 (clobber (match_scratch:DI 3 ""))]
6724 "TARGET_POWERPC64 && reload_completed"
6726 (mult:DI (match_dup 1) (match_dup 2)))
6728 (compare:CC (match_dup 3)
6732 (define_insn "*muldi3_internal2"
6733 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6734 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6735 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6737 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6738 (mult:DI (match_dup 1) (match_dup 2)))]
6743 [(set_attr "type" "lmul_compare")
6744 (set_attr "length" "4,8")])
6747 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
6748 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
6749 (match_operand:DI 2 "gpc_reg_operand" ""))
6751 (set (match_operand:DI 0 "gpc_reg_operand" "")
6752 (mult:DI (match_dup 1) (match_dup 2)))]
6753 "TARGET_POWERPC64 && reload_completed"
6755 (mult:DI (match_dup 1) (match_dup 2)))
6757 (compare:CC (match_dup 0)
6761 (define_insn "smuldi3_highpart"
6762 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6764 (lshiftrt:TI (mult:TI (sign_extend:TI
6765 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6767 (match_operand:DI 2 "gpc_reg_operand" "r")))
6771 [(set_attr "type" "lmul")])
6773 (define_insn "umuldi3_highpart"
6774 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6776 (lshiftrt:TI (mult:TI (zero_extend:TI
6777 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6779 (match_operand:DI 2 "gpc_reg_operand" "r")))
6783 [(set_attr "type" "lmul")])
6785 (define_insn "rotldi3"
6786 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6787 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6788 (match_operand:DI 2 "reg_or_cint_operand" "r,i")))]
6793 [(set_attr "type" "var_shift_rotate,integer")])
6795 (define_insn "*rotldi3_internal2"
6796 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
6797 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6798 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
6800 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
6807 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6808 (set_attr "length" "4,4,8,8")])
6811 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
6812 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6813 (match_operand:DI 2 "reg_or_cint_operand" ""))
6815 (clobber (match_scratch:DI 3 ""))]
6816 "TARGET_POWERPC64 && reload_completed"
6818 (rotate:DI (match_dup 1) (match_dup 2)))
6820 (compare:CC (match_dup 3)
6824 (define_insn "*rotldi3_internal3"
6825 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
6826 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6827 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
6829 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
6830 (rotate:DI (match_dup 1) (match_dup 2)))]
6837 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6838 (set_attr "length" "4,4,8,8")])
6841 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
6842 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6843 (match_operand:DI 2 "reg_or_cint_operand" ""))
6845 (set (match_operand:DI 0 "gpc_reg_operand" "")
6846 (rotate:DI (match_dup 1) (match_dup 2)))]
6847 "TARGET_POWERPC64 && reload_completed"
6849 (rotate:DI (match_dup 1) (match_dup 2)))
6851 (compare:CC (match_dup 0)
6855 (define_insn "*rotldi3_internal4"
6856 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6857 (and:DI (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6858 (match_operand:DI 2 "reg_or_cint_operand" "r,i"))
6859 (match_operand:DI 3 "mask64_operand" "n,n")))]
6862 rldc%B3 %0,%1,%2,%S3
6863 rldic%B3 %0,%1,%H2,%S3"
6864 [(set_attr "type" "var_shift_rotate,integer")])
6866 (define_insn "*rotldi3_internal5"
6867 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
6869 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6870 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
6871 (match_operand:DI 3 "mask64_operand" "n,n,n,n"))
6873 (clobber (match_scratch:DI 4 "=r,r,r,r"))]
6876 rldc%B3. %4,%1,%2,%S3
6877 rldic%B3. %4,%1,%H2,%S3
6880 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6881 (set_attr "length" "4,4,8,8")])
6884 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
6886 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6887 (match_operand:DI 2 "reg_or_cint_operand" ""))
6888 (match_operand:DI 3 "mask64_operand" ""))
6890 (clobber (match_scratch:DI 4 ""))]
6891 "TARGET_POWERPC64 && reload_completed"
6893 (and:DI (rotate:DI (match_dup 1)
6897 (compare:CC (match_dup 4)
6901 (define_insn "*rotldi3_internal6"
6902 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
6904 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6905 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
6906 (match_operand:DI 3 "mask64_operand" "n,n,n,n"))
6908 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
6909 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6912 rldc%B3. %0,%1,%2,%S3
6913 rldic%B3. %0,%1,%H2,%S3
6916 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6917 (set_attr "length" "4,4,8,8")])
6920 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
6922 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6923 (match_operand:DI 2 "reg_or_cint_operand" ""))
6924 (match_operand:DI 3 "mask64_operand" ""))
6926 (set (match_operand:DI 0 "gpc_reg_operand" "")
6927 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6928 "TARGET_POWERPC64 && reload_completed"
6930 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
6932 (compare:CC (match_dup 0)
6936 (define_insn "*rotldi3_internal7"
6937 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6940 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6941 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
6945 rldicl %0,%1,%H2,56"
6946 [(set_attr "type" "var_shift_rotate,integer")])
6948 (define_insn "*rotldi3_internal8"
6949 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
6950 (compare:CC (zero_extend:DI
6952 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6953 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
6955 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
6959 rldicl. %3,%1,%H2,56
6962 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6963 (set_attr "length" "4,4,8,8")])
6966 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
6967 (compare:CC (zero_extend:DI
6969 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6970 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6972 (clobber (match_scratch:DI 3 ""))]
6973 "TARGET_POWERPC64 && reload_completed"
6975 (zero_extend:DI (subreg:QI
6976 (rotate:DI (match_dup 1)
6979 (compare:CC (match_dup 3)
6983 (define_insn "*rotldi3_internal9"
6984 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
6985 (compare:CC (zero_extend:DI
6987 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6988 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
6990 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
6991 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6995 rldicl. %0,%1,%H2,56
6998 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6999 (set_attr "length" "4,4,8,8")])
7002 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7003 (compare:CC (zero_extend:DI
7005 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7006 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7008 (set (match_operand:DI 0 "gpc_reg_operand" "")
7009 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7010 "TARGET_POWERPC64 && reload_completed"
7012 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
7014 (compare:CC (match_dup 0)
7018 (define_insn "*rotldi3_internal10"
7019 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7022 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7023 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
7027 rldicl %0,%1,%H2,48"
7028 [(set_attr "type" "var_shift_rotate,integer")])
7030 (define_insn "*rotldi3_internal11"
7031 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7032 (compare:CC (zero_extend:DI
7034 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7035 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7037 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7041 rldicl. %3,%1,%H2,48
7044 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7045 (set_attr "length" "4,4,8,8")])
7048 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7049 (compare:CC (zero_extend:DI
7051 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7052 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7054 (clobber (match_scratch:DI 3 ""))]
7055 "TARGET_POWERPC64 && reload_completed"
7057 (zero_extend:DI (subreg:HI
7058 (rotate:DI (match_dup 1)
7061 (compare:CC (match_dup 3)
7065 (define_insn "*rotldi3_internal12"
7066 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7067 (compare:CC (zero_extend:DI
7069 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7070 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7072 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7073 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7077 rldicl. %0,%1,%H2,48
7080 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7081 (set_attr "length" "4,4,8,8")])
7084 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7085 (compare:CC (zero_extend:DI
7087 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7088 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7090 (set (match_operand:DI 0 "gpc_reg_operand" "")
7091 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7092 "TARGET_POWERPC64 && reload_completed"
7094 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
7096 (compare:CC (match_dup 0)
7100 (define_insn "*rotldi3_internal13"
7101 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7104 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7105 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
7109 rldicl %0,%1,%H2,32"
7110 [(set_attr "type" "var_shift_rotate,integer")])
7112 (define_insn "*rotldi3_internal14"
7113 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7114 (compare:CC (zero_extend:DI
7116 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7117 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7119 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7123 rldicl. %3,%1,%H2,32
7126 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7127 (set_attr "length" "4,4,8,8")])
7130 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7131 (compare:CC (zero_extend:DI
7133 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7134 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7136 (clobber (match_scratch:DI 3 ""))]
7137 "TARGET_POWERPC64 && reload_completed"
7139 (zero_extend:DI (subreg:SI
7140 (rotate:DI (match_dup 1)
7143 (compare:CC (match_dup 3)
7147 (define_insn "*rotldi3_internal15"
7148 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7149 (compare:CC (zero_extend:DI
7151 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7152 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7154 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7155 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7159 rldicl. %0,%1,%H2,32
7162 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7163 (set_attr "length" "4,4,8,8")])
7166 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7167 (compare:CC (zero_extend:DI
7169 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7170 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7172 (set (match_operand:DI 0 "gpc_reg_operand" "")
7173 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7174 "TARGET_POWERPC64 && reload_completed"
7176 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
7178 (compare:CC (match_dup 0)
7182 (define_expand "ashldi3"
7183 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7184 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7185 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7186 "TARGET_POWERPC64 || TARGET_POWER"
7189 if (TARGET_POWERPC64)
7191 else if (TARGET_POWER)
7193 emit_insn (gen_ashldi3_power (operands[0], operands[1], operands[2]));
7200 (define_insn "*ashldi3_internal1"
7201 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7202 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7203 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
7208 [(set_attr "type" "var_shift_rotate,shift")])
7210 (define_insn "*ashldi3_internal2"
7211 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7212 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7213 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7215 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7222 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7223 (set_attr "length" "4,4,8,8")])
7226 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7227 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7228 (match_operand:SI 2 "reg_or_cint_operand" ""))
7230 (clobber (match_scratch:DI 3 ""))]
7231 "TARGET_POWERPC64 && reload_completed"
7233 (ashift:DI (match_dup 1) (match_dup 2)))
7235 (compare:CC (match_dup 3)
7239 (define_insn "*ashldi3_internal3"
7240 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7241 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7242 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7244 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7245 (ashift:DI (match_dup 1) (match_dup 2)))]
7252 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7253 (set_attr "length" "4,4,8,8")])
7256 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7257 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7258 (match_operand:SI 2 "reg_or_cint_operand" ""))
7260 (set (match_operand:DI 0 "gpc_reg_operand" "")
7261 (ashift:DI (match_dup 1) (match_dup 2)))]
7262 "TARGET_POWERPC64 && reload_completed"
7264 (ashift:DI (match_dup 1) (match_dup 2)))
7266 (compare:CC (match_dup 0)
7270 (define_insn "*ashldi3_internal4"
7271 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7272 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7273 (match_operand:SI 2 "const_int_operand" "i"))
7274 (match_operand:DI 3 "const_int_operand" "n")))]
7275 "TARGET_POWERPC64 && includes_rldic_lshift_p (operands[2], operands[3])"
7276 "rldic %0,%1,%H2,%W3")
7278 (define_insn "ashldi3_internal5"
7279 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7281 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7282 (match_operand:SI 2 "const_int_operand" "i,i"))
7283 (match_operand:DI 3 "const_int_operand" "n,n"))
7285 (clobber (match_scratch:DI 4 "=r,r"))]
7286 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
7288 rldic. %4,%1,%H2,%W3
7290 [(set_attr "type" "compare")
7291 (set_attr "length" "4,8")])
7294 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7296 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7297 (match_operand:SI 2 "const_int_operand" ""))
7298 (match_operand:DI 3 "const_int_operand" ""))
7300 (clobber (match_scratch:DI 4 ""))]
7301 "TARGET_POWERPC64 && reload_completed
7302 && includes_rldic_lshift_p (operands[2], operands[3])"
7304 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7307 (compare:CC (match_dup 4)
7311 (define_insn "*ashldi3_internal6"
7312 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
7314 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7315 (match_operand:SI 2 "const_int_operand" "i,i"))
7316 (match_operand:DI 3 "const_int_operand" "n,n"))
7318 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7319 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7320 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
7322 rldic. %0,%1,%H2,%W3
7324 [(set_attr "type" "compare")
7325 (set_attr "length" "4,8")])
7328 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
7330 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7331 (match_operand:SI 2 "const_int_operand" ""))
7332 (match_operand:DI 3 "const_int_operand" ""))
7334 (set (match_operand:DI 0 "gpc_reg_operand" "")
7335 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7336 "TARGET_POWERPC64 && reload_completed
7337 && includes_rldic_lshift_p (operands[2], operands[3])"
7339 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7342 (compare:CC (match_dup 0)
7346 (define_insn "*ashldi3_internal7"
7347 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7348 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7349 (match_operand:SI 2 "const_int_operand" "i"))
7350 (match_operand:DI 3 "mask64_operand" "n")))]
7351 "TARGET_POWERPC64 && includes_rldicr_lshift_p (operands[2], operands[3])"
7352 "rldicr %0,%1,%H2,%S3")
7354 (define_insn "ashldi3_internal8"
7355 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7357 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7358 (match_operand:SI 2 "const_int_operand" "i,i"))
7359 (match_operand:DI 3 "mask64_operand" "n,n"))
7361 (clobber (match_scratch:DI 4 "=r,r"))]
7362 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
7364 rldicr. %4,%1,%H2,%S3
7366 [(set_attr "type" "compare")
7367 (set_attr "length" "4,8")])
7370 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7372 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7373 (match_operand:SI 2 "const_int_operand" ""))
7374 (match_operand:DI 3 "mask64_operand" ""))
7376 (clobber (match_scratch:DI 4 ""))]
7377 "TARGET_POWERPC64 && reload_completed
7378 && includes_rldicr_lshift_p (operands[2], operands[3])"
7380 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7383 (compare:CC (match_dup 4)
7387 (define_insn "*ashldi3_internal9"
7388 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
7390 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7391 (match_operand:SI 2 "const_int_operand" "i,i"))
7392 (match_operand:DI 3 "mask64_operand" "n,n"))
7394 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7395 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7396 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
7398 rldicr. %0,%1,%H2,%S3
7400 [(set_attr "type" "compare")
7401 (set_attr "length" "4,8")])
7404 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
7406 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7407 (match_operand:SI 2 "const_int_operand" ""))
7408 (match_operand:DI 3 "mask64_operand" ""))
7410 (set (match_operand:DI 0 "gpc_reg_operand" "")
7411 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7412 "TARGET_POWERPC64 && reload_completed
7413 && includes_rldicr_lshift_p (operands[2], operands[3])"
7415 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7418 (compare:CC (match_dup 0)
7422 (define_expand "lshrdi3"
7423 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7424 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7425 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7426 "TARGET_POWERPC64 || TARGET_POWER"
7429 if (TARGET_POWERPC64)
7431 else if (TARGET_POWER)
7433 emit_insn (gen_lshrdi3_power (operands[0], operands[1], operands[2]));
7440 (define_insn "*lshrdi3_internal1"
7441 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7442 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7443 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
7448 [(set_attr "type" "var_shift_rotate,shift")])
7450 (define_insn "*lshrdi3_internal2"
7451 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7452 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7453 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7455 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7462 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7463 (set_attr "length" "4,4,8,8")])
7466 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7467 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7468 (match_operand:SI 2 "reg_or_cint_operand" ""))
7470 (clobber (match_scratch:DI 3 ""))]
7471 "TARGET_POWERPC64 && reload_completed"
7473 (lshiftrt:DI (match_dup 1) (match_dup 2)))
7475 (compare:CC (match_dup 3)
7479 (define_insn "*lshrdi3_internal3"
7480 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7481 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7482 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7484 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7485 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
7492 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7493 (set_attr "length" "4,4,8,8")])
7496 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7497 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7498 (match_operand:SI 2 "reg_or_cint_operand" ""))
7500 (set (match_operand:DI 0 "gpc_reg_operand" "")
7501 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
7502 "TARGET_POWERPC64 && reload_completed"
7504 (lshiftrt:DI (match_dup 1) (match_dup 2)))
7506 (compare:CC (match_dup 0)
7510 (define_expand "ashrdi3"
7511 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7512 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7513 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7517 if (TARGET_POWERPC64)
7519 else if (TARGET_POWER && GET_CODE (operands[2]) == CONST_INT)
7521 emit_insn (gen_ashrdi3_power (operands[0], operands[1], operands[2]));
7524 else if (TARGET_32BIT && GET_CODE (operands[2]) == CONST_INT
7525 && WORDS_BIG_ENDIAN)
7527 emit_insn (gen_ashrdi3_no_power (operands[0], operands[1], operands[2]));
7534 (define_insn "*ashrdi3_internal1"
7535 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7536 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7537 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
7542 [(set_attr "type" "var_shift_rotate,shift")])
7544 (define_insn "*ashrdi3_internal2"
7545 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7546 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7547 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7549 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7556 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7557 (set_attr "length" "4,4,8,8")])
7560 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7561 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7562 (match_operand:SI 2 "reg_or_cint_operand" ""))
7564 (clobber (match_scratch:DI 3 ""))]
7565 "TARGET_POWERPC64 && reload_completed"
7567 (ashiftrt:DI (match_dup 1) (match_dup 2)))
7569 (compare:CC (match_dup 3)
7573 (define_insn "*ashrdi3_internal3"
7574 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7575 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7576 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7578 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7579 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
7586 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7587 (set_attr "length" "4,4,8,8")])
7590 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7591 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7592 (match_operand:SI 2 "reg_or_cint_operand" ""))
7594 (set (match_operand:DI 0 "gpc_reg_operand" "")
7595 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
7596 "TARGET_POWERPC64 && reload_completed"
7598 (ashiftrt:DI (match_dup 1) (match_dup 2)))
7600 (compare:CC (match_dup 0)
7604 (define_expand "anddi3"
7606 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7607 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7608 (match_operand:DI 2 "and64_2_operand" "")))
7609 (clobber (match_scratch:CC 3 ""))])]
7613 (define_insn "anddi3_mc"
7614 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
7615 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r")
7616 (match_operand:DI 2 "and64_2_operand" "?r,S,T,K,J,t")))
7617 (clobber (match_scratch:CC 3 "=X,X,X,x,x,X"))]
7618 "TARGET_POWERPC64 && rs6000_gen_cell_microcode"
7621 rldic%B2 %0,%1,0,%S2
7622 rlwinm %0,%1,0,%m2,%M2
7626 [(set_attr "type" "*,*,*,compare,compare,*")
7627 (set_attr "length" "4,4,4,4,4,8")])
7629 (define_insn "anddi3_nomc"
7630 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7631 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r")
7632 (match_operand:DI 2 "and64_2_operand" "?r,S,T,t")))
7633 (clobber (match_scratch:CC 3 "=X,X,X,X"))]
7634 "TARGET_POWERPC64 && !rs6000_gen_cell_microcode"
7637 rldic%B2 %0,%1,0,%S2
7638 rlwinm %0,%1,0,%m2,%M2
7640 [(set_attr "length" "4,4,4,8")])
7643 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7644 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7645 (match_operand:DI 2 "mask64_2_operand" "")))
7646 (clobber (match_scratch:CC 3 ""))]
7648 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7649 && !mask_operand (operands[2], DImode)
7650 && !mask64_operand (operands[2], DImode)"
7652 (and:DI (rotate:DI (match_dup 1)
7656 (and:DI (rotate:DI (match_dup 0)
7660 build_mask64_2_operands (operands[2], &operands[4]);
7663 (define_insn "*anddi3_internal2_mc"
7664 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,x,?y,?y,?y,??y,??y,?y")
7665 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r,r,r")
7666 (match_operand:DI 2 "and64_2_operand" "r,S,T,K,J,t,r,S,T,K,J,t"))
7668 (clobber (match_scratch:DI 3 "=r,r,r,r,r,r,r,r,r,r,r,r"))
7669 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,X,X,x,x,X"))]
7670 "TARGET_64BIT && rs6000_gen_cell_microcode"
7673 rldic%B2. %3,%1,0,%S2
7674 rlwinm. %3,%1,0,%m2,%M2
7684 [(set_attr "type" "compare,compare,delayed_compare,compare,compare,compare,compare,compare,compare,compare,compare,compare")
7685 (set_attr "length" "4,4,4,4,4,8,8,8,8,8,8,12")])
7687 (define_insn "*anddi3_internal2_nomc"
7688 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y,?y,??y,??y,?y")
7689 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r")
7690 (match_operand:DI 2 "and64_2_operand" "t,r,S,K,J,t"))
7692 (clobber (match_scratch:DI 3 "=r,r,r,r,r,r"))
7693 (clobber (match_scratch:CC 4 "=X,X,X,x,x,X"))]
7694 "TARGET_64BIT && !rs6000_gen_cell_microcode"
7696 [(set_attr "type" "delayed_compare,compare,compare,compare,compare,compare")
7697 (set_attr "length" "8,8,8,8,8,12")])
7700 [(set (match_operand:CC 0 "cc_reg_operand" "")
7701 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7702 (match_operand:DI 2 "mask64_2_operand" ""))
7704 (clobber (match_scratch:DI 3 ""))
7705 (clobber (match_scratch:CC 4 ""))]
7706 "TARGET_64BIT && reload_completed
7707 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7708 && !mask_operand (operands[2], DImode)
7709 && !mask64_operand (operands[2], DImode)"
7711 (and:DI (rotate:DI (match_dup 1)
7714 (parallel [(set (match_dup 0)
7715 (compare:CC (and:DI (rotate:DI (match_dup 3)
7719 (clobber (match_dup 3))])]
7722 build_mask64_2_operands (operands[2], &operands[5]);
7725 (define_insn "*anddi3_internal3_mc"
7726 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,x,x,?y,?y,?y,??y,??y,?y")
7727 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r,r,r")
7728 (match_operand:DI 2 "and64_2_operand" "r,S,T,K,J,t,r,S,T,K,J,t"))
7730 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r,r,r")
7731 (and:DI (match_dup 1) (match_dup 2)))
7732 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,X,X,x,x,X"))]
7733 "TARGET_64BIT && rs6000_gen_cell_microcode"
7736 rldic%B2. %0,%1,0,%S2
7737 rlwinm. %0,%1,0,%m2,%M2
7747 [(set_attr "type" "compare,compare,delayed_compare,compare,compare,compare,compare,compare,compare,compare,compare,compare")
7748 (set_attr "length" "4,4,4,4,4,8,8,8,8,8,8,12")])
7750 (define_insn "*anddi3_internal3_nomc"
7751 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y,?y,??y,??y,?y")
7752 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r")
7753 (match_operand:DI 2 "and64_2_operand" "t,r,S,K,J,t"))
7755 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
7756 (and:DI (match_dup 1) (match_dup 2)))
7757 (clobber (match_scratch:CC 4 "=X,X,X,x,x,X"))]
7758 "TARGET_64BIT && !rs6000_gen_cell_microcode"
7760 [(set_attr "type" "delayed_compare,compare,compare,compare,compare,compare")
7761 (set_attr "length" "8,8,8,8,8,12")])
7763 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7764 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7765 (match_operand:DI 2 "and64_2_operand" ""))
7767 (set (match_operand:DI 0 "gpc_reg_operand" "")
7768 (and:DI (match_dup 1) (match_dup 2)))
7769 (clobber (match_scratch:CC 4 ""))]
7770 "TARGET_64BIT && reload_completed"
7771 [(parallel [(set (match_dup 0)
7772 (and:DI (match_dup 1) (match_dup 2)))
7773 (clobber (match_dup 4))])
7775 (compare:CC (match_dup 0)
7780 [(set (match_operand:CC 3 "cc_reg_operand" "")
7781 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7782 (match_operand:DI 2 "mask64_2_operand" ""))
7784 (set (match_operand:DI 0 "gpc_reg_operand" "")
7785 (and:DI (match_dup 1) (match_dup 2)))
7786 (clobber (match_scratch:CC 4 ""))]
7787 "TARGET_64BIT && reload_completed
7788 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7789 && !mask_operand (operands[2], DImode)
7790 && !mask64_operand (operands[2], DImode)"
7792 (and:DI (rotate:DI (match_dup 1)
7795 (parallel [(set (match_dup 3)
7796 (compare:CC (and:DI (rotate:DI (match_dup 0)
7801 (and:DI (rotate:DI (match_dup 0)
7806 build_mask64_2_operands (operands[2], &operands[5]);
7809 (define_expand "iordi3"
7810 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7811 (ior:DI (match_operand:DI 1 "gpc_reg_operand" "")
7812 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
7816 if (non_logical_cint_operand (operands[2], DImode))
7818 HOST_WIDE_INT value;
7819 rtx tmp = ((!can_create_pseudo_p ()
7820 || rtx_equal_p (operands[0], operands[1]))
7821 ? operands[0] : gen_reg_rtx (DImode));
7823 if (GET_CODE (operands[2]) == CONST_INT)
7825 value = INTVAL (operands[2]);
7826 emit_insn (gen_iordi3 (tmp, operands[1],
7827 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
7831 value = CONST_DOUBLE_LOW (operands[2]);
7832 emit_insn (gen_iordi3 (tmp, operands[1],
7833 immed_double_const (value
7834 & (~ (HOST_WIDE_INT) 0xffff),
7838 emit_insn (gen_iordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
7843 (define_expand "xordi3"
7844 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7845 (xor:DI (match_operand:DI 1 "gpc_reg_operand" "")
7846 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
7850 if (non_logical_cint_operand (operands[2], DImode))
7852 HOST_WIDE_INT value;
7853 rtx tmp = ((!can_create_pseudo_p ()
7854 || rtx_equal_p (operands[0], operands[1]))
7855 ? operands[0] : gen_reg_rtx (DImode));
7857 if (GET_CODE (operands[2]) == CONST_INT)
7859 value = INTVAL (operands[2]);
7860 emit_insn (gen_xordi3 (tmp, operands[1],
7861 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
7865 value = CONST_DOUBLE_LOW (operands[2]);
7866 emit_insn (gen_xordi3 (tmp, operands[1],
7867 immed_double_const (value
7868 & (~ (HOST_WIDE_INT) 0xffff),
7872 emit_insn (gen_xordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
7877 (define_insn "*booldi3_internal1"
7878 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
7879 (match_operator:DI 3 "boolean_or_operator"
7880 [(match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
7881 (match_operand:DI 2 "logical_operand" "r,K,JF")]))]
7888 (define_insn "*booldi3_internal2"
7889 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7890 (compare:CC (match_operator:DI 4 "boolean_or_operator"
7891 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
7892 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7894 (clobber (match_scratch:DI 3 "=r,r"))]
7899 [(set_attr "type" "compare")
7900 (set_attr "length" "4,8")])
7903 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7904 (compare:CC (match_operator:DI 4 "boolean_operator"
7905 [(match_operand:DI 1 "gpc_reg_operand" "")
7906 (match_operand:DI 2 "gpc_reg_operand" "")])
7908 (clobber (match_scratch:DI 3 ""))]
7909 "TARGET_POWERPC64 && reload_completed"
7910 [(set (match_dup 3) (match_dup 4))
7912 (compare:CC (match_dup 3)
7916 (define_insn "*booldi3_internal3"
7917 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7918 (compare:CC (match_operator:DI 4 "boolean_operator"
7919 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
7920 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7922 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7928 [(set_attr "type" "compare")
7929 (set_attr "length" "4,8")])
7932 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7933 (compare:CC (match_operator:DI 4 "boolean_operator"
7934 [(match_operand:DI 1 "gpc_reg_operand" "")
7935 (match_operand:DI 2 "gpc_reg_operand" "")])
7937 (set (match_operand:DI 0 "gpc_reg_operand" "")
7939 "TARGET_POWERPC64 && reload_completed"
7940 [(set (match_dup 0) (match_dup 4))
7942 (compare:CC (match_dup 0)
7946 ;; Split a logical operation that we can't do in one insn into two insns,
7947 ;; each of which does one 16-bit part. This is used by combine.
7950 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7951 (match_operator:DI 3 "boolean_or_operator"
7952 [(match_operand:DI 1 "gpc_reg_operand" "")
7953 (match_operand:DI 2 "non_logical_cint_operand" "")]))]
7955 [(set (match_dup 0) (match_dup 4))
7956 (set (match_dup 0) (match_dup 5))]
7961 if (GET_CODE (operands[2]) == CONST_DOUBLE)
7963 HOST_WIDE_INT value = CONST_DOUBLE_LOW (operands[2]);
7964 i3 = immed_double_const (value & (~ (HOST_WIDE_INT) 0xffff),
7966 i4 = GEN_INT (value & 0xffff);
7970 i3 = GEN_INT (INTVAL (operands[2])
7971 & (~ (HOST_WIDE_INT) 0xffff));
7972 i4 = GEN_INT (INTVAL (operands[2]) & 0xffff);
7974 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
7976 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
7980 (define_insn "*boolcdi3_internal1"
7981 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7982 (match_operator:DI 3 "boolean_operator"
7983 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
7984 (match_operand:DI 2 "gpc_reg_operand" "r")]))]
7988 (define_insn "*boolcdi3_internal2"
7989 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7990 (compare:CC (match_operator:DI 4 "boolean_operator"
7991 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
7992 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7994 (clobber (match_scratch:DI 3 "=r,r"))]
7999 [(set_attr "type" "compare")
8000 (set_attr "length" "4,8")])
8003 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8004 (compare:CC (match_operator:DI 4 "boolean_operator"
8005 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
8006 (match_operand:DI 2 "gpc_reg_operand" "")])
8008 (clobber (match_scratch:DI 3 ""))]
8009 "TARGET_POWERPC64 && reload_completed"
8010 [(set (match_dup 3) (match_dup 4))
8012 (compare:CC (match_dup 3)
8016 (define_insn "*boolcdi3_internal3"
8017 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
8018 (compare:CC (match_operator:DI 4 "boolean_operator"
8019 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
8020 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
8022 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8028 [(set_attr "type" "compare")
8029 (set_attr "length" "4,8")])
8032 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8033 (compare:CC (match_operator:DI 4 "boolean_operator"
8034 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
8035 (match_operand:DI 2 "gpc_reg_operand" "")])
8037 (set (match_operand:DI 0 "gpc_reg_operand" "")
8039 "TARGET_POWERPC64 && reload_completed"
8040 [(set (match_dup 0) (match_dup 4))
8042 (compare:CC (match_dup 0)
8046 (define_insn "*boolccdi3_internal1"
8047 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
8048 (match_operator:DI 3 "boolean_operator"
8049 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
8050 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r"))]))]
8054 (define_insn "*boolccdi3_internal2"
8055 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
8056 (compare:CC (match_operator:DI 4 "boolean_operator"
8057 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
8058 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
8060 (clobber (match_scratch:DI 3 "=r,r"))]
8065 [(set_attr "type" "compare")
8066 (set_attr "length" "4,8")])
8069 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8070 (compare:CC (match_operator:DI 4 "boolean_operator"
8071 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
8072 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
8074 (clobber (match_scratch:DI 3 ""))]
8075 "TARGET_POWERPC64 && reload_completed"
8076 [(set (match_dup 3) (match_dup 4))
8078 (compare:CC (match_dup 3)
8082 (define_insn "*boolccdi3_internal3"
8083 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
8084 (compare:CC (match_operator:DI 4 "boolean_operator"
8085 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
8086 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
8088 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8094 [(set_attr "type" "compare")
8095 (set_attr "length" "4,8")])
8098 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8099 (compare:CC (match_operator:DI 4 "boolean_operator"
8100 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
8101 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
8103 (set (match_operand:DI 0 "gpc_reg_operand" "")
8105 "TARGET_POWERPC64 && reload_completed"
8106 [(set (match_dup 0) (match_dup 4))
8108 (compare:CC (match_dup 0)
8112 ;; Now define ways of moving data around.
8114 ;; Set up a register with a value from the GOT table
8116 (define_expand "movsi_got"
8117 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8118 (unspec:SI [(match_operand:SI 1 "got_operand" "")
8119 (match_dup 2)] UNSPEC_MOVSI_GOT))]
8120 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
8123 if (GET_CODE (operands[1]) == CONST)
8125 rtx offset = const0_rtx;
8126 HOST_WIDE_INT value;
8128 operands[1] = eliminate_constant_term (XEXP (operands[1], 0), &offset);
8129 value = INTVAL (offset);
8132 rtx tmp = (!can_create_pseudo_p ()
8134 : gen_reg_rtx (Pmode));
8135 emit_insn (gen_movsi_got (tmp, operands[1]));
8136 emit_insn (gen_addsi3 (operands[0], tmp, offset));
8141 operands[2] = rs6000_got_register (operands[1]);
8144 (define_insn "*movsi_got_internal"
8145 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8146 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
8147 (match_operand:SI 2 "gpc_reg_operand" "b")]
8149 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
8150 "{l|lwz} %0,%a1@got(%2)"
8151 [(set_attr "type" "load")])
8153 ;; Used by sched, shorten_branches and final when the GOT pseudo reg
8154 ;; didn't get allocated to a hard register.
8156 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8157 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
8158 (match_operand:SI 2 "memory_operand" "")]
8160 "DEFAULT_ABI == ABI_V4
8162 && (reload_in_progress || reload_completed)"
8163 [(set (match_dup 0) (match_dup 2))
8164 (set (match_dup 0) (unspec:SI [(match_dup 1)(match_dup 0)]
8168 ;; For SI, we special-case integers that can't be loaded in one insn. We
8169 ;; do the load 16-bits at a time. We could do this by loading from memory,
8170 ;; and this is even supposed to be faster, but it is simpler not to get
8171 ;; integers in the TOC.
8172 (define_insn "movsi_low"
8173 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8174 (mem:SI (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
8175 (match_operand 2 "" ""))))]
8176 "TARGET_MACHO && ! TARGET_64BIT"
8177 "{l|lwz} %0,lo16(%2)(%1)"
8178 [(set_attr "type" "load")
8179 (set_attr "length" "4")])
8181 (define_insn "*movsi_internal1"
8182 [(set (match_operand:SI 0 "rs6000_nonimmediate_operand" "=r,r,r,m,r,r,r,r,r,*q,*c*l,*h,*h")
8183 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,R,*h,r,r,r,0"))]
8184 "gpc_reg_operand (operands[0], SImode)
8185 || gpc_reg_operand (operands[1], SImode)"
8189 {l%U1%X1|lwz%U1%X1} %0,%1
8190 {st%U0%X0|stw%U0%X0} %1,%0
8200 [(set_attr "type" "*,*,load,store,*,*,*,*,mfjmpr,*,mtjmpr,*,*")
8201 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4,4,4")])
8203 ;; Split a load of a large constant into the appropriate two-insn
8207 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8208 (match_operand:SI 1 "const_int_operand" ""))]
8209 "(unsigned HOST_WIDE_INT) (INTVAL (operands[1]) + 0x8000) >= 0x10000
8210 && (INTVAL (operands[1]) & 0xffff) != 0"
8214 (ior:SI (match_dup 0)
8217 { rtx tem = rs6000_emit_set_const (operands[0], SImode, operands[1], 2);
8219 if (tem == operands[0])
8225 (define_insn "*mov<mode>_internal2"
8226 [(set (match_operand:CC 2 "cc_reg_operand" "=y,x,?y")
8227 (compare:CC (match_operand:P 1 "gpc_reg_operand" "0,r,r")
8229 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r") (match_dup 1))]
8232 {cmpi|cmp<wd>i} %2,%0,0
8235 [(set_attr "type" "cmp,compare,cmp")
8236 (set_attr "length" "4,4,8")])
8239 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
8240 (compare:CC (match_operand:P 1 "gpc_reg_operand" "")
8242 (set (match_operand:P 0 "gpc_reg_operand" "") (match_dup 1))]
8244 [(set (match_dup 0) (match_dup 1))
8246 (compare:CC (match_dup 0)
8250 (define_insn "*movhi_internal"
8251 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
8252 (match_operand:HI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
8253 "gpc_reg_operand (operands[0], HImode)
8254 || gpc_reg_operand (operands[1], HImode)"
8264 [(set_attr "type" "*,load,store,*,mfjmpr,*,mtjmpr,*")])
8266 (define_expand "mov<mode>"
8267 [(set (match_operand:INT 0 "general_operand" "")
8268 (match_operand:INT 1 "any_operand" ""))]
8270 "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
8272 (define_insn "*movqi_internal"
8273 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
8274 (match_operand:QI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
8275 "gpc_reg_operand (operands[0], QImode)
8276 || gpc_reg_operand (operands[1], QImode)"
8286 [(set_attr "type" "*,load,store,*,mfjmpr,*,mtjmpr,*")])
8288 ;; Here is how to move condition codes around. When we store CC data in
8289 ;; an integer register or memory, we store just the high-order 4 bits.
8290 ;; This lets us not shift in the most common case of CR0.
8291 (define_expand "movcc"
8292 [(set (match_operand:CC 0 "nonimmediate_operand" "")
8293 (match_operand:CC 1 "nonimmediate_operand" ""))]
8297 (define_insn "*movcc_internal1"
8298 [(set (match_operand:CC 0 "nonimmediate_operand" "=y,x,?y,y,r,r,r,r,r,q,cl,r,m")
8299 (match_operand:CC 1 "general_operand" "y,r,r,O,x,y,r,I,h,r,r,m,r"))]
8300 "register_operand (operands[0], CCmode)
8301 || register_operand (operands[1], CCmode)"
8305 {rlinm|rlwinm} %1,%1,%F0,0xffffffff\;mtcrf %R0,%1\;{rlinm|rlwinm} %1,%1,%f0,0xffffffff
8308 mfcr %0%Q1\;{rlinm|rlwinm} %0,%0,%f1,0xf0000000
8314 {l%U1%X1|lwz%U1%X1} %0,%1
8315 {st%U0%U1|stw%U0%U1} %1,%0"
8317 (cond [(eq_attr "alternative" "0,3")
8318 (const_string "cr_logical")
8319 (eq_attr "alternative" "1,2")
8320 (const_string "mtcr")
8321 (eq_attr "alternative" "6,7,9")
8322 (const_string "integer")
8323 (eq_attr "alternative" "8")
8324 (const_string "mfjmpr")
8325 (eq_attr "alternative" "10")
8326 (const_string "mtjmpr")
8327 (eq_attr "alternative" "11")
8328 (const_string "load")
8329 (eq_attr "alternative" "12")
8330 (const_string "store")
8331 (ne (symbol_ref "TARGET_MFCRF") (const_int 0))
8332 (const_string "mfcrf")
8334 (const_string "mfcr")))
8335 (set_attr "length" "4,4,12,4,4,8,4,4,4,4,4,4,4")])
8337 ;; For floating-point, we normally deal with the floating-point registers
8338 ;; unless -msoft-float is used. The sole exception is that parameter passing
8339 ;; can produce floating-point values in fixed-point registers. Unless the
8340 ;; value is a simple constant or already in memory, we deal with this by
8341 ;; allocating memory and copying the value explicitly via that memory location.
8342 (define_expand "movsf"
8343 [(set (match_operand:SF 0 "nonimmediate_operand" "")
8344 (match_operand:SF 1 "any_operand" ""))]
8346 "{ rs6000_emit_move (operands[0], operands[1], SFmode); DONE; }")
8349 [(set (match_operand:SF 0 "gpc_reg_operand" "")
8350 (match_operand:SF 1 "const_double_operand" ""))]
8352 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8353 || (GET_CODE (operands[0]) == SUBREG
8354 && GET_CODE (SUBREG_REG (operands[0])) == REG
8355 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8356 [(set (match_dup 2) (match_dup 3))]
8362 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8363 REAL_VALUE_TO_TARGET_SINGLE (rv, l);
8365 if (! TARGET_POWERPC64)
8366 operands[2] = operand_subword (operands[0], 0, 0, SFmode);
8368 operands[2] = gen_lowpart (SImode, operands[0]);
8370 operands[3] = gen_int_mode (l, SImode);
8373 (define_insn "*movsf_hardfloat"
8374 [(set (match_operand:SF 0 "nonimmediate_operand" "=!r,!r,m,f,f,m,*c*l,*q,!r,*h,!r,!r")
8375 (match_operand:SF 1 "input_operand" "r,m,r,f,m,f,r,r,h,0,G,Fn"))]
8376 "(gpc_reg_operand (operands[0], SFmode)
8377 || gpc_reg_operand (operands[1], SFmode))
8378 && (TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT)"
8381 {l%U1%X1|lwz%U1%X1} %0,%1
8382 {st%U0%X0|stw%U0%X0} %1,%0
8392 [(set_attr "type" "*,load,store,fp,fpload,fpstore,mtjmpr,*,mfjmpr,*,*,*")
8393 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,8")])
8395 (define_insn "*movsf_softfloat"
8396 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,cl,q,r,r,m,r,r,r,r,r,*h")
8397 (match_operand:SF 1 "input_operand" "r,r,r,h,m,r,I,L,R,G,Fn,0"))]
8398 "(gpc_reg_operand (operands[0], SFmode)
8399 || gpc_reg_operand (operands[1], SFmode))
8400 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)"
8406 {l%U1%X1|lwz%U1%X1} %0,%1
8407 {st%U0%X0|stw%U0%X0} %1,%0
8414 [(set_attr "type" "*,mtjmpr,*,mfjmpr,load,store,*,*,*,*,*,*")
8415 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,8,4")])
8418 (define_expand "movdf"
8419 [(set (match_operand:DF 0 "nonimmediate_operand" "")
8420 (match_operand:DF 1 "any_operand" ""))]
8422 "{ rs6000_emit_move (operands[0], operands[1], DFmode); DONE; }")
8425 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8426 (match_operand:DF 1 "const_int_operand" ""))]
8427 "! TARGET_POWERPC64 && reload_completed
8428 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8429 || (GET_CODE (operands[0]) == SUBREG
8430 && GET_CODE (SUBREG_REG (operands[0])) == REG
8431 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8432 [(set (match_dup 2) (match_dup 4))
8433 (set (match_dup 3) (match_dup 1))]
8436 int endian = (WORDS_BIG_ENDIAN == 0);
8437 HOST_WIDE_INT value = INTVAL (operands[1]);
8439 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
8440 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
8441 #if HOST_BITS_PER_WIDE_INT == 32
8442 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
8444 operands[4] = GEN_INT (value >> 32);
8445 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
8450 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8451 (match_operand:DF 1 "const_double_operand" ""))]
8452 "! TARGET_POWERPC64 && reload_completed
8453 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8454 || (GET_CODE (operands[0]) == SUBREG
8455 && GET_CODE (SUBREG_REG (operands[0])) == REG
8456 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8457 [(set (match_dup 2) (match_dup 4))
8458 (set (match_dup 3) (match_dup 5))]
8461 int endian = (WORDS_BIG_ENDIAN == 0);
8465 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8466 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
8468 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
8469 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
8470 operands[4] = gen_int_mode (l[endian], SImode);
8471 operands[5] = gen_int_mode (l[1 - endian], SImode);
8475 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8476 (match_operand:DF 1 "const_double_operand" ""))]
8477 "TARGET_POWERPC64 && reload_completed
8478 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8479 || (GET_CODE (operands[0]) == SUBREG
8480 && GET_CODE (SUBREG_REG (operands[0])) == REG
8481 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8482 [(set (match_dup 2) (match_dup 3))]
8485 int endian = (WORDS_BIG_ENDIAN == 0);
8488 #if HOST_BITS_PER_WIDE_INT >= 64
8492 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8493 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
8495 operands[2] = gen_lowpart (DImode, operands[0]);
8496 /* HIGHPART is lower memory address when WORDS_BIG_ENDIAN. */
8497 #if HOST_BITS_PER_WIDE_INT >= 64
8498 val = ((HOST_WIDE_INT)(unsigned long)l[endian] << 32
8499 | ((HOST_WIDE_INT)(unsigned long)l[1 - endian]));
8501 operands[3] = gen_int_mode (val, DImode);
8503 operands[3] = immed_double_const (l[1 - endian], l[endian], DImode);
8507 ;; Don't have reload use general registers to load a constant. First,
8508 ;; it might not work if the output operand is the equivalent of
8509 ;; a non-offsettable memref, but also it is less efficient than loading
8510 ;; the constant into an FP register, since it will probably be used there.
8511 ;; The "??" is a kludge until we can figure out a more reasonable way
8512 ;; of handling these non-offsettable values.
8513 (define_insn "*movdf_hardfloat32"
8514 [(set (match_operand:DF 0 "nonimmediate_operand" "=!r,??r,m,f,f,m,!r,!r,!r")
8515 (match_operand:DF 1 "input_operand" "r,m,r,f,m,f,G,H,F"))]
8516 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
8517 && (gpc_reg_operand (operands[0], DFmode)
8518 || gpc_reg_operand (operands[1], DFmode))"
8521 switch (which_alternative)
8526 /* We normally copy the low-numbered register first. However, if
8527 the first register operand 0 is the same as the second register
8528 of operand 1, we must copy in the opposite order. */
8529 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8530 return \"mr %L0,%L1\;mr %0,%1\";
8532 return \"mr %0,%1\;mr %L0,%L1\";
8534 if (rs6000_offsettable_memref_p (operands[1])
8535 || (GET_CODE (operands[1]) == MEM
8536 && (GET_CODE (XEXP (operands[1], 0)) == LO_SUM
8537 || GET_CODE (XEXP (operands[1], 0)) == PRE_INC
8538 || GET_CODE (XEXP (operands[1], 0)) == PRE_DEC
8539 || GET_CODE (XEXP (operands[1], 0)) == PRE_MODIFY)))
8541 /* If the low-address word is used in the address, we must load
8542 it last. Otherwise, load it first. Note that we cannot have
8543 auto-increment in that case since the address register is
8544 known to be dead. */
8545 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
8547 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
8549 return \"{l%U1%X1|lwz%U1%X1} %0,%1\;{l|lwz} %L0,%L1\";
8555 addreg = find_addr_reg (XEXP (operands[1], 0));
8556 if (refers_to_regno_p (REGNO (operands[0]),
8557 REGNO (operands[0]) + 1,
8560 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
8561 output_asm_insn (\"{l%X1|lwz%X1} %L0,%1\", operands);
8562 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
8563 return \"{l%X1|lwz%X1} %0,%1\";
8567 output_asm_insn (\"{l%X1|lwz%X1} %0,%1\", operands);
8568 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
8569 output_asm_insn (\"{l%X1|lwz%X1} %L0,%1\", operands);
8570 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
8575 if (rs6000_offsettable_memref_p (operands[0])
8576 || (GET_CODE (operands[0]) == MEM
8577 && (GET_CODE (XEXP (operands[0], 0)) == LO_SUM
8578 || GET_CODE (XEXP (operands[0], 0)) == PRE_INC
8579 || GET_CODE (XEXP (operands[0], 0)) == PRE_DEC
8580 || GET_CODE (XEXP (operands[0], 0)) == PRE_MODIFY)))
8581 return \"{st%U0%X0|stw%U0%X0} %1,%0\;{st|stw} %L1,%L0\";
8586 addreg = find_addr_reg (XEXP (operands[0], 0));
8587 output_asm_insn (\"{st%X0|stw%X0} %1,%0\", operands);
8588 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
8589 output_asm_insn (\"{st%X0|stw%X0} %L1,%0\", operands);
8590 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
8594 return \"fmr %0,%1\";
8596 return \"lfd%U1%X1 %0,%1\";
8598 return \"stfd%U0%X0 %1,%0\";
8605 [(set_attr "type" "two,load,store,fp,fpload,fpstore,*,*,*")
8606 (set_attr "length" "8,16,16,4,4,4,8,12,16")])
8608 (define_insn "*movdf_softfloat32"
8609 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,m,r,r,r")
8610 (match_operand:DF 1 "input_operand" "r,m,r,G,H,F"))]
8612 && ((TARGET_FPRS && !TARGET_DOUBLE_FLOAT)
8613 || TARGET_SOFT_FLOAT || TARGET_E500_SINGLE)
8614 && (gpc_reg_operand (operands[0], DFmode)
8615 || gpc_reg_operand (operands[1], DFmode))"
8618 switch (which_alternative)
8623 /* We normally copy the low-numbered register first. However, if
8624 the first register operand 0 is the same as the second register of
8625 operand 1, we must copy in the opposite order. */
8626 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8627 return \"mr %L0,%L1\;mr %0,%1\";
8629 return \"mr %0,%1\;mr %L0,%L1\";
8631 /* If the low-address word is used in the address, we must load
8632 it last. Otherwise, load it first. Note that we cannot have
8633 auto-increment in that case since the address register is
8634 known to be dead. */
8635 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
8637 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
8639 return \"{l%U1%X1|lwz%U1%X1} %0,%1\;{l|lwz} %L0,%L1\";
8641 return \"{st%U0%X0|stw%U0%X0} %1,%0\;{st|stw} %L1,%L0\";
8648 [(set_attr "type" "two,load,store,*,*,*")
8649 (set_attr "length" "8,8,8,8,12,16")])
8651 ; ld/std require word-aligned displacements -> 'Y' constraint.
8652 ; List Y->r and r->Y before r->r for reload.
8653 (define_insn "*movdf_hardfloat64_mfpgpr"
8654 [(set (match_operand:DF 0 "nonimmediate_operand" "=Y,r,!r,f,f,m,*c*l,!r,*h,!r,!r,!r,r,f")
8655 (match_operand:DF 1 "input_operand" "r,Y,r,f,m,f,r,h,0,G,H,F,f,r"))]
8656 "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
8657 && TARGET_DOUBLE_FLOAT
8658 && (gpc_reg_operand (operands[0], DFmode)
8659 || gpc_reg_operand (operands[1], DFmode))"
8675 [(set_attr "type" "store,load,*,fp,fpload,fpstore,mtjmpr,mfjmpr,*,*,*,*,mftgpr,mffgpr")
8676 (set_attr "length" "4,4,4,4,4,4,4,4,4,8,12,16,4,4")])
8678 ; ld/std require word-aligned displacements -> 'Y' constraint.
8679 ; List Y->r and r->Y before r->r for reload.
8680 (define_insn "*movdf_hardfloat64"
8681 [(set (match_operand:DF 0 "nonimmediate_operand" "=Y,r,!r,f,f,m,*c*l,!r,*h,!r,!r,!r")
8682 (match_operand:DF 1 "input_operand" "r,Y,r,f,m,f,r,h,0,G,H,F"))]
8683 "TARGET_POWERPC64 && !TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
8684 && TARGET_DOUBLE_FLOAT
8685 && (gpc_reg_operand (operands[0], DFmode)
8686 || gpc_reg_operand (operands[1], DFmode))"
8700 [(set_attr "type" "store,load,*,fp,fpload,fpstore,mtjmpr,mfjmpr,*,*,*,*")
8701 (set_attr "length" "4,4,4,4,4,4,4,4,4,8,12,16")])
8703 (define_insn "*movdf_softfloat64"
8704 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,Y,r,cl,r,r,r,r,*h")
8705 (match_operand:DF 1 "input_operand" "Y,r,r,r,h,G,H,F,0"))]
8706 "TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)
8707 && (gpc_reg_operand (operands[0], DFmode)
8708 || gpc_reg_operand (operands[1], DFmode))"
8719 [(set_attr "type" "load,store,*,mtjmpr,mfjmpr,*,*,*,*")
8720 (set_attr "length" "4,4,4,4,4,8,12,16,4")])
8722 (define_expand "movtf"
8723 [(set (match_operand:TF 0 "general_operand" "")
8724 (match_operand:TF 1 "any_operand" ""))]
8725 "!TARGET_IEEEQUAD && TARGET_LONG_DOUBLE_128"
8726 "{ rs6000_emit_move (operands[0], operands[1], TFmode); DONE; }")
8728 ; It's important to list the o->f and f->o moves before f->f because
8729 ; otherwise reload, given m->f, will try to pick f->f and reload it,
8730 ; which doesn't make progress. Likewise r->Y must be before r->r.
8731 (define_insn_and_split "*movtf_internal"
8732 [(set (match_operand:TF 0 "nonimmediate_operand" "=o,f,f,r,Y,r")
8733 (match_operand:TF 1 "input_operand" "f,o,f,YGHF,r,r"))]
8735 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128
8736 && (gpc_reg_operand (operands[0], TFmode)
8737 || gpc_reg_operand (operands[1], TFmode))"
8739 "&& reload_completed"
8741 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
8742 [(set_attr "length" "8,8,8,20,20,16")])
8744 (define_insn_and_split "*movtf_softfloat"
8745 [(set (match_operand:TF 0 "rs6000_nonimmediate_operand" "=r,Y,r")
8746 (match_operand:TF 1 "input_operand" "YGHF,r,r"))]
8748 && (TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_LONG_DOUBLE_128
8749 && (gpc_reg_operand (operands[0], TFmode)
8750 || gpc_reg_operand (operands[1], TFmode))"
8752 "&& reload_completed"
8754 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
8755 [(set_attr "length" "20,20,16")])
8757 (define_expand "extenddftf2"
8758 [(set (match_operand:TF 0 "nonimmediate_operand" "")
8759 (float_extend:TF (match_operand:DF 1 "input_operand" "")))]
8761 && TARGET_HARD_FLOAT
8762 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8763 && TARGET_LONG_DOUBLE_128"
8765 if (TARGET_E500_DOUBLE)
8766 emit_insn (gen_spe_extenddftf2 (operands[0], operands[1]));
8768 emit_insn (gen_extenddftf2_fprs (operands[0], operands[1]));
8772 (define_expand "extenddftf2_fprs"
8773 [(parallel [(set (match_operand:TF 0 "nonimmediate_operand" "")
8774 (float_extend:TF (match_operand:DF 1 "input_operand" "")))
8775 (use (match_dup 2))])]
8777 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
8778 && TARGET_LONG_DOUBLE_128"
8780 operands[2] = CONST0_RTX (DFmode);
8781 /* Generate GOT reference early for SVR4 PIC. */
8782 if (DEFAULT_ABI == ABI_V4 && flag_pic)
8783 operands[2] = validize_mem (force_const_mem (DFmode, operands[2]));
8786 (define_insn_and_split "*extenddftf2_internal"
8787 [(set (match_operand:TF 0 "nonimmediate_operand" "=o,f,&f,r")
8788 (float_extend:TF (match_operand:DF 1 "input_operand" "fr,mf,mf,rmGHF")))
8789 (use (match_operand:DF 2 "zero_reg_mem_operand" "rf,m,f,n"))]
8791 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
8792 && TARGET_LONG_DOUBLE_128"
8794 "&& reload_completed"
8797 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
8798 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
8799 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word),
8801 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word),
8806 (define_expand "extendsftf2"
8807 [(set (match_operand:TF 0 "nonimmediate_operand" "")
8808 (float_extend:TF (match_operand:SF 1 "gpc_reg_operand" "")))]
8810 && TARGET_HARD_FLOAT
8811 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8812 && TARGET_LONG_DOUBLE_128"
8814 rtx tmp = gen_reg_rtx (DFmode);
8815 emit_insn (gen_extendsfdf2 (tmp, operands[1]));
8816 emit_insn (gen_extenddftf2 (operands[0], tmp));
8820 (define_expand "trunctfdf2"
8821 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8822 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "")))]
8824 && TARGET_HARD_FLOAT
8825 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8826 && TARGET_LONG_DOUBLE_128"
8829 (define_insn_and_split "trunctfdf2_internal1"
8830 [(set (match_operand:DF 0 "gpc_reg_operand" "=f,?f")
8831 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "0,f")))]
8832 "!TARGET_IEEEQUAD && !TARGET_XL_COMPAT
8833 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8837 "&& reload_completed && REGNO (operands[0]) == REGNO (operands[1])"
8840 emit_note (NOTE_INSN_DELETED);
8843 [(set_attr "type" "fp")])
8845 (define_insn "trunctfdf2_internal2"
8846 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
8847 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "f")))]
8848 "!TARGET_IEEEQUAD && TARGET_XL_COMPAT
8849 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
8850 && TARGET_LONG_DOUBLE_128"
8852 [(set_attr "type" "fp")
8853 (set_attr "fp_type" "fp_addsub_d")])
8855 (define_expand "trunctfsf2"
8856 [(set (match_operand:SF 0 "gpc_reg_operand" "")
8857 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "")))]
8859 && TARGET_HARD_FLOAT
8860 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8861 && TARGET_LONG_DOUBLE_128"
8863 if (TARGET_E500_DOUBLE)
8864 emit_insn (gen_spe_trunctfsf2 (operands[0], operands[1]));
8866 emit_insn (gen_trunctfsf2_fprs (operands[0], operands[1]));
8870 (define_insn_and_split "trunctfsf2_fprs"
8871 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
8872 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "f")))
8873 (clobber (match_scratch:DF 2 "=f"))]
8875 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
8876 && TARGET_LONG_DOUBLE_128"
8878 "&& reload_completed"
8880 (float_truncate:DF (match_dup 1)))
8882 (float_truncate:SF (match_dup 2)))]
8885 (define_expand "floatsitf2"
8886 [(set (match_operand:TF 0 "gpc_reg_operand" "")
8887 (float:TF (match_operand:SI 1 "gpc_reg_operand" "")))]
8889 && TARGET_HARD_FLOAT
8890 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8891 && TARGET_LONG_DOUBLE_128"
8893 rtx tmp = gen_reg_rtx (DFmode);
8894 expand_float (tmp, operands[1], false);
8895 emit_insn (gen_extenddftf2 (operands[0], tmp));
8899 ; fadd, but rounding towards zero.
8900 ; This is probably not the optimal code sequence.
8901 (define_insn "fix_trunc_helper"
8902 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
8903 (unspec:DF [(match_operand:TF 1 "gpc_reg_operand" "f")]
8904 UNSPEC_FIX_TRUNC_TF))
8905 (clobber (match_operand:DF 2 "gpc_reg_operand" "=&f"))]
8906 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
8907 "mffs %2\n\tmtfsb1 31\n\tmtfsb0 30\n\tfadd %0,%1,%L1\n\tmtfsf 1,%2"
8908 [(set_attr "type" "fp")
8909 (set_attr "length" "20")])
8911 (define_expand "fix_trunctfsi2"
8912 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8913 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))]
8915 && (TARGET_POWER2 || TARGET_POWERPC)
8916 && TARGET_HARD_FLOAT
8917 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8918 && TARGET_LONG_DOUBLE_128"
8920 if (TARGET_E500_DOUBLE)
8921 emit_insn (gen_spe_fix_trunctfsi2 (operands[0], operands[1]));
8923 emit_insn (gen_fix_trunctfsi2_fprs (operands[0], operands[1]));
8927 (define_expand "fix_trunctfsi2_fprs"
8928 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
8929 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))
8930 (clobber (match_dup 2))
8931 (clobber (match_dup 3))
8932 (clobber (match_dup 4))
8933 (clobber (match_dup 5))])]
8935 && (TARGET_POWER2 || TARGET_POWERPC)
8936 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8938 operands[2] = gen_reg_rtx (DFmode);
8939 operands[3] = gen_reg_rtx (DFmode);
8940 operands[4] = gen_reg_rtx (DImode);
8941 operands[5] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
8944 (define_insn_and_split "*fix_trunctfsi2_internal"
8945 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8946 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "f")))
8947 (clobber (match_operand:DF 2 "gpc_reg_operand" "=f"))
8948 (clobber (match_operand:DF 3 "gpc_reg_operand" "=&f"))
8949 (clobber (match_operand:DI 4 "gpc_reg_operand" "=f"))
8950 (clobber (match_operand:DI 5 "offsettable_mem_operand" "=o"))]
8952 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8954 "&& (can_create_pseudo_p () || offsettable_nonstrict_memref_p (operands[5]))"
8958 emit_insn (gen_fix_trunc_helper (operands[2], operands[1], operands[3]));
8960 gcc_assert (MEM_P (operands[5]));
8961 lowword = adjust_address (operands[5], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
8963 emit_insn (gen_fctiwz (operands[4], operands[2]));
8964 emit_move_insn (operands[5], operands[4]);
8965 emit_move_insn (operands[0], lowword);
8969 (define_expand "negtf2"
8970 [(set (match_operand:TF 0 "gpc_reg_operand" "")
8971 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "")))]
8973 && TARGET_HARD_FLOAT
8974 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8975 && TARGET_LONG_DOUBLE_128"
8978 (define_insn "negtf2_internal"
8979 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8980 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "f")))]
8982 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8985 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8986 return \"fneg %L0,%L1\;fneg %0,%1\";
8988 return \"fneg %0,%1\;fneg %L0,%L1\";
8990 [(set_attr "type" "fp")
8991 (set_attr "length" "8")])
8993 (define_expand "abstf2"
8994 [(set (match_operand:TF 0 "gpc_reg_operand" "")
8995 (abs:TF (match_operand:TF 1 "gpc_reg_operand" "")))]
8997 && TARGET_HARD_FLOAT
8998 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8999 && TARGET_LONG_DOUBLE_128"
9002 rtx label = gen_label_rtx ();
9003 if (TARGET_E500_DOUBLE)
9005 if (flag_finite_math_only && !flag_trapping_math)
9006 emit_insn (gen_spe_abstf2_tst (operands[0], operands[1], label));
9008 emit_insn (gen_spe_abstf2_cmp (operands[0], operands[1], label));
9011 emit_insn (gen_abstf2_internal (operands[0], operands[1], label));
9016 (define_expand "abstf2_internal"
9017 [(set (match_operand:TF 0 "gpc_reg_operand" "")
9018 (match_operand:TF 1 "gpc_reg_operand" ""))
9019 (set (match_dup 3) (match_dup 5))
9020 (set (match_dup 5) (abs:DF (match_dup 5)))
9021 (set (match_dup 4) (compare:CCFP (match_dup 3) (match_dup 5)))
9022 (set (pc) (if_then_else (eq (match_dup 4) (const_int 0))
9023 (label_ref (match_operand 2 "" ""))
9025 (set (match_dup 6) (neg:DF (match_dup 6)))]
9027 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9028 && TARGET_LONG_DOUBLE_128"
9031 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
9032 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
9033 operands[3] = gen_reg_rtx (DFmode);
9034 operands[4] = gen_reg_rtx (CCFPmode);
9035 operands[5] = simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word);
9036 operands[6] = simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word);
9039 ;; Next come the multi-word integer load and store and the load and store
9042 ; List r->r after r->"o<>", otherwise reload will try to reload a
9043 ; non-offsettable address by using r->r which won't make progress.
9044 (define_insn "*movdi_internal32"
9045 [(set (match_operand:DI 0 "rs6000_nonimmediate_operand" "=o<>,r,r,*f,*f,m,r")
9046 (match_operand:DI 1 "input_operand" "r,r,m,f,m,f,IJKnGHF"))]
9048 && (gpc_reg_operand (operands[0], DImode)
9049 || gpc_reg_operand (operands[1], DImode))"
9058 [(set_attr "type" "load,*,store,fp,fpload,fpstore,*")])
9061 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9062 (match_operand:DI 1 "const_int_operand" ""))]
9063 "! TARGET_POWERPC64 && reload_completed"
9064 [(set (match_dup 2) (match_dup 4))
9065 (set (match_dup 3) (match_dup 1))]
9068 HOST_WIDE_INT value = INTVAL (operands[1]);
9069 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
9071 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
9073 #if HOST_BITS_PER_WIDE_INT == 32
9074 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
9076 operands[4] = GEN_INT (value >> 32);
9077 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
9082 [(set (match_operand:DI 0 "rs6000_nonimmediate_operand" "")
9083 (match_operand:DI 1 "input_operand" ""))]
9084 "reload_completed && !TARGET_POWERPC64
9085 && gpr_or_gpr_p (operands[0], operands[1])"
9087 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
9089 (define_insn "*movdi_mfpgpr"
9090 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,*f,*f,m,r,*h,*h,r,*f")
9091 (match_operand:DI 1 "input_operand" "r,m,r,I,L,nF,R,f,m,f,*h,r,0,*f,r"))]
9092 "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
9093 && (gpc_reg_operand (operands[0], DImode)
9094 || gpc_reg_operand (operands[1], DImode))"
9111 [(set_attr "type" "*,load,store,*,*,*,*,fp,fpload,fpstore,mfjmpr,mtjmpr,*,mftgpr,mffgpr")
9112 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4,4,4")])
9114 (define_insn "*movdi_internal64"
9115 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,*f,*f,m,r,*h,*h")
9116 (match_operand:DI 1 "input_operand" "r,m,r,I,L,nF,R,f,m,f,*h,r,0"))]
9117 "TARGET_POWERPC64 && (!TARGET_MFPGPR || !TARGET_HARD_FLOAT || !TARGET_FPRS)
9118 && (gpc_reg_operand (operands[0], DImode)
9119 || gpc_reg_operand (operands[1], DImode))"
9134 [(set_attr "type" "*,load,store,*,*,*,*,fp,fpload,fpstore,mfjmpr,mtjmpr,*")
9135 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4")])
9137 ;; immediate value valid for a single instruction hiding in a const_double
9139 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9140 (match_operand:DI 1 "const_double_operand" "F"))]
9141 "HOST_BITS_PER_WIDE_INT == 32 && TARGET_POWERPC64
9142 && GET_CODE (operands[1]) == CONST_DOUBLE
9143 && num_insns_constant (operands[1], DImode) == 1"
9146 return ((unsigned HOST_WIDE_INT)
9147 (CONST_DOUBLE_LOW (operands[1]) + 0x8000) < 0x10000)
9148 ? \"li %0,%1\" : \"lis %0,%v1\";
9151 ;; Generate all one-bits and clear left or right.
9152 ;; Use (and:DI (rotate:DI ...)) to avoid anddi3 unnecessary clobber.
9154 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9155 (match_operand:DI 1 "mask64_operand" ""))]
9156 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
9157 [(set (match_dup 0) (const_int -1))
9159 (and:DI (rotate:DI (match_dup 0)
9164 ;; Split a load of a large constant into the appropriate five-instruction
9165 ;; sequence. Handle anything in a constant number of insns.
9166 ;; When non-easy constants can go in the TOC, this should use
9167 ;; easy_fp_constant predicate.
9169 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9170 (match_operand:DI 1 "const_int_operand" ""))]
9171 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
9172 [(set (match_dup 0) (match_dup 2))
9173 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
9175 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
9177 if (tem == operands[0])
9184 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9185 (match_operand:DI 1 "const_double_operand" ""))]
9186 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
9187 [(set (match_dup 0) (match_dup 2))
9188 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
9190 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
9192 if (tem == operands[0])
9198 ;; TImode is similar, except that we usually want to compute the address into
9199 ;; a register and use lsi/stsi (the exception is during reload). MQ is also
9200 ;; clobbered in stsi for POWER, so we need a SCRATCH for it.
9202 ;; We say that MQ is clobbered in the last alternative because the first
9203 ;; alternative would never get used otherwise since it would need a reload
9204 ;; while the 2nd alternative would not. We put memory cases first so they
9205 ;; are preferred. Otherwise, we'd try to reload the output instead of
9206 ;; giving the SCRATCH mq.
9208 (define_insn "*movti_power"
9209 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,m,????r,????r,????r,r")
9210 (match_operand:TI 1 "input_operand" "r,r,r,Q,m,n"))
9211 (clobber (match_scratch:SI 2 "=q,q#X,X,X,X,X"))]
9212 "TARGET_POWER && ! TARGET_POWERPC64
9213 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
9216 switch (which_alternative)
9223 return \"{stsi|stswi} %1,%P0,16\";
9228 /* If the address is not used in the output, we can use lsi. Otherwise,
9229 fall through to generating four loads. */
9231 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
9232 return \"{lsi|lswi} %0,%P1,16\";
9233 /* ... fall through ... */
9239 [(set_attr "type" "store,store,*,load,load,*")])
9241 (define_insn "*movti_string"
9242 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,o<>,????r,????r,????r,r")
9243 (match_operand:TI 1 "input_operand" "r,r,r,Q,m,n"))]
9244 "! TARGET_POWER && ! TARGET_POWERPC64
9245 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
9248 switch (which_alternative)
9254 return \"{stsi|stswi} %1,%P0,16\";
9259 /* If the address is not used in the output, we can use lsi. Otherwise,
9260 fall through to generating four loads. */
9262 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
9263 return \"{lsi|lswi} %0,%P1,16\";
9264 /* ... fall through ... */
9270 [(set_attr "type" "store_ux,store_ux,*,load_ux,load_ux,*")
9271 (set (attr "cell_micro") (if_then_else (eq (symbol_ref "TARGET_STRING") (const_int 1))
9272 (const_string "always")
9273 (const_string "conditional")))])
9275 (define_insn "*movti_ppc64"
9276 [(set (match_operand:TI 0 "nonimmediate_operand" "=r,o<>,r")
9277 (match_operand:TI 1 "input_operand" "r,r,m"))]
9278 "TARGET_POWERPC64 && (gpc_reg_operand (operands[0], TImode)
9279 || gpc_reg_operand (operands[1], TImode))"
9281 [(set_attr "type" "*,store,load")])
9284 [(set (match_operand:TI 0 "gpc_reg_operand" "")
9285 (match_operand:TI 1 "const_double_operand" ""))]
9287 [(set (match_dup 2) (match_dup 4))
9288 (set (match_dup 3) (match_dup 5))]
9291 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
9293 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
9295 if (GET_CODE (operands[1]) == CONST_DOUBLE)
9297 operands[4] = GEN_INT (CONST_DOUBLE_HIGH (operands[1]));
9298 operands[5] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
9300 else if (GET_CODE (operands[1]) == CONST_INT)
9302 operands[4] = GEN_INT (- (INTVAL (operands[1]) < 0));
9303 operands[5] = operands[1];
9310 [(set (match_operand:TI 0 "nonimmediate_operand" "")
9311 (match_operand:TI 1 "input_operand" ""))]
9313 && gpr_or_gpr_p (operands[0], operands[1])"
9315 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
9317 (define_expand "load_multiple"
9318 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
9319 (match_operand:SI 1 "" ""))
9320 (use (match_operand:SI 2 "" ""))])]
9321 "TARGET_STRING && !TARGET_POWERPC64"
9329 /* Support only loading a constant number of fixed-point registers from
9330 memory and only bother with this if more than two; the machine
9331 doesn't support more than eight. */
9332 if (GET_CODE (operands[2]) != CONST_INT
9333 || INTVAL (operands[2]) <= 2
9334 || INTVAL (operands[2]) > 8
9335 || GET_CODE (operands[1]) != MEM
9336 || GET_CODE (operands[0]) != REG
9337 || REGNO (operands[0]) >= 32)
9340 count = INTVAL (operands[2]);
9341 regno = REGNO (operands[0]);
9343 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
9344 op1 = replace_equiv_address (operands[1],
9345 force_reg (SImode, XEXP (operands[1], 0)));
9347 for (i = 0; i < count; i++)
9348 XVECEXP (operands[3], 0, i)
9349 = gen_rtx_SET (VOIDmode, gen_rtx_REG (SImode, regno + i),
9350 adjust_address_nv (op1, SImode, i * 4));
9353 (define_insn "*ldmsi8"
9354 [(match_parallel 0 "load_multiple_operation"
9355 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9356 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9357 (set (match_operand:SI 3 "gpc_reg_operand" "")
9358 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9359 (set (match_operand:SI 4 "gpc_reg_operand" "")
9360 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9361 (set (match_operand:SI 5 "gpc_reg_operand" "")
9362 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
9363 (set (match_operand:SI 6 "gpc_reg_operand" "")
9364 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
9365 (set (match_operand:SI 7 "gpc_reg_operand" "")
9366 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
9367 (set (match_operand:SI 8 "gpc_reg_operand" "")
9368 (mem:SI (plus:SI (match_dup 1) (const_int 24))))
9369 (set (match_operand:SI 9 "gpc_reg_operand" "")
9370 (mem:SI (plus:SI (match_dup 1) (const_int 28))))])]
9371 "TARGET_STRING && XVECLEN (operands[0], 0) == 8"
9373 { return rs6000_output_load_multiple (operands); }"
9374 [(set_attr "type" "load_ux")
9375 (set_attr "length" "32")])
9377 (define_insn "*ldmsi7"
9378 [(match_parallel 0 "load_multiple_operation"
9379 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9380 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9381 (set (match_operand:SI 3 "gpc_reg_operand" "")
9382 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9383 (set (match_operand:SI 4 "gpc_reg_operand" "")
9384 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9385 (set (match_operand:SI 5 "gpc_reg_operand" "")
9386 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
9387 (set (match_operand:SI 6 "gpc_reg_operand" "")
9388 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
9389 (set (match_operand:SI 7 "gpc_reg_operand" "")
9390 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
9391 (set (match_operand:SI 8 "gpc_reg_operand" "")
9392 (mem:SI (plus:SI (match_dup 1) (const_int 24))))])]
9393 "TARGET_STRING && XVECLEN (operands[0], 0) == 7"
9395 { return rs6000_output_load_multiple (operands); }"
9396 [(set_attr "type" "load_ux")
9397 (set_attr "length" "32")])
9399 (define_insn "*ldmsi6"
9400 [(match_parallel 0 "load_multiple_operation"
9401 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9402 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9403 (set (match_operand:SI 3 "gpc_reg_operand" "")
9404 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9405 (set (match_operand:SI 4 "gpc_reg_operand" "")
9406 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9407 (set (match_operand:SI 5 "gpc_reg_operand" "")
9408 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
9409 (set (match_operand:SI 6 "gpc_reg_operand" "")
9410 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
9411 (set (match_operand:SI 7 "gpc_reg_operand" "")
9412 (mem:SI (plus:SI (match_dup 1) (const_int 20))))])]
9413 "TARGET_STRING && XVECLEN (operands[0], 0) == 6"
9415 { return rs6000_output_load_multiple (operands); }"
9416 [(set_attr "type" "load_ux")
9417 (set_attr "length" "32")])
9419 (define_insn "*ldmsi5"
9420 [(match_parallel 0 "load_multiple_operation"
9421 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9422 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9423 (set (match_operand:SI 3 "gpc_reg_operand" "")
9424 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9425 (set (match_operand:SI 4 "gpc_reg_operand" "")
9426 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9427 (set (match_operand:SI 5 "gpc_reg_operand" "")
9428 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
9429 (set (match_operand:SI 6 "gpc_reg_operand" "")
9430 (mem:SI (plus:SI (match_dup 1) (const_int 16))))])]
9431 "TARGET_STRING && XVECLEN (operands[0], 0) == 5"
9433 { return rs6000_output_load_multiple (operands); }"
9434 [(set_attr "type" "load_ux")
9435 (set_attr "length" "32")])
9437 (define_insn "*ldmsi4"
9438 [(match_parallel 0 "load_multiple_operation"
9439 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9440 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9441 (set (match_operand:SI 3 "gpc_reg_operand" "")
9442 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9443 (set (match_operand:SI 4 "gpc_reg_operand" "")
9444 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9445 (set (match_operand:SI 5 "gpc_reg_operand" "")
9446 (mem:SI (plus:SI (match_dup 1) (const_int 12))))])]
9447 "TARGET_STRING && XVECLEN (operands[0], 0) == 4"
9449 { return rs6000_output_load_multiple (operands); }"
9450 [(set_attr "type" "load_ux")
9451 (set_attr "length" "32")])
9453 (define_insn "*ldmsi3"
9454 [(match_parallel 0 "load_multiple_operation"
9455 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9456 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9457 (set (match_operand:SI 3 "gpc_reg_operand" "")
9458 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9459 (set (match_operand:SI 4 "gpc_reg_operand" "")
9460 (mem:SI (plus:SI (match_dup 1) (const_int 8))))])]
9461 "TARGET_STRING && XVECLEN (operands[0], 0) == 3"
9463 { return rs6000_output_load_multiple (operands); }"
9464 [(set_attr "type" "load_ux")
9465 (set_attr "length" "32")])
9467 (define_expand "store_multiple"
9468 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
9469 (match_operand:SI 1 "" ""))
9470 (clobber (scratch:SI))
9471 (use (match_operand:SI 2 "" ""))])]
9472 "TARGET_STRING && !TARGET_POWERPC64"
9481 /* Support only storing a constant number of fixed-point registers to
9482 memory and only bother with this if more than two; the machine
9483 doesn't support more than eight. */
9484 if (GET_CODE (operands[2]) != CONST_INT
9485 || INTVAL (operands[2]) <= 2
9486 || INTVAL (operands[2]) > 8
9487 || GET_CODE (operands[0]) != MEM
9488 || GET_CODE (operands[1]) != REG
9489 || REGNO (operands[1]) >= 32)
9492 count = INTVAL (operands[2]);
9493 regno = REGNO (operands[1]);
9495 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count + 1));
9496 to = force_reg (SImode, XEXP (operands[0], 0));
9497 op0 = replace_equiv_address (operands[0], to);
9499 XVECEXP (operands[3], 0, 0)
9500 = gen_rtx_SET (VOIDmode, adjust_address_nv (op0, SImode, 0), operands[1]);
9501 XVECEXP (operands[3], 0, 1) = gen_rtx_CLOBBER (VOIDmode,
9502 gen_rtx_SCRATCH (SImode));
9504 for (i = 1; i < count; i++)
9505 XVECEXP (operands[3], 0, i + 1)
9506 = gen_rtx_SET (VOIDmode,
9507 adjust_address_nv (op0, SImode, i * 4),
9508 gen_rtx_REG (SImode, regno + i));
9511 (define_insn "*stmsi8"
9512 [(match_parallel 0 "store_multiple_operation"
9513 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9514 (match_operand:SI 2 "gpc_reg_operand" "r"))
9515 (clobber (match_scratch:SI 3 "=X"))
9516 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9517 (match_operand:SI 4 "gpc_reg_operand" "r"))
9518 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9519 (match_operand:SI 5 "gpc_reg_operand" "r"))
9520 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9521 (match_operand:SI 6 "gpc_reg_operand" "r"))
9522 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9523 (match_operand:SI 7 "gpc_reg_operand" "r"))
9524 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9525 (match_operand:SI 8 "gpc_reg_operand" "r"))
9526 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
9527 (match_operand:SI 9 "gpc_reg_operand" "r"))
9528 (set (mem:SI (plus:SI (match_dup 1) (const_int 28)))
9529 (match_operand:SI 10 "gpc_reg_operand" "r"))])]
9530 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 9"
9531 "{stsi|stswi} %2,%1,%O0"
9532 [(set_attr "type" "store_ux")
9533 (set_attr "cell_micro" "always")])
9535 (define_insn "*stmsi7"
9536 [(match_parallel 0 "store_multiple_operation"
9537 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9538 (match_operand:SI 2 "gpc_reg_operand" "r"))
9539 (clobber (match_scratch:SI 3 "=X"))
9540 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9541 (match_operand:SI 4 "gpc_reg_operand" "r"))
9542 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9543 (match_operand:SI 5 "gpc_reg_operand" "r"))
9544 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9545 (match_operand:SI 6 "gpc_reg_operand" "r"))
9546 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9547 (match_operand:SI 7 "gpc_reg_operand" "r"))
9548 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9549 (match_operand:SI 8 "gpc_reg_operand" "r"))
9550 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
9551 (match_operand:SI 9 "gpc_reg_operand" "r"))])]
9552 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 8"
9553 "{stsi|stswi} %2,%1,%O0"
9554 [(set_attr "type" "store_ux")
9555 (set_attr "cell_micro" "always")])
9557 (define_insn "*stmsi6"
9558 [(match_parallel 0 "store_multiple_operation"
9559 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9560 (match_operand:SI 2 "gpc_reg_operand" "r"))
9561 (clobber (match_scratch:SI 3 "=X"))
9562 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9563 (match_operand:SI 4 "gpc_reg_operand" "r"))
9564 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9565 (match_operand:SI 5 "gpc_reg_operand" "r"))
9566 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9567 (match_operand:SI 6 "gpc_reg_operand" "r"))
9568 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9569 (match_operand:SI 7 "gpc_reg_operand" "r"))
9570 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9571 (match_operand:SI 8 "gpc_reg_operand" "r"))])]
9572 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 7"
9573 "{stsi|stswi} %2,%1,%O0"
9574 [(set_attr "type" "store_ux")
9575 (set_attr "cell_micro" "always")])
9577 (define_insn "*stmsi5"
9578 [(match_parallel 0 "store_multiple_operation"
9579 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9580 (match_operand:SI 2 "gpc_reg_operand" "r"))
9581 (clobber (match_scratch:SI 3 "=X"))
9582 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9583 (match_operand:SI 4 "gpc_reg_operand" "r"))
9584 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9585 (match_operand:SI 5 "gpc_reg_operand" "r"))
9586 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9587 (match_operand:SI 6 "gpc_reg_operand" "r"))
9588 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9589 (match_operand:SI 7 "gpc_reg_operand" "r"))])]
9590 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 6"
9591 "{stsi|stswi} %2,%1,%O0"
9592 [(set_attr "type" "store_ux")
9593 (set_attr "cell_micro" "always")])
9595 (define_insn "*stmsi4"
9596 [(match_parallel 0 "store_multiple_operation"
9597 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9598 (match_operand:SI 2 "gpc_reg_operand" "r"))
9599 (clobber (match_scratch:SI 3 "=X"))
9600 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9601 (match_operand:SI 4 "gpc_reg_operand" "r"))
9602 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9603 (match_operand:SI 5 "gpc_reg_operand" "r"))
9604 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9605 (match_operand:SI 6 "gpc_reg_operand" "r"))])]
9606 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 5"
9607 "{stsi|stswi} %2,%1,%O0"
9608 [(set_attr "type" "store_ux")
9609 (set_attr "cell_micro" "always")])
9611 (define_insn "*stmsi3"
9612 [(match_parallel 0 "store_multiple_operation"
9613 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9614 (match_operand:SI 2 "gpc_reg_operand" "r"))
9615 (clobber (match_scratch:SI 3 "=X"))
9616 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9617 (match_operand:SI 4 "gpc_reg_operand" "r"))
9618 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9619 (match_operand:SI 5 "gpc_reg_operand" "r"))])]
9620 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 4"
9621 "{stsi|stswi} %2,%1,%O0"
9622 [(set_attr "type" "store_ux")
9623 (set_attr "cell_micro" "always")])
9625 (define_insn "*stmsi8_power"
9626 [(match_parallel 0 "store_multiple_operation"
9627 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9628 (match_operand:SI 2 "gpc_reg_operand" "r"))
9629 (clobber (match_scratch:SI 3 "=q"))
9630 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9631 (match_operand:SI 4 "gpc_reg_operand" "r"))
9632 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9633 (match_operand:SI 5 "gpc_reg_operand" "r"))
9634 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9635 (match_operand:SI 6 "gpc_reg_operand" "r"))
9636 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9637 (match_operand:SI 7 "gpc_reg_operand" "r"))
9638 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9639 (match_operand:SI 8 "gpc_reg_operand" "r"))
9640 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
9641 (match_operand:SI 9 "gpc_reg_operand" "r"))
9642 (set (mem:SI (plus:SI (match_dup 1) (const_int 28)))
9643 (match_operand:SI 10 "gpc_reg_operand" "r"))])]
9644 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 9"
9645 "{stsi|stswi} %2,%1,%O0"
9646 [(set_attr "type" "store_ux")
9647 (set_attr "cell_micro" "always")])
9649 (define_insn "*stmsi7_power"
9650 [(match_parallel 0 "store_multiple_operation"
9651 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9652 (match_operand:SI 2 "gpc_reg_operand" "r"))
9653 (clobber (match_scratch:SI 3 "=q"))
9654 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9655 (match_operand:SI 4 "gpc_reg_operand" "r"))
9656 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9657 (match_operand:SI 5 "gpc_reg_operand" "r"))
9658 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9659 (match_operand:SI 6 "gpc_reg_operand" "r"))
9660 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9661 (match_operand:SI 7 "gpc_reg_operand" "r"))
9662 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9663 (match_operand:SI 8 "gpc_reg_operand" "r"))
9664 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
9665 (match_operand:SI 9 "gpc_reg_operand" "r"))])]
9666 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 8"
9667 "{stsi|stswi} %2,%1,%O0"
9668 [(set_attr "type" "store_ux")
9669 (set_attr "cell_micro" "always")])
9671 (define_insn "*stmsi6_power"
9672 [(match_parallel 0 "store_multiple_operation"
9673 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9674 (match_operand:SI 2 "gpc_reg_operand" "r"))
9675 (clobber (match_scratch:SI 3 "=q"))
9676 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9677 (match_operand:SI 4 "gpc_reg_operand" "r"))
9678 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9679 (match_operand:SI 5 "gpc_reg_operand" "r"))
9680 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9681 (match_operand:SI 6 "gpc_reg_operand" "r"))
9682 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9683 (match_operand:SI 7 "gpc_reg_operand" "r"))
9684 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9685 (match_operand:SI 8 "gpc_reg_operand" "r"))])]
9686 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 7"
9687 "{stsi|stswi} %2,%1,%O0"
9688 [(set_attr "type" "store_ux")
9689 (set_attr "cell_micro" "always")])
9691 (define_insn "*stmsi5_power"
9692 [(match_parallel 0 "store_multiple_operation"
9693 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9694 (match_operand:SI 2 "gpc_reg_operand" "r"))
9695 (clobber (match_scratch:SI 3 "=q"))
9696 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9697 (match_operand:SI 4 "gpc_reg_operand" "r"))
9698 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9699 (match_operand:SI 5 "gpc_reg_operand" "r"))
9700 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9701 (match_operand:SI 6 "gpc_reg_operand" "r"))
9702 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9703 (match_operand:SI 7 "gpc_reg_operand" "r"))])]
9704 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 6"
9705 "{stsi|stswi} %2,%1,%O0"
9706 [(set_attr "type" "store_ux")
9707 (set_attr "cell_micro" "always")])
9709 (define_insn "*stmsi4_power"
9710 [(match_parallel 0 "store_multiple_operation"
9711 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9712 (match_operand:SI 2 "gpc_reg_operand" "r"))
9713 (clobber (match_scratch:SI 3 "=q"))
9714 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9715 (match_operand:SI 4 "gpc_reg_operand" "r"))
9716 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9717 (match_operand:SI 5 "gpc_reg_operand" "r"))
9718 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9719 (match_operand:SI 6 "gpc_reg_operand" "r"))])]
9720 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 5"
9721 "{stsi|stswi} %2,%1,%O0"
9722 [(set_attr "type" "store_ux")
9723 (set_attr "cell_micro" "always")])
9725 (define_insn "*stmsi3_power"
9726 [(match_parallel 0 "store_multiple_operation"
9727 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9728 (match_operand:SI 2 "gpc_reg_operand" "r"))
9729 (clobber (match_scratch:SI 3 "=q"))
9730 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9731 (match_operand:SI 4 "gpc_reg_operand" "r"))
9732 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9733 (match_operand:SI 5 "gpc_reg_operand" "r"))])]
9734 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 4"
9735 "{stsi|stswi} %2,%1,%O0"
9736 [(set_attr "type" "store_ux")
9737 (set_attr "cell_micro" "always")])
9739 (define_expand "setmemsi"
9740 [(parallel [(set (match_operand:BLK 0 "" "")
9741 (match_operand 2 "const_int_operand" ""))
9742 (use (match_operand:SI 1 "" ""))
9743 (use (match_operand:SI 3 "" ""))])]
9747 /* If value to set is not zero, use the library routine. */
9748 if (operands[2] != const0_rtx)
9751 if (expand_block_clear (operands))
9757 ;; String/block move insn.
9758 ;; Argument 0 is the destination
9759 ;; Argument 1 is the source
9760 ;; Argument 2 is the length
9761 ;; Argument 3 is the alignment
9763 (define_expand "movmemsi"
9764 [(parallel [(set (match_operand:BLK 0 "" "")
9765 (match_operand:BLK 1 "" ""))
9766 (use (match_operand:SI 2 "" ""))
9767 (use (match_operand:SI 3 "" ""))])]
9771 if (expand_block_move (operands))
9777 ;; Move up to 32 bytes at a time. The fixed registers are needed because the
9778 ;; register allocator doesn't have a clue about allocating 8 word registers.
9779 ;; rD/rS = r5 is preferred, efficient form.
9780 (define_expand "movmemsi_8reg"
9781 [(parallel [(set (match_operand 0 "" "")
9782 (match_operand 1 "" ""))
9783 (use (match_operand 2 "" ""))
9784 (use (match_operand 3 "" ""))
9785 (clobber (reg:SI 5))
9786 (clobber (reg:SI 6))
9787 (clobber (reg:SI 7))
9788 (clobber (reg:SI 8))
9789 (clobber (reg:SI 9))
9790 (clobber (reg:SI 10))
9791 (clobber (reg:SI 11))
9792 (clobber (reg:SI 12))
9793 (clobber (match_scratch:SI 4 ""))])]
9798 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9799 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9800 (use (match_operand:SI 2 "immediate_operand" "i"))
9801 (use (match_operand:SI 3 "immediate_operand" "i"))
9802 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
9803 (clobber (reg:SI 6))
9804 (clobber (reg:SI 7))
9805 (clobber (reg:SI 8))
9806 (clobber (reg:SI 9))
9807 (clobber (reg:SI 10))
9808 (clobber (reg:SI 11))
9809 (clobber (reg:SI 12))
9810 (clobber (match_scratch:SI 5 "=q"))]
9811 "TARGET_STRING && TARGET_POWER
9812 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
9813 || INTVAL (operands[2]) == 0)
9814 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
9815 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
9816 && REGNO (operands[4]) == 5"
9817 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9818 [(set_attr "type" "store_ux")
9819 (set_attr "cell_micro" "always")
9820 (set_attr "length" "8")])
9823 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
9824 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
9825 (use (match_operand:SI 2 "immediate_operand" "i"))
9826 (use (match_operand:SI 3 "immediate_operand" "i"))
9827 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
9828 (clobber (reg:SI 6))
9829 (clobber (reg:SI 7))
9830 (clobber (reg:SI 8))
9831 (clobber (reg:SI 9))
9832 (clobber (reg:SI 10))
9833 (clobber (reg:SI 11))
9834 (clobber (reg:SI 12))
9835 (clobber (match_scratch:SI 5 "=X"))]
9836 "TARGET_STRING && ! TARGET_POWER
9837 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
9838 || INTVAL (operands[2]) == 0)
9839 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
9840 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
9841 && REGNO (operands[4]) == 5"
9842 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9843 [(set_attr "type" "store_ux")
9844 (set_attr "cell_micro" "always")
9845 (set_attr "length" "8")])
9847 ;; Move up to 24 bytes at a time. The fixed registers are needed because the
9848 ;; register allocator doesn't have a clue about allocating 6 word registers.
9849 ;; rD/rS = r5 is preferred, efficient form.
9850 (define_expand "movmemsi_6reg"
9851 [(parallel [(set (match_operand 0 "" "")
9852 (match_operand 1 "" ""))
9853 (use (match_operand 2 "" ""))
9854 (use (match_operand 3 "" ""))
9855 (clobber (reg:SI 5))
9856 (clobber (reg:SI 6))
9857 (clobber (reg:SI 7))
9858 (clobber (reg:SI 8))
9859 (clobber (reg:SI 9))
9860 (clobber (reg:SI 10))
9861 (clobber (match_scratch:SI 4 ""))])]
9866 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9867 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9868 (use (match_operand:SI 2 "immediate_operand" "i"))
9869 (use (match_operand:SI 3 "immediate_operand" "i"))
9870 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
9871 (clobber (reg:SI 6))
9872 (clobber (reg:SI 7))
9873 (clobber (reg:SI 8))
9874 (clobber (reg:SI 9))
9875 (clobber (reg:SI 10))
9876 (clobber (match_scratch:SI 5 "=q"))]
9877 "TARGET_STRING && TARGET_POWER
9878 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 24
9879 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
9880 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
9881 && REGNO (operands[4]) == 5"
9882 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9883 [(set_attr "type" "store_ux")
9884 (set_attr "cell_micro" "always")
9885 (set_attr "length" "8")])
9888 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
9889 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
9890 (use (match_operand:SI 2 "immediate_operand" "i"))
9891 (use (match_operand:SI 3 "immediate_operand" "i"))
9892 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
9893 (clobber (reg:SI 6))
9894 (clobber (reg:SI 7))
9895 (clobber (reg:SI 8))
9896 (clobber (reg:SI 9))
9897 (clobber (reg:SI 10))
9898 (clobber (match_scratch:SI 5 "=X"))]
9899 "TARGET_STRING && ! TARGET_POWER
9900 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
9901 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
9902 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
9903 && REGNO (operands[4]) == 5"
9904 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9905 [(set_attr "type" "store_ux")
9906 (set_attr "cell_micro" "always")
9907 (set_attr "length" "8")])
9909 ;; Move up to 16 bytes at a time, using 4 fixed registers to avoid spill
9910 ;; problems with TImode.
9911 ;; rD/rS = r5 is preferred, efficient form.
9912 (define_expand "movmemsi_4reg"
9913 [(parallel [(set (match_operand 0 "" "")
9914 (match_operand 1 "" ""))
9915 (use (match_operand 2 "" ""))
9916 (use (match_operand 3 "" ""))
9917 (clobber (reg:SI 5))
9918 (clobber (reg:SI 6))
9919 (clobber (reg:SI 7))
9920 (clobber (reg:SI 8))
9921 (clobber (match_scratch:SI 4 ""))])]
9926 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9927 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9928 (use (match_operand:SI 2 "immediate_operand" "i"))
9929 (use (match_operand:SI 3 "immediate_operand" "i"))
9930 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
9931 (clobber (reg:SI 6))
9932 (clobber (reg:SI 7))
9933 (clobber (reg:SI 8))
9934 (clobber (match_scratch:SI 5 "=q"))]
9935 "TARGET_STRING && TARGET_POWER
9936 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
9937 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
9938 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
9939 && REGNO (operands[4]) == 5"
9940 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9941 [(set_attr "type" "store_ux")
9942 (set_attr "cell_micro" "always")
9943 (set_attr "length" "8")])
9946 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
9947 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
9948 (use (match_operand:SI 2 "immediate_operand" "i"))
9949 (use (match_operand:SI 3 "immediate_operand" "i"))
9950 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
9951 (clobber (reg:SI 6))
9952 (clobber (reg:SI 7))
9953 (clobber (reg:SI 8))
9954 (clobber (match_scratch:SI 5 "=X"))]
9955 "TARGET_STRING && ! TARGET_POWER
9956 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
9957 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
9958 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
9959 && REGNO (operands[4]) == 5"
9960 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9961 [(set_attr "type" "store_ux")
9962 (set_attr "cell_micro" "always")
9963 (set_attr "length" "8")])
9965 ;; Move up to 8 bytes at a time.
9966 (define_expand "movmemsi_2reg"
9967 [(parallel [(set (match_operand 0 "" "")
9968 (match_operand 1 "" ""))
9969 (use (match_operand 2 "" ""))
9970 (use (match_operand 3 "" ""))
9971 (clobber (match_scratch:DI 4 ""))
9972 (clobber (match_scratch:SI 5 ""))])]
9973 "TARGET_STRING && ! TARGET_POWERPC64"
9977 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9978 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9979 (use (match_operand:SI 2 "immediate_operand" "i"))
9980 (use (match_operand:SI 3 "immediate_operand" "i"))
9981 (clobber (match_scratch:DI 4 "=&r"))
9982 (clobber (match_scratch:SI 5 "=q"))]
9983 "TARGET_STRING && TARGET_POWER && ! TARGET_POWERPC64
9984 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
9985 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9986 [(set_attr "type" "store_ux")
9987 (set_attr "cell_micro" "always")
9988 (set_attr "length" "8")])
9991 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9992 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9993 (use (match_operand:SI 2 "immediate_operand" "i"))
9994 (use (match_operand:SI 3 "immediate_operand" "i"))
9995 (clobber (match_scratch:DI 4 "=&r"))
9996 (clobber (match_scratch:SI 5 "=X"))]
9997 "TARGET_STRING && ! TARGET_POWER && ! TARGET_POWERPC64
9998 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
9999 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10000 [(set_attr "type" "store_ux")
10001 (set_attr "cell_micro" "always")
10002 (set_attr "length" "8")])
10004 ;; Move up to 4 bytes at a time.
10005 (define_expand "movmemsi_1reg"
10006 [(parallel [(set (match_operand 0 "" "")
10007 (match_operand 1 "" ""))
10008 (use (match_operand 2 "" ""))
10009 (use (match_operand 3 "" ""))
10010 (clobber (match_scratch:SI 4 ""))
10011 (clobber (match_scratch:SI 5 ""))])]
10016 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
10017 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
10018 (use (match_operand:SI 2 "immediate_operand" "i"))
10019 (use (match_operand:SI 3 "immediate_operand" "i"))
10020 (clobber (match_scratch:SI 4 "=&r"))
10021 (clobber (match_scratch:SI 5 "=q"))]
10022 "TARGET_STRING && TARGET_POWER
10023 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
10024 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10025 [(set_attr "type" "store_ux")
10026 (set_attr "cell_micro" "always")
10027 (set_attr "length" "8")])
10030 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
10031 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
10032 (use (match_operand:SI 2 "immediate_operand" "i"))
10033 (use (match_operand:SI 3 "immediate_operand" "i"))
10034 (clobber (match_scratch:SI 4 "=&r"))
10035 (clobber (match_scratch:SI 5 "=X"))]
10036 "TARGET_STRING && ! TARGET_POWER
10037 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
10038 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10039 [(set_attr "type" "store_ux")
10040 (set_attr "cell_micro" "always")
10041 (set_attr "length" "8")])
10043 ;; Define insns that do load or store with update. Some of these we can
10044 ;; get by using pre-decrement or pre-increment, but the hardware can also
10045 ;; do cases where the increment is not the size of the object.
10047 ;; In all these cases, we use operands 0 and 1 for the register being
10048 ;; incremented because those are the operands that local-alloc will
10049 ;; tie and these are the pair most likely to be tieable (and the ones
10050 ;; that will benefit the most).
10052 (define_insn "*movdi_update1"
10053 [(set (match_operand:DI 3 "gpc_reg_operand" "=r,r")
10054 (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
10055 (match_operand:DI 2 "reg_or_aligned_short_operand" "r,I"))))
10056 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
10057 (plus:DI (match_dup 1) (match_dup 2)))]
10058 "TARGET_POWERPC64 && TARGET_UPDATE
10059 && (!avoiding_indexed_address_p (DImode)
10060 || !gpc_reg_operand (operands[2], DImode))"
10064 [(set_attr "type" "load_ux,load_u")])
10066 (define_insn "movdi_<mode>_update"
10067 [(set (mem:DI (plus:P (match_operand:P 1 "gpc_reg_operand" "0,0")
10068 (match_operand:P 2 "reg_or_aligned_short_operand" "r,I")))
10069 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
10070 (set (match_operand:P 0 "gpc_reg_operand" "=b,b")
10071 (plus:P (match_dup 1) (match_dup 2)))]
10072 "TARGET_POWERPC64 && TARGET_UPDATE
10073 && (!avoiding_indexed_address_p (Pmode)
10074 || !gpc_reg_operand (operands[2], Pmode)
10075 || (REG_P (operands[0])
10076 && REGNO (operands[0]) == STACK_POINTER_REGNUM))"
10080 [(set_attr "type" "store_ux,store_u")])
10082 ;; This pattern is only conditional on TARGET_POWERPC64, as it is
10083 ;; needed for stack allocation, even if the user passes -mno-update.
10084 (define_insn "movdi_<mode>_update_stack"
10085 [(set (mem:DI (plus:P (match_operand:P 1 "gpc_reg_operand" "0,0")
10086 (match_operand:P 2 "reg_or_aligned_short_operand" "r,I")))
10087 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
10088 (set (match_operand:P 0 "gpc_reg_operand" "=b,b")
10089 (plus:P (match_dup 1) (match_dup 2)))]
10094 [(set_attr "type" "store_ux,store_u")])
10096 (define_insn "*movsi_update1"
10097 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
10098 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10099 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10100 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10101 (plus:SI (match_dup 1) (match_dup 2)))]
10103 && (!avoiding_indexed_address_p (SImode)
10104 || !gpc_reg_operand (operands[2], SImode))"
10106 {lux|lwzux} %3,%0,%2
10107 {lu|lwzu} %3,%2(%0)"
10108 [(set_attr "type" "load_ux,load_u")])
10110 (define_insn "*movsi_update2"
10111 [(set (match_operand:DI 3 "gpc_reg_operand" "=r")
10113 (mem:SI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0")
10114 (match_operand:DI 2 "gpc_reg_operand" "r")))))
10115 (set (match_operand:DI 0 "gpc_reg_operand" "=b")
10116 (plus:DI (match_dup 1) (match_dup 2)))]
10117 "TARGET_POWERPC64 && rs6000_gen_cell_microcode
10118 && !avoiding_indexed_address_p (DImode)"
10120 [(set_attr "type" "load_ext_ux")])
10122 (define_insn "movsi_update"
10123 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10124 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10125 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
10126 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10127 (plus:SI (match_dup 1) (match_dup 2)))]
10129 && (!avoiding_indexed_address_p (SImode)
10130 || !gpc_reg_operand (operands[2], SImode)
10131 || (REG_P (operands[0])
10132 && REGNO (operands[0]) == STACK_POINTER_REGNUM))"
10134 {stux|stwux} %3,%0,%2
10135 {stu|stwu} %3,%2(%0)"
10136 [(set_attr "type" "store_ux,store_u")])
10138 ;; This is an unconditional pattern; needed for stack allocation, even
10139 ;; if the user passes -mno-update.
10140 (define_insn "movsi_update_stack"
10141 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10142 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10143 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
10144 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10145 (plus:SI (match_dup 1) (match_dup 2)))]
10148 {stux|stwux} %3,%0,%2
10149 {stu|stwu} %3,%2(%0)"
10150 [(set_attr "type" "store_ux,store_u")])
10152 (define_insn "*movhi_update1"
10153 [(set (match_operand:HI 3 "gpc_reg_operand" "=r,r")
10154 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10155 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10156 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10157 (plus:SI (match_dup 1) (match_dup 2)))]
10159 && (!avoiding_indexed_address_p (SImode)
10160 || !gpc_reg_operand (operands[2], SImode))"
10164 [(set_attr "type" "load_ux,load_u")])
10166 (define_insn "*movhi_update2"
10167 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
10169 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10170 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
10171 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10172 (plus:SI (match_dup 1) (match_dup 2)))]
10174 && (!avoiding_indexed_address_p (SImode)
10175 || !gpc_reg_operand (operands[2], SImode))"
10179 [(set_attr "type" "load_ux,load_u")])
10181 (define_insn "*movhi_update3"
10182 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
10184 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10185 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
10186 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10187 (plus:SI (match_dup 1) (match_dup 2)))]
10188 "TARGET_UPDATE && rs6000_gen_cell_microcode
10189 && (!avoiding_indexed_address_p (SImode)
10190 || !gpc_reg_operand (operands[2], SImode))"
10194 [(set_attr "type" "load_ext_ux,load_ext_u")])
10196 (define_insn "*movhi_update4"
10197 [(set (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10198 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10199 (match_operand:HI 3 "gpc_reg_operand" "r,r"))
10200 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10201 (plus:SI (match_dup 1) (match_dup 2)))]
10203 && (!avoiding_indexed_address_p (SImode)
10204 || !gpc_reg_operand (operands[2], SImode))"
10208 [(set_attr "type" "store_ux,store_u")])
10210 (define_insn "*movqi_update1"
10211 [(set (match_operand:QI 3 "gpc_reg_operand" "=r,r")
10212 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10213 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10214 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10215 (plus:SI (match_dup 1) (match_dup 2)))]
10217 && (!avoiding_indexed_address_p (SImode)
10218 || !gpc_reg_operand (operands[2], SImode))"
10222 [(set_attr "type" "load_ux,load_u")])
10224 (define_insn "*movqi_update2"
10225 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
10227 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10228 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
10229 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10230 (plus:SI (match_dup 1) (match_dup 2)))]
10232 && (!avoiding_indexed_address_p (SImode)
10233 || !gpc_reg_operand (operands[2], SImode))"
10237 [(set_attr "type" "load_ux,load_u")])
10239 (define_insn "*movqi_update3"
10240 [(set (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10241 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10242 (match_operand:QI 3 "gpc_reg_operand" "r,r"))
10243 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10244 (plus:SI (match_dup 1) (match_dup 2)))]
10246 && (!avoiding_indexed_address_p (SImode)
10247 || !gpc_reg_operand (operands[2], SImode))"
10251 [(set_attr "type" "store_ux,store_u")])
10253 (define_insn "*movsf_update1"
10254 [(set (match_operand:SF 3 "gpc_reg_operand" "=f,f")
10255 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10256 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10257 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10258 (plus:SI (match_dup 1) (match_dup 2)))]
10259 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT && TARGET_UPDATE
10260 && (!avoiding_indexed_address_p (SImode)
10261 || !gpc_reg_operand (operands[2], SImode))"
10265 [(set_attr "type" "fpload_ux,fpload_u")])
10267 (define_insn "*movsf_update2"
10268 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10269 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10270 (match_operand:SF 3 "gpc_reg_operand" "f,f"))
10271 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10272 (plus:SI (match_dup 1) (match_dup 2)))]
10273 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT && TARGET_UPDATE
10274 && (!avoiding_indexed_address_p (SImode)
10275 || !gpc_reg_operand (operands[2], SImode))"
10279 [(set_attr "type" "fpstore_ux,fpstore_u")])
10281 (define_insn "*movsf_update3"
10282 [(set (match_operand:SF 3 "gpc_reg_operand" "=r,r")
10283 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10284 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10285 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10286 (plus:SI (match_dup 1) (match_dup 2)))]
10287 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE
10288 && (!avoiding_indexed_address_p (SImode)
10289 || !gpc_reg_operand (operands[2], SImode))"
10291 {lux|lwzux} %3,%0,%2
10292 {lu|lwzu} %3,%2(%0)"
10293 [(set_attr "type" "load_ux,load_u")])
10295 (define_insn "*movsf_update4"
10296 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10297 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10298 (match_operand:SF 3 "gpc_reg_operand" "r,r"))
10299 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10300 (plus:SI (match_dup 1) (match_dup 2)))]
10301 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE
10302 && (!avoiding_indexed_address_p (SImode)
10303 || !gpc_reg_operand (operands[2], SImode))"
10305 {stux|stwux} %3,%0,%2
10306 {stu|stwu} %3,%2(%0)"
10307 [(set_attr "type" "store_ux,store_u")])
10309 (define_insn "*movdf_update1"
10310 [(set (match_operand:DF 3 "gpc_reg_operand" "=f,f")
10311 (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10312 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10313 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10314 (plus:SI (match_dup 1) (match_dup 2)))]
10315 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_UPDATE
10316 && (!avoiding_indexed_address_p (SImode)
10317 || !gpc_reg_operand (operands[2], SImode))"
10321 [(set_attr "type" "fpload_ux,fpload_u")])
10323 (define_insn "*movdf_update2"
10324 [(set (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10325 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10326 (match_operand:DF 3 "gpc_reg_operand" "f,f"))
10327 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10328 (plus:SI (match_dup 1) (match_dup 2)))]
10329 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_UPDATE
10330 && (!avoiding_indexed_address_p (SImode)
10331 || !gpc_reg_operand (operands[2], SImode))"
10335 [(set_attr "type" "fpstore_ux,fpstore_u")])
10337 ;; Peephole to convert two consecutive FP loads or stores into lfq/stfq.
10339 (define_insn "*lfq_power2"
10340 [(set (match_operand:V2DF 0 "gpc_reg_operand" "=f")
10341 (match_operand:V2DF 1 "memory_operand" ""))]
10343 && TARGET_HARD_FLOAT && TARGET_FPRS"
10347 [(set (match_operand:DF 0 "gpc_reg_operand" "")
10348 (match_operand:DF 1 "memory_operand" ""))
10349 (set (match_operand:DF 2 "gpc_reg_operand" "")
10350 (match_operand:DF 3 "memory_operand" ""))]
10352 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
10353 && registers_ok_for_quad_peep (operands[0], operands[2])
10354 && mems_ok_for_quad_peep (operands[1], operands[3])"
10355 [(set (match_dup 0)
10357 "operands[1] = widen_memory_access (operands[1], V2DFmode, 0);
10358 operands[0] = gen_rtx_REG (V2DFmode, REGNO (operands[0]));")
10360 (define_insn "*stfq_power2"
10361 [(set (match_operand:V2DF 0 "memory_operand" "")
10362 (match_operand:V2DF 1 "gpc_reg_operand" "f"))]
10364 && TARGET_HARD_FLOAT && TARGET_FPRS"
10365 "stfq%U0%X0 %1,%0")
10369 [(set (match_operand:DF 0 "memory_operand" "")
10370 (match_operand:DF 1 "gpc_reg_operand" ""))
10371 (set (match_operand:DF 2 "memory_operand" "")
10372 (match_operand:DF 3 "gpc_reg_operand" ""))]
10374 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
10375 && registers_ok_for_quad_peep (operands[1], operands[3])
10376 && mems_ok_for_quad_peep (operands[0], operands[2])"
10377 [(set (match_dup 0)
10379 "operands[0] = widen_memory_access (operands[0], V2DFmode, 0);
10380 operands[1] = gen_rtx_REG (V2DFmode, REGNO (operands[1]));")
10382 ;; After inserting conditional returns we can sometimes have
10383 ;; unnecessary register moves. Unfortunately we cannot have a
10384 ;; modeless peephole here, because some single SImode sets have early
10385 ;; clobber outputs. Although those sets expand to multi-ppc-insn
10386 ;; sequences, using get_attr_length here will smash the operands
10387 ;; array. Neither is there an early_cobbler_p predicate.
10388 ;; Disallow subregs for E500 so we don't munge frob_di_df_2.
10390 [(set (match_operand:DF 0 "gpc_reg_operand" "")
10391 (match_operand:DF 1 "any_operand" ""))
10392 (set (match_operand:DF 2 "gpc_reg_operand" "")
10394 "!(TARGET_E500_DOUBLE && GET_CODE (operands[2]) == SUBREG)
10395 && peep2_reg_dead_p (2, operands[0])"
10396 [(set (match_dup 2) (match_dup 1))])
10399 [(set (match_operand:SF 0 "gpc_reg_operand" "")
10400 (match_operand:SF 1 "any_operand" ""))
10401 (set (match_operand:SF 2 "gpc_reg_operand" "")
10403 "peep2_reg_dead_p (2, operands[0])"
10404 [(set (match_dup 2) (match_dup 1))])
10409 ;; Mode attributes for different ABIs.
10410 (define_mode_iterator TLSmode [(SI "! TARGET_64BIT") (DI "TARGET_64BIT")])
10411 (define_mode_attr tls_abi_suffix [(SI "32") (DI "64")])
10412 (define_mode_attr tls_sysv_suffix [(SI "si") (DI "di")])
10413 (define_mode_attr tls_insn_suffix [(SI "wz") (DI "d")])
10415 (define_insn "tls_gd_aix<TLSmode:tls_abi_suffix>"
10416 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10417 (call (mem:TLSmode (match_operand:TLSmode 3 "symbol_ref_operand" "s"))
10418 (match_operand 4 "" "g")))
10419 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10420 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10422 (clobber (reg:SI LR_REGNO))]
10423 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX"
10424 "addi %0,%1,%2@got@tlsgd\;bl %z3\;%."
10425 [(set_attr "type" "two")
10426 (set_attr "length" "12")])
10428 (define_insn "tls_gd_sysv<TLSmode:tls_sysv_suffix>"
10429 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10430 (call (mem:TLSmode (match_operand:TLSmode 3 "symbol_ref_operand" "s"))
10431 (match_operand 4 "" "g")))
10432 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10433 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10435 (clobber (reg:SI LR_REGNO))]
10436 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4"
10440 if (TARGET_SECURE_PLT && flag_pic == 2)
10441 return "addi %0,%1,%2@got@tlsgd\;bl %z3+32768@plt";
10443 return "addi %0,%1,%2@got@tlsgd\;bl %z3@plt";
10446 return "addi %0,%1,%2@got@tlsgd\;bl %z3";
10448 [(set_attr "type" "two")
10449 (set_attr "length" "8")])
10451 (define_insn "tls_ld_aix<TLSmode:tls_abi_suffix>"
10452 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10453 (call (mem:TLSmode (match_operand:TLSmode 2 "symbol_ref_operand" "s"))
10454 (match_operand 3 "" "g")))
10455 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
10457 (clobber (reg:SI LR_REGNO))]
10458 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX"
10459 "addi %0,%1,%&@got@tlsld\;bl %z2\;%."
10460 [(set_attr "length" "12")])
10462 (define_insn "tls_ld_sysv<TLSmode:tls_sysv_suffix>"
10463 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10464 (call (mem:TLSmode (match_operand:TLSmode 2 "symbol_ref_operand" "s"))
10465 (match_operand 3 "" "g")))
10466 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
10468 (clobber (reg:SI LR_REGNO))]
10469 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4"
10473 if (TARGET_SECURE_PLT && flag_pic == 2)
10474 return "addi %0,%1,%&@got@tlsld\;bl %z2+32768@plt";
10476 return "addi %0,%1,%&@got@tlsld\;bl %z2@plt";
10479 return "addi %0,%1,%&@got@tlsld\;bl %z2";
10481 [(set_attr "length" "8")])
10483 (define_insn "tls_dtprel_<TLSmode:tls_abi_suffix>"
10484 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
10485 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10486 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10487 UNSPEC_TLSDTPREL))]
10489 "addi %0,%1,%2@dtprel")
10491 (define_insn "tls_dtprel_ha_<TLSmode:tls_abi_suffix>"
10492 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
10493 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10494 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10495 UNSPEC_TLSDTPRELHA))]
10497 "addis %0,%1,%2@dtprel@ha")
10499 (define_insn "tls_dtprel_lo_<TLSmode:tls_abi_suffix>"
10500 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
10501 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10502 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10503 UNSPEC_TLSDTPRELLO))]
10505 "addi %0,%1,%2@dtprel@l")
10507 (define_insn "tls_got_dtprel_<TLSmode:tls_abi_suffix>"
10508 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
10509 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10510 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10511 UNSPEC_TLSGOTDTPREL))]
10513 "l<TLSmode:tls_insn_suffix> %0,%2@got@dtprel(%1)")
10515 (define_insn "tls_tprel_<TLSmode:tls_abi_suffix>"
10516 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
10517 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10518 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10521 "addi %0,%1,%2@tprel")
10523 (define_insn "tls_tprel_ha_<TLSmode:tls_abi_suffix>"
10524 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
10525 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10526 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10527 UNSPEC_TLSTPRELHA))]
10529 "addis %0,%1,%2@tprel@ha")
10531 (define_insn "tls_tprel_lo_<TLSmode:tls_abi_suffix>"
10532 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
10533 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10534 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10535 UNSPEC_TLSTPRELLO))]
10537 "addi %0,%1,%2@tprel@l")
10539 ;; "b" output constraint here and on tls_tls input to support linker tls
10540 ;; optimization. The linker may edit the instructions emitted by a
10541 ;; tls_got_tprel/tls_tls pair to addis,addi.
10542 (define_insn "tls_got_tprel_<TLSmode:tls_abi_suffix>"
10543 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10544 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10545 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10546 UNSPEC_TLSGOTTPREL))]
10548 "l<TLSmode:tls_insn_suffix> %0,%2@got@tprel(%1)")
10550 (define_insn "tls_tls_<TLSmode:tls_abi_suffix>"
10551 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
10552 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10553 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10556 "add %0,%1,%2@tls")
10559 ;; Next come insns related to the calling sequence.
10561 ;; First, an insn to allocate new stack space for dynamic use (e.g., alloca).
10562 ;; We move the back-chain and decrement the stack pointer.
10564 (define_expand "allocate_stack"
10565 [(set (match_operand 0 "gpc_reg_operand" "")
10566 (minus (reg 1) (match_operand 1 "reg_or_short_operand" "")))
10568 (minus (reg 1) (match_dup 1)))]
10571 { rtx chain = gen_reg_rtx (Pmode);
10572 rtx stack_bot = gen_rtx_MEM (Pmode, stack_pointer_rtx);
10574 rtx insn, par, set, mem;
10576 emit_move_insn (chain, stack_bot);
10578 /* Check stack bounds if necessary. */
10579 if (crtl->limit_stack)
10582 available = expand_binop (Pmode, sub_optab,
10583 stack_pointer_rtx, stack_limit_rtx,
10584 NULL_RTX, 1, OPTAB_WIDEN);
10585 emit_insn (gen_cond_trap (LTU, available, operands[1], const0_rtx));
10588 if (GET_CODE (operands[1]) != CONST_INT
10589 || INTVAL (operands[1]) < -32767
10590 || INTVAL (operands[1]) > 32768)
10592 neg_op0 = gen_reg_rtx (Pmode);
10594 emit_insn (gen_negsi2 (neg_op0, operands[1]));
10596 emit_insn (gen_negdi2 (neg_op0, operands[1]));
10599 neg_op0 = GEN_INT (- INTVAL (operands[1]));
10601 insn = emit_insn ((* ((TARGET_32BIT) ? gen_movsi_update_stack
10602 : gen_movdi_di_update_stack))
10603 (stack_pointer_rtx, stack_pointer_rtx, neg_op0,
10605 /* Since we didn't use gen_frame_mem to generate the MEM, grab
10606 it now and set the alias set/attributes. The above gen_*_update
10607 calls will generate a PARALLEL with the MEM set being the first
10609 par = PATTERN (insn);
10610 gcc_assert (GET_CODE (par) == PARALLEL);
10611 set = XVECEXP (par, 0, 0);
10612 gcc_assert (GET_CODE (set) == SET);
10613 mem = SET_DEST (set);
10614 gcc_assert (MEM_P (mem));
10615 MEM_NOTRAP_P (mem) = 1;
10616 set_mem_alias_set (mem, get_frame_alias_set ());
10618 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
10622 ;; These patterns say how to save and restore the stack pointer. We need not
10623 ;; save the stack pointer at function level since we are careful to
10624 ;; preserve the backchain. At block level, we have to restore the backchain
10625 ;; when we restore the stack pointer.
10627 ;; For nonlocal gotos, we must save both the stack pointer and its
10628 ;; backchain and restore both. Note that in the nonlocal case, the
10629 ;; save area is a memory location.
10631 (define_expand "save_stack_function"
10632 [(match_operand 0 "any_operand" "")
10633 (match_operand 1 "any_operand" "")]
10637 (define_expand "restore_stack_function"
10638 [(match_operand 0 "any_operand" "")
10639 (match_operand 1 "any_operand" "")]
10643 ;; Adjust stack pointer (op0) to a new value (op1).
10644 ;; First copy old stack backchain to new location, and ensure that the
10645 ;; scheduler won't reorder the sp assignment before the backchain write.
10646 (define_expand "restore_stack_block"
10647 [(set (match_dup 2) (match_dup 3))
10648 (set (match_dup 4) (match_dup 2))
10649 (set (match_dup 5) (unspec:BLK [(match_dup 5)] UNSPEC_TIE))
10650 (set (match_operand 0 "register_operand" "")
10651 (match_operand 1 "register_operand" ""))]
10655 operands[1] = force_reg (Pmode, operands[1]);
10656 operands[2] = gen_reg_rtx (Pmode);
10657 operands[3] = gen_frame_mem (Pmode, operands[0]);
10658 operands[4] = gen_frame_mem (Pmode, operands[1]);
10659 operands[5] = gen_frame_mem (BLKmode, operands[0]);
10662 (define_expand "save_stack_nonlocal"
10663 [(set (match_dup 3) (match_dup 4))
10664 (set (match_operand 0 "memory_operand" "") (match_dup 3))
10665 (set (match_dup 2) (match_operand 1 "register_operand" ""))]
10669 int units_per_word = (TARGET_32BIT) ? 4 : 8;
10671 /* Copy the backchain to the first word, sp to the second. */
10672 operands[0] = adjust_address_nv (operands[0], Pmode, 0);
10673 operands[2] = adjust_address_nv (operands[0], Pmode, units_per_word);
10674 operands[3] = gen_reg_rtx (Pmode);
10675 operands[4] = gen_frame_mem (Pmode, operands[1]);
10678 (define_expand "restore_stack_nonlocal"
10679 [(set (match_dup 2) (match_operand 1 "memory_operand" ""))
10680 (set (match_dup 3) (match_dup 4))
10681 (set (match_dup 5) (match_dup 2))
10682 (set (match_dup 6) (unspec:BLK [(match_dup 6)] UNSPEC_TIE))
10683 (set (match_operand 0 "register_operand" "") (match_dup 3))]
10687 int units_per_word = (TARGET_32BIT) ? 4 : 8;
10689 /* Restore the backchain from the first word, sp from the second. */
10690 operands[2] = gen_reg_rtx (Pmode);
10691 operands[3] = gen_reg_rtx (Pmode);
10692 operands[1] = adjust_address_nv (operands[1], Pmode, 0);
10693 operands[4] = adjust_address_nv (operands[1], Pmode, units_per_word);
10694 operands[5] = gen_frame_mem (Pmode, operands[3]);
10695 operands[6] = gen_frame_mem (BLKmode, operands[0]);
10698 ;; TOC register handling.
10700 ;; Code to initialize the TOC register...
10702 (define_insn "load_toc_aix_si"
10703 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10704 (unspec:SI [(const_int 0)] UNSPEC_TOC))
10705 (use (reg:SI 2))])]
10706 "DEFAULT_ABI == ABI_AIX && TARGET_32BIT"
10710 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
10711 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
10712 operands[2] = gen_rtx_REG (Pmode, 2);
10713 return \"{l|lwz} %0,%1(%2)\";
10715 [(set_attr "type" "load")])
10717 (define_insn "load_toc_aix_di"
10718 [(parallel [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10719 (unspec:DI [(const_int 0)] UNSPEC_TOC))
10720 (use (reg:DI 2))])]
10721 "DEFAULT_ABI == ABI_AIX && TARGET_64BIT"
10725 #ifdef TARGET_RELOCATABLE
10726 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\",
10727 !TARGET_MINIMAL_TOC || TARGET_RELOCATABLE);
10729 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
10732 strcat (buf, \"@toc\");
10733 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
10734 operands[2] = gen_rtx_REG (Pmode, 2);
10735 return \"ld %0,%1(%2)\";
10737 [(set_attr "type" "load")])
10739 (define_insn "load_toc_v4_pic_si"
10740 [(set (reg:SI LR_REGNO)
10741 (unspec:SI [(const_int 0)] UNSPEC_TOC))]
10742 "DEFAULT_ABI == ABI_V4 && flag_pic == 1 && TARGET_32BIT"
10743 "bl _GLOBAL_OFFSET_TABLE_@local-4"
10744 [(set_attr "type" "branch")
10745 (set_attr "length" "4")])
10747 (define_insn "load_toc_v4_PIC_1"
10748 [(set (reg:SI LR_REGNO)
10749 (match_operand:SI 0 "immediate_operand" "s"))
10750 (use (unspec [(match_dup 0)] UNSPEC_TOC))]
10751 "TARGET_ELF && DEFAULT_ABI != ABI_AIX
10752 && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
10753 "bcl 20,31,%0\\n%0:"
10754 [(set_attr "type" "branch")
10755 (set_attr "length" "4")])
10757 (define_insn "load_toc_v4_PIC_1b"
10758 [(set (reg:SI LR_REGNO)
10759 (unspec:SI [(match_operand:SI 0 "immediate_operand" "s")]
10761 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
10762 "bcl 20,31,$+8\\n\\t.long %0-$"
10763 [(set_attr "type" "branch")
10764 (set_attr "length" "8")])
10766 (define_insn "load_toc_v4_PIC_2"
10767 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10768 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
10769 (minus:SI (match_operand:SI 2 "immediate_operand" "s")
10770 (match_operand:SI 3 "immediate_operand" "s")))))]
10771 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
10772 "{l|lwz} %0,%2-%3(%1)"
10773 [(set_attr "type" "load")])
10775 (define_insn "load_toc_v4_PIC_3b"
10776 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
10777 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "r")
10779 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
10780 (match_operand:SI 3 "symbol_ref_operand" "s")))))]
10781 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
10782 "{cau|addis} %0,%1,%2-%3@ha")
10784 (define_insn "load_toc_v4_PIC_3c"
10785 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10786 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
10787 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
10788 (match_operand:SI 3 "symbol_ref_operand" "s"))))]
10789 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
10790 "{cal|addi} %0,%1,%2-%3@l")
10792 ;; If the TOC is shared over a translation unit, as happens with all
10793 ;; the kinds of PIC that we support, we need to restore the TOC
10794 ;; pointer only when jumping over units of translation.
10795 ;; On Darwin, we need to reload the picbase.
10797 (define_expand "builtin_setjmp_receiver"
10798 [(use (label_ref (match_operand 0 "" "")))]
10799 "(DEFAULT_ABI == ABI_V4 && flag_pic == 1)
10800 || (TARGET_TOC && TARGET_MINIMAL_TOC)
10801 || (DEFAULT_ABI == ABI_DARWIN && flag_pic)"
10805 if (DEFAULT_ABI == ABI_DARWIN)
10807 rtx picrtx = gen_rtx_SYMBOL_REF (Pmode, MACHOPIC_FUNCTION_BASE_NAME);
10808 rtx picreg = gen_rtx_REG (Pmode, RS6000_PIC_OFFSET_TABLE_REGNUM);
10812 crtl->uses_pic_offset_table = 1;
10813 ASM_GENERATE_INTERNAL_LABEL(tmplab, \"LSJR\",
10814 CODE_LABEL_NUMBER (operands[0]));
10815 tmplabrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (tmplab));
10817 emit_insn (gen_load_macho_picbase (tmplabrtx));
10818 emit_move_insn (picreg, gen_rtx_REG (Pmode, LR_REGNO));
10819 emit_insn (gen_macho_correct_pic (picreg, picreg, picrtx, tmplabrtx));
10823 rs6000_emit_load_toc_table (FALSE);
10827 ;; Elf specific ways of loading addresses for non-PIC code.
10828 ;; The output of this could be r0, but we make a very strong
10829 ;; preference for a base register because it will usually
10830 ;; be needed there.
10831 (define_insn "elf_high"
10832 [(set (match_operand:SI 0 "gpc_reg_operand" "=b*r")
10833 (high:SI (match_operand 1 "" "")))]
10834 "TARGET_ELF && ! TARGET_64BIT"
10835 "{liu|lis} %0,%1@ha")
10837 (define_insn "elf_low"
10838 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
10839 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,!*r")
10840 (match_operand 2 "" "")))]
10841 "TARGET_ELF && ! TARGET_64BIT"
10843 {cal|la} %0,%2@l(%1)
10844 {ai|addic} %0,%1,%K2")
10846 ;; A function pointer under AIX is a pointer to a data area whose first word
10847 ;; contains the actual address of the function, whose second word contains a
10848 ;; pointer to its TOC, and whose third word contains a value to place in the
10849 ;; static chain register (r11). Note that if we load the static chain, our
10850 ;; "trampoline" need not have any executable code.
10852 (define_expand "call_indirect_aix32"
10853 [(set (match_dup 2)
10854 (mem:SI (match_operand:SI 0 "gpc_reg_operand" "")))
10855 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
10858 (mem:SI (plus:SI (match_dup 0)
10860 (parallel [(call (mem:SI (match_dup 2))
10861 (match_operand 1 "" ""))
10862 (use (mem:SI (plus:SI (match_dup 0) (const_int 4))))
10864 (use (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10865 (clobber (reg:SI LR_REGNO))])]
10868 { operands[2] = gen_reg_rtx (SImode); }")
10870 (define_expand "call_indirect_aix64"
10871 [(set (match_dup 2)
10872 (mem:DI (match_operand:DI 0 "gpc_reg_operand" "")))
10873 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
10876 (mem:DI (plus:DI (match_dup 0)
10878 (parallel [(call (mem:SI (match_dup 2))
10879 (match_operand 1 "" ""))
10880 (use (mem:DI (plus:DI (match_dup 0) (const_int 8))))
10882 (use (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10883 (clobber (reg:SI LR_REGNO))])]
10886 { operands[2] = gen_reg_rtx (DImode); }")
10888 (define_expand "call_value_indirect_aix32"
10889 [(set (match_dup 3)
10890 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "")))
10891 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
10894 (mem:SI (plus:SI (match_dup 1)
10896 (parallel [(set (match_operand 0 "" "")
10897 (call (mem:SI (match_dup 3))
10898 (match_operand 2 "" "")))
10899 (use (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10901 (use (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10902 (clobber (reg:SI LR_REGNO))])]
10905 { operands[3] = gen_reg_rtx (SImode); }")
10907 (define_expand "call_value_indirect_aix64"
10908 [(set (match_dup 3)
10909 (mem:DI (match_operand:DI 1 "gpc_reg_operand" "")))
10910 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
10913 (mem:DI (plus:DI (match_dup 1)
10915 (parallel [(set (match_operand 0 "" "")
10916 (call (mem:SI (match_dup 3))
10917 (match_operand 2 "" "")))
10918 (use (mem:DI (plus:DI (match_dup 1) (const_int 8))))
10920 (use (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10921 (clobber (reg:SI LR_REGNO))])]
10924 { operands[3] = gen_reg_rtx (DImode); }")
10926 ;; Now the definitions for the call and call_value insns
10927 (define_expand "call"
10928 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
10929 (match_operand 1 "" ""))
10930 (use (match_operand 2 "" ""))
10931 (clobber (reg:SI LR_REGNO))])]
10936 if (MACHOPIC_INDIRECT)
10937 operands[0] = machopic_indirect_call_target (operands[0]);
10940 gcc_assert (GET_CODE (operands[0]) == MEM);
10941 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
10943 operands[0] = XEXP (operands[0], 0);
10945 if (GET_CODE (operands[0]) != SYMBOL_REF
10946 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[0]))
10947 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[2]) & CALL_LONG) != 0))
10949 if (INTVAL (operands[2]) & CALL_LONG)
10950 operands[0] = rs6000_longcall_ref (operands[0]);
10952 switch (DEFAULT_ABI)
10956 operands[0] = force_reg (Pmode, operands[0]);
10960 /* AIX function pointers are really pointers to a three word
10962 emit_call_insn (TARGET_32BIT
10963 ? gen_call_indirect_aix32 (force_reg (SImode,
10966 : gen_call_indirect_aix64 (force_reg (DImode,
10972 gcc_unreachable ();
10977 (define_expand "call_value"
10978 [(parallel [(set (match_operand 0 "" "")
10979 (call (mem:SI (match_operand 1 "address_operand" ""))
10980 (match_operand 2 "" "")))
10981 (use (match_operand 3 "" ""))
10982 (clobber (reg:SI LR_REGNO))])]
10987 if (MACHOPIC_INDIRECT)
10988 operands[1] = machopic_indirect_call_target (operands[1]);
10991 gcc_assert (GET_CODE (operands[1]) == MEM);
10992 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
10994 operands[1] = XEXP (operands[1], 0);
10996 if (GET_CODE (operands[1]) != SYMBOL_REF
10997 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[1]))
10998 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[3]) & CALL_LONG) != 0))
11000 if (INTVAL (operands[3]) & CALL_LONG)
11001 operands[1] = rs6000_longcall_ref (operands[1]);
11003 switch (DEFAULT_ABI)
11007 operands[1] = force_reg (Pmode, operands[1]);
11011 /* AIX function pointers are really pointers to a three word
11013 emit_call_insn (TARGET_32BIT
11014 ? gen_call_value_indirect_aix32 (operands[0],
11018 : gen_call_value_indirect_aix64 (operands[0],
11025 gcc_unreachable ();
11030 ;; Call to function in current module. No TOC pointer reload needed.
11031 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
11032 ;; either the function was not prototyped, or it was prototyped as a
11033 ;; variable argument function. It is > 0 if FP registers were passed
11034 ;; and < 0 if they were not.
11036 (define_insn "*call_local32"
11037 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
11038 (match_operand 1 "" "g,g"))
11039 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11040 (clobber (reg:SI LR_REGNO))]
11041 "(INTVAL (operands[2]) & CALL_LONG) == 0"
11044 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11045 output_asm_insn (\"crxor 6,6,6\", operands);
11047 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11048 output_asm_insn (\"creqv 6,6,6\", operands);
11050 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
11052 [(set_attr "type" "branch")
11053 (set_attr "length" "4,8")])
11055 (define_insn "*call_local64"
11056 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
11057 (match_operand 1 "" "g,g"))
11058 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11059 (clobber (reg:SI LR_REGNO))]
11060 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
11063 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11064 output_asm_insn (\"crxor 6,6,6\", operands);
11066 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11067 output_asm_insn (\"creqv 6,6,6\", operands);
11069 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
11071 [(set_attr "type" "branch")
11072 (set_attr "length" "4,8")])
11074 (define_insn "*call_value_local32"
11075 [(set (match_operand 0 "" "")
11076 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
11077 (match_operand 2 "" "g,g")))
11078 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11079 (clobber (reg:SI LR_REGNO))]
11080 "(INTVAL (operands[3]) & CALL_LONG) == 0"
11083 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11084 output_asm_insn (\"crxor 6,6,6\", operands);
11086 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11087 output_asm_insn (\"creqv 6,6,6\", operands);
11089 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
11091 [(set_attr "type" "branch")
11092 (set_attr "length" "4,8")])
11095 (define_insn "*call_value_local64"
11096 [(set (match_operand 0 "" "")
11097 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
11098 (match_operand 2 "" "g,g")))
11099 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11100 (clobber (reg:SI LR_REGNO))]
11101 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
11104 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11105 output_asm_insn (\"crxor 6,6,6\", operands);
11107 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11108 output_asm_insn (\"creqv 6,6,6\", operands);
11110 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
11112 [(set_attr "type" "branch")
11113 (set_attr "length" "4,8")])
11115 ;; Call to function which may be in another module. Restore the TOC
11116 ;; pointer (r2) after the call unless this is System V.
11117 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
11118 ;; either the function was not prototyped, or it was prototyped as a
11119 ;; variable argument function. It is > 0 if FP registers were passed
11120 ;; and < 0 if they were not.
11122 (define_insn_and_split "*call_indirect_nonlocal_aix32_internal"
11123 [(call (mem:SI (match_operand:SI 0 "register_operand" "c,*l"))
11124 (match_operand 1 "" "g,g"))
11125 (use (mem:SI (plus:SI (match_operand:SI 2 "register_operand" "b,b") (const_int 4))))
11127 (use (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
11128 (clobber (reg:SI LR_REGNO))]
11129 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
11131 "&& reload_completed"
11133 (mem:SI (plus:SI (match_dup 2) (const_int 4))))
11134 (parallel [(call (mem:SI (match_dup 0))
11139 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
11140 (clobber (reg:SI LR_REGNO))])]
11142 [(set_attr "type" "jmpreg")
11143 (set_attr "length" "12")])
11145 (define_insn "*call_indirect_nonlocal_aix32"
11146 [(call (mem:SI (match_operand:SI 0 "register_operand" "c,*l"))
11147 (match_operand 1 "" "g,g"))
11151 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
11152 (clobber (reg:SI LR_REGNO))]
11153 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX && reload_completed"
11154 "b%T0l\;{l|lwz} 2,20(1)"
11155 [(set_attr "type" "jmpreg")
11156 (set_attr "length" "8")])
11158 (define_insn "*call_nonlocal_aix32"
11159 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
11160 (match_operand 1 "" "g"))
11161 (use (match_operand:SI 2 "immediate_operand" "O"))
11162 (clobber (reg:SI LR_REGNO))]
11164 && DEFAULT_ABI == ABI_AIX
11165 && (INTVAL (operands[2]) & CALL_LONG) == 0"
11167 [(set_attr "type" "branch")
11168 (set_attr "length" "8")])
11170 (define_insn_and_split "*call_indirect_nonlocal_aix64_internal"
11171 [(call (mem:SI (match_operand:DI 0 "register_operand" "c,*l"))
11172 (match_operand 1 "" "g,g"))
11173 (use (mem:DI (plus:DI (match_operand:DI 2 "register_operand" "b,b")
11176 (use (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
11177 (clobber (reg:SI LR_REGNO))]
11178 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
11180 "&& reload_completed"
11182 (mem:DI (plus:DI (match_dup 2) (const_int 8))))
11183 (parallel [(call (mem:SI (match_dup 0))
11188 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
11189 (clobber (reg:SI LR_REGNO))])]
11191 [(set_attr "type" "jmpreg")
11192 (set_attr "length" "12")])
11194 (define_insn "*call_indirect_nonlocal_aix64"
11195 [(call (mem:SI (match_operand:DI 0 "register_operand" "c,*l"))
11196 (match_operand 1 "" "g,g"))
11200 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
11201 (clobber (reg:SI LR_REGNO))]
11202 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX && reload_completed"
11203 "b%T0l\;ld 2,40(1)"
11204 [(set_attr "type" "jmpreg")
11205 (set_attr "length" "8")])
11207 (define_insn "*call_nonlocal_aix64"
11208 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
11209 (match_operand 1 "" "g"))
11210 (use (match_operand:SI 2 "immediate_operand" "O"))
11211 (clobber (reg:SI LR_REGNO))]
11213 && DEFAULT_ABI == ABI_AIX
11214 && (INTVAL (operands[2]) & CALL_LONG) == 0"
11216 [(set_attr "type" "branch")
11217 (set_attr "length" "8")])
11219 (define_insn_and_split "*call_value_indirect_nonlocal_aix32_internal"
11220 [(set (match_operand 0 "" "")
11221 (call (mem:SI (match_operand:SI 1 "register_operand" "c,*l"))
11222 (match_operand 2 "" "g,g")))
11223 (use (mem:SI (plus:SI (match_operand:SI 3 "register_operand" "b,b")
11226 (use (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
11227 (clobber (reg:SI LR_REGNO))]
11228 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
11230 "&& reload_completed"
11232 (mem:SI (plus:SI (match_dup 3) (const_int 4))))
11233 (parallel [(set (match_dup 0) (call (mem:SI (match_dup 1))
11238 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
11239 (clobber (reg:SI LR_REGNO))])]
11241 [(set_attr "type" "jmpreg")
11242 (set_attr "length" "12")])
11244 (define_insn "*call_value_indirect_nonlocal_aix32"
11245 [(set (match_operand 0 "" "")
11246 (call (mem:SI (match_operand:SI 1 "register_operand" "c,*l"))
11247 (match_operand 2 "" "g,g")))
11251 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
11252 (clobber (reg:SI LR_REGNO))]
11253 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX && reload_completed"
11254 "b%T1l\;{l|lwz} 2,20(1)"
11255 [(set_attr "type" "jmpreg")
11256 (set_attr "length" "8")])
11258 (define_insn "*call_value_nonlocal_aix32"
11259 [(set (match_operand 0 "" "")
11260 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
11261 (match_operand 2 "" "g")))
11262 (use (match_operand:SI 3 "immediate_operand" "O"))
11263 (clobber (reg:SI LR_REGNO))]
11265 && DEFAULT_ABI == ABI_AIX
11266 && (INTVAL (operands[3]) & CALL_LONG) == 0"
11268 [(set_attr "type" "branch")
11269 (set_attr "length" "8")])
11271 (define_insn_and_split "*call_value_indirect_nonlocal_aix64_internal"
11272 [(set (match_operand 0 "" "")
11273 (call (mem:SI (match_operand:DI 1 "register_operand" "c,*l"))
11274 (match_operand 2 "" "g,g")))
11275 (use (mem:DI (plus:DI (match_operand:DI 3 "register_operand" "b,b")
11278 (use (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
11279 (clobber (reg:SI LR_REGNO))]
11280 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
11282 "&& reload_completed"
11284 (mem:DI (plus:DI (match_dup 3) (const_int 8))))
11285 (parallel [(set (match_dup 0) (call (mem:SI (match_dup 1))
11290 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
11291 (clobber (reg:SI LR_REGNO))])]
11293 [(set_attr "type" "jmpreg")
11294 (set_attr "length" "12")])
11296 (define_insn "*call_value_indirect_nonlocal_aix64"
11297 [(set (match_operand 0 "" "")
11298 (call (mem:SI (match_operand:DI 1 "register_operand" "c,*l"))
11299 (match_operand 2 "" "g,g")))
11303 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
11304 (clobber (reg:SI LR_REGNO))]
11305 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX && reload_completed"
11306 "b%T1l\;ld 2,40(1)"
11307 [(set_attr "type" "jmpreg")
11308 (set_attr "length" "8")])
11310 (define_insn "*call_value_nonlocal_aix64"
11311 [(set (match_operand 0 "" "")
11312 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
11313 (match_operand 2 "" "g")))
11314 (use (match_operand:SI 3 "immediate_operand" "O"))
11315 (clobber (reg:SI LR_REGNO))]
11317 && DEFAULT_ABI == ABI_AIX
11318 && (INTVAL (operands[3]) & CALL_LONG) == 0"
11320 [(set_attr "type" "branch")
11321 (set_attr "length" "8")])
11323 ;; A function pointer under System V is just a normal pointer
11324 ;; operands[0] is the function pointer
11325 ;; operands[1] is the stack size to clean up
11326 ;; operands[2] is the value FUNCTION_ARG returns for the VOID argument
11327 ;; which indicates how to set cr1
11329 (define_insn "*call_indirect_nonlocal_sysv<mode>"
11330 [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l,c,*l"))
11331 (match_operand 1 "" "g,g,g,g"))
11332 (use (match_operand:SI 2 "immediate_operand" "O,O,n,n"))
11333 (clobber (reg:SI LR_REGNO))]
11334 "DEFAULT_ABI == ABI_V4
11335 || DEFAULT_ABI == ABI_DARWIN"
11337 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11338 output_asm_insn ("crxor 6,6,6", operands);
11340 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11341 output_asm_insn ("creqv 6,6,6", operands);
11345 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
11346 (set_attr "length" "4,4,8,8")])
11348 (define_insn_and_split "*call_nonlocal_sysv<mode>"
11349 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
11350 (match_operand 1 "" "g,g"))
11351 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11352 (clobber (reg:SI LR_REGNO))]
11353 "(DEFAULT_ABI == ABI_DARWIN
11354 || (DEFAULT_ABI == ABI_V4
11355 && (INTVAL (operands[2]) & CALL_LONG) == 0))"
11357 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11358 output_asm_insn ("crxor 6,6,6", operands);
11360 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11361 output_asm_insn ("creqv 6,6,6", operands);
11364 return output_call(insn, operands, 0, 2);
11366 if (DEFAULT_ABI == ABI_V4 && flag_pic)
11368 gcc_assert (!TARGET_SECURE_PLT);
11369 return "bl %z0@plt";
11375 "DEFAULT_ABI == ABI_V4
11376 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[0])
11377 && (INTVAL (operands[2]) & CALL_LONG) == 0"
11378 [(parallel [(call (mem:SI (match_dup 0))
11380 (use (match_dup 2))
11381 (use (match_dup 3))
11382 (clobber (reg:SI LR_REGNO))])]
11384 operands[3] = pic_offset_table_rtx;
11386 [(set_attr "type" "branch,branch")
11387 (set_attr "length" "4,8")])
11389 (define_insn "*call_nonlocal_sysv_secure<mode>"
11390 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
11391 (match_operand 1 "" "g,g"))
11392 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11393 (use (match_operand:SI 3 "register_operand" "r,r"))
11394 (clobber (reg:SI LR_REGNO))]
11395 "(DEFAULT_ABI == ABI_V4
11396 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[0])
11397 && (INTVAL (operands[2]) & CALL_LONG) == 0)"
11399 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11400 output_asm_insn ("crxor 6,6,6", operands);
11402 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11403 output_asm_insn ("creqv 6,6,6", operands);
11406 /* The magic 32768 offset here and in the other sysv call insns
11407 corresponds to the offset of r30 in .got2, as given by LCTOC1.
11408 See sysv4.h:toc_section. */
11409 return "bl %z0+32768@plt";
11411 return "bl %z0@plt";
11413 [(set_attr "type" "branch,branch")
11414 (set_attr "length" "4,8")])
11416 (define_insn "*call_value_indirect_nonlocal_sysv<mode>"
11417 [(set (match_operand 0 "" "")
11418 (call (mem:SI (match_operand:P 1 "register_operand" "c,*l,c,*l"))
11419 (match_operand 2 "" "g,g,g,g")))
11420 (use (match_operand:SI 3 "immediate_operand" "O,O,n,n"))
11421 (clobber (reg:SI LR_REGNO))]
11422 "DEFAULT_ABI == ABI_V4
11423 || DEFAULT_ABI == ABI_DARWIN"
11425 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11426 output_asm_insn ("crxor 6,6,6", operands);
11428 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11429 output_asm_insn ("creqv 6,6,6", operands);
11433 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
11434 (set_attr "length" "4,4,8,8")])
11436 (define_insn_and_split "*call_value_nonlocal_sysv<mode>"
11437 [(set (match_operand 0 "" "")
11438 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
11439 (match_operand 2 "" "g,g")))
11440 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11441 (clobber (reg:SI LR_REGNO))]
11442 "(DEFAULT_ABI == ABI_DARWIN
11443 || (DEFAULT_ABI == ABI_V4
11444 && (INTVAL (operands[3]) & CALL_LONG) == 0))"
11446 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11447 output_asm_insn ("crxor 6,6,6", operands);
11449 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11450 output_asm_insn ("creqv 6,6,6", operands);
11453 return output_call(insn, operands, 1, 3);
11455 if (DEFAULT_ABI == ABI_V4 && flag_pic)
11457 gcc_assert (!TARGET_SECURE_PLT);
11458 return "bl %z1@plt";
11464 "DEFAULT_ABI == ABI_V4
11465 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[1])
11466 && (INTVAL (operands[3]) & CALL_LONG) == 0"
11467 [(parallel [(set (match_dup 0)
11468 (call (mem:SI (match_dup 1))
11470 (use (match_dup 3))
11471 (use (match_dup 4))
11472 (clobber (reg:SI LR_REGNO))])]
11474 operands[4] = pic_offset_table_rtx;
11476 [(set_attr "type" "branch,branch")
11477 (set_attr "length" "4,8")])
11479 (define_insn "*call_value_nonlocal_sysv_secure<mode>"
11480 [(set (match_operand 0 "" "")
11481 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
11482 (match_operand 2 "" "g,g")))
11483 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11484 (use (match_operand:SI 4 "register_operand" "r,r"))
11485 (clobber (reg:SI LR_REGNO))]
11486 "(DEFAULT_ABI == ABI_V4
11487 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[1])
11488 && (INTVAL (operands[3]) & CALL_LONG) == 0)"
11490 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11491 output_asm_insn ("crxor 6,6,6", operands);
11493 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11494 output_asm_insn ("creqv 6,6,6", operands);
11497 return "bl %z1+32768@plt";
11499 return "bl %z1@plt";
11501 [(set_attr "type" "branch,branch")
11502 (set_attr "length" "4,8")])
11504 ;; Call subroutine returning any type.
11505 (define_expand "untyped_call"
11506 [(parallel [(call (match_operand 0 "" "")
11508 (match_operand 1 "" "")
11509 (match_operand 2 "" "")])]
11515 emit_call_insn (GEN_CALL (operands[0], const0_rtx, const0_rtx, const0_rtx));
11517 for (i = 0; i < XVECLEN (operands[2], 0); i++)
11519 rtx set = XVECEXP (operands[2], 0, i);
11520 emit_move_insn (SET_DEST (set), SET_SRC (set));
11523 /* The optimizer does not know that the call sets the function value
11524 registers we stored in the result block. We avoid problems by
11525 claiming that all hard registers are used and clobbered at this
11527 emit_insn (gen_blockage ());
11532 ;; sibling call patterns
11533 (define_expand "sibcall"
11534 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
11535 (match_operand 1 "" ""))
11536 (use (match_operand 2 "" ""))
11537 (use (reg:SI LR_REGNO))
11543 if (MACHOPIC_INDIRECT)
11544 operands[0] = machopic_indirect_call_target (operands[0]);
11547 gcc_assert (GET_CODE (operands[0]) == MEM);
11548 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
11550 operands[0] = XEXP (operands[0], 0);
11553 ;; this and similar patterns must be marked as using LR, otherwise
11554 ;; dataflow will try to delete the store into it. This is true
11555 ;; even when the actual reg to jump to is in CTR, when LR was
11556 ;; saved and restored around the PIC-setting BCL.
11557 (define_insn "*sibcall_local32"
11558 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
11559 (match_operand 1 "" "g,g"))
11560 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11561 (use (reg:SI LR_REGNO))
11563 "(INTVAL (operands[2]) & CALL_LONG) == 0"
11566 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11567 output_asm_insn (\"crxor 6,6,6\", operands);
11569 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11570 output_asm_insn (\"creqv 6,6,6\", operands);
11572 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
11574 [(set_attr "type" "branch")
11575 (set_attr "length" "4,8")])
11577 (define_insn "*sibcall_local64"
11578 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
11579 (match_operand 1 "" "g,g"))
11580 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11581 (use (reg:SI LR_REGNO))
11583 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
11586 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11587 output_asm_insn (\"crxor 6,6,6\", operands);
11589 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11590 output_asm_insn (\"creqv 6,6,6\", operands);
11592 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
11594 [(set_attr "type" "branch")
11595 (set_attr "length" "4,8")])
11597 (define_insn "*sibcall_value_local32"
11598 [(set (match_operand 0 "" "")
11599 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
11600 (match_operand 2 "" "g,g")))
11601 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11602 (use (reg:SI LR_REGNO))
11604 "(INTVAL (operands[3]) & CALL_LONG) == 0"
11607 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11608 output_asm_insn (\"crxor 6,6,6\", operands);
11610 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11611 output_asm_insn (\"creqv 6,6,6\", operands);
11613 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
11615 [(set_attr "type" "branch")
11616 (set_attr "length" "4,8")])
11619 (define_insn "*sibcall_value_local64"
11620 [(set (match_operand 0 "" "")
11621 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
11622 (match_operand 2 "" "g,g")))
11623 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11624 (use (reg:SI LR_REGNO))
11626 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
11629 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11630 output_asm_insn (\"crxor 6,6,6\", operands);
11632 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11633 output_asm_insn (\"creqv 6,6,6\", operands);
11635 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
11637 [(set_attr "type" "branch")
11638 (set_attr "length" "4,8")])
11640 (define_insn "*sibcall_nonlocal_aix32"
11641 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
11642 (match_operand 1 "" "g"))
11643 (use (match_operand:SI 2 "immediate_operand" "O"))
11644 (use (reg:SI LR_REGNO))
11647 && DEFAULT_ABI == ABI_AIX
11648 && (INTVAL (operands[2]) & CALL_LONG) == 0"
11650 [(set_attr "type" "branch")
11651 (set_attr "length" "4")])
11653 (define_insn "*sibcall_nonlocal_aix64"
11654 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
11655 (match_operand 1 "" "g"))
11656 (use (match_operand:SI 2 "immediate_operand" "O"))
11657 (use (reg:SI LR_REGNO))
11660 && DEFAULT_ABI == ABI_AIX
11661 && (INTVAL (operands[2]) & CALL_LONG) == 0"
11663 [(set_attr "type" "branch")
11664 (set_attr "length" "4")])
11666 (define_insn "*sibcall_value_nonlocal_aix32"
11667 [(set (match_operand 0 "" "")
11668 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
11669 (match_operand 2 "" "g")))
11670 (use (match_operand:SI 3 "immediate_operand" "O"))
11671 (use (reg:SI LR_REGNO))
11674 && DEFAULT_ABI == ABI_AIX
11675 && (INTVAL (operands[3]) & CALL_LONG) == 0"
11677 [(set_attr "type" "branch")
11678 (set_attr "length" "4")])
11680 (define_insn "*sibcall_value_nonlocal_aix64"
11681 [(set (match_operand 0 "" "")
11682 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
11683 (match_operand 2 "" "g")))
11684 (use (match_operand:SI 3 "immediate_operand" "O"))
11685 (use (reg:SI LR_REGNO))
11688 && DEFAULT_ABI == ABI_AIX
11689 && (INTVAL (operands[3]) & CALL_LONG) == 0"
11691 [(set_attr "type" "branch")
11692 (set_attr "length" "4")])
11694 (define_insn "*sibcall_nonlocal_sysv<mode>"
11695 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
11696 (match_operand 1 "" ""))
11697 (use (match_operand 2 "immediate_operand" "O,n"))
11698 (use (reg:SI LR_REGNO))
11700 "(DEFAULT_ABI == ABI_DARWIN
11701 || DEFAULT_ABI == ABI_V4)
11702 && (INTVAL (operands[2]) & CALL_LONG) == 0"
11705 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11706 output_asm_insn (\"crxor 6,6,6\", operands);
11708 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11709 output_asm_insn (\"creqv 6,6,6\", operands);
11711 if (DEFAULT_ABI == ABI_V4 && flag_pic)
11713 gcc_assert (!TARGET_SECURE_PLT);
11714 return \"b %z0@plt\";
11719 [(set_attr "type" "branch,branch")
11720 (set_attr "length" "4,8")])
11722 (define_expand "sibcall_value"
11723 [(parallel [(set (match_operand 0 "register_operand" "")
11724 (call (mem:SI (match_operand 1 "address_operand" ""))
11725 (match_operand 2 "" "")))
11726 (use (match_operand 3 "" ""))
11727 (use (reg:SI LR_REGNO))
11733 if (MACHOPIC_INDIRECT)
11734 operands[1] = machopic_indirect_call_target (operands[1]);
11737 gcc_assert (GET_CODE (operands[1]) == MEM);
11738 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
11740 operands[1] = XEXP (operands[1], 0);
11743 (define_insn "*sibcall_value_nonlocal_sysv<mode>"
11744 [(set (match_operand 0 "" "")
11745 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
11746 (match_operand 2 "" "")))
11747 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11748 (use (reg:SI LR_REGNO))
11750 "(DEFAULT_ABI == ABI_DARWIN
11751 || DEFAULT_ABI == ABI_V4)
11752 && (INTVAL (operands[3]) & CALL_LONG) == 0"
11755 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11756 output_asm_insn (\"crxor 6,6,6\", operands);
11758 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11759 output_asm_insn (\"creqv 6,6,6\", operands);
11761 if (DEFAULT_ABI == ABI_V4 && flag_pic)
11763 gcc_assert (!TARGET_SECURE_PLT);
11764 return \"b %z1@plt\";
11769 [(set_attr "type" "branch,branch")
11770 (set_attr "length" "4,8")])
11772 (define_expand "sibcall_epilogue"
11773 [(use (const_int 0))]
11774 "TARGET_SCHED_PROLOG"
11777 rs6000_emit_epilogue (TRUE);
11781 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
11782 ;; all of memory. This blocks insns from being moved across this point.
11784 (define_insn "blockage"
11785 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCK)]
11789 ;; Compare insns are next. Note that the RS/6000 has two types of compares,
11790 ;; signed & unsigned, and one type of branch.
11792 ;; Start with the DEFINE_EXPANDs to generate the rtl for compares, scc
11793 ;; insns, and branches. We store the operands of compares until we see
11795 (define_expand "cmp<mode>"
11797 (compare (match_operand:GPR 0 "gpc_reg_operand" "")
11798 (match_operand:GPR 1 "reg_or_short_operand" "")))]
11802 /* Take care of the possibility that operands[1] might be negative but
11803 this might be a logical operation. That insn doesn't exist. */
11804 if (GET_CODE (operands[1]) == CONST_INT
11805 && INTVAL (operands[1]) < 0)
11806 operands[1] = force_reg (<MODE>mode, operands[1]);
11808 rs6000_compare_op0 = operands[0];
11809 rs6000_compare_op1 = operands[1];
11810 rs6000_compare_fp_p = 0;
11814 (define_expand "cmp<mode>"
11815 [(set (cc0) (compare (match_operand:FP 0 "gpc_reg_operand" "")
11816 (match_operand:FP 1 "gpc_reg_operand" "")))]
11820 rs6000_compare_op0 = operands[0];
11821 rs6000_compare_op1 = operands[1];
11822 rs6000_compare_fp_p = 1;
11826 (define_expand "beq"
11827 [(use (match_operand 0 "" ""))]
11829 "{ rs6000_emit_cbranch (EQ, operands[0]); DONE; }")
11831 (define_expand "bne"
11832 [(use (match_operand 0 "" ""))]
11834 "{ rs6000_emit_cbranch (NE, operands[0]); DONE; }")
11836 (define_expand "bge"
11837 [(use (match_operand 0 "" ""))]
11839 "{ rs6000_emit_cbranch (GE, operands[0]); DONE; }")
11841 (define_expand "bgt"
11842 [(use (match_operand 0 "" ""))]
11844 "{ rs6000_emit_cbranch (GT, operands[0]); DONE; }")
11846 (define_expand "ble"
11847 [(use (match_operand 0 "" ""))]
11849 "{ rs6000_emit_cbranch (LE, operands[0]); DONE; }")
11851 (define_expand "blt"
11852 [(use (match_operand 0 "" ""))]
11854 "{ rs6000_emit_cbranch (LT, operands[0]); DONE; }")
11856 (define_expand "bgeu"
11857 [(use (match_operand 0 "" ""))]
11859 "{ rs6000_emit_cbranch (GEU, operands[0]); DONE; }")
11861 (define_expand "bgtu"
11862 [(use (match_operand 0 "" ""))]
11864 "{ rs6000_emit_cbranch (GTU, operands[0]); DONE; }")
11866 (define_expand "bleu"
11867 [(use (match_operand 0 "" ""))]
11869 "{ rs6000_emit_cbranch (LEU, operands[0]); DONE; }")
11871 (define_expand "bltu"
11872 [(use (match_operand 0 "" ""))]
11874 "{ rs6000_emit_cbranch (LTU, operands[0]); DONE; }")
11876 (define_expand "bunordered"
11877 [(use (match_operand 0 "" ""))]
11878 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11879 "{ rs6000_emit_cbranch (UNORDERED, operands[0]); DONE; }")
11881 (define_expand "bordered"
11882 [(use (match_operand 0 "" ""))]
11883 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11884 "{ rs6000_emit_cbranch (ORDERED, operands[0]); DONE; }")
11886 (define_expand "buneq"
11887 [(use (match_operand 0 "" ""))]
11888 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11889 "{ rs6000_emit_cbranch (UNEQ, operands[0]); DONE; }")
11891 (define_expand "bunge"
11892 [(use (match_operand 0 "" ""))]
11893 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11894 "{ rs6000_emit_cbranch (UNGE, operands[0]); DONE; }")
11896 (define_expand "bungt"
11897 [(use (match_operand 0 "" ""))]
11898 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11899 "{ rs6000_emit_cbranch (UNGT, operands[0]); DONE; }")
11901 (define_expand "bunle"
11902 [(use (match_operand 0 "" ""))]
11903 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11904 "{ rs6000_emit_cbranch (UNLE, operands[0]); DONE; }")
11906 (define_expand "bunlt"
11907 [(use (match_operand 0 "" ""))]
11908 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11909 "{ rs6000_emit_cbranch (UNLT, operands[0]); DONE; }")
11911 (define_expand "bltgt"
11912 [(use (match_operand 0 "" ""))]
11913 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11914 "{ rs6000_emit_cbranch (LTGT, operands[0]); DONE; }")
11916 ;; For SNE, we would prefer that the xor/abs sequence be used for integers.
11917 ;; For SEQ, likewise, except that comparisons with zero should be done
11918 ;; with an scc insns. However, due to the order that combine see the
11919 ;; resulting insns, we must, in fact, allow SEQ for integers. Fail in
11920 ;; the cases we don't want to handle.
11921 (define_expand "seq"
11922 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11924 "{ rs6000_emit_sCOND (EQ, operands[0]); DONE; }")
11926 (define_expand "sne"
11927 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11931 if (! rs6000_compare_fp_p)
11934 rs6000_emit_sCOND (NE, operands[0]);
11938 ;; A >= 0 is best done the portable way for A an integer.
11939 (define_expand "sge"
11940 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11944 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
11947 rs6000_emit_sCOND (GE, operands[0]);
11951 ;; A > 0 is best done using the portable sequence, so fail in that case.
11952 (define_expand "sgt"
11953 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11957 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
11960 rs6000_emit_sCOND (GT, operands[0]);
11964 ;; A <= 0 is best done the portable way for A an integer.
11965 (define_expand "sle"
11966 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11970 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
11973 rs6000_emit_sCOND (LE, operands[0]);
11977 ;; A < 0 is best done in the portable way for A an integer.
11978 (define_expand "slt"
11979 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11983 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
11986 rs6000_emit_sCOND (LT, operands[0]);
11990 (define_expand "sgeu"
11991 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11993 "{ rs6000_emit_sCOND (GEU, operands[0]); DONE; }")
11995 (define_expand "sgtu"
11996 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11998 "{ rs6000_emit_sCOND (GTU, operands[0]); DONE; }")
12000 (define_expand "sleu"
12001 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
12003 "{ rs6000_emit_sCOND (LEU, operands[0]); DONE; }")
12005 (define_expand "sltu"
12006 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
12008 "{ rs6000_emit_sCOND (LTU, operands[0]); DONE; }")
12010 (define_expand "sunordered"
12011 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
12012 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
12013 "{ rs6000_emit_sCOND (UNORDERED, operands[0]); DONE; }")
12015 (define_expand "sordered"
12016 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
12017 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
12018 "{ rs6000_emit_sCOND (ORDERED, operands[0]); DONE; }")
12020 (define_expand "suneq"
12021 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
12022 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
12023 "{ rs6000_emit_sCOND (UNEQ, operands[0]); DONE; }")
12025 (define_expand "sunge"
12026 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
12027 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
12028 "{ rs6000_emit_sCOND (UNGE, operands[0]); DONE; }")
12030 (define_expand "sungt"
12031 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
12032 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
12033 "{ rs6000_emit_sCOND (UNGT, operands[0]); DONE; }")
12035 (define_expand "sunle"
12036 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
12037 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
12038 "{ rs6000_emit_sCOND (UNLE, operands[0]); DONE; }")
12040 (define_expand "sunlt"
12041 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
12042 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
12043 "{ rs6000_emit_sCOND (UNLT, operands[0]); DONE; }")
12045 (define_expand "sltgt"
12046 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
12047 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
12048 "{ rs6000_emit_sCOND (LTGT, operands[0]); DONE; }")
12050 (define_expand "stack_protect_set"
12051 [(match_operand 0 "memory_operand" "")
12052 (match_operand 1 "memory_operand" "")]
12055 #ifdef TARGET_THREAD_SSP_OFFSET
12056 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
12057 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
12058 operands[1] = gen_rtx_MEM (Pmode, addr);
12061 emit_insn (gen_stack_protect_setdi (operands[0], operands[1]));
12063 emit_insn (gen_stack_protect_setsi (operands[0], operands[1]));
12067 (define_insn "stack_protect_setsi"
12068 [(set (match_operand:SI 0 "memory_operand" "=m")
12069 (unspec:SI [(match_operand:SI 1 "memory_operand" "m")] UNSPEC_SP_SET))
12070 (set (match_scratch:SI 2 "=&r") (const_int 0))]
12072 "{l%U1%X1|lwz%U1%X1} %2,%1\;{st%U0%X0|stw%U0%X0} %2,%0\;{lil|li} %2,0"
12073 [(set_attr "type" "three")
12074 (set_attr "length" "12")])
12076 (define_insn "stack_protect_setdi"
12077 [(set (match_operand:DI 0 "memory_operand" "=m")
12078 (unspec:DI [(match_operand:DI 1 "memory_operand" "m")] UNSPEC_SP_SET))
12079 (set (match_scratch:DI 2 "=&r") (const_int 0))]
12081 "ld%U1%X1 %2,%1\;std%U0%X0 %2,%0\;{lil|li} %2,0"
12082 [(set_attr "type" "three")
12083 (set_attr "length" "12")])
12085 (define_expand "stack_protect_test"
12086 [(match_operand 0 "memory_operand" "")
12087 (match_operand 1 "memory_operand" "")
12088 (match_operand 2 "" "")]
12091 #ifdef TARGET_THREAD_SSP_OFFSET
12092 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
12093 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
12094 operands[1] = gen_rtx_MEM (Pmode, addr);
12096 rs6000_compare_op0 = operands[0];
12097 rs6000_compare_op1 = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, operands[1]),
12099 rs6000_compare_fp_p = 0;
12100 emit_jump_insn (gen_beq (operands[2]));
12104 (define_insn "stack_protect_testsi"
12105 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
12106 (unspec:CCEQ [(match_operand:SI 1 "memory_operand" "m,m")
12107 (match_operand:SI 2 "memory_operand" "m,m")]
12109 (set (match_scratch:SI 4 "=r,r") (const_int 0))
12110 (clobber (match_scratch:SI 3 "=&r,&r"))]
12113 {l%U1%X1|lwz%U1%X1} %3,%1\;{l%U2%X2|lwz%U2%X2} %4,%2\;xor. %3,%3,%4\;{lil|li} %4,0
12114 {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"
12115 [(set_attr "length" "16,20")])
12117 (define_insn "stack_protect_testdi"
12118 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
12119 (unspec:CCEQ [(match_operand:DI 1 "memory_operand" "m,m")
12120 (match_operand:DI 2 "memory_operand" "m,m")]
12122 (set (match_scratch:DI 4 "=r,r") (const_int 0))
12123 (clobber (match_scratch:DI 3 "=&r,&r"))]
12126 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;xor. %3,%3,%4\;{lil|li} %4,0
12127 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;cmpld %0,%3,%4\;{lil|li} %3,0\;{lil|li} %4,0"
12128 [(set_attr "length" "16,20")])
12131 ;; Here are the actual compare insns.
12132 (define_insn "*cmp<mode>_internal1"
12133 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
12134 (compare:CC (match_operand:GPR 1 "gpc_reg_operand" "r")
12135 (match_operand:GPR 2 "reg_or_short_operand" "rI")))]
12137 "{cmp%I2|cmp<wd>%I2} %0,%1,%2"
12138 [(set_attr "type" "cmp")])
12140 ;; If we are comparing a register for equality with a large constant,
12141 ;; we can do this with an XOR followed by a compare. But this is profitable
12142 ;; only if the large constant is only used for the comparison (and in this
12143 ;; case we already have a register to reuse as scratch).
12145 ;; For 64-bit registers, we could only do so if the constant's bit 15 is clear:
12146 ;; otherwise we'd need to XOR with FFFFFFFF????0000 which is not available.
12149 [(set (match_operand:SI 0 "register_operand")
12150 (match_operand:SI 1 "logical_const_operand" ""))
12151 (set (match_dup 0) (match_operator:SI 3 "boolean_or_operator"
12153 (match_operand:SI 2 "logical_const_operand" "")]))
12154 (set (match_operand:CC 4 "cc_reg_operand" "")
12155 (compare:CC (match_operand:SI 5 "gpc_reg_operand" "")
12158 (if_then_else (match_operator 6 "equality_operator"
12159 [(match_dup 4) (const_int 0)])
12160 (match_operand 7 "" "")
12161 (match_operand 8 "" "")))]
12162 "peep2_reg_dead_p (3, operands[0])
12163 && peep2_reg_dead_p (4, operands[4])"
12164 [(set (match_dup 0) (xor:SI (match_dup 5) (match_dup 9)))
12165 (set (match_dup 4) (compare:CC (match_dup 0) (match_dup 10)))
12166 (set (pc) (if_then_else (match_dup 6) (match_dup 7) (match_dup 8)))]
12169 /* Get the constant we are comparing against, and see what it looks like
12170 when sign-extended from 16 to 32 bits. Then see what constant we could
12171 XOR with SEXTC to get the sign-extended value. */
12172 rtx cnst = simplify_const_binary_operation (GET_CODE (operands[3]),
12174 operands[1], operands[2]);
12175 HOST_WIDE_INT c = INTVAL (cnst);
12176 HOST_WIDE_INT sextc = ((c & 0xffff) ^ 0x8000) - 0x8000;
12177 HOST_WIDE_INT xorv = c ^ sextc;
12179 operands[9] = GEN_INT (xorv);
12180 operands[10] = GEN_INT (sextc);
12183 (define_insn "*cmpsi_internal2"
12184 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
12185 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
12186 (match_operand:SI 2 "reg_or_u_short_operand" "rK")))]
12188 "{cmpl%I2|cmplw%I2} %0,%1,%b2"
12189 [(set_attr "type" "cmp")])
12191 (define_insn "*cmpdi_internal2"
12192 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
12193 (compare:CCUNS (match_operand:DI 1 "gpc_reg_operand" "r")
12194 (match_operand:DI 2 "reg_or_u_short_operand" "rK")))]
12196 "cmpld%I2 %0,%1,%b2"
12197 [(set_attr "type" "cmp")])
12199 ;; The following two insns don't exist as single insns, but if we provide
12200 ;; them, we can swap an add and compare, which will enable us to overlap more
12201 ;; of the required delay between a compare and branch. We generate code for
12202 ;; them by splitting.
12205 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
12206 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
12207 (match_operand:SI 2 "short_cint_operand" "i")))
12208 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
12209 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
12212 [(set_attr "length" "8")])
12215 [(set (match_operand:CCUNS 3 "cc_reg_operand" "=y")
12216 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
12217 (match_operand:SI 2 "u_short_cint_operand" "i")))
12218 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
12219 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
12222 [(set_attr "length" "8")])
12225 [(set (match_operand:CC 3 "cc_reg_operand" "")
12226 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
12227 (match_operand:SI 2 "short_cint_operand" "")))
12228 (set (match_operand:SI 0 "gpc_reg_operand" "")
12229 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
12231 [(set (match_dup 3) (compare:CC (match_dup 1) (match_dup 2)))
12232 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
12235 [(set (match_operand:CCUNS 3 "cc_reg_operand" "")
12236 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "")
12237 (match_operand:SI 2 "u_short_cint_operand" "")))
12238 (set (match_operand:SI 0 "gpc_reg_operand" "")
12239 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
12241 [(set (match_dup 3) (compare:CCUNS (match_dup 1) (match_dup 2)))
12242 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
12244 (define_insn "*cmpsf_internal1"
12245 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
12246 (compare:CCFP (match_operand:SF 1 "gpc_reg_operand" "f")
12247 (match_operand:SF 2 "gpc_reg_operand" "f")))]
12248 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
12250 [(set_attr "type" "fpcompare")])
12252 (define_insn "*cmpdf_internal1"
12253 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
12254 (compare:CCFP (match_operand:DF 1 "gpc_reg_operand" "f")
12255 (match_operand:DF 2 "gpc_reg_operand" "f")))]
12256 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
12258 [(set_attr "type" "fpcompare")])
12260 ;; Only need to compare second words if first words equal
12261 (define_insn "*cmptf_internal1"
12262 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
12263 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "f")
12264 (match_operand:TF 2 "gpc_reg_operand" "f")))]
12265 "!TARGET_IEEEQUAD && !TARGET_XL_COMPAT
12266 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LONG_DOUBLE_128"
12267 "fcmpu %0,%1,%2\;bne %0,$+8\;fcmpu %0,%L1,%L2"
12268 [(set_attr "type" "fpcompare")
12269 (set_attr "length" "12")])
12271 (define_insn_and_split "*cmptf_internal2"
12272 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
12273 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "f")
12274 (match_operand:TF 2 "gpc_reg_operand" "f")))
12275 (clobber (match_scratch:DF 3 "=f"))
12276 (clobber (match_scratch:DF 4 "=f"))
12277 (clobber (match_scratch:DF 5 "=f"))
12278 (clobber (match_scratch:DF 6 "=f"))
12279 (clobber (match_scratch:DF 7 "=f"))
12280 (clobber (match_scratch:DF 8 "=f"))
12281 (clobber (match_scratch:DF 9 "=f"))
12282 (clobber (match_scratch:DF 10 "=f"))]
12283 "!TARGET_IEEEQUAD && TARGET_XL_COMPAT
12284 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LONG_DOUBLE_128"
12286 "&& reload_completed"
12287 [(set (match_dup 3) (match_dup 13))
12288 (set (match_dup 4) (match_dup 14))
12289 (set (match_dup 9) (abs:DF (match_dup 5)))
12290 (set (match_dup 0) (compare:CCFP (match_dup 9) (match_dup 3)))
12291 (set (pc) (if_then_else (ne (match_dup 0) (const_int 0))
12292 (label_ref (match_dup 11))
12294 (set (match_dup 0) (compare:CCFP (match_dup 5) (match_dup 7)))
12295 (set (pc) (label_ref (match_dup 12)))
12297 (set (match_dup 10) (minus:DF (match_dup 5) (match_dup 7)))
12298 (set (match_dup 9) (minus:DF (match_dup 6) (match_dup 8)))
12299 (set (match_dup 9) (plus:DF (match_dup 10) (match_dup 9)))
12300 (set (match_dup 0) (compare:CCFP (match_dup 7) (match_dup 4)))
12303 REAL_VALUE_TYPE rv;
12304 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
12305 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
12307 operands[5] = simplify_gen_subreg (DFmode, operands[1], TFmode, hi_word);
12308 operands[6] = simplify_gen_subreg (DFmode, operands[1], TFmode, lo_word);
12309 operands[7] = simplify_gen_subreg (DFmode, operands[2], TFmode, hi_word);
12310 operands[8] = simplify_gen_subreg (DFmode, operands[2], TFmode, lo_word);
12311 operands[11] = gen_label_rtx ();
12312 operands[12] = gen_label_rtx ();
12314 operands[13] = force_const_mem (DFmode,
12315 CONST_DOUBLE_FROM_REAL_VALUE (rv, DFmode));
12316 operands[14] = force_const_mem (DFmode,
12317 CONST_DOUBLE_FROM_REAL_VALUE (dconst0,
12321 operands[13] = gen_const_mem (DFmode,
12322 create_TOC_reference (XEXP (operands[13], 0)));
12323 operands[14] = gen_const_mem (DFmode,
12324 create_TOC_reference (XEXP (operands[14], 0)));
12325 set_mem_alias_set (operands[13], get_TOC_alias_set ());
12326 set_mem_alias_set (operands[14], get_TOC_alias_set ());
12330 ;; Now we have the scc insns. We can do some combinations because of the
12331 ;; way the machine works.
12333 ;; Note that this is probably faster if we can put an insn between the
12334 ;; mfcr and rlinm, but this is tricky. Let's leave it for now. In most
12335 ;; cases the insns below which don't use an intermediate CR field will
12336 ;; be used instead.
12338 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12339 (match_operator:SI 1 "scc_comparison_operator"
12340 [(match_operand 2 "cc_reg_operand" "y")
12343 "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1"
12344 [(set (attr "type")
12345 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
12346 (const_string "mfcrf")
12348 (const_string "mfcr")))
12349 (set_attr "length" "8")])
12351 ;; Same as above, but get the GT bit.
12352 (define_insn "move_from_CR_gt_bit"
12353 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12354 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_GT))]
12355 "TARGET_HARD_FLOAT && !TARGET_FPRS"
12356 "mfcr %0\;{rlinm|rlwinm} %0,%0,%D1,31,31"
12357 [(set_attr "type" "mfcr")
12358 (set_attr "length" "8")])
12360 ;; Same as above, but get the OV/ORDERED bit.
12361 (define_insn "move_from_CR_ov_bit"
12362 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12363 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_OV))]
12365 "mfcr %0\;{rlinm|rlwinm} %0,%0,%t1,1"
12366 [(set_attr "type" "mfcr")
12367 (set_attr "length" "8")])
12370 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12371 (match_operator:DI 1 "scc_comparison_operator"
12372 [(match_operand 2 "cc_reg_operand" "y")
12375 "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1"
12376 [(set (attr "type")
12377 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
12378 (const_string "mfcrf")
12380 (const_string "mfcr")))
12381 (set_attr "length" "8")])
12384 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12385 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
12386 [(match_operand 2 "cc_reg_operand" "y,y")
12389 (set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
12390 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
12393 mfcr %3%Q2\;{rlinm.|rlwinm.} %3,%3,%J1,1
12395 [(set_attr "type" "delayed_compare")
12396 (set_attr "length" "8,16")])
12399 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12400 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
12401 [(match_operand 2 "cc_reg_operand" "")
12404 (set (match_operand:SI 3 "gpc_reg_operand" "")
12405 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
12406 "TARGET_32BIT && reload_completed"
12407 [(set (match_dup 3)
12408 (match_op_dup 1 [(match_dup 2) (const_int 0)]))
12410 (compare:CC (match_dup 3)
12415 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12416 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
12417 [(match_operand 2 "cc_reg_operand" "y")
12419 (match_operand:SI 3 "const_int_operand" "n")))]
12423 int is_bit = ccr_bit (operands[1], 1);
12424 int put_bit = 31 - (INTVAL (operands[3]) & 31);
12427 if (is_bit >= put_bit)
12428 count = is_bit - put_bit;
12430 count = 32 - (put_bit - is_bit);
12432 operands[4] = GEN_INT (count);
12433 operands[5] = GEN_INT (put_bit);
12435 return \"mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%4,%5,%5\";
12437 [(set (attr "type")
12438 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
12439 (const_string "mfcrf")
12441 (const_string "mfcr")))
12442 (set_attr "length" "8")])
12445 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12447 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
12448 [(match_operand 2 "cc_reg_operand" "y,y")
12450 (match_operand:SI 3 "const_int_operand" "n,n"))
12452 (set (match_operand:SI 4 "gpc_reg_operand" "=r,r")
12453 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
12458 int is_bit = ccr_bit (operands[1], 1);
12459 int put_bit = 31 - (INTVAL (operands[3]) & 31);
12462 /* Force split for non-cc0 compare. */
12463 if (which_alternative == 1)
12466 if (is_bit >= put_bit)
12467 count = is_bit - put_bit;
12469 count = 32 - (put_bit - is_bit);
12471 operands[5] = GEN_INT (count);
12472 operands[6] = GEN_INT (put_bit);
12474 return \"mfcr %4%Q2\;{rlinm.|rlwinm.} %4,%4,%5,%6,%6\";
12476 [(set_attr "type" "delayed_compare")
12477 (set_attr "length" "8,16")])
12480 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
12482 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
12483 [(match_operand 2 "cc_reg_operand" "")
12485 (match_operand:SI 3 "const_int_operand" ""))
12487 (set (match_operand:SI 4 "gpc_reg_operand" "")
12488 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
12491 [(set (match_dup 4)
12492 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
12495 (compare:CC (match_dup 4)
12499 ;; There is a 3 cycle delay between consecutive mfcr instructions
12500 ;; so it is useful to combine 2 scc instructions to use only one mfcr.
12503 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12504 (match_operator:SI 1 "scc_comparison_operator"
12505 [(match_operand 2 "cc_reg_operand" "y")
12507 (set (match_operand:SI 3 "gpc_reg_operand" "=r")
12508 (match_operator:SI 4 "scc_comparison_operator"
12509 [(match_operand 5 "cc_reg_operand" "y")
12511 "REGNO (operands[2]) != REGNO (operands[5])"
12512 "mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
12513 [(set_attr "type" "mfcr")
12514 (set_attr "length" "12")])
12517 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12518 (match_operator:DI 1 "scc_comparison_operator"
12519 [(match_operand 2 "cc_reg_operand" "y")
12521 (set (match_operand:DI 3 "gpc_reg_operand" "=r")
12522 (match_operator:DI 4 "scc_comparison_operator"
12523 [(match_operand 5 "cc_reg_operand" "y")
12525 "TARGET_POWERPC64 && REGNO (operands[2]) != REGNO (operands[5])"
12526 "mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
12527 [(set_attr "type" "mfcr")
12528 (set_attr "length" "12")])
12530 ;; There are some scc insns that can be done directly, without a compare.
12531 ;; These are faster because they don't involve the communications between
12532 ;; the FXU and branch units. In fact, we will be replacing all of the
12533 ;; integer scc insns here or in the portable methods in emit_store_flag.
12535 ;; Also support (neg (scc ..)) since that construct is used to replace
12536 ;; branches, (plus (scc ..) ..) since that construct is common and
12537 ;; takes no more insns than scc, and (and (neg (scc ..)) ..) in the
12538 ;; cases where it is no more expensive than (neg (scc ..)).
12540 ;; Have reload force a constant into a register for the simple insns that
12541 ;; otherwise won't accept constants. We do this because it is faster than
12542 ;; the cmp/mfcr sequence we would otherwise generate.
12544 (define_mode_attr scc_eq_op2 [(SI "rKLI")
12547 (define_insn_and_split "*eq<mode>"
12548 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
12549 (eq:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
12550 (match_operand:GPR 2 "scc_eq_operand" "<scc_eq_op2>")))]
12554 [(set (match_dup 0)
12555 (clz:GPR (match_dup 3)))
12557 (lshiftrt:GPR (match_dup 0) (match_dup 4)))]
12559 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
12561 /* Use output operand as intermediate. */
12562 operands[3] = operands[0];
12564 if (logical_operand (operands[2], <MODE>mode))
12565 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
12566 gen_rtx_XOR (<MODE>mode,
12567 operands[1], operands[2])));
12569 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
12570 gen_rtx_PLUS (<MODE>mode, operands[1],
12571 negate_rtx (<MODE>mode,
12575 operands[3] = operands[1];
12577 operands[4] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
12580 (define_insn_and_split "*eq<mode>_compare"
12581 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
12583 (eq:P (match_operand:P 1 "gpc_reg_operand" "=r")
12584 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))
12586 (set (match_operand:P 0 "gpc_reg_operand" "=r")
12587 (eq:P (match_dup 1) (match_dup 2)))]
12588 "!TARGET_POWER && optimize_size"
12590 "!TARGET_POWER && optimize_size"
12591 [(set (match_dup 0)
12592 (clz:P (match_dup 4)))
12593 (parallel [(set (match_dup 3)
12594 (compare:CC (lshiftrt:P (match_dup 0) (match_dup 5))
12597 (lshiftrt:P (match_dup 0) (match_dup 5)))])]
12599 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
12601 /* Use output operand as intermediate. */
12602 operands[4] = operands[0];
12604 if (logical_operand (operands[2], <MODE>mode))
12605 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
12606 gen_rtx_XOR (<MODE>mode,
12607 operands[1], operands[2])));
12609 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
12610 gen_rtx_PLUS (<MODE>mode, operands[1],
12611 negate_rtx (<MODE>mode,
12615 operands[4] = operands[1];
12617 operands[5] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
12620 (define_insn "*eqsi_power"
12621 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
12622 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
12623 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I")))
12624 (clobber (match_scratch:SI 3 "=r,&r,r,r,r"))]
12627 xor %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
12628 {sfi|subfic} %3,%1,0\;{ae|adde} %0,%3,%1
12629 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
12630 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
12631 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0"
12632 [(set_attr "type" "three,two,three,three,three")
12633 (set_attr "length" "12,8,12,12,12")])
12635 ;; We have insns of the form shown by the first define_insn below. If
12636 ;; there is something inside the comparison operation, we must split it.
12638 [(set (match_operand:SI 0 "gpc_reg_operand" "")
12639 (plus:SI (match_operator 1 "comparison_operator"
12640 [(match_operand:SI 2 "" "")
12641 (match_operand:SI 3
12642 "reg_or_cint_operand" "")])
12643 (match_operand:SI 4 "gpc_reg_operand" "")))
12644 (clobber (match_operand:SI 5 "register_operand" ""))]
12645 "! gpc_reg_operand (operands[2], SImode)"
12646 [(set (match_dup 5) (match_dup 2))
12647 (set (match_dup 2) (plus:SI (match_op_dup 1 [(match_dup 2) (match_dup 3)])
12650 (define_insn "*plus_eqsi"
12651 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r")
12652 (plus:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
12653 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I"))
12654 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r")))]
12657 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
12658 {sfi|subfic} %0,%1,0\;{aze|addze} %0,%3
12659 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
12660 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
12661 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
12662 [(set_attr "type" "three,two,three,three,three")
12663 (set_attr "length" "12,8,12,12,12")])
12665 (define_insn "*compare_plus_eqsi"
12666 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
12669 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
12670 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
12671 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
12673 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r"))]
12674 "TARGET_32BIT && optimize_size"
12676 xor %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12677 {sfi|subfic} %4,%1,0\;{aze.|addze.} %4,%3
12678 {xoril|xori} %4,%1,%b2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12679 {xoriu|xoris} %4,%1,%u2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12680 {sfi|subfic} %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12686 [(set_attr "type" "compare")
12687 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
12690 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12693 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
12694 (match_operand:SI 2 "scc_eq_operand" ""))
12695 (match_operand:SI 3 "gpc_reg_operand" ""))
12697 (clobber (match_scratch:SI 4 ""))]
12698 "TARGET_32BIT && optimize_size && reload_completed"
12699 [(set (match_dup 4)
12700 (plus:SI (eq:SI (match_dup 1)
12704 (compare:CC (match_dup 4)
12708 (define_insn "*plus_eqsi_compare"
12709 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
12712 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
12713 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
12714 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
12716 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r")
12717 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12718 "TARGET_32BIT && optimize_size"
12720 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12721 {sfi|subfic} %0,%1,0\;{aze.|addze.} %0,%3
12722 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12723 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12724 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12730 [(set_attr "type" "compare")
12731 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
12734 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12737 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
12738 (match_operand:SI 2 "scc_eq_operand" ""))
12739 (match_operand:SI 3 "gpc_reg_operand" ""))
12741 (set (match_operand:SI 0 "gpc_reg_operand" "")
12742 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12743 "TARGET_32BIT && optimize_size && reload_completed"
12744 [(set (match_dup 0)
12745 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12747 (compare:CC (match_dup 0)
12751 (define_insn "*neg_eq0<mode>"
12752 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
12753 (neg:P (eq:P (match_operand:P 1 "gpc_reg_operand" "r")
12756 "{ai|addic} %0,%1,-1\;{sfe|subfe} %0,%0,%0"
12757 [(set_attr "type" "two")
12758 (set_attr "length" "8")])
12760 (define_insn_and_split "*neg_eq<mode>"
12761 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
12762 (neg:P (eq:P (match_operand:P 1 "gpc_reg_operand" "%r")
12763 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))))]
12767 [(set (match_dup 0) (neg:P (eq:P (match_dup 3) (const_int 0))))]
12769 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
12771 /* Use output operand as intermediate. */
12772 operands[3] = operands[0];
12774 if (logical_operand (operands[2], <MODE>mode))
12775 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
12776 gen_rtx_XOR (<MODE>mode,
12777 operands[1], operands[2])));
12779 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
12780 gen_rtx_PLUS (<MODE>mode, operands[1],
12781 negate_rtx (<MODE>mode,
12785 operands[3] = operands[1];
12788 ;; Simplify (ne X (const_int 0)) on the PowerPC. No need to on the Power,
12789 ;; since it nabs/sr is just as fast.
12790 (define_insn "*ne0si"
12791 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12792 (lshiftrt:SI (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
12794 (clobber (match_scratch:SI 2 "=&r"))]
12795 "! TARGET_POWER && TARGET_32BIT && !TARGET_ISEL"
12796 "{ai|addic} %2,%1,-1\;{sfe|subfe} %0,%2,%1"
12797 [(set_attr "type" "two")
12798 (set_attr "length" "8")])
12800 (define_insn "*ne0di"
12801 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12802 (lshiftrt:DI (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
12804 (clobber (match_scratch:DI 2 "=&r"))]
12806 "addic %2,%1,-1\;subfe %0,%2,%1"
12807 [(set_attr "type" "two")
12808 (set_attr "length" "8")])
12810 ;; This is what (plus (ne X (const_int 0)) Y) looks like.
12811 (define_insn "*plus_ne0si"
12812 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12813 (plus:SI (lshiftrt:SI
12814 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
12816 (match_operand:SI 2 "gpc_reg_operand" "r")))
12817 (clobber (match_scratch:SI 3 "=&r"))]
12819 "{ai|addic} %3,%1,-1\;{aze|addze} %0,%2"
12820 [(set_attr "type" "two")
12821 (set_attr "length" "8")])
12823 (define_insn "*plus_ne0di"
12824 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12825 (plus:DI (lshiftrt:DI
12826 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
12828 (match_operand:DI 2 "gpc_reg_operand" "r")))
12829 (clobber (match_scratch:DI 3 "=&r"))]
12831 "addic %3,%1,-1\;addze %0,%2"
12832 [(set_attr "type" "two")
12833 (set_attr "length" "8")])
12835 (define_insn "*compare_plus_ne0si"
12836 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12838 (plus:SI (lshiftrt:SI
12839 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
12841 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
12843 (clobber (match_scratch:SI 3 "=&r,&r"))
12844 (clobber (match_scratch:SI 4 "=X,&r"))]
12847 {ai|addic} %3,%1,-1\;{aze.|addze.} %3,%2
12849 [(set_attr "type" "compare")
12850 (set_attr "length" "8,12")])
12853 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12855 (plus:SI (lshiftrt:SI
12856 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
12858 (match_operand:SI 2 "gpc_reg_operand" ""))
12860 (clobber (match_scratch:SI 3 ""))
12861 (clobber (match_scratch:SI 4 ""))]
12862 "TARGET_32BIT && reload_completed"
12863 [(parallel [(set (match_dup 3)
12864 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1)))
12867 (clobber (match_dup 4))])
12869 (compare:CC (match_dup 3)
12873 (define_insn "*compare_plus_ne0di"
12874 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12876 (plus:DI (lshiftrt:DI
12877 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
12879 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
12881 (clobber (match_scratch:DI 3 "=&r,&r"))]
12884 addic %3,%1,-1\;addze. %3,%2
12886 [(set_attr "type" "compare")
12887 (set_attr "length" "8,12")])
12890 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
12892 (plus:DI (lshiftrt:DI
12893 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
12895 (match_operand:DI 2 "gpc_reg_operand" ""))
12897 (clobber (match_scratch:DI 3 ""))]
12898 "TARGET_64BIT && reload_completed"
12899 [(set (match_dup 3)
12900 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1)))
12904 (compare:CC (match_dup 3)
12908 (define_insn "*plus_ne0si_compare"
12909 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12911 (plus:SI (lshiftrt:SI
12912 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
12914 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
12916 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12917 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
12919 (clobber (match_scratch:SI 3 "=&r,&r"))]
12922 {ai|addic} %3,%1,-1\;{aze.|addze.} %0,%2
12924 [(set_attr "type" "compare")
12925 (set_attr "length" "8,12")])
12928 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12930 (plus:SI (lshiftrt:SI
12931 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
12933 (match_operand:SI 2 "gpc_reg_operand" ""))
12935 (set (match_operand:SI 0 "gpc_reg_operand" "")
12936 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
12938 (clobber (match_scratch:SI 3 ""))]
12939 "TARGET_32BIT && reload_completed"
12940 [(parallel [(set (match_dup 0)
12941 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
12943 (clobber (match_dup 3))])
12945 (compare:CC (match_dup 0)
12949 (define_insn "*plus_ne0di_compare"
12950 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12952 (plus:DI (lshiftrt:DI
12953 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
12955 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
12957 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
12958 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
12960 (clobber (match_scratch:DI 3 "=&r,&r"))]
12963 addic %3,%1,-1\;addze. %0,%2
12965 [(set_attr "type" "compare")
12966 (set_attr "length" "8,12")])
12969 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
12971 (plus:DI (lshiftrt:DI
12972 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
12974 (match_operand:DI 2 "gpc_reg_operand" ""))
12976 (set (match_operand:DI 0 "gpc_reg_operand" "")
12977 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
12979 (clobber (match_scratch:DI 3 ""))]
12980 "TARGET_64BIT && reload_completed"
12981 [(parallel [(set (match_dup 0)
12982 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
12984 (clobber (match_dup 3))])
12986 (compare:CC (match_dup 0)
12991 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12992 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12993 (match_operand:SI 2 "reg_or_short_operand" "r,O")))
12994 (clobber (match_scratch:SI 3 "=r,X"))]
12997 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3
12998 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri|srwi} %0,%0,31"
12999 [(set_attr "length" "12")])
13002 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13004 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13005 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
13007 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
13008 (le:SI (match_dup 1) (match_dup 2)))
13009 (clobber (match_scratch:SI 3 "=r,X,r,X"))]
13012 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
13013 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri.|srwi.} %0,%0,31
13016 [(set_attr "type" "compare,delayed_compare,compare,delayed_compare")
13017 (set_attr "length" "12,12,16,16")])
13020 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13022 (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
13023 (match_operand:SI 2 "reg_or_short_operand" ""))
13025 (set (match_operand:SI 0 "gpc_reg_operand" "")
13026 (le:SI (match_dup 1) (match_dup 2)))
13027 (clobber (match_scratch:SI 3 ""))]
13028 "TARGET_POWER && reload_completed"
13029 [(parallel [(set (match_dup 0)
13030 (le:SI (match_dup 1) (match_dup 2)))
13031 (clobber (match_dup 3))])
13033 (compare:CC (match_dup 0)
13038 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13039 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13040 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
13041 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
13044 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
13045 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze|addze} %0,%3"
13046 [(set_attr "length" "12")])
13049 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13051 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13052 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
13053 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13055 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
13058 doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
13059 {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze.|addze.} %4,%3
13062 [(set_attr "type" "compare")
13063 (set_attr "length" "12,12,16,16")])
13066 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13068 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
13069 (match_operand:SI 2 "reg_or_short_operand" ""))
13070 (match_operand:SI 3 "gpc_reg_operand" ""))
13072 (clobber (match_scratch:SI 4 ""))]
13073 "TARGET_POWER && reload_completed"
13074 [(set (match_dup 4)
13075 (plus:SI (le:SI (match_dup 1) (match_dup 2))
13078 (compare:CC (match_dup 4)
13083 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13085 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13086 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
13087 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13089 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13090 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13093 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
13094 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze.|addze.} %0,%3
13097 [(set_attr "type" "compare")
13098 (set_attr "length" "12,12,16,16")])
13101 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13103 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
13104 (match_operand:SI 2 "reg_or_short_operand" ""))
13105 (match_operand:SI 3 "gpc_reg_operand" ""))
13107 (set (match_operand:SI 0 "gpc_reg_operand" "")
13108 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13109 "TARGET_POWER && reload_completed"
13110 [(set (match_dup 0)
13111 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13113 (compare:CC (match_dup 0)
13118 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13119 (neg:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13120 (match_operand:SI 2 "reg_or_short_operand" "r,O"))))]
13123 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
13124 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{srai|srawi} %0,%0,31"
13125 [(set_attr "length" "12")])
13127 (define_insn "*leu<mode>"
13128 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13129 (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
13130 (match_operand:P 2 "reg_or_short_operand" "rI")))]
13132 "{sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
13133 [(set_attr "type" "three")
13134 (set_attr "length" "12")])
13136 (define_insn "*leu<mode>_compare"
13137 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13139 (leu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13140 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
13142 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13143 (leu:P (match_dup 1) (match_dup 2)))]
13146 {sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
13148 [(set_attr "type" "compare")
13149 (set_attr "length" "12,16")])
13152 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13154 (leu:P (match_operand:P 1 "gpc_reg_operand" "")
13155 (match_operand:P 2 "reg_or_short_operand" ""))
13157 (set (match_operand:P 0 "gpc_reg_operand" "")
13158 (leu:P (match_dup 1) (match_dup 2)))]
13160 [(set (match_dup 0)
13161 (leu:P (match_dup 1) (match_dup 2)))
13163 (compare:CC (match_dup 0)
13167 (define_insn "*plus_leu<mode>"
13168 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
13169 (plus:P (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
13170 (match_operand:P 2 "reg_or_short_operand" "rI"))
13171 (match_operand:P 3 "gpc_reg_operand" "r")))]
13173 "{sf%I2|subf%I2c} %0,%1,%2\;{aze|addze} %0,%3"
13174 [(set_attr "type" "two")
13175 (set_attr "length" "8")])
13178 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13180 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13181 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13182 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13184 (clobber (match_scratch:SI 4 "=&r,&r"))]
13187 {sf%I2|subf%I2c} %4,%1,%2\;{aze.|addze.} %4,%3
13189 [(set_attr "type" "compare")
13190 (set_attr "length" "8,12")])
13193 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13195 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13196 (match_operand:SI 2 "reg_or_short_operand" ""))
13197 (match_operand:SI 3 "gpc_reg_operand" ""))
13199 (clobber (match_scratch:SI 4 ""))]
13200 "TARGET_32BIT && reload_completed"
13201 [(set (match_dup 4)
13202 (plus:SI (leu:SI (match_dup 1) (match_dup 2))
13205 (compare:CC (match_dup 4)
13210 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13212 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13213 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13214 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13216 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13217 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13220 {sf%I2|subf%I2c} %0,%1,%2\;{aze.|addze.} %0,%3
13222 [(set_attr "type" "compare")
13223 (set_attr "length" "8,12")])
13226 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13228 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13229 (match_operand:SI 2 "reg_or_short_operand" ""))
13230 (match_operand:SI 3 "gpc_reg_operand" ""))
13232 (set (match_operand:SI 0 "gpc_reg_operand" "")
13233 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13234 "TARGET_32BIT && reload_completed"
13235 [(set (match_dup 0)
13236 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13238 (compare:CC (match_dup 0)
13242 (define_insn "*neg_leu<mode>"
13243 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13244 (neg:P (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
13245 (match_operand:P 2 "reg_or_short_operand" "rI"))))]
13247 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0"
13248 [(set_attr "type" "three")
13249 (set_attr "length" "12")])
13251 (define_insn "*and_neg_leu<mode>"
13252 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
13254 (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
13255 (match_operand:P 2 "reg_or_short_operand" "rI")))
13256 (match_operand:P 3 "gpc_reg_operand" "r")))]
13258 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
13259 [(set_attr "type" "three")
13260 (set_attr "length" "12")])
13263 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13266 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13267 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
13268 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13270 (clobber (match_scratch:SI 4 "=&r,&r"))]
13273 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
13275 [(set_attr "type" "compare")
13276 (set_attr "length" "12,16")])
13279 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13282 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13283 (match_operand:SI 2 "reg_or_short_operand" "")))
13284 (match_operand:SI 3 "gpc_reg_operand" ""))
13286 (clobber (match_scratch:SI 4 ""))]
13287 "TARGET_32BIT && reload_completed"
13288 [(set (match_dup 4)
13289 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
13292 (compare:CC (match_dup 4)
13297 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13300 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13301 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
13302 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13304 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13305 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13308 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
13310 [(set_attr "type" "compare")
13311 (set_attr "length" "12,16")])
13314 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13317 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13318 (match_operand:SI 2 "reg_or_short_operand" "")))
13319 (match_operand:SI 3 "gpc_reg_operand" ""))
13321 (set (match_operand:SI 0 "gpc_reg_operand" "")
13322 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13323 "TARGET_32BIT && reload_completed"
13324 [(set (match_dup 0)
13325 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
13328 (compare:CC (match_dup 0)
13333 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13334 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13335 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
13337 "doz%I2 %0,%1,%2\;nabs %0,%0\;{sri|srwi} %0,%0,31"
13338 [(set_attr "length" "12")])
13341 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13343 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13344 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13346 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13347 (lt:SI (match_dup 1) (match_dup 2)))]
13350 doz%I2 %0,%1,%2\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
13352 [(set_attr "type" "delayed_compare")
13353 (set_attr "length" "12,16")])
13356 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13358 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13359 (match_operand:SI 2 "reg_or_short_operand" ""))
13361 (set (match_operand:SI 0 "gpc_reg_operand" "")
13362 (lt:SI (match_dup 1) (match_dup 2)))]
13363 "TARGET_POWER && reload_completed"
13364 [(set (match_dup 0)
13365 (lt:SI (match_dup 1) (match_dup 2)))
13367 (compare:CC (match_dup 0)
13372 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
13373 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13374 (match_operand:SI 2 "reg_or_short_operand" "rI"))
13375 (match_operand:SI 3 "gpc_reg_operand" "r")))]
13377 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
13378 [(set_attr "length" "12")])
13381 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13383 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13384 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13385 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13387 (clobber (match_scratch:SI 4 "=&r,&r"))]
13390 doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
13392 [(set_attr "type" "compare")
13393 (set_attr "length" "12,16")])
13396 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13398 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13399 (match_operand:SI 2 "reg_or_short_operand" ""))
13400 (match_operand:SI 3 "gpc_reg_operand" ""))
13402 (clobber (match_scratch:SI 4 ""))]
13403 "TARGET_POWER && reload_completed"
13404 [(set (match_dup 4)
13405 (plus:SI (lt:SI (match_dup 1) (match_dup 2))
13408 (compare:CC (match_dup 4)
13413 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13415 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13416 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13417 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13419 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13420 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13423 doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
13425 [(set_attr "type" "compare")
13426 (set_attr "length" "12,16")])
13429 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13431 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13432 (match_operand:SI 2 "reg_or_short_operand" ""))
13433 (match_operand:SI 3 "gpc_reg_operand" ""))
13435 (set (match_operand:SI 0 "gpc_reg_operand" "")
13436 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13437 "TARGET_POWER && reload_completed"
13438 [(set (match_dup 0)
13439 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13441 (compare:CC (match_dup 0)
13446 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13447 (neg:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13448 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
13450 "doz%I2 %0,%1,%2\;nabs %0,%0\;{srai|srawi} %0,%0,31"
13451 [(set_attr "length" "12")])
13453 (define_insn_and_split "*ltu<mode>"
13454 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13455 (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13456 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))]
13460 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
13461 (set (match_dup 0) (neg:P (match_dup 0)))]
13464 (define_insn_and_split "*ltu<mode>_compare"
13465 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
13467 (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
13468 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
13470 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
13471 (ltu:P (match_dup 1) (match_dup 2)))]
13475 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
13476 (parallel [(set (match_dup 3)
13477 (compare:CC (neg:P (match_dup 0)) (const_int 0)))
13478 (set (match_dup 0) (neg:P (match_dup 0)))])]
13481 (define_insn_and_split "*plus_ltu<mode>"
13482 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,r")
13483 (plus:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13484 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))
13485 (match_operand:P 3 "reg_or_short_operand" "rI,rI")))]
13488 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13489 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
13490 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))]
13493 (define_insn_and_split "*plus_ltu<mode>_compare"
13494 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13496 (plus:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
13497 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
13498 (match_operand:P 3 "gpc_reg_operand" "r,r,r,r"))
13500 (set (match_operand:P 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13501 (plus:P (ltu:P (match_dup 1) (match_dup 2)) (match_dup 3)))]
13504 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13505 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
13506 (parallel [(set (match_dup 4)
13507 (compare:CC (minus:P (match_dup 3) (match_dup 0))
13509 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))])]
13512 (define_insn "*neg_ltu<mode>"
13513 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13514 (neg:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13515 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))))]
13518 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0
13519 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0"
13520 [(set_attr "type" "two")
13521 (set_attr "length" "8")])
13524 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13525 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13526 (match_operand:SI 2 "reg_or_short_operand" "rI")))
13527 (clobber (match_scratch:SI 3 "=r"))]
13529 "doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3"
13530 [(set_attr "length" "12")])
13533 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13535 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13536 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13538 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13539 (ge:SI (match_dup 1) (match_dup 2)))
13540 (clobber (match_scratch:SI 3 "=r,r"))]
13543 doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
13545 [(set_attr "type" "compare")
13546 (set_attr "length" "12,16")])
13549 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13551 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
13552 (match_operand:SI 2 "reg_or_short_operand" ""))
13554 (set (match_operand:SI 0 "gpc_reg_operand" "")
13555 (ge:SI (match_dup 1) (match_dup 2)))
13556 (clobber (match_scratch:SI 3 ""))]
13557 "TARGET_POWER && reload_completed"
13558 [(parallel [(set (match_dup 0)
13559 (ge:SI (match_dup 1) (match_dup 2)))
13560 (clobber (match_dup 3))])
13562 (compare:CC (match_dup 0)
13567 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
13568 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13569 (match_operand:SI 2 "reg_or_short_operand" "rI"))
13570 (match_operand:SI 3 "gpc_reg_operand" "r")))]
13572 "doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
13573 [(set_attr "length" "12")])
13576 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13578 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13579 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13580 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13582 (clobber (match_scratch:SI 4 "=&r,&r"))]
13585 doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
13587 [(set_attr "type" "compare")
13588 (set_attr "length" "12,16")])
13591 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13593 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
13594 (match_operand:SI 2 "reg_or_short_operand" ""))
13595 (match_operand:SI 3 "gpc_reg_operand" ""))
13597 (clobber (match_scratch:SI 4 ""))]
13598 "TARGET_POWER && reload_completed"
13599 [(set (match_dup 4)
13600 (plus:SI (ge:SI (match_dup 1) (match_dup 2))
13603 (compare:CC (match_dup 4)
13608 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13610 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13611 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13612 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13614 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13615 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13618 doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
13620 [(set_attr "type" "compare")
13621 (set_attr "length" "12,16")])
13624 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13626 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
13627 (match_operand:SI 2 "reg_or_short_operand" ""))
13628 (match_operand:SI 3 "gpc_reg_operand" ""))
13630 (set (match_operand:SI 0 "gpc_reg_operand" "")
13631 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13632 "TARGET_POWER && reload_completed"
13633 [(set (match_dup 0)
13634 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13636 (compare:CC (match_dup 0)
13641 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13642 (neg:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13643 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
13645 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
13646 [(set_attr "length" "12")])
13648 (define_insn "*geu<mode>"
13649 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13650 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13651 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))]
13654 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0
13655 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
13656 [(set_attr "type" "three")
13657 (set_attr "length" "12")])
13659 (define_insn "*geu<mode>_compare"
13660 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
13662 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
13663 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
13665 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
13666 (geu:P (match_dup 1) (match_dup 2)))]
13669 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
13670 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
13673 [(set_attr "type" "compare")
13674 (set_attr "length" "12,12,16,16")])
13677 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
13679 (geu:P (match_operand:P 1 "gpc_reg_operand" "")
13680 (match_operand:P 2 "reg_or_neg_short_operand" ""))
13682 (set (match_operand:P 0 "gpc_reg_operand" "")
13683 (geu:P (match_dup 1) (match_dup 2)))]
13685 [(set (match_dup 0)
13686 (geu:P (match_dup 1) (match_dup 2)))
13688 (compare:CC (match_dup 0)
13692 (define_insn "*plus_geu<mode>"
13693 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,&r")
13694 (plus:P (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13695 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))
13696 (match_operand:P 3 "gpc_reg_operand" "r,r")))]
13699 {sf|subfc} %0,%2,%1\;{aze|addze} %0,%3
13700 {ai|addic} %0,%1,%n2\;{aze|addze} %0,%3"
13701 [(set_attr "type" "two")
13702 (set_attr "length" "8")])
13705 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13707 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13708 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
13709 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13711 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
13714 {sf|subfc} %4,%2,%1\;{aze.|addze.} %4,%3
13715 {ai|addic} %4,%1,%n2\;{aze.|addze.} %4,%3
13718 [(set_attr "type" "compare")
13719 (set_attr "length" "8,8,12,12")])
13722 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13724 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13725 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
13726 (match_operand:SI 3 "gpc_reg_operand" ""))
13728 (clobber (match_scratch:SI 4 ""))]
13729 "TARGET_32BIT && reload_completed"
13730 [(set (match_dup 4)
13731 (plus:SI (geu:SI (match_dup 1) (match_dup 2))
13734 (compare:CC (match_dup 4)
13739 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13741 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13742 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
13743 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13745 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13746 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13749 {sf|subfc} %0,%2,%1\;{aze.|addze.} %0,%3
13750 {ai|addic} %0,%1,%n2\;{aze.|addze.} %0,%3
13753 [(set_attr "type" "compare")
13754 (set_attr "length" "8,8,12,12")])
13757 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13759 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13760 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
13761 (match_operand:SI 3 "gpc_reg_operand" ""))
13763 (set (match_operand:SI 0 "gpc_reg_operand" "")
13764 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13765 "TARGET_32BIT && reload_completed"
13766 [(set (match_dup 0)
13767 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13769 (compare:CC (match_dup 0)
13773 (define_insn "*neg_geu<mode>"
13774 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13775 (neg:P (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13776 (match_operand:P 2 "reg_or_short_operand" "r,I"))))]
13779 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0
13780 {sfi|subfic} %0,%1,-1\;{a%I2|add%I2c} %0,%0,%2\;{sfe|subfe} %0,%0,%0"
13781 [(set_attr "type" "three")
13782 (set_attr "length" "12")])
13784 (define_insn "*and_neg_geu<mode>"
13785 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,&r")
13787 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13788 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))
13789 (match_operand:P 3 "gpc_reg_operand" "r,r")))]
13792 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0
13793 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
13794 [(set_attr "type" "three")
13795 (set_attr "length" "12")])
13798 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13801 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13802 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
13803 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13805 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
13808 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
13809 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
13812 [(set_attr "type" "compare")
13813 (set_attr "length" "12,12,16,16")])
13816 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13819 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13820 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
13821 (match_operand:SI 3 "gpc_reg_operand" ""))
13823 (clobber (match_scratch:SI 4 ""))]
13824 "TARGET_32BIT && reload_completed"
13825 [(set (match_dup 4)
13826 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2)))
13829 (compare:CC (match_dup 4)
13834 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13837 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13838 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
13839 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13841 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13842 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13845 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
13846 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
13849 [(set_attr "type" "compare")
13850 (set_attr "length" "12,12,16,16")])
13853 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13856 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13857 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
13858 (match_operand:SI 3 "gpc_reg_operand" ""))
13860 (set (match_operand:SI 0 "gpc_reg_operand" "")
13861 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13862 "TARGET_32BIT && reload_completed"
13863 [(set (match_dup 0)
13864 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
13866 (compare:CC (match_dup 0)
13871 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13872 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13873 (match_operand:SI 2 "reg_or_short_operand" "r")))]
13875 "doz %0,%2,%1\;nabs %0,%0\;{sri|srwi} %0,%0,31"
13876 [(set_attr "length" "12")])
13879 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13881 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13882 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
13884 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13885 (gt:SI (match_dup 1) (match_dup 2)))]
13888 doz %0,%2,%1\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
13890 [(set_attr "type" "delayed_compare")
13891 (set_attr "length" "12,16")])
13894 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13896 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13897 (match_operand:SI 2 "reg_or_short_operand" ""))
13899 (set (match_operand:SI 0 "gpc_reg_operand" "")
13900 (gt:SI (match_dup 1) (match_dup 2)))]
13901 "TARGET_POWER && reload_completed"
13902 [(set (match_dup 0)
13903 (gt:SI (match_dup 1) (match_dup 2)))
13905 (compare:CC (match_dup 0)
13909 (define_insn "*plus_gt0<mode>"
13910 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
13911 (plus:P (gt:P (match_operand:P 1 "gpc_reg_operand" "r")
13913 (match_operand:P 2 "gpc_reg_operand" "r")))]
13915 "{a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze|addze} %0,%2"
13916 [(set_attr "type" "three")
13917 (set_attr "length" "12")])
13920 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13922 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13924 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
13926 (clobber (match_scratch:SI 3 "=&r,&r"))]
13929 {a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze.|addze.} %3,%2
13931 [(set_attr "type" "compare")
13932 (set_attr "length" "12,16")])
13935 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13937 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13939 (match_operand:SI 2 "gpc_reg_operand" ""))
13941 (clobber (match_scratch:SI 3 ""))]
13942 "TARGET_32BIT && reload_completed"
13943 [(set (match_dup 3)
13944 (plus:SI (gt:SI (match_dup 1) (const_int 0))
13947 (compare:CC (match_dup 3)
13952 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13954 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13956 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
13958 (clobber (match_scratch:DI 3 "=&r,&r"))]
13961 addc %3,%1,%1\;subfe %3,%1,%3\;addze. %3,%2
13963 [(set_attr "type" "compare")
13964 (set_attr "length" "12,16")])
13967 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
13969 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
13971 (match_operand:DI 2 "gpc_reg_operand" ""))
13973 (clobber (match_scratch:DI 3 ""))]
13974 "TARGET_64BIT && reload_completed"
13975 [(set (match_dup 3)
13976 (plus:DI (gt:DI (match_dup 1) (const_int 0))
13979 (compare:CC (match_dup 3)
13984 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13986 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13988 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
13990 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13991 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
13994 {a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze.|addze.} %0,%2
13996 [(set_attr "type" "compare")
13997 (set_attr "length" "12,16")])
14000 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
14002 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14004 (match_operand:SI 2 "gpc_reg_operand" ""))
14006 (set (match_operand:SI 0 "gpc_reg_operand" "")
14007 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
14008 "TARGET_32BIT && reload_completed"
14009 [(set (match_dup 0)
14010 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))
14012 (compare:CC (match_dup 0)
14017 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
14019 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
14021 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
14023 (set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
14024 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
14027 addc %0,%1,%1\;subfe %0,%1,%0\;addze. %0,%2
14029 [(set_attr "type" "compare")
14030 (set_attr "length" "12,16")])
14033 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
14035 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
14037 (match_operand:DI 2 "gpc_reg_operand" ""))
14039 (set (match_operand:DI 0 "gpc_reg_operand" "")
14040 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
14041 "TARGET_64BIT && reload_completed"
14042 [(set (match_dup 0)
14043 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))
14045 (compare:CC (match_dup 0)
14050 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
14051 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14052 (match_operand:SI 2 "reg_or_short_operand" "r"))
14053 (match_operand:SI 3 "gpc_reg_operand" "r")))]
14055 "doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
14056 [(set_attr "length" "12")])
14059 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
14061 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14062 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
14063 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14065 (clobber (match_scratch:SI 4 "=&r,&r"))]
14068 doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
14070 [(set_attr "type" "compare")
14071 (set_attr "length" "12,16")])
14074 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14076 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14077 (match_operand:SI 2 "reg_or_short_operand" ""))
14078 (match_operand:SI 3 "gpc_reg_operand" ""))
14080 (clobber (match_scratch:SI 4 ""))]
14081 "TARGET_POWER && reload_completed"
14082 [(set (match_dup 4)
14083 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
14085 (compare:CC (match_dup 4)
14090 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
14092 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14093 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
14094 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14096 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
14097 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14100 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
14102 [(set_attr "type" "compare")
14103 (set_attr "length" "12,16")])
14106 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14108 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14109 (match_operand:SI 2 "reg_or_short_operand" ""))
14110 (match_operand:SI 3 "gpc_reg_operand" ""))
14112 (set (match_operand:SI 0 "gpc_reg_operand" "")
14113 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14114 "TARGET_POWER && reload_completed"
14115 [(set (match_dup 0)
14116 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
14118 (compare:CC (match_dup 0)
14123 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14124 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14125 (match_operand:SI 2 "reg_or_short_operand" "r"))))]
14127 "doz %0,%2,%1\;nabs %0,%0\;{srai|srawi} %0,%0,31"
14128 [(set_attr "length" "12")])
14130 (define_insn_and_split "*gtu<mode>"
14131 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
14132 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
14133 (match_operand:P 2 "reg_or_short_operand" "rI")))]
14137 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
14138 (set (match_dup 0) (neg:P (match_dup 0)))]
14141 (define_insn_and_split "*gtu<mode>_compare"
14142 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
14144 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14145 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
14147 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
14148 (gtu:P (match_dup 1) (match_dup 2)))]
14152 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
14153 (parallel [(set (match_dup 3)
14154 (compare:CC (neg:P (match_dup 0)) (const_int 0)))
14155 (set (match_dup 0) (neg:P (match_dup 0)))])]
14158 (define_insn_and_split "*plus_gtu<mode>"
14159 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
14160 (plus:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
14161 (match_operand:P 2 "reg_or_short_operand" "rI"))
14162 (match_operand:P 3 "reg_or_short_operand" "rI")))]
14165 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
14166 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
14167 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))]
14170 (define_insn_and_split "*plus_gtu<mode>_compare"
14171 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
14173 (plus:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
14174 (match_operand:P 2 "reg_or_short_operand" "I,r,I,r"))
14175 (match_operand:P 3 "gpc_reg_operand" "r,r,r,r"))
14177 (set (match_operand:P 0 "gpc_reg_operand" "=&r,&r,&r,&r")
14178 (plus:P (gtu:P (match_dup 1) (match_dup 2)) (match_dup 3)))]
14181 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
14182 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
14183 (parallel [(set (match_dup 4)
14184 (compare:CC (minus:P (match_dup 3) (match_dup 0))
14186 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))])]
14189 (define_insn "*neg_gtu<mode>"
14190 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
14191 (neg:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
14192 (match_operand:P 2 "reg_or_short_operand" "rI"))))]
14194 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0"
14195 [(set_attr "type" "two")
14196 (set_attr "length" "8")])
14199 ;; Define both directions of branch and return. If we need a reload
14200 ;; register, we'd rather use CR0 since it is much easier to copy a
14201 ;; register CC value to there.
14205 (if_then_else (match_operator 1 "branch_comparison_operator"
14207 "cc_reg_operand" "y")
14209 (label_ref (match_operand 0 "" ""))
14214 return output_cbranch (operands[1], \"%l0\", 0, insn);
14216 [(set_attr "type" "branch")])
14220 (if_then_else (match_operator 0 "branch_comparison_operator"
14222 "cc_reg_operand" "y")
14229 return output_cbranch (operands[0], NULL, 0, insn);
14231 [(set_attr "type" "jmpreg")
14232 (set_attr "length" "4")])
14236 (if_then_else (match_operator 1 "branch_comparison_operator"
14238 "cc_reg_operand" "y")
14241 (label_ref (match_operand 0 "" ""))))]
14245 return output_cbranch (operands[1], \"%l0\", 1, insn);
14247 [(set_attr "type" "branch")])
14251 (if_then_else (match_operator 0 "branch_comparison_operator"
14253 "cc_reg_operand" "y")
14260 return output_cbranch (operands[0], NULL, 1, insn);
14262 [(set_attr "type" "jmpreg")
14263 (set_attr "length" "4")])
14265 ;; Logic on condition register values.
14267 ; This pattern matches things like
14268 ; (set (reg:CCEQ 68) (compare:CCEQ (ior:SI (gt:SI (reg:CCFP 68) (const_int 0))
14269 ; (eq:SI (reg:CCFP 68) (const_int 0)))
14271 ; which are generated by the branch logic.
14272 ; Prefer destructive operations where BT = BB (for crXX BT,BA,BB)
14274 (define_insn "*cceq_ior_compare"
14275 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
14276 (compare:CCEQ (match_operator:SI 1 "boolean_operator"
14277 [(match_operator:SI 2
14278 "branch_positive_comparison_operator"
14280 "cc_reg_operand" "y,y")
14282 (match_operator:SI 4
14283 "branch_positive_comparison_operator"
14285 "cc_reg_operand" "0,y")
14289 "cr%q1 %E0,%j2,%j4"
14290 [(set_attr "type" "cr_logical,delayed_cr")])
14292 ; Why is the constant -1 here, but 1 in the previous pattern?
14293 ; Because ~1 has all but the low bit set.
14295 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
14296 (compare:CCEQ (match_operator:SI 1 "boolean_or_operator"
14297 [(not:SI (match_operator:SI 2
14298 "branch_positive_comparison_operator"
14300 "cc_reg_operand" "y,y")
14302 (match_operator:SI 4
14303 "branch_positive_comparison_operator"
14305 "cc_reg_operand" "0,y")
14309 "cr%q1 %E0,%j2,%j4"
14310 [(set_attr "type" "cr_logical,delayed_cr")])
14312 (define_insn "*cceq_rev_compare"
14313 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
14314 (compare:CCEQ (match_operator:SI 1
14315 "branch_positive_comparison_operator"
14317 "cc_reg_operand" "0,y")
14321 "{crnor %E0,%j1,%j1|crnot %E0,%j1}"
14322 [(set_attr "type" "cr_logical,delayed_cr")])
14324 ;; If we are comparing the result of two comparisons, this can be done
14325 ;; using creqv or crxor.
14327 (define_insn_and_split ""
14328 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
14329 (compare:CCEQ (match_operator 1 "branch_comparison_operator"
14330 [(match_operand 2 "cc_reg_operand" "y")
14332 (match_operator 3 "branch_comparison_operator"
14333 [(match_operand 4 "cc_reg_operand" "y")
14338 [(set (match_dup 0) (compare:CCEQ (xor:SI (match_dup 1) (match_dup 3))
14342 int positive_1, positive_2;
14344 positive_1 = branch_positive_comparison_operator (operands[1],
14345 GET_MODE (operands[1]));
14346 positive_2 = branch_positive_comparison_operator (operands[3],
14347 GET_MODE (operands[3]));
14350 operands[1] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[2]),
14351 GET_CODE (operands[1])),
14353 operands[2], const0_rtx);
14354 else if (GET_MODE (operands[1]) != SImode)
14355 operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]), SImode,
14356 operands[2], const0_rtx);
14359 operands[3] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[4]),
14360 GET_CODE (operands[3])),
14362 operands[4], const0_rtx);
14363 else if (GET_MODE (operands[3]) != SImode)
14364 operands[3] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
14365 operands[4], const0_rtx);
14367 if (positive_1 == positive_2)
14369 operands[1] = gen_rtx_NOT (SImode, operands[1]);
14370 operands[5] = constm1_rtx;
14374 operands[5] = const1_rtx;
14378 ;; Unconditional branch and return.
14380 (define_insn "jump"
14382 (label_ref (match_operand 0 "" "")))]
14385 [(set_attr "type" "branch")])
14387 (define_insn "return"
14391 [(set_attr "type" "jmpreg")])
14393 (define_expand "indirect_jump"
14394 [(set (pc) (match_operand 0 "register_operand" ""))])
14396 (define_insn "*indirect_jump<mode>"
14397 [(set (pc) (match_operand:P 0 "register_operand" "c,*l"))]
14402 [(set_attr "type" "jmpreg")])
14404 ;; Table jump for switch statements:
14405 (define_expand "tablejump"
14406 [(use (match_operand 0 "" ""))
14407 (use (label_ref (match_operand 1 "" "")))]
14412 emit_jump_insn (gen_tablejumpsi (operands[0], operands[1]));
14414 emit_jump_insn (gen_tablejumpdi (operands[0], operands[1]));
14418 (define_expand "tablejumpsi"
14419 [(set (match_dup 3)
14420 (plus:SI (match_operand:SI 0 "" "")
14422 (parallel [(set (pc) (match_dup 3))
14423 (use (label_ref (match_operand 1 "" "")))])]
14426 { operands[0] = force_reg (SImode, operands[0]);
14427 operands[2] = force_reg (SImode, gen_rtx_LABEL_REF (SImode, operands[1]));
14428 operands[3] = gen_reg_rtx (SImode);
14431 (define_expand "tablejumpdi"
14432 [(set (match_dup 4)
14433 (sign_extend:DI (match_operand:SI 0 "lwa_operand" "")))
14435 (plus:DI (match_dup 4)
14437 (parallel [(set (pc) (match_dup 3))
14438 (use (label_ref (match_operand 1 "" "")))])]
14441 { operands[2] = force_reg (DImode, gen_rtx_LABEL_REF (DImode, operands[1]));
14442 operands[3] = gen_reg_rtx (DImode);
14443 operands[4] = gen_reg_rtx (DImode);
14446 (define_insn "*tablejump<mode>_internal1"
14448 (match_operand:P 0 "register_operand" "c,*l"))
14449 (use (label_ref (match_operand 1 "" "")))]
14454 [(set_attr "type" "jmpreg")])
14459 "{cror 0,0,0|nop}")
14461 ;; Define the subtract-one-and-jump insns, starting with the template
14462 ;; so loop.c knows what to generate.
14464 (define_expand "doloop_end"
14465 [(use (match_operand 0 "" "")) ; loop pseudo
14466 (use (match_operand 1 "" "")) ; iterations; zero if unknown
14467 (use (match_operand 2 "" "")) ; max iterations
14468 (use (match_operand 3 "" "")) ; loop level
14469 (use (match_operand 4 "" ""))] ; label
14473 /* Only use this on innermost loops. */
14474 if (INTVAL (operands[3]) > 1)
14478 if (GET_MODE (operands[0]) != DImode)
14480 emit_jump_insn (gen_ctrdi (operands[0], operands[4]));
14484 if (GET_MODE (operands[0]) != SImode)
14486 emit_jump_insn (gen_ctrsi (operands[0], operands[4]));
14491 (define_expand "ctr<mode>"
14492 [(parallel [(set (pc)
14493 (if_then_else (ne (match_operand:P 0 "register_operand" "")
14495 (label_ref (match_operand 1 "" ""))
14498 (plus:P (match_dup 0)
14500 (clobber (match_scratch:CC 2 ""))
14501 (clobber (match_scratch:P 3 ""))])]
14505 ;; We need to be able to do this for any operand, including MEM, or we
14506 ;; will cause reload to blow up since we don't allow output reloads on
14508 ;; For the length attribute to be calculated correctly, the
14509 ;; label MUST be operand 0.
14511 (define_insn "*ctr<mode>_internal1"
14513 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
14515 (label_ref (match_operand 0 "" ""))
14517 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
14518 (plus:P (match_dup 1)
14520 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14521 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
14525 if (which_alternative != 0)
14527 else if (get_attr_length (insn) == 4)
14528 return \"{bdn|bdnz} %l0\";
14530 return \"bdz $+8\;b %l0\";
14532 [(set_attr "type" "branch")
14533 (set_attr "length" "*,12,16,16")])
14535 (define_insn "*ctr<mode>_internal2"
14537 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
14540 (label_ref (match_operand 0 "" ""))))
14541 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
14542 (plus:P (match_dup 1)
14544 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14545 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
14549 if (which_alternative != 0)
14551 else if (get_attr_length (insn) == 4)
14552 return \"bdz %l0\";
14554 return \"{bdn|bdnz} $+8\;b %l0\";
14556 [(set_attr "type" "branch")
14557 (set_attr "length" "*,12,16,16")])
14559 ;; Similar but use EQ
14561 (define_insn "*ctr<mode>_internal5"
14563 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
14565 (label_ref (match_operand 0 "" ""))
14567 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
14568 (plus:P (match_dup 1)
14570 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14571 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
14575 if (which_alternative != 0)
14577 else if (get_attr_length (insn) == 4)
14578 return \"bdz %l0\";
14580 return \"{bdn|bdnz} $+8\;b %l0\";
14582 [(set_attr "type" "branch")
14583 (set_attr "length" "*,12,16,16")])
14585 (define_insn "*ctr<mode>_internal6"
14587 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
14590 (label_ref (match_operand 0 "" ""))))
14591 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
14592 (plus:P (match_dup 1)
14594 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14595 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
14599 if (which_alternative != 0)
14601 else if (get_attr_length (insn) == 4)
14602 return \"{bdn|bdnz} %l0\";
14604 return \"bdz $+8\;b %l0\";
14606 [(set_attr "type" "branch")
14607 (set_attr "length" "*,12,16,16")])
14609 ;; Now the splitters if we could not allocate the CTR register
14613 (if_then_else (match_operator 2 "comparison_operator"
14614 [(match_operand:P 1 "gpc_reg_operand" "")
14616 (match_operand 5 "" "")
14617 (match_operand 6 "" "")))
14618 (set (match_operand:P 0 "gpc_reg_operand" "")
14619 (plus:P (match_dup 1) (const_int -1)))
14620 (clobber (match_scratch:CC 3 ""))
14621 (clobber (match_scratch:P 4 ""))]
14623 [(parallel [(set (match_dup 3)
14624 (compare:CC (plus:P (match_dup 1)
14628 (plus:P (match_dup 1)
14630 (set (pc) (if_then_else (match_dup 7)
14634 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
14635 operands[3], const0_rtx); }")
14639 (if_then_else (match_operator 2 "comparison_operator"
14640 [(match_operand:P 1 "gpc_reg_operand" "")
14642 (match_operand 5 "" "")
14643 (match_operand 6 "" "")))
14644 (set (match_operand:P 0 "nonimmediate_operand" "")
14645 (plus:P (match_dup 1) (const_int -1)))
14646 (clobber (match_scratch:CC 3 ""))
14647 (clobber (match_scratch:P 4 ""))]
14648 "reload_completed && ! gpc_reg_operand (operands[0], SImode)"
14649 [(parallel [(set (match_dup 3)
14650 (compare:CC (plus:P (match_dup 1)
14654 (plus:P (match_dup 1)
14658 (set (pc) (if_then_else (match_dup 7)
14662 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
14663 operands[3], const0_rtx); }")
14665 (define_insn "trap"
14666 [(trap_if (const_int 1) (const_int 0))]
14669 [(set_attr "type" "trap")])
14671 (define_expand "conditional_trap"
14672 [(trap_if (match_operator 0 "trap_comparison_operator"
14673 [(match_dup 2) (match_dup 3)])
14674 (match_operand 1 "const_int_operand" ""))]
14676 "if (rs6000_compare_fp_p || operands[1] != const0_rtx) FAIL;
14677 operands[2] = rs6000_compare_op0;
14678 operands[3] = rs6000_compare_op1;")
14681 [(trap_if (match_operator 0 "trap_comparison_operator"
14682 [(match_operand:GPR 1 "register_operand" "r")
14683 (match_operand:GPR 2 "reg_or_short_operand" "rI")])
14686 "{t|t<wd>}%V0%I2 %1,%2"
14687 [(set_attr "type" "trap")])
14689 ;; Insns related to generating the function prologue and epilogue.
14691 (define_expand "prologue"
14692 [(use (const_int 0))]
14693 "TARGET_SCHED_PROLOG"
14696 rs6000_emit_prologue ();
14700 (define_insn "*movesi_from_cr_one"
14701 [(match_parallel 0 "mfcr_operation"
14702 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
14703 (unspec:SI [(match_operand:CC 2 "cc_reg_operand" "y")
14704 (match_operand 3 "immediate_operand" "n")]
14705 UNSPEC_MOVESI_FROM_CR))])]
14711 for (i = 0; i < XVECLEN (operands[0], 0); i++)
14713 mask = INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
14714 operands[4] = GEN_INT (mask);
14715 output_asm_insn (\"mfcr %1,%4\", operands);
14719 [(set_attr "type" "mfcrf")])
14721 (define_insn "movesi_from_cr"
14722 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14723 (unspec:SI [(reg:CC CR0_REGNO) (reg:CC CR1_REGNO)
14724 (reg:CC CR2_REGNO) (reg:CC CR3_REGNO)
14725 (reg:CC CR4_REGNO) (reg:CC CR5_REGNO)
14726 (reg:CC CR6_REGNO) (reg:CC CR7_REGNO)]
14727 UNSPEC_MOVESI_FROM_CR))]
14730 [(set_attr "type" "mfcr")])
14732 (define_insn "*stmw"
14733 [(match_parallel 0 "stmw_operation"
14734 [(set (match_operand:SI 1 "memory_operand" "=m")
14735 (match_operand:SI 2 "gpc_reg_operand" "r"))])]
14738 [(set_attr "type" "store_ux")])
14740 (define_insn "*save_gpregs_<mode>"
14741 [(match_parallel 0 "any_parallel_operand"
14742 [(clobber (reg:P 65))
14743 (use (match_operand:P 1 "symbol_ref_operand" "s"))
14744 (use (match_operand:P 2 "gpc_reg_operand" "r"))
14745 (set (match_operand:P 3 "memory_operand" "=m")
14746 (match_operand:P 4 "gpc_reg_operand" "r"))])]
14749 [(set_attr "type" "branch")
14750 (set_attr "length" "4")])
14752 (define_insn "*save_fpregs_<mode>"
14753 [(match_parallel 0 "any_parallel_operand"
14754 [(clobber (reg:P 65))
14755 (use (match_operand:P 1 "symbol_ref_operand" "s"))
14756 (use (match_operand:P 2 "gpc_reg_operand" "r"))
14757 (set (match_operand:DF 3 "memory_operand" "=m")
14758 (match_operand:DF 4 "gpc_reg_operand" "f"))])]
14761 [(set_attr "type" "branch")
14762 (set_attr "length" "4")])
14764 ; These are to explain that changes to the stack pointer should
14765 ; not be moved over stores to stack memory.
14766 (define_insn "stack_tie"
14767 [(set (match_operand:BLK 0 "memory_operand" "+m")
14768 (unspec:BLK [(match_dup 0)] UNSPEC_TIE))]
14771 [(set_attr "length" "0")])
14774 (define_expand "epilogue"
14775 [(use (const_int 0))]
14776 "TARGET_SCHED_PROLOG"
14779 rs6000_emit_epilogue (FALSE);
14783 ; On some processors, doing the mtcrf one CC register at a time is
14784 ; faster (like on the 604e). On others, doing them all at once is
14785 ; faster; for instance, on the 601 and 750.
14787 (define_expand "movsi_to_cr_one"
14788 [(set (match_operand:CC 0 "cc_reg_operand" "")
14789 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "")
14790 (match_dup 2)] UNSPEC_MOVESI_TO_CR))]
14792 "operands[2] = GEN_INT (1 << (75 - REGNO (operands[0])));")
14794 (define_insn "*movsi_to_cr"
14795 [(match_parallel 0 "mtcrf_operation"
14796 [(set (match_operand:CC 1 "cc_reg_operand" "=y")
14797 (unspec:CC [(match_operand:SI 2 "gpc_reg_operand" "r")
14798 (match_operand 3 "immediate_operand" "n")]
14799 UNSPEC_MOVESI_TO_CR))])]
14805 for (i = 0; i < XVECLEN (operands[0], 0); i++)
14806 mask |= INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
14807 operands[4] = GEN_INT (mask);
14808 return \"mtcrf %4,%2\";
14810 [(set_attr "type" "mtcr")])
14812 (define_insn "*mtcrfsi"
14813 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
14814 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
14815 (match_operand 2 "immediate_operand" "n")]
14816 UNSPEC_MOVESI_TO_CR))]
14817 "GET_CODE (operands[0]) == REG
14818 && CR_REGNO_P (REGNO (operands[0]))
14819 && GET_CODE (operands[2]) == CONST_INT
14820 && INTVAL (operands[2]) == 1 << (75 - REGNO (operands[0]))"
14822 [(set_attr "type" "mtcr")])
14824 ; The load-multiple instructions have similar properties.
14825 ; Note that "load_multiple" is a name known to the machine-independent
14826 ; code that actually corresponds to the PowerPC load-string.
14828 (define_insn "*lmw"
14829 [(match_parallel 0 "lmw_operation"
14830 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
14831 (match_operand:SI 2 "memory_operand" "m"))])]
14834 [(set_attr "type" "load_ux")
14835 (set_attr "cell_micro" "always")])
14837 (define_insn "*return_internal_<mode>"
14839 (use (match_operand:P 0 "register_operand" "lc"))]
14842 [(set_attr "type" "jmpreg")])
14844 ; FIXME: This would probably be somewhat simpler if the Cygnus sibcall
14845 ; stuff was in GCC. Oh, and "any_parallel_operand" is a bit flexible...
14847 (define_insn "*restore_gpregs_<mode>"
14848 [(match_parallel 0 "any_parallel_operand"
14849 [(clobber (match_operand:P 1 "register_operand" "=l"))
14850 (use (match_operand:P 2 "symbol_ref_operand" "s"))
14851 (use (match_operand:P 3 "gpc_reg_operand" "r"))
14852 (set (match_operand:P 4 "gpc_reg_operand" "=r")
14853 (match_operand:P 5 "memory_operand" "m"))])]
14856 [(set_attr "type" "branch")
14857 (set_attr "length" "4")])
14859 (define_insn "*return_and_restore_gpregs_<mode>"
14860 [(match_parallel 0 "any_parallel_operand"
14862 (clobber (match_operand:P 1 "register_operand" "=l"))
14863 (use (match_operand:P 2 "symbol_ref_operand" "s"))
14864 (use (match_operand:P 3 "gpc_reg_operand" "r"))
14865 (set (match_operand:P 4 "gpc_reg_operand" "=r")
14866 (match_operand:P 5 "memory_operand" "m"))])]
14869 [(set_attr "type" "branch")
14870 (set_attr "length" "4")])
14872 (define_insn "*return_and_restore_fpregs_<mode>"
14873 [(match_parallel 0 "any_parallel_operand"
14875 (clobber (match_operand:P 1 "register_operand" "=l"))
14876 (use (match_operand:P 2 "symbol_ref_operand" "s"))
14877 (use (match_operand:P 3 "gpc_reg_operand" "r"))
14878 (set (match_operand:DF 4 "gpc_reg_operand" "=f")
14879 (match_operand:DF 5 "memory_operand" "m"))])]
14882 [(set_attr "type" "branch")
14883 (set_attr "length" "4")])
14885 ; This is used in compiling the unwind routines.
14886 (define_expand "eh_return"
14887 [(use (match_operand 0 "general_operand" ""))]
14892 emit_insn (gen_eh_set_lr_si (operands[0]));
14894 emit_insn (gen_eh_set_lr_di (operands[0]));
14898 ; We can't expand this before we know where the link register is stored.
14899 (define_insn "eh_set_lr_<mode>"
14900 [(unspec_volatile [(match_operand:P 0 "register_operand" "r")]
14902 (clobber (match_scratch:P 1 "=&b"))]
14907 [(unspec_volatile [(match_operand 0 "register_operand" "")] UNSPECV_EH_RR)
14908 (clobber (match_scratch 1 ""))]
14913 rs6000_emit_eh_reg_restore (operands[0], operands[1]);
14917 (define_insn "prefetch"
14918 [(prefetch (match_operand 0 "indexed_or_indirect_address" "a")
14919 (match_operand:SI 1 "const_int_operand" "n")
14920 (match_operand:SI 2 "const_int_operand" "n"))]
14924 if (GET_CODE (operands[0]) == REG)
14925 return INTVAL (operands[1]) ? \"dcbtst 0,%0\" : \"dcbt 0,%0\";
14926 return INTVAL (operands[1]) ? \"dcbtst %a0\" : \"dcbt %a0\";
14928 [(set_attr "type" "load")])
14931 (include "sync.md")
14932 (include "altivec.md")
14935 (include "paired.md")