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)
116 ;; UNSPEC_VOLATILE usage
121 (UNSPECV_LL 1) ; load-locked
122 (UNSPECV_SC 2) ; store-conditional
123 (UNSPECV_PROBE_STACK_RANGE 3) ; probe range of stack addresses
124 (UNSPECV_EH_RR 9) ; eh_reg_restore
127 ;; Define an insn type attribute. This is used in function unit delay
129 (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"
130 (const_string "integer"))
132 ;; Define floating point instruction sub-types for use with Xfpu.md
133 (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"))
135 ;; Length (in bytes).
136 ; '(pc)' in the following doesn't include the instruction itself; it is
137 ; calculated as if the instruction had zero size.
138 (define_attr "length" ""
139 (if_then_else (eq_attr "type" "branch")
140 (if_then_else (and (ge (minus (match_dup 0) (pc))
142 (lt (minus (match_dup 0) (pc))
148 ;; Processor type -- this attribute must exactly match the processor_type
149 ;; enumeration in rs6000.h.
151 (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,titan"
152 (const (symbol_ref "rs6000_cpu_attr")))
155 ;; If this instruction is microcoded on the CELL processor
156 ; The default for load extended, the recorded instructions and rotate/shifts by a variable is always microcoded
157 (define_attr "cell_micro" "not,conditional,always"
158 (if_then_else (eq_attr "type" "compare,delayed_compare,imul_compare,lmul_compare,load_ext,load_ext_ux,var_shift_rotate,var_delayed_compare")
159 (const_string "always")
160 (const_string "not")))
162 (automata_option "ndfa")
176 (include "e300c2c3.md")
177 (include "e500mc.md")
178 (include "e500mc64.md")
179 (include "power4.md")
180 (include "power5.md")
181 (include "power6.md")
182 (include "power7.md")
188 (include "predicates.md")
189 (include "constraints.md")
191 (include "darwin.md")
196 ; This mode iterator allows :GPR to be used to indicate the allowable size
197 ; of whole values in GPRs.
198 (define_mode_iterator GPR [SI (DI "TARGET_POWERPC64")])
200 ; Any supported integer mode.
201 (define_mode_iterator INT [QI HI SI DI TI])
203 ; Any supported integer mode that fits in one register.
204 (define_mode_iterator INT1 [QI HI SI (DI "TARGET_POWERPC64")])
206 ; extend modes for DImode
207 (define_mode_iterator QHSI [QI HI SI])
209 ; SImode or DImode, even if DImode doesn't fit in GPRs.
210 (define_mode_iterator SDI [SI DI])
212 ; The size of a pointer. Also, the size of the value that a record-condition
213 ; (one with a '.') will compare; and the size used for arithmetic carries.
214 (define_mode_iterator P [(SI "TARGET_32BIT") (DI "TARGET_64BIT")])
216 ; Any hardware-supported floating-point mode
217 (define_mode_iterator FP [
218 (SF "TARGET_HARD_FLOAT
219 && ((TARGET_FPRS && TARGET_SINGLE_FLOAT) || TARGET_E500_SINGLE)")
220 (DF "TARGET_HARD_FLOAT
221 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)")
222 (TF "!TARGET_IEEEQUAD
224 && (TARGET_FPRS || TARGET_E500_DOUBLE)
225 && TARGET_LONG_DOUBLE_128")
229 ; These modes do not fit in integer registers in 32-bit mode.
230 ; but on e500v2, the gpr are 64 bit registers
231 (define_mode_iterator DIFD [DI (DF "!TARGET_E500_DOUBLE") DD])
233 ; Iterator for reciprocal estimate instructions
234 (define_mode_iterator RECIPF [SF DF V4SF V2DF])
236 ; Iterator for just SF/DF
237 (define_mode_iterator SFDF [SF DF])
239 ; Various instructions that come in SI and DI forms.
240 ; A generic w/d attribute, for things like cmpw/cmpd.
241 (define_mode_attr wd [(QI "b") (HI "h") (SI "w") (DI "d")])
244 (define_mode_attr dbits [(QI "56") (HI "48") (SI "32")])
246 ;; ISEL/ISEL64 target selection
247 (define_mode_attr sel [(SI "") (DI "64")])
249 ;; Suffix for reload patterns
250 (define_mode_attr ptrsize [(SI "32bit")
253 (define_mode_attr tptrsize [(SI "TARGET_32BIT")
254 (DI "TARGET_64BIT")])
256 (define_mode_attr mptrsize [(SI "si")
259 (define_mode_attr rreg [(SF "f")
264 (define_mode_attr rreg2 [(SF "f")
267 (define_mode_attr SI_CONVERT_FP [(SF "TARGET_FCFIDS")
268 (DF "TARGET_FCFID")])
270 (define_mode_attr E500_CONVERT [(SF "!TARGET_FPRS")
271 (DF "TARGET_E500_DOUBLE")])
273 (define_mode_attr TARGET_FLOAT [(SF "TARGET_SINGLE_FLOAT")
274 (DF "TARGET_DOUBLE_FLOAT")])
276 ;; Start with fixed-point load and store insns. Here we put only the more
277 ;; complex forms. Basic data transfer is done later.
279 (define_expand "zero_extend<mode>di2"
280 [(set (match_operand:DI 0 "gpc_reg_operand" "")
281 (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "")))]
285 (define_insn "*zero_extend<mode>di2_internal1"
286 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
287 (zero_extend:DI (match_operand:QHSI 1 "reg_or_mem_operand" "m,r")))]
291 rldicl %0,%1,0,<dbits>"
292 [(set_attr "type" "load,*")])
294 (define_insn "*zero_extend<mode>di2_internal2"
295 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
296 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "r,r"))
298 (clobber (match_scratch:DI 2 "=r,r"))]
301 rldicl. %2,%1,0,<dbits>
303 [(set_attr "type" "compare")
304 (set_attr "length" "4,8")])
307 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
308 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" ""))
310 (clobber (match_scratch:DI 2 ""))]
311 "TARGET_POWERPC64 && reload_completed"
313 (zero_extend:DI (match_dup 1)))
315 (compare:CC (match_dup 2)
319 (define_insn "*zero_extend<mode>di2_internal3"
320 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
321 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "r,r"))
323 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
324 (zero_extend:DI (match_dup 1)))]
327 rldicl. %0,%1,0,<dbits>
329 [(set_attr "type" "compare")
330 (set_attr "length" "4,8")])
333 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
334 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" ""))
336 (set (match_operand:DI 0 "gpc_reg_operand" "")
337 (zero_extend:DI (match_dup 1)))]
338 "TARGET_POWERPC64 && reload_completed"
340 (zero_extend:DI (match_dup 1)))
342 (compare:CC (match_dup 0)
346 (define_insn "extendqidi2"
347 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
348 (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r")))]
351 [(set_attr "type" "exts")])
354 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
355 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
357 (clobber (match_scratch:DI 2 "=r,r"))]
362 [(set_attr "type" "compare")
363 (set_attr "length" "4,8")])
366 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
367 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
369 (clobber (match_scratch:DI 2 ""))]
370 "TARGET_POWERPC64 && reload_completed"
372 (sign_extend:DI (match_dup 1)))
374 (compare:CC (match_dup 2)
379 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
380 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
382 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
383 (sign_extend:DI (match_dup 1)))]
388 [(set_attr "type" "compare")
389 (set_attr "length" "4,8")])
392 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
393 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
395 (set (match_operand:DI 0 "gpc_reg_operand" "")
396 (sign_extend:DI (match_dup 1)))]
397 "TARGET_POWERPC64 && reload_completed"
399 (sign_extend:DI (match_dup 1)))
401 (compare:CC (match_dup 0)
405 (define_expand "extendhidi2"
406 [(set (match_operand:DI 0 "gpc_reg_operand" "")
407 (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "")))]
412 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
413 (sign_extend:DI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
414 "TARGET_POWERPC64 && rs6000_gen_cell_microcode"
418 [(set_attr "type" "load_ext,exts")])
421 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
422 (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r")))]
423 "TARGET_POWERPC64 && !rs6000_gen_cell_microcode"
425 [(set_attr "type" "exts")])
428 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
429 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
431 (clobber (match_scratch:DI 2 "=r,r"))]
436 [(set_attr "type" "compare")
437 (set_attr "length" "4,8")])
440 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
441 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
443 (clobber (match_scratch:DI 2 ""))]
444 "TARGET_POWERPC64 && reload_completed"
446 (sign_extend:DI (match_dup 1)))
448 (compare:CC (match_dup 2)
453 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
454 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
456 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
457 (sign_extend:DI (match_dup 1)))]
462 [(set_attr "type" "compare")
463 (set_attr "length" "4,8")])
466 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
467 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
469 (set (match_operand:DI 0 "gpc_reg_operand" "")
470 (sign_extend:DI (match_dup 1)))]
471 "TARGET_POWERPC64 && reload_completed"
473 (sign_extend:DI (match_dup 1)))
475 (compare:CC (match_dup 0)
479 (define_expand "extendsidi2"
480 [(set (match_operand:DI 0 "gpc_reg_operand" "")
481 (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")))]
486 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
487 (sign_extend:DI (match_operand:SI 1 "lwa_operand" "m,r")))]
488 "TARGET_POWERPC64 && rs6000_gen_cell_microcode"
492 [(set_attr "type" "load_ext,exts")])
495 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
496 (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r")))]
497 "TARGET_POWERPC64 && !rs6000_gen_cell_microcode"
499 [(set_attr "type" "exts")])
502 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
503 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
505 (clobber (match_scratch:DI 2 "=r,r"))]
510 [(set_attr "type" "compare")
511 (set_attr "length" "4,8")])
514 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
515 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
517 (clobber (match_scratch:DI 2 ""))]
518 "TARGET_POWERPC64 && reload_completed"
520 (sign_extend:DI (match_dup 1)))
522 (compare:CC (match_dup 2)
527 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
528 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
530 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
531 (sign_extend:DI (match_dup 1)))]
536 [(set_attr "type" "compare")
537 (set_attr "length" "4,8")])
540 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
541 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
543 (set (match_operand:DI 0 "gpc_reg_operand" "")
544 (sign_extend:DI (match_dup 1)))]
545 "TARGET_POWERPC64 && reload_completed"
547 (sign_extend:DI (match_dup 1)))
549 (compare:CC (match_dup 0)
553 (define_expand "zero_extendqisi2"
554 [(set (match_operand:SI 0 "gpc_reg_operand" "")
555 (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "")))]
560 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
561 (zero_extend:SI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
565 {rlinm|rlwinm} %0,%1,0,0xff"
566 [(set_attr "type" "load,*")])
569 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
570 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
572 (clobber (match_scratch:SI 2 "=r,r"))]
575 {andil.|andi.} %2,%1,0xff
577 [(set_attr "type" "fast_compare,compare")
578 (set_attr "length" "4,8")])
581 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
582 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
584 (clobber (match_scratch:SI 2 ""))]
587 (zero_extend:SI (match_dup 1)))
589 (compare:CC (match_dup 2)
594 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
595 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
597 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
598 (zero_extend:SI (match_dup 1)))]
601 {andil.|andi.} %0,%1,0xff
603 [(set_attr "type" "fast_compare,compare")
604 (set_attr "length" "4,8")])
607 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
608 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
610 (set (match_operand:SI 0 "gpc_reg_operand" "")
611 (zero_extend:SI (match_dup 1)))]
614 (zero_extend:SI (match_dup 1)))
616 (compare:CC (match_dup 0)
620 (define_expand "extendqisi2"
621 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
622 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
627 emit_insn (gen_extendqisi2_ppc (operands[0], operands[1]));
628 else if (TARGET_POWER)
629 emit_insn (gen_extendqisi2_power (operands[0], operands[1]));
631 emit_insn (gen_extendqisi2_no_power (operands[0], operands[1]));
635 (define_insn "extendqisi2_ppc"
636 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
637 (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r")))]
640 [(set_attr "type" "exts")])
643 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
644 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
646 (clobber (match_scratch:SI 2 "=r,r"))]
651 [(set_attr "type" "compare")
652 (set_attr "length" "4,8")])
655 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
656 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
658 (clobber (match_scratch:SI 2 ""))]
659 "TARGET_POWERPC && reload_completed"
661 (sign_extend:SI (match_dup 1)))
663 (compare:CC (match_dup 2)
668 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
669 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
671 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
672 (sign_extend:SI (match_dup 1)))]
677 [(set_attr "type" "compare")
678 (set_attr "length" "4,8")])
681 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
682 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
684 (set (match_operand:SI 0 "gpc_reg_operand" "")
685 (sign_extend:SI (match_dup 1)))]
686 "TARGET_POWERPC && reload_completed"
688 (sign_extend:SI (match_dup 1)))
690 (compare:CC (match_dup 0)
694 (define_expand "extendqisi2_power"
695 [(parallel [(set (match_dup 2)
696 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
698 (clobber (scratch:SI))])
699 (parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
700 (ashiftrt:SI (match_dup 2)
702 (clobber (scratch:SI))])]
705 { operands[1] = gen_lowpart (SImode, operands[1]);
706 operands[2] = gen_reg_rtx (SImode); }")
708 (define_expand "extendqisi2_no_power"
710 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
712 (set (match_operand:SI 0 "gpc_reg_operand" "")
713 (ashiftrt:SI (match_dup 2)
715 "! TARGET_POWER && ! TARGET_POWERPC"
717 { operands[1] = gen_lowpart (SImode, operands[1]);
718 operands[2] = gen_reg_rtx (SImode); }")
720 (define_expand "zero_extendqihi2"
721 [(set (match_operand:HI 0 "gpc_reg_operand" "")
722 (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "")))]
727 [(set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
728 (zero_extend:HI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
732 {rlinm|rlwinm} %0,%1,0,0xff"
733 [(set_attr "type" "load,*")])
736 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
737 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
739 (clobber (match_scratch:HI 2 "=r,r"))]
742 {andil.|andi.} %2,%1,0xff
744 [(set_attr "type" "fast_compare,compare")
745 (set_attr "length" "4,8")])
748 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
749 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
751 (clobber (match_scratch:HI 2 ""))]
754 (zero_extend:HI (match_dup 1)))
756 (compare:CC (match_dup 2)
761 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
762 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
764 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
765 (zero_extend:HI (match_dup 1)))]
768 {andil.|andi.} %0,%1,0xff
770 [(set_attr "type" "fast_compare,compare")
771 (set_attr "length" "4,8")])
774 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
775 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
777 (set (match_operand:HI 0 "gpc_reg_operand" "")
778 (zero_extend:HI (match_dup 1)))]
781 (zero_extend:HI (match_dup 1)))
783 (compare:CC (match_dup 0)
787 (define_expand "extendqihi2"
788 [(use (match_operand:HI 0 "gpc_reg_operand" ""))
789 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
794 emit_insn (gen_extendqihi2_ppc (operands[0], operands[1]));
795 else if (TARGET_POWER)
796 emit_insn (gen_extendqihi2_power (operands[0], operands[1]));
798 emit_insn (gen_extendqihi2_no_power (operands[0], operands[1]));
802 (define_insn "extendqihi2_ppc"
803 [(set (match_operand:HI 0 "gpc_reg_operand" "=r")
804 (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r")))]
807 [(set_attr "type" "exts")])
810 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
811 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
813 (clobber (match_scratch:HI 2 "=r,r"))]
818 [(set_attr "type" "compare")
819 (set_attr "length" "4,8")])
822 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
823 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
825 (clobber (match_scratch:HI 2 ""))]
826 "TARGET_POWERPC && reload_completed"
828 (sign_extend:HI (match_dup 1)))
830 (compare:CC (match_dup 2)
835 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
836 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
838 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
839 (sign_extend:HI (match_dup 1)))]
844 [(set_attr "type" "compare")
845 (set_attr "length" "4,8")])
848 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
849 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
851 (set (match_operand:HI 0 "gpc_reg_operand" "")
852 (sign_extend:HI (match_dup 1)))]
853 "TARGET_POWERPC && reload_completed"
855 (sign_extend:HI (match_dup 1)))
857 (compare:CC (match_dup 0)
861 (define_expand "extendqihi2_power"
862 [(parallel [(set (match_dup 2)
863 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
865 (clobber (scratch:SI))])
866 (parallel [(set (match_operand:HI 0 "gpc_reg_operand" "")
867 (ashiftrt:SI (match_dup 2)
869 (clobber (scratch:SI))])]
872 { operands[0] = gen_lowpart (SImode, operands[0]);
873 operands[1] = gen_lowpart (SImode, operands[1]);
874 operands[2] = gen_reg_rtx (SImode); }")
876 (define_expand "extendqihi2_no_power"
878 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
880 (set (match_operand:HI 0 "gpc_reg_operand" "")
881 (ashiftrt:SI (match_dup 2)
883 "! TARGET_POWER && ! TARGET_POWERPC"
885 { operands[0] = gen_lowpart (SImode, operands[0]);
886 operands[1] = gen_lowpart (SImode, operands[1]);
887 operands[2] = gen_reg_rtx (SImode); }")
889 (define_expand "zero_extendhisi2"
890 [(set (match_operand:SI 0 "gpc_reg_operand" "")
891 (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
896 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
897 (zero_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
901 {rlinm|rlwinm} %0,%1,0,0xffff"
902 [(set_attr "type" "load,*")])
905 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
906 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
908 (clobber (match_scratch:SI 2 "=r,r"))]
911 {andil.|andi.} %2,%1,0xffff
913 [(set_attr "type" "fast_compare,compare")
914 (set_attr "length" "4,8")])
917 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
918 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
920 (clobber (match_scratch:SI 2 ""))]
923 (zero_extend:SI (match_dup 1)))
925 (compare:CC (match_dup 2)
930 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
931 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
933 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
934 (zero_extend:SI (match_dup 1)))]
937 {andil.|andi.} %0,%1,0xffff
939 [(set_attr "type" "fast_compare,compare")
940 (set_attr "length" "4,8")])
943 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
944 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
946 (set (match_operand:SI 0 "gpc_reg_operand" "")
947 (zero_extend:SI (match_dup 1)))]
950 (zero_extend:SI (match_dup 1)))
952 (compare:CC (match_dup 0)
956 (define_expand "extendhisi2"
957 [(set (match_operand:SI 0 "gpc_reg_operand" "")
958 (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
963 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
964 (sign_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
965 "rs6000_gen_cell_microcode"
969 [(set_attr "type" "load_ext,exts")])
972 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
973 (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r")))]
974 "!rs6000_gen_cell_microcode"
976 [(set_attr "type" "exts")])
979 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
980 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
982 (clobber (match_scratch:SI 2 "=r,r"))]
987 [(set_attr "type" "compare")
988 (set_attr "length" "4,8")])
991 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
992 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
994 (clobber (match_scratch:SI 2 ""))]
997 (sign_extend:SI (match_dup 1)))
999 (compare:CC (match_dup 2)
1004 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1005 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
1007 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1008 (sign_extend:SI (match_dup 1)))]
1011 {exts.|extsh.} %0,%1
1013 [(set_attr "type" "compare")
1014 (set_attr "length" "4,8")])
1016 ;; IBM 405, 440, 464 and 476 half-word multiplication operations.
1018 (define_insn "*macchwc"
1019 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1020 (compare:CC (plus:SI (mult:SI (ashiftrt:SI
1021 (match_operand:SI 2 "gpc_reg_operand" "r")
1024 (match_operand:HI 1 "gpc_reg_operand" "r")))
1025 (match_operand:SI 4 "gpc_reg_operand" "0"))
1027 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1028 (plus:SI (mult:SI (ashiftrt:SI
1035 "macchw. %0, %1, %2"
1036 [(set_attr "type" "imul3")])
1038 (define_insn "*macchw"
1039 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1040 (plus:SI (mult:SI (ashiftrt:SI
1041 (match_operand:SI 2 "gpc_reg_operand" "r")
1044 (match_operand:HI 1 "gpc_reg_operand" "r")))
1045 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1048 [(set_attr "type" "imul3")])
1050 (define_insn "*macchwuc"
1051 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1052 (compare:CC (plus:SI (mult:SI (lshiftrt:SI
1053 (match_operand:SI 2 "gpc_reg_operand" "r")
1056 (match_operand:HI 1 "gpc_reg_operand" "r")))
1057 (match_operand:SI 4 "gpc_reg_operand" "0"))
1059 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1060 (plus:SI (mult:SI (lshiftrt:SI
1067 "macchwu. %0, %1, %2"
1068 [(set_attr "type" "imul3")])
1070 (define_insn "*macchwu"
1071 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1072 (plus:SI (mult:SI (lshiftrt:SI
1073 (match_operand:SI 2 "gpc_reg_operand" "r")
1076 (match_operand:HI 1 "gpc_reg_operand" "r")))
1077 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1079 "macchwu %0, %1, %2"
1080 [(set_attr "type" "imul3")])
1082 (define_insn "*machhwc"
1083 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1084 (compare:CC (plus:SI (mult:SI (ashiftrt:SI
1085 (match_operand:SI 1 "gpc_reg_operand" "%r")
1088 (match_operand:SI 2 "gpc_reg_operand" "r")
1090 (match_operand:SI 4 "gpc_reg_operand" "0"))
1092 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1093 (plus:SI (mult:SI (ashiftrt:SI
1101 "machhw. %0, %1, %2"
1102 [(set_attr "type" "imul3")])
1104 (define_insn "*machhw"
1105 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1106 (plus:SI (mult:SI (ashiftrt:SI
1107 (match_operand:SI 1 "gpc_reg_operand" "%r")
1110 (match_operand:SI 2 "gpc_reg_operand" "r")
1112 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1115 [(set_attr "type" "imul3")])
1117 (define_insn "*machhwuc"
1118 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1119 (compare:CC (plus:SI (mult:SI (lshiftrt:SI
1120 (match_operand:SI 1 "gpc_reg_operand" "%r")
1123 (match_operand:SI 2 "gpc_reg_operand" "r")
1125 (match_operand:SI 4 "gpc_reg_operand" "0"))
1127 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1128 (plus:SI (mult:SI (lshiftrt:SI
1136 "machhwu. %0, %1, %2"
1137 [(set_attr "type" "imul3")])
1139 (define_insn "*machhwu"
1140 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1141 (plus:SI (mult:SI (lshiftrt:SI
1142 (match_operand:SI 1 "gpc_reg_operand" "%r")
1145 (match_operand:SI 2 "gpc_reg_operand" "r")
1147 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1149 "machhwu %0, %1, %2"
1150 [(set_attr "type" "imul3")])
1152 (define_insn "*maclhwc"
1153 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1154 (compare:CC (plus:SI (mult:SI (sign_extend:SI
1155 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1157 (match_operand:HI 2 "gpc_reg_operand" "r")))
1158 (match_operand:SI 4 "gpc_reg_operand" "0"))
1160 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1161 (plus:SI (mult:SI (sign_extend:SI
1167 "maclhw. %0, %1, %2"
1168 [(set_attr "type" "imul3")])
1170 (define_insn "*maclhw"
1171 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1172 (plus:SI (mult:SI (sign_extend:SI
1173 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1175 (match_operand:HI 2 "gpc_reg_operand" "r")))
1176 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1179 [(set_attr "type" "imul3")])
1181 (define_insn "*maclhwuc"
1182 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1183 (compare:CC (plus:SI (mult:SI (zero_extend:SI
1184 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1186 (match_operand:HI 2 "gpc_reg_operand" "r")))
1187 (match_operand:SI 4 "gpc_reg_operand" "0"))
1189 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1190 (plus:SI (mult:SI (zero_extend:SI
1196 "maclhwu. %0, %1, %2"
1197 [(set_attr "type" "imul3")])
1199 (define_insn "*maclhwu"
1200 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1201 (plus:SI (mult:SI (zero_extend:SI
1202 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1204 (match_operand:HI 2 "gpc_reg_operand" "r")))
1205 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1207 "maclhwu %0, %1, %2"
1208 [(set_attr "type" "imul3")])
1210 (define_insn "*nmacchwc"
1211 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1212 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1213 (mult:SI (ashiftrt:SI
1214 (match_operand:SI 2 "gpc_reg_operand" "r")
1217 (match_operand:HI 1 "gpc_reg_operand" "r"))))
1219 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1220 (minus:SI (match_dup 4)
1221 (mult:SI (ashiftrt:SI
1227 "nmacchw. %0, %1, %2"
1228 [(set_attr "type" "imul3")])
1230 (define_insn "*nmacchw"
1231 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1232 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1233 (mult:SI (ashiftrt:SI
1234 (match_operand:SI 2 "gpc_reg_operand" "r")
1237 (match_operand:HI 1 "gpc_reg_operand" "r")))))]
1239 "nmacchw %0, %1, %2"
1240 [(set_attr "type" "imul3")])
1242 (define_insn "*nmachhwc"
1243 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1244 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1245 (mult:SI (ashiftrt:SI
1246 (match_operand:SI 1 "gpc_reg_operand" "%r")
1249 (match_operand:SI 2 "gpc_reg_operand" "r")
1252 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1253 (minus:SI (match_dup 4)
1254 (mult:SI (ashiftrt:SI
1261 "nmachhw. %0, %1, %2"
1262 [(set_attr "type" "imul3")])
1264 (define_insn "*nmachhw"
1265 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1266 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1267 (mult:SI (ashiftrt:SI
1268 (match_operand:SI 1 "gpc_reg_operand" "%r")
1271 (match_operand:SI 2 "gpc_reg_operand" "r")
1274 "nmachhw %0, %1, %2"
1275 [(set_attr "type" "imul3")])
1277 (define_insn "*nmaclhwc"
1278 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1279 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1280 (mult:SI (sign_extend:SI
1281 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1283 (match_operand:HI 2 "gpc_reg_operand" "r"))))
1285 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1286 (minus:SI (match_dup 4)
1287 (mult:SI (sign_extend:SI
1292 "nmaclhw. %0, %1, %2"
1293 [(set_attr "type" "imul3")])
1295 (define_insn "*nmaclhw"
1296 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1297 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1298 (mult:SI (sign_extend:SI
1299 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1301 (match_operand:HI 2 "gpc_reg_operand" "r")))))]
1303 "nmaclhw %0, %1, %2"
1304 [(set_attr "type" "imul3")])
1306 (define_insn "*mulchwc"
1307 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1308 (compare:CC (mult:SI (ashiftrt:SI
1309 (match_operand:SI 2 "gpc_reg_operand" "r")
1312 (match_operand:HI 1 "gpc_reg_operand" "r")))
1314 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1315 (mult:SI (ashiftrt:SI
1321 "mulchw. %0, %1, %2"
1322 [(set_attr "type" "imul3")])
1324 (define_insn "*mulchw"
1325 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1326 (mult:SI (ashiftrt:SI
1327 (match_operand:SI 2 "gpc_reg_operand" "r")
1330 (match_operand:HI 1 "gpc_reg_operand" "r"))))]
1333 [(set_attr "type" "imul3")])
1335 (define_insn "*mulchwuc"
1336 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1337 (compare:CC (mult:SI (lshiftrt:SI
1338 (match_operand:SI 2 "gpc_reg_operand" "r")
1341 (match_operand:HI 1 "gpc_reg_operand" "r")))
1343 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1344 (mult:SI (lshiftrt:SI
1350 "mulchwu. %0, %1, %2"
1351 [(set_attr "type" "imul3")])
1353 (define_insn "*mulchwu"
1354 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1355 (mult:SI (lshiftrt:SI
1356 (match_operand:SI 2 "gpc_reg_operand" "r")
1359 (match_operand:HI 1 "gpc_reg_operand" "r"))))]
1361 "mulchwu %0, %1, %2"
1362 [(set_attr "type" "imul3")])
1364 (define_insn "*mulhhwc"
1365 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1366 (compare:CC (mult:SI (ashiftrt:SI
1367 (match_operand:SI 1 "gpc_reg_operand" "%r")
1370 (match_operand:SI 2 "gpc_reg_operand" "r")
1373 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1374 (mult:SI (ashiftrt:SI
1381 "mulhhw. %0, %1, %2"
1382 [(set_attr "type" "imul3")])
1384 (define_insn "*mulhhw"
1385 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1386 (mult:SI (ashiftrt:SI
1387 (match_operand:SI 1 "gpc_reg_operand" "%r")
1390 (match_operand:SI 2 "gpc_reg_operand" "r")
1394 [(set_attr "type" "imul3")])
1396 (define_insn "*mulhhwuc"
1397 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1398 (compare:CC (mult:SI (lshiftrt:SI
1399 (match_operand:SI 1 "gpc_reg_operand" "%r")
1402 (match_operand:SI 2 "gpc_reg_operand" "r")
1405 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1406 (mult:SI (lshiftrt:SI
1413 "mulhhwu. %0, %1, %2"
1414 [(set_attr "type" "imul3")])
1416 (define_insn "*mulhhwu"
1417 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1418 (mult:SI (lshiftrt:SI
1419 (match_operand:SI 1 "gpc_reg_operand" "%r")
1422 (match_operand:SI 2 "gpc_reg_operand" "r")
1425 "mulhhwu %0, %1, %2"
1426 [(set_attr "type" "imul3")])
1428 (define_insn "*mullhwc"
1429 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1430 (compare:CC (mult:SI (sign_extend:SI
1431 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1433 (match_operand:HI 2 "gpc_reg_operand" "r")))
1435 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1436 (mult:SI (sign_extend:SI
1441 "mullhw. %0, %1, %2"
1442 [(set_attr "type" "imul3")])
1444 (define_insn "*mullhw"
1445 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1446 (mult:SI (sign_extend:SI
1447 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1449 (match_operand:HI 2 "gpc_reg_operand" "r"))))]
1452 [(set_attr "type" "imul3")])
1454 (define_insn "*mullhwuc"
1455 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1456 (compare:CC (mult:SI (zero_extend:SI
1457 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1459 (match_operand:HI 2 "gpc_reg_operand" "r")))
1461 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1462 (mult:SI (zero_extend:SI
1467 "mullhwu. %0, %1, %2"
1468 [(set_attr "type" "imul3")])
1470 (define_insn "*mullhwu"
1471 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1472 (mult:SI (zero_extend:SI
1473 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1475 (match_operand:HI 2 "gpc_reg_operand" "r"))))]
1477 "mullhwu %0, %1, %2"
1478 [(set_attr "type" "imul3")])
1480 ;; IBM 405, 440, 464 and 476 string-search dlmzb instruction support.
1481 (define_insn "dlmzb"
1482 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1483 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
1484 (match_operand:SI 2 "gpc_reg_operand" "r")]
1486 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1487 (unspec:SI [(match_dup 1)
1491 "dlmzb. %0, %1, %2")
1493 (define_expand "strlensi"
1494 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1495 (unspec:SI [(match_operand:BLK 1 "general_operand" "")
1496 (match_operand:QI 2 "const_int_operand" "")
1497 (match_operand 3 "const_int_operand" "")]
1498 UNSPEC_DLMZB_STRLEN))
1499 (clobber (match_scratch:CC 4 "=x"))]
1500 "TARGET_DLMZB && WORDS_BIG_ENDIAN && !optimize_size"
1502 rtx result = operands[0];
1503 rtx src = operands[1];
1504 rtx search_char = operands[2];
1505 rtx align = operands[3];
1506 rtx addr, scratch_string, word1, word2, scratch_dlmzb;
1507 rtx loop_label, end_label, mem, cr0, cond;
1508 if (search_char != const0_rtx
1509 || GET_CODE (align) != CONST_INT
1510 || INTVAL (align) < 8)
1512 word1 = gen_reg_rtx (SImode);
1513 word2 = gen_reg_rtx (SImode);
1514 scratch_dlmzb = gen_reg_rtx (SImode);
1515 scratch_string = gen_reg_rtx (Pmode);
1516 loop_label = gen_label_rtx ();
1517 end_label = gen_label_rtx ();
1518 addr = force_reg (Pmode, XEXP (src, 0));
1519 emit_move_insn (scratch_string, addr);
1520 emit_label (loop_label);
1521 mem = change_address (src, SImode, scratch_string);
1522 emit_move_insn (word1, mem);
1523 emit_move_insn (word2, adjust_address (mem, SImode, 4));
1524 cr0 = gen_rtx_REG (CCmode, CR0_REGNO);
1525 emit_insn (gen_dlmzb (scratch_dlmzb, word1, word2, cr0));
1526 cond = gen_rtx_NE (VOIDmode, cr0, const0_rtx);
1527 emit_jump_insn (gen_rtx_SET (VOIDmode,
1529 gen_rtx_IF_THEN_ELSE (VOIDmode,
1535 emit_insn (gen_addsi3 (scratch_string, scratch_string, GEN_INT (8)));
1536 emit_jump_insn (gen_rtx_SET (VOIDmode,
1538 gen_rtx_LABEL_REF (VOIDmode, loop_label)));
1540 emit_label (end_label);
1541 emit_insn (gen_addsi3 (scratch_string, scratch_string, scratch_dlmzb));
1542 emit_insn (gen_subsi3 (result, scratch_string, addr));
1543 emit_insn (gen_subsi3 (result, result, const1_rtx));
1548 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
1549 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1551 (set (match_operand:SI 0 "gpc_reg_operand" "")
1552 (sign_extend:SI (match_dup 1)))]
1555 (sign_extend:SI (match_dup 1)))
1557 (compare:CC (match_dup 0)
1561 ;; Fixed-point arithmetic insns.
1563 (define_expand "add<mode>3"
1564 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1565 (plus:SDI (match_operand:SDI 1 "gpc_reg_operand" "")
1566 (match_operand:SDI 2 "reg_or_add_cint_operand" "")))]
1569 if (<MODE>mode == DImode && ! TARGET_POWERPC64)
1571 if (non_short_cint_operand (operands[2], DImode))
1574 else if (GET_CODE (operands[2]) == CONST_INT
1575 && ! add_operand (operands[2], <MODE>mode))
1577 rtx tmp = ((!can_create_pseudo_p ()
1578 || rtx_equal_p (operands[0], operands[1]))
1579 ? operands[0] : gen_reg_rtx (<MODE>mode));
1581 HOST_WIDE_INT val = INTVAL (operands[2]);
1582 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1583 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, <MODE>mode);
1585 if (<MODE>mode == DImode && !satisfies_constraint_L (GEN_INT (rest)))
1588 /* The ordering here is important for the prolog expander.
1589 When space is allocated from the stack, adding 'low' first may
1590 produce a temporary deallocation (which would be bad). */
1591 emit_insn (gen_add<mode>3 (tmp, operands[1], GEN_INT (rest)));
1592 emit_insn (gen_add<mode>3 (operands[0], tmp, GEN_INT (low)));
1597 ;; Discourage ai/addic because of carry but provide it in an alternative
1598 ;; allowing register zero as source.
1599 (define_insn "*add<mode>3_internal1"
1600 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r,?r,r")
1601 (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "%r,b,r,b")
1602 (match_operand:GPR 2 "add_operand" "r,I,I,L")))]
1603 "!DECIMAL_FLOAT_MODE_P (GET_MODE (operands[0])) && !DECIMAL_FLOAT_MODE_P (GET_MODE (operands[1]))"
1606 {cal %0,%2(%1)|addi %0,%1,%2}
1608 {cau|addis} %0,%1,%v2"
1609 [(set_attr "length" "4,4,4,4")])
1611 (define_insn "addsi3_high"
1612 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
1613 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
1614 (high:SI (match_operand 2 "" ""))))]
1615 "TARGET_MACHO && !TARGET_64BIT"
1616 "{cau|addis} %0,%1,ha16(%2)"
1617 [(set_attr "length" "4")])
1619 (define_insn "*add<mode>3_internal2"
1620 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
1621 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "%r,r,r,r")
1622 (match_operand:P 2 "reg_or_short_operand" "r,I,r,I"))
1624 (clobber (match_scratch:P 3 "=r,r,r,r"))]
1627 {cax.|add.} %3,%1,%2
1628 {ai.|addic.} %3,%1,%2
1631 [(set_attr "type" "fast_compare,compare,compare,compare")
1632 (set_attr "length" "4,4,8,8")])
1635 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1636 (compare:CC (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1637 (match_operand:GPR 2 "reg_or_short_operand" ""))
1639 (clobber (match_scratch:GPR 3 ""))]
1642 (plus:GPR (match_dup 1)
1645 (compare:CC (match_dup 3)
1649 (define_insn "*add<mode>3_internal3"
1650 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
1651 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "%r,r,r,r")
1652 (match_operand:P 2 "reg_or_short_operand" "r,I,r,I"))
1654 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
1655 (plus:P (match_dup 1)
1659 {cax.|add.} %0,%1,%2
1660 {ai.|addic.} %0,%1,%2
1663 [(set_attr "type" "fast_compare,compare,compare,compare")
1664 (set_attr "length" "4,4,8,8")])
1667 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1668 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "")
1669 (match_operand:P 2 "reg_or_short_operand" ""))
1671 (set (match_operand:P 0 "gpc_reg_operand" "")
1672 (plus:P (match_dup 1) (match_dup 2)))]
1675 (plus:P (match_dup 1)
1678 (compare:CC (match_dup 0)
1682 ;; Split an add that we can't do in one insn into two insns, each of which
1683 ;; does one 16-bit part. This is used by combine. Note that the low-order
1684 ;; add should be last in case the result gets used in an address.
1687 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
1688 (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1689 (match_operand:GPR 2 "non_add_cint_operand" "")))]
1691 [(set (match_dup 0) (plus:GPR (match_dup 1) (match_dup 3)))
1692 (set (match_dup 0) (plus:GPR (match_dup 0) (match_dup 4)))]
1694 HOST_WIDE_INT val = INTVAL (operands[2]);
1695 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1696 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, <MODE>mode);
1698 operands[4] = GEN_INT (low);
1699 if (<MODE>mode == SImode || satisfies_constraint_L (GEN_INT (rest)))
1700 operands[3] = GEN_INT (rest);
1701 else if (can_create_pseudo_p ())
1703 operands[3] = gen_reg_rtx (DImode);
1704 emit_move_insn (operands[3], operands[2]);
1705 emit_insn (gen_adddi3 (operands[0], operands[1], operands[3]));
1712 (define_insn "one_cmpl<mode>2"
1713 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1714 (not:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
1719 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1720 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1722 (clobber (match_scratch:P 2 "=r,r"))]
1727 [(set_attr "type" "fast_compare,compare")
1728 (set_attr "length" "4,8")])
1731 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
1732 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" ""))
1734 (clobber (match_scratch:P 2 ""))]
1737 (not:P (match_dup 1)))
1739 (compare:CC (match_dup 2)
1744 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1745 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1747 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
1748 (not:P (match_dup 1)))]
1753 [(set_attr "type" "fast_compare,compare")
1754 (set_attr "length" "4,8")])
1757 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
1758 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" ""))
1760 (set (match_operand:P 0 "gpc_reg_operand" "")
1761 (not:P (match_dup 1)))]
1764 (not:P (match_dup 1)))
1766 (compare:CC (match_dup 0)
1771 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1772 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "rI")
1773 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1775 "{sf%I1|subf%I1c} %0,%2,%1")
1778 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
1779 (minus:GPR (match_operand:GPR 1 "reg_or_short_operand" "r,I")
1780 (match_operand:GPR 2 "gpc_reg_operand" "r,r")))]
1787 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1788 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1789 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1791 (clobber (match_scratch:SI 3 "=r,r"))]
1794 {sf.|subfc.} %3,%2,%1
1796 [(set_attr "type" "compare")
1797 (set_attr "length" "4,8")])
1800 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1801 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "r,r")
1802 (match_operand:P 2 "gpc_reg_operand" "r,r"))
1804 (clobber (match_scratch:P 3 "=r,r"))]
1809 [(set_attr "type" "fast_compare")
1810 (set_attr "length" "4,8")])
1813 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1814 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "")
1815 (match_operand:P 2 "gpc_reg_operand" ""))
1817 (clobber (match_scratch:P 3 ""))]
1820 (minus:P (match_dup 1)
1823 (compare:CC (match_dup 3)
1828 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1829 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1830 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1832 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1833 (minus:SI (match_dup 1) (match_dup 2)))]
1836 {sf.|subfc.} %0,%2,%1
1838 [(set_attr "type" "compare")
1839 (set_attr "length" "4,8")])
1842 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1843 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "r,r")
1844 (match_operand:P 2 "gpc_reg_operand" "r,r"))
1846 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
1847 (minus:P (match_dup 1)
1853 [(set_attr "type" "fast_compare")
1854 (set_attr "length" "4,8")])
1857 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1858 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "")
1859 (match_operand:P 2 "gpc_reg_operand" ""))
1861 (set (match_operand:P 0 "gpc_reg_operand" "")
1862 (minus:P (match_dup 1)
1866 (minus:P (match_dup 1)
1869 (compare:CC (match_dup 0)
1873 (define_expand "sub<mode>3"
1874 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1875 (minus:SDI (match_operand:SDI 1 "reg_or_short_operand" "")
1876 (match_operand:SDI 2 "reg_or_sub_cint_operand" "")))]
1880 if (GET_CODE (operands[2]) == CONST_INT)
1882 emit_insn (gen_add<mode>3 (operands[0], operands[1],
1883 negate_rtx (<MODE>mode, operands[2])));
1888 ;; For SMIN, SMAX, UMIN, and UMAX, we use DEFINE_EXPAND's that involve a doz[i]
1889 ;; instruction and some auxiliary computations. Then we just have a single
1890 ;; DEFINE_INSN for doz[i] and the define_splits to make them if made by
1893 (define_expand "sminsi3"
1895 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1896 (match_operand:SI 2 "reg_or_short_operand" ""))
1898 (minus:SI (match_dup 2) (match_dup 1))))
1899 (set (match_operand:SI 0 "gpc_reg_operand" "")
1900 (minus:SI (match_dup 2) (match_dup 3)))]
1901 "TARGET_POWER || TARGET_ISEL"
1906 operands[2] = force_reg (SImode, operands[2]);
1907 rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]);
1911 operands[3] = gen_reg_rtx (SImode);
1915 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1916 (smin:SI (match_operand:SI 1 "gpc_reg_operand" "")
1917 (match_operand:SI 2 "reg_or_short_operand" "")))
1918 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1921 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1923 (minus:SI (match_dup 2) (match_dup 1))))
1924 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 3)))]
1927 (define_expand "smaxsi3"
1929 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1930 (match_operand:SI 2 "reg_or_short_operand" ""))
1932 (minus:SI (match_dup 2) (match_dup 1))))
1933 (set (match_operand:SI 0 "gpc_reg_operand" "")
1934 (plus:SI (match_dup 3) (match_dup 1)))]
1935 "TARGET_POWER || TARGET_ISEL"
1940 operands[2] = force_reg (SImode, operands[2]);
1941 rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]);
1944 operands[3] = gen_reg_rtx (SImode);
1948 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1949 (smax:SI (match_operand:SI 1 "gpc_reg_operand" "")
1950 (match_operand:SI 2 "reg_or_short_operand" "")))
1951 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1954 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1956 (minus:SI (match_dup 2) (match_dup 1))))
1957 (set (match_dup 0) (plus:SI (match_dup 3) (match_dup 1)))]
1960 (define_expand "uminsi3"
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 (minus:SI (match_dup 2) (match_dup 3)))]
1970 "TARGET_POWER || TARGET_ISEL"
1975 rs6000_emit_minmax (operands[0], UMIN, 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);
1983 (define_expand "umaxsi3"
1984 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1986 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
1988 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
1990 (minus:SI (match_dup 4) (match_dup 3))))
1991 (set (match_operand:SI 0 "gpc_reg_operand" "")
1992 (plus:SI (match_dup 3) (match_dup 1)))]
1993 "TARGET_POWER || TARGET_ISEL"
1998 rs6000_emit_minmax (operands[0], UMAX, operands[1], operands[2]);
2001 operands[3] = gen_reg_rtx (SImode);
2002 operands[4] = gen_reg_rtx (SImode);
2003 operands[5] = GEN_INT (-2147483647 - 1);
2007 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2008 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r")
2009 (match_operand:SI 2 "reg_or_short_operand" "rI"))
2011 (minus:SI (match_dup 2) (match_dup 1))))]
2016 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2018 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
2019 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
2021 (minus:SI (match_dup 2) (match_dup 1)))
2023 (clobber (match_scratch:SI 3 "=r,r"))]
2028 [(set_attr "type" "delayed_compare")
2029 (set_attr "length" "4,8")])
2032 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2034 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "")
2035 (match_operand:SI 2 "reg_or_short_operand" ""))
2037 (minus:SI (match_dup 2) (match_dup 1)))
2039 (clobber (match_scratch:SI 3 ""))]
2040 "TARGET_POWER && reload_completed"
2042 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
2044 (minus:SI (match_dup 2) (match_dup 1))))
2046 (compare:CC (match_dup 3)
2051 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2053 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
2054 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
2056 (minus:SI (match_dup 2) (match_dup 1)))
2058 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2059 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
2061 (minus:SI (match_dup 2) (match_dup 1))))]
2066 [(set_attr "type" "delayed_compare")
2067 (set_attr "length" "4,8")])
2070 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2072 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "")
2073 (match_operand:SI 2 "reg_or_short_operand" ""))
2075 (minus:SI (match_dup 2) (match_dup 1)))
2077 (set (match_operand:SI 0 "gpc_reg_operand" "")
2078 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
2080 (minus:SI (match_dup 2) (match_dup 1))))]
2081 "TARGET_POWER && reload_completed"
2083 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
2085 (minus:SI (match_dup 2) (match_dup 1))))
2087 (compare:CC (match_dup 0)
2091 ;; We don't need abs with condition code because such comparisons should
2093 (define_expand "abssi2"
2094 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2095 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))]
2101 emit_insn (gen_abssi2_isel (operands[0], operands[1]));
2104 else if (! TARGET_POWER)
2106 emit_insn (gen_abssi2_nopower (operands[0], operands[1]));
2111 (define_insn "*abssi2_power"
2112 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2113 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
2117 (define_insn_and_split "abs<mode>2_isel"
2118 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2119 (abs:GPR (match_operand:GPR 1 "gpc_reg_operand" "b")))
2120 (clobber (match_scratch:GPR 2 "=&b"))
2121 (clobber (match_scratch:CC 3 "=y"))]
2124 "&& reload_completed"
2125 [(set (match_dup 2) (neg:GPR (match_dup 1)))
2127 (compare:CC (match_dup 1)
2130 (if_then_else:GPR (lt (match_dup 3)
2136 (define_insn_and_split "nabs<mode>2_isel"
2137 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2138 (neg:GPR (abs:GPR (match_operand:GPR 1 "gpc_reg_operand" "b"))))
2139 (clobber (match_scratch:GPR 2 "=&b"))
2140 (clobber (match_scratch:CC 3 "=y"))]
2143 "&& reload_completed"
2144 [(set (match_dup 2) (neg:GPR (match_dup 1)))
2146 (compare:CC (match_dup 1)
2149 (if_then_else:GPR (lt (match_dup 3)
2155 (define_insn_and_split "abssi2_nopower"
2156 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
2157 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0")))
2158 (clobber (match_scratch:SI 2 "=&r,&r"))]
2159 "! TARGET_POWER && ! TARGET_ISEL"
2161 "&& reload_completed"
2162 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
2163 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
2164 (set (match_dup 0) (minus:SI (match_dup 0) (match_dup 2)))]
2167 (define_insn "*nabs_power"
2168 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2169 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r"))))]
2173 (define_insn_and_split "*nabs_nopower"
2174 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
2175 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0"))))
2176 (clobber (match_scratch:SI 2 "=&r,&r"))]
2179 "&& reload_completed"
2180 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
2181 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
2182 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 0)))]
2185 (define_expand "neg<mode>2"
2186 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
2187 (neg:SDI (match_operand:SDI 1 "gpc_reg_operand" "")))]
2191 (define_insn "*neg<mode>2_internal"
2192 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2193 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
2198 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2199 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
2201 (clobber (match_scratch:P 2 "=r,r"))]
2206 [(set_attr "type" "fast_compare")
2207 (set_attr "length" "4,8")])
2210 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2211 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" ""))
2213 (clobber (match_scratch:P 2 ""))]
2216 (neg:P (match_dup 1)))
2218 (compare:CC (match_dup 2)
2223 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
2224 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
2226 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
2227 (neg:P (match_dup 1)))]
2232 [(set_attr "type" "fast_compare")
2233 (set_attr "length" "4,8")])
2236 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
2237 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" ""))
2239 (set (match_operand:P 0 "gpc_reg_operand" "")
2240 (neg:P (match_dup 1)))]
2243 (neg:P (match_dup 1)))
2245 (compare:CC (match_dup 0)
2249 (define_insn "clz<mode>2"
2250 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2251 (clz:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
2253 "{cntlz|cntlz<wd>} %0,%1"
2254 [(set_attr "type" "cntlz")])
2256 (define_expand "ctz<mode>2"
2258 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))
2259 (parallel [(set (match_dup 3) (and:GPR (match_dup 1)
2261 (clobber (scratch:CC))])
2262 (set (match_dup 4) (clz:GPR (match_dup 3)))
2263 (set (match_operand:GPR 0 "gpc_reg_operand" "")
2264 (minus:GPR (match_dup 5) (match_dup 4)))]
2267 operands[2] = gen_reg_rtx (<MODE>mode);
2268 operands[3] = gen_reg_rtx (<MODE>mode);
2269 operands[4] = gen_reg_rtx (<MODE>mode);
2270 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode) - 1);
2273 (define_expand "ffs<mode>2"
2275 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))
2276 (parallel [(set (match_dup 3) (and:GPR (match_dup 1)
2278 (clobber (scratch:CC))])
2279 (set (match_dup 4) (clz:GPR (match_dup 3)))
2280 (set (match_operand:GPR 0 "gpc_reg_operand" "")
2281 (minus:GPR (match_dup 5) (match_dup 4)))]
2284 operands[2] = gen_reg_rtx (<MODE>mode);
2285 operands[3] = gen_reg_rtx (<MODE>mode);
2286 operands[4] = gen_reg_rtx (<MODE>mode);
2287 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode));
2290 (define_insn "popcntb<mode>2"
2291 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2292 (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")]
2297 (define_insn "popcntd<mode>2"
2298 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2299 (popcount:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
2303 (define_expand "popcount<mode>2"
2304 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2305 (popcount:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))]
2306 "TARGET_POPCNTB || TARGET_POPCNTD"
2308 rs6000_emit_popcount (operands[0], operands[1]);
2312 (define_insn "parity<mode>2_cmpb"
2313 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2314 (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")] UNSPEC_PARITY))]
2315 "TARGET_CMPB && TARGET_POPCNTB"
2318 (define_expand "parity<mode>2"
2319 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2320 (parity:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))]
2323 rs6000_emit_parity (operands[0], operands[1]);
2327 ;; Since the hardware zeros the upper part of the register, save generating the
2328 ;; AND immediate if we are converting to unsigned
2329 (define_insn "*bswaphi2_extenddi"
2330 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
2332 (bswap:HI (match_operand:HI 1 "memory_operand" "Z"))))]
2335 [(set_attr "length" "4")
2336 (set_attr "type" "load")])
2338 (define_insn "*bswaphi2_extendsi"
2339 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2341 (bswap:HI (match_operand:HI 1 "memory_operand" "Z"))))]
2344 [(set_attr "length" "4")
2345 (set_attr "type" "load")])
2347 (define_expand "bswaphi2"
2348 [(parallel [(set (match_operand:HI 0 "reg_or_mem_operand" "")
2350 (match_operand:HI 1 "reg_or_mem_operand" "")))
2351 (clobber (match_scratch:SI 2 ""))])]
2354 if (!REG_P (operands[0]) && !REG_P (operands[1]))
2355 operands[1] = force_reg (HImode, operands[1]);
2358 (define_insn "bswaphi2_internal"
2359 [(set (match_operand:HI 0 "reg_or_mem_operand" "=r,Z,&r")
2361 (match_operand:HI 1 "reg_or_mem_operand" "Z,r,r")))
2362 (clobber (match_scratch:SI 2 "=X,X,&r"))]
2368 [(set_attr "length" "4,4,12")
2369 (set_attr "type" "load,store,*")])
2372 [(set (match_operand:HI 0 "gpc_reg_operand" "")
2373 (bswap:HI (match_operand:HI 1 "gpc_reg_operand" "")))
2374 (clobber (match_operand:SI 2 "gpc_reg_operand" ""))]
2375 "TARGET_POWERPC && reload_completed"
2377 (zero_extract:SI (match_dup 4)
2381 (and:SI (ashift:SI (match_dup 4)
2383 (const_int 65280))) ;; 0xff00
2385 (ior:SI (match_dup 3)
2389 operands[3] = simplify_gen_subreg (SImode, operands[0], HImode, 0);
2390 operands[4] = simplify_gen_subreg (SImode, operands[1], HImode, 0);
2393 (define_insn "*bswapsi2_extenddi"
2394 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
2396 (bswap:SI (match_operand:SI 1 "memory_operand" "Z"))))]
2399 [(set_attr "length" "4")
2400 (set_attr "type" "load")])
2402 (define_expand "bswapsi2"
2403 [(set (match_operand:SI 0 "reg_or_mem_operand" "")
2405 (match_operand:SI 1 "reg_or_mem_operand" "")))]
2408 if (!REG_P (operands[0]) && !REG_P (operands[1]))
2409 operands[1] = force_reg (SImode, operands[1]);
2412 (define_insn "*bswapsi2_internal"
2413 [(set (match_operand:SI 0 "reg_or_mem_operand" "=r,Z,&r")
2415 (match_operand:SI 1 "reg_or_mem_operand" "Z,r,r")))]
2419 {stbrx|stwbrx} %1,%y0
2421 [(set_attr "length" "4,4,12")
2422 (set_attr "type" "load,store,*")])
2425 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2426 (bswap:SI (match_operand:SI 1 "gpc_reg_operand" "")))]
2429 (rotate:SI (match_dup 1) (const_int 8)))
2430 (set (zero_extract:SI (match_dup 0)
2434 (set (zero_extract:SI (match_dup 0)
2437 (rotate:SI (match_dup 1)
2441 (define_expand "bswapdi2"
2442 [(parallel [(set (match_operand:DI 0 "reg_or_mem_operand" "")
2444 (match_operand:DI 1 "reg_or_mem_operand" "")))
2445 (clobber (match_scratch:DI 2 ""))
2446 (clobber (match_scratch:DI 3 ""))
2447 (clobber (match_scratch:DI 4 ""))])]
2450 if (!REG_P (operands[0]) && !REG_P (operands[1]))
2451 operands[1] = force_reg (DImode, operands[1]);
2453 if (!TARGET_POWERPC64)
2455 /* 32-bit mode needs fewer scratch registers, but 32-bit addressing mode
2456 that uses 64-bit registers needs the same scratch registers as 64-bit
2458 emit_insn (gen_bswapdi2_32bit (operands[0], operands[1]));
2463 ;; Power7/cell has ldbrx/stdbrx, so use it directly
2464 (define_insn "*bswapdi2_ldbrx"
2465 [(set (match_operand:DI 0 "reg_or_mem_operand" "=&r,Z,??&r")
2466 (bswap:DI (match_operand:DI 1 "reg_or_mem_operand" "Z,r,r")))
2467 (clobber (match_scratch:DI 2 "=X,X,&r"))
2468 (clobber (match_scratch:DI 3 "=X,X,&r"))
2469 (clobber (match_scratch:DI 4 "=X,X,&r"))]
2470 "TARGET_POWERPC64 && TARGET_LDBRX
2471 && (REG_P (operands[0]) || REG_P (operands[1]))"
2476 [(set_attr "length" "4,4,36")
2477 (set_attr "type" "load,store,*")])
2479 ;; Non-power7/cell, fall back to use lwbrx/stwbrx
2480 (define_insn "*bswapdi2_64bit"
2481 [(set (match_operand:DI 0 "reg_or_mem_operand" "=&r,Z,??&r")
2482 (bswap:DI (match_operand:DI 1 "reg_or_mem_operand" "Z,r,r")))
2483 (clobber (match_scratch:DI 2 "=&b,&b,&r"))
2484 (clobber (match_scratch:DI 3 "=&r,&r,&r"))
2485 (clobber (match_scratch:DI 4 "=&r,X,&r"))]
2486 "TARGET_POWERPC64 && !TARGET_LDBRX
2487 && (REG_P (operands[0]) || REG_P (operands[1]))"
2489 [(set_attr "length" "16,12,36")])
2492 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2493 (bswap:DI (match_operand:DI 1 "indexed_or_indirect_operand" "")))
2494 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
2495 (clobber (match_operand:DI 3 "gpc_reg_operand" ""))
2496 (clobber (match_operand:DI 4 "gpc_reg_operand" ""))]
2497 "TARGET_POWERPC64 && !TARGET_LDBRX && reload_completed"
2501 rtx dest = operands[0];
2502 rtx src = operands[1];
2503 rtx op2 = operands[2];
2504 rtx op3 = operands[3];
2505 rtx op4 = operands[4];
2506 rtx op3_32 = simplify_gen_subreg (SImode, op3, DImode, 4);
2507 rtx op4_32 = simplify_gen_subreg (SImode, op4, DImode, 4);
2513 addr1 = XEXP (src, 0);
2514 if (GET_CODE (addr1) == PLUS)
2516 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2517 addr2 = gen_rtx_PLUS (Pmode, op2, XEXP (addr1, 1));
2521 emit_move_insn (op2, GEN_INT (4));
2522 addr2 = gen_rtx_PLUS (Pmode, op2, addr1);
2525 if (BYTES_BIG_ENDIAN)
2527 word_high = change_address (src, SImode, addr1);
2528 word_low = change_address (src, SImode, addr2);
2532 word_high = change_address (src, SImode, addr2);
2533 word_low = change_address (src, SImode, addr1);
2536 emit_insn (gen_bswapsi2 (op3_32, word_low));
2537 emit_insn (gen_bswapsi2 (op4_32, word_high));
2538 emit_insn (gen_ashldi3 (dest, op3, GEN_INT (32)));
2539 emit_insn (gen_iordi3 (dest, dest, op4));
2543 [(set (match_operand:DI 0 "indexed_or_indirect_operand" "")
2544 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2545 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
2546 (clobber (match_operand:DI 3 "gpc_reg_operand" ""))
2547 (clobber (match_operand:DI 4 "" ""))]
2548 "TARGET_POWERPC64 && !TARGET_LDBRX && reload_completed"
2552 rtx dest = operands[0];
2553 rtx src = operands[1];
2554 rtx op2 = operands[2];
2555 rtx op3 = operands[3];
2556 rtx src_si = simplify_gen_subreg (SImode, src, DImode, 4);
2557 rtx op3_si = simplify_gen_subreg (SImode, op3, DImode, 4);
2563 addr1 = XEXP (dest, 0);
2564 if (GET_CODE (addr1) == PLUS)
2566 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2567 addr2 = gen_rtx_PLUS (Pmode, op2, XEXP (addr1, 1));
2571 emit_move_insn (op2, GEN_INT (4));
2572 addr2 = gen_rtx_PLUS (Pmode, op2, addr1);
2575 emit_insn (gen_lshrdi3 (op3, src, GEN_INT (32)));
2576 if (BYTES_BIG_ENDIAN)
2578 word_high = change_address (dest, SImode, addr1);
2579 word_low = change_address (dest, SImode, addr2);
2580 emit_insn (gen_bswapsi2 (word_high, src_si));
2581 emit_insn (gen_bswapsi2 (word_low, op3_si));
2585 word_high = change_address (dest, SImode, addr2);
2586 word_low = change_address (dest, SImode, addr1);
2587 emit_insn (gen_bswapsi2 (word_low, src_si));
2588 emit_insn (gen_bswapsi2 (word_high, op3_si));
2593 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2594 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2595 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
2596 (clobber (match_operand:DI 3 "gpc_reg_operand" ""))
2597 (clobber (match_operand:DI 4 "" ""))]
2598 "TARGET_POWERPC64 && reload_completed"
2602 rtx dest = operands[0];
2603 rtx src = operands[1];
2604 rtx op2 = operands[2];
2605 rtx op3 = operands[3];
2606 rtx dest_si = simplify_gen_subreg (SImode, dest, DImode, 4);
2607 rtx src_si = simplify_gen_subreg (SImode, src, DImode, 4);
2608 rtx op2_si = simplify_gen_subreg (SImode, op2, DImode, 4);
2609 rtx op3_si = simplify_gen_subreg (SImode, op3, DImode, 4);
2611 emit_insn (gen_lshrdi3 (op2, src, GEN_INT (32)));
2612 emit_insn (gen_bswapsi2 (dest_si, src_si));
2613 emit_insn (gen_bswapsi2 (op3_si, op2_si));
2614 emit_insn (gen_ashldi3 (dest, dest, GEN_INT (32)));
2615 emit_insn (gen_iordi3 (dest, dest, op3));
2618 (define_insn "bswapdi2_32bit"
2619 [(set (match_operand:DI 0 "reg_or_mem_operand" "=&r,Z,??&r")
2620 (bswap:DI (match_operand:DI 1 "reg_or_mem_operand" "Z,r,r")))
2621 (clobber (match_scratch:SI 2 "=&b,&b,X"))]
2622 "!TARGET_POWERPC64 && (REG_P (operands[0]) || REG_P (operands[1]))"
2624 [(set_attr "length" "16,12,36")])
2627 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2628 (bswap:DI (match_operand:DI 1 "indexed_or_indirect_operand" "")))
2629 (clobber (match_operand:SI 2 "gpc_reg_operand" ""))]
2630 "!TARGET_POWERPC64 && reload_completed"
2634 rtx dest = operands[0];
2635 rtx src = operands[1];
2636 rtx op2 = operands[2];
2637 rtx dest_hi = simplify_gen_subreg (SImode, dest, DImode, 0);
2638 rtx dest_lo = simplify_gen_subreg (SImode, dest, DImode, 4);
2644 addr1 = XEXP (src, 0);
2645 if (GET_CODE (addr1) == PLUS)
2647 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2648 addr2 = gen_rtx_PLUS (SImode, op2, XEXP (addr1, 1));
2652 emit_move_insn (op2, GEN_INT (4));
2653 addr2 = gen_rtx_PLUS (SImode, op2, addr1);
2656 if (BYTES_BIG_ENDIAN)
2658 word_high = change_address (src, SImode, addr1);
2659 word_low = change_address (src, SImode, addr2);
2663 word_high = change_address (src, SImode, addr2);
2664 word_low = change_address (src, SImode, addr1);
2667 emit_insn (gen_bswapsi2 (dest_hi, word_low));
2668 emit_insn (gen_bswapsi2 (dest_lo, word_high));
2672 [(set (match_operand:DI 0 "indexed_or_indirect_operand" "")
2673 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2674 (clobber (match_operand:SI 2 "gpc_reg_operand" ""))]
2675 "!TARGET_POWERPC64 && reload_completed"
2679 rtx dest = operands[0];
2680 rtx src = operands[1];
2681 rtx op2 = operands[2];
2682 rtx src_high = simplify_gen_subreg (SImode, src, DImode, 0);
2683 rtx src_low = simplify_gen_subreg (SImode, src, DImode, 4);
2689 addr1 = XEXP (dest, 0);
2690 if (GET_CODE (addr1) == PLUS)
2692 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2693 addr2 = gen_rtx_PLUS (SImode, op2, XEXP (addr1, 1));
2697 emit_move_insn (op2, GEN_INT (4));
2698 addr2 = gen_rtx_PLUS (SImode, op2, addr1);
2701 if (BYTES_BIG_ENDIAN)
2703 word_high = change_address (dest, SImode, addr1);
2704 word_low = change_address (dest, SImode, addr2);
2708 word_high = change_address (dest, SImode, addr2);
2709 word_low = change_address (dest, SImode, addr1);
2712 emit_insn (gen_bswapsi2 (word_high, src_low));
2713 emit_insn (gen_bswapsi2 (word_low, src_high));
2717 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2718 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2719 (clobber (match_operand:SI 2 "" ""))]
2720 "!TARGET_POWERPC64 && reload_completed"
2724 rtx dest = operands[0];
2725 rtx src = operands[1];
2726 rtx src_high = simplify_gen_subreg (SImode, src, DImode, 0);
2727 rtx src_low = simplify_gen_subreg (SImode, src, DImode, 4);
2728 rtx dest_high = simplify_gen_subreg (SImode, dest, DImode, 0);
2729 rtx dest_low = simplify_gen_subreg (SImode, dest, DImode, 4);
2731 emit_insn (gen_bswapsi2 (dest_high, src_low));
2732 emit_insn (gen_bswapsi2 (dest_low, src_high));
2735 (define_expand "mulsi3"
2736 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
2737 (use (match_operand:SI 1 "gpc_reg_operand" ""))
2738 (use (match_operand:SI 2 "reg_or_short_operand" ""))]
2743 emit_insn (gen_mulsi3_mq (operands[0], operands[1], operands[2]));
2745 emit_insn (gen_mulsi3_no_mq (operands[0], operands[1], operands[2]));
2749 (define_insn "mulsi3_mq"
2750 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2751 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2752 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
2753 (clobber (match_scratch:SI 3 "=q,q"))]
2756 {muls|mullw} %0,%1,%2
2757 {muli|mulli} %0,%1,%2"
2759 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
2760 (const_string "imul3")
2761 (match_operand:SI 2 "short_cint_operand" "")
2762 (const_string "imul2")]
2763 (const_string "imul")))])
2765 (define_insn "mulsi3_no_mq"
2766 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2767 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2768 (match_operand:SI 2 "reg_or_short_operand" "r,I")))]
2771 {muls|mullw} %0,%1,%2
2772 {muli|mulli} %0,%1,%2"
2774 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
2775 (const_string "imul3")
2776 (match_operand:SI 2 "short_cint_operand" "")
2777 (const_string "imul2")]
2778 (const_string "imul")))])
2780 (define_insn "*mulsi3_mq_internal1"
2781 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2782 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2783 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2785 (clobber (match_scratch:SI 3 "=r,r"))
2786 (clobber (match_scratch:SI 4 "=q,q"))]
2789 {muls.|mullw.} %3,%1,%2
2791 [(set_attr "type" "imul_compare")
2792 (set_attr "length" "4,8")])
2795 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2796 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2797 (match_operand:SI 2 "gpc_reg_operand" ""))
2799 (clobber (match_scratch:SI 3 ""))
2800 (clobber (match_scratch:SI 4 ""))]
2801 "TARGET_POWER && reload_completed"
2802 [(parallel [(set (match_dup 3)
2803 (mult:SI (match_dup 1) (match_dup 2)))
2804 (clobber (match_dup 4))])
2806 (compare:CC (match_dup 3)
2810 (define_insn "*mulsi3_no_mq_internal1"
2811 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2812 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2813 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2815 (clobber (match_scratch:SI 3 "=r,r"))]
2818 {muls.|mullw.} %3,%1,%2
2820 [(set_attr "type" "imul_compare")
2821 (set_attr "length" "4,8")])
2824 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
2825 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2826 (match_operand:SI 2 "gpc_reg_operand" ""))
2828 (clobber (match_scratch:SI 3 ""))]
2829 "! TARGET_POWER && reload_completed"
2831 (mult:SI (match_dup 1) (match_dup 2)))
2833 (compare:CC (match_dup 3)
2837 (define_insn "*mulsi3_mq_internal2"
2838 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2839 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2840 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2842 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2843 (mult:SI (match_dup 1) (match_dup 2)))
2844 (clobber (match_scratch:SI 4 "=q,q"))]
2847 {muls.|mullw.} %0,%1,%2
2849 [(set_attr "type" "imul_compare")
2850 (set_attr "length" "4,8")])
2853 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2854 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2855 (match_operand:SI 2 "gpc_reg_operand" ""))
2857 (set (match_operand:SI 0 "gpc_reg_operand" "")
2858 (mult:SI (match_dup 1) (match_dup 2)))
2859 (clobber (match_scratch:SI 4 ""))]
2860 "TARGET_POWER && reload_completed"
2861 [(parallel [(set (match_dup 0)
2862 (mult:SI (match_dup 1) (match_dup 2)))
2863 (clobber (match_dup 4))])
2865 (compare:CC (match_dup 0)
2869 (define_insn "*mulsi3_no_mq_internal2"
2870 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2871 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2872 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2874 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2875 (mult:SI (match_dup 1) (match_dup 2)))]
2878 {muls.|mullw.} %0,%1,%2
2880 [(set_attr "type" "imul_compare")
2881 (set_attr "length" "4,8")])
2884 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
2885 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2886 (match_operand:SI 2 "gpc_reg_operand" ""))
2888 (set (match_operand:SI 0 "gpc_reg_operand" "")
2889 (mult:SI (match_dup 1) (match_dup 2)))]
2890 "! TARGET_POWER && reload_completed"
2892 (mult:SI (match_dup 1) (match_dup 2)))
2894 (compare:CC (match_dup 0)
2898 ;; Operand 1 is divided by operand 2; quotient goes to operand
2899 ;; 0 and remainder to operand 3.
2900 ;; ??? At some point, see what, if anything, we can do about if (x % y == 0).
2902 (define_expand "divmodsi4"
2903 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
2904 (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
2905 (match_operand:SI 2 "gpc_reg_operand" "")))
2906 (set (match_operand:SI 3 "register_operand" "")
2907 (mod:SI (match_dup 1) (match_dup 2)))])]
2908 "TARGET_POWER || (! TARGET_POWER && ! TARGET_POWERPC)"
2911 if (! TARGET_POWER && ! TARGET_POWERPC)
2913 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2914 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2915 emit_insn (gen_divss_call ());
2916 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2917 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
2922 (define_insn "*divmodsi4_internal"
2923 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2924 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2925 (match_operand:SI 2 "gpc_reg_operand" "r")))
2926 (set (match_operand:SI 3 "register_operand" "=q")
2927 (mod:SI (match_dup 1) (match_dup 2)))]
2930 [(set_attr "type" "idiv")])
2932 (define_expand "udiv<mode>3"
2933 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2934 (udiv:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2935 (match_operand:GPR 2 "gpc_reg_operand" "")))]
2936 "TARGET_POWERPC || (! TARGET_POWER && ! TARGET_POWERPC)"
2939 if (! TARGET_POWER && ! TARGET_POWERPC)
2941 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2942 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2943 emit_insn (gen_quous_call ());
2944 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2947 else if (TARGET_POWER)
2949 emit_insn (gen_udivsi3_mq (operands[0], operands[1], operands[2]));
2954 (define_insn "udivsi3_mq"
2955 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2956 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2957 (match_operand:SI 2 "gpc_reg_operand" "r")))
2958 (clobber (match_scratch:SI 3 "=q"))]
2959 "TARGET_POWERPC && TARGET_POWER"
2961 [(set_attr "type" "idiv")])
2963 (define_insn "*udivsi3_no_mq"
2964 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2965 (udiv:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2966 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
2967 "TARGET_POWERPC && ! TARGET_POWER"
2970 (cond [(match_operand:SI 0 "" "")
2971 (const_string "idiv")]
2972 (const_string "ldiv")))])
2975 ;; For powers of two we can do srai/aze for divide and then adjust for
2976 ;; modulus. If it isn't a power of two, FAIL on POWER so divmodsi4 will be
2977 ;; used; for PowerPC, force operands into register and do a normal divide;
2978 ;; for AIX common-mode, use quoss call on register operands.
2979 (define_expand "div<mode>3"
2980 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2981 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2982 (match_operand:GPR 2 "reg_or_cint_operand" "")))]
2986 if (GET_CODE (operands[2]) == CONST_INT
2987 && INTVAL (operands[2]) > 0
2988 && exact_log2 (INTVAL (operands[2])) >= 0)
2990 else if (TARGET_POWERPC)
2992 operands[2] = force_reg (<MODE>mode, operands[2]);
2995 emit_insn (gen_divsi3_mq (operands[0], operands[1], operands[2]));
2999 else if (TARGET_POWER)
3003 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
3004 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
3005 emit_insn (gen_quoss_call ());
3006 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
3011 (define_insn "divsi3_mq"
3012 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3013 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3014 (match_operand:SI 2 "gpc_reg_operand" "r")))
3015 (clobber (match_scratch:SI 3 "=q"))]
3016 "TARGET_POWERPC && TARGET_POWER"
3018 [(set_attr "type" "idiv")])
3020 (define_insn "*div<mode>3_no_mq"
3021 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
3022 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
3023 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
3024 "TARGET_POWERPC && ! TARGET_POWER"
3027 (cond [(match_operand:SI 0 "" "")
3028 (const_string "idiv")]
3029 (const_string "ldiv")))])
3031 (define_expand "mod<mode>3"
3032 [(use (match_operand:GPR 0 "gpc_reg_operand" ""))
3033 (use (match_operand:GPR 1 "gpc_reg_operand" ""))
3034 (use (match_operand:GPR 2 "reg_or_cint_operand" ""))]
3042 if (GET_CODE (operands[2]) != CONST_INT
3043 || INTVAL (operands[2]) <= 0
3044 || (i = exact_log2 (INTVAL (operands[2]))) < 0)
3047 temp1 = gen_reg_rtx (<MODE>mode);
3048 temp2 = gen_reg_rtx (<MODE>mode);
3050 emit_insn (gen_div<mode>3 (temp1, operands[1], operands[2]));
3051 emit_insn (gen_ashl<mode>3 (temp2, temp1, GEN_INT (i)));
3052 emit_insn (gen_sub<mode>3 (operands[0], operands[1], temp2));
3057 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
3058 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
3059 (match_operand:GPR 2 "exact_log2_cint_operand" "N")))]
3061 "{srai|sra<wd>i} %0,%1,%p2\;{aze|addze} %0,%0"
3062 [(set_attr "type" "two")
3063 (set_attr "length" "8")])
3066 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3067 (compare:CC (div:P (match_operand:P 1 "gpc_reg_operand" "r,r")
3068 (match_operand:P 2 "exact_log2_cint_operand" "N,N"))
3070 (clobber (match_scratch:P 3 "=r,r"))]
3073 {srai|sra<wd>i} %3,%1,%p2\;{aze.|addze.} %3,%3
3075 [(set_attr "type" "compare")
3076 (set_attr "length" "8,12")
3077 (set_attr "cell_micro" "not")])
3080 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3081 (compare:CC (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
3082 (match_operand:GPR 2 "exact_log2_cint_operand"
3085 (clobber (match_scratch:GPR 3 ""))]
3088 (div:<MODE> (match_dup 1) (match_dup 2)))
3090 (compare:CC (match_dup 3)
3095 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3096 (compare:CC (div:P (match_operand:P 1 "gpc_reg_operand" "r,r")
3097 (match_operand:P 2 "exact_log2_cint_operand" "N,N"))
3099 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
3100 (div:P (match_dup 1) (match_dup 2)))]
3103 {srai|sra<wd>i} %0,%1,%p2\;{aze.|addze.} %0,%0
3105 [(set_attr "type" "compare")
3106 (set_attr "length" "8,12")
3107 (set_attr "cell_micro" "not")])
3110 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3111 (compare:CC (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
3112 (match_operand:GPR 2 "exact_log2_cint_operand"
3115 (set (match_operand:GPR 0 "gpc_reg_operand" "")
3116 (div:GPR (match_dup 1) (match_dup 2)))]
3119 (div:<MODE> (match_dup 1) (match_dup 2)))
3121 (compare:CC (match_dup 0)
3126 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3129 (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
3131 (zero_extend:DI (match_operand:SI 4 "register_operand" "2")))
3132 (match_operand:SI 3 "gpc_reg_operand" "r")))
3133 (set (match_operand:SI 2 "register_operand" "=*q")
3136 (zero_extend:DI (match_dup 1)) (const_int 32))
3137 (zero_extend:DI (match_dup 4)))
3141 [(set_attr "type" "idiv")])
3143 ;; To do unsigned divide we handle the cases of the divisor looking like a
3144 ;; negative number. If it is a constant that is less than 2**31, we don't
3145 ;; have to worry about the branches. So make a few subroutines here.
3147 ;; First comes the normal case.
3148 (define_expand "udivmodsi4_normal"
3149 [(set (match_dup 4) (const_int 0))
3150 (parallel [(set (match_operand:SI 0 "" "")
3151 (udiv:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
3153 (zero_extend:DI (match_operand:SI 1 "" "")))
3154 (match_operand:SI 2 "" "")))
3155 (set (match_operand:SI 3 "" "")
3156 (umod:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
3158 (zero_extend:DI (match_dup 1)))
3162 { operands[4] = gen_reg_rtx (SImode); }")
3164 ;; This handles the branches.
3165 (define_expand "udivmodsi4_tests"
3166 [(set (match_operand:SI 0 "" "") (const_int 0))
3167 (set (match_operand:SI 3 "" "") (match_operand:SI 1 "" ""))
3168 (set (match_dup 5) (compare:CCUNS (match_dup 1) (match_operand:SI 2 "" "")))
3169 (set (pc) (if_then_else (ltu (match_dup 5) (const_int 0))
3170 (label_ref (match_operand:SI 4 "" "")) (pc)))
3171 (set (match_dup 0) (const_int 1))
3172 (set (match_dup 3) (minus:SI (match_dup 1) (match_dup 2)))
3173 (set (match_dup 6) (compare:CC (match_dup 2) (const_int 0)))
3174 (set (pc) (if_then_else (lt (match_dup 6) (const_int 0))
3175 (label_ref (match_dup 4)) (pc)))]
3178 { operands[5] = gen_reg_rtx (CCUNSmode);
3179 operands[6] = gen_reg_rtx (CCmode);
3182 (define_expand "udivmodsi4"
3183 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
3184 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "")
3185 (match_operand:SI 2 "reg_or_cint_operand" "")))
3186 (set (match_operand:SI 3 "gpc_reg_operand" "")
3187 (umod:SI (match_dup 1) (match_dup 2)))])]
3195 if (! TARGET_POWERPC)
3197 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
3198 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
3199 emit_insn (gen_divus_call ());
3200 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
3201 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
3208 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) < 0)
3210 operands[2] = force_reg (SImode, operands[2]);
3211 label = gen_label_rtx ();
3212 emit (gen_udivmodsi4_tests (operands[0], operands[1], operands[2],
3213 operands[3], label));
3216 operands[2] = force_reg (SImode, operands[2]);
3218 emit (gen_udivmodsi4_normal (operands[0], operands[1], operands[2],
3226 ;; AIX architecture-independent common-mode multiply (DImode),
3227 ;; divide/modulus, and quotient subroutine calls. Input operands in R3 and
3228 ;; R4; results in R3 and sometimes R4; link register always clobbered by bla
3229 ;; instruction; R0 sometimes clobbered; also, MQ sometimes clobbered but
3230 ;; assumed unused if generating common-mode, so ignore.
3231 (define_insn "mulh_call"
3234 (lshiftrt:DI (mult:DI (sign_extend:DI (reg:SI 3))
3235 (sign_extend:DI (reg:SI 4)))
3237 (clobber (reg:SI LR_REGNO))]
3238 "! TARGET_POWER && ! TARGET_POWERPC"
3240 [(set_attr "type" "imul")])
3242 (define_insn "mull_call"
3244 (mult:DI (sign_extend:DI (reg:SI 3))
3245 (sign_extend:DI (reg:SI 4))))
3246 (clobber (reg:SI LR_REGNO))
3247 (clobber (reg:SI 0))]
3248 "! TARGET_POWER && ! TARGET_POWERPC"
3250 [(set_attr "type" "imul")])
3252 (define_insn "divss_call"
3254 (div:SI (reg:SI 3) (reg:SI 4)))
3256 (mod:SI (reg:SI 3) (reg:SI 4)))
3257 (clobber (reg:SI LR_REGNO))
3258 (clobber (reg:SI 0))]
3259 "! TARGET_POWER && ! TARGET_POWERPC"
3261 [(set_attr "type" "idiv")])
3263 (define_insn "divus_call"
3265 (udiv:SI (reg:SI 3) (reg:SI 4)))
3267 (umod:SI (reg:SI 3) (reg:SI 4)))
3268 (clobber (reg:SI LR_REGNO))
3269 (clobber (reg:SI 0))
3270 (clobber (match_scratch:CC 0 "=x"))
3271 (clobber (reg:CC CR1_REGNO))]
3272 "! TARGET_POWER && ! TARGET_POWERPC"
3274 [(set_attr "type" "idiv")])
3276 (define_insn "quoss_call"
3278 (div:SI (reg:SI 3) (reg:SI 4)))
3279 (clobber (reg:SI LR_REGNO))]
3280 "! TARGET_POWER && ! TARGET_POWERPC"
3282 [(set_attr "type" "idiv")])
3284 (define_insn "quous_call"
3286 (udiv:SI (reg:SI 3) (reg:SI 4)))
3287 (clobber (reg:SI LR_REGNO))
3288 (clobber (reg:SI 0))
3289 (clobber (match_scratch:CC 0 "=x"))
3290 (clobber (reg:CC CR1_REGNO))]
3291 "! TARGET_POWER && ! TARGET_POWERPC"
3293 [(set_attr "type" "idiv")])
3295 ;; Logical instructions
3296 ;; The logical instructions are mostly combined by using match_operator,
3297 ;; but the plain AND insns are somewhat different because there is no
3298 ;; plain 'andi' (only 'andi.'), no plain 'andis', and there are all
3299 ;; those rotate-and-mask operations. Thus, the AND insns come first.
3301 (define_expand "andsi3"
3303 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3304 (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
3305 (match_operand:SI 2 "and_operand" "")))
3306 (clobber (match_scratch:CC 3 ""))])]
3310 (define_insn "andsi3_mc"
3311 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
3312 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
3313 (match_operand:SI 2 "and_operand" "?r,T,K,L")))
3314 (clobber (match_scratch:CC 3 "=X,X,x,x"))]
3315 "rs6000_gen_cell_microcode"
3318 {rlinm|rlwinm} %0,%1,0,%m2,%M2
3319 {andil.|andi.} %0,%1,%b2
3320 {andiu.|andis.} %0,%1,%u2"
3321 [(set_attr "type" "*,*,fast_compare,fast_compare")])
3323 (define_insn "andsi3_nomc"
3324 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3325 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
3326 (match_operand:SI 2 "and_operand" "?r,T")))
3327 (clobber (match_scratch:CC 3 "=X,X"))]
3328 "!rs6000_gen_cell_microcode"
3331 {rlinm|rlwinm} %0,%1,0,%m2,%M2")
3333 (define_insn "andsi3_internal0_nomc"
3334 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3335 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
3336 (match_operand:SI 2 "and_operand" "?r,T")))]
3337 "!rs6000_gen_cell_microcode"
3340 {rlinm|rlwinm} %0,%1,0,%m2,%M2")
3343 ;; Note to set cr's other than cr0 we do the and immediate and then
3344 ;; the test again -- this avoids a mfcr which on the higher end
3345 ;; machines causes an execution serialization
3347 (define_insn "*andsi3_internal2_mc"
3348 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
3349 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
3350 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
3352 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
3353 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
3354 "TARGET_32BIT && rs6000_gen_cell_microcode"
3357 {andil.|andi.} %3,%1,%b2
3358 {andiu.|andis.} %3,%1,%u2
3359 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
3364 [(set_attr "type" "fast_compare,fast_compare,fast_compare,delayed_compare,\
3365 compare,compare,compare,compare")
3366 (set_attr "length" "4,4,4,4,8,8,8,8")])
3368 (define_insn "*andsi3_internal3_mc"
3369 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
3370 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
3371 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
3373 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
3374 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
3375 "TARGET_64BIT && rs6000_gen_cell_microcode"
3378 {andil.|andi.} %3,%1,%b2
3379 {andiu.|andis.} %3,%1,%u2
3380 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
3385 [(set_attr "type" "compare,fast_compare,fast_compare,delayed_compare,compare,\
3386 compare,compare,compare")
3387 (set_attr "length" "8,4,4,4,8,8,8,8")])
3390 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3391 (compare:CC (and:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
3392 (match_operand:GPR 2 "and_operand" ""))
3394 (clobber (match_scratch:GPR 3 ""))
3395 (clobber (match_scratch:CC 4 ""))]
3397 [(parallel [(set (match_dup 3)
3398 (and:<MODE> (match_dup 1)
3400 (clobber (match_dup 4))])
3402 (compare:CC (match_dup 3)
3406 ;; We don't have a 32 bit "and. rt,ra,rb" for ppc64. cr is set from the
3407 ;; whole 64 bit reg, and we don't know what is in the high 32 bits.
3410 [(set (match_operand:CC 0 "cc_reg_operand" "")
3411 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
3412 (match_operand:SI 2 "gpc_reg_operand" ""))
3414 (clobber (match_scratch:SI 3 ""))
3415 (clobber (match_scratch:CC 4 ""))]
3416 "TARGET_POWERPC64 && reload_completed"
3417 [(parallel [(set (match_dup 3)
3418 (and:SI (match_dup 1)
3420 (clobber (match_dup 4))])
3422 (compare:CC (match_dup 3)
3426 (define_insn "*andsi3_internal4"
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_32BIT && 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" "fast_compare,fast_compare,fast_compare,delayed_compare,\
3446 compare,compare,compare,compare")
3447 (set_attr "length" "4,4,4,4,8,8,8,8")])
3449 (define_insn "*andsi3_internal5_mc"
3450 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
3451 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
3452 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
3454 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
3455 (and:SI (match_dup 1)
3457 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
3458 "TARGET_64BIT && rs6000_gen_cell_microcode"
3461 {andil.|andi.} %0,%1,%b2
3462 {andiu.|andis.} %0,%1,%u2
3463 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
3468 [(set_attr "type" "compare,fast_compare,fast_compare,delayed_compare,compare,\
3469 compare,compare,compare")
3470 (set_attr "length" "8,4,4,4,8,8,8,8")])
3473 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3474 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
3475 (match_operand:SI 2 "and_operand" ""))
3477 (set (match_operand:SI 0 "gpc_reg_operand" "")
3478 (and:SI (match_dup 1)
3480 (clobber (match_scratch:CC 4 ""))]
3482 [(parallel [(set (match_dup 0)
3483 (and:SI (match_dup 1)
3485 (clobber (match_dup 4))])
3487 (compare:CC (match_dup 0)
3492 [(set (match_operand:CC 3 "cc_reg_operand" "")
3493 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
3494 (match_operand:SI 2 "gpc_reg_operand" ""))
3496 (set (match_operand:SI 0 "gpc_reg_operand" "")
3497 (and:SI (match_dup 1)
3499 (clobber (match_scratch:CC 4 ""))]
3500 "TARGET_POWERPC64 && reload_completed"
3501 [(parallel [(set (match_dup 0)
3502 (and:SI (match_dup 1)
3504 (clobber (match_dup 4))])
3506 (compare:CC (match_dup 0)
3510 ;; Handle the PowerPC64 rlwinm corner case
3512 (define_insn_and_split "*andsi3_internal6"
3513 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3514 (and:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3515 (match_operand:SI 2 "mask_operand_wrap" "i")))]
3520 (and:SI (rotate:SI (match_dup 1) (match_dup 3))
3523 (rotate:SI (match_dup 0) (match_dup 5)))]
3526 int mb = extract_MB (operands[2]);
3527 int me = extract_ME (operands[2]);
3528 operands[3] = GEN_INT (me + 1);
3529 operands[5] = GEN_INT (32 - (me + 1));
3530 operands[4] = GEN_INT (~((HOST_WIDE_INT) -1 << (33 + me - mb)));
3532 [(set_attr "length" "8")])
3534 (define_expand "iorsi3"
3535 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3536 (ior:SI (match_operand:SI 1 "gpc_reg_operand" "")
3537 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
3541 if (GET_CODE (operands[2]) == CONST_INT
3542 && ! logical_operand (operands[2], SImode))
3544 HOST_WIDE_INT value = INTVAL (operands[2]);
3545 rtx tmp = ((!can_create_pseudo_p ()
3546 || rtx_equal_p (operands[0], operands[1]))
3547 ? operands[0] : gen_reg_rtx (SImode));
3549 emit_insn (gen_iorsi3 (tmp, operands[1],
3550 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
3551 emit_insn (gen_iorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
3556 (define_expand "xorsi3"
3557 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3558 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
3559 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
3563 if (GET_CODE (operands[2]) == CONST_INT
3564 && ! logical_operand (operands[2], SImode))
3566 HOST_WIDE_INT value = INTVAL (operands[2]);
3567 rtx tmp = ((!can_create_pseudo_p ()
3568 || rtx_equal_p (operands[0], operands[1]))
3569 ? operands[0] : gen_reg_rtx (SImode));
3571 emit_insn (gen_xorsi3 (tmp, operands[1],
3572 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
3573 emit_insn (gen_xorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
3578 (define_insn "*boolsi3_internal1"
3579 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
3580 (match_operator:SI 3 "boolean_or_operator"
3581 [(match_operand:SI 1 "gpc_reg_operand" "%r,r,r")
3582 (match_operand:SI 2 "logical_operand" "r,K,L")]))]
3586 {%q3il|%q3i} %0,%1,%b2
3587 {%q3iu|%q3is} %0,%1,%u2")
3589 (define_insn "*boolsi3_internal2"
3590 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3591 (compare:CC (match_operator:SI 4 "boolean_or_operator"
3592 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
3593 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3595 (clobber (match_scratch:SI 3 "=r,r"))]
3600 [(set_attr "type" "fast_compare,compare")
3601 (set_attr "length" "4,8")])
3604 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3605 (compare:CC (match_operator:SI 4 "boolean_operator"
3606 [(match_operand:SI 1 "gpc_reg_operand" "")
3607 (match_operand:SI 2 "gpc_reg_operand" "")])
3609 (clobber (match_scratch:SI 3 ""))]
3610 "TARGET_32BIT && reload_completed"
3611 [(set (match_dup 3) (match_dup 4))
3613 (compare:CC (match_dup 3)
3617 (define_insn "*boolsi3_internal3"
3618 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3619 (compare:CC (match_operator:SI 4 "boolean_operator"
3620 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
3621 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3623 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3629 [(set_attr "type" "fast_compare,compare")
3630 (set_attr "length" "4,8")])
3633 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3634 (compare:CC (match_operator:SI 4 "boolean_operator"
3635 [(match_operand:SI 1 "gpc_reg_operand" "")
3636 (match_operand:SI 2 "gpc_reg_operand" "")])
3638 (set (match_operand:SI 0 "gpc_reg_operand" "")
3640 "TARGET_32BIT && reload_completed"
3641 [(set (match_dup 0) (match_dup 4))
3643 (compare:CC (match_dup 0)
3647 ;; Split a logical operation that we can't do in one insn into two insns,
3648 ;; each of which does one 16-bit part. This is used by combine.
3651 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3652 (match_operator:SI 3 "boolean_or_operator"
3653 [(match_operand:SI 1 "gpc_reg_operand" "")
3654 (match_operand:SI 2 "non_logical_cint_operand" "")]))]
3656 [(set (match_dup 0) (match_dup 4))
3657 (set (match_dup 0) (match_dup 5))]
3661 i = GEN_INT (INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff));
3662 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
3664 i = GEN_INT (INTVAL (operands[2]) & 0xffff);
3665 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
3669 (define_insn "*boolcsi3_internal1"
3670 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3671 (match_operator:SI 3 "boolean_operator"
3672 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
3673 (match_operand:SI 2 "gpc_reg_operand" "r")]))]
3677 (define_insn "*boolcsi3_internal2"
3678 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3679 (compare:CC (match_operator:SI 4 "boolean_operator"
3680 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
3681 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3683 (clobber (match_scratch:SI 3 "=r,r"))]
3688 [(set_attr "type" "compare")
3689 (set_attr "length" "4,8")])
3692 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3693 (compare:CC (match_operator:SI 4 "boolean_operator"
3694 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3695 (match_operand:SI 2 "gpc_reg_operand" "")])
3697 (clobber (match_scratch:SI 3 ""))]
3698 "TARGET_32BIT && reload_completed"
3699 [(set (match_dup 3) (match_dup 4))
3701 (compare:CC (match_dup 3)
3705 (define_insn "*boolcsi3_internal3"
3706 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3707 (compare:CC (match_operator:SI 4 "boolean_operator"
3708 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
3709 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3711 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3717 [(set_attr "type" "compare")
3718 (set_attr "length" "4,8")])
3721 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3722 (compare:CC (match_operator:SI 4 "boolean_operator"
3723 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3724 (match_operand:SI 2 "gpc_reg_operand" "")])
3726 (set (match_operand:SI 0 "gpc_reg_operand" "")
3728 "TARGET_32BIT && reload_completed"
3729 [(set (match_dup 0) (match_dup 4))
3731 (compare:CC (match_dup 0)
3735 (define_insn "*boolccsi3_internal1"
3736 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3737 (match_operator:SI 3 "boolean_operator"
3738 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
3739 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))]))]
3743 (define_insn "*boolccsi3_internal2"
3744 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3745 (compare:CC (match_operator:SI 4 "boolean_operator"
3746 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
3747 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
3749 (clobber (match_scratch:SI 3 "=r,r"))]
3754 [(set_attr "type" "fast_compare,compare")
3755 (set_attr "length" "4,8")])
3758 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3759 (compare:CC (match_operator:SI 4 "boolean_operator"
3760 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3761 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
3763 (clobber (match_scratch:SI 3 ""))]
3764 "TARGET_32BIT && reload_completed"
3765 [(set (match_dup 3) (match_dup 4))
3767 (compare:CC (match_dup 3)
3771 (define_insn "*boolccsi3_internal3"
3772 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3773 (compare:CC (match_operator:SI 4 "boolean_operator"
3774 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
3775 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
3777 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3783 [(set_attr "type" "fast_compare,compare")
3784 (set_attr "length" "4,8")])
3787 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3788 (compare:CC (match_operator:SI 4 "boolean_operator"
3789 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3790 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
3792 (set (match_operand:SI 0 "gpc_reg_operand" "")
3794 "TARGET_32BIT && reload_completed"
3795 [(set (match_dup 0) (match_dup 4))
3797 (compare:CC (match_dup 0)
3801 ;; maskir insn. We need four forms because things might be in arbitrary
3802 ;; orders. Don't define forms that only set CR fields because these
3803 ;; would modify an input register.
3805 (define_insn "*maskir_internal1"
3806 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3807 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
3808 (match_operand:SI 1 "gpc_reg_operand" "0"))
3809 (and:SI (match_dup 2)
3810 (match_operand:SI 3 "gpc_reg_operand" "r"))))]
3814 (define_insn "*maskir_internal2"
3815 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3816 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
3817 (match_operand:SI 1 "gpc_reg_operand" "0"))
3818 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3823 (define_insn "*maskir_internal3"
3824 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3825 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r")
3826 (match_operand:SI 3 "gpc_reg_operand" "r"))
3827 (and:SI (not:SI (match_dup 2))
3828 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
3832 (define_insn "*maskir_internal4"
3833 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3834 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3835 (match_operand:SI 2 "gpc_reg_operand" "r"))
3836 (and:SI (not:SI (match_dup 2))
3837 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
3841 (define_insn "*maskir_internal5"
3842 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3844 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3845 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
3846 (and:SI (match_dup 2)
3847 (match_operand:SI 3 "gpc_reg_operand" "r,r")))
3849 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3850 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3851 (and:SI (match_dup 2) (match_dup 3))))]
3856 [(set_attr "type" "compare")
3857 (set_attr "length" "4,8")])
3860 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3862 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
3863 (match_operand:SI 1 "gpc_reg_operand" ""))
3864 (and:SI (match_dup 2)
3865 (match_operand:SI 3 "gpc_reg_operand" "")))
3867 (set (match_operand:SI 0 "gpc_reg_operand" "")
3868 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3869 (and:SI (match_dup 2) (match_dup 3))))]
3870 "TARGET_POWER && reload_completed"
3872 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3873 (and:SI (match_dup 2) (match_dup 3))))
3875 (compare:CC (match_dup 0)
3879 (define_insn "*maskir_internal6"
3880 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3882 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3883 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
3884 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
3887 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3888 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3889 (and:SI (match_dup 3) (match_dup 2))))]
3894 [(set_attr "type" "compare")
3895 (set_attr "length" "4,8")])
3898 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3900 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
3901 (match_operand:SI 1 "gpc_reg_operand" ""))
3902 (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
3905 (set (match_operand:SI 0 "gpc_reg_operand" "")
3906 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3907 (and:SI (match_dup 3) (match_dup 2))))]
3908 "TARGET_POWER && reload_completed"
3910 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3911 (and:SI (match_dup 3) (match_dup 2))))
3913 (compare:CC (match_dup 0)
3917 (define_insn "*maskir_internal7"
3918 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3920 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r,r")
3921 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
3922 (and:SI (not:SI (match_dup 2))
3923 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
3925 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3926 (ior:SI (and:SI (match_dup 2) (match_dup 3))
3927 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3932 [(set_attr "type" "compare")
3933 (set_attr "length" "4,8")])
3936 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3938 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "")
3939 (match_operand:SI 3 "gpc_reg_operand" ""))
3940 (and:SI (not:SI (match_dup 2))
3941 (match_operand:SI 1 "gpc_reg_operand" "")))
3943 (set (match_operand:SI 0 "gpc_reg_operand" "")
3944 (ior:SI (and:SI (match_dup 2) (match_dup 3))
3945 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3946 "TARGET_POWER && reload_completed"
3948 (ior:SI (and:SI (match_dup 2) (match_dup 3))
3949 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
3951 (compare:CC (match_dup 0)
3955 (define_insn "*maskir_internal8"
3956 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3958 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
3959 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3960 (and:SI (not:SI (match_dup 2))
3961 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
3963 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3964 (ior:SI (and:SI (match_dup 3) (match_dup 2))
3965 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3970 [(set_attr "type" "compare")
3971 (set_attr "length" "4,8")])
3974 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3976 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
3977 (match_operand:SI 2 "gpc_reg_operand" ""))
3978 (and:SI (not:SI (match_dup 2))
3979 (match_operand:SI 1 "gpc_reg_operand" "")))
3981 (set (match_operand:SI 0 "gpc_reg_operand" "")
3982 (ior:SI (and:SI (match_dup 3) (match_dup 2))
3983 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3984 "TARGET_POWER && reload_completed"
3986 (ior:SI (and:SI (match_dup 3) (match_dup 2))
3987 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
3989 (compare:CC (match_dup 0)
3993 ;; Rotate and shift insns, in all their variants. These support shifts,
3994 ;; field inserts and extracts, and various combinations thereof.
3995 (define_expand "insv"
3996 [(set (zero_extract (match_operand 0 "gpc_reg_operand" "")
3997 (match_operand:SI 1 "const_int_operand" "")
3998 (match_operand:SI 2 "const_int_operand" ""))
3999 (match_operand 3 "gpc_reg_operand" ""))]
4003 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
4004 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
4005 compiler if the address of the structure is taken later. Likewise, do
4006 not handle invalid E500 subregs. */
4007 if (GET_CODE (operands[0]) == SUBREG
4008 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD
4009 || ((TARGET_E500_DOUBLE || TARGET_SPE)
4010 && invalid_e500_subreg (operands[0], GET_MODE (operands[0])))))
4013 if (TARGET_POWERPC64 && GET_MODE (operands[0]) == DImode)
4014 emit_insn (gen_insvdi (operands[0], operands[1], operands[2], operands[3]));
4016 emit_insn (gen_insvsi (operands[0], operands[1], operands[2], operands[3]));
4020 (define_insn "insvsi"
4021 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4022 (match_operand:SI 1 "const_int_operand" "i")
4023 (match_operand:SI 2 "const_int_operand" "i"))
4024 (match_operand:SI 3 "gpc_reg_operand" "r"))]
4028 int start = INTVAL (operands[2]) & 31;
4029 int size = INTVAL (operands[1]) & 31;
4031 operands[4] = GEN_INT (32 - start - size);
4032 operands[1] = GEN_INT (start + size - 1);
4033 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
4035 [(set_attr "type" "insert_word")])
4037 (define_insn "*insvsi_internal1"
4038 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4039 (match_operand:SI 1 "const_int_operand" "i")
4040 (match_operand:SI 2 "const_int_operand" "i"))
4041 (rotate:SI (match_operand:SI 3 "gpc_reg_operand" "r")
4042 (match_operand:SI 4 "const_int_operand" "i")))]
4043 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
4046 int shift = INTVAL (operands[4]) & 31;
4047 int start = INTVAL (operands[2]) & 31;
4048 int size = INTVAL (operands[1]) & 31;
4050 operands[4] = GEN_INT (shift - start - size);
4051 operands[1] = GEN_INT (start + size - 1);
4052 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
4054 [(set_attr "type" "insert_word")])
4056 (define_insn "*insvsi_internal2"
4057 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4058 (match_operand:SI 1 "const_int_operand" "i")
4059 (match_operand:SI 2 "const_int_operand" "i"))
4060 (ashiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
4061 (match_operand:SI 4 "const_int_operand" "i")))]
4062 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
4065 int shift = INTVAL (operands[4]) & 31;
4066 int start = INTVAL (operands[2]) & 31;
4067 int size = INTVAL (operands[1]) & 31;
4069 operands[4] = GEN_INT (32 - shift - start - size);
4070 operands[1] = GEN_INT (start + size - 1);
4071 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
4073 [(set_attr "type" "insert_word")])
4075 (define_insn "*insvsi_internal3"
4076 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4077 (match_operand:SI 1 "const_int_operand" "i")
4078 (match_operand:SI 2 "const_int_operand" "i"))
4079 (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
4080 (match_operand:SI 4 "const_int_operand" "i")))]
4081 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
4084 int shift = INTVAL (operands[4]) & 31;
4085 int start = INTVAL (operands[2]) & 31;
4086 int size = INTVAL (operands[1]) & 31;
4088 operands[4] = GEN_INT (32 - shift - start - size);
4089 operands[1] = GEN_INT (start + size - 1);
4090 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
4092 [(set_attr "type" "insert_word")])
4094 (define_insn "*insvsi_internal4"
4095 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4096 (match_operand:SI 1 "const_int_operand" "i")
4097 (match_operand:SI 2 "const_int_operand" "i"))
4098 (zero_extract:SI (match_operand:SI 3 "gpc_reg_operand" "r")
4099 (match_operand:SI 4 "const_int_operand" "i")
4100 (match_operand:SI 5 "const_int_operand" "i")))]
4101 "INTVAL (operands[4]) >= INTVAL (operands[1])"
4104 int extract_start = INTVAL (operands[5]) & 31;
4105 int extract_size = INTVAL (operands[4]) & 31;
4106 int insert_start = INTVAL (operands[2]) & 31;
4107 int insert_size = INTVAL (operands[1]) & 31;
4109 /* Align extract field with insert field */
4110 operands[5] = GEN_INT (extract_start + extract_size - insert_start - insert_size);
4111 operands[1] = GEN_INT (insert_start + insert_size - 1);
4112 return \"{rlimi|rlwimi} %0,%3,%h5,%h2,%h1\";
4114 [(set_attr "type" "insert_word")])
4116 ;; combine patterns for rlwimi
4117 (define_insn "*insvsi_internal5"
4118 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4119 (ior:SI (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
4120 (match_operand:SI 1 "mask_operand" "i"))
4121 (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
4122 (match_operand:SI 2 "const_int_operand" "i"))
4123 (match_operand:SI 5 "mask_operand" "i"))))]
4124 "TARGET_POWERPC && INTVAL(operands[1]) == ~INTVAL(operands[5])"
4127 int me = extract_ME(operands[5]);
4128 int mb = extract_MB(operands[5]);
4129 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
4130 operands[2] = GEN_INT(mb);
4131 operands[1] = GEN_INT(me);
4132 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
4134 [(set_attr "type" "insert_word")])
4136 (define_insn "*insvsi_internal6"
4137 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4138 (ior:SI (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
4139 (match_operand:SI 2 "const_int_operand" "i"))
4140 (match_operand:SI 5 "mask_operand" "i"))
4141 (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
4142 (match_operand:SI 1 "mask_operand" "i"))))]
4143 "TARGET_POWERPC && INTVAL(operands[1]) == ~INTVAL(operands[5])"
4146 int me = extract_ME(operands[5]);
4147 int mb = extract_MB(operands[5]);
4148 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
4149 operands[2] = GEN_INT(mb);
4150 operands[1] = GEN_INT(me);
4151 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
4153 [(set_attr "type" "insert_word")])
4155 (define_insn "insvdi"
4156 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
4157 (match_operand:SI 1 "const_int_operand" "i")
4158 (match_operand:SI 2 "const_int_operand" "i"))
4159 (match_operand:DI 3 "gpc_reg_operand" "r"))]
4163 int start = INTVAL (operands[2]) & 63;
4164 int size = INTVAL (operands[1]) & 63;
4166 operands[1] = GEN_INT (64 - start - size);
4167 return \"rldimi %0,%3,%H1,%H2\";
4169 [(set_attr "type" "insert_dword")])
4171 (define_insn "*insvdi_internal2"
4172 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
4173 (match_operand:SI 1 "const_int_operand" "i")
4174 (match_operand:SI 2 "const_int_operand" "i"))
4175 (ashiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
4176 (match_operand:SI 4 "const_int_operand" "i")))]
4178 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
4181 int shift = INTVAL (operands[4]) & 63;
4182 int start = (INTVAL (operands[2]) & 63) - 32;
4183 int size = INTVAL (operands[1]) & 63;
4185 operands[4] = GEN_INT (64 - shift - start - size);
4186 operands[2] = GEN_INT (start);
4187 operands[1] = GEN_INT (start + size - 1);
4188 return \"rlwimi %0,%3,%h4,%h2,%h1\";
4191 (define_insn "*insvdi_internal3"
4192 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
4193 (match_operand:SI 1 "const_int_operand" "i")
4194 (match_operand:SI 2 "const_int_operand" "i"))
4195 (lshiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
4196 (match_operand:SI 4 "const_int_operand" "i")))]
4198 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
4201 int shift = INTVAL (operands[4]) & 63;
4202 int start = (INTVAL (operands[2]) & 63) - 32;
4203 int size = INTVAL (operands[1]) & 63;
4205 operands[4] = GEN_INT (64 - shift - start - size);
4206 operands[2] = GEN_INT (start);
4207 operands[1] = GEN_INT (start + size - 1);
4208 return \"rlwimi %0,%3,%h4,%h2,%h1\";
4211 (define_expand "extzv"
4212 [(set (match_operand 0 "gpc_reg_operand" "")
4213 (zero_extract (match_operand 1 "gpc_reg_operand" "")
4214 (match_operand:SI 2 "const_int_operand" "")
4215 (match_operand:SI 3 "const_int_operand" "")))]
4219 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
4220 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
4221 compiler if the address of the structure is taken later. */
4222 if (GET_CODE (operands[0]) == SUBREG
4223 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
4226 if (TARGET_POWERPC64 && GET_MODE (operands[1]) == DImode)
4227 emit_insn (gen_extzvdi (operands[0], operands[1], operands[2], operands[3]));
4229 emit_insn (gen_extzvsi (operands[0], operands[1], operands[2], operands[3]));
4233 (define_insn "extzvsi"
4234 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4235 (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4236 (match_operand:SI 2 "const_int_operand" "i")
4237 (match_operand:SI 3 "const_int_operand" "i")))]
4241 int start = INTVAL (operands[3]) & 31;
4242 int size = INTVAL (operands[2]) & 31;
4244 if (start + size >= 32)
4245 operands[3] = const0_rtx;
4247 operands[3] = GEN_INT (start + size);
4248 return \"{rlinm|rlwinm} %0,%1,%3,%s2,31\";
4251 (define_insn "*extzvsi_internal1"
4252 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4253 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4254 (match_operand:SI 2 "const_int_operand" "i,i")
4255 (match_operand:SI 3 "const_int_operand" "i,i"))
4257 (clobber (match_scratch:SI 4 "=r,r"))]
4261 int start = INTVAL (operands[3]) & 31;
4262 int size = INTVAL (operands[2]) & 31;
4264 /* Force split for non-cc0 compare. */
4265 if (which_alternative == 1)
4268 /* If the bit-field being tested fits in the upper or lower half of a
4269 word, it is possible to use andiu. or andil. to test it. This is
4270 useful because the condition register set-use delay is smaller for
4271 andi[ul]. than for rlinm. This doesn't work when the starting bit
4272 position is 0 because the LT and GT bits may be set wrong. */
4274 if ((start > 0 && start + size <= 16) || start >= 16)
4276 operands[3] = GEN_INT (((1 << (16 - (start & 15)))
4277 - (1 << (16 - (start & 15) - size))));
4279 return \"{andiu.|andis.} %4,%1,%3\";
4281 return \"{andil.|andi.} %4,%1,%3\";
4284 if (start + size >= 32)
4285 operands[3] = const0_rtx;
4287 operands[3] = GEN_INT (start + size);
4288 return \"{rlinm.|rlwinm.} %4,%1,%3,%s2,31\";
4290 [(set_attr "type" "delayed_compare")
4291 (set_attr "length" "4,8")])
4294 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4295 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
4296 (match_operand:SI 2 "const_int_operand" "")
4297 (match_operand:SI 3 "const_int_operand" ""))
4299 (clobber (match_scratch:SI 4 ""))]
4302 (zero_extract:SI (match_dup 1) (match_dup 2)
4305 (compare:CC (match_dup 4)
4309 (define_insn "*extzvsi_internal2"
4310 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4311 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4312 (match_operand:SI 2 "const_int_operand" "i,i")
4313 (match_operand:SI 3 "const_int_operand" "i,i"))
4315 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4316 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
4320 int start = INTVAL (operands[3]) & 31;
4321 int size = INTVAL (operands[2]) & 31;
4323 /* Force split for non-cc0 compare. */
4324 if (which_alternative == 1)
4327 /* Since we are using the output value, we can't ignore any need for
4328 a shift. The bit-field must end at the LSB. */
4329 if (start >= 16 && start + size == 32)
4331 operands[3] = GEN_INT ((1 << size) - 1);
4332 return \"{andil.|andi.} %0,%1,%3\";
4335 if (start + size >= 32)
4336 operands[3] = const0_rtx;
4338 operands[3] = GEN_INT (start + size);
4339 return \"{rlinm.|rlwinm.} %0,%1,%3,%s2,31\";
4341 [(set_attr "type" "delayed_compare")
4342 (set_attr "length" "4,8")])
4345 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
4346 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
4347 (match_operand:SI 2 "const_int_operand" "")
4348 (match_operand:SI 3 "const_int_operand" ""))
4350 (set (match_operand:SI 0 "gpc_reg_operand" "")
4351 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
4354 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))
4356 (compare:CC (match_dup 0)
4360 (define_insn "extzvdi"
4361 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4362 (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4363 (match_operand:SI 2 "const_int_operand" "i")
4364 (match_operand:SI 3 "const_int_operand" "i")))]
4368 int start = INTVAL (operands[3]) & 63;
4369 int size = INTVAL (operands[2]) & 63;
4371 if (start + size >= 64)
4372 operands[3] = const0_rtx;
4374 operands[3] = GEN_INT (start + size);
4375 operands[2] = GEN_INT (64 - size);
4376 return \"rldicl %0,%1,%3,%2\";
4379 (define_insn "*extzvdi_internal1"
4380 [(set (match_operand:CC 0 "gpc_reg_operand" "=x")
4381 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4382 (match_operand:SI 2 "const_int_operand" "i")
4383 (match_operand:SI 3 "const_int_operand" "i"))
4385 (clobber (match_scratch:DI 4 "=r"))]
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. %4,%1,%3,%2\";
4399 [(set_attr "type" "compare")])
4401 (define_insn "*extzvdi_internal2"
4402 [(set (match_operand:CC 4 "gpc_reg_operand" "=x")
4403 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4404 (match_operand:SI 2 "const_int_operand" "i")
4405 (match_operand:SI 3 "const_int_operand" "i"))
4407 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
4408 (zero_extract:DI (match_dup 1) (match_dup 2) (match_dup 3)))]
4409 "TARGET_64BIT && rs6000_gen_cell_microcode"
4412 int start = INTVAL (operands[3]) & 63;
4413 int size = INTVAL (operands[2]) & 63;
4415 if (start + size >= 64)
4416 operands[3] = const0_rtx;
4418 operands[3] = GEN_INT (start + size);
4419 operands[2] = GEN_INT (64 - size);
4420 return \"rldicl. %0,%1,%3,%2\";
4422 [(set_attr "type" "compare")])
4424 (define_insn "rotlsi3"
4425 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4426 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4427 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
4430 {rlnm|rlwnm} %0,%1,%2,0xffffffff
4431 {rlinm|rlwinm} %0,%1,%h2,0xffffffff"
4432 [(set_attr "type" "var_shift_rotate,integer")])
4434 (define_insn "*rotlsi3_64"
4435 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
4437 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4438 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))))]
4441 {rlnm|rlwnm} %0,%1,%2,0xffffffff
4442 {rlinm|rlwinm} %0,%1,%h2,0xffffffff"
4443 [(set_attr "type" "var_shift_rotate,integer")])
4445 (define_insn "*rotlsi3_internal2"
4446 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4447 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4448 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4450 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4453 {rlnm.|rlwnm.} %3,%1,%2,0xffffffff
4454 {rlinm.|rlwinm.} %3,%1,%h2,0xffffffff
4457 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4458 (set_attr "length" "4,4,8,8")])
4461 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4462 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4463 (match_operand:SI 2 "reg_or_cint_operand" ""))
4465 (clobber (match_scratch:SI 3 ""))]
4468 (rotate:SI (match_dup 1) (match_dup 2)))
4470 (compare:CC (match_dup 3)
4474 (define_insn "*rotlsi3_internal3"
4475 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4476 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4477 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4479 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4480 (rotate:SI (match_dup 1) (match_dup 2)))]
4483 {rlnm.|rlwnm.} %0,%1,%2,0xffffffff
4484 {rlinm.|rlwinm.} %0,%1,%h2,0xffffffff
4487 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4488 (set_attr "length" "4,4,8,8")])
4491 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4492 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4493 (match_operand:SI 2 "reg_or_cint_operand" ""))
4495 (set (match_operand:SI 0 "gpc_reg_operand" "")
4496 (rotate:SI (match_dup 1) (match_dup 2)))]
4499 (rotate:SI (match_dup 1) (match_dup 2)))
4501 (compare:CC (match_dup 0)
4505 (define_insn "*rotlsi3_internal4"
4506 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4507 (and:SI (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4508 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
4509 (match_operand:SI 3 "mask_operand" "n,n")))]
4512 {rlnm|rlwnm} %0,%1,%2,%m3,%M3
4513 {rlinm|rlwinm} %0,%1,%h2,%m3,%M3"
4514 [(set_attr "type" "var_shift_rotate,integer")])
4516 (define_insn "*rotlsi3_internal5"
4517 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4519 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4520 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4521 (match_operand:SI 3 "mask_operand" "n,n,n,n"))
4523 (clobber (match_scratch:SI 4 "=r,r,r,r"))]
4526 {rlnm.|rlwnm.} %4,%1,%2,%m3,%M3
4527 {rlinm.|rlwinm.} %4,%1,%h2,%m3,%M3
4530 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4531 (set_attr "length" "4,4,8,8")])
4534 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4536 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4537 (match_operand:SI 2 "reg_or_cint_operand" ""))
4538 (match_operand:SI 3 "mask_operand" ""))
4540 (clobber (match_scratch:SI 4 ""))]
4543 (and:SI (rotate:SI (match_dup 1)
4547 (compare:CC (match_dup 4)
4551 (define_insn "*rotlsi3_internal6"
4552 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
4554 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4555 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4556 (match_operand:SI 3 "mask_operand" "n,n,n,n"))
4558 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4559 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4562 {rlnm.|rlwnm.} %0,%1,%2,%m3,%M3
4563 {rlinm.|rlwinm.} %0,%1,%h2,%m3,%M3
4566 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4567 (set_attr "length" "4,4,8,8")])
4570 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
4572 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4573 (match_operand:SI 2 "reg_or_cint_operand" ""))
4574 (match_operand:SI 3 "mask_operand" ""))
4576 (set (match_operand:SI 0 "gpc_reg_operand" "")
4577 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4580 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4582 (compare:CC (match_dup 0)
4586 (define_insn "*rotlsi3_internal7"
4587 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4590 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4591 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
4593 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xff"
4594 [(set (attr "cell_micro")
4595 (if_then_else (match_operand:SI 2 "const_int_operand" "")
4596 (const_string "not")
4597 (const_string "always")))])
4599 (define_insn "*rotlsi3_internal8"
4600 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4601 (compare:CC (zero_extend:SI
4603 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4604 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4606 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4609 {rlnm.|rlwnm.} %3,%1,%2,0xff
4610 {rlinm.|rlwinm.} %3,%1,%h2,0xff
4613 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4614 (set_attr "length" "4,4,8,8")])
4617 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4618 (compare:CC (zero_extend:SI
4620 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4621 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4623 (clobber (match_scratch:SI 3 ""))]
4626 (zero_extend:SI (subreg:QI
4627 (rotate:SI (match_dup 1)
4630 (compare:CC (match_dup 3)
4634 (define_insn "*rotlsi3_internal9"
4635 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4636 (compare:CC (zero_extend:SI
4638 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4639 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4641 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4642 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4645 {rlnm.|rlwnm.} %0,%1,%2,0xff
4646 {rlinm.|rlwinm.} %0,%1,%h2,0xff
4649 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4650 (set_attr "length" "4,4,8,8")])
4653 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4654 (compare:CC (zero_extend:SI
4656 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4657 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4659 (set (match_operand:SI 0 "gpc_reg_operand" "")
4660 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4663 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
4665 (compare:CC (match_dup 0)
4669 (define_insn "*rotlsi3_internal10"
4670 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4673 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4674 (match_operand:SI 2 "reg_or_cint_operand" "r,i")) 0)))]
4677 {rlnm|rlwnm} %0,%1,%2,0xffff
4678 {rlinm|rlwinm} %0,%1,%h2,0xffff"
4679 [(set_attr "type" "var_shift_rotate,integer")])
4682 (define_insn "*rotlsi3_internal11"
4683 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4684 (compare:CC (zero_extend:SI
4686 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4687 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4689 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4692 {rlnm.|rlwnm.} %3,%1,%2,0xffff
4693 {rlinm.|rlwinm.} %3,%1,%h2,0xffff
4696 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4697 (set_attr "length" "4,4,8,8")])
4700 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4701 (compare:CC (zero_extend:SI
4703 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4704 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4706 (clobber (match_scratch:SI 3 ""))]
4709 (zero_extend:SI (subreg:HI
4710 (rotate:SI (match_dup 1)
4713 (compare:CC (match_dup 3)
4717 (define_insn "*rotlsi3_internal12"
4718 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4719 (compare:CC (zero_extend:SI
4721 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4722 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4724 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4725 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4728 {rlnm.|rlwnm.} %0,%1,%2,0xffff
4729 {rlinm.|rlwinm.} %0,%1,%h2,0xffff
4732 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4733 (set_attr "length" "4,4,8,8")])
4736 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4737 (compare:CC (zero_extend:SI
4739 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4740 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4742 (set (match_operand:SI 0 "gpc_reg_operand" "")
4743 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4746 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
4748 (compare:CC (match_dup 0)
4752 ;; Note that we use "sle." instead of "sl." so that we can set
4753 ;; SHIFT_COUNT_TRUNCATED.
4755 (define_expand "ashlsi3"
4756 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
4757 (use (match_operand:SI 1 "gpc_reg_operand" ""))
4758 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
4763 emit_insn (gen_ashlsi3_power (operands[0], operands[1], operands[2]));
4765 emit_insn (gen_ashlsi3_no_power (operands[0], operands[1], operands[2]));
4769 (define_insn "ashlsi3_power"
4770 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4771 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4772 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
4773 (clobber (match_scratch:SI 3 "=q,X"))]
4777 {sli|slwi} %0,%1,%h2")
4779 (define_insn "ashlsi3_no_power"
4780 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4781 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4782 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
4786 {sli|slwi} %0,%1,%h2"
4787 [(set_attr "type" "var_shift_rotate,shift")])
4789 (define_insn "*ashlsi3_64"
4790 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
4792 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4793 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))))]
4797 {sli|slwi} %0,%1,%h2"
4798 [(set_attr "type" "var_shift_rotate,shift")])
4801 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4802 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4803 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4805 (clobber (match_scratch:SI 3 "=r,r,r,r"))
4806 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4810 {sli.|slwi.} %3,%1,%h2
4813 [(set_attr "type" "delayed_compare")
4814 (set_attr "length" "4,4,8,8")])
4817 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4818 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4819 (match_operand:SI 2 "reg_or_cint_operand" ""))
4821 (clobber (match_scratch:SI 3 ""))
4822 (clobber (match_scratch:SI 4 ""))]
4823 "TARGET_POWER && reload_completed"
4824 [(parallel [(set (match_dup 3)
4825 (ashift:SI (match_dup 1) (match_dup 2)))
4826 (clobber (match_dup 4))])
4828 (compare:CC (match_dup 3)
4833 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4834 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4835 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4837 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4838 "! TARGET_POWER && TARGET_32BIT"
4841 {sli.|slwi.} %3,%1,%h2
4844 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4845 (set_attr "length" "4,4,8,8")])
4848 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4849 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4850 (match_operand:SI 2 "reg_or_cint_operand" ""))
4852 (clobber (match_scratch:SI 3 ""))]
4853 "! TARGET_POWER && TARGET_32BIT && reload_completed"
4855 (ashift:SI (match_dup 1) (match_dup 2)))
4857 (compare:CC (match_dup 3)
4862 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4863 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4864 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4866 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4867 (ashift:SI (match_dup 1) (match_dup 2)))
4868 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4872 {sli.|slwi.} %0,%1,%h2
4875 [(set_attr "type" "delayed_compare")
4876 (set_attr "length" "4,4,8,8")])
4879 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4880 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4881 (match_operand:SI 2 "reg_or_cint_operand" ""))
4883 (set (match_operand:SI 0 "gpc_reg_operand" "")
4884 (ashift:SI (match_dup 1) (match_dup 2)))
4885 (clobber (match_scratch:SI 4 ""))]
4886 "TARGET_POWER && reload_completed"
4887 [(parallel [(set (match_dup 0)
4888 (ashift:SI (match_dup 1) (match_dup 2)))
4889 (clobber (match_dup 4))])
4891 (compare:CC (match_dup 0)
4896 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4897 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4898 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4900 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4901 (ashift:SI (match_dup 1) (match_dup 2)))]
4902 "! TARGET_POWER && TARGET_32BIT"
4905 {sli.|slwi.} %0,%1,%h2
4908 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4909 (set_attr "length" "4,4,8,8")])
4912 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4913 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4914 (match_operand:SI 2 "reg_or_cint_operand" ""))
4916 (set (match_operand:SI 0 "gpc_reg_operand" "")
4917 (ashift:SI (match_dup 1) (match_dup 2)))]
4918 "! TARGET_POWER && TARGET_32BIT && reload_completed"
4920 (ashift:SI (match_dup 1) (match_dup 2)))
4922 (compare:CC (match_dup 0)
4926 (define_insn "rlwinm"
4927 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4928 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4929 (match_operand:SI 2 "const_int_operand" "i"))
4930 (match_operand:SI 3 "mask_operand" "n")))]
4931 "includes_lshift_p (operands[2], operands[3])"
4932 "{rlinm|rlwinm} %0,%1,%h2,%m3,%M3")
4935 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4937 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4938 (match_operand:SI 2 "const_int_operand" "i,i"))
4939 (match_operand:SI 3 "mask_operand" "n,n"))
4941 (clobber (match_scratch:SI 4 "=r,r"))]
4942 "includes_lshift_p (operands[2], operands[3])"
4944 {rlinm.|rlwinm.} %4,%1,%h2,%m3,%M3
4946 [(set_attr "type" "delayed_compare")
4947 (set_attr "length" "4,8")])
4950 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4952 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4953 (match_operand:SI 2 "const_int_operand" ""))
4954 (match_operand:SI 3 "mask_operand" ""))
4956 (clobber (match_scratch:SI 4 ""))]
4957 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
4959 (and:SI (ashift:SI (match_dup 1) (match_dup 2))
4962 (compare:CC (match_dup 4)
4967 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4969 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4970 (match_operand:SI 2 "const_int_operand" "i,i"))
4971 (match_operand:SI 3 "mask_operand" "n,n"))
4973 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4974 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4975 "includes_lshift_p (operands[2], operands[3])"
4977 {rlinm.|rlwinm.} %0,%1,%h2,%m3,%M3
4979 [(set_attr "type" "delayed_compare")
4980 (set_attr "length" "4,8")])
4983 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
4985 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4986 (match_operand:SI 2 "const_int_operand" ""))
4987 (match_operand:SI 3 "mask_operand" ""))
4989 (set (match_operand:SI 0 "gpc_reg_operand" "")
4990 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4991 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
4993 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4995 (compare:CC (match_dup 0)
4999 ;; The AIX assembler mis-handles "sri x,x,0", so write that case as
5001 (define_expand "lshrsi3"
5002 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
5003 (use (match_operand:SI 1 "gpc_reg_operand" ""))
5004 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
5009 emit_insn (gen_lshrsi3_power (operands[0], operands[1], operands[2]));
5011 emit_insn (gen_lshrsi3_no_power (operands[0], operands[1], operands[2]));
5015 (define_insn "lshrsi3_power"
5016 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
5017 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
5018 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i")))
5019 (clobber (match_scratch:SI 3 "=q,X,X"))]
5024 {s%A2i|s%A2wi} %0,%1,%h2")
5026 (define_insn "lshrsi3_no_power"
5027 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
5028 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
5029 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i")))]
5034 {sri|srwi} %0,%1,%h2"
5035 [(set_attr "type" "integer,var_shift_rotate,shift")])
5037 (define_insn "*lshrsi3_64"
5038 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
5040 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5041 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))))]
5045 {sri|srwi} %0,%1,%h2"
5046 [(set_attr "type" "var_shift_rotate,shift")])
5049 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,?y,?y,?y")
5050 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
5051 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
5053 (clobber (match_scratch:SI 3 "=r,X,r,r,X,r"))
5054 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
5059 {s%A2i.|s%A2wi.} %3,%1,%h2
5063 [(set_attr "type" "delayed_compare")
5064 (set_attr "length" "4,4,4,8,8,8")])
5067 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
5068 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5069 (match_operand:SI 2 "reg_or_cint_operand" ""))
5071 (clobber (match_scratch:SI 3 ""))
5072 (clobber (match_scratch:SI 4 ""))]
5073 "TARGET_POWER && reload_completed"
5074 [(parallel [(set (match_dup 3)
5075 (lshiftrt:SI (match_dup 1) (match_dup 2)))
5076 (clobber (match_dup 4))])
5078 (compare:CC (match_dup 3)
5083 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,?y,?y,?y")
5084 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
5085 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i,O,r,i"))
5087 (clobber (match_scratch:SI 3 "=X,r,r,X,r,r"))]
5088 "! TARGET_POWER && TARGET_32BIT"
5092 {sri.|srwi.} %3,%1,%h2
5096 [(set_attr "type" "delayed_compare,var_delayed_compare,delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
5097 (set_attr "length" "4,4,4,8,8,8")])
5100 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
5101 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5102 (match_operand:SI 2 "reg_or_cint_operand" ""))
5104 (clobber (match_scratch:SI 3 ""))]
5105 "! TARGET_POWER && TARGET_32BIT && reload_completed"
5107 (lshiftrt:SI (match_dup 1) (match_dup 2)))
5109 (compare:CC (match_dup 3)
5114 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,?y,?y,?y")
5115 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
5116 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
5118 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
5119 (lshiftrt:SI (match_dup 1) (match_dup 2)))
5120 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
5125 {s%A2i.|s%A2wi.} %0,%1,%h2
5129 [(set_attr "type" "delayed_compare")
5130 (set_attr "length" "4,4,4,8,8,8")])
5133 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
5134 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5135 (match_operand:SI 2 "reg_or_cint_operand" ""))
5137 (set (match_operand:SI 0 "gpc_reg_operand" "")
5138 (lshiftrt:SI (match_dup 1) (match_dup 2)))
5139 (clobber (match_scratch:SI 4 ""))]
5140 "TARGET_POWER && reload_completed"
5141 [(parallel [(set (match_dup 0)
5142 (lshiftrt:SI (match_dup 1) (match_dup 2)))
5143 (clobber (match_dup 4))])
5145 (compare:CC (match_dup 0)
5150 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,?y,?y,?y")
5151 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
5152 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i,O,r,i"))
5154 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
5155 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
5156 "! TARGET_POWER && TARGET_32BIT"
5160 {sri.|srwi.} %0,%1,%h2
5164 [(set_attr "type" "delayed_compare,var_delayed_compare,delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
5165 (set_attr "length" "4,4,4,8,8,8")])
5168 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
5169 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5170 (match_operand:SI 2 "reg_or_cint_operand" ""))
5172 (set (match_operand:SI 0 "gpc_reg_operand" "")
5173 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
5174 "! TARGET_POWER && TARGET_32BIT && reload_completed"
5176 (lshiftrt:SI (match_dup 1) (match_dup 2)))
5178 (compare:CC (match_dup 0)
5183 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5184 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
5185 (match_operand:SI 2 "const_int_operand" "i"))
5186 (match_operand:SI 3 "mask_operand" "n")))]
5187 "includes_rshift_p (operands[2], operands[3])"
5188 "{rlinm|rlwinm} %0,%1,%s2,%m3,%M3")
5191 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
5193 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5194 (match_operand:SI 2 "const_int_operand" "i,i"))
5195 (match_operand:SI 3 "mask_operand" "n,n"))
5197 (clobber (match_scratch:SI 4 "=r,r"))]
5198 "includes_rshift_p (operands[2], operands[3])"
5200 {rlinm.|rlwinm.} %4,%1,%s2,%m3,%M3
5202 [(set_attr "type" "delayed_compare")
5203 (set_attr "length" "4,8")])
5206 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
5208 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5209 (match_operand:SI 2 "const_int_operand" ""))
5210 (match_operand:SI 3 "mask_operand" ""))
5212 (clobber (match_scratch:SI 4 ""))]
5213 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
5215 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2))
5218 (compare:CC (match_dup 4)
5223 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
5225 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5226 (match_operand:SI 2 "const_int_operand" "i,i"))
5227 (match_operand:SI 3 "mask_operand" "n,n"))
5229 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
5230 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
5231 "includes_rshift_p (operands[2], operands[3])"
5233 {rlinm.|rlwinm.} %0,%1,%s2,%m3,%M3
5235 [(set_attr "type" "delayed_compare")
5236 (set_attr "length" "4,8")])
5239 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
5241 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5242 (match_operand:SI 2 "const_int_operand" ""))
5243 (match_operand:SI 3 "mask_operand" ""))
5245 (set (match_operand:SI 0 "gpc_reg_operand" "")
5246 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
5247 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
5249 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
5251 (compare:CC (match_dup 0)
5256 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5259 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
5260 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
5261 "includes_rshift_p (operands[2], GEN_INT (255))"
5262 "{rlinm|rlwinm} %0,%1,%s2,0xff")
5265 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
5269 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5270 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
5272 (clobber (match_scratch:SI 3 "=r,r"))]
5273 "includes_rshift_p (operands[2], GEN_INT (255))"
5275 {rlinm.|rlwinm.} %3,%1,%s2,0xff
5277 [(set_attr "type" "delayed_compare")
5278 (set_attr "length" "4,8")])
5281 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
5285 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5286 (match_operand:SI 2 "const_int_operand" "")) 0))
5288 (clobber (match_scratch:SI 3 ""))]
5289 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
5291 (zero_extend:SI (subreg:QI
5292 (lshiftrt:SI (match_dup 1)
5295 (compare:CC (match_dup 3)
5300 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
5304 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5305 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
5307 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
5308 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
5309 "includes_rshift_p (operands[2], GEN_INT (255))"
5311 {rlinm.|rlwinm.} %0,%1,%s2,0xff
5313 [(set_attr "type" "delayed_compare")
5314 (set_attr "length" "4,8")])
5317 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
5321 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5322 (match_operand:SI 2 "const_int_operand" "")) 0))
5324 (set (match_operand:SI 0 "gpc_reg_operand" "")
5325 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
5326 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
5328 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
5330 (compare:CC (match_dup 0)
5335 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5338 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
5339 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
5340 "includes_rshift_p (operands[2], GEN_INT (65535))"
5341 "{rlinm|rlwinm} %0,%1,%s2,0xffff")
5344 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
5348 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5349 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
5351 (clobber (match_scratch:SI 3 "=r,r"))]
5352 "includes_rshift_p (operands[2], GEN_INT (65535))"
5354 {rlinm.|rlwinm.} %3,%1,%s2,0xffff
5356 [(set_attr "type" "delayed_compare")
5357 (set_attr "length" "4,8")])
5360 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
5364 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5365 (match_operand:SI 2 "const_int_operand" "")) 0))
5367 (clobber (match_scratch:SI 3 ""))]
5368 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
5370 (zero_extend:SI (subreg:HI
5371 (lshiftrt:SI (match_dup 1)
5374 (compare:CC (match_dup 3)
5379 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
5383 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5384 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
5386 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
5387 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
5388 "includes_rshift_p (operands[2], GEN_INT (65535))"
5390 {rlinm.|rlwinm.} %0,%1,%s2,0xffff
5392 [(set_attr "type" "delayed_compare")
5393 (set_attr "length" "4,8")])
5396 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
5400 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5401 (match_operand:SI 2 "const_int_operand" "")) 0))
5403 (set (match_operand:SI 0 "gpc_reg_operand" "")
5404 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
5405 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
5407 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
5409 (compare:CC (match_dup 0)
5414 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
5416 (match_operand:SI 1 "gpc_reg_operand" "r"))
5417 (ashiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
5423 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
5425 (match_operand:SI 1 "gpc_reg_operand" "r"))
5426 (lshiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
5432 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
5434 (match_operand:SI 1 "gpc_reg_operand" "r"))
5435 (zero_extract:SI (match_operand:SI 2 "gpc_reg_operand" "r")
5441 (define_expand "ashrsi3"
5442 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5443 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5444 (match_operand:SI 2 "reg_or_cint_operand" "")))]
5449 emit_insn (gen_ashrsi3_power (operands[0], operands[1], operands[2]));
5451 emit_insn (gen_ashrsi3_no_power (operands[0], operands[1], operands[2]));
5455 (define_insn "ashrsi3_power"
5456 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
5457 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5458 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
5459 (clobber (match_scratch:SI 3 "=q,X"))]
5463 {srai|srawi} %0,%1,%h2"
5464 [(set_attr "type" "shift")])
5466 (define_insn "ashrsi3_no_power"
5467 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
5468 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5469 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
5473 {srai|srawi} %0,%1,%h2"
5474 [(set_attr "type" "var_shift_rotate,shift")])
5476 (define_insn "*ashrsi3_64"
5477 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
5479 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5480 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))))]
5484 {srai|srawi} %0,%1,%h2"
5485 [(set_attr "type" "var_shift_rotate,shift")])
5488 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
5489 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
5490 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
5492 (clobber (match_scratch:SI 3 "=r,r,r,r"))
5493 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
5497 {srai.|srawi.} %3,%1,%h2
5500 [(set_attr "type" "delayed_compare")
5501 (set_attr "length" "4,4,8,8")])
5504 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
5505 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5506 (match_operand:SI 2 "reg_or_cint_operand" ""))
5508 (clobber (match_scratch:SI 3 ""))
5509 (clobber (match_scratch:SI 4 ""))]
5510 "TARGET_POWER && reload_completed"
5511 [(parallel [(set (match_dup 3)
5512 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5513 (clobber (match_dup 4))])
5515 (compare:CC (match_dup 3)
5520 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
5521 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
5522 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
5524 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
5527 {sra.|sraw.} %3,%1,%2
5528 {srai.|srawi.} %3,%1,%h2
5531 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
5532 (set_attr "length" "4,4,8,8")])
5535 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
5536 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5537 (match_operand:SI 2 "reg_or_cint_operand" ""))
5539 (clobber (match_scratch:SI 3 ""))]
5540 "! TARGET_POWER && reload_completed"
5542 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5544 (compare:CC (match_dup 3)
5549 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
5550 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
5551 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
5553 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
5554 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5555 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
5559 {srai.|srawi.} %0,%1,%h2
5562 [(set_attr "type" "delayed_compare")
5563 (set_attr "length" "4,4,8,8")])
5566 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
5567 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5568 (match_operand:SI 2 "reg_or_cint_operand" ""))
5570 (set (match_operand:SI 0 "gpc_reg_operand" "")
5571 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5572 (clobber (match_scratch:SI 4 ""))]
5573 "TARGET_POWER && reload_completed"
5574 [(parallel [(set (match_dup 0)
5575 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5576 (clobber (match_dup 4))])
5578 (compare:CC (match_dup 0)
5583 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
5584 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
5585 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
5587 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
5588 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
5591 {sra.|sraw.} %0,%1,%2
5592 {srai.|srawi.} %0,%1,%h2
5595 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
5596 (set_attr "length" "4,4,8,8")])
5598 ;; Builtins to replace a division to generate FRE reciprocal estimate
5599 ;; instructions and the necessary fixup instructions
5600 (define_expand "recip<mode>3"
5601 [(match_operand:RECIPF 0 "gpc_reg_operand" "")
5602 (match_operand:RECIPF 1 "gpc_reg_operand" "")
5603 (match_operand:RECIPF 2 "gpc_reg_operand" "")]
5604 "RS6000_RECIP_HAVE_RE_P (<MODE>mode)"
5606 rs6000_emit_swdiv (operands[0], operands[1], operands[2], false);
5610 ;; Split to create division from FRE/FRES/etc. and fixup instead of the normal
5611 ;; hardware division. This is only done before register allocation and with
5612 ;; -ffast-math. This must appear before the divsf3/divdf3 insns.
5614 [(set (match_operand:RECIPF 0 "gpc_reg_operand" "")
5615 (div:RECIPF (match_operand 1 "gpc_reg_operand" "")
5616 (match_operand 2 "gpc_reg_operand" "")))]
5617 "RS6000_RECIP_AUTO_RE_P (<MODE>mode)
5618 && can_create_pseudo_p () && optimize_insn_for_speed_p ()
5619 && flag_finite_math_only && !flag_trapping_math && flag_reciprocal_math"
5622 rs6000_emit_swdiv (operands[0], operands[1], operands[2], true);
5626 ;; Builtins to replace 1/sqrt(x) with instructions using RSQRTE and the
5627 ;; appropriate fixup.
5628 (define_expand "rsqrt<mode>2"
5629 [(match_operand:RECIPF 0 "gpc_reg_operand" "")
5630 (match_operand:RECIPF 1 "gpc_reg_operand" "")]
5631 "RS6000_RECIP_HAVE_RSQRT_P (<MODE>mode)"
5633 rs6000_emit_swrsqrt (operands[0], operands[1]);
5638 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
5639 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5640 (match_operand:SI 2 "reg_or_cint_operand" ""))
5642 (set (match_operand:SI 0 "gpc_reg_operand" "")
5643 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
5644 "! TARGET_POWER && reload_completed"
5646 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5648 (compare:CC (match_dup 0)
5652 ;; Floating-point insns, excluding normal data motion.
5654 ;; PowerPC has a full set of single-precision floating point instructions.
5656 ;; For the POWER architecture, we pretend that we have both SFmode and
5657 ;; DFmode insns, while, in fact, all fp insns are actually done in double.
5658 ;; The only conversions we will do will be when storing to memory. In that
5659 ;; case, we will use the "frsp" instruction before storing.
5661 ;; Note that when we store into a single-precision memory location, we need to
5662 ;; use the frsp insn first. If the register being stored isn't dead, we
5663 ;; need a scratch register for the frsp. But this is difficult when the store
5664 ;; is done by reload. It is not incorrect to do the frsp on the register in
5665 ;; this case, we just lose precision that we would have otherwise gotten but
5666 ;; is not guaranteed. Perhaps this should be tightened up at some point.
5668 (define_expand "extendsfdf2"
5669 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5670 (float_extend:DF (match_operand:SF 1 "reg_or_none500mem_operand" "")))]
5671 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5674 (define_insn_and_split "*extendsfdf2_fpr"
5675 [(set (match_operand:DF 0 "gpc_reg_operand" "=d,?d,d")
5676 (float_extend:DF (match_operand:SF 1 "reg_or_mem_operand" "0,f,m")))]
5677 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5682 "&& reload_completed && REG_P (operands[1]) && REGNO (operands[0]) == REGNO (operands[1])"
5685 emit_note (NOTE_INSN_DELETED);
5688 [(set_attr "type" "fp,fp,fpload")])
5690 (define_expand "truncdfsf2"
5691 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5692 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "")))]
5693 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5696 (define_insn "*truncdfsf2_fpr"
5697 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5698 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "d")))]
5699 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5701 [(set_attr "type" "fp")])
5703 (define_insn "aux_truncdfsf2"
5704 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5705 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRSP))]
5706 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5708 [(set_attr "type" "fp")])
5710 (define_expand "negsf2"
5711 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5712 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
5713 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
5716 (define_insn "*negsf2"
5717 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5718 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5719 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5721 [(set_attr "type" "fp")])
5723 (define_expand "abssf2"
5724 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5725 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
5726 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
5729 (define_insn "*abssf2"
5730 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5731 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5732 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5734 [(set_attr "type" "fp")])
5737 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5738 (neg:SF (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f"))))]
5739 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5741 [(set_attr "type" "fp")])
5743 (define_expand "addsf3"
5744 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5745 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "")
5746 (match_operand:SF 2 "gpc_reg_operand" "")))]
5747 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
5751 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5752 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5753 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5754 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5756 [(set_attr "type" "fp")
5757 (set_attr "fp_type" "fp_addsub_s")])
5760 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5761 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5762 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5763 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5764 "{fa|fadd} %0,%1,%2"
5765 [(set_attr "type" "fp")])
5767 (define_expand "subsf3"
5768 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5769 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "")
5770 (match_operand:SF 2 "gpc_reg_operand" "")))]
5771 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
5775 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5776 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5777 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5778 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5780 [(set_attr "type" "fp")
5781 (set_attr "fp_type" "fp_addsub_s")])
5784 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5785 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5786 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5787 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5788 "{fs|fsub} %0,%1,%2"
5789 [(set_attr "type" "fp")])
5791 (define_expand "mulsf3"
5792 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5793 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "")
5794 (match_operand:SF 2 "gpc_reg_operand" "")))]
5795 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
5799 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5800 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5801 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5802 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5804 [(set_attr "type" "fp")
5805 (set_attr "fp_type" "fp_mul_s")])
5808 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5809 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5810 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5811 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5812 "{fm|fmul} %0,%1,%2"
5813 [(set_attr "type" "dmul")])
5815 (define_expand "divsf3"
5816 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5817 (div:SF (match_operand:SF 1 "gpc_reg_operand" "")
5818 (match_operand:SF 2 "gpc_reg_operand" "")))]
5819 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
5823 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5824 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5825 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5826 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS
5827 && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
5829 [(set_attr "type" "sdiv")])
5832 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5833 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5834 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5835 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS
5836 && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
5837 "{fd|fdiv} %0,%1,%2"
5838 [(set_attr "type" "ddiv")])
5841 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5842 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))]
5845 [(set_attr "type" "fp")])
5847 (define_insn "*fmaddsf4_powerpc"
5848 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5849 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5850 (match_operand:SF 2 "gpc_reg_operand" "f"))
5851 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5852 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS
5853 && TARGET_SINGLE_FLOAT && TARGET_FUSED_MADD"
5854 "fmadds %0,%1,%2,%3"
5855 [(set_attr "type" "fp")
5856 (set_attr "fp_type" "fp_maddsub_s")])
5858 (define_insn "*fmaddsf4_power"
5859 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5860 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5861 (match_operand:SF 2 "gpc_reg_operand" "f"))
5862 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5863 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5864 "{fma|fmadd} %0,%1,%2,%3"
5865 [(set_attr "type" "dmul")])
5867 (define_insn "*fmsubsf4_powerpc"
5868 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5869 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5870 (match_operand:SF 2 "gpc_reg_operand" "f"))
5871 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5872 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS
5873 && TARGET_SINGLE_FLOAT && TARGET_FUSED_MADD"
5874 "fmsubs %0,%1,%2,%3"
5875 [(set_attr "type" "fp")
5876 (set_attr "fp_type" "fp_maddsub_s")])
5878 (define_insn "*fmsubsf4_power"
5879 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5880 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5881 (match_operand:SF 2 "gpc_reg_operand" "f"))
5882 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5883 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5884 "{fms|fmsub} %0,%1,%2,%3"
5885 [(set_attr "type" "dmul")])
5887 (define_insn "*fnmaddsf4_powerpc_1"
5888 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5889 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5890 (match_operand:SF 2 "gpc_reg_operand" "f"))
5891 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5892 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5893 && TARGET_SINGLE_FLOAT"
5894 "fnmadds %0,%1,%2,%3"
5895 [(set_attr "type" "fp")
5896 (set_attr "fp_type" "fp_maddsub_s")])
5898 (define_insn "*fnmaddsf4_powerpc_2"
5899 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5900 (minus:SF (mult:SF (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f"))
5901 (match_operand:SF 2 "gpc_reg_operand" "f"))
5902 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5903 "TARGET_POWERPC && TARGET_SINGLE_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5904 && ! HONOR_SIGNED_ZEROS (SFmode)"
5905 "fnmadds %0,%1,%2,%3"
5906 [(set_attr "type" "fp")
5907 (set_attr "fp_type" "fp_maddsub_s")])
5909 (define_insn "*fnmaddsf4_power_1"
5910 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5911 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5912 (match_operand:SF 2 "gpc_reg_operand" "f"))
5913 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5914 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5915 "{fnma|fnmadd} %0,%1,%2,%3"
5916 [(set_attr "type" "dmul")])
5918 (define_insn "*fnmaddsf4_power_2"
5919 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5920 (minus:SF (mult:SF (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f"))
5921 (match_operand:SF 2 "gpc_reg_operand" "f"))
5922 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5923 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5924 && ! HONOR_SIGNED_ZEROS (SFmode)"
5925 "{fnma|fnmadd} %0,%1,%2,%3"
5926 [(set_attr "type" "dmul")])
5928 (define_insn "*fnmsubsf4_powerpc_1"
5929 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5930 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5931 (match_operand:SF 2 "gpc_reg_operand" "f"))
5932 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5933 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5934 && TARGET_SINGLE_FLOAT"
5935 "fnmsubs %0,%1,%2,%3"
5936 [(set_attr "type" "fp")
5937 (set_attr "fp_type" "fp_maddsub_s")])
5939 (define_insn "*fnmsubsf4_powerpc_2"
5940 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5941 (minus:SF (match_operand:SF 3 "gpc_reg_operand" "f")
5942 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5943 (match_operand:SF 2 "gpc_reg_operand" "f"))))]
5944 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5945 && TARGET_SINGLE_FLOAT && ! HONOR_SIGNED_ZEROS (SFmode)"
5946 "fnmsubs %0,%1,%2,%3"
5947 [(set_attr "type" "fp")
5948 (set_attr "fp_type" "fp_maddsub_s")])
5950 (define_insn "*fnmsubsf4_power_1"
5951 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5952 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5953 (match_operand:SF 2 "gpc_reg_operand" "f"))
5954 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5955 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5956 "{fnms|fnmsub} %0,%1,%2,%3"
5957 [(set_attr "type" "dmul")])
5959 (define_insn "*fnmsubsf4_power_2"
5960 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5961 (minus:SF (match_operand:SF 3 "gpc_reg_operand" "f")
5962 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5963 (match_operand:SF 2 "gpc_reg_operand" "f"))))]
5964 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5965 && ! HONOR_SIGNED_ZEROS (SFmode)"
5966 "{fnms|fnmsub} %0,%1,%2,%3"
5967 [(set_attr "type" "dmul")])
5969 (define_expand "sqrtsf2"
5970 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5971 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
5972 "(TARGET_PPC_GPOPT || TARGET_POWER2 || TARGET_XILINX_FPU)
5973 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
5974 && !TARGET_SIMPLE_FPU"
5978 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5979 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5980 "(TARGET_PPC_GPOPT || TARGET_XILINX_FPU) && TARGET_HARD_FLOAT
5981 && TARGET_FPRS && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
5983 [(set_attr "type" "ssqrt")])
5986 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5987 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5988 "TARGET_POWER2 && TARGET_HARD_FLOAT && TARGET_FPRS
5989 && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
5991 [(set_attr "type" "dsqrt")])
5993 (define_insn "*rsqrtsf_internal1"
5994 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5995 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")]
5999 [(set_attr "type" "fp")])
6001 (define_expand "copysign<mode>3"
6003 (abs:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")))
6005 (neg:SFDF (abs:SFDF (match_dup 1))))
6006 (set (match_operand:SFDF 0 "gpc_reg_operand" "")
6007 (if_then_else:SFDF (ge (match_operand:SFDF 2 "gpc_reg_operand" "")
6011 "TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>
6012 && ((TARGET_PPC_GFXOPT
6013 && !HONOR_NANS (<MODE>mode)
6014 && !HONOR_SIGNED_ZEROS (<MODE>mode))
6016 || VECTOR_UNIT_VSX_P (<MODE>mode))"
6018 if (TARGET_CMPB || VECTOR_UNIT_VSX_P (<MODE>mode))
6020 emit_insn (gen_copysign<mode>3_fcpsgn (operands[0], operands[1],
6025 operands[3] = gen_reg_rtx (<MODE>mode);
6026 operands[4] = gen_reg_rtx (<MODE>mode);
6027 operands[5] = CONST0_RTX (<MODE>mode);
6030 ;; Use an unspec rather providing an if-then-else in RTL, to prevent the
6031 ;; compiler from optimizing -0.0
6032 (define_insn "copysign<mode>3_fcpsgn"
6033 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
6034 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")
6035 (match_operand:SFDF 2 "gpc_reg_operand" "<rreg2>")]
6037 "TARGET_CMPB && !VECTOR_UNIT_VSX_P (<MODE>mode)"
6039 [(set_attr "type" "fp")])
6041 ;; For MIN, MAX, and conditional move, we use DEFINE_EXPAND's that involve a
6042 ;; fsel instruction and some auxiliary computations. Then we just have a
6043 ;; single DEFINE_INSN for fsel and the define_splits to make them if made by
6045 (define_expand "smaxsf3"
6046 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6047 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
6048 (match_operand:SF 2 "gpc_reg_operand" ""))
6051 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
6052 && TARGET_SINGLE_FLOAT && !flag_trapping_math"
6053 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
6055 (define_expand "sminsf3"
6056 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6057 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
6058 (match_operand:SF 2 "gpc_reg_operand" ""))
6061 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
6062 && TARGET_SINGLE_FLOAT && !flag_trapping_math"
6063 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
6066 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6067 (match_operator:SF 3 "min_max_operator"
6068 [(match_operand:SF 1 "gpc_reg_operand" "")
6069 (match_operand:SF 2 "gpc_reg_operand" "")]))]
6070 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
6071 && TARGET_SINGLE_FLOAT && !flag_trapping_math"
6074 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
6075 operands[1], operands[2]);
6079 (define_expand "mov<mode>cc"
6080 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
6081 (if_then_else:GPR (match_operand 1 "comparison_operator" "")
6082 (match_operand:GPR 2 "gpc_reg_operand" "")
6083 (match_operand:GPR 3 "gpc_reg_operand" "")))]
6087 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
6093 ;; We use the BASE_REGS for the isel input operands because, if rA is
6094 ;; 0, the value of 0 is placed in rD upon truth. Similarly for rB
6095 ;; because we may switch the operands and rB may end up being rA.
6097 ;; We need 2 patterns: an unsigned and a signed pattern. We could
6098 ;; leave out the mode in operand 4 and use one pattern, but reload can
6099 ;; change the mode underneath our feet and then gets confused trying
6100 ;; to reload the value.
6101 (define_insn "isel_signed_<mode>"
6102 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
6104 (match_operator 1 "scc_comparison_operator"
6105 [(match_operand:CC 4 "cc_reg_operand" "y,y")
6107 (match_operand:GPR 2 "reg_or_cint_operand" "O,b")
6108 (match_operand:GPR 3 "gpc_reg_operand" "r,r")))]
6111 { return output_isel (operands); }"
6112 [(set_attr "type" "isel")
6113 (set_attr "length" "4")])
6115 (define_insn "isel_unsigned_<mode>"
6116 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
6118 (match_operator 1 "scc_comparison_operator"
6119 [(match_operand:CCUNS 4 "cc_reg_operand" "y,y")
6121 (match_operand:GPR 2 "reg_or_cint_operand" "O,b")
6122 (match_operand:GPR 3 "gpc_reg_operand" "r,r")))]
6125 { return output_isel (operands); }"
6126 [(set_attr "type" "isel")
6127 (set_attr "length" "4")])
6129 (define_expand "movsfcc"
6130 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6131 (if_then_else:SF (match_operand 1 "comparison_operator" "")
6132 (match_operand:SF 2 "gpc_reg_operand" "")
6133 (match_operand:SF 3 "gpc_reg_operand" "")))]
6134 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
6137 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
6143 (define_insn "*fselsfsf4"
6144 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6145 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
6146 (match_operand:SF 4 "zero_fp_constant" "F"))
6147 (match_operand:SF 2 "gpc_reg_operand" "f")
6148 (match_operand:SF 3 "gpc_reg_operand" "f")))]
6149 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
6151 [(set_attr "type" "fp")])
6153 (define_insn "*fseldfsf4"
6154 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6155 (if_then_else:SF (ge (match_operand:DF 1 "gpc_reg_operand" "d")
6156 (match_operand:DF 4 "zero_fp_constant" "F"))
6157 (match_operand:SF 2 "gpc_reg_operand" "f")
6158 (match_operand:SF 3 "gpc_reg_operand" "f")))]
6159 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_SINGLE_FLOAT"
6161 [(set_attr "type" "fp")])
6163 (define_expand "negdf2"
6164 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6165 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
6166 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6169 (define_insn "*negdf2_fpr"
6170 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6171 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "d")))]
6172 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6173 && !VECTOR_UNIT_VSX_P (DFmode)"
6175 [(set_attr "type" "fp")])
6177 (define_expand "absdf2"
6178 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6179 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
6180 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6183 (define_insn "*absdf2_fpr"
6184 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6185 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "d")))]
6186 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6187 && !VECTOR_UNIT_VSX_P (DFmode)"
6189 [(set_attr "type" "fp")])
6191 (define_insn "*nabsdf2_fpr"
6192 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6193 (neg:DF (abs:DF (match_operand:DF 1 "gpc_reg_operand" "d"))))]
6194 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6195 && !VECTOR_UNIT_VSX_P (DFmode)"
6197 [(set_attr "type" "fp")])
6199 (define_expand "adddf3"
6200 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6201 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "")
6202 (match_operand:DF 2 "gpc_reg_operand" "")))]
6203 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6206 (define_insn "*adddf3_fpr"
6207 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6208 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
6209 (match_operand:DF 2 "gpc_reg_operand" "d")))]
6210 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6211 && !VECTOR_UNIT_VSX_P (DFmode)"
6212 "{fa|fadd} %0,%1,%2"
6213 [(set_attr "type" "fp")
6214 (set_attr "fp_type" "fp_addsub_d")])
6216 (define_expand "subdf3"
6217 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6218 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "")
6219 (match_operand:DF 2 "gpc_reg_operand" "")))]
6220 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6223 (define_insn "*subdf3_fpr"
6224 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6225 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "d")
6226 (match_operand:DF 2 "gpc_reg_operand" "d")))]
6227 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6228 && !VECTOR_UNIT_VSX_P (DFmode)"
6229 "{fs|fsub} %0,%1,%2"
6230 [(set_attr "type" "fp")
6231 (set_attr "fp_type" "fp_addsub_d")])
6233 (define_expand "muldf3"
6234 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6235 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "")
6236 (match_operand:DF 2 "gpc_reg_operand" "")))]
6237 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6240 (define_insn "*muldf3_fpr"
6241 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6242 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
6243 (match_operand:DF 2 "gpc_reg_operand" "d")))]
6244 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6245 && !VECTOR_UNIT_VSX_P (DFmode)"
6246 "{fm|fmul} %0,%1,%2"
6247 [(set_attr "type" "dmul")
6248 (set_attr "fp_type" "fp_mul_d")])
6250 (define_expand "divdf3"
6251 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6252 (div:DF (match_operand:DF 1 "gpc_reg_operand" "")
6253 (match_operand:DF 2 "gpc_reg_operand" "")))]
6255 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)
6256 && !TARGET_SIMPLE_FPU"
6259 (define_insn "*divdf3_fpr"
6260 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6261 (div:DF (match_operand:DF 1 "gpc_reg_operand" "d")
6262 (match_operand:DF 2 "gpc_reg_operand" "d")))]
6263 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && !TARGET_SIMPLE_FPU
6264 && !VECTOR_UNIT_VSX_P (DFmode)"
6265 "{fd|fdiv} %0,%1,%2"
6266 [(set_attr "type" "ddiv")])
6268 (define_insn "*fred_fpr"
6269 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6270 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))]
6271 "TARGET_FRE && !VECTOR_UNIT_VSX_P (DFmode)"
6273 [(set_attr "type" "fp")])
6275 (define_insn "*rsqrtdf_internal1"
6276 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6277 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "d")]
6279 "TARGET_FRSQRTE && !VECTOR_UNIT_VSX_P (DFmode)"
6281 [(set_attr "type" "fp")])
6283 (define_insn "*fmadddf4_fpr"
6284 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6285 (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
6286 (match_operand:DF 2 "gpc_reg_operand" "d"))
6287 (match_operand:DF 3 "gpc_reg_operand" "d")))]
6288 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD && TARGET_DOUBLE_FLOAT
6289 && VECTOR_UNIT_NONE_P (DFmode)"
6290 "{fma|fmadd} %0,%1,%2,%3"
6291 [(set_attr "type" "dmul")
6292 (set_attr "fp_type" "fp_maddsub_d")])
6294 (define_insn "*fmsubdf4_fpr"
6295 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6296 (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
6297 (match_operand:DF 2 "gpc_reg_operand" "d"))
6298 (match_operand:DF 3 "gpc_reg_operand" "d")))]
6299 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD && TARGET_DOUBLE_FLOAT
6300 && VECTOR_UNIT_NONE_P (DFmode)"
6301 "{fms|fmsub} %0,%1,%2,%3"
6302 [(set_attr "type" "dmul")
6303 (set_attr "fp_type" "fp_maddsub_d")])
6305 (define_insn "*fnmadddf4_fpr_1"
6306 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6307 (neg:DF (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
6308 (match_operand:DF 2 "gpc_reg_operand" "d"))
6309 (match_operand:DF 3 "gpc_reg_operand" "d"))))]
6310 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD && TARGET_DOUBLE_FLOAT
6311 && VECTOR_UNIT_NONE_P (DFmode)"
6312 "{fnma|fnmadd} %0,%1,%2,%3"
6313 [(set_attr "type" "dmul")
6314 (set_attr "fp_type" "fp_maddsub_d")])
6316 (define_insn "*fnmadddf4_fpr_2"
6317 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6318 (minus:DF (mult:DF (neg:DF (match_operand:DF 1 "gpc_reg_operand" "d"))
6319 (match_operand:DF 2 "gpc_reg_operand" "d"))
6320 (match_operand:DF 3 "gpc_reg_operand" "d")))]
6321 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD && TARGET_DOUBLE_FLOAT
6322 && ! HONOR_SIGNED_ZEROS (DFmode) && VECTOR_UNIT_NONE_P (DFmode)"
6323 "{fnma|fnmadd} %0,%1,%2,%3"
6324 [(set_attr "type" "dmul")
6325 (set_attr "fp_type" "fp_maddsub_d")])
6327 (define_insn "*fnmsubdf4_fpr_1"
6328 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6329 (neg:DF (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
6330 (match_operand:DF 2 "gpc_reg_operand" "d"))
6331 (match_operand:DF 3 "gpc_reg_operand" "d"))))]
6332 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD && TARGET_DOUBLE_FLOAT
6333 && VECTOR_UNIT_NONE_P (DFmode)"
6334 "{fnms|fnmsub} %0,%1,%2,%3"
6335 [(set_attr "type" "dmul")
6336 (set_attr "fp_type" "fp_maddsub_d")])
6338 (define_insn "*fnmsubdf4_fpr_2"
6339 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6340 (minus:DF (match_operand:DF 3 "gpc_reg_operand" "d")
6341 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
6342 (match_operand:DF 2 "gpc_reg_operand" "d"))))]
6343 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD && TARGET_DOUBLE_FLOAT
6344 && ! HONOR_SIGNED_ZEROS (DFmode) && VECTOR_UNIT_NONE_P (DFmode)"
6345 "{fnms|fnmsub} %0,%1,%2,%3"
6346 [(set_attr "type" "dmul")
6347 (set_attr "fp_type" "fp_maddsub_d")])
6349 (define_expand "sqrtdf2"
6350 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6351 (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
6352 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS
6353 && TARGET_DOUBLE_FLOAT"
6356 (define_insn "*sqrtdf2_fpr"
6357 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6358 (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "d")))]
6359 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS
6360 && TARGET_DOUBLE_FLOAT
6361 && !VECTOR_UNIT_VSX_P (DFmode)"
6363 [(set_attr "type" "dsqrt")])
6365 ;; The conditional move instructions allow us to perform max and min
6366 ;; operations even when
6368 (define_expand "smaxdf3"
6369 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6370 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
6371 (match_operand:DF 2 "gpc_reg_operand" ""))
6374 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6375 && !flag_trapping_math"
6376 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
6378 (define_expand "smindf3"
6379 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6380 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
6381 (match_operand:DF 2 "gpc_reg_operand" ""))
6384 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6385 && !flag_trapping_math"
6386 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
6389 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6390 (match_operator:DF 3 "min_max_operator"
6391 [(match_operand:DF 1 "gpc_reg_operand" "")
6392 (match_operand:DF 2 "gpc_reg_operand" "")]))]
6393 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6394 && !flag_trapping_math"
6397 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
6398 operands[1], operands[2]);
6402 (define_expand "movdfcc"
6403 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6404 (if_then_else:DF (match_operand 1 "comparison_operator" "")
6405 (match_operand:DF 2 "gpc_reg_operand" "")
6406 (match_operand:DF 3 "gpc_reg_operand" "")))]
6407 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6410 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
6416 (define_insn "*fseldfdf4"
6417 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6418 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "d")
6419 (match_operand:DF 4 "zero_fp_constant" "F"))
6420 (match_operand:DF 2 "gpc_reg_operand" "d")
6421 (match_operand:DF 3 "gpc_reg_operand" "d")))]
6422 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6424 [(set_attr "type" "fp")])
6426 (define_insn "*fselsfdf4"
6427 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6428 (if_then_else:DF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
6429 (match_operand:SF 4 "zero_fp_constant" "F"))
6430 (match_operand:DF 2 "gpc_reg_operand" "d")
6431 (match_operand:DF 3 "gpc_reg_operand" "d")))]
6432 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_SINGLE_FLOAT"
6434 [(set_attr "type" "fp")])
6436 ;; Conversions to and from floating-point.
6438 ; We don't define lfiwax/lfiwzx with the normal definition, because we
6439 ; don't want to support putting SImode in FPR registers.
6440 (define_insn "lfiwax"
6441 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6442 (unspec:DI [(match_operand:SI 1 "indexed_or_indirect_operand" "Z")]
6444 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWAX"
6446 [(set_attr "type" "fpload")])
6448 (define_insn_and_split "floatsi<mode>2_lfiwax"
6449 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>,<rreg2>")
6450 (float:SFDF (match_operand:SI 1 "nonimmediate_operand" "Z,r")))
6451 (clobber (match_operand:SI 2 "indexed_or_indirect_operand" "=Z,Z"))
6452 (clobber (match_operand:DI 3 "gpc_reg_operand" "=d,d"))]
6453 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWAX
6456 "MEM_P (operands[1]) || reload_completed"
6460 if (MEM_P (operands[1]))
6462 operands[1] = rs6000_address_for_fpconvert (operands[1]);
6463 emit_insn (gen_lfiwax (operands[3], operands[1]));
6467 emit_move_insn (operands[2], operands[1]);
6468 emit_insn (gen_lfiwax (operands[3], operands[2]));
6470 emit_insn (gen_floatdi<mode>2 (operands[0], operands[3]));
6473 [(set_attr "length" "8,12")])
6475 (define_insn_and_split "floatsi<mode>2_lfiwax_mem"
6476 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
6477 (float:SFDF (match_operand:SI 1 "memory_operand" "Z")))
6478 (clobber (match_scratch:DI 2 "=d"))]
6479 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWAX
6482 "&& reload_completed"
6486 emit_insn (gen_lfiwax (operands[2], operands[1]));
6487 emit_insn (gen_floatdi<mode>2 (operands[0], operands[2]));
6490 [(set_attr "length" "8")])
6492 (define_insn_and_split "floatsi<mode>2_lfiwax_mem2"
6493 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
6496 (match_operand:SI 1 "memory_operand" "Z"))))
6497 (clobber (match_scratch:DI 2 "=d"))]
6498 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWAX
6501 "&& reload_completed"
6505 emit_insn (gen_lfiwax (operands[2], operands[1]));
6506 emit_insn (gen_floatdi<mode>2 (operands[0], operands[2]));
6509 [(set_attr "length" "8")])
6511 (define_insn "lfiwzx"
6512 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6513 (unspec:DI [(match_operand:SI 1 "indexed_or_indirect_operand" "Z")]
6515 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWZX"
6517 [(set_attr "type" "fpload")])
6519 (define_insn_and_split "floatunssi<mode>2_lfiwzx"
6520 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>,<rreg2>")
6521 (unsigned_float:SFDF (match_operand:SI 1 "gpc_reg_operand" "Z,r")))
6522 (clobber (match_operand:SI 2 "indexed_or_indirect_operand" "=Z,Z"))
6523 (clobber (match_operand:DI 3 "gpc_reg_operand" "=d,d"))]
6524 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWZX
6527 "MEM_P (operands[1]) || reload_completed"
6531 if (MEM_P (operands[1]))
6533 operands[1] = rs6000_address_for_fpconvert (operands[1]);
6534 emit_insn (gen_lfiwzx (operands[3], operands[1]));
6538 emit_move_insn (operands[2], operands[1]);
6539 emit_insn (gen_lfiwzx (operands[3], operands[2]));
6541 emit_insn (gen_floatdi<mode>2 (operands[0], operands[3]));
6544 [(set_attr "length" "8,12")])
6546 (define_insn_and_split "floatunssi<mode>2_lfiwzx_mem"
6547 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
6548 (unsigned_float:SFDF (match_operand:SI 1 "memory_operand" "Z")))
6549 (clobber (match_scratch:DI 2 "=d"))]
6550 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWZX
6553 "&& reload_completed"
6557 emit_insn (gen_lfiwzx (operands[2], operands[1]));
6558 emit_insn (gen_floatdi<mode>2 (operands[0], operands[2]));
6561 [(set_attr "length" "8")])
6563 (define_insn_and_split "floatunssi<mode>2_lfiwzx_mem2"
6564 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
6565 (unsigned_float:SFDF
6567 (match_operand:SI 1 "memory_operand" "Z"))))
6568 (clobber (match_scratch:DI 2 "=d"))]
6569 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWZX
6572 "&& reload_completed"
6576 emit_insn (gen_lfiwzx (operands[2], operands[1]));
6577 emit_insn (gen_floatdi<mode>2 (operands[0], operands[2]));
6580 [(set_attr "length" "8")])
6582 ; For each of these conversions, there is a define_expand, a define_insn
6583 ; with a '#' template, and a define_split (with C code). The idea is
6584 ; to allow constant folding with the template of the define_insn,
6585 ; then to have the insns split later (between sched1 and final).
6587 (define_expand "floatsidf2"
6588 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
6589 (float:DF (match_operand:SI 1 "nonimmediate_operand" "")))
6592 (clobber (match_dup 4))
6593 (clobber (match_dup 5))
6594 (clobber (match_dup 6))])]
6596 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6599 if (TARGET_E500_DOUBLE)
6601 if (!REG_P (operands[1]))
6602 operands[1] = force_reg (SImode, operands[1]);
6603 emit_insn (gen_spe_floatsidf2 (operands[0], operands[1]));
6606 else if (TARGET_LFIWAX && TARGET_FCFID)
6608 rs6000_expand_convert_si_to_sfdf (operands[0], operands[1], false);
6611 else if (TARGET_FCFID)
6613 rtx dreg = operands[1];
6615 dreg = force_reg (SImode, dreg);
6616 dreg = convert_to_mode (DImode, dreg, false);
6617 emit_insn (gen_floatdidf2 (operands[0], dreg));
6621 if (!REG_P (operands[1]))
6622 operands[1] = force_reg (SImode, operands[1]);
6623 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
6624 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503601774854144\", DFmode));
6625 operands[4] = rs6000_allocate_stack_temp (DFmode, true, false);
6626 operands[5] = gen_reg_rtx (DFmode);
6627 operands[6] = gen_reg_rtx (SImode);
6630 (define_insn_and_split "*floatsidf2_internal"
6631 [(set (match_operand:DF 0 "gpc_reg_operand" "=&d")
6632 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
6633 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
6634 (use (match_operand:DF 3 "gpc_reg_operand" "d"))
6635 (clobber (match_operand:DF 4 "offsettable_mem_operand" "=o"))
6636 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&d"))
6637 (clobber (match_operand:SI 6 "gpc_reg_operand" "=&r"))]
6638 "! TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6644 rtx lowword, highword;
6645 gcc_assert (MEM_P (operands[4]));
6646 highword = adjust_address (operands[4], SImode, 0);
6647 lowword = adjust_address (operands[4], SImode, 4);
6648 if (! WORDS_BIG_ENDIAN)
6651 tmp = highword; highword = lowword; lowword = tmp;
6654 emit_insn (gen_xorsi3 (operands[6], operands[1],
6655 GEN_INT (~ (HOST_WIDE_INT) 0x7fffffff)));
6656 emit_move_insn (lowword, operands[6]);
6657 emit_move_insn (highword, operands[2]);
6658 emit_move_insn (operands[5], operands[4]);
6659 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
6662 [(set_attr "length" "24")])
6664 ;; If we don't have a direct conversion to single precision, don't enable this
6665 ;; conversion for 32-bit without fast math, because we don't have the insn to
6666 ;; generate the fixup swizzle to avoid double rounding problems.
6667 (define_expand "floatunssisf2"
6668 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6669 (unsigned_float:SF (match_operand:SI 1 "nonimmediate_operand" "")))]
6670 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT
6673 && ((TARGET_FCFIDUS && TARGET_LFIWZX)
6674 || (TARGET_DOUBLE_FLOAT && TARGET_FCFID
6675 && (TARGET_POWERPC64 || flag_unsafe_math_optimizations)))))"
6680 if (!REG_P (operands[1]))
6681 operands[1] = force_reg (SImode, operands[1]);
6683 else if (TARGET_LFIWZX && TARGET_FCFIDUS)
6685 rs6000_expand_convert_si_to_sfdf (operands[0], operands[1], true);
6690 rtx dreg = operands[1];
6692 dreg = force_reg (SImode, dreg);
6693 dreg = convert_to_mode (DImode, dreg, true);
6694 emit_insn (gen_floatdisf2 (operands[0], dreg));
6699 (define_expand "floatunssidf2"
6700 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
6701 (unsigned_float:DF (match_operand:SI 1 "nonimmediate_operand" "")))
6704 (clobber (match_dup 4))
6705 (clobber (match_dup 5))])]
6707 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6710 if (TARGET_E500_DOUBLE)
6712 if (!REG_P (operands[1]))
6713 operands[1] = force_reg (SImode, operands[1]);
6714 emit_insn (gen_spe_floatunssidf2 (operands[0], operands[1]));
6717 else if (TARGET_LFIWZX && TARGET_FCFID)
6719 rs6000_expand_convert_si_to_sfdf (operands[0], operands[1], true);
6722 else if (TARGET_FCFID)
6724 rtx dreg = operands[1];
6726 dreg = force_reg (SImode, dreg);
6727 dreg = convert_to_mode (DImode, dreg, true);
6728 emit_insn (gen_floatdidf2 (operands[0], dreg));
6732 if (!REG_P (operands[1]))
6733 operands[1] = force_reg (SImode, operands[1]);
6734 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
6735 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503599627370496\", DFmode));
6736 operands[4] = rs6000_allocate_stack_temp (DFmode, true, false);
6737 operands[5] = gen_reg_rtx (DFmode);
6740 (define_insn_and_split "*floatunssidf2_internal"
6741 [(set (match_operand:DF 0 "gpc_reg_operand" "=&d")
6742 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
6743 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
6744 (use (match_operand:DF 3 "gpc_reg_operand" "d"))
6745 (clobber (match_operand:DF 4 "offsettable_mem_operand" "=o"))
6746 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&d"))]
6747 "! TARGET_FCFIDU && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6748 && !(TARGET_FCFID && TARGET_POWERPC64)"
6754 rtx lowword, highword;
6755 gcc_assert (MEM_P (operands[4]));
6756 highword = adjust_address (operands[4], SImode, 0);
6757 lowword = adjust_address (operands[4], SImode, 4);
6758 if (! WORDS_BIG_ENDIAN)
6761 tmp = highword; highword = lowword; lowword = tmp;
6764 emit_move_insn (lowword, operands[1]);
6765 emit_move_insn (highword, operands[2]);
6766 emit_move_insn (operands[5], operands[4]);
6767 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
6770 [(set_attr "length" "20")])
6772 (define_expand "fix_trunc<mode>si2"
6773 [(set (match_operand:SI 0 "gpc_reg_operand" "")
6774 (fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "")))]
6775 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT
6776 && ((TARGET_FPRS && <TARGET_FLOAT>) || <E500_CONVERT>)"
6779 if (!<E500_CONVERT>)
6785 tmp = gen_reg_rtx (DImode);
6786 stack = rs6000_allocate_stack_temp (SImode, false, true);
6787 emit_insn (gen_fix_trunc<mode>si2_stfiwx (operands[0], operands[1],
6792 tmp = gen_reg_rtx (DImode);
6793 stack = rs6000_allocate_stack_temp (DImode, true, false);
6794 emit_insn (gen_fix_trunc<mode>si2_internal (operands[0], operands[1],
6801 (define_insn_and_split "fix_trunc<mode>si2_stfiwx"
6802 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6803 (fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")))
6804 (clobber (match_operand:DI 2 "gpc_reg_operand" "=d"))
6805 (clobber (match_operand:SI 3 "indexed_or_indirect_operand" "=Z"))]
6806 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6807 && (<MODE>mode != SFmode || TARGET_SINGLE_FLOAT)
6810 "&& reload_completed"
6814 emit_insn (gen_fctiwz_<mode> (operands[2], operands[1]));
6815 if (TARGET_MFPGPR && TARGET_POWERPC64 && REG_P (operands[0])
6816 && INT_REGNO_P (REGNO (operands[0])))
6818 rtx reg = gen_lowpart (DImode, operands[0]);
6819 emit_move_insn (reg, operands[2]);
6823 emit_insn (gen_stfiwx (operands[3], operands[2]));
6824 emit_move_insn (operands[0], operands[3]);
6828 [(set_attr "length" "12")])
6830 (define_insn_and_split "*fix_trunc<mode>si2_mem"
6831 [(set (match_operand:SI 0 "memory_operand" "=Z")
6832 (fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")))
6833 (clobber (match_scratch:DI 2 "=d"))]
6834 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6835 && (<MODE>mode != SFmode || TARGET_SINGLE_FLOAT)
6838 "&& reload_completed"
6842 emit_insn (gen_fctiwz_<mode> (operands[2], operands[1]));
6843 emit_insn (gen_stfiwx (operands[0], operands[2]));
6846 [(set_attr "length" "8")])
6848 (define_insn_and_split "fix_trunc<mode>si2_internal"
6849 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6850 (fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "<rreg>")))
6851 (clobber (match_operand:DI 2 "gpc_reg_operand" "=d"))
6852 (clobber (match_operand:DI 3 "offsettable_mem_operand" "=o"))]
6853 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS
6854 && TARGET_DOUBLE_FLOAT"
6861 gcc_assert (MEM_P (operands[3]));
6862 lowword = adjust_address (operands[3], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
6864 emit_insn (gen_fctiwz_<mode> (operands[2], operands[1]));
6865 emit_move_insn (operands[3], operands[2]);
6866 emit_move_insn (operands[0], lowword);
6869 [(set_attr "length" "16")])
6871 (define_expand "fix_trunc<mode>di2"
6872 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6873 (fix:DI (match_operand:SFDF 1 "gpc_reg_operand" "")))]
6874 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
6878 (define_insn "*fix_trunc<mode>di2_fctidz"
6879 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6880 (fix:DI (match_operand:SFDF 1 "gpc_reg_operand" "d")))]
6881 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
6882 && TARGET_FCFID && !VECTOR_UNIT_VSX_P (<MODE>mode)"
6884 [(set_attr "type" "fp")])
6886 (define_expand "fixuns_trunc<mode>si2"
6887 [(set (match_operand:SI 0 "gpc_reg_operand" "")
6888 (unsigned_fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "")))]
6890 && ((TARGET_FPRS && <TARGET_FLOAT> && TARGET_FCTIWUZ && TARGET_STFIWX)
6894 if (!<E500_CONVERT>)
6896 rtx tmp = gen_reg_rtx (DImode);
6897 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
6898 emit_insn (gen_fixuns_trunc<mode>si2_stfiwx (operands[0], operands[1],
6904 (define_insn_and_split "fixuns_trunc<mode>si2_stfiwx"
6905 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6907 (match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")))
6908 (clobber (match_operand:DI 2 "gpc_reg_operand" "=d"))
6909 (clobber (match_operand:SI 3 "indexed_or_indirect_operand" "=Z"))]
6910 "TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT> && TARGET_FCTIWUZ
6913 "&& reload_completed"
6917 emit_insn (gen_fctiwuz_<mode> (operands[2], operands[1]));
6918 if (TARGET_MFPGPR && TARGET_POWERPC64 && REG_P (operands[0])
6919 && INT_REGNO_P (REGNO (operands[0])))
6921 rtx reg = gen_lowpart (DImode, operands[0]);
6922 emit_move_insn (reg, operands[2]);
6926 emit_insn (gen_stfiwx (operands[3], operands[2]));
6927 emit_move_insn (operands[0], operands[3]);
6931 [(set_attr "length" "12")])
6933 (define_insn_and_split "*fixuns_trunc<mode>si2_mem"
6934 [(set (match_operand:SI 0 "memory_operand" "=Z")
6935 (unsigned_fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")))
6936 (clobber (match_scratch:DI 2 "=d"))]
6937 "TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT> && TARGET_FCTIWUZ
6940 "&& reload_completed"
6944 emit_insn (gen_fctiwuz_<mode> (operands[2], operands[1]));
6945 emit_insn (gen_stfiwx (operands[0], operands[2]));
6948 [(set_attr "length" "8")])
6950 (define_expand "fixuns_trunc<mode>di2"
6951 [(set (match_operand:DI 0 "register_operand" "")
6952 (unsigned_fix:DI (match_operand:SFDF 1 "register_operand" "")))]
6953 "TARGET_HARD_FLOAT && (TARGET_FCTIDUZ || VECTOR_UNIT_VSX_P (<MODE>mode))"
6956 (define_insn "*fixuns_trunc<mode>di2_fctiduz"
6957 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6958 (unsigned_fix:DI (match_operand:SFDF 1 "gpc_reg_operand" "d")))]
6959 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
6960 && TARGET_FCTIDUZ && !VECTOR_UNIT_VSX_P (<MODE>mode)"
6962 [(set_attr "type" "fp")])
6964 ; Here, we use (set (reg) (unspec:DI [(fix:SI ...)] UNSPEC_FCTIWZ))
6965 ; rather than (set (subreg:SI (reg)) (fix:SI ...))
6966 ; because the first makes it clear that operand 0 is not live
6967 ; before the instruction.
6968 (define_insn "fctiwz_<mode>"
6969 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6970 (unspec:DI [(fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d"))]
6972 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS
6973 && TARGET_DOUBLE_FLOAT"
6974 "{fcirz|fctiwz} %0,%1"
6975 [(set_attr "type" "fp")])
6977 (define_insn "fctiwuz_<mode>"
6978 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6979 (unspec:DI [(unsigned_fix:SI
6980 (match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>"))]
6982 "TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT> && TARGET_FCTIWUZ"
6984 [(set_attr "type" "fp")])
6986 ;; Only optimize (float (fix x)) -> frz if we are in fast-math mode, since
6987 ;; since the friz instruction does not truncate the value if the floating
6988 ;; point value is < LONG_MIN or > LONG_MAX.
6989 (define_insn "*friz"
6990 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6991 (float:DF (fix:DI (match_operand:DF 1 "gpc_reg_operand" "d"))))]
6992 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_POPCNTB
6993 && !VECTOR_UNIT_VSX_P (DFmode) && flag_unsafe_math_optimizations
6994 && !flag_trapping_math && TARGET_FRIZ"
6996 [(set_attr "type" "fp")])
6998 ;; No VSX equivalent to fctid
6999 (define_insn "lrint<mode>di2"
7000 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
7001 (unspec:DI [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
7003 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
7005 [(set_attr "type" "fp")])
7007 (define_expand "btrunc<mode>2"
7008 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
7009 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "")]
7011 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
7014 (define_insn "*btrunc<mode>2_fpr"
7015 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
7016 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
7018 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>
7019 && !VECTOR_UNIT_VSX_P (<MODE>mode)"
7021 [(set_attr "type" "fp")])
7023 (define_expand "ceil<mode>2"
7024 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
7025 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "")]
7027 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
7030 (define_insn "*ceil<mode>2_fpr"
7031 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
7032 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
7034 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>
7035 && !VECTOR_UNIT_VSX_P (<MODE>mode)"
7037 [(set_attr "type" "fp")])
7039 (define_expand "floor<mode>2"
7040 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
7041 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "")]
7043 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
7046 (define_insn "*floor<mode>2_fpr"
7047 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
7048 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
7050 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>
7051 && !VECTOR_UNIT_VSX_P (<MODE>mode)"
7053 [(set_attr "type" "fp")])
7055 ;; No VSX equivalent to frin
7056 (define_insn "round<mode>2"
7057 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
7058 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
7060 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
7062 [(set_attr "type" "fp")])
7064 ; An UNSPEC is used so we don't have to support SImode in FP registers.
7065 (define_insn "stfiwx"
7066 [(set (match_operand:SI 0 "memory_operand" "=Z")
7067 (unspec:SI [(match_operand:DI 1 "gpc_reg_operand" "d")]
7071 [(set_attr "type" "fpstore")])
7073 ;; If we don't have a direct conversion to single precision, don't enable this
7074 ;; conversion for 32-bit without fast math, because we don't have the insn to
7075 ;; generate the fixup swizzle to avoid double rounding problems.
7076 (define_expand "floatsisf2"
7077 [(set (match_operand:SF 0 "gpc_reg_operand" "")
7078 (float:SF (match_operand:SI 1 "nonimmediate_operand" "")))]
7079 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT
7082 && ((TARGET_FCFIDS && TARGET_LFIWAX)
7083 || (TARGET_DOUBLE_FLOAT && TARGET_FCFID
7084 && (TARGET_POWERPC64 || flag_unsafe_math_optimizations)))))"
7089 if (!REG_P (operands[1]))
7090 operands[1] = force_reg (SImode, operands[1]);
7092 else if (TARGET_FCFIDS && TARGET_LFIWAX)
7094 rs6000_expand_convert_si_to_sfdf (operands[0], operands[1], false);
7099 rtx dreg = operands[1];
7101 dreg = force_reg (SImode, dreg);
7102 dreg = convert_to_mode (DImode, dreg, false);
7103 emit_insn (gen_floatdisf2 (operands[0], dreg));
7108 (define_expand "floatdidf2"
7109 [(set (match_operand:DF 0 "gpc_reg_operand" "")
7110 (float:DF (match_operand:DI 1 "gpc_reg_operand" "")))]
7111 "TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS"
7114 (define_insn "*floatdidf2_fpr"
7115 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
7116 (float:DF (match_operand:DI 1 "gpc_reg_operand" "d")))]
7117 "TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
7118 && !VECTOR_UNIT_VSX_P (DFmode)"
7120 [(set_attr "type" "fp")])
7122 ; Allow the combiner to merge source memory operands to the conversion so that
7123 ; the optimizer/register allocator doesn't try to load the value too early in a
7124 ; GPR and then use store/load to move it to a FPR and suffer from a store-load
7125 ; hit. We will split after reload to avoid the trip through the GPRs
7127 (define_insn_and_split "*floatdidf2_mem"
7128 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
7129 (float:DF (match_operand:DI 1 "memory_operand" "m")))
7130 (clobber (match_scratch:DI 2 "=d"))]
7131 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS && TARGET_FCFID"
7133 "&& reload_completed"
7134 [(set (match_dup 2) (match_dup 1))
7135 (set (match_dup 0) (float:DF (match_dup 2)))]
7137 [(set_attr "length" "8")])
7139 (define_expand "floatunsdidf2"
7140 [(set (match_operand:DF 0 "gpc_reg_operand" "")
7142 (match_operand:DI 1 "gpc_reg_operand" "")))]
7143 "TARGET_FCFIDU || VECTOR_UNIT_VSX_P (DFmode)"
7146 (define_insn "*floatunsdidf2_fcfidu"
7147 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
7148 (unsigned_float:DF (match_operand:DI 1 "gpc_reg_operand" "d")))]
7149 "TARGET_FCFIDU && !VECTOR_UNIT_VSX_P (DFmode)"
7151 [(set_attr "type" "fp")
7152 (set_attr "length" "4")])
7154 (define_insn_and_split "*floatunsdidf2_mem"
7155 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
7156 (unsigned_float:DF (match_operand:DI 1 "memory_operand" "m")))
7157 (clobber (match_scratch:DI 2 "=d"))]
7158 "TARGET_FCFIDU || VECTOR_UNIT_VSX_P (DFmode)"
7160 "&& reload_completed"
7161 [(set (match_dup 2) (match_dup 1))
7162 (set (match_dup 0) (unsigned_float:DF (match_dup 2)))]
7164 [(set_attr "length" "8")])
7166 (define_expand "floatdisf2"
7167 [(set (match_operand:SF 0 "gpc_reg_operand" "")
7168 (float:SF (match_operand:DI 1 "gpc_reg_operand" "")))]
7169 "TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
7170 && (TARGET_FCFIDS || TARGET_POWERPC64 || flag_unsafe_math_optimizations)"
7175 rtx val = operands[1];
7176 if (!flag_unsafe_math_optimizations)
7178 rtx label = gen_label_rtx ();
7179 val = gen_reg_rtx (DImode);
7180 emit_insn (gen_floatdisf2_internal2 (val, operands[1], label));
7183 emit_insn (gen_floatdisf2_internal1 (operands[0], val));
7188 (define_insn "floatdisf2_fcfids"
7189 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
7190 (float:SF (match_operand:DI 1 "gpc_reg_operand" "d")))]
7191 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
7192 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDS"
7194 [(set_attr "type" "fp")])
7196 (define_insn_and_split "*floatdisf2_mem"
7197 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
7198 (float:SF (match_operand:DI 1 "memory_operand" "m")))
7199 (clobber (match_scratch:DI 2 "=f"))]
7200 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
7201 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDS"
7203 "&& reload_completed"
7207 emit_move_insn (operands[2], operands[1]);
7208 emit_insn (gen_floatdisf2_fcfids (operands[0], operands[2]));
7211 [(set_attr "length" "8")])
7213 ;; This is not IEEE compliant if rounding mode is "round to nearest".
7214 ;; If the DI->DF conversion is inexact, then it's possible to suffer
7215 ;; from double rounding.
7216 (define_insn_and_split "floatdisf2_internal1"
7217 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
7218 (float:SF (match_operand:DI 1 "gpc_reg_operand" "d")))
7219 (clobber (match_scratch:DF 2 "=d"))]
7220 "TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
7222 "&& reload_completed"
7224 (float:DF (match_dup 1)))
7226 (float_truncate:SF (match_dup 2)))]
7229 ;; Twiddles bits to avoid double rounding.
7230 ;; Bits that might be truncated when converting to DFmode are replaced
7231 ;; by a bit that won't be lost at that stage, but is below the SFmode
7232 ;; rounding position.
7233 (define_expand "floatdisf2_internal2"
7234 [(set (match_dup 3) (ashiftrt:DI (match_operand:DI 1 "" "")
7236 (parallel [(set (match_operand:DI 0 "" "") (and:DI (match_dup 1)
7238 (clobber (scratch:CC))])
7239 (set (match_dup 3) (plus:DI (match_dup 3)
7241 (set (match_dup 0) (plus:DI (match_dup 0)
7243 (set (match_dup 4) (compare:CCUNS (match_dup 3)
7245 (set (match_dup 0) (ior:DI (match_dup 0)
7247 (parallel [(set (match_dup 0) (and:DI (match_dup 0)
7249 (clobber (scratch:CC))])
7250 (set (pc) (if_then_else (geu (match_dup 4) (const_int 0))
7251 (label_ref (match_operand:DI 2 "" ""))
7253 (set (match_dup 0) (match_dup 1))]
7254 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
7257 operands[3] = gen_reg_rtx (DImode);
7258 operands[4] = gen_reg_rtx (CCUNSmode);
7261 (define_expand "floatunsdisf2"
7262 [(set (match_operand:SF 0 "gpc_reg_operand" "")
7263 (unsigned_float:SF (match_operand:DI 1 "gpc_reg_operand" "")))]
7264 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
7265 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDUS"
7268 (define_insn "floatunsdisf2_fcfidus"
7269 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
7270 (unsigned_float:SF (match_operand:DI 1 "gpc_reg_operand" "d")))]
7271 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
7272 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDUS"
7274 [(set_attr "type" "fp")])
7276 (define_insn_and_split "*floatunsdisf2_mem"
7277 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
7278 (unsigned_float:SF (match_operand:DI 1 "memory_operand" "m")))
7279 (clobber (match_scratch:DI 2 "=f"))]
7280 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
7281 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDUS"
7283 "&& reload_completed"
7287 emit_move_insn (operands[2], operands[1]);
7288 emit_insn (gen_floatunsdisf2_fcfidus (operands[0], operands[2]));
7291 [(set_attr "length" "8")])
7293 ;; Define the DImode operations that can be done in a small number
7294 ;; of instructions. The & constraints are to prevent the register
7295 ;; allocator from allocating registers that overlap with the inputs
7296 ;; (for example, having an input in 7,8 and an output in 6,7). We
7297 ;; also allow for the output being the same as one of the inputs.
7299 (define_insn "*adddi3_noppc64"
7300 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r")
7301 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,0,0")
7302 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I")))]
7303 "! TARGET_POWERPC64"
7306 if (WORDS_BIG_ENDIAN)
7307 return (GET_CODE (operands[2])) != CONST_INT
7308 ? \"{a|addc} %L0,%L1,%L2\;{ae|adde} %0,%1,%2\"
7309 : \"{ai|addic} %L0,%L1,%2\;{a%G2e|add%G2e} %0,%1\";
7311 return (GET_CODE (operands[2])) != CONST_INT
7312 ? \"{a|addc} %0,%1,%2\;{ae|adde} %L0,%L1,%L2\"
7313 : \"{ai|addic} %0,%1,%2\;{a%G2e|add%G2e} %L0,%L1\";
7315 [(set_attr "type" "two")
7316 (set_attr "length" "8")])
7318 (define_insn "*subdi3_noppc64"
7319 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r,r")
7320 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I,0,r,I")
7321 (match_operand:DI 2 "gpc_reg_operand" "r,r,r,0,0")))]
7322 "! TARGET_POWERPC64"
7325 if (WORDS_BIG_ENDIAN)
7326 return (GET_CODE (operands[1]) != CONST_INT)
7327 ? \"{sf|subfc} %L0,%L2,%L1\;{sfe|subfe} %0,%2,%1\"
7328 : \"{sfi|subfic} %L0,%L2,%1\;{sf%G1e|subf%G1e} %0,%2\";
7330 return (GET_CODE (operands[1]) != CONST_INT)
7331 ? \"{sf|subfc} %0,%2,%1\;{sfe|subfe} %L0,%L2,%L1\"
7332 : \"{sfi|subfic} %0,%2,%1\;{sf%G1e|subf%G1e} %L0,%L2\";
7334 [(set_attr "type" "two")
7335 (set_attr "length" "8")])
7337 (define_insn "*negdi2_noppc64"
7338 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
7339 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))]
7340 "! TARGET_POWERPC64"
7343 return (WORDS_BIG_ENDIAN)
7344 ? \"{sfi|subfic} %L0,%L1,0\;{sfze|subfze} %0,%1\"
7345 : \"{sfi|subfic} %0,%1,0\;{sfze|subfze} %L0,%L1\";
7347 [(set_attr "type" "two")
7348 (set_attr "length" "8")])
7350 (define_expand "mulsidi3"
7351 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7352 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
7353 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
7354 "! TARGET_POWERPC64"
7357 if (! TARGET_POWER && ! TARGET_POWERPC)
7359 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
7360 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
7361 emit_insn (gen_mull_call ());
7362 if (WORDS_BIG_ENDIAN)
7363 emit_move_insn (operands[0], gen_rtx_REG (DImode, 3));
7366 emit_move_insn (operand_subword (operands[0], 0, 0, DImode),
7367 gen_rtx_REG (SImode, 3));
7368 emit_move_insn (operand_subword (operands[0], 1, 0, DImode),
7369 gen_rtx_REG (SImode, 4));
7373 else if (TARGET_POWER)
7375 emit_insn (gen_mulsidi3_mq (operands[0], operands[1], operands[2]));
7380 (define_insn "mulsidi3_mq"
7381 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7382 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
7383 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
7384 (clobber (match_scratch:SI 3 "=q"))]
7386 "mul %0,%1,%2\;mfmq %L0"
7387 [(set_attr "type" "imul")
7388 (set_attr "length" "8")])
7390 (define_insn "*mulsidi3_no_mq"
7391 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
7392 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
7393 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
7394 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
7397 return (WORDS_BIG_ENDIAN)
7398 ? \"mulhw %0,%1,%2\;mullw %L0,%1,%2\"
7399 : \"mulhw %L0,%1,%2\;mullw %0,%1,%2\";
7401 [(set_attr "type" "imul")
7402 (set_attr "length" "8")])
7405 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7406 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
7407 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
7408 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
7411 (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
7412 (sign_extend:DI (match_dup 2)))
7415 (mult:SI (match_dup 1)
7419 int endian = (WORDS_BIG_ENDIAN == 0);
7420 operands[3] = operand_subword (operands[0], endian, 0, DImode);
7421 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
7424 (define_expand "umulsidi3"
7425 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7426 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
7427 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
7428 "TARGET_POWERPC && ! TARGET_POWERPC64"
7433 emit_insn (gen_umulsidi3_mq (operands[0], operands[1], operands[2]));
7438 (define_insn "umulsidi3_mq"
7439 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
7440 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
7441 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
7442 (clobber (match_scratch:SI 3 "=q"))]
7443 "TARGET_POWERPC && TARGET_POWER"
7446 return (WORDS_BIG_ENDIAN)
7447 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
7448 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
7450 [(set_attr "type" "imul")
7451 (set_attr "length" "8")])
7453 (define_insn "*umulsidi3_no_mq"
7454 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
7455 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
7456 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
7457 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
7460 return (WORDS_BIG_ENDIAN)
7461 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
7462 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
7464 [(set_attr "type" "imul")
7465 (set_attr "length" "8")])
7468 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7469 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
7470 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
7471 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
7474 (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
7475 (zero_extend:DI (match_dup 2)))
7478 (mult:SI (match_dup 1)
7482 int endian = (WORDS_BIG_ENDIAN == 0);
7483 operands[3] = operand_subword (operands[0], endian, 0, DImode);
7484 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
7487 (define_expand "smulsi3_highpart"
7488 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7490 (lshiftrt:DI (mult:DI (sign_extend:DI
7491 (match_operand:SI 1 "gpc_reg_operand" ""))
7493 (match_operand:SI 2 "gpc_reg_operand" "")))
7498 if (! TARGET_POWER && ! TARGET_POWERPC)
7500 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
7501 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
7502 emit_insn (gen_mulh_call ());
7503 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
7506 else if (TARGET_POWER)
7508 emit_insn (gen_smulsi3_highpart_mq (operands[0], operands[1], operands[2]));
7513 (define_insn "smulsi3_highpart_mq"
7514 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7516 (lshiftrt:DI (mult:DI (sign_extend:DI
7517 (match_operand:SI 1 "gpc_reg_operand" "%r"))
7519 (match_operand:SI 2 "gpc_reg_operand" "r")))
7521 (clobber (match_scratch:SI 3 "=q"))]
7524 [(set_attr "type" "imul")])
7526 (define_insn "*smulsi3_highpart_no_mq"
7527 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7529 (lshiftrt:DI (mult:DI (sign_extend:DI
7530 (match_operand:SI 1 "gpc_reg_operand" "%r"))
7532 (match_operand:SI 2 "gpc_reg_operand" "r")))
7534 "TARGET_POWERPC && ! TARGET_POWER"
7536 [(set_attr "type" "imul")])
7538 (define_expand "umulsi3_highpart"
7539 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7541 (lshiftrt:DI (mult:DI (zero_extend:DI
7542 (match_operand:SI 1 "gpc_reg_operand" ""))
7544 (match_operand:SI 2 "gpc_reg_operand" "")))
7551 emit_insn (gen_umulsi3_highpart_mq (operands[0], operands[1], operands[2]));
7556 (define_insn "umulsi3_highpart_mq"
7557 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7559 (lshiftrt:DI (mult:DI (zero_extend:DI
7560 (match_operand:SI 1 "gpc_reg_operand" "%r"))
7562 (match_operand:SI 2 "gpc_reg_operand" "r")))
7564 (clobber (match_scratch:SI 3 "=q"))]
7565 "TARGET_POWERPC && TARGET_POWER"
7567 [(set_attr "type" "imul")])
7569 (define_insn "*umulsi3_highpart_no_mq"
7570 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7572 (lshiftrt:DI (mult:DI (zero_extend:DI
7573 (match_operand:SI 1 "gpc_reg_operand" "%r"))
7575 (match_operand:SI 2 "gpc_reg_operand" "r")))
7577 "TARGET_POWERPC && ! TARGET_POWER"
7579 [(set_attr "type" "imul")])
7581 ;; If operands 0 and 2 are in the same register, we have a problem. But
7582 ;; operands 0 and 1 (the usual case) can be in the same register. That's
7583 ;; why we have the strange constraints below.
7584 (define_insn "ashldi3_power"
7585 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
7586 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
7587 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
7588 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
7591 {sli|slwi} %0,%L1,%h2\;{cal %L0,0(0)|li %L0,0}
7592 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
7593 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
7594 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2"
7595 [(set_attr "length" "8")])
7597 (define_insn "lshrdi3_power"
7598 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
7599 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
7600 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
7601 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
7604 {s%A2i|s%A2wi} %L0,%1,%h2\;{cal %0,0(0)|li %0,0}
7605 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
7606 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
7607 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2"
7608 [(set_attr "length" "8")])
7610 ;; Shift by a variable amount is too complex to be worth open-coding. We
7611 ;; just handle shifts by constants.
7612 (define_insn "ashrdi3_power"
7613 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
7614 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7615 (match_operand:SI 2 "const_int_operand" "M,i")))
7616 (clobber (match_scratch:SI 3 "=X,q"))]
7619 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
7620 sraiq %0,%1,%h2\;srliq %L0,%L1,%h2"
7621 [(set_attr "type" "shift")
7622 (set_attr "length" "8")])
7624 (define_insn "ashrdi3_no_power"
7625 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
7626 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7627 (match_operand:SI 2 "const_int_operand" "M,i")))]
7628 "TARGET_32BIT && !TARGET_POWERPC64 && !TARGET_POWER && WORDS_BIG_ENDIAN"
7630 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
7631 {sri|srwi} %L0,%L1,%h2\;insrwi %L0,%1,%h2,0\;{srai|srawi} %0,%1,%h2"
7632 [(set_attr "type" "two,three")
7633 (set_attr "length" "8,12")])
7635 (define_insn "*ashrdisi3_noppc64"
7636 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7637 (subreg:SI (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7638 (const_int 32)) 4))]
7639 "TARGET_32BIT && !TARGET_POWERPC64"
7642 if (REGNO (operands[0]) == REGNO (operands[1]))
7645 return \"mr %0,%1\";
7647 [(set_attr "length" "4")])
7650 ;; PowerPC64 DImode operations.
7652 (define_expand "absdi2"
7653 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7654 (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))]
7659 emit_insn (gen_absdi2_isel (operands[0], operands[1]));
7661 emit_insn (gen_absdi2_internal (operands[0], operands[1]));
7665 (define_insn_and_split "absdi2_internal"
7666 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
7667 (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))
7668 (clobber (match_scratch:DI 2 "=&r,&r"))]
7669 "TARGET_POWERPC64 && !TARGET_ISEL"
7671 "&& reload_completed"
7672 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
7673 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
7674 (set (match_dup 0) (minus:DI (match_dup 0) (match_dup 2)))]
7677 (define_insn_and_split "*nabsdi2"
7678 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
7679 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0"))))
7680 (clobber (match_scratch:DI 2 "=&r,&r"))]
7681 "TARGET_POWERPC64 && !TARGET_ISEL"
7683 "&& reload_completed"
7684 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
7685 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
7686 (set (match_dup 0) (minus:DI (match_dup 2) (match_dup 0)))]
7689 (define_insn "muldi3"
7690 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7691 (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
7692 (match_operand:DI 2 "reg_or_short_operand" "r,I")))]
7698 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
7699 (const_string "imul3")
7700 (match_operand:SI 2 "short_cint_operand" "")
7701 (const_string "imul2")]
7702 (const_string "lmul")))])
7704 (define_insn "*muldi3_internal1"
7705 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7706 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
7707 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
7709 (clobber (match_scratch:DI 3 "=r,r"))]
7714 [(set_attr "type" "lmul_compare")
7715 (set_attr "length" "4,8")])
7718 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7719 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
7720 (match_operand:DI 2 "gpc_reg_operand" ""))
7722 (clobber (match_scratch:DI 3 ""))]
7723 "TARGET_POWERPC64 && reload_completed"
7725 (mult:DI (match_dup 1) (match_dup 2)))
7727 (compare:CC (match_dup 3)
7731 (define_insn "*muldi3_internal2"
7732 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7733 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
7734 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
7736 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7737 (mult:DI (match_dup 1) (match_dup 2)))]
7742 [(set_attr "type" "lmul_compare")
7743 (set_attr "length" "4,8")])
7746 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7747 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
7748 (match_operand:DI 2 "gpc_reg_operand" ""))
7750 (set (match_operand:DI 0 "gpc_reg_operand" "")
7751 (mult:DI (match_dup 1) (match_dup 2)))]
7752 "TARGET_POWERPC64 && reload_completed"
7754 (mult:DI (match_dup 1) (match_dup 2)))
7756 (compare:CC (match_dup 0)
7760 (define_insn "smuldi3_highpart"
7761 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7763 (lshiftrt:TI (mult:TI (sign_extend:TI
7764 (match_operand:DI 1 "gpc_reg_operand" "%r"))
7766 (match_operand:DI 2 "gpc_reg_operand" "r")))
7770 [(set_attr "type" "lmul")])
7772 (define_insn "umuldi3_highpart"
7773 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7775 (lshiftrt:TI (mult:TI (zero_extend:TI
7776 (match_operand:DI 1 "gpc_reg_operand" "%r"))
7778 (match_operand:DI 2 "gpc_reg_operand" "r")))
7782 [(set_attr "type" "lmul")])
7784 (define_insn "rotldi3"
7785 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7786 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7787 (match_operand:DI 2 "reg_or_cint_operand" "r,i")))]
7792 [(set_attr "type" "var_shift_rotate,integer")])
7794 (define_insn "*rotldi3_internal2"
7795 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7796 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7797 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
7799 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7806 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7807 (set_attr "length" "4,4,8,8")])
7810 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7811 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7812 (match_operand:DI 2 "reg_or_cint_operand" ""))
7814 (clobber (match_scratch:DI 3 ""))]
7815 "TARGET_POWERPC64 && reload_completed"
7817 (rotate:DI (match_dup 1) (match_dup 2)))
7819 (compare:CC (match_dup 3)
7823 (define_insn "*rotldi3_internal3"
7824 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7825 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7826 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
7828 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7829 (rotate:DI (match_dup 1) (match_dup 2)))]
7836 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7837 (set_attr "length" "4,4,8,8")])
7840 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7841 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7842 (match_operand:DI 2 "reg_or_cint_operand" ""))
7844 (set (match_operand:DI 0 "gpc_reg_operand" "")
7845 (rotate:DI (match_dup 1) (match_dup 2)))]
7846 "TARGET_POWERPC64 && reload_completed"
7848 (rotate:DI (match_dup 1) (match_dup 2)))
7850 (compare:CC (match_dup 0)
7854 (define_insn "*rotldi3_internal4"
7855 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7856 (and:DI (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7857 (match_operand:DI 2 "reg_or_cint_operand" "r,i"))
7858 (match_operand:DI 3 "mask64_operand" "n,n")))]
7861 rldc%B3 %0,%1,%2,%S3
7862 rldic%B3 %0,%1,%H2,%S3"
7863 [(set_attr "type" "var_shift_rotate,integer")])
7865 (define_insn "*rotldi3_internal5"
7866 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7868 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7869 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
7870 (match_operand:DI 3 "mask64_operand" "n,n,n,n"))
7872 (clobber (match_scratch:DI 4 "=r,r,r,r"))]
7875 rldc%B3. %4,%1,%2,%S3
7876 rldic%B3. %4,%1,%H2,%S3
7879 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7880 (set_attr "length" "4,4,8,8")])
7883 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7885 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7886 (match_operand:DI 2 "reg_or_cint_operand" ""))
7887 (match_operand:DI 3 "mask64_operand" ""))
7889 (clobber (match_scratch:DI 4 ""))]
7890 "TARGET_POWERPC64 && reload_completed"
7892 (and:DI (rotate:DI (match_dup 1)
7896 (compare:CC (match_dup 4)
7900 (define_insn "*rotldi3_internal6"
7901 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
7903 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7904 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
7905 (match_operand:DI 3 "mask64_operand" "n,n,n,n"))
7907 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7908 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7911 rldc%B3. %0,%1,%2,%S3
7912 rldic%B3. %0,%1,%H2,%S3
7915 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7916 (set_attr "length" "4,4,8,8")])
7919 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
7921 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7922 (match_operand:DI 2 "reg_or_cint_operand" ""))
7923 (match_operand:DI 3 "mask64_operand" ""))
7925 (set (match_operand:DI 0 "gpc_reg_operand" "")
7926 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7927 "TARGET_POWERPC64 && reload_completed"
7929 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
7931 (compare:CC (match_dup 0)
7935 (define_insn "*rotldi3_internal7"
7936 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7939 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7940 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
7944 rldicl %0,%1,%H2,56"
7945 [(set_attr "type" "var_shift_rotate,integer")])
7947 (define_insn "*rotldi3_internal8"
7948 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7949 (compare:CC (zero_extend:DI
7951 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7952 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7954 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7958 rldicl. %3,%1,%H2,56
7961 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7962 (set_attr "length" "4,4,8,8")])
7965 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7966 (compare:CC (zero_extend:DI
7968 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7969 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7971 (clobber (match_scratch:DI 3 ""))]
7972 "TARGET_POWERPC64 && reload_completed"
7974 (zero_extend:DI (subreg:QI
7975 (rotate:DI (match_dup 1)
7978 (compare:CC (match_dup 3)
7982 (define_insn "*rotldi3_internal9"
7983 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7984 (compare:CC (zero_extend:DI
7986 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7987 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7989 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7990 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7994 rldicl. %0,%1,%H2,56
7997 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7998 (set_attr "length" "4,4,8,8")])
8001 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8002 (compare:CC (zero_extend:DI
8004 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
8005 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
8007 (set (match_operand:DI 0 "gpc_reg_operand" "")
8008 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
8009 "TARGET_POWERPC64 && reload_completed"
8011 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
8013 (compare:CC (match_dup 0)
8017 (define_insn "*rotldi3_internal10"
8018 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8021 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
8022 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
8026 rldicl %0,%1,%H2,48"
8027 [(set_attr "type" "var_shift_rotate,integer")])
8029 (define_insn "*rotldi3_internal11"
8030 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
8031 (compare:CC (zero_extend:DI
8033 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8034 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
8036 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
8040 rldicl. %3,%1,%H2,48
8043 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8044 (set_attr "length" "4,4,8,8")])
8047 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8048 (compare:CC (zero_extend:DI
8050 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
8051 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
8053 (clobber (match_scratch:DI 3 ""))]
8054 "TARGET_POWERPC64 && reload_completed"
8056 (zero_extend:DI (subreg:HI
8057 (rotate:DI (match_dup 1)
8060 (compare:CC (match_dup 3)
8064 (define_insn "*rotldi3_internal12"
8065 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
8066 (compare:CC (zero_extend:DI
8068 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8069 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
8071 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
8072 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
8076 rldicl. %0,%1,%H2,48
8079 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8080 (set_attr "length" "4,4,8,8")])
8083 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8084 (compare:CC (zero_extend:DI
8086 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
8087 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
8089 (set (match_operand:DI 0 "gpc_reg_operand" "")
8090 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
8091 "TARGET_POWERPC64 && reload_completed"
8093 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
8095 (compare:CC (match_dup 0)
8099 (define_insn "*rotldi3_internal13"
8100 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8103 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
8104 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
8108 rldicl %0,%1,%H2,32"
8109 [(set_attr "type" "var_shift_rotate,integer")])
8111 (define_insn "*rotldi3_internal14"
8112 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
8113 (compare:CC (zero_extend:DI
8115 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8116 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
8118 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
8122 rldicl. %3,%1,%H2,32
8125 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8126 (set_attr "length" "4,4,8,8")])
8129 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8130 (compare:CC (zero_extend:DI
8132 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
8133 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
8135 (clobber (match_scratch:DI 3 ""))]
8136 "TARGET_POWERPC64 && reload_completed"
8138 (zero_extend:DI (subreg:SI
8139 (rotate:DI (match_dup 1)
8142 (compare:CC (match_dup 3)
8146 (define_insn "*rotldi3_internal15"
8147 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
8148 (compare:CC (zero_extend:DI
8150 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8151 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
8153 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
8154 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
8158 rldicl. %0,%1,%H2,32
8161 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8162 (set_attr "length" "4,4,8,8")])
8165 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8166 (compare:CC (zero_extend:DI
8168 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
8169 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
8171 (set (match_operand:DI 0 "gpc_reg_operand" "")
8172 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
8173 "TARGET_POWERPC64 && reload_completed"
8175 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
8177 (compare:CC (match_dup 0)
8181 (define_expand "ashldi3"
8182 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8183 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
8184 (match_operand:SI 2 "reg_or_cint_operand" "")))]
8185 "TARGET_POWERPC64 || TARGET_POWER"
8188 if (TARGET_POWERPC64)
8190 else if (TARGET_POWER)
8192 emit_insn (gen_ashldi3_power (operands[0], operands[1], operands[2]));
8199 (define_insn "*ashldi3_internal1"
8200 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8201 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
8202 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
8207 [(set_attr "type" "var_shift_rotate,shift")])
8209 (define_insn "*ashldi3_internal2"
8210 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
8211 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8212 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
8214 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
8221 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8222 (set_attr "length" "4,4,8,8")])
8225 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
8226 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
8227 (match_operand:SI 2 "reg_or_cint_operand" ""))
8229 (clobber (match_scratch:DI 3 ""))]
8230 "TARGET_POWERPC64 && reload_completed"
8232 (ashift:DI (match_dup 1) (match_dup 2)))
8234 (compare:CC (match_dup 3)
8238 (define_insn "*ashldi3_internal3"
8239 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
8240 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8241 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
8243 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
8244 (ashift:DI (match_dup 1) (match_dup 2)))]
8251 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8252 (set_attr "length" "4,4,8,8")])
8255 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
8256 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
8257 (match_operand:SI 2 "reg_or_cint_operand" ""))
8259 (set (match_operand:DI 0 "gpc_reg_operand" "")
8260 (ashift:DI (match_dup 1) (match_dup 2)))]
8261 "TARGET_POWERPC64 && reload_completed"
8263 (ashift:DI (match_dup 1) (match_dup 2)))
8265 (compare:CC (match_dup 0)
8269 (define_insn "*ashldi3_internal4"
8270 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
8271 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
8272 (match_operand:SI 2 "const_int_operand" "i"))
8273 (match_operand:DI 3 "const_int_operand" "n")))]
8274 "TARGET_POWERPC64 && includes_rldic_lshift_p (operands[2], operands[3])"
8275 "rldic %0,%1,%H2,%W3")
8277 (define_insn "ashldi3_internal5"
8278 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
8280 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
8281 (match_operand:SI 2 "const_int_operand" "i,i"))
8282 (match_operand:DI 3 "const_int_operand" "n,n"))
8284 (clobber (match_scratch:DI 4 "=r,r"))]
8285 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
8287 rldic. %4,%1,%H2,%W3
8289 [(set_attr "type" "compare")
8290 (set_attr "length" "4,8")])
8293 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8295 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
8296 (match_operand:SI 2 "const_int_operand" ""))
8297 (match_operand:DI 3 "const_int_operand" ""))
8299 (clobber (match_scratch:DI 4 ""))]
8300 "TARGET_POWERPC64 && reload_completed
8301 && includes_rldic_lshift_p (operands[2], operands[3])"
8303 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
8306 (compare:CC (match_dup 4)
8310 (define_insn "*ashldi3_internal6"
8311 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
8313 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
8314 (match_operand:SI 2 "const_int_operand" "i,i"))
8315 (match_operand:DI 3 "const_int_operand" "n,n"))
8317 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8318 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
8319 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
8321 rldic. %0,%1,%H2,%W3
8323 [(set_attr "type" "compare")
8324 (set_attr "length" "4,8")])
8327 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
8329 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
8330 (match_operand:SI 2 "const_int_operand" ""))
8331 (match_operand:DI 3 "const_int_operand" ""))
8333 (set (match_operand:DI 0 "gpc_reg_operand" "")
8334 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
8335 "TARGET_POWERPC64 && reload_completed
8336 && includes_rldic_lshift_p (operands[2], operands[3])"
8338 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
8341 (compare:CC (match_dup 0)
8345 (define_insn "*ashldi3_internal7"
8346 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
8347 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
8348 (match_operand:SI 2 "const_int_operand" "i"))
8349 (match_operand:DI 3 "mask64_operand" "n")))]
8350 "TARGET_POWERPC64 && includes_rldicr_lshift_p (operands[2], operands[3])"
8351 "rldicr %0,%1,%H2,%S3")
8353 (define_insn "ashldi3_internal8"
8354 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
8356 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
8357 (match_operand:SI 2 "const_int_operand" "i,i"))
8358 (match_operand:DI 3 "mask64_operand" "n,n"))
8360 (clobber (match_scratch:DI 4 "=r,r"))]
8361 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
8363 rldicr. %4,%1,%H2,%S3
8365 [(set_attr "type" "compare")
8366 (set_attr "length" "4,8")])
8369 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8371 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
8372 (match_operand:SI 2 "const_int_operand" ""))
8373 (match_operand:DI 3 "mask64_operand" ""))
8375 (clobber (match_scratch:DI 4 ""))]
8376 "TARGET_POWERPC64 && reload_completed
8377 && includes_rldicr_lshift_p (operands[2], operands[3])"
8379 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
8382 (compare:CC (match_dup 4)
8386 (define_insn "*ashldi3_internal9"
8387 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
8389 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
8390 (match_operand:SI 2 "const_int_operand" "i,i"))
8391 (match_operand:DI 3 "mask64_operand" "n,n"))
8393 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8394 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
8395 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
8397 rldicr. %0,%1,%H2,%S3
8399 [(set_attr "type" "compare")
8400 (set_attr "length" "4,8")])
8403 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
8405 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
8406 (match_operand:SI 2 "const_int_operand" ""))
8407 (match_operand:DI 3 "mask64_operand" ""))
8409 (set (match_operand:DI 0 "gpc_reg_operand" "")
8410 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
8411 "TARGET_POWERPC64 && reload_completed
8412 && includes_rldicr_lshift_p (operands[2], operands[3])"
8414 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
8417 (compare:CC (match_dup 0)
8421 (define_expand "lshrdi3"
8422 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8423 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
8424 (match_operand:SI 2 "reg_or_cint_operand" "")))]
8425 "TARGET_POWERPC64 || TARGET_POWER"
8428 if (TARGET_POWERPC64)
8430 else if (TARGET_POWER)
8432 emit_insn (gen_lshrdi3_power (operands[0], operands[1], operands[2]));
8439 (define_insn "*lshrdi3_internal1"
8440 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8441 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
8442 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
8447 [(set_attr "type" "var_shift_rotate,shift")])
8449 (define_insn "*lshrdi3_internal2"
8450 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
8451 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8452 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
8454 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
8461 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8462 (set_attr "length" "4,4,8,8")])
8465 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8466 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
8467 (match_operand:SI 2 "reg_or_cint_operand" ""))
8469 (clobber (match_scratch:DI 3 ""))]
8470 "TARGET_POWERPC64 && reload_completed"
8472 (lshiftrt:DI (match_dup 1) (match_dup 2)))
8474 (compare:CC (match_dup 3)
8478 (define_insn "*lshrdi3_internal3"
8479 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
8480 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8481 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
8483 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
8484 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
8491 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8492 (set_attr "length" "4,4,8,8")])
8495 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8496 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
8497 (match_operand:SI 2 "reg_or_cint_operand" ""))
8499 (set (match_operand:DI 0 "gpc_reg_operand" "")
8500 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
8501 "TARGET_POWERPC64 && reload_completed"
8503 (lshiftrt:DI (match_dup 1) (match_dup 2)))
8505 (compare:CC (match_dup 0)
8509 (define_expand "ashrdi3"
8510 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8511 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
8512 (match_operand:SI 2 "reg_or_cint_operand" "")))]
8516 if (TARGET_POWERPC64)
8518 else if (TARGET_POWER && GET_CODE (operands[2]) == CONST_INT)
8520 emit_insn (gen_ashrdi3_power (operands[0], operands[1], operands[2]));
8523 else if (TARGET_32BIT && GET_CODE (operands[2]) == CONST_INT
8524 && WORDS_BIG_ENDIAN)
8526 emit_insn (gen_ashrdi3_no_power (operands[0], operands[1], operands[2]));
8533 (define_insn "*ashrdi3_internal1"
8534 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8535 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
8536 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
8541 [(set_attr "type" "var_shift_rotate,shift")])
8543 (define_insn "*ashrdi3_internal2"
8544 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
8545 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8546 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
8548 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
8555 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8556 (set_attr "length" "4,4,8,8")])
8559 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
8560 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
8561 (match_operand:SI 2 "reg_or_cint_operand" ""))
8563 (clobber (match_scratch:DI 3 ""))]
8564 "TARGET_POWERPC64 && reload_completed"
8566 (ashiftrt:DI (match_dup 1) (match_dup 2)))
8568 (compare:CC (match_dup 3)
8572 (define_insn "*ashrdi3_internal3"
8573 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
8574 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8575 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
8577 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
8578 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
8585 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8586 (set_attr "length" "4,4,8,8")])
8589 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
8590 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
8591 (match_operand:SI 2 "reg_or_cint_operand" ""))
8593 (set (match_operand:DI 0 "gpc_reg_operand" "")
8594 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
8595 "TARGET_POWERPC64 && reload_completed"
8597 (ashiftrt:DI (match_dup 1) (match_dup 2)))
8599 (compare:CC (match_dup 0)
8603 (define_expand "anddi3"
8605 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8606 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8607 (match_operand:DI 2 "and64_2_operand" "")))
8608 (clobber (match_scratch:CC 3 ""))])]
8612 (define_insn "anddi3_mc"
8613 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
8614 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r")
8615 (match_operand:DI 2 "and64_2_operand" "?r,S,T,K,J,t")))
8616 (clobber (match_scratch:CC 3 "=X,X,X,x,x,X"))]
8617 "TARGET_POWERPC64 && rs6000_gen_cell_microcode"
8620 rldic%B2 %0,%1,0,%S2
8621 rlwinm %0,%1,0,%m2,%M2
8625 [(set_attr "type" "*,*,*,fast_compare,fast_compare,*")
8626 (set_attr "length" "4,4,4,4,4,8")])
8628 (define_insn "anddi3_nomc"
8629 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
8630 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r")
8631 (match_operand:DI 2 "and64_2_operand" "?r,S,T,t")))
8632 (clobber (match_scratch:CC 3 "=X,X,X,X"))]
8633 "TARGET_POWERPC64 && !rs6000_gen_cell_microcode"
8636 rldic%B2 %0,%1,0,%S2
8637 rlwinm %0,%1,0,%m2,%M2
8639 [(set_attr "length" "4,4,4,8")])
8642 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8643 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8644 (match_operand:DI 2 "mask64_2_operand" "")))
8645 (clobber (match_scratch:CC 3 ""))]
8647 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
8648 && !mask_operand (operands[2], DImode)
8649 && !mask64_operand (operands[2], DImode)"
8651 (and:DI (rotate:DI (match_dup 1)
8655 (and:DI (rotate:DI (match_dup 0)
8659 build_mask64_2_operands (operands[2], &operands[4]);
8662 (define_insn "*anddi3_internal2_mc"
8663 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,x,?y,?y,?y,??y,??y,?y")
8664 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r,r,r")
8665 (match_operand:DI 2 "and64_2_operand" "r,S,T,K,J,t,r,S,T,K,J,t"))
8667 (clobber (match_scratch:DI 3 "=r,r,r,r,r,r,r,r,r,r,r,r"))
8668 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,X,X,x,x,X"))]
8669 "TARGET_64BIT && rs6000_gen_cell_microcode"
8672 rldic%B2. %3,%1,0,%S2
8673 rlwinm. %3,%1,0,%m2,%M2
8683 [(set_attr "type" "fast_compare,compare,delayed_compare,fast_compare,\
8684 fast_compare,compare,compare,compare,compare,compare,\
8686 (set_attr "length" "4,4,4,4,4,8,8,8,8,8,8,12")])
8689 [(set (match_operand:CC 0 "cc_reg_operand" "")
8690 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8691 (match_operand:DI 2 "mask64_2_operand" ""))
8693 (clobber (match_scratch:DI 3 ""))
8694 (clobber (match_scratch:CC 4 ""))]
8695 "TARGET_64BIT && reload_completed
8696 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
8697 && !mask_operand (operands[2], DImode)
8698 && !mask64_operand (operands[2], DImode)"
8700 (and:DI (rotate:DI (match_dup 1)
8703 (parallel [(set (match_dup 0)
8704 (compare:CC (and:DI (rotate:DI (match_dup 3)
8708 (clobber (match_dup 3))])]
8711 build_mask64_2_operands (operands[2], &operands[5]);
8714 (define_insn "*anddi3_internal3_mc"
8715 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,x,x,?y,?y,?y,??y,??y,?y")
8716 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r,r,r")
8717 (match_operand:DI 2 "and64_2_operand" "r,S,T,K,J,t,r,S,T,K,J,t"))
8719 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r,r,r")
8720 (and:DI (match_dup 1) (match_dup 2)))
8721 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,X,X,x,x,X"))]
8722 "TARGET_64BIT && rs6000_gen_cell_microcode"
8725 rldic%B2. %0,%1,0,%S2
8726 rlwinm. %0,%1,0,%m2,%M2
8736 [(set_attr "type" "fast_compare,compare,delayed_compare,fast_compare,\
8737 fast_compare,compare,compare,compare,compare,compare,\
8739 (set_attr "length" "4,4,4,4,4,8,8,8,8,8,8,12")])
8742 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8743 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8744 (match_operand:DI 2 "and64_2_operand" ""))
8746 (set (match_operand:DI 0 "gpc_reg_operand" "")
8747 (and:DI (match_dup 1) (match_dup 2)))
8748 (clobber (match_scratch:CC 4 ""))]
8749 "TARGET_64BIT && reload_completed"
8750 [(parallel [(set (match_dup 0)
8751 (and:DI (match_dup 1) (match_dup 2)))
8752 (clobber (match_dup 4))])
8754 (compare:CC (match_dup 0)
8759 [(set (match_operand:CC 3 "cc_reg_operand" "")
8760 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8761 (match_operand:DI 2 "mask64_2_operand" ""))
8763 (set (match_operand:DI 0 "gpc_reg_operand" "")
8764 (and:DI (match_dup 1) (match_dup 2)))
8765 (clobber (match_scratch:CC 4 ""))]
8766 "TARGET_64BIT && reload_completed
8767 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
8768 && !mask_operand (operands[2], DImode)
8769 && !mask64_operand (operands[2], DImode)"
8771 (and:DI (rotate:DI (match_dup 1)
8774 (parallel [(set (match_dup 3)
8775 (compare:CC (and:DI (rotate:DI (match_dup 0)
8780 (and:DI (rotate:DI (match_dup 0)
8785 build_mask64_2_operands (operands[2], &operands[5]);
8788 (define_expand "iordi3"
8789 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8790 (ior:DI (match_operand:DI 1 "gpc_reg_operand" "")
8791 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
8795 if (non_logical_cint_operand (operands[2], DImode))
8797 HOST_WIDE_INT value;
8798 rtx tmp = ((!can_create_pseudo_p ()
8799 || rtx_equal_p (operands[0], operands[1]))
8800 ? operands[0] : gen_reg_rtx (DImode));
8802 if (GET_CODE (operands[2]) == CONST_INT)
8804 value = INTVAL (operands[2]);
8805 emit_insn (gen_iordi3 (tmp, operands[1],
8806 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
8810 value = CONST_DOUBLE_LOW (operands[2]);
8811 emit_insn (gen_iordi3 (tmp, operands[1],
8812 immed_double_const (value
8813 & (~ (HOST_WIDE_INT) 0xffff),
8817 emit_insn (gen_iordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
8822 (define_expand "xordi3"
8823 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8824 (xor:DI (match_operand:DI 1 "gpc_reg_operand" "")
8825 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
8829 if (non_logical_cint_operand (operands[2], DImode))
8831 HOST_WIDE_INT value;
8832 rtx tmp = ((!can_create_pseudo_p ()
8833 || rtx_equal_p (operands[0], operands[1]))
8834 ? operands[0] : gen_reg_rtx (DImode));
8836 if (GET_CODE (operands[2]) == CONST_INT)
8838 value = INTVAL (operands[2]);
8839 emit_insn (gen_xordi3 (tmp, operands[1],
8840 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
8844 value = CONST_DOUBLE_LOW (operands[2]);
8845 emit_insn (gen_xordi3 (tmp, operands[1],
8846 immed_double_const (value
8847 & (~ (HOST_WIDE_INT) 0xffff),
8851 emit_insn (gen_xordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
8856 (define_insn "*booldi3_internal1"
8857 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
8858 (match_operator:DI 3 "boolean_or_operator"
8859 [(match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
8860 (match_operand:DI 2 "logical_operand" "r,K,JF")]))]
8867 (define_insn "*booldi3_internal2"
8868 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
8869 (compare:CC (match_operator:DI 4 "boolean_or_operator"
8870 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
8871 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
8873 (clobber (match_scratch:DI 3 "=r,r"))]
8878 [(set_attr "type" "fast_compare,compare")
8879 (set_attr "length" "4,8")])
8882 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8883 (compare:CC (match_operator:DI 4 "boolean_operator"
8884 [(match_operand:DI 1 "gpc_reg_operand" "")
8885 (match_operand:DI 2 "gpc_reg_operand" "")])
8887 (clobber (match_scratch:DI 3 ""))]
8888 "TARGET_POWERPC64 && reload_completed"
8889 [(set (match_dup 3) (match_dup 4))
8891 (compare:CC (match_dup 3)
8895 (define_insn "*booldi3_internal3"
8896 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
8897 (compare:CC (match_operator:DI 4 "boolean_or_operator"
8898 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
8899 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
8901 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8907 [(set_attr "type" "fast_compare,compare")
8908 (set_attr "length" "4,8")])
8911 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8912 (compare:CC (match_operator:DI 4 "boolean_operator"
8913 [(match_operand:DI 1 "gpc_reg_operand" "")
8914 (match_operand:DI 2 "gpc_reg_operand" "")])
8916 (set (match_operand:DI 0 "gpc_reg_operand" "")
8918 "TARGET_POWERPC64 && reload_completed"
8919 [(set (match_dup 0) (match_dup 4))
8921 (compare:CC (match_dup 0)
8925 ;; Split a logical operation that we can't do in one insn into two insns,
8926 ;; each of which does one 16-bit part. This is used by combine.
8929 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8930 (match_operator:DI 3 "boolean_or_operator"
8931 [(match_operand:DI 1 "gpc_reg_operand" "")
8932 (match_operand:DI 2 "non_logical_cint_operand" "")]))]
8934 [(set (match_dup 0) (match_dup 4))
8935 (set (match_dup 0) (match_dup 5))]
8940 if (GET_CODE (operands[2]) == CONST_DOUBLE)
8942 HOST_WIDE_INT value = CONST_DOUBLE_LOW (operands[2]);
8943 i3 = immed_double_const (value & (~ (HOST_WIDE_INT) 0xffff),
8945 i4 = GEN_INT (value & 0xffff);
8949 i3 = GEN_INT (INTVAL (operands[2])
8950 & (~ (HOST_WIDE_INT) 0xffff));
8951 i4 = GEN_INT (INTVAL (operands[2]) & 0xffff);
8953 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
8955 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
8959 (define_insn "*boolcdi3_internal1"
8960 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
8961 (match_operator:DI 3 "boolean_operator"
8962 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
8963 (match_operand:DI 2 "gpc_reg_operand" "r")]))]
8967 (define_insn "*boolcdi3_internal2"
8968 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
8969 (compare:CC (match_operator:DI 4 "boolean_operator"
8970 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
8971 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
8973 (clobber (match_scratch:DI 3 "=r,r"))]
8978 [(set_attr "type" "fast_compare,compare")
8979 (set_attr "length" "4,8")])
8982 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8983 (compare:CC (match_operator:DI 4 "boolean_operator"
8984 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
8985 (match_operand:DI 2 "gpc_reg_operand" "")])
8987 (clobber (match_scratch:DI 3 ""))]
8988 "TARGET_POWERPC64 && reload_completed"
8989 [(set (match_dup 3) (match_dup 4))
8991 (compare:CC (match_dup 3)
8995 (define_insn "*boolcdi3_internal3"
8996 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
8997 (compare:CC (match_operator:DI 4 "boolean_operator"
8998 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
8999 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
9001 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
9007 [(set_attr "type" "fast_compare,compare")
9008 (set_attr "length" "4,8")])
9011 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
9012 (compare:CC (match_operator:DI 4 "boolean_operator"
9013 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
9014 (match_operand:DI 2 "gpc_reg_operand" "")])
9016 (set (match_operand:DI 0 "gpc_reg_operand" "")
9018 "TARGET_POWERPC64 && reload_completed"
9019 [(set (match_dup 0) (match_dup 4))
9021 (compare:CC (match_dup 0)
9025 (define_insn "*boolccdi3_internal1"
9026 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9027 (match_operator:DI 3 "boolean_operator"
9028 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
9029 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r"))]))]
9033 (define_insn "*boolccdi3_internal2"
9034 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
9035 (compare:CC (match_operator:DI 4 "boolean_operator"
9036 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
9037 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
9039 (clobber (match_scratch:DI 3 "=r,r"))]
9044 [(set_attr "type" "fast_compare,compare")
9045 (set_attr "length" "4,8")])
9048 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
9049 (compare:CC (match_operator:DI 4 "boolean_operator"
9050 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
9051 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
9053 (clobber (match_scratch:DI 3 ""))]
9054 "TARGET_POWERPC64 && reload_completed"
9055 [(set (match_dup 3) (match_dup 4))
9057 (compare:CC (match_dup 3)
9061 (define_insn "*boolccdi3_internal3"
9062 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
9063 (compare:CC (match_operator:DI 4 "boolean_operator"
9064 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
9065 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
9067 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
9073 [(set_attr "type" "fast_compare,compare")
9074 (set_attr "length" "4,8")])
9077 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
9078 (compare:CC (match_operator:DI 4 "boolean_operator"
9079 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
9080 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
9082 (set (match_operand:DI 0 "gpc_reg_operand" "")
9084 "TARGET_POWERPC64 && reload_completed"
9085 [(set (match_dup 0) (match_dup 4))
9087 (compare:CC (match_dup 0)
9091 (define_expand "smindi3"
9092 [(match_operand:DI 0 "gpc_reg_operand" "")
9093 (match_operand:DI 1 "gpc_reg_operand" "")
9094 (match_operand:DI 2 "gpc_reg_operand" "")]
9098 rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]);
9102 (define_expand "smaxdi3"
9103 [(match_operand:DI 0 "gpc_reg_operand" "")
9104 (match_operand:DI 1 "gpc_reg_operand" "")
9105 (match_operand:DI 2 "gpc_reg_operand" "")]
9109 rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]);
9113 (define_expand "umindi3"
9114 [(match_operand:DI 0 "gpc_reg_operand" "")
9115 (match_operand:DI 1 "gpc_reg_operand" "")
9116 (match_operand:DI 2 "gpc_reg_operand" "")]
9120 rs6000_emit_minmax (operands[0], UMIN, operands[1], operands[2]);
9124 (define_expand "umaxdi3"
9125 [(match_operand:DI 0 "gpc_reg_operand" "")
9126 (match_operand:DI 1 "gpc_reg_operand" "")
9127 (match_operand:DI 2 "gpc_reg_operand" "")]
9131 rs6000_emit_minmax (operands[0], UMAX, operands[1], operands[2]);
9136 ;; Now define ways of moving data around.
9138 ;; Set up a register with a value from the GOT table
9140 (define_expand "movsi_got"
9141 [(set (match_operand:SI 0 "gpc_reg_operand" "")
9142 (unspec:SI [(match_operand:SI 1 "got_operand" "")
9143 (match_dup 2)] UNSPEC_MOVSI_GOT))]
9144 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
9147 if (GET_CODE (operands[1]) == CONST)
9149 rtx offset = const0_rtx;
9150 HOST_WIDE_INT value;
9152 operands[1] = eliminate_constant_term (XEXP (operands[1], 0), &offset);
9153 value = INTVAL (offset);
9156 rtx tmp = (!can_create_pseudo_p ()
9158 : gen_reg_rtx (Pmode));
9159 emit_insn (gen_movsi_got (tmp, operands[1]));
9160 emit_insn (gen_addsi3 (operands[0], tmp, offset));
9165 operands[2] = rs6000_got_register (operands[1]);
9168 (define_insn "*movsi_got_internal"
9169 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9170 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
9171 (match_operand:SI 2 "gpc_reg_operand" "b")]
9173 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
9174 "{l|lwz} %0,%a1@got(%2)"
9175 [(set_attr "type" "load")])
9177 ;; Used by sched, shorten_branches and final when the GOT pseudo reg
9178 ;; didn't get allocated to a hard register.
9180 [(set (match_operand:SI 0 "gpc_reg_operand" "")
9181 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
9182 (match_operand:SI 2 "memory_operand" "")]
9184 "DEFAULT_ABI == ABI_V4
9186 && (reload_in_progress || reload_completed)"
9187 [(set (match_dup 0) (match_dup 2))
9188 (set (match_dup 0) (unspec:SI [(match_dup 1)(match_dup 0)]
9192 ;; For SI, we special-case integers that can't be loaded in one insn. We
9193 ;; do the load 16-bits at a time. We could do this by loading from memory,
9194 ;; and this is even supposed to be faster, but it is simpler not to get
9195 ;; integers in the TOC.
9196 (define_insn "movsi_low"
9197 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9198 (mem:SI (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
9199 (match_operand 2 "" ""))))]
9200 "TARGET_MACHO && ! TARGET_64BIT"
9201 "{l|lwz} %0,lo16(%2)(%1)"
9202 [(set_attr "type" "load")
9203 (set_attr "length" "4")])
9205 (define_insn "*movsi_internal1"
9206 [(set (match_operand:SI 0 "rs6000_nonimmediate_operand" "=r,r,r,m,r,r,r,r,r,*q,*c*l,*h,*h")
9207 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,R,*h,r,r,r,0"))]
9208 "!TARGET_SINGLE_FPU &&
9209 (gpc_reg_operand (operands[0], SImode) || gpc_reg_operand (operands[1], SImode))"
9213 {l%U1%X1|lwz%U1%X1} %0,%1
9214 {st%U0%X0|stw%U0%X0} %1,%0
9224 [(set_attr "type" "*,*,load,store,*,*,*,*,mfjmpr,*,mtjmpr,*,*")
9225 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4,4,4")])
9227 (define_insn "*movsi_internal1_single"
9228 [(set (match_operand:SI 0 "rs6000_nonimmediate_operand" "=r,r,r,m,r,r,r,r,r,*q,*c*l,*h,*h,m,*f")
9229 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,R,*h,r,r,r,0,f,m"))]
9230 "TARGET_SINGLE_FPU &&
9231 (gpc_reg_operand (operands[0], SImode) || gpc_reg_operand (operands[1], SImode))"
9235 {l%U1%X1|lwz%U1%X1} %0,%1
9236 {st%U0%X0|stw%U0%X0} %1,%0
9248 [(set_attr "type" "*,*,load,store,*,*,*,*,mfjmpr,*,mtjmpr,*,*,*,*")
9249 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4,4,4,4,4")])
9251 ;; Split a load of a large constant into the appropriate two-insn
9255 [(set (match_operand:SI 0 "gpc_reg_operand" "")
9256 (match_operand:SI 1 "const_int_operand" ""))]
9257 "(unsigned HOST_WIDE_INT) (INTVAL (operands[1]) + 0x8000) >= 0x10000
9258 && (INTVAL (operands[1]) & 0xffff) != 0"
9262 (ior:SI (match_dup 0)
9265 { rtx tem = rs6000_emit_set_const (operands[0], SImode, operands[1], 2);
9267 if (tem == operands[0])
9273 (define_insn "*mov<mode>_internal2"
9274 [(set (match_operand:CC 2 "cc_reg_operand" "=y,x,?y")
9275 (compare:CC (match_operand:P 1 "gpc_reg_operand" "0,r,r")
9277 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r") (match_dup 1))]
9280 {cmpi|cmp<wd>i} %2,%0,0
9283 [(set_attr "type" "cmp,compare,cmp")
9284 (set_attr "length" "4,4,8")])
9287 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
9288 (compare:CC (match_operand:P 1 "gpc_reg_operand" "")
9290 (set (match_operand:P 0 "gpc_reg_operand" "") (match_dup 1))]
9292 [(set (match_dup 0) (match_dup 1))
9294 (compare:CC (match_dup 0)
9298 (define_insn "*movhi_internal"
9299 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
9300 (match_operand:HI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
9301 "gpc_reg_operand (operands[0], HImode)
9302 || gpc_reg_operand (operands[1], HImode)"
9312 [(set_attr "type" "*,load,store,*,mfjmpr,*,mtjmpr,*")])
9314 (define_expand "mov<mode>"
9315 [(set (match_operand:INT 0 "general_operand" "")
9316 (match_operand:INT 1 "any_operand" ""))]
9318 "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
9320 (define_insn "*movqi_internal"
9321 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
9322 (match_operand:QI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
9323 "gpc_reg_operand (operands[0], QImode)
9324 || gpc_reg_operand (operands[1], QImode)"
9334 [(set_attr "type" "*,load,store,*,mfjmpr,*,mtjmpr,*")])
9336 ;; Here is how to move condition codes around. When we store CC data in
9337 ;; an integer register or memory, we store just the high-order 4 bits.
9338 ;; This lets us not shift in the most common case of CR0.
9339 (define_expand "movcc"
9340 [(set (match_operand:CC 0 "nonimmediate_operand" "")
9341 (match_operand:CC 1 "nonimmediate_operand" ""))]
9345 (define_insn "*movcc_internal1"
9346 [(set (match_operand:CC 0 "nonimmediate_operand" "=y,x,?y,y,r,r,r,r,r,q,cl,r,m")
9347 (match_operand:CC 1 "general_operand" "y,r,r,O,x,y,r,I,h,r,r,m,r"))]
9348 "register_operand (operands[0], CCmode)
9349 || register_operand (operands[1], CCmode)"
9353 {rlinm|rlwinm} %1,%1,%F0,0xffffffff\;mtcrf %R0,%1\;{rlinm|rlwinm} %1,%1,%f0,0xffffffff
9356 mfcr %0%Q1\;{rlinm|rlwinm} %0,%0,%f1,0xf0000000
9362 {l%U1%X1|lwz%U1%X1} %0,%1
9363 {st%U0%U1|stw%U0%U1} %1,%0"
9365 (cond [(eq_attr "alternative" "0,3")
9366 (const_string "cr_logical")
9367 (eq_attr "alternative" "1,2")
9368 (const_string "mtcr")
9369 (eq_attr "alternative" "6,7,9")
9370 (const_string "integer")
9371 (eq_attr "alternative" "8")
9372 (const_string "mfjmpr")
9373 (eq_attr "alternative" "10")
9374 (const_string "mtjmpr")
9375 (eq_attr "alternative" "11")
9376 (const_string "load")
9377 (eq_attr "alternative" "12")
9378 (const_string "store")
9379 (ne (symbol_ref "TARGET_MFCRF") (const_int 0))
9380 (const_string "mfcrf")
9382 (const_string "mfcr")))
9383 (set_attr "length" "4,4,12,4,4,8,4,4,4,4,4,4,4")])
9385 ;; For floating-point, we normally deal with the floating-point registers
9386 ;; unless -msoft-float is used. The sole exception is that parameter passing
9387 ;; can produce floating-point values in fixed-point registers. Unless the
9388 ;; value is a simple constant or already in memory, we deal with this by
9389 ;; allocating memory and copying the value explicitly via that memory location.
9390 (define_expand "movsf"
9391 [(set (match_operand:SF 0 "nonimmediate_operand" "")
9392 (match_operand:SF 1 "any_operand" ""))]
9394 "{ rs6000_emit_move (operands[0], operands[1], SFmode); DONE; }")
9397 [(set (match_operand:SF 0 "gpc_reg_operand" "")
9398 (match_operand:SF 1 "const_double_operand" ""))]
9400 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
9401 || (GET_CODE (operands[0]) == SUBREG
9402 && GET_CODE (SUBREG_REG (operands[0])) == REG
9403 && REGNO (SUBREG_REG (operands[0])) <= 31))"
9404 [(set (match_dup 2) (match_dup 3))]
9410 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
9411 REAL_VALUE_TO_TARGET_SINGLE (rv, l);
9413 if (! TARGET_POWERPC64)
9414 operands[2] = operand_subword (operands[0], 0, 0, SFmode);
9416 operands[2] = gen_lowpart (SImode, operands[0]);
9418 operands[3] = gen_int_mode (l, SImode);
9421 (define_insn "*movsf_hardfloat"
9422 [(set (match_operand:SF 0 "nonimmediate_operand" "=!r,!r,m,f,f,m,*c*l,*q,!r,*h,!r,!r")
9423 (match_operand:SF 1 "input_operand" "r,m,r,f,m,f,r,r,h,0,G,Fn"))]
9424 "(gpc_reg_operand (operands[0], SFmode)
9425 || gpc_reg_operand (operands[1], SFmode))
9426 && (TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT)"
9429 {l%U1%X1|lwz%U1%X1} %0,%1
9430 {st%U0%X0|stw%U0%X0} %1,%0
9440 [(set_attr "type" "*,load,store,fp,fpload,fpstore,mtjmpr,*,mfjmpr,*,*,*")
9441 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,8")])
9443 (define_insn "*movsf_softfloat"
9444 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,cl,q,r,r,m,r,r,r,r,r,*h")
9445 (match_operand:SF 1 "input_operand" "r,r,r,h,m,r,I,L,R,G,Fn,0"))]
9446 "(gpc_reg_operand (operands[0], SFmode)
9447 || gpc_reg_operand (operands[1], SFmode))
9448 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)"
9454 {l%U1%X1|lwz%U1%X1} %0,%1
9455 {st%U0%X0|stw%U0%X0} %1,%0
9462 [(set_attr "type" "*,mtjmpr,*,mfjmpr,load,store,*,*,*,*,*,*")
9463 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,8,4")])
9466 (define_expand "movdf"
9467 [(set (match_operand:DF 0 "nonimmediate_operand" "")
9468 (match_operand:DF 1 "any_operand" ""))]
9470 "{ rs6000_emit_move (operands[0], operands[1], DFmode); DONE; }")
9473 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9474 (match_operand:DF 1 "const_int_operand" ""))]
9475 "! TARGET_POWERPC64 && reload_completed
9476 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
9477 || (GET_CODE (operands[0]) == SUBREG
9478 && GET_CODE (SUBREG_REG (operands[0])) == REG
9479 && REGNO (SUBREG_REG (operands[0])) <= 31))"
9480 [(set (match_dup 2) (match_dup 4))
9481 (set (match_dup 3) (match_dup 1))]
9484 int endian = (WORDS_BIG_ENDIAN == 0);
9485 HOST_WIDE_INT value = INTVAL (operands[1]);
9487 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
9488 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
9489 #if HOST_BITS_PER_WIDE_INT == 32
9490 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
9492 operands[4] = GEN_INT (value >> 32);
9493 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
9498 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9499 (match_operand:DF 1 "const_double_operand" ""))]
9500 "! TARGET_POWERPC64 && reload_completed
9501 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
9502 || (GET_CODE (operands[0]) == SUBREG
9503 && GET_CODE (SUBREG_REG (operands[0])) == REG
9504 && REGNO (SUBREG_REG (operands[0])) <= 31))"
9505 [(set (match_dup 2) (match_dup 4))
9506 (set (match_dup 3) (match_dup 5))]
9509 int endian = (WORDS_BIG_ENDIAN == 0);
9513 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
9514 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
9516 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
9517 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
9518 operands[4] = gen_int_mode (l[endian], SImode);
9519 operands[5] = gen_int_mode (l[1 - endian], SImode);
9523 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9524 (match_operand:DF 1 "const_double_operand" ""))]
9525 "TARGET_POWERPC64 && reload_completed
9526 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
9527 || (GET_CODE (operands[0]) == SUBREG
9528 && GET_CODE (SUBREG_REG (operands[0])) == REG
9529 && REGNO (SUBREG_REG (operands[0])) <= 31))"
9530 [(set (match_dup 2) (match_dup 3))]
9533 int endian = (WORDS_BIG_ENDIAN == 0);
9536 #if HOST_BITS_PER_WIDE_INT >= 64
9540 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
9541 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
9543 operands[2] = gen_lowpart (DImode, operands[0]);
9544 /* HIGHPART is lower memory address when WORDS_BIG_ENDIAN. */
9545 #if HOST_BITS_PER_WIDE_INT >= 64
9546 val = ((HOST_WIDE_INT)(unsigned long)l[endian] << 32
9547 | ((HOST_WIDE_INT)(unsigned long)l[1 - endian]));
9549 operands[3] = gen_int_mode (val, DImode);
9551 operands[3] = immed_double_const (l[1 - endian], l[endian], DImode);
9555 ;; Don't have reload use general registers to load a constant. First,
9556 ;; it might not work if the output operand is the equivalent of
9557 ;; a non-offsettable memref, but also it is less efficient than loading
9558 ;; the constant into an FP register, since it will probably be used there.
9559 ;; The "??" is a kludge until we can figure out a more reasonable way
9560 ;; of handling these non-offsettable values.
9561 (define_insn "*movdf_hardfloat32"
9562 [(set (match_operand:DF 0 "nonimmediate_operand" "=!r,??r,m,ws,?wa,ws,?wa,Z,?Z,d,d,m,wa,!r,!r,!r")
9563 (match_operand:DF 1 "input_operand" "r,m,r,ws,wa,Z,Z,ws,wa,d,m,d,j,G,H,F"))]
9564 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9565 && (gpc_reg_operand (operands[0], DFmode)
9566 || gpc_reg_operand (operands[1], DFmode))"
9569 switch (which_alternative)
9579 return \"xxlor %x0,%x1,%x1\";
9582 return \"lxsd%U1x %x0,%y1\";
9585 return \"stxsd%U0x %x1,%y0\";
9587 return \"fmr %0,%1\";
9589 return \"lfd%U1%X1 %0,%1\";
9591 return \"stfd%U0%X0 %1,%0\";
9593 return \"xxlxor %x0,%x0,%x0\";
9600 [(set_attr "type" "two,load,store,fp,fp,fpload,fpload,fpstore,fpstore,fp,fpload,fpstore,vecsimple,*,*,*")
9601 (set_attr "length" "8,16,16,4,4,4,4,4,4,4,4,4,4,8,12,16")])
9603 (define_insn "*movdf_softfloat32"
9604 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,m,r,r,r")
9605 (match_operand:DF 1 "input_operand" "r,m,r,G,H,F"))]
9607 && ((TARGET_FPRS && TARGET_SINGLE_FLOAT)
9608 || TARGET_SOFT_FLOAT || TARGET_E500_SINGLE)
9609 && (gpc_reg_operand (operands[0], DFmode)
9610 || gpc_reg_operand (operands[1], DFmode))"
9612 [(set_attr "type" "two,load,store,*,*,*")
9613 (set_attr "length" "8,8,8,8,12,16")])
9615 ; ld/std require word-aligned displacements -> 'Y' constraint.
9616 ; List Y->r and r->Y before r->r for reload.
9617 (define_insn "*movdf_hardfloat64_mfpgpr"
9618 [(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")
9619 (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"))]
9620 "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
9621 && TARGET_DOUBLE_FLOAT
9622 && (gpc_reg_operand (operands[0], DFmode)
9623 || gpc_reg_operand (operands[1], DFmode))"
9646 [(set_attr "type" "store,load,*,fp,fp,fpload,fpload,fpstore,fpstore,fp,fpload,fpstore,vecsimple,mtjmpr,mfjmpr,*,*,*,*,mftgpr,mffgpr")
9647 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,8,12,16,4,4")])
9649 ; ld/std require word-aligned displacements -> 'Y' constraint.
9650 ; List Y->r and r->Y before r->r for reload.
9651 (define_insn "*movdf_hardfloat64"
9652 [(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")
9653 (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"))]
9654 "TARGET_POWERPC64 && !TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
9655 && TARGET_DOUBLE_FLOAT
9656 && (gpc_reg_operand (operands[0], DFmode)
9657 || gpc_reg_operand (operands[1], DFmode))"
9678 [(set_attr "type" "store,load,*,fp,fp,fpload,fpload,fpstore,fpstore,fp,fpload,fpstore,vecsimple,mtjmpr,mfjmpr,*,*,*,*")
9679 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,8,12,16")])
9681 (define_insn "*movdf_softfloat64"
9682 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,Y,r,cl,r,r,r,r,*h")
9683 (match_operand:DF 1 "input_operand" "Y,r,r,r,h,G,H,F,0"))]
9684 "TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)
9685 && (gpc_reg_operand (operands[0], DFmode)
9686 || gpc_reg_operand (operands[1], DFmode))"
9697 [(set_attr "type" "load,store,*,mtjmpr,mfjmpr,*,*,*,*")
9698 (set_attr "length" "4,4,4,4,4,8,12,16,4")])
9700 (define_expand "movtf"
9701 [(set (match_operand:TF 0 "general_operand" "")
9702 (match_operand:TF 1 "any_operand" ""))]
9703 "!TARGET_IEEEQUAD && TARGET_LONG_DOUBLE_128"
9704 "{ rs6000_emit_move (operands[0], operands[1], TFmode); DONE; }")
9706 ; It's important to list the o->f and f->o moves before f->f because
9707 ; otherwise reload, given m->f, will try to pick f->f and reload it,
9708 ; which doesn't make progress. Likewise r->Y must be before r->r.
9709 (define_insn_and_split "*movtf_internal"
9710 [(set (match_operand:TF 0 "nonimmediate_operand" "=o,d,d,r,Y,r")
9711 (match_operand:TF 1 "input_operand" "d,o,d,YGHF,r,r"))]
9713 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128
9714 && (gpc_reg_operand (operands[0], TFmode)
9715 || gpc_reg_operand (operands[1], TFmode))"
9717 "&& reload_completed"
9719 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
9720 [(set_attr "length" "8,8,8,20,20,16")])
9722 (define_insn_and_split "*movtf_softfloat"
9723 [(set (match_operand:TF 0 "rs6000_nonimmediate_operand" "=r,Y,r")
9724 (match_operand:TF 1 "input_operand" "YGHF,r,r"))]
9726 && (TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_LONG_DOUBLE_128
9727 && (gpc_reg_operand (operands[0], TFmode)
9728 || gpc_reg_operand (operands[1], TFmode))"
9730 "&& reload_completed"
9732 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
9733 [(set_attr "length" "20,20,16")])
9735 (define_expand "extenddftf2"
9736 [(set (match_operand:TF 0 "nonimmediate_operand" "")
9737 (float_extend:TF (match_operand:DF 1 "input_operand" "")))]
9739 && TARGET_HARD_FLOAT
9740 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9741 && TARGET_LONG_DOUBLE_128"
9743 if (TARGET_E500_DOUBLE)
9744 emit_insn (gen_spe_extenddftf2 (operands[0], operands[1]));
9746 emit_insn (gen_extenddftf2_fprs (operands[0], operands[1]));
9750 (define_expand "extenddftf2_fprs"
9751 [(parallel [(set (match_operand:TF 0 "nonimmediate_operand" "")
9752 (float_extend:TF (match_operand:DF 1 "input_operand" "")))
9753 (use (match_dup 2))])]
9755 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9756 && TARGET_LONG_DOUBLE_128"
9758 operands[2] = CONST0_RTX (DFmode);
9759 /* Generate GOT reference early for SVR4 PIC. */
9760 if (DEFAULT_ABI == ABI_V4 && flag_pic)
9761 operands[2] = validize_mem (force_const_mem (DFmode, operands[2]));
9764 (define_insn_and_split "*extenddftf2_internal"
9765 [(set (match_operand:TF 0 "nonimmediate_operand" "=o,d,&d,r")
9766 (float_extend:TF (match_operand:DF 1 "input_operand" "dr,md,md,rmGHF")))
9767 (use (match_operand:DF 2 "zero_reg_mem_operand" "rd,m,d,n"))]
9769 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9770 && TARGET_LONG_DOUBLE_128"
9772 "&& reload_completed"
9775 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
9776 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
9777 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word),
9779 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word),
9784 (define_expand "extendsftf2"
9785 [(set (match_operand:TF 0 "nonimmediate_operand" "")
9786 (float_extend:TF (match_operand:SF 1 "gpc_reg_operand" "")))]
9788 && TARGET_HARD_FLOAT
9789 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9790 && TARGET_LONG_DOUBLE_128"
9792 rtx tmp = gen_reg_rtx (DFmode);
9793 emit_insn (gen_extendsfdf2 (tmp, operands[1]));
9794 emit_insn (gen_extenddftf2 (operands[0], tmp));
9798 (define_expand "trunctfdf2"
9799 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9800 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "")))]
9802 && TARGET_HARD_FLOAT
9803 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9804 && TARGET_LONG_DOUBLE_128"
9807 (define_insn_and_split "trunctfdf2_internal1"
9808 [(set (match_operand:DF 0 "gpc_reg_operand" "=d,?d")
9809 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "0,d")))]
9810 "!TARGET_IEEEQUAD && !TARGET_XL_COMPAT
9811 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9815 "&& reload_completed && REGNO (operands[0]) == REGNO (operands[1])"
9818 emit_note (NOTE_INSN_DELETED);
9821 [(set_attr "type" "fp")])
9823 (define_insn "trunctfdf2_internal2"
9824 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
9825 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "d")))]
9826 "!TARGET_IEEEQUAD && TARGET_XL_COMPAT
9827 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9828 && TARGET_LONG_DOUBLE_128"
9830 [(set_attr "type" "fp")
9831 (set_attr "fp_type" "fp_addsub_d")])
9833 (define_expand "trunctfsf2"
9834 [(set (match_operand:SF 0 "gpc_reg_operand" "")
9835 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "")))]
9837 && TARGET_HARD_FLOAT
9838 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9839 && TARGET_LONG_DOUBLE_128"
9841 if (TARGET_E500_DOUBLE)
9842 emit_insn (gen_spe_trunctfsf2 (operands[0], operands[1]));
9844 emit_insn (gen_trunctfsf2_fprs (operands[0], operands[1]));
9848 (define_insn_and_split "trunctfsf2_fprs"
9849 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
9850 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "d")))
9851 (clobber (match_scratch:DF 2 "=d"))]
9853 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
9854 && TARGET_LONG_DOUBLE_128"
9856 "&& reload_completed"
9858 (float_truncate:DF (match_dup 1)))
9860 (float_truncate:SF (match_dup 2)))]
9863 (define_expand "floatsitf2"
9864 [(set (match_operand:TF 0 "gpc_reg_operand" "")
9865 (float:TF (match_operand:SI 1 "gpc_reg_operand" "")))]
9867 && TARGET_HARD_FLOAT
9868 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9869 && TARGET_LONG_DOUBLE_128"
9871 rtx tmp = gen_reg_rtx (DFmode);
9872 expand_float (tmp, operands[1], false);
9873 emit_insn (gen_extenddftf2 (operands[0], tmp));
9877 ; fadd, but rounding towards zero.
9878 ; This is probably not the optimal code sequence.
9879 (define_insn "fix_trunc_helper"
9880 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
9881 (unspec:DF [(match_operand:TF 1 "gpc_reg_operand" "d")]
9882 UNSPEC_FIX_TRUNC_TF))
9883 (clobber (match_operand:DF 2 "gpc_reg_operand" "=&d"))]
9884 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
9885 "mffs %2\n\tmtfsb1 31\n\tmtfsb0 30\n\tfadd %0,%1,%L1\n\tmtfsf 1,%2"
9886 [(set_attr "type" "fp")
9887 (set_attr "length" "20")])
9889 (define_expand "fix_trunctfsi2"
9890 [(set (match_operand:SI 0 "gpc_reg_operand" "")
9891 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))]
9893 && (TARGET_POWER2 || TARGET_POWERPC)
9894 && TARGET_HARD_FLOAT
9895 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9896 && TARGET_LONG_DOUBLE_128"
9898 if (TARGET_E500_DOUBLE)
9899 emit_insn (gen_spe_fix_trunctfsi2 (operands[0], operands[1]));
9901 emit_insn (gen_fix_trunctfsi2_fprs (operands[0], operands[1]));
9905 (define_expand "fix_trunctfsi2_fprs"
9906 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
9907 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))
9908 (clobber (match_dup 2))
9909 (clobber (match_dup 3))
9910 (clobber (match_dup 4))
9911 (clobber (match_dup 5))])]
9913 && (TARGET_POWER2 || TARGET_POWERPC)
9914 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9916 operands[2] = gen_reg_rtx (DFmode);
9917 operands[3] = gen_reg_rtx (DFmode);
9918 operands[4] = gen_reg_rtx (DImode);
9919 operands[5] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
9922 (define_insn_and_split "*fix_trunctfsi2_internal"
9923 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9924 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "d")))
9925 (clobber (match_operand:DF 2 "gpc_reg_operand" "=d"))
9926 (clobber (match_operand:DF 3 "gpc_reg_operand" "=&d"))
9927 (clobber (match_operand:DI 4 "gpc_reg_operand" "=d"))
9928 (clobber (match_operand:DI 5 "offsettable_mem_operand" "=o"))]
9930 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9936 emit_insn (gen_fix_trunc_helper (operands[2], operands[1], operands[3]));
9938 gcc_assert (MEM_P (operands[5]));
9939 lowword = adjust_address (operands[5], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
9941 emit_insn (gen_fctiwz_df (operands[4], operands[2]));
9942 emit_move_insn (operands[5], operands[4]);
9943 emit_move_insn (operands[0], lowword);
9947 (define_expand "negtf2"
9948 [(set (match_operand:TF 0 "gpc_reg_operand" "")
9949 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "")))]
9951 && TARGET_HARD_FLOAT
9952 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9953 && TARGET_LONG_DOUBLE_128"
9956 (define_insn "negtf2_internal"
9957 [(set (match_operand:TF 0 "gpc_reg_operand" "=d")
9958 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "d")))]
9960 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9963 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
9964 return \"fneg %L0,%L1\;fneg %0,%1\";
9966 return \"fneg %0,%1\;fneg %L0,%L1\";
9968 [(set_attr "type" "fp")
9969 (set_attr "length" "8")])
9971 (define_expand "abstf2"
9972 [(set (match_operand:TF 0 "gpc_reg_operand" "")
9973 (abs:TF (match_operand:TF 1 "gpc_reg_operand" "")))]
9975 && TARGET_HARD_FLOAT
9976 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9977 && TARGET_LONG_DOUBLE_128"
9980 rtx label = gen_label_rtx ();
9981 if (TARGET_E500_DOUBLE)
9983 if (flag_finite_math_only && !flag_trapping_math)
9984 emit_insn (gen_spe_abstf2_tst (operands[0], operands[1], label));
9986 emit_insn (gen_spe_abstf2_cmp (operands[0], operands[1], label));
9989 emit_insn (gen_abstf2_internal (operands[0], operands[1], label));
9994 (define_expand "abstf2_internal"
9995 [(set (match_operand:TF 0 "gpc_reg_operand" "")
9996 (match_operand:TF 1 "gpc_reg_operand" ""))
9997 (set (match_dup 3) (match_dup 5))
9998 (set (match_dup 5) (abs:DF (match_dup 5)))
9999 (set (match_dup 4) (compare:CCFP (match_dup 3) (match_dup 5)))
10000 (set (pc) (if_then_else (eq (match_dup 4) (const_int 0))
10001 (label_ref (match_operand 2 "" ""))
10003 (set (match_dup 6) (neg:DF (match_dup 6)))]
10005 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
10006 && TARGET_LONG_DOUBLE_128"
10009 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
10010 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
10011 operands[3] = gen_reg_rtx (DFmode);
10012 operands[4] = gen_reg_rtx (CCFPmode);
10013 operands[5] = simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word);
10014 operands[6] = simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word);
10017 ;; Next come the multi-word integer load and store and the load and store
10020 ; List r->r after r->"o<>", otherwise reload will try to reload a
10021 ; non-offsettable address by using r->r which won't make progress.
10022 (define_insn "*movdi_internal32"
10023 [(set (match_operand:DI 0 "rs6000_nonimmediate_operand" "=o<>,r,r,*d,*d,m,r")
10024 (match_operand:DI 1 "input_operand" "r,r,m,d,m,d,IJKnGHF"))]
10025 "! TARGET_POWERPC64
10026 && (gpc_reg_operand (operands[0], DImode)
10027 || gpc_reg_operand (operands[1], DImode))"
10036 [(set_attr "type" "load,*,store,fp,fpload,fpstore,*")])
10039 [(set (match_operand:DI 0 "gpc_reg_operand" "")
10040 (match_operand:DI 1 "const_int_operand" ""))]
10041 "! TARGET_POWERPC64 && reload_completed"
10042 [(set (match_dup 2) (match_dup 4))
10043 (set (match_dup 3) (match_dup 1))]
10046 HOST_WIDE_INT value = INTVAL (operands[1]);
10047 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
10049 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
10051 #if HOST_BITS_PER_WIDE_INT == 32
10052 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
10054 operands[4] = GEN_INT (value >> 32);
10055 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
10060 [(set (match_operand:DIFD 0 "rs6000_nonimmediate_operand" "")
10061 (match_operand:DIFD 1 "input_operand" ""))]
10062 "reload_completed && !TARGET_POWERPC64
10063 && gpr_or_gpr_p (operands[0], operands[1])"
10065 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
10067 (define_insn "*movdi_mfpgpr"
10068 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,*d,*d,m,r,*h,*h,r,*d")
10069 (match_operand:DI 1 "input_operand" "r,m,r,I,L,nF,R,d,m,d,*h,r,0,*d,r"))]
10070 "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
10071 && (gpc_reg_operand (operands[0], DImode)
10072 || gpc_reg_operand (operands[1], DImode))"
10089 [(set_attr "type" "*,load,store,*,*,*,*,fp,fpload,fpstore,mfjmpr,mtjmpr,*,mftgpr,mffgpr")
10090 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4,4,4")])
10092 (define_insn "*movdi_internal64"
10093 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,*d,*d,m,r,*h,*h")
10094 (match_operand:DI 1 "input_operand" "r,m,r,I,L,nF,R,d,m,d,*h,r,0"))]
10095 "TARGET_POWERPC64 && (!TARGET_MFPGPR || !TARGET_HARD_FLOAT || !TARGET_FPRS)
10096 && (gpc_reg_operand (operands[0], DImode)
10097 || gpc_reg_operand (operands[1], DImode))"
10112 [(set_attr "type" "*,load,store,*,*,*,*,fp,fpload,fpstore,mfjmpr,mtjmpr,*")
10113 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4")])
10115 ;; immediate value valid for a single instruction hiding in a const_double
10117 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10118 (match_operand:DI 1 "const_double_operand" "F"))]
10119 "HOST_BITS_PER_WIDE_INT == 32 && TARGET_POWERPC64
10120 && GET_CODE (operands[1]) == CONST_DOUBLE
10121 && num_insns_constant (operands[1], DImode) == 1"
10124 return ((unsigned HOST_WIDE_INT)
10125 (CONST_DOUBLE_LOW (operands[1]) + 0x8000) < 0x10000)
10126 ? \"li %0,%1\" : \"lis %0,%v1\";
10129 ;; Generate all one-bits and clear left or right.
10130 ;; Use (and:DI (rotate:DI ...)) to avoid anddi3 unnecessary clobber.
10132 [(set (match_operand:DI 0 "gpc_reg_operand" "")
10133 (match_operand:DI 1 "mask64_operand" ""))]
10134 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
10135 [(set (match_dup 0) (const_int -1))
10137 (and:DI (rotate:DI (match_dup 0)
10142 ;; Split a load of a large constant into the appropriate five-instruction
10143 ;; sequence. Handle anything in a constant number of insns.
10144 ;; When non-easy constants can go in the TOC, this should use
10145 ;; easy_fp_constant predicate.
10147 [(set (match_operand:DI 0 "gpc_reg_operand" "")
10148 (match_operand:DI 1 "const_int_operand" ""))]
10149 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
10150 [(set (match_dup 0) (match_dup 2))
10151 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
10153 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
10155 if (tem == operands[0])
10162 [(set (match_operand:DI 0 "gpc_reg_operand" "")
10163 (match_operand:DI 1 "const_double_operand" ""))]
10164 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
10165 [(set (match_dup 0) (match_dup 2))
10166 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
10168 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
10170 if (tem == operands[0])
10176 ;; TImode is similar, except that we usually want to compute the address into
10177 ;; a register and use lsi/stsi (the exception is during reload). MQ is also
10178 ;; clobbered in stsi for POWER, so we need a SCRATCH for it.
10180 ;; We say that MQ is clobbered in the last alternative because the first
10181 ;; alternative would never get used otherwise since it would need a reload
10182 ;; while the 2nd alternative would not. We put memory cases first so they
10183 ;; are preferred. Otherwise, we'd try to reload the output instead of
10184 ;; giving the SCRATCH mq.
10186 (define_insn "*movti_power"
10187 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,m,????r,????r,????r,r")
10188 (match_operand:TI 1 "input_operand" "r,r,r,Q,m,n"))
10189 (clobber (match_scratch:SI 2 "=q,q#X,X,X,X,X"))]
10190 "TARGET_POWER && ! TARGET_POWERPC64
10191 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
10194 switch (which_alternative)
10197 gcc_unreachable ();
10201 return \"{stsi|stswi} %1,%P0,16\";
10206 /* If the address is not used in the output, we can use lsi. Otherwise,
10207 fall through to generating four loads. */
10209 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
10210 return \"{lsi|lswi} %0,%P1,16\";
10211 /* ... fall through ... */
10217 [(set_attr "type" "store,store,*,load,load,*")])
10219 (define_insn "*movti_string"
10220 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,o<>,????r,????r,????r,r")
10221 (match_operand:TI 1 "input_operand" "r,r,r,Q,m,n"))]
10222 "! TARGET_POWER && ! TARGET_POWERPC64
10223 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
10226 switch (which_alternative)
10229 gcc_unreachable ();
10232 return \"{stsi|stswi} %1,%P0,16\";
10237 /* If the address is not used in the output, we can use lsi. Otherwise,
10238 fall through to generating four loads. */
10240 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
10241 return \"{lsi|lswi} %0,%P1,16\";
10242 /* ... fall through ... */
10248 [(set_attr "type" "store_ux,store_ux,*,load_ux,load_ux,*")
10249 (set (attr "cell_micro") (if_then_else (eq (symbol_ref "TARGET_STRING") (const_int 1))
10250 (const_string "always")
10251 (const_string "conditional")))])
10253 (define_insn "*movti_ppc64"
10254 [(set (match_operand:TI 0 "nonimmediate_operand" "=r,o<>,r")
10255 (match_operand:TI 1 "input_operand" "r,r,m"))]
10256 "(TARGET_POWERPC64 && (gpc_reg_operand (operands[0], TImode)
10257 || gpc_reg_operand (operands[1], TImode)))
10258 && VECTOR_MEM_NONE_P (TImode)"
10260 [(set_attr "type" "*,store,load")])
10263 [(set (match_operand:TI 0 "gpc_reg_operand" "")
10264 (match_operand:TI 1 "const_double_operand" ""))]
10265 "TARGET_POWERPC64 && VECTOR_MEM_NONE_P (TImode)"
10266 [(set (match_dup 2) (match_dup 4))
10267 (set (match_dup 3) (match_dup 5))]
10270 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
10272 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
10274 if (GET_CODE (operands[1]) == CONST_DOUBLE)
10276 operands[4] = GEN_INT (CONST_DOUBLE_HIGH (operands[1]));
10277 operands[5] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
10279 else if (GET_CODE (operands[1]) == CONST_INT)
10281 operands[4] = GEN_INT (- (INTVAL (operands[1]) < 0));
10282 operands[5] = operands[1];
10289 [(set (match_operand:TI 0 "nonimmediate_operand" "")
10290 (match_operand:TI 1 "input_operand" ""))]
10291 "reload_completed && VECTOR_MEM_NONE_P (TImode)
10292 && gpr_or_gpr_p (operands[0], operands[1])"
10294 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
10296 (define_expand "load_multiple"
10297 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
10298 (match_operand:SI 1 "" ""))
10299 (use (match_operand:SI 2 "" ""))])]
10300 "TARGET_STRING && !TARGET_POWERPC64"
10308 /* Support only loading a constant number of fixed-point registers from
10309 memory and only bother with this if more than two; the machine
10310 doesn't support more than eight. */
10311 if (GET_CODE (operands[2]) != CONST_INT
10312 || INTVAL (operands[2]) <= 2
10313 || INTVAL (operands[2]) > 8
10314 || GET_CODE (operands[1]) != MEM
10315 || GET_CODE (operands[0]) != REG
10316 || REGNO (operands[0]) >= 32)
10319 count = INTVAL (operands[2]);
10320 regno = REGNO (operands[0]);
10322 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
10323 op1 = replace_equiv_address (operands[1],
10324 force_reg (SImode, XEXP (operands[1], 0)));
10326 for (i = 0; i < count; i++)
10327 XVECEXP (operands[3], 0, i)
10328 = gen_rtx_SET (VOIDmode, gen_rtx_REG (SImode, regno + i),
10329 adjust_address_nv (op1, SImode, i * 4));
10332 (define_insn "*ldmsi8"
10333 [(match_parallel 0 "load_multiple_operation"
10334 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10335 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10336 (set (match_operand:SI 3 "gpc_reg_operand" "")
10337 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10338 (set (match_operand:SI 4 "gpc_reg_operand" "")
10339 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
10340 (set (match_operand:SI 5 "gpc_reg_operand" "")
10341 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
10342 (set (match_operand:SI 6 "gpc_reg_operand" "")
10343 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
10344 (set (match_operand:SI 7 "gpc_reg_operand" "")
10345 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
10346 (set (match_operand:SI 8 "gpc_reg_operand" "")
10347 (mem:SI (plus:SI (match_dup 1) (const_int 24))))
10348 (set (match_operand:SI 9 "gpc_reg_operand" "")
10349 (mem:SI (plus:SI (match_dup 1) (const_int 28))))])]
10350 "TARGET_STRING && XVECLEN (operands[0], 0) == 8"
10352 { return rs6000_output_load_multiple (operands); }"
10353 [(set_attr "type" "load_ux")
10354 (set_attr "length" "32")])
10356 (define_insn "*ldmsi7"
10357 [(match_parallel 0 "load_multiple_operation"
10358 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10359 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10360 (set (match_operand:SI 3 "gpc_reg_operand" "")
10361 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10362 (set (match_operand:SI 4 "gpc_reg_operand" "")
10363 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
10364 (set (match_operand:SI 5 "gpc_reg_operand" "")
10365 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
10366 (set (match_operand:SI 6 "gpc_reg_operand" "")
10367 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
10368 (set (match_operand:SI 7 "gpc_reg_operand" "")
10369 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
10370 (set (match_operand:SI 8 "gpc_reg_operand" "")
10371 (mem:SI (plus:SI (match_dup 1) (const_int 24))))])]
10372 "TARGET_STRING && XVECLEN (operands[0], 0) == 7"
10374 { return rs6000_output_load_multiple (operands); }"
10375 [(set_attr "type" "load_ux")
10376 (set_attr "length" "32")])
10378 (define_insn "*ldmsi6"
10379 [(match_parallel 0 "load_multiple_operation"
10380 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10381 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10382 (set (match_operand:SI 3 "gpc_reg_operand" "")
10383 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10384 (set (match_operand:SI 4 "gpc_reg_operand" "")
10385 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
10386 (set (match_operand:SI 5 "gpc_reg_operand" "")
10387 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
10388 (set (match_operand:SI 6 "gpc_reg_operand" "")
10389 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
10390 (set (match_operand:SI 7 "gpc_reg_operand" "")
10391 (mem:SI (plus:SI (match_dup 1) (const_int 20))))])]
10392 "TARGET_STRING && XVECLEN (operands[0], 0) == 6"
10394 { return rs6000_output_load_multiple (operands); }"
10395 [(set_attr "type" "load_ux")
10396 (set_attr "length" "32")])
10398 (define_insn "*ldmsi5"
10399 [(match_parallel 0 "load_multiple_operation"
10400 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10401 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10402 (set (match_operand:SI 3 "gpc_reg_operand" "")
10403 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10404 (set (match_operand:SI 4 "gpc_reg_operand" "")
10405 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
10406 (set (match_operand:SI 5 "gpc_reg_operand" "")
10407 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
10408 (set (match_operand:SI 6 "gpc_reg_operand" "")
10409 (mem:SI (plus:SI (match_dup 1) (const_int 16))))])]
10410 "TARGET_STRING && XVECLEN (operands[0], 0) == 5"
10412 { return rs6000_output_load_multiple (operands); }"
10413 [(set_attr "type" "load_ux")
10414 (set_attr "length" "32")])
10416 (define_insn "*ldmsi4"
10417 [(match_parallel 0 "load_multiple_operation"
10418 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10419 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10420 (set (match_operand:SI 3 "gpc_reg_operand" "")
10421 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10422 (set (match_operand:SI 4 "gpc_reg_operand" "")
10423 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
10424 (set (match_operand:SI 5 "gpc_reg_operand" "")
10425 (mem:SI (plus:SI (match_dup 1) (const_int 12))))])]
10426 "TARGET_STRING && XVECLEN (operands[0], 0) == 4"
10428 { return rs6000_output_load_multiple (operands); }"
10429 [(set_attr "type" "load_ux")
10430 (set_attr "length" "32")])
10432 (define_insn "*ldmsi3"
10433 [(match_parallel 0 "load_multiple_operation"
10434 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10435 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10436 (set (match_operand:SI 3 "gpc_reg_operand" "")
10437 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10438 (set (match_operand:SI 4 "gpc_reg_operand" "")
10439 (mem:SI (plus:SI (match_dup 1) (const_int 8))))])]
10440 "TARGET_STRING && XVECLEN (operands[0], 0) == 3"
10442 { return rs6000_output_load_multiple (operands); }"
10443 [(set_attr "type" "load_ux")
10444 (set_attr "length" "32")])
10446 (define_expand "store_multiple"
10447 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
10448 (match_operand:SI 1 "" ""))
10449 (clobber (scratch:SI))
10450 (use (match_operand:SI 2 "" ""))])]
10451 "TARGET_STRING && !TARGET_POWERPC64"
10460 /* Support only storing a constant number of fixed-point registers to
10461 memory and only bother with this if more than two; the machine
10462 doesn't support more than eight. */
10463 if (GET_CODE (operands[2]) != CONST_INT
10464 || INTVAL (operands[2]) <= 2
10465 || INTVAL (operands[2]) > 8
10466 || GET_CODE (operands[0]) != MEM
10467 || GET_CODE (operands[1]) != REG
10468 || REGNO (operands[1]) >= 32)
10471 count = INTVAL (operands[2]);
10472 regno = REGNO (operands[1]);
10474 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count + 1));
10475 to = force_reg (SImode, XEXP (operands[0], 0));
10476 op0 = replace_equiv_address (operands[0], to);
10478 XVECEXP (operands[3], 0, 0)
10479 = gen_rtx_SET (VOIDmode, adjust_address_nv (op0, SImode, 0), operands[1]);
10480 XVECEXP (operands[3], 0, 1) = gen_rtx_CLOBBER (VOIDmode,
10481 gen_rtx_SCRATCH (SImode));
10483 for (i = 1; i < count; i++)
10484 XVECEXP (operands[3], 0, i + 1)
10485 = gen_rtx_SET (VOIDmode,
10486 adjust_address_nv (op0, SImode, i * 4),
10487 gen_rtx_REG (SImode, regno + i));
10490 (define_insn "*stmsi8"
10491 [(match_parallel 0 "store_multiple_operation"
10492 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10493 (match_operand:SI 2 "gpc_reg_operand" "r"))
10494 (clobber (match_scratch:SI 3 "=X"))
10495 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10496 (match_operand:SI 4 "gpc_reg_operand" "r"))
10497 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10498 (match_operand:SI 5 "gpc_reg_operand" "r"))
10499 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10500 (match_operand:SI 6 "gpc_reg_operand" "r"))
10501 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10502 (match_operand:SI 7 "gpc_reg_operand" "r"))
10503 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10504 (match_operand:SI 8 "gpc_reg_operand" "r"))
10505 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
10506 (match_operand:SI 9 "gpc_reg_operand" "r"))
10507 (set (mem:SI (plus:SI (match_dup 1) (const_int 28)))
10508 (match_operand:SI 10 "gpc_reg_operand" "r"))])]
10509 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 9"
10510 "{stsi|stswi} %2,%1,%O0"
10511 [(set_attr "type" "store_ux")
10512 (set_attr "cell_micro" "always")])
10514 (define_insn "*stmsi7"
10515 [(match_parallel 0 "store_multiple_operation"
10516 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10517 (match_operand:SI 2 "gpc_reg_operand" "r"))
10518 (clobber (match_scratch:SI 3 "=X"))
10519 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10520 (match_operand:SI 4 "gpc_reg_operand" "r"))
10521 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10522 (match_operand:SI 5 "gpc_reg_operand" "r"))
10523 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10524 (match_operand:SI 6 "gpc_reg_operand" "r"))
10525 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10526 (match_operand:SI 7 "gpc_reg_operand" "r"))
10527 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10528 (match_operand:SI 8 "gpc_reg_operand" "r"))
10529 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
10530 (match_operand:SI 9 "gpc_reg_operand" "r"))])]
10531 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 8"
10532 "{stsi|stswi} %2,%1,%O0"
10533 [(set_attr "type" "store_ux")
10534 (set_attr "cell_micro" "always")])
10536 (define_insn "*stmsi6"
10537 [(match_parallel 0 "store_multiple_operation"
10538 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10539 (match_operand:SI 2 "gpc_reg_operand" "r"))
10540 (clobber (match_scratch:SI 3 "=X"))
10541 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10542 (match_operand:SI 4 "gpc_reg_operand" "r"))
10543 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10544 (match_operand:SI 5 "gpc_reg_operand" "r"))
10545 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10546 (match_operand:SI 6 "gpc_reg_operand" "r"))
10547 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10548 (match_operand:SI 7 "gpc_reg_operand" "r"))
10549 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10550 (match_operand:SI 8 "gpc_reg_operand" "r"))])]
10551 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 7"
10552 "{stsi|stswi} %2,%1,%O0"
10553 [(set_attr "type" "store_ux")
10554 (set_attr "cell_micro" "always")])
10556 (define_insn "*stmsi5"
10557 [(match_parallel 0 "store_multiple_operation"
10558 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10559 (match_operand:SI 2 "gpc_reg_operand" "r"))
10560 (clobber (match_scratch:SI 3 "=X"))
10561 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10562 (match_operand:SI 4 "gpc_reg_operand" "r"))
10563 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10564 (match_operand:SI 5 "gpc_reg_operand" "r"))
10565 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10566 (match_operand:SI 6 "gpc_reg_operand" "r"))
10567 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10568 (match_operand:SI 7 "gpc_reg_operand" "r"))])]
10569 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 6"
10570 "{stsi|stswi} %2,%1,%O0"
10571 [(set_attr "type" "store_ux")
10572 (set_attr "cell_micro" "always")])
10574 (define_insn "*stmsi4"
10575 [(match_parallel 0 "store_multiple_operation"
10576 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10577 (match_operand:SI 2 "gpc_reg_operand" "r"))
10578 (clobber (match_scratch:SI 3 "=X"))
10579 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10580 (match_operand:SI 4 "gpc_reg_operand" "r"))
10581 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10582 (match_operand:SI 5 "gpc_reg_operand" "r"))
10583 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10584 (match_operand:SI 6 "gpc_reg_operand" "r"))])]
10585 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 5"
10586 "{stsi|stswi} %2,%1,%O0"
10587 [(set_attr "type" "store_ux")
10588 (set_attr "cell_micro" "always")])
10590 (define_insn "*stmsi3"
10591 [(match_parallel 0 "store_multiple_operation"
10592 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10593 (match_operand:SI 2 "gpc_reg_operand" "r"))
10594 (clobber (match_scratch:SI 3 "=X"))
10595 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10596 (match_operand:SI 4 "gpc_reg_operand" "r"))
10597 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10598 (match_operand:SI 5 "gpc_reg_operand" "r"))])]
10599 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 4"
10600 "{stsi|stswi} %2,%1,%O0"
10601 [(set_attr "type" "store_ux")
10602 (set_attr "cell_micro" "always")])
10604 (define_insn "*stmsi8_power"
10605 [(match_parallel 0 "store_multiple_operation"
10606 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10607 (match_operand:SI 2 "gpc_reg_operand" "r"))
10608 (clobber (match_scratch:SI 3 "=q"))
10609 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10610 (match_operand:SI 4 "gpc_reg_operand" "r"))
10611 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10612 (match_operand:SI 5 "gpc_reg_operand" "r"))
10613 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10614 (match_operand:SI 6 "gpc_reg_operand" "r"))
10615 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10616 (match_operand:SI 7 "gpc_reg_operand" "r"))
10617 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10618 (match_operand:SI 8 "gpc_reg_operand" "r"))
10619 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
10620 (match_operand:SI 9 "gpc_reg_operand" "r"))
10621 (set (mem:SI (plus:SI (match_dup 1) (const_int 28)))
10622 (match_operand:SI 10 "gpc_reg_operand" "r"))])]
10623 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 9"
10624 "{stsi|stswi} %2,%1,%O0"
10625 [(set_attr "type" "store_ux")
10626 (set_attr "cell_micro" "always")])
10628 (define_insn "*stmsi7_power"
10629 [(match_parallel 0 "store_multiple_operation"
10630 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10631 (match_operand:SI 2 "gpc_reg_operand" "r"))
10632 (clobber (match_scratch:SI 3 "=q"))
10633 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10634 (match_operand:SI 4 "gpc_reg_operand" "r"))
10635 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10636 (match_operand:SI 5 "gpc_reg_operand" "r"))
10637 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10638 (match_operand:SI 6 "gpc_reg_operand" "r"))
10639 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10640 (match_operand:SI 7 "gpc_reg_operand" "r"))
10641 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10642 (match_operand:SI 8 "gpc_reg_operand" "r"))
10643 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
10644 (match_operand:SI 9 "gpc_reg_operand" "r"))])]
10645 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 8"
10646 "{stsi|stswi} %2,%1,%O0"
10647 [(set_attr "type" "store_ux")
10648 (set_attr "cell_micro" "always")])
10650 (define_insn "*stmsi6_power"
10651 [(match_parallel 0 "store_multiple_operation"
10652 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10653 (match_operand:SI 2 "gpc_reg_operand" "r"))
10654 (clobber (match_scratch:SI 3 "=q"))
10655 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10656 (match_operand:SI 4 "gpc_reg_operand" "r"))
10657 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10658 (match_operand:SI 5 "gpc_reg_operand" "r"))
10659 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10660 (match_operand:SI 6 "gpc_reg_operand" "r"))
10661 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10662 (match_operand:SI 7 "gpc_reg_operand" "r"))
10663 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10664 (match_operand:SI 8 "gpc_reg_operand" "r"))])]
10665 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 7"
10666 "{stsi|stswi} %2,%1,%O0"
10667 [(set_attr "type" "store_ux")
10668 (set_attr "cell_micro" "always")])
10670 (define_insn "*stmsi5_power"
10671 [(match_parallel 0 "store_multiple_operation"
10672 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10673 (match_operand:SI 2 "gpc_reg_operand" "r"))
10674 (clobber (match_scratch:SI 3 "=q"))
10675 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10676 (match_operand:SI 4 "gpc_reg_operand" "r"))
10677 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10678 (match_operand:SI 5 "gpc_reg_operand" "r"))
10679 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10680 (match_operand:SI 6 "gpc_reg_operand" "r"))
10681 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10682 (match_operand:SI 7 "gpc_reg_operand" "r"))])]
10683 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 6"
10684 "{stsi|stswi} %2,%1,%O0"
10685 [(set_attr "type" "store_ux")
10686 (set_attr "cell_micro" "always")])
10688 (define_insn "*stmsi4_power"
10689 [(match_parallel 0 "store_multiple_operation"
10690 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10691 (match_operand:SI 2 "gpc_reg_operand" "r"))
10692 (clobber (match_scratch:SI 3 "=q"))
10693 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10694 (match_operand:SI 4 "gpc_reg_operand" "r"))
10695 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10696 (match_operand:SI 5 "gpc_reg_operand" "r"))
10697 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10698 (match_operand:SI 6 "gpc_reg_operand" "r"))])]
10699 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 5"
10700 "{stsi|stswi} %2,%1,%O0"
10701 [(set_attr "type" "store_ux")
10702 (set_attr "cell_micro" "always")])
10704 (define_insn "*stmsi3_power"
10705 [(match_parallel 0 "store_multiple_operation"
10706 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10707 (match_operand:SI 2 "gpc_reg_operand" "r"))
10708 (clobber (match_scratch:SI 3 "=q"))
10709 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10710 (match_operand:SI 4 "gpc_reg_operand" "r"))
10711 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10712 (match_operand:SI 5 "gpc_reg_operand" "r"))])]
10713 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 4"
10714 "{stsi|stswi} %2,%1,%O0"
10715 [(set_attr "type" "store_ux")
10716 (set_attr "cell_micro" "always")])
10718 (define_expand "setmemsi"
10719 [(parallel [(set (match_operand:BLK 0 "" "")
10720 (match_operand 2 "const_int_operand" ""))
10721 (use (match_operand:SI 1 "" ""))
10722 (use (match_operand:SI 3 "" ""))])]
10726 /* If value to set is not zero, use the library routine. */
10727 if (operands[2] != const0_rtx)
10730 if (expand_block_clear (operands))
10736 ;; String/block move insn.
10737 ;; Argument 0 is the destination
10738 ;; Argument 1 is the source
10739 ;; Argument 2 is the length
10740 ;; Argument 3 is the alignment
10742 (define_expand "movmemsi"
10743 [(parallel [(set (match_operand:BLK 0 "" "")
10744 (match_operand:BLK 1 "" ""))
10745 (use (match_operand:SI 2 "" ""))
10746 (use (match_operand:SI 3 "" ""))])]
10750 if (expand_block_move (operands))
10756 ;; Move up to 32 bytes at a time. The fixed registers are needed because the
10757 ;; register allocator doesn't have a clue about allocating 8 word registers.
10758 ;; rD/rS = r5 is preferred, efficient form.
10759 (define_expand "movmemsi_8reg"
10760 [(parallel [(set (match_operand 0 "" "")
10761 (match_operand 1 "" ""))
10762 (use (match_operand 2 "" ""))
10763 (use (match_operand 3 "" ""))
10764 (clobber (reg:SI 5))
10765 (clobber (reg:SI 6))
10766 (clobber (reg:SI 7))
10767 (clobber (reg:SI 8))
10768 (clobber (reg:SI 9))
10769 (clobber (reg:SI 10))
10770 (clobber (reg:SI 11))
10771 (clobber (reg:SI 12))
10772 (clobber (match_scratch:SI 4 ""))])]
10777 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
10778 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
10779 (use (match_operand:SI 2 "immediate_operand" "i"))
10780 (use (match_operand:SI 3 "immediate_operand" "i"))
10781 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10782 (clobber (reg:SI 6))
10783 (clobber (reg:SI 7))
10784 (clobber (reg:SI 8))
10785 (clobber (reg:SI 9))
10786 (clobber (reg:SI 10))
10787 (clobber (reg:SI 11))
10788 (clobber (reg:SI 12))
10789 (clobber (match_scratch:SI 5 "=q"))]
10790 "TARGET_STRING && TARGET_POWER
10791 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
10792 || INTVAL (operands[2]) == 0)
10793 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
10794 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
10795 && REGNO (operands[4]) == 5"
10796 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10797 [(set_attr "type" "store_ux")
10798 (set_attr "cell_micro" "always")
10799 (set_attr "length" "8")])
10802 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
10803 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
10804 (use (match_operand:SI 2 "immediate_operand" "i"))
10805 (use (match_operand:SI 3 "immediate_operand" "i"))
10806 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10807 (clobber (reg:SI 6))
10808 (clobber (reg:SI 7))
10809 (clobber (reg:SI 8))
10810 (clobber (reg:SI 9))
10811 (clobber (reg:SI 10))
10812 (clobber (reg:SI 11))
10813 (clobber (reg:SI 12))
10814 (clobber (match_scratch:SI 5 "=X"))]
10815 "TARGET_STRING && ! TARGET_POWER
10816 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
10817 || INTVAL (operands[2]) == 0)
10818 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
10819 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
10820 && REGNO (operands[4]) == 5"
10821 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10822 [(set_attr "type" "store_ux")
10823 (set_attr "cell_micro" "always")
10824 (set_attr "length" "8")])
10826 ;; Move up to 24 bytes at a time. The fixed registers are needed because the
10827 ;; register allocator doesn't have a clue about allocating 6 word registers.
10828 ;; rD/rS = r5 is preferred, efficient form.
10829 (define_expand "movmemsi_6reg"
10830 [(parallel [(set (match_operand 0 "" "")
10831 (match_operand 1 "" ""))
10832 (use (match_operand 2 "" ""))
10833 (use (match_operand 3 "" ""))
10834 (clobber (reg:SI 5))
10835 (clobber (reg:SI 6))
10836 (clobber (reg:SI 7))
10837 (clobber (reg:SI 8))
10838 (clobber (reg:SI 9))
10839 (clobber (reg:SI 10))
10840 (clobber (match_scratch:SI 4 ""))])]
10845 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
10846 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
10847 (use (match_operand:SI 2 "immediate_operand" "i"))
10848 (use (match_operand:SI 3 "immediate_operand" "i"))
10849 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10850 (clobber (reg:SI 6))
10851 (clobber (reg:SI 7))
10852 (clobber (reg:SI 8))
10853 (clobber (reg:SI 9))
10854 (clobber (reg:SI 10))
10855 (clobber (match_scratch:SI 5 "=q"))]
10856 "TARGET_STRING && TARGET_POWER
10857 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 24
10858 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
10859 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
10860 && REGNO (operands[4]) == 5"
10861 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10862 [(set_attr "type" "store_ux")
10863 (set_attr "cell_micro" "always")
10864 (set_attr "length" "8")])
10867 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
10868 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
10869 (use (match_operand:SI 2 "immediate_operand" "i"))
10870 (use (match_operand:SI 3 "immediate_operand" "i"))
10871 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10872 (clobber (reg:SI 6))
10873 (clobber (reg:SI 7))
10874 (clobber (reg:SI 8))
10875 (clobber (reg:SI 9))
10876 (clobber (reg:SI 10))
10877 (clobber (match_scratch:SI 5 "=X"))]
10878 "TARGET_STRING && ! TARGET_POWER
10879 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
10880 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
10881 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
10882 && REGNO (operands[4]) == 5"
10883 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10884 [(set_attr "type" "store_ux")
10885 (set_attr "cell_micro" "always")
10886 (set_attr "length" "8")])
10888 ;; Move up to 16 bytes at a time, using 4 fixed registers to avoid spill
10889 ;; problems with TImode.
10890 ;; rD/rS = r5 is preferred, efficient form.
10891 (define_expand "movmemsi_4reg"
10892 [(parallel [(set (match_operand 0 "" "")
10893 (match_operand 1 "" ""))
10894 (use (match_operand 2 "" ""))
10895 (use (match_operand 3 "" ""))
10896 (clobber (reg:SI 5))
10897 (clobber (reg:SI 6))
10898 (clobber (reg:SI 7))
10899 (clobber (reg:SI 8))
10900 (clobber (match_scratch:SI 4 ""))])]
10905 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
10906 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
10907 (use (match_operand:SI 2 "immediate_operand" "i"))
10908 (use (match_operand:SI 3 "immediate_operand" "i"))
10909 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10910 (clobber (reg:SI 6))
10911 (clobber (reg:SI 7))
10912 (clobber (reg:SI 8))
10913 (clobber (match_scratch:SI 5 "=q"))]
10914 "TARGET_STRING && TARGET_POWER
10915 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
10916 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
10917 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
10918 && REGNO (operands[4]) == 5"
10919 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10920 [(set_attr "type" "store_ux")
10921 (set_attr "cell_micro" "always")
10922 (set_attr "length" "8")])
10925 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
10926 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
10927 (use (match_operand:SI 2 "immediate_operand" "i"))
10928 (use (match_operand:SI 3 "immediate_operand" "i"))
10929 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10930 (clobber (reg:SI 6))
10931 (clobber (reg:SI 7))
10932 (clobber (reg:SI 8))
10933 (clobber (match_scratch:SI 5 "=X"))]
10934 "TARGET_STRING && ! TARGET_POWER
10935 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
10936 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
10937 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
10938 && REGNO (operands[4]) == 5"
10939 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10940 [(set_attr "type" "store_ux")
10941 (set_attr "cell_micro" "always")
10942 (set_attr "length" "8")])
10944 ;; Move up to 8 bytes at a time.
10945 (define_expand "movmemsi_2reg"
10946 [(parallel [(set (match_operand 0 "" "")
10947 (match_operand 1 "" ""))
10948 (use (match_operand 2 "" ""))
10949 (use (match_operand 3 "" ""))
10950 (clobber (match_scratch:DI 4 ""))
10951 (clobber (match_scratch:SI 5 ""))])]
10952 "TARGET_STRING && ! TARGET_POWERPC64"
10956 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
10957 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
10958 (use (match_operand:SI 2 "immediate_operand" "i"))
10959 (use (match_operand:SI 3 "immediate_operand" "i"))
10960 (clobber (match_scratch:DI 4 "=&r"))
10961 (clobber (match_scratch:SI 5 "=q"))]
10962 "TARGET_STRING && TARGET_POWER && ! TARGET_POWERPC64
10963 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
10964 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10965 [(set_attr "type" "store_ux")
10966 (set_attr "cell_micro" "always")
10967 (set_attr "length" "8")])
10970 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
10971 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
10972 (use (match_operand:SI 2 "immediate_operand" "i"))
10973 (use (match_operand:SI 3 "immediate_operand" "i"))
10974 (clobber (match_scratch:DI 4 "=&r"))
10975 (clobber (match_scratch:SI 5 "=X"))]
10976 "TARGET_STRING && ! TARGET_POWER && ! TARGET_POWERPC64
10977 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
10978 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10979 [(set_attr "type" "store_ux")
10980 (set_attr "cell_micro" "always")
10981 (set_attr "length" "8")])
10983 ;; Move up to 4 bytes at a time.
10984 (define_expand "movmemsi_1reg"
10985 [(parallel [(set (match_operand 0 "" "")
10986 (match_operand 1 "" ""))
10987 (use (match_operand 2 "" ""))
10988 (use (match_operand 3 "" ""))
10989 (clobber (match_scratch:SI 4 ""))
10990 (clobber (match_scratch:SI 5 ""))])]
10995 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
10996 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
10997 (use (match_operand:SI 2 "immediate_operand" "i"))
10998 (use (match_operand:SI 3 "immediate_operand" "i"))
10999 (clobber (match_scratch:SI 4 "=&r"))
11000 (clobber (match_scratch:SI 5 "=q"))]
11001 "TARGET_STRING && TARGET_POWER
11002 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
11003 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
11004 [(set_attr "type" "store_ux")
11005 (set_attr "cell_micro" "always")
11006 (set_attr "length" "8")])
11009 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
11010 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
11011 (use (match_operand:SI 2 "immediate_operand" "i"))
11012 (use (match_operand:SI 3 "immediate_operand" "i"))
11013 (clobber (match_scratch:SI 4 "=&r"))
11014 (clobber (match_scratch:SI 5 "=X"))]
11015 "TARGET_STRING && ! TARGET_POWER
11016 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
11017 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
11018 [(set_attr "type" "store_ux")
11019 (set_attr "cell_micro" "always")
11020 (set_attr "length" "8")])
11022 ;; Define insns that do load or store with update. Some of these we can
11023 ;; get by using pre-decrement or pre-increment, but the hardware can also
11024 ;; do cases where the increment is not the size of the object.
11026 ;; In all these cases, we use operands 0 and 1 for the register being
11027 ;; incremented because those are the operands that local-alloc will
11028 ;; tie and these are the pair most likely to be tieable (and the ones
11029 ;; that will benefit the most).
11031 (define_insn "*movdi_update1"
11032 [(set (match_operand:DI 3 "gpc_reg_operand" "=r,r")
11033 (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
11034 (match_operand:DI 2 "reg_or_aligned_short_operand" "r,I"))))
11035 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
11036 (plus:DI (match_dup 1) (match_dup 2)))]
11037 "TARGET_POWERPC64 && TARGET_UPDATE
11038 && (!avoiding_indexed_address_p (DImode)
11039 || !gpc_reg_operand (operands[2], DImode))"
11043 [(set_attr "type" "load_ux,load_u")])
11045 (define_insn "movdi_<mode>_update"
11046 [(set (mem:DI (plus:P (match_operand:P 1 "gpc_reg_operand" "0,0")
11047 (match_operand:P 2 "reg_or_aligned_short_operand" "r,I")))
11048 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
11049 (set (match_operand:P 0 "gpc_reg_operand" "=b,b")
11050 (plus:P (match_dup 1) (match_dup 2)))]
11051 "TARGET_POWERPC64 && TARGET_UPDATE
11052 && (!avoiding_indexed_address_p (Pmode)
11053 || !gpc_reg_operand (operands[2], Pmode)
11054 || (REG_P (operands[0])
11055 && REGNO (operands[0]) == STACK_POINTER_REGNUM))"
11059 [(set_attr "type" "store_ux,store_u")])
11061 ;; This pattern is only conditional on TARGET_POWERPC64, as it is
11062 ;; needed for stack allocation, even if the user passes -mno-update.
11063 (define_insn "movdi_<mode>_update_stack"
11064 [(set (mem:DI (plus:P (match_operand:P 1 "gpc_reg_operand" "0,0")
11065 (match_operand:P 2 "reg_or_aligned_short_operand" "r,I")))
11066 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
11067 (set (match_operand:P 0 "gpc_reg_operand" "=b,b")
11068 (plus:P (match_dup 1) (match_dup 2)))]
11073 [(set_attr "type" "store_ux,store_u")])
11075 (define_insn "*movsi_update1"
11076 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
11077 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11078 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
11079 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11080 (plus:SI (match_dup 1) (match_dup 2)))]
11082 && (!avoiding_indexed_address_p (SImode)
11083 || !gpc_reg_operand (operands[2], SImode))"
11085 {lux|lwzux} %3,%0,%2
11086 {lu|lwzu} %3,%2(%0)"
11087 [(set_attr "type" "load_ux,load_u")])
11089 (define_insn "*movsi_update2"
11090 [(set (match_operand:DI 3 "gpc_reg_operand" "=r")
11092 (mem:SI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0")
11093 (match_operand:DI 2 "gpc_reg_operand" "r")))))
11094 (set (match_operand:DI 0 "gpc_reg_operand" "=b")
11095 (plus:DI (match_dup 1) (match_dup 2)))]
11096 "TARGET_POWERPC64 && rs6000_gen_cell_microcode
11097 && !avoiding_indexed_address_p (DImode)"
11099 [(set_attr "type" "load_ext_ux")])
11101 (define_insn "movsi_update"
11102 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11103 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
11104 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
11105 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11106 (plus:SI (match_dup 1) (match_dup 2)))]
11108 && (!avoiding_indexed_address_p (SImode)
11109 || !gpc_reg_operand (operands[2], SImode)
11110 || (REG_P (operands[0])
11111 && REGNO (operands[0]) == STACK_POINTER_REGNUM))"
11113 {stux|stwux} %3,%0,%2
11114 {stu|stwu} %3,%2(%0)"
11115 [(set_attr "type" "store_ux,store_u")])
11117 ;; This is an unconditional pattern; needed for stack allocation, even
11118 ;; if the user passes -mno-update.
11119 (define_insn "movsi_update_stack"
11120 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11121 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
11122 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
11123 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11124 (plus:SI (match_dup 1) (match_dup 2)))]
11127 {stux|stwux} %3,%0,%2
11128 {stu|stwu} %3,%2(%0)"
11129 [(set_attr "type" "store_ux,store_u")])
11131 (define_insn "*movhi_update1"
11132 [(set (match_operand:HI 3 "gpc_reg_operand" "=r,r")
11133 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11134 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
11135 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11136 (plus:SI (match_dup 1) (match_dup 2)))]
11138 && (!avoiding_indexed_address_p (SImode)
11139 || !gpc_reg_operand (operands[2], SImode))"
11143 [(set_attr "type" "load_ux,load_u")])
11145 (define_insn "*movhi_update2"
11146 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
11148 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11149 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
11150 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11151 (plus:SI (match_dup 1) (match_dup 2)))]
11153 && (!avoiding_indexed_address_p (SImode)
11154 || !gpc_reg_operand (operands[2], SImode))"
11158 [(set_attr "type" "load_ux,load_u")])
11160 (define_insn "*movhi_update3"
11161 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
11163 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11164 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
11165 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11166 (plus:SI (match_dup 1) (match_dup 2)))]
11167 "TARGET_UPDATE && rs6000_gen_cell_microcode
11168 && (!avoiding_indexed_address_p (SImode)
11169 || !gpc_reg_operand (operands[2], SImode))"
11173 [(set_attr "type" "load_ext_ux,load_ext_u")])
11175 (define_insn "*movhi_update4"
11176 [(set (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11177 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
11178 (match_operand:HI 3 "gpc_reg_operand" "r,r"))
11179 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11180 (plus:SI (match_dup 1) (match_dup 2)))]
11182 && (!avoiding_indexed_address_p (SImode)
11183 || !gpc_reg_operand (operands[2], SImode))"
11187 [(set_attr "type" "store_ux,store_u")])
11189 (define_insn "*movqi_update1"
11190 [(set (match_operand:QI 3 "gpc_reg_operand" "=r,r")
11191 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11192 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
11193 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11194 (plus:SI (match_dup 1) (match_dup 2)))]
11196 && (!avoiding_indexed_address_p (SImode)
11197 || !gpc_reg_operand (operands[2], SImode))"
11201 [(set_attr "type" "load_ux,load_u")])
11203 (define_insn "*movqi_update2"
11204 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
11206 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11207 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
11208 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11209 (plus:SI (match_dup 1) (match_dup 2)))]
11211 && (!avoiding_indexed_address_p (SImode)
11212 || !gpc_reg_operand (operands[2], SImode))"
11216 [(set_attr "type" "load_ux,load_u")])
11218 (define_insn "*movqi_update3"
11219 [(set (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11220 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
11221 (match_operand:QI 3 "gpc_reg_operand" "r,r"))
11222 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11223 (plus:SI (match_dup 1) (match_dup 2)))]
11225 && (!avoiding_indexed_address_p (SImode)
11226 || !gpc_reg_operand (operands[2], SImode))"
11230 [(set_attr "type" "store_ux,store_u")])
11232 (define_insn "*movsf_update1"
11233 [(set (match_operand:SF 3 "gpc_reg_operand" "=f,f")
11234 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11235 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
11236 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11237 (plus:SI (match_dup 1) (match_dup 2)))]
11238 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT && TARGET_UPDATE
11239 && (!avoiding_indexed_address_p (SImode)
11240 || !gpc_reg_operand (operands[2], SImode))"
11244 [(set_attr "type" "fpload_ux,fpload_u")])
11246 (define_insn "*movsf_update2"
11247 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11248 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
11249 (match_operand:SF 3 "gpc_reg_operand" "f,f"))
11250 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11251 (plus:SI (match_dup 1) (match_dup 2)))]
11252 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT && TARGET_UPDATE
11253 && (!avoiding_indexed_address_p (SImode)
11254 || !gpc_reg_operand (operands[2], SImode))"
11258 [(set_attr "type" "fpstore_ux,fpstore_u")])
11260 (define_insn "*movsf_update3"
11261 [(set (match_operand:SF 3 "gpc_reg_operand" "=r,r")
11262 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11263 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
11264 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11265 (plus:SI (match_dup 1) (match_dup 2)))]
11266 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE
11267 && (!avoiding_indexed_address_p (SImode)
11268 || !gpc_reg_operand (operands[2], SImode))"
11270 {lux|lwzux} %3,%0,%2
11271 {lu|lwzu} %3,%2(%0)"
11272 [(set_attr "type" "load_ux,load_u")])
11274 (define_insn "*movsf_update4"
11275 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11276 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
11277 (match_operand:SF 3 "gpc_reg_operand" "r,r"))
11278 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11279 (plus:SI (match_dup 1) (match_dup 2)))]
11280 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE
11281 && (!avoiding_indexed_address_p (SImode)
11282 || !gpc_reg_operand (operands[2], SImode))"
11284 {stux|stwux} %3,%0,%2
11285 {stu|stwu} %3,%2(%0)"
11286 [(set_attr "type" "store_ux,store_u")])
11288 (define_insn "*movdf_update1"
11289 [(set (match_operand:DF 3 "gpc_reg_operand" "=d,d")
11290 (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11291 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
11292 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11293 (plus:SI (match_dup 1) (match_dup 2)))]
11294 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_UPDATE
11295 && (!avoiding_indexed_address_p (SImode)
11296 || !gpc_reg_operand (operands[2], SImode))"
11300 [(set_attr "type" "fpload_ux,fpload_u")])
11302 (define_insn "*movdf_update2"
11303 [(set (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11304 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
11305 (match_operand:DF 3 "gpc_reg_operand" "d,d"))
11306 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11307 (plus:SI (match_dup 1) (match_dup 2)))]
11308 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_UPDATE
11309 && (!avoiding_indexed_address_p (SImode)
11310 || !gpc_reg_operand (operands[2], SImode))"
11314 [(set_attr "type" "fpstore_ux,fpstore_u")])
11316 ;; Peephole to convert two consecutive FP loads or stores into lfq/stfq.
11318 (define_insn "*lfq_power2"
11319 [(set (match_operand:V2DF 0 "gpc_reg_operand" "=f")
11320 (match_operand:V2DF 1 "memory_operand" ""))]
11322 && TARGET_HARD_FLOAT && TARGET_FPRS"
11326 [(set (match_operand:DF 0 "gpc_reg_operand" "")
11327 (match_operand:DF 1 "memory_operand" ""))
11328 (set (match_operand:DF 2 "gpc_reg_operand" "")
11329 (match_operand:DF 3 "memory_operand" ""))]
11331 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
11332 && registers_ok_for_quad_peep (operands[0], operands[2])
11333 && mems_ok_for_quad_peep (operands[1], operands[3])"
11334 [(set (match_dup 0)
11336 "operands[1] = widen_memory_access (operands[1], V2DFmode, 0);
11337 operands[0] = gen_rtx_REG (V2DFmode, REGNO (operands[0]));")
11339 (define_insn "*stfq_power2"
11340 [(set (match_operand:V2DF 0 "memory_operand" "")
11341 (match_operand:V2DF 1 "gpc_reg_operand" "f"))]
11343 && TARGET_HARD_FLOAT && TARGET_FPRS"
11344 "stfq%U0%X0 %1,%0")
11348 [(set (match_operand:DF 0 "memory_operand" "")
11349 (match_operand:DF 1 "gpc_reg_operand" ""))
11350 (set (match_operand:DF 2 "memory_operand" "")
11351 (match_operand:DF 3 "gpc_reg_operand" ""))]
11353 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
11354 && registers_ok_for_quad_peep (operands[1], operands[3])
11355 && mems_ok_for_quad_peep (operands[0], operands[2])"
11356 [(set (match_dup 0)
11358 "operands[0] = widen_memory_access (operands[0], V2DFmode, 0);
11359 operands[1] = gen_rtx_REG (V2DFmode, REGNO (operands[1]));")
11361 ;; After inserting conditional returns we can sometimes have
11362 ;; unnecessary register moves. Unfortunately we cannot have a
11363 ;; modeless peephole here, because some single SImode sets have early
11364 ;; clobber outputs. Although those sets expand to multi-ppc-insn
11365 ;; sequences, using get_attr_length here will smash the operands
11366 ;; array. Neither is there an early_cobbler_p predicate.
11367 ;; Disallow subregs for E500 so we don't munge frob_di_df_2.
11369 [(set (match_operand:DF 0 "gpc_reg_operand" "")
11370 (match_operand:DF 1 "any_operand" ""))
11371 (set (match_operand:DF 2 "gpc_reg_operand" "")
11373 "!(TARGET_E500_DOUBLE && GET_CODE (operands[2]) == SUBREG)
11374 && peep2_reg_dead_p (2, operands[0])"
11375 [(set (match_dup 2) (match_dup 1))])
11378 [(set (match_operand:SF 0 "gpc_reg_operand" "")
11379 (match_operand:SF 1 "any_operand" ""))
11380 (set (match_operand:SF 2 "gpc_reg_operand" "")
11382 "peep2_reg_dead_p (2, operands[0])"
11383 [(set (match_dup 2) (match_dup 1))])
11388 ;; Mode attributes for different ABIs.
11389 (define_mode_iterator TLSmode [(SI "! TARGET_64BIT") (DI "TARGET_64BIT")])
11390 (define_mode_attr tls_abi_suffix [(SI "32") (DI "64")])
11391 (define_mode_attr tls_sysv_suffix [(SI "si") (DI "di")])
11392 (define_mode_attr tls_insn_suffix [(SI "wz") (DI "d")])
11394 (define_insn_and_split "tls_gd_aix<TLSmode:tls_abi_suffix>"
11395 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11396 (call (mem:TLSmode (match_operand:TLSmode 3 "symbol_ref_operand" "s"))
11397 (match_operand 4 "" "g")))
11398 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11399 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11401 (clobber (reg:SI LR_REGNO))]
11402 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX"
11404 if (TARGET_CMODEL != CMODEL_SMALL)
11405 return "addis %0,%1,%2@got@tlsgd@ha\;addi %0,%0,%2@got@tlsgd@l\;bl %z3\;%.";
11407 return "addi %0,%1,%2@got@tlsgd\;bl %z3\;%.";
11409 "&& TARGET_TLS_MARKERS"
11410 [(set (match_dup 0)
11411 (unspec:TLSmode [(match_dup 1)
11414 (parallel [(set (match_dup 0)
11415 (call (mem:TLSmode (match_dup 3))
11417 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD)
11418 (clobber (reg:SI LR_REGNO))])]
11420 [(set_attr "type" "two")
11421 (set (attr "length")
11422 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
11426 (define_insn_and_split "tls_gd_sysv<TLSmode:tls_sysv_suffix>"
11427 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11428 (call (mem:TLSmode (match_operand:TLSmode 3 "symbol_ref_operand" "s"))
11429 (match_operand 4 "" "g")))
11430 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11431 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11433 (clobber (reg:SI LR_REGNO))]
11434 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4"
11438 if (TARGET_SECURE_PLT && flag_pic == 2)
11439 return "addi %0,%1,%2@got@tlsgd\;bl %z3+32768@plt";
11441 return "addi %0,%1,%2@got@tlsgd\;bl %z3@plt";
11444 return "addi %0,%1,%2@got@tlsgd\;bl %z3";
11446 "&& TARGET_TLS_MARKERS"
11447 [(set (match_dup 0)
11448 (unspec:TLSmode [(match_dup 1)
11451 (parallel [(set (match_dup 0)
11452 (call (mem:TLSmode (match_dup 3))
11454 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD)
11455 (clobber (reg:SI LR_REGNO))])]
11457 [(set_attr "type" "two")
11458 (set_attr "length" "8")])
11460 (define_insn_and_split "*tls_gd<TLSmode:tls_abi_suffix>"
11461 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11462 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11463 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11465 "HAVE_AS_TLS && TARGET_TLS_MARKERS"
11466 "addi %0,%1,%2@got@tlsgd"
11467 "&& TARGET_CMODEL != CMODEL_SMALL"
11468 [(set (match_dup 3)
11469 (plus:TLSmode (match_dup 1)
11471 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD))))
11473 (lo_sum:TLSmode (match_dup 3)
11474 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD)))]
11477 operands[3] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
11479 [(set (attr "length")
11480 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
11484 (define_insn "*tls_gd_high<TLSmode:tls_abi_suffix>"
11485 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11486 (plus:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11488 (unspec:TLSmode [(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11490 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
11491 "addis %0,%1,%2@got@tlsgd@ha"
11492 [(set_attr "length" "4")])
11494 (define_insn "*tls_gd_low<TLSmode:tls_abi_suffix>"
11495 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11496 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11497 (unspec:TLSmode [(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11499 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
11500 "addi %0,%1,%2@got@tlsgd@l"
11501 [(set_attr "length" "4")])
11503 (define_insn "*tls_gd_call_aix<TLSmode:tls_abi_suffix>"
11504 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11505 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
11506 (match_operand 2 "" "g")))
11507 (unspec:TLSmode [(match_operand:TLSmode 3 "rs6000_tls_symbol_ref" "")]
11509 (clobber (reg:SI LR_REGNO))]
11510 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX && TARGET_TLS_MARKERS"
11511 "bl %z1(%3@tlsgd)\;%."
11512 [(set_attr "type" "branch")
11513 (set_attr "length" "8")])
11515 (define_insn "*tls_gd_call_sysv<TLSmode:tls_abi_suffix>"
11516 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11517 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
11518 (match_operand 2 "" "g")))
11519 (unspec:TLSmode [(match_operand:TLSmode 3 "rs6000_tls_symbol_ref" "")]
11521 (clobber (reg:SI LR_REGNO))]
11522 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4 && TARGET_TLS_MARKERS"
11526 if (TARGET_SECURE_PLT && flag_pic == 2)
11527 return "bl %z1+32768(%3@tlsgd)@plt";
11528 return "bl %z1(%3@tlsgd)@plt";
11530 return "bl %z1(%3@tlsgd)";
11532 [(set_attr "type" "branch")
11533 (set_attr "length" "4")])
11535 (define_insn_and_split "tls_ld_aix<TLSmode:tls_abi_suffix>"
11536 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11537 (call (mem:TLSmode (match_operand:TLSmode 2 "symbol_ref_operand" "s"))
11538 (match_operand 3 "" "g")))
11539 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
11541 (clobber (reg:SI LR_REGNO))]
11542 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX"
11544 if (TARGET_CMODEL != CMODEL_SMALL)
11545 return "addis %0,%1,%&@got@tlsld@ha\;addi %0,%0,%&@got@tlsld@l\;bl %z2\;%.";
11547 return "addi %0,%1,%&@got@tlsld\;bl %z2\;%.";
11549 "&& TARGET_TLS_MARKERS"
11550 [(set (match_dup 0)
11551 (unspec:TLSmode [(match_dup 1)]
11553 (parallel [(set (match_dup 0)
11554 (call (mem:TLSmode (match_dup 2))
11556 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
11557 (clobber (reg:SI LR_REGNO))])]
11559 [(set_attr "type" "two")
11560 (set (attr "length")
11561 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
11565 (define_insn_and_split "tls_ld_sysv<TLSmode:tls_sysv_suffix>"
11566 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11567 (call (mem:TLSmode (match_operand:TLSmode 2 "symbol_ref_operand" "s"))
11568 (match_operand 3 "" "g")))
11569 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
11571 (clobber (reg:SI LR_REGNO))]
11572 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4"
11576 if (TARGET_SECURE_PLT && flag_pic == 2)
11577 return "addi %0,%1,%&@got@tlsld\;bl %z2+32768@plt";
11579 return "addi %0,%1,%&@got@tlsld\;bl %z2@plt";
11582 return "addi %0,%1,%&@got@tlsld\;bl %z2";
11584 "&& TARGET_TLS_MARKERS"
11585 [(set (match_dup 0)
11586 (unspec:TLSmode [(match_dup 1)]
11588 (parallel [(set (match_dup 0)
11589 (call (mem:TLSmode (match_dup 2))
11591 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
11592 (clobber (reg:SI LR_REGNO))])]
11594 [(set_attr "length" "8")])
11596 (define_insn_and_split "*tls_ld<TLSmode:tls_abi_suffix>"
11597 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11598 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
11600 "HAVE_AS_TLS && TARGET_TLS_MARKERS"
11601 "addi %0,%1,%&@got@tlsld"
11602 "&& TARGET_CMODEL != CMODEL_SMALL"
11603 [(set (match_dup 2)
11604 (plus:TLSmode (match_dup 1)
11606 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD))))
11608 (lo_sum:TLSmode (match_dup 2)
11609 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)))]
11612 operands[2] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
11614 [(set (attr "length")
11615 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
11619 (define_insn "*tls_ld_high<TLSmode:tls_abi_suffix>"
11620 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11621 (plus:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11623 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD))))]
11624 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
11625 "addis %0,%1,%&@got@tlsld@ha"
11626 [(set_attr "length" "4")])
11628 (define_insn "*tls_ld_low<TLSmode:tls_abi_suffix>"
11629 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11630 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11631 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)))]
11632 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
11633 "addi %0,%1,%&@got@tlsld@l"
11634 [(set_attr "length" "4")])
11636 (define_insn "*tls_ld_call_aix<TLSmode:tls_abi_suffix>"
11637 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11638 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
11639 (match_operand 2 "" "g")))
11640 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
11641 (clobber (reg:SI LR_REGNO))]
11642 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX && TARGET_TLS_MARKERS"
11643 "bl %z1(%&@tlsld)\;%."
11644 [(set_attr "type" "branch")
11645 (set_attr "length" "8")])
11647 (define_insn "*tls_ld_call_sysv<TLSmode:tls_abi_suffix>"
11648 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11649 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
11650 (match_operand 2 "" "g")))
11651 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
11652 (clobber (reg:SI LR_REGNO))]
11653 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4 && TARGET_TLS_MARKERS"
11657 if (TARGET_SECURE_PLT && flag_pic == 2)
11658 return "bl %z1+32768(%&@tlsld)@plt";
11659 return "bl %z1(%&@tlsld)@plt";
11661 return "bl %z1(%&@tlsld)";
11663 [(set_attr "type" "branch")
11664 (set_attr "length" "4")])
11666 (define_insn "tls_dtprel_<TLSmode:tls_abi_suffix>"
11667 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11668 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11669 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11670 UNSPEC_TLSDTPREL))]
11672 "addi %0,%1,%2@dtprel")
11674 (define_insn "tls_dtprel_ha_<TLSmode:tls_abi_suffix>"
11675 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11676 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11677 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11678 UNSPEC_TLSDTPRELHA))]
11680 "addis %0,%1,%2@dtprel@ha")
11682 (define_insn "tls_dtprel_lo_<TLSmode:tls_abi_suffix>"
11683 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11684 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11685 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11686 UNSPEC_TLSDTPRELLO))]
11688 "addi %0,%1,%2@dtprel@l")
11690 (define_insn_and_split "tls_got_dtprel_<TLSmode:tls_abi_suffix>"
11691 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11692 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11693 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11694 UNSPEC_TLSGOTDTPREL))]
11696 "l<TLSmode:tls_insn_suffix> %0,%2@got@dtprel(%1)"
11697 "&& TARGET_CMODEL != CMODEL_SMALL"
11698 [(set (match_dup 3)
11699 (plus:TLSmode (match_dup 1)
11701 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGOTDTPREL))))
11703 (lo_sum:TLSmode (match_dup 3)
11704 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGOTDTPREL)))]
11707 operands[3] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
11709 [(set (attr "length")
11710 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
11714 (define_insn "*tls_got_dtprel_high<TLSmode:tls_abi_suffix>"
11715 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11716 (plus:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11718 (unspec:TLSmode [(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11719 UNSPEC_TLSGOTDTPREL))))]
11720 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
11721 "addis %0,%1,%2@got@dtprel@ha"
11722 [(set_attr "length" "4")])
11724 (define_insn "*tls_got_dtprel_low<TLSmode:tls_abi_suffix>"
11725 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11726 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11727 (unspec:TLSmode [(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11728 UNSPEC_TLSGOTDTPREL)))]
11729 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
11730 "l<TLSmode:tls_insn_suffix> %0,%2@got@dtprel@l(%1)"
11731 [(set_attr "length" "4")])
11733 (define_insn "tls_tprel_<TLSmode:tls_abi_suffix>"
11734 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11735 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11736 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11739 "addi %0,%1,%2@tprel")
11741 (define_insn "tls_tprel_ha_<TLSmode:tls_abi_suffix>"
11742 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11743 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11744 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11745 UNSPEC_TLSTPRELHA))]
11747 "addis %0,%1,%2@tprel@ha")
11749 (define_insn "tls_tprel_lo_<TLSmode:tls_abi_suffix>"
11750 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11751 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11752 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11753 UNSPEC_TLSTPRELLO))]
11755 "addi %0,%1,%2@tprel@l")
11757 ;; "b" output constraint here and on tls_tls input to support linker tls
11758 ;; optimization. The linker may edit the instructions emitted by a
11759 ;; tls_got_tprel/tls_tls pair to addis,addi.
11760 (define_insn_and_split "tls_got_tprel_<TLSmode:tls_abi_suffix>"
11761 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11762 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11763 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11764 UNSPEC_TLSGOTTPREL))]
11766 "l<TLSmode:tls_insn_suffix> %0,%2@got@tprel(%1)"
11767 "&& TARGET_CMODEL != CMODEL_SMALL"
11768 [(set (match_dup 3)
11769 (plus:TLSmode (match_dup 1)
11771 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGOTTPREL))))
11773 (lo_sum:TLSmode (match_dup 3)
11774 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGOTTPREL)))]
11777 operands[3] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
11779 [(set (attr "length")
11780 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
11784 (define_insn "*tls_got_tprel_high<TLSmode:tls_abi_suffix>"
11785 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11786 (plus:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11788 (unspec:TLSmode [(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11789 UNSPEC_TLSGOTTPREL))))]
11790 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
11791 "addis %0,%1,%2@got@tprel@ha"
11792 [(set_attr "length" "4")])
11794 (define_insn "*tls_got_tprel_low<TLSmode:tls_abi_suffix>"
11795 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11796 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11797 (unspec:TLSmode [(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11798 UNSPEC_TLSGOTTPREL)))]
11799 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
11800 "l<TLSmode:tls_insn_suffix> %0,%2@got@tprel@l(%1)"
11801 [(set_attr "length" "4")])
11803 (define_insn "tls_tls_<TLSmode:tls_abi_suffix>"
11804 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11805 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11806 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11809 "add %0,%1,%2@tls")
11811 ;; Next come insns related to the calling sequence.
11813 ;; First, an insn to allocate new stack space for dynamic use (e.g., alloca).
11814 ;; We move the back-chain and decrement the stack pointer.
11816 (define_expand "allocate_stack"
11817 [(set (match_operand 0 "gpc_reg_operand" "")
11818 (minus (reg 1) (match_operand 1 "reg_or_short_operand" "")))
11820 (minus (reg 1) (match_dup 1)))]
11823 { rtx chain = gen_reg_rtx (Pmode);
11824 rtx stack_bot = gen_rtx_MEM (Pmode, stack_pointer_rtx);
11826 rtx insn, par, set, mem;
11828 emit_move_insn (chain, stack_bot);
11830 /* Check stack bounds if necessary. */
11831 if (crtl->limit_stack)
11834 available = expand_binop (Pmode, sub_optab,
11835 stack_pointer_rtx, stack_limit_rtx,
11836 NULL_RTX, 1, OPTAB_WIDEN);
11837 emit_insn (gen_cond_trap (LTU, available, operands[1], const0_rtx));
11840 if (GET_CODE (operands[1]) != CONST_INT
11841 || INTVAL (operands[1]) < -32767
11842 || INTVAL (operands[1]) > 32768)
11844 neg_op0 = gen_reg_rtx (Pmode);
11846 emit_insn (gen_negsi2 (neg_op0, operands[1]));
11848 emit_insn (gen_negdi2 (neg_op0, operands[1]));
11851 neg_op0 = GEN_INT (- INTVAL (operands[1]));
11853 insn = emit_insn ((* ((TARGET_32BIT) ? gen_movsi_update_stack
11854 : gen_movdi_di_update_stack))
11855 (stack_pointer_rtx, stack_pointer_rtx, neg_op0,
11857 /* Since we didn't use gen_frame_mem to generate the MEM, grab
11858 it now and set the alias set/attributes. The above gen_*_update
11859 calls will generate a PARALLEL with the MEM set being the first
11861 par = PATTERN (insn);
11862 gcc_assert (GET_CODE (par) == PARALLEL);
11863 set = XVECEXP (par, 0, 0);
11864 gcc_assert (GET_CODE (set) == SET);
11865 mem = SET_DEST (set);
11866 gcc_assert (MEM_P (mem));
11867 MEM_NOTRAP_P (mem) = 1;
11868 set_mem_alias_set (mem, get_frame_alias_set ());
11870 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
11874 ;; These patterns say how to save and restore the stack pointer. We need not
11875 ;; save the stack pointer at function level since we are careful to
11876 ;; preserve the backchain. At block level, we have to restore the backchain
11877 ;; when we restore the stack pointer.
11879 ;; For nonlocal gotos, we must save both the stack pointer and its
11880 ;; backchain and restore both. Note that in the nonlocal case, the
11881 ;; save area is a memory location.
11883 (define_expand "save_stack_function"
11884 [(match_operand 0 "any_operand" "")
11885 (match_operand 1 "any_operand" "")]
11889 (define_expand "restore_stack_function"
11890 [(match_operand 0 "any_operand" "")
11891 (match_operand 1 "any_operand" "")]
11895 ;; Adjust stack pointer (op0) to a new value (op1).
11896 ;; First copy old stack backchain to new location, and ensure that the
11897 ;; scheduler won't reorder the sp assignment before the backchain write.
11898 (define_expand "restore_stack_block"
11899 [(set (match_dup 2) (match_dup 3))
11900 (set (match_dup 4) (match_dup 2))
11901 (set (match_dup 5) (unspec:BLK [(match_dup 5)] UNSPEC_TIE))
11902 (set (match_operand 0 "register_operand" "")
11903 (match_operand 1 "register_operand" ""))]
11907 operands[1] = force_reg (Pmode, operands[1]);
11908 operands[2] = gen_reg_rtx (Pmode);
11909 operands[3] = gen_frame_mem (Pmode, operands[0]);
11910 operands[4] = gen_frame_mem (Pmode, operands[1]);
11911 operands[5] = gen_frame_mem (BLKmode, operands[0]);
11914 (define_expand "save_stack_nonlocal"
11915 [(set (match_dup 3) (match_dup 4))
11916 (set (match_operand 0 "memory_operand" "") (match_dup 3))
11917 (set (match_dup 2) (match_operand 1 "register_operand" ""))]
11921 int units_per_word = (TARGET_32BIT) ? 4 : 8;
11923 /* Copy the backchain to the first word, sp to the second. */
11924 operands[0] = adjust_address_nv (operands[0], Pmode, 0);
11925 operands[2] = adjust_address_nv (operands[0], Pmode, units_per_word);
11926 operands[3] = gen_reg_rtx (Pmode);
11927 operands[4] = gen_frame_mem (Pmode, operands[1]);
11930 (define_expand "restore_stack_nonlocal"
11931 [(set (match_dup 2) (match_operand 1 "memory_operand" ""))
11932 (set (match_dup 3) (match_dup 4))
11933 (set (match_dup 5) (match_dup 2))
11934 (set (match_dup 6) (unspec:BLK [(match_dup 6)] UNSPEC_TIE))
11935 (set (match_operand 0 "register_operand" "") (match_dup 3))]
11939 int units_per_word = (TARGET_32BIT) ? 4 : 8;
11941 /* Restore the backchain from the first word, sp from the second. */
11942 operands[2] = gen_reg_rtx (Pmode);
11943 operands[3] = gen_reg_rtx (Pmode);
11944 operands[1] = adjust_address_nv (operands[1], Pmode, 0);
11945 operands[4] = adjust_address_nv (operands[1], Pmode, units_per_word);
11946 operands[5] = gen_frame_mem (Pmode, operands[3]);
11947 operands[6] = gen_frame_mem (BLKmode, operands[0]);
11950 ;; TOC register handling.
11952 ;; Code to initialize the TOC register...
11954 (define_insn "load_toc_aix_si"
11955 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11956 (unspec:SI [(const_int 0)] UNSPEC_TOC))
11957 (use (reg:SI 2))])]
11958 "DEFAULT_ABI == ABI_AIX && TARGET_32BIT"
11962 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
11963 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
11964 operands[2] = gen_rtx_REG (Pmode, 2);
11965 return \"{l|lwz} %0,%1(%2)\";
11967 [(set_attr "type" "load")])
11969 (define_insn "load_toc_aix_di"
11970 [(parallel [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11971 (unspec:DI [(const_int 0)] UNSPEC_TOC))
11972 (use (reg:DI 2))])]
11973 "DEFAULT_ABI == ABI_AIX && TARGET_64BIT"
11977 #ifdef TARGET_RELOCATABLE
11978 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\",
11979 !TARGET_MINIMAL_TOC || TARGET_RELOCATABLE);
11981 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
11984 strcat (buf, \"@toc\");
11985 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
11986 operands[2] = gen_rtx_REG (Pmode, 2);
11987 return \"ld %0,%1(%2)\";
11989 [(set_attr "type" "load")])
11991 (define_insn "load_toc_v4_pic_si"
11992 [(set (reg:SI LR_REGNO)
11993 (unspec:SI [(const_int 0)] UNSPEC_TOC))]
11994 "DEFAULT_ABI == ABI_V4 && flag_pic == 1 && TARGET_32BIT"
11995 "bl _GLOBAL_OFFSET_TABLE_@local-4"
11996 [(set_attr "type" "branch")
11997 (set_attr "length" "4")])
11999 (define_insn "load_toc_v4_PIC_1"
12000 [(set (reg:SI LR_REGNO)
12001 (match_operand:SI 0 "immediate_operand" "s"))
12002 (use (unspec [(match_dup 0)] UNSPEC_TOC))]
12003 "TARGET_ELF && DEFAULT_ABI != ABI_AIX
12004 && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
12005 "bcl 20,31,%0\\n%0:"
12006 [(set_attr "type" "branch")
12007 (set_attr "length" "4")])
12009 (define_insn "load_toc_v4_PIC_1b"
12010 [(set (reg:SI LR_REGNO)
12011 (unspec:SI [(match_operand:SI 0 "immediate_operand" "s")
12012 (label_ref (match_operand 1 "" ""))]
12015 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
12016 "bcl 20,31,$+8\;.long %0-$"
12017 [(set_attr "type" "branch")
12018 (set_attr "length" "8")])
12020 (define_insn "load_toc_v4_PIC_2"
12021 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12022 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
12023 (minus:SI (match_operand:SI 2 "immediate_operand" "s")
12024 (match_operand:SI 3 "immediate_operand" "s")))))]
12025 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
12026 "{l|lwz} %0,%2-%3(%1)"
12027 [(set_attr "type" "load")])
12029 (define_insn "load_toc_v4_PIC_3b"
12030 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
12031 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12033 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
12034 (match_operand:SI 3 "symbol_ref_operand" "s")))))]
12035 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
12036 "{cau|addis} %0,%1,%2-%3@ha")
12038 (define_insn "load_toc_v4_PIC_3c"
12039 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12040 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
12041 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
12042 (match_operand:SI 3 "symbol_ref_operand" "s"))))]
12043 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
12044 "{cal %0,%2-%3@l(%1)|addi %0,%1,%2-%3@l}")
12046 ;; If the TOC is shared over a translation unit, as happens with all
12047 ;; the kinds of PIC that we support, we need to restore the TOC
12048 ;; pointer only when jumping over units of translation.
12049 ;; On Darwin, we need to reload the picbase.
12051 (define_expand "builtin_setjmp_receiver"
12052 [(use (label_ref (match_operand 0 "" "")))]
12053 "(DEFAULT_ABI == ABI_V4 && flag_pic == 1)
12054 || (TARGET_TOC && TARGET_MINIMAL_TOC)
12055 || (DEFAULT_ABI == ABI_DARWIN && flag_pic)"
12059 if (DEFAULT_ABI == ABI_DARWIN)
12061 rtx picrtx = gen_rtx_SYMBOL_REF (Pmode, MACHOPIC_FUNCTION_BASE_NAME);
12062 rtx picreg = gen_rtx_REG (Pmode, RS6000_PIC_OFFSET_TABLE_REGNUM);
12066 crtl->uses_pic_offset_table = 1;
12067 ASM_GENERATE_INTERNAL_LABEL(tmplab, \"LSJR\",
12068 CODE_LABEL_NUMBER (operands[0]));
12069 tmplabrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (tmplab));
12071 emit_insn (gen_load_macho_picbase (tmplabrtx));
12072 emit_move_insn (picreg, gen_rtx_REG (Pmode, LR_REGNO));
12073 emit_insn (gen_macho_correct_pic (picreg, picreg, picrtx, tmplabrtx));
12077 rs6000_emit_load_toc_table (FALSE);
12081 ;; Elf specific ways of loading addresses for non-PIC code.
12082 ;; The output of this could be r0, but we make a very strong
12083 ;; preference for a base register because it will usually
12084 ;; be needed there.
12085 (define_insn "elf_high"
12086 [(set (match_operand:SI 0 "gpc_reg_operand" "=b*r")
12087 (high:SI (match_operand 1 "" "")))]
12088 "TARGET_ELF && ! TARGET_64BIT"
12089 "{liu|lis} %0,%1@ha")
12091 (define_insn "elf_low"
12092 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12093 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,!*r")
12094 (match_operand 2 "" "")))]
12095 "TARGET_ELF && ! TARGET_64BIT"
12097 {cal|la} %0,%2@l(%1)
12098 {ai|addic} %0,%1,%K2")
12100 ;; Largetoc support
12101 (define_insn "largetoc_high"
12102 [(set (match_operand:DI 0 "gpc_reg_operand" "=b")
12103 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "b")
12104 (high:DI (match_operand:DI 2 "" ""))))]
12105 "TARGET_ELF && TARGET_CMODEL != CMODEL_SMALL"
12106 "{cau|addis} %0,%1,%2@ha")
12108 (define_insn "largetoc_low"
12109 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12110 (lo_sum:DI (match_operand:DI 1 "gpc_reg_operand" "b")
12111 (match_operand:DI 2 "" "")))]
12112 "TARGET_ELF && TARGET_CMODEL != CMODEL_SMALL"
12113 "{cal %0,%2@l(%1)|addi %0,%1,%2@l}")
12115 ;; A function pointer under AIX is a pointer to a data area whose first word
12116 ;; contains the actual address of the function, whose second word contains a
12117 ;; pointer to its TOC, and whose third word contains a value to place in the
12118 ;; static chain register (r11). Note that if we load the static chain, our
12119 ;; "trampoline" need not have any executable code.
12121 (define_expand "call_indirect_aix32"
12122 [(set (match_dup 2)
12123 (mem:SI (match_operand:SI 0 "gpc_reg_operand" "")))
12124 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
12127 (mem:SI (plus:SI (match_dup 0)
12129 (parallel [(call (mem:SI (match_dup 2))
12130 (match_operand 1 "" ""))
12131 (use (mem:SI (plus:SI (match_dup 0) (const_int 4))))
12133 (use (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
12134 (clobber (reg:SI LR_REGNO))])]
12137 { operands[2] = gen_reg_rtx (SImode); }")
12139 (define_expand "call_indirect_aix64"
12140 [(set (match_dup 2)
12141 (mem:DI (match_operand:DI 0 "gpc_reg_operand" "")))
12142 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
12145 (mem:DI (plus:DI (match_dup 0)
12147 (parallel [(call (mem:SI (match_dup 2))
12148 (match_operand 1 "" ""))
12149 (use (mem:DI (plus:DI (match_dup 0) (const_int 8))))
12151 (use (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
12152 (clobber (reg:SI LR_REGNO))])]
12155 { operands[2] = gen_reg_rtx (DImode); }")
12157 (define_expand "call_value_indirect_aix32"
12158 [(set (match_dup 3)
12159 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "")))
12160 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
12163 (mem:SI (plus:SI (match_dup 1)
12165 (parallel [(set (match_operand 0 "" "")
12166 (call (mem:SI (match_dup 3))
12167 (match_operand 2 "" "")))
12168 (use (mem:SI (plus:SI (match_dup 1) (const_int 4))))
12170 (use (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
12171 (clobber (reg:SI LR_REGNO))])]
12174 { operands[3] = gen_reg_rtx (SImode); }")
12176 (define_expand "call_value_indirect_aix64"
12177 [(set (match_dup 3)
12178 (mem:DI (match_operand:DI 1 "gpc_reg_operand" "")))
12179 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
12182 (mem:DI (plus:DI (match_dup 1)
12184 (parallel [(set (match_operand 0 "" "")
12185 (call (mem:SI (match_dup 3))
12186 (match_operand 2 "" "")))
12187 (use (mem:DI (plus:DI (match_dup 1) (const_int 8))))
12189 (use (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
12190 (clobber (reg:SI LR_REGNO))])]
12193 { operands[3] = gen_reg_rtx (DImode); }")
12195 ;; Now the definitions for the call and call_value insns
12196 (define_expand "call"
12197 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
12198 (match_operand 1 "" ""))
12199 (use (match_operand 2 "" ""))
12200 (clobber (reg:SI LR_REGNO))])]
12205 if (MACHOPIC_INDIRECT)
12206 operands[0] = machopic_indirect_call_target (operands[0]);
12209 gcc_assert (GET_CODE (operands[0]) == MEM);
12210 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
12212 operands[0] = XEXP (operands[0], 0);
12214 if (GET_CODE (operands[0]) != SYMBOL_REF
12215 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[0]))
12216 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[2]) & CALL_LONG) != 0))
12218 if (INTVAL (operands[2]) & CALL_LONG)
12219 operands[0] = rs6000_longcall_ref (operands[0]);
12221 switch (DEFAULT_ABI)
12225 operands[0] = force_reg (Pmode, operands[0]);
12229 /* AIX function pointers are really pointers to a three word
12231 emit_call_insn (TARGET_32BIT
12232 ? gen_call_indirect_aix32 (force_reg (SImode,
12235 : gen_call_indirect_aix64 (force_reg (DImode,
12241 gcc_unreachable ();
12246 (define_expand "call_value"
12247 [(parallel [(set (match_operand 0 "" "")
12248 (call (mem:SI (match_operand 1 "address_operand" ""))
12249 (match_operand 2 "" "")))
12250 (use (match_operand 3 "" ""))
12251 (clobber (reg:SI LR_REGNO))])]
12256 if (MACHOPIC_INDIRECT)
12257 operands[1] = machopic_indirect_call_target (operands[1]);
12260 gcc_assert (GET_CODE (operands[1]) == MEM);
12261 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
12263 operands[1] = XEXP (operands[1], 0);
12265 if (GET_CODE (operands[1]) != SYMBOL_REF
12266 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[1]))
12267 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[3]) & CALL_LONG) != 0))
12269 if (INTVAL (operands[3]) & CALL_LONG)
12270 operands[1] = rs6000_longcall_ref (operands[1]);
12272 switch (DEFAULT_ABI)
12276 operands[1] = force_reg (Pmode, operands[1]);
12280 /* AIX function pointers are really pointers to a three word
12282 emit_call_insn (TARGET_32BIT
12283 ? gen_call_value_indirect_aix32 (operands[0],
12287 : gen_call_value_indirect_aix64 (operands[0],
12294 gcc_unreachable ();
12299 ;; Call to function in current module. No TOC pointer reload needed.
12300 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
12301 ;; either the function was not prototyped, or it was prototyped as a
12302 ;; variable argument function. It is > 0 if FP registers were passed
12303 ;; and < 0 if they were not.
12305 (define_insn "*call_local32"
12306 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
12307 (match_operand 1 "" "g,g"))
12308 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12309 (clobber (reg:SI LR_REGNO))]
12310 "(INTVAL (operands[2]) & CALL_LONG) == 0"
12313 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12314 output_asm_insn (\"crxor 6,6,6\", operands);
12316 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12317 output_asm_insn (\"creqv 6,6,6\", operands);
12319 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
12321 [(set_attr "type" "branch")
12322 (set_attr "length" "4,8")])
12324 (define_insn "*call_local64"
12325 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
12326 (match_operand 1 "" "g,g"))
12327 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12328 (clobber (reg:SI LR_REGNO))]
12329 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
12332 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12333 output_asm_insn (\"crxor 6,6,6\", operands);
12335 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12336 output_asm_insn (\"creqv 6,6,6\", operands);
12338 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
12340 [(set_attr "type" "branch")
12341 (set_attr "length" "4,8")])
12343 (define_insn "*call_value_local32"
12344 [(set (match_operand 0 "" "")
12345 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
12346 (match_operand 2 "" "g,g")))
12347 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12348 (clobber (reg:SI LR_REGNO))]
12349 "(INTVAL (operands[3]) & CALL_LONG) == 0"
12352 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12353 output_asm_insn (\"crxor 6,6,6\", operands);
12355 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12356 output_asm_insn (\"creqv 6,6,6\", operands);
12358 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
12360 [(set_attr "type" "branch")
12361 (set_attr "length" "4,8")])
12364 (define_insn "*call_value_local64"
12365 [(set (match_operand 0 "" "")
12366 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
12367 (match_operand 2 "" "g,g")))
12368 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12369 (clobber (reg:SI LR_REGNO))]
12370 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
12373 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12374 output_asm_insn (\"crxor 6,6,6\", operands);
12376 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12377 output_asm_insn (\"creqv 6,6,6\", operands);
12379 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
12381 [(set_attr "type" "branch")
12382 (set_attr "length" "4,8")])
12384 ;; Call to function which may be in another module. Restore the TOC
12385 ;; pointer (r2) after the call unless this is System V.
12386 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
12387 ;; either the function was not prototyped, or it was prototyped as a
12388 ;; variable argument function. It is > 0 if FP registers were passed
12389 ;; and < 0 if they were not.
12391 (define_insn_and_split "*call_indirect_nonlocal_aix32_internal"
12392 [(call (mem:SI (match_operand:SI 0 "register_operand" "c,*l"))
12393 (match_operand 1 "" "g,g"))
12394 (use (mem:SI (plus:SI (match_operand:SI 2 "register_operand" "b,b") (const_int 4))))
12396 (use (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
12397 (clobber (reg:SI LR_REGNO))]
12398 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
12400 "&& reload_completed"
12402 (mem:SI (plus:SI (match_dup 2) (const_int 4))))
12403 (parallel [(call (mem:SI (match_dup 0))
12408 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
12409 (clobber (reg:SI LR_REGNO))])]
12411 [(set_attr "type" "jmpreg")
12412 (set_attr "length" "12")])
12414 (define_insn "*call_indirect_nonlocal_aix32"
12415 [(call (mem:SI (match_operand:SI 0 "register_operand" "c,*l"))
12416 (match_operand 1 "" "g,g"))
12420 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
12421 (clobber (reg:SI LR_REGNO))]
12422 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX && reload_completed"
12423 "b%T0l\;{l|lwz} 2,20(1)"
12424 [(set_attr "type" "jmpreg")
12425 (set_attr "length" "8")])
12427 (define_insn "*call_nonlocal_aix32"
12428 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
12429 (match_operand 1 "" "g"))
12430 (use (match_operand:SI 2 "immediate_operand" "O"))
12431 (clobber (reg:SI LR_REGNO))]
12433 && DEFAULT_ABI == ABI_AIX
12434 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12436 [(set_attr "type" "branch")
12437 (set_attr "length" "8")])
12439 (define_insn_and_split "*call_indirect_nonlocal_aix64_internal"
12440 [(call (mem:SI (match_operand:DI 0 "register_operand" "c,*l"))
12441 (match_operand 1 "" "g,g"))
12442 (use (mem:DI (plus:DI (match_operand:DI 2 "register_operand" "b,b")
12445 (use (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
12446 (clobber (reg:SI LR_REGNO))]
12447 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
12449 "&& reload_completed"
12451 (mem:DI (plus:DI (match_dup 2) (const_int 8))))
12452 (parallel [(call (mem:SI (match_dup 0))
12457 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
12458 (clobber (reg:SI LR_REGNO))])]
12460 [(set_attr "type" "jmpreg")
12461 (set_attr "length" "12")])
12463 (define_insn "*call_indirect_nonlocal_aix64"
12464 [(call (mem:SI (match_operand:DI 0 "register_operand" "c,*l"))
12465 (match_operand 1 "" "g,g"))
12469 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
12470 (clobber (reg:SI LR_REGNO))]
12471 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX && reload_completed"
12472 "b%T0l\;ld 2,40(1)"
12473 [(set_attr "type" "jmpreg")
12474 (set_attr "length" "8")])
12476 (define_insn "*call_nonlocal_aix64"
12477 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
12478 (match_operand 1 "" "g"))
12479 (use (match_operand:SI 2 "immediate_operand" "O"))
12480 (clobber (reg:SI LR_REGNO))]
12482 && DEFAULT_ABI == ABI_AIX
12483 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12485 [(set_attr "type" "branch")
12486 (set_attr "length" "8")])
12488 (define_insn_and_split "*call_value_indirect_nonlocal_aix32_internal"
12489 [(set (match_operand 0 "" "")
12490 (call (mem:SI (match_operand:SI 1 "register_operand" "c,*l"))
12491 (match_operand 2 "" "g,g")))
12492 (use (mem:SI (plus:SI (match_operand:SI 3 "register_operand" "b,b")
12495 (use (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
12496 (clobber (reg:SI LR_REGNO))]
12497 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
12499 "&& reload_completed"
12501 (mem:SI (plus:SI (match_dup 3) (const_int 4))))
12502 (parallel [(set (match_dup 0) (call (mem:SI (match_dup 1))
12507 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
12508 (clobber (reg:SI LR_REGNO))])]
12510 [(set_attr "type" "jmpreg")
12511 (set_attr "length" "12")])
12513 (define_insn "*call_value_indirect_nonlocal_aix32"
12514 [(set (match_operand 0 "" "")
12515 (call (mem:SI (match_operand:SI 1 "register_operand" "c,*l"))
12516 (match_operand 2 "" "g,g")))
12520 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
12521 (clobber (reg:SI LR_REGNO))]
12522 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX && reload_completed"
12523 "b%T1l\;{l|lwz} 2,20(1)"
12524 [(set_attr "type" "jmpreg")
12525 (set_attr "length" "8")])
12527 (define_insn "*call_value_nonlocal_aix32"
12528 [(set (match_operand 0 "" "")
12529 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
12530 (match_operand 2 "" "g")))
12531 (use (match_operand:SI 3 "immediate_operand" "O"))
12532 (clobber (reg:SI LR_REGNO))]
12534 && DEFAULT_ABI == ABI_AIX
12535 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12537 [(set_attr "type" "branch")
12538 (set_attr "length" "8")])
12540 (define_insn_and_split "*call_value_indirect_nonlocal_aix64_internal"
12541 [(set (match_operand 0 "" "")
12542 (call (mem:SI (match_operand:DI 1 "register_operand" "c,*l"))
12543 (match_operand 2 "" "g,g")))
12544 (use (mem:DI (plus:DI (match_operand:DI 3 "register_operand" "b,b")
12547 (use (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
12548 (clobber (reg:SI LR_REGNO))]
12549 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
12551 "&& reload_completed"
12553 (mem:DI (plus:DI (match_dup 3) (const_int 8))))
12554 (parallel [(set (match_dup 0) (call (mem:SI (match_dup 1))
12559 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
12560 (clobber (reg:SI LR_REGNO))])]
12562 [(set_attr "type" "jmpreg")
12563 (set_attr "length" "12")])
12565 (define_insn "*call_value_indirect_nonlocal_aix64"
12566 [(set (match_operand 0 "" "")
12567 (call (mem:SI (match_operand:DI 1 "register_operand" "c,*l"))
12568 (match_operand 2 "" "g,g")))
12572 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
12573 (clobber (reg:SI LR_REGNO))]
12574 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX && reload_completed"
12575 "b%T1l\;ld 2,40(1)"
12576 [(set_attr "type" "jmpreg")
12577 (set_attr "length" "8")])
12579 (define_insn "*call_value_nonlocal_aix64"
12580 [(set (match_operand 0 "" "")
12581 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
12582 (match_operand 2 "" "g")))
12583 (use (match_operand:SI 3 "immediate_operand" "O"))
12584 (clobber (reg:SI LR_REGNO))]
12586 && DEFAULT_ABI == ABI_AIX
12587 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12589 [(set_attr "type" "branch")
12590 (set_attr "length" "8")])
12592 ;; A function pointer under System V is just a normal pointer
12593 ;; operands[0] is the function pointer
12594 ;; operands[1] is the stack size to clean up
12595 ;; operands[2] is the value FUNCTION_ARG returns for the VOID argument
12596 ;; which indicates how to set cr1
12598 (define_insn "*call_indirect_nonlocal_sysv<mode>"
12599 [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l,c,*l"))
12600 (match_operand 1 "" "g,g,g,g"))
12601 (use (match_operand:SI 2 "immediate_operand" "O,O,n,n"))
12602 (clobber (reg:SI LR_REGNO))]
12603 "DEFAULT_ABI == ABI_V4
12604 || DEFAULT_ABI == ABI_DARWIN"
12606 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12607 output_asm_insn ("crxor 6,6,6", operands);
12609 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12610 output_asm_insn ("creqv 6,6,6", operands);
12614 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
12615 (set_attr "length" "4,4,8,8")])
12617 (define_insn_and_split "*call_nonlocal_sysv<mode>"
12618 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
12619 (match_operand 1 "" "g,g"))
12620 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12621 (clobber (reg:SI LR_REGNO))]
12622 "(DEFAULT_ABI == ABI_DARWIN
12623 || (DEFAULT_ABI == ABI_V4
12624 && (INTVAL (operands[2]) & CALL_LONG) == 0))"
12626 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12627 output_asm_insn ("crxor 6,6,6", operands);
12629 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12630 output_asm_insn ("creqv 6,6,6", operands);
12633 return output_call(insn, operands, 0, 2);
12635 if (DEFAULT_ABI == ABI_V4 && flag_pic)
12637 gcc_assert (!TARGET_SECURE_PLT);
12638 return "bl %z0@plt";
12644 "DEFAULT_ABI == ABI_V4
12645 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[0])
12646 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12647 [(parallel [(call (mem:SI (match_dup 0))
12649 (use (match_dup 2))
12650 (use (match_dup 3))
12651 (clobber (reg:SI LR_REGNO))])]
12653 operands[3] = pic_offset_table_rtx;
12655 [(set_attr "type" "branch,branch")
12656 (set_attr "length" "4,8")])
12658 (define_insn "*call_nonlocal_sysv_secure<mode>"
12659 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
12660 (match_operand 1 "" "g,g"))
12661 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12662 (use (match_operand:SI 3 "register_operand" "r,r"))
12663 (clobber (reg:SI LR_REGNO))]
12664 "(DEFAULT_ABI == ABI_V4
12665 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[0])
12666 && (INTVAL (operands[2]) & CALL_LONG) == 0)"
12668 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12669 output_asm_insn ("crxor 6,6,6", operands);
12671 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12672 output_asm_insn ("creqv 6,6,6", operands);
12675 /* The magic 32768 offset here and in the other sysv call insns
12676 corresponds to the offset of r30 in .got2, as given by LCTOC1.
12677 See sysv4.h:toc_section. */
12678 return "bl %z0+32768@plt";
12680 return "bl %z0@plt";
12682 [(set_attr "type" "branch,branch")
12683 (set_attr "length" "4,8")])
12685 (define_insn "*call_value_indirect_nonlocal_sysv<mode>"
12686 [(set (match_operand 0 "" "")
12687 (call (mem:SI (match_operand:P 1 "register_operand" "c,*l,c,*l"))
12688 (match_operand 2 "" "g,g,g,g")))
12689 (use (match_operand:SI 3 "immediate_operand" "O,O,n,n"))
12690 (clobber (reg:SI LR_REGNO))]
12691 "DEFAULT_ABI == ABI_V4
12692 || DEFAULT_ABI == ABI_DARWIN"
12694 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12695 output_asm_insn ("crxor 6,6,6", operands);
12697 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12698 output_asm_insn ("creqv 6,6,6", operands);
12702 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
12703 (set_attr "length" "4,4,8,8")])
12705 (define_insn_and_split "*call_value_nonlocal_sysv<mode>"
12706 [(set (match_operand 0 "" "")
12707 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
12708 (match_operand 2 "" "g,g")))
12709 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12710 (clobber (reg:SI LR_REGNO))]
12711 "(DEFAULT_ABI == ABI_DARWIN
12712 || (DEFAULT_ABI == ABI_V4
12713 && (INTVAL (operands[3]) & CALL_LONG) == 0))"
12715 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12716 output_asm_insn ("crxor 6,6,6", operands);
12718 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12719 output_asm_insn ("creqv 6,6,6", operands);
12722 return output_call(insn, operands, 1, 3);
12724 if (DEFAULT_ABI == ABI_V4 && flag_pic)
12726 gcc_assert (!TARGET_SECURE_PLT);
12727 return "bl %z1@plt";
12733 "DEFAULT_ABI == ABI_V4
12734 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[1])
12735 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12736 [(parallel [(set (match_dup 0)
12737 (call (mem:SI (match_dup 1))
12739 (use (match_dup 3))
12740 (use (match_dup 4))
12741 (clobber (reg:SI LR_REGNO))])]
12743 operands[4] = pic_offset_table_rtx;
12745 [(set_attr "type" "branch,branch")
12746 (set_attr "length" "4,8")])
12748 (define_insn "*call_value_nonlocal_sysv_secure<mode>"
12749 [(set (match_operand 0 "" "")
12750 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
12751 (match_operand 2 "" "g,g")))
12752 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12753 (use (match_operand:SI 4 "register_operand" "r,r"))
12754 (clobber (reg:SI LR_REGNO))]
12755 "(DEFAULT_ABI == ABI_V4
12756 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[1])
12757 && (INTVAL (operands[3]) & CALL_LONG) == 0)"
12759 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12760 output_asm_insn ("crxor 6,6,6", operands);
12762 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12763 output_asm_insn ("creqv 6,6,6", operands);
12766 return "bl %z1+32768@plt";
12768 return "bl %z1@plt";
12770 [(set_attr "type" "branch,branch")
12771 (set_attr "length" "4,8")])
12773 ;; Call subroutine returning any type.
12774 (define_expand "untyped_call"
12775 [(parallel [(call (match_operand 0 "" "")
12777 (match_operand 1 "" "")
12778 (match_operand 2 "" "")])]
12784 emit_call_insn (GEN_CALL (operands[0], const0_rtx, const0_rtx, const0_rtx));
12786 for (i = 0; i < XVECLEN (operands[2], 0); i++)
12788 rtx set = XVECEXP (operands[2], 0, i);
12789 emit_move_insn (SET_DEST (set), SET_SRC (set));
12792 /* The optimizer does not know that the call sets the function value
12793 registers we stored in the result block. We avoid problems by
12794 claiming that all hard registers are used and clobbered at this
12796 emit_insn (gen_blockage ());
12801 ;; sibling call patterns
12802 (define_expand "sibcall"
12803 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
12804 (match_operand 1 "" ""))
12805 (use (match_operand 2 "" ""))
12806 (use (reg:SI LR_REGNO))
12812 if (MACHOPIC_INDIRECT)
12813 operands[0] = machopic_indirect_call_target (operands[0]);
12816 gcc_assert (GET_CODE (operands[0]) == MEM);
12817 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
12819 operands[0] = XEXP (operands[0], 0);
12822 ;; this and similar patterns must be marked as using LR, otherwise
12823 ;; dataflow will try to delete the store into it. This is true
12824 ;; even when the actual reg to jump to is in CTR, when LR was
12825 ;; saved and restored around the PIC-setting BCL.
12826 (define_insn "*sibcall_local32"
12827 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
12828 (match_operand 1 "" "g,g"))
12829 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12830 (use (reg:SI LR_REGNO))
12832 "(INTVAL (operands[2]) & CALL_LONG) == 0"
12835 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12836 output_asm_insn (\"crxor 6,6,6\", operands);
12838 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12839 output_asm_insn (\"creqv 6,6,6\", operands);
12841 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
12843 [(set_attr "type" "branch")
12844 (set_attr "length" "4,8")])
12846 (define_insn "*sibcall_local64"
12847 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
12848 (match_operand 1 "" "g,g"))
12849 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12850 (use (reg:SI LR_REGNO))
12852 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
12855 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12856 output_asm_insn (\"crxor 6,6,6\", operands);
12858 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12859 output_asm_insn (\"creqv 6,6,6\", operands);
12861 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
12863 [(set_attr "type" "branch")
12864 (set_attr "length" "4,8")])
12866 (define_insn "*sibcall_value_local32"
12867 [(set (match_operand 0 "" "")
12868 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
12869 (match_operand 2 "" "g,g")))
12870 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12871 (use (reg:SI LR_REGNO))
12873 "(INTVAL (operands[3]) & CALL_LONG) == 0"
12876 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12877 output_asm_insn (\"crxor 6,6,6\", operands);
12879 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12880 output_asm_insn (\"creqv 6,6,6\", operands);
12882 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
12884 [(set_attr "type" "branch")
12885 (set_attr "length" "4,8")])
12888 (define_insn "*sibcall_value_local64"
12889 [(set (match_operand 0 "" "")
12890 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
12891 (match_operand 2 "" "g,g")))
12892 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12893 (use (reg:SI LR_REGNO))
12895 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
12898 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12899 output_asm_insn (\"crxor 6,6,6\", operands);
12901 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12902 output_asm_insn (\"creqv 6,6,6\", operands);
12904 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
12906 [(set_attr "type" "branch")
12907 (set_attr "length" "4,8")])
12909 (define_insn "*sibcall_nonlocal_aix32"
12910 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
12911 (match_operand 1 "" "g"))
12912 (use (match_operand:SI 2 "immediate_operand" "O"))
12913 (use (reg:SI LR_REGNO))
12916 && DEFAULT_ABI == ABI_AIX
12917 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12919 [(set_attr "type" "branch")
12920 (set_attr "length" "4")])
12922 (define_insn "*sibcall_nonlocal_aix64"
12923 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
12924 (match_operand 1 "" "g"))
12925 (use (match_operand:SI 2 "immediate_operand" "O"))
12926 (use (reg:SI LR_REGNO))
12929 && DEFAULT_ABI == ABI_AIX
12930 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12932 [(set_attr "type" "branch")
12933 (set_attr "length" "4")])
12935 (define_insn "*sibcall_value_nonlocal_aix32"
12936 [(set (match_operand 0 "" "")
12937 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
12938 (match_operand 2 "" "g")))
12939 (use (match_operand:SI 3 "immediate_operand" "O"))
12940 (use (reg:SI LR_REGNO))
12943 && DEFAULT_ABI == ABI_AIX
12944 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12946 [(set_attr "type" "branch")
12947 (set_attr "length" "4")])
12949 (define_insn "*sibcall_value_nonlocal_aix64"
12950 [(set (match_operand 0 "" "")
12951 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
12952 (match_operand 2 "" "g")))
12953 (use (match_operand:SI 3 "immediate_operand" "O"))
12954 (use (reg:SI LR_REGNO))
12957 && DEFAULT_ABI == ABI_AIX
12958 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12960 [(set_attr "type" "branch")
12961 (set_attr "length" "4")])
12963 (define_insn "*sibcall_nonlocal_sysv<mode>"
12964 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
12965 (match_operand 1 "" ""))
12966 (use (match_operand 2 "immediate_operand" "O,n"))
12967 (use (reg:SI LR_REGNO))
12969 "(DEFAULT_ABI == ABI_DARWIN
12970 || DEFAULT_ABI == ABI_V4)
12971 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12974 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12975 output_asm_insn (\"crxor 6,6,6\", operands);
12977 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12978 output_asm_insn (\"creqv 6,6,6\", operands);
12980 if (DEFAULT_ABI == ABI_V4 && flag_pic)
12982 gcc_assert (!TARGET_SECURE_PLT);
12983 return \"b %z0@plt\";
12988 [(set_attr "type" "branch,branch")
12989 (set_attr "length" "4,8")])
12991 (define_expand "sibcall_value"
12992 [(parallel [(set (match_operand 0 "register_operand" "")
12993 (call (mem:SI (match_operand 1 "address_operand" ""))
12994 (match_operand 2 "" "")))
12995 (use (match_operand 3 "" ""))
12996 (use (reg:SI LR_REGNO))
13002 if (MACHOPIC_INDIRECT)
13003 operands[1] = machopic_indirect_call_target (operands[1]);
13006 gcc_assert (GET_CODE (operands[1]) == MEM);
13007 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
13009 operands[1] = XEXP (operands[1], 0);
13012 (define_insn "*sibcall_value_nonlocal_sysv<mode>"
13013 [(set (match_operand 0 "" "")
13014 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
13015 (match_operand 2 "" "")))
13016 (use (match_operand:SI 3 "immediate_operand" "O,n"))
13017 (use (reg:SI LR_REGNO))
13019 "(DEFAULT_ABI == ABI_DARWIN
13020 || DEFAULT_ABI == ABI_V4)
13021 && (INTVAL (operands[3]) & CALL_LONG) == 0"
13024 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
13025 output_asm_insn (\"crxor 6,6,6\", operands);
13027 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
13028 output_asm_insn (\"creqv 6,6,6\", operands);
13030 if (DEFAULT_ABI == ABI_V4 && flag_pic)
13032 gcc_assert (!TARGET_SECURE_PLT);
13033 return \"b %z1@plt\";
13038 [(set_attr "type" "branch,branch")
13039 (set_attr "length" "4,8")])
13041 (define_expand "sibcall_epilogue"
13042 [(use (const_int 0))]
13043 "TARGET_SCHED_PROLOG"
13046 rs6000_emit_epilogue (TRUE);
13050 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
13051 ;; all of memory. This blocks insns from being moved across this point.
13053 (define_insn "blockage"
13054 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCK)]
13058 (define_insn "probe_stack"
13059 [(set (match_operand 0 "memory_operand" "=m")
13060 (unspec [(const_int 0)] UNSPEC_PROBE_STACK))]
13062 "{st%U0%X0|stw%U0%X0} 0,%0"
13063 [(set_attr "type" "store")
13064 (set_attr "length" "4")])
13066 (define_insn "probe_stack_range<P:mode>"
13067 [(set (match_operand:P 0 "register_operand" "=r")
13068 (unspec_volatile:P [(match_operand:P 1 "register_operand" "0")
13069 (match_operand:P 2 "register_operand" "r")]
13070 UNSPECV_PROBE_STACK_RANGE))]
13072 "* return output_probe_stack_range (operands[0], operands[2]);"
13073 [(set_attr "type" "three")])
13075 ;; Compare insns are next. Note that the RS/6000 has two types of compares,
13076 ;; signed & unsigned, and one type of branch.
13078 ;; Start with the DEFINE_EXPANDs to generate the rtl for compares, scc
13079 ;; insns, and branches.
13081 (define_expand "cbranch<mode>4"
13082 [(use (match_operator 0 "rs6000_cbranch_operator"
13083 [(match_operand:GPR 1 "gpc_reg_operand" "")
13084 (match_operand:GPR 2 "reg_or_short_operand" "")]))
13085 (use (match_operand 3 ""))]
13089 /* Take care of the possibility that operands[2] might be negative but
13090 this might be a logical operation. That insn doesn't exist. */
13091 if (GET_CODE (operands[2]) == CONST_INT
13092 && INTVAL (operands[2]) < 0)
13094 operands[2] = force_reg (<MODE>mode, operands[2]);
13095 operands[0] = gen_rtx_fmt_ee (GET_CODE (operands[0]),
13096 GET_MODE (operands[0]),
13097 operands[1], operands[2]);
13100 rs6000_emit_cbranch (<MODE>mode, operands);
13104 (define_expand "cbranch<mode>4"
13105 [(use (match_operator 0 "rs6000_cbranch_operator"
13106 [(match_operand:FP 1 "gpc_reg_operand" "")
13107 (match_operand:FP 2 "gpc_reg_operand" "")]))
13108 (use (match_operand 3 ""))]
13112 rs6000_emit_cbranch (<MODE>mode, operands);
13116 (define_expand "cstore<mode>4"
13117 [(use (match_operator 1 "rs6000_cbranch_operator"
13118 [(match_operand:GPR 2 "gpc_reg_operand" "")
13119 (match_operand:GPR 3 "reg_or_short_operand" "")]))
13120 (clobber (match_operand:SI 0 "register_operand"))]
13124 /* Take care of the possibility that operands[3] might be negative but
13125 this might be a logical operation. That insn doesn't exist. */
13126 if (GET_CODE (operands[3]) == CONST_INT
13127 && INTVAL (operands[3]) < 0)
13129 operands[3] = force_reg (<MODE>mode, operands[3]);
13130 operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]),
13131 GET_MODE (operands[1]),
13132 operands[2], operands[3]);
13135 /* For SNE, we would prefer that the xor/abs sequence be used for integers.
13136 For SEQ, likewise, except that comparisons with zero should be done
13137 with an scc insns. However, due to the order that combine see the
13138 resulting insns, we must, in fact, allow SEQ for integers. Fail in
13139 the cases we don't want to handle or are best handled by portable
13141 if (GET_CODE (operands[1]) == NE)
13143 if ((GET_CODE (operands[1]) == LT || GET_CODE (operands[1]) == LE
13144 || GET_CODE (operands[1]) == GT || GET_CODE (operands[1]) == GE)
13145 && operands[3] == const0_rtx)
13147 rs6000_emit_sCOND (<MODE>mode, operands);
13151 (define_expand "cstore<mode>4"
13152 [(use (match_operator 1 "rs6000_cbranch_operator"
13153 [(match_operand:FP 2 "gpc_reg_operand" "")
13154 (match_operand:FP 3 "gpc_reg_operand" "")]))
13155 (clobber (match_operand:SI 0 "register_operand"))]
13159 rs6000_emit_sCOND (<MODE>mode, operands);
13164 (define_expand "stack_protect_set"
13165 [(match_operand 0 "memory_operand" "")
13166 (match_operand 1 "memory_operand" "")]
13169 #ifdef TARGET_THREAD_SSP_OFFSET
13170 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
13171 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
13172 operands[1] = gen_rtx_MEM (Pmode, addr);
13175 emit_insn (gen_stack_protect_setdi (operands[0], operands[1]));
13177 emit_insn (gen_stack_protect_setsi (operands[0], operands[1]));
13181 (define_insn "stack_protect_setsi"
13182 [(set (match_operand:SI 0 "memory_operand" "=m")
13183 (unspec:SI [(match_operand:SI 1 "memory_operand" "m")] UNSPEC_SP_SET))
13184 (set (match_scratch:SI 2 "=&r") (const_int 0))]
13186 "{l%U1%X1|lwz%U1%X1} %2,%1\;{st%U0%X0|stw%U0%X0} %2,%0\;{lil|li} %2,0"
13187 [(set_attr "type" "three")
13188 (set_attr "length" "12")])
13190 (define_insn "stack_protect_setdi"
13191 [(set (match_operand:DI 0 "memory_operand" "=m")
13192 (unspec:DI [(match_operand:DI 1 "memory_operand" "m")] UNSPEC_SP_SET))
13193 (set (match_scratch:DI 2 "=&r") (const_int 0))]
13195 "ld%U1%X1 %2,%1\;std%U0%X0 %2,%0\;{lil|li} %2,0"
13196 [(set_attr "type" "three")
13197 (set_attr "length" "12")])
13199 (define_expand "stack_protect_test"
13200 [(match_operand 0 "memory_operand" "")
13201 (match_operand 1 "memory_operand" "")
13202 (match_operand 2 "" "")]
13205 rtx test, op0, op1;
13206 #ifdef TARGET_THREAD_SSP_OFFSET
13207 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
13208 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
13209 operands[1] = gen_rtx_MEM (Pmode, addr);
13212 op1 = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, operands[1]), UNSPEC_SP_TEST);
13213 test = gen_rtx_EQ (VOIDmode, op0, op1);
13214 emit_jump_insn (gen_cbranchsi4 (test, op0, op1, operands[2]));
13218 (define_insn "stack_protect_testsi"
13219 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
13220 (unspec:CCEQ [(match_operand:SI 1 "memory_operand" "m,m")
13221 (match_operand:SI 2 "memory_operand" "m,m")]
13223 (set (match_scratch:SI 4 "=r,r") (const_int 0))
13224 (clobber (match_scratch:SI 3 "=&r,&r"))]
13227 {l%U1%X1|lwz%U1%X1} %3,%1\;{l%U2%X2|lwz%U2%X2} %4,%2\;xor. %3,%3,%4\;{lil|li} %4,0
13228 {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"
13229 [(set_attr "length" "16,20")])
13231 (define_insn "stack_protect_testdi"
13232 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
13233 (unspec:CCEQ [(match_operand:DI 1 "memory_operand" "m,m")
13234 (match_operand:DI 2 "memory_operand" "m,m")]
13236 (set (match_scratch:DI 4 "=r,r") (const_int 0))
13237 (clobber (match_scratch:DI 3 "=&r,&r"))]
13240 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;xor. %3,%3,%4\;{lil|li} %4,0
13241 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;cmpld %0,%3,%4\;{lil|li} %3,0\;{lil|li} %4,0"
13242 [(set_attr "length" "16,20")])
13245 ;; Here are the actual compare insns.
13246 (define_insn "*cmp<mode>_internal1"
13247 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
13248 (compare:CC (match_operand:GPR 1 "gpc_reg_operand" "r")
13249 (match_operand:GPR 2 "reg_or_short_operand" "rI")))]
13251 "{cmp%I2|cmp<wd>%I2} %0,%1,%2"
13252 [(set_attr "type" "cmp")])
13254 ;; If we are comparing a register for equality with a large constant,
13255 ;; we can do this with an XOR followed by a compare. But this is profitable
13256 ;; only if the large constant is only used for the comparison (and in this
13257 ;; case we already have a register to reuse as scratch).
13259 ;; For 64-bit registers, we could only do so if the constant's bit 15 is clear:
13260 ;; otherwise we'd need to XOR with FFFFFFFF????0000 which is not available.
13263 [(set (match_operand:SI 0 "register_operand")
13264 (match_operand:SI 1 "logical_const_operand" ""))
13265 (set (match_dup 0) (match_operator:SI 3 "boolean_or_operator"
13267 (match_operand:SI 2 "logical_const_operand" "")]))
13268 (set (match_operand:CC 4 "cc_reg_operand" "")
13269 (compare:CC (match_operand:SI 5 "gpc_reg_operand" "")
13272 (if_then_else (match_operator 6 "equality_operator"
13273 [(match_dup 4) (const_int 0)])
13274 (match_operand 7 "" "")
13275 (match_operand 8 "" "")))]
13276 "peep2_reg_dead_p (3, operands[0])
13277 && peep2_reg_dead_p (4, operands[4])"
13278 [(set (match_dup 0) (xor:SI (match_dup 5) (match_dup 9)))
13279 (set (match_dup 4) (compare:CC (match_dup 0) (match_dup 10)))
13280 (set (pc) (if_then_else (match_dup 6) (match_dup 7) (match_dup 8)))]
13283 /* Get the constant we are comparing against, and see what it looks like
13284 when sign-extended from 16 to 32 bits. Then see what constant we could
13285 XOR with SEXTC to get the sign-extended value. */
13286 rtx cnst = simplify_const_binary_operation (GET_CODE (operands[3]),
13288 operands[1], operands[2]);
13289 HOST_WIDE_INT c = INTVAL (cnst);
13290 HOST_WIDE_INT sextc = ((c & 0xffff) ^ 0x8000) - 0x8000;
13291 HOST_WIDE_INT xorv = c ^ sextc;
13293 operands[9] = GEN_INT (xorv);
13294 operands[10] = GEN_INT (sextc);
13297 (define_insn "*cmpsi_internal2"
13298 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
13299 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
13300 (match_operand:SI 2 "reg_or_u_short_operand" "rK")))]
13302 "{cmpl%I2|cmplw%I2} %0,%1,%b2"
13303 [(set_attr "type" "cmp")])
13305 (define_insn "*cmpdi_internal2"
13306 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
13307 (compare:CCUNS (match_operand:DI 1 "gpc_reg_operand" "r")
13308 (match_operand:DI 2 "reg_or_u_short_operand" "rK")))]
13310 "cmpld%I2 %0,%1,%b2"
13311 [(set_attr "type" "cmp")])
13313 ;; The following two insns don't exist as single insns, but if we provide
13314 ;; them, we can swap an add and compare, which will enable us to overlap more
13315 ;; of the required delay between a compare and branch. We generate code for
13316 ;; them by splitting.
13319 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
13320 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
13321 (match_operand:SI 2 "short_cint_operand" "i")))
13322 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
13323 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
13326 [(set_attr "length" "8")])
13329 [(set (match_operand:CCUNS 3 "cc_reg_operand" "=y")
13330 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
13331 (match_operand:SI 2 "u_short_cint_operand" "i")))
13332 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
13333 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
13336 [(set_attr "length" "8")])
13339 [(set (match_operand:CC 3 "cc_reg_operand" "")
13340 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
13341 (match_operand:SI 2 "short_cint_operand" "")))
13342 (set (match_operand:SI 0 "gpc_reg_operand" "")
13343 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
13345 [(set (match_dup 3) (compare:CC (match_dup 1) (match_dup 2)))
13346 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
13349 [(set (match_operand:CCUNS 3 "cc_reg_operand" "")
13350 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "")
13351 (match_operand:SI 2 "u_short_cint_operand" "")))
13352 (set (match_operand:SI 0 "gpc_reg_operand" "")
13353 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
13355 [(set (match_dup 3) (compare:CCUNS (match_dup 1) (match_dup 2)))
13356 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
13358 (define_insn "*cmpsf_internal1"
13359 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
13360 (compare:CCFP (match_operand:SF 1 "gpc_reg_operand" "f")
13361 (match_operand:SF 2 "gpc_reg_operand" "f")))]
13362 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
13364 [(set_attr "type" "fpcompare")])
13366 (define_insn "*cmpdf_internal1"
13367 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
13368 (compare:CCFP (match_operand:DF 1 "gpc_reg_operand" "d")
13369 (match_operand:DF 2 "gpc_reg_operand" "d")))]
13370 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
13371 && !VECTOR_UNIT_VSX_P (DFmode)"
13373 [(set_attr "type" "fpcompare")])
13375 ;; Only need to compare second words if first words equal
13376 (define_insn "*cmptf_internal1"
13377 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
13378 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "d")
13379 (match_operand:TF 2 "gpc_reg_operand" "d")))]
13380 "!TARGET_IEEEQUAD && !TARGET_XL_COMPAT
13381 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LONG_DOUBLE_128"
13382 "fcmpu %0,%1,%2\;bne %0,$+8\;fcmpu %0,%L1,%L2"
13383 [(set_attr "type" "fpcompare")
13384 (set_attr "length" "12")])
13386 (define_insn_and_split "*cmptf_internal2"
13387 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
13388 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "d")
13389 (match_operand:TF 2 "gpc_reg_operand" "d")))
13390 (clobber (match_scratch:DF 3 "=d"))
13391 (clobber (match_scratch:DF 4 "=d"))
13392 (clobber (match_scratch:DF 5 "=d"))
13393 (clobber (match_scratch:DF 6 "=d"))
13394 (clobber (match_scratch:DF 7 "=d"))
13395 (clobber (match_scratch:DF 8 "=d"))
13396 (clobber (match_scratch:DF 9 "=d"))
13397 (clobber (match_scratch:DF 10 "=d"))
13398 (clobber (match_scratch:GPR 11 "=b"))]
13399 "!TARGET_IEEEQUAD && TARGET_XL_COMPAT
13400 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LONG_DOUBLE_128"
13402 "&& reload_completed"
13403 [(set (match_dup 3) (match_dup 14))
13404 (set (match_dup 4) (match_dup 15))
13405 (set (match_dup 9) (abs:DF (match_dup 5)))
13406 (set (match_dup 0) (compare:CCFP (match_dup 9) (match_dup 3)))
13407 (set (pc) (if_then_else (ne (match_dup 0) (const_int 0))
13408 (label_ref (match_dup 12))
13410 (set (match_dup 0) (compare:CCFP (match_dup 5) (match_dup 7)))
13411 (set (pc) (label_ref (match_dup 13)))
13413 (set (match_dup 10) (minus:DF (match_dup 5) (match_dup 7)))
13414 (set (match_dup 9) (minus:DF (match_dup 6) (match_dup 8)))
13415 (set (match_dup 9) (plus:DF (match_dup 10) (match_dup 9)))
13416 (set (match_dup 0) (compare:CCFP (match_dup 9) (match_dup 4)))
13419 REAL_VALUE_TYPE rv;
13420 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
13421 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
13423 operands[5] = simplify_gen_subreg (DFmode, operands[1], TFmode, hi_word);
13424 operands[6] = simplify_gen_subreg (DFmode, operands[1], TFmode, lo_word);
13425 operands[7] = simplify_gen_subreg (DFmode, operands[2], TFmode, hi_word);
13426 operands[8] = simplify_gen_subreg (DFmode, operands[2], TFmode, lo_word);
13427 operands[12] = gen_label_rtx ();
13428 operands[13] = gen_label_rtx ();
13430 operands[14] = force_const_mem (DFmode,
13431 CONST_DOUBLE_FROM_REAL_VALUE (rv, DFmode));
13432 operands[15] = force_const_mem (DFmode,
13433 CONST_DOUBLE_FROM_REAL_VALUE (dconst0,
13438 tocref = create_TOC_reference (XEXP (operands[14], 0), operands[11]);
13439 operands[14] = gen_const_mem (DFmode, tocref);
13440 tocref = create_TOC_reference (XEXP (operands[15], 0), operands[11]);
13441 operands[15] = gen_const_mem (DFmode, tocref);
13442 set_mem_alias_set (operands[14], get_TOC_alias_set ());
13443 set_mem_alias_set (operands[15], get_TOC_alias_set ());
13447 ;; Now we have the scc insns. We can do some combinations because of the
13448 ;; way the machine works.
13450 ;; Note that this is probably faster if we can put an insn between the
13451 ;; mfcr and rlinm, but this is tricky. Let's leave it for now. In most
13452 ;; cases the insns below which don't use an intermediate CR field will
13453 ;; be used instead.
13455 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13456 (match_operator:SI 1 "scc_comparison_operator"
13457 [(match_operand 2 "cc_reg_operand" "y")
13460 "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1"
13461 [(set (attr "type")
13462 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
13463 (const_string "mfcrf")
13465 (const_string "mfcr")))
13466 (set_attr "length" "8")])
13468 ;; Same as above, but get the GT bit.
13469 (define_insn "move_from_CR_gt_bit"
13470 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13471 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_GT))]
13472 "TARGET_HARD_FLOAT && !TARGET_FPRS"
13473 "mfcr %0\;{rlinm|rlwinm} %0,%0,%D1,31,31"
13474 [(set_attr "type" "mfcr")
13475 (set_attr "length" "8")])
13477 ;; Same as above, but get the OV/ORDERED bit.
13478 (define_insn "move_from_CR_ov_bit"
13479 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13480 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_OV))]
13482 "mfcr %0\;{rlinm|rlwinm} %0,%0,%t1,1"
13483 [(set_attr "type" "mfcr")
13484 (set_attr "length" "8")])
13487 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13488 (match_operator:DI 1 "scc_comparison_operator"
13489 [(match_operand 2 "cc_reg_operand" "y")
13492 "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1"
13493 [(set (attr "type")
13494 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
13495 (const_string "mfcrf")
13497 (const_string "mfcr")))
13498 (set_attr "length" "8")])
13501 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13502 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
13503 [(match_operand 2 "cc_reg_operand" "y,y")
13506 (set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
13507 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
13510 mfcr %3%Q2\;{rlinm.|rlwinm.} %3,%3,%J1,1
13512 [(set_attr "type" "delayed_compare")
13513 (set_attr "length" "8,16")])
13516 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13517 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
13518 [(match_operand 2 "cc_reg_operand" "")
13521 (set (match_operand:SI 3 "gpc_reg_operand" "")
13522 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
13523 "TARGET_32BIT && reload_completed"
13524 [(set (match_dup 3)
13525 (match_op_dup 1 [(match_dup 2) (const_int 0)]))
13527 (compare:CC (match_dup 3)
13532 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13533 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
13534 [(match_operand 2 "cc_reg_operand" "y")
13536 (match_operand:SI 3 "const_int_operand" "n")))]
13540 int is_bit = ccr_bit (operands[1], 1);
13541 int put_bit = 31 - (INTVAL (operands[3]) & 31);
13544 if (is_bit >= put_bit)
13545 count = is_bit - put_bit;
13547 count = 32 - (put_bit - is_bit);
13549 operands[4] = GEN_INT (count);
13550 operands[5] = GEN_INT (put_bit);
13552 return \"mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%4,%5,%5\";
13554 [(set (attr "type")
13555 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
13556 (const_string "mfcrf")
13558 (const_string "mfcr")))
13559 (set_attr "length" "8")])
13562 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13564 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
13565 [(match_operand 2 "cc_reg_operand" "y,y")
13567 (match_operand:SI 3 "const_int_operand" "n,n"))
13569 (set (match_operand:SI 4 "gpc_reg_operand" "=r,r")
13570 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
13575 int is_bit = ccr_bit (operands[1], 1);
13576 int put_bit = 31 - (INTVAL (operands[3]) & 31);
13579 /* Force split for non-cc0 compare. */
13580 if (which_alternative == 1)
13583 if (is_bit >= put_bit)
13584 count = is_bit - put_bit;
13586 count = 32 - (put_bit - is_bit);
13588 operands[5] = GEN_INT (count);
13589 operands[6] = GEN_INT (put_bit);
13591 return \"mfcr %4%Q2\;{rlinm.|rlwinm.} %4,%4,%5,%6,%6\";
13593 [(set_attr "type" "delayed_compare")
13594 (set_attr "length" "8,16")])
13597 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
13599 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
13600 [(match_operand 2 "cc_reg_operand" "")
13602 (match_operand:SI 3 "const_int_operand" ""))
13604 (set (match_operand:SI 4 "gpc_reg_operand" "")
13605 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
13608 [(set (match_dup 4)
13609 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
13612 (compare:CC (match_dup 4)
13616 ;; There is a 3 cycle delay between consecutive mfcr instructions
13617 ;; so it is useful to combine 2 scc instructions to use only one mfcr.
13620 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13621 (match_operator:SI 1 "scc_comparison_operator"
13622 [(match_operand 2 "cc_reg_operand" "y")
13624 (set (match_operand:SI 3 "gpc_reg_operand" "=r")
13625 (match_operator:SI 4 "scc_comparison_operator"
13626 [(match_operand 5 "cc_reg_operand" "y")
13628 "REGNO (operands[2]) != REGNO (operands[5])"
13629 "mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
13630 [(set_attr "type" "mfcr")
13631 (set_attr "length" "12")])
13634 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13635 (match_operator:DI 1 "scc_comparison_operator"
13636 [(match_operand 2 "cc_reg_operand" "y")
13638 (set (match_operand:DI 3 "gpc_reg_operand" "=r")
13639 (match_operator:DI 4 "scc_comparison_operator"
13640 [(match_operand 5 "cc_reg_operand" "y")
13642 "TARGET_POWERPC64 && REGNO (operands[2]) != REGNO (operands[5])"
13643 "mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
13644 [(set_attr "type" "mfcr")
13645 (set_attr "length" "12")])
13647 ;; There are some scc insns that can be done directly, without a compare.
13648 ;; These are faster because they don't involve the communications between
13649 ;; the FXU and branch units. In fact, we will be replacing all of the
13650 ;; integer scc insns here or in the portable methods in emit_store_flag.
13652 ;; Also support (neg (scc ..)) since that construct is used to replace
13653 ;; branches, (plus (scc ..) ..) since that construct is common and
13654 ;; takes no more insns than scc, and (and (neg (scc ..)) ..) in the
13655 ;; cases where it is no more expensive than (neg (scc ..)).
13657 ;; Have reload force a constant into a register for the simple insns that
13658 ;; otherwise won't accept constants. We do this because it is faster than
13659 ;; the cmp/mfcr sequence we would otherwise generate.
13661 (define_mode_attr scc_eq_op2 [(SI "rKLI")
13664 (define_insn_and_split "*eq<mode>"
13665 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
13666 (eq:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
13667 (match_operand:GPR 2 "scc_eq_operand" "<scc_eq_op2>")))]
13671 [(set (match_dup 0)
13672 (clz:GPR (match_dup 3)))
13674 (lshiftrt:GPR (match_dup 0) (match_dup 4)))]
13676 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
13678 /* Use output operand as intermediate. */
13679 operands[3] = operands[0];
13681 if (logical_operand (operands[2], <MODE>mode))
13682 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13683 gen_rtx_XOR (<MODE>mode,
13684 operands[1], operands[2])));
13686 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13687 gen_rtx_PLUS (<MODE>mode, operands[1],
13688 negate_rtx (<MODE>mode,
13692 operands[3] = operands[1];
13694 operands[4] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
13697 (define_insn_and_split "*eq<mode>_compare"
13698 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
13700 (eq:P (match_operand:P 1 "gpc_reg_operand" "=r")
13701 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))
13703 (set (match_operand:P 0 "gpc_reg_operand" "=r")
13704 (eq:P (match_dup 1) (match_dup 2)))]
13705 "!TARGET_POWER && optimize_size"
13707 "!TARGET_POWER && optimize_size"
13708 [(set (match_dup 0)
13709 (clz:P (match_dup 4)))
13710 (parallel [(set (match_dup 3)
13711 (compare:CC (lshiftrt:P (match_dup 0) (match_dup 5))
13714 (lshiftrt:P (match_dup 0) (match_dup 5)))])]
13716 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
13718 /* Use output operand as intermediate. */
13719 operands[4] = operands[0];
13721 if (logical_operand (operands[2], <MODE>mode))
13722 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
13723 gen_rtx_XOR (<MODE>mode,
13724 operands[1], operands[2])));
13726 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
13727 gen_rtx_PLUS (<MODE>mode, operands[1],
13728 negate_rtx (<MODE>mode,
13732 operands[4] = operands[1];
13734 operands[5] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
13737 (define_insn "*eqsi_power"
13738 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
13739 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
13740 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I")))
13741 (clobber (match_scratch:SI 3 "=r,&r,r,r,r"))]
13744 xor %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
13745 {sfi|subfic} %3,%1,0\;{ae|adde} %0,%3,%1
13746 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
13747 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
13748 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0"
13749 [(set_attr "type" "three,two,three,three,three")
13750 (set_attr "length" "12,8,12,12,12")])
13752 ;; We have insns of the form shown by the first define_insn below. If
13753 ;; there is something inside the comparison operation, we must split it.
13755 [(set (match_operand:SI 0 "gpc_reg_operand" "")
13756 (plus:SI (match_operator 1 "comparison_operator"
13757 [(match_operand:SI 2 "" "")
13758 (match_operand:SI 3
13759 "reg_or_cint_operand" "")])
13760 (match_operand:SI 4 "gpc_reg_operand" "")))
13761 (clobber (match_operand:SI 5 "register_operand" ""))]
13762 "! gpc_reg_operand (operands[2], SImode)"
13763 [(set (match_dup 5) (match_dup 2))
13764 (set (match_dup 2) (plus:SI (match_op_dup 1 [(match_dup 2) (match_dup 3)])
13767 (define_insn "*plus_eqsi"
13768 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r")
13769 (plus:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
13770 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I"))
13771 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r")))]
13774 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
13775 {sfi|subfic} %0,%1,0\;{aze|addze} %0,%3
13776 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
13777 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
13778 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
13779 [(set_attr "type" "three,two,three,three,three")
13780 (set_attr "length" "12,8,12,12,12")])
13782 (define_insn "*compare_plus_eqsi"
13783 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
13786 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
13787 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
13788 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
13790 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r"))]
13791 "TARGET_32BIT && optimize_size"
13793 xor %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
13794 {sfi|subfic} %4,%1,0\;{aze.|addze.} %4,%3
13795 {xoril|xori} %4,%1,%b2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
13796 {xoriu|xoris} %4,%1,%u2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
13797 {sfi|subfic} %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
13803 [(set_attr "type" "compare")
13804 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
13807 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13810 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
13811 (match_operand:SI 2 "scc_eq_operand" ""))
13812 (match_operand:SI 3 "gpc_reg_operand" ""))
13814 (clobber (match_scratch:SI 4 ""))]
13815 "TARGET_32BIT && optimize_size && reload_completed"
13816 [(set (match_dup 4)
13817 (plus:SI (eq:SI (match_dup 1)
13821 (compare:CC (match_dup 4)
13825 (define_insn "*plus_eqsi_compare"
13826 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
13829 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
13830 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
13831 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
13833 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r")
13834 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13835 "TARGET_32BIT && optimize_size"
13837 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
13838 {sfi|subfic} %0,%1,0\;{aze.|addze.} %0,%3
13839 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
13840 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
13841 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
13847 [(set_attr "type" "compare")
13848 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
13851 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13854 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
13855 (match_operand:SI 2 "scc_eq_operand" ""))
13856 (match_operand:SI 3 "gpc_reg_operand" ""))
13858 (set (match_operand:SI 0 "gpc_reg_operand" "")
13859 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13860 "TARGET_32BIT && optimize_size && reload_completed"
13861 [(set (match_dup 0)
13862 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13864 (compare:CC (match_dup 0)
13868 (define_insn "*neg_eq0<mode>"
13869 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13870 (neg:P (eq:P (match_operand:P 1 "gpc_reg_operand" "r")
13873 "{ai|addic} %0,%1,-1\;{sfe|subfe} %0,%0,%0"
13874 [(set_attr "type" "two")
13875 (set_attr "length" "8")])
13877 (define_insn_and_split "*neg_eq<mode>"
13878 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13879 (neg:P (eq:P (match_operand:P 1 "gpc_reg_operand" "%r")
13880 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))))]
13884 [(set (match_dup 0) (neg:P (eq:P (match_dup 3) (const_int 0))))]
13886 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
13888 /* Use output operand as intermediate. */
13889 operands[3] = operands[0];
13891 if (logical_operand (operands[2], <MODE>mode))
13892 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13893 gen_rtx_XOR (<MODE>mode,
13894 operands[1], operands[2])));
13896 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13897 gen_rtx_PLUS (<MODE>mode, operands[1],
13898 negate_rtx (<MODE>mode,
13902 operands[3] = operands[1];
13905 ;; Simplify (ne X (const_int 0)) on the PowerPC. No need to on the Power,
13906 ;; since it nabs/sr is just as fast.
13907 (define_insn "*ne0si"
13908 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
13909 (lshiftrt:SI (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
13911 (clobber (match_scratch:SI 2 "=&r"))]
13912 "! TARGET_POWER && TARGET_32BIT && !TARGET_ISEL"
13913 "{ai|addic} %2,%1,-1\;{sfe|subfe} %0,%2,%1"
13914 [(set_attr "type" "two")
13915 (set_attr "length" "8")])
13917 (define_insn "*ne0di"
13918 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13919 (lshiftrt:DI (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
13921 (clobber (match_scratch:DI 2 "=&r"))]
13923 "addic %2,%1,-1\;subfe %0,%2,%1"
13924 [(set_attr "type" "two")
13925 (set_attr "length" "8")])
13927 ;; This is what (plus (ne X (const_int 0)) Y) looks like.
13928 (define_insn "*plus_ne0si"
13929 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13930 (plus:SI (lshiftrt:SI
13931 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
13933 (match_operand:SI 2 "gpc_reg_operand" "r")))
13934 (clobber (match_scratch:SI 3 "=&r"))]
13936 "{ai|addic} %3,%1,-1\;{aze|addze} %0,%2"
13937 [(set_attr "type" "two")
13938 (set_attr "length" "8")])
13940 (define_insn "*plus_ne0di"
13941 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13942 (plus:DI (lshiftrt:DI
13943 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
13945 (match_operand:DI 2 "gpc_reg_operand" "r")))
13946 (clobber (match_scratch:DI 3 "=&r"))]
13948 "addic %3,%1,-1\;addze %0,%2"
13949 [(set_attr "type" "two")
13950 (set_attr "length" "8")])
13952 (define_insn "*compare_plus_ne0si"
13953 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13955 (plus:SI (lshiftrt:SI
13956 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
13958 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
13960 (clobber (match_scratch:SI 3 "=&r,&r"))
13961 (clobber (match_scratch:SI 4 "=X,&r"))]
13964 {ai|addic} %3,%1,-1\;{aze.|addze.} %3,%2
13966 [(set_attr "type" "compare")
13967 (set_attr "length" "8,12")])
13970 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13972 (plus:SI (lshiftrt:SI
13973 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
13975 (match_operand:SI 2 "gpc_reg_operand" ""))
13977 (clobber (match_scratch:SI 3 ""))
13978 (clobber (match_scratch:SI 4 ""))]
13979 "TARGET_32BIT && reload_completed"
13980 [(parallel [(set (match_dup 3)
13981 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1)))
13984 (clobber (match_dup 4))])
13986 (compare:CC (match_dup 3)
13990 (define_insn "*compare_plus_ne0di"
13991 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13993 (plus:DI (lshiftrt:DI
13994 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
13996 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
13998 (clobber (match_scratch:DI 3 "=&r,&r"))]
14001 addic %3,%1,-1\;addze. %3,%2
14003 [(set_attr "type" "compare")
14004 (set_attr "length" "8,12")])
14007 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
14009 (plus:DI (lshiftrt:DI
14010 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
14012 (match_operand:DI 2 "gpc_reg_operand" ""))
14014 (clobber (match_scratch:DI 3 ""))]
14015 "TARGET_64BIT && reload_completed"
14016 [(set (match_dup 3)
14017 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1)))
14021 (compare:CC (match_dup 3)
14025 (define_insn "*plus_ne0si_compare"
14026 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
14028 (plus:SI (lshiftrt:SI
14029 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
14031 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
14033 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
14034 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
14036 (clobber (match_scratch:SI 3 "=&r,&r"))]
14039 {ai|addic} %3,%1,-1\;{aze.|addze.} %0,%2
14041 [(set_attr "type" "compare")
14042 (set_attr "length" "8,12")])
14045 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14047 (plus:SI (lshiftrt:SI
14048 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
14050 (match_operand:SI 2 "gpc_reg_operand" ""))
14052 (set (match_operand:SI 0 "gpc_reg_operand" "")
14053 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
14055 (clobber (match_scratch:SI 3 ""))]
14056 "TARGET_32BIT && reload_completed"
14057 [(parallel [(set (match_dup 0)
14058 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
14060 (clobber (match_dup 3))])
14062 (compare:CC (match_dup 0)
14066 (define_insn "*plus_ne0di_compare"
14067 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
14069 (plus:DI (lshiftrt:DI
14070 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
14072 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
14074 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
14075 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
14077 (clobber (match_scratch:DI 3 "=&r,&r"))]
14080 addic %3,%1,-1\;addze. %0,%2
14082 [(set_attr "type" "compare")
14083 (set_attr "length" "8,12")])
14086 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
14088 (plus:DI (lshiftrt:DI
14089 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
14091 (match_operand:DI 2 "gpc_reg_operand" ""))
14093 (set (match_operand:DI 0 "gpc_reg_operand" "")
14094 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
14096 (clobber (match_scratch:DI 3 ""))]
14097 "TARGET_64BIT && reload_completed"
14098 [(parallel [(set (match_dup 0)
14099 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
14101 (clobber (match_dup 3))])
14103 (compare:CC (match_dup 0)
14108 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
14109 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14110 (match_operand:SI 2 "reg_or_short_operand" "r,O")))
14111 (clobber (match_scratch:SI 3 "=r,X"))]
14114 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3
14115 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri|srwi} %0,%0,31"
14116 [(set_attr "length" "12")])
14119 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
14121 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14122 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
14124 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
14125 (le:SI (match_dup 1) (match_dup 2)))
14126 (clobber (match_scratch:SI 3 "=r,X,r,X"))]
14129 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
14130 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri.|srwi.} %0,%0,31
14133 [(set_attr "type" "compare,delayed_compare,compare,delayed_compare")
14134 (set_attr "length" "12,12,16,16")])
14137 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14139 (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
14140 (match_operand:SI 2 "reg_or_short_operand" ""))
14142 (set (match_operand:SI 0 "gpc_reg_operand" "")
14143 (le:SI (match_dup 1) (match_dup 2)))
14144 (clobber (match_scratch:SI 3 ""))]
14145 "TARGET_POWER && reload_completed"
14146 [(parallel [(set (match_dup 0)
14147 (le:SI (match_dup 1) (match_dup 2)))
14148 (clobber (match_dup 3))])
14150 (compare:CC (match_dup 0)
14155 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
14156 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14157 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
14158 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
14161 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
14162 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze|addze} %0,%3"
14163 [(set_attr "length" "12")])
14166 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
14168 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14169 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
14170 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
14172 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
14175 doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
14176 {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze.|addze.} %4,%3
14179 [(set_attr "type" "compare")
14180 (set_attr "length" "12,12,16,16")])
14183 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14185 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
14186 (match_operand:SI 2 "reg_or_short_operand" ""))
14187 (match_operand:SI 3 "gpc_reg_operand" ""))
14189 (clobber (match_scratch:SI 4 ""))]
14190 "TARGET_POWER && reload_completed"
14191 [(set (match_dup 4)
14192 (plus:SI (le:SI (match_dup 1) (match_dup 2))
14195 (compare:CC (match_dup 4)
14200 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
14202 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14203 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
14204 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
14206 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
14207 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14210 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
14211 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze.|addze.} %0,%3
14214 [(set_attr "type" "compare")
14215 (set_attr "length" "12,12,16,16")])
14218 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14220 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
14221 (match_operand:SI 2 "reg_or_short_operand" ""))
14222 (match_operand:SI 3 "gpc_reg_operand" ""))
14224 (set (match_operand:SI 0 "gpc_reg_operand" "")
14225 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14226 "TARGET_POWER && reload_completed"
14227 [(set (match_dup 0)
14228 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
14230 (compare:CC (match_dup 0)
14235 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
14236 (neg:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14237 (match_operand:SI 2 "reg_or_short_operand" "r,O"))))]
14240 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
14241 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{srai|srawi} %0,%0,31"
14242 [(set_attr "length" "12")])
14244 (define_insn "*leu<mode>"
14245 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
14246 (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
14247 (match_operand:P 2 "reg_or_short_operand" "rI")))]
14249 "{sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
14250 [(set_attr "type" "three")
14251 (set_attr "length" "12")])
14253 (define_insn "*leu<mode>_compare"
14254 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
14256 (leu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14257 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
14259 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
14260 (leu:P (match_dup 1) (match_dup 2)))]
14263 {sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
14265 [(set_attr "type" "compare")
14266 (set_attr "length" "12,16")])
14269 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
14271 (leu:P (match_operand:P 1 "gpc_reg_operand" "")
14272 (match_operand:P 2 "reg_or_short_operand" ""))
14274 (set (match_operand:P 0 "gpc_reg_operand" "")
14275 (leu:P (match_dup 1) (match_dup 2)))]
14277 [(set (match_dup 0)
14278 (leu:P (match_dup 1) (match_dup 2)))
14280 (compare:CC (match_dup 0)
14284 (define_insn "*plus_leu<mode>"
14285 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
14286 (plus:P (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
14287 (match_operand:P 2 "reg_or_short_operand" "rI"))
14288 (match_operand:P 3 "gpc_reg_operand" "r")))]
14290 "{sf%I2|subf%I2c} %0,%1,%2\;{aze|addze} %0,%3"
14291 [(set_attr "type" "two")
14292 (set_attr "length" "8")])
14295 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
14297 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14298 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14299 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14301 (clobber (match_scratch:SI 4 "=&r,&r"))]
14304 {sf%I2|subf%I2c} %4,%1,%2\;{aze.|addze.} %4,%3
14306 [(set_attr "type" "compare")
14307 (set_attr "length" "8,12")])
14310 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14312 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14313 (match_operand:SI 2 "reg_or_short_operand" ""))
14314 (match_operand:SI 3 "gpc_reg_operand" ""))
14316 (clobber (match_scratch:SI 4 ""))]
14317 "TARGET_32BIT && reload_completed"
14318 [(set (match_dup 4)
14319 (plus:SI (leu:SI (match_dup 1) (match_dup 2))
14322 (compare:CC (match_dup 4)
14327 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
14329 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14330 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14331 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14333 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
14334 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14337 {sf%I2|subf%I2c} %0,%1,%2\;{aze.|addze.} %0,%3
14339 [(set_attr "type" "compare")
14340 (set_attr "length" "8,12")])
14343 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14345 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14346 (match_operand:SI 2 "reg_or_short_operand" ""))
14347 (match_operand:SI 3 "gpc_reg_operand" ""))
14349 (set (match_operand:SI 0 "gpc_reg_operand" "")
14350 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14351 "TARGET_32BIT && reload_completed"
14352 [(set (match_dup 0)
14353 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
14355 (compare:CC (match_dup 0)
14359 (define_insn "*neg_leu<mode>"
14360 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
14361 (neg:P (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
14362 (match_operand:P 2 "reg_or_short_operand" "rI"))))]
14364 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0"
14365 [(set_attr "type" "three")
14366 (set_attr "length" "12")])
14368 (define_insn "*and_neg_leu<mode>"
14369 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
14371 (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
14372 (match_operand:P 2 "reg_or_short_operand" "rI")))
14373 (match_operand:P 3 "gpc_reg_operand" "r")))]
14375 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
14376 [(set_attr "type" "three")
14377 (set_attr "length" "12")])
14380 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
14383 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14384 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
14385 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14387 (clobber (match_scratch:SI 4 "=&r,&r"))]
14390 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
14392 [(set_attr "type" "compare")
14393 (set_attr "length" "12,16")])
14396 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14399 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14400 (match_operand:SI 2 "reg_or_short_operand" "")))
14401 (match_operand:SI 3 "gpc_reg_operand" ""))
14403 (clobber (match_scratch:SI 4 ""))]
14404 "TARGET_32BIT && reload_completed"
14405 [(set (match_dup 4)
14406 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
14409 (compare:CC (match_dup 4)
14414 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
14417 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14418 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
14419 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14421 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
14422 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
14425 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
14427 [(set_attr "type" "compare")
14428 (set_attr "length" "12,16")])
14431 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14434 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14435 (match_operand:SI 2 "reg_or_short_operand" "")))
14436 (match_operand:SI 3 "gpc_reg_operand" ""))
14438 (set (match_operand:SI 0 "gpc_reg_operand" "")
14439 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
14440 "TARGET_32BIT && reload_completed"
14441 [(set (match_dup 0)
14442 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
14445 (compare:CC (match_dup 0)
14450 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14451 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14452 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
14454 "doz%I2 %0,%1,%2\;nabs %0,%0\;{sri|srwi} %0,%0,31"
14455 [(set_attr "length" "12")])
14458 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
14460 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14461 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14463 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
14464 (lt:SI (match_dup 1) (match_dup 2)))]
14467 doz%I2 %0,%1,%2\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
14469 [(set_attr "type" "delayed_compare")
14470 (set_attr "length" "12,16")])
14473 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
14475 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14476 (match_operand:SI 2 "reg_or_short_operand" ""))
14478 (set (match_operand:SI 0 "gpc_reg_operand" "")
14479 (lt:SI (match_dup 1) (match_dup 2)))]
14480 "TARGET_POWER && reload_completed"
14481 [(set (match_dup 0)
14482 (lt:SI (match_dup 1) (match_dup 2)))
14484 (compare:CC (match_dup 0)
14489 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
14490 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14491 (match_operand:SI 2 "reg_or_short_operand" "rI"))
14492 (match_operand:SI 3 "gpc_reg_operand" "r")))]
14494 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
14495 [(set_attr "length" "12")])
14498 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
14500 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14501 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14502 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14504 (clobber (match_scratch:SI 4 "=&r,&r"))]
14507 doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
14509 [(set_attr "type" "compare")
14510 (set_attr "length" "12,16")])
14513 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14515 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14516 (match_operand:SI 2 "reg_or_short_operand" ""))
14517 (match_operand:SI 3 "gpc_reg_operand" ""))
14519 (clobber (match_scratch:SI 4 ""))]
14520 "TARGET_POWER && reload_completed"
14521 [(set (match_dup 4)
14522 (plus:SI (lt:SI (match_dup 1) (match_dup 2))
14525 (compare:CC (match_dup 4)
14530 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
14532 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14533 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14534 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14536 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
14537 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14540 doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
14542 [(set_attr "type" "compare")
14543 (set_attr "length" "12,16")])
14546 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14548 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14549 (match_operand:SI 2 "reg_or_short_operand" ""))
14550 (match_operand:SI 3 "gpc_reg_operand" ""))
14552 (set (match_operand:SI 0 "gpc_reg_operand" "")
14553 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14554 "TARGET_POWER && reload_completed"
14555 [(set (match_dup 0)
14556 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
14558 (compare:CC (match_dup 0)
14563 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14564 (neg:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14565 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
14567 "doz%I2 %0,%1,%2\;nabs %0,%0\;{srai|srawi} %0,%0,31"
14568 [(set_attr "length" "12")])
14570 (define_insn_and_split "*ltu<mode>"
14571 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
14572 (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14573 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))]
14577 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
14578 (set (match_dup 0) (neg:P (match_dup 0)))]
14581 (define_insn_and_split "*ltu<mode>_compare"
14582 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
14584 (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
14585 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
14587 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
14588 (ltu:P (match_dup 1) (match_dup 2)))]
14592 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
14593 (parallel [(set (match_dup 3)
14594 (compare:CC (neg:P (match_dup 0)) (const_int 0)))
14595 (set (match_dup 0) (neg:P (match_dup 0)))])]
14598 (define_insn_and_split "*plus_ltu<mode>"
14599 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,r")
14600 (plus:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14601 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))
14602 (match_operand:P 3 "reg_or_short_operand" "rI,rI")))]
14605 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
14606 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
14607 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))]
14610 (define_insn_and_split "*plus_ltu<mode>_compare"
14611 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
14613 (plus:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
14614 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
14615 (match_operand:P 3 "gpc_reg_operand" "r,r,r,r"))
14617 (set (match_operand:P 0 "gpc_reg_operand" "=&r,&r,&r,&r")
14618 (plus:P (ltu:P (match_dup 1) (match_dup 2)) (match_dup 3)))]
14621 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
14622 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
14623 (parallel [(set (match_dup 4)
14624 (compare:CC (minus:P (match_dup 3) (match_dup 0))
14626 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))])]
14629 (define_insn "*neg_ltu<mode>"
14630 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
14631 (neg:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14632 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))))]
14635 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0
14636 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0"
14637 [(set_attr "type" "two")
14638 (set_attr "length" "8")])
14641 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14642 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14643 (match_operand:SI 2 "reg_or_short_operand" "rI")))
14644 (clobber (match_scratch:SI 3 "=r"))]
14646 "doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3"
14647 [(set_attr "length" "12")])
14650 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
14652 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14653 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14655 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
14656 (ge:SI (match_dup 1) (match_dup 2)))
14657 (clobber (match_scratch:SI 3 "=r,r"))]
14660 doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
14662 [(set_attr "type" "compare")
14663 (set_attr "length" "12,16")])
14666 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14668 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
14669 (match_operand:SI 2 "reg_or_short_operand" ""))
14671 (set (match_operand:SI 0 "gpc_reg_operand" "")
14672 (ge:SI (match_dup 1) (match_dup 2)))
14673 (clobber (match_scratch:SI 3 ""))]
14674 "TARGET_POWER && reload_completed"
14675 [(parallel [(set (match_dup 0)
14676 (ge:SI (match_dup 1) (match_dup 2)))
14677 (clobber (match_dup 3))])
14679 (compare:CC (match_dup 0)
14684 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
14685 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14686 (match_operand:SI 2 "reg_or_short_operand" "rI"))
14687 (match_operand:SI 3 "gpc_reg_operand" "r")))]
14689 "doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
14690 [(set_attr "length" "12")])
14693 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
14695 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14696 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14697 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14699 (clobber (match_scratch:SI 4 "=&r,&r"))]
14702 doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
14704 [(set_attr "type" "compare")
14705 (set_attr "length" "12,16")])
14708 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14710 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
14711 (match_operand:SI 2 "reg_or_short_operand" ""))
14712 (match_operand:SI 3 "gpc_reg_operand" ""))
14714 (clobber (match_scratch:SI 4 ""))]
14715 "TARGET_POWER && reload_completed"
14716 [(set (match_dup 4)
14717 (plus:SI (ge:SI (match_dup 1) (match_dup 2))
14720 (compare:CC (match_dup 4)
14725 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
14727 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14728 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14729 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14731 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
14732 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14735 doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
14737 [(set_attr "type" "compare")
14738 (set_attr "length" "12,16")])
14741 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14743 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
14744 (match_operand:SI 2 "reg_or_short_operand" ""))
14745 (match_operand:SI 3 "gpc_reg_operand" ""))
14747 (set (match_operand:SI 0 "gpc_reg_operand" "")
14748 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14749 "TARGET_POWER && reload_completed"
14750 [(set (match_dup 0)
14751 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
14753 (compare:CC (match_dup 0)
14758 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14759 (neg:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14760 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
14762 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
14763 [(set_attr "length" "12")])
14765 (define_insn "*geu<mode>"
14766 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
14767 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14768 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))]
14771 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0
14772 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
14773 [(set_attr "type" "three")
14774 (set_attr "length" "12")])
14776 (define_insn "*geu<mode>_compare"
14777 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
14779 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
14780 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
14782 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
14783 (geu:P (match_dup 1) (match_dup 2)))]
14786 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
14787 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
14790 [(set_attr "type" "compare")
14791 (set_attr "length" "12,12,16,16")])
14794 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
14796 (geu:P (match_operand:P 1 "gpc_reg_operand" "")
14797 (match_operand:P 2 "reg_or_neg_short_operand" ""))
14799 (set (match_operand:P 0 "gpc_reg_operand" "")
14800 (geu:P (match_dup 1) (match_dup 2)))]
14802 [(set (match_dup 0)
14803 (geu:P (match_dup 1) (match_dup 2)))
14805 (compare:CC (match_dup 0)
14809 (define_insn "*plus_geu<mode>"
14810 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,&r")
14811 (plus:P (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14812 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))
14813 (match_operand:P 3 "gpc_reg_operand" "r,r")))]
14816 {sf|subfc} %0,%2,%1\;{aze|addze} %0,%3
14817 {ai|addic} %0,%1,%n2\;{aze|addze} %0,%3"
14818 [(set_attr "type" "two")
14819 (set_attr "length" "8")])
14822 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
14824 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14825 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
14826 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
14828 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
14831 {sf|subfc} %4,%2,%1\;{aze.|addze.} %4,%3
14832 {ai|addic} %4,%1,%n2\;{aze.|addze.} %4,%3
14835 [(set_attr "type" "compare")
14836 (set_attr "length" "8,8,12,12")])
14839 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14841 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14842 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
14843 (match_operand:SI 3 "gpc_reg_operand" ""))
14845 (clobber (match_scratch:SI 4 ""))]
14846 "TARGET_32BIT && reload_completed"
14847 [(set (match_dup 4)
14848 (plus:SI (geu:SI (match_dup 1) (match_dup 2))
14851 (compare:CC (match_dup 4)
14856 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
14858 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14859 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
14860 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
14862 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
14863 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14866 {sf|subfc} %0,%2,%1\;{aze.|addze.} %0,%3
14867 {ai|addic} %0,%1,%n2\;{aze.|addze.} %0,%3
14870 [(set_attr "type" "compare")
14871 (set_attr "length" "8,8,12,12")])
14874 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14876 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14877 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
14878 (match_operand:SI 3 "gpc_reg_operand" ""))
14880 (set (match_operand:SI 0 "gpc_reg_operand" "")
14881 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14882 "TARGET_32BIT && reload_completed"
14883 [(set (match_dup 0)
14884 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
14886 (compare:CC (match_dup 0)
14890 (define_insn "*neg_geu<mode>"
14891 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
14892 (neg:P (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14893 (match_operand:P 2 "reg_or_short_operand" "r,I"))))]
14896 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0
14897 {sfi|subfic} %0,%1,-1\;{a%I2|add%I2c} %0,%0,%2\;{sfe|subfe} %0,%0,%0"
14898 [(set_attr "type" "three")
14899 (set_attr "length" "12")])
14901 (define_insn "*and_neg_geu<mode>"
14902 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,&r")
14904 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14905 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))
14906 (match_operand:P 3 "gpc_reg_operand" "r,r")))]
14909 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0
14910 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
14911 [(set_attr "type" "three")
14912 (set_attr "length" "12")])
14915 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
14918 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14919 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
14920 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
14922 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
14925 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
14926 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
14929 [(set_attr "type" "compare")
14930 (set_attr "length" "12,12,16,16")])
14933 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14936 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14937 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
14938 (match_operand:SI 3 "gpc_reg_operand" ""))
14940 (clobber (match_scratch:SI 4 ""))]
14941 "TARGET_32BIT && reload_completed"
14942 [(set (match_dup 4)
14943 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2)))
14946 (compare:CC (match_dup 4)
14951 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
14954 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14955 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
14956 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
14958 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
14959 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
14962 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
14963 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
14966 [(set_attr "type" "compare")
14967 (set_attr "length" "12,12,16,16")])
14970 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14973 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14974 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
14975 (match_operand:SI 3 "gpc_reg_operand" ""))
14977 (set (match_operand:SI 0 "gpc_reg_operand" "")
14978 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
14979 "TARGET_32BIT && reload_completed"
14980 [(set (match_dup 0)
14981 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
14983 (compare:CC (match_dup 0)
14988 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14989 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14990 (match_operand:SI 2 "reg_or_short_operand" "r")))]
14992 "doz %0,%2,%1\;nabs %0,%0\;{sri|srwi} %0,%0,31"
14993 [(set_attr "length" "12")])
14996 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
14998 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14999 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
15001 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
15002 (gt:SI (match_dup 1) (match_dup 2)))]
15005 doz %0,%2,%1\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
15007 [(set_attr "type" "delayed_compare")
15008 (set_attr "length" "12,16")])
15011 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
15013 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
15014 (match_operand:SI 2 "reg_or_short_operand" ""))
15016 (set (match_operand:SI 0 "gpc_reg_operand" "")
15017 (gt:SI (match_dup 1) (match_dup 2)))]
15018 "TARGET_POWER && reload_completed"
15019 [(set (match_dup 0)
15020 (gt:SI (match_dup 1) (match_dup 2)))
15022 (compare:CC (match_dup 0)
15026 (define_insn "*plus_gt0<mode>"
15027 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
15028 (plus:P (gt:P (match_operand:P 1 "gpc_reg_operand" "r")
15030 (match_operand:P 2 "gpc_reg_operand" "r")))]
15032 "{a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze|addze} %0,%2"
15033 [(set_attr "type" "three")
15034 (set_attr "length" "12")])
15037 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
15039 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
15041 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
15043 (clobber (match_scratch:SI 3 "=&r,&r"))]
15046 {a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze.|addze.} %3,%2
15048 [(set_attr "type" "compare")
15049 (set_attr "length" "12,16")])
15052 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
15054 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
15056 (match_operand:SI 2 "gpc_reg_operand" ""))
15058 (clobber (match_scratch:SI 3 ""))]
15059 "TARGET_32BIT && reload_completed"
15060 [(set (match_dup 3)
15061 (plus:SI (gt:SI (match_dup 1) (const_int 0))
15064 (compare:CC (match_dup 3)
15069 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
15071 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
15073 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
15075 (clobber (match_scratch:DI 3 "=&r,&r"))]
15078 addc %3,%1,%1\;subfe %3,%1,%3\;addze. %3,%2
15080 [(set_attr "type" "compare")
15081 (set_attr "length" "12,16")])
15084 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
15086 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
15088 (match_operand:DI 2 "gpc_reg_operand" ""))
15090 (clobber (match_scratch:DI 3 ""))]
15091 "TARGET_64BIT && reload_completed"
15092 [(set (match_dup 3)
15093 (plus:DI (gt:DI (match_dup 1) (const_int 0))
15096 (compare:CC (match_dup 3)
15101 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
15103 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
15105 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
15107 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
15108 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
15111 {a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze.|addze.} %0,%2
15113 [(set_attr "type" "compare")
15114 (set_attr "length" "12,16")])
15117 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
15119 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
15121 (match_operand:SI 2 "gpc_reg_operand" ""))
15123 (set (match_operand:SI 0 "gpc_reg_operand" "")
15124 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
15125 "TARGET_32BIT && reload_completed"
15126 [(set (match_dup 0)
15127 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))
15129 (compare:CC (match_dup 0)
15134 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
15136 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
15138 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
15140 (set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
15141 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
15144 addc %0,%1,%1\;subfe %0,%1,%0\;addze. %0,%2
15146 [(set_attr "type" "compare")
15147 (set_attr "length" "12,16")])
15150 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
15152 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
15154 (match_operand:DI 2 "gpc_reg_operand" ""))
15156 (set (match_operand:DI 0 "gpc_reg_operand" "")
15157 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
15158 "TARGET_64BIT && reload_completed"
15159 [(set (match_dup 0)
15160 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))
15162 (compare:CC (match_dup 0)
15167 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
15168 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
15169 (match_operand:SI 2 "reg_or_short_operand" "r"))
15170 (match_operand:SI 3 "gpc_reg_operand" "r")))]
15172 "doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
15173 [(set_attr "length" "12")])
15176 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
15178 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
15179 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
15180 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
15182 (clobber (match_scratch:SI 4 "=&r,&r"))]
15185 doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
15187 [(set_attr "type" "compare")
15188 (set_attr "length" "12,16")])
15191 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
15193 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
15194 (match_operand:SI 2 "reg_or_short_operand" ""))
15195 (match_operand:SI 3 "gpc_reg_operand" ""))
15197 (clobber (match_scratch:SI 4 ""))]
15198 "TARGET_POWER && reload_completed"
15199 [(set (match_dup 4)
15200 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
15202 (compare:CC (match_dup 4)
15207 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
15209 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
15210 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
15211 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
15213 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
15214 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
15217 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
15219 [(set_attr "type" "compare")
15220 (set_attr "length" "12,16")])
15223 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
15225 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
15226 (match_operand:SI 2 "reg_or_short_operand" ""))
15227 (match_operand:SI 3 "gpc_reg_operand" ""))
15229 (set (match_operand:SI 0 "gpc_reg_operand" "")
15230 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
15231 "TARGET_POWER && reload_completed"
15232 [(set (match_dup 0)
15233 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
15235 (compare:CC (match_dup 0)
15240 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
15241 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
15242 (match_operand:SI 2 "reg_or_short_operand" "r"))))]
15244 "doz %0,%2,%1\;nabs %0,%0\;{srai|srawi} %0,%0,31"
15245 [(set_attr "length" "12")])
15247 (define_insn_and_split "*gtu<mode>"
15248 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
15249 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
15250 (match_operand:P 2 "reg_or_short_operand" "rI")))]
15254 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
15255 (set (match_dup 0) (neg:P (match_dup 0)))]
15258 (define_insn_and_split "*gtu<mode>_compare"
15259 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
15261 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
15262 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
15264 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
15265 (gtu:P (match_dup 1) (match_dup 2)))]
15269 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
15270 (parallel [(set (match_dup 3)
15271 (compare:CC (neg:P (match_dup 0)) (const_int 0)))
15272 (set (match_dup 0) (neg:P (match_dup 0)))])]
15275 (define_insn_and_split "*plus_gtu<mode>"
15276 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
15277 (plus:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
15278 (match_operand:P 2 "reg_or_short_operand" "rI"))
15279 (match_operand:P 3 "reg_or_short_operand" "rI")))]
15282 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
15283 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
15284 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))]
15287 (define_insn_and_split "*plus_gtu<mode>_compare"
15288 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
15290 (plus:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
15291 (match_operand:P 2 "reg_or_short_operand" "I,r,I,r"))
15292 (match_operand:P 3 "gpc_reg_operand" "r,r,r,r"))
15294 (set (match_operand:P 0 "gpc_reg_operand" "=&r,&r,&r,&r")
15295 (plus:P (gtu:P (match_dup 1) (match_dup 2)) (match_dup 3)))]
15298 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
15299 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
15300 (parallel [(set (match_dup 4)
15301 (compare:CC (minus:P (match_dup 3) (match_dup 0))
15303 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))])]
15306 (define_insn "*neg_gtu<mode>"
15307 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
15308 (neg:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
15309 (match_operand:P 2 "reg_or_short_operand" "rI"))))]
15311 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0"
15312 [(set_attr "type" "two")
15313 (set_attr "length" "8")])
15316 ;; Define both directions of branch and return. If we need a reload
15317 ;; register, we'd rather use CR0 since it is much easier to copy a
15318 ;; register CC value to there.
15322 (if_then_else (match_operator 1 "branch_comparison_operator"
15324 "cc_reg_operand" "y")
15326 (label_ref (match_operand 0 "" ""))
15331 return output_cbranch (operands[1], \"%l0\", 0, insn);
15333 [(set_attr "type" "branch")])
15337 (if_then_else (match_operator 0 "branch_comparison_operator"
15339 "cc_reg_operand" "y")
15346 return output_cbranch (operands[0], NULL, 0, insn);
15348 [(set_attr "type" "jmpreg")
15349 (set_attr "length" "4")])
15353 (if_then_else (match_operator 1 "branch_comparison_operator"
15355 "cc_reg_operand" "y")
15358 (label_ref (match_operand 0 "" ""))))]
15362 return output_cbranch (operands[1], \"%l0\", 1, insn);
15364 [(set_attr "type" "branch")])
15368 (if_then_else (match_operator 0 "branch_comparison_operator"
15370 "cc_reg_operand" "y")
15377 return output_cbranch (operands[0], NULL, 1, insn);
15379 [(set_attr "type" "jmpreg")
15380 (set_attr "length" "4")])
15382 ;; Logic on condition register values.
15384 ; This pattern matches things like
15385 ; (set (reg:CCEQ 68) (compare:CCEQ (ior:SI (gt:SI (reg:CCFP 68) (const_int 0))
15386 ; (eq:SI (reg:CCFP 68) (const_int 0)))
15388 ; which are generated by the branch logic.
15389 ; Prefer destructive operations where BT = BB (for crXX BT,BA,BB)
15391 (define_insn "*cceq_ior_compare"
15392 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
15393 (compare:CCEQ (match_operator:SI 1 "boolean_operator"
15394 [(match_operator:SI 2
15395 "branch_positive_comparison_operator"
15397 "cc_reg_operand" "y,y")
15399 (match_operator:SI 4
15400 "branch_positive_comparison_operator"
15402 "cc_reg_operand" "0,y")
15406 "cr%q1 %E0,%j2,%j4"
15407 [(set_attr "type" "cr_logical,delayed_cr")])
15409 ; Why is the constant -1 here, but 1 in the previous pattern?
15410 ; Because ~1 has all but the low bit set.
15412 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
15413 (compare:CCEQ (match_operator:SI 1 "boolean_or_operator"
15414 [(not:SI (match_operator:SI 2
15415 "branch_positive_comparison_operator"
15417 "cc_reg_operand" "y,y")
15419 (match_operator:SI 4
15420 "branch_positive_comparison_operator"
15422 "cc_reg_operand" "0,y")
15426 "cr%q1 %E0,%j2,%j4"
15427 [(set_attr "type" "cr_logical,delayed_cr")])
15429 (define_insn "*cceq_rev_compare"
15430 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
15431 (compare:CCEQ (match_operator:SI 1
15432 "branch_positive_comparison_operator"
15434 "cc_reg_operand" "0,y")
15438 "{crnor %E0,%j1,%j1|crnot %E0,%j1}"
15439 [(set_attr "type" "cr_logical,delayed_cr")])
15441 ;; If we are comparing the result of two comparisons, this can be done
15442 ;; using creqv or crxor.
15444 (define_insn_and_split ""
15445 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
15446 (compare:CCEQ (match_operator 1 "branch_comparison_operator"
15447 [(match_operand 2 "cc_reg_operand" "y")
15449 (match_operator 3 "branch_comparison_operator"
15450 [(match_operand 4 "cc_reg_operand" "y")
15455 [(set (match_dup 0) (compare:CCEQ (xor:SI (match_dup 1) (match_dup 3))
15459 int positive_1, positive_2;
15461 positive_1 = branch_positive_comparison_operator (operands[1],
15462 GET_MODE (operands[1]));
15463 positive_2 = branch_positive_comparison_operator (operands[3],
15464 GET_MODE (operands[3]));
15467 operands[1] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[2]),
15468 GET_CODE (operands[1])),
15470 operands[2], const0_rtx);
15471 else if (GET_MODE (operands[1]) != SImode)
15472 operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]), SImode,
15473 operands[2], const0_rtx);
15476 operands[3] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[4]),
15477 GET_CODE (operands[3])),
15479 operands[4], const0_rtx);
15480 else if (GET_MODE (operands[3]) != SImode)
15481 operands[3] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
15482 operands[4], const0_rtx);
15484 if (positive_1 == positive_2)
15486 operands[1] = gen_rtx_NOT (SImode, operands[1]);
15487 operands[5] = constm1_rtx;
15491 operands[5] = const1_rtx;
15495 ;; Unconditional branch and return.
15497 (define_insn "jump"
15499 (label_ref (match_operand 0 "" "")))]
15502 [(set_attr "type" "branch")])
15504 (define_insn "return"
15508 [(set_attr "type" "jmpreg")])
15510 (define_expand "indirect_jump"
15511 [(set (pc) (match_operand 0 "register_operand" ""))])
15513 (define_insn "*indirect_jump<mode>"
15514 [(set (pc) (match_operand:P 0 "register_operand" "c,*l"))]
15519 [(set_attr "type" "jmpreg")])
15521 ;; Table jump for switch statements:
15522 (define_expand "tablejump"
15523 [(use (match_operand 0 "" ""))
15524 (use (label_ref (match_operand 1 "" "")))]
15529 emit_jump_insn (gen_tablejumpsi (operands[0], operands[1]));
15531 emit_jump_insn (gen_tablejumpdi (operands[0], operands[1]));
15535 (define_expand "tablejumpsi"
15536 [(set (match_dup 3)
15537 (plus:SI (match_operand:SI 0 "" "")
15539 (parallel [(set (pc) (match_dup 3))
15540 (use (label_ref (match_operand 1 "" "")))])]
15543 { operands[0] = force_reg (SImode, operands[0]);
15544 operands[2] = force_reg (SImode, gen_rtx_LABEL_REF (SImode, operands[1]));
15545 operands[3] = gen_reg_rtx (SImode);
15548 (define_expand "tablejumpdi"
15549 [(set (match_dup 4)
15550 (sign_extend:DI (match_operand:SI 0 "lwa_operand" "")))
15552 (plus:DI (match_dup 4)
15554 (parallel [(set (pc) (match_dup 3))
15555 (use (label_ref (match_operand 1 "" "")))])]
15558 { operands[2] = force_reg (DImode, gen_rtx_LABEL_REF (DImode, operands[1]));
15559 operands[3] = gen_reg_rtx (DImode);
15560 operands[4] = gen_reg_rtx (DImode);
15563 (define_insn "*tablejump<mode>_internal1"
15565 (match_operand:P 0 "register_operand" "c,*l"))
15566 (use (label_ref (match_operand 1 "" "")))]
15571 [(set_attr "type" "jmpreg")])
15576 "{cror 0,0,0|nop}")
15578 ;; Define the subtract-one-and-jump insns, starting with the template
15579 ;; so loop.c knows what to generate.
15581 (define_expand "doloop_end"
15582 [(use (match_operand 0 "" "")) ; loop pseudo
15583 (use (match_operand 1 "" "")) ; iterations; zero if unknown
15584 (use (match_operand 2 "" "")) ; max iterations
15585 (use (match_operand 3 "" "")) ; loop level
15586 (use (match_operand 4 "" ""))] ; label
15590 /* Only use this on innermost loops. */
15591 if (INTVAL (operands[3]) > 1)
15595 if (GET_MODE (operands[0]) != DImode)
15597 emit_jump_insn (gen_ctrdi (operands[0], operands[4]));
15601 if (GET_MODE (operands[0]) != SImode)
15603 emit_jump_insn (gen_ctrsi (operands[0], operands[4]));
15608 (define_expand "ctr<mode>"
15609 [(parallel [(set (pc)
15610 (if_then_else (ne (match_operand:P 0 "register_operand" "")
15612 (label_ref (match_operand 1 "" ""))
15615 (plus:P (match_dup 0)
15617 (clobber (match_scratch:CC 2 ""))
15618 (clobber (match_scratch:P 3 ""))])]
15622 ;; We need to be able to do this for any operand, including MEM, or we
15623 ;; will cause reload to blow up since we don't allow output reloads on
15625 ;; For the length attribute to be calculated correctly, the
15626 ;; label MUST be operand 0.
15628 (define_insn "*ctr<mode>_internal1"
15630 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
15632 (label_ref (match_operand 0 "" ""))
15634 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
15635 (plus:P (match_dup 1)
15637 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
15638 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
15642 if (which_alternative != 0)
15644 else if (get_attr_length (insn) == 4)
15645 return \"{bdn|bdnz} %l0\";
15647 return \"bdz $+8\;b %l0\";
15649 [(set_attr "type" "branch")
15650 (set_attr "length" "*,12,16,16")])
15652 (define_insn "*ctr<mode>_internal2"
15654 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
15657 (label_ref (match_operand 0 "" ""))))
15658 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
15659 (plus:P (match_dup 1)
15661 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
15662 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
15666 if (which_alternative != 0)
15668 else if (get_attr_length (insn) == 4)
15669 return \"bdz %l0\";
15671 return \"{bdn|bdnz} $+8\;b %l0\";
15673 [(set_attr "type" "branch")
15674 (set_attr "length" "*,12,16,16")])
15676 ;; Similar but use EQ
15678 (define_insn "*ctr<mode>_internal5"
15680 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
15682 (label_ref (match_operand 0 "" ""))
15684 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
15685 (plus:P (match_dup 1)
15687 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
15688 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
15692 if (which_alternative != 0)
15694 else if (get_attr_length (insn) == 4)
15695 return \"bdz %l0\";
15697 return \"{bdn|bdnz} $+8\;b %l0\";
15699 [(set_attr "type" "branch")
15700 (set_attr "length" "*,12,16,16")])
15702 (define_insn "*ctr<mode>_internal6"
15704 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
15707 (label_ref (match_operand 0 "" ""))))
15708 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
15709 (plus:P (match_dup 1)
15711 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
15712 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
15716 if (which_alternative != 0)
15718 else if (get_attr_length (insn) == 4)
15719 return \"{bdn|bdnz} %l0\";
15721 return \"bdz $+8\;b %l0\";
15723 [(set_attr "type" "branch")
15724 (set_attr "length" "*,12,16,16")])
15726 ;; Now the splitters if we could not allocate the CTR register
15730 (if_then_else (match_operator 2 "comparison_operator"
15731 [(match_operand:P 1 "gpc_reg_operand" "")
15733 (match_operand 5 "" "")
15734 (match_operand 6 "" "")))
15735 (set (match_operand:P 0 "gpc_reg_operand" "")
15736 (plus:P (match_dup 1) (const_int -1)))
15737 (clobber (match_scratch:CC 3 ""))
15738 (clobber (match_scratch:P 4 ""))]
15740 [(parallel [(set (match_dup 3)
15741 (compare:CC (plus:P (match_dup 1)
15745 (plus:P (match_dup 1)
15747 (set (pc) (if_then_else (match_dup 7)
15751 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
15752 operands[3], const0_rtx); }")
15756 (if_then_else (match_operator 2 "comparison_operator"
15757 [(match_operand:P 1 "gpc_reg_operand" "")
15759 (match_operand 5 "" "")
15760 (match_operand 6 "" "")))
15761 (set (match_operand:P 0 "nonimmediate_operand" "")
15762 (plus:P (match_dup 1) (const_int -1)))
15763 (clobber (match_scratch:CC 3 ""))
15764 (clobber (match_scratch:P 4 ""))]
15765 "reload_completed && ! gpc_reg_operand (operands[0], SImode)"
15766 [(parallel [(set (match_dup 3)
15767 (compare:CC (plus:P (match_dup 1)
15771 (plus:P (match_dup 1)
15775 (set (pc) (if_then_else (match_dup 7)
15779 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
15780 operands[3], const0_rtx); }")
15782 (define_insn "trap"
15783 [(trap_if (const_int 1) (const_int 0))]
15786 [(set_attr "type" "trap")])
15788 (define_expand "ctrap<mode>4"
15789 [(trap_if (match_operator 0 "ordered_comparison_operator"
15790 [(match_operand:GPR 1 "register_operand")
15791 (match_operand:GPR 2 "reg_or_short_operand")])
15792 (match_operand 3 "zero_constant" ""))]
15797 [(trap_if (match_operator 0 "ordered_comparison_operator"
15798 [(match_operand:GPR 1 "register_operand" "r")
15799 (match_operand:GPR 2 "reg_or_short_operand" "rI")])
15802 "{t|t<wd>}%V0%I2 %1,%2"
15803 [(set_attr "type" "trap")])
15805 ;; Insns related to generating the function prologue and epilogue.
15807 (define_expand "prologue"
15808 [(use (const_int 0))]
15809 "TARGET_SCHED_PROLOG"
15812 rs6000_emit_prologue ();
15816 (define_insn "*movesi_from_cr_one"
15817 [(match_parallel 0 "mfcr_operation"
15818 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
15819 (unspec:SI [(match_operand:CC 2 "cc_reg_operand" "y")
15820 (match_operand 3 "immediate_operand" "n")]
15821 UNSPEC_MOVESI_FROM_CR))])]
15827 for (i = 0; i < XVECLEN (operands[0], 0); i++)
15829 mask = INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
15830 operands[4] = GEN_INT (mask);
15831 output_asm_insn (\"mfcr %1,%4\", operands);
15835 [(set_attr "type" "mfcrf")])
15837 (define_insn "movesi_from_cr"
15838 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
15839 (unspec:SI [(reg:CC CR0_REGNO) (reg:CC CR1_REGNO)
15840 (reg:CC CR2_REGNO) (reg:CC CR3_REGNO)
15841 (reg:CC CR4_REGNO) (reg:CC CR5_REGNO)
15842 (reg:CC CR6_REGNO) (reg:CC CR7_REGNO)]
15843 UNSPEC_MOVESI_FROM_CR))]
15846 [(set_attr "type" "mfcr")])
15848 (define_insn "*stmw"
15849 [(match_parallel 0 "stmw_operation"
15850 [(set (match_operand:SI 1 "memory_operand" "=m")
15851 (match_operand:SI 2 "gpc_reg_operand" "r"))])]
15854 [(set_attr "type" "store_ux")])
15856 (define_insn "*save_gpregs_<mode>"
15857 [(match_parallel 0 "any_parallel_operand"
15858 [(clobber (reg:P 65))
15859 (use (match_operand:P 1 "symbol_ref_operand" "s"))
15860 (use (match_operand:P 2 "gpc_reg_operand" "r"))
15861 (set (match_operand:P 3 "memory_operand" "=m")
15862 (match_operand:P 4 "gpc_reg_operand" "r"))])]
15865 [(set_attr "type" "branch")
15866 (set_attr "length" "4")])
15868 (define_insn "*save_fpregs_<mode>"
15869 [(match_parallel 0 "any_parallel_operand"
15870 [(clobber (reg:P 65))
15871 (use (match_operand:P 1 "symbol_ref_operand" "s"))
15872 (use (match_operand:P 2 "gpc_reg_operand" "r"))
15873 (set (match_operand:DF 3 "memory_operand" "=m")
15874 (match_operand:DF 4 "gpc_reg_operand" "d"))])]
15877 [(set_attr "type" "branch")
15878 (set_attr "length" "4")])
15880 ; These are to explain that changes to the stack pointer should
15881 ; not be moved over stores to stack memory.
15882 (define_insn "stack_tie"
15883 [(set (match_operand:BLK 0 "memory_operand" "+m")
15884 (unspec:BLK [(match_dup 0)] UNSPEC_TIE))]
15887 [(set_attr "length" "0")])
15889 ; Like stack_tie, but depend on both fp and sp based memory.
15890 (define_insn "frame_tie"
15891 [(set (match_operand:BLK 0 "memory_operand" "+m")
15892 (unspec:BLK [(match_dup 0)
15893 (match_operand:BLK 1 "memory_operand" "m")] UNSPEC_TIE))]
15896 [(set_attr "length" "0")])
15899 (define_expand "epilogue"
15900 [(use (const_int 0))]
15901 "TARGET_SCHED_PROLOG"
15904 rs6000_emit_epilogue (FALSE);
15908 ; On some processors, doing the mtcrf one CC register at a time is
15909 ; faster (like on the 604e). On others, doing them all at once is
15910 ; faster; for instance, on the 601 and 750.
15912 (define_expand "movsi_to_cr_one"
15913 [(set (match_operand:CC 0 "cc_reg_operand" "")
15914 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "")
15915 (match_dup 2)] UNSPEC_MOVESI_TO_CR))]
15917 "operands[2] = GEN_INT (1 << (75 - REGNO (operands[0])));")
15919 (define_insn "*movsi_to_cr"
15920 [(match_parallel 0 "mtcrf_operation"
15921 [(set (match_operand:CC 1 "cc_reg_operand" "=y")
15922 (unspec:CC [(match_operand:SI 2 "gpc_reg_operand" "r")
15923 (match_operand 3 "immediate_operand" "n")]
15924 UNSPEC_MOVESI_TO_CR))])]
15930 for (i = 0; i < XVECLEN (operands[0], 0); i++)
15931 mask |= INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
15932 operands[4] = GEN_INT (mask);
15933 return \"mtcrf %4,%2\";
15935 [(set_attr "type" "mtcr")])
15937 (define_insn "*mtcrfsi"
15938 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
15939 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
15940 (match_operand 2 "immediate_operand" "n")]
15941 UNSPEC_MOVESI_TO_CR))]
15942 "GET_CODE (operands[0]) == REG
15943 && CR_REGNO_P (REGNO (operands[0]))
15944 && GET_CODE (operands[2]) == CONST_INT
15945 && INTVAL (operands[2]) == 1 << (75 - REGNO (operands[0]))"
15947 [(set_attr "type" "mtcr")])
15949 ; The load-multiple instructions have similar properties.
15950 ; Note that "load_multiple" is a name known to the machine-independent
15951 ; code that actually corresponds to the PowerPC load-string.
15953 (define_insn "*lmw"
15954 [(match_parallel 0 "lmw_operation"
15955 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
15956 (match_operand:SI 2 "memory_operand" "m"))])]
15959 [(set_attr "type" "load_ux")
15960 (set_attr "cell_micro" "always")])
15962 (define_insn "*return_internal_<mode>"
15964 (use (match_operand:P 0 "register_operand" "lc"))]
15967 [(set_attr "type" "jmpreg")])
15969 ; FIXME: This would probably be somewhat simpler if the Cygnus sibcall
15970 ; stuff was in GCC. Oh, and "any_parallel_operand" is a bit flexible...
15972 (define_insn "*restore_gpregs_<mode>"
15973 [(match_parallel 0 "any_parallel_operand"
15974 [(clobber (match_operand:P 1 "register_operand" "=l"))
15975 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15976 (use (match_operand:P 3 "gpc_reg_operand" "r"))
15977 (set (match_operand:P 4 "gpc_reg_operand" "=r")
15978 (match_operand:P 5 "memory_operand" "m"))])]
15981 [(set_attr "type" "branch")
15982 (set_attr "length" "4")])
15984 (define_insn "*return_and_restore_gpregs_<mode>"
15985 [(match_parallel 0 "any_parallel_operand"
15987 (clobber (match_operand:P 1 "register_operand" "=l"))
15988 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15989 (use (match_operand:P 3 "gpc_reg_operand" "r"))
15990 (set (match_operand:P 4 "gpc_reg_operand" "=r")
15991 (match_operand:P 5 "memory_operand" "m"))])]
15994 [(set_attr "type" "branch")
15995 (set_attr "length" "4")])
15997 (define_insn "*return_and_restore_fpregs_<mode>"
15998 [(match_parallel 0 "any_parallel_operand"
16000 (clobber (match_operand:P 1 "register_operand" "=l"))
16001 (use (match_operand:P 2 "symbol_ref_operand" "s"))
16002 (use (match_operand:P 3 "gpc_reg_operand" "r"))
16003 (set (match_operand:DF 4 "gpc_reg_operand" "=d")
16004 (match_operand:DF 5 "memory_operand" "m"))])]
16007 [(set_attr "type" "branch")
16008 (set_attr "length" "4")])
16010 (define_insn "*return_and_restore_fpregs_aix_<mode>"
16011 [(match_parallel 0 "any_parallel_operand"
16013 (use (match_operand:P 1 "register_operand" "l"))
16014 (use (match_operand:P 2 "symbol_ref_operand" "s"))
16015 (use (match_operand:P 3 "gpc_reg_operand" "r"))
16016 (set (match_operand:DF 4 "gpc_reg_operand" "=d")
16017 (match_operand:DF 5 "memory_operand" "m"))])]
16020 [(set_attr "type" "branch")
16021 (set_attr "length" "4")])
16023 ; This is used in compiling the unwind routines.
16024 (define_expand "eh_return"
16025 [(use (match_operand 0 "general_operand" ""))]
16030 emit_insn (gen_eh_set_lr_si (operands[0]));
16032 emit_insn (gen_eh_set_lr_di (operands[0]));
16036 ; We can't expand this before we know where the link register is stored.
16037 (define_insn "eh_set_lr_<mode>"
16038 [(unspec_volatile [(match_operand:P 0 "register_operand" "r")]
16040 (clobber (match_scratch:P 1 "=&b"))]
16045 [(unspec_volatile [(match_operand 0 "register_operand" "")] UNSPECV_EH_RR)
16046 (clobber (match_scratch 1 ""))]
16051 rs6000_emit_eh_reg_restore (operands[0], operands[1]);
16055 (define_insn "prefetch"
16056 [(prefetch (match_operand 0 "indexed_or_indirect_address" "a")
16057 (match_operand:SI 1 "const_int_operand" "n")
16058 (match_operand:SI 2 "const_int_operand" "n"))]
16062 if (GET_CODE (operands[0]) == REG)
16063 return INTVAL (operands[1]) ? \"dcbtst 0,%0\" : \"dcbt 0,%0\";
16064 return INTVAL (operands[1]) ? \"dcbtst %a0\" : \"dcbt %a0\";
16066 [(set_attr "type" "load")])
16068 (define_insn "bpermd_<mode>"
16069 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
16070 (unspec:P [(match_operand:P 1 "gpc_reg_operand" "r")
16071 (match_operand:P 2 "gpc_reg_operand" "r")] UNSPEC_BPERM))]
16074 [(set_attr "type" "integer")])
16078 (include "sync.md")
16079 (include "vector.md")
16081 (include "altivec.md")
16084 (include "paired.md")