1 ;; Machine description for IBM RISC System 6000 (POWER) for GNU C compiler
2 ;; Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
3 ;; 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
4 ;; Free Software Foundation, Inc.
5 ;; Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
7 ;; This file is part of GCC.
9 ;; GCC is free software; you can redistribute it and/or modify it
10 ;; under the terms of the GNU General Public License as published
11 ;; by the Free Software Foundation; either version 3, or (at your
12 ;; option) any later version.
14 ;; GCC is distributed in the hope that it will be useful, but WITHOUT
15 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
17 ;; License for more details.
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GCC; see the file COPYING3. If not see
21 ;; <http://www.gnu.org/licenses/>.
23 ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
43 (FIRST_ALTIVEC_REGNO 77)
44 (LAST_ALTIVEC_REGNO 108)
57 [(UNSPEC_FRSP 0) ; frsp for POWER machines
58 (UNSPEC_PROBE_STACK 4) ; probe stack memory reference
59 (UNSPEC_TIE 5) ; tie stack contents and stack pointer
60 (UNSPEC_TOCPTR 6) ; address of a word pointing to the TOC
61 (UNSPEC_TOC 7) ; address of the TOC (more-or-less)
63 (UNSPEC_MV_CR_OV 9) ; move_from_CR_ov_bit
69 (UNSPEC_LD_MPIC 15) ; load_macho_picbase
70 (UNSPEC_MPIC_CORRECT 16) ; macho_correct_pic
73 (UNSPEC_MOVESI_FROM_CR 19)
74 (UNSPEC_MOVESI_TO_CR 20)
76 (UNSPEC_TLSDTPRELHA 22)
77 (UNSPEC_TLSDTPRELLO 23)
78 (UNSPEC_TLSGOTDTPREL 24)
80 (UNSPEC_TLSTPRELHA 26)
81 (UNSPEC_TLSTPRELLO 27)
82 (UNSPEC_TLSGOTTPREL 28)
84 (UNSPEC_FIX_TRUNC_TF 30) ; fadd, rounding towards zero
85 (UNSPEC_MV_CR_GT 31) ; move_from_CR_gt_bit
101 (UNSPEC_DLMZB_STRLEN 47)
104 (UNSPEC_MACHOPIC_OFFSET 50)
109 ;; UNSPEC_VOLATILE usage
114 (UNSPECV_LL 1) ; load-locked
115 (UNSPECV_SC 2) ; store-conditional
116 (UNSPECV_EH_RR 9) ; eh_reg_restore
119 ;; Define an insn type attribute. This is used in function unit delay
121 (define_attr "type" "integer,two,three,load,load_ext,load_ext_u,load_ext_ux,load_ux,load_u,store,store_ux,store_u,fpload,fpload_ux,fpload_u,fpstore,fpstore_ux,fpstore_u,vecload,vecstore,imul,imul2,imul3,lmul,idiv,ldiv,insert_word,branch,cmp,fast_compare,compare,var_delayed_compare,delayed_compare,imul_compare,lmul_compare,fpcompare,cr_logical,delayed_cr,mfcr,mfcrf,mtcr,mfjmpr,mtjmpr,fp,fpsimple,dmul,sdiv,ddiv,ssqrt,dsqrt,jmpreg,brinc,vecsimple,veccomplex,vecdiv,veccmp,veccmpsimple,vecperm,vecfloat,vecfdiv,isync,sync,load_l,store_c,shift,trap,insert_dword,var_shift_rotate,cntlz,exts,mffgpr,mftgpr,isel"
122 (const_string "integer"))
124 ;; Define floating point instruction sub-types for use with Xfpu.md
125 (define_attr "fp_type" "fp_default,fp_addsub_s,fp_addsub_d,fp_mul_s,fp_mul_d,fp_div_s,fp_div_d,fp_maddsub_s,fp_maddsub_d,fp_sqrt_s,fp_sqrt_d" (const_string "fp_default"))
127 ;; Length (in bytes).
128 ; '(pc)' in the following doesn't include the instruction itself; it is
129 ; calculated as if the instruction had zero size.
130 (define_attr "length" ""
131 (if_then_else (eq_attr "type" "branch")
132 (if_then_else (and (ge (minus (match_dup 0) (pc))
134 (lt (minus (match_dup 0) (pc))
140 ;; Processor type -- this attribute must exactly match the processor_type
141 ;; enumeration in rs6000.h.
143 (define_attr "cpu" "rios1,rios2,rs64a,mpccore,ppc403,ppc405,ppc440,ppc476,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630,ppc750,ppc7400,ppc7450,ppc8540,ppce300c2,ppce300c3,ppce500mc,ppce500mc64,power4,power5,power6,power7,cell,ppca2"
144 (const (symbol_ref "rs6000_cpu_attr")))
147 ;; If this instruction is microcoded on the CELL processor
148 ; The default for load extended, the recorded instructions and rotate/shifts by a variable is always microcoded
149 (define_attr "cell_micro" "not,conditional,always"
150 (if_then_else (eq_attr "type" "compare,delayed_compare,imul_compare,lmul_compare,load_ext,load_ext_ux,var_shift_rotate,var_delayed_compare")
151 (const_string "always")
152 (const_string "not")))
154 (automata_option "ndfa")
168 (include "e300c2c3.md")
169 (include "e500mc.md")
170 (include "e500mc64.md")
171 (include "power4.md")
172 (include "power5.md")
173 (include "power6.md")
174 (include "power7.md")
179 (include "predicates.md")
180 (include "constraints.md")
182 (include "darwin.md")
187 ; This mode iterator allows :GPR to be used to indicate the allowable size
188 ; of whole values in GPRs.
189 (define_mode_iterator GPR [SI (DI "TARGET_POWERPC64")])
191 ; Any supported integer mode.
192 (define_mode_iterator INT [QI HI SI DI TI])
194 ; Any supported integer mode that fits in one register.
195 (define_mode_iterator INT1 [QI HI SI (DI "TARGET_POWERPC64")])
197 ; extend modes for DImode
198 (define_mode_iterator QHSI [QI HI SI])
200 ; SImode or DImode, even if DImode doesn't fit in GPRs.
201 (define_mode_iterator SDI [SI DI])
203 ; The size of a pointer. Also, the size of the value that a record-condition
204 ; (one with a '.') will compare; and the size used for arithmetic carries.
205 (define_mode_iterator P [(SI "TARGET_32BIT") (DI "TARGET_64BIT")])
207 ; Any hardware-supported floating-point mode
208 (define_mode_iterator FP [
209 (SF "TARGET_HARD_FLOAT
210 && ((TARGET_FPRS && TARGET_SINGLE_FLOAT) || TARGET_E500_SINGLE)")
211 (DF "TARGET_HARD_FLOAT
212 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)")
213 (TF "!TARGET_IEEEQUAD
215 && (TARGET_FPRS || TARGET_E500_DOUBLE)
216 && TARGET_LONG_DOUBLE_128")
220 ; These modes do not fit in integer registers in 32-bit mode.
221 ; but on e500v2, the gpr are 64 bit registers
222 (define_mode_iterator DIFD [DI (DF "!TARGET_E500_DOUBLE") DD])
224 ;; Iterator for reciprocal estimate instructions
225 (define_mode_iterator RECIPF [SF DF V4SF V2DF])
227 ; Various instructions that come in SI and DI forms.
228 ; A generic w/d attribute, for things like cmpw/cmpd.
229 (define_mode_attr wd [(QI "b") (HI "h") (SI "w") (DI "d")])
232 (define_mode_attr dbits [(QI "56") (HI "48") (SI "32")])
234 ;; ISEL/ISEL64 target selection
235 (define_mode_attr sel [(SI "") (DI "64")])
237 ;; Suffix for reload patterns
238 (define_mode_attr ptrsize [(SI "32bit")
241 (define_mode_attr tptrsize [(SI "TARGET_32BIT")
242 (DI "TARGET_64BIT")])
244 (define_mode_attr mptrsize [(SI "si")
247 (define_mode_attr rreg [(SF "f")
253 ;; Start with fixed-point load and store insns. Here we put only the more
254 ;; complex forms. Basic data transfer is done later.
256 (define_expand "zero_extend<mode>di2"
257 [(set (match_operand:DI 0 "gpc_reg_operand" "")
258 (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "")))]
262 (define_insn "*zero_extend<mode>di2_internal1"
263 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
264 (zero_extend:DI (match_operand:QHSI 1 "reg_or_mem_operand" "m,r")))]
268 rldicl %0,%1,0,<dbits>"
269 [(set_attr "type" "load,*")])
271 (define_insn "*zero_extend<mode>di2_internal2"
272 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
273 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "r,r"))
275 (clobber (match_scratch:DI 2 "=r,r"))]
278 rldicl. %2,%1,0,<dbits>
280 [(set_attr "type" "compare")
281 (set_attr "length" "4,8")])
284 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
285 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" ""))
287 (clobber (match_scratch:DI 2 ""))]
288 "TARGET_POWERPC64 && reload_completed"
290 (zero_extend:DI (match_dup 1)))
292 (compare:CC (match_dup 2)
296 (define_insn "*zero_extend<mode>di2_internal3"
297 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
298 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "r,r"))
300 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
301 (zero_extend:DI (match_dup 1)))]
304 rldicl. %0,%1,0,<dbits>
306 [(set_attr "type" "compare")
307 (set_attr "length" "4,8")])
310 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
311 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" ""))
313 (set (match_operand:DI 0 "gpc_reg_operand" "")
314 (zero_extend:DI (match_dup 1)))]
315 "TARGET_POWERPC64 && reload_completed"
317 (zero_extend:DI (match_dup 1)))
319 (compare:CC (match_dup 0)
323 (define_insn "extendqidi2"
324 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
325 (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r")))]
328 [(set_attr "type" "exts")])
331 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
332 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
334 (clobber (match_scratch:DI 2 "=r,r"))]
339 [(set_attr "type" "compare")
340 (set_attr "length" "4,8")])
343 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
344 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
346 (clobber (match_scratch:DI 2 ""))]
347 "TARGET_POWERPC64 && reload_completed"
349 (sign_extend:DI (match_dup 1)))
351 (compare:CC (match_dup 2)
356 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
357 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
359 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
360 (sign_extend:DI (match_dup 1)))]
365 [(set_attr "type" "compare")
366 (set_attr "length" "4,8")])
369 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
370 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
372 (set (match_operand:DI 0 "gpc_reg_operand" "")
373 (sign_extend:DI (match_dup 1)))]
374 "TARGET_POWERPC64 && reload_completed"
376 (sign_extend:DI (match_dup 1)))
378 (compare:CC (match_dup 0)
382 (define_expand "extendhidi2"
383 [(set (match_operand:DI 0 "gpc_reg_operand" "")
384 (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "")))]
389 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
390 (sign_extend:DI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
391 "TARGET_POWERPC64 && rs6000_gen_cell_microcode"
395 [(set_attr "type" "load_ext,exts")])
398 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
399 (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r")))]
400 "TARGET_POWERPC64 && !rs6000_gen_cell_microcode"
402 [(set_attr "type" "exts")])
405 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
406 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
408 (clobber (match_scratch:DI 2 "=r,r"))]
413 [(set_attr "type" "compare")
414 (set_attr "length" "4,8")])
417 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
418 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
420 (clobber (match_scratch:DI 2 ""))]
421 "TARGET_POWERPC64 && reload_completed"
423 (sign_extend:DI (match_dup 1)))
425 (compare:CC (match_dup 2)
430 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
431 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
433 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
434 (sign_extend:DI (match_dup 1)))]
439 [(set_attr "type" "compare")
440 (set_attr "length" "4,8")])
443 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
444 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
446 (set (match_operand:DI 0 "gpc_reg_operand" "")
447 (sign_extend:DI (match_dup 1)))]
448 "TARGET_POWERPC64 && reload_completed"
450 (sign_extend:DI (match_dup 1)))
452 (compare:CC (match_dup 0)
456 (define_expand "extendsidi2"
457 [(set (match_operand:DI 0 "gpc_reg_operand" "")
458 (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")))]
463 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
464 (sign_extend:DI (match_operand:SI 1 "lwa_operand" "m,r")))]
465 "TARGET_POWERPC64 && rs6000_gen_cell_microcode"
469 [(set_attr "type" "load_ext,exts")])
472 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
473 (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r")))]
474 "TARGET_POWERPC64 && !rs6000_gen_cell_microcode"
476 [(set_attr "type" "exts")])
479 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
480 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
482 (clobber (match_scratch:DI 2 "=r,r"))]
487 [(set_attr "type" "compare")
488 (set_attr "length" "4,8")])
491 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
492 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
494 (clobber (match_scratch:DI 2 ""))]
495 "TARGET_POWERPC64 && reload_completed"
497 (sign_extend:DI (match_dup 1)))
499 (compare:CC (match_dup 2)
504 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
505 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
507 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
508 (sign_extend:DI (match_dup 1)))]
513 [(set_attr "type" "compare")
514 (set_attr "length" "4,8")])
517 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
518 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
520 (set (match_operand:DI 0 "gpc_reg_operand" "")
521 (sign_extend:DI (match_dup 1)))]
522 "TARGET_POWERPC64 && reload_completed"
524 (sign_extend:DI (match_dup 1)))
526 (compare:CC (match_dup 0)
530 (define_expand "zero_extendqisi2"
531 [(set (match_operand:SI 0 "gpc_reg_operand" "")
532 (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "")))]
537 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
538 (zero_extend:SI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
542 {rlinm|rlwinm} %0,%1,0,0xff"
543 [(set_attr "type" "load,*")])
546 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
547 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
549 (clobber (match_scratch:SI 2 "=r,r"))]
552 {andil.|andi.} %2,%1,0xff
554 [(set_attr "type" "fast_compare,compare")
555 (set_attr "length" "4,8")])
558 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
559 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
561 (clobber (match_scratch:SI 2 ""))]
564 (zero_extend:SI (match_dup 1)))
566 (compare:CC (match_dup 2)
571 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
572 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
574 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
575 (zero_extend:SI (match_dup 1)))]
578 {andil.|andi.} %0,%1,0xff
580 [(set_attr "type" "fast_compare,compare")
581 (set_attr "length" "4,8")])
584 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
585 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
587 (set (match_operand:SI 0 "gpc_reg_operand" "")
588 (zero_extend:SI (match_dup 1)))]
591 (zero_extend:SI (match_dup 1)))
593 (compare:CC (match_dup 0)
597 (define_expand "extendqisi2"
598 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
599 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
604 emit_insn (gen_extendqisi2_ppc (operands[0], operands[1]));
605 else if (TARGET_POWER)
606 emit_insn (gen_extendqisi2_power (operands[0], operands[1]));
608 emit_insn (gen_extendqisi2_no_power (operands[0], operands[1]));
612 (define_insn "extendqisi2_ppc"
613 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
614 (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r")))]
617 [(set_attr "type" "exts")])
620 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
621 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
623 (clobber (match_scratch:SI 2 "=r,r"))]
628 [(set_attr "type" "compare")
629 (set_attr "length" "4,8")])
632 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
633 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
635 (clobber (match_scratch:SI 2 ""))]
636 "TARGET_POWERPC && reload_completed"
638 (sign_extend:SI (match_dup 1)))
640 (compare:CC (match_dup 2)
645 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
646 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
648 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
649 (sign_extend:SI (match_dup 1)))]
654 [(set_attr "type" "compare")
655 (set_attr "length" "4,8")])
658 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
659 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
661 (set (match_operand:SI 0 "gpc_reg_operand" "")
662 (sign_extend:SI (match_dup 1)))]
663 "TARGET_POWERPC && reload_completed"
665 (sign_extend:SI (match_dup 1)))
667 (compare:CC (match_dup 0)
671 (define_expand "extendqisi2_power"
672 [(parallel [(set (match_dup 2)
673 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
675 (clobber (scratch:SI))])
676 (parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
677 (ashiftrt:SI (match_dup 2)
679 (clobber (scratch:SI))])]
682 { operands[1] = gen_lowpart (SImode, operands[1]);
683 operands[2] = gen_reg_rtx (SImode); }")
685 (define_expand "extendqisi2_no_power"
687 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
689 (set (match_operand:SI 0 "gpc_reg_operand" "")
690 (ashiftrt:SI (match_dup 2)
692 "! TARGET_POWER && ! TARGET_POWERPC"
694 { operands[1] = gen_lowpart (SImode, operands[1]);
695 operands[2] = gen_reg_rtx (SImode); }")
697 (define_expand "zero_extendqihi2"
698 [(set (match_operand:HI 0 "gpc_reg_operand" "")
699 (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "")))]
704 [(set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
705 (zero_extend:HI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
709 {rlinm|rlwinm} %0,%1,0,0xff"
710 [(set_attr "type" "load,*")])
713 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
714 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
716 (clobber (match_scratch:HI 2 "=r,r"))]
719 {andil.|andi.} %2,%1,0xff
721 [(set_attr "type" "fast_compare,compare")
722 (set_attr "length" "4,8")])
725 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
726 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
728 (clobber (match_scratch:HI 2 ""))]
731 (zero_extend:HI (match_dup 1)))
733 (compare:CC (match_dup 2)
738 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
739 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
741 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
742 (zero_extend:HI (match_dup 1)))]
745 {andil.|andi.} %0,%1,0xff
747 [(set_attr "type" "fast_compare,compare")
748 (set_attr "length" "4,8")])
751 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
752 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
754 (set (match_operand:HI 0 "gpc_reg_operand" "")
755 (zero_extend:HI (match_dup 1)))]
758 (zero_extend:HI (match_dup 1)))
760 (compare:CC (match_dup 0)
764 (define_expand "extendqihi2"
765 [(use (match_operand:HI 0 "gpc_reg_operand" ""))
766 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
771 emit_insn (gen_extendqihi2_ppc (operands[0], operands[1]));
772 else if (TARGET_POWER)
773 emit_insn (gen_extendqihi2_power (operands[0], operands[1]));
775 emit_insn (gen_extendqihi2_no_power (operands[0], operands[1]));
779 (define_insn "extendqihi2_ppc"
780 [(set (match_operand:HI 0 "gpc_reg_operand" "=r")
781 (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r")))]
784 [(set_attr "type" "exts")])
787 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
788 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
790 (clobber (match_scratch:HI 2 "=r,r"))]
795 [(set_attr "type" "compare")
796 (set_attr "length" "4,8")])
799 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
800 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
802 (clobber (match_scratch:HI 2 ""))]
803 "TARGET_POWERPC && reload_completed"
805 (sign_extend:HI (match_dup 1)))
807 (compare:CC (match_dup 2)
812 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
813 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
815 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
816 (sign_extend:HI (match_dup 1)))]
821 [(set_attr "type" "compare")
822 (set_attr "length" "4,8")])
825 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
826 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
828 (set (match_operand:HI 0 "gpc_reg_operand" "")
829 (sign_extend:HI (match_dup 1)))]
830 "TARGET_POWERPC && reload_completed"
832 (sign_extend:HI (match_dup 1)))
834 (compare:CC (match_dup 0)
838 (define_expand "extendqihi2_power"
839 [(parallel [(set (match_dup 2)
840 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
842 (clobber (scratch:SI))])
843 (parallel [(set (match_operand:HI 0 "gpc_reg_operand" "")
844 (ashiftrt:SI (match_dup 2)
846 (clobber (scratch:SI))])]
849 { operands[0] = gen_lowpart (SImode, operands[0]);
850 operands[1] = gen_lowpart (SImode, operands[1]);
851 operands[2] = gen_reg_rtx (SImode); }")
853 (define_expand "extendqihi2_no_power"
855 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
857 (set (match_operand:HI 0 "gpc_reg_operand" "")
858 (ashiftrt:SI (match_dup 2)
860 "! TARGET_POWER && ! TARGET_POWERPC"
862 { operands[0] = gen_lowpart (SImode, operands[0]);
863 operands[1] = gen_lowpart (SImode, operands[1]);
864 operands[2] = gen_reg_rtx (SImode); }")
866 (define_expand "zero_extendhisi2"
867 [(set (match_operand:SI 0 "gpc_reg_operand" "")
868 (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
873 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
874 (zero_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
878 {rlinm|rlwinm} %0,%1,0,0xffff"
879 [(set_attr "type" "load,*")])
882 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
883 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
885 (clobber (match_scratch:SI 2 "=r,r"))]
888 {andil.|andi.} %2,%1,0xffff
890 [(set_attr "type" "fast_compare,compare")
891 (set_attr "length" "4,8")])
894 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
895 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
897 (clobber (match_scratch:SI 2 ""))]
900 (zero_extend:SI (match_dup 1)))
902 (compare:CC (match_dup 2)
907 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
908 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
910 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
911 (zero_extend:SI (match_dup 1)))]
914 {andil.|andi.} %0,%1,0xffff
916 [(set_attr "type" "fast_compare,compare")
917 (set_attr "length" "4,8")])
920 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
921 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
923 (set (match_operand:SI 0 "gpc_reg_operand" "")
924 (zero_extend:SI (match_dup 1)))]
927 (zero_extend:SI (match_dup 1)))
929 (compare:CC (match_dup 0)
933 (define_expand "extendhisi2"
934 [(set (match_operand:SI 0 "gpc_reg_operand" "")
935 (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
940 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
941 (sign_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
942 "rs6000_gen_cell_microcode"
946 [(set_attr "type" "load_ext,exts")])
949 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
950 (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r")))]
951 "!rs6000_gen_cell_microcode"
953 [(set_attr "type" "exts")])
956 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
957 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
959 (clobber (match_scratch:SI 2 "=r,r"))]
964 [(set_attr "type" "compare")
965 (set_attr "length" "4,8")])
968 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
969 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
971 (clobber (match_scratch:SI 2 ""))]
974 (sign_extend:SI (match_dup 1)))
976 (compare:CC (match_dup 2)
981 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
982 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
984 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
985 (sign_extend:SI (match_dup 1)))]
990 [(set_attr "type" "compare")
991 (set_attr "length" "4,8")])
993 ;; IBM 405, 440, 464 and 476 half-word multiplication operations.
995 (define_insn "*macchwc"
996 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
997 (compare:CC (plus:SI (mult:SI (ashiftrt:SI
998 (match_operand:SI 2 "gpc_reg_operand" "r")
1001 (match_operand:HI 1 "gpc_reg_operand" "r")))
1002 (match_operand:SI 4 "gpc_reg_operand" "0"))
1004 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1005 (plus:SI (mult:SI (ashiftrt:SI
1012 "macchw. %0, %1, %2"
1013 [(set_attr "type" "imul3")])
1015 (define_insn "*macchw"
1016 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1017 (plus:SI (mult:SI (ashiftrt:SI
1018 (match_operand:SI 2 "gpc_reg_operand" "r")
1021 (match_operand:HI 1 "gpc_reg_operand" "r")))
1022 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1025 [(set_attr "type" "imul3")])
1027 (define_insn "*macchwuc"
1028 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1029 (compare:CC (plus:SI (mult:SI (lshiftrt:SI
1030 (match_operand:SI 2 "gpc_reg_operand" "r")
1033 (match_operand:HI 1 "gpc_reg_operand" "r")))
1034 (match_operand:SI 4 "gpc_reg_operand" "0"))
1036 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1037 (plus:SI (mult:SI (lshiftrt:SI
1044 "macchwu. %0, %1, %2"
1045 [(set_attr "type" "imul3")])
1047 (define_insn "*macchwu"
1048 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1049 (plus:SI (mult:SI (lshiftrt:SI
1050 (match_operand:SI 2 "gpc_reg_operand" "r")
1053 (match_operand:HI 1 "gpc_reg_operand" "r")))
1054 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1056 "macchwu %0, %1, %2"
1057 [(set_attr "type" "imul3")])
1059 (define_insn "*machhwc"
1060 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1061 (compare:CC (plus:SI (mult:SI (ashiftrt:SI
1062 (match_operand:SI 1 "gpc_reg_operand" "%r")
1065 (match_operand:SI 2 "gpc_reg_operand" "r")
1067 (match_operand:SI 4 "gpc_reg_operand" "0"))
1069 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1070 (plus:SI (mult:SI (ashiftrt:SI
1078 "machhw. %0, %1, %2"
1079 [(set_attr "type" "imul3")])
1081 (define_insn "*machhw"
1082 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1083 (plus:SI (mult:SI (ashiftrt:SI
1084 (match_operand:SI 1 "gpc_reg_operand" "%r")
1087 (match_operand:SI 2 "gpc_reg_operand" "r")
1089 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1092 [(set_attr "type" "imul3")])
1094 (define_insn "*machhwuc"
1095 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1096 (compare:CC (plus:SI (mult:SI (lshiftrt:SI
1097 (match_operand:SI 1 "gpc_reg_operand" "%r")
1100 (match_operand:SI 2 "gpc_reg_operand" "r")
1102 (match_operand:SI 4 "gpc_reg_operand" "0"))
1104 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1105 (plus:SI (mult:SI (lshiftrt:SI
1113 "machhwu. %0, %1, %2"
1114 [(set_attr "type" "imul3")])
1116 (define_insn "*machhwu"
1117 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1118 (plus:SI (mult:SI (lshiftrt:SI
1119 (match_operand:SI 1 "gpc_reg_operand" "%r")
1122 (match_operand:SI 2 "gpc_reg_operand" "r")
1124 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1126 "machhwu %0, %1, %2"
1127 [(set_attr "type" "imul3")])
1129 (define_insn "*maclhwc"
1130 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1131 (compare:CC (plus:SI (mult:SI (sign_extend:SI
1132 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1134 (match_operand:HI 2 "gpc_reg_operand" "r")))
1135 (match_operand:SI 4 "gpc_reg_operand" "0"))
1137 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1138 (plus:SI (mult:SI (sign_extend:SI
1144 "maclhw. %0, %1, %2"
1145 [(set_attr "type" "imul3")])
1147 (define_insn "*maclhw"
1148 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1149 (plus:SI (mult:SI (sign_extend:SI
1150 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1152 (match_operand:HI 2 "gpc_reg_operand" "r")))
1153 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1156 [(set_attr "type" "imul3")])
1158 (define_insn "*maclhwuc"
1159 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1160 (compare:CC (plus:SI (mult:SI (zero_extend:SI
1161 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1163 (match_operand:HI 2 "gpc_reg_operand" "r")))
1164 (match_operand:SI 4 "gpc_reg_operand" "0"))
1166 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1167 (plus:SI (mult:SI (zero_extend:SI
1173 "maclhwu. %0, %1, %2"
1174 [(set_attr "type" "imul3")])
1176 (define_insn "*maclhwu"
1177 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1178 (plus:SI (mult:SI (zero_extend:SI
1179 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1181 (match_operand:HI 2 "gpc_reg_operand" "r")))
1182 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1184 "maclhwu %0, %1, %2"
1185 [(set_attr "type" "imul3")])
1187 (define_insn "*nmacchwc"
1188 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1189 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1190 (mult:SI (ashiftrt:SI
1191 (match_operand:SI 2 "gpc_reg_operand" "r")
1194 (match_operand:HI 1 "gpc_reg_operand" "r"))))
1196 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1197 (minus:SI (match_dup 4)
1198 (mult:SI (ashiftrt:SI
1204 "nmacchw. %0, %1, %2"
1205 [(set_attr "type" "imul3")])
1207 (define_insn "*nmacchw"
1208 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1209 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1210 (mult:SI (ashiftrt:SI
1211 (match_operand:SI 2 "gpc_reg_operand" "r")
1214 (match_operand:HI 1 "gpc_reg_operand" "r")))))]
1216 "nmacchw %0, %1, %2"
1217 [(set_attr "type" "imul3")])
1219 (define_insn "*nmachhwc"
1220 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1221 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1222 (mult:SI (ashiftrt:SI
1223 (match_operand:SI 1 "gpc_reg_operand" "%r")
1226 (match_operand:SI 2 "gpc_reg_operand" "r")
1229 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1230 (minus:SI (match_dup 4)
1231 (mult:SI (ashiftrt:SI
1238 "nmachhw. %0, %1, %2"
1239 [(set_attr "type" "imul3")])
1241 (define_insn "*nmachhw"
1242 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1243 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1244 (mult:SI (ashiftrt:SI
1245 (match_operand:SI 1 "gpc_reg_operand" "%r")
1248 (match_operand:SI 2 "gpc_reg_operand" "r")
1251 "nmachhw %0, %1, %2"
1252 [(set_attr "type" "imul3")])
1254 (define_insn "*nmaclhwc"
1255 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1256 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1257 (mult:SI (sign_extend:SI
1258 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1260 (match_operand:HI 2 "gpc_reg_operand" "r"))))
1262 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1263 (minus:SI (match_dup 4)
1264 (mult:SI (sign_extend:SI
1269 "nmaclhw. %0, %1, %2"
1270 [(set_attr "type" "imul3")])
1272 (define_insn "*nmaclhw"
1273 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1274 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1275 (mult:SI (sign_extend:SI
1276 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1278 (match_operand:HI 2 "gpc_reg_operand" "r")))))]
1280 "nmaclhw %0, %1, %2"
1281 [(set_attr "type" "imul3")])
1283 (define_insn "*mulchwc"
1284 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1285 (compare:CC (mult:SI (ashiftrt:SI
1286 (match_operand:SI 2 "gpc_reg_operand" "r")
1289 (match_operand:HI 1 "gpc_reg_operand" "r")))
1291 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1292 (mult:SI (ashiftrt:SI
1298 "mulchw. %0, %1, %2"
1299 [(set_attr "type" "imul3")])
1301 (define_insn "*mulchw"
1302 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1303 (mult:SI (ashiftrt:SI
1304 (match_operand:SI 2 "gpc_reg_operand" "r")
1307 (match_operand:HI 1 "gpc_reg_operand" "r"))))]
1310 [(set_attr "type" "imul3")])
1312 (define_insn "*mulchwuc"
1313 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1314 (compare:CC (mult:SI (lshiftrt:SI
1315 (match_operand:SI 2 "gpc_reg_operand" "r")
1318 (match_operand:HI 1 "gpc_reg_operand" "r")))
1320 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1321 (mult:SI (lshiftrt:SI
1327 "mulchwu. %0, %1, %2"
1328 [(set_attr "type" "imul3")])
1330 (define_insn "*mulchwu"
1331 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1332 (mult:SI (lshiftrt:SI
1333 (match_operand:SI 2 "gpc_reg_operand" "r")
1336 (match_operand:HI 1 "gpc_reg_operand" "r"))))]
1338 "mulchwu %0, %1, %2"
1339 [(set_attr "type" "imul3")])
1341 (define_insn "*mulhhwc"
1342 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1343 (compare:CC (mult:SI (ashiftrt:SI
1344 (match_operand:SI 1 "gpc_reg_operand" "%r")
1347 (match_operand:SI 2 "gpc_reg_operand" "r")
1350 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1351 (mult:SI (ashiftrt:SI
1358 "mulhhw. %0, %1, %2"
1359 [(set_attr "type" "imul3")])
1361 (define_insn "*mulhhw"
1362 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1363 (mult:SI (ashiftrt:SI
1364 (match_operand:SI 1 "gpc_reg_operand" "%r")
1367 (match_operand:SI 2 "gpc_reg_operand" "r")
1371 [(set_attr "type" "imul3")])
1373 (define_insn "*mulhhwuc"
1374 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1375 (compare:CC (mult:SI (lshiftrt:SI
1376 (match_operand:SI 1 "gpc_reg_operand" "%r")
1379 (match_operand:SI 2 "gpc_reg_operand" "r")
1382 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1383 (mult:SI (lshiftrt:SI
1390 "mulhhwu. %0, %1, %2"
1391 [(set_attr "type" "imul3")])
1393 (define_insn "*mulhhwu"
1394 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1395 (mult:SI (lshiftrt:SI
1396 (match_operand:SI 1 "gpc_reg_operand" "%r")
1399 (match_operand:SI 2 "gpc_reg_operand" "r")
1402 "mulhhwu %0, %1, %2"
1403 [(set_attr "type" "imul3")])
1405 (define_insn "*mullhwc"
1406 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1407 (compare:CC (mult:SI (sign_extend:SI
1408 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1410 (match_operand:HI 2 "gpc_reg_operand" "r")))
1412 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1413 (mult:SI (sign_extend:SI
1418 "mullhw. %0, %1, %2"
1419 [(set_attr "type" "imul3")])
1421 (define_insn "*mullhw"
1422 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1423 (mult:SI (sign_extend:SI
1424 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1426 (match_operand:HI 2 "gpc_reg_operand" "r"))))]
1429 [(set_attr "type" "imul3")])
1431 (define_insn "*mullhwuc"
1432 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1433 (compare:CC (mult:SI (zero_extend:SI
1434 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1436 (match_operand:HI 2 "gpc_reg_operand" "r")))
1438 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1439 (mult:SI (zero_extend:SI
1444 "mullhwu. %0, %1, %2"
1445 [(set_attr "type" "imul3")])
1447 (define_insn "*mullhwu"
1448 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1449 (mult:SI (zero_extend:SI
1450 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1452 (match_operand:HI 2 "gpc_reg_operand" "r"))))]
1454 "mullhwu %0, %1, %2"
1455 [(set_attr "type" "imul3")])
1457 ;; IBM 405, 440, 464 and 476 string-search dlmzb instruction support.
1458 (define_insn "dlmzb"
1459 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1460 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
1461 (match_operand:SI 2 "gpc_reg_operand" "r")]
1463 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1464 (unspec:SI [(match_dup 1)
1468 "dlmzb. %0, %1, %2")
1470 (define_expand "strlensi"
1471 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1472 (unspec:SI [(match_operand:BLK 1 "general_operand" "")
1473 (match_operand:QI 2 "const_int_operand" "")
1474 (match_operand 3 "const_int_operand" "")]
1475 UNSPEC_DLMZB_STRLEN))
1476 (clobber (match_scratch:CC 4 "=x"))]
1477 "TARGET_DLMZB && WORDS_BIG_ENDIAN && !optimize_size"
1479 rtx result = operands[0];
1480 rtx src = operands[1];
1481 rtx search_char = operands[2];
1482 rtx align = operands[3];
1483 rtx addr, scratch_string, word1, word2, scratch_dlmzb;
1484 rtx loop_label, end_label, mem, cr0, cond;
1485 if (search_char != const0_rtx
1486 || GET_CODE (align) != CONST_INT
1487 || INTVAL (align) < 8)
1489 word1 = gen_reg_rtx (SImode);
1490 word2 = gen_reg_rtx (SImode);
1491 scratch_dlmzb = gen_reg_rtx (SImode);
1492 scratch_string = gen_reg_rtx (Pmode);
1493 loop_label = gen_label_rtx ();
1494 end_label = gen_label_rtx ();
1495 addr = force_reg (Pmode, XEXP (src, 0));
1496 emit_move_insn (scratch_string, addr);
1497 emit_label (loop_label);
1498 mem = change_address (src, SImode, scratch_string);
1499 emit_move_insn (word1, mem);
1500 emit_move_insn (word2, adjust_address (mem, SImode, 4));
1501 cr0 = gen_rtx_REG (CCmode, CR0_REGNO);
1502 emit_insn (gen_dlmzb (scratch_dlmzb, word1, word2, cr0));
1503 cond = gen_rtx_NE (VOIDmode, cr0, const0_rtx);
1504 emit_jump_insn (gen_rtx_SET (VOIDmode,
1506 gen_rtx_IF_THEN_ELSE (VOIDmode,
1512 emit_insn (gen_addsi3 (scratch_string, scratch_string, GEN_INT (8)));
1513 emit_jump_insn (gen_rtx_SET (VOIDmode,
1515 gen_rtx_LABEL_REF (VOIDmode, loop_label)));
1517 emit_label (end_label);
1518 emit_insn (gen_addsi3 (scratch_string, scratch_string, scratch_dlmzb));
1519 emit_insn (gen_subsi3 (result, scratch_string, addr));
1520 emit_insn (gen_subsi3 (result, result, const1_rtx));
1525 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
1526 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1528 (set (match_operand:SI 0 "gpc_reg_operand" "")
1529 (sign_extend:SI (match_dup 1)))]
1532 (sign_extend:SI (match_dup 1)))
1534 (compare:CC (match_dup 0)
1538 ;; Fixed-point arithmetic insns.
1540 (define_expand "add<mode>3"
1541 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1542 (plus:SDI (match_operand:SDI 1 "gpc_reg_operand" "")
1543 (match_operand:SDI 2 "reg_or_add_cint_operand" "")))]
1546 if (<MODE>mode == DImode && ! TARGET_POWERPC64)
1548 if (non_short_cint_operand (operands[2], DImode))
1551 else if (GET_CODE (operands[2]) == CONST_INT
1552 && ! add_operand (operands[2], <MODE>mode))
1554 rtx tmp = ((!can_create_pseudo_p ()
1555 || rtx_equal_p (operands[0], operands[1]))
1556 ? operands[0] : gen_reg_rtx (<MODE>mode));
1558 HOST_WIDE_INT val = INTVAL (operands[2]);
1559 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1560 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, <MODE>mode);
1562 if (<MODE>mode == DImode && !satisfies_constraint_L (GEN_INT (rest)))
1565 /* The ordering here is important for the prolog expander.
1566 When space is allocated from the stack, adding 'low' first may
1567 produce a temporary deallocation (which would be bad). */
1568 emit_insn (gen_add<mode>3 (tmp, operands[1], GEN_INT (rest)));
1569 emit_insn (gen_add<mode>3 (operands[0], tmp, GEN_INT (low)));
1574 ;; Discourage ai/addic because of carry but provide it in an alternative
1575 ;; allowing register zero as source.
1576 (define_insn "*add<mode>3_internal1"
1577 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r,?r,r")
1578 (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "%r,b,r,b")
1579 (match_operand:GPR 2 "add_operand" "r,I,I,L")))]
1580 "!DECIMAL_FLOAT_MODE_P (GET_MODE (operands[0])) && !DECIMAL_FLOAT_MODE_P (GET_MODE (operands[1]))"
1583 {cal %0,%2(%1)|addi %0,%1,%2}
1585 {cau|addis} %0,%1,%v2"
1586 [(set_attr "length" "4,4,4,4")])
1588 (define_insn "addsi3_high"
1589 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
1590 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
1591 (high:SI (match_operand 2 "" ""))))]
1592 "TARGET_MACHO && !TARGET_64BIT"
1593 "{cau|addis} %0,%1,ha16(%2)"
1594 [(set_attr "length" "4")])
1596 (define_insn "*add<mode>3_internal2"
1597 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
1598 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "%r,r,r,r")
1599 (match_operand:P 2 "reg_or_short_operand" "r,I,r,I"))
1601 (clobber (match_scratch:P 3 "=r,r,r,r"))]
1604 {cax.|add.} %3,%1,%2
1605 {ai.|addic.} %3,%1,%2
1608 [(set_attr "type" "fast_compare,compare,compare,compare")
1609 (set_attr "length" "4,4,8,8")])
1612 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1613 (compare:CC (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1614 (match_operand:GPR 2 "reg_or_short_operand" ""))
1616 (clobber (match_scratch:GPR 3 ""))]
1619 (plus:GPR (match_dup 1)
1622 (compare:CC (match_dup 3)
1626 (define_insn "*add<mode>3_internal3"
1627 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
1628 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "%r,r,r,r")
1629 (match_operand:P 2 "reg_or_short_operand" "r,I,r,I"))
1631 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
1632 (plus:P (match_dup 1)
1636 {cax.|add.} %0,%1,%2
1637 {ai.|addic.} %0,%1,%2
1640 [(set_attr "type" "fast_compare,compare,compare,compare")
1641 (set_attr "length" "4,4,8,8")])
1644 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1645 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "")
1646 (match_operand:P 2 "reg_or_short_operand" ""))
1648 (set (match_operand:P 0 "gpc_reg_operand" "")
1649 (plus:P (match_dup 1) (match_dup 2)))]
1652 (plus:P (match_dup 1)
1655 (compare:CC (match_dup 0)
1659 ;; Split an add that we can't do in one insn into two insns, each of which
1660 ;; does one 16-bit part. This is used by combine. Note that the low-order
1661 ;; add should be last in case the result gets used in an address.
1664 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
1665 (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1666 (match_operand:GPR 2 "non_add_cint_operand" "")))]
1668 [(set (match_dup 0) (plus:GPR (match_dup 1) (match_dup 3)))
1669 (set (match_dup 0) (plus:GPR (match_dup 0) (match_dup 4)))]
1671 HOST_WIDE_INT val = INTVAL (operands[2]);
1672 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1673 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, <MODE>mode);
1675 operands[4] = GEN_INT (low);
1676 if (<MODE>mode == SImode || satisfies_constraint_L (GEN_INT (rest)))
1677 operands[3] = GEN_INT (rest);
1678 else if (can_create_pseudo_p ())
1680 operands[3] = gen_reg_rtx (DImode);
1681 emit_move_insn (operands[3], operands[2]);
1682 emit_insn (gen_adddi3 (operands[0], operands[1], operands[3]));
1689 (define_insn "one_cmpl<mode>2"
1690 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1691 (not:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
1696 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1697 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1699 (clobber (match_scratch:P 2 "=r,r"))]
1704 [(set_attr "type" "fast_compare,compare")
1705 (set_attr "length" "4,8")])
1708 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
1709 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" ""))
1711 (clobber (match_scratch:P 2 ""))]
1714 (not:P (match_dup 1)))
1716 (compare:CC (match_dup 2)
1721 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1722 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1724 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
1725 (not:P (match_dup 1)))]
1730 [(set_attr "type" "fast_compare,compare")
1731 (set_attr "length" "4,8")])
1734 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
1735 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" ""))
1737 (set (match_operand:P 0 "gpc_reg_operand" "")
1738 (not:P (match_dup 1)))]
1741 (not:P (match_dup 1)))
1743 (compare:CC (match_dup 0)
1748 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1749 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "rI")
1750 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1752 "{sf%I1|subf%I1c} %0,%2,%1")
1755 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
1756 (minus:GPR (match_operand:GPR 1 "reg_or_short_operand" "r,I")
1757 (match_operand:GPR 2 "gpc_reg_operand" "r,r")))]
1764 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1765 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1766 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1768 (clobber (match_scratch:SI 3 "=r,r"))]
1771 {sf.|subfc.} %3,%2,%1
1773 [(set_attr "type" "compare")
1774 (set_attr "length" "4,8")])
1777 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1778 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "r,r")
1779 (match_operand:P 2 "gpc_reg_operand" "r,r"))
1781 (clobber (match_scratch:P 3 "=r,r"))]
1786 [(set_attr "type" "fast_compare")
1787 (set_attr "length" "4,8")])
1790 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1791 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "")
1792 (match_operand:P 2 "gpc_reg_operand" ""))
1794 (clobber (match_scratch:P 3 ""))]
1797 (minus:P (match_dup 1)
1800 (compare:CC (match_dup 3)
1805 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1806 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1807 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1809 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1810 (minus:SI (match_dup 1) (match_dup 2)))]
1813 {sf.|subfc.} %0,%2,%1
1815 [(set_attr "type" "compare")
1816 (set_attr "length" "4,8")])
1819 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1820 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "r,r")
1821 (match_operand:P 2 "gpc_reg_operand" "r,r"))
1823 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
1824 (minus:P (match_dup 1)
1830 [(set_attr "type" "fast_compare")
1831 (set_attr "length" "4,8")])
1834 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1835 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "")
1836 (match_operand:P 2 "gpc_reg_operand" ""))
1838 (set (match_operand:P 0 "gpc_reg_operand" "")
1839 (minus:P (match_dup 1)
1843 (minus:P (match_dup 1)
1846 (compare:CC (match_dup 0)
1850 (define_expand "sub<mode>3"
1851 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1852 (minus:SDI (match_operand:SDI 1 "reg_or_short_operand" "")
1853 (match_operand:SDI 2 "reg_or_sub_cint_operand" "")))]
1857 if (GET_CODE (operands[2]) == CONST_INT)
1859 emit_insn (gen_add<mode>3 (operands[0], operands[1],
1860 negate_rtx (<MODE>mode, operands[2])));
1865 ;; For SMIN, SMAX, UMIN, and UMAX, we use DEFINE_EXPAND's that involve a doz[i]
1866 ;; instruction and some auxiliary computations. Then we just have a single
1867 ;; DEFINE_INSN for doz[i] and the define_splits to make them if made by
1870 (define_expand "sminsi3"
1872 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1873 (match_operand:SI 2 "reg_or_short_operand" ""))
1875 (minus:SI (match_dup 2) (match_dup 1))))
1876 (set (match_operand:SI 0 "gpc_reg_operand" "")
1877 (minus:SI (match_dup 2) (match_dup 3)))]
1878 "TARGET_POWER || TARGET_ISEL"
1883 operands[2] = force_reg (SImode, operands[2]);
1884 rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]);
1888 operands[3] = gen_reg_rtx (SImode);
1892 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1893 (smin:SI (match_operand:SI 1 "gpc_reg_operand" "")
1894 (match_operand:SI 2 "reg_or_short_operand" "")))
1895 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1898 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1900 (minus:SI (match_dup 2) (match_dup 1))))
1901 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 3)))]
1904 (define_expand "smaxsi3"
1906 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1907 (match_operand:SI 2 "reg_or_short_operand" ""))
1909 (minus:SI (match_dup 2) (match_dup 1))))
1910 (set (match_operand:SI 0 "gpc_reg_operand" "")
1911 (plus:SI (match_dup 3) (match_dup 1)))]
1912 "TARGET_POWER || TARGET_ISEL"
1917 operands[2] = force_reg (SImode, operands[2]);
1918 rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]);
1921 operands[3] = gen_reg_rtx (SImode);
1925 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1926 (smax:SI (match_operand:SI 1 "gpc_reg_operand" "")
1927 (match_operand:SI 2 "reg_or_short_operand" "")))
1928 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1931 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1933 (minus:SI (match_dup 2) (match_dup 1))))
1934 (set (match_dup 0) (plus:SI (match_dup 3) (match_dup 1)))]
1937 (define_expand "uminsi3"
1938 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1940 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
1942 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
1944 (minus:SI (match_dup 4) (match_dup 3))))
1945 (set (match_operand:SI 0 "gpc_reg_operand" "")
1946 (minus:SI (match_dup 2) (match_dup 3)))]
1947 "TARGET_POWER || TARGET_ISEL"
1952 rs6000_emit_minmax (operands[0], UMIN, operands[1], operands[2]);
1955 operands[3] = gen_reg_rtx (SImode);
1956 operands[4] = gen_reg_rtx (SImode);
1957 operands[5] = GEN_INT (-2147483647 - 1);
1960 (define_expand "umaxsi3"
1961 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1963 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
1965 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
1967 (minus:SI (match_dup 4) (match_dup 3))))
1968 (set (match_operand:SI 0 "gpc_reg_operand" "")
1969 (plus:SI (match_dup 3) (match_dup 1)))]
1970 "TARGET_POWER || TARGET_ISEL"
1975 rs6000_emit_minmax (operands[0], UMAX, operands[1], operands[2]);
1978 operands[3] = gen_reg_rtx (SImode);
1979 operands[4] = gen_reg_rtx (SImode);
1980 operands[5] = GEN_INT (-2147483647 - 1);
1984 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1985 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r")
1986 (match_operand:SI 2 "reg_or_short_operand" "rI"))
1988 (minus:SI (match_dup 2) (match_dup 1))))]
1993 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1995 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
1996 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
1998 (minus:SI (match_dup 2) (match_dup 1)))
2000 (clobber (match_scratch:SI 3 "=r,r"))]
2005 [(set_attr "type" "delayed_compare")
2006 (set_attr "length" "4,8")])
2009 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2011 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "")
2012 (match_operand:SI 2 "reg_or_short_operand" ""))
2014 (minus:SI (match_dup 2) (match_dup 1)))
2016 (clobber (match_scratch:SI 3 ""))]
2017 "TARGET_POWER && reload_completed"
2019 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
2021 (minus:SI (match_dup 2) (match_dup 1))))
2023 (compare:CC (match_dup 3)
2028 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2030 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
2031 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
2033 (minus:SI (match_dup 2) (match_dup 1)))
2035 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2036 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
2038 (minus:SI (match_dup 2) (match_dup 1))))]
2043 [(set_attr "type" "delayed_compare")
2044 (set_attr "length" "4,8")])
2047 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2049 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "")
2050 (match_operand:SI 2 "reg_or_short_operand" ""))
2052 (minus:SI (match_dup 2) (match_dup 1)))
2054 (set (match_operand:SI 0 "gpc_reg_operand" "")
2055 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
2057 (minus:SI (match_dup 2) (match_dup 1))))]
2058 "TARGET_POWER && reload_completed"
2060 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
2062 (minus:SI (match_dup 2) (match_dup 1))))
2064 (compare:CC (match_dup 0)
2068 ;; We don't need abs with condition code because such comparisons should
2070 (define_expand "abssi2"
2071 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2072 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))]
2078 emit_insn (gen_abssi2_isel (operands[0], operands[1]));
2081 else if (! TARGET_POWER)
2083 emit_insn (gen_abssi2_nopower (operands[0], operands[1]));
2088 (define_insn "*abssi2_power"
2089 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2090 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
2094 (define_insn_and_split "abs<mode>2_isel"
2095 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2096 (abs:GPR (match_operand:GPR 1 "gpc_reg_operand" "b")))
2097 (clobber (match_scratch:GPR 2 "=&b"))
2098 (clobber (match_scratch:CC 3 "=y"))]
2101 "&& reload_completed"
2102 [(set (match_dup 2) (neg:GPR (match_dup 1)))
2104 (compare:CC (match_dup 1)
2107 (if_then_else:GPR (ge (match_dup 3)
2113 (define_insn_and_split "nabs<mode>2_isel"
2114 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2115 (neg:GPR (abs:GPR (match_operand:GPR 1 "gpc_reg_operand" "b"))))
2116 (clobber (match_scratch:GPR 2 "=&b"))
2117 (clobber (match_scratch:CC 3 "=y"))]
2120 "&& reload_completed"
2121 [(set (match_dup 2) (neg:GPR (match_dup 1)))
2123 (compare:CC (match_dup 1)
2126 (if_then_else:GPR (ge (match_dup 3)
2132 (define_insn_and_split "abssi2_nopower"
2133 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
2134 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0")))
2135 (clobber (match_scratch:SI 2 "=&r,&r"))]
2136 "! TARGET_POWER && ! TARGET_ISEL"
2138 "&& reload_completed"
2139 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
2140 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
2141 (set (match_dup 0) (minus:SI (match_dup 0) (match_dup 2)))]
2144 (define_insn "*nabs_power"
2145 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2146 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r"))))]
2150 (define_insn_and_split "*nabs_nopower"
2151 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
2152 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0"))))
2153 (clobber (match_scratch:SI 2 "=&r,&r"))]
2156 "&& reload_completed"
2157 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
2158 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
2159 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 0)))]
2162 (define_expand "neg<mode>2"
2163 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
2164 (neg:SDI (match_operand:SDI 1 "gpc_reg_operand" "")))]
2168 (define_insn "*neg<mode>2_internal"
2169 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2170 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
2175 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2176 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
2178 (clobber (match_scratch:P 2 "=r,r"))]
2183 [(set_attr "type" "fast_compare")
2184 (set_attr "length" "4,8")])
2187 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2188 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" ""))
2190 (clobber (match_scratch:P 2 ""))]
2193 (neg:P (match_dup 1)))
2195 (compare:CC (match_dup 2)
2200 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
2201 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
2203 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
2204 (neg:P (match_dup 1)))]
2209 [(set_attr "type" "fast_compare")
2210 (set_attr "length" "4,8")])
2213 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
2214 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" ""))
2216 (set (match_operand:P 0 "gpc_reg_operand" "")
2217 (neg:P (match_dup 1)))]
2220 (neg:P (match_dup 1)))
2222 (compare:CC (match_dup 0)
2226 (define_insn "clz<mode>2"
2227 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2228 (clz:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
2230 "{cntlz|cntlz<wd>} %0,%1"
2231 [(set_attr "type" "cntlz")])
2233 (define_expand "ctz<mode>2"
2235 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))
2236 (parallel [(set (match_dup 3) (and:GPR (match_dup 1)
2238 (clobber (scratch:CC))])
2239 (set (match_dup 4) (clz:GPR (match_dup 3)))
2240 (set (match_operand:GPR 0 "gpc_reg_operand" "")
2241 (minus:GPR (match_dup 5) (match_dup 4)))]
2244 operands[2] = gen_reg_rtx (<MODE>mode);
2245 operands[3] = gen_reg_rtx (<MODE>mode);
2246 operands[4] = gen_reg_rtx (<MODE>mode);
2247 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode) - 1);
2250 (define_expand "ffs<mode>2"
2252 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))
2253 (parallel [(set (match_dup 3) (and:GPR (match_dup 1)
2255 (clobber (scratch:CC))])
2256 (set (match_dup 4) (clz:GPR (match_dup 3)))
2257 (set (match_operand:GPR 0 "gpc_reg_operand" "")
2258 (minus:GPR (match_dup 5) (match_dup 4)))]
2261 operands[2] = gen_reg_rtx (<MODE>mode);
2262 operands[3] = gen_reg_rtx (<MODE>mode);
2263 operands[4] = gen_reg_rtx (<MODE>mode);
2264 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode));
2267 (define_insn "popcntb<mode>2"
2268 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2269 (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")]
2274 (define_insn "popcntwsi2"
2275 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2276 (popcount:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
2280 (define_insn "popcntddi2"
2281 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
2282 (popcount:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
2283 "TARGET_POPCNTD && TARGET_POWERPC64"
2286 (define_expand "popcount<mode>2"
2287 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2288 (popcount:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))]
2289 "TARGET_POPCNTB || TARGET_POPCNTD"
2291 rs6000_emit_popcount (operands[0], operands[1]);
2295 (define_expand "parity<mode>2"
2296 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2297 (parity:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))]
2300 rs6000_emit_parity (operands[0], operands[1]);
2304 ;; Since the hardware zeros the upper part of the register, save generating the
2305 ;; AND immediate if we are converting to unsigned
2306 (define_insn "*bswaphi2_extenddi"
2307 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
2309 (bswap:HI (match_operand:HI 1 "memory_operand" "Z"))))]
2312 [(set_attr "length" "4")
2313 (set_attr "type" "load")])
2315 (define_insn "*bswaphi2_extendsi"
2316 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2318 (bswap:HI (match_operand:HI 1 "memory_operand" "Z"))))]
2321 [(set_attr "length" "4")
2322 (set_attr "type" "load")])
2324 (define_expand "bswaphi2"
2325 [(parallel [(set (match_operand:HI 0 "reg_or_mem_operand" "")
2327 (match_operand:HI 1 "reg_or_mem_operand" "")))
2328 (clobber (match_scratch:SI 2 ""))])]
2331 if (!REG_P (operands[0]) && !REG_P (operands[1]))
2332 operands[1] = force_reg (HImode, operands[1]);
2335 (define_insn "bswaphi2_internal"
2336 [(set (match_operand:HI 0 "reg_or_mem_operand" "=r,Z,&r")
2338 (match_operand:HI 1 "reg_or_mem_operand" "Z,r,r")))
2339 (clobber (match_scratch:SI 2 "=X,X,&r"))]
2345 [(set_attr "length" "4,4,12")
2346 (set_attr "type" "load,store,*")])
2349 [(set (match_operand:HI 0 "gpc_reg_operand" "")
2350 (bswap:HI (match_operand:HI 1 "gpc_reg_operand" "")))
2351 (clobber (match_operand:SI 2 "gpc_reg_operand" ""))]
2352 "TARGET_POWERPC && reload_completed"
2354 (zero_extract:SI (match_dup 4)
2358 (and:SI (ashift:SI (match_dup 4)
2360 (const_int 65280))) ;; 0xff00
2362 (ior:SI (match_dup 3)
2366 operands[3] = simplify_gen_subreg (SImode, operands[0], HImode, 0);
2367 operands[4] = simplify_gen_subreg (SImode, operands[1], HImode, 0);
2370 (define_insn "*bswapsi2_extenddi"
2371 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
2373 (bswap:SI (match_operand:SI 1 "memory_operand" "Z"))))]
2376 [(set_attr "length" "4")
2377 (set_attr "type" "load")])
2379 (define_expand "bswapsi2"
2380 [(set (match_operand:SI 0 "reg_or_mem_operand" "")
2382 (match_operand:SI 1 "reg_or_mem_operand" "")))]
2385 if (!REG_P (operands[0]) && !REG_P (operands[1]))
2386 operands[1] = force_reg (SImode, operands[1]);
2389 (define_insn "*bswapsi2_internal"
2390 [(set (match_operand:SI 0 "reg_or_mem_operand" "=r,Z,&r")
2392 (match_operand:SI 1 "reg_or_mem_operand" "Z,r,r")))]
2396 {stbrx|stwbrx} %1,%y0
2398 [(set_attr "length" "4,4,12")
2399 (set_attr "type" "load,store,*")])
2402 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2403 (bswap:SI (match_operand:SI 1 "gpc_reg_operand" "")))]
2406 (rotate:SI (match_dup 1) (const_int 8)))
2407 (set (zero_extract:SI (match_dup 0)
2411 (set (zero_extract:SI (match_dup 0)
2414 (rotate:SI (match_dup 1)
2418 (define_expand "bswapdi2"
2419 [(parallel [(set (match_operand:DI 0 "reg_or_mem_operand" "")
2421 (match_operand:DI 1 "reg_or_mem_operand" "")))
2422 (clobber (match_scratch:DI 2 ""))
2423 (clobber (match_scratch:DI 3 ""))
2424 (clobber (match_scratch:DI 4 ""))])]
2427 if (!REG_P (operands[0]) && !REG_P (operands[1]))
2428 operands[1] = force_reg (DImode, operands[1]);
2430 if (!TARGET_POWERPC64)
2432 /* 32-bit mode needs fewer scratch registers, but 32-bit addressing mode
2433 that uses 64-bit registers needs the same scratch registers as 64-bit
2435 emit_insn (gen_bswapdi2_32bit (operands[0], operands[1]));
2440 ;; Power7/cell has ldbrx/stdbrx, so use it directly
2441 (define_insn "*bswapdi2_ldbrx"
2442 [(set (match_operand:DI 0 "reg_or_mem_operand" "=&r,Z,??&r")
2443 (bswap:DI (match_operand:DI 1 "reg_or_mem_operand" "Z,r,r")))
2444 (clobber (match_scratch:DI 2 "=X,X,&r"))
2445 (clobber (match_scratch:DI 3 "=X,X,&r"))
2446 (clobber (match_scratch:DI 4 "=X,X,&r"))]
2447 "TARGET_POWERPC64 && TARGET_LDBRX
2448 && (REG_P (operands[0]) || REG_P (operands[1]))"
2453 [(set_attr "length" "4,4,36")
2454 (set_attr "type" "load,store,*")])
2456 ;; Non-power7/cell, fall back to use lwbrx/stwbrx
2457 (define_insn "*bswapdi2_64bit"
2458 [(set (match_operand:DI 0 "reg_or_mem_operand" "=&r,Z,??&r")
2459 (bswap:DI (match_operand:DI 1 "reg_or_mem_operand" "Z,r,r")))
2460 (clobber (match_scratch:DI 2 "=&b,&b,&r"))
2461 (clobber (match_scratch:DI 3 "=&r,&r,&r"))
2462 (clobber (match_scratch:DI 4 "=&r,X,&r"))]
2463 "TARGET_POWERPC64 && !TARGET_LDBRX
2464 && (REG_P (operands[0]) || REG_P (operands[1]))"
2466 [(set_attr "length" "16,12,36")])
2469 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2470 (bswap:DI (match_operand:DI 1 "indexed_or_indirect_operand" "")))
2471 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
2472 (clobber (match_operand:DI 3 "gpc_reg_operand" ""))
2473 (clobber (match_operand:DI 4 "gpc_reg_operand" ""))]
2474 "TARGET_POWERPC64 && !TARGET_LDBRX && reload_completed"
2478 rtx dest = operands[0];
2479 rtx src = operands[1];
2480 rtx op2 = operands[2];
2481 rtx op3 = operands[3];
2482 rtx op4 = operands[4];
2483 rtx op3_32 = simplify_gen_subreg (SImode, op3, DImode, 4);
2484 rtx op4_32 = simplify_gen_subreg (SImode, op4, DImode, 4);
2490 addr1 = XEXP (src, 0);
2491 if (GET_CODE (addr1) == PLUS)
2493 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2494 addr2 = gen_rtx_PLUS (Pmode, op2, XEXP (addr1, 1));
2498 emit_move_insn (op2, GEN_INT (4));
2499 addr2 = gen_rtx_PLUS (Pmode, op2, addr1);
2502 if (BYTES_BIG_ENDIAN)
2504 word_high = change_address (src, SImode, addr1);
2505 word_low = change_address (src, SImode, addr2);
2509 word_high = change_address (src, SImode, addr2);
2510 word_low = change_address (src, SImode, addr1);
2513 emit_insn (gen_bswapsi2 (op3_32, word_low));
2514 emit_insn (gen_bswapsi2 (op4_32, word_high));
2515 emit_insn (gen_ashldi3 (dest, op3, GEN_INT (32)));
2516 emit_insn (gen_iordi3 (dest, dest, op4));
2520 [(set (match_operand:DI 0 "indexed_or_indirect_operand" "")
2521 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2522 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
2523 (clobber (match_operand:DI 3 "gpc_reg_operand" ""))
2524 (clobber (match_operand:DI 4 "" ""))]
2525 "TARGET_POWERPC64 && !TARGET_LDBRX && reload_completed"
2529 rtx dest = operands[0];
2530 rtx src = operands[1];
2531 rtx op2 = operands[2];
2532 rtx op3 = operands[3];
2533 rtx src_si = simplify_gen_subreg (SImode, src, DImode, 4);
2534 rtx op3_si = simplify_gen_subreg (SImode, op3, DImode, 4);
2540 addr1 = XEXP (dest, 0);
2541 if (GET_CODE (addr1) == PLUS)
2543 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2544 addr2 = gen_rtx_PLUS (Pmode, op2, XEXP (addr1, 1));
2548 emit_move_insn (op2, GEN_INT (4));
2549 addr2 = gen_rtx_PLUS (Pmode, op2, addr1);
2552 emit_insn (gen_lshrdi3 (op3, src, GEN_INT (32)));
2553 if (BYTES_BIG_ENDIAN)
2555 word_high = change_address (dest, SImode, addr1);
2556 word_low = change_address (dest, SImode, addr2);
2557 emit_insn (gen_bswapsi2 (word_high, src_si));
2558 emit_insn (gen_bswapsi2 (word_low, op3_si));
2562 word_high = change_address (dest, SImode, addr2);
2563 word_low = change_address (dest, SImode, addr1);
2564 emit_insn (gen_bswapsi2 (word_low, src_si));
2565 emit_insn (gen_bswapsi2 (word_high, op3_si));
2570 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2571 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2572 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
2573 (clobber (match_operand:DI 3 "gpc_reg_operand" ""))
2574 (clobber (match_operand:DI 4 "" ""))]
2575 "TARGET_POWERPC64 && reload_completed"
2579 rtx dest = operands[0];
2580 rtx src = operands[1];
2581 rtx op2 = operands[2];
2582 rtx op3 = operands[3];
2583 rtx dest_si = simplify_gen_subreg (SImode, dest, DImode, 4);
2584 rtx src_si = simplify_gen_subreg (SImode, src, DImode, 4);
2585 rtx op2_si = simplify_gen_subreg (SImode, op2, DImode, 4);
2586 rtx op3_si = simplify_gen_subreg (SImode, op3, DImode, 4);
2588 emit_insn (gen_lshrdi3 (op2, src, GEN_INT (32)));
2589 emit_insn (gen_bswapsi2 (dest_si, src_si));
2590 emit_insn (gen_bswapsi2 (op3_si, op2_si));
2591 emit_insn (gen_ashldi3 (dest, dest, GEN_INT (32)));
2592 emit_insn (gen_iordi3 (dest, dest, op3));
2595 (define_insn "bswapdi2_32bit"
2596 [(set (match_operand:DI 0 "reg_or_mem_operand" "=&r,Z,??&r")
2597 (bswap:DI (match_operand:DI 1 "reg_or_mem_operand" "Z,r,r")))
2598 (clobber (match_scratch:SI 2 "=&b,&b,X"))]
2599 "!TARGET_POWERPC64 && (REG_P (operands[0]) || REG_P (operands[1]))"
2601 [(set_attr "length" "16,12,36")])
2604 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2605 (bswap:DI (match_operand:DI 1 "indexed_or_indirect_operand" "")))
2606 (clobber (match_operand:SI 2 "gpc_reg_operand" ""))]
2607 "!TARGET_POWERPC64 && reload_completed"
2611 rtx dest = operands[0];
2612 rtx src = operands[1];
2613 rtx op2 = operands[2];
2614 rtx dest_hi = simplify_gen_subreg (SImode, dest, DImode, 0);
2615 rtx dest_lo = simplify_gen_subreg (SImode, dest, DImode, 4);
2621 addr1 = XEXP (src, 0);
2622 if (GET_CODE (addr1) == PLUS)
2624 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2625 addr2 = gen_rtx_PLUS (SImode, op2, XEXP (addr1, 1));
2629 emit_move_insn (op2, GEN_INT (4));
2630 addr2 = gen_rtx_PLUS (SImode, op2, addr1);
2633 if (BYTES_BIG_ENDIAN)
2635 word_high = change_address (src, SImode, addr1);
2636 word_low = change_address (src, SImode, addr2);
2640 word_high = change_address (src, SImode, addr2);
2641 word_low = change_address (src, SImode, addr1);
2644 emit_insn (gen_bswapsi2 (dest_hi, word_low));
2645 emit_insn (gen_bswapsi2 (dest_lo, word_high));
2649 [(set (match_operand:DI 0 "indexed_or_indirect_operand" "")
2650 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2651 (clobber (match_operand:SI 2 "gpc_reg_operand" ""))]
2652 "!TARGET_POWERPC64 && reload_completed"
2656 rtx dest = operands[0];
2657 rtx src = operands[1];
2658 rtx op2 = operands[2];
2659 rtx src_high = simplify_gen_subreg (SImode, src, DImode, 0);
2660 rtx src_low = simplify_gen_subreg (SImode, src, DImode, 4);
2666 addr1 = XEXP (dest, 0);
2667 if (GET_CODE (addr1) == PLUS)
2669 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2670 addr2 = gen_rtx_PLUS (SImode, op2, XEXP (addr1, 1));
2674 emit_move_insn (op2, GEN_INT (4));
2675 addr2 = gen_rtx_PLUS (SImode, op2, addr1);
2678 if (BYTES_BIG_ENDIAN)
2680 word_high = change_address (dest, SImode, addr1);
2681 word_low = change_address (dest, SImode, addr2);
2685 word_high = change_address (dest, SImode, addr2);
2686 word_low = change_address (dest, SImode, addr1);
2689 emit_insn (gen_bswapsi2 (word_high, src_low));
2690 emit_insn (gen_bswapsi2 (word_low, src_high));
2694 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2695 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2696 (clobber (match_operand:SI 2 "" ""))]
2697 "!TARGET_POWERPC64 && reload_completed"
2701 rtx dest = operands[0];
2702 rtx src = operands[1];
2703 rtx src_high = simplify_gen_subreg (SImode, src, DImode, 0);
2704 rtx src_low = simplify_gen_subreg (SImode, src, DImode, 4);
2705 rtx dest_high = simplify_gen_subreg (SImode, dest, DImode, 0);
2706 rtx dest_low = simplify_gen_subreg (SImode, dest, DImode, 4);
2708 emit_insn (gen_bswapsi2 (dest_high, src_low));
2709 emit_insn (gen_bswapsi2 (dest_low, src_high));
2712 (define_expand "mulsi3"
2713 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
2714 (use (match_operand:SI 1 "gpc_reg_operand" ""))
2715 (use (match_operand:SI 2 "reg_or_short_operand" ""))]
2720 emit_insn (gen_mulsi3_mq (operands[0], operands[1], operands[2]));
2722 emit_insn (gen_mulsi3_no_mq (operands[0], operands[1], operands[2]));
2726 (define_insn "mulsi3_mq"
2727 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2728 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2729 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
2730 (clobber (match_scratch:SI 3 "=q,q"))]
2733 {muls|mullw} %0,%1,%2
2734 {muli|mulli} %0,%1,%2"
2736 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
2737 (const_string "imul3")
2738 (match_operand:SI 2 "short_cint_operand" "")
2739 (const_string "imul2")]
2740 (const_string "imul")))])
2742 (define_insn "mulsi3_no_mq"
2743 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2744 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2745 (match_operand:SI 2 "reg_or_short_operand" "r,I")))]
2748 {muls|mullw} %0,%1,%2
2749 {muli|mulli} %0,%1,%2"
2751 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
2752 (const_string "imul3")
2753 (match_operand:SI 2 "short_cint_operand" "")
2754 (const_string "imul2")]
2755 (const_string "imul")))])
2757 (define_insn "*mulsi3_mq_internal1"
2758 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2759 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2760 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2762 (clobber (match_scratch:SI 3 "=r,r"))
2763 (clobber (match_scratch:SI 4 "=q,q"))]
2766 {muls.|mullw.} %3,%1,%2
2768 [(set_attr "type" "imul_compare")
2769 (set_attr "length" "4,8")])
2772 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2773 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2774 (match_operand:SI 2 "gpc_reg_operand" ""))
2776 (clobber (match_scratch:SI 3 ""))
2777 (clobber (match_scratch:SI 4 ""))]
2778 "TARGET_POWER && reload_completed"
2779 [(parallel [(set (match_dup 3)
2780 (mult:SI (match_dup 1) (match_dup 2)))
2781 (clobber (match_dup 4))])
2783 (compare:CC (match_dup 3)
2787 (define_insn "*mulsi3_no_mq_internal1"
2788 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2789 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2790 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2792 (clobber (match_scratch:SI 3 "=r,r"))]
2795 {muls.|mullw.} %3,%1,%2
2797 [(set_attr "type" "imul_compare")
2798 (set_attr "length" "4,8")])
2801 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
2802 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2803 (match_operand:SI 2 "gpc_reg_operand" ""))
2805 (clobber (match_scratch:SI 3 ""))]
2806 "! TARGET_POWER && reload_completed"
2808 (mult:SI (match_dup 1) (match_dup 2)))
2810 (compare:CC (match_dup 3)
2814 (define_insn "*mulsi3_mq_internal2"
2815 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2816 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2817 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2819 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2820 (mult:SI (match_dup 1) (match_dup 2)))
2821 (clobber (match_scratch:SI 4 "=q,q"))]
2824 {muls.|mullw.} %0,%1,%2
2826 [(set_attr "type" "imul_compare")
2827 (set_attr "length" "4,8")])
2830 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2831 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2832 (match_operand:SI 2 "gpc_reg_operand" ""))
2834 (set (match_operand:SI 0 "gpc_reg_operand" "")
2835 (mult:SI (match_dup 1) (match_dup 2)))
2836 (clobber (match_scratch:SI 4 ""))]
2837 "TARGET_POWER && reload_completed"
2838 [(parallel [(set (match_dup 0)
2839 (mult:SI (match_dup 1) (match_dup 2)))
2840 (clobber (match_dup 4))])
2842 (compare:CC (match_dup 0)
2846 (define_insn "*mulsi3_no_mq_internal2"
2847 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2848 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2849 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2851 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2852 (mult:SI (match_dup 1) (match_dup 2)))]
2855 {muls.|mullw.} %0,%1,%2
2857 [(set_attr "type" "imul_compare")
2858 (set_attr "length" "4,8")])
2861 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
2862 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2863 (match_operand:SI 2 "gpc_reg_operand" ""))
2865 (set (match_operand:SI 0 "gpc_reg_operand" "")
2866 (mult:SI (match_dup 1) (match_dup 2)))]
2867 "! TARGET_POWER && reload_completed"
2869 (mult:SI (match_dup 1) (match_dup 2)))
2871 (compare:CC (match_dup 0)
2875 ;; Operand 1 is divided by operand 2; quotient goes to operand
2876 ;; 0 and remainder to operand 3.
2877 ;; ??? At some point, see what, if anything, we can do about if (x % y == 0).
2879 (define_expand "divmodsi4"
2880 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
2881 (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
2882 (match_operand:SI 2 "gpc_reg_operand" "")))
2883 (set (match_operand:SI 3 "register_operand" "")
2884 (mod:SI (match_dup 1) (match_dup 2)))])]
2885 "TARGET_POWER || (! TARGET_POWER && ! TARGET_POWERPC)"
2888 if (! TARGET_POWER && ! TARGET_POWERPC)
2890 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2891 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2892 emit_insn (gen_divss_call ());
2893 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2894 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
2899 (define_insn "*divmodsi4_internal"
2900 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2901 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2902 (match_operand:SI 2 "gpc_reg_operand" "r")))
2903 (set (match_operand:SI 3 "register_operand" "=q")
2904 (mod:SI (match_dup 1) (match_dup 2)))]
2907 [(set_attr "type" "idiv")])
2909 (define_expand "udiv<mode>3"
2910 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2911 (udiv:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2912 (match_operand:GPR 2 "gpc_reg_operand" "")))]
2913 "TARGET_POWERPC || (! TARGET_POWER && ! TARGET_POWERPC)"
2916 if (! TARGET_POWER && ! TARGET_POWERPC)
2918 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2919 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2920 emit_insn (gen_quous_call ());
2921 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2924 else if (TARGET_POWER)
2926 emit_insn (gen_udivsi3_mq (operands[0], operands[1], operands[2]));
2931 (define_insn "udivsi3_mq"
2932 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2933 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2934 (match_operand:SI 2 "gpc_reg_operand" "r")))
2935 (clobber (match_scratch:SI 3 "=q"))]
2936 "TARGET_POWERPC && TARGET_POWER"
2938 [(set_attr "type" "idiv")])
2940 (define_insn "*udivsi3_no_mq"
2941 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2942 (udiv:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2943 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
2944 "TARGET_POWERPC && ! TARGET_POWER"
2947 (cond [(match_operand:SI 0 "" "")
2948 (const_string "idiv")]
2949 (const_string "ldiv")))])
2952 ;; For powers of two we can do srai/aze for divide and then adjust for
2953 ;; modulus. If it isn't a power of two, FAIL on POWER so divmodsi4 will be
2954 ;; used; for PowerPC, force operands into register and do a normal divide;
2955 ;; for AIX common-mode, use quoss call on register operands.
2956 (define_expand "div<mode>3"
2957 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2958 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2959 (match_operand:GPR 2 "reg_or_cint_operand" "")))]
2963 if (GET_CODE (operands[2]) == CONST_INT
2964 && INTVAL (operands[2]) > 0
2965 && exact_log2 (INTVAL (operands[2])) >= 0)
2967 else if (TARGET_POWERPC)
2969 operands[2] = force_reg (<MODE>mode, operands[2]);
2972 emit_insn (gen_divsi3_mq (operands[0], operands[1], operands[2]));
2976 else if (TARGET_POWER)
2980 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2981 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2982 emit_insn (gen_quoss_call ());
2983 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2988 (define_insn "divsi3_mq"
2989 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2990 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2991 (match_operand:SI 2 "gpc_reg_operand" "r")))
2992 (clobber (match_scratch:SI 3 "=q"))]
2993 "TARGET_POWERPC && TARGET_POWER"
2995 [(set_attr "type" "idiv")])
2997 (define_insn "*div<mode>3_no_mq"
2998 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2999 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
3000 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
3001 "TARGET_POWERPC && ! TARGET_POWER"
3004 (cond [(match_operand:SI 0 "" "")
3005 (const_string "idiv")]
3006 (const_string "ldiv")))])
3008 (define_expand "mod<mode>3"
3009 [(use (match_operand:GPR 0 "gpc_reg_operand" ""))
3010 (use (match_operand:GPR 1 "gpc_reg_operand" ""))
3011 (use (match_operand:GPR 2 "reg_or_cint_operand" ""))]
3019 if (GET_CODE (operands[2]) != CONST_INT
3020 || INTVAL (operands[2]) <= 0
3021 || (i = exact_log2 (INTVAL (operands[2]))) < 0)
3024 temp1 = gen_reg_rtx (<MODE>mode);
3025 temp2 = gen_reg_rtx (<MODE>mode);
3027 emit_insn (gen_div<mode>3 (temp1, operands[1], operands[2]));
3028 emit_insn (gen_ashl<mode>3 (temp2, temp1, GEN_INT (i)));
3029 emit_insn (gen_sub<mode>3 (operands[0], operands[1], temp2));
3034 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
3035 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
3036 (match_operand:GPR 2 "exact_log2_cint_operand" "N")))]
3038 "{srai|sra<wd>i} %0,%1,%p2\;{aze|addze} %0,%0"
3039 [(set_attr "type" "two")
3040 (set_attr "length" "8")])
3043 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3044 (compare:CC (div:P (match_operand:P 1 "gpc_reg_operand" "r,r")
3045 (match_operand:P 2 "exact_log2_cint_operand" "N,N"))
3047 (clobber (match_scratch:P 3 "=r,r"))]
3050 {srai|sra<wd>i} %3,%1,%p2\;{aze.|addze.} %3,%3
3052 [(set_attr "type" "compare")
3053 (set_attr "length" "8,12")
3054 (set_attr "cell_micro" "not")])
3057 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3058 (compare:CC (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
3059 (match_operand:GPR 2 "exact_log2_cint_operand"
3062 (clobber (match_scratch:GPR 3 ""))]
3065 (div:<MODE> (match_dup 1) (match_dup 2)))
3067 (compare:CC (match_dup 3)
3072 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3073 (compare:CC (div:P (match_operand:P 1 "gpc_reg_operand" "r,r")
3074 (match_operand:P 2 "exact_log2_cint_operand" "N,N"))
3076 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
3077 (div:P (match_dup 1) (match_dup 2)))]
3080 {srai|sra<wd>i} %0,%1,%p2\;{aze.|addze.} %0,%0
3082 [(set_attr "type" "compare")
3083 (set_attr "length" "8,12")
3084 (set_attr "cell_micro" "not")])
3087 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3088 (compare:CC (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
3089 (match_operand:GPR 2 "exact_log2_cint_operand"
3092 (set (match_operand:GPR 0 "gpc_reg_operand" "")
3093 (div:GPR (match_dup 1) (match_dup 2)))]
3096 (div:<MODE> (match_dup 1) (match_dup 2)))
3098 (compare:CC (match_dup 0)
3103 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3106 (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
3108 (zero_extend:DI (match_operand:SI 4 "register_operand" "2")))
3109 (match_operand:SI 3 "gpc_reg_operand" "r")))
3110 (set (match_operand:SI 2 "register_operand" "=*q")
3113 (zero_extend:DI (match_dup 1)) (const_int 32))
3114 (zero_extend:DI (match_dup 4)))
3118 [(set_attr "type" "idiv")])
3120 ;; To do unsigned divide we handle the cases of the divisor looking like a
3121 ;; negative number. If it is a constant that is less than 2**31, we don't
3122 ;; have to worry about the branches. So make a few subroutines here.
3124 ;; First comes the normal case.
3125 (define_expand "udivmodsi4_normal"
3126 [(set (match_dup 4) (const_int 0))
3127 (parallel [(set (match_operand:SI 0 "" "")
3128 (udiv:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
3130 (zero_extend:DI (match_operand:SI 1 "" "")))
3131 (match_operand:SI 2 "" "")))
3132 (set (match_operand:SI 3 "" "")
3133 (umod:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
3135 (zero_extend:DI (match_dup 1)))
3139 { operands[4] = gen_reg_rtx (SImode); }")
3141 ;; This handles the branches.
3142 (define_expand "udivmodsi4_tests"
3143 [(set (match_operand:SI 0 "" "") (const_int 0))
3144 (set (match_operand:SI 3 "" "") (match_operand:SI 1 "" ""))
3145 (set (match_dup 5) (compare:CCUNS (match_dup 1) (match_operand:SI 2 "" "")))
3146 (set (pc) (if_then_else (ltu (match_dup 5) (const_int 0))
3147 (label_ref (match_operand:SI 4 "" "")) (pc)))
3148 (set (match_dup 0) (const_int 1))
3149 (set (match_dup 3) (minus:SI (match_dup 1) (match_dup 2)))
3150 (set (match_dup 6) (compare:CC (match_dup 2) (const_int 0)))
3151 (set (pc) (if_then_else (lt (match_dup 6) (const_int 0))
3152 (label_ref (match_dup 4)) (pc)))]
3155 { operands[5] = gen_reg_rtx (CCUNSmode);
3156 operands[6] = gen_reg_rtx (CCmode);
3159 (define_expand "udivmodsi4"
3160 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
3161 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "")
3162 (match_operand:SI 2 "reg_or_cint_operand" "")))
3163 (set (match_operand:SI 3 "gpc_reg_operand" "")
3164 (umod:SI (match_dup 1) (match_dup 2)))])]
3172 if (! TARGET_POWERPC)
3174 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
3175 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
3176 emit_insn (gen_divus_call ());
3177 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
3178 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
3185 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) < 0)
3187 operands[2] = force_reg (SImode, operands[2]);
3188 label = gen_label_rtx ();
3189 emit (gen_udivmodsi4_tests (operands[0], operands[1], operands[2],
3190 operands[3], label));
3193 operands[2] = force_reg (SImode, operands[2]);
3195 emit (gen_udivmodsi4_normal (operands[0], operands[1], operands[2],
3203 ;; AIX architecture-independent common-mode multiply (DImode),
3204 ;; divide/modulus, and quotient subroutine calls. Input operands in R3 and
3205 ;; R4; results in R3 and sometimes R4; link register always clobbered by bla
3206 ;; instruction; R0 sometimes clobbered; also, MQ sometimes clobbered but
3207 ;; assumed unused if generating common-mode, so ignore.
3208 (define_insn "mulh_call"
3211 (lshiftrt:DI (mult:DI (sign_extend:DI (reg:SI 3))
3212 (sign_extend:DI (reg:SI 4)))
3214 (clobber (reg:SI LR_REGNO))]
3215 "! TARGET_POWER && ! TARGET_POWERPC"
3217 [(set_attr "type" "imul")])
3219 (define_insn "mull_call"
3221 (mult:DI (sign_extend:DI (reg:SI 3))
3222 (sign_extend:DI (reg:SI 4))))
3223 (clobber (reg:SI LR_REGNO))
3224 (clobber (reg:SI 0))]
3225 "! TARGET_POWER && ! TARGET_POWERPC"
3227 [(set_attr "type" "imul")])
3229 (define_insn "divss_call"
3231 (div:SI (reg:SI 3) (reg:SI 4)))
3233 (mod:SI (reg:SI 3) (reg:SI 4)))
3234 (clobber (reg:SI LR_REGNO))
3235 (clobber (reg:SI 0))]
3236 "! TARGET_POWER && ! TARGET_POWERPC"
3238 [(set_attr "type" "idiv")])
3240 (define_insn "divus_call"
3242 (udiv:SI (reg:SI 3) (reg:SI 4)))
3244 (umod:SI (reg:SI 3) (reg:SI 4)))
3245 (clobber (reg:SI LR_REGNO))
3246 (clobber (reg:SI 0))
3247 (clobber (match_scratch:CC 0 "=x"))
3248 (clobber (reg:CC CR1_REGNO))]
3249 "! TARGET_POWER && ! TARGET_POWERPC"
3251 [(set_attr "type" "idiv")])
3253 (define_insn "quoss_call"
3255 (div:SI (reg:SI 3) (reg:SI 4)))
3256 (clobber (reg:SI LR_REGNO))]
3257 "! TARGET_POWER && ! TARGET_POWERPC"
3259 [(set_attr "type" "idiv")])
3261 (define_insn "quous_call"
3263 (udiv:SI (reg:SI 3) (reg:SI 4)))
3264 (clobber (reg:SI LR_REGNO))
3265 (clobber (reg:SI 0))
3266 (clobber (match_scratch:CC 0 "=x"))
3267 (clobber (reg:CC CR1_REGNO))]
3268 "! TARGET_POWER && ! TARGET_POWERPC"
3270 [(set_attr "type" "idiv")])
3272 ;; Logical instructions
3273 ;; The logical instructions are mostly combined by using match_operator,
3274 ;; but the plain AND insns are somewhat different because there is no
3275 ;; plain 'andi' (only 'andi.'), no plain 'andis', and there are all
3276 ;; those rotate-and-mask operations. Thus, the AND insns come first.
3278 (define_expand "andsi3"
3280 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3281 (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
3282 (match_operand:SI 2 "and_operand" "")))
3283 (clobber (match_scratch:CC 3 ""))])]
3287 (define_insn "andsi3_mc"
3288 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
3289 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
3290 (match_operand:SI 2 "and_operand" "?r,T,K,L")))
3291 (clobber (match_scratch:CC 3 "=X,X,x,x"))]
3292 "rs6000_gen_cell_microcode"
3295 {rlinm|rlwinm} %0,%1,0,%m2,%M2
3296 {andil.|andi.} %0,%1,%b2
3297 {andiu.|andis.} %0,%1,%u2"
3298 [(set_attr "type" "*,*,fast_compare,fast_compare")])
3300 (define_insn "andsi3_nomc"
3301 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3302 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
3303 (match_operand:SI 2 "and_operand" "?r,T")))
3304 (clobber (match_scratch:CC 3 "=X,X"))]
3305 "!rs6000_gen_cell_microcode"
3308 {rlinm|rlwinm} %0,%1,0,%m2,%M2")
3310 (define_insn "andsi3_internal0_nomc"
3311 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3312 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
3313 (match_operand:SI 2 "and_operand" "?r,T")))]
3314 "!rs6000_gen_cell_microcode"
3317 {rlinm|rlwinm} %0,%1,0,%m2,%M2")
3320 ;; Note to set cr's other than cr0 we do the and immediate and then
3321 ;; the test again -- this avoids a mfcr which on the higher end
3322 ;; machines causes an execution serialization
3324 (define_insn "*andsi3_internal2_mc"
3325 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
3326 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
3327 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
3329 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
3330 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
3331 "TARGET_32BIT && rs6000_gen_cell_microcode"
3334 {andil.|andi.} %3,%1,%b2
3335 {andiu.|andis.} %3,%1,%u2
3336 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
3341 [(set_attr "type" "fast_compare,fast_compare,fast_compare,delayed_compare,\
3342 compare,compare,compare,compare")
3343 (set_attr "length" "4,4,4,4,8,8,8,8")])
3345 (define_insn "*andsi3_internal3_mc"
3346 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
3347 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
3348 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
3350 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
3351 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
3352 "TARGET_64BIT && rs6000_gen_cell_microcode"
3355 {andil.|andi.} %3,%1,%b2
3356 {andiu.|andis.} %3,%1,%u2
3357 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
3362 [(set_attr "type" "compare,fast_compare,fast_compare,delayed_compare,compare,\
3363 compare,compare,compare")
3364 (set_attr "length" "8,4,4,4,8,8,8,8")])
3367 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3368 (compare:CC (and:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
3369 (match_operand:GPR 2 "and_operand" ""))
3371 (clobber (match_scratch:GPR 3 ""))
3372 (clobber (match_scratch:CC 4 ""))]
3374 [(parallel [(set (match_dup 3)
3375 (and:<MODE> (match_dup 1)
3377 (clobber (match_dup 4))])
3379 (compare:CC (match_dup 3)
3383 ;; We don't have a 32 bit "and. rt,ra,rb" for ppc64. cr is set from the
3384 ;; whole 64 bit reg, and we don't know what is in the high 32 bits.
3387 [(set (match_operand:CC 0 "cc_reg_operand" "")
3388 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
3389 (match_operand:SI 2 "gpc_reg_operand" ""))
3391 (clobber (match_scratch:SI 3 ""))
3392 (clobber (match_scratch:CC 4 ""))]
3393 "TARGET_POWERPC64 && reload_completed"
3394 [(parallel [(set (match_dup 3)
3395 (and:SI (match_dup 1)
3397 (clobber (match_dup 4))])
3399 (compare:CC (match_dup 3)
3403 (define_insn "*andsi3_internal4"
3404 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
3405 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
3406 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
3408 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
3409 (and:SI (match_dup 1)
3411 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
3412 "TARGET_32BIT && rs6000_gen_cell_microcode"
3415 {andil.|andi.} %0,%1,%b2
3416 {andiu.|andis.} %0,%1,%u2
3417 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
3422 [(set_attr "type" "fast_compare,fast_compare,fast_compare,delayed_compare,\
3423 compare,compare,compare,compare")
3424 (set_attr "length" "4,4,4,4,8,8,8,8")])
3426 (define_insn "*andsi3_internal5_mc"
3427 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
3428 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
3429 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
3431 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
3432 (and:SI (match_dup 1)
3434 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
3435 "TARGET_64BIT && rs6000_gen_cell_microcode"
3438 {andil.|andi.} %0,%1,%b2
3439 {andiu.|andis.} %0,%1,%u2
3440 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
3445 [(set_attr "type" "compare,fast_compare,fast_compare,delayed_compare,compare,\
3446 compare,compare,compare")
3447 (set_attr "length" "8,4,4,4,8,8,8,8")])
3450 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3451 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
3452 (match_operand:SI 2 "and_operand" ""))
3454 (set (match_operand:SI 0 "gpc_reg_operand" "")
3455 (and:SI (match_dup 1)
3457 (clobber (match_scratch:CC 4 ""))]
3459 [(parallel [(set (match_dup 0)
3460 (and:SI (match_dup 1)
3462 (clobber (match_dup 4))])
3464 (compare:CC (match_dup 0)
3469 [(set (match_operand:CC 3 "cc_reg_operand" "")
3470 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
3471 (match_operand:SI 2 "gpc_reg_operand" ""))
3473 (set (match_operand:SI 0 "gpc_reg_operand" "")
3474 (and:SI (match_dup 1)
3476 (clobber (match_scratch:CC 4 ""))]
3477 "TARGET_POWERPC64 && reload_completed"
3478 [(parallel [(set (match_dup 0)
3479 (and:SI (match_dup 1)
3481 (clobber (match_dup 4))])
3483 (compare:CC (match_dup 0)
3487 ;; Handle the PowerPC64 rlwinm corner case
3489 (define_insn_and_split "*andsi3_internal6"
3490 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3491 (and:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3492 (match_operand:SI 2 "mask_operand_wrap" "i")))]
3497 (and:SI (rotate:SI (match_dup 1) (match_dup 3))
3500 (rotate:SI (match_dup 0) (match_dup 5)))]
3503 int mb = extract_MB (operands[2]);
3504 int me = extract_ME (operands[2]);
3505 operands[3] = GEN_INT (me + 1);
3506 operands[5] = GEN_INT (32 - (me + 1));
3507 operands[4] = GEN_INT (~((HOST_WIDE_INT) -1 << (33 + me - mb)));
3509 [(set_attr "length" "8")])
3511 (define_expand "iorsi3"
3512 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3513 (ior:SI (match_operand:SI 1 "gpc_reg_operand" "")
3514 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
3518 if (GET_CODE (operands[2]) == CONST_INT
3519 && ! logical_operand (operands[2], SImode))
3521 HOST_WIDE_INT value = INTVAL (operands[2]);
3522 rtx tmp = ((!can_create_pseudo_p ()
3523 || rtx_equal_p (operands[0], operands[1]))
3524 ? operands[0] : gen_reg_rtx (SImode));
3526 emit_insn (gen_iorsi3 (tmp, operands[1],
3527 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
3528 emit_insn (gen_iorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
3533 (define_expand "xorsi3"
3534 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3535 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
3536 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
3540 if (GET_CODE (operands[2]) == CONST_INT
3541 && ! logical_operand (operands[2], SImode))
3543 HOST_WIDE_INT value = INTVAL (operands[2]);
3544 rtx tmp = ((!can_create_pseudo_p ()
3545 || rtx_equal_p (operands[0], operands[1]))
3546 ? operands[0] : gen_reg_rtx (SImode));
3548 emit_insn (gen_xorsi3 (tmp, operands[1],
3549 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
3550 emit_insn (gen_xorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
3555 (define_insn "*boolsi3_internal1"
3556 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
3557 (match_operator:SI 3 "boolean_or_operator"
3558 [(match_operand:SI 1 "gpc_reg_operand" "%r,r,r")
3559 (match_operand:SI 2 "logical_operand" "r,K,L")]))]
3563 {%q3il|%q3i} %0,%1,%b2
3564 {%q3iu|%q3is} %0,%1,%u2")
3566 (define_insn "*boolsi3_internal2"
3567 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3568 (compare:CC (match_operator:SI 4 "boolean_or_operator"
3569 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
3570 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3572 (clobber (match_scratch:SI 3 "=r,r"))]
3577 [(set_attr "type" "fast_compare,compare")
3578 (set_attr "length" "4,8")])
3581 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3582 (compare:CC (match_operator:SI 4 "boolean_operator"
3583 [(match_operand:SI 1 "gpc_reg_operand" "")
3584 (match_operand:SI 2 "gpc_reg_operand" "")])
3586 (clobber (match_scratch:SI 3 ""))]
3587 "TARGET_32BIT && reload_completed"
3588 [(set (match_dup 3) (match_dup 4))
3590 (compare:CC (match_dup 3)
3594 (define_insn "*boolsi3_internal3"
3595 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3596 (compare:CC (match_operator:SI 4 "boolean_operator"
3597 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
3598 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3600 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3606 [(set_attr "type" "fast_compare,compare")
3607 (set_attr "length" "4,8")])
3610 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3611 (compare:CC (match_operator:SI 4 "boolean_operator"
3612 [(match_operand:SI 1 "gpc_reg_operand" "")
3613 (match_operand:SI 2 "gpc_reg_operand" "")])
3615 (set (match_operand:SI 0 "gpc_reg_operand" "")
3617 "TARGET_32BIT && reload_completed"
3618 [(set (match_dup 0) (match_dup 4))
3620 (compare:CC (match_dup 0)
3624 ;; Split a logical operation that we can't do in one insn into two insns,
3625 ;; each of which does one 16-bit part. This is used by combine.
3628 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3629 (match_operator:SI 3 "boolean_or_operator"
3630 [(match_operand:SI 1 "gpc_reg_operand" "")
3631 (match_operand:SI 2 "non_logical_cint_operand" "")]))]
3633 [(set (match_dup 0) (match_dup 4))
3634 (set (match_dup 0) (match_dup 5))]
3638 i = GEN_INT (INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff));
3639 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
3641 i = GEN_INT (INTVAL (operands[2]) & 0xffff);
3642 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
3646 (define_insn "*boolcsi3_internal1"
3647 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3648 (match_operator:SI 3 "boolean_operator"
3649 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
3650 (match_operand:SI 2 "gpc_reg_operand" "r")]))]
3654 (define_insn "*boolcsi3_internal2"
3655 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3656 (compare:CC (match_operator:SI 4 "boolean_operator"
3657 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
3658 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3660 (clobber (match_scratch:SI 3 "=r,r"))]
3665 [(set_attr "type" "compare")
3666 (set_attr "length" "4,8")])
3669 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3670 (compare:CC (match_operator:SI 4 "boolean_operator"
3671 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3672 (match_operand:SI 2 "gpc_reg_operand" "")])
3674 (clobber (match_scratch:SI 3 ""))]
3675 "TARGET_32BIT && reload_completed"
3676 [(set (match_dup 3) (match_dup 4))
3678 (compare:CC (match_dup 3)
3682 (define_insn "*boolcsi3_internal3"
3683 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3684 (compare:CC (match_operator:SI 4 "boolean_operator"
3685 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
3686 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3688 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3694 [(set_attr "type" "compare")
3695 (set_attr "length" "4,8")])
3698 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3699 (compare:CC (match_operator:SI 4 "boolean_operator"
3700 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3701 (match_operand:SI 2 "gpc_reg_operand" "")])
3703 (set (match_operand:SI 0 "gpc_reg_operand" "")
3705 "TARGET_32BIT && reload_completed"
3706 [(set (match_dup 0) (match_dup 4))
3708 (compare:CC (match_dup 0)
3712 (define_insn "*boolccsi3_internal1"
3713 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3714 (match_operator:SI 3 "boolean_operator"
3715 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
3716 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))]))]
3720 (define_insn "*boolccsi3_internal2"
3721 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3722 (compare:CC (match_operator:SI 4 "boolean_operator"
3723 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
3724 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
3726 (clobber (match_scratch:SI 3 "=r,r"))]
3731 [(set_attr "type" "fast_compare,compare")
3732 (set_attr "length" "4,8")])
3735 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3736 (compare:CC (match_operator:SI 4 "boolean_operator"
3737 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3738 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
3740 (clobber (match_scratch:SI 3 ""))]
3741 "TARGET_32BIT && reload_completed"
3742 [(set (match_dup 3) (match_dup 4))
3744 (compare:CC (match_dup 3)
3748 (define_insn "*boolccsi3_internal3"
3749 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3750 (compare:CC (match_operator:SI 4 "boolean_operator"
3751 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
3752 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
3754 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3760 [(set_attr "type" "fast_compare,compare")
3761 (set_attr "length" "4,8")])
3764 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3765 (compare:CC (match_operator:SI 4 "boolean_operator"
3766 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3767 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
3769 (set (match_operand:SI 0 "gpc_reg_operand" "")
3771 "TARGET_32BIT && reload_completed"
3772 [(set (match_dup 0) (match_dup 4))
3774 (compare:CC (match_dup 0)
3778 ;; maskir insn. We need four forms because things might be in arbitrary
3779 ;; orders. Don't define forms that only set CR fields because these
3780 ;; would modify an input register.
3782 (define_insn "*maskir_internal1"
3783 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3784 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
3785 (match_operand:SI 1 "gpc_reg_operand" "0"))
3786 (and:SI (match_dup 2)
3787 (match_operand:SI 3 "gpc_reg_operand" "r"))))]
3791 (define_insn "*maskir_internal2"
3792 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3793 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
3794 (match_operand:SI 1 "gpc_reg_operand" "0"))
3795 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3800 (define_insn "*maskir_internal3"
3801 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3802 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r")
3803 (match_operand:SI 3 "gpc_reg_operand" "r"))
3804 (and:SI (not:SI (match_dup 2))
3805 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
3809 (define_insn "*maskir_internal4"
3810 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3811 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3812 (match_operand:SI 2 "gpc_reg_operand" "r"))
3813 (and:SI (not:SI (match_dup 2))
3814 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
3818 (define_insn "*maskir_internal5"
3819 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3821 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3822 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
3823 (and:SI (match_dup 2)
3824 (match_operand:SI 3 "gpc_reg_operand" "r,r")))
3826 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3827 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3828 (and:SI (match_dup 2) (match_dup 3))))]
3833 [(set_attr "type" "compare")
3834 (set_attr "length" "4,8")])
3837 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3839 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
3840 (match_operand:SI 1 "gpc_reg_operand" ""))
3841 (and:SI (match_dup 2)
3842 (match_operand:SI 3 "gpc_reg_operand" "")))
3844 (set (match_operand:SI 0 "gpc_reg_operand" "")
3845 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3846 (and:SI (match_dup 2) (match_dup 3))))]
3847 "TARGET_POWER && reload_completed"
3849 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3850 (and:SI (match_dup 2) (match_dup 3))))
3852 (compare:CC (match_dup 0)
3856 (define_insn "*maskir_internal6"
3857 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3859 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3860 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
3861 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
3864 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3865 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3866 (and:SI (match_dup 3) (match_dup 2))))]
3871 [(set_attr "type" "compare")
3872 (set_attr "length" "4,8")])
3875 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3877 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
3878 (match_operand:SI 1 "gpc_reg_operand" ""))
3879 (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
3882 (set (match_operand:SI 0 "gpc_reg_operand" "")
3883 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3884 (and:SI (match_dup 3) (match_dup 2))))]
3885 "TARGET_POWER && reload_completed"
3887 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3888 (and:SI (match_dup 3) (match_dup 2))))
3890 (compare:CC (match_dup 0)
3894 (define_insn "*maskir_internal7"
3895 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3897 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r,r")
3898 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
3899 (and:SI (not:SI (match_dup 2))
3900 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
3902 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3903 (ior:SI (and:SI (match_dup 2) (match_dup 3))
3904 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3909 [(set_attr "type" "compare")
3910 (set_attr "length" "4,8")])
3913 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3915 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "")
3916 (match_operand:SI 3 "gpc_reg_operand" ""))
3917 (and:SI (not:SI (match_dup 2))
3918 (match_operand:SI 1 "gpc_reg_operand" "")))
3920 (set (match_operand:SI 0 "gpc_reg_operand" "")
3921 (ior:SI (and:SI (match_dup 2) (match_dup 3))
3922 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3923 "TARGET_POWER && reload_completed"
3925 (ior:SI (and:SI (match_dup 2) (match_dup 3))
3926 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
3928 (compare:CC (match_dup 0)
3932 (define_insn "*maskir_internal8"
3933 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3935 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
3936 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3937 (and:SI (not:SI (match_dup 2))
3938 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
3940 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3941 (ior:SI (and:SI (match_dup 3) (match_dup 2))
3942 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3947 [(set_attr "type" "compare")
3948 (set_attr "length" "4,8")])
3951 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3953 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
3954 (match_operand:SI 2 "gpc_reg_operand" ""))
3955 (and:SI (not:SI (match_dup 2))
3956 (match_operand:SI 1 "gpc_reg_operand" "")))
3958 (set (match_operand:SI 0 "gpc_reg_operand" "")
3959 (ior:SI (and:SI (match_dup 3) (match_dup 2))
3960 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3961 "TARGET_POWER && reload_completed"
3963 (ior:SI (and:SI (match_dup 3) (match_dup 2))
3964 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
3966 (compare:CC (match_dup 0)
3970 ;; Rotate and shift insns, in all their variants. These support shifts,
3971 ;; field inserts and extracts, and various combinations thereof.
3972 (define_expand "insv"
3973 [(set (zero_extract (match_operand 0 "gpc_reg_operand" "")
3974 (match_operand:SI 1 "const_int_operand" "")
3975 (match_operand:SI 2 "const_int_operand" ""))
3976 (match_operand 3 "gpc_reg_operand" ""))]
3980 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3981 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3982 compiler if the address of the structure is taken later. Likewise, do
3983 not handle invalid E500 subregs. */
3984 if (GET_CODE (operands[0]) == SUBREG
3985 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD
3986 || ((TARGET_E500_DOUBLE || TARGET_SPE)
3987 && invalid_e500_subreg (operands[0], GET_MODE (operands[0])))))
3990 if (TARGET_POWERPC64 && GET_MODE (operands[0]) == DImode)
3991 emit_insn (gen_insvdi (operands[0], operands[1], operands[2], operands[3]));
3993 emit_insn (gen_insvsi (operands[0], operands[1], operands[2], operands[3]));
3997 (define_insn "insvsi"
3998 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3999 (match_operand:SI 1 "const_int_operand" "i")
4000 (match_operand:SI 2 "const_int_operand" "i"))
4001 (match_operand:SI 3 "gpc_reg_operand" "r"))]
4005 int start = INTVAL (operands[2]) & 31;
4006 int size = INTVAL (operands[1]) & 31;
4008 operands[4] = GEN_INT (32 - start - size);
4009 operands[1] = GEN_INT (start + size - 1);
4010 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
4012 [(set_attr "type" "insert_word")])
4014 (define_insn "*insvsi_internal1"
4015 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4016 (match_operand:SI 1 "const_int_operand" "i")
4017 (match_operand:SI 2 "const_int_operand" "i"))
4018 (rotate:SI (match_operand:SI 3 "gpc_reg_operand" "r")
4019 (match_operand:SI 4 "const_int_operand" "i")))]
4020 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
4023 int shift = INTVAL (operands[4]) & 31;
4024 int start = INTVAL (operands[2]) & 31;
4025 int size = INTVAL (operands[1]) & 31;
4027 operands[4] = GEN_INT (shift - start - size);
4028 operands[1] = GEN_INT (start + size - 1);
4029 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
4031 [(set_attr "type" "insert_word")])
4033 (define_insn "*insvsi_internal2"
4034 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4035 (match_operand:SI 1 "const_int_operand" "i")
4036 (match_operand:SI 2 "const_int_operand" "i"))
4037 (ashiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
4038 (match_operand:SI 4 "const_int_operand" "i")))]
4039 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
4042 int shift = INTVAL (operands[4]) & 31;
4043 int start = INTVAL (operands[2]) & 31;
4044 int size = INTVAL (operands[1]) & 31;
4046 operands[4] = GEN_INT (32 - shift - start - size);
4047 operands[1] = GEN_INT (start + size - 1);
4048 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
4050 [(set_attr "type" "insert_word")])
4052 (define_insn "*insvsi_internal3"
4053 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4054 (match_operand:SI 1 "const_int_operand" "i")
4055 (match_operand:SI 2 "const_int_operand" "i"))
4056 (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
4057 (match_operand:SI 4 "const_int_operand" "i")))]
4058 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
4061 int shift = INTVAL (operands[4]) & 31;
4062 int start = INTVAL (operands[2]) & 31;
4063 int size = INTVAL (operands[1]) & 31;
4065 operands[4] = GEN_INT (32 - shift - start - size);
4066 operands[1] = GEN_INT (start + size - 1);
4067 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
4069 [(set_attr "type" "insert_word")])
4071 (define_insn "*insvsi_internal4"
4072 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4073 (match_operand:SI 1 "const_int_operand" "i")
4074 (match_operand:SI 2 "const_int_operand" "i"))
4075 (zero_extract:SI (match_operand:SI 3 "gpc_reg_operand" "r")
4076 (match_operand:SI 4 "const_int_operand" "i")
4077 (match_operand:SI 5 "const_int_operand" "i")))]
4078 "INTVAL (operands[4]) >= INTVAL (operands[1])"
4081 int extract_start = INTVAL (operands[5]) & 31;
4082 int extract_size = INTVAL (operands[4]) & 31;
4083 int insert_start = INTVAL (operands[2]) & 31;
4084 int insert_size = INTVAL (operands[1]) & 31;
4086 /* Align extract field with insert field */
4087 operands[5] = GEN_INT (extract_start + extract_size - insert_start - insert_size);
4088 operands[1] = GEN_INT (insert_start + insert_size - 1);
4089 return \"{rlimi|rlwimi} %0,%3,%h5,%h2,%h1\";
4091 [(set_attr "type" "insert_word")])
4093 ;; combine patterns for rlwimi
4094 (define_insn "*insvsi_internal5"
4095 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4096 (ior:SI (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
4097 (match_operand:SI 1 "mask_operand" "i"))
4098 (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
4099 (match_operand:SI 2 "const_int_operand" "i"))
4100 (match_operand:SI 5 "mask_operand" "i"))))]
4101 "TARGET_POWERPC && INTVAL(operands[1]) == ~INTVAL(operands[5])"
4104 int me = extract_ME(operands[5]);
4105 int mb = extract_MB(operands[5]);
4106 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
4107 operands[2] = GEN_INT(mb);
4108 operands[1] = GEN_INT(me);
4109 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
4111 [(set_attr "type" "insert_word")])
4113 (define_insn "*insvsi_internal6"
4114 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4115 (ior:SI (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
4116 (match_operand:SI 2 "const_int_operand" "i"))
4117 (match_operand:SI 5 "mask_operand" "i"))
4118 (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
4119 (match_operand:SI 1 "mask_operand" "i"))))]
4120 "TARGET_POWERPC && INTVAL(operands[1]) == ~INTVAL(operands[5])"
4123 int me = extract_ME(operands[5]);
4124 int mb = extract_MB(operands[5]);
4125 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
4126 operands[2] = GEN_INT(mb);
4127 operands[1] = GEN_INT(me);
4128 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
4130 [(set_attr "type" "insert_word")])
4132 (define_insn "insvdi"
4133 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
4134 (match_operand:SI 1 "const_int_operand" "i")
4135 (match_operand:SI 2 "const_int_operand" "i"))
4136 (match_operand:DI 3 "gpc_reg_operand" "r"))]
4140 int start = INTVAL (operands[2]) & 63;
4141 int size = INTVAL (operands[1]) & 63;
4143 operands[1] = GEN_INT (64 - start - size);
4144 return \"rldimi %0,%3,%H1,%H2\";
4146 [(set_attr "type" "insert_dword")])
4148 (define_insn "*insvdi_internal2"
4149 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
4150 (match_operand:SI 1 "const_int_operand" "i")
4151 (match_operand:SI 2 "const_int_operand" "i"))
4152 (ashiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
4153 (match_operand:SI 4 "const_int_operand" "i")))]
4155 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
4158 int shift = INTVAL (operands[4]) & 63;
4159 int start = (INTVAL (operands[2]) & 63) - 32;
4160 int size = INTVAL (operands[1]) & 63;
4162 operands[4] = GEN_INT (64 - shift - start - size);
4163 operands[2] = GEN_INT (start);
4164 operands[1] = GEN_INT (start + size - 1);
4165 return \"rlwimi %0,%3,%h4,%h2,%h1\";
4168 (define_insn "*insvdi_internal3"
4169 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
4170 (match_operand:SI 1 "const_int_operand" "i")
4171 (match_operand:SI 2 "const_int_operand" "i"))
4172 (lshiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
4173 (match_operand:SI 4 "const_int_operand" "i")))]
4175 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
4178 int shift = INTVAL (operands[4]) & 63;
4179 int start = (INTVAL (operands[2]) & 63) - 32;
4180 int size = INTVAL (operands[1]) & 63;
4182 operands[4] = GEN_INT (64 - shift - start - size);
4183 operands[2] = GEN_INT (start);
4184 operands[1] = GEN_INT (start + size - 1);
4185 return \"rlwimi %0,%3,%h4,%h2,%h1\";
4188 (define_expand "extzv"
4189 [(set (match_operand 0 "gpc_reg_operand" "")
4190 (zero_extract (match_operand 1 "gpc_reg_operand" "")
4191 (match_operand:SI 2 "const_int_operand" "")
4192 (match_operand:SI 3 "const_int_operand" "")))]
4196 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
4197 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
4198 compiler if the address of the structure is taken later. */
4199 if (GET_CODE (operands[0]) == SUBREG
4200 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
4203 if (TARGET_POWERPC64 && GET_MODE (operands[1]) == DImode)
4204 emit_insn (gen_extzvdi (operands[0], operands[1], operands[2], operands[3]));
4206 emit_insn (gen_extzvsi (operands[0], operands[1], operands[2], operands[3]));
4210 (define_insn "extzvsi"
4211 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4212 (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4213 (match_operand:SI 2 "const_int_operand" "i")
4214 (match_operand:SI 3 "const_int_operand" "i")))]
4218 int start = INTVAL (operands[3]) & 31;
4219 int size = INTVAL (operands[2]) & 31;
4221 if (start + size >= 32)
4222 operands[3] = const0_rtx;
4224 operands[3] = GEN_INT (start + size);
4225 return \"{rlinm|rlwinm} %0,%1,%3,%s2,31\";
4228 (define_insn "*extzvsi_internal1"
4229 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4230 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4231 (match_operand:SI 2 "const_int_operand" "i,i")
4232 (match_operand:SI 3 "const_int_operand" "i,i"))
4234 (clobber (match_scratch:SI 4 "=r,r"))]
4238 int start = INTVAL (operands[3]) & 31;
4239 int size = INTVAL (operands[2]) & 31;
4241 /* Force split for non-cc0 compare. */
4242 if (which_alternative == 1)
4245 /* If the bit-field being tested fits in the upper or lower half of a
4246 word, it is possible to use andiu. or andil. to test it. This is
4247 useful because the condition register set-use delay is smaller for
4248 andi[ul]. than for rlinm. This doesn't work when the starting bit
4249 position is 0 because the LT and GT bits may be set wrong. */
4251 if ((start > 0 && start + size <= 16) || start >= 16)
4253 operands[3] = GEN_INT (((1 << (16 - (start & 15)))
4254 - (1 << (16 - (start & 15) - size))));
4256 return \"{andiu.|andis.} %4,%1,%3\";
4258 return \"{andil.|andi.} %4,%1,%3\";
4261 if (start + size >= 32)
4262 operands[3] = const0_rtx;
4264 operands[3] = GEN_INT (start + size);
4265 return \"{rlinm.|rlwinm.} %4,%1,%3,%s2,31\";
4267 [(set_attr "type" "delayed_compare")
4268 (set_attr "length" "4,8")])
4271 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4272 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
4273 (match_operand:SI 2 "const_int_operand" "")
4274 (match_operand:SI 3 "const_int_operand" ""))
4276 (clobber (match_scratch:SI 4 ""))]
4279 (zero_extract:SI (match_dup 1) (match_dup 2)
4282 (compare:CC (match_dup 4)
4286 (define_insn "*extzvsi_internal2"
4287 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4288 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4289 (match_operand:SI 2 "const_int_operand" "i,i")
4290 (match_operand:SI 3 "const_int_operand" "i,i"))
4292 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4293 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
4297 int start = INTVAL (operands[3]) & 31;
4298 int size = INTVAL (operands[2]) & 31;
4300 /* Force split for non-cc0 compare. */
4301 if (which_alternative == 1)
4304 /* Since we are using the output value, we can't ignore any need for
4305 a shift. The bit-field must end at the LSB. */
4306 if (start >= 16 && start + size == 32)
4308 operands[3] = GEN_INT ((1 << size) - 1);
4309 return \"{andil.|andi.} %0,%1,%3\";
4312 if (start + size >= 32)
4313 operands[3] = const0_rtx;
4315 operands[3] = GEN_INT (start + size);
4316 return \"{rlinm.|rlwinm.} %0,%1,%3,%s2,31\";
4318 [(set_attr "type" "delayed_compare")
4319 (set_attr "length" "4,8")])
4322 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
4323 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
4324 (match_operand:SI 2 "const_int_operand" "")
4325 (match_operand:SI 3 "const_int_operand" ""))
4327 (set (match_operand:SI 0 "gpc_reg_operand" "")
4328 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
4331 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))
4333 (compare:CC (match_dup 0)
4337 (define_insn "extzvdi"
4338 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4339 (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4340 (match_operand:SI 2 "const_int_operand" "i")
4341 (match_operand:SI 3 "const_int_operand" "i")))]
4345 int start = INTVAL (operands[3]) & 63;
4346 int size = INTVAL (operands[2]) & 63;
4348 if (start + size >= 64)
4349 operands[3] = const0_rtx;
4351 operands[3] = GEN_INT (start + size);
4352 operands[2] = GEN_INT (64 - size);
4353 return \"rldicl %0,%1,%3,%2\";
4356 (define_insn "*extzvdi_internal1"
4357 [(set (match_operand:CC 0 "gpc_reg_operand" "=x")
4358 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4359 (match_operand:SI 2 "const_int_operand" "i")
4360 (match_operand:SI 3 "const_int_operand" "i"))
4362 (clobber (match_scratch:DI 4 "=r"))]
4363 "TARGET_64BIT && rs6000_gen_cell_microcode"
4366 int start = INTVAL (operands[3]) & 63;
4367 int size = INTVAL (operands[2]) & 63;
4369 if (start + size >= 64)
4370 operands[3] = const0_rtx;
4372 operands[3] = GEN_INT (start + size);
4373 operands[2] = GEN_INT (64 - size);
4374 return \"rldicl. %4,%1,%3,%2\";
4376 [(set_attr "type" "compare")])
4378 (define_insn "*extzvdi_internal2"
4379 [(set (match_operand:CC 4 "gpc_reg_operand" "=x")
4380 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4381 (match_operand:SI 2 "const_int_operand" "i")
4382 (match_operand:SI 3 "const_int_operand" "i"))
4384 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
4385 (zero_extract:DI (match_dup 1) (match_dup 2) (match_dup 3)))]
4386 "TARGET_64BIT && rs6000_gen_cell_microcode"
4389 int start = INTVAL (operands[3]) & 63;
4390 int size = INTVAL (operands[2]) & 63;
4392 if (start + size >= 64)
4393 operands[3] = const0_rtx;
4395 operands[3] = GEN_INT (start + size);
4396 operands[2] = GEN_INT (64 - size);
4397 return \"rldicl. %0,%1,%3,%2\";
4399 [(set_attr "type" "compare")])
4401 (define_insn "rotlsi3"
4402 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4403 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4404 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
4407 {rlnm|rlwnm} %0,%1,%2,0xffffffff
4408 {rlinm|rlwinm} %0,%1,%h2,0xffffffff"
4409 [(set_attr "type" "var_shift_rotate,integer")])
4411 (define_insn "*rotlsi3_64"
4412 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
4414 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4415 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))))]
4418 {rlnm|rlwnm} %0,%1,%2,0xffffffff
4419 {rlinm|rlwinm} %0,%1,%h2,0xffffffff"
4420 [(set_attr "type" "var_shift_rotate,integer")])
4422 (define_insn "*rotlsi3_internal2"
4423 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4424 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4425 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4427 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4430 {rlnm.|rlwnm.} %3,%1,%2,0xffffffff
4431 {rlinm.|rlwinm.} %3,%1,%h2,0xffffffff
4434 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4435 (set_attr "length" "4,4,8,8")])
4438 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4439 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4440 (match_operand:SI 2 "reg_or_cint_operand" ""))
4442 (clobber (match_scratch:SI 3 ""))]
4445 (rotate:SI (match_dup 1) (match_dup 2)))
4447 (compare:CC (match_dup 3)
4451 (define_insn "*rotlsi3_internal3"
4452 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4453 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4454 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4456 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4457 (rotate:SI (match_dup 1) (match_dup 2)))]
4460 {rlnm.|rlwnm.} %0,%1,%2,0xffffffff
4461 {rlinm.|rlwinm.} %0,%1,%h2,0xffffffff
4464 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4465 (set_attr "length" "4,4,8,8")])
4468 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4469 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4470 (match_operand:SI 2 "reg_or_cint_operand" ""))
4472 (set (match_operand:SI 0 "gpc_reg_operand" "")
4473 (rotate:SI (match_dup 1) (match_dup 2)))]
4476 (rotate:SI (match_dup 1) (match_dup 2)))
4478 (compare:CC (match_dup 0)
4482 (define_insn "*rotlsi3_internal4"
4483 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4484 (and:SI (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4485 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
4486 (match_operand:SI 3 "mask_operand" "n,n")))]
4489 {rlnm|rlwnm} %0,%1,%2,%m3,%M3
4490 {rlinm|rlwinm} %0,%1,%h2,%m3,%M3"
4491 [(set_attr "type" "var_shift_rotate,integer")])
4493 (define_insn "*rotlsi3_internal5"
4494 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4496 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4497 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4498 (match_operand:SI 3 "mask_operand" "n,n,n,n"))
4500 (clobber (match_scratch:SI 4 "=r,r,r,r"))]
4503 {rlnm.|rlwnm.} %4,%1,%2,%m3,%M3
4504 {rlinm.|rlwinm.} %4,%1,%h2,%m3,%M3
4507 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4508 (set_attr "length" "4,4,8,8")])
4511 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4513 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4514 (match_operand:SI 2 "reg_or_cint_operand" ""))
4515 (match_operand:SI 3 "mask_operand" ""))
4517 (clobber (match_scratch:SI 4 ""))]
4520 (and:SI (rotate:SI (match_dup 1)
4524 (compare:CC (match_dup 4)
4528 (define_insn "*rotlsi3_internal6"
4529 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
4531 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4532 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4533 (match_operand:SI 3 "mask_operand" "n,n,n,n"))
4535 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4536 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4539 {rlnm.|rlwnm.} %0,%1,%2,%m3,%M3
4540 {rlinm.|rlwinm.} %0,%1,%h2,%m3,%M3
4543 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4544 (set_attr "length" "4,4,8,8")])
4547 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
4549 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4550 (match_operand:SI 2 "reg_or_cint_operand" ""))
4551 (match_operand:SI 3 "mask_operand" ""))
4553 (set (match_operand:SI 0 "gpc_reg_operand" "")
4554 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4557 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4559 (compare:CC (match_dup 0)
4563 (define_insn "*rotlsi3_internal7"
4564 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4567 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4568 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
4570 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xff"
4571 [(set (attr "cell_micro")
4572 (if_then_else (match_operand:SI 2 "const_int_operand" "")
4573 (const_string "not")
4574 (const_string "always")))])
4576 (define_insn "*rotlsi3_internal8"
4577 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4578 (compare:CC (zero_extend:SI
4580 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4581 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4583 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4586 {rlnm.|rlwnm.} %3,%1,%2,0xff
4587 {rlinm.|rlwinm.} %3,%1,%h2,0xff
4590 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4591 (set_attr "length" "4,4,8,8")])
4594 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4595 (compare:CC (zero_extend:SI
4597 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4598 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4600 (clobber (match_scratch:SI 3 ""))]
4603 (zero_extend:SI (subreg:QI
4604 (rotate:SI (match_dup 1)
4607 (compare:CC (match_dup 3)
4611 (define_insn "*rotlsi3_internal9"
4612 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4613 (compare:CC (zero_extend:SI
4615 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4616 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4618 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4619 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4622 {rlnm.|rlwnm.} %0,%1,%2,0xff
4623 {rlinm.|rlwinm.} %0,%1,%h2,0xff
4626 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4627 (set_attr "length" "4,4,8,8")])
4630 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4631 (compare:CC (zero_extend:SI
4633 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4634 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4636 (set (match_operand:SI 0 "gpc_reg_operand" "")
4637 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4640 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
4642 (compare:CC (match_dup 0)
4646 (define_insn "*rotlsi3_internal10"
4647 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4650 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4651 (match_operand:SI 2 "reg_or_cint_operand" "r,i")) 0)))]
4654 {rlnm|rlwnm} %0,%1,%2,0xffff
4655 {rlinm|rlwinm} %0,%1,%h2,0xffff"
4656 [(set_attr "type" "var_shift_rotate,integer")])
4659 (define_insn "*rotlsi3_internal11"
4660 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4661 (compare:CC (zero_extend:SI
4663 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4664 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4666 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4669 {rlnm.|rlwnm.} %3,%1,%2,0xffff
4670 {rlinm.|rlwinm.} %3,%1,%h2,0xffff
4673 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4674 (set_attr "length" "4,4,8,8")])
4677 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4678 (compare:CC (zero_extend:SI
4680 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4681 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4683 (clobber (match_scratch:SI 3 ""))]
4686 (zero_extend:SI (subreg:HI
4687 (rotate:SI (match_dup 1)
4690 (compare:CC (match_dup 3)
4694 (define_insn "*rotlsi3_internal12"
4695 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4696 (compare:CC (zero_extend:SI
4698 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4699 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4701 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4702 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4705 {rlnm.|rlwnm.} %0,%1,%2,0xffff
4706 {rlinm.|rlwinm.} %0,%1,%h2,0xffff
4709 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4710 (set_attr "length" "4,4,8,8")])
4713 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4714 (compare:CC (zero_extend:SI
4716 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4717 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4719 (set (match_operand:SI 0 "gpc_reg_operand" "")
4720 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4723 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
4725 (compare:CC (match_dup 0)
4729 ;; Note that we use "sle." instead of "sl." so that we can set
4730 ;; SHIFT_COUNT_TRUNCATED.
4732 (define_expand "ashlsi3"
4733 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
4734 (use (match_operand:SI 1 "gpc_reg_operand" ""))
4735 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
4740 emit_insn (gen_ashlsi3_power (operands[0], operands[1], operands[2]));
4742 emit_insn (gen_ashlsi3_no_power (operands[0], operands[1], operands[2]));
4746 (define_insn "ashlsi3_power"
4747 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4748 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4749 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
4750 (clobber (match_scratch:SI 3 "=q,X"))]
4754 {sli|slwi} %0,%1,%h2")
4756 (define_insn "ashlsi3_no_power"
4757 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4758 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4759 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
4763 {sli|slwi} %0,%1,%h2"
4764 [(set_attr "type" "var_shift_rotate,shift")])
4766 (define_insn "*ashlsi3_64"
4767 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
4769 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4770 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))))]
4774 {sli|slwi} %0,%1,%h2"
4775 [(set_attr "type" "var_shift_rotate,shift")])
4778 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4779 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4780 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4782 (clobber (match_scratch:SI 3 "=r,r,r,r"))
4783 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4787 {sli.|slwi.} %3,%1,%h2
4790 [(set_attr "type" "delayed_compare")
4791 (set_attr "length" "4,4,8,8")])
4794 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4795 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4796 (match_operand:SI 2 "reg_or_cint_operand" ""))
4798 (clobber (match_scratch:SI 3 ""))
4799 (clobber (match_scratch:SI 4 ""))]
4800 "TARGET_POWER && reload_completed"
4801 [(parallel [(set (match_dup 3)
4802 (ashift:SI (match_dup 1) (match_dup 2)))
4803 (clobber (match_dup 4))])
4805 (compare:CC (match_dup 3)
4810 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4811 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4812 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4814 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4815 "! TARGET_POWER && TARGET_32BIT"
4818 {sli.|slwi.} %3,%1,%h2
4821 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4822 (set_attr "length" "4,4,8,8")])
4825 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4826 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4827 (match_operand:SI 2 "reg_or_cint_operand" ""))
4829 (clobber (match_scratch:SI 3 ""))]
4830 "! TARGET_POWER && TARGET_32BIT && reload_completed"
4832 (ashift:SI (match_dup 1) (match_dup 2)))
4834 (compare:CC (match_dup 3)
4839 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4840 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4841 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4843 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4844 (ashift:SI (match_dup 1) (match_dup 2)))
4845 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4849 {sli.|slwi.} %0,%1,%h2
4852 [(set_attr "type" "delayed_compare")
4853 (set_attr "length" "4,4,8,8")])
4856 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4857 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4858 (match_operand:SI 2 "reg_or_cint_operand" ""))
4860 (set (match_operand:SI 0 "gpc_reg_operand" "")
4861 (ashift:SI (match_dup 1) (match_dup 2)))
4862 (clobber (match_scratch:SI 4 ""))]
4863 "TARGET_POWER && reload_completed"
4864 [(parallel [(set (match_dup 0)
4865 (ashift:SI (match_dup 1) (match_dup 2)))
4866 (clobber (match_dup 4))])
4868 (compare:CC (match_dup 0)
4873 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4874 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4875 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4877 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4878 (ashift:SI (match_dup 1) (match_dup 2)))]
4879 "! TARGET_POWER && TARGET_32BIT"
4882 {sli.|slwi.} %0,%1,%h2
4885 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4886 (set_attr "length" "4,4,8,8")])
4889 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4890 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4891 (match_operand:SI 2 "reg_or_cint_operand" ""))
4893 (set (match_operand:SI 0 "gpc_reg_operand" "")
4894 (ashift:SI (match_dup 1) (match_dup 2)))]
4895 "! TARGET_POWER && TARGET_32BIT && reload_completed"
4897 (ashift:SI (match_dup 1) (match_dup 2)))
4899 (compare:CC (match_dup 0)
4903 (define_insn "rlwinm"
4904 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4905 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4906 (match_operand:SI 2 "const_int_operand" "i"))
4907 (match_operand:SI 3 "mask_operand" "n")))]
4908 "includes_lshift_p (operands[2], operands[3])"
4909 "{rlinm|rlwinm} %0,%1,%h2,%m3,%M3")
4912 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4914 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4915 (match_operand:SI 2 "const_int_operand" "i,i"))
4916 (match_operand:SI 3 "mask_operand" "n,n"))
4918 (clobber (match_scratch:SI 4 "=r,r"))]
4919 "includes_lshift_p (operands[2], operands[3])"
4921 {rlinm.|rlwinm.} %4,%1,%h2,%m3,%M3
4923 [(set_attr "type" "delayed_compare")
4924 (set_attr "length" "4,8")])
4927 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4929 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4930 (match_operand:SI 2 "const_int_operand" ""))
4931 (match_operand:SI 3 "mask_operand" ""))
4933 (clobber (match_scratch:SI 4 ""))]
4934 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
4936 (and:SI (ashift:SI (match_dup 1) (match_dup 2))
4939 (compare:CC (match_dup 4)
4944 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4946 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4947 (match_operand:SI 2 "const_int_operand" "i,i"))
4948 (match_operand:SI 3 "mask_operand" "n,n"))
4950 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4951 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4952 "includes_lshift_p (operands[2], operands[3])"
4954 {rlinm.|rlwinm.} %0,%1,%h2,%m3,%M3
4956 [(set_attr "type" "delayed_compare")
4957 (set_attr "length" "4,8")])
4960 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
4962 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4963 (match_operand:SI 2 "const_int_operand" ""))
4964 (match_operand:SI 3 "mask_operand" ""))
4966 (set (match_operand:SI 0 "gpc_reg_operand" "")
4967 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4968 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
4970 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4972 (compare:CC (match_dup 0)
4976 ;; The AIX assembler mis-handles "sri x,x,0", so write that case as
4978 (define_expand "lshrsi3"
4979 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
4980 (use (match_operand:SI 1 "gpc_reg_operand" ""))
4981 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
4986 emit_insn (gen_lshrsi3_power (operands[0], operands[1], operands[2]));
4988 emit_insn (gen_lshrsi3_no_power (operands[0], operands[1], operands[2]));
4992 (define_insn "lshrsi3_power"
4993 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
4994 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
4995 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i")))
4996 (clobber (match_scratch:SI 3 "=q,X,X"))]
5001 {s%A2i|s%A2wi} %0,%1,%h2")
5003 (define_insn "lshrsi3_no_power"
5004 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
5005 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
5006 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i")))]
5011 {sri|srwi} %0,%1,%h2"
5012 [(set_attr "type" "integer,var_shift_rotate,shift")])
5014 (define_insn "*lshrsi3_64"
5015 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
5017 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5018 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))))]
5022 {sri|srwi} %0,%1,%h2"
5023 [(set_attr "type" "var_shift_rotate,shift")])
5026 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,?y,?y,?y")
5027 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
5028 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
5030 (clobber (match_scratch:SI 3 "=r,X,r,r,X,r"))
5031 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
5036 {s%A2i.|s%A2wi.} %3,%1,%h2
5040 [(set_attr "type" "delayed_compare")
5041 (set_attr "length" "4,4,4,8,8,8")])
5044 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
5045 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5046 (match_operand:SI 2 "reg_or_cint_operand" ""))
5048 (clobber (match_scratch:SI 3 ""))
5049 (clobber (match_scratch:SI 4 ""))]
5050 "TARGET_POWER && reload_completed"
5051 [(parallel [(set (match_dup 3)
5052 (lshiftrt:SI (match_dup 1) (match_dup 2)))
5053 (clobber (match_dup 4))])
5055 (compare:CC (match_dup 3)
5060 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,?y,?y,?y")
5061 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
5062 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i,O,r,i"))
5064 (clobber (match_scratch:SI 3 "=X,r,r,X,r,r"))]
5065 "! TARGET_POWER && TARGET_32BIT"
5069 {sri.|srwi.} %3,%1,%h2
5073 [(set_attr "type" "delayed_compare,var_delayed_compare,delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
5074 (set_attr "length" "4,4,4,8,8,8")])
5077 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
5078 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5079 (match_operand:SI 2 "reg_or_cint_operand" ""))
5081 (clobber (match_scratch:SI 3 ""))]
5082 "! TARGET_POWER && TARGET_32BIT && reload_completed"
5084 (lshiftrt:SI (match_dup 1) (match_dup 2)))
5086 (compare:CC (match_dup 3)
5091 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,?y,?y,?y")
5092 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
5093 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
5095 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
5096 (lshiftrt:SI (match_dup 1) (match_dup 2)))
5097 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
5102 {s%A2i.|s%A2wi.} %0,%1,%h2
5106 [(set_attr "type" "delayed_compare")
5107 (set_attr "length" "4,4,4,8,8,8")])
5110 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
5111 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5112 (match_operand:SI 2 "reg_or_cint_operand" ""))
5114 (set (match_operand:SI 0 "gpc_reg_operand" "")
5115 (lshiftrt:SI (match_dup 1) (match_dup 2)))
5116 (clobber (match_scratch:SI 4 ""))]
5117 "TARGET_POWER && reload_completed"
5118 [(parallel [(set (match_dup 0)
5119 (lshiftrt:SI (match_dup 1) (match_dup 2)))
5120 (clobber (match_dup 4))])
5122 (compare:CC (match_dup 0)
5127 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,?y,?y,?y")
5128 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
5129 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i,O,r,i"))
5131 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
5132 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
5133 "! TARGET_POWER && TARGET_32BIT"
5137 {sri.|srwi.} %0,%1,%h2
5141 [(set_attr "type" "delayed_compare,var_delayed_compare,delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
5142 (set_attr "length" "4,4,4,8,8,8")])
5145 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
5146 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5147 (match_operand:SI 2 "reg_or_cint_operand" ""))
5149 (set (match_operand:SI 0 "gpc_reg_operand" "")
5150 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
5151 "! TARGET_POWER && TARGET_32BIT && reload_completed"
5153 (lshiftrt:SI (match_dup 1) (match_dup 2)))
5155 (compare:CC (match_dup 0)
5160 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5161 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
5162 (match_operand:SI 2 "const_int_operand" "i"))
5163 (match_operand:SI 3 "mask_operand" "n")))]
5164 "includes_rshift_p (operands[2], operands[3])"
5165 "{rlinm|rlwinm} %0,%1,%s2,%m3,%M3")
5168 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
5170 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5171 (match_operand:SI 2 "const_int_operand" "i,i"))
5172 (match_operand:SI 3 "mask_operand" "n,n"))
5174 (clobber (match_scratch:SI 4 "=r,r"))]
5175 "includes_rshift_p (operands[2], operands[3])"
5177 {rlinm.|rlwinm.} %4,%1,%s2,%m3,%M3
5179 [(set_attr "type" "delayed_compare")
5180 (set_attr "length" "4,8")])
5183 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
5185 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5186 (match_operand:SI 2 "const_int_operand" ""))
5187 (match_operand:SI 3 "mask_operand" ""))
5189 (clobber (match_scratch:SI 4 ""))]
5190 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
5192 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2))
5195 (compare:CC (match_dup 4)
5200 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
5202 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5203 (match_operand:SI 2 "const_int_operand" "i,i"))
5204 (match_operand:SI 3 "mask_operand" "n,n"))
5206 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
5207 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
5208 "includes_rshift_p (operands[2], operands[3])"
5210 {rlinm.|rlwinm.} %0,%1,%s2,%m3,%M3
5212 [(set_attr "type" "delayed_compare")
5213 (set_attr "length" "4,8")])
5216 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
5218 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5219 (match_operand:SI 2 "const_int_operand" ""))
5220 (match_operand:SI 3 "mask_operand" ""))
5222 (set (match_operand:SI 0 "gpc_reg_operand" "")
5223 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
5224 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
5226 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
5228 (compare:CC (match_dup 0)
5233 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5236 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
5237 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
5238 "includes_rshift_p (operands[2], GEN_INT (255))"
5239 "{rlinm|rlwinm} %0,%1,%s2,0xff")
5242 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
5246 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5247 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
5249 (clobber (match_scratch:SI 3 "=r,r"))]
5250 "includes_rshift_p (operands[2], GEN_INT (255))"
5252 {rlinm.|rlwinm.} %3,%1,%s2,0xff
5254 [(set_attr "type" "delayed_compare")
5255 (set_attr "length" "4,8")])
5258 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
5262 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5263 (match_operand:SI 2 "const_int_operand" "")) 0))
5265 (clobber (match_scratch:SI 3 ""))]
5266 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
5268 (zero_extend:SI (subreg:QI
5269 (lshiftrt:SI (match_dup 1)
5272 (compare:CC (match_dup 3)
5277 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
5281 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5282 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
5284 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
5285 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
5286 "includes_rshift_p (operands[2], GEN_INT (255))"
5288 {rlinm.|rlwinm.} %0,%1,%s2,0xff
5290 [(set_attr "type" "delayed_compare")
5291 (set_attr "length" "4,8")])
5294 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
5298 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5299 (match_operand:SI 2 "const_int_operand" "")) 0))
5301 (set (match_operand:SI 0 "gpc_reg_operand" "")
5302 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
5303 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
5305 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
5307 (compare:CC (match_dup 0)
5312 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5315 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
5316 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
5317 "includes_rshift_p (operands[2], GEN_INT (65535))"
5318 "{rlinm|rlwinm} %0,%1,%s2,0xffff")
5321 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
5325 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5326 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
5328 (clobber (match_scratch:SI 3 "=r,r"))]
5329 "includes_rshift_p (operands[2], GEN_INT (65535))"
5331 {rlinm.|rlwinm.} %3,%1,%s2,0xffff
5333 [(set_attr "type" "delayed_compare")
5334 (set_attr "length" "4,8")])
5337 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
5341 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5342 (match_operand:SI 2 "const_int_operand" "")) 0))
5344 (clobber (match_scratch:SI 3 ""))]
5345 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
5347 (zero_extend:SI (subreg:HI
5348 (lshiftrt:SI (match_dup 1)
5351 (compare:CC (match_dup 3)
5356 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
5360 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5361 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
5363 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
5364 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
5365 "includes_rshift_p (operands[2], GEN_INT (65535))"
5367 {rlinm.|rlwinm.} %0,%1,%s2,0xffff
5369 [(set_attr "type" "delayed_compare")
5370 (set_attr "length" "4,8")])
5373 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
5377 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5378 (match_operand:SI 2 "const_int_operand" "")) 0))
5380 (set (match_operand:SI 0 "gpc_reg_operand" "")
5381 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
5382 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
5384 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
5386 (compare:CC (match_dup 0)
5391 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
5393 (match_operand:SI 1 "gpc_reg_operand" "r"))
5394 (ashiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
5400 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
5402 (match_operand:SI 1 "gpc_reg_operand" "r"))
5403 (lshiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
5409 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
5411 (match_operand:SI 1 "gpc_reg_operand" "r"))
5412 (zero_extract:SI (match_operand:SI 2 "gpc_reg_operand" "r")
5418 (define_expand "ashrsi3"
5419 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5420 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5421 (match_operand:SI 2 "reg_or_cint_operand" "")))]
5426 emit_insn (gen_ashrsi3_power (operands[0], operands[1], operands[2]));
5428 emit_insn (gen_ashrsi3_no_power (operands[0], operands[1], operands[2]));
5432 (define_insn "ashrsi3_power"
5433 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
5434 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5435 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
5436 (clobber (match_scratch:SI 3 "=q,X"))]
5440 {srai|srawi} %0,%1,%h2"
5441 [(set_attr "type" "shift")])
5443 (define_insn "ashrsi3_no_power"
5444 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
5445 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5446 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
5450 {srai|srawi} %0,%1,%h2"
5451 [(set_attr "type" "var_shift_rotate,shift")])
5453 (define_insn "*ashrsi3_64"
5454 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
5456 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5457 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))))]
5461 {srai|srawi} %0,%1,%h2"
5462 [(set_attr "type" "var_shift_rotate,shift")])
5465 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
5466 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
5467 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
5469 (clobber (match_scratch:SI 3 "=r,r,r,r"))
5470 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
5474 {srai.|srawi.} %3,%1,%h2
5477 [(set_attr "type" "delayed_compare")
5478 (set_attr "length" "4,4,8,8")])
5481 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
5482 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5483 (match_operand:SI 2 "reg_or_cint_operand" ""))
5485 (clobber (match_scratch:SI 3 ""))
5486 (clobber (match_scratch:SI 4 ""))]
5487 "TARGET_POWER && reload_completed"
5488 [(parallel [(set (match_dup 3)
5489 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5490 (clobber (match_dup 4))])
5492 (compare:CC (match_dup 3)
5497 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
5498 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
5499 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
5501 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
5504 {sra.|sraw.} %3,%1,%2
5505 {srai.|srawi.} %3,%1,%h2
5508 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
5509 (set_attr "length" "4,4,8,8")])
5512 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
5513 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5514 (match_operand:SI 2 "reg_or_cint_operand" ""))
5516 (clobber (match_scratch:SI 3 ""))]
5517 "! TARGET_POWER && reload_completed"
5519 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5521 (compare:CC (match_dup 3)
5526 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
5527 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
5528 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
5530 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
5531 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5532 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
5536 {srai.|srawi.} %0,%1,%h2
5539 [(set_attr "type" "delayed_compare")
5540 (set_attr "length" "4,4,8,8")])
5543 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
5544 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5545 (match_operand:SI 2 "reg_or_cint_operand" ""))
5547 (set (match_operand:SI 0 "gpc_reg_operand" "")
5548 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5549 (clobber (match_scratch:SI 4 ""))]
5550 "TARGET_POWER && reload_completed"
5551 [(parallel [(set (match_dup 0)
5552 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5553 (clobber (match_dup 4))])
5555 (compare:CC (match_dup 0)
5560 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
5561 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
5562 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
5564 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
5565 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
5568 {sra.|sraw.} %0,%1,%2
5569 {srai.|srawi.} %0,%1,%h2
5572 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
5573 (set_attr "length" "4,4,8,8")])
5575 ;; Builtins to replace a division to generate FRE reciprocal estimate
5576 ;; instructions and the necessary fixup instructions
5577 (define_expand "recip<mode>3"
5578 [(match_operand:RECIPF 0 "gpc_reg_operand" "")
5579 (match_operand:RECIPF 1 "gpc_reg_operand" "")
5580 (match_operand:RECIPF 2 "gpc_reg_operand" "")]
5581 "RS6000_RECIP_HAVE_RE_P (<MODE>mode)"
5583 rs6000_emit_swdiv (operands[0], operands[1], operands[2], false);
5587 ;; Split to create division from FRE/FRES/etc. and fixup instead of the normal
5588 ;; hardware division. This is only done before register allocation and with
5589 ;; -ffast-math. This must appear before the divsf3/divdf3 insns.
5591 [(set (match_operand:RECIPF 0 "gpc_reg_operand" "")
5592 (div:RECIPF (match_operand 1 "gpc_reg_operand" "")
5593 (match_operand 2 "gpc_reg_operand" "")))]
5594 "RS6000_RECIP_AUTO_RE_P (<MODE>mode)
5595 && can_create_pseudo_p () && optimize_insn_for_speed_p ()
5596 && flag_finite_math_only && !flag_trapping_math && flag_reciprocal_math"
5599 rs6000_emit_swdiv (operands[0], operands[1], operands[2], true);
5603 ;; Builtins to replace 1/sqrt(x) with instructions using RSQRTE and the
5604 ;; appropriate fixup.
5605 (define_expand "rsqrt<mode>2"
5606 [(match_operand:RECIPF 0 "gpc_reg_operand" "")
5607 (match_operand:RECIPF 1 "gpc_reg_operand" "")]
5608 "RS6000_RECIP_HAVE_RSQRT_P (<MODE>mode)"
5610 rs6000_emit_swrsqrt (operands[0], operands[1]);
5615 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
5616 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5617 (match_operand:SI 2 "reg_or_cint_operand" ""))
5619 (set (match_operand:SI 0 "gpc_reg_operand" "")
5620 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
5621 "! TARGET_POWER && reload_completed"
5623 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5625 (compare:CC (match_dup 0)
5629 ;; Floating-point insns, excluding normal data motion.
5631 ;; PowerPC has a full set of single-precision floating point instructions.
5633 ;; For the POWER architecture, we pretend that we have both SFmode and
5634 ;; DFmode insns, while, in fact, all fp insns are actually done in double.
5635 ;; The only conversions we will do will be when storing to memory. In that
5636 ;; case, we will use the "frsp" instruction before storing.
5638 ;; Note that when we store into a single-precision memory location, we need to
5639 ;; use the frsp insn first. If the register being stored isn't dead, we
5640 ;; need a scratch register for the frsp. But this is difficult when the store
5641 ;; is done by reload. It is not incorrect to do the frsp on the register in
5642 ;; this case, we just lose precision that we would have otherwise gotten but
5643 ;; is not guaranteed. Perhaps this should be tightened up at some point.
5645 (define_expand "extendsfdf2"
5646 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5647 (float_extend:DF (match_operand:SF 1 "reg_or_none500mem_operand" "")))]
5648 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5651 (define_insn_and_split "*extendsfdf2_fpr"
5652 [(set (match_operand:DF 0 "gpc_reg_operand" "=d,?d,d")
5653 (float_extend:DF (match_operand:SF 1 "reg_or_mem_operand" "0,f,m")))]
5654 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5659 "&& reload_completed && REG_P (operands[1]) && REGNO (operands[0]) == REGNO (operands[1])"
5662 emit_note (NOTE_INSN_DELETED);
5665 [(set_attr "type" "fp,fp,fpload")])
5667 (define_expand "truncdfsf2"
5668 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5669 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "")))]
5670 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5673 (define_insn "*truncdfsf2_fpr"
5674 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5675 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "d")))]
5676 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5678 [(set_attr "type" "fp")])
5680 (define_insn "aux_truncdfsf2"
5681 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5682 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRSP))]
5683 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5685 [(set_attr "type" "fp")])
5687 (define_expand "negsf2"
5688 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5689 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
5690 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
5693 (define_insn "*negsf2"
5694 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5695 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5696 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5698 [(set_attr "type" "fp")])
5700 (define_expand "abssf2"
5701 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5702 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
5703 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
5706 (define_insn "*abssf2"
5707 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5708 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5709 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5711 [(set_attr "type" "fp")])
5714 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5715 (neg:SF (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f"))))]
5716 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5718 [(set_attr "type" "fp")])
5720 (define_expand "addsf3"
5721 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5722 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "")
5723 (match_operand:SF 2 "gpc_reg_operand" "")))]
5724 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
5728 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5729 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5730 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5731 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5733 [(set_attr "type" "fp")
5734 (set_attr "fp_type" "fp_addsub_s")])
5737 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5738 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5739 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5740 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5741 "{fa|fadd} %0,%1,%2"
5742 [(set_attr "type" "fp")])
5744 (define_expand "subsf3"
5745 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5746 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "")
5747 (match_operand:SF 2 "gpc_reg_operand" "")))]
5748 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
5752 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5753 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5754 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5755 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5757 [(set_attr "type" "fp")
5758 (set_attr "fp_type" "fp_addsub_s")])
5761 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5762 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5763 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5764 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5765 "{fs|fsub} %0,%1,%2"
5766 [(set_attr "type" "fp")])
5768 (define_expand "mulsf3"
5769 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5770 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "")
5771 (match_operand:SF 2 "gpc_reg_operand" "")))]
5772 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
5776 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5777 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5778 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5779 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5781 [(set_attr "type" "fp")
5782 (set_attr "fp_type" "fp_mul_s")])
5785 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5786 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5787 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5788 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5789 "{fm|fmul} %0,%1,%2"
5790 [(set_attr "type" "dmul")])
5792 (define_expand "divsf3"
5793 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5794 (div:SF (match_operand:SF 1 "gpc_reg_operand" "")
5795 (match_operand:SF 2 "gpc_reg_operand" "")))]
5796 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
5800 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5801 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5802 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5803 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS
5804 && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
5806 [(set_attr "type" "sdiv")])
5809 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5810 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5811 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5812 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS
5813 && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
5814 "{fd|fdiv} %0,%1,%2"
5815 [(set_attr "type" "ddiv")])
5818 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5819 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))]
5822 [(set_attr "type" "fp")])
5824 (define_insn "*fmaddsf4_powerpc"
5825 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5826 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5827 (match_operand:SF 2 "gpc_reg_operand" "f"))
5828 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5829 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS
5830 && TARGET_SINGLE_FLOAT && TARGET_FUSED_MADD"
5831 "fmadds %0,%1,%2,%3"
5832 [(set_attr "type" "fp")
5833 (set_attr "fp_type" "fp_maddsub_s")])
5835 (define_insn "*fmaddsf4_power"
5836 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5837 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5838 (match_operand:SF 2 "gpc_reg_operand" "f"))
5839 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5840 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5841 "{fma|fmadd} %0,%1,%2,%3"
5842 [(set_attr "type" "dmul")])
5844 (define_insn "*fmsubsf4_powerpc"
5845 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5846 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5847 (match_operand:SF 2 "gpc_reg_operand" "f"))
5848 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5849 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS
5850 && TARGET_SINGLE_FLOAT && TARGET_FUSED_MADD"
5851 "fmsubs %0,%1,%2,%3"
5852 [(set_attr "type" "fp")
5853 (set_attr "fp_type" "fp_maddsub_s")])
5855 (define_insn "*fmsubsf4_power"
5856 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5857 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5858 (match_operand:SF 2 "gpc_reg_operand" "f"))
5859 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5860 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5861 "{fms|fmsub} %0,%1,%2,%3"
5862 [(set_attr "type" "dmul")])
5864 (define_insn "*fnmaddsf4_powerpc_1"
5865 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5866 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5867 (match_operand:SF 2 "gpc_reg_operand" "f"))
5868 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5869 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5870 && TARGET_SINGLE_FLOAT"
5871 "fnmadds %0,%1,%2,%3"
5872 [(set_attr "type" "fp")
5873 (set_attr "fp_type" "fp_maddsub_s")])
5875 (define_insn "*fnmaddsf4_powerpc_2"
5876 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5877 (minus:SF (mult:SF (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f"))
5878 (match_operand:SF 2 "gpc_reg_operand" "f"))
5879 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5880 "TARGET_POWERPC && TARGET_SINGLE_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5881 && ! HONOR_SIGNED_ZEROS (SFmode)"
5882 "fnmadds %0,%1,%2,%3"
5883 [(set_attr "type" "fp")
5884 (set_attr "fp_type" "fp_maddsub_s")])
5886 (define_insn "*fnmaddsf4_power_1"
5887 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5888 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5889 (match_operand:SF 2 "gpc_reg_operand" "f"))
5890 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5891 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5892 "{fnma|fnmadd} %0,%1,%2,%3"
5893 [(set_attr "type" "dmul")])
5895 (define_insn "*fnmaddsf4_power_2"
5896 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5897 (minus:SF (mult:SF (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f"))
5898 (match_operand:SF 2 "gpc_reg_operand" "f"))
5899 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5900 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5901 && ! HONOR_SIGNED_ZEROS (SFmode)"
5902 "{fnma|fnmadd} %0,%1,%2,%3"
5903 [(set_attr "type" "dmul")])
5905 (define_insn "*fnmsubsf4_powerpc_1"
5906 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5907 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5908 (match_operand:SF 2 "gpc_reg_operand" "f"))
5909 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5910 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5911 && TARGET_SINGLE_FLOAT"
5912 "fnmsubs %0,%1,%2,%3"
5913 [(set_attr "type" "fp")
5914 (set_attr "fp_type" "fp_maddsub_s")])
5916 (define_insn "*fnmsubsf4_powerpc_2"
5917 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5918 (minus:SF (match_operand:SF 3 "gpc_reg_operand" "f")
5919 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5920 (match_operand:SF 2 "gpc_reg_operand" "f"))))]
5921 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5922 && TARGET_SINGLE_FLOAT && ! HONOR_SIGNED_ZEROS (SFmode)"
5923 "fnmsubs %0,%1,%2,%3"
5924 [(set_attr "type" "fp")
5925 (set_attr "fp_type" "fp_maddsub_s")])
5927 (define_insn "*fnmsubsf4_power_1"
5928 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5929 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5930 (match_operand:SF 2 "gpc_reg_operand" "f"))
5931 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5932 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5933 "{fnms|fnmsub} %0,%1,%2,%3"
5934 [(set_attr "type" "dmul")])
5936 (define_insn "*fnmsubsf4_power_2"
5937 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5938 (minus:SF (match_operand:SF 3 "gpc_reg_operand" "f")
5939 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5940 (match_operand:SF 2 "gpc_reg_operand" "f"))))]
5941 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5942 && ! HONOR_SIGNED_ZEROS (SFmode)"
5943 "{fnms|fnmsub} %0,%1,%2,%3"
5944 [(set_attr "type" "dmul")])
5946 (define_expand "sqrtsf2"
5947 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5948 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
5949 "(TARGET_PPC_GPOPT || TARGET_POWER2 || TARGET_XILINX_FPU)
5950 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
5951 && !TARGET_SIMPLE_FPU"
5955 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5956 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5957 "(TARGET_PPC_GPOPT || TARGET_XILINX_FPU) && TARGET_HARD_FLOAT
5958 && TARGET_FPRS && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
5960 [(set_attr "type" "ssqrt")])
5963 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5964 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5965 "TARGET_POWER2 && TARGET_HARD_FLOAT && TARGET_FPRS
5966 && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
5968 [(set_attr "type" "dsqrt")])
5970 (define_insn "*rsqrtsf_internal1"
5971 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5972 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")]
5976 [(set_attr "type" "fp")])
5978 (define_expand "copysignsf3"
5980 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "")))
5982 (neg:SF (abs:SF (match_dup 1))))
5983 (set (match_operand:SF 0 "gpc_reg_operand" "")
5984 (if_then_else:SF (ge (match_operand:SF 2 "gpc_reg_operand" "")
5988 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
5989 && ((TARGET_PPC_GFXOPT
5990 && !HONOR_NANS (SFmode)
5991 && !HONOR_SIGNED_ZEROS (SFmode))
5992 || VECTOR_UNIT_VSX_P (DFmode))"
5994 if (VECTOR_UNIT_VSX_P (DFmode))
5996 emit_insn (gen_vsx_copysignsf3 (operands[0], operands[1], operands[2],
5997 CONST0_RTX (SFmode)));
6000 operands[3] = gen_reg_rtx (SFmode);
6001 operands[4] = gen_reg_rtx (SFmode);
6002 operands[5] = CONST0_RTX (SFmode);
6005 (define_expand "copysigndf3"
6007 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "")))
6009 (neg:DF (abs:DF (match_dup 1))))
6010 (set (match_operand:DF 0 "gpc_reg_operand" "")
6011 (if_then_else:DF (ge (match_operand:DF 2 "gpc_reg_operand" "")
6015 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6016 && ((TARGET_PPC_GFXOPT
6017 && !HONOR_NANS (DFmode)
6018 && !HONOR_SIGNED_ZEROS (DFmode))
6019 || VECTOR_UNIT_VSX_P (DFmode))"
6021 if (VECTOR_UNIT_VSX_P (DFmode))
6023 emit_insn (gen_vsx_copysigndf3 (operands[0], operands[1],
6024 operands[2], CONST0_RTX (DFmode)));
6027 operands[3] = gen_reg_rtx (DFmode);
6028 operands[4] = gen_reg_rtx (DFmode);
6029 operands[5] = CONST0_RTX (DFmode);
6032 ;; For MIN, MAX, and conditional move, we use DEFINE_EXPAND's that involve a
6033 ;; fsel instruction and some auxiliary computations. Then we just have a
6034 ;; single DEFINE_INSN for fsel and the define_splits to make them if made by
6036 (define_expand "smaxsf3"
6037 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6038 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
6039 (match_operand:SF 2 "gpc_reg_operand" ""))
6042 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
6043 && TARGET_SINGLE_FLOAT && !flag_trapping_math"
6044 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
6046 (define_expand "sminsf3"
6047 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6048 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
6049 (match_operand:SF 2 "gpc_reg_operand" ""))
6052 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
6053 && TARGET_SINGLE_FLOAT && !flag_trapping_math"
6054 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
6057 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6058 (match_operator:SF 3 "min_max_operator"
6059 [(match_operand:SF 1 "gpc_reg_operand" "")
6060 (match_operand:SF 2 "gpc_reg_operand" "")]))]
6061 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
6062 && TARGET_SINGLE_FLOAT && !flag_trapping_math"
6065 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
6066 operands[1], operands[2]);
6070 (define_expand "mov<mode>cc"
6071 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
6072 (if_then_else:GPR (match_operand 1 "comparison_operator" "")
6073 (match_operand:GPR 2 "gpc_reg_operand" "")
6074 (match_operand:GPR 3 "gpc_reg_operand" "")))]
6078 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
6084 ;; We use the BASE_REGS for the isel input operands because, if rA is
6085 ;; 0, the value of 0 is placed in rD upon truth. Similarly for rB
6086 ;; because we may switch the operands and rB may end up being rA.
6088 ;; We need 2 patterns: an unsigned and a signed pattern. We could
6089 ;; leave out the mode in operand 4 and use one pattern, but reload can
6090 ;; change the mode underneath our feet and then gets confused trying
6091 ;; to reload the value.
6092 (define_insn "isel_signed_<mode>"
6093 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
6095 (match_operator 1 "comparison_operator"
6096 [(match_operand:CC 4 "cc_reg_operand" "y")
6098 (match_operand:GPR 2 "gpc_reg_operand" "b")
6099 (match_operand:GPR 3 "gpc_reg_operand" "b")))]
6102 { return output_isel (operands); }"
6103 [(set_attr "type" "isel")
6104 (set_attr "length" "4")])
6106 (define_insn "isel_unsigned_<mode>"
6107 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
6109 (match_operator 1 "comparison_operator"
6110 [(match_operand:CCUNS 4 "cc_reg_operand" "y")
6112 (match_operand:GPR 2 "gpc_reg_operand" "b")
6113 (match_operand:GPR 3 "gpc_reg_operand" "b")))]
6116 { return output_isel (operands); }"
6117 [(set_attr "type" "isel")
6118 (set_attr "length" "4")])
6120 (define_expand "movsfcc"
6121 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6122 (if_then_else:SF (match_operand 1 "comparison_operator" "")
6123 (match_operand:SF 2 "gpc_reg_operand" "")
6124 (match_operand:SF 3 "gpc_reg_operand" "")))]
6125 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
6128 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
6134 (define_insn "*fselsfsf4"
6135 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6136 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
6137 (match_operand:SF 4 "zero_fp_constant" "F"))
6138 (match_operand:SF 2 "gpc_reg_operand" "f")
6139 (match_operand:SF 3 "gpc_reg_operand" "f")))]
6140 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
6142 [(set_attr "type" "fp")])
6144 (define_insn "*fseldfsf4"
6145 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6146 (if_then_else:SF (ge (match_operand:DF 1 "gpc_reg_operand" "d")
6147 (match_operand:DF 4 "zero_fp_constant" "F"))
6148 (match_operand:SF 2 "gpc_reg_operand" "f")
6149 (match_operand:SF 3 "gpc_reg_operand" "f")))]
6150 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_SINGLE_FLOAT"
6152 [(set_attr "type" "fp")])
6154 (define_expand "negdf2"
6155 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6156 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
6157 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6160 (define_insn "*negdf2_fpr"
6161 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6162 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "d")))]
6163 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6164 && !VECTOR_UNIT_VSX_P (DFmode)"
6166 [(set_attr "type" "fp")])
6168 (define_expand "absdf2"
6169 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6170 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
6171 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6174 (define_insn "*absdf2_fpr"
6175 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6176 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "d")))]
6177 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6178 && !VECTOR_UNIT_VSX_P (DFmode)"
6180 [(set_attr "type" "fp")])
6182 (define_insn "*nabsdf2_fpr"
6183 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6184 (neg:DF (abs:DF (match_operand:DF 1 "gpc_reg_operand" "d"))))]
6185 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6186 && !VECTOR_UNIT_VSX_P (DFmode)"
6188 [(set_attr "type" "fp")])
6190 (define_expand "adddf3"
6191 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6192 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "")
6193 (match_operand:DF 2 "gpc_reg_operand" "")))]
6194 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6197 (define_insn "*adddf3_fpr"
6198 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6199 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
6200 (match_operand:DF 2 "gpc_reg_operand" "d")))]
6201 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6202 && !VECTOR_UNIT_VSX_P (DFmode)"
6203 "{fa|fadd} %0,%1,%2"
6204 [(set_attr "type" "fp")
6205 (set_attr "fp_type" "fp_addsub_d")])
6207 (define_expand "subdf3"
6208 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6209 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "")
6210 (match_operand:DF 2 "gpc_reg_operand" "")))]
6211 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6214 (define_insn "*subdf3_fpr"
6215 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6216 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "d")
6217 (match_operand:DF 2 "gpc_reg_operand" "d")))]
6218 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6219 && !VECTOR_UNIT_VSX_P (DFmode)"
6220 "{fs|fsub} %0,%1,%2"
6221 [(set_attr "type" "fp")
6222 (set_attr "fp_type" "fp_addsub_d")])
6224 (define_expand "muldf3"
6225 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6226 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "")
6227 (match_operand:DF 2 "gpc_reg_operand" "")))]
6228 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6231 (define_insn "*muldf3_fpr"
6232 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6233 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
6234 (match_operand:DF 2 "gpc_reg_operand" "d")))]
6235 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6236 && !VECTOR_UNIT_VSX_P (DFmode)"
6237 "{fm|fmul} %0,%1,%2"
6238 [(set_attr "type" "dmul")
6239 (set_attr "fp_type" "fp_mul_d")])
6241 (define_expand "divdf3"
6242 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6243 (div:DF (match_operand:DF 1 "gpc_reg_operand" "")
6244 (match_operand:DF 2 "gpc_reg_operand" "")))]
6246 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)
6247 && !TARGET_SIMPLE_FPU"
6250 (define_insn "*divdf3_fpr"
6251 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6252 (div:DF (match_operand:DF 1 "gpc_reg_operand" "d")
6253 (match_operand:DF 2 "gpc_reg_operand" "d")))]
6254 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && !TARGET_SIMPLE_FPU
6255 && !VECTOR_UNIT_VSX_P (DFmode)"
6256 "{fd|fdiv} %0,%1,%2"
6257 [(set_attr "type" "ddiv")])
6259 (define_insn "*fred_fpr"
6260 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6261 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))]
6262 "TARGET_FRE && !VECTOR_UNIT_VSX_P (DFmode)"
6264 [(set_attr "type" "fp")])
6266 (define_insn "*rsqrtdf_internal1"
6267 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6268 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "d")]
6270 "TARGET_FRSQRTE && !VECTOR_UNIT_VSX_P (DFmode)"
6272 [(set_attr "type" "fp")])
6274 (define_insn "*fmadddf4_fpr"
6275 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6276 (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
6277 (match_operand:DF 2 "gpc_reg_operand" "d"))
6278 (match_operand:DF 3 "gpc_reg_operand" "d")))]
6279 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD && TARGET_DOUBLE_FLOAT
6280 && VECTOR_UNIT_NONE_P (DFmode)"
6281 "{fma|fmadd} %0,%1,%2,%3"
6282 [(set_attr "type" "dmul")
6283 (set_attr "fp_type" "fp_maddsub_d")])
6285 (define_insn "*fmsubdf4_fpr"
6286 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6287 (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
6288 (match_operand:DF 2 "gpc_reg_operand" "d"))
6289 (match_operand:DF 3 "gpc_reg_operand" "d")))]
6290 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD && TARGET_DOUBLE_FLOAT
6291 && VECTOR_UNIT_NONE_P (DFmode)"
6292 "{fms|fmsub} %0,%1,%2,%3"
6293 [(set_attr "type" "dmul")
6294 (set_attr "fp_type" "fp_maddsub_d")])
6296 (define_insn "*fnmadddf4_fpr_1"
6297 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6298 (neg:DF (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
6299 (match_operand:DF 2 "gpc_reg_operand" "d"))
6300 (match_operand:DF 3 "gpc_reg_operand" "d"))))]
6301 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD && TARGET_DOUBLE_FLOAT
6302 && VECTOR_UNIT_NONE_P (DFmode)"
6303 "{fnma|fnmadd} %0,%1,%2,%3"
6304 [(set_attr "type" "dmul")
6305 (set_attr "fp_type" "fp_maddsub_d")])
6307 (define_insn "*fnmadddf4_fpr_2"
6308 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6309 (minus:DF (mult:DF (neg:DF (match_operand:DF 1 "gpc_reg_operand" "d"))
6310 (match_operand:DF 2 "gpc_reg_operand" "d"))
6311 (match_operand:DF 3 "gpc_reg_operand" "d")))]
6312 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD && TARGET_DOUBLE_FLOAT
6313 && ! HONOR_SIGNED_ZEROS (DFmode) && VECTOR_UNIT_NONE_P (DFmode)"
6314 "{fnma|fnmadd} %0,%1,%2,%3"
6315 [(set_attr "type" "dmul")
6316 (set_attr "fp_type" "fp_maddsub_d")])
6318 (define_insn "*fnmsubdf4_fpr_1"
6319 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6320 (neg:DF (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
6321 (match_operand:DF 2 "gpc_reg_operand" "d"))
6322 (match_operand:DF 3 "gpc_reg_operand" "d"))))]
6323 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD && TARGET_DOUBLE_FLOAT
6324 && VECTOR_UNIT_NONE_P (DFmode)"
6325 "{fnms|fnmsub} %0,%1,%2,%3"
6326 [(set_attr "type" "dmul")
6327 (set_attr "fp_type" "fp_maddsub_d")])
6329 (define_insn "*fnmsubdf4_fpr_2"
6330 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6331 (minus:DF (match_operand:DF 3 "gpc_reg_operand" "d")
6332 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
6333 (match_operand:DF 2 "gpc_reg_operand" "d"))))]
6334 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD && TARGET_DOUBLE_FLOAT
6335 && ! HONOR_SIGNED_ZEROS (DFmode) && VECTOR_UNIT_NONE_P (DFmode)"
6336 "{fnms|fnmsub} %0,%1,%2,%3"
6337 [(set_attr "type" "dmul")
6338 (set_attr "fp_type" "fp_maddsub_d")])
6340 (define_expand "sqrtdf2"
6341 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6342 (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
6343 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS
6344 && TARGET_DOUBLE_FLOAT"
6347 (define_insn "*sqrtdf2_fpr"
6348 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6349 (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "d")))]
6350 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS
6351 && TARGET_DOUBLE_FLOAT
6352 && !VECTOR_UNIT_VSX_P (DFmode)"
6354 [(set_attr "type" "dsqrt")])
6356 ;; The conditional move instructions allow us to perform max and min
6357 ;; operations even when
6359 (define_expand "smaxdf3"
6360 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6361 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
6362 (match_operand:DF 2 "gpc_reg_operand" ""))
6365 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6366 && !flag_trapping_math"
6367 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
6369 (define_expand "smindf3"
6370 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6371 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
6372 (match_operand:DF 2 "gpc_reg_operand" ""))
6375 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6376 && !flag_trapping_math"
6377 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
6380 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6381 (match_operator:DF 3 "min_max_operator"
6382 [(match_operand:DF 1 "gpc_reg_operand" "")
6383 (match_operand:DF 2 "gpc_reg_operand" "")]))]
6384 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6385 && !flag_trapping_math"
6388 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
6389 operands[1], operands[2]);
6393 (define_expand "movdfcc"
6394 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6395 (if_then_else:DF (match_operand 1 "comparison_operator" "")
6396 (match_operand:DF 2 "gpc_reg_operand" "")
6397 (match_operand:DF 3 "gpc_reg_operand" "")))]
6398 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6401 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
6407 (define_insn "*fseldfdf4"
6408 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6409 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "d")
6410 (match_operand:DF 4 "zero_fp_constant" "F"))
6411 (match_operand:DF 2 "gpc_reg_operand" "d")
6412 (match_operand:DF 3 "gpc_reg_operand" "d")))]
6413 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6415 [(set_attr "type" "fp")])
6417 (define_insn "*fselsfdf4"
6418 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6419 (if_then_else:DF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
6420 (match_operand:SF 4 "zero_fp_constant" "F"))
6421 (match_operand:DF 2 "gpc_reg_operand" "d")
6422 (match_operand:DF 3 "gpc_reg_operand" "d")))]
6423 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_SINGLE_FLOAT"
6425 [(set_attr "type" "fp")])
6427 ;; Conversions to and from floating-point.
6429 (define_expand "fixuns_truncsfsi2"
6430 [(set (match_operand:SI 0 "gpc_reg_operand" "")
6431 (unsigned_fix:SI (match_operand:SF 1 "gpc_reg_operand" "")))]
6432 "TARGET_HARD_FLOAT && !TARGET_FPRS && TARGET_SINGLE_FLOAT"
6435 (define_expand "fix_truncsfsi2"
6436 [(set (match_operand:SI 0 "gpc_reg_operand" "")
6437 (fix:SI (match_operand:SF 1 "gpc_reg_operand" "")))]
6438 "TARGET_HARD_FLOAT && !TARGET_FPRS && TARGET_SINGLE_FLOAT"
6441 (define_expand "fixuns_truncdfsi2"
6442 [(set (match_operand:SI 0 "gpc_reg_operand" "")
6443 (unsigned_fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))]
6444 "TARGET_HARD_FLOAT && TARGET_E500_DOUBLE"
6447 (define_expand "fixuns_truncdfdi2"
6448 [(set (match_operand:DI 0 "register_operand" "")
6449 (unsigned_fix:DI (match_operand:DF 1 "register_operand" "")))]
6450 "TARGET_HARD_FLOAT && TARGET_VSX"
6453 ; For each of these conversions, there is a define_expand, a define_insn
6454 ; with a '#' template, and a define_split (with C code). The idea is
6455 ; to allow constant folding with the template of the define_insn,
6456 ; then to have the insns split later (between sched1 and final).
6458 (define_expand "floatsidf2"
6459 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
6460 (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
6463 (clobber (match_dup 4))
6464 (clobber (match_dup 5))
6465 (clobber (match_dup 6))])]
6467 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6470 if (TARGET_E500_DOUBLE)
6472 emit_insn (gen_spe_floatsidf2 (operands[0], operands[1]));
6475 if (TARGET_POWERPC64)
6477 rtx x = convert_to_mode (DImode, operands[1], 0);
6478 emit_insn (gen_floatdidf2 (operands[0], x));
6482 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
6483 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503601774854144\", DFmode));
6484 operands[4] = assign_stack_temp (DFmode, GET_MODE_SIZE (DFmode), 0);
6485 operands[5] = gen_reg_rtx (DFmode);
6486 operands[6] = gen_reg_rtx (SImode);
6489 (define_insn_and_split "*floatsidf2_internal"
6490 [(set (match_operand:DF 0 "gpc_reg_operand" "=&d")
6491 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
6492 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
6493 (use (match_operand:DF 3 "gpc_reg_operand" "d"))
6494 (clobber (match_operand:DF 4 "offsettable_mem_operand" "=o"))
6495 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&d"))
6496 (clobber (match_operand:SI 6 "gpc_reg_operand" "=&r"))]
6497 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6503 rtx lowword, highword;
6504 gcc_assert (MEM_P (operands[4]));
6505 highword = adjust_address (operands[4], SImode, 0);
6506 lowword = adjust_address (operands[4], SImode, 4);
6507 if (! WORDS_BIG_ENDIAN)
6510 tmp = highword; highword = lowword; lowword = tmp;
6513 emit_insn (gen_xorsi3 (operands[6], operands[1],
6514 GEN_INT (~ (HOST_WIDE_INT) 0x7fffffff)));
6515 emit_move_insn (lowword, operands[6]);
6516 emit_move_insn (highword, operands[2]);
6517 emit_move_insn (operands[5], operands[4]);
6518 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
6521 [(set_attr "length" "24")])
6523 (define_expand "floatunssisf2"
6524 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6525 (unsigned_float:SF (match_operand:SI 1 "gpc_reg_operand" "")))]
6526 "TARGET_HARD_FLOAT && !TARGET_FPRS && TARGET_SINGLE_FLOAT"
6529 (define_expand "floatunssidf2"
6530 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
6531 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
6534 (clobber (match_dup 4))
6535 (clobber (match_dup 5))])]
6536 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6539 if (TARGET_E500_DOUBLE)
6541 emit_insn (gen_spe_floatunssidf2 (operands[0], operands[1]));
6544 if (TARGET_POWERPC64)
6546 rtx x = convert_to_mode (DImode, operands[1], 1);
6547 emit_insn (gen_floatdidf2 (operands[0], x));
6551 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
6552 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503599627370496\", DFmode));
6553 operands[4] = assign_stack_temp (DFmode, GET_MODE_SIZE (DFmode), 0);
6554 operands[5] = gen_reg_rtx (DFmode);
6557 (define_insn_and_split "*floatunssidf2_internal"
6558 [(set (match_operand:DF 0 "gpc_reg_operand" "=&d")
6559 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
6560 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
6561 (use (match_operand:DF 3 "gpc_reg_operand" "d"))
6562 (clobber (match_operand:DF 4 "offsettable_mem_operand" "=o"))
6563 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&d"))]
6564 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6570 rtx lowword, highword;
6571 gcc_assert (MEM_P (operands[4]));
6572 highword = adjust_address (operands[4], SImode, 0);
6573 lowword = adjust_address (operands[4], SImode, 4);
6574 if (! WORDS_BIG_ENDIAN)
6577 tmp = highword; highword = lowword; lowword = tmp;
6580 emit_move_insn (lowword, operands[1]);
6581 emit_move_insn (highword, operands[2]);
6582 emit_move_insn (operands[5], operands[4]);
6583 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
6586 [(set_attr "length" "20")])
6588 (define_expand "fix_truncdfsi2"
6589 [(parallel [(set (match_operand:SI 0 "fix_trunc_dest_operand" "")
6590 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))
6591 (clobber (match_dup 2))
6592 (clobber (match_dup 3))])]
6593 "(TARGET_POWER2 || TARGET_POWERPC)
6594 && TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6597 if (TARGET_E500_DOUBLE)
6599 emit_insn (gen_spe_fix_truncdfsi2 (operands[0], operands[1]));
6602 operands[2] = gen_reg_rtx (DImode);
6603 if (TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
6604 && gpc_reg_operand(operands[0], GET_MODE (operands[0])))
6606 operands[3] = gen_reg_rtx (DImode);
6607 emit_insn (gen_fix_truncdfsi2_mfpgpr (operands[0], operands[1],
6608 operands[2], operands[3]));
6611 if (TARGET_PPC_GFXOPT)
6613 rtx orig_dest = operands[0];
6614 if (! memory_operand (orig_dest, GET_MODE (orig_dest)))
6615 operands[0] = assign_stack_temp (SImode, GET_MODE_SIZE (SImode), 0);
6616 emit_insn (gen_fix_truncdfsi2_internal_gfxopt (operands[0], operands[1],
6618 if (operands[0] != orig_dest)
6619 emit_move_insn (orig_dest, operands[0]);
6622 operands[3] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
6625 (define_insn_and_split "*fix_truncdfsi2_internal"
6626 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6627 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "d")))
6628 (clobber (match_operand:DI 2 "gpc_reg_operand" "=d"))
6629 (clobber (match_operand:DI 3 "offsettable_mem_operand" "=o"))]
6630 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS
6631 && TARGET_DOUBLE_FLOAT"
6638 gcc_assert (MEM_P (operands[3]));
6639 lowword = adjust_address (operands[3], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
6641 emit_insn (gen_fctiwz (operands[2], operands[1]));
6642 emit_move_insn (operands[3], operands[2]);
6643 emit_move_insn (operands[0], lowword);
6646 [(set_attr "length" "16")])
6648 (define_insn_and_split "fix_truncdfsi2_internal_gfxopt"
6649 [(set (match_operand:SI 0 "memory_operand" "=Z")
6650 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "d")))
6651 (clobber (match_operand:DI 2 "gpc_reg_operand" "=d"))]
6652 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS
6653 && TARGET_DOUBLE_FLOAT
6654 && TARGET_PPC_GFXOPT"
6660 emit_insn (gen_fctiwz (operands[2], operands[1]));
6661 emit_insn (gen_stfiwx (operands[0], operands[2]));
6664 [(set_attr "length" "16")])
6666 (define_insn_and_split "fix_truncdfsi2_mfpgpr"
6667 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6668 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "d")))
6669 (clobber (match_operand:DI 2 "gpc_reg_operand" "=d"))
6670 (clobber (match_operand:DI 3 "gpc_reg_operand" "=r"))]
6671 "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
6672 && TARGET_DOUBLE_FLOAT"
6675 [(set (match_dup 2) (unspec:DI [(fix:SI (match_dup 1))] UNSPEC_FCTIWZ))
6676 (set (match_dup 3) (match_dup 2))
6677 (set (match_dup 0) (subreg:SI (match_dup 3) 4))]
6679 [(set_attr "length" "12")])
6681 ; Here, we use (set (reg) (unspec:DI [(fix:SI ...)] UNSPEC_FCTIWZ))
6682 ; rather than (set (subreg:SI (reg)) (fix:SI ...))
6683 ; because the first makes it clear that operand 0 is not live
6684 ; before the instruction.
6685 (define_insn "fctiwz"
6686 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6687 (unspec:DI [(fix:SI (match_operand:DF 1 "gpc_reg_operand" "d"))]
6689 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS
6690 && TARGET_DOUBLE_FLOAT"
6691 "{fcirz|fctiwz} %0,%1"
6692 [(set_attr "type" "fp")])
6694 (define_expand "btruncdf2"
6695 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6696 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "d")] UNSPEC_FRIZ))]
6697 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6700 (define_insn "*btruncdf2_fpr"
6701 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6702 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRIZ))]
6703 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6704 && !VECTOR_UNIT_VSX_P (DFmode)"
6706 [(set_attr "type" "fp")])
6708 (define_insn "btruncsf2"
6709 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6710 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIZ))]
6711 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
6713 [(set_attr "type" "fp")])
6715 (define_expand "ceildf2"
6716 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6717 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "")] UNSPEC_FRIP))]
6718 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6721 (define_insn "*ceildf2_fpr"
6722 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6723 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "d")] UNSPEC_FRIP))]
6724 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6725 && !VECTOR_UNIT_VSX_P (DFmode)"
6727 [(set_attr "type" "fp")])
6729 (define_insn "ceilsf2"
6730 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6731 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIP))]
6732 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT "
6734 [(set_attr "type" "fp")])
6736 (define_expand "floordf2"
6737 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6738 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "")] UNSPEC_FRIM))]
6739 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6742 (define_insn "*floordf2_fpr"
6743 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6744 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "d")] UNSPEC_FRIM))]
6745 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6746 && !VECTOR_UNIT_VSX_P (DFmode)"
6748 [(set_attr "type" "fp")])
6750 (define_insn "floorsf2"
6751 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6752 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIM))]
6753 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT "
6755 [(set_attr "type" "fp")])
6757 ;; No VSX equivalent to frin
6758 (define_insn "rounddf2"
6759 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6760 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "d")] UNSPEC_FRIN))]
6761 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6763 [(set_attr "type" "fp")])
6765 (define_insn "roundsf2"
6766 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6767 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIN))]
6768 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT "
6770 [(set_attr "type" "fp")])
6772 (define_expand "ftruncdf2"
6773 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6774 (fix:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
6775 "VECTOR_UNIT_VSX_P (DFmode)"
6778 ; An UNSPEC is used so we don't have to support SImode in FP registers.
6779 (define_insn "stfiwx"
6780 [(set (match_operand:SI 0 "memory_operand" "=Z")
6781 (unspec:SI [(match_operand:DI 1 "gpc_reg_operand" "d")]
6785 [(set_attr "type" "fpstore")])
6787 (define_expand "floatsisf2"
6788 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6789 (float:SF (match_operand:SI 1 "gpc_reg_operand" "")))]
6790 "TARGET_HARD_FLOAT && !TARGET_FPRS"
6793 (define_expand "floatdidf2"
6794 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6795 (float:DF (match_operand:DI 1 "gpc_reg_operand" "")))]
6796 "(TARGET_POWERPC64 || TARGET_XILINX_FPU || VECTOR_UNIT_VSX_P (DFmode))
6797 && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS"
6800 (define_insn "*floatdidf2_fpr"
6801 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6802 (float:DF (match_operand:DI 1 "gpc_reg_operand" "!d#r")))]
6803 "(TARGET_POWERPC64 || TARGET_XILINX_FPU)
6804 && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
6805 && !VECTOR_UNIT_VSX_P (DFmode)"
6807 [(set_attr "type" "fp")])
6809 (define_expand "floatunsdidf2"
6810 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6811 (unsigned_float:DF (match_operand:DI 1 "gpc_reg_operand" "")))]
6815 (define_expand "fix_truncdfdi2"
6816 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6817 (fix:DI (match_operand:DF 1 "gpc_reg_operand" "")))]
6818 "(TARGET_POWERPC64 || TARGET_XILINX_FPU || VECTOR_UNIT_VSX_P (DFmode))
6819 && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS"
6822 (define_insn "*fix_truncdfdi2_fpr"
6823 [(set (match_operand:DI 0 "gpc_reg_operand" "=!d#r")
6824 (fix:DI (match_operand:DF 1 "gpc_reg_operand" "d")))]
6825 "(TARGET_POWERPC64 || TARGET_XILINX_FPU)
6826 && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
6827 && !VECTOR_UNIT_VSX_P (DFmode)"
6829 [(set_attr "type" "fp")])
6831 (define_expand "floatdisf2"
6832 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6833 (float:SF (match_operand:DI 1 "gpc_reg_operand" "")))]
6834 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT "
6837 rtx val = operands[1];
6838 if (!flag_unsafe_math_optimizations)
6840 rtx label = gen_label_rtx ();
6841 val = gen_reg_rtx (DImode);
6842 emit_insn (gen_floatdisf2_internal2 (val, operands[1], label));
6845 emit_insn (gen_floatdisf2_internal1 (operands[0], val));
6849 ;; This is not IEEE compliant if rounding mode is "round to nearest".
6850 ;; If the DI->DF conversion is inexact, then it's possible to suffer
6851 ;; from double rounding.
6852 (define_insn_and_split "floatdisf2_internal1"
6853 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6854 (float:SF (match_operand:DI 1 "gpc_reg_operand" "!d#r")))
6855 (clobber (match_scratch:DF 2 "=d"))]
6856 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
6858 "&& reload_completed"
6860 (float:DF (match_dup 1)))
6862 (float_truncate:SF (match_dup 2)))]
6865 ;; Twiddles bits to avoid double rounding.
6866 ;; Bits that might be truncated when converting to DFmode are replaced
6867 ;; by a bit that won't be lost at that stage, but is below the SFmode
6868 ;; rounding position.
6869 (define_expand "floatdisf2_internal2"
6870 [(set (match_dup 3) (ashiftrt:DI (match_operand:DI 1 "" "")
6872 (parallel [(set (match_operand:DI 0 "" "") (and:DI (match_dup 1)
6874 (clobber (scratch:CC))])
6875 (set (match_dup 3) (plus:DI (match_dup 3)
6877 (set (match_dup 0) (plus:DI (match_dup 0)
6879 (set (match_dup 4) (compare:CCUNS (match_dup 3)
6881 (set (match_dup 0) (ior:DI (match_dup 0)
6883 (parallel [(set (match_dup 0) (and:DI (match_dup 0)
6885 (clobber (scratch:CC))])
6886 (set (pc) (if_then_else (geu (match_dup 4) (const_int 0))
6887 (label_ref (match_operand:DI 2 "" ""))
6889 (set (match_dup 0) (match_dup 1))]
6890 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
6893 operands[3] = gen_reg_rtx (DImode);
6894 operands[4] = gen_reg_rtx (CCUNSmode);
6897 ;; Define the DImode operations that can be done in a small number
6898 ;; of instructions. The & constraints are to prevent the register
6899 ;; allocator from allocating registers that overlap with the inputs
6900 ;; (for example, having an input in 7,8 and an output in 6,7). We
6901 ;; also allow for the output being the same as one of the inputs.
6903 (define_insn "*adddi3_noppc64"
6904 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r")
6905 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,0,0")
6906 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I")))]
6907 "! TARGET_POWERPC64"
6910 if (WORDS_BIG_ENDIAN)
6911 return (GET_CODE (operands[2])) != CONST_INT
6912 ? \"{a|addc} %L0,%L1,%L2\;{ae|adde} %0,%1,%2\"
6913 : \"{ai|addic} %L0,%L1,%2\;{a%G2e|add%G2e} %0,%1\";
6915 return (GET_CODE (operands[2])) != CONST_INT
6916 ? \"{a|addc} %0,%1,%2\;{ae|adde} %L0,%L1,%L2\"
6917 : \"{ai|addic} %0,%1,%2\;{a%G2e|add%G2e} %L0,%L1\";
6919 [(set_attr "type" "two")
6920 (set_attr "length" "8")])
6922 (define_insn "*subdi3_noppc64"
6923 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r,r")
6924 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I,0,r,I")
6925 (match_operand:DI 2 "gpc_reg_operand" "r,r,r,0,0")))]
6926 "! TARGET_POWERPC64"
6929 if (WORDS_BIG_ENDIAN)
6930 return (GET_CODE (operands[1]) != CONST_INT)
6931 ? \"{sf|subfc} %L0,%L2,%L1\;{sfe|subfe} %0,%2,%1\"
6932 : \"{sfi|subfic} %L0,%L2,%1\;{sf%G1e|subf%G1e} %0,%2\";
6934 return (GET_CODE (operands[1]) != CONST_INT)
6935 ? \"{sf|subfc} %0,%2,%1\;{sfe|subfe} %L0,%L2,%L1\"
6936 : \"{sfi|subfic} %0,%2,%1\;{sf%G1e|subf%G1e} %L0,%L2\";
6938 [(set_attr "type" "two")
6939 (set_attr "length" "8")])
6941 (define_insn "*negdi2_noppc64"
6942 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6943 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))]
6944 "! TARGET_POWERPC64"
6947 return (WORDS_BIG_ENDIAN)
6948 ? \"{sfi|subfic} %L0,%L1,0\;{sfze|subfze} %0,%1\"
6949 : \"{sfi|subfic} %0,%1,0\;{sfze|subfze} %L0,%L1\";
6951 [(set_attr "type" "two")
6952 (set_attr "length" "8")])
6954 (define_expand "mulsidi3"
6955 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6956 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6957 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6958 "! TARGET_POWERPC64"
6961 if (! TARGET_POWER && ! TARGET_POWERPC)
6963 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
6964 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
6965 emit_insn (gen_mull_call ());
6966 if (WORDS_BIG_ENDIAN)
6967 emit_move_insn (operands[0], gen_rtx_REG (DImode, 3));
6970 emit_move_insn (operand_subword (operands[0], 0, 0, DImode),
6971 gen_rtx_REG (SImode, 3));
6972 emit_move_insn (operand_subword (operands[0], 1, 0, DImode),
6973 gen_rtx_REG (SImode, 4));
6977 else if (TARGET_POWER)
6979 emit_insn (gen_mulsidi3_mq (operands[0], operands[1], operands[2]));
6984 (define_insn "mulsidi3_mq"
6985 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6986 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6987 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
6988 (clobber (match_scratch:SI 3 "=q"))]
6990 "mul %0,%1,%2\;mfmq %L0"
6991 [(set_attr "type" "imul")
6992 (set_attr "length" "8")])
6994 (define_insn "*mulsidi3_no_mq"
6995 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6996 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6997 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
6998 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
7001 return (WORDS_BIG_ENDIAN)
7002 ? \"mulhw %0,%1,%2\;mullw %L0,%1,%2\"
7003 : \"mulhw %L0,%1,%2\;mullw %0,%1,%2\";
7005 [(set_attr "type" "imul")
7006 (set_attr "length" "8")])
7009 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7010 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
7011 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
7012 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
7015 (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
7016 (sign_extend:DI (match_dup 2)))
7019 (mult:SI (match_dup 1)
7023 int endian = (WORDS_BIG_ENDIAN == 0);
7024 operands[3] = operand_subword (operands[0], endian, 0, DImode);
7025 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
7028 (define_expand "umulsidi3"
7029 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7030 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
7031 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
7032 "TARGET_POWERPC && ! TARGET_POWERPC64"
7037 emit_insn (gen_umulsidi3_mq (operands[0], operands[1], operands[2]));
7042 (define_insn "umulsidi3_mq"
7043 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
7044 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
7045 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
7046 (clobber (match_scratch:SI 3 "=q"))]
7047 "TARGET_POWERPC && TARGET_POWER"
7050 return (WORDS_BIG_ENDIAN)
7051 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
7052 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
7054 [(set_attr "type" "imul")
7055 (set_attr "length" "8")])
7057 (define_insn "*umulsidi3_no_mq"
7058 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
7059 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
7060 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
7061 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
7064 return (WORDS_BIG_ENDIAN)
7065 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
7066 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
7068 [(set_attr "type" "imul")
7069 (set_attr "length" "8")])
7072 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7073 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
7074 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
7075 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
7078 (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
7079 (zero_extend:DI (match_dup 2)))
7082 (mult:SI (match_dup 1)
7086 int endian = (WORDS_BIG_ENDIAN == 0);
7087 operands[3] = operand_subword (operands[0], endian, 0, DImode);
7088 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
7091 (define_expand "smulsi3_highpart"
7092 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7094 (lshiftrt:DI (mult:DI (sign_extend:DI
7095 (match_operand:SI 1 "gpc_reg_operand" ""))
7097 (match_operand:SI 2 "gpc_reg_operand" "")))
7102 if (! TARGET_POWER && ! TARGET_POWERPC)
7104 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
7105 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
7106 emit_insn (gen_mulh_call ());
7107 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
7110 else if (TARGET_POWER)
7112 emit_insn (gen_smulsi3_highpart_mq (operands[0], operands[1], operands[2]));
7117 (define_insn "smulsi3_highpart_mq"
7118 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7120 (lshiftrt:DI (mult:DI (sign_extend:DI
7121 (match_operand:SI 1 "gpc_reg_operand" "%r"))
7123 (match_operand:SI 2 "gpc_reg_operand" "r")))
7125 (clobber (match_scratch:SI 3 "=q"))]
7128 [(set_attr "type" "imul")])
7130 (define_insn "*smulsi3_highpart_no_mq"
7131 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7133 (lshiftrt:DI (mult:DI (sign_extend:DI
7134 (match_operand:SI 1 "gpc_reg_operand" "%r"))
7136 (match_operand:SI 2 "gpc_reg_operand" "r")))
7138 "TARGET_POWERPC && ! TARGET_POWER"
7140 [(set_attr "type" "imul")])
7142 (define_expand "umulsi3_highpart"
7143 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7145 (lshiftrt:DI (mult:DI (zero_extend:DI
7146 (match_operand:SI 1 "gpc_reg_operand" ""))
7148 (match_operand:SI 2 "gpc_reg_operand" "")))
7155 emit_insn (gen_umulsi3_highpart_mq (operands[0], operands[1], operands[2]));
7160 (define_insn "umulsi3_highpart_mq"
7161 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7163 (lshiftrt:DI (mult:DI (zero_extend:DI
7164 (match_operand:SI 1 "gpc_reg_operand" "%r"))
7166 (match_operand:SI 2 "gpc_reg_operand" "r")))
7168 (clobber (match_scratch:SI 3 "=q"))]
7169 "TARGET_POWERPC && TARGET_POWER"
7171 [(set_attr "type" "imul")])
7173 (define_insn "*umulsi3_highpart_no_mq"
7174 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7176 (lshiftrt:DI (mult:DI (zero_extend:DI
7177 (match_operand:SI 1 "gpc_reg_operand" "%r"))
7179 (match_operand:SI 2 "gpc_reg_operand" "r")))
7181 "TARGET_POWERPC && ! TARGET_POWER"
7183 [(set_attr "type" "imul")])
7185 ;; If operands 0 and 2 are in the same register, we have a problem. But
7186 ;; operands 0 and 1 (the usual case) can be in the same register. That's
7187 ;; why we have the strange constraints below.
7188 (define_insn "ashldi3_power"
7189 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
7190 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
7191 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
7192 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
7195 {sli|slwi} %0,%L1,%h2\;{cal %L0,0(0)|li %L0,0}
7196 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
7197 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
7198 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2"
7199 [(set_attr "length" "8")])
7201 (define_insn "lshrdi3_power"
7202 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
7203 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
7204 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
7205 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
7208 {s%A2i|s%A2wi} %L0,%1,%h2\;{cal %0,0(0)|li %0,0}
7209 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
7210 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
7211 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2"
7212 [(set_attr "length" "8")])
7214 ;; Shift by a variable amount is too complex to be worth open-coding. We
7215 ;; just handle shifts by constants.
7216 (define_insn "ashrdi3_power"
7217 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
7218 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7219 (match_operand:SI 2 "const_int_operand" "M,i")))
7220 (clobber (match_scratch:SI 3 "=X,q"))]
7223 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
7224 sraiq %0,%1,%h2\;srliq %L0,%L1,%h2"
7225 [(set_attr "type" "shift")
7226 (set_attr "length" "8")])
7228 (define_insn "ashrdi3_no_power"
7229 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
7230 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7231 (match_operand:SI 2 "const_int_operand" "M,i")))]
7232 "TARGET_32BIT && !TARGET_POWERPC64 && !TARGET_POWER && WORDS_BIG_ENDIAN"
7234 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
7235 {sri|srwi} %L0,%L1,%h2\;insrwi %L0,%1,%h2,0\;{srai|srawi} %0,%1,%h2"
7236 [(set_attr "type" "two,three")
7237 (set_attr "length" "8,12")])
7239 (define_insn "*ashrdisi3_noppc64"
7240 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7241 (subreg:SI (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7242 (const_int 32)) 4))]
7243 "TARGET_32BIT && !TARGET_POWERPC64"
7246 if (REGNO (operands[0]) == REGNO (operands[1]))
7249 return \"mr %0,%1\";
7251 [(set_attr "length" "4")])
7254 ;; PowerPC64 DImode operations.
7256 (define_expand "absdi2"
7257 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7258 (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))]
7263 emit_insn (gen_absdi2_isel (operands[0], operands[1]));
7265 emit_insn (gen_absdi2_internal (operands[0], operands[1]));
7269 (define_insn_and_split "absdi2_internal"
7270 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
7271 (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))
7272 (clobber (match_scratch:DI 2 "=&r,&r"))]
7273 "TARGET_POWERPC64 && !TARGET_ISEL"
7275 "&& reload_completed"
7276 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
7277 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
7278 (set (match_dup 0) (minus:DI (match_dup 0) (match_dup 2)))]
7281 (define_insn_and_split "*nabsdi2"
7282 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
7283 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0"))))
7284 (clobber (match_scratch:DI 2 "=&r,&r"))]
7285 "TARGET_POWERPC64 && !TARGET_ISEL"
7287 "&& reload_completed"
7288 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
7289 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
7290 (set (match_dup 0) (minus:DI (match_dup 2) (match_dup 0)))]
7293 (define_insn "muldi3"
7294 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7295 (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
7296 (match_operand:DI 2 "reg_or_short_operand" "r,I")))]
7302 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
7303 (const_string "imul3")
7304 (match_operand:SI 2 "short_cint_operand" "")
7305 (const_string "imul2")]
7306 (const_string "lmul")))])
7308 (define_insn "*muldi3_internal1"
7309 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7310 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
7311 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
7313 (clobber (match_scratch:DI 3 "=r,r"))]
7318 [(set_attr "type" "lmul_compare")
7319 (set_attr "length" "4,8")])
7322 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7323 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
7324 (match_operand:DI 2 "gpc_reg_operand" ""))
7326 (clobber (match_scratch:DI 3 ""))]
7327 "TARGET_POWERPC64 && reload_completed"
7329 (mult:DI (match_dup 1) (match_dup 2)))
7331 (compare:CC (match_dup 3)
7335 (define_insn "*muldi3_internal2"
7336 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7337 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
7338 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
7340 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7341 (mult:DI (match_dup 1) (match_dup 2)))]
7346 [(set_attr "type" "lmul_compare")
7347 (set_attr "length" "4,8")])
7350 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7351 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
7352 (match_operand:DI 2 "gpc_reg_operand" ""))
7354 (set (match_operand:DI 0 "gpc_reg_operand" "")
7355 (mult:DI (match_dup 1) (match_dup 2)))]
7356 "TARGET_POWERPC64 && reload_completed"
7358 (mult:DI (match_dup 1) (match_dup 2)))
7360 (compare:CC (match_dup 0)
7364 (define_insn "smuldi3_highpart"
7365 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7367 (lshiftrt:TI (mult:TI (sign_extend:TI
7368 (match_operand:DI 1 "gpc_reg_operand" "%r"))
7370 (match_operand:DI 2 "gpc_reg_operand" "r")))
7374 [(set_attr "type" "lmul")])
7376 (define_insn "umuldi3_highpart"
7377 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7379 (lshiftrt:TI (mult:TI (zero_extend:TI
7380 (match_operand:DI 1 "gpc_reg_operand" "%r"))
7382 (match_operand:DI 2 "gpc_reg_operand" "r")))
7386 [(set_attr "type" "lmul")])
7388 (define_insn "rotldi3"
7389 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7390 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7391 (match_operand:DI 2 "reg_or_cint_operand" "r,i")))]
7396 [(set_attr "type" "var_shift_rotate,integer")])
7398 (define_insn "*rotldi3_internal2"
7399 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7400 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7401 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
7403 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7410 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7411 (set_attr "length" "4,4,8,8")])
7414 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7415 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7416 (match_operand:DI 2 "reg_or_cint_operand" ""))
7418 (clobber (match_scratch:DI 3 ""))]
7419 "TARGET_POWERPC64 && reload_completed"
7421 (rotate:DI (match_dup 1) (match_dup 2)))
7423 (compare:CC (match_dup 3)
7427 (define_insn "*rotldi3_internal3"
7428 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7429 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7430 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
7432 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7433 (rotate:DI (match_dup 1) (match_dup 2)))]
7440 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7441 (set_attr "length" "4,4,8,8")])
7444 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7445 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7446 (match_operand:DI 2 "reg_or_cint_operand" ""))
7448 (set (match_operand:DI 0 "gpc_reg_operand" "")
7449 (rotate:DI (match_dup 1) (match_dup 2)))]
7450 "TARGET_POWERPC64 && reload_completed"
7452 (rotate:DI (match_dup 1) (match_dup 2)))
7454 (compare:CC (match_dup 0)
7458 (define_insn "*rotldi3_internal4"
7459 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7460 (and:DI (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7461 (match_operand:DI 2 "reg_or_cint_operand" "r,i"))
7462 (match_operand:DI 3 "mask64_operand" "n,n")))]
7465 rldc%B3 %0,%1,%2,%S3
7466 rldic%B3 %0,%1,%H2,%S3"
7467 [(set_attr "type" "var_shift_rotate,integer")])
7469 (define_insn "*rotldi3_internal5"
7470 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7472 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7473 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
7474 (match_operand:DI 3 "mask64_operand" "n,n,n,n"))
7476 (clobber (match_scratch:DI 4 "=r,r,r,r"))]
7479 rldc%B3. %4,%1,%2,%S3
7480 rldic%B3. %4,%1,%H2,%S3
7483 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7484 (set_attr "length" "4,4,8,8")])
7487 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7489 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7490 (match_operand:DI 2 "reg_or_cint_operand" ""))
7491 (match_operand:DI 3 "mask64_operand" ""))
7493 (clobber (match_scratch:DI 4 ""))]
7494 "TARGET_POWERPC64 && reload_completed"
7496 (and:DI (rotate:DI (match_dup 1)
7500 (compare:CC (match_dup 4)
7504 (define_insn "*rotldi3_internal6"
7505 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
7507 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7508 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
7509 (match_operand:DI 3 "mask64_operand" "n,n,n,n"))
7511 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7512 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7515 rldc%B3. %0,%1,%2,%S3
7516 rldic%B3. %0,%1,%H2,%S3
7519 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7520 (set_attr "length" "4,4,8,8")])
7523 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
7525 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7526 (match_operand:DI 2 "reg_or_cint_operand" ""))
7527 (match_operand:DI 3 "mask64_operand" ""))
7529 (set (match_operand:DI 0 "gpc_reg_operand" "")
7530 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7531 "TARGET_POWERPC64 && reload_completed"
7533 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
7535 (compare:CC (match_dup 0)
7539 (define_insn "*rotldi3_internal7"
7540 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7543 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7544 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
7548 rldicl %0,%1,%H2,56"
7549 [(set_attr "type" "var_shift_rotate,integer")])
7551 (define_insn "*rotldi3_internal8"
7552 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7553 (compare:CC (zero_extend:DI
7555 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7556 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7558 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7562 rldicl. %3,%1,%H2,56
7565 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7566 (set_attr "length" "4,4,8,8")])
7569 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7570 (compare:CC (zero_extend:DI
7572 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7573 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7575 (clobber (match_scratch:DI 3 ""))]
7576 "TARGET_POWERPC64 && reload_completed"
7578 (zero_extend:DI (subreg:QI
7579 (rotate:DI (match_dup 1)
7582 (compare:CC (match_dup 3)
7586 (define_insn "*rotldi3_internal9"
7587 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7588 (compare:CC (zero_extend:DI
7590 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7591 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7593 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7594 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7598 rldicl. %0,%1,%H2,56
7601 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7602 (set_attr "length" "4,4,8,8")])
7605 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7606 (compare:CC (zero_extend:DI
7608 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7609 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7611 (set (match_operand:DI 0 "gpc_reg_operand" "")
7612 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7613 "TARGET_POWERPC64 && reload_completed"
7615 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
7617 (compare:CC (match_dup 0)
7621 (define_insn "*rotldi3_internal10"
7622 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7625 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7626 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
7630 rldicl %0,%1,%H2,48"
7631 [(set_attr "type" "var_shift_rotate,integer")])
7633 (define_insn "*rotldi3_internal11"
7634 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7635 (compare:CC (zero_extend:DI
7637 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7638 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7640 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7644 rldicl. %3,%1,%H2,48
7647 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7648 (set_attr "length" "4,4,8,8")])
7651 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7652 (compare:CC (zero_extend:DI
7654 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7655 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7657 (clobber (match_scratch:DI 3 ""))]
7658 "TARGET_POWERPC64 && reload_completed"
7660 (zero_extend:DI (subreg:HI
7661 (rotate:DI (match_dup 1)
7664 (compare:CC (match_dup 3)
7668 (define_insn "*rotldi3_internal12"
7669 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7670 (compare:CC (zero_extend:DI
7672 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7673 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7675 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7676 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7680 rldicl. %0,%1,%H2,48
7683 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7684 (set_attr "length" "4,4,8,8")])
7687 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7688 (compare:CC (zero_extend:DI
7690 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7691 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7693 (set (match_operand:DI 0 "gpc_reg_operand" "")
7694 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7695 "TARGET_POWERPC64 && reload_completed"
7697 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
7699 (compare:CC (match_dup 0)
7703 (define_insn "*rotldi3_internal13"
7704 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7707 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7708 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
7712 rldicl %0,%1,%H2,32"
7713 [(set_attr "type" "var_shift_rotate,integer")])
7715 (define_insn "*rotldi3_internal14"
7716 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7717 (compare:CC (zero_extend:DI
7719 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7720 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7722 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7726 rldicl. %3,%1,%H2,32
7729 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7730 (set_attr "length" "4,4,8,8")])
7733 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7734 (compare:CC (zero_extend:DI
7736 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7737 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7739 (clobber (match_scratch:DI 3 ""))]
7740 "TARGET_POWERPC64 && reload_completed"
7742 (zero_extend:DI (subreg:SI
7743 (rotate:DI (match_dup 1)
7746 (compare:CC (match_dup 3)
7750 (define_insn "*rotldi3_internal15"
7751 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7752 (compare:CC (zero_extend:DI
7754 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7755 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7757 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7758 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7762 rldicl. %0,%1,%H2,32
7765 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7766 (set_attr "length" "4,4,8,8")])
7769 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7770 (compare:CC (zero_extend:DI
7772 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7773 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7775 (set (match_operand:DI 0 "gpc_reg_operand" "")
7776 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7777 "TARGET_POWERPC64 && reload_completed"
7779 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
7781 (compare:CC (match_dup 0)
7785 (define_expand "ashldi3"
7786 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7787 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7788 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7789 "TARGET_POWERPC64 || TARGET_POWER"
7792 if (TARGET_POWERPC64)
7794 else if (TARGET_POWER)
7796 emit_insn (gen_ashldi3_power (operands[0], operands[1], operands[2]));
7803 (define_insn "*ashldi3_internal1"
7804 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7805 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7806 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
7811 [(set_attr "type" "var_shift_rotate,shift")])
7813 (define_insn "*ashldi3_internal2"
7814 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7815 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7816 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7818 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7825 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7826 (set_attr "length" "4,4,8,8")])
7829 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7830 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7831 (match_operand:SI 2 "reg_or_cint_operand" ""))
7833 (clobber (match_scratch:DI 3 ""))]
7834 "TARGET_POWERPC64 && reload_completed"
7836 (ashift:DI (match_dup 1) (match_dup 2)))
7838 (compare:CC (match_dup 3)
7842 (define_insn "*ashldi3_internal3"
7843 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7844 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7845 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7847 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7848 (ashift:DI (match_dup 1) (match_dup 2)))]
7855 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7856 (set_attr "length" "4,4,8,8")])
7859 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7860 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7861 (match_operand:SI 2 "reg_or_cint_operand" ""))
7863 (set (match_operand:DI 0 "gpc_reg_operand" "")
7864 (ashift:DI (match_dup 1) (match_dup 2)))]
7865 "TARGET_POWERPC64 && reload_completed"
7867 (ashift:DI (match_dup 1) (match_dup 2)))
7869 (compare:CC (match_dup 0)
7873 (define_insn "*ashldi3_internal4"
7874 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7875 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7876 (match_operand:SI 2 "const_int_operand" "i"))
7877 (match_operand:DI 3 "const_int_operand" "n")))]
7878 "TARGET_POWERPC64 && includes_rldic_lshift_p (operands[2], operands[3])"
7879 "rldic %0,%1,%H2,%W3")
7881 (define_insn "ashldi3_internal5"
7882 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7884 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7885 (match_operand:SI 2 "const_int_operand" "i,i"))
7886 (match_operand:DI 3 "const_int_operand" "n,n"))
7888 (clobber (match_scratch:DI 4 "=r,r"))]
7889 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
7891 rldic. %4,%1,%H2,%W3
7893 [(set_attr "type" "compare")
7894 (set_attr "length" "4,8")])
7897 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7899 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7900 (match_operand:SI 2 "const_int_operand" ""))
7901 (match_operand:DI 3 "const_int_operand" ""))
7903 (clobber (match_scratch:DI 4 ""))]
7904 "TARGET_POWERPC64 && reload_completed
7905 && includes_rldic_lshift_p (operands[2], operands[3])"
7907 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7910 (compare:CC (match_dup 4)
7914 (define_insn "*ashldi3_internal6"
7915 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
7917 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7918 (match_operand:SI 2 "const_int_operand" "i,i"))
7919 (match_operand:DI 3 "const_int_operand" "n,n"))
7921 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7922 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7923 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
7925 rldic. %0,%1,%H2,%W3
7927 [(set_attr "type" "compare")
7928 (set_attr "length" "4,8")])
7931 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
7933 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7934 (match_operand:SI 2 "const_int_operand" ""))
7935 (match_operand:DI 3 "const_int_operand" ""))
7937 (set (match_operand:DI 0 "gpc_reg_operand" "")
7938 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7939 "TARGET_POWERPC64 && reload_completed
7940 && includes_rldic_lshift_p (operands[2], operands[3])"
7942 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7945 (compare:CC (match_dup 0)
7949 (define_insn "*ashldi3_internal7"
7950 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7951 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7952 (match_operand:SI 2 "const_int_operand" "i"))
7953 (match_operand:DI 3 "mask64_operand" "n")))]
7954 "TARGET_POWERPC64 && includes_rldicr_lshift_p (operands[2], operands[3])"
7955 "rldicr %0,%1,%H2,%S3")
7957 (define_insn "ashldi3_internal8"
7958 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7960 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7961 (match_operand:SI 2 "const_int_operand" "i,i"))
7962 (match_operand:DI 3 "mask64_operand" "n,n"))
7964 (clobber (match_scratch:DI 4 "=r,r"))]
7965 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
7967 rldicr. %4,%1,%H2,%S3
7969 [(set_attr "type" "compare")
7970 (set_attr "length" "4,8")])
7973 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7975 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7976 (match_operand:SI 2 "const_int_operand" ""))
7977 (match_operand:DI 3 "mask64_operand" ""))
7979 (clobber (match_scratch:DI 4 ""))]
7980 "TARGET_POWERPC64 && reload_completed
7981 && includes_rldicr_lshift_p (operands[2], operands[3])"
7983 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7986 (compare:CC (match_dup 4)
7990 (define_insn "*ashldi3_internal9"
7991 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
7993 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7994 (match_operand:SI 2 "const_int_operand" "i,i"))
7995 (match_operand:DI 3 "mask64_operand" "n,n"))
7997 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7998 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7999 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
8001 rldicr. %0,%1,%H2,%S3
8003 [(set_attr "type" "compare")
8004 (set_attr "length" "4,8")])
8007 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
8009 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
8010 (match_operand:SI 2 "const_int_operand" ""))
8011 (match_operand:DI 3 "mask64_operand" ""))
8013 (set (match_operand:DI 0 "gpc_reg_operand" "")
8014 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
8015 "TARGET_POWERPC64 && reload_completed
8016 && includes_rldicr_lshift_p (operands[2], operands[3])"
8018 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
8021 (compare:CC (match_dup 0)
8025 (define_expand "lshrdi3"
8026 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8027 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
8028 (match_operand:SI 2 "reg_or_cint_operand" "")))]
8029 "TARGET_POWERPC64 || TARGET_POWER"
8032 if (TARGET_POWERPC64)
8034 else if (TARGET_POWER)
8036 emit_insn (gen_lshrdi3_power (operands[0], operands[1], operands[2]));
8043 (define_insn "*lshrdi3_internal1"
8044 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8045 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
8046 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
8051 [(set_attr "type" "var_shift_rotate,shift")])
8053 (define_insn "*lshrdi3_internal2"
8054 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
8055 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8056 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
8058 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
8065 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8066 (set_attr "length" "4,4,8,8")])
8069 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8070 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
8071 (match_operand:SI 2 "reg_or_cint_operand" ""))
8073 (clobber (match_scratch:DI 3 ""))]
8074 "TARGET_POWERPC64 && reload_completed"
8076 (lshiftrt:DI (match_dup 1) (match_dup 2)))
8078 (compare:CC (match_dup 3)
8082 (define_insn "*lshrdi3_internal3"
8083 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
8084 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8085 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
8087 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
8088 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
8095 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8096 (set_attr "length" "4,4,8,8")])
8099 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8100 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
8101 (match_operand:SI 2 "reg_or_cint_operand" ""))
8103 (set (match_operand:DI 0 "gpc_reg_operand" "")
8104 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
8105 "TARGET_POWERPC64 && reload_completed"
8107 (lshiftrt:DI (match_dup 1) (match_dup 2)))
8109 (compare:CC (match_dup 0)
8113 (define_expand "ashrdi3"
8114 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8115 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
8116 (match_operand:SI 2 "reg_or_cint_operand" "")))]
8120 if (TARGET_POWERPC64)
8122 else if (TARGET_POWER && GET_CODE (operands[2]) == CONST_INT)
8124 emit_insn (gen_ashrdi3_power (operands[0], operands[1], operands[2]));
8127 else if (TARGET_32BIT && GET_CODE (operands[2]) == CONST_INT
8128 && WORDS_BIG_ENDIAN)
8130 emit_insn (gen_ashrdi3_no_power (operands[0], operands[1], operands[2]));
8137 (define_insn "*ashrdi3_internal1"
8138 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8139 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
8140 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
8145 [(set_attr "type" "var_shift_rotate,shift")])
8147 (define_insn "*ashrdi3_internal2"
8148 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
8149 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8150 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
8152 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
8159 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8160 (set_attr "length" "4,4,8,8")])
8163 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
8164 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
8165 (match_operand:SI 2 "reg_or_cint_operand" ""))
8167 (clobber (match_scratch:DI 3 ""))]
8168 "TARGET_POWERPC64 && reload_completed"
8170 (ashiftrt:DI (match_dup 1) (match_dup 2)))
8172 (compare:CC (match_dup 3)
8176 (define_insn "*ashrdi3_internal3"
8177 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
8178 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8179 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
8181 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
8182 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
8189 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8190 (set_attr "length" "4,4,8,8")])
8193 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
8194 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
8195 (match_operand:SI 2 "reg_or_cint_operand" ""))
8197 (set (match_operand:DI 0 "gpc_reg_operand" "")
8198 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
8199 "TARGET_POWERPC64 && reload_completed"
8201 (ashiftrt:DI (match_dup 1) (match_dup 2)))
8203 (compare:CC (match_dup 0)
8207 (define_expand "anddi3"
8209 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8210 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8211 (match_operand:DI 2 "and64_2_operand" "")))
8212 (clobber (match_scratch:CC 3 ""))])]
8216 (define_insn "anddi3_mc"
8217 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
8218 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r")
8219 (match_operand:DI 2 "and64_2_operand" "?r,S,T,K,J,t")))
8220 (clobber (match_scratch:CC 3 "=X,X,X,x,x,X"))]
8221 "TARGET_POWERPC64 && rs6000_gen_cell_microcode"
8224 rldic%B2 %0,%1,0,%S2
8225 rlwinm %0,%1,0,%m2,%M2
8229 [(set_attr "type" "*,*,*,fast_compare,fast_compare,*")
8230 (set_attr "length" "4,4,4,4,4,8")])
8232 (define_insn "anddi3_nomc"
8233 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
8234 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r")
8235 (match_operand:DI 2 "and64_2_operand" "?r,S,T,t")))
8236 (clobber (match_scratch:CC 3 "=X,X,X,X"))]
8237 "TARGET_POWERPC64 && !rs6000_gen_cell_microcode"
8240 rldic%B2 %0,%1,0,%S2
8241 rlwinm %0,%1,0,%m2,%M2
8243 [(set_attr "length" "4,4,4,8")])
8246 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8247 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8248 (match_operand:DI 2 "mask64_2_operand" "")))
8249 (clobber (match_scratch:CC 3 ""))]
8251 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
8252 && !mask_operand (operands[2], DImode)
8253 && !mask64_operand (operands[2], DImode)"
8255 (and:DI (rotate:DI (match_dup 1)
8259 (and:DI (rotate:DI (match_dup 0)
8263 build_mask64_2_operands (operands[2], &operands[4]);
8266 (define_insn "*anddi3_internal2_mc"
8267 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,x,?y,?y,?y,??y,??y,?y")
8268 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r,r,r")
8269 (match_operand:DI 2 "and64_2_operand" "r,S,T,K,J,t,r,S,T,K,J,t"))
8271 (clobber (match_scratch:DI 3 "=r,r,r,r,r,r,r,r,r,r,r,r"))
8272 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,X,X,x,x,X"))]
8273 "TARGET_64BIT && rs6000_gen_cell_microcode"
8276 rldic%B2. %3,%1,0,%S2
8277 rlwinm. %3,%1,0,%m2,%M2
8287 [(set_attr "type" "fast_compare,compare,delayed_compare,fast_compare,\
8288 fast_compare,compare,compare,compare,compare,compare,\
8290 (set_attr "length" "4,4,4,4,4,8,8,8,8,8,8,12")])
8293 [(set (match_operand:CC 0 "cc_reg_operand" "")
8294 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8295 (match_operand:DI 2 "mask64_2_operand" ""))
8297 (clobber (match_scratch:DI 3 ""))
8298 (clobber (match_scratch:CC 4 ""))]
8299 "TARGET_64BIT && reload_completed
8300 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
8301 && !mask_operand (operands[2], DImode)
8302 && !mask64_operand (operands[2], DImode)"
8304 (and:DI (rotate:DI (match_dup 1)
8307 (parallel [(set (match_dup 0)
8308 (compare:CC (and:DI (rotate:DI (match_dup 3)
8312 (clobber (match_dup 3))])]
8315 build_mask64_2_operands (operands[2], &operands[5]);
8318 (define_insn "*anddi3_internal3_mc"
8319 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,x,x,?y,?y,?y,??y,??y,?y")
8320 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r,r,r")
8321 (match_operand:DI 2 "and64_2_operand" "r,S,T,K,J,t,r,S,T,K,J,t"))
8323 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r,r,r")
8324 (and:DI (match_dup 1) (match_dup 2)))
8325 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,X,X,x,x,X"))]
8326 "TARGET_64BIT && rs6000_gen_cell_microcode"
8329 rldic%B2. %0,%1,0,%S2
8330 rlwinm. %0,%1,0,%m2,%M2
8340 [(set_attr "type" "fast_compare,compare,delayed_compare,fast_compare,\
8341 fast_compare,compare,compare,compare,compare,compare,\
8343 (set_attr "length" "4,4,4,4,4,8,8,8,8,8,8,12")])
8346 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8347 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8348 (match_operand:DI 2 "and64_2_operand" ""))
8350 (set (match_operand:DI 0 "gpc_reg_operand" "")
8351 (and:DI (match_dup 1) (match_dup 2)))
8352 (clobber (match_scratch:CC 4 ""))]
8353 "TARGET_64BIT && reload_completed"
8354 [(parallel [(set (match_dup 0)
8355 (and:DI (match_dup 1) (match_dup 2)))
8356 (clobber (match_dup 4))])
8358 (compare:CC (match_dup 0)
8363 [(set (match_operand:CC 3 "cc_reg_operand" "")
8364 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8365 (match_operand:DI 2 "mask64_2_operand" ""))
8367 (set (match_operand:DI 0 "gpc_reg_operand" "")
8368 (and:DI (match_dup 1) (match_dup 2)))
8369 (clobber (match_scratch:CC 4 ""))]
8370 "TARGET_64BIT && reload_completed
8371 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
8372 && !mask_operand (operands[2], DImode)
8373 && !mask64_operand (operands[2], DImode)"
8375 (and:DI (rotate:DI (match_dup 1)
8378 (parallel [(set (match_dup 3)
8379 (compare:CC (and:DI (rotate:DI (match_dup 0)
8384 (and:DI (rotate:DI (match_dup 0)
8389 build_mask64_2_operands (operands[2], &operands[5]);
8392 (define_expand "iordi3"
8393 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8394 (ior:DI (match_operand:DI 1 "gpc_reg_operand" "")
8395 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
8399 if (non_logical_cint_operand (operands[2], DImode))
8401 HOST_WIDE_INT value;
8402 rtx tmp = ((!can_create_pseudo_p ()
8403 || rtx_equal_p (operands[0], operands[1]))
8404 ? operands[0] : gen_reg_rtx (DImode));
8406 if (GET_CODE (operands[2]) == CONST_INT)
8408 value = INTVAL (operands[2]);
8409 emit_insn (gen_iordi3 (tmp, operands[1],
8410 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
8414 value = CONST_DOUBLE_LOW (operands[2]);
8415 emit_insn (gen_iordi3 (tmp, operands[1],
8416 immed_double_const (value
8417 & (~ (HOST_WIDE_INT) 0xffff),
8421 emit_insn (gen_iordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
8426 (define_expand "xordi3"
8427 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8428 (xor:DI (match_operand:DI 1 "gpc_reg_operand" "")
8429 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
8433 if (non_logical_cint_operand (operands[2], DImode))
8435 HOST_WIDE_INT value;
8436 rtx tmp = ((!can_create_pseudo_p ()
8437 || rtx_equal_p (operands[0], operands[1]))
8438 ? operands[0] : gen_reg_rtx (DImode));
8440 if (GET_CODE (operands[2]) == CONST_INT)
8442 value = INTVAL (operands[2]);
8443 emit_insn (gen_xordi3 (tmp, operands[1],
8444 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
8448 value = CONST_DOUBLE_LOW (operands[2]);
8449 emit_insn (gen_xordi3 (tmp, operands[1],
8450 immed_double_const (value
8451 & (~ (HOST_WIDE_INT) 0xffff),
8455 emit_insn (gen_xordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
8460 (define_insn "*booldi3_internal1"
8461 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
8462 (match_operator:DI 3 "boolean_or_operator"
8463 [(match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
8464 (match_operand:DI 2 "logical_operand" "r,K,JF")]))]
8471 (define_insn "*booldi3_internal2"
8472 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
8473 (compare:CC (match_operator:DI 4 "boolean_or_operator"
8474 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
8475 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
8477 (clobber (match_scratch:DI 3 "=r,r"))]
8482 [(set_attr "type" "fast_compare,compare")
8483 (set_attr "length" "4,8")])
8486 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8487 (compare:CC (match_operator:DI 4 "boolean_operator"
8488 [(match_operand:DI 1 "gpc_reg_operand" "")
8489 (match_operand:DI 2 "gpc_reg_operand" "")])
8491 (clobber (match_scratch:DI 3 ""))]
8492 "TARGET_POWERPC64 && reload_completed"
8493 [(set (match_dup 3) (match_dup 4))
8495 (compare:CC (match_dup 3)
8499 (define_insn "*booldi3_internal3"
8500 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
8501 (compare:CC (match_operator:DI 4 "boolean_or_operator"
8502 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
8503 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
8505 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8511 [(set_attr "type" "fast_compare,compare")
8512 (set_attr "length" "4,8")])
8515 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8516 (compare:CC (match_operator:DI 4 "boolean_operator"
8517 [(match_operand:DI 1 "gpc_reg_operand" "")
8518 (match_operand:DI 2 "gpc_reg_operand" "")])
8520 (set (match_operand:DI 0 "gpc_reg_operand" "")
8522 "TARGET_POWERPC64 && reload_completed"
8523 [(set (match_dup 0) (match_dup 4))
8525 (compare:CC (match_dup 0)
8529 ;; Split a logical operation that we can't do in one insn into two insns,
8530 ;; each of which does one 16-bit part. This is used by combine.
8533 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8534 (match_operator:DI 3 "boolean_or_operator"
8535 [(match_operand:DI 1 "gpc_reg_operand" "")
8536 (match_operand:DI 2 "non_logical_cint_operand" "")]))]
8538 [(set (match_dup 0) (match_dup 4))
8539 (set (match_dup 0) (match_dup 5))]
8544 if (GET_CODE (operands[2]) == CONST_DOUBLE)
8546 HOST_WIDE_INT value = CONST_DOUBLE_LOW (operands[2]);
8547 i3 = immed_double_const (value & (~ (HOST_WIDE_INT) 0xffff),
8549 i4 = GEN_INT (value & 0xffff);
8553 i3 = GEN_INT (INTVAL (operands[2])
8554 & (~ (HOST_WIDE_INT) 0xffff));
8555 i4 = GEN_INT (INTVAL (operands[2]) & 0xffff);
8557 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
8559 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
8563 (define_insn "*boolcdi3_internal1"
8564 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
8565 (match_operator:DI 3 "boolean_operator"
8566 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
8567 (match_operand:DI 2 "gpc_reg_operand" "r")]))]
8571 (define_insn "*boolcdi3_internal2"
8572 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
8573 (compare:CC (match_operator:DI 4 "boolean_operator"
8574 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
8575 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
8577 (clobber (match_scratch:DI 3 "=r,r"))]
8582 [(set_attr "type" "fast_compare,compare")
8583 (set_attr "length" "4,8")])
8586 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8587 (compare:CC (match_operator:DI 4 "boolean_operator"
8588 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
8589 (match_operand:DI 2 "gpc_reg_operand" "")])
8591 (clobber (match_scratch:DI 3 ""))]
8592 "TARGET_POWERPC64 && reload_completed"
8593 [(set (match_dup 3) (match_dup 4))
8595 (compare:CC (match_dup 3)
8599 (define_insn "*boolcdi3_internal3"
8600 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
8601 (compare:CC (match_operator:DI 4 "boolean_operator"
8602 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
8603 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
8605 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8611 [(set_attr "type" "fast_compare,compare")
8612 (set_attr "length" "4,8")])
8615 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8616 (compare:CC (match_operator:DI 4 "boolean_operator"
8617 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
8618 (match_operand:DI 2 "gpc_reg_operand" "")])
8620 (set (match_operand:DI 0 "gpc_reg_operand" "")
8622 "TARGET_POWERPC64 && reload_completed"
8623 [(set (match_dup 0) (match_dup 4))
8625 (compare:CC (match_dup 0)
8629 (define_insn "*boolccdi3_internal1"
8630 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
8631 (match_operator:DI 3 "boolean_operator"
8632 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
8633 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r"))]))]
8637 (define_insn "*boolccdi3_internal2"
8638 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
8639 (compare:CC (match_operator:DI 4 "boolean_operator"
8640 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
8641 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
8643 (clobber (match_scratch:DI 3 "=r,r"))]
8648 [(set_attr "type" "fast_compare,compare")
8649 (set_attr "length" "4,8")])
8652 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8653 (compare:CC (match_operator:DI 4 "boolean_operator"
8654 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
8655 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
8657 (clobber (match_scratch:DI 3 ""))]
8658 "TARGET_POWERPC64 && reload_completed"
8659 [(set (match_dup 3) (match_dup 4))
8661 (compare:CC (match_dup 3)
8665 (define_insn "*boolccdi3_internal3"
8666 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
8667 (compare:CC (match_operator:DI 4 "boolean_operator"
8668 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
8669 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
8671 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8677 [(set_attr "type" "fast_compare,compare")
8678 (set_attr "length" "4,8")])
8681 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8682 (compare:CC (match_operator:DI 4 "boolean_operator"
8683 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
8684 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
8686 (set (match_operand:DI 0 "gpc_reg_operand" "")
8688 "TARGET_POWERPC64 && reload_completed"
8689 [(set (match_dup 0) (match_dup 4))
8691 (compare:CC (match_dup 0)
8695 (define_expand "smindi3"
8696 [(match_operand:DI 0 "gpc_reg_operand" "")
8697 (match_operand:DI 1 "gpc_reg_operand" "")
8698 (match_operand:DI 2 "gpc_reg_operand" "")]
8702 rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]);
8706 (define_expand "smaxdi3"
8707 [(match_operand:DI 0 "gpc_reg_operand" "")
8708 (match_operand:DI 1 "gpc_reg_operand" "")
8709 (match_operand:DI 2 "gpc_reg_operand" "")]
8713 rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]);
8717 (define_expand "umindi3"
8718 [(match_operand:DI 0 "gpc_reg_operand" "")
8719 (match_operand:DI 1 "gpc_reg_operand" "")
8720 (match_operand:DI 2 "gpc_reg_operand" "")]
8724 rs6000_emit_minmax (operands[0], UMIN, operands[1], operands[2]);
8728 (define_expand "umaxdi3"
8729 [(match_operand:DI 0 "gpc_reg_operand" "")
8730 (match_operand:DI 1 "gpc_reg_operand" "")
8731 (match_operand:DI 2 "gpc_reg_operand" "")]
8735 rs6000_emit_minmax (operands[0], UMAX, operands[1], operands[2]);
8740 ;; Now define ways of moving data around.
8742 ;; Set up a register with a value from the GOT table
8744 (define_expand "movsi_got"
8745 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8746 (unspec:SI [(match_operand:SI 1 "got_operand" "")
8747 (match_dup 2)] UNSPEC_MOVSI_GOT))]
8748 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
8751 if (GET_CODE (operands[1]) == CONST)
8753 rtx offset = const0_rtx;
8754 HOST_WIDE_INT value;
8756 operands[1] = eliminate_constant_term (XEXP (operands[1], 0), &offset);
8757 value = INTVAL (offset);
8760 rtx tmp = (!can_create_pseudo_p ()
8762 : gen_reg_rtx (Pmode));
8763 emit_insn (gen_movsi_got (tmp, operands[1]));
8764 emit_insn (gen_addsi3 (operands[0], tmp, offset));
8769 operands[2] = rs6000_got_register (operands[1]);
8772 (define_insn "*movsi_got_internal"
8773 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8774 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
8775 (match_operand:SI 2 "gpc_reg_operand" "b")]
8777 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
8778 "{l|lwz} %0,%a1@got(%2)"
8779 [(set_attr "type" "load")])
8781 ;; Used by sched, shorten_branches and final when the GOT pseudo reg
8782 ;; didn't get allocated to a hard register.
8784 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8785 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
8786 (match_operand:SI 2 "memory_operand" "")]
8788 "DEFAULT_ABI == ABI_V4
8790 && (reload_in_progress || reload_completed)"
8791 [(set (match_dup 0) (match_dup 2))
8792 (set (match_dup 0) (unspec:SI [(match_dup 1)(match_dup 0)]
8796 ;; For SI, we special-case integers that can't be loaded in one insn. We
8797 ;; do the load 16-bits at a time. We could do this by loading from memory,
8798 ;; and this is even supposed to be faster, but it is simpler not to get
8799 ;; integers in the TOC.
8800 (define_insn "movsi_low"
8801 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8802 (mem:SI (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
8803 (match_operand 2 "" ""))))]
8804 "TARGET_MACHO && ! TARGET_64BIT"
8805 "{l|lwz} %0,lo16(%2)(%1)"
8806 [(set_attr "type" "load")
8807 (set_attr "length" "4")])
8809 (define_insn "*movsi_internal1"
8810 [(set (match_operand:SI 0 "rs6000_nonimmediate_operand" "=r,r,r,m,r,r,r,r,r,*q,*c*l,*h,*h")
8811 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,R,*h,r,r,r,0"))]
8812 "!TARGET_SINGLE_FPU &&
8813 (gpc_reg_operand (operands[0], SImode) || gpc_reg_operand (operands[1], SImode))"
8817 {l%U1%X1|lwz%U1%X1} %0,%1
8818 {st%U0%X0|stw%U0%X0} %1,%0
8828 [(set_attr "type" "*,*,load,store,*,*,*,*,mfjmpr,*,mtjmpr,*,*")
8829 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4,4,4")])
8831 (define_insn "*movsi_internal1_single"
8832 [(set (match_operand:SI 0 "rs6000_nonimmediate_operand" "=r,r,r,m,r,r,r,r,r,*q,*c*l,*h,*h,m,*f")
8833 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,R,*h,r,r,r,0,f,m"))]
8834 "TARGET_SINGLE_FPU &&
8835 (gpc_reg_operand (operands[0], SImode) || gpc_reg_operand (operands[1], SImode))"
8839 {l%U1%X1|lwz%U1%X1} %0,%1
8840 {st%U0%X0|stw%U0%X0} %1,%0
8852 [(set_attr "type" "*,*,load,store,*,*,*,*,mfjmpr,*,mtjmpr,*,*,*,*")
8853 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4,4,4,4,4")])
8855 ;; Split a load of a large constant into the appropriate two-insn
8859 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8860 (match_operand:SI 1 "const_int_operand" ""))]
8861 "(unsigned HOST_WIDE_INT) (INTVAL (operands[1]) + 0x8000) >= 0x10000
8862 && (INTVAL (operands[1]) & 0xffff) != 0"
8866 (ior:SI (match_dup 0)
8869 { rtx tem = rs6000_emit_set_const (operands[0], SImode, operands[1], 2);
8871 if (tem == operands[0])
8877 (define_insn "*mov<mode>_internal2"
8878 [(set (match_operand:CC 2 "cc_reg_operand" "=y,x,?y")
8879 (compare:CC (match_operand:P 1 "gpc_reg_operand" "0,r,r")
8881 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r") (match_dup 1))]
8884 {cmpi|cmp<wd>i} %2,%0,0
8887 [(set_attr "type" "cmp,compare,cmp")
8888 (set_attr "length" "4,4,8")])
8891 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
8892 (compare:CC (match_operand:P 1 "gpc_reg_operand" "")
8894 (set (match_operand:P 0 "gpc_reg_operand" "") (match_dup 1))]
8896 [(set (match_dup 0) (match_dup 1))
8898 (compare:CC (match_dup 0)
8902 (define_insn "*movhi_internal"
8903 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
8904 (match_operand:HI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
8905 "gpc_reg_operand (operands[0], HImode)
8906 || gpc_reg_operand (operands[1], HImode)"
8916 [(set_attr "type" "*,load,store,*,mfjmpr,*,mtjmpr,*")])
8918 (define_expand "mov<mode>"
8919 [(set (match_operand:INT 0 "general_operand" "")
8920 (match_operand:INT 1 "any_operand" ""))]
8922 "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
8924 (define_insn "*movqi_internal"
8925 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
8926 (match_operand:QI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
8927 "gpc_reg_operand (operands[0], QImode)
8928 || gpc_reg_operand (operands[1], QImode)"
8938 [(set_attr "type" "*,load,store,*,mfjmpr,*,mtjmpr,*")])
8940 ;; Here is how to move condition codes around. When we store CC data in
8941 ;; an integer register or memory, we store just the high-order 4 bits.
8942 ;; This lets us not shift in the most common case of CR0.
8943 (define_expand "movcc"
8944 [(set (match_operand:CC 0 "nonimmediate_operand" "")
8945 (match_operand:CC 1 "nonimmediate_operand" ""))]
8949 (define_insn "*movcc_internal1"
8950 [(set (match_operand:CC 0 "nonimmediate_operand" "=y,x,?y,y,r,r,r,r,r,q,cl,r,m")
8951 (match_operand:CC 1 "general_operand" "y,r,r,O,x,y,r,I,h,r,r,m,r"))]
8952 "register_operand (operands[0], CCmode)
8953 || register_operand (operands[1], CCmode)"
8957 {rlinm|rlwinm} %1,%1,%F0,0xffffffff\;mtcrf %R0,%1\;{rlinm|rlwinm} %1,%1,%f0,0xffffffff
8960 mfcr %0%Q1\;{rlinm|rlwinm} %0,%0,%f1,0xf0000000
8966 {l%U1%X1|lwz%U1%X1} %0,%1
8967 {st%U0%U1|stw%U0%U1} %1,%0"
8969 (cond [(eq_attr "alternative" "0,3")
8970 (const_string "cr_logical")
8971 (eq_attr "alternative" "1,2")
8972 (const_string "mtcr")
8973 (eq_attr "alternative" "6,7,9")
8974 (const_string "integer")
8975 (eq_attr "alternative" "8")
8976 (const_string "mfjmpr")
8977 (eq_attr "alternative" "10")
8978 (const_string "mtjmpr")
8979 (eq_attr "alternative" "11")
8980 (const_string "load")
8981 (eq_attr "alternative" "12")
8982 (const_string "store")
8983 (ne (symbol_ref "TARGET_MFCRF") (const_int 0))
8984 (const_string "mfcrf")
8986 (const_string "mfcr")))
8987 (set_attr "length" "4,4,12,4,4,8,4,4,4,4,4,4,4")])
8989 ;; For floating-point, we normally deal with the floating-point registers
8990 ;; unless -msoft-float is used. The sole exception is that parameter passing
8991 ;; can produce floating-point values in fixed-point registers. Unless the
8992 ;; value is a simple constant or already in memory, we deal with this by
8993 ;; allocating memory and copying the value explicitly via that memory location.
8994 (define_expand "movsf"
8995 [(set (match_operand:SF 0 "nonimmediate_operand" "")
8996 (match_operand:SF 1 "any_operand" ""))]
8998 "{ rs6000_emit_move (operands[0], operands[1], SFmode); DONE; }")
9001 [(set (match_operand:SF 0 "gpc_reg_operand" "")
9002 (match_operand:SF 1 "const_double_operand" ""))]
9004 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
9005 || (GET_CODE (operands[0]) == SUBREG
9006 && GET_CODE (SUBREG_REG (operands[0])) == REG
9007 && REGNO (SUBREG_REG (operands[0])) <= 31))"
9008 [(set (match_dup 2) (match_dup 3))]
9014 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
9015 REAL_VALUE_TO_TARGET_SINGLE (rv, l);
9017 if (! TARGET_POWERPC64)
9018 operands[2] = operand_subword (operands[0], 0, 0, SFmode);
9020 operands[2] = gen_lowpart (SImode, operands[0]);
9022 operands[3] = gen_int_mode (l, SImode);
9025 (define_insn "*movsf_hardfloat"
9026 [(set (match_operand:SF 0 "nonimmediate_operand" "=!r,!r,m,f,f,m,*c*l,*q,!r,*h,!r,!r")
9027 (match_operand:SF 1 "input_operand" "r,m,r,f,m,f,r,r,h,0,G,Fn"))]
9028 "(gpc_reg_operand (operands[0], SFmode)
9029 || gpc_reg_operand (operands[1], SFmode))
9030 && (TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT)"
9033 {l%U1%X1|lwz%U1%X1} %0,%1
9034 {st%U0%X0|stw%U0%X0} %1,%0
9044 [(set_attr "type" "*,load,store,fp,fpload,fpstore,mtjmpr,*,mfjmpr,*,*,*")
9045 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,8")])
9047 (define_insn "*movsf_softfloat"
9048 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,cl,q,r,r,m,r,r,r,r,r,*h")
9049 (match_operand:SF 1 "input_operand" "r,r,r,h,m,r,I,L,R,G,Fn,0"))]
9050 "(gpc_reg_operand (operands[0], SFmode)
9051 || gpc_reg_operand (operands[1], SFmode))
9052 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)"
9058 {l%U1%X1|lwz%U1%X1} %0,%1
9059 {st%U0%X0|stw%U0%X0} %1,%0
9066 [(set_attr "type" "*,mtjmpr,*,mfjmpr,load,store,*,*,*,*,*,*")
9067 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,8,4")])
9070 (define_expand "movdf"
9071 [(set (match_operand:DF 0 "nonimmediate_operand" "")
9072 (match_operand:DF 1 "any_operand" ""))]
9074 "{ rs6000_emit_move (operands[0], operands[1], DFmode); DONE; }")
9077 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9078 (match_operand:DF 1 "const_int_operand" ""))]
9079 "! TARGET_POWERPC64 && reload_completed
9080 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
9081 || (GET_CODE (operands[0]) == SUBREG
9082 && GET_CODE (SUBREG_REG (operands[0])) == REG
9083 && REGNO (SUBREG_REG (operands[0])) <= 31))"
9084 [(set (match_dup 2) (match_dup 4))
9085 (set (match_dup 3) (match_dup 1))]
9088 int endian = (WORDS_BIG_ENDIAN == 0);
9089 HOST_WIDE_INT value = INTVAL (operands[1]);
9091 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
9092 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
9093 #if HOST_BITS_PER_WIDE_INT == 32
9094 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
9096 operands[4] = GEN_INT (value >> 32);
9097 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
9102 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9103 (match_operand:DF 1 "const_double_operand" ""))]
9104 "! TARGET_POWERPC64 && reload_completed
9105 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
9106 || (GET_CODE (operands[0]) == SUBREG
9107 && GET_CODE (SUBREG_REG (operands[0])) == REG
9108 && REGNO (SUBREG_REG (operands[0])) <= 31))"
9109 [(set (match_dup 2) (match_dup 4))
9110 (set (match_dup 3) (match_dup 5))]
9113 int endian = (WORDS_BIG_ENDIAN == 0);
9117 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
9118 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
9120 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
9121 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
9122 operands[4] = gen_int_mode (l[endian], SImode);
9123 operands[5] = gen_int_mode (l[1 - endian], SImode);
9127 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9128 (match_operand:DF 1 "const_double_operand" ""))]
9129 "TARGET_POWERPC64 && reload_completed
9130 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
9131 || (GET_CODE (operands[0]) == SUBREG
9132 && GET_CODE (SUBREG_REG (operands[0])) == REG
9133 && REGNO (SUBREG_REG (operands[0])) <= 31))"
9134 [(set (match_dup 2) (match_dup 3))]
9137 int endian = (WORDS_BIG_ENDIAN == 0);
9140 #if HOST_BITS_PER_WIDE_INT >= 64
9144 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
9145 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
9147 operands[2] = gen_lowpart (DImode, operands[0]);
9148 /* HIGHPART is lower memory address when WORDS_BIG_ENDIAN. */
9149 #if HOST_BITS_PER_WIDE_INT >= 64
9150 val = ((HOST_WIDE_INT)(unsigned long)l[endian] << 32
9151 | ((HOST_WIDE_INT)(unsigned long)l[1 - endian]));
9153 operands[3] = gen_int_mode (val, DImode);
9155 operands[3] = immed_double_const (l[1 - endian], l[endian], DImode);
9159 ;; Don't have reload use general registers to load a constant. First,
9160 ;; it might not work if the output operand is the equivalent of
9161 ;; a non-offsettable memref, but also it is less efficient than loading
9162 ;; the constant into an FP register, since it will probably be used there.
9163 ;; The "??" is a kludge until we can figure out a more reasonable way
9164 ;; of handling these non-offsettable values.
9165 (define_insn "*movdf_hardfloat32"
9166 [(set (match_operand:DF 0 "nonimmediate_operand" "=!r,??r,m,ws,?wa,ws,?wa,Z,?Z,d,d,m,wa,!r,!r,!r")
9167 (match_operand:DF 1 "input_operand" "r,m,r,ws,wa,Z,Z,ws,wa,d,m,d,j,G,H,F"))]
9168 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9169 && (gpc_reg_operand (operands[0], DFmode)
9170 || gpc_reg_operand (operands[1], DFmode))"
9173 switch (which_alternative)
9183 return \"xxlor %x0,%x1,%x1\";
9186 return \"lxsd%U1x %x0,%y1\";
9189 return \"stxsd%U0x %x1,%y0\";
9191 return \"fmr %0,%1\";
9193 return \"lfd%U1%X1 %0,%1\";
9195 return \"stfd%U0%X0 %1,%0\";
9197 return \"xxlxor %x0,%x0,%x0\";
9204 [(set_attr "type" "two,load,store,fp,fp,fpload,fpload,fpstore,fpstore,fp,fpload,fpstore,vecsimple,*,*,*")
9205 (set_attr "length" "8,16,16,4,4,4,4,4,4,4,4,4,4,8,12,16")])
9207 (define_insn "*movdf_softfloat32"
9208 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,m,r,r,r")
9209 (match_operand:DF 1 "input_operand" "r,m,r,G,H,F"))]
9211 && ((TARGET_FPRS && TARGET_SINGLE_FLOAT)
9212 || TARGET_SOFT_FLOAT || TARGET_E500_SINGLE)
9213 && (gpc_reg_operand (operands[0], DFmode)
9214 || gpc_reg_operand (operands[1], DFmode))"
9216 [(set_attr "type" "two,load,store,*,*,*")
9217 (set_attr "length" "8,8,8,8,12,16")])
9219 ; ld/std require word-aligned displacements -> 'Y' constraint.
9220 ; List Y->r and r->Y before r->r for reload.
9221 (define_insn "*movdf_hardfloat64_mfpgpr"
9222 [(set (match_operand:DF 0 "nonimmediate_operand" "=Y,r,!r,ws,?wa,ws,?wa,Z,?Z,d,d,m,wa,*c*l,!r,*h,!r,!r,!r,r,d")
9223 (match_operand:DF 1 "input_operand" "r,Y,r,ws,?wa,Z,Z,ws,wa,d,m,d,j,r,h,0,G,H,F,d,r"))]
9224 "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
9225 && TARGET_DOUBLE_FLOAT
9226 && (gpc_reg_operand (operands[0], DFmode)
9227 || gpc_reg_operand (operands[1], DFmode))"
9250 [(set_attr "type" "store,load,*,fp,fp,fpload,fpload,fpstore,fpstore,fp,fpload,fpstore,vecsimple,mtjmpr,mfjmpr,*,*,*,*,mftgpr,mffgpr")
9251 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,8,12,16,4,4")])
9253 ; ld/std require word-aligned displacements -> 'Y' constraint.
9254 ; List Y->r and r->Y before r->r for reload.
9255 (define_insn "*movdf_hardfloat64"
9256 [(set (match_operand:DF 0 "nonimmediate_operand" "=Y,r,!r,ws,?wa,ws,?wa,Z,?Z,d,d,m,wa,*c*l,!r,*h,!r,!r,!r")
9257 (match_operand:DF 1 "input_operand" "r,Y,r,ws,wa,Z,Z,ws,wa,d,m,d,j,r,h,0,G,H,F"))]
9258 "TARGET_POWERPC64 && !TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
9259 && TARGET_DOUBLE_FLOAT
9260 && (gpc_reg_operand (operands[0], DFmode)
9261 || gpc_reg_operand (operands[1], DFmode))"
9282 [(set_attr "type" "store,load,*,fp,fp,fpload,fpload,fpstore,fpstore,fp,fpload,fpstore,vecsimple,mtjmpr,mfjmpr,*,*,*,*")
9283 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,8,12,16")])
9285 (define_insn "*movdf_softfloat64"
9286 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,Y,r,cl,r,r,r,r,*h")
9287 (match_operand:DF 1 "input_operand" "Y,r,r,r,h,G,H,F,0"))]
9288 "TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)
9289 && (gpc_reg_operand (operands[0], DFmode)
9290 || gpc_reg_operand (operands[1], DFmode))"
9301 [(set_attr "type" "load,store,*,mtjmpr,mfjmpr,*,*,*,*")
9302 (set_attr "length" "4,4,4,4,4,8,12,16,4")])
9304 (define_expand "movtf"
9305 [(set (match_operand:TF 0 "general_operand" "")
9306 (match_operand:TF 1 "any_operand" ""))]
9307 "!TARGET_IEEEQUAD && TARGET_LONG_DOUBLE_128"
9308 "{ rs6000_emit_move (operands[0], operands[1], TFmode); DONE; }")
9310 ; It's important to list the o->f and f->o moves before f->f because
9311 ; otherwise reload, given m->f, will try to pick f->f and reload it,
9312 ; which doesn't make progress. Likewise r->Y must be before r->r.
9313 (define_insn_and_split "*movtf_internal"
9314 [(set (match_operand:TF 0 "nonimmediate_operand" "=o,d,d,r,Y,r")
9315 (match_operand:TF 1 "input_operand" "d,o,d,YGHF,r,r"))]
9317 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128
9318 && (gpc_reg_operand (operands[0], TFmode)
9319 || gpc_reg_operand (operands[1], TFmode))"
9321 "&& reload_completed"
9323 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
9324 [(set_attr "length" "8,8,8,20,20,16")])
9326 (define_insn_and_split "*movtf_softfloat"
9327 [(set (match_operand:TF 0 "rs6000_nonimmediate_operand" "=r,Y,r")
9328 (match_operand:TF 1 "input_operand" "YGHF,r,r"))]
9330 && (TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_LONG_DOUBLE_128
9331 && (gpc_reg_operand (operands[0], TFmode)
9332 || gpc_reg_operand (operands[1], TFmode))"
9334 "&& reload_completed"
9336 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
9337 [(set_attr "length" "20,20,16")])
9339 (define_expand "extenddftf2"
9340 [(set (match_operand:TF 0 "nonimmediate_operand" "")
9341 (float_extend:TF (match_operand:DF 1 "input_operand" "")))]
9343 && TARGET_HARD_FLOAT
9344 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9345 && TARGET_LONG_DOUBLE_128"
9347 if (TARGET_E500_DOUBLE)
9348 emit_insn (gen_spe_extenddftf2 (operands[0], operands[1]));
9350 emit_insn (gen_extenddftf2_fprs (operands[0], operands[1]));
9354 (define_expand "extenddftf2_fprs"
9355 [(parallel [(set (match_operand:TF 0 "nonimmediate_operand" "")
9356 (float_extend:TF (match_operand:DF 1 "input_operand" "")))
9357 (use (match_dup 2))])]
9359 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9360 && TARGET_LONG_DOUBLE_128"
9362 operands[2] = CONST0_RTX (DFmode);
9363 /* Generate GOT reference early for SVR4 PIC. */
9364 if (DEFAULT_ABI == ABI_V4 && flag_pic)
9365 operands[2] = validize_mem (force_const_mem (DFmode, operands[2]));
9368 (define_insn_and_split "*extenddftf2_internal"
9369 [(set (match_operand:TF 0 "nonimmediate_operand" "=o,d,&d,r")
9370 (float_extend:TF (match_operand:DF 1 "input_operand" "dr,md,md,rmGHF")))
9371 (use (match_operand:DF 2 "zero_reg_mem_operand" "rd,m,d,n"))]
9373 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9374 && TARGET_LONG_DOUBLE_128"
9376 "&& reload_completed"
9379 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
9380 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
9381 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word),
9383 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word),
9388 (define_expand "extendsftf2"
9389 [(set (match_operand:TF 0 "nonimmediate_operand" "")
9390 (float_extend:TF (match_operand:SF 1 "gpc_reg_operand" "")))]
9392 && TARGET_HARD_FLOAT
9393 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9394 && TARGET_LONG_DOUBLE_128"
9396 rtx tmp = gen_reg_rtx (DFmode);
9397 emit_insn (gen_extendsfdf2 (tmp, operands[1]));
9398 emit_insn (gen_extenddftf2 (operands[0], tmp));
9402 (define_expand "trunctfdf2"
9403 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9404 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "")))]
9406 && TARGET_HARD_FLOAT
9407 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9408 && TARGET_LONG_DOUBLE_128"
9411 (define_insn_and_split "trunctfdf2_internal1"
9412 [(set (match_operand:DF 0 "gpc_reg_operand" "=d,?d")
9413 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "0,d")))]
9414 "!TARGET_IEEEQUAD && !TARGET_XL_COMPAT
9415 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9419 "&& reload_completed && REGNO (operands[0]) == REGNO (operands[1])"
9422 emit_note (NOTE_INSN_DELETED);
9425 [(set_attr "type" "fp")])
9427 (define_insn "trunctfdf2_internal2"
9428 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
9429 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "d")))]
9430 "!TARGET_IEEEQUAD && TARGET_XL_COMPAT
9431 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9432 && TARGET_LONG_DOUBLE_128"
9434 [(set_attr "type" "fp")
9435 (set_attr "fp_type" "fp_addsub_d")])
9437 (define_expand "trunctfsf2"
9438 [(set (match_operand:SF 0 "gpc_reg_operand" "")
9439 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "")))]
9441 && TARGET_HARD_FLOAT
9442 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9443 && TARGET_LONG_DOUBLE_128"
9445 if (TARGET_E500_DOUBLE)
9446 emit_insn (gen_spe_trunctfsf2 (operands[0], operands[1]));
9448 emit_insn (gen_trunctfsf2_fprs (operands[0], operands[1]));
9452 (define_insn_and_split "trunctfsf2_fprs"
9453 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
9454 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "d")))
9455 (clobber (match_scratch:DF 2 "=d"))]
9457 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
9458 && TARGET_LONG_DOUBLE_128"
9460 "&& reload_completed"
9462 (float_truncate:DF (match_dup 1)))
9464 (float_truncate:SF (match_dup 2)))]
9467 (define_expand "floatsitf2"
9468 [(set (match_operand:TF 0 "gpc_reg_operand" "")
9469 (float:TF (match_operand:SI 1 "gpc_reg_operand" "")))]
9471 && TARGET_HARD_FLOAT
9472 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9473 && TARGET_LONG_DOUBLE_128"
9475 rtx tmp = gen_reg_rtx (DFmode);
9476 expand_float (tmp, operands[1], false);
9477 emit_insn (gen_extenddftf2 (operands[0], tmp));
9481 ; fadd, but rounding towards zero.
9482 ; This is probably not the optimal code sequence.
9483 (define_insn "fix_trunc_helper"
9484 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
9485 (unspec:DF [(match_operand:TF 1 "gpc_reg_operand" "d")]
9486 UNSPEC_FIX_TRUNC_TF))
9487 (clobber (match_operand:DF 2 "gpc_reg_operand" "=&d"))]
9488 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
9489 "mffs %2\n\tmtfsb1 31\n\tmtfsb0 30\n\tfadd %0,%1,%L1\n\tmtfsf 1,%2"
9490 [(set_attr "type" "fp")
9491 (set_attr "length" "20")])
9493 (define_expand "fix_trunctfsi2"
9494 [(set (match_operand:SI 0 "gpc_reg_operand" "")
9495 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))]
9497 && (TARGET_POWER2 || TARGET_POWERPC)
9498 && TARGET_HARD_FLOAT
9499 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9500 && TARGET_LONG_DOUBLE_128"
9502 if (TARGET_E500_DOUBLE)
9503 emit_insn (gen_spe_fix_trunctfsi2 (operands[0], operands[1]));
9505 emit_insn (gen_fix_trunctfsi2_fprs (operands[0], operands[1]));
9509 (define_expand "fix_trunctfsi2_fprs"
9510 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
9511 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))
9512 (clobber (match_dup 2))
9513 (clobber (match_dup 3))
9514 (clobber (match_dup 4))
9515 (clobber (match_dup 5))])]
9517 && (TARGET_POWER2 || TARGET_POWERPC)
9518 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9520 operands[2] = gen_reg_rtx (DFmode);
9521 operands[3] = gen_reg_rtx (DFmode);
9522 operands[4] = gen_reg_rtx (DImode);
9523 operands[5] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
9526 (define_insn_and_split "*fix_trunctfsi2_internal"
9527 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9528 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "d")))
9529 (clobber (match_operand:DF 2 "gpc_reg_operand" "=d"))
9530 (clobber (match_operand:DF 3 "gpc_reg_operand" "=&d"))
9531 (clobber (match_operand:DI 4 "gpc_reg_operand" "=d"))
9532 (clobber (match_operand:DI 5 "offsettable_mem_operand" "=o"))]
9534 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9540 emit_insn (gen_fix_trunc_helper (operands[2], operands[1], operands[3]));
9542 gcc_assert (MEM_P (operands[5]));
9543 lowword = adjust_address (operands[5], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
9545 emit_insn (gen_fctiwz (operands[4], operands[2]));
9546 emit_move_insn (operands[5], operands[4]);
9547 emit_move_insn (operands[0], lowword);
9551 (define_expand "negtf2"
9552 [(set (match_operand:TF 0 "gpc_reg_operand" "")
9553 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "")))]
9555 && TARGET_HARD_FLOAT
9556 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9557 && TARGET_LONG_DOUBLE_128"
9560 (define_insn "negtf2_internal"
9561 [(set (match_operand:TF 0 "gpc_reg_operand" "=d")
9562 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "d")))]
9564 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9567 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
9568 return \"fneg %L0,%L1\;fneg %0,%1\";
9570 return \"fneg %0,%1\;fneg %L0,%L1\";
9572 [(set_attr "type" "fp")
9573 (set_attr "length" "8")])
9575 (define_expand "abstf2"
9576 [(set (match_operand:TF 0 "gpc_reg_operand" "")
9577 (abs:TF (match_operand:TF 1 "gpc_reg_operand" "")))]
9579 && TARGET_HARD_FLOAT
9580 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9581 && TARGET_LONG_DOUBLE_128"
9584 rtx label = gen_label_rtx ();
9585 if (TARGET_E500_DOUBLE)
9587 if (flag_finite_math_only && !flag_trapping_math)
9588 emit_insn (gen_spe_abstf2_tst (operands[0], operands[1], label));
9590 emit_insn (gen_spe_abstf2_cmp (operands[0], operands[1], label));
9593 emit_insn (gen_abstf2_internal (operands[0], operands[1], label));
9598 (define_expand "abstf2_internal"
9599 [(set (match_operand:TF 0 "gpc_reg_operand" "")
9600 (match_operand:TF 1 "gpc_reg_operand" ""))
9601 (set (match_dup 3) (match_dup 5))
9602 (set (match_dup 5) (abs:DF (match_dup 5)))
9603 (set (match_dup 4) (compare:CCFP (match_dup 3) (match_dup 5)))
9604 (set (pc) (if_then_else (eq (match_dup 4) (const_int 0))
9605 (label_ref (match_operand 2 "" ""))
9607 (set (match_dup 6) (neg:DF (match_dup 6)))]
9609 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9610 && TARGET_LONG_DOUBLE_128"
9613 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
9614 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
9615 operands[3] = gen_reg_rtx (DFmode);
9616 operands[4] = gen_reg_rtx (CCFPmode);
9617 operands[5] = simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word);
9618 operands[6] = simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word);
9621 ;; Next come the multi-word integer load and store and the load and store
9624 ; List r->r after r->"o<>", otherwise reload will try to reload a
9625 ; non-offsettable address by using r->r which won't make progress.
9626 (define_insn "*movdi_internal32"
9627 [(set (match_operand:DI 0 "rs6000_nonimmediate_operand" "=o<>,r,r,*d,*d,m,r")
9628 (match_operand:DI 1 "input_operand" "r,r,m,d,m,d,IJKnGHF"))]
9630 && (gpc_reg_operand (operands[0], DImode)
9631 || gpc_reg_operand (operands[1], DImode))"
9640 [(set_attr "type" "load,*,store,fp,fpload,fpstore,*")])
9643 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9644 (match_operand:DI 1 "const_int_operand" ""))]
9645 "! TARGET_POWERPC64 && reload_completed"
9646 [(set (match_dup 2) (match_dup 4))
9647 (set (match_dup 3) (match_dup 1))]
9650 HOST_WIDE_INT value = INTVAL (operands[1]);
9651 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
9653 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
9655 #if HOST_BITS_PER_WIDE_INT == 32
9656 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
9658 operands[4] = GEN_INT (value >> 32);
9659 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
9664 [(set (match_operand:DIFD 0 "rs6000_nonimmediate_operand" "")
9665 (match_operand:DIFD 1 "input_operand" ""))]
9666 "reload_completed && !TARGET_POWERPC64
9667 && gpr_or_gpr_p (operands[0], operands[1])"
9669 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
9671 (define_insn "*movdi_mfpgpr"
9672 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,*d,*d,m,r,*h,*h,r,*d")
9673 (match_operand:DI 1 "input_operand" "r,m,r,I,L,nF,R,d,m,d,*h,r,0,*d,r"))]
9674 "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
9675 && (gpc_reg_operand (operands[0], DImode)
9676 || gpc_reg_operand (operands[1], DImode))"
9693 [(set_attr "type" "*,load,store,*,*,*,*,fp,fpload,fpstore,mfjmpr,mtjmpr,*,mftgpr,mffgpr")
9694 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4,4,4")])
9696 (define_insn "*movdi_internal64"
9697 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,*d,*d,m,r,*h,*h")
9698 (match_operand:DI 1 "input_operand" "r,m,r,I,L,nF,R,d,m,d,*h,r,0"))]
9699 "TARGET_POWERPC64 && (!TARGET_MFPGPR || !TARGET_HARD_FLOAT || !TARGET_FPRS)
9700 && (gpc_reg_operand (operands[0], DImode)
9701 || gpc_reg_operand (operands[1], DImode))"
9716 [(set_attr "type" "*,load,store,*,*,*,*,fp,fpload,fpstore,mfjmpr,mtjmpr,*")
9717 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4")])
9719 ;; immediate value valid for a single instruction hiding in a const_double
9721 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9722 (match_operand:DI 1 "const_double_operand" "F"))]
9723 "HOST_BITS_PER_WIDE_INT == 32 && TARGET_POWERPC64
9724 && GET_CODE (operands[1]) == CONST_DOUBLE
9725 && num_insns_constant (operands[1], DImode) == 1"
9728 return ((unsigned HOST_WIDE_INT)
9729 (CONST_DOUBLE_LOW (operands[1]) + 0x8000) < 0x10000)
9730 ? \"li %0,%1\" : \"lis %0,%v1\";
9733 ;; Generate all one-bits and clear left or right.
9734 ;; Use (and:DI (rotate:DI ...)) to avoid anddi3 unnecessary clobber.
9736 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9737 (match_operand:DI 1 "mask64_operand" ""))]
9738 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
9739 [(set (match_dup 0) (const_int -1))
9741 (and:DI (rotate:DI (match_dup 0)
9746 ;; Split a load of a large constant into the appropriate five-instruction
9747 ;; sequence. Handle anything in a constant number of insns.
9748 ;; When non-easy constants can go in the TOC, this should use
9749 ;; easy_fp_constant predicate.
9751 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9752 (match_operand:DI 1 "const_int_operand" ""))]
9753 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
9754 [(set (match_dup 0) (match_dup 2))
9755 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
9757 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
9759 if (tem == operands[0])
9766 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9767 (match_operand:DI 1 "const_double_operand" ""))]
9768 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
9769 [(set (match_dup 0) (match_dup 2))
9770 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
9772 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
9774 if (tem == operands[0])
9780 ;; TImode is similar, except that we usually want to compute the address into
9781 ;; a register and use lsi/stsi (the exception is during reload). MQ is also
9782 ;; clobbered in stsi for POWER, so we need a SCRATCH for it.
9784 ;; We say that MQ is clobbered in the last alternative because the first
9785 ;; alternative would never get used otherwise since it would need a reload
9786 ;; while the 2nd alternative would not. We put memory cases first so they
9787 ;; are preferred. Otherwise, we'd try to reload the output instead of
9788 ;; giving the SCRATCH mq.
9790 (define_insn "*movti_power"
9791 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,m,????r,????r,????r,r")
9792 (match_operand:TI 1 "input_operand" "r,r,r,Q,m,n"))
9793 (clobber (match_scratch:SI 2 "=q,q#X,X,X,X,X"))]
9794 "TARGET_POWER && ! TARGET_POWERPC64
9795 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
9798 switch (which_alternative)
9805 return \"{stsi|stswi} %1,%P0,16\";
9810 /* If the address is not used in the output, we can use lsi. Otherwise,
9811 fall through to generating four loads. */
9813 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
9814 return \"{lsi|lswi} %0,%P1,16\";
9815 /* ... fall through ... */
9821 [(set_attr "type" "store,store,*,load,load,*")])
9823 (define_insn "*movti_string"
9824 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,o<>,????r,????r,????r,r")
9825 (match_operand:TI 1 "input_operand" "r,r,r,Q,m,n"))]
9826 "! TARGET_POWER && ! TARGET_POWERPC64
9827 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
9830 switch (which_alternative)
9836 return \"{stsi|stswi} %1,%P0,16\";
9841 /* If the address is not used in the output, we can use lsi. Otherwise,
9842 fall through to generating four loads. */
9844 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
9845 return \"{lsi|lswi} %0,%P1,16\";
9846 /* ... fall through ... */
9852 [(set_attr "type" "store_ux,store_ux,*,load_ux,load_ux,*")
9853 (set (attr "cell_micro") (if_then_else (eq (symbol_ref "TARGET_STRING") (const_int 1))
9854 (const_string "always")
9855 (const_string "conditional")))])
9857 (define_insn "*movti_ppc64"
9858 [(set (match_operand:TI 0 "nonimmediate_operand" "=r,o<>,r")
9859 (match_operand:TI 1 "input_operand" "r,r,m"))]
9860 "(TARGET_POWERPC64 && (gpc_reg_operand (operands[0], TImode)
9861 || gpc_reg_operand (operands[1], TImode)))
9862 && VECTOR_MEM_NONE_P (TImode)"
9864 [(set_attr "type" "*,store,load")])
9867 [(set (match_operand:TI 0 "gpc_reg_operand" "")
9868 (match_operand:TI 1 "const_double_operand" ""))]
9869 "TARGET_POWERPC64 && VECTOR_MEM_NONE_P (TImode)"
9870 [(set (match_dup 2) (match_dup 4))
9871 (set (match_dup 3) (match_dup 5))]
9874 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
9876 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
9878 if (GET_CODE (operands[1]) == CONST_DOUBLE)
9880 operands[4] = GEN_INT (CONST_DOUBLE_HIGH (operands[1]));
9881 operands[5] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
9883 else if (GET_CODE (operands[1]) == CONST_INT)
9885 operands[4] = GEN_INT (- (INTVAL (operands[1]) < 0));
9886 operands[5] = operands[1];
9893 [(set (match_operand:TI 0 "nonimmediate_operand" "")
9894 (match_operand:TI 1 "input_operand" ""))]
9895 "reload_completed && VECTOR_MEM_NONE_P (TImode)
9896 && gpr_or_gpr_p (operands[0], operands[1])"
9898 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
9900 (define_expand "load_multiple"
9901 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
9902 (match_operand:SI 1 "" ""))
9903 (use (match_operand:SI 2 "" ""))])]
9904 "TARGET_STRING && !TARGET_POWERPC64"
9912 /* Support only loading a constant number of fixed-point registers from
9913 memory and only bother with this if more than two; the machine
9914 doesn't support more than eight. */
9915 if (GET_CODE (operands[2]) != CONST_INT
9916 || INTVAL (operands[2]) <= 2
9917 || INTVAL (operands[2]) > 8
9918 || GET_CODE (operands[1]) != MEM
9919 || GET_CODE (operands[0]) != REG
9920 || REGNO (operands[0]) >= 32)
9923 count = INTVAL (operands[2]);
9924 regno = REGNO (operands[0]);
9926 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
9927 op1 = replace_equiv_address (operands[1],
9928 force_reg (SImode, XEXP (operands[1], 0)));
9930 for (i = 0; i < count; i++)
9931 XVECEXP (operands[3], 0, i)
9932 = gen_rtx_SET (VOIDmode, gen_rtx_REG (SImode, regno + i),
9933 adjust_address_nv (op1, SImode, i * 4));
9936 (define_insn "*ldmsi8"
9937 [(match_parallel 0 "load_multiple_operation"
9938 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9939 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9940 (set (match_operand:SI 3 "gpc_reg_operand" "")
9941 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9942 (set (match_operand:SI 4 "gpc_reg_operand" "")
9943 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9944 (set (match_operand:SI 5 "gpc_reg_operand" "")
9945 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
9946 (set (match_operand:SI 6 "gpc_reg_operand" "")
9947 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
9948 (set (match_operand:SI 7 "gpc_reg_operand" "")
9949 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
9950 (set (match_operand:SI 8 "gpc_reg_operand" "")
9951 (mem:SI (plus:SI (match_dup 1) (const_int 24))))
9952 (set (match_operand:SI 9 "gpc_reg_operand" "")
9953 (mem:SI (plus:SI (match_dup 1) (const_int 28))))])]
9954 "TARGET_STRING && XVECLEN (operands[0], 0) == 8"
9956 { return rs6000_output_load_multiple (operands); }"
9957 [(set_attr "type" "load_ux")
9958 (set_attr "length" "32")])
9960 (define_insn "*ldmsi7"
9961 [(match_parallel 0 "load_multiple_operation"
9962 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9963 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9964 (set (match_operand:SI 3 "gpc_reg_operand" "")
9965 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9966 (set (match_operand:SI 4 "gpc_reg_operand" "")
9967 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9968 (set (match_operand:SI 5 "gpc_reg_operand" "")
9969 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
9970 (set (match_operand:SI 6 "gpc_reg_operand" "")
9971 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
9972 (set (match_operand:SI 7 "gpc_reg_operand" "")
9973 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
9974 (set (match_operand:SI 8 "gpc_reg_operand" "")
9975 (mem:SI (plus:SI (match_dup 1) (const_int 24))))])]
9976 "TARGET_STRING && XVECLEN (operands[0], 0) == 7"
9978 { return rs6000_output_load_multiple (operands); }"
9979 [(set_attr "type" "load_ux")
9980 (set_attr "length" "32")])
9982 (define_insn "*ldmsi6"
9983 [(match_parallel 0 "load_multiple_operation"
9984 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9985 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9986 (set (match_operand:SI 3 "gpc_reg_operand" "")
9987 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9988 (set (match_operand:SI 4 "gpc_reg_operand" "")
9989 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9990 (set (match_operand:SI 5 "gpc_reg_operand" "")
9991 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
9992 (set (match_operand:SI 6 "gpc_reg_operand" "")
9993 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
9994 (set (match_operand:SI 7 "gpc_reg_operand" "")
9995 (mem:SI (plus:SI (match_dup 1) (const_int 20))))])]
9996 "TARGET_STRING && XVECLEN (operands[0], 0) == 6"
9998 { return rs6000_output_load_multiple (operands); }"
9999 [(set_attr "type" "load_ux")
10000 (set_attr "length" "32")])
10002 (define_insn "*ldmsi5"
10003 [(match_parallel 0 "load_multiple_operation"
10004 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10005 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10006 (set (match_operand:SI 3 "gpc_reg_operand" "")
10007 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10008 (set (match_operand:SI 4 "gpc_reg_operand" "")
10009 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
10010 (set (match_operand:SI 5 "gpc_reg_operand" "")
10011 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
10012 (set (match_operand:SI 6 "gpc_reg_operand" "")
10013 (mem:SI (plus:SI (match_dup 1) (const_int 16))))])]
10014 "TARGET_STRING && XVECLEN (operands[0], 0) == 5"
10016 { return rs6000_output_load_multiple (operands); }"
10017 [(set_attr "type" "load_ux")
10018 (set_attr "length" "32")])
10020 (define_insn "*ldmsi4"
10021 [(match_parallel 0 "load_multiple_operation"
10022 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10023 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10024 (set (match_operand:SI 3 "gpc_reg_operand" "")
10025 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10026 (set (match_operand:SI 4 "gpc_reg_operand" "")
10027 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
10028 (set (match_operand:SI 5 "gpc_reg_operand" "")
10029 (mem:SI (plus:SI (match_dup 1) (const_int 12))))])]
10030 "TARGET_STRING && XVECLEN (operands[0], 0) == 4"
10032 { return rs6000_output_load_multiple (operands); }"
10033 [(set_attr "type" "load_ux")
10034 (set_attr "length" "32")])
10036 (define_insn "*ldmsi3"
10037 [(match_parallel 0 "load_multiple_operation"
10038 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10039 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10040 (set (match_operand:SI 3 "gpc_reg_operand" "")
10041 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10042 (set (match_operand:SI 4 "gpc_reg_operand" "")
10043 (mem:SI (plus:SI (match_dup 1) (const_int 8))))])]
10044 "TARGET_STRING && XVECLEN (operands[0], 0) == 3"
10046 { return rs6000_output_load_multiple (operands); }"
10047 [(set_attr "type" "load_ux")
10048 (set_attr "length" "32")])
10050 (define_expand "store_multiple"
10051 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
10052 (match_operand:SI 1 "" ""))
10053 (clobber (scratch:SI))
10054 (use (match_operand:SI 2 "" ""))])]
10055 "TARGET_STRING && !TARGET_POWERPC64"
10064 /* Support only storing a constant number of fixed-point registers to
10065 memory and only bother with this if more than two; the machine
10066 doesn't support more than eight. */
10067 if (GET_CODE (operands[2]) != CONST_INT
10068 || INTVAL (operands[2]) <= 2
10069 || INTVAL (operands[2]) > 8
10070 || GET_CODE (operands[0]) != MEM
10071 || GET_CODE (operands[1]) != REG
10072 || REGNO (operands[1]) >= 32)
10075 count = INTVAL (operands[2]);
10076 regno = REGNO (operands[1]);
10078 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count + 1));
10079 to = force_reg (SImode, XEXP (operands[0], 0));
10080 op0 = replace_equiv_address (operands[0], to);
10082 XVECEXP (operands[3], 0, 0)
10083 = gen_rtx_SET (VOIDmode, adjust_address_nv (op0, SImode, 0), operands[1]);
10084 XVECEXP (operands[3], 0, 1) = gen_rtx_CLOBBER (VOIDmode,
10085 gen_rtx_SCRATCH (SImode));
10087 for (i = 1; i < count; i++)
10088 XVECEXP (operands[3], 0, i + 1)
10089 = gen_rtx_SET (VOIDmode,
10090 adjust_address_nv (op0, SImode, i * 4),
10091 gen_rtx_REG (SImode, regno + i));
10094 (define_insn "*stmsi8"
10095 [(match_parallel 0 "store_multiple_operation"
10096 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10097 (match_operand:SI 2 "gpc_reg_operand" "r"))
10098 (clobber (match_scratch:SI 3 "=X"))
10099 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10100 (match_operand:SI 4 "gpc_reg_operand" "r"))
10101 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10102 (match_operand:SI 5 "gpc_reg_operand" "r"))
10103 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10104 (match_operand:SI 6 "gpc_reg_operand" "r"))
10105 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10106 (match_operand:SI 7 "gpc_reg_operand" "r"))
10107 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10108 (match_operand:SI 8 "gpc_reg_operand" "r"))
10109 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
10110 (match_operand:SI 9 "gpc_reg_operand" "r"))
10111 (set (mem:SI (plus:SI (match_dup 1) (const_int 28)))
10112 (match_operand:SI 10 "gpc_reg_operand" "r"))])]
10113 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 9"
10114 "{stsi|stswi} %2,%1,%O0"
10115 [(set_attr "type" "store_ux")
10116 (set_attr "cell_micro" "always")])
10118 (define_insn "*stmsi7"
10119 [(match_parallel 0 "store_multiple_operation"
10120 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10121 (match_operand:SI 2 "gpc_reg_operand" "r"))
10122 (clobber (match_scratch:SI 3 "=X"))
10123 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10124 (match_operand:SI 4 "gpc_reg_operand" "r"))
10125 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10126 (match_operand:SI 5 "gpc_reg_operand" "r"))
10127 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10128 (match_operand:SI 6 "gpc_reg_operand" "r"))
10129 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10130 (match_operand:SI 7 "gpc_reg_operand" "r"))
10131 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10132 (match_operand:SI 8 "gpc_reg_operand" "r"))
10133 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
10134 (match_operand:SI 9 "gpc_reg_operand" "r"))])]
10135 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 8"
10136 "{stsi|stswi} %2,%1,%O0"
10137 [(set_attr "type" "store_ux")
10138 (set_attr "cell_micro" "always")])
10140 (define_insn "*stmsi6"
10141 [(match_parallel 0 "store_multiple_operation"
10142 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10143 (match_operand:SI 2 "gpc_reg_operand" "r"))
10144 (clobber (match_scratch:SI 3 "=X"))
10145 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10146 (match_operand:SI 4 "gpc_reg_operand" "r"))
10147 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10148 (match_operand:SI 5 "gpc_reg_operand" "r"))
10149 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10150 (match_operand:SI 6 "gpc_reg_operand" "r"))
10151 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10152 (match_operand:SI 7 "gpc_reg_operand" "r"))
10153 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10154 (match_operand:SI 8 "gpc_reg_operand" "r"))])]
10155 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 7"
10156 "{stsi|stswi} %2,%1,%O0"
10157 [(set_attr "type" "store_ux")
10158 (set_attr "cell_micro" "always")])
10160 (define_insn "*stmsi5"
10161 [(match_parallel 0 "store_multiple_operation"
10162 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10163 (match_operand:SI 2 "gpc_reg_operand" "r"))
10164 (clobber (match_scratch:SI 3 "=X"))
10165 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10166 (match_operand:SI 4 "gpc_reg_operand" "r"))
10167 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10168 (match_operand:SI 5 "gpc_reg_operand" "r"))
10169 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10170 (match_operand:SI 6 "gpc_reg_operand" "r"))
10171 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10172 (match_operand:SI 7 "gpc_reg_operand" "r"))])]
10173 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 6"
10174 "{stsi|stswi} %2,%1,%O0"
10175 [(set_attr "type" "store_ux")
10176 (set_attr "cell_micro" "always")])
10178 (define_insn "*stmsi4"
10179 [(match_parallel 0 "store_multiple_operation"
10180 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10181 (match_operand:SI 2 "gpc_reg_operand" "r"))
10182 (clobber (match_scratch:SI 3 "=X"))
10183 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10184 (match_operand:SI 4 "gpc_reg_operand" "r"))
10185 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10186 (match_operand:SI 5 "gpc_reg_operand" "r"))
10187 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10188 (match_operand:SI 6 "gpc_reg_operand" "r"))])]
10189 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 5"
10190 "{stsi|stswi} %2,%1,%O0"
10191 [(set_attr "type" "store_ux")
10192 (set_attr "cell_micro" "always")])
10194 (define_insn "*stmsi3"
10195 [(match_parallel 0 "store_multiple_operation"
10196 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10197 (match_operand:SI 2 "gpc_reg_operand" "r"))
10198 (clobber (match_scratch:SI 3 "=X"))
10199 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10200 (match_operand:SI 4 "gpc_reg_operand" "r"))
10201 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10202 (match_operand:SI 5 "gpc_reg_operand" "r"))])]
10203 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 4"
10204 "{stsi|stswi} %2,%1,%O0"
10205 [(set_attr "type" "store_ux")
10206 (set_attr "cell_micro" "always")])
10208 (define_insn "*stmsi8_power"
10209 [(match_parallel 0 "store_multiple_operation"
10210 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10211 (match_operand:SI 2 "gpc_reg_operand" "r"))
10212 (clobber (match_scratch:SI 3 "=q"))
10213 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10214 (match_operand:SI 4 "gpc_reg_operand" "r"))
10215 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10216 (match_operand:SI 5 "gpc_reg_operand" "r"))
10217 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10218 (match_operand:SI 6 "gpc_reg_operand" "r"))
10219 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10220 (match_operand:SI 7 "gpc_reg_operand" "r"))
10221 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10222 (match_operand:SI 8 "gpc_reg_operand" "r"))
10223 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
10224 (match_operand:SI 9 "gpc_reg_operand" "r"))
10225 (set (mem:SI (plus:SI (match_dup 1) (const_int 28)))
10226 (match_operand:SI 10 "gpc_reg_operand" "r"))])]
10227 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 9"
10228 "{stsi|stswi} %2,%1,%O0"
10229 [(set_attr "type" "store_ux")
10230 (set_attr "cell_micro" "always")])
10232 (define_insn "*stmsi7_power"
10233 [(match_parallel 0 "store_multiple_operation"
10234 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10235 (match_operand:SI 2 "gpc_reg_operand" "r"))
10236 (clobber (match_scratch:SI 3 "=q"))
10237 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10238 (match_operand:SI 4 "gpc_reg_operand" "r"))
10239 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10240 (match_operand:SI 5 "gpc_reg_operand" "r"))
10241 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10242 (match_operand:SI 6 "gpc_reg_operand" "r"))
10243 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10244 (match_operand:SI 7 "gpc_reg_operand" "r"))
10245 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10246 (match_operand:SI 8 "gpc_reg_operand" "r"))
10247 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
10248 (match_operand:SI 9 "gpc_reg_operand" "r"))])]
10249 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 8"
10250 "{stsi|stswi} %2,%1,%O0"
10251 [(set_attr "type" "store_ux")
10252 (set_attr "cell_micro" "always")])
10254 (define_insn "*stmsi6_power"
10255 [(match_parallel 0 "store_multiple_operation"
10256 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10257 (match_operand:SI 2 "gpc_reg_operand" "r"))
10258 (clobber (match_scratch:SI 3 "=q"))
10259 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10260 (match_operand:SI 4 "gpc_reg_operand" "r"))
10261 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10262 (match_operand:SI 5 "gpc_reg_operand" "r"))
10263 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10264 (match_operand:SI 6 "gpc_reg_operand" "r"))
10265 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10266 (match_operand:SI 7 "gpc_reg_operand" "r"))
10267 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10268 (match_operand:SI 8 "gpc_reg_operand" "r"))])]
10269 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 7"
10270 "{stsi|stswi} %2,%1,%O0"
10271 [(set_attr "type" "store_ux")
10272 (set_attr "cell_micro" "always")])
10274 (define_insn "*stmsi5_power"
10275 [(match_parallel 0 "store_multiple_operation"
10276 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10277 (match_operand:SI 2 "gpc_reg_operand" "r"))
10278 (clobber (match_scratch:SI 3 "=q"))
10279 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10280 (match_operand:SI 4 "gpc_reg_operand" "r"))
10281 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10282 (match_operand:SI 5 "gpc_reg_operand" "r"))
10283 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10284 (match_operand:SI 6 "gpc_reg_operand" "r"))
10285 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10286 (match_operand:SI 7 "gpc_reg_operand" "r"))])]
10287 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 6"
10288 "{stsi|stswi} %2,%1,%O0"
10289 [(set_attr "type" "store_ux")
10290 (set_attr "cell_micro" "always")])
10292 (define_insn "*stmsi4_power"
10293 [(match_parallel 0 "store_multiple_operation"
10294 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10295 (match_operand:SI 2 "gpc_reg_operand" "r"))
10296 (clobber (match_scratch:SI 3 "=q"))
10297 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10298 (match_operand:SI 4 "gpc_reg_operand" "r"))
10299 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10300 (match_operand:SI 5 "gpc_reg_operand" "r"))
10301 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10302 (match_operand:SI 6 "gpc_reg_operand" "r"))])]
10303 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 5"
10304 "{stsi|stswi} %2,%1,%O0"
10305 [(set_attr "type" "store_ux")
10306 (set_attr "cell_micro" "always")])
10308 (define_insn "*stmsi3_power"
10309 [(match_parallel 0 "store_multiple_operation"
10310 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10311 (match_operand:SI 2 "gpc_reg_operand" "r"))
10312 (clobber (match_scratch:SI 3 "=q"))
10313 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10314 (match_operand:SI 4 "gpc_reg_operand" "r"))
10315 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10316 (match_operand:SI 5 "gpc_reg_operand" "r"))])]
10317 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 4"
10318 "{stsi|stswi} %2,%1,%O0"
10319 [(set_attr "type" "store_ux")
10320 (set_attr "cell_micro" "always")])
10322 (define_expand "setmemsi"
10323 [(parallel [(set (match_operand:BLK 0 "" "")
10324 (match_operand 2 "const_int_operand" ""))
10325 (use (match_operand:SI 1 "" ""))
10326 (use (match_operand:SI 3 "" ""))])]
10330 /* If value to set is not zero, use the library routine. */
10331 if (operands[2] != const0_rtx)
10334 if (expand_block_clear (operands))
10340 ;; String/block move insn.
10341 ;; Argument 0 is the destination
10342 ;; Argument 1 is the source
10343 ;; Argument 2 is the length
10344 ;; Argument 3 is the alignment
10346 (define_expand "movmemsi"
10347 [(parallel [(set (match_operand:BLK 0 "" "")
10348 (match_operand:BLK 1 "" ""))
10349 (use (match_operand:SI 2 "" ""))
10350 (use (match_operand:SI 3 "" ""))])]
10354 if (expand_block_move (operands))
10360 ;; Move up to 32 bytes at a time. The fixed registers are needed because the
10361 ;; register allocator doesn't have a clue about allocating 8 word registers.
10362 ;; rD/rS = r5 is preferred, efficient form.
10363 (define_expand "movmemsi_8reg"
10364 [(parallel [(set (match_operand 0 "" "")
10365 (match_operand 1 "" ""))
10366 (use (match_operand 2 "" ""))
10367 (use (match_operand 3 "" ""))
10368 (clobber (reg:SI 5))
10369 (clobber (reg:SI 6))
10370 (clobber (reg:SI 7))
10371 (clobber (reg:SI 8))
10372 (clobber (reg:SI 9))
10373 (clobber (reg:SI 10))
10374 (clobber (reg:SI 11))
10375 (clobber (reg:SI 12))
10376 (clobber (match_scratch:SI 4 ""))])]
10381 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
10382 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
10383 (use (match_operand:SI 2 "immediate_operand" "i"))
10384 (use (match_operand:SI 3 "immediate_operand" "i"))
10385 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10386 (clobber (reg:SI 6))
10387 (clobber (reg:SI 7))
10388 (clobber (reg:SI 8))
10389 (clobber (reg:SI 9))
10390 (clobber (reg:SI 10))
10391 (clobber (reg:SI 11))
10392 (clobber (reg:SI 12))
10393 (clobber (match_scratch:SI 5 "=q"))]
10394 "TARGET_STRING && TARGET_POWER
10395 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
10396 || INTVAL (operands[2]) == 0)
10397 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
10398 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
10399 && REGNO (operands[4]) == 5"
10400 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10401 [(set_attr "type" "store_ux")
10402 (set_attr "cell_micro" "always")
10403 (set_attr "length" "8")])
10406 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
10407 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
10408 (use (match_operand:SI 2 "immediate_operand" "i"))
10409 (use (match_operand:SI 3 "immediate_operand" "i"))
10410 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10411 (clobber (reg:SI 6))
10412 (clobber (reg:SI 7))
10413 (clobber (reg:SI 8))
10414 (clobber (reg:SI 9))
10415 (clobber (reg:SI 10))
10416 (clobber (reg:SI 11))
10417 (clobber (reg:SI 12))
10418 (clobber (match_scratch:SI 5 "=X"))]
10419 "TARGET_STRING && ! TARGET_POWER
10420 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
10421 || INTVAL (operands[2]) == 0)
10422 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
10423 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
10424 && REGNO (operands[4]) == 5"
10425 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10426 [(set_attr "type" "store_ux")
10427 (set_attr "cell_micro" "always")
10428 (set_attr "length" "8")])
10430 ;; Move up to 24 bytes at a time. The fixed registers are needed because the
10431 ;; register allocator doesn't have a clue about allocating 6 word registers.
10432 ;; rD/rS = r5 is preferred, efficient form.
10433 (define_expand "movmemsi_6reg"
10434 [(parallel [(set (match_operand 0 "" "")
10435 (match_operand 1 "" ""))
10436 (use (match_operand 2 "" ""))
10437 (use (match_operand 3 "" ""))
10438 (clobber (reg:SI 5))
10439 (clobber (reg:SI 6))
10440 (clobber (reg:SI 7))
10441 (clobber (reg:SI 8))
10442 (clobber (reg:SI 9))
10443 (clobber (reg:SI 10))
10444 (clobber (match_scratch:SI 4 ""))])]
10449 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
10450 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
10451 (use (match_operand:SI 2 "immediate_operand" "i"))
10452 (use (match_operand:SI 3 "immediate_operand" "i"))
10453 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10454 (clobber (reg:SI 6))
10455 (clobber (reg:SI 7))
10456 (clobber (reg:SI 8))
10457 (clobber (reg:SI 9))
10458 (clobber (reg:SI 10))
10459 (clobber (match_scratch:SI 5 "=q"))]
10460 "TARGET_STRING && TARGET_POWER
10461 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 24
10462 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
10463 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
10464 && REGNO (operands[4]) == 5"
10465 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10466 [(set_attr "type" "store_ux")
10467 (set_attr "cell_micro" "always")
10468 (set_attr "length" "8")])
10471 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
10472 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
10473 (use (match_operand:SI 2 "immediate_operand" "i"))
10474 (use (match_operand:SI 3 "immediate_operand" "i"))
10475 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10476 (clobber (reg:SI 6))
10477 (clobber (reg:SI 7))
10478 (clobber (reg:SI 8))
10479 (clobber (reg:SI 9))
10480 (clobber (reg:SI 10))
10481 (clobber (match_scratch:SI 5 "=X"))]
10482 "TARGET_STRING && ! TARGET_POWER
10483 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
10484 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
10485 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
10486 && REGNO (operands[4]) == 5"
10487 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10488 [(set_attr "type" "store_ux")
10489 (set_attr "cell_micro" "always")
10490 (set_attr "length" "8")])
10492 ;; Move up to 16 bytes at a time, using 4 fixed registers to avoid spill
10493 ;; problems with TImode.
10494 ;; rD/rS = r5 is preferred, efficient form.
10495 (define_expand "movmemsi_4reg"
10496 [(parallel [(set (match_operand 0 "" "")
10497 (match_operand 1 "" ""))
10498 (use (match_operand 2 "" ""))
10499 (use (match_operand 3 "" ""))
10500 (clobber (reg:SI 5))
10501 (clobber (reg:SI 6))
10502 (clobber (reg:SI 7))
10503 (clobber (reg:SI 8))
10504 (clobber (match_scratch:SI 4 ""))])]
10509 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
10510 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
10511 (use (match_operand:SI 2 "immediate_operand" "i"))
10512 (use (match_operand:SI 3 "immediate_operand" "i"))
10513 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10514 (clobber (reg:SI 6))
10515 (clobber (reg:SI 7))
10516 (clobber (reg:SI 8))
10517 (clobber (match_scratch:SI 5 "=q"))]
10518 "TARGET_STRING && TARGET_POWER
10519 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
10520 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
10521 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
10522 && REGNO (operands[4]) == 5"
10523 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10524 [(set_attr "type" "store_ux")
10525 (set_attr "cell_micro" "always")
10526 (set_attr "length" "8")])
10529 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
10530 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
10531 (use (match_operand:SI 2 "immediate_operand" "i"))
10532 (use (match_operand:SI 3 "immediate_operand" "i"))
10533 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10534 (clobber (reg:SI 6))
10535 (clobber (reg:SI 7))
10536 (clobber (reg:SI 8))
10537 (clobber (match_scratch:SI 5 "=X"))]
10538 "TARGET_STRING && ! TARGET_POWER
10539 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
10540 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
10541 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
10542 && REGNO (operands[4]) == 5"
10543 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10544 [(set_attr "type" "store_ux")
10545 (set_attr "cell_micro" "always")
10546 (set_attr "length" "8")])
10548 ;; Move up to 8 bytes at a time.
10549 (define_expand "movmemsi_2reg"
10550 [(parallel [(set (match_operand 0 "" "")
10551 (match_operand 1 "" ""))
10552 (use (match_operand 2 "" ""))
10553 (use (match_operand 3 "" ""))
10554 (clobber (match_scratch:DI 4 ""))
10555 (clobber (match_scratch:SI 5 ""))])]
10556 "TARGET_STRING && ! TARGET_POWERPC64"
10560 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
10561 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
10562 (use (match_operand:SI 2 "immediate_operand" "i"))
10563 (use (match_operand:SI 3 "immediate_operand" "i"))
10564 (clobber (match_scratch:DI 4 "=&r"))
10565 (clobber (match_scratch:SI 5 "=q"))]
10566 "TARGET_STRING && TARGET_POWER && ! TARGET_POWERPC64
10567 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
10568 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10569 [(set_attr "type" "store_ux")
10570 (set_attr "cell_micro" "always")
10571 (set_attr "length" "8")])
10574 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
10575 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
10576 (use (match_operand:SI 2 "immediate_operand" "i"))
10577 (use (match_operand:SI 3 "immediate_operand" "i"))
10578 (clobber (match_scratch:DI 4 "=&r"))
10579 (clobber (match_scratch:SI 5 "=X"))]
10580 "TARGET_STRING && ! TARGET_POWER && ! TARGET_POWERPC64
10581 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
10582 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10583 [(set_attr "type" "store_ux")
10584 (set_attr "cell_micro" "always")
10585 (set_attr "length" "8")])
10587 ;; Move up to 4 bytes at a time.
10588 (define_expand "movmemsi_1reg"
10589 [(parallel [(set (match_operand 0 "" "")
10590 (match_operand 1 "" ""))
10591 (use (match_operand 2 "" ""))
10592 (use (match_operand 3 "" ""))
10593 (clobber (match_scratch:SI 4 ""))
10594 (clobber (match_scratch:SI 5 ""))])]
10599 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
10600 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
10601 (use (match_operand:SI 2 "immediate_operand" "i"))
10602 (use (match_operand:SI 3 "immediate_operand" "i"))
10603 (clobber (match_scratch:SI 4 "=&r"))
10604 (clobber (match_scratch:SI 5 "=q"))]
10605 "TARGET_STRING && TARGET_POWER
10606 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
10607 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10608 [(set_attr "type" "store_ux")
10609 (set_attr "cell_micro" "always")
10610 (set_attr "length" "8")])
10613 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
10614 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
10615 (use (match_operand:SI 2 "immediate_operand" "i"))
10616 (use (match_operand:SI 3 "immediate_operand" "i"))
10617 (clobber (match_scratch:SI 4 "=&r"))
10618 (clobber (match_scratch:SI 5 "=X"))]
10619 "TARGET_STRING && ! TARGET_POWER
10620 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
10621 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10622 [(set_attr "type" "store_ux")
10623 (set_attr "cell_micro" "always")
10624 (set_attr "length" "8")])
10626 ;; Define insns that do load or store with update. Some of these we can
10627 ;; get by using pre-decrement or pre-increment, but the hardware can also
10628 ;; do cases where the increment is not the size of the object.
10630 ;; In all these cases, we use operands 0 and 1 for the register being
10631 ;; incremented because those are the operands that local-alloc will
10632 ;; tie and these are the pair most likely to be tieable (and the ones
10633 ;; that will benefit the most).
10635 (define_insn "*movdi_update1"
10636 [(set (match_operand:DI 3 "gpc_reg_operand" "=r,r")
10637 (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
10638 (match_operand:DI 2 "reg_or_aligned_short_operand" "r,I"))))
10639 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
10640 (plus:DI (match_dup 1) (match_dup 2)))]
10641 "TARGET_POWERPC64 && TARGET_UPDATE
10642 && (!avoiding_indexed_address_p (DImode)
10643 || !gpc_reg_operand (operands[2], DImode))"
10647 [(set_attr "type" "load_ux,load_u")])
10649 (define_insn "movdi_<mode>_update"
10650 [(set (mem:DI (plus:P (match_operand:P 1 "gpc_reg_operand" "0,0")
10651 (match_operand:P 2 "reg_or_aligned_short_operand" "r,I")))
10652 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
10653 (set (match_operand:P 0 "gpc_reg_operand" "=b,b")
10654 (plus:P (match_dup 1) (match_dup 2)))]
10655 "TARGET_POWERPC64 && TARGET_UPDATE
10656 && (!avoiding_indexed_address_p (Pmode)
10657 || !gpc_reg_operand (operands[2], Pmode)
10658 || (REG_P (operands[0])
10659 && REGNO (operands[0]) == STACK_POINTER_REGNUM))"
10663 [(set_attr "type" "store_ux,store_u")])
10665 ;; This pattern is only conditional on TARGET_POWERPC64, as it is
10666 ;; needed for stack allocation, even if the user passes -mno-update.
10667 (define_insn "movdi_<mode>_update_stack"
10668 [(set (mem:DI (plus:P (match_operand:P 1 "gpc_reg_operand" "0,0")
10669 (match_operand:P 2 "reg_or_aligned_short_operand" "r,I")))
10670 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
10671 (set (match_operand:P 0 "gpc_reg_operand" "=b,b")
10672 (plus:P (match_dup 1) (match_dup 2)))]
10677 [(set_attr "type" "store_ux,store_u")])
10679 (define_insn "*movsi_update1"
10680 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
10681 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10682 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10683 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10684 (plus:SI (match_dup 1) (match_dup 2)))]
10686 && (!avoiding_indexed_address_p (SImode)
10687 || !gpc_reg_operand (operands[2], SImode))"
10689 {lux|lwzux} %3,%0,%2
10690 {lu|lwzu} %3,%2(%0)"
10691 [(set_attr "type" "load_ux,load_u")])
10693 (define_insn "*movsi_update2"
10694 [(set (match_operand:DI 3 "gpc_reg_operand" "=r")
10696 (mem:SI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0")
10697 (match_operand:DI 2 "gpc_reg_operand" "r")))))
10698 (set (match_operand:DI 0 "gpc_reg_operand" "=b")
10699 (plus:DI (match_dup 1) (match_dup 2)))]
10700 "TARGET_POWERPC64 && rs6000_gen_cell_microcode
10701 && !avoiding_indexed_address_p (DImode)"
10703 [(set_attr "type" "load_ext_ux")])
10705 (define_insn "movsi_update"
10706 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10707 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10708 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
10709 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10710 (plus:SI (match_dup 1) (match_dup 2)))]
10712 && (!avoiding_indexed_address_p (SImode)
10713 || !gpc_reg_operand (operands[2], SImode)
10714 || (REG_P (operands[0])
10715 && REGNO (operands[0]) == STACK_POINTER_REGNUM))"
10717 {stux|stwux} %3,%0,%2
10718 {stu|stwu} %3,%2(%0)"
10719 [(set_attr "type" "store_ux,store_u")])
10721 ;; This is an unconditional pattern; needed for stack allocation, even
10722 ;; if the user passes -mno-update.
10723 (define_insn "movsi_update_stack"
10724 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10725 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10726 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
10727 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10728 (plus:SI (match_dup 1) (match_dup 2)))]
10731 {stux|stwux} %3,%0,%2
10732 {stu|stwu} %3,%2(%0)"
10733 [(set_attr "type" "store_ux,store_u")])
10735 (define_insn "*movhi_update1"
10736 [(set (match_operand:HI 3 "gpc_reg_operand" "=r,r")
10737 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10738 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10739 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10740 (plus:SI (match_dup 1) (match_dup 2)))]
10742 && (!avoiding_indexed_address_p (SImode)
10743 || !gpc_reg_operand (operands[2], SImode))"
10747 [(set_attr "type" "load_ux,load_u")])
10749 (define_insn "*movhi_update2"
10750 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
10752 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10753 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
10754 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10755 (plus:SI (match_dup 1) (match_dup 2)))]
10757 && (!avoiding_indexed_address_p (SImode)
10758 || !gpc_reg_operand (operands[2], SImode))"
10762 [(set_attr "type" "load_ux,load_u")])
10764 (define_insn "*movhi_update3"
10765 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
10767 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10768 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
10769 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10770 (plus:SI (match_dup 1) (match_dup 2)))]
10771 "TARGET_UPDATE && rs6000_gen_cell_microcode
10772 && (!avoiding_indexed_address_p (SImode)
10773 || !gpc_reg_operand (operands[2], SImode))"
10777 [(set_attr "type" "load_ext_ux,load_ext_u")])
10779 (define_insn "*movhi_update4"
10780 [(set (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10781 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10782 (match_operand:HI 3 "gpc_reg_operand" "r,r"))
10783 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10784 (plus:SI (match_dup 1) (match_dup 2)))]
10786 && (!avoiding_indexed_address_p (SImode)
10787 || !gpc_reg_operand (operands[2], SImode))"
10791 [(set_attr "type" "store_ux,store_u")])
10793 (define_insn "*movqi_update1"
10794 [(set (match_operand:QI 3 "gpc_reg_operand" "=r,r")
10795 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10796 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10797 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10798 (plus:SI (match_dup 1) (match_dup 2)))]
10800 && (!avoiding_indexed_address_p (SImode)
10801 || !gpc_reg_operand (operands[2], SImode))"
10805 [(set_attr "type" "load_ux,load_u")])
10807 (define_insn "*movqi_update2"
10808 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
10810 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10811 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
10812 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10813 (plus:SI (match_dup 1) (match_dup 2)))]
10815 && (!avoiding_indexed_address_p (SImode)
10816 || !gpc_reg_operand (operands[2], SImode))"
10820 [(set_attr "type" "load_ux,load_u")])
10822 (define_insn "*movqi_update3"
10823 [(set (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10824 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10825 (match_operand:QI 3 "gpc_reg_operand" "r,r"))
10826 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10827 (plus:SI (match_dup 1) (match_dup 2)))]
10829 && (!avoiding_indexed_address_p (SImode)
10830 || !gpc_reg_operand (operands[2], SImode))"
10834 [(set_attr "type" "store_ux,store_u")])
10836 (define_insn "*movsf_update1"
10837 [(set (match_operand:SF 3 "gpc_reg_operand" "=f,f")
10838 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10839 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10840 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10841 (plus:SI (match_dup 1) (match_dup 2)))]
10842 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT && TARGET_UPDATE
10843 && (!avoiding_indexed_address_p (SImode)
10844 || !gpc_reg_operand (operands[2], SImode))"
10848 [(set_attr "type" "fpload_ux,fpload_u")])
10850 (define_insn "*movsf_update2"
10851 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10852 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10853 (match_operand:SF 3 "gpc_reg_operand" "f,f"))
10854 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10855 (plus:SI (match_dup 1) (match_dup 2)))]
10856 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT && TARGET_UPDATE
10857 && (!avoiding_indexed_address_p (SImode)
10858 || !gpc_reg_operand (operands[2], SImode))"
10862 [(set_attr "type" "fpstore_ux,fpstore_u")])
10864 (define_insn "*movsf_update3"
10865 [(set (match_operand:SF 3 "gpc_reg_operand" "=r,r")
10866 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10867 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10868 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10869 (plus:SI (match_dup 1) (match_dup 2)))]
10870 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE
10871 && (!avoiding_indexed_address_p (SImode)
10872 || !gpc_reg_operand (operands[2], SImode))"
10874 {lux|lwzux} %3,%0,%2
10875 {lu|lwzu} %3,%2(%0)"
10876 [(set_attr "type" "load_ux,load_u")])
10878 (define_insn "*movsf_update4"
10879 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10880 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10881 (match_operand:SF 3 "gpc_reg_operand" "r,r"))
10882 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10883 (plus:SI (match_dup 1) (match_dup 2)))]
10884 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE
10885 && (!avoiding_indexed_address_p (SImode)
10886 || !gpc_reg_operand (operands[2], SImode))"
10888 {stux|stwux} %3,%0,%2
10889 {stu|stwu} %3,%2(%0)"
10890 [(set_attr "type" "store_ux,store_u")])
10892 (define_insn "*movdf_update1"
10893 [(set (match_operand:DF 3 "gpc_reg_operand" "=d,d")
10894 (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10895 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10896 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10897 (plus:SI (match_dup 1) (match_dup 2)))]
10898 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_UPDATE
10899 && (!avoiding_indexed_address_p (SImode)
10900 || !gpc_reg_operand (operands[2], SImode))"
10904 [(set_attr "type" "fpload_ux,fpload_u")])
10906 (define_insn "*movdf_update2"
10907 [(set (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10908 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10909 (match_operand:DF 3 "gpc_reg_operand" "d,d"))
10910 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10911 (plus:SI (match_dup 1) (match_dup 2)))]
10912 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_UPDATE
10913 && (!avoiding_indexed_address_p (SImode)
10914 || !gpc_reg_operand (operands[2], SImode))"
10918 [(set_attr "type" "fpstore_ux,fpstore_u")])
10920 ;; Peephole to convert two consecutive FP loads or stores into lfq/stfq.
10922 (define_insn "*lfq_power2"
10923 [(set (match_operand:V2DF 0 "gpc_reg_operand" "=f")
10924 (match_operand:V2DF 1 "memory_operand" ""))]
10926 && TARGET_HARD_FLOAT && TARGET_FPRS"
10930 [(set (match_operand:DF 0 "gpc_reg_operand" "")
10931 (match_operand:DF 1 "memory_operand" ""))
10932 (set (match_operand:DF 2 "gpc_reg_operand" "")
10933 (match_operand:DF 3 "memory_operand" ""))]
10935 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
10936 && registers_ok_for_quad_peep (operands[0], operands[2])
10937 && mems_ok_for_quad_peep (operands[1], operands[3])"
10938 [(set (match_dup 0)
10940 "operands[1] = widen_memory_access (operands[1], V2DFmode, 0);
10941 operands[0] = gen_rtx_REG (V2DFmode, REGNO (operands[0]));")
10943 (define_insn "*stfq_power2"
10944 [(set (match_operand:V2DF 0 "memory_operand" "")
10945 (match_operand:V2DF 1 "gpc_reg_operand" "f"))]
10947 && TARGET_HARD_FLOAT && TARGET_FPRS"
10948 "stfq%U0%X0 %1,%0")
10952 [(set (match_operand:DF 0 "memory_operand" "")
10953 (match_operand:DF 1 "gpc_reg_operand" ""))
10954 (set (match_operand:DF 2 "memory_operand" "")
10955 (match_operand:DF 3 "gpc_reg_operand" ""))]
10957 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
10958 && registers_ok_for_quad_peep (operands[1], operands[3])
10959 && mems_ok_for_quad_peep (operands[0], operands[2])"
10960 [(set (match_dup 0)
10962 "operands[0] = widen_memory_access (operands[0], V2DFmode, 0);
10963 operands[1] = gen_rtx_REG (V2DFmode, REGNO (operands[1]));")
10965 ;; After inserting conditional returns we can sometimes have
10966 ;; unnecessary register moves. Unfortunately we cannot have a
10967 ;; modeless peephole here, because some single SImode sets have early
10968 ;; clobber outputs. Although those sets expand to multi-ppc-insn
10969 ;; sequences, using get_attr_length here will smash the operands
10970 ;; array. Neither is there an early_cobbler_p predicate.
10971 ;; Disallow subregs for E500 so we don't munge frob_di_df_2.
10973 [(set (match_operand:DF 0 "gpc_reg_operand" "")
10974 (match_operand:DF 1 "any_operand" ""))
10975 (set (match_operand:DF 2 "gpc_reg_operand" "")
10977 "!(TARGET_E500_DOUBLE && GET_CODE (operands[2]) == SUBREG)
10978 && peep2_reg_dead_p (2, operands[0])"
10979 [(set (match_dup 2) (match_dup 1))])
10982 [(set (match_operand:SF 0 "gpc_reg_operand" "")
10983 (match_operand:SF 1 "any_operand" ""))
10984 (set (match_operand:SF 2 "gpc_reg_operand" "")
10986 "peep2_reg_dead_p (2, operands[0])"
10987 [(set (match_dup 2) (match_dup 1))])
10992 ;; Mode attributes for different ABIs.
10993 (define_mode_iterator TLSmode [(SI "! TARGET_64BIT") (DI "TARGET_64BIT")])
10994 (define_mode_attr tls_abi_suffix [(SI "32") (DI "64")])
10995 (define_mode_attr tls_sysv_suffix [(SI "si") (DI "di")])
10996 (define_mode_attr tls_insn_suffix [(SI "wz") (DI "d")])
10998 (define_insn_and_split "tls_gd_aix<TLSmode:tls_abi_suffix>"
10999 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11000 (call (mem:TLSmode (match_operand:TLSmode 3 "symbol_ref_operand" "s"))
11001 (match_operand 4 "" "g")))
11002 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11003 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11005 (clobber (reg:SI LR_REGNO))]
11006 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX"
11007 "addi %0,%1,%2@got@tlsgd\;bl %z3\;%."
11008 "&& TARGET_TLS_MARKERS"
11009 [(set (match_dup 0)
11010 (unspec:TLSmode [(match_dup 1)
11013 (parallel [(set (match_dup 0)
11014 (call (mem:TLSmode (match_dup 3))
11016 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD)
11017 (clobber (reg:SI LR_REGNO))])]
11019 [(set_attr "type" "two")
11020 (set_attr "length" "12")])
11022 (define_insn_and_split "tls_gd_sysv<TLSmode:tls_sysv_suffix>"
11023 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11024 (call (mem:TLSmode (match_operand:TLSmode 3 "symbol_ref_operand" "s"))
11025 (match_operand 4 "" "g")))
11026 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11027 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11029 (clobber (reg:SI LR_REGNO))]
11030 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4"
11034 if (TARGET_SECURE_PLT && flag_pic == 2)
11035 return "addi %0,%1,%2@got@tlsgd\;bl %z3+32768@plt";
11037 return "addi %0,%1,%2@got@tlsgd\;bl %z3@plt";
11040 return "addi %0,%1,%2@got@tlsgd\;bl %z3";
11042 "&& TARGET_TLS_MARKERS"
11043 [(set (match_dup 0)
11044 (unspec:TLSmode [(match_dup 1)
11047 (parallel [(set (match_dup 0)
11048 (call (mem:TLSmode (match_dup 3))
11050 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD)
11051 (clobber (reg:SI LR_REGNO))])]
11053 [(set_attr "type" "two")
11054 (set_attr "length" "8")])
11056 (define_insn "*tls_gd<TLSmode:tls_abi_suffix>"
11057 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11058 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11059 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11061 "HAVE_AS_TLS && TARGET_TLS_MARKERS"
11062 "addi %0,%1,%2@got@tlsgd"
11063 [(set_attr "length" "4")])
11065 (define_insn "*tls_gd_call_aix<TLSmode:tls_abi_suffix>"
11066 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11067 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
11068 (match_operand 2 "" "g")))
11069 (unspec:TLSmode [(match_operand:TLSmode 3 "rs6000_tls_symbol_ref" "")]
11071 (clobber (reg:SI LR_REGNO))]
11072 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX && TARGET_TLS_MARKERS"
11073 "bl %z1(%3@tlsgd)\;%."
11074 [(set_attr "type" "branch")
11075 (set_attr "length" "8")])
11077 (define_insn "*tls_gd_call_sysv<TLSmode:tls_abi_suffix>"
11078 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11079 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
11080 (match_operand 2 "" "g")))
11081 (unspec:TLSmode [(match_operand:TLSmode 3 "rs6000_tls_symbol_ref" "")]
11083 (clobber (reg:SI LR_REGNO))]
11084 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4 && TARGET_TLS_MARKERS"
11088 if (TARGET_SECURE_PLT && flag_pic == 2)
11089 return "bl %z1+32768(%3@tlsgd)@plt";
11090 return "bl %z1(%3@tlsgd)@plt";
11092 return "bl %z1(%3@tlsgd)";
11094 [(set_attr "type" "branch")
11095 (set_attr "length" "4")])
11097 (define_insn_and_split "tls_ld_aix<TLSmode:tls_abi_suffix>"
11098 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11099 (call (mem:TLSmode (match_operand:TLSmode 2 "symbol_ref_operand" "s"))
11100 (match_operand 3 "" "g")))
11101 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
11103 (clobber (reg:SI LR_REGNO))]
11104 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX"
11105 "addi %0,%1,%&@got@tlsld\;bl %z2\;%."
11106 "&& TARGET_TLS_MARKERS"
11107 [(set (match_dup 0)
11108 (unspec:TLSmode [(match_dup 1)]
11110 (parallel [(set (match_dup 0)
11111 (call (mem:TLSmode (match_dup 2))
11113 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
11114 (clobber (reg:SI LR_REGNO))])]
11116 [(set_attr "length" "12")])
11118 (define_insn_and_split "tls_ld_sysv<TLSmode:tls_sysv_suffix>"
11119 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11120 (call (mem:TLSmode (match_operand:TLSmode 2 "symbol_ref_operand" "s"))
11121 (match_operand 3 "" "g")))
11122 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
11124 (clobber (reg:SI LR_REGNO))]
11125 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4"
11129 if (TARGET_SECURE_PLT && flag_pic == 2)
11130 return "addi %0,%1,%&@got@tlsld\;bl %z2+32768@plt";
11132 return "addi %0,%1,%&@got@tlsld\;bl %z2@plt";
11135 return "addi %0,%1,%&@got@tlsld\;bl %z2";
11137 "&& TARGET_TLS_MARKERS"
11138 [(set (match_dup 0)
11139 (unspec:TLSmode [(match_dup 1)]
11141 (parallel [(set (match_dup 0)
11142 (call (mem:TLSmode (match_dup 2))
11144 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
11145 (clobber (reg:SI LR_REGNO))])]
11147 [(set_attr "length" "8")])
11149 (define_insn "*tls_ld<TLSmode:tls_abi_suffix>"
11150 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11151 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
11153 "HAVE_AS_TLS && TARGET_TLS_MARKERS"
11154 "addi %0,%1,%&@got@tlsld"
11155 [(set_attr "length" "4")])
11157 (define_insn "*tls_ld_call_aix<TLSmode:tls_abi_suffix>"
11158 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11159 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
11160 (match_operand 2 "" "g")))
11161 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
11162 (clobber (reg:SI LR_REGNO))]
11163 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX && TARGET_TLS_MARKERS"
11164 "bl %z1(%&@tlsld)\;%."
11165 [(set_attr "type" "branch")
11166 (set_attr "length" "8")])
11168 (define_insn "*tls_ld_call_sysv<TLSmode:tls_abi_suffix>"
11169 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11170 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
11171 (match_operand 2 "" "g")))
11172 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
11173 (clobber (reg:SI LR_REGNO))]
11174 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4 && TARGET_TLS_MARKERS"
11178 if (TARGET_SECURE_PLT && flag_pic == 2)
11179 return "bl %z1+32768(%&@tlsld)@plt";
11180 return "bl %z1(%&@tlsld)@plt";
11182 return "bl %z1(%&@tlsld)";
11184 [(set_attr "type" "branch")
11185 (set_attr "length" "4")])
11187 (define_insn "tls_dtprel_<TLSmode:tls_abi_suffix>"
11188 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11189 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11190 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11191 UNSPEC_TLSDTPREL))]
11193 "addi %0,%1,%2@dtprel")
11195 (define_insn "tls_dtprel_ha_<TLSmode:tls_abi_suffix>"
11196 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11197 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11198 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11199 UNSPEC_TLSDTPRELHA))]
11201 "addis %0,%1,%2@dtprel@ha")
11203 (define_insn "tls_dtprel_lo_<TLSmode:tls_abi_suffix>"
11204 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11205 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11206 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11207 UNSPEC_TLSDTPRELLO))]
11209 "addi %0,%1,%2@dtprel@l")
11211 (define_insn "tls_got_dtprel_<TLSmode:tls_abi_suffix>"
11212 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11213 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11214 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11215 UNSPEC_TLSGOTDTPREL))]
11217 "l<TLSmode:tls_insn_suffix> %0,%2@got@dtprel(%1)")
11219 (define_insn "tls_tprel_<TLSmode:tls_abi_suffix>"
11220 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11221 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11222 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11225 "addi %0,%1,%2@tprel")
11227 (define_insn "tls_tprel_ha_<TLSmode:tls_abi_suffix>"
11228 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11229 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11230 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11231 UNSPEC_TLSTPRELHA))]
11233 "addis %0,%1,%2@tprel@ha")
11235 (define_insn "tls_tprel_lo_<TLSmode:tls_abi_suffix>"
11236 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11237 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11238 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11239 UNSPEC_TLSTPRELLO))]
11241 "addi %0,%1,%2@tprel@l")
11243 ;; "b" output constraint here and on tls_tls input to support linker tls
11244 ;; optimization. The linker may edit the instructions emitted by a
11245 ;; tls_got_tprel/tls_tls pair to addis,addi.
11246 (define_insn "tls_got_tprel_<TLSmode:tls_abi_suffix>"
11247 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11248 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11249 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11250 UNSPEC_TLSGOTTPREL))]
11252 "l<TLSmode:tls_insn_suffix> %0,%2@got@tprel(%1)")
11254 (define_insn "tls_tls_<TLSmode:tls_abi_suffix>"
11255 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11256 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11257 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11260 "add %0,%1,%2@tls")
11263 ;; Next come insns related to the calling sequence.
11265 ;; First, an insn to allocate new stack space for dynamic use (e.g., alloca).
11266 ;; We move the back-chain and decrement the stack pointer.
11268 (define_expand "allocate_stack"
11269 [(set (match_operand 0 "gpc_reg_operand" "")
11270 (minus (reg 1) (match_operand 1 "reg_or_short_operand" "")))
11272 (minus (reg 1) (match_dup 1)))]
11275 { rtx chain = gen_reg_rtx (Pmode);
11276 rtx stack_bot = gen_rtx_MEM (Pmode, stack_pointer_rtx);
11278 rtx insn, par, set, mem;
11280 emit_move_insn (chain, stack_bot);
11282 /* Check stack bounds if necessary. */
11283 if (crtl->limit_stack)
11286 available = expand_binop (Pmode, sub_optab,
11287 stack_pointer_rtx, stack_limit_rtx,
11288 NULL_RTX, 1, OPTAB_WIDEN);
11289 emit_insn (gen_cond_trap (LTU, available, operands[1], const0_rtx));
11292 if (GET_CODE (operands[1]) != CONST_INT
11293 || INTVAL (operands[1]) < -32767
11294 || INTVAL (operands[1]) > 32768)
11296 neg_op0 = gen_reg_rtx (Pmode);
11298 emit_insn (gen_negsi2 (neg_op0, operands[1]));
11300 emit_insn (gen_negdi2 (neg_op0, operands[1]));
11303 neg_op0 = GEN_INT (- INTVAL (operands[1]));
11305 insn = emit_insn ((* ((TARGET_32BIT) ? gen_movsi_update_stack
11306 : gen_movdi_di_update_stack))
11307 (stack_pointer_rtx, stack_pointer_rtx, neg_op0,
11309 /* Since we didn't use gen_frame_mem to generate the MEM, grab
11310 it now and set the alias set/attributes. The above gen_*_update
11311 calls will generate a PARALLEL with the MEM set being the first
11313 par = PATTERN (insn);
11314 gcc_assert (GET_CODE (par) == PARALLEL);
11315 set = XVECEXP (par, 0, 0);
11316 gcc_assert (GET_CODE (set) == SET);
11317 mem = SET_DEST (set);
11318 gcc_assert (MEM_P (mem));
11319 MEM_NOTRAP_P (mem) = 1;
11320 set_mem_alias_set (mem, get_frame_alias_set ());
11322 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
11326 ;; These patterns say how to save and restore the stack pointer. We need not
11327 ;; save the stack pointer at function level since we are careful to
11328 ;; preserve the backchain. At block level, we have to restore the backchain
11329 ;; when we restore the stack pointer.
11331 ;; For nonlocal gotos, we must save both the stack pointer and its
11332 ;; backchain and restore both. Note that in the nonlocal case, the
11333 ;; save area is a memory location.
11335 (define_expand "save_stack_function"
11336 [(match_operand 0 "any_operand" "")
11337 (match_operand 1 "any_operand" "")]
11341 (define_expand "restore_stack_function"
11342 [(match_operand 0 "any_operand" "")
11343 (match_operand 1 "any_operand" "")]
11347 ;; Adjust stack pointer (op0) to a new value (op1).
11348 ;; First copy old stack backchain to new location, and ensure that the
11349 ;; scheduler won't reorder the sp assignment before the backchain write.
11350 (define_expand "restore_stack_block"
11351 [(set (match_dup 2) (match_dup 3))
11352 (set (match_dup 4) (match_dup 2))
11353 (set (match_dup 5) (unspec:BLK [(match_dup 5)] UNSPEC_TIE))
11354 (set (match_operand 0 "register_operand" "")
11355 (match_operand 1 "register_operand" ""))]
11359 operands[1] = force_reg (Pmode, operands[1]);
11360 operands[2] = gen_reg_rtx (Pmode);
11361 operands[3] = gen_frame_mem (Pmode, operands[0]);
11362 operands[4] = gen_frame_mem (Pmode, operands[1]);
11363 operands[5] = gen_frame_mem (BLKmode, operands[0]);
11366 (define_expand "save_stack_nonlocal"
11367 [(set (match_dup 3) (match_dup 4))
11368 (set (match_operand 0 "memory_operand" "") (match_dup 3))
11369 (set (match_dup 2) (match_operand 1 "register_operand" ""))]
11373 int units_per_word = (TARGET_32BIT) ? 4 : 8;
11375 /* Copy the backchain to the first word, sp to the second. */
11376 operands[0] = adjust_address_nv (operands[0], Pmode, 0);
11377 operands[2] = adjust_address_nv (operands[0], Pmode, units_per_word);
11378 operands[3] = gen_reg_rtx (Pmode);
11379 operands[4] = gen_frame_mem (Pmode, operands[1]);
11382 (define_expand "restore_stack_nonlocal"
11383 [(set (match_dup 2) (match_operand 1 "memory_operand" ""))
11384 (set (match_dup 3) (match_dup 4))
11385 (set (match_dup 5) (match_dup 2))
11386 (set (match_dup 6) (unspec:BLK [(match_dup 6)] UNSPEC_TIE))
11387 (set (match_operand 0 "register_operand" "") (match_dup 3))]
11391 int units_per_word = (TARGET_32BIT) ? 4 : 8;
11393 /* Restore the backchain from the first word, sp from the second. */
11394 operands[2] = gen_reg_rtx (Pmode);
11395 operands[3] = gen_reg_rtx (Pmode);
11396 operands[1] = adjust_address_nv (operands[1], Pmode, 0);
11397 operands[4] = adjust_address_nv (operands[1], Pmode, units_per_word);
11398 operands[5] = gen_frame_mem (Pmode, operands[3]);
11399 operands[6] = gen_frame_mem (BLKmode, operands[0]);
11402 ;; TOC register handling.
11404 ;; Code to initialize the TOC register...
11406 (define_insn "load_toc_aix_si"
11407 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11408 (unspec:SI [(const_int 0)] UNSPEC_TOC))
11409 (use (reg:SI 2))])]
11410 "DEFAULT_ABI == ABI_AIX && TARGET_32BIT"
11414 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
11415 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
11416 operands[2] = gen_rtx_REG (Pmode, 2);
11417 return \"{l|lwz} %0,%1(%2)\";
11419 [(set_attr "type" "load")])
11421 (define_insn "load_toc_aix_di"
11422 [(parallel [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11423 (unspec:DI [(const_int 0)] UNSPEC_TOC))
11424 (use (reg:DI 2))])]
11425 "DEFAULT_ABI == ABI_AIX && TARGET_64BIT"
11429 #ifdef TARGET_RELOCATABLE
11430 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\",
11431 !TARGET_MINIMAL_TOC || TARGET_RELOCATABLE);
11433 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
11436 strcat (buf, \"@toc\");
11437 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
11438 operands[2] = gen_rtx_REG (Pmode, 2);
11439 return \"ld %0,%1(%2)\";
11441 [(set_attr "type" "load")])
11443 (define_insn "load_toc_v4_pic_si"
11444 [(set (reg:SI LR_REGNO)
11445 (unspec:SI [(const_int 0)] UNSPEC_TOC))]
11446 "DEFAULT_ABI == ABI_V4 && flag_pic == 1 && TARGET_32BIT"
11447 "bl _GLOBAL_OFFSET_TABLE_@local-4"
11448 [(set_attr "type" "branch")
11449 (set_attr "length" "4")])
11451 (define_insn "load_toc_v4_PIC_1"
11452 [(set (reg:SI LR_REGNO)
11453 (match_operand:SI 0 "immediate_operand" "s"))
11454 (use (unspec [(match_dup 0)] UNSPEC_TOC))]
11455 "TARGET_ELF && DEFAULT_ABI != ABI_AIX
11456 && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
11457 "bcl 20,31,%0\\n%0:"
11458 [(set_attr "type" "branch")
11459 (set_attr "length" "4")])
11461 (define_insn "load_toc_v4_PIC_1b"
11462 [(set (reg:SI LR_REGNO)
11463 (unspec:SI [(match_operand:SI 0 "immediate_operand" "s")
11464 (label_ref (match_operand 1 "" ""))]
11467 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
11468 "bcl 20,31,$+8\;.long %0-$"
11469 [(set_attr "type" "branch")
11470 (set_attr "length" "8")])
11472 (define_insn "load_toc_v4_PIC_2"
11473 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11474 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
11475 (minus:SI (match_operand:SI 2 "immediate_operand" "s")
11476 (match_operand:SI 3 "immediate_operand" "s")))))]
11477 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
11478 "{l|lwz} %0,%2-%3(%1)"
11479 [(set_attr "type" "load")])
11481 (define_insn "load_toc_v4_PIC_3b"
11482 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
11483 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "r")
11485 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
11486 (match_operand:SI 3 "symbol_ref_operand" "s")))))]
11487 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
11488 "{cau|addis} %0,%1,%2-%3@ha")
11490 (define_insn "load_toc_v4_PIC_3c"
11491 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11492 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
11493 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
11494 (match_operand:SI 3 "symbol_ref_operand" "s"))))]
11495 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
11496 "{cal %0,%2-%3@l(%1)|addi %0,%1,%2-%3@l}")
11498 ;; If the TOC is shared over a translation unit, as happens with all
11499 ;; the kinds of PIC that we support, we need to restore the TOC
11500 ;; pointer only when jumping over units of translation.
11501 ;; On Darwin, we need to reload the picbase.
11503 (define_expand "builtin_setjmp_receiver"
11504 [(use (label_ref (match_operand 0 "" "")))]
11505 "(DEFAULT_ABI == ABI_V4 && flag_pic == 1)
11506 || (TARGET_TOC && TARGET_MINIMAL_TOC)
11507 || (DEFAULT_ABI == ABI_DARWIN && flag_pic)"
11511 if (DEFAULT_ABI == ABI_DARWIN)
11513 rtx picrtx = gen_rtx_SYMBOL_REF (Pmode, MACHOPIC_FUNCTION_BASE_NAME);
11514 rtx picreg = gen_rtx_REG (Pmode, RS6000_PIC_OFFSET_TABLE_REGNUM);
11518 crtl->uses_pic_offset_table = 1;
11519 ASM_GENERATE_INTERNAL_LABEL(tmplab, \"LSJR\",
11520 CODE_LABEL_NUMBER (operands[0]));
11521 tmplabrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (tmplab));
11523 emit_insn (gen_load_macho_picbase (tmplabrtx));
11524 emit_move_insn (picreg, gen_rtx_REG (Pmode, LR_REGNO));
11525 emit_insn (gen_macho_correct_pic (picreg, picreg, picrtx, tmplabrtx));
11529 rs6000_emit_load_toc_table (FALSE);
11533 ;; Elf specific ways of loading addresses for non-PIC code.
11534 ;; The output of this could be r0, but we make a very strong
11535 ;; preference for a base register because it will usually
11536 ;; be needed there.
11537 (define_insn "elf_high"
11538 [(set (match_operand:SI 0 "gpc_reg_operand" "=b*r")
11539 (high:SI (match_operand 1 "" "")))]
11540 "TARGET_ELF && ! TARGET_64BIT"
11541 "{liu|lis} %0,%1@ha")
11543 (define_insn "elf_low"
11544 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11545 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,!*r")
11546 (match_operand 2 "" "")))]
11547 "TARGET_ELF && ! TARGET_64BIT"
11549 {cal|la} %0,%2@l(%1)
11550 {ai|addic} %0,%1,%K2")
11552 ;; A function pointer under AIX is a pointer to a data area whose first word
11553 ;; contains the actual address of the function, whose second word contains a
11554 ;; pointer to its TOC, and whose third word contains a value to place in the
11555 ;; static chain register (r11). Note that if we load the static chain, our
11556 ;; "trampoline" need not have any executable code.
11558 (define_expand "call_indirect_aix32"
11559 [(set (match_dup 2)
11560 (mem:SI (match_operand:SI 0 "gpc_reg_operand" "")))
11561 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
11564 (mem:SI (plus:SI (match_dup 0)
11566 (parallel [(call (mem:SI (match_dup 2))
11567 (match_operand 1 "" ""))
11568 (use (mem:SI (plus:SI (match_dup 0) (const_int 4))))
11570 (use (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
11571 (clobber (reg:SI LR_REGNO))])]
11574 { operands[2] = gen_reg_rtx (SImode); }")
11576 (define_expand "call_indirect_aix64"
11577 [(set (match_dup 2)
11578 (mem:DI (match_operand:DI 0 "gpc_reg_operand" "")))
11579 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
11582 (mem:DI (plus:DI (match_dup 0)
11584 (parallel [(call (mem:SI (match_dup 2))
11585 (match_operand 1 "" ""))
11586 (use (mem:DI (plus:DI (match_dup 0) (const_int 8))))
11588 (use (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
11589 (clobber (reg:SI LR_REGNO))])]
11592 { operands[2] = gen_reg_rtx (DImode); }")
11594 (define_expand "call_value_indirect_aix32"
11595 [(set (match_dup 3)
11596 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "")))
11597 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
11600 (mem:SI (plus:SI (match_dup 1)
11602 (parallel [(set (match_operand 0 "" "")
11603 (call (mem:SI (match_dup 3))
11604 (match_operand 2 "" "")))
11605 (use (mem:SI (plus:SI (match_dup 1) (const_int 4))))
11607 (use (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
11608 (clobber (reg:SI LR_REGNO))])]
11611 { operands[3] = gen_reg_rtx (SImode); }")
11613 (define_expand "call_value_indirect_aix64"
11614 [(set (match_dup 3)
11615 (mem:DI (match_operand:DI 1 "gpc_reg_operand" "")))
11616 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
11619 (mem:DI (plus:DI (match_dup 1)
11621 (parallel [(set (match_operand 0 "" "")
11622 (call (mem:SI (match_dup 3))
11623 (match_operand 2 "" "")))
11624 (use (mem:DI (plus:DI (match_dup 1) (const_int 8))))
11626 (use (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
11627 (clobber (reg:SI LR_REGNO))])]
11630 { operands[3] = gen_reg_rtx (DImode); }")
11632 ;; Now the definitions for the call and call_value insns
11633 (define_expand "call"
11634 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
11635 (match_operand 1 "" ""))
11636 (use (match_operand 2 "" ""))
11637 (clobber (reg:SI LR_REGNO))])]
11642 if (MACHOPIC_INDIRECT)
11643 operands[0] = machopic_indirect_call_target (operands[0]);
11646 gcc_assert (GET_CODE (operands[0]) == MEM);
11647 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
11649 operands[0] = XEXP (operands[0], 0);
11651 if (GET_CODE (operands[0]) != SYMBOL_REF
11652 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[0]))
11653 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[2]) & CALL_LONG) != 0))
11655 if (INTVAL (operands[2]) & CALL_LONG)
11656 operands[0] = rs6000_longcall_ref (operands[0]);
11658 switch (DEFAULT_ABI)
11662 operands[0] = force_reg (Pmode, operands[0]);
11666 /* AIX function pointers are really pointers to a three word
11668 emit_call_insn (TARGET_32BIT
11669 ? gen_call_indirect_aix32 (force_reg (SImode,
11672 : gen_call_indirect_aix64 (force_reg (DImode,
11678 gcc_unreachable ();
11683 (define_expand "call_value"
11684 [(parallel [(set (match_operand 0 "" "")
11685 (call (mem:SI (match_operand 1 "address_operand" ""))
11686 (match_operand 2 "" "")))
11687 (use (match_operand 3 "" ""))
11688 (clobber (reg:SI LR_REGNO))])]
11693 if (MACHOPIC_INDIRECT)
11694 operands[1] = machopic_indirect_call_target (operands[1]);
11697 gcc_assert (GET_CODE (operands[1]) == MEM);
11698 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
11700 operands[1] = XEXP (operands[1], 0);
11702 if (GET_CODE (operands[1]) != SYMBOL_REF
11703 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[1]))
11704 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[3]) & CALL_LONG) != 0))
11706 if (INTVAL (operands[3]) & CALL_LONG)
11707 operands[1] = rs6000_longcall_ref (operands[1]);
11709 switch (DEFAULT_ABI)
11713 operands[1] = force_reg (Pmode, operands[1]);
11717 /* AIX function pointers are really pointers to a three word
11719 emit_call_insn (TARGET_32BIT
11720 ? gen_call_value_indirect_aix32 (operands[0],
11724 : gen_call_value_indirect_aix64 (operands[0],
11731 gcc_unreachable ();
11736 ;; Call to function in current module. No TOC pointer reload needed.
11737 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
11738 ;; either the function was not prototyped, or it was prototyped as a
11739 ;; variable argument function. It is > 0 if FP registers were passed
11740 ;; and < 0 if they were not.
11742 (define_insn "*call_local32"
11743 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
11744 (match_operand 1 "" "g,g"))
11745 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11746 (clobber (reg:SI LR_REGNO))]
11747 "(INTVAL (operands[2]) & CALL_LONG) == 0"
11750 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11751 output_asm_insn (\"crxor 6,6,6\", operands);
11753 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11754 output_asm_insn (\"creqv 6,6,6\", operands);
11756 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
11758 [(set_attr "type" "branch")
11759 (set_attr "length" "4,8")])
11761 (define_insn "*call_local64"
11762 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
11763 (match_operand 1 "" "g,g"))
11764 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11765 (clobber (reg:SI LR_REGNO))]
11766 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
11769 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11770 output_asm_insn (\"crxor 6,6,6\", operands);
11772 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11773 output_asm_insn (\"creqv 6,6,6\", operands);
11775 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
11777 [(set_attr "type" "branch")
11778 (set_attr "length" "4,8")])
11780 (define_insn "*call_value_local32"
11781 [(set (match_operand 0 "" "")
11782 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
11783 (match_operand 2 "" "g,g")))
11784 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11785 (clobber (reg:SI LR_REGNO))]
11786 "(INTVAL (operands[3]) & CALL_LONG) == 0"
11789 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11790 output_asm_insn (\"crxor 6,6,6\", operands);
11792 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11793 output_asm_insn (\"creqv 6,6,6\", operands);
11795 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
11797 [(set_attr "type" "branch")
11798 (set_attr "length" "4,8")])
11801 (define_insn "*call_value_local64"
11802 [(set (match_operand 0 "" "")
11803 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
11804 (match_operand 2 "" "g,g")))
11805 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11806 (clobber (reg:SI LR_REGNO))]
11807 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
11810 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11811 output_asm_insn (\"crxor 6,6,6\", operands);
11813 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11814 output_asm_insn (\"creqv 6,6,6\", operands);
11816 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
11818 [(set_attr "type" "branch")
11819 (set_attr "length" "4,8")])
11821 ;; Call to function which may be in another module. Restore the TOC
11822 ;; pointer (r2) after the call unless this is System V.
11823 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
11824 ;; either the function was not prototyped, or it was prototyped as a
11825 ;; variable argument function. It is > 0 if FP registers were passed
11826 ;; and < 0 if they were not.
11828 (define_insn_and_split "*call_indirect_nonlocal_aix32_internal"
11829 [(call (mem:SI (match_operand:SI 0 "register_operand" "c,*l"))
11830 (match_operand 1 "" "g,g"))
11831 (use (mem:SI (plus:SI (match_operand:SI 2 "register_operand" "b,b") (const_int 4))))
11833 (use (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
11834 (clobber (reg:SI LR_REGNO))]
11835 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
11837 "&& reload_completed"
11839 (mem:SI (plus:SI (match_dup 2) (const_int 4))))
11840 (parallel [(call (mem:SI (match_dup 0))
11845 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
11846 (clobber (reg:SI LR_REGNO))])]
11848 [(set_attr "type" "jmpreg")
11849 (set_attr "length" "12")])
11851 (define_insn "*call_indirect_nonlocal_aix32"
11852 [(call (mem:SI (match_operand:SI 0 "register_operand" "c,*l"))
11853 (match_operand 1 "" "g,g"))
11857 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
11858 (clobber (reg:SI LR_REGNO))]
11859 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX && reload_completed"
11860 "b%T0l\;{l|lwz} 2,20(1)"
11861 [(set_attr "type" "jmpreg")
11862 (set_attr "length" "8")])
11864 (define_insn "*call_nonlocal_aix32"
11865 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
11866 (match_operand 1 "" "g"))
11867 (use (match_operand:SI 2 "immediate_operand" "O"))
11868 (clobber (reg:SI LR_REGNO))]
11870 && DEFAULT_ABI == ABI_AIX
11871 && (INTVAL (operands[2]) & CALL_LONG) == 0"
11873 [(set_attr "type" "branch")
11874 (set_attr "length" "8")])
11876 (define_insn_and_split "*call_indirect_nonlocal_aix64_internal"
11877 [(call (mem:SI (match_operand:DI 0 "register_operand" "c,*l"))
11878 (match_operand 1 "" "g,g"))
11879 (use (mem:DI (plus:DI (match_operand:DI 2 "register_operand" "b,b")
11882 (use (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
11883 (clobber (reg:SI LR_REGNO))]
11884 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
11886 "&& reload_completed"
11888 (mem:DI (plus:DI (match_dup 2) (const_int 8))))
11889 (parallel [(call (mem:SI (match_dup 0))
11894 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
11895 (clobber (reg:SI LR_REGNO))])]
11897 [(set_attr "type" "jmpreg")
11898 (set_attr "length" "12")])
11900 (define_insn "*call_indirect_nonlocal_aix64"
11901 [(call (mem:SI (match_operand:DI 0 "register_operand" "c,*l"))
11902 (match_operand 1 "" "g,g"))
11906 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
11907 (clobber (reg:SI LR_REGNO))]
11908 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX && reload_completed"
11909 "b%T0l\;ld 2,40(1)"
11910 [(set_attr "type" "jmpreg")
11911 (set_attr "length" "8")])
11913 (define_insn "*call_nonlocal_aix64"
11914 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
11915 (match_operand 1 "" "g"))
11916 (use (match_operand:SI 2 "immediate_operand" "O"))
11917 (clobber (reg:SI LR_REGNO))]
11919 && DEFAULT_ABI == ABI_AIX
11920 && (INTVAL (operands[2]) & CALL_LONG) == 0"
11922 [(set_attr "type" "branch")
11923 (set_attr "length" "8")])
11925 (define_insn_and_split "*call_value_indirect_nonlocal_aix32_internal"
11926 [(set (match_operand 0 "" "")
11927 (call (mem:SI (match_operand:SI 1 "register_operand" "c,*l"))
11928 (match_operand 2 "" "g,g")))
11929 (use (mem:SI (plus:SI (match_operand:SI 3 "register_operand" "b,b")
11932 (use (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
11933 (clobber (reg:SI LR_REGNO))]
11934 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
11936 "&& reload_completed"
11938 (mem:SI (plus:SI (match_dup 3) (const_int 4))))
11939 (parallel [(set (match_dup 0) (call (mem:SI (match_dup 1))
11944 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
11945 (clobber (reg:SI LR_REGNO))])]
11947 [(set_attr "type" "jmpreg")
11948 (set_attr "length" "12")])
11950 (define_insn "*call_value_indirect_nonlocal_aix32"
11951 [(set (match_operand 0 "" "")
11952 (call (mem:SI (match_operand:SI 1 "register_operand" "c,*l"))
11953 (match_operand 2 "" "g,g")))
11957 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
11958 (clobber (reg:SI LR_REGNO))]
11959 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX && reload_completed"
11960 "b%T1l\;{l|lwz} 2,20(1)"
11961 [(set_attr "type" "jmpreg")
11962 (set_attr "length" "8")])
11964 (define_insn "*call_value_nonlocal_aix32"
11965 [(set (match_operand 0 "" "")
11966 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
11967 (match_operand 2 "" "g")))
11968 (use (match_operand:SI 3 "immediate_operand" "O"))
11969 (clobber (reg:SI LR_REGNO))]
11971 && DEFAULT_ABI == ABI_AIX
11972 && (INTVAL (operands[3]) & CALL_LONG) == 0"
11974 [(set_attr "type" "branch")
11975 (set_attr "length" "8")])
11977 (define_insn_and_split "*call_value_indirect_nonlocal_aix64_internal"
11978 [(set (match_operand 0 "" "")
11979 (call (mem:SI (match_operand:DI 1 "register_operand" "c,*l"))
11980 (match_operand 2 "" "g,g")))
11981 (use (mem:DI (plus:DI (match_operand:DI 3 "register_operand" "b,b")
11984 (use (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
11985 (clobber (reg:SI LR_REGNO))]
11986 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
11988 "&& reload_completed"
11990 (mem:DI (plus:DI (match_dup 3) (const_int 8))))
11991 (parallel [(set (match_dup 0) (call (mem:SI (match_dup 1))
11996 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
11997 (clobber (reg:SI LR_REGNO))])]
11999 [(set_attr "type" "jmpreg")
12000 (set_attr "length" "12")])
12002 (define_insn "*call_value_indirect_nonlocal_aix64"
12003 [(set (match_operand 0 "" "")
12004 (call (mem:SI (match_operand:DI 1 "register_operand" "c,*l"))
12005 (match_operand 2 "" "g,g")))
12009 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
12010 (clobber (reg:SI LR_REGNO))]
12011 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX && reload_completed"
12012 "b%T1l\;ld 2,40(1)"
12013 [(set_attr "type" "jmpreg")
12014 (set_attr "length" "8")])
12016 (define_insn "*call_value_nonlocal_aix64"
12017 [(set (match_operand 0 "" "")
12018 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
12019 (match_operand 2 "" "g")))
12020 (use (match_operand:SI 3 "immediate_operand" "O"))
12021 (clobber (reg:SI LR_REGNO))]
12023 && DEFAULT_ABI == ABI_AIX
12024 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12026 [(set_attr "type" "branch")
12027 (set_attr "length" "8")])
12029 ;; A function pointer under System V is just a normal pointer
12030 ;; operands[0] is the function pointer
12031 ;; operands[1] is the stack size to clean up
12032 ;; operands[2] is the value FUNCTION_ARG returns for the VOID argument
12033 ;; which indicates how to set cr1
12035 (define_insn "*call_indirect_nonlocal_sysv<mode>"
12036 [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l,c,*l"))
12037 (match_operand 1 "" "g,g,g,g"))
12038 (use (match_operand:SI 2 "immediate_operand" "O,O,n,n"))
12039 (clobber (reg:SI LR_REGNO))]
12040 "DEFAULT_ABI == ABI_V4
12041 || DEFAULT_ABI == ABI_DARWIN"
12043 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12044 output_asm_insn ("crxor 6,6,6", operands);
12046 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12047 output_asm_insn ("creqv 6,6,6", operands);
12051 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
12052 (set_attr "length" "4,4,8,8")])
12054 (define_insn_and_split "*call_nonlocal_sysv<mode>"
12055 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
12056 (match_operand 1 "" "g,g"))
12057 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12058 (clobber (reg:SI LR_REGNO))]
12059 "(DEFAULT_ABI == ABI_DARWIN
12060 || (DEFAULT_ABI == ABI_V4
12061 && (INTVAL (operands[2]) & CALL_LONG) == 0))"
12063 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12064 output_asm_insn ("crxor 6,6,6", operands);
12066 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12067 output_asm_insn ("creqv 6,6,6", operands);
12070 return output_call(insn, operands, 0, 2);
12072 if (DEFAULT_ABI == ABI_V4 && flag_pic)
12074 gcc_assert (!TARGET_SECURE_PLT);
12075 return "bl %z0@plt";
12081 "DEFAULT_ABI == ABI_V4
12082 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[0])
12083 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12084 [(parallel [(call (mem:SI (match_dup 0))
12086 (use (match_dup 2))
12087 (use (match_dup 3))
12088 (clobber (reg:SI LR_REGNO))])]
12090 operands[3] = pic_offset_table_rtx;
12092 [(set_attr "type" "branch,branch")
12093 (set_attr "length" "4,8")])
12095 (define_insn "*call_nonlocal_sysv_secure<mode>"
12096 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
12097 (match_operand 1 "" "g,g"))
12098 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12099 (use (match_operand:SI 3 "register_operand" "r,r"))
12100 (clobber (reg:SI LR_REGNO))]
12101 "(DEFAULT_ABI == ABI_V4
12102 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[0])
12103 && (INTVAL (operands[2]) & CALL_LONG) == 0)"
12105 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12106 output_asm_insn ("crxor 6,6,6", operands);
12108 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12109 output_asm_insn ("creqv 6,6,6", operands);
12112 /* The magic 32768 offset here and in the other sysv call insns
12113 corresponds to the offset of r30 in .got2, as given by LCTOC1.
12114 See sysv4.h:toc_section. */
12115 return "bl %z0+32768@plt";
12117 return "bl %z0@plt";
12119 [(set_attr "type" "branch,branch")
12120 (set_attr "length" "4,8")])
12122 (define_insn "*call_value_indirect_nonlocal_sysv<mode>"
12123 [(set (match_operand 0 "" "")
12124 (call (mem:SI (match_operand:P 1 "register_operand" "c,*l,c,*l"))
12125 (match_operand 2 "" "g,g,g,g")))
12126 (use (match_operand:SI 3 "immediate_operand" "O,O,n,n"))
12127 (clobber (reg:SI LR_REGNO))]
12128 "DEFAULT_ABI == ABI_V4
12129 || DEFAULT_ABI == ABI_DARWIN"
12131 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12132 output_asm_insn ("crxor 6,6,6", operands);
12134 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12135 output_asm_insn ("creqv 6,6,6", operands);
12139 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
12140 (set_attr "length" "4,4,8,8")])
12142 (define_insn_and_split "*call_value_nonlocal_sysv<mode>"
12143 [(set (match_operand 0 "" "")
12144 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
12145 (match_operand 2 "" "g,g")))
12146 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12147 (clobber (reg:SI LR_REGNO))]
12148 "(DEFAULT_ABI == ABI_DARWIN
12149 || (DEFAULT_ABI == ABI_V4
12150 && (INTVAL (operands[3]) & CALL_LONG) == 0))"
12152 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12153 output_asm_insn ("crxor 6,6,6", operands);
12155 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12156 output_asm_insn ("creqv 6,6,6", operands);
12159 return output_call(insn, operands, 1, 3);
12161 if (DEFAULT_ABI == ABI_V4 && flag_pic)
12163 gcc_assert (!TARGET_SECURE_PLT);
12164 return "bl %z1@plt";
12170 "DEFAULT_ABI == ABI_V4
12171 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[1])
12172 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12173 [(parallel [(set (match_dup 0)
12174 (call (mem:SI (match_dup 1))
12176 (use (match_dup 3))
12177 (use (match_dup 4))
12178 (clobber (reg:SI LR_REGNO))])]
12180 operands[4] = pic_offset_table_rtx;
12182 [(set_attr "type" "branch,branch")
12183 (set_attr "length" "4,8")])
12185 (define_insn "*call_value_nonlocal_sysv_secure<mode>"
12186 [(set (match_operand 0 "" "")
12187 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
12188 (match_operand 2 "" "g,g")))
12189 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12190 (use (match_operand:SI 4 "register_operand" "r,r"))
12191 (clobber (reg:SI LR_REGNO))]
12192 "(DEFAULT_ABI == ABI_V4
12193 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[1])
12194 && (INTVAL (operands[3]) & CALL_LONG) == 0)"
12196 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12197 output_asm_insn ("crxor 6,6,6", operands);
12199 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12200 output_asm_insn ("creqv 6,6,6", operands);
12203 return "bl %z1+32768@plt";
12205 return "bl %z1@plt";
12207 [(set_attr "type" "branch,branch")
12208 (set_attr "length" "4,8")])
12210 ;; Call subroutine returning any type.
12211 (define_expand "untyped_call"
12212 [(parallel [(call (match_operand 0 "" "")
12214 (match_operand 1 "" "")
12215 (match_operand 2 "" "")])]
12221 emit_call_insn (GEN_CALL (operands[0], const0_rtx, const0_rtx, const0_rtx));
12223 for (i = 0; i < XVECLEN (operands[2], 0); i++)
12225 rtx set = XVECEXP (operands[2], 0, i);
12226 emit_move_insn (SET_DEST (set), SET_SRC (set));
12229 /* The optimizer does not know that the call sets the function value
12230 registers we stored in the result block. We avoid problems by
12231 claiming that all hard registers are used and clobbered at this
12233 emit_insn (gen_blockage ());
12238 ;; sibling call patterns
12239 (define_expand "sibcall"
12240 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
12241 (match_operand 1 "" ""))
12242 (use (match_operand 2 "" ""))
12243 (use (reg:SI LR_REGNO))
12249 if (MACHOPIC_INDIRECT)
12250 operands[0] = machopic_indirect_call_target (operands[0]);
12253 gcc_assert (GET_CODE (operands[0]) == MEM);
12254 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
12256 operands[0] = XEXP (operands[0], 0);
12259 ;; this and similar patterns must be marked as using LR, otherwise
12260 ;; dataflow will try to delete the store into it. This is true
12261 ;; even when the actual reg to jump to is in CTR, when LR was
12262 ;; saved and restored around the PIC-setting BCL.
12263 (define_insn "*sibcall_local32"
12264 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
12265 (match_operand 1 "" "g,g"))
12266 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12267 (use (reg:SI LR_REGNO))
12269 "(INTVAL (operands[2]) & CALL_LONG) == 0"
12272 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12273 output_asm_insn (\"crxor 6,6,6\", operands);
12275 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12276 output_asm_insn (\"creqv 6,6,6\", operands);
12278 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
12280 [(set_attr "type" "branch")
12281 (set_attr "length" "4,8")])
12283 (define_insn "*sibcall_local64"
12284 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
12285 (match_operand 1 "" "g,g"))
12286 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12287 (use (reg:SI LR_REGNO))
12289 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
12292 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12293 output_asm_insn (\"crxor 6,6,6\", operands);
12295 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12296 output_asm_insn (\"creqv 6,6,6\", operands);
12298 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
12300 [(set_attr "type" "branch")
12301 (set_attr "length" "4,8")])
12303 (define_insn "*sibcall_value_local32"
12304 [(set (match_operand 0 "" "")
12305 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
12306 (match_operand 2 "" "g,g")))
12307 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12308 (use (reg:SI LR_REGNO))
12310 "(INTVAL (operands[3]) & CALL_LONG) == 0"
12313 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12314 output_asm_insn (\"crxor 6,6,6\", operands);
12316 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12317 output_asm_insn (\"creqv 6,6,6\", operands);
12319 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
12321 [(set_attr "type" "branch")
12322 (set_attr "length" "4,8")])
12325 (define_insn "*sibcall_value_local64"
12326 [(set (match_operand 0 "" "")
12327 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
12328 (match_operand 2 "" "g,g")))
12329 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12330 (use (reg:SI LR_REGNO))
12332 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
12335 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12336 output_asm_insn (\"crxor 6,6,6\", operands);
12338 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12339 output_asm_insn (\"creqv 6,6,6\", operands);
12341 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
12343 [(set_attr "type" "branch")
12344 (set_attr "length" "4,8")])
12346 (define_insn "*sibcall_nonlocal_aix32"
12347 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
12348 (match_operand 1 "" "g"))
12349 (use (match_operand:SI 2 "immediate_operand" "O"))
12350 (use (reg:SI LR_REGNO))
12353 && DEFAULT_ABI == ABI_AIX
12354 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12356 [(set_attr "type" "branch")
12357 (set_attr "length" "4")])
12359 (define_insn "*sibcall_nonlocal_aix64"
12360 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
12361 (match_operand 1 "" "g"))
12362 (use (match_operand:SI 2 "immediate_operand" "O"))
12363 (use (reg:SI LR_REGNO))
12366 && DEFAULT_ABI == ABI_AIX
12367 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12369 [(set_attr "type" "branch")
12370 (set_attr "length" "4")])
12372 (define_insn "*sibcall_value_nonlocal_aix32"
12373 [(set (match_operand 0 "" "")
12374 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
12375 (match_operand 2 "" "g")))
12376 (use (match_operand:SI 3 "immediate_operand" "O"))
12377 (use (reg:SI LR_REGNO))
12380 && DEFAULT_ABI == ABI_AIX
12381 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12383 [(set_attr "type" "branch")
12384 (set_attr "length" "4")])
12386 (define_insn "*sibcall_value_nonlocal_aix64"
12387 [(set (match_operand 0 "" "")
12388 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
12389 (match_operand 2 "" "g")))
12390 (use (match_operand:SI 3 "immediate_operand" "O"))
12391 (use (reg:SI LR_REGNO))
12394 && DEFAULT_ABI == ABI_AIX
12395 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12397 [(set_attr "type" "branch")
12398 (set_attr "length" "4")])
12400 (define_insn "*sibcall_nonlocal_sysv<mode>"
12401 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
12402 (match_operand 1 "" ""))
12403 (use (match_operand 2 "immediate_operand" "O,n"))
12404 (use (reg:SI LR_REGNO))
12406 "(DEFAULT_ABI == ABI_DARWIN
12407 || DEFAULT_ABI == ABI_V4)
12408 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12411 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12412 output_asm_insn (\"crxor 6,6,6\", operands);
12414 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12415 output_asm_insn (\"creqv 6,6,6\", operands);
12417 if (DEFAULT_ABI == ABI_V4 && flag_pic)
12419 gcc_assert (!TARGET_SECURE_PLT);
12420 return \"b %z0@plt\";
12425 [(set_attr "type" "branch,branch")
12426 (set_attr "length" "4,8")])
12428 (define_expand "sibcall_value"
12429 [(parallel [(set (match_operand 0 "register_operand" "")
12430 (call (mem:SI (match_operand 1 "address_operand" ""))
12431 (match_operand 2 "" "")))
12432 (use (match_operand 3 "" ""))
12433 (use (reg:SI LR_REGNO))
12439 if (MACHOPIC_INDIRECT)
12440 operands[1] = machopic_indirect_call_target (operands[1]);
12443 gcc_assert (GET_CODE (operands[1]) == MEM);
12444 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
12446 operands[1] = XEXP (operands[1], 0);
12449 (define_insn "*sibcall_value_nonlocal_sysv<mode>"
12450 [(set (match_operand 0 "" "")
12451 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
12452 (match_operand 2 "" "")))
12453 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12454 (use (reg:SI LR_REGNO))
12456 "(DEFAULT_ABI == ABI_DARWIN
12457 || DEFAULT_ABI == ABI_V4)
12458 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12461 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12462 output_asm_insn (\"crxor 6,6,6\", operands);
12464 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12465 output_asm_insn (\"creqv 6,6,6\", operands);
12467 if (DEFAULT_ABI == ABI_V4 && flag_pic)
12469 gcc_assert (!TARGET_SECURE_PLT);
12470 return \"b %z1@plt\";
12475 [(set_attr "type" "branch,branch")
12476 (set_attr "length" "4,8")])
12478 (define_expand "sibcall_epilogue"
12479 [(use (const_int 0))]
12480 "TARGET_SCHED_PROLOG"
12483 rs6000_emit_epilogue (TRUE);
12487 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
12488 ;; all of memory. This blocks insns from being moved across this point.
12490 (define_insn "blockage"
12491 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCK)]
12495 (define_insn "probe_stack"
12496 [(set (match_operand 0 "memory_operand" "=m")
12497 (unspec [(const_int 0)] UNSPEC_PROBE_STACK))]
12499 "{st%U0%X0|stw%U0%X0} 0,%0"
12500 [(set_attr "type" "store")
12501 (set_attr "length" "4")])
12503 ;; Compare insns are next. Note that the RS/6000 has two types of compares,
12504 ;; signed & unsigned, and one type of branch.
12506 ;; Start with the DEFINE_EXPANDs to generate the rtl for compares, scc
12507 ;; insns, and branches.
12509 (define_expand "cbranch<mode>4"
12510 [(use (match_operator 0 "rs6000_cbranch_operator"
12511 [(match_operand:GPR 1 "gpc_reg_operand" "")
12512 (match_operand:GPR 2 "reg_or_short_operand" "")]))
12513 (use (match_operand 3 ""))]
12517 /* Take care of the possibility that operands[2] might be negative but
12518 this might be a logical operation. That insn doesn't exist. */
12519 if (GET_CODE (operands[2]) == CONST_INT
12520 && INTVAL (operands[2]) < 0)
12522 operands[2] = force_reg (<MODE>mode, operands[2]);
12523 operands[0] = gen_rtx_fmt_ee (GET_CODE (operands[0]),
12524 GET_MODE (operands[0]),
12525 operands[1], operands[2]);
12528 rs6000_emit_cbranch (<MODE>mode, operands);
12532 (define_expand "cbranch<mode>4"
12533 [(use (match_operator 0 "rs6000_cbranch_operator"
12534 [(match_operand:FP 1 "gpc_reg_operand" "")
12535 (match_operand:FP 2 "gpc_reg_operand" "")]))
12536 (use (match_operand 3 ""))]
12540 rs6000_emit_cbranch (<MODE>mode, operands);
12544 (define_expand "cstore<mode>4"
12545 [(use (match_operator 1 "rs6000_cbranch_operator"
12546 [(match_operand:GPR 2 "gpc_reg_operand" "")
12547 (match_operand:GPR 3 "reg_or_short_operand" "")]))
12548 (clobber (match_operand:SI 0 "register_operand"))]
12552 /* Take care of the possibility that operands[3] might be negative but
12553 this might be a logical operation. That insn doesn't exist. */
12554 if (GET_CODE (operands[3]) == CONST_INT
12555 && INTVAL (operands[3]) < 0)
12557 operands[3] = force_reg (<MODE>mode, operands[3]);
12558 operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]),
12559 GET_MODE (operands[1]),
12560 operands[2], operands[3]);
12563 /* For SNE, we would prefer that the xor/abs sequence be used for integers.
12564 For SEQ, likewise, except that comparisons with zero should be done
12565 with an scc insns. However, due to the order that combine see the
12566 resulting insns, we must, in fact, allow SEQ for integers. Fail in
12567 the cases we don't want to handle or are best handled by portable
12569 if (GET_CODE (operands[1]) == NE)
12571 if ((GET_CODE (operands[1]) == LT || GET_CODE (operands[1]) == LE
12572 || GET_CODE (operands[1]) == GT || GET_CODE (operands[1]) == GE)
12573 && operands[3] == const0_rtx)
12575 rs6000_emit_sCOND (<MODE>mode, operands);
12579 (define_expand "cstore<mode>4"
12580 [(use (match_operator 1 "rs6000_cbranch_operator"
12581 [(match_operand:FP 2 "gpc_reg_operand" "")
12582 (match_operand:FP 3 "gpc_reg_operand" "")]))
12583 (clobber (match_operand:SI 0 "register_operand"))]
12587 rs6000_emit_sCOND (<MODE>mode, operands);
12592 (define_expand "stack_protect_set"
12593 [(match_operand 0 "memory_operand" "")
12594 (match_operand 1 "memory_operand" "")]
12597 #ifdef TARGET_THREAD_SSP_OFFSET
12598 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
12599 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
12600 operands[1] = gen_rtx_MEM (Pmode, addr);
12603 emit_insn (gen_stack_protect_setdi (operands[0], operands[1]));
12605 emit_insn (gen_stack_protect_setsi (operands[0], operands[1]));
12609 (define_insn "stack_protect_setsi"
12610 [(set (match_operand:SI 0 "memory_operand" "=m")
12611 (unspec:SI [(match_operand:SI 1 "memory_operand" "m")] UNSPEC_SP_SET))
12612 (set (match_scratch:SI 2 "=&r") (const_int 0))]
12614 "{l%U1%X1|lwz%U1%X1} %2,%1\;{st%U0%X0|stw%U0%X0} %2,%0\;{lil|li} %2,0"
12615 [(set_attr "type" "three")
12616 (set_attr "length" "12")])
12618 (define_insn "stack_protect_setdi"
12619 [(set (match_operand:DI 0 "memory_operand" "=m")
12620 (unspec:DI [(match_operand:DI 1 "memory_operand" "m")] UNSPEC_SP_SET))
12621 (set (match_scratch:DI 2 "=&r") (const_int 0))]
12623 "ld%U1%X1 %2,%1\;std%U0%X0 %2,%0\;{lil|li} %2,0"
12624 [(set_attr "type" "three")
12625 (set_attr "length" "12")])
12627 (define_expand "stack_protect_test"
12628 [(match_operand 0 "memory_operand" "")
12629 (match_operand 1 "memory_operand" "")
12630 (match_operand 2 "" "")]
12633 rtx test, op0, op1;
12634 #ifdef TARGET_THREAD_SSP_OFFSET
12635 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
12636 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
12637 operands[1] = gen_rtx_MEM (Pmode, addr);
12640 op1 = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, operands[1]), UNSPEC_SP_TEST);
12641 test = gen_rtx_EQ (VOIDmode, op0, op1);
12642 emit_jump_insn (gen_cbranchsi4 (test, op0, op1, operands[2]));
12646 (define_insn "stack_protect_testsi"
12647 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
12648 (unspec:CCEQ [(match_operand:SI 1 "memory_operand" "m,m")
12649 (match_operand:SI 2 "memory_operand" "m,m")]
12651 (set (match_scratch:SI 4 "=r,r") (const_int 0))
12652 (clobber (match_scratch:SI 3 "=&r,&r"))]
12655 {l%U1%X1|lwz%U1%X1} %3,%1\;{l%U2%X2|lwz%U2%X2} %4,%2\;xor. %3,%3,%4\;{lil|li} %4,0
12656 {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"
12657 [(set_attr "length" "16,20")])
12659 (define_insn "stack_protect_testdi"
12660 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
12661 (unspec:CCEQ [(match_operand:DI 1 "memory_operand" "m,m")
12662 (match_operand:DI 2 "memory_operand" "m,m")]
12664 (set (match_scratch:DI 4 "=r,r") (const_int 0))
12665 (clobber (match_scratch:DI 3 "=&r,&r"))]
12668 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;xor. %3,%3,%4\;{lil|li} %4,0
12669 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;cmpld %0,%3,%4\;{lil|li} %3,0\;{lil|li} %4,0"
12670 [(set_attr "length" "16,20")])
12673 ;; Here are the actual compare insns.
12674 (define_insn "*cmp<mode>_internal1"
12675 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
12676 (compare:CC (match_operand:GPR 1 "gpc_reg_operand" "r")
12677 (match_operand:GPR 2 "reg_or_short_operand" "rI")))]
12679 "{cmp%I2|cmp<wd>%I2} %0,%1,%2"
12680 [(set_attr "type" "cmp")])
12682 ;; If we are comparing a register for equality with a large constant,
12683 ;; we can do this with an XOR followed by a compare. But this is profitable
12684 ;; only if the large constant is only used for the comparison (and in this
12685 ;; case we already have a register to reuse as scratch).
12687 ;; For 64-bit registers, we could only do so if the constant's bit 15 is clear:
12688 ;; otherwise we'd need to XOR with FFFFFFFF????0000 which is not available.
12691 [(set (match_operand:SI 0 "register_operand")
12692 (match_operand:SI 1 "logical_const_operand" ""))
12693 (set (match_dup 0) (match_operator:SI 3 "boolean_or_operator"
12695 (match_operand:SI 2 "logical_const_operand" "")]))
12696 (set (match_operand:CC 4 "cc_reg_operand" "")
12697 (compare:CC (match_operand:SI 5 "gpc_reg_operand" "")
12700 (if_then_else (match_operator 6 "equality_operator"
12701 [(match_dup 4) (const_int 0)])
12702 (match_operand 7 "" "")
12703 (match_operand 8 "" "")))]
12704 "peep2_reg_dead_p (3, operands[0])
12705 && peep2_reg_dead_p (4, operands[4])"
12706 [(set (match_dup 0) (xor:SI (match_dup 5) (match_dup 9)))
12707 (set (match_dup 4) (compare:CC (match_dup 0) (match_dup 10)))
12708 (set (pc) (if_then_else (match_dup 6) (match_dup 7) (match_dup 8)))]
12711 /* Get the constant we are comparing against, and see what it looks like
12712 when sign-extended from 16 to 32 bits. Then see what constant we could
12713 XOR with SEXTC to get the sign-extended value. */
12714 rtx cnst = simplify_const_binary_operation (GET_CODE (operands[3]),
12716 operands[1], operands[2]);
12717 HOST_WIDE_INT c = INTVAL (cnst);
12718 HOST_WIDE_INT sextc = ((c & 0xffff) ^ 0x8000) - 0x8000;
12719 HOST_WIDE_INT xorv = c ^ sextc;
12721 operands[9] = GEN_INT (xorv);
12722 operands[10] = GEN_INT (sextc);
12725 (define_insn "*cmpsi_internal2"
12726 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
12727 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
12728 (match_operand:SI 2 "reg_or_u_short_operand" "rK")))]
12730 "{cmpl%I2|cmplw%I2} %0,%1,%b2"
12731 [(set_attr "type" "cmp")])
12733 (define_insn "*cmpdi_internal2"
12734 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
12735 (compare:CCUNS (match_operand:DI 1 "gpc_reg_operand" "r")
12736 (match_operand:DI 2 "reg_or_u_short_operand" "rK")))]
12738 "cmpld%I2 %0,%1,%b2"
12739 [(set_attr "type" "cmp")])
12741 ;; The following two insns don't exist as single insns, but if we provide
12742 ;; them, we can swap an add and compare, which will enable us to overlap more
12743 ;; of the required delay between a compare and branch. We generate code for
12744 ;; them by splitting.
12747 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
12748 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
12749 (match_operand:SI 2 "short_cint_operand" "i")))
12750 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
12751 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
12754 [(set_attr "length" "8")])
12757 [(set (match_operand:CCUNS 3 "cc_reg_operand" "=y")
12758 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
12759 (match_operand:SI 2 "u_short_cint_operand" "i")))
12760 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
12761 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
12764 [(set_attr "length" "8")])
12767 [(set (match_operand:CC 3 "cc_reg_operand" "")
12768 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
12769 (match_operand:SI 2 "short_cint_operand" "")))
12770 (set (match_operand:SI 0 "gpc_reg_operand" "")
12771 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
12773 [(set (match_dup 3) (compare:CC (match_dup 1) (match_dup 2)))
12774 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
12777 [(set (match_operand:CCUNS 3 "cc_reg_operand" "")
12778 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "")
12779 (match_operand:SI 2 "u_short_cint_operand" "")))
12780 (set (match_operand:SI 0 "gpc_reg_operand" "")
12781 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
12783 [(set (match_dup 3) (compare:CCUNS (match_dup 1) (match_dup 2)))
12784 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
12786 (define_insn "*cmpsf_internal1"
12787 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
12788 (compare:CCFP (match_operand:SF 1 "gpc_reg_operand" "f")
12789 (match_operand:SF 2 "gpc_reg_operand" "f")))]
12790 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
12792 [(set_attr "type" "fpcompare")])
12794 (define_insn "*cmpdf_internal1"
12795 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
12796 (compare:CCFP (match_operand:DF 1 "gpc_reg_operand" "d")
12797 (match_operand:DF 2 "gpc_reg_operand" "d")))]
12798 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
12799 && !VECTOR_UNIT_VSX_P (DFmode)"
12801 [(set_attr "type" "fpcompare")])
12803 ;; Only need to compare second words if first words equal
12804 (define_insn "*cmptf_internal1"
12805 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
12806 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "d")
12807 (match_operand:TF 2 "gpc_reg_operand" "d")))]
12808 "!TARGET_IEEEQUAD && !TARGET_XL_COMPAT
12809 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LONG_DOUBLE_128"
12810 "fcmpu %0,%1,%2\;bne %0,$+8\;fcmpu %0,%L1,%L2"
12811 [(set_attr "type" "fpcompare")
12812 (set_attr "length" "12")])
12814 (define_insn_and_split "*cmptf_internal2"
12815 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
12816 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "d")
12817 (match_operand:TF 2 "gpc_reg_operand" "d")))
12818 (clobber (match_scratch:DF 3 "=d"))
12819 (clobber (match_scratch:DF 4 "=d"))
12820 (clobber (match_scratch:DF 5 "=d"))
12821 (clobber (match_scratch:DF 6 "=d"))
12822 (clobber (match_scratch:DF 7 "=d"))
12823 (clobber (match_scratch:DF 8 "=d"))
12824 (clobber (match_scratch:DF 9 "=d"))
12825 (clobber (match_scratch:DF 10 "=d"))]
12826 "!TARGET_IEEEQUAD && TARGET_XL_COMPAT
12827 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LONG_DOUBLE_128"
12829 "&& reload_completed"
12830 [(set (match_dup 3) (match_dup 13))
12831 (set (match_dup 4) (match_dup 14))
12832 (set (match_dup 9) (abs:DF (match_dup 5)))
12833 (set (match_dup 0) (compare:CCFP (match_dup 9) (match_dup 3)))
12834 (set (pc) (if_then_else (ne (match_dup 0) (const_int 0))
12835 (label_ref (match_dup 11))
12837 (set (match_dup 0) (compare:CCFP (match_dup 5) (match_dup 7)))
12838 (set (pc) (label_ref (match_dup 12)))
12840 (set (match_dup 10) (minus:DF (match_dup 5) (match_dup 7)))
12841 (set (match_dup 9) (minus:DF (match_dup 6) (match_dup 8)))
12842 (set (match_dup 9) (plus:DF (match_dup 10) (match_dup 9)))
12843 (set (match_dup 0) (compare:CCFP (match_dup 9) (match_dup 4)))
12846 REAL_VALUE_TYPE rv;
12847 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
12848 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
12850 operands[5] = simplify_gen_subreg (DFmode, operands[1], TFmode, hi_word);
12851 operands[6] = simplify_gen_subreg (DFmode, operands[1], TFmode, lo_word);
12852 operands[7] = simplify_gen_subreg (DFmode, operands[2], TFmode, hi_word);
12853 operands[8] = simplify_gen_subreg (DFmode, operands[2], TFmode, lo_word);
12854 operands[11] = gen_label_rtx ();
12855 operands[12] = gen_label_rtx ();
12857 operands[13] = force_const_mem (DFmode,
12858 CONST_DOUBLE_FROM_REAL_VALUE (rv, DFmode));
12859 operands[14] = force_const_mem (DFmode,
12860 CONST_DOUBLE_FROM_REAL_VALUE (dconst0,
12864 operands[13] = gen_const_mem (DFmode,
12865 create_TOC_reference (XEXP (operands[13], 0)));
12866 operands[14] = gen_const_mem (DFmode,
12867 create_TOC_reference (XEXP (operands[14], 0)));
12868 set_mem_alias_set (operands[13], get_TOC_alias_set ());
12869 set_mem_alias_set (operands[14], get_TOC_alias_set ());
12873 ;; Now we have the scc insns. We can do some combinations because of the
12874 ;; way the machine works.
12876 ;; Note that this is probably faster if we can put an insn between the
12877 ;; mfcr and rlinm, but this is tricky. Let's leave it for now. In most
12878 ;; cases the insns below which don't use an intermediate CR field will
12879 ;; be used instead.
12881 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12882 (match_operator:SI 1 "scc_comparison_operator"
12883 [(match_operand 2 "cc_reg_operand" "y")
12886 "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1"
12887 [(set (attr "type")
12888 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
12889 (const_string "mfcrf")
12891 (const_string "mfcr")))
12892 (set_attr "length" "8")])
12894 ;; Same as above, but get the GT bit.
12895 (define_insn "move_from_CR_gt_bit"
12896 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12897 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_GT))]
12898 "TARGET_HARD_FLOAT && !TARGET_FPRS"
12899 "mfcr %0\;{rlinm|rlwinm} %0,%0,%D1,31,31"
12900 [(set_attr "type" "mfcr")
12901 (set_attr "length" "8")])
12903 ;; Same as above, but get the OV/ORDERED bit.
12904 (define_insn "move_from_CR_ov_bit"
12905 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12906 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_OV))]
12908 "mfcr %0\;{rlinm|rlwinm} %0,%0,%t1,1"
12909 [(set_attr "type" "mfcr")
12910 (set_attr "length" "8")])
12913 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12914 (match_operator:DI 1 "scc_comparison_operator"
12915 [(match_operand 2 "cc_reg_operand" "y")
12918 "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1"
12919 [(set (attr "type")
12920 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
12921 (const_string "mfcrf")
12923 (const_string "mfcr")))
12924 (set_attr "length" "8")])
12927 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12928 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
12929 [(match_operand 2 "cc_reg_operand" "y,y")
12932 (set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
12933 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
12936 mfcr %3%Q2\;{rlinm.|rlwinm.} %3,%3,%J1,1
12938 [(set_attr "type" "delayed_compare")
12939 (set_attr "length" "8,16")])
12942 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12943 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
12944 [(match_operand 2 "cc_reg_operand" "")
12947 (set (match_operand:SI 3 "gpc_reg_operand" "")
12948 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
12949 "TARGET_32BIT && reload_completed"
12950 [(set (match_dup 3)
12951 (match_op_dup 1 [(match_dup 2) (const_int 0)]))
12953 (compare:CC (match_dup 3)
12958 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12959 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
12960 [(match_operand 2 "cc_reg_operand" "y")
12962 (match_operand:SI 3 "const_int_operand" "n")))]
12966 int is_bit = ccr_bit (operands[1], 1);
12967 int put_bit = 31 - (INTVAL (operands[3]) & 31);
12970 if (is_bit >= put_bit)
12971 count = is_bit - put_bit;
12973 count = 32 - (put_bit - is_bit);
12975 operands[4] = GEN_INT (count);
12976 operands[5] = GEN_INT (put_bit);
12978 return \"mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%4,%5,%5\";
12980 [(set (attr "type")
12981 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
12982 (const_string "mfcrf")
12984 (const_string "mfcr")))
12985 (set_attr "length" "8")])
12988 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12990 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
12991 [(match_operand 2 "cc_reg_operand" "y,y")
12993 (match_operand:SI 3 "const_int_operand" "n,n"))
12995 (set (match_operand:SI 4 "gpc_reg_operand" "=r,r")
12996 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
13001 int is_bit = ccr_bit (operands[1], 1);
13002 int put_bit = 31 - (INTVAL (operands[3]) & 31);
13005 /* Force split for non-cc0 compare. */
13006 if (which_alternative == 1)
13009 if (is_bit >= put_bit)
13010 count = is_bit - put_bit;
13012 count = 32 - (put_bit - is_bit);
13014 operands[5] = GEN_INT (count);
13015 operands[6] = GEN_INT (put_bit);
13017 return \"mfcr %4%Q2\;{rlinm.|rlwinm.} %4,%4,%5,%6,%6\";
13019 [(set_attr "type" "delayed_compare")
13020 (set_attr "length" "8,16")])
13023 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
13025 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
13026 [(match_operand 2 "cc_reg_operand" "")
13028 (match_operand:SI 3 "const_int_operand" ""))
13030 (set (match_operand:SI 4 "gpc_reg_operand" "")
13031 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
13034 [(set (match_dup 4)
13035 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
13038 (compare:CC (match_dup 4)
13042 ;; There is a 3 cycle delay between consecutive mfcr instructions
13043 ;; so it is useful to combine 2 scc instructions to use only one mfcr.
13046 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13047 (match_operator:SI 1 "scc_comparison_operator"
13048 [(match_operand 2 "cc_reg_operand" "y")
13050 (set (match_operand:SI 3 "gpc_reg_operand" "=r")
13051 (match_operator:SI 4 "scc_comparison_operator"
13052 [(match_operand 5 "cc_reg_operand" "y")
13054 "REGNO (operands[2]) != REGNO (operands[5])"
13055 "mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
13056 [(set_attr "type" "mfcr")
13057 (set_attr "length" "12")])
13060 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13061 (match_operator:DI 1 "scc_comparison_operator"
13062 [(match_operand 2 "cc_reg_operand" "y")
13064 (set (match_operand:DI 3 "gpc_reg_operand" "=r")
13065 (match_operator:DI 4 "scc_comparison_operator"
13066 [(match_operand 5 "cc_reg_operand" "y")
13068 "TARGET_POWERPC64 && REGNO (operands[2]) != REGNO (operands[5])"
13069 "mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
13070 [(set_attr "type" "mfcr")
13071 (set_attr "length" "12")])
13073 ;; There are some scc insns that can be done directly, without a compare.
13074 ;; These are faster because they don't involve the communications between
13075 ;; the FXU and branch units. In fact, we will be replacing all of the
13076 ;; integer scc insns here or in the portable methods in emit_store_flag.
13078 ;; Also support (neg (scc ..)) since that construct is used to replace
13079 ;; branches, (plus (scc ..) ..) since that construct is common and
13080 ;; takes no more insns than scc, and (and (neg (scc ..)) ..) in the
13081 ;; cases where it is no more expensive than (neg (scc ..)).
13083 ;; Have reload force a constant into a register for the simple insns that
13084 ;; otherwise won't accept constants. We do this because it is faster than
13085 ;; the cmp/mfcr sequence we would otherwise generate.
13087 (define_mode_attr scc_eq_op2 [(SI "rKLI")
13090 (define_insn_and_split "*eq<mode>"
13091 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
13092 (eq:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
13093 (match_operand:GPR 2 "scc_eq_operand" "<scc_eq_op2>")))]
13097 [(set (match_dup 0)
13098 (clz:GPR (match_dup 3)))
13100 (lshiftrt:GPR (match_dup 0) (match_dup 4)))]
13102 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
13104 /* Use output operand as intermediate. */
13105 operands[3] = operands[0];
13107 if (logical_operand (operands[2], <MODE>mode))
13108 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13109 gen_rtx_XOR (<MODE>mode,
13110 operands[1], operands[2])));
13112 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13113 gen_rtx_PLUS (<MODE>mode, operands[1],
13114 negate_rtx (<MODE>mode,
13118 operands[3] = operands[1];
13120 operands[4] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
13123 (define_insn_and_split "*eq<mode>_compare"
13124 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
13126 (eq:P (match_operand:P 1 "gpc_reg_operand" "=r")
13127 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))
13129 (set (match_operand:P 0 "gpc_reg_operand" "=r")
13130 (eq:P (match_dup 1) (match_dup 2)))]
13131 "!TARGET_POWER && optimize_size"
13133 "!TARGET_POWER && optimize_size"
13134 [(set (match_dup 0)
13135 (clz:P (match_dup 4)))
13136 (parallel [(set (match_dup 3)
13137 (compare:CC (lshiftrt:P (match_dup 0) (match_dup 5))
13140 (lshiftrt:P (match_dup 0) (match_dup 5)))])]
13142 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
13144 /* Use output operand as intermediate. */
13145 operands[4] = operands[0];
13147 if (logical_operand (operands[2], <MODE>mode))
13148 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
13149 gen_rtx_XOR (<MODE>mode,
13150 operands[1], operands[2])));
13152 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
13153 gen_rtx_PLUS (<MODE>mode, operands[1],
13154 negate_rtx (<MODE>mode,
13158 operands[4] = operands[1];
13160 operands[5] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
13163 (define_insn "*eqsi_power"
13164 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
13165 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
13166 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I")))
13167 (clobber (match_scratch:SI 3 "=r,&r,r,r,r"))]
13170 xor %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
13171 {sfi|subfic} %3,%1,0\;{ae|adde} %0,%3,%1
13172 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
13173 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
13174 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0"
13175 [(set_attr "type" "three,two,three,three,three")
13176 (set_attr "length" "12,8,12,12,12")])
13178 ;; We have insns of the form shown by the first define_insn below. If
13179 ;; there is something inside the comparison operation, we must split it.
13181 [(set (match_operand:SI 0 "gpc_reg_operand" "")
13182 (plus:SI (match_operator 1 "comparison_operator"
13183 [(match_operand:SI 2 "" "")
13184 (match_operand:SI 3
13185 "reg_or_cint_operand" "")])
13186 (match_operand:SI 4 "gpc_reg_operand" "")))
13187 (clobber (match_operand:SI 5 "register_operand" ""))]
13188 "! gpc_reg_operand (operands[2], SImode)"
13189 [(set (match_dup 5) (match_dup 2))
13190 (set (match_dup 2) (plus:SI (match_op_dup 1 [(match_dup 2) (match_dup 3)])
13193 (define_insn "*plus_eqsi"
13194 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r")
13195 (plus:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
13196 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I"))
13197 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r")))]
13200 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
13201 {sfi|subfic} %0,%1,0\;{aze|addze} %0,%3
13202 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
13203 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
13204 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
13205 [(set_attr "type" "three,two,three,three,three")
13206 (set_attr "length" "12,8,12,12,12")])
13208 (define_insn "*compare_plus_eqsi"
13209 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
13212 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
13213 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
13214 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
13216 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r"))]
13217 "TARGET_32BIT && optimize_size"
13219 xor %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
13220 {sfi|subfic} %4,%1,0\;{aze.|addze.} %4,%3
13221 {xoril|xori} %4,%1,%b2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
13222 {xoriu|xoris} %4,%1,%u2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
13223 {sfi|subfic} %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
13229 [(set_attr "type" "compare")
13230 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
13233 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13236 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
13237 (match_operand:SI 2 "scc_eq_operand" ""))
13238 (match_operand:SI 3 "gpc_reg_operand" ""))
13240 (clobber (match_scratch:SI 4 ""))]
13241 "TARGET_32BIT && optimize_size && reload_completed"
13242 [(set (match_dup 4)
13243 (plus:SI (eq:SI (match_dup 1)
13247 (compare:CC (match_dup 4)
13251 (define_insn "*plus_eqsi_compare"
13252 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
13255 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
13256 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
13257 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
13259 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r")
13260 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13261 "TARGET_32BIT && optimize_size"
13263 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
13264 {sfi|subfic} %0,%1,0\;{aze.|addze.} %0,%3
13265 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
13266 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
13267 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
13273 [(set_attr "type" "compare")
13274 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
13277 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13280 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
13281 (match_operand:SI 2 "scc_eq_operand" ""))
13282 (match_operand:SI 3 "gpc_reg_operand" ""))
13284 (set (match_operand:SI 0 "gpc_reg_operand" "")
13285 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13286 "TARGET_32BIT && optimize_size && reload_completed"
13287 [(set (match_dup 0)
13288 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13290 (compare:CC (match_dup 0)
13294 (define_insn "*neg_eq0<mode>"
13295 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13296 (neg:P (eq:P (match_operand:P 1 "gpc_reg_operand" "r")
13299 "{ai|addic} %0,%1,-1\;{sfe|subfe} %0,%0,%0"
13300 [(set_attr "type" "two")
13301 (set_attr "length" "8")])
13303 (define_insn_and_split "*neg_eq<mode>"
13304 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13305 (neg:P (eq:P (match_operand:P 1 "gpc_reg_operand" "%r")
13306 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))))]
13310 [(set (match_dup 0) (neg:P (eq:P (match_dup 3) (const_int 0))))]
13312 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
13314 /* Use output operand as intermediate. */
13315 operands[3] = operands[0];
13317 if (logical_operand (operands[2], <MODE>mode))
13318 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13319 gen_rtx_XOR (<MODE>mode,
13320 operands[1], operands[2])));
13322 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13323 gen_rtx_PLUS (<MODE>mode, operands[1],
13324 negate_rtx (<MODE>mode,
13328 operands[3] = operands[1];
13331 ;; Simplify (ne X (const_int 0)) on the PowerPC. No need to on the Power,
13332 ;; since it nabs/sr is just as fast.
13333 (define_insn "*ne0si"
13334 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
13335 (lshiftrt:SI (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
13337 (clobber (match_scratch:SI 2 "=&r"))]
13338 "! TARGET_POWER && TARGET_32BIT && !TARGET_ISEL"
13339 "{ai|addic} %2,%1,-1\;{sfe|subfe} %0,%2,%1"
13340 [(set_attr "type" "two")
13341 (set_attr "length" "8")])
13343 (define_insn "*ne0di"
13344 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13345 (lshiftrt:DI (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
13347 (clobber (match_scratch:DI 2 "=&r"))]
13349 "addic %2,%1,-1\;subfe %0,%2,%1"
13350 [(set_attr "type" "two")
13351 (set_attr "length" "8")])
13353 ;; This is what (plus (ne X (const_int 0)) Y) looks like.
13354 (define_insn "*plus_ne0si"
13355 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13356 (plus:SI (lshiftrt:SI
13357 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
13359 (match_operand:SI 2 "gpc_reg_operand" "r")))
13360 (clobber (match_scratch:SI 3 "=&r"))]
13362 "{ai|addic} %3,%1,-1\;{aze|addze} %0,%2"
13363 [(set_attr "type" "two")
13364 (set_attr "length" "8")])
13366 (define_insn "*plus_ne0di"
13367 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13368 (plus:DI (lshiftrt:DI
13369 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
13371 (match_operand:DI 2 "gpc_reg_operand" "r")))
13372 (clobber (match_scratch:DI 3 "=&r"))]
13374 "addic %3,%1,-1\;addze %0,%2"
13375 [(set_attr "type" "two")
13376 (set_attr "length" "8")])
13378 (define_insn "*compare_plus_ne0si"
13379 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13381 (plus:SI (lshiftrt:SI
13382 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
13384 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
13386 (clobber (match_scratch:SI 3 "=&r,&r"))
13387 (clobber (match_scratch:SI 4 "=X,&r"))]
13390 {ai|addic} %3,%1,-1\;{aze.|addze.} %3,%2
13392 [(set_attr "type" "compare")
13393 (set_attr "length" "8,12")])
13396 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13398 (plus:SI (lshiftrt:SI
13399 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
13401 (match_operand:SI 2 "gpc_reg_operand" ""))
13403 (clobber (match_scratch:SI 3 ""))
13404 (clobber (match_scratch:SI 4 ""))]
13405 "TARGET_32BIT && reload_completed"
13406 [(parallel [(set (match_dup 3)
13407 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1)))
13410 (clobber (match_dup 4))])
13412 (compare:CC (match_dup 3)
13416 (define_insn "*compare_plus_ne0di"
13417 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13419 (plus:DI (lshiftrt:DI
13420 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
13422 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
13424 (clobber (match_scratch:DI 3 "=&r,&r"))]
13427 addic %3,%1,-1\;addze. %3,%2
13429 [(set_attr "type" "compare")
13430 (set_attr "length" "8,12")])
13433 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
13435 (plus:DI (lshiftrt:DI
13436 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
13438 (match_operand:DI 2 "gpc_reg_operand" ""))
13440 (clobber (match_scratch:DI 3 ""))]
13441 "TARGET_64BIT && reload_completed"
13442 [(set (match_dup 3)
13443 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1)))
13447 (compare:CC (match_dup 3)
13451 (define_insn "*plus_ne0si_compare"
13452 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13454 (plus:SI (lshiftrt:SI
13455 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
13457 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
13459 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13460 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
13462 (clobber (match_scratch:SI 3 "=&r,&r"))]
13465 {ai|addic} %3,%1,-1\;{aze.|addze.} %0,%2
13467 [(set_attr "type" "compare")
13468 (set_attr "length" "8,12")])
13471 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13473 (plus:SI (lshiftrt:SI
13474 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
13476 (match_operand:SI 2 "gpc_reg_operand" ""))
13478 (set (match_operand:SI 0 "gpc_reg_operand" "")
13479 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
13481 (clobber (match_scratch:SI 3 ""))]
13482 "TARGET_32BIT && reload_completed"
13483 [(parallel [(set (match_dup 0)
13484 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
13486 (clobber (match_dup 3))])
13488 (compare:CC (match_dup 0)
13492 (define_insn "*plus_ne0di_compare"
13493 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13495 (plus:DI (lshiftrt:DI
13496 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
13498 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
13500 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
13501 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
13503 (clobber (match_scratch:DI 3 "=&r,&r"))]
13506 addic %3,%1,-1\;addze. %0,%2
13508 [(set_attr "type" "compare")
13509 (set_attr "length" "8,12")])
13512 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
13514 (plus:DI (lshiftrt:DI
13515 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
13517 (match_operand:DI 2 "gpc_reg_operand" ""))
13519 (set (match_operand:DI 0 "gpc_reg_operand" "")
13520 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
13522 (clobber (match_scratch:DI 3 ""))]
13523 "TARGET_64BIT && reload_completed"
13524 [(parallel [(set (match_dup 0)
13525 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
13527 (clobber (match_dup 3))])
13529 (compare:CC (match_dup 0)
13534 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13535 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13536 (match_operand:SI 2 "reg_or_short_operand" "r,O")))
13537 (clobber (match_scratch:SI 3 "=r,X"))]
13540 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3
13541 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri|srwi} %0,%0,31"
13542 [(set_attr "length" "12")])
13545 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13547 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13548 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
13550 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
13551 (le:SI (match_dup 1) (match_dup 2)))
13552 (clobber (match_scratch:SI 3 "=r,X,r,X"))]
13555 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
13556 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri.|srwi.} %0,%0,31
13559 [(set_attr "type" "compare,delayed_compare,compare,delayed_compare")
13560 (set_attr "length" "12,12,16,16")])
13563 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13565 (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
13566 (match_operand:SI 2 "reg_or_short_operand" ""))
13568 (set (match_operand:SI 0 "gpc_reg_operand" "")
13569 (le:SI (match_dup 1) (match_dup 2)))
13570 (clobber (match_scratch:SI 3 ""))]
13571 "TARGET_POWER && reload_completed"
13572 [(parallel [(set (match_dup 0)
13573 (le:SI (match_dup 1) (match_dup 2)))
13574 (clobber (match_dup 3))])
13576 (compare:CC (match_dup 0)
13581 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13582 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13583 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
13584 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
13587 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
13588 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze|addze} %0,%3"
13589 [(set_attr "length" "12")])
13592 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13594 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13595 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
13596 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13598 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
13601 doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
13602 {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze.|addze.} %4,%3
13605 [(set_attr "type" "compare")
13606 (set_attr "length" "12,12,16,16")])
13609 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13611 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
13612 (match_operand:SI 2 "reg_or_short_operand" ""))
13613 (match_operand:SI 3 "gpc_reg_operand" ""))
13615 (clobber (match_scratch:SI 4 ""))]
13616 "TARGET_POWER && reload_completed"
13617 [(set (match_dup 4)
13618 (plus:SI (le:SI (match_dup 1) (match_dup 2))
13621 (compare:CC (match_dup 4)
13626 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13628 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13629 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
13630 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13632 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13633 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13636 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
13637 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze.|addze.} %0,%3
13640 [(set_attr "type" "compare")
13641 (set_attr "length" "12,12,16,16")])
13644 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13646 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
13647 (match_operand:SI 2 "reg_or_short_operand" ""))
13648 (match_operand:SI 3 "gpc_reg_operand" ""))
13650 (set (match_operand:SI 0 "gpc_reg_operand" "")
13651 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13652 "TARGET_POWER && reload_completed"
13653 [(set (match_dup 0)
13654 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13656 (compare:CC (match_dup 0)
13661 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13662 (neg:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13663 (match_operand:SI 2 "reg_or_short_operand" "r,O"))))]
13666 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
13667 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{srai|srawi} %0,%0,31"
13668 [(set_attr "length" "12")])
13670 (define_insn "*leu<mode>"
13671 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13672 (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
13673 (match_operand:P 2 "reg_or_short_operand" "rI")))]
13675 "{sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
13676 [(set_attr "type" "three")
13677 (set_attr "length" "12")])
13679 (define_insn "*leu<mode>_compare"
13680 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13682 (leu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13683 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
13685 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13686 (leu:P (match_dup 1) (match_dup 2)))]
13689 {sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
13691 [(set_attr "type" "compare")
13692 (set_attr "length" "12,16")])
13695 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13697 (leu:P (match_operand:P 1 "gpc_reg_operand" "")
13698 (match_operand:P 2 "reg_or_short_operand" ""))
13700 (set (match_operand:P 0 "gpc_reg_operand" "")
13701 (leu:P (match_dup 1) (match_dup 2)))]
13703 [(set (match_dup 0)
13704 (leu:P (match_dup 1) (match_dup 2)))
13706 (compare:CC (match_dup 0)
13710 (define_insn "*plus_leu<mode>"
13711 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
13712 (plus:P (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
13713 (match_operand:P 2 "reg_or_short_operand" "rI"))
13714 (match_operand:P 3 "gpc_reg_operand" "r")))]
13716 "{sf%I2|subf%I2c} %0,%1,%2\;{aze|addze} %0,%3"
13717 [(set_attr "type" "two")
13718 (set_attr "length" "8")])
13721 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13723 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13724 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13725 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13727 (clobber (match_scratch:SI 4 "=&r,&r"))]
13730 {sf%I2|subf%I2c} %4,%1,%2\;{aze.|addze.} %4,%3
13732 [(set_attr "type" "compare")
13733 (set_attr "length" "8,12")])
13736 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13738 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13739 (match_operand:SI 2 "reg_or_short_operand" ""))
13740 (match_operand:SI 3 "gpc_reg_operand" ""))
13742 (clobber (match_scratch:SI 4 ""))]
13743 "TARGET_32BIT && reload_completed"
13744 [(set (match_dup 4)
13745 (plus:SI (leu:SI (match_dup 1) (match_dup 2))
13748 (compare:CC (match_dup 4)
13753 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13755 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13756 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13757 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13759 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13760 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13763 {sf%I2|subf%I2c} %0,%1,%2\;{aze.|addze.} %0,%3
13765 [(set_attr "type" "compare")
13766 (set_attr "length" "8,12")])
13769 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13771 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13772 (match_operand:SI 2 "reg_or_short_operand" ""))
13773 (match_operand:SI 3 "gpc_reg_operand" ""))
13775 (set (match_operand:SI 0 "gpc_reg_operand" "")
13776 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13777 "TARGET_32BIT && reload_completed"
13778 [(set (match_dup 0)
13779 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13781 (compare:CC (match_dup 0)
13785 (define_insn "*neg_leu<mode>"
13786 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13787 (neg:P (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
13788 (match_operand:P 2 "reg_or_short_operand" "rI"))))]
13790 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0"
13791 [(set_attr "type" "three")
13792 (set_attr "length" "12")])
13794 (define_insn "*and_neg_leu<mode>"
13795 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
13797 (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
13798 (match_operand:P 2 "reg_or_short_operand" "rI")))
13799 (match_operand:P 3 "gpc_reg_operand" "r")))]
13801 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
13802 [(set_attr "type" "three")
13803 (set_attr "length" "12")])
13806 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13809 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13810 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
13811 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13813 (clobber (match_scratch:SI 4 "=&r,&r"))]
13816 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
13818 [(set_attr "type" "compare")
13819 (set_attr "length" "12,16")])
13822 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13825 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13826 (match_operand:SI 2 "reg_or_short_operand" "")))
13827 (match_operand:SI 3 "gpc_reg_operand" ""))
13829 (clobber (match_scratch:SI 4 ""))]
13830 "TARGET_32BIT && reload_completed"
13831 [(set (match_dup 4)
13832 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
13835 (compare:CC (match_dup 4)
13840 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13843 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13844 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
13845 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13847 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13848 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13851 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
13853 [(set_attr "type" "compare")
13854 (set_attr "length" "12,16")])
13857 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13860 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13861 (match_operand:SI 2 "reg_or_short_operand" "")))
13862 (match_operand:SI 3 "gpc_reg_operand" ""))
13864 (set (match_operand:SI 0 "gpc_reg_operand" "")
13865 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13866 "TARGET_32BIT && reload_completed"
13867 [(set (match_dup 0)
13868 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
13871 (compare:CC (match_dup 0)
13876 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13877 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13878 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
13880 "doz%I2 %0,%1,%2\;nabs %0,%0\;{sri|srwi} %0,%0,31"
13881 [(set_attr "length" "12")])
13884 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13886 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13887 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13889 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13890 (lt:SI (match_dup 1) (match_dup 2)))]
13893 doz%I2 %0,%1,%2\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
13895 [(set_attr "type" "delayed_compare")
13896 (set_attr "length" "12,16")])
13899 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13901 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13902 (match_operand:SI 2 "reg_or_short_operand" ""))
13904 (set (match_operand:SI 0 "gpc_reg_operand" "")
13905 (lt:SI (match_dup 1) (match_dup 2)))]
13906 "TARGET_POWER && reload_completed"
13907 [(set (match_dup 0)
13908 (lt:SI (match_dup 1) (match_dup 2)))
13910 (compare:CC (match_dup 0)
13915 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
13916 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13917 (match_operand:SI 2 "reg_or_short_operand" "rI"))
13918 (match_operand:SI 3 "gpc_reg_operand" "r")))]
13920 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
13921 [(set_attr "length" "12")])
13924 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13926 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13927 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13928 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13930 (clobber (match_scratch:SI 4 "=&r,&r"))]
13933 doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
13935 [(set_attr "type" "compare")
13936 (set_attr "length" "12,16")])
13939 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13941 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13942 (match_operand:SI 2 "reg_or_short_operand" ""))
13943 (match_operand:SI 3 "gpc_reg_operand" ""))
13945 (clobber (match_scratch:SI 4 ""))]
13946 "TARGET_POWER && reload_completed"
13947 [(set (match_dup 4)
13948 (plus:SI (lt:SI (match_dup 1) (match_dup 2))
13951 (compare:CC (match_dup 4)
13956 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13958 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13959 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13960 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13962 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13963 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13966 doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
13968 [(set_attr "type" "compare")
13969 (set_attr "length" "12,16")])
13972 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13974 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13975 (match_operand:SI 2 "reg_or_short_operand" ""))
13976 (match_operand:SI 3 "gpc_reg_operand" ""))
13978 (set (match_operand:SI 0 "gpc_reg_operand" "")
13979 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13980 "TARGET_POWER && reload_completed"
13981 [(set (match_dup 0)
13982 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13984 (compare:CC (match_dup 0)
13989 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13990 (neg:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13991 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
13993 "doz%I2 %0,%1,%2\;nabs %0,%0\;{srai|srawi} %0,%0,31"
13994 [(set_attr "length" "12")])
13996 (define_insn_and_split "*ltu<mode>"
13997 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13998 (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13999 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))]
14003 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
14004 (set (match_dup 0) (neg:P (match_dup 0)))]
14007 (define_insn_and_split "*ltu<mode>_compare"
14008 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
14010 (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
14011 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
14013 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
14014 (ltu:P (match_dup 1) (match_dup 2)))]
14018 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
14019 (parallel [(set (match_dup 3)
14020 (compare:CC (neg:P (match_dup 0)) (const_int 0)))
14021 (set (match_dup 0) (neg:P (match_dup 0)))])]
14024 (define_insn_and_split "*plus_ltu<mode>"
14025 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,r")
14026 (plus:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14027 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))
14028 (match_operand:P 3 "reg_or_short_operand" "rI,rI")))]
14031 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
14032 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
14033 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))]
14036 (define_insn_and_split "*plus_ltu<mode>_compare"
14037 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
14039 (plus:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
14040 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
14041 (match_operand:P 3 "gpc_reg_operand" "r,r,r,r"))
14043 (set (match_operand:P 0 "gpc_reg_operand" "=&r,&r,&r,&r")
14044 (plus:P (ltu:P (match_dup 1) (match_dup 2)) (match_dup 3)))]
14047 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
14048 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
14049 (parallel [(set (match_dup 4)
14050 (compare:CC (minus:P (match_dup 3) (match_dup 0))
14052 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))])]
14055 (define_insn "*neg_ltu<mode>"
14056 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
14057 (neg:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14058 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))))]
14061 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0
14062 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0"
14063 [(set_attr "type" "two")
14064 (set_attr "length" "8")])
14067 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14068 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14069 (match_operand:SI 2 "reg_or_short_operand" "rI")))
14070 (clobber (match_scratch:SI 3 "=r"))]
14072 "doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3"
14073 [(set_attr "length" "12")])
14076 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
14078 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14079 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14081 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
14082 (ge:SI (match_dup 1) (match_dup 2)))
14083 (clobber (match_scratch:SI 3 "=r,r"))]
14086 doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
14088 [(set_attr "type" "compare")
14089 (set_attr "length" "12,16")])
14092 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14094 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
14095 (match_operand:SI 2 "reg_or_short_operand" ""))
14097 (set (match_operand:SI 0 "gpc_reg_operand" "")
14098 (ge:SI (match_dup 1) (match_dup 2)))
14099 (clobber (match_scratch:SI 3 ""))]
14100 "TARGET_POWER && reload_completed"
14101 [(parallel [(set (match_dup 0)
14102 (ge:SI (match_dup 1) (match_dup 2)))
14103 (clobber (match_dup 3))])
14105 (compare:CC (match_dup 0)
14110 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
14111 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14112 (match_operand:SI 2 "reg_or_short_operand" "rI"))
14113 (match_operand:SI 3 "gpc_reg_operand" "r")))]
14115 "doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
14116 [(set_attr "length" "12")])
14119 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
14121 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14122 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14123 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14125 (clobber (match_scratch:SI 4 "=&r,&r"))]
14128 doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
14130 [(set_attr "type" "compare")
14131 (set_attr "length" "12,16")])
14134 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14136 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
14137 (match_operand:SI 2 "reg_or_short_operand" ""))
14138 (match_operand:SI 3 "gpc_reg_operand" ""))
14140 (clobber (match_scratch:SI 4 ""))]
14141 "TARGET_POWER && reload_completed"
14142 [(set (match_dup 4)
14143 (plus:SI (ge:SI (match_dup 1) (match_dup 2))
14146 (compare:CC (match_dup 4)
14151 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
14153 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14154 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14155 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14157 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
14158 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14161 doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
14163 [(set_attr "type" "compare")
14164 (set_attr "length" "12,16")])
14167 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14169 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
14170 (match_operand:SI 2 "reg_or_short_operand" ""))
14171 (match_operand:SI 3 "gpc_reg_operand" ""))
14173 (set (match_operand:SI 0 "gpc_reg_operand" "")
14174 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14175 "TARGET_POWER && reload_completed"
14176 [(set (match_dup 0)
14177 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
14179 (compare:CC (match_dup 0)
14184 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14185 (neg:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14186 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
14188 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
14189 [(set_attr "length" "12")])
14191 (define_insn "*geu<mode>"
14192 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
14193 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14194 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))]
14197 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0
14198 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
14199 [(set_attr "type" "three")
14200 (set_attr "length" "12")])
14202 (define_insn "*geu<mode>_compare"
14203 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
14205 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
14206 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
14208 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
14209 (geu:P (match_dup 1) (match_dup 2)))]
14212 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
14213 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
14216 [(set_attr "type" "compare")
14217 (set_attr "length" "12,12,16,16")])
14220 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
14222 (geu:P (match_operand:P 1 "gpc_reg_operand" "")
14223 (match_operand:P 2 "reg_or_neg_short_operand" ""))
14225 (set (match_operand:P 0 "gpc_reg_operand" "")
14226 (geu:P (match_dup 1) (match_dup 2)))]
14228 [(set (match_dup 0)
14229 (geu:P (match_dup 1) (match_dup 2)))
14231 (compare:CC (match_dup 0)
14235 (define_insn "*plus_geu<mode>"
14236 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,&r")
14237 (plus:P (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14238 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))
14239 (match_operand:P 3 "gpc_reg_operand" "r,r")))]
14242 {sf|subfc} %0,%2,%1\;{aze|addze} %0,%3
14243 {ai|addic} %0,%1,%n2\;{aze|addze} %0,%3"
14244 [(set_attr "type" "two")
14245 (set_attr "length" "8")])
14248 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
14250 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14251 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
14252 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
14254 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
14257 {sf|subfc} %4,%2,%1\;{aze.|addze.} %4,%3
14258 {ai|addic} %4,%1,%n2\;{aze.|addze.} %4,%3
14261 [(set_attr "type" "compare")
14262 (set_attr "length" "8,8,12,12")])
14265 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14267 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14268 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
14269 (match_operand:SI 3 "gpc_reg_operand" ""))
14271 (clobber (match_scratch:SI 4 ""))]
14272 "TARGET_32BIT && reload_completed"
14273 [(set (match_dup 4)
14274 (plus:SI (geu:SI (match_dup 1) (match_dup 2))
14277 (compare:CC (match_dup 4)
14282 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
14284 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14285 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
14286 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
14288 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
14289 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14292 {sf|subfc} %0,%2,%1\;{aze.|addze.} %0,%3
14293 {ai|addic} %0,%1,%n2\;{aze.|addze.} %0,%3
14296 [(set_attr "type" "compare")
14297 (set_attr "length" "8,8,12,12")])
14300 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14302 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14303 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
14304 (match_operand:SI 3 "gpc_reg_operand" ""))
14306 (set (match_operand:SI 0 "gpc_reg_operand" "")
14307 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14308 "TARGET_32BIT && reload_completed"
14309 [(set (match_dup 0)
14310 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
14312 (compare:CC (match_dup 0)
14316 (define_insn "*neg_geu<mode>"
14317 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
14318 (neg:P (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14319 (match_operand:P 2 "reg_or_short_operand" "r,I"))))]
14322 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0
14323 {sfi|subfic} %0,%1,-1\;{a%I2|add%I2c} %0,%0,%2\;{sfe|subfe} %0,%0,%0"
14324 [(set_attr "type" "three")
14325 (set_attr "length" "12")])
14327 (define_insn "*and_neg_geu<mode>"
14328 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,&r")
14330 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14331 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))
14332 (match_operand:P 3 "gpc_reg_operand" "r,r")))]
14335 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0
14336 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
14337 [(set_attr "type" "three")
14338 (set_attr "length" "12")])
14341 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
14344 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14345 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
14346 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
14348 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
14351 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
14352 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
14355 [(set_attr "type" "compare")
14356 (set_attr "length" "12,12,16,16")])
14359 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14362 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14363 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
14364 (match_operand:SI 3 "gpc_reg_operand" ""))
14366 (clobber (match_scratch:SI 4 ""))]
14367 "TARGET_32BIT && reload_completed"
14368 [(set (match_dup 4)
14369 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2)))
14372 (compare:CC (match_dup 4)
14377 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
14380 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14381 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
14382 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
14384 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
14385 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
14388 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
14389 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
14392 [(set_attr "type" "compare")
14393 (set_attr "length" "12,12,16,16")])
14396 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14399 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14400 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
14401 (match_operand:SI 3 "gpc_reg_operand" ""))
14403 (set (match_operand:SI 0 "gpc_reg_operand" "")
14404 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
14405 "TARGET_32BIT && reload_completed"
14406 [(set (match_dup 0)
14407 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
14409 (compare:CC (match_dup 0)
14414 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14415 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14416 (match_operand:SI 2 "reg_or_short_operand" "r")))]
14418 "doz %0,%2,%1\;nabs %0,%0\;{sri|srwi} %0,%0,31"
14419 [(set_attr "length" "12")])
14422 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
14424 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14425 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
14427 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
14428 (gt:SI (match_dup 1) (match_dup 2)))]
14431 doz %0,%2,%1\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
14433 [(set_attr "type" "delayed_compare")
14434 (set_attr "length" "12,16")])
14437 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
14439 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14440 (match_operand:SI 2 "reg_or_short_operand" ""))
14442 (set (match_operand:SI 0 "gpc_reg_operand" "")
14443 (gt:SI (match_dup 1) (match_dup 2)))]
14444 "TARGET_POWER && reload_completed"
14445 [(set (match_dup 0)
14446 (gt:SI (match_dup 1) (match_dup 2)))
14448 (compare:CC (match_dup 0)
14452 (define_insn "*plus_gt0<mode>"
14453 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
14454 (plus:P (gt:P (match_operand:P 1 "gpc_reg_operand" "r")
14456 (match_operand:P 2 "gpc_reg_operand" "r")))]
14458 "{a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze|addze} %0,%2"
14459 [(set_attr "type" "three")
14460 (set_attr "length" "12")])
14463 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
14465 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14467 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
14469 (clobber (match_scratch:SI 3 "=&r,&r"))]
14472 {a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze.|addze.} %3,%2
14474 [(set_attr "type" "compare")
14475 (set_attr "length" "12,16")])
14478 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14480 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14482 (match_operand:SI 2 "gpc_reg_operand" ""))
14484 (clobber (match_scratch:SI 3 ""))]
14485 "TARGET_32BIT && reload_completed"
14486 [(set (match_dup 3)
14487 (plus:SI (gt:SI (match_dup 1) (const_int 0))
14490 (compare:CC (match_dup 3)
14495 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
14497 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
14499 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
14501 (clobber (match_scratch:DI 3 "=&r,&r"))]
14504 addc %3,%1,%1\;subfe %3,%1,%3\;addze. %3,%2
14506 [(set_attr "type" "compare")
14507 (set_attr "length" "12,16")])
14510 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
14512 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
14514 (match_operand:DI 2 "gpc_reg_operand" ""))
14516 (clobber (match_scratch:DI 3 ""))]
14517 "TARGET_64BIT && reload_completed"
14518 [(set (match_dup 3)
14519 (plus:DI (gt:DI (match_dup 1) (const_int 0))
14522 (compare:CC (match_dup 3)
14527 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
14529 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14531 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
14533 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
14534 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
14537 {a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze.|addze.} %0,%2
14539 [(set_attr "type" "compare")
14540 (set_attr "length" "12,16")])
14543 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
14545 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14547 (match_operand:SI 2 "gpc_reg_operand" ""))
14549 (set (match_operand:SI 0 "gpc_reg_operand" "")
14550 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
14551 "TARGET_32BIT && reload_completed"
14552 [(set (match_dup 0)
14553 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))
14555 (compare:CC (match_dup 0)
14560 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
14562 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
14564 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
14566 (set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
14567 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
14570 addc %0,%1,%1\;subfe %0,%1,%0\;addze. %0,%2
14572 [(set_attr "type" "compare")
14573 (set_attr "length" "12,16")])
14576 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
14578 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
14580 (match_operand:DI 2 "gpc_reg_operand" ""))
14582 (set (match_operand:DI 0 "gpc_reg_operand" "")
14583 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
14584 "TARGET_64BIT && reload_completed"
14585 [(set (match_dup 0)
14586 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))
14588 (compare:CC (match_dup 0)
14593 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
14594 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14595 (match_operand:SI 2 "reg_or_short_operand" "r"))
14596 (match_operand:SI 3 "gpc_reg_operand" "r")))]
14598 "doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
14599 [(set_attr "length" "12")])
14602 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
14604 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14605 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
14606 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14608 (clobber (match_scratch:SI 4 "=&r,&r"))]
14611 doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
14613 [(set_attr "type" "compare")
14614 (set_attr "length" "12,16")])
14617 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14619 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14620 (match_operand:SI 2 "reg_or_short_operand" ""))
14621 (match_operand:SI 3 "gpc_reg_operand" ""))
14623 (clobber (match_scratch:SI 4 ""))]
14624 "TARGET_POWER && reload_completed"
14625 [(set (match_dup 4)
14626 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
14628 (compare:CC (match_dup 4)
14633 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
14635 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14636 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
14637 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14639 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
14640 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14643 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
14645 [(set_attr "type" "compare")
14646 (set_attr "length" "12,16")])
14649 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14651 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14652 (match_operand:SI 2 "reg_or_short_operand" ""))
14653 (match_operand:SI 3 "gpc_reg_operand" ""))
14655 (set (match_operand:SI 0 "gpc_reg_operand" "")
14656 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14657 "TARGET_POWER && reload_completed"
14658 [(set (match_dup 0)
14659 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
14661 (compare:CC (match_dup 0)
14666 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14667 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14668 (match_operand:SI 2 "reg_or_short_operand" "r"))))]
14670 "doz %0,%2,%1\;nabs %0,%0\;{srai|srawi} %0,%0,31"
14671 [(set_attr "length" "12")])
14673 (define_insn_and_split "*gtu<mode>"
14674 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
14675 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
14676 (match_operand:P 2 "reg_or_short_operand" "rI")))]
14680 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
14681 (set (match_dup 0) (neg:P (match_dup 0)))]
14684 (define_insn_and_split "*gtu<mode>_compare"
14685 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
14687 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14688 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
14690 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
14691 (gtu:P (match_dup 1) (match_dup 2)))]
14695 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
14696 (parallel [(set (match_dup 3)
14697 (compare:CC (neg:P (match_dup 0)) (const_int 0)))
14698 (set (match_dup 0) (neg:P (match_dup 0)))])]
14701 (define_insn_and_split "*plus_gtu<mode>"
14702 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
14703 (plus:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
14704 (match_operand:P 2 "reg_or_short_operand" "rI"))
14705 (match_operand:P 3 "reg_or_short_operand" "rI")))]
14708 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
14709 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
14710 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))]
14713 (define_insn_and_split "*plus_gtu<mode>_compare"
14714 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
14716 (plus:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
14717 (match_operand:P 2 "reg_or_short_operand" "I,r,I,r"))
14718 (match_operand:P 3 "gpc_reg_operand" "r,r,r,r"))
14720 (set (match_operand:P 0 "gpc_reg_operand" "=&r,&r,&r,&r")
14721 (plus:P (gtu:P (match_dup 1) (match_dup 2)) (match_dup 3)))]
14724 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
14725 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
14726 (parallel [(set (match_dup 4)
14727 (compare:CC (minus:P (match_dup 3) (match_dup 0))
14729 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))])]
14732 (define_insn "*neg_gtu<mode>"
14733 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
14734 (neg:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
14735 (match_operand:P 2 "reg_or_short_operand" "rI"))))]
14737 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0"
14738 [(set_attr "type" "two")
14739 (set_attr "length" "8")])
14742 ;; Define both directions of branch and return. If we need a reload
14743 ;; register, we'd rather use CR0 since it is much easier to copy a
14744 ;; register CC value to there.
14748 (if_then_else (match_operator 1 "branch_comparison_operator"
14750 "cc_reg_operand" "y")
14752 (label_ref (match_operand 0 "" ""))
14757 return output_cbranch (operands[1], \"%l0\", 0, insn);
14759 [(set_attr "type" "branch")])
14763 (if_then_else (match_operator 0 "branch_comparison_operator"
14765 "cc_reg_operand" "y")
14772 return output_cbranch (operands[0], NULL, 0, insn);
14774 [(set_attr "type" "jmpreg")
14775 (set_attr "length" "4")])
14779 (if_then_else (match_operator 1 "branch_comparison_operator"
14781 "cc_reg_operand" "y")
14784 (label_ref (match_operand 0 "" ""))))]
14788 return output_cbranch (operands[1], \"%l0\", 1, insn);
14790 [(set_attr "type" "branch")])
14794 (if_then_else (match_operator 0 "branch_comparison_operator"
14796 "cc_reg_operand" "y")
14803 return output_cbranch (operands[0], NULL, 1, insn);
14805 [(set_attr "type" "jmpreg")
14806 (set_attr "length" "4")])
14808 ;; Logic on condition register values.
14810 ; This pattern matches things like
14811 ; (set (reg:CCEQ 68) (compare:CCEQ (ior:SI (gt:SI (reg:CCFP 68) (const_int 0))
14812 ; (eq:SI (reg:CCFP 68) (const_int 0)))
14814 ; which are generated by the branch logic.
14815 ; Prefer destructive operations where BT = BB (for crXX BT,BA,BB)
14817 (define_insn "*cceq_ior_compare"
14818 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
14819 (compare:CCEQ (match_operator:SI 1 "boolean_operator"
14820 [(match_operator:SI 2
14821 "branch_positive_comparison_operator"
14823 "cc_reg_operand" "y,y")
14825 (match_operator:SI 4
14826 "branch_positive_comparison_operator"
14828 "cc_reg_operand" "0,y")
14832 "cr%q1 %E0,%j2,%j4"
14833 [(set_attr "type" "cr_logical,delayed_cr")])
14835 ; Why is the constant -1 here, but 1 in the previous pattern?
14836 ; Because ~1 has all but the low bit set.
14838 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
14839 (compare:CCEQ (match_operator:SI 1 "boolean_or_operator"
14840 [(not:SI (match_operator:SI 2
14841 "branch_positive_comparison_operator"
14843 "cc_reg_operand" "y,y")
14845 (match_operator:SI 4
14846 "branch_positive_comparison_operator"
14848 "cc_reg_operand" "0,y")
14852 "cr%q1 %E0,%j2,%j4"
14853 [(set_attr "type" "cr_logical,delayed_cr")])
14855 (define_insn "*cceq_rev_compare"
14856 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
14857 (compare:CCEQ (match_operator:SI 1
14858 "branch_positive_comparison_operator"
14860 "cc_reg_operand" "0,y")
14864 "{crnor %E0,%j1,%j1|crnot %E0,%j1}"
14865 [(set_attr "type" "cr_logical,delayed_cr")])
14867 ;; If we are comparing the result of two comparisons, this can be done
14868 ;; using creqv or crxor.
14870 (define_insn_and_split ""
14871 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
14872 (compare:CCEQ (match_operator 1 "branch_comparison_operator"
14873 [(match_operand 2 "cc_reg_operand" "y")
14875 (match_operator 3 "branch_comparison_operator"
14876 [(match_operand 4 "cc_reg_operand" "y")
14881 [(set (match_dup 0) (compare:CCEQ (xor:SI (match_dup 1) (match_dup 3))
14885 int positive_1, positive_2;
14887 positive_1 = branch_positive_comparison_operator (operands[1],
14888 GET_MODE (operands[1]));
14889 positive_2 = branch_positive_comparison_operator (operands[3],
14890 GET_MODE (operands[3]));
14893 operands[1] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[2]),
14894 GET_CODE (operands[1])),
14896 operands[2], const0_rtx);
14897 else if (GET_MODE (operands[1]) != SImode)
14898 operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]), SImode,
14899 operands[2], const0_rtx);
14902 operands[3] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[4]),
14903 GET_CODE (operands[3])),
14905 operands[4], const0_rtx);
14906 else if (GET_MODE (operands[3]) != SImode)
14907 operands[3] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
14908 operands[4], const0_rtx);
14910 if (positive_1 == positive_2)
14912 operands[1] = gen_rtx_NOT (SImode, operands[1]);
14913 operands[5] = constm1_rtx;
14917 operands[5] = const1_rtx;
14921 ;; Unconditional branch and return.
14923 (define_insn "jump"
14925 (label_ref (match_operand 0 "" "")))]
14928 [(set_attr "type" "branch")])
14930 (define_insn "return"
14934 [(set_attr "type" "jmpreg")])
14936 (define_expand "indirect_jump"
14937 [(set (pc) (match_operand 0 "register_operand" ""))])
14939 (define_insn "*indirect_jump<mode>"
14940 [(set (pc) (match_operand:P 0 "register_operand" "c,*l"))]
14945 [(set_attr "type" "jmpreg")])
14947 ;; Table jump for switch statements:
14948 (define_expand "tablejump"
14949 [(use (match_operand 0 "" ""))
14950 (use (label_ref (match_operand 1 "" "")))]
14955 emit_jump_insn (gen_tablejumpsi (operands[0], operands[1]));
14957 emit_jump_insn (gen_tablejumpdi (operands[0], operands[1]));
14961 (define_expand "tablejumpsi"
14962 [(set (match_dup 3)
14963 (plus:SI (match_operand:SI 0 "" "")
14965 (parallel [(set (pc) (match_dup 3))
14966 (use (label_ref (match_operand 1 "" "")))])]
14969 { operands[0] = force_reg (SImode, operands[0]);
14970 operands[2] = force_reg (SImode, gen_rtx_LABEL_REF (SImode, operands[1]));
14971 operands[3] = gen_reg_rtx (SImode);
14974 (define_expand "tablejumpdi"
14975 [(set (match_dup 4)
14976 (sign_extend:DI (match_operand:SI 0 "lwa_operand" "")))
14978 (plus:DI (match_dup 4)
14980 (parallel [(set (pc) (match_dup 3))
14981 (use (label_ref (match_operand 1 "" "")))])]
14984 { operands[2] = force_reg (DImode, gen_rtx_LABEL_REF (DImode, operands[1]));
14985 operands[3] = gen_reg_rtx (DImode);
14986 operands[4] = gen_reg_rtx (DImode);
14989 (define_insn "*tablejump<mode>_internal1"
14991 (match_operand:P 0 "register_operand" "c,*l"))
14992 (use (label_ref (match_operand 1 "" "")))]
14997 [(set_attr "type" "jmpreg")])
15002 "{cror 0,0,0|nop}")
15004 ;; Define the subtract-one-and-jump insns, starting with the template
15005 ;; so loop.c knows what to generate.
15007 (define_expand "doloop_end"
15008 [(use (match_operand 0 "" "")) ; loop pseudo
15009 (use (match_operand 1 "" "")) ; iterations; zero if unknown
15010 (use (match_operand 2 "" "")) ; max iterations
15011 (use (match_operand 3 "" "")) ; loop level
15012 (use (match_operand 4 "" ""))] ; label
15016 /* Only use this on innermost loops. */
15017 if (INTVAL (operands[3]) > 1)
15021 if (GET_MODE (operands[0]) != DImode)
15023 emit_jump_insn (gen_ctrdi (operands[0], operands[4]));
15027 if (GET_MODE (operands[0]) != SImode)
15029 emit_jump_insn (gen_ctrsi (operands[0], operands[4]));
15034 (define_expand "ctr<mode>"
15035 [(parallel [(set (pc)
15036 (if_then_else (ne (match_operand:P 0 "register_operand" "")
15038 (label_ref (match_operand 1 "" ""))
15041 (plus:P (match_dup 0)
15043 (clobber (match_scratch:CC 2 ""))
15044 (clobber (match_scratch:P 3 ""))])]
15048 ;; We need to be able to do this for any operand, including MEM, or we
15049 ;; will cause reload to blow up since we don't allow output reloads on
15051 ;; For the length attribute to be calculated correctly, the
15052 ;; label MUST be operand 0.
15054 (define_insn "*ctr<mode>_internal1"
15056 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
15058 (label_ref (match_operand 0 "" ""))
15060 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
15061 (plus:P (match_dup 1)
15063 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
15064 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
15068 if (which_alternative != 0)
15070 else if (get_attr_length (insn) == 4)
15071 return \"{bdn|bdnz} %l0\";
15073 return \"bdz $+8\;b %l0\";
15075 [(set_attr "type" "branch")
15076 (set_attr "length" "*,12,16,16")])
15078 (define_insn "*ctr<mode>_internal2"
15080 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
15083 (label_ref (match_operand 0 "" ""))))
15084 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
15085 (plus:P (match_dup 1)
15087 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
15088 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
15092 if (which_alternative != 0)
15094 else if (get_attr_length (insn) == 4)
15095 return \"bdz %l0\";
15097 return \"{bdn|bdnz} $+8\;b %l0\";
15099 [(set_attr "type" "branch")
15100 (set_attr "length" "*,12,16,16")])
15102 ;; Similar but use EQ
15104 (define_insn "*ctr<mode>_internal5"
15106 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
15108 (label_ref (match_operand 0 "" ""))
15110 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
15111 (plus:P (match_dup 1)
15113 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
15114 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
15118 if (which_alternative != 0)
15120 else if (get_attr_length (insn) == 4)
15121 return \"bdz %l0\";
15123 return \"{bdn|bdnz} $+8\;b %l0\";
15125 [(set_attr "type" "branch")
15126 (set_attr "length" "*,12,16,16")])
15128 (define_insn "*ctr<mode>_internal6"
15130 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
15133 (label_ref (match_operand 0 "" ""))))
15134 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
15135 (plus:P (match_dup 1)
15137 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
15138 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
15142 if (which_alternative != 0)
15144 else if (get_attr_length (insn) == 4)
15145 return \"{bdn|bdnz} %l0\";
15147 return \"bdz $+8\;b %l0\";
15149 [(set_attr "type" "branch")
15150 (set_attr "length" "*,12,16,16")])
15152 ;; Now the splitters if we could not allocate the CTR register
15156 (if_then_else (match_operator 2 "comparison_operator"
15157 [(match_operand:P 1 "gpc_reg_operand" "")
15159 (match_operand 5 "" "")
15160 (match_operand 6 "" "")))
15161 (set (match_operand:P 0 "gpc_reg_operand" "")
15162 (plus:P (match_dup 1) (const_int -1)))
15163 (clobber (match_scratch:CC 3 ""))
15164 (clobber (match_scratch:P 4 ""))]
15166 [(parallel [(set (match_dup 3)
15167 (compare:CC (plus:P (match_dup 1)
15171 (plus:P (match_dup 1)
15173 (set (pc) (if_then_else (match_dup 7)
15177 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
15178 operands[3], const0_rtx); }")
15182 (if_then_else (match_operator 2 "comparison_operator"
15183 [(match_operand:P 1 "gpc_reg_operand" "")
15185 (match_operand 5 "" "")
15186 (match_operand 6 "" "")))
15187 (set (match_operand:P 0 "nonimmediate_operand" "")
15188 (plus:P (match_dup 1) (const_int -1)))
15189 (clobber (match_scratch:CC 3 ""))
15190 (clobber (match_scratch:P 4 ""))]
15191 "reload_completed && ! gpc_reg_operand (operands[0], SImode)"
15192 [(parallel [(set (match_dup 3)
15193 (compare:CC (plus:P (match_dup 1)
15197 (plus:P (match_dup 1)
15201 (set (pc) (if_then_else (match_dup 7)
15205 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
15206 operands[3], const0_rtx); }")
15208 (define_insn "trap"
15209 [(trap_if (const_int 1) (const_int 0))]
15212 [(set_attr "type" "trap")])
15214 (define_expand "ctrap<mode>4"
15215 [(trap_if (match_operator 0 "ordered_comparison_operator"
15216 [(match_operand:GPR 1 "register_operand")
15217 (match_operand:GPR 2 "reg_or_short_operand")])
15218 (match_operand 3 "zero_constant" ""))]
15223 [(trap_if (match_operator 0 "ordered_comparison_operator"
15224 [(match_operand:GPR 1 "register_operand" "r")
15225 (match_operand:GPR 2 "reg_or_short_operand" "rI")])
15228 "{t|t<wd>}%V0%I2 %1,%2"
15229 [(set_attr "type" "trap")])
15231 ;; Insns related to generating the function prologue and epilogue.
15233 (define_expand "prologue"
15234 [(use (const_int 0))]
15235 "TARGET_SCHED_PROLOG"
15238 rs6000_emit_prologue ();
15242 (define_insn "*movesi_from_cr_one"
15243 [(match_parallel 0 "mfcr_operation"
15244 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
15245 (unspec:SI [(match_operand:CC 2 "cc_reg_operand" "y")
15246 (match_operand 3 "immediate_operand" "n")]
15247 UNSPEC_MOVESI_FROM_CR))])]
15253 for (i = 0; i < XVECLEN (operands[0], 0); i++)
15255 mask = INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
15256 operands[4] = GEN_INT (mask);
15257 output_asm_insn (\"mfcr %1,%4\", operands);
15261 [(set_attr "type" "mfcrf")])
15263 (define_insn "movesi_from_cr"
15264 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
15265 (unspec:SI [(reg:CC CR0_REGNO) (reg:CC CR1_REGNO)
15266 (reg:CC CR2_REGNO) (reg:CC CR3_REGNO)
15267 (reg:CC CR4_REGNO) (reg:CC CR5_REGNO)
15268 (reg:CC CR6_REGNO) (reg:CC CR7_REGNO)]
15269 UNSPEC_MOVESI_FROM_CR))]
15272 [(set_attr "type" "mfcr")])
15274 (define_insn "*stmw"
15275 [(match_parallel 0 "stmw_operation"
15276 [(set (match_operand:SI 1 "memory_operand" "=m")
15277 (match_operand:SI 2 "gpc_reg_operand" "r"))])]
15280 [(set_attr "type" "store_ux")])
15282 (define_insn "*save_gpregs_<mode>"
15283 [(match_parallel 0 "any_parallel_operand"
15284 [(clobber (reg:P 65))
15285 (use (match_operand:P 1 "symbol_ref_operand" "s"))
15286 (use (match_operand:P 2 "gpc_reg_operand" "r"))
15287 (set (match_operand:P 3 "memory_operand" "=m")
15288 (match_operand:P 4 "gpc_reg_operand" "r"))])]
15291 [(set_attr "type" "branch")
15292 (set_attr "length" "4")])
15294 (define_insn "*save_fpregs_<mode>"
15295 [(match_parallel 0 "any_parallel_operand"
15296 [(clobber (reg:P 65))
15297 (use (match_operand:P 1 "symbol_ref_operand" "s"))
15298 (use (match_operand:P 2 "gpc_reg_operand" "r"))
15299 (set (match_operand:DF 3 "memory_operand" "=m")
15300 (match_operand:DF 4 "gpc_reg_operand" "d"))])]
15303 [(set_attr "type" "branch")
15304 (set_attr "length" "4")])
15306 ; These are to explain that changes to the stack pointer should
15307 ; not be moved over stores to stack memory.
15308 (define_insn "stack_tie"
15309 [(set (match_operand:BLK 0 "memory_operand" "+m")
15310 (unspec:BLK [(match_dup 0)] UNSPEC_TIE))]
15313 [(set_attr "length" "0")])
15315 ; Like stack_tie, but depend on both fp and sp based memory.
15316 (define_insn "frame_tie"
15317 [(set (match_operand:BLK 0 "memory_operand" "+m")
15318 (unspec:BLK [(match_dup 0)
15319 (match_operand:BLK 1 "memory_operand" "m")] UNSPEC_TIE))]
15322 [(set_attr "length" "0")])
15325 (define_expand "epilogue"
15326 [(use (const_int 0))]
15327 "TARGET_SCHED_PROLOG"
15330 rs6000_emit_epilogue (FALSE);
15334 ; On some processors, doing the mtcrf one CC register at a time is
15335 ; faster (like on the 604e). On others, doing them all at once is
15336 ; faster; for instance, on the 601 and 750.
15338 (define_expand "movsi_to_cr_one"
15339 [(set (match_operand:CC 0 "cc_reg_operand" "")
15340 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "")
15341 (match_dup 2)] UNSPEC_MOVESI_TO_CR))]
15343 "operands[2] = GEN_INT (1 << (75 - REGNO (operands[0])));")
15345 (define_insn "*movsi_to_cr"
15346 [(match_parallel 0 "mtcrf_operation"
15347 [(set (match_operand:CC 1 "cc_reg_operand" "=y")
15348 (unspec:CC [(match_operand:SI 2 "gpc_reg_operand" "r")
15349 (match_operand 3 "immediate_operand" "n")]
15350 UNSPEC_MOVESI_TO_CR))])]
15356 for (i = 0; i < XVECLEN (operands[0], 0); i++)
15357 mask |= INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
15358 operands[4] = GEN_INT (mask);
15359 return \"mtcrf %4,%2\";
15361 [(set_attr "type" "mtcr")])
15363 (define_insn "*mtcrfsi"
15364 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
15365 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
15366 (match_operand 2 "immediate_operand" "n")]
15367 UNSPEC_MOVESI_TO_CR))]
15368 "GET_CODE (operands[0]) == REG
15369 && CR_REGNO_P (REGNO (operands[0]))
15370 && GET_CODE (operands[2]) == CONST_INT
15371 && INTVAL (operands[2]) == 1 << (75 - REGNO (operands[0]))"
15373 [(set_attr "type" "mtcr")])
15375 ; The load-multiple instructions have similar properties.
15376 ; Note that "load_multiple" is a name known to the machine-independent
15377 ; code that actually corresponds to the PowerPC load-string.
15379 (define_insn "*lmw"
15380 [(match_parallel 0 "lmw_operation"
15381 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
15382 (match_operand:SI 2 "memory_operand" "m"))])]
15385 [(set_attr "type" "load_ux")
15386 (set_attr "cell_micro" "always")])
15388 (define_insn "*return_internal_<mode>"
15390 (use (match_operand:P 0 "register_operand" "lc"))]
15393 [(set_attr "type" "jmpreg")])
15395 ; FIXME: This would probably be somewhat simpler if the Cygnus sibcall
15396 ; stuff was in GCC. Oh, and "any_parallel_operand" is a bit flexible...
15398 (define_insn "*restore_gpregs_<mode>"
15399 [(match_parallel 0 "any_parallel_operand"
15400 [(clobber (match_operand:P 1 "register_operand" "=l"))
15401 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15402 (use (match_operand:P 3 "gpc_reg_operand" "r"))
15403 (set (match_operand:P 4 "gpc_reg_operand" "=r")
15404 (match_operand:P 5 "memory_operand" "m"))])]
15407 [(set_attr "type" "branch")
15408 (set_attr "length" "4")])
15410 (define_insn "*return_and_restore_gpregs_<mode>"
15411 [(match_parallel 0 "any_parallel_operand"
15413 (clobber (match_operand:P 1 "register_operand" "=l"))
15414 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15415 (use (match_operand:P 3 "gpc_reg_operand" "r"))
15416 (set (match_operand:P 4 "gpc_reg_operand" "=r")
15417 (match_operand:P 5 "memory_operand" "m"))])]
15420 [(set_attr "type" "branch")
15421 (set_attr "length" "4")])
15423 (define_insn "*return_and_restore_fpregs_<mode>"
15424 [(match_parallel 0 "any_parallel_operand"
15426 (clobber (match_operand:P 1 "register_operand" "=l"))
15427 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15428 (use (match_operand:P 3 "gpc_reg_operand" "r"))
15429 (set (match_operand:DF 4 "gpc_reg_operand" "=d")
15430 (match_operand:DF 5 "memory_operand" "m"))])]
15433 [(set_attr "type" "branch")
15434 (set_attr "length" "4")])
15436 (define_insn "*return_and_restore_fpregs_aix_<mode>"
15437 [(match_parallel 0 "any_parallel_operand"
15439 (use (match_operand:P 1 "register_operand" "l"))
15440 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15441 (use (match_operand:P 3 "gpc_reg_operand" "r"))
15442 (set (match_operand:DF 4 "gpc_reg_operand" "=d")
15443 (match_operand:DF 5 "memory_operand" "m"))])]
15446 [(set_attr "type" "branch")
15447 (set_attr "length" "4")])
15449 ; This is used in compiling the unwind routines.
15450 (define_expand "eh_return"
15451 [(use (match_operand 0 "general_operand" ""))]
15456 emit_insn (gen_eh_set_lr_si (operands[0]));
15458 emit_insn (gen_eh_set_lr_di (operands[0]));
15462 ; We can't expand this before we know where the link register is stored.
15463 (define_insn "eh_set_lr_<mode>"
15464 [(unspec_volatile [(match_operand:P 0 "register_operand" "r")]
15466 (clobber (match_scratch:P 1 "=&b"))]
15471 [(unspec_volatile [(match_operand 0 "register_operand" "")] UNSPECV_EH_RR)
15472 (clobber (match_scratch 1 ""))]
15477 rs6000_emit_eh_reg_restore (operands[0], operands[1]);
15481 (define_insn "prefetch"
15482 [(prefetch (match_operand 0 "indexed_or_indirect_address" "a")
15483 (match_operand:SI 1 "const_int_operand" "n")
15484 (match_operand:SI 2 "const_int_operand" "n"))]
15488 if (GET_CODE (operands[0]) == REG)
15489 return INTVAL (operands[1]) ? \"dcbtst 0,%0\" : \"dcbt 0,%0\";
15490 return INTVAL (operands[1]) ? \"dcbtst %a0\" : \"dcbt %a0\";
15492 [(set_attr "type" "load")])
15494 (define_insn "bpermd_<mode>"
15495 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
15496 (unspec:P [(match_operand:P 1 "gpc_reg_operand" "r")
15497 (match_operand:P 2 "gpc_reg_operand" "r")] UNSPEC_BPERM))]
15500 [(set_attr "type" "integer")])
15504 (include "sync.md")
15505 (include "vector.md")
15507 (include "altivec.md")
15510 (include "paired.md")