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
144 ;; UNSPEC_VOLATILE usage
147 (define_c_enum "unspecv"
149 UNSPECV_LL ; load-locked
150 UNSPECV_SC ; store-conditional
151 UNSPECV_PROBE_STACK_RANGE ; probe range of stack addresses
152 UNSPECV_EH_RR ; eh_reg_restore
153 UNSPECV_ISYNC ; isync instruction
154 UNSPECV_MFTB ; move from time base
155 UNSPECV_NLGR ; non-local goto receiver
156 UNSPECV_MFFS ; Move from FPSCR
157 UNSPECV_MTFSF ; Move to FPSCR Fields
161 ;; Define an insn type attribute. This is used in function unit delay
165 add,logical,shift,insert,
167 exts,cntlz,popcnt,isel,
168 load,store,fpload,fpstore,vecload,vecstore,
170 branch,jmpreg,mfjmpr,mtjmpr,trap,isync,sync,load_l,store_c,
172 cr_logical,delayed_cr,mfcr,mfcrf,mtcr,
173 fpcompare,fp,fpsimple,dmul,sdiv,ddiv,ssqrt,dsqrt,
175 vecsimple,veccomplex,vecdiv,veccmp,veccmpsimple,vecperm,
176 vecfloat,vecfdiv,vecdouble,mffgpr,mftgpr,crypto,
178 (const_string "integer"))
180 ;; What data size does this instruction work on?
181 ;; This is used for insert, mul.
182 (define_attr "size" "8,16,32,64" (const_string "32"))
184 ;; Is this instruction record form ("dot", signed compare to 0, writing CR0)?
185 ;; This is used for add, logical, shift, exts, mul.
186 (define_attr "dot" "no,yes" (const_string "no"))
188 ;; Does this instruction sign-extend its result?
189 ;; This is used for load insns.
190 (define_attr "sign_extend" "no,yes" (const_string "no"))
192 ;; Does this instruction use indexed (that is, reg+reg) addressing?
193 ;; This is used for load and store insns. If operand 0 or 1 is a MEM
194 ;; it is automatically set based on that. If a load or store instruction
195 ;; has fewer than two operands it needs to set this attribute manually
196 ;; or the compiler will crash.
197 (define_attr "indexed" "no,yes"
198 (if_then_else (ior (match_operand 0 "indexed_address_mem")
199 (match_operand 1 "indexed_address_mem"))
201 (const_string "no")))
203 ;; Does this instruction use update addressing?
204 ;; This is used for load and store insns. See the comments for "indexed".
205 (define_attr "update" "no,yes"
206 (if_then_else (ior (match_operand 0 "update_address_mem")
207 (match_operand 1 "update_address_mem"))
209 (const_string "no")))
211 ;; Is this instruction using operands[2] as shift amount, and can that be a
213 ;; This is used for shift insns.
214 (define_attr "maybe_var_shift" "no,yes" (const_string "no"))
216 ;; Is this instruction using a shift amount from a register?
217 ;; This is used for shift insns.
218 (define_attr "var_shift" "no,yes"
219 (if_then_else (and (eq_attr "type" "shift")
220 (eq_attr "maybe_var_shift" "yes"))
221 (if_then_else (match_operand 2 "gpc_reg_operand")
224 (const_string "no")))
226 ;; Define floating point instruction sub-types for use with Xfpu.md
227 (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"))
229 ;; Length (in bytes).
230 ; '(pc)' in the following doesn't include the instruction itself; it is
231 ; calculated as if the instruction had zero size.
232 (define_attr "length" ""
233 (if_then_else (eq_attr "type" "branch")
234 (if_then_else (and (ge (minus (match_dup 0) (pc))
236 (lt (minus (match_dup 0) (pc))
242 ;; Processor type -- this attribute must exactly match the processor_type
243 ;; enumeration in rs6000-opts.h.
245 "ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630,
246 ppc750,ppc7400,ppc7450,
247 ppc403,ppc405,ppc440,ppc476,
248 ppc8540,ppc8548,ppce300c2,ppce300c3,ppce500mc,ppce500mc64,ppce5500,ppce6500,
249 power4,power5,power6,power7,power8,
250 rs64a,mpccore,cell,ppca2,titan"
251 (const (symbol_ref "rs6000_cpu_attr")))
254 ;; If this instruction is microcoded on the CELL processor
255 ; The default for load extended, the recorded instructions and rotate/shifts by a variable is always microcoded
256 (define_attr "cell_micro" "not,conditional,always"
257 (if_then_else (ior (eq_attr "type" "compare")
258 (and (eq_attr "type" "shift,exts,mul")
259 (eq_attr "dot" "yes"))
260 (and (eq_attr "type" "load")
261 (eq_attr "sign_extend" "yes"))
262 (and (eq_attr "type" "shift")
263 (eq_attr "var_shift" "yes")))
264 (const_string "always")
265 (const_string "not")))
267 (automata_option "ndfa")
280 (include "e300c2c3.md")
281 (include "e500mc.md")
282 (include "e500mc64.md")
285 (include "power4.md")
286 (include "power5.md")
287 (include "power6.md")
288 (include "power7.md")
289 (include "power8.md")
295 (include "predicates.md")
296 (include "constraints.md")
298 (include "darwin.md")
303 ; This mode iterator allows :GPR to be used to indicate the allowable size
304 ; of whole values in GPRs.
305 (define_mode_iterator GPR [SI (DI "TARGET_POWERPC64")])
307 ; Any supported integer mode.
308 (define_mode_iterator INT [QI HI SI DI TI PTI])
310 ; Any supported integer mode that fits in one register.
311 (define_mode_iterator INT1 [QI HI SI (DI "TARGET_POWERPC64")])
313 ; Everything we can extend QImode to.
314 (define_mode_iterator EXTQI [HI SI (DI "TARGET_POWERPC64")])
316 ; Everything we can extend HImode to.
317 (define_mode_iterator EXTHI [SI (DI "TARGET_POWERPC64")])
319 ; Everything we can extend SImode to.
320 (define_mode_iterator EXTSI [(DI "TARGET_POWERPC64")])
322 ; QImode or HImode for small atomic ops
323 (define_mode_iterator QHI [QI HI])
325 ; HImode or SImode for sign extended fusion ops
326 (define_mode_iterator HSI [HI SI])
328 ; SImode or DImode, even if DImode doesn't fit in GPRs.
329 (define_mode_iterator SDI [SI DI])
331 ; The size of a pointer. Also, the size of the value that a record-condition
332 ; (one with a '.') will compare; and the size used for arithmetic carries.
333 (define_mode_iterator P [(SI "TARGET_32BIT") (DI "TARGET_64BIT")])
335 ; Iterator to add PTImode along with TImode (TImode can go in VSX registers,
336 ; PTImode is GPR only)
337 (define_mode_iterator TI2 [TI PTI])
339 ; Any hardware-supported floating-point mode
340 (define_mode_iterator FP [
341 (SF "TARGET_HARD_FLOAT
342 && ((TARGET_FPRS && TARGET_SINGLE_FLOAT) || TARGET_E500_SINGLE)")
343 (DF "TARGET_HARD_FLOAT
344 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)")
345 (TF "!TARGET_IEEEQUAD
347 && (TARGET_FPRS || TARGET_E500_DOUBLE)
348 && TARGET_LONG_DOUBLE_128")
352 ; Any fma capable floating-point mode.
353 (define_mode_iterator FMA_F [
354 (SF "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT")
355 (DF "(TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT)
356 || VECTOR_UNIT_VSX_P (DFmode)")
357 (V2SF "TARGET_PAIRED_FLOAT")
358 (V4SF "VECTOR_UNIT_ALTIVEC_OR_VSX_P (V4SFmode)")
359 (V2DF "VECTOR_UNIT_ALTIVEC_OR_VSX_P (V2DFmode)")
362 ; Floating point move iterators to combine binary and decimal moves
363 (define_mode_iterator FMOVE32 [SF SD])
364 (define_mode_iterator FMOVE64 [DF DD])
365 (define_mode_iterator FMOVE64X [DI DF DD])
366 (define_mode_iterator FMOVE128 [(TF "!TARGET_IEEEQUAD && TARGET_LONG_DOUBLE_128")
367 (TD "TARGET_HARD_FLOAT && TARGET_FPRS")])
369 ; Iterators for 128 bit types for direct move
370 (define_mode_iterator FMOVE128_GPR [(TI "TARGET_VSX_TIMODE")
379 ; Whether a floating point move is ok, don't allow SD without hardware FP
380 (define_mode_attr fmove_ok [(SF "")
382 (SD "TARGET_HARD_FLOAT && TARGET_FPRS")
385 ; Convert REAL_VALUE to the appropriate bits
386 (define_mode_attr real_value_to_target [(SF "REAL_VALUE_TO_TARGET_SINGLE")
387 (DF "REAL_VALUE_TO_TARGET_DOUBLE")
388 (SD "REAL_VALUE_TO_TARGET_DECIMAL32")
389 (DD "REAL_VALUE_TO_TARGET_DECIMAL64")])
391 ; Definitions for load to 32-bit fpr register
392 (define_mode_attr f32_lr [(SF "f") (SD "wz")])
393 (define_mode_attr f32_lm [(SF "m") (SD "Z")])
394 (define_mode_attr f32_li [(SF "lfs%U1%X1 %0,%1") (SD "lfiwzx %0,%y1")])
395 (define_mode_attr f32_lv [(SF "lxsspx %x0,%y1") (SD "lxsiwzx %x0,%y1")])
397 ; Definitions for store from 32-bit fpr register
398 (define_mode_attr f32_sr [(SF "f") (SD "wx")])
399 (define_mode_attr f32_sm [(SF "m") (SD "Z")])
400 (define_mode_attr f32_si [(SF "stfs%U0%X0 %1,%0") (SD "stfiwx %1,%y0")])
401 (define_mode_attr f32_sv [(SF "stxsspx %x1,%y0") (SD "stxsiwzx %x1,%y0")])
403 ; Definitions for 32-bit fpr direct move
404 (define_mode_attr f32_dm [(SF "wn") (SD "wh")])
406 ; These modes do not fit in integer registers in 32-bit mode.
407 ; but on e500v2, the gpr are 64 bit registers
408 (define_mode_iterator DIFD [DI (DF "!TARGET_E500_DOUBLE") DD])
410 ; Iterator for reciprocal estimate instructions
411 (define_mode_iterator RECIPF [SF DF V4SF V2DF])
413 ; Iterator for just SF/DF
414 (define_mode_iterator SFDF [SF DF])
416 ; SF/DF suffix for traditional floating instructions
417 (define_mode_attr Ftrad [(SF "s") (DF "")])
419 ; SF/DF suffix for VSX instructions
420 (define_mode_attr Fvsx [(SF "sp") (DF "dp")])
422 ; SF/DF constraint for arithmetic on traditional floating point registers
423 (define_mode_attr Ff [(SF "f") (DF "d")])
425 ; SF/DF constraint for arithmetic on VSX registers
426 (define_mode_attr Fv [(SF "wy") (DF "ws")])
428 ; s/d suffix for things like fp_addsub_s/fp_addsub_d
429 (define_mode_attr Fs [(SF "s") (DF "d")])
432 (define_mode_attr Ffre [(SF "fres") (DF "fre")])
433 (define_mode_attr FFRE [(SF "FRES") (DF "FRE")])
435 ; Conditional returns.
436 (define_code_iterator any_return [return simple_return])
437 (define_code_attr return_pred [(return "direct_return ()")
438 (simple_return "1")])
439 (define_code_attr return_str [(return "") (simple_return "simple_")])
441 ; Signed/unsigned variants of ops.
442 (define_code_iterator any_extend [sign_extend zero_extend])
443 (define_code_attr u [(sign_extend "") (zero_extend "u")])
444 (define_code_attr su [(sign_extend "s") (zero_extend "u")])
446 ; Various instructions that come in SI and DI forms.
447 ; A generic w/d attribute, for things like cmpw/cmpd.
448 (define_mode_attr wd [(QI "b")
457 ;; How many bits in this mode?
458 (define_mode_attr bits [(QI "8") (HI "16") (SI "32") (DI "64")])
461 (define_mode_attr dbits [(QI "56") (HI "48") (SI "32")])
463 ;; ISEL/ISEL64 target selection
464 (define_mode_attr sel [(SI "") (DI "64")])
466 ;; Bitmask for shift instructions
467 (define_mode_attr hH [(SI "h") (DI "H")])
469 ;; A mode twice the size of the given mode
470 (define_mode_attr dmode [(SI "di") (DI "ti")])
471 (define_mode_attr DMODE [(SI "DI") (DI "TI")])
473 ;; Suffix for reload patterns
474 (define_mode_attr ptrsize [(SI "32bit")
477 (define_mode_attr tptrsize [(SI "TARGET_32BIT")
478 (DI "TARGET_64BIT")])
480 (define_mode_attr mptrsize [(SI "si")
483 (define_mode_attr ptrload [(SI "lwz")
486 (define_mode_attr ptrm [(SI "m")
489 (define_mode_attr rreg [(SF "f")
496 (define_mode_attr rreg2 [(SF "f")
499 (define_mode_attr SI_CONVERT_FP [(SF "TARGET_FCFIDS")
500 (DF "TARGET_FCFID")])
502 (define_mode_attr E500_CONVERT [(SF "!TARGET_FPRS")
503 (DF "TARGET_E500_DOUBLE")])
505 (define_mode_attr TARGET_FLOAT [(SF "TARGET_SINGLE_FLOAT")
506 (DF "TARGET_DOUBLE_FLOAT")])
508 ;; Mode iterator for logical operations on 128-bit types
509 (define_mode_iterator BOOL_128 [TI
511 (V16QI "TARGET_ALTIVEC")
512 (V8HI "TARGET_ALTIVEC")
513 (V4SI "TARGET_ALTIVEC")
514 (V4SF "TARGET_ALTIVEC")
515 (V2DI "TARGET_ALTIVEC")
516 (V2DF "TARGET_ALTIVEC")
517 (V1TI "TARGET_ALTIVEC")])
519 ;; For the GPRs we use 3 constraints for register outputs, two that are the
520 ;; same as the output register, and a third where the output register is an
521 ;; early clobber, so we don't have to deal with register overlaps. For the
522 ;; vector types, we prefer to use the vector registers. For TI mode, allow
525 ;; Mode attribute for boolean operation register constraints for output
526 (define_mode_attr BOOL_REGS_OUTPUT [(TI "&r,r,r,wa,v")
528 (V16QI "wa,v,&?r,?r,?r")
529 (V8HI "wa,v,&?r,?r,?r")
530 (V4SI "wa,v,&?r,?r,?r")
531 (V4SF "wa,v,&?r,?r,?r")
532 (V2DI "wa,v,&?r,?r,?r")
533 (V2DF "wa,v,&?r,?r,?r")
534 (V1TI "wa,v,&?r,?r,?r")])
536 ;; Mode attribute for boolean operation register constraints for operand1
537 (define_mode_attr BOOL_REGS_OP1 [(TI "r,0,r,wa,v")
545 (V1TI "wa,v,r,0,r")])
547 ;; Mode attribute for boolean operation register constraints for operand2
548 (define_mode_attr BOOL_REGS_OP2 [(TI "r,r,0,wa,v")
556 (V1TI "wa,v,r,r,0")])
558 ;; Mode attribute for boolean operation register constraints for operand1
559 ;; for one_cmpl. To simplify things, we repeat the constraint where 0
560 ;; is used for operand1 or operand2
561 (define_mode_attr BOOL_REGS_UNARY [(TI "r,0,0,wa,v")
569 (V1TI "wa,v,r,0,0")])
571 ;; Start with fixed-point load and store insns. Here we put only the more
572 ;; complex forms. Basic data transfer is done later.
574 (define_insn "zero_extendqi<mode>2"
575 [(set (match_operand:EXTQI 0 "gpc_reg_operand" "=r,r")
576 (zero_extend:EXTQI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
581 [(set_attr "type" "load,shift")])
583 (define_insn_and_split "*zero_extendqi<mode>2_dot"
584 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
585 (compare:CC (zero_extend:EXTQI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
587 (clobber (match_scratch:EXTQI 0 "=r,r"))]
588 "rs6000_gen_cell_microcode"
592 "&& reload_completed && cc_reg_not_cr0_operand (operands[2], CCmode)"
594 (zero_extend:EXTQI (match_dup 1)))
596 (compare:CC (match_dup 0)
599 [(set_attr "type" "logical")
600 (set_attr "dot" "yes")
601 (set_attr "length" "4,8")])
603 (define_insn_and_split "*zero_extendqi<mode>2_dot2"
604 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
605 (compare:CC (zero_extend:EXTQI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
607 (set (match_operand:EXTQI 0 "gpc_reg_operand" "=r,r")
608 (zero_extend:EXTQI (match_dup 1)))]
609 "rs6000_gen_cell_microcode"
613 "&& reload_completed && cc_reg_not_cr0_operand (operands[2], CCmode)"
615 (zero_extend:EXTQI (match_dup 1)))
617 (compare:CC (match_dup 0)
620 [(set_attr "type" "logical")
621 (set_attr "dot" "yes")
622 (set_attr "length" "4,8")])
625 (define_insn "zero_extendhi<mode>2"
626 [(set (match_operand:EXTHI 0 "gpc_reg_operand" "=r,r")
627 (zero_extend:EXTHI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
631 rlwinm %0,%1,0,0xffff"
632 [(set_attr "type" "load,shift")])
634 (define_insn_and_split "*zero_extendhi<mode>2_dot"
635 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
636 (compare:CC (zero_extend:EXTHI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
638 (clobber (match_scratch:EXTHI 0 "=r,r"))]
639 "rs6000_gen_cell_microcode"
643 "&& reload_completed && cc_reg_not_cr0_operand (operands[2], CCmode)"
645 (zero_extend:EXTHI (match_dup 1)))
647 (compare:CC (match_dup 0)
650 [(set_attr "type" "logical")
651 (set_attr "dot" "yes")
652 (set_attr "length" "4,8")])
654 (define_insn_and_split "*zero_extendhi<mode>2_dot2"
655 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
656 (compare:CC (zero_extend:EXTHI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
658 (set (match_operand:EXTHI 0 "gpc_reg_operand" "=r,r")
659 (zero_extend:EXTHI (match_dup 1)))]
660 "rs6000_gen_cell_microcode"
664 "&& reload_completed && cc_reg_not_cr0_operand (operands[2], CCmode)"
666 (zero_extend:EXTHI (match_dup 1)))
668 (compare:CC (match_dup 0)
671 [(set_attr "type" "logical")
672 (set_attr "dot" "yes")
673 (set_attr "length" "4,8")])
676 (define_insn "zero_extendsi<mode>2"
677 [(set (match_operand:EXTSI 0 "gpc_reg_operand" "=r,r,??wj,!wz,!wu")
678 (zero_extend:EXTSI (match_operand:SI 1 "reg_or_mem_operand" "m,r,r,Z,Z")))]
686 [(set_attr "type" "load,shift,mffgpr,fpload,fpload")])
688 (define_insn_and_split "*zero_extendsi<mode>2_dot"
689 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
690 (compare:CC (zero_extend:EXTSI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
692 (clobber (match_scratch:EXTSI 0 "=r,r"))]
693 "rs6000_gen_cell_microcode"
697 "&& reload_completed && cc_reg_not_cr0_operand (operands[2], CCmode)"
699 (zero_extend:DI (match_dup 1)))
701 (compare:CC (match_dup 0)
704 [(set_attr "type" "shift")
705 (set_attr "dot" "yes")
706 (set_attr "length" "4,8")])
708 (define_insn_and_split "*zero_extendsi<mode>2_dot2"
709 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
710 (compare:CC (zero_extend:EXTSI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
712 (set (match_operand:EXTSI 0 "gpc_reg_operand" "=r,r")
713 (zero_extend:EXTSI (match_dup 1)))]
714 "rs6000_gen_cell_microcode"
718 "&& reload_completed && cc_reg_not_cr0_operand (operands[2], CCmode)"
720 (zero_extend:EXTSI (match_dup 1)))
722 (compare:CC (match_dup 0)
725 [(set_attr "type" "shift")
726 (set_attr "dot" "yes")
727 (set_attr "length" "4,8")])
730 (define_insn "extendqi<mode>2"
731 [(set (match_operand:EXTQI 0 "gpc_reg_operand" "=r")
732 (sign_extend:EXTQI (match_operand:QI 1 "gpc_reg_operand" "r")))]
735 [(set_attr "type" "exts")])
737 (define_insn_and_split "*extendqi<mode>2_dot"
738 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
739 (compare:CC (sign_extend:EXTQI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
741 (clobber (match_scratch:EXTQI 0 "=r,r"))]
742 "rs6000_gen_cell_microcode"
746 "&& reload_completed && cc_reg_not_cr0_operand (operands[2], CCmode)"
748 (sign_extend:EXTQI (match_dup 1)))
750 (compare:CC (match_dup 0)
753 [(set_attr "type" "exts")
754 (set_attr "dot" "yes")
755 (set_attr "length" "4,8")])
757 (define_insn_and_split "*extendqi<mode>2_dot2"
758 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
759 (compare:CC (sign_extend:EXTQI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
761 (set (match_operand:EXTQI 0 "gpc_reg_operand" "=r,r")
762 (sign_extend:EXTQI (match_dup 1)))]
763 "rs6000_gen_cell_microcode"
767 "&& reload_completed && cc_reg_not_cr0_operand (operands[2], CCmode)"
769 (sign_extend:EXTQI (match_dup 1)))
771 (compare:CC (match_dup 0)
774 [(set_attr "type" "exts")
775 (set_attr "dot" "yes")
776 (set_attr "length" "4,8")])
779 (define_expand "extendhi<mode>2"
780 [(set (match_operand:EXTHI 0 "gpc_reg_operand" "")
781 (sign_extend:EXTHI (match_operand:HI 1 "gpc_reg_operand" "")))]
785 (define_insn "*extendhi<mode>2"
786 [(set (match_operand:EXTHI 0 "gpc_reg_operand" "=r,r")
787 (sign_extend:EXTHI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
788 "rs6000_gen_cell_microcode"
792 [(set_attr "type" "load,exts")
793 (set_attr "sign_extend" "yes")])
795 (define_insn "*extendhi<mode>2_noload"
796 [(set (match_operand:EXTHI 0 "gpc_reg_operand" "=r")
797 (sign_extend:EXTHI (match_operand:HI 1 "gpc_reg_operand" "r")))]
798 "!rs6000_gen_cell_microcode"
800 [(set_attr "type" "exts")])
802 (define_insn_and_split "*extendhi<mode>2_dot"
803 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
804 (compare:CC (sign_extend:EXTHI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
806 (clobber (match_scratch:EXTHI 0 "=r,r"))]
807 "rs6000_gen_cell_microcode"
811 "&& reload_completed && cc_reg_not_cr0_operand (operands[2], CCmode)"
813 (sign_extend:EXTHI (match_dup 1)))
815 (compare:CC (match_dup 0)
818 [(set_attr "type" "exts")
819 (set_attr "dot" "yes")
820 (set_attr "length" "4,8")])
822 (define_insn_and_split "*extendhi<mode>2_dot2"
823 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
824 (compare:CC (sign_extend:EXTHI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
826 (set (match_operand:EXTHI 0 "gpc_reg_operand" "=r,r")
827 (sign_extend:EXTHI (match_dup 1)))]
828 "rs6000_gen_cell_microcode"
832 "&& reload_completed && cc_reg_not_cr0_operand (operands[2], CCmode)"
834 (sign_extend:EXTHI (match_dup 1)))
836 (compare:CC (match_dup 0)
839 [(set_attr "type" "exts")
840 (set_attr "dot" "yes")
841 (set_attr "length" "4,8")])
844 (define_insn "extendsi<mode>2"
845 [(set (match_operand:EXTSI 0 "gpc_reg_operand" "=r,r,??wj,!wl,!wu")
846 (sign_extend:EXTSI (match_operand:SI 1 "lwa_operand" "Y,r,r,Z,Z")))]
854 [(set_attr "type" "load,exts,mffgpr,fpload,fpload")
855 (set_attr "sign_extend" "yes")])
857 (define_insn_and_split "*extendsi<mode>2_dot"
858 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
859 (compare:CC (sign_extend:EXTSI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
861 (clobber (match_scratch:EXTSI 0 "=r,r"))]
862 "rs6000_gen_cell_microcode"
866 "&& reload_completed && cc_reg_not_cr0_operand (operands[2], CCmode)"
868 (sign_extend:EXTSI (match_dup 1)))
870 (compare:CC (match_dup 0)
873 [(set_attr "type" "exts")
874 (set_attr "dot" "yes")
875 (set_attr "length" "4,8")])
877 (define_insn_and_split "*extendsi<mode>2_dot2"
878 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
879 (compare:CC (sign_extend:EXTSI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
881 (set (match_operand:EXTSI 0 "gpc_reg_operand" "=r,r")
882 (sign_extend:EXTSI (match_dup 1)))]
883 "rs6000_gen_cell_microcode"
887 "&& reload_completed && cc_reg_not_cr0_operand (operands[2], CCmode)"
889 (sign_extend:EXTSI (match_dup 1)))
891 (compare:CC (match_dup 0)
894 [(set_attr "type" "exts")
895 (set_attr "dot" "yes")
896 (set_attr "length" "4,8")])
898 ;; IBM 405, 440, 464 and 476 half-word multiplication operations.
900 (define_insn "*macchwc"
901 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
902 (compare:CC (plus:SI (mult:SI (ashiftrt:SI
903 (match_operand:SI 2 "gpc_reg_operand" "r")
906 (match_operand:HI 1 "gpc_reg_operand" "r")))
907 (match_operand:SI 4 "gpc_reg_operand" "0"))
909 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
910 (plus:SI (mult:SI (ashiftrt:SI
918 [(set_attr "type" "halfmul")])
920 (define_insn "*macchw"
921 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
922 (plus:SI (mult:SI (ashiftrt:SI
923 (match_operand:SI 2 "gpc_reg_operand" "r")
926 (match_operand:HI 1 "gpc_reg_operand" "r")))
927 (match_operand:SI 3 "gpc_reg_operand" "0")))]
930 [(set_attr "type" "halfmul")])
932 (define_insn "*macchwuc"
933 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
934 (compare:CC (plus:SI (mult:SI (lshiftrt:SI
935 (match_operand:SI 2 "gpc_reg_operand" "r")
938 (match_operand:HI 1 "gpc_reg_operand" "r")))
939 (match_operand:SI 4 "gpc_reg_operand" "0"))
941 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
942 (plus:SI (mult:SI (lshiftrt:SI
950 [(set_attr "type" "halfmul")])
952 (define_insn "*macchwu"
953 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
954 (plus:SI (mult:SI (lshiftrt:SI
955 (match_operand:SI 2 "gpc_reg_operand" "r")
958 (match_operand:HI 1 "gpc_reg_operand" "r")))
959 (match_operand:SI 3 "gpc_reg_operand" "0")))]
962 [(set_attr "type" "halfmul")])
964 (define_insn "*machhwc"
965 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
966 (compare:CC (plus:SI (mult:SI (ashiftrt:SI
967 (match_operand:SI 1 "gpc_reg_operand" "%r")
970 (match_operand:SI 2 "gpc_reg_operand" "r")
972 (match_operand:SI 4 "gpc_reg_operand" "0"))
974 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
975 (plus:SI (mult:SI (ashiftrt:SI
984 [(set_attr "type" "halfmul")])
986 (define_insn "*machhw"
987 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
988 (plus:SI (mult:SI (ashiftrt:SI
989 (match_operand:SI 1 "gpc_reg_operand" "%r")
992 (match_operand:SI 2 "gpc_reg_operand" "r")
994 (match_operand:SI 3 "gpc_reg_operand" "0")))]
997 [(set_attr "type" "halfmul")])
999 (define_insn "*machhwuc"
1000 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1001 (compare:CC (plus:SI (mult:SI (lshiftrt:SI
1002 (match_operand:SI 1 "gpc_reg_operand" "%r")
1005 (match_operand:SI 2 "gpc_reg_operand" "r")
1007 (match_operand:SI 4 "gpc_reg_operand" "0"))
1009 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1010 (plus:SI (mult:SI (lshiftrt:SI
1019 [(set_attr "type" "halfmul")])
1021 (define_insn "*machhwu"
1022 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1023 (plus:SI (mult:SI (lshiftrt:SI
1024 (match_operand:SI 1 "gpc_reg_operand" "%r")
1027 (match_operand:SI 2 "gpc_reg_operand" "r")
1029 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1032 [(set_attr "type" "halfmul")])
1034 (define_insn "*maclhwc"
1035 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1036 (compare:CC (plus:SI (mult:SI (sign_extend:SI
1037 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1039 (match_operand:HI 2 "gpc_reg_operand" "r")))
1040 (match_operand:SI 4 "gpc_reg_operand" "0"))
1042 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1043 (plus:SI (mult:SI (sign_extend:SI
1050 [(set_attr "type" "halfmul")])
1052 (define_insn "*maclhw"
1053 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1054 (plus:SI (mult:SI (sign_extend:SI
1055 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1057 (match_operand:HI 2 "gpc_reg_operand" "r")))
1058 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1061 [(set_attr "type" "halfmul")])
1063 (define_insn "*maclhwuc"
1064 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1065 (compare:CC (plus:SI (mult:SI (zero_extend:SI
1066 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1068 (match_operand:HI 2 "gpc_reg_operand" "r")))
1069 (match_operand:SI 4 "gpc_reg_operand" "0"))
1071 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1072 (plus:SI (mult:SI (zero_extend:SI
1079 [(set_attr "type" "halfmul")])
1081 (define_insn "*maclhwu"
1082 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1083 (plus:SI (mult:SI (zero_extend:SI
1084 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1086 (match_operand:HI 2 "gpc_reg_operand" "r")))
1087 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1090 [(set_attr "type" "halfmul")])
1092 (define_insn "*nmacchwc"
1093 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1094 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1095 (mult:SI (ashiftrt:SI
1096 (match_operand:SI 2 "gpc_reg_operand" "r")
1099 (match_operand:HI 1 "gpc_reg_operand" "r"))))
1101 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1102 (minus:SI (match_dup 4)
1103 (mult:SI (ashiftrt:SI
1110 [(set_attr "type" "halfmul")])
1112 (define_insn "*nmacchw"
1113 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1114 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1115 (mult:SI (ashiftrt:SI
1116 (match_operand:SI 2 "gpc_reg_operand" "r")
1119 (match_operand:HI 1 "gpc_reg_operand" "r")))))]
1122 [(set_attr "type" "halfmul")])
1124 (define_insn "*nmachhwc"
1125 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1126 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1127 (mult:SI (ashiftrt:SI
1128 (match_operand:SI 1 "gpc_reg_operand" "%r")
1131 (match_operand:SI 2 "gpc_reg_operand" "r")
1134 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1135 (minus:SI (match_dup 4)
1136 (mult:SI (ashiftrt:SI
1144 [(set_attr "type" "halfmul")])
1146 (define_insn "*nmachhw"
1147 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1148 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1149 (mult:SI (ashiftrt:SI
1150 (match_operand:SI 1 "gpc_reg_operand" "%r")
1153 (match_operand:SI 2 "gpc_reg_operand" "r")
1157 [(set_attr "type" "halfmul")])
1159 (define_insn "*nmaclhwc"
1160 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1161 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1162 (mult:SI (sign_extend:SI
1163 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1165 (match_operand:HI 2 "gpc_reg_operand" "r"))))
1167 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1168 (minus:SI (match_dup 4)
1169 (mult:SI (sign_extend:SI
1175 [(set_attr "type" "halfmul")])
1177 (define_insn "*nmaclhw"
1178 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1179 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1180 (mult:SI (sign_extend:SI
1181 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1183 (match_operand:HI 2 "gpc_reg_operand" "r")))))]
1186 [(set_attr "type" "halfmul")])
1188 (define_insn "*mulchwc"
1189 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1190 (compare:CC (mult:SI (ashiftrt:SI
1191 (match_operand:SI 2 "gpc_reg_operand" "r")
1194 (match_operand:HI 1 "gpc_reg_operand" "r")))
1196 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1197 (mult:SI (ashiftrt:SI
1204 [(set_attr "type" "halfmul")])
1206 (define_insn "*mulchw"
1207 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1208 (mult:SI (ashiftrt:SI
1209 (match_operand:SI 2 "gpc_reg_operand" "r")
1212 (match_operand:HI 1 "gpc_reg_operand" "r"))))]
1215 [(set_attr "type" "halfmul")])
1217 (define_insn "*mulchwuc"
1218 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1219 (compare:CC (mult:SI (lshiftrt:SI
1220 (match_operand:SI 2 "gpc_reg_operand" "r")
1223 (match_operand:HI 1 "gpc_reg_operand" "r")))
1225 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1226 (mult:SI (lshiftrt:SI
1233 [(set_attr "type" "halfmul")])
1235 (define_insn "*mulchwu"
1236 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1237 (mult:SI (lshiftrt:SI
1238 (match_operand:SI 2 "gpc_reg_operand" "r")
1241 (match_operand:HI 1 "gpc_reg_operand" "r"))))]
1244 [(set_attr "type" "halfmul")])
1246 (define_insn "*mulhhwc"
1247 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1248 (compare:CC (mult:SI (ashiftrt:SI
1249 (match_operand:SI 1 "gpc_reg_operand" "%r")
1252 (match_operand:SI 2 "gpc_reg_operand" "r")
1255 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1256 (mult:SI (ashiftrt:SI
1264 [(set_attr "type" "halfmul")])
1266 (define_insn "*mulhhw"
1267 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1268 (mult:SI (ashiftrt:SI
1269 (match_operand:SI 1 "gpc_reg_operand" "%r")
1272 (match_operand:SI 2 "gpc_reg_operand" "r")
1276 [(set_attr "type" "halfmul")])
1278 (define_insn "*mulhhwuc"
1279 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1280 (compare:CC (mult:SI (lshiftrt:SI
1281 (match_operand:SI 1 "gpc_reg_operand" "%r")
1284 (match_operand:SI 2 "gpc_reg_operand" "r")
1287 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1288 (mult:SI (lshiftrt:SI
1296 [(set_attr "type" "halfmul")])
1298 (define_insn "*mulhhwu"
1299 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1300 (mult:SI (lshiftrt:SI
1301 (match_operand:SI 1 "gpc_reg_operand" "%r")
1304 (match_operand:SI 2 "gpc_reg_operand" "r")
1308 [(set_attr "type" "halfmul")])
1310 (define_insn "*mullhwc"
1311 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1312 (compare:CC (mult:SI (sign_extend:SI
1313 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1315 (match_operand:HI 2 "gpc_reg_operand" "r")))
1317 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1318 (mult:SI (sign_extend:SI
1324 [(set_attr "type" "halfmul")])
1326 (define_insn "*mullhw"
1327 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1328 (mult:SI (sign_extend:SI
1329 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1331 (match_operand:HI 2 "gpc_reg_operand" "r"))))]
1334 [(set_attr "type" "halfmul")])
1336 (define_insn "*mullhwuc"
1337 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1338 (compare:CC (mult:SI (zero_extend:SI
1339 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1341 (match_operand:HI 2 "gpc_reg_operand" "r")))
1343 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1344 (mult:SI (zero_extend:SI
1350 [(set_attr "type" "halfmul")])
1352 (define_insn "*mullhwu"
1353 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1354 (mult:SI (zero_extend:SI
1355 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1357 (match_operand:HI 2 "gpc_reg_operand" "r"))))]
1360 [(set_attr "type" "halfmul")])
1362 ;; IBM 405, 440, 464 and 476 string-search dlmzb instruction support.
1363 (define_insn "dlmzb"
1364 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1365 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
1366 (match_operand:SI 2 "gpc_reg_operand" "r")]
1368 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1369 (unspec:SI [(match_dup 1)
1375 (define_expand "strlensi"
1376 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1377 (unspec:SI [(match_operand:BLK 1 "general_operand" "")
1378 (match_operand:QI 2 "const_int_operand" "")
1379 (match_operand 3 "const_int_operand" "")]
1380 UNSPEC_DLMZB_STRLEN))
1381 (clobber (match_scratch:CC 4 "=x"))]
1382 "TARGET_DLMZB && WORDS_BIG_ENDIAN && !optimize_size"
1384 rtx result = operands[0];
1385 rtx src = operands[1];
1386 rtx search_char = operands[2];
1387 rtx align = operands[3];
1388 rtx addr, scratch_string, word1, word2, scratch_dlmzb;
1389 rtx loop_label, end_label, mem, cr0, cond;
1390 if (search_char != const0_rtx
1391 || GET_CODE (align) != CONST_INT
1392 || INTVAL (align) < 8)
1394 word1 = gen_reg_rtx (SImode);
1395 word2 = gen_reg_rtx (SImode);
1396 scratch_dlmzb = gen_reg_rtx (SImode);
1397 scratch_string = gen_reg_rtx (Pmode);
1398 loop_label = gen_label_rtx ();
1399 end_label = gen_label_rtx ();
1400 addr = force_reg (Pmode, XEXP (src, 0));
1401 emit_move_insn (scratch_string, addr);
1402 emit_label (loop_label);
1403 mem = change_address (src, SImode, scratch_string);
1404 emit_move_insn (word1, mem);
1405 emit_move_insn (word2, adjust_address (mem, SImode, 4));
1406 cr0 = gen_rtx_REG (CCmode, CR0_REGNO);
1407 emit_insn (gen_dlmzb (scratch_dlmzb, word1, word2, cr0));
1408 cond = gen_rtx_NE (VOIDmode, cr0, const0_rtx);
1409 emit_jump_insn (gen_rtx_SET (VOIDmode,
1411 gen_rtx_IF_THEN_ELSE (VOIDmode,
1417 emit_insn (gen_addsi3 (scratch_string, scratch_string, GEN_INT (8)));
1418 emit_jump_insn (gen_rtx_SET (VOIDmode,
1420 gen_rtx_LABEL_REF (VOIDmode, loop_label)));
1422 emit_label (end_label);
1423 emit_insn (gen_addsi3 (scratch_string, scratch_string, scratch_dlmzb));
1424 emit_insn (gen_subsi3 (result, scratch_string, addr));
1425 emit_insn (gen_subsi3 (result, result, const1_rtx));
1429 ;; Fixed-point arithmetic insns.
1431 (define_expand "add<mode>3"
1432 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1433 (plus:SDI (match_operand:SDI 1 "gpc_reg_operand" "")
1434 (match_operand:SDI 2 "reg_or_add_cint_operand" "")))]
1437 if (<MODE>mode == DImode && ! TARGET_POWERPC64)
1439 if (non_short_cint_operand (operands[2], DImode))
1442 else if (GET_CODE (operands[2]) == CONST_INT
1443 && ! add_operand (operands[2], <MODE>mode))
1445 rtx tmp = ((!can_create_pseudo_p ()
1446 || rtx_equal_p (operands[0], operands[1]))
1447 ? operands[0] : gen_reg_rtx (<MODE>mode));
1449 HOST_WIDE_INT val = INTVAL (operands[2]);
1450 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1451 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, <MODE>mode);
1453 if (<MODE>mode == DImode && !satisfies_constraint_L (GEN_INT (rest)))
1456 /* The ordering here is important for the prolog expander.
1457 When space is allocated from the stack, adding 'low' first may
1458 produce a temporary deallocation (which would be bad). */
1459 emit_insn (gen_add<mode>3 (tmp, operands[1], GEN_INT (rest)));
1460 emit_insn (gen_add<mode>3 (operands[0], tmp, GEN_INT (low)));
1465 ;; Discourage ai/addic because of carry but provide it in an alternative
1466 ;; allowing register zero as source.
1467 (define_insn "*add<mode>3_internal1"
1468 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r,?r,r")
1469 (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "%r,b,r,b")
1470 (match_operand:GPR 2 "add_operand" "r,I,I,L")))]
1471 "!DECIMAL_FLOAT_MODE_P (GET_MODE (operands[0])) && !DECIMAL_FLOAT_MODE_P (GET_MODE (operands[1]))"
1477 [(set_attr "type" "add")])
1479 (define_insn "addsi3_high"
1480 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
1481 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
1482 (high:SI (match_operand 2 "" ""))))]
1483 "TARGET_MACHO && !TARGET_64BIT"
1484 "addis %0,%1,ha16(%2)"
1485 [(set_attr "type" "add")])
1487 (define_insn "*add<mode>3_internal2"
1488 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
1489 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "%r,r,r,r")
1490 (match_operand:P 2 "reg_or_short_operand" "r,I,r,I"))
1492 (clobber (match_scratch:P 3 "=r,r,r,r"))]
1499 [(set_attr "type" "add,compare,compare,compare")
1500 (set_attr "dot" "yes")
1501 (set_attr "length" "4,4,8,8")])
1504 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1505 (compare:CC (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1506 (match_operand:GPR 2 "reg_or_short_operand" ""))
1508 (clobber (match_scratch:GPR 3 ""))]
1511 (plus:GPR (match_dup 1)
1514 (compare:CC (match_dup 3)
1518 (define_insn "*add<mode>3_internal3"
1519 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
1520 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "%r,r,r,r")
1521 (match_operand:P 2 "reg_or_short_operand" "r,I,r,I"))
1523 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
1524 (plus:P (match_dup 1)
1532 [(set_attr "type" "add,compare,compare,compare")
1533 (set_attr "dot" "yes")
1534 (set_attr "length" "4,4,8,8")])
1537 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1538 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "")
1539 (match_operand:P 2 "reg_or_short_operand" ""))
1541 (set (match_operand:P 0 "gpc_reg_operand" "")
1542 (plus:P (match_dup 1) (match_dup 2)))]
1545 (plus:P (match_dup 1)
1548 (compare:CC (match_dup 0)
1552 ;; Split an add that we can't do in one insn into two insns, each of which
1553 ;; does one 16-bit part. This is used by combine. Note that the low-order
1554 ;; add should be last in case the result gets used in an address.
1557 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
1558 (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1559 (match_operand:GPR 2 "non_add_cint_operand" "")))]
1561 [(set (match_dup 0) (plus:GPR (match_dup 1) (match_dup 3)))
1562 (set (match_dup 0) (plus:GPR (match_dup 0) (match_dup 4)))]
1564 HOST_WIDE_INT val = INTVAL (operands[2]);
1565 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1566 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, <MODE>mode);
1568 operands[4] = GEN_INT (low);
1569 if (<MODE>mode == SImode || satisfies_constraint_L (GEN_INT (rest)))
1570 operands[3] = GEN_INT (rest);
1571 else if (can_create_pseudo_p ())
1573 operands[3] = gen_reg_rtx (DImode);
1574 emit_move_insn (operands[3], operands[2]);
1575 emit_insn (gen_adddi3 (operands[0], operands[1], operands[3]));
1582 (define_expand "one_cmpl<mode>2"
1583 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1584 (not:SDI (match_operand:SDI 1 "gpc_reg_operand" "")))]
1587 if (<MODE>mode == DImode && !TARGET_POWERPC64)
1589 rs6000_split_logical (operands, NOT, false, false, false);
1594 (define_insn "*one_cmpl<mode>2"
1595 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1596 (not:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
1600 (define_insn_and_split "*one_cmpl<mode>2_dot"
1601 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1602 (compare:CC (not:GPR (match_operand:GPR 1 "gpc_reg_operand" "r,r"))
1604 (clobber (match_scratch:GPR 0 "=r,r"))]
1605 "<MODE>mode == Pmode && rs6000_gen_cell_microcode"
1609 "&& reload_completed && cc_reg_not_cr0_operand (operands[2], CCmode)"
1611 (not:GPR (match_dup 1)))
1613 (compare:CC (match_dup 0)
1616 [(set_attr "type" "logical")
1617 (set_attr "dot" "yes")
1618 (set_attr "length" "4,8")])
1620 (define_insn_and_split "*one_cmpl<mode>2_dot2"
1621 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1622 (compare:CC (not:GPR (match_operand:GPR 1 "gpc_reg_operand" "r,r"))
1624 (set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
1625 (not:GPR (match_dup 1)))]
1626 "<MODE>mode == Pmode && rs6000_gen_cell_microcode"
1630 "&& reload_completed && cc_reg_not_cr0_operand (operands[2], CCmode)"
1632 (not:GPR (match_dup 1)))
1634 (compare:CC (match_dup 0)
1637 [(set_attr "type" "logical")
1638 (set_attr "dot" "yes")
1639 (set_attr "length" "4,8")])
1643 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
1644 (minus:GPR (match_operand:GPR 1 "reg_or_short_operand" "r,I")
1645 (match_operand:GPR 2 "gpc_reg_operand" "r,r")))]
1650 [(set_attr "type" "add")])
1653 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1654 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "r,r")
1655 (match_operand:P 2 "gpc_reg_operand" "r,r"))
1657 (clobber (match_scratch:P 3 "=r,r"))]
1662 [(set_attr "type" "add")
1663 (set_attr "dot" "yes")
1664 (set_attr "length" "4,8")])
1667 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1668 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "")
1669 (match_operand:P 2 "gpc_reg_operand" ""))
1671 (clobber (match_scratch:P 3 ""))]
1674 (minus:P (match_dup 1)
1677 (compare:CC (match_dup 3)
1682 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1683 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "r,r")
1684 (match_operand:P 2 "gpc_reg_operand" "r,r"))
1686 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
1687 (minus:P (match_dup 1)
1693 [(set_attr "type" "add")
1694 (set_attr "dot" "yes")
1695 (set_attr "length" "4,8")])
1698 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1699 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "")
1700 (match_operand:P 2 "gpc_reg_operand" ""))
1702 (set (match_operand:P 0 "gpc_reg_operand" "")
1703 (minus:P (match_dup 1)
1707 (minus:P (match_dup 1)
1710 (compare:CC (match_dup 0)
1714 (define_expand "sub<mode>3"
1715 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1716 (minus:SDI (match_operand:SDI 1 "reg_or_short_operand" "")
1717 (match_operand:SDI 2 "reg_or_sub_cint_operand" "")))]
1721 if (GET_CODE (operands[2]) == CONST_INT)
1723 emit_insn (gen_add<mode>3 (operands[0], operands[1],
1724 negate_rtx (<MODE>mode, operands[2])));
1730 (define_expand "neg<mode>2"
1731 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1732 (neg:SDI (match_operand:SDI 1 "gpc_reg_operand" "")))]
1736 (define_insn "*neg<mode>2"
1737 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1738 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
1741 [(set_attr "type" "add")])
1743 (define_insn_and_split "*neg<mode>2_dot"
1744 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1745 (compare:CC (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "r,r"))
1747 (clobber (match_scratch:GPR 0 "=r,r"))]
1748 "<MODE>mode == Pmode"
1752 "&& reload_completed && cc_reg_not_cr0_operand (operands[2], CCmode)"
1754 (neg:GPR (match_dup 1)))
1756 (compare:CC (match_dup 0)
1759 [(set_attr "type" "add")
1760 (set_attr "dot" "yes")
1761 (set_attr "length" "4,8")])
1763 (define_insn_and_split "*neg<mode>2_dot2"
1764 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1765 (compare:CC (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "r,r"))
1767 (set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
1768 (neg:GPR (match_dup 1)))]
1769 "<MODE>mode == Pmode"
1773 "&& reload_completed && cc_reg_not_cr0_operand (operands[2], CCmode)"
1775 (neg:GPR (match_dup 1)))
1777 (compare:CC (match_dup 0)
1780 [(set_attr "type" "add")
1781 (set_attr "dot" "yes")
1782 (set_attr "length" "4,8")])
1785 (define_insn "clz<mode>2"
1786 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1787 (clz:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
1790 [(set_attr "type" "cntlz")])
1792 (define_expand "ctz<mode>2"
1794 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))
1796 (and:GPR (match_dup 1)
1799 (clz:GPR (match_dup 3)))
1800 (set (match_operand:GPR 0 "gpc_reg_operand" "")
1801 (minus:GPR (match_dup 5)
1805 operands[2] = gen_reg_rtx (<MODE>mode);
1806 operands[3] = gen_reg_rtx (<MODE>mode);
1807 operands[4] = gen_reg_rtx (<MODE>mode);
1808 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode) - 1);
1811 (define_expand "ffs<mode>2"
1813 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))
1815 (and:GPR (match_dup 1)
1818 (clz:GPR (match_dup 3)))
1819 (set (match_operand:GPR 0 "gpc_reg_operand" "")
1820 (minus:GPR (match_dup 5)
1824 operands[2] = gen_reg_rtx (<MODE>mode);
1825 operands[3] = gen_reg_rtx (<MODE>mode);
1826 operands[4] = gen_reg_rtx (<MODE>mode);
1827 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode));
1830 (define_insn "popcntb<mode>2"
1831 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1832 (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")]
1836 [(set_attr "length" "4")
1837 (set_attr "type" "popcnt")])
1839 (define_insn "popcntd<mode>2"
1840 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1841 (popcount:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
1844 [(set_attr "length" "4")
1845 (set_attr "type" "popcnt")])
1847 (define_expand "popcount<mode>2"
1848 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
1849 (popcount:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))]
1850 "TARGET_POPCNTB || TARGET_POPCNTD"
1852 rs6000_emit_popcount (operands[0], operands[1]);
1856 (define_insn "parity<mode>2_cmpb"
1857 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1858 (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")] UNSPEC_PARITY))]
1859 "TARGET_CMPB && TARGET_POPCNTB"
1861 [(set_attr "length" "4")
1862 (set_attr "type" "popcnt")])
1864 (define_expand "parity<mode>2"
1865 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
1866 (parity:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))]
1869 rs6000_emit_parity (operands[0], operands[1]);
1873 ;; Since the hardware zeros the upper part of the register, save generating the
1874 ;; AND immediate if we are converting to unsigned
1875 (define_insn "*bswaphi2_extenddi"
1876 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
1878 (bswap:HI (match_operand:HI 1 "memory_operand" "Z"))))]
1881 [(set_attr "length" "4")
1882 (set_attr "type" "load")])
1884 (define_insn "*bswaphi2_extendsi"
1885 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1887 (bswap:HI (match_operand:HI 1 "memory_operand" "Z"))))]
1890 [(set_attr "length" "4")
1891 (set_attr "type" "load")])
1893 (define_expand "bswaphi2"
1894 [(parallel [(set (match_operand:HI 0 "reg_or_mem_operand" "")
1896 (match_operand:HI 1 "reg_or_mem_operand" "")))
1897 (clobber (match_scratch:SI 2 ""))])]
1900 if (!REG_P (operands[0]) && !REG_P (operands[1]))
1901 operands[1] = force_reg (HImode, operands[1]);
1904 (define_insn "bswaphi2_internal"
1905 [(set (match_operand:HI 0 "reg_or_mem_operand" "=r,Z,&r")
1907 (match_operand:HI 1 "reg_or_mem_operand" "Z,r,r")))
1908 (clobber (match_scratch:SI 2 "=X,X,&r"))]
1914 [(set_attr "length" "4,4,12")
1915 (set_attr "type" "load,store,*")])
1917 ;; We are always BITS_BIG_ENDIAN, so the (const_int 16) below is
1918 ;; correct for -mlittle as well as -mbig.
1920 [(set (match_operand:HI 0 "gpc_reg_operand" "")
1921 (bswap:HI (match_operand:HI 1 "gpc_reg_operand" "")))
1922 (clobber (match_operand:SI 2 "gpc_reg_operand" ""))]
1925 (zero_extract:SI (match_dup 4)
1929 (and:SI (ashift:SI (match_dup 4)
1931 (const_int 65280))) ;; 0xff00
1933 (ior:SI (match_dup 3)
1937 operands[3] = simplify_gen_subreg (SImode, operands[0], HImode, 0);
1938 operands[4] = simplify_gen_subreg (SImode, operands[1], HImode, 0);
1941 (define_insn "*bswapsi2_extenddi"
1942 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
1944 (bswap:SI (match_operand:SI 1 "memory_operand" "Z"))))]
1947 [(set_attr "length" "4")
1948 (set_attr "type" "load")])
1950 (define_expand "bswapsi2"
1951 [(set (match_operand:SI 0 "reg_or_mem_operand" "")
1953 (match_operand:SI 1 "reg_or_mem_operand" "")))]
1956 if (!REG_P (operands[0]) && !REG_P (operands[1]))
1957 operands[1] = force_reg (SImode, operands[1]);
1960 (define_insn "*bswapsi2_internal"
1961 [(set (match_operand:SI 0 "reg_or_mem_operand" "=r,Z,&r")
1963 (match_operand:SI 1 "reg_or_mem_operand" "Z,r,r")))]
1969 [(set_attr "length" "4,4,12")
1970 (set_attr "type" "load,store,*")])
1972 ;; We are always BITS_BIG_ENDIAN, so the bit positions below in
1973 ;; zero_extract insns do not change for -mlittle.
1975 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1976 (bswap:SI (match_operand:SI 1 "gpc_reg_operand" "")))]
1979 (rotate:SI (match_dup 1) (const_int 8)))
1980 (set (zero_extract:SI (match_dup 0)
1984 (set (zero_extract:SI (match_dup 0)
1987 (rotate:SI (match_dup 1)
1991 (define_expand "bswapdi2"
1992 [(parallel [(set (match_operand:DI 0 "reg_or_mem_operand" "")
1994 (match_operand:DI 1 "reg_or_mem_operand" "")))
1995 (clobber (match_scratch:DI 2 ""))
1996 (clobber (match_scratch:DI 3 ""))
1997 (clobber (match_scratch:DI 4 ""))])]
2000 if (!REG_P (operands[0]) && !REG_P (operands[1]))
2001 operands[1] = force_reg (DImode, operands[1]);
2003 if (!TARGET_POWERPC64)
2005 /* 32-bit mode needs fewer scratch registers, but 32-bit addressing mode
2006 that uses 64-bit registers needs the same scratch registers as 64-bit
2008 emit_insn (gen_bswapdi2_32bit (operands[0], operands[1]));
2013 ;; Power7/cell has ldbrx/stdbrx, so use it directly
2014 (define_insn "*bswapdi2_ldbrx"
2015 [(set (match_operand:DI 0 "reg_or_mem_operand" "=&r,Z,??&r")
2016 (bswap:DI (match_operand:DI 1 "reg_or_mem_operand" "Z,r,r")))
2017 (clobber (match_scratch:DI 2 "=X,X,&r"))
2018 (clobber (match_scratch:DI 3 "=X,X,&r"))
2019 (clobber (match_scratch:DI 4 "=X,X,&r"))]
2020 "TARGET_POWERPC64 && TARGET_LDBRX
2021 && (REG_P (operands[0]) || REG_P (operands[1]))"
2026 [(set_attr "length" "4,4,36")
2027 (set_attr "type" "load,store,*")])
2029 ;; Non-power7/cell, fall back to use lwbrx/stwbrx
2030 (define_insn "*bswapdi2_64bit"
2031 [(set (match_operand:DI 0 "reg_or_mem_operand" "=&r,Z,&r")
2032 (bswap:DI (match_operand:DI 1 "reg_or_mem_operand" "Z,r,r")))
2033 (clobber (match_scratch:DI 2 "=&b,&b,&r"))
2034 (clobber (match_scratch:DI 3 "=&r,&r,&r"))
2035 (clobber (match_scratch:DI 4 "=&r,X,&r"))]
2036 "TARGET_POWERPC64 && !TARGET_LDBRX
2037 && (REG_P (operands[0]) || REG_P (operands[1]))
2038 && !(MEM_P (operands[0]) && MEM_VOLATILE_P (operands[0]))
2039 && !(MEM_P (operands[1]) && MEM_VOLATILE_P (operands[1]))"
2041 [(set_attr "length" "16,12,36")])
2044 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2045 (bswap:DI (match_operand:DI 1 "indexed_or_indirect_operand" "")))
2046 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
2047 (clobber (match_operand:DI 3 "gpc_reg_operand" ""))
2048 (clobber (match_operand:DI 4 "gpc_reg_operand" ""))]
2049 "TARGET_POWERPC64 && !TARGET_LDBRX && reload_completed"
2053 rtx dest = operands[0];
2054 rtx src = operands[1];
2055 rtx op2 = operands[2];
2056 rtx op3 = operands[3];
2057 rtx op4 = operands[4];
2058 rtx op3_32 = simplify_gen_subreg (SImode, op3, DImode,
2059 BYTES_BIG_ENDIAN ? 4 : 0);
2060 rtx op4_32 = simplify_gen_subreg (SImode, op4, DImode,
2061 BYTES_BIG_ENDIAN ? 4 : 0);
2067 addr1 = XEXP (src, 0);
2068 if (GET_CODE (addr1) == PLUS)
2070 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2071 if (TARGET_AVOID_XFORM)
2073 emit_insn (gen_add3_insn (op2, XEXP (addr1, 1), op2));
2077 addr2 = gen_rtx_PLUS (Pmode, op2, XEXP (addr1, 1));
2079 else if (TARGET_AVOID_XFORM)
2081 emit_insn (gen_add3_insn (op2, addr1, GEN_INT (4)));
2086 emit_move_insn (op2, GEN_INT (4));
2087 addr2 = gen_rtx_PLUS (Pmode, op2, addr1);
2090 if (BYTES_BIG_ENDIAN)
2092 word_high = change_address (src, SImode, addr1);
2093 word_low = change_address (src, SImode, addr2);
2097 word_high = change_address (src, SImode, addr2);
2098 word_low = change_address (src, SImode, addr1);
2101 emit_insn (gen_bswapsi2 (op3_32, word_low));
2102 emit_insn (gen_bswapsi2 (op4_32, word_high));
2103 emit_insn (gen_ashldi3 (dest, op3, GEN_INT (32)));
2104 emit_insn (gen_iordi3 (dest, dest, op4));
2109 [(set (match_operand:DI 0 "indexed_or_indirect_operand" "")
2110 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2111 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
2112 (clobber (match_operand:DI 3 "gpc_reg_operand" ""))
2113 (clobber (match_operand:DI 4 "" ""))]
2114 "TARGET_POWERPC64 && !TARGET_LDBRX && reload_completed"
2118 rtx dest = operands[0];
2119 rtx src = operands[1];
2120 rtx op2 = operands[2];
2121 rtx op3 = operands[3];
2122 rtx src_si = simplify_gen_subreg (SImode, src, DImode,
2123 BYTES_BIG_ENDIAN ? 4 : 0);
2124 rtx op3_si = simplify_gen_subreg (SImode, op3, DImode,
2125 BYTES_BIG_ENDIAN ? 4 : 0);
2131 addr1 = XEXP (dest, 0);
2132 if (GET_CODE (addr1) == PLUS)
2134 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2135 if (TARGET_AVOID_XFORM)
2137 emit_insn (gen_add3_insn (op2, XEXP (addr1, 1), op2));
2141 addr2 = gen_rtx_PLUS (Pmode, op2, XEXP (addr1, 1));
2143 else if (TARGET_AVOID_XFORM)
2145 emit_insn (gen_add3_insn (op2, addr1, GEN_INT (4)));
2150 emit_move_insn (op2, GEN_INT (4));
2151 addr2 = gen_rtx_PLUS (Pmode, op2, addr1);
2154 emit_insn (gen_lshrdi3 (op3, src, GEN_INT (32)));
2155 if (BYTES_BIG_ENDIAN)
2157 word_high = change_address (dest, SImode, addr1);
2158 word_low = change_address (dest, SImode, addr2);
2162 word_high = change_address (dest, SImode, addr2);
2163 word_low = change_address (dest, SImode, addr1);
2165 emit_insn (gen_bswapsi2 (word_high, src_si));
2166 emit_insn (gen_bswapsi2 (word_low, op3_si));
2171 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2172 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2173 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
2174 (clobber (match_operand:DI 3 "gpc_reg_operand" ""))
2175 (clobber (match_operand:DI 4 "" ""))]
2176 "TARGET_POWERPC64 && reload_completed"
2180 rtx dest = operands[0];
2181 rtx src = operands[1];
2182 rtx op2 = operands[2];
2183 rtx op3 = operands[3];
2184 int lo_off = BYTES_BIG_ENDIAN ? 4 : 0;
2185 rtx dest_si = simplify_gen_subreg (SImode, dest, DImode, lo_off);
2186 rtx src_si = simplify_gen_subreg (SImode, src, DImode, lo_off);
2187 rtx op2_si = simplify_gen_subreg (SImode, op2, DImode, lo_off);
2188 rtx op3_si = simplify_gen_subreg (SImode, op3, DImode, lo_off);
2190 emit_insn (gen_lshrdi3 (op2, src, GEN_INT (32)));
2191 emit_insn (gen_bswapsi2 (dest_si, src_si));
2192 emit_insn (gen_bswapsi2 (op3_si, op2_si));
2193 emit_insn (gen_ashldi3 (dest, dest, GEN_INT (32)));
2194 emit_insn (gen_iordi3 (dest, dest, op3));
2198 (define_insn "bswapdi2_32bit"
2199 [(set (match_operand:DI 0 "reg_or_mem_operand" "=&r,Z,&r")
2200 (bswap:DI (match_operand:DI 1 "reg_or_mem_operand" "Z,r,r")))
2201 (clobber (match_scratch:SI 2 "=&b,&b,X"))]
2202 "!TARGET_POWERPC64 && (REG_P (operands[0]) || REG_P (operands[1]))"
2204 [(set_attr "length" "16,12,36")])
2207 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2208 (bswap:DI (match_operand:DI 1 "indexed_or_indirect_operand" "")))
2209 (clobber (match_operand:SI 2 "gpc_reg_operand" ""))]
2210 "!TARGET_POWERPC64 && reload_completed"
2214 rtx dest = operands[0];
2215 rtx src = operands[1];
2216 rtx op2 = operands[2];
2217 rtx dest1 = simplify_gen_subreg (SImode, dest, DImode, 0);
2218 rtx dest2 = simplify_gen_subreg (SImode, dest, DImode, 4);
2224 addr1 = XEXP (src, 0);
2225 if (GET_CODE (addr1) == PLUS)
2227 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2228 if (TARGET_AVOID_XFORM)
2230 emit_insn (gen_add3_insn (op2, XEXP (addr1, 1), op2));
2234 addr2 = gen_rtx_PLUS (SImode, op2, XEXP (addr1, 1));
2236 else if (TARGET_AVOID_XFORM)
2238 emit_insn (gen_add3_insn (op2, addr1, GEN_INT (4)));
2243 emit_move_insn (op2, GEN_INT (4));
2244 addr2 = gen_rtx_PLUS (SImode, op2, addr1);
2247 word1 = change_address (src, SImode, addr1);
2248 word2 = change_address (src, SImode, addr2);
2250 emit_insn (gen_bswapsi2 (dest2, word1));
2251 emit_insn (gen_bswapsi2 (dest1, word2));
2256 [(set (match_operand:DI 0 "indexed_or_indirect_operand" "")
2257 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2258 (clobber (match_operand:SI 2 "gpc_reg_operand" ""))]
2259 "!TARGET_POWERPC64 && reload_completed"
2263 rtx dest = operands[0];
2264 rtx src = operands[1];
2265 rtx op2 = operands[2];
2266 rtx src1 = simplify_gen_subreg (SImode, src, DImode, 0);
2267 rtx src2 = simplify_gen_subreg (SImode, src, DImode, 4);
2273 addr1 = XEXP (dest, 0);
2274 if (GET_CODE (addr1) == PLUS)
2276 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2277 if (TARGET_AVOID_XFORM)
2279 emit_insn (gen_add3_insn (op2, XEXP (addr1, 1), op2));
2283 addr2 = gen_rtx_PLUS (SImode, op2, XEXP (addr1, 1));
2285 else if (TARGET_AVOID_XFORM)
2287 emit_insn (gen_add3_insn (op2, addr1, GEN_INT (4)));
2292 emit_move_insn (op2, GEN_INT (4));
2293 addr2 = gen_rtx_PLUS (SImode, op2, addr1);
2296 word1 = change_address (dest, SImode, addr1);
2297 word2 = change_address (dest, SImode, addr2);
2299 emit_insn (gen_bswapsi2 (word2, src1));
2300 emit_insn (gen_bswapsi2 (word1, src2));
2305 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2306 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2307 (clobber (match_operand:SI 2 "" ""))]
2308 "!TARGET_POWERPC64 && reload_completed"
2312 rtx dest = operands[0];
2313 rtx src = operands[1];
2314 rtx src1 = simplify_gen_subreg (SImode, src, DImode, 0);
2315 rtx src2 = simplify_gen_subreg (SImode, src, DImode, 4);
2316 rtx dest1 = simplify_gen_subreg (SImode, dest, DImode, 0);
2317 rtx dest2 = simplify_gen_subreg (SImode, dest, DImode, 4);
2319 emit_insn (gen_bswapsi2 (dest1, src2));
2320 emit_insn (gen_bswapsi2 (dest2, src1));
2325 (define_insn "mul<mode>3"
2326 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
2327 (mult:GPR (match_operand:GPR 1 "gpc_reg_operand" "%r,r")
2328 (match_operand:GPR 2 "reg_or_short_operand" "r,I")))]
2333 [(set_attr "type" "mul")
2335 (cond [(match_operand:GPR 2 "s8bit_cint_operand" "")
2337 (match_operand:GPR 2 "short_cint_operand" "")
2338 (const_string "16")]
2339 (const_string "<bits>")))])
2341 (define_insn_and_split "*mul<mode>3_dot"
2342 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2343 (compare:CC (mult:GPR (match_operand:GPR 1 "gpc_reg_operand" "r,r")
2344 (match_operand:GPR 2 "gpc_reg_operand" "r,r"))
2346 (clobber (match_scratch:GPR 0 "=r,r"))]
2347 "<MODE>mode == Pmode && rs6000_gen_cell_microcode"
2351 "&& reload_completed && cc_reg_not_cr0_operand (operands[3], CCmode)"
2353 (mult:GPR (match_dup 1)
2356 (compare:CC (match_dup 0)
2359 [(set_attr "type" "mul")
2360 (set_attr "size" "<bits>")
2361 (set_attr "dot" "yes")
2362 (set_attr "length" "4,8")])
2364 (define_insn_and_split "*mul<mode>3_dot2"
2365 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2366 (compare:CC (mult:GPR (match_operand:GPR 1 "gpc_reg_operand" "r,r")
2367 (match_operand:GPR 2 "gpc_reg_operand" "r,r"))
2369 (set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
2370 (mult:GPR (match_dup 1)
2372 "<MODE>mode == Pmode && rs6000_gen_cell_microcode"
2376 "&& reload_completed && cc_reg_not_cr0_operand (operands[3], CCmode)"
2378 (mult:GPR (match_dup 1)
2381 (compare:CC (match_dup 0)
2384 [(set_attr "type" "mul")
2385 (set_attr "size" "<bits>")
2386 (set_attr "dot" "yes")
2387 (set_attr "length" "4,8")])
2390 (define_expand "<su>mul<mode>3_highpart"
2391 [(set (match_operand:GPR 0 "gpc_reg_operand")
2393 (mult:<DMODE> (any_extend:<DMODE>
2394 (match_operand:GPR 1 "gpc_reg_operand"))
2396 (match_operand:GPR 2 "gpc_reg_operand")))
2400 if (<MODE>mode == SImode && TARGET_POWERPC64)
2402 emit_insn (gen_<su>mulsi3_highpart_64 (operands[0], operands[1],
2407 if (!WORDS_BIG_ENDIAN)
2409 emit_insn (gen_<su>mul<mode>3_highpart_le (operands[0], operands[1],
2415 (define_insn "*<su>mul<mode>3_highpart"
2416 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2418 (mult:<DMODE> (any_extend:<DMODE>
2419 (match_operand:GPR 1 "gpc_reg_operand" "r"))
2421 (match_operand:GPR 2 "gpc_reg_operand" "r")))
2423 "WORDS_BIG_ENDIAN && !(<MODE>mode == SImode && TARGET_POWERPC64)"
2424 "mulh<wd><u> %0,%1,%2"
2425 [(set_attr "type" "mul")
2426 (set_attr "size" "<bits>")])
2428 (define_insn "<su>mulsi3_highpart_le"
2429 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2431 (mult:DI (any_extend:DI
2432 (match_operand:SI 1 "gpc_reg_operand" "r"))
2434 (match_operand:SI 2 "gpc_reg_operand" "r")))
2436 "!WORDS_BIG_ENDIAN && !TARGET_POWERPC64"
2438 [(set_attr "type" "mul")])
2440 (define_insn "<su>muldi3_highpart_le"
2441 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
2443 (mult:TI (any_extend:TI
2444 (match_operand:DI 1 "gpc_reg_operand" "r"))
2446 (match_operand:DI 2 "gpc_reg_operand" "r")))
2448 "!WORDS_BIG_ENDIAN && TARGET_POWERPC64"
2450 [(set_attr "type" "mul")
2451 (set_attr "size" "64")])
2453 (define_insn "<su>mulsi3_highpart_64"
2454 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2457 (mult:DI (any_extend:DI
2458 (match_operand:SI 1 "gpc_reg_operand" "r"))
2460 (match_operand:SI 2 "gpc_reg_operand" "r")))
2464 [(set_attr "type" "mul")])
2466 (define_expand "<u>mul<mode><dmode>3"
2467 [(set (match_operand:<DMODE> 0 "gpc_reg_operand")
2468 (mult:<DMODE> (any_extend:<DMODE>
2469 (match_operand:GPR 1 "gpc_reg_operand"))
2471 (match_operand:GPR 2 "gpc_reg_operand"))))]
2472 "!(<MODE>mode == SImode && TARGET_POWERPC64)"
2474 rtx l = gen_reg_rtx (<MODE>mode);
2475 rtx h = gen_reg_rtx (<MODE>mode);
2476 emit_insn (gen_mul<mode>3 (l, operands[1], operands[2]));
2477 emit_insn (gen_<su>mul<mode>3_highpart (h, operands[1], operands[2]));
2478 emit_move_insn (gen_lowpart (<MODE>mode, operands[0]), l);
2479 emit_move_insn (gen_highpart (<MODE>mode, operands[0]), h);
2484 (define_insn "udiv<mode>3"
2485 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2486 (udiv:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2487 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
2490 [(set_attr "type" "div")
2491 (set_attr "size" "<bits>")])
2494 ;; For powers of two we can do srai/aze for divide and then adjust for
2495 ;; modulus. If it isn't a power of two, force operands into register and do
2497 (define_expand "div<mode>3"
2498 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2499 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2500 (match_operand:GPR 2 "reg_or_cint_operand" "")))]
2503 if (GET_CODE (operands[2]) != CONST_INT
2504 || INTVAL (operands[2]) <= 0
2505 || exact_log2 (INTVAL (operands[2])) < 0)
2506 operands[2] = force_reg (<MODE>mode, operands[2]);
2509 (define_insn "*div<mode>3"
2510 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2511 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2512 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
2515 [(set_attr "type" "div")
2516 (set_attr "size" "<bits>")])
2518 (define_expand "mod<mode>3"
2519 [(use (match_operand:GPR 0 "gpc_reg_operand" ""))
2520 (use (match_operand:GPR 1 "gpc_reg_operand" ""))
2521 (use (match_operand:GPR 2 "reg_or_cint_operand" ""))]
2529 if (GET_CODE (operands[2]) != CONST_INT
2530 || INTVAL (operands[2]) <= 0
2531 || (i = exact_log2 (INTVAL (operands[2]))) < 0)
2534 temp1 = gen_reg_rtx (<MODE>mode);
2535 temp2 = gen_reg_rtx (<MODE>mode);
2537 emit_insn (gen_div<mode>3 (temp1, operands[1], operands[2]));
2538 emit_insn (gen_ashl<mode>3 (temp2, temp1, GEN_INT (i)));
2539 emit_insn (gen_sub<mode>3 (operands[0], operands[1], temp2));
2544 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2545 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2546 (match_operand:GPR 2 "exact_log2_cint_operand" "N")))]
2548 "sra<wd>i %0,%1,%p2\;addze %0,%0"
2549 [(set_attr "type" "two")
2550 (set_attr "length" "8")])
2553 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2554 (compare:CC (div:P (match_operand:P 1 "gpc_reg_operand" "r,r")
2555 (match_operand:P 2 "exact_log2_cint_operand" "N,N"))
2557 (clobber (match_scratch:P 3 "=r,r"))]
2560 sra<wd>i %3,%1,%p2\;addze. %3,%3
2562 [(set_attr "type" "compare")
2563 (set_attr "length" "8,12")
2564 (set_attr "cell_micro" "not")])
2567 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2568 (compare:CC (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2569 (match_operand:GPR 2 "exact_log2_cint_operand"
2572 (clobber (match_scratch:GPR 3 ""))]
2575 (div:<MODE> (match_dup 1) (match_dup 2)))
2577 (compare:CC (match_dup 3)
2582 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2583 (compare:CC (div:P (match_operand:P 1 "gpc_reg_operand" "r,r")
2584 (match_operand:P 2 "exact_log2_cint_operand" "N,N"))
2586 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
2587 (div:P (match_dup 1) (match_dup 2)))]
2590 sra<wd>i %0,%1,%p2\;addze. %0,%0
2592 [(set_attr "type" "compare")
2593 (set_attr "length" "8,12")
2594 (set_attr "cell_micro" "not")])
2597 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2598 (compare:CC (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2599 (match_operand:GPR 2 "exact_log2_cint_operand"
2602 (set (match_operand:GPR 0 "gpc_reg_operand" "")
2603 (div:GPR (match_dup 1) (match_dup 2)))]
2606 (div:<MODE> (match_dup 1) (match_dup 2)))
2608 (compare:CC (match_dup 0)
2612 ;; Logical instructions
2613 ;; The logical instructions are mostly combined by using match_operator,
2614 ;; but the plain AND insns are somewhat different because there is no
2615 ;; plain 'andi' (only 'andi.'), no plain 'andis', and there are all
2616 ;; those rotate-and-mask operations. Thus, the AND insns come first.
2618 (define_expand "and<mode>3"
2619 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
2620 (and:SDI (match_operand:SDI 1 "gpc_reg_operand" "")
2621 (match_operand:SDI 2 "reg_or_cint_operand" "")))]
2624 if (<MODE>mode == DImode && !TARGET_POWERPC64)
2626 rs6000_split_logical (operands, AND, false, false, false);
2630 if (logical_const_operand (operands[2], <MODE>mode)
2631 && !any_mask_operand (operands[2], <MODE>mode))
2633 emit_insn (gen_and<mode>3_imm (operands[0], operands[1], operands[2]));
2637 if ((<MODE>mode == DImode && !and64_2_operand (operands[2], <MODE>mode))
2638 || (<MODE>mode != DImode && !and_operand (operands[2], <MODE>mode)))
2639 operands[2] = force_reg (<MODE>mode, operands[2]);
2643 (define_insn "*and<mode>3"
2644 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2645 (and:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2646 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
2649 [(set_attr "type" "logical")])
2651 (define_insn_and_split "*and<mode>3_dot"
2652 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2653 (compare:CC (and:GPR (match_operand:GPR 1 "gpc_reg_operand" "r,r")
2654 (match_operand:GPR 2 "gpc_reg_operand" "r,r"))
2656 (clobber (match_scratch:GPR 0 "=r,r"))]
2657 "<MODE>mode == Pmode && rs6000_gen_cell_microcode"
2661 "&& reload_completed && cc_reg_not_cr0_operand (operands[3], CCmode)"
2663 (and:GPR (match_dup 1)
2666 (compare:CC (match_dup 0)
2669 [(set_attr "type" "logical")
2670 (set_attr "dot" "yes")
2671 (set_attr "length" "4,8")])
2673 (define_insn_and_split "*and<mode>3_dot2"
2674 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2675 (compare:CC (and:GPR (match_operand:GPR 1 "gpc_reg_operand" "r,r")
2676 (match_operand:GPR 2 "gpc_reg_operand" "r,r"))
2678 (set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
2679 (and:GPR (match_dup 1)
2681 "<MODE>mode == Pmode && rs6000_gen_cell_microcode"
2685 "&& reload_completed && cc_reg_not_cr0_operand (operands[3], CCmode)"
2687 (and:GPR (match_dup 1)
2690 (compare:CC (match_dup 0)
2693 [(set_attr "type" "logical")
2694 (set_attr "dot" "yes")
2695 (set_attr "length" "4,8")])
2698 (define_insn "and<mode>3_imm"
2699 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2700 (and:GPR (match_operand:GPR 1 "gpc_reg_operand" "%r")
2701 (match_operand:GPR 2 "logical_const_operand" "n")))
2702 (clobber (match_scratch:CC 3 "=x"))]
2703 "rs6000_gen_cell_microcode
2704 && !any_mask_operand (operands[2], <MODE>mode)"
2705 "andi%e2. %0,%1,%u2"
2706 [(set_attr "type" "logical")
2707 (set_attr "dot" "yes")])
2709 (define_insn_and_split "*and<mode>3_imm_dot"
2710 [(set (match_operand:CC 3 "cc_reg_operand" "=x,??y")
2711 (compare:CC (and:GPR (match_operand:GPR 1 "gpc_reg_operand" "%r,r")
2712 (match_operand:GPR 2 "logical_const_operand" "n,n"))
2714 (clobber (match_scratch:GPR 0 "=r,r"))
2715 (clobber (match_scratch:CC 4 "=X,x"))]
2716 "(<MODE>mode == Pmode || UINTVAL (operands[2]) <= 0x7fffffff)
2717 && rs6000_gen_cell_microcode
2718 && !any_mask_operand (operands[2], <MODE>mode)"
2722 "&& reload_completed && cc_reg_not_cr0_operand (operands[3], CCmode)"
2723 [(parallel [(set (match_dup 0)
2724 (and:GPR (match_dup 1)
2726 (clobber (match_dup 4))])
2728 (compare:CC (match_dup 0)
2731 [(set_attr "type" "logical")
2732 (set_attr "dot" "yes")
2733 (set_attr "length" "4,8")])
2735 (define_insn_and_split "*and<mode>3_imm_dot2"
2736 [(set (match_operand:CC 3 "cc_reg_operand" "=x,??y")
2737 (compare:CC (and:GPR (match_operand:GPR 1 "gpc_reg_operand" "%r,r")
2738 (match_operand:GPR 2 "logical_const_operand" "n,n"))
2740 (set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
2741 (and:GPR (match_dup 1)
2743 (clobber (match_scratch:CC 4 "=X,x"))]
2744 "(<MODE>mode == Pmode || UINTVAL (operands[2]) <= 0x7fffffff)
2745 && rs6000_gen_cell_microcode
2746 && !any_mask_operand (operands[2], <MODE>mode)"
2750 "&& reload_completed && cc_reg_not_cr0_operand (operands[3], CCmode)"
2751 [(parallel [(set (match_dup 0)
2752 (and:GPR (match_dup 1)
2754 (clobber (match_dup 4))])
2756 (compare:CC (match_dup 0)
2759 [(set_attr "type" "logical")
2760 (set_attr "dot" "yes")
2761 (set_attr "length" "4,8")])
2763 (define_insn_and_split "*and<mode>3_imm_mask_dot"
2764 [(set (match_operand:CC 3 "cc_reg_operand" "=x,??y")
2765 (compare:CC (and:GPR (match_operand:GPR 1 "gpc_reg_operand" "%r,r")
2766 (match_operand:GPR 2 "logical_const_operand" "n,n"))
2768 (clobber (match_scratch:GPR 0 "=r,r"))]
2769 "(<MODE>mode == Pmode || UINTVAL (operands[2]) <= 0x7fffffff)
2770 && rs6000_gen_cell_microcode
2771 && any_mask_operand (operands[2], <MODE>mode)"
2775 "&& reload_completed && cc_reg_not_cr0_operand (operands[3], CCmode)"
2777 (and:GPR (match_dup 1)
2780 (compare:CC (match_dup 0)
2783 [(set_attr "type" "logical")
2784 (set_attr "dot" "yes")
2785 (set_attr "length" "4,8")])
2787 (define_insn_and_split "*and<mode>3_imm_mask_dot2"
2788 [(set (match_operand:CC 3 "cc_reg_operand" "=x,??y")
2789 (compare:CC (and:GPR (match_operand:GPR 1 "gpc_reg_operand" "%r,r")
2790 (match_operand:GPR 2 "logical_const_operand" "n,n"))
2792 (set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
2793 (and:GPR (match_dup 1)
2795 "(<MODE>mode == Pmode || UINTVAL (operands[2]) <= 0x7fffffff)
2796 && rs6000_gen_cell_microcode
2797 && any_mask_operand (operands[2], <MODE>mode)"
2801 "&& reload_completed && cc_reg_not_cr0_operand (operands[3], CCmode)"
2803 (and:GPR (match_dup 1)
2806 (compare:CC (match_dup 0)
2809 [(set_attr "type" "logical")
2810 (set_attr "dot" "yes")
2811 (set_attr "length" "4,8")])
2814 (define_insn "*and<mode>3_mask"
2815 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
2816 (and:GPR (match_operand:GPR 1 "gpc_reg_operand" "%r,r")
2817 (match_operand:GPR 2 "any_mask_operand" "S,T")))]
2820 rldic%B2 %0,%1,0,%S2
2821 rlwinm %0,%1,0,%m2,%M2"
2822 [(set_attr "type" "shift")])
2824 (define_insn_and_split "*and<mode>3_mask_dot"
2825 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
2826 (compare:CC (and:GPR (match_operand:GPR 1 "gpc_reg_operand" "%r,r,r,r")
2827 (match_operand:GPR 2 "any_mask_operand" "S,T,S,T"))
2829 (clobber (match_scratch:GPR 0 "=r,r,r,r"))]
2830 "(<MODE>mode == Pmode || UINTVAL (operands[2]) <= 0x7fffffff)
2831 && rs6000_gen_cell_microcode
2832 && !logical_const_operand (operands[2], <MODE>mode)"
2834 rldic%B2. %0,%1,0,%S2
2835 rlwinm. %0,%1,0,%m2,%M2
2838 "&& reload_completed && cc_reg_not_cr0_operand (operands[3], CCmode)"
2840 (and:GPR (match_dup 1)
2843 (compare:CC (match_dup 0)
2846 [(set_attr "type" "shift")
2847 (set_attr "dot" "yes")
2848 (set_attr "length" "4,4,8,8")])
2850 (define_insn_and_split "*and<mode>3_mask_dot2"
2851 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
2852 (compare:CC (and:GPR (match_operand:GPR 1 "gpc_reg_operand" "%r,r,r,r")
2853 (match_operand:GPR 2 "any_mask_operand" "S,T,S,T"))
2855 (set (match_operand:GPR 0 "gpc_reg_operand" "=r,r,r,r")
2856 (and:GPR (match_dup 1)
2858 "(<MODE>mode == Pmode || UINTVAL (operands[2]) <= 0x7fffffff)
2859 && rs6000_gen_cell_microcode
2860 && !logical_const_operand (operands[2], <MODE>mode)"
2862 rldic%B2. %0,%1,0,%S2
2863 rlwinm. %0,%1,0,%m2,%M2
2866 "&& reload_completed && cc_reg_not_cr0_operand (operands[3], CCmode)"
2868 (and:GPR (match_dup 1)
2871 (compare:CC (match_dup 0)
2874 [(set_attr "type" "shift")
2875 (set_attr "dot" "yes")
2876 (set_attr "length" "4,4,8,8")])
2880 (define_insn "andsi3_internal0_nomc"
2881 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2882 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2883 (match_operand:SI 2 "and_operand" "?r,T")))]
2884 "!rs6000_gen_cell_microcode"
2887 rlwinm %0,%1,0,%m2,%M2"
2888 [(set_attr "type" "logical,shift")])
2891 ;; Handle the PowerPC64 rlwinm corner case
2893 (define_insn_and_split "*andsi3_internal6"
2894 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2895 (and:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2896 (match_operand:SI 2 "mask_operand_wrap" "i")))]
2901 (and:SI (rotate:SI (match_dup 1) (match_dup 3))
2904 (rotate:SI (match_dup 0) (match_dup 5)))]
2907 int mb = extract_MB (operands[2]);
2908 int me = extract_ME (operands[2]);
2909 operands[3] = GEN_INT (me + 1);
2910 operands[5] = GEN_INT (32 - (me + 1));
2911 operands[4] = GEN_INT (~((HOST_WIDE_INT) -1 << (33 + me - mb)));
2913 [(set_attr "length" "8")])
2916 (define_expand "ior<mode>3"
2917 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
2918 (ior:SDI (match_operand:SDI 1 "gpc_reg_operand" "")
2919 (match_operand:SDI 2 "reg_or_cint_operand" "")))]
2922 if (<MODE>mode == DImode && !TARGET_POWERPC64)
2924 rs6000_split_logical (operands, IOR, false, false, false);
2928 if (non_logical_cint_operand (operands[2], <MODE>mode))
2930 rtx tmp = ((!can_create_pseudo_p ()
2931 || rtx_equal_p (operands[0], operands[1]))
2932 ? operands[0] : gen_reg_rtx (<MODE>mode));
2933 HOST_WIDE_INT value = INTVAL (operands[2]);
2935 emit_insn (gen_ior<mode>3 (tmp, operands[1],
2936 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
2938 emit_insn (gen_ior<mode>3 (operands[0], tmp, GEN_INT (value & 0xffff)));
2942 if (!reg_or_logical_cint_operand (operands[2], <MODE>mode))
2943 operands[2] = force_reg (<MODE>mode, operands[2]);
2946 (define_expand "xor<mode>3"
2947 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
2948 (xor:SDI (match_operand:SDI 1 "gpc_reg_operand" "")
2949 (match_operand:SDI 2 "reg_or_cint_operand" "")))]
2952 if (<MODE>mode == DImode && !TARGET_POWERPC64)
2954 rs6000_split_logical (operands, XOR, false, false, false);
2958 if (non_logical_cint_operand (operands[2], <MODE>mode))
2960 rtx tmp = ((!can_create_pseudo_p ()
2961 || rtx_equal_p (operands[0], operands[1]))
2962 ? operands[0] : gen_reg_rtx (<MODE>mode));
2963 HOST_WIDE_INT value = INTVAL (operands[2]);
2965 emit_insn (gen_xor<mode>3 (tmp, operands[1],
2966 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
2968 emit_insn (gen_xor<mode>3 (operands[0], tmp, GEN_INT (value & 0xffff)));
2972 if (!reg_or_logical_cint_operand (operands[2], <MODE>mode))
2973 operands[2] = force_reg (<MODE>mode, operands[2]);
2976 (define_insn "*bool<mode>3"
2977 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2978 (match_operator:GPR 3 "boolean_or_operator"
2979 [(match_operand:GPR 1 "gpc_reg_operand" "r")
2980 (match_operand:GPR 2 "gpc_reg_operand" "r")]))]
2983 [(set_attr "type" "logical")])
2985 (define_insn "*bool<mode>3_imm"
2986 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2987 (match_operator:GPR 3 "boolean_or_operator"
2988 [(match_operand:GPR 1 "gpc_reg_operand" "%r")
2989 (match_operand:GPR 2 "logical_const_operand" "n")]))]
2992 [(set_attr "type" "logical")])
2994 (define_insn_and_split "*bool<mode>3_dot"
2995 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
2996 (compare:CC (match_operator:GPR 3 "boolean_or_operator"
2997 [(match_operand:GPR 1 "gpc_reg_operand" "r,r")
2998 (match_operand:GPR 2 "gpc_reg_operand" "r,r")])
3000 (clobber (match_scratch:GPR 0 "=r,r"))]
3001 "<MODE>mode == Pmode && rs6000_gen_cell_microcode"
3005 "&& reload_completed && cc_reg_not_cr0_operand (operands[4], CCmode)"
3009 (compare:CC (match_dup 0)
3012 [(set_attr "type" "logical")
3013 (set_attr "dot" "yes")
3014 (set_attr "length" "4,8")])
3016 (define_insn_and_split "*bool<mode>3_dot2"
3017 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3018 (compare:CC (match_operator:GPR 3 "boolean_or_operator"
3019 [(match_operand:GPR 1 "gpc_reg_operand" "r,r")
3020 (match_operand:GPR 2 "gpc_reg_operand" "r,r")])
3022 (set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
3024 "<MODE>mode == Pmode && rs6000_gen_cell_microcode"
3028 "&& reload_completed && cc_reg_not_cr0_operand (operands[4], CCmode)"
3032 (compare:CC (match_dup 0)
3035 [(set_attr "type" "logical")
3036 (set_attr "dot" "yes")
3037 (set_attr "length" "4,8")])
3039 ;; Split a logical operation that we can't do in one insn into two insns,
3040 ;; each of which does one 16-bit part. This is used by combine.
3043 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
3044 (match_operator:GPR 3 "boolean_or_operator"
3045 [(match_operand:GPR 1 "gpc_reg_operand" "")
3046 (match_operand:GPR 2 "non_logical_cint_operand" "")]))]
3048 [(set (match_dup 0) (match_dup 4))
3049 (set (match_dup 0) (match_dup 5))]
3052 i = GEN_INT (INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff));
3053 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), <MODE>mode,
3055 i = GEN_INT (INTVAL (operands[2]) & 0xffff);
3056 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), <MODE>mode,
3061 (define_insn "*boolc<mode>3"
3062 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
3063 (match_operator:GPR 3 "boolean_operator"
3064 [(not:GPR (match_operand:GPR 2 "gpc_reg_operand" "r"))
3065 (match_operand:GPR 1 "gpc_reg_operand" "r")]))]
3068 [(set_attr "type" "logical")])
3070 (define_insn_and_split "*boolc<mode>3_dot"
3071 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3072 (compare:CC (match_operator:GPR 3 "boolean_operator"
3073 [(not:GPR (match_operand:GPR 2 "gpc_reg_operand" "r,r"))
3074 (match_operand:GPR 1 "gpc_reg_operand" "r,r")])
3076 (clobber (match_scratch:GPR 0 "=r,r"))]
3077 "<MODE>mode == Pmode && rs6000_gen_cell_microcode"
3081 "&& reload_completed && cc_reg_not_cr0_operand (operands[4], CCmode)"
3085 (compare:CC (match_dup 0)
3088 [(set_attr "type" "logical")
3089 (set_attr "dot" "yes")
3090 (set_attr "length" "4,8")])
3092 (define_insn_and_split "*boolc<mode>3_dot2"
3093 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3094 (compare:CC (match_operator:GPR 3 "boolean_operator"
3095 [(not:GPR (match_operand:GPR 2 "gpc_reg_operand" "r,r"))
3096 (match_operand:GPR 1 "gpc_reg_operand" "r,r")])
3098 (set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
3100 "<MODE>mode == Pmode && rs6000_gen_cell_microcode"
3104 "&& reload_completed && cc_reg_not_cr0_operand (operands[4], CCmode)"
3108 (compare:CC (match_dup 0)
3111 [(set_attr "type" "logical")
3112 (set_attr "dot" "yes")
3113 (set_attr "length" "4,8")])
3116 (define_insn "*boolcc<mode>3"
3117 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
3118 (match_operator:GPR 3 "boolean_operator"
3119 [(not:GPR (match_operand:GPR 1 "gpc_reg_operand" "r"))
3120 (not:GPR (match_operand:GPR 2 "gpc_reg_operand" "r"))]))]
3123 [(set_attr "type" "logical")])
3125 (define_insn_and_split "*boolcc<mode>3_dot"
3126 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3127 (compare:CC (match_operator:GPR 3 "boolean_operator"
3128 [(not:GPR (match_operand:GPR 1 "gpc_reg_operand" "r,r"))
3129 (not:GPR (match_operand:GPR 2 "gpc_reg_operand" "r,r"))])
3131 (clobber (match_scratch:GPR 0 "=r,r"))]
3132 "<MODE>mode == Pmode && rs6000_gen_cell_microcode"
3136 "&& reload_completed && cc_reg_not_cr0_operand (operands[4], CCmode)"
3140 (compare:CC (match_dup 0)
3143 [(set_attr "type" "logical")
3144 (set_attr "dot" "yes")
3145 (set_attr "length" "4,8")])
3147 (define_insn_and_split "*boolcc<mode>3_dot2"
3148 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3149 (compare:CC (match_operator:GPR 3 "boolean_operator"
3150 [(not:GPR (match_operand:GPR 1 "gpc_reg_operand" "r,r"))
3151 (not:GPR (match_operand:GPR 2 "gpc_reg_operand" "r,r"))])
3153 (set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
3155 "<MODE>mode == Pmode && rs6000_gen_cell_microcode"
3159 "&& reload_completed && cc_reg_not_cr0_operand (operands[4], CCmode)"
3163 (compare:CC (match_dup 0)
3166 [(set_attr "type" "logical")
3167 (set_attr "dot" "yes")
3168 (set_attr "length" "4,8")])
3171 ;; TODO: Should have dots of this as well.
3172 (define_insn "*eqv<mode>3"
3173 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
3174 (not:GPR (xor:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
3175 (match_operand:GPR 2 "gpc_reg_operand" "r"))))]
3178 [(set_attr "type" "logical")])
3180 ;; Rotate and shift insns, in all their variants. These support shifts,
3181 ;; field inserts and extracts, and various combinations thereof.
3182 (define_expand "insv"
3183 [(set (zero_extract (match_operand 0 "gpc_reg_operand" "")
3184 (match_operand:SI 1 "const_int_operand" "")
3185 (match_operand:SI 2 "const_int_operand" ""))
3186 (match_operand 3 "gpc_reg_operand" ""))]
3190 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3191 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3192 compiler if the address of the structure is taken later. Likewise, do
3193 not handle invalid E500 subregs. */
3194 if (GET_CODE (operands[0]) == SUBREG
3195 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD
3196 || ((TARGET_E500_DOUBLE || TARGET_SPE)
3197 && invalid_e500_subreg (operands[0], GET_MODE (operands[0])))))
3200 if (TARGET_POWERPC64 && GET_MODE (operands[0]) == DImode)
3201 emit_insn (gen_insvdi_internal (operands[0], operands[1], operands[2],
3204 emit_insn (gen_insvsi_internal (operands[0], operands[1], operands[2],
3209 (define_insn "insvsi_internal"
3210 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3211 (match_operand:SI 1 "const_int_operand" "i")
3212 (match_operand:SI 2 "const_int_operand" "i"))
3213 (match_operand:SI 3 "gpc_reg_operand" "r"))]
3217 int start = INTVAL (operands[2]) & 31;
3218 int size = INTVAL (operands[1]) & 31;
3220 operands[4] = GEN_INT (32 - start - size);
3221 operands[1] = GEN_INT (start + size - 1);
3222 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3224 [(set_attr "type" "insert")])
3226 (define_insn "*insvsi_internal1"
3227 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3228 (match_operand:SI 1 "const_int_operand" "i")
3229 (match_operand:SI 2 "const_int_operand" "i"))
3230 (rotate:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3231 (match_operand:SI 4 "const_int_operand" "i")))]
3232 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3235 int shift = INTVAL (operands[4]) & 31;
3236 int start = INTVAL (operands[2]) & 31;
3237 int size = INTVAL (operands[1]) & 31;
3239 operands[4] = GEN_INT (shift - start - size);
3240 operands[1] = GEN_INT (start + size - 1);
3241 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3243 [(set_attr "type" "insert")])
3245 (define_insn "*insvsi_internal2"
3246 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3247 (match_operand:SI 1 "const_int_operand" "i")
3248 (match_operand:SI 2 "const_int_operand" "i"))
3249 (ashiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3250 (match_operand:SI 4 "const_int_operand" "i")))]
3251 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3254 int shift = INTVAL (operands[4]) & 31;
3255 int start = INTVAL (operands[2]) & 31;
3256 int size = INTVAL (operands[1]) & 31;
3258 operands[4] = GEN_INT (32 - shift - start - size);
3259 operands[1] = GEN_INT (start + size - 1);
3260 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3262 [(set_attr "type" "insert")])
3264 (define_insn "*insvsi_internal3"
3265 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3266 (match_operand:SI 1 "const_int_operand" "i")
3267 (match_operand:SI 2 "const_int_operand" "i"))
3268 (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3269 (match_operand:SI 4 "const_int_operand" "i")))]
3270 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3273 int shift = INTVAL (operands[4]) & 31;
3274 int start = INTVAL (operands[2]) & 31;
3275 int size = INTVAL (operands[1]) & 31;
3277 operands[4] = GEN_INT (32 - shift - start - size);
3278 operands[1] = GEN_INT (start + size - 1);
3279 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3281 [(set_attr "type" "insert")])
3283 (define_insn "*insvsi_internal4"
3284 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3285 (match_operand:SI 1 "const_int_operand" "i")
3286 (match_operand:SI 2 "const_int_operand" "i"))
3287 (zero_extract:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3288 (match_operand:SI 4 "const_int_operand" "i")
3289 (match_operand:SI 5 "const_int_operand" "i")))]
3290 "INTVAL (operands[4]) >= INTVAL (operands[1])"
3293 int extract_start = INTVAL (operands[5]) & 31;
3294 int extract_size = INTVAL (operands[4]) & 31;
3295 int insert_start = INTVAL (operands[2]) & 31;
3296 int insert_size = INTVAL (operands[1]) & 31;
3298 /* Align extract field with insert field */
3299 operands[5] = GEN_INT (extract_start + extract_size - insert_start - insert_size);
3300 operands[1] = GEN_INT (insert_start + insert_size - 1);
3301 return \"rlwimi %0,%3,%h5,%h2,%h1\";
3303 [(set_attr "type" "insert")])
3305 ;; combine patterns for rlwimi
3306 (define_insn "*insvsi_internal5"
3307 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3308 (ior:SI (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
3309 (match_operand:SI 1 "mask_operand" "i"))
3310 (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3311 (match_operand:SI 2 "const_int_operand" "i"))
3312 (match_operand:SI 5 "mask_operand" "i"))))]
3313 "INTVAL(operands[1]) == ~INTVAL(operands[5])"
3316 int me = extract_ME(operands[5]);
3317 int mb = extract_MB(operands[5]);
3318 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
3319 operands[2] = GEN_INT(mb);
3320 operands[1] = GEN_INT(me);
3321 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3323 [(set_attr "type" "insert")])
3325 (define_insn "*insvsi_internal6"
3326 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3327 (ior:SI (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3328 (match_operand:SI 2 "const_int_operand" "i"))
3329 (match_operand:SI 5 "mask_operand" "i"))
3330 (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
3331 (match_operand:SI 1 "mask_operand" "i"))))]
3332 "INTVAL(operands[1]) == ~INTVAL(operands[5])"
3335 int me = extract_ME(operands[5]);
3336 int mb = extract_MB(operands[5]);
3337 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
3338 operands[2] = GEN_INT(mb);
3339 operands[1] = GEN_INT(me);
3340 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3342 [(set_attr "type" "insert")])
3344 (define_insn "insvdi_internal"
3345 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3346 (match_operand:SI 1 "const_int_operand" "i")
3347 (match_operand:SI 2 "const_int_operand" "i"))
3348 (match_operand:DI 3 "gpc_reg_operand" "r"))]
3352 int start = INTVAL (operands[2]) & 63;
3353 int size = INTVAL (operands[1]) & 63;
3355 operands[1] = GEN_INT (64 - start - size);
3356 return \"rldimi %0,%3,%H1,%H2\";
3358 [(set_attr "type" "insert")
3359 (set_attr "size" "64")])
3361 (define_insn "*insvdi_internal2"
3362 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3363 (match_operand:SI 1 "const_int_operand" "i")
3364 (match_operand:SI 2 "const_int_operand" "i"))
3365 (ashiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
3366 (match_operand:SI 4 "const_int_operand" "i")))]
3368 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
3371 int shift = INTVAL (operands[4]) & 63;
3372 int start = (INTVAL (operands[2]) & 63) - 32;
3373 int size = INTVAL (operands[1]) & 63;
3375 operands[4] = GEN_INT (64 - shift - start - size);
3376 operands[2] = GEN_INT (start);
3377 operands[1] = GEN_INT (start + size - 1);
3378 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3381 (define_insn "*insvdi_internal3"
3382 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3383 (match_operand:SI 1 "const_int_operand" "i")
3384 (match_operand:SI 2 "const_int_operand" "i"))
3385 (lshiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
3386 (match_operand:SI 4 "const_int_operand" "i")))]
3388 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
3391 int shift = INTVAL (operands[4]) & 63;
3392 int start = (INTVAL (operands[2]) & 63) - 32;
3393 int size = INTVAL (operands[1]) & 63;
3395 operands[4] = GEN_INT (64 - shift - start - size);
3396 operands[2] = GEN_INT (start);
3397 operands[1] = GEN_INT (start + size - 1);
3398 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3401 (define_expand "extzv"
3402 [(set (match_operand 0 "gpc_reg_operand" "")
3403 (zero_extract (match_operand 1 "gpc_reg_operand" "")
3404 (match_operand:SI 2 "const_int_operand" "")
3405 (match_operand:SI 3 "const_int_operand" "")))]
3409 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3410 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3411 compiler if the address of the structure is taken later. */
3412 if (GET_CODE (operands[0]) == SUBREG
3413 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
3416 if (TARGET_POWERPC64 && GET_MODE (operands[1]) == DImode)
3417 emit_insn (gen_extzvdi_internal (operands[0], operands[1], operands[2],
3420 emit_insn (gen_extzvsi_internal (operands[0], operands[1], operands[2],
3425 (define_insn "extzvsi_internal"
3426 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3427 (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3428 (match_operand:SI 2 "const_int_operand" "i")
3429 (match_operand:SI 3 "const_int_operand" "i")))]
3433 int start = INTVAL (operands[3]) & 31;
3434 int size = INTVAL (operands[2]) & 31;
3436 if (start + size >= 32)
3437 operands[3] = const0_rtx;
3439 operands[3] = GEN_INT (start + size);
3440 return \"rlwinm %0,%1,%3,%s2,31\";
3442 [(set_attr "type" "shift")])
3444 (define_insn "*extzvsi_internal1"
3445 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3446 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3447 (match_operand:SI 2 "const_int_operand" "i,i")
3448 (match_operand:SI 3 "const_int_operand" "i,i"))
3450 (clobber (match_scratch:SI 4 "=r,r"))]
3454 int start = INTVAL (operands[3]) & 31;
3455 int size = INTVAL (operands[2]) & 31;
3457 /* Force split for non-cc0 compare. */
3458 if (which_alternative == 1)
3461 /* If the bit-field being tested fits in the upper or lower half of a
3462 word, it is possible to use andiu. or andil. to test it. This is
3463 useful because the condition register set-use delay is smaller for
3464 andi[ul]. than for rlinm. This doesn't work when the starting bit
3465 position is 0 because the LT and GT bits may be set wrong. */
3467 if ((start > 0 && start + size <= 16) || start >= 16)
3469 operands[3] = GEN_INT (((1 << (16 - (start & 15)))
3470 - (1 << (16 - (start & 15) - size))));
3472 return \"andis. %4,%1,%3\";
3474 return \"andi. %4,%1,%3\";
3477 if (start + size >= 32)
3478 operands[3] = const0_rtx;
3480 operands[3] = GEN_INT (start + size);
3481 return \"rlwinm. %4,%1,%3,%s2,31\";
3483 [(set_attr "type" "shift")
3484 (set_attr "dot" "yes")
3485 (set_attr "length" "4,8")])
3488 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3489 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3490 (match_operand:SI 2 "const_int_operand" "")
3491 (match_operand:SI 3 "const_int_operand" ""))
3493 (clobber (match_scratch:SI 4 ""))]
3496 (zero_extract:SI (match_dup 1) (match_dup 2)
3499 (compare:CC (match_dup 4)
3503 (define_insn "*extzvsi_internal2"
3504 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3505 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3506 (match_operand:SI 2 "const_int_operand" "i,i")
3507 (match_operand:SI 3 "const_int_operand" "i,i"))
3509 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3510 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3514 int start = INTVAL (operands[3]) & 31;
3515 int size = INTVAL (operands[2]) & 31;
3517 /* Force split for non-cc0 compare. */
3518 if (which_alternative == 1)
3521 /* Since we are using the output value, we can't ignore any need for
3522 a shift. The bit-field must end at the LSB. */
3523 if (start >= 16 && start + size == 32)
3525 operands[3] = GEN_INT ((1 << size) - 1);
3526 return \"andi. %0,%1,%3\";
3529 if (start + size >= 32)
3530 operands[3] = const0_rtx;
3532 operands[3] = GEN_INT (start + size);
3533 return \"rlwinm. %0,%1,%3,%s2,31\";
3535 [(set_attr "type" "shift")
3536 (set_attr "dot" "yes")
3537 (set_attr "length" "4,8")])
3540 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
3541 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3542 (match_operand:SI 2 "const_int_operand" "")
3543 (match_operand:SI 3 "const_int_operand" ""))
3545 (set (match_operand:SI 0 "gpc_reg_operand" "")
3546 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3549 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))
3551 (compare:CC (match_dup 0)
3555 (define_insn "extzvdi_internal"
3556 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
3557 (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3558 (match_operand:SI 2 "const_int_operand" "i")
3559 (match_operand:SI 3 "const_int_operand" "i")))]
3563 int start = INTVAL (operands[3]) & 63;
3564 int size = INTVAL (operands[2]) & 63;
3566 if (start + size >= 64)
3567 operands[3] = const0_rtx;
3569 operands[3] = GEN_INT (start + size);
3570 operands[2] = GEN_INT (64 - size);
3571 return \"rldicl %0,%1,%3,%2\";
3573 [(set_attr "type" "shift")])
3575 (define_insn "*extzvdi_internal1"
3576 [(set (match_operand:CC 0 "gpc_reg_operand" "=x")
3577 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3578 (match_operand:SI 2 "const_int_operand" "i")
3579 (match_operand:SI 3 "const_int_operand" "i"))
3581 (clobber (match_scratch:DI 4 "=r"))]
3582 "TARGET_64BIT && rs6000_gen_cell_microcode"
3585 int start = INTVAL (operands[3]) & 63;
3586 int size = INTVAL (operands[2]) & 63;
3588 if (start + size >= 64)
3589 operands[3] = const0_rtx;
3591 operands[3] = GEN_INT (start + size);
3592 operands[2] = GEN_INT (64 - size);
3593 return \"rldicl. %4,%1,%3,%2\";
3595 [(set_attr "type" "shift")
3596 (set_attr "dot" "yes")])
3598 (define_insn "*extzvdi_internal2"
3599 [(set (match_operand:CC 4 "gpc_reg_operand" "=x")
3600 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3601 (match_operand:SI 2 "const_int_operand" "i")
3602 (match_operand:SI 3 "const_int_operand" "i"))
3604 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
3605 (zero_extract:DI (match_dup 1) (match_dup 2) (match_dup 3)))]
3606 "TARGET_64BIT && rs6000_gen_cell_microcode"
3609 int start = INTVAL (operands[3]) & 63;
3610 int size = INTVAL (operands[2]) & 63;
3612 if (start + size >= 64)
3613 operands[3] = const0_rtx;
3615 operands[3] = GEN_INT (start + size);
3616 operands[2] = GEN_INT (64 - size);
3617 return \"rldicl. %0,%1,%3,%2\";
3619 [(set_attr "type" "shift")
3620 (set_attr "dot" "yes")])
3623 (define_insn "rotl<mode>3"
3624 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
3625 (rotate:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
3626 (match_operand:SI 2 "reg_or_cint_operand" "rn")))]
3628 "rotl<wd>%I2 %0,%1,%<hH>2"
3629 [(set_attr "type" "shift")
3630 (set_attr "maybe_var_shift" "yes")])
3632 (define_insn "*rotlsi3_64"
3633 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
3635 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3636 (match_operand:SI 2 "reg_or_cint_operand" "rn"))))]
3638 "rotlw%I2 %0,%1,%h2"
3639 [(set_attr "type" "shift")
3640 (set_attr "maybe_var_shift" "yes")])
3642 (define_insn_and_split "*rotl<mode>3_dot"
3643 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3644 (compare:CC (rotate:GPR (match_operand:GPR 1 "gpc_reg_operand" "r,r")
3645 (match_operand:SI 2 "reg_or_cint_operand" "rn,rn"))
3647 (clobber (match_scratch:GPR 0 "=r,r"))]
3648 "<MODE>mode == Pmode && rs6000_gen_cell_microcode"
3650 rotl<wd>%I2. %0,%1,%<hH>2
3652 "&& reload_completed && cc_reg_not_cr0_operand (operands[3], CCmode)"
3654 (rotate:GPR (match_dup 1)
3657 (compare:CC (match_dup 0)
3660 [(set_attr "type" "shift")
3661 (set_attr "maybe_var_shift" "yes")
3662 (set_attr "dot" "yes")
3663 (set_attr "length" "4,8")])
3665 (define_insn_and_split "*rotl<mode>3_dot2"
3666 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3667 (compare:CC (rotate:GPR (match_operand:GPR 1 "gpc_reg_operand" "r,r")
3668 (match_operand:SI 2 "reg_or_cint_operand" "rn,rn"))
3670 (set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
3671 (rotate:GPR (match_dup 1)
3673 "<MODE>mode == Pmode && rs6000_gen_cell_microcode"
3675 rotl<wd>%I2. %0,%1,%<hH>2
3677 "&& reload_completed && cc_reg_not_cr0_operand (operands[3], CCmode)"
3679 (rotate:GPR (match_dup 1)
3682 (compare:CC (match_dup 0)
3685 [(set_attr "type" "shift")
3686 (set_attr "maybe_var_shift" "yes")
3687 (set_attr "dot" "yes")
3688 (set_attr "length" "4,8")])
3691 (define_insn "*rotlsi3_internal4"
3692 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3693 (and:SI (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3694 (match_operand:SI 2 "reg_or_cint_operand" "rn"))
3695 (match_operand:SI 3 "mask_operand" "n")))]
3697 "rlw%I2nm %0,%1,%h2,%m3,%M3"
3698 [(set_attr "type" "shift")
3699 (set_attr "maybe_var_shift" "yes")])
3701 (define_insn "*rotlsi3_internal5"
3702 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3704 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3705 (match_operand:SI 2 "reg_or_cint_operand" "rn,rn"))
3706 (match_operand:SI 3 "mask_operand" "n,n"))
3708 (clobber (match_scratch:SI 4 "=r,r"))]
3711 rlw%I2nm. %4,%1,%h2,%m3,%M3
3713 [(set_attr "type" "shift")
3714 (set_attr "maybe_var_shift" "yes")
3715 (set_attr "dot" "yes")
3716 (set_attr "length" "4,8")])
3719 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3721 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3722 (match_operand:SI 2 "reg_or_cint_operand" ""))
3723 (match_operand:SI 3 "mask_operand" ""))
3725 (clobber (match_scratch:SI 4 ""))]
3728 (and:SI (rotate:SI (match_dup 1)
3732 (compare:CC (match_dup 4)
3736 (define_insn "*rotlsi3_internal6"
3737 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3739 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3740 (match_operand:SI 2 "reg_or_cint_operand" "rn,rn"))
3741 (match_operand:SI 3 "mask_operand" "n,n"))
3743 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3744 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3747 rlw%I2nm. %0,%1,%h2,%m3,%M3
3749 [(set_attr "type" "shift")
3750 (set_attr "maybe_var_shift" "yes")
3751 (set_attr "dot" "yes")
3752 (set_attr "length" "4,8")])
3755 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
3757 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3758 (match_operand:SI 2 "reg_or_cint_operand" ""))
3759 (match_operand:SI 3 "mask_operand" ""))
3761 (set (match_operand:SI 0 "gpc_reg_operand" "")
3762 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3765 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
3767 (compare:CC (match_dup 0)
3771 (define_insn "*rotlsi3_internal7le"
3772 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3775 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3776 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
3778 "rlw%I2nm %0,%1,%h2,0xff"
3779 [(set (attr "cell_micro")
3780 (if_then_else (match_operand:SI 2 "const_int_operand" "")
3781 (const_string "not")
3782 (const_string "always")))
3783 (set_attr "type" "shift")])
3785 (define_insn "*rotlsi3_internal7be"
3786 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3789 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3790 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 3)))]
3792 "rlw%I2nm %0,%1,%h2,0xff"
3793 [(set (attr "cell_micro")
3794 (if_then_else (match_operand:SI 2 "const_int_operand" "")
3795 (const_string "not")
3796 (const_string "always")))
3797 (set_attr "type" "shift")])
3799 (define_insn "*rotlsi3_internal8le"
3800 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3801 (compare:CC (zero_extend:SI
3803 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3804 (match_operand:SI 2 "reg_or_cint_operand" "rn,rn")) 0))
3806 (clobber (match_scratch:SI 3 "=r,r"))]
3809 rlw%I2nm. %3,%1,%h2,0xff
3811 [(set_attr "type" "shift")
3812 (set_attr "maybe_var_shift" "yes")
3813 (set_attr "dot" "yes")
3814 (set_attr "length" "4,8")])
3816 (define_insn "*rotlsi3_internal8be"
3817 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3818 (compare:CC (zero_extend:SI
3820 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3821 (match_operand:SI 2 "reg_or_cint_operand" "rn,rn")) 3))
3823 (clobber (match_scratch:SI 3 "=r,r"))]
3826 rlw%I2nm. %3,%1,%h2,0xff
3828 [(set_attr "type" "shift")
3829 (set_attr "maybe_var_shift" "yes")
3830 (set_attr "dot" "yes")
3831 (set_attr "length" "4,8")])
3834 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3835 (compare:CC (zero_extend:SI
3837 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3838 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3840 (clobber (match_scratch:SI 3 ""))]
3841 "!BYTES_BIG_ENDIAN && reload_completed"
3843 (zero_extend:SI (subreg:QI
3844 (rotate:SI (match_dup 1)
3847 (compare:CC (match_dup 3)
3852 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3853 (compare:CC (zero_extend:SI
3855 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3856 (match_operand:SI 2 "reg_or_cint_operand" "")) 3))
3858 (clobber (match_scratch:SI 3 ""))]
3859 "BYTES_BIG_ENDIAN && reload_completed"
3861 (zero_extend:SI (subreg:QI
3862 (rotate:SI (match_dup 1)
3865 (compare:CC (match_dup 3)
3869 (define_insn "*rotlsi3_internal9le"
3870 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3871 (compare:CC (zero_extend:SI
3873 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3874 (match_operand:SI 2 "reg_or_cint_operand" "rn,rn")) 0))
3876 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3877 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3880 rlw%I2nm. %0,%1,%h2,0xff
3882 [(set_attr "type" "shift")
3883 (set_attr "maybe_var_shift" "yes")
3884 (set_attr "dot" "yes")
3885 (set_attr "length" "4,8")])
3887 (define_insn "*rotlsi3_internal9be"
3888 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3889 (compare:CC (zero_extend:SI
3891 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3892 (match_operand:SI 2 "reg_or_cint_operand" "rn,rn")) 3))
3894 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3895 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 3)))]
3898 rlw%I2nm. %0,%1,%h2,0xff
3900 [(set_attr "type" "shift")
3901 (set_attr "maybe_var_shift" "yes")
3902 (set_attr "dot" "yes")
3903 (set_attr "length" "4,8")])
3906 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3907 (compare:CC (zero_extend:SI
3909 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3910 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3912 (set (match_operand:SI 0 "gpc_reg_operand" "")
3913 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3914 "!BYTES_BIG_ENDIAN && reload_completed"
3916 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
3918 (compare:CC (match_dup 0)
3923 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3924 (compare:CC (zero_extend:SI
3926 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3927 (match_operand:SI 2 "reg_or_cint_operand" "")) 3))
3929 (set (match_operand:SI 0 "gpc_reg_operand" "")
3930 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 3)))]
3931 "BYTES_BIG_ENDIAN && reload_completed"
3933 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 3)))
3935 (compare:CC (match_dup 0)
3939 (define_insn "*rotlsi3_internal10le"
3940 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3943 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3944 (match_operand:SI 2 "reg_or_cint_operand" "rn")) 0)))]
3946 "rlw%I2nm %0,%1,%h2,0xffff"
3947 [(set_attr "type" "shift")
3948 (set_attr "maybe_var_shift" "yes")])
3950 (define_insn "*rotlsi3_internal10be"
3951 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3954 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3955 (match_operand:SI 2 "reg_or_cint_operand" "rn")) 2)))]
3957 "rlw%I2nm %0,%1,%h2,0xffff"
3958 [(set_attr "type" "shift")
3959 (set_attr "maybe_var_shift" "yes")])
3961 (define_insn "*rotlsi3_internal11le"
3962 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3963 (compare:CC (zero_extend:SI
3965 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3966 (match_operand:SI 2 "reg_or_cint_operand" "rn,rn")) 0))
3968 (clobber (match_scratch:SI 3 "=r,r"))]
3971 rlw%I2nm. %3,%1,%h2,0xffff
3973 [(set_attr "type" "shift")
3974 (set_attr "maybe_var_shift" "yes")
3975 (set_attr "dot" "yes")
3976 (set_attr "length" "4,8")])
3978 (define_insn "*rotlsi3_internal11be"
3979 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3980 (compare:CC (zero_extend:SI
3982 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3983 (match_operand:SI 2 "reg_or_cint_operand" "rn,rn")) 2))
3985 (clobber (match_scratch:SI 3 "=r,r"))]
3988 rlw%I2nm. %3,%1,%h2,0xffff
3990 [(set_attr "type" "shift")
3991 (set_attr "maybe_var_shift" "yes")
3992 (set_attr "dot" "yes")
3993 (set_attr "length" "4,8")])
3996 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3997 (compare:CC (zero_extend:SI
3999 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4000 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4002 (clobber (match_scratch:SI 3 ""))]
4003 "!BYTES_BIG_ENDIAN && reload_completed"
4005 (zero_extend:SI (subreg:HI
4006 (rotate:SI (match_dup 1)
4009 (compare:CC (match_dup 3)
4014 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4015 (compare:CC (zero_extend:SI
4017 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4018 (match_operand:SI 2 "reg_or_cint_operand" "")) 2))
4020 (clobber (match_scratch:SI 3 ""))]
4021 "BYTES_BIG_ENDIAN && reload_completed"
4023 (zero_extend:SI (subreg:HI
4024 (rotate:SI (match_dup 1)
4027 (compare:CC (match_dup 3)
4031 (define_insn "*rotlsi3_internal12le"
4032 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4033 (compare:CC (zero_extend:SI
4035 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4036 (match_operand:SI 2 "reg_or_cint_operand" "rn,rn")) 0))
4038 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4039 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4042 rlw%I2nm. %0,%1,%h2,0xffff
4044 [(set_attr "type" "shift")
4045 (set_attr "maybe_var_shift" "yes")
4046 (set_attr "dot" "yes")
4047 (set_attr "length" "4,8")])
4049 (define_insn "*rotlsi3_internal12be"
4050 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4051 (compare:CC (zero_extend:SI
4053 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4054 (match_operand:SI 2 "reg_or_cint_operand" "rn,rn")) 2))
4056 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4057 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 2)))]
4060 rlw%I2nm. %0,%1,%h2,0xffff
4062 [(set_attr "type" "shift")
4063 (set_attr "maybe_var_shift" "yes")
4064 (set_attr "dot" "yes")
4065 (set_attr "length" "4,8")])
4068 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4069 (compare:CC (zero_extend:SI
4071 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4072 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4074 (set (match_operand:SI 0 "gpc_reg_operand" "")
4075 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4076 "!BYTES_BIG_ENDIAN && reload_completed"
4078 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
4080 (compare:CC (match_dup 0)
4085 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4086 (compare:CC (zero_extend:SI
4088 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4089 (match_operand:SI 2 "reg_or_cint_operand" "")) 2))
4091 (set (match_operand:SI 0 "gpc_reg_operand" "")
4092 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 2)))]
4093 "BYTES_BIG_ENDIAN && reload_completed"
4095 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 2)))
4097 (compare:CC (match_dup 0)
4102 (define_insn "ashl<mode>3"
4103 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
4104 (ashift:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
4105 (match_operand:SI 2 "reg_or_cint_operand" "rn")))]
4107 "sl<wd>%I2 %0,%1,%<hH>2"
4108 [(set_attr "type" "shift")
4109 (set_attr "maybe_var_shift" "yes")])
4111 (define_insn "*ashlsi3_64"
4112 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4114 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4115 (match_operand:SI 2 "reg_or_cint_operand" "rn"))))]
4118 [(set_attr "type" "shift")
4119 (set_attr "maybe_var_shift" "yes")])
4121 (define_insn_and_split "*ashl<mode>3_dot"
4122 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4123 (compare:CC (ashift:GPR (match_operand:GPR 1 "gpc_reg_operand" "r,r")
4124 (match_operand:SI 2 "reg_or_cint_operand" "rn,rn"))
4126 (clobber (match_scratch:GPR 0 "=r,r"))]
4127 "<MODE>mode == Pmode && rs6000_gen_cell_microcode"
4129 sl<wd>%I2. %0,%1,%<hH>2
4131 "&& reload_completed && cc_reg_not_cr0_operand (operands[3], CCmode)"
4133 (ashift:GPR (match_dup 1)
4136 (compare:CC (match_dup 0)
4139 [(set_attr "type" "shift")
4140 (set_attr "maybe_var_shift" "yes")
4141 (set_attr "dot" "yes")
4142 (set_attr "length" "4,8")])
4144 (define_insn_and_split "*ashl<mode>3_dot2"
4145 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4146 (compare:CC (ashift:GPR (match_operand:GPR 1 "gpc_reg_operand" "r,r")
4147 (match_operand:SI 2 "reg_or_cint_operand" "rn,rn"))
4149 (set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
4150 (ashift:GPR (match_dup 1)
4152 "<MODE>mode == Pmode && rs6000_gen_cell_microcode"
4154 sl<wd>%I2. %0,%1,%<hH>2
4156 "&& reload_completed && cc_reg_not_cr0_operand (operands[3], CCmode)"
4158 (ashift:GPR (match_dup 1)
4161 (compare:CC (match_dup 0)
4164 [(set_attr "type" "shift")
4165 (set_attr "maybe_var_shift" "yes")
4166 (set_attr "dot" "yes")
4167 (set_attr "length" "4,8")])
4170 (define_insn "rlwinm"
4171 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4172 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4173 (match_operand:SI 2 "const_int_operand" "i"))
4174 (match_operand:SI 3 "mask_operand" "n")))]
4175 "includes_lshift_p (operands[2], operands[3])"
4176 "rlwinm %0,%1,%h2,%m3,%M3"
4177 [(set_attr "type" "shift")])
4180 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4182 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4183 (match_operand:SI 2 "const_int_operand" "i,i"))
4184 (match_operand:SI 3 "mask_operand" "n,n"))
4186 (clobber (match_scratch:SI 4 "=r,r"))]
4187 "includes_lshift_p (operands[2], operands[3])"
4189 rlwinm. %4,%1,%h2,%m3,%M3
4191 [(set_attr "type" "shift")
4192 (set_attr "dot" "yes")
4193 (set_attr "length" "4,8")])
4196 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4198 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4199 (match_operand:SI 2 "const_int_operand" ""))
4200 (match_operand:SI 3 "mask_operand" ""))
4202 (clobber (match_scratch:SI 4 ""))]
4203 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
4205 (and:SI (ashift:SI (match_dup 1) (match_dup 2))
4208 (compare:CC (match_dup 4)
4213 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4215 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4216 (match_operand:SI 2 "const_int_operand" "i,i"))
4217 (match_operand:SI 3 "mask_operand" "n,n"))
4219 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4220 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4221 "includes_lshift_p (operands[2], operands[3])"
4223 rlwinm. %0,%1,%h2,%m3,%M3
4225 [(set_attr "type" "shift")
4226 (set_attr "dot" "yes")
4227 (set_attr "length" "4,8")])
4230 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
4232 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4233 (match_operand:SI 2 "const_int_operand" ""))
4234 (match_operand:SI 3 "mask_operand" ""))
4236 (set (match_operand:SI 0 "gpc_reg_operand" "")
4237 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4238 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
4240 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4242 (compare:CC (match_dup 0)
4247 (define_insn "lshr<mode>3"
4248 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
4249 (lshiftrt:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
4250 (match_operand:SI 2 "reg_or_cint_operand" "rn")))]
4252 "sr<wd>%I2 %0,%1,%<hH>2"
4253 [(set_attr "type" "shift")
4254 (set_attr "maybe_var_shift" "yes")])
4256 (define_insn "*lshrsi3_64"
4257 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4259 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4260 (match_operand:SI 2 "reg_or_cint_operand" "rn"))))]
4263 [(set_attr "type" "shift")
4264 (set_attr "maybe_var_shift" "yes")])
4266 (define_insn_and_split "*lshr<mode>3_dot"
4267 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4268 (compare:CC (lshiftrt:GPR (match_operand:GPR 1 "gpc_reg_operand" "r,r")
4269 (match_operand:SI 2 "reg_or_cint_operand" "rn,rn"))
4271 (clobber (match_scratch:GPR 0 "=r,r"))]
4272 "<MODE>mode == Pmode && rs6000_gen_cell_microcode"
4274 sr<wd>%I2. %0,%1,%<hH>2
4276 "&& reload_completed && cc_reg_not_cr0_operand (operands[3], CCmode)"
4278 (lshiftrt:GPR (match_dup 1)
4281 (compare:CC (match_dup 0)
4284 [(set_attr "type" "shift")
4285 (set_attr "maybe_var_shift" "yes")
4286 (set_attr "dot" "yes")
4287 (set_attr "length" "4,8")])
4289 (define_insn_and_split "*lshr<mode>3_dot2"
4290 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4291 (compare:CC (lshiftrt:GPR (match_operand:GPR 1 "gpc_reg_operand" "r,r")
4292 (match_operand:SI 2 "reg_or_cint_operand" "rn,rn"))
4294 (set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
4295 (lshiftrt:GPR (match_dup 1)
4297 "<MODE>mode == Pmode && rs6000_gen_cell_microcode"
4299 sr<wd>%I2. %0,%1,%<hH>2
4301 "&& reload_completed && cc_reg_not_cr0_operand (operands[3], CCmode)"
4303 (lshiftrt:GPR (match_dup 1)
4306 (compare:CC (match_dup 0)
4309 [(set_attr "type" "shift")
4310 (set_attr "maybe_var_shift" "yes")
4311 (set_attr "dot" "yes")
4312 (set_attr "length" "4,8")])
4316 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4317 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4318 (match_operand:SI 2 "const_int_operand" "i"))
4319 (match_operand:SI 3 "mask_operand" "n")))]
4320 "includes_rshift_p (operands[2], operands[3])"
4321 "rlwinm %0,%1,%s2,%m3,%M3"
4322 [(set_attr "type" "shift")])
4325 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4327 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4328 (match_operand:SI 2 "const_int_operand" "i,i"))
4329 (match_operand:SI 3 "mask_operand" "n,n"))
4331 (clobber (match_scratch:SI 4 "=r,r"))]
4332 "includes_rshift_p (operands[2], operands[3])"
4334 rlwinm. %4,%1,%s2,%m3,%M3
4336 [(set_attr "type" "shift")
4337 (set_attr "dot" "yes")
4338 (set_attr "length" "4,8")])
4341 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4343 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4344 (match_operand:SI 2 "const_int_operand" ""))
4345 (match_operand:SI 3 "mask_operand" ""))
4347 (clobber (match_scratch:SI 4 ""))]
4348 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
4350 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2))
4353 (compare:CC (match_dup 4)
4358 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4360 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4361 (match_operand:SI 2 "const_int_operand" "i,i"))
4362 (match_operand:SI 3 "mask_operand" "n,n"))
4364 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4365 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4366 "includes_rshift_p (operands[2], operands[3])"
4368 rlwinm. %0,%1,%s2,%m3,%M3
4370 [(set_attr "type" "shift")
4371 (set_attr "dot" "yes")
4372 (set_attr "length" "4,8")])
4375 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
4377 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4378 (match_operand:SI 2 "const_int_operand" ""))
4379 (match_operand:SI 3 "mask_operand" ""))
4381 (set (match_operand:SI 0 "gpc_reg_operand" "")
4382 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4383 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
4385 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4387 (compare:CC (match_dup 0)
4391 (define_insn "*lshiftrt_internal1le"
4392 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4395 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4396 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4397 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255))"
4398 "rlwinm %0,%1,%s2,0xff"
4399 [(set_attr "type" "shift")])
4401 (define_insn "*lshiftrt_internal1be"
4402 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4405 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4406 (match_operand:SI 2 "const_int_operand" "i")) 3)))]
4407 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255))"
4408 "rlwinm %0,%1,%s2,0xff"
4409 [(set_attr "type" "shift")])
4411 (define_insn "*lshiftrt_internal2le"
4412 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4416 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4417 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4419 (clobber (match_scratch:SI 3 "=r,r"))]
4420 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255))"
4422 rlwinm. %3,%1,%s2,0xff
4424 [(set_attr "type" "shift")
4425 (set_attr "dot" "yes")
4426 (set_attr "length" "4,8")])
4428 (define_insn "*lshiftrt_internal2be"
4429 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4433 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4434 (match_operand:SI 2 "const_int_operand" "i,i")) 3))
4436 (clobber (match_scratch:SI 3 "=r,r"))]
4437 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255))"
4439 rlwinm. %3,%1,%s2,0xff
4441 [(set_attr "type" "shift")
4442 (set_attr "dot" "yes")
4443 (set_attr "length" "4,8")])
4446 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4450 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4451 (match_operand:SI 2 "const_int_operand" "")) 0))
4453 (clobber (match_scratch:SI 3 ""))]
4454 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4456 (zero_extend:SI (subreg:QI
4457 (lshiftrt:SI (match_dup 1)
4460 (compare:CC (match_dup 3)
4465 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4469 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4470 (match_operand:SI 2 "const_int_operand" "")) 3))
4472 (clobber (match_scratch:SI 3 ""))]
4473 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4475 (zero_extend:SI (subreg:QI
4476 (lshiftrt:SI (match_dup 1)
4479 (compare:CC (match_dup 3)
4483 (define_insn "*lshiftrt_internal3le"
4484 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4488 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4489 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4491 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4492 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4493 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255))"
4495 rlwinm. %0,%1,%s2,0xff
4497 [(set_attr "type" "shift")
4498 (set_attr "dot" "yes")
4499 (set_attr "length" "4,8")])
4501 (define_insn "*lshiftrt_internal3be"
4502 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4506 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4507 (match_operand:SI 2 "const_int_operand" "i,i")) 3))
4509 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4510 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 3)))]
4511 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255))"
4513 rlwinm. %0,%1,%s2,0xff
4515 [(set_attr "type" "shift")
4516 (set_attr "dot" "yes")
4517 (set_attr "length" "4,8")])
4520 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4524 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4525 (match_operand:SI 2 "const_int_operand" "")) 0))
4527 (set (match_operand:SI 0 "gpc_reg_operand" "")
4528 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4529 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4531 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4533 (compare:CC (match_dup 0)
4538 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4542 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4543 (match_operand:SI 2 "const_int_operand" "")) 3))
4545 (set (match_operand:SI 0 "gpc_reg_operand" "")
4546 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 3)))]
4547 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4549 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 3)))
4551 (compare:CC (match_dup 0)
4555 (define_insn "*lshiftrt_internal4le"
4556 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4559 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4560 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4561 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535))"
4562 "rlwinm %0,%1,%s2,0xffff"
4563 [(set_attr "type" "shift")])
4565 (define_insn "*lshiftrt_internal4be"
4566 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4569 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4570 (match_operand:SI 2 "const_int_operand" "i")) 2)))]
4571 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535))"
4572 "rlwinm %0,%1,%s2,0xffff"
4573 [(set_attr "type" "shift")])
4575 (define_insn "*lshiftrt_internal5le"
4576 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4580 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4581 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4583 (clobber (match_scratch:SI 3 "=r,r"))]
4584 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535))"
4586 rlwinm. %3,%1,%s2,0xffff
4588 [(set_attr "type" "shift")
4589 (set_attr "dot" "yes")
4590 (set_attr "length" "4,8")])
4592 (define_insn "*lshiftrt_internal5be"
4593 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4597 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4598 (match_operand:SI 2 "const_int_operand" "i,i")) 2))
4600 (clobber (match_scratch:SI 3 "=r,r"))]
4601 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535))"
4603 rlwinm. %3,%1,%s2,0xffff
4605 [(set_attr "type" "shift")
4606 (set_attr "dot" "yes")
4607 (set_attr "length" "4,8")])
4610 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4614 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4615 (match_operand:SI 2 "const_int_operand" "")) 0))
4617 (clobber (match_scratch:SI 3 ""))]
4618 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4620 (zero_extend:SI (subreg:HI
4621 (lshiftrt:SI (match_dup 1)
4624 (compare:CC (match_dup 3)
4629 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4633 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4634 (match_operand:SI 2 "const_int_operand" "")) 2))
4636 (clobber (match_scratch:SI 3 ""))]
4637 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4639 (zero_extend:SI (subreg:HI
4640 (lshiftrt:SI (match_dup 1)
4643 (compare:CC (match_dup 3)
4647 (define_insn "*lshiftrt_internal5le"
4648 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4652 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4653 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4655 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4656 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4657 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535))"
4659 rlwinm. %0,%1,%s2,0xffff
4661 [(set_attr "type" "shift")
4662 (set_attr "dot" "yes")
4663 (set_attr "length" "4,8")])
4665 (define_insn "*lshiftrt_internal5be"
4666 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4670 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4671 (match_operand:SI 2 "const_int_operand" "i,i")) 2))
4673 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4674 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 2)))]
4675 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535))"
4677 rlwinm. %0,%1,%s2,0xffff
4679 [(set_attr "type" "shift")
4680 (set_attr "dot" "yes")
4681 (set_attr "length" "4,8")])
4684 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4688 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4689 (match_operand:SI 2 "const_int_operand" "")) 0))
4691 (set (match_operand:SI 0 "gpc_reg_operand" "")
4692 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4693 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4695 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4697 (compare:CC (match_dup 0)
4702 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4706 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4707 (match_operand:SI 2 "const_int_operand" "")) 2))
4709 (set (match_operand:SI 0 "gpc_reg_operand" "")
4710 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 2)))]
4711 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4713 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 2)))
4715 (compare:CC (match_dup 0)
4720 (define_expand "ashr<mode>3"
4721 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
4722 (ashiftrt:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
4723 (match_operand:SI 2 "reg_or_cint_operand" "")))]
4726 /* The generic code does not generate optimal code for the low word
4727 (it should be a rlwimi and a rot). Until we have target code to
4728 solve this generically, keep this expander. */
4730 if (<MODE>mode == DImode && !TARGET_POWERPC64)
4732 if (CONST_INT_P (operands[2]))
4734 emit_insn (gen_ashrdi3_no_power (operands[0], operands[1], operands[2]));
4742 (define_insn "*ashr<mode>3"
4743 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
4744 (ashiftrt:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
4745 (match_operand:SI 2 "reg_or_cint_operand" "rn")))]
4747 "sra<wd>%I2 %0,%1,%<hH>2"
4748 [(set_attr "type" "shift")
4749 (set_attr "maybe_var_shift" "yes")])
4751 (define_insn "*ashrsi3_64"
4752 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4754 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4755 (match_operand:SI 2 "reg_or_cint_operand" "rn"))))]
4758 [(set_attr "type" "shift")
4759 (set_attr "maybe_var_shift" "yes")])
4761 (define_insn_and_split "*ashr<mode>3_dot"
4762 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4763 (compare:CC (ashiftrt:GPR (match_operand:GPR 1 "gpc_reg_operand" "r,r")
4764 (match_operand:SI 2 "reg_or_cint_operand" "rn,rn"))
4766 (clobber (match_scratch:GPR 0 "=r,r"))]
4767 "<MODE>mode == Pmode && rs6000_gen_cell_microcode"
4769 sra<wd>%I2. %0,%1,%<hH>2
4771 "&& reload_completed && cc_reg_not_cr0_operand (operands[3], CCmode)"
4773 (ashiftrt:GPR (match_dup 1)
4776 (compare:CC (match_dup 0)
4779 [(set_attr "type" "shift")
4780 (set_attr "maybe_var_shift" "yes")
4781 (set_attr "dot" "yes")
4782 (set_attr "length" "4,8")])
4784 (define_insn_and_split "*ashr<mode>3_dot2"
4785 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4786 (compare:CC (ashiftrt:GPR (match_operand:GPR 1 "gpc_reg_operand" "r,r")
4787 (match_operand:SI 2 "reg_or_cint_operand" "rn,rn"))
4789 (set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
4790 (ashiftrt:GPR (match_dup 1)
4792 "<MODE>mode == Pmode && rs6000_gen_cell_microcode"
4794 sra<wd>%I2. %0,%1,%<hH>2
4796 "&& reload_completed && cc_reg_not_cr0_operand (operands[3], CCmode)"
4798 (ashiftrt:GPR (match_dup 1)
4801 (compare:CC (match_dup 0)
4804 [(set_attr "type" "shift")
4805 (set_attr "maybe_var_shift" "yes")
4806 (set_attr "dot" "yes")
4807 (set_attr "length" "4,8")])
4809 ;; Builtins to replace a division to generate FRE reciprocal estimate
4810 ;; instructions and the necessary fixup instructions
4811 (define_expand "recip<mode>3"
4812 [(match_operand:RECIPF 0 "gpc_reg_operand" "")
4813 (match_operand:RECIPF 1 "gpc_reg_operand" "")
4814 (match_operand:RECIPF 2 "gpc_reg_operand" "")]
4815 "RS6000_RECIP_HAVE_RE_P (<MODE>mode)"
4817 rs6000_emit_swdiv (operands[0], operands[1], operands[2], false);
4821 ;; Split to create division from FRE/FRES/etc. and fixup instead of the normal
4822 ;; hardware division. This is only done before register allocation and with
4823 ;; -ffast-math. This must appear before the divsf3/divdf3 insns.
4825 [(set (match_operand:RECIPF 0 "gpc_reg_operand" "")
4826 (div:RECIPF (match_operand 1 "gpc_reg_operand" "")
4827 (match_operand 2 "gpc_reg_operand" "")))]
4828 "RS6000_RECIP_AUTO_RE_P (<MODE>mode)
4829 && can_create_pseudo_p () && optimize_insn_for_speed_p ()
4830 && flag_finite_math_only && !flag_trapping_math && flag_reciprocal_math"
4833 rs6000_emit_swdiv (operands[0], operands[1], operands[2], true);
4837 ;; Builtins to replace 1/sqrt(x) with instructions using RSQRTE and the
4838 ;; appropriate fixup.
4839 (define_expand "rsqrt<mode>2"
4840 [(match_operand:RECIPF 0 "gpc_reg_operand" "")
4841 (match_operand:RECIPF 1 "gpc_reg_operand" "")]
4842 "RS6000_RECIP_HAVE_RSQRTE_P (<MODE>mode)"
4844 rs6000_emit_swrsqrt (operands[0], operands[1]);
4848 ;; Floating-point insns, excluding normal data motion. We combine the SF/DF
4849 ;; modes here, and also add in conditional vsx/power8-vector support to access
4850 ;; values in the traditional Altivec registers if the appropriate
4851 ;; -mupper-regs-{df,sf} option is enabled.
4853 (define_expand "abs<mode>2"
4854 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
4855 (abs:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")))]
4856 "TARGET_<MODE>_INSN"
4859 (define_insn "*abs<mode>2_fpr"
4860 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
4861 (abs:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")))]
4866 [(set_attr "type" "fp")
4867 (set_attr "fp_type" "fp_addsub_<Fs>")])
4869 (define_insn "*nabs<mode>2_fpr"
4870 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
4873 (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>"))))]
4878 [(set_attr "type" "fp")
4879 (set_attr "fp_type" "fp_addsub_<Fs>")])
4881 (define_expand "neg<mode>2"
4882 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
4883 (neg:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")))]
4884 "TARGET_<MODE>_INSN"
4887 (define_insn "*neg<mode>2_fpr"
4888 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
4889 (neg:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")))]
4894 [(set_attr "type" "fp")
4895 (set_attr "fp_type" "fp_addsub_<Fs>")])
4897 (define_expand "add<mode>3"
4898 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
4899 (plus:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")
4900 (match_operand:SFDF 2 "gpc_reg_operand" "")))]
4901 "TARGET_<MODE>_INSN"
4904 (define_insn "*add<mode>3_fpr"
4905 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
4906 (plus:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "%<Ff>,<Fv>")
4907 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")))]
4910 fadd<Ftrad> %0,%1,%2
4911 xsadd<Fvsx> %x0,%x1,%x2"
4912 [(set_attr "type" "fp")
4913 (set_attr "fp_type" "fp_addsub_<Fs>")])
4915 (define_expand "sub<mode>3"
4916 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
4917 (minus:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")
4918 (match_operand:SFDF 2 "gpc_reg_operand" "")))]
4919 "TARGET_<MODE>_INSN"
4922 (define_insn "*sub<mode>3_fpr"
4923 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
4924 (minus:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")
4925 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")))]
4928 fsub<Ftrad> %0,%1,%2
4929 xssub<Fvsx> %x0,%x1,%x2"
4930 [(set_attr "type" "fp")
4931 (set_attr "fp_type" "fp_addsub_<Fs>")])
4933 (define_expand "mul<mode>3"
4934 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
4935 (mult:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")
4936 (match_operand:SFDF 2 "gpc_reg_operand" "")))]
4937 "TARGET_<MODE>_INSN"
4940 (define_insn "*mul<mode>3_fpr"
4941 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
4942 (mult:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "%<Ff>,<Fv>")
4943 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")))]
4946 fmul<Ftrad> %0,%1,%2
4947 xsmul<Fvsx> %x0,%x1,%x2"
4948 [(set_attr "type" "dmul")
4949 (set_attr "fp_type" "fp_mul_<Fs>")])
4951 (define_expand "div<mode>3"
4952 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
4953 (div:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")
4954 (match_operand:SFDF 2 "gpc_reg_operand" "")))]
4955 "TARGET_<MODE>_INSN && !TARGET_SIMPLE_FPU"
4958 (define_insn "*div<mode>3_fpr"
4959 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
4960 (div:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")
4961 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")))]
4962 "TARGET_<MODE>_FPR && !TARGET_SIMPLE_FPU"
4964 fdiv<Ftrad> %0,%1,%2
4965 xsdiv<Fvsx> %x0,%x1,%x2"
4966 [(set_attr "type" "<Fs>div")
4967 (set_attr "fp_type" "fp_div_<Fs>")])
4969 (define_insn "sqrt<mode>2"
4970 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
4971 (sqrt:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")))]
4972 "TARGET_<MODE>_FPR && !TARGET_SIMPLE_FPU
4973 && (TARGET_PPC_GPOPT || (<MODE>mode == SFmode && TARGET_XILINX_FPU))"
4976 xssqrt<Fvsx> %x0,%x1"
4977 [(set_attr "type" "<Fs>sqrt")
4978 (set_attr "fp_type" "fp_sqrt_<Fs>")])
4980 ;; Floating point reciprocal approximation
4981 (define_insn "fre<Fs>"
4982 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
4983 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")]
4989 [(set_attr "type" "fp")])
4991 (define_insn "*rsqrt<mode>2"
4992 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
4993 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")]
4995 "RS6000_RECIP_HAVE_RSQRTE_P (<MODE>mode)"
4997 frsqrte<Ftrad> %0,%1
4998 xsrsqrte<Fvsx> %x0,%x1"
4999 [(set_attr "type" "fp")])
5001 ;; Floating point comparisons
5002 (define_insn "*cmp<mode>_fpr"
5003 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y,y")
5004 (compare:CCFP (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")
5005 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")))]
5009 xscmpudp %0,%x1,%x2"
5010 [(set_attr "type" "fpcompare")])
5012 ;; Floating point conversions
5013 (define_expand "extendsfdf2"
5014 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5015 (float_extend:DF (match_operand:SF 1 "reg_or_none500mem_operand" "")))]
5016 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5019 (define_insn_and_split "*extendsfdf2_fpr"
5020 [(set (match_operand:DF 0 "gpc_reg_operand" "=d,?d,d,ws,?ws,wv")
5021 (float_extend:DF (match_operand:SF 1 "reg_or_mem_operand" "0,f,m,0,wy,Z")))]
5022 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5030 "&& reload_completed && REG_P (operands[1]) && REGNO (operands[0]) == REGNO (operands[1])"
5033 emit_note (NOTE_INSN_DELETED);
5036 [(set_attr "type" "fp,fp,fpload,fp,vecsimple,fpload")])
5038 (define_expand "truncdfsf2"
5039 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5040 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "")))]
5041 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5044 (define_insn "*truncdfsf2_fpr"
5045 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5046 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "d")))]
5047 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5049 [(set_attr "type" "fp")])
5051 ;; This expander is here to avoid FLOAT_WORDS_BIGENDIAN tests in
5052 ;; builtins.c and optabs.c that are not correct for IBM long double
5053 ;; when little-endian.
5054 (define_expand "signbittf2"
5056 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "")))
5058 (subreg:DI (match_dup 2) 0))
5061 (set (match_operand:SI 0 "gpc_reg_operand" "")
5064 && TARGET_HARD_FLOAT
5065 && (TARGET_FPRS || TARGET_E500_DOUBLE)
5066 && TARGET_LONG_DOUBLE_128"
5068 operands[2] = gen_reg_rtx (DFmode);
5069 operands[3] = gen_reg_rtx (DImode);
5070 if (TARGET_POWERPC64)
5072 operands[4] = gen_reg_rtx (DImode);
5073 operands[5] = gen_rtx_LSHIFTRT (DImode, operands[3], GEN_INT (63));
5074 operands[6] = gen_rtx_SUBREG (SImode, operands[4],
5075 WORDS_BIG_ENDIAN ? 4 : 0);
5079 operands[4] = gen_reg_rtx (SImode);
5080 operands[5] = gen_rtx_SUBREG (SImode, operands[3],
5081 WORDS_BIG_ENDIAN ? 0 : 4);
5082 operands[6] = gen_rtx_LSHIFTRT (SImode, operands[4], GEN_INT (31));
5086 (define_expand "copysign<mode>3"
5088 (abs:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")))
5090 (neg:SFDF (abs:SFDF (match_dup 1))))
5091 (set (match_operand:SFDF 0 "gpc_reg_operand" "")
5092 (if_then_else:SFDF (ge (match_operand:SFDF 2 "gpc_reg_operand" "")
5096 "TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>
5097 && ((TARGET_PPC_GFXOPT
5098 && !HONOR_NANS (<MODE>mode)
5099 && !HONOR_SIGNED_ZEROS (<MODE>mode))
5101 || VECTOR_UNIT_VSX_P (<MODE>mode))"
5103 if (TARGET_CMPB || VECTOR_UNIT_VSX_P (<MODE>mode))
5105 emit_insn (gen_copysign<mode>3_fcpsgn (operands[0], operands[1],
5110 operands[3] = gen_reg_rtx (<MODE>mode);
5111 operands[4] = gen_reg_rtx (<MODE>mode);
5112 operands[5] = CONST0_RTX (<MODE>mode);
5115 ;; Use an unspec rather providing an if-then-else in RTL, to prevent the
5116 ;; compiler from optimizing -0.0
5117 (define_insn "copysign<mode>3_fcpsgn"
5118 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
5119 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")
5120 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")]
5122 "TARGET_<MODE>_FPR && TARGET_CMPB"
5125 xscpsgn<Fvsx> %x0,%x2,%x1"
5126 [(set_attr "type" "fp")])
5128 ;; For MIN, MAX, and conditional move, we use DEFINE_EXPAND's that involve a
5129 ;; fsel instruction and some auxiliary computations. Then we just have a
5130 ;; single DEFINE_INSN for fsel and the define_splits to make them if made by
5132 ;; For MIN, MAX on non-VSX machines, and conditional move all of the time, we
5133 ;; use DEFINE_EXPAND's that involve a fsel instruction and some auxiliary
5134 ;; computations. Then we just have a single DEFINE_INSN for fsel and the
5135 ;; define_splits to make them if made by combine. On VSX machines we have the
5136 ;; min/max instructions.
5138 ;; On VSX, we only check for TARGET_VSX instead of checking for a vsx/p8 vector
5139 ;; to allow either DF/SF to use only traditional registers.
5141 (define_expand "smax<mode>3"
5142 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
5143 (if_then_else:SFDF (ge (match_operand:SFDF 1 "gpc_reg_operand" "")
5144 (match_operand:SFDF 2 "gpc_reg_operand" ""))
5147 "TARGET_<MODE>_FPR && TARGET_PPC_GFXOPT && !flag_trapping_math"
5149 rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]);
5153 (define_insn "*smax<mode>3_vsx"
5154 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
5155 (smax:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "%<Ff>,<Fv>")
5156 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")))]
5157 "TARGET_<MODE>_FPR && TARGET_VSX"
5158 "xsmaxdp %x0,%x1,%x2"
5159 [(set_attr "type" "fp")])
5161 (define_expand "smin<mode>3"
5162 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
5163 (if_then_else:SFDF (ge (match_operand:SFDF 1 "gpc_reg_operand" "")
5164 (match_operand:SFDF 2 "gpc_reg_operand" ""))
5167 "TARGET_<MODE>_FPR && TARGET_PPC_GFXOPT && !flag_trapping_math"
5169 rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]);
5173 (define_insn "*smin<mode>3_vsx"
5174 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
5175 (smin:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "%<Ff>,<Fv>")
5176 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")))]
5177 "TARGET_<MODE>_FPR && TARGET_VSX"
5178 "xsmindp %x0,%x1,%x2"
5179 [(set_attr "type" "fp")])
5182 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
5183 (match_operator:SFDF 3 "min_max_operator"
5184 [(match_operand:SFDF 1 "gpc_reg_operand" "")
5185 (match_operand:SFDF 2 "gpc_reg_operand" "")]))]
5186 "TARGET_<MODE>_FPR && TARGET_PPC_GFXOPT && !flag_trapping_math
5190 rs6000_emit_minmax (operands[0], GET_CODE (operands[3]), operands[1],
5196 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5197 (match_operator:SF 3 "min_max_operator"
5198 [(match_operand:SF 1 "gpc_reg_operand" "")
5199 (match_operand:SF 2 "gpc_reg_operand" "")]))]
5200 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
5201 && TARGET_SINGLE_FLOAT && !flag_trapping_math"
5204 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
5205 operands[1], operands[2]);
5209 (define_expand "mov<mode>cc"
5210 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
5211 (if_then_else:GPR (match_operand 1 "comparison_operator" "")
5212 (match_operand:GPR 2 "gpc_reg_operand" "")
5213 (match_operand:GPR 3 "gpc_reg_operand" "")))]
5217 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5223 ;; We use the BASE_REGS for the isel input operands because, if rA is
5224 ;; 0, the value of 0 is placed in rD upon truth. Similarly for rB
5225 ;; because we may switch the operands and rB may end up being rA.
5227 ;; We need 2 patterns: an unsigned and a signed pattern. We could
5228 ;; leave out the mode in operand 4 and use one pattern, but reload can
5229 ;; change the mode underneath our feet and then gets confused trying
5230 ;; to reload the value.
5231 (define_insn "isel_signed_<mode>"
5232 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
5234 (match_operator 1 "scc_comparison_operator"
5235 [(match_operand:CC 4 "cc_reg_operand" "y,y")
5237 (match_operand:GPR 2 "reg_or_cint_operand" "O,b")
5238 (match_operand:GPR 3 "gpc_reg_operand" "r,r")))]
5241 { return output_isel (operands); }"
5242 [(set_attr "type" "isel")
5243 (set_attr "length" "4")])
5245 (define_insn "isel_unsigned_<mode>"
5246 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
5248 (match_operator 1 "scc_comparison_operator"
5249 [(match_operand:CCUNS 4 "cc_reg_operand" "y,y")
5251 (match_operand:GPR 2 "reg_or_cint_operand" "O,b")
5252 (match_operand:GPR 3 "gpc_reg_operand" "r,r")))]
5255 { return output_isel (operands); }"
5256 [(set_attr "type" "isel")
5257 (set_attr "length" "4")])
5259 ;; These patterns can be useful for combine; they let combine know that
5260 ;; isel can handle reversed comparisons so long as the operands are
5263 (define_insn "*isel_reversed_signed_<mode>"
5264 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
5266 (match_operator 1 "scc_rev_comparison_operator"
5267 [(match_operand:CC 4 "cc_reg_operand" "y")
5269 (match_operand:GPR 2 "gpc_reg_operand" "b")
5270 (match_operand:GPR 3 "gpc_reg_operand" "b")))]
5273 { return output_isel (operands); }"
5274 [(set_attr "type" "isel")
5275 (set_attr "length" "4")])
5277 (define_insn "*isel_reversed_unsigned_<mode>"
5278 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
5280 (match_operator 1 "scc_rev_comparison_operator"
5281 [(match_operand:CCUNS 4 "cc_reg_operand" "y")
5283 (match_operand:GPR 2 "gpc_reg_operand" "b")
5284 (match_operand:GPR 3 "gpc_reg_operand" "b")))]
5287 { return output_isel (operands); }"
5288 [(set_attr "type" "isel")
5289 (set_attr "length" "4")])
5291 (define_expand "movsfcc"
5292 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5293 (if_then_else:SF (match_operand 1 "comparison_operator" "")
5294 (match_operand:SF 2 "gpc_reg_operand" "")
5295 (match_operand:SF 3 "gpc_reg_operand" "")))]
5296 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5299 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5305 (define_insn "*fselsfsf4"
5306 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5307 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
5308 (match_operand:SF 4 "zero_fp_constant" "F"))
5309 (match_operand:SF 2 "gpc_reg_operand" "f")
5310 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5311 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5313 [(set_attr "type" "fp")])
5315 (define_insn "*fseldfsf4"
5316 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5317 (if_then_else:SF (ge (match_operand:DF 1 "gpc_reg_operand" "d")
5318 (match_operand:DF 4 "zero_fp_constant" "F"))
5319 (match_operand:SF 2 "gpc_reg_operand" "f")
5320 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5321 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_SINGLE_FLOAT"
5323 [(set_attr "type" "fp")])
5325 ;; The conditional move instructions allow us to perform max and min
5326 ;; operations even when
5329 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5330 (match_operator:DF 3 "min_max_operator"
5331 [(match_operand:DF 1 "gpc_reg_operand" "")
5332 (match_operand:DF 2 "gpc_reg_operand" "")]))]
5333 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5334 && !flag_trapping_math"
5337 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
5338 operands[1], operands[2]);
5342 (define_expand "movdfcc"
5343 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5344 (if_then_else:DF (match_operand 1 "comparison_operator" "")
5345 (match_operand:DF 2 "gpc_reg_operand" "")
5346 (match_operand:DF 3 "gpc_reg_operand" "")))]
5347 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5350 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5356 (define_insn "*fseldfdf4"
5357 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
5358 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "d")
5359 (match_operand:DF 4 "zero_fp_constant" "F"))
5360 (match_operand:DF 2 "gpc_reg_operand" "d")
5361 (match_operand:DF 3 "gpc_reg_operand" "d")))]
5362 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5364 [(set_attr "type" "fp")])
5366 (define_insn "*fselsfdf4"
5367 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
5368 (if_then_else:DF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
5369 (match_operand:SF 4 "zero_fp_constant" "F"))
5370 (match_operand:DF 2 "gpc_reg_operand" "d")
5371 (match_operand:DF 3 "gpc_reg_operand" "d")))]
5372 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_SINGLE_FLOAT"
5374 [(set_attr "type" "fp")])
5376 ;; Conversions to and from floating-point.
5378 ; We don't define lfiwax/lfiwzx with the normal definition, because we
5379 ; don't want to support putting SImode in FPR registers.
5380 (define_insn "lfiwax"
5381 [(set (match_operand:DI 0 "gpc_reg_operand" "=d,wj,!wj")
5382 (unspec:DI [(match_operand:SI 1 "reg_or_indexed_operand" "Z,Z,r")]
5384 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWAX"
5389 [(set_attr "type" "fpload,fpload,mffgpr")])
5391 ; This split must be run before register allocation because it allocates the
5392 ; memory slot that is needed to move values to/from the FPR. We don't allocate
5393 ; it earlier to allow for the combiner to merge insns together where it might
5394 ; not be needed and also in case the insns are deleted as dead code.
5396 (define_insn_and_split "floatsi<mode>2_lfiwax"
5397 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d")
5398 (float:SFDF (match_operand:SI 1 "nonimmediate_operand" "r")))
5399 (clobber (match_scratch:DI 2 "=d"))]
5400 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWAX
5401 && <SI_CONVERT_FP> && can_create_pseudo_p ()"
5407 rtx dest = operands[0];
5408 rtx src = operands[1];
5411 if (!MEM_P (src) && TARGET_POWERPC64
5412 && (TARGET_MFPGPR || TARGET_DIRECT_MOVE))
5413 tmp = convert_to_mode (DImode, src, false);
5417 if (GET_CODE (tmp) == SCRATCH)
5418 tmp = gen_reg_rtx (DImode);
5421 src = rs6000_address_for_fpconvert (src);
5422 emit_insn (gen_lfiwax (tmp, src));
5426 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
5427 emit_move_insn (stack, src);
5428 emit_insn (gen_lfiwax (tmp, stack));
5431 emit_insn (gen_floatdi<mode>2 (dest, tmp));
5434 [(set_attr "length" "12")
5435 (set_attr "type" "fpload")])
5437 (define_insn_and_split "floatsi<mode>2_lfiwax_mem"
5438 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d,<rreg2>")
5441 (match_operand:SI 1 "indexed_or_indirect_operand" "Z,Z"))))
5442 (clobber (match_scratch:DI 2 "=0,d"))]
5443 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWAX
5450 operands[1] = rs6000_address_for_fpconvert (operands[1]);
5451 if (GET_CODE (operands[2]) == SCRATCH)
5452 operands[2] = gen_reg_rtx (DImode);
5453 emit_insn (gen_lfiwax (operands[2], operands[1]));
5454 emit_insn (gen_floatdi<mode>2 (operands[0], operands[2]));
5457 [(set_attr "length" "8")
5458 (set_attr "type" "fpload")])
5460 (define_insn "lfiwzx"
5461 [(set (match_operand:DI 0 "gpc_reg_operand" "=d,wj,!wj")
5462 (unspec:DI [(match_operand:SI 1 "reg_or_indexed_operand" "Z,Z,r")]
5464 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWZX"
5469 [(set_attr "type" "fpload,fpload,mftgpr")])
5471 (define_insn_and_split "floatunssi<mode>2_lfiwzx"
5472 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d")
5473 (unsigned_float:SFDF (match_operand:SI 1 "nonimmediate_operand" "r")))
5474 (clobber (match_scratch:DI 2 "=d"))]
5475 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWZX
5482 rtx dest = operands[0];
5483 rtx src = operands[1];
5486 if (!MEM_P (src) && TARGET_POWERPC64
5487 && (TARGET_MFPGPR || TARGET_DIRECT_MOVE))
5488 tmp = convert_to_mode (DImode, src, true);
5492 if (GET_CODE (tmp) == SCRATCH)
5493 tmp = gen_reg_rtx (DImode);
5496 src = rs6000_address_for_fpconvert (src);
5497 emit_insn (gen_lfiwzx (tmp, src));
5501 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
5502 emit_move_insn (stack, src);
5503 emit_insn (gen_lfiwzx (tmp, stack));
5506 emit_insn (gen_floatdi<mode>2 (dest, tmp));
5509 [(set_attr "length" "12")
5510 (set_attr "type" "fpload")])
5512 (define_insn_and_split "floatunssi<mode>2_lfiwzx_mem"
5513 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d,<rreg2>")
5514 (unsigned_float:SFDF
5516 (match_operand:SI 1 "indexed_or_indirect_operand" "Z,Z"))))
5517 (clobber (match_scratch:DI 2 "=0,d"))]
5518 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWZX
5525 operands[1] = rs6000_address_for_fpconvert (operands[1]);
5526 if (GET_CODE (operands[2]) == SCRATCH)
5527 operands[2] = gen_reg_rtx (DImode);
5528 emit_insn (gen_lfiwzx (operands[2], operands[1]));
5529 emit_insn (gen_floatdi<mode>2 (operands[0], operands[2]));
5532 [(set_attr "length" "8")
5533 (set_attr "type" "fpload")])
5535 ; For each of these conversions, there is a define_expand, a define_insn
5536 ; with a '#' template, and a define_split (with C code). The idea is
5537 ; to allow constant folding with the template of the define_insn,
5538 ; then to have the insns split later (between sched1 and final).
5540 (define_expand "floatsidf2"
5541 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5542 (float:DF (match_operand:SI 1 "nonimmediate_operand" "")))
5545 (clobber (match_dup 4))
5546 (clobber (match_dup 5))
5547 (clobber (match_dup 6))])]
5549 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5552 if (TARGET_E500_DOUBLE)
5554 if (!REG_P (operands[1]))
5555 operands[1] = force_reg (SImode, operands[1]);
5556 emit_insn (gen_spe_floatsidf2 (operands[0], operands[1]));
5559 else if (TARGET_LFIWAX && TARGET_FCFID)
5561 emit_insn (gen_floatsidf2_lfiwax (operands[0], operands[1]));
5564 else if (TARGET_FCFID)
5566 rtx dreg = operands[1];
5568 dreg = force_reg (SImode, dreg);
5569 dreg = convert_to_mode (DImode, dreg, false);
5570 emit_insn (gen_floatdidf2 (operands[0], dreg));
5574 if (!REG_P (operands[1]))
5575 operands[1] = force_reg (SImode, operands[1]);
5576 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5577 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503601774854144\", DFmode));
5578 operands[4] = rs6000_allocate_stack_temp (DFmode, true, false);
5579 operands[5] = gen_reg_rtx (DFmode);
5580 operands[6] = gen_reg_rtx (SImode);
5583 (define_insn_and_split "*floatsidf2_internal"
5584 [(set (match_operand:DF 0 "gpc_reg_operand" "=&d")
5585 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5586 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5587 (use (match_operand:DF 3 "gpc_reg_operand" "d"))
5588 (clobber (match_operand:DF 4 "offsettable_mem_operand" "=o"))
5589 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&d"))
5590 (clobber (match_operand:SI 6 "gpc_reg_operand" "=&r"))]
5591 "! TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5597 rtx lowword, highword;
5598 gcc_assert (MEM_P (operands[4]));
5599 highword = adjust_address (operands[4], SImode, 0);
5600 lowword = adjust_address (operands[4], SImode, 4);
5601 if (! WORDS_BIG_ENDIAN)
5604 tmp = highword; highword = lowword; lowword = tmp;
5607 emit_insn (gen_xorsi3 (operands[6], operands[1],
5608 GEN_INT (~ (HOST_WIDE_INT) 0x7fffffff)));
5609 emit_move_insn (lowword, operands[6]);
5610 emit_move_insn (highword, operands[2]);
5611 emit_move_insn (operands[5], operands[4]);
5612 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5615 [(set_attr "length" "24")
5616 (set_attr "type" "fp")])
5618 ;; If we don't have a direct conversion to single precision, don't enable this
5619 ;; conversion for 32-bit without fast math, because we don't have the insn to
5620 ;; generate the fixup swizzle to avoid double rounding problems.
5621 (define_expand "floatunssisf2"
5622 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5623 (unsigned_float:SF (match_operand:SI 1 "nonimmediate_operand" "")))]
5624 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT
5627 && ((TARGET_FCFIDUS && TARGET_LFIWZX)
5628 || (TARGET_DOUBLE_FLOAT && TARGET_FCFID
5629 && (TARGET_POWERPC64 || flag_unsafe_math_optimizations)))))"
5634 if (!REG_P (operands[1]))
5635 operands[1] = force_reg (SImode, operands[1]);
5637 else if (TARGET_LFIWZX && TARGET_FCFIDUS)
5639 emit_insn (gen_floatunssisf2_lfiwzx (operands[0], operands[1]));
5644 rtx dreg = operands[1];
5646 dreg = force_reg (SImode, dreg);
5647 dreg = convert_to_mode (DImode, dreg, true);
5648 emit_insn (gen_floatdisf2 (operands[0], dreg));
5653 (define_expand "floatunssidf2"
5654 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5655 (unsigned_float:DF (match_operand:SI 1 "nonimmediate_operand" "")))
5658 (clobber (match_dup 4))
5659 (clobber (match_dup 5))])]
5661 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5664 if (TARGET_E500_DOUBLE)
5666 if (!REG_P (operands[1]))
5667 operands[1] = force_reg (SImode, operands[1]);
5668 emit_insn (gen_spe_floatunssidf2 (operands[0], operands[1]));
5671 else if (TARGET_LFIWZX && TARGET_FCFID)
5673 emit_insn (gen_floatunssidf2_lfiwzx (operands[0], operands[1]));
5676 else if (TARGET_FCFID)
5678 rtx dreg = operands[1];
5680 dreg = force_reg (SImode, dreg);
5681 dreg = convert_to_mode (DImode, dreg, true);
5682 emit_insn (gen_floatdidf2 (operands[0], dreg));
5686 if (!REG_P (operands[1]))
5687 operands[1] = force_reg (SImode, operands[1]);
5688 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5689 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503599627370496\", DFmode));
5690 operands[4] = rs6000_allocate_stack_temp (DFmode, true, false);
5691 operands[5] = gen_reg_rtx (DFmode);
5694 (define_insn_and_split "*floatunssidf2_internal"
5695 [(set (match_operand:DF 0 "gpc_reg_operand" "=&d")
5696 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5697 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5698 (use (match_operand:DF 3 "gpc_reg_operand" "d"))
5699 (clobber (match_operand:DF 4 "offsettable_mem_operand" "=o"))
5700 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&d"))]
5701 "! TARGET_FCFIDU && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5702 && !(TARGET_FCFID && TARGET_POWERPC64)"
5708 rtx lowword, highword;
5709 gcc_assert (MEM_P (operands[4]));
5710 highword = adjust_address (operands[4], SImode, 0);
5711 lowword = adjust_address (operands[4], SImode, 4);
5712 if (! WORDS_BIG_ENDIAN)
5715 tmp = highword; highword = lowword; lowword = tmp;
5718 emit_move_insn (lowword, operands[1]);
5719 emit_move_insn (highword, operands[2]);
5720 emit_move_insn (operands[5], operands[4]);
5721 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5724 [(set_attr "length" "20")
5725 (set_attr "type" "fp")])
5727 (define_expand "fix_trunc<mode>si2"
5728 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5729 (fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "")))]
5730 "TARGET_HARD_FLOAT && ((TARGET_FPRS && <TARGET_FLOAT>) || <E500_CONVERT>)"
5733 if (!<E500_CONVERT>)
5738 emit_insn (gen_fix_trunc<mode>si2_stfiwx (operands[0], operands[1]));
5741 tmp = gen_reg_rtx (DImode);
5742 stack = rs6000_allocate_stack_temp (DImode, true, false);
5743 emit_insn (gen_fix_trunc<mode>si2_internal (operands[0], operands[1],
5750 ; Like the convert to float patterns, this insn must be split before
5751 ; register allocation so that it can allocate the memory slot if it
5753 (define_insn_and_split "fix_trunc<mode>si2_stfiwx"
5754 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
5755 (fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d")))
5756 (clobber (match_scratch:DI 2 "=d"))]
5757 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5758 && (<MODE>mode != SFmode || TARGET_SINGLE_FLOAT)
5759 && TARGET_STFIWX && can_create_pseudo_p ()"
5764 rtx dest = operands[0];
5765 rtx src = operands[1];
5766 rtx tmp = operands[2];
5768 if (GET_CODE (tmp) == SCRATCH)
5769 tmp = gen_reg_rtx (DImode);
5771 emit_insn (gen_fctiwz_<mode> (tmp, src));
5774 dest = rs6000_address_for_fpconvert (dest);
5775 emit_insn (gen_stfiwx (dest, tmp));
5778 else if (TARGET_POWERPC64 && (TARGET_MFPGPR || TARGET_DIRECT_MOVE))
5780 dest = gen_lowpart (DImode, dest);
5781 emit_move_insn (dest, tmp);
5786 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
5787 emit_insn (gen_stfiwx (stack, tmp));
5788 emit_move_insn (dest, stack);
5792 [(set_attr "length" "12")
5793 (set_attr "type" "fp")])
5795 (define_insn_and_split "fix_trunc<mode>si2_internal"
5796 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,?r")
5797 (fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d,<rreg>")))
5798 (clobber (match_operand:DI 2 "gpc_reg_operand" "=1,d"))
5799 (clobber (match_operand:DI 3 "offsettable_mem_operand" "=o,o"))]
5800 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5807 gcc_assert (MEM_P (operands[3]));
5808 lowword = adjust_address (operands[3], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
5810 emit_insn (gen_fctiwz_<mode> (operands[2], operands[1]));
5811 emit_move_insn (operands[3], operands[2]);
5812 emit_move_insn (operands[0], lowword);
5815 [(set_attr "length" "16")
5816 (set_attr "type" "fp")])
5818 (define_expand "fix_trunc<mode>di2"
5819 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5820 (fix:DI (match_operand:SFDF 1 "gpc_reg_operand" "")))]
5821 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
5825 (define_insn "*fix_trunc<mode>di2_fctidz"
5826 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
5827 (fix:DI (match_operand:SFDF 1 "gpc_reg_operand" "d")))]
5828 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
5829 && TARGET_FCFID && !VECTOR_UNIT_VSX_P (<MODE>mode)"
5831 [(set_attr "type" "fp")])
5833 (define_expand "fixuns_trunc<mode>si2"
5834 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5835 (unsigned_fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "")))]
5837 && ((TARGET_FPRS && <TARGET_FLOAT> && TARGET_FCTIWUZ && TARGET_STFIWX)
5841 if (!<E500_CONVERT>)
5843 emit_insn (gen_fixuns_trunc<mode>si2_stfiwx (operands[0], operands[1]));
5848 (define_insn_and_split "fixuns_trunc<mode>si2_stfiwx"
5849 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
5850 (unsigned_fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d")))
5851 (clobber (match_scratch:DI 2 "=d"))]
5852 "TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT> && TARGET_FCTIWUZ
5853 && TARGET_STFIWX && can_create_pseudo_p ()"
5858 rtx dest = operands[0];
5859 rtx src = operands[1];
5860 rtx tmp = operands[2];
5862 if (GET_CODE (tmp) == SCRATCH)
5863 tmp = gen_reg_rtx (DImode);
5865 emit_insn (gen_fctiwuz_<mode> (tmp, src));
5868 dest = rs6000_address_for_fpconvert (dest);
5869 emit_insn (gen_stfiwx (dest, tmp));
5872 else if (TARGET_POWERPC64 && (TARGET_MFPGPR || TARGET_DIRECT_MOVE))
5874 dest = gen_lowpart (DImode, dest);
5875 emit_move_insn (dest, tmp);
5880 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
5881 emit_insn (gen_stfiwx (stack, tmp));
5882 emit_move_insn (dest, stack);
5886 [(set_attr "length" "12")
5887 (set_attr "type" "fp")])
5889 (define_expand "fixuns_trunc<mode>di2"
5890 [(set (match_operand:DI 0 "register_operand" "")
5891 (unsigned_fix:DI (match_operand:SFDF 1 "register_operand" "")))]
5892 "TARGET_HARD_FLOAT && (TARGET_FCTIDUZ || VECTOR_UNIT_VSX_P (<MODE>mode))"
5895 (define_insn "*fixuns_trunc<mode>di2_fctiduz"
5896 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
5897 (unsigned_fix:DI (match_operand:SFDF 1 "gpc_reg_operand" "d")))]
5898 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
5899 && TARGET_FCTIDUZ && !VECTOR_UNIT_VSX_P (<MODE>mode)"
5901 [(set_attr "type" "fp")])
5903 ; Here, we use (set (reg) (unspec:DI [(fix:SI ...)] UNSPEC_FCTIWZ))
5904 ; rather than (set (subreg:SI (reg)) (fix:SI ...))
5905 ; because the first makes it clear that operand 0 is not live
5906 ; before the instruction.
5907 (define_insn "fctiwz_<mode>"
5908 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
5909 (unspec:DI [(fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d"))]
5911 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5913 [(set_attr "type" "fp")])
5915 (define_insn "fctiwuz_<mode>"
5916 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
5917 (unspec:DI [(unsigned_fix:SI
5918 (match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>"))]
5920 "TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT> && TARGET_FCTIWUZ"
5922 [(set_attr "type" "fp")])
5924 ;; Only optimize (float (fix x)) -> frz if we are in fast-math mode, since
5925 ;; since the friz instruction does not truncate the value if the floating
5926 ;; point value is < LONG_MIN or > LONG_MAX.
5927 (define_insn "*friz"
5928 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
5929 (float:DF (fix:DI (match_operand:DF 1 "gpc_reg_operand" "d"))))]
5930 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_FPRND
5931 && !VECTOR_UNIT_VSX_P (DFmode) && flag_unsafe_math_optimizations
5932 && !flag_trapping_math && TARGET_FRIZ"
5934 [(set_attr "type" "fp")])
5936 ;; Since FCTIWZ doesn't sign extend the upper bits, we have to do a store and a
5937 ;; load to properly sign extend the value, but at least doing a store, load
5938 ;; into a GPR to sign extend, a store from the GPR and a load back into the FPR
5939 ;; if we have 32-bit memory ops
5940 (define_insn_and_split "*round32<mode>2_fprs"
5941 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d")
5943 (fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d"))))
5944 (clobber (match_scratch:DI 2 "=d"))
5945 (clobber (match_scratch:DI 3 "=d"))]
5946 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5947 && <SI_CONVERT_FP> && TARGET_LFIWAX && TARGET_STFIWX && TARGET_FCFID
5948 && can_create_pseudo_p ()"
5953 rtx dest = operands[0];
5954 rtx src = operands[1];
5955 rtx tmp1 = operands[2];
5956 rtx tmp2 = operands[3];
5957 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
5959 if (GET_CODE (tmp1) == SCRATCH)
5960 tmp1 = gen_reg_rtx (DImode);
5961 if (GET_CODE (tmp2) == SCRATCH)
5962 tmp2 = gen_reg_rtx (DImode);
5964 emit_insn (gen_fctiwz_<mode> (tmp1, src));
5965 emit_insn (gen_stfiwx (stack, tmp1));
5966 emit_insn (gen_lfiwax (tmp2, stack));
5967 emit_insn (gen_floatdi<mode>2 (dest, tmp2));
5970 [(set_attr "type" "fpload")
5971 (set_attr "length" "16")])
5973 (define_insn_and_split "*roundu32<mode>2_fprs"
5974 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d")
5975 (unsigned_float:SFDF
5976 (unsigned_fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d"))))
5977 (clobber (match_scratch:DI 2 "=d"))
5978 (clobber (match_scratch:DI 3 "=d"))]
5979 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5980 && TARGET_LFIWZX && TARGET_STFIWX && TARGET_FCFIDU
5981 && can_create_pseudo_p ()"
5986 rtx dest = operands[0];
5987 rtx src = operands[1];
5988 rtx tmp1 = operands[2];
5989 rtx tmp2 = operands[3];
5990 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
5992 if (GET_CODE (tmp1) == SCRATCH)
5993 tmp1 = gen_reg_rtx (DImode);
5994 if (GET_CODE (tmp2) == SCRATCH)
5995 tmp2 = gen_reg_rtx (DImode);
5997 emit_insn (gen_fctiwuz_<mode> (tmp1, src));
5998 emit_insn (gen_stfiwx (stack, tmp1));
5999 emit_insn (gen_lfiwzx (tmp2, stack));
6000 emit_insn (gen_floatdi<mode>2 (dest, tmp2));
6003 [(set_attr "type" "fpload")
6004 (set_attr "length" "16")])
6006 ;; No VSX equivalent to fctid
6007 (define_insn "lrint<mode>di2"
6008 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6009 (unspec:DI [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
6011 "TARGET_<MODE>_FPR && TARGET_FPRND"
6013 [(set_attr "type" "fp")])
6015 (define_insn "btrunc<mode>2"
6016 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
6017 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")]
6019 "TARGET_<MODE>_FPR && TARGET_FPRND"
6023 [(set_attr "type" "fp")
6024 (set_attr "fp_type" "fp_addsub_<Fs>")])
6026 (define_insn "ceil<mode>2"
6027 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
6028 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")]
6030 "TARGET_<MODE>_FPR && TARGET_FPRND"
6034 [(set_attr "type" "fp")
6035 (set_attr "fp_type" "fp_addsub_<Fs>")])
6037 (define_insn "floor<mode>2"
6038 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
6039 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")]
6041 "TARGET_<MODE>_FPR && TARGET_FPRND"
6045 [(set_attr "type" "fp")
6046 (set_attr "fp_type" "fp_addsub_<Fs>")])
6048 ;; No VSX equivalent to frin
6049 (define_insn "round<mode>2"
6050 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
6051 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
6053 "TARGET_<MODE>_FPR && TARGET_FPRND"
6055 [(set_attr "type" "fp")
6056 (set_attr "fp_type" "fp_addsub_<Fs>")])
6058 ; An UNSPEC is used so we don't have to support SImode in FP registers.
6059 (define_insn "stfiwx"
6060 [(set (match_operand:SI 0 "memory_operand" "=Z")
6061 (unspec:SI [(match_operand:DI 1 "gpc_reg_operand" "d")]
6065 [(set_attr "type" "fpstore")])
6067 ;; If we don't have a direct conversion to single precision, don't enable this
6068 ;; conversion for 32-bit without fast math, because we don't have the insn to
6069 ;; generate the fixup swizzle to avoid double rounding problems.
6070 (define_expand "floatsisf2"
6071 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6072 (float:SF (match_operand:SI 1 "nonimmediate_operand" "")))]
6073 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT
6076 && ((TARGET_FCFIDS && TARGET_LFIWAX)
6077 || (TARGET_DOUBLE_FLOAT && TARGET_FCFID
6078 && (TARGET_POWERPC64 || flag_unsafe_math_optimizations)))))"
6083 if (!REG_P (operands[1]))
6084 operands[1] = force_reg (SImode, operands[1]);
6086 else if (TARGET_FCFIDS && TARGET_LFIWAX)
6088 emit_insn (gen_floatsisf2_lfiwax (operands[0], operands[1]));
6091 else if (TARGET_FCFID && TARGET_LFIWAX)
6093 rtx dfreg = gen_reg_rtx (DFmode);
6094 emit_insn (gen_floatsidf2_lfiwax (dfreg, operands[1]));
6095 emit_insn (gen_truncdfsf2 (operands[0], dfreg));
6100 rtx dreg = operands[1];
6102 dreg = force_reg (SImode, dreg);
6103 dreg = convert_to_mode (DImode, dreg, false);
6104 emit_insn (gen_floatdisf2 (operands[0], dreg));
6109 (define_expand "floatdidf2"
6110 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6111 (float:DF (match_operand:DI 1 "gpc_reg_operand" "")))]
6112 "TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS"
6115 (define_insn "*floatdidf2_fpr"
6116 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6117 (float:DF (match_operand:DI 1 "gpc_reg_operand" "d")))]
6118 "TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
6119 && !VECTOR_UNIT_VSX_P (DFmode)"
6121 [(set_attr "type" "fp")])
6123 ; Allow the combiner to merge source memory operands to the conversion so that
6124 ; the optimizer/register allocator doesn't try to load the value too early in a
6125 ; GPR and then use store/load to move it to a FPR and suffer from a store-load
6126 ; hit. We will split after reload to avoid the trip through the GPRs
6128 (define_insn_and_split "*floatdidf2_mem"
6129 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6130 (float:DF (match_operand:DI 1 "memory_operand" "m")))
6131 (clobber (match_scratch:DI 2 "=d"))]
6132 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS && TARGET_FCFID"
6134 "&& reload_completed"
6135 [(set (match_dup 2) (match_dup 1))
6136 (set (match_dup 0) (float:DF (match_dup 2)))]
6138 [(set_attr "length" "8")
6139 (set_attr "type" "fpload")])
6141 (define_expand "floatunsdidf2"
6142 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6144 (match_operand:DI 1 "gpc_reg_operand" "")))]
6145 "TARGET_HARD_FLOAT && (TARGET_FCFIDU || VECTOR_UNIT_VSX_P (DFmode))"
6148 (define_insn "*floatunsdidf2_fcfidu"
6149 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6150 (unsigned_float:DF (match_operand:DI 1 "gpc_reg_operand" "d")))]
6151 "TARGET_HARD_FLOAT && TARGET_FCFIDU && !VECTOR_UNIT_VSX_P (DFmode)"
6153 [(set_attr "type" "fp")
6154 (set_attr "length" "4")])
6156 (define_insn_and_split "*floatunsdidf2_mem"
6157 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6158 (unsigned_float:DF (match_operand:DI 1 "memory_operand" "m")))
6159 (clobber (match_scratch:DI 2 "=d"))]
6160 "TARGET_HARD_FLOAT && (TARGET_FCFIDU || VECTOR_UNIT_VSX_P (DFmode))"
6162 "&& reload_completed"
6163 [(set (match_dup 2) (match_dup 1))
6164 (set (match_dup 0) (unsigned_float:DF (match_dup 2)))]
6166 [(set_attr "length" "8")
6167 (set_attr "type" "fpload")])
6169 (define_expand "floatdisf2"
6170 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6171 (float:SF (match_operand:DI 1 "gpc_reg_operand" "")))]
6172 "TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
6173 && (TARGET_FCFIDS || TARGET_POWERPC64 || flag_unsafe_math_optimizations)"
6178 rtx val = operands[1];
6179 if (!flag_unsafe_math_optimizations)
6181 rtx label = gen_label_rtx ();
6182 val = gen_reg_rtx (DImode);
6183 emit_insn (gen_floatdisf2_internal2 (val, operands[1], label));
6186 emit_insn (gen_floatdisf2_internal1 (operands[0], val));
6191 (define_insn "floatdisf2_fcfids"
6192 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6193 (float:SF (match_operand:DI 1 "gpc_reg_operand" "d")))]
6194 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
6195 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDS"
6197 [(set_attr "type" "fp")])
6199 (define_insn_and_split "*floatdisf2_mem"
6200 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6201 (float:SF (match_operand:DI 1 "memory_operand" "m")))
6202 (clobber (match_scratch:DI 2 "=f"))]
6203 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
6204 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDS"
6206 "&& reload_completed"
6210 emit_move_insn (operands[2], operands[1]);
6211 emit_insn (gen_floatdisf2_fcfids (operands[0], operands[2]));
6214 [(set_attr "length" "8")])
6216 ;; This is not IEEE compliant if rounding mode is "round to nearest".
6217 ;; If the DI->DF conversion is inexact, then it's possible to suffer
6218 ;; from double rounding.
6219 ;; Instead of creating a new cpu type for two FP operations, just use fp
6220 (define_insn_and_split "floatdisf2_internal1"
6221 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6222 (float:SF (match_operand:DI 1 "gpc_reg_operand" "d")))
6223 (clobber (match_scratch:DF 2 "=d"))]
6224 "TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
6226 "&& reload_completed"
6228 (float:DF (match_dup 1)))
6230 (float_truncate:SF (match_dup 2)))]
6232 [(set_attr "length" "8")
6233 (set_attr "type" "fp")])
6235 ;; Twiddles bits to avoid double rounding.
6236 ;; Bits that might be truncated when converting to DFmode are replaced
6237 ;; by a bit that won't be lost at that stage, but is below the SFmode
6238 ;; rounding position.
6239 (define_expand "floatdisf2_internal2"
6240 [(set (match_dup 3) (ashiftrt:DI (match_operand:DI 1 "" "")
6242 (set (match_operand:DI 0 "" "") (and:DI (match_dup 1)
6244 (set (match_dup 3) (plus:DI (match_dup 3)
6246 (set (match_dup 0) (plus:DI (match_dup 0)
6248 (set (match_dup 4) (compare:CCUNS (match_dup 3)
6250 (set (match_dup 0) (ior:DI (match_dup 0)
6252 (set (match_dup 0) (and:DI (match_dup 0)
6254 (set (pc) (if_then_else (geu (match_dup 4) (const_int 0))
6255 (label_ref (match_operand:DI 2 "" ""))
6257 (set (match_dup 0) (match_dup 1))]
6258 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
6261 operands[3] = gen_reg_rtx (DImode);
6262 operands[4] = gen_reg_rtx (CCUNSmode);
6265 (define_expand "floatunsdisf2"
6266 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6267 (unsigned_float:SF (match_operand:DI 1 "gpc_reg_operand" "")))]
6268 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
6269 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDUS"
6272 (define_insn "floatunsdisf2_fcfidus"
6273 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6274 (unsigned_float:SF (match_operand:DI 1 "gpc_reg_operand" "d")))]
6275 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
6276 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDUS"
6278 [(set_attr "type" "fp")])
6280 (define_insn_and_split "*floatunsdisf2_mem"
6281 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6282 (unsigned_float:SF (match_operand:DI 1 "memory_operand" "m")))
6283 (clobber (match_scratch:DI 2 "=f"))]
6284 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
6285 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDUS"
6287 "&& reload_completed"
6291 emit_move_insn (operands[2], operands[1]);
6292 emit_insn (gen_floatunsdisf2_fcfidus (operands[0], operands[2]));
6295 [(set_attr "length" "8")
6296 (set_attr "type" "fpload")])
6298 ;; Define the TImode operations that can be done in a small number
6299 ;; of instructions. The & constraints are to prevent the register
6300 ;; allocator from allocating registers that overlap with the inputs
6301 ;; (for example, having an input in 7,8 and an output in 6,7). We
6302 ;; also allow for the output being the same as one of the inputs.
6304 (define_insn "addti3"
6305 [(set (match_operand:TI 0 "gpc_reg_operand" "=&r,&r,r,r")
6306 (plus:TI (match_operand:TI 1 "gpc_reg_operand" "%r,r,0,0")
6307 (match_operand:TI 2 "reg_or_short_operand" "r,I,r,I")))]
6310 if (WORDS_BIG_ENDIAN)
6311 return (GET_CODE (operands[2])) != CONST_INT
6312 ? \"addc %L0,%L1,%L2\;adde %0,%1,%2\"
6313 : \"addic %L0,%L1,%2\;add%G2e %0,%1\";
6315 return (GET_CODE (operands[2])) != CONST_INT
6316 ? \"addc %0,%1,%2\;adde %L0,%L1,%L2\"
6317 : \"addic %0,%1,%2\;add%G2e %L0,%L1\";
6319 [(set_attr "type" "two")
6320 (set_attr "length" "8")])
6322 (define_insn "subti3"
6323 [(set (match_operand:TI 0 "gpc_reg_operand" "=&r,&r,r,r,r")
6324 (minus:TI (match_operand:TI 1 "reg_or_short_operand" "r,I,0,r,I")
6325 (match_operand:TI 2 "gpc_reg_operand" "r,r,r,0,0")))]
6328 if (WORDS_BIG_ENDIAN)
6329 return (GET_CODE (operands[1]) != CONST_INT)
6330 ? \"subfc %L0,%L2,%L1\;subfe %0,%2,%1\"
6331 : \"subfic %L0,%L2,%1\;subf%G1e %0,%2\";
6333 return (GET_CODE (operands[1]) != CONST_INT)
6334 ? \"subfc %0,%2,%1\;subfe %L0,%L2,%L1\"
6335 : \"subfic %0,%2,%1\;subf%G1e %L0,%L2\";
6337 [(set_attr "type" "two")
6338 (set_attr "length" "8")])
6341 ;; Define the DImode operations that can be done in a small number
6342 ;; of instructions. The & constraints are to prevent the register
6343 ;; allocator from allocating registers that overlap with the inputs
6344 ;; (for example, having an input in 7,8 and an output in 6,7). We
6345 ;; also allow for the output being the same as one of the inputs.
6347 (define_insn "*adddi3_noppc64"
6348 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r")
6349 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,0,0")
6350 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I")))]
6351 "! TARGET_POWERPC64"
6354 if (WORDS_BIG_ENDIAN)
6355 return (GET_CODE (operands[2])) != CONST_INT
6356 ? \"addc %L0,%L1,%L2\;adde %0,%1,%2\"
6357 : \"addic %L0,%L1,%2\;add%G2e %0,%1\";
6359 return (GET_CODE (operands[2])) != CONST_INT
6360 ? \"addc %0,%1,%2\;adde %L0,%L1,%L2\"
6361 : \"addic %0,%1,%2\;add%G2e %L0,%L1\";
6363 [(set_attr "type" "two")
6364 (set_attr "length" "8")])
6366 (define_insn "*subdi3_noppc64"
6367 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r,r")
6368 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I,0,r,I")
6369 (match_operand:DI 2 "gpc_reg_operand" "r,r,r,0,0")))]
6370 "! TARGET_POWERPC64"
6373 if (WORDS_BIG_ENDIAN)
6374 return (GET_CODE (operands[1]) != CONST_INT)
6375 ? \"subfc %L0,%L2,%L1\;subfe %0,%2,%1\"
6376 : \"subfic %L0,%L2,%1\;subf%G1e %0,%2\";
6378 return (GET_CODE (operands[1]) != CONST_INT)
6379 ? \"subfc %0,%2,%1\;subfe %L0,%L2,%L1\"
6380 : \"subfic %0,%2,%1\;subf%G1e %L0,%L2\";
6382 [(set_attr "type" "two")
6383 (set_attr "length" "8")])
6385 (define_insn "*negdi2_noppc64"
6386 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6387 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))]
6388 "! TARGET_POWERPC64"
6391 return (WORDS_BIG_ENDIAN)
6392 ? \"subfic %L0,%L1,0\;subfze %0,%1\"
6393 : \"subfic %0,%1,0\;subfze %L0,%L1\";
6395 [(set_attr "type" "two")
6396 (set_attr "length" "8")])
6399 ;; Shift by a variable amount is too complex to be worth open-coding. We
6400 ;; just handle shifts by constants.
6401 (define_insn "ashrdi3_no_power"
6402 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
6403 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6404 (match_operand:SI 2 "const_int_operand" "M,i")))]
6408 switch (which_alternative)
6413 if (WORDS_BIG_ENDIAN)
6414 return \"srawi %0,%1,31\;srawi %L0,%1,%h2\";
6416 return \"srawi %L0,%L1,31\;srawi %0,%L1,%h2\";
6418 if (WORDS_BIG_ENDIAN)
6419 return \"srwi %L0,%L1,%h2\;insrwi %L0,%1,%h2,0\;srawi %0,%1,%h2\";
6421 return \"srwi %0,%1,%h2\;insrwi %0,%L1,%h2,0\;srawi %L0,%L1,%h2\";
6424 [(set_attr "type" "two,three")
6425 (set_attr "length" "8,12")])
6427 (define_insn "*ashrdisi3_noppc64be"
6428 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6429 (subreg:SI (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6430 (const_int 32)) 4))]
6431 "TARGET_32BIT && !TARGET_POWERPC64 && WORDS_BIG_ENDIAN"
6434 if (REGNO (operands[0]) == REGNO (operands[1]))
6437 return \"mr %0,%1\";
6439 [(set_attr "length" "4")])
6442 ;; PowerPC64 DImode operations.
6444 (define_insn "*rotldi3_internal4"
6445 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6446 (and:DI (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6447 (match_operand:DI 2 "reg_or_cint_operand" "rn"))
6448 (match_operand:DI 3 "mask64_operand" "n")))]
6450 "rld%I2c%B3 %0,%1,%H2,%S3"
6451 [(set_attr "type" "shift")
6452 (set_attr "maybe_var_shift" "yes")])
6454 (define_insn "*rotldi3_internal5"
6455 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6457 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6458 (match_operand:DI 2 "reg_or_cint_operand" "rn,rn"))
6459 (match_operand:DI 3 "mask64_operand" "n,n"))
6461 (clobber (match_scratch:DI 4 "=r,r"))]
6464 rld%I2c%B3. %4,%1,%H2,%S3
6466 [(set_attr "type" "shift")
6467 (set_attr "maybe_var_shift" "yes")
6468 (set_attr "dot" "yes")
6469 (set_attr "length" "4,8")])
6472 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
6474 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6475 (match_operand:DI 2 "reg_or_cint_operand" ""))
6476 (match_operand:DI 3 "mask64_operand" ""))
6478 (clobber (match_scratch:DI 4 ""))]
6479 "TARGET_POWERPC64 && reload_completed"
6481 (and:DI (rotate:DI (match_dup 1)
6485 (compare:CC (match_dup 4)
6489 (define_insn "*rotldi3_internal6"
6490 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
6492 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6493 (match_operand:DI 2 "reg_or_cint_operand" "rn,rn"))
6494 (match_operand:DI 3 "mask64_operand" "n,n"))
6496 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6497 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6500 rld%I2c%B3. %0,%1,%H2,%S3
6502 [(set_attr "type" "shift")
6503 (set_attr "maybe_var_shift" "yes")
6504 (set_attr "dot" "yes")
6505 (set_attr "length" "4,8")])
6508 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
6510 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6511 (match_operand:DI 2 "reg_or_cint_operand" ""))
6512 (match_operand:DI 3 "mask64_operand" ""))
6514 (set (match_operand:DI 0 "gpc_reg_operand" "")
6515 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6516 "TARGET_POWERPC64 && reload_completed"
6518 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
6520 (compare:CC (match_dup 0)
6524 (define_insn "*rotldi3_internal7le"
6525 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6528 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6529 (match_operand:DI 2 "reg_or_cint_operand" "rn")) 0)))]
6530 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN"
6531 "rld%I2cl %0,%1,%H2,56"
6532 [(set_attr "type" "shift")
6533 (set_attr "maybe_var_shift" "yes")])
6535 (define_insn "*rotldi3_internal7be"
6536 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6539 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6540 (match_operand:DI 2 "reg_or_cint_operand" "rn")) 7)))]
6541 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN"
6542 "rld%I2cl %0,%1,%H2,56"
6543 [(set_attr "type" "shift")
6544 (set_attr "maybe_var_shift" "yes")])
6546 (define_insn "*rotldi3_internal8le"
6547 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6548 (compare:CC (zero_extend:DI
6550 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6551 (match_operand:DI 2 "reg_or_cint_operand" "rn,rn")) 0))
6553 (clobber (match_scratch:DI 3 "=r,r"))]
6554 "TARGET_64BIT && !BYTES_BIG_ENDIAN"
6556 rld%I2cl. %3,%1,%H2,56
6558 [(set_attr "type" "shift")
6559 (set_attr "maybe_var_shift" "yes")
6560 (set_attr "dot" "yes")
6561 (set_attr "length" "4,8")])
6563 (define_insn "*rotldi3_internal8be"
6564 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6565 (compare:CC (zero_extend:DI
6567 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6568 (match_operand:DI 2 "reg_or_cint_operand" "rn,rn")) 7))
6570 (clobber (match_scratch:DI 3 "=r,r"))]
6571 "TARGET_64BIT && BYTES_BIG_ENDIAN"
6573 rld%I2cl. %3,%1,%H2,56
6575 [(set_attr "type" "shift")
6576 (set_attr "maybe_var_shift" "yes")
6577 (set_attr "dot" "yes")
6578 (set_attr "length" "4,8")])
6581 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
6582 (compare:CC (zero_extend:DI
6584 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6585 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6587 (clobber (match_scratch:DI 3 ""))]
6588 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN && reload_completed"
6590 (zero_extend:DI (subreg:QI
6591 (rotate:DI (match_dup 1)
6594 (compare:CC (match_dup 3)
6599 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
6600 (compare:CC (zero_extend:DI
6602 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6603 (match_operand:DI 2 "reg_or_cint_operand" "")) 7))
6605 (clobber (match_scratch:DI 3 ""))]
6606 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN && reload_completed"
6608 (zero_extend:DI (subreg:QI
6609 (rotate:DI (match_dup 1)
6612 (compare:CC (match_dup 3)
6616 (define_insn "*rotldi3_internal9le"
6617 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6618 (compare:CC (zero_extend:DI
6620 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6621 (match_operand:DI 2 "reg_or_cint_operand" "rn,rn")) 0))
6623 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6624 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6625 "TARGET_64BIT && !BYTES_BIG_ENDIAN"
6627 rld%I2cl. %0,%1,%H2,56
6629 [(set_attr "type" "shift")
6630 (set_attr "maybe_var_shift" "yes")
6631 (set_attr "dot" "yes")
6632 (set_attr "length" "4,8")])
6634 (define_insn "*rotldi3_internal9be"
6635 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6636 (compare:CC (zero_extend:DI
6638 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6639 (match_operand:DI 2 "reg_or_cint_operand" "rn,rn")) 7))
6641 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6642 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 7)))]
6643 "TARGET_64BIT && BYTES_BIG_ENDIAN"
6645 rld%I2cl. %0,%1,%H2,56
6647 [(set_attr "type" "shift")
6648 (set_attr "maybe_var_shift" "yes")
6649 (set_attr "dot" "yes")
6650 (set_attr "length" "4,8")])
6653 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
6654 (compare:CC (zero_extend:DI
6656 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6657 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6659 (set (match_operand:DI 0 "gpc_reg_operand" "")
6660 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6661 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN && reload_completed"
6663 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
6665 (compare:CC (match_dup 0)
6670 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
6671 (compare:CC (zero_extend:DI
6673 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6674 (match_operand:DI 2 "reg_or_cint_operand" "")) 7))
6676 (set (match_operand:DI 0 "gpc_reg_operand" "")
6677 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 7)))]
6678 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN && reload_completed"
6680 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 7)))
6682 (compare:CC (match_dup 0)
6686 (define_insn "*rotldi3_internal10le"
6687 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6690 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6691 (match_operand:DI 2 "reg_or_cint_operand" "rn")) 0)))]
6692 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN"
6693 "rld%I2cl %0,%1,%H2,48"
6694 [(set_attr "type" "shift")
6695 (set_attr "maybe_var_shift" "yes")])
6697 (define_insn "*rotldi3_internal10be"
6698 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6701 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6702 (match_operand:DI 2 "reg_or_cint_operand" "rn")) 6)))]
6703 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN"
6704 "rld%I2cl %0,%1,%H2,48"
6705 [(set_attr "type" "shift")
6706 (set_attr "maybe_var_shift" "yes")])
6708 (define_insn "*rotldi3_internal11le"
6709 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6710 (compare:CC (zero_extend:DI
6712 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6713 (match_operand:DI 2 "reg_or_cint_operand" "rn,rn")) 0))
6715 (clobber (match_scratch:DI 3 "=r,r"))]
6716 "TARGET_64BIT && !BYTES_BIG_ENDIAN"
6718 rld%I2cl. %3,%1,%H2,48
6720 [(set_attr "type" "shift")
6721 (set_attr "maybe_var_shift" "yes")
6722 (set_attr "dot" "yes")
6723 (set_attr "length" "4,8")])
6725 (define_insn "*rotldi3_internal11be"
6726 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6727 (compare:CC (zero_extend:DI
6729 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6730 (match_operand:DI 2 "reg_or_cint_operand" "rn,rn")) 6))
6732 (clobber (match_scratch:DI 3 "=r,r"))]
6733 "TARGET_64BIT && BYTES_BIG_ENDIAN"
6735 rld%I2cl. %3,%1,%H2,48
6737 [(set_attr "type" "shift")
6738 (set_attr "maybe_var_shift" "yes")
6739 (set_attr "dot" "yes")
6740 (set_attr "length" "4,8")])
6743 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
6744 (compare:CC (zero_extend:DI
6746 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6747 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6749 (clobber (match_scratch:DI 3 ""))]
6750 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN && reload_completed"
6752 (zero_extend:DI (subreg:HI
6753 (rotate:DI (match_dup 1)
6756 (compare:CC (match_dup 3)
6761 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
6762 (compare:CC (zero_extend:DI
6764 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6765 (match_operand:DI 2 "reg_or_cint_operand" "")) 6))
6767 (clobber (match_scratch:DI 3 ""))]
6768 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN && reload_completed"
6770 (zero_extend:DI (subreg:HI
6771 (rotate:DI (match_dup 1)
6774 (compare:CC (match_dup 3)
6778 (define_insn "*rotldi3_internal12le"
6779 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6780 (compare:CC (zero_extend:DI
6782 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6783 (match_operand:DI 2 "reg_or_cint_operand" "rn,rn")) 0))
6785 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6786 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6787 "TARGET_64BIT && !BYTES_BIG_ENDIAN"
6789 rld%I2cl. %0,%1,%H2,48
6791 [(set_attr "type" "shift")
6792 (set_attr "maybe_var_shift" "yes")
6793 (set_attr "dot" "yes")
6794 (set_attr "length" "4,8")])
6796 (define_insn "*rotldi3_internal12be"
6797 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6798 (compare:CC (zero_extend:DI
6800 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6801 (match_operand:DI 2 "reg_or_cint_operand" "rn,rn")) 6))
6803 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6804 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 6)))]
6805 "TARGET_64BIT && BYTES_BIG_ENDIAN"
6807 rld%I2cl. %0,%1,%H2,48
6809 [(set_attr "type" "shift")
6810 (set_attr "maybe_var_shift" "yes")
6811 (set_attr "dot" "yes")
6812 (set_attr "length" "4,8")])
6815 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
6816 (compare:CC (zero_extend:DI
6818 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6819 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6821 (set (match_operand:DI 0 "gpc_reg_operand" "")
6822 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6823 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN && reload_completed"
6825 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
6827 (compare:CC (match_dup 0)
6832 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
6833 (compare:CC (zero_extend:DI
6835 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6836 (match_operand:DI 2 "reg_or_cint_operand" "")) 6))
6838 (set (match_operand:DI 0 "gpc_reg_operand" "")
6839 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 6)))]
6840 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN && reload_completed"
6842 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 6)))
6844 (compare:CC (match_dup 0)
6848 (define_insn "*rotldi3_internal13le"
6849 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6852 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6853 (match_operand:DI 2 "reg_or_cint_operand" "rn")) 0)))]
6854 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN"
6855 "rld%I2cl %0,%1,%H2,32"
6856 [(set_attr "type" "shift")
6857 (set_attr "maybe_var_shift" "yes")])
6859 (define_insn "*rotldi3_internal13be"
6860 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6863 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6864 (match_operand:DI 2 "reg_or_cint_operand" "rn")) 4)))]
6865 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN"
6866 "rld%I2cl %0,%1,%H2,32"
6867 [(set_attr "type" "shift")
6868 (set_attr "maybe_var_shift" "yes")])
6870 (define_insn "*rotldi3_internal14le"
6871 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6872 (compare:CC (zero_extend:DI
6874 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6875 (match_operand:DI 2 "reg_or_cint_operand" "rn,rn")) 0))
6877 (clobber (match_scratch:DI 3 "=r,r"))]
6878 "TARGET_64BIT && !BYTES_BIG_ENDIAN"
6880 rld%I2cl. %3,%1,%H2,32
6882 [(set_attr "type" "shift")
6883 (set_attr "maybe_var_shift" "yes")
6884 (set_attr "dot" "yes")
6885 (set_attr "length" "4,8")])
6887 (define_insn "*rotldi3_internal14be"
6888 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6889 (compare:CC (zero_extend:DI
6891 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6892 (match_operand:DI 2 "reg_or_cint_operand" "rn,rn")) 4))
6894 (clobber (match_scratch:DI 3 "=r,r"))]
6895 "TARGET_64BIT && BYTES_BIG_ENDIAN"
6897 rld%I2cl. %3,%1,%H2,32
6899 [(set_attr "type" "shift")
6900 (set_attr "maybe_var_shift" "yes")
6901 (set_attr "dot" "yes")
6902 (set_attr "length" "4,8")])
6905 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
6906 (compare:CC (zero_extend:DI
6908 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6909 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6911 (clobber (match_scratch:DI 3 ""))]
6912 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN && reload_completed"
6914 (zero_extend:DI (subreg:SI
6915 (rotate:DI (match_dup 1)
6918 (compare:CC (match_dup 3)
6923 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
6924 (compare:CC (zero_extend:DI
6926 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6927 (match_operand:DI 2 "reg_or_cint_operand" "")) 4))
6929 (clobber (match_scratch:DI 3 ""))]
6930 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN && reload_completed"
6932 (zero_extend:DI (subreg:SI
6933 (rotate:DI (match_dup 1)
6936 (compare:CC (match_dup 3)
6940 (define_insn "*rotldi3_internal15le"
6941 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6942 (compare:CC (zero_extend:DI
6944 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6945 (match_operand:DI 2 "reg_or_cint_operand" "rn,rn")) 0))
6947 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6948 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6949 "TARGET_64BIT && !BYTES_BIG_ENDIAN"
6951 rld%I2cl. %0,%1,%H2,32
6953 [(set_attr "type" "shift")
6954 (set_attr "maybe_var_shift" "yes")
6955 (set_attr "dot" "yes")
6956 (set_attr "length" "4,8")])
6958 (define_insn "*rotldi3_internal15be"
6959 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6960 (compare:CC (zero_extend:DI
6962 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6963 (match_operand:DI 2 "reg_or_cint_operand" "rn,rn")) 4))
6965 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6966 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 4)))]
6967 "TARGET_64BIT && BYTES_BIG_ENDIAN"
6969 rld%I2cl. %0,%1,%H2,32
6971 [(set_attr "type" "shift")
6972 (set_attr "maybe_var_shift" "yes")
6973 (set_attr "dot" "yes")
6974 (set_attr "length" "4,8")])
6977 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
6978 (compare:CC (zero_extend:DI
6980 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6981 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6983 (set (match_operand:DI 0 "gpc_reg_operand" "")
6984 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6985 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN && reload_completed"
6987 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
6989 (compare:CC (match_dup 0)
6994 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
6995 (compare:CC (zero_extend:DI
6997 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6998 (match_operand:DI 2 "reg_or_cint_operand" "")) 4))
7000 (set (match_operand:DI 0 "gpc_reg_operand" "")
7001 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 4)))]
7002 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN && reload_completed"
7004 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 4)))
7006 (compare:CC (match_dup 0)
7010 (define_insn "*ashldi3_internal4"
7011 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7012 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7013 (match_operand:SI 2 "const_int_operand" "i"))
7014 (match_operand:DI 3 "const_int_operand" "n")))]
7015 "TARGET_POWERPC64 && includes_rldic_lshift_p (operands[2], operands[3])"
7016 "rldic %0,%1,%H2,%W3"
7017 [(set_attr "type" "shift")])
7019 (define_insn "ashldi3_internal5"
7020 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7022 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7023 (match_operand:SI 2 "const_int_operand" "i,i"))
7024 (match_operand:DI 3 "const_int_operand" "n,n"))
7026 (clobber (match_scratch:DI 4 "=r,r"))]
7027 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
7029 rldic. %4,%1,%H2,%W3
7031 [(set_attr "type" "shift")
7032 (set_attr "dot" "yes")
7033 (set_attr "length" "4,8")])
7036 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7038 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7039 (match_operand:SI 2 "const_int_operand" ""))
7040 (match_operand:DI 3 "const_int_operand" ""))
7042 (clobber (match_scratch:DI 4 ""))]
7043 "TARGET_POWERPC64 && reload_completed
7044 && includes_rldic_lshift_p (operands[2], operands[3])"
7046 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7049 (compare:CC (match_dup 4)
7053 (define_insn "*ashldi3_internal6"
7054 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
7056 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7057 (match_operand:SI 2 "const_int_operand" "i,i"))
7058 (match_operand:DI 3 "const_int_operand" "n,n"))
7060 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7061 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7062 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
7064 rldic. %0,%1,%H2,%W3
7066 [(set_attr "type" "shift")
7067 (set_attr "dot" "yes")
7068 (set_attr "length" "4,8")])
7071 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
7073 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7074 (match_operand:SI 2 "const_int_operand" ""))
7075 (match_operand:DI 3 "const_int_operand" ""))
7077 (set (match_operand:DI 0 "gpc_reg_operand" "")
7078 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7079 "TARGET_POWERPC64 && reload_completed
7080 && includes_rldic_lshift_p (operands[2], operands[3])"
7082 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7085 (compare:CC (match_dup 0)
7089 (define_insn "*ashldi3_internal7"
7090 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7091 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7092 (match_operand:SI 2 "const_int_operand" "i"))
7093 (match_operand:DI 3 "mask64_operand" "n")))]
7094 "TARGET_POWERPC64 && includes_rldicr_lshift_p (operands[2], operands[3])"
7095 "rldicr %0,%1,%H2,%S3"
7096 [(set_attr "type" "shift")])
7098 (define_insn "ashldi3_internal8"
7099 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7101 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7102 (match_operand:SI 2 "const_int_operand" "i,i"))
7103 (match_operand:DI 3 "mask64_operand" "n,n"))
7105 (clobber (match_scratch:DI 4 "=r,r"))]
7106 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
7108 rldicr. %4,%1,%H2,%S3
7110 [(set_attr "type" "shift")
7111 (set_attr "dot" "yes")
7112 (set_attr "length" "4,8")])
7115 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7117 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7118 (match_operand:SI 2 "const_int_operand" ""))
7119 (match_operand:DI 3 "mask64_operand" ""))
7121 (clobber (match_scratch:DI 4 ""))]
7122 "TARGET_POWERPC64 && reload_completed
7123 && includes_rldicr_lshift_p (operands[2], operands[3])"
7125 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7128 (compare:CC (match_dup 4)
7132 (define_insn "*ashldi3_internal9"
7133 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
7135 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7136 (match_operand:SI 2 "const_int_operand" "i,i"))
7137 (match_operand:DI 3 "mask64_operand" "n,n"))
7139 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7140 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7141 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
7143 rldicr. %0,%1,%H2,%S3
7145 [(set_attr "type" "shift")
7146 (set_attr "dot" "yes")
7147 (set_attr "length" "4,8")])
7150 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
7152 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7153 (match_operand:SI 2 "const_int_operand" ""))
7154 (match_operand:DI 3 "mask64_operand" ""))
7156 (set (match_operand:DI 0 "gpc_reg_operand" "")
7157 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7158 "TARGET_POWERPC64 && reload_completed
7159 && includes_rldicr_lshift_p (operands[2], operands[3])"
7161 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7164 (compare:CC (match_dup 0)
7169 (define_insn_and_split "*anddi3_2rld"
7170 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7171 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
7172 (match_operand:DI 2 "and_2rld_operand" "n")))]
7177 (and:DI (rotate:DI (match_dup 1)
7181 (and:DI (rotate:DI (match_dup 0)
7185 build_mask64_2_operands (operands[2], &operands[4]);
7187 [(set_attr "length" "8")])
7189 (define_insn_and_split "*anddi3_2rld_dot"
7190 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7191 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
7192 (match_operand:DI 2 "and_2rld_operand" "n,n"))
7194 (clobber (match_scratch:DI 0 "=r,r"))]
7195 "TARGET_64BIT && rs6000_gen_cell_microcode"
7199 "&& reload_completed"
7201 (and:DI (rotate:DI (match_dup 1)
7204 (parallel [(set (match_dup 3)
7205 (compare:CC (and:DI (rotate:DI (match_dup 0)
7209 (clobber (match_dup 0))])]
7211 build_mask64_2_operands (operands[2], &operands[4]);
7213 [(set_attr "type" "compare")
7214 (set_attr "dot" "yes")
7215 (set_attr "length" "8,12")])
7217 (define_insn_and_split "*anddi3_2rld_dot2"
7218 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7219 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
7220 (match_operand:DI 2 "and_2rld_operand" "n,n"))
7222 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7223 (and:DI (match_dup 1)
7225 "TARGET_64BIT && rs6000_gen_cell_microcode"
7229 "&& reload_completed"
7231 (and:DI (rotate:DI (match_dup 1)
7234 (parallel [(set (match_dup 3)
7235 (compare:CC (and:DI (rotate:DI (match_dup 0)
7240 (and:DI (rotate:DI (match_dup 0)
7244 build_mask64_2_operands (operands[2], &operands[4]);
7246 [(set_attr "type" "compare")
7247 (set_attr "dot" "yes")
7248 (set_attr "length" "8,12")])
7250 ;; 128-bit logical operations expanders
7252 (define_expand "and<mode>3"
7253 [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
7254 (and:BOOL_128 (match_operand:BOOL_128 1 "vlogical_operand" "")
7255 (match_operand:BOOL_128 2 "vlogical_operand" "")))]
7259 (define_expand "ior<mode>3"
7260 [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
7261 (ior:BOOL_128 (match_operand:BOOL_128 1 "vlogical_operand" "")
7262 (match_operand:BOOL_128 2 "vlogical_operand" "")))]
7266 (define_expand "xor<mode>3"
7267 [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
7268 (xor:BOOL_128 (match_operand:BOOL_128 1 "vlogical_operand" "")
7269 (match_operand:BOOL_128 2 "vlogical_operand" "")))]
7273 (define_expand "one_cmpl<mode>2"
7274 [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
7275 (not:BOOL_128 (match_operand:BOOL_128 1 "vlogical_operand" "")))]
7279 (define_expand "nor<mode>3"
7280 [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
7282 (not:BOOL_128 (match_operand:BOOL_128 1 "vlogical_operand" ""))
7283 (not:BOOL_128 (match_operand:BOOL_128 2 "vlogical_operand" ""))))]
7287 (define_expand "andc<mode>3"
7288 [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
7290 (not:BOOL_128 (match_operand:BOOL_128 2 "vlogical_operand" ""))
7291 (match_operand:BOOL_128 1 "vlogical_operand" "")))]
7295 ;; Power8 vector logical instructions.
7296 (define_expand "eqv<mode>3"
7297 [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
7299 (xor:BOOL_128 (match_operand:BOOL_128 1 "vlogical_operand" "")
7300 (match_operand:BOOL_128 2 "vlogical_operand" ""))))]
7301 "<MODE>mode == TImode || <MODE>mode == PTImode || TARGET_P8_VECTOR"
7304 ;; Rewrite nand into canonical form
7305 (define_expand "nand<mode>3"
7306 [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
7308 (not:BOOL_128 (match_operand:BOOL_128 1 "vlogical_operand" ""))
7309 (not:BOOL_128 (match_operand:BOOL_128 2 "vlogical_operand" ""))))]
7310 "<MODE>mode == TImode || <MODE>mode == PTImode || TARGET_P8_VECTOR"
7313 ;; The canonical form is to have the negated element first, so we need to
7314 ;; reverse arguments.
7315 (define_expand "orc<mode>3"
7316 [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
7318 (not:BOOL_128 (match_operand:BOOL_128 2 "vlogical_operand" ""))
7319 (match_operand:BOOL_128 1 "vlogical_operand" "")))]
7320 "<MODE>mode == TImode || <MODE>mode == PTImode || TARGET_P8_VECTOR"
7323 ;; 128-bit logical operations insns and split operations
7324 (define_insn_and_split "*and<mode>3_internal"
7325 [(set (match_operand:BOOL_128 0 "vlogical_operand" "=<BOOL_REGS_OUTPUT>")
7327 (match_operand:BOOL_128 1 "vlogical_operand" "%<BOOL_REGS_OP1>")
7328 (match_operand:BOOL_128 2 "vlogical_operand" "<BOOL_REGS_OP2>")))]
7331 if (TARGET_VSX && vsx_register_operand (operands[0], <MODE>mode))
7332 return "xxland %x0,%x1,%x2";
7334 if (TARGET_ALTIVEC && altivec_register_operand (operands[0], <MODE>mode))
7335 return "vand %0,%1,%2";
7339 "reload_completed && int_reg_operand (operands[0], <MODE>mode)"
7342 rs6000_split_logical (operands, AND, false, false, false);
7347 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
7348 (const_string "vecsimple")
7349 (const_string "integer")))
7350 (set (attr "length")
7352 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
7355 (match_test "TARGET_POWERPC64")
7357 (const_string "16"))))])
7360 (define_insn_and_split "*bool<mode>3_internal"
7361 [(set (match_operand:BOOL_128 0 "vlogical_operand" "=<BOOL_REGS_OUTPUT>")
7362 (match_operator:BOOL_128 3 "boolean_or_operator"
7363 [(match_operand:BOOL_128 1 "vlogical_operand" "%<BOOL_REGS_OP1>")
7364 (match_operand:BOOL_128 2 "vlogical_operand" "<BOOL_REGS_OP2>")]))]
7367 if (TARGET_VSX && vsx_register_operand (operands[0], <MODE>mode))
7368 return "xxl%q3 %x0,%x1,%x2";
7370 if (TARGET_ALTIVEC && altivec_register_operand (operands[0], <MODE>mode))
7371 return "v%q3 %0,%1,%2";
7375 "reload_completed && int_reg_operand (operands[0], <MODE>mode)"
7378 rs6000_split_logical (operands, GET_CODE (operands[3]), false, false, false);
7383 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
7384 (const_string "vecsimple")
7385 (const_string "integer")))
7386 (set (attr "length")
7388 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
7391 (match_test "TARGET_POWERPC64")
7393 (const_string "16"))))])
7396 (define_insn_and_split "*boolc<mode>3_internal1"
7397 [(set (match_operand:BOOL_128 0 "vlogical_operand" "=<BOOL_REGS_OUTPUT>")
7398 (match_operator:BOOL_128 3 "boolean_operator"
7400 (match_operand:BOOL_128 2 "vlogical_operand" "<BOOL_REGS_OP1>"))
7401 (match_operand:BOOL_128 1 "vlogical_operand" "<BOOL_REGS_OP2>")]))]
7402 "TARGET_P8_VECTOR || (GET_CODE (operands[3]) == AND)"
7404 if (TARGET_VSX && vsx_register_operand (operands[0], <MODE>mode))
7405 return "xxl%q3 %x0,%x1,%x2";
7407 if (TARGET_ALTIVEC && altivec_register_operand (operands[0], <MODE>mode))
7408 return "v%q3 %0,%1,%2";
7412 "(TARGET_P8_VECTOR || (GET_CODE (operands[3]) == AND))
7413 && reload_completed && int_reg_operand (operands[0], <MODE>mode)"
7416 rs6000_split_logical (operands, GET_CODE (operands[3]), false, true, false);
7421 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
7422 (const_string "vecsimple")
7423 (const_string "integer")))
7424 (set (attr "length")
7426 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
7429 (match_test "TARGET_POWERPC64")
7431 (const_string "16"))))])
7433 (define_insn_and_split "*boolc<mode>3_internal2"
7434 [(set (match_operand:TI2 0 "int_reg_operand" "=&r,r,r")
7435 (match_operator:TI2 3 "boolean_operator"
7437 (match_operand:TI2 1 "int_reg_operand" "r,0,r"))
7438 (match_operand:TI2 2 "int_reg_operand" "r,r,0")]))]
7439 "!TARGET_P8_VECTOR && (GET_CODE (operands[3]) != AND)"
7441 "reload_completed && !TARGET_P8_VECTOR && (GET_CODE (operands[3]) != AND)"
7444 rs6000_split_logical (operands, GET_CODE (operands[3]), false, true, false);
7447 [(set_attr "type" "integer")
7448 (set (attr "length")
7450 (match_test "TARGET_POWERPC64")
7452 (const_string "16")))])
7455 (define_insn_and_split "*boolcc<mode>3_internal1"
7456 [(set (match_operand:BOOL_128 0 "vlogical_operand" "=<BOOL_REGS_OUTPUT>")
7457 (match_operator:BOOL_128 3 "boolean_operator"
7459 (match_operand:BOOL_128 1 "vlogical_operand" "<BOOL_REGS_OP1>"))
7461 (match_operand:BOOL_128 2 "vlogical_operand" "<BOOL_REGS_OP2>"))]))]
7462 "TARGET_P8_VECTOR || (GET_CODE (operands[3]) == AND)"
7464 if (TARGET_VSX && vsx_register_operand (operands[0], <MODE>mode))
7465 return "xxl%q3 %x0,%x1,%x2";
7467 if (TARGET_ALTIVEC && altivec_register_operand (operands[0], <MODE>mode))
7468 return "v%q3 %0,%1,%2";
7472 "(TARGET_P8_VECTOR || (GET_CODE (operands[3]) == AND))
7473 && reload_completed && int_reg_operand (operands[0], <MODE>mode)"
7476 rs6000_split_logical (operands, GET_CODE (operands[3]), false, true, true);
7481 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
7482 (const_string "vecsimple")
7483 (const_string "integer")))
7484 (set (attr "length")
7486 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
7489 (match_test "TARGET_POWERPC64")
7491 (const_string "16"))))])
7493 (define_insn_and_split "*boolcc<mode>3_internal2"
7494 [(set (match_operand:TI2 0 "int_reg_operand" "=&r,r,r")
7495 (match_operator:TI2 3 "boolean_operator"
7497 (match_operand:TI2 1 "int_reg_operand" "r,0,r"))
7499 (match_operand:TI2 2 "int_reg_operand" "r,r,0"))]))]
7500 "!TARGET_P8_VECTOR && (GET_CODE (operands[3]) != AND)"
7502 "reload_completed && !TARGET_P8_VECTOR && (GET_CODE (operands[3]) != AND)"
7505 rs6000_split_logical (operands, GET_CODE (operands[3]), false, true, true);
7508 [(set_attr "type" "integer")
7509 (set (attr "length")
7511 (match_test "TARGET_POWERPC64")
7513 (const_string "16")))])
7517 (define_insn_and_split "*eqv<mode>3_internal1"
7518 [(set (match_operand:BOOL_128 0 "vlogical_operand" "=<BOOL_REGS_OUTPUT>")
7521 (match_operand:BOOL_128 1 "vlogical_operand" "<BOOL_REGS_OP1>")
7522 (match_operand:BOOL_128 2 "vlogical_operand" "<BOOL_REGS_OP2>"))))]
7525 if (vsx_register_operand (operands[0], <MODE>mode))
7526 return "xxleqv %x0,%x1,%x2";
7530 "TARGET_P8_VECTOR && reload_completed
7531 && int_reg_operand (operands[0], <MODE>mode)"
7534 rs6000_split_logical (operands, XOR, true, false, false);
7539 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
7540 (const_string "vecsimple")
7541 (const_string "integer")))
7542 (set (attr "length")
7544 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
7547 (match_test "TARGET_POWERPC64")
7549 (const_string "16"))))])
7551 (define_insn_and_split "*eqv<mode>3_internal2"
7552 [(set (match_operand:TI2 0 "int_reg_operand" "=&r,r,r")
7555 (match_operand:TI2 1 "int_reg_operand" "r,0,r")
7556 (match_operand:TI2 2 "int_reg_operand" "r,r,0"))))]
7559 "reload_completed && !TARGET_P8_VECTOR"
7562 rs6000_split_logical (operands, XOR, true, false, false);
7565 [(set_attr "type" "integer")
7566 (set (attr "length")
7568 (match_test "TARGET_POWERPC64")
7570 (const_string "16")))])
7572 ;; 128-bit one's complement
7573 (define_insn_and_split "*one_cmpl<mode>3_internal"
7574 [(set (match_operand:BOOL_128 0 "vlogical_operand" "=<BOOL_REGS_OUTPUT>")
7576 (match_operand:BOOL_128 1 "vlogical_operand" "<BOOL_REGS_UNARY>")))]
7579 if (TARGET_VSX && vsx_register_operand (operands[0], <MODE>mode))
7580 return "xxlnor %x0,%x1,%x1";
7582 if (TARGET_ALTIVEC && altivec_register_operand (operands[0], <MODE>mode))
7583 return "vnor %0,%1,%1";
7587 "reload_completed && int_reg_operand (operands[0], <MODE>mode)"
7590 rs6000_split_logical (operands, NOT, false, false, false);
7595 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
7596 (const_string "vecsimple")
7597 (const_string "integer")))
7598 (set (attr "length")
7600 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
7603 (match_test "TARGET_POWERPC64")
7605 (const_string "16"))))])
7608 ;; Now define ways of moving data around.
7610 ;; Set up a register with a value from the GOT table
7612 (define_expand "movsi_got"
7613 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7614 (unspec:SI [(match_operand:SI 1 "got_operand" "")
7615 (match_dup 2)] UNSPEC_MOVSI_GOT))]
7616 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
7619 if (GET_CODE (operands[1]) == CONST)
7621 rtx offset = const0_rtx;
7622 HOST_WIDE_INT value;
7624 operands[1] = eliminate_constant_term (XEXP (operands[1], 0), &offset);
7625 value = INTVAL (offset);
7628 rtx tmp = (!can_create_pseudo_p ()
7630 : gen_reg_rtx (Pmode));
7631 emit_insn (gen_movsi_got (tmp, operands[1]));
7632 emit_insn (gen_addsi3 (operands[0], tmp, offset));
7637 operands[2] = rs6000_got_register (operands[1]);
7640 (define_insn "*movsi_got_internal"
7641 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7642 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
7643 (match_operand:SI 2 "gpc_reg_operand" "b")]
7645 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
7646 "lwz %0,%a1@got(%2)"
7647 [(set_attr "type" "load")])
7649 ;; Used by sched, shorten_branches and final when the GOT pseudo reg
7650 ;; didn't get allocated to a hard register.
7652 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7653 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
7654 (match_operand:SI 2 "memory_operand" "")]
7656 "DEFAULT_ABI == ABI_V4
7658 && (reload_in_progress || reload_completed)"
7659 [(set (match_dup 0) (match_dup 2))
7660 (set (match_dup 0) (unspec:SI [(match_dup 1)(match_dup 0)]
7664 ;; For SI, we special-case integers that can't be loaded in one insn. We
7665 ;; do the load 16-bits at a time. We could do this by loading from memory,
7666 ;; and this is even supposed to be faster, but it is simpler not to get
7667 ;; integers in the TOC.
7668 (define_insn "movsi_low"
7669 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7670 (mem:SI (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
7671 (match_operand 2 "" ""))))]
7672 "TARGET_MACHO && ! TARGET_64BIT"
7673 "lwz %0,lo16(%2)(%1)"
7674 [(set_attr "type" "load")
7675 (set_attr "length" "4")])
7677 (define_insn "*movsi_internal1"
7678 [(set (match_operand:SI 0 "rs6000_nonimmediate_operand" "=r,r,r,m,r,r,r,r,*c*l,*h,*h")
7679 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,*h,r,r,0"))]
7680 "!TARGET_SINGLE_FPU &&
7681 (gpc_reg_operand (operands[0], SImode) || gpc_reg_operand (operands[1], SImode))"
7694 [(set_attr "type" "*,*,load,store,*,*,*,mfjmpr,mtjmpr,*,*")
7695 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4")])
7697 (define_insn "*movsi_internal1_single"
7698 [(set (match_operand:SI 0 "rs6000_nonimmediate_operand" "=r,r,r,m,r,r,r,r,*c*l,*h,*h,m,*f")
7699 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,*h,r,r,0,f,m"))]
7700 "TARGET_SINGLE_FPU &&
7701 (gpc_reg_operand (operands[0], SImode) || gpc_reg_operand (operands[1], SImode))"
7716 [(set_attr "type" "*,*,load,store,*,*,*,mfjmpr,mtjmpr,*,*,fpstore,fpload")
7717 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4,4,4")])
7719 ;; Split a load of a large constant into the appropriate two-insn
7723 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7724 (match_operand:SI 1 "const_int_operand" ""))]
7725 "(unsigned HOST_WIDE_INT) (INTVAL (operands[1]) + 0x8000) >= 0x10000
7726 && (INTVAL (operands[1]) & 0xffff) != 0"
7730 (ior:SI (match_dup 0)
7734 if (rs6000_emit_set_const (operands[0], operands[1]))
7740 (define_insn "*mov<mode>_internal2"
7741 [(set (match_operand:CC 2 "cc_reg_operand" "=y,x,?y")
7742 (compare:CC (match_operand:P 1 "gpc_reg_operand" "0,r,r")
7744 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r") (match_dup 1))]
7750 [(set_attr "type" "cmp,logical,cmp")
7751 (set_attr "dot" "yes")
7752 (set_attr "length" "4,4,8")])
7755 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
7756 (compare:CC (match_operand:P 1 "gpc_reg_operand" "")
7758 (set (match_operand:P 0 "gpc_reg_operand" "") (match_dup 1))]
7760 [(set (match_dup 0) (match_dup 1))
7762 (compare:CC (match_dup 0)
7766 (define_insn "*movhi_internal"
7767 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,m,r,r,*c*l,*h")
7768 (match_operand:HI 1 "input_operand" "r,m,r,i,*h,r,0"))]
7769 "gpc_reg_operand (operands[0], HImode)
7770 || gpc_reg_operand (operands[1], HImode)"
7779 [(set_attr "type" "*,load,store,*,mfjmpr,mtjmpr,*")])
7781 (define_expand "mov<mode>"
7782 [(set (match_operand:INT 0 "general_operand" "")
7783 (match_operand:INT 1 "any_operand" ""))]
7785 "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
7787 (define_insn "*movqi_internal"
7788 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,m,r,r,*c*l,*h")
7789 (match_operand:QI 1 "input_operand" "r,m,r,i,*h,r,0"))]
7790 "gpc_reg_operand (operands[0], QImode)
7791 || gpc_reg_operand (operands[1], QImode)"
7800 [(set_attr "type" "*,load,store,*,mfjmpr,mtjmpr,*")])
7802 ;; Here is how to move condition codes around. When we store CC data in
7803 ;; an integer register or memory, we store just the high-order 4 bits.
7804 ;; This lets us not shift in the most common case of CR0.
7805 (define_expand "movcc"
7806 [(set (match_operand:CC 0 "nonimmediate_operand" "")
7807 (match_operand:CC 1 "nonimmediate_operand" ""))]
7811 (define_insn "*movcc_internal1"
7812 [(set (match_operand:CC 0 "nonimmediate_operand" "=y,x,?y,y,r,r,r,r,r,cl,r,m")
7813 (match_operand:CC 1 "general_operand" "y,r,r,O,x,y,r,I,h,r,m,r"))]
7814 "register_operand (operands[0], CCmode)
7815 || register_operand (operands[1], CCmode)"
7819 rlwinm %1,%1,%F0,0xffffffff\;mtcrf %R0,%1\;rlwinm %1,%1,%f0,0xffffffff
7822 mfcr %0%Q1\;rlwinm %0,%0,%f1,0xf0000000
7830 (cond [(eq_attr "alternative" "0,3")
7831 (const_string "cr_logical")
7832 (eq_attr "alternative" "1,2")
7833 (const_string "mtcr")
7834 (eq_attr "alternative" "6,7")
7835 (const_string "integer")
7836 (eq_attr "alternative" "8")
7837 (const_string "mfjmpr")
7838 (eq_attr "alternative" "9")
7839 (const_string "mtjmpr")
7840 (eq_attr "alternative" "10")
7841 (const_string "load")
7842 (eq_attr "alternative" "11")
7843 (const_string "store")
7844 (match_test "TARGET_MFCRF")
7845 (const_string "mfcrf")
7847 (const_string "mfcr")))
7848 (set_attr "length" "4,4,12,4,4,8,4,4,4,4,4,4")])
7850 ;; For floating-point, we normally deal with the floating-point registers
7851 ;; unless -msoft-float is used. The sole exception is that parameter passing
7852 ;; can produce floating-point values in fixed-point registers. Unless the
7853 ;; value is a simple constant or already in memory, we deal with this by
7854 ;; allocating memory and copying the value explicitly via that memory location.
7856 ;; Move 32-bit binary/decimal floating point
7857 (define_expand "mov<mode>"
7858 [(set (match_operand:FMOVE32 0 "nonimmediate_operand" "")
7859 (match_operand:FMOVE32 1 "any_operand" ""))]
7861 "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
7864 [(set (match_operand:FMOVE32 0 "gpc_reg_operand" "")
7865 (match_operand:FMOVE32 1 "const_double_operand" ""))]
7867 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
7868 || (GET_CODE (operands[0]) == SUBREG
7869 && GET_CODE (SUBREG_REG (operands[0])) == REG
7870 && REGNO (SUBREG_REG (operands[0])) <= 31))"
7871 [(set (match_dup 2) (match_dup 3))]
7877 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
7878 <real_value_to_target> (rv, l);
7880 if (! TARGET_POWERPC64)
7881 operands[2] = operand_subword (operands[0], 0, 0, <MODE>mode);
7883 operands[2] = gen_lowpart (SImode, operands[0]);
7885 operands[3] = gen_int_mode (l, SImode);
7888 (define_insn "mov<mode>_hardfloat"
7889 [(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")
7890 (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"))]
7891 "(gpc_reg_operand (operands[0], <MODE>mode)
7892 || gpc_reg_operand (operands[1], <MODE>mode))
7893 && (TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT)"
7912 [(set_attr "type" "*,load,store,fp,vecsimple,vecsimple,fpload,fpstore,fpload,fpstore,mftgpr,mffgpr,mtjmpr,mfjmpr,*,*,*")
7913 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,8")])
7915 (define_insn "*mov<mode>_softfloat"
7916 [(set (match_operand:FMOVE32 0 "nonimmediate_operand" "=r,cl,r,r,m,r,r,r,r,*h")
7917 (match_operand:FMOVE32 1 "input_operand" "r,r,h,m,r,I,L,G,Fn,0"))]
7918 "(gpc_reg_operand (operands[0], <MODE>mode)
7919 || gpc_reg_operand (operands[1], <MODE>mode))
7920 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)"
7932 [(set_attr "type" "*,mtjmpr,mfjmpr,load,store,*,*,*,*,*")
7933 (set_attr "length" "4,4,4,4,4,4,4,4,8,4")])
7936 ;; Move 64-bit binary/decimal floating point
7937 (define_expand "mov<mode>"
7938 [(set (match_operand:FMOVE64 0 "nonimmediate_operand" "")
7939 (match_operand:FMOVE64 1 "any_operand" ""))]
7941 "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
7944 [(set (match_operand:FMOVE64 0 "gpc_reg_operand" "")
7945 (match_operand:FMOVE64 1 "const_int_operand" ""))]
7946 "! TARGET_POWERPC64 && reload_completed
7947 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
7948 || (GET_CODE (operands[0]) == SUBREG
7949 && GET_CODE (SUBREG_REG (operands[0])) == REG
7950 && REGNO (SUBREG_REG (operands[0])) <= 31))"
7951 [(set (match_dup 2) (match_dup 4))
7952 (set (match_dup 3) (match_dup 1))]
7955 int endian = (WORDS_BIG_ENDIAN == 0);
7956 HOST_WIDE_INT value = INTVAL (operands[1]);
7958 operands[2] = operand_subword (operands[0], endian, 0, <MODE>mode);
7959 operands[3] = operand_subword (operands[0], 1 - endian, 0, <MODE>mode);
7960 operands[4] = GEN_INT (value >> 32);
7961 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
7965 [(set (match_operand:FMOVE64 0 "gpc_reg_operand" "")
7966 (match_operand:FMOVE64 1 "const_double_operand" ""))]
7967 "! TARGET_POWERPC64 && reload_completed
7968 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
7969 || (GET_CODE (operands[0]) == SUBREG
7970 && GET_CODE (SUBREG_REG (operands[0])) == REG
7971 && REGNO (SUBREG_REG (operands[0])) <= 31))"
7972 [(set (match_dup 2) (match_dup 4))
7973 (set (match_dup 3) (match_dup 5))]
7976 int endian = (WORDS_BIG_ENDIAN == 0);
7980 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
7981 <real_value_to_target> (rv, l);
7983 operands[2] = operand_subword (operands[0], endian, 0, <MODE>mode);
7984 operands[3] = operand_subword (operands[0], 1 - endian, 0, <MODE>mode);
7985 operands[4] = gen_int_mode (l[endian], SImode);
7986 operands[5] = gen_int_mode (l[1 - endian], SImode);
7990 [(set (match_operand:FMOVE64 0 "gpc_reg_operand" "")
7991 (match_operand:FMOVE64 1 "const_double_operand" ""))]
7992 "TARGET_POWERPC64 && reload_completed
7993 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
7994 || (GET_CODE (operands[0]) == SUBREG
7995 && GET_CODE (SUBREG_REG (operands[0])) == REG
7996 && REGNO (SUBREG_REG (operands[0])) <= 31))"
7997 [(set (match_dup 2) (match_dup 3))]
8000 int endian = (WORDS_BIG_ENDIAN == 0);
8005 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8006 <real_value_to_target> (rv, l);
8008 operands[2] = gen_lowpart (DImode, operands[0]);
8009 /* HIGHPART is lower memory address when WORDS_BIG_ENDIAN. */
8010 val = ((HOST_WIDE_INT)(unsigned long)l[endian] << 32
8011 | ((HOST_WIDE_INT)(unsigned long)l[1 - endian]));
8013 operands[3] = gen_int_mode (val, DImode);
8016 ;; Don't have reload use general registers to load a constant. It is
8017 ;; less efficient than loading the constant into an FP register, since
8018 ;; it will probably be used there.
8020 ;; The move constraints are ordered to prefer floating point registers before
8021 ;; general purpose registers to avoid doing a store and a load to get the value
8022 ;; into a floating point register when it is needed for a floating point
8023 ;; operation. Prefer traditional floating point registers over VSX registers,
8024 ;; since the D-form version of the memory instructions does not need a GPR for
8027 (define_insn "*mov<mode>_hardfloat32"
8028 [(set (match_operand:FMOVE64 0 "nonimmediate_operand" "=m,d,d,wv,Z,wa,wa,Y,r,!r,!r,!r,!r")
8029 (match_operand:FMOVE64 1 "input_operand" "d,m,d,Z,wv,wa,j,r,Y,r,G,H,F"))]
8030 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
8031 && (gpc_reg_operand (operands[0], <MODE>mode)
8032 || gpc_reg_operand (operands[1], <MODE>mode))"
8047 [(set_attr "type" "fpstore,fpload,fp,fpload,fpstore,vecsimple,vecsimple,store,load,two,fp,fp,*")
8048 (set_attr "length" "4,4,4,4,4,4,4,8,8,8,8,12,16")])
8050 (define_insn "*mov<mode>_softfloat32"
8051 [(set (match_operand:FMOVE64 0 "nonimmediate_operand" "=Y,r,r,r,r,r")
8052 (match_operand:FMOVE64 1 "input_operand" "r,Y,r,G,H,F"))]
8054 && ((TARGET_FPRS && TARGET_SINGLE_FLOAT)
8055 || TARGET_SOFT_FLOAT || TARGET_E500_SINGLE
8056 || (<MODE>mode == DDmode && TARGET_E500_DOUBLE))
8057 && (gpc_reg_operand (operands[0], <MODE>mode)
8058 || gpc_reg_operand (operands[1], <MODE>mode))"
8060 [(set_attr "type" "store,load,two,*,*,*")
8061 (set_attr "length" "8,8,8,8,12,16")])
8063 ; ld/std require word-aligned displacements -> 'Y' constraint.
8064 ; List Y->r and r->Y before r->r for reload.
8065 (define_insn "*mov<mode>_hardfloat64"
8066 [(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")
8067 (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"))]
8068 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
8069 && (gpc_reg_operand (operands[0], <MODE>mode)
8070 || gpc_reg_operand (operands[1], <MODE>mode))"
8092 [(set_attr "type" "fpstore,fpload,fp,fpload,fpstore,vecsimple,vecsimple,store,load,*,mtjmpr,mfjmpr,*,*,*,*,mftgpr,mffgpr,mftgpr,mffgpr")
8093 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4,4,8,12,16,4,4,4,4")])
8095 (define_insn "*mov<mode>_softfloat64"
8096 [(set (match_operand:FMOVE64 0 "nonimmediate_operand" "=Y,r,r,cl,r,r,r,r,*h")
8097 (match_operand:FMOVE64 1 "input_operand" "r,Y,r,r,h,G,H,F,0"))]
8098 "TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)
8099 && (gpc_reg_operand (operands[0], <MODE>mode)
8100 || gpc_reg_operand (operands[1], <MODE>mode))"
8111 [(set_attr "type" "store,load,*,mtjmpr,mfjmpr,*,*,*,*")
8112 (set_attr "length" "4,4,4,4,4,8,12,16,4")])
8114 (define_expand "mov<mode>"
8115 [(set (match_operand:FMOVE128 0 "general_operand" "")
8116 (match_operand:FMOVE128 1 "any_operand" ""))]
8118 "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
8120 ;; It's important to list Y->r and r->Y before r->r because otherwise
8121 ;; reload, given m->r, will try to pick r->r and reload it, which
8122 ;; doesn't make progress.
8124 ;; We can't split little endian direct moves of TDmode, because the words are
8125 ;; not swapped like they are for TImode or TFmode. Subregs therefore are
8126 ;; problematical. Don't allow direct move for this case.
8128 (define_insn_and_split "*mov<mode>_64bit_dm"
8129 [(set (match_operand:FMOVE128 0 "nonimmediate_operand" "=m,d,d,Y,r,r,r,wm")
8130 (match_operand:FMOVE128 1 "input_operand" "d,m,d,r,YGHF,r,wm,r"))]
8131 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_POWERPC64
8132 && (<MODE>mode != TDmode || WORDS_BIG_ENDIAN)
8133 && (gpc_reg_operand (operands[0], <MODE>mode)
8134 || gpc_reg_operand (operands[1], <MODE>mode))"
8136 "&& reload_completed"
8138 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
8139 [(set_attr "length" "8,8,8,12,12,8,8,8")])
8141 (define_insn_and_split "*movtd_64bit_nodm"
8142 [(set (match_operand:TD 0 "nonimmediate_operand" "=m,d,d,Y,r,r")
8143 (match_operand:TD 1 "input_operand" "d,m,d,r,YGHF,r"))]
8144 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_POWERPC64 && !WORDS_BIG_ENDIAN
8145 && (gpc_reg_operand (operands[0], TDmode)
8146 || gpc_reg_operand (operands[1], TDmode))"
8148 "&& reload_completed"
8150 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
8151 [(set_attr "length" "8,8,8,12,12,8")])
8153 (define_insn_and_split "*mov<mode>_32bit"
8154 [(set (match_operand:FMOVE128 0 "nonimmediate_operand" "=m,d,d,Y,r,r")
8155 (match_operand:FMOVE128 1 "input_operand" "d,m,d,r,YGHF,r"))]
8156 "TARGET_HARD_FLOAT && TARGET_FPRS && !TARGET_POWERPC64
8157 && (gpc_reg_operand (operands[0], <MODE>mode)
8158 || gpc_reg_operand (operands[1], <MODE>mode))"
8160 "&& reload_completed"
8162 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
8163 [(set_attr "length" "8,8,8,20,20,16")])
8165 (define_insn_and_split "*mov<mode>_softfloat"
8166 [(set (match_operand:FMOVE128 0 "rs6000_nonimmediate_operand" "=Y,r,r")
8167 (match_operand:FMOVE128 1 "input_operand" "r,YGHF,r"))]
8168 "(TARGET_SOFT_FLOAT || !TARGET_FPRS)
8169 && (gpc_reg_operand (operands[0], <MODE>mode)
8170 || gpc_reg_operand (operands[1], <MODE>mode))"
8172 "&& reload_completed"
8174 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
8175 [(set_attr "length" "20,20,16")])
8177 (define_expand "extenddftf2"
8178 [(set (match_operand:TF 0 "nonimmediate_operand" "")
8179 (float_extend:TF (match_operand:DF 1 "input_operand" "")))]
8181 && TARGET_HARD_FLOAT
8182 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8183 && TARGET_LONG_DOUBLE_128"
8185 if (TARGET_E500_DOUBLE)
8186 emit_insn (gen_spe_extenddftf2 (operands[0], operands[1]));
8188 emit_insn (gen_extenddftf2_fprs (operands[0], operands[1]));
8192 (define_expand "extenddftf2_fprs"
8193 [(parallel [(set (match_operand:TF 0 "nonimmediate_operand" "")
8194 (float_extend:TF (match_operand:DF 1 "input_operand" "")))
8195 (use (match_dup 2))])]
8197 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
8198 && TARGET_LONG_DOUBLE_128"
8200 operands[2] = CONST0_RTX (DFmode);
8201 /* Generate GOT reference early for SVR4 PIC. */
8202 if (DEFAULT_ABI == ABI_V4 && flag_pic)
8203 operands[2] = validize_mem (force_const_mem (DFmode, operands[2]));
8206 (define_insn_and_split "*extenddftf2_internal"
8207 [(set (match_operand:TF 0 "nonimmediate_operand" "=m,Y,d,&d,r")
8208 (float_extend:TF (match_operand:DF 1 "input_operand" "d,r,md,md,rmGHF")))
8209 (use (match_operand:DF 2 "zero_reg_mem_operand" "d,r,m,d,n"))]
8211 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
8212 && TARGET_LONG_DOUBLE_128"
8214 "&& reload_completed"
8217 const int lo_word = LONG_DOUBLE_LARGE_FIRST ? GET_MODE_SIZE (DFmode) : 0;
8218 const int hi_word = LONG_DOUBLE_LARGE_FIRST ? 0 : GET_MODE_SIZE (DFmode);
8219 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word),
8221 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word),
8226 (define_expand "extendsftf2"
8227 [(set (match_operand:TF 0 "nonimmediate_operand" "")
8228 (float_extend:TF (match_operand:SF 1 "gpc_reg_operand" "")))]
8230 && TARGET_HARD_FLOAT
8231 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8232 && TARGET_LONG_DOUBLE_128"
8234 rtx tmp = gen_reg_rtx (DFmode);
8235 emit_insn (gen_extendsfdf2 (tmp, operands[1]));
8236 emit_insn (gen_extenddftf2 (operands[0], tmp));
8240 (define_expand "trunctfdf2"
8241 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8242 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "")))]
8244 && TARGET_HARD_FLOAT
8245 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8246 && TARGET_LONG_DOUBLE_128"
8249 (define_insn_and_split "trunctfdf2_internal1"
8250 [(set (match_operand:DF 0 "gpc_reg_operand" "=d,?d")
8251 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "0,d")))]
8252 "!TARGET_IEEEQUAD && !TARGET_XL_COMPAT
8253 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8257 "&& reload_completed && REGNO (operands[0]) == REGNO (operands[1])"
8260 emit_note (NOTE_INSN_DELETED);
8263 [(set_attr "type" "fp")])
8265 (define_insn "trunctfdf2_internal2"
8266 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
8267 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "d")))]
8268 "!TARGET_IEEEQUAD && TARGET_XL_COMPAT
8269 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
8270 && TARGET_LONG_DOUBLE_128"
8272 [(set_attr "type" "fp")
8273 (set_attr "fp_type" "fp_addsub_d")])
8275 (define_expand "trunctfsf2"
8276 [(set (match_operand:SF 0 "gpc_reg_operand" "")
8277 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "")))]
8279 && TARGET_HARD_FLOAT
8280 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8281 && TARGET_LONG_DOUBLE_128"
8283 if (TARGET_E500_DOUBLE)
8284 emit_insn (gen_spe_trunctfsf2 (operands[0], operands[1]));
8286 emit_insn (gen_trunctfsf2_fprs (operands[0], operands[1]));
8290 (define_insn_and_split "trunctfsf2_fprs"
8291 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
8292 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "d")))
8293 (clobber (match_scratch:DF 2 "=d"))]
8295 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
8296 && TARGET_LONG_DOUBLE_128"
8298 "&& reload_completed"
8300 (float_truncate:DF (match_dup 1)))
8302 (float_truncate:SF (match_dup 2)))]
8305 (define_expand "floatsitf2"
8306 [(set (match_operand:TF 0 "gpc_reg_operand" "")
8307 (float:TF (match_operand:SI 1 "gpc_reg_operand" "")))]
8309 && TARGET_HARD_FLOAT
8310 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8311 && TARGET_LONG_DOUBLE_128"
8313 rtx tmp = gen_reg_rtx (DFmode);
8314 expand_float (tmp, operands[1], false);
8315 emit_insn (gen_extenddftf2 (operands[0], tmp));
8319 ; fadd, but rounding towards zero.
8320 ; This is probably not the optimal code sequence.
8321 (define_insn "fix_trunc_helper"
8322 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
8323 (unspec:DF [(match_operand:TF 1 "gpc_reg_operand" "d")]
8324 UNSPEC_FIX_TRUNC_TF))
8325 (clobber (match_operand:DF 2 "gpc_reg_operand" "=&d"))]
8326 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
8327 "mffs %2\n\tmtfsb1 31\n\tmtfsb0 30\n\tfadd %0,%1,%L1\n\tmtfsf 1,%2"
8328 [(set_attr "type" "fp")
8329 (set_attr "length" "20")])
8331 (define_expand "fix_trunctfsi2"
8332 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8333 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))]
8334 "!TARGET_IEEEQUAD && TARGET_HARD_FLOAT
8335 && (TARGET_FPRS || TARGET_E500_DOUBLE) && TARGET_LONG_DOUBLE_128"
8337 if (TARGET_E500_DOUBLE)
8338 emit_insn (gen_spe_fix_trunctfsi2 (operands[0], operands[1]));
8340 emit_insn (gen_fix_trunctfsi2_fprs (operands[0], operands[1]));
8344 (define_expand "fix_trunctfsi2_fprs"
8345 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
8346 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))
8347 (clobber (match_dup 2))
8348 (clobber (match_dup 3))
8349 (clobber (match_dup 4))
8350 (clobber (match_dup 5))])]
8352 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8354 operands[2] = gen_reg_rtx (DFmode);
8355 operands[3] = gen_reg_rtx (DFmode);
8356 operands[4] = gen_reg_rtx (DImode);
8357 operands[5] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode));
8360 (define_insn_and_split "*fix_trunctfsi2_internal"
8361 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8362 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "d")))
8363 (clobber (match_operand:DF 2 "gpc_reg_operand" "=d"))
8364 (clobber (match_operand:DF 3 "gpc_reg_operand" "=&d"))
8365 (clobber (match_operand:DI 4 "gpc_reg_operand" "=d"))
8366 (clobber (match_operand:DI 5 "offsettable_mem_operand" "=o"))]
8368 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8374 emit_insn (gen_fix_trunc_helper (operands[2], operands[1], operands[3]));
8376 gcc_assert (MEM_P (operands[5]));
8377 lowword = adjust_address (operands[5], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
8379 emit_insn (gen_fctiwz_df (operands[4], operands[2]));
8380 emit_move_insn (operands[5], operands[4]);
8381 emit_move_insn (operands[0], lowword);
8385 (define_expand "negtf2"
8386 [(set (match_operand:TF 0 "gpc_reg_operand" "")
8387 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "")))]
8389 && TARGET_HARD_FLOAT
8390 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8391 && TARGET_LONG_DOUBLE_128"
8394 (define_insn "negtf2_internal"
8395 [(set (match_operand:TF 0 "gpc_reg_operand" "=d")
8396 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "d")))]
8398 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8401 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8402 return \"fneg %L0,%L1\;fneg %0,%1\";
8404 return \"fneg %0,%1\;fneg %L0,%L1\";
8406 [(set_attr "type" "fp")
8407 (set_attr "length" "8")])
8409 (define_expand "abstf2"
8410 [(set (match_operand:TF 0 "gpc_reg_operand" "")
8411 (abs:TF (match_operand:TF 1 "gpc_reg_operand" "")))]
8413 && TARGET_HARD_FLOAT
8414 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8415 && TARGET_LONG_DOUBLE_128"
8418 rtx label = gen_label_rtx ();
8419 if (TARGET_E500_DOUBLE)
8421 if (flag_finite_math_only && !flag_trapping_math)
8422 emit_insn (gen_spe_abstf2_tst (operands[0], operands[1], label));
8424 emit_insn (gen_spe_abstf2_cmp (operands[0], operands[1], label));
8427 emit_insn (gen_abstf2_internal (operands[0], operands[1], label));
8432 (define_expand "abstf2_internal"
8433 [(set (match_operand:TF 0 "gpc_reg_operand" "")
8434 (match_operand:TF 1 "gpc_reg_operand" ""))
8435 (set (match_dup 3) (match_dup 5))
8436 (set (match_dup 5) (abs:DF (match_dup 5)))
8437 (set (match_dup 4) (compare:CCFP (match_dup 3) (match_dup 5)))
8438 (set (pc) (if_then_else (eq (match_dup 4) (const_int 0))
8439 (label_ref (match_operand 2 "" ""))
8441 (set (match_dup 6) (neg:DF (match_dup 6)))]
8443 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
8444 && TARGET_LONG_DOUBLE_128"
8447 const int hi_word = LONG_DOUBLE_LARGE_FIRST ? 0 : GET_MODE_SIZE (DFmode);
8448 const int lo_word = LONG_DOUBLE_LARGE_FIRST ? GET_MODE_SIZE (DFmode) : 0;
8449 operands[3] = gen_reg_rtx (DFmode);
8450 operands[4] = gen_reg_rtx (CCFPmode);
8451 operands[5] = simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word);
8452 operands[6] = simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word);
8455 ;; Reload helper functions used by rs6000_secondary_reload. The patterns all
8456 ;; must have 3 arguments, and scratch register constraint must be a single
8459 ;; Reload patterns to support gpr load/store with misaligned mem.
8460 ;; and multiple gpr load/store at offset >= 0xfffc
8461 (define_expand "reload_<mode>_store"
8462 [(parallel [(match_operand 0 "memory_operand" "=m")
8463 (match_operand 1 "gpc_reg_operand" "r")
8464 (match_operand:GPR 2 "register_operand" "=&b")])]
8467 rs6000_secondary_reload_gpr (operands[1], operands[0], operands[2], true);
8471 (define_expand "reload_<mode>_load"
8472 [(parallel [(match_operand 0 "gpc_reg_operand" "=r")
8473 (match_operand 1 "memory_operand" "m")
8474 (match_operand:GPR 2 "register_operand" "=b")])]
8477 rs6000_secondary_reload_gpr (operands[0], operands[1], operands[2], false);
8482 ;; Power8 merge instructions to allow direct move to/from floating point
8483 ;; registers in 32-bit mode. We use TF mode to get two registers to move the
8484 ;; individual 32-bit parts across. Subreg doesn't work too well on the TF
8485 ;; value, since it is allocated in reload and not all of the flow information
8486 ;; is setup for it. We have two patterns to do the two moves between gprs and
8487 ;; fprs. There isn't a dependancy between the two, but we could potentially
8488 ;; schedule other instructions between the two instructions. TFmode is
8489 ;; currently limited to traditional FPR registers. If/when this is changed, we
8490 ;; will need to revist %L to make sure it works with VSX registers, or add an
8491 ;; %x version of %L.
8493 (define_insn "p8_fmrgow_<mode>"
8494 [(set (match_operand:FMOVE64X 0 "register_operand" "=d")
8495 (unspec:FMOVE64X [(match_operand:TF 1 "register_operand" "d")]
8496 UNSPEC_P8V_FMRGOW))]
8497 "!TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
8499 [(set_attr "type" "vecperm")])
8501 (define_insn "p8_mtvsrwz_1"
8502 [(set (match_operand:TF 0 "register_operand" "=d")
8503 (unspec:TF [(match_operand:SI 1 "register_operand" "r")]
8504 UNSPEC_P8V_MTVSRWZ))]
8505 "!TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
8507 [(set_attr "type" "mftgpr")])
8509 (define_insn "p8_mtvsrwz_2"
8510 [(set (match_operand:TF 0 "register_operand" "+d")
8511 (unspec:TF [(match_dup 0)
8512 (match_operand:SI 1 "register_operand" "r")]
8513 UNSPEC_P8V_MTVSRWZ))]
8514 "!TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
8516 [(set_attr "type" "mftgpr")])
8518 (define_insn_and_split "reload_fpr_from_gpr<mode>"
8519 [(set (match_operand:FMOVE64X 0 "register_operand" "=ws")
8520 (unspec:FMOVE64X [(match_operand:FMOVE64X 1 "register_operand" "r")]
8521 UNSPEC_P8V_RELOAD_FROM_GPR))
8522 (clobber (match_operand:TF 2 "register_operand" "=d"))]
8523 "!TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
8525 "&& reload_completed"
8528 rtx dest = operands[0];
8529 rtx src = operands[1];
8530 rtx tmp = operands[2];
8531 rtx gpr_hi_reg = gen_highpart (SImode, src);
8532 rtx gpr_lo_reg = gen_lowpart (SImode, src);
8534 emit_insn (gen_p8_mtvsrwz_1 (tmp, gpr_hi_reg));
8535 emit_insn (gen_p8_mtvsrwz_2 (tmp, gpr_lo_reg));
8536 emit_insn (gen_p8_fmrgow_<mode> (dest, tmp));
8539 [(set_attr "length" "12")
8540 (set_attr "type" "three")])
8542 ;; Move 128 bit values from GPRs to VSX registers in 64-bit mode
8543 (define_insn "p8_mtvsrd_1"
8544 [(set (match_operand:TF 0 "register_operand" "=ws")
8545 (unspec:TF [(match_operand:DI 1 "register_operand" "r")]
8546 UNSPEC_P8V_MTVSRD))]
8547 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
8549 [(set_attr "type" "mftgpr")])
8551 (define_insn "p8_mtvsrd_2"
8552 [(set (match_operand:TF 0 "register_operand" "+ws")
8553 (unspec:TF [(match_dup 0)
8554 (match_operand:DI 1 "register_operand" "r")]
8555 UNSPEC_P8V_MTVSRD))]
8556 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
8558 [(set_attr "type" "mftgpr")])
8560 (define_insn "p8_xxpermdi_<mode>"
8561 [(set (match_operand:FMOVE128_GPR 0 "register_operand" "=wa")
8562 (unspec:FMOVE128_GPR [(match_operand:TF 1 "register_operand" "ws")]
8563 UNSPEC_P8V_XXPERMDI))]
8564 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
8565 "xxpermdi %x0,%1,%L1,0"
8566 [(set_attr "type" "vecperm")])
8568 (define_insn_and_split "reload_vsx_from_gpr<mode>"
8569 [(set (match_operand:FMOVE128_GPR 0 "register_operand" "=wa")
8570 (unspec:FMOVE128_GPR
8571 [(match_operand:FMOVE128_GPR 1 "register_operand" "r")]
8572 UNSPEC_P8V_RELOAD_FROM_GPR))
8573 (clobber (match_operand:TF 2 "register_operand" "=ws"))]
8574 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
8576 "&& reload_completed"
8579 rtx dest = operands[0];
8580 rtx src = operands[1];
8581 rtx tmp = operands[2];
8582 rtx gpr_hi_reg = gen_highpart (DImode, src);
8583 rtx gpr_lo_reg = gen_lowpart (DImode, src);
8585 emit_insn (gen_p8_mtvsrd_1 (tmp, gpr_hi_reg));
8586 emit_insn (gen_p8_mtvsrd_2 (tmp, gpr_lo_reg));
8587 emit_insn (gen_p8_xxpermdi_<mode> (dest, tmp));
8589 [(set_attr "length" "12")
8590 (set_attr "type" "three")])
8593 [(set (match_operand:FMOVE128_GPR 0 "nonimmediate_operand" "")
8594 (match_operand:FMOVE128_GPR 1 "input_operand" ""))]
8596 && (int_reg_operand (operands[0], <MODE>mode)
8597 || int_reg_operand (operands[1], <MODE>mode))"
8599 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
8601 ;; Move SFmode to a VSX from a GPR register. Because scalar floating point
8602 ;; type is stored internally as double precision in the VSX registers, we have
8603 ;; to convert it from the vector format.
8605 (define_insn_and_split "reload_vsx_from_gprsf"
8606 [(set (match_operand:SF 0 "register_operand" "=wa")
8607 (unspec:SF [(match_operand:SF 1 "register_operand" "r")]
8608 UNSPEC_P8V_RELOAD_FROM_GPR))
8609 (clobber (match_operand:DI 2 "register_operand" "=r"))]
8610 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
8612 "&& reload_completed"
8615 rtx op0 = operands[0];
8616 rtx op1 = operands[1];
8617 rtx op2 = operands[2];
8618 /* Also use the destination register to hold the unconverted DImode value.
8619 This is conceptually a separate value from OP0, so we use gen_rtx_REG
8620 rather than simplify_gen_subreg. */
8621 rtx op0_di = gen_rtx_REG (DImode, REGNO (op0));
8622 rtx op1_di = simplify_gen_subreg (DImode, op1, SFmode, 0);
8624 /* Move SF value to upper 32-bits for xscvspdpn. */
8625 emit_insn (gen_ashldi3 (op2, op1_di, GEN_INT (32)));
8626 emit_move_insn (op0_di, op2);
8627 emit_insn (gen_vsx_xscvspdpn_directmove (op0, op0_di));
8630 [(set_attr "length" "8")
8631 (set_attr "type" "two")])
8633 ;; Move 128 bit values from VSX registers to GPRs in 64-bit mode by doing a
8634 ;; normal 64-bit move, followed by an xxpermdi to get the bottom 64-bit value,
8635 ;; and then doing a move of that.
8636 (define_insn "p8_mfvsrd_3_<mode>"
8637 [(set (match_operand:DF 0 "register_operand" "=r")
8638 (unspec:DF [(match_operand:FMOVE128_GPR 1 "register_operand" "wa")]
8639 UNSPEC_P8V_RELOAD_FROM_VSX))]
8640 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
8642 [(set_attr "type" "mftgpr")])
8644 (define_insn_and_split "reload_gpr_from_vsx<mode>"
8645 [(set (match_operand:FMOVE128_GPR 0 "register_operand" "=r")
8646 (unspec:FMOVE128_GPR
8647 [(match_operand:FMOVE128_GPR 1 "register_operand" "wa")]
8648 UNSPEC_P8V_RELOAD_FROM_VSX))
8649 (clobber (match_operand:FMOVE128_GPR 2 "register_operand" "=wa"))]
8650 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
8652 "&& reload_completed"
8655 rtx dest = operands[0];
8656 rtx src = operands[1];
8657 rtx tmp = operands[2];
8658 rtx gpr_hi_reg = gen_highpart (DFmode, dest);
8659 rtx gpr_lo_reg = gen_lowpart (DFmode, dest);
8661 emit_insn (gen_p8_mfvsrd_3_<mode> (gpr_hi_reg, src));
8662 emit_insn (gen_vsx_xxpermdi_<mode> (tmp, src, src, GEN_INT (3)));
8663 emit_insn (gen_p8_mfvsrd_3_<mode> (gpr_lo_reg, tmp));
8665 [(set_attr "length" "12")
8666 (set_attr "type" "three")])
8668 ;; Move SFmode to a GPR from a VSX register. Because scalar floating point
8669 ;; type is stored internally as double precision, we have to convert it to the
8672 (define_insn_and_split "reload_gpr_from_vsxsf"
8673 [(set (match_operand:SF 0 "register_operand" "=r")
8674 (unspec:SF [(match_operand:SF 1 "register_operand" "wa")]
8675 UNSPEC_P8V_RELOAD_FROM_VSX))
8676 (clobber (match_operand:V4SF 2 "register_operand" "=wa"))]
8677 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
8679 "&& reload_completed"
8682 rtx op0 = operands[0];
8683 rtx op1 = operands[1];
8684 rtx op2 = operands[2];
8685 rtx diop0 = simplify_gen_subreg (DImode, op0, SFmode, 0);
8687 emit_insn (gen_vsx_xscvdpspn_scalar (op2, op1));
8688 emit_insn (gen_p8_mfvsrd_4_disf (diop0, op2));
8689 emit_insn (gen_lshrdi3 (diop0, diop0, GEN_INT (32)));
8692 [(set_attr "length" "12")
8693 (set_attr "type" "three")])
8695 (define_insn "p8_mfvsrd_4_disf"
8696 [(set (match_operand:DI 0 "register_operand" "=r")
8697 (unspec:DI [(match_operand:V4SF 1 "register_operand" "wa")]
8698 UNSPEC_P8V_RELOAD_FROM_VSX))]
8699 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
8701 [(set_attr "type" "mftgpr")])
8704 ;; Next come the multi-word integer load and store and the load and store
8707 ;; List r->r after r->Y, otherwise reload will try to reload a
8708 ;; non-offsettable address by using r->r which won't make progress.
8709 ;; Use of fprs is disparaged slightly otherwise reload prefers to reload
8710 ;; a gpr into a fpr instead of reloading an invalid 'Y' address
8711 (define_insn "*movdi_internal32"
8712 [(set (match_operand:DI 0 "rs6000_nonimmediate_operand" "=Y,r,r,?m,?*d,?*d,r")
8713 (match_operand:DI 1 "input_operand" "r,Y,r,d,m,d,IJKnGHF"))]
8715 && (gpc_reg_operand (operands[0], DImode)
8716 || gpc_reg_operand (operands[1], DImode))"
8725 [(set_attr "type" "store,load,*,fpstore,fpload,fp,*")])
8728 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8729 (match_operand:DI 1 "const_int_operand" ""))]
8730 "! TARGET_POWERPC64 && reload_completed
8731 && gpr_or_gpr_p (operands[0], operands[1])
8732 && !direct_move_p (operands[0], operands[1])"
8733 [(set (match_dup 2) (match_dup 4))
8734 (set (match_dup 3) (match_dup 1))]
8737 HOST_WIDE_INT value = INTVAL (operands[1]);
8738 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
8740 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
8742 operands[4] = GEN_INT (value >> 32);
8743 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
8747 [(set (match_operand:DIFD 0 "rs6000_nonimmediate_operand" "")
8748 (match_operand:DIFD 1 "input_operand" ""))]
8749 "reload_completed && !TARGET_POWERPC64
8750 && gpr_or_gpr_p (operands[0], operands[1])
8751 && !direct_move_p (operands[0], operands[1])"
8753 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
8755 (define_insn "*movdi_internal64"
8756 [(set (match_operand:DI 0 "nonimmediate_operand" "=Y,r,r,r,r,r,?m,?*d,?*d,r,*h,*h,r,?*wg,r,?*wj,?*wi")
8757 (match_operand:DI 1 "input_operand" "r,Y,r,I,L,nF,d,m,d,*h,r,0,*wg,r,*wj,r,O"))]
8759 && (gpc_reg_operand (operands[0], DImode)
8760 || gpc_reg_operand (operands[1], DImode))"
8779 [(set_attr "type" "store,load,*,*,*,*,fpstore,fpload,fp,mfjmpr,mtjmpr,*,mftgpr,mffgpr,mftgpr,mffgpr,vecsimple")
8780 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4,4,4,4,4")])
8782 ;; Generate all one-bits and clear left or right.
8783 ;; Use (and:DI (rotate:DI ...)) to avoid anddi3 unnecessary clobber.
8785 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8786 (match_operand:DI 1 "mask64_operand" ""))]
8787 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
8788 [(set (match_dup 0) (const_int -1))
8790 (and:DI (rotate:DI (match_dup 0)
8795 ;; Split a load of a large constant into the appropriate five-instruction
8796 ;; sequence. Handle anything in a constant number of insns.
8797 ;; When non-easy constants can go in the TOC, this should use
8798 ;; easy_fp_constant predicate.
8800 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8801 (match_operand:DI 1 "const_int_operand" ""))]
8802 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
8803 [(set (match_dup 0) (match_dup 2))
8804 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
8807 if (rs6000_emit_set_const (operands[0], operands[1]))
8814 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8815 (match_operand:DI 1 "const_scalar_int_operand" ""))]
8816 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
8817 [(set (match_dup 0) (match_dup 2))
8818 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
8821 if (rs6000_emit_set_const (operands[0], operands[1]))
8827 ;; TImode/PTImode is similar, except that we usually want to compute the
8828 ;; address into a register and use lsi/stsi (the exception is during reload).
8830 (define_insn "*mov<mode>_string"
8831 [(set (match_operand:TI2 0 "reg_or_mem_operand" "=Q,Y,????r,????r,????r,r")
8832 (match_operand:TI2 1 "input_operand" "r,r,Q,Y,r,n"))]
8834 && (<MODE>mode != TImode || VECTOR_MEM_NONE_P (TImode))
8835 && (gpc_reg_operand (operands[0], <MODE>mode)
8836 || gpc_reg_operand (operands[1], <MODE>mode))"
8839 switch (which_alternative)
8845 return \"stswi %1,%P0,16\";
8849 /* If the address is not used in the output, we can use lsi. Otherwise,
8850 fall through to generating four loads. */
8852 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
8853 return \"lswi %0,%P1,16\";
8854 /* ... fall through ... */
8861 [(set_attr "type" "store,store,load,load,*,*")
8862 (set_attr "update" "yes")
8863 (set_attr "indexed" "yes")
8864 (set (attr "cell_micro") (if_then_else (match_test "TARGET_STRING")
8865 (const_string "always")
8866 (const_string "conditional")))])
8868 (define_insn "*mov<mode>_ppc64"
8869 [(set (match_operand:TI2 0 "nonimmediate_operand" "=wQ,Y,r,r,r,r")
8870 (match_operand:TI2 1 "input_operand" "r,r,wQ,Y,r,n"))]
8871 "(TARGET_POWERPC64 && VECTOR_MEM_NONE_P (<MODE>mode)
8872 && (gpc_reg_operand (operands[0], <MODE>mode)
8873 || gpc_reg_operand (operands[1], <MODE>mode)))"
8875 return rs6000_output_move_128bit (operands);
8877 [(set_attr "type" "store,store,load,load,*,*")
8878 (set_attr "length" "8")])
8881 [(set (match_operand:TI2 0 "int_reg_operand" "")
8882 (match_operand:TI2 1 "const_scalar_int_operand" ""))]
8884 && (VECTOR_MEM_NONE_P (<MODE>mode)
8885 || (reload_completed && INT_REGNO_P (REGNO (operands[0]))))"
8886 [(set (match_dup 2) (match_dup 4))
8887 (set (match_dup 3) (match_dup 5))]
8890 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
8892 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
8894 if (CONST_WIDE_INT_P (operands[1]))
8896 operands[4] = GEN_INT (CONST_WIDE_INT_ELT (operands[1], 1));
8897 operands[5] = GEN_INT (CONST_WIDE_INT_ELT (operands[1], 0));
8899 else if (CONST_INT_P (operands[1]))
8901 operands[4] = GEN_INT (- (INTVAL (operands[1]) < 0));
8902 operands[5] = operands[1];
8909 [(set (match_operand:TI2 0 "nonimmediate_operand" "")
8910 (match_operand:TI2 1 "input_operand" ""))]
8912 && gpr_or_gpr_p (operands[0], operands[1])
8913 && !direct_move_p (operands[0], operands[1])
8914 && !quad_load_store_p (operands[0], operands[1])"
8916 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
8918 (define_expand "load_multiple"
8919 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
8920 (match_operand:SI 1 "" ""))
8921 (use (match_operand:SI 2 "" ""))])]
8922 "TARGET_STRING && !TARGET_POWERPC64"
8930 /* Support only loading a constant number of fixed-point registers from
8931 memory and only bother with this if more than two; the machine
8932 doesn't support more than eight. */
8933 if (GET_CODE (operands[2]) != CONST_INT
8934 || INTVAL (operands[2]) <= 2
8935 || INTVAL (operands[2]) > 8
8936 || GET_CODE (operands[1]) != MEM
8937 || GET_CODE (operands[0]) != REG
8938 || REGNO (operands[0]) >= 32)
8941 count = INTVAL (operands[2]);
8942 regno = REGNO (operands[0]);
8944 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
8945 op1 = replace_equiv_address (operands[1],
8946 force_reg (SImode, XEXP (operands[1], 0)));
8948 for (i = 0; i < count; i++)
8949 XVECEXP (operands[3], 0, i)
8950 = gen_rtx_SET (VOIDmode, gen_rtx_REG (SImode, regno + i),
8951 adjust_address_nv (op1, SImode, i * 4));
8954 (define_insn "*ldmsi8"
8955 [(match_parallel 0 "load_multiple_operation"
8956 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8957 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8958 (set (match_operand:SI 3 "gpc_reg_operand" "")
8959 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8960 (set (match_operand:SI 4 "gpc_reg_operand" "")
8961 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8962 (set (match_operand:SI 5 "gpc_reg_operand" "")
8963 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8964 (set (match_operand:SI 6 "gpc_reg_operand" "")
8965 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
8966 (set (match_operand:SI 7 "gpc_reg_operand" "")
8967 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
8968 (set (match_operand:SI 8 "gpc_reg_operand" "")
8969 (mem:SI (plus:SI (match_dup 1) (const_int 24))))
8970 (set (match_operand:SI 9 "gpc_reg_operand" "")
8971 (mem:SI (plus:SI (match_dup 1) (const_int 28))))])]
8972 "TARGET_STRING && XVECLEN (operands[0], 0) == 8"
8974 { return rs6000_output_load_multiple (operands); }"
8975 [(set_attr "type" "load")
8976 (set_attr "update" "yes")
8977 (set_attr "indexed" "yes")
8978 (set_attr "length" "32")])
8980 (define_insn "*ldmsi7"
8981 [(match_parallel 0 "load_multiple_operation"
8982 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8983 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8984 (set (match_operand:SI 3 "gpc_reg_operand" "")
8985 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8986 (set (match_operand:SI 4 "gpc_reg_operand" "")
8987 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8988 (set (match_operand:SI 5 "gpc_reg_operand" "")
8989 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8990 (set (match_operand:SI 6 "gpc_reg_operand" "")
8991 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
8992 (set (match_operand:SI 7 "gpc_reg_operand" "")
8993 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
8994 (set (match_operand:SI 8 "gpc_reg_operand" "")
8995 (mem:SI (plus:SI (match_dup 1) (const_int 24))))])]
8996 "TARGET_STRING && XVECLEN (operands[0], 0) == 7"
8998 { return rs6000_output_load_multiple (operands); }"
8999 [(set_attr "type" "load")
9000 (set_attr "update" "yes")
9001 (set_attr "indexed" "yes")
9002 (set_attr "length" "32")])
9004 (define_insn "*ldmsi6"
9005 [(match_parallel 0 "load_multiple_operation"
9006 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9007 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9008 (set (match_operand:SI 3 "gpc_reg_operand" "")
9009 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9010 (set (match_operand:SI 4 "gpc_reg_operand" "")
9011 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9012 (set (match_operand:SI 5 "gpc_reg_operand" "")
9013 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
9014 (set (match_operand:SI 6 "gpc_reg_operand" "")
9015 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
9016 (set (match_operand:SI 7 "gpc_reg_operand" "")
9017 (mem:SI (plus:SI (match_dup 1) (const_int 20))))])]
9018 "TARGET_STRING && XVECLEN (operands[0], 0) == 6"
9020 { return rs6000_output_load_multiple (operands); }"
9021 [(set_attr "type" "load")
9022 (set_attr "update" "yes")
9023 (set_attr "indexed" "yes")
9024 (set_attr "length" "32")])
9026 (define_insn "*ldmsi5"
9027 [(match_parallel 0 "load_multiple_operation"
9028 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9029 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9030 (set (match_operand:SI 3 "gpc_reg_operand" "")
9031 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9032 (set (match_operand:SI 4 "gpc_reg_operand" "")
9033 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9034 (set (match_operand:SI 5 "gpc_reg_operand" "")
9035 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
9036 (set (match_operand:SI 6 "gpc_reg_operand" "")
9037 (mem:SI (plus:SI (match_dup 1) (const_int 16))))])]
9038 "TARGET_STRING && XVECLEN (operands[0], 0) == 5"
9040 { return rs6000_output_load_multiple (operands); }"
9041 [(set_attr "type" "load")
9042 (set_attr "update" "yes")
9043 (set_attr "indexed" "yes")
9044 (set_attr "length" "32")])
9046 (define_insn "*ldmsi4"
9047 [(match_parallel 0 "load_multiple_operation"
9048 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9049 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9050 (set (match_operand:SI 3 "gpc_reg_operand" "")
9051 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9052 (set (match_operand:SI 4 "gpc_reg_operand" "")
9053 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9054 (set (match_operand:SI 5 "gpc_reg_operand" "")
9055 (mem:SI (plus:SI (match_dup 1) (const_int 12))))])]
9056 "TARGET_STRING && XVECLEN (operands[0], 0) == 4"
9058 { return rs6000_output_load_multiple (operands); }"
9059 [(set_attr "type" "load")
9060 (set_attr "update" "yes")
9061 (set_attr "indexed" "yes")
9062 (set_attr "length" "32")])
9064 (define_insn "*ldmsi3"
9065 [(match_parallel 0 "load_multiple_operation"
9066 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9067 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9068 (set (match_operand:SI 3 "gpc_reg_operand" "")
9069 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9070 (set (match_operand:SI 4 "gpc_reg_operand" "")
9071 (mem:SI (plus:SI (match_dup 1) (const_int 8))))])]
9072 "TARGET_STRING && XVECLEN (operands[0], 0) == 3"
9074 { return rs6000_output_load_multiple (operands); }"
9075 [(set_attr "type" "load")
9076 (set_attr "update" "yes")
9077 (set_attr "indexed" "yes")
9078 (set_attr "length" "32")])
9080 (define_expand "store_multiple"
9081 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
9082 (match_operand:SI 1 "" ""))
9083 (clobber (scratch:SI))
9084 (use (match_operand:SI 2 "" ""))])]
9085 "TARGET_STRING && !TARGET_POWERPC64"
9094 /* Support only storing a constant number of fixed-point registers to
9095 memory and only bother with this if more than two; the machine
9096 doesn't support more than eight. */
9097 if (GET_CODE (operands[2]) != CONST_INT
9098 || INTVAL (operands[2]) <= 2
9099 || INTVAL (operands[2]) > 8
9100 || GET_CODE (operands[0]) != MEM
9101 || GET_CODE (operands[1]) != REG
9102 || REGNO (operands[1]) >= 32)
9105 count = INTVAL (operands[2]);
9106 regno = REGNO (operands[1]);
9108 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count + 1));
9109 to = force_reg (SImode, XEXP (operands[0], 0));
9110 op0 = replace_equiv_address (operands[0], to);
9112 XVECEXP (operands[3], 0, 0)
9113 = gen_rtx_SET (VOIDmode, adjust_address_nv (op0, SImode, 0), operands[1]);
9114 XVECEXP (operands[3], 0, 1) = gen_rtx_CLOBBER (VOIDmode,
9115 gen_rtx_SCRATCH (SImode));
9117 for (i = 1; i < count; i++)
9118 XVECEXP (operands[3], 0, i + 1)
9119 = gen_rtx_SET (VOIDmode,
9120 adjust_address_nv (op0, SImode, i * 4),
9121 gen_rtx_REG (SImode, regno + i));
9124 (define_insn "*stmsi8"
9125 [(match_parallel 0 "store_multiple_operation"
9126 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9127 (match_operand:SI 2 "gpc_reg_operand" "r"))
9128 (clobber (match_scratch:SI 3 "=X"))
9129 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9130 (match_operand:SI 4 "gpc_reg_operand" "r"))
9131 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9132 (match_operand:SI 5 "gpc_reg_operand" "r"))
9133 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9134 (match_operand:SI 6 "gpc_reg_operand" "r"))
9135 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9136 (match_operand:SI 7 "gpc_reg_operand" "r"))
9137 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9138 (match_operand:SI 8 "gpc_reg_operand" "r"))
9139 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
9140 (match_operand:SI 9 "gpc_reg_operand" "r"))
9141 (set (mem:SI (plus:SI (match_dup 1) (const_int 28)))
9142 (match_operand:SI 10 "gpc_reg_operand" "r"))])]
9143 "TARGET_STRING && XVECLEN (operands[0], 0) == 9"
9145 [(set_attr "type" "store")
9146 (set_attr "update" "yes")
9147 (set_attr "indexed" "yes")
9148 (set_attr "cell_micro" "always")])
9150 (define_insn "*stmsi7"
9151 [(match_parallel 0 "store_multiple_operation"
9152 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9153 (match_operand:SI 2 "gpc_reg_operand" "r"))
9154 (clobber (match_scratch:SI 3 "=X"))
9155 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9156 (match_operand:SI 4 "gpc_reg_operand" "r"))
9157 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9158 (match_operand:SI 5 "gpc_reg_operand" "r"))
9159 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9160 (match_operand:SI 6 "gpc_reg_operand" "r"))
9161 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9162 (match_operand:SI 7 "gpc_reg_operand" "r"))
9163 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9164 (match_operand:SI 8 "gpc_reg_operand" "r"))
9165 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
9166 (match_operand:SI 9 "gpc_reg_operand" "r"))])]
9167 "TARGET_STRING && XVECLEN (operands[0], 0) == 8"
9169 [(set_attr "type" "store")
9170 (set_attr "update" "yes")
9171 (set_attr "indexed" "yes")
9172 (set_attr "cell_micro" "always")])
9174 (define_insn "*stmsi6"
9175 [(match_parallel 0 "store_multiple_operation"
9176 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9177 (match_operand:SI 2 "gpc_reg_operand" "r"))
9178 (clobber (match_scratch:SI 3 "=X"))
9179 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9180 (match_operand:SI 4 "gpc_reg_operand" "r"))
9181 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9182 (match_operand:SI 5 "gpc_reg_operand" "r"))
9183 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9184 (match_operand:SI 6 "gpc_reg_operand" "r"))
9185 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9186 (match_operand:SI 7 "gpc_reg_operand" "r"))
9187 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9188 (match_operand:SI 8 "gpc_reg_operand" "r"))])]
9189 "TARGET_STRING && XVECLEN (operands[0], 0) == 7"
9191 [(set_attr "type" "store")
9192 (set_attr "update" "yes")
9193 (set_attr "indexed" "yes")
9194 (set_attr "cell_micro" "always")])
9196 (define_insn "*stmsi5"
9197 [(match_parallel 0 "store_multiple_operation"
9198 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9199 (match_operand:SI 2 "gpc_reg_operand" "r"))
9200 (clobber (match_scratch:SI 3 "=X"))
9201 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9202 (match_operand:SI 4 "gpc_reg_operand" "r"))
9203 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9204 (match_operand:SI 5 "gpc_reg_operand" "r"))
9205 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9206 (match_operand:SI 6 "gpc_reg_operand" "r"))
9207 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9208 (match_operand:SI 7 "gpc_reg_operand" "r"))])]
9209 "TARGET_STRING && XVECLEN (operands[0], 0) == 6"
9211 [(set_attr "type" "store")
9212 (set_attr "update" "yes")
9213 (set_attr "indexed" "yes")
9214 (set_attr "cell_micro" "always")])
9216 (define_insn "*stmsi4"
9217 [(match_parallel 0 "store_multiple_operation"
9218 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9219 (match_operand:SI 2 "gpc_reg_operand" "r"))
9220 (clobber (match_scratch:SI 3 "=X"))
9221 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9222 (match_operand:SI 4 "gpc_reg_operand" "r"))
9223 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9224 (match_operand:SI 5 "gpc_reg_operand" "r"))
9225 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9226 (match_operand:SI 6 "gpc_reg_operand" "r"))])]
9227 "TARGET_STRING && XVECLEN (operands[0], 0) == 5"
9229 [(set_attr "type" "store")
9230 (set_attr "update" "yes")
9231 (set_attr "indexed" "yes")
9232 (set_attr "cell_micro" "always")])
9234 (define_insn "*stmsi3"
9235 [(match_parallel 0 "store_multiple_operation"
9236 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9237 (match_operand:SI 2 "gpc_reg_operand" "r"))
9238 (clobber (match_scratch:SI 3 "=X"))
9239 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9240 (match_operand:SI 4 "gpc_reg_operand" "r"))
9241 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9242 (match_operand:SI 5 "gpc_reg_operand" "r"))])]
9243 "TARGET_STRING && XVECLEN (operands[0], 0) == 4"
9245 [(set_attr "type" "store")
9246 (set_attr "update" "yes")
9247 (set_attr "indexed" "yes")
9248 (set_attr "cell_micro" "always")])
9250 (define_expand "setmemsi"
9251 [(parallel [(set (match_operand:BLK 0 "" "")
9252 (match_operand 2 "const_int_operand" ""))
9253 (use (match_operand:SI 1 "" ""))
9254 (use (match_operand:SI 3 "" ""))])]
9258 /* If value to set is not zero, use the library routine. */
9259 if (operands[2] != const0_rtx)
9262 if (expand_block_clear (operands))
9268 ;; String/block move insn.
9269 ;; Argument 0 is the destination
9270 ;; Argument 1 is the source
9271 ;; Argument 2 is the length
9272 ;; Argument 3 is the alignment
9274 (define_expand "movmemsi"
9275 [(parallel [(set (match_operand:BLK 0 "" "")
9276 (match_operand:BLK 1 "" ""))
9277 (use (match_operand:SI 2 "" ""))
9278 (use (match_operand:SI 3 "" ""))])]
9282 if (expand_block_move (operands))
9288 ;; Move up to 32 bytes at a time. The fixed registers are needed because the
9289 ;; register allocator doesn't have a clue about allocating 8 word registers.
9290 ;; rD/rS = r5 is preferred, efficient form.
9291 (define_expand "movmemsi_8reg"
9292 [(parallel [(set (match_operand 0 "" "")
9293 (match_operand 1 "" ""))
9294 (use (match_operand 2 "" ""))
9295 (use (match_operand 3 "" ""))
9296 (clobber (reg:SI 5))
9297 (clobber (reg:SI 6))
9298 (clobber (reg:SI 7))
9299 (clobber (reg:SI 8))
9300 (clobber (reg:SI 9))
9301 (clobber (reg:SI 10))
9302 (clobber (reg:SI 11))
9303 (clobber (reg:SI 12))
9304 (clobber (match_scratch:SI 4 ""))])]
9309 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
9310 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
9311 (use (match_operand:SI 2 "immediate_operand" "i"))
9312 (use (match_operand:SI 3 "immediate_operand" "i"))
9313 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
9314 (clobber (reg:SI 6))
9315 (clobber (reg:SI 7))
9316 (clobber (reg:SI 8))
9317 (clobber (reg:SI 9))
9318 (clobber (reg:SI 10))
9319 (clobber (reg:SI 11))
9320 (clobber (reg:SI 12))
9321 (clobber (match_scratch:SI 5 "=X"))]
9323 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
9324 || INTVAL (operands[2]) == 0)
9325 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
9326 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
9327 && REGNO (operands[4]) == 5"
9328 "lswi %4,%1,%2\;stswi %4,%0,%2"
9329 [(set_attr "type" "store")
9330 (set_attr "update" "yes")
9331 (set_attr "indexed" "yes")
9332 (set_attr "cell_micro" "always")
9333 (set_attr "length" "8")])
9335 ;; Move up to 24 bytes at a time. The fixed registers are needed because the
9336 ;; register allocator doesn't have a clue about allocating 6 word registers.
9337 ;; rD/rS = r5 is preferred, efficient form.
9338 (define_expand "movmemsi_6reg"
9339 [(parallel [(set (match_operand 0 "" "")
9340 (match_operand 1 "" ""))
9341 (use (match_operand 2 "" ""))
9342 (use (match_operand 3 "" ""))
9343 (clobber (reg:SI 5))
9344 (clobber (reg:SI 6))
9345 (clobber (reg:SI 7))
9346 (clobber (reg:SI 8))
9347 (clobber (reg:SI 9))
9348 (clobber (reg:SI 10))
9349 (clobber (match_scratch:SI 4 ""))])]
9354 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
9355 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
9356 (use (match_operand:SI 2 "immediate_operand" "i"))
9357 (use (match_operand:SI 3 "immediate_operand" "i"))
9358 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
9359 (clobber (reg:SI 6))
9360 (clobber (reg:SI 7))
9361 (clobber (reg:SI 8))
9362 (clobber (reg:SI 9))
9363 (clobber (reg:SI 10))
9364 (clobber (match_scratch:SI 5 "=X"))]
9366 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
9367 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
9368 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
9369 && REGNO (operands[4]) == 5"
9370 "lswi %4,%1,%2\;stswi %4,%0,%2"
9371 [(set_attr "type" "store")
9372 (set_attr "update" "yes")
9373 (set_attr "indexed" "yes")
9374 (set_attr "cell_micro" "always")
9375 (set_attr "length" "8")])
9377 ;; Move up to 16 bytes at a time, using 4 fixed registers to avoid spill
9378 ;; problems with TImode.
9379 ;; rD/rS = r5 is preferred, efficient form.
9380 (define_expand "movmemsi_4reg"
9381 [(parallel [(set (match_operand 0 "" "")
9382 (match_operand 1 "" ""))
9383 (use (match_operand 2 "" ""))
9384 (use (match_operand 3 "" ""))
9385 (clobber (reg:SI 5))
9386 (clobber (reg:SI 6))
9387 (clobber (reg:SI 7))
9388 (clobber (reg:SI 8))
9389 (clobber (match_scratch:SI 4 ""))])]
9394 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
9395 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
9396 (use (match_operand:SI 2 "immediate_operand" "i"))
9397 (use (match_operand:SI 3 "immediate_operand" "i"))
9398 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
9399 (clobber (reg:SI 6))
9400 (clobber (reg:SI 7))
9401 (clobber (reg:SI 8))
9402 (clobber (match_scratch:SI 5 "=X"))]
9404 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
9405 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
9406 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
9407 && REGNO (operands[4]) == 5"
9408 "lswi %4,%1,%2\;stswi %4,%0,%2"
9409 [(set_attr "type" "store")
9410 (set_attr "update" "yes")
9411 (set_attr "indexed" "yes")
9412 (set_attr "cell_micro" "always")
9413 (set_attr "length" "8")])
9415 ;; Move up to 8 bytes at a time.
9416 (define_expand "movmemsi_2reg"
9417 [(parallel [(set (match_operand 0 "" "")
9418 (match_operand 1 "" ""))
9419 (use (match_operand 2 "" ""))
9420 (use (match_operand 3 "" ""))
9421 (clobber (match_scratch:DI 4 ""))
9422 (clobber (match_scratch:SI 5 ""))])]
9423 "TARGET_STRING && ! TARGET_POWERPC64"
9427 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9428 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9429 (use (match_operand:SI 2 "immediate_operand" "i"))
9430 (use (match_operand:SI 3 "immediate_operand" "i"))
9431 (clobber (match_scratch:DI 4 "=&r"))
9432 (clobber (match_scratch:SI 5 "=X"))]
9433 "TARGET_STRING && ! TARGET_POWERPC64
9434 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
9435 "lswi %4,%1,%2\;stswi %4,%0,%2"
9436 [(set_attr "type" "store")
9437 (set_attr "update" "yes")
9438 (set_attr "indexed" "yes")
9439 (set_attr "cell_micro" "always")
9440 (set_attr "length" "8")])
9442 ;; Move up to 4 bytes at a time.
9443 (define_expand "movmemsi_1reg"
9444 [(parallel [(set (match_operand 0 "" "")
9445 (match_operand 1 "" ""))
9446 (use (match_operand 2 "" ""))
9447 (use (match_operand 3 "" ""))
9448 (clobber (match_scratch:SI 4 ""))
9449 (clobber (match_scratch:SI 5 ""))])]
9454 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
9455 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
9456 (use (match_operand:SI 2 "immediate_operand" "i"))
9457 (use (match_operand:SI 3 "immediate_operand" "i"))
9458 (clobber (match_scratch:SI 4 "=&r"))
9459 (clobber (match_scratch:SI 5 "=X"))]
9460 "TARGET_STRING && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
9461 "lswi %4,%1,%2\;stswi %4,%0,%2"
9462 [(set_attr "type" "store")
9463 (set_attr "update" "yes")
9464 (set_attr "indexed" "yes")
9465 (set_attr "cell_micro" "always")
9466 (set_attr "length" "8")])
9468 ;; Define insns that do load or store with update. Some of these we can
9469 ;; get by using pre-decrement or pre-increment, but the hardware can also
9470 ;; do cases where the increment is not the size of the object.
9472 ;; In all these cases, we use operands 0 and 1 for the register being
9473 ;; incremented because those are the operands that local-alloc will
9474 ;; tie and these are the pair most likely to be tieable (and the ones
9475 ;; that will benefit the most).
9477 (define_insn "*movdi_update1"
9478 [(set (match_operand:DI 3 "gpc_reg_operand" "=r,r")
9479 (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
9480 (match_operand:DI 2 "reg_or_aligned_short_operand" "r,I"))))
9481 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
9482 (plus:DI (match_dup 1) (match_dup 2)))]
9483 "TARGET_POWERPC64 && TARGET_UPDATE
9484 && (!avoiding_indexed_address_p (DImode)
9485 || !gpc_reg_operand (operands[2], DImode))"
9489 [(set_attr "type" "load")
9490 (set_attr "update" "yes")
9491 (set_attr "indexed" "yes,no")])
9493 (define_insn "movdi_<mode>_update"
9494 [(set (mem:DI (plus:P (match_operand:P 1 "gpc_reg_operand" "0,0")
9495 (match_operand:P 2 "reg_or_aligned_short_operand" "r,I")))
9496 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
9497 (set (match_operand:P 0 "gpc_reg_operand" "=b,b")
9498 (plus:P (match_dup 1) (match_dup 2)))]
9499 "TARGET_POWERPC64 && TARGET_UPDATE
9500 && (!avoiding_indexed_address_p (Pmode)
9501 || !gpc_reg_operand (operands[2], Pmode)
9502 || (REG_P (operands[0])
9503 && REGNO (operands[0]) == STACK_POINTER_REGNUM))"
9507 [(set_attr "type" "store")
9508 (set_attr "update" "yes")
9509 (set_attr "indexed" "yes,no")])
9511 ;; This pattern is only conditional on TARGET_POWERPC64, as it is
9512 ;; needed for stack allocation, even if the user passes -mno-update.
9513 (define_insn "movdi_<mode>_update_stack"
9514 [(set (mem:DI (plus:P (match_operand:P 1 "gpc_reg_operand" "0,0")
9515 (match_operand:P 2 "reg_or_aligned_short_operand" "r,I")))
9516 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
9517 (set (match_operand:P 0 "gpc_reg_operand" "=b,b")
9518 (plus:P (match_dup 1) (match_dup 2)))]
9523 [(set_attr "type" "store")
9524 (set_attr "update" "yes")
9525 (set_attr "indexed" "yes,no")])
9527 (define_insn "*movsi_update1"
9528 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9529 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9530 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9531 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9532 (plus:SI (match_dup 1) (match_dup 2)))]
9534 && (!avoiding_indexed_address_p (SImode)
9535 || !gpc_reg_operand (operands[2], SImode))"
9539 [(set_attr "type" "load")
9540 (set_attr "update" "yes")
9541 (set_attr "indexed" "yes,no")])
9543 (define_insn "*movsi_update2"
9544 [(set (match_operand:DI 3 "gpc_reg_operand" "=r")
9546 (mem:SI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0")
9547 (match_operand:DI 2 "gpc_reg_operand" "r")))))
9548 (set (match_operand:DI 0 "gpc_reg_operand" "=b")
9549 (plus:DI (match_dup 1) (match_dup 2)))]
9550 "TARGET_POWERPC64 && rs6000_gen_cell_microcode
9551 && !avoiding_indexed_address_p (DImode)"
9553 [(set_attr "type" "load")
9554 (set_attr "sign_extend" "yes")
9555 (set_attr "update" "yes")
9556 (set_attr "indexed" "yes")])
9558 (define_insn "movsi_update"
9559 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9560 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9561 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
9562 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9563 (plus:SI (match_dup 1) (match_dup 2)))]
9565 && (!avoiding_indexed_address_p (SImode)
9566 || !gpc_reg_operand (operands[2], SImode)
9567 || (REG_P (operands[0])
9568 && REGNO (operands[0]) == STACK_POINTER_REGNUM))"
9572 [(set_attr "type" "store")
9573 (set_attr "update" "yes")
9574 (set_attr "indexed" "yes,no")])
9576 ;; This is an unconditional pattern; needed for stack allocation, even
9577 ;; if the user passes -mno-update.
9578 (define_insn "movsi_update_stack"
9579 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9580 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9581 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
9582 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9583 (plus:SI (match_dup 1) (match_dup 2)))]
9588 [(set_attr "type" "store")
9589 (set_attr "update" "yes")
9590 (set_attr "indexed" "yes,no")])
9592 (define_insn "*movhi_update1"
9593 [(set (match_operand:HI 3 "gpc_reg_operand" "=r,r")
9594 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9595 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9596 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9597 (plus:SI (match_dup 1) (match_dup 2)))]
9599 && (!avoiding_indexed_address_p (SImode)
9600 || !gpc_reg_operand (operands[2], SImode))"
9604 [(set_attr "type" "load")
9605 (set_attr "update" "yes")
9606 (set_attr "indexed" "yes,no")])
9608 (define_insn "*movhi_update2"
9609 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9611 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9612 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9613 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9614 (plus:SI (match_dup 1) (match_dup 2)))]
9616 && (!avoiding_indexed_address_p (SImode)
9617 || !gpc_reg_operand (operands[2], SImode))"
9621 [(set_attr "type" "load")
9622 (set_attr "update" "yes")
9623 (set_attr "indexed" "yes,no")])
9625 (define_insn "*movhi_update3"
9626 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9628 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9629 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9630 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9631 (plus:SI (match_dup 1) (match_dup 2)))]
9632 "TARGET_UPDATE && rs6000_gen_cell_microcode
9633 && (!avoiding_indexed_address_p (SImode)
9634 || !gpc_reg_operand (operands[2], SImode))"
9638 [(set_attr "type" "load")
9639 (set_attr "sign_extend" "yes")
9640 (set_attr "update" "yes")
9641 (set_attr "indexed" "yes,no")])
9643 (define_insn "*movhi_update4"
9644 [(set (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9645 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9646 (match_operand:HI 3 "gpc_reg_operand" "r,r"))
9647 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9648 (plus:SI (match_dup 1) (match_dup 2)))]
9650 && (!avoiding_indexed_address_p (SImode)
9651 || !gpc_reg_operand (operands[2], SImode))"
9655 [(set_attr "type" "store")
9656 (set_attr "update" "yes")
9657 (set_attr "indexed" "yes,no")])
9659 (define_insn "*movqi_update1"
9660 [(set (match_operand:QI 3 "gpc_reg_operand" "=r,r")
9661 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9662 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9663 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9664 (plus:SI (match_dup 1) (match_dup 2)))]
9666 && (!avoiding_indexed_address_p (SImode)
9667 || !gpc_reg_operand (operands[2], SImode))"
9671 [(set_attr "type" "load")
9672 (set_attr "update" "yes")
9673 (set_attr "indexed" "yes,no")])
9675 (define_insn "*movqi_update2"
9676 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9678 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9679 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9680 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9681 (plus:SI (match_dup 1) (match_dup 2)))]
9683 && (!avoiding_indexed_address_p (SImode)
9684 || !gpc_reg_operand (operands[2], SImode))"
9688 [(set_attr "type" "load")
9689 (set_attr "update" "yes")
9690 (set_attr "indexed" "yes,no")])
9692 (define_insn "*movqi_update3"
9693 [(set (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9694 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9695 (match_operand:QI 3 "gpc_reg_operand" "r,r"))
9696 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9697 (plus:SI (match_dup 1) (match_dup 2)))]
9699 && (!avoiding_indexed_address_p (SImode)
9700 || !gpc_reg_operand (operands[2], SImode))"
9704 [(set_attr "type" "store")
9705 (set_attr "update" "yes")
9706 (set_attr "indexed" "yes,no")])
9708 (define_insn "*movsf_update1"
9709 [(set (match_operand:SF 3 "gpc_reg_operand" "=f,f")
9710 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9711 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9712 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9713 (plus:SI (match_dup 1) (match_dup 2)))]
9714 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT && TARGET_UPDATE
9715 && (!avoiding_indexed_address_p (SImode)
9716 || !gpc_reg_operand (operands[2], SImode))"
9720 [(set_attr "type" "fpload")
9721 (set_attr "update" "yes")
9722 (set_attr "indexed" "yes,no")])
9724 (define_insn "*movsf_update2"
9725 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9726 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9727 (match_operand:SF 3 "gpc_reg_operand" "f,f"))
9728 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9729 (plus:SI (match_dup 1) (match_dup 2)))]
9730 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT && TARGET_UPDATE
9731 && (!avoiding_indexed_address_p (SImode)
9732 || !gpc_reg_operand (operands[2], SImode))"
9736 [(set_attr "type" "fpstore")
9737 (set_attr "update" "yes")
9738 (set_attr "indexed" "yes,no")])
9740 (define_insn "*movsf_update3"
9741 [(set (match_operand:SF 3 "gpc_reg_operand" "=r,r")
9742 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9743 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9744 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9745 (plus:SI (match_dup 1) (match_dup 2)))]
9746 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE
9747 && (!avoiding_indexed_address_p (SImode)
9748 || !gpc_reg_operand (operands[2], SImode))"
9752 [(set_attr "type" "load")
9753 (set_attr "update" "yes")
9754 (set_attr "indexed" "yes,no")])
9756 (define_insn "*movsf_update4"
9757 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9758 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9759 (match_operand:SF 3 "gpc_reg_operand" "r,r"))
9760 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9761 (plus:SI (match_dup 1) (match_dup 2)))]
9762 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE
9763 && (!avoiding_indexed_address_p (SImode)
9764 || !gpc_reg_operand (operands[2], SImode))"
9768 [(set_attr "type" "store")
9769 (set_attr "update" "yes")
9770 (set_attr "indexed" "yes,no")])
9772 (define_insn "*movdf_update1"
9773 [(set (match_operand:DF 3 "gpc_reg_operand" "=d,d")
9774 (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9775 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9776 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9777 (plus:SI (match_dup 1) (match_dup 2)))]
9778 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_UPDATE
9779 && (!avoiding_indexed_address_p (SImode)
9780 || !gpc_reg_operand (operands[2], SImode))"
9784 [(set_attr "type" "fpload")
9785 (set_attr "update" "yes")
9786 (set_attr "indexed" "yes,no")])
9788 (define_insn "*movdf_update2"
9789 [(set (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9790 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9791 (match_operand:DF 3 "gpc_reg_operand" "d,d"))
9792 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9793 (plus:SI (match_dup 1) (match_dup 2)))]
9794 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_UPDATE
9795 && (!avoiding_indexed_address_p (SImode)
9796 || !gpc_reg_operand (operands[2], SImode))"
9800 [(set_attr "type" "fpstore")
9801 (set_attr "update" "yes")
9802 (set_attr "indexed" "yes,no")])
9805 ;; After inserting conditional returns we can sometimes have
9806 ;; unnecessary register moves. Unfortunately we cannot have a
9807 ;; modeless peephole here, because some single SImode sets have early
9808 ;; clobber outputs. Although those sets expand to multi-ppc-insn
9809 ;; sequences, using get_attr_length here will smash the operands
9810 ;; array. Neither is there an early_cobbler_p predicate.
9811 ;; Disallow subregs for E500 so we don't munge frob_di_df_2.
9813 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9814 (match_operand:DF 1 "any_operand" ""))
9815 (set (match_operand:DF 2 "gpc_reg_operand" "")
9817 "!(TARGET_E500_DOUBLE && GET_CODE (operands[2]) == SUBREG)
9818 && peep2_reg_dead_p (2, operands[0])"
9819 [(set (match_dup 2) (match_dup 1))])
9822 [(set (match_operand:SF 0 "gpc_reg_operand" "")
9823 (match_operand:SF 1 "any_operand" ""))
9824 (set (match_operand:SF 2 "gpc_reg_operand" "")
9826 "peep2_reg_dead_p (2, operands[0])"
9827 [(set (match_dup 2) (match_dup 1))])
9832 ;; Mode attributes for different ABIs.
9833 (define_mode_iterator TLSmode [(SI "! TARGET_64BIT") (DI "TARGET_64BIT")])
9834 (define_mode_attr tls_abi_suffix [(SI "32") (DI "64")])
9835 (define_mode_attr tls_sysv_suffix [(SI "si") (DI "di")])
9836 (define_mode_attr tls_insn_suffix [(SI "wz") (DI "d")])
9838 (define_insn_and_split "tls_gd_aix<TLSmode:tls_abi_suffix>"
9839 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
9840 (call (mem:TLSmode (match_operand:TLSmode 3 "symbol_ref_operand" "s"))
9841 (match_operand 4 "" "g")))
9842 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
9843 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
9845 (clobber (reg:SI LR_REGNO))]
9846 "HAVE_AS_TLS && (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)"
9848 if (TARGET_CMODEL != CMODEL_SMALL)
9849 return "addis %0,%1,%2@got@tlsgd@ha\;addi %0,%0,%2@got@tlsgd@l\;"
9852 return "addi %0,%1,%2@got@tlsgd\;bl %z3\;nop";
9854 "&& TARGET_TLS_MARKERS"
9856 (unspec:TLSmode [(match_dup 1)
9859 (parallel [(set (match_dup 0)
9860 (call (mem:TLSmode (match_dup 3))
9862 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD)
9863 (clobber (reg:SI LR_REGNO))])]
9865 [(set_attr "type" "two")
9866 (set (attr "length")
9867 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
9871 (define_insn_and_split "tls_gd_sysv<TLSmode:tls_sysv_suffix>"
9872 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
9873 (call (mem:TLSmode (match_operand:TLSmode 3 "symbol_ref_operand" "s"))
9874 (match_operand 4 "" "g")))
9875 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
9876 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
9878 (clobber (reg:SI LR_REGNO))]
9879 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4"
9883 if (TARGET_SECURE_PLT && flag_pic == 2)
9884 return "addi %0,%1,%2@got@tlsgd\;bl %z3+32768@plt";
9886 return "addi %0,%1,%2@got@tlsgd\;bl %z3@plt";
9889 return "addi %0,%1,%2@got@tlsgd\;bl %z3";
9891 "&& TARGET_TLS_MARKERS"
9893 (unspec:TLSmode [(match_dup 1)
9896 (parallel [(set (match_dup 0)
9897 (call (mem:TLSmode (match_dup 3))
9899 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD)
9900 (clobber (reg:SI LR_REGNO))])]
9902 [(set_attr "type" "two")
9903 (set_attr "length" "8")])
9905 (define_insn_and_split "*tls_gd<TLSmode:tls_abi_suffix>"
9906 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
9907 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
9908 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
9910 "HAVE_AS_TLS && TARGET_TLS_MARKERS"
9911 "addi %0,%1,%2@got@tlsgd"
9912 "&& TARGET_CMODEL != CMODEL_SMALL"
9915 (unspec:TLSmode [(match_dup 1) (match_dup 2)] UNSPEC_TLSGD)))
9917 (lo_sum:TLSmode (match_dup 3)
9918 (unspec:TLSmode [(match_dup 1) (match_dup 2)] UNSPEC_TLSGD)))]
9921 operands[3] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
9923 [(set (attr "length")
9924 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
9928 (define_insn "*tls_gd_high<TLSmode:tls_abi_suffix>"
9929 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
9931 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
9932 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
9934 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
9935 "addis %0,%1,%2@got@tlsgd@ha"
9936 [(set_attr "length" "4")])
9938 (define_insn "*tls_gd_low<TLSmode:tls_abi_suffix>"
9939 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
9940 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
9941 (unspec:TLSmode [(match_operand:TLSmode 3 "gpc_reg_operand" "b")
9942 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
9944 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
9945 "addi %0,%1,%2@got@tlsgd@l"
9946 [(set_attr "length" "4")])
9948 (define_insn "*tls_gd_call_aix<TLSmode:tls_abi_suffix>"
9949 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
9950 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
9951 (match_operand 2 "" "g")))
9952 (unspec:TLSmode [(match_operand:TLSmode 3 "rs6000_tls_symbol_ref" "")]
9954 (clobber (reg:SI LR_REGNO))]
9955 "HAVE_AS_TLS && TARGET_TLS_MARKERS
9956 && (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)"
9957 "bl %z1(%3@tlsgd)\;nop"
9958 [(set_attr "type" "branch")
9959 (set_attr "length" "8")])
9961 (define_insn "*tls_gd_call_sysv<TLSmode:tls_abi_suffix>"
9962 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
9963 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
9964 (match_operand 2 "" "g")))
9965 (unspec:TLSmode [(match_operand:TLSmode 3 "rs6000_tls_symbol_ref" "")]
9967 (clobber (reg:SI LR_REGNO))]
9968 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4 && TARGET_TLS_MARKERS"
9972 if (TARGET_SECURE_PLT && flag_pic == 2)
9973 return "bl %z1+32768(%3@tlsgd)@plt";
9974 return "bl %z1(%3@tlsgd)@plt";
9976 return "bl %z1(%3@tlsgd)";
9978 [(set_attr "type" "branch")
9979 (set_attr "length" "4")])
9981 (define_insn_and_split "tls_ld_aix<TLSmode:tls_abi_suffix>"
9982 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
9983 (call (mem:TLSmode (match_operand:TLSmode 2 "symbol_ref_operand" "s"))
9984 (match_operand 3 "" "g")))
9985 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
9987 (clobber (reg:SI LR_REGNO))]
9988 "HAVE_AS_TLS && (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)"
9990 if (TARGET_CMODEL != CMODEL_SMALL)
9991 return "addis %0,%1,%&@got@tlsld@ha\;addi %0,%0,%&@got@tlsld@l\;"
9994 return "addi %0,%1,%&@got@tlsld\;bl %z2\;nop";
9996 "&& TARGET_TLS_MARKERS"
9998 (unspec:TLSmode [(match_dup 1)]
10000 (parallel [(set (match_dup 0)
10001 (call (mem:TLSmode (match_dup 2))
10003 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
10004 (clobber (reg:SI LR_REGNO))])]
10006 [(set_attr "type" "two")
10007 (set (attr "length")
10008 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
10012 (define_insn_and_split "tls_ld_sysv<TLSmode:tls_sysv_suffix>"
10013 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10014 (call (mem:TLSmode (match_operand:TLSmode 2 "symbol_ref_operand" "s"))
10015 (match_operand 3 "" "g")))
10016 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
10018 (clobber (reg:SI LR_REGNO))]
10019 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4"
10023 if (TARGET_SECURE_PLT && flag_pic == 2)
10024 return "addi %0,%1,%&@got@tlsld\;bl %z2+32768@plt";
10026 return "addi %0,%1,%&@got@tlsld\;bl %z2@plt";
10029 return "addi %0,%1,%&@got@tlsld\;bl %z2";
10031 "&& TARGET_TLS_MARKERS"
10032 [(set (match_dup 0)
10033 (unspec:TLSmode [(match_dup 1)]
10035 (parallel [(set (match_dup 0)
10036 (call (mem:TLSmode (match_dup 2))
10038 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
10039 (clobber (reg:SI LR_REGNO))])]
10041 [(set_attr "length" "8")])
10043 (define_insn_and_split "*tls_ld<TLSmode:tls_abi_suffix>"
10044 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10045 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
10047 "HAVE_AS_TLS && TARGET_TLS_MARKERS"
10048 "addi %0,%1,%&@got@tlsld"
10049 "&& TARGET_CMODEL != CMODEL_SMALL"
10050 [(set (match_dup 2)
10052 (unspec:TLSmode [(const_int 0) (match_dup 1)] UNSPEC_TLSLD)))
10054 (lo_sum:TLSmode (match_dup 2)
10055 (unspec:TLSmode [(const_int 0) (match_dup 1)] UNSPEC_TLSLD)))]
10058 operands[2] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
10060 [(set (attr "length")
10061 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
10065 (define_insn "*tls_ld_high<TLSmode:tls_abi_suffix>"
10066 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10068 (unspec:TLSmode [(const_int 0)
10069 (match_operand:TLSmode 1 "gpc_reg_operand" "b")]
10071 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
10072 "addis %0,%1,%&@got@tlsld@ha"
10073 [(set_attr "length" "4")])
10075 (define_insn "*tls_ld_low<TLSmode:tls_abi_suffix>"
10076 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10077 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
10078 (unspec:TLSmode [(const_int 0)
10079 (match_operand:TLSmode 2 "gpc_reg_operand" "b")]
10081 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
10082 "addi %0,%1,%&@got@tlsld@l"
10083 [(set_attr "length" "4")])
10085 (define_insn "*tls_ld_call_aix<TLSmode:tls_abi_suffix>"
10086 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10087 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
10088 (match_operand 2 "" "g")))
10089 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
10090 (clobber (reg:SI LR_REGNO))]
10091 "HAVE_AS_TLS && TARGET_TLS_MARKERS
10092 && (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)"
10093 "bl %z1(%&@tlsld)\;nop"
10094 [(set_attr "type" "branch")
10095 (set_attr "length" "8")])
10097 (define_insn "*tls_ld_call_sysv<TLSmode:tls_abi_suffix>"
10098 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10099 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
10100 (match_operand 2 "" "g")))
10101 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
10102 (clobber (reg:SI LR_REGNO))]
10103 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4 && TARGET_TLS_MARKERS"
10107 if (TARGET_SECURE_PLT && flag_pic == 2)
10108 return "bl %z1+32768(%&@tlsld)@plt";
10109 return "bl %z1(%&@tlsld)@plt";
10111 return "bl %z1(%&@tlsld)";
10113 [(set_attr "type" "branch")
10114 (set_attr "length" "4")])
10116 (define_insn "tls_dtprel_<TLSmode:tls_abi_suffix>"
10117 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
10118 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10119 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10120 UNSPEC_TLSDTPREL))]
10122 "addi %0,%1,%2@dtprel")
10124 (define_insn "tls_dtprel_ha_<TLSmode:tls_abi_suffix>"
10125 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
10126 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10127 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10128 UNSPEC_TLSDTPRELHA))]
10130 "addis %0,%1,%2@dtprel@ha")
10132 (define_insn "tls_dtprel_lo_<TLSmode:tls_abi_suffix>"
10133 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
10134 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10135 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10136 UNSPEC_TLSDTPRELLO))]
10138 "addi %0,%1,%2@dtprel@l")
10140 (define_insn_and_split "tls_got_dtprel_<TLSmode:tls_abi_suffix>"
10141 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
10142 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10143 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10144 UNSPEC_TLSGOTDTPREL))]
10146 "l<TLSmode:tls_insn_suffix> %0,%2@got@dtprel(%1)"
10147 "&& TARGET_CMODEL != CMODEL_SMALL"
10148 [(set (match_dup 3)
10150 (unspec:TLSmode [(match_dup 1) (match_dup 2)] UNSPEC_TLSGOTDTPREL)))
10152 (lo_sum:TLSmode (match_dup 3)
10153 (unspec:TLSmode [(match_dup 1) (match_dup 2)] UNSPEC_TLSGOTDTPREL)))]
10156 operands[3] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
10158 [(set (attr "length")
10159 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
10163 (define_insn "*tls_got_dtprel_high<TLSmode:tls_abi_suffix>"
10164 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10166 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10167 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10168 UNSPEC_TLSGOTDTPREL)))]
10169 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
10170 "addis %0,%1,%2@got@dtprel@ha"
10171 [(set_attr "length" "4")])
10173 (define_insn "*tls_got_dtprel_low<TLSmode:tls_abi_suffix>"
10174 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
10175 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
10176 (unspec:TLSmode [(match_operand:TLSmode 3 "gpc_reg_operand" "b")
10177 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10178 UNSPEC_TLSGOTDTPREL)))]
10179 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
10180 "l<TLSmode:tls_insn_suffix> %0,%2@got@dtprel@l(%1)"
10181 [(set_attr "length" "4")])
10183 (define_insn "tls_tprel_<TLSmode:tls_abi_suffix>"
10184 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
10185 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10186 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10189 "addi %0,%1,%2@tprel")
10191 (define_insn "tls_tprel_ha_<TLSmode:tls_abi_suffix>"
10192 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
10193 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10194 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10195 UNSPEC_TLSTPRELHA))]
10197 "addis %0,%1,%2@tprel@ha")
10199 (define_insn "tls_tprel_lo_<TLSmode:tls_abi_suffix>"
10200 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
10201 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10202 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10203 UNSPEC_TLSTPRELLO))]
10205 "addi %0,%1,%2@tprel@l")
10207 ;; "b" output constraint here and on tls_tls input to support linker tls
10208 ;; optimization. The linker may edit the instructions emitted by a
10209 ;; tls_got_tprel/tls_tls pair to addis,addi.
10210 (define_insn_and_split "tls_got_tprel_<TLSmode:tls_abi_suffix>"
10211 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10212 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10213 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10214 UNSPEC_TLSGOTTPREL))]
10216 "l<TLSmode:tls_insn_suffix> %0,%2@got@tprel(%1)"
10217 "&& TARGET_CMODEL != CMODEL_SMALL"
10218 [(set (match_dup 3)
10220 (unspec:TLSmode [(match_dup 1) (match_dup 2)] UNSPEC_TLSGOTTPREL)))
10222 (lo_sum:TLSmode (match_dup 3)
10223 (unspec:TLSmode [(match_dup 1) (match_dup 2)] UNSPEC_TLSGOTTPREL)))]
10226 operands[3] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
10228 [(set (attr "length")
10229 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
10233 (define_insn "*tls_got_tprel_high<TLSmode:tls_abi_suffix>"
10234 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10236 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10237 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10238 UNSPEC_TLSGOTTPREL)))]
10239 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
10240 "addis %0,%1,%2@got@tprel@ha"
10241 [(set_attr "length" "4")])
10243 (define_insn "*tls_got_tprel_low<TLSmode:tls_abi_suffix>"
10244 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
10245 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
10246 (unspec:TLSmode [(match_operand:TLSmode 3 "gpc_reg_operand" "b")
10247 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10248 UNSPEC_TLSGOTTPREL)))]
10249 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
10250 "l<TLSmode:tls_insn_suffix> %0,%2@got@tprel@l(%1)"
10251 [(set_attr "length" "4")])
10253 (define_insn "tls_tls_<TLSmode:tls_abi_suffix>"
10254 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
10255 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10256 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10258 "TARGET_ELF && HAVE_AS_TLS"
10259 "add %0,%1,%2@tls")
10261 (define_expand "tls_get_tpointer"
10262 [(set (match_operand:SI 0 "gpc_reg_operand" "")
10263 (unspec:SI [(const_int 0)] UNSPEC_TLSTLS))]
10264 "TARGET_XCOFF && HAVE_AS_TLS"
10267 emit_insn (gen_tls_get_tpointer_internal ());
10268 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
10272 (define_insn "tls_get_tpointer_internal"
10274 (unspec:SI [(const_int 0)] UNSPEC_TLSTLS))
10275 (clobber (reg:SI LR_REGNO))]
10276 "TARGET_XCOFF && HAVE_AS_TLS"
10277 "bla __get_tpointer")
10279 (define_expand "tls_get_addr<mode>"
10280 [(set (match_operand:P 0 "gpc_reg_operand" "")
10281 (unspec:P [(match_operand:P 1 "gpc_reg_operand" "")
10282 (match_operand:P 2 "gpc_reg_operand" "")] UNSPEC_TLSTLS))]
10283 "TARGET_XCOFF && HAVE_AS_TLS"
10286 emit_move_insn (gen_rtx_REG (Pmode, 3), operands[1]);
10287 emit_move_insn (gen_rtx_REG (Pmode, 4), operands[2]);
10288 emit_insn (gen_tls_get_addr_internal<mode> ());
10289 emit_move_insn (operands[0], gen_rtx_REG (Pmode, 3));
10293 (define_insn "tls_get_addr_internal<mode>"
10295 (unspec:P [(reg:P 3) (reg:P 4)] UNSPEC_TLSTLS))
10296 (clobber (reg:P 0))
10297 (clobber (reg:P 4))
10298 (clobber (reg:P 5))
10299 (clobber (reg:P 11))
10300 (clobber (reg:CC CR0_REGNO))
10301 (clobber (reg:P LR_REGNO))]
10302 "TARGET_XCOFF && HAVE_AS_TLS"
10303 "bla __tls_get_addr")
10305 ;; Next come insns related to the calling sequence.
10307 ;; First, an insn to allocate new stack space for dynamic use (e.g., alloca).
10308 ;; We move the back-chain and decrement the stack pointer.
10310 (define_expand "allocate_stack"
10311 [(set (match_operand 0 "gpc_reg_operand" "")
10312 (minus (reg 1) (match_operand 1 "reg_or_short_operand" "")))
10314 (minus (reg 1) (match_dup 1)))]
10317 { rtx chain = gen_reg_rtx (Pmode);
10318 rtx stack_bot = gen_rtx_MEM (Pmode, stack_pointer_rtx);
10320 rtx insn, par, set, mem;
10322 emit_move_insn (chain, stack_bot);
10324 /* Check stack bounds if necessary. */
10325 if (crtl->limit_stack)
10328 available = expand_binop (Pmode, sub_optab,
10329 stack_pointer_rtx, stack_limit_rtx,
10330 NULL_RTX, 1, OPTAB_WIDEN);
10331 emit_insn (gen_cond_trap (LTU, available, operands[1], const0_rtx));
10334 if (GET_CODE (operands[1]) != CONST_INT
10335 || INTVAL (operands[1]) < -32767
10336 || INTVAL (operands[1]) > 32768)
10338 neg_op0 = gen_reg_rtx (Pmode);
10340 emit_insn (gen_negsi2 (neg_op0, operands[1]));
10342 emit_insn (gen_negdi2 (neg_op0, operands[1]));
10345 neg_op0 = GEN_INT (- INTVAL (operands[1]));
10347 insn = emit_insn ((* ((TARGET_32BIT) ? gen_movsi_update_stack
10348 : gen_movdi_di_update_stack))
10349 (stack_pointer_rtx, stack_pointer_rtx, neg_op0,
10351 /* Since we didn't use gen_frame_mem to generate the MEM, grab
10352 it now and set the alias set/attributes. The above gen_*_update
10353 calls will generate a PARALLEL with the MEM set being the first
10355 par = PATTERN (insn);
10356 gcc_assert (GET_CODE (par) == PARALLEL);
10357 set = XVECEXP (par, 0, 0);
10358 gcc_assert (GET_CODE (set) == SET);
10359 mem = SET_DEST (set);
10360 gcc_assert (MEM_P (mem));
10361 MEM_NOTRAP_P (mem) = 1;
10362 set_mem_alias_set (mem, get_frame_alias_set ());
10364 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
10368 ;; These patterns say how to save and restore the stack pointer. We need not
10369 ;; save the stack pointer at function level since we are careful to
10370 ;; preserve the backchain. At block level, we have to restore the backchain
10371 ;; when we restore the stack pointer.
10373 ;; For nonlocal gotos, we must save both the stack pointer and its
10374 ;; backchain and restore both. Note that in the nonlocal case, the
10375 ;; save area is a memory location.
10377 (define_expand "save_stack_function"
10378 [(match_operand 0 "any_operand" "")
10379 (match_operand 1 "any_operand" "")]
10383 (define_expand "restore_stack_function"
10384 [(match_operand 0 "any_operand" "")
10385 (match_operand 1 "any_operand" "")]
10389 ;; Adjust stack pointer (op0) to a new value (op1).
10390 ;; First copy old stack backchain to new location, and ensure that the
10391 ;; scheduler won't reorder the sp assignment before the backchain write.
10392 (define_expand "restore_stack_block"
10393 [(set (match_dup 2) (match_dup 3))
10394 (set (match_dup 4) (match_dup 2))
10396 (set (match_operand 0 "register_operand" "")
10397 (match_operand 1 "register_operand" ""))]
10403 operands[1] = force_reg (Pmode, operands[1]);
10404 operands[2] = gen_reg_rtx (Pmode);
10405 operands[3] = gen_frame_mem (Pmode, operands[0]);
10406 operands[4] = gen_frame_mem (Pmode, operands[1]);
10407 p = rtvec_alloc (1);
10408 RTVEC_ELT (p, 0) = gen_rtx_SET (VOIDmode,
10409 gen_frame_mem (BLKmode, operands[0]),
10411 operands[5] = gen_rtx_PARALLEL (VOIDmode, p);
10414 (define_expand "save_stack_nonlocal"
10415 [(set (match_dup 3) (match_dup 4))
10416 (set (match_operand 0 "memory_operand" "") (match_dup 3))
10417 (set (match_dup 2) (match_operand 1 "register_operand" ""))]
10421 int units_per_word = (TARGET_32BIT) ? 4 : 8;
10423 /* Copy the backchain to the first word, sp to the second. */
10424 operands[0] = adjust_address_nv (operands[0], Pmode, 0);
10425 operands[2] = adjust_address_nv (operands[0], Pmode, units_per_word);
10426 operands[3] = gen_reg_rtx (Pmode);
10427 operands[4] = gen_frame_mem (Pmode, operands[1]);
10430 (define_expand "restore_stack_nonlocal"
10431 [(set (match_dup 2) (match_operand 1 "memory_operand" ""))
10432 (set (match_dup 3) (match_dup 4))
10433 (set (match_dup 5) (match_dup 2))
10435 (set (match_operand 0 "register_operand" "") (match_dup 3))]
10439 int units_per_word = (TARGET_32BIT) ? 4 : 8;
10442 /* Restore the backchain from the first word, sp from the second. */
10443 operands[2] = gen_reg_rtx (Pmode);
10444 operands[3] = gen_reg_rtx (Pmode);
10445 operands[1] = adjust_address_nv (operands[1], Pmode, 0);
10446 operands[4] = adjust_address_nv (operands[1], Pmode, units_per_word);
10447 operands[5] = gen_frame_mem (Pmode, operands[3]);
10448 p = rtvec_alloc (1);
10449 RTVEC_ELT (p, 0) = gen_rtx_SET (VOIDmode,
10450 gen_frame_mem (BLKmode, operands[0]),
10452 operands[6] = gen_rtx_PARALLEL (VOIDmode, p);
10455 ;; TOC register handling.
10457 ;; Code to initialize the TOC register...
10459 (define_insn "load_toc_aix_si"
10460 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10461 (unspec:SI [(const_int 0)] UNSPEC_TOC))
10462 (use (reg:SI 2))])]
10463 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2) && TARGET_32BIT"
10467 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
10468 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
10469 operands[2] = gen_rtx_REG (Pmode, 2);
10470 return \"lwz %0,%1(%2)\";
10472 [(set_attr "type" "load")
10473 (set_attr "update" "no")
10474 (set_attr "indexed" "no")])
10476 (define_insn "load_toc_aix_di"
10477 [(parallel [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10478 (unspec:DI [(const_int 0)] UNSPEC_TOC))
10479 (use (reg:DI 2))])]
10480 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2) && TARGET_64BIT"
10484 #ifdef TARGET_RELOCATABLE
10485 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\",
10486 !TARGET_MINIMAL_TOC || TARGET_RELOCATABLE);
10488 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
10491 strcat (buf, \"@toc\");
10492 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
10493 operands[2] = gen_rtx_REG (Pmode, 2);
10494 return \"ld %0,%1(%2)\";
10496 [(set_attr "type" "load")
10497 (set_attr "update" "no")
10498 (set_attr "indexed" "no")])
10500 (define_insn "load_toc_v4_pic_si"
10501 [(set (reg:SI LR_REGNO)
10502 (unspec:SI [(const_int 0)] UNSPEC_TOC))]
10503 "DEFAULT_ABI == ABI_V4 && flag_pic == 1 && TARGET_32BIT"
10504 "bl _GLOBAL_OFFSET_TABLE_@local-4"
10505 [(set_attr "type" "branch")
10506 (set_attr "length" "4")])
10508 (define_expand "load_toc_v4_PIC_1"
10509 [(parallel [(set (reg:SI LR_REGNO)
10510 (match_operand:SI 0 "immediate_operand" "s"))
10511 (use (unspec [(match_dup 0)] UNSPEC_TOC))])]
10512 "TARGET_ELF && DEFAULT_ABI == ABI_V4
10513 && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
10516 (define_insn "load_toc_v4_PIC_1_normal"
10517 [(set (reg:SI LR_REGNO)
10518 (match_operand:SI 0 "immediate_operand" "s"))
10519 (use (unspec [(match_dup 0)] UNSPEC_TOC))]
10520 "!TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI == ABI_V4
10521 && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
10522 "bcl 20,31,%0\\n%0:"
10523 [(set_attr "type" "branch")
10524 (set_attr "length" "4")])
10526 (define_insn "load_toc_v4_PIC_1_476"
10527 [(set (reg:SI LR_REGNO)
10528 (match_operand:SI 0 "immediate_operand" "s"))
10529 (use (unspec [(match_dup 0)] UNSPEC_TOC))]
10530 "TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI == ABI_V4
10531 && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
10535 static char templ[32];
10537 get_ppc476_thunk_name (name);
10538 sprintf (templ, \"bl %s\\n%%0:\", name);
10541 [(set_attr "type" "branch")
10542 (set_attr "length" "4")])
10544 (define_expand "load_toc_v4_PIC_1b"
10545 [(parallel [(set (reg:SI LR_REGNO)
10546 (unspec:SI [(match_operand:SI 0 "immediate_operand" "s")
10547 (label_ref (match_operand 1 "" ""))]
10550 "TARGET_ELF && DEFAULT_ABI == ABI_V4 && flag_pic == 2"
10553 (define_insn "load_toc_v4_PIC_1b_normal"
10554 [(set (reg:SI LR_REGNO)
10555 (unspec:SI [(match_operand:SI 0 "immediate_operand" "s")
10556 (label_ref (match_operand 1 "" ""))]
10559 "!TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI == ABI_V4 && flag_pic == 2"
10560 "bcl 20,31,$+8\;.long %0-$"
10561 [(set_attr "type" "branch")
10562 (set_attr "length" "8")])
10564 (define_insn "load_toc_v4_PIC_1b_476"
10565 [(set (reg:SI LR_REGNO)
10566 (unspec:SI [(match_operand:SI 0 "immediate_operand" "s")
10567 (label_ref (match_operand 1 "" ""))]
10570 "TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI == ABI_V4 && flag_pic == 2"
10574 static char templ[32];
10576 get_ppc476_thunk_name (name);
10577 sprintf (templ, \"bl %s\\n\\tb $+8\\n\\t.long %%0-$\", name);
10580 [(set_attr "type" "branch")
10581 (set_attr "length" "16")])
10583 (define_insn "load_toc_v4_PIC_2"
10584 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10585 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
10586 (minus:SI (match_operand:SI 2 "immediate_operand" "s")
10587 (match_operand:SI 3 "immediate_operand" "s")))))]
10588 "TARGET_ELF && DEFAULT_ABI == ABI_V4 && flag_pic == 2"
10590 [(set_attr "type" "load")])
10592 (define_insn "load_toc_v4_PIC_3b"
10593 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10594 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
10596 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
10597 (match_operand:SI 3 "symbol_ref_operand" "s")))))]
10598 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI == ABI_V4 && flag_pic"
10599 "addis %0,%1,%2-%3@ha")
10601 (define_insn "load_toc_v4_PIC_3c"
10602 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10603 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
10604 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
10605 (match_operand:SI 3 "symbol_ref_operand" "s"))))]
10606 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI == ABI_V4 && flag_pic"
10607 "addi %0,%1,%2-%3@l")
10609 ;; If the TOC is shared over a translation unit, as happens with all
10610 ;; the kinds of PIC that we support, we need to restore the TOC
10611 ;; pointer only when jumping over units of translation.
10612 ;; On Darwin, we need to reload the picbase.
10614 (define_expand "builtin_setjmp_receiver"
10615 [(use (label_ref (match_operand 0 "" "")))]
10616 "(DEFAULT_ABI == ABI_V4 && flag_pic == 1)
10617 || (TARGET_TOC && TARGET_MINIMAL_TOC)
10618 || (DEFAULT_ABI == ABI_DARWIN && flag_pic)"
10622 if (DEFAULT_ABI == ABI_DARWIN)
10624 rtx picrtx = gen_rtx_SYMBOL_REF (Pmode, MACHOPIC_FUNCTION_BASE_NAME);
10625 rtx picreg = gen_rtx_REG (Pmode, RS6000_PIC_OFFSET_TABLE_REGNUM);
10629 crtl->uses_pic_offset_table = 1;
10630 ASM_GENERATE_INTERNAL_LABEL(tmplab, \"LSJR\",
10631 CODE_LABEL_NUMBER (operands[0]));
10632 tmplabrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (tmplab));
10634 emit_insn (gen_load_macho_picbase (tmplabrtx));
10635 emit_move_insn (picreg, gen_rtx_REG (Pmode, LR_REGNO));
10636 emit_insn (gen_macho_correct_pic (picreg, picreg, picrtx, tmplabrtx));
10640 rs6000_emit_load_toc_table (FALSE);
10644 ;; Largetoc support
10645 (define_insn "*largetoc_high"
10646 [(set (match_operand:DI 0 "gpc_reg_operand" "=b*r")
10648 (unspec [(match_operand:DI 1 "" "")
10649 (match_operand:DI 2 "gpc_reg_operand" "b")]
10651 "TARGET_ELF && TARGET_CMODEL != CMODEL_SMALL"
10652 "addis %0,%2,%1@toc@ha")
10654 (define_insn "*largetoc_high_aix<mode>"
10655 [(set (match_operand:P 0 "gpc_reg_operand" "=b*r")
10657 (unspec [(match_operand:P 1 "" "")
10658 (match_operand:P 2 "gpc_reg_operand" "b")]
10660 "TARGET_XCOFF && TARGET_CMODEL != CMODEL_SMALL"
10661 "addis %0,%1@u(%2)")
10663 (define_insn "*largetoc_high_plus"
10664 [(set (match_operand:DI 0 "gpc_reg_operand" "=b*r")
10667 (unspec [(match_operand:DI 1 "" "")
10668 (match_operand:DI 2 "gpc_reg_operand" "b")]
10670 (match_operand:DI 3 "add_cint_operand" "n"))))]
10671 "TARGET_ELF && TARGET_CMODEL != CMODEL_SMALL"
10672 "addis %0,%2,%1+%3@toc@ha")
10674 (define_insn "*largetoc_high_plus_aix<mode>"
10675 [(set (match_operand:P 0 "gpc_reg_operand" "=b*r")
10678 (unspec [(match_operand:P 1 "" "")
10679 (match_operand:P 2 "gpc_reg_operand" "b")]
10681 (match_operand:P 3 "add_cint_operand" "n"))))]
10682 "TARGET_XCOFF && TARGET_CMODEL != CMODEL_SMALL"
10683 "addis %0,%1+%3@u(%2)")
10685 (define_insn "*largetoc_low"
10686 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
10687 (lo_sum:DI (match_operand:DI 1 "gpc_reg_operand" "b,!*r")
10688 (match_operand:DI 2 "" "")))]
10689 "TARGET_ELF && TARGET_CMODEL != CMODEL_SMALL"
10694 (define_insn "*largetoc_low_aix<mode>"
10695 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
10696 (lo_sum:P (match_operand:P 1 "gpc_reg_operand" "b")
10697 (match_operand:P 2 "" "")))]
10698 "TARGET_XCOFF && TARGET_CMODEL != CMODEL_SMALL"
10701 (define_insn_and_split "*tocref<mode>"
10702 [(set (match_operand:P 0 "gpc_reg_operand" "=b*r")
10703 (match_operand:P 1 "small_toc_ref" "R"))]
10706 "&& TARGET_CMODEL != CMODEL_SMALL && reload_completed"
10707 [(set (match_dup 0) (high:P (match_dup 1)))
10708 (set (match_dup 0) (lo_sum:P (match_dup 0) (match_dup 1)))])
10710 ;; Elf specific ways of loading addresses for non-PIC code.
10711 ;; The output of this could be r0, but we make a very strong
10712 ;; preference for a base register because it will usually
10713 ;; be needed there.
10714 (define_insn "elf_high"
10715 [(set (match_operand:SI 0 "gpc_reg_operand" "=b*r")
10716 (high:SI (match_operand 1 "" "")))]
10717 "TARGET_ELF && ! TARGET_64BIT"
10720 (define_insn "elf_low"
10721 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
10722 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,!*r")
10723 (match_operand 2 "" "")))]
10724 "TARGET_ELF && ! TARGET_64BIT"
10729 ;; Call and call_value insns
10730 (define_expand "call"
10731 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
10732 (match_operand 1 "" ""))
10733 (use (match_operand 2 "" ""))
10734 (clobber (reg:SI LR_REGNO))])]
10739 if (MACHOPIC_INDIRECT)
10740 operands[0] = machopic_indirect_call_target (operands[0]);
10743 gcc_assert (GET_CODE (operands[0]) == MEM);
10744 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
10746 operands[0] = XEXP (operands[0], 0);
10748 if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
10750 rs6000_call_aix (NULL_RTX, operands[0], operands[1], operands[2]);
10754 if (GET_CODE (operands[0]) != SYMBOL_REF
10755 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[2]) & CALL_LONG) != 0))
10757 if (INTVAL (operands[2]) & CALL_LONG)
10758 operands[0] = rs6000_longcall_ref (operands[0]);
10760 switch (DEFAULT_ABI)
10764 operands[0] = force_reg (Pmode, operands[0]);
10768 gcc_unreachable ();
10773 (define_expand "call_value"
10774 [(parallel [(set (match_operand 0 "" "")
10775 (call (mem:SI (match_operand 1 "address_operand" ""))
10776 (match_operand 2 "" "")))
10777 (use (match_operand 3 "" ""))
10778 (clobber (reg:SI LR_REGNO))])]
10783 if (MACHOPIC_INDIRECT)
10784 operands[1] = machopic_indirect_call_target (operands[1]);
10787 gcc_assert (GET_CODE (operands[1]) == MEM);
10788 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
10790 operands[1] = XEXP (operands[1], 0);
10792 if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
10794 rs6000_call_aix (operands[0], operands[1], operands[2], operands[3]);
10798 if (GET_CODE (operands[1]) != SYMBOL_REF
10799 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[3]) & CALL_LONG) != 0))
10801 if (INTVAL (operands[3]) & CALL_LONG)
10802 operands[1] = rs6000_longcall_ref (operands[1]);
10804 switch (DEFAULT_ABI)
10808 operands[1] = force_reg (Pmode, operands[1]);
10812 gcc_unreachable ();
10817 ;; Call to function in current module. No TOC pointer reload needed.
10818 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
10819 ;; either the function was not prototyped, or it was prototyped as a
10820 ;; variable argument function. It is > 0 if FP registers were passed
10821 ;; and < 0 if they were not.
10823 (define_insn "*call_local32"
10824 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
10825 (match_operand 1 "" "g,g"))
10826 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10827 (clobber (reg:SI LR_REGNO))]
10828 "(INTVAL (operands[2]) & CALL_LONG) == 0"
10831 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10832 output_asm_insn (\"crxor 6,6,6\", operands);
10834 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10835 output_asm_insn (\"creqv 6,6,6\", operands);
10837 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
10839 [(set_attr "type" "branch")
10840 (set_attr "length" "4,8")])
10842 (define_insn "*call_local64"
10843 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
10844 (match_operand 1 "" "g,g"))
10845 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10846 (clobber (reg:SI LR_REGNO))]
10847 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
10850 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10851 output_asm_insn (\"crxor 6,6,6\", operands);
10853 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10854 output_asm_insn (\"creqv 6,6,6\", operands);
10856 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
10858 [(set_attr "type" "branch")
10859 (set_attr "length" "4,8")])
10861 (define_insn "*call_value_local32"
10862 [(set (match_operand 0 "" "")
10863 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
10864 (match_operand 2 "" "g,g")))
10865 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10866 (clobber (reg:SI LR_REGNO))]
10867 "(INTVAL (operands[3]) & CALL_LONG) == 0"
10870 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10871 output_asm_insn (\"crxor 6,6,6\", operands);
10873 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10874 output_asm_insn (\"creqv 6,6,6\", operands);
10876 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
10878 [(set_attr "type" "branch")
10879 (set_attr "length" "4,8")])
10882 (define_insn "*call_value_local64"
10883 [(set (match_operand 0 "" "")
10884 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
10885 (match_operand 2 "" "g,g")))
10886 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10887 (clobber (reg:SI LR_REGNO))]
10888 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
10891 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10892 output_asm_insn (\"crxor 6,6,6\", operands);
10894 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10895 output_asm_insn (\"creqv 6,6,6\", operands);
10897 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
10899 [(set_attr "type" "branch")
10900 (set_attr "length" "4,8")])
10903 ;; A function pointer under System V is just a normal pointer
10904 ;; operands[0] is the function pointer
10905 ;; operands[1] is the stack size to clean up
10906 ;; operands[2] is the value FUNCTION_ARG returns for the VOID argument
10907 ;; which indicates how to set cr1
10909 (define_insn "*call_indirect_nonlocal_sysv<mode>"
10910 [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l,c,*l"))
10911 (match_operand 1 "" "g,g,g,g"))
10912 (use (match_operand:SI 2 "immediate_operand" "O,O,n,n"))
10913 (clobber (reg:SI LR_REGNO))]
10914 "DEFAULT_ABI == ABI_V4
10915 || DEFAULT_ABI == ABI_DARWIN"
10917 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10918 output_asm_insn ("crxor 6,6,6", operands);
10920 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10921 output_asm_insn ("creqv 6,6,6", operands);
10925 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
10926 (set_attr "length" "4,4,8,8")])
10928 (define_insn_and_split "*call_nonlocal_sysv<mode>"
10929 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
10930 (match_operand 1 "" "g,g"))
10931 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10932 (clobber (reg:SI LR_REGNO))]
10933 "(DEFAULT_ABI == ABI_DARWIN
10934 || (DEFAULT_ABI == ABI_V4
10935 && (INTVAL (operands[2]) & CALL_LONG) == 0))"
10937 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10938 output_asm_insn ("crxor 6,6,6", operands);
10940 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10941 output_asm_insn ("creqv 6,6,6", operands);
10944 return output_call(insn, operands, 0, 2);
10946 if (DEFAULT_ABI == ABI_V4 && flag_pic)
10948 gcc_assert (!TARGET_SECURE_PLT);
10949 return "bl %z0@plt";
10955 "DEFAULT_ABI == ABI_V4
10956 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[0])
10957 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10958 [(parallel [(call (mem:SI (match_dup 0))
10960 (use (match_dup 2))
10961 (use (match_dup 3))
10962 (clobber (reg:SI LR_REGNO))])]
10964 operands[3] = pic_offset_table_rtx;
10966 [(set_attr "type" "branch,branch")
10967 (set_attr "length" "4,8")])
10969 (define_insn "*call_nonlocal_sysv_secure<mode>"
10970 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
10971 (match_operand 1 "" "g,g"))
10972 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10973 (use (match_operand:SI 3 "register_operand" "r,r"))
10974 (clobber (reg:SI LR_REGNO))]
10975 "(DEFAULT_ABI == ABI_V4
10976 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[0])
10977 && (INTVAL (operands[2]) & CALL_LONG) == 0)"
10979 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10980 output_asm_insn ("crxor 6,6,6", operands);
10982 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10983 output_asm_insn ("creqv 6,6,6", operands);
10986 /* The magic 32768 offset here and in the other sysv call insns
10987 corresponds to the offset of r30 in .got2, as given by LCTOC1.
10988 See sysv4.h:toc_section. */
10989 return "bl %z0+32768@plt";
10991 return "bl %z0@plt";
10993 [(set_attr "type" "branch,branch")
10994 (set_attr "length" "4,8")])
10996 (define_insn "*call_value_indirect_nonlocal_sysv<mode>"
10997 [(set (match_operand 0 "" "")
10998 (call (mem:SI (match_operand:P 1 "register_operand" "c,*l,c,*l"))
10999 (match_operand 2 "" "g,g,g,g")))
11000 (use (match_operand:SI 3 "immediate_operand" "O,O,n,n"))
11001 (clobber (reg:SI LR_REGNO))]
11002 "DEFAULT_ABI == ABI_V4
11003 || DEFAULT_ABI == ABI_DARWIN"
11005 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11006 output_asm_insn ("crxor 6,6,6", operands);
11008 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11009 output_asm_insn ("creqv 6,6,6", operands);
11013 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
11014 (set_attr "length" "4,4,8,8")])
11016 (define_insn_and_split "*call_value_nonlocal_sysv<mode>"
11017 [(set (match_operand 0 "" "")
11018 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
11019 (match_operand 2 "" "g,g")))
11020 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11021 (clobber (reg:SI LR_REGNO))]
11022 "(DEFAULT_ABI == ABI_DARWIN
11023 || (DEFAULT_ABI == ABI_V4
11024 && (INTVAL (operands[3]) & CALL_LONG) == 0))"
11026 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11027 output_asm_insn ("crxor 6,6,6", operands);
11029 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11030 output_asm_insn ("creqv 6,6,6", operands);
11033 return output_call(insn, operands, 1, 3);
11035 if (DEFAULT_ABI == ABI_V4 && flag_pic)
11037 gcc_assert (!TARGET_SECURE_PLT);
11038 return "bl %z1@plt";
11044 "DEFAULT_ABI == ABI_V4
11045 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[1])
11046 && (INTVAL (operands[3]) & CALL_LONG) == 0"
11047 [(parallel [(set (match_dup 0)
11048 (call (mem:SI (match_dup 1))
11050 (use (match_dup 3))
11051 (use (match_dup 4))
11052 (clobber (reg:SI LR_REGNO))])]
11054 operands[4] = pic_offset_table_rtx;
11056 [(set_attr "type" "branch,branch")
11057 (set_attr "length" "4,8")])
11059 (define_insn "*call_value_nonlocal_sysv_secure<mode>"
11060 [(set (match_operand 0 "" "")
11061 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
11062 (match_operand 2 "" "g,g")))
11063 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11064 (use (match_operand:SI 4 "register_operand" "r,r"))
11065 (clobber (reg:SI LR_REGNO))]
11066 "(DEFAULT_ABI == ABI_V4
11067 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[1])
11068 && (INTVAL (operands[3]) & CALL_LONG) == 0)"
11070 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11071 output_asm_insn ("crxor 6,6,6", operands);
11073 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11074 output_asm_insn ("creqv 6,6,6", operands);
11077 return "bl %z1+32768@plt";
11079 return "bl %z1@plt";
11081 [(set_attr "type" "branch,branch")
11082 (set_attr "length" "4,8")])
11085 ;; Call to AIX abi function in the same module.
11087 (define_insn "*call_local_aix<mode>"
11088 [(call (mem:SI (match_operand:P 0 "current_file_function_operand" "s"))
11089 (match_operand 1 "" "g"))
11090 (clobber (reg:P LR_REGNO))]
11091 "DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2"
11093 [(set_attr "type" "branch")
11094 (set_attr "length" "4")])
11096 (define_insn "*call_value_local_aix<mode>"
11097 [(set (match_operand 0 "" "")
11098 (call (mem:SI (match_operand:P 1 "current_file_function_operand" "s"))
11099 (match_operand 2 "" "g")))
11100 (clobber (reg:P LR_REGNO))]
11101 "DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2"
11103 [(set_attr "type" "branch")
11104 (set_attr "length" "4")])
11106 ;; Call to AIX abi function which may be in another module.
11107 ;; Restore the TOC pointer (r2) after the call.
11109 (define_insn "*call_nonlocal_aix<mode>"
11110 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s"))
11111 (match_operand 1 "" "g"))
11112 (clobber (reg:P LR_REGNO))]
11113 "DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2"
11115 [(set_attr "type" "branch")
11116 (set_attr "length" "8")])
11118 (define_insn "*call_value_nonlocal_aix<mode>"
11119 [(set (match_operand 0 "" "")
11120 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s"))
11121 (match_operand 2 "" "g")))
11122 (clobber (reg:P LR_REGNO))]
11123 "DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2"
11125 [(set_attr "type" "branch")
11126 (set_attr "length" "8")])
11128 ;; Call to indirect functions with the AIX abi using a 3 word descriptor.
11129 ;; Operand0 is the addresss of the function to call
11130 ;; Operand2 is the location in the function descriptor to load r2 from
11131 ;; Operand3 is the stack location to hold the current TOC pointer
11133 (define_insn "*call_indirect_aix<mode>"
11134 [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l"))
11135 (match_operand 1 "" "g,g"))
11136 (use (match_operand:P 2 "memory_operand" "<ptrm>,<ptrm>"))
11137 (set (reg:P TOC_REGNUM) (match_operand:P 3 "memory_operand" "<ptrm>,<ptrm>"))
11138 (clobber (reg:P LR_REGNO))]
11139 "DEFAULT_ABI == ABI_AIX"
11140 "<ptrload> 2,%2\;b%T0l\;<ptrload> 2,%3"
11141 [(set_attr "type" "jmpreg")
11142 (set_attr "length" "12")])
11144 (define_insn "*call_value_indirect_aix<mode>"
11145 [(set (match_operand 0 "" "")
11146 (call (mem:SI (match_operand:P 1 "register_operand" "c,*l"))
11147 (match_operand 2 "" "g,g")))
11148 (use (match_operand:P 3 "memory_operand" "<ptrm>,<ptrm>"))
11149 (set (reg:P TOC_REGNUM) (match_operand:P 4 "memory_operand" "<ptrm>,<ptrm>"))
11150 (clobber (reg:P LR_REGNO))]
11151 "DEFAULT_ABI == ABI_AIX"
11152 "<ptrload> 2,%3\;b%T1l\;<ptrload> 2,%4"
11153 [(set_attr "type" "jmpreg")
11154 (set_attr "length" "12")])
11156 ;; Call to indirect functions with the ELFv2 ABI.
11157 ;; Operand0 is the addresss of the function to call
11158 ;; Operand2 is the stack location to hold the current TOC pointer
11160 (define_insn "*call_indirect_elfv2<mode>"
11161 [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l"))
11162 (match_operand 1 "" "g,g"))
11163 (set (reg:P TOC_REGNUM) (match_operand:P 2 "memory_operand" "<ptrm>,<ptrm>"))
11164 (clobber (reg:P LR_REGNO))]
11165 "DEFAULT_ABI == ABI_ELFv2"
11166 "b%T0l\;<ptrload> 2,%2"
11167 [(set_attr "type" "jmpreg")
11168 (set_attr "length" "8")])
11170 (define_insn "*call_value_indirect_elfv2<mode>"
11171 [(set (match_operand 0 "" "")
11172 (call (mem:SI (match_operand:P 1 "register_operand" "c,*l"))
11173 (match_operand 2 "" "g,g")))
11174 (set (reg:P TOC_REGNUM) (match_operand:P 3 "memory_operand" "<ptrm>,<ptrm>"))
11175 (clobber (reg:P LR_REGNO))]
11176 "DEFAULT_ABI == ABI_ELFv2"
11177 "b%T1l\;<ptrload> 2,%3"
11178 [(set_attr "type" "jmpreg")
11179 (set_attr "length" "8")])
11182 ;; Call subroutine returning any type.
11183 (define_expand "untyped_call"
11184 [(parallel [(call (match_operand 0 "" "")
11186 (match_operand 1 "" "")
11187 (match_operand 2 "" "")])]
11193 emit_call_insn (GEN_CALL (operands[0], const0_rtx, const0_rtx, const0_rtx));
11195 for (i = 0; i < XVECLEN (operands[2], 0); i++)
11197 rtx set = XVECEXP (operands[2], 0, i);
11198 emit_move_insn (SET_DEST (set), SET_SRC (set));
11201 /* The optimizer does not know that the call sets the function value
11202 registers we stored in the result block. We avoid problems by
11203 claiming that all hard registers are used and clobbered at this
11205 emit_insn (gen_blockage ());
11210 ;; sibling call patterns
11211 (define_expand "sibcall"
11212 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
11213 (match_operand 1 "" ""))
11214 (use (match_operand 2 "" ""))
11215 (use (reg:SI LR_REGNO))
11221 if (MACHOPIC_INDIRECT)
11222 operands[0] = machopic_indirect_call_target (operands[0]);
11225 gcc_assert (GET_CODE (operands[0]) == MEM);
11226 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
11228 operands[0] = XEXP (operands[0], 0);
11230 if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
11232 rs6000_sibcall_aix (NULL_RTX, operands[0], operands[1], operands[2]);
11237 (define_expand "sibcall_value"
11238 [(parallel [(set (match_operand 0 "register_operand" "")
11239 (call (mem:SI (match_operand 1 "address_operand" ""))
11240 (match_operand 2 "" "")))
11241 (use (match_operand 3 "" ""))
11242 (use (reg:SI LR_REGNO))
11248 if (MACHOPIC_INDIRECT)
11249 operands[1] = machopic_indirect_call_target (operands[1]);
11252 gcc_assert (GET_CODE (operands[1]) == MEM);
11253 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
11255 operands[1] = XEXP (operands[1], 0);
11257 if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
11259 rs6000_sibcall_aix (operands[0], operands[1], operands[2], operands[3]);
11264 ;; this and similar patterns must be marked as using LR, otherwise
11265 ;; dataflow will try to delete the store into it. This is true
11266 ;; even when the actual reg to jump to is in CTR, when LR was
11267 ;; saved and restored around the PIC-setting BCL.
11268 (define_insn "*sibcall_local32"
11269 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
11270 (match_operand 1 "" "g,g"))
11271 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11272 (use (reg:SI LR_REGNO))
11274 "(INTVAL (operands[2]) & CALL_LONG) == 0"
11277 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11278 output_asm_insn (\"crxor 6,6,6\", operands);
11280 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11281 output_asm_insn (\"creqv 6,6,6\", operands);
11283 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
11285 [(set_attr "type" "branch")
11286 (set_attr "length" "4,8")])
11288 (define_insn "*sibcall_local64"
11289 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
11290 (match_operand 1 "" "g,g"))
11291 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11292 (use (reg:SI LR_REGNO))
11294 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
11297 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11298 output_asm_insn (\"crxor 6,6,6\", operands);
11300 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11301 output_asm_insn (\"creqv 6,6,6\", operands);
11303 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
11305 [(set_attr "type" "branch")
11306 (set_attr "length" "4,8")])
11308 (define_insn "*sibcall_value_local32"
11309 [(set (match_operand 0 "" "")
11310 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
11311 (match_operand 2 "" "g,g")))
11312 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11313 (use (reg:SI LR_REGNO))
11315 "(INTVAL (operands[3]) & CALL_LONG) == 0"
11318 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11319 output_asm_insn (\"crxor 6,6,6\", operands);
11321 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11322 output_asm_insn (\"creqv 6,6,6\", operands);
11324 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
11326 [(set_attr "type" "branch")
11327 (set_attr "length" "4,8")])
11329 (define_insn "*sibcall_value_local64"
11330 [(set (match_operand 0 "" "")
11331 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
11332 (match_operand 2 "" "g,g")))
11333 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11334 (use (reg:SI LR_REGNO))
11336 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
11339 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11340 output_asm_insn (\"crxor 6,6,6\", operands);
11342 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11343 output_asm_insn (\"creqv 6,6,6\", operands);
11345 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
11347 [(set_attr "type" "branch")
11348 (set_attr "length" "4,8")])
11350 (define_insn "*sibcall_nonlocal_sysv<mode>"
11351 [(call (mem:SI (match_operand:P 0 "call_operand" "s,s,c,c"))
11352 (match_operand 1 "" ""))
11353 (use (match_operand 2 "immediate_operand" "O,n,O,n"))
11354 (use (reg:SI LR_REGNO))
11356 "(DEFAULT_ABI == ABI_DARWIN
11357 || DEFAULT_ABI == ABI_V4)
11358 && (INTVAL (operands[2]) & CALL_LONG) == 0"
11361 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11362 output_asm_insn (\"crxor 6,6,6\", operands);
11364 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11365 output_asm_insn (\"creqv 6,6,6\", operands);
11367 if (which_alternative >= 2)
11369 else if (DEFAULT_ABI == ABI_V4 && flag_pic)
11371 gcc_assert (!TARGET_SECURE_PLT);
11372 return \"b %z0@plt\";
11377 [(set_attr "type" "branch")
11378 (set_attr "length" "4,8,4,8")])
11380 (define_insn "*sibcall_value_nonlocal_sysv<mode>"
11381 [(set (match_operand 0 "" "")
11382 (call (mem:SI (match_operand:P 1 "call_operand" "s,s,c,c"))
11383 (match_operand 2 "" "")))
11384 (use (match_operand:SI 3 "immediate_operand" "O,n,O,n"))
11385 (use (reg:SI LR_REGNO))
11387 "(DEFAULT_ABI == ABI_DARWIN
11388 || DEFAULT_ABI == ABI_V4)
11389 && (INTVAL (operands[3]) & CALL_LONG) == 0"
11392 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11393 output_asm_insn (\"crxor 6,6,6\", operands);
11395 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11396 output_asm_insn (\"creqv 6,6,6\", operands);
11398 if (which_alternative >= 2)
11400 else if (DEFAULT_ABI == ABI_V4 && flag_pic)
11402 gcc_assert (!TARGET_SECURE_PLT);
11403 return \"b %z1@plt\";
11408 [(set_attr "type" "branch")
11409 (set_attr "length" "4,8,4,8")])
11411 ;; AIX ABI sibling call patterns.
11413 (define_insn "*sibcall_aix<mode>"
11414 [(call (mem:SI (match_operand:P 0 "call_operand" "s,c"))
11415 (match_operand 1 "" "g,g"))
11417 "DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2"
11421 [(set_attr "type" "branch")
11422 (set_attr "length" "4")])
11424 (define_insn "*sibcall_value_aix<mode>"
11425 [(set (match_operand 0 "" "")
11426 (call (mem:SI (match_operand:P 1 "call_operand" "s,c"))
11427 (match_operand 2 "" "g,g")))
11429 "DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2"
11433 [(set_attr "type" "branch")
11434 (set_attr "length" "4")])
11436 (define_expand "sibcall_epilogue"
11437 [(use (const_int 0))]
11440 if (!TARGET_SCHED_PROLOG)
11441 emit_insn (gen_blockage ());
11442 rs6000_emit_epilogue (TRUE);
11446 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
11447 ;; all of memory. This blocks insns from being moved across this point.
11449 (define_insn "blockage"
11450 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCK)]
11454 (define_expand "probe_stack"
11455 [(set (match_operand 0 "memory_operand" "=m")
11456 (unspec [(const_int 0)] UNSPEC_PROBE_STACK))]
11460 emit_insn (gen_probe_stack_di (operands[0]));
11462 emit_insn (gen_probe_stack_si (operands[0]));
11466 (define_insn "probe_stack_<mode>"
11467 [(set (match_operand:P 0 "memory_operand" "=m")
11468 (unspec:P [(const_int 0)] UNSPEC_PROBE_STACK))]
11471 operands[1] = gen_rtx_REG (Pmode, 0);
11472 return "st<wd>%U0%X0 %1,%0";
11474 [(set_attr "type" "store")
11475 (set (attr "update")
11476 (if_then_else (match_operand 0 "update_address_mem")
11477 (const_string "yes")
11478 (const_string "no")))
11479 (set (attr "indexed")
11480 (if_then_else (match_operand 0 "indexed_address_mem")
11481 (const_string "yes")
11482 (const_string "no")))
11483 (set_attr "length" "4")])
11485 (define_insn "probe_stack_range<P:mode>"
11486 [(set (match_operand:P 0 "register_operand" "=r")
11487 (unspec_volatile:P [(match_operand:P 1 "register_operand" "0")
11488 (match_operand:P 2 "register_operand" "r")]
11489 UNSPECV_PROBE_STACK_RANGE))]
11491 "* return output_probe_stack_range (operands[0], operands[2]);"
11492 [(set_attr "type" "three")])
11494 ;; Compare insns are next. Note that the RS/6000 has two types of compares,
11495 ;; signed & unsigned, and one type of branch.
11497 ;; Start with the DEFINE_EXPANDs to generate the rtl for compares, scc
11498 ;; insns, and branches.
11500 (define_expand "cbranch<mode>4"
11501 [(use (match_operator 0 "rs6000_cbranch_operator"
11502 [(match_operand:GPR 1 "gpc_reg_operand" "")
11503 (match_operand:GPR 2 "reg_or_short_operand" "")]))
11504 (use (match_operand 3 ""))]
11508 /* Take care of the possibility that operands[2] might be negative but
11509 this might be a logical operation. That insn doesn't exist. */
11510 if (GET_CODE (operands[2]) == CONST_INT
11511 && INTVAL (operands[2]) < 0)
11513 operands[2] = force_reg (<MODE>mode, operands[2]);
11514 operands[0] = gen_rtx_fmt_ee (GET_CODE (operands[0]),
11515 GET_MODE (operands[0]),
11516 operands[1], operands[2]);
11519 rs6000_emit_cbranch (<MODE>mode, operands);
11523 (define_expand "cbranch<mode>4"
11524 [(use (match_operator 0 "rs6000_cbranch_operator"
11525 [(match_operand:FP 1 "gpc_reg_operand" "")
11526 (match_operand:FP 2 "gpc_reg_operand" "")]))
11527 (use (match_operand 3 ""))]
11531 rs6000_emit_cbranch (<MODE>mode, operands);
11535 (define_expand "cstore<mode>4"
11536 [(use (match_operator 1 "rs6000_cbranch_operator"
11537 [(match_operand:GPR 2 "gpc_reg_operand" "")
11538 (match_operand:GPR 3 "reg_or_short_operand" "")]))
11539 (clobber (match_operand:SI 0 "register_operand"))]
11543 /* Take care of the possibility that operands[3] might be negative but
11544 this might be a logical operation. That insn doesn't exist. */
11545 if (GET_CODE (operands[3]) == CONST_INT
11546 && INTVAL (operands[3]) < 0)
11548 operands[3] = force_reg (<MODE>mode, operands[3]);
11549 operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]),
11550 GET_MODE (operands[1]),
11551 operands[2], operands[3]);
11554 /* For SNE, we would prefer that the xor/abs sequence be used for integers.
11555 For SEQ, likewise, except that comparisons with zero should be done
11556 with an scc insns. However, due to the order that combine see the
11557 resulting insns, we must, in fact, allow SEQ for integers. Fail in
11558 the cases we don't want to handle or are best handled by portable
11560 if (GET_CODE (operands[1]) == NE)
11562 if ((GET_CODE (operands[1]) == LT || GET_CODE (operands[1]) == LE
11563 || GET_CODE (operands[1]) == GT || GET_CODE (operands[1]) == GE)
11564 && operands[3] == const0_rtx)
11566 rs6000_emit_sCOND (<MODE>mode, operands);
11570 (define_expand "cstore<mode>4"
11571 [(use (match_operator 1 "rs6000_cbranch_operator"
11572 [(match_operand:FP 2 "gpc_reg_operand" "")
11573 (match_operand:FP 3 "gpc_reg_operand" "")]))
11574 (clobber (match_operand:SI 0 "register_operand"))]
11578 rs6000_emit_sCOND (<MODE>mode, operands);
11583 (define_expand "stack_protect_set"
11584 [(match_operand 0 "memory_operand" "")
11585 (match_operand 1 "memory_operand" "")]
11588 #ifdef TARGET_THREAD_SSP_OFFSET
11589 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
11590 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
11591 operands[1] = gen_rtx_MEM (Pmode, addr);
11594 emit_insn (gen_stack_protect_setdi (operands[0], operands[1]));
11596 emit_insn (gen_stack_protect_setsi (operands[0], operands[1]));
11600 (define_insn "stack_protect_setsi"
11601 [(set (match_operand:SI 0 "memory_operand" "=m")
11602 (unspec:SI [(match_operand:SI 1 "memory_operand" "m")] UNSPEC_SP_SET))
11603 (set (match_scratch:SI 2 "=&r") (const_int 0))]
11605 "lwz%U1%X1 %2,%1\;stw%U0%X0 %2,%0\;li %2,0"
11606 [(set_attr "type" "three")
11607 (set_attr "length" "12")])
11609 (define_insn "stack_protect_setdi"
11610 [(set (match_operand:DI 0 "memory_operand" "=Y")
11611 (unspec:DI [(match_operand:DI 1 "memory_operand" "Y")] UNSPEC_SP_SET))
11612 (set (match_scratch:DI 2 "=&r") (const_int 0))]
11614 "ld%U1%X1 %2,%1\;std%U0%X0 %2,%0\;li %2,0"
11615 [(set_attr "type" "three")
11616 (set_attr "length" "12")])
11618 (define_expand "stack_protect_test"
11619 [(match_operand 0 "memory_operand" "")
11620 (match_operand 1 "memory_operand" "")
11621 (match_operand 2 "" "")]
11624 rtx test, op0, op1;
11625 #ifdef TARGET_THREAD_SSP_OFFSET
11626 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
11627 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
11628 operands[1] = gen_rtx_MEM (Pmode, addr);
11631 op1 = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, operands[1]), UNSPEC_SP_TEST);
11632 test = gen_rtx_EQ (VOIDmode, op0, op1);
11633 emit_jump_insn (gen_cbranchsi4 (test, op0, op1, operands[2]));
11637 (define_insn "stack_protect_testsi"
11638 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
11639 (unspec:CCEQ [(match_operand:SI 1 "memory_operand" "m,m")
11640 (match_operand:SI 2 "memory_operand" "m,m")]
11642 (set (match_scratch:SI 4 "=r,r") (const_int 0))
11643 (clobber (match_scratch:SI 3 "=&r,&r"))]
11646 lwz%U1%X1 %3,%1\;lwz%U2%X2 %4,%2\;xor. %3,%3,%4\;li %4,0
11647 lwz%U1%X1 %3,%1\;lwz%U2%X2 %4,%2\;cmplw %0,%3,%4\;li %3,0\;li %4,0"
11648 [(set_attr "length" "16,20")])
11650 (define_insn "stack_protect_testdi"
11651 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
11652 (unspec:CCEQ [(match_operand:DI 1 "memory_operand" "Y,Y")
11653 (match_operand:DI 2 "memory_operand" "Y,Y")]
11655 (set (match_scratch:DI 4 "=r,r") (const_int 0))
11656 (clobber (match_scratch:DI 3 "=&r,&r"))]
11659 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;xor. %3,%3,%4\;li %4,0
11660 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;cmpld %0,%3,%4\;li %3,0\;li %4,0"
11661 [(set_attr "length" "16,20")])
11664 ;; Here are the actual compare insns.
11665 (define_insn "*cmp<mode>_internal1"
11666 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
11667 (compare:CC (match_operand:GPR 1 "gpc_reg_operand" "r")
11668 (match_operand:GPR 2 "reg_or_short_operand" "rI")))]
11670 "cmp<wd>%I2 %0,%1,%2"
11671 [(set_attr "type" "cmp")])
11673 ;; If we are comparing a register for equality with a large constant,
11674 ;; we can do this with an XOR followed by a compare. But this is profitable
11675 ;; only if the large constant is only used for the comparison (and in this
11676 ;; case we already have a register to reuse as scratch).
11678 ;; For 64-bit registers, we could only do so if the constant's bit 15 is clear:
11679 ;; otherwise we'd need to XOR with FFFFFFFF????0000 which is not available.
11682 [(set (match_operand:SI 0 "register_operand")
11683 (match_operand:SI 1 "logical_const_operand" ""))
11684 (set (match_dup 0) (match_operator:SI 3 "boolean_or_operator"
11686 (match_operand:SI 2 "logical_const_operand" "")]))
11687 (set (match_operand:CC 4 "cc_reg_operand" "")
11688 (compare:CC (match_operand:SI 5 "gpc_reg_operand" "")
11691 (if_then_else (match_operator 6 "equality_operator"
11692 [(match_dup 4) (const_int 0)])
11693 (match_operand 7 "" "")
11694 (match_operand 8 "" "")))]
11695 "peep2_reg_dead_p (3, operands[0])
11696 && peep2_reg_dead_p (4, operands[4])"
11697 [(set (match_dup 0) (xor:SI (match_dup 5) (match_dup 9)))
11698 (set (match_dup 4) (compare:CC (match_dup 0) (match_dup 10)))
11699 (set (pc) (if_then_else (match_dup 6) (match_dup 7) (match_dup 8)))]
11702 /* Get the constant we are comparing against, and see what it looks like
11703 when sign-extended from 16 to 32 bits. Then see what constant we could
11704 XOR with SEXTC to get the sign-extended value. */
11705 rtx cnst = simplify_const_binary_operation (GET_CODE (operands[3]),
11707 operands[1], operands[2]);
11708 HOST_WIDE_INT c = INTVAL (cnst);
11709 HOST_WIDE_INT sextc = ((c & 0xffff) ^ 0x8000) - 0x8000;
11710 HOST_WIDE_INT xorv = c ^ sextc;
11712 operands[9] = GEN_INT (xorv);
11713 operands[10] = GEN_INT (sextc);
11716 (define_insn "*cmpsi_internal2"
11717 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
11718 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
11719 (match_operand:SI 2 "reg_or_u_short_operand" "rK")))]
11721 "cmplw%I2 %0,%1,%b2"
11722 [(set_attr "type" "cmp")])
11724 (define_insn "*cmpdi_internal2"
11725 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
11726 (compare:CCUNS (match_operand:DI 1 "gpc_reg_operand" "r")
11727 (match_operand:DI 2 "reg_or_u_short_operand" "rK")))]
11729 "cmpld%I2 %0,%1,%b2"
11730 [(set_attr "type" "cmp")])
11732 ;; The following two insns don't exist as single insns, but if we provide
11733 ;; them, we can swap an add and compare, which will enable us to overlap more
11734 ;; of the required delay between a compare and branch. We generate code for
11735 ;; them by splitting.
11738 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
11739 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
11740 (match_operand:SI 2 "short_cint_operand" "i")))
11741 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
11742 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
11745 [(set_attr "length" "8")])
11748 [(set (match_operand:CCUNS 3 "cc_reg_operand" "=y")
11749 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
11750 (match_operand:SI 2 "u_short_cint_operand" "i")))
11751 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
11752 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
11755 [(set_attr "length" "8")])
11758 [(set (match_operand:CC 3 "cc_reg_operand" "")
11759 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
11760 (match_operand:SI 2 "short_cint_operand" "")))
11761 (set (match_operand:SI 0 "gpc_reg_operand" "")
11762 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
11764 [(set (match_dup 3) (compare:CC (match_dup 1) (match_dup 2)))
11765 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
11768 [(set (match_operand:CCUNS 3 "cc_reg_operand" "")
11769 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "")
11770 (match_operand:SI 2 "u_short_cint_operand" "")))
11771 (set (match_operand:SI 0 "gpc_reg_operand" "")
11772 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
11774 [(set (match_dup 3) (compare:CCUNS (match_dup 1) (match_dup 2)))
11775 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
11777 ;; Only need to compare second words if first words equal
11778 (define_insn "*cmptf_internal1"
11779 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11780 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "d")
11781 (match_operand:TF 2 "gpc_reg_operand" "d")))]
11782 "!TARGET_IEEEQUAD && !TARGET_XL_COMPAT
11783 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LONG_DOUBLE_128"
11784 "fcmpu %0,%1,%2\;bne %0,$+8\;fcmpu %0,%L1,%L2"
11785 [(set_attr "type" "fpcompare")
11786 (set_attr "length" "12")])
11788 (define_insn_and_split "*cmptf_internal2"
11789 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11790 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "d")
11791 (match_operand:TF 2 "gpc_reg_operand" "d")))
11792 (clobber (match_scratch:DF 3 "=d"))
11793 (clobber (match_scratch:DF 4 "=d"))
11794 (clobber (match_scratch:DF 5 "=d"))
11795 (clobber (match_scratch:DF 6 "=d"))
11796 (clobber (match_scratch:DF 7 "=d"))
11797 (clobber (match_scratch:DF 8 "=d"))
11798 (clobber (match_scratch:DF 9 "=d"))
11799 (clobber (match_scratch:DF 10 "=d"))
11800 (clobber (match_scratch:GPR 11 "=b"))]
11801 "!TARGET_IEEEQUAD && TARGET_XL_COMPAT
11802 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LONG_DOUBLE_128"
11804 "&& reload_completed"
11805 [(set (match_dup 3) (match_dup 14))
11806 (set (match_dup 4) (match_dup 15))
11807 (set (match_dup 9) (abs:DF (match_dup 5)))
11808 (set (match_dup 0) (compare:CCFP (match_dup 9) (match_dup 3)))
11809 (set (pc) (if_then_else (ne (match_dup 0) (const_int 0))
11810 (label_ref (match_dup 12))
11812 (set (match_dup 0) (compare:CCFP (match_dup 5) (match_dup 7)))
11813 (set (pc) (label_ref (match_dup 13)))
11815 (set (match_dup 10) (minus:DF (match_dup 5) (match_dup 7)))
11816 (set (match_dup 9) (minus:DF (match_dup 6) (match_dup 8)))
11817 (set (match_dup 9) (plus:DF (match_dup 10) (match_dup 9)))
11818 (set (match_dup 0) (compare:CCFP (match_dup 9) (match_dup 4)))
11821 REAL_VALUE_TYPE rv;
11822 const int lo_word = LONG_DOUBLE_LARGE_FIRST ? GET_MODE_SIZE (DFmode) : 0;
11823 const int hi_word = LONG_DOUBLE_LARGE_FIRST ? 0 : GET_MODE_SIZE (DFmode);
11825 operands[5] = simplify_gen_subreg (DFmode, operands[1], TFmode, hi_word);
11826 operands[6] = simplify_gen_subreg (DFmode, operands[1], TFmode, lo_word);
11827 operands[7] = simplify_gen_subreg (DFmode, operands[2], TFmode, hi_word);
11828 operands[8] = simplify_gen_subreg (DFmode, operands[2], TFmode, lo_word);
11829 operands[12] = gen_label_rtx ();
11830 operands[13] = gen_label_rtx ();
11832 operands[14] = force_const_mem (DFmode,
11833 CONST_DOUBLE_FROM_REAL_VALUE (rv, DFmode));
11834 operands[15] = force_const_mem (DFmode,
11835 CONST_DOUBLE_FROM_REAL_VALUE (dconst0,
11840 tocref = create_TOC_reference (XEXP (operands[14], 0), operands[11]);
11841 operands[14] = gen_const_mem (DFmode, tocref);
11842 tocref = create_TOC_reference (XEXP (operands[15], 0), operands[11]);
11843 operands[15] = gen_const_mem (DFmode, tocref);
11844 set_mem_alias_set (operands[14], get_TOC_alias_set ());
11845 set_mem_alias_set (operands[15], get_TOC_alias_set ());
11849 ;; Now we have the scc insns. We can do some combinations because of the
11850 ;; way the machine works.
11852 ;; Note that this is probably faster if we can put an insn between the
11853 ;; mfcr and rlinm, but this is tricky. Let's leave it for now. In most
11854 ;; cases the insns below which don't use an intermediate CR field will
11855 ;; be used instead.
11857 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11858 (match_operator:SI 1 "scc_comparison_operator"
11859 [(match_operand 2 "cc_reg_operand" "y")
11862 "mfcr %0%Q2\;rlwinm %0,%0,%J1,1"
11863 [(set (attr "type")
11864 (cond [(match_test "TARGET_MFCRF")
11865 (const_string "mfcrf")
11867 (const_string "mfcr")))
11868 (set_attr "length" "8")])
11870 ;; Same as above, but get the GT bit.
11871 (define_insn "move_from_CR_gt_bit"
11872 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11873 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_GT))]
11874 "TARGET_HARD_FLOAT && !TARGET_FPRS"
11875 "mfcr %0\;rlwinm %0,%0,%D1,31,31"
11876 [(set_attr "type" "mfcr")
11877 (set_attr "length" "8")])
11879 ;; Same as above, but get the OV/ORDERED bit.
11880 (define_insn "move_from_CR_ov_bit"
11881 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11882 (unspec:SI [(match_operand:CC 1 "cc_reg_operand" "y")]
11885 "mfcr %0\;rlwinm %0,%0,%t1,1"
11886 [(set_attr "type" "mfcr")
11887 (set_attr "length" "8")])
11890 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11891 (match_operator:DI 1 "scc_comparison_operator"
11892 [(match_operand 2 "cc_reg_operand" "y")
11895 "mfcr %0%Q2\;rlwinm %0,%0,%J1,1"
11896 [(set (attr "type")
11897 (cond [(match_test "TARGET_MFCRF")
11898 (const_string "mfcrf")
11900 (const_string "mfcr")))
11901 (set_attr "length" "8")])
11904 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11905 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
11906 [(match_operand 2 "cc_reg_operand" "y,y")
11909 (set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
11910 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
11913 mfcr %3%Q2\;rlwinm. %3,%3,%J1,1
11915 [(set_attr "type" "shift")
11916 (set_attr "dot" "yes")
11917 (set_attr "length" "8,16")])
11920 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11921 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
11922 [(match_operand 2 "cc_reg_operand" "")
11925 (set (match_operand:SI 3 "gpc_reg_operand" "")
11926 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
11927 "TARGET_32BIT && reload_completed"
11928 [(set (match_dup 3)
11929 (match_op_dup 1 [(match_dup 2) (const_int 0)]))
11931 (compare:CC (match_dup 3)
11936 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11937 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
11938 [(match_operand 2 "cc_reg_operand" "y")
11940 (match_operand:SI 3 "const_int_operand" "n")))]
11944 int is_bit = ccr_bit (operands[1], 1);
11945 int put_bit = 31 - (INTVAL (operands[3]) & 31);
11948 if (is_bit >= put_bit)
11949 count = is_bit - put_bit;
11951 count = 32 - (put_bit - is_bit);
11953 operands[4] = GEN_INT (count);
11954 operands[5] = GEN_INT (put_bit);
11956 return \"mfcr %0%Q2\;rlwinm %0,%0,%4,%5,%5\";
11958 [(set (attr "type")
11959 (cond [(match_test "TARGET_MFCRF")
11960 (const_string "mfcrf")
11962 (const_string "mfcr")))
11963 (set_attr "length" "8")])
11966 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11968 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
11969 [(match_operand 2 "cc_reg_operand" "y,y")
11971 (match_operand:SI 3 "const_int_operand" "n,n"))
11973 (set (match_operand:SI 4 "gpc_reg_operand" "=r,r")
11974 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
11979 int is_bit = ccr_bit (operands[1], 1);
11980 int put_bit = 31 - (INTVAL (operands[3]) & 31);
11983 /* Force split for non-cc0 compare. */
11984 if (which_alternative == 1)
11987 if (is_bit >= put_bit)
11988 count = is_bit - put_bit;
11990 count = 32 - (put_bit - is_bit);
11992 operands[5] = GEN_INT (count);
11993 operands[6] = GEN_INT (put_bit);
11995 return \"mfcr %4%Q2\;rlwinm. %4,%4,%5,%6,%6\";
11997 [(set_attr "type" "shift")
11998 (set_attr "dot" "yes")
11999 (set_attr "length" "8,16")])
12002 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
12004 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
12005 [(match_operand 2 "cc_reg_operand" "")
12007 (match_operand:SI 3 "const_int_operand" ""))
12009 (set (match_operand:SI 4 "gpc_reg_operand" "")
12010 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
12013 [(set (match_dup 4)
12014 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
12017 (compare:CC (match_dup 4)
12021 ;; There is a 3 cycle delay between consecutive mfcr instructions
12022 ;; so it is useful to combine 2 scc instructions to use only one mfcr.
12025 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12026 (match_operator:SI 1 "scc_comparison_operator"
12027 [(match_operand 2 "cc_reg_operand" "y")
12029 (set (match_operand:SI 3 "gpc_reg_operand" "=r")
12030 (match_operator:SI 4 "scc_comparison_operator"
12031 [(match_operand 5 "cc_reg_operand" "y")
12033 "REGNO (operands[2]) != REGNO (operands[5])"
12034 "mfcr %3\;rlwinm %0,%3,%J1,1\;rlwinm %3,%3,%J4,1"
12035 [(set_attr "type" "mfcr")
12036 (set_attr "length" "12")])
12039 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12040 (match_operator:DI 1 "scc_comparison_operator"
12041 [(match_operand 2 "cc_reg_operand" "y")
12043 (set (match_operand:DI 3 "gpc_reg_operand" "=r")
12044 (match_operator:DI 4 "scc_comparison_operator"
12045 [(match_operand 5 "cc_reg_operand" "y")
12047 "TARGET_POWERPC64 && REGNO (operands[2]) != REGNO (operands[5])"
12048 "mfcr %3\;rlwinm %0,%3,%J1,1\;rlwinm %3,%3,%J4,1"
12049 [(set_attr "type" "mfcr")
12050 (set_attr "length" "12")])
12052 ;; There are some scc insns that can be done directly, without a compare.
12053 ;; These are faster because they don't involve the communications between
12054 ;; the FXU and branch units. In fact, we will be replacing all of the
12055 ;; integer scc insns here or in the portable methods in emit_store_flag.
12057 ;; Also support (neg (scc ..)) since that construct is used to replace
12058 ;; branches, (plus (scc ..) ..) since that construct is common and
12059 ;; takes no more insns than scc, and (and (neg (scc ..)) ..) in the
12060 ;; cases where it is no more expensive than (neg (scc ..)).
12062 ;; Have reload force a constant into a register for the simple insns that
12063 ;; otherwise won't accept constants. We do this because it is faster than
12064 ;; the cmp/mfcr sequence we would otherwise generate.
12066 (define_mode_attr scc_eq_op2 [(SI "rKLI")
12069 (define_insn_and_split "*eq<mode>"
12070 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
12071 (eq:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
12072 (match_operand:GPR 2 "scc_eq_operand" "<scc_eq_op2>")))]
12076 [(set (match_dup 0)
12077 (clz:GPR (match_dup 3)))
12079 (lshiftrt:GPR (match_dup 0) (match_dup 4)))]
12081 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
12083 /* Use output operand as intermediate. */
12084 operands[3] = operands[0];
12086 if (logical_operand (operands[2], <MODE>mode))
12087 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
12088 gen_rtx_XOR (<MODE>mode,
12089 operands[1], operands[2])));
12091 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
12092 gen_rtx_PLUS (<MODE>mode, operands[1],
12093 negate_rtx (<MODE>mode,
12097 operands[3] = operands[1];
12099 operands[4] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
12102 (define_insn_and_split "*eq<mode>_compare"
12103 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
12105 (eq:P (match_operand:P 1 "gpc_reg_operand" "=r")
12106 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))
12108 (set (match_operand:P 0 "gpc_reg_operand" "=r")
12109 (eq:P (match_dup 1) (match_dup 2)))]
12113 [(set (match_dup 0)
12114 (clz:P (match_dup 4)))
12115 (parallel [(set (match_dup 3)
12116 (compare:CC (lshiftrt:P (match_dup 0) (match_dup 5))
12119 (lshiftrt:P (match_dup 0) (match_dup 5)))])]
12121 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
12123 /* Use output operand as intermediate. */
12124 operands[4] = operands[0];
12126 if (logical_operand (operands[2], <MODE>mode))
12127 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
12128 gen_rtx_XOR (<MODE>mode,
12129 operands[1], operands[2])));
12131 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
12132 gen_rtx_PLUS (<MODE>mode, operands[1],
12133 negate_rtx (<MODE>mode,
12137 operands[4] = operands[1];
12139 operands[5] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
12142 ;; We have insns of the form shown by the first define_insn below. If
12143 ;; there is something inside the comparison operation, we must split it.
12145 [(set (match_operand:SI 0 "gpc_reg_operand" "")
12146 (plus:SI (match_operator 1 "comparison_operator"
12147 [(match_operand:SI 2 "" "")
12148 (match_operand:SI 3
12149 "reg_or_cint_operand" "")])
12150 (match_operand:SI 4 "gpc_reg_operand" "")))
12151 (clobber (match_operand:SI 5 "register_operand" ""))]
12152 "! gpc_reg_operand (operands[2], SImode)"
12153 [(set (match_dup 5) (match_dup 2))
12154 (set (match_dup 0) (plus:SI (match_op_dup 1 [(match_dup 5) (match_dup 3)])
12157 (define_insn "*plus_eqsi"
12158 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r")
12159 (plus:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
12160 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I"))
12161 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r")))]
12164 xor %0,%1,%2\;subfic %0,%0,0\;addze %0,%3
12165 subfic %0,%1,0\;addze %0,%3
12166 xori %0,%1,%b2\;subfic %0,%0,0\;addze %0,%3
12167 xoris %0,%1,%u2\;subfic %0,%0,0\;addze %0,%3
12168 subfic %0,%1,%2\;subfic %0,%0,0\;addze %0,%3"
12169 [(set_attr "type" "three,two,three,three,three")
12170 (set_attr "length" "12,8,12,12,12")])
12172 (define_insn "*compare_plus_eqsi"
12173 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
12176 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
12177 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
12178 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
12180 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r"))]
12181 "TARGET_32BIT && optimize_size"
12183 xor %4,%1,%2\;subfic %4,%4,0\;addze. %4,%3
12184 subfic %4,%1,0\;addze. %4,%3
12185 xori %4,%1,%b2\;subfic %4,%4,0\;addze. %4,%3
12186 xoris %4,%1,%u2\;subfic %4,%4,0\;addze. %4,%3
12187 subfic %4,%1,%2\;subfic %4,%4,0\;addze. %4,%3
12193 [(set_attr "type" "compare")
12194 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
12197 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12200 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
12201 (match_operand:SI 2 "scc_eq_operand" ""))
12202 (match_operand:SI 3 "gpc_reg_operand" ""))
12204 (clobber (match_scratch:SI 4 ""))]
12205 "TARGET_32BIT && optimize_size && reload_completed"
12206 [(set (match_dup 4)
12207 (plus:SI (eq:SI (match_dup 1)
12211 (compare:CC (match_dup 4)
12215 (define_insn "*plus_eqsi_compare"
12216 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
12219 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
12220 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
12221 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
12223 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r")
12224 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12225 "TARGET_32BIT && optimize_size"
12227 xor %0,%1,%2\;subfic %0,%0,0\;addze. %0,%3
12228 subfic %0,%1,0\;addze. %0,%3
12229 xori %0,%1,%b2\;subfic %0,%0,0\;addze. %0,%3
12230 xoris %0,%1,%u2\;subfic %0,%0,0\;addze. %0,%3
12231 subfic %0,%1,%2\;subfic %0,%0,0\;addze. %0,%3
12237 [(set_attr "type" "compare")
12238 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
12241 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12244 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
12245 (match_operand:SI 2 "scc_eq_operand" ""))
12246 (match_operand:SI 3 "gpc_reg_operand" ""))
12248 (set (match_operand:SI 0 "gpc_reg_operand" "")
12249 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12250 "TARGET_32BIT && optimize_size && reload_completed"
12251 [(set (match_dup 0)
12252 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12254 (compare:CC (match_dup 0)
12258 (define_insn "*neg_eq0<mode>"
12259 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
12260 (neg:P (eq:P (match_operand:P 1 "gpc_reg_operand" "r")
12263 "addic %0,%1,-1\;subfe %0,%0,%0"
12264 [(set_attr "type" "two")
12265 (set_attr "length" "8")])
12267 (define_insn_and_split "*neg_eq<mode>"
12268 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
12269 (neg:P (eq:P (match_operand:P 1 "gpc_reg_operand" "%r")
12270 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))))]
12274 [(set (match_dup 0) (neg:P (eq:P (match_dup 3) (const_int 0))))]
12276 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
12278 /* Use output operand as intermediate. */
12279 operands[3] = operands[0];
12281 if (logical_operand (operands[2], <MODE>mode))
12282 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
12283 gen_rtx_XOR (<MODE>mode,
12284 operands[1], operands[2])));
12286 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
12287 gen_rtx_PLUS (<MODE>mode, operands[1],
12288 negate_rtx (<MODE>mode,
12292 operands[3] = operands[1];
12295 (define_insn "*ne0_<mode>"
12296 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
12297 (ne:P (match_operand:P 1 "gpc_reg_operand" "r")
12299 (clobber (match_scratch:P 2 "=&r"))]
12300 "!(TARGET_32BIT && TARGET_ISEL)"
12301 "addic %2,%1,-1\;subfe %0,%2,%1"
12302 [(set_attr "type" "two")
12303 (set_attr "length" "8")])
12305 (define_insn "*plus_ne0_<mode>"
12306 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
12307 (plus:P (ne:P (match_operand:P 1 "gpc_reg_operand" "r")
12309 (match_operand:P 2 "gpc_reg_operand" "r")))
12310 (clobber (match_scratch:P 3 "=&r"))]
12312 "addic %3,%1,-1\;addze %0,%2"
12313 [(set_attr "type" "two")
12314 (set_attr "length" "8")])
12316 (define_insn "*compare_plus_ne0_<mode>"
12317 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12318 (compare:CC (plus:P (ne:P (match_operand:P 1 "gpc_reg_operand" "r,r")
12320 (match_operand:P 2 "gpc_reg_operand" "r,r"))
12322 (clobber (match_scratch:P 3 "=&r,&r"))
12323 (clobber (match_scratch:P 4 "=X,&r"))]
12326 addic %3,%1,-1\;addze. %3,%2
12328 [(set_attr "type" "compare")
12329 (set_attr "length" "8,12")])
12332 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
12333 (compare:CC (ne:P (match_operand:SI 1 "gpc_reg_operand" "")
12335 (neg:P (match_operand:P 2 "gpc_reg_operand" ""))))
12336 (clobber (match_scratch:P 3 ""))
12337 (clobber (match_scratch:P 4 ""))]
12339 [(parallel [(set (match_dup 3)
12340 (plus:P (ne:P (match_dup 1)
12343 (clobber (match_dup 4))])
12345 (compare:CC (match_dup 3)
12350 (define_insn "*compare_plus_ne0_<mode>_1"
12351 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
12352 (compare:CCEQ (ne:P (match_operand:P 1 "gpc_reg_operand" "r,r")
12354 (neg:P (match_operand:P 2 "gpc_reg_operand" "r,r"))))
12355 (clobber (match_scratch:P 3 "=&r,&r"))
12356 (clobber (match_scratch:P 4 "=X,&r"))]
12359 addic %3,%1,-1\;addze. %3,%2
12361 [(set_attr "type" "compare")
12362 (set_attr "length" "8,12")])
12365 [(set (match_operand:CCEQ 0 "cc_reg_not_micro_cr0_operand" "")
12366 (compare:CCEQ (ne:P (match_operand:SI 1 "gpc_reg_operand" "")
12368 (neg:P (match_operand:P 2 "gpc_reg_operand" ""))))
12369 (clobber (match_scratch:P 3 ""))
12370 (clobber (match_scratch:P 4 ""))]
12372 [(parallel [(set (match_dup 3)
12373 (plus:P (ne:P (match_dup 1)
12376 (clobber (match_dup 4))])
12378 (compare:CC (match_dup 3)
12382 (define_insn "*plus_ne0_<mode>_compare"
12383 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12385 (plus:P (ne:P (match_operand:P 1 "gpc_reg_operand" "r,r")
12387 (match_operand:P 2 "gpc_reg_operand" "r,r"))
12389 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
12390 (plus:P (ne:P (match_dup 1)
12393 (clobber (match_scratch:P 3 "=&r,&r"))]
12396 addic %3,%1,-1\;addze. %0,%2
12398 [(set_attr "type" "compare")
12399 (set_attr "length" "8,12")])
12402 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
12404 (plus:P (ne:P (match_operand:P 1 "gpc_reg_operand" "")
12406 (match_operand:P 2 "gpc_reg_operand" ""))
12408 (set (match_operand:P 0 "gpc_reg_operand" "")
12409 (plus:P (ne:P (match_dup 1)
12412 (clobber (match_scratch:P 3 ""))]
12414 [(parallel [(set (match_dup 0)
12415 (plus:P (ne:P (match_dup 1)
12418 (clobber (match_dup 3))])
12420 (compare:CC (match_dup 0)
12424 (define_insn "*leu<mode>"
12425 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
12426 (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
12427 (match_operand:P 2 "reg_or_short_operand" "rI")))]
12429 "subf%I2c %0,%1,%2\;li %0,0\;adde %0,%0,%0"
12430 [(set_attr "type" "three")
12431 (set_attr "length" "12")])
12433 (define_insn "*leu<mode>_compare"
12434 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12436 (leu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
12437 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
12439 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
12440 (leu:P (match_dup 1) (match_dup 2)))]
12443 subf%I2c %0,%1,%2\;li %0,0\;adde. %0,%0,%0
12445 [(set_attr "type" "compare")
12446 (set_attr "length" "12,16")])
12449 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12451 (leu:P (match_operand:P 1 "gpc_reg_operand" "")
12452 (match_operand:P 2 "reg_or_short_operand" ""))
12454 (set (match_operand:P 0 "gpc_reg_operand" "")
12455 (leu:P (match_dup 1) (match_dup 2)))]
12457 [(set (match_dup 0)
12458 (leu:P (match_dup 1) (match_dup 2)))
12460 (compare:CC (match_dup 0)
12464 (define_insn "*plus_leu<mode>"
12465 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
12466 (plus:P (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
12467 (match_operand:P 2 "reg_or_short_operand" "rI"))
12468 (match_operand:P 3 "gpc_reg_operand" "r")))]
12470 "subf%I2c %0,%1,%2\;addze %0,%3"
12471 [(set_attr "type" "two")
12472 (set_attr "length" "8")])
12475 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12477 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12478 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12479 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12481 (clobber (match_scratch:SI 4 "=&r,&r"))]
12484 subf%I2c %4,%1,%2\;addze. %4,%3
12486 [(set_attr "type" "compare")
12487 (set_attr "length" "8,12")])
12490 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12492 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12493 (match_operand:SI 2 "reg_or_short_operand" ""))
12494 (match_operand:SI 3 "gpc_reg_operand" ""))
12496 (clobber (match_scratch:SI 4 ""))]
12497 "TARGET_32BIT && reload_completed"
12498 [(set (match_dup 4)
12499 (plus:SI (leu:SI (match_dup 1) (match_dup 2))
12502 (compare:CC (match_dup 4)
12507 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12509 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12510 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12511 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12513 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12514 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12517 subf%I2c %0,%1,%2\;addze. %0,%3
12519 [(set_attr "type" "compare")
12520 (set_attr "length" "8,12")])
12523 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12525 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12526 (match_operand:SI 2 "reg_or_short_operand" ""))
12527 (match_operand:SI 3 "gpc_reg_operand" ""))
12529 (set (match_operand:SI 0 "gpc_reg_operand" "")
12530 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12531 "TARGET_32BIT && reload_completed"
12532 [(set (match_dup 0)
12533 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12535 (compare:CC (match_dup 0)
12539 (define_insn "*neg_leu<mode>"
12540 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
12541 (neg:P (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
12542 (match_operand:P 2 "reg_or_short_operand" "rI"))))]
12544 "subf%I2c %0,%1,%2\;subfe %0,%0,%0\;nand %0,%0,%0"
12545 [(set_attr "type" "three")
12546 (set_attr "length" "12")])
12548 (define_insn "*and_neg_leu<mode>"
12549 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
12551 (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
12552 (match_operand:P 2 "reg_or_short_operand" "rI")))
12553 (match_operand:P 3 "gpc_reg_operand" "r")))]
12555 "subf%I2c %0,%1,%2\;subfe %0,%0,%0\;andc %0,%3,%0"
12556 [(set_attr "type" "three")
12557 (set_attr "length" "12")])
12560 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12563 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12564 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
12565 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12567 (clobber (match_scratch:SI 4 "=&r,&r"))]
12570 subf%I2c %4,%1,%2\;subfe %4,%4,%4\;andc. %4,%3,%4
12572 [(set_attr "type" "compare")
12573 (set_attr "length" "12,16")])
12576 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12579 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12580 (match_operand:SI 2 "reg_or_short_operand" "")))
12581 (match_operand:SI 3 "gpc_reg_operand" ""))
12583 (clobber (match_scratch:SI 4 ""))]
12584 "TARGET_32BIT && reload_completed"
12585 [(set (match_dup 4)
12586 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
12589 (compare:CC (match_dup 4)
12594 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12597 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12598 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
12599 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12601 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12602 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12605 subf%I2c %0,%1,%2\;subfe %0,%0,%0\;andc. %0,%3,%0
12607 [(set_attr "type" "compare")
12608 (set_attr "length" "12,16")])
12611 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12614 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12615 (match_operand:SI 2 "reg_or_short_operand" "")))
12616 (match_operand:SI 3 "gpc_reg_operand" ""))
12618 (set (match_operand:SI 0 "gpc_reg_operand" "")
12619 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12620 "TARGET_32BIT && reload_completed"
12621 [(set (match_dup 0)
12622 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
12625 (compare:CC (match_dup 0)
12629 (define_insn_and_split "*ltu<mode>"
12630 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
12631 (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
12632 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))]
12636 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
12637 (set (match_dup 0) (neg:P (match_dup 0)))]
12640 (define_insn_and_split "*ltu<mode>_compare"
12641 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
12643 (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
12644 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
12646 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
12647 (ltu:P (match_dup 1) (match_dup 2)))]
12651 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
12652 (parallel [(set (match_dup 3)
12653 (compare:CC (neg:P (match_dup 0)) (const_int 0)))
12654 (set (match_dup 0) (neg:P (match_dup 0)))])]
12657 (define_insn_and_split "*plus_ltu<mode>"
12658 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,r")
12659 (plus:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
12660 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))
12661 (match_operand:P 3 "reg_or_short_operand" "rI,rI")))]
12664 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
12665 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
12666 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))]
12669 (define_insn_and_split "*plus_ltu<mode>_compare"
12670 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12672 (plus:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
12673 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
12674 (match_operand:P 3 "gpc_reg_operand" "r,r,r,r"))
12676 (set (match_operand:P 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12677 (plus:P (ltu:P (match_dup 1) (match_dup 2)) (match_dup 3)))]
12680 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
12681 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
12682 (parallel [(set (match_dup 4)
12683 (compare:CC (minus:P (match_dup 3) (match_dup 0))
12685 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))])]
12688 (define_insn "*neg_ltu<mode>"
12689 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
12690 (neg:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
12691 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))))]
12694 subfc %0,%2,%1\;subfe %0,%0,%0
12695 addic %0,%1,%n2\;subfe %0,%0,%0"
12696 [(set_attr "type" "two")
12697 (set_attr "length" "8")])
12699 (define_insn "*geu<mode>"
12700 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
12701 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
12702 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))]
12705 subfc %0,%2,%1\;li %0,0\;adde %0,%0,%0
12706 addic %0,%1,%n2\;li %0,0\;adde %0,%0,%0"
12707 [(set_attr "type" "three")
12708 (set_attr "length" "12")])
12710 (define_insn "*geu<mode>_compare"
12711 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
12713 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
12714 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
12716 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
12717 (geu:P (match_dup 1) (match_dup 2)))]
12720 subfc %0,%2,%1\;li %0,0\;adde. %0,%0,%0
12721 addic %0,%1,%n2\;li %0,0\;adde. %0,%0,%0
12724 [(set_attr "type" "compare")
12725 (set_attr "length" "12,12,16,16")])
12728 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
12730 (geu:P (match_operand:P 1 "gpc_reg_operand" "")
12731 (match_operand:P 2 "reg_or_neg_short_operand" ""))
12733 (set (match_operand:P 0 "gpc_reg_operand" "")
12734 (geu:P (match_dup 1) (match_dup 2)))]
12736 [(set (match_dup 0)
12737 (geu:P (match_dup 1) (match_dup 2)))
12739 (compare:CC (match_dup 0)
12743 (define_insn "*plus_geu<mode>"
12744 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,&r")
12745 (plus:P (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
12746 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))
12747 (match_operand:P 3 "gpc_reg_operand" "r,r")))]
12750 subfc %0,%2,%1\;addze %0,%3
12751 addic %0,%1,%n2\;addze %0,%3"
12752 [(set_attr "type" "two")
12753 (set_attr "length" "8")])
12756 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12758 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12759 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12760 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12762 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12765 subfc %4,%2,%1\;addze. %4,%3
12766 addic %4,%1,%n2\;addze. %4,%3
12769 [(set_attr "type" "compare")
12770 (set_attr "length" "8,8,12,12")])
12773 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12775 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12776 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12777 (match_operand:SI 3 "gpc_reg_operand" ""))
12779 (clobber (match_scratch:SI 4 ""))]
12780 "TARGET_32BIT && reload_completed"
12781 [(set (match_dup 4)
12782 (plus:SI (geu:SI (match_dup 1) (match_dup 2))
12785 (compare:CC (match_dup 4)
12790 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12792 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12793 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12794 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12796 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12797 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12800 subfc %0,%2,%1\;addze. %0,%3
12801 addic %0,%1,%n2\;addze. %0,%3
12804 [(set_attr "type" "compare")
12805 (set_attr "length" "8,8,12,12")])
12808 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12810 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12811 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12812 (match_operand:SI 3 "gpc_reg_operand" ""))
12814 (set (match_operand:SI 0 "gpc_reg_operand" "")
12815 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12816 "TARGET_32BIT && reload_completed"
12817 [(set (match_dup 0)
12818 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12820 (compare:CC (match_dup 0)
12824 (define_insn "*neg_geu<mode>"
12825 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
12826 (neg:P (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
12827 (match_operand:P 2 "reg_or_short_operand" "r,I"))))]
12830 subfc %0,%2,%1\;subfe %0,%0,%0\;nand %0,%0,%0
12831 subfic %0,%1,-1\;add%I2c %0,%0,%2\;subfe %0,%0,%0"
12832 [(set_attr "type" "three")
12833 (set_attr "length" "12")])
12835 (define_insn "*and_neg_geu<mode>"
12836 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,&r")
12838 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
12839 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))
12840 (match_operand:P 3 "gpc_reg_operand" "r,r")))]
12843 subfc %0,%2,%1\;subfe %0,%0,%0\;andc %0,%3,%0
12844 addic %0,%1,%n2\;subfe %0,%0,%0\;andc %0,%3,%0"
12845 [(set_attr "type" "three")
12846 (set_attr "length" "12")])
12849 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12852 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12853 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
12854 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12856 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12859 subfc %4,%2,%1\;subfe %4,%4,%4\;andc. %4,%3,%4
12860 addic %4,%1,%n2\;subfe %4,%4,%4\;andc. %4,%3,%4
12863 [(set_attr "type" "compare")
12864 (set_attr "length" "12,12,16,16")])
12867 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12870 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12871 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
12872 (match_operand:SI 3 "gpc_reg_operand" ""))
12874 (clobber (match_scratch:SI 4 ""))]
12875 "TARGET_32BIT && reload_completed"
12876 [(set (match_dup 4)
12877 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2)))
12880 (compare:CC (match_dup 4)
12885 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12888 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12889 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
12890 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12892 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12893 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12896 subfc %0,%2,%1\;subfe %0,%0,%0\;andc. %0,%3,%0
12897 addic %0,%1,%n2\;subfe %0,%0,%0\;andc. %0,%3,%0
12900 [(set_attr "type" "compare")
12901 (set_attr "length" "12,12,16,16")])
12904 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12907 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12908 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
12909 (match_operand:SI 3 "gpc_reg_operand" ""))
12911 (set (match_operand:SI 0 "gpc_reg_operand" "")
12912 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12913 "TARGET_32BIT && reload_completed"
12914 [(set (match_dup 0)
12915 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
12917 (compare:CC (match_dup 0)
12921 (define_insn "*plus_gt0<mode>"
12922 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
12923 (plus:P (gt:P (match_operand:P 1 "gpc_reg_operand" "r")
12925 (match_operand:P 2 "gpc_reg_operand" "r")))]
12927 "addc %0,%1,%1\;subfe %0,%1,%0\;addze %0,%2"
12928 [(set_attr "type" "three")
12929 (set_attr "length" "12")])
12932 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12934 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12936 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
12938 (clobber (match_scratch:SI 3 "=&r,&r"))]
12941 addc %3,%1,%1\;subfe %3,%1,%3\;addze. %3,%2
12943 [(set_attr "type" "compare")
12944 (set_attr "length" "12,16")])
12947 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12949 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12951 (match_operand:SI 2 "gpc_reg_operand" ""))
12953 (clobber (match_scratch:SI 3 ""))]
12954 "TARGET_32BIT && reload_completed"
12955 [(set (match_dup 3)
12956 (plus:SI (gt:SI (match_dup 1) (const_int 0))
12959 (compare:CC (match_dup 3)
12964 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12966 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12968 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
12970 (clobber (match_scratch:DI 3 "=&r,&r"))]
12973 addc %3,%1,%1\;subfe %3,%1,%3\;addze. %3,%2
12975 [(set_attr "type" "compare")
12976 (set_attr "length" "12,16")])
12979 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
12981 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
12983 (match_operand:DI 2 "gpc_reg_operand" ""))
12985 (clobber (match_scratch:DI 3 ""))]
12986 "TARGET_64BIT && reload_completed"
12987 [(set (match_dup 3)
12988 (plus:DI (gt:DI (match_dup 1) (const_int 0))
12991 (compare:CC (match_dup 3)
12996 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12998 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13000 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
13002 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13003 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
13006 addc %0,%1,%1\;subfe %0,%1,%0\;addze. %0,%2
13008 [(set_attr "type" "compare")
13009 (set_attr "length" "12,16")])
13012 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13014 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13016 (match_operand:SI 2 "gpc_reg_operand" ""))
13018 (set (match_operand:SI 0 "gpc_reg_operand" "")
13019 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
13020 "TARGET_32BIT && reload_completed"
13021 [(set (match_dup 0)
13022 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))
13024 (compare:CC (match_dup 0)
13029 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13031 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13033 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
13035 (set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
13036 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
13039 addc %0,%1,%1\;subfe %0,%1,%0\;addze. %0,%2
13041 [(set_attr "type" "compare")
13042 (set_attr "length" "12,16")])
13045 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
13047 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
13049 (match_operand:DI 2 "gpc_reg_operand" ""))
13051 (set (match_operand:DI 0 "gpc_reg_operand" "")
13052 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
13053 "TARGET_64BIT && reload_completed"
13054 [(set (match_dup 0)
13055 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))
13057 (compare:CC (match_dup 0)
13061 (define_insn_and_split "*gtu<mode>"
13062 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13063 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
13064 (match_operand:P 2 "reg_or_short_operand" "rI")))]
13068 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
13069 (set (match_dup 0) (neg:P (match_dup 0)))]
13072 (define_insn_and_split "*gtu<mode>_compare"
13073 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13075 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13076 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
13078 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13079 (gtu:P (match_dup 1) (match_dup 2)))]
13083 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
13084 (parallel [(set (match_dup 3)
13085 (compare:CC (neg:P (match_dup 0)) (const_int 0)))
13086 (set (match_dup 0) (neg:P (match_dup 0)))])]
13089 (define_insn_and_split "*plus_gtu<mode>"
13090 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
13091 (plus:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
13092 (match_operand:P 2 "reg_or_short_operand" "rI"))
13093 (match_operand:P 3 "reg_or_short_operand" "rI")))]
13096 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13097 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
13098 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))]
13101 (define_insn_and_split "*plus_gtu<mode>_compare"
13102 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13104 (plus:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
13105 (match_operand:P 2 "reg_or_short_operand" "I,r,I,r"))
13106 (match_operand:P 3 "gpc_reg_operand" "r,r,r,r"))
13108 (set (match_operand:P 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13109 (plus:P (gtu:P (match_dup 1) (match_dup 2)) (match_dup 3)))]
13112 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13113 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
13114 (parallel [(set (match_dup 4)
13115 (compare:CC (minus:P (match_dup 3) (match_dup 0))
13117 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))])]
13120 (define_insn "*neg_gtu<mode>"
13121 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13122 (neg:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
13123 (match_operand:P 2 "reg_or_short_operand" "rI"))))]
13125 "subf%I2c %0,%1,%2\;subfe %0,%0,%0"
13126 [(set_attr "type" "two")
13127 (set_attr "length" "8")])
13130 ;; Define both directions of branch and return. If we need a reload
13131 ;; register, we'd rather use CR0 since it is much easier to copy a
13132 ;; register CC value to there.
13136 (if_then_else (match_operator 1 "branch_comparison_operator"
13138 "cc_reg_operand" "y")
13140 (label_ref (match_operand 0 "" ""))
13145 return output_cbranch (operands[1], \"%l0\", 0, insn);
13147 [(set_attr "type" "branch")])
13151 (if_then_else (match_operator 0 "branch_comparison_operator"
13153 "cc_reg_operand" "y")
13160 return output_cbranch (operands[0], NULL, 0, insn);
13162 [(set_attr "type" "jmpreg")
13163 (set_attr "length" "4")])
13167 (if_then_else (match_operator 1 "branch_comparison_operator"
13169 "cc_reg_operand" "y")
13172 (label_ref (match_operand 0 "" ""))))]
13176 return output_cbranch (operands[1], \"%l0\", 1, insn);
13178 [(set_attr "type" "branch")])
13182 (if_then_else (match_operator 0 "branch_comparison_operator"
13184 "cc_reg_operand" "y")
13191 return output_cbranch (operands[0], NULL, 1, insn);
13193 [(set_attr "type" "jmpreg")
13194 (set_attr "length" "4")])
13196 ;; Logic on condition register values.
13198 ; This pattern matches things like
13199 ; (set (reg:CCEQ 68) (compare:CCEQ (ior:SI (gt:SI (reg:CCFP 68) (const_int 0))
13200 ; (eq:SI (reg:CCFP 68) (const_int 0)))
13202 ; which are generated by the branch logic.
13203 ; Prefer destructive operations where BT = BB (for crXX BT,BA,BB)
13205 (define_insn "*cceq_ior_compare"
13206 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13207 (compare:CCEQ (match_operator:SI 1 "boolean_operator"
13208 [(match_operator:SI 2
13209 "branch_positive_comparison_operator"
13211 "cc_reg_operand" "y,y")
13213 (match_operator:SI 4
13214 "branch_positive_comparison_operator"
13216 "cc_reg_operand" "0,y")
13220 "cr%q1 %E0,%j2,%j4"
13221 [(set_attr "type" "cr_logical,delayed_cr")])
13223 ; Why is the constant -1 here, but 1 in the previous pattern?
13224 ; Because ~1 has all but the low bit set.
13226 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13227 (compare:CCEQ (match_operator:SI 1 "boolean_or_operator"
13228 [(not:SI (match_operator:SI 2
13229 "branch_positive_comparison_operator"
13231 "cc_reg_operand" "y,y")
13233 (match_operator:SI 4
13234 "branch_positive_comparison_operator"
13236 "cc_reg_operand" "0,y")
13240 "cr%q1 %E0,%j2,%j4"
13241 [(set_attr "type" "cr_logical,delayed_cr")])
13243 (define_insn "*cceq_rev_compare"
13244 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13245 (compare:CCEQ (match_operator:SI 1
13246 "branch_positive_comparison_operator"
13248 "cc_reg_operand" "0,y")
13253 [(set_attr "type" "cr_logical,delayed_cr")])
13255 ;; If we are comparing the result of two comparisons, this can be done
13256 ;; using creqv or crxor.
13258 (define_insn_and_split ""
13259 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
13260 (compare:CCEQ (match_operator 1 "branch_comparison_operator"
13261 [(match_operand 2 "cc_reg_operand" "y")
13263 (match_operator 3 "branch_comparison_operator"
13264 [(match_operand 4 "cc_reg_operand" "y")
13269 [(set (match_dup 0) (compare:CCEQ (xor:SI (match_dup 1) (match_dup 3))
13273 int positive_1, positive_2;
13275 positive_1 = branch_positive_comparison_operator (operands[1],
13276 GET_MODE (operands[1]));
13277 positive_2 = branch_positive_comparison_operator (operands[3],
13278 GET_MODE (operands[3]));
13281 operands[1] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[2]),
13282 GET_CODE (operands[1])),
13284 operands[2], const0_rtx);
13285 else if (GET_MODE (operands[1]) != SImode)
13286 operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]), SImode,
13287 operands[2], const0_rtx);
13290 operands[3] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[4]),
13291 GET_CODE (operands[3])),
13293 operands[4], const0_rtx);
13294 else if (GET_MODE (operands[3]) != SImode)
13295 operands[3] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
13296 operands[4], const0_rtx);
13298 if (positive_1 == positive_2)
13300 operands[1] = gen_rtx_NOT (SImode, operands[1]);
13301 operands[5] = constm1_rtx;
13305 operands[5] = const1_rtx;
13309 ;; Unconditional branch and return.
13311 (define_insn "jump"
13313 (label_ref (match_operand 0 "" "")))]
13316 [(set_attr "type" "branch")])
13318 (define_insn "<return_str>return"
13322 [(set_attr "type" "jmpreg")])
13324 (define_expand "indirect_jump"
13325 [(set (pc) (match_operand 0 "register_operand" ""))])
13327 (define_insn "*indirect_jump<mode>"
13328 [(set (pc) (match_operand:P 0 "register_operand" "c,*l"))]
13333 [(set_attr "type" "jmpreg")])
13335 ;; Table jump for switch statements:
13336 (define_expand "tablejump"
13337 [(use (match_operand 0 "" ""))
13338 (use (label_ref (match_operand 1 "" "")))]
13343 emit_jump_insn (gen_tablejumpsi (operands[0], operands[1]));
13345 emit_jump_insn (gen_tablejumpdi (operands[0], operands[1]));
13349 (define_expand "tablejumpsi"
13350 [(set (match_dup 3)
13351 (plus:SI (match_operand:SI 0 "" "")
13353 (parallel [(set (pc) (match_dup 3))
13354 (use (label_ref (match_operand 1 "" "")))])]
13357 { operands[0] = force_reg (SImode, operands[0]);
13358 operands[2] = force_reg (SImode, gen_rtx_LABEL_REF (SImode, operands[1]));
13359 operands[3] = gen_reg_rtx (SImode);
13362 (define_expand "tablejumpdi"
13363 [(set (match_dup 4)
13364 (sign_extend:DI (match_operand:SI 0 "lwa_operand" "")))
13366 (plus:DI (match_dup 4)
13368 (parallel [(set (pc) (match_dup 3))
13369 (use (label_ref (match_operand 1 "" "")))])]
13372 { operands[2] = force_reg (DImode, gen_rtx_LABEL_REF (DImode, operands[1]));
13373 operands[3] = gen_reg_rtx (DImode);
13374 operands[4] = gen_reg_rtx (DImode);
13377 (define_insn "*tablejump<mode>_internal1"
13379 (match_operand:P 0 "register_operand" "c,*l"))
13380 (use (label_ref (match_operand 1 "" "")))]
13385 [(set_attr "type" "jmpreg")])
13392 (define_insn "group_ending_nop"
13393 [(unspec [(const_int 0)] UNSPEC_GRP_END_NOP)]
13397 if (rs6000_cpu_attr == CPU_POWER6)
13398 return \"ori 1,1,0\";
13399 return \"ori 2,2,0\";
13402 ;; Define the subtract-one-and-jump insns, starting with the template
13403 ;; so loop.c knows what to generate.
13405 (define_expand "doloop_end"
13406 [(use (match_operand 0 "" "")) ; loop pseudo
13407 (use (match_operand 1 "" ""))] ; label
13413 if (GET_MODE (operands[0]) != DImode)
13415 emit_jump_insn (gen_ctrdi (operands[0], operands[1]));
13419 if (GET_MODE (operands[0]) != SImode)
13421 emit_jump_insn (gen_ctrsi (operands[0], operands[1]));
13426 (define_expand "ctr<mode>"
13427 [(parallel [(set (pc)
13428 (if_then_else (ne (match_operand:P 0 "register_operand" "")
13430 (label_ref (match_operand 1 "" ""))
13433 (plus:P (match_dup 0)
13435 (clobber (match_scratch:CC 2 ""))
13436 (clobber (match_scratch:P 3 ""))])]
13440 ;; We need to be able to do this for any operand, including MEM, or we
13441 ;; will cause reload to blow up since we don't allow output reloads on
13443 ;; For the length attribute to be calculated correctly, the
13444 ;; label MUST be operand 0.
13446 (define_insn "*ctr<mode>_internal1"
13448 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
13450 (label_ref (match_operand 0 "" ""))
13452 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*c*l")
13453 (plus:P (match_dup 1)
13455 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
13456 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
13460 if (which_alternative != 0)
13462 else if (get_attr_length (insn) == 4)
13463 return \"bdnz %l0\";
13465 return \"bdz $+8\;b %l0\";
13467 [(set_attr "type" "branch")
13468 (set_attr "length" "*,12,16,16")])
13470 (define_insn "*ctr<mode>_internal2"
13472 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
13475 (label_ref (match_operand 0 "" ""))))
13476 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*c*l")
13477 (plus:P (match_dup 1)
13479 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
13480 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
13484 if (which_alternative != 0)
13486 else if (get_attr_length (insn) == 4)
13487 return \"bdz %l0\";
13489 return \"bdnz $+8\;b %l0\";
13491 [(set_attr "type" "branch")
13492 (set_attr "length" "*,12,16,16")])
13494 ;; Similar but use EQ
13496 (define_insn "*ctr<mode>_internal5"
13498 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
13500 (label_ref (match_operand 0 "" ""))
13502 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*c*l")
13503 (plus:P (match_dup 1)
13505 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
13506 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
13510 if (which_alternative != 0)
13512 else if (get_attr_length (insn) == 4)
13513 return \"bdz %l0\";
13515 return \"bdnz $+8\;b %l0\";
13517 [(set_attr "type" "branch")
13518 (set_attr "length" "*,12,16,16")])
13520 (define_insn "*ctr<mode>_internal6"
13522 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
13525 (label_ref (match_operand 0 "" ""))))
13526 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*c*l")
13527 (plus:P (match_dup 1)
13529 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
13530 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
13534 if (which_alternative != 0)
13536 else if (get_attr_length (insn) == 4)
13537 return \"bdnz %l0\";
13539 return \"bdz $+8\;b %l0\";
13541 [(set_attr "type" "branch")
13542 (set_attr "length" "*,12,16,16")])
13544 ;; Now the splitters if we could not allocate the CTR register
13548 (if_then_else (match_operator 2 "comparison_operator"
13549 [(match_operand:P 1 "gpc_reg_operand" "")
13551 (match_operand 5 "" "")
13552 (match_operand 6 "" "")))
13553 (set (match_operand:P 0 "gpc_reg_operand" "")
13554 (plus:P (match_dup 1) (const_int -1)))
13555 (clobber (match_scratch:CC 3 ""))
13556 (clobber (match_scratch:P 4 ""))]
13558 [(parallel [(set (match_dup 3)
13559 (compare:CC (plus:P (match_dup 1)
13563 (plus:P (match_dup 1)
13565 (set (pc) (if_then_else (match_dup 7)
13569 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
13570 operands[3], const0_rtx); }")
13574 (if_then_else (match_operator 2 "comparison_operator"
13575 [(match_operand:P 1 "gpc_reg_operand" "")
13577 (match_operand 5 "" "")
13578 (match_operand 6 "" "")))
13579 (set (match_operand:P 0 "nonimmediate_operand" "")
13580 (plus:P (match_dup 1) (const_int -1)))
13581 (clobber (match_scratch:CC 3 ""))
13582 (clobber (match_scratch:P 4 ""))]
13583 "reload_completed && ! gpc_reg_operand (operands[0], SImode)"
13584 [(parallel [(set (match_dup 3)
13585 (compare:CC (plus:P (match_dup 1)
13589 (plus:P (match_dup 1)
13593 (set (pc) (if_then_else (match_dup 7)
13597 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
13598 operands[3], const0_rtx); }")
13600 (define_insn "trap"
13601 [(trap_if (const_int 1) (const_int 0))]
13604 [(set_attr "type" "trap")])
13606 (define_expand "ctrap<mode>4"
13607 [(trap_if (match_operator 0 "ordered_comparison_operator"
13608 [(match_operand:GPR 1 "register_operand")
13609 (match_operand:GPR 2 "reg_or_short_operand")])
13610 (match_operand 3 "zero_constant" ""))]
13615 [(trap_if (match_operator 0 "ordered_comparison_operator"
13616 [(match_operand:GPR 1 "register_operand" "r")
13617 (match_operand:GPR 2 "reg_or_short_operand" "rI")])
13620 "t<wd>%V0%I2 %1,%2"
13621 [(set_attr "type" "trap")])
13623 ;; Insns related to generating the function prologue and epilogue.
13625 (define_expand "prologue"
13626 [(use (const_int 0))]
13629 rs6000_emit_prologue ();
13630 if (!TARGET_SCHED_PROLOG)
13631 emit_insn (gen_blockage ());
13635 (define_insn "*movesi_from_cr_one"
13636 [(match_parallel 0 "mfcr_operation"
13637 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
13638 (unspec:SI [(match_operand:CC 2 "cc_reg_operand" "y")
13639 (match_operand 3 "immediate_operand" "n")]
13640 UNSPEC_MOVESI_FROM_CR))])]
13646 for (i = 0; i < XVECLEN (operands[0], 0); i++)
13648 mask = INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
13649 operands[4] = GEN_INT (mask);
13650 output_asm_insn (\"mfcr %1,%4\", operands);
13654 [(set_attr "type" "mfcrf")])
13656 (define_insn "movesi_from_cr"
13657 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13658 (unspec:SI [(reg:CC CR0_REGNO) (reg:CC CR1_REGNO)
13659 (reg:CC CR2_REGNO) (reg:CC CR3_REGNO)
13660 (reg:CC CR4_REGNO) (reg:CC CR5_REGNO)
13661 (reg:CC CR6_REGNO) (reg:CC CR7_REGNO)]
13662 UNSPEC_MOVESI_FROM_CR))]
13665 [(set_attr "type" "mfcr")])
13667 (define_insn "*crsave"
13668 [(match_parallel 0 "crsave_operation"
13669 [(set (match_operand:SI 1 "memory_operand" "=m")
13670 (match_operand:SI 2 "gpc_reg_operand" "r"))])]
13673 [(set_attr "type" "store")])
13675 (define_insn "*stmw"
13676 [(match_parallel 0 "stmw_operation"
13677 [(set (match_operand:SI 1 "memory_operand" "=m")
13678 (match_operand:SI 2 "gpc_reg_operand" "r"))])]
13681 [(set_attr "type" "store")
13682 (set_attr "update" "yes")
13683 (set_attr "indexed" "yes")])
13685 ; The following comment applies to:
13689 ; return_and_restore_gpregs*
13690 ; return_and_restore_fpregs*
13691 ; return_and_restore_fpregs_aix*
13693 ; The out-of-line save / restore functions expects one input argument.
13694 ; Since those are not standard call_insn's, we must avoid using
13695 ; MATCH_OPERAND for that argument. That way the register rename
13696 ; optimization will not try to rename this register.
13697 ; Each pattern is repeated for each possible register number used in
13698 ; various ABIs (r11, r1, and for some functions r12)
13700 (define_insn "*save_gpregs_<mode>_r11"
13701 [(match_parallel 0 "any_parallel_operand"
13702 [(clobber (reg:P 65))
13703 (use (match_operand:P 1 "symbol_ref_operand" "s"))
13705 (set (match_operand:P 2 "memory_operand" "=m")
13706 (match_operand:P 3 "gpc_reg_operand" "r"))])]
13709 [(set_attr "type" "branch")
13710 (set_attr "length" "4")])
13712 (define_insn "*save_gpregs_<mode>_r12"
13713 [(match_parallel 0 "any_parallel_operand"
13714 [(clobber (reg:P 65))
13715 (use (match_operand:P 1 "symbol_ref_operand" "s"))
13717 (set (match_operand:P 2 "memory_operand" "=m")
13718 (match_operand:P 3 "gpc_reg_operand" "r"))])]
13721 [(set_attr "type" "branch")
13722 (set_attr "length" "4")])
13724 (define_insn "*save_gpregs_<mode>_r1"
13725 [(match_parallel 0 "any_parallel_operand"
13726 [(clobber (reg:P 65))
13727 (use (match_operand:P 1 "symbol_ref_operand" "s"))
13729 (set (match_operand:P 2 "memory_operand" "=m")
13730 (match_operand:P 3 "gpc_reg_operand" "r"))])]
13733 [(set_attr "type" "branch")
13734 (set_attr "length" "4")])
13736 (define_insn "*save_fpregs_<mode>_r11"
13737 [(match_parallel 0 "any_parallel_operand"
13738 [(clobber (reg:P 65))
13739 (use (match_operand:P 1 "symbol_ref_operand" "s"))
13741 (set (match_operand:DF 2 "memory_operand" "=m")
13742 (match_operand:DF 3 "gpc_reg_operand" "d"))])]
13745 [(set_attr "type" "branch")
13746 (set_attr "length" "4")])
13748 (define_insn "*save_fpregs_<mode>_r12"
13749 [(match_parallel 0 "any_parallel_operand"
13750 [(clobber (reg:P 65))
13751 (use (match_operand:P 1 "symbol_ref_operand" "s"))
13753 (set (match_operand:DF 2 "memory_operand" "=m")
13754 (match_operand:DF 3 "gpc_reg_operand" "d"))])]
13757 [(set_attr "type" "branch")
13758 (set_attr "length" "4")])
13760 (define_insn "*save_fpregs_<mode>_r1"
13761 [(match_parallel 0 "any_parallel_operand"
13762 [(clobber (reg:P 65))
13763 (use (match_operand:P 1 "symbol_ref_operand" "s"))
13765 (set (match_operand:DF 2 "memory_operand" "=m")
13766 (match_operand:DF 3 "gpc_reg_operand" "d"))])]
13769 [(set_attr "type" "branch")
13770 (set_attr "length" "4")])
13772 ; This is to explain that changes to the stack pointer should
13773 ; not be moved over loads from or stores to stack memory.
13774 (define_insn "stack_tie"
13775 [(match_parallel 0 "tie_operand"
13776 [(set (mem:BLK (reg 1)) (const_int 0))])]
13779 [(set_attr "length" "0")])
13781 (define_expand "epilogue"
13782 [(use (const_int 0))]
13785 if (!TARGET_SCHED_PROLOG)
13786 emit_insn (gen_blockage ());
13787 rs6000_emit_epilogue (FALSE);
13791 ; On some processors, doing the mtcrf one CC register at a time is
13792 ; faster (like on the 604e). On others, doing them all at once is
13793 ; faster; for instance, on the 601 and 750.
13795 (define_expand "movsi_to_cr_one"
13796 [(set (match_operand:CC 0 "cc_reg_operand" "")
13797 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "")
13798 (match_dup 2)] UNSPEC_MOVESI_TO_CR))]
13800 "operands[2] = GEN_INT (1 << (75 - REGNO (operands[0])));")
13802 (define_insn "*movsi_to_cr"
13803 [(match_parallel 0 "mtcrf_operation"
13804 [(set (match_operand:CC 1 "cc_reg_operand" "=y")
13805 (unspec:CC [(match_operand:SI 2 "gpc_reg_operand" "r")
13806 (match_operand 3 "immediate_operand" "n")]
13807 UNSPEC_MOVESI_TO_CR))])]
13813 for (i = 0; i < XVECLEN (operands[0], 0); i++)
13814 mask |= INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
13815 operands[4] = GEN_INT (mask);
13816 return \"mtcrf %4,%2\";
13818 [(set_attr "type" "mtcr")])
13820 (define_insn "*mtcrfsi"
13821 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
13822 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
13823 (match_operand 2 "immediate_operand" "n")]
13824 UNSPEC_MOVESI_TO_CR))]
13825 "GET_CODE (operands[0]) == REG
13826 && CR_REGNO_P (REGNO (operands[0]))
13827 && GET_CODE (operands[2]) == CONST_INT
13828 && INTVAL (operands[2]) == 1 << (75 - REGNO (operands[0]))"
13830 [(set_attr "type" "mtcr")])
13832 ; The load-multiple instructions have similar properties.
13833 ; Note that "load_multiple" is a name known to the machine-independent
13834 ; code that actually corresponds to the PowerPC load-string.
13836 (define_insn "*lmw"
13837 [(match_parallel 0 "lmw_operation"
13838 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
13839 (match_operand:SI 2 "memory_operand" "m"))])]
13842 [(set_attr "type" "load")
13843 (set_attr "update" "yes")
13844 (set_attr "indexed" "yes")
13845 (set_attr "cell_micro" "always")])
13847 (define_insn "*return_internal_<mode>"
13849 (use (match_operand:P 0 "register_operand" "lc"))]
13852 [(set_attr "type" "jmpreg")])
13854 ; FIXME: This would probably be somewhat simpler if the Cygnus sibcall
13855 ; stuff was in GCC. Oh, and "any_parallel_operand" is a bit flexible...
13857 ; The following comment applies to:
13861 ; return_and_restore_gpregs*
13862 ; return_and_restore_fpregs*
13863 ; return_and_restore_fpregs_aix*
13865 ; The out-of-line save / restore functions expects one input argument.
13866 ; Since those are not standard call_insn's, we must avoid using
13867 ; MATCH_OPERAND for that argument. That way the register rename
13868 ; optimization will not try to rename this register.
13869 ; Each pattern is repeated for each possible register number used in
13870 ; various ABIs (r11, r1, and for some functions r12)
13872 (define_insn "*restore_gpregs_<mode>_r11"
13873 [(match_parallel 0 "any_parallel_operand"
13874 [(clobber (match_operand:P 1 "register_operand" "=l"))
13875 (use (match_operand:P 2 "symbol_ref_operand" "s"))
13877 (set (match_operand:P 3 "gpc_reg_operand" "=r")
13878 (match_operand:P 4 "memory_operand" "m"))])]
13881 [(set_attr "type" "branch")
13882 (set_attr "length" "4")])
13884 (define_insn "*restore_gpregs_<mode>_r12"
13885 [(match_parallel 0 "any_parallel_operand"
13886 [(clobber (match_operand:P 1 "register_operand" "=l"))
13887 (use (match_operand:P 2 "symbol_ref_operand" "s"))
13889 (set (match_operand:P 3 "gpc_reg_operand" "=r")
13890 (match_operand:P 4 "memory_operand" "m"))])]
13893 [(set_attr "type" "branch")
13894 (set_attr "length" "4")])
13896 (define_insn "*restore_gpregs_<mode>_r1"
13897 [(match_parallel 0 "any_parallel_operand"
13898 [(clobber (match_operand:P 1 "register_operand" "=l"))
13899 (use (match_operand:P 2 "symbol_ref_operand" "s"))
13901 (set (match_operand:P 3 "gpc_reg_operand" "=r")
13902 (match_operand:P 4 "memory_operand" "m"))])]
13905 [(set_attr "type" "branch")
13906 (set_attr "length" "4")])
13908 (define_insn "*return_and_restore_gpregs_<mode>_r11"
13909 [(match_parallel 0 "any_parallel_operand"
13911 (clobber (match_operand:P 1 "register_operand" "=l"))
13912 (use (match_operand:P 2 "symbol_ref_operand" "s"))
13914 (set (match_operand:P 3 "gpc_reg_operand" "=r")
13915 (match_operand:P 4 "memory_operand" "m"))])]
13918 [(set_attr "type" "branch")
13919 (set_attr "length" "4")])
13921 (define_insn "*return_and_restore_gpregs_<mode>_r12"
13922 [(match_parallel 0 "any_parallel_operand"
13924 (clobber (match_operand:P 1 "register_operand" "=l"))
13925 (use (match_operand:P 2 "symbol_ref_operand" "s"))
13927 (set (match_operand:P 3 "gpc_reg_operand" "=r")
13928 (match_operand:P 4 "memory_operand" "m"))])]
13931 [(set_attr "type" "branch")
13932 (set_attr "length" "4")])
13934 (define_insn "*return_and_restore_gpregs_<mode>_r1"
13935 [(match_parallel 0 "any_parallel_operand"
13937 (clobber (match_operand:P 1 "register_operand" "=l"))
13938 (use (match_operand:P 2 "symbol_ref_operand" "s"))
13940 (set (match_operand:P 3 "gpc_reg_operand" "=r")
13941 (match_operand:P 4 "memory_operand" "m"))])]
13944 [(set_attr "type" "branch")
13945 (set_attr "length" "4")])
13947 (define_insn "*return_and_restore_fpregs_<mode>_r11"
13948 [(match_parallel 0 "any_parallel_operand"
13950 (clobber (match_operand:P 1 "register_operand" "=l"))
13951 (use (match_operand:P 2 "symbol_ref_operand" "s"))
13953 (set (match_operand:DF 3 "gpc_reg_operand" "=d")
13954 (match_operand:DF 4 "memory_operand" "m"))])]
13957 [(set_attr "type" "branch")
13958 (set_attr "length" "4")])
13960 (define_insn "*return_and_restore_fpregs_<mode>_r12"
13961 [(match_parallel 0 "any_parallel_operand"
13963 (clobber (match_operand:P 1 "register_operand" "=l"))
13964 (use (match_operand:P 2 "symbol_ref_operand" "s"))
13966 (set (match_operand:DF 3 "gpc_reg_operand" "=d")
13967 (match_operand:DF 4 "memory_operand" "m"))])]
13970 [(set_attr "type" "branch")
13971 (set_attr "length" "4")])
13973 (define_insn "*return_and_restore_fpregs_<mode>_r1"
13974 [(match_parallel 0 "any_parallel_operand"
13976 (clobber (match_operand:P 1 "register_operand" "=l"))
13977 (use (match_operand:P 2 "symbol_ref_operand" "s"))
13979 (set (match_operand:DF 3 "gpc_reg_operand" "=d")
13980 (match_operand:DF 4 "memory_operand" "m"))])]
13983 [(set_attr "type" "branch")
13984 (set_attr "length" "4")])
13986 (define_insn "*return_and_restore_fpregs_aix_<mode>_r11"
13987 [(match_parallel 0 "any_parallel_operand"
13989 (use (match_operand:P 1 "register_operand" "l"))
13990 (use (match_operand:P 2 "symbol_ref_operand" "s"))
13992 (set (match_operand:DF 3 "gpc_reg_operand" "=d")
13993 (match_operand:DF 4 "memory_operand" "m"))])]
13996 [(set_attr "type" "branch")
13997 (set_attr "length" "4")])
13999 (define_insn "*return_and_restore_fpregs_aix_<mode>_r1"
14000 [(match_parallel 0 "any_parallel_operand"
14002 (use (match_operand:P 1 "register_operand" "l"))
14003 (use (match_operand:P 2 "symbol_ref_operand" "s"))
14005 (set (match_operand:DF 3 "gpc_reg_operand" "=d")
14006 (match_operand:DF 4 "memory_operand" "m"))])]
14009 [(set_attr "type" "branch")
14010 (set_attr "length" "4")])
14012 ; This is used in compiling the unwind routines.
14013 (define_expand "eh_return"
14014 [(use (match_operand 0 "general_operand" ""))]
14019 emit_insn (gen_eh_set_lr_si (operands[0]));
14021 emit_insn (gen_eh_set_lr_di (operands[0]));
14025 ; We can't expand this before we know where the link register is stored.
14026 (define_insn "eh_set_lr_<mode>"
14027 [(unspec_volatile [(match_operand:P 0 "register_operand" "r")]
14029 (clobber (match_scratch:P 1 "=&b"))]
14034 [(unspec_volatile [(match_operand 0 "register_operand" "")] UNSPECV_EH_RR)
14035 (clobber (match_scratch 1 ""))]
14040 rs6000_emit_eh_reg_restore (operands[0], operands[1]);
14044 (define_insn "prefetch"
14045 [(prefetch (match_operand 0 "indexed_or_indirect_address" "a")
14046 (match_operand:SI 1 "const_int_operand" "n")
14047 (match_operand:SI 2 "const_int_operand" "n"))]
14051 if (GET_CODE (operands[0]) == REG)
14052 return INTVAL (operands[1]) ? \"dcbtst 0,%0\" : \"dcbt 0,%0\";
14053 return INTVAL (operands[1]) ? \"dcbtst %a0\" : \"dcbt %a0\";
14055 [(set_attr "type" "load")])
14057 (define_insn "bpermd_<mode>"
14058 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
14059 (unspec:P [(match_operand:P 1 "gpc_reg_operand" "r")
14060 (match_operand:P 2 "gpc_reg_operand" "r")] UNSPEC_BPERM))]
14063 [(set_attr "type" "popcnt")])
14066 ;; Builtin fma support. Handle
14067 ;; Note that the conditions for expansion are in the FMA_F iterator.
14069 (define_expand "fma<mode>4"
14070 [(set (match_operand:FMA_F 0 "register_operand" "")
14072 (match_operand:FMA_F 1 "register_operand" "")
14073 (match_operand:FMA_F 2 "register_operand" "")
14074 (match_operand:FMA_F 3 "register_operand" "")))]
14078 (define_insn "*fma<mode>4_fpr"
14079 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>,<Fv>")
14081 (match_operand:SFDF 1 "gpc_reg_operand" "%<Ff>,<Fv>,<Fv>")
14082 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>,0")
14083 (match_operand:SFDF 3 "gpc_reg_operand" "<Ff>,0,<Fv>")))]
14084 "TARGET_<MODE>_FPR"
14086 fmadd<Ftrad> %0,%1,%2,%3
14087 xsmadda<Fvsx> %x0,%x1,%x2
14088 xsmaddm<Fvsx> %x0,%x1,%x3"
14089 [(set_attr "type" "fp")
14090 (set_attr "fp_type" "fp_maddsub_<Fs>")])
14092 ; Altivec only has fma and nfms.
14093 (define_expand "fms<mode>4"
14094 [(set (match_operand:FMA_F 0 "register_operand" "")
14096 (match_operand:FMA_F 1 "register_operand" "")
14097 (match_operand:FMA_F 2 "register_operand" "")
14098 (neg:FMA_F (match_operand:FMA_F 3 "register_operand" ""))))]
14099 "!VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
14102 (define_insn "*fms<mode>4_fpr"
14103 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>,<Fv>")
14105 (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>,<Fv>")
14106 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>,0")
14107 (neg:SFDF (match_operand:SFDF 3 "gpc_reg_operand" "<Ff>,0,<Fv>"))))]
14108 "TARGET_<MODE>_FPR"
14110 fmsub<Ftrad> %0,%1,%2,%3
14111 xsmsuba<Fvsx> %x0,%x1,%x2
14112 xsmsubm<Fvsx> %x0,%x1,%x3"
14113 [(set_attr "type" "fp")
14114 (set_attr "fp_type" "fp_maddsub_<Fs>")])
14116 ;; If signed zeros are ignored, -(a * b - c) = -a * b + c.
14117 (define_expand "fnma<mode>4"
14118 [(set (match_operand:FMA_F 0 "register_operand" "")
14121 (match_operand:FMA_F 1 "register_operand" "")
14122 (match_operand:FMA_F 2 "register_operand" "")
14123 (neg:FMA_F (match_operand:FMA_F 3 "register_operand" "")))))]
14124 "!HONOR_SIGNED_ZEROS (<MODE>mode)"
14127 ;; If signed zeros are ignored, -(a * b + c) = -a * b - c.
14128 (define_expand "fnms<mode>4"
14129 [(set (match_operand:FMA_F 0 "register_operand" "")
14132 (match_operand:FMA_F 1 "register_operand" "")
14133 (match_operand:FMA_F 2 "register_operand" "")
14134 (match_operand:FMA_F 3 "register_operand" ""))))]
14135 "!HONOR_SIGNED_ZEROS (<MODE>mode) && !VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
14138 ; Not an official optab name, but used from builtins.
14139 (define_expand "nfma<mode>4"
14140 [(set (match_operand:FMA_F 0 "register_operand" "")
14143 (match_operand:FMA_F 1 "register_operand" "")
14144 (match_operand:FMA_F 2 "register_operand" "")
14145 (match_operand:FMA_F 3 "register_operand" ""))))]
14146 "!VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
14149 (define_insn "*nfma<mode>4_fpr"
14150 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>,<Fv>")
14153 (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>,<Fv>")
14154 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>,0")
14155 (match_operand:SFDF 3 "gpc_reg_operand" "<Ff>,0,<Fv>"))))]
14156 "TARGET_<MODE>_FPR"
14158 fnmadd<Ftrad> %0,%1,%2,%3
14159 xsnmadda<Fvsx> %x0,%x1,%x2
14160 xsnmaddm<Fvsx> %x0,%x1,%x3"
14161 [(set_attr "type" "fp")
14162 (set_attr "fp_type" "fp_maddsub_<Fs>")])
14164 ; Not an official optab name, but used from builtins.
14165 (define_expand "nfms<mode>4"
14166 [(set (match_operand:FMA_F 0 "register_operand" "")
14169 (match_operand:FMA_F 1 "register_operand" "")
14170 (match_operand:FMA_F 2 "register_operand" "")
14171 (neg:FMA_F (match_operand:FMA_F 3 "register_operand" "")))))]
14175 (define_insn "*nfmssf4_fpr"
14176 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>,<Fv>")
14179 (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>,<Fv>")
14180 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>,0")
14182 (match_operand:SFDF 3 "gpc_reg_operand" "<Ff>,0,<Fv>")))))]
14183 "TARGET_<MODE>_FPR"
14185 fnmsub<Ftrad> %0,%1,%2,%3
14186 xsnmsuba<Fvsx> %x0,%x1,%x2
14187 xsnmsubm<Fvsx> %x0,%x1,%x3"
14188 [(set_attr "type" "fp")
14189 (set_attr "fp_type" "fp_maddsub_<Fs>")])
14192 (define_expand "rs6000_get_timebase"
14193 [(use (match_operand:DI 0 "gpc_reg_operand" ""))]
14196 if (TARGET_POWERPC64)
14197 emit_insn (gen_rs6000_mftb_di (operands[0]));
14199 emit_insn (gen_rs6000_get_timebase_ppc32 (operands[0]));
14203 (define_insn "rs6000_get_timebase_ppc32"
14204 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
14205 (unspec_volatile:DI [(const_int 0)] UNSPECV_MFTB))
14206 (clobber (match_scratch:SI 1 "=r"))
14207 (clobber (match_scratch:CC 2 "=y"))]
14208 "!TARGET_POWERPC64"
14210 if (WORDS_BIG_ENDIAN)
14213 return "mfspr %0,269\;"
14221 return "mftbu %0\;"
14230 return "mfspr %L0,269\;"
14238 return "mftbu %L0\;"
14245 [(set_attr "length" "20")])
14247 (define_insn "rs6000_mftb_<mode>"
14248 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
14249 (unspec_volatile:GPR [(const_int 0)] UNSPECV_MFTB))]
14253 return "mfspr %0,268";
14259 (define_insn "rs6000_mffs"
14260 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
14261 (unspec_volatile:DF [(const_int 0)] UNSPECV_MFFS))]
14262 "TARGET_HARD_FLOAT && TARGET_FPRS"
14265 (define_insn "rs6000_mtfsf"
14266 [(unspec_volatile [(match_operand:SI 0 "const_int_operand" "i")
14267 (match_operand:DF 1 "gpc_reg_operand" "d")]
14269 "TARGET_HARD_FLOAT && TARGET_FPRS"
14273 ;; Power8 fusion support for fusing an addis instruction with a D-form load of
14274 ;; a GPR. The addis instruction must be adjacent to the load, and use the same
14275 ;; register that is being loaded. The fused ops must be physically adjacent.
14277 ;; Find cases where the addis that feeds into a load instruction is either used
14278 ;; once or is the same as the target register, and replace it with the fusion
14282 [(set (match_operand:P 0 "base_reg_operand" "")
14283 (match_operand:P 1 "fusion_gpr_addis" ""))
14284 (set (match_operand:INT1 2 "base_reg_operand" "")
14285 (match_operand:INT1 3 "fusion_gpr_mem_load" ""))]
14287 && fusion_gpr_load_p (operands[0], operands[1], operands[2],
14291 expand_fusion_gpr_load (operands);
14295 ;; Fusion insn, created by the define_peephole2 above (and eventually by
14298 (define_insn "fusion_gpr_load_<mode>"
14299 [(set (match_operand:INT1 0 "base_reg_operand" "=&b")
14300 (unspec:INT1 [(match_operand:INT1 1 "fusion_gpr_mem_combo" "")]
14301 UNSPEC_FUSION_GPR))]
14304 return emit_fusion_gpr_load (operands[0], operands[1]);
14306 [(set_attr "type" "load")
14307 (set_attr "length" "8")])
14310 ;; Miscellaneous ISA 2.06 (power7) instructions
14311 (define_insn "addg6s"
14312 [(set (match_operand:SI 0 "register_operand" "=r")
14313 (unspec:SI [(match_operand:SI 1 "register_operand" "r")
14314 (match_operand:SI 2 "register_operand" "r")]
14318 [(set_attr "type" "integer")
14319 (set_attr "length" "4")])
14321 (define_insn "cdtbcd"
14322 [(set (match_operand:SI 0 "register_operand" "=r")
14323 (unspec:SI [(match_operand:SI 1 "register_operand" "r")]
14327 [(set_attr "type" "integer")
14328 (set_attr "length" "4")])
14330 (define_insn "cbcdtd"
14331 [(set (match_operand:SI 0 "register_operand" "=r")
14332 (unspec:SI [(match_operand:SI 1 "register_operand" "r")]
14336 [(set_attr "type" "integer")
14337 (set_attr "length" "4")])
14339 (define_int_iterator UNSPEC_DIV_EXTEND [UNSPEC_DIVE
14344 (define_int_attr div_extend [(UNSPEC_DIVE "e")
14345 (UNSPEC_DIVEO "eo")
14346 (UNSPEC_DIVEU "eu")
14347 (UNSPEC_DIVEUO "euo")])
14349 (define_insn "div<div_extend>_<mode>"
14350 [(set (match_operand:GPR 0 "register_operand" "=r")
14351 (unspec:GPR [(match_operand:GPR 1 "register_operand" "r")
14352 (match_operand:GPR 2 "register_operand" "r")]
14353 UNSPEC_DIV_EXTEND))]
14355 "div<wd><div_extend> %0,%1,%2"
14356 [(set_attr "type" "div")
14357 (set_attr "size" "<bits>")])
14360 ;; Pack/unpack 128-bit floating point types that take 2 scalar registers
14362 ; Type of the 64-bit part when packing/unpacking 128-bit floating point types
14363 (define_mode_attr FP128_64 [(TF "DF") (TD "DI")])
14365 (define_expand "unpack<mode>"
14366 [(set (match_operand:<FP128_64> 0 "nonimmediate_operand" "")
14368 [(match_operand:FMOVE128 1 "register_operand" "")
14369 (match_operand:QI 2 "const_0_to_1_operand" "")]
14370 UNSPEC_UNPACK_128BIT))]
14374 (define_insn_and_split "unpack<mode>_dm"
14375 [(set (match_operand:<FP128_64> 0 "nonimmediate_operand" "=d,m,d,r,m")
14377 [(match_operand:FMOVE128 1 "register_operand" "d,d,r,d,r")
14378 (match_operand:QI 2 "const_0_to_1_operand" "i,i,i,i,i")]
14379 UNSPEC_UNPACK_128BIT))]
14380 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
14382 "&& reload_completed"
14383 [(set (match_dup 0) (match_dup 3))]
14385 unsigned fp_regno = REGNO (operands[1]) + UINTVAL (operands[2]);
14387 if (REG_P (operands[0]) && REGNO (operands[0]) == fp_regno)
14389 emit_note (NOTE_INSN_DELETED);
14393 operands[3] = gen_rtx_REG (<FP128_64>mode, fp_regno);
14395 [(set_attr "type" "fp,fpstore,mffgpr,mftgpr,store")
14396 (set_attr "length" "4")])
14398 (define_insn_and_split "unpack<mode>_nodm"
14399 [(set (match_operand:<FP128_64> 0 "nonimmediate_operand" "=d,m")
14401 [(match_operand:FMOVE128 1 "register_operand" "d,d")
14402 (match_operand:QI 2 "const_0_to_1_operand" "i,i")]
14403 UNSPEC_UNPACK_128BIT))]
14404 "!TARGET_POWERPC64 || !TARGET_DIRECT_MOVE"
14406 "&& reload_completed"
14407 [(set (match_dup 0) (match_dup 3))]
14409 unsigned fp_regno = REGNO (operands[1]) + UINTVAL (operands[2]);
14411 if (REG_P (operands[0]) && REGNO (operands[0]) == fp_regno)
14413 emit_note (NOTE_INSN_DELETED);
14417 operands[3] = gen_rtx_REG (<FP128_64>mode, fp_regno);
14419 [(set_attr "type" "fp,fpstore")
14420 (set_attr "length" "4")])
14422 (define_insn_and_split "pack<mode>"
14423 [(set (match_operand:FMOVE128 0 "register_operand" "=d,&d")
14425 [(match_operand:<FP128_64> 1 "register_operand" "0,d")
14426 (match_operand:<FP128_64> 2 "register_operand" "d,d")]
14427 UNSPEC_PACK_128BIT))]
14432 "&& reload_completed && REGNO (operands[0]) != REGNO (operands[1])"
14433 [(set (match_dup 3) (match_dup 1))
14434 (set (match_dup 4) (match_dup 2))]
14436 unsigned dest_hi = REGNO (operands[0]);
14437 unsigned dest_lo = dest_hi + 1;
14439 gcc_assert (!IN_RANGE (REGNO (operands[1]), dest_hi, dest_lo));
14440 gcc_assert (!IN_RANGE (REGNO (operands[2]), dest_hi, dest_lo));
14442 operands[3] = gen_rtx_REG (<FP128_64>mode, dest_hi);
14443 operands[4] = gen_rtx_REG (<FP128_64>mode, dest_lo);
14445 [(set_attr "type" "fp,fp")
14446 (set_attr "length" "4,8")])
14448 (define_insn "unpackv1ti"
14449 [(set (match_operand:DI 0 "register_operand" "=d,d")
14450 (unspec:DI [(match_operand:V1TI 1 "register_operand" "0,wa")
14451 (match_operand:QI 2 "const_0_to_1_operand" "O,i")]
14452 UNSPEC_UNPACK_128BIT))]
14455 if (REGNO (operands[0]) == REGNO (operands[1]) && INTVAL (operands[2]) == 0)
14456 return ASM_COMMENT_START " xxpermdi to same register";
14458 operands[3] = GEN_INT (INTVAL (operands[2]) == 0 ? 0 : 3);
14459 return "xxpermdi %x0,%x1,%x1,%3";
14461 [(set_attr "type" "vecperm")
14462 (set_attr "length" "4")])
14464 (define_insn "packv1ti"
14465 [(set (match_operand:V1TI 0 "register_operand" "=wa")
14467 [(match_operand:DI 1 "register_operand" "d")
14468 (match_operand:DI 2 "register_operand" "d")]
14469 UNSPEC_PACK_128BIT))]
14471 "xxpermdi %x0,%x1,%x2,0"
14472 [(set_attr "type" "vecperm")
14473 (set_attr "length" "4")])
14477 (include "sync.md")
14478 (include "vector.md")
14480 (include "altivec.md")
14483 (include "paired.md")
14484 (include "crypto.md")