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"
11008 if (TARGET_CMODEL != CMODEL_SMALL)
11009 return "addis %0,%1,%2@got@tlsgd@ha\;addi %0,%0,%2@got@tlsgd@l\;bl %z3\;%.";
11011 return "addi %0,%1,%2@got@tlsgd\;bl %z3\;%.";
11013 "&& TARGET_TLS_MARKERS"
11014 [(set (match_dup 0)
11015 (unspec:TLSmode [(match_dup 1)
11018 (parallel [(set (match_dup 0)
11019 (call (mem:TLSmode (match_dup 3))
11021 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD)
11022 (clobber (reg:SI LR_REGNO))])]
11024 [(set_attr "type" "two")
11025 (set (attr "length")
11026 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
11030 (define_insn_and_split "tls_gd_sysv<TLSmode:tls_sysv_suffix>"
11031 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11032 (call (mem:TLSmode (match_operand:TLSmode 3 "symbol_ref_operand" "s"))
11033 (match_operand 4 "" "g")))
11034 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11035 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11037 (clobber (reg:SI LR_REGNO))]
11038 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4"
11042 if (TARGET_SECURE_PLT && flag_pic == 2)
11043 return "addi %0,%1,%2@got@tlsgd\;bl %z3+32768@plt";
11045 return "addi %0,%1,%2@got@tlsgd\;bl %z3@plt";
11048 return "addi %0,%1,%2@got@tlsgd\;bl %z3";
11050 "&& TARGET_TLS_MARKERS"
11051 [(set (match_dup 0)
11052 (unspec:TLSmode [(match_dup 1)
11055 (parallel [(set (match_dup 0)
11056 (call (mem:TLSmode (match_dup 3))
11058 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD)
11059 (clobber (reg:SI LR_REGNO))])]
11061 [(set_attr "type" "two")
11062 (set_attr "length" "8")])
11064 (define_insn_and_split "*tls_gd<TLSmode:tls_abi_suffix>"
11065 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11066 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11067 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11069 "HAVE_AS_TLS && TARGET_TLS_MARKERS"
11070 "addi %0,%1,%2@got@tlsgd"
11071 "&& TARGET_CMODEL != CMODEL_SMALL"
11072 [(set (match_dup 3)
11073 (plus:TLSmode (match_dup 1)
11075 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD))))
11077 (lo_sum:TLSmode (match_dup 3)
11078 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD)))]
11081 operands[3] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
11083 [(set (attr "length")
11084 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
11088 (define_insn "*tls_gd_high<TLSmode:tls_abi_suffix>"
11089 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11090 (plus:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11092 (unspec:TLSmode [(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11094 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
11095 "addis %0,%1,%2@got@tlsgd@ha"
11096 [(set_attr "length" "4")])
11098 (define_insn "*tls_gd_low<TLSmode:tls_abi_suffix>"
11099 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11100 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11101 (unspec:TLSmode [(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11103 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
11104 "addi %0,%1,%2@got@tlsgd@l"
11105 [(set_attr "length" "4")])
11107 (define_insn "*tls_gd_call_aix<TLSmode:tls_abi_suffix>"
11108 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11109 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
11110 (match_operand 2 "" "g")))
11111 (unspec:TLSmode [(match_operand:TLSmode 3 "rs6000_tls_symbol_ref" "")]
11113 (clobber (reg:SI LR_REGNO))]
11114 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX && TARGET_TLS_MARKERS"
11115 "bl %z1(%3@tlsgd)\;%."
11116 [(set_attr "type" "branch")
11117 (set_attr "length" "8")])
11119 (define_insn "*tls_gd_call_sysv<TLSmode:tls_abi_suffix>"
11120 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11121 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
11122 (match_operand 2 "" "g")))
11123 (unspec:TLSmode [(match_operand:TLSmode 3 "rs6000_tls_symbol_ref" "")]
11125 (clobber (reg:SI LR_REGNO))]
11126 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4 && TARGET_TLS_MARKERS"
11130 if (TARGET_SECURE_PLT && flag_pic == 2)
11131 return "bl %z1+32768(%3@tlsgd)@plt";
11132 return "bl %z1(%3@tlsgd)@plt";
11134 return "bl %z1(%3@tlsgd)";
11136 [(set_attr "type" "branch")
11137 (set_attr "length" "4")])
11139 (define_insn_and_split "tls_ld_aix<TLSmode:tls_abi_suffix>"
11140 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11141 (call (mem:TLSmode (match_operand:TLSmode 2 "symbol_ref_operand" "s"))
11142 (match_operand 3 "" "g")))
11143 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
11145 (clobber (reg:SI LR_REGNO))]
11146 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX"
11148 if (TARGET_CMODEL != CMODEL_SMALL)
11149 return "addis %0,%1,%&@got@tlsld@ha\;addi %0,%0,%&@got@tlsld@l\;bl %z2\;%.";
11151 return "addi %0,%1,%&@got@tlsld\;bl %z2\;%.";
11153 "&& TARGET_TLS_MARKERS"
11154 [(set (match_dup 0)
11155 (unspec:TLSmode [(match_dup 1)]
11157 (parallel [(set (match_dup 0)
11158 (call (mem:TLSmode (match_dup 2))
11160 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
11161 (clobber (reg:SI LR_REGNO))])]
11163 [(set_attr "type" "two")
11164 (set (attr "length")
11165 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
11169 (define_insn_and_split "tls_ld_sysv<TLSmode:tls_sysv_suffix>"
11170 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11171 (call (mem:TLSmode (match_operand:TLSmode 2 "symbol_ref_operand" "s"))
11172 (match_operand 3 "" "g")))
11173 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
11175 (clobber (reg:SI LR_REGNO))]
11176 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4"
11180 if (TARGET_SECURE_PLT && flag_pic == 2)
11181 return "addi %0,%1,%&@got@tlsld\;bl %z2+32768@plt";
11183 return "addi %0,%1,%&@got@tlsld\;bl %z2@plt";
11186 return "addi %0,%1,%&@got@tlsld\;bl %z2";
11188 "&& TARGET_TLS_MARKERS"
11189 [(set (match_dup 0)
11190 (unspec:TLSmode [(match_dup 1)]
11192 (parallel [(set (match_dup 0)
11193 (call (mem:TLSmode (match_dup 2))
11195 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
11196 (clobber (reg:SI LR_REGNO))])]
11198 [(set_attr "length" "8")])
11200 (define_insn_and_split "*tls_ld<TLSmode:tls_abi_suffix>"
11201 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11202 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
11204 "HAVE_AS_TLS && TARGET_TLS_MARKERS"
11205 "addi %0,%1,%&@got@tlsld"
11206 "&& TARGET_CMODEL != CMODEL_SMALL"
11207 [(set (match_dup 2)
11208 (plus:TLSmode (match_dup 1)
11210 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD))))
11212 (lo_sum:TLSmode (match_dup 2)
11213 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)))]
11216 operands[2] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
11218 [(set (attr "length")
11219 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
11223 (define_insn "*tls_ld_high<TLSmode:tls_abi_suffix>"
11224 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11225 (plus:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11227 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD))))]
11228 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
11229 "addis %0,%1,%&@got@tlsld@ha"
11230 [(set_attr "length" "4")])
11232 (define_insn "*tls_ld_low<TLSmode:tls_abi_suffix>"
11233 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11234 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11235 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)))]
11236 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
11237 "addi %0,%1,%&@got@tlsld@l"
11238 [(set_attr "length" "4")])
11240 (define_insn "*tls_ld_call_aix<TLSmode:tls_abi_suffix>"
11241 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11242 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
11243 (match_operand 2 "" "g")))
11244 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
11245 (clobber (reg:SI LR_REGNO))]
11246 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX && TARGET_TLS_MARKERS"
11247 "bl %z1(%&@tlsld)\;%."
11248 [(set_attr "type" "branch")
11249 (set_attr "length" "8")])
11251 (define_insn "*tls_ld_call_sysv<TLSmode:tls_abi_suffix>"
11252 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11253 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
11254 (match_operand 2 "" "g")))
11255 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
11256 (clobber (reg:SI LR_REGNO))]
11257 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4 && TARGET_TLS_MARKERS"
11261 if (TARGET_SECURE_PLT && flag_pic == 2)
11262 return "bl %z1+32768(%&@tlsld)@plt";
11263 return "bl %z1(%&@tlsld)@plt";
11265 return "bl %z1(%&@tlsld)";
11267 [(set_attr "type" "branch")
11268 (set_attr "length" "4")])
11270 (define_insn "tls_dtprel_<TLSmode:tls_abi_suffix>"
11271 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11272 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11273 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11274 UNSPEC_TLSDTPREL))]
11276 "addi %0,%1,%2@dtprel")
11278 (define_insn "tls_dtprel_ha_<TLSmode:tls_abi_suffix>"
11279 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11280 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11281 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11282 UNSPEC_TLSDTPRELHA))]
11284 "addis %0,%1,%2@dtprel@ha")
11286 (define_insn "tls_dtprel_lo_<TLSmode:tls_abi_suffix>"
11287 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11288 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11289 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11290 UNSPEC_TLSDTPRELLO))]
11292 "addi %0,%1,%2@dtprel@l")
11294 (define_insn_and_split "tls_got_dtprel_<TLSmode:tls_abi_suffix>"
11295 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11296 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11297 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11298 UNSPEC_TLSGOTDTPREL))]
11300 "l<TLSmode:tls_insn_suffix> %0,%2@got@dtprel(%1)"
11301 "&& TARGET_CMODEL != CMODEL_SMALL"
11302 [(set (match_dup 3)
11303 (plus:TLSmode (match_dup 1)
11305 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGOTDTPREL))))
11307 (lo_sum:TLSmode (match_dup 3)
11308 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGOTDTPREL)))]
11311 operands[3] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
11313 [(set (attr "length")
11314 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
11318 (define_insn "*tls_got_dtprel_high<TLSmode:tls_abi_suffix>"
11319 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11320 (plus:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11322 (unspec:TLSmode [(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11323 UNSPEC_TLSGOTDTPREL))))]
11324 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
11325 "addis %0,%1,%2@got@dtprel@ha"
11326 [(set_attr "length" "4")])
11328 (define_insn "*tls_got_dtprel_low<TLSmode:tls_abi_suffix>"
11329 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11330 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11331 (unspec:TLSmode [(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11332 UNSPEC_TLSGOTDTPREL)))]
11333 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
11334 "l<TLSmode:tls_insn_suffix> %0,%2@got@dtprel@l(%1)"
11335 [(set_attr "length" "4")])
11337 (define_insn "tls_tprel_<TLSmode:tls_abi_suffix>"
11338 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11339 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11340 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11343 "addi %0,%1,%2@tprel")
11345 (define_insn "tls_tprel_ha_<TLSmode:tls_abi_suffix>"
11346 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11347 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11348 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11349 UNSPEC_TLSTPRELHA))]
11351 "addis %0,%1,%2@tprel@ha")
11353 (define_insn "tls_tprel_lo_<TLSmode:tls_abi_suffix>"
11354 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11355 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11356 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11357 UNSPEC_TLSTPRELLO))]
11359 "addi %0,%1,%2@tprel@l")
11361 ;; "b" output constraint here and on tls_tls input to support linker tls
11362 ;; optimization. The linker may edit the instructions emitted by a
11363 ;; tls_got_tprel/tls_tls pair to addis,addi.
11364 (define_insn_and_split "tls_got_tprel_<TLSmode:tls_abi_suffix>"
11365 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11366 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11367 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11368 UNSPEC_TLSGOTTPREL))]
11370 "l<TLSmode:tls_insn_suffix> %0,%2@got@tprel(%1)"
11371 "&& TARGET_CMODEL != CMODEL_SMALL"
11372 [(set (match_dup 3)
11373 (plus:TLSmode (match_dup 1)
11375 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGOTTPREL))))
11377 (lo_sum:TLSmode (match_dup 3)
11378 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGOTTPREL)))]
11381 operands[3] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
11383 [(set (attr "length")
11384 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
11388 (define_insn "*tls_got_tprel_high<TLSmode:tls_abi_suffix>"
11389 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11390 (plus:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11392 (unspec:TLSmode [(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11393 UNSPEC_TLSGOTTPREL))))]
11394 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
11395 "addis %0,%1,%2@got@tprel@ha"
11396 [(set_attr "length" "4")])
11398 (define_insn "*tls_got_tprel_low<TLSmode:tls_abi_suffix>"
11399 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11400 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11401 (unspec:TLSmode [(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11402 UNSPEC_TLSGOTTPREL)))]
11403 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
11404 "l<TLSmode:tls_insn_suffix> %0,%2@got@tprel@l(%1)"
11405 [(set_attr "length" "4")])
11407 (define_insn "tls_tls_<TLSmode:tls_abi_suffix>"
11408 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11409 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11410 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11413 "add %0,%1,%2@tls")
11415 ;; Next come insns related to the calling sequence.
11417 ;; First, an insn to allocate new stack space for dynamic use (e.g., alloca).
11418 ;; We move the back-chain and decrement the stack pointer.
11420 (define_expand "allocate_stack"
11421 [(set (match_operand 0 "gpc_reg_operand" "")
11422 (minus (reg 1) (match_operand 1 "reg_or_short_operand" "")))
11424 (minus (reg 1) (match_dup 1)))]
11427 { rtx chain = gen_reg_rtx (Pmode);
11428 rtx stack_bot = gen_rtx_MEM (Pmode, stack_pointer_rtx);
11430 rtx insn, par, set, mem;
11432 emit_move_insn (chain, stack_bot);
11434 /* Check stack bounds if necessary. */
11435 if (crtl->limit_stack)
11438 available = expand_binop (Pmode, sub_optab,
11439 stack_pointer_rtx, stack_limit_rtx,
11440 NULL_RTX, 1, OPTAB_WIDEN);
11441 emit_insn (gen_cond_trap (LTU, available, operands[1], const0_rtx));
11444 if (GET_CODE (operands[1]) != CONST_INT
11445 || INTVAL (operands[1]) < -32767
11446 || INTVAL (operands[1]) > 32768)
11448 neg_op0 = gen_reg_rtx (Pmode);
11450 emit_insn (gen_negsi2 (neg_op0, operands[1]));
11452 emit_insn (gen_negdi2 (neg_op0, operands[1]));
11455 neg_op0 = GEN_INT (- INTVAL (operands[1]));
11457 insn = emit_insn ((* ((TARGET_32BIT) ? gen_movsi_update_stack
11458 : gen_movdi_di_update_stack))
11459 (stack_pointer_rtx, stack_pointer_rtx, neg_op0,
11461 /* Since we didn't use gen_frame_mem to generate the MEM, grab
11462 it now and set the alias set/attributes. The above gen_*_update
11463 calls will generate a PARALLEL with the MEM set being the first
11465 par = PATTERN (insn);
11466 gcc_assert (GET_CODE (par) == PARALLEL);
11467 set = XVECEXP (par, 0, 0);
11468 gcc_assert (GET_CODE (set) == SET);
11469 mem = SET_DEST (set);
11470 gcc_assert (MEM_P (mem));
11471 MEM_NOTRAP_P (mem) = 1;
11472 set_mem_alias_set (mem, get_frame_alias_set ());
11474 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
11478 ;; These patterns say how to save and restore the stack pointer. We need not
11479 ;; save the stack pointer at function level since we are careful to
11480 ;; preserve the backchain. At block level, we have to restore the backchain
11481 ;; when we restore the stack pointer.
11483 ;; For nonlocal gotos, we must save both the stack pointer and its
11484 ;; backchain and restore both. Note that in the nonlocal case, the
11485 ;; save area is a memory location.
11487 (define_expand "save_stack_function"
11488 [(match_operand 0 "any_operand" "")
11489 (match_operand 1 "any_operand" "")]
11493 (define_expand "restore_stack_function"
11494 [(match_operand 0 "any_operand" "")
11495 (match_operand 1 "any_operand" "")]
11499 ;; Adjust stack pointer (op0) to a new value (op1).
11500 ;; First copy old stack backchain to new location, and ensure that the
11501 ;; scheduler won't reorder the sp assignment before the backchain write.
11502 (define_expand "restore_stack_block"
11503 [(set (match_dup 2) (match_dup 3))
11504 (set (match_dup 4) (match_dup 2))
11505 (set (match_dup 5) (unspec:BLK [(match_dup 5)] UNSPEC_TIE))
11506 (set (match_operand 0 "register_operand" "")
11507 (match_operand 1 "register_operand" ""))]
11511 operands[1] = force_reg (Pmode, operands[1]);
11512 operands[2] = gen_reg_rtx (Pmode);
11513 operands[3] = gen_frame_mem (Pmode, operands[0]);
11514 operands[4] = gen_frame_mem (Pmode, operands[1]);
11515 operands[5] = gen_frame_mem (BLKmode, operands[0]);
11518 (define_expand "save_stack_nonlocal"
11519 [(set (match_dup 3) (match_dup 4))
11520 (set (match_operand 0 "memory_operand" "") (match_dup 3))
11521 (set (match_dup 2) (match_operand 1 "register_operand" ""))]
11525 int units_per_word = (TARGET_32BIT) ? 4 : 8;
11527 /* Copy the backchain to the first word, sp to the second. */
11528 operands[0] = adjust_address_nv (operands[0], Pmode, 0);
11529 operands[2] = adjust_address_nv (operands[0], Pmode, units_per_word);
11530 operands[3] = gen_reg_rtx (Pmode);
11531 operands[4] = gen_frame_mem (Pmode, operands[1]);
11534 (define_expand "restore_stack_nonlocal"
11535 [(set (match_dup 2) (match_operand 1 "memory_operand" ""))
11536 (set (match_dup 3) (match_dup 4))
11537 (set (match_dup 5) (match_dup 2))
11538 (set (match_dup 6) (unspec:BLK [(match_dup 6)] UNSPEC_TIE))
11539 (set (match_operand 0 "register_operand" "") (match_dup 3))]
11543 int units_per_word = (TARGET_32BIT) ? 4 : 8;
11545 /* Restore the backchain from the first word, sp from the second. */
11546 operands[2] = gen_reg_rtx (Pmode);
11547 operands[3] = gen_reg_rtx (Pmode);
11548 operands[1] = adjust_address_nv (operands[1], Pmode, 0);
11549 operands[4] = adjust_address_nv (operands[1], Pmode, units_per_word);
11550 operands[5] = gen_frame_mem (Pmode, operands[3]);
11551 operands[6] = gen_frame_mem (BLKmode, operands[0]);
11554 ;; TOC register handling.
11556 ;; Code to initialize the TOC register...
11558 (define_insn "load_toc_aix_si"
11559 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11560 (unspec:SI [(const_int 0)] UNSPEC_TOC))
11561 (use (reg:SI 2))])]
11562 "DEFAULT_ABI == ABI_AIX && TARGET_32BIT"
11566 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
11567 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
11568 operands[2] = gen_rtx_REG (Pmode, 2);
11569 return \"{l|lwz} %0,%1(%2)\";
11571 [(set_attr "type" "load")])
11573 (define_insn "load_toc_aix_di"
11574 [(parallel [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11575 (unspec:DI [(const_int 0)] UNSPEC_TOC))
11576 (use (reg:DI 2))])]
11577 "DEFAULT_ABI == ABI_AIX && TARGET_64BIT"
11581 #ifdef TARGET_RELOCATABLE
11582 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\",
11583 !TARGET_MINIMAL_TOC || TARGET_RELOCATABLE);
11585 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
11588 strcat (buf, \"@toc\");
11589 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
11590 operands[2] = gen_rtx_REG (Pmode, 2);
11591 return \"ld %0,%1(%2)\";
11593 [(set_attr "type" "load")])
11595 (define_insn "load_toc_v4_pic_si"
11596 [(set (reg:SI LR_REGNO)
11597 (unspec:SI [(const_int 0)] UNSPEC_TOC))]
11598 "DEFAULT_ABI == ABI_V4 && flag_pic == 1 && TARGET_32BIT"
11599 "bl _GLOBAL_OFFSET_TABLE_@local-4"
11600 [(set_attr "type" "branch")
11601 (set_attr "length" "4")])
11603 (define_insn "load_toc_v4_PIC_1"
11604 [(set (reg:SI LR_REGNO)
11605 (match_operand:SI 0 "immediate_operand" "s"))
11606 (use (unspec [(match_dup 0)] UNSPEC_TOC))]
11607 "TARGET_ELF && DEFAULT_ABI != ABI_AIX
11608 && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
11609 "bcl 20,31,%0\\n%0:"
11610 [(set_attr "type" "branch")
11611 (set_attr "length" "4")])
11613 (define_insn "load_toc_v4_PIC_1b"
11614 [(set (reg:SI LR_REGNO)
11615 (unspec:SI [(match_operand:SI 0 "immediate_operand" "s")
11616 (label_ref (match_operand 1 "" ""))]
11619 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
11620 "bcl 20,31,$+8\;.long %0-$"
11621 [(set_attr "type" "branch")
11622 (set_attr "length" "8")])
11624 (define_insn "load_toc_v4_PIC_2"
11625 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11626 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
11627 (minus:SI (match_operand:SI 2 "immediate_operand" "s")
11628 (match_operand:SI 3 "immediate_operand" "s")))))]
11629 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
11630 "{l|lwz} %0,%2-%3(%1)"
11631 [(set_attr "type" "load")])
11633 (define_insn "load_toc_v4_PIC_3b"
11634 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
11635 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "r")
11637 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
11638 (match_operand:SI 3 "symbol_ref_operand" "s")))))]
11639 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
11640 "{cau|addis} %0,%1,%2-%3@ha")
11642 (define_insn "load_toc_v4_PIC_3c"
11643 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11644 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
11645 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
11646 (match_operand:SI 3 "symbol_ref_operand" "s"))))]
11647 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
11648 "{cal %0,%2-%3@l(%1)|addi %0,%1,%2-%3@l}")
11650 ;; If the TOC is shared over a translation unit, as happens with all
11651 ;; the kinds of PIC that we support, we need to restore the TOC
11652 ;; pointer only when jumping over units of translation.
11653 ;; On Darwin, we need to reload the picbase.
11655 (define_expand "builtin_setjmp_receiver"
11656 [(use (label_ref (match_operand 0 "" "")))]
11657 "(DEFAULT_ABI == ABI_V4 && flag_pic == 1)
11658 || (TARGET_TOC && TARGET_MINIMAL_TOC)
11659 || (DEFAULT_ABI == ABI_DARWIN && flag_pic)"
11663 if (DEFAULT_ABI == ABI_DARWIN)
11665 rtx picrtx = gen_rtx_SYMBOL_REF (Pmode, MACHOPIC_FUNCTION_BASE_NAME);
11666 rtx picreg = gen_rtx_REG (Pmode, RS6000_PIC_OFFSET_TABLE_REGNUM);
11670 crtl->uses_pic_offset_table = 1;
11671 ASM_GENERATE_INTERNAL_LABEL(tmplab, \"LSJR\",
11672 CODE_LABEL_NUMBER (operands[0]));
11673 tmplabrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (tmplab));
11675 emit_insn (gen_load_macho_picbase (tmplabrtx));
11676 emit_move_insn (picreg, gen_rtx_REG (Pmode, LR_REGNO));
11677 emit_insn (gen_macho_correct_pic (picreg, picreg, picrtx, tmplabrtx));
11681 rs6000_emit_load_toc_table (FALSE);
11685 ;; Elf specific ways of loading addresses for non-PIC code.
11686 ;; The output of this could be r0, but we make a very strong
11687 ;; preference for a base register because it will usually
11688 ;; be needed there.
11689 (define_insn "elf_high"
11690 [(set (match_operand:SI 0 "gpc_reg_operand" "=b*r")
11691 (high:SI (match_operand 1 "" "")))]
11692 "TARGET_ELF && ! TARGET_64BIT"
11693 "{liu|lis} %0,%1@ha")
11695 (define_insn "elf_low"
11696 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11697 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,!*r")
11698 (match_operand 2 "" "")))]
11699 "TARGET_ELF && ! TARGET_64BIT"
11701 {cal|la} %0,%2@l(%1)
11702 {ai|addic} %0,%1,%K2")
11704 ;; Largetoc support
11705 (define_insn "largetoc_high"
11706 [(set (match_operand:DI 0 "gpc_reg_operand" "=b")
11707 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "b")
11708 (high:DI (match_operand:DI 2 "" ""))))]
11709 "TARGET_ELF && TARGET_CMODEL != CMODEL_SMALL"
11710 "{cau|addis} %0,%1,%2@ha")
11712 (define_insn "largetoc_low"
11713 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11714 (lo_sum:DI (match_operand:DI 1 "gpc_reg_operand" "b")
11715 (match_operand:DI 2 "" "")))]
11716 "TARGET_ELF && TARGET_CMODEL != CMODEL_SMALL"
11717 "{cal %0,%2@l(%1)|addi %0,%1,%2@l}")
11719 ;; A function pointer under AIX is a pointer to a data area whose first word
11720 ;; contains the actual address of the function, whose second word contains a
11721 ;; pointer to its TOC, and whose third word contains a value to place in the
11722 ;; static chain register (r11). Note that if we load the static chain, our
11723 ;; "trampoline" need not have any executable code.
11725 (define_expand "call_indirect_aix32"
11726 [(set (match_dup 2)
11727 (mem:SI (match_operand:SI 0 "gpc_reg_operand" "")))
11728 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
11731 (mem:SI (plus:SI (match_dup 0)
11733 (parallel [(call (mem:SI (match_dup 2))
11734 (match_operand 1 "" ""))
11735 (use (mem:SI (plus:SI (match_dup 0) (const_int 4))))
11737 (use (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
11738 (clobber (reg:SI LR_REGNO))])]
11741 { operands[2] = gen_reg_rtx (SImode); }")
11743 (define_expand "call_indirect_aix64"
11744 [(set (match_dup 2)
11745 (mem:DI (match_operand:DI 0 "gpc_reg_operand" "")))
11746 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
11749 (mem:DI (plus:DI (match_dup 0)
11751 (parallel [(call (mem:SI (match_dup 2))
11752 (match_operand 1 "" ""))
11753 (use (mem:DI (plus:DI (match_dup 0) (const_int 8))))
11755 (use (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
11756 (clobber (reg:SI LR_REGNO))])]
11759 { operands[2] = gen_reg_rtx (DImode); }")
11761 (define_expand "call_value_indirect_aix32"
11762 [(set (match_dup 3)
11763 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "")))
11764 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
11767 (mem:SI (plus:SI (match_dup 1)
11769 (parallel [(set (match_operand 0 "" "")
11770 (call (mem:SI (match_dup 3))
11771 (match_operand 2 "" "")))
11772 (use (mem:SI (plus:SI (match_dup 1) (const_int 4))))
11774 (use (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
11775 (clobber (reg:SI LR_REGNO))])]
11778 { operands[3] = gen_reg_rtx (SImode); }")
11780 (define_expand "call_value_indirect_aix64"
11781 [(set (match_dup 3)
11782 (mem:DI (match_operand:DI 1 "gpc_reg_operand" "")))
11783 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
11786 (mem:DI (plus:DI (match_dup 1)
11788 (parallel [(set (match_operand 0 "" "")
11789 (call (mem:SI (match_dup 3))
11790 (match_operand 2 "" "")))
11791 (use (mem:DI (plus:DI (match_dup 1) (const_int 8))))
11793 (use (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
11794 (clobber (reg:SI LR_REGNO))])]
11797 { operands[3] = gen_reg_rtx (DImode); }")
11799 ;; Now the definitions for the call and call_value insns
11800 (define_expand "call"
11801 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
11802 (match_operand 1 "" ""))
11803 (use (match_operand 2 "" ""))
11804 (clobber (reg:SI LR_REGNO))])]
11809 if (MACHOPIC_INDIRECT)
11810 operands[0] = machopic_indirect_call_target (operands[0]);
11813 gcc_assert (GET_CODE (operands[0]) == MEM);
11814 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
11816 operands[0] = XEXP (operands[0], 0);
11818 if (GET_CODE (operands[0]) != SYMBOL_REF
11819 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[0]))
11820 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[2]) & CALL_LONG) != 0))
11822 if (INTVAL (operands[2]) & CALL_LONG)
11823 operands[0] = rs6000_longcall_ref (operands[0]);
11825 switch (DEFAULT_ABI)
11829 operands[0] = force_reg (Pmode, operands[0]);
11833 /* AIX function pointers are really pointers to a three word
11835 emit_call_insn (TARGET_32BIT
11836 ? gen_call_indirect_aix32 (force_reg (SImode,
11839 : gen_call_indirect_aix64 (force_reg (DImode,
11845 gcc_unreachable ();
11850 (define_expand "call_value"
11851 [(parallel [(set (match_operand 0 "" "")
11852 (call (mem:SI (match_operand 1 "address_operand" ""))
11853 (match_operand 2 "" "")))
11854 (use (match_operand 3 "" ""))
11855 (clobber (reg:SI LR_REGNO))])]
11860 if (MACHOPIC_INDIRECT)
11861 operands[1] = machopic_indirect_call_target (operands[1]);
11864 gcc_assert (GET_CODE (operands[1]) == MEM);
11865 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
11867 operands[1] = XEXP (operands[1], 0);
11869 if (GET_CODE (operands[1]) != SYMBOL_REF
11870 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[1]))
11871 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[3]) & CALL_LONG) != 0))
11873 if (INTVAL (operands[3]) & CALL_LONG)
11874 operands[1] = rs6000_longcall_ref (operands[1]);
11876 switch (DEFAULT_ABI)
11880 operands[1] = force_reg (Pmode, operands[1]);
11884 /* AIX function pointers are really pointers to a three word
11886 emit_call_insn (TARGET_32BIT
11887 ? gen_call_value_indirect_aix32 (operands[0],
11891 : gen_call_value_indirect_aix64 (operands[0],
11898 gcc_unreachable ();
11903 ;; Call to function in current module. No TOC pointer reload needed.
11904 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
11905 ;; either the function was not prototyped, or it was prototyped as a
11906 ;; variable argument function. It is > 0 if FP registers were passed
11907 ;; and < 0 if they were not.
11909 (define_insn "*call_local32"
11910 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
11911 (match_operand 1 "" "g,g"))
11912 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11913 (clobber (reg:SI LR_REGNO))]
11914 "(INTVAL (operands[2]) & CALL_LONG) == 0"
11917 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11918 output_asm_insn (\"crxor 6,6,6\", operands);
11920 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11921 output_asm_insn (\"creqv 6,6,6\", operands);
11923 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
11925 [(set_attr "type" "branch")
11926 (set_attr "length" "4,8")])
11928 (define_insn "*call_local64"
11929 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
11930 (match_operand 1 "" "g,g"))
11931 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11932 (clobber (reg:SI LR_REGNO))]
11933 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
11936 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11937 output_asm_insn (\"crxor 6,6,6\", operands);
11939 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11940 output_asm_insn (\"creqv 6,6,6\", operands);
11942 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
11944 [(set_attr "type" "branch")
11945 (set_attr "length" "4,8")])
11947 (define_insn "*call_value_local32"
11948 [(set (match_operand 0 "" "")
11949 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
11950 (match_operand 2 "" "g,g")))
11951 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11952 (clobber (reg:SI LR_REGNO))]
11953 "(INTVAL (operands[3]) & CALL_LONG) == 0"
11956 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11957 output_asm_insn (\"crxor 6,6,6\", operands);
11959 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11960 output_asm_insn (\"creqv 6,6,6\", operands);
11962 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
11964 [(set_attr "type" "branch")
11965 (set_attr "length" "4,8")])
11968 (define_insn "*call_value_local64"
11969 [(set (match_operand 0 "" "")
11970 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
11971 (match_operand 2 "" "g,g")))
11972 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11973 (clobber (reg:SI LR_REGNO))]
11974 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
11977 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11978 output_asm_insn (\"crxor 6,6,6\", operands);
11980 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11981 output_asm_insn (\"creqv 6,6,6\", operands);
11983 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
11985 [(set_attr "type" "branch")
11986 (set_attr "length" "4,8")])
11988 ;; Call to function which may be in another module. Restore the TOC
11989 ;; pointer (r2) after the call unless this is System V.
11990 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
11991 ;; either the function was not prototyped, or it was prototyped as a
11992 ;; variable argument function. It is > 0 if FP registers were passed
11993 ;; and < 0 if they were not.
11995 (define_insn_and_split "*call_indirect_nonlocal_aix32_internal"
11996 [(call (mem:SI (match_operand:SI 0 "register_operand" "c,*l"))
11997 (match_operand 1 "" "g,g"))
11998 (use (mem:SI (plus:SI (match_operand:SI 2 "register_operand" "b,b") (const_int 4))))
12000 (use (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
12001 (clobber (reg:SI LR_REGNO))]
12002 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
12004 "&& reload_completed"
12006 (mem:SI (plus:SI (match_dup 2) (const_int 4))))
12007 (parallel [(call (mem:SI (match_dup 0))
12012 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
12013 (clobber (reg:SI LR_REGNO))])]
12015 [(set_attr "type" "jmpreg")
12016 (set_attr "length" "12")])
12018 (define_insn "*call_indirect_nonlocal_aix32"
12019 [(call (mem:SI (match_operand:SI 0 "register_operand" "c,*l"))
12020 (match_operand 1 "" "g,g"))
12024 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
12025 (clobber (reg:SI LR_REGNO))]
12026 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX && reload_completed"
12027 "b%T0l\;{l|lwz} 2,20(1)"
12028 [(set_attr "type" "jmpreg")
12029 (set_attr "length" "8")])
12031 (define_insn "*call_nonlocal_aix32"
12032 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
12033 (match_operand 1 "" "g"))
12034 (use (match_operand:SI 2 "immediate_operand" "O"))
12035 (clobber (reg:SI LR_REGNO))]
12037 && DEFAULT_ABI == ABI_AIX
12038 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12040 [(set_attr "type" "branch")
12041 (set_attr "length" "8")])
12043 (define_insn_and_split "*call_indirect_nonlocal_aix64_internal"
12044 [(call (mem:SI (match_operand:DI 0 "register_operand" "c,*l"))
12045 (match_operand 1 "" "g,g"))
12046 (use (mem:DI (plus:DI (match_operand:DI 2 "register_operand" "b,b")
12049 (use (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
12050 (clobber (reg:SI LR_REGNO))]
12051 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
12053 "&& reload_completed"
12055 (mem:DI (plus:DI (match_dup 2) (const_int 8))))
12056 (parallel [(call (mem:SI (match_dup 0))
12061 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
12062 (clobber (reg:SI LR_REGNO))])]
12064 [(set_attr "type" "jmpreg")
12065 (set_attr "length" "12")])
12067 (define_insn "*call_indirect_nonlocal_aix64"
12068 [(call (mem:SI (match_operand:DI 0 "register_operand" "c,*l"))
12069 (match_operand 1 "" "g,g"))
12073 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
12074 (clobber (reg:SI LR_REGNO))]
12075 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX && reload_completed"
12076 "b%T0l\;ld 2,40(1)"
12077 [(set_attr "type" "jmpreg")
12078 (set_attr "length" "8")])
12080 (define_insn "*call_nonlocal_aix64"
12081 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
12082 (match_operand 1 "" "g"))
12083 (use (match_operand:SI 2 "immediate_operand" "O"))
12084 (clobber (reg:SI LR_REGNO))]
12086 && DEFAULT_ABI == ABI_AIX
12087 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12089 [(set_attr "type" "branch")
12090 (set_attr "length" "8")])
12092 (define_insn_and_split "*call_value_indirect_nonlocal_aix32_internal"
12093 [(set (match_operand 0 "" "")
12094 (call (mem:SI (match_operand:SI 1 "register_operand" "c,*l"))
12095 (match_operand 2 "" "g,g")))
12096 (use (mem:SI (plus:SI (match_operand:SI 3 "register_operand" "b,b")
12099 (use (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
12100 (clobber (reg:SI LR_REGNO))]
12101 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
12103 "&& reload_completed"
12105 (mem:SI (plus:SI (match_dup 3) (const_int 4))))
12106 (parallel [(set (match_dup 0) (call (mem:SI (match_dup 1))
12111 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
12112 (clobber (reg:SI LR_REGNO))])]
12114 [(set_attr "type" "jmpreg")
12115 (set_attr "length" "12")])
12117 (define_insn "*call_value_indirect_nonlocal_aix32"
12118 [(set (match_operand 0 "" "")
12119 (call (mem:SI (match_operand:SI 1 "register_operand" "c,*l"))
12120 (match_operand 2 "" "g,g")))
12124 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
12125 (clobber (reg:SI LR_REGNO))]
12126 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX && reload_completed"
12127 "b%T1l\;{l|lwz} 2,20(1)"
12128 [(set_attr "type" "jmpreg")
12129 (set_attr "length" "8")])
12131 (define_insn "*call_value_nonlocal_aix32"
12132 [(set (match_operand 0 "" "")
12133 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
12134 (match_operand 2 "" "g")))
12135 (use (match_operand:SI 3 "immediate_operand" "O"))
12136 (clobber (reg:SI LR_REGNO))]
12138 && DEFAULT_ABI == ABI_AIX
12139 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12141 [(set_attr "type" "branch")
12142 (set_attr "length" "8")])
12144 (define_insn_and_split "*call_value_indirect_nonlocal_aix64_internal"
12145 [(set (match_operand 0 "" "")
12146 (call (mem:SI (match_operand:DI 1 "register_operand" "c,*l"))
12147 (match_operand 2 "" "g,g")))
12148 (use (mem:DI (plus:DI (match_operand:DI 3 "register_operand" "b,b")
12151 (use (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
12152 (clobber (reg:SI LR_REGNO))]
12153 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
12155 "&& reload_completed"
12157 (mem:DI (plus:DI (match_dup 3) (const_int 8))))
12158 (parallel [(set (match_dup 0) (call (mem:SI (match_dup 1))
12163 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
12164 (clobber (reg:SI LR_REGNO))])]
12166 [(set_attr "type" "jmpreg")
12167 (set_attr "length" "12")])
12169 (define_insn "*call_value_indirect_nonlocal_aix64"
12170 [(set (match_operand 0 "" "")
12171 (call (mem:SI (match_operand:DI 1 "register_operand" "c,*l"))
12172 (match_operand 2 "" "g,g")))
12176 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
12177 (clobber (reg:SI LR_REGNO))]
12178 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX && reload_completed"
12179 "b%T1l\;ld 2,40(1)"
12180 [(set_attr "type" "jmpreg")
12181 (set_attr "length" "8")])
12183 (define_insn "*call_value_nonlocal_aix64"
12184 [(set (match_operand 0 "" "")
12185 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
12186 (match_operand 2 "" "g")))
12187 (use (match_operand:SI 3 "immediate_operand" "O"))
12188 (clobber (reg:SI LR_REGNO))]
12190 && DEFAULT_ABI == ABI_AIX
12191 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12193 [(set_attr "type" "branch")
12194 (set_attr "length" "8")])
12196 ;; A function pointer under System V is just a normal pointer
12197 ;; operands[0] is the function pointer
12198 ;; operands[1] is the stack size to clean up
12199 ;; operands[2] is the value FUNCTION_ARG returns for the VOID argument
12200 ;; which indicates how to set cr1
12202 (define_insn "*call_indirect_nonlocal_sysv<mode>"
12203 [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l,c,*l"))
12204 (match_operand 1 "" "g,g,g,g"))
12205 (use (match_operand:SI 2 "immediate_operand" "O,O,n,n"))
12206 (clobber (reg:SI LR_REGNO))]
12207 "DEFAULT_ABI == ABI_V4
12208 || DEFAULT_ABI == ABI_DARWIN"
12210 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12211 output_asm_insn ("crxor 6,6,6", operands);
12213 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12214 output_asm_insn ("creqv 6,6,6", operands);
12218 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
12219 (set_attr "length" "4,4,8,8")])
12221 (define_insn_and_split "*call_nonlocal_sysv<mode>"
12222 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
12223 (match_operand 1 "" "g,g"))
12224 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12225 (clobber (reg:SI LR_REGNO))]
12226 "(DEFAULT_ABI == ABI_DARWIN
12227 || (DEFAULT_ABI == ABI_V4
12228 && (INTVAL (operands[2]) & CALL_LONG) == 0))"
12230 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12231 output_asm_insn ("crxor 6,6,6", operands);
12233 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12234 output_asm_insn ("creqv 6,6,6", operands);
12237 return output_call(insn, operands, 0, 2);
12239 if (DEFAULT_ABI == ABI_V4 && flag_pic)
12241 gcc_assert (!TARGET_SECURE_PLT);
12242 return "bl %z0@plt";
12248 "DEFAULT_ABI == ABI_V4
12249 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[0])
12250 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12251 [(parallel [(call (mem:SI (match_dup 0))
12253 (use (match_dup 2))
12254 (use (match_dup 3))
12255 (clobber (reg:SI LR_REGNO))])]
12257 operands[3] = pic_offset_table_rtx;
12259 [(set_attr "type" "branch,branch")
12260 (set_attr "length" "4,8")])
12262 (define_insn "*call_nonlocal_sysv_secure<mode>"
12263 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
12264 (match_operand 1 "" "g,g"))
12265 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12266 (use (match_operand:SI 3 "register_operand" "r,r"))
12267 (clobber (reg:SI LR_REGNO))]
12268 "(DEFAULT_ABI == ABI_V4
12269 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[0])
12270 && (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);
12279 /* The magic 32768 offset here and in the other sysv call insns
12280 corresponds to the offset of r30 in .got2, as given by LCTOC1.
12281 See sysv4.h:toc_section. */
12282 return "bl %z0+32768@plt";
12284 return "bl %z0@plt";
12286 [(set_attr "type" "branch,branch")
12287 (set_attr "length" "4,8")])
12289 (define_insn "*call_value_indirect_nonlocal_sysv<mode>"
12290 [(set (match_operand 0 "" "")
12291 (call (mem:SI (match_operand:P 1 "register_operand" "c,*l,c,*l"))
12292 (match_operand 2 "" "g,g,g,g")))
12293 (use (match_operand:SI 3 "immediate_operand" "O,O,n,n"))
12294 (clobber (reg:SI LR_REGNO))]
12295 "DEFAULT_ABI == ABI_V4
12296 || DEFAULT_ABI == ABI_DARWIN"
12298 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12299 output_asm_insn ("crxor 6,6,6", operands);
12301 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12302 output_asm_insn ("creqv 6,6,6", operands);
12306 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
12307 (set_attr "length" "4,4,8,8")])
12309 (define_insn_and_split "*call_value_nonlocal_sysv<mode>"
12310 [(set (match_operand 0 "" "")
12311 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
12312 (match_operand 2 "" "g,g")))
12313 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12314 (clobber (reg:SI LR_REGNO))]
12315 "(DEFAULT_ABI == ABI_DARWIN
12316 || (DEFAULT_ABI == ABI_V4
12317 && (INTVAL (operands[3]) & CALL_LONG) == 0))"
12319 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12320 output_asm_insn ("crxor 6,6,6", operands);
12322 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12323 output_asm_insn ("creqv 6,6,6", operands);
12326 return output_call(insn, operands, 1, 3);
12328 if (DEFAULT_ABI == ABI_V4 && flag_pic)
12330 gcc_assert (!TARGET_SECURE_PLT);
12331 return "bl %z1@plt";
12337 "DEFAULT_ABI == ABI_V4
12338 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[1])
12339 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12340 [(parallel [(set (match_dup 0)
12341 (call (mem:SI (match_dup 1))
12343 (use (match_dup 3))
12344 (use (match_dup 4))
12345 (clobber (reg:SI LR_REGNO))])]
12347 operands[4] = pic_offset_table_rtx;
12349 [(set_attr "type" "branch,branch")
12350 (set_attr "length" "4,8")])
12352 (define_insn "*call_value_nonlocal_sysv_secure<mode>"
12353 [(set (match_operand 0 "" "")
12354 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
12355 (match_operand 2 "" "g,g")))
12356 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12357 (use (match_operand:SI 4 "register_operand" "r,r"))
12358 (clobber (reg:SI LR_REGNO))]
12359 "(DEFAULT_ABI == ABI_V4
12360 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[1])
12361 && (INTVAL (operands[3]) & CALL_LONG) == 0)"
12363 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12364 output_asm_insn ("crxor 6,6,6", operands);
12366 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12367 output_asm_insn ("creqv 6,6,6", operands);
12370 return "bl %z1+32768@plt";
12372 return "bl %z1@plt";
12374 [(set_attr "type" "branch,branch")
12375 (set_attr "length" "4,8")])
12377 ;; Call subroutine returning any type.
12378 (define_expand "untyped_call"
12379 [(parallel [(call (match_operand 0 "" "")
12381 (match_operand 1 "" "")
12382 (match_operand 2 "" "")])]
12388 emit_call_insn (GEN_CALL (operands[0], const0_rtx, const0_rtx, const0_rtx));
12390 for (i = 0; i < XVECLEN (operands[2], 0); i++)
12392 rtx set = XVECEXP (operands[2], 0, i);
12393 emit_move_insn (SET_DEST (set), SET_SRC (set));
12396 /* The optimizer does not know that the call sets the function value
12397 registers we stored in the result block. We avoid problems by
12398 claiming that all hard registers are used and clobbered at this
12400 emit_insn (gen_blockage ());
12405 ;; sibling call patterns
12406 (define_expand "sibcall"
12407 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
12408 (match_operand 1 "" ""))
12409 (use (match_operand 2 "" ""))
12410 (use (reg:SI LR_REGNO))
12416 if (MACHOPIC_INDIRECT)
12417 operands[0] = machopic_indirect_call_target (operands[0]);
12420 gcc_assert (GET_CODE (operands[0]) == MEM);
12421 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
12423 operands[0] = XEXP (operands[0], 0);
12426 ;; this and similar patterns must be marked as using LR, otherwise
12427 ;; dataflow will try to delete the store into it. This is true
12428 ;; even when the actual reg to jump to is in CTR, when LR was
12429 ;; saved and restored around the PIC-setting BCL.
12430 (define_insn "*sibcall_local32"
12431 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
12432 (match_operand 1 "" "g,g"))
12433 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12434 (use (reg:SI LR_REGNO))
12436 "(INTVAL (operands[2]) & CALL_LONG) == 0"
12439 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12440 output_asm_insn (\"crxor 6,6,6\", operands);
12442 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12443 output_asm_insn (\"creqv 6,6,6\", operands);
12445 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
12447 [(set_attr "type" "branch")
12448 (set_attr "length" "4,8")])
12450 (define_insn "*sibcall_local64"
12451 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
12452 (match_operand 1 "" "g,g"))
12453 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12454 (use (reg:SI LR_REGNO))
12456 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
12459 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12460 output_asm_insn (\"crxor 6,6,6\", operands);
12462 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12463 output_asm_insn (\"creqv 6,6,6\", operands);
12465 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
12467 [(set_attr "type" "branch")
12468 (set_attr "length" "4,8")])
12470 (define_insn "*sibcall_value_local32"
12471 [(set (match_operand 0 "" "")
12472 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
12473 (match_operand 2 "" "g,g")))
12474 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12475 (use (reg:SI LR_REGNO))
12477 "(INTVAL (operands[3]) & CALL_LONG) == 0"
12480 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12481 output_asm_insn (\"crxor 6,6,6\", operands);
12483 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12484 output_asm_insn (\"creqv 6,6,6\", operands);
12486 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
12488 [(set_attr "type" "branch")
12489 (set_attr "length" "4,8")])
12492 (define_insn "*sibcall_value_local64"
12493 [(set (match_operand 0 "" "")
12494 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
12495 (match_operand 2 "" "g,g")))
12496 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12497 (use (reg:SI LR_REGNO))
12499 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
12502 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12503 output_asm_insn (\"crxor 6,6,6\", operands);
12505 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12506 output_asm_insn (\"creqv 6,6,6\", operands);
12508 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
12510 [(set_attr "type" "branch")
12511 (set_attr "length" "4,8")])
12513 (define_insn "*sibcall_nonlocal_aix32"
12514 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
12515 (match_operand 1 "" "g"))
12516 (use (match_operand:SI 2 "immediate_operand" "O"))
12517 (use (reg:SI LR_REGNO))
12520 && DEFAULT_ABI == ABI_AIX
12521 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12523 [(set_attr "type" "branch")
12524 (set_attr "length" "4")])
12526 (define_insn "*sibcall_nonlocal_aix64"
12527 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
12528 (match_operand 1 "" "g"))
12529 (use (match_operand:SI 2 "immediate_operand" "O"))
12530 (use (reg:SI LR_REGNO))
12533 && DEFAULT_ABI == ABI_AIX
12534 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12536 [(set_attr "type" "branch")
12537 (set_attr "length" "4")])
12539 (define_insn "*sibcall_value_nonlocal_aix32"
12540 [(set (match_operand 0 "" "")
12541 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
12542 (match_operand 2 "" "g")))
12543 (use (match_operand:SI 3 "immediate_operand" "O"))
12544 (use (reg:SI LR_REGNO))
12547 && DEFAULT_ABI == ABI_AIX
12548 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12550 [(set_attr "type" "branch")
12551 (set_attr "length" "4")])
12553 (define_insn "*sibcall_value_nonlocal_aix64"
12554 [(set (match_operand 0 "" "")
12555 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
12556 (match_operand 2 "" "g")))
12557 (use (match_operand:SI 3 "immediate_operand" "O"))
12558 (use (reg:SI LR_REGNO))
12561 && DEFAULT_ABI == ABI_AIX
12562 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12564 [(set_attr "type" "branch")
12565 (set_attr "length" "4")])
12567 (define_insn "*sibcall_nonlocal_sysv<mode>"
12568 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
12569 (match_operand 1 "" ""))
12570 (use (match_operand 2 "immediate_operand" "O,n"))
12571 (use (reg:SI LR_REGNO))
12573 "(DEFAULT_ABI == ABI_DARWIN
12574 || DEFAULT_ABI == ABI_V4)
12575 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12578 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12579 output_asm_insn (\"crxor 6,6,6\", operands);
12581 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12582 output_asm_insn (\"creqv 6,6,6\", operands);
12584 if (DEFAULT_ABI == ABI_V4 && flag_pic)
12586 gcc_assert (!TARGET_SECURE_PLT);
12587 return \"b %z0@plt\";
12592 [(set_attr "type" "branch,branch")
12593 (set_attr "length" "4,8")])
12595 (define_expand "sibcall_value"
12596 [(parallel [(set (match_operand 0 "register_operand" "")
12597 (call (mem:SI (match_operand 1 "address_operand" ""))
12598 (match_operand 2 "" "")))
12599 (use (match_operand 3 "" ""))
12600 (use (reg:SI LR_REGNO))
12606 if (MACHOPIC_INDIRECT)
12607 operands[1] = machopic_indirect_call_target (operands[1]);
12610 gcc_assert (GET_CODE (operands[1]) == MEM);
12611 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
12613 operands[1] = XEXP (operands[1], 0);
12616 (define_insn "*sibcall_value_nonlocal_sysv<mode>"
12617 [(set (match_operand 0 "" "")
12618 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
12619 (match_operand 2 "" "")))
12620 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12621 (use (reg:SI LR_REGNO))
12623 "(DEFAULT_ABI == ABI_DARWIN
12624 || DEFAULT_ABI == ABI_V4)
12625 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12628 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12629 output_asm_insn (\"crxor 6,6,6\", operands);
12631 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12632 output_asm_insn (\"creqv 6,6,6\", operands);
12634 if (DEFAULT_ABI == ABI_V4 && flag_pic)
12636 gcc_assert (!TARGET_SECURE_PLT);
12637 return \"b %z1@plt\";
12642 [(set_attr "type" "branch,branch")
12643 (set_attr "length" "4,8")])
12645 (define_expand "sibcall_epilogue"
12646 [(use (const_int 0))]
12647 "TARGET_SCHED_PROLOG"
12650 rs6000_emit_epilogue (TRUE);
12654 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
12655 ;; all of memory. This blocks insns from being moved across this point.
12657 (define_insn "blockage"
12658 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCK)]
12662 (define_insn "probe_stack"
12663 [(set (match_operand 0 "memory_operand" "=m")
12664 (unspec [(const_int 0)] UNSPEC_PROBE_STACK))]
12666 "{st%U0%X0|stw%U0%X0} 0,%0"
12667 [(set_attr "type" "store")
12668 (set_attr "length" "4")])
12670 ;; Compare insns are next. Note that the RS/6000 has two types of compares,
12671 ;; signed & unsigned, and one type of branch.
12673 ;; Start with the DEFINE_EXPANDs to generate the rtl for compares, scc
12674 ;; insns, and branches.
12676 (define_expand "cbranch<mode>4"
12677 [(use (match_operator 0 "rs6000_cbranch_operator"
12678 [(match_operand:GPR 1 "gpc_reg_operand" "")
12679 (match_operand:GPR 2 "reg_or_short_operand" "")]))
12680 (use (match_operand 3 ""))]
12684 /* Take care of the possibility that operands[2] might be negative but
12685 this might be a logical operation. That insn doesn't exist. */
12686 if (GET_CODE (operands[2]) == CONST_INT
12687 && INTVAL (operands[2]) < 0)
12689 operands[2] = force_reg (<MODE>mode, operands[2]);
12690 operands[0] = gen_rtx_fmt_ee (GET_CODE (operands[0]),
12691 GET_MODE (operands[0]),
12692 operands[1], operands[2]);
12695 rs6000_emit_cbranch (<MODE>mode, operands);
12699 (define_expand "cbranch<mode>4"
12700 [(use (match_operator 0 "rs6000_cbranch_operator"
12701 [(match_operand:FP 1 "gpc_reg_operand" "")
12702 (match_operand:FP 2 "gpc_reg_operand" "")]))
12703 (use (match_operand 3 ""))]
12707 rs6000_emit_cbranch (<MODE>mode, operands);
12711 (define_expand "cstore<mode>4"
12712 [(use (match_operator 1 "rs6000_cbranch_operator"
12713 [(match_operand:GPR 2 "gpc_reg_operand" "")
12714 (match_operand:GPR 3 "reg_or_short_operand" "")]))
12715 (clobber (match_operand:SI 0 "register_operand"))]
12719 /* Take care of the possibility that operands[3] might be negative but
12720 this might be a logical operation. That insn doesn't exist. */
12721 if (GET_CODE (operands[3]) == CONST_INT
12722 && INTVAL (operands[3]) < 0)
12724 operands[3] = force_reg (<MODE>mode, operands[3]);
12725 operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]),
12726 GET_MODE (operands[1]),
12727 operands[2], operands[3]);
12730 /* For SNE, we would prefer that the xor/abs sequence be used for integers.
12731 For SEQ, likewise, except that comparisons with zero should be done
12732 with an scc insns. However, due to the order that combine see the
12733 resulting insns, we must, in fact, allow SEQ for integers. Fail in
12734 the cases we don't want to handle or are best handled by portable
12736 if (GET_CODE (operands[1]) == NE)
12738 if ((GET_CODE (operands[1]) == LT || GET_CODE (operands[1]) == LE
12739 || GET_CODE (operands[1]) == GT || GET_CODE (operands[1]) == GE)
12740 && operands[3] == const0_rtx)
12742 rs6000_emit_sCOND (<MODE>mode, operands);
12746 (define_expand "cstore<mode>4"
12747 [(use (match_operator 1 "rs6000_cbranch_operator"
12748 [(match_operand:FP 2 "gpc_reg_operand" "")
12749 (match_operand:FP 3 "gpc_reg_operand" "")]))
12750 (clobber (match_operand:SI 0 "register_operand"))]
12754 rs6000_emit_sCOND (<MODE>mode, operands);
12759 (define_expand "stack_protect_set"
12760 [(match_operand 0 "memory_operand" "")
12761 (match_operand 1 "memory_operand" "")]
12764 #ifdef TARGET_THREAD_SSP_OFFSET
12765 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
12766 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
12767 operands[1] = gen_rtx_MEM (Pmode, addr);
12770 emit_insn (gen_stack_protect_setdi (operands[0], operands[1]));
12772 emit_insn (gen_stack_protect_setsi (operands[0], operands[1]));
12776 (define_insn "stack_protect_setsi"
12777 [(set (match_operand:SI 0 "memory_operand" "=m")
12778 (unspec:SI [(match_operand:SI 1 "memory_operand" "m")] UNSPEC_SP_SET))
12779 (set (match_scratch:SI 2 "=&r") (const_int 0))]
12781 "{l%U1%X1|lwz%U1%X1} %2,%1\;{st%U0%X0|stw%U0%X0} %2,%0\;{lil|li} %2,0"
12782 [(set_attr "type" "three")
12783 (set_attr "length" "12")])
12785 (define_insn "stack_protect_setdi"
12786 [(set (match_operand:DI 0 "memory_operand" "=m")
12787 (unspec:DI [(match_operand:DI 1 "memory_operand" "m")] UNSPEC_SP_SET))
12788 (set (match_scratch:DI 2 "=&r") (const_int 0))]
12790 "ld%U1%X1 %2,%1\;std%U0%X0 %2,%0\;{lil|li} %2,0"
12791 [(set_attr "type" "three")
12792 (set_attr "length" "12")])
12794 (define_expand "stack_protect_test"
12795 [(match_operand 0 "memory_operand" "")
12796 (match_operand 1 "memory_operand" "")
12797 (match_operand 2 "" "")]
12800 rtx test, op0, op1;
12801 #ifdef TARGET_THREAD_SSP_OFFSET
12802 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
12803 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
12804 operands[1] = gen_rtx_MEM (Pmode, addr);
12807 op1 = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, operands[1]), UNSPEC_SP_TEST);
12808 test = gen_rtx_EQ (VOIDmode, op0, op1);
12809 emit_jump_insn (gen_cbranchsi4 (test, op0, op1, operands[2]));
12813 (define_insn "stack_protect_testsi"
12814 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
12815 (unspec:CCEQ [(match_operand:SI 1 "memory_operand" "m,m")
12816 (match_operand:SI 2 "memory_operand" "m,m")]
12818 (set (match_scratch:SI 4 "=r,r") (const_int 0))
12819 (clobber (match_scratch:SI 3 "=&r,&r"))]
12822 {l%U1%X1|lwz%U1%X1} %3,%1\;{l%U2%X2|lwz%U2%X2} %4,%2\;xor. %3,%3,%4\;{lil|li} %4,0
12823 {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"
12824 [(set_attr "length" "16,20")])
12826 (define_insn "stack_protect_testdi"
12827 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
12828 (unspec:CCEQ [(match_operand:DI 1 "memory_operand" "m,m")
12829 (match_operand:DI 2 "memory_operand" "m,m")]
12831 (set (match_scratch:DI 4 "=r,r") (const_int 0))
12832 (clobber (match_scratch:DI 3 "=&r,&r"))]
12835 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;xor. %3,%3,%4\;{lil|li} %4,0
12836 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;cmpld %0,%3,%4\;{lil|li} %3,0\;{lil|li} %4,0"
12837 [(set_attr "length" "16,20")])
12840 ;; Here are the actual compare insns.
12841 (define_insn "*cmp<mode>_internal1"
12842 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
12843 (compare:CC (match_operand:GPR 1 "gpc_reg_operand" "r")
12844 (match_operand:GPR 2 "reg_or_short_operand" "rI")))]
12846 "{cmp%I2|cmp<wd>%I2} %0,%1,%2"
12847 [(set_attr "type" "cmp")])
12849 ;; If we are comparing a register for equality with a large constant,
12850 ;; we can do this with an XOR followed by a compare. But this is profitable
12851 ;; only if the large constant is only used for the comparison (and in this
12852 ;; case we already have a register to reuse as scratch).
12854 ;; For 64-bit registers, we could only do so if the constant's bit 15 is clear:
12855 ;; otherwise we'd need to XOR with FFFFFFFF????0000 which is not available.
12858 [(set (match_operand:SI 0 "register_operand")
12859 (match_operand:SI 1 "logical_const_operand" ""))
12860 (set (match_dup 0) (match_operator:SI 3 "boolean_or_operator"
12862 (match_operand:SI 2 "logical_const_operand" "")]))
12863 (set (match_operand:CC 4 "cc_reg_operand" "")
12864 (compare:CC (match_operand:SI 5 "gpc_reg_operand" "")
12867 (if_then_else (match_operator 6 "equality_operator"
12868 [(match_dup 4) (const_int 0)])
12869 (match_operand 7 "" "")
12870 (match_operand 8 "" "")))]
12871 "peep2_reg_dead_p (3, operands[0])
12872 && peep2_reg_dead_p (4, operands[4])"
12873 [(set (match_dup 0) (xor:SI (match_dup 5) (match_dup 9)))
12874 (set (match_dup 4) (compare:CC (match_dup 0) (match_dup 10)))
12875 (set (pc) (if_then_else (match_dup 6) (match_dup 7) (match_dup 8)))]
12878 /* Get the constant we are comparing against, and see what it looks like
12879 when sign-extended from 16 to 32 bits. Then see what constant we could
12880 XOR with SEXTC to get the sign-extended value. */
12881 rtx cnst = simplify_const_binary_operation (GET_CODE (operands[3]),
12883 operands[1], operands[2]);
12884 HOST_WIDE_INT c = INTVAL (cnst);
12885 HOST_WIDE_INT sextc = ((c & 0xffff) ^ 0x8000) - 0x8000;
12886 HOST_WIDE_INT xorv = c ^ sextc;
12888 operands[9] = GEN_INT (xorv);
12889 operands[10] = GEN_INT (sextc);
12892 (define_insn "*cmpsi_internal2"
12893 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
12894 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
12895 (match_operand:SI 2 "reg_or_u_short_operand" "rK")))]
12897 "{cmpl%I2|cmplw%I2} %0,%1,%b2"
12898 [(set_attr "type" "cmp")])
12900 (define_insn "*cmpdi_internal2"
12901 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
12902 (compare:CCUNS (match_operand:DI 1 "gpc_reg_operand" "r")
12903 (match_operand:DI 2 "reg_or_u_short_operand" "rK")))]
12905 "cmpld%I2 %0,%1,%b2"
12906 [(set_attr "type" "cmp")])
12908 ;; The following two insns don't exist as single insns, but if we provide
12909 ;; them, we can swap an add and compare, which will enable us to overlap more
12910 ;; of the required delay between a compare and branch. We generate code for
12911 ;; them by splitting.
12914 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
12915 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
12916 (match_operand:SI 2 "short_cint_operand" "i")))
12917 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
12918 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
12921 [(set_attr "length" "8")])
12924 [(set (match_operand:CCUNS 3 "cc_reg_operand" "=y")
12925 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
12926 (match_operand:SI 2 "u_short_cint_operand" "i")))
12927 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
12928 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
12931 [(set_attr "length" "8")])
12934 [(set (match_operand:CC 3 "cc_reg_operand" "")
12935 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
12936 (match_operand:SI 2 "short_cint_operand" "")))
12937 (set (match_operand:SI 0 "gpc_reg_operand" "")
12938 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
12940 [(set (match_dup 3) (compare:CC (match_dup 1) (match_dup 2)))
12941 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
12944 [(set (match_operand:CCUNS 3 "cc_reg_operand" "")
12945 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "")
12946 (match_operand:SI 2 "u_short_cint_operand" "")))
12947 (set (match_operand:SI 0 "gpc_reg_operand" "")
12948 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
12950 [(set (match_dup 3) (compare:CCUNS (match_dup 1) (match_dup 2)))
12951 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
12953 (define_insn "*cmpsf_internal1"
12954 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
12955 (compare:CCFP (match_operand:SF 1 "gpc_reg_operand" "f")
12956 (match_operand:SF 2 "gpc_reg_operand" "f")))]
12957 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
12959 [(set_attr "type" "fpcompare")])
12961 (define_insn "*cmpdf_internal1"
12962 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
12963 (compare:CCFP (match_operand:DF 1 "gpc_reg_operand" "d")
12964 (match_operand:DF 2 "gpc_reg_operand" "d")))]
12965 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
12966 && !VECTOR_UNIT_VSX_P (DFmode)"
12968 [(set_attr "type" "fpcompare")])
12970 ;; Only need to compare second words if first words equal
12971 (define_insn "*cmptf_internal1"
12972 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
12973 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "d")
12974 (match_operand:TF 2 "gpc_reg_operand" "d")))]
12975 "!TARGET_IEEEQUAD && !TARGET_XL_COMPAT
12976 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LONG_DOUBLE_128"
12977 "fcmpu %0,%1,%2\;bne %0,$+8\;fcmpu %0,%L1,%L2"
12978 [(set_attr "type" "fpcompare")
12979 (set_attr "length" "12")])
12981 (define_insn_and_split "*cmptf_internal2"
12982 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
12983 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "d")
12984 (match_operand:TF 2 "gpc_reg_operand" "d")))
12985 (clobber (match_scratch:DF 3 "=d"))
12986 (clobber (match_scratch:DF 4 "=d"))
12987 (clobber (match_scratch:DF 5 "=d"))
12988 (clobber (match_scratch:DF 6 "=d"))
12989 (clobber (match_scratch:DF 7 "=d"))
12990 (clobber (match_scratch:DF 8 "=d"))
12991 (clobber (match_scratch:DF 9 "=d"))
12992 (clobber (match_scratch:DF 10 "=d"))
12993 (clobber (match_scratch:GPR 11 "=b"))]
12994 "!TARGET_IEEEQUAD && TARGET_XL_COMPAT
12995 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LONG_DOUBLE_128"
12997 "&& reload_completed"
12998 [(set (match_dup 3) (match_dup 14))
12999 (set (match_dup 4) (match_dup 15))
13000 (set (match_dup 9) (abs:DF (match_dup 5)))
13001 (set (match_dup 0) (compare:CCFP (match_dup 9) (match_dup 3)))
13002 (set (pc) (if_then_else (ne (match_dup 0) (const_int 0))
13003 (label_ref (match_dup 12))
13005 (set (match_dup 0) (compare:CCFP (match_dup 5) (match_dup 7)))
13006 (set (pc) (label_ref (match_dup 13)))
13008 (set (match_dup 10) (minus:DF (match_dup 5) (match_dup 7)))
13009 (set (match_dup 9) (minus:DF (match_dup 6) (match_dup 8)))
13010 (set (match_dup 9) (plus:DF (match_dup 10) (match_dup 9)))
13011 (set (match_dup 0) (compare:CCFP (match_dup 9) (match_dup 4)))
13014 REAL_VALUE_TYPE rv;
13015 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
13016 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
13018 operands[5] = simplify_gen_subreg (DFmode, operands[1], TFmode, hi_word);
13019 operands[6] = simplify_gen_subreg (DFmode, operands[1], TFmode, lo_word);
13020 operands[7] = simplify_gen_subreg (DFmode, operands[2], TFmode, hi_word);
13021 operands[8] = simplify_gen_subreg (DFmode, operands[2], TFmode, lo_word);
13022 operands[12] = gen_label_rtx ();
13023 operands[13] = gen_label_rtx ();
13025 operands[14] = force_const_mem (DFmode,
13026 CONST_DOUBLE_FROM_REAL_VALUE (rv, DFmode));
13027 operands[15] = force_const_mem (DFmode,
13028 CONST_DOUBLE_FROM_REAL_VALUE (dconst0,
13033 tocref = create_TOC_reference (XEXP (operands[14], 0), operands[11]);
13034 operands[14] = gen_const_mem (DFmode, tocref);
13035 tocref = create_TOC_reference (XEXP (operands[15], 0), operands[11]);
13036 operands[15] = gen_const_mem (DFmode, tocref);
13037 set_mem_alias_set (operands[14], get_TOC_alias_set ());
13038 set_mem_alias_set (operands[15], get_TOC_alias_set ());
13042 ;; Now we have the scc insns. We can do some combinations because of the
13043 ;; way the machine works.
13045 ;; Note that this is probably faster if we can put an insn between the
13046 ;; mfcr and rlinm, but this is tricky. Let's leave it for now. In most
13047 ;; cases the insns below which don't use an intermediate CR field will
13048 ;; be used instead.
13050 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13051 (match_operator:SI 1 "scc_comparison_operator"
13052 [(match_operand 2 "cc_reg_operand" "y")
13055 "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1"
13056 [(set (attr "type")
13057 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
13058 (const_string "mfcrf")
13060 (const_string "mfcr")))
13061 (set_attr "length" "8")])
13063 ;; Same as above, but get the GT bit.
13064 (define_insn "move_from_CR_gt_bit"
13065 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13066 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_GT))]
13067 "TARGET_HARD_FLOAT && !TARGET_FPRS"
13068 "mfcr %0\;{rlinm|rlwinm} %0,%0,%D1,31,31"
13069 [(set_attr "type" "mfcr")
13070 (set_attr "length" "8")])
13072 ;; Same as above, but get the OV/ORDERED bit.
13073 (define_insn "move_from_CR_ov_bit"
13074 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13075 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_OV))]
13077 "mfcr %0\;{rlinm|rlwinm} %0,%0,%t1,1"
13078 [(set_attr "type" "mfcr")
13079 (set_attr "length" "8")])
13082 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13083 (match_operator:DI 1 "scc_comparison_operator"
13084 [(match_operand 2 "cc_reg_operand" "y")
13087 "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1"
13088 [(set (attr "type")
13089 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
13090 (const_string "mfcrf")
13092 (const_string "mfcr")))
13093 (set_attr "length" "8")])
13096 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13097 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
13098 [(match_operand 2 "cc_reg_operand" "y,y")
13101 (set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
13102 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
13105 mfcr %3%Q2\;{rlinm.|rlwinm.} %3,%3,%J1,1
13107 [(set_attr "type" "delayed_compare")
13108 (set_attr "length" "8,16")])
13111 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13112 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
13113 [(match_operand 2 "cc_reg_operand" "")
13116 (set (match_operand:SI 3 "gpc_reg_operand" "")
13117 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
13118 "TARGET_32BIT && reload_completed"
13119 [(set (match_dup 3)
13120 (match_op_dup 1 [(match_dup 2) (const_int 0)]))
13122 (compare:CC (match_dup 3)
13127 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13128 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
13129 [(match_operand 2 "cc_reg_operand" "y")
13131 (match_operand:SI 3 "const_int_operand" "n")))]
13135 int is_bit = ccr_bit (operands[1], 1);
13136 int put_bit = 31 - (INTVAL (operands[3]) & 31);
13139 if (is_bit >= put_bit)
13140 count = is_bit - put_bit;
13142 count = 32 - (put_bit - is_bit);
13144 operands[4] = GEN_INT (count);
13145 operands[5] = GEN_INT (put_bit);
13147 return \"mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%4,%5,%5\";
13149 [(set (attr "type")
13150 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
13151 (const_string "mfcrf")
13153 (const_string "mfcr")))
13154 (set_attr "length" "8")])
13157 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13159 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
13160 [(match_operand 2 "cc_reg_operand" "y,y")
13162 (match_operand:SI 3 "const_int_operand" "n,n"))
13164 (set (match_operand:SI 4 "gpc_reg_operand" "=r,r")
13165 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
13170 int is_bit = ccr_bit (operands[1], 1);
13171 int put_bit = 31 - (INTVAL (operands[3]) & 31);
13174 /* Force split for non-cc0 compare. */
13175 if (which_alternative == 1)
13178 if (is_bit >= put_bit)
13179 count = is_bit - put_bit;
13181 count = 32 - (put_bit - is_bit);
13183 operands[5] = GEN_INT (count);
13184 operands[6] = GEN_INT (put_bit);
13186 return \"mfcr %4%Q2\;{rlinm.|rlwinm.} %4,%4,%5,%6,%6\";
13188 [(set_attr "type" "delayed_compare")
13189 (set_attr "length" "8,16")])
13192 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
13194 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
13195 [(match_operand 2 "cc_reg_operand" "")
13197 (match_operand:SI 3 "const_int_operand" ""))
13199 (set (match_operand:SI 4 "gpc_reg_operand" "")
13200 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
13203 [(set (match_dup 4)
13204 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
13207 (compare:CC (match_dup 4)
13211 ;; There is a 3 cycle delay between consecutive mfcr instructions
13212 ;; so it is useful to combine 2 scc instructions to use only one mfcr.
13215 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13216 (match_operator:SI 1 "scc_comparison_operator"
13217 [(match_operand 2 "cc_reg_operand" "y")
13219 (set (match_operand:SI 3 "gpc_reg_operand" "=r")
13220 (match_operator:SI 4 "scc_comparison_operator"
13221 [(match_operand 5 "cc_reg_operand" "y")
13223 "REGNO (operands[2]) != REGNO (operands[5])"
13224 "mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
13225 [(set_attr "type" "mfcr")
13226 (set_attr "length" "12")])
13229 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13230 (match_operator:DI 1 "scc_comparison_operator"
13231 [(match_operand 2 "cc_reg_operand" "y")
13233 (set (match_operand:DI 3 "gpc_reg_operand" "=r")
13234 (match_operator:DI 4 "scc_comparison_operator"
13235 [(match_operand 5 "cc_reg_operand" "y")
13237 "TARGET_POWERPC64 && REGNO (operands[2]) != REGNO (operands[5])"
13238 "mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
13239 [(set_attr "type" "mfcr")
13240 (set_attr "length" "12")])
13242 ;; There are some scc insns that can be done directly, without a compare.
13243 ;; These are faster because they don't involve the communications between
13244 ;; the FXU and branch units. In fact, we will be replacing all of the
13245 ;; integer scc insns here or in the portable methods in emit_store_flag.
13247 ;; Also support (neg (scc ..)) since that construct is used to replace
13248 ;; branches, (plus (scc ..) ..) since that construct is common and
13249 ;; takes no more insns than scc, and (and (neg (scc ..)) ..) in the
13250 ;; cases where it is no more expensive than (neg (scc ..)).
13252 ;; Have reload force a constant into a register for the simple insns that
13253 ;; otherwise won't accept constants. We do this because it is faster than
13254 ;; the cmp/mfcr sequence we would otherwise generate.
13256 (define_mode_attr scc_eq_op2 [(SI "rKLI")
13259 (define_insn_and_split "*eq<mode>"
13260 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
13261 (eq:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
13262 (match_operand:GPR 2 "scc_eq_operand" "<scc_eq_op2>")))]
13266 [(set (match_dup 0)
13267 (clz:GPR (match_dup 3)))
13269 (lshiftrt:GPR (match_dup 0) (match_dup 4)))]
13271 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
13273 /* Use output operand as intermediate. */
13274 operands[3] = operands[0];
13276 if (logical_operand (operands[2], <MODE>mode))
13277 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13278 gen_rtx_XOR (<MODE>mode,
13279 operands[1], operands[2])));
13281 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13282 gen_rtx_PLUS (<MODE>mode, operands[1],
13283 negate_rtx (<MODE>mode,
13287 operands[3] = operands[1];
13289 operands[4] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
13292 (define_insn_and_split "*eq<mode>_compare"
13293 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
13295 (eq:P (match_operand:P 1 "gpc_reg_operand" "=r")
13296 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))
13298 (set (match_operand:P 0 "gpc_reg_operand" "=r")
13299 (eq:P (match_dup 1) (match_dup 2)))]
13300 "!TARGET_POWER && optimize_size"
13302 "!TARGET_POWER && optimize_size"
13303 [(set (match_dup 0)
13304 (clz:P (match_dup 4)))
13305 (parallel [(set (match_dup 3)
13306 (compare:CC (lshiftrt:P (match_dup 0) (match_dup 5))
13309 (lshiftrt:P (match_dup 0) (match_dup 5)))])]
13311 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
13313 /* Use output operand as intermediate. */
13314 operands[4] = operands[0];
13316 if (logical_operand (operands[2], <MODE>mode))
13317 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
13318 gen_rtx_XOR (<MODE>mode,
13319 operands[1], operands[2])));
13321 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
13322 gen_rtx_PLUS (<MODE>mode, operands[1],
13323 negate_rtx (<MODE>mode,
13327 operands[4] = operands[1];
13329 operands[5] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
13332 (define_insn "*eqsi_power"
13333 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
13334 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
13335 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I")))
13336 (clobber (match_scratch:SI 3 "=r,&r,r,r,r"))]
13339 xor %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
13340 {sfi|subfic} %3,%1,0\;{ae|adde} %0,%3,%1
13341 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
13342 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
13343 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0"
13344 [(set_attr "type" "three,two,three,three,three")
13345 (set_attr "length" "12,8,12,12,12")])
13347 ;; We have insns of the form shown by the first define_insn below. If
13348 ;; there is something inside the comparison operation, we must split it.
13350 [(set (match_operand:SI 0 "gpc_reg_operand" "")
13351 (plus:SI (match_operator 1 "comparison_operator"
13352 [(match_operand:SI 2 "" "")
13353 (match_operand:SI 3
13354 "reg_or_cint_operand" "")])
13355 (match_operand:SI 4 "gpc_reg_operand" "")))
13356 (clobber (match_operand:SI 5 "register_operand" ""))]
13357 "! gpc_reg_operand (operands[2], SImode)"
13358 [(set (match_dup 5) (match_dup 2))
13359 (set (match_dup 2) (plus:SI (match_op_dup 1 [(match_dup 2) (match_dup 3)])
13362 (define_insn "*plus_eqsi"
13363 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r")
13364 (plus:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
13365 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I"))
13366 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r")))]
13369 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
13370 {sfi|subfic} %0,%1,0\;{aze|addze} %0,%3
13371 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
13372 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
13373 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
13374 [(set_attr "type" "three,two,three,three,three")
13375 (set_attr "length" "12,8,12,12,12")])
13377 (define_insn "*compare_plus_eqsi"
13378 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
13381 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
13382 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
13383 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
13385 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r"))]
13386 "TARGET_32BIT && optimize_size"
13388 xor %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
13389 {sfi|subfic} %4,%1,0\;{aze.|addze.} %4,%3
13390 {xoril|xori} %4,%1,%b2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
13391 {xoriu|xoris} %4,%1,%u2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
13392 {sfi|subfic} %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
13398 [(set_attr "type" "compare")
13399 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
13402 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13405 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
13406 (match_operand:SI 2 "scc_eq_operand" ""))
13407 (match_operand:SI 3 "gpc_reg_operand" ""))
13409 (clobber (match_scratch:SI 4 ""))]
13410 "TARGET_32BIT && optimize_size && reload_completed"
13411 [(set (match_dup 4)
13412 (plus:SI (eq:SI (match_dup 1)
13416 (compare:CC (match_dup 4)
13420 (define_insn "*plus_eqsi_compare"
13421 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
13424 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
13425 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
13426 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
13428 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r")
13429 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13430 "TARGET_32BIT && optimize_size"
13432 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
13433 {sfi|subfic} %0,%1,0\;{aze.|addze.} %0,%3
13434 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
13435 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
13436 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
13442 [(set_attr "type" "compare")
13443 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
13446 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13449 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
13450 (match_operand:SI 2 "scc_eq_operand" ""))
13451 (match_operand:SI 3 "gpc_reg_operand" ""))
13453 (set (match_operand:SI 0 "gpc_reg_operand" "")
13454 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13455 "TARGET_32BIT && optimize_size && reload_completed"
13456 [(set (match_dup 0)
13457 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13459 (compare:CC (match_dup 0)
13463 (define_insn "*neg_eq0<mode>"
13464 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13465 (neg:P (eq:P (match_operand:P 1 "gpc_reg_operand" "r")
13468 "{ai|addic} %0,%1,-1\;{sfe|subfe} %0,%0,%0"
13469 [(set_attr "type" "two")
13470 (set_attr "length" "8")])
13472 (define_insn_and_split "*neg_eq<mode>"
13473 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13474 (neg:P (eq:P (match_operand:P 1 "gpc_reg_operand" "%r")
13475 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))))]
13479 [(set (match_dup 0) (neg:P (eq:P (match_dup 3) (const_int 0))))]
13481 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
13483 /* Use output operand as intermediate. */
13484 operands[3] = operands[0];
13486 if (logical_operand (operands[2], <MODE>mode))
13487 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13488 gen_rtx_XOR (<MODE>mode,
13489 operands[1], operands[2])));
13491 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13492 gen_rtx_PLUS (<MODE>mode, operands[1],
13493 negate_rtx (<MODE>mode,
13497 operands[3] = operands[1];
13500 ;; Simplify (ne X (const_int 0)) on the PowerPC. No need to on the Power,
13501 ;; since it nabs/sr is just as fast.
13502 (define_insn "*ne0si"
13503 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
13504 (lshiftrt:SI (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
13506 (clobber (match_scratch:SI 2 "=&r"))]
13507 "! TARGET_POWER && TARGET_32BIT && !TARGET_ISEL"
13508 "{ai|addic} %2,%1,-1\;{sfe|subfe} %0,%2,%1"
13509 [(set_attr "type" "two")
13510 (set_attr "length" "8")])
13512 (define_insn "*ne0di"
13513 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13514 (lshiftrt:DI (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
13516 (clobber (match_scratch:DI 2 "=&r"))]
13518 "addic %2,%1,-1\;subfe %0,%2,%1"
13519 [(set_attr "type" "two")
13520 (set_attr "length" "8")])
13522 ;; This is what (plus (ne X (const_int 0)) Y) looks like.
13523 (define_insn "*plus_ne0si"
13524 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13525 (plus:SI (lshiftrt:SI
13526 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
13528 (match_operand:SI 2 "gpc_reg_operand" "r")))
13529 (clobber (match_scratch:SI 3 "=&r"))]
13531 "{ai|addic} %3,%1,-1\;{aze|addze} %0,%2"
13532 [(set_attr "type" "two")
13533 (set_attr "length" "8")])
13535 (define_insn "*plus_ne0di"
13536 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13537 (plus:DI (lshiftrt:DI
13538 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
13540 (match_operand:DI 2 "gpc_reg_operand" "r")))
13541 (clobber (match_scratch:DI 3 "=&r"))]
13543 "addic %3,%1,-1\;addze %0,%2"
13544 [(set_attr "type" "two")
13545 (set_attr "length" "8")])
13547 (define_insn "*compare_plus_ne0si"
13548 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13550 (plus:SI (lshiftrt:SI
13551 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
13553 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
13555 (clobber (match_scratch:SI 3 "=&r,&r"))
13556 (clobber (match_scratch:SI 4 "=X,&r"))]
13559 {ai|addic} %3,%1,-1\;{aze.|addze.} %3,%2
13561 [(set_attr "type" "compare")
13562 (set_attr "length" "8,12")])
13565 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13567 (plus:SI (lshiftrt:SI
13568 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
13570 (match_operand:SI 2 "gpc_reg_operand" ""))
13572 (clobber (match_scratch:SI 3 ""))
13573 (clobber (match_scratch:SI 4 ""))]
13574 "TARGET_32BIT && reload_completed"
13575 [(parallel [(set (match_dup 3)
13576 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1)))
13579 (clobber (match_dup 4))])
13581 (compare:CC (match_dup 3)
13585 (define_insn "*compare_plus_ne0di"
13586 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13588 (plus:DI (lshiftrt:DI
13589 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
13591 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
13593 (clobber (match_scratch:DI 3 "=&r,&r"))]
13596 addic %3,%1,-1\;addze. %3,%2
13598 [(set_attr "type" "compare")
13599 (set_attr "length" "8,12")])
13602 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
13604 (plus:DI (lshiftrt:DI
13605 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
13607 (match_operand:DI 2 "gpc_reg_operand" ""))
13609 (clobber (match_scratch:DI 3 ""))]
13610 "TARGET_64BIT && reload_completed"
13611 [(set (match_dup 3)
13612 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1)))
13616 (compare:CC (match_dup 3)
13620 (define_insn "*plus_ne0si_compare"
13621 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13623 (plus:SI (lshiftrt:SI
13624 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
13626 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
13628 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13629 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
13631 (clobber (match_scratch:SI 3 "=&r,&r"))]
13634 {ai|addic} %3,%1,-1\;{aze.|addze.} %0,%2
13636 [(set_attr "type" "compare")
13637 (set_attr "length" "8,12")])
13640 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13642 (plus:SI (lshiftrt:SI
13643 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
13645 (match_operand:SI 2 "gpc_reg_operand" ""))
13647 (set (match_operand:SI 0 "gpc_reg_operand" "")
13648 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
13650 (clobber (match_scratch:SI 3 ""))]
13651 "TARGET_32BIT && reload_completed"
13652 [(parallel [(set (match_dup 0)
13653 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
13655 (clobber (match_dup 3))])
13657 (compare:CC (match_dup 0)
13661 (define_insn "*plus_ne0di_compare"
13662 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13664 (plus:DI (lshiftrt:DI
13665 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
13667 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
13669 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
13670 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
13672 (clobber (match_scratch:DI 3 "=&r,&r"))]
13675 addic %3,%1,-1\;addze. %0,%2
13677 [(set_attr "type" "compare")
13678 (set_attr "length" "8,12")])
13681 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
13683 (plus:DI (lshiftrt:DI
13684 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
13686 (match_operand:DI 2 "gpc_reg_operand" ""))
13688 (set (match_operand:DI 0 "gpc_reg_operand" "")
13689 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
13691 (clobber (match_scratch:DI 3 ""))]
13692 "TARGET_64BIT && reload_completed"
13693 [(parallel [(set (match_dup 0)
13694 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
13696 (clobber (match_dup 3))])
13698 (compare:CC (match_dup 0)
13703 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13704 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13705 (match_operand:SI 2 "reg_or_short_operand" "r,O")))
13706 (clobber (match_scratch:SI 3 "=r,X"))]
13709 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3
13710 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri|srwi} %0,%0,31"
13711 [(set_attr "length" "12")])
13714 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13716 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13717 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
13719 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
13720 (le:SI (match_dup 1) (match_dup 2)))
13721 (clobber (match_scratch:SI 3 "=r,X,r,X"))]
13724 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
13725 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri.|srwi.} %0,%0,31
13728 [(set_attr "type" "compare,delayed_compare,compare,delayed_compare")
13729 (set_attr "length" "12,12,16,16")])
13732 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13734 (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
13735 (match_operand:SI 2 "reg_or_short_operand" ""))
13737 (set (match_operand:SI 0 "gpc_reg_operand" "")
13738 (le:SI (match_dup 1) (match_dup 2)))
13739 (clobber (match_scratch:SI 3 ""))]
13740 "TARGET_POWER && reload_completed"
13741 [(parallel [(set (match_dup 0)
13742 (le:SI (match_dup 1) (match_dup 2)))
13743 (clobber (match_dup 3))])
13745 (compare:CC (match_dup 0)
13750 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13751 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13752 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
13753 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
13756 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
13757 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze|addze} %0,%3"
13758 [(set_attr "length" "12")])
13761 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13763 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13764 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
13765 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13767 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
13770 doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
13771 {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze.|addze.} %4,%3
13774 [(set_attr "type" "compare")
13775 (set_attr "length" "12,12,16,16")])
13778 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13780 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
13781 (match_operand:SI 2 "reg_or_short_operand" ""))
13782 (match_operand:SI 3 "gpc_reg_operand" ""))
13784 (clobber (match_scratch:SI 4 ""))]
13785 "TARGET_POWER && reload_completed"
13786 [(set (match_dup 4)
13787 (plus:SI (le:SI (match_dup 1) (match_dup 2))
13790 (compare:CC (match_dup 4)
13795 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13797 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13798 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
13799 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13801 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13802 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13805 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
13806 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze.|addze.} %0,%3
13809 [(set_attr "type" "compare")
13810 (set_attr "length" "12,12,16,16")])
13813 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13815 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
13816 (match_operand:SI 2 "reg_or_short_operand" ""))
13817 (match_operand:SI 3 "gpc_reg_operand" ""))
13819 (set (match_operand:SI 0 "gpc_reg_operand" "")
13820 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13821 "TARGET_POWER && reload_completed"
13822 [(set (match_dup 0)
13823 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13825 (compare:CC (match_dup 0)
13830 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13831 (neg:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13832 (match_operand:SI 2 "reg_or_short_operand" "r,O"))))]
13835 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
13836 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{srai|srawi} %0,%0,31"
13837 [(set_attr "length" "12")])
13839 (define_insn "*leu<mode>"
13840 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13841 (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
13842 (match_operand:P 2 "reg_or_short_operand" "rI")))]
13844 "{sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
13845 [(set_attr "type" "three")
13846 (set_attr "length" "12")])
13848 (define_insn "*leu<mode>_compare"
13849 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13851 (leu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13852 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
13854 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13855 (leu:P (match_dup 1) (match_dup 2)))]
13858 {sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
13860 [(set_attr "type" "compare")
13861 (set_attr "length" "12,16")])
13864 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13866 (leu:P (match_operand:P 1 "gpc_reg_operand" "")
13867 (match_operand:P 2 "reg_or_short_operand" ""))
13869 (set (match_operand:P 0 "gpc_reg_operand" "")
13870 (leu:P (match_dup 1) (match_dup 2)))]
13872 [(set (match_dup 0)
13873 (leu:P (match_dup 1) (match_dup 2)))
13875 (compare:CC (match_dup 0)
13879 (define_insn "*plus_leu<mode>"
13880 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
13881 (plus:P (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
13882 (match_operand:P 2 "reg_or_short_operand" "rI"))
13883 (match_operand:P 3 "gpc_reg_operand" "r")))]
13885 "{sf%I2|subf%I2c} %0,%1,%2\;{aze|addze} %0,%3"
13886 [(set_attr "type" "two")
13887 (set_attr "length" "8")])
13890 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13892 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13893 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13894 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13896 (clobber (match_scratch:SI 4 "=&r,&r"))]
13899 {sf%I2|subf%I2c} %4,%1,%2\;{aze.|addze.} %4,%3
13901 [(set_attr "type" "compare")
13902 (set_attr "length" "8,12")])
13905 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13907 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13908 (match_operand:SI 2 "reg_or_short_operand" ""))
13909 (match_operand:SI 3 "gpc_reg_operand" ""))
13911 (clobber (match_scratch:SI 4 ""))]
13912 "TARGET_32BIT && reload_completed"
13913 [(set (match_dup 4)
13914 (plus:SI (leu:SI (match_dup 1) (match_dup 2))
13917 (compare:CC (match_dup 4)
13922 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13924 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13925 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13926 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13928 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13929 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13932 {sf%I2|subf%I2c} %0,%1,%2\;{aze.|addze.} %0,%3
13934 [(set_attr "type" "compare")
13935 (set_attr "length" "8,12")])
13938 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13940 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13941 (match_operand:SI 2 "reg_or_short_operand" ""))
13942 (match_operand:SI 3 "gpc_reg_operand" ""))
13944 (set (match_operand:SI 0 "gpc_reg_operand" "")
13945 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13946 "TARGET_32BIT && reload_completed"
13947 [(set (match_dup 0)
13948 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13950 (compare:CC (match_dup 0)
13954 (define_insn "*neg_leu<mode>"
13955 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13956 (neg:P (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
13957 (match_operand:P 2 "reg_or_short_operand" "rI"))))]
13959 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0"
13960 [(set_attr "type" "three")
13961 (set_attr "length" "12")])
13963 (define_insn "*and_neg_leu<mode>"
13964 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
13966 (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
13967 (match_operand:P 2 "reg_or_short_operand" "rI")))
13968 (match_operand:P 3 "gpc_reg_operand" "r")))]
13970 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
13971 [(set_attr "type" "three")
13972 (set_attr "length" "12")])
13975 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13978 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13979 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
13980 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13982 (clobber (match_scratch:SI 4 "=&r,&r"))]
13985 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
13987 [(set_attr "type" "compare")
13988 (set_attr "length" "12,16")])
13991 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13994 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13995 (match_operand:SI 2 "reg_or_short_operand" "")))
13996 (match_operand:SI 3 "gpc_reg_operand" ""))
13998 (clobber (match_scratch:SI 4 ""))]
13999 "TARGET_32BIT && reload_completed"
14000 [(set (match_dup 4)
14001 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
14004 (compare:CC (match_dup 4)
14009 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
14012 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14013 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
14014 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14016 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
14017 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
14020 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
14022 [(set_attr "type" "compare")
14023 (set_attr "length" "12,16")])
14026 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14029 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14030 (match_operand:SI 2 "reg_or_short_operand" "")))
14031 (match_operand:SI 3 "gpc_reg_operand" ""))
14033 (set (match_operand:SI 0 "gpc_reg_operand" "")
14034 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
14035 "TARGET_32BIT && reload_completed"
14036 [(set (match_dup 0)
14037 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
14040 (compare:CC (match_dup 0)
14045 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14046 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14047 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
14049 "doz%I2 %0,%1,%2\;nabs %0,%0\;{sri|srwi} %0,%0,31"
14050 [(set_attr "length" "12")])
14053 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
14055 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14056 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14058 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
14059 (lt:SI (match_dup 1) (match_dup 2)))]
14062 doz%I2 %0,%1,%2\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
14064 [(set_attr "type" "delayed_compare")
14065 (set_attr "length" "12,16")])
14068 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
14070 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14071 (match_operand:SI 2 "reg_or_short_operand" ""))
14073 (set (match_operand:SI 0 "gpc_reg_operand" "")
14074 (lt:SI (match_dup 1) (match_dup 2)))]
14075 "TARGET_POWER && reload_completed"
14076 [(set (match_dup 0)
14077 (lt:SI (match_dup 1) (match_dup 2)))
14079 (compare:CC (match_dup 0)
14084 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
14085 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14086 (match_operand:SI 2 "reg_or_short_operand" "rI"))
14087 (match_operand:SI 3 "gpc_reg_operand" "r")))]
14089 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
14090 [(set_attr "length" "12")])
14093 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
14095 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14096 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14097 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14099 (clobber (match_scratch:SI 4 "=&r,&r"))]
14102 doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
14104 [(set_attr "type" "compare")
14105 (set_attr "length" "12,16")])
14108 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14110 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14111 (match_operand:SI 2 "reg_or_short_operand" ""))
14112 (match_operand:SI 3 "gpc_reg_operand" ""))
14114 (clobber (match_scratch:SI 4 ""))]
14115 "TARGET_POWER && reload_completed"
14116 [(set (match_dup 4)
14117 (plus:SI (lt:SI (match_dup 1) (match_dup 2))
14120 (compare:CC (match_dup 4)
14125 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
14127 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14128 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14129 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14131 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
14132 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14135 doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
14137 [(set_attr "type" "compare")
14138 (set_attr "length" "12,16")])
14141 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14143 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14144 (match_operand:SI 2 "reg_or_short_operand" ""))
14145 (match_operand:SI 3 "gpc_reg_operand" ""))
14147 (set (match_operand:SI 0 "gpc_reg_operand" "")
14148 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14149 "TARGET_POWER && reload_completed"
14150 [(set (match_dup 0)
14151 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
14153 (compare:CC (match_dup 0)
14158 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14159 (neg:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14160 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
14162 "doz%I2 %0,%1,%2\;nabs %0,%0\;{srai|srawi} %0,%0,31"
14163 [(set_attr "length" "12")])
14165 (define_insn_and_split "*ltu<mode>"
14166 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
14167 (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14168 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))]
14172 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
14173 (set (match_dup 0) (neg:P (match_dup 0)))]
14176 (define_insn_and_split "*ltu<mode>_compare"
14177 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
14179 (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
14180 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
14182 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
14183 (ltu:P (match_dup 1) (match_dup 2)))]
14187 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
14188 (parallel [(set (match_dup 3)
14189 (compare:CC (neg:P (match_dup 0)) (const_int 0)))
14190 (set (match_dup 0) (neg:P (match_dup 0)))])]
14193 (define_insn_and_split "*plus_ltu<mode>"
14194 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,r")
14195 (plus:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14196 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))
14197 (match_operand:P 3 "reg_or_short_operand" "rI,rI")))]
14200 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
14201 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
14202 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))]
14205 (define_insn_and_split "*plus_ltu<mode>_compare"
14206 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
14208 (plus:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
14209 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
14210 (match_operand:P 3 "gpc_reg_operand" "r,r,r,r"))
14212 (set (match_operand:P 0 "gpc_reg_operand" "=&r,&r,&r,&r")
14213 (plus:P (ltu:P (match_dup 1) (match_dup 2)) (match_dup 3)))]
14216 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
14217 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
14218 (parallel [(set (match_dup 4)
14219 (compare:CC (minus:P (match_dup 3) (match_dup 0))
14221 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))])]
14224 (define_insn "*neg_ltu<mode>"
14225 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
14226 (neg:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14227 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))))]
14230 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0
14231 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0"
14232 [(set_attr "type" "two")
14233 (set_attr "length" "8")])
14236 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14237 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14238 (match_operand:SI 2 "reg_or_short_operand" "rI")))
14239 (clobber (match_scratch:SI 3 "=r"))]
14241 "doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3"
14242 [(set_attr "length" "12")])
14245 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
14247 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14248 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14250 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
14251 (ge:SI (match_dup 1) (match_dup 2)))
14252 (clobber (match_scratch:SI 3 "=r,r"))]
14255 doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
14257 [(set_attr "type" "compare")
14258 (set_attr "length" "12,16")])
14261 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14263 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
14264 (match_operand:SI 2 "reg_or_short_operand" ""))
14266 (set (match_operand:SI 0 "gpc_reg_operand" "")
14267 (ge:SI (match_dup 1) (match_dup 2)))
14268 (clobber (match_scratch:SI 3 ""))]
14269 "TARGET_POWER && reload_completed"
14270 [(parallel [(set (match_dup 0)
14271 (ge:SI (match_dup 1) (match_dup 2)))
14272 (clobber (match_dup 3))])
14274 (compare:CC (match_dup 0)
14279 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
14280 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14281 (match_operand:SI 2 "reg_or_short_operand" "rI"))
14282 (match_operand:SI 3 "gpc_reg_operand" "r")))]
14284 "doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
14285 [(set_attr "length" "12")])
14288 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
14290 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14291 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14292 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14294 (clobber (match_scratch:SI 4 "=&r,&r"))]
14297 doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
14299 [(set_attr "type" "compare")
14300 (set_attr "length" "12,16")])
14303 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14305 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
14306 (match_operand:SI 2 "reg_or_short_operand" ""))
14307 (match_operand:SI 3 "gpc_reg_operand" ""))
14309 (clobber (match_scratch:SI 4 ""))]
14310 "TARGET_POWER && reload_completed"
14311 [(set (match_dup 4)
14312 (plus:SI (ge:SI (match_dup 1) (match_dup 2))
14315 (compare:CC (match_dup 4)
14320 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
14322 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14323 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14324 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14326 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
14327 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14330 doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
14332 [(set_attr "type" "compare")
14333 (set_attr "length" "12,16")])
14336 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14338 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
14339 (match_operand:SI 2 "reg_or_short_operand" ""))
14340 (match_operand:SI 3 "gpc_reg_operand" ""))
14342 (set (match_operand:SI 0 "gpc_reg_operand" "")
14343 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14344 "TARGET_POWER && reload_completed"
14345 [(set (match_dup 0)
14346 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
14348 (compare:CC (match_dup 0)
14353 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14354 (neg:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14355 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
14357 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
14358 [(set_attr "length" "12")])
14360 (define_insn "*geu<mode>"
14361 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
14362 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14363 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))]
14366 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0
14367 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
14368 [(set_attr "type" "three")
14369 (set_attr "length" "12")])
14371 (define_insn "*geu<mode>_compare"
14372 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
14374 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
14375 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
14377 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
14378 (geu:P (match_dup 1) (match_dup 2)))]
14381 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
14382 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
14385 [(set_attr "type" "compare")
14386 (set_attr "length" "12,12,16,16")])
14389 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
14391 (geu:P (match_operand:P 1 "gpc_reg_operand" "")
14392 (match_operand:P 2 "reg_or_neg_short_operand" ""))
14394 (set (match_operand:P 0 "gpc_reg_operand" "")
14395 (geu:P (match_dup 1) (match_dup 2)))]
14397 [(set (match_dup 0)
14398 (geu:P (match_dup 1) (match_dup 2)))
14400 (compare:CC (match_dup 0)
14404 (define_insn "*plus_geu<mode>"
14405 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,&r")
14406 (plus:P (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14407 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))
14408 (match_operand:P 3 "gpc_reg_operand" "r,r")))]
14411 {sf|subfc} %0,%2,%1\;{aze|addze} %0,%3
14412 {ai|addic} %0,%1,%n2\;{aze|addze} %0,%3"
14413 [(set_attr "type" "two")
14414 (set_attr "length" "8")])
14417 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
14419 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14420 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
14421 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
14423 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
14426 {sf|subfc} %4,%2,%1\;{aze.|addze.} %4,%3
14427 {ai|addic} %4,%1,%n2\;{aze.|addze.} %4,%3
14430 [(set_attr "type" "compare")
14431 (set_attr "length" "8,8,12,12")])
14434 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14436 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14437 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
14438 (match_operand:SI 3 "gpc_reg_operand" ""))
14440 (clobber (match_scratch:SI 4 ""))]
14441 "TARGET_32BIT && reload_completed"
14442 [(set (match_dup 4)
14443 (plus:SI (geu:SI (match_dup 1) (match_dup 2))
14446 (compare:CC (match_dup 4)
14451 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
14453 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14454 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
14455 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
14457 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
14458 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14461 {sf|subfc} %0,%2,%1\;{aze.|addze.} %0,%3
14462 {ai|addic} %0,%1,%n2\;{aze.|addze.} %0,%3
14465 [(set_attr "type" "compare")
14466 (set_attr "length" "8,8,12,12")])
14469 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14471 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14472 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
14473 (match_operand:SI 3 "gpc_reg_operand" ""))
14475 (set (match_operand:SI 0 "gpc_reg_operand" "")
14476 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14477 "TARGET_32BIT && reload_completed"
14478 [(set (match_dup 0)
14479 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
14481 (compare:CC (match_dup 0)
14485 (define_insn "*neg_geu<mode>"
14486 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
14487 (neg:P (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14488 (match_operand:P 2 "reg_or_short_operand" "r,I"))))]
14491 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0
14492 {sfi|subfic} %0,%1,-1\;{a%I2|add%I2c} %0,%0,%2\;{sfe|subfe} %0,%0,%0"
14493 [(set_attr "type" "three")
14494 (set_attr "length" "12")])
14496 (define_insn "*and_neg_geu<mode>"
14497 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,&r")
14499 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14500 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))
14501 (match_operand:P 3 "gpc_reg_operand" "r,r")))]
14504 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0
14505 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
14506 [(set_attr "type" "three")
14507 (set_attr "length" "12")])
14510 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
14513 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14514 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
14515 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
14517 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
14520 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
14521 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
14524 [(set_attr "type" "compare")
14525 (set_attr "length" "12,12,16,16")])
14528 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14531 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14532 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
14533 (match_operand:SI 3 "gpc_reg_operand" ""))
14535 (clobber (match_scratch:SI 4 ""))]
14536 "TARGET_32BIT && reload_completed"
14537 [(set (match_dup 4)
14538 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2)))
14541 (compare:CC (match_dup 4)
14546 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
14549 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14550 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
14551 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
14553 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
14554 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
14557 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
14558 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
14561 [(set_attr "type" "compare")
14562 (set_attr "length" "12,12,16,16")])
14565 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14568 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14569 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
14570 (match_operand:SI 3 "gpc_reg_operand" ""))
14572 (set (match_operand:SI 0 "gpc_reg_operand" "")
14573 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
14574 "TARGET_32BIT && reload_completed"
14575 [(set (match_dup 0)
14576 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
14578 (compare:CC (match_dup 0)
14583 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14584 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14585 (match_operand:SI 2 "reg_or_short_operand" "r")))]
14587 "doz %0,%2,%1\;nabs %0,%0\;{sri|srwi} %0,%0,31"
14588 [(set_attr "length" "12")])
14591 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
14593 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14594 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
14596 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
14597 (gt:SI (match_dup 1) (match_dup 2)))]
14600 doz %0,%2,%1\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
14602 [(set_attr "type" "delayed_compare")
14603 (set_attr "length" "12,16")])
14606 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
14608 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14609 (match_operand:SI 2 "reg_or_short_operand" ""))
14611 (set (match_operand:SI 0 "gpc_reg_operand" "")
14612 (gt:SI (match_dup 1) (match_dup 2)))]
14613 "TARGET_POWER && reload_completed"
14614 [(set (match_dup 0)
14615 (gt:SI (match_dup 1) (match_dup 2)))
14617 (compare:CC (match_dup 0)
14621 (define_insn "*plus_gt0<mode>"
14622 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
14623 (plus:P (gt:P (match_operand:P 1 "gpc_reg_operand" "r")
14625 (match_operand:P 2 "gpc_reg_operand" "r")))]
14627 "{a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze|addze} %0,%2"
14628 [(set_attr "type" "three")
14629 (set_attr "length" "12")])
14632 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
14634 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14636 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
14638 (clobber (match_scratch:SI 3 "=&r,&r"))]
14641 {a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze.|addze.} %3,%2
14643 [(set_attr "type" "compare")
14644 (set_attr "length" "12,16")])
14647 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14649 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14651 (match_operand:SI 2 "gpc_reg_operand" ""))
14653 (clobber (match_scratch:SI 3 ""))]
14654 "TARGET_32BIT && reload_completed"
14655 [(set (match_dup 3)
14656 (plus:SI (gt:SI (match_dup 1) (const_int 0))
14659 (compare:CC (match_dup 3)
14664 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
14666 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
14668 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
14670 (clobber (match_scratch:DI 3 "=&r,&r"))]
14673 addc %3,%1,%1\;subfe %3,%1,%3\;addze. %3,%2
14675 [(set_attr "type" "compare")
14676 (set_attr "length" "12,16")])
14679 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
14681 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
14683 (match_operand:DI 2 "gpc_reg_operand" ""))
14685 (clobber (match_scratch:DI 3 ""))]
14686 "TARGET_64BIT && reload_completed"
14687 [(set (match_dup 3)
14688 (plus:DI (gt:DI (match_dup 1) (const_int 0))
14691 (compare:CC (match_dup 3)
14696 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
14698 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14700 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
14702 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
14703 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
14706 {a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze.|addze.} %0,%2
14708 [(set_attr "type" "compare")
14709 (set_attr "length" "12,16")])
14712 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
14714 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14716 (match_operand:SI 2 "gpc_reg_operand" ""))
14718 (set (match_operand:SI 0 "gpc_reg_operand" "")
14719 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
14720 "TARGET_32BIT && reload_completed"
14721 [(set (match_dup 0)
14722 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))
14724 (compare:CC (match_dup 0)
14729 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
14731 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
14733 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
14735 (set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
14736 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
14739 addc %0,%1,%1\;subfe %0,%1,%0\;addze. %0,%2
14741 [(set_attr "type" "compare")
14742 (set_attr "length" "12,16")])
14745 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
14747 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
14749 (match_operand:DI 2 "gpc_reg_operand" ""))
14751 (set (match_operand:DI 0 "gpc_reg_operand" "")
14752 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
14753 "TARGET_64BIT && reload_completed"
14754 [(set (match_dup 0)
14755 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))
14757 (compare:CC (match_dup 0)
14762 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
14763 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14764 (match_operand:SI 2 "reg_or_short_operand" "r"))
14765 (match_operand:SI 3 "gpc_reg_operand" "r")))]
14767 "doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
14768 [(set_attr "length" "12")])
14771 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
14773 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14774 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
14775 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14777 (clobber (match_scratch:SI 4 "=&r,&r"))]
14780 doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
14782 [(set_attr "type" "compare")
14783 (set_attr "length" "12,16")])
14786 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14788 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14789 (match_operand:SI 2 "reg_or_short_operand" ""))
14790 (match_operand:SI 3 "gpc_reg_operand" ""))
14792 (clobber (match_scratch:SI 4 ""))]
14793 "TARGET_POWER && reload_completed"
14794 [(set (match_dup 4)
14795 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
14797 (compare:CC (match_dup 4)
14802 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
14804 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14805 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
14806 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14808 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
14809 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14812 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
14814 [(set_attr "type" "compare")
14815 (set_attr "length" "12,16")])
14818 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14820 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14821 (match_operand:SI 2 "reg_or_short_operand" ""))
14822 (match_operand:SI 3 "gpc_reg_operand" ""))
14824 (set (match_operand:SI 0 "gpc_reg_operand" "")
14825 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14826 "TARGET_POWER && reload_completed"
14827 [(set (match_dup 0)
14828 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
14830 (compare:CC (match_dup 0)
14835 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14836 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14837 (match_operand:SI 2 "reg_or_short_operand" "r"))))]
14839 "doz %0,%2,%1\;nabs %0,%0\;{srai|srawi} %0,%0,31"
14840 [(set_attr "length" "12")])
14842 (define_insn_and_split "*gtu<mode>"
14843 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
14844 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
14845 (match_operand:P 2 "reg_or_short_operand" "rI")))]
14849 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
14850 (set (match_dup 0) (neg:P (match_dup 0)))]
14853 (define_insn_and_split "*gtu<mode>_compare"
14854 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
14856 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14857 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
14859 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
14860 (gtu:P (match_dup 1) (match_dup 2)))]
14864 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
14865 (parallel [(set (match_dup 3)
14866 (compare:CC (neg:P (match_dup 0)) (const_int 0)))
14867 (set (match_dup 0) (neg:P (match_dup 0)))])]
14870 (define_insn_and_split "*plus_gtu<mode>"
14871 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
14872 (plus:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
14873 (match_operand:P 2 "reg_or_short_operand" "rI"))
14874 (match_operand:P 3 "reg_or_short_operand" "rI")))]
14877 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
14878 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
14879 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))]
14882 (define_insn_and_split "*plus_gtu<mode>_compare"
14883 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
14885 (plus:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
14886 (match_operand:P 2 "reg_or_short_operand" "I,r,I,r"))
14887 (match_operand:P 3 "gpc_reg_operand" "r,r,r,r"))
14889 (set (match_operand:P 0 "gpc_reg_operand" "=&r,&r,&r,&r")
14890 (plus:P (gtu:P (match_dup 1) (match_dup 2)) (match_dup 3)))]
14893 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
14894 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
14895 (parallel [(set (match_dup 4)
14896 (compare:CC (minus:P (match_dup 3) (match_dup 0))
14898 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))])]
14901 (define_insn "*neg_gtu<mode>"
14902 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
14903 (neg:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
14904 (match_operand:P 2 "reg_or_short_operand" "rI"))))]
14906 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0"
14907 [(set_attr "type" "two")
14908 (set_attr "length" "8")])
14911 ;; Define both directions of branch and return. If we need a reload
14912 ;; register, we'd rather use CR0 since it is much easier to copy a
14913 ;; register CC value to there.
14917 (if_then_else (match_operator 1 "branch_comparison_operator"
14919 "cc_reg_operand" "y")
14921 (label_ref (match_operand 0 "" ""))
14926 return output_cbranch (operands[1], \"%l0\", 0, insn);
14928 [(set_attr "type" "branch")])
14932 (if_then_else (match_operator 0 "branch_comparison_operator"
14934 "cc_reg_operand" "y")
14941 return output_cbranch (operands[0], NULL, 0, insn);
14943 [(set_attr "type" "jmpreg")
14944 (set_attr "length" "4")])
14948 (if_then_else (match_operator 1 "branch_comparison_operator"
14950 "cc_reg_operand" "y")
14953 (label_ref (match_operand 0 "" ""))))]
14957 return output_cbranch (operands[1], \"%l0\", 1, insn);
14959 [(set_attr "type" "branch")])
14963 (if_then_else (match_operator 0 "branch_comparison_operator"
14965 "cc_reg_operand" "y")
14972 return output_cbranch (operands[0], NULL, 1, insn);
14974 [(set_attr "type" "jmpreg")
14975 (set_attr "length" "4")])
14977 ;; Logic on condition register values.
14979 ; This pattern matches things like
14980 ; (set (reg:CCEQ 68) (compare:CCEQ (ior:SI (gt:SI (reg:CCFP 68) (const_int 0))
14981 ; (eq:SI (reg:CCFP 68) (const_int 0)))
14983 ; which are generated by the branch logic.
14984 ; Prefer destructive operations where BT = BB (for crXX BT,BA,BB)
14986 (define_insn "*cceq_ior_compare"
14987 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
14988 (compare:CCEQ (match_operator:SI 1 "boolean_operator"
14989 [(match_operator:SI 2
14990 "branch_positive_comparison_operator"
14992 "cc_reg_operand" "y,y")
14994 (match_operator:SI 4
14995 "branch_positive_comparison_operator"
14997 "cc_reg_operand" "0,y")
15001 "cr%q1 %E0,%j2,%j4"
15002 [(set_attr "type" "cr_logical,delayed_cr")])
15004 ; Why is the constant -1 here, but 1 in the previous pattern?
15005 ; Because ~1 has all but the low bit set.
15007 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
15008 (compare:CCEQ (match_operator:SI 1 "boolean_or_operator"
15009 [(not:SI (match_operator:SI 2
15010 "branch_positive_comparison_operator"
15012 "cc_reg_operand" "y,y")
15014 (match_operator:SI 4
15015 "branch_positive_comparison_operator"
15017 "cc_reg_operand" "0,y")
15021 "cr%q1 %E0,%j2,%j4"
15022 [(set_attr "type" "cr_logical,delayed_cr")])
15024 (define_insn "*cceq_rev_compare"
15025 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
15026 (compare:CCEQ (match_operator:SI 1
15027 "branch_positive_comparison_operator"
15029 "cc_reg_operand" "0,y")
15033 "{crnor %E0,%j1,%j1|crnot %E0,%j1}"
15034 [(set_attr "type" "cr_logical,delayed_cr")])
15036 ;; If we are comparing the result of two comparisons, this can be done
15037 ;; using creqv or crxor.
15039 (define_insn_and_split ""
15040 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
15041 (compare:CCEQ (match_operator 1 "branch_comparison_operator"
15042 [(match_operand 2 "cc_reg_operand" "y")
15044 (match_operator 3 "branch_comparison_operator"
15045 [(match_operand 4 "cc_reg_operand" "y")
15050 [(set (match_dup 0) (compare:CCEQ (xor:SI (match_dup 1) (match_dup 3))
15054 int positive_1, positive_2;
15056 positive_1 = branch_positive_comparison_operator (operands[1],
15057 GET_MODE (operands[1]));
15058 positive_2 = branch_positive_comparison_operator (operands[3],
15059 GET_MODE (operands[3]));
15062 operands[1] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[2]),
15063 GET_CODE (operands[1])),
15065 operands[2], const0_rtx);
15066 else if (GET_MODE (operands[1]) != SImode)
15067 operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]), SImode,
15068 operands[2], const0_rtx);
15071 operands[3] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[4]),
15072 GET_CODE (operands[3])),
15074 operands[4], const0_rtx);
15075 else if (GET_MODE (operands[3]) != SImode)
15076 operands[3] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
15077 operands[4], const0_rtx);
15079 if (positive_1 == positive_2)
15081 operands[1] = gen_rtx_NOT (SImode, operands[1]);
15082 operands[5] = constm1_rtx;
15086 operands[5] = const1_rtx;
15090 ;; Unconditional branch and return.
15092 (define_insn "jump"
15094 (label_ref (match_operand 0 "" "")))]
15097 [(set_attr "type" "branch")])
15099 (define_insn "return"
15103 [(set_attr "type" "jmpreg")])
15105 (define_expand "indirect_jump"
15106 [(set (pc) (match_operand 0 "register_operand" ""))])
15108 (define_insn "*indirect_jump<mode>"
15109 [(set (pc) (match_operand:P 0 "register_operand" "c,*l"))]
15114 [(set_attr "type" "jmpreg")])
15116 ;; Table jump for switch statements:
15117 (define_expand "tablejump"
15118 [(use (match_operand 0 "" ""))
15119 (use (label_ref (match_operand 1 "" "")))]
15124 emit_jump_insn (gen_tablejumpsi (operands[0], operands[1]));
15126 emit_jump_insn (gen_tablejumpdi (operands[0], operands[1]));
15130 (define_expand "tablejumpsi"
15131 [(set (match_dup 3)
15132 (plus:SI (match_operand:SI 0 "" "")
15134 (parallel [(set (pc) (match_dup 3))
15135 (use (label_ref (match_operand 1 "" "")))])]
15138 { operands[0] = force_reg (SImode, operands[0]);
15139 operands[2] = force_reg (SImode, gen_rtx_LABEL_REF (SImode, operands[1]));
15140 operands[3] = gen_reg_rtx (SImode);
15143 (define_expand "tablejumpdi"
15144 [(set (match_dup 4)
15145 (sign_extend:DI (match_operand:SI 0 "lwa_operand" "")))
15147 (plus:DI (match_dup 4)
15149 (parallel [(set (pc) (match_dup 3))
15150 (use (label_ref (match_operand 1 "" "")))])]
15153 { operands[2] = force_reg (DImode, gen_rtx_LABEL_REF (DImode, operands[1]));
15154 operands[3] = gen_reg_rtx (DImode);
15155 operands[4] = gen_reg_rtx (DImode);
15158 (define_insn "*tablejump<mode>_internal1"
15160 (match_operand:P 0 "register_operand" "c,*l"))
15161 (use (label_ref (match_operand 1 "" "")))]
15166 [(set_attr "type" "jmpreg")])
15171 "{cror 0,0,0|nop}")
15173 ;; Define the subtract-one-and-jump insns, starting with the template
15174 ;; so loop.c knows what to generate.
15176 (define_expand "doloop_end"
15177 [(use (match_operand 0 "" "")) ; loop pseudo
15178 (use (match_operand 1 "" "")) ; iterations; zero if unknown
15179 (use (match_operand 2 "" "")) ; max iterations
15180 (use (match_operand 3 "" "")) ; loop level
15181 (use (match_operand 4 "" ""))] ; label
15185 /* Only use this on innermost loops. */
15186 if (INTVAL (operands[3]) > 1)
15190 if (GET_MODE (operands[0]) != DImode)
15192 emit_jump_insn (gen_ctrdi (operands[0], operands[4]));
15196 if (GET_MODE (operands[0]) != SImode)
15198 emit_jump_insn (gen_ctrsi (operands[0], operands[4]));
15203 (define_expand "ctr<mode>"
15204 [(parallel [(set (pc)
15205 (if_then_else (ne (match_operand:P 0 "register_operand" "")
15207 (label_ref (match_operand 1 "" ""))
15210 (plus:P (match_dup 0)
15212 (clobber (match_scratch:CC 2 ""))
15213 (clobber (match_scratch:P 3 ""))])]
15217 ;; We need to be able to do this for any operand, including MEM, or we
15218 ;; will cause reload to blow up since we don't allow output reloads on
15220 ;; For the length attribute to be calculated correctly, the
15221 ;; label MUST be operand 0.
15223 (define_insn "*ctr<mode>_internal1"
15225 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
15227 (label_ref (match_operand 0 "" ""))
15229 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
15230 (plus:P (match_dup 1)
15232 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
15233 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
15237 if (which_alternative != 0)
15239 else if (get_attr_length (insn) == 4)
15240 return \"{bdn|bdnz} %l0\";
15242 return \"bdz $+8\;b %l0\";
15244 [(set_attr "type" "branch")
15245 (set_attr "length" "*,12,16,16")])
15247 (define_insn "*ctr<mode>_internal2"
15249 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
15252 (label_ref (match_operand 0 "" ""))))
15253 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
15254 (plus:P (match_dup 1)
15256 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
15257 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
15261 if (which_alternative != 0)
15263 else if (get_attr_length (insn) == 4)
15264 return \"bdz %l0\";
15266 return \"{bdn|bdnz} $+8\;b %l0\";
15268 [(set_attr "type" "branch")
15269 (set_attr "length" "*,12,16,16")])
15271 ;; Similar but use EQ
15273 (define_insn "*ctr<mode>_internal5"
15275 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
15277 (label_ref (match_operand 0 "" ""))
15279 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
15280 (plus:P (match_dup 1)
15282 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
15283 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
15287 if (which_alternative != 0)
15289 else if (get_attr_length (insn) == 4)
15290 return \"bdz %l0\";
15292 return \"{bdn|bdnz} $+8\;b %l0\";
15294 [(set_attr "type" "branch")
15295 (set_attr "length" "*,12,16,16")])
15297 (define_insn "*ctr<mode>_internal6"
15299 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
15302 (label_ref (match_operand 0 "" ""))))
15303 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
15304 (plus:P (match_dup 1)
15306 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
15307 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
15311 if (which_alternative != 0)
15313 else if (get_attr_length (insn) == 4)
15314 return \"{bdn|bdnz} %l0\";
15316 return \"bdz $+8\;b %l0\";
15318 [(set_attr "type" "branch")
15319 (set_attr "length" "*,12,16,16")])
15321 ;; Now the splitters if we could not allocate the CTR register
15325 (if_then_else (match_operator 2 "comparison_operator"
15326 [(match_operand:P 1 "gpc_reg_operand" "")
15328 (match_operand 5 "" "")
15329 (match_operand 6 "" "")))
15330 (set (match_operand:P 0 "gpc_reg_operand" "")
15331 (plus:P (match_dup 1) (const_int -1)))
15332 (clobber (match_scratch:CC 3 ""))
15333 (clobber (match_scratch:P 4 ""))]
15335 [(parallel [(set (match_dup 3)
15336 (compare:CC (plus:P (match_dup 1)
15340 (plus:P (match_dup 1)
15342 (set (pc) (if_then_else (match_dup 7)
15346 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
15347 operands[3], const0_rtx); }")
15351 (if_then_else (match_operator 2 "comparison_operator"
15352 [(match_operand:P 1 "gpc_reg_operand" "")
15354 (match_operand 5 "" "")
15355 (match_operand 6 "" "")))
15356 (set (match_operand:P 0 "nonimmediate_operand" "")
15357 (plus:P (match_dup 1) (const_int -1)))
15358 (clobber (match_scratch:CC 3 ""))
15359 (clobber (match_scratch:P 4 ""))]
15360 "reload_completed && ! gpc_reg_operand (operands[0], SImode)"
15361 [(parallel [(set (match_dup 3)
15362 (compare:CC (plus:P (match_dup 1)
15366 (plus:P (match_dup 1)
15370 (set (pc) (if_then_else (match_dup 7)
15374 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
15375 operands[3], const0_rtx); }")
15377 (define_insn "trap"
15378 [(trap_if (const_int 1) (const_int 0))]
15381 [(set_attr "type" "trap")])
15383 (define_expand "ctrap<mode>4"
15384 [(trap_if (match_operator 0 "ordered_comparison_operator"
15385 [(match_operand:GPR 1 "register_operand")
15386 (match_operand:GPR 2 "reg_or_short_operand")])
15387 (match_operand 3 "zero_constant" ""))]
15392 [(trap_if (match_operator 0 "ordered_comparison_operator"
15393 [(match_operand:GPR 1 "register_operand" "r")
15394 (match_operand:GPR 2 "reg_or_short_operand" "rI")])
15397 "{t|t<wd>}%V0%I2 %1,%2"
15398 [(set_attr "type" "trap")])
15400 ;; Insns related to generating the function prologue and epilogue.
15402 (define_expand "prologue"
15403 [(use (const_int 0))]
15404 "TARGET_SCHED_PROLOG"
15407 rs6000_emit_prologue ();
15411 (define_insn "*movesi_from_cr_one"
15412 [(match_parallel 0 "mfcr_operation"
15413 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
15414 (unspec:SI [(match_operand:CC 2 "cc_reg_operand" "y")
15415 (match_operand 3 "immediate_operand" "n")]
15416 UNSPEC_MOVESI_FROM_CR))])]
15422 for (i = 0; i < XVECLEN (operands[0], 0); i++)
15424 mask = INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
15425 operands[4] = GEN_INT (mask);
15426 output_asm_insn (\"mfcr %1,%4\", operands);
15430 [(set_attr "type" "mfcrf")])
15432 (define_insn "movesi_from_cr"
15433 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
15434 (unspec:SI [(reg:CC CR0_REGNO) (reg:CC CR1_REGNO)
15435 (reg:CC CR2_REGNO) (reg:CC CR3_REGNO)
15436 (reg:CC CR4_REGNO) (reg:CC CR5_REGNO)
15437 (reg:CC CR6_REGNO) (reg:CC CR7_REGNO)]
15438 UNSPEC_MOVESI_FROM_CR))]
15441 [(set_attr "type" "mfcr")])
15443 (define_insn "*stmw"
15444 [(match_parallel 0 "stmw_operation"
15445 [(set (match_operand:SI 1 "memory_operand" "=m")
15446 (match_operand:SI 2 "gpc_reg_operand" "r"))])]
15449 [(set_attr "type" "store_ux")])
15451 (define_insn "*save_gpregs_<mode>"
15452 [(match_parallel 0 "any_parallel_operand"
15453 [(clobber (reg:P 65))
15454 (use (match_operand:P 1 "symbol_ref_operand" "s"))
15455 (use (match_operand:P 2 "gpc_reg_operand" "r"))
15456 (set (match_operand:P 3 "memory_operand" "=m")
15457 (match_operand:P 4 "gpc_reg_operand" "r"))])]
15460 [(set_attr "type" "branch")
15461 (set_attr "length" "4")])
15463 (define_insn "*save_fpregs_<mode>"
15464 [(match_parallel 0 "any_parallel_operand"
15465 [(clobber (reg:P 65))
15466 (use (match_operand:P 1 "symbol_ref_operand" "s"))
15467 (use (match_operand:P 2 "gpc_reg_operand" "r"))
15468 (set (match_operand:DF 3 "memory_operand" "=m")
15469 (match_operand:DF 4 "gpc_reg_operand" "d"))])]
15472 [(set_attr "type" "branch")
15473 (set_attr "length" "4")])
15475 ; These are to explain that changes to the stack pointer should
15476 ; not be moved over stores to stack memory.
15477 (define_insn "stack_tie"
15478 [(set (match_operand:BLK 0 "memory_operand" "+m")
15479 (unspec:BLK [(match_dup 0)] UNSPEC_TIE))]
15482 [(set_attr "length" "0")])
15484 ; Like stack_tie, but depend on both fp and sp based memory.
15485 (define_insn "frame_tie"
15486 [(set (match_operand:BLK 0 "memory_operand" "+m")
15487 (unspec:BLK [(match_dup 0)
15488 (match_operand:BLK 1 "memory_operand" "m")] UNSPEC_TIE))]
15491 [(set_attr "length" "0")])
15494 (define_expand "epilogue"
15495 [(use (const_int 0))]
15496 "TARGET_SCHED_PROLOG"
15499 rs6000_emit_epilogue (FALSE);
15503 ; On some processors, doing the mtcrf one CC register at a time is
15504 ; faster (like on the 604e). On others, doing them all at once is
15505 ; faster; for instance, on the 601 and 750.
15507 (define_expand "movsi_to_cr_one"
15508 [(set (match_operand:CC 0 "cc_reg_operand" "")
15509 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "")
15510 (match_dup 2)] UNSPEC_MOVESI_TO_CR))]
15512 "operands[2] = GEN_INT (1 << (75 - REGNO (operands[0])));")
15514 (define_insn "*movsi_to_cr"
15515 [(match_parallel 0 "mtcrf_operation"
15516 [(set (match_operand:CC 1 "cc_reg_operand" "=y")
15517 (unspec:CC [(match_operand:SI 2 "gpc_reg_operand" "r")
15518 (match_operand 3 "immediate_operand" "n")]
15519 UNSPEC_MOVESI_TO_CR))])]
15525 for (i = 0; i < XVECLEN (operands[0], 0); i++)
15526 mask |= INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
15527 operands[4] = GEN_INT (mask);
15528 return \"mtcrf %4,%2\";
15530 [(set_attr "type" "mtcr")])
15532 (define_insn "*mtcrfsi"
15533 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
15534 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
15535 (match_operand 2 "immediate_operand" "n")]
15536 UNSPEC_MOVESI_TO_CR))]
15537 "GET_CODE (operands[0]) == REG
15538 && CR_REGNO_P (REGNO (operands[0]))
15539 && GET_CODE (operands[2]) == CONST_INT
15540 && INTVAL (operands[2]) == 1 << (75 - REGNO (operands[0]))"
15542 [(set_attr "type" "mtcr")])
15544 ; The load-multiple instructions have similar properties.
15545 ; Note that "load_multiple" is a name known to the machine-independent
15546 ; code that actually corresponds to the PowerPC load-string.
15548 (define_insn "*lmw"
15549 [(match_parallel 0 "lmw_operation"
15550 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
15551 (match_operand:SI 2 "memory_operand" "m"))])]
15554 [(set_attr "type" "load_ux")
15555 (set_attr "cell_micro" "always")])
15557 (define_insn "*return_internal_<mode>"
15559 (use (match_operand:P 0 "register_operand" "lc"))]
15562 [(set_attr "type" "jmpreg")])
15564 ; FIXME: This would probably be somewhat simpler if the Cygnus sibcall
15565 ; stuff was in GCC. Oh, and "any_parallel_operand" is a bit flexible...
15567 (define_insn "*restore_gpregs_<mode>"
15568 [(match_parallel 0 "any_parallel_operand"
15569 [(clobber (match_operand:P 1 "register_operand" "=l"))
15570 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15571 (use (match_operand:P 3 "gpc_reg_operand" "r"))
15572 (set (match_operand:P 4 "gpc_reg_operand" "=r")
15573 (match_operand:P 5 "memory_operand" "m"))])]
15576 [(set_attr "type" "branch")
15577 (set_attr "length" "4")])
15579 (define_insn "*return_and_restore_gpregs_<mode>"
15580 [(match_parallel 0 "any_parallel_operand"
15582 (clobber (match_operand:P 1 "register_operand" "=l"))
15583 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15584 (use (match_operand:P 3 "gpc_reg_operand" "r"))
15585 (set (match_operand:P 4 "gpc_reg_operand" "=r")
15586 (match_operand:P 5 "memory_operand" "m"))])]
15589 [(set_attr "type" "branch")
15590 (set_attr "length" "4")])
15592 (define_insn "*return_and_restore_fpregs_<mode>"
15593 [(match_parallel 0 "any_parallel_operand"
15595 (clobber (match_operand:P 1 "register_operand" "=l"))
15596 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15597 (use (match_operand:P 3 "gpc_reg_operand" "r"))
15598 (set (match_operand:DF 4 "gpc_reg_operand" "=d")
15599 (match_operand:DF 5 "memory_operand" "m"))])]
15602 [(set_attr "type" "branch")
15603 (set_attr "length" "4")])
15605 (define_insn "*return_and_restore_fpregs_aix_<mode>"
15606 [(match_parallel 0 "any_parallel_operand"
15608 (use (match_operand:P 1 "register_operand" "l"))
15609 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15610 (use (match_operand:P 3 "gpc_reg_operand" "r"))
15611 (set (match_operand:DF 4 "gpc_reg_operand" "=d")
15612 (match_operand:DF 5 "memory_operand" "m"))])]
15615 [(set_attr "type" "branch")
15616 (set_attr "length" "4")])
15618 ; This is used in compiling the unwind routines.
15619 (define_expand "eh_return"
15620 [(use (match_operand 0 "general_operand" ""))]
15625 emit_insn (gen_eh_set_lr_si (operands[0]));
15627 emit_insn (gen_eh_set_lr_di (operands[0]));
15631 ; We can't expand this before we know where the link register is stored.
15632 (define_insn "eh_set_lr_<mode>"
15633 [(unspec_volatile [(match_operand:P 0 "register_operand" "r")]
15635 (clobber (match_scratch:P 1 "=&b"))]
15640 [(unspec_volatile [(match_operand 0 "register_operand" "")] UNSPECV_EH_RR)
15641 (clobber (match_scratch 1 ""))]
15646 rs6000_emit_eh_reg_restore (operands[0], operands[1]);
15650 (define_insn "prefetch"
15651 [(prefetch (match_operand 0 "indexed_or_indirect_address" "a")
15652 (match_operand:SI 1 "const_int_operand" "n")
15653 (match_operand:SI 2 "const_int_operand" "n"))]
15657 if (GET_CODE (operands[0]) == REG)
15658 return INTVAL (operands[1]) ? \"dcbtst 0,%0\" : \"dcbt 0,%0\";
15659 return INTVAL (operands[1]) ? \"dcbtst %a0\" : \"dcbt %a0\";
15661 [(set_attr "type" "load")])
15663 (define_insn "bpermd_<mode>"
15664 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
15665 (unspec:P [(match_operand:P 1 "gpc_reg_operand" "r")
15666 (match_operand:P 2 "gpc_reg_operand" "r")] UNSPEC_BPERM))]
15669 [(set_attr "type" "integer")])
15673 (include "sync.md")
15674 (include "vector.md")
15676 (include "altivec.md")
15679 (include "paired.md")