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 ; builtin fmaf support
5848 ; If the user explicitly uses the fma builtin, don't convert this to
5849 ; (plus (mult op1 op2) op3)
5850 (define_expand "fmasf4"
5851 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5852 (fma:SF (match_operand:SF 1 "gpc_reg_operand" "")
5853 (match_operand:SF 2 "gpc_reg_operand" "")
5854 (match_operand:SF 3 "gpc_reg_operand" "")))]
5855 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5858 (define_insn "fmasf4_fpr"
5859 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5860 (fma: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_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5866 return ((TARGET_POWERPC)
5867 ? \"fmadds %0,%1,%2,%3\"
5868 : \"{fma|fmadd} %0,%1,%2,%3\");
5870 [(set_attr "type" "fp")
5871 (set_attr "fp_type" "fp_maddsub_s")])
5873 (define_insn "*fmssf4_fpr"
5874 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5875 (fma:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5876 (match_operand:SF 2 "gpc_reg_operand" "f")
5877 (neg:SF (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5878 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5881 return ((TARGET_POWERPC)
5882 ? \"fmsubs %0,%1,%2,%3\"
5883 : \"{fms|fmsub} %0,%1,%2,%3\");
5885 [(set_attr "type" "fp")
5886 (set_attr "fp_type" "fp_maddsub_s")])
5888 (define_insn "*fnmasf4_fpr"
5889 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5890 (neg:SF (fma:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5891 (match_operand:SF 2 "gpc_reg_operand" "f")
5892 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5893 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5896 return ((TARGET_POWERPC)
5897 ? \"fnmadds %0,%1,%2,%3\"
5898 : \"{fnma|fnmadd} %0,%1,%2,%3\");
5900 [(set_attr "type" "fp")
5901 (set_attr "fp_type" "fp_maddsub_s")])
5903 (define_insn "*fnmssf4_fpr"
5904 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5905 (neg:SF (fma:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5906 (match_operand:SF 2 "gpc_reg_operand" "f")
5907 (neg:SF (match_operand:SF 3 "gpc_reg_operand" "f")))))]
5908 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5911 return ((TARGET_POWERPC)
5912 ? \"fnmsubs %0,%1,%2,%3\"
5913 : \"{fnms|fnmsub} %0,%1,%2,%3\");
5915 [(set_attr "type" "fp")
5916 (set_attr "fp_type" "fp_maddsub_s")])
5918 ; Fused multiply/add ops created by the combiner
5919 (define_insn "*fmaddsf4_powerpc"
5920 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5921 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5922 (match_operand:SF 2 "gpc_reg_operand" "f"))
5923 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5924 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS
5925 && TARGET_SINGLE_FLOAT && TARGET_FUSED_MADD"
5926 "fmadds %0,%1,%2,%3"
5927 [(set_attr "type" "fp")
5928 (set_attr "fp_type" "fp_maddsub_s")])
5930 (define_insn "*fmaddsf4_power"
5931 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5932 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5933 (match_operand:SF 2 "gpc_reg_operand" "f"))
5934 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5935 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5936 "{fma|fmadd} %0,%1,%2,%3"
5937 [(set_attr "type" "dmul")])
5939 (define_insn "*fmsubsf4_powerpc"
5940 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5941 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5942 (match_operand:SF 2 "gpc_reg_operand" "f"))
5943 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5944 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS
5945 && TARGET_SINGLE_FLOAT && TARGET_FUSED_MADD"
5946 "fmsubs %0,%1,%2,%3"
5947 [(set_attr "type" "fp")
5948 (set_attr "fp_type" "fp_maddsub_s")])
5950 (define_insn "*fmsubsf4_power"
5951 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5952 (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 "{fms|fmsub} %0,%1,%2,%3"
5957 [(set_attr "type" "dmul")])
5959 (define_insn "*fnmaddsf4_powerpc_1"
5960 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5961 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5962 (match_operand:SF 2 "gpc_reg_operand" "f"))
5963 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5964 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5965 && TARGET_SINGLE_FLOAT"
5966 "fnmadds %0,%1,%2,%3"
5967 [(set_attr "type" "fp")
5968 (set_attr "fp_type" "fp_maddsub_s")])
5970 (define_insn "*fnmaddsf4_powerpc_2"
5971 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5972 (minus:SF (mult:SF (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f"))
5973 (match_operand:SF 2 "gpc_reg_operand" "f"))
5974 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5975 "TARGET_POWERPC && TARGET_SINGLE_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5976 && ! HONOR_SIGNED_ZEROS (SFmode)"
5977 "fnmadds %0,%1,%2,%3"
5978 [(set_attr "type" "fp")
5979 (set_attr "fp_type" "fp_maddsub_s")])
5981 (define_insn "*fnmaddsf4_power_1"
5982 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5983 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5984 (match_operand:SF 2 "gpc_reg_operand" "f"))
5985 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5986 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5987 "{fnma|fnmadd} %0,%1,%2,%3"
5988 [(set_attr "type" "dmul")])
5990 (define_insn "*fnmaddsf4_power_2"
5991 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5992 (minus:SF (mult:SF (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f"))
5993 (match_operand:SF 2 "gpc_reg_operand" "f"))
5994 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5995 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5996 && ! HONOR_SIGNED_ZEROS (SFmode)"
5997 "{fnma|fnmadd} %0,%1,%2,%3"
5998 [(set_attr "type" "dmul")])
6000 (define_insn "*fnmsubsf4_powerpc_1"
6001 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6002 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
6003 (match_operand:SF 2 "gpc_reg_operand" "f"))
6004 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
6005 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
6006 && TARGET_SINGLE_FLOAT"
6007 "fnmsubs %0,%1,%2,%3"
6008 [(set_attr "type" "fp")
6009 (set_attr "fp_type" "fp_maddsub_s")])
6011 (define_insn "*fnmsubsf4_powerpc_2"
6012 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6013 (minus:SF (match_operand:SF 3 "gpc_reg_operand" "f")
6014 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
6015 (match_operand:SF 2 "gpc_reg_operand" "f"))))]
6016 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
6017 && TARGET_SINGLE_FLOAT && ! HONOR_SIGNED_ZEROS (SFmode)"
6018 "fnmsubs %0,%1,%2,%3"
6019 [(set_attr "type" "fp")
6020 (set_attr "fp_type" "fp_maddsub_s")])
6022 (define_insn "*fnmsubsf4_power_1"
6023 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6024 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
6025 (match_operand:SF 2 "gpc_reg_operand" "f"))
6026 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
6027 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
6028 "{fnms|fnmsub} %0,%1,%2,%3"
6029 [(set_attr "type" "dmul")])
6031 (define_insn "*fnmsubsf4_power_2"
6032 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6033 (minus:SF (match_operand:SF 3 "gpc_reg_operand" "f")
6034 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
6035 (match_operand:SF 2 "gpc_reg_operand" "f"))))]
6036 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
6037 && ! HONOR_SIGNED_ZEROS (SFmode)"
6038 "{fnms|fnmsub} %0,%1,%2,%3"
6039 [(set_attr "type" "dmul")])
6041 (define_expand "sqrtsf2"
6042 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6043 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
6044 "(TARGET_PPC_GPOPT || TARGET_POWER2 || TARGET_XILINX_FPU)
6045 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
6046 && !TARGET_SIMPLE_FPU"
6050 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6051 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
6052 "(TARGET_PPC_GPOPT || TARGET_XILINX_FPU) && TARGET_HARD_FLOAT
6053 && TARGET_FPRS && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
6055 [(set_attr "type" "ssqrt")])
6058 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6059 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
6060 "TARGET_POWER2 && TARGET_HARD_FLOAT && TARGET_FPRS
6061 && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
6063 [(set_attr "type" "dsqrt")])
6065 (define_insn "*rsqrtsf_internal1"
6066 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6067 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")]
6071 [(set_attr "type" "fp")])
6073 (define_expand "copysign<mode>3"
6075 (abs:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")))
6077 (neg:SFDF (abs:SFDF (match_dup 1))))
6078 (set (match_operand:SFDF 0 "gpc_reg_operand" "")
6079 (if_then_else:SFDF (ge (match_operand:SFDF 2 "gpc_reg_operand" "")
6083 "TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>
6084 && ((TARGET_PPC_GFXOPT
6085 && !HONOR_NANS (<MODE>mode)
6086 && !HONOR_SIGNED_ZEROS (<MODE>mode))
6088 || VECTOR_UNIT_VSX_P (<MODE>mode))"
6090 if (TARGET_CMPB || VECTOR_UNIT_VSX_P (<MODE>mode))
6092 emit_insn (gen_copysign<mode>3_fcpsgn (operands[0], operands[1],
6097 operands[3] = gen_reg_rtx (<MODE>mode);
6098 operands[4] = gen_reg_rtx (<MODE>mode);
6099 operands[5] = CONST0_RTX (<MODE>mode);
6102 ;; Use an unspec rather providing an if-then-else in RTL, to prevent the
6103 ;; compiler from optimizing -0.0
6104 (define_insn "copysign<mode>3_fcpsgn"
6105 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
6106 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")
6107 (match_operand:SFDF 2 "gpc_reg_operand" "<rreg2>")]
6109 "TARGET_CMPB && !VECTOR_UNIT_VSX_P (<MODE>mode)"
6111 [(set_attr "type" "fp")])
6113 ;; For MIN, MAX, and conditional move, we use DEFINE_EXPAND's that involve a
6114 ;; fsel instruction and some auxiliary computations. Then we just have a
6115 ;; single DEFINE_INSN for fsel and the define_splits to make them if made by
6117 (define_expand "smaxsf3"
6118 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6119 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
6120 (match_operand:SF 2 "gpc_reg_operand" ""))
6123 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
6124 && TARGET_SINGLE_FLOAT && !flag_trapping_math"
6125 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
6127 (define_expand "sminsf3"
6128 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6129 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
6130 (match_operand:SF 2 "gpc_reg_operand" ""))
6133 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
6134 && TARGET_SINGLE_FLOAT && !flag_trapping_math"
6135 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
6138 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6139 (match_operator:SF 3 "min_max_operator"
6140 [(match_operand:SF 1 "gpc_reg_operand" "")
6141 (match_operand:SF 2 "gpc_reg_operand" "")]))]
6142 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
6143 && TARGET_SINGLE_FLOAT && !flag_trapping_math"
6146 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
6147 operands[1], operands[2]);
6151 (define_expand "mov<mode>cc"
6152 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
6153 (if_then_else:GPR (match_operand 1 "comparison_operator" "")
6154 (match_operand:GPR 2 "gpc_reg_operand" "")
6155 (match_operand:GPR 3 "gpc_reg_operand" "")))]
6159 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
6165 ;; We use the BASE_REGS for the isel input operands because, if rA is
6166 ;; 0, the value of 0 is placed in rD upon truth. Similarly for rB
6167 ;; because we may switch the operands and rB may end up being rA.
6169 ;; We need 2 patterns: an unsigned and a signed pattern. We could
6170 ;; leave out the mode in operand 4 and use one pattern, but reload can
6171 ;; change the mode underneath our feet and then gets confused trying
6172 ;; to reload the value.
6173 (define_insn "isel_signed_<mode>"
6174 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
6176 (match_operator 1 "scc_comparison_operator"
6177 [(match_operand:CC 4 "cc_reg_operand" "y,y")
6179 (match_operand:GPR 2 "reg_or_cint_operand" "O,b")
6180 (match_operand:GPR 3 "gpc_reg_operand" "r,r")))]
6183 { return output_isel (operands); }"
6184 [(set_attr "type" "isel")
6185 (set_attr "length" "4")])
6187 (define_insn "isel_unsigned_<mode>"
6188 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
6190 (match_operator 1 "scc_comparison_operator"
6191 [(match_operand:CCUNS 4 "cc_reg_operand" "y,y")
6193 (match_operand:GPR 2 "reg_or_cint_operand" "O,b")
6194 (match_operand:GPR 3 "gpc_reg_operand" "r,r")))]
6197 { return output_isel (operands); }"
6198 [(set_attr "type" "isel")
6199 (set_attr "length" "4")])
6201 ;; These patterns can be useful for combine; they let combine know that
6202 ;; isel can handle reversed comparisons so long as the operands are
6205 (define_insn "*isel_reversed_signed_<mode>"
6206 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
6208 (match_operator 1 "scc_rev_comparison_operator"
6209 [(match_operand:CC 4 "cc_reg_operand" "y")
6211 (match_operand:GPR 2 "gpc_reg_operand" "b")
6212 (match_operand:GPR 3 "gpc_reg_operand" "b")))]
6215 { return output_isel (operands); }"
6216 [(set_attr "type" "isel")
6217 (set_attr "length" "4")])
6219 (define_insn "*isel_reversed_unsigned_<mode>"
6220 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
6222 (match_operator 1 "scc_rev_comparison_operator"
6223 [(match_operand:CCUNS 4 "cc_reg_operand" "y")
6225 (match_operand:GPR 2 "gpc_reg_operand" "b")
6226 (match_operand:GPR 3 "gpc_reg_operand" "b")))]
6229 { return output_isel (operands); }"
6230 [(set_attr "type" "isel")
6231 (set_attr "length" "4")])
6233 (define_expand "movsfcc"
6234 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6235 (if_then_else:SF (match_operand 1 "comparison_operator" "")
6236 (match_operand:SF 2 "gpc_reg_operand" "")
6237 (match_operand:SF 3 "gpc_reg_operand" "")))]
6238 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
6241 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
6247 (define_insn "*fselsfsf4"
6248 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6249 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
6250 (match_operand:SF 4 "zero_fp_constant" "F"))
6251 (match_operand:SF 2 "gpc_reg_operand" "f")
6252 (match_operand:SF 3 "gpc_reg_operand" "f")))]
6253 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
6255 [(set_attr "type" "fp")])
6257 (define_insn "*fseldfsf4"
6258 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6259 (if_then_else:SF (ge (match_operand:DF 1 "gpc_reg_operand" "d")
6260 (match_operand:DF 4 "zero_fp_constant" "F"))
6261 (match_operand:SF 2 "gpc_reg_operand" "f")
6262 (match_operand:SF 3 "gpc_reg_operand" "f")))]
6263 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_SINGLE_FLOAT"
6265 [(set_attr "type" "fp")])
6267 (define_expand "negdf2"
6268 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6269 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
6270 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6273 (define_insn "*negdf2_fpr"
6274 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6275 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "d")))]
6276 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6277 && !VECTOR_UNIT_VSX_P (DFmode)"
6279 [(set_attr "type" "fp")])
6281 (define_expand "absdf2"
6282 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6283 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
6284 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6287 (define_insn "*absdf2_fpr"
6288 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6289 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "d")))]
6290 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6291 && !VECTOR_UNIT_VSX_P (DFmode)"
6293 [(set_attr "type" "fp")])
6295 (define_insn "*nabsdf2_fpr"
6296 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6297 (neg:DF (abs:DF (match_operand:DF 1 "gpc_reg_operand" "d"))))]
6298 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6299 && !VECTOR_UNIT_VSX_P (DFmode)"
6301 [(set_attr "type" "fp")])
6303 (define_expand "adddf3"
6304 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6305 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "")
6306 (match_operand:DF 2 "gpc_reg_operand" "")))]
6307 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6310 (define_insn "*adddf3_fpr"
6311 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6312 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
6313 (match_operand:DF 2 "gpc_reg_operand" "d")))]
6314 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6315 && !VECTOR_UNIT_VSX_P (DFmode)"
6316 "{fa|fadd} %0,%1,%2"
6317 [(set_attr "type" "fp")
6318 (set_attr "fp_type" "fp_addsub_d")])
6320 (define_expand "subdf3"
6321 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6322 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "")
6323 (match_operand:DF 2 "gpc_reg_operand" "")))]
6324 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6327 (define_insn "*subdf3_fpr"
6328 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6329 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "d")
6330 (match_operand:DF 2 "gpc_reg_operand" "d")))]
6331 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6332 && !VECTOR_UNIT_VSX_P (DFmode)"
6333 "{fs|fsub} %0,%1,%2"
6334 [(set_attr "type" "fp")
6335 (set_attr "fp_type" "fp_addsub_d")])
6337 (define_expand "muldf3"
6338 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6339 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "")
6340 (match_operand:DF 2 "gpc_reg_operand" "")))]
6341 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6344 (define_insn "*muldf3_fpr"
6345 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6346 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
6347 (match_operand:DF 2 "gpc_reg_operand" "d")))]
6348 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6349 && !VECTOR_UNIT_VSX_P (DFmode)"
6350 "{fm|fmul} %0,%1,%2"
6351 [(set_attr "type" "dmul")
6352 (set_attr "fp_type" "fp_mul_d")])
6354 (define_expand "divdf3"
6355 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6356 (div:DF (match_operand:DF 1 "gpc_reg_operand" "")
6357 (match_operand:DF 2 "gpc_reg_operand" "")))]
6359 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)
6360 && !TARGET_SIMPLE_FPU"
6363 (define_insn "*divdf3_fpr"
6364 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6365 (div:DF (match_operand:DF 1 "gpc_reg_operand" "d")
6366 (match_operand:DF 2 "gpc_reg_operand" "d")))]
6367 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && !TARGET_SIMPLE_FPU
6368 && !VECTOR_UNIT_VSX_P (DFmode)"
6369 "{fd|fdiv} %0,%1,%2"
6370 [(set_attr "type" "ddiv")])
6372 (define_insn "*fred_fpr"
6373 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6374 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))]
6375 "TARGET_FRE && !VECTOR_UNIT_VSX_P (DFmode)"
6377 [(set_attr "type" "fp")])
6379 (define_insn "*rsqrtdf_internal1"
6380 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6381 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "d")]
6383 "TARGET_FRSQRTE && !VECTOR_UNIT_VSX_P (DFmode)"
6385 [(set_attr "type" "fp")])
6387 ; builtin fma support
6388 ; If the user explicitly uses the fma builtin, don't convert this to
6389 ; (plus (mult op1 op2) op3)
6390 (define_expand "fmadf4"
6391 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6392 (fma:DF (match_operand:DF 1 "gpc_reg_operand" "")
6393 (match_operand:DF 2 "gpc_reg_operand" "")
6394 (match_operand:DF 3 "gpc_reg_operand" "")))]
6395 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6398 (define_insn "fmadf4_fpr"
6399 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6400 (fma:DF (match_operand:DF 1 "gpc_reg_operand" "f")
6401 (match_operand:DF 2 "gpc_reg_operand" "f")
6402 (match_operand:DF 3 "gpc_reg_operand" "f")))]
6403 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6404 && VECTOR_UNIT_NONE_P (DFmode)"
6405 "{fma|fmadd} %0,%1,%2,%3"
6406 [(set_attr "type" "fp")
6407 (set_attr "fp_type" "fp_maddsub_s")])
6409 (define_insn "*fmsdf4_fpr"
6410 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6411 (fma:DF (match_operand:DF 1 "gpc_reg_operand" "f")
6412 (match_operand:DF 2 "gpc_reg_operand" "f")
6413 (neg:DF (match_operand:DF 3 "gpc_reg_operand" "f"))))]
6414 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6415 && VECTOR_UNIT_NONE_P (DFmode)"
6416 "{fms|fmsub} %0,%1,%2,%3"
6417 [(set_attr "type" "fp")
6418 (set_attr "fp_type" "fp_maddsub_s")])
6420 (define_insn "*fnmadf4_fpr"
6421 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6422 (neg:DF (fma:DF (match_operand:DF 1 "gpc_reg_operand" "f")
6423 (match_operand:DF 2 "gpc_reg_operand" "f")
6424 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
6425 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6426 && VECTOR_UNIT_NONE_P (DFmode)"
6427 "{fnma|fnmadd} %0,%1,%2,%3"
6428 [(set_attr "type" "fp")
6429 (set_attr "fp_type" "fp_maddsub_s")])
6431 (define_insn "*fnmsdf4_fpr"
6432 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6433 (neg:DF (fma:DF (match_operand:DF 1 "gpc_reg_operand" "f")
6434 (match_operand:DF 2 "gpc_reg_operand" "f")
6435 (neg:DF (match_operand:DF 3 "gpc_reg_operand" "f")))))]
6436 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6437 && VECTOR_UNIT_NONE_P (DFmode)"
6438 "{fnms|fnmsub} %0,%1,%2,%3"
6439 [(set_attr "type" "fp")
6440 (set_attr "fp_type" "fp_maddsub_s")])
6442 ; Fused multiply/add ops created by the combiner
6443 (define_insn "*fmadddf4_fpr"
6444 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6445 (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
6446 (match_operand:DF 2 "gpc_reg_operand" "d"))
6447 (match_operand:DF 3 "gpc_reg_operand" "d")))]
6448 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD && TARGET_DOUBLE_FLOAT
6449 && VECTOR_UNIT_NONE_P (DFmode)"
6450 "{fma|fmadd} %0,%1,%2,%3"
6451 [(set_attr "type" "dmul")
6452 (set_attr "fp_type" "fp_maddsub_d")])
6454 (define_insn "*fmsubdf4_fpr"
6455 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6456 (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
6457 (match_operand:DF 2 "gpc_reg_operand" "d"))
6458 (match_operand:DF 3 "gpc_reg_operand" "d")))]
6459 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD && TARGET_DOUBLE_FLOAT
6460 && VECTOR_UNIT_NONE_P (DFmode)"
6461 "{fms|fmsub} %0,%1,%2,%3"
6462 [(set_attr "type" "dmul")
6463 (set_attr "fp_type" "fp_maddsub_d")])
6465 (define_insn "*fnmadddf4_fpr_1"
6466 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6467 (neg:DF (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
6468 (match_operand:DF 2 "gpc_reg_operand" "d"))
6469 (match_operand:DF 3 "gpc_reg_operand" "d"))))]
6470 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD && TARGET_DOUBLE_FLOAT
6471 && VECTOR_UNIT_NONE_P (DFmode)"
6472 "{fnma|fnmadd} %0,%1,%2,%3"
6473 [(set_attr "type" "dmul")
6474 (set_attr "fp_type" "fp_maddsub_d")])
6476 (define_insn "*fnmadddf4_fpr_2"
6477 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6478 (minus:DF (mult:DF (neg:DF (match_operand:DF 1 "gpc_reg_operand" "d"))
6479 (match_operand:DF 2 "gpc_reg_operand" "d"))
6480 (match_operand:DF 3 "gpc_reg_operand" "d")))]
6481 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD && TARGET_DOUBLE_FLOAT
6482 && ! HONOR_SIGNED_ZEROS (DFmode) && VECTOR_UNIT_NONE_P (DFmode)"
6483 "{fnma|fnmadd} %0,%1,%2,%3"
6484 [(set_attr "type" "dmul")
6485 (set_attr "fp_type" "fp_maddsub_d")])
6487 (define_insn "*fnmsubdf4_fpr_1"
6488 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6489 (neg:DF (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
6490 (match_operand:DF 2 "gpc_reg_operand" "d"))
6491 (match_operand:DF 3 "gpc_reg_operand" "d"))))]
6492 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD && TARGET_DOUBLE_FLOAT
6493 && VECTOR_UNIT_NONE_P (DFmode)"
6494 "{fnms|fnmsub} %0,%1,%2,%3"
6495 [(set_attr "type" "dmul")
6496 (set_attr "fp_type" "fp_maddsub_d")])
6498 (define_insn "*fnmsubdf4_fpr_2"
6499 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6500 (minus:DF (match_operand:DF 3 "gpc_reg_operand" "d")
6501 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
6502 (match_operand:DF 2 "gpc_reg_operand" "d"))))]
6503 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD && TARGET_DOUBLE_FLOAT
6504 && ! HONOR_SIGNED_ZEROS (DFmode) && VECTOR_UNIT_NONE_P (DFmode)"
6505 "{fnms|fnmsub} %0,%1,%2,%3"
6506 [(set_attr "type" "dmul")
6507 (set_attr "fp_type" "fp_maddsub_d")])
6509 (define_expand "sqrtdf2"
6510 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6511 (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
6512 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS
6513 && TARGET_DOUBLE_FLOAT"
6516 (define_insn "*sqrtdf2_fpr"
6517 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6518 (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "d")))]
6519 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS
6520 && TARGET_DOUBLE_FLOAT
6521 && !VECTOR_UNIT_VSX_P (DFmode)"
6523 [(set_attr "type" "dsqrt")])
6525 ;; The conditional move instructions allow us to perform max and min
6526 ;; operations even when
6528 (define_expand "smaxdf3"
6529 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6530 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
6531 (match_operand:DF 2 "gpc_reg_operand" ""))
6534 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6535 && !flag_trapping_math"
6536 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
6538 (define_expand "smindf3"
6539 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6540 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
6541 (match_operand:DF 2 "gpc_reg_operand" ""))
6544 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6545 && !flag_trapping_math"
6546 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
6549 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6550 (match_operator:DF 3 "min_max_operator"
6551 [(match_operand:DF 1 "gpc_reg_operand" "")
6552 (match_operand:DF 2 "gpc_reg_operand" "")]))]
6553 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6554 && !flag_trapping_math"
6557 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
6558 operands[1], operands[2]);
6562 (define_expand "movdfcc"
6563 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6564 (if_then_else:DF (match_operand 1 "comparison_operator" "")
6565 (match_operand:DF 2 "gpc_reg_operand" "")
6566 (match_operand:DF 3 "gpc_reg_operand" "")))]
6567 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6570 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
6576 (define_insn "*fseldfdf4"
6577 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6578 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "d")
6579 (match_operand:DF 4 "zero_fp_constant" "F"))
6580 (match_operand:DF 2 "gpc_reg_operand" "d")
6581 (match_operand:DF 3 "gpc_reg_operand" "d")))]
6582 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6584 [(set_attr "type" "fp")])
6586 (define_insn "*fselsfdf4"
6587 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6588 (if_then_else:DF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
6589 (match_operand:SF 4 "zero_fp_constant" "F"))
6590 (match_operand:DF 2 "gpc_reg_operand" "d")
6591 (match_operand:DF 3 "gpc_reg_operand" "d")))]
6592 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_SINGLE_FLOAT"
6594 [(set_attr "type" "fp")])
6596 ;; Conversions to and from floating-point.
6598 ; We don't define lfiwax/lfiwzx with the normal definition, because we
6599 ; don't want to support putting SImode in FPR registers.
6600 (define_insn "lfiwax"
6601 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6602 (unspec:DI [(match_operand:SI 1 "indexed_or_indirect_operand" "Z")]
6604 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWAX"
6606 [(set_attr "type" "fpload")])
6608 (define_insn_and_split "floatsi<mode>2_lfiwax"
6609 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>,<rreg2>")
6610 (float:SFDF (match_operand:SI 1 "nonimmediate_operand" "Z,r")))
6611 (clobber (match_operand:SI 2 "indexed_or_indirect_operand" "=Z,Z"))
6612 (clobber (match_operand:DI 3 "gpc_reg_operand" "=d,d"))]
6613 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWAX
6616 "MEM_P (operands[1]) || reload_completed"
6620 if (MEM_P (operands[1]))
6622 operands[1] = rs6000_address_for_fpconvert (operands[1]);
6623 emit_insn (gen_lfiwax (operands[3], operands[1]));
6627 emit_move_insn (operands[2], operands[1]);
6628 emit_insn (gen_lfiwax (operands[3], operands[2]));
6630 emit_insn (gen_floatdi<mode>2 (operands[0], operands[3]));
6633 [(set_attr "length" "8,12")])
6635 (define_insn_and_split "floatsi<mode>2_lfiwax_mem"
6636 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
6637 (float:SFDF (match_operand:SI 1 "memory_operand" "Z")))
6638 (clobber (match_scratch:DI 2 "=d"))]
6639 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWAX
6642 "&& reload_completed"
6646 emit_insn (gen_lfiwax (operands[2], operands[1]));
6647 emit_insn (gen_floatdi<mode>2 (operands[0], operands[2]));
6650 [(set_attr "length" "8")])
6652 (define_insn_and_split "floatsi<mode>2_lfiwax_mem2"
6653 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
6656 (match_operand:SI 1 "memory_operand" "Z"))))
6657 (clobber (match_scratch:DI 2 "=d"))]
6658 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWAX
6661 "&& reload_completed"
6665 emit_insn (gen_lfiwax (operands[2], operands[1]));
6666 emit_insn (gen_floatdi<mode>2 (operands[0], operands[2]));
6669 [(set_attr "length" "8")])
6671 (define_insn "lfiwzx"
6672 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6673 (unspec:DI [(match_operand:SI 1 "indexed_or_indirect_operand" "Z")]
6675 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWZX"
6677 [(set_attr "type" "fpload")])
6679 (define_insn_and_split "floatunssi<mode>2_lfiwzx"
6680 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>,<rreg2>")
6681 (unsigned_float:SFDF (match_operand:SI 1 "gpc_reg_operand" "Z,r")))
6682 (clobber (match_operand:SI 2 "indexed_or_indirect_operand" "=Z,Z"))
6683 (clobber (match_operand:DI 3 "gpc_reg_operand" "=d,d"))]
6684 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWZX
6687 "MEM_P (operands[1]) || reload_completed"
6691 if (MEM_P (operands[1]))
6693 operands[1] = rs6000_address_for_fpconvert (operands[1]);
6694 emit_insn (gen_lfiwzx (operands[3], operands[1]));
6698 emit_move_insn (operands[2], operands[1]);
6699 emit_insn (gen_lfiwzx (operands[3], operands[2]));
6701 emit_insn (gen_floatdi<mode>2 (operands[0], operands[3]));
6704 [(set_attr "length" "8,12")])
6706 (define_insn_and_split "floatunssi<mode>2_lfiwzx_mem"
6707 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
6708 (unsigned_float:SFDF (match_operand:SI 1 "memory_operand" "Z")))
6709 (clobber (match_scratch:DI 2 "=d"))]
6710 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWZX
6713 "&& reload_completed"
6717 emit_insn (gen_lfiwzx (operands[2], operands[1]));
6718 emit_insn (gen_floatdi<mode>2 (operands[0], operands[2]));
6721 [(set_attr "length" "8")])
6723 (define_insn_and_split "floatunssi<mode>2_lfiwzx_mem2"
6724 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
6725 (unsigned_float:SFDF
6727 (match_operand:SI 1 "memory_operand" "Z"))))
6728 (clobber (match_scratch:DI 2 "=d"))]
6729 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWZX
6732 "&& reload_completed"
6736 emit_insn (gen_lfiwzx (operands[2], operands[1]));
6737 emit_insn (gen_floatdi<mode>2 (operands[0], operands[2]));
6740 [(set_attr "length" "8")])
6742 ; For each of these conversions, there is a define_expand, a define_insn
6743 ; with a '#' template, and a define_split (with C code). The idea is
6744 ; to allow constant folding with the template of the define_insn,
6745 ; then to have the insns split later (between sched1 and final).
6747 (define_expand "floatsidf2"
6748 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
6749 (float:DF (match_operand:SI 1 "nonimmediate_operand" "")))
6752 (clobber (match_dup 4))
6753 (clobber (match_dup 5))
6754 (clobber (match_dup 6))])]
6756 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6759 if (TARGET_E500_DOUBLE)
6761 if (!REG_P (operands[1]))
6762 operands[1] = force_reg (SImode, operands[1]);
6763 emit_insn (gen_spe_floatsidf2 (operands[0], operands[1]));
6766 else if (TARGET_LFIWAX && TARGET_FCFID)
6768 rs6000_expand_convert_si_to_sfdf (operands[0], operands[1], false);
6771 else if (TARGET_FCFID)
6773 rtx dreg = operands[1];
6775 dreg = force_reg (SImode, dreg);
6776 dreg = convert_to_mode (DImode, dreg, false);
6777 emit_insn (gen_floatdidf2 (operands[0], dreg));
6781 if (!REG_P (operands[1]))
6782 operands[1] = force_reg (SImode, operands[1]);
6783 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
6784 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503601774854144\", DFmode));
6785 operands[4] = rs6000_allocate_stack_temp (DFmode, true, false);
6786 operands[5] = gen_reg_rtx (DFmode);
6787 operands[6] = gen_reg_rtx (SImode);
6790 (define_insn_and_split "*floatsidf2_internal"
6791 [(set (match_operand:DF 0 "gpc_reg_operand" "=&d")
6792 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
6793 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
6794 (use (match_operand:DF 3 "gpc_reg_operand" "d"))
6795 (clobber (match_operand:DF 4 "offsettable_mem_operand" "=o"))
6796 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&d"))
6797 (clobber (match_operand:SI 6 "gpc_reg_operand" "=&r"))]
6798 "! TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6804 rtx lowword, highword;
6805 gcc_assert (MEM_P (operands[4]));
6806 highword = adjust_address (operands[4], SImode, 0);
6807 lowword = adjust_address (operands[4], SImode, 4);
6808 if (! WORDS_BIG_ENDIAN)
6811 tmp = highword; highword = lowword; lowword = tmp;
6814 emit_insn (gen_xorsi3 (operands[6], operands[1],
6815 GEN_INT (~ (HOST_WIDE_INT) 0x7fffffff)));
6816 emit_move_insn (lowword, operands[6]);
6817 emit_move_insn (highword, operands[2]);
6818 emit_move_insn (operands[5], operands[4]);
6819 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
6822 [(set_attr "length" "24")])
6824 ;; If we don't have a direct conversion to single precision, don't enable this
6825 ;; conversion for 32-bit without fast math, because we don't have the insn to
6826 ;; generate the fixup swizzle to avoid double rounding problems.
6827 (define_expand "floatunssisf2"
6828 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6829 (unsigned_float:SF (match_operand:SI 1 "nonimmediate_operand" "")))]
6830 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT
6833 && ((TARGET_FCFIDUS && TARGET_LFIWZX)
6834 || (TARGET_DOUBLE_FLOAT && TARGET_FCFID
6835 && (TARGET_POWERPC64 || flag_unsafe_math_optimizations)))))"
6840 if (!REG_P (operands[1]))
6841 operands[1] = force_reg (SImode, operands[1]);
6843 else if (TARGET_LFIWZX && TARGET_FCFIDUS)
6845 rs6000_expand_convert_si_to_sfdf (operands[0], operands[1], true);
6850 rtx dreg = operands[1];
6852 dreg = force_reg (SImode, dreg);
6853 dreg = convert_to_mode (DImode, dreg, true);
6854 emit_insn (gen_floatdisf2 (operands[0], dreg));
6859 (define_expand "floatunssidf2"
6860 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
6861 (unsigned_float:DF (match_operand:SI 1 "nonimmediate_operand" "")))
6864 (clobber (match_dup 4))
6865 (clobber (match_dup 5))])]
6867 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6870 if (TARGET_E500_DOUBLE)
6872 if (!REG_P (operands[1]))
6873 operands[1] = force_reg (SImode, operands[1]);
6874 emit_insn (gen_spe_floatunssidf2 (operands[0], operands[1]));
6877 else if (TARGET_LFIWZX && TARGET_FCFID)
6879 rs6000_expand_convert_si_to_sfdf (operands[0], operands[1], true);
6882 else if (TARGET_FCFID)
6884 rtx dreg = operands[1];
6886 dreg = force_reg (SImode, dreg);
6887 dreg = convert_to_mode (DImode, dreg, true);
6888 emit_insn (gen_floatdidf2 (operands[0], dreg));
6892 if (!REG_P (operands[1]))
6893 operands[1] = force_reg (SImode, operands[1]);
6894 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
6895 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503599627370496\", DFmode));
6896 operands[4] = rs6000_allocate_stack_temp (DFmode, true, false);
6897 operands[5] = gen_reg_rtx (DFmode);
6900 (define_insn_and_split "*floatunssidf2_internal"
6901 [(set (match_operand:DF 0 "gpc_reg_operand" "=&d")
6902 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
6903 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
6904 (use (match_operand:DF 3 "gpc_reg_operand" "d"))
6905 (clobber (match_operand:DF 4 "offsettable_mem_operand" "=o"))
6906 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&d"))]
6907 "! TARGET_FCFIDU && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6908 && !(TARGET_FCFID && TARGET_POWERPC64)"
6914 rtx lowword, highword;
6915 gcc_assert (MEM_P (operands[4]));
6916 highword = adjust_address (operands[4], SImode, 0);
6917 lowword = adjust_address (operands[4], SImode, 4);
6918 if (! WORDS_BIG_ENDIAN)
6921 tmp = highword; highword = lowword; lowword = tmp;
6924 emit_move_insn (lowword, operands[1]);
6925 emit_move_insn (highword, operands[2]);
6926 emit_move_insn (operands[5], operands[4]);
6927 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
6930 [(set_attr "length" "20")])
6932 (define_expand "fix_trunc<mode>si2"
6933 [(set (match_operand:SI 0 "gpc_reg_operand" "")
6934 (fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "")))]
6935 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT
6936 && ((TARGET_FPRS && <TARGET_FLOAT>) || <E500_CONVERT>)"
6939 if (!<E500_CONVERT>)
6945 tmp = gen_reg_rtx (DImode);
6946 stack = rs6000_allocate_stack_temp (SImode, false, true);
6947 emit_insn (gen_fix_trunc<mode>si2_stfiwx (operands[0], operands[1],
6952 tmp = gen_reg_rtx (DImode);
6953 stack = rs6000_allocate_stack_temp (DImode, true, false);
6954 emit_insn (gen_fix_trunc<mode>si2_internal (operands[0], operands[1],
6961 (define_insn_and_split "fix_trunc<mode>si2_stfiwx"
6962 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6963 (fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")))
6964 (clobber (match_operand:DI 2 "gpc_reg_operand" "=d"))
6965 (clobber (match_operand:SI 3 "indexed_or_indirect_operand" "=Z"))]
6966 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6967 && (<MODE>mode != SFmode || TARGET_SINGLE_FLOAT)
6970 "&& reload_completed"
6974 emit_insn (gen_fctiwz_<mode> (operands[2], operands[1]));
6975 if (TARGET_MFPGPR && TARGET_POWERPC64 && REG_P (operands[0])
6976 && INT_REGNO_P (REGNO (operands[0])))
6978 rtx reg = gen_lowpart (DImode, operands[0]);
6979 emit_move_insn (reg, operands[2]);
6983 emit_insn (gen_stfiwx (operands[3], operands[2]));
6984 emit_move_insn (operands[0], operands[3]);
6988 [(set_attr "length" "12")])
6990 (define_insn_and_split "*fix_trunc<mode>si2_mem"
6991 [(set (match_operand:SI 0 "memory_operand" "=Z")
6992 (fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")))
6993 (clobber (match_scratch:DI 2 "=d"))]
6994 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6995 && (<MODE>mode != SFmode || TARGET_SINGLE_FLOAT)
6998 "&& reload_completed"
7002 emit_insn (gen_fctiwz_<mode> (operands[2], operands[1]));
7003 emit_insn (gen_stfiwx (operands[0], operands[2]));
7006 [(set_attr "length" "8")])
7008 (define_insn_and_split "fix_trunc<mode>si2_internal"
7009 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7010 (fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "<rreg>")))
7011 (clobber (match_operand:DI 2 "gpc_reg_operand" "=d"))
7012 (clobber (match_operand:DI 3 "offsettable_mem_operand" "=o"))]
7013 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS
7014 && TARGET_DOUBLE_FLOAT"
7021 gcc_assert (MEM_P (operands[3]));
7022 lowword = adjust_address (operands[3], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
7024 emit_insn (gen_fctiwz_<mode> (operands[2], operands[1]));
7025 emit_move_insn (operands[3], operands[2]);
7026 emit_move_insn (operands[0], lowword);
7029 [(set_attr "length" "16")])
7031 (define_expand "fix_trunc<mode>di2"
7032 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7033 (fix:DI (match_operand:SFDF 1 "gpc_reg_operand" "")))]
7034 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
7038 (define_insn "*fix_trunc<mode>di2_fctidz"
7039 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
7040 (fix:DI (match_operand:SFDF 1 "gpc_reg_operand" "d")))]
7041 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
7042 && TARGET_FCFID && !VECTOR_UNIT_VSX_P (<MODE>mode)"
7044 [(set_attr "type" "fp")])
7046 (define_expand "fixuns_trunc<mode>si2"
7047 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7048 (unsigned_fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "")))]
7050 && ((TARGET_FPRS && <TARGET_FLOAT> && TARGET_FCTIWUZ && TARGET_STFIWX)
7054 if (!<E500_CONVERT>)
7056 rtx tmp = gen_reg_rtx (DImode);
7057 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
7058 emit_insn (gen_fixuns_trunc<mode>si2_stfiwx (operands[0], operands[1],
7064 (define_insn_and_split "fixuns_trunc<mode>si2_stfiwx"
7065 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7067 (match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")))
7068 (clobber (match_operand:DI 2 "gpc_reg_operand" "=d"))
7069 (clobber (match_operand:SI 3 "indexed_or_indirect_operand" "=Z"))]
7070 "TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT> && TARGET_FCTIWUZ
7073 "&& reload_completed"
7077 emit_insn (gen_fctiwuz_<mode> (operands[2], operands[1]));
7078 if (TARGET_MFPGPR && TARGET_POWERPC64 && REG_P (operands[0])
7079 && INT_REGNO_P (REGNO (operands[0])))
7081 rtx reg = gen_lowpart (DImode, operands[0]);
7082 emit_move_insn (reg, operands[2]);
7086 emit_insn (gen_stfiwx (operands[3], operands[2]));
7087 emit_move_insn (operands[0], operands[3]);
7091 [(set_attr "length" "12")])
7093 (define_insn_and_split "*fixuns_trunc<mode>si2_mem"
7094 [(set (match_operand:SI 0 "memory_operand" "=Z")
7095 (unsigned_fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")))
7096 (clobber (match_scratch:DI 2 "=d"))]
7097 "TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT> && TARGET_FCTIWUZ
7100 "&& reload_completed"
7104 emit_insn (gen_fctiwuz_<mode> (operands[2], operands[1]));
7105 emit_insn (gen_stfiwx (operands[0], operands[2]));
7108 [(set_attr "length" "8")])
7110 (define_expand "fixuns_trunc<mode>di2"
7111 [(set (match_operand:DI 0 "register_operand" "")
7112 (unsigned_fix:DI (match_operand:SFDF 1 "register_operand" "")))]
7113 "TARGET_HARD_FLOAT && (TARGET_FCTIDUZ || VECTOR_UNIT_VSX_P (<MODE>mode))"
7116 (define_insn "*fixuns_trunc<mode>di2_fctiduz"
7117 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
7118 (unsigned_fix:DI (match_operand:SFDF 1 "gpc_reg_operand" "d")))]
7119 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
7120 && TARGET_FCTIDUZ && !VECTOR_UNIT_VSX_P (<MODE>mode)"
7122 [(set_attr "type" "fp")])
7124 ; Here, we use (set (reg) (unspec:DI [(fix:SI ...)] UNSPEC_FCTIWZ))
7125 ; rather than (set (subreg:SI (reg)) (fix:SI ...))
7126 ; because the first makes it clear that operand 0 is not live
7127 ; before the instruction.
7128 (define_insn "fctiwz_<mode>"
7129 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
7130 (unspec:DI [(fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d"))]
7132 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS
7133 && TARGET_DOUBLE_FLOAT"
7134 "{fcirz|fctiwz} %0,%1"
7135 [(set_attr "type" "fp")])
7137 (define_insn "fctiwuz_<mode>"
7138 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
7139 (unspec:DI [(unsigned_fix:SI
7140 (match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>"))]
7142 "TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT> && TARGET_FCTIWUZ"
7144 [(set_attr "type" "fp")])
7146 ;; Only optimize (float (fix x)) -> frz if we are in fast-math mode, since
7147 ;; since the friz instruction does not truncate the value if the floating
7148 ;; point value is < LONG_MIN or > LONG_MAX.
7149 (define_insn "*friz"
7150 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
7151 (float:DF (fix:DI (match_operand:DF 1 "gpc_reg_operand" "d"))))]
7152 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_POPCNTB
7153 && !VECTOR_UNIT_VSX_P (DFmode) && flag_unsafe_math_optimizations
7154 && !flag_trapping_math && TARGET_FRIZ"
7156 [(set_attr "type" "fp")])
7158 ;; No VSX equivalent to fctid
7159 (define_insn "lrint<mode>di2"
7160 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
7161 (unspec:DI [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
7163 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
7165 [(set_attr "type" "fp")])
7167 (define_expand "btrunc<mode>2"
7168 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
7169 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "")]
7171 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
7174 (define_insn "*btrunc<mode>2_fpr"
7175 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
7176 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
7178 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>
7179 && !VECTOR_UNIT_VSX_P (<MODE>mode)"
7181 [(set_attr "type" "fp")])
7183 (define_expand "ceil<mode>2"
7184 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
7185 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "")]
7187 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
7190 (define_insn "*ceil<mode>2_fpr"
7191 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
7192 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
7194 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>
7195 && !VECTOR_UNIT_VSX_P (<MODE>mode)"
7197 [(set_attr "type" "fp")])
7199 (define_expand "floor<mode>2"
7200 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
7201 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "")]
7203 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
7206 (define_insn "*floor<mode>2_fpr"
7207 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
7208 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
7210 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>
7211 && !VECTOR_UNIT_VSX_P (<MODE>mode)"
7213 [(set_attr "type" "fp")])
7215 ;; No VSX equivalent to frin
7216 (define_insn "round<mode>2"
7217 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
7218 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
7220 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
7222 [(set_attr "type" "fp")])
7224 ; An UNSPEC is used so we don't have to support SImode in FP registers.
7225 (define_insn "stfiwx"
7226 [(set (match_operand:SI 0 "memory_operand" "=Z")
7227 (unspec:SI [(match_operand:DI 1 "gpc_reg_operand" "d")]
7231 [(set_attr "type" "fpstore")])
7233 ;; If we don't have a direct conversion to single precision, don't enable this
7234 ;; conversion for 32-bit without fast math, because we don't have the insn to
7235 ;; generate the fixup swizzle to avoid double rounding problems.
7236 (define_expand "floatsisf2"
7237 [(set (match_operand:SF 0 "gpc_reg_operand" "")
7238 (float:SF (match_operand:SI 1 "nonimmediate_operand" "")))]
7239 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT
7242 && ((TARGET_FCFIDS && TARGET_LFIWAX)
7243 || (TARGET_DOUBLE_FLOAT && TARGET_FCFID
7244 && (TARGET_POWERPC64 || flag_unsafe_math_optimizations)))))"
7249 if (!REG_P (operands[1]))
7250 operands[1] = force_reg (SImode, operands[1]);
7252 else if (TARGET_FCFIDS && TARGET_LFIWAX)
7254 rs6000_expand_convert_si_to_sfdf (operands[0], operands[1], false);
7259 rtx dreg = operands[1];
7261 dreg = force_reg (SImode, dreg);
7262 dreg = convert_to_mode (DImode, dreg, false);
7263 emit_insn (gen_floatdisf2 (operands[0], dreg));
7268 (define_expand "floatdidf2"
7269 [(set (match_operand:DF 0 "gpc_reg_operand" "")
7270 (float:DF (match_operand:DI 1 "gpc_reg_operand" "")))]
7271 "TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS"
7274 (define_insn "*floatdidf2_fpr"
7275 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
7276 (float:DF (match_operand:DI 1 "gpc_reg_operand" "d")))]
7277 "TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
7278 && !VECTOR_UNIT_VSX_P (DFmode)"
7280 [(set_attr "type" "fp")])
7282 ; Allow the combiner to merge source memory operands to the conversion so that
7283 ; the optimizer/register allocator doesn't try to load the value too early in a
7284 ; GPR and then use store/load to move it to a FPR and suffer from a store-load
7285 ; hit. We will split after reload to avoid the trip through the GPRs
7287 (define_insn_and_split "*floatdidf2_mem"
7288 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
7289 (float:DF (match_operand:DI 1 "memory_operand" "m")))
7290 (clobber (match_scratch:DI 2 "=d"))]
7291 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS && TARGET_FCFID"
7293 "&& reload_completed"
7294 [(set (match_dup 2) (match_dup 1))
7295 (set (match_dup 0) (float:DF (match_dup 2)))]
7297 [(set_attr "length" "8")])
7299 (define_expand "floatunsdidf2"
7300 [(set (match_operand:DF 0 "gpc_reg_operand" "")
7302 (match_operand:DI 1 "gpc_reg_operand" "")))]
7303 "TARGET_FCFIDU || VECTOR_UNIT_VSX_P (DFmode)"
7306 (define_insn "*floatunsdidf2_fcfidu"
7307 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
7308 (unsigned_float:DF (match_operand:DI 1 "gpc_reg_operand" "d")))]
7309 "TARGET_FCFIDU && !VECTOR_UNIT_VSX_P (DFmode)"
7311 [(set_attr "type" "fp")
7312 (set_attr "length" "4")])
7314 (define_insn_and_split "*floatunsdidf2_mem"
7315 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
7316 (unsigned_float:DF (match_operand:DI 1 "memory_operand" "m")))
7317 (clobber (match_scratch:DI 2 "=d"))]
7318 "TARGET_FCFIDU || VECTOR_UNIT_VSX_P (DFmode)"
7320 "&& reload_completed"
7321 [(set (match_dup 2) (match_dup 1))
7322 (set (match_dup 0) (unsigned_float:DF (match_dup 2)))]
7324 [(set_attr "length" "8")])
7326 (define_expand "floatdisf2"
7327 [(set (match_operand:SF 0 "gpc_reg_operand" "")
7328 (float:SF (match_operand:DI 1 "gpc_reg_operand" "")))]
7329 "TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
7330 && (TARGET_FCFIDS || TARGET_POWERPC64 || flag_unsafe_math_optimizations)"
7335 rtx val = operands[1];
7336 if (!flag_unsafe_math_optimizations)
7338 rtx label = gen_label_rtx ();
7339 val = gen_reg_rtx (DImode);
7340 emit_insn (gen_floatdisf2_internal2 (val, operands[1], label));
7343 emit_insn (gen_floatdisf2_internal1 (operands[0], val));
7348 (define_insn "floatdisf2_fcfids"
7349 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
7350 (float:SF (match_operand:DI 1 "gpc_reg_operand" "d")))]
7351 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
7352 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDS"
7354 [(set_attr "type" "fp")])
7356 (define_insn_and_split "*floatdisf2_mem"
7357 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
7358 (float:SF (match_operand:DI 1 "memory_operand" "m")))
7359 (clobber (match_scratch:DI 2 "=f"))]
7360 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
7361 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDS"
7363 "&& reload_completed"
7367 emit_move_insn (operands[2], operands[1]);
7368 emit_insn (gen_floatdisf2_fcfids (operands[0], operands[2]));
7371 [(set_attr "length" "8")])
7373 ;; This is not IEEE compliant if rounding mode is "round to nearest".
7374 ;; If the DI->DF conversion is inexact, then it's possible to suffer
7375 ;; from double rounding.
7376 (define_insn_and_split "floatdisf2_internal1"
7377 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
7378 (float:SF (match_operand:DI 1 "gpc_reg_operand" "d")))
7379 (clobber (match_scratch:DF 2 "=d"))]
7380 "TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
7382 "&& reload_completed"
7384 (float:DF (match_dup 1)))
7386 (float_truncate:SF (match_dup 2)))]
7389 ;; Twiddles bits to avoid double rounding.
7390 ;; Bits that might be truncated when converting to DFmode are replaced
7391 ;; by a bit that won't be lost at that stage, but is below the SFmode
7392 ;; rounding position.
7393 (define_expand "floatdisf2_internal2"
7394 [(set (match_dup 3) (ashiftrt:DI (match_operand:DI 1 "" "")
7396 (parallel [(set (match_operand:DI 0 "" "") (and:DI (match_dup 1)
7398 (clobber (scratch:CC))])
7399 (set (match_dup 3) (plus:DI (match_dup 3)
7401 (set (match_dup 0) (plus:DI (match_dup 0)
7403 (set (match_dup 4) (compare:CCUNS (match_dup 3)
7405 (set (match_dup 0) (ior:DI (match_dup 0)
7407 (parallel [(set (match_dup 0) (and:DI (match_dup 0)
7409 (clobber (scratch:CC))])
7410 (set (pc) (if_then_else (geu (match_dup 4) (const_int 0))
7411 (label_ref (match_operand:DI 2 "" ""))
7413 (set (match_dup 0) (match_dup 1))]
7414 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
7417 operands[3] = gen_reg_rtx (DImode);
7418 operands[4] = gen_reg_rtx (CCUNSmode);
7421 (define_expand "floatunsdisf2"
7422 [(set (match_operand:SF 0 "gpc_reg_operand" "")
7423 (unsigned_float:SF (match_operand:DI 1 "gpc_reg_operand" "")))]
7424 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
7425 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDUS"
7428 (define_insn "floatunsdisf2_fcfidus"
7429 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
7430 (unsigned_float:SF (match_operand:DI 1 "gpc_reg_operand" "d")))]
7431 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
7432 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDUS"
7434 [(set_attr "type" "fp")])
7436 (define_insn_and_split "*floatunsdisf2_mem"
7437 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
7438 (unsigned_float:SF (match_operand:DI 1 "memory_operand" "m")))
7439 (clobber (match_scratch:DI 2 "=f"))]
7440 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
7441 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDUS"
7443 "&& reload_completed"
7447 emit_move_insn (operands[2], operands[1]);
7448 emit_insn (gen_floatunsdisf2_fcfidus (operands[0], operands[2]));
7451 [(set_attr "length" "8")])
7453 ;; Define the DImode operations that can be done in a small number
7454 ;; of instructions. The & constraints are to prevent the register
7455 ;; allocator from allocating registers that overlap with the inputs
7456 ;; (for example, having an input in 7,8 and an output in 6,7). We
7457 ;; also allow for the output being the same as one of the inputs.
7459 (define_insn "*adddi3_noppc64"
7460 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r")
7461 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,0,0")
7462 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I")))]
7463 "! TARGET_POWERPC64"
7466 if (WORDS_BIG_ENDIAN)
7467 return (GET_CODE (operands[2])) != CONST_INT
7468 ? \"{a|addc} %L0,%L1,%L2\;{ae|adde} %0,%1,%2\"
7469 : \"{ai|addic} %L0,%L1,%2\;{a%G2e|add%G2e} %0,%1\";
7471 return (GET_CODE (operands[2])) != CONST_INT
7472 ? \"{a|addc} %0,%1,%2\;{ae|adde} %L0,%L1,%L2\"
7473 : \"{ai|addic} %0,%1,%2\;{a%G2e|add%G2e} %L0,%L1\";
7475 [(set_attr "type" "two")
7476 (set_attr "length" "8")])
7478 (define_insn "*subdi3_noppc64"
7479 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r,r")
7480 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I,0,r,I")
7481 (match_operand:DI 2 "gpc_reg_operand" "r,r,r,0,0")))]
7482 "! TARGET_POWERPC64"
7485 if (WORDS_BIG_ENDIAN)
7486 return (GET_CODE (operands[1]) != CONST_INT)
7487 ? \"{sf|subfc} %L0,%L2,%L1\;{sfe|subfe} %0,%2,%1\"
7488 : \"{sfi|subfic} %L0,%L2,%1\;{sf%G1e|subf%G1e} %0,%2\";
7490 return (GET_CODE (operands[1]) != CONST_INT)
7491 ? \"{sf|subfc} %0,%2,%1\;{sfe|subfe} %L0,%L2,%L1\"
7492 : \"{sfi|subfic} %0,%2,%1\;{sf%G1e|subf%G1e} %L0,%L2\";
7494 [(set_attr "type" "two")
7495 (set_attr "length" "8")])
7497 (define_insn "*negdi2_noppc64"
7498 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
7499 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))]
7500 "! TARGET_POWERPC64"
7503 return (WORDS_BIG_ENDIAN)
7504 ? \"{sfi|subfic} %L0,%L1,0\;{sfze|subfze} %0,%1\"
7505 : \"{sfi|subfic} %0,%1,0\;{sfze|subfze} %L0,%L1\";
7507 [(set_attr "type" "two")
7508 (set_attr "length" "8")])
7510 (define_expand "mulsidi3"
7511 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7512 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
7513 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
7514 "! TARGET_POWERPC64"
7517 if (! TARGET_POWER && ! TARGET_POWERPC)
7519 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
7520 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
7521 emit_insn (gen_mull_call ());
7522 if (WORDS_BIG_ENDIAN)
7523 emit_move_insn (operands[0], gen_rtx_REG (DImode, 3));
7526 emit_move_insn (operand_subword (operands[0], 0, 0, DImode),
7527 gen_rtx_REG (SImode, 3));
7528 emit_move_insn (operand_subword (operands[0], 1, 0, DImode),
7529 gen_rtx_REG (SImode, 4));
7533 else if (TARGET_POWER)
7535 emit_insn (gen_mulsidi3_mq (operands[0], operands[1], operands[2]));
7540 (define_insn "mulsidi3_mq"
7541 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7542 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
7543 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
7544 (clobber (match_scratch:SI 3 "=q"))]
7546 "mul %0,%1,%2\;mfmq %L0"
7547 [(set_attr "type" "imul")
7548 (set_attr "length" "8")])
7550 (define_insn "*mulsidi3_no_mq"
7551 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
7552 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
7553 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
7554 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
7557 return (WORDS_BIG_ENDIAN)
7558 ? \"mulhw %0,%1,%2\;mullw %L0,%1,%2\"
7559 : \"mulhw %L0,%1,%2\;mullw %0,%1,%2\";
7561 [(set_attr "type" "imul")
7562 (set_attr "length" "8")])
7565 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7566 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
7567 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
7568 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
7571 (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
7572 (sign_extend:DI (match_dup 2)))
7575 (mult:SI (match_dup 1)
7579 int endian = (WORDS_BIG_ENDIAN == 0);
7580 operands[3] = operand_subword (operands[0], endian, 0, DImode);
7581 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
7584 (define_expand "umulsidi3"
7585 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7586 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
7587 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
7588 "TARGET_POWERPC && ! TARGET_POWERPC64"
7593 emit_insn (gen_umulsidi3_mq (operands[0], operands[1], operands[2]));
7598 (define_insn "umulsidi3_mq"
7599 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
7600 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
7601 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
7602 (clobber (match_scratch:SI 3 "=q"))]
7603 "TARGET_POWERPC && TARGET_POWER"
7606 return (WORDS_BIG_ENDIAN)
7607 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
7608 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
7610 [(set_attr "type" "imul")
7611 (set_attr "length" "8")])
7613 (define_insn "*umulsidi3_no_mq"
7614 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
7615 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
7616 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
7617 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
7620 return (WORDS_BIG_ENDIAN)
7621 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
7622 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
7624 [(set_attr "type" "imul")
7625 (set_attr "length" "8")])
7628 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7629 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
7630 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
7631 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
7634 (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
7635 (zero_extend:DI (match_dup 2)))
7638 (mult:SI (match_dup 1)
7642 int endian = (WORDS_BIG_ENDIAN == 0);
7643 operands[3] = operand_subword (operands[0], endian, 0, DImode);
7644 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
7647 (define_expand "smulsi3_highpart"
7648 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7650 (lshiftrt:DI (mult:DI (sign_extend:DI
7651 (match_operand:SI 1 "gpc_reg_operand" ""))
7653 (match_operand:SI 2 "gpc_reg_operand" "")))
7658 if (! TARGET_POWER && ! TARGET_POWERPC)
7660 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
7661 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
7662 emit_insn (gen_mulh_call ());
7663 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
7666 else if (TARGET_POWER)
7668 emit_insn (gen_smulsi3_highpart_mq (operands[0], operands[1], operands[2]));
7673 (define_insn "smulsi3_highpart_mq"
7674 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7676 (lshiftrt:DI (mult:DI (sign_extend:DI
7677 (match_operand:SI 1 "gpc_reg_operand" "%r"))
7679 (match_operand:SI 2 "gpc_reg_operand" "r")))
7681 (clobber (match_scratch:SI 3 "=q"))]
7684 [(set_attr "type" "imul")])
7686 (define_insn "*smulsi3_highpart_no_mq"
7687 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7689 (lshiftrt:DI (mult:DI (sign_extend:DI
7690 (match_operand:SI 1 "gpc_reg_operand" "%r"))
7692 (match_operand:SI 2 "gpc_reg_operand" "r")))
7694 "TARGET_POWERPC && ! TARGET_POWER"
7696 [(set_attr "type" "imul")])
7698 (define_expand "umulsi3_highpart"
7699 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7701 (lshiftrt:DI (mult:DI (zero_extend:DI
7702 (match_operand:SI 1 "gpc_reg_operand" ""))
7704 (match_operand:SI 2 "gpc_reg_operand" "")))
7711 emit_insn (gen_umulsi3_highpart_mq (operands[0], operands[1], operands[2]));
7716 (define_insn "umulsi3_highpart_mq"
7717 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7719 (lshiftrt:DI (mult:DI (zero_extend:DI
7720 (match_operand:SI 1 "gpc_reg_operand" "%r"))
7722 (match_operand:SI 2 "gpc_reg_operand" "r")))
7724 (clobber (match_scratch:SI 3 "=q"))]
7725 "TARGET_POWERPC && TARGET_POWER"
7727 [(set_attr "type" "imul")])
7729 (define_insn "*umulsi3_highpart_no_mq"
7730 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7732 (lshiftrt:DI (mult:DI (zero_extend:DI
7733 (match_operand:SI 1 "gpc_reg_operand" "%r"))
7735 (match_operand:SI 2 "gpc_reg_operand" "r")))
7737 "TARGET_POWERPC && ! TARGET_POWER"
7739 [(set_attr "type" "imul")])
7741 ;; If operands 0 and 2 are in the same register, we have a problem. But
7742 ;; operands 0 and 1 (the usual case) can be in the same register. That's
7743 ;; why we have the strange constraints below.
7744 (define_insn "ashldi3_power"
7745 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
7746 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
7747 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
7748 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
7751 {sli|slwi} %0,%L1,%h2\;{cal %L0,0(0)|li %L0,0}
7752 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
7753 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
7754 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2"
7755 [(set_attr "length" "8")])
7757 (define_insn "lshrdi3_power"
7758 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
7759 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
7760 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
7761 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
7764 {s%A2i|s%A2wi} %L0,%1,%h2\;{cal %0,0(0)|li %0,0}
7765 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
7766 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
7767 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2"
7768 [(set_attr "length" "8")])
7770 ;; Shift by a variable amount is too complex to be worth open-coding. We
7771 ;; just handle shifts by constants.
7772 (define_insn "ashrdi3_power"
7773 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
7774 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7775 (match_operand:SI 2 "const_int_operand" "M,i")))
7776 (clobber (match_scratch:SI 3 "=X,q"))]
7779 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
7780 sraiq %0,%1,%h2\;srliq %L0,%L1,%h2"
7781 [(set_attr "type" "shift")
7782 (set_attr "length" "8")])
7784 (define_insn "ashrdi3_no_power"
7785 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
7786 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7787 (match_operand:SI 2 "const_int_operand" "M,i")))]
7788 "TARGET_32BIT && !TARGET_POWERPC64 && !TARGET_POWER && WORDS_BIG_ENDIAN"
7790 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
7791 {sri|srwi} %L0,%L1,%h2\;insrwi %L0,%1,%h2,0\;{srai|srawi} %0,%1,%h2"
7792 [(set_attr "type" "two,three")
7793 (set_attr "length" "8,12")])
7795 (define_insn "*ashrdisi3_noppc64"
7796 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7797 (subreg:SI (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7798 (const_int 32)) 4))]
7799 "TARGET_32BIT && !TARGET_POWERPC64"
7802 if (REGNO (operands[0]) == REGNO (operands[1]))
7805 return \"mr %0,%1\";
7807 [(set_attr "length" "4")])
7810 ;; PowerPC64 DImode operations.
7812 (define_expand "absdi2"
7813 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7814 (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))]
7819 emit_insn (gen_absdi2_isel (operands[0], operands[1]));
7821 emit_insn (gen_absdi2_internal (operands[0], operands[1]));
7825 (define_insn_and_split "absdi2_internal"
7826 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
7827 (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))
7828 (clobber (match_scratch:DI 2 "=&r,&r"))]
7829 "TARGET_POWERPC64 && !TARGET_ISEL"
7831 "&& reload_completed"
7832 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
7833 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
7834 (set (match_dup 0) (minus:DI (match_dup 0) (match_dup 2)))]
7837 (define_insn_and_split "*nabsdi2"
7838 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
7839 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0"))))
7840 (clobber (match_scratch:DI 2 "=&r,&r"))]
7841 "TARGET_POWERPC64 && !TARGET_ISEL"
7843 "&& reload_completed"
7844 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
7845 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
7846 (set (match_dup 0) (minus:DI (match_dup 2) (match_dup 0)))]
7849 (define_insn "muldi3"
7850 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7851 (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
7852 (match_operand:DI 2 "reg_or_short_operand" "r,I")))]
7858 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
7859 (const_string "imul3")
7860 (match_operand:SI 2 "short_cint_operand" "")
7861 (const_string "imul2")]
7862 (const_string "lmul")))])
7864 (define_insn "*muldi3_internal1"
7865 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7866 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
7867 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
7869 (clobber (match_scratch:DI 3 "=r,r"))]
7874 [(set_attr "type" "lmul_compare")
7875 (set_attr "length" "4,8")])
7878 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7879 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
7880 (match_operand:DI 2 "gpc_reg_operand" ""))
7882 (clobber (match_scratch:DI 3 ""))]
7883 "TARGET_POWERPC64 && reload_completed"
7885 (mult:DI (match_dup 1) (match_dup 2)))
7887 (compare:CC (match_dup 3)
7891 (define_insn "*muldi3_internal2"
7892 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7893 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
7894 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
7896 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7897 (mult:DI (match_dup 1) (match_dup 2)))]
7902 [(set_attr "type" "lmul_compare")
7903 (set_attr "length" "4,8")])
7906 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7907 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
7908 (match_operand:DI 2 "gpc_reg_operand" ""))
7910 (set (match_operand:DI 0 "gpc_reg_operand" "")
7911 (mult:DI (match_dup 1) (match_dup 2)))]
7912 "TARGET_POWERPC64 && reload_completed"
7914 (mult:DI (match_dup 1) (match_dup 2)))
7916 (compare:CC (match_dup 0)
7920 (define_insn "smuldi3_highpart"
7921 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7923 (lshiftrt:TI (mult:TI (sign_extend:TI
7924 (match_operand:DI 1 "gpc_reg_operand" "%r"))
7926 (match_operand:DI 2 "gpc_reg_operand" "r")))
7930 [(set_attr "type" "lmul")])
7932 (define_insn "umuldi3_highpart"
7933 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7935 (lshiftrt:TI (mult:TI (zero_extend:TI
7936 (match_operand:DI 1 "gpc_reg_operand" "%r"))
7938 (match_operand:DI 2 "gpc_reg_operand" "r")))
7942 [(set_attr "type" "lmul")])
7944 (define_insn "rotldi3"
7945 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7946 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7947 (match_operand:DI 2 "reg_or_cint_operand" "r,i")))]
7952 [(set_attr "type" "var_shift_rotate,integer")])
7954 (define_insn "*rotldi3_internal2"
7955 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7956 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7957 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
7959 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7966 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7967 (set_attr "length" "4,4,8,8")])
7970 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7971 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7972 (match_operand:DI 2 "reg_or_cint_operand" ""))
7974 (clobber (match_scratch:DI 3 ""))]
7975 "TARGET_POWERPC64 && reload_completed"
7977 (rotate:DI (match_dup 1) (match_dup 2)))
7979 (compare:CC (match_dup 3)
7983 (define_insn "*rotldi3_internal3"
7984 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7985 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7986 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
7988 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7989 (rotate:DI (match_dup 1) (match_dup 2)))]
7996 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7997 (set_attr "length" "4,4,8,8")])
8000 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8001 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
8002 (match_operand:DI 2 "reg_or_cint_operand" ""))
8004 (set (match_operand:DI 0 "gpc_reg_operand" "")
8005 (rotate:DI (match_dup 1) (match_dup 2)))]
8006 "TARGET_POWERPC64 && reload_completed"
8008 (rotate:DI (match_dup 1) (match_dup 2)))
8010 (compare:CC (match_dup 0)
8014 (define_insn "*rotldi3_internal4"
8015 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8016 (and:DI (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
8017 (match_operand:DI 2 "reg_or_cint_operand" "r,i"))
8018 (match_operand:DI 3 "mask64_operand" "n,n")))]
8021 rldc%B3 %0,%1,%2,%S3
8022 rldic%B3 %0,%1,%H2,%S3"
8023 [(set_attr "type" "var_shift_rotate,integer")])
8025 (define_insn "*rotldi3_internal5"
8026 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
8028 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8029 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
8030 (match_operand:DI 3 "mask64_operand" "n,n,n,n"))
8032 (clobber (match_scratch:DI 4 "=r,r,r,r"))]
8035 rldc%B3. %4,%1,%2,%S3
8036 rldic%B3. %4,%1,%H2,%S3
8039 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8040 (set_attr "length" "4,4,8,8")])
8043 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8045 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
8046 (match_operand:DI 2 "reg_or_cint_operand" ""))
8047 (match_operand:DI 3 "mask64_operand" ""))
8049 (clobber (match_scratch:DI 4 ""))]
8050 "TARGET_POWERPC64 && reload_completed"
8052 (and:DI (rotate:DI (match_dup 1)
8056 (compare:CC (match_dup 4)
8060 (define_insn "*rotldi3_internal6"
8061 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
8063 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8064 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
8065 (match_operand:DI 3 "mask64_operand" "n,n,n,n"))
8067 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
8068 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
8071 rldc%B3. %0,%1,%2,%S3
8072 rldic%B3. %0,%1,%H2,%S3
8075 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8076 (set_attr "length" "4,4,8,8")])
8079 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
8081 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
8082 (match_operand:DI 2 "reg_or_cint_operand" ""))
8083 (match_operand:DI 3 "mask64_operand" ""))
8085 (set (match_operand:DI 0 "gpc_reg_operand" "")
8086 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
8087 "TARGET_POWERPC64 && reload_completed"
8089 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
8091 (compare:CC (match_dup 0)
8095 (define_insn "*rotldi3_internal7"
8096 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8099 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
8100 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
8104 rldicl %0,%1,%H2,56"
8105 [(set_attr "type" "var_shift_rotate,integer")])
8107 (define_insn "*rotldi3_internal8"
8108 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
8109 (compare:CC (zero_extend:DI
8111 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8112 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
8114 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
8118 rldicl. %3,%1,%H2,56
8121 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8122 (set_attr "length" "4,4,8,8")])
8125 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8126 (compare:CC (zero_extend:DI
8128 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
8129 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
8131 (clobber (match_scratch:DI 3 ""))]
8132 "TARGET_POWERPC64 && reload_completed"
8134 (zero_extend:DI (subreg:QI
8135 (rotate:DI (match_dup 1)
8138 (compare:CC (match_dup 3)
8142 (define_insn "*rotldi3_internal9"
8143 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
8144 (compare:CC (zero_extend:DI
8146 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8147 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
8149 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
8150 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
8154 rldicl. %0,%1,%H2,56
8157 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8158 (set_attr "length" "4,4,8,8")])
8161 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8162 (compare:CC (zero_extend:DI
8164 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
8165 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
8167 (set (match_operand:DI 0 "gpc_reg_operand" "")
8168 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
8169 "TARGET_POWERPC64 && reload_completed"
8171 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
8173 (compare:CC (match_dup 0)
8177 (define_insn "*rotldi3_internal10"
8178 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8181 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
8182 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
8186 rldicl %0,%1,%H2,48"
8187 [(set_attr "type" "var_shift_rotate,integer")])
8189 (define_insn "*rotldi3_internal11"
8190 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
8191 (compare:CC (zero_extend:DI
8193 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8194 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
8196 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
8200 rldicl. %3,%1,%H2,48
8203 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8204 (set_attr "length" "4,4,8,8")])
8207 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8208 (compare:CC (zero_extend:DI
8210 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
8211 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
8213 (clobber (match_scratch:DI 3 ""))]
8214 "TARGET_POWERPC64 && reload_completed"
8216 (zero_extend:DI (subreg:HI
8217 (rotate:DI (match_dup 1)
8220 (compare:CC (match_dup 3)
8224 (define_insn "*rotldi3_internal12"
8225 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
8226 (compare:CC (zero_extend:DI
8228 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8229 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
8231 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
8232 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
8236 rldicl. %0,%1,%H2,48
8239 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8240 (set_attr "length" "4,4,8,8")])
8243 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8244 (compare:CC (zero_extend:DI
8246 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
8247 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
8249 (set (match_operand:DI 0 "gpc_reg_operand" "")
8250 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
8251 "TARGET_POWERPC64 && reload_completed"
8253 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
8255 (compare:CC (match_dup 0)
8259 (define_insn "*rotldi3_internal13"
8260 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8263 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
8264 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
8268 rldicl %0,%1,%H2,32"
8269 [(set_attr "type" "var_shift_rotate,integer")])
8271 (define_insn "*rotldi3_internal14"
8272 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
8273 (compare:CC (zero_extend:DI
8275 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8276 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
8278 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
8282 rldicl. %3,%1,%H2,32
8285 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8286 (set_attr "length" "4,4,8,8")])
8289 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8290 (compare:CC (zero_extend:DI
8292 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
8293 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
8295 (clobber (match_scratch:DI 3 ""))]
8296 "TARGET_POWERPC64 && reload_completed"
8298 (zero_extend:DI (subreg:SI
8299 (rotate:DI (match_dup 1)
8302 (compare:CC (match_dup 3)
8306 (define_insn "*rotldi3_internal15"
8307 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
8308 (compare:CC (zero_extend:DI
8310 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8311 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
8313 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
8314 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
8318 rldicl. %0,%1,%H2,32
8321 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8322 (set_attr "length" "4,4,8,8")])
8325 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8326 (compare:CC (zero_extend:DI
8328 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
8329 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
8331 (set (match_operand:DI 0 "gpc_reg_operand" "")
8332 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
8333 "TARGET_POWERPC64 && reload_completed"
8335 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
8337 (compare:CC (match_dup 0)
8341 (define_expand "ashldi3"
8342 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8343 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
8344 (match_operand:SI 2 "reg_or_cint_operand" "")))]
8345 "TARGET_POWERPC64 || TARGET_POWER"
8348 if (TARGET_POWERPC64)
8350 else if (TARGET_POWER)
8352 emit_insn (gen_ashldi3_power (operands[0], operands[1], operands[2]));
8359 (define_insn "*ashldi3_internal1"
8360 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8361 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
8362 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
8367 [(set_attr "type" "var_shift_rotate,shift")])
8369 (define_insn "*ashldi3_internal2"
8370 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
8371 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8372 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
8374 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
8381 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8382 (set_attr "length" "4,4,8,8")])
8385 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
8386 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
8387 (match_operand:SI 2 "reg_or_cint_operand" ""))
8389 (clobber (match_scratch:DI 3 ""))]
8390 "TARGET_POWERPC64 && reload_completed"
8392 (ashift:DI (match_dup 1) (match_dup 2)))
8394 (compare:CC (match_dup 3)
8398 (define_insn "*ashldi3_internal3"
8399 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
8400 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8401 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
8403 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
8404 (ashift:DI (match_dup 1) (match_dup 2)))]
8411 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8412 (set_attr "length" "4,4,8,8")])
8415 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
8416 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
8417 (match_operand:SI 2 "reg_or_cint_operand" ""))
8419 (set (match_operand:DI 0 "gpc_reg_operand" "")
8420 (ashift:DI (match_dup 1) (match_dup 2)))]
8421 "TARGET_POWERPC64 && reload_completed"
8423 (ashift:DI (match_dup 1) (match_dup 2)))
8425 (compare:CC (match_dup 0)
8429 (define_insn "*ashldi3_internal4"
8430 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
8431 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
8432 (match_operand:SI 2 "const_int_operand" "i"))
8433 (match_operand:DI 3 "const_int_operand" "n")))]
8434 "TARGET_POWERPC64 && includes_rldic_lshift_p (operands[2], operands[3])"
8435 "rldic %0,%1,%H2,%W3")
8437 (define_insn "ashldi3_internal5"
8438 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
8440 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
8441 (match_operand:SI 2 "const_int_operand" "i,i"))
8442 (match_operand:DI 3 "const_int_operand" "n,n"))
8444 (clobber (match_scratch:DI 4 "=r,r"))]
8445 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
8447 rldic. %4,%1,%H2,%W3
8449 [(set_attr "type" "compare")
8450 (set_attr "length" "4,8")])
8453 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8455 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
8456 (match_operand:SI 2 "const_int_operand" ""))
8457 (match_operand:DI 3 "const_int_operand" ""))
8459 (clobber (match_scratch:DI 4 ""))]
8460 "TARGET_POWERPC64 && reload_completed
8461 && includes_rldic_lshift_p (operands[2], operands[3])"
8463 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
8466 (compare:CC (match_dup 4)
8470 (define_insn "*ashldi3_internal6"
8471 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
8473 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
8474 (match_operand:SI 2 "const_int_operand" "i,i"))
8475 (match_operand:DI 3 "const_int_operand" "n,n"))
8477 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8478 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
8479 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
8481 rldic. %0,%1,%H2,%W3
8483 [(set_attr "type" "compare")
8484 (set_attr "length" "4,8")])
8487 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
8489 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
8490 (match_operand:SI 2 "const_int_operand" ""))
8491 (match_operand:DI 3 "const_int_operand" ""))
8493 (set (match_operand:DI 0 "gpc_reg_operand" "")
8494 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
8495 "TARGET_POWERPC64 && reload_completed
8496 && includes_rldic_lshift_p (operands[2], operands[3])"
8498 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
8501 (compare:CC (match_dup 0)
8505 (define_insn "*ashldi3_internal7"
8506 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
8507 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
8508 (match_operand:SI 2 "const_int_operand" "i"))
8509 (match_operand:DI 3 "mask64_operand" "n")))]
8510 "TARGET_POWERPC64 && includes_rldicr_lshift_p (operands[2], operands[3])"
8511 "rldicr %0,%1,%H2,%S3")
8513 (define_insn "ashldi3_internal8"
8514 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
8516 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
8517 (match_operand:SI 2 "const_int_operand" "i,i"))
8518 (match_operand:DI 3 "mask64_operand" "n,n"))
8520 (clobber (match_scratch:DI 4 "=r,r"))]
8521 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
8523 rldicr. %4,%1,%H2,%S3
8525 [(set_attr "type" "compare")
8526 (set_attr "length" "4,8")])
8529 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8531 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
8532 (match_operand:SI 2 "const_int_operand" ""))
8533 (match_operand:DI 3 "mask64_operand" ""))
8535 (clobber (match_scratch:DI 4 ""))]
8536 "TARGET_POWERPC64 && reload_completed
8537 && includes_rldicr_lshift_p (operands[2], operands[3])"
8539 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
8542 (compare:CC (match_dup 4)
8546 (define_insn "*ashldi3_internal9"
8547 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
8549 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
8550 (match_operand:SI 2 "const_int_operand" "i,i"))
8551 (match_operand:DI 3 "mask64_operand" "n,n"))
8553 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8554 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
8555 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
8557 rldicr. %0,%1,%H2,%S3
8559 [(set_attr "type" "compare")
8560 (set_attr "length" "4,8")])
8563 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
8565 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
8566 (match_operand:SI 2 "const_int_operand" ""))
8567 (match_operand:DI 3 "mask64_operand" ""))
8569 (set (match_operand:DI 0 "gpc_reg_operand" "")
8570 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
8571 "TARGET_POWERPC64 && reload_completed
8572 && includes_rldicr_lshift_p (operands[2], operands[3])"
8574 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
8577 (compare:CC (match_dup 0)
8581 (define_expand "lshrdi3"
8582 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8583 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
8584 (match_operand:SI 2 "reg_or_cint_operand" "")))]
8585 "TARGET_POWERPC64 || TARGET_POWER"
8588 if (TARGET_POWERPC64)
8590 else if (TARGET_POWER)
8592 emit_insn (gen_lshrdi3_power (operands[0], operands[1], operands[2]));
8599 (define_insn "*lshrdi3_internal1"
8600 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8601 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
8602 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
8607 [(set_attr "type" "var_shift_rotate,shift")])
8609 (define_insn "*lshrdi3_internal2"
8610 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
8611 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8612 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
8614 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
8621 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8622 (set_attr "length" "4,4,8,8")])
8625 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8626 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
8627 (match_operand:SI 2 "reg_or_cint_operand" ""))
8629 (clobber (match_scratch:DI 3 ""))]
8630 "TARGET_POWERPC64 && reload_completed"
8632 (lshiftrt:DI (match_dup 1) (match_dup 2)))
8634 (compare:CC (match_dup 3)
8638 (define_insn "*lshrdi3_internal3"
8639 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
8640 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8641 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
8643 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
8644 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
8651 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8652 (set_attr "length" "4,4,8,8")])
8655 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8656 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
8657 (match_operand:SI 2 "reg_or_cint_operand" ""))
8659 (set (match_operand:DI 0 "gpc_reg_operand" "")
8660 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
8661 "TARGET_POWERPC64 && reload_completed"
8663 (lshiftrt:DI (match_dup 1) (match_dup 2)))
8665 (compare:CC (match_dup 0)
8669 (define_expand "ashrdi3"
8670 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8671 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
8672 (match_operand:SI 2 "reg_or_cint_operand" "")))]
8676 if (TARGET_POWERPC64)
8678 else if (TARGET_POWER && GET_CODE (operands[2]) == CONST_INT)
8680 emit_insn (gen_ashrdi3_power (operands[0], operands[1], operands[2]));
8683 else if (TARGET_32BIT && GET_CODE (operands[2]) == CONST_INT
8684 && WORDS_BIG_ENDIAN)
8686 emit_insn (gen_ashrdi3_no_power (operands[0], operands[1], operands[2]));
8693 (define_insn "*ashrdi3_internal1"
8694 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8695 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
8696 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
8701 [(set_attr "type" "var_shift_rotate,shift")])
8703 (define_insn "*ashrdi3_internal2"
8704 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
8705 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8706 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
8708 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
8715 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8716 (set_attr "length" "4,4,8,8")])
8719 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
8720 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
8721 (match_operand:SI 2 "reg_or_cint_operand" ""))
8723 (clobber (match_scratch:DI 3 ""))]
8724 "TARGET_POWERPC64 && reload_completed"
8726 (ashiftrt:DI (match_dup 1) (match_dup 2)))
8728 (compare:CC (match_dup 3)
8732 (define_insn "*ashrdi3_internal3"
8733 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
8734 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8735 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
8737 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
8738 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
8745 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8746 (set_attr "length" "4,4,8,8")])
8749 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
8750 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
8751 (match_operand:SI 2 "reg_or_cint_operand" ""))
8753 (set (match_operand:DI 0 "gpc_reg_operand" "")
8754 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
8755 "TARGET_POWERPC64 && reload_completed"
8757 (ashiftrt:DI (match_dup 1) (match_dup 2)))
8759 (compare:CC (match_dup 0)
8763 (define_expand "anddi3"
8765 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8766 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8767 (match_operand:DI 2 "and64_2_operand" "")))
8768 (clobber (match_scratch:CC 3 ""))])]
8772 (define_insn "anddi3_mc"
8773 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
8774 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r")
8775 (match_operand:DI 2 "and64_2_operand" "?r,S,T,K,J,t")))
8776 (clobber (match_scratch:CC 3 "=X,X,X,x,x,X"))]
8777 "TARGET_POWERPC64 && rs6000_gen_cell_microcode"
8780 rldic%B2 %0,%1,0,%S2
8781 rlwinm %0,%1,0,%m2,%M2
8785 [(set_attr "type" "*,*,*,fast_compare,fast_compare,*")
8786 (set_attr "length" "4,4,4,4,4,8")])
8788 (define_insn "anddi3_nomc"
8789 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
8790 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r")
8791 (match_operand:DI 2 "and64_2_operand" "?r,S,T,t")))
8792 (clobber (match_scratch:CC 3 "=X,X,X,X"))]
8793 "TARGET_POWERPC64 && !rs6000_gen_cell_microcode"
8796 rldic%B2 %0,%1,0,%S2
8797 rlwinm %0,%1,0,%m2,%M2
8799 [(set_attr "length" "4,4,4,8")])
8802 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8803 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8804 (match_operand:DI 2 "mask64_2_operand" "")))
8805 (clobber (match_scratch:CC 3 ""))]
8807 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
8808 && !mask_operand (operands[2], DImode)
8809 && !mask64_operand (operands[2], DImode)"
8811 (and:DI (rotate:DI (match_dup 1)
8815 (and:DI (rotate:DI (match_dup 0)
8819 build_mask64_2_operands (operands[2], &operands[4]);
8822 (define_insn "*anddi3_internal2_mc"
8823 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,x,?y,?y,?y,??y,??y,?y")
8824 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r,r,r")
8825 (match_operand:DI 2 "and64_2_operand" "r,S,T,K,J,t,r,S,T,K,J,t"))
8827 (clobber (match_scratch:DI 3 "=r,r,r,r,r,r,r,r,r,r,r,r"))
8828 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,X,X,x,x,X"))]
8829 "TARGET_64BIT && rs6000_gen_cell_microcode"
8832 rldic%B2. %3,%1,0,%S2
8833 rlwinm. %3,%1,0,%m2,%M2
8843 [(set_attr "type" "fast_compare,compare,delayed_compare,fast_compare,\
8844 fast_compare,compare,compare,compare,compare,compare,\
8846 (set_attr "length" "4,4,4,4,4,8,8,8,8,8,8,12")])
8849 [(set (match_operand:CC 0 "cc_reg_operand" "")
8850 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8851 (match_operand:DI 2 "mask64_2_operand" ""))
8853 (clobber (match_scratch:DI 3 ""))
8854 (clobber (match_scratch:CC 4 ""))]
8855 "TARGET_64BIT && reload_completed
8856 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
8857 && !mask_operand (operands[2], DImode)
8858 && !mask64_operand (operands[2], DImode)"
8860 (and:DI (rotate:DI (match_dup 1)
8863 (parallel [(set (match_dup 0)
8864 (compare:CC (and:DI (rotate:DI (match_dup 3)
8868 (clobber (match_dup 3))])]
8871 build_mask64_2_operands (operands[2], &operands[5]);
8874 (define_insn "*anddi3_internal3_mc"
8875 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,x,x,?y,?y,?y,??y,??y,?y")
8876 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r,r,r")
8877 (match_operand:DI 2 "and64_2_operand" "r,S,T,K,J,t,r,S,T,K,J,t"))
8879 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r,r,r")
8880 (and:DI (match_dup 1) (match_dup 2)))
8881 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,X,X,x,x,X"))]
8882 "TARGET_64BIT && rs6000_gen_cell_microcode"
8885 rldic%B2. %0,%1,0,%S2
8886 rlwinm. %0,%1,0,%m2,%M2
8896 [(set_attr "type" "fast_compare,compare,delayed_compare,fast_compare,\
8897 fast_compare,compare,compare,compare,compare,compare,\
8899 (set_attr "length" "4,4,4,4,4,8,8,8,8,8,8,12")])
8902 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8903 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8904 (match_operand:DI 2 "and64_2_operand" ""))
8906 (set (match_operand:DI 0 "gpc_reg_operand" "")
8907 (and:DI (match_dup 1) (match_dup 2)))
8908 (clobber (match_scratch:CC 4 ""))]
8909 "TARGET_64BIT && reload_completed"
8910 [(parallel [(set (match_dup 0)
8911 (and:DI (match_dup 1) (match_dup 2)))
8912 (clobber (match_dup 4))])
8914 (compare:CC (match_dup 0)
8919 [(set (match_operand:CC 3 "cc_reg_operand" "")
8920 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8921 (match_operand:DI 2 "mask64_2_operand" ""))
8923 (set (match_operand:DI 0 "gpc_reg_operand" "")
8924 (and:DI (match_dup 1) (match_dup 2)))
8925 (clobber (match_scratch:CC 4 ""))]
8926 "TARGET_64BIT && reload_completed
8927 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
8928 && !mask_operand (operands[2], DImode)
8929 && !mask64_operand (operands[2], DImode)"
8931 (and:DI (rotate:DI (match_dup 1)
8934 (parallel [(set (match_dup 3)
8935 (compare:CC (and:DI (rotate:DI (match_dup 0)
8940 (and:DI (rotate:DI (match_dup 0)
8945 build_mask64_2_operands (operands[2], &operands[5]);
8948 (define_expand "iordi3"
8949 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8950 (ior:DI (match_operand:DI 1 "gpc_reg_operand" "")
8951 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
8955 if (non_logical_cint_operand (operands[2], DImode))
8957 HOST_WIDE_INT value;
8958 rtx tmp = ((!can_create_pseudo_p ()
8959 || rtx_equal_p (operands[0], operands[1]))
8960 ? operands[0] : gen_reg_rtx (DImode));
8962 if (GET_CODE (operands[2]) == CONST_INT)
8964 value = INTVAL (operands[2]);
8965 emit_insn (gen_iordi3 (tmp, operands[1],
8966 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
8970 value = CONST_DOUBLE_LOW (operands[2]);
8971 emit_insn (gen_iordi3 (tmp, operands[1],
8972 immed_double_const (value
8973 & (~ (HOST_WIDE_INT) 0xffff),
8977 emit_insn (gen_iordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
8982 (define_expand "xordi3"
8983 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8984 (xor:DI (match_operand:DI 1 "gpc_reg_operand" "")
8985 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
8989 if (non_logical_cint_operand (operands[2], DImode))
8991 HOST_WIDE_INT value;
8992 rtx tmp = ((!can_create_pseudo_p ()
8993 || rtx_equal_p (operands[0], operands[1]))
8994 ? operands[0] : gen_reg_rtx (DImode));
8996 if (GET_CODE (operands[2]) == CONST_INT)
8998 value = INTVAL (operands[2]);
8999 emit_insn (gen_xordi3 (tmp, operands[1],
9000 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
9004 value = CONST_DOUBLE_LOW (operands[2]);
9005 emit_insn (gen_xordi3 (tmp, operands[1],
9006 immed_double_const (value
9007 & (~ (HOST_WIDE_INT) 0xffff),
9011 emit_insn (gen_xordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
9016 (define_insn "*booldi3_internal1"
9017 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
9018 (match_operator:DI 3 "boolean_or_operator"
9019 [(match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
9020 (match_operand:DI 2 "logical_operand" "r,K,JF")]))]
9027 (define_insn "*booldi3_internal2"
9028 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
9029 (compare:CC (match_operator:DI 4 "boolean_or_operator"
9030 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
9031 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
9033 (clobber (match_scratch:DI 3 "=r,r"))]
9038 [(set_attr "type" "fast_compare,compare")
9039 (set_attr "length" "4,8")])
9042 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
9043 (compare:CC (match_operator:DI 4 "boolean_operator"
9044 [(match_operand:DI 1 "gpc_reg_operand" "")
9045 (match_operand:DI 2 "gpc_reg_operand" "")])
9047 (clobber (match_scratch:DI 3 ""))]
9048 "TARGET_POWERPC64 && reload_completed"
9049 [(set (match_dup 3) (match_dup 4))
9051 (compare:CC (match_dup 3)
9055 (define_insn "*booldi3_internal3"
9056 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
9057 (compare:CC (match_operator:DI 4 "boolean_or_operator"
9058 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
9059 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
9061 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
9067 [(set_attr "type" "fast_compare,compare")
9068 (set_attr "length" "4,8")])
9071 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
9072 (compare:CC (match_operator:DI 4 "boolean_operator"
9073 [(match_operand:DI 1 "gpc_reg_operand" "")
9074 (match_operand:DI 2 "gpc_reg_operand" "")])
9076 (set (match_operand:DI 0 "gpc_reg_operand" "")
9078 "TARGET_POWERPC64 && reload_completed"
9079 [(set (match_dup 0) (match_dup 4))
9081 (compare:CC (match_dup 0)
9085 ;; Split a logical operation that we can't do in one insn into two insns,
9086 ;; each of which does one 16-bit part. This is used by combine.
9089 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9090 (match_operator:DI 3 "boolean_or_operator"
9091 [(match_operand:DI 1 "gpc_reg_operand" "")
9092 (match_operand:DI 2 "non_logical_cint_operand" "")]))]
9094 [(set (match_dup 0) (match_dup 4))
9095 (set (match_dup 0) (match_dup 5))]
9100 if (GET_CODE (operands[2]) == CONST_DOUBLE)
9102 HOST_WIDE_INT value = CONST_DOUBLE_LOW (operands[2]);
9103 i3 = immed_double_const (value & (~ (HOST_WIDE_INT) 0xffff),
9105 i4 = GEN_INT (value & 0xffff);
9109 i3 = GEN_INT (INTVAL (operands[2])
9110 & (~ (HOST_WIDE_INT) 0xffff));
9111 i4 = GEN_INT (INTVAL (operands[2]) & 0xffff);
9113 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
9115 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
9119 (define_insn "*boolcdi3_internal1"
9120 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9121 (match_operator:DI 3 "boolean_operator"
9122 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
9123 (match_operand:DI 2 "gpc_reg_operand" "r")]))]
9127 (define_insn "*boolcdi3_internal2"
9128 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
9129 (compare:CC (match_operator:DI 4 "boolean_operator"
9130 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
9131 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
9133 (clobber (match_scratch:DI 3 "=r,r"))]
9138 [(set_attr "type" "fast_compare,compare")
9139 (set_attr "length" "4,8")])
9142 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
9143 (compare:CC (match_operator:DI 4 "boolean_operator"
9144 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
9145 (match_operand:DI 2 "gpc_reg_operand" "")])
9147 (clobber (match_scratch:DI 3 ""))]
9148 "TARGET_POWERPC64 && reload_completed"
9149 [(set (match_dup 3) (match_dup 4))
9151 (compare:CC (match_dup 3)
9155 (define_insn "*boolcdi3_internal3"
9156 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
9157 (compare:CC (match_operator:DI 4 "boolean_operator"
9158 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
9159 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
9161 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
9167 [(set_attr "type" "fast_compare,compare")
9168 (set_attr "length" "4,8")])
9171 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
9172 (compare:CC (match_operator:DI 4 "boolean_operator"
9173 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
9174 (match_operand:DI 2 "gpc_reg_operand" "")])
9176 (set (match_operand:DI 0 "gpc_reg_operand" "")
9178 "TARGET_POWERPC64 && reload_completed"
9179 [(set (match_dup 0) (match_dup 4))
9181 (compare:CC (match_dup 0)
9185 (define_insn "*boolccdi3_internal1"
9186 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9187 (match_operator:DI 3 "boolean_operator"
9188 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
9189 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r"))]))]
9193 (define_insn "*boolccdi3_internal2"
9194 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
9195 (compare:CC (match_operator:DI 4 "boolean_operator"
9196 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
9197 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
9199 (clobber (match_scratch:DI 3 "=r,r"))]
9204 [(set_attr "type" "fast_compare,compare")
9205 (set_attr "length" "4,8")])
9208 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
9209 (compare:CC (match_operator:DI 4 "boolean_operator"
9210 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
9211 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
9213 (clobber (match_scratch:DI 3 ""))]
9214 "TARGET_POWERPC64 && reload_completed"
9215 [(set (match_dup 3) (match_dup 4))
9217 (compare:CC (match_dup 3)
9221 (define_insn "*boolccdi3_internal3"
9222 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
9223 (compare:CC (match_operator:DI 4 "boolean_operator"
9224 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
9225 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
9227 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
9233 [(set_attr "type" "fast_compare,compare")
9234 (set_attr "length" "4,8")])
9237 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
9238 (compare:CC (match_operator:DI 4 "boolean_operator"
9239 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
9240 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
9242 (set (match_operand:DI 0 "gpc_reg_operand" "")
9244 "TARGET_POWERPC64 && reload_completed"
9245 [(set (match_dup 0) (match_dup 4))
9247 (compare:CC (match_dup 0)
9251 (define_expand "smindi3"
9252 [(match_operand:DI 0 "gpc_reg_operand" "")
9253 (match_operand:DI 1 "gpc_reg_operand" "")
9254 (match_operand:DI 2 "gpc_reg_operand" "")]
9258 rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]);
9262 (define_expand "smaxdi3"
9263 [(match_operand:DI 0 "gpc_reg_operand" "")
9264 (match_operand:DI 1 "gpc_reg_operand" "")
9265 (match_operand:DI 2 "gpc_reg_operand" "")]
9269 rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]);
9273 (define_expand "umindi3"
9274 [(match_operand:DI 0 "gpc_reg_operand" "")
9275 (match_operand:DI 1 "gpc_reg_operand" "")
9276 (match_operand:DI 2 "gpc_reg_operand" "")]
9280 rs6000_emit_minmax (operands[0], UMIN, operands[1], operands[2]);
9284 (define_expand "umaxdi3"
9285 [(match_operand:DI 0 "gpc_reg_operand" "")
9286 (match_operand:DI 1 "gpc_reg_operand" "")
9287 (match_operand:DI 2 "gpc_reg_operand" "")]
9291 rs6000_emit_minmax (operands[0], UMAX, operands[1], operands[2]);
9296 ;; Now define ways of moving data around.
9298 ;; Set up a register with a value from the GOT table
9300 (define_expand "movsi_got"
9301 [(set (match_operand:SI 0 "gpc_reg_operand" "")
9302 (unspec:SI [(match_operand:SI 1 "got_operand" "")
9303 (match_dup 2)] UNSPEC_MOVSI_GOT))]
9304 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
9307 if (GET_CODE (operands[1]) == CONST)
9309 rtx offset = const0_rtx;
9310 HOST_WIDE_INT value;
9312 operands[1] = eliminate_constant_term (XEXP (operands[1], 0), &offset);
9313 value = INTVAL (offset);
9316 rtx tmp = (!can_create_pseudo_p ()
9318 : gen_reg_rtx (Pmode));
9319 emit_insn (gen_movsi_got (tmp, operands[1]));
9320 emit_insn (gen_addsi3 (operands[0], tmp, offset));
9325 operands[2] = rs6000_got_register (operands[1]);
9328 (define_insn "*movsi_got_internal"
9329 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9330 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
9331 (match_operand:SI 2 "gpc_reg_operand" "b")]
9333 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
9334 "{l|lwz} %0,%a1@got(%2)"
9335 [(set_attr "type" "load")])
9337 ;; Used by sched, shorten_branches and final when the GOT pseudo reg
9338 ;; didn't get allocated to a hard register.
9340 [(set (match_operand:SI 0 "gpc_reg_operand" "")
9341 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
9342 (match_operand:SI 2 "memory_operand" "")]
9344 "DEFAULT_ABI == ABI_V4
9346 && (reload_in_progress || reload_completed)"
9347 [(set (match_dup 0) (match_dup 2))
9348 (set (match_dup 0) (unspec:SI [(match_dup 1)(match_dup 0)]
9352 ;; For SI, we special-case integers that can't be loaded in one insn. We
9353 ;; do the load 16-bits at a time. We could do this by loading from memory,
9354 ;; and this is even supposed to be faster, but it is simpler not to get
9355 ;; integers in the TOC.
9356 (define_insn "movsi_low"
9357 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9358 (mem:SI (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
9359 (match_operand 2 "" ""))))]
9360 "TARGET_MACHO && ! TARGET_64BIT"
9361 "{l|lwz} %0,lo16(%2)(%1)"
9362 [(set_attr "type" "load")
9363 (set_attr "length" "4")])
9365 (define_insn "*movsi_internal1"
9366 [(set (match_operand:SI 0 "rs6000_nonimmediate_operand" "=r,r,r,m,r,r,r,r,r,*q,*c*l,*h,*h")
9367 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,R,*h,r,r,r,0"))]
9368 "!TARGET_SINGLE_FPU &&
9369 (gpc_reg_operand (operands[0], SImode) || gpc_reg_operand (operands[1], SImode))"
9373 {l%U1%X1|lwz%U1%X1} %0,%1
9374 {st%U0%X0|stw%U0%X0} %1,%0
9384 [(set_attr "type" "*,*,load,store,*,*,*,*,mfjmpr,*,mtjmpr,*,*")
9385 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4,4,4")])
9387 (define_insn "*movsi_internal1_single"
9388 [(set (match_operand:SI 0 "rs6000_nonimmediate_operand" "=r,r,r,m,r,r,r,r,r,*q,*c*l,*h,*h,m,*f")
9389 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,R,*h,r,r,r,0,f,m"))]
9390 "TARGET_SINGLE_FPU &&
9391 (gpc_reg_operand (operands[0], SImode) || gpc_reg_operand (operands[1], SImode))"
9395 {l%U1%X1|lwz%U1%X1} %0,%1
9396 {st%U0%X0|stw%U0%X0} %1,%0
9408 [(set_attr "type" "*,*,load,store,*,*,*,*,mfjmpr,*,mtjmpr,*,*,*,*")
9409 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4,4,4,4,4")])
9411 ;; Split a load of a large constant into the appropriate two-insn
9415 [(set (match_operand:SI 0 "gpc_reg_operand" "")
9416 (match_operand:SI 1 "const_int_operand" ""))]
9417 "(unsigned HOST_WIDE_INT) (INTVAL (operands[1]) + 0x8000) >= 0x10000
9418 && (INTVAL (operands[1]) & 0xffff) != 0"
9422 (ior:SI (match_dup 0)
9425 { rtx tem = rs6000_emit_set_const (operands[0], SImode, operands[1], 2);
9427 if (tem == operands[0])
9433 (define_insn "*mov<mode>_internal2"
9434 [(set (match_operand:CC 2 "cc_reg_operand" "=y,x,?y")
9435 (compare:CC (match_operand:P 1 "gpc_reg_operand" "0,r,r")
9437 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r") (match_dup 1))]
9440 {cmpi|cmp<wd>i} %2,%0,0
9443 [(set_attr "type" "cmp,compare,cmp")
9444 (set_attr "length" "4,4,8")])
9447 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
9448 (compare:CC (match_operand:P 1 "gpc_reg_operand" "")
9450 (set (match_operand:P 0 "gpc_reg_operand" "") (match_dup 1))]
9452 [(set (match_dup 0) (match_dup 1))
9454 (compare:CC (match_dup 0)
9458 (define_insn "*movhi_internal"
9459 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
9460 (match_operand:HI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
9461 "gpc_reg_operand (operands[0], HImode)
9462 || gpc_reg_operand (operands[1], HImode)"
9472 [(set_attr "type" "*,load,store,*,mfjmpr,*,mtjmpr,*")])
9474 (define_expand "mov<mode>"
9475 [(set (match_operand:INT 0 "general_operand" "")
9476 (match_operand:INT 1 "any_operand" ""))]
9478 "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
9480 (define_insn "*movqi_internal"
9481 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
9482 (match_operand:QI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
9483 "gpc_reg_operand (operands[0], QImode)
9484 || gpc_reg_operand (operands[1], QImode)"
9494 [(set_attr "type" "*,load,store,*,mfjmpr,*,mtjmpr,*")])
9496 ;; Here is how to move condition codes around. When we store CC data in
9497 ;; an integer register or memory, we store just the high-order 4 bits.
9498 ;; This lets us not shift in the most common case of CR0.
9499 (define_expand "movcc"
9500 [(set (match_operand:CC 0 "nonimmediate_operand" "")
9501 (match_operand:CC 1 "nonimmediate_operand" ""))]
9505 (define_insn "*movcc_internal1"
9506 [(set (match_operand:CC 0 "nonimmediate_operand" "=y,x,?y,y,r,r,r,r,r,q,cl,r,m")
9507 (match_operand:CC 1 "general_operand" "y,r,r,O,x,y,r,I,h,r,r,m,r"))]
9508 "register_operand (operands[0], CCmode)
9509 || register_operand (operands[1], CCmode)"
9513 {rlinm|rlwinm} %1,%1,%F0,0xffffffff\;mtcrf %R0,%1\;{rlinm|rlwinm} %1,%1,%f0,0xffffffff
9516 mfcr %0%Q1\;{rlinm|rlwinm} %0,%0,%f1,0xf0000000
9522 {l%U1%X1|lwz%U1%X1} %0,%1
9523 {st%U0%U1|stw%U0%U1} %1,%0"
9525 (cond [(eq_attr "alternative" "0,3")
9526 (const_string "cr_logical")
9527 (eq_attr "alternative" "1,2")
9528 (const_string "mtcr")
9529 (eq_attr "alternative" "6,7,9")
9530 (const_string "integer")
9531 (eq_attr "alternative" "8")
9532 (const_string "mfjmpr")
9533 (eq_attr "alternative" "10")
9534 (const_string "mtjmpr")
9535 (eq_attr "alternative" "11")
9536 (const_string "load")
9537 (eq_attr "alternative" "12")
9538 (const_string "store")
9539 (ne (symbol_ref "TARGET_MFCRF") (const_int 0))
9540 (const_string "mfcrf")
9542 (const_string "mfcr")))
9543 (set_attr "length" "4,4,12,4,4,8,4,4,4,4,4,4,4")])
9545 ;; For floating-point, we normally deal with the floating-point registers
9546 ;; unless -msoft-float is used. The sole exception is that parameter passing
9547 ;; can produce floating-point values in fixed-point registers. Unless the
9548 ;; value is a simple constant or already in memory, we deal with this by
9549 ;; allocating memory and copying the value explicitly via that memory location.
9550 (define_expand "movsf"
9551 [(set (match_operand:SF 0 "nonimmediate_operand" "")
9552 (match_operand:SF 1 "any_operand" ""))]
9554 "{ rs6000_emit_move (operands[0], operands[1], SFmode); DONE; }")
9557 [(set (match_operand:SF 0 "gpc_reg_operand" "")
9558 (match_operand:SF 1 "const_double_operand" ""))]
9560 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
9561 || (GET_CODE (operands[0]) == SUBREG
9562 && GET_CODE (SUBREG_REG (operands[0])) == REG
9563 && REGNO (SUBREG_REG (operands[0])) <= 31))"
9564 [(set (match_dup 2) (match_dup 3))]
9570 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
9571 REAL_VALUE_TO_TARGET_SINGLE (rv, l);
9573 if (! TARGET_POWERPC64)
9574 operands[2] = operand_subword (operands[0], 0, 0, SFmode);
9576 operands[2] = gen_lowpart (SImode, operands[0]);
9578 operands[3] = gen_int_mode (l, SImode);
9581 (define_insn "*movsf_hardfloat"
9582 [(set (match_operand:SF 0 "nonimmediate_operand" "=!r,!r,m,f,f,m,*c*l,*q,!r,*h,!r,!r")
9583 (match_operand:SF 1 "input_operand" "r,m,r,f,m,f,r,r,h,0,G,Fn"))]
9584 "(gpc_reg_operand (operands[0], SFmode)
9585 || gpc_reg_operand (operands[1], SFmode))
9586 && (TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT)"
9589 {l%U1%X1|lwz%U1%X1} %0,%1
9590 {st%U0%X0|stw%U0%X0} %1,%0
9600 [(set_attr "type" "*,load,store,fp,fpload,fpstore,mtjmpr,*,mfjmpr,*,*,*")
9601 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,8")])
9603 (define_insn "*movsf_softfloat"
9604 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,cl,q,r,r,m,r,r,r,r,r,*h")
9605 (match_operand:SF 1 "input_operand" "r,r,r,h,m,r,I,L,R,G,Fn,0"))]
9606 "(gpc_reg_operand (operands[0], SFmode)
9607 || gpc_reg_operand (operands[1], SFmode))
9608 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)"
9614 {l%U1%X1|lwz%U1%X1} %0,%1
9615 {st%U0%X0|stw%U0%X0} %1,%0
9622 [(set_attr "type" "*,mtjmpr,*,mfjmpr,load,store,*,*,*,*,*,*")
9623 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,8,4")])
9626 (define_expand "movdf"
9627 [(set (match_operand:DF 0 "nonimmediate_operand" "")
9628 (match_operand:DF 1 "any_operand" ""))]
9630 "{ rs6000_emit_move (operands[0], operands[1], DFmode); DONE; }")
9633 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9634 (match_operand:DF 1 "const_int_operand" ""))]
9635 "! TARGET_POWERPC64 && reload_completed
9636 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
9637 || (GET_CODE (operands[0]) == SUBREG
9638 && GET_CODE (SUBREG_REG (operands[0])) == REG
9639 && REGNO (SUBREG_REG (operands[0])) <= 31))"
9640 [(set (match_dup 2) (match_dup 4))
9641 (set (match_dup 3) (match_dup 1))]
9644 int endian = (WORDS_BIG_ENDIAN == 0);
9645 HOST_WIDE_INT value = INTVAL (operands[1]);
9647 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
9648 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
9649 #if HOST_BITS_PER_WIDE_INT == 32
9650 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
9652 operands[4] = GEN_INT (value >> 32);
9653 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
9658 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9659 (match_operand:DF 1 "const_double_operand" ""))]
9660 "! TARGET_POWERPC64 && reload_completed
9661 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
9662 || (GET_CODE (operands[0]) == SUBREG
9663 && GET_CODE (SUBREG_REG (operands[0])) == REG
9664 && REGNO (SUBREG_REG (operands[0])) <= 31))"
9665 [(set (match_dup 2) (match_dup 4))
9666 (set (match_dup 3) (match_dup 5))]
9669 int endian = (WORDS_BIG_ENDIAN == 0);
9673 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
9674 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
9676 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
9677 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
9678 operands[4] = gen_int_mode (l[endian], SImode);
9679 operands[5] = gen_int_mode (l[1 - endian], SImode);
9683 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9684 (match_operand:DF 1 "const_double_operand" ""))]
9685 "TARGET_POWERPC64 && reload_completed
9686 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
9687 || (GET_CODE (operands[0]) == SUBREG
9688 && GET_CODE (SUBREG_REG (operands[0])) == REG
9689 && REGNO (SUBREG_REG (operands[0])) <= 31))"
9690 [(set (match_dup 2) (match_dup 3))]
9693 int endian = (WORDS_BIG_ENDIAN == 0);
9696 #if HOST_BITS_PER_WIDE_INT >= 64
9700 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
9701 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
9703 operands[2] = gen_lowpart (DImode, operands[0]);
9704 /* HIGHPART is lower memory address when WORDS_BIG_ENDIAN. */
9705 #if HOST_BITS_PER_WIDE_INT >= 64
9706 val = ((HOST_WIDE_INT)(unsigned long)l[endian] << 32
9707 | ((HOST_WIDE_INT)(unsigned long)l[1 - endian]));
9709 operands[3] = gen_int_mode (val, DImode);
9711 operands[3] = immed_double_const (l[1 - endian], l[endian], DImode);
9715 ;; Don't have reload use general registers to load a constant. First,
9716 ;; it might not work if the output operand is the equivalent of
9717 ;; a non-offsettable memref, but also it is less efficient than loading
9718 ;; the constant into an FP register, since it will probably be used there.
9719 ;; The "??" is a kludge until we can figure out a more reasonable way
9720 ;; of handling these non-offsettable values.
9721 (define_insn "*movdf_hardfloat32"
9722 [(set (match_operand:DF 0 "nonimmediate_operand" "=!r,??r,m,ws,?wa,ws,?wa,Z,?Z,d,d,m,wa,!r,!r,!r")
9723 (match_operand:DF 1 "input_operand" "r,m,r,ws,wa,Z,Z,ws,wa,d,m,d,j,G,H,F"))]
9724 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9725 && (gpc_reg_operand (operands[0], DFmode)
9726 || gpc_reg_operand (operands[1], DFmode))"
9729 switch (which_alternative)
9739 return \"xxlor %x0,%x1,%x1\";
9742 return \"lxsd%U1x %x0,%y1\";
9745 return \"stxsd%U0x %x1,%y0\";
9747 return \"fmr %0,%1\";
9749 return \"lfd%U1%X1 %0,%1\";
9751 return \"stfd%U0%X0 %1,%0\";
9753 return \"xxlxor %x0,%x0,%x0\";
9760 [(set_attr "type" "two,load,store,fp,fp,fpload,fpload,fpstore,fpstore,fp,fpload,fpstore,vecsimple,*,*,*")
9761 (set_attr "length" "8,16,16,4,4,4,4,4,4,4,4,4,4,8,12,16")])
9763 (define_insn "*movdf_softfloat32"
9764 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,m,r,r,r")
9765 (match_operand:DF 1 "input_operand" "r,m,r,G,H,F"))]
9767 && ((TARGET_FPRS && TARGET_SINGLE_FLOAT)
9768 || TARGET_SOFT_FLOAT || TARGET_E500_SINGLE)
9769 && (gpc_reg_operand (operands[0], DFmode)
9770 || gpc_reg_operand (operands[1], DFmode))"
9772 [(set_attr "type" "two,load,store,*,*,*")
9773 (set_attr "length" "8,8,8,8,12,16")])
9775 ; ld/std require word-aligned displacements -> 'Y' constraint.
9776 ; List Y->r and r->Y before r->r for reload.
9777 (define_insn "*movdf_hardfloat64_mfpgpr"
9778 [(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")
9779 (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"))]
9780 "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
9781 && TARGET_DOUBLE_FLOAT
9782 && (gpc_reg_operand (operands[0], DFmode)
9783 || gpc_reg_operand (operands[1], DFmode))"
9806 [(set_attr "type" "store,load,*,fp,fp,fpload,fpload,fpstore,fpstore,fp,fpload,fpstore,vecsimple,mtjmpr,mfjmpr,*,*,*,*,mftgpr,mffgpr")
9807 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,8,12,16,4,4")])
9809 ; ld/std require word-aligned displacements -> 'Y' constraint.
9810 ; List Y->r and r->Y before r->r for reload.
9811 (define_insn "*movdf_hardfloat64"
9812 [(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")
9813 (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"))]
9814 "TARGET_POWERPC64 && !TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
9815 && TARGET_DOUBLE_FLOAT
9816 && (gpc_reg_operand (operands[0], DFmode)
9817 || gpc_reg_operand (operands[1], DFmode))"
9838 [(set_attr "type" "store,load,*,fp,fp,fpload,fpload,fpstore,fpstore,fp,fpload,fpstore,vecsimple,mtjmpr,mfjmpr,*,*,*,*")
9839 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,8,12,16")])
9841 (define_insn "*movdf_softfloat64"
9842 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,Y,r,cl,r,r,r,r,*h")
9843 (match_operand:DF 1 "input_operand" "Y,r,r,r,h,G,H,F,0"))]
9844 "TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)
9845 && (gpc_reg_operand (operands[0], DFmode)
9846 || gpc_reg_operand (operands[1], DFmode))"
9857 [(set_attr "type" "load,store,*,mtjmpr,mfjmpr,*,*,*,*")
9858 (set_attr "length" "4,4,4,4,4,8,12,16,4")])
9860 (define_expand "movtf"
9861 [(set (match_operand:TF 0 "general_operand" "")
9862 (match_operand:TF 1 "any_operand" ""))]
9863 "!TARGET_IEEEQUAD && TARGET_LONG_DOUBLE_128"
9864 "{ rs6000_emit_move (operands[0], operands[1], TFmode); DONE; }")
9866 ; It's important to list the o->f and f->o moves before f->f because
9867 ; otherwise reload, given m->f, will try to pick f->f and reload it,
9868 ; which doesn't make progress. Likewise r->Y must be before r->r.
9869 (define_insn_and_split "*movtf_internal"
9870 [(set (match_operand:TF 0 "nonimmediate_operand" "=o,d,d,r,Y,r")
9871 (match_operand:TF 1 "input_operand" "d,o,d,YGHF,r,r"))]
9873 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128
9874 && (gpc_reg_operand (operands[0], TFmode)
9875 || gpc_reg_operand (operands[1], TFmode))"
9877 "&& reload_completed"
9879 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
9880 [(set_attr "length" "8,8,8,20,20,16")])
9882 (define_insn_and_split "*movtf_softfloat"
9883 [(set (match_operand:TF 0 "rs6000_nonimmediate_operand" "=r,Y,r")
9884 (match_operand:TF 1 "input_operand" "YGHF,r,r"))]
9886 && (TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_LONG_DOUBLE_128
9887 && (gpc_reg_operand (operands[0], TFmode)
9888 || gpc_reg_operand (operands[1], TFmode))"
9890 "&& reload_completed"
9892 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
9893 [(set_attr "length" "20,20,16")])
9895 (define_expand "extenddftf2"
9896 [(set (match_operand:TF 0 "nonimmediate_operand" "")
9897 (float_extend:TF (match_operand:DF 1 "input_operand" "")))]
9899 && TARGET_HARD_FLOAT
9900 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9901 && TARGET_LONG_DOUBLE_128"
9903 if (TARGET_E500_DOUBLE)
9904 emit_insn (gen_spe_extenddftf2 (operands[0], operands[1]));
9906 emit_insn (gen_extenddftf2_fprs (operands[0], operands[1]));
9910 (define_expand "extenddftf2_fprs"
9911 [(parallel [(set (match_operand:TF 0 "nonimmediate_operand" "")
9912 (float_extend:TF (match_operand:DF 1 "input_operand" "")))
9913 (use (match_dup 2))])]
9915 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9916 && TARGET_LONG_DOUBLE_128"
9918 operands[2] = CONST0_RTX (DFmode);
9919 /* Generate GOT reference early for SVR4 PIC. */
9920 if (DEFAULT_ABI == ABI_V4 && flag_pic)
9921 operands[2] = validize_mem (force_const_mem (DFmode, operands[2]));
9924 (define_insn_and_split "*extenddftf2_internal"
9925 [(set (match_operand:TF 0 "nonimmediate_operand" "=o,d,&d,r")
9926 (float_extend:TF (match_operand:DF 1 "input_operand" "dr,md,md,rmGHF")))
9927 (use (match_operand:DF 2 "zero_reg_mem_operand" "rd,m,d,n"))]
9929 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9930 && TARGET_LONG_DOUBLE_128"
9932 "&& reload_completed"
9935 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
9936 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
9937 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word),
9939 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word),
9944 (define_expand "extendsftf2"
9945 [(set (match_operand:TF 0 "nonimmediate_operand" "")
9946 (float_extend:TF (match_operand:SF 1 "gpc_reg_operand" "")))]
9948 && TARGET_HARD_FLOAT
9949 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9950 && TARGET_LONG_DOUBLE_128"
9952 rtx tmp = gen_reg_rtx (DFmode);
9953 emit_insn (gen_extendsfdf2 (tmp, operands[1]));
9954 emit_insn (gen_extenddftf2 (operands[0], tmp));
9958 (define_expand "trunctfdf2"
9959 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9960 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "")))]
9962 && TARGET_HARD_FLOAT
9963 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9964 && TARGET_LONG_DOUBLE_128"
9967 (define_insn_and_split "trunctfdf2_internal1"
9968 [(set (match_operand:DF 0 "gpc_reg_operand" "=d,?d")
9969 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "0,d")))]
9970 "!TARGET_IEEEQUAD && !TARGET_XL_COMPAT
9971 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9975 "&& reload_completed && REGNO (operands[0]) == REGNO (operands[1])"
9978 emit_note (NOTE_INSN_DELETED);
9981 [(set_attr "type" "fp")])
9983 (define_insn "trunctfdf2_internal2"
9984 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
9985 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "d")))]
9986 "!TARGET_IEEEQUAD && TARGET_XL_COMPAT
9987 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9988 && TARGET_LONG_DOUBLE_128"
9990 [(set_attr "type" "fp")
9991 (set_attr "fp_type" "fp_addsub_d")])
9993 (define_expand "trunctfsf2"
9994 [(set (match_operand:SF 0 "gpc_reg_operand" "")
9995 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "")))]
9997 && TARGET_HARD_FLOAT
9998 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9999 && TARGET_LONG_DOUBLE_128"
10001 if (TARGET_E500_DOUBLE)
10002 emit_insn (gen_spe_trunctfsf2 (operands[0], operands[1]));
10004 emit_insn (gen_trunctfsf2_fprs (operands[0], operands[1]));
10008 (define_insn_and_split "trunctfsf2_fprs"
10009 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
10010 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "d")))
10011 (clobber (match_scratch:DF 2 "=d"))]
10013 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
10014 && TARGET_LONG_DOUBLE_128"
10016 "&& reload_completed"
10017 [(set (match_dup 2)
10018 (float_truncate:DF (match_dup 1)))
10020 (float_truncate:SF (match_dup 2)))]
10023 (define_expand "floatsitf2"
10024 [(set (match_operand:TF 0 "gpc_reg_operand" "")
10025 (float:TF (match_operand:SI 1 "gpc_reg_operand" "")))]
10027 && TARGET_HARD_FLOAT
10028 && (TARGET_FPRS || TARGET_E500_DOUBLE)
10029 && TARGET_LONG_DOUBLE_128"
10031 rtx tmp = gen_reg_rtx (DFmode);
10032 expand_float (tmp, operands[1], false);
10033 emit_insn (gen_extenddftf2 (operands[0], tmp));
10037 ; fadd, but rounding towards zero.
10038 ; This is probably not the optimal code sequence.
10039 (define_insn "fix_trunc_helper"
10040 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
10041 (unspec:DF [(match_operand:TF 1 "gpc_reg_operand" "d")]
10042 UNSPEC_FIX_TRUNC_TF))
10043 (clobber (match_operand:DF 2 "gpc_reg_operand" "=&d"))]
10044 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
10045 "mffs %2\n\tmtfsb1 31\n\tmtfsb0 30\n\tfadd %0,%1,%L1\n\tmtfsf 1,%2"
10046 [(set_attr "type" "fp")
10047 (set_attr "length" "20")])
10049 (define_expand "fix_trunctfsi2"
10050 [(set (match_operand:SI 0 "gpc_reg_operand" "")
10051 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))]
10053 && (TARGET_POWER2 || TARGET_POWERPC)
10054 && TARGET_HARD_FLOAT
10055 && (TARGET_FPRS || TARGET_E500_DOUBLE)
10056 && TARGET_LONG_DOUBLE_128"
10058 if (TARGET_E500_DOUBLE)
10059 emit_insn (gen_spe_fix_trunctfsi2 (operands[0], operands[1]));
10061 emit_insn (gen_fix_trunctfsi2_fprs (operands[0], operands[1]));
10065 (define_expand "fix_trunctfsi2_fprs"
10066 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
10067 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))
10068 (clobber (match_dup 2))
10069 (clobber (match_dup 3))
10070 (clobber (match_dup 4))
10071 (clobber (match_dup 5))])]
10073 && (TARGET_POWER2 || TARGET_POWERPC)
10074 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
10076 operands[2] = gen_reg_rtx (DFmode);
10077 operands[3] = gen_reg_rtx (DFmode);
10078 operands[4] = gen_reg_rtx (DImode);
10079 operands[5] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
10082 (define_insn_and_split "*fix_trunctfsi2_internal"
10083 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10084 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "d")))
10085 (clobber (match_operand:DF 2 "gpc_reg_operand" "=d"))
10086 (clobber (match_operand:DF 3 "gpc_reg_operand" "=&d"))
10087 (clobber (match_operand:DI 4 "gpc_reg_operand" "=d"))
10088 (clobber (match_operand:DI 5 "offsettable_mem_operand" "=o"))]
10090 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
10096 emit_insn (gen_fix_trunc_helper (operands[2], operands[1], operands[3]));
10098 gcc_assert (MEM_P (operands[5]));
10099 lowword = adjust_address (operands[5], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
10101 emit_insn (gen_fctiwz_df (operands[4], operands[2]));
10102 emit_move_insn (operands[5], operands[4]);
10103 emit_move_insn (operands[0], lowword);
10107 (define_expand "negtf2"
10108 [(set (match_operand:TF 0 "gpc_reg_operand" "")
10109 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "")))]
10111 && TARGET_HARD_FLOAT
10112 && (TARGET_FPRS || TARGET_E500_DOUBLE)
10113 && TARGET_LONG_DOUBLE_128"
10116 (define_insn "negtf2_internal"
10117 [(set (match_operand:TF 0 "gpc_reg_operand" "=d")
10118 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "d")))]
10120 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
10123 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
10124 return \"fneg %L0,%L1\;fneg %0,%1\";
10126 return \"fneg %0,%1\;fneg %L0,%L1\";
10128 [(set_attr "type" "fp")
10129 (set_attr "length" "8")])
10131 (define_expand "abstf2"
10132 [(set (match_operand:TF 0 "gpc_reg_operand" "")
10133 (abs:TF (match_operand:TF 1 "gpc_reg_operand" "")))]
10135 && TARGET_HARD_FLOAT
10136 && (TARGET_FPRS || TARGET_E500_DOUBLE)
10137 && TARGET_LONG_DOUBLE_128"
10140 rtx label = gen_label_rtx ();
10141 if (TARGET_E500_DOUBLE)
10143 if (flag_finite_math_only && !flag_trapping_math)
10144 emit_insn (gen_spe_abstf2_tst (operands[0], operands[1], label));
10146 emit_insn (gen_spe_abstf2_cmp (operands[0], operands[1], label));
10149 emit_insn (gen_abstf2_internal (operands[0], operands[1], label));
10150 emit_label (label);
10154 (define_expand "abstf2_internal"
10155 [(set (match_operand:TF 0 "gpc_reg_operand" "")
10156 (match_operand:TF 1 "gpc_reg_operand" ""))
10157 (set (match_dup 3) (match_dup 5))
10158 (set (match_dup 5) (abs:DF (match_dup 5)))
10159 (set (match_dup 4) (compare:CCFP (match_dup 3) (match_dup 5)))
10160 (set (pc) (if_then_else (eq (match_dup 4) (const_int 0))
10161 (label_ref (match_operand 2 "" ""))
10163 (set (match_dup 6) (neg:DF (match_dup 6)))]
10165 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
10166 && TARGET_LONG_DOUBLE_128"
10169 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
10170 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
10171 operands[3] = gen_reg_rtx (DFmode);
10172 operands[4] = gen_reg_rtx (CCFPmode);
10173 operands[5] = simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word);
10174 operands[6] = simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word);
10177 ;; Next come the multi-word integer load and store and the load and store
10180 ; List r->r after r->"o<>", otherwise reload will try to reload a
10181 ; non-offsettable address by using r->r which won't make progress.
10182 (define_insn "*movdi_internal32"
10183 [(set (match_operand:DI 0 "rs6000_nonimmediate_operand" "=o<>,r,r,*d,*d,m,r")
10184 (match_operand:DI 1 "input_operand" "r,r,m,d,m,d,IJKnGHF"))]
10185 "! TARGET_POWERPC64
10186 && (gpc_reg_operand (operands[0], DImode)
10187 || gpc_reg_operand (operands[1], DImode))"
10196 [(set_attr "type" "load,*,store,fp,fpload,fpstore,*")])
10199 [(set (match_operand:DI 0 "gpc_reg_operand" "")
10200 (match_operand:DI 1 "const_int_operand" ""))]
10201 "! TARGET_POWERPC64 && reload_completed"
10202 [(set (match_dup 2) (match_dup 4))
10203 (set (match_dup 3) (match_dup 1))]
10206 HOST_WIDE_INT value = INTVAL (operands[1]);
10207 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
10209 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
10211 #if HOST_BITS_PER_WIDE_INT == 32
10212 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
10214 operands[4] = GEN_INT (value >> 32);
10215 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
10220 [(set (match_operand:DIFD 0 "rs6000_nonimmediate_operand" "")
10221 (match_operand:DIFD 1 "input_operand" ""))]
10222 "reload_completed && !TARGET_POWERPC64
10223 && gpr_or_gpr_p (operands[0], operands[1])"
10225 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
10227 (define_insn "*movdi_mfpgpr"
10228 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,*d,*d,m,r,*h,*h,r,*d")
10229 (match_operand:DI 1 "input_operand" "r,m,r,I,L,nF,R,d,m,d,*h,r,0,*d,r"))]
10230 "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
10231 && (gpc_reg_operand (operands[0], DImode)
10232 || gpc_reg_operand (operands[1], DImode))"
10249 [(set_attr "type" "*,load,store,*,*,*,*,fp,fpload,fpstore,mfjmpr,mtjmpr,*,mftgpr,mffgpr")
10250 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4,4,4")])
10252 (define_insn "*movdi_internal64"
10253 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,*d,*d,m,r,*h,*h")
10254 (match_operand:DI 1 "input_operand" "r,m,r,I,L,nF,R,d,m,d,*h,r,0"))]
10255 "TARGET_POWERPC64 && (!TARGET_MFPGPR || !TARGET_HARD_FLOAT || !TARGET_FPRS)
10256 && (gpc_reg_operand (operands[0], DImode)
10257 || gpc_reg_operand (operands[1], DImode))"
10272 [(set_attr "type" "*,load,store,*,*,*,*,fp,fpload,fpstore,mfjmpr,mtjmpr,*")
10273 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4")])
10275 ;; immediate value valid for a single instruction hiding in a const_double
10277 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10278 (match_operand:DI 1 "const_double_operand" "F"))]
10279 "HOST_BITS_PER_WIDE_INT == 32 && TARGET_POWERPC64
10280 && GET_CODE (operands[1]) == CONST_DOUBLE
10281 && num_insns_constant (operands[1], DImode) == 1"
10284 return ((unsigned HOST_WIDE_INT)
10285 (CONST_DOUBLE_LOW (operands[1]) + 0x8000) < 0x10000)
10286 ? \"li %0,%1\" : \"lis %0,%v1\";
10289 ;; Generate all one-bits and clear left or right.
10290 ;; Use (and:DI (rotate:DI ...)) to avoid anddi3 unnecessary clobber.
10292 [(set (match_operand:DI 0 "gpc_reg_operand" "")
10293 (match_operand:DI 1 "mask64_operand" ""))]
10294 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
10295 [(set (match_dup 0) (const_int -1))
10297 (and:DI (rotate:DI (match_dup 0)
10302 ;; Split a load of a large constant into the appropriate five-instruction
10303 ;; sequence. Handle anything in a constant number of insns.
10304 ;; When non-easy constants can go in the TOC, this should use
10305 ;; easy_fp_constant predicate.
10307 [(set (match_operand:DI 0 "gpc_reg_operand" "")
10308 (match_operand:DI 1 "const_int_operand" ""))]
10309 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
10310 [(set (match_dup 0) (match_dup 2))
10311 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
10313 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
10315 if (tem == operands[0])
10322 [(set (match_operand:DI 0 "gpc_reg_operand" "")
10323 (match_operand:DI 1 "const_double_operand" ""))]
10324 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
10325 [(set (match_dup 0) (match_dup 2))
10326 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
10328 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
10330 if (tem == operands[0])
10336 ;; TImode is similar, except that we usually want to compute the address into
10337 ;; a register and use lsi/stsi (the exception is during reload). MQ is also
10338 ;; clobbered in stsi for POWER, so we need a SCRATCH for it.
10340 ;; We say that MQ is clobbered in the last alternative because the first
10341 ;; alternative would never get used otherwise since it would need a reload
10342 ;; while the 2nd alternative would not. We put memory cases first so they
10343 ;; are preferred. Otherwise, we'd try to reload the output instead of
10344 ;; giving the SCRATCH mq.
10346 (define_insn "*movti_power"
10347 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,m,????r,????r,????r,r")
10348 (match_operand:TI 1 "input_operand" "r,r,r,Q,m,n"))
10349 (clobber (match_scratch:SI 2 "=q,q#X,X,X,X,X"))]
10350 "TARGET_POWER && ! TARGET_POWERPC64
10351 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
10354 switch (which_alternative)
10357 gcc_unreachable ();
10361 return \"{stsi|stswi} %1,%P0,16\";
10366 /* If the address is not used in the output, we can use lsi. Otherwise,
10367 fall through to generating four loads. */
10369 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
10370 return \"{lsi|lswi} %0,%P1,16\";
10371 /* ... fall through ... */
10377 [(set_attr "type" "store,store,*,load,load,*")])
10379 (define_insn "*movti_string"
10380 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,o<>,????r,????r,????r,r")
10381 (match_operand:TI 1 "input_operand" "r,r,r,Q,m,n"))]
10382 "! TARGET_POWER && ! TARGET_POWERPC64
10383 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
10386 switch (which_alternative)
10389 gcc_unreachable ();
10392 return \"{stsi|stswi} %1,%P0,16\";
10397 /* If the address is not used in the output, we can use lsi. Otherwise,
10398 fall through to generating four loads. */
10400 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
10401 return \"{lsi|lswi} %0,%P1,16\";
10402 /* ... fall through ... */
10408 [(set_attr "type" "store_ux,store_ux,*,load_ux,load_ux,*")
10409 (set (attr "cell_micro") (if_then_else (eq (symbol_ref "TARGET_STRING") (const_int 1))
10410 (const_string "always")
10411 (const_string "conditional")))])
10413 (define_insn "*movti_ppc64"
10414 [(set (match_operand:TI 0 "nonimmediate_operand" "=r,o<>,r")
10415 (match_operand:TI 1 "input_operand" "r,r,m"))]
10416 "(TARGET_POWERPC64 && (gpc_reg_operand (operands[0], TImode)
10417 || gpc_reg_operand (operands[1], TImode)))
10418 && VECTOR_MEM_NONE_P (TImode)"
10420 [(set_attr "type" "*,store,load")])
10423 [(set (match_operand:TI 0 "gpc_reg_operand" "")
10424 (match_operand:TI 1 "const_double_operand" ""))]
10425 "TARGET_POWERPC64 && VECTOR_MEM_NONE_P (TImode)"
10426 [(set (match_dup 2) (match_dup 4))
10427 (set (match_dup 3) (match_dup 5))]
10430 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
10432 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
10434 if (GET_CODE (operands[1]) == CONST_DOUBLE)
10436 operands[4] = GEN_INT (CONST_DOUBLE_HIGH (operands[1]));
10437 operands[5] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
10439 else if (GET_CODE (operands[1]) == CONST_INT)
10441 operands[4] = GEN_INT (- (INTVAL (operands[1]) < 0));
10442 operands[5] = operands[1];
10449 [(set (match_operand:TI 0 "nonimmediate_operand" "")
10450 (match_operand:TI 1 "input_operand" ""))]
10451 "reload_completed && VECTOR_MEM_NONE_P (TImode)
10452 && gpr_or_gpr_p (operands[0], operands[1])"
10454 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
10456 (define_expand "load_multiple"
10457 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
10458 (match_operand:SI 1 "" ""))
10459 (use (match_operand:SI 2 "" ""))])]
10460 "TARGET_STRING && !TARGET_POWERPC64"
10468 /* Support only loading a constant number of fixed-point registers from
10469 memory and only bother with this if more than two; the machine
10470 doesn't support more than eight. */
10471 if (GET_CODE (operands[2]) != CONST_INT
10472 || INTVAL (operands[2]) <= 2
10473 || INTVAL (operands[2]) > 8
10474 || GET_CODE (operands[1]) != MEM
10475 || GET_CODE (operands[0]) != REG
10476 || REGNO (operands[0]) >= 32)
10479 count = INTVAL (operands[2]);
10480 regno = REGNO (operands[0]);
10482 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
10483 op1 = replace_equiv_address (operands[1],
10484 force_reg (SImode, XEXP (operands[1], 0)));
10486 for (i = 0; i < count; i++)
10487 XVECEXP (operands[3], 0, i)
10488 = gen_rtx_SET (VOIDmode, gen_rtx_REG (SImode, regno + i),
10489 adjust_address_nv (op1, SImode, i * 4));
10492 (define_insn "*ldmsi8"
10493 [(match_parallel 0 "load_multiple_operation"
10494 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10495 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10496 (set (match_operand:SI 3 "gpc_reg_operand" "")
10497 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10498 (set (match_operand:SI 4 "gpc_reg_operand" "")
10499 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
10500 (set (match_operand:SI 5 "gpc_reg_operand" "")
10501 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
10502 (set (match_operand:SI 6 "gpc_reg_operand" "")
10503 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
10504 (set (match_operand:SI 7 "gpc_reg_operand" "")
10505 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
10506 (set (match_operand:SI 8 "gpc_reg_operand" "")
10507 (mem:SI (plus:SI (match_dup 1) (const_int 24))))
10508 (set (match_operand:SI 9 "gpc_reg_operand" "")
10509 (mem:SI (plus:SI (match_dup 1) (const_int 28))))])]
10510 "TARGET_STRING && XVECLEN (operands[0], 0) == 8"
10512 { return rs6000_output_load_multiple (operands); }"
10513 [(set_attr "type" "load_ux")
10514 (set_attr "length" "32")])
10516 (define_insn "*ldmsi7"
10517 [(match_parallel 0 "load_multiple_operation"
10518 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10519 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10520 (set (match_operand:SI 3 "gpc_reg_operand" "")
10521 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10522 (set (match_operand:SI 4 "gpc_reg_operand" "")
10523 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
10524 (set (match_operand:SI 5 "gpc_reg_operand" "")
10525 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
10526 (set (match_operand:SI 6 "gpc_reg_operand" "")
10527 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
10528 (set (match_operand:SI 7 "gpc_reg_operand" "")
10529 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
10530 (set (match_operand:SI 8 "gpc_reg_operand" "")
10531 (mem:SI (plus:SI (match_dup 1) (const_int 24))))])]
10532 "TARGET_STRING && XVECLEN (operands[0], 0) == 7"
10534 { return rs6000_output_load_multiple (operands); }"
10535 [(set_attr "type" "load_ux")
10536 (set_attr "length" "32")])
10538 (define_insn "*ldmsi6"
10539 [(match_parallel 0 "load_multiple_operation"
10540 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10541 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10542 (set (match_operand:SI 3 "gpc_reg_operand" "")
10543 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10544 (set (match_operand:SI 4 "gpc_reg_operand" "")
10545 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
10546 (set (match_operand:SI 5 "gpc_reg_operand" "")
10547 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
10548 (set (match_operand:SI 6 "gpc_reg_operand" "")
10549 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
10550 (set (match_operand:SI 7 "gpc_reg_operand" "")
10551 (mem:SI (plus:SI (match_dup 1) (const_int 20))))])]
10552 "TARGET_STRING && XVECLEN (operands[0], 0) == 6"
10554 { return rs6000_output_load_multiple (operands); }"
10555 [(set_attr "type" "load_ux")
10556 (set_attr "length" "32")])
10558 (define_insn "*ldmsi5"
10559 [(match_parallel 0 "load_multiple_operation"
10560 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10561 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10562 (set (match_operand:SI 3 "gpc_reg_operand" "")
10563 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10564 (set (match_operand:SI 4 "gpc_reg_operand" "")
10565 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
10566 (set (match_operand:SI 5 "gpc_reg_operand" "")
10567 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
10568 (set (match_operand:SI 6 "gpc_reg_operand" "")
10569 (mem:SI (plus:SI (match_dup 1) (const_int 16))))])]
10570 "TARGET_STRING && XVECLEN (operands[0], 0) == 5"
10572 { return rs6000_output_load_multiple (operands); }"
10573 [(set_attr "type" "load_ux")
10574 (set_attr "length" "32")])
10576 (define_insn "*ldmsi4"
10577 [(match_parallel 0 "load_multiple_operation"
10578 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10579 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10580 (set (match_operand:SI 3 "gpc_reg_operand" "")
10581 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10582 (set (match_operand:SI 4 "gpc_reg_operand" "")
10583 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
10584 (set (match_operand:SI 5 "gpc_reg_operand" "")
10585 (mem:SI (plus:SI (match_dup 1) (const_int 12))))])]
10586 "TARGET_STRING && XVECLEN (operands[0], 0) == 4"
10588 { return rs6000_output_load_multiple (operands); }"
10589 [(set_attr "type" "load_ux")
10590 (set_attr "length" "32")])
10592 (define_insn "*ldmsi3"
10593 [(match_parallel 0 "load_multiple_operation"
10594 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10595 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10596 (set (match_operand:SI 3 "gpc_reg_operand" "")
10597 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10598 (set (match_operand:SI 4 "gpc_reg_operand" "")
10599 (mem:SI (plus:SI (match_dup 1) (const_int 8))))])]
10600 "TARGET_STRING && XVECLEN (operands[0], 0) == 3"
10602 { return rs6000_output_load_multiple (operands); }"
10603 [(set_attr "type" "load_ux")
10604 (set_attr "length" "32")])
10606 (define_expand "store_multiple"
10607 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
10608 (match_operand:SI 1 "" ""))
10609 (clobber (scratch:SI))
10610 (use (match_operand:SI 2 "" ""))])]
10611 "TARGET_STRING && !TARGET_POWERPC64"
10620 /* Support only storing a constant number of fixed-point registers to
10621 memory and only bother with this if more than two; the machine
10622 doesn't support more than eight. */
10623 if (GET_CODE (operands[2]) != CONST_INT
10624 || INTVAL (operands[2]) <= 2
10625 || INTVAL (operands[2]) > 8
10626 || GET_CODE (operands[0]) != MEM
10627 || GET_CODE (operands[1]) != REG
10628 || REGNO (operands[1]) >= 32)
10631 count = INTVAL (operands[2]);
10632 regno = REGNO (operands[1]);
10634 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count + 1));
10635 to = force_reg (SImode, XEXP (operands[0], 0));
10636 op0 = replace_equiv_address (operands[0], to);
10638 XVECEXP (operands[3], 0, 0)
10639 = gen_rtx_SET (VOIDmode, adjust_address_nv (op0, SImode, 0), operands[1]);
10640 XVECEXP (operands[3], 0, 1) = gen_rtx_CLOBBER (VOIDmode,
10641 gen_rtx_SCRATCH (SImode));
10643 for (i = 1; i < count; i++)
10644 XVECEXP (operands[3], 0, i + 1)
10645 = gen_rtx_SET (VOIDmode,
10646 adjust_address_nv (op0, SImode, i * 4),
10647 gen_rtx_REG (SImode, regno + i));
10650 (define_insn "*stmsi8"
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 "=X"))
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 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
10666 (match_operand:SI 9 "gpc_reg_operand" "r"))
10667 (set (mem:SI (plus:SI (match_dup 1) (const_int 28)))
10668 (match_operand:SI 10 "gpc_reg_operand" "r"))])]
10669 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 9"
10670 "{stsi|stswi} %2,%1,%O0"
10671 [(set_attr "type" "store_ux")
10672 (set_attr "cell_micro" "always")])
10674 (define_insn "*stmsi7"
10675 [(match_parallel 0 "store_multiple_operation"
10676 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10677 (match_operand:SI 2 "gpc_reg_operand" "r"))
10678 (clobber (match_scratch:SI 3 "=X"))
10679 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10680 (match_operand:SI 4 "gpc_reg_operand" "r"))
10681 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10682 (match_operand:SI 5 "gpc_reg_operand" "r"))
10683 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10684 (match_operand:SI 6 "gpc_reg_operand" "r"))
10685 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10686 (match_operand:SI 7 "gpc_reg_operand" "r"))
10687 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10688 (match_operand:SI 8 "gpc_reg_operand" "r"))
10689 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
10690 (match_operand:SI 9 "gpc_reg_operand" "r"))])]
10691 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 8"
10692 "{stsi|stswi} %2,%1,%O0"
10693 [(set_attr "type" "store_ux")
10694 (set_attr "cell_micro" "always")])
10696 (define_insn "*stmsi6"
10697 [(match_parallel 0 "store_multiple_operation"
10698 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10699 (match_operand:SI 2 "gpc_reg_operand" "r"))
10700 (clobber (match_scratch:SI 3 "=X"))
10701 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10702 (match_operand:SI 4 "gpc_reg_operand" "r"))
10703 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10704 (match_operand:SI 5 "gpc_reg_operand" "r"))
10705 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10706 (match_operand:SI 6 "gpc_reg_operand" "r"))
10707 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10708 (match_operand:SI 7 "gpc_reg_operand" "r"))
10709 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10710 (match_operand:SI 8 "gpc_reg_operand" "r"))])]
10711 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 7"
10712 "{stsi|stswi} %2,%1,%O0"
10713 [(set_attr "type" "store_ux")
10714 (set_attr "cell_micro" "always")])
10716 (define_insn "*stmsi5"
10717 [(match_parallel 0 "store_multiple_operation"
10718 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10719 (match_operand:SI 2 "gpc_reg_operand" "r"))
10720 (clobber (match_scratch:SI 3 "=X"))
10721 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10722 (match_operand:SI 4 "gpc_reg_operand" "r"))
10723 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10724 (match_operand:SI 5 "gpc_reg_operand" "r"))
10725 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10726 (match_operand:SI 6 "gpc_reg_operand" "r"))
10727 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10728 (match_operand:SI 7 "gpc_reg_operand" "r"))])]
10729 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 6"
10730 "{stsi|stswi} %2,%1,%O0"
10731 [(set_attr "type" "store_ux")
10732 (set_attr "cell_micro" "always")])
10734 (define_insn "*stmsi4"
10735 [(match_parallel 0 "store_multiple_operation"
10736 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10737 (match_operand:SI 2 "gpc_reg_operand" "r"))
10738 (clobber (match_scratch:SI 3 "=X"))
10739 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10740 (match_operand:SI 4 "gpc_reg_operand" "r"))
10741 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10742 (match_operand:SI 5 "gpc_reg_operand" "r"))
10743 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10744 (match_operand:SI 6 "gpc_reg_operand" "r"))])]
10745 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 5"
10746 "{stsi|stswi} %2,%1,%O0"
10747 [(set_attr "type" "store_ux")
10748 (set_attr "cell_micro" "always")])
10750 (define_insn "*stmsi3"
10751 [(match_parallel 0 "store_multiple_operation"
10752 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10753 (match_operand:SI 2 "gpc_reg_operand" "r"))
10754 (clobber (match_scratch:SI 3 "=X"))
10755 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10756 (match_operand:SI 4 "gpc_reg_operand" "r"))
10757 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10758 (match_operand:SI 5 "gpc_reg_operand" "r"))])]
10759 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 4"
10760 "{stsi|stswi} %2,%1,%O0"
10761 [(set_attr "type" "store_ux")
10762 (set_attr "cell_micro" "always")])
10764 (define_insn "*stmsi8_power"
10765 [(match_parallel 0 "store_multiple_operation"
10766 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10767 (match_operand:SI 2 "gpc_reg_operand" "r"))
10768 (clobber (match_scratch:SI 3 "=q"))
10769 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10770 (match_operand:SI 4 "gpc_reg_operand" "r"))
10771 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10772 (match_operand:SI 5 "gpc_reg_operand" "r"))
10773 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10774 (match_operand:SI 6 "gpc_reg_operand" "r"))
10775 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10776 (match_operand:SI 7 "gpc_reg_operand" "r"))
10777 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10778 (match_operand:SI 8 "gpc_reg_operand" "r"))
10779 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
10780 (match_operand:SI 9 "gpc_reg_operand" "r"))
10781 (set (mem:SI (plus:SI (match_dup 1) (const_int 28)))
10782 (match_operand:SI 10 "gpc_reg_operand" "r"))])]
10783 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 9"
10784 "{stsi|stswi} %2,%1,%O0"
10785 [(set_attr "type" "store_ux")
10786 (set_attr "cell_micro" "always")])
10788 (define_insn "*stmsi7_power"
10789 [(match_parallel 0 "store_multiple_operation"
10790 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10791 (match_operand:SI 2 "gpc_reg_operand" "r"))
10792 (clobber (match_scratch:SI 3 "=q"))
10793 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10794 (match_operand:SI 4 "gpc_reg_operand" "r"))
10795 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10796 (match_operand:SI 5 "gpc_reg_operand" "r"))
10797 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10798 (match_operand:SI 6 "gpc_reg_operand" "r"))
10799 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10800 (match_operand:SI 7 "gpc_reg_operand" "r"))
10801 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10802 (match_operand:SI 8 "gpc_reg_operand" "r"))
10803 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
10804 (match_operand:SI 9 "gpc_reg_operand" "r"))])]
10805 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 8"
10806 "{stsi|stswi} %2,%1,%O0"
10807 [(set_attr "type" "store_ux")
10808 (set_attr "cell_micro" "always")])
10810 (define_insn "*stmsi6_power"
10811 [(match_parallel 0 "store_multiple_operation"
10812 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10813 (match_operand:SI 2 "gpc_reg_operand" "r"))
10814 (clobber (match_scratch:SI 3 "=q"))
10815 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10816 (match_operand:SI 4 "gpc_reg_operand" "r"))
10817 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10818 (match_operand:SI 5 "gpc_reg_operand" "r"))
10819 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10820 (match_operand:SI 6 "gpc_reg_operand" "r"))
10821 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10822 (match_operand:SI 7 "gpc_reg_operand" "r"))
10823 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10824 (match_operand:SI 8 "gpc_reg_operand" "r"))])]
10825 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 7"
10826 "{stsi|stswi} %2,%1,%O0"
10827 [(set_attr "type" "store_ux")
10828 (set_attr "cell_micro" "always")])
10830 (define_insn "*stmsi5_power"
10831 [(match_parallel 0 "store_multiple_operation"
10832 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10833 (match_operand:SI 2 "gpc_reg_operand" "r"))
10834 (clobber (match_scratch:SI 3 "=q"))
10835 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10836 (match_operand:SI 4 "gpc_reg_operand" "r"))
10837 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10838 (match_operand:SI 5 "gpc_reg_operand" "r"))
10839 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10840 (match_operand:SI 6 "gpc_reg_operand" "r"))
10841 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10842 (match_operand:SI 7 "gpc_reg_operand" "r"))])]
10843 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 6"
10844 "{stsi|stswi} %2,%1,%O0"
10845 [(set_attr "type" "store_ux")
10846 (set_attr "cell_micro" "always")])
10848 (define_insn "*stmsi4_power"
10849 [(match_parallel 0 "store_multiple_operation"
10850 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10851 (match_operand:SI 2 "gpc_reg_operand" "r"))
10852 (clobber (match_scratch:SI 3 "=q"))
10853 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10854 (match_operand:SI 4 "gpc_reg_operand" "r"))
10855 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10856 (match_operand:SI 5 "gpc_reg_operand" "r"))
10857 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10858 (match_operand:SI 6 "gpc_reg_operand" "r"))])]
10859 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 5"
10860 "{stsi|stswi} %2,%1,%O0"
10861 [(set_attr "type" "store_ux")
10862 (set_attr "cell_micro" "always")])
10864 (define_insn "*stmsi3_power"
10865 [(match_parallel 0 "store_multiple_operation"
10866 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10867 (match_operand:SI 2 "gpc_reg_operand" "r"))
10868 (clobber (match_scratch:SI 3 "=q"))
10869 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10870 (match_operand:SI 4 "gpc_reg_operand" "r"))
10871 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10872 (match_operand:SI 5 "gpc_reg_operand" "r"))])]
10873 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 4"
10874 "{stsi|stswi} %2,%1,%O0"
10875 [(set_attr "type" "store_ux")
10876 (set_attr "cell_micro" "always")])
10878 (define_expand "setmemsi"
10879 [(parallel [(set (match_operand:BLK 0 "" "")
10880 (match_operand 2 "const_int_operand" ""))
10881 (use (match_operand:SI 1 "" ""))
10882 (use (match_operand:SI 3 "" ""))])]
10886 /* If value to set is not zero, use the library routine. */
10887 if (operands[2] != const0_rtx)
10890 if (expand_block_clear (operands))
10896 ;; String/block move insn.
10897 ;; Argument 0 is the destination
10898 ;; Argument 1 is the source
10899 ;; Argument 2 is the length
10900 ;; Argument 3 is the alignment
10902 (define_expand "movmemsi"
10903 [(parallel [(set (match_operand:BLK 0 "" "")
10904 (match_operand:BLK 1 "" ""))
10905 (use (match_operand:SI 2 "" ""))
10906 (use (match_operand:SI 3 "" ""))])]
10910 if (expand_block_move (operands))
10916 ;; Move up to 32 bytes at a time. The fixed registers are needed because the
10917 ;; register allocator doesn't have a clue about allocating 8 word registers.
10918 ;; rD/rS = r5 is preferred, efficient form.
10919 (define_expand "movmemsi_8reg"
10920 [(parallel [(set (match_operand 0 "" "")
10921 (match_operand 1 "" ""))
10922 (use (match_operand 2 "" ""))
10923 (use (match_operand 3 "" ""))
10924 (clobber (reg:SI 5))
10925 (clobber (reg:SI 6))
10926 (clobber (reg:SI 7))
10927 (clobber (reg:SI 8))
10928 (clobber (reg:SI 9))
10929 (clobber (reg:SI 10))
10930 (clobber (reg:SI 11))
10931 (clobber (reg:SI 12))
10932 (clobber (match_scratch:SI 4 ""))])]
10937 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
10938 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
10939 (use (match_operand:SI 2 "immediate_operand" "i"))
10940 (use (match_operand:SI 3 "immediate_operand" "i"))
10941 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10942 (clobber (reg:SI 6))
10943 (clobber (reg:SI 7))
10944 (clobber (reg:SI 8))
10945 (clobber (reg:SI 9))
10946 (clobber (reg:SI 10))
10947 (clobber (reg:SI 11))
10948 (clobber (reg:SI 12))
10949 (clobber (match_scratch:SI 5 "=q"))]
10950 "TARGET_STRING && TARGET_POWER
10951 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
10952 || INTVAL (operands[2]) == 0)
10953 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
10954 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
10955 && REGNO (operands[4]) == 5"
10956 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10957 [(set_attr "type" "store_ux")
10958 (set_attr "cell_micro" "always")
10959 (set_attr "length" "8")])
10962 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
10963 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
10964 (use (match_operand:SI 2 "immediate_operand" "i"))
10965 (use (match_operand:SI 3 "immediate_operand" "i"))
10966 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10967 (clobber (reg:SI 6))
10968 (clobber (reg:SI 7))
10969 (clobber (reg:SI 8))
10970 (clobber (reg:SI 9))
10971 (clobber (reg:SI 10))
10972 (clobber (reg:SI 11))
10973 (clobber (reg:SI 12))
10974 (clobber (match_scratch:SI 5 "=X"))]
10975 "TARGET_STRING && ! TARGET_POWER
10976 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
10977 || INTVAL (operands[2]) == 0)
10978 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
10979 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
10980 && REGNO (operands[4]) == 5"
10981 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10982 [(set_attr "type" "store_ux")
10983 (set_attr "cell_micro" "always")
10984 (set_attr "length" "8")])
10986 ;; Move up to 24 bytes at a time. The fixed registers are needed because the
10987 ;; register allocator doesn't have a clue about allocating 6 word registers.
10988 ;; rD/rS = r5 is preferred, efficient form.
10989 (define_expand "movmemsi_6reg"
10990 [(parallel [(set (match_operand 0 "" "")
10991 (match_operand 1 "" ""))
10992 (use (match_operand 2 "" ""))
10993 (use (match_operand 3 "" ""))
10994 (clobber (reg:SI 5))
10995 (clobber (reg:SI 6))
10996 (clobber (reg:SI 7))
10997 (clobber (reg:SI 8))
10998 (clobber (reg:SI 9))
10999 (clobber (reg:SI 10))
11000 (clobber (match_scratch:SI 4 ""))])]
11005 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
11006 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
11007 (use (match_operand:SI 2 "immediate_operand" "i"))
11008 (use (match_operand:SI 3 "immediate_operand" "i"))
11009 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
11010 (clobber (reg:SI 6))
11011 (clobber (reg:SI 7))
11012 (clobber (reg:SI 8))
11013 (clobber (reg:SI 9))
11014 (clobber (reg:SI 10))
11015 (clobber (match_scratch:SI 5 "=q"))]
11016 "TARGET_STRING && TARGET_POWER
11017 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 24
11018 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
11019 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
11020 && REGNO (operands[4]) == 5"
11021 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
11022 [(set_attr "type" "store_ux")
11023 (set_attr "cell_micro" "always")
11024 (set_attr "length" "8")])
11027 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
11028 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
11029 (use (match_operand:SI 2 "immediate_operand" "i"))
11030 (use (match_operand:SI 3 "immediate_operand" "i"))
11031 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
11032 (clobber (reg:SI 6))
11033 (clobber (reg:SI 7))
11034 (clobber (reg:SI 8))
11035 (clobber (reg:SI 9))
11036 (clobber (reg:SI 10))
11037 (clobber (match_scratch:SI 5 "=X"))]
11038 "TARGET_STRING && ! TARGET_POWER
11039 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
11040 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
11041 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
11042 && REGNO (operands[4]) == 5"
11043 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
11044 [(set_attr "type" "store_ux")
11045 (set_attr "cell_micro" "always")
11046 (set_attr "length" "8")])
11048 ;; Move up to 16 bytes at a time, using 4 fixed registers to avoid spill
11049 ;; problems with TImode.
11050 ;; rD/rS = r5 is preferred, efficient form.
11051 (define_expand "movmemsi_4reg"
11052 [(parallel [(set (match_operand 0 "" "")
11053 (match_operand 1 "" ""))
11054 (use (match_operand 2 "" ""))
11055 (use (match_operand 3 "" ""))
11056 (clobber (reg:SI 5))
11057 (clobber (reg:SI 6))
11058 (clobber (reg:SI 7))
11059 (clobber (reg:SI 8))
11060 (clobber (match_scratch:SI 4 ""))])]
11065 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
11066 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
11067 (use (match_operand:SI 2 "immediate_operand" "i"))
11068 (use (match_operand:SI 3 "immediate_operand" "i"))
11069 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
11070 (clobber (reg:SI 6))
11071 (clobber (reg:SI 7))
11072 (clobber (reg:SI 8))
11073 (clobber (match_scratch:SI 5 "=q"))]
11074 "TARGET_STRING && TARGET_POWER
11075 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
11076 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
11077 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
11078 && REGNO (operands[4]) == 5"
11079 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
11080 [(set_attr "type" "store_ux")
11081 (set_attr "cell_micro" "always")
11082 (set_attr "length" "8")])
11085 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
11086 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
11087 (use (match_operand:SI 2 "immediate_operand" "i"))
11088 (use (match_operand:SI 3 "immediate_operand" "i"))
11089 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
11090 (clobber (reg:SI 6))
11091 (clobber (reg:SI 7))
11092 (clobber (reg:SI 8))
11093 (clobber (match_scratch:SI 5 "=X"))]
11094 "TARGET_STRING && ! TARGET_POWER
11095 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
11096 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
11097 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
11098 && REGNO (operands[4]) == 5"
11099 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
11100 [(set_attr "type" "store_ux")
11101 (set_attr "cell_micro" "always")
11102 (set_attr "length" "8")])
11104 ;; Move up to 8 bytes at a time.
11105 (define_expand "movmemsi_2reg"
11106 [(parallel [(set (match_operand 0 "" "")
11107 (match_operand 1 "" ""))
11108 (use (match_operand 2 "" ""))
11109 (use (match_operand 3 "" ""))
11110 (clobber (match_scratch:DI 4 ""))
11111 (clobber (match_scratch:SI 5 ""))])]
11112 "TARGET_STRING && ! TARGET_POWERPC64"
11116 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
11117 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
11118 (use (match_operand:SI 2 "immediate_operand" "i"))
11119 (use (match_operand:SI 3 "immediate_operand" "i"))
11120 (clobber (match_scratch:DI 4 "=&r"))
11121 (clobber (match_scratch:SI 5 "=q"))]
11122 "TARGET_STRING && TARGET_POWER && ! TARGET_POWERPC64
11123 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
11124 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
11125 [(set_attr "type" "store_ux")
11126 (set_attr "cell_micro" "always")
11127 (set_attr "length" "8")])
11130 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
11131 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
11132 (use (match_operand:SI 2 "immediate_operand" "i"))
11133 (use (match_operand:SI 3 "immediate_operand" "i"))
11134 (clobber (match_scratch:DI 4 "=&r"))
11135 (clobber (match_scratch:SI 5 "=X"))]
11136 "TARGET_STRING && ! TARGET_POWER && ! TARGET_POWERPC64
11137 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
11138 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
11139 [(set_attr "type" "store_ux")
11140 (set_attr "cell_micro" "always")
11141 (set_attr "length" "8")])
11143 ;; Move up to 4 bytes at a time.
11144 (define_expand "movmemsi_1reg"
11145 [(parallel [(set (match_operand 0 "" "")
11146 (match_operand 1 "" ""))
11147 (use (match_operand 2 "" ""))
11148 (use (match_operand 3 "" ""))
11149 (clobber (match_scratch:SI 4 ""))
11150 (clobber (match_scratch:SI 5 ""))])]
11155 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
11156 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
11157 (use (match_operand:SI 2 "immediate_operand" "i"))
11158 (use (match_operand:SI 3 "immediate_operand" "i"))
11159 (clobber (match_scratch:SI 4 "=&r"))
11160 (clobber (match_scratch:SI 5 "=q"))]
11161 "TARGET_STRING && TARGET_POWER
11162 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
11163 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
11164 [(set_attr "type" "store_ux")
11165 (set_attr "cell_micro" "always")
11166 (set_attr "length" "8")])
11169 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
11170 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
11171 (use (match_operand:SI 2 "immediate_operand" "i"))
11172 (use (match_operand:SI 3 "immediate_operand" "i"))
11173 (clobber (match_scratch:SI 4 "=&r"))
11174 (clobber (match_scratch:SI 5 "=X"))]
11175 "TARGET_STRING && ! TARGET_POWER
11176 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
11177 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
11178 [(set_attr "type" "store_ux")
11179 (set_attr "cell_micro" "always")
11180 (set_attr "length" "8")])
11182 ;; Define insns that do load or store with update. Some of these we can
11183 ;; get by using pre-decrement or pre-increment, but the hardware can also
11184 ;; do cases where the increment is not the size of the object.
11186 ;; In all these cases, we use operands 0 and 1 for the register being
11187 ;; incremented because those are the operands that local-alloc will
11188 ;; tie and these are the pair most likely to be tieable (and the ones
11189 ;; that will benefit the most).
11191 (define_insn "*movdi_update1"
11192 [(set (match_operand:DI 3 "gpc_reg_operand" "=r,r")
11193 (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
11194 (match_operand:DI 2 "reg_or_aligned_short_operand" "r,I"))))
11195 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
11196 (plus:DI (match_dup 1) (match_dup 2)))]
11197 "TARGET_POWERPC64 && TARGET_UPDATE
11198 && (!avoiding_indexed_address_p (DImode)
11199 || !gpc_reg_operand (operands[2], DImode))"
11203 [(set_attr "type" "load_ux,load_u")])
11205 (define_insn "movdi_<mode>_update"
11206 [(set (mem:DI (plus:P (match_operand:P 1 "gpc_reg_operand" "0,0")
11207 (match_operand:P 2 "reg_or_aligned_short_operand" "r,I")))
11208 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
11209 (set (match_operand:P 0 "gpc_reg_operand" "=b,b")
11210 (plus:P (match_dup 1) (match_dup 2)))]
11211 "TARGET_POWERPC64 && TARGET_UPDATE
11212 && (!avoiding_indexed_address_p (Pmode)
11213 || !gpc_reg_operand (operands[2], Pmode)
11214 || (REG_P (operands[0])
11215 && REGNO (operands[0]) == STACK_POINTER_REGNUM))"
11219 [(set_attr "type" "store_ux,store_u")])
11221 ;; This pattern is only conditional on TARGET_POWERPC64, as it is
11222 ;; needed for stack allocation, even if the user passes -mno-update.
11223 (define_insn "movdi_<mode>_update_stack"
11224 [(set (mem:DI (plus:P (match_operand:P 1 "gpc_reg_operand" "0,0")
11225 (match_operand:P 2 "reg_or_aligned_short_operand" "r,I")))
11226 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
11227 (set (match_operand:P 0 "gpc_reg_operand" "=b,b")
11228 (plus:P (match_dup 1) (match_dup 2)))]
11233 [(set_attr "type" "store_ux,store_u")])
11235 (define_insn "*movsi_update1"
11236 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
11237 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11238 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
11239 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11240 (plus:SI (match_dup 1) (match_dup 2)))]
11242 && (!avoiding_indexed_address_p (SImode)
11243 || !gpc_reg_operand (operands[2], SImode))"
11245 {lux|lwzux} %3,%0,%2
11246 {lu|lwzu} %3,%2(%0)"
11247 [(set_attr "type" "load_ux,load_u")])
11249 (define_insn "*movsi_update2"
11250 [(set (match_operand:DI 3 "gpc_reg_operand" "=r")
11252 (mem:SI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0")
11253 (match_operand:DI 2 "gpc_reg_operand" "r")))))
11254 (set (match_operand:DI 0 "gpc_reg_operand" "=b")
11255 (plus:DI (match_dup 1) (match_dup 2)))]
11256 "TARGET_POWERPC64 && rs6000_gen_cell_microcode
11257 && !avoiding_indexed_address_p (DImode)"
11259 [(set_attr "type" "load_ext_ux")])
11261 (define_insn "movsi_update"
11262 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11263 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
11264 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
11265 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11266 (plus:SI (match_dup 1) (match_dup 2)))]
11268 && (!avoiding_indexed_address_p (SImode)
11269 || !gpc_reg_operand (operands[2], SImode)
11270 || (REG_P (operands[0])
11271 && REGNO (operands[0]) == STACK_POINTER_REGNUM))"
11273 {stux|stwux} %3,%0,%2
11274 {stu|stwu} %3,%2(%0)"
11275 [(set_attr "type" "store_ux,store_u")])
11277 ;; This is an unconditional pattern; needed for stack allocation, even
11278 ;; if the user passes -mno-update.
11279 (define_insn "movsi_update_stack"
11280 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11281 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
11282 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
11283 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11284 (plus:SI (match_dup 1) (match_dup 2)))]
11287 {stux|stwux} %3,%0,%2
11288 {stu|stwu} %3,%2(%0)"
11289 [(set_attr "type" "store_ux,store_u")])
11291 (define_insn "*movhi_update1"
11292 [(set (match_operand:HI 3 "gpc_reg_operand" "=r,r")
11293 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11294 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
11295 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11296 (plus:SI (match_dup 1) (match_dup 2)))]
11298 && (!avoiding_indexed_address_p (SImode)
11299 || !gpc_reg_operand (operands[2], SImode))"
11303 [(set_attr "type" "load_ux,load_u")])
11305 (define_insn "*movhi_update2"
11306 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
11308 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11309 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
11310 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11311 (plus:SI (match_dup 1) (match_dup 2)))]
11313 && (!avoiding_indexed_address_p (SImode)
11314 || !gpc_reg_operand (operands[2], SImode))"
11318 [(set_attr "type" "load_ux,load_u")])
11320 (define_insn "*movhi_update3"
11321 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
11323 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11324 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
11325 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11326 (plus:SI (match_dup 1) (match_dup 2)))]
11327 "TARGET_UPDATE && rs6000_gen_cell_microcode
11328 && (!avoiding_indexed_address_p (SImode)
11329 || !gpc_reg_operand (operands[2], SImode))"
11333 [(set_attr "type" "load_ext_ux,load_ext_u")])
11335 (define_insn "*movhi_update4"
11336 [(set (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11337 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
11338 (match_operand:HI 3 "gpc_reg_operand" "r,r"))
11339 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11340 (plus:SI (match_dup 1) (match_dup 2)))]
11342 && (!avoiding_indexed_address_p (SImode)
11343 || !gpc_reg_operand (operands[2], SImode))"
11347 [(set_attr "type" "store_ux,store_u")])
11349 (define_insn "*movqi_update1"
11350 [(set (match_operand:QI 3 "gpc_reg_operand" "=r,r")
11351 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11352 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
11353 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11354 (plus:SI (match_dup 1) (match_dup 2)))]
11356 && (!avoiding_indexed_address_p (SImode)
11357 || !gpc_reg_operand (operands[2], SImode))"
11361 [(set_attr "type" "load_ux,load_u")])
11363 (define_insn "*movqi_update2"
11364 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
11366 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11367 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
11368 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11369 (plus:SI (match_dup 1) (match_dup 2)))]
11371 && (!avoiding_indexed_address_p (SImode)
11372 || !gpc_reg_operand (operands[2], SImode))"
11376 [(set_attr "type" "load_ux,load_u")])
11378 (define_insn "*movqi_update3"
11379 [(set (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11380 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
11381 (match_operand:QI 3 "gpc_reg_operand" "r,r"))
11382 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11383 (plus:SI (match_dup 1) (match_dup 2)))]
11385 && (!avoiding_indexed_address_p (SImode)
11386 || !gpc_reg_operand (operands[2], SImode))"
11390 [(set_attr "type" "store_ux,store_u")])
11392 (define_insn "*movsf_update1"
11393 [(set (match_operand:SF 3 "gpc_reg_operand" "=f,f")
11394 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11395 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
11396 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11397 (plus:SI (match_dup 1) (match_dup 2)))]
11398 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT && TARGET_UPDATE
11399 && (!avoiding_indexed_address_p (SImode)
11400 || !gpc_reg_operand (operands[2], SImode))"
11404 [(set_attr "type" "fpload_ux,fpload_u")])
11406 (define_insn "*movsf_update2"
11407 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11408 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
11409 (match_operand:SF 3 "gpc_reg_operand" "f,f"))
11410 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11411 (plus:SI (match_dup 1) (match_dup 2)))]
11412 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT && TARGET_UPDATE
11413 && (!avoiding_indexed_address_p (SImode)
11414 || !gpc_reg_operand (operands[2], SImode))"
11418 [(set_attr "type" "fpstore_ux,fpstore_u")])
11420 (define_insn "*movsf_update3"
11421 [(set (match_operand:SF 3 "gpc_reg_operand" "=r,r")
11422 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11423 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
11424 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11425 (plus:SI (match_dup 1) (match_dup 2)))]
11426 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE
11427 && (!avoiding_indexed_address_p (SImode)
11428 || !gpc_reg_operand (operands[2], SImode))"
11430 {lux|lwzux} %3,%0,%2
11431 {lu|lwzu} %3,%2(%0)"
11432 [(set_attr "type" "load_ux,load_u")])
11434 (define_insn "*movsf_update4"
11435 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11436 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
11437 (match_operand:SF 3 "gpc_reg_operand" "r,r"))
11438 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11439 (plus:SI (match_dup 1) (match_dup 2)))]
11440 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE
11441 && (!avoiding_indexed_address_p (SImode)
11442 || !gpc_reg_operand (operands[2], SImode))"
11444 {stux|stwux} %3,%0,%2
11445 {stu|stwu} %3,%2(%0)"
11446 [(set_attr "type" "store_ux,store_u")])
11448 (define_insn "*movdf_update1"
11449 [(set (match_operand:DF 3 "gpc_reg_operand" "=d,d")
11450 (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11451 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
11452 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11453 (plus:SI (match_dup 1) (match_dup 2)))]
11454 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_UPDATE
11455 && (!avoiding_indexed_address_p (SImode)
11456 || !gpc_reg_operand (operands[2], SImode))"
11460 [(set_attr "type" "fpload_ux,fpload_u")])
11462 (define_insn "*movdf_update2"
11463 [(set (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11464 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
11465 (match_operand:DF 3 "gpc_reg_operand" "d,d"))
11466 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11467 (plus:SI (match_dup 1) (match_dup 2)))]
11468 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_UPDATE
11469 && (!avoiding_indexed_address_p (SImode)
11470 || !gpc_reg_operand (operands[2], SImode))"
11474 [(set_attr "type" "fpstore_ux,fpstore_u")])
11476 ;; Peephole to convert two consecutive FP loads or stores into lfq/stfq.
11478 (define_insn "*lfq_power2"
11479 [(set (match_operand:V2DF 0 "gpc_reg_operand" "=f")
11480 (match_operand:V2DF 1 "memory_operand" ""))]
11482 && TARGET_HARD_FLOAT && TARGET_FPRS"
11486 [(set (match_operand:DF 0 "gpc_reg_operand" "")
11487 (match_operand:DF 1 "memory_operand" ""))
11488 (set (match_operand:DF 2 "gpc_reg_operand" "")
11489 (match_operand:DF 3 "memory_operand" ""))]
11491 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
11492 && registers_ok_for_quad_peep (operands[0], operands[2])
11493 && mems_ok_for_quad_peep (operands[1], operands[3])"
11494 [(set (match_dup 0)
11496 "operands[1] = widen_memory_access (operands[1], V2DFmode, 0);
11497 operands[0] = gen_rtx_REG (V2DFmode, REGNO (operands[0]));")
11499 (define_insn "*stfq_power2"
11500 [(set (match_operand:V2DF 0 "memory_operand" "")
11501 (match_operand:V2DF 1 "gpc_reg_operand" "f"))]
11503 && TARGET_HARD_FLOAT && TARGET_FPRS"
11504 "stfq%U0%X0 %1,%0")
11508 [(set (match_operand:DF 0 "memory_operand" "")
11509 (match_operand:DF 1 "gpc_reg_operand" ""))
11510 (set (match_operand:DF 2 "memory_operand" "")
11511 (match_operand:DF 3 "gpc_reg_operand" ""))]
11513 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
11514 && registers_ok_for_quad_peep (operands[1], operands[3])
11515 && mems_ok_for_quad_peep (operands[0], operands[2])"
11516 [(set (match_dup 0)
11518 "operands[0] = widen_memory_access (operands[0], V2DFmode, 0);
11519 operands[1] = gen_rtx_REG (V2DFmode, REGNO (operands[1]));")
11521 ;; After inserting conditional returns we can sometimes have
11522 ;; unnecessary register moves. Unfortunately we cannot have a
11523 ;; modeless peephole here, because some single SImode sets have early
11524 ;; clobber outputs. Although those sets expand to multi-ppc-insn
11525 ;; sequences, using get_attr_length here will smash the operands
11526 ;; array. Neither is there an early_cobbler_p predicate.
11527 ;; Disallow subregs for E500 so we don't munge frob_di_df_2.
11529 [(set (match_operand:DF 0 "gpc_reg_operand" "")
11530 (match_operand:DF 1 "any_operand" ""))
11531 (set (match_operand:DF 2 "gpc_reg_operand" "")
11533 "!(TARGET_E500_DOUBLE && GET_CODE (operands[2]) == SUBREG)
11534 && peep2_reg_dead_p (2, operands[0])"
11535 [(set (match_dup 2) (match_dup 1))])
11538 [(set (match_operand:SF 0 "gpc_reg_operand" "")
11539 (match_operand:SF 1 "any_operand" ""))
11540 (set (match_operand:SF 2 "gpc_reg_operand" "")
11542 "peep2_reg_dead_p (2, operands[0])"
11543 [(set (match_dup 2) (match_dup 1))])
11548 ;; Mode attributes for different ABIs.
11549 (define_mode_iterator TLSmode [(SI "! TARGET_64BIT") (DI "TARGET_64BIT")])
11550 (define_mode_attr tls_abi_suffix [(SI "32") (DI "64")])
11551 (define_mode_attr tls_sysv_suffix [(SI "si") (DI "di")])
11552 (define_mode_attr tls_insn_suffix [(SI "wz") (DI "d")])
11554 (define_insn_and_split "tls_gd_aix<TLSmode:tls_abi_suffix>"
11555 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11556 (call (mem:TLSmode (match_operand:TLSmode 3 "symbol_ref_operand" "s"))
11557 (match_operand 4 "" "g")))
11558 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11559 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11561 (clobber (reg:SI LR_REGNO))]
11562 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX"
11564 if (TARGET_CMODEL != CMODEL_SMALL)
11565 return "addis %0,%1,%2@got@tlsgd@ha\;addi %0,%0,%2@got@tlsgd@l\;bl %z3\;%.";
11567 return "addi %0,%1,%2@got@tlsgd\;bl %z3\;%.";
11569 "&& TARGET_TLS_MARKERS"
11570 [(set (match_dup 0)
11571 (unspec:TLSmode [(match_dup 1)
11574 (parallel [(set (match_dup 0)
11575 (call (mem:TLSmode (match_dup 3))
11577 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD)
11578 (clobber (reg:SI LR_REGNO))])]
11580 [(set_attr "type" "two")
11581 (set (attr "length")
11582 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
11586 (define_insn_and_split "tls_gd_sysv<TLSmode:tls_sysv_suffix>"
11587 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11588 (call (mem:TLSmode (match_operand:TLSmode 3 "symbol_ref_operand" "s"))
11589 (match_operand 4 "" "g")))
11590 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11591 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11593 (clobber (reg:SI LR_REGNO))]
11594 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4"
11598 if (TARGET_SECURE_PLT && flag_pic == 2)
11599 return "addi %0,%1,%2@got@tlsgd\;bl %z3+32768@plt";
11601 return "addi %0,%1,%2@got@tlsgd\;bl %z3@plt";
11604 return "addi %0,%1,%2@got@tlsgd\;bl %z3";
11606 "&& TARGET_TLS_MARKERS"
11607 [(set (match_dup 0)
11608 (unspec:TLSmode [(match_dup 1)
11611 (parallel [(set (match_dup 0)
11612 (call (mem:TLSmode (match_dup 3))
11614 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD)
11615 (clobber (reg:SI LR_REGNO))])]
11617 [(set_attr "type" "two")
11618 (set_attr "length" "8")])
11620 (define_insn_and_split "*tls_gd<TLSmode:tls_abi_suffix>"
11621 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11622 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11623 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11625 "HAVE_AS_TLS && TARGET_TLS_MARKERS"
11626 "addi %0,%1,%2@got@tlsgd"
11627 "&& TARGET_CMODEL != CMODEL_SMALL"
11628 [(set (match_dup 3)
11629 (plus:TLSmode (match_dup 1)
11631 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD))))
11633 (lo_sum:TLSmode (match_dup 3)
11634 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD)))]
11637 operands[3] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
11639 [(set (attr "length")
11640 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
11644 (define_insn "*tls_gd_high<TLSmode:tls_abi_suffix>"
11645 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11646 (plus:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11648 (unspec:TLSmode [(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11650 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
11651 "addis %0,%1,%2@got@tlsgd@ha"
11652 [(set_attr "length" "4")])
11654 (define_insn "*tls_gd_low<TLSmode:tls_abi_suffix>"
11655 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11656 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11657 (unspec:TLSmode [(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11659 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
11660 "addi %0,%1,%2@got@tlsgd@l"
11661 [(set_attr "length" "4")])
11663 (define_insn "*tls_gd_call_aix<TLSmode:tls_abi_suffix>"
11664 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11665 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
11666 (match_operand 2 "" "g")))
11667 (unspec:TLSmode [(match_operand:TLSmode 3 "rs6000_tls_symbol_ref" "")]
11669 (clobber (reg:SI LR_REGNO))]
11670 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX && TARGET_TLS_MARKERS"
11671 "bl %z1(%3@tlsgd)\;%."
11672 [(set_attr "type" "branch")
11673 (set_attr "length" "8")])
11675 (define_insn "*tls_gd_call_sysv<TLSmode:tls_abi_suffix>"
11676 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11677 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
11678 (match_operand 2 "" "g")))
11679 (unspec:TLSmode [(match_operand:TLSmode 3 "rs6000_tls_symbol_ref" "")]
11681 (clobber (reg:SI LR_REGNO))]
11682 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4 && TARGET_TLS_MARKERS"
11686 if (TARGET_SECURE_PLT && flag_pic == 2)
11687 return "bl %z1+32768(%3@tlsgd)@plt";
11688 return "bl %z1(%3@tlsgd)@plt";
11690 return "bl %z1(%3@tlsgd)";
11692 [(set_attr "type" "branch")
11693 (set_attr "length" "4")])
11695 (define_insn_and_split "tls_ld_aix<TLSmode:tls_abi_suffix>"
11696 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11697 (call (mem:TLSmode (match_operand:TLSmode 2 "symbol_ref_operand" "s"))
11698 (match_operand 3 "" "g")))
11699 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
11701 (clobber (reg:SI LR_REGNO))]
11702 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX"
11704 if (TARGET_CMODEL != CMODEL_SMALL)
11705 return "addis %0,%1,%&@got@tlsld@ha\;addi %0,%0,%&@got@tlsld@l\;bl %z2\;%.";
11707 return "addi %0,%1,%&@got@tlsld\;bl %z2\;%.";
11709 "&& TARGET_TLS_MARKERS"
11710 [(set (match_dup 0)
11711 (unspec:TLSmode [(match_dup 1)]
11713 (parallel [(set (match_dup 0)
11714 (call (mem:TLSmode (match_dup 2))
11716 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
11717 (clobber (reg:SI LR_REGNO))])]
11719 [(set_attr "type" "two")
11720 (set (attr "length")
11721 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
11725 (define_insn_and_split "tls_ld_sysv<TLSmode:tls_sysv_suffix>"
11726 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11727 (call (mem:TLSmode (match_operand:TLSmode 2 "symbol_ref_operand" "s"))
11728 (match_operand 3 "" "g")))
11729 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
11731 (clobber (reg:SI LR_REGNO))]
11732 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4"
11736 if (TARGET_SECURE_PLT && flag_pic == 2)
11737 return "addi %0,%1,%&@got@tlsld\;bl %z2+32768@plt";
11739 return "addi %0,%1,%&@got@tlsld\;bl %z2@plt";
11742 return "addi %0,%1,%&@got@tlsld\;bl %z2";
11744 "&& TARGET_TLS_MARKERS"
11745 [(set (match_dup 0)
11746 (unspec:TLSmode [(match_dup 1)]
11748 (parallel [(set (match_dup 0)
11749 (call (mem:TLSmode (match_dup 2))
11751 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
11752 (clobber (reg:SI LR_REGNO))])]
11754 [(set_attr "length" "8")])
11756 (define_insn_and_split "*tls_ld<TLSmode:tls_abi_suffix>"
11757 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11758 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
11760 "HAVE_AS_TLS && TARGET_TLS_MARKERS"
11761 "addi %0,%1,%&@got@tlsld"
11762 "&& TARGET_CMODEL != CMODEL_SMALL"
11763 [(set (match_dup 2)
11764 (plus:TLSmode (match_dup 1)
11766 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD))))
11768 (lo_sum:TLSmode (match_dup 2)
11769 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)))]
11772 operands[2] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
11774 [(set (attr "length")
11775 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
11779 (define_insn "*tls_ld_high<TLSmode:tls_abi_suffix>"
11780 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11781 (plus:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11783 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD))))]
11784 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
11785 "addis %0,%1,%&@got@tlsld@ha"
11786 [(set_attr "length" "4")])
11788 (define_insn "*tls_ld_low<TLSmode:tls_abi_suffix>"
11789 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11790 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11791 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)))]
11792 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
11793 "addi %0,%1,%&@got@tlsld@l"
11794 [(set_attr "length" "4")])
11796 (define_insn "*tls_ld_call_aix<TLSmode:tls_abi_suffix>"
11797 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11798 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
11799 (match_operand 2 "" "g")))
11800 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
11801 (clobber (reg:SI LR_REGNO))]
11802 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX && TARGET_TLS_MARKERS"
11803 "bl %z1(%&@tlsld)\;%."
11804 [(set_attr "type" "branch")
11805 (set_attr "length" "8")])
11807 (define_insn "*tls_ld_call_sysv<TLSmode:tls_abi_suffix>"
11808 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11809 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
11810 (match_operand 2 "" "g")))
11811 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
11812 (clobber (reg:SI LR_REGNO))]
11813 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4 && TARGET_TLS_MARKERS"
11817 if (TARGET_SECURE_PLT && flag_pic == 2)
11818 return "bl %z1+32768(%&@tlsld)@plt";
11819 return "bl %z1(%&@tlsld)@plt";
11821 return "bl %z1(%&@tlsld)";
11823 [(set_attr "type" "branch")
11824 (set_attr "length" "4")])
11826 (define_insn "tls_dtprel_<TLSmode:tls_abi_suffix>"
11827 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11828 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11829 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11830 UNSPEC_TLSDTPREL))]
11832 "addi %0,%1,%2@dtprel")
11834 (define_insn "tls_dtprel_ha_<TLSmode:tls_abi_suffix>"
11835 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11836 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11837 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11838 UNSPEC_TLSDTPRELHA))]
11840 "addis %0,%1,%2@dtprel@ha")
11842 (define_insn "tls_dtprel_lo_<TLSmode:tls_abi_suffix>"
11843 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11844 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11845 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11846 UNSPEC_TLSDTPRELLO))]
11848 "addi %0,%1,%2@dtprel@l")
11850 (define_insn_and_split "tls_got_dtprel_<TLSmode:tls_abi_suffix>"
11851 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11852 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11853 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11854 UNSPEC_TLSGOTDTPREL))]
11856 "l<TLSmode:tls_insn_suffix> %0,%2@got@dtprel(%1)"
11857 "&& TARGET_CMODEL != CMODEL_SMALL"
11858 [(set (match_dup 3)
11859 (plus:TLSmode (match_dup 1)
11861 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGOTDTPREL))))
11863 (lo_sum:TLSmode (match_dup 3)
11864 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGOTDTPREL)))]
11867 operands[3] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
11869 [(set (attr "length")
11870 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
11874 (define_insn "*tls_got_dtprel_high<TLSmode:tls_abi_suffix>"
11875 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11876 (plus:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11878 (unspec:TLSmode [(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11879 UNSPEC_TLSGOTDTPREL))))]
11880 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
11881 "addis %0,%1,%2@got@dtprel@ha"
11882 [(set_attr "length" "4")])
11884 (define_insn "*tls_got_dtprel_low<TLSmode:tls_abi_suffix>"
11885 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11886 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11887 (unspec:TLSmode [(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11888 UNSPEC_TLSGOTDTPREL)))]
11889 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
11890 "l<TLSmode:tls_insn_suffix> %0,%2@got@dtprel@l(%1)"
11891 [(set_attr "length" "4")])
11893 (define_insn "tls_tprel_<TLSmode:tls_abi_suffix>"
11894 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11895 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11896 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11899 "addi %0,%1,%2@tprel")
11901 (define_insn "tls_tprel_ha_<TLSmode:tls_abi_suffix>"
11902 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11903 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11904 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11905 UNSPEC_TLSTPRELHA))]
11907 "addis %0,%1,%2@tprel@ha")
11909 (define_insn "tls_tprel_lo_<TLSmode:tls_abi_suffix>"
11910 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11911 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11912 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11913 UNSPEC_TLSTPRELLO))]
11915 "addi %0,%1,%2@tprel@l")
11917 ;; "b" output constraint here and on tls_tls input to support linker tls
11918 ;; optimization. The linker may edit the instructions emitted by a
11919 ;; tls_got_tprel/tls_tls pair to addis,addi.
11920 (define_insn_and_split "tls_got_tprel_<TLSmode:tls_abi_suffix>"
11921 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11922 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11923 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11924 UNSPEC_TLSGOTTPREL))]
11926 "l<TLSmode:tls_insn_suffix> %0,%2@got@tprel(%1)"
11927 "&& TARGET_CMODEL != CMODEL_SMALL"
11928 [(set (match_dup 3)
11929 (plus:TLSmode (match_dup 1)
11931 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGOTTPREL))))
11933 (lo_sum:TLSmode (match_dup 3)
11934 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGOTTPREL)))]
11937 operands[3] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
11939 [(set (attr "length")
11940 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
11944 (define_insn "*tls_got_tprel_high<TLSmode:tls_abi_suffix>"
11945 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11946 (plus:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11948 (unspec:TLSmode [(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11949 UNSPEC_TLSGOTTPREL))))]
11950 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
11951 "addis %0,%1,%2@got@tprel@ha"
11952 [(set_attr "length" "4")])
11954 (define_insn "*tls_got_tprel_low<TLSmode:tls_abi_suffix>"
11955 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11956 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11957 (unspec:TLSmode [(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11958 UNSPEC_TLSGOTTPREL)))]
11959 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
11960 "l<TLSmode:tls_insn_suffix> %0,%2@got@tprel@l(%1)"
11961 [(set_attr "length" "4")])
11963 (define_insn "tls_tls_<TLSmode:tls_abi_suffix>"
11964 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11965 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11966 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11969 "add %0,%1,%2@tls")
11971 ;; Next come insns related to the calling sequence.
11973 ;; First, an insn to allocate new stack space for dynamic use (e.g., alloca).
11974 ;; We move the back-chain and decrement the stack pointer.
11976 (define_expand "allocate_stack"
11977 [(set (match_operand 0 "gpc_reg_operand" "")
11978 (minus (reg 1) (match_operand 1 "reg_or_short_operand" "")))
11980 (minus (reg 1) (match_dup 1)))]
11983 { rtx chain = gen_reg_rtx (Pmode);
11984 rtx stack_bot = gen_rtx_MEM (Pmode, stack_pointer_rtx);
11986 rtx insn, par, set, mem;
11988 emit_move_insn (chain, stack_bot);
11990 /* Check stack bounds if necessary. */
11991 if (crtl->limit_stack)
11994 available = expand_binop (Pmode, sub_optab,
11995 stack_pointer_rtx, stack_limit_rtx,
11996 NULL_RTX, 1, OPTAB_WIDEN);
11997 emit_insn (gen_cond_trap (LTU, available, operands[1], const0_rtx));
12000 if (GET_CODE (operands[1]) != CONST_INT
12001 || INTVAL (operands[1]) < -32767
12002 || INTVAL (operands[1]) > 32768)
12004 neg_op0 = gen_reg_rtx (Pmode);
12006 emit_insn (gen_negsi2 (neg_op0, operands[1]));
12008 emit_insn (gen_negdi2 (neg_op0, operands[1]));
12011 neg_op0 = GEN_INT (- INTVAL (operands[1]));
12013 insn = emit_insn ((* ((TARGET_32BIT) ? gen_movsi_update_stack
12014 : gen_movdi_di_update_stack))
12015 (stack_pointer_rtx, stack_pointer_rtx, neg_op0,
12017 /* Since we didn't use gen_frame_mem to generate the MEM, grab
12018 it now and set the alias set/attributes. The above gen_*_update
12019 calls will generate a PARALLEL with the MEM set being the first
12021 par = PATTERN (insn);
12022 gcc_assert (GET_CODE (par) == PARALLEL);
12023 set = XVECEXP (par, 0, 0);
12024 gcc_assert (GET_CODE (set) == SET);
12025 mem = SET_DEST (set);
12026 gcc_assert (MEM_P (mem));
12027 MEM_NOTRAP_P (mem) = 1;
12028 set_mem_alias_set (mem, get_frame_alias_set ());
12030 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
12034 ;; These patterns say how to save and restore the stack pointer. We need not
12035 ;; save the stack pointer at function level since we are careful to
12036 ;; preserve the backchain. At block level, we have to restore the backchain
12037 ;; when we restore the stack pointer.
12039 ;; For nonlocal gotos, we must save both the stack pointer and its
12040 ;; backchain and restore both. Note that in the nonlocal case, the
12041 ;; save area is a memory location.
12043 (define_expand "save_stack_function"
12044 [(match_operand 0 "any_operand" "")
12045 (match_operand 1 "any_operand" "")]
12049 (define_expand "restore_stack_function"
12050 [(match_operand 0 "any_operand" "")
12051 (match_operand 1 "any_operand" "")]
12055 ;; Adjust stack pointer (op0) to a new value (op1).
12056 ;; First copy old stack backchain to new location, and ensure that the
12057 ;; scheduler won't reorder the sp assignment before the backchain write.
12058 (define_expand "restore_stack_block"
12059 [(set (match_dup 2) (match_dup 3))
12060 (set (match_dup 4) (match_dup 2))
12061 (set (match_dup 5) (unspec:BLK [(match_dup 5)] UNSPEC_TIE))
12062 (set (match_operand 0 "register_operand" "")
12063 (match_operand 1 "register_operand" ""))]
12067 operands[1] = force_reg (Pmode, operands[1]);
12068 operands[2] = gen_reg_rtx (Pmode);
12069 operands[3] = gen_frame_mem (Pmode, operands[0]);
12070 operands[4] = gen_frame_mem (Pmode, operands[1]);
12071 operands[5] = gen_frame_mem (BLKmode, operands[0]);
12074 (define_expand "save_stack_nonlocal"
12075 [(set (match_dup 3) (match_dup 4))
12076 (set (match_operand 0 "memory_operand" "") (match_dup 3))
12077 (set (match_dup 2) (match_operand 1 "register_operand" ""))]
12081 int units_per_word = (TARGET_32BIT) ? 4 : 8;
12083 /* Copy the backchain to the first word, sp to the second. */
12084 operands[0] = adjust_address_nv (operands[0], Pmode, 0);
12085 operands[2] = adjust_address_nv (operands[0], Pmode, units_per_word);
12086 operands[3] = gen_reg_rtx (Pmode);
12087 operands[4] = gen_frame_mem (Pmode, operands[1]);
12090 (define_expand "restore_stack_nonlocal"
12091 [(set (match_dup 2) (match_operand 1 "memory_operand" ""))
12092 (set (match_dup 3) (match_dup 4))
12093 (set (match_dup 5) (match_dup 2))
12094 (set (match_dup 6) (unspec:BLK [(match_dup 6)] UNSPEC_TIE))
12095 (set (match_operand 0 "register_operand" "") (match_dup 3))]
12099 int units_per_word = (TARGET_32BIT) ? 4 : 8;
12101 /* Restore the backchain from the first word, sp from the second. */
12102 operands[2] = gen_reg_rtx (Pmode);
12103 operands[3] = gen_reg_rtx (Pmode);
12104 operands[1] = adjust_address_nv (operands[1], Pmode, 0);
12105 operands[4] = adjust_address_nv (operands[1], Pmode, units_per_word);
12106 operands[5] = gen_frame_mem (Pmode, operands[3]);
12107 operands[6] = gen_frame_mem (BLKmode, operands[0]);
12110 ;; TOC register handling.
12112 ;; Code to initialize the TOC register...
12114 (define_insn "load_toc_aix_si"
12115 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12116 (unspec:SI [(const_int 0)] UNSPEC_TOC))
12117 (use (reg:SI 2))])]
12118 "DEFAULT_ABI == ABI_AIX && TARGET_32BIT"
12122 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
12123 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
12124 operands[2] = gen_rtx_REG (Pmode, 2);
12125 return \"{l|lwz} %0,%1(%2)\";
12127 [(set_attr "type" "load")])
12129 (define_insn "load_toc_aix_di"
12130 [(parallel [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12131 (unspec:DI [(const_int 0)] UNSPEC_TOC))
12132 (use (reg:DI 2))])]
12133 "DEFAULT_ABI == ABI_AIX && TARGET_64BIT"
12137 #ifdef TARGET_RELOCATABLE
12138 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\",
12139 !TARGET_MINIMAL_TOC || TARGET_RELOCATABLE);
12141 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
12144 strcat (buf, \"@toc\");
12145 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
12146 operands[2] = gen_rtx_REG (Pmode, 2);
12147 return \"ld %0,%1(%2)\";
12149 [(set_attr "type" "load")])
12151 (define_insn "load_toc_v4_pic_si"
12152 [(set (reg:SI LR_REGNO)
12153 (unspec:SI [(const_int 0)] UNSPEC_TOC))]
12154 "DEFAULT_ABI == ABI_V4 && flag_pic == 1 && TARGET_32BIT"
12155 "bl _GLOBAL_OFFSET_TABLE_@local-4"
12156 [(set_attr "type" "branch")
12157 (set_attr "length" "4")])
12159 (define_insn "load_toc_v4_PIC_1"
12160 [(set (reg:SI LR_REGNO)
12161 (match_operand:SI 0 "immediate_operand" "s"))
12162 (use (unspec [(match_dup 0)] UNSPEC_TOC))]
12163 "TARGET_ELF && DEFAULT_ABI != ABI_AIX
12164 && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
12165 "bcl 20,31,%0\\n%0:"
12166 [(set_attr "type" "branch")
12167 (set_attr "length" "4")])
12169 (define_insn "load_toc_v4_PIC_1b"
12170 [(set (reg:SI LR_REGNO)
12171 (unspec:SI [(match_operand:SI 0 "immediate_operand" "s")
12172 (label_ref (match_operand 1 "" ""))]
12175 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
12176 "bcl 20,31,$+8\;.long %0-$"
12177 [(set_attr "type" "branch")
12178 (set_attr "length" "8")])
12180 (define_insn "load_toc_v4_PIC_2"
12181 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12182 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
12183 (minus:SI (match_operand:SI 2 "immediate_operand" "s")
12184 (match_operand:SI 3 "immediate_operand" "s")))))]
12185 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
12186 "{l|lwz} %0,%2-%3(%1)"
12187 [(set_attr "type" "load")])
12189 (define_insn "load_toc_v4_PIC_3b"
12190 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
12191 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12193 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
12194 (match_operand:SI 3 "symbol_ref_operand" "s")))))]
12195 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
12196 "{cau|addis} %0,%1,%2-%3@ha")
12198 (define_insn "load_toc_v4_PIC_3c"
12199 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12200 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
12201 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
12202 (match_operand:SI 3 "symbol_ref_operand" "s"))))]
12203 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
12204 "{cal %0,%2-%3@l(%1)|addi %0,%1,%2-%3@l}")
12206 ;; If the TOC is shared over a translation unit, as happens with all
12207 ;; the kinds of PIC that we support, we need to restore the TOC
12208 ;; pointer only when jumping over units of translation.
12209 ;; On Darwin, we need to reload the picbase.
12211 (define_expand "builtin_setjmp_receiver"
12212 [(use (label_ref (match_operand 0 "" "")))]
12213 "(DEFAULT_ABI == ABI_V4 && flag_pic == 1)
12214 || (TARGET_TOC && TARGET_MINIMAL_TOC)
12215 || (DEFAULT_ABI == ABI_DARWIN && flag_pic)"
12219 if (DEFAULT_ABI == ABI_DARWIN)
12221 rtx picrtx = gen_rtx_SYMBOL_REF (Pmode, MACHOPIC_FUNCTION_BASE_NAME);
12222 rtx picreg = gen_rtx_REG (Pmode, RS6000_PIC_OFFSET_TABLE_REGNUM);
12226 crtl->uses_pic_offset_table = 1;
12227 ASM_GENERATE_INTERNAL_LABEL(tmplab, \"LSJR\",
12228 CODE_LABEL_NUMBER (operands[0]));
12229 tmplabrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (tmplab));
12231 emit_insn (gen_load_macho_picbase (tmplabrtx));
12232 emit_move_insn (picreg, gen_rtx_REG (Pmode, LR_REGNO));
12233 emit_insn (gen_macho_correct_pic (picreg, picreg, picrtx, tmplabrtx));
12237 rs6000_emit_load_toc_table (FALSE);
12241 ;; Elf specific ways of loading addresses for non-PIC code.
12242 ;; The output of this could be r0, but we make a very strong
12243 ;; preference for a base register because it will usually
12244 ;; be needed there.
12245 (define_insn "elf_high"
12246 [(set (match_operand:SI 0 "gpc_reg_operand" "=b*r")
12247 (high:SI (match_operand 1 "" "")))]
12248 "TARGET_ELF && ! TARGET_64BIT"
12249 "{liu|lis} %0,%1@ha")
12251 (define_insn "elf_low"
12252 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12253 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,!*r")
12254 (match_operand 2 "" "")))]
12255 "TARGET_ELF && ! TARGET_64BIT"
12257 {cal|la} %0,%2@l(%1)
12258 {ai|addic} %0,%1,%K2")
12260 ;; Largetoc support
12261 (define_insn "largetoc_high"
12262 [(set (match_operand:DI 0 "gpc_reg_operand" "=b")
12263 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "b")
12264 (high:DI (match_operand:DI 2 "" ""))))]
12265 "TARGET_ELF && TARGET_CMODEL != CMODEL_SMALL"
12266 "{cau|addis} %0,%1,%2@ha")
12268 (define_insn "largetoc_low"
12269 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12270 (lo_sum:DI (match_operand:DI 1 "gpc_reg_operand" "b")
12271 (match_operand:DI 2 "" "")))]
12272 "TARGET_ELF && TARGET_CMODEL != CMODEL_SMALL"
12273 "{cal %0,%2@l(%1)|addi %0,%1,%2@l}")
12275 ;; A function pointer under AIX is a pointer to a data area whose first word
12276 ;; contains the actual address of the function, whose second word contains a
12277 ;; pointer to its TOC, and whose third word contains a value to place in the
12278 ;; static chain register (r11). Note that if we load the static chain, our
12279 ;; "trampoline" need not have any executable code.
12281 (define_expand "call_indirect_aix32"
12282 [(set (match_dup 2)
12283 (mem:SI (match_operand:SI 0 "gpc_reg_operand" "")))
12284 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
12287 (mem:SI (plus:SI (match_dup 0)
12289 (parallel [(call (mem:SI (match_dup 2))
12290 (match_operand 1 "" ""))
12291 (use (mem:SI (plus:SI (match_dup 0) (const_int 4))))
12293 (use (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
12294 (clobber (reg:SI LR_REGNO))])]
12297 { operands[2] = gen_reg_rtx (SImode); }")
12299 (define_expand "call_indirect_aix64"
12300 [(set (match_dup 2)
12301 (mem:DI (match_operand:DI 0 "gpc_reg_operand" "")))
12302 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
12305 (mem:DI (plus:DI (match_dup 0)
12307 (parallel [(call (mem:SI (match_dup 2))
12308 (match_operand 1 "" ""))
12309 (use (mem:DI (plus:DI (match_dup 0) (const_int 8))))
12311 (use (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
12312 (clobber (reg:SI LR_REGNO))])]
12315 { operands[2] = gen_reg_rtx (DImode); }")
12317 (define_expand "call_value_indirect_aix32"
12318 [(set (match_dup 3)
12319 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "")))
12320 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
12323 (mem:SI (plus:SI (match_dup 1)
12325 (parallel [(set (match_operand 0 "" "")
12326 (call (mem:SI (match_dup 3))
12327 (match_operand 2 "" "")))
12328 (use (mem:SI (plus:SI (match_dup 1) (const_int 4))))
12330 (use (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
12331 (clobber (reg:SI LR_REGNO))])]
12334 { operands[3] = gen_reg_rtx (SImode); }")
12336 (define_expand "call_value_indirect_aix64"
12337 [(set (match_dup 3)
12338 (mem:DI (match_operand:DI 1 "gpc_reg_operand" "")))
12339 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
12342 (mem:DI (plus:DI (match_dup 1)
12344 (parallel [(set (match_operand 0 "" "")
12345 (call (mem:SI (match_dup 3))
12346 (match_operand 2 "" "")))
12347 (use (mem:DI (plus:DI (match_dup 1) (const_int 8))))
12349 (use (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
12350 (clobber (reg:SI LR_REGNO))])]
12353 { operands[3] = gen_reg_rtx (DImode); }")
12355 ;; Now the definitions for the call and call_value insns
12356 (define_expand "call"
12357 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
12358 (match_operand 1 "" ""))
12359 (use (match_operand 2 "" ""))
12360 (clobber (reg:SI LR_REGNO))])]
12365 if (MACHOPIC_INDIRECT)
12366 operands[0] = machopic_indirect_call_target (operands[0]);
12369 gcc_assert (GET_CODE (operands[0]) == MEM);
12370 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
12372 operands[0] = XEXP (operands[0], 0);
12374 if (GET_CODE (operands[0]) != SYMBOL_REF
12375 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[0]))
12376 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[2]) & CALL_LONG) != 0))
12378 if (INTVAL (operands[2]) & CALL_LONG)
12379 operands[0] = rs6000_longcall_ref (operands[0]);
12381 switch (DEFAULT_ABI)
12385 operands[0] = force_reg (Pmode, operands[0]);
12389 /* AIX function pointers are really pointers to a three word
12391 emit_call_insn (TARGET_32BIT
12392 ? gen_call_indirect_aix32 (force_reg (SImode,
12395 : gen_call_indirect_aix64 (force_reg (DImode,
12401 gcc_unreachable ();
12406 (define_expand "call_value"
12407 [(parallel [(set (match_operand 0 "" "")
12408 (call (mem:SI (match_operand 1 "address_operand" ""))
12409 (match_operand 2 "" "")))
12410 (use (match_operand 3 "" ""))
12411 (clobber (reg:SI LR_REGNO))])]
12416 if (MACHOPIC_INDIRECT)
12417 operands[1] = machopic_indirect_call_target (operands[1]);
12420 gcc_assert (GET_CODE (operands[1]) == MEM);
12421 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
12423 operands[1] = XEXP (operands[1], 0);
12425 if (GET_CODE (operands[1]) != SYMBOL_REF
12426 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[1]))
12427 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[3]) & CALL_LONG) != 0))
12429 if (INTVAL (operands[3]) & CALL_LONG)
12430 operands[1] = rs6000_longcall_ref (operands[1]);
12432 switch (DEFAULT_ABI)
12436 operands[1] = force_reg (Pmode, operands[1]);
12440 /* AIX function pointers are really pointers to a three word
12442 emit_call_insn (TARGET_32BIT
12443 ? gen_call_value_indirect_aix32 (operands[0],
12447 : gen_call_value_indirect_aix64 (operands[0],
12454 gcc_unreachable ();
12459 ;; Call to function in current module. No TOC pointer reload needed.
12460 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
12461 ;; either the function was not prototyped, or it was prototyped as a
12462 ;; variable argument function. It is > 0 if FP registers were passed
12463 ;; and < 0 if they were not.
12465 (define_insn "*call_local32"
12466 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
12467 (match_operand 1 "" "g,g"))
12468 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12469 (clobber (reg:SI LR_REGNO))]
12470 "(INTVAL (operands[2]) & CALL_LONG) == 0"
12473 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12474 output_asm_insn (\"crxor 6,6,6\", operands);
12476 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12477 output_asm_insn (\"creqv 6,6,6\", operands);
12479 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
12481 [(set_attr "type" "branch")
12482 (set_attr "length" "4,8")])
12484 (define_insn "*call_local64"
12485 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
12486 (match_operand 1 "" "g,g"))
12487 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12488 (clobber (reg:SI LR_REGNO))]
12489 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
12492 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12493 output_asm_insn (\"crxor 6,6,6\", operands);
12495 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12496 output_asm_insn (\"creqv 6,6,6\", operands);
12498 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
12500 [(set_attr "type" "branch")
12501 (set_attr "length" "4,8")])
12503 (define_insn "*call_value_local32"
12504 [(set (match_operand 0 "" "")
12505 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
12506 (match_operand 2 "" "g,g")))
12507 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12508 (clobber (reg:SI LR_REGNO))]
12509 "(INTVAL (operands[3]) & CALL_LONG) == 0"
12512 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12513 output_asm_insn (\"crxor 6,6,6\", operands);
12515 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12516 output_asm_insn (\"creqv 6,6,6\", operands);
12518 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
12520 [(set_attr "type" "branch")
12521 (set_attr "length" "4,8")])
12524 (define_insn "*call_value_local64"
12525 [(set (match_operand 0 "" "")
12526 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
12527 (match_operand 2 "" "g,g")))
12528 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12529 (clobber (reg:SI LR_REGNO))]
12530 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
12533 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12534 output_asm_insn (\"crxor 6,6,6\", operands);
12536 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12537 output_asm_insn (\"creqv 6,6,6\", operands);
12539 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
12541 [(set_attr "type" "branch")
12542 (set_attr "length" "4,8")])
12544 ;; Call to function which may be in another module. Restore the TOC
12545 ;; pointer (r2) after the call unless this is System V.
12546 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
12547 ;; either the function was not prototyped, or it was prototyped as a
12548 ;; variable argument function. It is > 0 if FP registers were passed
12549 ;; and < 0 if they were not.
12551 (define_insn_and_split "*call_indirect_nonlocal_aix32_internal"
12552 [(call (mem:SI (match_operand:SI 0 "register_operand" "c,*l"))
12553 (match_operand 1 "" "g,g"))
12554 (use (mem:SI (plus:SI (match_operand:SI 2 "register_operand" "b,b") (const_int 4))))
12556 (use (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
12557 (clobber (reg:SI LR_REGNO))]
12558 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
12560 "&& reload_completed"
12562 (mem:SI (plus:SI (match_dup 2) (const_int 4))))
12563 (parallel [(call (mem:SI (match_dup 0))
12568 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
12569 (clobber (reg:SI LR_REGNO))])]
12571 [(set_attr "type" "jmpreg")
12572 (set_attr "length" "12")])
12574 (define_insn "*call_indirect_nonlocal_aix32"
12575 [(call (mem:SI (match_operand:SI 0 "register_operand" "c,*l"))
12576 (match_operand 1 "" "g,g"))
12580 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
12581 (clobber (reg:SI LR_REGNO))]
12582 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX && reload_completed"
12583 "b%T0l\;{l|lwz} 2,20(1)"
12584 [(set_attr "type" "jmpreg")
12585 (set_attr "length" "8")])
12587 (define_insn "*call_nonlocal_aix32"
12588 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
12589 (match_operand 1 "" "g"))
12590 (use (match_operand:SI 2 "immediate_operand" "O"))
12591 (clobber (reg:SI LR_REGNO))]
12593 && DEFAULT_ABI == ABI_AIX
12594 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12596 [(set_attr "type" "branch")
12597 (set_attr "length" "8")])
12599 (define_insn_and_split "*call_indirect_nonlocal_aix64_internal"
12600 [(call (mem:SI (match_operand:DI 0 "register_operand" "c,*l"))
12601 (match_operand 1 "" "g,g"))
12602 (use (mem:DI (plus:DI (match_operand:DI 2 "register_operand" "b,b")
12605 (use (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
12606 (clobber (reg:SI LR_REGNO))]
12607 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
12609 "&& reload_completed"
12611 (mem:DI (plus:DI (match_dup 2) (const_int 8))))
12612 (parallel [(call (mem:SI (match_dup 0))
12617 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
12618 (clobber (reg:SI LR_REGNO))])]
12620 [(set_attr "type" "jmpreg")
12621 (set_attr "length" "12")])
12623 (define_insn "*call_indirect_nonlocal_aix64"
12624 [(call (mem:SI (match_operand:DI 0 "register_operand" "c,*l"))
12625 (match_operand 1 "" "g,g"))
12629 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
12630 (clobber (reg:SI LR_REGNO))]
12631 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX && reload_completed"
12632 "b%T0l\;ld 2,40(1)"
12633 [(set_attr "type" "jmpreg")
12634 (set_attr "length" "8")])
12636 (define_insn "*call_nonlocal_aix64"
12637 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
12638 (match_operand 1 "" "g"))
12639 (use (match_operand:SI 2 "immediate_operand" "O"))
12640 (clobber (reg:SI LR_REGNO))]
12642 && DEFAULT_ABI == ABI_AIX
12643 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12645 [(set_attr "type" "branch")
12646 (set_attr "length" "8")])
12648 (define_insn_and_split "*call_value_indirect_nonlocal_aix32_internal"
12649 [(set (match_operand 0 "" "")
12650 (call (mem:SI (match_operand:SI 1 "register_operand" "c,*l"))
12651 (match_operand 2 "" "g,g")))
12652 (use (mem:SI (plus:SI (match_operand:SI 3 "register_operand" "b,b")
12655 (use (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
12656 (clobber (reg:SI LR_REGNO))]
12657 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
12659 "&& reload_completed"
12661 (mem:SI (plus:SI (match_dup 3) (const_int 4))))
12662 (parallel [(set (match_dup 0) (call (mem:SI (match_dup 1))
12667 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
12668 (clobber (reg:SI LR_REGNO))])]
12670 [(set_attr "type" "jmpreg")
12671 (set_attr "length" "12")])
12673 (define_insn "*call_value_indirect_nonlocal_aix32"
12674 [(set (match_operand 0 "" "")
12675 (call (mem:SI (match_operand:SI 1 "register_operand" "c,*l"))
12676 (match_operand 2 "" "g,g")))
12680 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
12681 (clobber (reg:SI LR_REGNO))]
12682 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX && reload_completed"
12683 "b%T1l\;{l|lwz} 2,20(1)"
12684 [(set_attr "type" "jmpreg")
12685 (set_attr "length" "8")])
12687 (define_insn "*call_value_nonlocal_aix32"
12688 [(set (match_operand 0 "" "")
12689 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
12690 (match_operand 2 "" "g")))
12691 (use (match_operand:SI 3 "immediate_operand" "O"))
12692 (clobber (reg:SI LR_REGNO))]
12694 && DEFAULT_ABI == ABI_AIX
12695 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12697 [(set_attr "type" "branch")
12698 (set_attr "length" "8")])
12700 (define_insn_and_split "*call_value_indirect_nonlocal_aix64_internal"
12701 [(set (match_operand 0 "" "")
12702 (call (mem:SI (match_operand:DI 1 "register_operand" "c,*l"))
12703 (match_operand 2 "" "g,g")))
12704 (use (mem:DI (plus:DI (match_operand:DI 3 "register_operand" "b,b")
12707 (use (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
12708 (clobber (reg:SI LR_REGNO))]
12709 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
12711 "&& reload_completed"
12713 (mem:DI (plus:DI (match_dup 3) (const_int 8))))
12714 (parallel [(set (match_dup 0) (call (mem:SI (match_dup 1))
12719 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
12720 (clobber (reg:SI LR_REGNO))])]
12722 [(set_attr "type" "jmpreg")
12723 (set_attr "length" "12")])
12725 (define_insn "*call_value_indirect_nonlocal_aix64"
12726 [(set (match_operand 0 "" "")
12727 (call (mem:SI (match_operand:DI 1 "register_operand" "c,*l"))
12728 (match_operand 2 "" "g,g")))
12732 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
12733 (clobber (reg:SI LR_REGNO))]
12734 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX && reload_completed"
12735 "b%T1l\;ld 2,40(1)"
12736 [(set_attr "type" "jmpreg")
12737 (set_attr "length" "8")])
12739 (define_insn "*call_value_nonlocal_aix64"
12740 [(set (match_operand 0 "" "")
12741 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
12742 (match_operand 2 "" "g")))
12743 (use (match_operand:SI 3 "immediate_operand" "O"))
12744 (clobber (reg:SI LR_REGNO))]
12746 && DEFAULT_ABI == ABI_AIX
12747 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12749 [(set_attr "type" "branch")
12750 (set_attr "length" "8")])
12752 ;; A function pointer under System V is just a normal pointer
12753 ;; operands[0] is the function pointer
12754 ;; operands[1] is the stack size to clean up
12755 ;; operands[2] is the value FUNCTION_ARG returns for the VOID argument
12756 ;; which indicates how to set cr1
12758 (define_insn "*call_indirect_nonlocal_sysv<mode>"
12759 [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l,c,*l"))
12760 (match_operand 1 "" "g,g,g,g"))
12761 (use (match_operand:SI 2 "immediate_operand" "O,O,n,n"))
12762 (clobber (reg:SI LR_REGNO))]
12763 "DEFAULT_ABI == ABI_V4
12764 || DEFAULT_ABI == ABI_DARWIN"
12766 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12767 output_asm_insn ("crxor 6,6,6", operands);
12769 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12770 output_asm_insn ("creqv 6,6,6", operands);
12774 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
12775 (set_attr "length" "4,4,8,8")])
12777 (define_insn_and_split "*call_nonlocal_sysv<mode>"
12778 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
12779 (match_operand 1 "" "g,g"))
12780 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12781 (clobber (reg:SI LR_REGNO))]
12782 "(DEFAULT_ABI == ABI_DARWIN
12783 || (DEFAULT_ABI == ABI_V4
12784 && (INTVAL (operands[2]) & CALL_LONG) == 0))"
12786 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12787 output_asm_insn ("crxor 6,6,6", operands);
12789 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12790 output_asm_insn ("creqv 6,6,6", operands);
12793 return output_call(insn, operands, 0, 2);
12795 if (DEFAULT_ABI == ABI_V4 && flag_pic)
12797 gcc_assert (!TARGET_SECURE_PLT);
12798 return "bl %z0@plt";
12804 "DEFAULT_ABI == ABI_V4
12805 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[0])
12806 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12807 [(parallel [(call (mem:SI (match_dup 0))
12809 (use (match_dup 2))
12810 (use (match_dup 3))
12811 (clobber (reg:SI LR_REGNO))])]
12813 operands[3] = pic_offset_table_rtx;
12815 [(set_attr "type" "branch,branch")
12816 (set_attr "length" "4,8")])
12818 (define_insn "*call_nonlocal_sysv_secure<mode>"
12819 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
12820 (match_operand 1 "" "g,g"))
12821 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12822 (use (match_operand:SI 3 "register_operand" "r,r"))
12823 (clobber (reg:SI LR_REGNO))]
12824 "(DEFAULT_ABI == ABI_V4
12825 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[0])
12826 && (INTVAL (operands[2]) & CALL_LONG) == 0)"
12828 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12829 output_asm_insn ("crxor 6,6,6", operands);
12831 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12832 output_asm_insn ("creqv 6,6,6", operands);
12835 /* The magic 32768 offset here and in the other sysv call insns
12836 corresponds to the offset of r30 in .got2, as given by LCTOC1.
12837 See sysv4.h:toc_section. */
12838 return "bl %z0+32768@plt";
12840 return "bl %z0@plt";
12842 [(set_attr "type" "branch,branch")
12843 (set_attr "length" "4,8")])
12845 (define_insn "*call_value_indirect_nonlocal_sysv<mode>"
12846 [(set (match_operand 0 "" "")
12847 (call (mem:SI (match_operand:P 1 "register_operand" "c,*l,c,*l"))
12848 (match_operand 2 "" "g,g,g,g")))
12849 (use (match_operand:SI 3 "immediate_operand" "O,O,n,n"))
12850 (clobber (reg:SI LR_REGNO))]
12851 "DEFAULT_ABI == ABI_V4
12852 || DEFAULT_ABI == ABI_DARWIN"
12854 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12855 output_asm_insn ("crxor 6,6,6", operands);
12857 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12858 output_asm_insn ("creqv 6,6,6", operands);
12862 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
12863 (set_attr "length" "4,4,8,8")])
12865 (define_insn_and_split "*call_value_nonlocal_sysv<mode>"
12866 [(set (match_operand 0 "" "")
12867 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
12868 (match_operand 2 "" "g,g")))
12869 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12870 (clobber (reg:SI LR_REGNO))]
12871 "(DEFAULT_ABI == ABI_DARWIN
12872 || (DEFAULT_ABI == ABI_V4
12873 && (INTVAL (operands[3]) & CALL_LONG) == 0))"
12875 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12876 output_asm_insn ("crxor 6,6,6", operands);
12878 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12879 output_asm_insn ("creqv 6,6,6", operands);
12882 return output_call(insn, operands, 1, 3);
12884 if (DEFAULT_ABI == ABI_V4 && flag_pic)
12886 gcc_assert (!TARGET_SECURE_PLT);
12887 return "bl %z1@plt";
12893 "DEFAULT_ABI == ABI_V4
12894 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[1])
12895 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12896 [(parallel [(set (match_dup 0)
12897 (call (mem:SI (match_dup 1))
12899 (use (match_dup 3))
12900 (use (match_dup 4))
12901 (clobber (reg:SI LR_REGNO))])]
12903 operands[4] = pic_offset_table_rtx;
12905 [(set_attr "type" "branch,branch")
12906 (set_attr "length" "4,8")])
12908 (define_insn "*call_value_nonlocal_sysv_secure<mode>"
12909 [(set (match_operand 0 "" "")
12910 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
12911 (match_operand 2 "" "g,g")))
12912 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12913 (use (match_operand:SI 4 "register_operand" "r,r"))
12914 (clobber (reg:SI LR_REGNO))]
12915 "(DEFAULT_ABI == ABI_V4
12916 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[1])
12917 && (INTVAL (operands[3]) & CALL_LONG) == 0)"
12919 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12920 output_asm_insn ("crxor 6,6,6", operands);
12922 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12923 output_asm_insn ("creqv 6,6,6", operands);
12926 return "bl %z1+32768@plt";
12928 return "bl %z1@plt";
12930 [(set_attr "type" "branch,branch")
12931 (set_attr "length" "4,8")])
12933 ;; Call subroutine returning any type.
12934 (define_expand "untyped_call"
12935 [(parallel [(call (match_operand 0 "" "")
12937 (match_operand 1 "" "")
12938 (match_operand 2 "" "")])]
12944 emit_call_insn (GEN_CALL (operands[0], const0_rtx, const0_rtx, const0_rtx));
12946 for (i = 0; i < XVECLEN (operands[2], 0); i++)
12948 rtx set = XVECEXP (operands[2], 0, i);
12949 emit_move_insn (SET_DEST (set), SET_SRC (set));
12952 /* The optimizer does not know that the call sets the function value
12953 registers we stored in the result block. We avoid problems by
12954 claiming that all hard registers are used and clobbered at this
12956 emit_insn (gen_blockage ());
12961 ;; sibling call patterns
12962 (define_expand "sibcall"
12963 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
12964 (match_operand 1 "" ""))
12965 (use (match_operand 2 "" ""))
12966 (use (reg:SI LR_REGNO))
12972 if (MACHOPIC_INDIRECT)
12973 operands[0] = machopic_indirect_call_target (operands[0]);
12976 gcc_assert (GET_CODE (operands[0]) == MEM);
12977 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
12979 operands[0] = XEXP (operands[0], 0);
12982 ;; this and similar patterns must be marked as using LR, otherwise
12983 ;; dataflow will try to delete the store into it. This is true
12984 ;; even when the actual reg to jump to is in CTR, when LR was
12985 ;; saved and restored around the PIC-setting BCL.
12986 (define_insn "*sibcall_local32"
12987 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
12988 (match_operand 1 "" "g,g"))
12989 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12990 (use (reg:SI LR_REGNO))
12992 "(INTVAL (operands[2]) & CALL_LONG) == 0"
12995 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12996 output_asm_insn (\"crxor 6,6,6\", operands);
12998 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12999 output_asm_insn (\"creqv 6,6,6\", operands);
13001 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
13003 [(set_attr "type" "branch")
13004 (set_attr "length" "4,8")])
13006 (define_insn "*sibcall_local64"
13007 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
13008 (match_operand 1 "" "g,g"))
13009 (use (match_operand:SI 2 "immediate_operand" "O,n"))
13010 (use (reg:SI LR_REGNO))
13012 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
13015 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
13016 output_asm_insn (\"crxor 6,6,6\", operands);
13018 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
13019 output_asm_insn (\"creqv 6,6,6\", operands);
13021 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
13023 [(set_attr "type" "branch")
13024 (set_attr "length" "4,8")])
13026 (define_insn "*sibcall_value_local32"
13027 [(set (match_operand 0 "" "")
13028 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
13029 (match_operand 2 "" "g,g")))
13030 (use (match_operand:SI 3 "immediate_operand" "O,n"))
13031 (use (reg:SI LR_REGNO))
13033 "(INTVAL (operands[3]) & CALL_LONG) == 0"
13036 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
13037 output_asm_insn (\"crxor 6,6,6\", operands);
13039 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
13040 output_asm_insn (\"creqv 6,6,6\", operands);
13042 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
13044 [(set_attr "type" "branch")
13045 (set_attr "length" "4,8")])
13048 (define_insn "*sibcall_value_local64"
13049 [(set (match_operand 0 "" "")
13050 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
13051 (match_operand 2 "" "g,g")))
13052 (use (match_operand:SI 3 "immediate_operand" "O,n"))
13053 (use (reg:SI LR_REGNO))
13055 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
13058 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
13059 output_asm_insn (\"crxor 6,6,6\", operands);
13061 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
13062 output_asm_insn (\"creqv 6,6,6\", operands);
13064 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
13066 [(set_attr "type" "branch")
13067 (set_attr "length" "4,8")])
13069 (define_insn "*sibcall_nonlocal_aix32"
13070 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
13071 (match_operand 1 "" "g"))
13072 (use (match_operand:SI 2 "immediate_operand" "O"))
13073 (use (reg:SI LR_REGNO))
13076 && DEFAULT_ABI == ABI_AIX
13077 && (INTVAL (operands[2]) & CALL_LONG) == 0"
13079 [(set_attr "type" "branch")
13080 (set_attr "length" "4")])
13082 (define_insn "*sibcall_nonlocal_aix64"
13083 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
13084 (match_operand 1 "" "g"))
13085 (use (match_operand:SI 2 "immediate_operand" "O"))
13086 (use (reg:SI LR_REGNO))
13089 && DEFAULT_ABI == ABI_AIX
13090 && (INTVAL (operands[2]) & CALL_LONG) == 0"
13092 [(set_attr "type" "branch")
13093 (set_attr "length" "4")])
13095 (define_insn "*sibcall_value_nonlocal_aix32"
13096 [(set (match_operand 0 "" "")
13097 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
13098 (match_operand 2 "" "g")))
13099 (use (match_operand:SI 3 "immediate_operand" "O"))
13100 (use (reg:SI LR_REGNO))
13103 && DEFAULT_ABI == ABI_AIX
13104 && (INTVAL (operands[3]) & CALL_LONG) == 0"
13106 [(set_attr "type" "branch")
13107 (set_attr "length" "4")])
13109 (define_insn "*sibcall_value_nonlocal_aix64"
13110 [(set (match_operand 0 "" "")
13111 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
13112 (match_operand 2 "" "g")))
13113 (use (match_operand:SI 3 "immediate_operand" "O"))
13114 (use (reg:SI LR_REGNO))
13117 && DEFAULT_ABI == ABI_AIX
13118 && (INTVAL (operands[3]) & CALL_LONG) == 0"
13120 [(set_attr "type" "branch")
13121 (set_attr "length" "4")])
13123 (define_insn "*sibcall_nonlocal_sysv<mode>"
13124 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
13125 (match_operand 1 "" ""))
13126 (use (match_operand 2 "immediate_operand" "O,n"))
13127 (use (reg:SI LR_REGNO))
13129 "(DEFAULT_ABI == ABI_DARWIN
13130 || DEFAULT_ABI == ABI_V4)
13131 && (INTVAL (operands[2]) & CALL_LONG) == 0"
13134 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
13135 output_asm_insn (\"crxor 6,6,6\", operands);
13137 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
13138 output_asm_insn (\"creqv 6,6,6\", operands);
13140 if (DEFAULT_ABI == ABI_V4 && flag_pic)
13142 gcc_assert (!TARGET_SECURE_PLT);
13143 return \"b %z0@plt\";
13148 [(set_attr "type" "branch,branch")
13149 (set_attr "length" "4,8")])
13151 (define_expand "sibcall_value"
13152 [(parallel [(set (match_operand 0 "register_operand" "")
13153 (call (mem:SI (match_operand 1 "address_operand" ""))
13154 (match_operand 2 "" "")))
13155 (use (match_operand 3 "" ""))
13156 (use (reg:SI LR_REGNO))
13162 if (MACHOPIC_INDIRECT)
13163 operands[1] = machopic_indirect_call_target (operands[1]);
13166 gcc_assert (GET_CODE (operands[1]) == MEM);
13167 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
13169 operands[1] = XEXP (operands[1], 0);
13172 (define_insn "*sibcall_value_nonlocal_sysv<mode>"
13173 [(set (match_operand 0 "" "")
13174 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
13175 (match_operand 2 "" "")))
13176 (use (match_operand:SI 3 "immediate_operand" "O,n"))
13177 (use (reg:SI LR_REGNO))
13179 "(DEFAULT_ABI == ABI_DARWIN
13180 || DEFAULT_ABI == ABI_V4)
13181 && (INTVAL (operands[3]) & CALL_LONG) == 0"
13184 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
13185 output_asm_insn (\"crxor 6,6,6\", operands);
13187 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
13188 output_asm_insn (\"creqv 6,6,6\", operands);
13190 if (DEFAULT_ABI == ABI_V4 && flag_pic)
13192 gcc_assert (!TARGET_SECURE_PLT);
13193 return \"b %z1@plt\";
13198 [(set_attr "type" "branch,branch")
13199 (set_attr "length" "4,8")])
13201 (define_expand "sibcall_epilogue"
13202 [(use (const_int 0))]
13203 "TARGET_SCHED_PROLOG"
13206 rs6000_emit_epilogue (TRUE);
13210 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
13211 ;; all of memory. This blocks insns from being moved across this point.
13213 (define_insn "blockage"
13214 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCK)]
13218 (define_insn "probe_stack"
13219 [(set (match_operand 0 "memory_operand" "=m")
13220 (unspec [(const_int 0)] UNSPEC_PROBE_STACK))]
13222 "{st%U0%X0|stw%U0%X0} 0,%0"
13223 [(set_attr "type" "store")
13224 (set_attr "length" "4")])
13226 (define_insn "probe_stack_range<P:mode>"
13227 [(set (match_operand:P 0 "register_operand" "=r")
13228 (unspec_volatile:P [(match_operand:P 1 "register_operand" "0")
13229 (match_operand:P 2 "register_operand" "r")]
13230 UNSPECV_PROBE_STACK_RANGE))]
13232 "* return output_probe_stack_range (operands[0], operands[2]);"
13233 [(set_attr "type" "three")])
13235 ;; Compare insns are next. Note that the RS/6000 has two types of compares,
13236 ;; signed & unsigned, and one type of branch.
13238 ;; Start with the DEFINE_EXPANDs to generate the rtl for compares, scc
13239 ;; insns, and branches.
13241 (define_expand "cbranch<mode>4"
13242 [(use (match_operator 0 "rs6000_cbranch_operator"
13243 [(match_operand:GPR 1 "gpc_reg_operand" "")
13244 (match_operand:GPR 2 "reg_or_short_operand" "")]))
13245 (use (match_operand 3 ""))]
13249 /* Take care of the possibility that operands[2] might be negative but
13250 this might be a logical operation. That insn doesn't exist. */
13251 if (GET_CODE (operands[2]) == CONST_INT
13252 && INTVAL (operands[2]) < 0)
13254 operands[2] = force_reg (<MODE>mode, operands[2]);
13255 operands[0] = gen_rtx_fmt_ee (GET_CODE (operands[0]),
13256 GET_MODE (operands[0]),
13257 operands[1], operands[2]);
13260 rs6000_emit_cbranch (<MODE>mode, operands);
13264 (define_expand "cbranch<mode>4"
13265 [(use (match_operator 0 "rs6000_cbranch_operator"
13266 [(match_operand:FP 1 "gpc_reg_operand" "")
13267 (match_operand:FP 2 "gpc_reg_operand" "")]))
13268 (use (match_operand 3 ""))]
13272 rs6000_emit_cbranch (<MODE>mode, operands);
13276 (define_expand "cstore<mode>4"
13277 [(use (match_operator 1 "rs6000_cbranch_operator"
13278 [(match_operand:GPR 2 "gpc_reg_operand" "")
13279 (match_operand:GPR 3 "reg_or_short_operand" "")]))
13280 (clobber (match_operand:SI 0 "register_operand"))]
13284 /* Take care of the possibility that operands[3] might be negative but
13285 this might be a logical operation. That insn doesn't exist. */
13286 if (GET_CODE (operands[3]) == CONST_INT
13287 && INTVAL (operands[3]) < 0)
13289 operands[3] = force_reg (<MODE>mode, operands[3]);
13290 operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]),
13291 GET_MODE (operands[1]),
13292 operands[2], operands[3]);
13295 /* For SNE, we would prefer that the xor/abs sequence be used for integers.
13296 For SEQ, likewise, except that comparisons with zero should be done
13297 with an scc insns. However, due to the order that combine see the
13298 resulting insns, we must, in fact, allow SEQ for integers. Fail in
13299 the cases we don't want to handle or are best handled by portable
13301 if (GET_CODE (operands[1]) == NE)
13303 if ((GET_CODE (operands[1]) == LT || GET_CODE (operands[1]) == LE
13304 || GET_CODE (operands[1]) == GT || GET_CODE (operands[1]) == GE)
13305 && operands[3] == const0_rtx)
13307 rs6000_emit_sCOND (<MODE>mode, operands);
13311 (define_expand "cstore<mode>4"
13312 [(use (match_operator 1 "rs6000_cbranch_operator"
13313 [(match_operand:FP 2 "gpc_reg_operand" "")
13314 (match_operand:FP 3 "gpc_reg_operand" "")]))
13315 (clobber (match_operand:SI 0 "register_operand"))]
13319 rs6000_emit_sCOND (<MODE>mode, operands);
13324 (define_expand "stack_protect_set"
13325 [(match_operand 0 "memory_operand" "")
13326 (match_operand 1 "memory_operand" "")]
13329 #ifdef TARGET_THREAD_SSP_OFFSET
13330 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
13331 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
13332 operands[1] = gen_rtx_MEM (Pmode, addr);
13335 emit_insn (gen_stack_protect_setdi (operands[0], operands[1]));
13337 emit_insn (gen_stack_protect_setsi (operands[0], operands[1]));
13341 (define_insn "stack_protect_setsi"
13342 [(set (match_operand:SI 0 "memory_operand" "=m")
13343 (unspec:SI [(match_operand:SI 1 "memory_operand" "m")] UNSPEC_SP_SET))
13344 (set (match_scratch:SI 2 "=&r") (const_int 0))]
13346 "{l%U1%X1|lwz%U1%X1} %2,%1\;{st%U0%X0|stw%U0%X0} %2,%0\;{lil|li} %2,0"
13347 [(set_attr "type" "three")
13348 (set_attr "length" "12")])
13350 (define_insn "stack_protect_setdi"
13351 [(set (match_operand:DI 0 "memory_operand" "=m")
13352 (unspec:DI [(match_operand:DI 1 "memory_operand" "m")] UNSPEC_SP_SET))
13353 (set (match_scratch:DI 2 "=&r") (const_int 0))]
13355 "ld%U1%X1 %2,%1\;std%U0%X0 %2,%0\;{lil|li} %2,0"
13356 [(set_attr "type" "three")
13357 (set_attr "length" "12")])
13359 (define_expand "stack_protect_test"
13360 [(match_operand 0 "memory_operand" "")
13361 (match_operand 1 "memory_operand" "")
13362 (match_operand 2 "" "")]
13365 rtx test, op0, op1;
13366 #ifdef TARGET_THREAD_SSP_OFFSET
13367 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
13368 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
13369 operands[1] = gen_rtx_MEM (Pmode, addr);
13372 op1 = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, operands[1]), UNSPEC_SP_TEST);
13373 test = gen_rtx_EQ (VOIDmode, op0, op1);
13374 emit_jump_insn (gen_cbranchsi4 (test, op0, op1, operands[2]));
13378 (define_insn "stack_protect_testsi"
13379 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
13380 (unspec:CCEQ [(match_operand:SI 1 "memory_operand" "m,m")
13381 (match_operand:SI 2 "memory_operand" "m,m")]
13383 (set (match_scratch:SI 4 "=r,r") (const_int 0))
13384 (clobber (match_scratch:SI 3 "=&r,&r"))]
13387 {l%U1%X1|lwz%U1%X1} %3,%1\;{l%U2%X2|lwz%U2%X2} %4,%2\;xor. %3,%3,%4\;{lil|li} %4,0
13388 {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"
13389 [(set_attr "length" "16,20")])
13391 (define_insn "stack_protect_testdi"
13392 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
13393 (unspec:CCEQ [(match_operand:DI 1 "memory_operand" "m,m")
13394 (match_operand:DI 2 "memory_operand" "m,m")]
13396 (set (match_scratch:DI 4 "=r,r") (const_int 0))
13397 (clobber (match_scratch:DI 3 "=&r,&r"))]
13400 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;xor. %3,%3,%4\;{lil|li} %4,0
13401 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;cmpld %0,%3,%4\;{lil|li} %3,0\;{lil|li} %4,0"
13402 [(set_attr "length" "16,20")])
13405 ;; Here are the actual compare insns.
13406 (define_insn "*cmp<mode>_internal1"
13407 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
13408 (compare:CC (match_operand:GPR 1 "gpc_reg_operand" "r")
13409 (match_operand:GPR 2 "reg_or_short_operand" "rI")))]
13411 "{cmp%I2|cmp<wd>%I2} %0,%1,%2"
13412 [(set_attr "type" "cmp")])
13414 ;; If we are comparing a register for equality with a large constant,
13415 ;; we can do this with an XOR followed by a compare. But this is profitable
13416 ;; only if the large constant is only used for the comparison (and in this
13417 ;; case we already have a register to reuse as scratch).
13419 ;; For 64-bit registers, we could only do so if the constant's bit 15 is clear:
13420 ;; otherwise we'd need to XOR with FFFFFFFF????0000 which is not available.
13423 [(set (match_operand:SI 0 "register_operand")
13424 (match_operand:SI 1 "logical_const_operand" ""))
13425 (set (match_dup 0) (match_operator:SI 3 "boolean_or_operator"
13427 (match_operand:SI 2 "logical_const_operand" "")]))
13428 (set (match_operand:CC 4 "cc_reg_operand" "")
13429 (compare:CC (match_operand:SI 5 "gpc_reg_operand" "")
13432 (if_then_else (match_operator 6 "equality_operator"
13433 [(match_dup 4) (const_int 0)])
13434 (match_operand 7 "" "")
13435 (match_operand 8 "" "")))]
13436 "peep2_reg_dead_p (3, operands[0])
13437 && peep2_reg_dead_p (4, operands[4])"
13438 [(set (match_dup 0) (xor:SI (match_dup 5) (match_dup 9)))
13439 (set (match_dup 4) (compare:CC (match_dup 0) (match_dup 10)))
13440 (set (pc) (if_then_else (match_dup 6) (match_dup 7) (match_dup 8)))]
13443 /* Get the constant we are comparing against, and see what it looks like
13444 when sign-extended from 16 to 32 bits. Then see what constant we could
13445 XOR with SEXTC to get the sign-extended value. */
13446 rtx cnst = simplify_const_binary_operation (GET_CODE (operands[3]),
13448 operands[1], operands[2]);
13449 HOST_WIDE_INT c = INTVAL (cnst);
13450 HOST_WIDE_INT sextc = ((c & 0xffff) ^ 0x8000) - 0x8000;
13451 HOST_WIDE_INT xorv = c ^ sextc;
13453 operands[9] = GEN_INT (xorv);
13454 operands[10] = GEN_INT (sextc);
13457 (define_insn "*cmpsi_internal2"
13458 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
13459 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
13460 (match_operand:SI 2 "reg_or_u_short_operand" "rK")))]
13462 "{cmpl%I2|cmplw%I2} %0,%1,%b2"
13463 [(set_attr "type" "cmp")])
13465 (define_insn "*cmpdi_internal2"
13466 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
13467 (compare:CCUNS (match_operand:DI 1 "gpc_reg_operand" "r")
13468 (match_operand:DI 2 "reg_or_u_short_operand" "rK")))]
13470 "cmpld%I2 %0,%1,%b2"
13471 [(set_attr "type" "cmp")])
13473 ;; The following two insns don't exist as single insns, but if we provide
13474 ;; them, we can swap an add and compare, which will enable us to overlap more
13475 ;; of the required delay between a compare and branch. We generate code for
13476 ;; them by splitting.
13479 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
13480 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
13481 (match_operand:SI 2 "short_cint_operand" "i")))
13482 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
13483 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
13486 [(set_attr "length" "8")])
13489 [(set (match_operand:CCUNS 3 "cc_reg_operand" "=y")
13490 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
13491 (match_operand:SI 2 "u_short_cint_operand" "i")))
13492 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
13493 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
13496 [(set_attr "length" "8")])
13499 [(set (match_operand:CC 3 "cc_reg_operand" "")
13500 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
13501 (match_operand:SI 2 "short_cint_operand" "")))
13502 (set (match_operand:SI 0 "gpc_reg_operand" "")
13503 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
13505 [(set (match_dup 3) (compare:CC (match_dup 1) (match_dup 2)))
13506 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
13509 [(set (match_operand:CCUNS 3 "cc_reg_operand" "")
13510 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "")
13511 (match_operand:SI 2 "u_short_cint_operand" "")))
13512 (set (match_operand:SI 0 "gpc_reg_operand" "")
13513 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
13515 [(set (match_dup 3) (compare:CCUNS (match_dup 1) (match_dup 2)))
13516 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
13518 (define_insn "*cmpsf_internal1"
13519 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
13520 (compare:CCFP (match_operand:SF 1 "gpc_reg_operand" "f")
13521 (match_operand:SF 2 "gpc_reg_operand" "f")))]
13522 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
13524 [(set_attr "type" "fpcompare")])
13526 (define_insn "*cmpdf_internal1"
13527 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
13528 (compare:CCFP (match_operand:DF 1 "gpc_reg_operand" "d")
13529 (match_operand:DF 2 "gpc_reg_operand" "d")))]
13530 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
13531 && !VECTOR_UNIT_VSX_P (DFmode)"
13533 [(set_attr "type" "fpcompare")])
13535 ;; Only need to compare second words if first words equal
13536 (define_insn "*cmptf_internal1"
13537 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
13538 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "d")
13539 (match_operand:TF 2 "gpc_reg_operand" "d")))]
13540 "!TARGET_IEEEQUAD && !TARGET_XL_COMPAT
13541 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LONG_DOUBLE_128"
13542 "fcmpu %0,%1,%2\;bne %0,$+8\;fcmpu %0,%L1,%L2"
13543 [(set_attr "type" "fpcompare")
13544 (set_attr "length" "12")])
13546 (define_insn_and_split "*cmptf_internal2"
13547 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
13548 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "d")
13549 (match_operand:TF 2 "gpc_reg_operand" "d")))
13550 (clobber (match_scratch:DF 3 "=d"))
13551 (clobber (match_scratch:DF 4 "=d"))
13552 (clobber (match_scratch:DF 5 "=d"))
13553 (clobber (match_scratch:DF 6 "=d"))
13554 (clobber (match_scratch:DF 7 "=d"))
13555 (clobber (match_scratch:DF 8 "=d"))
13556 (clobber (match_scratch:DF 9 "=d"))
13557 (clobber (match_scratch:DF 10 "=d"))
13558 (clobber (match_scratch:GPR 11 "=b"))]
13559 "!TARGET_IEEEQUAD && TARGET_XL_COMPAT
13560 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LONG_DOUBLE_128"
13562 "&& reload_completed"
13563 [(set (match_dup 3) (match_dup 14))
13564 (set (match_dup 4) (match_dup 15))
13565 (set (match_dup 9) (abs:DF (match_dup 5)))
13566 (set (match_dup 0) (compare:CCFP (match_dup 9) (match_dup 3)))
13567 (set (pc) (if_then_else (ne (match_dup 0) (const_int 0))
13568 (label_ref (match_dup 12))
13570 (set (match_dup 0) (compare:CCFP (match_dup 5) (match_dup 7)))
13571 (set (pc) (label_ref (match_dup 13)))
13573 (set (match_dup 10) (minus:DF (match_dup 5) (match_dup 7)))
13574 (set (match_dup 9) (minus:DF (match_dup 6) (match_dup 8)))
13575 (set (match_dup 9) (plus:DF (match_dup 10) (match_dup 9)))
13576 (set (match_dup 0) (compare:CCFP (match_dup 9) (match_dup 4)))
13579 REAL_VALUE_TYPE rv;
13580 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
13581 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
13583 operands[5] = simplify_gen_subreg (DFmode, operands[1], TFmode, hi_word);
13584 operands[6] = simplify_gen_subreg (DFmode, operands[1], TFmode, lo_word);
13585 operands[7] = simplify_gen_subreg (DFmode, operands[2], TFmode, hi_word);
13586 operands[8] = simplify_gen_subreg (DFmode, operands[2], TFmode, lo_word);
13587 operands[12] = gen_label_rtx ();
13588 operands[13] = gen_label_rtx ();
13590 operands[14] = force_const_mem (DFmode,
13591 CONST_DOUBLE_FROM_REAL_VALUE (rv, DFmode));
13592 operands[15] = force_const_mem (DFmode,
13593 CONST_DOUBLE_FROM_REAL_VALUE (dconst0,
13598 tocref = create_TOC_reference (XEXP (operands[14], 0), operands[11]);
13599 operands[14] = gen_const_mem (DFmode, tocref);
13600 tocref = create_TOC_reference (XEXP (operands[15], 0), operands[11]);
13601 operands[15] = gen_const_mem (DFmode, tocref);
13602 set_mem_alias_set (operands[14], get_TOC_alias_set ());
13603 set_mem_alias_set (operands[15], get_TOC_alias_set ());
13607 ;; Now we have the scc insns. We can do some combinations because of the
13608 ;; way the machine works.
13610 ;; Note that this is probably faster if we can put an insn between the
13611 ;; mfcr and rlinm, but this is tricky. Let's leave it for now. In most
13612 ;; cases the insns below which don't use an intermediate CR field will
13613 ;; be used instead.
13615 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13616 (match_operator:SI 1 "scc_comparison_operator"
13617 [(match_operand 2 "cc_reg_operand" "y")
13620 "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1"
13621 [(set (attr "type")
13622 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
13623 (const_string "mfcrf")
13625 (const_string "mfcr")))
13626 (set_attr "length" "8")])
13628 ;; Same as above, but get the GT bit.
13629 (define_insn "move_from_CR_gt_bit"
13630 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13631 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_GT))]
13632 "TARGET_HARD_FLOAT && !TARGET_FPRS"
13633 "mfcr %0\;{rlinm|rlwinm} %0,%0,%D1,31,31"
13634 [(set_attr "type" "mfcr")
13635 (set_attr "length" "8")])
13637 ;; Same as above, but get the OV/ORDERED bit.
13638 (define_insn "move_from_CR_ov_bit"
13639 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13640 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_OV))]
13642 "mfcr %0\;{rlinm|rlwinm} %0,%0,%t1,1"
13643 [(set_attr "type" "mfcr")
13644 (set_attr "length" "8")])
13647 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13648 (match_operator:DI 1 "scc_comparison_operator"
13649 [(match_operand 2 "cc_reg_operand" "y")
13652 "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1"
13653 [(set (attr "type")
13654 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
13655 (const_string "mfcrf")
13657 (const_string "mfcr")))
13658 (set_attr "length" "8")])
13661 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13662 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
13663 [(match_operand 2 "cc_reg_operand" "y,y")
13666 (set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
13667 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
13670 mfcr %3%Q2\;{rlinm.|rlwinm.} %3,%3,%J1,1
13672 [(set_attr "type" "delayed_compare")
13673 (set_attr "length" "8,16")])
13676 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13677 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
13678 [(match_operand 2 "cc_reg_operand" "")
13681 (set (match_operand:SI 3 "gpc_reg_operand" "")
13682 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
13683 "TARGET_32BIT && reload_completed"
13684 [(set (match_dup 3)
13685 (match_op_dup 1 [(match_dup 2) (const_int 0)]))
13687 (compare:CC (match_dup 3)
13692 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13693 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
13694 [(match_operand 2 "cc_reg_operand" "y")
13696 (match_operand:SI 3 "const_int_operand" "n")))]
13700 int is_bit = ccr_bit (operands[1], 1);
13701 int put_bit = 31 - (INTVAL (operands[3]) & 31);
13704 if (is_bit >= put_bit)
13705 count = is_bit - put_bit;
13707 count = 32 - (put_bit - is_bit);
13709 operands[4] = GEN_INT (count);
13710 operands[5] = GEN_INT (put_bit);
13712 return \"mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%4,%5,%5\";
13714 [(set (attr "type")
13715 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
13716 (const_string "mfcrf")
13718 (const_string "mfcr")))
13719 (set_attr "length" "8")])
13722 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13724 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
13725 [(match_operand 2 "cc_reg_operand" "y,y")
13727 (match_operand:SI 3 "const_int_operand" "n,n"))
13729 (set (match_operand:SI 4 "gpc_reg_operand" "=r,r")
13730 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
13735 int is_bit = ccr_bit (operands[1], 1);
13736 int put_bit = 31 - (INTVAL (operands[3]) & 31);
13739 /* Force split for non-cc0 compare. */
13740 if (which_alternative == 1)
13743 if (is_bit >= put_bit)
13744 count = is_bit - put_bit;
13746 count = 32 - (put_bit - is_bit);
13748 operands[5] = GEN_INT (count);
13749 operands[6] = GEN_INT (put_bit);
13751 return \"mfcr %4%Q2\;{rlinm.|rlwinm.} %4,%4,%5,%6,%6\";
13753 [(set_attr "type" "delayed_compare")
13754 (set_attr "length" "8,16")])
13757 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
13759 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
13760 [(match_operand 2 "cc_reg_operand" "")
13762 (match_operand:SI 3 "const_int_operand" ""))
13764 (set (match_operand:SI 4 "gpc_reg_operand" "")
13765 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
13768 [(set (match_dup 4)
13769 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
13772 (compare:CC (match_dup 4)
13776 ;; There is a 3 cycle delay between consecutive mfcr instructions
13777 ;; so it is useful to combine 2 scc instructions to use only one mfcr.
13780 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13781 (match_operator:SI 1 "scc_comparison_operator"
13782 [(match_operand 2 "cc_reg_operand" "y")
13784 (set (match_operand:SI 3 "gpc_reg_operand" "=r")
13785 (match_operator:SI 4 "scc_comparison_operator"
13786 [(match_operand 5 "cc_reg_operand" "y")
13788 "REGNO (operands[2]) != REGNO (operands[5])"
13789 "mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
13790 [(set_attr "type" "mfcr")
13791 (set_attr "length" "12")])
13794 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13795 (match_operator:DI 1 "scc_comparison_operator"
13796 [(match_operand 2 "cc_reg_operand" "y")
13798 (set (match_operand:DI 3 "gpc_reg_operand" "=r")
13799 (match_operator:DI 4 "scc_comparison_operator"
13800 [(match_operand 5 "cc_reg_operand" "y")
13802 "TARGET_POWERPC64 && REGNO (operands[2]) != REGNO (operands[5])"
13803 "mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
13804 [(set_attr "type" "mfcr")
13805 (set_attr "length" "12")])
13807 ;; There are some scc insns that can be done directly, without a compare.
13808 ;; These are faster because they don't involve the communications between
13809 ;; the FXU and branch units. In fact, we will be replacing all of the
13810 ;; integer scc insns here or in the portable methods in emit_store_flag.
13812 ;; Also support (neg (scc ..)) since that construct is used to replace
13813 ;; branches, (plus (scc ..) ..) since that construct is common and
13814 ;; takes no more insns than scc, and (and (neg (scc ..)) ..) in the
13815 ;; cases where it is no more expensive than (neg (scc ..)).
13817 ;; Have reload force a constant into a register for the simple insns that
13818 ;; otherwise won't accept constants. We do this because it is faster than
13819 ;; the cmp/mfcr sequence we would otherwise generate.
13821 (define_mode_attr scc_eq_op2 [(SI "rKLI")
13824 (define_insn_and_split "*eq<mode>"
13825 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
13826 (eq:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
13827 (match_operand:GPR 2 "scc_eq_operand" "<scc_eq_op2>")))]
13831 [(set (match_dup 0)
13832 (clz:GPR (match_dup 3)))
13834 (lshiftrt:GPR (match_dup 0) (match_dup 4)))]
13836 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
13838 /* Use output operand as intermediate. */
13839 operands[3] = operands[0];
13841 if (logical_operand (operands[2], <MODE>mode))
13842 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13843 gen_rtx_XOR (<MODE>mode,
13844 operands[1], operands[2])));
13846 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13847 gen_rtx_PLUS (<MODE>mode, operands[1],
13848 negate_rtx (<MODE>mode,
13852 operands[3] = operands[1];
13854 operands[4] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
13857 (define_insn_and_split "*eq<mode>_compare"
13858 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
13860 (eq:P (match_operand:P 1 "gpc_reg_operand" "=r")
13861 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))
13863 (set (match_operand:P 0 "gpc_reg_operand" "=r")
13864 (eq:P (match_dup 1) (match_dup 2)))]
13865 "!TARGET_POWER && optimize_size"
13867 "!TARGET_POWER && optimize_size"
13868 [(set (match_dup 0)
13869 (clz:P (match_dup 4)))
13870 (parallel [(set (match_dup 3)
13871 (compare:CC (lshiftrt:P (match_dup 0) (match_dup 5))
13874 (lshiftrt:P (match_dup 0) (match_dup 5)))])]
13876 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
13878 /* Use output operand as intermediate. */
13879 operands[4] = operands[0];
13881 if (logical_operand (operands[2], <MODE>mode))
13882 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
13883 gen_rtx_XOR (<MODE>mode,
13884 operands[1], operands[2])));
13886 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
13887 gen_rtx_PLUS (<MODE>mode, operands[1],
13888 negate_rtx (<MODE>mode,
13892 operands[4] = operands[1];
13894 operands[5] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
13897 (define_insn "*eqsi_power"
13898 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
13899 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
13900 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I")))
13901 (clobber (match_scratch:SI 3 "=r,&r,r,r,r"))]
13904 xor %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
13905 {sfi|subfic} %3,%1,0\;{ae|adde} %0,%3,%1
13906 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
13907 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
13908 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0"
13909 [(set_attr "type" "three,two,three,three,three")
13910 (set_attr "length" "12,8,12,12,12")])
13912 ;; We have insns of the form shown by the first define_insn below. If
13913 ;; there is something inside the comparison operation, we must split it.
13915 [(set (match_operand:SI 0 "gpc_reg_operand" "")
13916 (plus:SI (match_operator 1 "comparison_operator"
13917 [(match_operand:SI 2 "" "")
13918 (match_operand:SI 3
13919 "reg_or_cint_operand" "")])
13920 (match_operand:SI 4 "gpc_reg_operand" "")))
13921 (clobber (match_operand:SI 5 "register_operand" ""))]
13922 "! gpc_reg_operand (operands[2], SImode)"
13923 [(set (match_dup 5) (match_dup 2))
13924 (set (match_dup 2) (plus:SI (match_op_dup 1 [(match_dup 2) (match_dup 3)])
13927 (define_insn "*plus_eqsi"
13928 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r")
13929 (plus:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
13930 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I"))
13931 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r")))]
13934 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
13935 {sfi|subfic} %0,%1,0\;{aze|addze} %0,%3
13936 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
13937 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
13938 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
13939 [(set_attr "type" "three,two,three,three,three")
13940 (set_attr "length" "12,8,12,12,12")])
13942 (define_insn "*compare_plus_eqsi"
13943 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
13946 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
13947 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
13948 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
13950 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r"))]
13951 "TARGET_32BIT && optimize_size"
13953 xor %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
13954 {sfi|subfic} %4,%1,0\;{aze.|addze.} %4,%3
13955 {xoril|xori} %4,%1,%b2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
13956 {xoriu|xoris} %4,%1,%u2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
13957 {sfi|subfic} %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
13963 [(set_attr "type" "compare")
13964 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
13967 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13970 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
13971 (match_operand:SI 2 "scc_eq_operand" ""))
13972 (match_operand:SI 3 "gpc_reg_operand" ""))
13974 (clobber (match_scratch:SI 4 ""))]
13975 "TARGET_32BIT && optimize_size && reload_completed"
13976 [(set (match_dup 4)
13977 (plus:SI (eq:SI (match_dup 1)
13981 (compare:CC (match_dup 4)
13985 (define_insn "*plus_eqsi_compare"
13986 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
13989 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
13990 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
13991 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
13993 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r")
13994 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13995 "TARGET_32BIT && optimize_size"
13997 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
13998 {sfi|subfic} %0,%1,0\;{aze.|addze.} %0,%3
13999 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
14000 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
14001 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
14007 [(set_attr "type" "compare")
14008 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
14011 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14014 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
14015 (match_operand:SI 2 "scc_eq_operand" ""))
14016 (match_operand:SI 3 "gpc_reg_operand" ""))
14018 (set (match_operand:SI 0 "gpc_reg_operand" "")
14019 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14020 "TARGET_32BIT && optimize_size && reload_completed"
14021 [(set (match_dup 0)
14022 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
14024 (compare:CC (match_dup 0)
14028 (define_insn "*neg_eq0<mode>"
14029 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
14030 (neg:P (eq:P (match_operand:P 1 "gpc_reg_operand" "r")
14033 "{ai|addic} %0,%1,-1\;{sfe|subfe} %0,%0,%0"
14034 [(set_attr "type" "two")
14035 (set_attr "length" "8")])
14037 (define_insn_and_split "*neg_eq<mode>"
14038 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
14039 (neg:P (eq:P (match_operand:P 1 "gpc_reg_operand" "%r")
14040 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))))]
14044 [(set (match_dup 0) (neg:P (eq:P (match_dup 3) (const_int 0))))]
14046 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
14048 /* Use output operand as intermediate. */
14049 operands[3] = operands[0];
14051 if (logical_operand (operands[2], <MODE>mode))
14052 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
14053 gen_rtx_XOR (<MODE>mode,
14054 operands[1], operands[2])));
14056 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
14057 gen_rtx_PLUS (<MODE>mode, operands[1],
14058 negate_rtx (<MODE>mode,
14062 operands[3] = operands[1];
14065 ;; Simplify (ne X (const_int 0)) on the PowerPC. No need to on the Power,
14066 ;; since it nabs/sr is just as fast.
14067 (define_insn "*ne0si"
14068 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
14069 (lshiftrt:SI (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
14071 (clobber (match_scratch:SI 2 "=&r"))]
14072 "! TARGET_POWER && TARGET_32BIT && !TARGET_ISEL"
14073 "{ai|addic} %2,%1,-1\;{sfe|subfe} %0,%2,%1"
14074 [(set_attr "type" "two")
14075 (set_attr "length" "8")])
14077 (define_insn "*ne0di"
14078 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
14079 (lshiftrt:DI (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
14081 (clobber (match_scratch:DI 2 "=&r"))]
14083 "addic %2,%1,-1\;subfe %0,%2,%1"
14084 [(set_attr "type" "two")
14085 (set_attr "length" "8")])
14087 ;; This is what (plus (ne X (const_int 0)) Y) looks like.
14088 (define_insn "*plus_ne0si"
14089 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14090 (plus:SI (lshiftrt:SI
14091 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
14093 (match_operand:SI 2 "gpc_reg_operand" "r")))
14094 (clobber (match_scratch:SI 3 "=&r"))]
14096 "{ai|addic} %3,%1,-1\;{aze|addze} %0,%2"
14097 [(set_attr "type" "two")
14098 (set_attr "length" "8")])
14100 (define_insn "*plus_ne0di"
14101 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
14102 (plus:DI (lshiftrt:DI
14103 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
14105 (match_operand:DI 2 "gpc_reg_operand" "r")))
14106 (clobber (match_scratch:DI 3 "=&r"))]
14108 "addic %3,%1,-1\;addze %0,%2"
14109 [(set_attr "type" "two")
14110 (set_attr "length" "8")])
14112 (define_insn "*compare_plus_ne0si"
14113 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
14115 (plus:SI (lshiftrt:SI
14116 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
14118 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
14120 (clobber (match_scratch:SI 3 "=&r,&r"))
14121 (clobber (match_scratch:SI 4 "=X,&r"))]
14124 {ai|addic} %3,%1,-1\;{aze.|addze.} %3,%2
14126 [(set_attr "type" "compare")
14127 (set_attr "length" "8,12")])
14130 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14132 (plus:SI (lshiftrt:SI
14133 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
14135 (match_operand:SI 2 "gpc_reg_operand" ""))
14137 (clobber (match_scratch:SI 3 ""))
14138 (clobber (match_scratch:SI 4 ""))]
14139 "TARGET_32BIT && reload_completed"
14140 [(parallel [(set (match_dup 3)
14141 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1)))
14144 (clobber (match_dup 4))])
14146 (compare:CC (match_dup 3)
14150 (define_insn "*compare_plus_ne0di"
14151 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
14153 (plus:DI (lshiftrt:DI
14154 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
14156 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
14158 (clobber (match_scratch:DI 3 "=&r,&r"))]
14161 addic %3,%1,-1\;addze. %3,%2
14163 [(set_attr "type" "compare")
14164 (set_attr "length" "8,12")])
14167 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
14169 (plus:DI (lshiftrt:DI
14170 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
14172 (match_operand:DI 2 "gpc_reg_operand" ""))
14174 (clobber (match_scratch:DI 3 ""))]
14175 "TARGET_64BIT && reload_completed"
14176 [(set (match_dup 3)
14177 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1)))
14181 (compare:CC (match_dup 3)
14185 (define_insn "*plus_ne0si_compare"
14186 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
14188 (plus:SI (lshiftrt:SI
14189 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
14191 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
14193 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
14194 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
14196 (clobber (match_scratch:SI 3 "=&r,&r"))]
14199 {ai|addic} %3,%1,-1\;{aze.|addze.} %0,%2
14201 [(set_attr "type" "compare")
14202 (set_attr "length" "8,12")])
14205 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14207 (plus:SI (lshiftrt:SI
14208 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
14210 (match_operand:SI 2 "gpc_reg_operand" ""))
14212 (set (match_operand:SI 0 "gpc_reg_operand" "")
14213 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
14215 (clobber (match_scratch:SI 3 ""))]
14216 "TARGET_32BIT && reload_completed"
14217 [(parallel [(set (match_dup 0)
14218 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
14220 (clobber (match_dup 3))])
14222 (compare:CC (match_dup 0)
14226 (define_insn "*plus_ne0di_compare"
14227 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
14229 (plus:DI (lshiftrt:DI
14230 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
14232 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
14234 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
14235 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
14237 (clobber (match_scratch:DI 3 "=&r,&r"))]
14240 addic %3,%1,-1\;addze. %0,%2
14242 [(set_attr "type" "compare")
14243 (set_attr "length" "8,12")])
14246 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
14248 (plus:DI (lshiftrt:DI
14249 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
14251 (match_operand:DI 2 "gpc_reg_operand" ""))
14253 (set (match_operand:DI 0 "gpc_reg_operand" "")
14254 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
14256 (clobber (match_scratch:DI 3 ""))]
14257 "TARGET_64BIT && reload_completed"
14258 [(parallel [(set (match_dup 0)
14259 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
14261 (clobber (match_dup 3))])
14263 (compare:CC (match_dup 0)
14268 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
14269 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14270 (match_operand:SI 2 "reg_or_short_operand" "r,O")))
14271 (clobber (match_scratch:SI 3 "=r,X"))]
14274 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3
14275 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri|srwi} %0,%0,31"
14276 [(set_attr "length" "12")])
14279 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
14281 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14282 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
14284 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
14285 (le:SI (match_dup 1) (match_dup 2)))
14286 (clobber (match_scratch:SI 3 "=r,X,r,X"))]
14289 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
14290 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri.|srwi.} %0,%0,31
14293 [(set_attr "type" "compare,delayed_compare,compare,delayed_compare")
14294 (set_attr "length" "12,12,16,16")])
14297 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14299 (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
14300 (match_operand:SI 2 "reg_or_short_operand" ""))
14302 (set (match_operand:SI 0 "gpc_reg_operand" "")
14303 (le:SI (match_dup 1) (match_dup 2)))
14304 (clobber (match_scratch:SI 3 ""))]
14305 "TARGET_POWER && reload_completed"
14306 [(parallel [(set (match_dup 0)
14307 (le:SI (match_dup 1) (match_dup 2)))
14308 (clobber (match_dup 3))])
14310 (compare:CC (match_dup 0)
14315 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
14316 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14317 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
14318 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
14321 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
14322 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze|addze} %0,%3"
14323 [(set_attr "length" "12")])
14326 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
14328 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14329 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
14330 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
14332 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
14335 doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
14336 {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze.|addze.} %4,%3
14339 [(set_attr "type" "compare")
14340 (set_attr "length" "12,12,16,16")])
14343 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14345 (plus:SI (le: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 (clobber (match_scratch:SI 4 ""))]
14350 "TARGET_POWER && reload_completed"
14351 [(set (match_dup 4)
14352 (plus:SI (le:SI (match_dup 1) (match_dup 2))
14355 (compare:CC (match_dup 4)
14360 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
14362 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14363 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
14364 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
14366 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
14367 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14370 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
14371 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze.|addze.} %0,%3
14374 [(set_attr "type" "compare")
14375 (set_attr "length" "12,12,16,16")])
14378 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14380 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
14381 (match_operand:SI 2 "reg_or_short_operand" ""))
14382 (match_operand:SI 3 "gpc_reg_operand" ""))
14384 (set (match_operand:SI 0 "gpc_reg_operand" "")
14385 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14386 "TARGET_POWER && reload_completed"
14387 [(set (match_dup 0)
14388 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
14390 (compare:CC (match_dup 0)
14395 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
14396 (neg:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14397 (match_operand:SI 2 "reg_or_short_operand" "r,O"))))]
14400 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
14401 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{srai|srawi} %0,%0,31"
14402 [(set_attr "length" "12")])
14404 (define_insn "*leu<mode>"
14405 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
14406 (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
14407 (match_operand:P 2 "reg_or_short_operand" "rI")))]
14409 "{sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
14410 [(set_attr "type" "three")
14411 (set_attr "length" "12")])
14413 (define_insn "*leu<mode>_compare"
14414 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
14416 (leu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14417 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
14419 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
14420 (leu:P (match_dup 1) (match_dup 2)))]
14423 {sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
14425 [(set_attr "type" "compare")
14426 (set_attr "length" "12,16")])
14429 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
14431 (leu:P (match_operand:P 1 "gpc_reg_operand" "")
14432 (match_operand:P 2 "reg_or_short_operand" ""))
14434 (set (match_operand:P 0 "gpc_reg_operand" "")
14435 (leu:P (match_dup 1) (match_dup 2)))]
14437 [(set (match_dup 0)
14438 (leu:P (match_dup 1) (match_dup 2)))
14440 (compare:CC (match_dup 0)
14444 (define_insn "*plus_leu<mode>"
14445 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
14446 (plus:P (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
14447 (match_operand:P 2 "reg_or_short_operand" "rI"))
14448 (match_operand:P 3 "gpc_reg_operand" "r")))]
14450 "{sf%I2|subf%I2c} %0,%1,%2\;{aze|addze} %0,%3"
14451 [(set_attr "type" "two")
14452 (set_attr "length" "8")])
14455 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
14457 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14458 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14459 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14461 (clobber (match_scratch:SI 4 "=&r,&r"))]
14464 {sf%I2|subf%I2c} %4,%1,%2\;{aze.|addze.} %4,%3
14466 [(set_attr "type" "compare")
14467 (set_attr "length" "8,12")])
14470 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14472 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14473 (match_operand:SI 2 "reg_or_short_operand" ""))
14474 (match_operand:SI 3 "gpc_reg_operand" ""))
14476 (clobber (match_scratch:SI 4 ""))]
14477 "TARGET_32BIT && reload_completed"
14478 [(set (match_dup 4)
14479 (plus:SI (leu:SI (match_dup 1) (match_dup 2))
14482 (compare:CC (match_dup 4)
14487 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
14489 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14490 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14491 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14493 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
14494 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14497 {sf%I2|subf%I2c} %0,%1,%2\;{aze.|addze.} %0,%3
14499 [(set_attr "type" "compare")
14500 (set_attr "length" "8,12")])
14503 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14505 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14506 (match_operand:SI 2 "reg_or_short_operand" ""))
14507 (match_operand:SI 3 "gpc_reg_operand" ""))
14509 (set (match_operand:SI 0 "gpc_reg_operand" "")
14510 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14511 "TARGET_32BIT && reload_completed"
14512 [(set (match_dup 0)
14513 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
14515 (compare:CC (match_dup 0)
14519 (define_insn "*neg_leu<mode>"
14520 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
14521 (neg:P (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
14522 (match_operand:P 2 "reg_or_short_operand" "rI"))))]
14524 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0"
14525 [(set_attr "type" "three")
14526 (set_attr "length" "12")])
14528 (define_insn "*and_neg_leu<mode>"
14529 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
14531 (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
14532 (match_operand:P 2 "reg_or_short_operand" "rI")))
14533 (match_operand:P 3 "gpc_reg_operand" "r")))]
14535 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
14536 [(set_attr "type" "three")
14537 (set_attr "length" "12")])
14540 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
14543 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14544 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
14545 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14547 (clobber (match_scratch:SI 4 "=&r,&r"))]
14550 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
14552 [(set_attr "type" "compare")
14553 (set_attr "length" "12,16")])
14556 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14559 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14560 (match_operand:SI 2 "reg_or_short_operand" "")))
14561 (match_operand:SI 3 "gpc_reg_operand" ""))
14563 (clobber (match_scratch:SI 4 ""))]
14564 "TARGET_32BIT && reload_completed"
14565 [(set (match_dup 4)
14566 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
14569 (compare:CC (match_dup 4)
14574 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
14577 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14578 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
14579 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14581 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
14582 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
14585 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
14587 [(set_attr "type" "compare")
14588 (set_attr "length" "12,16")])
14591 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14594 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14595 (match_operand:SI 2 "reg_or_short_operand" "")))
14596 (match_operand:SI 3 "gpc_reg_operand" ""))
14598 (set (match_operand:SI 0 "gpc_reg_operand" "")
14599 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
14600 "TARGET_32BIT && reload_completed"
14601 [(set (match_dup 0)
14602 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
14605 (compare:CC (match_dup 0)
14610 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14611 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14612 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
14614 "doz%I2 %0,%1,%2\;nabs %0,%0\;{sri|srwi} %0,%0,31"
14615 [(set_attr "length" "12")])
14618 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
14620 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14621 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14623 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
14624 (lt:SI (match_dup 1) (match_dup 2)))]
14627 doz%I2 %0,%1,%2\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
14629 [(set_attr "type" "delayed_compare")
14630 (set_attr "length" "12,16")])
14633 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
14635 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14636 (match_operand:SI 2 "reg_or_short_operand" ""))
14638 (set (match_operand:SI 0 "gpc_reg_operand" "")
14639 (lt:SI (match_dup 1) (match_dup 2)))]
14640 "TARGET_POWER && reload_completed"
14641 [(set (match_dup 0)
14642 (lt:SI (match_dup 1) (match_dup 2)))
14644 (compare:CC (match_dup 0)
14649 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
14650 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14651 (match_operand:SI 2 "reg_or_short_operand" "rI"))
14652 (match_operand:SI 3 "gpc_reg_operand" "r")))]
14654 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
14655 [(set_attr "length" "12")])
14658 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
14660 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14661 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14662 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14664 (clobber (match_scratch:SI 4 "=&r,&r"))]
14667 doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
14669 [(set_attr "type" "compare")
14670 (set_attr "length" "12,16")])
14673 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14675 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14676 (match_operand:SI 2 "reg_or_short_operand" ""))
14677 (match_operand:SI 3 "gpc_reg_operand" ""))
14679 (clobber (match_scratch:SI 4 ""))]
14680 "TARGET_POWER && reload_completed"
14681 [(set (match_dup 4)
14682 (plus:SI (lt:SI (match_dup 1) (match_dup 2))
14685 (compare:CC (match_dup 4)
14690 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
14692 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14693 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14694 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14696 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
14697 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14700 doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
14702 [(set_attr "type" "compare")
14703 (set_attr "length" "12,16")])
14706 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14708 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14709 (match_operand:SI 2 "reg_or_short_operand" ""))
14710 (match_operand:SI 3 "gpc_reg_operand" ""))
14712 (set (match_operand:SI 0 "gpc_reg_operand" "")
14713 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14714 "TARGET_POWER && reload_completed"
14715 [(set (match_dup 0)
14716 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
14718 (compare:CC (match_dup 0)
14723 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14724 (neg:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14725 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
14727 "doz%I2 %0,%1,%2\;nabs %0,%0\;{srai|srawi} %0,%0,31"
14728 [(set_attr "length" "12")])
14730 (define_insn_and_split "*ltu<mode>"
14731 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
14732 (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14733 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))]
14737 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
14738 (set (match_dup 0) (neg:P (match_dup 0)))]
14741 (define_insn_and_split "*ltu<mode>_compare"
14742 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
14744 (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
14745 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
14747 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
14748 (ltu:P (match_dup 1) (match_dup 2)))]
14752 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
14753 (parallel [(set (match_dup 3)
14754 (compare:CC (neg:P (match_dup 0)) (const_int 0)))
14755 (set (match_dup 0) (neg:P (match_dup 0)))])]
14758 (define_insn_and_split "*plus_ltu<mode>"
14759 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,r")
14760 (plus:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14761 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))
14762 (match_operand:P 3 "reg_or_short_operand" "rI,rI")))]
14765 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
14766 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
14767 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))]
14770 (define_insn_and_split "*plus_ltu<mode>_compare"
14771 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
14773 (plus:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
14774 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
14775 (match_operand:P 3 "gpc_reg_operand" "r,r,r,r"))
14777 (set (match_operand:P 0 "gpc_reg_operand" "=&r,&r,&r,&r")
14778 (plus:P (ltu:P (match_dup 1) (match_dup 2)) (match_dup 3)))]
14781 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
14782 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
14783 (parallel [(set (match_dup 4)
14784 (compare:CC (minus:P (match_dup 3) (match_dup 0))
14786 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))])]
14789 (define_insn "*neg_ltu<mode>"
14790 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
14791 (neg:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14792 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))))]
14795 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0
14796 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0"
14797 [(set_attr "type" "two")
14798 (set_attr "length" "8")])
14801 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14802 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14803 (match_operand:SI 2 "reg_or_short_operand" "rI")))
14804 (clobber (match_scratch:SI 3 "=r"))]
14806 "doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3"
14807 [(set_attr "length" "12")])
14810 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
14812 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14813 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14815 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
14816 (ge:SI (match_dup 1) (match_dup 2)))
14817 (clobber (match_scratch:SI 3 "=r,r"))]
14820 doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
14822 [(set_attr "type" "compare")
14823 (set_attr "length" "12,16")])
14826 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14828 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
14829 (match_operand:SI 2 "reg_or_short_operand" ""))
14831 (set (match_operand:SI 0 "gpc_reg_operand" "")
14832 (ge:SI (match_dup 1) (match_dup 2)))
14833 (clobber (match_scratch:SI 3 ""))]
14834 "TARGET_POWER && reload_completed"
14835 [(parallel [(set (match_dup 0)
14836 (ge:SI (match_dup 1) (match_dup 2)))
14837 (clobber (match_dup 3))])
14839 (compare:CC (match_dup 0)
14844 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
14845 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14846 (match_operand:SI 2 "reg_or_short_operand" "rI"))
14847 (match_operand:SI 3 "gpc_reg_operand" "r")))]
14849 "doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
14850 [(set_attr "length" "12")])
14853 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
14855 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14856 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14857 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14859 (clobber (match_scratch:SI 4 "=&r,&r"))]
14862 doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
14864 [(set_attr "type" "compare")
14865 (set_attr "length" "12,16")])
14868 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14870 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
14871 (match_operand:SI 2 "reg_or_short_operand" ""))
14872 (match_operand:SI 3 "gpc_reg_operand" ""))
14874 (clobber (match_scratch:SI 4 ""))]
14875 "TARGET_POWER && reload_completed"
14876 [(set (match_dup 4)
14877 (plus:SI (ge:SI (match_dup 1) (match_dup 2))
14880 (compare:CC (match_dup 4)
14885 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
14887 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14888 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14889 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14891 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
14892 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14895 doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
14897 [(set_attr "type" "compare")
14898 (set_attr "length" "12,16")])
14901 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14903 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
14904 (match_operand:SI 2 "reg_or_short_operand" ""))
14905 (match_operand:SI 3 "gpc_reg_operand" ""))
14907 (set (match_operand:SI 0 "gpc_reg_operand" "")
14908 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14909 "TARGET_POWER && reload_completed"
14910 [(set (match_dup 0)
14911 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
14913 (compare:CC (match_dup 0)
14918 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14919 (neg:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14920 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
14922 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
14923 [(set_attr "length" "12")])
14925 (define_insn "*geu<mode>"
14926 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
14927 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14928 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))]
14931 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0
14932 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
14933 [(set_attr "type" "three")
14934 (set_attr "length" "12")])
14936 (define_insn "*geu<mode>_compare"
14937 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
14939 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
14940 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
14942 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
14943 (geu:P (match_dup 1) (match_dup 2)))]
14946 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
14947 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
14950 [(set_attr "type" "compare")
14951 (set_attr "length" "12,12,16,16")])
14954 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
14956 (geu:P (match_operand:P 1 "gpc_reg_operand" "")
14957 (match_operand:P 2 "reg_or_neg_short_operand" ""))
14959 (set (match_operand:P 0 "gpc_reg_operand" "")
14960 (geu:P (match_dup 1) (match_dup 2)))]
14962 [(set (match_dup 0)
14963 (geu:P (match_dup 1) (match_dup 2)))
14965 (compare:CC (match_dup 0)
14969 (define_insn "*plus_geu<mode>"
14970 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,&r")
14971 (plus:P (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14972 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))
14973 (match_operand:P 3 "gpc_reg_operand" "r,r")))]
14976 {sf|subfc} %0,%2,%1\;{aze|addze} %0,%3
14977 {ai|addic} %0,%1,%n2\;{aze|addze} %0,%3"
14978 [(set_attr "type" "two")
14979 (set_attr "length" "8")])
14982 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
14984 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14985 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
14986 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
14988 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
14991 {sf|subfc} %4,%2,%1\;{aze.|addze.} %4,%3
14992 {ai|addic} %4,%1,%n2\;{aze.|addze.} %4,%3
14995 [(set_attr "type" "compare")
14996 (set_attr "length" "8,8,12,12")])
14999 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
15001 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
15002 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
15003 (match_operand:SI 3 "gpc_reg_operand" ""))
15005 (clobber (match_scratch:SI 4 ""))]
15006 "TARGET_32BIT && reload_completed"
15007 [(set (match_dup 4)
15008 (plus:SI (geu:SI (match_dup 1) (match_dup 2))
15011 (compare:CC (match_dup 4)
15016 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
15018 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
15019 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
15020 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
15022 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
15023 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
15026 {sf|subfc} %0,%2,%1\;{aze.|addze.} %0,%3
15027 {ai|addic} %0,%1,%n2\;{aze.|addze.} %0,%3
15030 [(set_attr "type" "compare")
15031 (set_attr "length" "8,8,12,12")])
15034 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
15036 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
15037 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
15038 (match_operand:SI 3 "gpc_reg_operand" ""))
15040 (set (match_operand:SI 0 "gpc_reg_operand" "")
15041 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
15042 "TARGET_32BIT && reload_completed"
15043 [(set (match_dup 0)
15044 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
15046 (compare:CC (match_dup 0)
15050 (define_insn "*neg_geu<mode>"
15051 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
15052 (neg:P (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
15053 (match_operand:P 2 "reg_or_short_operand" "r,I"))))]
15056 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0
15057 {sfi|subfic} %0,%1,-1\;{a%I2|add%I2c} %0,%0,%2\;{sfe|subfe} %0,%0,%0"
15058 [(set_attr "type" "three")
15059 (set_attr "length" "12")])
15061 (define_insn "*and_neg_geu<mode>"
15062 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,&r")
15064 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
15065 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))
15066 (match_operand:P 3 "gpc_reg_operand" "r,r")))]
15069 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0
15070 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
15071 [(set_attr "type" "three")
15072 (set_attr "length" "12")])
15075 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
15078 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
15079 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
15080 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
15082 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
15085 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
15086 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
15089 [(set_attr "type" "compare")
15090 (set_attr "length" "12,12,16,16")])
15093 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
15096 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
15097 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
15098 (match_operand:SI 3 "gpc_reg_operand" ""))
15100 (clobber (match_scratch:SI 4 ""))]
15101 "TARGET_32BIT && reload_completed"
15102 [(set (match_dup 4)
15103 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2)))
15106 (compare:CC (match_dup 4)
15111 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
15114 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
15115 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
15116 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
15118 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
15119 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
15122 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
15123 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
15126 [(set_attr "type" "compare")
15127 (set_attr "length" "12,12,16,16")])
15130 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
15133 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
15134 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
15135 (match_operand:SI 3 "gpc_reg_operand" ""))
15137 (set (match_operand:SI 0 "gpc_reg_operand" "")
15138 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
15139 "TARGET_32BIT && reload_completed"
15140 [(set (match_dup 0)
15141 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
15143 (compare:CC (match_dup 0)
15148 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
15149 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
15150 (match_operand:SI 2 "reg_or_short_operand" "r")))]
15152 "doz %0,%2,%1\;nabs %0,%0\;{sri|srwi} %0,%0,31"
15153 [(set_attr "length" "12")])
15156 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
15158 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
15159 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
15161 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
15162 (gt:SI (match_dup 1) (match_dup 2)))]
15165 doz %0,%2,%1\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
15167 [(set_attr "type" "delayed_compare")
15168 (set_attr "length" "12,16")])
15171 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
15173 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
15174 (match_operand:SI 2 "reg_or_short_operand" ""))
15176 (set (match_operand:SI 0 "gpc_reg_operand" "")
15177 (gt:SI (match_dup 1) (match_dup 2)))]
15178 "TARGET_POWER && reload_completed"
15179 [(set (match_dup 0)
15180 (gt:SI (match_dup 1) (match_dup 2)))
15182 (compare:CC (match_dup 0)
15186 (define_insn "*plus_gt0<mode>"
15187 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
15188 (plus:P (gt:P (match_operand:P 1 "gpc_reg_operand" "r")
15190 (match_operand:P 2 "gpc_reg_operand" "r")))]
15192 "{a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze|addze} %0,%2"
15193 [(set_attr "type" "three")
15194 (set_attr "length" "12")])
15197 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
15199 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
15201 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
15203 (clobber (match_scratch:SI 3 "=&r,&r"))]
15206 {a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze.|addze.} %3,%2
15208 [(set_attr "type" "compare")
15209 (set_attr "length" "12,16")])
15212 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
15214 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
15216 (match_operand:SI 2 "gpc_reg_operand" ""))
15218 (clobber (match_scratch:SI 3 ""))]
15219 "TARGET_32BIT && reload_completed"
15220 [(set (match_dup 3)
15221 (plus:SI (gt:SI (match_dup 1) (const_int 0))
15224 (compare:CC (match_dup 3)
15229 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
15231 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
15233 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
15235 (clobber (match_scratch:DI 3 "=&r,&r"))]
15238 addc %3,%1,%1\;subfe %3,%1,%3\;addze. %3,%2
15240 [(set_attr "type" "compare")
15241 (set_attr "length" "12,16")])
15244 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
15246 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
15248 (match_operand:DI 2 "gpc_reg_operand" ""))
15250 (clobber (match_scratch:DI 3 ""))]
15251 "TARGET_64BIT && reload_completed"
15252 [(set (match_dup 3)
15253 (plus:DI (gt:DI (match_dup 1) (const_int 0))
15256 (compare:CC (match_dup 3)
15261 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
15263 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
15265 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
15267 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
15268 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
15271 {a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze.|addze.} %0,%2
15273 [(set_attr "type" "compare")
15274 (set_attr "length" "12,16")])
15277 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
15279 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
15281 (match_operand:SI 2 "gpc_reg_operand" ""))
15283 (set (match_operand:SI 0 "gpc_reg_operand" "")
15284 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
15285 "TARGET_32BIT && reload_completed"
15286 [(set (match_dup 0)
15287 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))
15289 (compare:CC (match_dup 0)
15294 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
15296 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
15298 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
15300 (set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
15301 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
15304 addc %0,%1,%1\;subfe %0,%1,%0\;addze. %0,%2
15306 [(set_attr "type" "compare")
15307 (set_attr "length" "12,16")])
15310 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
15312 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
15314 (match_operand:DI 2 "gpc_reg_operand" ""))
15316 (set (match_operand:DI 0 "gpc_reg_operand" "")
15317 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
15318 "TARGET_64BIT && reload_completed"
15319 [(set (match_dup 0)
15320 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))
15322 (compare:CC (match_dup 0)
15327 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
15328 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
15329 (match_operand:SI 2 "reg_or_short_operand" "r"))
15330 (match_operand:SI 3 "gpc_reg_operand" "r")))]
15332 "doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
15333 [(set_attr "length" "12")])
15336 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
15338 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
15339 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
15340 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
15342 (clobber (match_scratch:SI 4 "=&r,&r"))]
15345 doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
15347 [(set_attr "type" "compare")
15348 (set_attr "length" "12,16")])
15351 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
15353 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
15354 (match_operand:SI 2 "reg_or_short_operand" ""))
15355 (match_operand:SI 3 "gpc_reg_operand" ""))
15357 (clobber (match_scratch:SI 4 ""))]
15358 "TARGET_POWER && reload_completed"
15359 [(set (match_dup 4)
15360 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
15362 (compare:CC (match_dup 4)
15367 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
15369 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
15370 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
15371 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
15373 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
15374 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
15377 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
15379 [(set_attr "type" "compare")
15380 (set_attr "length" "12,16")])
15383 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
15385 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
15386 (match_operand:SI 2 "reg_or_short_operand" ""))
15387 (match_operand:SI 3 "gpc_reg_operand" ""))
15389 (set (match_operand:SI 0 "gpc_reg_operand" "")
15390 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
15391 "TARGET_POWER && reload_completed"
15392 [(set (match_dup 0)
15393 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
15395 (compare:CC (match_dup 0)
15400 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
15401 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
15402 (match_operand:SI 2 "reg_or_short_operand" "r"))))]
15404 "doz %0,%2,%1\;nabs %0,%0\;{srai|srawi} %0,%0,31"
15405 [(set_attr "length" "12")])
15407 (define_insn_and_split "*gtu<mode>"
15408 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
15409 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
15410 (match_operand:P 2 "reg_or_short_operand" "rI")))]
15414 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
15415 (set (match_dup 0) (neg:P (match_dup 0)))]
15418 (define_insn_and_split "*gtu<mode>_compare"
15419 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
15421 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
15422 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
15424 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
15425 (gtu:P (match_dup 1) (match_dup 2)))]
15429 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
15430 (parallel [(set (match_dup 3)
15431 (compare:CC (neg:P (match_dup 0)) (const_int 0)))
15432 (set (match_dup 0) (neg:P (match_dup 0)))])]
15435 (define_insn_and_split "*plus_gtu<mode>"
15436 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
15437 (plus:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
15438 (match_operand:P 2 "reg_or_short_operand" "rI"))
15439 (match_operand:P 3 "reg_or_short_operand" "rI")))]
15442 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
15443 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
15444 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))]
15447 (define_insn_and_split "*plus_gtu<mode>_compare"
15448 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
15450 (plus:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
15451 (match_operand:P 2 "reg_or_short_operand" "I,r,I,r"))
15452 (match_operand:P 3 "gpc_reg_operand" "r,r,r,r"))
15454 (set (match_operand:P 0 "gpc_reg_operand" "=&r,&r,&r,&r")
15455 (plus:P (gtu:P (match_dup 1) (match_dup 2)) (match_dup 3)))]
15458 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
15459 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
15460 (parallel [(set (match_dup 4)
15461 (compare:CC (minus:P (match_dup 3) (match_dup 0))
15463 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))])]
15466 (define_insn "*neg_gtu<mode>"
15467 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
15468 (neg:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
15469 (match_operand:P 2 "reg_or_short_operand" "rI"))))]
15471 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0"
15472 [(set_attr "type" "two")
15473 (set_attr "length" "8")])
15476 ;; Define both directions of branch and return. If we need a reload
15477 ;; register, we'd rather use CR0 since it is much easier to copy a
15478 ;; register CC value to there.
15482 (if_then_else (match_operator 1 "branch_comparison_operator"
15484 "cc_reg_operand" "y")
15486 (label_ref (match_operand 0 "" ""))
15491 return output_cbranch (operands[1], \"%l0\", 0, insn);
15493 [(set_attr "type" "branch")])
15497 (if_then_else (match_operator 0 "branch_comparison_operator"
15499 "cc_reg_operand" "y")
15506 return output_cbranch (operands[0], NULL, 0, insn);
15508 [(set_attr "type" "jmpreg")
15509 (set_attr "length" "4")])
15513 (if_then_else (match_operator 1 "branch_comparison_operator"
15515 "cc_reg_operand" "y")
15518 (label_ref (match_operand 0 "" ""))))]
15522 return output_cbranch (operands[1], \"%l0\", 1, insn);
15524 [(set_attr "type" "branch")])
15528 (if_then_else (match_operator 0 "branch_comparison_operator"
15530 "cc_reg_operand" "y")
15537 return output_cbranch (operands[0], NULL, 1, insn);
15539 [(set_attr "type" "jmpreg")
15540 (set_attr "length" "4")])
15542 ;; Logic on condition register values.
15544 ; This pattern matches things like
15545 ; (set (reg:CCEQ 68) (compare:CCEQ (ior:SI (gt:SI (reg:CCFP 68) (const_int 0))
15546 ; (eq:SI (reg:CCFP 68) (const_int 0)))
15548 ; which are generated by the branch logic.
15549 ; Prefer destructive operations where BT = BB (for crXX BT,BA,BB)
15551 (define_insn "*cceq_ior_compare"
15552 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
15553 (compare:CCEQ (match_operator:SI 1 "boolean_operator"
15554 [(match_operator:SI 2
15555 "branch_positive_comparison_operator"
15557 "cc_reg_operand" "y,y")
15559 (match_operator:SI 4
15560 "branch_positive_comparison_operator"
15562 "cc_reg_operand" "0,y")
15566 "cr%q1 %E0,%j2,%j4"
15567 [(set_attr "type" "cr_logical,delayed_cr")])
15569 ; Why is the constant -1 here, but 1 in the previous pattern?
15570 ; Because ~1 has all but the low bit set.
15572 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
15573 (compare:CCEQ (match_operator:SI 1 "boolean_or_operator"
15574 [(not:SI (match_operator:SI 2
15575 "branch_positive_comparison_operator"
15577 "cc_reg_operand" "y,y")
15579 (match_operator:SI 4
15580 "branch_positive_comparison_operator"
15582 "cc_reg_operand" "0,y")
15586 "cr%q1 %E0,%j2,%j4"
15587 [(set_attr "type" "cr_logical,delayed_cr")])
15589 (define_insn "*cceq_rev_compare"
15590 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
15591 (compare:CCEQ (match_operator:SI 1
15592 "branch_positive_comparison_operator"
15594 "cc_reg_operand" "0,y")
15598 "{crnor %E0,%j1,%j1|crnot %E0,%j1}"
15599 [(set_attr "type" "cr_logical,delayed_cr")])
15601 ;; If we are comparing the result of two comparisons, this can be done
15602 ;; using creqv or crxor.
15604 (define_insn_and_split ""
15605 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
15606 (compare:CCEQ (match_operator 1 "branch_comparison_operator"
15607 [(match_operand 2 "cc_reg_operand" "y")
15609 (match_operator 3 "branch_comparison_operator"
15610 [(match_operand 4 "cc_reg_operand" "y")
15615 [(set (match_dup 0) (compare:CCEQ (xor:SI (match_dup 1) (match_dup 3))
15619 int positive_1, positive_2;
15621 positive_1 = branch_positive_comparison_operator (operands[1],
15622 GET_MODE (operands[1]));
15623 positive_2 = branch_positive_comparison_operator (operands[3],
15624 GET_MODE (operands[3]));
15627 operands[1] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[2]),
15628 GET_CODE (operands[1])),
15630 operands[2], const0_rtx);
15631 else if (GET_MODE (operands[1]) != SImode)
15632 operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]), SImode,
15633 operands[2], const0_rtx);
15636 operands[3] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[4]),
15637 GET_CODE (operands[3])),
15639 operands[4], const0_rtx);
15640 else if (GET_MODE (operands[3]) != SImode)
15641 operands[3] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
15642 operands[4], const0_rtx);
15644 if (positive_1 == positive_2)
15646 operands[1] = gen_rtx_NOT (SImode, operands[1]);
15647 operands[5] = constm1_rtx;
15651 operands[5] = const1_rtx;
15655 ;; Unconditional branch and return.
15657 (define_insn "jump"
15659 (label_ref (match_operand 0 "" "")))]
15662 [(set_attr "type" "branch")])
15664 (define_insn "return"
15668 [(set_attr "type" "jmpreg")])
15670 (define_expand "indirect_jump"
15671 [(set (pc) (match_operand 0 "register_operand" ""))])
15673 (define_insn "*indirect_jump<mode>"
15674 [(set (pc) (match_operand:P 0 "register_operand" "c,*l"))]
15679 [(set_attr "type" "jmpreg")])
15681 ;; Table jump for switch statements:
15682 (define_expand "tablejump"
15683 [(use (match_operand 0 "" ""))
15684 (use (label_ref (match_operand 1 "" "")))]
15689 emit_jump_insn (gen_tablejumpsi (operands[0], operands[1]));
15691 emit_jump_insn (gen_tablejumpdi (operands[0], operands[1]));
15695 (define_expand "tablejumpsi"
15696 [(set (match_dup 3)
15697 (plus:SI (match_operand:SI 0 "" "")
15699 (parallel [(set (pc) (match_dup 3))
15700 (use (label_ref (match_operand 1 "" "")))])]
15703 { operands[0] = force_reg (SImode, operands[0]);
15704 operands[2] = force_reg (SImode, gen_rtx_LABEL_REF (SImode, operands[1]));
15705 operands[3] = gen_reg_rtx (SImode);
15708 (define_expand "tablejumpdi"
15709 [(set (match_dup 4)
15710 (sign_extend:DI (match_operand:SI 0 "lwa_operand" "")))
15712 (plus:DI (match_dup 4)
15714 (parallel [(set (pc) (match_dup 3))
15715 (use (label_ref (match_operand 1 "" "")))])]
15718 { operands[2] = force_reg (DImode, gen_rtx_LABEL_REF (DImode, operands[1]));
15719 operands[3] = gen_reg_rtx (DImode);
15720 operands[4] = gen_reg_rtx (DImode);
15723 (define_insn "*tablejump<mode>_internal1"
15725 (match_operand:P 0 "register_operand" "c,*l"))
15726 (use (label_ref (match_operand 1 "" "")))]
15731 [(set_attr "type" "jmpreg")])
15736 "{cror 0,0,0|nop}")
15738 ;; Define the subtract-one-and-jump insns, starting with the template
15739 ;; so loop.c knows what to generate.
15741 (define_expand "doloop_end"
15742 [(use (match_operand 0 "" "")) ; loop pseudo
15743 (use (match_operand 1 "" "")) ; iterations; zero if unknown
15744 (use (match_operand 2 "" "")) ; max iterations
15745 (use (match_operand 3 "" "")) ; loop level
15746 (use (match_operand 4 "" ""))] ; label
15750 /* Only use this on innermost loops. */
15751 if (INTVAL (operands[3]) > 1)
15755 if (GET_MODE (operands[0]) != DImode)
15757 emit_jump_insn (gen_ctrdi (operands[0], operands[4]));
15761 if (GET_MODE (operands[0]) != SImode)
15763 emit_jump_insn (gen_ctrsi (operands[0], operands[4]));
15768 (define_expand "ctr<mode>"
15769 [(parallel [(set (pc)
15770 (if_then_else (ne (match_operand:P 0 "register_operand" "")
15772 (label_ref (match_operand 1 "" ""))
15775 (plus:P (match_dup 0)
15777 (clobber (match_scratch:CC 2 ""))
15778 (clobber (match_scratch:P 3 ""))])]
15782 ;; We need to be able to do this for any operand, including MEM, or we
15783 ;; will cause reload to blow up since we don't allow output reloads on
15785 ;; For the length attribute to be calculated correctly, the
15786 ;; label MUST be operand 0.
15788 (define_insn "*ctr<mode>_internal1"
15790 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
15792 (label_ref (match_operand 0 "" ""))
15794 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
15795 (plus:P (match_dup 1)
15797 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
15798 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
15802 if (which_alternative != 0)
15804 else if (get_attr_length (insn) == 4)
15805 return \"{bdn|bdnz} %l0\";
15807 return \"bdz $+8\;b %l0\";
15809 [(set_attr "type" "branch")
15810 (set_attr "length" "*,12,16,16")])
15812 (define_insn "*ctr<mode>_internal2"
15814 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
15817 (label_ref (match_operand 0 "" ""))))
15818 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
15819 (plus:P (match_dup 1)
15821 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
15822 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
15826 if (which_alternative != 0)
15828 else if (get_attr_length (insn) == 4)
15829 return \"bdz %l0\";
15831 return \"{bdn|bdnz} $+8\;b %l0\";
15833 [(set_attr "type" "branch")
15834 (set_attr "length" "*,12,16,16")])
15836 ;; Similar but use EQ
15838 (define_insn "*ctr<mode>_internal5"
15840 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
15842 (label_ref (match_operand 0 "" ""))
15844 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
15845 (plus:P (match_dup 1)
15847 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
15848 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
15852 if (which_alternative != 0)
15854 else if (get_attr_length (insn) == 4)
15855 return \"bdz %l0\";
15857 return \"{bdn|bdnz} $+8\;b %l0\";
15859 [(set_attr "type" "branch")
15860 (set_attr "length" "*,12,16,16")])
15862 (define_insn "*ctr<mode>_internal6"
15864 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
15867 (label_ref (match_operand 0 "" ""))))
15868 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
15869 (plus:P (match_dup 1)
15871 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
15872 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
15876 if (which_alternative != 0)
15878 else if (get_attr_length (insn) == 4)
15879 return \"{bdn|bdnz} %l0\";
15881 return \"bdz $+8\;b %l0\";
15883 [(set_attr "type" "branch")
15884 (set_attr "length" "*,12,16,16")])
15886 ;; Now the splitters if we could not allocate the CTR register
15890 (if_then_else (match_operator 2 "comparison_operator"
15891 [(match_operand:P 1 "gpc_reg_operand" "")
15893 (match_operand 5 "" "")
15894 (match_operand 6 "" "")))
15895 (set (match_operand:P 0 "gpc_reg_operand" "")
15896 (plus:P (match_dup 1) (const_int -1)))
15897 (clobber (match_scratch:CC 3 ""))
15898 (clobber (match_scratch:P 4 ""))]
15900 [(parallel [(set (match_dup 3)
15901 (compare:CC (plus:P (match_dup 1)
15905 (plus:P (match_dup 1)
15907 (set (pc) (if_then_else (match_dup 7)
15911 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
15912 operands[3], const0_rtx); }")
15916 (if_then_else (match_operator 2 "comparison_operator"
15917 [(match_operand:P 1 "gpc_reg_operand" "")
15919 (match_operand 5 "" "")
15920 (match_operand 6 "" "")))
15921 (set (match_operand:P 0 "nonimmediate_operand" "")
15922 (plus:P (match_dup 1) (const_int -1)))
15923 (clobber (match_scratch:CC 3 ""))
15924 (clobber (match_scratch:P 4 ""))]
15925 "reload_completed && ! gpc_reg_operand (operands[0], SImode)"
15926 [(parallel [(set (match_dup 3)
15927 (compare:CC (plus:P (match_dup 1)
15931 (plus:P (match_dup 1)
15935 (set (pc) (if_then_else (match_dup 7)
15939 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
15940 operands[3], const0_rtx); }")
15942 (define_insn "trap"
15943 [(trap_if (const_int 1) (const_int 0))]
15946 [(set_attr "type" "trap")])
15948 (define_expand "ctrap<mode>4"
15949 [(trap_if (match_operator 0 "ordered_comparison_operator"
15950 [(match_operand:GPR 1 "register_operand")
15951 (match_operand:GPR 2 "reg_or_short_operand")])
15952 (match_operand 3 "zero_constant" ""))]
15957 [(trap_if (match_operator 0 "ordered_comparison_operator"
15958 [(match_operand:GPR 1 "register_operand" "r")
15959 (match_operand:GPR 2 "reg_or_short_operand" "rI")])
15962 "{t|t<wd>}%V0%I2 %1,%2"
15963 [(set_attr "type" "trap")])
15965 ;; Insns related to generating the function prologue and epilogue.
15967 (define_expand "prologue"
15968 [(use (const_int 0))]
15969 "TARGET_SCHED_PROLOG"
15972 rs6000_emit_prologue ();
15976 (define_insn "*movesi_from_cr_one"
15977 [(match_parallel 0 "mfcr_operation"
15978 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
15979 (unspec:SI [(match_operand:CC 2 "cc_reg_operand" "y")
15980 (match_operand 3 "immediate_operand" "n")]
15981 UNSPEC_MOVESI_FROM_CR))])]
15987 for (i = 0; i < XVECLEN (operands[0], 0); i++)
15989 mask = INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
15990 operands[4] = GEN_INT (mask);
15991 output_asm_insn (\"mfcr %1,%4\", operands);
15995 [(set_attr "type" "mfcrf")])
15997 (define_insn "movesi_from_cr"
15998 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
15999 (unspec:SI [(reg:CC CR0_REGNO) (reg:CC CR1_REGNO)
16000 (reg:CC CR2_REGNO) (reg:CC CR3_REGNO)
16001 (reg:CC CR4_REGNO) (reg:CC CR5_REGNO)
16002 (reg:CC CR6_REGNO) (reg:CC CR7_REGNO)]
16003 UNSPEC_MOVESI_FROM_CR))]
16006 [(set_attr "type" "mfcr")])
16008 (define_insn "*stmw"
16009 [(match_parallel 0 "stmw_operation"
16010 [(set (match_operand:SI 1 "memory_operand" "=m")
16011 (match_operand:SI 2 "gpc_reg_operand" "r"))])]
16014 [(set_attr "type" "store_ux")])
16016 (define_insn "*save_gpregs_<mode>"
16017 [(match_parallel 0 "any_parallel_operand"
16018 [(clobber (reg:P 65))
16019 (use (match_operand:P 1 "symbol_ref_operand" "s"))
16020 (use (match_operand:P 2 "gpc_reg_operand" "r"))
16021 (set (match_operand:P 3 "memory_operand" "=m")
16022 (match_operand:P 4 "gpc_reg_operand" "r"))])]
16025 [(set_attr "type" "branch")
16026 (set_attr "length" "4")])
16028 (define_insn "*save_fpregs_<mode>"
16029 [(match_parallel 0 "any_parallel_operand"
16030 [(clobber (reg:P 65))
16031 (use (match_operand:P 1 "symbol_ref_operand" "s"))
16032 (use (match_operand:P 2 "gpc_reg_operand" "r"))
16033 (set (match_operand:DF 3 "memory_operand" "=m")
16034 (match_operand:DF 4 "gpc_reg_operand" "d"))])]
16037 [(set_attr "type" "branch")
16038 (set_attr "length" "4")])
16040 ; These are to explain that changes to the stack pointer should
16041 ; not be moved over stores to stack memory.
16042 (define_insn "stack_tie"
16043 [(set (match_operand:BLK 0 "memory_operand" "+m")
16044 (unspec:BLK [(match_dup 0)] UNSPEC_TIE))]
16047 [(set_attr "length" "0")])
16049 ; Like stack_tie, but depend on both fp and sp based memory.
16050 (define_insn "frame_tie"
16051 [(set (match_operand:BLK 0 "memory_operand" "+m")
16052 (unspec:BLK [(match_dup 0)
16053 (match_operand:BLK 1 "memory_operand" "m")] UNSPEC_TIE))]
16056 [(set_attr "length" "0")])
16059 (define_expand "epilogue"
16060 [(use (const_int 0))]
16061 "TARGET_SCHED_PROLOG"
16064 rs6000_emit_epilogue (FALSE);
16068 ; On some processors, doing the mtcrf one CC register at a time is
16069 ; faster (like on the 604e). On others, doing them all at once is
16070 ; faster; for instance, on the 601 and 750.
16072 (define_expand "movsi_to_cr_one"
16073 [(set (match_operand:CC 0 "cc_reg_operand" "")
16074 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "")
16075 (match_dup 2)] UNSPEC_MOVESI_TO_CR))]
16077 "operands[2] = GEN_INT (1 << (75 - REGNO (operands[0])));")
16079 (define_insn "*movsi_to_cr"
16080 [(match_parallel 0 "mtcrf_operation"
16081 [(set (match_operand:CC 1 "cc_reg_operand" "=y")
16082 (unspec:CC [(match_operand:SI 2 "gpc_reg_operand" "r")
16083 (match_operand 3 "immediate_operand" "n")]
16084 UNSPEC_MOVESI_TO_CR))])]
16090 for (i = 0; i < XVECLEN (operands[0], 0); i++)
16091 mask |= INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
16092 operands[4] = GEN_INT (mask);
16093 return \"mtcrf %4,%2\";
16095 [(set_attr "type" "mtcr")])
16097 (define_insn "*mtcrfsi"
16098 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
16099 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
16100 (match_operand 2 "immediate_operand" "n")]
16101 UNSPEC_MOVESI_TO_CR))]
16102 "GET_CODE (operands[0]) == REG
16103 && CR_REGNO_P (REGNO (operands[0]))
16104 && GET_CODE (operands[2]) == CONST_INT
16105 && INTVAL (operands[2]) == 1 << (75 - REGNO (operands[0]))"
16107 [(set_attr "type" "mtcr")])
16109 ; The load-multiple instructions have similar properties.
16110 ; Note that "load_multiple" is a name known to the machine-independent
16111 ; code that actually corresponds to the PowerPC load-string.
16113 (define_insn "*lmw"
16114 [(match_parallel 0 "lmw_operation"
16115 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
16116 (match_operand:SI 2 "memory_operand" "m"))])]
16119 [(set_attr "type" "load_ux")
16120 (set_attr "cell_micro" "always")])
16122 (define_insn "*return_internal_<mode>"
16124 (use (match_operand:P 0 "register_operand" "lc"))]
16127 [(set_attr "type" "jmpreg")])
16129 ; FIXME: This would probably be somewhat simpler if the Cygnus sibcall
16130 ; stuff was in GCC. Oh, and "any_parallel_operand" is a bit flexible...
16132 (define_insn "*restore_gpregs_<mode>"
16133 [(match_parallel 0 "any_parallel_operand"
16134 [(clobber (match_operand:P 1 "register_operand" "=l"))
16135 (use (match_operand:P 2 "symbol_ref_operand" "s"))
16136 (use (match_operand:P 3 "gpc_reg_operand" "r"))
16137 (set (match_operand:P 4 "gpc_reg_operand" "=r")
16138 (match_operand:P 5 "memory_operand" "m"))])]
16141 [(set_attr "type" "branch")
16142 (set_attr "length" "4")])
16144 (define_insn "*return_and_restore_gpregs_<mode>"
16145 [(match_parallel 0 "any_parallel_operand"
16147 (clobber (match_operand:P 1 "register_operand" "=l"))
16148 (use (match_operand:P 2 "symbol_ref_operand" "s"))
16149 (use (match_operand:P 3 "gpc_reg_operand" "r"))
16150 (set (match_operand:P 4 "gpc_reg_operand" "=r")
16151 (match_operand:P 5 "memory_operand" "m"))])]
16154 [(set_attr "type" "branch")
16155 (set_attr "length" "4")])
16157 (define_insn "*return_and_restore_fpregs_<mode>"
16158 [(match_parallel 0 "any_parallel_operand"
16160 (clobber (match_operand:P 1 "register_operand" "=l"))
16161 (use (match_operand:P 2 "symbol_ref_operand" "s"))
16162 (use (match_operand:P 3 "gpc_reg_operand" "r"))
16163 (set (match_operand:DF 4 "gpc_reg_operand" "=d")
16164 (match_operand:DF 5 "memory_operand" "m"))])]
16167 [(set_attr "type" "branch")
16168 (set_attr "length" "4")])
16170 (define_insn "*return_and_restore_fpregs_aix_<mode>"
16171 [(match_parallel 0 "any_parallel_operand"
16173 (use (match_operand:P 1 "register_operand" "l"))
16174 (use (match_operand:P 2 "symbol_ref_operand" "s"))
16175 (use (match_operand:P 3 "gpc_reg_operand" "r"))
16176 (set (match_operand:DF 4 "gpc_reg_operand" "=d")
16177 (match_operand:DF 5 "memory_operand" "m"))])]
16180 [(set_attr "type" "branch")
16181 (set_attr "length" "4")])
16183 ; This is used in compiling the unwind routines.
16184 (define_expand "eh_return"
16185 [(use (match_operand 0 "general_operand" ""))]
16190 emit_insn (gen_eh_set_lr_si (operands[0]));
16192 emit_insn (gen_eh_set_lr_di (operands[0]));
16196 ; We can't expand this before we know where the link register is stored.
16197 (define_insn "eh_set_lr_<mode>"
16198 [(unspec_volatile [(match_operand:P 0 "register_operand" "r")]
16200 (clobber (match_scratch:P 1 "=&b"))]
16205 [(unspec_volatile [(match_operand 0 "register_operand" "")] UNSPECV_EH_RR)
16206 (clobber (match_scratch 1 ""))]
16211 rs6000_emit_eh_reg_restore (operands[0], operands[1]);
16215 (define_insn "prefetch"
16216 [(prefetch (match_operand 0 "indexed_or_indirect_address" "a")
16217 (match_operand:SI 1 "const_int_operand" "n")
16218 (match_operand:SI 2 "const_int_operand" "n"))]
16222 if (GET_CODE (operands[0]) == REG)
16223 return INTVAL (operands[1]) ? \"dcbtst 0,%0\" : \"dcbt 0,%0\";
16224 return INTVAL (operands[1]) ? \"dcbtst %a0\" : \"dcbt %a0\";
16226 [(set_attr "type" "load")])
16228 (define_insn "bpermd_<mode>"
16229 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
16230 (unspec:P [(match_operand:P 1 "gpc_reg_operand" "r")
16231 (match_operand:P 2 "gpc_reg_operand" "r")] UNSPEC_BPERM))]
16234 [(set_attr "type" "integer")])
16238 (include "sync.md")
16239 (include "vector.md")
16241 (include "altivec.md")
16244 (include "paired.md")