1 ;; Machine description for IBM RISC System 6000 (POWER) for GNU C compiler
2 ;; Copyright (C) 1990-2014 Free Software Foundation, Inc.
3 ;; Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
5 ;; This file is part of GCC.
7 ;; GCC is free software; you can redistribute it and/or modify it
8 ;; under the terms of the GNU General Public License as published
9 ;; by the Free Software Foundation; either version 3, or (at your
10 ;; option) any later version.
12 ;; GCC is distributed in the hope that it will be useful, but WITHOUT
13 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
15 ;; License for more details.
17 ;; You should have received a copy of the GNU General Public License
18 ;; along with GCC; see the file COPYING3. If not see
19 ;; <http://www.gnu.org/licenses/>.
21 ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
29 (STACK_POINTER_REGNUM 1)
31 (STATIC_CHAIN_REGNUM 11)
32 (HARD_FRAME_POINTER_REGNUM 31)
38 (ARG_POINTER_REGNUM 67)
49 (FIRST_ALTIVEC_REGNO 77)
50 (LAST_ALTIVEC_REGNO 108)
55 (FRAME_POINTER_REGNUM 113)
65 (define_c_enum "unspec"
66 [UNSPEC_FRSP ; frsp for POWER machines
67 UNSPEC_PROBE_STACK ; probe stack memory reference
68 UNSPEC_TOCPTR ; address of a word pointing to the TOC
69 UNSPEC_TOC ; address of the TOC (more-or-less)
71 UNSPEC_MV_CR_OV ; move_from_CR_ov_bit
77 UNSPEC_LD_MPIC ; load_macho_picbase
78 UNSPEC_RELD_MPIC ; re-load_macho_picbase
79 UNSPEC_MPIC_CORRECT ; macho_correct_pic
93 UNSPEC_FIX_TRUNC_TF ; fadd, rounding towards zero
94 UNSPEC_MV_CR_GT ; move_from_CR_gt_bit
112 UNSPEC_MACHOPIC_OFFSET
124 UNSPEC_P8V_RELOAD_FROM_GPR
127 UNSPEC_P8V_RELOAD_FROM_VSX
141 ;; UNSPEC_VOLATILE usage
144 (define_c_enum "unspecv"
146 UNSPECV_LL ; load-locked
147 UNSPECV_SC ; store-conditional
148 UNSPECV_PROBE_STACK_RANGE ; probe range of stack addresses
149 UNSPECV_EH_RR ; eh_reg_restore
150 UNSPECV_ISYNC ; isync instruction
151 UNSPECV_MFTB ; move from time base
152 UNSPECV_NLGR ; non-local goto receiver
153 UNSPECV_MFFS ; Move from FPSCR
154 UNSPECV_MTFSF ; Move to FPSCR Fields
158 ;; Define an insn type attribute. This is used in function unit delay
160 (define_attr "type" "integer,two,three,load,store,fpload,fpstore,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,vecdouble,isync,sync,load_l,store_c,shift,trap,insert_dword,var_shift_rotate,cntlz,exts,mffgpr,mftgpr,isel,popcnt,crypto,htm"
161 (const_string "integer"))
163 ;; Does this instruction sign-extend its result?
164 ;; This is used for load insns.
165 (define_attr "sign_extend" "no,yes" (const_string "no"))
167 ;; Does this instruction use indexed (that is, reg+reg) addressing?
168 ;; This is used for load and store insns. If operand 0 or 1 is a MEM
169 ;; it is automatically set based on that. If a load or store instruction
170 ;; has fewer than two operands it needs to set this attribute manually
171 ;; or the compiler will crash.
172 (define_attr "indexed" "no,yes"
173 (if_then_else (ior (match_operand 0 "indexed_address_mem")
174 (match_operand 1 "indexed_address_mem"))
176 (const_string "no")))
178 ;; Does this instruction use update addressing?
179 ;; This is used for load and store insns. See the comments for "indexed".
180 (define_attr "update" "no,yes"
181 (if_then_else (ior (match_operand 0 "update_address_mem")
182 (match_operand 1 "update_address_mem"))
184 (const_string "no")))
186 ;; Define floating point instruction sub-types for use with Xfpu.md
187 (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"))
189 ;; Length (in bytes).
190 ; '(pc)' in the following doesn't include the instruction itself; it is
191 ; calculated as if the instruction had zero size.
192 (define_attr "length" ""
193 (if_then_else (eq_attr "type" "branch")
194 (if_then_else (and (ge (minus (match_dup 0) (pc))
196 (lt (minus (match_dup 0) (pc))
202 ;; Processor type -- this attribute must exactly match the processor_type
203 ;; enumeration in rs6000-opts.h.
205 "ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630,
206 ppc750,ppc7400,ppc7450,
207 ppc403,ppc405,ppc440,ppc476,
208 ppc8540,ppc8548,ppce300c2,ppce300c3,ppce500mc,ppce500mc64,ppce5500,ppce6500,
209 power4,power5,power6,power7,power8,
210 rs64a,mpccore,cell,ppca2,titan"
211 (const (symbol_ref "rs6000_cpu_attr")))
214 ;; If this instruction is microcoded on the CELL processor
215 ; The default for load extended, the recorded instructions and rotate/shifts by a variable is always microcoded
216 (define_attr "cell_micro" "not,conditional,always"
217 (if_then_else (ior (eq_attr "type" "compare,delayed_compare,imul_compare,lmul_compare,var_shift_rotate,var_delayed_compare")
218 (and (eq_attr "type" "load")
219 (eq_attr "sign_extend" "yes")))
220 (const_string "always")
221 (const_string "not")))
223 (automata_option "ndfa")
236 (include "e300c2c3.md")
237 (include "e500mc.md")
238 (include "e500mc64.md")
241 (include "power4.md")
242 (include "power5.md")
243 (include "power6.md")
244 (include "power7.md")
245 (include "power8.md")
251 (include "predicates.md")
252 (include "constraints.md")
254 (include "darwin.md")
259 ; This mode iterator allows :GPR to be used to indicate the allowable size
260 ; of whole values in GPRs.
261 (define_mode_iterator GPR [SI (DI "TARGET_POWERPC64")])
263 ; Any supported integer mode.
264 (define_mode_iterator INT [QI HI SI DI TI PTI])
266 ; Any supported integer mode that fits in one register.
267 (define_mode_iterator INT1 [QI HI SI (DI "TARGET_POWERPC64")])
269 ; extend modes for DImode
270 (define_mode_iterator QHSI [QI HI SI])
272 ; QImode or HImode for small atomic ops
273 (define_mode_iterator QHI [QI HI])
275 ; HImode or SImode for sign extended fusion ops
276 (define_mode_iterator HSI [HI SI])
278 ; SImode or DImode, even if DImode doesn't fit in GPRs.
279 (define_mode_iterator SDI [SI DI])
281 ; The size of a pointer. Also, the size of the value that a record-condition
282 ; (one with a '.') will compare; and the size used for arithmetic carries.
283 (define_mode_iterator P [(SI "TARGET_32BIT") (DI "TARGET_64BIT")])
285 ; Iterator to add PTImode along with TImode (TImode can go in VSX registers,
286 ; PTImode is GPR only)
287 (define_mode_iterator TI2 [TI PTI])
289 ; Any hardware-supported floating-point mode
290 (define_mode_iterator FP [
291 (SF "TARGET_HARD_FLOAT
292 && ((TARGET_FPRS && TARGET_SINGLE_FLOAT) || TARGET_E500_SINGLE)")
293 (DF "TARGET_HARD_FLOAT
294 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)")
295 (TF "!TARGET_IEEEQUAD
297 && (TARGET_FPRS || TARGET_E500_DOUBLE)
298 && TARGET_LONG_DOUBLE_128")
302 ; Any fma capable floating-point mode.
303 (define_mode_iterator FMA_F [
304 (SF "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT")
305 (DF "(TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT)
306 || VECTOR_UNIT_VSX_P (DFmode)")
307 (V2SF "TARGET_PAIRED_FLOAT")
308 (V4SF "VECTOR_UNIT_ALTIVEC_OR_VSX_P (V4SFmode)")
309 (V2DF "VECTOR_UNIT_ALTIVEC_OR_VSX_P (V2DFmode)")
312 ; Floating point move iterators to combine binary and decimal moves
313 (define_mode_iterator FMOVE32 [SF SD])
314 (define_mode_iterator FMOVE64 [DF DD])
315 (define_mode_iterator FMOVE64X [DI DF DD])
316 (define_mode_iterator FMOVE128 [(TF "!TARGET_IEEEQUAD && TARGET_LONG_DOUBLE_128")
317 (TD "TARGET_HARD_FLOAT && TARGET_FPRS")])
319 ; Iterators for 128 bit types for direct move
320 (define_mode_iterator FMOVE128_GPR [(TI "TARGET_VSX_TIMODE")
329 ; Whether a floating point move is ok, don't allow SD without hardware FP
330 (define_mode_attr fmove_ok [(SF "")
332 (SD "TARGET_HARD_FLOAT && TARGET_FPRS")
335 ; Convert REAL_VALUE to the appropriate bits
336 (define_mode_attr real_value_to_target [(SF "REAL_VALUE_TO_TARGET_SINGLE")
337 (DF "REAL_VALUE_TO_TARGET_DOUBLE")
338 (SD "REAL_VALUE_TO_TARGET_DECIMAL32")
339 (DD "REAL_VALUE_TO_TARGET_DECIMAL64")])
341 ; Definitions for load to 32-bit fpr register
342 (define_mode_attr f32_lr [(SF "f") (SD "wz")])
343 (define_mode_attr f32_lm [(SF "m") (SD "Z")])
344 (define_mode_attr f32_li [(SF "lfs%U1%X1 %0,%1") (SD "lfiwzx %0,%y1")])
345 (define_mode_attr f32_lv [(SF "lxsspx %x0,%y1") (SD "lxsiwzx %x0,%y1")])
347 ; Definitions for store from 32-bit fpr register
348 (define_mode_attr f32_sr [(SF "f") (SD "wx")])
349 (define_mode_attr f32_sm [(SF "m") (SD "Z")])
350 (define_mode_attr f32_si [(SF "stfs%U0%X0 %1,%0") (SD "stfiwx %1,%y0")])
351 (define_mode_attr f32_sv [(SF "stxsspx %x1,%y0") (SD "stxsiwzx %x1,%y0")])
353 ; Definitions for 32-bit fpr direct move
354 (define_mode_attr f32_dm [(SF "wn") (SD "wm")])
356 ; These modes do not fit in integer registers in 32-bit mode.
357 ; but on e500v2, the gpr are 64 bit registers
358 (define_mode_iterator DIFD [DI (DF "!TARGET_E500_DOUBLE") DD])
360 ; Iterator for reciprocal estimate instructions
361 (define_mode_iterator RECIPF [SF DF V4SF V2DF])
363 ; Iterator for just SF/DF
364 (define_mode_iterator SFDF [SF DF])
366 ; SF/DF suffix for traditional floating instructions
367 (define_mode_attr Ftrad [(SF "s") (DF "")])
369 ; SF/DF suffix for VSX instructions
370 (define_mode_attr Fvsx [(SF "sp") (DF "dp")])
372 ; SF/DF constraint for arithmetic on traditional floating point registers
373 (define_mode_attr Ff [(SF "f") (DF "d")])
375 ; SF/DF constraint for arithmetic on VSX registers
376 (define_mode_attr Fv [(SF "wy") (DF "ws")])
378 ; s/d suffix for things like fp_addsub_s/fp_addsub_d
379 (define_mode_attr Fs [(SF "s") (DF "d")])
382 (define_mode_attr Ffre [(SF "fres") (DF "fre")])
383 (define_mode_attr FFRE [(SF "FRES") (DF "FRE")])
385 ; Conditional returns.
386 (define_code_iterator any_return [return simple_return])
387 (define_code_attr return_pred [(return "direct_return ()")
388 (simple_return "1")])
389 (define_code_attr return_str [(return "") (simple_return "simple_")])
391 ; Various instructions that come in SI and DI forms.
392 ; A generic w/d attribute, for things like cmpw/cmpd.
393 (define_mode_attr wd [(QI "b")
403 (define_mode_attr dbits [(QI "56") (HI "48") (SI "32")])
405 ;; ISEL/ISEL64 target selection
406 (define_mode_attr sel [(SI "") (DI "64")])
408 ;; Suffix for reload patterns
409 (define_mode_attr ptrsize [(SI "32bit")
412 (define_mode_attr tptrsize [(SI "TARGET_32BIT")
413 (DI "TARGET_64BIT")])
415 (define_mode_attr mptrsize [(SI "si")
418 (define_mode_attr ptrload [(SI "lwz")
421 (define_mode_attr ptrm [(SI "m")
424 (define_mode_attr rreg [(SF "f")
431 (define_mode_attr rreg2 [(SF "f")
434 (define_mode_attr SI_CONVERT_FP [(SF "TARGET_FCFIDS")
435 (DF "TARGET_FCFID")])
437 (define_mode_attr E500_CONVERT [(SF "!TARGET_FPRS")
438 (DF "TARGET_E500_DOUBLE")])
440 (define_mode_attr TARGET_FLOAT [(SF "TARGET_SINGLE_FLOAT")
441 (DF "TARGET_DOUBLE_FLOAT")])
443 ;; Mode iterator for logical operations on 128-bit types
444 (define_mode_iterator BOOL_128 [TI
446 (V16QI "TARGET_ALTIVEC")
447 (V8HI "TARGET_ALTIVEC")
448 (V4SI "TARGET_ALTIVEC")
449 (V4SF "TARGET_ALTIVEC")
450 (V2DI "TARGET_ALTIVEC")
451 (V2DF "TARGET_ALTIVEC")
452 (V1TI "TARGET_ALTIVEC")])
454 ;; For the GPRs we use 3 constraints for register outputs, two that are the
455 ;; same as the output register, and a third where the output register is an
456 ;; early clobber, so we don't have to deal with register overlaps. For the
457 ;; vector types, we prefer to use the vector registers. For TI mode, allow
460 ;; Mode attribute for boolean operation register constraints for output
461 (define_mode_attr BOOL_REGS_OUTPUT [(TI "&r,r,r,wa,v")
463 (V16QI "wa,v,&?r,?r,?r")
464 (V8HI "wa,v,&?r,?r,?r")
465 (V4SI "wa,v,&?r,?r,?r")
466 (V4SF "wa,v,&?r,?r,?r")
467 (V2DI "wa,v,&?r,?r,?r")
468 (V2DF "wa,v,&?r,?r,?r")
469 (V1TI "wa,v,&?r,?r,?r")])
471 ;; Mode attribute for boolean operation register constraints for operand1
472 (define_mode_attr BOOL_REGS_OP1 [(TI "r,0,r,wa,v")
480 (V1TI "wa,v,r,0,r")])
482 ;; Mode attribute for boolean operation register constraints for operand2
483 (define_mode_attr BOOL_REGS_OP2 [(TI "r,r,0,wa,v")
491 (V1TI "wa,v,r,r,0")])
493 ;; Mode attribute for boolean operation register constraints for operand1
494 ;; for one_cmpl. To simplify things, we repeat the constraint where 0
495 ;; is used for operand1 or operand2
496 (define_mode_attr BOOL_REGS_UNARY [(TI "r,0,0,wa,v")
504 (V1TI "wa,v,r,0,0")])
506 ;; Mode attribute for the clobber of CC0 for AND expansion.
507 ;; For the 128-bit types, we never do AND immediate, but we need to
508 ;; get the correct number of X's for the number of operands.
509 (define_mode_attr BOOL_REGS_AND_CR0 [(TI "X,X,X,X,X")
519 ;; Mode attribute to give the correct type for integer divides
520 (define_mode_attr idiv_ldiv [(SI "idiv")
524 ;; Start with fixed-point load and store insns. Here we put only the more
525 ;; complex forms. Basic data transfer is done later.
527 (define_expand "zero_extend<mode>di2"
528 [(set (match_operand:DI 0 "gpc_reg_operand" "")
529 (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "")))]
533 (define_insn "*zero_extend<mode>di2_internal1"
534 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
535 (zero_extend:DI (match_operand:QHSI 1 "reg_or_mem_operand" "m,r")))]
536 "TARGET_POWERPC64 && (<MODE>mode != SImode || !TARGET_LFIWZX)"
539 rldicl %0,%1,0,<dbits>"
540 [(set_attr "type" "load,*")])
542 (define_insn "*zero_extend<mode>di2_internal2"
543 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
544 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "r,r"))
546 (clobber (match_scratch:DI 2 "=r,r"))]
549 rldicl. %2,%1,0,<dbits>
551 [(set_attr "type" "compare")
552 (set_attr "length" "4,8")])
555 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
556 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" ""))
558 (clobber (match_scratch:DI 2 ""))]
559 "TARGET_POWERPC64 && reload_completed"
561 (zero_extend:DI (match_dup 1)))
563 (compare:CC (match_dup 2)
567 (define_insn "*zero_extend<mode>di2_internal3"
568 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
569 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "r,r"))
571 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
572 (zero_extend:DI (match_dup 1)))]
575 rldicl. %0,%1,0,<dbits>
577 [(set_attr "type" "compare")
578 (set_attr "length" "4,8")])
581 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
582 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" ""))
584 (set (match_operand:DI 0 "gpc_reg_operand" "")
585 (zero_extend:DI (match_dup 1)))]
586 "TARGET_POWERPC64 && reload_completed"
588 (zero_extend:DI (match_dup 1)))
590 (compare:CC (match_dup 0)
594 (define_insn "*zero_extendsidi2_lfiwzx"
595 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,??wm,!wz,!wu")
596 (zero_extend:DI (match_operand:SI 1 "reg_or_mem_operand" "m,r,r,Z,Z")))]
597 "TARGET_POWERPC64 && TARGET_LFIWZX"
604 [(set_attr "type" "load,*,mffgpr,fpload,fpload")])
606 (define_insn "extendqidi2"
607 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
608 (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r")))]
611 [(set_attr "type" "exts")])
614 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
615 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
617 (clobber (match_scratch:DI 2 "=r,r"))]
622 [(set_attr "type" "compare")
623 (set_attr "length" "4,8")])
626 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
627 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
629 (clobber (match_scratch:DI 2 ""))]
630 "TARGET_POWERPC64 && reload_completed"
632 (sign_extend:DI (match_dup 1)))
634 (compare:CC (match_dup 2)
639 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
640 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
642 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
643 (sign_extend:DI (match_dup 1)))]
648 [(set_attr "type" "compare")
649 (set_attr "length" "4,8")])
652 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
653 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
655 (set (match_operand:DI 0 "gpc_reg_operand" "")
656 (sign_extend:DI (match_dup 1)))]
657 "TARGET_POWERPC64 && reload_completed"
659 (sign_extend:DI (match_dup 1)))
661 (compare:CC (match_dup 0)
665 (define_expand "extendhidi2"
666 [(set (match_operand:DI 0 "gpc_reg_operand" "")
667 (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "")))]
672 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
673 (sign_extend:DI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
674 "TARGET_POWERPC64 && rs6000_gen_cell_microcode"
678 [(set_attr "type" "load,exts")
679 (set_attr "sign_extend" "yes")])
682 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
683 (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r")))]
684 "TARGET_POWERPC64 && !rs6000_gen_cell_microcode"
686 [(set_attr "type" "exts")])
689 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
690 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
692 (clobber (match_scratch:DI 2 "=r,r"))]
697 [(set_attr "type" "compare")
698 (set_attr "length" "4,8")])
701 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
702 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
704 (clobber (match_scratch:DI 2 ""))]
705 "TARGET_POWERPC64 && reload_completed"
707 (sign_extend:DI (match_dup 1)))
709 (compare:CC (match_dup 2)
714 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
715 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
717 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
718 (sign_extend:DI (match_dup 1)))]
723 [(set_attr "type" "compare")
724 (set_attr "length" "4,8")])
727 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
728 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
730 (set (match_operand:DI 0 "gpc_reg_operand" "")
731 (sign_extend:DI (match_dup 1)))]
732 "TARGET_POWERPC64 && reload_completed"
734 (sign_extend:DI (match_dup 1)))
736 (compare:CC (match_dup 0)
740 (define_expand "extendsidi2"
741 [(set (match_operand:DI 0 "gpc_reg_operand" "")
742 (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")))]
746 (define_insn "*extendsidi2_lfiwax"
747 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,??wm,!wl,!wu")
748 (sign_extend:DI (match_operand:SI 1 "lwa_operand" "m,r,r,Z,Z")))]
749 "TARGET_POWERPC64 && TARGET_LFIWAX"
756 [(set_attr "type" "load,exts,mffgpr,fpload,fpload")
757 (set_attr "sign_extend" "yes")])
759 (define_insn "*extendsidi2_nocell"
760 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
761 (sign_extend:DI (match_operand:SI 1 "lwa_operand" "m,r")))]
762 "TARGET_POWERPC64 && rs6000_gen_cell_microcode && !TARGET_LFIWAX"
766 [(set_attr "type" "load,exts")
767 (set_attr "sign_extend" "yes")])
769 (define_insn "*extendsidi2_nocell"
770 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
771 (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r")))]
772 "TARGET_POWERPC64 && !rs6000_gen_cell_microcode"
774 [(set_attr "type" "exts")])
777 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
778 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
780 (clobber (match_scratch:DI 2 "=r,r"))]
785 [(set_attr "type" "compare")
786 (set_attr "length" "4,8")])
789 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
790 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
792 (clobber (match_scratch:DI 2 ""))]
793 "TARGET_POWERPC64 && reload_completed"
795 (sign_extend:DI (match_dup 1)))
797 (compare:CC (match_dup 2)
802 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
803 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
805 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
806 (sign_extend:DI (match_dup 1)))]
811 [(set_attr "type" "compare")
812 (set_attr "length" "4,8")])
815 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
816 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
818 (set (match_operand:DI 0 "gpc_reg_operand" "")
819 (sign_extend:DI (match_dup 1)))]
820 "TARGET_POWERPC64 && reload_completed"
822 (sign_extend:DI (match_dup 1)))
824 (compare:CC (match_dup 0)
828 (define_expand "zero_extendqisi2"
829 [(set (match_operand:SI 0 "gpc_reg_operand" "")
830 (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "")))]
835 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
836 (zero_extend:SI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
841 [(set_attr "type" "load,*")])
844 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
845 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
847 (clobber (match_scratch:SI 2 "=r,r"))]
852 [(set_attr "type" "fast_compare,compare")
853 (set_attr "length" "4,8")])
856 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
857 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
859 (clobber (match_scratch:SI 2 ""))]
862 (zero_extend:SI (match_dup 1)))
864 (compare:CC (match_dup 2)
869 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
870 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
872 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
873 (zero_extend:SI (match_dup 1)))]
878 [(set_attr "type" "fast_compare,compare")
879 (set_attr "length" "4,8")])
882 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
883 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
885 (set (match_operand:SI 0 "gpc_reg_operand" "")
886 (zero_extend:SI (match_dup 1)))]
889 (zero_extend:SI (match_dup 1)))
891 (compare:CC (match_dup 0)
895 (define_insn "extendqisi2"
896 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
897 (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r")))]
900 [(set_attr "type" "exts")])
903 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
904 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
906 (clobber (match_scratch:SI 2 "=r,r"))]
911 [(set_attr "type" "compare")
912 (set_attr "length" "4,8")])
915 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
916 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
918 (clobber (match_scratch:SI 2 ""))]
921 (sign_extend:SI (match_dup 1)))
923 (compare:CC (match_dup 2)
928 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
929 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
931 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
932 (sign_extend:SI (match_dup 1)))]
937 [(set_attr "type" "compare")
938 (set_attr "length" "4,8")])
941 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
942 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
944 (set (match_operand:SI 0 "gpc_reg_operand" "")
945 (sign_extend:SI (match_dup 1)))]
948 (sign_extend:SI (match_dup 1)))
950 (compare:CC (match_dup 0)
955 [(set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
956 (zero_extend:HI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
961 [(set_attr "type" "load,*")])
964 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
965 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
967 (clobber (match_scratch:HI 2 "=r,r"))]
972 [(set_attr "type" "fast_compare,compare")
973 (set_attr "length" "4,8")])
976 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
977 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
979 (clobber (match_scratch:HI 2 ""))]
982 (zero_extend:HI (match_dup 1)))
984 (compare:CC (match_dup 2)
989 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
990 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
992 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
993 (zero_extend:HI (match_dup 1)))]
998 [(set_attr "type" "fast_compare,compare")
999 (set_attr "length" "4,8")])
1002 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
1003 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
1005 (set (match_operand:HI 0 "gpc_reg_operand" "")
1006 (zero_extend:HI (match_dup 1)))]
1009 (zero_extend:HI (match_dup 1)))
1011 (compare:CC (match_dup 0)
1015 (define_insn "extendqihi2"
1016 [(set (match_operand:HI 0 "gpc_reg_operand" "=r")
1017 (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r")))]
1020 [(set_attr "type" "exts")])
1023 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1024 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
1026 (clobber (match_scratch:HI 2 "=r,r"))]
1031 [(set_attr "type" "compare")
1032 (set_attr "length" "4,8")])
1035 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
1036 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
1038 (clobber (match_scratch:HI 2 ""))]
1041 (sign_extend:HI (match_dup 1)))
1043 (compare:CC (match_dup 2)
1048 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1049 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
1051 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
1052 (sign_extend:HI (match_dup 1)))]
1057 [(set_attr "type" "compare")
1058 (set_attr "length" "4,8")])
1061 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
1062 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
1064 (set (match_operand:HI 0 "gpc_reg_operand" "")
1065 (sign_extend:HI (match_dup 1)))]
1068 (sign_extend:HI (match_dup 1)))
1070 (compare:CC (match_dup 0)
1074 (define_expand "zero_extendhisi2"
1075 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1076 (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
1081 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1082 (zero_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
1086 rlwinm %0,%1,0,0xffff"
1087 [(set_attr "type" "load,*")])
1090 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1091 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
1093 (clobber (match_scratch:SI 2 "=r,r"))]
1098 [(set_attr "type" "fast_compare,compare")
1099 (set_attr "length" "4,8")])
1102 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
1103 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1105 (clobber (match_scratch:SI 2 ""))]
1108 (zero_extend:SI (match_dup 1)))
1110 (compare:CC (match_dup 2)
1115 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1116 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
1118 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1119 (zero_extend:SI (match_dup 1)))]
1124 [(set_attr "type" "fast_compare,compare")
1125 (set_attr "length" "4,8")])
1128 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
1129 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1131 (set (match_operand:SI 0 "gpc_reg_operand" "")
1132 (zero_extend:SI (match_dup 1)))]
1135 (zero_extend:SI (match_dup 1)))
1137 (compare:CC (match_dup 0)
1141 (define_expand "extendhisi2"
1142 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1143 (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
1148 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1149 (sign_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
1150 "rs6000_gen_cell_microcode"
1154 [(set_attr "type" "load,exts")
1155 (set_attr "sign_extend" "yes")])
1158 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1159 (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r")))]
1160 "!rs6000_gen_cell_microcode"
1162 [(set_attr "type" "exts")])
1165 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1166 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
1168 (clobber (match_scratch:SI 2 "=r,r"))]
1173 [(set_attr "type" "compare")
1174 (set_attr "length" "4,8")])
1177 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
1178 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1180 (clobber (match_scratch:SI 2 ""))]
1183 (sign_extend:SI (match_dup 1)))
1185 (compare:CC (match_dup 2)
1190 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1191 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
1193 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1194 (sign_extend:SI (match_dup 1)))]
1199 [(set_attr "type" "compare")
1200 (set_attr "length" "4,8")])
1203 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
1204 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1206 (set (match_operand:SI 0 "gpc_reg_operand" "")
1207 (sign_extend:SI (match_dup 1)))]
1210 (sign_extend:SI (match_dup 1)))
1212 (compare:CC (match_dup 0)
1216 ;; IBM 405, 440, 464 and 476 half-word multiplication operations.
1218 (define_insn "*macchwc"
1219 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1220 (compare:CC (plus:SI (mult:SI (ashiftrt:SI
1221 (match_operand:SI 2 "gpc_reg_operand" "r")
1224 (match_operand:HI 1 "gpc_reg_operand" "r")))
1225 (match_operand:SI 4 "gpc_reg_operand" "0"))
1227 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1228 (plus:SI (mult:SI (ashiftrt:SI
1236 [(set_attr "type" "imul3")])
1238 (define_insn "*macchw"
1239 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1240 (plus:SI (mult:SI (ashiftrt:SI
1241 (match_operand:SI 2 "gpc_reg_operand" "r")
1244 (match_operand:HI 1 "gpc_reg_operand" "r")))
1245 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1248 [(set_attr "type" "imul3")])
1250 (define_insn "*macchwuc"
1251 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1252 (compare:CC (plus:SI (mult:SI (lshiftrt:SI
1253 (match_operand:SI 2 "gpc_reg_operand" "r")
1256 (match_operand:HI 1 "gpc_reg_operand" "r")))
1257 (match_operand:SI 4 "gpc_reg_operand" "0"))
1259 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1260 (plus:SI (mult:SI (lshiftrt:SI
1268 [(set_attr "type" "imul3")])
1270 (define_insn "*macchwu"
1271 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1272 (plus:SI (mult:SI (lshiftrt:SI
1273 (match_operand:SI 2 "gpc_reg_operand" "r")
1276 (match_operand:HI 1 "gpc_reg_operand" "r")))
1277 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1280 [(set_attr "type" "imul3")])
1282 (define_insn "*machhwc"
1283 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1284 (compare:CC (plus:SI (mult:SI (ashiftrt:SI
1285 (match_operand:SI 1 "gpc_reg_operand" "%r")
1288 (match_operand:SI 2 "gpc_reg_operand" "r")
1290 (match_operand:SI 4 "gpc_reg_operand" "0"))
1292 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1293 (plus:SI (mult:SI (ashiftrt:SI
1302 [(set_attr "type" "imul3")])
1304 (define_insn "*machhw"
1305 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1306 (plus:SI (mult:SI (ashiftrt:SI
1307 (match_operand:SI 1 "gpc_reg_operand" "%r")
1310 (match_operand:SI 2 "gpc_reg_operand" "r")
1312 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1315 [(set_attr "type" "imul3")])
1317 (define_insn "*machhwuc"
1318 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1319 (compare:CC (plus:SI (mult:SI (lshiftrt:SI
1320 (match_operand:SI 1 "gpc_reg_operand" "%r")
1323 (match_operand:SI 2 "gpc_reg_operand" "r")
1325 (match_operand:SI 4 "gpc_reg_operand" "0"))
1327 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1328 (plus:SI (mult:SI (lshiftrt:SI
1337 [(set_attr "type" "imul3")])
1339 (define_insn "*machhwu"
1340 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1341 (plus:SI (mult:SI (lshiftrt:SI
1342 (match_operand:SI 1 "gpc_reg_operand" "%r")
1345 (match_operand:SI 2 "gpc_reg_operand" "r")
1347 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1350 [(set_attr "type" "imul3")])
1352 (define_insn "*maclhwc"
1353 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1354 (compare:CC (plus:SI (mult:SI (sign_extend:SI
1355 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1357 (match_operand:HI 2 "gpc_reg_operand" "r")))
1358 (match_operand:SI 4 "gpc_reg_operand" "0"))
1360 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1361 (plus:SI (mult:SI (sign_extend:SI
1368 [(set_attr "type" "imul3")])
1370 (define_insn "*maclhw"
1371 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1372 (plus:SI (mult:SI (sign_extend:SI
1373 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1375 (match_operand:HI 2 "gpc_reg_operand" "r")))
1376 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1379 [(set_attr "type" "imul3")])
1381 (define_insn "*maclhwuc"
1382 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1383 (compare:CC (plus:SI (mult:SI (zero_extend:SI
1384 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1386 (match_operand:HI 2 "gpc_reg_operand" "r")))
1387 (match_operand:SI 4 "gpc_reg_operand" "0"))
1389 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1390 (plus:SI (mult:SI (zero_extend:SI
1397 [(set_attr "type" "imul3")])
1399 (define_insn "*maclhwu"
1400 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1401 (plus:SI (mult:SI (zero_extend:SI
1402 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1404 (match_operand:HI 2 "gpc_reg_operand" "r")))
1405 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1408 [(set_attr "type" "imul3")])
1410 (define_insn "*nmacchwc"
1411 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1412 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1413 (mult:SI (ashiftrt:SI
1414 (match_operand:SI 2 "gpc_reg_operand" "r")
1417 (match_operand:HI 1 "gpc_reg_operand" "r"))))
1419 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1420 (minus:SI (match_dup 4)
1421 (mult:SI (ashiftrt:SI
1428 [(set_attr "type" "imul3")])
1430 (define_insn "*nmacchw"
1431 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1432 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1433 (mult:SI (ashiftrt:SI
1434 (match_operand:SI 2 "gpc_reg_operand" "r")
1437 (match_operand:HI 1 "gpc_reg_operand" "r")))))]
1440 [(set_attr "type" "imul3")])
1442 (define_insn "*nmachhwc"
1443 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1444 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1445 (mult:SI (ashiftrt:SI
1446 (match_operand:SI 1 "gpc_reg_operand" "%r")
1449 (match_operand:SI 2 "gpc_reg_operand" "r")
1452 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1453 (minus:SI (match_dup 4)
1454 (mult:SI (ashiftrt:SI
1462 [(set_attr "type" "imul3")])
1464 (define_insn "*nmachhw"
1465 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1466 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1467 (mult:SI (ashiftrt:SI
1468 (match_operand:SI 1 "gpc_reg_operand" "%r")
1471 (match_operand:SI 2 "gpc_reg_operand" "r")
1475 [(set_attr "type" "imul3")])
1477 (define_insn "*nmaclhwc"
1478 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1479 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1480 (mult:SI (sign_extend:SI
1481 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1483 (match_operand:HI 2 "gpc_reg_operand" "r"))))
1485 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1486 (minus:SI (match_dup 4)
1487 (mult:SI (sign_extend:SI
1493 [(set_attr "type" "imul3")])
1495 (define_insn "*nmaclhw"
1496 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1497 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1498 (mult:SI (sign_extend:SI
1499 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1501 (match_operand:HI 2 "gpc_reg_operand" "r")))))]
1504 [(set_attr "type" "imul3")])
1506 (define_insn "*mulchwc"
1507 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1508 (compare:CC (mult:SI (ashiftrt:SI
1509 (match_operand:SI 2 "gpc_reg_operand" "r")
1512 (match_operand:HI 1 "gpc_reg_operand" "r")))
1514 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1515 (mult:SI (ashiftrt:SI
1522 [(set_attr "type" "imul3")])
1524 (define_insn "*mulchw"
1525 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1526 (mult:SI (ashiftrt:SI
1527 (match_operand:SI 2 "gpc_reg_operand" "r")
1530 (match_operand:HI 1 "gpc_reg_operand" "r"))))]
1533 [(set_attr "type" "imul3")])
1535 (define_insn "*mulchwuc"
1536 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1537 (compare:CC (mult:SI (lshiftrt:SI
1538 (match_operand:SI 2 "gpc_reg_operand" "r")
1541 (match_operand:HI 1 "gpc_reg_operand" "r")))
1543 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1544 (mult:SI (lshiftrt:SI
1551 [(set_attr "type" "imul3")])
1553 (define_insn "*mulchwu"
1554 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1555 (mult:SI (lshiftrt:SI
1556 (match_operand:SI 2 "gpc_reg_operand" "r")
1559 (match_operand:HI 1 "gpc_reg_operand" "r"))))]
1562 [(set_attr "type" "imul3")])
1564 (define_insn "*mulhhwc"
1565 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1566 (compare:CC (mult:SI (ashiftrt:SI
1567 (match_operand:SI 1 "gpc_reg_operand" "%r")
1570 (match_operand:SI 2 "gpc_reg_operand" "r")
1573 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1574 (mult:SI (ashiftrt:SI
1582 [(set_attr "type" "imul3")])
1584 (define_insn "*mulhhw"
1585 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1586 (mult:SI (ashiftrt:SI
1587 (match_operand:SI 1 "gpc_reg_operand" "%r")
1590 (match_operand:SI 2 "gpc_reg_operand" "r")
1594 [(set_attr "type" "imul3")])
1596 (define_insn "*mulhhwuc"
1597 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1598 (compare:CC (mult:SI (lshiftrt:SI
1599 (match_operand:SI 1 "gpc_reg_operand" "%r")
1602 (match_operand:SI 2 "gpc_reg_operand" "r")
1605 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1606 (mult:SI (lshiftrt:SI
1614 [(set_attr "type" "imul3")])
1616 (define_insn "*mulhhwu"
1617 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1618 (mult:SI (lshiftrt:SI
1619 (match_operand:SI 1 "gpc_reg_operand" "%r")
1622 (match_operand:SI 2 "gpc_reg_operand" "r")
1626 [(set_attr "type" "imul3")])
1628 (define_insn "*mullhwc"
1629 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1630 (compare:CC (mult:SI (sign_extend:SI
1631 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1633 (match_operand:HI 2 "gpc_reg_operand" "r")))
1635 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1636 (mult:SI (sign_extend:SI
1642 [(set_attr "type" "imul3")])
1644 (define_insn "*mullhw"
1645 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1646 (mult:SI (sign_extend:SI
1647 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1649 (match_operand:HI 2 "gpc_reg_operand" "r"))))]
1652 [(set_attr "type" "imul3")])
1654 (define_insn "*mullhwuc"
1655 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1656 (compare:CC (mult:SI (zero_extend:SI
1657 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1659 (match_operand:HI 2 "gpc_reg_operand" "r")))
1661 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1662 (mult:SI (zero_extend:SI
1668 [(set_attr "type" "imul3")])
1670 (define_insn "*mullhwu"
1671 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1672 (mult:SI (zero_extend:SI
1673 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1675 (match_operand:HI 2 "gpc_reg_operand" "r"))))]
1678 [(set_attr "type" "imul3")])
1680 ;; IBM 405, 440, 464 and 476 string-search dlmzb instruction support.
1681 (define_insn "dlmzb"
1682 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1683 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
1684 (match_operand:SI 2 "gpc_reg_operand" "r")]
1686 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1687 (unspec:SI [(match_dup 1)
1693 (define_expand "strlensi"
1694 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1695 (unspec:SI [(match_operand:BLK 1 "general_operand" "")
1696 (match_operand:QI 2 "const_int_operand" "")
1697 (match_operand 3 "const_int_operand" "")]
1698 UNSPEC_DLMZB_STRLEN))
1699 (clobber (match_scratch:CC 4 "=x"))]
1700 "TARGET_DLMZB && WORDS_BIG_ENDIAN && !optimize_size"
1702 rtx result = operands[0];
1703 rtx src = operands[1];
1704 rtx search_char = operands[2];
1705 rtx align = operands[3];
1706 rtx addr, scratch_string, word1, word2, scratch_dlmzb;
1707 rtx loop_label, end_label, mem, cr0, cond;
1708 if (search_char != const0_rtx
1709 || GET_CODE (align) != CONST_INT
1710 || INTVAL (align) < 8)
1712 word1 = gen_reg_rtx (SImode);
1713 word2 = gen_reg_rtx (SImode);
1714 scratch_dlmzb = gen_reg_rtx (SImode);
1715 scratch_string = gen_reg_rtx (Pmode);
1716 loop_label = gen_label_rtx ();
1717 end_label = gen_label_rtx ();
1718 addr = force_reg (Pmode, XEXP (src, 0));
1719 emit_move_insn (scratch_string, addr);
1720 emit_label (loop_label);
1721 mem = change_address (src, SImode, scratch_string);
1722 emit_move_insn (word1, mem);
1723 emit_move_insn (word2, adjust_address (mem, SImode, 4));
1724 cr0 = gen_rtx_REG (CCmode, CR0_REGNO);
1725 emit_insn (gen_dlmzb (scratch_dlmzb, word1, word2, cr0));
1726 cond = gen_rtx_NE (VOIDmode, cr0, const0_rtx);
1727 emit_jump_insn (gen_rtx_SET (VOIDmode,
1729 gen_rtx_IF_THEN_ELSE (VOIDmode,
1735 emit_insn (gen_addsi3 (scratch_string, scratch_string, GEN_INT (8)));
1736 emit_jump_insn (gen_rtx_SET (VOIDmode,
1738 gen_rtx_LABEL_REF (VOIDmode, loop_label)));
1740 emit_label (end_label);
1741 emit_insn (gen_addsi3 (scratch_string, scratch_string, scratch_dlmzb));
1742 emit_insn (gen_subsi3 (result, scratch_string, addr));
1743 emit_insn (gen_subsi3 (result, result, const1_rtx));
1747 ;; Fixed-point arithmetic insns.
1749 (define_expand "add<mode>3"
1750 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1751 (plus:SDI (match_operand:SDI 1 "gpc_reg_operand" "")
1752 (match_operand:SDI 2 "reg_or_add_cint_operand" "")))]
1755 if (<MODE>mode == DImode && ! TARGET_POWERPC64)
1757 if (non_short_cint_operand (operands[2], DImode))
1760 else if (GET_CODE (operands[2]) == CONST_INT
1761 && ! add_operand (operands[2], <MODE>mode))
1763 rtx tmp = ((!can_create_pseudo_p ()
1764 || rtx_equal_p (operands[0], operands[1]))
1765 ? operands[0] : gen_reg_rtx (<MODE>mode));
1767 HOST_WIDE_INT val = INTVAL (operands[2]);
1768 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1769 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, <MODE>mode);
1771 if (<MODE>mode == DImode && !satisfies_constraint_L (GEN_INT (rest)))
1774 /* The ordering here is important for the prolog expander.
1775 When space is allocated from the stack, adding 'low' first may
1776 produce a temporary deallocation (which would be bad). */
1777 emit_insn (gen_add<mode>3 (tmp, operands[1], GEN_INT (rest)));
1778 emit_insn (gen_add<mode>3 (operands[0], tmp, GEN_INT (low)));
1783 ;; Discourage ai/addic because of carry but provide it in an alternative
1784 ;; allowing register zero as source.
1785 (define_insn "*add<mode>3_internal1"
1786 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r,?r,r")
1787 (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "%r,b,r,b")
1788 (match_operand:GPR 2 "add_operand" "r,I,I,L")))]
1789 "!DECIMAL_FLOAT_MODE_P (GET_MODE (operands[0])) && !DECIMAL_FLOAT_MODE_P (GET_MODE (operands[1]))"
1795 [(set_attr "length" "4,4,4,4")])
1797 (define_insn "addsi3_high"
1798 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
1799 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
1800 (high:SI (match_operand 2 "" ""))))]
1801 "TARGET_MACHO && !TARGET_64BIT"
1802 "addis %0,%1,ha16(%2)"
1803 [(set_attr "length" "4")])
1805 (define_insn "*add<mode>3_internal2"
1806 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
1807 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "%r,r,r,r")
1808 (match_operand:P 2 "reg_or_short_operand" "r,I,r,I"))
1810 (clobber (match_scratch:P 3 "=r,r,r,r"))]
1817 [(set_attr "type" "fast_compare,compare,compare,compare")
1818 (set_attr "length" "4,4,8,8")])
1821 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1822 (compare:CC (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1823 (match_operand:GPR 2 "reg_or_short_operand" ""))
1825 (clobber (match_scratch:GPR 3 ""))]
1828 (plus:GPR (match_dup 1)
1831 (compare:CC (match_dup 3)
1835 (define_insn "*add<mode>3_internal3"
1836 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
1837 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "%r,r,r,r")
1838 (match_operand:P 2 "reg_or_short_operand" "r,I,r,I"))
1840 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
1841 (plus:P (match_dup 1)
1849 [(set_attr "type" "fast_compare,compare,compare,compare")
1850 (set_attr "length" "4,4,8,8")])
1853 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1854 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "")
1855 (match_operand:P 2 "reg_or_short_operand" ""))
1857 (set (match_operand:P 0 "gpc_reg_operand" "")
1858 (plus:P (match_dup 1) (match_dup 2)))]
1861 (plus:P (match_dup 1)
1864 (compare:CC (match_dup 0)
1868 ;; Split an add that we can't do in one insn into two insns, each of which
1869 ;; does one 16-bit part. This is used by combine. Note that the low-order
1870 ;; add should be last in case the result gets used in an address.
1873 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
1874 (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1875 (match_operand:GPR 2 "non_add_cint_operand" "")))]
1877 [(set (match_dup 0) (plus:GPR (match_dup 1) (match_dup 3)))
1878 (set (match_dup 0) (plus:GPR (match_dup 0) (match_dup 4)))]
1880 HOST_WIDE_INT val = INTVAL (operands[2]);
1881 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1882 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, <MODE>mode);
1884 operands[4] = GEN_INT (low);
1885 if (<MODE>mode == SImode || satisfies_constraint_L (GEN_INT (rest)))
1886 operands[3] = GEN_INT (rest);
1887 else if (can_create_pseudo_p ())
1889 operands[3] = gen_reg_rtx (DImode);
1890 emit_move_insn (operands[3], operands[2]);
1891 emit_insn (gen_adddi3 (operands[0], operands[1], operands[3]));
1898 (define_expand "one_cmpl<mode>2"
1899 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1900 (not:SDI (match_operand:SDI 1 "gpc_reg_operand" "")))]
1903 if (<MODE>mode == DImode && !TARGET_POWERPC64)
1905 rs6000_split_logical (operands, NOT, false, false, false, NULL_RTX);
1910 (define_insn "*one_cmpl<mode>2"
1911 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1912 (not:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
1917 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1918 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1920 (clobber (match_scratch:P 2 "=r,r"))]
1925 [(set_attr "type" "fast_compare,compare")
1926 (set_attr "length" "4,8")])
1929 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
1930 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" ""))
1932 (clobber (match_scratch:P 2 ""))]
1935 (not:P (match_dup 1)))
1937 (compare:CC (match_dup 2)
1942 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1943 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1945 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
1946 (not:P (match_dup 1)))]
1951 [(set_attr "type" "fast_compare,compare")
1952 (set_attr "length" "4,8")])
1955 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
1956 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" ""))
1958 (set (match_operand:P 0 "gpc_reg_operand" "")
1959 (not:P (match_dup 1)))]
1962 (not:P (match_dup 1)))
1964 (compare:CC (match_dup 0)
1969 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
1970 (minus:GPR (match_operand:GPR 1 "reg_or_short_operand" "r,I")
1971 (match_operand:GPR 2 "gpc_reg_operand" "r,r")))]
1978 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1979 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "r,r")
1980 (match_operand:P 2 "gpc_reg_operand" "r,r"))
1982 (clobber (match_scratch:P 3 "=r,r"))]
1987 [(set_attr "type" "fast_compare")
1988 (set_attr "length" "4,8")])
1991 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1992 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "")
1993 (match_operand:P 2 "gpc_reg_operand" ""))
1995 (clobber (match_scratch:P 3 ""))]
1998 (minus:P (match_dup 1)
2001 (compare:CC (match_dup 3)
2006 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2007 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "r,r")
2008 (match_operand:P 2 "gpc_reg_operand" "r,r"))
2010 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
2011 (minus:P (match_dup 1)
2017 [(set_attr "type" "fast_compare")
2018 (set_attr "length" "4,8")])
2021 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2022 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "")
2023 (match_operand:P 2 "gpc_reg_operand" ""))
2025 (set (match_operand:P 0 "gpc_reg_operand" "")
2026 (minus:P (match_dup 1)
2030 (minus:P (match_dup 1)
2033 (compare:CC (match_dup 0)
2037 (define_expand "sub<mode>3"
2038 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
2039 (minus:SDI (match_operand:SDI 1 "reg_or_short_operand" "")
2040 (match_operand:SDI 2 "reg_or_sub_cint_operand" "")))]
2044 if (GET_CODE (operands[2]) == CONST_INT)
2046 emit_insn (gen_add<mode>3 (operands[0], operands[1],
2047 negate_rtx (<MODE>mode, operands[2])));
2052 (define_expand "neg<mode>2"
2053 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
2054 (neg:SDI (match_operand:SDI 1 "gpc_reg_operand" "")))]
2058 (define_insn "*neg<mode>2_internal"
2059 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2060 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
2065 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2066 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
2068 (clobber (match_scratch:P 2 "=r,r"))]
2073 [(set_attr "type" "fast_compare")
2074 (set_attr "length" "4,8")])
2077 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2078 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" ""))
2080 (clobber (match_scratch:P 2 ""))]
2083 (neg:P (match_dup 1)))
2085 (compare:CC (match_dup 2)
2090 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
2091 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
2093 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
2094 (neg:P (match_dup 1)))]
2099 [(set_attr "type" "fast_compare")
2100 (set_attr "length" "4,8")])
2103 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
2104 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" ""))
2106 (set (match_operand:P 0 "gpc_reg_operand" "")
2107 (neg:P (match_dup 1)))]
2110 (neg:P (match_dup 1)))
2112 (compare:CC (match_dup 0)
2116 (define_insn "clz<mode>2"
2117 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2118 (clz:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
2121 [(set_attr "type" "cntlz")])
2123 (define_expand "ctz<mode>2"
2125 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))
2126 (parallel [(set (match_dup 3) (and:GPR (match_dup 1)
2128 (clobber (scratch:CC))])
2129 (set (match_dup 4) (clz:GPR (match_dup 3)))
2130 (set (match_operand:GPR 0 "gpc_reg_operand" "")
2131 (minus:GPR (match_dup 5) (match_dup 4)))]
2134 operands[2] = gen_reg_rtx (<MODE>mode);
2135 operands[3] = gen_reg_rtx (<MODE>mode);
2136 operands[4] = gen_reg_rtx (<MODE>mode);
2137 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode) - 1);
2140 (define_expand "ffs<mode>2"
2142 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))
2143 (parallel [(set (match_dup 3) (and:GPR (match_dup 1)
2145 (clobber (scratch:CC))])
2146 (set (match_dup 4) (clz:GPR (match_dup 3)))
2147 (set (match_operand:GPR 0 "gpc_reg_operand" "")
2148 (minus:GPR (match_dup 5) (match_dup 4)))]
2151 operands[2] = gen_reg_rtx (<MODE>mode);
2152 operands[3] = gen_reg_rtx (<MODE>mode);
2153 operands[4] = gen_reg_rtx (<MODE>mode);
2154 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode));
2157 (define_insn "popcntb<mode>2"
2158 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2159 (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")]
2163 [(set_attr "length" "4")
2164 (set_attr "type" "popcnt")])
2166 (define_insn "popcntd<mode>2"
2167 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2168 (popcount:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
2171 [(set_attr "length" "4")
2172 (set_attr "type" "popcnt")])
2174 (define_expand "popcount<mode>2"
2175 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2176 (popcount:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))]
2177 "TARGET_POPCNTB || TARGET_POPCNTD"
2179 rs6000_emit_popcount (operands[0], operands[1]);
2183 (define_insn "parity<mode>2_cmpb"
2184 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2185 (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")] UNSPEC_PARITY))]
2186 "TARGET_CMPB && TARGET_POPCNTB"
2188 [(set_attr "length" "4")
2189 (set_attr "type" "popcnt")])
2191 (define_expand "parity<mode>2"
2192 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2193 (parity:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))]
2196 rs6000_emit_parity (operands[0], operands[1]);
2200 ;; Since the hardware zeros the upper part of the register, save generating the
2201 ;; AND immediate if we are converting to unsigned
2202 (define_insn "*bswaphi2_extenddi"
2203 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
2205 (bswap:HI (match_operand:HI 1 "memory_operand" "Z"))))]
2208 [(set_attr "length" "4")
2209 (set_attr "type" "load")])
2211 (define_insn "*bswaphi2_extendsi"
2212 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2214 (bswap:HI (match_operand:HI 1 "memory_operand" "Z"))))]
2217 [(set_attr "length" "4")
2218 (set_attr "type" "load")])
2220 (define_expand "bswaphi2"
2221 [(parallel [(set (match_operand:HI 0 "reg_or_mem_operand" "")
2223 (match_operand:HI 1 "reg_or_mem_operand" "")))
2224 (clobber (match_scratch:SI 2 ""))])]
2227 if (!REG_P (operands[0]) && !REG_P (operands[1]))
2228 operands[1] = force_reg (HImode, operands[1]);
2231 (define_insn "bswaphi2_internal"
2232 [(set (match_operand:HI 0 "reg_or_mem_operand" "=r,Z,&r")
2234 (match_operand:HI 1 "reg_or_mem_operand" "Z,r,r")))
2235 (clobber (match_scratch:SI 2 "=X,X,&r"))]
2241 [(set_attr "length" "4,4,12")
2242 (set_attr "type" "load,store,*")])
2244 ;; We are always BITS_BIG_ENDIAN, so the (const_int 16) below is
2245 ;; correct for -mlittle as well as -mbig.
2247 [(set (match_operand:HI 0 "gpc_reg_operand" "")
2248 (bswap:HI (match_operand:HI 1 "gpc_reg_operand" "")))
2249 (clobber (match_operand:SI 2 "gpc_reg_operand" ""))]
2252 (zero_extract:SI (match_dup 4)
2256 (and:SI (ashift:SI (match_dup 4)
2258 (const_int 65280))) ;; 0xff00
2260 (ior:SI (match_dup 3)
2264 operands[3] = simplify_gen_subreg (SImode, operands[0], HImode, 0);
2265 operands[4] = simplify_gen_subreg (SImode, operands[1], HImode, 0);
2268 (define_insn "*bswapsi2_extenddi"
2269 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
2271 (bswap:SI (match_operand:SI 1 "memory_operand" "Z"))))]
2274 [(set_attr "length" "4")
2275 (set_attr "type" "load")])
2277 (define_expand "bswapsi2"
2278 [(set (match_operand:SI 0 "reg_or_mem_operand" "")
2280 (match_operand:SI 1 "reg_or_mem_operand" "")))]
2283 if (!REG_P (operands[0]) && !REG_P (operands[1]))
2284 operands[1] = force_reg (SImode, operands[1]);
2287 (define_insn "*bswapsi2_internal"
2288 [(set (match_operand:SI 0 "reg_or_mem_operand" "=r,Z,&r")
2290 (match_operand:SI 1 "reg_or_mem_operand" "Z,r,r")))]
2296 [(set_attr "length" "4,4,12")
2297 (set_attr "type" "load,store,*")])
2299 ;; We are always BITS_BIG_ENDIAN, so the bit positions below in
2300 ;; zero_extract insns do not change for -mlittle.
2302 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2303 (bswap:SI (match_operand:SI 1 "gpc_reg_operand" "")))]
2306 (rotate:SI (match_dup 1) (const_int 8)))
2307 (set (zero_extract:SI (match_dup 0)
2311 (set (zero_extract:SI (match_dup 0)
2314 (rotate:SI (match_dup 1)
2318 (define_expand "bswapdi2"
2319 [(parallel [(set (match_operand:DI 0 "reg_or_mem_operand" "")
2321 (match_operand:DI 1 "reg_or_mem_operand" "")))
2322 (clobber (match_scratch:DI 2 ""))
2323 (clobber (match_scratch:DI 3 ""))
2324 (clobber (match_scratch:DI 4 ""))])]
2327 if (!REG_P (operands[0]) && !REG_P (operands[1]))
2328 operands[1] = force_reg (DImode, operands[1]);
2330 if (!TARGET_POWERPC64)
2332 /* 32-bit mode needs fewer scratch registers, but 32-bit addressing mode
2333 that uses 64-bit registers needs the same scratch registers as 64-bit
2335 emit_insn (gen_bswapdi2_32bit (operands[0], operands[1]));
2340 ;; Power7/cell has ldbrx/stdbrx, so use it directly
2341 (define_insn "*bswapdi2_ldbrx"
2342 [(set (match_operand:DI 0 "reg_or_mem_operand" "=&r,Z,??&r")
2343 (bswap:DI (match_operand:DI 1 "reg_or_mem_operand" "Z,r,r")))
2344 (clobber (match_scratch:DI 2 "=X,X,&r"))
2345 (clobber (match_scratch:DI 3 "=X,X,&r"))
2346 (clobber (match_scratch:DI 4 "=X,X,&r"))]
2347 "TARGET_POWERPC64 && TARGET_LDBRX
2348 && (REG_P (operands[0]) || REG_P (operands[1]))"
2353 [(set_attr "length" "4,4,36")
2354 (set_attr "type" "load,store,*")])
2356 ;; Non-power7/cell, fall back to use lwbrx/stwbrx
2357 (define_insn "*bswapdi2_64bit"
2358 [(set (match_operand:DI 0 "reg_or_mem_operand" "=&r,Z,&r")
2359 (bswap:DI (match_operand:DI 1 "reg_or_mem_operand" "Z,r,r")))
2360 (clobber (match_scratch:DI 2 "=&b,&b,&r"))
2361 (clobber (match_scratch:DI 3 "=&r,&r,&r"))
2362 (clobber (match_scratch:DI 4 "=&r,X,&r"))]
2363 "TARGET_POWERPC64 && !TARGET_LDBRX
2364 && (REG_P (operands[0]) || REG_P (operands[1]))
2365 && !(MEM_P (operands[0]) && MEM_VOLATILE_P (operands[0]))
2366 && !(MEM_P (operands[1]) && MEM_VOLATILE_P (operands[1]))"
2368 [(set_attr "length" "16,12,36")])
2371 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2372 (bswap:DI (match_operand:DI 1 "indexed_or_indirect_operand" "")))
2373 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
2374 (clobber (match_operand:DI 3 "gpc_reg_operand" ""))
2375 (clobber (match_operand:DI 4 "gpc_reg_operand" ""))]
2376 "TARGET_POWERPC64 && !TARGET_LDBRX && reload_completed"
2380 rtx dest = operands[0];
2381 rtx src = operands[1];
2382 rtx op2 = operands[2];
2383 rtx op3 = operands[3];
2384 rtx op4 = operands[4];
2385 rtx op3_32 = simplify_gen_subreg (SImode, op3, DImode,
2386 BYTES_BIG_ENDIAN ? 4 : 0);
2387 rtx op4_32 = simplify_gen_subreg (SImode, op4, DImode,
2388 BYTES_BIG_ENDIAN ? 4 : 0);
2394 addr1 = XEXP (src, 0);
2395 if (GET_CODE (addr1) == PLUS)
2397 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2398 if (TARGET_AVOID_XFORM)
2400 emit_insn (gen_add3_insn (op2, XEXP (addr1, 1), op2));
2404 addr2 = gen_rtx_PLUS (Pmode, op2, XEXP (addr1, 1));
2406 else if (TARGET_AVOID_XFORM)
2408 emit_insn (gen_add3_insn (op2, addr1, GEN_INT (4)));
2413 emit_move_insn (op2, GEN_INT (4));
2414 addr2 = gen_rtx_PLUS (Pmode, op2, addr1);
2417 if (BYTES_BIG_ENDIAN)
2419 word_high = change_address (src, SImode, addr1);
2420 word_low = change_address (src, SImode, addr2);
2424 word_high = change_address (src, SImode, addr2);
2425 word_low = change_address (src, SImode, addr1);
2428 emit_insn (gen_bswapsi2 (op3_32, word_low));
2429 emit_insn (gen_bswapsi2 (op4_32, word_high));
2430 emit_insn (gen_ashldi3 (dest, op3, GEN_INT (32)));
2431 emit_insn (gen_iordi3 (dest, dest, op4));
2435 [(set (match_operand:DI 0 "indexed_or_indirect_operand" "")
2436 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2437 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
2438 (clobber (match_operand:DI 3 "gpc_reg_operand" ""))
2439 (clobber (match_operand:DI 4 "" ""))]
2440 "TARGET_POWERPC64 && !TARGET_LDBRX && reload_completed"
2444 rtx dest = operands[0];
2445 rtx src = operands[1];
2446 rtx op2 = operands[2];
2447 rtx op3 = operands[3];
2448 rtx src_si = simplify_gen_subreg (SImode, src, DImode,
2449 BYTES_BIG_ENDIAN ? 4 : 0);
2450 rtx op3_si = simplify_gen_subreg (SImode, op3, DImode,
2451 BYTES_BIG_ENDIAN ? 4 : 0);
2457 addr1 = XEXP (dest, 0);
2458 if (GET_CODE (addr1) == PLUS)
2460 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2461 if (TARGET_AVOID_XFORM)
2463 emit_insn (gen_add3_insn (op2, XEXP (addr1, 1), op2));
2467 addr2 = gen_rtx_PLUS (Pmode, op2, XEXP (addr1, 1));
2469 else if (TARGET_AVOID_XFORM)
2471 emit_insn (gen_add3_insn (op2, addr1, GEN_INT (4)));
2476 emit_move_insn (op2, GEN_INT (4));
2477 addr2 = gen_rtx_PLUS (Pmode, op2, addr1);
2480 emit_insn (gen_lshrdi3 (op3, src, GEN_INT (32)));
2481 if (BYTES_BIG_ENDIAN)
2483 word_high = change_address (dest, SImode, addr1);
2484 word_low = change_address (dest, SImode, addr2);
2488 word_high = change_address (dest, SImode, addr2);
2489 word_low = change_address (dest, SImode, addr1);
2491 emit_insn (gen_bswapsi2 (word_high, src_si));
2492 emit_insn (gen_bswapsi2 (word_low, op3_si));
2496 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2497 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2498 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
2499 (clobber (match_operand:DI 3 "gpc_reg_operand" ""))
2500 (clobber (match_operand:DI 4 "" ""))]
2501 "TARGET_POWERPC64 && reload_completed"
2505 rtx dest = operands[0];
2506 rtx src = operands[1];
2507 rtx op2 = operands[2];
2508 rtx op3 = operands[3];
2509 int lo_off = BYTES_BIG_ENDIAN ? 4 : 0;
2510 rtx dest_si = simplify_gen_subreg (SImode, dest, DImode, lo_off);
2511 rtx src_si = simplify_gen_subreg (SImode, src, DImode, lo_off);
2512 rtx op2_si = simplify_gen_subreg (SImode, op2, DImode, lo_off);
2513 rtx op3_si = simplify_gen_subreg (SImode, op3, DImode, lo_off);
2515 emit_insn (gen_lshrdi3 (op2, src, GEN_INT (32)));
2516 emit_insn (gen_bswapsi2 (dest_si, src_si));
2517 emit_insn (gen_bswapsi2 (op3_si, op2_si));
2518 emit_insn (gen_ashldi3 (dest, dest, GEN_INT (32)));
2519 emit_insn (gen_iordi3 (dest, dest, op3));
2522 (define_insn "bswapdi2_32bit"
2523 [(set (match_operand:DI 0 "reg_or_mem_operand" "=&r,Z,&r")
2524 (bswap:DI (match_operand:DI 1 "reg_or_mem_operand" "Z,r,r")))
2525 (clobber (match_scratch:SI 2 "=&b,&b,X"))]
2526 "!TARGET_POWERPC64 && (REG_P (operands[0]) || REG_P (operands[1]))"
2528 [(set_attr "length" "16,12,36")])
2531 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2532 (bswap:DI (match_operand:DI 1 "indexed_or_indirect_operand" "")))
2533 (clobber (match_operand:SI 2 "gpc_reg_operand" ""))]
2534 "!TARGET_POWERPC64 && reload_completed"
2538 rtx dest = operands[0];
2539 rtx src = operands[1];
2540 rtx op2 = operands[2];
2541 rtx dest1 = simplify_gen_subreg (SImode, dest, DImode, 0);
2542 rtx dest2 = simplify_gen_subreg (SImode, dest, DImode, 4);
2548 addr1 = XEXP (src, 0);
2549 if (GET_CODE (addr1) == PLUS)
2551 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2552 if (TARGET_AVOID_XFORM)
2554 emit_insn (gen_add3_insn (op2, XEXP (addr1, 1), op2));
2558 addr2 = gen_rtx_PLUS (SImode, op2, XEXP (addr1, 1));
2560 else if (TARGET_AVOID_XFORM)
2562 emit_insn (gen_add3_insn (op2, addr1, GEN_INT (4)));
2567 emit_move_insn (op2, GEN_INT (4));
2568 addr2 = gen_rtx_PLUS (SImode, op2, addr1);
2571 word1 = change_address (src, SImode, addr1);
2572 word2 = change_address (src, SImode, addr2);
2574 emit_insn (gen_bswapsi2 (dest2, word1));
2575 emit_insn (gen_bswapsi2 (dest1, word2));
2579 [(set (match_operand:DI 0 "indexed_or_indirect_operand" "")
2580 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2581 (clobber (match_operand:SI 2 "gpc_reg_operand" ""))]
2582 "!TARGET_POWERPC64 && reload_completed"
2586 rtx dest = operands[0];
2587 rtx src = operands[1];
2588 rtx op2 = operands[2];
2589 rtx src1 = simplify_gen_subreg (SImode, src, DImode, 0);
2590 rtx src2 = simplify_gen_subreg (SImode, src, DImode, 4);
2596 addr1 = XEXP (dest, 0);
2597 if (GET_CODE (addr1) == PLUS)
2599 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2600 if (TARGET_AVOID_XFORM)
2602 emit_insn (gen_add3_insn (op2, XEXP (addr1, 1), op2));
2606 addr2 = gen_rtx_PLUS (SImode, op2, XEXP (addr1, 1));
2608 else if (TARGET_AVOID_XFORM)
2610 emit_insn (gen_add3_insn (op2, addr1, GEN_INT (4)));
2615 emit_move_insn (op2, GEN_INT (4));
2616 addr2 = gen_rtx_PLUS (SImode, op2, addr1);
2619 word1 = change_address (dest, SImode, addr1);
2620 word2 = change_address (dest, SImode, addr2);
2622 emit_insn (gen_bswapsi2 (word2, src1));
2623 emit_insn (gen_bswapsi2 (word1, src2));
2627 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2628 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2629 (clobber (match_operand:SI 2 "" ""))]
2630 "!TARGET_POWERPC64 && reload_completed"
2634 rtx dest = operands[0];
2635 rtx src = operands[1];
2636 rtx src1 = simplify_gen_subreg (SImode, src, DImode, 0);
2637 rtx src2 = simplify_gen_subreg (SImode, src, DImode, 4);
2638 rtx dest1 = simplify_gen_subreg (SImode, dest, DImode, 0);
2639 rtx dest2 = simplify_gen_subreg (SImode, dest, DImode, 4);
2641 emit_insn (gen_bswapsi2 (dest1, src2));
2642 emit_insn (gen_bswapsi2 (dest2, src1));
2645 (define_insn "mulsi3"
2646 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2647 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2648 (match_operand:SI 2 "reg_or_short_operand" "r,I")))]
2654 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
2655 (const_string "imul3")
2656 (match_operand:SI 2 "short_cint_operand" "")
2657 (const_string "imul2")]
2658 (const_string "imul")))])
2660 (define_insn "*mulsi3_internal1"
2661 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2662 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2663 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2665 (clobber (match_scratch:SI 3 "=r,r"))]
2670 [(set_attr "type" "imul_compare")
2671 (set_attr "length" "4,8")])
2674 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
2675 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2676 (match_operand:SI 2 "gpc_reg_operand" ""))
2678 (clobber (match_scratch:SI 3 ""))]
2679 "TARGET_32BIT && reload_completed"
2681 (mult:SI (match_dup 1) (match_dup 2)))
2683 (compare:CC (match_dup 3)
2687 (define_insn "*mulsi3_internal2"
2688 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2689 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2690 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2692 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2693 (mult:SI (match_dup 1) (match_dup 2)))]
2698 [(set_attr "type" "imul_compare")
2699 (set_attr "length" "4,8")])
2702 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
2703 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2704 (match_operand:SI 2 "gpc_reg_operand" ""))
2706 (set (match_operand:SI 0 "gpc_reg_operand" "")
2707 (mult:SI (match_dup 1) (match_dup 2)))]
2708 "TARGET_32BIT && reload_completed"
2710 (mult:SI (match_dup 1) (match_dup 2)))
2712 (compare:CC (match_dup 0)
2717 (define_insn "udiv<mode>3"
2718 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2719 (udiv:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2720 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
2723 [(set_attr "type" "<idiv_ldiv>")])
2726 ;; For powers of two we can do srai/aze for divide and then adjust for
2727 ;; modulus. If it isn't a power of two, force operands into register and do
2729 (define_expand "div<mode>3"
2730 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2731 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2732 (match_operand:GPR 2 "reg_or_cint_operand" "")))]
2735 if (GET_CODE (operands[2]) != CONST_INT
2736 || INTVAL (operands[2]) <= 0
2737 || exact_log2 (INTVAL (operands[2])) < 0)
2738 operands[2] = force_reg (<MODE>mode, operands[2]);
2741 (define_insn "*div<mode>3"
2742 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2743 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2744 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
2747 [(set_attr "type" "<idiv_ldiv>")])
2749 (define_expand "mod<mode>3"
2750 [(use (match_operand:GPR 0 "gpc_reg_operand" ""))
2751 (use (match_operand:GPR 1 "gpc_reg_operand" ""))
2752 (use (match_operand:GPR 2 "reg_or_cint_operand" ""))]
2760 if (GET_CODE (operands[2]) != CONST_INT
2761 || INTVAL (operands[2]) <= 0
2762 || (i = exact_log2 (INTVAL (operands[2]))) < 0)
2765 temp1 = gen_reg_rtx (<MODE>mode);
2766 temp2 = gen_reg_rtx (<MODE>mode);
2768 emit_insn (gen_div<mode>3 (temp1, operands[1], operands[2]));
2769 emit_insn (gen_ashl<mode>3 (temp2, temp1, GEN_INT (i)));
2770 emit_insn (gen_sub<mode>3 (operands[0], operands[1], temp2));
2775 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2776 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2777 (match_operand:GPR 2 "exact_log2_cint_operand" "N")))]
2779 "sra<wd>i %0,%1,%p2\;addze %0,%0"
2780 [(set_attr "type" "two")
2781 (set_attr "length" "8")])
2784 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2785 (compare:CC (div:P (match_operand:P 1 "gpc_reg_operand" "r,r")
2786 (match_operand:P 2 "exact_log2_cint_operand" "N,N"))
2788 (clobber (match_scratch:P 3 "=r,r"))]
2791 sra<wd>i %3,%1,%p2\;addze. %3,%3
2793 [(set_attr "type" "compare")
2794 (set_attr "length" "8,12")
2795 (set_attr "cell_micro" "not")])
2798 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2799 (compare:CC (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2800 (match_operand:GPR 2 "exact_log2_cint_operand"
2803 (clobber (match_scratch:GPR 3 ""))]
2806 (div:<MODE> (match_dup 1) (match_dup 2)))
2808 (compare:CC (match_dup 3)
2813 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2814 (compare:CC (div:P (match_operand:P 1 "gpc_reg_operand" "r,r")
2815 (match_operand:P 2 "exact_log2_cint_operand" "N,N"))
2817 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
2818 (div:P (match_dup 1) (match_dup 2)))]
2821 sra<wd>i %0,%1,%p2\;addze. %0,%0
2823 [(set_attr "type" "compare")
2824 (set_attr "length" "8,12")
2825 (set_attr "cell_micro" "not")])
2828 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2829 (compare:CC (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2830 (match_operand:GPR 2 "exact_log2_cint_operand"
2833 (set (match_operand:GPR 0 "gpc_reg_operand" "")
2834 (div:GPR (match_dup 1) (match_dup 2)))]
2837 (div:<MODE> (match_dup 1) (match_dup 2)))
2839 (compare:CC (match_dup 0)
2843 ;; Logical instructions
2844 ;; The logical instructions are mostly combined by using match_operator,
2845 ;; but the plain AND insns are somewhat different because there is no
2846 ;; plain 'andi' (only 'andi.'), no plain 'andis', and there are all
2847 ;; those rotate-and-mask operations. Thus, the AND insns come first.
2849 (define_expand "andsi3"
2851 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2852 (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2853 (match_operand:SI 2 "and_operand" "")))
2854 (clobber (match_scratch:CC 3 ""))])]
2858 (define_insn "andsi3_mc"
2859 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
2860 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
2861 (match_operand:SI 2 "and_operand" "?r,T,K,L")))
2862 (clobber (match_scratch:CC 3 "=X,X,x,x"))]
2863 "rs6000_gen_cell_microcode"
2866 rlwinm %0,%1,0,%m2,%M2
2869 [(set_attr "type" "*,*,fast_compare,fast_compare")])
2871 (define_insn "andsi3_nomc"
2872 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2873 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2874 (match_operand:SI 2 "and_operand" "?r,T")))
2875 (clobber (match_scratch:CC 3 "=X,X"))]
2876 "!rs6000_gen_cell_microcode"
2879 rlwinm %0,%1,0,%m2,%M2")
2881 (define_insn "andsi3_internal0_nomc"
2882 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2883 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2884 (match_operand:SI 2 "and_operand" "?r,T")))]
2885 "!rs6000_gen_cell_microcode"
2888 rlwinm %0,%1,0,%m2,%M2")
2891 ;; Note to set cr's other than cr0 we do the and immediate and then
2892 ;; the test again -- this avoids a mfcr which on the higher end
2893 ;; machines causes an execution serialization
2895 (define_insn "*andsi3_internal2_mc"
2896 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2897 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2898 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2900 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2901 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2902 "TARGET_32BIT && rs6000_gen_cell_microcode"
2907 rlwinm. %3,%1,0,%m2,%M2
2912 [(set_attr "type" "fast_compare,fast_compare,fast_compare,delayed_compare,\
2913 compare,compare,compare,compare")
2914 (set_attr "length" "4,4,4,4,8,8,8,8")])
2916 (define_insn "*andsi3_internal3_mc"
2917 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2918 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2919 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2921 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2922 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2923 "TARGET_64BIT && rs6000_gen_cell_microcode"
2928 rlwinm. %3,%1,0,%m2,%M2
2933 [(set_attr "type" "compare,fast_compare,fast_compare,delayed_compare,compare,\
2934 compare,compare,compare")
2935 (set_attr "length" "8,4,4,4,8,8,8,8")])
2938 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
2939 (compare:CC (and:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2940 (match_operand:GPR 2 "and_operand" ""))
2942 (clobber (match_scratch:GPR 3 ""))
2943 (clobber (match_scratch:CC 4 ""))]
2945 [(parallel [(set (match_dup 3)
2946 (and:<MODE> (match_dup 1)
2948 (clobber (match_dup 4))])
2950 (compare:CC (match_dup 3)
2954 ;; We don't have a 32 bit "and. rt,ra,rb" for ppc64. cr is set from the
2955 ;; whole 64 bit reg, and we don't know what is in the high 32 bits.
2958 [(set (match_operand:CC 0 "cc_reg_operand" "")
2959 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2960 (match_operand:SI 2 "gpc_reg_operand" ""))
2962 (clobber (match_scratch:SI 3 ""))
2963 (clobber (match_scratch:CC 4 ""))]
2964 "TARGET_POWERPC64 && reload_completed"
2965 [(parallel [(set (match_dup 3)
2966 (and:SI (match_dup 1)
2968 (clobber (match_dup 4))])
2970 (compare:CC (match_dup 3)
2974 (define_insn "*andsi3_internal4"
2975 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2976 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2977 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2979 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
2980 (and:SI (match_dup 1)
2982 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2983 "TARGET_32BIT && rs6000_gen_cell_microcode"
2988 rlwinm. %0,%1,0,%m2,%M2
2993 [(set_attr "type" "fast_compare,fast_compare,fast_compare,delayed_compare,\
2994 compare,compare,compare,compare")
2995 (set_attr "length" "4,4,4,4,8,8,8,8")])
2997 (define_insn "*andsi3_internal5_mc"
2998 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2999 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
3000 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
3002 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
3003 (and:SI (match_dup 1)
3005 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
3006 "TARGET_64BIT && rs6000_gen_cell_microcode"
3011 rlwinm. %0,%1,0,%m2,%M2
3016 [(set_attr "type" "compare,fast_compare,fast_compare,delayed_compare,compare,\
3017 compare,compare,compare")
3018 (set_attr "length" "8,4,4,4,8,8,8,8")])
3021 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3022 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
3023 (match_operand:SI 2 "and_operand" ""))
3025 (set (match_operand:SI 0 "gpc_reg_operand" "")
3026 (and:SI (match_dup 1)
3028 (clobber (match_scratch:CC 4 ""))]
3030 [(parallel [(set (match_dup 0)
3031 (and:SI (match_dup 1)
3033 (clobber (match_dup 4))])
3035 (compare:CC (match_dup 0)
3040 [(set (match_operand:CC 3 "cc_reg_operand" "")
3041 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
3042 (match_operand:SI 2 "gpc_reg_operand" ""))
3044 (set (match_operand:SI 0 "gpc_reg_operand" "")
3045 (and:SI (match_dup 1)
3047 (clobber (match_scratch:CC 4 ""))]
3048 "TARGET_POWERPC64 && reload_completed"
3049 [(parallel [(set (match_dup 0)
3050 (and:SI (match_dup 1)
3052 (clobber (match_dup 4))])
3054 (compare:CC (match_dup 0)
3058 ;; Handle the PowerPC64 rlwinm corner case
3060 (define_insn_and_split "*andsi3_internal6"
3061 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3062 (and:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3063 (match_operand:SI 2 "mask_operand_wrap" "i")))]
3068 (and:SI (rotate:SI (match_dup 1) (match_dup 3))
3071 (rotate:SI (match_dup 0) (match_dup 5)))]
3074 int mb = extract_MB (operands[2]);
3075 int me = extract_ME (operands[2]);
3076 operands[3] = GEN_INT (me + 1);
3077 operands[5] = GEN_INT (32 - (me + 1));
3078 operands[4] = GEN_INT (~((HOST_WIDE_INT) -1 << (33 + me - mb)));
3080 [(set_attr "length" "8")])
3082 (define_expand "iorsi3"
3083 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3084 (ior:SI (match_operand:SI 1 "gpc_reg_operand" "")
3085 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
3089 if (GET_CODE (operands[2]) == CONST_INT
3090 && ! logical_operand (operands[2], SImode))
3092 HOST_WIDE_INT value = INTVAL (operands[2]);
3093 rtx tmp = ((!can_create_pseudo_p ()
3094 || rtx_equal_p (operands[0], operands[1]))
3095 ? operands[0] : gen_reg_rtx (SImode));
3097 emit_insn (gen_iorsi3 (tmp, operands[1],
3098 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
3099 emit_insn (gen_iorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
3104 (define_expand "xorsi3"
3105 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3106 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
3107 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
3111 if (GET_CODE (operands[2]) == CONST_INT
3112 && ! logical_operand (operands[2], SImode))
3114 HOST_WIDE_INT value = INTVAL (operands[2]);
3115 rtx tmp = ((!can_create_pseudo_p ()
3116 || rtx_equal_p (operands[0], operands[1]))
3117 ? operands[0] : gen_reg_rtx (SImode));
3119 emit_insn (gen_xorsi3 (tmp, operands[1],
3120 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
3121 emit_insn (gen_xorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
3126 (define_insn "*boolsi3_internal1"
3127 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
3128 (match_operator:SI 3 "boolean_or_operator"
3129 [(match_operand:SI 1 "gpc_reg_operand" "%r,r,r")
3130 (match_operand:SI 2 "logical_operand" "r,K,L")]))]
3137 (define_insn "*boolsi3_internal2"
3138 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3139 (compare:CC (match_operator:SI 4 "boolean_or_operator"
3140 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
3141 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3143 (clobber (match_scratch:SI 3 "=r,r"))]
3148 [(set_attr "type" "fast_compare,compare")
3149 (set_attr "length" "4,8")])
3152 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3153 (compare:CC (match_operator:SI 4 "boolean_operator"
3154 [(match_operand:SI 1 "gpc_reg_operand" "")
3155 (match_operand:SI 2 "gpc_reg_operand" "")])
3157 (clobber (match_scratch:SI 3 ""))]
3158 "TARGET_32BIT && reload_completed"
3159 [(set (match_dup 3) (match_dup 4))
3161 (compare:CC (match_dup 3)
3165 (define_insn "*boolsi3_internal3"
3166 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3167 (compare:CC (match_operator:SI 4 "boolean_operator"
3168 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
3169 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3171 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3177 [(set_attr "type" "fast_compare,compare")
3178 (set_attr "length" "4,8")])
3181 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3182 (compare:CC (match_operator:SI 4 "boolean_operator"
3183 [(match_operand:SI 1 "gpc_reg_operand" "")
3184 (match_operand:SI 2 "gpc_reg_operand" "")])
3186 (set (match_operand:SI 0 "gpc_reg_operand" "")
3188 "TARGET_32BIT && reload_completed"
3189 [(set (match_dup 0) (match_dup 4))
3191 (compare:CC (match_dup 0)
3195 ;; Split a logical operation that we can't do in one insn into two insns,
3196 ;; each of which does one 16-bit part. This is used by combine.
3199 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3200 (match_operator:SI 3 "boolean_or_operator"
3201 [(match_operand:SI 1 "gpc_reg_operand" "")
3202 (match_operand:SI 2 "non_logical_cint_operand" "")]))]
3204 [(set (match_dup 0) (match_dup 4))
3205 (set (match_dup 0) (match_dup 5))]
3209 i = GEN_INT (INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff));
3210 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
3212 i = GEN_INT (INTVAL (operands[2]) & 0xffff);
3213 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
3217 (define_insn "*boolcsi3_internal1"
3218 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3219 (match_operator:SI 3 "boolean_operator"
3220 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
3221 (match_operand:SI 2 "gpc_reg_operand" "r")]))]
3225 (define_insn "*boolcsi3_internal2"
3226 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3227 (compare:CC (match_operator:SI 4 "boolean_operator"
3228 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
3229 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3231 (clobber (match_scratch:SI 3 "=r,r"))]
3236 [(set_attr "type" "compare")
3237 (set_attr "length" "4,8")])
3240 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3241 (compare:CC (match_operator:SI 4 "boolean_operator"
3242 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3243 (match_operand:SI 2 "gpc_reg_operand" "")])
3245 (clobber (match_scratch:SI 3 ""))]
3246 "TARGET_32BIT && reload_completed"
3247 [(set (match_dup 3) (match_dup 4))
3249 (compare:CC (match_dup 3)
3253 (define_insn "*boolcsi3_internal3"
3254 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3255 (compare:CC (match_operator:SI 4 "boolean_operator"
3256 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
3257 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3259 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3265 [(set_attr "type" "compare")
3266 (set_attr "length" "4,8")])
3269 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3270 (compare:CC (match_operator:SI 4 "boolean_operator"
3271 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3272 (match_operand:SI 2 "gpc_reg_operand" "")])
3274 (set (match_operand:SI 0 "gpc_reg_operand" "")
3276 "TARGET_32BIT && reload_completed"
3277 [(set (match_dup 0) (match_dup 4))
3279 (compare:CC (match_dup 0)
3283 (define_insn "*boolccsi3_internal1"
3284 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3285 (match_operator:SI 3 "boolean_operator"
3286 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
3287 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))]))]
3291 (define_insn "*boolccsi3_internal2"
3292 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3293 (compare:CC (match_operator:SI 4 "boolean_operator"
3294 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
3295 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
3297 (clobber (match_scratch:SI 3 "=r,r"))]
3302 [(set_attr "type" "fast_compare,compare")
3303 (set_attr "length" "4,8")])
3306 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3307 (compare:CC (match_operator:SI 4 "boolean_operator"
3308 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3309 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
3311 (clobber (match_scratch:SI 3 ""))]
3312 "TARGET_32BIT && reload_completed"
3313 [(set (match_dup 3) (match_dup 4))
3315 (compare:CC (match_dup 3)
3319 (define_insn "*boolccsi3_internal3"
3320 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3321 (compare:CC (match_operator:SI 4 "boolean_operator"
3322 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
3323 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
3325 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3331 [(set_attr "type" "fast_compare,compare")
3332 (set_attr "length" "4,8")])
3335 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3336 (compare:CC (match_operator:SI 4 "boolean_operator"
3337 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3338 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
3340 (set (match_operand:SI 0 "gpc_reg_operand" "")
3342 "TARGET_32BIT && reload_completed"
3343 [(set (match_dup 0) (match_dup 4))
3345 (compare:CC (match_dup 0)
3349 ;; Rotate and shift insns, in all their variants. These support shifts,
3350 ;; field inserts and extracts, and various combinations thereof.
3351 (define_expand "insv"
3352 [(set (zero_extract (match_operand 0 "gpc_reg_operand" "")
3353 (match_operand:SI 1 "const_int_operand" "")
3354 (match_operand:SI 2 "const_int_operand" ""))
3355 (match_operand 3 "gpc_reg_operand" ""))]
3359 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3360 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3361 compiler if the address of the structure is taken later. Likewise, do
3362 not handle invalid E500 subregs. */
3363 if (GET_CODE (operands[0]) == SUBREG
3364 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD
3365 || ((TARGET_E500_DOUBLE || TARGET_SPE)
3366 && invalid_e500_subreg (operands[0], GET_MODE (operands[0])))))
3369 if (TARGET_POWERPC64 && GET_MODE (operands[0]) == DImode)
3370 emit_insn (gen_insvdi_internal (operands[0], operands[1], operands[2],
3373 emit_insn (gen_insvsi_internal (operands[0], operands[1], operands[2],
3378 (define_insn "insvsi_internal"
3379 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3380 (match_operand:SI 1 "const_int_operand" "i")
3381 (match_operand:SI 2 "const_int_operand" "i"))
3382 (match_operand:SI 3 "gpc_reg_operand" "r"))]
3386 int start = INTVAL (operands[2]) & 31;
3387 int size = INTVAL (operands[1]) & 31;
3389 operands[4] = GEN_INT (32 - start - size);
3390 operands[1] = GEN_INT (start + size - 1);
3391 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3393 [(set_attr "type" "insert_word")])
3395 (define_insn "*insvsi_internal1"
3396 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3397 (match_operand:SI 1 "const_int_operand" "i")
3398 (match_operand:SI 2 "const_int_operand" "i"))
3399 (rotate:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3400 (match_operand:SI 4 "const_int_operand" "i")))]
3401 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3404 int shift = INTVAL (operands[4]) & 31;
3405 int start = INTVAL (operands[2]) & 31;
3406 int size = INTVAL (operands[1]) & 31;
3408 operands[4] = GEN_INT (shift - start - size);
3409 operands[1] = GEN_INT (start + size - 1);
3410 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3412 [(set_attr "type" "insert_word")])
3414 (define_insn "*insvsi_internal2"
3415 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3416 (match_operand:SI 1 "const_int_operand" "i")
3417 (match_operand:SI 2 "const_int_operand" "i"))
3418 (ashiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3419 (match_operand:SI 4 "const_int_operand" "i")))]
3420 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3423 int shift = INTVAL (operands[4]) & 31;
3424 int start = INTVAL (operands[2]) & 31;
3425 int size = INTVAL (operands[1]) & 31;
3427 operands[4] = GEN_INT (32 - shift - start - size);
3428 operands[1] = GEN_INT (start + size - 1);
3429 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3431 [(set_attr "type" "insert_word")])
3433 (define_insn "*insvsi_internal3"
3434 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3435 (match_operand:SI 1 "const_int_operand" "i")
3436 (match_operand:SI 2 "const_int_operand" "i"))
3437 (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3438 (match_operand:SI 4 "const_int_operand" "i")))]
3439 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3442 int shift = INTVAL (operands[4]) & 31;
3443 int start = INTVAL (operands[2]) & 31;
3444 int size = INTVAL (operands[1]) & 31;
3446 operands[4] = GEN_INT (32 - shift - start - size);
3447 operands[1] = GEN_INT (start + size - 1);
3448 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3450 [(set_attr "type" "insert_word")])
3452 (define_insn "*insvsi_internal4"
3453 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3454 (match_operand:SI 1 "const_int_operand" "i")
3455 (match_operand:SI 2 "const_int_operand" "i"))
3456 (zero_extract:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3457 (match_operand:SI 4 "const_int_operand" "i")
3458 (match_operand:SI 5 "const_int_operand" "i")))]
3459 "INTVAL (operands[4]) >= INTVAL (operands[1])"
3462 int extract_start = INTVAL (operands[5]) & 31;
3463 int extract_size = INTVAL (operands[4]) & 31;
3464 int insert_start = INTVAL (operands[2]) & 31;
3465 int insert_size = INTVAL (operands[1]) & 31;
3467 /* Align extract field with insert field */
3468 operands[5] = GEN_INT (extract_start + extract_size - insert_start - insert_size);
3469 operands[1] = GEN_INT (insert_start + insert_size - 1);
3470 return \"rlwimi %0,%3,%h5,%h2,%h1\";
3472 [(set_attr "type" "insert_word")])
3474 ;; combine patterns for rlwimi
3475 (define_insn "*insvsi_internal5"
3476 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3477 (ior:SI (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
3478 (match_operand:SI 1 "mask_operand" "i"))
3479 (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3480 (match_operand:SI 2 "const_int_operand" "i"))
3481 (match_operand:SI 5 "mask_operand" "i"))))]
3482 "INTVAL(operands[1]) == ~INTVAL(operands[5])"
3485 int me = extract_ME(operands[5]);
3486 int mb = extract_MB(operands[5]);
3487 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
3488 operands[2] = GEN_INT(mb);
3489 operands[1] = GEN_INT(me);
3490 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3492 [(set_attr "type" "insert_word")])
3494 (define_insn "*insvsi_internal6"
3495 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3496 (ior:SI (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3497 (match_operand:SI 2 "const_int_operand" "i"))
3498 (match_operand:SI 5 "mask_operand" "i"))
3499 (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
3500 (match_operand:SI 1 "mask_operand" "i"))))]
3501 "INTVAL(operands[1]) == ~INTVAL(operands[5])"
3504 int me = extract_ME(operands[5]);
3505 int mb = extract_MB(operands[5]);
3506 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
3507 operands[2] = GEN_INT(mb);
3508 operands[1] = GEN_INT(me);
3509 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3511 [(set_attr "type" "insert_word")])
3513 (define_insn "insvdi_internal"
3514 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3515 (match_operand:SI 1 "const_int_operand" "i")
3516 (match_operand:SI 2 "const_int_operand" "i"))
3517 (match_operand:DI 3 "gpc_reg_operand" "r"))]
3521 int start = INTVAL (operands[2]) & 63;
3522 int size = INTVAL (operands[1]) & 63;
3524 operands[1] = GEN_INT (64 - start - size);
3525 return \"rldimi %0,%3,%H1,%H2\";
3527 [(set_attr "type" "insert_dword")])
3529 (define_insn "*insvdi_internal2"
3530 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3531 (match_operand:SI 1 "const_int_operand" "i")
3532 (match_operand:SI 2 "const_int_operand" "i"))
3533 (ashiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
3534 (match_operand:SI 4 "const_int_operand" "i")))]
3536 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
3539 int shift = INTVAL (operands[4]) & 63;
3540 int start = (INTVAL (operands[2]) & 63) - 32;
3541 int size = INTVAL (operands[1]) & 63;
3543 operands[4] = GEN_INT (64 - shift - start - size);
3544 operands[2] = GEN_INT (start);
3545 operands[1] = GEN_INT (start + size - 1);
3546 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3549 (define_insn "*insvdi_internal3"
3550 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3551 (match_operand:SI 1 "const_int_operand" "i")
3552 (match_operand:SI 2 "const_int_operand" "i"))
3553 (lshiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
3554 (match_operand:SI 4 "const_int_operand" "i")))]
3556 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
3559 int shift = INTVAL (operands[4]) & 63;
3560 int start = (INTVAL (operands[2]) & 63) - 32;
3561 int size = INTVAL (operands[1]) & 63;
3563 operands[4] = GEN_INT (64 - shift - start - size);
3564 operands[2] = GEN_INT (start);
3565 operands[1] = GEN_INT (start + size - 1);
3566 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3569 (define_expand "extzv"
3570 [(set (match_operand 0 "gpc_reg_operand" "")
3571 (zero_extract (match_operand 1 "gpc_reg_operand" "")
3572 (match_operand:SI 2 "const_int_operand" "")
3573 (match_operand:SI 3 "const_int_operand" "")))]
3577 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3578 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3579 compiler if the address of the structure is taken later. */
3580 if (GET_CODE (operands[0]) == SUBREG
3581 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
3584 if (TARGET_POWERPC64 && GET_MODE (operands[1]) == DImode)
3585 emit_insn (gen_extzvdi_internal (operands[0], operands[1], operands[2],
3588 emit_insn (gen_extzvsi_internal (operands[0], operands[1], operands[2],
3593 (define_insn "extzvsi_internal"
3594 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3595 (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3596 (match_operand:SI 2 "const_int_operand" "i")
3597 (match_operand:SI 3 "const_int_operand" "i")))]
3601 int start = INTVAL (operands[3]) & 31;
3602 int size = INTVAL (operands[2]) & 31;
3604 if (start + size >= 32)
3605 operands[3] = const0_rtx;
3607 operands[3] = GEN_INT (start + size);
3608 return \"rlwinm %0,%1,%3,%s2,31\";
3611 (define_insn "*extzvsi_internal1"
3612 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3613 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3614 (match_operand:SI 2 "const_int_operand" "i,i")
3615 (match_operand:SI 3 "const_int_operand" "i,i"))
3617 (clobber (match_scratch:SI 4 "=r,r"))]
3621 int start = INTVAL (operands[3]) & 31;
3622 int size = INTVAL (operands[2]) & 31;
3624 /* Force split for non-cc0 compare. */
3625 if (which_alternative == 1)
3628 /* If the bit-field being tested fits in the upper or lower half of a
3629 word, it is possible to use andiu. or andil. to test it. This is
3630 useful because the condition register set-use delay is smaller for
3631 andi[ul]. than for rlinm. This doesn't work when the starting bit
3632 position is 0 because the LT and GT bits may be set wrong. */
3634 if ((start > 0 && start + size <= 16) || start >= 16)
3636 operands[3] = GEN_INT (((1 << (16 - (start & 15)))
3637 - (1 << (16 - (start & 15) - size))));
3639 return \"andis. %4,%1,%3\";
3641 return \"andi. %4,%1,%3\";
3644 if (start + size >= 32)
3645 operands[3] = const0_rtx;
3647 operands[3] = GEN_INT (start + size);
3648 return \"rlwinm. %4,%1,%3,%s2,31\";
3650 [(set_attr "type" "delayed_compare")
3651 (set_attr "length" "4,8")])
3654 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3655 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3656 (match_operand:SI 2 "const_int_operand" "")
3657 (match_operand:SI 3 "const_int_operand" ""))
3659 (clobber (match_scratch:SI 4 ""))]
3662 (zero_extract:SI (match_dup 1) (match_dup 2)
3665 (compare:CC (match_dup 4)
3669 (define_insn "*extzvsi_internal2"
3670 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3671 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3672 (match_operand:SI 2 "const_int_operand" "i,i")
3673 (match_operand:SI 3 "const_int_operand" "i,i"))
3675 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3676 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3680 int start = INTVAL (operands[3]) & 31;
3681 int size = INTVAL (operands[2]) & 31;
3683 /* Force split for non-cc0 compare. */
3684 if (which_alternative == 1)
3687 /* Since we are using the output value, we can't ignore any need for
3688 a shift. The bit-field must end at the LSB. */
3689 if (start >= 16 && start + size == 32)
3691 operands[3] = GEN_INT ((1 << size) - 1);
3692 return \"andi. %0,%1,%3\";
3695 if (start + size >= 32)
3696 operands[3] = const0_rtx;
3698 operands[3] = GEN_INT (start + size);
3699 return \"rlwinm. %0,%1,%3,%s2,31\";
3701 [(set_attr "type" "delayed_compare")
3702 (set_attr "length" "4,8")])
3705 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
3706 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3707 (match_operand:SI 2 "const_int_operand" "")
3708 (match_operand:SI 3 "const_int_operand" ""))
3710 (set (match_operand:SI 0 "gpc_reg_operand" "")
3711 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3714 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))
3716 (compare:CC (match_dup 0)
3720 (define_insn "extzvdi_internal"
3721 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
3722 (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3723 (match_operand:SI 2 "const_int_operand" "i")
3724 (match_operand:SI 3 "const_int_operand" "i")))]
3728 int start = INTVAL (operands[3]) & 63;
3729 int size = INTVAL (operands[2]) & 63;
3731 if (start + size >= 64)
3732 operands[3] = const0_rtx;
3734 operands[3] = GEN_INT (start + size);
3735 operands[2] = GEN_INT (64 - size);
3736 return \"rldicl %0,%1,%3,%2\";
3739 (define_insn "*extzvdi_internal1"
3740 [(set (match_operand:CC 0 "gpc_reg_operand" "=x")
3741 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3742 (match_operand:SI 2 "const_int_operand" "i")
3743 (match_operand:SI 3 "const_int_operand" "i"))
3745 (clobber (match_scratch:DI 4 "=r"))]
3746 "TARGET_64BIT && rs6000_gen_cell_microcode"
3749 int start = INTVAL (operands[3]) & 63;
3750 int size = INTVAL (operands[2]) & 63;
3752 if (start + size >= 64)
3753 operands[3] = const0_rtx;
3755 operands[3] = GEN_INT (start + size);
3756 operands[2] = GEN_INT (64 - size);
3757 return \"rldicl. %4,%1,%3,%2\";
3759 [(set_attr "type" "compare")])
3761 (define_insn "*extzvdi_internal2"
3762 [(set (match_operand:CC 4 "gpc_reg_operand" "=x")
3763 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3764 (match_operand:SI 2 "const_int_operand" "i")
3765 (match_operand:SI 3 "const_int_operand" "i"))
3767 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
3768 (zero_extract:DI (match_dup 1) (match_dup 2) (match_dup 3)))]
3769 "TARGET_64BIT && rs6000_gen_cell_microcode"
3772 int start = INTVAL (operands[3]) & 63;
3773 int size = INTVAL (operands[2]) & 63;
3775 if (start + size >= 64)
3776 operands[3] = const0_rtx;
3778 operands[3] = GEN_INT (start + size);
3779 operands[2] = GEN_INT (64 - size);
3780 return \"rldicl. %0,%1,%3,%2\";
3782 [(set_attr "type" "compare")])
3784 (define_insn "rotlsi3"
3785 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3786 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3787 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
3790 rlwnm %0,%1,%2,0xffffffff
3791 rlwinm %0,%1,%h2,0xffffffff"
3792 [(set_attr "type" "var_shift_rotate,integer")])
3794 (define_insn "*rotlsi3_64"
3795 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
3797 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3798 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))))]
3801 rlwnm %0,%1,%2,0xffffffff
3802 rlwinm %0,%1,%h2,0xffffffff"
3803 [(set_attr "type" "var_shift_rotate,integer")])
3805 (define_insn "*rotlsi3_internal2"
3806 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3807 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3808 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3810 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
3813 rlwnm. %3,%1,%2,0xffffffff
3814 rlwinm. %3,%1,%h2,0xffffffff
3817 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3818 (set_attr "length" "4,4,8,8")])
3821 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3822 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3823 (match_operand:SI 2 "reg_or_cint_operand" ""))
3825 (clobber (match_scratch:SI 3 ""))]
3828 (rotate:SI (match_dup 1) (match_dup 2)))
3830 (compare:CC (match_dup 3)
3834 (define_insn "*rotlsi3_internal3"
3835 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
3836 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3837 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3839 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
3840 (rotate:SI (match_dup 1) (match_dup 2)))]
3843 rlwnm. %0,%1,%2,0xffffffff
3844 rlwinm. %0,%1,%h2,0xffffffff
3847 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3848 (set_attr "length" "4,4,8,8")])
3851 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3852 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3853 (match_operand:SI 2 "reg_or_cint_operand" ""))
3855 (set (match_operand:SI 0 "gpc_reg_operand" "")
3856 (rotate:SI (match_dup 1) (match_dup 2)))]
3859 (rotate:SI (match_dup 1) (match_dup 2)))
3861 (compare:CC (match_dup 0)
3865 (define_insn "*rotlsi3_internal4"
3866 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3867 (and:SI (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3868 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
3869 (match_operand:SI 3 "mask_operand" "n,n")))]
3872 rlwnm %0,%1,%2,%m3,%M3
3873 rlwinm %0,%1,%h2,%m3,%M3"
3874 [(set_attr "type" "var_shift_rotate,integer")])
3876 (define_insn "*rotlsi3_internal5"
3877 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3879 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3880 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3881 (match_operand:SI 3 "mask_operand" "n,n,n,n"))
3883 (clobber (match_scratch:SI 4 "=r,r,r,r"))]
3886 rlwnm. %4,%1,%2,%m3,%M3
3887 rlwinm. %4,%1,%h2,%m3,%M3
3890 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3891 (set_attr "length" "4,4,8,8")])
3894 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3896 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3897 (match_operand:SI 2 "reg_or_cint_operand" ""))
3898 (match_operand:SI 3 "mask_operand" ""))
3900 (clobber (match_scratch:SI 4 ""))]
3903 (and:SI (rotate:SI (match_dup 1)
3907 (compare:CC (match_dup 4)
3911 (define_insn "*rotlsi3_internal6"
3912 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
3914 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3915 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3916 (match_operand:SI 3 "mask_operand" "n,n,n,n"))
3918 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
3919 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3922 rlwnm. %0,%1,%2,%m3,%M3
3923 rlwinm. %0,%1,%h2,%m3,%M3
3926 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3927 (set_attr "length" "4,4,8,8")])
3930 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
3932 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3933 (match_operand:SI 2 "reg_or_cint_operand" ""))
3934 (match_operand:SI 3 "mask_operand" ""))
3936 (set (match_operand:SI 0 "gpc_reg_operand" "")
3937 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3940 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
3942 (compare:CC (match_dup 0)
3946 (define_insn "*rotlsi3_internal7le"
3947 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3950 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3951 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
3953 "rlw%I2nm %0,%1,%h2,0xff"
3954 [(set (attr "cell_micro")
3955 (if_then_else (match_operand:SI 2 "const_int_operand" "")
3956 (const_string "not")
3957 (const_string "always")))])
3959 (define_insn "*rotlsi3_internal7be"
3960 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3963 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3964 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 3)))]
3966 "rlw%I2nm %0,%1,%h2,0xff"
3967 [(set (attr "cell_micro")
3968 (if_then_else (match_operand:SI 2 "const_int_operand" "")
3969 (const_string "not")
3970 (const_string "always")))])
3972 (define_insn "*rotlsi3_internal8le"
3973 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3974 (compare:CC (zero_extend:SI
3976 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3977 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
3979 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
3982 rlwnm. %3,%1,%2,0xff
3983 rlwinm. %3,%1,%h2,0xff
3986 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3987 (set_attr "length" "4,4,8,8")])
3989 (define_insn "*rotlsi3_internal8be"
3990 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3991 (compare:CC (zero_extend:SI
3993 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3994 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 3))
3996 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
3999 rlwnm. %3,%1,%2,0xff
4000 rlwinm. %3,%1,%h2,0xff
4003 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4004 (set_attr "length" "4,4,8,8")])
4007 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4008 (compare:CC (zero_extend:SI
4010 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4011 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4013 (clobber (match_scratch:SI 3 ""))]
4014 "!BYTES_BIG_ENDIAN && reload_completed"
4016 (zero_extend:SI (subreg:QI
4017 (rotate:SI (match_dup 1)
4020 (compare:CC (match_dup 3)
4025 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4026 (compare:CC (zero_extend:SI
4028 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4029 (match_operand:SI 2 "reg_or_cint_operand" "")) 3))
4031 (clobber (match_scratch:SI 3 ""))]
4032 "BYTES_BIG_ENDIAN && reload_completed"
4034 (zero_extend:SI (subreg:QI
4035 (rotate:SI (match_dup 1)
4038 (compare:CC (match_dup 3)
4042 (define_insn "*rotlsi3_internal9le"
4043 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4044 (compare:CC (zero_extend:SI
4046 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4047 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4049 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4050 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4053 rlwnm. %0,%1,%2,0xff
4054 rlwinm. %0,%1,%h2,0xff
4057 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4058 (set_attr "length" "4,4,8,8")])
4060 (define_insn "*rotlsi3_internal9be"
4061 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4062 (compare:CC (zero_extend:SI
4064 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4065 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 3))
4067 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4068 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 3)))]
4071 rlwnm. %0,%1,%2,0xff
4072 rlwinm. %0,%1,%h2,0xff
4075 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4076 (set_attr "length" "4,4,8,8")])
4079 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4080 (compare:CC (zero_extend:SI
4082 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4083 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4085 (set (match_operand:SI 0 "gpc_reg_operand" "")
4086 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4087 "!BYTES_BIG_ENDIAN && reload_completed"
4089 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
4091 (compare:CC (match_dup 0)
4096 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4097 (compare:CC (zero_extend:SI
4099 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4100 (match_operand:SI 2 "reg_or_cint_operand" "")) 3))
4102 (set (match_operand:SI 0 "gpc_reg_operand" "")
4103 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 3)))]
4104 "BYTES_BIG_ENDIAN && reload_completed"
4106 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 3)))
4108 (compare:CC (match_dup 0)
4112 (define_insn "*rotlsi3_internal10le"
4113 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4116 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4117 (match_operand:SI 2 "reg_or_cint_operand" "r,i")) 0)))]
4120 rlwnm %0,%1,%2,0xffff
4121 rlwinm %0,%1,%h2,0xffff"
4122 [(set_attr "type" "var_shift_rotate,integer")])
4124 (define_insn "*rotlsi3_internal10be"
4125 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4128 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4129 (match_operand:SI 2 "reg_or_cint_operand" "r,i")) 2)))]
4132 rlwnm %0,%1,%2,0xffff
4133 rlwinm %0,%1,%h2,0xffff"
4134 [(set_attr "type" "var_shift_rotate,integer")])
4136 (define_insn "*rotlsi3_internal11le"
4137 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4138 (compare:CC (zero_extend:SI
4140 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4141 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4143 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4146 rlwnm. %3,%1,%2,0xffff
4147 rlwinm. %3,%1,%h2,0xffff
4150 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4151 (set_attr "length" "4,4,8,8")])
4153 (define_insn "*rotlsi3_internal11be"
4154 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4155 (compare:CC (zero_extend:SI
4157 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4158 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 2))
4160 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4163 rlwnm. %3,%1,%2,0xffff
4164 rlwinm. %3,%1,%h2,0xffff
4167 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4168 (set_attr "length" "4,4,8,8")])
4171 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4172 (compare:CC (zero_extend:SI
4174 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4175 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4177 (clobber (match_scratch:SI 3 ""))]
4178 "!BYTES_BIG_ENDIAN && reload_completed"
4180 (zero_extend:SI (subreg:HI
4181 (rotate:SI (match_dup 1)
4184 (compare:CC (match_dup 3)
4189 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4190 (compare:CC (zero_extend:SI
4192 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4193 (match_operand:SI 2 "reg_or_cint_operand" "")) 2))
4195 (clobber (match_scratch:SI 3 ""))]
4196 "BYTES_BIG_ENDIAN && reload_completed"
4198 (zero_extend:SI (subreg:HI
4199 (rotate:SI (match_dup 1)
4202 (compare:CC (match_dup 3)
4206 (define_insn "*rotlsi3_internal12le"
4207 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4208 (compare:CC (zero_extend:SI
4210 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4211 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4213 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4214 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4217 rlwnm. %0,%1,%2,0xffff
4218 rlwinm. %0,%1,%h2,0xffff
4221 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4222 (set_attr "length" "4,4,8,8")])
4224 (define_insn "*rotlsi3_internal12be"
4225 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4226 (compare:CC (zero_extend:SI
4228 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4229 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 2))
4231 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4232 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 2)))]
4235 rlwnm. %0,%1,%2,0xffff
4236 rlwinm. %0,%1,%h2,0xffff
4239 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4240 (set_attr "length" "4,4,8,8")])
4243 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4244 (compare:CC (zero_extend:SI
4246 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4247 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4249 (set (match_operand:SI 0 "gpc_reg_operand" "")
4250 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4251 "!BYTES_BIG_ENDIAN && reload_completed"
4253 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
4255 (compare:CC (match_dup 0)
4260 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4261 (compare:CC (zero_extend:SI
4263 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4264 (match_operand:SI 2 "reg_or_cint_operand" "")) 2))
4266 (set (match_operand:SI 0 "gpc_reg_operand" "")
4267 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 2)))]
4268 "BYTES_BIG_ENDIAN && reload_completed"
4270 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 2)))
4272 (compare:CC (match_dup 0)
4276 (define_insn "ashlsi3"
4277 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4278 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4279 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
4284 [(set_attr "type" "var_shift_rotate,shift")])
4286 (define_insn "*ashlsi3_64"
4287 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
4289 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4290 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))))]
4295 [(set_attr "type" "var_shift_rotate,shift")])
4298 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4299 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4300 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4302 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4309 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4310 (set_attr "length" "4,4,8,8")])
4313 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4314 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4315 (match_operand:SI 2 "reg_or_cint_operand" ""))
4317 (clobber (match_scratch:SI 3 ""))]
4318 "TARGET_32BIT && reload_completed"
4320 (ashift:SI (match_dup 1) (match_dup 2)))
4322 (compare:CC (match_dup 3)
4327 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4328 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4329 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4331 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4332 (ashift:SI (match_dup 1) (match_dup 2)))]
4339 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4340 (set_attr "length" "4,4,8,8")])
4343 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4344 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4345 (match_operand:SI 2 "reg_or_cint_operand" ""))
4347 (set (match_operand:SI 0 "gpc_reg_operand" "")
4348 (ashift:SI (match_dup 1) (match_dup 2)))]
4349 "TARGET_32BIT && reload_completed"
4351 (ashift:SI (match_dup 1) (match_dup 2)))
4353 (compare:CC (match_dup 0)
4357 (define_insn "rlwinm"
4358 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4359 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4360 (match_operand:SI 2 "const_int_operand" "i"))
4361 (match_operand:SI 3 "mask_operand" "n")))]
4362 "includes_lshift_p (operands[2], operands[3])"
4363 "rlwinm %0,%1,%h2,%m3,%M3")
4366 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4368 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4369 (match_operand:SI 2 "const_int_operand" "i,i"))
4370 (match_operand:SI 3 "mask_operand" "n,n"))
4372 (clobber (match_scratch:SI 4 "=r,r"))]
4373 "includes_lshift_p (operands[2], operands[3])"
4375 rlwinm. %4,%1,%h2,%m3,%M3
4377 [(set_attr "type" "delayed_compare")
4378 (set_attr "length" "4,8")])
4381 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4383 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4384 (match_operand:SI 2 "const_int_operand" ""))
4385 (match_operand:SI 3 "mask_operand" ""))
4387 (clobber (match_scratch:SI 4 ""))]
4388 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
4390 (and:SI (ashift:SI (match_dup 1) (match_dup 2))
4393 (compare:CC (match_dup 4)
4398 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4400 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4401 (match_operand:SI 2 "const_int_operand" "i,i"))
4402 (match_operand:SI 3 "mask_operand" "n,n"))
4404 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4405 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4406 "includes_lshift_p (operands[2], operands[3])"
4408 rlwinm. %0,%1,%h2,%m3,%M3
4410 [(set_attr "type" "delayed_compare")
4411 (set_attr "length" "4,8")])
4414 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
4416 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4417 (match_operand:SI 2 "const_int_operand" ""))
4418 (match_operand:SI 3 "mask_operand" ""))
4420 (set (match_operand:SI 0 "gpc_reg_operand" "")
4421 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4422 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
4424 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4426 (compare:CC (match_dup 0)
4430 (define_insn "lshrsi3"
4431 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
4432 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
4433 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i")))]
4439 [(set_attr "type" "integer,var_shift_rotate,shift")])
4441 (define_insn "*lshrsi3_64"
4442 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
4444 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4445 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))))]
4450 [(set_attr "type" "var_shift_rotate,shift")])
4453 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,?y,?y,?y")
4454 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
4455 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i,O,r,i"))
4457 (clobber (match_scratch:SI 3 "=X,r,r,X,r,r"))]
4466 [(set_attr "type" "fast_compare,var_delayed_compare,delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4467 (set_attr "length" "4,4,4,8,8,8")])
4470 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4471 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4472 (match_operand:SI 2 "reg_or_cint_operand" ""))
4474 (clobber (match_scratch:SI 3 ""))]
4475 "TARGET_32BIT && reload_completed"
4477 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4479 (compare:CC (match_dup 3)
4484 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,?y,?y,?y")
4485 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
4486 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i,O,r,i"))
4488 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
4489 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
4498 [(set_attr "type" "fast_compare,var_delayed_compare,delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4499 (set_attr "length" "4,4,4,8,8,8")])
4502 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4503 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4504 (match_operand:SI 2 "reg_or_cint_operand" ""))
4506 (set (match_operand:SI 0 "gpc_reg_operand" "")
4507 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
4508 "TARGET_32BIT && reload_completed"
4510 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4512 (compare:CC (match_dup 0)
4517 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4518 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4519 (match_operand:SI 2 "const_int_operand" "i"))
4520 (match_operand:SI 3 "mask_operand" "n")))]
4521 "includes_rshift_p (operands[2], operands[3])"
4522 "rlwinm %0,%1,%s2,%m3,%M3")
4525 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4527 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4528 (match_operand:SI 2 "const_int_operand" "i,i"))
4529 (match_operand:SI 3 "mask_operand" "n,n"))
4531 (clobber (match_scratch:SI 4 "=r,r"))]
4532 "includes_rshift_p (operands[2], operands[3])"
4534 rlwinm. %4,%1,%s2,%m3,%M3
4536 [(set_attr "type" "delayed_compare")
4537 (set_attr "length" "4,8")])
4540 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4542 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4543 (match_operand:SI 2 "const_int_operand" ""))
4544 (match_operand:SI 3 "mask_operand" ""))
4546 (clobber (match_scratch:SI 4 ""))]
4547 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
4549 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2))
4552 (compare:CC (match_dup 4)
4557 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4559 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4560 (match_operand:SI 2 "const_int_operand" "i,i"))
4561 (match_operand:SI 3 "mask_operand" "n,n"))
4563 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4564 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4565 "includes_rshift_p (operands[2], operands[3])"
4567 rlwinm. %0,%1,%s2,%m3,%M3
4569 [(set_attr "type" "delayed_compare")
4570 (set_attr "length" "4,8")])
4573 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
4575 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4576 (match_operand:SI 2 "const_int_operand" ""))
4577 (match_operand:SI 3 "mask_operand" ""))
4579 (set (match_operand:SI 0 "gpc_reg_operand" "")
4580 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4581 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
4583 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4585 (compare:CC (match_dup 0)
4589 (define_insn "*lshiftrt_internal1le"
4590 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4593 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4594 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4595 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255))"
4596 "rlwinm %0,%1,%s2,0xff")
4598 (define_insn "*lshiftrt_internal1be"
4599 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4602 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4603 (match_operand:SI 2 "const_int_operand" "i")) 3)))]
4604 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255))"
4605 "rlwinm %0,%1,%s2,0xff")
4607 (define_insn "*lshiftrt_internal2le"
4608 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4612 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4613 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4615 (clobber (match_scratch:SI 3 "=r,r"))]
4616 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255))"
4618 rlwinm. %3,%1,%s2,0xff
4620 [(set_attr "type" "delayed_compare")
4621 (set_attr "length" "4,8")])
4623 (define_insn "*lshiftrt_internal2be"
4624 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4628 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4629 (match_operand:SI 2 "const_int_operand" "i,i")) 3))
4631 (clobber (match_scratch:SI 3 "=r,r"))]
4632 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255))"
4634 rlwinm. %3,%1,%s2,0xff
4636 [(set_attr "type" "delayed_compare")
4637 (set_attr "length" "4,8")])
4640 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4644 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4645 (match_operand:SI 2 "const_int_operand" "")) 0))
4647 (clobber (match_scratch:SI 3 ""))]
4648 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4650 (zero_extend:SI (subreg:QI
4651 (lshiftrt:SI (match_dup 1)
4654 (compare:CC (match_dup 3)
4659 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4663 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4664 (match_operand:SI 2 "const_int_operand" "")) 3))
4666 (clobber (match_scratch:SI 3 ""))]
4667 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4669 (zero_extend:SI (subreg:QI
4670 (lshiftrt:SI (match_dup 1)
4673 (compare:CC (match_dup 3)
4677 (define_insn "*lshiftrt_internal3le"
4678 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4682 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4683 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4685 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4686 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4687 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255))"
4689 rlwinm. %0,%1,%s2,0xff
4691 [(set_attr "type" "delayed_compare")
4692 (set_attr "length" "4,8")])
4694 (define_insn "*lshiftrt_internal3be"
4695 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4699 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4700 (match_operand:SI 2 "const_int_operand" "i,i")) 3))
4702 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4703 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 3)))]
4704 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255))"
4706 rlwinm. %0,%1,%s2,0xff
4708 [(set_attr "type" "delayed_compare")
4709 (set_attr "length" "4,8")])
4712 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4716 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4717 (match_operand:SI 2 "const_int_operand" "")) 0))
4719 (set (match_operand:SI 0 "gpc_reg_operand" "")
4720 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4721 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4723 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4725 (compare:CC (match_dup 0)
4730 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4734 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4735 (match_operand:SI 2 "const_int_operand" "")) 3))
4737 (set (match_operand:SI 0 "gpc_reg_operand" "")
4738 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 3)))]
4739 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4741 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 3)))
4743 (compare:CC (match_dup 0)
4747 (define_insn "*lshiftrt_internal4le"
4748 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4751 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4752 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4753 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535))"
4754 "rlwinm %0,%1,%s2,0xffff")
4756 (define_insn "*lshiftrt_internal4be"
4757 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4760 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4761 (match_operand:SI 2 "const_int_operand" "i")) 2)))]
4762 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535))"
4763 "rlwinm %0,%1,%s2,0xffff")
4765 (define_insn "*lshiftrt_internal5le"
4766 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4770 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4771 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4773 (clobber (match_scratch:SI 3 "=r,r"))]
4774 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535))"
4776 rlwinm. %3,%1,%s2,0xffff
4778 [(set_attr "type" "delayed_compare")
4779 (set_attr "length" "4,8")])
4781 (define_insn "*lshiftrt_internal5be"
4782 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4786 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4787 (match_operand:SI 2 "const_int_operand" "i,i")) 2))
4789 (clobber (match_scratch:SI 3 "=r,r"))]
4790 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535))"
4792 rlwinm. %3,%1,%s2,0xffff
4794 [(set_attr "type" "delayed_compare")
4795 (set_attr "length" "4,8")])
4798 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4802 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4803 (match_operand:SI 2 "const_int_operand" "")) 0))
4805 (clobber (match_scratch:SI 3 ""))]
4806 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4808 (zero_extend:SI (subreg:HI
4809 (lshiftrt:SI (match_dup 1)
4812 (compare:CC (match_dup 3)
4817 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4821 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4822 (match_operand:SI 2 "const_int_operand" "")) 2))
4824 (clobber (match_scratch:SI 3 ""))]
4825 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4827 (zero_extend:SI (subreg:HI
4828 (lshiftrt:SI (match_dup 1)
4831 (compare:CC (match_dup 3)
4835 (define_insn "*lshiftrt_internal5le"
4836 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4840 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4841 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4843 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4844 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4845 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535))"
4847 rlwinm. %0,%1,%s2,0xffff
4849 [(set_attr "type" "delayed_compare")
4850 (set_attr "length" "4,8")])
4852 (define_insn "*lshiftrt_internal5be"
4853 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4857 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4858 (match_operand:SI 2 "const_int_operand" "i,i")) 2))
4860 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4861 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 2)))]
4862 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535))"
4864 rlwinm. %0,%1,%s2,0xffff
4866 [(set_attr "type" "delayed_compare")
4867 (set_attr "length" "4,8")])
4870 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4874 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4875 (match_operand:SI 2 "const_int_operand" "")) 0))
4877 (set (match_operand:SI 0 "gpc_reg_operand" "")
4878 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4879 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4881 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4883 (compare:CC (match_dup 0)
4888 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4892 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4893 (match_operand:SI 2 "const_int_operand" "")) 2))
4895 (set (match_operand:SI 0 "gpc_reg_operand" "")
4896 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 2)))]
4897 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4899 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 2)))
4901 (compare:CC (match_dup 0)
4905 (define_insn "ashrsi3"
4906 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4907 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4908 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
4913 [(set_attr "type" "var_shift_rotate,shift")])
4915 (define_insn "*ashrsi3_64"
4916 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
4918 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4919 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))))]
4924 [(set_attr "type" "var_shift_rotate,shift")])
4927 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4928 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4929 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4931 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4938 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4939 (set_attr "length" "4,4,8,8")])
4942 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4943 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4944 (match_operand:SI 2 "reg_or_cint_operand" ""))
4946 (clobber (match_scratch:SI 3 ""))]
4949 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4951 (compare:CC (match_dup 3)
4956 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4957 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4958 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4960 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4961 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
4968 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4969 (set_attr "length" "4,4,8,8")])
4971 ;; Builtins to replace a division to generate FRE reciprocal estimate
4972 ;; instructions and the necessary fixup instructions
4973 (define_expand "recip<mode>3"
4974 [(match_operand:RECIPF 0 "gpc_reg_operand" "")
4975 (match_operand:RECIPF 1 "gpc_reg_operand" "")
4976 (match_operand:RECIPF 2 "gpc_reg_operand" "")]
4977 "RS6000_RECIP_HAVE_RE_P (<MODE>mode)"
4979 rs6000_emit_swdiv (operands[0], operands[1], operands[2], false);
4983 ;; Split to create division from FRE/FRES/etc. and fixup instead of the normal
4984 ;; hardware division. This is only done before register allocation and with
4985 ;; -ffast-math. This must appear before the divsf3/divdf3 insns.
4987 [(set (match_operand:RECIPF 0 "gpc_reg_operand" "")
4988 (div:RECIPF (match_operand 1 "gpc_reg_operand" "")
4989 (match_operand 2 "gpc_reg_operand" "")))]
4990 "RS6000_RECIP_AUTO_RE_P (<MODE>mode)
4991 && can_create_pseudo_p () && optimize_insn_for_speed_p ()
4992 && flag_finite_math_only && !flag_trapping_math && flag_reciprocal_math"
4995 rs6000_emit_swdiv (operands[0], operands[1], operands[2], true);
4999 ;; Builtins to replace 1/sqrt(x) with instructions using RSQRTE and the
5000 ;; appropriate fixup.
5001 (define_expand "rsqrt<mode>2"
5002 [(match_operand:RECIPF 0 "gpc_reg_operand" "")
5003 (match_operand:RECIPF 1 "gpc_reg_operand" "")]
5004 "RS6000_RECIP_HAVE_RSQRTE_P (<MODE>mode)"
5006 rs6000_emit_swrsqrt (operands[0], operands[1]);
5011 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
5012 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5013 (match_operand:SI 2 "reg_or_cint_operand" ""))
5015 (set (match_operand:SI 0 "gpc_reg_operand" "")
5016 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
5019 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5021 (compare:CC (match_dup 0)
5026 ;; Floating-point insns, excluding normal data motion. We combine the SF/DF
5027 ;; modes here, and also add in conditional vsx/power8-vector support to access
5028 ;; values in the traditional Altivec registers if the appropriate
5029 ;; -mupper-regs-{df,sf} option is enabled.
5031 (define_expand "abs<mode>2"
5032 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
5033 (abs:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")))]
5034 "TARGET_<MODE>_INSN"
5037 (define_insn "*abs<mode>2_fpr"
5038 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
5039 (abs:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")))]
5044 [(set_attr "type" "fp")
5045 (set_attr "fp_type" "fp_addsub_<Fs>")])
5047 (define_insn "*nabs<mode>2_fpr"
5048 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
5051 (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>"))))]
5056 [(set_attr "type" "fp")
5057 (set_attr "fp_type" "fp_addsub_<Fs>")])
5059 (define_expand "neg<mode>2"
5060 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
5061 (neg:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")))]
5062 "TARGET_<MODE>_INSN"
5065 (define_insn "*neg<mode>2_fpr"
5066 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
5067 (neg:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")))]
5072 [(set_attr "type" "fp")
5073 (set_attr "fp_type" "fp_addsub_<Fs>")])
5075 (define_expand "add<mode>3"
5076 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
5077 (plus:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")
5078 (match_operand:SFDF 2 "gpc_reg_operand" "")))]
5079 "TARGET_<MODE>_INSN"
5082 (define_insn "*add<mode>3_fpr"
5083 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
5084 (plus:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "%<Ff>,<Fv>")
5085 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")))]
5088 fadd<Ftrad> %0,%1,%2
5089 xsadd<Fvsx> %x0,%x1,%x2"
5090 [(set_attr "type" "fp")
5091 (set_attr "fp_type" "fp_addsub_<Fs>")])
5093 (define_expand "sub<mode>3"
5094 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
5095 (minus:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")
5096 (match_operand:SFDF 2 "gpc_reg_operand" "")))]
5097 "TARGET_<MODE>_INSN"
5100 (define_insn "*sub<mode>3_fpr"
5101 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
5102 (minus:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")
5103 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")))]
5106 fsub<Ftrad> %0,%1,%2
5107 xssub<Fvsx> %x0,%x1,%x2"
5108 [(set_attr "type" "fp")
5109 (set_attr "fp_type" "fp_addsub_<Fs>")])
5111 (define_expand "mul<mode>3"
5112 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
5113 (mult:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")
5114 (match_operand:SFDF 2 "gpc_reg_operand" "")))]
5115 "TARGET_<MODE>_INSN"
5118 (define_insn "*mul<mode>3_fpr"
5119 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
5120 (mult:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "%<Ff>,<Fv>")
5121 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")))]
5124 fmul<Ftrad> %0,%1,%2
5125 xsmul<Fvsx> %x0,%x1,%x2"
5126 [(set_attr "type" "dmul")
5127 (set_attr "fp_type" "fp_mul_<Fs>")])
5129 (define_expand "div<mode>3"
5130 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
5131 (div:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")
5132 (match_operand:SFDF 2 "gpc_reg_operand" "")))]
5133 "TARGET_<MODE>_INSN && !TARGET_SIMPLE_FPU"
5136 (define_insn "*div<mode>3_fpr"
5137 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
5138 (div:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")
5139 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")))]
5140 "TARGET_<MODE>_FPR && !TARGET_SIMPLE_FPU"
5142 fdiv<Ftrad> %0,%1,%2
5143 xsdiv<Fvsx> %x0,%x1,%x2"
5144 [(set_attr "type" "<Fs>div")
5145 (set_attr "fp_type" "fp_div_<Fs>")])
5147 (define_insn "sqrt<mode>2"
5148 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
5149 (sqrt:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")))]
5150 "TARGET_<MODE>_FPR && !TARGET_SIMPLE_FPU
5151 && (TARGET_PPC_GPOPT || (<MODE>mode == SFmode && TARGET_XILINX_FPU))"
5154 xssqrt<Fvsx> %x0,%x1"
5155 [(set_attr "type" "<Fs>sqrt")
5156 (set_attr "fp_type" "fp_sqrt_<Fs>")])
5158 ;; Floating point reciprocal approximation
5159 (define_insn "fre<Fs>"
5160 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
5161 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")]
5167 [(set_attr "type" "fp")])
5169 (define_insn "*rsqrt<mode>2"
5170 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
5171 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")]
5173 "RS6000_RECIP_HAVE_RSQRTE_P (<MODE>mode)"
5175 frsqrte<Ftrad> %0,%1
5176 xsrsqrte<Fvsx> %x0,%x1"
5177 [(set_attr "type" "fp")])
5179 ;; Floating point comparisons
5180 (define_insn "*cmp<mode>_fpr"
5181 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y,y")
5182 (compare:CCFP (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")
5183 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")))]
5187 xscmpudp %0,%x1,%x2"
5188 [(set_attr "type" "fpcompare")])
5190 ;; Floating point conversions
5191 (define_expand "extendsfdf2"
5192 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5193 (float_extend:DF (match_operand:SF 1 "reg_or_none500mem_operand" "")))]
5194 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5197 (define_insn_and_split "*extendsfdf2_fpr"
5198 [(set (match_operand:DF 0 "gpc_reg_operand" "=d,?d,d,ws,?ws,wv")
5199 (float_extend:DF (match_operand:SF 1 "reg_or_mem_operand" "0,f,m,0,wy,Z")))]
5200 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5208 "&& reload_completed && REG_P (operands[1]) && REGNO (operands[0]) == REGNO (operands[1])"
5211 emit_note (NOTE_INSN_DELETED);
5214 [(set_attr "type" "fp,fp,fpload,fp,vecsimple,fpload")])
5216 (define_expand "truncdfsf2"
5217 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5218 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "")))]
5219 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5222 (define_insn "*truncdfsf2_fpr"
5223 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5224 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "d")))]
5225 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5227 [(set_attr "type" "fp")])
5229 ;; This expander is here to avoid FLOAT_WORDS_BIGENDIAN tests in
5230 ;; builtins.c and optabs.c that are not correct for IBM long double
5231 ;; when little-endian.
5232 (define_expand "signbittf2"
5234 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "")))
5236 (subreg:DI (match_dup 2) 0))
5239 (set (match_operand:SI 0 "gpc_reg_operand" "")
5242 && TARGET_HARD_FLOAT
5243 && (TARGET_FPRS || TARGET_E500_DOUBLE)
5244 && TARGET_LONG_DOUBLE_128"
5246 operands[2] = gen_reg_rtx (DFmode);
5247 operands[3] = gen_reg_rtx (DImode);
5248 if (TARGET_POWERPC64)
5250 operands[4] = gen_reg_rtx (DImode);
5251 operands[5] = gen_rtx_LSHIFTRT (DImode, operands[3], GEN_INT (63));
5252 operands[6] = gen_rtx_SUBREG (SImode, operands[4],
5253 WORDS_BIG_ENDIAN ? 4 : 0);
5257 operands[4] = gen_reg_rtx (SImode);
5258 operands[5] = gen_rtx_SUBREG (SImode, operands[3],
5259 WORDS_BIG_ENDIAN ? 0 : 4);
5260 operands[6] = gen_rtx_LSHIFTRT (SImode, operands[4], GEN_INT (31));
5264 (define_expand "copysign<mode>3"
5266 (abs:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")))
5268 (neg:SFDF (abs:SFDF (match_dup 1))))
5269 (set (match_operand:SFDF 0 "gpc_reg_operand" "")
5270 (if_then_else:SFDF (ge (match_operand:SFDF 2 "gpc_reg_operand" "")
5274 "TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>
5275 && ((TARGET_PPC_GFXOPT
5276 && !HONOR_NANS (<MODE>mode)
5277 && !HONOR_SIGNED_ZEROS (<MODE>mode))
5279 || VECTOR_UNIT_VSX_P (<MODE>mode))"
5281 if (TARGET_CMPB || VECTOR_UNIT_VSX_P (<MODE>mode))
5283 emit_insn (gen_copysign<mode>3_fcpsgn (operands[0], operands[1],
5288 operands[3] = gen_reg_rtx (<MODE>mode);
5289 operands[4] = gen_reg_rtx (<MODE>mode);
5290 operands[5] = CONST0_RTX (<MODE>mode);
5293 ;; Use an unspec rather providing an if-then-else in RTL, to prevent the
5294 ;; compiler from optimizing -0.0
5295 (define_insn "copysign<mode>3_fcpsgn"
5296 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
5297 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")
5298 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")]
5300 "TARGET_<MODE>_FPR && TARGET_CMPB"
5303 xscpsgn<Fvsx> %x0,%x2,%x1"
5304 [(set_attr "type" "fp")])
5306 ;; For MIN, MAX, and conditional move, we use DEFINE_EXPAND's that involve a
5307 ;; fsel instruction and some auxiliary computations. Then we just have a
5308 ;; single DEFINE_INSN for fsel and the define_splits to make them if made by
5310 ;; For MIN, MAX on non-VSX machines, and conditional move all of the time, we
5311 ;; use DEFINE_EXPAND's that involve a fsel instruction and some auxiliary
5312 ;; computations. Then we just have a single DEFINE_INSN for fsel and the
5313 ;; define_splits to make them if made by combine. On VSX machines we have the
5314 ;; min/max instructions.
5316 ;; On VSX, we only check for TARGET_VSX instead of checking for a vsx/p8 vector
5317 ;; to allow either DF/SF to use only traditional registers.
5319 (define_expand "smax<mode>3"
5320 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
5321 (if_then_else:SFDF (ge (match_operand:SFDF 1 "gpc_reg_operand" "")
5322 (match_operand:SFDF 2 "gpc_reg_operand" ""))
5325 "TARGET_<MODE>_FPR && TARGET_PPC_GFXOPT && !flag_trapping_math"
5327 rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]);
5331 (define_insn "*smax<mode>3_vsx"
5332 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
5333 (smax:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "%<Ff>,<Fv>")
5334 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")))]
5335 "TARGET_<MODE>_FPR && TARGET_VSX"
5336 "xsmaxdp %x0,%x1,%x2"
5337 [(set_attr "type" "fp")])
5339 (define_expand "smin<mode>3"
5340 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
5341 (if_then_else:SFDF (ge (match_operand:SFDF 1 "gpc_reg_operand" "")
5342 (match_operand:SFDF 2 "gpc_reg_operand" ""))
5345 "TARGET_<MODE>_FPR && TARGET_PPC_GFXOPT && !flag_trapping_math"
5347 rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]);
5351 (define_insn "*smin<mode>3_vsx"
5352 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
5353 (smin:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "%<Ff>,<Fv>")
5354 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")))]
5355 "TARGET_<MODE>_FPR && TARGET_VSX"
5356 "xsmindp %x0,%x1,%x2"
5357 [(set_attr "type" "fp")])
5360 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
5361 (match_operator:SFDF 3 "min_max_operator"
5362 [(match_operand:SFDF 1 "gpc_reg_operand" "")
5363 (match_operand:SFDF 2 "gpc_reg_operand" "")]))]
5364 "TARGET_<MODE>_FPR && TARGET_PPC_GFXOPT && !flag_trapping_math
5368 rs6000_emit_minmax (operands[0], GET_CODE (operands[3]), operands[1],
5374 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5375 (match_operator:SF 3 "min_max_operator"
5376 [(match_operand:SF 1 "gpc_reg_operand" "")
5377 (match_operand:SF 2 "gpc_reg_operand" "")]))]
5378 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
5379 && TARGET_SINGLE_FLOAT && !flag_trapping_math"
5382 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
5383 operands[1], operands[2]);
5387 (define_expand "mov<mode>cc"
5388 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
5389 (if_then_else:GPR (match_operand 1 "comparison_operator" "")
5390 (match_operand:GPR 2 "gpc_reg_operand" "")
5391 (match_operand:GPR 3 "gpc_reg_operand" "")))]
5395 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5401 ;; We use the BASE_REGS for the isel input operands because, if rA is
5402 ;; 0, the value of 0 is placed in rD upon truth. Similarly for rB
5403 ;; because we may switch the operands and rB may end up being rA.
5405 ;; We need 2 patterns: an unsigned and a signed pattern. We could
5406 ;; leave out the mode in operand 4 and use one pattern, but reload can
5407 ;; change the mode underneath our feet and then gets confused trying
5408 ;; to reload the value.
5409 (define_insn "isel_signed_<mode>"
5410 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
5412 (match_operator 1 "scc_comparison_operator"
5413 [(match_operand:CC 4 "cc_reg_operand" "y,y")
5415 (match_operand:GPR 2 "reg_or_cint_operand" "O,b")
5416 (match_operand:GPR 3 "gpc_reg_operand" "r,r")))]
5419 { return output_isel (operands); }"
5420 [(set_attr "type" "isel")
5421 (set_attr "length" "4")])
5423 (define_insn "isel_unsigned_<mode>"
5424 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
5426 (match_operator 1 "scc_comparison_operator"
5427 [(match_operand:CCUNS 4 "cc_reg_operand" "y,y")
5429 (match_operand:GPR 2 "reg_or_cint_operand" "O,b")
5430 (match_operand:GPR 3 "gpc_reg_operand" "r,r")))]
5433 { return output_isel (operands); }"
5434 [(set_attr "type" "isel")
5435 (set_attr "length" "4")])
5437 ;; These patterns can be useful for combine; they let combine know that
5438 ;; isel can handle reversed comparisons so long as the operands are
5441 (define_insn "*isel_reversed_signed_<mode>"
5442 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
5444 (match_operator 1 "scc_rev_comparison_operator"
5445 [(match_operand:CC 4 "cc_reg_operand" "y")
5447 (match_operand:GPR 2 "gpc_reg_operand" "b")
5448 (match_operand:GPR 3 "gpc_reg_operand" "b")))]
5451 { return output_isel (operands); }"
5452 [(set_attr "type" "isel")
5453 (set_attr "length" "4")])
5455 (define_insn "*isel_reversed_unsigned_<mode>"
5456 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
5458 (match_operator 1 "scc_rev_comparison_operator"
5459 [(match_operand:CCUNS 4 "cc_reg_operand" "y")
5461 (match_operand:GPR 2 "gpc_reg_operand" "b")
5462 (match_operand:GPR 3 "gpc_reg_operand" "b")))]
5465 { return output_isel (operands); }"
5466 [(set_attr "type" "isel")
5467 (set_attr "length" "4")])
5469 (define_expand "movsfcc"
5470 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5471 (if_then_else:SF (match_operand 1 "comparison_operator" "")
5472 (match_operand:SF 2 "gpc_reg_operand" "")
5473 (match_operand:SF 3 "gpc_reg_operand" "")))]
5474 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5477 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5483 (define_insn "*fselsfsf4"
5484 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5485 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
5486 (match_operand:SF 4 "zero_fp_constant" "F"))
5487 (match_operand:SF 2 "gpc_reg_operand" "f")
5488 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5489 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5491 [(set_attr "type" "fp")])
5493 (define_insn "*fseldfsf4"
5494 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5495 (if_then_else:SF (ge (match_operand:DF 1 "gpc_reg_operand" "d")
5496 (match_operand:DF 4 "zero_fp_constant" "F"))
5497 (match_operand:SF 2 "gpc_reg_operand" "f")
5498 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5499 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_SINGLE_FLOAT"
5501 [(set_attr "type" "fp")])
5503 ;; The conditional move instructions allow us to perform max and min
5504 ;; operations even when
5507 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5508 (match_operator:DF 3 "min_max_operator"
5509 [(match_operand:DF 1 "gpc_reg_operand" "")
5510 (match_operand:DF 2 "gpc_reg_operand" "")]))]
5511 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5512 && !flag_trapping_math"
5515 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
5516 operands[1], operands[2]);
5520 (define_expand "movdfcc"
5521 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5522 (if_then_else:DF (match_operand 1 "comparison_operator" "")
5523 (match_operand:DF 2 "gpc_reg_operand" "")
5524 (match_operand:DF 3 "gpc_reg_operand" "")))]
5525 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5528 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5534 (define_insn "*fseldfdf4"
5535 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
5536 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "d")
5537 (match_operand:DF 4 "zero_fp_constant" "F"))
5538 (match_operand:DF 2 "gpc_reg_operand" "d")
5539 (match_operand:DF 3 "gpc_reg_operand" "d")))]
5540 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5542 [(set_attr "type" "fp")])
5544 (define_insn "*fselsfdf4"
5545 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
5546 (if_then_else:DF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
5547 (match_operand:SF 4 "zero_fp_constant" "F"))
5548 (match_operand:DF 2 "gpc_reg_operand" "d")
5549 (match_operand:DF 3 "gpc_reg_operand" "d")))]
5550 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_SINGLE_FLOAT"
5552 [(set_attr "type" "fp")])
5554 ;; Conversions to and from floating-point.
5556 ; We don't define lfiwax/lfiwzx with the normal definition, because we
5557 ; don't want to support putting SImode in FPR registers.
5558 (define_insn "lfiwax"
5559 [(set (match_operand:DI 0 "gpc_reg_operand" "=d,wm,!wm")
5560 (unspec:DI [(match_operand:SI 1 "reg_or_indexed_operand" "Z,Z,r")]
5562 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWAX"
5567 [(set_attr "type" "fpload,fpload,mffgpr")])
5569 ; This split must be run before register allocation because it allocates the
5570 ; memory slot that is needed to move values to/from the FPR. We don't allocate
5571 ; it earlier to allow for the combiner to merge insns together where it might
5572 ; not be needed and also in case the insns are deleted as dead code.
5574 (define_insn_and_split "floatsi<mode>2_lfiwax"
5575 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d")
5576 (float:SFDF (match_operand:SI 1 "nonimmediate_operand" "r")))
5577 (clobber (match_scratch:DI 2 "=d"))]
5578 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWAX
5579 && <SI_CONVERT_FP> && can_create_pseudo_p ()"
5585 rtx dest = operands[0];
5586 rtx src = operands[1];
5589 if (!MEM_P (src) && TARGET_POWERPC64
5590 && (TARGET_MFPGPR || TARGET_DIRECT_MOVE))
5591 tmp = convert_to_mode (DImode, src, false);
5595 if (GET_CODE (tmp) == SCRATCH)
5596 tmp = gen_reg_rtx (DImode);
5599 src = rs6000_address_for_fpconvert (src);
5600 emit_insn (gen_lfiwax (tmp, src));
5604 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
5605 emit_move_insn (stack, src);
5606 emit_insn (gen_lfiwax (tmp, stack));
5609 emit_insn (gen_floatdi<mode>2 (dest, tmp));
5612 [(set_attr "length" "12")
5613 (set_attr "type" "fpload")])
5615 (define_insn_and_split "floatsi<mode>2_lfiwax_mem"
5616 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d,<rreg2>")
5619 (match_operand:SI 1 "memory_operand" "Z,Z"))))
5620 (clobber (match_scratch:DI 2 "=0,d"))]
5621 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWAX
5628 operands[1] = rs6000_address_for_fpconvert (operands[1]);
5629 if (GET_CODE (operands[2]) == SCRATCH)
5630 operands[2] = gen_reg_rtx (DImode);
5631 emit_insn (gen_lfiwax (operands[2], operands[1]));
5632 emit_insn (gen_floatdi<mode>2 (operands[0], operands[2]));
5635 [(set_attr "length" "8")
5636 (set_attr "type" "fpload")])
5638 (define_insn "lfiwzx"
5639 [(set (match_operand:DI 0 "gpc_reg_operand" "=d,wm,!wm")
5640 (unspec:DI [(match_operand:SI 1 "reg_or_indexed_operand" "Z,Z,r")]
5642 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWZX"
5647 [(set_attr "type" "fpload,fpload,mftgpr")])
5649 (define_insn_and_split "floatunssi<mode>2_lfiwzx"
5650 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d")
5651 (unsigned_float:SFDF (match_operand:SI 1 "nonimmediate_operand" "r")))
5652 (clobber (match_scratch:DI 2 "=d"))]
5653 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWZX
5660 rtx dest = operands[0];
5661 rtx src = operands[1];
5664 if (!MEM_P (src) && TARGET_POWERPC64
5665 && (TARGET_MFPGPR || TARGET_DIRECT_MOVE))
5666 tmp = convert_to_mode (DImode, src, true);
5670 if (GET_CODE (tmp) == SCRATCH)
5671 tmp = gen_reg_rtx (DImode);
5674 src = rs6000_address_for_fpconvert (src);
5675 emit_insn (gen_lfiwzx (tmp, src));
5679 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
5680 emit_move_insn (stack, src);
5681 emit_insn (gen_lfiwzx (tmp, stack));
5684 emit_insn (gen_floatdi<mode>2 (dest, tmp));
5687 [(set_attr "length" "12")
5688 (set_attr "type" "fpload")])
5690 (define_insn_and_split "floatunssi<mode>2_lfiwzx_mem"
5691 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d,<rreg2>")
5692 (unsigned_float:SFDF
5694 (match_operand:SI 1 "memory_operand" "Z,Z"))))
5695 (clobber (match_scratch:DI 2 "=0,d"))]
5696 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWZX
5703 operands[1] = rs6000_address_for_fpconvert (operands[1]);
5704 if (GET_CODE (operands[2]) == SCRATCH)
5705 operands[2] = gen_reg_rtx (DImode);
5706 emit_insn (gen_lfiwzx (operands[2], operands[1]));
5707 emit_insn (gen_floatdi<mode>2 (operands[0], operands[2]));
5710 [(set_attr "length" "8")
5711 (set_attr "type" "fpload")])
5713 ; For each of these conversions, there is a define_expand, a define_insn
5714 ; with a '#' template, and a define_split (with C code). The idea is
5715 ; to allow constant folding with the template of the define_insn,
5716 ; then to have the insns split later (between sched1 and final).
5718 (define_expand "floatsidf2"
5719 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5720 (float:DF (match_operand:SI 1 "nonimmediate_operand" "")))
5723 (clobber (match_dup 4))
5724 (clobber (match_dup 5))
5725 (clobber (match_dup 6))])]
5727 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5730 if (TARGET_E500_DOUBLE)
5732 if (!REG_P (operands[1]))
5733 operands[1] = force_reg (SImode, operands[1]);
5734 emit_insn (gen_spe_floatsidf2 (operands[0], operands[1]));
5737 else if (TARGET_LFIWAX && TARGET_FCFID)
5739 emit_insn (gen_floatsidf2_lfiwax (operands[0], operands[1]));
5742 else if (TARGET_FCFID)
5744 rtx dreg = operands[1];
5746 dreg = force_reg (SImode, dreg);
5747 dreg = convert_to_mode (DImode, dreg, false);
5748 emit_insn (gen_floatdidf2 (operands[0], dreg));
5752 if (!REG_P (operands[1]))
5753 operands[1] = force_reg (SImode, operands[1]);
5754 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5755 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503601774854144\", DFmode));
5756 operands[4] = rs6000_allocate_stack_temp (DFmode, true, false);
5757 operands[5] = gen_reg_rtx (DFmode);
5758 operands[6] = gen_reg_rtx (SImode);
5761 (define_insn_and_split "*floatsidf2_internal"
5762 [(set (match_operand:DF 0 "gpc_reg_operand" "=&d")
5763 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5764 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5765 (use (match_operand:DF 3 "gpc_reg_operand" "d"))
5766 (clobber (match_operand:DF 4 "offsettable_mem_operand" "=o"))
5767 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&d"))
5768 (clobber (match_operand:SI 6 "gpc_reg_operand" "=&r"))]
5769 "! TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5775 rtx lowword, highword;
5776 gcc_assert (MEM_P (operands[4]));
5777 highword = adjust_address (operands[4], SImode, 0);
5778 lowword = adjust_address (operands[4], SImode, 4);
5779 if (! WORDS_BIG_ENDIAN)
5782 tmp = highword; highword = lowword; lowword = tmp;
5785 emit_insn (gen_xorsi3 (operands[6], operands[1],
5786 GEN_INT (~ (HOST_WIDE_INT) 0x7fffffff)));
5787 emit_move_insn (lowword, operands[6]);
5788 emit_move_insn (highword, operands[2]);
5789 emit_move_insn (operands[5], operands[4]);
5790 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5793 [(set_attr "length" "24")
5794 (set_attr "type" "fp")])
5796 ;; If we don't have a direct conversion to single precision, don't enable this
5797 ;; conversion for 32-bit without fast math, because we don't have the insn to
5798 ;; generate the fixup swizzle to avoid double rounding problems.
5799 (define_expand "floatunssisf2"
5800 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5801 (unsigned_float:SF (match_operand:SI 1 "nonimmediate_operand" "")))]
5802 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT
5805 && ((TARGET_FCFIDUS && TARGET_LFIWZX)
5806 || (TARGET_DOUBLE_FLOAT && TARGET_FCFID
5807 && (TARGET_POWERPC64 || flag_unsafe_math_optimizations)))))"
5812 if (!REG_P (operands[1]))
5813 operands[1] = force_reg (SImode, operands[1]);
5815 else if (TARGET_LFIWZX && TARGET_FCFIDUS)
5817 emit_insn (gen_floatunssisf2_lfiwzx (operands[0], operands[1]));
5822 rtx dreg = operands[1];
5824 dreg = force_reg (SImode, dreg);
5825 dreg = convert_to_mode (DImode, dreg, true);
5826 emit_insn (gen_floatdisf2 (operands[0], dreg));
5831 (define_expand "floatunssidf2"
5832 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5833 (unsigned_float:DF (match_operand:SI 1 "nonimmediate_operand" "")))
5836 (clobber (match_dup 4))
5837 (clobber (match_dup 5))])]
5839 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5842 if (TARGET_E500_DOUBLE)
5844 if (!REG_P (operands[1]))
5845 operands[1] = force_reg (SImode, operands[1]);
5846 emit_insn (gen_spe_floatunssidf2 (operands[0], operands[1]));
5849 else if (TARGET_LFIWZX && TARGET_FCFID)
5851 emit_insn (gen_floatunssidf2_lfiwzx (operands[0], operands[1]));
5854 else if (TARGET_FCFID)
5856 rtx dreg = operands[1];
5858 dreg = force_reg (SImode, dreg);
5859 dreg = convert_to_mode (DImode, dreg, true);
5860 emit_insn (gen_floatdidf2 (operands[0], dreg));
5864 if (!REG_P (operands[1]))
5865 operands[1] = force_reg (SImode, operands[1]);
5866 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5867 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503599627370496\", DFmode));
5868 operands[4] = rs6000_allocate_stack_temp (DFmode, true, false);
5869 operands[5] = gen_reg_rtx (DFmode);
5872 (define_insn_and_split "*floatunssidf2_internal"
5873 [(set (match_operand:DF 0 "gpc_reg_operand" "=&d")
5874 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5875 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5876 (use (match_operand:DF 3 "gpc_reg_operand" "d"))
5877 (clobber (match_operand:DF 4 "offsettable_mem_operand" "=o"))
5878 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&d"))]
5879 "! TARGET_FCFIDU && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5880 && !(TARGET_FCFID && TARGET_POWERPC64)"
5886 rtx lowword, highword;
5887 gcc_assert (MEM_P (operands[4]));
5888 highword = adjust_address (operands[4], SImode, 0);
5889 lowword = adjust_address (operands[4], SImode, 4);
5890 if (! WORDS_BIG_ENDIAN)
5893 tmp = highword; highword = lowword; lowword = tmp;
5896 emit_move_insn (lowword, operands[1]);
5897 emit_move_insn (highword, operands[2]);
5898 emit_move_insn (operands[5], operands[4]);
5899 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5902 [(set_attr "length" "20")
5903 (set_attr "type" "fp")])
5905 (define_expand "fix_trunc<mode>si2"
5906 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5907 (fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "")))]
5908 "TARGET_HARD_FLOAT && ((TARGET_FPRS && <TARGET_FLOAT>) || <E500_CONVERT>)"
5911 if (!<E500_CONVERT>)
5916 emit_insn (gen_fix_trunc<mode>si2_stfiwx (operands[0], operands[1]));
5919 tmp = gen_reg_rtx (DImode);
5920 stack = rs6000_allocate_stack_temp (DImode, true, false);
5921 emit_insn (gen_fix_trunc<mode>si2_internal (operands[0], operands[1],
5928 ; Like the convert to float patterns, this insn must be split before
5929 ; register allocation so that it can allocate the memory slot if it
5931 (define_insn_and_split "fix_trunc<mode>si2_stfiwx"
5932 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
5933 (fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d")))
5934 (clobber (match_scratch:DI 2 "=d"))]
5935 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5936 && (<MODE>mode != SFmode || TARGET_SINGLE_FLOAT)
5937 && TARGET_STFIWX && can_create_pseudo_p ()"
5942 rtx dest = operands[0];
5943 rtx src = operands[1];
5944 rtx tmp = operands[2];
5946 if (GET_CODE (tmp) == SCRATCH)
5947 tmp = gen_reg_rtx (DImode);
5949 emit_insn (gen_fctiwz_<mode> (tmp, src));
5952 dest = rs6000_address_for_fpconvert (dest);
5953 emit_insn (gen_stfiwx (dest, tmp));
5956 else if (TARGET_POWERPC64 && (TARGET_MFPGPR || TARGET_DIRECT_MOVE))
5958 dest = gen_lowpart (DImode, dest);
5959 emit_move_insn (dest, tmp);
5964 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
5965 emit_insn (gen_stfiwx (stack, tmp));
5966 emit_move_insn (dest, stack);
5970 [(set_attr "length" "12")
5971 (set_attr "type" "fp")])
5973 (define_insn_and_split "fix_trunc<mode>si2_internal"
5974 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,?r")
5975 (fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d,<rreg>")))
5976 (clobber (match_operand:DI 2 "gpc_reg_operand" "=1,d"))
5977 (clobber (match_operand:DI 3 "offsettable_mem_operand" "=o,o"))]
5978 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5985 gcc_assert (MEM_P (operands[3]));
5986 lowword = adjust_address (operands[3], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
5988 emit_insn (gen_fctiwz_<mode> (operands[2], operands[1]));
5989 emit_move_insn (operands[3], operands[2]);
5990 emit_move_insn (operands[0], lowword);
5993 [(set_attr "length" "16")
5994 (set_attr "type" "fp")])
5996 (define_expand "fix_trunc<mode>di2"
5997 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5998 (fix:DI (match_operand:SFDF 1 "gpc_reg_operand" "")))]
5999 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
6003 (define_insn "*fix_trunc<mode>di2_fctidz"
6004 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6005 (fix:DI (match_operand:SFDF 1 "gpc_reg_operand" "d")))]
6006 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
6007 && TARGET_FCFID && !VECTOR_UNIT_VSX_P (<MODE>mode)"
6009 [(set_attr "type" "fp")])
6011 (define_expand "fixuns_trunc<mode>si2"
6012 [(set (match_operand:SI 0 "gpc_reg_operand" "")
6013 (unsigned_fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "")))]
6015 && ((TARGET_FPRS && <TARGET_FLOAT> && TARGET_FCTIWUZ && TARGET_STFIWX)
6019 if (!<E500_CONVERT>)
6021 emit_insn (gen_fixuns_trunc<mode>si2_stfiwx (operands[0], operands[1]));
6026 (define_insn_and_split "fixuns_trunc<mode>si2_stfiwx"
6027 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
6028 (unsigned_fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d")))
6029 (clobber (match_scratch:DI 2 "=d"))]
6030 "TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT> && TARGET_FCTIWUZ
6031 && TARGET_STFIWX && can_create_pseudo_p ()"
6036 rtx dest = operands[0];
6037 rtx src = operands[1];
6038 rtx tmp = operands[2];
6040 if (GET_CODE (tmp) == SCRATCH)
6041 tmp = gen_reg_rtx (DImode);
6043 emit_insn (gen_fctiwuz_<mode> (tmp, src));
6046 dest = rs6000_address_for_fpconvert (dest);
6047 emit_insn (gen_stfiwx (dest, tmp));
6050 else if (TARGET_POWERPC64 && (TARGET_MFPGPR || TARGET_DIRECT_MOVE))
6052 dest = gen_lowpart (DImode, dest);
6053 emit_move_insn (dest, tmp);
6058 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
6059 emit_insn (gen_stfiwx (stack, tmp));
6060 emit_move_insn (dest, stack);
6064 [(set_attr "length" "12")
6065 (set_attr "type" "fp")])
6067 (define_expand "fixuns_trunc<mode>di2"
6068 [(set (match_operand:DI 0 "register_operand" "")
6069 (unsigned_fix:DI (match_operand:SFDF 1 "register_operand" "")))]
6070 "TARGET_HARD_FLOAT && (TARGET_FCTIDUZ || VECTOR_UNIT_VSX_P (<MODE>mode))"
6073 (define_insn "*fixuns_trunc<mode>di2_fctiduz"
6074 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6075 (unsigned_fix:DI (match_operand:SFDF 1 "gpc_reg_operand" "d")))]
6076 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
6077 && TARGET_FCTIDUZ && !VECTOR_UNIT_VSX_P (<MODE>mode)"
6079 [(set_attr "type" "fp")])
6081 ; Here, we use (set (reg) (unspec:DI [(fix:SI ...)] UNSPEC_FCTIWZ))
6082 ; rather than (set (subreg:SI (reg)) (fix:SI ...))
6083 ; because the first makes it clear that operand 0 is not live
6084 ; before the instruction.
6085 (define_insn "fctiwz_<mode>"
6086 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6087 (unspec:DI [(fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d"))]
6089 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6091 [(set_attr "type" "fp")])
6093 (define_insn "fctiwuz_<mode>"
6094 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6095 (unspec:DI [(unsigned_fix:SI
6096 (match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>"))]
6098 "TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT> && TARGET_FCTIWUZ"
6100 [(set_attr "type" "fp")])
6102 ;; Only optimize (float (fix x)) -> frz if we are in fast-math mode, since
6103 ;; since the friz instruction does not truncate the value if the floating
6104 ;; point value is < LONG_MIN or > LONG_MAX.
6105 (define_insn "*friz"
6106 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6107 (float:DF (fix:DI (match_operand:DF 1 "gpc_reg_operand" "d"))))]
6108 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_FPRND
6109 && !VECTOR_UNIT_VSX_P (DFmode) && flag_unsafe_math_optimizations
6110 && !flag_trapping_math && TARGET_FRIZ"
6112 [(set_attr "type" "fp")])
6114 ;; Since FCTIWZ doesn't sign extend the upper bits, we have to do a store and a
6115 ;; load to properly sign extend the value, but at least doing a store, load
6116 ;; into a GPR to sign extend, a store from the GPR and a load back into the FPR
6117 ;; if we have 32-bit memory ops
6118 (define_insn_and_split "*round32<mode>2_fprs"
6119 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d")
6121 (fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d"))))
6122 (clobber (match_scratch:DI 2 "=d"))
6123 (clobber (match_scratch:DI 3 "=d"))]
6124 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6125 && <SI_CONVERT_FP> && TARGET_LFIWAX && TARGET_STFIWX && TARGET_FCFID
6126 && can_create_pseudo_p ()"
6131 rtx dest = operands[0];
6132 rtx src = operands[1];
6133 rtx tmp1 = operands[2];
6134 rtx tmp2 = operands[3];
6135 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
6137 if (GET_CODE (tmp1) == SCRATCH)
6138 tmp1 = gen_reg_rtx (DImode);
6139 if (GET_CODE (tmp2) == SCRATCH)
6140 tmp2 = gen_reg_rtx (DImode);
6142 emit_insn (gen_fctiwz_<mode> (tmp1, src));
6143 emit_insn (gen_stfiwx (stack, tmp1));
6144 emit_insn (gen_lfiwax (tmp2, stack));
6145 emit_insn (gen_floatdi<mode>2 (dest, tmp2));
6148 [(set_attr "type" "fpload")
6149 (set_attr "length" "16")])
6151 (define_insn_and_split "*roundu32<mode>2_fprs"
6152 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d")
6153 (unsigned_float:SFDF
6154 (unsigned_fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d"))))
6155 (clobber (match_scratch:DI 2 "=d"))
6156 (clobber (match_scratch:DI 3 "=d"))]
6157 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6158 && TARGET_LFIWZX && TARGET_STFIWX && TARGET_FCFIDU
6159 && can_create_pseudo_p ()"
6164 rtx dest = operands[0];
6165 rtx src = operands[1];
6166 rtx tmp1 = operands[2];
6167 rtx tmp2 = operands[3];
6168 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
6170 if (GET_CODE (tmp1) == SCRATCH)
6171 tmp1 = gen_reg_rtx (DImode);
6172 if (GET_CODE (tmp2) == SCRATCH)
6173 tmp2 = gen_reg_rtx (DImode);
6175 emit_insn (gen_fctiwuz_<mode> (tmp1, src));
6176 emit_insn (gen_stfiwx (stack, tmp1));
6177 emit_insn (gen_lfiwzx (tmp2, stack));
6178 emit_insn (gen_floatdi<mode>2 (dest, tmp2));
6181 [(set_attr "type" "fpload")
6182 (set_attr "length" "16")])
6184 ;; No VSX equivalent to fctid
6185 (define_insn "lrint<mode>di2"
6186 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6187 (unspec:DI [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
6189 "TARGET_<MODE>_FPR && TARGET_FPRND"
6191 [(set_attr "type" "fp")])
6193 (define_insn "btrunc<mode>2"
6194 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
6195 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")]
6197 "TARGET_<MODE>_FPR && TARGET_FPRND"
6201 [(set_attr "type" "fp")
6202 (set_attr "fp_type" "fp_addsub_<Fs>")])
6204 (define_insn "ceil<mode>2"
6205 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
6206 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")]
6208 "TARGET_<MODE>_FPR && TARGET_FPRND"
6212 [(set_attr "type" "fp")
6213 (set_attr "fp_type" "fp_addsub_<Fs>")])
6215 (define_insn "floor<mode>2"
6216 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
6217 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")]
6219 "TARGET_<MODE>_FPR && TARGET_FPRND"
6223 [(set_attr "type" "fp")
6224 (set_attr "fp_type" "fp_addsub_<Fs>")])
6226 ;; No VSX equivalent to frin
6227 (define_insn "round<mode>2"
6228 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
6229 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
6231 "TARGET_<MODE>_FPR && TARGET_FPRND"
6233 [(set_attr "type" "fp")
6234 (set_attr "fp_type" "fp_addsub_<Fs>")])
6236 ; An UNSPEC is used so we don't have to support SImode in FP registers.
6237 (define_insn "stfiwx"
6238 [(set (match_operand:SI 0 "memory_operand" "=Z")
6239 (unspec:SI [(match_operand:DI 1 "gpc_reg_operand" "d")]
6243 [(set_attr "type" "fpstore")])
6245 ;; If we don't have a direct conversion to single precision, don't enable this
6246 ;; conversion for 32-bit without fast math, because we don't have the insn to
6247 ;; generate the fixup swizzle to avoid double rounding problems.
6248 (define_expand "floatsisf2"
6249 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6250 (float:SF (match_operand:SI 1 "nonimmediate_operand" "")))]
6251 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT
6254 && ((TARGET_FCFIDS && TARGET_LFIWAX)
6255 || (TARGET_DOUBLE_FLOAT && TARGET_FCFID
6256 && (TARGET_POWERPC64 || flag_unsafe_math_optimizations)))))"
6261 if (!REG_P (operands[1]))
6262 operands[1] = force_reg (SImode, operands[1]);
6264 else if (TARGET_FCFIDS && TARGET_LFIWAX)
6266 emit_insn (gen_floatsisf2_lfiwax (operands[0], operands[1]));
6269 else if (TARGET_FCFID && TARGET_LFIWAX)
6271 rtx dfreg = gen_reg_rtx (DFmode);
6272 emit_insn (gen_floatsidf2_lfiwax (dfreg, operands[1]));
6273 emit_insn (gen_truncdfsf2 (operands[0], dfreg));
6278 rtx dreg = operands[1];
6280 dreg = force_reg (SImode, dreg);
6281 dreg = convert_to_mode (DImode, dreg, false);
6282 emit_insn (gen_floatdisf2 (operands[0], dreg));
6287 (define_expand "floatdidf2"
6288 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6289 (float:DF (match_operand:DI 1 "gpc_reg_operand" "")))]
6290 "TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS"
6293 (define_insn "*floatdidf2_fpr"
6294 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6295 (float:DF (match_operand:DI 1 "gpc_reg_operand" "d")))]
6296 "TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
6297 && !VECTOR_UNIT_VSX_P (DFmode)"
6299 [(set_attr "type" "fp")])
6301 ; Allow the combiner to merge source memory operands to the conversion so that
6302 ; the optimizer/register allocator doesn't try to load the value too early in a
6303 ; GPR and then use store/load to move it to a FPR and suffer from a store-load
6304 ; hit. We will split after reload to avoid the trip through the GPRs
6306 (define_insn_and_split "*floatdidf2_mem"
6307 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6308 (float:DF (match_operand:DI 1 "memory_operand" "m")))
6309 (clobber (match_scratch:DI 2 "=d"))]
6310 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS && TARGET_FCFID"
6312 "&& reload_completed"
6313 [(set (match_dup 2) (match_dup 1))
6314 (set (match_dup 0) (float:DF (match_dup 2)))]
6316 [(set_attr "length" "8")
6317 (set_attr "type" "fpload")])
6319 (define_expand "floatunsdidf2"
6320 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6322 (match_operand:DI 1 "gpc_reg_operand" "")))]
6323 "TARGET_HARD_FLOAT && (TARGET_FCFIDU || VECTOR_UNIT_VSX_P (DFmode))"
6326 (define_insn "*floatunsdidf2_fcfidu"
6327 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6328 (unsigned_float:DF (match_operand:DI 1 "gpc_reg_operand" "d")))]
6329 "TARGET_HARD_FLOAT && TARGET_FCFIDU && !VECTOR_UNIT_VSX_P (DFmode)"
6331 [(set_attr "type" "fp")
6332 (set_attr "length" "4")])
6334 (define_insn_and_split "*floatunsdidf2_mem"
6335 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6336 (unsigned_float:DF (match_operand:DI 1 "memory_operand" "m")))
6337 (clobber (match_scratch:DI 2 "=d"))]
6338 "TARGET_HARD_FLOAT && (TARGET_FCFIDU || VECTOR_UNIT_VSX_P (DFmode))"
6340 "&& reload_completed"
6341 [(set (match_dup 2) (match_dup 1))
6342 (set (match_dup 0) (unsigned_float:DF (match_dup 2)))]
6344 [(set_attr "length" "8")
6345 (set_attr "type" "fpload")])
6347 (define_expand "floatdisf2"
6348 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6349 (float:SF (match_operand:DI 1 "gpc_reg_operand" "")))]
6350 "TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
6351 && (TARGET_FCFIDS || TARGET_POWERPC64 || flag_unsafe_math_optimizations)"
6356 rtx val = operands[1];
6357 if (!flag_unsafe_math_optimizations)
6359 rtx label = gen_label_rtx ();
6360 val = gen_reg_rtx (DImode);
6361 emit_insn (gen_floatdisf2_internal2 (val, operands[1], label));
6364 emit_insn (gen_floatdisf2_internal1 (operands[0], val));
6369 (define_insn "floatdisf2_fcfids"
6370 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6371 (float:SF (match_operand:DI 1 "gpc_reg_operand" "d")))]
6372 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
6373 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDS"
6375 [(set_attr "type" "fp")])
6377 (define_insn_and_split "*floatdisf2_mem"
6378 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6379 (float:SF (match_operand:DI 1 "memory_operand" "m")))
6380 (clobber (match_scratch:DI 2 "=f"))]
6381 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
6382 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDS"
6384 "&& reload_completed"
6388 emit_move_insn (operands[2], operands[1]);
6389 emit_insn (gen_floatdisf2_fcfids (operands[0], operands[2]));
6392 [(set_attr "length" "8")])
6394 ;; This is not IEEE compliant if rounding mode is "round to nearest".
6395 ;; If the DI->DF conversion is inexact, then it's possible to suffer
6396 ;; from double rounding.
6397 ;; Instead of creating a new cpu type for two FP operations, just use fp
6398 (define_insn_and_split "floatdisf2_internal1"
6399 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6400 (float:SF (match_operand:DI 1 "gpc_reg_operand" "d")))
6401 (clobber (match_scratch:DF 2 "=d"))]
6402 "TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
6404 "&& reload_completed"
6406 (float:DF (match_dup 1)))
6408 (float_truncate:SF (match_dup 2)))]
6410 [(set_attr "length" "8")
6411 (set_attr "type" "fp")])
6413 ;; Twiddles bits to avoid double rounding.
6414 ;; Bits that might be truncated when converting to DFmode are replaced
6415 ;; by a bit that won't be lost at that stage, but is below the SFmode
6416 ;; rounding position.
6417 (define_expand "floatdisf2_internal2"
6418 [(set (match_dup 3) (ashiftrt:DI (match_operand:DI 1 "" "")
6420 (parallel [(set (match_operand:DI 0 "" "") (and:DI (match_dup 1)
6422 (clobber (scratch:CC))])
6423 (set (match_dup 3) (plus:DI (match_dup 3)
6425 (set (match_dup 0) (plus:DI (match_dup 0)
6427 (set (match_dup 4) (compare:CCUNS (match_dup 3)
6429 (set (match_dup 0) (ior:DI (match_dup 0)
6431 (parallel [(set (match_dup 0) (and:DI (match_dup 0)
6433 (clobber (scratch:CC))])
6434 (set (pc) (if_then_else (geu (match_dup 4) (const_int 0))
6435 (label_ref (match_operand:DI 2 "" ""))
6437 (set (match_dup 0) (match_dup 1))]
6438 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
6441 operands[3] = gen_reg_rtx (DImode);
6442 operands[4] = gen_reg_rtx (CCUNSmode);
6445 (define_expand "floatunsdisf2"
6446 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6447 (unsigned_float:SF (match_operand:DI 1 "gpc_reg_operand" "")))]
6448 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
6449 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDUS"
6452 (define_insn "floatunsdisf2_fcfidus"
6453 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6454 (unsigned_float:SF (match_operand:DI 1 "gpc_reg_operand" "d")))]
6455 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
6456 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDUS"
6458 [(set_attr "type" "fp")])
6460 (define_insn_and_split "*floatunsdisf2_mem"
6461 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6462 (unsigned_float:SF (match_operand:DI 1 "memory_operand" "m")))
6463 (clobber (match_scratch:DI 2 "=f"))]
6464 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
6465 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDUS"
6467 "&& reload_completed"
6471 emit_move_insn (operands[2], operands[1]);
6472 emit_insn (gen_floatunsdisf2_fcfidus (operands[0], operands[2]));
6475 [(set_attr "length" "8")
6476 (set_attr "type" "fpload")])
6478 ;; Define the TImode operations that can be done in a small number
6479 ;; of instructions. The & constraints are to prevent the register
6480 ;; allocator from allocating registers that overlap with the inputs
6481 ;; (for example, having an input in 7,8 and an output in 6,7). We
6482 ;; also allow for the output being the same as one of the inputs.
6484 (define_insn "addti3"
6485 [(set (match_operand:TI 0 "gpc_reg_operand" "=&r,&r,r,r")
6486 (plus:TI (match_operand:TI 1 "gpc_reg_operand" "%r,r,0,0")
6487 (match_operand:TI 2 "reg_or_short_operand" "r,I,r,I")))]
6490 if (WORDS_BIG_ENDIAN)
6491 return (GET_CODE (operands[2])) != CONST_INT
6492 ? \"addc %L0,%L1,%L2\;adde %0,%1,%2\"
6493 : \"addic %L0,%L1,%2\;add%G2e %0,%1\";
6495 return (GET_CODE (operands[2])) != CONST_INT
6496 ? \"addc %0,%1,%2\;adde %L0,%L1,%L2\"
6497 : \"addic %0,%1,%2\;add%G2e %L0,%L1\";
6499 [(set_attr "type" "two")
6500 (set_attr "length" "8")])
6502 (define_insn "subti3"
6503 [(set (match_operand:TI 0 "gpc_reg_operand" "=&r,&r,r,r,r")
6504 (minus:TI (match_operand:TI 1 "reg_or_short_operand" "r,I,0,r,I")
6505 (match_operand:TI 2 "gpc_reg_operand" "r,r,r,0,0")))]
6508 if (WORDS_BIG_ENDIAN)
6509 return (GET_CODE (operands[1]) != CONST_INT)
6510 ? \"subfc %L0,%L2,%L1\;subfe %0,%2,%1\"
6511 : \"subfic %L0,%L2,%1\;subf%G1e %0,%2\";
6513 return (GET_CODE (operands[1]) != CONST_INT)
6514 ? \"subfc %0,%2,%1\;subfe %L0,%L2,%L1\"
6515 : \"subfic %0,%2,%1\;subf%G1e %L0,%L2\";
6517 [(set_attr "type" "two")
6518 (set_attr "length" "8")])
6521 ;; Define the DImode operations that can be done in a small number
6522 ;; of instructions. The & constraints are to prevent the register
6523 ;; allocator from allocating registers that overlap with the inputs
6524 ;; (for example, having an input in 7,8 and an output in 6,7). We
6525 ;; also allow for the output being the same as one of the inputs.
6527 (define_insn "*adddi3_noppc64"
6528 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r")
6529 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,0,0")
6530 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I")))]
6531 "! TARGET_POWERPC64"
6534 if (WORDS_BIG_ENDIAN)
6535 return (GET_CODE (operands[2])) != CONST_INT
6536 ? \"addc %L0,%L1,%L2\;adde %0,%1,%2\"
6537 : \"addic %L0,%L1,%2\;add%G2e %0,%1\";
6539 return (GET_CODE (operands[2])) != CONST_INT
6540 ? \"addc %0,%1,%2\;adde %L0,%L1,%L2\"
6541 : \"addic %0,%1,%2\;add%G2e %L0,%L1\";
6543 [(set_attr "type" "two")
6544 (set_attr "length" "8")])
6546 (define_insn "*subdi3_noppc64"
6547 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r,r")
6548 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I,0,r,I")
6549 (match_operand:DI 2 "gpc_reg_operand" "r,r,r,0,0")))]
6550 "! TARGET_POWERPC64"
6553 if (WORDS_BIG_ENDIAN)
6554 return (GET_CODE (operands[1]) != CONST_INT)
6555 ? \"subfc %L0,%L2,%L1\;subfe %0,%2,%1\"
6556 : \"subfic %L0,%L2,%1\;subf%G1e %0,%2\";
6558 return (GET_CODE (operands[1]) != CONST_INT)
6559 ? \"subfc %0,%2,%1\;subfe %L0,%L2,%L1\"
6560 : \"subfic %0,%2,%1\;subf%G1e %L0,%L2\";
6562 [(set_attr "type" "two")
6563 (set_attr "length" "8")])
6565 (define_insn "*negdi2_noppc64"
6566 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6567 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))]
6568 "! TARGET_POWERPC64"
6571 return (WORDS_BIG_ENDIAN)
6572 ? \"subfic %L0,%L1,0\;subfze %0,%1\"
6573 : \"subfic %0,%1,0\;subfze %L0,%L1\";
6575 [(set_attr "type" "two")
6576 (set_attr "length" "8")])
6578 (define_insn "mulsidi3"
6579 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6580 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6581 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
6582 "! TARGET_POWERPC64"
6584 return (WORDS_BIG_ENDIAN)
6585 ? \"mulhw %0,%1,%2\;mullw %L0,%1,%2\"
6586 : \"mulhw %L0,%1,%2\;mullw %0,%1,%2\";
6588 [(set_attr "type" "imul")
6589 (set_attr "length" "8")])
6592 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6593 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6594 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6595 "! TARGET_POWERPC64 && reload_completed"
6598 (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
6599 (sign_extend:DI (match_dup 2)))
6602 (mult:SI (match_dup 1)
6606 int endian = (WORDS_BIG_ENDIAN == 0);
6607 operands[3] = operand_subword (operands[0], endian, 0, DImode);
6608 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
6611 (define_insn "umulsidi3"
6612 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6613 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6614 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
6615 "! TARGET_POWERPC64"
6618 return (WORDS_BIG_ENDIAN)
6619 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
6620 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
6622 [(set_attr "type" "imul")
6623 (set_attr "length" "8")])
6626 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6627 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6628 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6629 "! TARGET_POWERPC64 && reload_completed"
6632 (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
6633 (zero_extend:DI (match_dup 2)))
6636 (mult:SI (match_dup 1)
6640 int endian = (WORDS_BIG_ENDIAN == 0);
6641 operands[3] = operand_subword (operands[0], endian, 0, DImode);
6642 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
6645 (define_insn "smulsi3_highpart"
6646 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6648 (lshiftrt:DI (mult:DI (sign_extend:DI
6649 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6651 (match_operand:SI 2 "gpc_reg_operand" "r")))
6655 [(set_attr "type" "imul")])
6657 (define_insn "umulsi3_highpart"
6658 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6660 (lshiftrt:DI (mult:DI (zero_extend:DI
6661 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6663 (match_operand:SI 2 "gpc_reg_operand" "r")))
6667 [(set_attr "type" "imul")])
6669 ;; Shift by a variable amount is too complex to be worth open-coding. We
6670 ;; just handle shifts by constants.
6671 (define_insn "ashrdi3_no_power"
6672 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
6673 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6674 (match_operand:SI 2 "const_int_operand" "M,i")))]
6678 switch (which_alternative)
6683 if (WORDS_BIG_ENDIAN)
6684 return \"srawi %0,%1,31\;srawi %L0,%1,%h2\";
6686 return \"srawi %L0,%L1,31\;srawi %0,%L1,%h2\";
6688 if (WORDS_BIG_ENDIAN)
6689 return \"srwi %L0,%L1,%h2\;insrwi %L0,%1,%h2,0\;srawi %0,%1,%h2\";
6691 return \"srwi %0,%1,%h2\;insrwi %0,%L1,%h2,0\;srawi %L0,%L1,%h2\";
6694 [(set_attr "type" "two,three")
6695 (set_attr "length" "8,12")])
6697 (define_insn "*ashrdisi3_noppc64be"
6698 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6699 (subreg:SI (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6700 (const_int 32)) 4))]
6701 "TARGET_32BIT && !TARGET_POWERPC64 && WORDS_BIG_ENDIAN"
6704 if (REGNO (operands[0]) == REGNO (operands[1]))
6707 return \"mr %0,%1\";
6709 [(set_attr "length" "4")])
6712 ;; PowerPC64 DImode operations.
6714 (define_insn "muldi3"
6715 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6716 (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6717 (match_operand:DI 2 "reg_or_short_operand" "r,I")))]
6723 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
6724 (const_string "imul3")
6725 (match_operand:SI 2 "short_cint_operand" "")
6726 (const_string "imul2")]
6727 (const_string "lmul")))])
6729 (define_insn "*muldi3_internal1"
6730 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6731 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6732 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6734 (clobber (match_scratch:DI 3 "=r,r"))]
6739 [(set_attr "type" "lmul_compare")
6740 (set_attr "length" "4,8")])
6743 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6744 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
6745 (match_operand:DI 2 "gpc_reg_operand" ""))
6747 (clobber (match_scratch:DI 3 ""))]
6748 "TARGET_POWERPC64 && reload_completed"
6750 (mult:DI (match_dup 1) (match_dup 2)))
6752 (compare:CC (match_dup 3)
6756 (define_insn "*muldi3_internal2"
6757 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6758 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6759 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6761 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6762 (mult:DI (match_dup 1) (match_dup 2)))]
6767 [(set_attr "type" "lmul_compare")
6768 (set_attr "length" "4,8")])
6771 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
6772 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
6773 (match_operand:DI 2 "gpc_reg_operand" ""))
6775 (set (match_operand:DI 0 "gpc_reg_operand" "")
6776 (mult:DI (match_dup 1) (match_dup 2)))]
6777 "TARGET_POWERPC64 && reload_completed"
6779 (mult:DI (match_dup 1) (match_dup 2)))
6781 (compare:CC (match_dup 0)
6785 (define_insn "smuldi3_highpart"
6786 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6788 (lshiftrt:TI (mult:TI (sign_extend:TI
6789 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6791 (match_operand:DI 2 "gpc_reg_operand" "r")))
6795 [(set_attr "type" "lmul")])
6797 (define_insn "umuldi3_highpart"
6798 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6800 (lshiftrt:TI (mult:TI (zero_extend:TI
6801 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6803 (match_operand:DI 2 "gpc_reg_operand" "r")))
6807 [(set_attr "type" "lmul")])
6809 (define_expand "mulditi3"
6810 [(set (match_operand:TI 0 "gpc_reg_operand")
6811 (mult:TI (sign_extend:TI (match_operand:DI 1 "gpc_reg_operand"))
6812 (sign_extend:TI (match_operand:DI 2 "gpc_reg_operand"))))]
6815 rtx l = gen_reg_rtx (DImode), h = gen_reg_rtx (DImode);
6816 emit_insn (gen_muldi3 (l, operands[1], operands[2]));
6817 emit_insn (gen_smuldi3_highpart (h, operands[1], operands[2]));
6818 emit_move_insn (gen_lowpart (DImode, operands[0]), l);
6819 emit_move_insn (gen_highpart (DImode, operands[0]), h);
6823 (define_expand "umulditi3"
6824 [(set (match_operand:TI 0 "gpc_reg_operand")
6825 (mult:TI (zero_extend:TI (match_operand:DI 1 "gpc_reg_operand"))
6826 (zero_extend:TI (match_operand:DI 2 "gpc_reg_operand"))))]
6829 rtx l = gen_reg_rtx (DImode), h = gen_reg_rtx (DImode);
6830 emit_insn (gen_muldi3 (l, operands[1], operands[2]));
6831 emit_insn (gen_umuldi3_highpart (h, operands[1], operands[2]));
6832 emit_move_insn (gen_lowpart (DImode, operands[0]), l);
6833 emit_move_insn (gen_highpart (DImode, operands[0]), h);
6837 (define_insn "rotldi3"
6838 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6839 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6840 (match_operand:DI 2 "reg_or_cint_operand" "r,i")))]
6845 [(set_attr "type" "var_shift_rotate,integer")])
6847 (define_insn "*rotldi3_internal2"
6848 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
6849 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6850 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
6852 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
6859 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6860 (set_attr "length" "4,4,8,8")])
6863 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
6864 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6865 (match_operand:DI 2 "reg_or_cint_operand" ""))
6867 (clobber (match_scratch:DI 3 ""))]
6868 "TARGET_POWERPC64 && reload_completed"
6870 (rotate:DI (match_dup 1) (match_dup 2)))
6872 (compare:CC (match_dup 3)
6876 (define_insn "*rotldi3_internal3"
6877 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
6878 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6879 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
6881 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
6882 (rotate:DI (match_dup 1) (match_dup 2)))]
6889 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6890 (set_attr "length" "4,4,8,8")])
6893 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
6894 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6895 (match_operand:DI 2 "reg_or_cint_operand" ""))
6897 (set (match_operand:DI 0 "gpc_reg_operand" "")
6898 (rotate:DI (match_dup 1) (match_dup 2)))]
6899 "TARGET_POWERPC64 && reload_completed"
6901 (rotate:DI (match_dup 1) (match_dup 2)))
6903 (compare:CC (match_dup 0)
6907 (define_insn "*rotldi3_internal4"
6908 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6909 (and:DI (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6910 (match_operand:DI 2 "reg_or_cint_operand" "r,i"))
6911 (match_operand:DI 3 "mask64_operand" "n,n")))]
6914 rldc%B3 %0,%1,%2,%S3
6915 rldic%B3 %0,%1,%H2,%S3"
6916 [(set_attr "type" "var_shift_rotate,integer")])
6918 (define_insn "*rotldi3_internal5"
6919 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
6921 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6922 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
6923 (match_operand:DI 3 "mask64_operand" "n,n,n,n"))
6925 (clobber (match_scratch:DI 4 "=r,r,r,r"))]
6928 rldc%B3. %4,%1,%2,%S3
6929 rldic%B3. %4,%1,%H2,%S3
6932 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6933 (set_attr "length" "4,4,8,8")])
6936 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
6938 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6939 (match_operand:DI 2 "reg_or_cint_operand" ""))
6940 (match_operand:DI 3 "mask64_operand" ""))
6942 (clobber (match_scratch:DI 4 ""))]
6943 "TARGET_POWERPC64 && reload_completed"
6945 (and:DI (rotate:DI (match_dup 1)
6949 (compare:CC (match_dup 4)
6953 (define_insn "*rotldi3_internal6"
6954 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
6956 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6957 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
6958 (match_operand:DI 3 "mask64_operand" "n,n,n,n"))
6960 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
6961 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6964 rldc%B3. %0,%1,%2,%S3
6965 rldic%B3. %0,%1,%H2,%S3
6968 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6969 (set_attr "length" "4,4,8,8")])
6972 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
6974 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6975 (match_operand:DI 2 "reg_or_cint_operand" ""))
6976 (match_operand:DI 3 "mask64_operand" ""))
6978 (set (match_operand:DI 0 "gpc_reg_operand" "")
6979 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6980 "TARGET_POWERPC64 && reload_completed"
6982 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
6984 (compare:CC (match_dup 0)
6988 (define_insn "*rotldi3_internal7le"
6989 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6992 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6993 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
6994 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN"
6997 rldicl %0,%1,%H2,56"
6998 [(set_attr "type" "var_shift_rotate,integer")])
7000 (define_insn "*rotldi3_internal7be"
7001 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7004 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7005 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 7)))]
7006 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN"
7009 rldicl %0,%1,%H2,56"
7010 [(set_attr "type" "var_shift_rotate,integer")])
7012 (define_insn "*rotldi3_internal8le"
7013 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7014 (compare:CC (zero_extend:DI
7016 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7017 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7019 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7020 "TARGET_64BIT && !BYTES_BIG_ENDIAN"
7023 rldicl. %3,%1,%H2,56
7026 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7027 (set_attr "length" "4,4,8,8")])
7029 (define_insn "*rotldi3_internal8be"
7030 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7031 (compare:CC (zero_extend:DI
7033 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7034 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 7))
7036 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7037 "TARGET_64BIT && BYTES_BIG_ENDIAN"
7040 rldicl. %3,%1,%H2,56
7043 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7044 (set_attr "length" "4,4,8,8")])
7047 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7048 (compare:CC (zero_extend:DI
7050 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7051 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7053 (clobber (match_scratch:DI 3 ""))]
7054 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN && reload_completed"
7056 (zero_extend:DI (subreg:QI
7057 (rotate:DI (match_dup 1)
7060 (compare:CC (match_dup 3)
7065 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7066 (compare:CC (zero_extend:DI
7068 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7069 (match_operand:DI 2 "reg_or_cint_operand" "")) 7))
7071 (clobber (match_scratch:DI 3 ""))]
7072 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN && reload_completed"
7074 (zero_extend:DI (subreg:QI
7075 (rotate:DI (match_dup 1)
7078 (compare:CC (match_dup 3)
7082 (define_insn "*rotldi3_internal9le"
7083 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7084 (compare:CC (zero_extend:DI
7086 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7087 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7089 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7090 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7091 "TARGET_64BIT && !BYTES_BIG_ENDIAN"
7094 rldicl. %0,%1,%H2,56
7097 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7098 (set_attr "length" "4,4,8,8")])
7100 (define_insn "*rotldi3_internal9be"
7101 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7102 (compare:CC (zero_extend:DI
7104 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7105 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 7))
7107 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7108 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 7)))]
7109 "TARGET_64BIT && BYTES_BIG_ENDIAN"
7112 rldicl. %0,%1,%H2,56
7115 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7116 (set_attr "length" "4,4,8,8")])
7119 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7120 (compare:CC (zero_extend:DI
7122 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7123 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7125 (set (match_operand:DI 0 "gpc_reg_operand" "")
7126 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7127 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN && reload_completed"
7129 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
7131 (compare:CC (match_dup 0)
7136 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7137 (compare:CC (zero_extend:DI
7139 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7140 (match_operand:DI 2 "reg_or_cint_operand" "")) 7))
7142 (set (match_operand:DI 0 "gpc_reg_operand" "")
7143 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 7)))]
7144 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN && reload_completed"
7146 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 7)))
7148 (compare:CC (match_dup 0)
7152 (define_insn "*rotldi3_internal10le"
7153 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7156 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7157 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
7158 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN"
7161 rldicl %0,%1,%H2,48"
7162 [(set_attr "type" "var_shift_rotate,integer")])
7164 (define_insn "*rotldi3_internal10be"
7165 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7168 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7169 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 6)))]
7170 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN"
7173 rldicl %0,%1,%H2,48"
7174 [(set_attr "type" "var_shift_rotate,integer")])
7176 (define_insn "*rotldi3_internal11le"
7177 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7178 (compare:CC (zero_extend:DI
7180 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7181 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7183 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7184 "TARGET_64BIT && !BYTES_BIG_ENDIAN"
7187 rldicl. %3,%1,%H2,48
7190 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7191 (set_attr "length" "4,4,8,8")])
7193 (define_insn "*rotldi3_internal11be"
7194 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7195 (compare:CC (zero_extend:DI
7197 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7198 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 6))
7200 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7201 "TARGET_64BIT && BYTES_BIG_ENDIAN"
7204 rldicl. %3,%1,%H2,48
7207 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7208 (set_attr "length" "4,4,8,8")])
7211 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7212 (compare:CC (zero_extend:DI
7214 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7215 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7217 (clobber (match_scratch:DI 3 ""))]
7218 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN && reload_completed"
7220 (zero_extend:DI (subreg:HI
7221 (rotate:DI (match_dup 1)
7224 (compare:CC (match_dup 3)
7229 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7230 (compare:CC (zero_extend:DI
7232 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7233 (match_operand:DI 2 "reg_or_cint_operand" "")) 6))
7235 (clobber (match_scratch:DI 3 ""))]
7236 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN && reload_completed"
7238 (zero_extend:DI (subreg:HI
7239 (rotate:DI (match_dup 1)
7242 (compare:CC (match_dup 3)
7246 (define_insn "*rotldi3_internal12le"
7247 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7248 (compare:CC (zero_extend:DI
7250 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7251 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7253 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7254 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7255 "TARGET_64BIT && !BYTES_BIG_ENDIAN"
7258 rldicl. %0,%1,%H2,48
7261 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7262 (set_attr "length" "4,4,8,8")])
7264 (define_insn "*rotldi3_internal12be"
7265 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7266 (compare:CC (zero_extend:DI
7268 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7269 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 6))
7271 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7272 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 6)))]
7273 "TARGET_64BIT && BYTES_BIG_ENDIAN"
7276 rldicl. %0,%1,%H2,48
7279 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7280 (set_attr "length" "4,4,8,8")])
7283 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7284 (compare:CC (zero_extend:DI
7286 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7287 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7289 (set (match_operand:DI 0 "gpc_reg_operand" "")
7290 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7291 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN && reload_completed"
7293 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
7295 (compare:CC (match_dup 0)
7300 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7301 (compare:CC (zero_extend:DI
7303 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7304 (match_operand:DI 2 "reg_or_cint_operand" "")) 6))
7306 (set (match_operand:DI 0 "gpc_reg_operand" "")
7307 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 6)))]
7308 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN && reload_completed"
7310 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 6)))
7312 (compare:CC (match_dup 0)
7316 (define_insn "*rotldi3_internal13le"
7317 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7320 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7321 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
7322 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN"
7325 rldicl %0,%1,%H2,32"
7326 [(set_attr "type" "var_shift_rotate,integer")])
7328 (define_insn "*rotldi3_internal13be"
7329 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7332 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7333 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 4)))]
7334 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN"
7337 rldicl %0,%1,%H2,32"
7338 [(set_attr "type" "var_shift_rotate,integer")])
7340 (define_insn "*rotldi3_internal14le"
7341 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7342 (compare:CC (zero_extend:DI
7344 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7345 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7347 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7348 "TARGET_64BIT && !BYTES_BIG_ENDIAN"
7351 rldicl. %3,%1,%H2,32
7354 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7355 (set_attr "length" "4,4,8,8")])
7357 (define_insn "*rotldi3_internal14be"
7358 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7359 (compare:CC (zero_extend:DI
7361 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7362 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 4))
7364 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7365 "TARGET_64BIT && BYTES_BIG_ENDIAN"
7368 rldicl. %3,%1,%H2,32
7371 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7372 (set_attr "length" "4,4,8,8")])
7375 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7376 (compare:CC (zero_extend:DI
7378 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7379 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7381 (clobber (match_scratch:DI 3 ""))]
7382 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN && reload_completed"
7384 (zero_extend:DI (subreg:SI
7385 (rotate:DI (match_dup 1)
7388 (compare:CC (match_dup 3)
7393 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7394 (compare:CC (zero_extend:DI
7396 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7397 (match_operand:DI 2 "reg_or_cint_operand" "")) 4))
7399 (clobber (match_scratch:DI 3 ""))]
7400 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN && reload_completed"
7402 (zero_extend:DI (subreg:SI
7403 (rotate:DI (match_dup 1)
7406 (compare:CC (match_dup 3)
7410 (define_insn "*rotldi3_internal15le"
7411 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7412 (compare:CC (zero_extend:DI
7414 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7415 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7417 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7418 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7419 "TARGET_64BIT && !BYTES_BIG_ENDIAN"
7422 rldicl. %0,%1,%H2,32
7425 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7426 (set_attr "length" "4,4,8,8")])
7428 (define_insn "*rotldi3_internal15be"
7429 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7430 (compare:CC (zero_extend:DI
7432 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7433 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 4))
7435 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7436 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 4)))]
7437 "TARGET_64BIT && BYTES_BIG_ENDIAN"
7440 rldicl. %0,%1,%H2,32
7443 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7444 (set_attr "length" "4,4,8,8")])
7447 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7448 (compare:CC (zero_extend:DI
7450 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7451 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7453 (set (match_operand:DI 0 "gpc_reg_operand" "")
7454 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7455 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN && reload_completed"
7457 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
7459 (compare:CC (match_dup 0)
7464 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7465 (compare:CC (zero_extend:DI
7467 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7468 (match_operand:DI 2 "reg_or_cint_operand" "")) 4))
7470 (set (match_operand:DI 0 "gpc_reg_operand" "")
7471 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 4)))]
7472 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN && reload_completed"
7474 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 4)))
7476 (compare:CC (match_dup 0)
7480 (define_expand "ashldi3"
7481 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7482 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7483 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7487 (define_insn "*ashldi3_internal1"
7488 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7489 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7490 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
7495 [(set_attr "type" "var_shift_rotate,shift")])
7497 (define_insn "*ashldi3_internal2"
7498 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7499 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7500 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7502 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7509 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7510 (set_attr "length" "4,4,8,8")])
7513 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7514 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7515 (match_operand:SI 2 "reg_or_cint_operand" ""))
7517 (clobber (match_scratch:DI 3 ""))]
7518 "TARGET_POWERPC64 && reload_completed"
7520 (ashift:DI (match_dup 1) (match_dup 2)))
7522 (compare:CC (match_dup 3)
7526 (define_insn "*ashldi3_internal3"
7527 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7528 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7529 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7531 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7532 (ashift:DI (match_dup 1) (match_dup 2)))]
7539 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7540 (set_attr "length" "4,4,8,8")])
7543 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7544 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7545 (match_operand:SI 2 "reg_or_cint_operand" ""))
7547 (set (match_operand:DI 0 "gpc_reg_operand" "")
7548 (ashift:DI (match_dup 1) (match_dup 2)))]
7549 "TARGET_POWERPC64 && reload_completed"
7551 (ashift:DI (match_dup 1) (match_dup 2)))
7553 (compare:CC (match_dup 0)
7557 (define_insn "*ashldi3_internal4"
7558 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7559 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7560 (match_operand:SI 2 "const_int_operand" "i"))
7561 (match_operand:DI 3 "const_int_operand" "n")))]
7562 "TARGET_POWERPC64 && includes_rldic_lshift_p (operands[2], operands[3])"
7563 "rldic %0,%1,%H2,%W3")
7565 (define_insn "ashldi3_internal5"
7566 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7568 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7569 (match_operand:SI 2 "const_int_operand" "i,i"))
7570 (match_operand:DI 3 "const_int_operand" "n,n"))
7572 (clobber (match_scratch:DI 4 "=r,r"))]
7573 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
7575 rldic. %4,%1,%H2,%W3
7577 [(set_attr "type" "compare")
7578 (set_attr "length" "4,8")])
7581 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7583 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7584 (match_operand:SI 2 "const_int_operand" ""))
7585 (match_operand:DI 3 "const_int_operand" ""))
7587 (clobber (match_scratch:DI 4 ""))]
7588 "TARGET_POWERPC64 && reload_completed
7589 && includes_rldic_lshift_p (operands[2], operands[3])"
7591 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7594 (compare:CC (match_dup 4)
7598 (define_insn "*ashldi3_internal6"
7599 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
7601 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7602 (match_operand:SI 2 "const_int_operand" "i,i"))
7603 (match_operand:DI 3 "const_int_operand" "n,n"))
7605 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7606 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7607 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
7609 rldic. %0,%1,%H2,%W3
7611 [(set_attr "type" "compare")
7612 (set_attr "length" "4,8")])
7615 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
7617 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7618 (match_operand:SI 2 "const_int_operand" ""))
7619 (match_operand:DI 3 "const_int_operand" ""))
7621 (set (match_operand:DI 0 "gpc_reg_operand" "")
7622 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7623 "TARGET_POWERPC64 && reload_completed
7624 && includes_rldic_lshift_p (operands[2], operands[3])"
7626 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7629 (compare:CC (match_dup 0)
7633 (define_insn "*ashldi3_internal7"
7634 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7635 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7636 (match_operand:SI 2 "const_int_operand" "i"))
7637 (match_operand:DI 3 "mask64_operand" "n")))]
7638 "TARGET_POWERPC64 && includes_rldicr_lshift_p (operands[2], operands[3])"
7639 "rldicr %0,%1,%H2,%S3")
7641 (define_insn "ashldi3_internal8"
7642 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7644 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7645 (match_operand:SI 2 "const_int_operand" "i,i"))
7646 (match_operand:DI 3 "mask64_operand" "n,n"))
7648 (clobber (match_scratch:DI 4 "=r,r"))]
7649 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
7651 rldicr. %4,%1,%H2,%S3
7653 [(set_attr "type" "compare")
7654 (set_attr "length" "4,8")])
7657 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7659 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7660 (match_operand:SI 2 "const_int_operand" ""))
7661 (match_operand:DI 3 "mask64_operand" ""))
7663 (clobber (match_scratch:DI 4 ""))]
7664 "TARGET_POWERPC64 && reload_completed
7665 && includes_rldicr_lshift_p (operands[2], operands[3])"
7667 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7670 (compare:CC (match_dup 4)
7674 (define_insn "*ashldi3_internal9"
7675 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
7677 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7678 (match_operand:SI 2 "const_int_operand" "i,i"))
7679 (match_operand:DI 3 "mask64_operand" "n,n"))
7681 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7682 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7683 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
7685 rldicr. %0,%1,%H2,%S3
7687 [(set_attr "type" "compare")
7688 (set_attr "length" "4,8")])
7691 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
7693 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7694 (match_operand:SI 2 "const_int_operand" ""))
7695 (match_operand:DI 3 "mask64_operand" ""))
7697 (set (match_operand:DI 0 "gpc_reg_operand" "")
7698 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7699 "TARGET_POWERPC64 && reload_completed
7700 && includes_rldicr_lshift_p (operands[2], operands[3])"
7702 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7705 (compare:CC (match_dup 0)
7709 (define_expand "lshrdi3"
7710 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7711 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7712 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7716 (define_insn "*lshrdi3_internal1"
7717 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7718 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7719 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
7724 [(set_attr "type" "var_shift_rotate,shift")])
7726 (define_insn "*lshrdi3_internal2"
7727 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7728 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7729 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7731 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7738 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7739 (set_attr "length" "4,4,8,8")])
7742 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7743 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7744 (match_operand:SI 2 "reg_or_cint_operand" ""))
7746 (clobber (match_scratch:DI 3 ""))]
7747 "TARGET_POWERPC64 && reload_completed"
7749 (lshiftrt:DI (match_dup 1) (match_dup 2)))
7751 (compare:CC (match_dup 3)
7755 (define_insn "*lshrdi3_internal3"
7756 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7757 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7758 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7760 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7761 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
7768 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7769 (set_attr "length" "4,4,8,8")])
7772 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7773 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7774 (match_operand:SI 2 "reg_or_cint_operand" ""))
7776 (set (match_operand:DI 0 "gpc_reg_operand" "")
7777 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
7778 "TARGET_POWERPC64 && reload_completed"
7780 (lshiftrt:DI (match_dup 1) (match_dup 2)))
7782 (compare:CC (match_dup 0)
7786 (define_expand "ashrdi3"
7787 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7788 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7789 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7793 if (TARGET_POWERPC64)
7795 else if (GET_CODE (operands[2]) == CONST_INT)
7797 emit_insn (gen_ashrdi3_no_power (operands[0], operands[1], operands[2]));
7804 (define_insn "*ashrdi3_internal1"
7805 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7806 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7807 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
7812 [(set_attr "type" "var_shift_rotate,shift")])
7814 (define_insn "*ashrdi3_internal2"
7815 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7816 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7817 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7819 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7826 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7827 (set_attr "length" "4,4,8,8")])
7830 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7831 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7832 (match_operand:SI 2 "reg_or_cint_operand" ""))
7834 (clobber (match_scratch:DI 3 ""))]
7835 "TARGET_POWERPC64 && reload_completed"
7837 (ashiftrt:DI (match_dup 1) (match_dup 2)))
7839 (compare:CC (match_dup 3)
7843 (define_insn "*ashrdi3_internal3"
7844 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7845 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7846 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7848 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7849 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
7856 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7857 (set_attr "length" "4,4,8,8")])
7860 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7861 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7862 (match_operand:SI 2 "reg_or_cint_operand" ""))
7864 (set (match_operand:DI 0 "gpc_reg_operand" "")
7865 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
7866 "TARGET_POWERPC64 && reload_completed"
7868 (ashiftrt:DI (match_dup 1) (match_dup 2)))
7870 (compare:CC (match_dup 0)
7874 (define_expand "anddi3"
7876 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7877 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7878 (match_operand:DI 2 "reg_or_cint_operand" "")))
7879 (clobber (match_scratch:CC 3 ""))])]
7882 if (!TARGET_POWERPC64)
7884 rtx cc = gen_rtx_SCRATCH (CCmode);
7885 rs6000_split_logical (operands, AND, false, false, false, cc);
7888 else if (!and64_2_operand (operands[2], DImode))
7889 operands[2] = force_reg (DImode, operands[2]);
7892 (define_insn "anddi3_mc"
7893 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
7894 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r")
7895 (match_operand:DI 2 "and64_2_operand" "?r,S,T,K,J,t")))
7896 (clobber (match_scratch:CC 3 "=X,X,X,x,x,X"))]
7897 "TARGET_POWERPC64 && rs6000_gen_cell_microcode"
7900 rldic%B2 %0,%1,0,%S2
7901 rlwinm %0,%1,0,%m2,%M2
7905 [(set_attr "type" "*,*,*,fast_compare,fast_compare,*")
7906 (set_attr "length" "4,4,4,4,4,8")])
7908 (define_insn "anddi3_nomc"
7909 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7910 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r")
7911 (match_operand:DI 2 "and64_2_operand" "?r,S,T,t")))
7912 (clobber (match_scratch:CC 3 "=X,X,X,X"))]
7913 "TARGET_POWERPC64 && !rs6000_gen_cell_microcode"
7916 rldic%B2 %0,%1,0,%S2
7917 rlwinm %0,%1,0,%m2,%M2
7919 [(set_attr "length" "4,4,4,8")])
7922 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7923 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7924 (match_operand:DI 2 "mask64_2_operand" "")))
7925 (clobber (match_scratch:CC 3 ""))]
7927 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7928 && !mask_operand (operands[2], DImode)
7929 && !mask64_operand (operands[2], DImode)"
7931 (and:DI (rotate:DI (match_dup 1)
7935 (and:DI (rotate:DI (match_dup 0)
7939 build_mask64_2_operands (operands[2], &operands[4]);
7942 (define_insn "*anddi3_internal2_mc"
7943 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,x,?y,?y,?y,??y,??y,?y")
7944 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r,r,r")
7945 (match_operand:DI 2 "and64_2_operand" "r,S,T,K,J,t,r,S,T,K,J,t"))
7947 (clobber (match_scratch:DI 3 "=r,r,r,r,r,r,r,r,r,r,r,r"))
7948 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,X,X,x,x,X"))]
7949 "TARGET_64BIT && rs6000_gen_cell_microcode"
7952 rldic%B2. %3,%1,0,%S2
7953 rlwinm. %3,%1,0,%m2,%M2
7963 [(set_attr "type" "fast_compare,compare,delayed_compare,fast_compare,\
7964 fast_compare,compare,compare,compare,compare,compare,\
7966 (set_attr "length" "4,4,4,4,4,8,8,8,8,8,8,12")])
7969 [(set (match_operand:CC 0 "cc_reg_operand" "")
7970 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7971 (match_operand:DI 2 "mask64_2_operand" ""))
7973 (clobber (match_scratch:DI 3 ""))
7974 (clobber (match_scratch:CC 4 ""))]
7975 "TARGET_64BIT && reload_completed
7976 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7977 && !mask_operand (operands[2], DImode)
7978 && !mask64_operand (operands[2], DImode)"
7980 (and:DI (rotate:DI (match_dup 1)
7983 (parallel [(set (match_dup 0)
7984 (compare:CC (and:DI (rotate:DI (match_dup 3)
7988 (clobber (match_dup 3))])]
7991 build_mask64_2_operands (operands[2], &operands[5]);
7994 (define_insn "*anddi3_internal3_mc"
7995 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,x,x,?y,?y,?y,??y,??y,?y")
7996 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r,r,r")
7997 (match_operand:DI 2 "and64_2_operand" "r,S,T,K,J,t,r,S,T,K,J,t"))
7999 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r,r,r")
8000 (and:DI (match_dup 1) (match_dup 2)))
8001 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,X,X,x,x,X"))]
8002 "TARGET_64BIT && rs6000_gen_cell_microcode"
8005 rldic%B2. %0,%1,0,%S2
8006 rlwinm. %0,%1,0,%m2,%M2
8016 [(set_attr "type" "fast_compare,compare,delayed_compare,fast_compare,\
8017 fast_compare,compare,compare,compare,compare,compare,\
8019 (set_attr "length" "4,4,4,4,4,8,8,8,8,8,8,12")])
8022 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8023 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8024 (match_operand:DI 2 "and64_2_operand" ""))
8026 (set (match_operand:DI 0 "gpc_reg_operand" "")
8027 (and:DI (match_dup 1) (match_dup 2)))
8028 (clobber (match_scratch:CC 4 ""))]
8029 "TARGET_64BIT && reload_completed"
8030 [(parallel [(set (match_dup 0)
8031 (and:DI (match_dup 1) (match_dup 2)))
8032 (clobber (match_dup 4))])
8034 (compare:CC (match_dup 0)
8039 [(set (match_operand:CC 3 "cc_reg_operand" "")
8040 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8041 (match_operand:DI 2 "mask64_2_operand" ""))
8043 (set (match_operand:DI 0 "gpc_reg_operand" "")
8044 (and:DI (match_dup 1) (match_dup 2)))
8045 (clobber (match_scratch:CC 4 ""))]
8046 "TARGET_64BIT && reload_completed
8047 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
8048 && !mask_operand (operands[2], DImode)
8049 && !mask64_operand (operands[2], DImode)"
8051 (and:DI (rotate:DI (match_dup 1)
8054 (parallel [(set (match_dup 3)
8055 (compare:CC (and:DI (rotate:DI (match_dup 0)
8060 (and:DI (rotate:DI (match_dup 0)
8065 build_mask64_2_operands (operands[2], &operands[5]);
8068 (define_expand "iordi3"
8069 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8070 (ior:DI (match_operand:DI 1 "gpc_reg_operand" "")
8071 (match_operand:DI 2 "reg_or_cint_operand" "")))]
8074 if (!TARGET_POWERPC64)
8076 rs6000_split_logical (operands, IOR, false, false, false, NULL_RTX);
8079 else if (!reg_or_logical_cint_operand (operands[2], DImode))
8080 operands[2] = force_reg (DImode, operands[2]);
8081 else if (non_logical_cint_operand (operands[2], DImode))
8083 HOST_WIDE_INT value;
8084 rtx tmp = ((!can_create_pseudo_p ()
8085 || rtx_equal_p (operands[0], operands[1]))
8086 ? operands[0] : gen_reg_rtx (DImode));
8088 value = INTVAL (operands[2]);
8089 emit_insn (gen_iordi3 (tmp, operands[1],
8090 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
8092 emit_insn (gen_iordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
8097 (define_expand "xordi3"
8098 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8099 (xor:DI (match_operand:DI 1 "gpc_reg_operand" "")
8100 (match_operand:DI 2 "reg_or_cint_operand" "")))]
8103 if (!TARGET_POWERPC64)
8105 rs6000_split_logical (operands, XOR, false, false, false, NULL_RTX);
8108 else if (!reg_or_logical_cint_operand (operands[2], DImode))
8109 operands[2] = force_reg (DImode, operands[2]);
8110 if (non_logical_cint_operand (operands[2], DImode))
8112 HOST_WIDE_INT value;
8113 rtx tmp = ((!can_create_pseudo_p ()
8114 || rtx_equal_p (operands[0], operands[1]))
8115 ? operands[0] : gen_reg_rtx (DImode));
8117 value = INTVAL (operands[2]);
8118 emit_insn (gen_xordi3 (tmp, operands[1],
8119 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
8121 emit_insn (gen_xordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
8126 (define_insn "*booldi3_internal1"
8127 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
8128 (match_operator:DI 3 "boolean_or_operator"
8129 [(match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
8130 (match_operand:DI 2 "logical_operand" "r,K,JF")]))]
8137 (define_insn "*booldi3_internal2"
8138 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
8139 (compare:CC (match_operator:DI 4 "boolean_or_operator"
8140 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
8141 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
8143 (clobber (match_scratch:DI 3 "=r,r"))]
8148 [(set_attr "type" "fast_compare,compare")
8149 (set_attr "length" "4,8")])
8152 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8153 (compare:CC (match_operator:DI 4 "boolean_operator"
8154 [(match_operand:DI 1 "gpc_reg_operand" "")
8155 (match_operand:DI 2 "gpc_reg_operand" "")])
8157 (clobber (match_scratch:DI 3 ""))]
8158 "TARGET_POWERPC64 && reload_completed"
8159 [(set (match_dup 3) (match_dup 4))
8161 (compare:CC (match_dup 3)
8165 (define_insn "*booldi3_internal3"
8166 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
8167 (compare:CC (match_operator:DI 4 "boolean_or_operator"
8168 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
8169 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
8171 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8177 [(set_attr "type" "fast_compare,compare")
8178 (set_attr "length" "4,8")])
8181 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8182 (compare:CC (match_operator:DI 4 "boolean_operator"
8183 [(match_operand:DI 1 "gpc_reg_operand" "")
8184 (match_operand:DI 2 "gpc_reg_operand" "")])
8186 (set (match_operand:DI 0 "gpc_reg_operand" "")
8188 "TARGET_POWERPC64 && reload_completed"
8189 [(set (match_dup 0) (match_dup 4))
8191 (compare:CC (match_dup 0)
8195 ;; Split a logical operation that we can't do in one insn into two insns,
8196 ;; each of which does one 16-bit part. This is used by combine.
8199 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8200 (match_operator:DI 3 "boolean_or_operator"
8201 [(match_operand:DI 1 "gpc_reg_operand" "")
8202 (match_operand:DI 2 "non_logical_cint_operand" "")]))]
8204 [(set (match_dup 0) (match_dup 4))
8205 (set (match_dup 0) (match_dup 5))]
8210 i3 = GEN_INT (INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff));
8211 i4 = GEN_INT (INTVAL (operands[2]) & 0xffff);
8212 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
8214 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
8218 (define_insn "*boolcdi3_internal1"
8219 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
8220 (match_operator:DI 3 "boolean_operator"
8221 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
8222 (match_operand:DI 2 "gpc_reg_operand" "r")]))]
8226 (define_insn "*boolcdi3_internal2"
8227 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
8228 (compare:CC (match_operator:DI 4 "boolean_operator"
8229 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
8230 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
8232 (clobber (match_scratch:DI 3 "=r,r"))]
8237 [(set_attr "type" "fast_compare,compare")
8238 (set_attr "length" "4,8")])
8241 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8242 (compare:CC (match_operator:DI 4 "boolean_operator"
8243 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
8244 (match_operand:DI 2 "gpc_reg_operand" "")])
8246 (clobber (match_scratch:DI 3 ""))]
8247 "TARGET_POWERPC64 && reload_completed"
8248 [(set (match_dup 3) (match_dup 4))
8250 (compare:CC (match_dup 3)
8254 (define_insn "*boolcdi3_internal3"
8255 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
8256 (compare:CC (match_operator:DI 4 "boolean_operator"
8257 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
8258 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
8260 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8266 [(set_attr "type" "fast_compare,compare")
8267 (set_attr "length" "4,8")])
8270 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8271 (compare:CC (match_operator:DI 4 "boolean_operator"
8272 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
8273 (match_operand:DI 2 "gpc_reg_operand" "")])
8275 (set (match_operand:DI 0 "gpc_reg_operand" "")
8277 "TARGET_POWERPC64 && reload_completed"
8278 [(set (match_dup 0) (match_dup 4))
8280 (compare:CC (match_dup 0)
8284 (define_insn "*boolccdi3_internal1"
8285 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
8286 (match_operator:DI 3 "boolean_operator"
8287 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
8288 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r"))]))]
8292 (define_insn "*boolccdi3_internal2"
8293 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
8294 (compare:CC (match_operator:DI 4 "boolean_operator"
8295 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
8296 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
8298 (clobber (match_scratch:DI 3 "=r,r"))]
8303 [(set_attr "type" "fast_compare,compare")
8304 (set_attr "length" "4,8")])
8307 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8308 (compare:CC (match_operator:DI 4 "boolean_operator"
8309 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
8310 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
8312 (clobber (match_scratch:DI 3 ""))]
8313 "TARGET_POWERPC64 && reload_completed"
8314 [(set (match_dup 3) (match_dup 4))
8316 (compare:CC (match_dup 3)
8320 (define_insn "*boolccdi3_internal3"
8321 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
8322 (compare:CC (match_operator:DI 4 "boolean_operator"
8323 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
8324 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
8326 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8332 [(set_attr "type" "fast_compare,compare")
8333 (set_attr "length" "4,8")])
8336 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8337 (compare:CC (match_operator:DI 4 "boolean_operator"
8338 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
8339 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
8341 (set (match_operand:DI 0 "gpc_reg_operand" "")
8343 "TARGET_POWERPC64 && reload_completed"
8344 [(set (match_dup 0) (match_dup 4))
8346 (compare:CC (match_dup 0)
8351 (define_insn "*eqv<mode>3"
8352 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
8354 (xor:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
8355 (match_operand:GPR 2 "gpc_reg_operand" "r"))))]
8358 [(set_attr "type" "integer")
8359 (set_attr "length" "4")])
8362 ;; 128-bit logical operations expanders
8364 (define_expand "and<mode>3"
8365 [(parallel [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
8367 (match_operand:BOOL_128 1 "vlogical_operand" "")
8368 (match_operand:BOOL_128 2 "vlogical_operand" "")))
8369 (clobber (match_scratch:CC 3 ""))])]
8373 (define_expand "ior<mode>3"
8374 [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
8375 (ior:BOOL_128 (match_operand:BOOL_128 1 "vlogical_operand" "")
8376 (match_operand:BOOL_128 2 "vlogical_operand" "")))]
8380 (define_expand "xor<mode>3"
8381 [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
8382 (xor:BOOL_128 (match_operand:BOOL_128 1 "vlogical_operand" "")
8383 (match_operand:BOOL_128 2 "vlogical_operand" "")))]
8387 (define_expand "one_cmpl<mode>2"
8388 [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
8389 (not:BOOL_128 (match_operand:BOOL_128 1 "vlogical_operand" "")))]
8393 (define_expand "nor<mode>3"
8394 [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
8396 (not:BOOL_128 (match_operand:BOOL_128 1 "vlogical_operand" ""))
8397 (not:BOOL_128 (match_operand:BOOL_128 2 "vlogical_operand" ""))))]
8401 (define_expand "andc<mode>3"
8402 [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
8404 (not:BOOL_128 (match_operand:BOOL_128 2 "vlogical_operand" ""))
8405 (match_operand:BOOL_128 1 "vlogical_operand" "")))]
8409 ;; Power8 vector logical instructions.
8410 (define_expand "eqv<mode>3"
8411 [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
8413 (xor:BOOL_128 (match_operand:BOOL_128 1 "vlogical_operand" "")
8414 (match_operand:BOOL_128 2 "vlogical_operand" ""))))]
8415 "<MODE>mode == TImode || <MODE>mode == PTImode || TARGET_P8_VECTOR"
8418 ;; Rewrite nand into canonical form
8419 (define_expand "nand<mode>3"
8420 [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
8422 (not:BOOL_128 (match_operand:BOOL_128 1 "vlogical_operand" ""))
8423 (not:BOOL_128 (match_operand:BOOL_128 2 "vlogical_operand" ""))))]
8424 "<MODE>mode == TImode || <MODE>mode == PTImode || TARGET_P8_VECTOR"
8427 ;; The canonical form is to have the negated element first, so we need to
8428 ;; reverse arguments.
8429 (define_expand "orc<mode>3"
8430 [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
8432 (not:BOOL_128 (match_operand:BOOL_128 2 "vlogical_operand" ""))
8433 (match_operand:BOOL_128 1 "vlogical_operand" "")))]
8434 "<MODE>mode == TImode || <MODE>mode == PTImode || TARGET_P8_VECTOR"
8437 ;; 128-bit logical operations insns and split operations
8438 (define_insn_and_split "*and<mode>3_internal"
8439 [(set (match_operand:BOOL_128 0 "vlogical_operand" "=<BOOL_REGS_OUTPUT>")
8441 (match_operand:BOOL_128 1 "vlogical_operand" "%<BOOL_REGS_OP1>")
8442 (match_operand:BOOL_128 2 "vlogical_operand" "<BOOL_REGS_OP2>")))
8443 (clobber (match_scratch:CC 3 "<BOOL_REGS_AND_CR0>"))]
8446 if (TARGET_VSX && vsx_register_operand (operands[0], <MODE>mode))
8447 return "xxland %x0,%x1,%x2";
8449 if (TARGET_ALTIVEC && altivec_register_operand (operands[0], <MODE>mode))
8450 return "vand %0,%1,%2";
8454 "reload_completed && int_reg_operand (operands[0], <MODE>mode)"
8457 rs6000_split_logical (operands, AND, false, false, false, operands[3]);
8462 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
8463 (const_string "vecsimple")
8464 (const_string "integer")))
8465 (set (attr "length")
8467 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
8470 (match_test "TARGET_POWERPC64")
8472 (const_string "16"))))])
8475 (define_insn_and_split "*bool<mode>3_internal"
8476 [(set (match_operand:BOOL_128 0 "vlogical_operand" "=<BOOL_REGS_OUTPUT>")
8477 (match_operator:BOOL_128 3 "boolean_or_operator"
8478 [(match_operand:BOOL_128 1 "vlogical_operand" "%<BOOL_REGS_OP1>")
8479 (match_operand:BOOL_128 2 "vlogical_operand" "<BOOL_REGS_OP2>")]))]
8482 if (TARGET_VSX && vsx_register_operand (operands[0], <MODE>mode))
8483 return "xxl%q3 %x0,%x1,%x2";
8485 if (TARGET_ALTIVEC && altivec_register_operand (operands[0], <MODE>mode))
8486 return "v%q3 %0,%1,%2";
8490 "reload_completed && int_reg_operand (operands[0], <MODE>mode)"
8493 rs6000_split_logical (operands, GET_CODE (operands[3]), false, false, false,
8499 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
8500 (const_string "vecsimple")
8501 (const_string "integer")))
8502 (set (attr "length")
8504 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
8507 (match_test "TARGET_POWERPC64")
8509 (const_string "16"))))])
8512 (define_insn_and_split "*boolc<mode>3_internal1"
8513 [(set (match_operand:BOOL_128 0 "vlogical_operand" "=<BOOL_REGS_OUTPUT>")
8514 (match_operator:BOOL_128 3 "boolean_operator"
8516 (match_operand:BOOL_128 2 "vlogical_operand" "<BOOL_REGS_OP1>"))
8517 (match_operand:BOOL_128 1 "vlogical_operand" "<BOOL_REGS_OP2>")]))]
8518 "TARGET_P8_VECTOR || (GET_CODE (operands[3]) == AND)"
8520 if (TARGET_VSX && vsx_register_operand (operands[0], <MODE>mode))
8521 return "xxl%q3 %x0,%x1,%x2";
8523 if (TARGET_ALTIVEC && altivec_register_operand (operands[0], <MODE>mode))
8524 return "v%q3 %0,%1,%2";
8528 "(TARGET_P8_VECTOR || (GET_CODE (operands[3]) == AND))
8529 && reload_completed && int_reg_operand (operands[0], <MODE>mode)"
8532 rs6000_split_logical (operands, GET_CODE (operands[3]), false, true, false,
8538 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
8539 (const_string "vecsimple")
8540 (const_string "integer")))
8541 (set (attr "length")
8543 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
8546 (match_test "TARGET_POWERPC64")
8548 (const_string "16"))))])
8550 (define_insn_and_split "*boolc<mode>3_internal2"
8551 [(set (match_operand:TI2 0 "int_reg_operand" "=&r,r,r")
8552 (match_operator:TI2 3 "boolean_operator"
8554 (match_operand:TI2 1 "int_reg_operand" "r,0,r"))
8555 (match_operand:TI2 2 "int_reg_operand" "r,r,0")]))]
8556 "!TARGET_P8_VECTOR && (GET_CODE (operands[3]) != AND)"
8558 "reload_completed && !TARGET_P8_VECTOR && (GET_CODE (operands[3]) != AND)"
8561 rs6000_split_logical (operands, GET_CODE (operands[3]), false, true, false,
8565 [(set_attr "type" "integer")
8566 (set (attr "length")
8568 (match_test "TARGET_POWERPC64")
8570 (const_string "16")))])
8573 (define_insn_and_split "*boolcc<mode>3_internal1"
8574 [(set (match_operand:BOOL_128 0 "vlogical_operand" "=<BOOL_REGS_OUTPUT>")
8575 (match_operator:BOOL_128 3 "boolean_operator"
8577 (match_operand:BOOL_128 1 "vlogical_operand" "<BOOL_REGS_OP1>"))
8579 (match_operand:BOOL_128 2 "vlogical_operand" "<BOOL_REGS_OP2>"))]))]
8580 "TARGET_P8_VECTOR || (GET_CODE (operands[3]) == AND)"
8582 if (TARGET_VSX && vsx_register_operand (operands[0], <MODE>mode))
8583 return "xxl%q3 %x0,%x1,%x2";
8585 if (TARGET_ALTIVEC && altivec_register_operand (operands[0], <MODE>mode))
8586 return "v%q3 %0,%1,%2";
8590 "(TARGET_P8_VECTOR || (GET_CODE (operands[3]) == AND))
8591 && reload_completed && int_reg_operand (operands[0], <MODE>mode)"
8594 rs6000_split_logical (operands, GET_CODE (operands[3]), false, true, true,
8600 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
8601 (const_string "vecsimple")
8602 (const_string "integer")))
8603 (set (attr "length")
8605 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
8608 (match_test "TARGET_POWERPC64")
8610 (const_string "16"))))])
8612 (define_insn_and_split "*boolcc<mode>3_internal2"
8613 [(set (match_operand:TI2 0 "int_reg_operand" "=&r,r,r")
8614 (match_operator:TI2 3 "boolean_operator"
8616 (match_operand:TI2 1 "int_reg_operand" "r,0,r"))
8618 (match_operand:TI2 2 "int_reg_operand" "r,r,0"))]))]
8619 "!TARGET_P8_VECTOR && (GET_CODE (operands[3]) != AND)"
8621 "reload_completed && !TARGET_P8_VECTOR && (GET_CODE (operands[3]) != AND)"
8624 rs6000_split_logical (operands, GET_CODE (operands[3]), false, true, true,
8628 [(set_attr "type" "integer")
8629 (set (attr "length")
8631 (match_test "TARGET_POWERPC64")
8633 (const_string "16")))])
8637 (define_insn_and_split "*eqv<mode>3_internal1"
8638 [(set (match_operand:BOOL_128 0 "vlogical_operand" "=<BOOL_REGS_OUTPUT>")
8641 (match_operand:BOOL_128 1 "vlogical_operand" "<BOOL_REGS_OP1>")
8642 (match_operand:BOOL_128 2 "vlogical_operand" "<BOOL_REGS_OP2>"))))]
8645 if (vsx_register_operand (operands[0], <MODE>mode))
8646 return "xxleqv %x0,%x1,%x2";
8650 "TARGET_P8_VECTOR && reload_completed
8651 && int_reg_operand (operands[0], <MODE>mode)"
8654 rs6000_split_logical (operands, XOR, true, false, false, NULL_RTX);
8659 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
8660 (const_string "vecsimple")
8661 (const_string "integer")))
8662 (set (attr "length")
8664 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
8667 (match_test "TARGET_POWERPC64")
8669 (const_string "16"))))])
8671 (define_insn_and_split "*eqv<mode>3_internal2"
8672 [(set (match_operand:TI2 0 "int_reg_operand" "=&r,r,r")
8675 (match_operand:TI2 1 "int_reg_operand" "r,0,r")
8676 (match_operand:TI2 2 "int_reg_operand" "r,r,0"))))]
8679 "reload_completed && !TARGET_P8_VECTOR"
8682 rs6000_split_logical (operands, XOR, true, false, false, NULL_RTX);
8685 [(set_attr "type" "integer")
8686 (set (attr "length")
8688 (match_test "TARGET_POWERPC64")
8690 (const_string "16")))])
8692 ;; 128-bit one's complement
8693 (define_insn_and_split "*one_cmpl<mode>3_internal"
8694 [(set (match_operand:BOOL_128 0 "vlogical_operand" "=<BOOL_REGS_OUTPUT>")
8696 (match_operand:BOOL_128 1 "vlogical_operand" "<BOOL_REGS_UNARY>")))]
8699 if (TARGET_VSX && vsx_register_operand (operands[0], <MODE>mode))
8700 return "xxlnor %x0,%x1,%x1";
8702 if (TARGET_ALTIVEC && altivec_register_operand (operands[0], <MODE>mode))
8703 return "vnor %0,%1,%1";
8707 "reload_completed && int_reg_operand (operands[0], <MODE>mode)"
8710 rs6000_split_logical (operands, NOT, false, false, false, NULL_RTX);
8715 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
8716 (const_string "vecsimple")
8717 (const_string "integer")))
8718 (set (attr "length")
8720 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
8723 (match_test "TARGET_POWERPC64")
8725 (const_string "16"))))])
8728 ;; Now define ways of moving data around.
8730 ;; Set up a register with a value from the GOT table
8732 (define_expand "movsi_got"
8733 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8734 (unspec:SI [(match_operand:SI 1 "got_operand" "")
8735 (match_dup 2)] UNSPEC_MOVSI_GOT))]
8736 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
8739 if (GET_CODE (operands[1]) == CONST)
8741 rtx offset = const0_rtx;
8742 HOST_WIDE_INT value;
8744 operands[1] = eliminate_constant_term (XEXP (operands[1], 0), &offset);
8745 value = INTVAL (offset);
8748 rtx tmp = (!can_create_pseudo_p ()
8750 : gen_reg_rtx (Pmode));
8751 emit_insn (gen_movsi_got (tmp, operands[1]));
8752 emit_insn (gen_addsi3 (operands[0], tmp, offset));
8757 operands[2] = rs6000_got_register (operands[1]);
8760 (define_insn "*movsi_got_internal"
8761 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8762 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
8763 (match_operand:SI 2 "gpc_reg_operand" "b")]
8765 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
8766 "lwz %0,%a1@got(%2)"
8767 [(set_attr "type" "load")])
8769 ;; Used by sched, shorten_branches and final when the GOT pseudo reg
8770 ;; didn't get allocated to a hard register.
8772 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8773 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
8774 (match_operand:SI 2 "memory_operand" "")]
8776 "DEFAULT_ABI == ABI_V4
8778 && (reload_in_progress || reload_completed)"
8779 [(set (match_dup 0) (match_dup 2))
8780 (set (match_dup 0) (unspec:SI [(match_dup 1)(match_dup 0)]
8784 ;; For SI, we special-case integers that can't be loaded in one insn. We
8785 ;; do the load 16-bits at a time. We could do this by loading from memory,
8786 ;; and this is even supposed to be faster, but it is simpler not to get
8787 ;; integers in the TOC.
8788 (define_insn "movsi_low"
8789 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8790 (mem:SI (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
8791 (match_operand 2 "" ""))))]
8792 "TARGET_MACHO && ! TARGET_64BIT"
8793 "lwz %0,lo16(%2)(%1)"
8794 [(set_attr "type" "load")
8795 (set_attr "length" "4")])
8797 (define_insn "*movsi_internal1"
8798 [(set (match_operand:SI 0 "rs6000_nonimmediate_operand" "=r,r,r,m,r,r,r,r,*c*l,*h,*h")
8799 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,*h,r,r,0"))]
8800 "!TARGET_SINGLE_FPU &&
8801 (gpc_reg_operand (operands[0], SImode) || gpc_reg_operand (operands[1], SImode))"
8814 [(set_attr "type" "*,*,load,store,*,*,*,mfjmpr,mtjmpr,*,*")
8815 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4")])
8817 (define_insn "*movsi_internal1_single"
8818 [(set (match_operand:SI 0 "rs6000_nonimmediate_operand" "=r,r,r,m,r,r,r,r,*c*l,*h,*h,m,*f")
8819 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,*h,r,r,0,f,m"))]
8820 "TARGET_SINGLE_FPU &&
8821 (gpc_reg_operand (operands[0], SImode) || gpc_reg_operand (operands[1], SImode))"
8836 [(set_attr "type" "*,*,load,store,*,*,*,mfjmpr,mtjmpr,*,*,fpstore,fpload")
8837 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4,4,4")])
8839 ;; Split a load of a large constant into the appropriate two-insn
8843 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8844 (match_operand:SI 1 "const_int_operand" ""))]
8845 "(unsigned HOST_WIDE_INT) (INTVAL (operands[1]) + 0x8000) >= 0x10000
8846 && (INTVAL (operands[1]) & 0xffff) != 0"
8850 (ior:SI (match_dup 0)
8853 { rtx tem = rs6000_emit_set_const (operands[0], SImode, operands[1], 2);
8855 if (tem == operands[0])
8861 (define_insn "*mov<mode>_internal2"
8862 [(set (match_operand:CC 2 "cc_reg_operand" "=y,x,?y")
8863 (compare:CC (match_operand:P 1 "gpc_reg_operand" "0,r,r")
8865 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r") (match_dup 1))]
8871 [(set_attr "type" "cmp,fast_compare,cmp")
8872 (set_attr "length" "4,4,8")])
8875 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
8876 (compare:CC (match_operand:P 1 "gpc_reg_operand" "")
8878 (set (match_operand:P 0 "gpc_reg_operand" "") (match_dup 1))]
8880 [(set (match_dup 0) (match_dup 1))
8882 (compare:CC (match_dup 0)
8886 (define_insn "*movhi_internal"
8887 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,m,r,r,*c*l,*h")
8888 (match_operand:HI 1 "input_operand" "r,m,r,i,*h,r,0"))]
8889 "gpc_reg_operand (operands[0], HImode)
8890 || gpc_reg_operand (operands[1], HImode)"
8899 [(set_attr "type" "*,load,store,*,mfjmpr,mtjmpr,*")])
8901 (define_expand "mov<mode>"
8902 [(set (match_operand:INT 0 "general_operand" "")
8903 (match_operand:INT 1 "any_operand" ""))]
8905 "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
8907 (define_insn "*movqi_internal"
8908 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,m,r,r,*c*l,*h")
8909 (match_operand:QI 1 "input_operand" "r,m,r,i,*h,r,0"))]
8910 "gpc_reg_operand (operands[0], QImode)
8911 || gpc_reg_operand (operands[1], QImode)"
8920 [(set_attr "type" "*,load,store,*,mfjmpr,mtjmpr,*")])
8922 ;; Here is how to move condition codes around. When we store CC data in
8923 ;; an integer register or memory, we store just the high-order 4 bits.
8924 ;; This lets us not shift in the most common case of CR0.
8925 (define_expand "movcc"
8926 [(set (match_operand:CC 0 "nonimmediate_operand" "")
8927 (match_operand:CC 1 "nonimmediate_operand" ""))]
8931 (define_insn "*movcc_internal1"
8932 [(set (match_operand:CC 0 "nonimmediate_operand" "=y,x,?y,y,r,r,r,r,r,cl,r,m")
8933 (match_operand:CC 1 "general_operand" "y,r,r,O,x,y,r,I,h,r,m,r"))]
8934 "register_operand (operands[0], CCmode)
8935 || register_operand (operands[1], CCmode)"
8939 rlwinm %1,%1,%F0,0xffffffff\;mtcrf %R0,%1\;rlwinm %1,%1,%f0,0xffffffff
8942 mfcr %0%Q1\;rlwinm %0,%0,%f1,0xf0000000
8950 (cond [(eq_attr "alternative" "0,3")
8951 (const_string "cr_logical")
8952 (eq_attr "alternative" "1,2")
8953 (const_string "mtcr")
8954 (eq_attr "alternative" "6,7")
8955 (const_string "integer")
8956 (eq_attr "alternative" "8")
8957 (const_string "mfjmpr")
8958 (eq_attr "alternative" "9")
8959 (const_string "mtjmpr")
8960 (eq_attr "alternative" "10")
8961 (const_string "load")
8962 (eq_attr "alternative" "11")
8963 (const_string "store")
8964 (match_test "TARGET_MFCRF")
8965 (const_string "mfcrf")
8967 (const_string "mfcr")))
8968 (set_attr "length" "4,4,12,4,4,8,4,4,4,4,4,4")])
8970 ;; For floating-point, we normally deal with the floating-point registers
8971 ;; unless -msoft-float is used. The sole exception is that parameter passing
8972 ;; can produce floating-point values in fixed-point registers. Unless the
8973 ;; value is a simple constant or already in memory, we deal with this by
8974 ;; allocating memory and copying the value explicitly via that memory location.
8976 ;; Move 32-bit binary/decimal floating point
8977 (define_expand "mov<mode>"
8978 [(set (match_operand:FMOVE32 0 "nonimmediate_operand" "")
8979 (match_operand:FMOVE32 1 "any_operand" ""))]
8981 "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
8984 [(set (match_operand:FMOVE32 0 "gpc_reg_operand" "")
8985 (match_operand:FMOVE32 1 "const_double_operand" ""))]
8987 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8988 || (GET_CODE (operands[0]) == SUBREG
8989 && GET_CODE (SUBREG_REG (operands[0])) == REG
8990 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8991 [(set (match_dup 2) (match_dup 3))]
8997 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8998 <real_value_to_target> (rv, l);
9000 if (! TARGET_POWERPC64)
9001 operands[2] = operand_subword (operands[0], 0, 0, <MODE>mode);
9003 operands[2] = gen_lowpart (SImode, operands[0]);
9005 operands[3] = gen_int_mode (l, SImode);
9008 (define_insn "mov<mode>_hardfloat"
9009 [(set (match_operand:FMOVE32 0 "nonimmediate_operand" "=!r,!r,m,f,wa,wa,<f32_lr>,<f32_sm>,wu,Z,?<f32_dm>,?r,*c*l,!r,*h,!r,!r")
9010 (match_operand:FMOVE32 1 "input_operand" "r,m,r,f,wa,j,<f32_lm>,<f32_sr>,Z,wu,r,<f32_dm>,r,h,0,G,Fn"))]
9011 "(gpc_reg_operand (operands[0], <MODE>mode)
9012 || gpc_reg_operand (operands[1], <MODE>mode))
9013 && (TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT)"
9032 [(set_attr "type" "*,load,store,fp,vecsimple,vecsimple,fpload,fpstore,fpload,fpstore,mftgpr,mffgpr,mtjmpr,mfjmpr,*,*,*")
9033 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,8")])
9035 (define_insn "*mov<mode>_softfloat"
9036 [(set (match_operand:FMOVE32 0 "nonimmediate_operand" "=r,cl,r,r,m,r,r,r,r,*h")
9037 (match_operand:FMOVE32 1 "input_operand" "r,r,h,m,r,I,L,G,Fn,0"))]
9038 "(gpc_reg_operand (operands[0], <MODE>mode)
9039 || gpc_reg_operand (operands[1], <MODE>mode))
9040 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)"
9052 [(set_attr "type" "*,mtjmpr,mfjmpr,load,store,*,*,*,*,*")
9053 (set_attr "length" "4,4,4,4,4,4,4,4,8,4")])
9056 ;; Move 64-bit binary/decimal floating point
9057 (define_expand "mov<mode>"
9058 [(set (match_operand:FMOVE64 0 "nonimmediate_operand" "")
9059 (match_operand:FMOVE64 1 "any_operand" ""))]
9061 "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
9064 [(set (match_operand:FMOVE64 0 "gpc_reg_operand" "")
9065 (match_operand:FMOVE64 1 "const_int_operand" ""))]
9066 "! TARGET_POWERPC64 && reload_completed
9067 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
9068 || (GET_CODE (operands[0]) == SUBREG
9069 && GET_CODE (SUBREG_REG (operands[0])) == REG
9070 && REGNO (SUBREG_REG (operands[0])) <= 31))"
9071 [(set (match_dup 2) (match_dup 4))
9072 (set (match_dup 3) (match_dup 1))]
9075 int endian = (WORDS_BIG_ENDIAN == 0);
9076 HOST_WIDE_INT value = INTVAL (operands[1]);
9078 operands[2] = operand_subword (operands[0], endian, 0, <MODE>mode);
9079 operands[3] = operand_subword (operands[0], 1 - endian, 0, <MODE>mode);
9080 operands[4] = GEN_INT (value >> 32);
9081 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
9085 [(set (match_operand:FMOVE64 0 "gpc_reg_operand" "")
9086 (match_operand:FMOVE64 1 "const_double_operand" ""))]
9087 "! TARGET_POWERPC64 && reload_completed
9088 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
9089 || (GET_CODE (operands[0]) == SUBREG
9090 && GET_CODE (SUBREG_REG (operands[0])) == REG
9091 && REGNO (SUBREG_REG (operands[0])) <= 31))"
9092 [(set (match_dup 2) (match_dup 4))
9093 (set (match_dup 3) (match_dup 5))]
9096 int endian = (WORDS_BIG_ENDIAN == 0);
9100 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
9101 <real_value_to_target> (rv, l);
9103 operands[2] = operand_subword (operands[0], endian, 0, <MODE>mode);
9104 operands[3] = operand_subword (operands[0], 1 - endian, 0, <MODE>mode);
9105 operands[4] = gen_int_mode (l[endian], SImode);
9106 operands[5] = gen_int_mode (l[1 - endian], SImode);
9110 [(set (match_operand:FMOVE64 0 "gpc_reg_operand" "")
9111 (match_operand:FMOVE64 1 "const_double_operand" ""))]
9112 "TARGET_POWERPC64 && reload_completed
9113 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
9114 || (GET_CODE (operands[0]) == SUBREG
9115 && GET_CODE (SUBREG_REG (operands[0])) == REG
9116 && REGNO (SUBREG_REG (operands[0])) <= 31))"
9117 [(set (match_dup 2) (match_dup 3))]
9120 int endian = (WORDS_BIG_ENDIAN == 0);
9125 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
9126 <real_value_to_target> (rv, l);
9128 operands[2] = gen_lowpart (DImode, operands[0]);
9129 /* HIGHPART is lower memory address when WORDS_BIG_ENDIAN. */
9130 val = ((HOST_WIDE_INT)(unsigned long)l[endian] << 32
9131 | ((HOST_WIDE_INT)(unsigned long)l[1 - endian]));
9133 operands[3] = gen_int_mode (val, DImode);
9136 ;; Don't have reload use general registers to load a constant. It is
9137 ;; less efficient than loading the constant into an FP register, since
9138 ;; it will probably be used there.
9140 ;; The move constraints are ordered to prefer floating point registers before
9141 ;; general purpose registers to avoid doing a store and a load to get the value
9142 ;; into a floating point register when it is needed for a floating point
9143 ;; operation. Prefer traditional floating point registers over VSX registers,
9144 ;; since the D-form version of the memory instructions does not need a GPR for
9147 (define_insn "*mov<mode>_hardfloat32"
9148 [(set (match_operand:FMOVE64 0 "nonimmediate_operand" "=m,d,d,wv,Z,wa,wa,Y,r,!r,!r,!r,!r")
9149 (match_operand:FMOVE64 1 "input_operand" "d,m,d,Z,wv,wa,j,r,Y,r,G,H,F"))]
9150 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9151 && (gpc_reg_operand (operands[0], <MODE>mode)
9152 || gpc_reg_operand (operands[1], <MODE>mode))"
9167 [(set_attr "type" "fpstore,fpload,fp,fpload,fpstore,vecsimple,vecsimple,store,load,two,fp,fp,*")
9168 (set_attr "length" "4,4,4,4,4,4,4,8,8,8,8,12,16")])
9170 (define_insn "*mov<mode>_softfloat32"
9171 [(set (match_operand:FMOVE64 0 "nonimmediate_operand" "=Y,r,r,r,r,r")
9172 (match_operand:FMOVE64 1 "input_operand" "r,Y,r,G,H,F"))]
9174 && ((TARGET_FPRS && TARGET_SINGLE_FLOAT)
9175 || TARGET_SOFT_FLOAT || TARGET_E500_SINGLE
9176 || (<MODE>mode == DDmode && TARGET_E500_DOUBLE))
9177 && (gpc_reg_operand (operands[0], <MODE>mode)
9178 || gpc_reg_operand (operands[1], <MODE>mode))"
9180 [(set_attr "type" "store,load,two,*,*,*")
9181 (set_attr "length" "8,8,8,8,12,16")])
9183 ; ld/std require word-aligned displacements -> 'Y' constraint.
9184 ; List Y->r and r->Y before r->r for reload.
9185 (define_insn "*mov<mode>_hardfloat64"
9186 [(set (match_operand:FMOVE64 0 "nonimmediate_operand" "=m,d,d,wv,Z,wa,wa,Y,r,!r,*c*l,!r,*h,!r,!r,!r,r,wg,r,wm")
9187 (match_operand:FMOVE64 1 "input_operand" "d,m,d,Z,wv,wa,j,r,Y,r,r,h,0,G,H,F,wg,r,wm,r"))]
9188 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9189 && (gpc_reg_operand (operands[0], <MODE>mode)
9190 || gpc_reg_operand (operands[1], <MODE>mode))"
9212 [(set_attr "type" "fpstore,fpload,fp,fpload,fpstore,vecsimple,vecsimple,store,load,*,mtjmpr,mfjmpr,*,*,*,*,mftgpr,mffgpr,mftgpr,mffgpr")
9213 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4,4,8,12,16,4,4,4,4")])
9215 (define_insn "*mov<mode>_softfloat64"
9216 [(set (match_operand:FMOVE64 0 "nonimmediate_operand" "=Y,r,r,cl,r,r,r,r,*h")
9217 (match_operand:FMOVE64 1 "input_operand" "r,Y,r,r,h,G,H,F,0"))]
9218 "TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)
9219 && (gpc_reg_operand (operands[0], <MODE>mode)
9220 || gpc_reg_operand (operands[1], <MODE>mode))"
9231 [(set_attr "type" "store,load,*,mtjmpr,mfjmpr,*,*,*,*")
9232 (set_attr "length" "4,4,4,4,4,8,12,16,4")])
9234 (define_expand "mov<mode>"
9235 [(set (match_operand:FMOVE128 0 "general_operand" "")
9236 (match_operand:FMOVE128 1 "any_operand" ""))]
9238 "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
9240 ;; It's important to list Y->r and r->Y before r->r because otherwise
9241 ;; reload, given m->r, will try to pick r->r and reload it, which
9242 ;; doesn't make progress.
9244 ;; We can't split little endian direct moves of TDmode, because the words are
9245 ;; not swapped like they are for TImode or TFmode. Subregs therefore are
9246 ;; problematical. Don't allow direct move for this case.
9248 (define_insn_and_split "*mov<mode>_64bit_dm"
9249 [(set (match_operand:FMOVE128 0 "nonimmediate_operand" "=m,d,d,Y,r,r,r,wm")
9250 (match_operand:FMOVE128 1 "input_operand" "d,m,d,r,YGHF,r,wm,r"))]
9251 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_POWERPC64
9252 && (<MODE>mode != TDmode || WORDS_BIG_ENDIAN)
9253 && (gpc_reg_operand (operands[0], <MODE>mode)
9254 || gpc_reg_operand (operands[1], <MODE>mode))"
9256 "&& reload_completed"
9258 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
9259 [(set_attr "length" "8,8,8,12,12,8,8,8")])
9261 (define_insn_and_split "*movtd_64bit_nodm"
9262 [(set (match_operand:TD 0 "nonimmediate_operand" "=m,d,d,Y,r,r")
9263 (match_operand:TD 1 "input_operand" "d,m,d,r,YGHF,r"))]
9264 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_POWERPC64 && !WORDS_BIG_ENDIAN
9265 && (gpc_reg_operand (operands[0], TDmode)
9266 || gpc_reg_operand (operands[1], TDmode))"
9268 "&& reload_completed"
9270 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
9271 [(set_attr "length" "8,8,8,12,12,8")])
9273 (define_insn_and_split "*mov<mode>_32bit"
9274 [(set (match_operand:FMOVE128 0 "nonimmediate_operand" "=m,d,d,Y,r,r")
9275 (match_operand:FMOVE128 1 "input_operand" "d,m,d,r,YGHF,r"))]
9276 "TARGET_HARD_FLOAT && TARGET_FPRS && !TARGET_POWERPC64
9277 && (gpc_reg_operand (operands[0], <MODE>mode)
9278 || gpc_reg_operand (operands[1], <MODE>mode))"
9280 "&& reload_completed"
9282 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
9283 [(set_attr "length" "8,8,8,20,20,16")])
9285 (define_insn_and_split "*mov<mode>_softfloat"
9286 [(set (match_operand:FMOVE128 0 "rs6000_nonimmediate_operand" "=Y,r,r")
9287 (match_operand:FMOVE128 1 "input_operand" "r,YGHF,r"))]
9288 "(TARGET_SOFT_FLOAT || !TARGET_FPRS)
9289 && (gpc_reg_operand (operands[0], <MODE>mode)
9290 || gpc_reg_operand (operands[1], <MODE>mode))"
9292 "&& reload_completed"
9294 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
9295 [(set_attr "length" "20,20,16")])
9297 (define_expand "extenddftf2"
9298 [(set (match_operand:TF 0 "nonimmediate_operand" "")
9299 (float_extend:TF (match_operand:DF 1 "input_operand" "")))]
9301 && TARGET_HARD_FLOAT
9302 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9303 && TARGET_LONG_DOUBLE_128"
9305 if (TARGET_E500_DOUBLE)
9306 emit_insn (gen_spe_extenddftf2 (operands[0], operands[1]));
9308 emit_insn (gen_extenddftf2_fprs (operands[0], operands[1]));
9312 (define_expand "extenddftf2_fprs"
9313 [(parallel [(set (match_operand:TF 0 "nonimmediate_operand" "")
9314 (float_extend:TF (match_operand:DF 1 "input_operand" "")))
9315 (use (match_dup 2))])]
9317 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9318 && TARGET_LONG_DOUBLE_128"
9320 operands[2] = CONST0_RTX (DFmode);
9321 /* Generate GOT reference early for SVR4 PIC. */
9322 if (DEFAULT_ABI == ABI_V4 && flag_pic)
9323 operands[2] = validize_mem (force_const_mem (DFmode, operands[2]));
9326 (define_insn_and_split "*extenddftf2_internal"
9327 [(set (match_operand:TF 0 "nonimmediate_operand" "=m,Y,d,&d,r")
9328 (float_extend:TF (match_operand:DF 1 "input_operand" "d,r,md,md,rmGHF")))
9329 (use (match_operand:DF 2 "zero_reg_mem_operand" "d,r,m,d,n"))]
9331 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9332 && TARGET_LONG_DOUBLE_128"
9334 "&& reload_completed"
9337 const int lo_word = LONG_DOUBLE_LARGE_FIRST ? GET_MODE_SIZE (DFmode) : 0;
9338 const int hi_word = LONG_DOUBLE_LARGE_FIRST ? 0 : GET_MODE_SIZE (DFmode);
9339 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word),
9341 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word),
9346 (define_expand "extendsftf2"
9347 [(set (match_operand:TF 0 "nonimmediate_operand" "")
9348 (float_extend:TF (match_operand:SF 1 "gpc_reg_operand" "")))]
9350 && TARGET_HARD_FLOAT
9351 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9352 && TARGET_LONG_DOUBLE_128"
9354 rtx tmp = gen_reg_rtx (DFmode);
9355 emit_insn (gen_extendsfdf2 (tmp, operands[1]));
9356 emit_insn (gen_extenddftf2 (operands[0], tmp));
9360 (define_expand "trunctfdf2"
9361 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9362 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "")))]
9364 && TARGET_HARD_FLOAT
9365 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9366 && TARGET_LONG_DOUBLE_128"
9369 (define_insn_and_split "trunctfdf2_internal1"
9370 [(set (match_operand:DF 0 "gpc_reg_operand" "=d,?d")
9371 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "0,d")))]
9372 "!TARGET_IEEEQUAD && !TARGET_XL_COMPAT
9373 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9377 "&& reload_completed && REGNO (operands[0]) == REGNO (operands[1])"
9380 emit_note (NOTE_INSN_DELETED);
9383 [(set_attr "type" "fp")])
9385 (define_insn "trunctfdf2_internal2"
9386 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
9387 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "d")))]
9388 "!TARGET_IEEEQUAD && TARGET_XL_COMPAT
9389 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9390 && TARGET_LONG_DOUBLE_128"
9392 [(set_attr "type" "fp")
9393 (set_attr "fp_type" "fp_addsub_d")])
9395 (define_expand "trunctfsf2"
9396 [(set (match_operand:SF 0 "gpc_reg_operand" "")
9397 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "")))]
9399 && TARGET_HARD_FLOAT
9400 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9401 && TARGET_LONG_DOUBLE_128"
9403 if (TARGET_E500_DOUBLE)
9404 emit_insn (gen_spe_trunctfsf2 (operands[0], operands[1]));
9406 emit_insn (gen_trunctfsf2_fprs (operands[0], operands[1]));
9410 (define_insn_and_split "trunctfsf2_fprs"
9411 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
9412 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "d")))
9413 (clobber (match_scratch:DF 2 "=d"))]
9415 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
9416 && TARGET_LONG_DOUBLE_128"
9418 "&& reload_completed"
9420 (float_truncate:DF (match_dup 1)))
9422 (float_truncate:SF (match_dup 2)))]
9425 (define_expand "floatsitf2"
9426 [(set (match_operand:TF 0 "gpc_reg_operand" "")
9427 (float:TF (match_operand:SI 1 "gpc_reg_operand" "")))]
9429 && TARGET_HARD_FLOAT
9430 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9431 && TARGET_LONG_DOUBLE_128"
9433 rtx tmp = gen_reg_rtx (DFmode);
9434 expand_float (tmp, operands[1], false);
9435 emit_insn (gen_extenddftf2 (operands[0], tmp));
9439 ; fadd, but rounding towards zero.
9440 ; This is probably not the optimal code sequence.
9441 (define_insn "fix_trunc_helper"
9442 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
9443 (unspec:DF [(match_operand:TF 1 "gpc_reg_operand" "d")]
9444 UNSPEC_FIX_TRUNC_TF))
9445 (clobber (match_operand:DF 2 "gpc_reg_operand" "=&d"))]
9446 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
9447 "mffs %2\n\tmtfsb1 31\n\tmtfsb0 30\n\tfadd %0,%1,%L1\n\tmtfsf 1,%2"
9448 [(set_attr "type" "fp")
9449 (set_attr "length" "20")])
9451 (define_expand "fix_trunctfsi2"
9452 [(set (match_operand:SI 0 "gpc_reg_operand" "")
9453 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))]
9454 "!TARGET_IEEEQUAD && TARGET_HARD_FLOAT
9455 && (TARGET_FPRS || TARGET_E500_DOUBLE) && TARGET_LONG_DOUBLE_128"
9457 if (TARGET_E500_DOUBLE)
9458 emit_insn (gen_spe_fix_trunctfsi2 (operands[0], operands[1]));
9460 emit_insn (gen_fix_trunctfsi2_fprs (operands[0], operands[1]));
9464 (define_expand "fix_trunctfsi2_fprs"
9465 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
9466 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))
9467 (clobber (match_dup 2))
9468 (clobber (match_dup 3))
9469 (clobber (match_dup 4))
9470 (clobber (match_dup 5))])]
9472 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9474 operands[2] = gen_reg_rtx (DFmode);
9475 operands[3] = gen_reg_rtx (DFmode);
9476 operands[4] = gen_reg_rtx (DImode);
9477 operands[5] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode));
9480 (define_insn_and_split "*fix_trunctfsi2_internal"
9481 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9482 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "d")))
9483 (clobber (match_operand:DF 2 "gpc_reg_operand" "=d"))
9484 (clobber (match_operand:DF 3 "gpc_reg_operand" "=&d"))
9485 (clobber (match_operand:DI 4 "gpc_reg_operand" "=d"))
9486 (clobber (match_operand:DI 5 "offsettable_mem_operand" "=o"))]
9488 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9494 emit_insn (gen_fix_trunc_helper (operands[2], operands[1], operands[3]));
9496 gcc_assert (MEM_P (operands[5]));
9497 lowword = adjust_address (operands[5], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
9499 emit_insn (gen_fctiwz_df (operands[4], operands[2]));
9500 emit_move_insn (operands[5], operands[4]);
9501 emit_move_insn (operands[0], lowword);
9505 (define_expand "negtf2"
9506 [(set (match_operand:TF 0 "gpc_reg_operand" "")
9507 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "")))]
9509 && TARGET_HARD_FLOAT
9510 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9511 && TARGET_LONG_DOUBLE_128"
9514 (define_insn "negtf2_internal"
9515 [(set (match_operand:TF 0 "gpc_reg_operand" "=d")
9516 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "d")))]
9518 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9521 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
9522 return \"fneg %L0,%L1\;fneg %0,%1\";
9524 return \"fneg %0,%1\;fneg %L0,%L1\";
9526 [(set_attr "type" "fp")
9527 (set_attr "length" "8")])
9529 (define_expand "abstf2"
9530 [(set (match_operand:TF 0 "gpc_reg_operand" "")
9531 (abs:TF (match_operand:TF 1 "gpc_reg_operand" "")))]
9533 && TARGET_HARD_FLOAT
9534 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9535 && TARGET_LONG_DOUBLE_128"
9538 rtx label = gen_label_rtx ();
9539 if (TARGET_E500_DOUBLE)
9541 if (flag_finite_math_only && !flag_trapping_math)
9542 emit_insn (gen_spe_abstf2_tst (operands[0], operands[1], label));
9544 emit_insn (gen_spe_abstf2_cmp (operands[0], operands[1], label));
9547 emit_insn (gen_abstf2_internal (operands[0], operands[1], label));
9552 (define_expand "abstf2_internal"
9553 [(set (match_operand:TF 0 "gpc_reg_operand" "")
9554 (match_operand:TF 1 "gpc_reg_operand" ""))
9555 (set (match_dup 3) (match_dup 5))
9556 (set (match_dup 5) (abs:DF (match_dup 5)))
9557 (set (match_dup 4) (compare:CCFP (match_dup 3) (match_dup 5)))
9558 (set (pc) (if_then_else (eq (match_dup 4) (const_int 0))
9559 (label_ref (match_operand 2 "" ""))
9561 (set (match_dup 6) (neg:DF (match_dup 6)))]
9563 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9564 && TARGET_LONG_DOUBLE_128"
9567 const int hi_word = LONG_DOUBLE_LARGE_FIRST ? 0 : GET_MODE_SIZE (DFmode);
9568 const int lo_word = LONG_DOUBLE_LARGE_FIRST ? GET_MODE_SIZE (DFmode) : 0;
9569 operands[3] = gen_reg_rtx (DFmode);
9570 operands[4] = gen_reg_rtx (CCFPmode);
9571 operands[5] = simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word);
9572 operands[6] = simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word);
9575 ;; Reload helper functions used by rs6000_secondary_reload. The patterns all
9576 ;; must have 3 arguments, and scratch register constraint must be a single
9579 ;; Reload patterns to support gpr load/store with misaligned mem.
9580 ;; and multiple gpr load/store at offset >= 0xfffc
9581 (define_expand "reload_<mode>_store"
9582 [(parallel [(match_operand 0 "memory_operand" "=m")
9583 (match_operand 1 "gpc_reg_operand" "r")
9584 (match_operand:GPR 2 "register_operand" "=&b")])]
9587 rs6000_secondary_reload_gpr (operands[1], operands[0], operands[2], true);
9591 (define_expand "reload_<mode>_load"
9592 [(parallel [(match_operand 0 "gpc_reg_operand" "=r")
9593 (match_operand 1 "memory_operand" "m")
9594 (match_operand:GPR 2 "register_operand" "=b")])]
9597 rs6000_secondary_reload_gpr (operands[0], operands[1], operands[2], false);
9602 ;; Power8 merge instructions to allow direct move to/from floating point
9603 ;; registers in 32-bit mode. We use TF mode to get two registers to move the
9604 ;; individual 32-bit parts across. Subreg doesn't work too well on the TF
9605 ;; value, since it is allocated in reload and not all of the flow information
9606 ;; is setup for it. We have two patterns to do the two moves between gprs and
9607 ;; fprs. There isn't a dependancy between the two, but we could potentially
9608 ;; schedule other instructions between the two instructions. TFmode is
9609 ;; currently limited to traditional FPR registers. If/when this is changed, we
9610 ;; will need to revist %L to make sure it works with VSX registers, or add an
9611 ;; %x version of %L.
9613 (define_insn "p8_fmrgow_<mode>"
9614 [(set (match_operand:FMOVE64X 0 "register_operand" "=d")
9615 (unspec:FMOVE64X [(match_operand:TF 1 "register_operand" "d")]
9616 UNSPEC_P8V_FMRGOW))]
9617 "!TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9619 [(set_attr "type" "vecperm")])
9621 (define_insn "p8_mtvsrwz_1"
9622 [(set (match_operand:TF 0 "register_operand" "=d")
9623 (unspec:TF [(match_operand:SI 1 "register_operand" "r")]
9624 UNSPEC_P8V_MTVSRWZ))]
9625 "!TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9627 [(set_attr "type" "mftgpr")])
9629 (define_insn "p8_mtvsrwz_2"
9630 [(set (match_operand:TF 0 "register_operand" "+d")
9631 (unspec:TF [(match_dup 0)
9632 (match_operand:SI 1 "register_operand" "r")]
9633 UNSPEC_P8V_MTVSRWZ))]
9634 "!TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9636 [(set_attr "type" "mftgpr")])
9638 (define_insn_and_split "reload_fpr_from_gpr<mode>"
9639 [(set (match_operand:FMOVE64X 0 "register_operand" "=ws")
9640 (unspec:FMOVE64X [(match_operand:FMOVE64X 1 "register_operand" "r")]
9641 UNSPEC_P8V_RELOAD_FROM_GPR))
9642 (clobber (match_operand:TF 2 "register_operand" "=d"))]
9643 "!TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9645 "&& reload_completed"
9648 rtx dest = operands[0];
9649 rtx src = operands[1];
9650 rtx tmp = operands[2];
9651 rtx gpr_hi_reg = gen_highpart (SImode, src);
9652 rtx gpr_lo_reg = gen_lowpart (SImode, src);
9654 emit_insn (gen_p8_mtvsrwz_1 (tmp, gpr_hi_reg));
9655 emit_insn (gen_p8_mtvsrwz_2 (tmp, gpr_lo_reg));
9656 emit_insn (gen_p8_fmrgow_<mode> (dest, tmp));
9659 [(set_attr "length" "12")
9660 (set_attr "type" "three")])
9662 ;; Move 128 bit values from GPRs to VSX registers in 64-bit mode
9663 (define_insn "p8_mtvsrd_1"
9664 [(set (match_operand:TF 0 "register_operand" "=ws")
9665 (unspec:TF [(match_operand:DI 1 "register_operand" "r")]
9666 UNSPEC_P8V_MTVSRD))]
9667 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9669 [(set_attr "type" "mftgpr")])
9671 (define_insn "p8_mtvsrd_2"
9672 [(set (match_operand:TF 0 "register_operand" "+ws")
9673 (unspec:TF [(match_dup 0)
9674 (match_operand:DI 1 "register_operand" "r")]
9675 UNSPEC_P8V_MTVSRD))]
9676 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9678 [(set_attr "type" "mftgpr")])
9680 (define_insn "p8_xxpermdi_<mode>"
9681 [(set (match_operand:FMOVE128_GPR 0 "register_operand" "=wa")
9682 (unspec:FMOVE128_GPR [(match_operand:TF 1 "register_operand" "ws")]
9683 UNSPEC_P8V_XXPERMDI))]
9684 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9685 "xxpermdi %x0,%1,%L1,0"
9686 [(set_attr "type" "vecperm")])
9688 (define_insn_and_split "reload_vsx_from_gpr<mode>"
9689 [(set (match_operand:FMOVE128_GPR 0 "register_operand" "=wa")
9690 (unspec:FMOVE128_GPR
9691 [(match_operand:FMOVE128_GPR 1 "register_operand" "r")]
9692 UNSPEC_P8V_RELOAD_FROM_GPR))
9693 (clobber (match_operand:TF 2 "register_operand" "=ws"))]
9694 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9696 "&& reload_completed"
9699 rtx dest = operands[0];
9700 rtx src = operands[1];
9701 rtx tmp = operands[2];
9702 rtx gpr_hi_reg = gen_highpart (DImode, src);
9703 rtx gpr_lo_reg = gen_lowpart (DImode, src);
9705 emit_insn (gen_p8_mtvsrd_1 (tmp, gpr_hi_reg));
9706 emit_insn (gen_p8_mtvsrd_2 (tmp, gpr_lo_reg));
9707 emit_insn (gen_p8_xxpermdi_<mode> (dest, tmp));
9709 [(set_attr "length" "12")
9710 (set_attr "type" "three")])
9713 [(set (match_operand:FMOVE128_GPR 0 "nonimmediate_operand" "")
9714 (match_operand:FMOVE128_GPR 1 "input_operand" ""))]
9716 && (int_reg_operand (operands[0], <MODE>mode)
9717 || int_reg_operand (operands[1], <MODE>mode))"
9719 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
9721 ;; Move SFmode to a VSX from a GPR register. Because scalar floating point
9722 ;; type is stored internally as double precision in the VSX registers, we have
9723 ;; to convert it from the vector format.
9725 (define_insn_and_split "reload_vsx_from_gprsf"
9726 [(set (match_operand:SF 0 "register_operand" "=wa")
9727 (unspec:SF [(match_operand:SF 1 "register_operand" "r")]
9728 UNSPEC_P8V_RELOAD_FROM_GPR))
9729 (clobber (match_operand:DI 2 "register_operand" "=r"))]
9730 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9732 "&& reload_completed"
9735 rtx op0 = operands[0];
9736 rtx op1 = operands[1];
9737 rtx op2 = operands[2];
9738 /* Also use the destination register to hold the unconverted DImode value.
9739 This is conceptually a separate value from OP0, so we use gen_rtx_REG
9740 rather than simplify_gen_subreg. */
9741 rtx op0_di = gen_rtx_REG (DImode, REGNO (op0));
9742 rtx op1_di = simplify_gen_subreg (DImode, op1, SFmode, 0);
9744 /* Move SF value to upper 32-bits for xscvspdpn. */
9745 emit_insn (gen_ashldi3 (op2, op1_di, GEN_INT (32)));
9746 emit_move_insn (op0_di, op2);
9747 emit_insn (gen_vsx_xscvspdpn_directmove (op0, op0_di));
9750 [(set_attr "length" "8")
9751 (set_attr "type" "two")])
9753 ;; Move 128 bit values from VSX registers to GPRs in 64-bit mode by doing a
9754 ;; normal 64-bit move, followed by an xxpermdi to get the bottom 64-bit value,
9755 ;; and then doing a move of that.
9756 (define_insn "p8_mfvsrd_3_<mode>"
9757 [(set (match_operand:DF 0 "register_operand" "=r")
9758 (unspec:DF [(match_operand:FMOVE128_GPR 1 "register_operand" "wa")]
9759 UNSPEC_P8V_RELOAD_FROM_VSX))]
9760 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9762 [(set_attr "type" "mftgpr")])
9764 (define_insn_and_split "reload_gpr_from_vsx<mode>"
9765 [(set (match_operand:FMOVE128_GPR 0 "register_operand" "=r")
9766 (unspec:FMOVE128_GPR
9767 [(match_operand:FMOVE128_GPR 1 "register_operand" "wa")]
9768 UNSPEC_P8V_RELOAD_FROM_VSX))
9769 (clobber (match_operand:FMOVE128_GPR 2 "register_operand" "=wa"))]
9770 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9772 "&& reload_completed"
9775 rtx dest = operands[0];
9776 rtx src = operands[1];
9777 rtx tmp = operands[2];
9778 rtx gpr_hi_reg = gen_highpart (DFmode, dest);
9779 rtx gpr_lo_reg = gen_lowpart (DFmode, dest);
9781 emit_insn (gen_p8_mfvsrd_3_<mode> (gpr_hi_reg, src));
9782 emit_insn (gen_vsx_xxpermdi_<mode> (tmp, src, src, GEN_INT (3)));
9783 emit_insn (gen_p8_mfvsrd_3_<mode> (gpr_lo_reg, tmp));
9785 [(set_attr "length" "12")
9786 (set_attr "type" "three")])
9788 ;; Move SFmode to a GPR from a VSX register. Because scalar floating point
9789 ;; type is stored internally as double precision, we have to convert it to the
9792 (define_insn_and_split "reload_gpr_from_vsxsf"
9793 [(set (match_operand:SF 0 "register_operand" "=r")
9794 (unspec:SF [(match_operand:SF 1 "register_operand" "wa")]
9795 UNSPEC_P8V_RELOAD_FROM_VSX))
9796 (clobber (match_operand:V4SF 2 "register_operand" "=wa"))]
9797 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9799 "&& reload_completed"
9802 rtx op0 = operands[0];
9803 rtx op1 = operands[1];
9804 rtx op2 = operands[2];
9805 rtx diop0 = simplify_gen_subreg (DImode, op0, SFmode, 0);
9807 emit_insn (gen_vsx_xscvdpspn_scalar (op2, op1));
9808 emit_insn (gen_p8_mfvsrd_4_disf (diop0, op2));
9809 emit_insn (gen_lshrdi3 (diop0, diop0, GEN_INT (32)));
9812 [(set_attr "length" "12")
9813 (set_attr "type" "three")])
9815 (define_insn "p8_mfvsrd_4_disf"
9816 [(set (match_operand:DI 0 "register_operand" "=r")
9817 (unspec:DI [(match_operand:V4SF 1 "register_operand" "wa")]
9818 UNSPEC_P8V_RELOAD_FROM_VSX))]
9819 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9821 [(set_attr "type" "mftgpr")])
9824 ;; Next come the multi-word integer load and store and the load and store
9827 ;; List r->r after r->Y, otherwise reload will try to reload a
9828 ;; non-offsettable address by using r->r which won't make progress.
9829 ;; Use of fprs is disparaged slightly otherwise reload prefers to reload
9830 ;; a gpr into a fpr instead of reloading an invalid 'Y' address
9831 (define_insn "*movdi_internal32"
9832 [(set (match_operand:DI 0 "rs6000_nonimmediate_operand" "=Y,r,r,?m,?*d,?*d,r")
9833 (match_operand:DI 1 "input_operand" "r,Y,r,d,m,d,IJKnGHF"))]
9835 && (gpc_reg_operand (operands[0], DImode)
9836 || gpc_reg_operand (operands[1], DImode))"
9845 [(set_attr "type" "store,load,*,fpstore,fpload,fp,*")])
9848 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9849 (match_operand:DI 1 "const_int_operand" ""))]
9850 "! TARGET_POWERPC64 && reload_completed
9851 && gpr_or_gpr_p (operands[0], operands[1])
9852 && !direct_move_p (operands[0], operands[1])"
9853 [(set (match_dup 2) (match_dup 4))
9854 (set (match_dup 3) (match_dup 1))]
9857 HOST_WIDE_INT value = INTVAL (operands[1]);
9858 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
9860 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
9862 operands[4] = GEN_INT (value >> 32);
9863 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
9867 [(set (match_operand:DIFD 0 "rs6000_nonimmediate_operand" "")
9868 (match_operand:DIFD 1 "input_operand" ""))]
9869 "reload_completed && !TARGET_POWERPC64
9870 && gpr_or_gpr_p (operands[0], operands[1])
9871 && !direct_move_p (operands[0], operands[1])"
9873 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
9875 (define_insn "*movdi_internal64"
9876 [(set (match_operand:DI 0 "nonimmediate_operand" "=Y,r,r,r,r,r,?m,?*d,?*d,r,*h,*h,r,?*wg,r,?*wm")
9877 (match_operand:DI 1 "input_operand" "r,Y,r,I,L,nF,d,m,d,*h,r,0,*wg,r,*wm,r"))]
9879 && (gpc_reg_operand (operands[0], DImode)
9880 || gpc_reg_operand (operands[1], DImode))"
9898 [(set_attr "type" "store,load,*,*,*,*,fpstore,fpload,fp,mfjmpr,mtjmpr,*,mftgpr,mffgpr,mftgpr,mffgpr")
9899 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4,4,4,4")])
9901 ;; Generate all one-bits and clear left or right.
9902 ;; Use (and:DI (rotate:DI ...)) to avoid anddi3 unnecessary clobber.
9904 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9905 (match_operand:DI 1 "mask64_operand" ""))]
9906 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
9907 [(set (match_dup 0) (const_int -1))
9909 (and:DI (rotate:DI (match_dup 0)
9914 ;; Split a load of a large constant into the appropriate five-instruction
9915 ;; sequence. Handle anything in a constant number of insns.
9916 ;; When non-easy constants can go in the TOC, this should use
9917 ;; easy_fp_constant predicate.
9919 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9920 (match_operand:DI 1 "const_int_operand" ""))]
9921 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
9922 [(set (match_dup 0) (match_dup 2))
9923 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
9925 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
9927 if (tem == operands[0])
9934 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9935 (match_operand:DI 1 "const_scalar_int_operand" ""))]
9936 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
9937 [(set (match_dup 0) (match_dup 2))
9938 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
9940 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
9942 if (tem == operands[0])
9948 ;; TImode/PTImode is similar, except that we usually want to compute the
9949 ;; address into a register and use lsi/stsi (the exception is during reload).
9951 (define_insn "*mov<mode>_string"
9952 [(set (match_operand:TI2 0 "reg_or_mem_operand" "=Q,Y,????r,????r,????r,r")
9953 (match_operand:TI2 1 "input_operand" "r,r,Q,Y,r,n"))]
9955 && (<MODE>mode != TImode || VECTOR_MEM_NONE_P (TImode))
9956 && (gpc_reg_operand (operands[0], <MODE>mode)
9957 || gpc_reg_operand (operands[1], <MODE>mode))"
9960 switch (which_alternative)
9966 return \"stswi %1,%P0,16\";
9970 /* If the address is not used in the output, we can use lsi. Otherwise,
9971 fall through to generating four loads. */
9973 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
9974 return \"lswi %0,%P1,16\";
9975 /* ... fall through ... */
9982 [(set_attr "type" "store,store,load,load,*,*")
9983 (set_attr "update" "yes")
9984 (set_attr "indexed" "yes")
9985 (set (attr "cell_micro") (if_then_else (match_test "TARGET_STRING")
9986 (const_string "always")
9987 (const_string "conditional")))])
9989 (define_insn "*mov<mode>_ppc64"
9990 [(set (match_operand:TI2 0 "nonimmediate_operand" "=wQ,Y,r,r,r,r")
9991 (match_operand:TI2 1 "input_operand" "r,r,wQ,Y,r,n"))]
9992 "(TARGET_POWERPC64 && VECTOR_MEM_NONE_P (<MODE>mode)
9993 && (gpc_reg_operand (operands[0], <MODE>mode)
9994 || gpc_reg_operand (operands[1], <MODE>mode)))"
9996 return rs6000_output_move_128bit (operands);
9998 [(set_attr "type" "store,store,load,load,*,*")
9999 (set_attr "length" "8")])
10002 [(set (match_operand:TI2 0 "int_reg_operand" "")
10003 (match_operand:TI2 1 "const_scalar_int_operand" ""))]
10005 && (VECTOR_MEM_NONE_P (<MODE>mode)
10006 || (reload_completed && INT_REGNO_P (REGNO (operands[0]))))"
10007 [(set (match_dup 2) (match_dup 4))
10008 (set (match_dup 3) (match_dup 5))]
10011 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
10013 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
10015 if (CONST_WIDE_INT_P (operands[1]))
10017 operands[4] = GEN_INT (CONST_WIDE_INT_ELT (operands[1], 1));
10018 operands[5] = GEN_INT (CONST_WIDE_INT_ELT (operands[1], 0));
10020 else if (CONST_INT_P (operands[1]))
10022 operands[4] = GEN_INT (- (INTVAL (operands[1]) < 0));
10023 operands[5] = operands[1];
10030 [(set (match_operand:TI2 0 "nonimmediate_operand" "")
10031 (match_operand:TI2 1 "input_operand" ""))]
10033 && gpr_or_gpr_p (operands[0], operands[1])
10034 && !direct_move_p (operands[0], operands[1])
10035 && !quad_load_store_p (operands[0], operands[1])"
10037 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
10039 (define_expand "load_multiple"
10040 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
10041 (match_operand:SI 1 "" ""))
10042 (use (match_operand:SI 2 "" ""))])]
10043 "TARGET_STRING && !TARGET_POWERPC64"
10051 /* Support only loading a constant number of fixed-point registers from
10052 memory and only bother with this if more than two; the machine
10053 doesn't support more than eight. */
10054 if (GET_CODE (operands[2]) != CONST_INT
10055 || INTVAL (operands[2]) <= 2
10056 || INTVAL (operands[2]) > 8
10057 || GET_CODE (operands[1]) != MEM
10058 || GET_CODE (operands[0]) != REG
10059 || REGNO (operands[0]) >= 32)
10062 count = INTVAL (operands[2]);
10063 regno = REGNO (operands[0]);
10065 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
10066 op1 = replace_equiv_address (operands[1],
10067 force_reg (SImode, XEXP (operands[1], 0)));
10069 for (i = 0; i < count; i++)
10070 XVECEXP (operands[3], 0, i)
10071 = gen_rtx_SET (VOIDmode, gen_rtx_REG (SImode, regno + i),
10072 adjust_address_nv (op1, SImode, i * 4));
10075 (define_insn "*ldmsi8"
10076 [(match_parallel 0 "load_multiple_operation"
10077 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10078 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10079 (set (match_operand:SI 3 "gpc_reg_operand" "")
10080 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10081 (set (match_operand:SI 4 "gpc_reg_operand" "")
10082 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
10083 (set (match_operand:SI 5 "gpc_reg_operand" "")
10084 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
10085 (set (match_operand:SI 6 "gpc_reg_operand" "")
10086 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
10087 (set (match_operand:SI 7 "gpc_reg_operand" "")
10088 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
10089 (set (match_operand:SI 8 "gpc_reg_operand" "")
10090 (mem:SI (plus:SI (match_dup 1) (const_int 24))))
10091 (set (match_operand:SI 9 "gpc_reg_operand" "")
10092 (mem:SI (plus:SI (match_dup 1) (const_int 28))))])]
10093 "TARGET_STRING && XVECLEN (operands[0], 0) == 8"
10095 { return rs6000_output_load_multiple (operands); }"
10096 [(set_attr "type" "load")
10097 (set_attr "update" "yes")
10098 (set_attr "indexed" "yes")
10099 (set_attr "length" "32")])
10101 (define_insn "*ldmsi7"
10102 [(match_parallel 0 "load_multiple_operation"
10103 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10104 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10105 (set (match_operand:SI 3 "gpc_reg_operand" "")
10106 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10107 (set (match_operand:SI 4 "gpc_reg_operand" "")
10108 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
10109 (set (match_operand:SI 5 "gpc_reg_operand" "")
10110 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
10111 (set (match_operand:SI 6 "gpc_reg_operand" "")
10112 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
10113 (set (match_operand:SI 7 "gpc_reg_operand" "")
10114 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
10115 (set (match_operand:SI 8 "gpc_reg_operand" "")
10116 (mem:SI (plus:SI (match_dup 1) (const_int 24))))])]
10117 "TARGET_STRING && XVECLEN (operands[0], 0) == 7"
10119 { return rs6000_output_load_multiple (operands); }"
10120 [(set_attr "type" "load")
10121 (set_attr "update" "yes")
10122 (set_attr "indexed" "yes")
10123 (set_attr "length" "32")])
10125 (define_insn "*ldmsi6"
10126 [(match_parallel 0 "load_multiple_operation"
10127 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10128 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10129 (set (match_operand:SI 3 "gpc_reg_operand" "")
10130 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10131 (set (match_operand:SI 4 "gpc_reg_operand" "")
10132 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
10133 (set (match_operand:SI 5 "gpc_reg_operand" "")
10134 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
10135 (set (match_operand:SI 6 "gpc_reg_operand" "")
10136 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
10137 (set (match_operand:SI 7 "gpc_reg_operand" "")
10138 (mem:SI (plus:SI (match_dup 1) (const_int 20))))])]
10139 "TARGET_STRING && XVECLEN (operands[0], 0) == 6"
10141 { return rs6000_output_load_multiple (operands); }"
10142 [(set_attr "type" "load")
10143 (set_attr "update" "yes")
10144 (set_attr "indexed" "yes")
10145 (set_attr "length" "32")])
10147 (define_insn "*ldmsi5"
10148 [(match_parallel 0 "load_multiple_operation"
10149 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10150 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10151 (set (match_operand:SI 3 "gpc_reg_operand" "")
10152 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10153 (set (match_operand:SI 4 "gpc_reg_operand" "")
10154 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
10155 (set (match_operand:SI 5 "gpc_reg_operand" "")
10156 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
10157 (set (match_operand:SI 6 "gpc_reg_operand" "")
10158 (mem:SI (plus:SI (match_dup 1) (const_int 16))))])]
10159 "TARGET_STRING && XVECLEN (operands[0], 0) == 5"
10161 { return rs6000_output_load_multiple (operands); }"
10162 [(set_attr "type" "load")
10163 (set_attr "update" "yes")
10164 (set_attr "indexed" "yes")
10165 (set_attr "length" "32")])
10167 (define_insn "*ldmsi4"
10168 [(match_parallel 0 "load_multiple_operation"
10169 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10170 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10171 (set (match_operand:SI 3 "gpc_reg_operand" "")
10172 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10173 (set (match_operand:SI 4 "gpc_reg_operand" "")
10174 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
10175 (set (match_operand:SI 5 "gpc_reg_operand" "")
10176 (mem:SI (plus:SI (match_dup 1) (const_int 12))))])]
10177 "TARGET_STRING && XVECLEN (operands[0], 0) == 4"
10179 { return rs6000_output_load_multiple (operands); }"
10180 [(set_attr "type" "load")
10181 (set_attr "update" "yes")
10182 (set_attr "indexed" "yes")
10183 (set_attr "length" "32")])
10185 (define_insn "*ldmsi3"
10186 [(match_parallel 0 "load_multiple_operation"
10187 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10188 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10189 (set (match_operand:SI 3 "gpc_reg_operand" "")
10190 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10191 (set (match_operand:SI 4 "gpc_reg_operand" "")
10192 (mem:SI (plus:SI (match_dup 1) (const_int 8))))])]
10193 "TARGET_STRING && XVECLEN (operands[0], 0) == 3"
10195 { return rs6000_output_load_multiple (operands); }"
10196 [(set_attr "type" "load")
10197 (set_attr "update" "yes")
10198 (set_attr "indexed" "yes")
10199 (set_attr "length" "32")])
10201 (define_expand "store_multiple"
10202 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
10203 (match_operand:SI 1 "" ""))
10204 (clobber (scratch:SI))
10205 (use (match_operand:SI 2 "" ""))])]
10206 "TARGET_STRING && !TARGET_POWERPC64"
10215 /* Support only storing a constant number of fixed-point registers to
10216 memory and only bother with this if more than two; the machine
10217 doesn't support more than eight. */
10218 if (GET_CODE (operands[2]) != CONST_INT
10219 || INTVAL (operands[2]) <= 2
10220 || INTVAL (operands[2]) > 8
10221 || GET_CODE (operands[0]) != MEM
10222 || GET_CODE (operands[1]) != REG
10223 || REGNO (operands[1]) >= 32)
10226 count = INTVAL (operands[2]);
10227 regno = REGNO (operands[1]);
10229 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count + 1));
10230 to = force_reg (SImode, XEXP (operands[0], 0));
10231 op0 = replace_equiv_address (operands[0], to);
10233 XVECEXP (operands[3], 0, 0)
10234 = gen_rtx_SET (VOIDmode, adjust_address_nv (op0, SImode, 0), operands[1]);
10235 XVECEXP (operands[3], 0, 1) = gen_rtx_CLOBBER (VOIDmode,
10236 gen_rtx_SCRATCH (SImode));
10238 for (i = 1; i < count; i++)
10239 XVECEXP (operands[3], 0, i + 1)
10240 = gen_rtx_SET (VOIDmode,
10241 adjust_address_nv (op0, SImode, i * 4),
10242 gen_rtx_REG (SImode, regno + i));
10245 (define_insn "*stmsi8"
10246 [(match_parallel 0 "store_multiple_operation"
10247 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10248 (match_operand:SI 2 "gpc_reg_operand" "r"))
10249 (clobber (match_scratch:SI 3 "=X"))
10250 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10251 (match_operand:SI 4 "gpc_reg_operand" "r"))
10252 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10253 (match_operand:SI 5 "gpc_reg_operand" "r"))
10254 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10255 (match_operand:SI 6 "gpc_reg_operand" "r"))
10256 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10257 (match_operand:SI 7 "gpc_reg_operand" "r"))
10258 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10259 (match_operand:SI 8 "gpc_reg_operand" "r"))
10260 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
10261 (match_operand:SI 9 "gpc_reg_operand" "r"))
10262 (set (mem:SI (plus:SI (match_dup 1) (const_int 28)))
10263 (match_operand:SI 10 "gpc_reg_operand" "r"))])]
10264 "TARGET_STRING && XVECLEN (operands[0], 0) == 9"
10266 [(set_attr "type" "store")
10267 (set_attr "update" "yes")
10268 (set_attr "indexed" "yes")
10269 (set_attr "cell_micro" "always")])
10271 (define_insn "*stmsi7"
10272 [(match_parallel 0 "store_multiple_operation"
10273 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10274 (match_operand:SI 2 "gpc_reg_operand" "r"))
10275 (clobber (match_scratch:SI 3 "=X"))
10276 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10277 (match_operand:SI 4 "gpc_reg_operand" "r"))
10278 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10279 (match_operand:SI 5 "gpc_reg_operand" "r"))
10280 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10281 (match_operand:SI 6 "gpc_reg_operand" "r"))
10282 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10283 (match_operand:SI 7 "gpc_reg_operand" "r"))
10284 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10285 (match_operand:SI 8 "gpc_reg_operand" "r"))
10286 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
10287 (match_operand:SI 9 "gpc_reg_operand" "r"))])]
10288 "TARGET_STRING && XVECLEN (operands[0], 0) == 8"
10290 [(set_attr "type" "store")
10291 (set_attr "update" "yes")
10292 (set_attr "indexed" "yes")
10293 (set_attr "cell_micro" "always")])
10295 (define_insn "*stmsi6"
10296 [(match_parallel 0 "store_multiple_operation"
10297 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10298 (match_operand:SI 2 "gpc_reg_operand" "r"))
10299 (clobber (match_scratch:SI 3 "=X"))
10300 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10301 (match_operand:SI 4 "gpc_reg_operand" "r"))
10302 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10303 (match_operand:SI 5 "gpc_reg_operand" "r"))
10304 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10305 (match_operand:SI 6 "gpc_reg_operand" "r"))
10306 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10307 (match_operand:SI 7 "gpc_reg_operand" "r"))
10308 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10309 (match_operand:SI 8 "gpc_reg_operand" "r"))])]
10310 "TARGET_STRING && XVECLEN (operands[0], 0) == 7"
10312 [(set_attr "type" "store")
10313 (set_attr "update" "yes")
10314 (set_attr "indexed" "yes")
10315 (set_attr "cell_micro" "always")])
10317 (define_insn "*stmsi5"
10318 [(match_parallel 0 "store_multiple_operation"
10319 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10320 (match_operand:SI 2 "gpc_reg_operand" "r"))
10321 (clobber (match_scratch:SI 3 "=X"))
10322 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10323 (match_operand:SI 4 "gpc_reg_operand" "r"))
10324 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10325 (match_operand:SI 5 "gpc_reg_operand" "r"))
10326 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10327 (match_operand:SI 6 "gpc_reg_operand" "r"))
10328 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10329 (match_operand:SI 7 "gpc_reg_operand" "r"))])]
10330 "TARGET_STRING && XVECLEN (operands[0], 0) == 6"
10332 [(set_attr "type" "store")
10333 (set_attr "update" "yes")
10334 (set_attr "indexed" "yes")
10335 (set_attr "cell_micro" "always")])
10337 (define_insn "*stmsi4"
10338 [(match_parallel 0 "store_multiple_operation"
10339 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10340 (match_operand:SI 2 "gpc_reg_operand" "r"))
10341 (clobber (match_scratch:SI 3 "=X"))
10342 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10343 (match_operand:SI 4 "gpc_reg_operand" "r"))
10344 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10345 (match_operand:SI 5 "gpc_reg_operand" "r"))
10346 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10347 (match_operand:SI 6 "gpc_reg_operand" "r"))])]
10348 "TARGET_STRING && XVECLEN (operands[0], 0) == 5"
10350 [(set_attr "type" "store")
10351 (set_attr "update" "yes")
10352 (set_attr "indexed" "yes")
10353 (set_attr "cell_micro" "always")])
10355 (define_insn "*stmsi3"
10356 [(match_parallel 0 "store_multiple_operation"
10357 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10358 (match_operand:SI 2 "gpc_reg_operand" "r"))
10359 (clobber (match_scratch:SI 3 "=X"))
10360 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10361 (match_operand:SI 4 "gpc_reg_operand" "r"))
10362 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10363 (match_operand:SI 5 "gpc_reg_operand" "r"))])]
10364 "TARGET_STRING && XVECLEN (operands[0], 0) == 4"
10366 [(set_attr "type" "store")
10367 (set_attr "update" "yes")
10368 (set_attr "indexed" "yes")
10369 (set_attr "cell_micro" "always")])
10371 (define_expand "setmemsi"
10372 [(parallel [(set (match_operand:BLK 0 "" "")
10373 (match_operand 2 "const_int_operand" ""))
10374 (use (match_operand:SI 1 "" ""))
10375 (use (match_operand:SI 3 "" ""))])]
10379 /* If value to set is not zero, use the library routine. */
10380 if (operands[2] != const0_rtx)
10383 if (expand_block_clear (operands))
10389 ;; String/block move insn.
10390 ;; Argument 0 is the destination
10391 ;; Argument 1 is the source
10392 ;; Argument 2 is the length
10393 ;; Argument 3 is the alignment
10395 (define_expand "movmemsi"
10396 [(parallel [(set (match_operand:BLK 0 "" "")
10397 (match_operand:BLK 1 "" ""))
10398 (use (match_operand:SI 2 "" ""))
10399 (use (match_operand:SI 3 "" ""))])]
10403 if (expand_block_move (operands))
10409 ;; Move up to 32 bytes at a time. The fixed registers are needed because the
10410 ;; register allocator doesn't have a clue about allocating 8 word registers.
10411 ;; rD/rS = r5 is preferred, efficient form.
10412 (define_expand "movmemsi_8reg"
10413 [(parallel [(set (match_operand 0 "" "")
10414 (match_operand 1 "" ""))
10415 (use (match_operand 2 "" ""))
10416 (use (match_operand 3 "" ""))
10417 (clobber (reg:SI 5))
10418 (clobber (reg:SI 6))
10419 (clobber (reg:SI 7))
10420 (clobber (reg:SI 8))
10421 (clobber (reg:SI 9))
10422 (clobber (reg:SI 10))
10423 (clobber (reg:SI 11))
10424 (clobber (reg:SI 12))
10425 (clobber (match_scratch:SI 4 ""))])]
10430 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
10431 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
10432 (use (match_operand:SI 2 "immediate_operand" "i"))
10433 (use (match_operand:SI 3 "immediate_operand" "i"))
10434 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10435 (clobber (reg:SI 6))
10436 (clobber (reg:SI 7))
10437 (clobber (reg:SI 8))
10438 (clobber (reg:SI 9))
10439 (clobber (reg:SI 10))
10440 (clobber (reg:SI 11))
10441 (clobber (reg:SI 12))
10442 (clobber (match_scratch:SI 5 "=X"))]
10444 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
10445 || INTVAL (operands[2]) == 0)
10446 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
10447 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
10448 && REGNO (operands[4]) == 5"
10449 "lswi %4,%1,%2\;stswi %4,%0,%2"
10450 [(set_attr "type" "store")
10451 (set_attr "update" "yes")
10452 (set_attr "indexed" "yes")
10453 (set_attr "cell_micro" "always")
10454 (set_attr "length" "8")])
10456 ;; Move up to 24 bytes at a time. The fixed registers are needed because the
10457 ;; register allocator doesn't have a clue about allocating 6 word registers.
10458 ;; rD/rS = r5 is preferred, efficient form.
10459 (define_expand "movmemsi_6reg"
10460 [(parallel [(set (match_operand 0 "" "")
10461 (match_operand 1 "" ""))
10462 (use (match_operand 2 "" ""))
10463 (use (match_operand 3 "" ""))
10464 (clobber (reg:SI 5))
10465 (clobber (reg:SI 6))
10466 (clobber (reg:SI 7))
10467 (clobber (reg:SI 8))
10468 (clobber (reg:SI 9))
10469 (clobber (reg:SI 10))
10470 (clobber (match_scratch:SI 4 ""))])]
10475 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
10476 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
10477 (use (match_operand:SI 2 "immediate_operand" "i"))
10478 (use (match_operand:SI 3 "immediate_operand" "i"))
10479 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10480 (clobber (reg:SI 6))
10481 (clobber (reg:SI 7))
10482 (clobber (reg:SI 8))
10483 (clobber (reg:SI 9))
10484 (clobber (reg:SI 10))
10485 (clobber (match_scratch:SI 5 "=X"))]
10487 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
10488 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
10489 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
10490 && REGNO (operands[4]) == 5"
10491 "lswi %4,%1,%2\;stswi %4,%0,%2"
10492 [(set_attr "type" "store")
10493 (set_attr "update" "yes")
10494 (set_attr "indexed" "yes")
10495 (set_attr "cell_micro" "always")
10496 (set_attr "length" "8")])
10498 ;; Move up to 16 bytes at a time, using 4 fixed registers to avoid spill
10499 ;; problems with TImode.
10500 ;; rD/rS = r5 is preferred, efficient form.
10501 (define_expand "movmemsi_4reg"
10502 [(parallel [(set (match_operand 0 "" "")
10503 (match_operand 1 "" ""))
10504 (use (match_operand 2 "" ""))
10505 (use (match_operand 3 "" ""))
10506 (clobber (reg:SI 5))
10507 (clobber (reg:SI 6))
10508 (clobber (reg:SI 7))
10509 (clobber (reg:SI 8))
10510 (clobber (match_scratch:SI 4 ""))])]
10515 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
10516 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
10517 (use (match_operand:SI 2 "immediate_operand" "i"))
10518 (use (match_operand:SI 3 "immediate_operand" "i"))
10519 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10520 (clobber (reg:SI 6))
10521 (clobber (reg:SI 7))
10522 (clobber (reg:SI 8))
10523 (clobber (match_scratch:SI 5 "=X"))]
10525 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
10526 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
10527 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
10528 && REGNO (operands[4]) == 5"
10529 "lswi %4,%1,%2\;stswi %4,%0,%2"
10530 [(set_attr "type" "store")
10531 (set_attr "update" "yes")
10532 (set_attr "indexed" "yes")
10533 (set_attr "cell_micro" "always")
10534 (set_attr "length" "8")])
10536 ;; Move up to 8 bytes at a time.
10537 (define_expand "movmemsi_2reg"
10538 [(parallel [(set (match_operand 0 "" "")
10539 (match_operand 1 "" ""))
10540 (use (match_operand 2 "" ""))
10541 (use (match_operand 3 "" ""))
10542 (clobber (match_scratch:DI 4 ""))
10543 (clobber (match_scratch:SI 5 ""))])]
10544 "TARGET_STRING && ! TARGET_POWERPC64"
10548 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
10549 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
10550 (use (match_operand:SI 2 "immediate_operand" "i"))
10551 (use (match_operand:SI 3 "immediate_operand" "i"))
10552 (clobber (match_scratch:DI 4 "=&r"))
10553 (clobber (match_scratch:SI 5 "=X"))]
10554 "TARGET_STRING && ! TARGET_POWERPC64
10555 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
10556 "lswi %4,%1,%2\;stswi %4,%0,%2"
10557 [(set_attr "type" "store")
10558 (set_attr "update" "yes")
10559 (set_attr "indexed" "yes")
10560 (set_attr "cell_micro" "always")
10561 (set_attr "length" "8")])
10563 ;; Move up to 4 bytes at a time.
10564 (define_expand "movmemsi_1reg"
10565 [(parallel [(set (match_operand 0 "" "")
10566 (match_operand 1 "" ""))
10567 (use (match_operand 2 "" ""))
10568 (use (match_operand 3 "" ""))
10569 (clobber (match_scratch:SI 4 ""))
10570 (clobber (match_scratch:SI 5 ""))])]
10575 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
10576 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
10577 (use (match_operand:SI 2 "immediate_operand" "i"))
10578 (use (match_operand:SI 3 "immediate_operand" "i"))
10579 (clobber (match_scratch:SI 4 "=&r"))
10580 (clobber (match_scratch:SI 5 "=X"))]
10581 "TARGET_STRING && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
10582 "lswi %4,%1,%2\;stswi %4,%0,%2"
10583 [(set_attr "type" "store")
10584 (set_attr "update" "yes")
10585 (set_attr "indexed" "yes")
10586 (set_attr "cell_micro" "always")
10587 (set_attr "length" "8")])
10589 ;; Define insns that do load or store with update. Some of these we can
10590 ;; get by using pre-decrement or pre-increment, but the hardware can also
10591 ;; do cases where the increment is not the size of the object.
10593 ;; In all these cases, we use operands 0 and 1 for the register being
10594 ;; incremented because those are the operands that local-alloc will
10595 ;; tie and these are the pair most likely to be tieable (and the ones
10596 ;; that will benefit the most).
10598 (define_insn "*movdi_update1"
10599 [(set (match_operand:DI 3 "gpc_reg_operand" "=r,r")
10600 (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
10601 (match_operand:DI 2 "reg_or_aligned_short_operand" "r,I"))))
10602 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
10603 (plus:DI (match_dup 1) (match_dup 2)))]
10604 "TARGET_POWERPC64 && TARGET_UPDATE
10605 && (!avoiding_indexed_address_p (DImode)
10606 || !gpc_reg_operand (operands[2], DImode))"
10610 [(set_attr "type" "load")
10611 (set_attr "update" "yes")
10612 (set_attr "indexed" "yes,no")])
10614 (define_insn "movdi_<mode>_update"
10615 [(set (mem:DI (plus:P (match_operand:P 1 "gpc_reg_operand" "0,0")
10616 (match_operand:P 2 "reg_or_aligned_short_operand" "r,I")))
10617 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
10618 (set (match_operand:P 0 "gpc_reg_operand" "=b,b")
10619 (plus:P (match_dup 1) (match_dup 2)))]
10620 "TARGET_POWERPC64 && TARGET_UPDATE
10621 && (!avoiding_indexed_address_p (Pmode)
10622 || !gpc_reg_operand (operands[2], Pmode)
10623 || (REG_P (operands[0])
10624 && REGNO (operands[0]) == STACK_POINTER_REGNUM))"
10628 [(set_attr "type" "store")
10629 (set_attr "update" "yes")
10630 (set_attr "indexed" "yes,no")])
10632 ;; This pattern is only conditional on TARGET_POWERPC64, as it is
10633 ;; needed for stack allocation, even if the user passes -mno-update.
10634 (define_insn "movdi_<mode>_update_stack"
10635 [(set (mem:DI (plus:P (match_operand:P 1 "gpc_reg_operand" "0,0")
10636 (match_operand:P 2 "reg_or_aligned_short_operand" "r,I")))
10637 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
10638 (set (match_operand:P 0 "gpc_reg_operand" "=b,b")
10639 (plus:P (match_dup 1) (match_dup 2)))]
10644 [(set_attr "type" "store")
10645 (set_attr "update" "yes")
10646 (set_attr "indexed" "yes,no")])
10648 (define_insn "*movsi_update1"
10649 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
10650 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10651 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10652 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10653 (plus:SI (match_dup 1) (match_dup 2)))]
10655 && (!avoiding_indexed_address_p (SImode)
10656 || !gpc_reg_operand (operands[2], SImode))"
10660 [(set_attr "type" "load")
10661 (set_attr "update" "yes")
10662 (set_attr "indexed" "yes,no")])
10664 (define_insn "*movsi_update2"
10665 [(set (match_operand:DI 3 "gpc_reg_operand" "=r")
10667 (mem:SI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0")
10668 (match_operand:DI 2 "gpc_reg_operand" "r")))))
10669 (set (match_operand:DI 0 "gpc_reg_operand" "=b")
10670 (plus:DI (match_dup 1) (match_dup 2)))]
10671 "TARGET_POWERPC64 && rs6000_gen_cell_microcode
10672 && !avoiding_indexed_address_p (DImode)"
10674 [(set_attr "type" "load")
10675 (set_attr "sign_extend" "yes")
10676 (set_attr "update" "yes")
10677 (set_attr "indexed" "yes")])
10679 (define_insn "movsi_update"
10680 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10681 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10682 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
10683 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10684 (plus:SI (match_dup 1) (match_dup 2)))]
10686 && (!avoiding_indexed_address_p (SImode)
10687 || !gpc_reg_operand (operands[2], SImode)
10688 || (REG_P (operands[0])
10689 && REGNO (operands[0]) == STACK_POINTER_REGNUM))"
10693 [(set_attr "type" "store")
10694 (set_attr "update" "yes")
10695 (set_attr "indexed" "yes,no")])
10697 ;; This is an unconditional pattern; needed for stack allocation, even
10698 ;; if the user passes -mno-update.
10699 (define_insn "movsi_update_stack"
10700 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10701 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10702 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
10703 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10704 (plus:SI (match_dup 1) (match_dup 2)))]
10709 [(set_attr "type" "store")
10710 (set_attr "update" "yes")
10711 (set_attr "indexed" "yes,no")])
10713 (define_insn "*movhi_update1"
10714 [(set (match_operand:HI 3 "gpc_reg_operand" "=r,r")
10715 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10716 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10717 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10718 (plus:SI (match_dup 1) (match_dup 2)))]
10720 && (!avoiding_indexed_address_p (SImode)
10721 || !gpc_reg_operand (operands[2], SImode))"
10725 [(set_attr "type" "load")
10726 (set_attr "update" "yes")
10727 (set_attr "indexed" "yes,no")])
10729 (define_insn "*movhi_update2"
10730 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
10732 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10733 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
10734 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10735 (plus:SI (match_dup 1) (match_dup 2)))]
10737 && (!avoiding_indexed_address_p (SImode)
10738 || !gpc_reg_operand (operands[2], SImode))"
10742 [(set_attr "type" "load")
10743 (set_attr "update" "yes")
10744 (set_attr "indexed" "yes,no")])
10746 (define_insn "*movhi_update3"
10747 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
10749 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10750 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
10751 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10752 (plus:SI (match_dup 1) (match_dup 2)))]
10753 "TARGET_UPDATE && rs6000_gen_cell_microcode
10754 && (!avoiding_indexed_address_p (SImode)
10755 || !gpc_reg_operand (operands[2], SImode))"
10759 [(set_attr "type" "load")
10760 (set_attr "sign_extend" "yes")
10761 (set_attr "update" "yes")
10762 (set_attr "indexed" "yes,no")])
10764 (define_insn "*movhi_update4"
10765 [(set (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10766 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10767 (match_operand:HI 3 "gpc_reg_operand" "r,r"))
10768 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10769 (plus:SI (match_dup 1) (match_dup 2)))]
10771 && (!avoiding_indexed_address_p (SImode)
10772 || !gpc_reg_operand (operands[2], SImode))"
10776 [(set_attr "type" "store")
10777 (set_attr "update" "yes")
10778 (set_attr "indexed" "yes,no")])
10780 (define_insn "*movqi_update1"
10781 [(set (match_operand:QI 3 "gpc_reg_operand" "=r,r")
10782 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10783 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10784 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10785 (plus:SI (match_dup 1) (match_dup 2)))]
10787 && (!avoiding_indexed_address_p (SImode)
10788 || !gpc_reg_operand (operands[2], SImode))"
10792 [(set_attr "type" "load")
10793 (set_attr "update" "yes")
10794 (set_attr "indexed" "yes,no")])
10796 (define_insn "*movqi_update2"
10797 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
10799 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10800 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
10801 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10802 (plus:SI (match_dup 1) (match_dup 2)))]
10804 && (!avoiding_indexed_address_p (SImode)
10805 || !gpc_reg_operand (operands[2], SImode))"
10809 [(set_attr "type" "load")
10810 (set_attr "update" "yes")
10811 (set_attr "indexed" "yes,no")])
10813 (define_insn "*movqi_update3"
10814 [(set (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10815 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10816 (match_operand:QI 3 "gpc_reg_operand" "r,r"))
10817 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10818 (plus:SI (match_dup 1) (match_dup 2)))]
10820 && (!avoiding_indexed_address_p (SImode)
10821 || !gpc_reg_operand (operands[2], SImode))"
10825 [(set_attr "type" "store")
10826 (set_attr "update" "yes")
10827 (set_attr "indexed" "yes,no")])
10829 (define_insn "*movsf_update1"
10830 [(set (match_operand:SF 3 "gpc_reg_operand" "=f,f")
10831 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10832 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10833 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10834 (plus:SI (match_dup 1) (match_dup 2)))]
10835 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT && TARGET_UPDATE
10836 && (!avoiding_indexed_address_p (SImode)
10837 || !gpc_reg_operand (operands[2], SImode))"
10841 [(set_attr "type" "fpload")
10842 (set_attr "update" "yes")
10843 (set_attr "indexed" "yes,no")])
10845 (define_insn "*movsf_update2"
10846 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10847 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10848 (match_operand:SF 3 "gpc_reg_operand" "f,f"))
10849 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10850 (plus:SI (match_dup 1) (match_dup 2)))]
10851 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT && TARGET_UPDATE
10852 && (!avoiding_indexed_address_p (SImode)
10853 || !gpc_reg_operand (operands[2], SImode))"
10857 [(set_attr "type" "fpstore")
10858 (set_attr "update" "yes")
10859 (set_attr "indexed" "yes,no")])
10861 (define_insn "*movsf_update3"
10862 [(set (match_operand:SF 3 "gpc_reg_operand" "=r,r")
10863 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10864 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10865 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10866 (plus:SI (match_dup 1) (match_dup 2)))]
10867 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE
10868 && (!avoiding_indexed_address_p (SImode)
10869 || !gpc_reg_operand (operands[2], SImode))"
10873 [(set_attr "type" "load")
10874 (set_attr "update" "yes")
10875 (set_attr "indexed" "yes,no")])
10877 (define_insn "*movsf_update4"
10878 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10879 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10880 (match_operand:SF 3 "gpc_reg_operand" "r,r"))
10881 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10882 (plus:SI (match_dup 1) (match_dup 2)))]
10883 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE
10884 && (!avoiding_indexed_address_p (SImode)
10885 || !gpc_reg_operand (operands[2], SImode))"
10889 [(set_attr "type" "store")
10890 (set_attr "update" "yes")
10891 (set_attr "indexed" "yes,no")])
10893 (define_insn "*movdf_update1"
10894 [(set (match_operand:DF 3 "gpc_reg_operand" "=d,d")
10895 (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10896 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10897 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10898 (plus:SI (match_dup 1) (match_dup 2)))]
10899 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_UPDATE
10900 && (!avoiding_indexed_address_p (SImode)
10901 || !gpc_reg_operand (operands[2], SImode))"
10905 [(set_attr "type" "fpload")
10906 (set_attr "update" "yes")
10907 (set_attr "indexed" "yes,no")])
10909 (define_insn "*movdf_update2"
10910 [(set (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10911 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10912 (match_operand:DF 3 "gpc_reg_operand" "d,d"))
10913 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10914 (plus:SI (match_dup 1) (match_dup 2)))]
10915 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_UPDATE
10916 && (!avoiding_indexed_address_p (SImode)
10917 || !gpc_reg_operand (operands[2], SImode))"
10921 [(set_attr "type" "fpstore")
10922 (set_attr "update" "yes")
10923 (set_attr "indexed" "yes,no")])
10926 ;; After inserting conditional returns we can sometimes have
10927 ;; unnecessary register moves. Unfortunately we cannot have a
10928 ;; modeless peephole here, because some single SImode sets have early
10929 ;; clobber outputs. Although those sets expand to multi-ppc-insn
10930 ;; sequences, using get_attr_length here will smash the operands
10931 ;; array. Neither is there an early_cobbler_p predicate.
10932 ;; Disallow subregs for E500 so we don't munge frob_di_df_2.
10934 [(set (match_operand:DF 0 "gpc_reg_operand" "")
10935 (match_operand:DF 1 "any_operand" ""))
10936 (set (match_operand:DF 2 "gpc_reg_operand" "")
10938 "!(TARGET_E500_DOUBLE && GET_CODE (operands[2]) == SUBREG)
10939 && peep2_reg_dead_p (2, operands[0])"
10940 [(set (match_dup 2) (match_dup 1))])
10943 [(set (match_operand:SF 0 "gpc_reg_operand" "")
10944 (match_operand:SF 1 "any_operand" ""))
10945 (set (match_operand:SF 2 "gpc_reg_operand" "")
10947 "peep2_reg_dead_p (2, operands[0])"
10948 [(set (match_dup 2) (match_dup 1))])
10953 ;; Mode attributes for different ABIs.
10954 (define_mode_iterator TLSmode [(SI "! TARGET_64BIT") (DI "TARGET_64BIT")])
10955 (define_mode_attr tls_abi_suffix [(SI "32") (DI "64")])
10956 (define_mode_attr tls_sysv_suffix [(SI "si") (DI "di")])
10957 (define_mode_attr tls_insn_suffix [(SI "wz") (DI "d")])
10959 (define_insn_and_split "tls_gd_aix<TLSmode:tls_abi_suffix>"
10960 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10961 (call (mem:TLSmode (match_operand:TLSmode 3 "symbol_ref_operand" "s"))
10962 (match_operand 4 "" "g")))
10963 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10964 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10966 (clobber (reg:SI LR_REGNO))]
10967 "HAVE_AS_TLS && (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)"
10969 if (TARGET_CMODEL != CMODEL_SMALL)
10970 return "addis %0,%1,%2@got@tlsgd@ha\;addi %0,%0,%2@got@tlsgd@l\;"
10973 return "addi %0,%1,%2@got@tlsgd\;bl %z3\;nop";
10975 "&& TARGET_TLS_MARKERS"
10976 [(set (match_dup 0)
10977 (unspec:TLSmode [(match_dup 1)
10980 (parallel [(set (match_dup 0)
10981 (call (mem:TLSmode (match_dup 3))
10983 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD)
10984 (clobber (reg:SI LR_REGNO))])]
10986 [(set_attr "type" "two")
10987 (set (attr "length")
10988 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
10992 (define_insn_and_split "tls_gd_sysv<TLSmode:tls_sysv_suffix>"
10993 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10994 (call (mem:TLSmode (match_operand:TLSmode 3 "symbol_ref_operand" "s"))
10995 (match_operand 4 "" "g")))
10996 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10997 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10999 (clobber (reg:SI LR_REGNO))]
11000 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4"
11004 if (TARGET_SECURE_PLT && flag_pic == 2)
11005 return "addi %0,%1,%2@got@tlsgd\;bl %z3+32768@plt";
11007 return "addi %0,%1,%2@got@tlsgd\;bl %z3@plt";
11010 return "addi %0,%1,%2@got@tlsgd\;bl %z3";
11012 "&& TARGET_TLS_MARKERS"
11013 [(set (match_dup 0)
11014 (unspec:TLSmode [(match_dup 1)
11017 (parallel [(set (match_dup 0)
11018 (call (mem:TLSmode (match_dup 3))
11020 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD)
11021 (clobber (reg:SI LR_REGNO))])]
11023 [(set_attr "type" "two")
11024 (set_attr "length" "8")])
11026 (define_insn_and_split "*tls_gd<TLSmode:tls_abi_suffix>"
11027 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11028 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11029 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11031 "HAVE_AS_TLS && TARGET_TLS_MARKERS"
11032 "addi %0,%1,%2@got@tlsgd"
11033 "&& TARGET_CMODEL != CMODEL_SMALL"
11034 [(set (match_dup 3)
11036 (unspec:TLSmode [(match_dup 1) (match_dup 2)] UNSPEC_TLSGD)))
11038 (lo_sum:TLSmode (match_dup 3)
11039 (unspec:TLSmode [(match_dup 1) (match_dup 2)] UNSPEC_TLSGD)))]
11042 operands[3] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
11044 [(set (attr "length")
11045 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
11049 (define_insn "*tls_gd_high<TLSmode:tls_abi_suffix>"
11050 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11052 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11053 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11055 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
11056 "addis %0,%1,%2@got@tlsgd@ha"
11057 [(set_attr "length" "4")])
11059 (define_insn "*tls_gd_low<TLSmode:tls_abi_suffix>"
11060 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11061 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11062 (unspec:TLSmode [(match_operand:TLSmode 3 "gpc_reg_operand" "b")
11063 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11065 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
11066 "addi %0,%1,%2@got@tlsgd@l"
11067 [(set_attr "length" "4")])
11069 (define_insn "*tls_gd_call_aix<TLSmode:tls_abi_suffix>"
11070 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11071 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
11072 (match_operand 2 "" "g")))
11073 (unspec:TLSmode [(match_operand:TLSmode 3 "rs6000_tls_symbol_ref" "")]
11075 (clobber (reg:SI LR_REGNO))]
11076 "HAVE_AS_TLS && TARGET_TLS_MARKERS
11077 && (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)"
11078 "bl %z1(%3@tlsgd)\;nop"
11079 [(set_attr "type" "branch")
11080 (set_attr "length" "8")])
11082 (define_insn "*tls_gd_call_sysv<TLSmode:tls_abi_suffix>"
11083 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11084 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
11085 (match_operand 2 "" "g")))
11086 (unspec:TLSmode [(match_operand:TLSmode 3 "rs6000_tls_symbol_ref" "")]
11088 (clobber (reg:SI LR_REGNO))]
11089 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4 && TARGET_TLS_MARKERS"
11093 if (TARGET_SECURE_PLT && flag_pic == 2)
11094 return "bl %z1+32768(%3@tlsgd)@plt";
11095 return "bl %z1(%3@tlsgd)@plt";
11097 return "bl %z1(%3@tlsgd)";
11099 [(set_attr "type" "branch")
11100 (set_attr "length" "4")])
11102 (define_insn_and_split "tls_ld_aix<TLSmode:tls_abi_suffix>"
11103 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11104 (call (mem:TLSmode (match_operand:TLSmode 2 "symbol_ref_operand" "s"))
11105 (match_operand 3 "" "g")))
11106 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
11108 (clobber (reg:SI LR_REGNO))]
11109 "HAVE_AS_TLS && (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)"
11111 if (TARGET_CMODEL != CMODEL_SMALL)
11112 return "addis %0,%1,%&@got@tlsld@ha\;addi %0,%0,%&@got@tlsld@l\;"
11115 return "addi %0,%1,%&@got@tlsld\;bl %z2\;nop";
11117 "&& TARGET_TLS_MARKERS"
11118 [(set (match_dup 0)
11119 (unspec:TLSmode [(match_dup 1)]
11121 (parallel [(set (match_dup 0)
11122 (call (mem:TLSmode (match_dup 2))
11124 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
11125 (clobber (reg:SI LR_REGNO))])]
11127 [(set_attr "type" "two")
11128 (set (attr "length")
11129 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
11133 (define_insn_and_split "tls_ld_sysv<TLSmode:tls_sysv_suffix>"
11134 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11135 (call (mem:TLSmode (match_operand:TLSmode 2 "symbol_ref_operand" "s"))
11136 (match_operand 3 "" "g")))
11137 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
11139 (clobber (reg:SI LR_REGNO))]
11140 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4"
11144 if (TARGET_SECURE_PLT && flag_pic == 2)
11145 return "addi %0,%1,%&@got@tlsld\;bl %z2+32768@plt";
11147 return "addi %0,%1,%&@got@tlsld\;bl %z2@plt";
11150 return "addi %0,%1,%&@got@tlsld\;bl %z2";
11152 "&& TARGET_TLS_MARKERS"
11153 [(set (match_dup 0)
11154 (unspec:TLSmode [(match_dup 1)]
11156 (parallel [(set (match_dup 0)
11157 (call (mem:TLSmode (match_dup 2))
11159 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
11160 (clobber (reg:SI LR_REGNO))])]
11162 [(set_attr "length" "8")])
11164 (define_insn_and_split "*tls_ld<TLSmode:tls_abi_suffix>"
11165 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11166 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
11168 "HAVE_AS_TLS && TARGET_TLS_MARKERS"
11169 "addi %0,%1,%&@got@tlsld"
11170 "&& TARGET_CMODEL != CMODEL_SMALL"
11171 [(set (match_dup 2)
11173 (unspec:TLSmode [(const_int 0) (match_dup 1)] UNSPEC_TLSLD)))
11175 (lo_sum:TLSmode (match_dup 2)
11176 (unspec:TLSmode [(const_int 0) (match_dup 1)] UNSPEC_TLSLD)))]
11179 operands[2] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
11181 [(set (attr "length")
11182 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
11186 (define_insn "*tls_ld_high<TLSmode:tls_abi_suffix>"
11187 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11189 (unspec:TLSmode [(const_int 0)
11190 (match_operand:TLSmode 1 "gpc_reg_operand" "b")]
11192 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
11193 "addis %0,%1,%&@got@tlsld@ha"
11194 [(set_attr "length" "4")])
11196 (define_insn "*tls_ld_low<TLSmode:tls_abi_suffix>"
11197 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11198 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11199 (unspec:TLSmode [(const_int 0)
11200 (match_operand:TLSmode 2 "gpc_reg_operand" "b")]
11202 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
11203 "addi %0,%1,%&@got@tlsld@l"
11204 [(set_attr "length" "4")])
11206 (define_insn "*tls_ld_call_aix<TLSmode:tls_abi_suffix>"
11207 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11208 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
11209 (match_operand 2 "" "g")))
11210 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
11211 (clobber (reg:SI LR_REGNO))]
11212 "HAVE_AS_TLS && TARGET_TLS_MARKERS
11213 && (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)"
11214 "bl %z1(%&@tlsld)\;nop"
11215 [(set_attr "type" "branch")
11216 (set_attr "length" "8")])
11218 (define_insn "*tls_ld_call_sysv<TLSmode:tls_abi_suffix>"
11219 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11220 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
11221 (match_operand 2 "" "g")))
11222 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
11223 (clobber (reg:SI LR_REGNO))]
11224 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4 && TARGET_TLS_MARKERS"
11228 if (TARGET_SECURE_PLT && flag_pic == 2)
11229 return "bl %z1+32768(%&@tlsld)@plt";
11230 return "bl %z1(%&@tlsld)@plt";
11232 return "bl %z1(%&@tlsld)";
11234 [(set_attr "type" "branch")
11235 (set_attr "length" "4")])
11237 (define_insn "tls_dtprel_<TLSmode:tls_abi_suffix>"
11238 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11239 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11240 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11241 UNSPEC_TLSDTPREL))]
11243 "addi %0,%1,%2@dtprel")
11245 (define_insn "tls_dtprel_ha_<TLSmode:tls_abi_suffix>"
11246 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11247 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11248 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11249 UNSPEC_TLSDTPRELHA))]
11251 "addis %0,%1,%2@dtprel@ha")
11253 (define_insn "tls_dtprel_lo_<TLSmode:tls_abi_suffix>"
11254 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11255 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11256 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11257 UNSPEC_TLSDTPRELLO))]
11259 "addi %0,%1,%2@dtprel@l")
11261 (define_insn_and_split "tls_got_dtprel_<TLSmode:tls_abi_suffix>"
11262 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11263 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11264 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11265 UNSPEC_TLSGOTDTPREL))]
11267 "l<TLSmode:tls_insn_suffix> %0,%2@got@dtprel(%1)"
11268 "&& TARGET_CMODEL != CMODEL_SMALL"
11269 [(set (match_dup 3)
11271 (unspec:TLSmode [(match_dup 1) (match_dup 2)] UNSPEC_TLSGOTDTPREL)))
11273 (lo_sum:TLSmode (match_dup 3)
11274 (unspec:TLSmode [(match_dup 1) (match_dup 2)] UNSPEC_TLSGOTDTPREL)))]
11277 operands[3] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
11279 [(set (attr "length")
11280 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
11284 (define_insn "*tls_got_dtprel_high<TLSmode:tls_abi_suffix>"
11285 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11287 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11288 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11289 UNSPEC_TLSGOTDTPREL)))]
11290 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
11291 "addis %0,%1,%2@got@dtprel@ha"
11292 [(set_attr "length" "4")])
11294 (define_insn "*tls_got_dtprel_low<TLSmode:tls_abi_suffix>"
11295 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11296 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11297 (unspec:TLSmode [(match_operand:TLSmode 3 "gpc_reg_operand" "b")
11298 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11299 UNSPEC_TLSGOTDTPREL)))]
11300 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
11301 "l<TLSmode:tls_insn_suffix> %0,%2@got@dtprel@l(%1)"
11302 [(set_attr "length" "4")])
11304 (define_insn "tls_tprel_<TLSmode:tls_abi_suffix>"
11305 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11306 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11307 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11310 "addi %0,%1,%2@tprel")
11312 (define_insn "tls_tprel_ha_<TLSmode:tls_abi_suffix>"
11313 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11314 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11315 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11316 UNSPEC_TLSTPRELHA))]
11318 "addis %0,%1,%2@tprel@ha")
11320 (define_insn "tls_tprel_lo_<TLSmode:tls_abi_suffix>"
11321 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11322 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11323 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11324 UNSPEC_TLSTPRELLO))]
11326 "addi %0,%1,%2@tprel@l")
11328 ;; "b" output constraint here and on tls_tls input to support linker tls
11329 ;; optimization. The linker may edit the instructions emitted by a
11330 ;; tls_got_tprel/tls_tls pair to addis,addi.
11331 (define_insn_and_split "tls_got_tprel_<TLSmode:tls_abi_suffix>"
11332 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11333 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11334 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11335 UNSPEC_TLSGOTTPREL))]
11337 "l<TLSmode:tls_insn_suffix> %0,%2@got@tprel(%1)"
11338 "&& TARGET_CMODEL != CMODEL_SMALL"
11339 [(set (match_dup 3)
11341 (unspec:TLSmode [(match_dup 1) (match_dup 2)] UNSPEC_TLSGOTTPREL)))
11343 (lo_sum:TLSmode (match_dup 3)
11344 (unspec:TLSmode [(match_dup 1) (match_dup 2)] UNSPEC_TLSGOTTPREL)))]
11347 operands[3] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
11349 [(set (attr "length")
11350 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
11354 (define_insn "*tls_got_tprel_high<TLSmode:tls_abi_suffix>"
11355 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11357 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11358 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11359 UNSPEC_TLSGOTTPREL)))]
11360 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
11361 "addis %0,%1,%2@got@tprel@ha"
11362 [(set_attr "length" "4")])
11364 (define_insn "*tls_got_tprel_low<TLSmode:tls_abi_suffix>"
11365 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11366 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11367 (unspec:TLSmode [(match_operand:TLSmode 3 "gpc_reg_operand" "b")
11368 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11369 UNSPEC_TLSGOTTPREL)))]
11370 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
11371 "l<TLSmode:tls_insn_suffix> %0,%2@got@tprel@l(%1)"
11372 [(set_attr "length" "4")])
11374 (define_insn "tls_tls_<TLSmode:tls_abi_suffix>"
11375 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11376 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11377 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11379 "TARGET_ELF && HAVE_AS_TLS"
11380 "add %0,%1,%2@tls")
11382 (define_expand "tls_get_tpointer"
11383 [(set (match_operand:SI 0 "gpc_reg_operand" "")
11384 (unspec:SI [(const_int 0)] UNSPEC_TLSTLS))]
11385 "TARGET_XCOFF && HAVE_AS_TLS"
11388 emit_insn (gen_tls_get_tpointer_internal ());
11389 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
11393 (define_insn "tls_get_tpointer_internal"
11395 (unspec:SI [(const_int 0)] UNSPEC_TLSTLS))
11396 (clobber (reg:SI LR_REGNO))]
11397 "TARGET_XCOFF && HAVE_AS_TLS"
11398 "bla __get_tpointer")
11400 (define_expand "tls_get_addr<mode>"
11401 [(set (match_operand:P 0 "gpc_reg_operand" "")
11402 (unspec:P [(match_operand:P 1 "gpc_reg_operand" "")
11403 (match_operand:P 2 "gpc_reg_operand" "")] UNSPEC_TLSTLS))]
11404 "TARGET_XCOFF && HAVE_AS_TLS"
11407 emit_move_insn (gen_rtx_REG (Pmode, 3), operands[1]);
11408 emit_move_insn (gen_rtx_REG (Pmode, 4), operands[2]);
11409 emit_insn (gen_tls_get_addr_internal<mode> ());
11410 emit_move_insn (operands[0], gen_rtx_REG (Pmode, 3));
11414 (define_insn "tls_get_addr_internal<mode>"
11416 (unspec:P [(reg:P 3) (reg:P 4)] UNSPEC_TLSTLS))
11417 (clobber (reg:P 0))
11418 (clobber (reg:P 4))
11419 (clobber (reg:P 5))
11420 (clobber (reg:P 11))
11421 (clobber (reg:CC CR0_REGNO))
11422 (clobber (reg:P LR_REGNO))]
11423 "TARGET_XCOFF && HAVE_AS_TLS"
11424 "bla __tls_get_addr")
11426 ;; Next come insns related to the calling sequence.
11428 ;; First, an insn to allocate new stack space for dynamic use (e.g., alloca).
11429 ;; We move the back-chain and decrement the stack pointer.
11431 (define_expand "allocate_stack"
11432 [(set (match_operand 0 "gpc_reg_operand" "")
11433 (minus (reg 1) (match_operand 1 "reg_or_short_operand" "")))
11435 (minus (reg 1) (match_dup 1)))]
11438 { rtx chain = gen_reg_rtx (Pmode);
11439 rtx stack_bot = gen_rtx_MEM (Pmode, stack_pointer_rtx);
11441 rtx insn, par, set, mem;
11443 emit_move_insn (chain, stack_bot);
11445 /* Check stack bounds if necessary. */
11446 if (crtl->limit_stack)
11449 available = expand_binop (Pmode, sub_optab,
11450 stack_pointer_rtx, stack_limit_rtx,
11451 NULL_RTX, 1, OPTAB_WIDEN);
11452 emit_insn (gen_cond_trap (LTU, available, operands[1], const0_rtx));
11455 if (GET_CODE (operands[1]) != CONST_INT
11456 || INTVAL (operands[1]) < -32767
11457 || INTVAL (operands[1]) > 32768)
11459 neg_op0 = gen_reg_rtx (Pmode);
11461 emit_insn (gen_negsi2 (neg_op0, operands[1]));
11463 emit_insn (gen_negdi2 (neg_op0, operands[1]));
11466 neg_op0 = GEN_INT (- INTVAL (operands[1]));
11468 insn = emit_insn ((* ((TARGET_32BIT) ? gen_movsi_update_stack
11469 : gen_movdi_di_update_stack))
11470 (stack_pointer_rtx, stack_pointer_rtx, neg_op0,
11472 /* Since we didn't use gen_frame_mem to generate the MEM, grab
11473 it now and set the alias set/attributes. The above gen_*_update
11474 calls will generate a PARALLEL with the MEM set being the first
11476 par = PATTERN (insn);
11477 gcc_assert (GET_CODE (par) == PARALLEL);
11478 set = XVECEXP (par, 0, 0);
11479 gcc_assert (GET_CODE (set) == SET);
11480 mem = SET_DEST (set);
11481 gcc_assert (MEM_P (mem));
11482 MEM_NOTRAP_P (mem) = 1;
11483 set_mem_alias_set (mem, get_frame_alias_set ());
11485 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
11489 ;; These patterns say how to save and restore the stack pointer. We need not
11490 ;; save the stack pointer at function level since we are careful to
11491 ;; preserve the backchain. At block level, we have to restore the backchain
11492 ;; when we restore the stack pointer.
11494 ;; For nonlocal gotos, we must save both the stack pointer and its
11495 ;; backchain and restore both. Note that in the nonlocal case, the
11496 ;; save area is a memory location.
11498 (define_expand "save_stack_function"
11499 [(match_operand 0 "any_operand" "")
11500 (match_operand 1 "any_operand" "")]
11504 (define_expand "restore_stack_function"
11505 [(match_operand 0 "any_operand" "")
11506 (match_operand 1 "any_operand" "")]
11510 ;; Adjust stack pointer (op0) to a new value (op1).
11511 ;; First copy old stack backchain to new location, and ensure that the
11512 ;; scheduler won't reorder the sp assignment before the backchain write.
11513 (define_expand "restore_stack_block"
11514 [(set (match_dup 2) (match_dup 3))
11515 (set (match_dup 4) (match_dup 2))
11517 (set (match_operand 0 "register_operand" "")
11518 (match_operand 1 "register_operand" ""))]
11524 operands[1] = force_reg (Pmode, operands[1]);
11525 operands[2] = gen_reg_rtx (Pmode);
11526 operands[3] = gen_frame_mem (Pmode, operands[0]);
11527 operands[4] = gen_frame_mem (Pmode, operands[1]);
11528 p = rtvec_alloc (1);
11529 RTVEC_ELT (p, 0) = gen_rtx_SET (VOIDmode,
11530 gen_frame_mem (BLKmode, operands[0]),
11532 operands[5] = gen_rtx_PARALLEL (VOIDmode, p);
11535 (define_expand "save_stack_nonlocal"
11536 [(set (match_dup 3) (match_dup 4))
11537 (set (match_operand 0 "memory_operand" "") (match_dup 3))
11538 (set (match_dup 2) (match_operand 1 "register_operand" ""))]
11542 int units_per_word = (TARGET_32BIT) ? 4 : 8;
11544 /* Copy the backchain to the first word, sp to the second. */
11545 operands[0] = adjust_address_nv (operands[0], Pmode, 0);
11546 operands[2] = adjust_address_nv (operands[0], Pmode, units_per_word);
11547 operands[3] = gen_reg_rtx (Pmode);
11548 operands[4] = gen_frame_mem (Pmode, operands[1]);
11551 (define_expand "restore_stack_nonlocal"
11552 [(set (match_dup 2) (match_operand 1 "memory_operand" ""))
11553 (set (match_dup 3) (match_dup 4))
11554 (set (match_dup 5) (match_dup 2))
11556 (set (match_operand 0 "register_operand" "") (match_dup 3))]
11560 int units_per_word = (TARGET_32BIT) ? 4 : 8;
11563 /* Restore the backchain from the first word, sp from the second. */
11564 operands[2] = gen_reg_rtx (Pmode);
11565 operands[3] = gen_reg_rtx (Pmode);
11566 operands[1] = adjust_address_nv (operands[1], Pmode, 0);
11567 operands[4] = adjust_address_nv (operands[1], Pmode, units_per_word);
11568 operands[5] = gen_frame_mem (Pmode, operands[3]);
11569 p = rtvec_alloc (1);
11570 RTVEC_ELT (p, 0) = gen_rtx_SET (VOIDmode,
11571 gen_frame_mem (BLKmode, operands[0]),
11573 operands[6] = gen_rtx_PARALLEL (VOIDmode, p);
11576 ;; TOC register handling.
11578 ;; Code to initialize the TOC register...
11580 (define_insn "load_toc_aix_si"
11581 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11582 (unspec:SI [(const_int 0)] UNSPEC_TOC))
11583 (use (reg:SI 2))])]
11584 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2) && TARGET_32BIT"
11588 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
11589 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
11590 operands[2] = gen_rtx_REG (Pmode, 2);
11591 return \"lwz %0,%1(%2)\";
11593 [(set_attr "type" "load")
11594 (set_attr "update" "no")
11595 (set_attr "indexed" "no")])
11597 (define_insn "load_toc_aix_di"
11598 [(parallel [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11599 (unspec:DI [(const_int 0)] UNSPEC_TOC))
11600 (use (reg:DI 2))])]
11601 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2) && TARGET_64BIT"
11605 #ifdef TARGET_RELOCATABLE
11606 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\",
11607 !TARGET_MINIMAL_TOC || TARGET_RELOCATABLE);
11609 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
11612 strcat (buf, \"@toc\");
11613 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
11614 operands[2] = gen_rtx_REG (Pmode, 2);
11615 return \"ld %0,%1(%2)\";
11617 [(set_attr "type" "load")
11618 (set_attr "update" "no")
11619 (set_attr "indexed" "no")])
11621 (define_insn "load_toc_v4_pic_si"
11622 [(set (reg:SI LR_REGNO)
11623 (unspec:SI [(const_int 0)] UNSPEC_TOC))]
11624 "DEFAULT_ABI == ABI_V4 && flag_pic == 1 && TARGET_32BIT"
11625 "bl _GLOBAL_OFFSET_TABLE_@local-4"
11626 [(set_attr "type" "branch")
11627 (set_attr "length" "4")])
11629 (define_expand "load_toc_v4_PIC_1"
11630 [(parallel [(set (reg:SI LR_REGNO)
11631 (match_operand:SI 0 "immediate_operand" "s"))
11632 (use (unspec [(match_dup 0)] UNSPEC_TOC))])]
11633 "TARGET_ELF && DEFAULT_ABI == ABI_V4
11634 && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
11637 (define_insn "load_toc_v4_PIC_1_normal"
11638 [(set (reg:SI LR_REGNO)
11639 (match_operand:SI 0 "immediate_operand" "s"))
11640 (use (unspec [(match_dup 0)] UNSPEC_TOC))]
11641 "!TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI == ABI_V4
11642 && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
11643 "bcl 20,31,%0\\n%0:"
11644 [(set_attr "type" "branch")
11645 (set_attr "length" "4")])
11647 (define_insn "load_toc_v4_PIC_1_476"
11648 [(set (reg:SI LR_REGNO)
11649 (match_operand:SI 0 "immediate_operand" "s"))
11650 (use (unspec [(match_dup 0)] UNSPEC_TOC))]
11651 "TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI == ABI_V4
11652 && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
11656 static char templ[32];
11658 get_ppc476_thunk_name (name);
11659 sprintf (templ, \"bl %s\\n%%0:\", name);
11662 [(set_attr "type" "branch")
11663 (set_attr "length" "4")])
11665 (define_expand "load_toc_v4_PIC_1b"
11666 [(parallel [(set (reg:SI LR_REGNO)
11667 (unspec:SI [(match_operand:SI 0 "immediate_operand" "s")
11668 (label_ref (match_operand 1 "" ""))]
11671 "TARGET_ELF && DEFAULT_ABI == ABI_V4 && flag_pic == 2"
11674 (define_insn "load_toc_v4_PIC_1b_normal"
11675 [(set (reg:SI LR_REGNO)
11676 (unspec:SI [(match_operand:SI 0 "immediate_operand" "s")
11677 (label_ref (match_operand 1 "" ""))]
11680 "!TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI == ABI_V4 && flag_pic == 2"
11681 "bcl 20,31,$+8\;.long %0-$"
11682 [(set_attr "type" "branch")
11683 (set_attr "length" "8")])
11685 (define_insn "load_toc_v4_PIC_1b_476"
11686 [(set (reg:SI LR_REGNO)
11687 (unspec:SI [(match_operand:SI 0 "immediate_operand" "s")
11688 (label_ref (match_operand 1 "" ""))]
11691 "TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI == ABI_V4 && flag_pic == 2"
11695 static char templ[32];
11697 get_ppc476_thunk_name (name);
11698 sprintf (templ, \"bl %s\\n\\tb $+8\\n\\t.long %%0-$\", name);
11701 [(set_attr "type" "branch")
11702 (set_attr "length" "16")])
11704 (define_insn "load_toc_v4_PIC_2"
11705 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11706 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
11707 (minus:SI (match_operand:SI 2 "immediate_operand" "s")
11708 (match_operand:SI 3 "immediate_operand" "s")))))]
11709 "TARGET_ELF && DEFAULT_ABI == ABI_V4 && flag_pic == 2"
11711 [(set_attr "type" "load")])
11713 (define_insn "load_toc_v4_PIC_3b"
11714 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11715 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
11717 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
11718 (match_operand:SI 3 "symbol_ref_operand" "s")))))]
11719 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI == ABI_V4 && flag_pic"
11720 "addis %0,%1,%2-%3@ha")
11722 (define_insn "load_toc_v4_PIC_3c"
11723 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11724 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
11725 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
11726 (match_operand:SI 3 "symbol_ref_operand" "s"))))]
11727 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI == ABI_V4 && flag_pic"
11728 "addi %0,%1,%2-%3@l")
11730 ;; If the TOC is shared over a translation unit, as happens with all
11731 ;; the kinds of PIC that we support, we need to restore the TOC
11732 ;; pointer only when jumping over units of translation.
11733 ;; On Darwin, we need to reload the picbase.
11735 (define_expand "builtin_setjmp_receiver"
11736 [(use (label_ref (match_operand 0 "" "")))]
11737 "(DEFAULT_ABI == ABI_V4 && flag_pic == 1)
11738 || (TARGET_TOC && TARGET_MINIMAL_TOC)
11739 || (DEFAULT_ABI == ABI_DARWIN && flag_pic)"
11743 if (DEFAULT_ABI == ABI_DARWIN)
11745 rtx picrtx = gen_rtx_SYMBOL_REF (Pmode, MACHOPIC_FUNCTION_BASE_NAME);
11746 rtx picreg = gen_rtx_REG (Pmode, RS6000_PIC_OFFSET_TABLE_REGNUM);
11750 crtl->uses_pic_offset_table = 1;
11751 ASM_GENERATE_INTERNAL_LABEL(tmplab, \"LSJR\",
11752 CODE_LABEL_NUMBER (operands[0]));
11753 tmplabrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (tmplab));
11755 emit_insn (gen_load_macho_picbase (tmplabrtx));
11756 emit_move_insn (picreg, gen_rtx_REG (Pmode, LR_REGNO));
11757 emit_insn (gen_macho_correct_pic (picreg, picreg, picrtx, tmplabrtx));
11761 rs6000_emit_load_toc_table (FALSE);
11765 ;; Largetoc support
11766 (define_insn "*largetoc_high"
11767 [(set (match_operand:DI 0 "gpc_reg_operand" "=b*r")
11769 (unspec [(match_operand:DI 1 "" "")
11770 (match_operand:DI 2 "gpc_reg_operand" "b")]
11772 "TARGET_ELF && TARGET_CMODEL != CMODEL_SMALL"
11773 "addis %0,%2,%1@toc@ha")
11775 (define_insn "*largetoc_high_aix<mode>"
11776 [(set (match_operand:P 0 "gpc_reg_operand" "=b*r")
11778 (unspec [(match_operand:P 1 "" "")
11779 (match_operand:P 2 "gpc_reg_operand" "b")]
11781 "TARGET_XCOFF && TARGET_CMODEL != CMODEL_SMALL"
11782 "addis %0,%1@u(%2)")
11784 (define_insn "*largetoc_high_plus"
11785 [(set (match_operand:DI 0 "gpc_reg_operand" "=b*r")
11788 (unspec [(match_operand:DI 1 "" "")
11789 (match_operand:DI 2 "gpc_reg_operand" "b")]
11791 (match_operand:DI 3 "add_cint_operand" "n"))))]
11792 "TARGET_ELF && TARGET_CMODEL != CMODEL_SMALL"
11793 "addis %0,%2,%1+%3@toc@ha")
11795 (define_insn "*largetoc_high_plus_aix<mode>"
11796 [(set (match_operand:P 0 "gpc_reg_operand" "=b*r")
11799 (unspec [(match_operand:P 1 "" "")
11800 (match_operand:P 2 "gpc_reg_operand" "b")]
11802 (match_operand:P 3 "add_cint_operand" "n"))))]
11803 "TARGET_XCOFF && TARGET_CMODEL != CMODEL_SMALL"
11804 "addis %0,%1+%3@u(%2)")
11806 (define_insn "*largetoc_low"
11807 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
11808 (lo_sum:DI (match_operand:DI 1 "gpc_reg_operand" "b,!*r")
11809 (match_operand:DI 2 "" "")))]
11810 "TARGET_ELF && TARGET_CMODEL != CMODEL_SMALL"
11815 (define_insn "*largetoc_low_aix<mode>"
11816 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
11817 (lo_sum:P (match_operand:P 1 "gpc_reg_operand" "b")
11818 (match_operand:P 2 "" "")))]
11819 "TARGET_XCOFF && TARGET_CMODEL != CMODEL_SMALL"
11822 (define_insn_and_split "*tocref<mode>"
11823 [(set (match_operand:P 0 "gpc_reg_operand" "=b*r")
11824 (match_operand:P 1 "small_toc_ref" "R"))]
11827 "&& TARGET_CMODEL != CMODEL_SMALL && reload_completed"
11828 [(set (match_dup 0) (high:P (match_dup 1)))
11829 (set (match_dup 0) (lo_sum:P (match_dup 0) (match_dup 1)))])
11831 ;; Elf specific ways of loading addresses for non-PIC code.
11832 ;; The output of this could be r0, but we make a very strong
11833 ;; preference for a base register because it will usually
11834 ;; be needed there.
11835 (define_insn "elf_high"
11836 [(set (match_operand:SI 0 "gpc_reg_operand" "=b*r")
11837 (high:SI (match_operand 1 "" "")))]
11838 "TARGET_ELF && ! TARGET_64BIT"
11841 (define_insn "elf_low"
11842 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11843 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,!*r")
11844 (match_operand 2 "" "")))]
11845 "TARGET_ELF && ! TARGET_64BIT"
11850 ;; Call and call_value insns
11851 (define_expand "call"
11852 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
11853 (match_operand 1 "" ""))
11854 (use (match_operand 2 "" ""))
11855 (clobber (reg:SI LR_REGNO))])]
11860 if (MACHOPIC_INDIRECT)
11861 operands[0] = machopic_indirect_call_target (operands[0]);
11864 gcc_assert (GET_CODE (operands[0]) == MEM);
11865 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
11867 operands[0] = XEXP (operands[0], 0);
11869 if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
11871 rs6000_call_aix (NULL_RTX, operands[0], operands[1], operands[2]);
11875 if (GET_CODE (operands[0]) != SYMBOL_REF
11876 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[2]) & CALL_LONG) != 0))
11878 if (INTVAL (operands[2]) & CALL_LONG)
11879 operands[0] = rs6000_longcall_ref (operands[0]);
11881 switch (DEFAULT_ABI)
11885 operands[0] = force_reg (Pmode, operands[0]);
11889 gcc_unreachable ();
11894 (define_expand "call_value"
11895 [(parallel [(set (match_operand 0 "" "")
11896 (call (mem:SI (match_operand 1 "address_operand" ""))
11897 (match_operand 2 "" "")))
11898 (use (match_operand 3 "" ""))
11899 (clobber (reg:SI LR_REGNO))])]
11904 if (MACHOPIC_INDIRECT)
11905 operands[1] = machopic_indirect_call_target (operands[1]);
11908 gcc_assert (GET_CODE (operands[1]) == MEM);
11909 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
11911 operands[1] = XEXP (operands[1], 0);
11913 if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
11915 rs6000_call_aix (operands[0], operands[1], operands[2], operands[3]);
11919 if (GET_CODE (operands[1]) != SYMBOL_REF
11920 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[3]) & CALL_LONG) != 0))
11922 if (INTVAL (operands[3]) & CALL_LONG)
11923 operands[1] = rs6000_longcall_ref (operands[1]);
11925 switch (DEFAULT_ABI)
11929 operands[1] = force_reg (Pmode, operands[1]);
11933 gcc_unreachable ();
11938 ;; Call to function in current module. No TOC pointer reload needed.
11939 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
11940 ;; either the function was not prototyped, or it was prototyped as a
11941 ;; variable argument function. It is > 0 if FP registers were passed
11942 ;; and < 0 if they were not.
11944 (define_insn "*call_local32"
11945 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
11946 (match_operand 1 "" "g,g"))
11947 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11948 (clobber (reg:SI LR_REGNO))]
11949 "(INTVAL (operands[2]) & CALL_LONG) == 0"
11952 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11953 output_asm_insn (\"crxor 6,6,6\", operands);
11955 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11956 output_asm_insn (\"creqv 6,6,6\", operands);
11958 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
11960 [(set_attr "type" "branch")
11961 (set_attr "length" "4,8")])
11963 (define_insn "*call_local64"
11964 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
11965 (match_operand 1 "" "g,g"))
11966 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11967 (clobber (reg:SI LR_REGNO))]
11968 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
11971 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11972 output_asm_insn (\"crxor 6,6,6\", operands);
11974 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11975 output_asm_insn (\"creqv 6,6,6\", operands);
11977 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
11979 [(set_attr "type" "branch")
11980 (set_attr "length" "4,8")])
11982 (define_insn "*call_value_local32"
11983 [(set (match_operand 0 "" "")
11984 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
11985 (match_operand 2 "" "g,g")))
11986 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11987 (clobber (reg:SI LR_REGNO))]
11988 "(INTVAL (operands[3]) & CALL_LONG) == 0"
11991 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11992 output_asm_insn (\"crxor 6,6,6\", operands);
11994 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11995 output_asm_insn (\"creqv 6,6,6\", operands);
11997 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
11999 [(set_attr "type" "branch")
12000 (set_attr "length" "4,8")])
12003 (define_insn "*call_value_local64"
12004 [(set (match_operand 0 "" "")
12005 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
12006 (match_operand 2 "" "g,g")))
12007 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12008 (clobber (reg:SI LR_REGNO))]
12009 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
12012 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12013 output_asm_insn (\"crxor 6,6,6\", operands);
12015 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12016 output_asm_insn (\"creqv 6,6,6\", operands);
12018 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
12020 [(set_attr "type" "branch")
12021 (set_attr "length" "4,8")])
12024 ;; A function pointer under System V is just a normal pointer
12025 ;; operands[0] is the function pointer
12026 ;; operands[1] is the stack size to clean up
12027 ;; operands[2] is the value FUNCTION_ARG returns for the VOID argument
12028 ;; which indicates how to set cr1
12030 (define_insn "*call_indirect_nonlocal_sysv<mode>"
12031 [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l,c,*l"))
12032 (match_operand 1 "" "g,g,g,g"))
12033 (use (match_operand:SI 2 "immediate_operand" "O,O,n,n"))
12034 (clobber (reg:SI LR_REGNO))]
12035 "DEFAULT_ABI == ABI_V4
12036 || DEFAULT_ABI == ABI_DARWIN"
12038 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12039 output_asm_insn ("crxor 6,6,6", operands);
12041 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12042 output_asm_insn ("creqv 6,6,6", operands);
12046 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
12047 (set_attr "length" "4,4,8,8")])
12049 (define_insn_and_split "*call_nonlocal_sysv<mode>"
12050 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
12051 (match_operand 1 "" "g,g"))
12052 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12053 (clobber (reg:SI LR_REGNO))]
12054 "(DEFAULT_ABI == ABI_DARWIN
12055 || (DEFAULT_ABI == ABI_V4
12056 && (INTVAL (operands[2]) & CALL_LONG) == 0))"
12058 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12059 output_asm_insn ("crxor 6,6,6", operands);
12061 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12062 output_asm_insn ("creqv 6,6,6", operands);
12065 return output_call(insn, operands, 0, 2);
12067 if (DEFAULT_ABI == ABI_V4 && flag_pic)
12069 gcc_assert (!TARGET_SECURE_PLT);
12070 return "bl %z0@plt";
12076 "DEFAULT_ABI == ABI_V4
12077 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[0])
12078 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12079 [(parallel [(call (mem:SI (match_dup 0))
12081 (use (match_dup 2))
12082 (use (match_dup 3))
12083 (clobber (reg:SI LR_REGNO))])]
12085 operands[3] = pic_offset_table_rtx;
12087 [(set_attr "type" "branch,branch")
12088 (set_attr "length" "4,8")])
12090 (define_insn "*call_nonlocal_sysv_secure<mode>"
12091 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
12092 (match_operand 1 "" "g,g"))
12093 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12094 (use (match_operand:SI 3 "register_operand" "r,r"))
12095 (clobber (reg:SI LR_REGNO))]
12096 "(DEFAULT_ABI == ABI_V4
12097 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[0])
12098 && (INTVAL (operands[2]) & CALL_LONG) == 0)"
12100 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12101 output_asm_insn ("crxor 6,6,6", operands);
12103 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12104 output_asm_insn ("creqv 6,6,6", operands);
12107 /* The magic 32768 offset here and in the other sysv call insns
12108 corresponds to the offset of r30 in .got2, as given by LCTOC1.
12109 See sysv4.h:toc_section. */
12110 return "bl %z0+32768@plt";
12112 return "bl %z0@plt";
12114 [(set_attr "type" "branch,branch")
12115 (set_attr "length" "4,8")])
12117 (define_insn "*call_value_indirect_nonlocal_sysv<mode>"
12118 [(set (match_operand 0 "" "")
12119 (call (mem:SI (match_operand:P 1 "register_operand" "c,*l,c,*l"))
12120 (match_operand 2 "" "g,g,g,g")))
12121 (use (match_operand:SI 3 "immediate_operand" "O,O,n,n"))
12122 (clobber (reg:SI LR_REGNO))]
12123 "DEFAULT_ABI == ABI_V4
12124 || DEFAULT_ABI == ABI_DARWIN"
12126 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12127 output_asm_insn ("crxor 6,6,6", operands);
12129 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12130 output_asm_insn ("creqv 6,6,6", operands);
12134 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
12135 (set_attr "length" "4,4,8,8")])
12137 (define_insn_and_split "*call_value_nonlocal_sysv<mode>"
12138 [(set (match_operand 0 "" "")
12139 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
12140 (match_operand 2 "" "g,g")))
12141 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12142 (clobber (reg:SI LR_REGNO))]
12143 "(DEFAULT_ABI == ABI_DARWIN
12144 || (DEFAULT_ABI == ABI_V4
12145 && (INTVAL (operands[3]) & CALL_LONG) == 0))"
12147 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12148 output_asm_insn ("crxor 6,6,6", operands);
12150 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12151 output_asm_insn ("creqv 6,6,6", operands);
12154 return output_call(insn, operands, 1, 3);
12156 if (DEFAULT_ABI == ABI_V4 && flag_pic)
12158 gcc_assert (!TARGET_SECURE_PLT);
12159 return "bl %z1@plt";
12165 "DEFAULT_ABI == ABI_V4
12166 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[1])
12167 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12168 [(parallel [(set (match_dup 0)
12169 (call (mem:SI (match_dup 1))
12171 (use (match_dup 3))
12172 (use (match_dup 4))
12173 (clobber (reg:SI LR_REGNO))])]
12175 operands[4] = pic_offset_table_rtx;
12177 [(set_attr "type" "branch,branch")
12178 (set_attr "length" "4,8")])
12180 (define_insn "*call_value_nonlocal_sysv_secure<mode>"
12181 [(set (match_operand 0 "" "")
12182 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
12183 (match_operand 2 "" "g,g")))
12184 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12185 (use (match_operand:SI 4 "register_operand" "r,r"))
12186 (clobber (reg:SI LR_REGNO))]
12187 "(DEFAULT_ABI == ABI_V4
12188 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[1])
12189 && (INTVAL (operands[3]) & CALL_LONG) == 0)"
12191 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12192 output_asm_insn ("crxor 6,6,6", operands);
12194 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12195 output_asm_insn ("creqv 6,6,6", operands);
12198 return "bl %z1+32768@plt";
12200 return "bl %z1@plt";
12202 [(set_attr "type" "branch,branch")
12203 (set_attr "length" "4,8")])
12206 ;; Call to AIX abi function in the same module.
12208 (define_insn "*call_local_aix<mode>"
12209 [(call (mem:SI (match_operand:P 0 "current_file_function_operand" "s"))
12210 (match_operand 1 "" "g"))
12211 (clobber (reg:P LR_REGNO))]
12212 "DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2"
12214 [(set_attr "type" "branch")
12215 (set_attr "length" "4")])
12217 (define_insn "*call_value_local_aix<mode>"
12218 [(set (match_operand 0 "" "")
12219 (call (mem:SI (match_operand:P 1 "current_file_function_operand" "s"))
12220 (match_operand 2 "" "g")))
12221 (clobber (reg:P LR_REGNO))]
12222 "DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2"
12224 [(set_attr "type" "branch")
12225 (set_attr "length" "4")])
12227 ;; Call to AIX abi function which may be in another module.
12228 ;; Restore the TOC pointer (r2) after the call.
12230 (define_insn "*call_nonlocal_aix<mode>"
12231 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s"))
12232 (match_operand 1 "" "g"))
12233 (clobber (reg:P LR_REGNO))]
12234 "DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2"
12236 [(set_attr "type" "branch")
12237 (set_attr "length" "8")])
12239 (define_insn "*call_value_nonlocal_aix<mode>"
12240 [(set (match_operand 0 "" "")
12241 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s"))
12242 (match_operand 2 "" "g")))
12243 (clobber (reg:P LR_REGNO))]
12244 "DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2"
12246 [(set_attr "type" "branch")
12247 (set_attr "length" "8")])
12249 ;; Call to indirect functions with the AIX abi using a 3 word descriptor.
12250 ;; Operand0 is the addresss of the function to call
12251 ;; Operand2 is the location in the function descriptor to load r2 from
12252 ;; Operand3 is the stack location to hold the current TOC pointer
12254 (define_insn "*call_indirect_aix<mode>"
12255 [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l"))
12256 (match_operand 1 "" "g,g"))
12257 (use (match_operand:P 2 "memory_operand" "<ptrm>,<ptrm>"))
12258 (set (reg:P TOC_REGNUM) (match_operand:P 3 "memory_operand" "<ptrm>,<ptrm>"))
12259 (clobber (reg:P LR_REGNO))]
12260 "DEFAULT_ABI == ABI_AIX"
12261 "<ptrload> 2,%2\;b%T0l\;<ptrload> 2,%3"
12262 [(set_attr "type" "jmpreg")
12263 (set_attr "length" "12")])
12265 (define_insn "*call_value_indirect_aix<mode>"
12266 [(set (match_operand 0 "" "")
12267 (call (mem:SI (match_operand:P 1 "register_operand" "c,*l"))
12268 (match_operand 2 "" "g,g")))
12269 (use (match_operand:P 3 "memory_operand" "<ptrm>,<ptrm>"))
12270 (set (reg:P TOC_REGNUM) (match_operand:P 4 "memory_operand" "<ptrm>,<ptrm>"))
12271 (clobber (reg:P LR_REGNO))]
12272 "DEFAULT_ABI == ABI_AIX"
12273 "<ptrload> 2,%3\;b%T1l\;<ptrload> 2,%4"
12274 [(set_attr "type" "jmpreg")
12275 (set_attr "length" "12")])
12277 ;; Call to indirect functions with the ELFv2 ABI.
12278 ;; Operand0 is the addresss of the function to call
12279 ;; Operand2 is the stack location to hold the current TOC pointer
12281 (define_insn "*call_indirect_elfv2<mode>"
12282 [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l"))
12283 (match_operand 1 "" "g,g"))
12284 (set (reg:P TOC_REGNUM) (match_operand:P 2 "memory_operand" "<ptrm>,<ptrm>"))
12285 (clobber (reg:P LR_REGNO))]
12286 "DEFAULT_ABI == ABI_ELFv2"
12287 "b%T0l\;<ptrload> 2,%2"
12288 [(set_attr "type" "jmpreg")
12289 (set_attr "length" "8")])
12291 (define_insn "*call_value_indirect_elfv2<mode>"
12292 [(set (match_operand 0 "" "")
12293 (call (mem:SI (match_operand:P 1 "register_operand" "c,*l"))
12294 (match_operand 2 "" "g,g")))
12295 (set (reg:P TOC_REGNUM) (match_operand:P 3 "memory_operand" "<ptrm>,<ptrm>"))
12296 (clobber (reg:P LR_REGNO))]
12297 "DEFAULT_ABI == ABI_ELFv2"
12298 "b%T1l\;<ptrload> 2,%3"
12299 [(set_attr "type" "jmpreg")
12300 (set_attr "length" "8")])
12303 ;; Call subroutine returning any type.
12304 (define_expand "untyped_call"
12305 [(parallel [(call (match_operand 0 "" "")
12307 (match_operand 1 "" "")
12308 (match_operand 2 "" "")])]
12314 emit_call_insn (GEN_CALL (operands[0], const0_rtx, const0_rtx, const0_rtx));
12316 for (i = 0; i < XVECLEN (operands[2], 0); i++)
12318 rtx set = XVECEXP (operands[2], 0, i);
12319 emit_move_insn (SET_DEST (set), SET_SRC (set));
12322 /* The optimizer does not know that the call sets the function value
12323 registers we stored in the result block. We avoid problems by
12324 claiming that all hard registers are used and clobbered at this
12326 emit_insn (gen_blockage ());
12331 ;; sibling call patterns
12332 (define_expand "sibcall"
12333 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
12334 (match_operand 1 "" ""))
12335 (use (match_operand 2 "" ""))
12336 (use (reg:SI LR_REGNO))
12342 if (MACHOPIC_INDIRECT)
12343 operands[0] = machopic_indirect_call_target (operands[0]);
12346 gcc_assert (GET_CODE (operands[0]) == MEM);
12347 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
12349 operands[0] = XEXP (operands[0], 0);
12351 if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
12353 rs6000_sibcall_aix (NULL_RTX, operands[0], operands[1], operands[2]);
12358 (define_expand "sibcall_value"
12359 [(parallel [(set (match_operand 0 "register_operand" "")
12360 (call (mem:SI (match_operand 1 "address_operand" ""))
12361 (match_operand 2 "" "")))
12362 (use (match_operand 3 "" ""))
12363 (use (reg:SI LR_REGNO))
12369 if (MACHOPIC_INDIRECT)
12370 operands[1] = machopic_indirect_call_target (operands[1]);
12373 gcc_assert (GET_CODE (operands[1]) == MEM);
12374 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
12376 operands[1] = XEXP (operands[1], 0);
12378 if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
12380 rs6000_sibcall_aix (operands[0], operands[1], operands[2], operands[3]);
12385 ;; this and similar patterns must be marked as using LR, otherwise
12386 ;; dataflow will try to delete the store into it. This is true
12387 ;; even when the actual reg to jump to is in CTR, when LR was
12388 ;; saved and restored around the PIC-setting BCL.
12389 (define_insn "*sibcall_local32"
12390 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
12391 (match_operand 1 "" "g,g"))
12392 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12393 (use (reg:SI LR_REGNO))
12395 "(INTVAL (operands[2]) & CALL_LONG) == 0"
12398 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12399 output_asm_insn (\"crxor 6,6,6\", operands);
12401 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12402 output_asm_insn (\"creqv 6,6,6\", operands);
12404 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
12406 [(set_attr "type" "branch")
12407 (set_attr "length" "4,8")])
12409 (define_insn "*sibcall_local64"
12410 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
12411 (match_operand 1 "" "g,g"))
12412 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12413 (use (reg:SI LR_REGNO))
12415 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
12418 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12419 output_asm_insn (\"crxor 6,6,6\", operands);
12421 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12422 output_asm_insn (\"creqv 6,6,6\", operands);
12424 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
12426 [(set_attr "type" "branch")
12427 (set_attr "length" "4,8")])
12429 (define_insn "*sibcall_value_local32"
12430 [(set (match_operand 0 "" "")
12431 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
12432 (match_operand 2 "" "g,g")))
12433 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12434 (use (reg:SI LR_REGNO))
12436 "(INTVAL (operands[3]) & CALL_LONG) == 0"
12439 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12440 output_asm_insn (\"crxor 6,6,6\", operands);
12442 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12443 output_asm_insn (\"creqv 6,6,6\", operands);
12445 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
12447 [(set_attr "type" "branch")
12448 (set_attr "length" "4,8")])
12450 (define_insn "*sibcall_value_local64"
12451 [(set (match_operand 0 "" "")
12452 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
12453 (match_operand 2 "" "g,g")))
12454 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12455 (use (reg:SI LR_REGNO))
12457 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
12460 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12461 output_asm_insn (\"crxor 6,6,6\", operands);
12463 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12464 output_asm_insn (\"creqv 6,6,6\", operands);
12466 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
12468 [(set_attr "type" "branch")
12469 (set_attr "length" "4,8")])
12471 (define_insn "*sibcall_nonlocal_sysv<mode>"
12472 [(call (mem:SI (match_operand:P 0 "call_operand" "s,s,c,c"))
12473 (match_operand 1 "" ""))
12474 (use (match_operand 2 "immediate_operand" "O,n,O,n"))
12475 (use (reg:SI LR_REGNO))
12477 "(DEFAULT_ABI == ABI_DARWIN
12478 || DEFAULT_ABI == ABI_V4)
12479 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12482 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12483 output_asm_insn (\"crxor 6,6,6\", operands);
12485 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12486 output_asm_insn (\"creqv 6,6,6\", operands);
12488 if (which_alternative >= 2)
12490 else if (DEFAULT_ABI == ABI_V4 && flag_pic)
12492 gcc_assert (!TARGET_SECURE_PLT);
12493 return \"b %z0@plt\";
12498 [(set_attr "type" "branch")
12499 (set_attr "length" "4,8,4,8")])
12501 (define_insn "*sibcall_value_nonlocal_sysv<mode>"
12502 [(set (match_operand 0 "" "")
12503 (call (mem:SI (match_operand:P 1 "call_operand" "s,s,c,c"))
12504 (match_operand 2 "" "")))
12505 (use (match_operand:SI 3 "immediate_operand" "O,n,O,n"))
12506 (use (reg:SI LR_REGNO))
12508 "(DEFAULT_ABI == ABI_DARWIN
12509 || DEFAULT_ABI == ABI_V4)
12510 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12513 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12514 output_asm_insn (\"crxor 6,6,6\", operands);
12516 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12517 output_asm_insn (\"creqv 6,6,6\", operands);
12519 if (which_alternative >= 2)
12521 else if (DEFAULT_ABI == ABI_V4 && flag_pic)
12523 gcc_assert (!TARGET_SECURE_PLT);
12524 return \"b %z1@plt\";
12529 [(set_attr "type" "branch")
12530 (set_attr "length" "4,8,4,8")])
12532 ;; AIX ABI sibling call patterns.
12534 (define_insn "*sibcall_aix<mode>"
12535 [(call (mem:SI (match_operand:P 0 "call_operand" "s,c"))
12536 (match_operand 1 "" "g,g"))
12538 "DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2"
12542 [(set_attr "type" "branch")
12543 (set_attr "length" "4")])
12545 (define_insn "*sibcall_value_aix<mode>"
12546 [(set (match_operand 0 "" "")
12547 (call (mem:SI (match_operand:P 1 "call_operand" "s,c"))
12548 (match_operand 2 "" "g,g")))
12550 "DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2"
12554 [(set_attr "type" "branch")
12555 (set_attr "length" "4")])
12557 (define_expand "sibcall_epilogue"
12558 [(use (const_int 0))]
12561 if (!TARGET_SCHED_PROLOG)
12562 emit_insn (gen_blockage ());
12563 rs6000_emit_epilogue (TRUE);
12567 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
12568 ;; all of memory. This blocks insns from being moved across this point.
12570 (define_insn "blockage"
12571 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCK)]
12575 (define_expand "probe_stack"
12576 [(set (match_operand 0 "memory_operand" "=m")
12577 (unspec [(const_int 0)] UNSPEC_PROBE_STACK))]
12581 emit_insn (gen_probe_stack_di (operands[0]));
12583 emit_insn (gen_probe_stack_si (operands[0]));
12587 (define_insn "probe_stack_<mode>"
12588 [(set (match_operand:P 0 "memory_operand" "=m")
12589 (unspec:P [(const_int 0)] UNSPEC_PROBE_STACK))]
12592 operands[1] = gen_rtx_REG (Pmode, 0);
12593 return "st<wd>%U0%X0 %1,%0";
12595 [(set_attr "type" "store")
12596 (set (attr "update")
12597 (if_then_else (match_operand 0 "update_address_mem")
12598 (const_string "yes")
12599 (const_string "no")))
12600 (set (attr "indexed")
12601 (if_then_else (match_operand 0 "indexed_address_mem")
12602 (const_string "yes")
12603 (const_string "no")))
12604 (set_attr "length" "4")])
12606 (define_insn "probe_stack_range<P:mode>"
12607 [(set (match_operand:P 0 "register_operand" "=r")
12608 (unspec_volatile:P [(match_operand:P 1 "register_operand" "0")
12609 (match_operand:P 2 "register_operand" "r")]
12610 UNSPECV_PROBE_STACK_RANGE))]
12612 "* return output_probe_stack_range (operands[0], operands[2]);"
12613 [(set_attr "type" "three")])
12615 ;; Compare insns are next. Note that the RS/6000 has two types of compares,
12616 ;; signed & unsigned, and one type of branch.
12618 ;; Start with the DEFINE_EXPANDs to generate the rtl for compares, scc
12619 ;; insns, and branches.
12621 (define_expand "cbranch<mode>4"
12622 [(use (match_operator 0 "rs6000_cbranch_operator"
12623 [(match_operand:GPR 1 "gpc_reg_operand" "")
12624 (match_operand:GPR 2 "reg_or_short_operand" "")]))
12625 (use (match_operand 3 ""))]
12629 /* Take care of the possibility that operands[2] might be negative but
12630 this might be a logical operation. That insn doesn't exist. */
12631 if (GET_CODE (operands[2]) == CONST_INT
12632 && INTVAL (operands[2]) < 0)
12634 operands[2] = force_reg (<MODE>mode, operands[2]);
12635 operands[0] = gen_rtx_fmt_ee (GET_CODE (operands[0]),
12636 GET_MODE (operands[0]),
12637 operands[1], operands[2]);
12640 rs6000_emit_cbranch (<MODE>mode, operands);
12644 (define_expand "cbranch<mode>4"
12645 [(use (match_operator 0 "rs6000_cbranch_operator"
12646 [(match_operand:FP 1 "gpc_reg_operand" "")
12647 (match_operand:FP 2 "gpc_reg_operand" "")]))
12648 (use (match_operand 3 ""))]
12652 rs6000_emit_cbranch (<MODE>mode, operands);
12656 (define_expand "cstore<mode>4"
12657 [(use (match_operator 1 "rs6000_cbranch_operator"
12658 [(match_operand:GPR 2 "gpc_reg_operand" "")
12659 (match_operand:GPR 3 "reg_or_short_operand" "")]))
12660 (clobber (match_operand:SI 0 "register_operand"))]
12664 /* Take care of the possibility that operands[3] might be negative but
12665 this might be a logical operation. That insn doesn't exist. */
12666 if (GET_CODE (operands[3]) == CONST_INT
12667 && INTVAL (operands[3]) < 0)
12669 operands[3] = force_reg (<MODE>mode, operands[3]);
12670 operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]),
12671 GET_MODE (operands[1]),
12672 operands[2], operands[3]);
12675 /* For SNE, we would prefer that the xor/abs sequence be used for integers.
12676 For SEQ, likewise, except that comparisons with zero should be done
12677 with an scc insns. However, due to the order that combine see the
12678 resulting insns, we must, in fact, allow SEQ for integers. Fail in
12679 the cases we don't want to handle or are best handled by portable
12681 if (GET_CODE (operands[1]) == NE)
12683 if ((GET_CODE (operands[1]) == LT || GET_CODE (operands[1]) == LE
12684 || GET_CODE (operands[1]) == GT || GET_CODE (operands[1]) == GE)
12685 && operands[3] == const0_rtx)
12687 rs6000_emit_sCOND (<MODE>mode, operands);
12691 (define_expand "cstore<mode>4"
12692 [(use (match_operator 1 "rs6000_cbranch_operator"
12693 [(match_operand:FP 2 "gpc_reg_operand" "")
12694 (match_operand:FP 3 "gpc_reg_operand" "")]))
12695 (clobber (match_operand:SI 0 "register_operand"))]
12699 rs6000_emit_sCOND (<MODE>mode, operands);
12704 (define_expand "stack_protect_set"
12705 [(match_operand 0 "memory_operand" "")
12706 (match_operand 1 "memory_operand" "")]
12709 #ifdef TARGET_THREAD_SSP_OFFSET
12710 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
12711 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
12712 operands[1] = gen_rtx_MEM (Pmode, addr);
12715 emit_insn (gen_stack_protect_setdi (operands[0], operands[1]));
12717 emit_insn (gen_stack_protect_setsi (operands[0], operands[1]));
12721 (define_insn "stack_protect_setsi"
12722 [(set (match_operand:SI 0 "memory_operand" "=m")
12723 (unspec:SI [(match_operand:SI 1 "memory_operand" "m")] UNSPEC_SP_SET))
12724 (set (match_scratch:SI 2 "=&r") (const_int 0))]
12726 "lwz%U1%X1 %2,%1\;stw%U0%X0 %2,%0\;li %2,0"
12727 [(set_attr "type" "three")
12728 (set_attr "length" "12")])
12730 (define_insn "stack_protect_setdi"
12731 [(set (match_operand:DI 0 "memory_operand" "=Y")
12732 (unspec:DI [(match_operand:DI 1 "memory_operand" "Y")] UNSPEC_SP_SET))
12733 (set (match_scratch:DI 2 "=&r") (const_int 0))]
12735 "ld%U1%X1 %2,%1\;std%U0%X0 %2,%0\;li %2,0"
12736 [(set_attr "type" "three")
12737 (set_attr "length" "12")])
12739 (define_expand "stack_protect_test"
12740 [(match_operand 0 "memory_operand" "")
12741 (match_operand 1 "memory_operand" "")
12742 (match_operand 2 "" "")]
12745 rtx test, op0, op1;
12746 #ifdef TARGET_THREAD_SSP_OFFSET
12747 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
12748 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
12749 operands[1] = gen_rtx_MEM (Pmode, addr);
12752 op1 = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, operands[1]), UNSPEC_SP_TEST);
12753 test = gen_rtx_EQ (VOIDmode, op0, op1);
12754 emit_jump_insn (gen_cbranchsi4 (test, op0, op1, operands[2]));
12758 (define_insn "stack_protect_testsi"
12759 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
12760 (unspec:CCEQ [(match_operand:SI 1 "memory_operand" "m,m")
12761 (match_operand:SI 2 "memory_operand" "m,m")]
12763 (set (match_scratch:SI 4 "=r,r") (const_int 0))
12764 (clobber (match_scratch:SI 3 "=&r,&r"))]
12767 lwz%U1%X1 %3,%1\;lwz%U2%X2 %4,%2\;xor. %3,%3,%4\;li %4,0
12768 lwz%U1%X1 %3,%1\;lwz%U2%X2 %4,%2\;cmplw %0,%3,%4\;li %3,0\;li %4,0"
12769 [(set_attr "length" "16,20")])
12771 (define_insn "stack_protect_testdi"
12772 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
12773 (unspec:CCEQ [(match_operand:DI 1 "memory_operand" "Y,Y")
12774 (match_operand:DI 2 "memory_operand" "Y,Y")]
12776 (set (match_scratch:DI 4 "=r,r") (const_int 0))
12777 (clobber (match_scratch:DI 3 "=&r,&r"))]
12780 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;xor. %3,%3,%4\;li %4,0
12781 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;cmpld %0,%3,%4\;li %3,0\;li %4,0"
12782 [(set_attr "length" "16,20")])
12785 ;; Here are the actual compare insns.
12786 (define_insn "*cmp<mode>_internal1"
12787 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
12788 (compare:CC (match_operand:GPR 1 "gpc_reg_operand" "r")
12789 (match_operand:GPR 2 "reg_or_short_operand" "rI")))]
12791 "cmp<wd>%I2 %0,%1,%2"
12792 [(set_attr "type" "cmp")])
12794 ;; If we are comparing a register for equality with a large constant,
12795 ;; we can do this with an XOR followed by a compare. But this is profitable
12796 ;; only if the large constant is only used for the comparison (and in this
12797 ;; case we already have a register to reuse as scratch).
12799 ;; For 64-bit registers, we could only do so if the constant's bit 15 is clear:
12800 ;; otherwise we'd need to XOR with FFFFFFFF????0000 which is not available.
12803 [(set (match_operand:SI 0 "register_operand")
12804 (match_operand:SI 1 "logical_const_operand" ""))
12805 (set (match_dup 0) (match_operator:SI 3 "boolean_or_operator"
12807 (match_operand:SI 2 "logical_const_operand" "")]))
12808 (set (match_operand:CC 4 "cc_reg_operand" "")
12809 (compare:CC (match_operand:SI 5 "gpc_reg_operand" "")
12812 (if_then_else (match_operator 6 "equality_operator"
12813 [(match_dup 4) (const_int 0)])
12814 (match_operand 7 "" "")
12815 (match_operand 8 "" "")))]
12816 "peep2_reg_dead_p (3, operands[0])
12817 && peep2_reg_dead_p (4, operands[4])"
12818 [(set (match_dup 0) (xor:SI (match_dup 5) (match_dup 9)))
12819 (set (match_dup 4) (compare:CC (match_dup 0) (match_dup 10)))
12820 (set (pc) (if_then_else (match_dup 6) (match_dup 7) (match_dup 8)))]
12823 /* Get the constant we are comparing against, and see what it looks like
12824 when sign-extended from 16 to 32 bits. Then see what constant we could
12825 XOR with SEXTC to get the sign-extended value. */
12826 rtx cnst = simplify_const_binary_operation (GET_CODE (operands[3]),
12828 operands[1], operands[2]);
12829 HOST_WIDE_INT c = INTVAL (cnst);
12830 HOST_WIDE_INT sextc = ((c & 0xffff) ^ 0x8000) - 0x8000;
12831 HOST_WIDE_INT xorv = c ^ sextc;
12833 operands[9] = GEN_INT (xorv);
12834 operands[10] = GEN_INT (sextc);
12837 (define_insn "*cmpsi_internal2"
12838 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
12839 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
12840 (match_operand:SI 2 "reg_or_u_short_operand" "rK")))]
12842 "cmplw%I2 %0,%1,%b2"
12843 [(set_attr "type" "cmp")])
12845 (define_insn "*cmpdi_internal2"
12846 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
12847 (compare:CCUNS (match_operand:DI 1 "gpc_reg_operand" "r")
12848 (match_operand:DI 2 "reg_or_u_short_operand" "rK")))]
12850 "cmpld%I2 %0,%1,%b2"
12851 [(set_attr "type" "cmp")])
12853 ;; The following two insns don't exist as single insns, but if we provide
12854 ;; them, we can swap an add and compare, which will enable us to overlap more
12855 ;; of the required delay between a compare and branch. We generate code for
12856 ;; them by splitting.
12859 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
12860 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
12861 (match_operand:SI 2 "short_cint_operand" "i")))
12862 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
12863 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
12866 [(set_attr "length" "8")])
12869 [(set (match_operand:CCUNS 3 "cc_reg_operand" "=y")
12870 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
12871 (match_operand:SI 2 "u_short_cint_operand" "i")))
12872 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
12873 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
12876 [(set_attr "length" "8")])
12879 [(set (match_operand:CC 3 "cc_reg_operand" "")
12880 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
12881 (match_operand:SI 2 "short_cint_operand" "")))
12882 (set (match_operand:SI 0 "gpc_reg_operand" "")
12883 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
12885 [(set (match_dup 3) (compare:CC (match_dup 1) (match_dup 2)))
12886 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
12889 [(set (match_operand:CCUNS 3 "cc_reg_operand" "")
12890 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "")
12891 (match_operand:SI 2 "u_short_cint_operand" "")))
12892 (set (match_operand:SI 0 "gpc_reg_operand" "")
12893 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
12895 [(set (match_dup 3) (compare:CCUNS (match_dup 1) (match_dup 2)))
12896 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
12898 ;; Only need to compare second words if first words equal
12899 (define_insn "*cmptf_internal1"
12900 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
12901 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "d")
12902 (match_operand:TF 2 "gpc_reg_operand" "d")))]
12903 "!TARGET_IEEEQUAD && !TARGET_XL_COMPAT
12904 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LONG_DOUBLE_128"
12905 "fcmpu %0,%1,%2\;bne %0,$+8\;fcmpu %0,%L1,%L2"
12906 [(set_attr "type" "fpcompare")
12907 (set_attr "length" "12")])
12909 (define_insn_and_split "*cmptf_internal2"
12910 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
12911 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "d")
12912 (match_operand:TF 2 "gpc_reg_operand" "d")))
12913 (clobber (match_scratch:DF 3 "=d"))
12914 (clobber (match_scratch:DF 4 "=d"))
12915 (clobber (match_scratch:DF 5 "=d"))
12916 (clobber (match_scratch:DF 6 "=d"))
12917 (clobber (match_scratch:DF 7 "=d"))
12918 (clobber (match_scratch:DF 8 "=d"))
12919 (clobber (match_scratch:DF 9 "=d"))
12920 (clobber (match_scratch:DF 10 "=d"))
12921 (clobber (match_scratch:GPR 11 "=b"))]
12922 "!TARGET_IEEEQUAD && TARGET_XL_COMPAT
12923 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LONG_DOUBLE_128"
12925 "&& reload_completed"
12926 [(set (match_dup 3) (match_dup 14))
12927 (set (match_dup 4) (match_dup 15))
12928 (set (match_dup 9) (abs:DF (match_dup 5)))
12929 (set (match_dup 0) (compare:CCFP (match_dup 9) (match_dup 3)))
12930 (set (pc) (if_then_else (ne (match_dup 0) (const_int 0))
12931 (label_ref (match_dup 12))
12933 (set (match_dup 0) (compare:CCFP (match_dup 5) (match_dup 7)))
12934 (set (pc) (label_ref (match_dup 13)))
12936 (set (match_dup 10) (minus:DF (match_dup 5) (match_dup 7)))
12937 (set (match_dup 9) (minus:DF (match_dup 6) (match_dup 8)))
12938 (set (match_dup 9) (plus:DF (match_dup 10) (match_dup 9)))
12939 (set (match_dup 0) (compare:CCFP (match_dup 9) (match_dup 4)))
12942 REAL_VALUE_TYPE rv;
12943 const int lo_word = LONG_DOUBLE_LARGE_FIRST ? GET_MODE_SIZE (DFmode) : 0;
12944 const int hi_word = LONG_DOUBLE_LARGE_FIRST ? 0 : GET_MODE_SIZE (DFmode);
12946 operands[5] = simplify_gen_subreg (DFmode, operands[1], TFmode, hi_word);
12947 operands[6] = simplify_gen_subreg (DFmode, operands[1], TFmode, lo_word);
12948 operands[7] = simplify_gen_subreg (DFmode, operands[2], TFmode, hi_word);
12949 operands[8] = simplify_gen_subreg (DFmode, operands[2], TFmode, lo_word);
12950 operands[12] = gen_label_rtx ();
12951 operands[13] = gen_label_rtx ();
12953 operands[14] = force_const_mem (DFmode,
12954 CONST_DOUBLE_FROM_REAL_VALUE (rv, DFmode));
12955 operands[15] = force_const_mem (DFmode,
12956 CONST_DOUBLE_FROM_REAL_VALUE (dconst0,
12961 tocref = create_TOC_reference (XEXP (operands[14], 0), operands[11]);
12962 operands[14] = gen_const_mem (DFmode, tocref);
12963 tocref = create_TOC_reference (XEXP (operands[15], 0), operands[11]);
12964 operands[15] = gen_const_mem (DFmode, tocref);
12965 set_mem_alias_set (operands[14], get_TOC_alias_set ());
12966 set_mem_alias_set (operands[15], get_TOC_alias_set ());
12970 ;; Now we have the scc insns. We can do some combinations because of the
12971 ;; way the machine works.
12973 ;; Note that this is probably faster if we can put an insn between the
12974 ;; mfcr and rlinm, but this is tricky. Let's leave it for now. In most
12975 ;; cases the insns below which don't use an intermediate CR field will
12976 ;; be used instead.
12978 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12979 (match_operator:SI 1 "scc_comparison_operator"
12980 [(match_operand 2 "cc_reg_operand" "y")
12983 "mfcr %0%Q2\;rlwinm %0,%0,%J1,1"
12984 [(set (attr "type")
12985 (cond [(match_test "TARGET_MFCRF")
12986 (const_string "mfcrf")
12988 (const_string "mfcr")))
12989 (set_attr "length" "8")])
12991 ;; Same as above, but get the GT bit.
12992 (define_insn "move_from_CR_gt_bit"
12993 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12994 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_GT))]
12995 "TARGET_HARD_FLOAT && !TARGET_FPRS"
12996 "mfcr %0\;rlwinm %0,%0,%D1,31,31"
12997 [(set_attr "type" "mfcr")
12998 (set_attr "length" "8")])
13000 ;; Same as above, but get the OV/ORDERED bit.
13001 (define_insn "move_from_CR_ov_bit"
13002 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13003 (unspec:SI [(match_operand:CC 1 "cc_reg_operand" "y")]
13006 "mfcr %0\;rlwinm %0,%0,%t1,1"
13007 [(set_attr "type" "mfcr")
13008 (set_attr "length" "8")])
13011 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13012 (match_operator:DI 1 "scc_comparison_operator"
13013 [(match_operand 2 "cc_reg_operand" "y")
13016 "mfcr %0%Q2\;rlwinm %0,%0,%J1,1"
13017 [(set (attr "type")
13018 (cond [(match_test "TARGET_MFCRF")
13019 (const_string "mfcrf")
13021 (const_string "mfcr")))
13022 (set_attr "length" "8")])
13025 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13026 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
13027 [(match_operand 2 "cc_reg_operand" "y,y")
13030 (set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
13031 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
13034 mfcr %3%Q2\;rlwinm. %3,%3,%J1,1
13036 [(set_attr "type" "delayed_compare")
13037 (set_attr "length" "8,16")])
13040 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13041 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
13042 [(match_operand 2 "cc_reg_operand" "")
13045 (set (match_operand:SI 3 "gpc_reg_operand" "")
13046 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
13047 "TARGET_32BIT && reload_completed"
13048 [(set (match_dup 3)
13049 (match_op_dup 1 [(match_dup 2) (const_int 0)]))
13051 (compare:CC (match_dup 3)
13056 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13057 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
13058 [(match_operand 2 "cc_reg_operand" "y")
13060 (match_operand:SI 3 "const_int_operand" "n")))]
13064 int is_bit = ccr_bit (operands[1], 1);
13065 int put_bit = 31 - (INTVAL (operands[3]) & 31);
13068 if (is_bit >= put_bit)
13069 count = is_bit - put_bit;
13071 count = 32 - (put_bit - is_bit);
13073 operands[4] = GEN_INT (count);
13074 operands[5] = GEN_INT (put_bit);
13076 return \"mfcr %0%Q2\;rlwinm %0,%0,%4,%5,%5\";
13078 [(set (attr "type")
13079 (cond [(match_test "TARGET_MFCRF")
13080 (const_string "mfcrf")
13082 (const_string "mfcr")))
13083 (set_attr "length" "8")])
13086 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13088 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
13089 [(match_operand 2 "cc_reg_operand" "y,y")
13091 (match_operand:SI 3 "const_int_operand" "n,n"))
13093 (set (match_operand:SI 4 "gpc_reg_operand" "=r,r")
13094 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
13099 int is_bit = ccr_bit (operands[1], 1);
13100 int put_bit = 31 - (INTVAL (operands[3]) & 31);
13103 /* Force split for non-cc0 compare. */
13104 if (which_alternative == 1)
13107 if (is_bit >= put_bit)
13108 count = is_bit - put_bit;
13110 count = 32 - (put_bit - is_bit);
13112 operands[5] = GEN_INT (count);
13113 operands[6] = GEN_INT (put_bit);
13115 return \"mfcr %4%Q2\;rlwinm. %4,%4,%5,%6,%6\";
13117 [(set_attr "type" "delayed_compare")
13118 (set_attr "length" "8,16")])
13121 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
13123 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
13124 [(match_operand 2 "cc_reg_operand" "")
13126 (match_operand:SI 3 "const_int_operand" ""))
13128 (set (match_operand:SI 4 "gpc_reg_operand" "")
13129 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
13132 [(set (match_dup 4)
13133 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
13136 (compare:CC (match_dup 4)
13140 ;; There is a 3 cycle delay between consecutive mfcr instructions
13141 ;; so it is useful to combine 2 scc instructions to use only one mfcr.
13144 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13145 (match_operator:SI 1 "scc_comparison_operator"
13146 [(match_operand 2 "cc_reg_operand" "y")
13148 (set (match_operand:SI 3 "gpc_reg_operand" "=r")
13149 (match_operator:SI 4 "scc_comparison_operator"
13150 [(match_operand 5 "cc_reg_operand" "y")
13152 "REGNO (operands[2]) != REGNO (operands[5])"
13153 "mfcr %3\;rlwinm %0,%3,%J1,1\;rlwinm %3,%3,%J4,1"
13154 [(set_attr "type" "mfcr")
13155 (set_attr "length" "12")])
13158 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13159 (match_operator:DI 1 "scc_comparison_operator"
13160 [(match_operand 2 "cc_reg_operand" "y")
13162 (set (match_operand:DI 3 "gpc_reg_operand" "=r")
13163 (match_operator:DI 4 "scc_comparison_operator"
13164 [(match_operand 5 "cc_reg_operand" "y")
13166 "TARGET_POWERPC64 && REGNO (operands[2]) != REGNO (operands[5])"
13167 "mfcr %3\;rlwinm %0,%3,%J1,1\;rlwinm %3,%3,%J4,1"
13168 [(set_attr "type" "mfcr")
13169 (set_attr "length" "12")])
13171 ;; There are some scc insns that can be done directly, without a compare.
13172 ;; These are faster because they don't involve the communications between
13173 ;; the FXU and branch units. In fact, we will be replacing all of the
13174 ;; integer scc insns here or in the portable methods in emit_store_flag.
13176 ;; Also support (neg (scc ..)) since that construct is used to replace
13177 ;; branches, (plus (scc ..) ..) since that construct is common and
13178 ;; takes no more insns than scc, and (and (neg (scc ..)) ..) in the
13179 ;; cases where it is no more expensive than (neg (scc ..)).
13181 ;; Have reload force a constant into a register for the simple insns that
13182 ;; otherwise won't accept constants. We do this because it is faster than
13183 ;; the cmp/mfcr sequence we would otherwise generate.
13185 (define_mode_attr scc_eq_op2 [(SI "rKLI")
13188 (define_insn_and_split "*eq<mode>"
13189 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
13190 (eq:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
13191 (match_operand:GPR 2 "scc_eq_operand" "<scc_eq_op2>")))]
13195 [(set (match_dup 0)
13196 (clz:GPR (match_dup 3)))
13198 (lshiftrt:GPR (match_dup 0) (match_dup 4)))]
13200 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
13202 /* Use output operand as intermediate. */
13203 operands[3] = operands[0];
13205 if (logical_operand (operands[2], <MODE>mode))
13206 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13207 gen_rtx_XOR (<MODE>mode,
13208 operands[1], operands[2])));
13210 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13211 gen_rtx_PLUS (<MODE>mode, operands[1],
13212 negate_rtx (<MODE>mode,
13216 operands[3] = operands[1];
13218 operands[4] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
13221 (define_insn_and_split "*eq<mode>_compare"
13222 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
13224 (eq:P (match_operand:P 1 "gpc_reg_operand" "=r")
13225 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))
13227 (set (match_operand:P 0 "gpc_reg_operand" "=r")
13228 (eq:P (match_dup 1) (match_dup 2)))]
13232 [(set (match_dup 0)
13233 (clz:P (match_dup 4)))
13234 (parallel [(set (match_dup 3)
13235 (compare:CC (lshiftrt:P (match_dup 0) (match_dup 5))
13238 (lshiftrt:P (match_dup 0) (match_dup 5)))])]
13240 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
13242 /* Use output operand as intermediate. */
13243 operands[4] = operands[0];
13245 if (logical_operand (operands[2], <MODE>mode))
13246 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
13247 gen_rtx_XOR (<MODE>mode,
13248 operands[1], operands[2])));
13250 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
13251 gen_rtx_PLUS (<MODE>mode, operands[1],
13252 negate_rtx (<MODE>mode,
13256 operands[4] = operands[1];
13258 operands[5] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
13261 ;; We have insns of the form shown by the first define_insn below. If
13262 ;; there is something inside the comparison operation, we must split it.
13264 [(set (match_operand:SI 0 "gpc_reg_operand" "")
13265 (plus:SI (match_operator 1 "comparison_operator"
13266 [(match_operand:SI 2 "" "")
13267 (match_operand:SI 3
13268 "reg_or_cint_operand" "")])
13269 (match_operand:SI 4 "gpc_reg_operand" "")))
13270 (clobber (match_operand:SI 5 "register_operand" ""))]
13271 "! gpc_reg_operand (operands[2], SImode)"
13272 [(set (match_dup 5) (match_dup 2))
13273 (set (match_dup 0) (plus:SI (match_op_dup 1 [(match_dup 5) (match_dup 3)])
13276 (define_insn "*plus_eqsi"
13277 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r")
13278 (plus:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
13279 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I"))
13280 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r")))]
13283 xor %0,%1,%2\;subfic %0,%0,0\;addze %0,%3
13284 subfic %0,%1,0\;addze %0,%3
13285 xori %0,%1,%b2\;subfic %0,%0,0\;addze %0,%3
13286 xoris %0,%1,%u2\;subfic %0,%0,0\;addze %0,%3
13287 subfic %0,%1,%2\;subfic %0,%0,0\;addze %0,%3"
13288 [(set_attr "type" "three,two,three,three,three")
13289 (set_attr "length" "12,8,12,12,12")])
13291 (define_insn "*compare_plus_eqsi"
13292 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
13295 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
13296 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
13297 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
13299 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r"))]
13300 "TARGET_32BIT && optimize_size"
13302 xor %4,%1,%2\;subfic %4,%4,0\;addze. %4,%3
13303 subfic %4,%1,0\;addze. %4,%3
13304 xori %4,%1,%b2\;subfic %4,%4,0\;addze. %4,%3
13305 xoris %4,%1,%u2\;subfic %4,%4,0\;addze. %4,%3
13306 subfic %4,%1,%2\;subfic %4,%4,0\;addze. %4,%3
13312 [(set_attr "type" "compare")
13313 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
13316 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13319 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
13320 (match_operand:SI 2 "scc_eq_operand" ""))
13321 (match_operand:SI 3 "gpc_reg_operand" ""))
13323 (clobber (match_scratch:SI 4 ""))]
13324 "TARGET_32BIT && optimize_size && reload_completed"
13325 [(set (match_dup 4)
13326 (plus:SI (eq:SI (match_dup 1)
13330 (compare:CC (match_dup 4)
13334 (define_insn "*plus_eqsi_compare"
13335 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
13338 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
13339 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
13340 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
13342 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r")
13343 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13344 "TARGET_32BIT && optimize_size"
13346 xor %0,%1,%2\;subfic %0,%0,0\;addze. %0,%3
13347 subfic %0,%1,0\;addze. %0,%3
13348 xori %0,%1,%b2\;subfic %0,%0,0\;addze. %0,%3
13349 xoris %0,%1,%u2\;subfic %0,%0,0\;addze. %0,%3
13350 subfic %0,%1,%2\;subfic %0,%0,0\;addze. %0,%3
13356 [(set_attr "type" "compare")
13357 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
13360 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13363 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
13364 (match_operand:SI 2 "scc_eq_operand" ""))
13365 (match_operand:SI 3 "gpc_reg_operand" ""))
13367 (set (match_operand:SI 0 "gpc_reg_operand" "")
13368 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13369 "TARGET_32BIT && optimize_size && reload_completed"
13370 [(set (match_dup 0)
13371 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13373 (compare:CC (match_dup 0)
13377 (define_insn "*neg_eq0<mode>"
13378 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13379 (neg:P (eq:P (match_operand:P 1 "gpc_reg_operand" "r")
13382 "addic %0,%1,-1\;subfe %0,%0,%0"
13383 [(set_attr "type" "two")
13384 (set_attr "length" "8")])
13386 (define_insn_and_split "*neg_eq<mode>"
13387 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13388 (neg:P (eq:P (match_operand:P 1 "gpc_reg_operand" "%r")
13389 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))))]
13393 [(set (match_dup 0) (neg:P (eq:P (match_dup 3) (const_int 0))))]
13395 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
13397 /* Use output operand as intermediate. */
13398 operands[3] = operands[0];
13400 if (logical_operand (operands[2], <MODE>mode))
13401 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13402 gen_rtx_XOR (<MODE>mode,
13403 operands[1], operands[2])));
13405 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13406 gen_rtx_PLUS (<MODE>mode, operands[1],
13407 negate_rtx (<MODE>mode,
13411 operands[3] = operands[1];
13414 (define_insn "*ne0_<mode>"
13415 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13416 (ne:P (match_operand:P 1 "gpc_reg_operand" "r")
13418 (clobber (match_scratch:P 2 "=&r"))]
13419 "!(TARGET_32BIT && TARGET_ISEL)"
13420 "addic %2,%1,-1\;subfe %0,%2,%1"
13421 [(set_attr "type" "two")
13422 (set_attr "length" "8")])
13424 (define_insn "*plus_ne0_<mode>"
13425 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13426 (plus:P (ne:P (match_operand:P 1 "gpc_reg_operand" "r")
13428 (match_operand:P 2 "gpc_reg_operand" "r")))
13429 (clobber (match_scratch:P 3 "=&r"))]
13431 "addic %3,%1,-1\;addze %0,%2"
13432 [(set_attr "type" "two")
13433 (set_attr "length" "8")])
13435 (define_insn "*compare_plus_ne0_<mode>"
13436 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13437 (compare:CC (plus:P (ne:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13439 (match_operand:P 2 "gpc_reg_operand" "r,r"))
13441 (clobber (match_scratch:P 3 "=&r,&r"))
13442 (clobber (match_scratch:P 4 "=X,&r"))]
13445 addic %3,%1,-1\;addze. %3,%2
13447 [(set_attr "type" "compare")
13448 (set_attr "length" "8,12")])
13451 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
13452 (compare:CC (ne:P (match_operand:SI 1 "gpc_reg_operand" "")
13454 (neg:P (match_operand:P 2 "gpc_reg_operand" ""))))
13455 (clobber (match_scratch:P 3 ""))
13456 (clobber (match_scratch:P 4 ""))]
13458 [(parallel [(set (match_dup 3)
13459 (plus:P (ne:P (match_dup 1)
13462 (clobber (match_dup 4))])
13464 (compare:CC (match_dup 3)
13469 (define_insn "*compare_plus_ne0_<mode>_1"
13470 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
13471 (compare:CCEQ (ne:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13473 (neg:P (match_operand:P 2 "gpc_reg_operand" "r,r"))))
13474 (clobber (match_scratch:P 3 "=&r,&r"))
13475 (clobber (match_scratch:P 4 "=X,&r"))]
13478 addic %3,%1,-1\;addze. %3,%2
13480 [(set_attr "type" "compare")
13481 (set_attr "length" "8,12")])
13484 [(set (match_operand:CCEQ 0 "cc_reg_not_micro_cr0_operand" "")
13485 (compare:CCEQ (ne:P (match_operand:SI 1 "gpc_reg_operand" "")
13487 (neg:P (match_operand:P 2 "gpc_reg_operand" ""))))
13488 (clobber (match_scratch:P 3 ""))
13489 (clobber (match_scratch:P 4 ""))]
13491 [(parallel [(set (match_dup 3)
13492 (plus:P (ne:P (match_dup 1)
13495 (clobber (match_dup 4))])
13497 (compare:CC (match_dup 3)
13501 (define_insn "*plus_ne0_<mode>_compare"
13502 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13504 (plus:P (ne:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13506 (match_operand:P 2 "gpc_reg_operand" "r,r"))
13508 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13509 (plus:P (ne:P (match_dup 1)
13512 (clobber (match_scratch:P 3 "=&r,&r"))]
13515 addic %3,%1,-1\;addze. %0,%2
13517 [(set_attr "type" "compare")
13518 (set_attr "length" "8,12")])
13521 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
13523 (plus:P (ne:P (match_operand:P 1 "gpc_reg_operand" "")
13525 (match_operand:P 2 "gpc_reg_operand" ""))
13527 (set (match_operand:P 0 "gpc_reg_operand" "")
13528 (plus:P (ne:P (match_dup 1)
13531 (clobber (match_scratch:P 3 ""))]
13533 [(parallel [(set (match_dup 0)
13534 (plus:P (ne:P (match_dup 1)
13537 (clobber (match_dup 3))])
13539 (compare:CC (match_dup 0)
13543 (define_insn "*leu<mode>"
13544 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13545 (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
13546 (match_operand:P 2 "reg_or_short_operand" "rI")))]
13548 "subf%I2c %0,%1,%2\;li %0,0\;adde %0,%0,%0"
13549 [(set_attr "type" "three")
13550 (set_attr "length" "12")])
13552 (define_insn "*leu<mode>_compare"
13553 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13555 (leu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13556 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
13558 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13559 (leu:P (match_dup 1) (match_dup 2)))]
13562 subf%I2c %0,%1,%2\;li %0,0\;adde. %0,%0,%0
13564 [(set_attr "type" "compare")
13565 (set_attr "length" "12,16")])
13568 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13570 (leu:P (match_operand:P 1 "gpc_reg_operand" "")
13571 (match_operand:P 2 "reg_or_short_operand" ""))
13573 (set (match_operand:P 0 "gpc_reg_operand" "")
13574 (leu:P (match_dup 1) (match_dup 2)))]
13576 [(set (match_dup 0)
13577 (leu:P (match_dup 1) (match_dup 2)))
13579 (compare:CC (match_dup 0)
13583 (define_insn "*plus_leu<mode>"
13584 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
13585 (plus:P (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
13586 (match_operand:P 2 "reg_or_short_operand" "rI"))
13587 (match_operand:P 3 "gpc_reg_operand" "r")))]
13589 "subf%I2c %0,%1,%2\;addze %0,%3"
13590 [(set_attr "type" "two")
13591 (set_attr "length" "8")])
13594 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13596 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13597 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13598 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13600 (clobber (match_scratch:SI 4 "=&r,&r"))]
13603 subf%I2c %4,%1,%2\;addze. %4,%3
13605 [(set_attr "type" "compare")
13606 (set_attr "length" "8,12")])
13609 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13611 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13612 (match_operand:SI 2 "reg_or_short_operand" ""))
13613 (match_operand:SI 3 "gpc_reg_operand" ""))
13615 (clobber (match_scratch:SI 4 ""))]
13616 "TARGET_32BIT && reload_completed"
13617 [(set (match_dup 4)
13618 (plus:SI (leu:SI (match_dup 1) (match_dup 2))
13621 (compare:CC (match_dup 4)
13626 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13628 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13629 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13630 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13632 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13633 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13636 subf%I2c %0,%1,%2\;addze. %0,%3
13638 [(set_attr "type" "compare")
13639 (set_attr "length" "8,12")])
13642 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13644 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13645 (match_operand:SI 2 "reg_or_short_operand" ""))
13646 (match_operand:SI 3 "gpc_reg_operand" ""))
13648 (set (match_operand:SI 0 "gpc_reg_operand" "")
13649 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13650 "TARGET_32BIT && reload_completed"
13651 [(set (match_dup 0)
13652 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13654 (compare:CC (match_dup 0)
13658 (define_insn "*neg_leu<mode>"
13659 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13660 (neg:P (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
13661 (match_operand:P 2 "reg_or_short_operand" "rI"))))]
13663 "subf%I2c %0,%1,%2\;subfe %0,%0,%0\;nand %0,%0,%0"
13664 [(set_attr "type" "three")
13665 (set_attr "length" "12")])
13667 (define_insn "*and_neg_leu<mode>"
13668 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
13670 (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
13671 (match_operand:P 2 "reg_or_short_operand" "rI")))
13672 (match_operand:P 3 "gpc_reg_operand" "r")))]
13674 "subf%I2c %0,%1,%2\;subfe %0,%0,%0\;andc %0,%3,%0"
13675 [(set_attr "type" "three")
13676 (set_attr "length" "12")])
13679 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13682 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13683 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
13684 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13686 (clobber (match_scratch:SI 4 "=&r,&r"))]
13689 subf%I2c %4,%1,%2\;subfe %4,%4,%4\;andc. %4,%3,%4
13691 [(set_attr "type" "compare")
13692 (set_attr "length" "12,16")])
13695 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13698 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13699 (match_operand:SI 2 "reg_or_short_operand" "")))
13700 (match_operand:SI 3 "gpc_reg_operand" ""))
13702 (clobber (match_scratch:SI 4 ""))]
13703 "TARGET_32BIT && reload_completed"
13704 [(set (match_dup 4)
13705 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
13708 (compare:CC (match_dup 4)
13713 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13716 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13717 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
13718 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13720 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13721 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13724 subf%I2c %0,%1,%2\;subfe %0,%0,%0\;andc. %0,%3,%0
13726 [(set_attr "type" "compare")
13727 (set_attr "length" "12,16")])
13730 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13733 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13734 (match_operand:SI 2 "reg_or_short_operand" "")))
13735 (match_operand:SI 3 "gpc_reg_operand" ""))
13737 (set (match_operand:SI 0 "gpc_reg_operand" "")
13738 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13739 "TARGET_32BIT && reload_completed"
13740 [(set (match_dup 0)
13741 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
13744 (compare:CC (match_dup 0)
13748 (define_insn_and_split "*ltu<mode>"
13749 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13750 (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13751 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))]
13755 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
13756 (set (match_dup 0) (neg:P (match_dup 0)))]
13759 (define_insn_and_split "*ltu<mode>_compare"
13760 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
13762 (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
13763 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
13765 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
13766 (ltu:P (match_dup 1) (match_dup 2)))]
13770 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
13771 (parallel [(set (match_dup 3)
13772 (compare:CC (neg:P (match_dup 0)) (const_int 0)))
13773 (set (match_dup 0) (neg:P (match_dup 0)))])]
13776 (define_insn_and_split "*plus_ltu<mode>"
13777 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,r")
13778 (plus:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13779 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))
13780 (match_operand:P 3 "reg_or_short_operand" "rI,rI")))]
13783 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13784 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
13785 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))]
13788 (define_insn_and_split "*plus_ltu<mode>_compare"
13789 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13791 (plus:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
13792 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
13793 (match_operand:P 3 "gpc_reg_operand" "r,r,r,r"))
13795 (set (match_operand:P 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13796 (plus:P (ltu:P (match_dup 1) (match_dup 2)) (match_dup 3)))]
13799 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13800 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
13801 (parallel [(set (match_dup 4)
13802 (compare:CC (minus:P (match_dup 3) (match_dup 0))
13804 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))])]
13807 (define_insn "*neg_ltu<mode>"
13808 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13809 (neg:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13810 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))))]
13813 subfc %0,%2,%1\;subfe %0,%0,%0
13814 addic %0,%1,%n2\;subfe %0,%0,%0"
13815 [(set_attr "type" "two")
13816 (set_attr "length" "8")])
13818 (define_insn "*geu<mode>"
13819 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13820 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13821 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))]
13824 subfc %0,%2,%1\;li %0,0\;adde %0,%0,%0
13825 addic %0,%1,%n2\;li %0,0\;adde %0,%0,%0"
13826 [(set_attr "type" "three")
13827 (set_attr "length" "12")])
13829 (define_insn "*geu<mode>_compare"
13830 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
13832 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
13833 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
13835 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
13836 (geu:P (match_dup 1) (match_dup 2)))]
13839 subfc %0,%2,%1\;li %0,0\;adde. %0,%0,%0
13840 addic %0,%1,%n2\;li %0,0\;adde. %0,%0,%0
13843 [(set_attr "type" "compare")
13844 (set_attr "length" "12,12,16,16")])
13847 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
13849 (geu:P (match_operand:P 1 "gpc_reg_operand" "")
13850 (match_operand:P 2 "reg_or_neg_short_operand" ""))
13852 (set (match_operand:P 0 "gpc_reg_operand" "")
13853 (geu:P (match_dup 1) (match_dup 2)))]
13855 [(set (match_dup 0)
13856 (geu:P (match_dup 1) (match_dup 2)))
13858 (compare:CC (match_dup 0)
13862 (define_insn "*plus_geu<mode>"
13863 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,&r")
13864 (plus:P (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13865 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))
13866 (match_operand:P 3 "gpc_reg_operand" "r,r")))]
13869 subfc %0,%2,%1\;addze %0,%3
13870 addic %0,%1,%n2\;addze %0,%3"
13871 [(set_attr "type" "two")
13872 (set_attr "length" "8")])
13875 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13877 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13878 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
13879 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13881 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
13884 subfc %4,%2,%1\;addze. %4,%3
13885 addic %4,%1,%n2\;addze. %4,%3
13888 [(set_attr "type" "compare")
13889 (set_attr "length" "8,8,12,12")])
13892 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13894 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13895 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
13896 (match_operand:SI 3 "gpc_reg_operand" ""))
13898 (clobber (match_scratch:SI 4 ""))]
13899 "TARGET_32BIT && reload_completed"
13900 [(set (match_dup 4)
13901 (plus:SI (geu:SI (match_dup 1) (match_dup 2))
13904 (compare:CC (match_dup 4)
13909 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13911 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13912 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
13913 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13915 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13916 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13919 subfc %0,%2,%1\;addze. %0,%3
13920 addic %0,%1,%n2\;addze. %0,%3
13923 [(set_attr "type" "compare")
13924 (set_attr "length" "8,8,12,12")])
13927 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13929 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13930 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
13931 (match_operand:SI 3 "gpc_reg_operand" ""))
13933 (set (match_operand:SI 0 "gpc_reg_operand" "")
13934 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13935 "TARGET_32BIT && reload_completed"
13936 [(set (match_dup 0)
13937 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13939 (compare:CC (match_dup 0)
13943 (define_insn "*neg_geu<mode>"
13944 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13945 (neg:P (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13946 (match_operand:P 2 "reg_or_short_operand" "r,I"))))]
13949 subfc %0,%2,%1\;subfe %0,%0,%0\;nand %0,%0,%0
13950 subfic %0,%1,-1\;add%I2c %0,%0,%2\;subfe %0,%0,%0"
13951 [(set_attr "type" "three")
13952 (set_attr "length" "12")])
13954 (define_insn "*and_neg_geu<mode>"
13955 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,&r")
13957 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13958 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))
13959 (match_operand:P 3 "gpc_reg_operand" "r,r")))]
13962 subfc %0,%2,%1\;subfe %0,%0,%0\;andc %0,%3,%0
13963 addic %0,%1,%n2\;subfe %0,%0,%0\;andc %0,%3,%0"
13964 [(set_attr "type" "three")
13965 (set_attr "length" "12")])
13968 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13971 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13972 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
13973 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13975 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
13978 subfc %4,%2,%1\;subfe %4,%4,%4\;andc. %4,%3,%4
13979 addic %4,%1,%n2\;subfe %4,%4,%4\;andc. %4,%3,%4
13982 [(set_attr "type" "compare")
13983 (set_attr "length" "12,12,16,16")])
13986 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13989 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13990 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
13991 (match_operand:SI 3 "gpc_reg_operand" ""))
13993 (clobber (match_scratch:SI 4 ""))]
13994 "TARGET_32BIT && reload_completed"
13995 [(set (match_dup 4)
13996 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2)))
13999 (compare:CC (match_dup 4)
14004 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
14007 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14008 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
14009 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
14011 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
14012 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
14015 subfc %0,%2,%1\;subfe %0,%0,%0\;andc. %0,%3,%0
14016 addic %0,%1,%n2\;subfe %0,%0,%0\;andc. %0,%3,%0
14019 [(set_attr "type" "compare")
14020 (set_attr "length" "12,12,16,16")])
14023 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14026 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14027 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
14028 (match_operand:SI 3 "gpc_reg_operand" ""))
14030 (set (match_operand:SI 0 "gpc_reg_operand" "")
14031 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
14032 "TARGET_32BIT && reload_completed"
14033 [(set (match_dup 0)
14034 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
14036 (compare:CC (match_dup 0)
14040 (define_insn "*plus_gt0<mode>"
14041 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
14042 (plus:P (gt:P (match_operand:P 1 "gpc_reg_operand" "r")
14044 (match_operand:P 2 "gpc_reg_operand" "r")))]
14046 "addc %0,%1,%1\;subfe %0,%1,%0\;addze %0,%2"
14047 [(set_attr "type" "three")
14048 (set_attr "length" "12")])
14051 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
14053 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14055 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
14057 (clobber (match_scratch:SI 3 "=&r,&r"))]
14060 addc %3,%1,%1\;subfe %3,%1,%3\;addze. %3,%2
14062 [(set_attr "type" "compare")
14063 (set_attr "length" "12,16")])
14066 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14068 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14070 (match_operand:SI 2 "gpc_reg_operand" ""))
14072 (clobber (match_scratch:SI 3 ""))]
14073 "TARGET_32BIT && reload_completed"
14074 [(set (match_dup 3)
14075 (plus:SI (gt:SI (match_dup 1) (const_int 0))
14078 (compare:CC (match_dup 3)
14083 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
14085 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
14087 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
14089 (clobber (match_scratch:DI 3 "=&r,&r"))]
14092 addc %3,%1,%1\;subfe %3,%1,%3\;addze. %3,%2
14094 [(set_attr "type" "compare")
14095 (set_attr "length" "12,16")])
14098 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
14100 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
14102 (match_operand:DI 2 "gpc_reg_operand" ""))
14104 (clobber (match_scratch:DI 3 ""))]
14105 "TARGET_64BIT && reload_completed"
14106 [(set (match_dup 3)
14107 (plus:DI (gt:DI (match_dup 1) (const_int 0))
14110 (compare:CC (match_dup 3)
14115 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
14117 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14119 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
14121 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
14122 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
14125 addc %0,%1,%1\;subfe %0,%1,%0\;addze. %0,%2
14127 [(set_attr "type" "compare")
14128 (set_attr "length" "12,16")])
14131 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
14133 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14135 (match_operand:SI 2 "gpc_reg_operand" ""))
14137 (set (match_operand:SI 0 "gpc_reg_operand" "")
14138 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
14139 "TARGET_32BIT && reload_completed"
14140 [(set (match_dup 0)
14141 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))
14143 (compare:CC (match_dup 0)
14148 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
14150 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
14152 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
14154 (set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
14155 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
14158 addc %0,%1,%1\;subfe %0,%1,%0\;addze. %0,%2
14160 [(set_attr "type" "compare")
14161 (set_attr "length" "12,16")])
14164 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
14166 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
14168 (match_operand:DI 2 "gpc_reg_operand" ""))
14170 (set (match_operand:DI 0 "gpc_reg_operand" "")
14171 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
14172 "TARGET_64BIT && reload_completed"
14173 [(set (match_dup 0)
14174 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))
14176 (compare:CC (match_dup 0)
14180 (define_insn_and_split "*gtu<mode>"
14181 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
14182 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
14183 (match_operand:P 2 "reg_or_short_operand" "rI")))]
14187 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
14188 (set (match_dup 0) (neg:P (match_dup 0)))]
14191 (define_insn_and_split "*gtu<mode>_compare"
14192 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
14194 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14195 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
14197 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
14198 (gtu:P (match_dup 1) (match_dup 2)))]
14202 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
14203 (parallel [(set (match_dup 3)
14204 (compare:CC (neg:P (match_dup 0)) (const_int 0)))
14205 (set (match_dup 0) (neg:P (match_dup 0)))])]
14208 (define_insn_and_split "*plus_gtu<mode>"
14209 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
14210 (plus:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
14211 (match_operand:P 2 "reg_or_short_operand" "rI"))
14212 (match_operand:P 3 "reg_or_short_operand" "rI")))]
14215 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
14216 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
14217 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))]
14220 (define_insn_and_split "*plus_gtu<mode>_compare"
14221 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
14223 (plus:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
14224 (match_operand:P 2 "reg_or_short_operand" "I,r,I,r"))
14225 (match_operand:P 3 "gpc_reg_operand" "r,r,r,r"))
14227 (set (match_operand:P 0 "gpc_reg_operand" "=&r,&r,&r,&r")
14228 (plus:P (gtu:P (match_dup 1) (match_dup 2)) (match_dup 3)))]
14231 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
14232 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
14233 (parallel [(set (match_dup 4)
14234 (compare:CC (minus:P (match_dup 3) (match_dup 0))
14236 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))])]
14239 (define_insn "*neg_gtu<mode>"
14240 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
14241 (neg:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
14242 (match_operand:P 2 "reg_or_short_operand" "rI"))))]
14244 "subf%I2c %0,%1,%2\;subfe %0,%0,%0"
14245 [(set_attr "type" "two")
14246 (set_attr "length" "8")])
14249 ;; Define both directions of branch and return. If we need a reload
14250 ;; register, we'd rather use CR0 since it is much easier to copy a
14251 ;; register CC value to there.
14255 (if_then_else (match_operator 1 "branch_comparison_operator"
14257 "cc_reg_operand" "y")
14259 (label_ref (match_operand 0 "" ""))
14264 return output_cbranch (operands[1], \"%l0\", 0, insn);
14266 [(set_attr "type" "branch")])
14270 (if_then_else (match_operator 0 "branch_comparison_operator"
14272 "cc_reg_operand" "y")
14279 return output_cbranch (operands[0], NULL, 0, insn);
14281 [(set_attr "type" "jmpreg")
14282 (set_attr "length" "4")])
14286 (if_then_else (match_operator 1 "branch_comparison_operator"
14288 "cc_reg_operand" "y")
14291 (label_ref (match_operand 0 "" ""))))]
14295 return output_cbranch (operands[1], \"%l0\", 1, insn);
14297 [(set_attr "type" "branch")])
14301 (if_then_else (match_operator 0 "branch_comparison_operator"
14303 "cc_reg_operand" "y")
14310 return output_cbranch (operands[0], NULL, 1, insn);
14312 [(set_attr "type" "jmpreg")
14313 (set_attr "length" "4")])
14315 ;; Logic on condition register values.
14317 ; This pattern matches things like
14318 ; (set (reg:CCEQ 68) (compare:CCEQ (ior:SI (gt:SI (reg:CCFP 68) (const_int 0))
14319 ; (eq:SI (reg:CCFP 68) (const_int 0)))
14321 ; which are generated by the branch logic.
14322 ; Prefer destructive operations where BT = BB (for crXX BT,BA,BB)
14324 (define_insn "*cceq_ior_compare"
14325 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
14326 (compare:CCEQ (match_operator:SI 1 "boolean_operator"
14327 [(match_operator:SI 2
14328 "branch_positive_comparison_operator"
14330 "cc_reg_operand" "y,y")
14332 (match_operator:SI 4
14333 "branch_positive_comparison_operator"
14335 "cc_reg_operand" "0,y")
14339 "cr%q1 %E0,%j2,%j4"
14340 [(set_attr "type" "cr_logical,delayed_cr")])
14342 ; Why is the constant -1 here, but 1 in the previous pattern?
14343 ; Because ~1 has all but the low bit set.
14345 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
14346 (compare:CCEQ (match_operator:SI 1 "boolean_or_operator"
14347 [(not:SI (match_operator:SI 2
14348 "branch_positive_comparison_operator"
14350 "cc_reg_operand" "y,y")
14352 (match_operator:SI 4
14353 "branch_positive_comparison_operator"
14355 "cc_reg_operand" "0,y")
14359 "cr%q1 %E0,%j2,%j4"
14360 [(set_attr "type" "cr_logical,delayed_cr")])
14362 (define_insn "*cceq_rev_compare"
14363 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
14364 (compare:CCEQ (match_operator:SI 1
14365 "branch_positive_comparison_operator"
14367 "cc_reg_operand" "0,y")
14372 [(set_attr "type" "cr_logical,delayed_cr")])
14374 ;; If we are comparing the result of two comparisons, this can be done
14375 ;; using creqv or crxor.
14377 (define_insn_and_split ""
14378 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
14379 (compare:CCEQ (match_operator 1 "branch_comparison_operator"
14380 [(match_operand 2 "cc_reg_operand" "y")
14382 (match_operator 3 "branch_comparison_operator"
14383 [(match_operand 4 "cc_reg_operand" "y")
14388 [(set (match_dup 0) (compare:CCEQ (xor:SI (match_dup 1) (match_dup 3))
14392 int positive_1, positive_2;
14394 positive_1 = branch_positive_comparison_operator (operands[1],
14395 GET_MODE (operands[1]));
14396 positive_2 = branch_positive_comparison_operator (operands[3],
14397 GET_MODE (operands[3]));
14400 operands[1] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[2]),
14401 GET_CODE (operands[1])),
14403 operands[2], const0_rtx);
14404 else if (GET_MODE (operands[1]) != SImode)
14405 operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]), SImode,
14406 operands[2], const0_rtx);
14409 operands[3] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[4]),
14410 GET_CODE (operands[3])),
14412 operands[4], const0_rtx);
14413 else if (GET_MODE (operands[3]) != SImode)
14414 operands[3] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
14415 operands[4], const0_rtx);
14417 if (positive_1 == positive_2)
14419 operands[1] = gen_rtx_NOT (SImode, operands[1]);
14420 operands[5] = constm1_rtx;
14424 operands[5] = const1_rtx;
14428 ;; Unconditional branch and return.
14430 (define_insn "jump"
14432 (label_ref (match_operand 0 "" "")))]
14435 [(set_attr "type" "branch")])
14437 (define_insn "<return_str>return"
14441 [(set_attr "type" "jmpreg")])
14443 (define_expand "indirect_jump"
14444 [(set (pc) (match_operand 0 "register_operand" ""))])
14446 (define_insn "*indirect_jump<mode>"
14447 [(set (pc) (match_operand:P 0 "register_operand" "c,*l"))]
14452 [(set_attr "type" "jmpreg")])
14454 ;; Table jump for switch statements:
14455 (define_expand "tablejump"
14456 [(use (match_operand 0 "" ""))
14457 (use (label_ref (match_operand 1 "" "")))]
14462 emit_jump_insn (gen_tablejumpsi (operands[0], operands[1]));
14464 emit_jump_insn (gen_tablejumpdi (operands[0], operands[1]));
14468 (define_expand "tablejumpsi"
14469 [(set (match_dup 3)
14470 (plus:SI (match_operand:SI 0 "" "")
14472 (parallel [(set (pc) (match_dup 3))
14473 (use (label_ref (match_operand 1 "" "")))])]
14476 { operands[0] = force_reg (SImode, operands[0]);
14477 operands[2] = force_reg (SImode, gen_rtx_LABEL_REF (SImode, operands[1]));
14478 operands[3] = gen_reg_rtx (SImode);
14481 (define_expand "tablejumpdi"
14482 [(set (match_dup 4)
14483 (sign_extend:DI (match_operand:SI 0 "lwa_operand" "")))
14485 (plus:DI (match_dup 4)
14487 (parallel [(set (pc) (match_dup 3))
14488 (use (label_ref (match_operand 1 "" "")))])]
14491 { operands[2] = force_reg (DImode, gen_rtx_LABEL_REF (DImode, operands[1]));
14492 operands[3] = gen_reg_rtx (DImode);
14493 operands[4] = gen_reg_rtx (DImode);
14496 (define_insn "*tablejump<mode>_internal1"
14498 (match_operand:P 0 "register_operand" "c,*l"))
14499 (use (label_ref (match_operand 1 "" "")))]
14504 [(set_attr "type" "jmpreg")])
14511 (define_insn "group_ending_nop"
14512 [(unspec [(const_int 0)] UNSPEC_GRP_END_NOP)]
14516 if (rs6000_cpu_attr == CPU_POWER6)
14517 return \"ori 1,1,0\";
14518 return \"ori 2,2,0\";
14521 ;; Define the subtract-one-and-jump insns, starting with the template
14522 ;; so loop.c knows what to generate.
14524 (define_expand "doloop_end"
14525 [(use (match_operand 0 "" "")) ; loop pseudo
14526 (use (match_operand 1 "" ""))] ; label
14532 if (GET_MODE (operands[0]) != DImode)
14534 emit_jump_insn (gen_ctrdi (operands[0], operands[1]));
14538 if (GET_MODE (operands[0]) != SImode)
14540 emit_jump_insn (gen_ctrsi (operands[0], operands[1]));
14545 (define_expand "ctr<mode>"
14546 [(parallel [(set (pc)
14547 (if_then_else (ne (match_operand:P 0 "register_operand" "")
14549 (label_ref (match_operand 1 "" ""))
14552 (plus:P (match_dup 0)
14554 (clobber (match_scratch:CC 2 ""))
14555 (clobber (match_scratch:P 3 ""))])]
14559 ;; We need to be able to do this for any operand, including MEM, or we
14560 ;; will cause reload to blow up since we don't allow output reloads on
14562 ;; For the length attribute to be calculated correctly, the
14563 ;; label MUST be operand 0.
14565 (define_insn "*ctr<mode>_internal1"
14567 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
14569 (label_ref (match_operand 0 "" ""))
14571 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*c*l")
14572 (plus:P (match_dup 1)
14574 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14575 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
14579 if (which_alternative != 0)
14581 else if (get_attr_length (insn) == 4)
14582 return \"bdnz %l0\";
14584 return \"bdz $+8\;b %l0\";
14586 [(set_attr "type" "branch")
14587 (set_attr "length" "*,12,16,16")])
14589 (define_insn "*ctr<mode>_internal2"
14591 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
14594 (label_ref (match_operand 0 "" ""))))
14595 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*c*l")
14596 (plus:P (match_dup 1)
14598 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14599 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
14603 if (which_alternative != 0)
14605 else if (get_attr_length (insn) == 4)
14606 return \"bdz %l0\";
14608 return \"bdnz $+8\;b %l0\";
14610 [(set_attr "type" "branch")
14611 (set_attr "length" "*,12,16,16")])
14613 ;; Similar but use EQ
14615 (define_insn "*ctr<mode>_internal5"
14617 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
14619 (label_ref (match_operand 0 "" ""))
14621 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*c*l")
14622 (plus:P (match_dup 1)
14624 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14625 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
14629 if (which_alternative != 0)
14631 else if (get_attr_length (insn) == 4)
14632 return \"bdz %l0\";
14634 return \"bdnz $+8\;b %l0\";
14636 [(set_attr "type" "branch")
14637 (set_attr "length" "*,12,16,16")])
14639 (define_insn "*ctr<mode>_internal6"
14641 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
14644 (label_ref (match_operand 0 "" ""))))
14645 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*c*l")
14646 (plus:P (match_dup 1)
14648 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14649 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
14653 if (which_alternative != 0)
14655 else if (get_attr_length (insn) == 4)
14656 return \"bdnz %l0\";
14658 return \"bdz $+8\;b %l0\";
14660 [(set_attr "type" "branch")
14661 (set_attr "length" "*,12,16,16")])
14663 ;; Now the splitters if we could not allocate the CTR register
14667 (if_then_else (match_operator 2 "comparison_operator"
14668 [(match_operand:P 1 "gpc_reg_operand" "")
14670 (match_operand 5 "" "")
14671 (match_operand 6 "" "")))
14672 (set (match_operand:P 0 "gpc_reg_operand" "")
14673 (plus:P (match_dup 1) (const_int -1)))
14674 (clobber (match_scratch:CC 3 ""))
14675 (clobber (match_scratch:P 4 ""))]
14677 [(parallel [(set (match_dup 3)
14678 (compare:CC (plus:P (match_dup 1)
14682 (plus:P (match_dup 1)
14684 (set (pc) (if_then_else (match_dup 7)
14688 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
14689 operands[3], const0_rtx); }")
14693 (if_then_else (match_operator 2 "comparison_operator"
14694 [(match_operand:P 1 "gpc_reg_operand" "")
14696 (match_operand 5 "" "")
14697 (match_operand 6 "" "")))
14698 (set (match_operand:P 0 "nonimmediate_operand" "")
14699 (plus:P (match_dup 1) (const_int -1)))
14700 (clobber (match_scratch:CC 3 ""))
14701 (clobber (match_scratch:P 4 ""))]
14702 "reload_completed && ! gpc_reg_operand (operands[0], SImode)"
14703 [(parallel [(set (match_dup 3)
14704 (compare:CC (plus:P (match_dup 1)
14708 (plus:P (match_dup 1)
14712 (set (pc) (if_then_else (match_dup 7)
14716 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
14717 operands[3], const0_rtx); }")
14719 (define_insn "trap"
14720 [(trap_if (const_int 1) (const_int 0))]
14723 [(set_attr "type" "trap")])
14725 (define_expand "ctrap<mode>4"
14726 [(trap_if (match_operator 0 "ordered_comparison_operator"
14727 [(match_operand:GPR 1 "register_operand")
14728 (match_operand:GPR 2 "reg_or_short_operand")])
14729 (match_operand 3 "zero_constant" ""))]
14734 [(trap_if (match_operator 0 "ordered_comparison_operator"
14735 [(match_operand:GPR 1 "register_operand" "r")
14736 (match_operand:GPR 2 "reg_or_short_operand" "rI")])
14739 "t<wd>%V0%I2 %1,%2"
14740 [(set_attr "type" "trap")])
14742 ;; Insns related to generating the function prologue and epilogue.
14744 (define_expand "prologue"
14745 [(use (const_int 0))]
14748 rs6000_emit_prologue ();
14749 if (!TARGET_SCHED_PROLOG)
14750 emit_insn (gen_blockage ());
14754 (define_insn "*movesi_from_cr_one"
14755 [(match_parallel 0 "mfcr_operation"
14756 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
14757 (unspec:SI [(match_operand:CC 2 "cc_reg_operand" "y")
14758 (match_operand 3 "immediate_operand" "n")]
14759 UNSPEC_MOVESI_FROM_CR))])]
14765 for (i = 0; i < XVECLEN (operands[0], 0); i++)
14767 mask = INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
14768 operands[4] = GEN_INT (mask);
14769 output_asm_insn (\"mfcr %1,%4\", operands);
14773 [(set_attr "type" "mfcrf")])
14775 (define_insn "movesi_from_cr"
14776 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14777 (unspec:SI [(reg:CC CR0_REGNO) (reg:CC CR1_REGNO)
14778 (reg:CC CR2_REGNO) (reg:CC CR3_REGNO)
14779 (reg:CC CR4_REGNO) (reg:CC CR5_REGNO)
14780 (reg:CC CR6_REGNO) (reg:CC CR7_REGNO)]
14781 UNSPEC_MOVESI_FROM_CR))]
14784 [(set_attr "type" "mfcr")])
14786 (define_insn "*crsave"
14787 [(match_parallel 0 "crsave_operation"
14788 [(set (match_operand:SI 1 "memory_operand" "=m")
14789 (match_operand:SI 2 "gpc_reg_operand" "r"))])]
14792 [(set_attr "type" "store")])
14794 (define_insn "*stmw"
14795 [(match_parallel 0 "stmw_operation"
14796 [(set (match_operand:SI 1 "memory_operand" "=m")
14797 (match_operand:SI 2 "gpc_reg_operand" "r"))])]
14800 [(set_attr "type" "store")
14801 (set_attr "update" "yes")
14802 (set_attr "indexed" "yes")])
14804 ; The following comment applies to:
14808 ; return_and_restore_gpregs*
14809 ; return_and_restore_fpregs*
14810 ; return_and_restore_fpregs_aix*
14812 ; The out-of-line save / restore functions expects one input argument.
14813 ; Since those are not standard call_insn's, we must avoid using
14814 ; MATCH_OPERAND for that argument. That way the register rename
14815 ; optimization will not try to rename this register.
14816 ; Each pattern is repeated for each possible register number used in
14817 ; various ABIs (r11, r1, and for some functions r12)
14819 (define_insn "*save_gpregs_<mode>_r11"
14820 [(match_parallel 0 "any_parallel_operand"
14821 [(clobber (reg:P 65))
14822 (use (match_operand:P 1 "symbol_ref_operand" "s"))
14824 (set (match_operand:P 2 "memory_operand" "=m")
14825 (match_operand:P 3 "gpc_reg_operand" "r"))])]
14828 [(set_attr "type" "branch")
14829 (set_attr "length" "4")])
14831 (define_insn "*save_gpregs_<mode>_r12"
14832 [(match_parallel 0 "any_parallel_operand"
14833 [(clobber (reg:P 65))
14834 (use (match_operand:P 1 "symbol_ref_operand" "s"))
14836 (set (match_operand:P 2 "memory_operand" "=m")
14837 (match_operand:P 3 "gpc_reg_operand" "r"))])]
14840 [(set_attr "type" "branch")
14841 (set_attr "length" "4")])
14843 (define_insn "*save_gpregs_<mode>_r1"
14844 [(match_parallel 0 "any_parallel_operand"
14845 [(clobber (reg:P 65))
14846 (use (match_operand:P 1 "symbol_ref_operand" "s"))
14848 (set (match_operand:P 2 "memory_operand" "=m")
14849 (match_operand:P 3 "gpc_reg_operand" "r"))])]
14852 [(set_attr "type" "branch")
14853 (set_attr "length" "4")])
14855 (define_insn "*save_fpregs_<mode>_r11"
14856 [(match_parallel 0 "any_parallel_operand"
14857 [(clobber (reg:P 65))
14858 (use (match_operand:P 1 "symbol_ref_operand" "s"))
14860 (set (match_operand:DF 2 "memory_operand" "=m")
14861 (match_operand:DF 3 "gpc_reg_operand" "d"))])]
14864 [(set_attr "type" "branch")
14865 (set_attr "length" "4")])
14867 (define_insn "*save_fpregs_<mode>_r12"
14868 [(match_parallel 0 "any_parallel_operand"
14869 [(clobber (reg:P 65))
14870 (use (match_operand:P 1 "symbol_ref_operand" "s"))
14872 (set (match_operand:DF 2 "memory_operand" "=m")
14873 (match_operand:DF 3 "gpc_reg_operand" "d"))])]
14876 [(set_attr "type" "branch")
14877 (set_attr "length" "4")])
14879 (define_insn "*save_fpregs_<mode>_r1"
14880 [(match_parallel 0 "any_parallel_operand"
14881 [(clobber (reg:P 65))
14882 (use (match_operand:P 1 "symbol_ref_operand" "s"))
14884 (set (match_operand:DF 2 "memory_operand" "=m")
14885 (match_operand:DF 3 "gpc_reg_operand" "d"))])]
14888 [(set_attr "type" "branch")
14889 (set_attr "length" "4")])
14891 ; This is to explain that changes to the stack pointer should
14892 ; not be moved over loads from or stores to stack memory.
14893 (define_insn "stack_tie"
14894 [(match_parallel 0 "tie_operand"
14895 [(set (mem:BLK (reg 1)) (const_int 0))])]
14898 [(set_attr "length" "0")])
14900 (define_expand "epilogue"
14901 [(use (const_int 0))]
14904 if (!TARGET_SCHED_PROLOG)
14905 emit_insn (gen_blockage ());
14906 rs6000_emit_epilogue (FALSE);
14910 ; On some processors, doing the mtcrf one CC register at a time is
14911 ; faster (like on the 604e). On others, doing them all at once is
14912 ; faster; for instance, on the 601 and 750.
14914 (define_expand "movsi_to_cr_one"
14915 [(set (match_operand:CC 0 "cc_reg_operand" "")
14916 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "")
14917 (match_dup 2)] UNSPEC_MOVESI_TO_CR))]
14919 "operands[2] = GEN_INT (1 << (75 - REGNO (operands[0])));")
14921 (define_insn "*movsi_to_cr"
14922 [(match_parallel 0 "mtcrf_operation"
14923 [(set (match_operand:CC 1 "cc_reg_operand" "=y")
14924 (unspec:CC [(match_operand:SI 2 "gpc_reg_operand" "r")
14925 (match_operand 3 "immediate_operand" "n")]
14926 UNSPEC_MOVESI_TO_CR))])]
14932 for (i = 0; i < XVECLEN (operands[0], 0); i++)
14933 mask |= INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
14934 operands[4] = GEN_INT (mask);
14935 return \"mtcrf %4,%2\";
14937 [(set_attr "type" "mtcr")])
14939 (define_insn "*mtcrfsi"
14940 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
14941 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
14942 (match_operand 2 "immediate_operand" "n")]
14943 UNSPEC_MOVESI_TO_CR))]
14944 "GET_CODE (operands[0]) == REG
14945 && CR_REGNO_P (REGNO (operands[0]))
14946 && GET_CODE (operands[2]) == CONST_INT
14947 && INTVAL (operands[2]) == 1 << (75 - REGNO (operands[0]))"
14949 [(set_attr "type" "mtcr")])
14951 ; The load-multiple instructions have similar properties.
14952 ; Note that "load_multiple" is a name known to the machine-independent
14953 ; code that actually corresponds to the PowerPC load-string.
14955 (define_insn "*lmw"
14956 [(match_parallel 0 "lmw_operation"
14957 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
14958 (match_operand:SI 2 "memory_operand" "m"))])]
14961 [(set_attr "type" "load")
14962 (set_attr "update" "yes")
14963 (set_attr "indexed" "yes")
14964 (set_attr "cell_micro" "always")])
14966 (define_insn "*return_internal_<mode>"
14968 (use (match_operand:P 0 "register_operand" "lc"))]
14971 [(set_attr "type" "jmpreg")])
14973 ; FIXME: This would probably be somewhat simpler if the Cygnus sibcall
14974 ; stuff was in GCC. Oh, and "any_parallel_operand" is a bit flexible...
14976 ; The following comment applies to:
14980 ; return_and_restore_gpregs*
14981 ; return_and_restore_fpregs*
14982 ; return_and_restore_fpregs_aix*
14984 ; The out-of-line save / restore functions expects one input argument.
14985 ; Since those are not standard call_insn's, we must avoid using
14986 ; MATCH_OPERAND for that argument. That way the register rename
14987 ; optimization will not try to rename this register.
14988 ; Each pattern is repeated for each possible register number used in
14989 ; various ABIs (r11, r1, and for some functions r12)
14991 (define_insn "*restore_gpregs_<mode>_r11"
14992 [(match_parallel 0 "any_parallel_operand"
14993 [(clobber (match_operand:P 1 "register_operand" "=l"))
14994 (use (match_operand:P 2 "symbol_ref_operand" "s"))
14996 (set (match_operand:P 3 "gpc_reg_operand" "=r")
14997 (match_operand:P 4 "memory_operand" "m"))])]
15000 [(set_attr "type" "branch")
15001 (set_attr "length" "4")])
15003 (define_insn "*restore_gpregs_<mode>_r12"
15004 [(match_parallel 0 "any_parallel_operand"
15005 [(clobber (match_operand:P 1 "register_operand" "=l"))
15006 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15008 (set (match_operand:P 3 "gpc_reg_operand" "=r")
15009 (match_operand:P 4 "memory_operand" "m"))])]
15012 [(set_attr "type" "branch")
15013 (set_attr "length" "4")])
15015 (define_insn "*restore_gpregs_<mode>_r1"
15016 [(match_parallel 0 "any_parallel_operand"
15017 [(clobber (match_operand:P 1 "register_operand" "=l"))
15018 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15020 (set (match_operand:P 3 "gpc_reg_operand" "=r")
15021 (match_operand:P 4 "memory_operand" "m"))])]
15024 [(set_attr "type" "branch")
15025 (set_attr "length" "4")])
15027 (define_insn "*return_and_restore_gpregs_<mode>_r11"
15028 [(match_parallel 0 "any_parallel_operand"
15030 (clobber (match_operand:P 1 "register_operand" "=l"))
15031 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15033 (set (match_operand:P 3 "gpc_reg_operand" "=r")
15034 (match_operand:P 4 "memory_operand" "m"))])]
15037 [(set_attr "type" "branch")
15038 (set_attr "length" "4")])
15040 (define_insn "*return_and_restore_gpregs_<mode>_r12"
15041 [(match_parallel 0 "any_parallel_operand"
15043 (clobber (match_operand:P 1 "register_operand" "=l"))
15044 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15046 (set (match_operand:P 3 "gpc_reg_operand" "=r")
15047 (match_operand:P 4 "memory_operand" "m"))])]
15050 [(set_attr "type" "branch")
15051 (set_attr "length" "4")])
15053 (define_insn "*return_and_restore_gpregs_<mode>_r1"
15054 [(match_parallel 0 "any_parallel_operand"
15056 (clobber (match_operand:P 1 "register_operand" "=l"))
15057 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15059 (set (match_operand:P 3 "gpc_reg_operand" "=r")
15060 (match_operand:P 4 "memory_operand" "m"))])]
15063 [(set_attr "type" "branch")
15064 (set_attr "length" "4")])
15066 (define_insn "*return_and_restore_fpregs_<mode>_r11"
15067 [(match_parallel 0 "any_parallel_operand"
15069 (clobber (match_operand:P 1 "register_operand" "=l"))
15070 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15072 (set (match_operand:DF 3 "gpc_reg_operand" "=d")
15073 (match_operand:DF 4 "memory_operand" "m"))])]
15076 [(set_attr "type" "branch")
15077 (set_attr "length" "4")])
15079 (define_insn "*return_and_restore_fpregs_<mode>_r12"
15080 [(match_parallel 0 "any_parallel_operand"
15082 (clobber (match_operand:P 1 "register_operand" "=l"))
15083 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15085 (set (match_operand:DF 3 "gpc_reg_operand" "=d")
15086 (match_operand:DF 4 "memory_operand" "m"))])]
15089 [(set_attr "type" "branch")
15090 (set_attr "length" "4")])
15092 (define_insn "*return_and_restore_fpregs_<mode>_r1"
15093 [(match_parallel 0 "any_parallel_operand"
15095 (clobber (match_operand:P 1 "register_operand" "=l"))
15096 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15098 (set (match_operand:DF 3 "gpc_reg_operand" "=d")
15099 (match_operand:DF 4 "memory_operand" "m"))])]
15102 [(set_attr "type" "branch")
15103 (set_attr "length" "4")])
15105 (define_insn "*return_and_restore_fpregs_aix_<mode>_r11"
15106 [(match_parallel 0 "any_parallel_operand"
15108 (use (match_operand:P 1 "register_operand" "l"))
15109 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15111 (set (match_operand:DF 3 "gpc_reg_operand" "=d")
15112 (match_operand:DF 4 "memory_operand" "m"))])]
15115 [(set_attr "type" "branch")
15116 (set_attr "length" "4")])
15118 (define_insn "*return_and_restore_fpregs_aix_<mode>_r1"
15119 [(match_parallel 0 "any_parallel_operand"
15121 (use (match_operand:P 1 "register_operand" "l"))
15122 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15124 (set (match_operand:DF 3 "gpc_reg_operand" "=d")
15125 (match_operand:DF 4 "memory_operand" "m"))])]
15128 [(set_attr "type" "branch")
15129 (set_attr "length" "4")])
15131 ; This is used in compiling the unwind routines.
15132 (define_expand "eh_return"
15133 [(use (match_operand 0 "general_operand" ""))]
15138 emit_insn (gen_eh_set_lr_si (operands[0]));
15140 emit_insn (gen_eh_set_lr_di (operands[0]));
15144 ; We can't expand this before we know where the link register is stored.
15145 (define_insn "eh_set_lr_<mode>"
15146 [(unspec_volatile [(match_operand:P 0 "register_operand" "r")]
15148 (clobber (match_scratch:P 1 "=&b"))]
15153 [(unspec_volatile [(match_operand 0 "register_operand" "")] UNSPECV_EH_RR)
15154 (clobber (match_scratch 1 ""))]
15159 rs6000_emit_eh_reg_restore (operands[0], operands[1]);
15163 (define_insn "prefetch"
15164 [(prefetch (match_operand 0 "indexed_or_indirect_address" "a")
15165 (match_operand:SI 1 "const_int_operand" "n")
15166 (match_operand:SI 2 "const_int_operand" "n"))]
15170 if (GET_CODE (operands[0]) == REG)
15171 return INTVAL (operands[1]) ? \"dcbtst 0,%0\" : \"dcbt 0,%0\";
15172 return INTVAL (operands[1]) ? \"dcbtst %a0\" : \"dcbt %a0\";
15174 [(set_attr "type" "load")])
15176 (define_insn "bpermd_<mode>"
15177 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
15178 (unspec:P [(match_operand:P 1 "gpc_reg_operand" "r")
15179 (match_operand:P 2 "gpc_reg_operand" "r")] UNSPEC_BPERM))]
15182 [(set_attr "type" "popcnt")])
15185 ;; Builtin fma support. Handle
15186 ;; Note that the conditions for expansion are in the FMA_F iterator.
15188 (define_expand "fma<mode>4"
15189 [(set (match_operand:FMA_F 0 "register_operand" "")
15191 (match_operand:FMA_F 1 "register_operand" "")
15192 (match_operand:FMA_F 2 "register_operand" "")
15193 (match_operand:FMA_F 3 "register_operand" "")))]
15197 (define_insn "*fma<mode>4_fpr"
15198 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>,<Fv>")
15200 (match_operand:SFDF 1 "gpc_reg_operand" "%<Ff>,<Fv>,<Fv>")
15201 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>,0")
15202 (match_operand:SFDF 3 "gpc_reg_operand" "<Ff>,0,<Fv>")))]
15203 "TARGET_<MODE>_FPR"
15205 fmadd<Ftrad> %0,%1,%2,%3
15206 xsmadda<Fvsx> %x0,%x1,%x2
15207 xsmaddm<Fvsx> %x0,%x1,%x3"
15208 [(set_attr "type" "fp")
15209 (set_attr "fp_type" "fp_maddsub_<Fs>")])
15211 ; Altivec only has fma and nfms.
15212 (define_expand "fms<mode>4"
15213 [(set (match_operand:FMA_F 0 "register_operand" "")
15215 (match_operand:FMA_F 1 "register_operand" "")
15216 (match_operand:FMA_F 2 "register_operand" "")
15217 (neg:FMA_F (match_operand:FMA_F 3 "register_operand" ""))))]
15218 "!VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
15221 (define_insn "*fms<mode>4_fpr"
15222 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>,<Fv>")
15224 (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>,<Fv>")
15225 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>,0")
15226 (neg:SFDF (match_operand:SFDF 3 "gpc_reg_operand" "<Ff>,0,<Fv>"))))]
15227 "TARGET_<MODE>_FPR"
15229 fmsub<Ftrad> %0,%1,%2,%3
15230 xsmsuba<Fvsx> %x0,%x1,%x2
15231 xsmsubm<Fvsx> %x0,%x1,%x3"
15232 [(set_attr "type" "fp")
15233 (set_attr "fp_type" "fp_maddsub_<Fs>")])
15235 ;; If signed zeros are ignored, -(a * b - c) = -a * b + c.
15236 (define_expand "fnma<mode>4"
15237 [(set (match_operand:FMA_F 0 "register_operand" "")
15240 (match_operand:FMA_F 1 "register_operand" "")
15241 (match_operand:FMA_F 2 "register_operand" "")
15242 (neg:FMA_F (match_operand:FMA_F 3 "register_operand" "")))))]
15243 "!HONOR_SIGNED_ZEROS (<MODE>mode)"
15246 ;; If signed zeros are ignored, -(a * b + c) = -a * b - c.
15247 (define_expand "fnms<mode>4"
15248 [(set (match_operand:FMA_F 0 "register_operand" "")
15251 (match_operand:FMA_F 1 "register_operand" "")
15252 (match_operand:FMA_F 2 "register_operand" "")
15253 (match_operand:FMA_F 3 "register_operand" ""))))]
15254 "!HONOR_SIGNED_ZEROS (<MODE>mode) && !VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
15257 ; Not an official optab name, but used from builtins.
15258 (define_expand "nfma<mode>4"
15259 [(set (match_operand:FMA_F 0 "register_operand" "")
15262 (match_operand:FMA_F 1 "register_operand" "")
15263 (match_operand:FMA_F 2 "register_operand" "")
15264 (match_operand:FMA_F 3 "register_operand" ""))))]
15265 "!VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
15268 (define_insn "*nfma<mode>4_fpr"
15269 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>,<Fv>")
15272 (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>,<Fv>")
15273 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>,0")
15274 (match_operand:SFDF 3 "gpc_reg_operand" "<Ff>,0,<Fv>"))))]
15275 "TARGET_<MODE>_FPR"
15277 fnmadd<Ftrad> %0,%1,%2,%3
15278 xsnmadda<Fvsx> %x0,%x1,%x2
15279 xsnmaddm<Fvsx> %x0,%x1,%x3"
15280 [(set_attr "type" "fp")
15281 (set_attr "fp_type" "fp_maddsub_<Fs>")])
15283 ; Not an official optab name, but used from builtins.
15284 (define_expand "nfms<mode>4"
15285 [(set (match_operand:FMA_F 0 "register_operand" "")
15288 (match_operand:FMA_F 1 "register_operand" "")
15289 (match_operand:FMA_F 2 "register_operand" "")
15290 (neg:FMA_F (match_operand:FMA_F 3 "register_operand" "")))))]
15294 (define_insn "*nfmssf4_fpr"
15295 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>,<Fv>")
15298 (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>,<Fv>")
15299 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>,0")
15301 (match_operand:SFDF 3 "gpc_reg_operand" "<Ff>,0,<Fv>")))))]
15302 "TARGET_<MODE>_FPR"
15304 fnmsub<Ftrad> %0,%1,%2,%3
15305 xsnmsuba<Fvsx> %x0,%x1,%x2
15306 xsnmsubm<Fvsx> %x0,%x1,%x3"
15307 [(set_attr "type" "fp")
15308 (set_attr "fp_type" "fp_maddsub_<Fs>")])
15311 (define_expand "rs6000_get_timebase"
15312 [(use (match_operand:DI 0 "gpc_reg_operand" ""))]
15315 if (TARGET_POWERPC64)
15316 emit_insn (gen_rs6000_mftb_di (operands[0]));
15318 emit_insn (gen_rs6000_get_timebase_ppc32 (operands[0]));
15322 (define_insn "rs6000_get_timebase_ppc32"
15323 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
15324 (unspec_volatile:DI [(const_int 0)] UNSPECV_MFTB))
15325 (clobber (match_scratch:SI 1 "=r"))
15326 (clobber (match_scratch:CC 2 "=y"))]
15327 "!TARGET_POWERPC64"
15329 if (WORDS_BIG_ENDIAN)
15332 return "mfspr %0,269\;"
15340 return "mftbu %0\;"
15349 return "mfspr %L0,269\;"
15357 return "mftbu %L0\;"
15364 [(set_attr "length" "20")])
15366 (define_insn "rs6000_mftb_<mode>"
15367 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
15368 (unspec_volatile:P [(const_int 0)] UNSPECV_MFTB))]
15372 return "mfspr %0,268";
15378 (define_insn "rs6000_mffs"
15379 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
15380 (unspec_volatile:DF [(const_int 0)] UNSPECV_MFFS))]
15381 "TARGET_HARD_FLOAT && TARGET_FPRS"
15384 (define_insn "rs6000_mtfsf"
15385 [(unspec_volatile [(match_operand:SI 0 "const_int_operand" "i")
15386 (match_operand:DF 1 "gpc_reg_operand" "d")]
15388 "TARGET_HARD_FLOAT && TARGET_FPRS"
15392 ;; Power8 fusion support for fusing an addis instruction with a D-form load of
15393 ;; a GPR. The addis instruction must be adjacent to the load, and use the same
15394 ;; register that is being loaded. The fused ops must be physically adjacent.
15396 ;; We use define_peephole for the actual addis/load, and the register used to
15397 ;; hold the addis value must be the same as the register being loaded. We use
15398 ;; define_peephole2 to change the register used for addis to be the register
15399 ;; being loaded, since we can look at whether it is dead after the load insn.
15402 [(set (match_operand:P 0 "base_reg_operand" "")
15403 (match_operand:P 1 "fusion_gpr_addis" ""))
15404 (set (match_operand:INT1 2 "base_reg_operand" "")
15405 (match_operand:INT1 3 "fusion_gpr_mem_load" ""))]
15406 "TARGET_P8_FUSION && fusion_gpr_load_p (operands, false)"
15408 return emit_fusion_gpr_load (operands);
15410 [(set_attr "type" "load")
15411 (set_attr "length" "8")])
15414 [(set (match_operand:P 0 "base_reg_operand" "")
15415 (match_operand:P 1 "fusion_gpr_addis" ""))
15416 (set (match_operand:INT1 2 "base_reg_operand" "")
15417 (match_operand:INT1 3 "fusion_gpr_mem_load" ""))]
15419 && (REGNO (operands[0]) != REGNO (operands[2])
15420 || GET_CODE (operands[3]) == SIGN_EXTEND)
15421 && fusion_gpr_load_p (operands, true)"
15424 expand_fusion_gpr_load (operands);
15429 ;; Miscellaneous ISA 2.06 (power7) instructions
15430 (define_insn "addg6s"
15431 [(set (match_operand:SI 0 "register_operand" "=r")
15432 (unspec:SI [(match_operand:SI 1 "register_operand" "r")
15433 (match_operand:SI 2 "register_operand" "r")]
15437 [(set_attr "type" "integer")
15438 (set_attr "length" "4")])
15440 (define_insn "cdtbcd"
15441 [(set (match_operand:SI 0 "register_operand" "=r")
15442 (unspec:SI [(match_operand:SI 1 "register_operand" "r")]
15446 [(set_attr "type" "integer")
15447 (set_attr "length" "4")])
15449 (define_insn "cbcdtd"
15450 [(set (match_operand:SI 0 "register_operand" "=r")
15451 (unspec:SI [(match_operand:SI 1 "register_operand" "r")]
15455 [(set_attr "type" "integer")
15456 (set_attr "length" "4")])
15458 (define_int_iterator UNSPEC_DIV_EXTEND [UNSPEC_DIVE
15463 (define_int_attr div_extend [(UNSPEC_DIVE "e")
15464 (UNSPEC_DIVEO "eo")
15465 (UNSPEC_DIVEU "eu")
15466 (UNSPEC_DIVEUO "euo")])
15468 (define_insn "div<div_extend>_<mode>"
15469 [(set (match_operand:GPR 0 "register_operand" "=r")
15470 (unspec:GPR [(match_operand:GPR 1 "register_operand" "r")
15471 (match_operand:GPR 2 "register_operand" "r")]
15472 UNSPEC_DIV_EXTEND))]
15474 "div<wd><div_extend> %0,%1,%2"
15475 [(set_attr "type" "<idiv_ldiv>")])
15478 ;; Pack/unpack 128-bit floating point types that take 2 scalar registers
15480 ; Type of the 64-bit part when packing/unpacking 128-bit floating point types
15481 (define_mode_attr FP128_64 [(TF "DF") (TD "DI")])
15483 (define_expand "unpack<mode>"
15484 [(set (match_operand:<FP128_64> 0 "nonimmediate_operand" "")
15486 [(match_operand:FMOVE128 1 "register_operand" "")
15487 (match_operand:QI 2 "const_0_to_1_operand" "")]
15488 UNSPEC_UNPACK_128BIT))]
15492 ;; The Advance Toolchain 7.0-3 added private builtins: __builtin_longdouble_dw0
15493 ;; and __builtin_longdouble_dw1 to optimize glibc. Add support for these
15496 (define_expand "unpacktf_0"
15497 [(set (match_operand:DF 0 "nonimmediate_operand" "")
15498 (unspec:DF [(match_operand:TF 1 "register_operand" "")
15500 UNSPEC_UNPACK_128BIT))]
15504 (define_expand "unpacktf_1"
15505 [(set (match_operand:DF 0 "nonimmediate_operand" "")
15506 (unspec:DF [(match_operand:TF 1 "register_operand" "")
15508 UNSPEC_UNPACK_128BIT))]
15512 (define_insn_and_split "unpack<mode>_dm"
15513 [(set (match_operand:<FP128_64> 0 "nonimmediate_operand" "=d,m,d,r,m")
15515 [(match_operand:FMOVE128 1 "register_operand" "d,d,r,d,r")
15516 (match_operand:QI 2 "const_0_to_1_operand" "i,i,i,i,i")]
15517 UNSPEC_UNPACK_128BIT))]
15518 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
15520 "&& reload_completed"
15521 [(set (match_dup 0) (match_dup 3))]
15523 unsigned fp_regno = REGNO (operands[1]) + UINTVAL (operands[2]);
15525 if (REG_P (operands[0]) && REGNO (operands[0]) == fp_regno)
15527 emit_note (NOTE_INSN_DELETED);
15531 operands[3] = gen_rtx_REG (<FP128_64>mode, fp_regno);
15533 [(set_attr "type" "fp,fpstore,mffgpr,mftgpr,store")
15534 (set_attr "length" "4")])
15536 (define_insn_and_split "unpack<mode>_nodm"
15537 [(set (match_operand:<FP128_64> 0 "nonimmediate_operand" "=d,m")
15539 [(match_operand:FMOVE128 1 "register_operand" "d,d")
15540 (match_operand:QI 2 "const_0_to_1_operand" "i,i")]
15541 UNSPEC_UNPACK_128BIT))]
15542 "!TARGET_POWERPC64 || !TARGET_DIRECT_MOVE"
15544 "&& reload_completed"
15545 [(set (match_dup 0) (match_dup 3))]
15547 unsigned fp_regno = REGNO (operands[1]) + UINTVAL (operands[2]);
15549 if (REG_P (operands[0]) && REGNO (operands[0]) == fp_regno)
15551 emit_note (NOTE_INSN_DELETED);
15555 operands[3] = gen_rtx_REG (<FP128_64>mode, fp_regno);
15557 [(set_attr "type" "fp,fpstore")
15558 (set_attr "length" "4")])
15560 (define_insn_and_split "pack<mode>"
15561 [(set (match_operand:FMOVE128 0 "register_operand" "=d,&d")
15563 [(match_operand:<FP128_64> 1 "register_operand" "0,d")
15564 (match_operand:<FP128_64> 2 "register_operand" "d,d")]
15565 UNSPEC_PACK_128BIT))]
15570 "&& reload_completed && REGNO (operands[0]) != REGNO (operands[1])"
15571 [(set (match_dup 3) (match_dup 1))
15572 (set (match_dup 4) (match_dup 2))]
15574 unsigned dest_hi = REGNO (operands[0]);
15575 unsigned dest_lo = dest_hi + 1;
15577 gcc_assert (!IN_RANGE (REGNO (operands[1]), dest_hi, dest_lo));
15578 gcc_assert (!IN_RANGE (REGNO (operands[2]), dest_hi, dest_lo));
15580 operands[3] = gen_rtx_REG (<FP128_64>mode, dest_hi);
15581 operands[4] = gen_rtx_REG (<FP128_64>mode, dest_lo);
15583 [(set_attr "type" "fp,fp")
15584 (set_attr "length" "4,8")])
15586 (define_insn "unpackv1ti"
15587 [(set (match_operand:DI 0 "register_operand" "=d,d")
15588 (unspec:DI [(match_operand:V1TI 1 "register_operand" "0,wa")
15589 (match_operand:QI 2 "const_0_to_1_operand" "O,i")]
15590 UNSPEC_UNPACK_128BIT))]
15593 if (REGNO (operands[0]) == REGNO (operands[1]) && INTVAL (operands[2]) == 0)
15594 return ASM_COMMENT_START " xxpermdi to same register";
15596 operands[3] = GEN_INT (INTVAL (operands[2]) == 0 ? 0 : 3);
15597 return "xxpermdi %x0,%x1,%x1,%3";
15599 [(set_attr "type" "vecperm")
15600 (set_attr "length" "4")])
15602 (define_insn "packv1ti"
15603 [(set (match_operand:V1TI 0 "register_operand" "=wa")
15605 [(match_operand:DI 1 "register_operand" "d")
15606 (match_operand:DI 2 "register_operand" "d")]
15607 UNSPEC_PACK_128BIT))]
15609 "xxpermdi %x0,%x1,%x2,0"
15610 [(set_attr "type" "vecperm")
15611 (set_attr "length" "4")])
15615 (include "sync.md")
15616 (include "vector.md")
15618 (include "altivec.md")
15621 (include "paired.md")
15622 (include "crypto.md")