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)
59 (FIRST_SPE_HIGH_REGNO 117)
60 (LAST_SPE_HIGH_REGNO 148)
67 (define_c_enum "unspec"
68 [UNSPEC_FRSP ; frsp for POWER machines
69 UNSPEC_PROBE_STACK ; probe stack memory reference
70 UNSPEC_TOCPTR ; address of a word pointing to the TOC
71 UNSPEC_TOC ; address of the TOC (more-or-less)
73 UNSPEC_MV_CR_OV ; move_from_CR_ov_bit
79 UNSPEC_LD_MPIC ; load_macho_picbase
80 UNSPEC_RELD_MPIC ; re-load_macho_picbase
81 UNSPEC_MPIC_CORRECT ; macho_correct_pic
95 UNSPEC_FIX_TRUNC_TF ; fadd, rounding towards zero
96 UNSPEC_MV_CR_GT ; move_from_CR_gt_bit
114 UNSPEC_MACHOPIC_OFFSET
126 UNSPEC_P8V_RELOAD_FROM_GPR
129 UNSPEC_P8V_RELOAD_FROM_VSX
143 ;; UNSPEC_VOLATILE usage
146 (define_c_enum "unspecv"
148 UNSPECV_LL ; load-locked
149 UNSPECV_SC ; store-conditional
150 UNSPECV_PROBE_STACK_RANGE ; probe range of stack addresses
151 UNSPECV_EH_RR ; eh_reg_restore
152 UNSPECV_ISYNC ; isync instruction
153 UNSPECV_MFTB ; move from time base
154 UNSPECV_NLGR ; non-local goto receiver
155 UNSPECV_MFFS ; Move from FPSCR
156 UNSPECV_MTFSF ; Move to FPSCR Fields
160 ;; Define an insn type attribute. This is used in function unit delay
164 add,logical,shift,insert,
166 exts,cntlz,popcnt,isel,
167 load,store,fpload,fpstore,vecload,vecstore,
169 branch,jmpreg,mfjmpr,mtjmpr,trap,isync,sync,load_l,store_c,
171 cr_logical,delayed_cr,mfcr,mfcrf,mtcr,
172 fpcompare,fp,fpsimple,dmul,sdiv,ddiv,ssqrt,dsqrt,
174 vecsimple,veccomplex,vecdiv,veccmp,veccmpsimple,vecperm,
175 vecfloat,vecfdiv,vecdouble,mffgpr,mftgpr,crypto,
177 (const_string "integer"))
179 ;; What data size does this instruction work on?
180 ;; This is used for insert, mul.
181 (define_attr "size" "8,16,32,64" (const_string "32"))
183 ;; Is this instruction record form ("dot", signed compare to 0, writing CR0)?
184 ;; This is used for add, logical, shift, mul.
185 (define_attr "dot" "no,yes" (const_string "no"))
187 ;; Does this instruction sign-extend its result?
188 ;; This is used for load insns.
189 (define_attr "sign_extend" "no,yes" (const_string "no"))
191 ;; Does this instruction use indexed (that is, reg+reg) addressing?
192 ;; This is used for load and store insns. If operand 0 or 1 is a MEM
193 ;; it is automatically set based on that. If a load or store instruction
194 ;; has fewer than two operands it needs to set this attribute manually
195 ;; or the compiler will crash.
196 (define_attr "indexed" "no,yes"
197 (if_then_else (ior (match_operand 0 "indexed_address_mem")
198 (match_operand 1 "indexed_address_mem"))
200 (const_string "no")))
202 ;; Does this instruction use update addressing?
203 ;; This is used for load and store insns. See the comments for "indexed".
204 (define_attr "update" "no,yes"
205 (if_then_else (ior (match_operand 0 "update_address_mem")
206 (match_operand 1 "update_address_mem"))
208 (const_string "no")))
210 ;; Is this instruction using operands[2] as shift amount, and can that be a
212 ;; This is used for shift insns.
213 (define_attr "maybe_var_shift" "no,yes" (const_string "no"))
215 ;; Is this instruction using a shift amount from a register?
216 ;; This is used for shift insns.
217 (define_attr "var_shift" "no,yes"
218 (if_then_else (and (eq_attr "type" "shift")
219 (eq_attr "maybe_var_shift" "yes"))
220 (if_then_else (match_operand 2 "gpc_reg_operand")
223 (const_string "no")))
225 ;; Define floating point instruction sub-types for use with Xfpu.md
226 (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"))
228 ;; Length (in bytes).
229 ; '(pc)' in the following doesn't include the instruction itself; it is
230 ; calculated as if the instruction had zero size.
231 (define_attr "length" ""
232 (if_then_else (eq_attr "type" "branch")
233 (if_then_else (and (ge (minus (match_dup 0) (pc))
235 (lt (minus (match_dup 0) (pc))
241 ;; Processor type -- this attribute must exactly match the processor_type
242 ;; enumeration in rs6000-opts.h.
244 "ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630,
245 ppc750,ppc7400,ppc7450,
246 ppc403,ppc405,ppc440,ppc476,
247 ppc8540,ppc8548,ppce300c2,ppce300c3,ppce500mc,ppce500mc64,ppce5500,ppce6500,
248 power4,power5,power6,power7,power8,
249 rs64a,mpccore,cell,ppca2,titan"
250 (const (symbol_ref "rs6000_cpu_attr")))
253 ;; If this instruction is microcoded on the CELL processor
254 ; The default for load extended, the recorded instructions and rotate/shifts by a variable is always microcoded
255 (define_attr "cell_micro" "not,conditional,always"
256 (if_then_else (ior (eq_attr "type" "compare")
257 (and (eq_attr "type" "shift,mul")
258 (eq_attr "dot" "yes"))
259 (and (eq_attr "type" "load")
260 (eq_attr "sign_extend" "yes"))
261 (and (eq_attr "type" "shift")
262 (eq_attr "var_shift" "yes")))
263 (const_string "always")
264 (const_string "not")))
266 (automata_option "ndfa")
279 (include "e300c2c3.md")
280 (include "e500mc.md")
281 (include "e500mc64.md")
284 (include "power4.md")
285 (include "power5.md")
286 (include "power6.md")
287 (include "power7.md")
288 (include "power8.md")
294 (include "predicates.md")
295 (include "constraints.md")
297 (include "darwin.md")
302 ; This mode iterator allows :GPR to be used to indicate the allowable size
303 ; of whole values in GPRs.
304 (define_mode_iterator GPR [SI (DI "TARGET_POWERPC64")])
306 ; Any supported integer mode.
307 (define_mode_iterator INT [QI HI SI DI TI PTI])
309 ; Any supported integer mode that fits in one register.
310 (define_mode_iterator INT1 [QI HI SI (DI "TARGET_POWERPC64")])
312 ; extend modes for DImode
313 (define_mode_iterator QHSI [QI HI SI])
315 ; QImode or HImode for small atomic ops
316 (define_mode_iterator QHI [QI HI])
318 ; HImode or SImode for sign extended fusion ops
319 (define_mode_iterator HSI [HI SI])
321 ; SImode or DImode, even if DImode doesn't fit in GPRs.
322 (define_mode_iterator SDI [SI DI])
324 ; The size of a pointer. Also, the size of the value that a record-condition
325 ; (one with a '.') will compare; and the size used for arithmetic carries.
326 (define_mode_iterator P [(SI "TARGET_32BIT") (DI "TARGET_64BIT")])
328 ; Iterator to add PTImode along with TImode (TImode can go in VSX registers,
329 ; PTImode is GPR only)
330 (define_mode_iterator TI2 [TI PTI])
332 ; Any hardware-supported floating-point mode
333 (define_mode_iterator FP [
334 (SF "TARGET_HARD_FLOAT
335 && ((TARGET_FPRS && TARGET_SINGLE_FLOAT) || TARGET_E500_SINGLE)")
336 (DF "TARGET_HARD_FLOAT
337 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)")
338 (TF "!TARGET_IEEEQUAD
340 && (TARGET_FPRS || TARGET_E500_DOUBLE)
341 && TARGET_LONG_DOUBLE_128")
345 ; Any fma capable floating-point mode.
346 (define_mode_iterator FMA_F [
347 (SF "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT")
348 (DF "(TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT)
349 || VECTOR_UNIT_VSX_P (DFmode)")
350 (V2SF "TARGET_PAIRED_FLOAT")
351 (V4SF "VECTOR_UNIT_ALTIVEC_OR_VSX_P (V4SFmode)")
352 (V2DF "VECTOR_UNIT_ALTIVEC_OR_VSX_P (V2DFmode)")
355 ; Floating point move iterators to combine binary and decimal moves
356 (define_mode_iterator FMOVE32 [SF SD])
357 (define_mode_iterator FMOVE64 [DF DD])
358 (define_mode_iterator FMOVE64X [DI DF DD])
359 (define_mode_iterator FMOVE128 [(TF "!TARGET_IEEEQUAD && TARGET_LONG_DOUBLE_128")
360 (TD "TARGET_HARD_FLOAT && TARGET_FPRS")])
362 ; Iterators for 128 bit types for direct move
363 (define_mode_iterator FMOVE128_GPR [(TI "TARGET_VSX_TIMODE")
372 ; Whether a floating point move is ok, don't allow SD without hardware FP
373 (define_mode_attr fmove_ok [(SF "")
375 (SD "TARGET_HARD_FLOAT && TARGET_FPRS")
378 ; Convert REAL_VALUE to the appropriate bits
379 (define_mode_attr real_value_to_target [(SF "REAL_VALUE_TO_TARGET_SINGLE")
380 (DF "REAL_VALUE_TO_TARGET_DOUBLE")
381 (SD "REAL_VALUE_TO_TARGET_DECIMAL32")
382 (DD "REAL_VALUE_TO_TARGET_DECIMAL64")])
384 ; Definitions for load to 32-bit fpr register
385 (define_mode_attr f32_lr [(SF "f") (SD "wz")])
386 (define_mode_attr f32_lm [(SF "m") (SD "Z")])
387 (define_mode_attr f32_li [(SF "lfs%U1%X1 %0,%1") (SD "lfiwzx %0,%y1")])
388 (define_mode_attr f32_lv [(SF "lxsspx %x0,%y1") (SD "lxsiwzx %x0,%y1")])
390 ; Definitions for store from 32-bit fpr register
391 (define_mode_attr f32_sr [(SF "f") (SD "wx")])
392 (define_mode_attr f32_sm [(SF "m") (SD "Z")])
393 (define_mode_attr f32_si [(SF "stfs%U0%X0 %1,%0") (SD "stfiwx %1,%y0")])
394 (define_mode_attr f32_sv [(SF "stxsspx %x1,%y0") (SD "stxsiwzx %x1,%y0")])
396 ; Definitions for 32-bit fpr direct move
397 (define_mode_attr f32_dm [(SF "wn") (SD "wh")])
399 ; These modes do not fit in integer registers in 32-bit mode.
400 ; but on e500v2, the gpr are 64 bit registers
401 (define_mode_iterator DIFD [DI (DF "!TARGET_E500_DOUBLE") DD])
403 ; Iterator for reciprocal estimate instructions
404 (define_mode_iterator RECIPF [SF DF V4SF V2DF])
406 ; Iterator for just SF/DF
407 (define_mode_iterator SFDF [SF DF])
409 ; SF/DF suffix for traditional floating instructions
410 (define_mode_attr Ftrad [(SF "s") (DF "")])
412 ; SF/DF suffix for VSX instructions
413 (define_mode_attr Fvsx [(SF "sp") (DF "dp")])
415 ; SF/DF constraint for arithmetic on traditional floating point registers
416 (define_mode_attr Ff [(SF "f") (DF "d")])
418 ; SF/DF constraint for arithmetic on VSX registers
419 (define_mode_attr Fv [(SF "wy") (DF "ws")])
421 ; s/d suffix for things like fp_addsub_s/fp_addsub_d
422 (define_mode_attr Fs [(SF "s") (DF "d")])
425 (define_mode_attr Ffre [(SF "fres") (DF "fre")])
426 (define_mode_attr FFRE [(SF "FRES") (DF "FRE")])
428 ; Conditional returns.
429 (define_code_iterator any_return [return simple_return])
430 (define_code_attr return_pred [(return "direct_return ()")
431 (simple_return "1")])
432 (define_code_attr return_str [(return "") (simple_return "simple_")])
434 ; Various instructions that come in SI and DI forms.
435 ; A generic w/d attribute, for things like cmpw/cmpd.
436 (define_mode_attr wd [(QI "b")
445 ;; How many bits in this mode?
446 (define_mode_attr bits [(QI "8") (HI "16") (SI "32") (DI "64")])
449 (define_mode_attr dbits [(QI "56") (HI "48") (SI "32")])
451 ;; ISEL/ISEL64 target selection
452 (define_mode_attr sel [(SI "") (DI "64")])
454 ;; Bitmask for shift instructions
455 (define_mode_attr hH [(SI "h") (DI "H")])
457 ;; Suffix for reload patterns
458 (define_mode_attr ptrsize [(SI "32bit")
461 (define_mode_attr tptrsize [(SI "TARGET_32BIT")
462 (DI "TARGET_64BIT")])
464 (define_mode_attr mptrsize [(SI "si")
467 (define_mode_attr ptrload [(SI "lwz")
470 (define_mode_attr ptrm [(SI "m")
473 (define_mode_attr rreg [(SF "f")
480 (define_mode_attr rreg2 [(SF "f")
483 (define_mode_attr SI_CONVERT_FP [(SF "TARGET_FCFIDS")
484 (DF "TARGET_FCFID")])
486 (define_mode_attr E500_CONVERT [(SF "!TARGET_FPRS")
487 (DF "TARGET_E500_DOUBLE")])
489 (define_mode_attr TARGET_FLOAT [(SF "TARGET_SINGLE_FLOAT")
490 (DF "TARGET_DOUBLE_FLOAT")])
492 ;; Mode iterator for logical operations on 128-bit types
493 (define_mode_iterator BOOL_128 [TI
495 (V16QI "TARGET_ALTIVEC")
496 (V8HI "TARGET_ALTIVEC")
497 (V4SI "TARGET_ALTIVEC")
498 (V4SF "TARGET_ALTIVEC")
499 (V2DI "TARGET_ALTIVEC")
500 (V2DF "TARGET_ALTIVEC")
501 (V1TI "TARGET_ALTIVEC")])
503 ;; For the GPRs we use 3 constraints for register outputs, two that are the
504 ;; same as the output register, and a third where the output register is an
505 ;; early clobber, so we don't have to deal with register overlaps. For the
506 ;; vector types, we prefer to use the vector registers. For TI mode, allow
509 ;; Mode attribute for boolean operation register constraints for output
510 (define_mode_attr BOOL_REGS_OUTPUT [(TI "&r,r,r,wa,v")
512 (V16QI "wa,v,&?r,?r,?r")
513 (V8HI "wa,v,&?r,?r,?r")
514 (V4SI "wa,v,&?r,?r,?r")
515 (V4SF "wa,v,&?r,?r,?r")
516 (V2DI "wa,v,&?r,?r,?r")
517 (V2DF "wa,v,&?r,?r,?r")
518 (V1TI "wa,v,&?r,?r,?r")])
520 ;; Mode attribute for boolean operation register constraints for operand1
521 (define_mode_attr BOOL_REGS_OP1 [(TI "r,0,r,wa,v")
529 (V1TI "wa,v,r,0,r")])
531 ;; Mode attribute for boolean operation register constraints for operand2
532 (define_mode_attr BOOL_REGS_OP2 [(TI "r,r,0,wa,v")
540 (V1TI "wa,v,r,r,0")])
542 ;; Mode attribute for boolean operation register constraints for operand1
543 ;; for one_cmpl. To simplify things, we repeat the constraint where 0
544 ;; is used for operand1 or operand2
545 (define_mode_attr BOOL_REGS_UNARY [(TI "r,0,0,wa,v")
553 (V1TI "wa,v,r,0,0")])
555 ;; Mode attribute for the clobber of CC0 for AND expansion.
556 ;; For the 128-bit types, we never do AND immediate, but we need to
557 ;; get the correct number of X's for the number of operands.
558 (define_mode_attr BOOL_REGS_AND_CR0 [(TI "X,X,X,X,X")
568 ;; Start with fixed-point load and store insns. Here we put only the more
569 ;; complex forms. Basic data transfer is done later.
571 (define_expand "zero_extend<mode>di2"
572 [(set (match_operand:DI 0 "gpc_reg_operand" "")
573 (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "")))]
577 (define_insn "*zero_extend<mode>di2_internal1"
578 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
579 (zero_extend:DI (match_operand:QHSI 1 "reg_or_mem_operand" "m,r")))]
580 "TARGET_POWERPC64 && (<MODE>mode != SImode || !TARGET_LFIWZX)"
583 rldicl %0,%1,0,<dbits>"
584 [(set_attr "type" "load,shift")])
586 (define_insn "*zero_extend<mode>di2_internal2"
587 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
588 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "r,r"))
590 (clobber (match_scratch:DI 2 "=r,r"))]
593 rldicl. %2,%1,0,<dbits>
595 [(set_attr "type" "shift")
596 (set_attr "dot" "yes")
597 (set_attr "length" "4,8")])
600 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
601 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" ""))
603 (clobber (match_scratch:DI 2 ""))]
604 "TARGET_POWERPC64 && reload_completed"
606 (zero_extend:DI (match_dup 1)))
608 (compare:CC (match_dup 2)
612 (define_insn "*zero_extend<mode>di2_internal3"
613 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
614 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "r,r"))
616 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
617 (zero_extend:DI (match_dup 1)))]
620 rldicl. %0,%1,0,<dbits>
622 [(set_attr "type" "shift")
623 (set_attr "dot" "yes")
624 (set_attr "length" "4,8")])
627 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
628 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" ""))
630 (set (match_operand:DI 0 "gpc_reg_operand" "")
631 (zero_extend:DI (match_dup 1)))]
632 "TARGET_POWERPC64 && reload_completed"
634 (zero_extend:DI (match_dup 1)))
636 (compare:CC (match_dup 0)
640 (define_insn "*zero_extendsidi2_lfiwzx"
641 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,??wj,!wz,!wu")
642 (zero_extend:DI (match_operand:SI 1 "reg_or_mem_operand" "m,r,r,Z,Z")))]
643 "TARGET_POWERPC64 && TARGET_LFIWZX"
650 [(set_attr "type" "load,shift,mffgpr,fpload,fpload")])
652 (define_insn "extendqidi2"
653 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
654 (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r")))]
657 [(set_attr "type" "exts")])
660 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
661 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
663 (clobber (match_scratch:DI 2 "=r,r"))]
668 [(set_attr "type" "compare")
669 (set_attr "length" "4,8")])
672 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
673 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
675 (clobber (match_scratch:DI 2 ""))]
676 "TARGET_POWERPC64 && reload_completed"
678 (sign_extend:DI (match_dup 1)))
680 (compare:CC (match_dup 2)
685 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
686 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
688 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
689 (sign_extend:DI (match_dup 1)))]
694 [(set_attr "type" "compare")
695 (set_attr "length" "4,8")])
698 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
699 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
701 (set (match_operand:DI 0 "gpc_reg_operand" "")
702 (sign_extend:DI (match_dup 1)))]
703 "TARGET_POWERPC64 && reload_completed"
705 (sign_extend:DI (match_dup 1)))
707 (compare:CC (match_dup 0)
711 (define_expand "extendhidi2"
712 [(set (match_operand:DI 0 "gpc_reg_operand" "")
713 (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "")))]
718 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
719 (sign_extend:DI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
720 "TARGET_POWERPC64 && rs6000_gen_cell_microcode"
724 [(set_attr "type" "load,exts")
725 (set_attr "sign_extend" "yes")])
728 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
729 (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r")))]
730 "TARGET_POWERPC64 && !rs6000_gen_cell_microcode"
732 [(set_attr "type" "exts")])
735 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
736 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
738 (clobber (match_scratch:DI 2 "=r,r"))]
743 [(set_attr "type" "compare")
744 (set_attr "length" "4,8")])
747 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
748 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
750 (clobber (match_scratch:DI 2 ""))]
751 "TARGET_POWERPC64 && reload_completed"
753 (sign_extend:DI (match_dup 1)))
755 (compare:CC (match_dup 2)
760 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
761 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
763 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
764 (sign_extend:DI (match_dup 1)))]
769 [(set_attr "type" "compare")
770 (set_attr "length" "4,8")])
773 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
774 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
776 (set (match_operand:DI 0 "gpc_reg_operand" "")
777 (sign_extend:DI (match_dup 1)))]
778 "TARGET_POWERPC64 && reload_completed"
780 (sign_extend:DI (match_dup 1)))
782 (compare:CC (match_dup 0)
786 (define_expand "extendsidi2"
787 [(set (match_operand:DI 0 "gpc_reg_operand" "")
788 (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")))]
792 (define_insn "*extendsidi2_lfiwax"
793 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,??wj,!wl,!wu")
794 (sign_extend:DI (match_operand:SI 1 "lwa_operand" "Y,r,r,Z,Z")))]
795 "TARGET_POWERPC64 && TARGET_LFIWAX"
802 [(set_attr "type" "load,exts,mffgpr,fpload,fpload")
803 (set_attr "sign_extend" "yes")])
805 (define_insn "*extendsidi2_nocell"
806 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
807 (sign_extend:DI (match_operand:SI 1 "lwa_operand" "Y,r")))]
808 "TARGET_POWERPC64 && rs6000_gen_cell_microcode && !TARGET_LFIWAX"
812 [(set_attr "type" "load,exts")
813 (set_attr "sign_extend" "yes")])
815 (define_insn "*extendsidi2_nocell"
816 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
817 (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r")))]
818 "TARGET_POWERPC64 && !rs6000_gen_cell_microcode"
820 [(set_attr "type" "exts")])
823 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
824 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
826 (clobber (match_scratch:DI 2 "=r,r"))]
831 [(set_attr "type" "compare")
832 (set_attr "length" "4,8")])
835 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
836 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
838 (clobber (match_scratch:DI 2 ""))]
839 "TARGET_POWERPC64 && reload_completed"
841 (sign_extend:DI (match_dup 1)))
843 (compare:CC (match_dup 2)
848 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
849 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
851 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
852 (sign_extend:DI (match_dup 1)))]
857 [(set_attr "type" "compare")
858 (set_attr "length" "4,8")])
861 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
862 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
864 (set (match_operand:DI 0 "gpc_reg_operand" "")
865 (sign_extend:DI (match_dup 1)))]
866 "TARGET_POWERPC64 && reload_completed"
868 (sign_extend:DI (match_dup 1)))
870 (compare:CC (match_dup 0)
874 (define_expand "zero_extendqisi2"
875 [(set (match_operand:SI 0 "gpc_reg_operand" "")
876 (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "")))]
881 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
882 (zero_extend:SI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
887 [(set_attr "type" "load,shift")])
890 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
891 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
893 (clobber (match_scratch:SI 2 "=r,r"))]
898 [(set_attr "type" "logical,compare")
899 (set_attr "dot" "yes")
900 (set_attr "length" "4,8")])
903 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
904 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
906 (clobber (match_scratch:SI 2 ""))]
909 (zero_extend:SI (match_dup 1)))
911 (compare:CC (match_dup 2)
916 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
917 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
919 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
920 (zero_extend:SI (match_dup 1)))]
925 [(set_attr "type" "logical,compare")
926 (set_attr "dot" "yes")
927 (set_attr "length" "4,8")])
930 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
931 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
933 (set (match_operand:SI 0 "gpc_reg_operand" "")
934 (zero_extend:SI (match_dup 1)))]
937 (zero_extend:SI (match_dup 1)))
939 (compare:CC (match_dup 0)
943 (define_insn "extendqisi2"
944 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
945 (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r")))]
948 [(set_attr "type" "exts")])
951 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
952 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
954 (clobber (match_scratch:SI 2 "=r,r"))]
959 [(set_attr "type" "compare")
960 (set_attr "length" "4,8")])
963 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
964 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
966 (clobber (match_scratch:SI 2 ""))]
969 (sign_extend:SI (match_dup 1)))
971 (compare:CC (match_dup 2)
976 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
977 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
979 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
980 (sign_extend:SI (match_dup 1)))]
985 [(set_attr "type" "compare")
986 (set_attr "length" "4,8")])
989 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
990 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
992 (set (match_operand:SI 0 "gpc_reg_operand" "")
993 (sign_extend:SI (match_dup 1)))]
996 (sign_extend:SI (match_dup 1)))
998 (compare:CC (match_dup 0)
1003 [(set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
1004 (zero_extend:HI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
1008 rlwinm %0,%1,0,0xff"
1009 [(set_attr "type" "load,shift")])
1012 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1013 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
1015 (clobber (match_scratch:HI 2 "=r,r"))]
1020 [(set_attr "type" "logical,compare")
1021 (set_attr "dot" "yes")
1022 (set_attr "length" "4,8")])
1025 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
1026 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
1028 (clobber (match_scratch:HI 2 ""))]
1031 (zero_extend:HI (match_dup 1)))
1033 (compare:CC (match_dup 2)
1038 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1039 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
1041 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
1042 (zero_extend:HI (match_dup 1)))]
1047 [(set_attr "type" "logical,compare")
1048 (set_attr "dot" "yes")
1049 (set_attr "length" "4,8")])
1052 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
1053 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
1055 (set (match_operand:HI 0 "gpc_reg_operand" "")
1056 (zero_extend:HI (match_dup 1)))]
1059 (zero_extend:HI (match_dup 1)))
1061 (compare:CC (match_dup 0)
1065 (define_insn "extendqihi2"
1066 [(set (match_operand:HI 0 "gpc_reg_operand" "=r")
1067 (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r")))]
1070 [(set_attr "type" "exts")])
1073 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1074 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
1076 (clobber (match_scratch:HI 2 "=r,r"))]
1081 [(set_attr "type" "compare")
1082 (set_attr "length" "4,8")])
1085 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
1086 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
1088 (clobber (match_scratch:HI 2 ""))]
1091 (sign_extend:HI (match_dup 1)))
1093 (compare:CC (match_dup 2)
1098 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1099 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
1101 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
1102 (sign_extend:HI (match_dup 1)))]
1107 [(set_attr "type" "compare")
1108 (set_attr "length" "4,8")])
1111 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
1112 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
1114 (set (match_operand:HI 0 "gpc_reg_operand" "")
1115 (sign_extend:HI (match_dup 1)))]
1118 (sign_extend:HI (match_dup 1)))
1120 (compare:CC (match_dup 0)
1124 (define_expand "zero_extendhisi2"
1125 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1126 (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
1131 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1132 (zero_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
1136 rlwinm %0,%1,0,0xffff"
1137 [(set_attr "type" "load,shift")])
1140 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1141 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
1143 (clobber (match_scratch:SI 2 "=r,r"))]
1148 [(set_attr "type" "logical,compare")
1149 (set_attr "dot" "yes")
1150 (set_attr "length" "4,8")])
1153 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
1154 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1156 (clobber (match_scratch:SI 2 ""))]
1159 (zero_extend:SI (match_dup 1)))
1161 (compare:CC (match_dup 2)
1166 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1167 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
1169 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1170 (zero_extend:SI (match_dup 1)))]
1175 [(set_attr "type" "logical,compare")
1176 (set_attr "dot" "yes")
1177 (set_attr "length" "4,8")])
1180 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
1181 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1183 (set (match_operand:SI 0 "gpc_reg_operand" "")
1184 (zero_extend:SI (match_dup 1)))]
1187 (zero_extend:SI (match_dup 1)))
1189 (compare:CC (match_dup 0)
1193 (define_expand "extendhisi2"
1194 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1195 (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
1200 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1201 (sign_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
1202 "rs6000_gen_cell_microcode"
1206 [(set_attr "type" "load,exts")
1207 (set_attr "sign_extend" "yes")])
1210 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1211 (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r")))]
1212 "!rs6000_gen_cell_microcode"
1214 [(set_attr "type" "exts")])
1217 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1218 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
1220 (clobber (match_scratch:SI 2 "=r,r"))]
1225 [(set_attr "type" "compare")
1226 (set_attr "length" "4,8")])
1229 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
1230 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1232 (clobber (match_scratch:SI 2 ""))]
1235 (sign_extend:SI (match_dup 1)))
1237 (compare:CC (match_dup 2)
1242 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1243 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
1245 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1246 (sign_extend:SI (match_dup 1)))]
1251 [(set_attr "type" "compare")
1252 (set_attr "length" "4,8")])
1255 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
1256 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1258 (set (match_operand:SI 0 "gpc_reg_operand" "")
1259 (sign_extend:SI (match_dup 1)))]
1262 (sign_extend:SI (match_dup 1)))
1264 (compare:CC (match_dup 0)
1268 ;; IBM 405, 440, 464 and 476 half-word multiplication operations.
1270 (define_insn "*macchwc"
1271 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1272 (compare:CC (plus:SI (mult:SI (ashiftrt:SI
1273 (match_operand:SI 2 "gpc_reg_operand" "r")
1276 (match_operand:HI 1 "gpc_reg_operand" "r")))
1277 (match_operand:SI 4 "gpc_reg_operand" "0"))
1279 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1280 (plus:SI (mult:SI (ashiftrt:SI
1288 [(set_attr "type" "halfmul")])
1290 (define_insn "*macchw"
1291 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1292 (plus:SI (mult:SI (ashiftrt:SI
1293 (match_operand:SI 2 "gpc_reg_operand" "r")
1296 (match_operand:HI 1 "gpc_reg_operand" "r")))
1297 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1300 [(set_attr "type" "halfmul")])
1302 (define_insn "*macchwuc"
1303 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1304 (compare:CC (plus:SI (mult:SI (lshiftrt:SI
1305 (match_operand:SI 2 "gpc_reg_operand" "r")
1308 (match_operand:HI 1 "gpc_reg_operand" "r")))
1309 (match_operand:SI 4 "gpc_reg_operand" "0"))
1311 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1312 (plus:SI (mult:SI (lshiftrt:SI
1320 [(set_attr "type" "halfmul")])
1322 (define_insn "*macchwu"
1323 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1324 (plus:SI (mult:SI (lshiftrt:SI
1325 (match_operand:SI 2 "gpc_reg_operand" "r")
1328 (match_operand:HI 1 "gpc_reg_operand" "r")))
1329 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1332 [(set_attr "type" "halfmul")])
1334 (define_insn "*machhwc"
1335 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1336 (compare:CC (plus:SI (mult:SI (ashiftrt:SI
1337 (match_operand:SI 1 "gpc_reg_operand" "%r")
1340 (match_operand:SI 2 "gpc_reg_operand" "r")
1342 (match_operand:SI 4 "gpc_reg_operand" "0"))
1344 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1345 (plus:SI (mult:SI (ashiftrt:SI
1354 [(set_attr "type" "halfmul")])
1356 (define_insn "*machhw"
1357 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1358 (plus:SI (mult:SI (ashiftrt:SI
1359 (match_operand:SI 1 "gpc_reg_operand" "%r")
1362 (match_operand:SI 2 "gpc_reg_operand" "r")
1364 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1367 [(set_attr "type" "halfmul")])
1369 (define_insn "*machhwuc"
1370 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1371 (compare:CC (plus:SI (mult:SI (lshiftrt:SI
1372 (match_operand:SI 1 "gpc_reg_operand" "%r")
1375 (match_operand:SI 2 "gpc_reg_operand" "r")
1377 (match_operand:SI 4 "gpc_reg_operand" "0"))
1379 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1380 (plus:SI (mult:SI (lshiftrt:SI
1389 [(set_attr "type" "halfmul")])
1391 (define_insn "*machhwu"
1392 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1393 (plus:SI (mult:SI (lshiftrt:SI
1394 (match_operand:SI 1 "gpc_reg_operand" "%r")
1397 (match_operand:SI 2 "gpc_reg_operand" "r")
1399 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1402 [(set_attr "type" "halfmul")])
1404 (define_insn "*maclhwc"
1405 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1406 (compare:CC (plus:SI (mult:SI (sign_extend:SI
1407 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1409 (match_operand:HI 2 "gpc_reg_operand" "r")))
1410 (match_operand:SI 4 "gpc_reg_operand" "0"))
1412 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1413 (plus:SI (mult:SI (sign_extend:SI
1420 [(set_attr "type" "halfmul")])
1422 (define_insn "*maclhw"
1423 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1424 (plus:SI (mult:SI (sign_extend:SI
1425 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1427 (match_operand:HI 2 "gpc_reg_operand" "r")))
1428 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1431 [(set_attr "type" "halfmul")])
1433 (define_insn "*maclhwuc"
1434 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1435 (compare:CC (plus:SI (mult:SI (zero_extend:SI
1436 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1438 (match_operand:HI 2 "gpc_reg_operand" "r")))
1439 (match_operand:SI 4 "gpc_reg_operand" "0"))
1441 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1442 (plus:SI (mult:SI (zero_extend:SI
1449 [(set_attr "type" "halfmul")])
1451 (define_insn "*maclhwu"
1452 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1453 (plus:SI (mult:SI (zero_extend:SI
1454 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1456 (match_operand:HI 2 "gpc_reg_operand" "r")))
1457 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1460 [(set_attr "type" "halfmul")])
1462 (define_insn "*nmacchwc"
1463 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1464 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1465 (mult:SI (ashiftrt:SI
1466 (match_operand:SI 2 "gpc_reg_operand" "r")
1469 (match_operand:HI 1 "gpc_reg_operand" "r"))))
1471 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1472 (minus:SI (match_dup 4)
1473 (mult:SI (ashiftrt:SI
1480 [(set_attr "type" "halfmul")])
1482 (define_insn "*nmacchw"
1483 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1484 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1485 (mult:SI (ashiftrt:SI
1486 (match_operand:SI 2 "gpc_reg_operand" "r")
1489 (match_operand:HI 1 "gpc_reg_operand" "r")))))]
1492 [(set_attr "type" "halfmul")])
1494 (define_insn "*nmachhwc"
1495 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1496 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1497 (mult:SI (ashiftrt:SI
1498 (match_operand:SI 1 "gpc_reg_operand" "%r")
1501 (match_operand:SI 2 "gpc_reg_operand" "r")
1504 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1505 (minus:SI (match_dup 4)
1506 (mult:SI (ashiftrt:SI
1514 [(set_attr "type" "halfmul")])
1516 (define_insn "*nmachhw"
1517 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1518 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1519 (mult:SI (ashiftrt:SI
1520 (match_operand:SI 1 "gpc_reg_operand" "%r")
1523 (match_operand:SI 2 "gpc_reg_operand" "r")
1527 [(set_attr "type" "halfmul")])
1529 (define_insn "*nmaclhwc"
1530 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1531 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1532 (mult:SI (sign_extend:SI
1533 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1535 (match_operand:HI 2 "gpc_reg_operand" "r"))))
1537 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1538 (minus:SI (match_dup 4)
1539 (mult:SI (sign_extend:SI
1545 [(set_attr "type" "halfmul")])
1547 (define_insn "*nmaclhw"
1548 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1549 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1550 (mult:SI (sign_extend:SI
1551 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1553 (match_operand:HI 2 "gpc_reg_operand" "r")))))]
1556 [(set_attr "type" "halfmul")])
1558 (define_insn "*mulchwc"
1559 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1560 (compare:CC (mult:SI (ashiftrt:SI
1561 (match_operand:SI 2 "gpc_reg_operand" "r")
1564 (match_operand:HI 1 "gpc_reg_operand" "r")))
1566 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1567 (mult:SI (ashiftrt:SI
1574 [(set_attr "type" "halfmul")])
1576 (define_insn "*mulchw"
1577 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1578 (mult:SI (ashiftrt:SI
1579 (match_operand:SI 2 "gpc_reg_operand" "r")
1582 (match_operand:HI 1 "gpc_reg_operand" "r"))))]
1585 [(set_attr "type" "halfmul")])
1587 (define_insn "*mulchwuc"
1588 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1589 (compare:CC (mult:SI (lshiftrt:SI
1590 (match_operand:SI 2 "gpc_reg_operand" "r")
1593 (match_operand:HI 1 "gpc_reg_operand" "r")))
1595 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1596 (mult:SI (lshiftrt:SI
1603 [(set_attr "type" "halfmul")])
1605 (define_insn "*mulchwu"
1606 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1607 (mult:SI (lshiftrt:SI
1608 (match_operand:SI 2 "gpc_reg_operand" "r")
1611 (match_operand:HI 1 "gpc_reg_operand" "r"))))]
1614 [(set_attr "type" "halfmul")])
1616 (define_insn "*mulhhwc"
1617 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1618 (compare:CC (mult:SI (ashiftrt:SI
1619 (match_operand:SI 1 "gpc_reg_operand" "%r")
1622 (match_operand:SI 2 "gpc_reg_operand" "r")
1625 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1626 (mult:SI (ashiftrt:SI
1634 [(set_attr "type" "halfmul")])
1636 (define_insn "*mulhhw"
1637 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1638 (mult:SI (ashiftrt:SI
1639 (match_operand:SI 1 "gpc_reg_operand" "%r")
1642 (match_operand:SI 2 "gpc_reg_operand" "r")
1646 [(set_attr "type" "halfmul")])
1648 (define_insn "*mulhhwuc"
1649 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1650 (compare:CC (mult:SI (lshiftrt:SI
1651 (match_operand:SI 1 "gpc_reg_operand" "%r")
1654 (match_operand:SI 2 "gpc_reg_operand" "r")
1657 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1658 (mult:SI (lshiftrt:SI
1666 [(set_attr "type" "halfmul")])
1668 (define_insn "*mulhhwu"
1669 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1670 (mult:SI (lshiftrt:SI
1671 (match_operand:SI 1 "gpc_reg_operand" "%r")
1674 (match_operand:SI 2 "gpc_reg_operand" "r")
1678 [(set_attr "type" "halfmul")])
1680 (define_insn "*mullhwc"
1681 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1682 (compare:CC (mult:SI (sign_extend:SI
1683 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1685 (match_operand:HI 2 "gpc_reg_operand" "r")))
1687 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1688 (mult:SI (sign_extend:SI
1694 [(set_attr "type" "halfmul")])
1696 (define_insn "*mullhw"
1697 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1698 (mult:SI (sign_extend:SI
1699 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1701 (match_operand:HI 2 "gpc_reg_operand" "r"))))]
1704 [(set_attr "type" "halfmul")])
1706 (define_insn "*mullhwuc"
1707 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1708 (compare:CC (mult:SI (zero_extend:SI
1709 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1711 (match_operand:HI 2 "gpc_reg_operand" "r")))
1713 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1714 (mult:SI (zero_extend:SI
1720 [(set_attr "type" "halfmul")])
1722 (define_insn "*mullhwu"
1723 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1724 (mult:SI (zero_extend:SI
1725 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1727 (match_operand:HI 2 "gpc_reg_operand" "r"))))]
1730 [(set_attr "type" "halfmul")])
1732 ;; IBM 405, 440, 464 and 476 string-search dlmzb instruction support.
1733 (define_insn "dlmzb"
1734 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1735 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
1736 (match_operand:SI 2 "gpc_reg_operand" "r")]
1738 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1739 (unspec:SI [(match_dup 1)
1745 (define_expand "strlensi"
1746 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1747 (unspec:SI [(match_operand:BLK 1 "general_operand" "")
1748 (match_operand:QI 2 "const_int_operand" "")
1749 (match_operand 3 "const_int_operand" "")]
1750 UNSPEC_DLMZB_STRLEN))
1751 (clobber (match_scratch:CC 4 "=x"))]
1752 "TARGET_DLMZB && WORDS_BIG_ENDIAN && !optimize_size"
1754 rtx result = operands[0];
1755 rtx src = operands[1];
1756 rtx search_char = operands[2];
1757 rtx align = operands[3];
1758 rtx addr, scratch_string, word1, word2, scratch_dlmzb;
1759 rtx loop_label, end_label, mem, cr0, cond;
1760 if (search_char != const0_rtx
1761 || GET_CODE (align) != CONST_INT
1762 || INTVAL (align) < 8)
1764 word1 = gen_reg_rtx (SImode);
1765 word2 = gen_reg_rtx (SImode);
1766 scratch_dlmzb = gen_reg_rtx (SImode);
1767 scratch_string = gen_reg_rtx (Pmode);
1768 loop_label = gen_label_rtx ();
1769 end_label = gen_label_rtx ();
1770 addr = force_reg (Pmode, XEXP (src, 0));
1771 emit_move_insn (scratch_string, addr);
1772 emit_label (loop_label);
1773 mem = change_address (src, SImode, scratch_string);
1774 emit_move_insn (word1, mem);
1775 emit_move_insn (word2, adjust_address (mem, SImode, 4));
1776 cr0 = gen_rtx_REG (CCmode, CR0_REGNO);
1777 emit_insn (gen_dlmzb (scratch_dlmzb, word1, word2, cr0));
1778 cond = gen_rtx_NE (VOIDmode, cr0, const0_rtx);
1779 emit_jump_insn (gen_rtx_SET (VOIDmode,
1781 gen_rtx_IF_THEN_ELSE (VOIDmode,
1787 emit_insn (gen_addsi3 (scratch_string, scratch_string, GEN_INT (8)));
1788 emit_jump_insn (gen_rtx_SET (VOIDmode,
1790 gen_rtx_LABEL_REF (VOIDmode, loop_label)));
1792 emit_label (end_label);
1793 emit_insn (gen_addsi3 (scratch_string, scratch_string, scratch_dlmzb));
1794 emit_insn (gen_subsi3 (result, scratch_string, addr));
1795 emit_insn (gen_subsi3 (result, result, const1_rtx));
1799 ;; Fixed-point arithmetic insns.
1801 (define_expand "add<mode>3"
1802 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1803 (plus:SDI (match_operand:SDI 1 "gpc_reg_operand" "")
1804 (match_operand:SDI 2 "reg_or_add_cint_operand" "")))]
1807 if (<MODE>mode == DImode && ! TARGET_POWERPC64)
1809 if (non_short_cint_operand (operands[2], DImode))
1812 else if (GET_CODE (operands[2]) == CONST_INT
1813 && ! add_operand (operands[2], <MODE>mode))
1815 rtx tmp = ((!can_create_pseudo_p ()
1816 || rtx_equal_p (operands[0], operands[1]))
1817 ? operands[0] : gen_reg_rtx (<MODE>mode));
1819 HOST_WIDE_INT val = INTVAL (operands[2]);
1820 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1821 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, <MODE>mode);
1823 if (<MODE>mode == DImode && !satisfies_constraint_L (GEN_INT (rest)))
1826 /* The ordering here is important for the prolog expander.
1827 When space is allocated from the stack, adding 'low' first may
1828 produce a temporary deallocation (which would be bad). */
1829 emit_insn (gen_add<mode>3 (tmp, operands[1], GEN_INT (rest)));
1830 emit_insn (gen_add<mode>3 (operands[0], tmp, GEN_INT (low)));
1835 ;; Discourage ai/addic because of carry but provide it in an alternative
1836 ;; allowing register zero as source.
1837 (define_insn "*add<mode>3_internal1"
1838 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r,?r,r")
1839 (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "%r,b,r,b")
1840 (match_operand:GPR 2 "add_operand" "r,I,I,L")))]
1841 "!DECIMAL_FLOAT_MODE_P (GET_MODE (operands[0])) && !DECIMAL_FLOAT_MODE_P (GET_MODE (operands[1]))"
1847 [(set_attr "type" "add")])
1849 (define_insn "addsi3_high"
1850 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
1851 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
1852 (high:SI (match_operand 2 "" ""))))]
1853 "TARGET_MACHO && !TARGET_64BIT"
1854 "addis %0,%1,ha16(%2)"
1855 [(set_attr "type" "add")])
1857 (define_insn "*add<mode>3_internal2"
1858 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
1859 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "%r,r,r,r")
1860 (match_operand:P 2 "reg_or_short_operand" "r,I,r,I"))
1862 (clobber (match_scratch:P 3 "=r,r,r,r"))]
1869 [(set_attr "type" "add,compare,compare,compare")
1870 (set_attr "dot" "yes")
1871 (set_attr "length" "4,4,8,8")])
1874 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1875 (compare:CC (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1876 (match_operand:GPR 2 "reg_or_short_operand" ""))
1878 (clobber (match_scratch:GPR 3 ""))]
1881 (plus:GPR (match_dup 1)
1884 (compare:CC (match_dup 3)
1888 (define_insn "*add<mode>3_internal3"
1889 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
1890 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "%r,r,r,r")
1891 (match_operand:P 2 "reg_or_short_operand" "r,I,r,I"))
1893 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
1894 (plus:P (match_dup 1)
1902 [(set_attr "type" "add,compare,compare,compare")
1903 (set_attr "dot" "yes")
1904 (set_attr "length" "4,4,8,8")])
1907 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1908 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "")
1909 (match_operand:P 2 "reg_or_short_operand" ""))
1911 (set (match_operand:P 0 "gpc_reg_operand" "")
1912 (plus:P (match_dup 1) (match_dup 2)))]
1915 (plus:P (match_dup 1)
1918 (compare:CC (match_dup 0)
1922 ;; Split an add that we can't do in one insn into two insns, each of which
1923 ;; does one 16-bit part. This is used by combine. Note that the low-order
1924 ;; add should be last in case the result gets used in an address.
1927 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
1928 (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1929 (match_operand:GPR 2 "non_add_cint_operand" "")))]
1931 [(set (match_dup 0) (plus:GPR (match_dup 1) (match_dup 3)))
1932 (set (match_dup 0) (plus:GPR (match_dup 0) (match_dup 4)))]
1934 HOST_WIDE_INT val = INTVAL (operands[2]);
1935 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1936 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, <MODE>mode);
1938 operands[4] = GEN_INT (low);
1939 if (<MODE>mode == SImode || satisfies_constraint_L (GEN_INT (rest)))
1940 operands[3] = GEN_INT (rest);
1941 else if (can_create_pseudo_p ())
1943 operands[3] = gen_reg_rtx (DImode);
1944 emit_move_insn (operands[3], operands[2]);
1945 emit_insn (gen_adddi3 (operands[0], operands[1], operands[3]));
1952 (define_expand "one_cmpl<mode>2"
1953 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1954 (not:SDI (match_operand:SDI 1 "gpc_reg_operand" "")))]
1957 if (<MODE>mode == DImode && !TARGET_POWERPC64)
1959 rs6000_split_logical (operands, NOT, false, false, false, NULL_RTX);
1964 (define_insn "*one_cmpl<mode>2"
1965 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1966 (not:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
1971 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1972 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1974 (clobber (match_scratch:P 2 "=r,r"))]
1979 [(set_attr "type" "logical,compare")
1980 (set_attr "dot" "yes")
1981 (set_attr "length" "4,8")])
1984 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
1985 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" ""))
1987 (clobber (match_scratch:P 2 ""))]
1990 (not:P (match_dup 1)))
1992 (compare:CC (match_dup 2)
1997 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1998 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
2000 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
2001 (not:P (match_dup 1)))]
2006 [(set_attr "type" "logical,compare")
2007 (set_attr "dot" "yes")
2008 (set_attr "length" "4,8")])
2011 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
2012 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" ""))
2014 (set (match_operand:P 0 "gpc_reg_operand" "")
2015 (not:P (match_dup 1)))]
2018 (not:P (match_dup 1)))
2020 (compare:CC (match_dup 0)
2025 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
2026 (minus:GPR (match_operand:GPR 1 "reg_or_short_operand" "r,I")
2027 (match_operand:GPR 2 "gpc_reg_operand" "r,r")))]
2032 [(set_attr "type" "add")])
2035 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2036 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "r,r")
2037 (match_operand:P 2 "gpc_reg_operand" "r,r"))
2039 (clobber (match_scratch:P 3 "=r,r"))]
2044 [(set_attr "type" "add")
2045 (set_attr "dot" "yes")
2046 (set_attr "length" "4,8")])
2049 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2050 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "")
2051 (match_operand:P 2 "gpc_reg_operand" ""))
2053 (clobber (match_scratch:P 3 ""))]
2056 (minus:P (match_dup 1)
2059 (compare:CC (match_dup 3)
2064 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2065 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "r,r")
2066 (match_operand:P 2 "gpc_reg_operand" "r,r"))
2068 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
2069 (minus:P (match_dup 1)
2075 [(set_attr "type" "add")
2076 (set_attr "dot" "yes")
2077 (set_attr "length" "4,8")])
2080 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2081 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "")
2082 (match_operand:P 2 "gpc_reg_operand" ""))
2084 (set (match_operand:P 0 "gpc_reg_operand" "")
2085 (minus:P (match_dup 1)
2089 (minus:P (match_dup 1)
2092 (compare:CC (match_dup 0)
2096 (define_expand "sub<mode>3"
2097 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
2098 (minus:SDI (match_operand:SDI 1 "reg_or_short_operand" "")
2099 (match_operand:SDI 2 "reg_or_sub_cint_operand" "")))]
2103 if (GET_CODE (operands[2]) == CONST_INT)
2105 emit_insn (gen_add<mode>3 (operands[0], operands[1],
2106 negate_rtx (<MODE>mode, operands[2])));
2111 (define_expand "neg<mode>2"
2112 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
2113 (neg:SDI (match_operand:SDI 1 "gpc_reg_operand" "")))]
2117 (define_insn "*neg<mode>2_internal"
2118 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2119 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
2122 [(set_attr "type" "add")])
2125 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2126 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
2128 (clobber (match_scratch:P 2 "=r,r"))]
2133 [(set_attr "type" "add")
2134 (set_attr "dot" "yes")
2135 (set_attr "length" "4,8")])
2138 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2139 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" ""))
2141 (clobber (match_scratch:P 2 ""))]
2144 (neg:P (match_dup 1)))
2146 (compare:CC (match_dup 2)
2151 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
2152 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
2154 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
2155 (neg:P (match_dup 1)))]
2160 [(set_attr "type" "add")
2161 (set_attr "dot" "yes")
2162 (set_attr "length" "4,8")])
2165 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
2166 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" ""))
2168 (set (match_operand:P 0 "gpc_reg_operand" "")
2169 (neg:P (match_dup 1)))]
2172 (neg:P (match_dup 1)))
2174 (compare:CC (match_dup 0)
2178 (define_insn "clz<mode>2"
2179 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2180 (clz:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
2183 [(set_attr "type" "cntlz")])
2185 (define_expand "ctz<mode>2"
2187 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))
2188 (parallel [(set (match_dup 3) (and:GPR (match_dup 1)
2190 (clobber (scratch:CC))])
2191 (set (match_dup 4) (clz:GPR (match_dup 3)))
2192 (set (match_operand:GPR 0 "gpc_reg_operand" "")
2193 (minus:GPR (match_dup 5) (match_dup 4)))]
2196 operands[2] = gen_reg_rtx (<MODE>mode);
2197 operands[3] = gen_reg_rtx (<MODE>mode);
2198 operands[4] = gen_reg_rtx (<MODE>mode);
2199 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode) - 1);
2202 (define_expand "ffs<mode>2"
2204 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))
2205 (parallel [(set (match_dup 3) (and:GPR (match_dup 1)
2207 (clobber (scratch:CC))])
2208 (set (match_dup 4) (clz:GPR (match_dup 3)))
2209 (set (match_operand:GPR 0 "gpc_reg_operand" "")
2210 (minus:GPR (match_dup 5) (match_dup 4)))]
2213 operands[2] = gen_reg_rtx (<MODE>mode);
2214 operands[3] = gen_reg_rtx (<MODE>mode);
2215 operands[4] = gen_reg_rtx (<MODE>mode);
2216 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode));
2219 (define_insn "popcntb<mode>2"
2220 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2221 (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")]
2225 [(set_attr "length" "4")
2226 (set_attr "type" "popcnt")])
2228 (define_insn "popcntd<mode>2"
2229 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2230 (popcount:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
2233 [(set_attr "length" "4")
2234 (set_attr "type" "popcnt")])
2236 (define_expand "popcount<mode>2"
2237 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2238 (popcount:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))]
2239 "TARGET_POPCNTB || TARGET_POPCNTD"
2241 rs6000_emit_popcount (operands[0], operands[1]);
2245 (define_insn "parity<mode>2_cmpb"
2246 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2247 (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")] UNSPEC_PARITY))]
2248 "TARGET_CMPB && TARGET_POPCNTB"
2250 [(set_attr "length" "4")
2251 (set_attr "type" "popcnt")])
2253 (define_expand "parity<mode>2"
2254 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2255 (parity:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))]
2258 rs6000_emit_parity (operands[0], operands[1]);
2262 ;; Since the hardware zeros the upper part of the register, save generating the
2263 ;; AND immediate if we are converting to unsigned
2264 (define_insn "*bswaphi2_extenddi"
2265 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
2267 (bswap:HI (match_operand:HI 1 "memory_operand" "Z"))))]
2270 [(set_attr "length" "4")
2271 (set_attr "type" "load")])
2273 (define_insn "*bswaphi2_extendsi"
2274 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2276 (bswap:HI (match_operand:HI 1 "memory_operand" "Z"))))]
2279 [(set_attr "length" "4")
2280 (set_attr "type" "load")])
2282 (define_expand "bswaphi2"
2283 [(parallel [(set (match_operand:HI 0 "reg_or_mem_operand" "")
2285 (match_operand:HI 1 "reg_or_mem_operand" "")))
2286 (clobber (match_scratch:SI 2 ""))])]
2289 if (!REG_P (operands[0]) && !REG_P (operands[1]))
2290 operands[1] = force_reg (HImode, operands[1]);
2293 (define_insn "bswaphi2_internal"
2294 [(set (match_operand:HI 0 "reg_or_mem_operand" "=r,Z,&r")
2296 (match_operand:HI 1 "reg_or_mem_operand" "Z,r,r")))
2297 (clobber (match_scratch:SI 2 "=X,X,&r"))]
2303 [(set_attr "length" "4,4,12")
2304 (set_attr "type" "load,store,*")])
2306 ;; We are always BITS_BIG_ENDIAN, so the (const_int 16) below is
2307 ;; correct for -mlittle as well as -mbig.
2309 [(set (match_operand:HI 0 "gpc_reg_operand" "")
2310 (bswap:HI (match_operand:HI 1 "gpc_reg_operand" "")))
2311 (clobber (match_operand:SI 2 "gpc_reg_operand" ""))]
2314 (zero_extract:SI (match_dup 4)
2318 (and:SI (ashift:SI (match_dup 4)
2320 (const_int 65280))) ;; 0xff00
2322 (ior:SI (match_dup 3)
2326 operands[3] = simplify_gen_subreg (SImode, operands[0], HImode, 0);
2327 operands[4] = simplify_gen_subreg (SImode, operands[1], HImode, 0);
2330 (define_insn "*bswapsi2_extenddi"
2331 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
2333 (bswap:SI (match_operand:SI 1 "memory_operand" "Z"))))]
2336 [(set_attr "length" "4")
2337 (set_attr "type" "load")])
2339 (define_expand "bswapsi2"
2340 [(set (match_operand:SI 0 "reg_or_mem_operand" "")
2342 (match_operand:SI 1 "reg_or_mem_operand" "")))]
2345 if (!REG_P (operands[0]) && !REG_P (operands[1]))
2346 operands[1] = force_reg (SImode, operands[1]);
2349 (define_insn "*bswapsi2_internal"
2350 [(set (match_operand:SI 0 "reg_or_mem_operand" "=r,Z,&r")
2352 (match_operand:SI 1 "reg_or_mem_operand" "Z,r,r")))]
2358 [(set_attr "length" "4,4,12")
2359 (set_attr "type" "load,store,*")])
2361 ;; We are always BITS_BIG_ENDIAN, so the bit positions below in
2362 ;; zero_extract insns do not change for -mlittle.
2364 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2365 (bswap:SI (match_operand:SI 1 "gpc_reg_operand" "")))]
2368 (rotate:SI (match_dup 1) (const_int 8)))
2369 (set (zero_extract:SI (match_dup 0)
2373 (set (zero_extract:SI (match_dup 0)
2376 (rotate:SI (match_dup 1)
2380 (define_expand "bswapdi2"
2381 [(parallel [(set (match_operand:DI 0 "reg_or_mem_operand" "")
2383 (match_operand:DI 1 "reg_or_mem_operand" "")))
2384 (clobber (match_scratch:DI 2 ""))
2385 (clobber (match_scratch:DI 3 ""))
2386 (clobber (match_scratch:DI 4 ""))])]
2389 if (!REG_P (operands[0]) && !REG_P (operands[1]))
2390 operands[1] = force_reg (DImode, operands[1]);
2392 if (!TARGET_POWERPC64)
2394 /* 32-bit mode needs fewer scratch registers, but 32-bit addressing mode
2395 that uses 64-bit registers needs the same scratch registers as 64-bit
2397 emit_insn (gen_bswapdi2_32bit (operands[0], operands[1]));
2402 ;; Power7/cell has ldbrx/stdbrx, so use it directly
2403 (define_insn "*bswapdi2_ldbrx"
2404 [(set (match_operand:DI 0 "reg_or_mem_operand" "=&r,Z,??&r")
2405 (bswap:DI (match_operand:DI 1 "reg_or_mem_operand" "Z,r,r")))
2406 (clobber (match_scratch:DI 2 "=X,X,&r"))
2407 (clobber (match_scratch:DI 3 "=X,X,&r"))
2408 (clobber (match_scratch:DI 4 "=X,X,&r"))]
2409 "TARGET_POWERPC64 && TARGET_LDBRX
2410 && (REG_P (operands[0]) || REG_P (operands[1]))"
2415 [(set_attr "length" "4,4,36")
2416 (set_attr "type" "load,store,*")])
2418 ;; Non-power7/cell, fall back to use lwbrx/stwbrx
2419 (define_insn "*bswapdi2_64bit"
2420 [(set (match_operand:DI 0 "reg_or_mem_operand" "=&r,Z,&r")
2421 (bswap:DI (match_operand:DI 1 "reg_or_mem_operand" "Z,r,r")))
2422 (clobber (match_scratch:DI 2 "=&b,&b,&r"))
2423 (clobber (match_scratch:DI 3 "=&r,&r,&r"))
2424 (clobber (match_scratch:DI 4 "=&r,X,&r"))]
2425 "TARGET_POWERPC64 && !TARGET_LDBRX
2426 && (REG_P (operands[0]) || REG_P (operands[1]))
2427 && !(MEM_P (operands[0]) && MEM_VOLATILE_P (operands[0]))
2428 && !(MEM_P (operands[1]) && MEM_VOLATILE_P (operands[1]))"
2430 [(set_attr "length" "16,12,36")])
2433 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2434 (bswap:DI (match_operand:DI 1 "indexed_or_indirect_operand" "")))
2435 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
2436 (clobber (match_operand:DI 3 "gpc_reg_operand" ""))
2437 (clobber (match_operand:DI 4 "gpc_reg_operand" ""))]
2438 "TARGET_POWERPC64 && !TARGET_LDBRX && reload_completed"
2442 rtx dest = operands[0];
2443 rtx src = operands[1];
2444 rtx op2 = operands[2];
2445 rtx op3 = operands[3];
2446 rtx op4 = operands[4];
2447 rtx op3_32 = simplify_gen_subreg (SImode, op3, DImode,
2448 BYTES_BIG_ENDIAN ? 4 : 0);
2449 rtx op4_32 = simplify_gen_subreg (SImode, op4, DImode,
2450 BYTES_BIG_ENDIAN ? 4 : 0);
2456 addr1 = XEXP (src, 0);
2457 if (GET_CODE (addr1) == PLUS)
2459 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2460 if (TARGET_AVOID_XFORM)
2462 emit_insn (gen_add3_insn (op2, XEXP (addr1, 1), op2));
2466 addr2 = gen_rtx_PLUS (Pmode, op2, XEXP (addr1, 1));
2468 else if (TARGET_AVOID_XFORM)
2470 emit_insn (gen_add3_insn (op2, addr1, GEN_INT (4)));
2475 emit_move_insn (op2, GEN_INT (4));
2476 addr2 = gen_rtx_PLUS (Pmode, op2, addr1);
2479 if (BYTES_BIG_ENDIAN)
2481 word_high = change_address (src, SImode, addr1);
2482 word_low = change_address (src, SImode, addr2);
2486 word_high = change_address (src, SImode, addr2);
2487 word_low = change_address (src, SImode, addr1);
2490 emit_insn (gen_bswapsi2 (op3_32, word_low));
2491 emit_insn (gen_bswapsi2 (op4_32, word_high));
2492 emit_insn (gen_ashldi3 (dest, op3, GEN_INT (32)));
2493 emit_insn (gen_iordi3 (dest, dest, op4));
2498 [(set (match_operand:DI 0 "indexed_or_indirect_operand" "")
2499 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2500 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
2501 (clobber (match_operand:DI 3 "gpc_reg_operand" ""))
2502 (clobber (match_operand:DI 4 "" ""))]
2503 "TARGET_POWERPC64 && !TARGET_LDBRX && reload_completed"
2507 rtx dest = operands[0];
2508 rtx src = operands[1];
2509 rtx op2 = operands[2];
2510 rtx op3 = operands[3];
2511 rtx src_si = simplify_gen_subreg (SImode, src, DImode,
2512 BYTES_BIG_ENDIAN ? 4 : 0);
2513 rtx op3_si = simplify_gen_subreg (SImode, op3, DImode,
2514 BYTES_BIG_ENDIAN ? 4 : 0);
2520 addr1 = XEXP (dest, 0);
2521 if (GET_CODE (addr1) == PLUS)
2523 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2524 if (TARGET_AVOID_XFORM)
2526 emit_insn (gen_add3_insn (op2, XEXP (addr1, 1), op2));
2530 addr2 = gen_rtx_PLUS (Pmode, op2, XEXP (addr1, 1));
2532 else if (TARGET_AVOID_XFORM)
2534 emit_insn (gen_add3_insn (op2, addr1, GEN_INT (4)));
2539 emit_move_insn (op2, GEN_INT (4));
2540 addr2 = gen_rtx_PLUS (Pmode, op2, addr1);
2543 emit_insn (gen_lshrdi3 (op3, src, GEN_INT (32)));
2544 if (BYTES_BIG_ENDIAN)
2546 word_high = change_address (dest, SImode, addr1);
2547 word_low = change_address (dest, SImode, addr2);
2551 word_high = change_address (dest, SImode, addr2);
2552 word_low = change_address (dest, SImode, addr1);
2554 emit_insn (gen_bswapsi2 (word_high, src_si));
2555 emit_insn (gen_bswapsi2 (word_low, op3_si));
2560 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2561 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2562 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
2563 (clobber (match_operand:DI 3 "gpc_reg_operand" ""))
2564 (clobber (match_operand:DI 4 "" ""))]
2565 "TARGET_POWERPC64 && reload_completed"
2569 rtx dest = operands[0];
2570 rtx src = operands[1];
2571 rtx op2 = operands[2];
2572 rtx op3 = operands[3];
2573 int lo_off = BYTES_BIG_ENDIAN ? 4 : 0;
2574 rtx dest_si = simplify_gen_subreg (SImode, dest, DImode, lo_off);
2575 rtx src_si = simplify_gen_subreg (SImode, src, DImode, lo_off);
2576 rtx op2_si = simplify_gen_subreg (SImode, op2, DImode, lo_off);
2577 rtx op3_si = simplify_gen_subreg (SImode, op3, DImode, lo_off);
2579 emit_insn (gen_lshrdi3 (op2, src, GEN_INT (32)));
2580 emit_insn (gen_bswapsi2 (dest_si, src_si));
2581 emit_insn (gen_bswapsi2 (op3_si, op2_si));
2582 emit_insn (gen_ashldi3 (dest, dest, GEN_INT (32)));
2583 emit_insn (gen_iordi3 (dest, dest, op3));
2587 (define_insn "bswapdi2_32bit"
2588 [(set (match_operand:DI 0 "reg_or_mem_operand" "=&r,Z,&r")
2589 (bswap:DI (match_operand:DI 1 "reg_or_mem_operand" "Z,r,r")))
2590 (clobber (match_scratch:SI 2 "=&b,&b,X"))]
2591 "!TARGET_POWERPC64 && (REG_P (operands[0]) || REG_P (operands[1]))"
2593 [(set_attr "length" "16,12,36")])
2596 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2597 (bswap:DI (match_operand:DI 1 "indexed_or_indirect_operand" "")))
2598 (clobber (match_operand:SI 2 "gpc_reg_operand" ""))]
2599 "!TARGET_POWERPC64 && reload_completed"
2603 rtx dest = operands[0];
2604 rtx src = operands[1];
2605 rtx op2 = operands[2];
2606 rtx dest1 = simplify_gen_subreg (SImode, dest, DImode, 0);
2607 rtx dest2 = simplify_gen_subreg (SImode, dest, DImode, 4);
2613 addr1 = XEXP (src, 0);
2614 if (GET_CODE (addr1) == PLUS)
2616 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2617 if (TARGET_AVOID_XFORM)
2619 emit_insn (gen_add3_insn (op2, XEXP (addr1, 1), op2));
2623 addr2 = gen_rtx_PLUS (SImode, op2, XEXP (addr1, 1));
2625 else if (TARGET_AVOID_XFORM)
2627 emit_insn (gen_add3_insn (op2, addr1, GEN_INT (4)));
2632 emit_move_insn (op2, GEN_INT (4));
2633 addr2 = gen_rtx_PLUS (SImode, op2, addr1);
2636 word1 = change_address (src, SImode, addr1);
2637 word2 = change_address (src, SImode, addr2);
2639 emit_insn (gen_bswapsi2 (dest2, word1));
2640 emit_insn (gen_bswapsi2 (dest1, word2));
2645 [(set (match_operand:DI 0 "indexed_or_indirect_operand" "")
2646 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2647 (clobber (match_operand:SI 2 "gpc_reg_operand" ""))]
2648 "!TARGET_POWERPC64 && reload_completed"
2652 rtx dest = operands[0];
2653 rtx src = operands[1];
2654 rtx op2 = operands[2];
2655 rtx src1 = simplify_gen_subreg (SImode, src, DImode, 0);
2656 rtx src2 = simplify_gen_subreg (SImode, src, DImode, 4);
2662 addr1 = XEXP (dest, 0);
2663 if (GET_CODE (addr1) == PLUS)
2665 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2666 if (TARGET_AVOID_XFORM)
2668 emit_insn (gen_add3_insn (op2, XEXP (addr1, 1), op2));
2672 addr2 = gen_rtx_PLUS (SImode, op2, XEXP (addr1, 1));
2674 else if (TARGET_AVOID_XFORM)
2676 emit_insn (gen_add3_insn (op2, addr1, GEN_INT (4)));
2681 emit_move_insn (op2, GEN_INT (4));
2682 addr2 = gen_rtx_PLUS (SImode, op2, addr1);
2685 word1 = change_address (dest, SImode, addr1);
2686 word2 = change_address (dest, SImode, addr2);
2688 emit_insn (gen_bswapsi2 (word2, src1));
2689 emit_insn (gen_bswapsi2 (word1, src2));
2694 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2695 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2696 (clobber (match_operand:SI 2 "" ""))]
2697 "!TARGET_POWERPC64 && reload_completed"
2701 rtx dest = operands[0];
2702 rtx src = operands[1];
2703 rtx src1 = simplify_gen_subreg (SImode, src, DImode, 0);
2704 rtx src2 = simplify_gen_subreg (SImode, src, DImode, 4);
2705 rtx dest1 = simplify_gen_subreg (SImode, dest, DImode, 0);
2706 rtx dest2 = simplify_gen_subreg (SImode, dest, DImode, 4);
2708 emit_insn (gen_bswapsi2 (dest1, src2));
2709 emit_insn (gen_bswapsi2 (dest2, src1));
2713 (define_insn "mulsi3"
2714 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2715 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2716 (match_operand:SI 2 "reg_or_short_operand" "r,I")))]
2721 [(set_attr "type" "mul")
2723 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
2725 (match_operand:SI 2 "short_cint_operand" "")
2726 (const_string "16")]
2727 (const_string "32")))])
2729 (define_insn "*mulsi3_internal1"
2730 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2731 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2732 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2734 (clobber (match_scratch:SI 3 "=r,r"))]
2739 [(set_attr "type" "mul")
2740 (set_attr "dot" "yes")
2741 (set_attr "length" "4,8")])
2744 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
2745 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2746 (match_operand:SI 2 "gpc_reg_operand" ""))
2748 (clobber (match_scratch:SI 3 ""))]
2749 "TARGET_32BIT && reload_completed"
2751 (mult:SI (match_dup 1) (match_dup 2)))
2753 (compare:CC (match_dup 3)
2757 (define_insn "*mulsi3_internal2"
2758 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2759 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2760 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2762 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2763 (mult:SI (match_dup 1) (match_dup 2)))]
2768 [(set_attr "type" "mul")
2769 (set_attr "dot" "yes")
2770 (set_attr "length" "4,8")])
2773 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
2774 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2775 (match_operand:SI 2 "gpc_reg_operand" ""))
2777 (set (match_operand:SI 0 "gpc_reg_operand" "")
2778 (mult:SI (match_dup 1) (match_dup 2)))]
2779 "TARGET_32BIT && reload_completed"
2781 (mult:SI (match_dup 1) (match_dup 2)))
2783 (compare:CC (match_dup 0)
2788 (define_insn "udiv<mode>3"
2789 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2790 (udiv:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2791 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
2794 [(set_attr "type" "div")
2795 (set_attr "size" "<bits>")])
2798 ;; For powers of two we can do srai/aze for divide and then adjust for
2799 ;; modulus. If it isn't a power of two, force operands into register and do
2801 (define_expand "div<mode>3"
2802 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2803 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2804 (match_operand:GPR 2 "reg_or_cint_operand" "")))]
2807 if (GET_CODE (operands[2]) != CONST_INT
2808 || INTVAL (operands[2]) <= 0
2809 || exact_log2 (INTVAL (operands[2])) < 0)
2810 operands[2] = force_reg (<MODE>mode, operands[2]);
2813 (define_insn "*div<mode>3"
2814 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2815 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2816 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
2819 [(set_attr "type" "div")
2820 (set_attr "size" "<bits>")])
2822 (define_expand "mod<mode>3"
2823 [(use (match_operand:GPR 0 "gpc_reg_operand" ""))
2824 (use (match_operand:GPR 1 "gpc_reg_operand" ""))
2825 (use (match_operand:GPR 2 "reg_or_cint_operand" ""))]
2833 if (GET_CODE (operands[2]) != CONST_INT
2834 || INTVAL (operands[2]) <= 0
2835 || (i = exact_log2 (INTVAL (operands[2]))) < 0)
2838 temp1 = gen_reg_rtx (<MODE>mode);
2839 temp2 = gen_reg_rtx (<MODE>mode);
2841 emit_insn (gen_div<mode>3 (temp1, operands[1], operands[2]));
2842 emit_insn (gen_ashl<mode>3 (temp2, temp1, GEN_INT (i)));
2843 emit_insn (gen_sub<mode>3 (operands[0], operands[1], temp2));
2848 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2849 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2850 (match_operand:GPR 2 "exact_log2_cint_operand" "N")))]
2852 "sra<wd>i %0,%1,%p2\;addze %0,%0"
2853 [(set_attr "type" "two")
2854 (set_attr "length" "8")])
2857 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2858 (compare:CC (div:P (match_operand:P 1 "gpc_reg_operand" "r,r")
2859 (match_operand:P 2 "exact_log2_cint_operand" "N,N"))
2861 (clobber (match_scratch:P 3 "=r,r"))]
2864 sra<wd>i %3,%1,%p2\;addze. %3,%3
2866 [(set_attr "type" "compare")
2867 (set_attr "length" "8,12")
2868 (set_attr "cell_micro" "not")])
2871 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2872 (compare:CC (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2873 (match_operand:GPR 2 "exact_log2_cint_operand"
2876 (clobber (match_scratch:GPR 3 ""))]
2879 (div:<MODE> (match_dup 1) (match_dup 2)))
2881 (compare:CC (match_dup 3)
2886 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2887 (compare:CC (div:P (match_operand:P 1 "gpc_reg_operand" "r,r")
2888 (match_operand:P 2 "exact_log2_cint_operand" "N,N"))
2890 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
2891 (div:P (match_dup 1) (match_dup 2)))]
2894 sra<wd>i %0,%1,%p2\;addze. %0,%0
2896 [(set_attr "type" "compare")
2897 (set_attr "length" "8,12")
2898 (set_attr "cell_micro" "not")])
2901 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2902 (compare:CC (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2903 (match_operand:GPR 2 "exact_log2_cint_operand"
2906 (set (match_operand:GPR 0 "gpc_reg_operand" "")
2907 (div:GPR (match_dup 1) (match_dup 2)))]
2910 (div:<MODE> (match_dup 1) (match_dup 2)))
2912 (compare:CC (match_dup 0)
2916 ;; Logical instructions
2917 ;; The logical instructions are mostly combined by using match_operator,
2918 ;; but the plain AND insns are somewhat different because there is no
2919 ;; plain 'andi' (only 'andi.'), no plain 'andis', and there are all
2920 ;; those rotate-and-mask operations. Thus, the AND insns come first.
2922 (define_expand "andsi3"
2924 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2925 (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2926 (match_operand:SI 2 "and_operand" "")))
2927 (clobber (match_scratch:CC 3 ""))])]
2931 (define_insn "andsi3_mc"
2932 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
2933 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
2934 (match_operand:SI 2 "and_operand" "?r,T,K,L")))
2935 (clobber (match_scratch:CC 3 "=X,X,x,x"))]
2936 "rs6000_gen_cell_microcode"
2939 rlwinm %0,%1,0,%m2,%M2
2942 [(set_attr "type" "*,shift,logical,logical")
2943 (set_attr "dot" "no,no,yes,yes")])
2945 (define_insn "andsi3_nomc"
2946 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2947 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2948 (match_operand:SI 2 "and_operand" "?r,T")))
2949 (clobber (match_scratch:CC 3 "=X,X"))]
2950 "!rs6000_gen_cell_microcode"
2953 rlwinm %0,%1,0,%m2,%M2"
2954 [(set_attr "type" "logical,shift")])
2956 (define_insn "andsi3_internal0_nomc"
2957 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2958 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2959 (match_operand:SI 2 "and_operand" "?r,T")))]
2960 "!rs6000_gen_cell_microcode"
2963 rlwinm %0,%1,0,%m2,%M2"
2964 [(set_attr "type" "logical,shift")])
2967 ;; Note to set cr's other than cr0 we do the and immediate and then
2968 ;; the test again -- this avoids a mfcr which on the higher end
2969 ;; machines causes an execution serialization
2971 (define_insn "*andsi3_internal2_mc"
2972 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2973 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2974 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2976 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2977 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2978 "TARGET_32BIT && rs6000_gen_cell_microcode"
2983 rlwinm. %3,%1,0,%m2,%M2
2988 [(set_attr "type" "logical,logical,logical,shift,\
2989 compare,compare,compare,compare")
2990 (set_attr "dot" "yes")
2991 (set_attr "length" "4,4,4,4,8,8,8,8")])
2993 (define_insn "*andsi3_internal3_mc"
2994 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2995 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2996 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2998 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2999 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
3000 "TARGET_64BIT && rs6000_gen_cell_microcode"
3005 rlwinm. %3,%1,0,%m2,%M2
3010 [(set_attr "type" "compare,logical,logical,shift,compare,\
3011 compare,compare,compare")
3012 (set_attr "dot" "yes")
3013 (set_attr "length" "8,4,4,4,8,8,8,8")])
3016 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3017 (compare:CC (and:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
3018 (match_operand:GPR 2 "and_operand" ""))
3020 (clobber (match_scratch:GPR 3 ""))
3021 (clobber (match_scratch:CC 4 ""))]
3023 [(parallel [(set (match_dup 3)
3024 (and:<MODE> (match_dup 1)
3026 (clobber (match_dup 4))])
3028 (compare:CC (match_dup 3)
3032 ;; We don't have a 32 bit "and. rt,ra,rb" for ppc64. cr is set from the
3033 ;; whole 64 bit reg, and we don't know what is in the high 32 bits.
3036 [(set (match_operand:CC 0 "cc_reg_operand" "")
3037 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
3038 (match_operand:SI 2 "gpc_reg_operand" ""))
3040 (clobber (match_scratch:SI 3 ""))
3041 (clobber (match_scratch:CC 4 ""))]
3042 "TARGET_POWERPC64 && reload_completed"
3043 [(parallel [(set (match_dup 3)
3044 (and:SI (match_dup 1)
3046 (clobber (match_dup 4))])
3048 (compare:CC (match_dup 3)
3052 (define_insn "*andsi3_internal4"
3053 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
3054 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
3055 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
3057 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
3058 (and:SI (match_dup 1)
3060 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
3061 "TARGET_32BIT && rs6000_gen_cell_microcode"
3066 rlwinm. %0,%1,0,%m2,%M2
3071 [(set_attr "type" "logical,logical,logical,shift,\
3072 compare,compare,compare,compare")
3073 (set_attr "dot" "yes")
3074 (set_attr "length" "4,4,4,4,8,8,8,8")])
3076 (define_insn "*andsi3_internal5_mc"
3077 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
3078 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
3079 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
3081 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
3082 (and:SI (match_dup 1)
3084 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
3085 "TARGET_64BIT && rs6000_gen_cell_microcode"
3090 rlwinm. %0,%1,0,%m2,%M2
3095 [(set_attr "type" "compare,logical,logical,shift,compare,\
3096 compare,compare,compare")
3097 (set_attr "dot" "yes")
3098 (set_attr "length" "8,4,4,4,8,8,8,8")])
3101 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3102 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
3103 (match_operand:SI 2 "and_operand" ""))
3105 (set (match_operand:SI 0 "gpc_reg_operand" "")
3106 (and:SI (match_dup 1)
3108 (clobber (match_scratch:CC 4 ""))]
3110 [(parallel [(set (match_dup 0)
3111 (and:SI (match_dup 1)
3113 (clobber (match_dup 4))])
3115 (compare:CC (match_dup 0)
3120 [(set (match_operand:CC 3 "cc_reg_operand" "")
3121 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
3122 (match_operand:SI 2 "gpc_reg_operand" ""))
3124 (set (match_operand:SI 0 "gpc_reg_operand" "")
3125 (and:SI (match_dup 1)
3127 (clobber (match_scratch:CC 4 ""))]
3128 "TARGET_POWERPC64 && reload_completed"
3129 [(parallel [(set (match_dup 0)
3130 (and:SI (match_dup 1)
3132 (clobber (match_dup 4))])
3134 (compare:CC (match_dup 0)
3138 ;; Handle the PowerPC64 rlwinm corner case
3140 (define_insn_and_split "*andsi3_internal6"
3141 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3142 (and:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3143 (match_operand:SI 2 "mask_operand_wrap" "i")))]
3148 (and:SI (rotate:SI (match_dup 1) (match_dup 3))
3151 (rotate:SI (match_dup 0) (match_dup 5)))]
3154 int mb = extract_MB (operands[2]);
3155 int me = extract_ME (operands[2]);
3156 operands[3] = GEN_INT (me + 1);
3157 operands[5] = GEN_INT (32 - (me + 1));
3158 operands[4] = GEN_INT (~((HOST_WIDE_INT) -1 << (33 + me - mb)));
3160 [(set_attr "length" "8")])
3163 (define_expand "ior<mode>3"
3164 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
3165 (ior:SDI (match_operand:SDI 1 "gpc_reg_operand" "")
3166 (match_operand:SDI 2 "reg_or_cint_operand" "")))]
3169 if (<MODE>mode == DImode && !TARGET_POWERPC64)
3171 rs6000_split_logical (operands, IOR, false, false, false, NULL_RTX);
3175 if (non_logical_cint_operand (operands[2], <MODE>mode))
3177 rtx tmp = ((!can_create_pseudo_p ()
3178 || rtx_equal_p (operands[0], operands[1]))
3179 ? operands[0] : gen_reg_rtx (<MODE>mode));
3180 HOST_WIDE_INT value = INTVAL (operands[2]);
3182 emit_insn (gen_ior<mode>3 (tmp, operands[1],
3183 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
3185 emit_insn (gen_ior<mode>3 (operands[0], tmp, GEN_INT (value & 0xffff)));
3189 if (!reg_or_logical_cint_operand (operands[2], <MODE>mode))
3190 operands[2] = force_reg (<MODE>mode, operands[2]);
3193 (define_expand "xor<mode>3"
3194 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
3195 (xor:SDI (match_operand:SDI 1 "gpc_reg_operand" "")
3196 (match_operand:SDI 2 "reg_or_cint_operand" "")))]
3199 if (<MODE>mode == DImode && !TARGET_POWERPC64)
3201 rs6000_split_logical (operands, XOR, false, false, false, NULL_RTX);
3205 if (non_logical_cint_operand (operands[2], <MODE>mode))
3207 rtx tmp = ((!can_create_pseudo_p ()
3208 || rtx_equal_p (operands[0], operands[1]))
3209 ? operands[0] : gen_reg_rtx (<MODE>mode));
3210 HOST_WIDE_INT value = INTVAL (operands[2]);
3212 emit_insn (gen_xor<mode>3 (tmp, operands[1],
3213 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
3215 emit_insn (gen_xor<mode>3 (operands[0], tmp, GEN_INT (value & 0xffff)));
3219 if (!reg_or_logical_cint_operand (operands[2], <MODE>mode))
3220 operands[2] = force_reg (<MODE>mode, operands[2]);
3223 (define_insn "*bool<mode>3"
3224 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
3225 (match_operator:GPR 3 "boolean_or_operator"
3226 [(match_operand:GPR 1 "gpc_reg_operand" "%r,r")
3227 (match_operand:GPR 2 "logical_operand" "r,n")]))]
3232 [(set_attr "type" "logical")])
3234 (define_insn_and_split "*bool<mode>3_dot"
3235 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3236 (compare:CC (match_operator:GPR 3 "boolean_or_operator"
3237 [(match_operand:GPR 1 "gpc_reg_operand" "r,r")
3238 (match_operand:GPR 2 "gpc_reg_operand" "r,r")])
3240 (clobber (match_scratch:GPR 0 "=r,r"))]
3241 "<MODE>mode == Pmode && rs6000_gen_cell_microcode"
3245 "&& reload_completed && cc_reg_not_cr0_operand (operands[4], CCmode)"
3249 (compare:CC (match_dup 0)
3252 [(set_attr "type" "logical")
3253 (set_attr "dot" "yes")
3254 (set_attr "length" "4,8")])
3256 (define_insn_and_split "*bool<mode>3_dot2"
3257 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3258 (compare:CC (match_operator:GPR 3 "boolean_or_operator"
3259 [(match_operand:GPR 1 "gpc_reg_operand" "r,r")
3260 (match_operand:GPR 2 "gpc_reg_operand" "r,r")])
3262 (set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
3264 "<MODE>mode == Pmode && rs6000_gen_cell_microcode"
3268 "&& reload_completed && cc_reg_not_cr0_operand (operands[4], CCmode)"
3272 (compare:CC (match_dup 0)
3275 [(set_attr "type" "logical")
3276 (set_attr "dot" "yes")
3277 (set_attr "length" "4,8")])
3279 ;; Split a logical operation that we can't do in one insn into two insns,
3280 ;; each of which does one 16-bit part. This is used by combine.
3283 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
3284 (match_operator:GPR 3 "boolean_or_operator"
3285 [(match_operand:GPR 1 "gpc_reg_operand" "")
3286 (match_operand:GPR 2 "non_logical_cint_operand" "")]))]
3288 [(set (match_dup 0) (match_dup 4))
3289 (set (match_dup 0) (match_dup 5))]
3292 i = GEN_INT (INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff));
3293 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), <MODE>mode,
3295 i = GEN_INT (INTVAL (operands[2]) & 0xffff);
3296 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), <MODE>mode,
3301 (define_insn "*boolcsi3_internal1"
3302 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3303 (match_operator:SI 3 "boolean_operator"
3304 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
3305 (match_operand:SI 2 "gpc_reg_operand" "r")]))]
3309 (define_insn "*boolcsi3_internal2"
3310 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3311 (compare:CC (match_operator:SI 4 "boolean_operator"
3312 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
3313 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3315 (clobber (match_scratch:SI 3 "=r,r"))]
3320 [(set_attr "type" "compare")
3321 (set_attr "length" "4,8")])
3324 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3325 (compare:CC (match_operator:SI 4 "boolean_operator"
3326 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3327 (match_operand:SI 2 "gpc_reg_operand" "")])
3329 (clobber (match_scratch:SI 3 ""))]
3330 "TARGET_32BIT && reload_completed"
3331 [(set (match_dup 3) (match_dup 4))
3333 (compare:CC (match_dup 3)
3337 (define_insn "*boolcsi3_internal3"
3338 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3339 (compare:CC (match_operator:SI 4 "boolean_operator"
3340 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
3341 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3343 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3349 [(set_attr "type" "compare")
3350 (set_attr "length" "4,8")])
3353 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3354 (compare:CC (match_operator:SI 4 "boolean_operator"
3355 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3356 (match_operand:SI 2 "gpc_reg_operand" "")])
3358 (set (match_operand:SI 0 "gpc_reg_operand" "")
3360 "TARGET_32BIT && reload_completed"
3361 [(set (match_dup 0) (match_dup 4))
3363 (compare:CC (match_dup 0)
3367 (define_insn "*boolccsi3_internal1"
3368 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3369 (match_operator:SI 3 "boolean_operator"
3370 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
3371 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))]))]
3375 (define_insn "*boolccsi3_internal2"
3376 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3377 (compare:CC (match_operator:SI 4 "boolean_operator"
3378 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
3379 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
3381 (clobber (match_scratch:SI 3 "=r,r"))]
3386 [(set_attr "type" "logical,compare")
3387 (set_attr "dot" "yes")
3388 (set_attr "length" "4,8")])
3391 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3392 (compare:CC (match_operator:SI 4 "boolean_operator"
3393 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3394 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
3396 (clobber (match_scratch:SI 3 ""))]
3397 "TARGET_32BIT && reload_completed"
3398 [(set (match_dup 3) (match_dup 4))
3400 (compare:CC (match_dup 3)
3404 (define_insn "*boolccsi3_internal3"
3405 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3406 (compare:CC (match_operator:SI 4 "boolean_operator"
3407 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
3408 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
3410 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3416 [(set_attr "type" "logical,compare")
3417 (set_attr "dot" "yes")
3418 (set_attr "length" "4,8")])
3421 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3422 (compare:CC (match_operator:SI 4 "boolean_operator"
3423 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3424 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
3426 (set (match_operand:SI 0 "gpc_reg_operand" "")
3428 "TARGET_32BIT && reload_completed"
3429 [(set (match_dup 0) (match_dup 4))
3431 (compare:CC (match_dup 0)
3435 ;; Rotate and shift insns, in all their variants. These support shifts,
3436 ;; field inserts and extracts, and various combinations thereof.
3437 (define_expand "insv"
3438 [(set (zero_extract (match_operand 0 "gpc_reg_operand" "")
3439 (match_operand:SI 1 "const_int_operand" "")
3440 (match_operand:SI 2 "const_int_operand" ""))
3441 (match_operand 3 "gpc_reg_operand" ""))]
3445 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3446 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3447 compiler if the address of the structure is taken later. Likewise, do
3448 not handle invalid E500 subregs. */
3449 if (GET_CODE (operands[0]) == SUBREG
3450 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD
3451 || ((TARGET_E500_DOUBLE || TARGET_SPE)
3452 && invalid_e500_subreg (operands[0], GET_MODE (operands[0])))))
3455 if (TARGET_POWERPC64 && GET_MODE (operands[0]) == DImode)
3456 emit_insn (gen_insvdi_internal (operands[0], operands[1], operands[2],
3459 emit_insn (gen_insvsi_internal (operands[0], operands[1], operands[2],
3464 (define_insn "insvsi_internal"
3465 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3466 (match_operand:SI 1 "const_int_operand" "i")
3467 (match_operand:SI 2 "const_int_operand" "i"))
3468 (match_operand:SI 3 "gpc_reg_operand" "r"))]
3472 int start = INTVAL (operands[2]) & 31;
3473 int size = INTVAL (operands[1]) & 31;
3475 operands[4] = GEN_INT (32 - start - size);
3476 operands[1] = GEN_INT (start + size - 1);
3477 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3479 [(set_attr "type" "insert")])
3481 (define_insn "*insvsi_internal1"
3482 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3483 (match_operand:SI 1 "const_int_operand" "i")
3484 (match_operand:SI 2 "const_int_operand" "i"))
3485 (rotate:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3486 (match_operand:SI 4 "const_int_operand" "i")))]
3487 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3490 int shift = INTVAL (operands[4]) & 31;
3491 int start = INTVAL (operands[2]) & 31;
3492 int size = INTVAL (operands[1]) & 31;
3494 operands[4] = GEN_INT (shift - start - size);
3495 operands[1] = GEN_INT (start + size - 1);
3496 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3498 [(set_attr "type" "insert")])
3500 (define_insn "*insvsi_internal2"
3501 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3502 (match_operand:SI 1 "const_int_operand" "i")
3503 (match_operand:SI 2 "const_int_operand" "i"))
3504 (ashiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3505 (match_operand:SI 4 "const_int_operand" "i")))]
3506 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3509 int shift = INTVAL (operands[4]) & 31;
3510 int start = INTVAL (operands[2]) & 31;
3511 int size = INTVAL (operands[1]) & 31;
3513 operands[4] = GEN_INT (32 - shift - start - size);
3514 operands[1] = GEN_INT (start + size - 1);
3515 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3517 [(set_attr "type" "insert")])
3519 (define_insn "*insvsi_internal3"
3520 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3521 (match_operand:SI 1 "const_int_operand" "i")
3522 (match_operand:SI 2 "const_int_operand" "i"))
3523 (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3524 (match_operand:SI 4 "const_int_operand" "i")))]
3525 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3528 int shift = INTVAL (operands[4]) & 31;
3529 int start = INTVAL (operands[2]) & 31;
3530 int size = INTVAL (operands[1]) & 31;
3532 operands[4] = GEN_INT (32 - shift - start - size);
3533 operands[1] = GEN_INT (start + size - 1);
3534 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3536 [(set_attr "type" "insert")])
3538 (define_insn "*insvsi_internal4"
3539 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3540 (match_operand:SI 1 "const_int_operand" "i")
3541 (match_operand:SI 2 "const_int_operand" "i"))
3542 (zero_extract:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3543 (match_operand:SI 4 "const_int_operand" "i")
3544 (match_operand:SI 5 "const_int_operand" "i")))]
3545 "INTVAL (operands[4]) >= INTVAL (operands[1])"
3548 int extract_start = INTVAL (operands[5]) & 31;
3549 int extract_size = INTVAL (operands[4]) & 31;
3550 int insert_start = INTVAL (operands[2]) & 31;
3551 int insert_size = INTVAL (operands[1]) & 31;
3553 /* Align extract field with insert field */
3554 operands[5] = GEN_INT (extract_start + extract_size - insert_start - insert_size);
3555 operands[1] = GEN_INT (insert_start + insert_size - 1);
3556 return \"rlwimi %0,%3,%h5,%h2,%h1\";
3558 [(set_attr "type" "insert")])
3560 ;; combine patterns for rlwimi
3561 (define_insn "*insvsi_internal5"
3562 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3563 (ior:SI (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
3564 (match_operand:SI 1 "mask_operand" "i"))
3565 (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3566 (match_operand:SI 2 "const_int_operand" "i"))
3567 (match_operand:SI 5 "mask_operand" "i"))))]
3568 "INTVAL(operands[1]) == ~INTVAL(operands[5])"
3571 int me = extract_ME(operands[5]);
3572 int mb = extract_MB(operands[5]);
3573 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
3574 operands[2] = GEN_INT(mb);
3575 operands[1] = GEN_INT(me);
3576 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3578 [(set_attr "type" "insert")])
3580 (define_insn "*insvsi_internal6"
3581 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3582 (ior:SI (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3583 (match_operand:SI 2 "const_int_operand" "i"))
3584 (match_operand:SI 5 "mask_operand" "i"))
3585 (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
3586 (match_operand:SI 1 "mask_operand" "i"))))]
3587 "INTVAL(operands[1]) == ~INTVAL(operands[5])"
3590 int me = extract_ME(operands[5]);
3591 int mb = extract_MB(operands[5]);
3592 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
3593 operands[2] = GEN_INT(mb);
3594 operands[1] = GEN_INT(me);
3595 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3597 [(set_attr "type" "insert")])
3599 (define_insn "insvdi_internal"
3600 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3601 (match_operand:SI 1 "const_int_operand" "i")
3602 (match_operand:SI 2 "const_int_operand" "i"))
3603 (match_operand:DI 3 "gpc_reg_operand" "r"))]
3607 int start = INTVAL (operands[2]) & 63;
3608 int size = INTVAL (operands[1]) & 63;
3610 operands[1] = GEN_INT (64 - start - size);
3611 return \"rldimi %0,%3,%H1,%H2\";
3613 [(set_attr "type" "insert")
3614 (set_attr "size" "64")])
3616 (define_insn "*insvdi_internal2"
3617 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3618 (match_operand:SI 1 "const_int_operand" "i")
3619 (match_operand:SI 2 "const_int_operand" "i"))
3620 (ashiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
3621 (match_operand:SI 4 "const_int_operand" "i")))]
3623 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
3626 int shift = INTVAL (operands[4]) & 63;
3627 int start = (INTVAL (operands[2]) & 63) - 32;
3628 int size = INTVAL (operands[1]) & 63;
3630 operands[4] = GEN_INT (64 - shift - start - size);
3631 operands[2] = GEN_INT (start);
3632 operands[1] = GEN_INT (start + size - 1);
3633 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3636 (define_insn "*insvdi_internal3"
3637 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3638 (match_operand:SI 1 "const_int_operand" "i")
3639 (match_operand:SI 2 "const_int_operand" "i"))
3640 (lshiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
3641 (match_operand:SI 4 "const_int_operand" "i")))]
3643 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
3646 int shift = INTVAL (operands[4]) & 63;
3647 int start = (INTVAL (operands[2]) & 63) - 32;
3648 int size = INTVAL (operands[1]) & 63;
3650 operands[4] = GEN_INT (64 - shift - start - size);
3651 operands[2] = GEN_INT (start);
3652 operands[1] = GEN_INT (start + size - 1);
3653 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3656 (define_expand "extzv"
3657 [(set (match_operand 0 "gpc_reg_operand" "")
3658 (zero_extract (match_operand 1 "gpc_reg_operand" "")
3659 (match_operand:SI 2 "const_int_operand" "")
3660 (match_operand:SI 3 "const_int_operand" "")))]
3664 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3665 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3666 compiler if the address of the structure is taken later. */
3667 if (GET_CODE (operands[0]) == SUBREG
3668 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
3671 if (TARGET_POWERPC64 && GET_MODE (operands[1]) == DImode)
3672 emit_insn (gen_extzvdi_internal (operands[0], operands[1], operands[2],
3675 emit_insn (gen_extzvsi_internal (operands[0], operands[1], operands[2],
3680 (define_insn "extzvsi_internal"
3681 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3682 (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3683 (match_operand:SI 2 "const_int_operand" "i")
3684 (match_operand:SI 3 "const_int_operand" "i")))]
3688 int start = INTVAL (operands[3]) & 31;
3689 int size = INTVAL (operands[2]) & 31;
3691 if (start + size >= 32)
3692 operands[3] = const0_rtx;
3694 operands[3] = GEN_INT (start + size);
3695 return \"rlwinm %0,%1,%3,%s2,31\";
3697 [(set_attr "type" "shift")])
3699 (define_insn "*extzvsi_internal1"
3700 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3701 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3702 (match_operand:SI 2 "const_int_operand" "i,i")
3703 (match_operand:SI 3 "const_int_operand" "i,i"))
3705 (clobber (match_scratch:SI 4 "=r,r"))]
3709 int start = INTVAL (operands[3]) & 31;
3710 int size = INTVAL (operands[2]) & 31;
3712 /* Force split for non-cc0 compare. */
3713 if (which_alternative == 1)
3716 /* If the bit-field being tested fits in the upper or lower half of a
3717 word, it is possible to use andiu. or andil. to test it. This is
3718 useful because the condition register set-use delay is smaller for
3719 andi[ul]. than for rlinm. This doesn't work when the starting bit
3720 position is 0 because the LT and GT bits may be set wrong. */
3722 if ((start > 0 && start + size <= 16) || start >= 16)
3724 operands[3] = GEN_INT (((1 << (16 - (start & 15)))
3725 - (1 << (16 - (start & 15) - size))));
3727 return \"andis. %4,%1,%3\";
3729 return \"andi. %4,%1,%3\";
3732 if (start + size >= 32)
3733 operands[3] = const0_rtx;
3735 operands[3] = GEN_INT (start + size);
3736 return \"rlwinm. %4,%1,%3,%s2,31\";
3738 [(set_attr "type" "shift")
3739 (set_attr "dot" "yes")
3740 (set_attr "length" "4,8")])
3743 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3744 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3745 (match_operand:SI 2 "const_int_operand" "")
3746 (match_operand:SI 3 "const_int_operand" ""))
3748 (clobber (match_scratch:SI 4 ""))]
3751 (zero_extract:SI (match_dup 1) (match_dup 2)
3754 (compare:CC (match_dup 4)
3758 (define_insn "*extzvsi_internal2"
3759 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3760 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3761 (match_operand:SI 2 "const_int_operand" "i,i")
3762 (match_operand:SI 3 "const_int_operand" "i,i"))
3764 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3765 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3769 int start = INTVAL (operands[3]) & 31;
3770 int size = INTVAL (operands[2]) & 31;
3772 /* Force split for non-cc0 compare. */
3773 if (which_alternative == 1)
3776 /* Since we are using the output value, we can't ignore any need for
3777 a shift. The bit-field must end at the LSB. */
3778 if (start >= 16 && start + size == 32)
3780 operands[3] = GEN_INT ((1 << size) - 1);
3781 return \"andi. %0,%1,%3\";
3784 if (start + size >= 32)
3785 operands[3] = const0_rtx;
3787 operands[3] = GEN_INT (start + size);
3788 return \"rlwinm. %0,%1,%3,%s2,31\";
3790 [(set_attr "type" "shift")
3791 (set_attr "dot" "yes")
3792 (set_attr "length" "4,8")])
3795 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
3796 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3797 (match_operand:SI 2 "const_int_operand" "")
3798 (match_operand:SI 3 "const_int_operand" ""))
3800 (set (match_operand:SI 0 "gpc_reg_operand" "")
3801 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3804 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))
3806 (compare:CC (match_dup 0)
3810 (define_insn "extzvdi_internal"
3811 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
3812 (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3813 (match_operand:SI 2 "const_int_operand" "i")
3814 (match_operand:SI 3 "const_int_operand" "i")))]
3818 int start = INTVAL (operands[3]) & 63;
3819 int size = INTVAL (operands[2]) & 63;
3821 if (start + size >= 64)
3822 operands[3] = const0_rtx;
3824 operands[3] = GEN_INT (start + size);
3825 operands[2] = GEN_INT (64 - size);
3826 return \"rldicl %0,%1,%3,%2\";
3828 [(set_attr "type" "shift")])
3830 (define_insn "*extzvdi_internal1"
3831 [(set (match_operand:CC 0 "gpc_reg_operand" "=x")
3832 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3833 (match_operand:SI 2 "const_int_operand" "i")
3834 (match_operand:SI 3 "const_int_operand" "i"))
3836 (clobber (match_scratch:DI 4 "=r"))]
3837 "TARGET_64BIT && rs6000_gen_cell_microcode"
3840 int start = INTVAL (operands[3]) & 63;
3841 int size = INTVAL (operands[2]) & 63;
3843 if (start + size >= 64)
3844 operands[3] = const0_rtx;
3846 operands[3] = GEN_INT (start + size);
3847 operands[2] = GEN_INT (64 - size);
3848 return \"rldicl. %4,%1,%3,%2\";
3850 [(set_attr "type" "shift")
3851 (set_attr "dot" "yes")])
3853 (define_insn "*extzvdi_internal2"
3854 [(set (match_operand:CC 4 "gpc_reg_operand" "=x")
3855 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3856 (match_operand:SI 2 "const_int_operand" "i")
3857 (match_operand:SI 3 "const_int_operand" "i"))
3859 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
3860 (zero_extract:DI (match_dup 1) (match_dup 2) (match_dup 3)))]
3861 "TARGET_64BIT && rs6000_gen_cell_microcode"
3864 int start = INTVAL (operands[3]) & 63;
3865 int size = INTVAL (operands[2]) & 63;
3867 if (start + size >= 64)
3868 operands[3] = const0_rtx;
3870 operands[3] = GEN_INT (start + size);
3871 operands[2] = GEN_INT (64 - size);
3872 return \"rldicl. %0,%1,%3,%2\";
3874 [(set_attr "type" "shift")
3875 (set_attr "dot" "yes")])
3878 (define_insn "rotl<mode>3"
3879 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
3880 (rotate:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
3881 (match_operand:SI 2 "reg_or_cint_operand" "rn")))]
3883 "rotl<wd>%I2 %0,%1,%<hH>2"
3884 [(set_attr "type" "shift")
3885 (set_attr "maybe_var_shift" "yes")])
3887 (define_insn "*rotlsi3_64"
3888 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
3890 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3891 (match_operand:SI 2 "reg_or_cint_operand" "rn"))))]
3893 "rotlw%I2 %0,%1,%h2"
3894 [(set_attr "type" "shift")
3895 (set_attr "maybe_var_shift" "yes")])
3897 (define_insn_and_split "*rotl<mode>3_dot"
3898 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3899 (compare:CC (rotate:GPR (match_operand:GPR 1 "gpc_reg_operand" "r,r")
3900 (match_operand:SI 2 "reg_or_cint_operand" "rn,rn"))
3902 (clobber (match_scratch:GPR 0 "=r,r"))]
3903 "<MODE>mode == Pmode && rs6000_gen_cell_microcode"
3905 rotl<wd>%I2. %0,%1,%<hH>2
3907 "&& reload_completed && cc_reg_not_cr0_operand (operands[3], CCmode)"
3909 (rotate:GPR (match_dup 1)
3912 (compare:CC (match_dup 0)
3915 [(set_attr "type" "shift")
3916 (set_attr "maybe_var_shift" "yes")
3917 (set_attr "dot" "yes")
3918 (set_attr "length" "4,8")])
3920 (define_insn_and_split "*rotl<mode>3_dot2"
3921 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3922 (compare:CC (rotate:GPR (match_operand:GPR 1 "gpc_reg_operand" "r,r")
3923 (match_operand:SI 2 "reg_or_cint_operand" "rn,rn"))
3925 (set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
3926 (rotate:GPR (match_dup 1)
3928 "<MODE>mode == Pmode && rs6000_gen_cell_microcode"
3930 rotl<wd>%I2. %0,%1,%<hH>2
3932 "&& reload_completed && cc_reg_not_cr0_operand (operands[3], CCmode)"
3934 (rotate:GPR (match_dup 1)
3937 (compare:CC (match_dup 0)
3940 [(set_attr "type" "shift")
3941 (set_attr "maybe_var_shift" "yes")
3942 (set_attr "dot" "yes")
3943 (set_attr "length" "4,8")])
3946 (define_insn "*rotlsi3_internal4"
3947 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3948 (and:SI (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3949 (match_operand:SI 2 "reg_or_cint_operand" "rn"))
3950 (match_operand:SI 3 "mask_operand" "n")))]
3952 "rlw%I2nm %0,%1,%h2,%m3,%M3"
3953 [(set_attr "type" "shift")
3954 (set_attr "maybe_var_shift" "yes")])
3956 (define_insn "*rotlsi3_internal5"
3957 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3959 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3960 (match_operand:SI 2 "reg_or_cint_operand" "rn,rn"))
3961 (match_operand:SI 3 "mask_operand" "n,n"))
3963 (clobber (match_scratch:SI 4 "=r,r"))]
3966 rlw%I2nm. %4,%1,%h2,%m3,%M3
3968 [(set_attr "type" "shift")
3969 (set_attr "maybe_var_shift" "yes")
3970 (set_attr "dot" "yes")
3971 (set_attr "length" "4,8")])
3974 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3976 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3977 (match_operand:SI 2 "reg_or_cint_operand" ""))
3978 (match_operand:SI 3 "mask_operand" ""))
3980 (clobber (match_scratch:SI 4 ""))]
3983 (and:SI (rotate:SI (match_dup 1)
3987 (compare:CC (match_dup 4)
3991 (define_insn "*rotlsi3_internal6"
3992 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3994 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3995 (match_operand:SI 2 "reg_or_cint_operand" "rn,rn"))
3996 (match_operand:SI 3 "mask_operand" "n,n"))
3998 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3999 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4002 rlw%I2nm. %0,%1,%h2,%m3,%M3
4004 [(set_attr "type" "shift")
4005 (set_attr "maybe_var_shift" "yes")
4006 (set_attr "dot" "yes")
4007 (set_attr "length" "4,8")])
4010 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
4012 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4013 (match_operand:SI 2 "reg_or_cint_operand" ""))
4014 (match_operand:SI 3 "mask_operand" ""))
4016 (set (match_operand:SI 0 "gpc_reg_operand" "")
4017 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4020 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4022 (compare:CC (match_dup 0)
4026 (define_insn "*rotlsi3_internal7le"
4027 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4030 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4031 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
4033 "rlw%I2nm %0,%1,%h2,0xff"
4034 [(set (attr "cell_micro")
4035 (if_then_else (match_operand:SI 2 "const_int_operand" "")
4036 (const_string "not")
4037 (const_string "always")))
4038 (set_attr "type" "shift")])
4040 (define_insn "*rotlsi3_internal7be"
4041 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4044 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4045 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 3)))]
4047 "rlw%I2nm %0,%1,%h2,0xff"
4048 [(set (attr "cell_micro")
4049 (if_then_else (match_operand:SI 2 "const_int_operand" "")
4050 (const_string "not")
4051 (const_string "always")))
4052 (set_attr "type" "shift")])
4054 (define_insn "*rotlsi3_internal8le"
4055 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4056 (compare:CC (zero_extend:SI
4058 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4059 (match_operand:SI 2 "reg_or_cint_operand" "rn,rn")) 0))
4061 (clobber (match_scratch:SI 3 "=r,r"))]
4064 rlw%I2nm. %3,%1,%h2,0xff
4066 [(set_attr "type" "shift")
4067 (set_attr "maybe_var_shift" "yes")
4068 (set_attr "dot" "yes")
4069 (set_attr "length" "4,8")])
4071 (define_insn "*rotlsi3_internal8be"
4072 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4073 (compare:CC (zero_extend:SI
4075 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4076 (match_operand:SI 2 "reg_or_cint_operand" "rn,rn")) 3))
4078 (clobber (match_scratch:SI 3 "=r,r"))]
4081 rlw%I2nm. %3,%1,%h2,0xff
4083 [(set_attr "type" "shift")
4084 (set_attr "maybe_var_shift" "yes")
4085 (set_attr "dot" "yes")
4086 (set_attr "length" "4,8")])
4089 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4090 (compare:CC (zero_extend:SI
4092 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4093 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4095 (clobber (match_scratch:SI 3 ""))]
4096 "!BYTES_BIG_ENDIAN && reload_completed"
4098 (zero_extend:SI (subreg:QI
4099 (rotate:SI (match_dup 1)
4102 (compare:CC (match_dup 3)
4107 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4108 (compare:CC (zero_extend:SI
4110 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4111 (match_operand:SI 2 "reg_or_cint_operand" "")) 3))
4113 (clobber (match_scratch:SI 3 ""))]
4114 "BYTES_BIG_ENDIAN && reload_completed"
4116 (zero_extend:SI (subreg:QI
4117 (rotate:SI (match_dup 1)
4120 (compare:CC (match_dup 3)
4124 (define_insn "*rotlsi3_internal9le"
4125 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4126 (compare:CC (zero_extend:SI
4128 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4129 (match_operand:SI 2 "reg_or_cint_operand" "rn,rn")) 0))
4131 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4132 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4135 rlw%I2nm. %0,%1,%h2,0xff
4137 [(set_attr "type" "shift")
4138 (set_attr "maybe_var_shift" "yes")
4139 (set_attr "dot" "yes")
4140 (set_attr "length" "4,8")])
4142 (define_insn "*rotlsi3_internal9be"
4143 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4144 (compare:CC (zero_extend:SI
4146 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4147 (match_operand:SI 2 "reg_or_cint_operand" "rn,rn")) 3))
4149 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4150 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 3)))]
4153 rlw%I2nm. %0,%1,%h2,0xff
4155 [(set_attr "type" "shift")
4156 (set_attr "maybe_var_shift" "yes")
4157 (set_attr "dot" "yes")
4158 (set_attr "length" "4,8")])
4161 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4162 (compare:CC (zero_extend:SI
4164 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4165 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4167 (set (match_operand:SI 0 "gpc_reg_operand" "")
4168 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4169 "!BYTES_BIG_ENDIAN && reload_completed"
4171 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
4173 (compare:CC (match_dup 0)
4178 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4179 (compare:CC (zero_extend:SI
4181 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4182 (match_operand:SI 2 "reg_or_cint_operand" "")) 3))
4184 (set (match_operand:SI 0 "gpc_reg_operand" "")
4185 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 3)))]
4186 "BYTES_BIG_ENDIAN && reload_completed"
4188 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 3)))
4190 (compare:CC (match_dup 0)
4194 (define_insn "*rotlsi3_internal10le"
4195 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4198 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4199 (match_operand:SI 2 "reg_or_cint_operand" "rn")) 0)))]
4201 "rlw%I2nm %0,%1,%h2,0xffff"
4202 [(set_attr "type" "shift")
4203 (set_attr "maybe_var_shift" "yes")])
4205 (define_insn "*rotlsi3_internal10be"
4206 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4209 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4210 (match_operand:SI 2 "reg_or_cint_operand" "rn")) 2)))]
4212 "rlw%I2nm %0,%1,%h2,0xffff"
4213 [(set_attr "type" "shift")
4214 (set_attr "maybe_var_shift" "yes")])
4216 (define_insn "*rotlsi3_internal11le"
4217 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4218 (compare:CC (zero_extend:SI
4220 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4221 (match_operand:SI 2 "reg_or_cint_operand" "rn,rn")) 0))
4223 (clobber (match_scratch:SI 3 "=r,r"))]
4226 rlw%I2nm. %3,%1,%h2,0xffff
4228 [(set_attr "type" "shift")
4229 (set_attr "maybe_var_shift" "yes")
4230 (set_attr "dot" "yes")
4231 (set_attr "length" "4,8")])
4233 (define_insn "*rotlsi3_internal11be"
4234 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4235 (compare:CC (zero_extend:SI
4237 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4238 (match_operand:SI 2 "reg_or_cint_operand" "rn,rn")) 2))
4240 (clobber (match_scratch:SI 3 "=r,r"))]
4243 rlw%I2nm. %3,%1,%h2,0xffff
4245 [(set_attr "type" "shift")
4246 (set_attr "maybe_var_shift" "yes")
4247 (set_attr "dot" "yes")
4248 (set_attr "length" "4,8")])
4251 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4252 (compare:CC (zero_extend:SI
4254 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4255 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4257 (clobber (match_scratch:SI 3 ""))]
4258 "!BYTES_BIG_ENDIAN && reload_completed"
4260 (zero_extend:SI (subreg:HI
4261 (rotate:SI (match_dup 1)
4264 (compare:CC (match_dup 3)
4269 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4270 (compare:CC (zero_extend:SI
4272 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4273 (match_operand:SI 2 "reg_or_cint_operand" "")) 2))
4275 (clobber (match_scratch:SI 3 ""))]
4276 "BYTES_BIG_ENDIAN && reload_completed"
4278 (zero_extend:SI (subreg:HI
4279 (rotate:SI (match_dup 1)
4282 (compare:CC (match_dup 3)
4286 (define_insn "*rotlsi3_internal12le"
4287 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4288 (compare:CC (zero_extend:SI
4290 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4291 (match_operand:SI 2 "reg_or_cint_operand" "rn,rn")) 0))
4293 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4294 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4297 rlw%I2nm. %0,%1,%h2,0xffff
4299 [(set_attr "type" "shift")
4300 (set_attr "maybe_var_shift" "yes")
4301 (set_attr "dot" "yes")
4302 (set_attr "length" "4,8")])
4304 (define_insn "*rotlsi3_internal12be"
4305 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4306 (compare:CC (zero_extend:SI
4308 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4309 (match_operand:SI 2 "reg_or_cint_operand" "rn,rn")) 2))
4311 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4312 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 2)))]
4315 rlw%I2nm. %0,%1,%h2,0xffff
4317 [(set_attr "type" "shift")
4318 (set_attr "maybe_var_shift" "yes")
4319 (set_attr "dot" "yes")
4320 (set_attr "length" "4,8")])
4323 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4324 (compare:CC (zero_extend:SI
4326 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4327 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4329 (set (match_operand:SI 0 "gpc_reg_operand" "")
4330 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4331 "!BYTES_BIG_ENDIAN && reload_completed"
4333 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
4335 (compare:CC (match_dup 0)
4340 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4341 (compare:CC (zero_extend:SI
4343 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4344 (match_operand:SI 2 "reg_or_cint_operand" "")) 2))
4346 (set (match_operand:SI 0 "gpc_reg_operand" "")
4347 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 2)))]
4348 "BYTES_BIG_ENDIAN && reload_completed"
4350 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 2)))
4352 (compare:CC (match_dup 0)
4357 (define_insn "ashl<mode>3"
4358 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
4359 (ashift:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
4360 (match_operand:SI 2 "reg_or_cint_operand" "rn")))]
4362 "sl<wd>%I2 %0,%1,%<hH>2"
4363 [(set_attr "type" "shift")
4364 (set_attr "maybe_var_shift" "yes")])
4366 (define_insn "*ashlsi3_64"
4367 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4369 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4370 (match_operand:SI 2 "reg_or_cint_operand" "rn"))))]
4373 [(set_attr "type" "shift")
4374 (set_attr "maybe_var_shift" "yes")])
4376 (define_insn_and_split "*ashl<mode>3_dot"
4377 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4378 (compare:CC (ashift:GPR (match_operand:GPR 1 "gpc_reg_operand" "r,r")
4379 (match_operand:SI 2 "reg_or_cint_operand" "rn,rn"))
4381 (clobber (match_scratch:GPR 0 "=r,r"))]
4382 "<MODE>mode == Pmode && rs6000_gen_cell_microcode"
4384 sl<wd>%I2. %0,%1,%<hH>2
4386 "&& reload_completed && cc_reg_not_cr0_operand (operands[3], CCmode)"
4388 (ashift:GPR (match_dup 1)
4391 (compare:CC (match_dup 0)
4394 [(set_attr "type" "shift")
4395 (set_attr "maybe_var_shift" "yes")
4396 (set_attr "dot" "yes")
4397 (set_attr "length" "4,8")])
4399 (define_insn_and_split "*ashl<mode>3_dot2"
4400 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4401 (compare:CC (ashift:GPR (match_operand:GPR 1 "gpc_reg_operand" "r,r")
4402 (match_operand:SI 2 "reg_or_cint_operand" "rn,rn"))
4404 (set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
4405 (ashift:GPR (match_dup 1)
4407 "<MODE>mode == Pmode && rs6000_gen_cell_microcode"
4409 sl<wd>%I2. %0,%1,%<hH>2
4411 "&& reload_completed && cc_reg_not_cr0_operand (operands[3], CCmode)"
4413 (ashift:GPR (match_dup 1)
4416 (compare:CC (match_dup 0)
4419 [(set_attr "type" "shift")
4420 (set_attr "maybe_var_shift" "yes")
4421 (set_attr "dot" "yes")
4422 (set_attr "length" "4,8")])
4425 (define_insn "rlwinm"
4426 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4427 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4428 (match_operand:SI 2 "const_int_operand" "i"))
4429 (match_operand:SI 3 "mask_operand" "n")))]
4430 "includes_lshift_p (operands[2], operands[3])"
4431 "rlwinm %0,%1,%h2,%m3,%M3"
4432 [(set_attr "type" "shift")])
4435 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4437 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4438 (match_operand:SI 2 "const_int_operand" "i,i"))
4439 (match_operand:SI 3 "mask_operand" "n,n"))
4441 (clobber (match_scratch:SI 4 "=r,r"))]
4442 "includes_lshift_p (operands[2], operands[3])"
4444 rlwinm. %4,%1,%h2,%m3,%M3
4446 [(set_attr "type" "shift")
4447 (set_attr "dot" "yes")
4448 (set_attr "length" "4,8")])
4451 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4453 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4454 (match_operand:SI 2 "const_int_operand" ""))
4455 (match_operand:SI 3 "mask_operand" ""))
4457 (clobber (match_scratch:SI 4 ""))]
4458 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
4460 (and:SI (ashift:SI (match_dup 1) (match_dup 2))
4463 (compare:CC (match_dup 4)
4468 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4470 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4471 (match_operand:SI 2 "const_int_operand" "i,i"))
4472 (match_operand:SI 3 "mask_operand" "n,n"))
4474 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4475 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4476 "includes_lshift_p (operands[2], operands[3])"
4478 rlwinm. %0,%1,%h2,%m3,%M3
4480 [(set_attr "type" "shift")
4481 (set_attr "dot" "yes")
4482 (set_attr "length" "4,8")])
4485 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
4487 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4488 (match_operand:SI 2 "const_int_operand" ""))
4489 (match_operand:SI 3 "mask_operand" ""))
4491 (set (match_operand:SI 0 "gpc_reg_operand" "")
4492 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4493 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
4495 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4497 (compare:CC (match_dup 0)
4502 (define_insn "lshr<mode>3"
4503 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
4504 (lshiftrt:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
4505 (match_operand:SI 2 "reg_or_cint_operand" "rn")))]
4507 "sr<wd>%I2 %0,%1,%<hH>2"
4508 [(set_attr "type" "shift")
4509 (set_attr "maybe_var_shift" "yes")])
4511 (define_insn "*lshrsi3_64"
4512 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4514 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4515 (match_operand:SI 2 "reg_or_cint_operand" "rn"))))]
4518 [(set_attr "type" "shift")
4519 (set_attr "maybe_var_shift" "yes")])
4521 (define_insn_and_split "*lshr<mode>3_dot"
4522 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4523 (compare:CC (lshiftrt:GPR (match_operand:GPR 1 "gpc_reg_operand" "r,r")
4524 (match_operand:SI 2 "reg_or_cint_operand" "rn,rn"))
4526 (clobber (match_scratch:GPR 0 "=r,r"))]
4527 "<MODE>mode == Pmode && rs6000_gen_cell_microcode"
4529 sr<wd>%I2. %0,%1,%<hH>2
4531 "&& reload_completed && cc_reg_not_cr0_operand (operands[3], CCmode)"
4533 (lshiftrt:GPR (match_dup 1)
4536 (compare:CC (match_dup 0)
4539 [(set_attr "type" "shift")
4540 (set_attr "maybe_var_shift" "yes")
4541 (set_attr "dot" "yes")
4542 (set_attr "length" "4,8")])
4544 (define_insn_and_split "*lshr<mode>3_dot2"
4545 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4546 (compare:CC (lshiftrt:GPR (match_operand:GPR 1 "gpc_reg_operand" "r,r")
4547 (match_operand:SI 2 "reg_or_cint_operand" "rn,rn"))
4549 (set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
4550 (lshiftrt:GPR (match_dup 1)
4552 "<MODE>mode == Pmode && rs6000_gen_cell_microcode"
4554 sr<wd>%I2. %0,%1,%<hH>2
4556 "&& reload_completed && cc_reg_not_cr0_operand (operands[3], CCmode)"
4558 (lshiftrt:GPR (match_dup 1)
4561 (compare:CC (match_dup 0)
4564 [(set_attr "type" "shift")
4565 (set_attr "maybe_var_shift" "yes")
4566 (set_attr "dot" "yes")
4567 (set_attr "length" "4,8")])
4571 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4572 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4573 (match_operand:SI 2 "const_int_operand" "i"))
4574 (match_operand:SI 3 "mask_operand" "n")))]
4575 "includes_rshift_p (operands[2], operands[3])"
4576 "rlwinm %0,%1,%s2,%m3,%M3"
4577 [(set_attr "type" "shift")])
4580 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4582 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4583 (match_operand:SI 2 "const_int_operand" "i,i"))
4584 (match_operand:SI 3 "mask_operand" "n,n"))
4586 (clobber (match_scratch:SI 4 "=r,r"))]
4587 "includes_rshift_p (operands[2], operands[3])"
4589 rlwinm. %4,%1,%s2,%m3,%M3
4591 [(set_attr "type" "shift")
4592 (set_attr "dot" "yes")
4593 (set_attr "length" "4,8")])
4596 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4598 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4599 (match_operand:SI 2 "const_int_operand" ""))
4600 (match_operand:SI 3 "mask_operand" ""))
4602 (clobber (match_scratch:SI 4 ""))]
4603 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
4605 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2))
4608 (compare:CC (match_dup 4)
4613 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4615 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4616 (match_operand:SI 2 "const_int_operand" "i,i"))
4617 (match_operand:SI 3 "mask_operand" "n,n"))
4619 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4620 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4621 "includes_rshift_p (operands[2], operands[3])"
4623 rlwinm. %0,%1,%s2,%m3,%M3
4625 [(set_attr "type" "shift")
4626 (set_attr "dot" "yes")
4627 (set_attr "length" "4,8")])
4630 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
4632 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4633 (match_operand:SI 2 "const_int_operand" ""))
4634 (match_operand:SI 3 "mask_operand" ""))
4636 (set (match_operand:SI 0 "gpc_reg_operand" "")
4637 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4638 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
4640 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4642 (compare:CC (match_dup 0)
4646 (define_insn "*lshiftrt_internal1le"
4647 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4650 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4651 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4652 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255))"
4653 "rlwinm %0,%1,%s2,0xff"
4654 [(set_attr "type" "shift")])
4656 (define_insn "*lshiftrt_internal1be"
4657 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4660 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4661 (match_operand:SI 2 "const_int_operand" "i")) 3)))]
4662 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255))"
4663 "rlwinm %0,%1,%s2,0xff"
4664 [(set_attr "type" "shift")])
4666 (define_insn "*lshiftrt_internal2le"
4667 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4671 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4672 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4674 (clobber (match_scratch:SI 3 "=r,r"))]
4675 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255))"
4677 rlwinm. %3,%1,%s2,0xff
4679 [(set_attr "type" "shift")
4680 (set_attr "dot" "yes")
4681 (set_attr "length" "4,8")])
4683 (define_insn "*lshiftrt_internal2be"
4684 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4688 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4689 (match_operand:SI 2 "const_int_operand" "i,i")) 3))
4691 (clobber (match_scratch:SI 3 "=r,r"))]
4692 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255))"
4694 rlwinm. %3,%1,%s2,0xff
4696 [(set_attr "type" "shift")
4697 (set_attr "dot" "yes")
4698 (set_attr "length" "4,8")])
4701 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4705 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4706 (match_operand:SI 2 "const_int_operand" "")) 0))
4708 (clobber (match_scratch:SI 3 ""))]
4709 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4711 (zero_extend:SI (subreg:QI
4712 (lshiftrt:SI (match_dup 1)
4715 (compare:CC (match_dup 3)
4720 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4724 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4725 (match_operand:SI 2 "const_int_operand" "")) 3))
4727 (clobber (match_scratch:SI 3 ""))]
4728 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4730 (zero_extend:SI (subreg:QI
4731 (lshiftrt:SI (match_dup 1)
4734 (compare:CC (match_dup 3)
4738 (define_insn "*lshiftrt_internal3le"
4739 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4743 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4744 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4746 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4747 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4748 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255))"
4750 rlwinm. %0,%1,%s2,0xff
4752 [(set_attr "type" "shift")
4753 (set_attr "dot" "yes")
4754 (set_attr "length" "4,8")])
4756 (define_insn "*lshiftrt_internal3be"
4757 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4761 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4762 (match_operand:SI 2 "const_int_operand" "i,i")) 3))
4764 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4765 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 3)))]
4766 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255))"
4768 rlwinm. %0,%1,%s2,0xff
4770 [(set_attr "type" "shift")
4771 (set_attr "dot" "yes")
4772 (set_attr "length" "4,8")])
4775 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4779 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4780 (match_operand:SI 2 "const_int_operand" "")) 0))
4782 (set (match_operand:SI 0 "gpc_reg_operand" "")
4783 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4784 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4786 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4788 (compare:CC (match_dup 0)
4793 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4797 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4798 (match_operand:SI 2 "const_int_operand" "")) 3))
4800 (set (match_operand:SI 0 "gpc_reg_operand" "")
4801 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 3)))]
4802 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4804 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 3)))
4806 (compare:CC (match_dup 0)
4810 (define_insn "*lshiftrt_internal4le"
4811 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4814 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4815 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4816 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535))"
4817 "rlwinm %0,%1,%s2,0xffff"
4818 [(set_attr "type" "shift")])
4820 (define_insn "*lshiftrt_internal4be"
4821 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4824 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4825 (match_operand:SI 2 "const_int_operand" "i")) 2)))]
4826 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535))"
4827 "rlwinm %0,%1,%s2,0xffff"
4828 [(set_attr "type" "shift")])
4830 (define_insn "*lshiftrt_internal5le"
4831 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4835 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4836 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4838 (clobber (match_scratch:SI 3 "=r,r"))]
4839 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535))"
4841 rlwinm. %3,%1,%s2,0xffff
4843 [(set_attr "type" "shift")
4844 (set_attr "dot" "yes")
4845 (set_attr "length" "4,8")])
4847 (define_insn "*lshiftrt_internal5be"
4848 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4852 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4853 (match_operand:SI 2 "const_int_operand" "i,i")) 2))
4855 (clobber (match_scratch:SI 3 "=r,r"))]
4856 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535))"
4858 rlwinm. %3,%1,%s2,0xffff
4860 [(set_attr "type" "shift")
4861 (set_attr "dot" "yes")
4862 (set_attr "length" "4,8")])
4865 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4869 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4870 (match_operand:SI 2 "const_int_operand" "")) 0))
4872 (clobber (match_scratch:SI 3 ""))]
4873 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4875 (zero_extend:SI (subreg:HI
4876 (lshiftrt:SI (match_dup 1)
4879 (compare:CC (match_dup 3)
4884 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4888 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4889 (match_operand:SI 2 "const_int_operand" "")) 2))
4891 (clobber (match_scratch:SI 3 ""))]
4892 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4894 (zero_extend:SI (subreg:HI
4895 (lshiftrt:SI (match_dup 1)
4898 (compare:CC (match_dup 3)
4902 (define_insn "*lshiftrt_internal5le"
4903 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4907 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4908 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4910 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4911 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4912 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535))"
4914 rlwinm. %0,%1,%s2,0xffff
4916 [(set_attr "type" "shift")
4917 (set_attr "dot" "yes")
4918 (set_attr "length" "4,8")])
4920 (define_insn "*lshiftrt_internal5be"
4921 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4925 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4926 (match_operand:SI 2 "const_int_operand" "i,i")) 2))
4928 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4929 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 2)))]
4930 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535))"
4932 rlwinm. %0,%1,%s2,0xffff
4934 [(set_attr "type" "shift")
4935 (set_attr "dot" "yes")
4936 (set_attr "length" "4,8")])
4939 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4943 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4944 (match_operand:SI 2 "const_int_operand" "")) 0))
4946 (set (match_operand:SI 0 "gpc_reg_operand" "")
4947 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4948 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4950 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4952 (compare:CC (match_dup 0)
4957 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4961 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4962 (match_operand:SI 2 "const_int_operand" "")) 2))
4964 (set (match_operand:SI 0 "gpc_reg_operand" "")
4965 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 2)))]
4966 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4968 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 2)))
4970 (compare:CC (match_dup 0)
4975 (define_expand "ashr<mode>3"
4976 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
4977 (ashiftrt:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
4978 (match_operand:SI 2 "reg_or_cint_operand" "")))]
4981 /* The generic code does not generate optimal code for the low word
4982 (it should be a rlwimi and a rot). Until we have target code to
4983 solve this generically, keep this expander. */
4985 if (<MODE>mode == DImode && !TARGET_POWERPC64)
4987 if (CONST_INT_P (operands[2]))
4989 emit_insn (gen_ashrdi3_no_power (operands[0], operands[1], operands[2]));
4997 (define_insn "*ashr<mode>3"
4998 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
4999 (ashiftrt:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
5000 (match_operand:SI 2 "reg_or_cint_operand" "rn")))]
5002 "sra<wd>%I2 %0,%1,%<hH>2"
5003 [(set_attr "type" "shift")
5004 (set_attr "maybe_var_shift" "yes")])
5006 (define_insn "*ashrsi3_64"
5007 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
5009 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
5010 (match_operand:SI 2 "reg_or_cint_operand" "rn"))))]
5013 [(set_attr "type" "shift")
5014 (set_attr "maybe_var_shift" "yes")])
5016 (define_insn_and_split "*ashr<mode>3_dot"
5017 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
5018 (compare:CC (ashiftrt:GPR (match_operand:GPR 1 "gpc_reg_operand" "r,r")
5019 (match_operand:SI 2 "reg_or_cint_operand" "rn,rn"))
5021 (clobber (match_scratch:GPR 0 "=r,r"))]
5022 "<MODE>mode == Pmode && rs6000_gen_cell_microcode"
5024 sra<wd>%I2. %0,%1,%<hH>2
5026 "&& reload_completed && cc_reg_not_cr0_operand (operands[3], CCmode)"
5028 (ashiftrt:GPR (match_dup 1)
5031 (compare:CC (match_dup 0)
5034 [(set_attr "type" "shift")
5035 (set_attr "maybe_var_shift" "yes")
5036 (set_attr "dot" "yes")
5037 (set_attr "length" "4,8")])
5039 (define_insn_and_split "*ashr<mode>3_dot2"
5040 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
5041 (compare:CC (ashiftrt:GPR (match_operand:GPR 1 "gpc_reg_operand" "r,r")
5042 (match_operand:SI 2 "reg_or_cint_operand" "rn,rn"))
5044 (set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
5045 (ashiftrt:GPR (match_dup 1)
5047 "<MODE>mode == Pmode && rs6000_gen_cell_microcode"
5049 sra<wd>%I2. %0,%1,%<hH>2
5051 "&& reload_completed && cc_reg_not_cr0_operand (operands[3], CCmode)"
5053 (ashiftrt:GPR (match_dup 1)
5056 (compare:CC (match_dup 0)
5059 [(set_attr "type" "shift")
5060 (set_attr "maybe_var_shift" "yes")
5061 (set_attr "dot" "yes")
5062 (set_attr "length" "4,8")])
5064 ;; Builtins to replace a division to generate FRE reciprocal estimate
5065 ;; instructions and the necessary fixup instructions
5066 (define_expand "recip<mode>3"
5067 [(match_operand:RECIPF 0 "gpc_reg_operand" "")
5068 (match_operand:RECIPF 1 "gpc_reg_operand" "")
5069 (match_operand:RECIPF 2 "gpc_reg_operand" "")]
5070 "RS6000_RECIP_HAVE_RE_P (<MODE>mode)"
5072 rs6000_emit_swdiv (operands[0], operands[1], operands[2], false);
5076 ;; Split to create division from FRE/FRES/etc. and fixup instead of the normal
5077 ;; hardware division. This is only done before register allocation and with
5078 ;; -ffast-math. This must appear before the divsf3/divdf3 insns.
5080 [(set (match_operand:RECIPF 0 "gpc_reg_operand" "")
5081 (div:RECIPF (match_operand 1 "gpc_reg_operand" "")
5082 (match_operand 2 "gpc_reg_operand" "")))]
5083 "RS6000_RECIP_AUTO_RE_P (<MODE>mode)
5084 && can_create_pseudo_p () && optimize_insn_for_speed_p ()
5085 && flag_finite_math_only && !flag_trapping_math && flag_reciprocal_math"
5088 rs6000_emit_swdiv (operands[0], operands[1], operands[2], true);
5092 ;; Builtins to replace 1/sqrt(x) with instructions using RSQRTE and the
5093 ;; appropriate fixup.
5094 (define_expand "rsqrt<mode>2"
5095 [(match_operand:RECIPF 0 "gpc_reg_operand" "")
5096 (match_operand:RECIPF 1 "gpc_reg_operand" "")]
5097 "RS6000_RECIP_HAVE_RSQRTE_P (<MODE>mode)"
5099 rs6000_emit_swrsqrt (operands[0], operands[1]);
5103 ;; Floating-point insns, excluding normal data motion. We combine the SF/DF
5104 ;; modes here, and also add in conditional vsx/power8-vector support to access
5105 ;; values in the traditional Altivec registers if the appropriate
5106 ;; -mupper-regs-{df,sf} option is enabled.
5108 (define_expand "abs<mode>2"
5109 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
5110 (abs:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")))]
5111 "TARGET_<MODE>_INSN"
5114 (define_insn "*abs<mode>2_fpr"
5115 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
5116 (abs:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")))]
5121 [(set_attr "type" "fp")
5122 (set_attr "fp_type" "fp_addsub_<Fs>")])
5124 (define_insn "*nabs<mode>2_fpr"
5125 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
5128 (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>"))))]
5133 [(set_attr "type" "fp")
5134 (set_attr "fp_type" "fp_addsub_<Fs>")])
5136 (define_expand "neg<mode>2"
5137 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
5138 (neg:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")))]
5139 "TARGET_<MODE>_INSN"
5142 (define_insn "*neg<mode>2_fpr"
5143 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
5144 (neg:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")))]
5149 [(set_attr "type" "fp")
5150 (set_attr "fp_type" "fp_addsub_<Fs>")])
5152 (define_expand "add<mode>3"
5153 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
5154 (plus:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")
5155 (match_operand:SFDF 2 "gpc_reg_operand" "")))]
5156 "TARGET_<MODE>_INSN"
5159 (define_insn "*add<mode>3_fpr"
5160 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
5161 (plus:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "%<Ff>,<Fv>")
5162 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")))]
5165 fadd<Ftrad> %0,%1,%2
5166 xsadd<Fvsx> %x0,%x1,%x2"
5167 [(set_attr "type" "fp")
5168 (set_attr "fp_type" "fp_addsub_<Fs>")])
5170 (define_expand "sub<mode>3"
5171 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
5172 (minus:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")
5173 (match_operand:SFDF 2 "gpc_reg_operand" "")))]
5174 "TARGET_<MODE>_INSN"
5177 (define_insn "*sub<mode>3_fpr"
5178 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
5179 (minus:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")
5180 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")))]
5183 fsub<Ftrad> %0,%1,%2
5184 xssub<Fvsx> %x0,%x1,%x2"
5185 [(set_attr "type" "fp")
5186 (set_attr "fp_type" "fp_addsub_<Fs>")])
5188 (define_expand "mul<mode>3"
5189 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
5190 (mult:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")
5191 (match_operand:SFDF 2 "gpc_reg_operand" "")))]
5192 "TARGET_<MODE>_INSN"
5195 (define_insn "*mul<mode>3_fpr"
5196 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
5197 (mult:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "%<Ff>,<Fv>")
5198 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")))]
5201 fmul<Ftrad> %0,%1,%2
5202 xsmul<Fvsx> %x0,%x1,%x2"
5203 [(set_attr "type" "dmul")
5204 (set_attr "fp_type" "fp_mul_<Fs>")])
5206 (define_expand "div<mode>3"
5207 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
5208 (div:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")
5209 (match_operand:SFDF 2 "gpc_reg_operand" "")))]
5210 "TARGET_<MODE>_INSN && !TARGET_SIMPLE_FPU"
5213 (define_insn "*div<mode>3_fpr"
5214 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
5215 (div:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")
5216 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")))]
5217 "TARGET_<MODE>_FPR && !TARGET_SIMPLE_FPU"
5219 fdiv<Ftrad> %0,%1,%2
5220 xsdiv<Fvsx> %x0,%x1,%x2"
5221 [(set_attr "type" "<Fs>div")
5222 (set_attr "fp_type" "fp_div_<Fs>")])
5224 (define_insn "sqrt<mode>2"
5225 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
5226 (sqrt:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")))]
5227 "TARGET_<MODE>_FPR && !TARGET_SIMPLE_FPU
5228 && (TARGET_PPC_GPOPT || (<MODE>mode == SFmode && TARGET_XILINX_FPU))"
5231 xssqrt<Fvsx> %x0,%x1"
5232 [(set_attr "type" "<Fs>sqrt")
5233 (set_attr "fp_type" "fp_sqrt_<Fs>")])
5235 ;; Floating point reciprocal approximation
5236 (define_insn "fre<Fs>"
5237 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
5238 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")]
5244 [(set_attr "type" "fp")])
5246 (define_insn "*rsqrt<mode>2"
5247 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
5248 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")]
5250 "RS6000_RECIP_HAVE_RSQRTE_P (<MODE>mode)"
5252 frsqrte<Ftrad> %0,%1
5253 xsrsqrte<Fvsx> %x0,%x1"
5254 [(set_attr "type" "fp")])
5256 ;; Floating point comparisons
5257 (define_insn "*cmp<mode>_fpr"
5258 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y,y")
5259 (compare:CCFP (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")
5260 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")))]
5264 xscmpudp %0,%x1,%x2"
5265 [(set_attr "type" "fpcompare")])
5267 ;; Floating point conversions
5268 (define_expand "extendsfdf2"
5269 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5270 (float_extend:DF (match_operand:SF 1 "reg_or_none500mem_operand" "")))]
5271 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5274 (define_insn_and_split "*extendsfdf2_fpr"
5275 [(set (match_operand:DF 0 "gpc_reg_operand" "=d,?d,d,ws,?ws,wv")
5276 (float_extend:DF (match_operand:SF 1 "reg_or_mem_operand" "0,f,m,0,wy,Z")))]
5277 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5285 "&& reload_completed && REG_P (operands[1]) && REGNO (operands[0]) == REGNO (operands[1])"
5288 emit_note (NOTE_INSN_DELETED);
5291 [(set_attr "type" "fp,fp,fpload,fp,vecsimple,fpload")])
5293 (define_expand "truncdfsf2"
5294 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5295 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "")))]
5296 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5299 (define_insn "*truncdfsf2_fpr"
5300 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5301 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "d")))]
5302 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5304 [(set_attr "type" "fp")])
5306 ;; This expander is here to avoid FLOAT_WORDS_BIGENDIAN tests in
5307 ;; builtins.c and optabs.c that are not correct for IBM long double
5308 ;; when little-endian.
5309 (define_expand "signbittf2"
5311 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "")))
5313 (subreg:DI (match_dup 2) 0))
5316 (set (match_operand:SI 0 "gpc_reg_operand" "")
5319 && TARGET_HARD_FLOAT
5320 && (TARGET_FPRS || TARGET_E500_DOUBLE)
5321 && TARGET_LONG_DOUBLE_128"
5323 operands[2] = gen_reg_rtx (DFmode);
5324 operands[3] = gen_reg_rtx (DImode);
5325 if (TARGET_POWERPC64)
5327 operands[4] = gen_reg_rtx (DImode);
5328 operands[5] = gen_rtx_LSHIFTRT (DImode, operands[3], GEN_INT (63));
5329 operands[6] = gen_rtx_SUBREG (SImode, operands[4],
5330 WORDS_BIG_ENDIAN ? 4 : 0);
5334 operands[4] = gen_reg_rtx (SImode);
5335 operands[5] = gen_rtx_SUBREG (SImode, operands[3],
5336 WORDS_BIG_ENDIAN ? 0 : 4);
5337 operands[6] = gen_rtx_LSHIFTRT (SImode, operands[4], GEN_INT (31));
5341 (define_expand "copysign<mode>3"
5343 (abs:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")))
5345 (neg:SFDF (abs:SFDF (match_dup 1))))
5346 (set (match_operand:SFDF 0 "gpc_reg_operand" "")
5347 (if_then_else:SFDF (ge (match_operand:SFDF 2 "gpc_reg_operand" "")
5351 "TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>
5352 && ((TARGET_PPC_GFXOPT
5353 && !HONOR_NANS (<MODE>mode)
5354 && !HONOR_SIGNED_ZEROS (<MODE>mode))
5356 || VECTOR_UNIT_VSX_P (<MODE>mode))"
5358 if (TARGET_CMPB || VECTOR_UNIT_VSX_P (<MODE>mode))
5360 emit_insn (gen_copysign<mode>3_fcpsgn (operands[0], operands[1],
5365 operands[3] = gen_reg_rtx (<MODE>mode);
5366 operands[4] = gen_reg_rtx (<MODE>mode);
5367 operands[5] = CONST0_RTX (<MODE>mode);
5370 ;; Use an unspec rather providing an if-then-else in RTL, to prevent the
5371 ;; compiler from optimizing -0.0
5372 (define_insn "copysign<mode>3_fcpsgn"
5373 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
5374 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")
5375 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")]
5377 "TARGET_<MODE>_FPR && TARGET_CMPB"
5380 xscpsgn<Fvsx> %x0,%x2,%x1"
5381 [(set_attr "type" "fp")])
5383 ;; For MIN, MAX, and conditional move, we use DEFINE_EXPAND's that involve a
5384 ;; fsel instruction and some auxiliary computations. Then we just have a
5385 ;; single DEFINE_INSN for fsel and the define_splits to make them if made by
5387 ;; For MIN, MAX on non-VSX machines, and conditional move all of the time, we
5388 ;; use DEFINE_EXPAND's that involve a fsel instruction and some auxiliary
5389 ;; computations. Then we just have a single DEFINE_INSN for fsel and the
5390 ;; define_splits to make them if made by combine. On VSX machines we have the
5391 ;; min/max instructions.
5393 ;; On VSX, we only check for TARGET_VSX instead of checking for a vsx/p8 vector
5394 ;; to allow either DF/SF to use only traditional registers.
5396 (define_expand "smax<mode>3"
5397 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
5398 (if_then_else:SFDF (ge (match_operand:SFDF 1 "gpc_reg_operand" "")
5399 (match_operand:SFDF 2 "gpc_reg_operand" ""))
5402 "TARGET_<MODE>_FPR && TARGET_PPC_GFXOPT && !flag_trapping_math"
5404 rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]);
5408 (define_insn "*smax<mode>3_vsx"
5409 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
5410 (smax:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "%<Ff>,<Fv>")
5411 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")))]
5412 "TARGET_<MODE>_FPR && TARGET_VSX"
5413 "xsmaxdp %x0,%x1,%x2"
5414 [(set_attr "type" "fp")])
5416 (define_expand "smin<mode>3"
5417 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
5418 (if_then_else:SFDF (ge (match_operand:SFDF 1 "gpc_reg_operand" "")
5419 (match_operand:SFDF 2 "gpc_reg_operand" ""))
5422 "TARGET_<MODE>_FPR && TARGET_PPC_GFXOPT && !flag_trapping_math"
5424 rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]);
5428 (define_insn "*smin<mode>3_vsx"
5429 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
5430 (smin:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "%<Ff>,<Fv>")
5431 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")))]
5432 "TARGET_<MODE>_FPR && TARGET_VSX"
5433 "xsmindp %x0,%x1,%x2"
5434 [(set_attr "type" "fp")])
5437 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
5438 (match_operator:SFDF 3 "min_max_operator"
5439 [(match_operand:SFDF 1 "gpc_reg_operand" "")
5440 (match_operand:SFDF 2 "gpc_reg_operand" "")]))]
5441 "TARGET_<MODE>_FPR && TARGET_PPC_GFXOPT && !flag_trapping_math
5445 rs6000_emit_minmax (operands[0], GET_CODE (operands[3]), operands[1],
5451 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5452 (match_operator:SF 3 "min_max_operator"
5453 [(match_operand:SF 1 "gpc_reg_operand" "")
5454 (match_operand:SF 2 "gpc_reg_operand" "")]))]
5455 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
5456 && TARGET_SINGLE_FLOAT && !flag_trapping_math"
5459 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
5460 operands[1], operands[2]);
5464 (define_expand "mov<mode>cc"
5465 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
5466 (if_then_else:GPR (match_operand 1 "comparison_operator" "")
5467 (match_operand:GPR 2 "gpc_reg_operand" "")
5468 (match_operand:GPR 3 "gpc_reg_operand" "")))]
5472 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5478 ;; We use the BASE_REGS for the isel input operands because, if rA is
5479 ;; 0, the value of 0 is placed in rD upon truth. Similarly for rB
5480 ;; because we may switch the operands and rB may end up being rA.
5482 ;; We need 2 patterns: an unsigned and a signed pattern. We could
5483 ;; leave out the mode in operand 4 and use one pattern, but reload can
5484 ;; change the mode underneath our feet and then gets confused trying
5485 ;; to reload the value.
5486 (define_insn "isel_signed_<mode>"
5487 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
5489 (match_operator 1 "scc_comparison_operator"
5490 [(match_operand:CC 4 "cc_reg_operand" "y,y")
5492 (match_operand:GPR 2 "reg_or_cint_operand" "O,b")
5493 (match_operand:GPR 3 "gpc_reg_operand" "r,r")))]
5496 { return output_isel (operands); }"
5497 [(set_attr "type" "isel")
5498 (set_attr "length" "4")])
5500 (define_insn "isel_unsigned_<mode>"
5501 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
5503 (match_operator 1 "scc_comparison_operator"
5504 [(match_operand:CCUNS 4 "cc_reg_operand" "y,y")
5506 (match_operand:GPR 2 "reg_or_cint_operand" "O,b")
5507 (match_operand:GPR 3 "gpc_reg_operand" "r,r")))]
5510 { return output_isel (operands); }"
5511 [(set_attr "type" "isel")
5512 (set_attr "length" "4")])
5514 ;; These patterns can be useful for combine; they let combine know that
5515 ;; isel can handle reversed comparisons so long as the operands are
5518 (define_insn "*isel_reversed_signed_<mode>"
5519 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
5521 (match_operator 1 "scc_rev_comparison_operator"
5522 [(match_operand:CC 4 "cc_reg_operand" "y")
5524 (match_operand:GPR 2 "gpc_reg_operand" "b")
5525 (match_operand:GPR 3 "gpc_reg_operand" "b")))]
5528 { return output_isel (operands); }"
5529 [(set_attr "type" "isel")
5530 (set_attr "length" "4")])
5532 (define_insn "*isel_reversed_unsigned_<mode>"
5533 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
5535 (match_operator 1 "scc_rev_comparison_operator"
5536 [(match_operand:CCUNS 4 "cc_reg_operand" "y")
5538 (match_operand:GPR 2 "gpc_reg_operand" "b")
5539 (match_operand:GPR 3 "gpc_reg_operand" "b")))]
5542 { return output_isel (operands); }"
5543 [(set_attr "type" "isel")
5544 (set_attr "length" "4")])
5546 (define_expand "movsfcc"
5547 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5548 (if_then_else:SF (match_operand 1 "comparison_operator" "")
5549 (match_operand:SF 2 "gpc_reg_operand" "")
5550 (match_operand:SF 3 "gpc_reg_operand" "")))]
5551 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5554 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5560 (define_insn "*fselsfsf4"
5561 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5562 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
5563 (match_operand:SF 4 "zero_fp_constant" "F"))
5564 (match_operand:SF 2 "gpc_reg_operand" "f")
5565 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5566 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5568 [(set_attr "type" "fp")])
5570 (define_insn "*fseldfsf4"
5571 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5572 (if_then_else:SF (ge (match_operand:DF 1 "gpc_reg_operand" "d")
5573 (match_operand:DF 4 "zero_fp_constant" "F"))
5574 (match_operand:SF 2 "gpc_reg_operand" "f")
5575 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5576 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_SINGLE_FLOAT"
5578 [(set_attr "type" "fp")])
5580 ;; The conditional move instructions allow us to perform max and min
5581 ;; operations even when
5584 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5585 (match_operator:DF 3 "min_max_operator"
5586 [(match_operand:DF 1 "gpc_reg_operand" "")
5587 (match_operand:DF 2 "gpc_reg_operand" "")]))]
5588 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5589 && !flag_trapping_math"
5592 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
5593 operands[1], operands[2]);
5597 (define_expand "movdfcc"
5598 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5599 (if_then_else:DF (match_operand 1 "comparison_operator" "")
5600 (match_operand:DF 2 "gpc_reg_operand" "")
5601 (match_operand:DF 3 "gpc_reg_operand" "")))]
5602 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5605 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5611 (define_insn "*fseldfdf4"
5612 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
5613 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "d")
5614 (match_operand:DF 4 "zero_fp_constant" "F"))
5615 (match_operand:DF 2 "gpc_reg_operand" "d")
5616 (match_operand:DF 3 "gpc_reg_operand" "d")))]
5617 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5619 [(set_attr "type" "fp")])
5621 (define_insn "*fselsfdf4"
5622 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
5623 (if_then_else:DF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
5624 (match_operand:SF 4 "zero_fp_constant" "F"))
5625 (match_operand:DF 2 "gpc_reg_operand" "d")
5626 (match_operand:DF 3 "gpc_reg_operand" "d")))]
5627 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_SINGLE_FLOAT"
5629 [(set_attr "type" "fp")])
5631 ;; Conversions to and from floating-point.
5633 ; We don't define lfiwax/lfiwzx with the normal definition, because we
5634 ; don't want to support putting SImode in FPR registers.
5635 (define_insn "lfiwax"
5636 [(set (match_operand:DI 0 "gpc_reg_operand" "=d,wi,!wj")
5637 (unspec:DI [(match_operand:SI 1 "reg_or_indexed_operand" "Z,Z,r")]
5639 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWAX"
5644 [(set_attr "type" "fpload,fpload,mffgpr")])
5646 ; This split must be run before register allocation because it allocates the
5647 ; memory slot that is needed to move values to/from the FPR. We don't allocate
5648 ; it earlier to allow for the combiner to merge insns together where it might
5649 ; not be needed and also in case the insns are deleted as dead code.
5651 (define_insn_and_split "floatsi<mode>2_lfiwax"
5652 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d")
5653 (float:SFDF (match_operand:SI 1 "nonimmediate_operand" "r")))
5654 (clobber (match_scratch:DI 2 "=d"))]
5655 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWAX
5656 && <SI_CONVERT_FP> && can_create_pseudo_p ()"
5662 rtx dest = operands[0];
5663 rtx src = operands[1];
5666 if (!MEM_P (src) && TARGET_POWERPC64
5667 && (TARGET_MFPGPR || TARGET_DIRECT_MOVE))
5668 tmp = convert_to_mode (DImode, src, false);
5672 if (GET_CODE (tmp) == SCRATCH)
5673 tmp = gen_reg_rtx (DImode);
5676 src = rs6000_address_for_fpconvert (src);
5677 emit_insn (gen_lfiwax (tmp, src));
5681 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
5682 emit_move_insn (stack, src);
5683 emit_insn (gen_lfiwax (tmp, stack));
5686 emit_insn (gen_floatdi<mode>2 (dest, tmp));
5689 [(set_attr "length" "12")
5690 (set_attr "type" "fpload")])
5692 (define_insn_and_split "floatsi<mode>2_lfiwax_mem"
5693 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d,<rreg2>")
5696 (match_operand:SI 1 "memory_operand" "Z,Z"))))
5697 (clobber (match_scratch:DI 2 "=0,d"))]
5698 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWAX
5705 operands[1] = rs6000_address_for_fpconvert (operands[1]);
5706 if (GET_CODE (operands[2]) == SCRATCH)
5707 operands[2] = gen_reg_rtx (DImode);
5708 emit_insn (gen_lfiwax (operands[2], operands[1]));
5709 emit_insn (gen_floatdi<mode>2 (operands[0], operands[2]));
5712 [(set_attr "length" "8")
5713 (set_attr "type" "fpload")])
5715 (define_insn "lfiwzx"
5716 [(set (match_operand:DI 0 "gpc_reg_operand" "=d,wi,!wj")
5717 (unspec:DI [(match_operand:SI 1 "reg_or_indexed_operand" "Z,Z,r")]
5719 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWZX"
5724 [(set_attr "type" "fpload,fpload,mftgpr")])
5726 (define_insn_and_split "floatunssi<mode>2_lfiwzx"
5727 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d")
5728 (unsigned_float:SFDF (match_operand:SI 1 "nonimmediate_operand" "r")))
5729 (clobber (match_scratch:DI 2 "=d"))]
5730 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWZX
5737 rtx dest = operands[0];
5738 rtx src = operands[1];
5741 if (!MEM_P (src) && TARGET_POWERPC64
5742 && (TARGET_MFPGPR || TARGET_DIRECT_MOVE))
5743 tmp = convert_to_mode (DImode, src, true);
5747 if (GET_CODE (tmp) == SCRATCH)
5748 tmp = gen_reg_rtx (DImode);
5751 src = rs6000_address_for_fpconvert (src);
5752 emit_insn (gen_lfiwzx (tmp, src));
5756 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
5757 emit_move_insn (stack, src);
5758 emit_insn (gen_lfiwzx (tmp, stack));
5761 emit_insn (gen_floatdi<mode>2 (dest, tmp));
5764 [(set_attr "length" "12")
5765 (set_attr "type" "fpload")])
5767 (define_insn_and_split "floatunssi<mode>2_lfiwzx_mem"
5768 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d,<rreg2>")
5769 (unsigned_float:SFDF
5771 (match_operand:SI 1 "memory_operand" "Z,Z"))))
5772 (clobber (match_scratch:DI 2 "=0,d"))]
5773 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWZX
5780 operands[1] = rs6000_address_for_fpconvert (operands[1]);
5781 if (GET_CODE (operands[2]) == SCRATCH)
5782 operands[2] = gen_reg_rtx (DImode);
5783 emit_insn (gen_lfiwzx (operands[2], operands[1]));
5784 emit_insn (gen_floatdi<mode>2 (operands[0], operands[2]));
5787 [(set_attr "length" "8")
5788 (set_attr "type" "fpload")])
5790 ; For each of these conversions, there is a define_expand, a define_insn
5791 ; with a '#' template, and a define_split (with C code). The idea is
5792 ; to allow constant folding with the template of the define_insn,
5793 ; then to have the insns split later (between sched1 and final).
5795 (define_expand "floatsidf2"
5796 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5797 (float:DF (match_operand:SI 1 "nonimmediate_operand" "")))
5800 (clobber (match_dup 4))
5801 (clobber (match_dup 5))
5802 (clobber (match_dup 6))])]
5804 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5807 if (TARGET_E500_DOUBLE)
5809 if (!REG_P (operands[1]))
5810 operands[1] = force_reg (SImode, operands[1]);
5811 emit_insn (gen_spe_floatsidf2 (operands[0], operands[1]));
5814 else if (TARGET_LFIWAX && TARGET_FCFID)
5816 emit_insn (gen_floatsidf2_lfiwax (operands[0], operands[1]));
5819 else if (TARGET_FCFID)
5821 rtx dreg = operands[1];
5823 dreg = force_reg (SImode, dreg);
5824 dreg = convert_to_mode (DImode, dreg, false);
5825 emit_insn (gen_floatdidf2 (operands[0], dreg));
5829 if (!REG_P (operands[1]))
5830 operands[1] = force_reg (SImode, operands[1]);
5831 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5832 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503601774854144\", DFmode));
5833 operands[4] = rs6000_allocate_stack_temp (DFmode, true, false);
5834 operands[5] = gen_reg_rtx (DFmode);
5835 operands[6] = gen_reg_rtx (SImode);
5838 (define_insn_and_split "*floatsidf2_internal"
5839 [(set (match_operand:DF 0 "gpc_reg_operand" "=&d")
5840 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5841 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5842 (use (match_operand:DF 3 "gpc_reg_operand" "d"))
5843 (clobber (match_operand:DF 4 "offsettable_mem_operand" "=o"))
5844 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&d"))
5845 (clobber (match_operand:SI 6 "gpc_reg_operand" "=&r"))]
5846 "! TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5852 rtx lowword, highword;
5853 gcc_assert (MEM_P (operands[4]));
5854 highword = adjust_address (operands[4], SImode, 0);
5855 lowword = adjust_address (operands[4], SImode, 4);
5856 if (! WORDS_BIG_ENDIAN)
5859 tmp = highword; highword = lowword; lowword = tmp;
5862 emit_insn (gen_xorsi3 (operands[6], operands[1],
5863 GEN_INT (~ (HOST_WIDE_INT) 0x7fffffff)));
5864 emit_move_insn (lowword, operands[6]);
5865 emit_move_insn (highword, operands[2]);
5866 emit_move_insn (operands[5], operands[4]);
5867 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5870 [(set_attr "length" "24")
5871 (set_attr "type" "fp")])
5873 ;; If we don't have a direct conversion to single precision, don't enable this
5874 ;; conversion for 32-bit without fast math, because we don't have the insn to
5875 ;; generate the fixup swizzle to avoid double rounding problems.
5876 (define_expand "floatunssisf2"
5877 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5878 (unsigned_float:SF (match_operand:SI 1 "nonimmediate_operand" "")))]
5879 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT
5882 && ((TARGET_FCFIDUS && TARGET_LFIWZX)
5883 || (TARGET_DOUBLE_FLOAT && TARGET_FCFID
5884 && (TARGET_POWERPC64 || flag_unsafe_math_optimizations)))))"
5889 if (!REG_P (operands[1]))
5890 operands[1] = force_reg (SImode, operands[1]);
5892 else if (TARGET_LFIWZX && TARGET_FCFIDUS)
5894 emit_insn (gen_floatunssisf2_lfiwzx (operands[0], operands[1]));
5899 rtx dreg = operands[1];
5901 dreg = force_reg (SImode, dreg);
5902 dreg = convert_to_mode (DImode, dreg, true);
5903 emit_insn (gen_floatdisf2 (operands[0], dreg));
5908 (define_expand "floatunssidf2"
5909 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5910 (unsigned_float:DF (match_operand:SI 1 "nonimmediate_operand" "")))
5913 (clobber (match_dup 4))
5914 (clobber (match_dup 5))])]
5916 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5919 if (TARGET_E500_DOUBLE)
5921 if (!REG_P (operands[1]))
5922 operands[1] = force_reg (SImode, operands[1]);
5923 emit_insn (gen_spe_floatunssidf2 (operands[0], operands[1]));
5926 else if (TARGET_LFIWZX && TARGET_FCFID)
5928 emit_insn (gen_floatunssidf2_lfiwzx (operands[0], operands[1]));
5931 else if (TARGET_FCFID)
5933 rtx dreg = operands[1];
5935 dreg = force_reg (SImode, dreg);
5936 dreg = convert_to_mode (DImode, dreg, true);
5937 emit_insn (gen_floatdidf2 (operands[0], dreg));
5941 if (!REG_P (operands[1]))
5942 operands[1] = force_reg (SImode, operands[1]);
5943 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5944 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503599627370496\", DFmode));
5945 operands[4] = rs6000_allocate_stack_temp (DFmode, true, false);
5946 operands[5] = gen_reg_rtx (DFmode);
5949 (define_insn_and_split "*floatunssidf2_internal"
5950 [(set (match_operand:DF 0 "gpc_reg_operand" "=&d")
5951 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5952 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5953 (use (match_operand:DF 3 "gpc_reg_operand" "d"))
5954 (clobber (match_operand:DF 4 "offsettable_mem_operand" "=o"))
5955 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&d"))]
5956 "! TARGET_FCFIDU && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5957 && !(TARGET_FCFID && TARGET_POWERPC64)"
5963 rtx lowword, highword;
5964 gcc_assert (MEM_P (operands[4]));
5965 highword = adjust_address (operands[4], SImode, 0);
5966 lowword = adjust_address (operands[4], SImode, 4);
5967 if (! WORDS_BIG_ENDIAN)
5970 tmp = highword; highword = lowword; lowword = tmp;
5973 emit_move_insn (lowword, operands[1]);
5974 emit_move_insn (highword, operands[2]);
5975 emit_move_insn (operands[5], operands[4]);
5976 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5979 [(set_attr "length" "20")
5980 (set_attr "type" "fp")])
5982 (define_expand "fix_trunc<mode>si2"
5983 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5984 (fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "")))]
5985 "TARGET_HARD_FLOAT && ((TARGET_FPRS && <TARGET_FLOAT>) || <E500_CONVERT>)"
5988 if (!<E500_CONVERT>)
5993 emit_insn (gen_fix_trunc<mode>si2_stfiwx (operands[0], operands[1]));
5996 tmp = gen_reg_rtx (DImode);
5997 stack = rs6000_allocate_stack_temp (DImode, true, false);
5998 emit_insn (gen_fix_trunc<mode>si2_internal (operands[0], operands[1],
6005 ; Like the convert to float patterns, this insn must be split before
6006 ; register allocation so that it can allocate the memory slot if it
6008 (define_insn_and_split "fix_trunc<mode>si2_stfiwx"
6009 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
6010 (fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d")))
6011 (clobber (match_scratch:DI 2 "=d"))]
6012 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6013 && (<MODE>mode != SFmode || TARGET_SINGLE_FLOAT)
6014 && TARGET_STFIWX && can_create_pseudo_p ()"
6019 rtx dest = operands[0];
6020 rtx src = operands[1];
6021 rtx tmp = operands[2];
6023 if (GET_CODE (tmp) == SCRATCH)
6024 tmp = gen_reg_rtx (DImode);
6026 emit_insn (gen_fctiwz_<mode> (tmp, src));
6029 dest = rs6000_address_for_fpconvert (dest);
6030 emit_insn (gen_stfiwx (dest, tmp));
6033 else if (TARGET_POWERPC64 && (TARGET_MFPGPR || TARGET_DIRECT_MOVE))
6035 dest = gen_lowpart (DImode, dest);
6036 emit_move_insn (dest, tmp);
6041 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
6042 emit_insn (gen_stfiwx (stack, tmp));
6043 emit_move_insn (dest, stack);
6047 [(set_attr "length" "12")
6048 (set_attr "type" "fp")])
6050 (define_insn_and_split "fix_trunc<mode>si2_internal"
6051 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,?r")
6052 (fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d,<rreg>")))
6053 (clobber (match_operand:DI 2 "gpc_reg_operand" "=1,d"))
6054 (clobber (match_operand:DI 3 "offsettable_mem_operand" "=o,o"))]
6055 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6062 gcc_assert (MEM_P (operands[3]));
6063 lowword = adjust_address (operands[3], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
6065 emit_insn (gen_fctiwz_<mode> (operands[2], operands[1]));
6066 emit_move_insn (operands[3], operands[2]);
6067 emit_move_insn (operands[0], lowword);
6070 [(set_attr "length" "16")
6071 (set_attr "type" "fp")])
6073 (define_expand "fix_trunc<mode>di2"
6074 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6075 (fix:DI (match_operand:SFDF 1 "gpc_reg_operand" "")))]
6076 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
6080 (define_insn "*fix_trunc<mode>di2_fctidz"
6081 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6082 (fix:DI (match_operand:SFDF 1 "gpc_reg_operand" "d")))]
6083 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
6084 && TARGET_FCFID && !VECTOR_UNIT_VSX_P (<MODE>mode)"
6086 [(set_attr "type" "fp")])
6088 (define_expand "fixuns_trunc<mode>si2"
6089 [(set (match_operand:SI 0 "gpc_reg_operand" "")
6090 (unsigned_fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "")))]
6092 && ((TARGET_FPRS && <TARGET_FLOAT> && TARGET_FCTIWUZ && TARGET_STFIWX)
6096 if (!<E500_CONVERT>)
6098 emit_insn (gen_fixuns_trunc<mode>si2_stfiwx (operands[0], operands[1]));
6103 (define_insn_and_split "fixuns_trunc<mode>si2_stfiwx"
6104 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
6105 (unsigned_fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d")))
6106 (clobber (match_scratch:DI 2 "=d"))]
6107 "TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT> && TARGET_FCTIWUZ
6108 && TARGET_STFIWX && can_create_pseudo_p ()"
6113 rtx dest = operands[0];
6114 rtx src = operands[1];
6115 rtx tmp = operands[2];
6117 if (GET_CODE (tmp) == SCRATCH)
6118 tmp = gen_reg_rtx (DImode);
6120 emit_insn (gen_fctiwuz_<mode> (tmp, src));
6123 dest = rs6000_address_for_fpconvert (dest);
6124 emit_insn (gen_stfiwx (dest, tmp));
6127 else if (TARGET_POWERPC64 && (TARGET_MFPGPR || TARGET_DIRECT_MOVE))
6129 dest = gen_lowpart (DImode, dest);
6130 emit_move_insn (dest, tmp);
6135 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
6136 emit_insn (gen_stfiwx (stack, tmp));
6137 emit_move_insn (dest, stack);
6141 [(set_attr "length" "12")
6142 (set_attr "type" "fp")])
6144 (define_expand "fixuns_trunc<mode>di2"
6145 [(set (match_operand:DI 0 "register_operand" "")
6146 (unsigned_fix:DI (match_operand:SFDF 1 "register_operand" "")))]
6147 "TARGET_HARD_FLOAT && (TARGET_FCTIDUZ || VECTOR_UNIT_VSX_P (<MODE>mode))"
6150 (define_insn "*fixuns_trunc<mode>di2_fctiduz"
6151 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6152 (unsigned_fix:DI (match_operand:SFDF 1 "gpc_reg_operand" "d")))]
6153 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
6154 && TARGET_FCTIDUZ && !VECTOR_UNIT_VSX_P (<MODE>mode)"
6156 [(set_attr "type" "fp")])
6158 ; Here, we use (set (reg) (unspec:DI [(fix:SI ...)] UNSPEC_FCTIWZ))
6159 ; rather than (set (subreg:SI (reg)) (fix:SI ...))
6160 ; because the first makes it clear that operand 0 is not live
6161 ; before the instruction.
6162 (define_insn "fctiwz_<mode>"
6163 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6164 (unspec:DI [(fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d"))]
6166 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6168 [(set_attr "type" "fp")])
6170 (define_insn "fctiwuz_<mode>"
6171 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6172 (unspec:DI [(unsigned_fix:SI
6173 (match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>"))]
6175 "TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT> && TARGET_FCTIWUZ"
6177 [(set_attr "type" "fp")])
6179 ;; Only optimize (float (fix x)) -> frz if we are in fast-math mode, since
6180 ;; since the friz instruction does not truncate the value if the floating
6181 ;; point value is < LONG_MIN or > LONG_MAX.
6182 (define_insn "*friz"
6183 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6184 (float:DF (fix:DI (match_operand:DF 1 "gpc_reg_operand" "d"))))]
6185 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_FPRND
6186 && !VECTOR_UNIT_VSX_P (DFmode) && flag_unsafe_math_optimizations
6187 && !flag_trapping_math && TARGET_FRIZ"
6189 [(set_attr "type" "fp")])
6191 ;; Since FCTIWZ doesn't sign extend the upper bits, we have to do a store and a
6192 ;; load to properly sign extend the value, but at least doing a store, load
6193 ;; into a GPR to sign extend, a store from the GPR and a load back into the FPR
6194 ;; if we have 32-bit memory ops
6195 (define_insn_and_split "*round32<mode>2_fprs"
6196 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d")
6198 (fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d"))))
6199 (clobber (match_scratch:DI 2 "=d"))
6200 (clobber (match_scratch:DI 3 "=d"))]
6201 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6202 && <SI_CONVERT_FP> && TARGET_LFIWAX && TARGET_STFIWX && TARGET_FCFID
6203 && can_create_pseudo_p ()"
6208 rtx dest = operands[0];
6209 rtx src = operands[1];
6210 rtx tmp1 = operands[2];
6211 rtx tmp2 = operands[3];
6212 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
6214 if (GET_CODE (tmp1) == SCRATCH)
6215 tmp1 = gen_reg_rtx (DImode);
6216 if (GET_CODE (tmp2) == SCRATCH)
6217 tmp2 = gen_reg_rtx (DImode);
6219 emit_insn (gen_fctiwz_<mode> (tmp1, src));
6220 emit_insn (gen_stfiwx (stack, tmp1));
6221 emit_insn (gen_lfiwax (tmp2, stack));
6222 emit_insn (gen_floatdi<mode>2 (dest, tmp2));
6225 [(set_attr "type" "fpload")
6226 (set_attr "length" "16")])
6228 (define_insn_and_split "*roundu32<mode>2_fprs"
6229 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d")
6230 (unsigned_float:SFDF
6231 (unsigned_fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d"))))
6232 (clobber (match_scratch:DI 2 "=d"))
6233 (clobber (match_scratch:DI 3 "=d"))]
6234 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6235 && TARGET_LFIWZX && TARGET_STFIWX && TARGET_FCFIDU
6236 && can_create_pseudo_p ()"
6241 rtx dest = operands[0];
6242 rtx src = operands[1];
6243 rtx tmp1 = operands[2];
6244 rtx tmp2 = operands[3];
6245 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
6247 if (GET_CODE (tmp1) == SCRATCH)
6248 tmp1 = gen_reg_rtx (DImode);
6249 if (GET_CODE (tmp2) == SCRATCH)
6250 tmp2 = gen_reg_rtx (DImode);
6252 emit_insn (gen_fctiwuz_<mode> (tmp1, src));
6253 emit_insn (gen_stfiwx (stack, tmp1));
6254 emit_insn (gen_lfiwzx (tmp2, stack));
6255 emit_insn (gen_floatdi<mode>2 (dest, tmp2));
6258 [(set_attr "type" "fpload")
6259 (set_attr "length" "16")])
6261 ;; No VSX equivalent to fctid
6262 (define_insn "lrint<mode>di2"
6263 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6264 (unspec:DI [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
6266 "TARGET_<MODE>_FPR && TARGET_FPRND"
6268 [(set_attr "type" "fp")])
6270 (define_insn "btrunc<mode>2"
6271 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
6272 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")]
6274 "TARGET_<MODE>_FPR && TARGET_FPRND"
6278 [(set_attr "type" "fp")
6279 (set_attr "fp_type" "fp_addsub_<Fs>")])
6281 (define_insn "ceil<mode>2"
6282 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
6283 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")]
6285 "TARGET_<MODE>_FPR && TARGET_FPRND"
6289 [(set_attr "type" "fp")
6290 (set_attr "fp_type" "fp_addsub_<Fs>")])
6292 (define_insn "floor<mode>2"
6293 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
6294 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")]
6296 "TARGET_<MODE>_FPR && TARGET_FPRND"
6300 [(set_attr "type" "fp")
6301 (set_attr "fp_type" "fp_addsub_<Fs>")])
6303 ;; No VSX equivalent to frin
6304 (define_insn "round<mode>2"
6305 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
6306 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
6308 "TARGET_<MODE>_FPR && TARGET_FPRND"
6310 [(set_attr "type" "fp")
6311 (set_attr "fp_type" "fp_addsub_<Fs>")])
6313 ; An UNSPEC is used so we don't have to support SImode in FP registers.
6314 (define_insn "stfiwx"
6315 [(set (match_operand:SI 0 "memory_operand" "=Z")
6316 (unspec:SI [(match_operand:DI 1 "gpc_reg_operand" "d")]
6320 [(set_attr "type" "fpstore")])
6322 ;; If we don't have a direct conversion to single precision, don't enable this
6323 ;; conversion for 32-bit without fast math, because we don't have the insn to
6324 ;; generate the fixup swizzle to avoid double rounding problems.
6325 (define_expand "floatsisf2"
6326 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6327 (float:SF (match_operand:SI 1 "nonimmediate_operand" "")))]
6328 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT
6331 && ((TARGET_FCFIDS && TARGET_LFIWAX)
6332 || (TARGET_DOUBLE_FLOAT && TARGET_FCFID
6333 && (TARGET_POWERPC64 || flag_unsafe_math_optimizations)))))"
6338 if (!REG_P (operands[1]))
6339 operands[1] = force_reg (SImode, operands[1]);
6341 else if (TARGET_FCFIDS && TARGET_LFIWAX)
6343 emit_insn (gen_floatsisf2_lfiwax (operands[0], operands[1]));
6346 else if (TARGET_FCFID && TARGET_LFIWAX)
6348 rtx dfreg = gen_reg_rtx (DFmode);
6349 emit_insn (gen_floatsidf2_lfiwax (dfreg, operands[1]));
6350 emit_insn (gen_truncdfsf2 (operands[0], dfreg));
6355 rtx dreg = operands[1];
6357 dreg = force_reg (SImode, dreg);
6358 dreg = convert_to_mode (DImode, dreg, false);
6359 emit_insn (gen_floatdisf2 (operands[0], dreg));
6364 (define_expand "floatdidf2"
6365 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6366 (float:DF (match_operand:DI 1 "gpc_reg_operand" "")))]
6367 "TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS"
6370 (define_insn "*floatdidf2_fpr"
6371 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6372 (float:DF (match_operand:DI 1 "gpc_reg_operand" "d")))]
6373 "TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
6374 && !VECTOR_UNIT_VSX_P (DFmode)"
6376 [(set_attr "type" "fp")])
6378 ; Allow the combiner to merge source memory operands to the conversion so that
6379 ; the optimizer/register allocator doesn't try to load the value too early in a
6380 ; GPR and then use store/load to move it to a FPR and suffer from a store-load
6381 ; hit. We will split after reload to avoid the trip through the GPRs
6383 (define_insn_and_split "*floatdidf2_mem"
6384 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6385 (float:DF (match_operand:DI 1 "memory_operand" "m")))
6386 (clobber (match_scratch:DI 2 "=d"))]
6387 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS && TARGET_FCFID"
6389 "&& reload_completed"
6390 [(set (match_dup 2) (match_dup 1))
6391 (set (match_dup 0) (float:DF (match_dup 2)))]
6393 [(set_attr "length" "8")
6394 (set_attr "type" "fpload")])
6396 (define_expand "floatunsdidf2"
6397 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6399 (match_operand:DI 1 "gpc_reg_operand" "")))]
6400 "TARGET_HARD_FLOAT && (TARGET_FCFIDU || VECTOR_UNIT_VSX_P (DFmode))"
6403 (define_insn "*floatunsdidf2_fcfidu"
6404 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6405 (unsigned_float:DF (match_operand:DI 1 "gpc_reg_operand" "d")))]
6406 "TARGET_HARD_FLOAT && TARGET_FCFIDU && !VECTOR_UNIT_VSX_P (DFmode)"
6408 [(set_attr "type" "fp")
6409 (set_attr "length" "4")])
6411 (define_insn_and_split "*floatunsdidf2_mem"
6412 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6413 (unsigned_float:DF (match_operand:DI 1 "memory_operand" "m")))
6414 (clobber (match_scratch:DI 2 "=d"))]
6415 "TARGET_HARD_FLOAT && (TARGET_FCFIDU || VECTOR_UNIT_VSX_P (DFmode))"
6417 "&& reload_completed"
6418 [(set (match_dup 2) (match_dup 1))
6419 (set (match_dup 0) (unsigned_float:DF (match_dup 2)))]
6421 [(set_attr "length" "8")
6422 (set_attr "type" "fpload")])
6424 (define_expand "floatdisf2"
6425 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6426 (float:SF (match_operand:DI 1 "gpc_reg_operand" "")))]
6427 "TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
6428 && (TARGET_FCFIDS || TARGET_POWERPC64 || flag_unsafe_math_optimizations)"
6433 rtx val = operands[1];
6434 if (!flag_unsafe_math_optimizations)
6436 rtx label = gen_label_rtx ();
6437 val = gen_reg_rtx (DImode);
6438 emit_insn (gen_floatdisf2_internal2 (val, operands[1], label));
6441 emit_insn (gen_floatdisf2_internal1 (operands[0], val));
6446 (define_insn "floatdisf2_fcfids"
6447 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6448 (float:SF (match_operand:DI 1 "gpc_reg_operand" "d")))]
6449 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
6450 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDS"
6452 [(set_attr "type" "fp")])
6454 (define_insn_and_split "*floatdisf2_mem"
6455 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6456 (float:SF (match_operand:DI 1 "memory_operand" "m")))
6457 (clobber (match_scratch:DI 2 "=f"))]
6458 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
6459 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDS"
6461 "&& reload_completed"
6465 emit_move_insn (operands[2], operands[1]);
6466 emit_insn (gen_floatdisf2_fcfids (operands[0], operands[2]));
6469 [(set_attr "length" "8")])
6471 ;; This is not IEEE compliant if rounding mode is "round to nearest".
6472 ;; If the DI->DF conversion is inexact, then it's possible to suffer
6473 ;; from double rounding.
6474 ;; Instead of creating a new cpu type for two FP operations, just use fp
6475 (define_insn_and_split "floatdisf2_internal1"
6476 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6477 (float:SF (match_operand:DI 1 "gpc_reg_operand" "d")))
6478 (clobber (match_scratch:DF 2 "=d"))]
6479 "TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
6481 "&& reload_completed"
6483 (float:DF (match_dup 1)))
6485 (float_truncate:SF (match_dup 2)))]
6487 [(set_attr "length" "8")
6488 (set_attr "type" "fp")])
6490 ;; Twiddles bits to avoid double rounding.
6491 ;; Bits that might be truncated when converting to DFmode are replaced
6492 ;; by a bit that won't be lost at that stage, but is below the SFmode
6493 ;; rounding position.
6494 (define_expand "floatdisf2_internal2"
6495 [(set (match_dup 3) (ashiftrt:DI (match_operand:DI 1 "" "")
6497 (parallel [(set (match_operand:DI 0 "" "") (and:DI (match_dup 1)
6499 (clobber (scratch:CC))])
6500 (set (match_dup 3) (plus:DI (match_dup 3)
6502 (set (match_dup 0) (plus:DI (match_dup 0)
6504 (set (match_dup 4) (compare:CCUNS (match_dup 3)
6506 (set (match_dup 0) (ior:DI (match_dup 0)
6508 (parallel [(set (match_dup 0) (and:DI (match_dup 0)
6510 (clobber (scratch:CC))])
6511 (set (pc) (if_then_else (geu (match_dup 4) (const_int 0))
6512 (label_ref (match_operand:DI 2 "" ""))
6514 (set (match_dup 0) (match_dup 1))]
6515 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
6518 operands[3] = gen_reg_rtx (DImode);
6519 operands[4] = gen_reg_rtx (CCUNSmode);
6522 (define_expand "floatunsdisf2"
6523 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6524 (unsigned_float:SF (match_operand:DI 1 "gpc_reg_operand" "")))]
6525 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
6526 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDUS"
6529 (define_insn "floatunsdisf2_fcfidus"
6530 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6531 (unsigned_float:SF (match_operand:DI 1 "gpc_reg_operand" "d")))]
6532 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
6533 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDUS"
6535 [(set_attr "type" "fp")])
6537 (define_insn_and_split "*floatunsdisf2_mem"
6538 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6539 (unsigned_float:SF (match_operand:DI 1 "memory_operand" "m")))
6540 (clobber (match_scratch:DI 2 "=f"))]
6541 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
6542 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDUS"
6544 "&& reload_completed"
6548 emit_move_insn (operands[2], operands[1]);
6549 emit_insn (gen_floatunsdisf2_fcfidus (operands[0], operands[2]));
6552 [(set_attr "length" "8")
6553 (set_attr "type" "fpload")])
6555 ;; Define the TImode operations that can be done in a small number
6556 ;; of instructions. The & constraints are to prevent the register
6557 ;; allocator from allocating registers that overlap with the inputs
6558 ;; (for example, having an input in 7,8 and an output in 6,7). We
6559 ;; also allow for the output being the same as one of the inputs.
6561 (define_insn "addti3"
6562 [(set (match_operand:TI 0 "gpc_reg_operand" "=&r,&r,r,r")
6563 (plus:TI (match_operand:TI 1 "gpc_reg_operand" "%r,r,0,0")
6564 (match_operand:TI 2 "reg_or_short_operand" "r,I,r,I")))]
6567 if (WORDS_BIG_ENDIAN)
6568 return (GET_CODE (operands[2])) != CONST_INT
6569 ? \"addc %L0,%L1,%L2\;adde %0,%1,%2\"
6570 : \"addic %L0,%L1,%2\;add%G2e %0,%1\";
6572 return (GET_CODE (operands[2])) != CONST_INT
6573 ? \"addc %0,%1,%2\;adde %L0,%L1,%L2\"
6574 : \"addic %0,%1,%2\;add%G2e %L0,%L1\";
6576 [(set_attr "type" "two")
6577 (set_attr "length" "8")])
6579 (define_insn "subti3"
6580 [(set (match_operand:TI 0 "gpc_reg_operand" "=&r,&r,r,r,r")
6581 (minus:TI (match_operand:TI 1 "reg_or_short_operand" "r,I,0,r,I")
6582 (match_operand:TI 2 "gpc_reg_operand" "r,r,r,0,0")))]
6585 if (WORDS_BIG_ENDIAN)
6586 return (GET_CODE (operands[1]) != CONST_INT)
6587 ? \"subfc %L0,%L2,%L1\;subfe %0,%2,%1\"
6588 : \"subfic %L0,%L2,%1\;subf%G1e %0,%2\";
6590 return (GET_CODE (operands[1]) != CONST_INT)
6591 ? \"subfc %0,%2,%1\;subfe %L0,%L2,%L1\"
6592 : \"subfic %0,%2,%1\;subf%G1e %L0,%L2\";
6594 [(set_attr "type" "two")
6595 (set_attr "length" "8")])
6598 ;; Define the DImode operations that can be done in a small number
6599 ;; of instructions. The & constraints are to prevent the register
6600 ;; allocator from allocating registers that overlap with the inputs
6601 ;; (for example, having an input in 7,8 and an output in 6,7). We
6602 ;; also allow for the output being the same as one of the inputs.
6604 (define_insn "*adddi3_noppc64"
6605 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r")
6606 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,0,0")
6607 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I")))]
6608 "! TARGET_POWERPC64"
6611 if (WORDS_BIG_ENDIAN)
6612 return (GET_CODE (operands[2])) != CONST_INT
6613 ? \"addc %L0,%L1,%L2\;adde %0,%1,%2\"
6614 : \"addic %L0,%L1,%2\;add%G2e %0,%1\";
6616 return (GET_CODE (operands[2])) != CONST_INT
6617 ? \"addc %0,%1,%2\;adde %L0,%L1,%L2\"
6618 : \"addic %0,%1,%2\;add%G2e %L0,%L1\";
6620 [(set_attr "type" "two")
6621 (set_attr "length" "8")])
6623 (define_insn "*subdi3_noppc64"
6624 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r,r")
6625 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I,0,r,I")
6626 (match_operand:DI 2 "gpc_reg_operand" "r,r,r,0,0")))]
6627 "! TARGET_POWERPC64"
6630 if (WORDS_BIG_ENDIAN)
6631 return (GET_CODE (operands[1]) != CONST_INT)
6632 ? \"subfc %L0,%L2,%L1\;subfe %0,%2,%1\"
6633 : \"subfic %L0,%L2,%1\;subf%G1e %0,%2\";
6635 return (GET_CODE (operands[1]) != CONST_INT)
6636 ? \"subfc %0,%2,%1\;subfe %L0,%L2,%L1\"
6637 : \"subfic %0,%2,%1\;subf%G1e %L0,%L2\";
6639 [(set_attr "type" "two")
6640 (set_attr "length" "8")])
6642 (define_insn "*negdi2_noppc64"
6643 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6644 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))]
6645 "! TARGET_POWERPC64"
6648 return (WORDS_BIG_ENDIAN)
6649 ? \"subfic %L0,%L1,0\;subfze %0,%1\"
6650 : \"subfic %0,%1,0\;subfze %L0,%L1\";
6652 [(set_attr "type" "two")
6653 (set_attr "length" "8")])
6655 (define_insn "mulsidi3"
6656 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6657 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6658 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
6659 "! TARGET_POWERPC64"
6661 return (WORDS_BIG_ENDIAN)
6662 ? \"mulhw %0,%1,%2\;mullw %L0,%1,%2\"
6663 : \"mulhw %L0,%1,%2\;mullw %0,%1,%2\";
6665 [(set_attr "type" "mul")
6666 (set_attr "length" "8")])
6669 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6670 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6671 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6672 "! TARGET_POWERPC64 && reload_completed"
6675 (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
6676 (sign_extend:DI (match_dup 2)))
6679 (mult:SI (match_dup 1)
6683 int endian = (WORDS_BIG_ENDIAN == 0);
6684 operands[3] = operand_subword (operands[0], endian, 0, DImode);
6685 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
6688 (define_insn "umulsidi3"
6689 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6690 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6691 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
6692 "! TARGET_POWERPC64"
6695 return (WORDS_BIG_ENDIAN)
6696 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
6697 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
6699 [(set_attr "type" "mul")
6700 (set_attr "length" "8")])
6703 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6704 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6705 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6706 "! TARGET_POWERPC64 && reload_completed"
6709 (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
6710 (zero_extend:DI (match_dup 2)))
6713 (mult:SI (match_dup 1)
6717 int endian = (WORDS_BIG_ENDIAN == 0);
6718 operands[3] = operand_subword (operands[0], endian, 0, DImode);
6719 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
6722 (define_insn "smulsi3_highpart"
6723 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6725 (lshiftrt:DI (mult:DI (sign_extend:DI
6726 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6728 (match_operand:SI 2 "gpc_reg_operand" "r")))
6732 [(set_attr "type" "mul")])
6734 (define_insn "umulsi3_highpart"
6735 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6737 (lshiftrt:DI (mult:DI (zero_extend:DI
6738 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6740 (match_operand:SI 2 "gpc_reg_operand" "r")))
6744 [(set_attr "type" "mul")])
6746 ;; Shift by a variable amount is too complex to be worth open-coding. We
6747 ;; just handle shifts by constants.
6748 (define_insn "ashrdi3_no_power"
6749 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
6750 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6751 (match_operand:SI 2 "const_int_operand" "M,i")))]
6755 switch (which_alternative)
6760 if (WORDS_BIG_ENDIAN)
6761 return \"srawi %0,%1,31\;srawi %L0,%1,%h2\";
6763 return \"srawi %L0,%L1,31\;srawi %0,%L1,%h2\";
6765 if (WORDS_BIG_ENDIAN)
6766 return \"srwi %L0,%L1,%h2\;insrwi %L0,%1,%h2,0\;srawi %0,%1,%h2\";
6768 return \"srwi %0,%1,%h2\;insrwi %0,%L1,%h2,0\;srawi %L0,%L1,%h2\";
6771 [(set_attr "type" "two,three")
6772 (set_attr "length" "8,12")])
6774 (define_insn "*ashrdisi3_noppc64be"
6775 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6776 (subreg:SI (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6777 (const_int 32)) 4))]
6778 "TARGET_32BIT && !TARGET_POWERPC64 && WORDS_BIG_ENDIAN"
6781 if (REGNO (operands[0]) == REGNO (operands[1]))
6784 return \"mr %0,%1\";
6786 [(set_attr "length" "4")])
6789 ;; PowerPC64 DImode operations.
6791 (define_insn "muldi3"
6792 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6793 (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6794 (match_operand:DI 2 "reg_or_short_operand" "r,I")))]
6799 [(set_attr "type" "mul")
6801 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
6803 (match_operand:SI 2 "short_cint_operand" "")
6804 (const_string "16")]
6805 (const_string "64")))])
6807 (define_insn "*muldi3_internal1"
6808 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6809 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6810 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6812 (clobber (match_scratch:DI 3 "=r,r"))]
6817 [(set_attr "type" "mul")
6818 (set_attr "size" "64")
6819 (set_attr "dot" "yes")
6820 (set_attr "length" "4,8")])
6823 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6824 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
6825 (match_operand:DI 2 "gpc_reg_operand" ""))
6827 (clobber (match_scratch:DI 3 ""))]
6828 "TARGET_POWERPC64 && reload_completed"
6830 (mult:DI (match_dup 1) (match_dup 2)))
6832 (compare:CC (match_dup 3)
6836 (define_insn "*muldi3_internal2"
6837 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6838 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6839 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6841 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6842 (mult:DI (match_dup 1) (match_dup 2)))]
6847 [(set_attr "type" "mul")
6848 (set_attr "size" "64")
6849 (set_attr "dot" "yes")
6850 (set_attr "length" "4,8")])
6853 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
6854 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
6855 (match_operand:DI 2 "gpc_reg_operand" ""))
6857 (set (match_operand:DI 0 "gpc_reg_operand" "")
6858 (mult:DI (match_dup 1) (match_dup 2)))]
6859 "TARGET_POWERPC64 && reload_completed"
6861 (mult:DI (match_dup 1) (match_dup 2)))
6863 (compare:CC (match_dup 0)
6867 (define_insn "smuldi3_highpart"
6868 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6870 (lshiftrt:TI (mult:TI (sign_extend:TI
6871 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6873 (match_operand:DI 2 "gpc_reg_operand" "r")))
6877 [(set_attr "type" "mul")
6878 (set_attr "size" "64")])
6880 (define_insn "umuldi3_highpart"
6881 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6883 (lshiftrt:TI (mult:TI (zero_extend:TI
6884 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6886 (match_operand:DI 2 "gpc_reg_operand" "r")))
6890 [(set_attr "type" "mul")
6891 (set_attr "size" "64")])
6893 (define_expand "mulditi3"
6894 [(set (match_operand:TI 0 "gpc_reg_operand")
6895 (mult:TI (sign_extend:TI (match_operand:DI 1 "gpc_reg_operand"))
6896 (sign_extend:TI (match_operand:DI 2 "gpc_reg_operand"))))]
6899 rtx l = gen_reg_rtx (DImode), h = gen_reg_rtx (DImode);
6900 emit_insn (gen_muldi3 (l, operands[1], operands[2]));
6901 emit_insn (gen_smuldi3_highpart (h, operands[1], operands[2]));
6902 emit_move_insn (gen_lowpart (DImode, operands[0]), l);
6903 emit_move_insn (gen_highpart (DImode, operands[0]), h);
6907 (define_expand "umulditi3"
6908 [(set (match_operand:TI 0 "gpc_reg_operand")
6909 (mult:TI (zero_extend:TI (match_operand:DI 1 "gpc_reg_operand"))
6910 (zero_extend:TI (match_operand:DI 2 "gpc_reg_operand"))))]
6913 rtx l = gen_reg_rtx (DImode), h = gen_reg_rtx (DImode);
6914 emit_insn (gen_muldi3 (l, operands[1], operands[2]));
6915 emit_insn (gen_umuldi3_highpart (h, operands[1], operands[2]));
6916 emit_move_insn (gen_lowpart (DImode, operands[0]), l);
6917 emit_move_insn (gen_highpart (DImode, operands[0]), h);
6921 (define_insn "*rotldi3_internal4"
6922 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6923 (and:DI (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6924 (match_operand:DI 2 "reg_or_cint_operand" "rn"))
6925 (match_operand:DI 3 "mask64_operand" "n")))]
6927 "rld%I2c%B3 %0,%1,%H2,%S3"
6928 [(set_attr "type" "shift")
6929 (set_attr "maybe_var_shift" "yes")])
6931 (define_insn "*rotldi3_internal5"
6932 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6934 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6935 (match_operand:DI 2 "reg_or_cint_operand" "rn,rn"))
6936 (match_operand:DI 3 "mask64_operand" "n,n"))
6938 (clobber (match_scratch:DI 4 "=r,r"))]
6941 rld%I2c%B3. %4,%1,%H2,%S3
6943 [(set_attr "type" "shift")
6944 (set_attr "maybe_var_shift" "yes")
6945 (set_attr "dot" "yes")
6946 (set_attr "length" "4,8")])
6949 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
6951 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6952 (match_operand:DI 2 "reg_or_cint_operand" ""))
6953 (match_operand:DI 3 "mask64_operand" ""))
6955 (clobber (match_scratch:DI 4 ""))]
6956 "TARGET_POWERPC64 && reload_completed"
6958 (and:DI (rotate:DI (match_dup 1)
6962 (compare:CC (match_dup 4)
6966 (define_insn "*rotldi3_internal6"
6967 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
6969 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6970 (match_operand:DI 2 "reg_or_cint_operand" "rn,rn"))
6971 (match_operand:DI 3 "mask64_operand" "n,n"))
6973 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6974 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6977 rld%I2c%B3. %0,%1,%H2,%S3
6979 [(set_attr "type" "shift")
6980 (set_attr "maybe_var_shift" "yes")
6981 (set_attr "dot" "yes")
6982 (set_attr "length" "4,8")])
6985 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
6987 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6988 (match_operand:DI 2 "reg_or_cint_operand" ""))
6989 (match_operand:DI 3 "mask64_operand" ""))
6991 (set (match_operand:DI 0 "gpc_reg_operand" "")
6992 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6993 "TARGET_POWERPC64 && reload_completed"
6995 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
6997 (compare:CC (match_dup 0)
7001 (define_insn "*rotldi3_internal7le"
7002 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7005 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7006 (match_operand:DI 2 "reg_or_cint_operand" "rn")) 0)))]
7007 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN"
7008 "rld%I2cl %0,%1,%H2,56"
7009 [(set_attr "type" "shift")
7010 (set_attr "maybe_var_shift" "yes")])
7012 (define_insn "*rotldi3_internal7be"
7013 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7016 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7017 (match_operand:DI 2 "reg_or_cint_operand" "rn")) 7)))]
7018 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN"
7019 "rld%I2cl %0,%1,%H2,56"
7020 [(set_attr "type" "shift")
7021 (set_attr "maybe_var_shift" "yes")])
7023 (define_insn "*rotldi3_internal8le"
7024 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7025 (compare:CC (zero_extend:DI
7027 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7028 (match_operand:DI 2 "reg_or_cint_operand" "rn,rn")) 0))
7030 (clobber (match_scratch:DI 3 "=r,r"))]
7031 "TARGET_64BIT && !BYTES_BIG_ENDIAN"
7033 rld%I2cl. %3,%1,%H2,56
7035 [(set_attr "type" "shift")
7036 (set_attr "maybe_var_shift" "yes")
7037 (set_attr "dot" "yes")
7038 (set_attr "length" "4,8")])
7040 (define_insn "*rotldi3_internal8be"
7041 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7042 (compare:CC (zero_extend:DI
7044 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7045 (match_operand:DI 2 "reg_or_cint_operand" "rn,rn")) 7))
7047 (clobber (match_scratch:DI 3 "=r,r"))]
7048 "TARGET_64BIT && BYTES_BIG_ENDIAN"
7050 rld%I2cl. %3,%1,%H2,56
7052 [(set_attr "type" "shift")
7053 (set_attr "maybe_var_shift" "yes")
7054 (set_attr "dot" "yes")
7055 (set_attr "length" "4,8")])
7058 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7059 (compare:CC (zero_extend:DI
7061 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7062 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7064 (clobber (match_scratch:DI 3 ""))]
7065 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN && reload_completed"
7067 (zero_extend:DI (subreg:QI
7068 (rotate:DI (match_dup 1)
7071 (compare:CC (match_dup 3)
7076 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7077 (compare:CC (zero_extend:DI
7079 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7080 (match_operand:DI 2 "reg_or_cint_operand" "")) 7))
7082 (clobber (match_scratch:DI 3 ""))]
7083 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN && reload_completed"
7085 (zero_extend:DI (subreg:QI
7086 (rotate:DI (match_dup 1)
7089 (compare:CC (match_dup 3)
7093 (define_insn "*rotldi3_internal9le"
7094 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7095 (compare:CC (zero_extend:DI
7097 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7098 (match_operand:DI 2 "reg_or_cint_operand" "rn,rn")) 0))
7100 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7101 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7102 "TARGET_64BIT && !BYTES_BIG_ENDIAN"
7104 rld%I2cl. %0,%1,%H2,56
7106 [(set_attr "type" "shift")
7107 (set_attr "maybe_var_shift" "yes")
7108 (set_attr "dot" "yes")
7109 (set_attr "length" "4,8")])
7111 (define_insn "*rotldi3_internal9be"
7112 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7113 (compare:CC (zero_extend:DI
7115 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7116 (match_operand:DI 2 "reg_or_cint_operand" "rn,rn")) 7))
7118 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7119 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 7)))]
7120 "TARGET_64BIT && BYTES_BIG_ENDIAN"
7122 rld%I2cl. %0,%1,%H2,56
7124 [(set_attr "type" "shift")
7125 (set_attr "maybe_var_shift" "yes")
7126 (set_attr "dot" "yes")
7127 (set_attr "length" "4,8")])
7130 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7131 (compare:CC (zero_extend:DI
7133 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7134 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7136 (set (match_operand:DI 0 "gpc_reg_operand" "")
7137 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7138 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN && reload_completed"
7140 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
7142 (compare:CC (match_dup 0)
7147 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7148 (compare:CC (zero_extend:DI
7150 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7151 (match_operand:DI 2 "reg_or_cint_operand" "")) 7))
7153 (set (match_operand:DI 0 "gpc_reg_operand" "")
7154 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 7)))]
7155 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN && reload_completed"
7157 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 7)))
7159 (compare:CC (match_dup 0)
7163 (define_insn "*rotldi3_internal10le"
7164 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7167 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7168 (match_operand:DI 2 "reg_or_cint_operand" "rn")) 0)))]
7169 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN"
7170 "rld%I2cl %0,%1,%H2,48"
7171 [(set_attr "type" "shift")
7172 (set_attr "maybe_var_shift" "yes")])
7174 (define_insn "*rotldi3_internal10be"
7175 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7178 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7179 (match_operand:DI 2 "reg_or_cint_operand" "rn")) 6)))]
7180 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN"
7181 "rld%I2cl %0,%1,%H2,48"
7182 [(set_attr "type" "shift")
7183 (set_attr "maybe_var_shift" "yes")])
7185 (define_insn "*rotldi3_internal11le"
7186 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7187 (compare:CC (zero_extend:DI
7189 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7190 (match_operand:DI 2 "reg_or_cint_operand" "rn,rn")) 0))
7192 (clobber (match_scratch:DI 3 "=r,r"))]
7193 "TARGET_64BIT && !BYTES_BIG_ENDIAN"
7195 rld%I2cl. %3,%1,%H2,48
7197 [(set_attr "type" "shift")
7198 (set_attr "maybe_var_shift" "yes")
7199 (set_attr "dot" "yes")
7200 (set_attr "length" "4,8")])
7202 (define_insn "*rotldi3_internal11be"
7203 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7204 (compare:CC (zero_extend:DI
7206 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7207 (match_operand:DI 2 "reg_or_cint_operand" "rn,rn")) 6))
7209 (clobber (match_scratch:DI 3 "=r,r"))]
7210 "TARGET_64BIT && BYTES_BIG_ENDIAN"
7212 rld%I2cl. %3,%1,%H2,48
7214 [(set_attr "type" "shift")
7215 (set_attr "maybe_var_shift" "yes")
7216 (set_attr "dot" "yes")
7217 (set_attr "length" "4,8")])
7220 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7221 (compare:CC (zero_extend:DI
7223 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7224 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7226 (clobber (match_scratch:DI 3 ""))]
7227 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN && reload_completed"
7229 (zero_extend:DI (subreg:HI
7230 (rotate:DI (match_dup 1)
7233 (compare:CC (match_dup 3)
7238 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7239 (compare:CC (zero_extend:DI
7241 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7242 (match_operand:DI 2 "reg_or_cint_operand" "")) 6))
7244 (clobber (match_scratch:DI 3 ""))]
7245 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN && reload_completed"
7247 (zero_extend:DI (subreg:HI
7248 (rotate:DI (match_dup 1)
7251 (compare:CC (match_dup 3)
7255 (define_insn "*rotldi3_internal12le"
7256 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7257 (compare:CC (zero_extend:DI
7259 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7260 (match_operand:DI 2 "reg_or_cint_operand" "rn,rn")) 0))
7262 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7263 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7264 "TARGET_64BIT && !BYTES_BIG_ENDIAN"
7266 rld%I2cl. %0,%1,%H2,48
7268 [(set_attr "type" "shift")
7269 (set_attr "maybe_var_shift" "yes")
7270 (set_attr "dot" "yes")
7271 (set_attr "length" "4,8")])
7273 (define_insn "*rotldi3_internal12be"
7274 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7275 (compare:CC (zero_extend:DI
7277 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7278 (match_operand:DI 2 "reg_or_cint_operand" "rn,rn")) 6))
7280 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7281 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 6)))]
7282 "TARGET_64BIT && BYTES_BIG_ENDIAN"
7284 rld%I2cl. %0,%1,%H2,48
7286 [(set_attr "type" "shift")
7287 (set_attr "maybe_var_shift" "yes")
7288 (set_attr "dot" "yes")
7289 (set_attr "length" "4,8")])
7292 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7293 (compare:CC (zero_extend:DI
7295 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7296 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7298 (set (match_operand:DI 0 "gpc_reg_operand" "")
7299 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7300 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN && reload_completed"
7302 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
7304 (compare:CC (match_dup 0)
7309 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7310 (compare:CC (zero_extend:DI
7312 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7313 (match_operand:DI 2 "reg_or_cint_operand" "")) 6))
7315 (set (match_operand:DI 0 "gpc_reg_operand" "")
7316 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 6)))]
7317 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN && reload_completed"
7319 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 6)))
7321 (compare:CC (match_dup 0)
7325 (define_insn "*rotldi3_internal13le"
7326 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7329 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7330 (match_operand:DI 2 "reg_or_cint_operand" "rn")) 0)))]
7331 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN"
7332 "rld%I2cl %0,%1,%H2,32"
7333 [(set_attr "type" "shift")
7334 (set_attr "maybe_var_shift" "yes")])
7336 (define_insn "*rotldi3_internal13be"
7337 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7340 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7341 (match_operand:DI 2 "reg_or_cint_operand" "rn")) 4)))]
7342 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN"
7343 "rld%I2cl %0,%1,%H2,32"
7344 [(set_attr "type" "shift")
7345 (set_attr "maybe_var_shift" "yes")])
7347 (define_insn "*rotldi3_internal14le"
7348 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7349 (compare:CC (zero_extend:DI
7351 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7352 (match_operand:DI 2 "reg_or_cint_operand" "rn,rn")) 0))
7354 (clobber (match_scratch:DI 3 "=r,r"))]
7355 "TARGET_64BIT && !BYTES_BIG_ENDIAN"
7357 rld%I2cl. %3,%1,%H2,32
7359 [(set_attr "type" "shift")
7360 (set_attr "maybe_var_shift" "yes")
7361 (set_attr "dot" "yes")
7362 (set_attr "length" "4,8")])
7364 (define_insn "*rotldi3_internal14be"
7365 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7366 (compare:CC (zero_extend:DI
7368 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7369 (match_operand:DI 2 "reg_or_cint_operand" "rn,rn")) 4))
7371 (clobber (match_scratch:DI 3 "=r,r"))]
7372 "TARGET_64BIT && BYTES_BIG_ENDIAN"
7374 rld%I2cl. %3,%1,%H2,32
7376 [(set_attr "type" "shift")
7377 (set_attr "maybe_var_shift" "yes")
7378 (set_attr "dot" "yes")
7379 (set_attr "length" "4,8")])
7382 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7383 (compare:CC (zero_extend:DI
7385 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7386 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7388 (clobber (match_scratch:DI 3 ""))]
7389 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN && reload_completed"
7391 (zero_extend:DI (subreg:SI
7392 (rotate:DI (match_dup 1)
7395 (compare:CC (match_dup 3)
7400 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7401 (compare:CC (zero_extend:DI
7403 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7404 (match_operand:DI 2 "reg_or_cint_operand" "")) 4))
7406 (clobber (match_scratch:DI 3 ""))]
7407 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN && reload_completed"
7409 (zero_extend:DI (subreg:SI
7410 (rotate:DI (match_dup 1)
7413 (compare:CC (match_dup 3)
7417 (define_insn "*rotldi3_internal15le"
7418 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7419 (compare:CC (zero_extend:DI
7421 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7422 (match_operand:DI 2 "reg_or_cint_operand" "rn,rn")) 0))
7424 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7425 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7426 "TARGET_64BIT && !BYTES_BIG_ENDIAN"
7428 rld%I2cl. %0,%1,%H2,32
7430 [(set_attr "type" "shift")
7431 (set_attr "maybe_var_shift" "yes")
7432 (set_attr "dot" "yes")
7433 (set_attr "length" "4,8")])
7435 (define_insn "*rotldi3_internal15be"
7436 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7437 (compare:CC (zero_extend:DI
7439 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7440 (match_operand:DI 2 "reg_or_cint_operand" "rn,rn")) 4))
7442 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7443 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 4)))]
7444 "TARGET_64BIT && BYTES_BIG_ENDIAN"
7446 rld%I2cl. %0,%1,%H2,32
7448 [(set_attr "type" "shift")
7449 (set_attr "maybe_var_shift" "yes")
7450 (set_attr "dot" "yes")
7451 (set_attr "length" "4,8")])
7454 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7455 (compare:CC (zero_extend:DI
7457 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7458 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7460 (set (match_operand:DI 0 "gpc_reg_operand" "")
7461 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7462 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN && reload_completed"
7464 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
7466 (compare:CC (match_dup 0)
7471 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7472 (compare:CC (zero_extend:DI
7474 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7475 (match_operand:DI 2 "reg_or_cint_operand" "")) 4))
7477 (set (match_operand:DI 0 "gpc_reg_operand" "")
7478 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 4)))]
7479 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN && reload_completed"
7481 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 4)))
7483 (compare:CC (match_dup 0)
7487 (define_insn "*ashldi3_internal4"
7488 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7489 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7490 (match_operand:SI 2 "const_int_operand" "i"))
7491 (match_operand:DI 3 "const_int_operand" "n")))]
7492 "TARGET_POWERPC64 && includes_rldic_lshift_p (operands[2], operands[3])"
7493 "rldic %0,%1,%H2,%W3"
7494 [(set_attr "type" "shift")])
7496 (define_insn "ashldi3_internal5"
7497 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7499 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7500 (match_operand:SI 2 "const_int_operand" "i,i"))
7501 (match_operand:DI 3 "const_int_operand" "n,n"))
7503 (clobber (match_scratch:DI 4 "=r,r"))]
7504 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
7506 rldic. %4,%1,%H2,%W3
7508 [(set_attr "type" "shift")
7509 (set_attr "dot" "yes")
7510 (set_attr "length" "4,8")])
7513 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7515 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7516 (match_operand:SI 2 "const_int_operand" ""))
7517 (match_operand:DI 3 "const_int_operand" ""))
7519 (clobber (match_scratch:DI 4 ""))]
7520 "TARGET_POWERPC64 && reload_completed
7521 && includes_rldic_lshift_p (operands[2], operands[3])"
7523 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7526 (compare:CC (match_dup 4)
7530 (define_insn "*ashldi3_internal6"
7531 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
7533 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7534 (match_operand:SI 2 "const_int_operand" "i,i"))
7535 (match_operand:DI 3 "const_int_operand" "n,n"))
7537 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7538 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7539 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
7541 rldic. %0,%1,%H2,%W3
7543 [(set_attr "type" "shift")
7544 (set_attr "dot" "yes")
7545 (set_attr "length" "4,8")])
7548 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
7550 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7551 (match_operand:SI 2 "const_int_operand" ""))
7552 (match_operand:DI 3 "const_int_operand" ""))
7554 (set (match_operand:DI 0 "gpc_reg_operand" "")
7555 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7556 "TARGET_POWERPC64 && reload_completed
7557 && includes_rldic_lshift_p (operands[2], operands[3])"
7559 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7562 (compare:CC (match_dup 0)
7566 (define_insn "*ashldi3_internal7"
7567 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7568 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7569 (match_operand:SI 2 "const_int_operand" "i"))
7570 (match_operand:DI 3 "mask64_operand" "n")))]
7571 "TARGET_POWERPC64 && includes_rldicr_lshift_p (operands[2], operands[3])"
7572 "rldicr %0,%1,%H2,%S3"
7573 [(set_attr "type" "shift")])
7575 (define_insn "ashldi3_internal8"
7576 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7578 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7579 (match_operand:SI 2 "const_int_operand" "i,i"))
7580 (match_operand:DI 3 "mask64_operand" "n,n"))
7582 (clobber (match_scratch:DI 4 "=r,r"))]
7583 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
7585 rldicr. %4,%1,%H2,%S3
7587 [(set_attr "type" "shift")
7588 (set_attr "dot" "yes")
7589 (set_attr "length" "4,8")])
7592 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7594 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7595 (match_operand:SI 2 "const_int_operand" ""))
7596 (match_operand:DI 3 "mask64_operand" ""))
7598 (clobber (match_scratch:DI 4 ""))]
7599 "TARGET_POWERPC64 && reload_completed
7600 && includes_rldicr_lshift_p (operands[2], operands[3])"
7602 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7605 (compare:CC (match_dup 4)
7609 (define_insn "*ashldi3_internal9"
7610 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
7612 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7613 (match_operand:SI 2 "const_int_operand" "i,i"))
7614 (match_operand:DI 3 "mask64_operand" "n,n"))
7616 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7617 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7618 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
7620 rldicr. %0,%1,%H2,%S3
7622 [(set_attr "type" "shift")
7623 (set_attr "dot" "yes")
7624 (set_attr "length" "4,8")])
7627 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
7629 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7630 (match_operand:SI 2 "const_int_operand" ""))
7631 (match_operand:DI 3 "mask64_operand" ""))
7633 (set (match_operand:DI 0 "gpc_reg_operand" "")
7634 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7635 "TARGET_POWERPC64 && reload_completed
7636 && includes_rldicr_lshift_p (operands[2], operands[3])"
7638 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7641 (compare:CC (match_dup 0)
7645 (define_expand "anddi3"
7647 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7648 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7649 (match_operand:DI 2 "reg_or_cint_operand" "")))
7650 (clobber (match_scratch:CC 3 ""))])]
7653 if (!TARGET_POWERPC64)
7655 rtx cc = gen_rtx_SCRATCH (CCmode);
7656 rs6000_split_logical (operands, AND, false, false, false, cc);
7659 else if (!and64_2_operand (operands[2], DImode))
7660 operands[2] = force_reg (DImode, operands[2]);
7663 (define_insn "anddi3_mc"
7664 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
7665 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r")
7666 (match_operand:DI 2 "and64_2_operand" "?r,S,T,K,J,t")))
7667 (clobber (match_scratch:CC 3 "=X,X,X,x,x,X"))]
7668 "TARGET_POWERPC64 && rs6000_gen_cell_microcode"
7671 rldic%B2 %0,%1,0,%S2
7672 rlwinm %0,%1,0,%m2,%M2
7676 [(set_attr "type" "*,shift,shift,logical,logical,*")
7677 (set_attr "dot" "no,no,no,yes,yes,no")
7678 (set_attr "length" "4,4,4,4,4,8")])
7680 (define_insn "anddi3_nomc"
7681 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7682 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r")
7683 (match_operand:DI 2 "and64_2_operand" "?r,S,T,t")))
7684 (clobber (match_scratch:CC 3 "=X,X,X,X"))]
7685 "TARGET_POWERPC64 && !rs6000_gen_cell_microcode"
7688 rldic%B2 %0,%1,0,%S2
7689 rlwinm %0,%1,0,%m2,%M2
7691 [(set_attr "type" "*,shift,shift,*")
7692 (set_attr "length" "4,4,4,8")])
7695 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7696 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7697 (match_operand:DI 2 "mask64_2_operand" "")))
7698 (clobber (match_scratch:CC 3 ""))]
7700 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7701 && !mask_operand (operands[2], DImode)
7702 && !mask64_operand (operands[2], DImode)"
7704 (and:DI (rotate:DI (match_dup 1)
7708 (and:DI (rotate:DI (match_dup 0)
7712 build_mask64_2_operands (operands[2], &operands[4]);
7715 (define_insn "*anddi3_internal2_mc"
7716 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,x,?y,?y,?y,??y,??y,?y")
7717 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r,r,r")
7718 (match_operand:DI 2 "and64_2_operand" "r,S,T,K,J,t,r,S,T,K,J,t"))
7720 (clobber (match_scratch:DI 3 "=r,r,r,r,r,r,r,r,r,r,r,r"))
7721 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,X,X,x,x,X"))]
7722 "TARGET_64BIT && rs6000_gen_cell_microcode"
7725 rldic%B2. %3,%1,0,%S2
7726 rlwinm. %3,%1,0,%m2,%M2
7736 [(set_attr "type" "logical,shift,shift,logical,\
7737 logical,compare,compare,compare,compare,compare,\
7739 (set_attr "dot" "yes")
7740 (set_attr "length" "4,4,4,4,4,8,8,8,8,8,8,12")])
7743 [(set (match_operand:CC 0 "cc_reg_operand" "")
7744 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7745 (match_operand:DI 2 "mask64_2_operand" ""))
7747 (clobber (match_scratch:DI 3 ""))
7748 (clobber (match_scratch:CC 4 ""))]
7749 "TARGET_64BIT && reload_completed
7750 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7751 && !mask_operand (operands[2], DImode)
7752 && !mask64_operand (operands[2], DImode)"
7754 (and:DI (rotate:DI (match_dup 1)
7757 (parallel [(set (match_dup 0)
7758 (compare:CC (and:DI (rotate:DI (match_dup 3)
7762 (clobber (match_dup 3))])]
7765 build_mask64_2_operands (operands[2], &operands[5]);
7768 (define_insn "*anddi3_internal3_mc"
7769 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,x,x,?y,?y,?y,??y,??y,?y")
7770 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r,r,r")
7771 (match_operand:DI 2 "and64_2_operand" "r,S,T,K,J,t,r,S,T,K,J,t"))
7773 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r,r,r")
7774 (and:DI (match_dup 1) (match_dup 2)))
7775 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,X,X,x,x,X"))]
7776 "TARGET_64BIT && rs6000_gen_cell_microcode"
7779 rldic%B2. %0,%1,0,%S2
7780 rlwinm. %0,%1,0,%m2,%M2
7790 [(set_attr "type" "logical,shift,shift,logical,\
7791 logical,compare,compare,compare,compare,compare,\
7793 (set_attr "dot" "yes")
7794 (set_attr "length" "4,4,4,4,4,8,8,8,8,8,8,12")])
7797 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7798 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7799 (match_operand:DI 2 "and64_2_operand" ""))
7801 (set (match_operand:DI 0 "gpc_reg_operand" "")
7802 (and:DI (match_dup 1) (match_dup 2)))
7803 (clobber (match_scratch:CC 4 ""))]
7804 "TARGET_64BIT && reload_completed"
7805 [(parallel [(set (match_dup 0)
7806 (and:DI (match_dup 1) (match_dup 2)))
7807 (clobber (match_dup 4))])
7809 (compare:CC (match_dup 0)
7814 [(set (match_operand:CC 3 "cc_reg_operand" "")
7815 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7816 (match_operand:DI 2 "mask64_2_operand" ""))
7818 (set (match_operand:DI 0 "gpc_reg_operand" "")
7819 (and:DI (match_dup 1) (match_dup 2)))
7820 (clobber (match_scratch:CC 4 ""))]
7821 "TARGET_64BIT && reload_completed
7822 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7823 && !mask_operand (operands[2], DImode)
7824 && !mask64_operand (operands[2], DImode)"
7826 (and:DI (rotate:DI (match_dup 1)
7829 (parallel [(set (match_dup 3)
7830 (compare:CC (and:DI (rotate:DI (match_dup 0)
7835 (and:DI (rotate:DI (match_dup 0)
7840 build_mask64_2_operands (operands[2], &operands[5]);
7843 (define_insn "*boolcdi3_internal1"
7844 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7845 (match_operator:DI 3 "boolean_operator"
7846 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
7847 (match_operand:DI 2 "gpc_reg_operand" "r")]))]
7851 (define_insn "*boolcdi3_internal2"
7852 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7853 (compare:CC (match_operator:DI 4 "boolean_operator"
7854 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
7855 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7857 (clobber (match_scratch:DI 3 "=r,r"))]
7862 [(set_attr "type" "logical,compare")
7863 (set_attr "dot" "yes")
7864 (set_attr "length" "4,8")])
7867 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7868 (compare:CC (match_operator:DI 4 "boolean_operator"
7869 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7870 (match_operand:DI 2 "gpc_reg_operand" "")])
7872 (clobber (match_scratch:DI 3 ""))]
7873 "TARGET_POWERPC64 && reload_completed"
7874 [(set (match_dup 3) (match_dup 4))
7876 (compare:CC (match_dup 3)
7880 (define_insn "*boolcdi3_internal3"
7881 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7882 (compare:CC (match_operator:DI 4 "boolean_operator"
7883 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
7884 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7886 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7892 [(set_attr "type" "logical,compare")
7893 (set_attr "dot" "yes")
7894 (set_attr "length" "4,8")])
7897 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7898 (compare:CC (match_operator:DI 4 "boolean_operator"
7899 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7900 (match_operand:DI 2 "gpc_reg_operand" "")])
7902 (set (match_operand:DI 0 "gpc_reg_operand" "")
7904 "TARGET_POWERPC64 && reload_completed"
7905 [(set (match_dup 0) (match_dup 4))
7907 (compare:CC (match_dup 0)
7911 (define_insn "*boolccdi3_internal1"
7912 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7913 (match_operator:DI 3 "boolean_operator"
7914 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
7915 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r"))]))]
7919 (define_insn "*boolccdi3_internal2"
7920 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7921 (compare:CC (match_operator:DI 4 "boolean_operator"
7922 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
7923 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
7925 (clobber (match_scratch:DI 3 "=r,r"))]
7930 [(set_attr "type" "logical,compare")
7931 (set_attr "dot" "yes")
7932 (set_attr "length" "4,8")])
7935 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7936 (compare:CC (match_operator:DI 4 "boolean_operator"
7937 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7938 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
7940 (clobber (match_scratch:DI 3 ""))]
7941 "TARGET_POWERPC64 && reload_completed"
7942 [(set (match_dup 3) (match_dup 4))
7944 (compare:CC (match_dup 3)
7948 (define_insn "*boolccdi3_internal3"
7949 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7950 (compare:CC (match_operator:DI 4 "boolean_operator"
7951 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
7952 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
7954 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7960 [(set_attr "type" "logical,compare")
7961 (set_attr "dot" "yes")
7962 (set_attr "length" "4,8")])
7965 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7966 (compare:CC (match_operator:DI 4 "boolean_operator"
7967 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7968 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
7970 (set (match_operand:DI 0 "gpc_reg_operand" "")
7972 "TARGET_POWERPC64 && reload_completed"
7973 [(set (match_dup 0) (match_dup 4))
7975 (compare:CC (match_dup 0)
7980 (define_insn "*eqv<mode>3"
7981 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
7983 (xor:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
7984 (match_operand:GPR 2 "gpc_reg_operand" "r"))))]
7987 [(set_attr "type" "integer")
7988 (set_attr "length" "4")])
7991 ;; 128-bit logical operations expanders
7993 (define_expand "and<mode>3"
7994 [(parallel [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
7996 (match_operand:BOOL_128 1 "vlogical_operand" "")
7997 (match_operand:BOOL_128 2 "vlogical_operand" "")))
7998 (clobber (match_scratch:CC 3 ""))])]
8002 (define_expand "ior<mode>3"
8003 [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
8004 (ior:BOOL_128 (match_operand:BOOL_128 1 "vlogical_operand" "")
8005 (match_operand:BOOL_128 2 "vlogical_operand" "")))]
8009 (define_expand "xor<mode>3"
8010 [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
8011 (xor:BOOL_128 (match_operand:BOOL_128 1 "vlogical_operand" "")
8012 (match_operand:BOOL_128 2 "vlogical_operand" "")))]
8016 (define_expand "one_cmpl<mode>2"
8017 [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
8018 (not:BOOL_128 (match_operand:BOOL_128 1 "vlogical_operand" "")))]
8022 (define_expand "nor<mode>3"
8023 [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
8025 (not:BOOL_128 (match_operand:BOOL_128 1 "vlogical_operand" ""))
8026 (not:BOOL_128 (match_operand:BOOL_128 2 "vlogical_operand" ""))))]
8030 (define_expand "andc<mode>3"
8031 [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
8033 (not:BOOL_128 (match_operand:BOOL_128 2 "vlogical_operand" ""))
8034 (match_operand:BOOL_128 1 "vlogical_operand" "")))]
8038 ;; Power8 vector logical instructions.
8039 (define_expand "eqv<mode>3"
8040 [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
8042 (xor:BOOL_128 (match_operand:BOOL_128 1 "vlogical_operand" "")
8043 (match_operand:BOOL_128 2 "vlogical_operand" ""))))]
8044 "<MODE>mode == TImode || <MODE>mode == PTImode || TARGET_P8_VECTOR"
8047 ;; Rewrite nand into canonical form
8048 (define_expand "nand<mode>3"
8049 [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
8051 (not:BOOL_128 (match_operand:BOOL_128 1 "vlogical_operand" ""))
8052 (not:BOOL_128 (match_operand:BOOL_128 2 "vlogical_operand" ""))))]
8053 "<MODE>mode == TImode || <MODE>mode == PTImode || TARGET_P8_VECTOR"
8056 ;; The canonical form is to have the negated element first, so we need to
8057 ;; reverse arguments.
8058 (define_expand "orc<mode>3"
8059 [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
8061 (not:BOOL_128 (match_operand:BOOL_128 2 "vlogical_operand" ""))
8062 (match_operand:BOOL_128 1 "vlogical_operand" "")))]
8063 "<MODE>mode == TImode || <MODE>mode == PTImode || TARGET_P8_VECTOR"
8066 ;; 128-bit logical operations insns and split operations
8067 (define_insn_and_split "*and<mode>3_internal"
8068 [(set (match_operand:BOOL_128 0 "vlogical_operand" "=<BOOL_REGS_OUTPUT>")
8070 (match_operand:BOOL_128 1 "vlogical_operand" "%<BOOL_REGS_OP1>")
8071 (match_operand:BOOL_128 2 "vlogical_operand" "<BOOL_REGS_OP2>")))
8072 (clobber (match_scratch:CC 3 "<BOOL_REGS_AND_CR0>"))]
8075 if (TARGET_VSX && vsx_register_operand (operands[0], <MODE>mode))
8076 return "xxland %x0,%x1,%x2";
8078 if (TARGET_ALTIVEC && altivec_register_operand (operands[0], <MODE>mode))
8079 return "vand %0,%1,%2";
8083 "reload_completed && int_reg_operand (operands[0], <MODE>mode)"
8086 rs6000_split_logical (operands, AND, false, false, false, operands[3]);
8091 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
8092 (const_string "vecsimple")
8093 (const_string "integer")))
8094 (set (attr "length")
8096 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
8099 (match_test "TARGET_POWERPC64")
8101 (const_string "16"))))])
8104 (define_insn_and_split "*bool<mode>3_internal"
8105 [(set (match_operand:BOOL_128 0 "vlogical_operand" "=<BOOL_REGS_OUTPUT>")
8106 (match_operator:BOOL_128 3 "boolean_or_operator"
8107 [(match_operand:BOOL_128 1 "vlogical_operand" "%<BOOL_REGS_OP1>")
8108 (match_operand:BOOL_128 2 "vlogical_operand" "<BOOL_REGS_OP2>")]))]
8111 if (TARGET_VSX && vsx_register_operand (operands[0], <MODE>mode))
8112 return "xxl%q3 %x0,%x1,%x2";
8114 if (TARGET_ALTIVEC && altivec_register_operand (operands[0], <MODE>mode))
8115 return "v%q3 %0,%1,%2";
8119 "reload_completed && int_reg_operand (operands[0], <MODE>mode)"
8122 rs6000_split_logical (operands, GET_CODE (operands[3]), false, false, false,
8128 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
8129 (const_string "vecsimple")
8130 (const_string "integer")))
8131 (set (attr "length")
8133 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
8136 (match_test "TARGET_POWERPC64")
8138 (const_string "16"))))])
8141 (define_insn_and_split "*boolc<mode>3_internal1"
8142 [(set (match_operand:BOOL_128 0 "vlogical_operand" "=<BOOL_REGS_OUTPUT>")
8143 (match_operator:BOOL_128 3 "boolean_operator"
8145 (match_operand:BOOL_128 2 "vlogical_operand" "<BOOL_REGS_OP1>"))
8146 (match_operand:BOOL_128 1 "vlogical_operand" "<BOOL_REGS_OP2>")]))]
8147 "TARGET_P8_VECTOR || (GET_CODE (operands[3]) == AND)"
8149 if (TARGET_VSX && vsx_register_operand (operands[0], <MODE>mode))
8150 return "xxl%q3 %x0,%x1,%x2";
8152 if (TARGET_ALTIVEC && altivec_register_operand (operands[0], <MODE>mode))
8153 return "v%q3 %0,%1,%2";
8157 "(TARGET_P8_VECTOR || (GET_CODE (operands[3]) == AND))
8158 && reload_completed && int_reg_operand (operands[0], <MODE>mode)"
8161 rs6000_split_logical (operands, GET_CODE (operands[3]), false, true, false,
8167 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
8168 (const_string "vecsimple")
8169 (const_string "integer")))
8170 (set (attr "length")
8172 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
8175 (match_test "TARGET_POWERPC64")
8177 (const_string "16"))))])
8179 (define_insn_and_split "*boolc<mode>3_internal2"
8180 [(set (match_operand:TI2 0 "int_reg_operand" "=&r,r,r")
8181 (match_operator:TI2 3 "boolean_operator"
8183 (match_operand:TI2 1 "int_reg_operand" "r,0,r"))
8184 (match_operand:TI2 2 "int_reg_operand" "r,r,0")]))]
8185 "!TARGET_P8_VECTOR && (GET_CODE (operands[3]) != AND)"
8187 "reload_completed && !TARGET_P8_VECTOR && (GET_CODE (operands[3]) != AND)"
8190 rs6000_split_logical (operands, GET_CODE (operands[3]), false, true, false,
8194 [(set_attr "type" "integer")
8195 (set (attr "length")
8197 (match_test "TARGET_POWERPC64")
8199 (const_string "16")))])
8202 (define_insn_and_split "*boolcc<mode>3_internal1"
8203 [(set (match_operand:BOOL_128 0 "vlogical_operand" "=<BOOL_REGS_OUTPUT>")
8204 (match_operator:BOOL_128 3 "boolean_operator"
8206 (match_operand:BOOL_128 1 "vlogical_operand" "<BOOL_REGS_OP1>"))
8208 (match_operand:BOOL_128 2 "vlogical_operand" "<BOOL_REGS_OP2>"))]))]
8209 "TARGET_P8_VECTOR || (GET_CODE (operands[3]) == AND)"
8211 if (TARGET_VSX && vsx_register_operand (operands[0], <MODE>mode))
8212 return "xxl%q3 %x0,%x1,%x2";
8214 if (TARGET_ALTIVEC && altivec_register_operand (operands[0], <MODE>mode))
8215 return "v%q3 %0,%1,%2";
8219 "(TARGET_P8_VECTOR || (GET_CODE (operands[3]) == AND))
8220 && reload_completed && int_reg_operand (operands[0], <MODE>mode)"
8223 rs6000_split_logical (operands, GET_CODE (operands[3]), false, true, true,
8229 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
8230 (const_string "vecsimple")
8231 (const_string "integer")))
8232 (set (attr "length")
8234 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
8237 (match_test "TARGET_POWERPC64")
8239 (const_string "16"))))])
8241 (define_insn_and_split "*boolcc<mode>3_internal2"
8242 [(set (match_operand:TI2 0 "int_reg_operand" "=&r,r,r")
8243 (match_operator:TI2 3 "boolean_operator"
8245 (match_operand:TI2 1 "int_reg_operand" "r,0,r"))
8247 (match_operand:TI2 2 "int_reg_operand" "r,r,0"))]))]
8248 "!TARGET_P8_VECTOR && (GET_CODE (operands[3]) != AND)"
8250 "reload_completed && !TARGET_P8_VECTOR && (GET_CODE (operands[3]) != AND)"
8253 rs6000_split_logical (operands, GET_CODE (operands[3]), false, true, true,
8257 [(set_attr "type" "integer")
8258 (set (attr "length")
8260 (match_test "TARGET_POWERPC64")
8262 (const_string "16")))])
8266 (define_insn_and_split "*eqv<mode>3_internal1"
8267 [(set (match_operand:BOOL_128 0 "vlogical_operand" "=<BOOL_REGS_OUTPUT>")
8270 (match_operand:BOOL_128 1 "vlogical_operand" "<BOOL_REGS_OP1>")
8271 (match_operand:BOOL_128 2 "vlogical_operand" "<BOOL_REGS_OP2>"))))]
8274 if (vsx_register_operand (operands[0], <MODE>mode))
8275 return "xxleqv %x0,%x1,%x2";
8279 "TARGET_P8_VECTOR && reload_completed
8280 && int_reg_operand (operands[0], <MODE>mode)"
8283 rs6000_split_logical (operands, XOR, true, false, false, NULL_RTX);
8288 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
8289 (const_string "vecsimple")
8290 (const_string "integer")))
8291 (set (attr "length")
8293 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
8296 (match_test "TARGET_POWERPC64")
8298 (const_string "16"))))])
8300 (define_insn_and_split "*eqv<mode>3_internal2"
8301 [(set (match_operand:TI2 0 "int_reg_operand" "=&r,r,r")
8304 (match_operand:TI2 1 "int_reg_operand" "r,0,r")
8305 (match_operand:TI2 2 "int_reg_operand" "r,r,0"))))]
8308 "reload_completed && !TARGET_P8_VECTOR"
8311 rs6000_split_logical (operands, XOR, true, false, false, NULL_RTX);
8314 [(set_attr "type" "integer")
8315 (set (attr "length")
8317 (match_test "TARGET_POWERPC64")
8319 (const_string "16")))])
8321 ;; 128-bit one's complement
8322 (define_insn_and_split "*one_cmpl<mode>3_internal"
8323 [(set (match_operand:BOOL_128 0 "vlogical_operand" "=<BOOL_REGS_OUTPUT>")
8325 (match_operand:BOOL_128 1 "vlogical_operand" "<BOOL_REGS_UNARY>")))]
8328 if (TARGET_VSX && vsx_register_operand (operands[0], <MODE>mode))
8329 return "xxlnor %x0,%x1,%x1";
8331 if (TARGET_ALTIVEC && altivec_register_operand (operands[0], <MODE>mode))
8332 return "vnor %0,%1,%1";
8336 "reload_completed && int_reg_operand (operands[0], <MODE>mode)"
8339 rs6000_split_logical (operands, NOT, false, false, false, NULL_RTX);
8344 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
8345 (const_string "vecsimple")
8346 (const_string "integer")))
8347 (set (attr "length")
8349 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
8352 (match_test "TARGET_POWERPC64")
8354 (const_string "16"))))])
8357 ;; Now define ways of moving data around.
8359 ;; Set up a register with a value from the GOT table
8361 (define_expand "movsi_got"
8362 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8363 (unspec:SI [(match_operand:SI 1 "got_operand" "")
8364 (match_dup 2)] UNSPEC_MOVSI_GOT))]
8365 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
8368 if (GET_CODE (operands[1]) == CONST)
8370 rtx offset = const0_rtx;
8371 HOST_WIDE_INT value;
8373 operands[1] = eliminate_constant_term (XEXP (operands[1], 0), &offset);
8374 value = INTVAL (offset);
8377 rtx tmp = (!can_create_pseudo_p ()
8379 : gen_reg_rtx (Pmode));
8380 emit_insn (gen_movsi_got (tmp, operands[1]));
8381 emit_insn (gen_addsi3 (operands[0], tmp, offset));
8386 operands[2] = rs6000_got_register (operands[1]);
8389 (define_insn "*movsi_got_internal"
8390 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8391 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
8392 (match_operand:SI 2 "gpc_reg_operand" "b")]
8394 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
8395 "lwz %0,%a1@got(%2)"
8396 [(set_attr "type" "load")])
8398 ;; Used by sched, shorten_branches and final when the GOT pseudo reg
8399 ;; didn't get allocated to a hard register.
8401 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8402 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
8403 (match_operand:SI 2 "memory_operand" "")]
8405 "DEFAULT_ABI == ABI_V4
8407 && (reload_in_progress || reload_completed)"
8408 [(set (match_dup 0) (match_dup 2))
8409 (set (match_dup 0) (unspec:SI [(match_dup 1)(match_dup 0)]
8413 ;; For SI, we special-case integers that can't be loaded in one insn. We
8414 ;; do the load 16-bits at a time. We could do this by loading from memory,
8415 ;; and this is even supposed to be faster, but it is simpler not to get
8416 ;; integers in the TOC.
8417 (define_insn "movsi_low"
8418 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8419 (mem:SI (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
8420 (match_operand 2 "" ""))))]
8421 "TARGET_MACHO && ! TARGET_64BIT"
8422 "lwz %0,lo16(%2)(%1)"
8423 [(set_attr "type" "load")
8424 (set_attr "length" "4")])
8426 (define_insn "*movsi_internal1"
8427 [(set (match_operand:SI 0 "rs6000_nonimmediate_operand" "=r,r,r,m,r,r,r,r,*c*l,*h,*h")
8428 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,*h,r,r,0"))]
8429 "!TARGET_SINGLE_FPU &&
8430 (gpc_reg_operand (operands[0], SImode) || gpc_reg_operand (operands[1], SImode))"
8443 [(set_attr "type" "*,*,load,store,*,*,*,mfjmpr,mtjmpr,*,*")
8444 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4")])
8446 (define_insn "*movsi_internal1_single"
8447 [(set (match_operand:SI 0 "rs6000_nonimmediate_operand" "=r,r,r,m,r,r,r,r,*c*l,*h,*h,m,*f")
8448 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,*h,r,r,0,f,m"))]
8449 "TARGET_SINGLE_FPU &&
8450 (gpc_reg_operand (operands[0], SImode) || gpc_reg_operand (operands[1], SImode))"
8465 [(set_attr "type" "*,*,load,store,*,*,*,mfjmpr,mtjmpr,*,*,fpstore,fpload")
8466 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4,4,4")])
8468 ;; Split a load of a large constant into the appropriate two-insn
8472 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8473 (match_operand:SI 1 "const_int_operand" ""))]
8474 "(unsigned HOST_WIDE_INT) (INTVAL (operands[1]) + 0x8000) >= 0x10000
8475 && (INTVAL (operands[1]) & 0xffff) != 0"
8479 (ior:SI (match_dup 0)
8483 if (rs6000_emit_set_const (operands[0], operands[1]))
8489 (define_insn "*mov<mode>_internal2"
8490 [(set (match_operand:CC 2 "cc_reg_operand" "=y,x,?y")
8491 (compare:CC (match_operand:P 1 "gpc_reg_operand" "0,r,r")
8493 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r") (match_dup 1))]
8499 [(set_attr "type" "cmp,logical,cmp")
8500 (set_attr "dot" "yes")
8501 (set_attr "length" "4,4,8")])
8504 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
8505 (compare:CC (match_operand:P 1 "gpc_reg_operand" "")
8507 (set (match_operand:P 0 "gpc_reg_operand" "") (match_dup 1))]
8509 [(set (match_dup 0) (match_dup 1))
8511 (compare:CC (match_dup 0)
8515 (define_insn "*movhi_internal"
8516 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,m,r,r,*c*l,*h")
8517 (match_operand:HI 1 "input_operand" "r,m,r,i,*h,r,0"))]
8518 "gpc_reg_operand (operands[0], HImode)
8519 || gpc_reg_operand (operands[1], HImode)"
8528 [(set_attr "type" "*,load,store,*,mfjmpr,mtjmpr,*")])
8530 (define_expand "mov<mode>"
8531 [(set (match_operand:INT 0 "general_operand" "")
8532 (match_operand:INT 1 "any_operand" ""))]
8534 "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
8536 (define_insn "*movqi_internal"
8537 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,m,r,r,*c*l,*h")
8538 (match_operand:QI 1 "input_operand" "r,m,r,i,*h,r,0"))]
8539 "gpc_reg_operand (operands[0], QImode)
8540 || gpc_reg_operand (operands[1], QImode)"
8549 [(set_attr "type" "*,load,store,*,mfjmpr,mtjmpr,*")])
8551 ;; Here is how to move condition codes around. When we store CC data in
8552 ;; an integer register or memory, we store just the high-order 4 bits.
8553 ;; This lets us not shift in the most common case of CR0.
8554 (define_expand "movcc"
8555 [(set (match_operand:CC 0 "nonimmediate_operand" "")
8556 (match_operand:CC 1 "nonimmediate_operand" ""))]
8560 (define_insn "*movcc_internal1"
8561 [(set (match_operand:CC 0 "nonimmediate_operand" "=y,x,?y,y,r,r,r,r,r,cl,r,m")
8562 (match_operand:CC 1 "general_operand" "y,r,r,O,x,y,r,I,h,r,m,r"))]
8563 "register_operand (operands[0], CCmode)
8564 || register_operand (operands[1], CCmode)"
8568 rlwinm %1,%1,%F0,0xffffffff\;mtcrf %R0,%1\;rlwinm %1,%1,%f0,0xffffffff
8571 mfcr %0%Q1\;rlwinm %0,%0,%f1,0xf0000000
8579 (cond [(eq_attr "alternative" "0,3")
8580 (const_string "cr_logical")
8581 (eq_attr "alternative" "1,2")
8582 (const_string "mtcr")
8583 (eq_attr "alternative" "6,7")
8584 (const_string "integer")
8585 (eq_attr "alternative" "8")
8586 (const_string "mfjmpr")
8587 (eq_attr "alternative" "9")
8588 (const_string "mtjmpr")
8589 (eq_attr "alternative" "10")
8590 (const_string "load")
8591 (eq_attr "alternative" "11")
8592 (const_string "store")
8593 (match_test "TARGET_MFCRF")
8594 (const_string "mfcrf")
8596 (const_string "mfcr")))
8597 (set_attr "length" "4,4,12,4,4,8,4,4,4,4,4,4")])
8599 ;; For floating-point, we normally deal with the floating-point registers
8600 ;; unless -msoft-float is used. The sole exception is that parameter passing
8601 ;; can produce floating-point values in fixed-point registers. Unless the
8602 ;; value is a simple constant or already in memory, we deal with this by
8603 ;; allocating memory and copying the value explicitly via that memory location.
8605 ;; Move 32-bit binary/decimal floating point
8606 (define_expand "mov<mode>"
8607 [(set (match_operand:FMOVE32 0 "nonimmediate_operand" "")
8608 (match_operand:FMOVE32 1 "any_operand" ""))]
8610 "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
8613 [(set (match_operand:FMOVE32 0 "gpc_reg_operand" "")
8614 (match_operand:FMOVE32 1 "const_double_operand" ""))]
8616 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8617 || (GET_CODE (operands[0]) == SUBREG
8618 && GET_CODE (SUBREG_REG (operands[0])) == REG
8619 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8620 [(set (match_dup 2) (match_dup 3))]
8626 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8627 <real_value_to_target> (rv, l);
8629 if (! TARGET_POWERPC64)
8630 operands[2] = operand_subword (operands[0], 0, 0, <MODE>mode);
8632 operands[2] = gen_lowpart (SImode, operands[0]);
8634 operands[3] = gen_int_mode (l, SImode);
8637 (define_insn "mov<mode>_hardfloat"
8638 [(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")
8639 (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"))]
8640 "(gpc_reg_operand (operands[0], <MODE>mode)
8641 || gpc_reg_operand (operands[1], <MODE>mode))
8642 && (TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT)"
8661 [(set_attr "type" "*,load,store,fp,vecsimple,vecsimple,fpload,fpstore,fpload,fpstore,mftgpr,mffgpr,mtjmpr,mfjmpr,*,*,*")
8662 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,8")])
8664 (define_insn "*mov<mode>_softfloat"
8665 [(set (match_operand:FMOVE32 0 "nonimmediate_operand" "=r,cl,r,r,m,r,r,r,r,*h")
8666 (match_operand:FMOVE32 1 "input_operand" "r,r,h,m,r,I,L,G,Fn,0"))]
8667 "(gpc_reg_operand (operands[0], <MODE>mode)
8668 || gpc_reg_operand (operands[1], <MODE>mode))
8669 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)"
8681 [(set_attr "type" "*,mtjmpr,mfjmpr,load,store,*,*,*,*,*")
8682 (set_attr "length" "4,4,4,4,4,4,4,4,8,4")])
8685 ;; Move 64-bit binary/decimal floating point
8686 (define_expand "mov<mode>"
8687 [(set (match_operand:FMOVE64 0 "nonimmediate_operand" "")
8688 (match_operand:FMOVE64 1 "any_operand" ""))]
8690 "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
8693 [(set (match_operand:FMOVE64 0 "gpc_reg_operand" "")
8694 (match_operand:FMOVE64 1 "const_int_operand" ""))]
8695 "! TARGET_POWERPC64 && reload_completed
8696 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8697 || (GET_CODE (operands[0]) == SUBREG
8698 && GET_CODE (SUBREG_REG (operands[0])) == REG
8699 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8700 [(set (match_dup 2) (match_dup 4))
8701 (set (match_dup 3) (match_dup 1))]
8704 int endian = (WORDS_BIG_ENDIAN == 0);
8705 HOST_WIDE_INT value = INTVAL (operands[1]);
8707 operands[2] = operand_subword (operands[0], endian, 0, <MODE>mode);
8708 operands[3] = operand_subword (operands[0], 1 - endian, 0, <MODE>mode);
8709 operands[4] = GEN_INT (value >> 32);
8710 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
8714 [(set (match_operand:FMOVE64 0 "gpc_reg_operand" "")
8715 (match_operand:FMOVE64 1 "const_double_operand" ""))]
8716 "! TARGET_POWERPC64 && reload_completed
8717 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8718 || (GET_CODE (operands[0]) == SUBREG
8719 && GET_CODE (SUBREG_REG (operands[0])) == REG
8720 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8721 [(set (match_dup 2) (match_dup 4))
8722 (set (match_dup 3) (match_dup 5))]
8725 int endian = (WORDS_BIG_ENDIAN == 0);
8729 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8730 <real_value_to_target> (rv, l);
8732 operands[2] = operand_subword (operands[0], endian, 0, <MODE>mode);
8733 operands[3] = operand_subword (operands[0], 1 - endian, 0, <MODE>mode);
8734 operands[4] = gen_int_mode (l[endian], SImode);
8735 operands[5] = gen_int_mode (l[1 - endian], SImode);
8739 [(set (match_operand:FMOVE64 0 "gpc_reg_operand" "")
8740 (match_operand:FMOVE64 1 "const_double_operand" ""))]
8741 "TARGET_POWERPC64 && reload_completed
8742 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8743 || (GET_CODE (operands[0]) == SUBREG
8744 && GET_CODE (SUBREG_REG (operands[0])) == REG
8745 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8746 [(set (match_dup 2) (match_dup 3))]
8749 int endian = (WORDS_BIG_ENDIAN == 0);
8754 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8755 <real_value_to_target> (rv, l);
8757 operands[2] = gen_lowpart (DImode, operands[0]);
8758 /* HIGHPART is lower memory address when WORDS_BIG_ENDIAN. */
8759 val = ((HOST_WIDE_INT)(unsigned long)l[endian] << 32
8760 | ((HOST_WIDE_INT)(unsigned long)l[1 - endian]));
8762 operands[3] = gen_int_mode (val, DImode);
8765 ;; Don't have reload use general registers to load a constant. It is
8766 ;; less efficient than loading the constant into an FP register, since
8767 ;; it will probably be used there.
8769 ;; The move constraints are ordered to prefer floating point registers before
8770 ;; general purpose registers to avoid doing a store and a load to get the value
8771 ;; into a floating point register when it is needed for a floating point
8772 ;; operation. Prefer traditional floating point registers over VSX registers,
8773 ;; since the D-form version of the memory instructions does not need a GPR for
8776 (define_insn "*mov<mode>_hardfloat32"
8777 [(set (match_operand:FMOVE64 0 "nonimmediate_operand" "=m,d,d,wv,Z,wa,wa,Y,r,!r,!r,!r,!r")
8778 (match_operand:FMOVE64 1 "input_operand" "d,m,d,Z,wv,wa,j,r,Y,r,G,H,F"))]
8779 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
8780 && (gpc_reg_operand (operands[0], <MODE>mode)
8781 || gpc_reg_operand (operands[1], <MODE>mode))"
8796 [(set_attr "type" "fpstore,fpload,fp,fpload,fpstore,vecsimple,vecsimple,store,load,two,fp,fp,*")
8797 (set_attr "length" "4,4,4,4,4,4,4,8,8,8,8,12,16")])
8799 (define_insn "*mov<mode>_softfloat32"
8800 [(set (match_operand:FMOVE64 0 "nonimmediate_operand" "=Y,r,r,r,r,r")
8801 (match_operand:FMOVE64 1 "input_operand" "r,Y,r,G,H,F"))]
8803 && ((TARGET_FPRS && TARGET_SINGLE_FLOAT)
8804 || TARGET_SOFT_FLOAT || TARGET_E500_SINGLE
8805 || (<MODE>mode == DDmode && TARGET_E500_DOUBLE))
8806 && (gpc_reg_operand (operands[0], <MODE>mode)
8807 || gpc_reg_operand (operands[1], <MODE>mode))"
8809 [(set_attr "type" "store,load,two,*,*,*")
8810 (set_attr "length" "8,8,8,8,12,16")])
8812 ; ld/std require word-aligned displacements -> 'Y' constraint.
8813 ; List Y->r and r->Y before r->r for reload.
8814 (define_insn "*mov<mode>_hardfloat64"
8815 [(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,wk")
8816 (match_operand:FMOVE64 1 "input_operand" "d,m,d,Z,wv,wa,j,r,Y,r,r,h,0,G,H,F,wg,r,wk,r"))]
8817 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
8818 && (gpc_reg_operand (operands[0], <MODE>mode)
8819 || gpc_reg_operand (operands[1], <MODE>mode))"
8841 [(set_attr "type" "fpstore,fpload,fp,fpload,fpstore,vecsimple,vecsimple,store,load,*,mtjmpr,mfjmpr,*,*,*,*,mftgpr,mffgpr,mftgpr,mffgpr")
8842 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4,4,8,12,16,4,4,4,4")])
8844 (define_insn "*mov<mode>_softfloat64"
8845 [(set (match_operand:FMOVE64 0 "nonimmediate_operand" "=Y,r,r,cl,r,r,r,r,*h")
8846 (match_operand:FMOVE64 1 "input_operand" "r,Y,r,r,h,G,H,F,0"))]
8847 "TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)
8848 && (gpc_reg_operand (operands[0], <MODE>mode)
8849 || gpc_reg_operand (operands[1], <MODE>mode))"
8860 [(set_attr "type" "store,load,*,mtjmpr,mfjmpr,*,*,*,*")
8861 (set_attr "length" "4,4,4,4,4,8,12,16,4")])
8863 (define_expand "mov<mode>"
8864 [(set (match_operand:FMOVE128 0 "general_operand" "")
8865 (match_operand:FMOVE128 1 "any_operand" ""))]
8867 "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
8869 ;; It's important to list Y->r and r->Y before r->r because otherwise
8870 ;; reload, given m->r, will try to pick r->r and reload it, which
8871 ;; doesn't make progress.
8873 ;; We can't split little endian direct moves of TDmode, because the words are
8874 ;; not swapped like they are for TImode or TFmode. Subregs therefore are
8875 ;; problematical. Don't allow direct move for this case.
8877 (define_insn_and_split "*mov<mode>_64bit_dm"
8878 [(set (match_operand:FMOVE128 0 "nonimmediate_operand" "=m,d,d,Y,r,r,r,wm")
8879 (match_operand:FMOVE128 1 "input_operand" "d,m,d,r,YGHF,r,wm,r"))]
8880 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_POWERPC64
8881 && (<MODE>mode != TDmode || WORDS_BIG_ENDIAN)
8882 && (gpc_reg_operand (operands[0], <MODE>mode)
8883 || gpc_reg_operand (operands[1], <MODE>mode))"
8885 "&& reload_completed"
8887 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
8888 [(set_attr "length" "8,8,8,12,12,8,8,8")])
8890 (define_insn_and_split "*movtd_64bit_nodm"
8891 [(set (match_operand:TD 0 "nonimmediate_operand" "=m,d,d,Y,r,r")
8892 (match_operand:TD 1 "input_operand" "d,m,d,r,YGHF,r"))]
8893 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_POWERPC64 && !WORDS_BIG_ENDIAN
8894 && (gpc_reg_operand (operands[0], TDmode)
8895 || gpc_reg_operand (operands[1], TDmode))"
8897 "&& reload_completed"
8899 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
8900 [(set_attr "length" "8,8,8,12,12,8")])
8902 (define_insn_and_split "*mov<mode>_32bit"
8903 [(set (match_operand:FMOVE128 0 "nonimmediate_operand" "=m,d,d,Y,r,r")
8904 (match_operand:FMOVE128 1 "input_operand" "d,m,d,r,YGHF,r"))]
8905 "TARGET_HARD_FLOAT && TARGET_FPRS && !TARGET_POWERPC64
8906 && (gpc_reg_operand (operands[0], <MODE>mode)
8907 || gpc_reg_operand (operands[1], <MODE>mode))"
8909 "&& reload_completed"
8911 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
8912 [(set_attr "length" "8,8,8,20,20,16")])
8914 (define_insn_and_split "*mov<mode>_softfloat"
8915 [(set (match_operand:FMOVE128 0 "rs6000_nonimmediate_operand" "=Y,r,r")
8916 (match_operand:FMOVE128 1 "input_operand" "r,YGHF,r"))]
8917 "(TARGET_SOFT_FLOAT || !TARGET_FPRS)
8918 && (gpc_reg_operand (operands[0], <MODE>mode)
8919 || gpc_reg_operand (operands[1], <MODE>mode))"
8921 "&& reload_completed"
8923 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
8924 [(set_attr "length" "20,20,16")])
8926 (define_expand "extenddftf2"
8927 [(set (match_operand:TF 0 "nonimmediate_operand" "")
8928 (float_extend:TF (match_operand:DF 1 "input_operand" "")))]
8930 && TARGET_HARD_FLOAT
8931 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8932 && TARGET_LONG_DOUBLE_128"
8934 if (TARGET_E500_DOUBLE)
8935 emit_insn (gen_spe_extenddftf2 (operands[0], operands[1]));
8937 emit_insn (gen_extenddftf2_fprs (operands[0], operands[1]));
8941 (define_expand "extenddftf2_fprs"
8942 [(parallel [(set (match_operand:TF 0 "nonimmediate_operand" "")
8943 (float_extend:TF (match_operand:DF 1 "input_operand" "")))
8944 (use (match_dup 2))])]
8946 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
8947 && TARGET_LONG_DOUBLE_128"
8949 operands[2] = CONST0_RTX (DFmode);
8950 /* Generate GOT reference early for SVR4 PIC. */
8951 if (DEFAULT_ABI == ABI_V4 && flag_pic)
8952 operands[2] = validize_mem (force_const_mem (DFmode, operands[2]));
8955 (define_insn_and_split "*extenddftf2_internal"
8956 [(set (match_operand:TF 0 "nonimmediate_operand" "=m,Y,d,&d,r")
8957 (float_extend:TF (match_operand:DF 1 "input_operand" "d,r,md,md,rmGHF")))
8958 (use (match_operand:DF 2 "zero_reg_mem_operand" "d,r,m,d,n"))]
8960 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
8961 && TARGET_LONG_DOUBLE_128"
8963 "&& reload_completed"
8966 const int lo_word = LONG_DOUBLE_LARGE_FIRST ? GET_MODE_SIZE (DFmode) : 0;
8967 const int hi_word = LONG_DOUBLE_LARGE_FIRST ? 0 : GET_MODE_SIZE (DFmode);
8968 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word),
8970 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word),
8975 (define_expand "extendsftf2"
8976 [(set (match_operand:TF 0 "nonimmediate_operand" "")
8977 (float_extend:TF (match_operand:SF 1 "gpc_reg_operand" "")))]
8979 && TARGET_HARD_FLOAT
8980 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8981 && TARGET_LONG_DOUBLE_128"
8983 rtx tmp = gen_reg_rtx (DFmode);
8984 emit_insn (gen_extendsfdf2 (tmp, operands[1]));
8985 emit_insn (gen_extenddftf2 (operands[0], tmp));
8989 (define_expand "trunctfdf2"
8990 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8991 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "")))]
8993 && TARGET_HARD_FLOAT
8994 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8995 && TARGET_LONG_DOUBLE_128"
8998 (define_insn_and_split "trunctfdf2_internal1"
8999 [(set (match_operand:DF 0 "gpc_reg_operand" "=d,?d")
9000 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "0,d")))]
9001 "!TARGET_IEEEQUAD && !TARGET_XL_COMPAT
9002 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9006 "&& reload_completed && REGNO (operands[0]) == REGNO (operands[1])"
9009 emit_note (NOTE_INSN_DELETED);
9012 [(set_attr "type" "fp")])
9014 (define_insn "trunctfdf2_internal2"
9015 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
9016 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "d")))]
9017 "!TARGET_IEEEQUAD && TARGET_XL_COMPAT
9018 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9019 && TARGET_LONG_DOUBLE_128"
9021 [(set_attr "type" "fp")
9022 (set_attr "fp_type" "fp_addsub_d")])
9024 (define_expand "trunctfsf2"
9025 [(set (match_operand:SF 0 "gpc_reg_operand" "")
9026 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "")))]
9028 && TARGET_HARD_FLOAT
9029 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9030 && TARGET_LONG_DOUBLE_128"
9032 if (TARGET_E500_DOUBLE)
9033 emit_insn (gen_spe_trunctfsf2 (operands[0], operands[1]));
9035 emit_insn (gen_trunctfsf2_fprs (operands[0], operands[1]));
9039 (define_insn_and_split "trunctfsf2_fprs"
9040 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
9041 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "d")))
9042 (clobber (match_scratch:DF 2 "=d"))]
9044 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
9045 && TARGET_LONG_DOUBLE_128"
9047 "&& reload_completed"
9049 (float_truncate:DF (match_dup 1)))
9051 (float_truncate:SF (match_dup 2)))]
9054 (define_expand "floatsitf2"
9055 [(set (match_operand:TF 0 "gpc_reg_operand" "")
9056 (float:TF (match_operand:SI 1 "gpc_reg_operand" "")))]
9058 && TARGET_HARD_FLOAT
9059 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9060 && TARGET_LONG_DOUBLE_128"
9062 rtx tmp = gen_reg_rtx (DFmode);
9063 expand_float (tmp, operands[1], false);
9064 emit_insn (gen_extenddftf2 (operands[0], tmp));
9068 ; fadd, but rounding towards zero.
9069 ; This is probably not the optimal code sequence.
9070 (define_insn "fix_trunc_helper"
9071 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
9072 (unspec:DF [(match_operand:TF 1 "gpc_reg_operand" "d")]
9073 UNSPEC_FIX_TRUNC_TF))
9074 (clobber (match_operand:DF 2 "gpc_reg_operand" "=&d"))]
9075 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
9076 "mffs %2\n\tmtfsb1 31\n\tmtfsb0 30\n\tfadd %0,%1,%L1\n\tmtfsf 1,%2"
9077 [(set_attr "type" "fp")
9078 (set_attr "length" "20")])
9080 (define_expand "fix_trunctfsi2"
9081 [(set (match_operand:SI 0 "gpc_reg_operand" "")
9082 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))]
9083 "!TARGET_IEEEQUAD && TARGET_HARD_FLOAT
9084 && (TARGET_FPRS || TARGET_E500_DOUBLE) && TARGET_LONG_DOUBLE_128"
9086 if (TARGET_E500_DOUBLE)
9087 emit_insn (gen_spe_fix_trunctfsi2 (operands[0], operands[1]));
9089 emit_insn (gen_fix_trunctfsi2_fprs (operands[0], operands[1]));
9093 (define_expand "fix_trunctfsi2_fprs"
9094 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
9095 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))
9096 (clobber (match_dup 2))
9097 (clobber (match_dup 3))
9098 (clobber (match_dup 4))
9099 (clobber (match_dup 5))])]
9101 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9103 operands[2] = gen_reg_rtx (DFmode);
9104 operands[3] = gen_reg_rtx (DFmode);
9105 operands[4] = gen_reg_rtx (DImode);
9106 operands[5] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode));
9109 (define_insn_and_split "*fix_trunctfsi2_internal"
9110 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9111 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "d")))
9112 (clobber (match_operand:DF 2 "gpc_reg_operand" "=d"))
9113 (clobber (match_operand:DF 3 "gpc_reg_operand" "=&d"))
9114 (clobber (match_operand:DI 4 "gpc_reg_operand" "=d"))
9115 (clobber (match_operand:DI 5 "offsettable_mem_operand" "=o"))]
9117 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9123 emit_insn (gen_fix_trunc_helper (operands[2], operands[1], operands[3]));
9125 gcc_assert (MEM_P (operands[5]));
9126 lowword = adjust_address (operands[5], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
9128 emit_insn (gen_fctiwz_df (operands[4], operands[2]));
9129 emit_move_insn (operands[5], operands[4]);
9130 emit_move_insn (operands[0], lowword);
9134 (define_expand "negtf2"
9135 [(set (match_operand:TF 0 "gpc_reg_operand" "")
9136 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "")))]
9138 && TARGET_HARD_FLOAT
9139 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9140 && TARGET_LONG_DOUBLE_128"
9143 (define_insn "negtf2_internal"
9144 [(set (match_operand:TF 0 "gpc_reg_operand" "=d")
9145 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "d")))]
9147 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9150 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
9151 return \"fneg %L0,%L1\;fneg %0,%1\";
9153 return \"fneg %0,%1\;fneg %L0,%L1\";
9155 [(set_attr "type" "fp")
9156 (set_attr "length" "8")])
9158 (define_expand "abstf2"
9159 [(set (match_operand:TF 0 "gpc_reg_operand" "")
9160 (abs:TF (match_operand:TF 1 "gpc_reg_operand" "")))]
9162 && TARGET_HARD_FLOAT
9163 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9164 && TARGET_LONG_DOUBLE_128"
9167 rtx label = gen_label_rtx ();
9168 if (TARGET_E500_DOUBLE)
9170 if (flag_finite_math_only && !flag_trapping_math)
9171 emit_insn (gen_spe_abstf2_tst (operands[0], operands[1], label));
9173 emit_insn (gen_spe_abstf2_cmp (operands[0], operands[1], label));
9176 emit_insn (gen_abstf2_internal (operands[0], operands[1], label));
9181 (define_expand "abstf2_internal"
9182 [(set (match_operand:TF 0 "gpc_reg_operand" "")
9183 (match_operand:TF 1 "gpc_reg_operand" ""))
9184 (set (match_dup 3) (match_dup 5))
9185 (set (match_dup 5) (abs:DF (match_dup 5)))
9186 (set (match_dup 4) (compare:CCFP (match_dup 3) (match_dup 5)))
9187 (set (pc) (if_then_else (eq (match_dup 4) (const_int 0))
9188 (label_ref (match_operand 2 "" ""))
9190 (set (match_dup 6) (neg:DF (match_dup 6)))]
9192 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9193 && TARGET_LONG_DOUBLE_128"
9196 const int hi_word = LONG_DOUBLE_LARGE_FIRST ? 0 : GET_MODE_SIZE (DFmode);
9197 const int lo_word = LONG_DOUBLE_LARGE_FIRST ? GET_MODE_SIZE (DFmode) : 0;
9198 operands[3] = gen_reg_rtx (DFmode);
9199 operands[4] = gen_reg_rtx (CCFPmode);
9200 operands[5] = simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word);
9201 operands[6] = simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word);
9204 ;; Reload helper functions used by rs6000_secondary_reload. The patterns all
9205 ;; must have 3 arguments, and scratch register constraint must be a single
9208 ;; Reload patterns to support gpr load/store with misaligned mem.
9209 ;; and multiple gpr load/store at offset >= 0xfffc
9210 (define_expand "reload_<mode>_store"
9211 [(parallel [(match_operand 0 "memory_operand" "=m")
9212 (match_operand 1 "gpc_reg_operand" "r")
9213 (match_operand:GPR 2 "register_operand" "=&b")])]
9216 rs6000_secondary_reload_gpr (operands[1], operands[0], operands[2], true);
9220 (define_expand "reload_<mode>_load"
9221 [(parallel [(match_operand 0 "gpc_reg_operand" "=r")
9222 (match_operand 1 "memory_operand" "m")
9223 (match_operand:GPR 2 "register_operand" "=b")])]
9226 rs6000_secondary_reload_gpr (operands[0], operands[1], operands[2], false);
9231 ;; Power8 merge instructions to allow direct move to/from floating point
9232 ;; registers in 32-bit mode. We use TF mode to get two registers to move the
9233 ;; individual 32-bit parts across. Subreg doesn't work too well on the TF
9234 ;; value, since it is allocated in reload and not all of the flow information
9235 ;; is setup for it. We have two patterns to do the two moves between gprs and
9236 ;; fprs. There isn't a dependancy between the two, but we could potentially
9237 ;; schedule other instructions between the two instructions. TFmode is
9238 ;; currently limited to traditional FPR registers. If/when this is changed, we
9239 ;; will need to revist %L to make sure it works with VSX registers, or add an
9240 ;; %x version of %L.
9242 (define_insn "p8_fmrgow_<mode>"
9243 [(set (match_operand:FMOVE64X 0 "register_operand" "=d")
9244 (unspec:FMOVE64X [(match_operand:TF 1 "register_operand" "d")]
9245 UNSPEC_P8V_FMRGOW))]
9246 "!TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9248 [(set_attr "type" "vecperm")])
9250 (define_insn "p8_mtvsrwz_1"
9251 [(set (match_operand:TF 0 "register_operand" "=d")
9252 (unspec:TF [(match_operand:SI 1 "register_operand" "r")]
9253 UNSPEC_P8V_MTVSRWZ))]
9254 "!TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9256 [(set_attr "type" "mftgpr")])
9258 (define_insn "p8_mtvsrwz_2"
9259 [(set (match_operand:TF 0 "register_operand" "+d")
9260 (unspec:TF [(match_dup 0)
9261 (match_operand:SI 1 "register_operand" "r")]
9262 UNSPEC_P8V_MTVSRWZ))]
9263 "!TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9265 [(set_attr "type" "mftgpr")])
9267 (define_insn_and_split "reload_fpr_from_gpr<mode>"
9268 [(set (match_operand:FMOVE64X 0 "register_operand" "=ws")
9269 (unspec:FMOVE64X [(match_operand:FMOVE64X 1 "register_operand" "r")]
9270 UNSPEC_P8V_RELOAD_FROM_GPR))
9271 (clobber (match_operand:TF 2 "register_operand" "=d"))]
9272 "!TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9274 "&& reload_completed"
9277 rtx dest = operands[0];
9278 rtx src = operands[1];
9279 rtx tmp = operands[2];
9280 rtx gpr_hi_reg = gen_highpart (SImode, src);
9281 rtx gpr_lo_reg = gen_lowpart (SImode, src);
9283 emit_insn (gen_p8_mtvsrwz_1 (tmp, gpr_hi_reg));
9284 emit_insn (gen_p8_mtvsrwz_2 (tmp, gpr_lo_reg));
9285 emit_insn (gen_p8_fmrgow_<mode> (dest, tmp));
9288 [(set_attr "length" "12")
9289 (set_attr "type" "three")])
9291 ;; Move 128 bit values from GPRs to VSX registers in 64-bit mode
9292 (define_insn "p8_mtvsrd_1"
9293 [(set (match_operand:TF 0 "register_operand" "=ws")
9294 (unspec:TF [(match_operand:DI 1 "register_operand" "r")]
9295 UNSPEC_P8V_MTVSRD))]
9296 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9298 [(set_attr "type" "mftgpr")])
9300 (define_insn "p8_mtvsrd_2"
9301 [(set (match_operand:TF 0 "register_operand" "+ws")
9302 (unspec:TF [(match_dup 0)
9303 (match_operand:DI 1 "register_operand" "r")]
9304 UNSPEC_P8V_MTVSRD))]
9305 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9307 [(set_attr "type" "mftgpr")])
9309 (define_insn "p8_xxpermdi_<mode>"
9310 [(set (match_operand:FMOVE128_GPR 0 "register_operand" "=wa")
9311 (unspec:FMOVE128_GPR [(match_operand:TF 1 "register_operand" "ws")]
9312 UNSPEC_P8V_XXPERMDI))]
9313 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9314 "xxpermdi %x0,%1,%L1,0"
9315 [(set_attr "type" "vecperm")])
9317 (define_insn_and_split "reload_vsx_from_gpr<mode>"
9318 [(set (match_operand:FMOVE128_GPR 0 "register_operand" "=wa")
9319 (unspec:FMOVE128_GPR
9320 [(match_operand:FMOVE128_GPR 1 "register_operand" "r")]
9321 UNSPEC_P8V_RELOAD_FROM_GPR))
9322 (clobber (match_operand:TF 2 "register_operand" "=ws"))]
9323 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9325 "&& reload_completed"
9328 rtx dest = operands[0];
9329 rtx src = operands[1];
9330 rtx tmp = operands[2];
9331 rtx gpr_hi_reg = gen_highpart (DImode, src);
9332 rtx gpr_lo_reg = gen_lowpart (DImode, src);
9334 emit_insn (gen_p8_mtvsrd_1 (tmp, gpr_hi_reg));
9335 emit_insn (gen_p8_mtvsrd_2 (tmp, gpr_lo_reg));
9336 emit_insn (gen_p8_xxpermdi_<mode> (dest, tmp));
9338 [(set_attr "length" "12")
9339 (set_attr "type" "three")])
9342 [(set (match_operand:FMOVE128_GPR 0 "nonimmediate_operand" "")
9343 (match_operand:FMOVE128_GPR 1 "input_operand" ""))]
9345 && (int_reg_operand (operands[0], <MODE>mode)
9346 || int_reg_operand (operands[1], <MODE>mode))"
9348 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
9350 ;; Move SFmode to a VSX from a GPR register. Because scalar floating point
9351 ;; type is stored internally as double precision in the VSX registers, we have
9352 ;; to convert it from the vector format.
9354 (define_insn_and_split "reload_vsx_from_gprsf"
9355 [(set (match_operand:SF 0 "register_operand" "=wa")
9356 (unspec:SF [(match_operand:SF 1 "register_operand" "r")]
9357 UNSPEC_P8V_RELOAD_FROM_GPR))
9358 (clobber (match_operand:DI 2 "register_operand" "=r"))]
9359 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9361 "&& reload_completed"
9364 rtx op0 = operands[0];
9365 rtx op1 = operands[1];
9366 rtx op2 = operands[2];
9367 /* Also use the destination register to hold the unconverted DImode value.
9368 This is conceptually a separate value from OP0, so we use gen_rtx_REG
9369 rather than simplify_gen_subreg. */
9370 rtx op0_di = gen_rtx_REG (DImode, REGNO (op0));
9371 rtx op1_di = simplify_gen_subreg (DImode, op1, SFmode, 0);
9373 /* Move SF value to upper 32-bits for xscvspdpn. */
9374 emit_insn (gen_ashldi3 (op2, op1_di, GEN_INT (32)));
9375 emit_move_insn (op0_di, op2);
9376 emit_insn (gen_vsx_xscvspdpn_directmove (op0, op0_di));
9379 [(set_attr "length" "8")
9380 (set_attr "type" "two")])
9382 ;; Move 128 bit values from VSX registers to GPRs in 64-bit mode by doing a
9383 ;; normal 64-bit move, followed by an xxpermdi to get the bottom 64-bit value,
9384 ;; and then doing a move of that.
9385 (define_insn "p8_mfvsrd_3_<mode>"
9386 [(set (match_operand:DF 0 "register_operand" "=r")
9387 (unspec:DF [(match_operand:FMOVE128_GPR 1 "register_operand" "wa")]
9388 UNSPEC_P8V_RELOAD_FROM_VSX))]
9389 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9391 [(set_attr "type" "mftgpr")])
9393 (define_insn_and_split "reload_gpr_from_vsx<mode>"
9394 [(set (match_operand:FMOVE128_GPR 0 "register_operand" "=r")
9395 (unspec:FMOVE128_GPR
9396 [(match_operand:FMOVE128_GPR 1 "register_operand" "wa")]
9397 UNSPEC_P8V_RELOAD_FROM_VSX))
9398 (clobber (match_operand:FMOVE128_GPR 2 "register_operand" "=wa"))]
9399 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9401 "&& reload_completed"
9404 rtx dest = operands[0];
9405 rtx src = operands[1];
9406 rtx tmp = operands[2];
9407 rtx gpr_hi_reg = gen_highpart (DFmode, dest);
9408 rtx gpr_lo_reg = gen_lowpart (DFmode, dest);
9410 emit_insn (gen_p8_mfvsrd_3_<mode> (gpr_hi_reg, src));
9411 emit_insn (gen_vsx_xxpermdi_<mode> (tmp, src, src, GEN_INT (3)));
9412 emit_insn (gen_p8_mfvsrd_3_<mode> (gpr_lo_reg, tmp));
9414 [(set_attr "length" "12")
9415 (set_attr "type" "three")])
9417 ;; Move SFmode to a GPR from a VSX register. Because scalar floating point
9418 ;; type is stored internally as double precision, we have to convert it to the
9421 (define_insn_and_split "reload_gpr_from_vsxsf"
9422 [(set (match_operand:SF 0 "register_operand" "=r")
9423 (unspec:SF [(match_operand:SF 1 "register_operand" "wa")]
9424 UNSPEC_P8V_RELOAD_FROM_VSX))
9425 (clobber (match_operand:V4SF 2 "register_operand" "=wa"))]
9426 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9428 "&& reload_completed"
9431 rtx op0 = operands[0];
9432 rtx op1 = operands[1];
9433 rtx op2 = operands[2];
9434 rtx diop0 = simplify_gen_subreg (DImode, op0, SFmode, 0);
9436 emit_insn (gen_vsx_xscvdpspn_scalar (op2, op1));
9437 emit_insn (gen_p8_mfvsrd_4_disf (diop0, op2));
9438 emit_insn (gen_lshrdi3 (diop0, diop0, GEN_INT (32)));
9441 [(set_attr "length" "12")
9442 (set_attr "type" "three")])
9444 (define_insn "p8_mfvsrd_4_disf"
9445 [(set (match_operand:DI 0 "register_operand" "=r")
9446 (unspec:DI [(match_operand:V4SF 1 "register_operand" "wa")]
9447 UNSPEC_P8V_RELOAD_FROM_VSX))]
9448 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9450 [(set_attr "type" "mftgpr")])
9453 ;; Next come the multi-word integer load and store and the load and store
9456 ;; List r->r after r->Y, otherwise reload will try to reload a
9457 ;; non-offsettable address by using r->r which won't make progress.
9458 ;; Use of fprs is disparaged slightly otherwise reload prefers to reload
9459 ;; a gpr into a fpr instead of reloading an invalid 'Y' address
9460 (define_insn "*movdi_internal32"
9461 [(set (match_operand:DI 0 "rs6000_nonimmediate_operand" "=Y,r,r,?m,?*d,?*d,r")
9462 (match_operand:DI 1 "input_operand" "r,Y,r,d,m,d,IJKnGHF"))]
9464 && (gpc_reg_operand (operands[0], DImode)
9465 || gpc_reg_operand (operands[1], DImode))"
9474 [(set_attr "type" "store,load,*,fpstore,fpload,fp,*")])
9477 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9478 (match_operand:DI 1 "const_int_operand" ""))]
9479 "! TARGET_POWERPC64 && reload_completed
9480 && gpr_or_gpr_p (operands[0], operands[1])
9481 && !direct_move_p (operands[0], operands[1])"
9482 [(set (match_dup 2) (match_dup 4))
9483 (set (match_dup 3) (match_dup 1))]
9486 HOST_WIDE_INT value = INTVAL (operands[1]);
9487 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
9489 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
9491 operands[4] = GEN_INT (value >> 32);
9492 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
9496 [(set (match_operand:DIFD 0 "rs6000_nonimmediate_operand" "")
9497 (match_operand:DIFD 1 "input_operand" ""))]
9498 "reload_completed && !TARGET_POWERPC64
9499 && gpr_or_gpr_p (operands[0], operands[1])
9500 && !direct_move_p (operands[0], operands[1])"
9502 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
9504 (define_insn "*movdi_internal64"
9505 [(set (match_operand:DI 0 "nonimmediate_operand" "=Y,r,r,r,r,r,?m,?*d,?*d,r,*h,*h,r,?*wg,r,?*wj,?*wi")
9506 (match_operand:DI 1 "input_operand" "r,Y,r,I,L,nF,d,m,d,*h,r,0,*wg,r,*wj,r,O"))]
9508 && (gpc_reg_operand (operands[0], DImode)
9509 || gpc_reg_operand (operands[1], DImode))"
9528 [(set_attr "type" "store,load,*,*,*,*,fpstore,fpload,fp,mfjmpr,mtjmpr,*,mftgpr,mffgpr,mftgpr,mffgpr,vecsimple")
9529 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4,4,4,4,4")])
9531 ;; Generate all one-bits and clear left or right.
9532 ;; Use (and:DI (rotate:DI ...)) to avoid anddi3 unnecessary clobber.
9534 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9535 (match_operand:DI 1 "mask64_operand" ""))]
9536 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
9537 [(set (match_dup 0) (const_int -1))
9539 (and:DI (rotate:DI (match_dup 0)
9544 ;; Split a load of a large constant into the appropriate five-instruction
9545 ;; sequence. Handle anything in a constant number of insns.
9546 ;; When non-easy constants can go in the TOC, this should use
9547 ;; easy_fp_constant predicate.
9549 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9550 (match_operand:DI 1 "const_int_operand" ""))]
9551 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
9552 [(set (match_dup 0) (match_dup 2))
9553 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
9556 if (rs6000_emit_set_const (operands[0], operands[1]))
9563 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9564 (match_operand:DI 1 "const_scalar_int_operand" ""))]
9565 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
9566 [(set (match_dup 0) (match_dup 2))
9567 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
9570 if (rs6000_emit_set_const (operands[0], operands[1]))
9576 ;; TImode/PTImode is similar, except that we usually want to compute the
9577 ;; address into a register and use lsi/stsi (the exception is during reload).
9579 (define_insn "*mov<mode>_string"
9580 [(set (match_operand:TI2 0 "reg_or_mem_operand" "=Q,Y,????r,????r,????r,r")
9581 (match_operand:TI2 1 "input_operand" "r,r,Q,Y,r,n"))]
9583 && (<MODE>mode != TImode || VECTOR_MEM_NONE_P (TImode))
9584 && (gpc_reg_operand (operands[0], <MODE>mode)
9585 || gpc_reg_operand (operands[1], <MODE>mode))"
9588 switch (which_alternative)
9594 return \"stswi %1,%P0,16\";
9598 /* If the address is not used in the output, we can use lsi. Otherwise,
9599 fall through to generating four loads. */
9601 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
9602 return \"lswi %0,%P1,16\";
9603 /* ... fall through ... */
9610 [(set_attr "type" "store,store,load,load,*,*")
9611 (set_attr "update" "yes")
9612 (set_attr "indexed" "yes")
9613 (set (attr "cell_micro") (if_then_else (match_test "TARGET_STRING")
9614 (const_string "always")
9615 (const_string "conditional")))])
9617 (define_insn "*mov<mode>_ppc64"
9618 [(set (match_operand:TI2 0 "nonimmediate_operand" "=wQ,Y,r,r,r,r")
9619 (match_operand:TI2 1 "input_operand" "r,r,wQ,Y,r,n"))]
9620 "(TARGET_POWERPC64 && VECTOR_MEM_NONE_P (<MODE>mode)
9621 && (gpc_reg_operand (operands[0], <MODE>mode)
9622 || gpc_reg_operand (operands[1], <MODE>mode)))"
9624 return rs6000_output_move_128bit (operands);
9626 [(set_attr "type" "store,store,load,load,*,*")
9627 (set_attr "length" "8")])
9630 [(set (match_operand:TI2 0 "int_reg_operand" "")
9631 (match_operand:TI2 1 "const_scalar_int_operand" ""))]
9633 && (VECTOR_MEM_NONE_P (<MODE>mode)
9634 || (reload_completed && INT_REGNO_P (REGNO (operands[0]))))"
9635 [(set (match_dup 2) (match_dup 4))
9636 (set (match_dup 3) (match_dup 5))]
9639 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
9641 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
9643 if (CONST_WIDE_INT_P (operands[1]))
9645 operands[4] = GEN_INT (CONST_WIDE_INT_ELT (operands[1], 1));
9646 operands[5] = GEN_INT (CONST_WIDE_INT_ELT (operands[1], 0));
9648 else if (CONST_INT_P (operands[1]))
9650 operands[4] = GEN_INT (- (INTVAL (operands[1]) < 0));
9651 operands[5] = operands[1];
9658 [(set (match_operand:TI2 0 "nonimmediate_operand" "")
9659 (match_operand:TI2 1 "input_operand" ""))]
9661 && gpr_or_gpr_p (operands[0], operands[1])
9662 && !direct_move_p (operands[0], operands[1])
9663 && !quad_load_store_p (operands[0], operands[1])"
9665 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
9667 (define_expand "load_multiple"
9668 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
9669 (match_operand:SI 1 "" ""))
9670 (use (match_operand:SI 2 "" ""))])]
9671 "TARGET_STRING && !TARGET_POWERPC64"
9679 /* Support only loading a constant number of fixed-point registers from
9680 memory and only bother with this if more than two; the machine
9681 doesn't support more than eight. */
9682 if (GET_CODE (operands[2]) != CONST_INT
9683 || INTVAL (operands[2]) <= 2
9684 || INTVAL (operands[2]) > 8
9685 || GET_CODE (operands[1]) != MEM
9686 || GET_CODE (operands[0]) != REG
9687 || REGNO (operands[0]) >= 32)
9690 count = INTVAL (operands[2]);
9691 regno = REGNO (operands[0]);
9693 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
9694 op1 = replace_equiv_address (operands[1],
9695 force_reg (SImode, XEXP (operands[1], 0)));
9697 for (i = 0; i < count; i++)
9698 XVECEXP (operands[3], 0, i)
9699 = gen_rtx_SET (VOIDmode, gen_rtx_REG (SImode, regno + i),
9700 adjust_address_nv (op1, SImode, i * 4));
9703 (define_insn "*ldmsi8"
9704 [(match_parallel 0 "load_multiple_operation"
9705 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9706 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9707 (set (match_operand:SI 3 "gpc_reg_operand" "")
9708 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9709 (set (match_operand:SI 4 "gpc_reg_operand" "")
9710 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9711 (set (match_operand:SI 5 "gpc_reg_operand" "")
9712 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
9713 (set (match_operand:SI 6 "gpc_reg_operand" "")
9714 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
9715 (set (match_operand:SI 7 "gpc_reg_operand" "")
9716 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
9717 (set (match_operand:SI 8 "gpc_reg_operand" "")
9718 (mem:SI (plus:SI (match_dup 1) (const_int 24))))
9719 (set (match_operand:SI 9 "gpc_reg_operand" "")
9720 (mem:SI (plus:SI (match_dup 1) (const_int 28))))])]
9721 "TARGET_STRING && XVECLEN (operands[0], 0) == 8"
9723 { return rs6000_output_load_multiple (operands); }"
9724 [(set_attr "type" "load")
9725 (set_attr "update" "yes")
9726 (set_attr "indexed" "yes")
9727 (set_attr "length" "32")])
9729 (define_insn "*ldmsi7"
9730 [(match_parallel 0 "load_multiple_operation"
9731 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9732 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9733 (set (match_operand:SI 3 "gpc_reg_operand" "")
9734 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9735 (set (match_operand:SI 4 "gpc_reg_operand" "")
9736 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9737 (set (match_operand:SI 5 "gpc_reg_operand" "")
9738 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
9739 (set (match_operand:SI 6 "gpc_reg_operand" "")
9740 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
9741 (set (match_operand:SI 7 "gpc_reg_operand" "")
9742 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
9743 (set (match_operand:SI 8 "gpc_reg_operand" "")
9744 (mem:SI (plus:SI (match_dup 1) (const_int 24))))])]
9745 "TARGET_STRING && XVECLEN (operands[0], 0) == 7"
9747 { return rs6000_output_load_multiple (operands); }"
9748 [(set_attr "type" "load")
9749 (set_attr "update" "yes")
9750 (set_attr "indexed" "yes")
9751 (set_attr "length" "32")])
9753 (define_insn "*ldmsi6"
9754 [(match_parallel 0 "load_multiple_operation"
9755 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9756 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9757 (set (match_operand:SI 3 "gpc_reg_operand" "")
9758 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9759 (set (match_operand:SI 4 "gpc_reg_operand" "")
9760 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9761 (set (match_operand:SI 5 "gpc_reg_operand" "")
9762 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
9763 (set (match_operand:SI 6 "gpc_reg_operand" "")
9764 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
9765 (set (match_operand:SI 7 "gpc_reg_operand" "")
9766 (mem:SI (plus:SI (match_dup 1) (const_int 20))))])]
9767 "TARGET_STRING && XVECLEN (operands[0], 0) == 6"
9769 { return rs6000_output_load_multiple (operands); }"
9770 [(set_attr "type" "load")
9771 (set_attr "update" "yes")
9772 (set_attr "indexed" "yes")
9773 (set_attr "length" "32")])
9775 (define_insn "*ldmsi5"
9776 [(match_parallel 0 "load_multiple_operation"
9777 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9778 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9779 (set (match_operand:SI 3 "gpc_reg_operand" "")
9780 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9781 (set (match_operand:SI 4 "gpc_reg_operand" "")
9782 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9783 (set (match_operand:SI 5 "gpc_reg_operand" "")
9784 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
9785 (set (match_operand:SI 6 "gpc_reg_operand" "")
9786 (mem:SI (plus:SI (match_dup 1) (const_int 16))))])]
9787 "TARGET_STRING && XVECLEN (operands[0], 0) == 5"
9789 { return rs6000_output_load_multiple (operands); }"
9790 [(set_attr "type" "load")
9791 (set_attr "update" "yes")
9792 (set_attr "indexed" "yes")
9793 (set_attr "length" "32")])
9795 (define_insn "*ldmsi4"
9796 [(match_parallel 0 "load_multiple_operation"
9797 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9798 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9799 (set (match_operand:SI 3 "gpc_reg_operand" "")
9800 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9801 (set (match_operand:SI 4 "gpc_reg_operand" "")
9802 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9803 (set (match_operand:SI 5 "gpc_reg_operand" "")
9804 (mem:SI (plus:SI (match_dup 1) (const_int 12))))])]
9805 "TARGET_STRING && XVECLEN (operands[0], 0) == 4"
9807 { return rs6000_output_load_multiple (operands); }"
9808 [(set_attr "type" "load")
9809 (set_attr "update" "yes")
9810 (set_attr "indexed" "yes")
9811 (set_attr "length" "32")])
9813 (define_insn "*ldmsi3"
9814 [(match_parallel 0 "load_multiple_operation"
9815 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9816 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9817 (set (match_operand:SI 3 "gpc_reg_operand" "")
9818 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9819 (set (match_operand:SI 4 "gpc_reg_operand" "")
9820 (mem:SI (plus:SI (match_dup 1) (const_int 8))))])]
9821 "TARGET_STRING && XVECLEN (operands[0], 0) == 3"
9823 { return rs6000_output_load_multiple (operands); }"
9824 [(set_attr "type" "load")
9825 (set_attr "update" "yes")
9826 (set_attr "indexed" "yes")
9827 (set_attr "length" "32")])
9829 (define_expand "store_multiple"
9830 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
9831 (match_operand:SI 1 "" ""))
9832 (clobber (scratch:SI))
9833 (use (match_operand:SI 2 "" ""))])]
9834 "TARGET_STRING && !TARGET_POWERPC64"
9843 /* Support only storing a constant number of fixed-point registers to
9844 memory and only bother with this if more than two; the machine
9845 doesn't support more than eight. */
9846 if (GET_CODE (operands[2]) != CONST_INT
9847 || INTVAL (operands[2]) <= 2
9848 || INTVAL (operands[2]) > 8
9849 || GET_CODE (operands[0]) != MEM
9850 || GET_CODE (operands[1]) != REG
9851 || REGNO (operands[1]) >= 32)
9854 count = INTVAL (operands[2]);
9855 regno = REGNO (operands[1]);
9857 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count + 1));
9858 to = force_reg (SImode, XEXP (operands[0], 0));
9859 op0 = replace_equiv_address (operands[0], to);
9861 XVECEXP (operands[3], 0, 0)
9862 = gen_rtx_SET (VOIDmode, adjust_address_nv (op0, SImode, 0), operands[1]);
9863 XVECEXP (operands[3], 0, 1) = gen_rtx_CLOBBER (VOIDmode,
9864 gen_rtx_SCRATCH (SImode));
9866 for (i = 1; i < count; i++)
9867 XVECEXP (operands[3], 0, i + 1)
9868 = gen_rtx_SET (VOIDmode,
9869 adjust_address_nv (op0, SImode, i * 4),
9870 gen_rtx_REG (SImode, regno + i));
9873 (define_insn "*stmsi8"
9874 [(match_parallel 0 "store_multiple_operation"
9875 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9876 (match_operand:SI 2 "gpc_reg_operand" "r"))
9877 (clobber (match_scratch:SI 3 "=X"))
9878 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9879 (match_operand:SI 4 "gpc_reg_operand" "r"))
9880 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9881 (match_operand:SI 5 "gpc_reg_operand" "r"))
9882 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9883 (match_operand:SI 6 "gpc_reg_operand" "r"))
9884 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9885 (match_operand:SI 7 "gpc_reg_operand" "r"))
9886 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9887 (match_operand:SI 8 "gpc_reg_operand" "r"))
9888 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
9889 (match_operand:SI 9 "gpc_reg_operand" "r"))
9890 (set (mem:SI (plus:SI (match_dup 1) (const_int 28)))
9891 (match_operand:SI 10 "gpc_reg_operand" "r"))])]
9892 "TARGET_STRING && XVECLEN (operands[0], 0) == 9"
9894 [(set_attr "type" "store")
9895 (set_attr "update" "yes")
9896 (set_attr "indexed" "yes")
9897 (set_attr "cell_micro" "always")])
9899 (define_insn "*stmsi7"
9900 [(match_parallel 0 "store_multiple_operation"
9901 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9902 (match_operand:SI 2 "gpc_reg_operand" "r"))
9903 (clobber (match_scratch:SI 3 "=X"))
9904 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9905 (match_operand:SI 4 "gpc_reg_operand" "r"))
9906 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9907 (match_operand:SI 5 "gpc_reg_operand" "r"))
9908 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9909 (match_operand:SI 6 "gpc_reg_operand" "r"))
9910 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9911 (match_operand:SI 7 "gpc_reg_operand" "r"))
9912 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9913 (match_operand:SI 8 "gpc_reg_operand" "r"))
9914 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
9915 (match_operand:SI 9 "gpc_reg_operand" "r"))])]
9916 "TARGET_STRING && XVECLEN (operands[0], 0) == 8"
9918 [(set_attr "type" "store")
9919 (set_attr "update" "yes")
9920 (set_attr "indexed" "yes")
9921 (set_attr "cell_micro" "always")])
9923 (define_insn "*stmsi6"
9924 [(match_parallel 0 "store_multiple_operation"
9925 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9926 (match_operand:SI 2 "gpc_reg_operand" "r"))
9927 (clobber (match_scratch:SI 3 "=X"))
9928 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9929 (match_operand:SI 4 "gpc_reg_operand" "r"))
9930 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9931 (match_operand:SI 5 "gpc_reg_operand" "r"))
9932 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9933 (match_operand:SI 6 "gpc_reg_operand" "r"))
9934 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9935 (match_operand:SI 7 "gpc_reg_operand" "r"))
9936 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9937 (match_operand:SI 8 "gpc_reg_operand" "r"))])]
9938 "TARGET_STRING && XVECLEN (operands[0], 0) == 7"
9940 [(set_attr "type" "store")
9941 (set_attr "update" "yes")
9942 (set_attr "indexed" "yes")
9943 (set_attr "cell_micro" "always")])
9945 (define_insn "*stmsi5"
9946 [(match_parallel 0 "store_multiple_operation"
9947 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9948 (match_operand:SI 2 "gpc_reg_operand" "r"))
9949 (clobber (match_scratch:SI 3 "=X"))
9950 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9951 (match_operand:SI 4 "gpc_reg_operand" "r"))
9952 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9953 (match_operand:SI 5 "gpc_reg_operand" "r"))
9954 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9955 (match_operand:SI 6 "gpc_reg_operand" "r"))
9956 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9957 (match_operand:SI 7 "gpc_reg_operand" "r"))])]
9958 "TARGET_STRING && XVECLEN (operands[0], 0) == 6"
9960 [(set_attr "type" "store")
9961 (set_attr "update" "yes")
9962 (set_attr "indexed" "yes")
9963 (set_attr "cell_micro" "always")])
9965 (define_insn "*stmsi4"
9966 [(match_parallel 0 "store_multiple_operation"
9967 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9968 (match_operand:SI 2 "gpc_reg_operand" "r"))
9969 (clobber (match_scratch:SI 3 "=X"))
9970 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9971 (match_operand:SI 4 "gpc_reg_operand" "r"))
9972 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9973 (match_operand:SI 5 "gpc_reg_operand" "r"))
9974 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9975 (match_operand:SI 6 "gpc_reg_operand" "r"))])]
9976 "TARGET_STRING && XVECLEN (operands[0], 0) == 5"
9978 [(set_attr "type" "store")
9979 (set_attr "update" "yes")
9980 (set_attr "indexed" "yes")
9981 (set_attr "cell_micro" "always")])
9983 (define_insn "*stmsi3"
9984 [(match_parallel 0 "store_multiple_operation"
9985 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9986 (match_operand:SI 2 "gpc_reg_operand" "r"))
9987 (clobber (match_scratch:SI 3 "=X"))
9988 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9989 (match_operand:SI 4 "gpc_reg_operand" "r"))
9990 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9991 (match_operand:SI 5 "gpc_reg_operand" "r"))])]
9992 "TARGET_STRING && XVECLEN (operands[0], 0) == 4"
9994 [(set_attr "type" "store")
9995 (set_attr "update" "yes")
9996 (set_attr "indexed" "yes")
9997 (set_attr "cell_micro" "always")])
9999 (define_expand "setmemsi"
10000 [(parallel [(set (match_operand:BLK 0 "" "")
10001 (match_operand 2 "const_int_operand" ""))
10002 (use (match_operand:SI 1 "" ""))
10003 (use (match_operand:SI 3 "" ""))])]
10007 /* If value to set is not zero, use the library routine. */
10008 if (operands[2] != const0_rtx)
10011 if (expand_block_clear (operands))
10017 ;; String/block move insn.
10018 ;; Argument 0 is the destination
10019 ;; Argument 1 is the source
10020 ;; Argument 2 is the length
10021 ;; Argument 3 is the alignment
10023 (define_expand "movmemsi"
10024 [(parallel [(set (match_operand:BLK 0 "" "")
10025 (match_operand:BLK 1 "" ""))
10026 (use (match_operand:SI 2 "" ""))
10027 (use (match_operand:SI 3 "" ""))])]
10031 if (expand_block_move (operands))
10037 ;; Move up to 32 bytes at a time. The fixed registers are needed because the
10038 ;; register allocator doesn't have a clue about allocating 8 word registers.
10039 ;; rD/rS = r5 is preferred, efficient form.
10040 (define_expand "movmemsi_8reg"
10041 [(parallel [(set (match_operand 0 "" "")
10042 (match_operand 1 "" ""))
10043 (use (match_operand 2 "" ""))
10044 (use (match_operand 3 "" ""))
10045 (clobber (reg:SI 5))
10046 (clobber (reg:SI 6))
10047 (clobber (reg:SI 7))
10048 (clobber (reg:SI 8))
10049 (clobber (reg:SI 9))
10050 (clobber (reg:SI 10))
10051 (clobber (reg:SI 11))
10052 (clobber (reg:SI 12))
10053 (clobber (match_scratch:SI 4 ""))])]
10058 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
10059 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
10060 (use (match_operand:SI 2 "immediate_operand" "i"))
10061 (use (match_operand:SI 3 "immediate_operand" "i"))
10062 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10063 (clobber (reg:SI 6))
10064 (clobber (reg:SI 7))
10065 (clobber (reg:SI 8))
10066 (clobber (reg:SI 9))
10067 (clobber (reg:SI 10))
10068 (clobber (reg:SI 11))
10069 (clobber (reg:SI 12))
10070 (clobber (match_scratch:SI 5 "=X"))]
10072 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
10073 || INTVAL (operands[2]) == 0)
10074 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
10075 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
10076 && REGNO (operands[4]) == 5"
10077 "lswi %4,%1,%2\;stswi %4,%0,%2"
10078 [(set_attr "type" "store")
10079 (set_attr "update" "yes")
10080 (set_attr "indexed" "yes")
10081 (set_attr "cell_micro" "always")
10082 (set_attr "length" "8")])
10084 ;; Move up to 24 bytes at a time. The fixed registers are needed because the
10085 ;; register allocator doesn't have a clue about allocating 6 word registers.
10086 ;; rD/rS = r5 is preferred, efficient form.
10087 (define_expand "movmemsi_6reg"
10088 [(parallel [(set (match_operand 0 "" "")
10089 (match_operand 1 "" ""))
10090 (use (match_operand 2 "" ""))
10091 (use (match_operand 3 "" ""))
10092 (clobber (reg:SI 5))
10093 (clobber (reg:SI 6))
10094 (clobber (reg:SI 7))
10095 (clobber (reg:SI 8))
10096 (clobber (reg:SI 9))
10097 (clobber (reg:SI 10))
10098 (clobber (match_scratch:SI 4 ""))])]
10103 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
10104 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
10105 (use (match_operand:SI 2 "immediate_operand" "i"))
10106 (use (match_operand:SI 3 "immediate_operand" "i"))
10107 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10108 (clobber (reg:SI 6))
10109 (clobber (reg:SI 7))
10110 (clobber (reg:SI 8))
10111 (clobber (reg:SI 9))
10112 (clobber (reg:SI 10))
10113 (clobber (match_scratch:SI 5 "=X"))]
10115 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
10116 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
10117 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
10118 && REGNO (operands[4]) == 5"
10119 "lswi %4,%1,%2\;stswi %4,%0,%2"
10120 [(set_attr "type" "store")
10121 (set_attr "update" "yes")
10122 (set_attr "indexed" "yes")
10123 (set_attr "cell_micro" "always")
10124 (set_attr "length" "8")])
10126 ;; Move up to 16 bytes at a time, using 4 fixed registers to avoid spill
10127 ;; problems with TImode.
10128 ;; rD/rS = r5 is preferred, efficient form.
10129 (define_expand "movmemsi_4reg"
10130 [(parallel [(set (match_operand 0 "" "")
10131 (match_operand 1 "" ""))
10132 (use (match_operand 2 "" ""))
10133 (use (match_operand 3 "" ""))
10134 (clobber (reg:SI 5))
10135 (clobber (reg:SI 6))
10136 (clobber (reg:SI 7))
10137 (clobber (reg:SI 8))
10138 (clobber (match_scratch:SI 4 ""))])]
10143 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
10144 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
10145 (use (match_operand:SI 2 "immediate_operand" "i"))
10146 (use (match_operand:SI 3 "immediate_operand" "i"))
10147 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10148 (clobber (reg:SI 6))
10149 (clobber (reg:SI 7))
10150 (clobber (reg:SI 8))
10151 (clobber (match_scratch:SI 5 "=X"))]
10153 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
10154 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
10155 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
10156 && REGNO (operands[4]) == 5"
10157 "lswi %4,%1,%2\;stswi %4,%0,%2"
10158 [(set_attr "type" "store")
10159 (set_attr "update" "yes")
10160 (set_attr "indexed" "yes")
10161 (set_attr "cell_micro" "always")
10162 (set_attr "length" "8")])
10164 ;; Move up to 8 bytes at a time.
10165 (define_expand "movmemsi_2reg"
10166 [(parallel [(set (match_operand 0 "" "")
10167 (match_operand 1 "" ""))
10168 (use (match_operand 2 "" ""))
10169 (use (match_operand 3 "" ""))
10170 (clobber (match_scratch:DI 4 ""))
10171 (clobber (match_scratch:SI 5 ""))])]
10172 "TARGET_STRING && ! TARGET_POWERPC64"
10176 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
10177 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
10178 (use (match_operand:SI 2 "immediate_operand" "i"))
10179 (use (match_operand:SI 3 "immediate_operand" "i"))
10180 (clobber (match_scratch:DI 4 "=&r"))
10181 (clobber (match_scratch:SI 5 "=X"))]
10182 "TARGET_STRING && ! TARGET_POWERPC64
10183 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
10184 "lswi %4,%1,%2\;stswi %4,%0,%2"
10185 [(set_attr "type" "store")
10186 (set_attr "update" "yes")
10187 (set_attr "indexed" "yes")
10188 (set_attr "cell_micro" "always")
10189 (set_attr "length" "8")])
10191 ;; Move up to 4 bytes at a time.
10192 (define_expand "movmemsi_1reg"
10193 [(parallel [(set (match_operand 0 "" "")
10194 (match_operand 1 "" ""))
10195 (use (match_operand 2 "" ""))
10196 (use (match_operand 3 "" ""))
10197 (clobber (match_scratch:SI 4 ""))
10198 (clobber (match_scratch:SI 5 ""))])]
10203 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
10204 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
10205 (use (match_operand:SI 2 "immediate_operand" "i"))
10206 (use (match_operand:SI 3 "immediate_operand" "i"))
10207 (clobber (match_scratch:SI 4 "=&r"))
10208 (clobber (match_scratch:SI 5 "=X"))]
10209 "TARGET_STRING && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
10210 "lswi %4,%1,%2\;stswi %4,%0,%2"
10211 [(set_attr "type" "store")
10212 (set_attr "update" "yes")
10213 (set_attr "indexed" "yes")
10214 (set_attr "cell_micro" "always")
10215 (set_attr "length" "8")])
10217 ;; Define insns that do load or store with update. Some of these we can
10218 ;; get by using pre-decrement or pre-increment, but the hardware can also
10219 ;; do cases where the increment is not the size of the object.
10221 ;; In all these cases, we use operands 0 and 1 for the register being
10222 ;; incremented because those are the operands that local-alloc will
10223 ;; tie and these are the pair most likely to be tieable (and the ones
10224 ;; that will benefit the most).
10226 (define_insn "*movdi_update1"
10227 [(set (match_operand:DI 3 "gpc_reg_operand" "=r,r")
10228 (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
10229 (match_operand:DI 2 "reg_or_aligned_short_operand" "r,I"))))
10230 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
10231 (plus:DI (match_dup 1) (match_dup 2)))]
10232 "TARGET_POWERPC64 && TARGET_UPDATE
10233 && (!avoiding_indexed_address_p (DImode)
10234 || !gpc_reg_operand (operands[2], DImode))"
10238 [(set_attr "type" "load")
10239 (set_attr "update" "yes")
10240 (set_attr "indexed" "yes,no")])
10242 (define_insn "movdi_<mode>_update"
10243 [(set (mem:DI (plus:P (match_operand:P 1 "gpc_reg_operand" "0,0")
10244 (match_operand:P 2 "reg_or_aligned_short_operand" "r,I")))
10245 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
10246 (set (match_operand:P 0 "gpc_reg_operand" "=b,b")
10247 (plus:P (match_dup 1) (match_dup 2)))]
10248 "TARGET_POWERPC64 && TARGET_UPDATE
10249 && (!avoiding_indexed_address_p (Pmode)
10250 || !gpc_reg_operand (operands[2], Pmode)
10251 || (REG_P (operands[0])
10252 && REGNO (operands[0]) == STACK_POINTER_REGNUM))"
10256 [(set_attr "type" "store")
10257 (set_attr "update" "yes")
10258 (set_attr "indexed" "yes,no")])
10260 ;; This pattern is only conditional on TARGET_POWERPC64, as it is
10261 ;; needed for stack allocation, even if the user passes -mno-update.
10262 (define_insn "movdi_<mode>_update_stack"
10263 [(set (mem:DI (plus:P (match_operand:P 1 "gpc_reg_operand" "0,0")
10264 (match_operand:P 2 "reg_or_aligned_short_operand" "r,I")))
10265 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
10266 (set (match_operand:P 0 "gpc_reg_operand" "=b,b")
10267 (plus:P (match_dup 1) (match_dup 2)))]
10272 [(set_attr "type" "store")
10273 (set_attr "update" "yes")
10274 (set_attr "indexed" "yes,no")])
10276 (define_insn "*movsi_update1"
10277 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
10278 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10279 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10280 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10281 (plus:SI (match_dup 1) (match_dup 2)))]
10283 && (!avoiding_indexed_address_p (SImode)
10284 || !gpc_reg_operand (operands[2], SImode))"
10288 [(set_attr "type" "load")
10289 (set_attr "update" "yes")
10290 (set_attr "indexed" "yes,no")])
10292 (define_insn "*movsi_update2"
10293 [(set (match_operand:DI 3 "gpc_reg_operand" "=r")
10295 (mem:SI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0")
10296 (match_operand:DI 2 "gpc_reg_operand" "r")))))
10297 (set (match_operand:DI 0 "gpc_reg_operand" "=b")
10298 (plus:DI (match_dup 1) (match_dup 2)))]
10299 "TARGET_POWERPC64 && rs6000_gen_cell_microcode
10300 && !avoiding_indexed_address_p (DImode)"
10302 [(set_attr "type" "load")
10303 (set_attr "sign_extend" "yes")
10304 (set_attr "update" "yes")
10305 (set_attr "indexed" "yes")])
10307 (define_insn "movsi_update"
10308 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10309 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10310 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
10311 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10312 (plus:SI (match_dup 1) (match_dup 2)))]
10314 && (!avoiding_indexed_address_p (SImode)
10315 || !gpc_reg_operand (operands[2], SImode)
10316 || (REG_P (operands[0])
10317 && REGNO (operands[0]) == STACK_POINTER_REGNUM))"
10321 [(set_attr "type" "store")
10322 (set_attr "update" "yes")
10323 (set_attr "indexed" "yes,no")])
10325 ;; This is an unconditional pattern; needed for stack allocation, even
10326 ;; if the user passes -mno-update.
10327 (define_insn "movsi_update_stack"
10328 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10329 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10330 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
10331 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10332 (plus:SI (match_dup 1) (match_dup 2)))]
10337 [(set_attr "type" "store")
10338 (set_attr "update" "yes")
10339 (set_attr "indexed" "yes,no")])
10341 (define_insn "*movhi_update1"
10342 [(set (match_operand:HI 3 "gpc_reg_operand" "=r,r")
10343 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10344 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10345 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10346 (plus:SI (match_dup 1) (match_dup 2)))]
10348 && (!avoiding_indexed_address_p (SImode)
10349 || !gpc_reg_operand (operands[2], SImode))"
10353 [(set_attr "type" "load")
10354 (set_attr "update" "yes")
10355 (set_attr "indexed" "yes,no")])
10357 (define_insn "*movhi_update2"
10358 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
10360 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10361 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
10362 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10363 (plus:SI (match_dup 1) (match_dup 2)))]
10365 && (!avoiding_indexed_address_p (SImode)
10366 || !gpc_reg_operand (operands[2], SImode))"
10370 [(set_attr "type" "load")
10371 (set_attr "update" "yes")
10372 (set_attr "indexed" "yes,no")])
10374 (define_insn "*movhi_update3"
10375 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
10377 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10378 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
10379 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10380 (plus:SI (match_dup 1) (match_dup 2)))]
10381 "TARGET_UPDATE && rs6000_gen_cell_microcode
10382 && (!avoiding_indexed_address_p (SImode)
10383 || !gpc_reg_operand (operands[2], SImode))"
10387 [(set_attr "type" "load")
10388 (set_attr "sign_extend" "yes")
10389 (set_attr "update" "yes")
10390 (set_attr "indexed" "yes,no")])
10392 (define_insn "*movhi_update4"
10393 [(set (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10394 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10395 (match_operand:HI 3 "gpc_reg_operand" "r,r"))
10396 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10397 (plus:SI (match_dup 1) (match_dup 2)))]
10399 && (!avoiding_indexed_address_p (SImode)
10400 || !gpc_reg_operand (operands[2], SImode))"
10404 [(set_attr "type" "store")
10405 (set_attr "update" "yes")
10406 (set_attr "indexed" "yes,no")])
10408 (define_insn "*movqi_update1"
10409 [(set (match_operand:QI 3 "gpc_reg_operand" "=r,r")
10410 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10411 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10412 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10413 (plus:SI (match_dup 1) (match_dup 2)))]
10415 && (!avoiding_indexed_address_p (SImode)
10416 || !gpc_reg_operand (operands[2], SImode))"
10420 [(set_attr "type" "load")
10421 (set_attr "update" "yes")
10422 (set_attr "indexed" "yes,no")])
10424 (define_insn "*movqi_update2"
10425 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
10427 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10428 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
10429 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10430 (plus:SI (match_dup 1) (match_dup 2)))]
10432 && (!avoiding_indexed_address_p (SImode)
10433 || !gpc_reg_operand (operands[2], SImode))"
10437 [(set_attr "type" "load")
10438 (set_attr "update" "yes")
10439 (set_attr "indexed" "yes,no")])
10441 (define_insn "*movqi_update3"
10442 [(set (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10443 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10444 (match_operand:QI 3 "gpc_reg_operand" "r,r"))
10445 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10446 (plus:SI (match_dup 1) (match_dup 2)))]
10448 && (!avoiding_indexed_address_p (SImode)
10449 || !gpc_reg_operand (operands[2], SImode))"
10453 [(set_attr "type" "store")
10454 (set_attr "update" "yes")
10455 (set_attr "indexed" "yes,no")])
10457 (define_insn "*movsf_update1"
10458 [(set (match_operand:SF 3 "gpc_reg_operand" "=f,f")
10459 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10460 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10461 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10462 (plus:SI (match_dup 1) (match_dup 2)))]
10463 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT && TARGET_UPDATE
10464 && (!avoiding_indexed_address_p (SImode)
10465 || !gpc_reg_operand (operands[2], SImode))"
10469 [(set_attr "type" "fpload")
10470 (set_attr "update" "yes")
10471 (set_attr "indexed" "yes,no")])
10473 (define_insn "*movsf_update2"
10474 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10475 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10476 (match_operand:SF 3 "gpc_reg_operand" "f,f"))
10477 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10478 (plus:SI (match_dup 1) (match_dup 2)))]
10479 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT && TARGET_UPDATE
10480 && (!avoiding_indexed_address_p (SImode)
10481 || !gpc_reg_operand (operands[2], SImode))"
10485 [(set_attr "type" "fpstore")
10486 (set_attr "update" "yes")
10487 (set_attr "indexed" "yes,no")])
10489 (define_insn "*movsf_update3"
10490 [(set (match_operand:SF 3 "gpc_reg_operand" "=r,r")
10491 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10492 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10493 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10494 (plus:SI (match_dup 1) (match_dup 2)))]
10495 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE
10496 && (!avoiding_indexed_address_p (SImode)
10497 || !gpc_reg_operand (operands[2], SImode))"
10501 [(set_attr "type" "load")
10502 (set_attr "update" "yes")
10503 (set_attr "indexed" "yes,no")])
10505 (define_insn "*movsf_update4"
10506 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10507 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10508 (match_operand:SF 3 "gpc_reg_operand" "r,r"))
10509 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10510 (plus:SI (match_dup 1) (match_dup 2)))]
10511 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE
10512 && (!avoiding_indexed_address_p (SImode)
10513 || !gpc_reg_operand (operands[2], SImode))"
10517 [(set_attr "type" "store")
10518 (set_attr "update" "yes")
10519 (set_attr "indexed" "yes,no")])
10521 (define_insn "*movdf_update1"
10522 [(set (match_operand:DF 3 "gpc_reg_operand" "=d,d")
10523 (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10524 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10525 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10526 (plus:SI (match_dup 1) (match_dup 2)))]
10527 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_UPDATE
10528 && (!avoiding_indexed_address_p (SImode)
10529 || !gpc_reg_operand (operands[2], SImode))"
10533 [(set_attr "type" "fpload")
10534 (set_attr "update" "yes")
10535 (set_attr "indexed" "yes,no")])
10537 (define_insn "*movdf_update2"
10538 [(set (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10539 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10540 (match_operand:DF 3 "gpc_reg_operand" "d,d"))
10541 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10542 (plus:SI (match_dup 1) (match_dup 2)))]
10543 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_UPDATE
10544 && (!avoiding_indexed_address_p (SImode)
10545 || !gpc_reg_operand (operands[2], SImode))"
10549 [(set_attr "type" "fpstore")
10550 (set_attr "update" "yes")
10551 (set_attr "indexed" "yes,no")])
10554 ;; After inserting conditional returns we can sometimes have
10555 ;; unnecessary register moves. Unfortunately we cannot have a
10556 ;; modeless peephole here, because some single SImode sets have early
10557 ;; clobber outputs. Although those sets expand to multi-ppc-insn
10558 ;; sequences, using get_attr_length here will smash the operands
10559 ;; array. Neither is there an early_cobbler_p predicate.
10560 ;; Disallow subregs for E500 so we don't munge frob_di_df_2.
10562 [(set (match_operand:DF 0 "gpc_reg_operand" "")
10563 (match_operand:DF 1 "any_operand" ""))
10564 (set (match_operand:DF 2 "gpc_reg_operand" "")
10566 "!(TARGET_E500_DOUBLE && GET_CODE (operands[2]) == SUBREG)
10567 && peep2_reg_dead_p (2, operands[0])"
10568 [(set (match_dup 2) (match_dup 1))])
10571 [(set (match_operand:SF 0 "gpc_reg_operand" "")
10572 (match_operand:SF 1 "any_operand" ""))
10573 (set (match_operand:SF 2 "gpc_reg_operand" "")
10575 "peep2_reg_dead_p (2, operands[0])"
10576 [(set (match_dup 2) (match_dup 1))])
10581 ;; Mode attributes for different ABIs.
10582 (define_mode_iterator TLSmode [(SI "! TARGET_64BIT") (DI "TARGET_64BIT")])
10583 (define_mode_attr tls_abi_suffix [(SI "32") (DI "64")])
10584 (define_mode_attr tls_sysv_suffix [(SI "si") (DI "di")])
10585 (define_mode_attr tls_insn_suffix [(SI "wz") (DI "d")])
10587 (define_insn_and_split "tls_gd_aix<TLSmode:tls_abi_suffix>"
10588 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10589 (call (mem:TLSmode (match_operand:TLSmode 3 "symbol_ref_operand" "s"))
10590 (match_operand 4 "" "g")))
10591 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10592 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10594 (clobber (reg:SI LR_REGNO))]
10595 "HAVE_AS_TLS && (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)"
10597 if (TARGET_CMODEL != CMODEL_SMALL)
10598 return "addis %0,%1,%2@got@tlsgd@ha\;addi %0,%0,%2@got@tlsgd@l\;"
10601 return "addi %0,%1,%2@got@tlsgd\;bl %z3\;nop";
10603 "&& TARGET_TLS_MARKERS"
10604 [(set (match_dup 0)
10605 (unspec:TLSmode [(match_dup 1)
10608 (parallel [(set (match_dup 0)
10609 (call (mem:TLSmode (match_dup 3))
10611 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD)
10612 (clobber (reg:SI LR_REGNO))])]
10614 [(set_attr "type" "two")
10615 (set (attr "length")
10616 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
10620 (define_insn_and_split "tls_gd_sysv<TLSmode:tls_sysv_suffix>"
10621 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10622 (call (mem:TLSmode (match_operand:TLSmode 3 "symbol_ref_operand" "s"))
10623 (match_operand 4 "" "g")))
10624 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10625 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10627 (clobber (reg:SI LR_REGNO))]
10628 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4"
10632 if (TARGET_SECURE_PLT && flag_pic == 2)
10633 return "addi %0,%1,%2@got@tlsgd\;bl %z3+32768@plt";
10635 return "addi %0,%1,%2@got@tlsgd\;bl %z3@plt";
10638 return "addi %0,%1,%2@got@tlsgd\;bl %z3";
10640 "&& TARGET_TLS_MARKERS"
10641 [(set (match_dup 0)
10642 (unspec:TLSmode [(match_dup 1)
10645 (parallel [(set (match_dup 0)
10646 (call (mem:TLSmode (match_dup 3))
10648 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD)
10649 (clobber (reg:SI LR_REGNO))])]
10651 [(set_attr "type" "two")
10652 (set_attr "length" "8")])
10654 (define_insn_and_split "*tls_gd<TLSmode:tls_abi_suffix>"
10655 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10656 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10657 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10659 "HAVE_AS_TLS && TARGET_TLS_MARKERS"
10660 "addi %0,%1,%2@got@tlsgd"
10661 "&& TARGET_CMODEL != CMODEL_SMALL"
10662 [(set (match_dup 3)
10664 (unspec:TLSmode [(match_dup 1) (match_dup 2)] UNSPEC_TLSGD)))
10666 (lo_sum:TLSmode (match_dup 3)
10667 (unspec:TLSmode [(match_dup 1) (match_dup 2)] UNSPEC_TLSGD)))]
10670 operands[3] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
10672 [(set (attr "length")
10673 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
10677 (define_insn "*tls_gd_high<TLSmode:tls_abi_suffix>"
10678 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10680 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10681 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10683 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
10684 "addis %0,%1,%2@got@tlsgd@ha"
10685 [(set_attr "length" "4")])
10687 (define_insn "*tls_gd_low<TLSmode:tls_abi_suffix>"
10688 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10689 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
10690 (unspec:TLSmode [(match_operand:TLSmode 3 "gpc_reg_operand" "b")
10691 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10693 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
10694 "addi %0,%1,%2@got@tlsgd@l"
10695 [(set_attr "length" "4")])
10697 (define_insn "*tls_gd_call_aix<TLSmode:tls_abi_suffix>"
10698 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10699 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
10700 (match_operand 2 "" "g")))
10701 (unspec:TLSmode [(match_operand:TLSmode 3 "rs6000_tls_symbol_ref" "")]
10703 (clobber (reg:SI LR_REGNO))]
10704 "HAVE_AS_TLS && TARGET_TLS_MARKERS
10705 && (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)"
10706 "bl %z1(%3@tlsgd)\;nop"
10707 [(set_attr "type" "branch")
10708 (set_attr "length" "8")])
10710 (define_insn "*tls_gd_call_sysv<TLSmode:tls_abi_suffix>"
10711 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10712 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
10713 (match_operand 2 "" "g")))
10714 (unspec:TLSmode [(match_operand:TLSmode 3 "rs6000_tls_symbol_ref" "")]
10716 (clobber (reg:SI LR_REGNO))]
10717 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4 && TARGET_TLS_MARKERS"
10721 if (TARGET_SECURE_PLT && flag_pic == 2)
10722 return "bl %z1+32768(%3@tlsgd)@plt";
10723 return "bl %z1(%3@tlsgd)@plt";
10725 return "bl %z1(%3@tlsgd)";
10727 [(set_attr "type" "branch")
10728 (set_attr "length" "4")])
10730 (define_insn_and_split "tls_ld_aix<TLSmode:tls_abi_suffix>"
10731 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10732 (call (mem:TLSmode (match_operand:TLSmode 2 "symbol_ref_operand" "s"))
10733 (match_operand 3 "" "g")))
10734 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
10736 (clobber (reg:SI LR_REGNO))]
10737 "HAVE_AS_TLS && (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)"
10739 if (TARGET_CMODEL != CMODEL_SMALL)
10740 return "addis %0,%1,%&@got@tlsld@ha\;addi %0,%0,%&@got@tlsld@l\;"
10743 return "addi %0,%1,%&@got@tlsld\;bl %z2\;nop";
10745 "&& TARGET_TLS_MARKERS"
10746 [(set (match_dup 0)
10747 (unspec:TLSmode [(match_dup 1)]
10749 (parallel [(set (match_dup 0)
10750 (call (mem:TLSmode (match_dup 2))
10752 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
10753 (clobber (reg:SI LR_REGNO))])]
10755 [(set_attr "type" "two")
10756 (set (attr "length")
10757 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
10761 (define_insn_and_split "tls_ld_sysv<TLSmode:tls_sysv_suffix>"
10762 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10763 (call (mem:TLSmode (match_operand:TLSmode 2 "symbol_ref_operand" "s"))
10764 (match_operand 3 "" "g")))
10765 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
10767 (clobber (reg:SI LR_REGNO))]
10768 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4"
10772 if (TARGET_SECURE_PLT && flag_pic == 2)
10773 return "addi %0,%1,%&@got@tlsld\;bl %z2+32768@plt";
10775 return "addi %0,%1,%&@got@tlsld\;bl %z2@plt";
10778 return "addi %0,%1,%&@got@tlsld\;bl %z2";
10780 "&& TARGET_TLS_MARKERS"
10781 [(set (match_dup 0)
10782 (unspec:TLSmode [(match_dup 1)]
10784 (parallel [(set (match_dup 0)
10785 (call (mem:TLSmode (match_dup 2))
10787 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
10788 (clobber (reg:SI LR_REGNO))])]
10790 [(set_attr "length" "8")])
10792 (define_insn_and_split "*tls_ld<TLSmode:tls_abi_suffix>"
10793 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10794 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
10796 "HAVE_AS_TLS && TARGET_TLS_MARKERS"
10797 "addi %0,%1,%&@got@tlsld"
10798 "&& TARGET_CMODEL != CMODEL_SMALL"
10799 [(set (match_dup 2)
10801 (unspec:TLSmode [(const_int 0) (match_dup 1)] UNSPEC_TLSLD)))
10803 (lo_sum:TLSmode (match_dup 2)
10804 (unspec:TLSmode [(const_int 0) (match_dup 1)] UNSPEC_TLSLD)))]
10807 operands[2] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
10809 [(set (attr "length")
10810 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
10814 (define_insn "*tls_ld_high<TLSmode:tls_abi_suffix>"
10815 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10817 (unspec:TLSmode [(const_int 0)
10818 (match_operand:TLSmode 1 "gpc_reg_operand" "b")]
10820 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
10821 "addis %0,%1,%&@got@tlsld@ha"
10822 [(set_attr "length" "4")])
10824 (define_insn "*tls_ld_low<TLSmode:tls_abi_suffix>"
10825 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10826 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
10827 (unspec:TLSmode [(const_int 0)
10828 (match_operand:TLSmode 2 "gpc_reg_operand" "b")]
10830 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
10831 "addi %0,%1,%&@got@tlsld@l"
10832 [(set_attr "length" "4")])
10834 (define_insn "*tls_ld_call_aix<TLSmode:tls_abi_suffix>"
10835 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10836 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
10837 (match_operand 2 "" "g")))
10838 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
10839 (clobber (reg:SI LR_REGNO))]
10840 "HAVE_AS_TLS && TARGET_TLS_MARKERS
10841 && (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)"
10842 "bl %z1(%&@tlsld)\;nop"
10843 [(set_attr "type" "branch")
10844 (set_attr "length" "8")])
10846 (define_insn "*tls_ld_call_sysv<TLSmode:tls_abi_suffix>"
10847 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10848 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
10849 (match_operand 2 "" "g")))
10850 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
10851 (clobber (reg:SI LR_REGNO))]
10852 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4 && TARGET_TLS_MARKERS"
10856 if (TARGET_SECURE_PLT && flag_pic == 2)
10857 return "bl %z1+32768(%&@tlsld)@plt";
10858 return "bl %z1(%&@tlsld)@plt";
10860 return "bl %z1(%&@tlsld)";
10862 [(set_attr "type" "branch")
10863 (set_attr "length" "4")])
10865 (define_insn "tls_dtprel_<TLSmode:tls_abi_suffix>"
10866 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
10867 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10868 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10869 UNSPEC_TLSDTPREL))]
10871 "addi %0,%1,%2@dtprel")
10873 (define_insn "tls_dtprel_ha_<TLSmode:tls_abi_suffix>"
10874 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
10875 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10876 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10877 UNSPEC_TLSDTPRELHA))]
10879 "addis %0,%1,%2@dtprel@ha")
10881 (define_insn "tls_dtprel_lo_<TLSmode:tls_abi_suffix>"
10882 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
10883 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10884 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10885 UNSPEC_TLSDTPRELLO))]
10887 "addi %0,%1,%2@dtprel@l")
10889 (define_insn_and_split "tls_got_dtprel_<TLSmode:tls_abi_suffix>"
10890 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
10891 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10892 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10893 UNSPEC_TLSGOTDTPREL))]
10895 "l<TLSmode:tls_insn_suffix> %0,%2@got@dtprel(%1)"
10896 "&& TARGET_CMODEL != CMODEL_SMALL"
10897 [(set (match_dup 3)
10899 (unspec:TLSmode [(match_dup 1) (match_dup 2)] UNSPEC_TLSGOTDTPREL)))
10901 (lo_sum:TLSmode (match_dup 3)
10902 (unspec:TLSmode [(match_dup 1) (match_dup 2)] UNSPEC_TLSGOTDTPREL)))]
10905 operands[3] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
10907 [(set (attr "length")
10908 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
10912 (define_insn "*tls_got_dtprel_high<TLSmode:tls_abi_suffix>"
10913 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10915 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10916 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10917 UNSPEC_TLSGOTDTPREL)))]
10918 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
10919 "addis %0,%1,%2@got@dtprel@ha"
10920 [(set_attr "length" "4")])
10922 (define_insn "*tls_got_dtprel_low<TLSmode:tls_abi_suffix>"
10923 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
10924 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
10925 (unspec:TLSmode [(match_operand:TLSmode 3 "gpc_reg_operand" "b")
10926 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10927 UNSPEC_TLSGOTDTPREL)))]
10928 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
10929 "l<TLSmode:tls_insn_suffix> %0,%2@got@dtprel@l(%1)"
10930 [(set_attr "length" "4")])
10932 (define_insn "tls_tprel_<TLSmode:tls_abi_suffix>"
10933 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
10934 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10935 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10938 "addi %0,%1,%2@tprel")
10940 (define_insn "tls_tprel_ha_<TLSmode:tls_abi_suffix>"
10941 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
10942 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10943 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10944 UNSPEC_TLSTPRELHA))]
10946 "addis %0,%1,%2@tprel@ha")
10948 (define_insn "tls_tprel_lo_<TLSmode:tls_abi_suffix>"
10949 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
10950 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10951 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10952 UNSPEC_TLSTPRELLO))]
10954 "addi %0,%1,%2@tprel@l")
10956 ;; "b" output constraint here and on tls_tls input to support linker tls
10957 ;; optimization. The linker may edit the instructions emitted by a
10958 ;; tls_got_tprel/tls_tls pair to addis,addi.
10959 (define_insn_and_split "tls_got_tprel_<TLSmode:tls_abi_suffix>"
10960 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10961 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10962 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10963 UNSPEC_TLSGOTTPREL))]
10965 "l<TLSmode:tls_insn_suffix> %0,%2@got@tprel(%1)"
10966 "&& TARGET_CMODEL != CMODEL_SMALL"
10967 [(set (match_dup 3)
10969 (unspec:TLSmode [(match_dup 1) (match_dup 2)] UNSPEC_TLSGOTTPREL)))
10971 (lo_sum:TLSmode (match_dup 3)
10972 (unspec:TLSmode [(match_dup 1) (match_dup 2)] UNSPEC_TLSGOTTPREL)))]
10975 operands[3] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
10977 [(set (attr "length")
10978 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
10982 (define_insn "*tls_got_tprel_high<TLSmode:tls_abi_suffix>"
10983 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10985 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10986 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10987 UNSPEC_TLSGOTTPREL)))]
10988 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
10989 "addis %0,%1,%2@got@tprel@ha"
10990 [(set_attr "length" "4")])
10992 (define_insn "*tls_got_tprel_low<TLSmode:tls_abi_suffix>"
10993 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
10994 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
10995 (unspec:TLSmode [(match_operand:TLSmode 3 "gpc_reg_operand" "b")
10996 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10997 UNSPEC_TLSGOTTPREL)))]
10998 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
10999 "l<TLSmode:tls_insn_suffix> %0,%2@got@tprel@l(%1)"
11000 [(set_attr "length" "4")])
11002 (define_insn "tls_tls_<TLSmode:tls_abi_suffix>"
11003 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11004 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11005 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11007 "TARGET_ELF && HAVE_AS_TLS"
11008 "add %0,%1,%2@tls")
11010 (define_expand "tls_get_tpointer"
11011 [(set (match_operand:SI 0 "gpc_reg_operand" "")
11012 (unspec:SI [(const_int 0)] UNSPEC_TLSTLS))]
11013 "TARGET_XCOFF && HAVE_AS_TLS"
11016 emit_insn (gen_tls_get_tpointer_internal ());
11017 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
11021 (define_insn "tls_get_tpointer_internal"
11023 (unspec:SI [(const_int 0)] UNSPEC_TLSTLS))
11024 (clobber (reg:SI LR_REGNO))]
11025 "TARGET_XCOFF && HAVE_AS_TLS"
11026 "bla __get_tpointer")
11028 (define_expand "tls_get_addr<mode>"
11029 [(set (match_operand:P 0 "gpc_reg_operand" "")
11030 (unspec:P [(match_operand:P 1 "gpc_reg_operand" "")
11031 (match_operand:P 2 "gpc_reg_operand" "")] UNSPEC_TLSTLS))]
11032 "TARGET_XCOFF && HAVE_AS_TLS"
11035 emit_move_insn (gen_rtx_REG (Pmode, 3), operands[1]);
11036 emit_move_insn (gen_rtx_REG (Pmode, 4), operands[2]);
11037 emit_insn (gen_tls_get_addr_internal<mode> ());
11038 emit_move_insn (operands[0], gen_rtx_REG (Pmode, 3));
11042 (define_insn "tls_get_addr_internal<mode>"
11044 (unspec:P [(reg:P 3) (reg:P 4)] UNSPEC_TLSTLS))
11045 (clobber (reg:P 0))
11046 (clobber (reg:P 4))
11047 (clobber (reg:P 5))
11048 (clobber (reg:P 11))
11049 (clobber (reg:CC CR0_REGNO))
11050 (clobber (reg:P LR_REGNO))]
11051 "TARGET_XCOFF && HAVE_AS_TLS"
11052 "bla __tls_get_addr")
11054 ;; Next come insns related to the calling sequence.
11056 ;; First, an insn to allocate new stack space for dynamic use (e.g., alloca).
11057 ;; We move the back-chain and decrement the stack pointer.
11059 (define_expand "allocate_stack"
11060 [(set (match_operand 0 "gpc_reg_operand" "")
11061 (minus (reg 1) (match_operand 1 "reg_or_short_operand" "")))
11063 (minus (reg 1) (match_dup 1)))]
11066 { rtx chain = gen_reg_rtx (Pmode);
11067 rtx stack_bot = gen_rtx_MEM (Pmode, stack_pointer_rtx);
11069 rtx insn, par, set, mem;
11071 emit_move_insn (chain, stack_bot);
11073 /* Check stack bounds if necessary. */
11074 if (crtl->limit_stack)
11077 available = expand_binop (Pmode, sub_optab,
11078 stack_pointer_rtx, stack_limit_rtx,
11079 NULL_RTX, 1, OPTAB_WIDEN);
11080 emit_insn (gen_cond_trap (LTU, available, operands[1], const0_rtx));
11083 if (GET_CODE (operands[1]) != CONST_INT
11084 || INTVAL (operands[1]) < -32767
11085 || INTVAL (operands[1]) > 32768)
11087 neg_op0 = gen_reg_rtx (Pmode);
11089 emit_insn (gen_negsi2 (neg_op0, operands[1]));
11091 emit_insn (gen_negdi2 (neg_op0, operands[1]));
11094 neg_op0 = GEN_INT (- INTVAL (operands[1]));
11096 insn = emit_insn ((* ((TARGET_32BIT) ? gen_movsi_update_stack
11097 : gen_movdi_di_update_stack))
11098 (stack_pointer_rtx, stack_pointer_rtx, neg_op0,
11100 /* Since we didn't use gen_frame_mem to generate the MEM, grab
11101 it now and set the alias set/attributes. The above gen_*_update
11102 calls will generate a PARALLEL with the MEM set being the first
11104 par = PATTERN (insn);
11105 gcc_assert (GET_CODE (par) == PARALLEL);
11106 set = XVECEXP (par, 0, 0);
11107 gcc_assert (GET_CODE (set) == SET);
11108 mem = SET_DEST (set);
11109 gcc_assert (MEM_P (mem));
11110 MEM_NOTRAP_P (mem) = 1;
11111 set_mem_alias_set (mem, get_frame_alias_set ());
11113 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
11117 ;; These patterns say how to save and restore the stack pointer. We need not
11118 ;; save the stack pointer at function level since we are careful to
11119 ;; preserve the backchain. At block level, we have to restore the backchain
11120 ;; when we restore the stack pointer.
11122 ;; For nonlocal gotos, we must save both the stack pointer and its
11123 ;; backchain and restore both. Note that in the nonlocal case, the
11124 ;; save area is a memory location.
11126 (define_expand "save_stack_function"
11127 [(match_operand 0 "any_operand" "")
11128 (match_operand 1 "any_operand" "")]
11132 (define_expand "restore_stack_function"
11133 [(match_operand 0 "any_operand" "")
11134 (match_operand 1 "any_operand" "")]
11138 ;; Adjust stack pointer (op0) to a new value (op1).
11139 ;; First copy old stack backchain to new location, and ensure that the
11140 ;; scheduler won't reorder the sp assignment before the backchain write.
11141 (define_expand "restore_stack_block"
11142 [(set (match_dup 2) (match_dup 3))
11143 (set (match_dup 4) (match_dup 2))
11145 (set (match_operand 0 "register_operand" "")
11146 (match_operand 1 "register_operand" ""))]
11152 operands[1] = force_reg (Pmode, operands[1]);
11153 operands[2] = gen_reg_rtx (Pmode);
11154 operands[3] = gen_frame_mem (Pmode, operands[0]);
11155 operands[4] = gen_frame_mem (Pmode, operands[1]);
11156 p = rtvec_alloc (1);
11157 RTVEC_ELT (p, 0) = gen_rtx_SET (VOIDmode,
11158 gen_frame_mem (BLKmode, operands[0]),
11160 operands[5] = gen_rtx_PARALLEL (VOIDmode, p);
11163 (define_expand "save_stack_nonlocal"
11164 [(set (match_dup 3) (match_dup 4))
11165 (set (match_operand 0 "memory_operand" "") (match_dup 3))
11166 (set (match_dup 2) (match_operand 1 "register_operand" ""))]
11170 int units_per_word = (TARGET_32BIT) ? 4 : 8;
11172 /* Copy the backchain to the first word, sp to the second. */
11173 operands[0] = adjust_address_nv (operands[0], Pmode, 0);
11174 operands[2] = adjust_address_nv (operands[0], Pmode, units_per_word);
11175 operands[3] = gen_reg_rtx (Pmode);
11176 operands[4] = gen_frame_mem (Pmode, operands[1]);
11179 (define_expand "restore_stack_nonlocal"
11180 [(set (match_dup 2) (match_operand 1 "memory_operand" ""))
11181 (set (match_dup 3) (match_dup 4))
11182 (set (match_dup 5) (match_dup 2))
11184 (set (match_operand 0 "register_operand" "") (match_dup 3))]
11188 int units_per_word = (TARGET_32BIT) ? 4 : 8;
11191 /* Restore the backchain from the first word, sp from the second. */
11192 operands[2] = gen_reg_rtx (Pmode);
11193 operands[3] = gen_reg_rtx (Pmode);
11194 operands[1] = adjust_address_nv (operands[1], Pmode, 0);
11195 operands[4] = adjust_address_nv (operands[1], Pmode, units_per_word);
11196 operands[5] = gen_frame_mem (Pmode, operands[3]);
11197 p = rtvec_alloc (1);
11198 RTVEC_ELT (p, 0) = gen_rtx_SET (VOIDmode,
11199 gen_frame_mem (BLKmode, operands[0]),
11201 operands[6] = gen_rtx_PARALLEL (VOIDmode, p);
11204 ;; TOC register handling.
11206 ;; Code to initialize the TOC register...
11208 (define_insn "load_toc_aix_si"
11209 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11210 (unspec:SI [(const_int 0)] UNSPEC_TOC))
11211 (use (reg:SI 2))])]
11212 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2) && TARGET_32BIT"
11216 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
11217 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
11218 operands[2] = gen_rtx_REG (Pmode, 2);
11219 return \"lwz %0,%1(%2)\";
11221 [(set_attr "type" "load")
11222 (set_attr "update" "no")
11223 (set_attr "indexed" "no")])
11225 (define_insn "load_toc_aix_di"
11226 [(parallel [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11227 (unspec:DI [(const_int 0)] UNSPEC_TOC))
11228 (use (reg:DI 2))])]
11229 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2) && TARGET_64BIT"
11233 #ifdef TARGET_RELOCATABLE
11234 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\",
11235 !TARGET_MINIMAL_TOC || TARGET_RELOCATABLE);
11237 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
11240 strcat (buf, \"@toc\");
11241 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
11242 operands[2] = gen_rtx_REG (Pmode, 2);
11243 return \"ld %0,%1(%2)\";
11245 [(set_attr "type" "load")
11246 (set_attr "update" "no")
11247 (set_attr "indexed" "no")])
11249 (define_insn "load_toc_v4_pic_si"
11250 [(set (reg:SI LR_REGNO)
11251 (unspec:SI [(const_int 0)] UNSPEC_TOC))]
11252 "DEFAULT_ABI == ABI_V4 && flag_pic == 1 && TARGET_32BIT"
11253 "bl _GLOBAL_OFFSET_TABLE_@local-4"
11254 [(set_attr "type" "branch")
11255 (set_attr "length" "4")])
11257 (define_expand "load_toc_v4_PIC_1"
11258 [(parallel [(set (reg:SI LR_REGNO)
11259 (match_operand:SI 0 "immediate_operand" "s"))
11260 (use (unspec [(match_dup 0)] UNSPEC_TOC))])]
11261 "TARGET_ELF && DEFAULT_ABI == ABI_V4
11262 && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
11265 (define_insn "load_toc_v4_PIC_1_normal"
11266 [(set (reg:SI LR_REGNO)
11267 (match_operand:SI 0 "immediate_operand" "s"))
11268 (use (unspec [(match_dup 0)] UNSPEC_TOC))]
11269 "!TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI == ABI_V4
11270 && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
11271 "bcl 20,31,%0\\n%0:"
11272 [(set_attr "type" "branch")
11273 (set_attr "length" "4")])
11275 (define_insn "load_toc_v4_PIC_1_476"
11276 [(set (reg:SI LR_REGNO)
11277 (match_operand:SI 0 "immediate_operand" "s"))
11278 (use (unspec [(match_dup 0)] UNSPEC_TOC))]
11279 "TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI == ABI_V4
11280 && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
11284 static char templ[32];
11286 get_ppc476_thunk_name (name);
11287 sprintf (templ, \"bl %s\\n%%0:\", name);
11290 [(set_attr "type" "branch")
11291 (set_attr "length" "4")])
11293 (define_expand "load_toc_v4_PIC_1b"
11294 [(parallel [(set (reg:SI LR_REGNO)
11295 (unspec:SI [(match_operand:SI 0 "immediate_operand" "s")
11296 (label_ref (match_operand 1 "" ""))]
11299 "TARGET_ELF && DEFAULT_ABI == ABI_V4 && flag_pic == 2"
11302 (define_insn "load_toc_v4_PIC_1b_normal"
11303 [(set (reg:SI LR_REGNO)
11304 (unspec:SI [(match_operand:SI 0 "immediate_operand" "s")
11305 (label_ref (match_operand 1 "" ""))]
11308 "!TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI == ABI_V4 && flag_pic == 2"
11309 "bcl 20,31,$+8\;.long %0-$"
11310 [(set_attr "type" "branch")
11311 (set_attr "length" "8")])
11313 (define_insn "load_toc_v4_PIC_1b_476"
11314 [(set (reg:SI LR_REGNO)
11315 (unspec:SI [(match_operand:SI 0 "immediate_operand" "s")
11316 (label_ref (match_operand 1 "" ""))]
11319 "TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI == ABI_V4 && flag_pic == 2"
11323 static char templ[32];
11325 get_ppc476_thunk_name (name);
11326 sprintf (templ, \"bl %s\\n\\tb $+8\\n\\t.long %%0-$\", name);
11329 [(set_attr "type" "branch")
11330 (set_attr "length" "16")])
11332 (define_insn "load_toc_v4_PIC_2"
11333 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11334 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
11335 (minus:SI (match_operand:SI 2 "immediate_operand" "s")
11336 (match_operand:SI 3 "immediate_operand" "s")))))]
11337 "TARGET_ELF && DEFAULT_ABI == ABI_V4 && flag_pic == 2"
11339 [(set_attr "type" "load")])
11341 (define_insn "load_toc_v4_PIC_3b"
11342 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11343 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
11345 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
11346 (match_operand:SI 3 "symbol_ref_operand" "s")))))]
11347 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI == ABI_V4 && flag_pic"
11348 "addis %0,%1,%2-%3@ha")
11350 (define_insn "load_toc_v4_PIC_3c"
11351 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11352 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
11353 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
11354 (match_operand:SI 3 "symbol_ref_operand" "s"))))]
11355 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI == ABI_V4 && flag_pic"
11356 "addi %0,%1,%2-%3@l")
11358 ;; If the TOC is shared over a translation unit, as happens with all
11359 ;; the kinds of PIC that we support, we need to restore the TOC
11360 ;; pointer only when jumping over units of translation.
11361 ;; On Darwin, we need to reload the picbase.
11363 (define_expand "builtin_setjmp_receiver"
11364 [(use (label_ref (match_operand 0 "" "")))]
11365 "(DEFAULT_ABI == ABI_V4 && flag_pic == 1)
11366 || (TARGET_TOC && TARGET_MINIMAL_TOC)
11367 || (DEFAULT_ABI == ABI_DARWIN && flag_pic)"
11371 if (DEFAULT_ABI == ABI_DARWIN)
11373 rtx picrtx = gen_rtx_SYMBOL_REF (Pmode, MACHOPIC_FUNCTION_BASE_NAME);
11374 rtx picreg = gen_rtx_REG (Pmode, RS6000_PIC_OFFSET_TABLE_REGNUM);
11378 crtl->uses_pic_offset_table = 1;
11379 ASM_GENERATE_INTERNAL_LABEL(tmplab, \"LSJR\",
11380 CODE_LABEL_NUMBER (operands[0]));
11381 tmplabrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (tmplab));
11383 emit_insn (gen_load_macho_picbase (tmplabrtx));
11384 emit_move_insn (picreg, gen_rtx_REG (Pmode, LR_REGNO));
11385 emit_insn (gen_macho_correct_pic (picreg, picreg, picrtx, tmplabrtx));
11389 rs6000_emit_load_toc_table (FALSE);
11393 ;; Largetoc support
11394 (define_insn "*largetoc_high"
11395 [(set (match_operand:DI 0 "gpc_reg_operand" "=b*r")
11397 (unspec [(match_operand:DI 1 "" "")
11398 (match_operand:DI 2 "gpc_reg_operand" "b")]
11400 "TARGET_ELF && TARGET_CMODEL != CMODEL_SMALL"
11401 "addis %0,%2,%1@toc@ha")
11403 (define_insn "*largetoc_high_aix<mode>"
11404 [(set (match_operand:P 0 "gpc_reg_operand" "=b*r")
11406 (unspec [(match_operand:P 1 "" "")
11407 (match_operand:P 2 "gpc_reg_operand" "b")]
11409 "TARGET_XCOFF && TARGET_CMODEL != CMODEL_SMALL"
11410 "addis %0,%1@u(%2)")
11412 (define_insn "*largetoc_high_plus"
11413 [(set (match_operand:DI 0 "gpc_reg_operand" "=b*r")
11416 (unspec [(match_operand:DI 1 "" "")
11417 (match_operand:DI 2 "gpc_reg_operand" "b")]
11419 (match_operand:DI 3 "add_cint_operand" "n"))))]
11420 "TARGET_ELF && TARGET_CMODEL != CMODEL_SMALL"
11421 "addis %0,%2,%1+%3@toc@ha")
11423 (define_insn "*largetoc_high_plus_aix<mode>"
11424 [(set (match_operand:P 0 "gpc_reg_operand" "=b*r")
11427 (unspec [(match_operand:P 1 "" "")
11428 (match_operand:P 2 "gpc_reg_operand" "b")]
11430 (match_operand:P 3 "add_cint_operand" "n"))))]
11431 "TARGET_XCOFF && TARGET_CMODEL != CMODEL_SMALL"
11432 "addis %0,%1+%3@u(%2)")
11434 (define_insn "*largetoc_low"
11435 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
11436 (lo_sum:DI (match_operand:DI 1 "gpc_reg_operand" "b,!*r")
11437 (match_operand:DI 2 "" "")))]
11438 "TARGET_ELF && TARGET_CMODEL != CMODEL_SMALL"
11443 (define_insn "*largetoc_low_aix<mode>"
11444 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
11445 (lo_sum:P (match_operand:P 1 "gpc_reg_operand" "b")
11446 (match_operand:P 2 "" "")))]
11447 "TARGET_XCOFF && TARGET_CMODEL != CMODEL_SMALL"
11450 (define_insn_and_split "*tocref<mode>"
11451 [(set (match_operand:P 0 "gpc_reg_operand" "=b*r")
11452 (match_operand:P 1 "small_toc_ref" "R"))]
11455 "&& TARGET_CMODEL != CMODEL_SMALL && reload_completed"
11456 [(set (match_dup 0) (high:P (match_dup 1)))
11457 (set (match_dup 0) (lo_sum:P (match_dup 0) (match_dup 1)))])
11459 ;; Elf specific ways of loading addresses for non-PIC code.
11460 ;; The output of this could be r0, but we make a very strong
11461 ;; preference for a base register because it will usually
11462 ;; be needed there.
11463 (define_insn "elf_high"
11464 [(set (match_operand:SI 0 "gpc_reg_operand" "=b*r")
11465 (high:SI (match_operand 1 "" "")))]
11466 "TARGET_ELF && ! TARGET_64BIT"
11469 (define_insn "elf_low"
11470 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11471 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,!*r")
11472 (match_operand 2 "" "")))]
11473 "TARGET_ELF && ! TARGET_64BIT"
11478 ;; Call and call_value insns
11479 (define_expand "call"
11480 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
11481 (match_operand 1 "" ""))
11482 (use (match_operand 2 "" ""))
11483 (clobber (reg:SI LR_REGNO))])]
11488 if (MACHOPIC_INDIRECT)
11489 operands[0] = machopic_indirect_call_target (operands[0]);
11492 gcc_assert (GET_CODE (operands[0]) == MEM);
11493 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
11495 operands[0] = XEXP (operands[0], 0);
11497 if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
11499 rs6000_call_aix (NULL_RTX, operands[0], operands[1], operands[2]);
11503 if (GET_CODE (operands[0]) != SYMBOL_REF
11504 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[2]) & CALL_LONG) != 0))
11506 if (INTVAL (operands[2]) & CALL_LONG)
11507 operands[0] = rs6000_longcall_ref (operands[0]);
11509 switch (DEFAULT_ABI)
11513 operands[0] = force_reg (Pmode, operands[0]);
11517 gcc_unreachable ();
11522 (define_expand "call_value"
11523 [(parallel [(set (match_operand 0 "" "")
11524 (call (mem:SI (match_operand 1 "address_operand" ""))
11525 (match_operand 2 "" "")))
11526 (use (match_operand 3 "" ""))
11527 (clobber (reg:SI LR_REGNO))])]
11532 if (MACHOPIC_INDIRECT)
11533 operands[1] = machopic_indirect_call_target (operands[1]);
11536 gcc_assert (GET_CODE (operands[1]) == MEM);
11537 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
11539 operands[1] = XEXP (operands[1], 0);
11541 if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
11543 rs6000_call_aix (operands[0], operands[1], operands[2], operands[3]);
11547 if (GET_CODE (operands[1]) != SYMBOL_REF
11548 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[3]) & CALL_LONG) != 0))
11550 if (INTVAL (operands[3]) & CALL_LONG)
11551 operands[1] = rs6000_longcall_ref (operands[1]);
11553 switch (DEFAULT_ABI)
11557 operands[1] = force_reg (Pmode, operands[1]);
11561 gcc_unreachable ();
11566 ;; Call to function in current module. No TOC pointer reload needed.
11567 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
11568 ;; either the function was not prototyped, or it was prototyped as a
11569 ;; variable argument function. It is > 0 if FP registers were passed
11570 ;; and < 0 if they were not.
11572 (define_insn "*call_local32"
11573 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
11574 (match_operand 1 "" "g,g"))
11575 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11576 (clobber (reg:SI LR_REGNO))]
11577 "(INTVAL (operands[2]) & CALL_LONG) == 0"
11580 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11581 output_asm_insn (\"crxor 6,6,6\", operands);
11583 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11584 output_asm_insn (\"creqv 6,6,6\", operands);
11586 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
11588 [(set_attr "type" "branch")
11589 (set_attr "length" "4,8")])
11591 (define_insn "*call_local64"
11592 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
11593 (match_operand 1 "" "g,g"))
11594 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11595 (clobber (reg:SI LR_REGNO))]
11596 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
11599 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11600 output_asm_insn (\"crxor 6,6,6\", operands);
11602 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11603 output_asm_insn (\"creqv 6,6,6\", operands);
11605 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
11607 [(set_attr "type" "branch")
11608 (set_attr "length" "4,8")])
11610 (define_insn "*call_value_local32"
11611 [(set (match_operand 0 "" "")
11612 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
11613 (match_operand 2 "" "g,g")))
11614 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11615 (clobber (reg:SI LR_REGNO))]
11616 "(INTVAL (operands[3]) & CALL_LONG) == 0"
11619 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11620 output_asm_insn (\"crxor 6,6,6\", operands);
11622 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11623 output_asm_insn (\"creqv 6,6,6\", operands);
11625 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
11627 [(set_attr "type" "branch")
11628 (set_attr "length" "4,8")])
11631 (define_insn "*call_value_local64"
11632 [(set (match_operand 0 "" "")
11633 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
11634 (match_operand 2 "" "g,g")))
11635 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11636 (clobber (reg:SI LR_REGNO))]
11637 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
11640 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11641 output_asm_insn (\"crxor 6,6,6\", operands);
11643 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11644 output_asm_insn (\"creqv 6,6,6\", operands);
11646 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
11648 [(set_attr "type" "branch")
11649 (set_attr "length" "4,8")])
11652 ;; A function pointer under System V is just a normal pointer
11653 ;; operands[0] is the function pointer
11654 ;; operands[1] is the stack size to clean up
11655 ;; operands[2] is the value FUNCTION_ARG returns for the VOID argument
11656 ;; which indicates how to set cr1
11658 (define_insn "*call_indirect_nonlocal_sysv<mode>"
11659 [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l,c,*l"))
11660 (match_operand 1 "" "g,g,g,g"))
11661 (use (match_operand:SI 2 "immediate_operand" "O,O,n,n"))
11662 (clobber (reg:SI LR_REGNO))]
11663 "DEFAULT_ABI == ABI_V4
11664 || DEFAULT_ABI == ABI_DARWIN"
11666 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11667 output_asm_insn ("crxor 6,6,6", operands);
11669 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11670 output_asm_insn ("creqv 6,6,6", operands);
11674 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
11675 (set_attr "length" "4,4,8,8")])
11677 (define_insn_and_split "*call_nonlocal_sysv<mode>"
11678 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
11679 (match_operand 1 "" "g,g"))
11680 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11681 (clobber (reg:SI LR_REGNO))]
11682 "(DEFAULT_ABI == ABI_DARWIN
11683 || (DEFAULT_ABI == ABI_V4
11684 && (INTVAL (operands[2]) & CALL_LONG) == 0))"
11686 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11687 output_asm_insn ("crxor 6,6,6", operands);
11689 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11690 output_asm_insn ("creqv 6,6,6", operands);
11693 return output_call(insn, operands, 0, 2);
11695 if (DEFAULT_ABI == ABI_V4 && flag_pic)
11697 gcc_assert (!TARGET_SECURE_PLT);
11698 return "bl %z0@plt";
11704 "DEFAULT_ABI == ABI_V4
11705 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[0])
11706 && (INTVAL (operands[2]) & CALL_LONG) == 0"
11707 [(parallel [(call (mem:SI (match_dup 0))
11709 (use (match_dup 2))
11710 (use (match_dup 3))
11711 (clobber (reg:SI LR_REGNO))])]
11713 operands[3] = pic_offset_table_rtx;
11715 [(set_attr "type" "branch,branch")
11716 (set_attr "length" "4,8")])
11718 (define_insn "*call_nonlocal_sysv_secure<mode>"
11719 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
11720 (match_operand 1 "" "g,g"))
11721 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11722 (use (match_operand:SI 3 "register_operand" "r,r"))
11723 (clobber (reg:SI LR_REGNO))]
11724 "(DEFAULT_ABI == ABI_V4
11725 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[0])
11726 && (INTVAL (operands[2]) & CALL_LONG) == 0)"
11728 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11729 output_asm_insn ("crxor 6,6,6", operands);
11731 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11732 output_asm_insn ("creqv 6,6,6", operands);
11735 /* The magic 32768 offset here and in the other sysv call insns
11736 corresponds to the offset of r30 in .got2, as given by LCTOC1.
11737 See sysv4.h:toc_section. */
11738 return "bl %z0+32768@plt";
11740 return "bl %z0@plt";
11742 [(set_attr "type" "branch,branch")
11743 (set_attr "length" "4,8")])
11745 (define_insn "*call_value_indirect_nonlocal_sysv<mode>"
11746 [(set (match_operand 0 "" "")
11747 (call (mem:SI (match_operand:P 1 "register_operand" "c,*l,c,*l"))
11748 (match_operand 2 "" "g,g,g,g")))
11749 (use (match_operand:SI 3 "immediate_operand" "O,O,n,n"))
11750 (clobber (reg:SI LR_REGNO))]
11751 "DEFAULT_ABI == ABI_V4
11752 || DEFAULT_ABI == ABI_DARWIN"
11754 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11755 output_asm_insn ("crxor 6,6,6", operands);
11757 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11758 output_asm_insn ("creqv 6,6,6", operands);
11762 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
11763 (set_attr "length" "4,4,8,8")])
11765 (define_insn_and_split "*call_value_nonlocal_sysv<mode>"
11766 [(set (match_operand 0 "" "")
11767 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
11768 (match_operand 2 "" "g,g")))
11769 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11770 (clobber (reg:SI LR_REGNO))]
11771 "(DEFAULT_ABI == ABI_DARWIN
11772 || (DEFAULT_ABI == ABI_V4
11773 && (INTVAL (operands[3]) & CALL_LONG) == 0))"
11775 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11776 output_asm_insn ("crxor 6,6,6", operands);
11778 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11779 output_asm_insn ("creqv 6,6,6", operands);
11782 return output_call(insn, operands, 1, 3);
11784 if (DEFAULT_ABI == ABI_V4 && flag_pic)
11786 gcc_assert (!TARGET_SECURE_PLT);
11787 return "bl %z1@plt";
11793 "DEFAULT_ABI == ABI_V4
11794 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[1])
11795 && (INTVAL (operands[3]) & CALL_LONG) == 0"
11796 [(parallel [(set (match_dup 0)
11797 (call (mem:SI (match_dup 1))
11799 (use (match_dup 3))
11800 (use (match_dup 4))
11801 (clobber (reg:SI LR_REGNO))])]
11803 operands[4] = pic_offset_table_rtx;
11805 [(set_attr "type" "branch,branch")
11806 (set_attr "length" "4,8")])
11808 (define_insn "*call_value_nonlocal_sysv_secure<mode>"
11809 [(set (match_operand 0 "" "")
11810 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
11811 (match_operand 2 "" "g,g")))
11812 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11813 (use (match_operand:SI 4 "register_operand" "r,r"))
11814 (clobber (reg:SI LR_REGNO))]
11815 "(DEFAULT_ABI == ABI_V4
11816 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[1])
11817 && (INTVAL (operands[3]) & CALL_LONG) == 0)"
11819 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11820 output_asm_insn ("crxor 6,6,6", operands);
11822 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11823 output_asm_insn ("creqv 6,6,6", operands);
11826 return "bl %z1+32768@plt";
11828 return "bl %z1@plt";
11830 [(set_attr "type" "branch,branch")
11831 (set_attr "length" "4,8")])
11834 ;; Call to AIX abi function in the same module.
11836 (define_insn "*call_local_aix<mode>"
11837 [(call (mem:SI (match_operand:P 0 "current_file_function_operand" "s"))
11838 (match_operand 1 "" "g"))
11839 (clobber (reg:P LR_REGNO))]
11840 "DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2"
11842 [(set_attr "type" "branch")
11843 (set_attr "length" "4")])
11845 (define_insn "*call_value_local_aix<mode>"
11846 [(set (match_operand 0 "" "")
11847 (call (mem:SI (match_operand:P 1 "current_file_function_operand" "s"))
11848 (match_operand 2 "" "g")))
11849 (clobber (reg:P LR_REGNO))]
11850 "DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2"
11852 [(set_attr "type" "branch")
11853 (set_attr "length" "4")])
11855 ;; Call to AIX abi function which may be in another module.
11856 ;; Restore the TOC pointer (r2) after the call.
11858 (define_insn "*call_nonlocal_aix<mode>"
11859 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s"))
11860 (match_operand 1 "" "g"))
11861 (clobber (reg:P LR_REGNO))]
11862 "DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2"
11864 [(set_attr "type" "branch")
11865 (set_attr "length" "8")])
11867 (define_insn "*call_value_nonlocal_aix<mode>"
11868 [(set (match_operand 0 "" "")
11869 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s"))
11870 (match_operand 2 "" "g")))
11871 (clobber (reg:P LR_REGNO))]
11872 "DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2"
11874 [(set_attr "type" "branch")
11875 (set_attr "length" "8")])
11877 ;; Call to indirect functions with the AIX abi using a 3 word descriptor.
11878 ;; Operand0 is the addresss of the function to call
11879 ;; Operand2 is the location in the function descriptor to load r2 from
11880 ;; Operand3 is the stack location to hold the current TOC pointer
11882 (define_insn "*call_indirect_aix<mode>"
11883 [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l"))
11884 (match_operand 1 "" "g,g"))
11885 (use (match_operand:P 2 "memory_operand" "<ptrm>,<ptrm>"))
11886 (set (reg:P TOC_REGNUM) (match_operand:P 3 "memory_operand" "<ptrm>,<ptrm>"))
11887 (clobber (reg:P LR_REGNO))]
11888 "DEFAULT_ABI == ABI_AIX"
11889 "<ptrload> 2,%2\;b%T0l\;<ptrload> 2,%3"
11890 [(set_attr "type" "jmpreg")
11891 (set_attr "length" "12")])
11893 (define_insn "*call_value_indirect_aix<mode>"
11894 [(set (match_operand 0 "" "")
11895 (call (mem:SI (match_operand:P 1 "register_operand" "c,*l"))
11896 (match_operand 2 "" "g,g")))
11897 (use (match_operand:P 3 "memory_operand" "<ptrm>,<ptrm>"))
11898 (set (reg:P TOC_REGNUM) (match_operand:P 4 "memory_operand" "<ptrm>,<ptrm>"))
11899 (clobber (reg:P LR_REGNO))]
11900 "DEFAULT_ABI == ABI_AIX"
11901 "<ptrload> 2,%3\;b%T1l\;<ptrload> 2,%4"
11902 [(set_attr "type" "jmpreg")
11903 (set_attr "length" "12")])
11905 ;; Call to indirect functions with the ELFv2 ABI.
11906 ;; Operand0 is the addresss of the function to call
11907 ;; Operand2 is the stack location to hold the current TOC pointer
11909 (define_insn "*call_indirect_elfv2<mode>"
11910 [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l"))
11911 (match_operand 1 "" "g,g"))
11912 (set (reg:P TOC_REGNUM) (match_operand:P 2 "memory_operand" "<ptrm>,<ptrm>"))
11913 (clobber (reg:P LR_REGNO))]
11914 "DEFAULT_ABI == ABI_ELFv2"
11915 "b%T0l\;<ptrload> 2,%2"
11916 [(set_attr "type" "jmpreg")
11917 (set_attr "length" "8")])
11919 (define_insn "*call_value_indirect_elfv2<mode>"
11920 [(set (match_operand 0 "" "")
11921 (call (mem:SI (match_operand:P 1 "register_operand" "c,*l"))
11922 (match_operand 2 "" "g,g")))
11923 (set (reg:P TOC_REGNUM) (match_operand:P 3 "memory_operand" "<ptrm>,<ptrm>"))
11924 (clobber (reg:P LR_REGNO))]
11925 "DEFAULT_ABI == ABI_ELFv2"
11926 "b%T1l\;<ptrload> 2,%3"
11927 [(set_attr "type" "jmpreg")
11928 (set_attr "length" "8")])
11931 ;; Call subroutine returning any type.
11932 (define_expand "untyped_call"
11933 [(parallel [(call (match_operand 0 "" "")
11935 (match_operand 1 "" "")
11936 (match_operand 2 "" "")])]
11942 emit_call_insn (GEN_CALL (operands[0], const0_rtx, const0_rtx, const0_rtx));
11944 for (i = 0; i < XVECLEN (operands[2], 0); i++)
11946 rtx set = XVECEXP (operands[2], 0, i);
11947 emit_move_insn (SET_DEST (set), SET_SRC (set));
11950 /* The optimizer does not know that the call sets the function value
11951 registers we stored in the result block. We avoid problems by
11952 claiming that all hard registers are used and clobbered at this
11954 emit_insn (gen_blockage ());
11959 ;; sibling call patterns
11960 (define_expand "sibcall"
11961 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
11962 (match_operand 1 "" ""))
11963 (use (match_operand 2 "" ""))
11964 (use (reg:SI LR_REGNO))
11970 if (MACHOPIC_INDIRECT)
11971 operands[0] = machopic_indirect_call_target (operands[0]);
11974 gcc_assert (GET_CODE (operands[0]) == MEM);
11975 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
11977 operands[0] = XEXP (operands[0], 0);
11979 if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
11981 rs6000_sibcall_aix (NULL_RTX, operands[0], operands[1], operands[2]);
11986 (define_expand "sibcall_value"
11987 [(parallel [(set (match_operand 0 "register_operand" "")
11988 (call (mem:SI (match_operand 1 "address_operand" ""))
11989 (match_operand 2 "" "")))
11990 (use (match_operand 3 "" ""))
11991 (use (reg:SI LR_REGNO))
11997 if (MACHOPIC_INDIRECT)
11998 operands[1] = machopic_indirect_call_target (operands[1]);
12001 gcc_assert (GET_CODE (operands[1]) == MEM);
12002 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
12004 operands[1] = XEXP (operands[1], 0);
12006 if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
12008 rs6000_sibcall_aix (operands[0], operands[1], operands[2], operands[3]);
12013 ;; this and similar patterns must be marked as using LR, otherwise
12014 ;; dataflow will try to delete the store into it. This is true
12015 ;; even when the actual reg to jump to is in CTR, when LR was
12016 ;; saved and restored around the PIC-setting BCL.
12017 (define_insn "*sibcall_local32"
12018 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
12019 (match_operand 1 "" "g,g"))
12020 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12021 (use (reg:SI LR_REGNO))
12023 "(INTVAL (operands[2]) & CALL_LONG) == 0"
12026 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12027 output_asm_insn (\"crxor 6,6,6\", operands);
12029 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12030 output_asm_insn (\"creqv 6,6,6\", operands);
12032 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
12034 [(set_attr "type" "branch")
12035 (set_attr "length" "4,8")])
12037 (define_insn "*sibcall_local64"
12038 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
12039 (match_operand 1 "" "g,g"))
12040 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12041 (use (reg:SI LR_REGNO))
12043 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
12046 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12047 output_asm_insn (\"crxor 6,6,6\", operands);
12049 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12050 output_asm_insn (\"creqv 6,6,6\", operands);
12052 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
12054 [(set_attr "type" "branch")
12055 (set_attr "length" "4,8")])
12057 (define_insn "*sibcall_value_local32"
12058 [(set (match_operand 0 "" "")
12059 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
12060 (match_operand 2 "" "g,g")))
12061 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12062 (use (reg:SI LR_REGNO))
12064 "(INTVAL (operands[3]) & CALL_LONG) == 0"
12067 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12068 output_asm_insn (\"crxor 6,6,6\", operands);
12070 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12071 output_asm_insn (\"creqv 6,6,6\", operands);
12073 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
12075 [(set_attr "type" "branch")
12076 (set_attr "length" "4,8")])
12078 (define_insn "*sibcall_value_local64"
12079 [(set (match_operand 0 "" "")
12080 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
12081 (match_operand 2 "" "g,g")))
12082 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12083 (use (reg:SI LR_REGNO))
12085 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
12088 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12089 output_asm_insn (\"crxor 6,6,6\", operands);
12091 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12092 output_asm_insn (\"creqv 6,6,6\", operands);
12094 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
12096 [(set_attr "type" "branch")
12097 (set_attr "length" "4,8")])
12099 (define_insn "*sibcall_nonlocal_sysv<mode>"
12100 [(call (mem:SI (match_operand:P 0 "call_operand" "s,s,c,c"))
12101 (match_operand 1 "" ""))
12102 (use (match_operand 2 "immediate_operand" "O,n,O,n"))
12103 (use (reg:SI LR_REGNO))
12105 "(DEFAULT_ABI == ABI_DARWIN
12106 || DEFAULT_ABI == ABI_V4)
12107 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12110 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12111 output_asm_insn (\"crxor 6,6,6\", operands);
12113 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12114 output_asm_insn (\"creqv 6,6,6\", operands);
12116 if (which_alternative >= 2)
12118 else if (DEFAULT_ABI == ABI_V4 && flag_pic)
12120 gcc_assert (!TARGET_SECURE_PLT);
12121 return \"b %z0@plt\";
12126 [(set_attr "type" "branch")
12127 (set_attr "length" "4,8,4,8")])
12129 (define_insn "*sibcall_value_nonlocal_sysv<mode>"
12130 [(set (match_operand 0 "" "")
12131 (call (mem:SI (match_operand:P 1 "call_operand" "s,s,c,c"))
12132 (match_operand 2 "" "")))
12133 (use (match_operand:SI 3 "immediate_operand" "O,n,O,n"))
12134 (use (reg:SI LR_REGNO))
12136 "(DEFAULT_ABI == ABI_DARWIN
12137 || DEFAULT_ABI == ABI_V4)
12138 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12141 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12142 output_asm_insn (\"crxor 6,6,6\", operands);
12144 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12145 output_asm_insn (\"creqv 6,6,6\", operands);
12147 if (which_alternative >= 2)
12149 else if (DEFAULT_ABI == ABI_V4 && flag_pic)
12151 gcc_assert (!TARGET_SECURE_PLT);
12152 return \"b %z1@plt\";
12157 [(set_attr "type" "branch")
12158 (set_attr "length" "4,8,4,8")])
12160 ;; AIX ABI sibling call patterns.
12162 (define_insn "*sibcall_aix<mode>"
12163 [(call (mem:SI (match_operand:P 0 "call_operand" "s,c"))
12164 (match_operand 1 "" "g,g"))
12166 "DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2"
12170 [(set_attr "type" "branch")
12171 (set_attr "length" "4")])
12173 (define_insn "*sibcall_value_aix<mode>"
12174 [(set (match_operand 0 "" "")
12175 (call (mem:SI (match_operand:P 1 "call_operand" "s,c"))
12176 (match_operand 2 "" "g,g")))
12178 "DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2"
12182 [(set_attr "type" "branch")
12183 (set_attr "length" "4")])
12185 (define_expand "sibcall_epilogue"
12186 [(use (const_int 0))]
12189 if (!TARGET_SCHED_PROLOG)
12190 emit_insn (gen_blockage ());
12191 rs6000_emit_epilogue (TRUE);
12195 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
12196 ;; all of memory. This blocks insns from being moved across this point.
12198 (define_insn "blockage"
12199 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCK)]
12203 (define_expand "probe_stack"
12204 [(set (match_operand 0 "memory_operand" "=m")
12205 (unspec [(const_int 0)] UNSPEC_PROBE_STACK))]
12209 emit_insn (gen_probe_stack_di (operands[0]));
12211 emit_insn (gen_probe_stack_si (operands[0]));
12215 (define_insn "probe_stack_<mode>"
12216 [(set (match_operand:P 0 "memory_operand" "=m")
12217 (unspec:P [(const_int 0)] UNSPEC_PROBE_STACK))]
12220 operands[1] = gen_rtx_REG (Pmode, 0);
12221 return "st<wd>%U0%X0 %1,%0";
12223 [(set_attr "type" "store")
12224 (set (attr "update")
12225 (if_then_else (match_operand 0 "update_address_mem")
12226 (const_string "yes")
12227 (const_string "no")))
12228 (set (attr "indexed")
12229 (if_then_else (match_operand 0 "indexed_address_mem")
12230 (const_string "yes")
12231 (const_string "no")))
12232 (set_attr "length" "4")])
12234 (define_insn "probe_stack_range<P:mode>"
12235 [(set (match_operand:P 0 "register_operand" "=r")
12236 (unspec_volatile:P [(match_operand:P 1 "register_operand" "0")
12237 (match_operand:P 2 "register_operand" "r")]
12238 UNSPECV_PROBE_STACK_RANGE))]
12240 "* return output_probe_stack_range (operands[0], operands[2]);"
12241 [(set_attr "type" "three")])
12243 ;; Compare insns are next. Note that the RS/6000 has two types of compares,
12244 ;; signed & unsigned, and one type of branch.
12246 ;; Start with the DEFINE_EXPANDs to generate the rtl for compares, scc
12247 ;; insns, and branches.
12249 (define_expand "cbranch<mode>4"
12250 [(use (match_operator 0 "rs6000_cbranch_operator"
12251 [(match_operand:GPR 1 "gpc_reg_operand" "")
12252 (match_operand:GPR 2 "reg_or_short_operand" "")]))
12253 (use (match_operand 3 ""))]
12257 /* Take care of the possibility that operands[2] might be negative but
12258 this might be a logical operation. That insn doesn't exist. */
12259 if (GET_CODE (operands[2]) == CONST_INT
12260 && INTVAL (operands[2]) < 0)
12262 operands[2] = force_reg (<MODE>mode, operands[2]);
12263 operands[0] = gen_rtx_fmt_ee (GET_CODE (operands[0]),
12264 GET_MODE (operands[0]),
12265 operands[1], operands[2]);
12268 rs6000_emit_cbranch (<MODE>mode, operands);
12272 (define_expand "cbranch<mode>4"
12273 [(use (match_operator 0 "rs6000_cbranch_operator"
12274 [(match_operand:FP 1 "gpc_reg_operand" "")
12275 (match_operand:FP 2 "gpc_reg_operand" "")]))
12276 (use (match_operand 3 ""))]
12280 rs6000_emit_cbranch (<MODE>mode, operands);
12284 (define_expand "cstore<mode>4"
12285 [(use (match_operator 1 "rs6000_cbranch_operator"
12286 [(match_operand:GPR 2 "gpc_reg_operand" "")
12287 (match_operand:GPR 3 "reg_or_short_operand" "")]))
12288 (clobber (match_operand:SI 0 "register_operand"))]
12292 /* Take care of the possibility that operands[3] might be negative but
12293 this might be a logical operation. That insn doesn't exist. */
12294 if (GET_CODE (operands[3]) == CONST_INT
12295 && INTVAL (operands[3]) < 0)
12297 operands[3] = force_reg (<MODE>mode, operands[3]);
12298 operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]),
12299 GET_MODE (operands[1]),
12300 operands[2], operands[3]);
12303 /* For SNE, we would prefer that the xor/abs sequence be used for integers.
12304 For SEQ, likewise, except that comparisons with zero should be done
12305 with an scc insns. However, due to the order that combine see the
12306 resulting insns, we must, in fact, allow SEQ for integers. Fail in
12307 the cases we don't want to handle or are best handled by portable
12309 if (GET_CODE (operands[1]) == NE)
12311 if ((GET_CODE (operands[1]) == LT || GET_CODE (operands[1]) == LE
12312 || GET_CODE (operands[1]) == GT || GET_CODE (operands[1]) == GE)
12313 && operands[3] == const0_rtx)
12315 rs6000_emit_sCOND (<MODE>mode, operands);
12319 (define_expand "cstore<mode>4"
12320 [(use (match_operator 1 "rs6000_cbranch_operator"
12321 [(match_operand:FP 2 "gpc_reg_operand" "")
12322 (match_operand:FP 3 "gpc_reg_operand" "")]))
12323 (clobber (match_operand:SI 0 "register_operand"))]
12327 rs6000_emit_sCOND (<MODE>mode, operands);
12332 (define_expand "stack_protect_set"
12333 [(match_operand 0 "memory_operand" "")
12334 (match_operand 1 "memory_operand" "")]
12337 #ifdef TARGET_THREAD_SSP_OFFSET
12338 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
12339 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
12340 operands[1] = gen_rtx_MEM (Pmode, addr);
12343 emit_insn (gen_stack_protect_setdi (operands[0], operands[1]));
12345 emit_insn (gen_stack_protect_setsi (operands[0], operands[1]));
12349 (define_insn "stack_protect_setsi"
12350 [(set (match_operand:SI 0 "memory_operand" "=m")
12351 (unspec:SI [(match_operand:SI 1 "memory_operand" "m")] UNSPEC_SP_SET))
12352 (set (match_scratch:SI 2 "=&r") (const_int 0))]
12354 "lwz%U1%X1 %2,%1\;stw%U0%X0 %2,%0\;li %2,0"
12355 [(set_attr "type" "three")
12356 (set_attr "length" "12")])
12358 (define_insn "stack_protect_setdi"
12359 [(set (match_operand:DI 0 "memory_operand" "=Y")
12360 (unspec:DI [(match_operand:DI 1 "memory_operand" "Y")] UNSPEC_SP_SET))
12361 (set (match_scratch:DI 2 "=&r") (const_int 0))]
12363 "ld%U1%X1 %2,%1\;std%U0%X0 %2,%0\;li %2,0"
12364 [(set_attr "type" "three")
12365 (set_attr "length" "12")])
12367 (define_expand "stack_protect_test"
12368 [(match_operand 0 "memory_operand" "")
12369 (match_operand 1 "memory_operand" "")
12370 (match_operand 2 "" "")]
12373 rtx test, op0, op1;
12374 #ifdef TARGET_THREAD_SSP_OFFSET
12375 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
12376 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
12377 operands[1] = gen_rtx_MEM (Pmode, addr);
12380 op1 = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, operands[1]), UNSPEC_SP_TEST);
12381 test = gen_rtx_EQ (VOIDmode, op0, op1);
12382 emit_jump_insn (gen_cbranchsi4 (test, op0, op1, operands[2]));
12386 (define_insn "stack_protect_testsi"
12387 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
12388 (unspec:CCEQ [(match_operand:SI 1 "memory_operand" "m,m")
12389 (match_operand:SI 2 "memory_operand" "m,m")]
12391 (set (match_scratch:SI 4 "=r,r") (const_int 0))
12392 (clobber (match_scratch:SI 3 "=&r,&r"))]
12395 lwz%U1%X1 %3,%1\;lwz%U2%X2 %4,%2\;xor. %3,%3,%4\;li %4,0
12396 lwz%U1%X1 %3,%1\;lwz%U2%X2 %4,%2\;cmplw %0,%3,%4\;li %3,0\;li %4,0"
12397 [(set_attr "length" "16,20")])
12399 (define_insn "stack_protect_testdi"
12400 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
12401 (unspec:CCEQ [(match_operand:DI 1 "memory_operand" "Y,Y")
12402 (match_operand:DI 2 "memory_operand" "Y,Y")]
12404 (set (match_scratch:DI 4 "=r,r") (const_int 0))
12405 (clobber (match_scratch:DI 3 "=&r,&r"))]
12408 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;xor. %3,%3,%4\;li %4,0
12409 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;cmpld %0,%3,%4\;li %3,0\;li %4,0"
12410 [(set_attr "length" "16,20")])
12413 ;; Here are the actual compare insns.
12414 (define_insn "*cmp<mode>_internal1"
12415 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
12416 (compare:CC (match_operand:GPR 1 "gpc_reg_operand" "r")
12417 (match_operand:GPR 2 "reg_or_short_operand" "rI")))]
12419 "cmp<wd>%I2 %0,%1,%2"
12420 [(set_attr "type" "cmp")])
12422 ;; If we are comparing a register for equality with a large constant,
12423 ;; we can do this with an XOR followed by a compare. But this is profitable
12424 ;; only if the large constant is only used for the comparison (and in this
12425 ;; case we already have a register to reuse as scratch).
12427 ;; For 64-bit registers, we could only do so if the constant's bit 15 is clear:
12428 ;; otherwise we'd need to XOR with FFFFFFFF????0000 which is not available.
12431 [(set (match_operand:SI 0 "register_operand")
12432 (match_operand:SI 1 "logical_const_operand" ""))
12433 (set (match_dup 0) (match_operator:SI 3 "boolean_or_operator"
12435 (match_operand:SI 2 "logical_const_operand" "")]))
12436 (set (match_operand:CC 4 "cc_reg_operand" "")
12437 (compare:CC (match_operand:SI 5 "gpc_reg_operand" "")
12440 (if_then_else (match_operator 6 "equality_operator"
12441 [(match_dup 4) (const_int 0)])
12442 (match_operand 7 "" "")
12443 (match_operand 8 "" "")))]
12444 "peep2_reg_dead_p (3, operands[0])
12445 && peep2_reg_dead_p (4, operands[4])"
12446 [(set (match_dup 0) (xor:SI (match_dup 5) (match_dup 9)))
12447 (set (match_dup 4) (compare:CC (match_dup 0) (match_dup 10)))
12448 (set (pc) (if_then_else (match_dup 6) (match_dup 7) (match_dup 8)))]
12451 /* Get the constant we are comparing against, and see what it looks like
12452 when sign-extended from 16 to 32 bits. Then see what constant we could
12453 XOR with SEXTC to get the sign-extended value. */
12454 rtx cnst = simplify_const_binary_operation (GET_CODE (operands[3]),
12456 operands[1], operands[2]);
12457 HOST_WIDE_INT c = INTVAL (cnst);
12458 HOST_WIDE_INT sextc = ((c & 0xffff) ^ 0x8000) - 0x8000;
12459 HOST_WIDE_INT xorv = c ^ sextc;
12461 operands[9] = GEN_INT (xorv);
12462 operands[10] = GEN_INT (sextc);
12465 (define_insn "*cmpsi_internal2"
12466 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
12467 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
12468 (match_operand:SI 2 "reg_or_u_short_operand" "rK")))]
12470 "cmplw%I2 %0,%1,%b2"
12471 [(set_attr "type" "cmp")])
12473 (define_insn "*cmpdi_internal2"
12474 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
12475 (compare:CCUNS (match_operand:DI 1 "gpc_reg_operand" "r")
12476 (match_operand:DI 2 "reg_or_u_short_operand" "rK")))]
12478 "cmpld%I2 %0,%1,%b2"
12479 [(set_attr "type" "cmp")])
12481 ;; The following two insns don't exist as single insns, but if we provide
12482 ;; them, we can swap an add and compare, which will enable us to overlap more
12483 ;; of the required delay between a compare and branch. We generate code for
12484 ;; them by splitting.
12487 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
12488 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
12489 (match_operand:SI 2 "short_cint_operand" "i")))
12490 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
12491 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
12494 [(set_attr "length" "8")])
12497 [(set (match_operand:CCUNS 3 "cc_reg_operand" "=y")
12498 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
12499 (match_operand:SI 2 "u_short_cint_operand" "i")))
12500 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
12501 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
12504 [(set_attr "length" "8")])
12507 [(set (match_operand:CC 3 "cc_reg_operand" "")
12508 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
12509 (match_operand:SI 2 "short_cint_operand" "")))
12510 (set (match_operand:SI 0 "gpc_reg_operand" "")
12511 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
12513 [(set (match_dup 3) (compare:CC (match_dup 1) (match_dup 2)))
12514 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
12517 [(set (match_operand:CCUNS 3 "cc_reg_operand" "")
12518 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "")
12519 (match_operand:SI 2 "u_short_cint_operand" "")))
12520 (set (match_operand:SI 0 "gpc_reg_operand" "")
12521 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
12523 [(set (match_dup 3) (compare:CCUNS (match_dup 1) (match_dup 2)))
12524 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
12526 ;; Only need to compare second words if first words equal
12527 (define_insn "*cmptf_internal1"
12528 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
12529 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "d")
12530 (match_operand:TF 2 "gpc_reg_operand" "d")))]
12531 "!TARGET_IEEEQUAD && !TARGET_XL_COMPAT
12532 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LONG_DOUBLE_128"
12533 "fcmpu %0,%1,%2\;bne %0,$+8\;fcmpu %0,%L1,%L2"
12534 [(set_attr "type" "fpcompare")
12535 (set_attr "length" "12")])
12537 (define_insn_and_split "*cmptf_internal2"
12538 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
12539 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "d")
12540 (match_operand:TF 2 "gpc_reg_operand" "d")))
12541 (clobber (match_scratch:DF 3 "=d"))
12542 (clobber (match_scratch:DF 4 "=d"))
12543 (clobber (match_scratch:DF 5 "=d"))
12544 (clobber (match_scratch:DF 6 "=d"))
12545 (clobber (match_scratch:DF 7 "=d"))
12546 (clobber (match_scratch:DF 8 "=d"))
12547 (clobber (match_scratch:DF 9 "=d"))
12548 (clobber (match_scratch:DF 10 "=d"))
12549 (clobber (match_scratch:GPR 11 "=b"))]
12550 "!TARGET_IEEEQUAD && TARGET_XL_COMPAT
12551 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LONG_DOUBLE_128"
12553 "&& reload_completed"
12554 [(set (match_dup 3) (match_dup 14))
12555 (set (match_dup 4) (match_dup 15))
12556 (set (match_dup 9) (abs:DF (match_dup 5)))
12557 (set (match_dup 0) (compare:CCFP (match_dup 9) (match_dup 3)))
12558 (set (pc) (if_then_else (ne (match_dup 0) (const_int 0))
12559 (label_ref (match_dup 12))
12561 (set (match_dup 0) (compare:CCFP (match_dup 5) (match_dup 7)))
12562 (set (pc) (label_ref (match_dup 13)))
12564 (set (match_dup 10) (minus:DF (match_dup 5) (match_dup 7)))
12565 (set (match_dup 9) (minus:DF (match_dup 6) (match_dup 8)))
12566 (set (match_dup 9) (plus:DF (match_dup 10) (match_dup 9)))
12567 (set (match_dup 0) (compare:CCFP (match_dup 9) (match_dup 4)))
12570 REAL_VALUE_TYPE rv;
12571 const int lo_word = LONG_DOUBLE_LARGE_FIRST ? GET_MODE_SIZE (DFmode) : 0;
12572 const int hi_word = LONG_DOUBLE_LARGE_FIRST ? 0 : GET_MODE_SIZE (DFmode);
12574 operands[5] = simplify_gen_subreg (DFmode, operands[1], TFmode, hi_word);
12575 operands[6] = simplify_gen_subreg (DFmode, operands[1], TFmode, lo_word);
12576 operands[7] = simplify_gen_subreg (DFmode, operands[2], TFmode, hi_word);
12577 operands[8] = simplify_gen_subreg (DFmode, operands[2], TFmode, lo_word);
12578 operands[12] = gen_label_rtx ();
12579 operands[13] = gen_label_rtx ();
12581 operands[14] = force_const_mem (DFmode,
12582 CONST_DOUBLE_FROM_REAL_VALUE (rv, DFmode));
12583 operands[15] = force_const_mem (DFmode,
12584 CONST_DOUBLE_FROM_REAL_VALUE (dconst0,
12589 tocref = create_TOC_reference (XEXP (operands[14], 0), operands[11]);
12590 operands[14] = gen_const_mem (DFmode, tocref);
12591 tocref = create_TOC_reference (XEXP (operands[15], 0), operands[11]);
12592 operands[15] = gen_const_mem (DFmode, tocref);
12593 set_mem_alias_set (operands[14], get_TOC_alias_set ());
12594 set_mem_alias_set (operands[15], get_TOC_alias_set ());
12598 ;; Now we have the scc insns. We can do some combinations because of the
12599 ;; way the machine works.
12601 ;; Note that this is probably faster if we can put an insn between the
12602 ;; mfcr and rlinm, but this is tricky. Let's leave it for now. In most
12603 ;; cases the insns below which don't use an intermediate CR field will
12604 ;; be used instead.
12606 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12607 (match_operator:SI 1 "scc_comparison_operator"
12608 [(match_operand 2 "cc_reg_operand" "y")
12611 "mfcr %0%Q2\;rlwinm %0,%0,%J1,1"
12612 [(set (attr "type")
12613 (cond [(match_test "TARGET_MFCRF")
12614 (const_string "mfcrf")
12616 (const_string "mfcr")))
12617 (set_attr "length" "8")])
12619 ;; Same as above, but get the GT bit.
12620 (define_insn "move_from_CR_gt_bit"
12621 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12622 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_GT))]
12623 "TARGET_HARD_FLOAT && !TARGET_FPRS"
12624 "mfcr %0\;rlwinm %0,%0,%D1,31,31"
12625 [(set_attr "type" "mfcr")
12626 (set_attr "length" "8")])
12628 ;; Same as above, but get the OV/ORDERED bit.
12629 (define_insn "move_from_CR_ov_bit"
12630 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12631 (unspec:SI [(match_operand:CC 1 "cc_reg_operand" "y")]
12634 "mfcr %0\;rlwinm %0,%0,%t1,1"
12635 [(set_attr "type" "mfcr")
12636 (set_attr "length" "8")])
12639 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12640 (match_operator:DI 1 "scc_comparison_operator"
12641 [(match_operand 2 "cc_reg_operand" "y")
12644 "mfcr %0%Q2\;rlwinm %0,%0,%J1,1"
12645 [(set (attr "type")
12646 (cond [(match_test "TARGET_MFCRF")
12647 (const_string "mfcrf")
12649 (const_string "mfcr")))
12650 (set_attr "length" "8")])
12653 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12654 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
12655 [(match_operand 2 "cc_reg_operand" "y,y")
12658 (set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
12659 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
12662 mfcr %3%Q2\;rlwinm. %3,%3,%J1,1
12664 [(set_attr "type" "shift")
12665 (set_attr "dot" "yes")
12666 (set_attr "length" "8,16")])
12669 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12670 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
12671 [(match_operand 2 "cc_reg_operand" "")
12674 (set (match_operand:SI 3 "gpc_reg_operand" "")
12675 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
12676 "TARGET_32BIT && reload_completed"
12677 [(set (match_dup 3)
12678 (match_op_dup 1 [(match_dup 2) (const_int 0)]))
12680 (compare:CC (match_dup 3)
12685 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12686 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
12687 [(match_operand 2 "cc_reg_operand" "y")
12689 (match_operand:SI 3 "const_int_operand" "n")))]
12693 int is_bit = ccr_bit (operands[1], 1);
12694 int put_bit = 31 - (INTVAL (operands[3]) & 31);
12697 if (is_bit >= put_bit)
12698 count = is_bit - put_bit;
12700 count = 32 - (put_bit - is_bit);
12702 operands[4] = GEN_INT (count);
12703 operands[5] = GEN_INT (put_bit);
12705 return \"mfcr %0%Q2\;rlwinm %0,%0,%4,%5,%5\";
12707 [(set (attr "type")
12708 (cond [(match_test "TARGET_MFCRF")
12709 (const_string "mfcrf")
12711 (const_string "mfcr")))
12712 (set_attr "length" "8")])
12715 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12717 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
12718 [(match_operand 2 "cc_reg_operand" "y,y")
12720 (match_operand:SI 3 "const_int_operand" "n,n"))
12722 (set (match_operand:SI 4 "gpc_reg_operand" "=r,r")
12723 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
12728 int is_bit = ccr_bit (operands[1], 1);
12729 int put_bit = 31 - (INTVAL (operands[3]) & 31);
12732 /* Force split for non-cc0 compare. */
12733 if (which_alternative == 1)
12736 if (is_bit >= put_bit)
12737 count = is_bit - put_bit;
12739 count = 32 - (put_bit - is_bit);
12741 operands[5] = GEN_INT (count);
12742 operands[6] = GEN_INT (put_bit);
12744 return \"mfcr %4%Q2\;rlwinm. %4,%4,%5,%6,%6\";
12746 [(set_attr "type" "shift")
12747 (set_attr "dot" "yes")
12748 (set_attr "length" "8,16")])
12751 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
12753 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
12754 [(match_operand 2 "cc_reg_operand" "")
12756 (match_operand:SI 3 "const_int_operand" ""))
12758 (set (match_operand:SI 4 "gpc_reg_operand" "")
12759 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
12762 [(set (match_dup 4)
12763 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
12766 (compare:CC (match_dup 4)
12770 ;; There is a 3 cycle delay between consecutive mfcr instructions
12771 ;; so it is useful to combine 2 scc instructions to use only one mfcr.
12774 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12775 (match_operator:SI 1 "scc_comparison_operator"
12776 [(match_operand 2 "cc_reg_operand" "y")
12778 (set (match_operand:SI 3 "gpc_reg_operand" "=r")
12779 (match_operator:SI 4 "scc_comparison_operator"
12780 [(match_operand 5 "cc_reg_operand" "y")
12782 "REGNO (operands[2]) != REGNO (operands[5])"
12783 "mfcr %3\;rlwinm %0,%3,%J1,1\;rlwinm %3,%3,%J4,1"
12784 [(set_attr "type" "mfcr")
12785 (set_attr "length" "12")])
12788 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12789 (match_operator:DI 1 "scc_comparison_operator"
12790 [(match_operand 2 "cc_reg_operand" "y")
12792 (set (match_operand:DI 3 "gpc_reg_operand" "=r")
12793 (match_operator:DI 4 "scc_comparison_operator"
12794 [(match_operand 5 "cc_reg_operand" "y")
12796 "TARGET_POWERPC64 && REGNO (operands[2]) != REGNO (operands[5])"
12797 "mfcr %3\;rlwinm %0,%3,%J1,1\;rlwinm %3,%3,%J4,1"
12798 [(set_attr "type" "mfcr")
12799 (set_attr "length" "12")])
12801 ;; There are some scc insns that can be done directly, without a compare.
12802 ;; These are faster because they don't involve the communications between
12803 ;; the FXU and branch units. In fact, we will be replacing all of the
12804 ;; integer scc insns here or in the portable methods in emit_store_flag.
12806 ;; Also support (neg (scc ..)) since that construct is used to replace
12807 ;; branches, (plus (scc ..) ..) since that construct is common and
12808 ;; takes no more insns than scc, and (and (neg (scc ..)) ..) in the
12809 ;; cases where it is no more expensive than (neg (scc ..)).
12811 ;; Have reload force a constant into a register for the simple insns that
12812 ;; otherwise won't accept constants. We do this because it is faster than
12813 ;; the cmp/mfcr sequence we would otherwise generate.
12815 (define_mode_attr scc_eq_op2 [(SI "rKLI")
12818 (define_insn_and_split "*eq<mode>"
12819 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
12820 (eq:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
12821 (match_operand:GPR 2 "scc_eq_operand" "<scc_eq_op2>")))]
12825 [(set (match_dup 0)
12826 (clz:GPR (match_dup 3)))
12828 (lshiftrt:GPR (match_dup 0) (match_dup 4)))]
12830 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
12832 /* Use output operand as intermediate. */
12833 operands[3] = operands[0];
12835 if (logical_operand (operands[2], <MODE>mode))
12836 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
12837 gen_rtx_XOR (<MODE>mode,
12838 operands[1], operands[2])));
12840 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
12841 gen_rtx_PLUS (<MODE>mode, operands[1],
12842 negate_rtx (<MODE>mode,
12846 operands[3] = operands[1];
12848 operands[4] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
12851 (define_insn_and_split "*eq<mode>_compare"
12852 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
12854 (eq:P (match_operand:P 1 "gpc_reg_operand" "=r")
12855 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))
12857 (set (match_operand:P 0 "gpc_reg_operand" "=r")
12858 (eq:P (match_dup 1) (match_dup 2)))]
12862 [(set (match_dup 0)
12863 (clz:P (match_dup 4)))
12864 (parallel [(set (match_dup 3)
12865 (compare:CC (lshiftrt:P (match_dup 0) (match_dup 5))
12868 (lshiftrt:P (match_dup 0) (match_dup 5)))])]
12870 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
12872 /* Use output operand as intermediate. */
12873 operands[4] = operands[0];
12875 if (logical_operand (operands[2], <MODE>mode))
12876 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
12877 gen_rtx_XOR (<MODE>mode,
12878 operands[1], operands[2])));
12880 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
12881 gen_rtx_PLUS (<MODE>mode, operands[1],
12882 negate_rtx (<MODE>mode,
12886 operands[4] = operands[1];
12888 operands[5] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
12891 ;; We have insns of the form shown by the first define_insn below. If
12892 ;; there is something inside the comparison operation, we must split it.
12894 [(set (match_operand:SI 0 "gpc_reg_operand" "")
12895 (plus:SI (match_operator 1 "comparison_operator"
12896 [(match_operand:SI 2 "" "")
12897 (match_operand:SI 3
12898 "reg_or_cint_operand" "")])
12899 (match_operand:SI 4 "gpc_reg_operand" "")))
12900 (clobber (match_operand:SI 5 "register_operand" ""))]
12901 "! gpc_reg_operand (operands[2], SImode)"
12902 [(set (match_dup 5) (match_dup 2))
12903 (set (match_dup 0) (plus:SI (match_op_dup 1 [(match_dup 5) (match_dup 3)])
12906 (define_insn "*plus_eqsi"
12907 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r")
12908 (plus:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
12909 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I"))
12910 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r")))]
12913 xor %0,%1,%2\;subfic %0,%0,0\;addze %0,%3
12914 subfic %0,%1,0\;addze %0,%3
12915 xori %0,%1,%b2\;subfic %0,%0,0\;addze %0,%3
12916 xoris %0,%1,%u2\;subfic %0,%0,0\;addze %0,%3
12917 subfic %0,%1,%2\;subfic %0,%0,0\;addze %0,%3"
12918 [(set_attr "type" "three,two,three,three,three")
12919 (set_attr "length" "12,8,12,12,12")])
12921 (define_insn "*compare_plus_eqsi"
12922 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
12925 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
12926 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
12927 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
12929 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r"))]
12930 "TARGET_32BIT && optimize_size"
12932 xor %4,%1,%2\;subfic %4,%4,0\;addze. %4,%3
12933 subfic %4,%1,0\;addze. %4,%3
12934 xori %4,%1,%b2\;subfic %4,%4,0\;addze. %4,%3
12935 xoris %4,%1,%u2\;subfic %4,%4,0\;addze. %4,%3
12936 subfic %4,%1,%2\;subfic %4,%4,0\;addze. %4,%3
12942 [(set_attr "type" "compare")
12943 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
12946 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12949 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
12950 (match_operand:SI 2 "scc_eq_operand" ""))
12951 (match_operand:SI 3 "gpc_reg_operand" ""))
12953 (clobber (match_scratch:SI 4 ""))]
12954 "TARGET_32BIT && optimize_size && reload_completed"
12955 [(set (match_dup 4)
12956 (plus:SI (eq:SI (match_dup 1)
12960 (compare:CC (match_dup 4)
12964 (define_insn "*plus_eqsi_compare"
12965 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
12968 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
12969 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
12970 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
12972 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r")
12973 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12974 "TARGET_32BIT && optimize_size"
12976 xor %0,%1,%2\;subfic %0,%0,0\;addze. %0,%3
12977 subfic %0,%1,0\;addze. %0,%3
12978 xori %0,%1,%b2\;subfic %0,%0,0\;addze. %0,%3
12979 xoris %0,%1,%u2\;subfic %0,%0,0\;addze. %0,%3
12980 subfic %0,%1,%2\;subfic %0,%0,0\;addze. %0,%3
12986 [(set_attr "type" "compare")
12987 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
12990 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12993 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
12994 (match_operand:SI 2 "scc_eq_operand" ""))
12995 (match_operand:SI 3 "gpc_reg_operand" ""))
12997 (set (match_operand:SI 0 "gpc_reg_operand" "")
12998 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12999 "TARGET_32BIT && optimize_size && reload_completed"
13000 [(set (match_dup 0)
13001 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13003 (compare:CC (match_dup 0)
13007 (define_insn "*neg_eq0<mode>"
13008 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13009 (neg:P (eq:P (match_operand:P 1 "gpc_reg_operand" "r")
13012 "addic %0,%1,-1\;subfe %0,%0,%0"
13013 [(set_attr "type" "two")
13014 (set_attr "length" "8")])
13016 (define_insn_and_split "*neg_eq<mode>"
13017 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13018 (neg:P (eq:P (match_operand:P 1 "gpc_reg_operand" "%r")
13019 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))))]
13023 [(set (match_dup 0) (neg:P (eq:P (match_dup 3) (const_int 0))))]
13025 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
13027 /* Use output operand as intermediate. */
13028 operands[3] = operands[0];
13030 if (logical_operand (operands[2], <MODE>mode))
13031 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13032 gen_rtx_XOR (<MODE>mode,
13033 operands[1], operands[2])));
13035 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13036 gen_rtx_PLUS (<MODE>mode, operands[1],
13037 negate_rtx (<MODE>mode,
13041 operands[3] = operands[1];
13044 (define_insn "*ne0_<mode>"
13045 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13046 (ne:P (match_operand:P 1 "gpc_reg_operand" "r")
13048 (clobber (match_scratch:P 2 "=&r"))]
13049 "!(TARGET_32BIT && TARGET_ISEL)"
13050 "addic %2,%1,-1\;subfe %0,%2,%1"
13051 [(set_attr "type" "two")
13052 (set_attr "length" "8")])
13054 (define_insn "*plus_ne0_<mode>"
13055 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13056 (plus:P (ne:P (match_operand:P 1 "gpc_reg_operand" "r")
13058 (match_operand:P 2 "gpc_reg_operand" "r")))
13059 (clobber (match_scratch:P 3 "=&r"))]
13061 "addic %3,%1,-1\;addze %0,%2"
13062 [(set_attr "type" "two")
13063 (set_attr "length" "8")])
13065 (define_insn "*compare_plus_ne0_<mode>"
13066 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13067 (compare:CC (plus:P (ne:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13069 (match_operand:P 2 "gpc_reg_operand" "r,r"))
13071 (clobber (match_scratch:P 3 "=&r,&r"))
13072 (clobber (match_scratch:P 4 "=X,&r"))]
13075 addic %3,%1,-1\;addze. %3,%2
13077 [(set_attr "type" "compare")
13078 (set_attr "length" "8,12")])
13081 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
13082 (compare:CC (ne:P (match_operand:SI 1 "gpc_reg_operand" "")
13084 (neg:P (match_operand:P 2 "gpc_reg_operand" ""))))
13085 (clobber (match_scratch:P 3 ""))
13086 (clobber (match_scratch:P 4 ""))]
13088 [(parallel [(set (match_dup 3)
13089 (plus:P (ne:P (match_dup 1)
13092 (clobber (match_dup 4))])
13094 (compare:CC (match_dup 3)
13099 (define_insn "*compare_plus_ne0_<mode>_1"
13100 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
13101 (compare:CCEQ (ne:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13103 (neg:P (match_operand:P 2 "gpc_reg_operand" "r,r"))))
13104 (clobber (match_scratch:P 3 "=&r,&r"))
13105 (clobber (match_scratch:P 4 "=X,&r"))]
13108 addic %3,%1,-1\;addze. %3,%2
13110 [(set_attr "type" "compare")
13111 (set_attr "length" "8,12")])
13114 [(set (match_operand:CCEQ 0 "cc_reg_not_micro_cr0_operand" "")
13115 (compare:CCEQ (ne:P (match_operand:SI 1 "gpc_reg_operand" "")
13117 (neg:P (match_operand:P 2 "gpc_reg_operand" ""))))
13118 (clobber (match_scratch:P 3 ""))
13119 (clobber (match_scratch:P 4 ""))]
13121 [(parallel [(set (match_dup 3)
13122 (plus:P (ne:P (match_dup 1)
13125 (clobber (match_dup 4))])
13127 (compare:CC (match_dup 3)
13131 (define_insn "*plus_ne0_<mode>_compare"
13132 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13134 (plus:P (ne:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13136 (match_operand:P 2 "gpc_reg_operand" "r,r"))
13138 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13139 (plus:P (ne:P (match_dup 1)
13142 (clobber (match_scratch:P 3 "=&r,&r"))]
13145 addic %3,%1,-1\;addze. %0,%2
13147 [(set_attr "type" "compare")
13148 (set_attr "length" "8,12")])
13151 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
13153 (plus:P (ne:P (match_operand:P 1 "gpc_reg_operand" "")
13155 (match_operand:P 2 "gpc_reg_operand" ""))
13157 (set (match_operand:P 0 "gpc_reg_operand" "")
13158 (plus:P (ne:P (match_dup 1)
13161 (clobber (match_scratch:P 3 ""))]
13163 [(parallel [(set (match_dup 0)
13164 (plus:P (ne:P (match_dup 1)
13167 (clobber (match_dup 3))])
13169 (compare:CC (match_dup 0)
13173 (define_insn "*leu<mode>"
13174 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13175 (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
13176 (match_operand:P 2 "reg_or_short_operand" "rI")))]
13178 "subf%I2c %0,%1,%2\;li %0,0\;adde %0,%0,%0"
13179 [(set_attr "type" "three")
13180 (set_attr "length" "12")])
13182 (define_insn "*leu<mode>_compare"
13183 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13185 (leu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13186 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
13188 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13189 (leu:P (match_dup 1) (match_dup 2)))]
13192 subf%I2c %0,%1,%2\;li %0,0\;adde. %0,%0,%0
13194 [(set_attr "type" "compare")
13195 (set_attr "length" "12,16")])
13198 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13200 (leu:P (match_operand:P 1 "gpc_reg_operand" "")
13201 (match_operand:P 2 "reg_or_short_operand" ""))
13203 (set (match_operand:P 0 "gpc_reg_operand" "")
13204 (leu:P (match_dup 1) (match_dup 2)))]
13206 [(set (match_dup 0)
13207 (leu:P (match_dup 1) (match_dup 2)))
13209 (compare:CC (match_dup 0)
13213 (define_insn "*plus_leu<mode>"
13214 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
13215 (plus:P (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
13216 (match_operand:P 2 "reg_or_short_operand" "rI"))
13217 (match_operand:P 3 "gpc_reg_operand" "r")))]
13219 "subf%I2c %0,%1,%2\;addze %0,%3"
13220 [(set_attr "type" "two")
13221 (set_attr "length" "8")])
13224 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13226 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13227 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13228 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13230 (clobber (match_scratch:SI 4 "=&r,&r"))]
13233 subf%I2c %4,%1,%2\;addze. %4,%3
13235 [(set_attr "type" "compare")
13236 (set_attr "length" "8,12")])
13239 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13241 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13242 (match_operand:SI 2 "reg_or_short_operand" ""))
13243 (match_operand:SI 3 "gpc_reg_operand" ""))
13245 (clobber (match_scratch:SI 4 ""))]
13246 "TARGET_32BIT && reload_completed"
13247 [(set (match_dup 4)
13248 (plus:SI (leu:SI (match_dup 1) (match_dup 2))
13251 (compare:CC (match_dup 4)
13256 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13258 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13259 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13260 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13262 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13263 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13266 subf%I2c %0,%1,%2\;addze. %0,%3
13268 [(set_attr "type" "compare")
13269 (set_attr "length" "8,12")])
13272 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13274 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13275 (match_operand:SI 2 "reg_or_short_operand" ""))
13276 (match_operand:SI 3 "gpc_reg_operand" ""))
13278 (set (match_operand:SI 0 "gpc_reg_operand" "")
13279 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13280 "TARGET_32BIT && reload_completed"
13281 [(set (match_dup 0)
13282 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13284 (compare:CC (match_dup 0)
13288 (define_insn "*neg_leu<mode>"
13289 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13290 (neg:P (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
13291 (match_operand:P 2 "reg_or_short_operand" "rI"))))]
13293 "subf%I2c %0,%1,%2\;subfe %0,%0,%0\;nand %0,%0,%0"
13294 [(set_attr "type" "three")
13295 (set_attr "length" "12")])
13297 (define_insn "*and_neg_leu<mode>"
13298 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
13300 (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
13301 (match_operand:P 2 "reg_or_short_operand" "rI")))
13302 (match_operand:P 3 "gpc_reg_operand" "r")))]
13304 "subf%I2c %0,%1,%2\;subfe %0,%0,%0\;andc %0,%3,%0"
13305 [(set_attr "type" "three")
13306 (set_attr "length" "12")])
13309 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13312 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13313 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
13314 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13316 (clobber (match_scratch:SI 4 "=&r,&r"))]
13319 subf%I2c %4,%1,%2\;subfe %4,%4,%4\;andc. %4,%3,%4
13321 [(set_attr "type" "compare")
13322 (set_attr "length" "12,16")])
13325 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13328 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13329 (match_operand:SI 2 "reg_or_short_operand" "")))
13330 (match_operand:SI 3 "gpc_reg_operand" ""))
13332 (clobber (match_scratch:SI 4 ""))]
13333 "TARGET_32BIT && reload_completed"
13334 [(set (match_dup 4)
13335 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
13338 (compare:CC (match_dup 4)
13343 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13346 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13347 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
13348 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13350 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13351 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13354 subf%I2c %0,%1,%2\;subfe %0,%0,%0\;andc. %0,%3,%0
13356 [(set_attr "type" "compare")
13357 (set_attr "length" "12,16")])
13360 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13363 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13364 (match_operand:SI 2 "reg_or_short_operand" "")))
13365 (match_operand:SI 3 "gpc_reg_operand" ""))
13367 (set (match_operand:SI 0 "gpc_reg_operand" "")
13368 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13369 "TARGET_32BIT && reload_completed"
13370 [(set (match_dup 0)
13371 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
13374 (compare:CC (match_dup 0)
13378 (define_insn_and_split "*ltu<mode>"
13379 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13380 (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13381 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))]
13385 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
13386 (set (match_dup 0) (neg:P (match_dup 0)))]
13389 (define_insn_and_split "*ltu<mode>_compare"
13390 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
13392 (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
13393 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
13395 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
13396 (ltu:P (match_dup 1) (match_dup 2)))]
13400 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
13401 (parallel [(set (match_dup 3)
13402 (compare:CC (neg:P (match_dup 0)) (const_int 0)))
13403 (set (match_dup 0) (neg:P (match_dup 0)))])]
13406 (define_insn_and_split "*plus_ltu<mode>"
13407 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,r")
13408 (plus:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13409 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))
13410 (match_operand:P 3 "reg_or_short_operand" "rI,rI")))]
13413 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13414 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
13415 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))]
13418 (define_insn_and_split "*plus_ltu<mode>_compare"
13419 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13421 (plus:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
13422 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
13423 (match_operand:P 3 "gpc_reg_operand" "r,r,r,r"))
13425 (set (match_operand:P 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13426 (plus:P (ltu:P (match_dup 1) (match_dup 2)) (match_dup 3)))]
13429 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13430 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
13431 (parallel [(set (match_dup 4)
13432 (compare:CC (minus:P (match_dup 3) (match_dup 0))
13434 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))])]
13437 (define_insn "*neg_ltu<mode>"
13438 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13439 (neg:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13440 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))))]
13443 subfc %0,%2,%1\;subfe %0,%0,%0
13444 addic %0,%1,%n2\;subfe %0,%0,%0"
13445 [(set_attr "type" "two")
13446 (set_attr "length" "8")])
13448 (define_insn "*geu<mode>"
13449 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13450 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13451 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))]
13454 subfc %0,%2,%1\;li %0,0\;adde %0,%0,%0
13455 addic %0,%1,%n2\;li %0,0\;adde %0,%0,%0"
13456 [(set_attr "type" "three")
13457 (set_attr "length" "12")])
13459 (define_insn "*geu<mode>_compare"
13460 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
13462 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
13463 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
13465 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
13466 (geu:P (match_dup 1) (match_dup 2)))]
13469 subfc %0,%2,%1\;li %0,0\;adde. %0,%0,%0
13470 addic %0,%1,%n2\;li %0,0\;adde. %0,%0,%0
13473 [(set_attr "type" "compare")
13474 (set_attr "length" "12,12,16,16")])
13477 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
13479 (geu:P (match_operand:P 1 "gpc_reg_operand" "")
13480 (match_operand:P 2 "reg_or_neg_short_operand" ""))
13482 (set (match_operand:P 0 "gpc_reg_operand" "")
13483 (geu:P (match_dup 1) (match_dup 2)))]
13485 [(set (match_dup 0)
13486 (geu:P (match_dup 1) (match_dup 2)))
13488 (compare:CC (match_dup 0)
13492 (define_insn "*plus_geu<mode>"
13493 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,&r")
13494 (plus:P (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13495 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))
13496 (match_operand:P 3 "gpc_reg_operand" "r,r")))]
13499 subfc %0,%2,%1\;addze %0,%3
13500 addic %0,%1,%n2\;addze %0,%3"
13501 [(set_attr "type" "two")
13502 (set_attr "length" "8")])
13505 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13507 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13508 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
13509 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13511 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
13514 subfc %4,%2,%1\;addze. %4,%3
13515 addic %4,%1,%n2\;addze. %4,%3
13518 [(set_attr "type" "compare")
13519 (set_attr "length" "8,8,12,12")])
13522 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13524 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13525 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
13526 (match_operand:SI 3 "gpc_reg_operand" ""))
13528 (clobber (match_scratch:SI 4 ""))]
13529 "TARGET_32BIT && reload_completed"
13530 [(set (match_dup 4)
13531 (plus:SI (geu:SI (match_dup 1) (match_dup 2))
13534 (compare:CC (match_dup 4)
13539 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13541 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13542 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
13543 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13545 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13546 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13549 subfc %0,%2,%1\;addze. %0,%3
13550 addic %0,%1,%n2\;addze. %0,%3
13553 [(set_attr "type" "compare")
13554 (set_attr "length" "8,8,12,12")])
13557 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13559 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13560 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
13561 (match_operand:SI 3 "gpc_reg_operand" ""))
13563 (set (match_operand:SI 0 "gpc_reg_operand" "")
13564 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13565 "TARGET_32BIT && reload_completed"
13566 [(set (match_dup 0)
13567 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13569 (compare:CC (match_dup 0)
13573 (define_insn "*neg_geu<mode>"
13574 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13575 (neg:P (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13576 (match_operand:P 2 "reg_or_short_operand" "r,I"))))]
13579 subfc %0,%2,%1\;subfe %0,%0,%0\;nand %0,%0,%0
13580 subfic %0,%1,-1\;add%I2c %0,%0,%2\;subfe %0,%0,%0"
13581 [(set_attr "type" "three")
13582 (set_attr "length" "12")])
13584 (define_insn "*and_neg_geu<mode>"
13585 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,&r")
13587 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13588 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))
13589 (match_operand:P 3 "gpc_reg_operand" "r,r")))]
13592 subfc %0,%2,%1\;subfe %0,%0,%0\;andc %0,%3,%0
13593 addic %0,%1,%n2\;subfe %0,%0,%0\;andc %0,%3,%0"
13594 [(set_attr "type" "three")
13595 (set_attr "length" "12")])
13598 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13601 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13602 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
13603 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13605 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
13608 subfc %4,%2,%1\;subfe %4,%4,%4\;andc. %4,%3,%4
13609 addic %4,%1,%n2\;subfe %4,%4,%4\;andc. %4,%3,%4
13612 [(set_attr "type" "compare")
13613 (set_attr "length" "12,12,16,16")])
13616 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13619 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13620 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
13621 (match_operand:SI 3 "gpc_reg_operand" ""))
13623 (clobber (match_scratch:SI 4 ""))]
13624 "TARGET_32BIT && reload_completed"
13625 [(set (match_dup 4)
13626 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2)))
13629 (compare:CC (match_dup 4)
13634 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13637 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13638 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
13639 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13641 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13642 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13645 subfc %0,%2,%1\;subfe %0,%0,%0\;andc. %0,%3,%0
13646 addic %0,%1,%n2\;subfe %0,%0,%0\;andc. %0,%3,%0
13649 [(set_attr "type" "compare")
13650 (set_attr "length" "12,12,16,16")])
13653 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13656 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13657 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
13658 (match_operand:SI 3 "gpc_reg_operand" ""))
13660 (set (match_operand:SI 0 "gpc_reg_operand" "")
13661 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13662 "TARGET_32BIT && reload_completed"
13663 [(set (match_dup 0)
13664 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
13666 (compare:CC (match_dup 0)
13670 (define_insn "*plus_gt0<mode>"
13671 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
13672 (plus:P (gt:P (match_operand:P 1 "gpc_reg_operand" "r")
13674 (match_operand:P 2 "gpc_reg_operand" "r")))]
13676 "addc %0,%1,%1\;subfe %0,%1,%0\;addze %0,%2"
13677 [(set_attr "type" "three")
13678 (set_attr "length" "12")])
13681 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13683 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13685 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
13687 (clobber (match_scratch:SI 3 "=&r,&r"))]
13690 addc %3,%1,%1\;subfe %3,%1,%3\;addze. %3,%2
13692 [(set_attr "type" "compare")
13693 (set_attr "length" "12,16")])
13696 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13698 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13700 (match_operand:SI 2 "gpc_reg_operand" ""))
13702 (clobber (match_scratch:SI 3 ""))]
13703 "TARGET_32BIT && reload_completed"
13704 [(set (match_dup 3)
13705 (plus:SI (gt:SI (match_dup 1) (const_int 0))
13708 (compare:CC (match_dup 3)
13713 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13715 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13717 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
13719 (clobber (match_scratch:DI 3 "=&r,&r"))]
13722 addc %3,%1,%1\;subfe %3,%1,%3\;addze. %3,%2
13724 [(set_attr "type" "compare")
13725 (set_attr "length" "12,16")])
13728 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
13730 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
13732 (match_operand:DI 2 "gpc_reg_operand" ""))
13734 (clobber (match_scratch:DI 3 ""))]
13735 "TARGET_64BIT && reload_completed"
13736 [(set (match_dup 3)
13737 (plus:DI (gt:DI (match_dup 1) (const_int 0))
13740 (compare:CC (match_dup 3)
13745 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13747 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13749 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
13751 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13752 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
13755 addc %0,%1,%1\;subfe %0,%1,%0\;addze. %0,%2
13757 [(set_attr "type" "compare")
13758 (set_attr "length" "12,16")])
13761 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13763 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13765 (match_operand:SI 2 "gpc_reg_operand" ""))
13767 (set (match_operand:SI 0 "gpc_reg_operand" "")
13768 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
13769 "TARGET_32BIT && reload_completed"
13770 [(set (match_dup 0)
13771 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))
13773 (compare:CC (match_dup 0)
13778 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13780 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13782 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
13784 (set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
13785 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
13788 addc %0,%1,%1\;subfe %0,%1,%0\;addze. %0,%2
13790 [(set_attr "type" "compare")
13791 (set_attr "length" "12,16")])
13794 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
13796 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
13798 (match_operand:DI 2 "gpc_reg_operand" ""))
13800 (set (match_operand:DI 0 "gpc_reg_operand" "")
13801 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
13802 "TARGET_64BIT && reload_completed"
13803 [(set (match_dup 0)
13804 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))
13806 (compare:CC (match_dup 0)
13810 (define_insn_and_split "*gtu<mode>"
13811 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13812 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
13813 (match_operand:P 2 "reg_or_short_operand" "rI")))]
13817 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
13818 (set (match_dup 0) (neg:P (match_dup 0)))]
13821 (define_insn_and_split "*gtu<mode>_compare"
13822 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13824 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13825 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
13827 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13828 (gtu:P (match_dup 1) (match_dup 2)))]
13832 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
13833 (parallel [(set (match_dup 3)
13834 (compare:CC (neg:P (match_dup 0)) (const_int 0)))
13835 (set (match_dup 0) (neg:P (match_dup 0)))])]
13838 (define_insn_and_split "*plus_gtu<mode>"
13839 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
13840 (plus:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
13841 (match_operand:P 2 "reg_or_short_operand" "rI"))
13842 (match_operand:P 3 "reg_or_short_operand" "rI")))]
13845 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13846 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
13847 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))]
13850 (define_insn_and_split "*plus_gtu<mode>_compare"
13851 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13853 (plus:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
13854 (match_operand:P 2 "reg_or_short_operand" "I,r,I,r"))
13855 (match_operand:P 3 "gpc_reg_operand" "r,r,r,r"))
13857 (set (match_operand:P 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13858 (plus:P (gtu:P (match_dup 1) (match_dup 2)) (match_dup 3)))]
13861 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13862 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
13863 (parallel [(set (match_dup 4)
13864 (compare:CC (minus:P (match_dup 3) (match_dup 0))
13866 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))])]
13869 (define_insn "*neg_gtu<mode>"
13870 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13871 (neg:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
13872 (match_operand:P 2 "reg_or_short_operand" "rI"))))]
13874 "subf%I2c %0,%1,%2\;subfe %0,%0,%0"
13875 [(set_attr "type" "two")
13876 (set_attr "length" "8")])
13879 ;; Define both directions of branch and return. If we need a reload
13880 ;; register, we'd rather use CR0 since it is much easier to copy a
13881 ;; register CC value to there.
13885 (if_then_else (match_operator 1 "branch_comparison_operator"
13887 "cc_reg_operand" "y")
13889 (label_ref (match_operand 0 "" ""))
13894 return output_cbranch (operands[1], \"%l0\", 0, insn);
13896 [(set_attr "type" "branch")])
13900 (if_then_else (match_operator 0 "branch_comparison_operator"
13902 "cc_reg_operand" "y")
13909 return output_cbranch (operands[0], NULL, 0, insn);
13911 [(set_attr "type" "jmpreg")
13912 (set_attr "length" "4")])
13916 (if_then_else (match_operator 1 "branch_comparison_operator"
13918 "cc_reg_operand" "y")
13921 (label_ref (match_operand 0 "" ""))))]
13925 return output_cbranch (operands[1], \"%l0\", 1, insn);
13927 [(set_attr "type" "branch")])
13931 (if_then_else (match_operator 0 "branch_comparison_operator"
13933 "cc_reg_operand" "y")
13940 return output_cbranch (operands[0], NULL, 1, insn);
13942 [(set_attr "type" "jmpreg")
13943 (set_attr "length" "4")])
13945 ;; Logic on condition register values.
13947 ; This pattern matches things like
13948 ; (set (reg:CCEQ 68) (compare:CCEQ (ior:SI (gt:SI (reg:CCFP 68) (const_int 0))
13949 ; (eq:SI (reg:CCFP 68) (const_int 0)))
13951 ; which are generated by the branch logic.
13952 ; Prefer destructive operations where BT = BB (for crXX BT,BA,BB)
13954 (define_insn "*cceq_ior_compare"
13955 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13956 (compare:CCEQ (match_operator:SI 1 "boolean_operator"
13957 [(match_operator:SI 2
13958 "branch_positive_comparison_operator"
13960 "cc_reg_operand" "y,y")
13962 (match_operator:SI 4
13963 "branch_positive_comparison_operator"
13965 "cc_reg_operand" "0,y")
13969 "cr%q1 %E0,%j2,%j4"
13970 [(set_attr "type" "cr_logical,delayed_cr")])
13972 ; Why is the constant -1 here, but 1 in the previous pattern?
13973 ; Because ~1 has all but the low bit set.
13975 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13976 (compare:CCEQ (match_operator:SI 1 "boolean_or_operator"
13977 [(not:SI (match_operator:SI 2
13978 "branch_positive_comparison_operator"
13980 "cc_reg_operand" "y,y")
13982 (match_operator:SI 4
13983 "branch_positive_comparison_operator"
13985 "cc_reg_operand" "0,y")
13989 "cr%q1 %E0,%j2,%j4"
13990 [(set_attr "type" "cr_logical,delayed_cr")])
13992 (define_insn "*cceq_rev_compare"
13993 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13994 (compare:CCEQ (match_operator:SI 1
13995 "branch_positive_comparison_operator"
13997 "cc_reg_operand" "0,y")
14002 [(set_attr "type" "cr_logical,delayed_cr")])
14004 ;; If we are comparing the result of two comparisons, this can be done
14005 ;; using creqv or crxor.
14007 (define_insn_and_split ""
14008 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
14009 (compare:CCEQ (match_operator 1 "branch_comparison_operator"
14010 [(match_operand 2 "cc_reg_operand" "y")
14012 (match_operator 3 "branch_comparison_operator"
14013 [(match_operand 4 "cc_reg_operand" "y")
14018 [(set (match_dup 0) (compare:CCEQ (xor:SI (match_dup 1) (match_dup 3))
14022 int positive_1, positive_2;
14024 positive_1 = branch_positive_comparison_operator (operands[1],
14025 GET_MODE (operands[1]));
14026 positive_2 = branch_positive_comparison_operator (operands[3],
14027 GET_MODE (operands[3]));
14030 operands[1] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[2]),
14031 GET_CODE (operands[1])),
14033 operands[2], const0_rtx);
14034 else if (GET_MODE (operands[1]) != SImode)
14035 operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]), SImode,
14036 operands[2], const0_rtx);
14039 operands[3] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[4]),
14040 GET_CODE (operands[3])),
14042 operands[4], const0_rtx);
14043 else if (GET_MODE (operands[3]) != SImode)
14044 operands[3] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
14045 operands[4], const0_rtx);
14047 if (positive_1 == positive_2)
14049 operands[1] = gen_rtx_NOT (SImode, operands[1]);
14050 operands[5] = constm1_rtx;
14054 operands[5] = const1_rtx;
14058 ;; Unconditional branch and return.
14060 (define_insn "jump"
14062 (label_ref (match_operand 0 "" "")))]
14065 [(set_attr "type" "branch")])
14067 (define_insn "<return_str>return"
14071 [(set_attr "type" "jmpreg")])
14073 (define_expand "indirect_jump"
14074 [(set (pc) (match_operand 0 "register_operand" ""))])
14076 (define_insn "*indirect_jump<mode>"
14077 [(set (pc) (match_operand:P 0 "register_operand" "c,*l"))]
14082 [(set_attr "type" "jmpreg")])
14084 ;; Table jump for switch statements:
14085 (define_expand "tablejump"
14086 [(use (match_operand 0 "" ""))
14087 (use (label_ref (match_operand 1 "" "")))]
14092 emit_jump_insn (gen_tablejumpsi (operands[0], operands[1]));
14094 emit_jump_insn (gen_tablejumpdi (operands[0], operands[1]));
14098 (define_expand "tablejumpsi"
14099 [(set (match_dup 3)
14100 (plus:SI (match_operand:SI 0 "" "")
14102 (parallel [(set (pc) (match_dup 3))
14103 (use (label_ref (match_operand 1 "" "")))])]
14106 { operands[0] = force_reg (SImode, operands[0]);
14107 operands[2] = force_reg (SImode, gen_rtx_LABEL_REF (SImode, operands[1]));
14108 operands[3] = gen_reg_rtx (SImode);
14111 (define_expand "tablejumpdi"
14112 [(set (match_dup 4)
14113 (sign_extend:DI (match_operand:SI 0 "lwa_operand" "")))
14115 (plus:DI (match_dup 4)
14117 (parallel [(set (pc) (match_dup 3))
14118 (use (label_ref (match_operand 1 "" "")))])]
14121 { operands[2] = force_reg (DImode, gen_rtx_LABEL_REF (DImode, operands[1]));
14122 operands[3] = gen_reg_rtx (DImode);
14123 operands[4] = gen_reg_rtx (DImode);
14126 (define_insn "*tablejump<mode>_internal1"
14128 (match_operand:P 0 "register_operand" "c,*l"))
14129 (use (label_ref (match_operand 1 "" "")))]
14134 [(set_attr "type" "jmpreg")])
14141 (define_insn "group_ending_nop"
14142 [(unspec [(const_int 0)] UNSPEC_GRP_END_NOP)]
14146 if (rs6000_cpu_attr == CPU_POWER6)
14147 return \"ori 1,1,0\";
14148 return \"ori 2,2,0\";
14151 ;; Define the subtract-one-and-jump insns, starting with the template
14152 ;; so loop.c knows what to generate.
14154 (define_expand "doloop_end"
14155 [(use (match_operand 0 "" "")) ; loop pseudo
14156 (use (match_operand 1 "" ""))] ; label
14162 if (GET_MODE (operands[0]) != DImode)
14164 emit_jump_insn (gen_ctrdi (operands[0], operands[1]));
14168 if (GET_MODE (operands[0]) != SImode)
14170 emit_jump_insn (gen_ctrsi (operands[0], operands[1]));
14175 (define_expand "ctr<mode>"
14176 [(parallel [(set (pc)
14177 (if_then_else (ne (match_operand:P 0 "register_operand" "")
14179 (label_ref (match_operand 1 "" ""))
14182 (plus:P (match_dup 0)
14184 (clobber (match_scratch:CC 2 ""))
14185 (clobber (match_scratch:P 3 ""))])]
14189 ;; We need to be able to do this for any operand, including MEM, or we
14190 ;; will cause reload to blow up since we don't allow output reloads on
14192 ;; For the length attribute to be calculated correctly, the
14193 ;; label MUST be operand 0.
14195 (define_insn "*ctr<mode>_internal1"
14197 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
14199 (label_ref (match_operand 0 "" ""))
14201 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*c*l")
14202 (plus:P (match_dup 1)
14204 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14205 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
14209 if (which_alternative != 0)
14211 else if (get_attr_length (insn) == 4)
14212 return \"bdnz %l0\";
14214 return \"bdz $+8\;b %l0\";
14216 [(set_attr "type" "branch")
14217 (set_attr "length" "*,12,16,16")])
14219 (define_insn "*ctr<mode>_internal2"
14221 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
14224 (label_ref (match_operand 0 "" ""))))
14225 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*c*l")
14226 (plus:P (match_dup 1)
14228 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14229 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
14233 if (which_alternative != 0)
14235 else if (get_attr_length (insn) == 4)
14236 return \"bdz %l0\";
14238 return \"bdnz $+8\;b %l0\";
14240 [(set_attr "type" "branch")
14241 (set_attr "length" "*,12,16,16")])
14243 ;; Similar but use EQ
14245 (define_insn "*ctr<mode>_internal5"
14247 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
14249 (label_ref (match_operand 0 "" ""))
14251 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*c*l")
14252 (plus:P (match_dup 1)
14254 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14255 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
14259 if (which_alternative != 0)
14261 else if (get_attr_length (insn) == 4)
14262 return \"bdz %l0\";
14264 return \"bdnz $+8\;b %l0\";
14266 [(set_attr "type" "branch")
14267 (set_attr "length" "*,12,16,16")])
14269 (define_insn "*ctr<mode>_internal6"
14271 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
14274 (label_ref (match_operand 0 "" ""))))
14275 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*c*l")
14276 (plus:P (match_dup 1)
14278 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14279 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
14283 if (which_alternative != 0)
14285 else if (get_attr_length (insn) == 4)
14286 return \"bdnz %l0\";
14288 return \"bdz $+8\;b %l0\";
14290 [(set_attr "type" "branch")
14291 (set_attr "length" "*,12,16,16")])
14293 ;; Now the splitters if we could not allocate the CTR register
14297 (if_then_else (match_operator 2 "comparison_operator"
14298 [(match_operand:P 1 "gpc_reg_operand" "")
14300 (match_operand 5 "" "")
14301 (match_operand 6 "" "")))
14302 (set (match_operand:P 0 "gpc_reg_operand" "")
14303 (plus:P (match_dup 1) (const_int -1)))
14304 (clobber (match_scratch:CC 3 ""))
14305 (clobber (match_scratch:P 4 ""))]
14307 [(parallel [(set (match_dup 3)
14308 (compare:CC (plus:P (match_dup 1)
14312 (plus:P (match_dup 1)
14314 (set (pc) (if_then_else (match_dup 7)
14318 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
14319 operands[3], const0_rtx); }")
14323 (if_then_else (match_operator 2 "comparison_operator"
14324 [(match_operand:P 1 "gpc_reg_operand" "")
14326 (match_operand 5 "" "")
14327 (match_operand 6 "" "")))
14328 (set (match_operand:P 0 "nonimmediate_operand" "")
14329 (plus:P (match_dup 1) (const_int -1)))
14330 (clobber (match_scratch:CC 3 ""))
14331 (clobber (match_scratch:P 4 ""))]
14332 "reload_completed && ! gpc_reg_operand (operands[0], SImode)"
14333 [(parallel [(set (match_dup 3)
14334 (compare:CC (plus:P (match_dup 1)
14338 (plus:P (match_dup 1)
14342 (set (pc) (if_then_else (match_dup 7)
14346 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
14347 operands[3], const0_rtx); }")
14349 (define_insn "trap"
14350 [(trap_if (const_int 1) (const_int 0))]
14353 [(set_attr "type" "trap")])
14355 (define_expand "ctrap<mode>4"
14356 [(trap_if (match_operator 0 "ordered_comparison_operator"
14357 [(match_operand:GPR 1 "register_operand")
14358 (match_operand:GPR 2 "reg_or_short_operand")])
14359 (match_operand 3 "zero_constant" ""))]
14364 [(trap_if (match_operator 0 "ordered_comparison_operator"
14365 [(match_operand:GPR 1 "register_operand" "r")
14366 (match_operand:GPR 2 "reg_or_short_operand" "rI")])
14369 "t<wd>%V0%I2 %1,%2"
14370 [(set_attr "type" "trap")])
14372 ;; Insns related to generating the function prologue and epilogue.
14374 (define_expand "prologue"
14375 [(use (const_int 0))]
14378 rs6000_emit_prologue ();
14379 if (!TARGET_SCHED_PROLOG)
14380 emit_insn (gen_blockage ());
14384 (define_insn "*movesi_from_cr_one"
14385 [(match_parallel 0 "mfcr_operation"
14386 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
14387 (unspec:SI [(match_operand:CC 2 "cc_reg_operand" "y")
14388 (match_operand 3 "immediate_operand" "n")]
14389 UNSPEC_MOVESI_FROM_CR))])]
14395 for (i = 0; i < XVECLEN (operands[0], 0); i++)
14397 mask = INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
14398 operands[4] = GEN_INT (mask);
14399 output_asm_insn (\"mfcr %1,%4\", operands);
14403 [(set_attr "type" "mfcrf")])
14405 (define_insn "movesi_from_cr"
14406 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14407 (unspec:SI [(reg:CC CR0_REGNO) (reg:CC CR1_REGNO)
14408 (reg:CC CR2_REGNO) (reg:CC CR3_REGNO)
14409 (reg:CC CR4_REGNO) (reg:CC CR5_REGNO)
14410 (reg:CC CR6_REGNO) (reg:CC CR7_REGNO)]
14411 UNSPEC_MOVESI_FROM_CR))]
14414 [(set_attr "type" "mfcr")])
14416 (define_insn "*crsave"
14417 [(match_parallel 0 "crsave_operation"
14418 [(set (match_operand:SI 1 "memory_operand" "=m")
14419 (match_operand:SI 2 "gpc_reg_operand" "r"))])]
14422 [(set_attr "type" "store")])
14424 (define_insn "*stmw"
14425 [(match_parallel 0 "stmw_operation"
14426 [(set (match_operand:SI 1 "memory_operand" "=m")
14427 (match_operand:SI 2 "gpc_reg_operand" "r"))])]
14430 [(set_attr "type" "store")
14431 (set_attr "update" "yes")
14432 (set_attr "indexed" "yes")])
14434 ; The following comment applies to:
14438 ; return_and_restore_gpregs*
14439 ; return_and_restore_fpregs*
14440 ; return_and_restore_fpregs_aix*
14442 ; The out-of-line save / restore functions expects one input argument.
14443 ; Since those are not standard call_insn's, we must avoid using
14444 ; MATCH_OPERAND for that argument. That way the register rename
14445 ; optimization will not try to rename this register.
14446 ; Each pattern is repeated for each possible register number used in
14447 ; various ABIs (r11, r1, and for some functions r12)
14449 (define_insn "*save_gpregs_<mode>_r11"
14450 [(match_parallel 0 "any_parallel_operand"
14451 [(clobber (reg:P 65))
14452 (use (match_operand:P 1 "symbol_ref_operand" "s"))
14454 (set (match_operand:P 2 "memory_operand" "=m")
14455 (match_operand:P 3 "gpc_reg_operand" "r"))])]
14458 [(set_attr "type" "branch")
14459 (set_attr "length" "4")])
14461 (define_insn "*save_gpregs_<mode>_r12"
14462 [(match_parallel 0 "any_parallel_operand"
14463 [(clobber (reg:P 65))
14464 (use (match_operand:P 1 "symbol_ref_operand" "s"))
14466 (set (match_operand:P 2 "memory_operand" "=m")
14467 (match_operand:P 3 "gpc_reg_operand" "r"))])]
14470 [(set_attr "type" "branch")
14471 (set_attr "length" "4")])
14473 (define_insn "*save_gpregs_<mode>_r1"
14474 [(match_parallel 0 "any_parallel_operand"
14475 [(clobber (reg:P 65))
14476 (use (match_operand:P 1 "symbol_ref_operand" "s"))
14478 (set (match_operand:P 2 "memory_operand" "=m")
14479 (match_operand:P 3 "gpc_reg_operand" "r"))])]
14482 [(set_attr "type" "branch")
14483 (set_attr "length" "4")])
14485 (define_insn "*save_fpregs_<mode>_r11"
14486 [(match_parallel 0 "any_parallel_operand"
14487 [(clobber (reg:P 65))
14488 (use (match_operand:P 1 "symbol_ref_operand" "s"))
14490 (set (match_operand:DF 2 "memory_operand" "=m")
14491 (match_operand:DF 3 "gpc_reg_operand" "d"))])]
14494 [(set_attr "type" "branch")
14495 (set_attr "length" "4")])
14497 (define_insn "*save_fpregs_<mode>_r12"
14498 [(match_parallel 0 "any_parallel_operand"
14499 [(clobber (reg:P 65))
14500 (use (match_operand:P 1 "symbol_ref_operand" "s"))
14502 (set (match_operand:DF 2 "memory_operand" "=m")
14503 (match_operand:DF 3 "gpc_reg_operand" "d"))])]
14506 [(set_attr "type" "branch")
14507 (set_attr "length" "4")])
14509 (define_insn "*save_fpregs_<mode>_r1"
14510 [(match_parallel 0 "any_parallel_operand"
14511 [(clobber (reg:P 65))
14512 (use (match_operand:P 1 "symbol_ref_operand" "s"))
14514 (set (match_operand:DF 2 "memory_operand" "=m")
14515 (match_operand:DF 3 "gpc_reg_operand" "d"))])]
14518 [(set_attr "type" "branch")
14519 (set_attr "length" "4")])
14521 ; This is to explain that changes to the stack pointer should
14522 ; not be moved over loads from or stores to stack memory.
14523 (define_insn "stack_tie"
14524 [(match_parallel 0 "tie_operand"
14525 [(set (mem:BLK (reg 1)) (const_int 0))])]
14528 [(set_attr "length" "0")])
14530 (define_expand "epilogue"
14531 [(use (const_int 0))]
14534 if (!TARGET_SCHED_PROLOG)
14535 emit_insn (gen_blockage ());
14536 rs6000_emit_epilogue (FALSE);
14540 ; On some processors, doing the mtcrf one CC register at a time is
14541 ; faster (like on the 604e). On others, doing them all at once is
14542 ; faster; for instance, on the 601 and 750.
14544 (define_expand "movsi_to_cr_one"
14545 [(set (match_operand:CC 0 "cc_reg_operand" "")
14546 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "")
14547 (match_dup 2)] UNSPEC_MOVESI_TO_CR))]
14549 "operands[2] = GEN_INT (1 << (75 - REGNO (operands[0])));")
14551 (define_insn "*movsi_to_cr"
14552 [(match_parallel 0 "mtcrf_operation"
14553 [(set (match_operand:CC 1 "cc_reg_operand" "=y")
14554 (unspec:CC [(match_operand:SI 2 "gpc_reg_operand" "r")
14555 (match_operand 3 "immediate_operand" "n")]
14556 UNSPEC_MOVESI_TO_CR))])]
14562 for (i = 0; i < XVECLEN (operands[0], 0); i++)
14563 mask |= INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
14564 operands[4] = GEN_INT (mask);
14565 return \"mtcrf %4,%2\";
14567 [(set_attr "type" "mtcr")])
14569 (define_insn "*mtcrfsi"
14570 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
14571 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
14572 (match_operand 2 "immediate_operand" "n")]
14573 UNSPEC_MOVESI_TO_CR))]
14574 "GET_CODE (operands[0]) == REG
14575 && CR_REGNO_P (REGNO (operands[0]))
14576 && GET_CODE (operands[2]) == CONST_INT
14577 && INTVAL (operands[2]) == 1 << (75 - REGNO (operands[0]))"
14579 [(set_attr "type" "mtcr")])
14581 ; The load-multiple instructions have similar properties.
14582 ; Note that "load_multiple" is a name known to the machine-independent
14583 ; code that actually corresponds to the PowerPC load-string.
14585 (define_insn "*lmw"
14586 [(match_parallel 0 "lmw_operation"
14587 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
14588 (match_operand:SI 2 "memory_operand" "m"))])]
14591 [(set_attr "type" "load")
14592 (set_attr "update" "yes")
14593 (set_attr "indexed" "yes")
14594 (set_attr "cell_micro" "always")])
14596 (define_insn "*return_internal_<mode>"
14598 (use (match_operand:P 0 "register_operand" "lc"))]
14601 [(set_attr "type" "jmpreg")])
14603 ; FIXME: This would probably be somewhat simpler if the Cygnus sibcall
14604 ; stuff was in GCC. Oh, and "any_parallel_operand" is a bit flexible...
14606 ; The following comment applies to:
14610 ; return_and_restore_gpregs*
14611 ; return_and_restore_fpregs*
14612 ; return_and_restore_fpregs_aix*
14614 ; The out-of-line save / restore functions expects one input argument.
14615 ; Since those are not standard call_insn's, we must avoid using
14616 ; MATCH_OPERAND for that argument. That way the register rename
14617 ; optimization will not try to rename this register.
14618 ; Each pattern is repeated for each possible register number used in
14619 ; various ABIs (r11, r1, and for some functions r12)
14621 (define_insn "*restore_gpregs_<mode>_r11"
14622 [(match_parallel 0 "any_parallel_operand"
14623 [(clobber (match_operand:P 1 "register_operand" "=l"))
14624 (use (match_operand:P 2 "symbol_ref_operand" "s"))
14626 (set (match_operand:P 3 "gpc_reg_operand" "=r")
14627 (match_operand:P 4 "memory_operand" "m"))])]
14630 [(set_attr "type" "branch")
14631 (set_attr "length" "4")])
14633 (define_insn "*restore_gpregs_<mode>_r12"
14634 [(match_parallel 0 "any_parallel_operand"
14635 [(clobber (match_operand:P 1 "register_operand" "=l"))
14636 (use (match_operand:P 2 "symbol_ref_operand" "s"))
14638 (set (match_operand:P 3 "gpc_reg_operand" "=r")
14639 (match_operand:P 4 "memory_operand" "m"))])]
14642 [(set_attr "type" "branch")
14643 (set_attr "length" "4")])
14645 (define_insn "*restore_gpregs_<mode>_r1"
14646 [(match_parallel 0 "any_parallel_operand"
14647 [(clobber (match_operand:P 1 "register_operand" "=l"))
14648 (use (match_operand:P 2 "symbol_ref_operand" "s"))
14650 (set (match_operand:P 3 "gpc_reg_operand" "=r")
14651 (match_operand:P 4 "memory_operand" "m"))])]
14654 [(set_attr "type" "branch")
14655 (set_attr "length" "4")])
14657 (define_insn "*return_and_restore_gpregs_<mode>_r11"
14658 [(match_parallel 0 "any_parallel_operand"
14660 (clobber (match_operand:P 1 "register_operand" "=l"))
14661 (use (match_operand:P 2 "symbol_ref_operand" "s"))
14663 (set (match_operand:P 3 "gpc_reg_operand" "=r")
14664 (match_operand:P 4 "memory_operand" "m"))])]
14667 [(set_attr "type" "branch")
14668 (set_attr "length" "4")])
14670 (define_insn "*return_and_restore_gpregs_<mode>_r12"
14671 [(match_parallel 0 "any_parallel_operand"
14673 (clobber (match_operand:P 1 "register_operand" "=l"))
14674 (use (match_operand:P 2 "symbol_ref_operand" "s"))
14676 (set (match_operand:P 3 "gpc_reg_operand" "=r")
14677 (match_operand:P 4 "memory_operand" "m"))])]
14680 [(set_attr "type" "branch")
14681 (set_attr "length" "4")])
14683 (define_insn "*return_and_restore_gpregs_<mode>_r1"
14684 [(match_parallel 0 "any_parallel_operand"
14686 (clobber (match_operand:P 1 "register_operand" "=l"))
14687 (use (match_operand:P 2 "symbol_ref_operand" "s"))
14689 (set (match_operand:P 3 "gpc_reg_operand" "=r")
14690 (match_operand:P 4 "memory_operand" "m"))])]
14693 [(set_attr "type" "branch")
14694 (set_attr "length" "4")])
14696 (define_insn "*return_and_restore_fpregs_<mode>_r11"
14697 [(match_parallel 0 "any_parallel_operand"
14699 (clobber (match_operand:P 1 "register_operand" "=l"))
14700 (use (match_operand:P 2 "symbol_ref_operand" "s"))
14702 (set (match_operand:DF 3 "gpc_reg_operand" "=d")
14703 (match_operand:DF 4 "memory_operand" "m"))])]
14706 [(set_attr "type" "branch")
14707 (set_attr "length" "4")])
14709 (define_insn "*return_and_restore_fpregs_<mode>_r12"
14710 [(match_parallel 0 "any_parallel_operand"
14712 (clobber (match_operand:P 1 "register_operand" "=l"))
14713 (use (match_operand:P 2 "symbol_ref_operand" "s"))
14715 (set (match_operand:DF 3 "gpc_reg_operand" "=d")
14716 (match_operand:DF 4 "memory_operand" "m"))])]
14719 [(set_attr "type" "branch")
14720 (set_attr "length" "4")])
14722 (define_insn "*return_and_restore_fpregs_<mode>_r1"
14723 [(match_parallel 0 "any_parallel_operand"
14725 (clobber (match_operand:P 1 "register_operand" "=l"))
14726 (use (match_operand:P 2 "symbol_ref_operand" "s"))
14728 (set (match_operand:DF 3 "gpc_reg_operand" "=d")
14729 (match_operand:DF 4 "memory_operand" "m"))])]
14732 [(set_attr "type" "branch")
14733 (set_attr "length" "4")])
14735 (define_insn "*return_and_restore_fpregs_aix_<mode>_r11"
14736 [(match_parallel 0 "any_parallel_operand"
14738 (use (match_operand:P 1 "register_operand" "l"))
14739 (use (match_operand:P 2 "symbol_ref_operand" "s"))
14741 (set (match_operand:DF 3 "gpc_reg_operand" "=d")
14742 (match_operand:DF 4 "memory_operand" "m"))])]
14745 [(set_attr "type" "branch")
14746 (set_attr "length" "4")])
14748 (define_insn "*return_and_restore_fpregs_aix_<mode>_r1"
14749 [(match_parallel 0 "any_parallel_operand"
14751 (use (match_operand:P 1 "register_operand" "l"))
14752 (use (match_operand:P 2 "symbol_ref_operand" "s"))
14754 (set (match_operand:DF 3 "gpc_reg_operand" "=d")
14755 (match_operand:DF 4 "memory_operand" "m"))])]
14758 [(set_attr "type" "branch")
14759 (set_attr "length" "4")])
14761 ; This is used in compiling the unwind routines.
14762 (define_expand "eh_return"
14763 [(use (match_operand 0 "general_operand" ""))]
14768 emit_insn (gen_eh_set_lr_si (operands[0]));
14770 emit_insn (gen_eh_set_lr_di (operands[0]));
14774 ; We can't expand this before we know where the link register is stored.
14775 (define_insn "eh_set_lr_<mode>"
14776 [(unspec_volatile [(match_operand:P 0 "register_operand" "r")]
14778 (clobber (match_scratch:P 1 "=&b"))]
14783 [(unspec_volatile [(match_operand 0 "register_operand" "")] UNSPECV_EH_RR)
14784 (clobber (match_scratch 1 ""))]
14789 rs6000_emit_eh_reg_restore (operands[0], operands[1]);
14793 (define_insn "prefetch"
14794 [(prefetch (match_operand 0 "indexed_or_indirect_address" "a")
14795 (match_operand:SI 1 "const_int_operand" "n")
14796 (match_operand:SI 2 "const_int_operand" "n"))]
14800 if (GET_CODE (operands[0]) == REG)
14801 return INTVAL (operands[1]) ? \"dcbtst 0,%0\" : \"dcbt 0,%0\";
14802 return INTVAL (operands[1]) ? \"dcbtst %a0\" : \"dcbt %a0\";
14804 [(set_attr "type" "load")])
14806 (define_insn "bpermd_<mode>"
14807 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
14808 (unspec:P [(match_operand:P 1 "gpc_reg_operand" "r")
14809 (match_operand:P 2 "gpc_reg_operand" "r")] UNSPEC_BPERM))]
14812 [(set_attr "type" "popcnt")])
14815 ;; Builtin fma support. Handle
14816 ;; Note that the conditions for expansion are in the FMA_F iterator.
14818 (define_expand "fma<mode>4"
14819 [(set (match_operand:FMA_F 0 "register_operand" "")
14821 (match_operand:FMA_F 1 "register_operand" "")
14822 (match_operand:FMA_F 2 "register_operand" "")
14823 (match_operand:FMA_F 3 "register_operand" "")))]
14827 (define_insn "*fma<mode>4_fpr"
14828 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>,<Fv>")
14830 (match_operand:SFDF 1 "gpc_reg_operand" "%<Ff>,<Fv>,<Fv>")
14831 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>,0")
14832 (match_operand:SFDF 3 "gpc_reg_operand" "<Ff>,0,<Fv>")))]
14833 "TARGET_<MODE>_FPR"
14835 fmadd<Ftrad> %0,%1,%2,%3
14836 xsmadda<Fvsx> %x0,%x1,%x2
14837 xsmaddm<Fvsx> %x0,%x1,%x3"
14838 [(set_attr "type" "fp")
14839 (set_attr "fp_type" "fp_maddsub_<Fs>")])
14841 ; Altivec only has fma and nfms.
14842 (define_expand "fms<mode>4"
14843 [(set (match_operand:FMA_F 0 "register_operand" "")
14845 (match_operand:FMA_F 1 "register_operand" "")
14846 (match_operand:FMA_F 2 "register_operand" "")
14847 (neg:FMA_F (match_operand:FMA_F 3 "register_operand" ""))))]
14848 "!VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
14851 (define_insn "*fms<mode>4_fpr"
14852 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>,<Fv>")
14854 (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>,<Fv>")
14855 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>,0")
14856 (neg:SFDF (match_operand:SFDF 3 "gpc_reg_operand" "<Ff>,0,<Fv>"))))]
14857 "TARGET_<MODE>_FPR"
14859 fmsub<Ftrad> %0,%1,%2,%3
14860 xsmsuba<Fvsx> %x0,%x1,%x2
14861 xsmsubm<Fvsx> %x0,%x1,%x3"
14862 [(set_attr "type" "fp")
14863 (set_attr "fp_type" "fp_maddsub_<Fs>")])
14865 ;; If signed zeros are ignored, -(a * b - c) = -a * b + c.
14866 (define_expand "fnma<mode>4"
14867 [(set (match_operand:FMA_F 0 "register_operand" "")
14870 (match_operand:FMA_F 1 "register_operand" "")
14871 (match_operand:FMA_F 2 "register_operand" "")
14872 (neg:FMA_F (match_operand:FMA_F 3 "register_operand" "")))))]
14873 "!HONOR_SIGNED_ZEROS (<MODE>mode)"
14876 ;; If signed zeros are ignored, -(a * b + c) = -a * b - c.
14877 (define_expand "fnms<mode>4"
14878 [(set (match_operand:FMA_F 0 "register_operand" "")
14881 (match_operand:FMA_F 1 "register_operand" "")
14882 (match_operand:FMA_F 2 "register_operand" "")
14883 (match_operand:FMA_F 3 "register_operand" ""))))]
14884 "!HONOR_SIGNED_ZEROS (<MODE>mode) && !VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
14887 ; Not an official optab name, but used from builtins.
14888 (define_expand "nfma<mode>4"
14889 [(set (match_operand:FMA_F 0 "register_operand" "")
14892 (match_operand:FMA_F 1 "register_operand" "")
14893 (match_operand:FMA_F 2 "register_operand" "")
14894 (match_operand:FMA_F 3 "register_operand" ""))))]
14895 "!VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
14898 (define_insn "*nfma<mode>4_fpr"
14899 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>,<Fv>")
14902 (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>,<Fv>")
14903 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>,0")
14904 (match_operand:SFDF 3 "gpc_reg_operand" "<Ff>,0,<Fv>"))))]
14905 "TARGET_<MODE>_FPR"
14907 fnmadd<Ftrad> %0,%1,%2,%3
14908 xsnmadda<Fvsx> %x0,%x1,%x2
14909 xsnmaddm<Fvsx> %x0,%x1,%x3"
14910 [(set_attr "type" "fp")
14911 (set_attr "fp_type" "fp_maddsub_<Fs>")])
14913 ; Not an official optab name, but used from builtins.
14914 (define_expand "nfms<mode>4"
14915 [(set (match_operand:FMA_F 0 "register_operand" "")
14918 (match_operand:FMA_F 1 "register_operand" "")
14919 (match_operand:FMA_F 2 "register_operand" "")
14920 (neg:FMA_F (match_operand:FMA_F 3 "register_operand" "")))))]
14924 (define_insn "*nfmssf4_fpr"
14925 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>,<Fv>")
14928 (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>,<Fv>")
14929 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>,0")
14931 (match_operand:SFDF 3 "gpc_reg_operand" "<Ff>,0,<Fv>")))))]
14932 "TARGET_<MODE>_FPR"
14934 fnmsub<Ftrad> %0,%1,%2,%3
14935 xsnmsuba<Fvsx> %x0,%x1,%x2
14936 xsnmsubm<Fvsx> %x0,%x1,%x3"
14937 [(set_attr "type" "fp")
14938 (set_attr "fp_type" "fp_maddsub_<Fs>")])
14941 (define_expand "rs6000_get_timebase"
14942 [(use (match_operand:DI 0 "gpc_reg_operand" ""))]
14945 if (TARGET_POWERPC64)
14946 emit_insn (gen_rs6000_mftb_di (operands[0]));
14948 emit_insn (gen_rs6000_get_timebase_ppc32 (operands[0]));
14952 (define_insn "rs6000_get_timebase_ppc32"
14953 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
14954 (unspec_volatile:DI [(const_int 0)] UNSPECV_MFTB))
14955 (clobber (match_scratch:SI 1 "=r"))
14956 (clobber (match_scratch:CC 2 "=y"))]
14957 "!TARGET_POWERPC64"
14959 if (WORDS_BIG_ENDIAN)
14962 return "mfspr %0,269\;"
14970 return "mftbu %0\;"
14979 return "mfspr %L0,269\;"
14987 return "mftbu %L0\;"
14994 [(set_attr "length" "20")])
14996 (define_insn "rs6000_mftb_<mode>"
14997 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
14998 (unspec_volatile:P [(const_int 0)] UNSPECV_MFTB))]
15002 return "mfspr %0,268";
15008 (define_insn "rs6000_mffs"
15009 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
15010 (unspec_volatile:DF [(const_int 0)] UNSPECV_MFFS))]
15011 "TARGET_HARD_FLOAT && TARGET_FPRS"
15014 (define_insn "rs6000_mtfsf"
15015 [(unspec_volatile [(match_operand:SI 0 "const_int_operand" "i")
15016 (match_operand:DF 1 "gpc_reg_operand" "d")]
15018 "TARGET_HARD_FLOAT && TARGET_FPRS"
15022 ;; Power8 fusion support for fusing an addis instruction with a D-form load of
15023 ;; a GPR. The addis instruction must be adjacent to the load, and use the same
15024 ;; register that is being loaded. The fused ops must be physically adjacent.
15026 ;; We use define_peephole for the actual addis/load, and the register used to
15027 ;; hold the addis value must be the same as the register being loaded. We use
15028 ;; define_peephole2 to change the register used for addis to be the register
15029 ;; being loaded, since we can look at whether it is dead after the load insn.
15032 [(set (match_operand:P 0 "base_reg_operand" "")
15033 (match_operand:P 1 "fusion_gpr_addis" ""))
15034 (set (match_operand:INT1 2 "base_reg_operand" "")
15035 (match_operand:INT1 3 "fusion_gpr_mem_load" ""))]
15036 "TARGET_P8_FUSION && fusion_gpr_load_p (operands, false)"
15038 return emit_fusion_gpr_load (operands);
15040 [(set_attr "type" "load")
15041 (set_attr "length" "8")])
15044 [(set (match_operand:P 0 "base_reg_operand" "")
15045 (match_operand:P 1 "fusion_gpr_addis" ""))
15046 (set (match_operand:INT1 2 "base_reg_operand" "")
15047 (match_operand:INT1 3 "fusion_gpr_mem_load" ""))]
15049 && (REGNO (operands[0]) != REGNO (operands[2])
15050 || GET_CODE (operands[3]) == SIGN_EXTEND)
15051 && fusion_gpr_load_p (operands, true)"
15054 expand_fusion_gpr_load (operands);
15059 ;; Miscellaneous ISA 2.06 (power7) instructions
15060 (define_insn "addg6s"
15061 [(set (match_operand:SI 0 "register_operand" "=r")
15062 (unspec:SI [(match_operand:SI 1 "register_operand" "r")
15063 (match_operand:SI 2 "register_operand" "r")]
15067 [(set_attr "type" "integer")
15068 (set_attr "length" "4")])
15070 (define_insn "cdtbcd"
15071 [(set (match_operand:SI 0 "register_operand" "=r")
15072 (unspec:SI [(match_operand:SI 1 "register_operand" "r")]
15076 [(set_attr "type" "integer")
15077 (set_attr "length" "4")])
15079 (define_insn "cbcdtd"
15080 [(set (match_operand:SI 0 "register_operand" "=r")
15081 (unspec:SI [(match_operand:SI 1 "register_operand" "r")]
15085 [(set_attr "type" "integer")
15086 (set_attr "length" "4")])
15088 (define_int_iterator UNSPEC_DIV_EXTEND [UNSPEC_DIVE
15093 (define_int_attr div_extend [(UNSPEC_DIVE "e")
15094 (UNSPEC_DIVEO "eo")
15095 (UNSPEC_DIVEU "eu")
15096 (UNSPEC_DIVEUO "euo")])
15098 (define_insn "div<div_extend>_<mode>"
15099 [(set (match_operand:GPR 0 "register_operand" "=r")
15100 (unspec:GPR [(match_operand:GPR 1 "register_operand" "r")
15101 (match_operand:GPR 2 "register_operand" "r")]
15102 UNSPEC_DIV_EXTEND))]
15104 "div<wd><div_extend> %0,%1,%2"
15105 [(set_attr "type" "div")
15106 (set_attr "size" "<bits>")])
15109 ;; Pack/unpack 128-bit floating point types that take 2 scalar registers
15111 ; Type of the 64-bit part when packing/unpacking 128-bit floating point types
15112 (define_mode_attr FP128_64 [(TF "DF") (TD "DI")])
15114 (define_expand "unpack<mode>"
15115 [(set (match_operand:<FP128_64> 0 "nonimmediate_operand" "")
15117 [(match_operand:FMOVE128 1 "register_operand" "")
15118 (match_operand:QI 2 "const_0_to_1_operand" "")]
15119 UNSPEC_UNPACK_128BIT))]
15123 (define_insn_and_split "unpack<mode>_dm"
15124 [(set (match_operand:<FP128_64> 0 "nonimmediate_operand" "=d,m,d,r,m")
15126 [(match_operand:FMOVE128 1 "register_operand" "d,d,r,d,r")
15127 (match_operand:QI 2 "const_0_to_1_operand" "i,i,i,i,i")]
15128 UNSPEC_UNPACK_128BIT))]
15129 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
15131 "&& reload_completed"
15132 [(set (match_dup 0) (match_dup 3))]
15134 unsigned fp_regno = REGNO (operands[1]) + UINTVAL (operands[2]);
15136 if (REG_P (operands[0]) && REGNO (operands[0]) == fp_regno)
15138 emit_note (NOTE_INSN_DELETED);
15142 operands[3] = gen_rtx_REG (<FP128_64>mode, fp_regno);
15144 [(set_attr "type" "fp,fpstore,mffgpr,mftgpr,store")
15145 (set_attr "length" "4")])
15147 (define_insn_and_split "unpack<mode>_nodm"
15148 [(set (match_operand:<FP128_64> 0 "nonimmediate_operand" "=d,m")
15150 [(match_operand:FMOVE128 1 "register_operand" "d,d")
15151 (match_operand:QI 2 "const_0_to_1_operand" "i,i")]
15152 UNSPEC_UNPACK_128BIT))]
15153 "!TARGET_POWERPC64 || !TARGET_DIRECT_MOVE"
15155 "&& reload_completed"
15156 [(set (match_dup 0) (match_dup 3))]
15158 unsigned fp_regno = REGNO (operands[1]) + UINTVAL (operands[2]);
15160 if (REG_P (operands[0]) && REGNO (operands[0]) == fp_regno)
15162 emit_note (NOTE_INSN_DELETED);
15166 operands[3] = gen_rtx_REG (<FP128_64>mode, fp_regno);
15168 [(set_attr "type" "fp,fpstore")
15169 (set_attr "length" "4")])
15171 (define_insn_and_split "pack<mode>"
15172 [(set (match_operand:FMOVE128 0 "register_operand" "=d,&d")
15174 [(match_operand:<FP128_64> 1 "register_operand" "0,d")
15175 (match_operand:<FP128_64> 2 "register_operand" "d,d")]
15176 UNSPEC_PACK_128BIT))]
15181 "&& reload_completed && REGNO (operands[0]) != REGNO (operands[1])"
15182 [(set (match_dup 3) (match_dup 1))
15183 (set (match_dup 4) (match_dup 2))]
15185 unsigned dest_hi = REGNO (operands[0]);
15186 unsigned dest_lo = dest_hi + 1;
15188 gcc_assert (!IN_RANGE (REGNO (operands[1]), dest_hi, dest_lo));
15189 gcc_assert (!IN_RANGE (REGNO (operands[2]), dest_hi, dest_lo));
15191 operands[3] = gen_rtx_REG (<FP128_64>mode, dest_hi);
15192 operands[4] = gen_rtx_REG (<FP128_64>mode, dest_lo);
15194 [(set_attr "type" "fp,fp")
15195 (set_attr "length" "4,8")])
15197 (define_insn "unpackv1ti"
15198 [(set (match_operand:DI 0 "register_operand" "=d,d")
15199 (unspec:DI [(match_operand:V1TI 1 "register_operand" "0,wa")
15200 (match_operand:QI 2 "const_0_to_1_operand" "O,i")]
15201 UNSPEC_UNPACK_128BIT))]
15204 if (REGNO (operands[0]) == REGNO (operands[1]) && INTVAL (operands[2]) == 0)
15205 return ASM_COMMENT_START " xxpermdi to same register";
15207 operands[3] = GEN_INT (INTVAL (operands[2]) == 0 ? 0 : 3);
15208 return "xxpermdi %x0,%x1,%x1,%3";
15210 [(set_attr "type" "vecperm")
15211 (set_attr "length" "4")])
15213 (define_insn "packv1ti"
15214 [(set (match_operand:V1TI 0 "register_operand" "=wa")
15216 [(match_operand:DI 1 "register_operand" "d")
15217 (match_operand:DI 2 "register_operand" "d")]
15218 UNSPEC_PACK_128BIT))]
15220 "xxpermdi %x0,%x1,%x2,0"
15221 [(set_attr "type" "vecperm")
15222 (set_attr "length" "4")])
15226 (include "sync.md")
15227 (include "vector.md")
15229 (include "altivec.md")
15232 (include "paired.md")
15233 (include "crypto.md")