1 ;; Machine description for IBM RISC System 6000 (POWER) for GNU C compiler
2 ;; Copyright (C) 1990-2014 Free Software Foundation, Inc.
3 ;; Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
5 ;; This file is part of GCC.
7 ;; GCC is free software; you can redistribute it and/or modify it
8 ;; under the terms of the GNU General Public License as published
9 ;; by the Free Software Foundation; either version 3, or (at your
10 ;; option) any later version.
12 ;; GCC is distributed in the hope that it will be useful, but WITHOUT
13 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
15 ;; License for more details.
17 ;; You should have received a copy of the GNU General Public License
18 ;; along with GCC; see the file COPYING3. If not see
19 ;; <http://www.gnu.org/licenses/>.
21 ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
29 (STACK_POINTER_REGNUM 1)
31 (STATIC_CHAIN_REGNUM 11)
32 (HARD_FRAME_POINTER_REGNUM 31)
38 (ARG_POINTER_REGNUM 67)
49 (FIRST_ALTIVEC_REGNO 77)
50 (LAST_ALTIVEC_REGNO 108)
55 (FRAME_POINTER_REGNUM 113)
65 (define_c_enum "unspec"
66 [UNSPEC_FRSP ; frsp for POWER machines
67 UNSPEC_PROBE_STACK ; probe stack memory reference
68 UNSPEC_TOCPTR ; address of a word pointing to the TOC
69 UNSPEC_TOC ; address of the TOC (more-or-less)
71 UNSPEC_MV_CR_OV ; move_from_CR_ov_bit
77 UNSPEC_LD_MPIC ; load_macho_picbase
78 UNSPEC_RELD_MPIC ; re-load_macho_picbase
79 UNSPEC_MPIC_CORRECT ; macho_correct_pic
93 UNSPEC_FIX_TRUNC_TF ; fadd, rounding towards zero
94 UNSPEC_MV_CR_GT ; move_from_CR_gt_bit
112 UNSPEC_MACHOPIC_OFFSET
124 UNSPEC_P8V_RELOAD_FROM_GPR
127 UNSPEC_P8V_RELOAD_FROM_VSX
141 ;; UNSPEC_VOLATILE usage
144 (define_c_enum "unspecv"
146 UNSPECV_LL ; load-locked
147 UNSPECV_SC ; store-conditional
148 UNSPECV_PROBE_STACK_RANGE ; probe range of stack addresses
149 UNSPECV_EH_RR ; eh_reg_restore
150 UNSPECV_ISYNC ; isync instruction
151 UNSPECV_MFTB ; move from time base
152 UNSPECV_NLGR ; non-local goto receiver
153 UNSPECV_MFFS ; Move from FPSCR
154 UNSPECV_MTFSF ; Move to FPSCR Fields
158 ;; Define an insn type attribute. This is used in function unit delay
162 add,logical,shift,insert,
164 exts,cntlz,popcnt,isel,
165 load,store,fpload,fpstore,vecload,vecstore,
167 branch,jmpreg,mfjmpr,mtjmpr,trap,isync,sync,load_l,store_c,
169 cr_logical,delayed_cr,mfcr,mfcrf,mtcr,
170 fpcompare,fp,fpsimple,dmul,sdiv,ddiv,ssqrt,dsqrt,
172 vecsimple,veccomplex,vecdiv,veccmp,veccmpsimple,vecperm,
173 vecfloat,vecfdiv,vecdouble,mffgpr,mftgpr,crypto,
175 (const_string "integer"))
177 ;; What data size does this instruction work on?
178 ;; This is used for insert, mul.
179 (define_attr "size" "8,16,32,64" (const_string "32"))
181 ;; Is this instruction record form ("dot", signed compare to 0, writing CR0)?
182 ;; This is used for add, logical, shift, mul.
183 (define_attr "dot" "no,yes" (const_string "no"))
185 ;; Does this instruction sign-extend its result?
186 ;; This is used for load insns.
187 (define_attr "sign_extend" "no,yes" (const_string "no"))
189 ;; Does this instruction use indexed (that is, reg+reg) addressing?
190 ;; This is used for load and store insns. If operand 0 or 1 is a MEM
191 ;; it is automatically set based on that. If a load or store instruction
192 ;; has fewer than two operands it needs to set this attribute manually
193 ;; or the compiler will crash.
194 (define_attr "indexed" "no,yes"
195 (if_then_else (ior (match_operand 0 "indexed_address_mem")
196 (match_operand 1 "indexed_address_mem"))
198 (const_string "no")))
200 ;; Does this instruction use update addressing?
201 ;; This is used for load and store insns. See the comments for "indexed".
202 (define_attr "update" "no,yes"
203 (if_then_else (ior (match_operand 0 "update_address_mem")
204 (match_operand 1 "update_address_mem"))
206 (const_string "no")))
208 ;; Is this instruction using a shift amount from a register?
209 ;; This is used for shift insns.
210 (define_attr "var_shift" "no,yes" (const_string "no"))
212 ;; Define floating point instruction sub-types for use with Xfpu.md
213 (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"))
215 ;; Length (in bytes).
216 ; '(pc)' in the following doesn't include the instruction itself; it is
217 ; calculated as if the instruction had zero size.
218 (define_attr "length" ""
219 (if_then_else (eq_attr "type" "branch")
220 (if_then_else (and (ge (minus (match_dup 0) (pc))
222 (lt (minus (match_dup 0) (pc))
228 ;; Processor type -- this attribute must exactly match the processor_type
229 ;; enumeration in rs6000-opts.h.
231 "ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630,
232 ppc750,ppc7400,ppc7450,
233 ppc403,ppc405,ppc440,ppc476,
234 ppc8540,ppc8548,ppce300c2,ppce300c3,ppce500mc,ppce500mc64,ppce5500,ppce6500,
235 power4,power5,power6,power7,power8,
236 rs64a,mpccore,cell,ppca2,titan"
237 (const (symbol_ref "rs6000_cpu_attr")))
240 ;; If this instruction is microcoded on the CELL processor
241 ; The default for load extended, the recorded instructions and rotate/shifts by a variable is always microcoded
242 (define_attr "cell_micro" "not,conditional,always"
243 (if_then_else (ior (eq_attr "type" "compare")
244 (and (eq_attr "type" "shift,mul")
245 (eq_attr "dot" "yes"))
246 (and (eq_attr "type" "load")
247 (eq_attr "sign_extend" "yes"))
248 (and (eq_attr "type" "shift")
249 (eq_attr "var_shift" "yes")))
250 (const_string "always")
251 (const_string "not")))
253 (automata_option "ndfa")
266 (include "e300c2c3.md")
267 (include "e500mc.md")
268 (include "e500mc64.md")
271 (include "power4.md")
272 (include "power5.md")
273 (include "power6.md")
274 (include "power7.md")
275 (include "power8.md")
281 (include "predicates.md")
282 (include "constraints.md")
284 (include "darwin.md")
289 ; This mode iterator allows :GPR to be used to indicate the allowable size
290 ; of whole values in GPRs.
291 (define_mode_iterator GPR [SI (DI "TARGET_POWERPC64")])
293 ; Any supported integer mode.
294 (define_mode_iterator INT [QI HI SI DI TI PTI])
296 ; Any supported integer mode that fits in one register.
297 (define_mode_iterator INT1 [QI HI SI (DI "TARGET_POWERPC64")])
299 ; extend modes for DImode
300 (define_mode_iterator QHSI [QI HI SI])
302 ; QImode or HImode for small atomic ops
303 (define_mode_iterator QHI [QI HI])
305 ; HImode or SImode for sign extended fusion ops
306 (define_mode_iterator HSI [HI SI])
308 ; SImode or DImode, even if DImode doesn't fit in GPRs.
309 (define_mode_iterator SDI [SI DI])
311 ; The size of a pointer. Also, the size of the value that a record-condition
312 ; (one with a '.') will compare; and the size used for arithmetic carries.
313 (define_mode_iterator P [(SI "TARGET_32BIT") (DI "TARGET_64BIT")])
315 ; Iterator to add PTImode along with TImode (TImode can go in VSX registers,
316 ; PTImode is GPR only)
317 (define_mode_iterator TI2 [TI PTI])
319 ; Any hardware-supported floating-point mode
320 (define_mode_iterator FP [
321 (SF "TARGET_HARD_FLOAT
322 && ((TARGET_FPRS && TARGET_SINGLE_FLOAT) || TARGET_E500_SINGLE)")
323 (DF "TARGET_HARD_FLOAT
324 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)")
325 (TF "!TARGET_IEEEQUAD
327 && (TARGET_FPRS || TARGET_E500_DOUBLE)
328 && TARGET_LONG_DOUBLE_128")
332 ; Any fma capable floating-point mode.
333 (define_mode_iterator FMA_F [
334 (SF "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT")
335 (DF "(TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT)
336 || VECTOR_UNIT_VSX_P (DFmode)")
337 (V2SF "TARGET_PAIRED_FLOAT")
338 (V4SF "VECTOR_UNIT_ALTIVEC_OR_VSX_P (V4SFmode)")
339 (V2DF "VECTOR_UNIT_ALTIVEC_OR_VSX_P (V2DFmode)")
342 ; Floating point move iterators to combine binary and decimal moves
343 (define_mode_iterator FMOVE32 [SF SD])
344 (define_mode_iterator FMOVE64 [DF DD])
345 (define_mode_iterator FMOVE64X [DI DF DD])
346 (define_mode_iterator FMOVE128 [(TF "!TARGET_IEEEQUAD && TARGET_LONG_DOUBLE_128")
347 (TD "TARGET_HARD_FLOAT && TARGET_FPRS")])
349 ; Iterators for 128 bit types for direct move
350 (define_mode_iterator FMOVE128_GPR [(TI "TARGET_VSX_TIMODE")
359 ; Whether a floating point move is ok, don't allow SD without hardware FP
360 (define_mode_attr fmove_ok [(SF "")
362 (SD "TARGET_HARD_FLOAT && TARGET_FPRS")
365 ; Convert REAL_VALUE to the appropriate bits
366 (define_mode_attr real_value_to_target [(SF "REAL_VALUE_TO_TARGET_SINGLE")
367 (DF "REAL_VALUE_TO_TARGET_DOUBLE")
368 (SD "REAL_VALUE_TO_TARGET_DECIMAL32")
369 (DD "REAL_VALUE_TO_TARGET_DECIMAL64")])
371 ; Definitions for load to 32-bit fpr register
372 (define_mode_attr f32_lr [(SF "f") (SD "wz")])
373 (define_mode_attr f32_lm [(SF "m") (SD "Z")])
374 (define_mode_attr f32_li [(SF "lfs%U1%X1 %0,%1") (SD "lfiwzx %0,%y1")])
375 (define_mode_attr f32_lv [(SF "lxsspx %x0,%y1") (SD "lxsiwzx %x0,%y1")])
377 ; Definitions for store from 32-bit fpr register
378 (define_mode_attr f32_sr [(SF "f") (SD "wx")])
379 (define_mode_attr f32_sm [(SF "m") (SD "Z")])
380 (define_mode_attr f32_si [(SF "stfs%U0%X0 %1,%0") (SD "stfiwx %1,%y0")])
381 (define_mode_attr f32_sv [(SF "stxsspx %x1,%y0") (SD "stxsiwzx %x1,%y0")])
383 ; Definitions for 32-bit fpr direct move
384 (define_mode_attr f32_dm [(SF "wn") (SD "wm")])
386 ; These modes do not fit in integer registers in 32-bit mode.
387 ; but on e500v2, the gpr are 64 bit registers
388 (define_mode_iterator DIFD [DI (DF "!TARGET_E500_DOUBLE") DD])
390 ; Iterator for reciprocal estimate instructions
391 (define_mode_iterator RECIPF [SF DF V4SF V2DF])
393 ; Iterator for just SF/DF
394 (define_mode_iterator SFDF [SF DF])
396 ; SF/DF suffix for traditional floating instructions
397 (define_mode_attr Ftrad [(SF "s") (DF "")])
399 ; SF/DF suffix for VSX instructions
400 (define_mode_attr Fvsx [(SF "sp") (DF "dp")])
402 ; SF/DF constraint for arithmetic on traditional floating point registers
403 (define_mode_attr Ff [(SF "f") (DF "d")])
405 ; SF/DF constraint for arithmetic on VSX registers
406 (define_mode_attr Fv [(SF "wy") (DF "ws")])
408 ; s/d suffix for things like fp_addsub_s/fp_addsub_d
409 (define_mode_attr Fs [(SF "s") (DF "d")])
412 (define_mode_attr Ffre [(SF "fres") (DF "fre")])
413 (define_mode_attr FFRE [(SF "FRES") (DF "FRE")])
415 ; Conditional returns.
416 (define_code_iterator any_return [return simple_return])
417 (define_code_attr return_pred [(return "direct_return ()")
418 (simple_return "1")])
419 (define_code_attr return_str [(return "") (simple_return "simple_")])
421 ; Various instructions that come in SI and DI forms.
422 ; A generic w/d attribute, for things like cmpw/cmpd.
423 (define_mode_attr wd [(QI "b")
432 ;; How many bits in this mode?
433 (define_mode_attr bits [(QI "8") (HI "16") (SI "32") (DI "64")])
436 (define_mode_attr dbits [(QI "56") (HI "48") (SI "32")])
438 ;; ISEL/ISEL64 target selection
439 (define_mode_attr sel [(SI "") (DI "64")])
441 ;; Suffix for reload patterns
442 (define_mode_attr ptrsize [(SI "32bit")
445 (define_mode_attr tptrsize [(SI "TARGET_32BIT")
446 (DI "TARGET_64BIT")])
448 (define_mode_attr mptrsize [(SI "si")
451 (define_mode_attr ptrload [(SI "lwz")
454 (define_mode_attr ptrm [(SI "m")
457 (define_mode_attr rreg [(SF "f")
464 (define_mode_attr rreg2 [(SF "f")
467 (define_mode_attr SI_CONVERT_FP [(SF "TARGET_FCFIDS")
468 (DF "TARGET_FCFID")])
470 (define_mode_attr E500_CONVERT [(SF "!TARGET_FPRS")
471 (DF "TARGET_E500_DOUBLE")])
473 (define_mode_attr TARGET_FLOAT [(SF "TARGET_SINGLE_FLOAT")
474 (DF "TARGET_DOUBLE_FLOAT")])
476 ;; Mode iterator for logical operations on 128-bit types
477 (define_mode_iterator BOOL_128 [TI
479 (V16QI "TARGET_ALTIVEC")
480 (V8HI "TARGET_ALTIVEC")
481 (V4SI "TARGET_ALTIVEC")
482 (V4SF "TARGET_ALTIVEC")
483 (V2DI "TARGET_ALTIVEC")
484 (V2DF "TARGET_ALTIVEC")
485 (V1TI "TARGET_ALTIVEC")])
487 ;; For the GPRs we use 3 constraints for register outputs, two that are the
488 ;; same as the output register, and a third where the output register is an
489 ;; early clobber, so we don't have to deal with register overlaps. For the
490 ;; vector types, we prefer to use the vector registers. For TI mode, allow
493 ;; Mode attribute for boolean operation register constraints for output
494 (define_mode_attr BOOL_REGS_OUTPUT [(TI "&r,r,r,wa,v")
496 (V16QI "wa,v,&?r,?r,?r")
497 (V8HI "wa,v,&?r,?r,?r")
498 (V4SI "wa,v,&?r,?r,?r")
499 (V4SF "wa,v,&?r,?r,?r")
500 (V2DI "wa,v,&?r,?r,?r")
501 (V2DF "wa,v,&?r,?r,?r")
502 (V1TI "wa,v,&?r,?r,?r")])
504 ;; Mode attribute for boolean operation register constraints for operand1
505 (define_mode_attr BOOL_REGS_OP1 [(TI "r,0,r,wa,v")
513 (V1TI "wa,v,r,0,r")])
515 ;; Mode attribute for boolean operation register constraints for operand2
516 (define_mode_attr BOOL_REGS_OP2 [(TI "r,r,0,wa,v")
524 (V1TI "wa,v,r,r,0")])
526 ;; Mode attribute for boolean operation register constraints for operand1
527 ;; for one_cmpl. To simplify things, we repeat the constraint where 0
528 ;; is used for operand1 or operand2
529 (define_mode_attr BOOL_REGS_UNARY [(TI "r,0,0,wa,v")
537 (V1TI "wa,v,r,0,0")])
539 ;; Mode attribute for the clobber of CC0 for AND expansion.
540 ;; For the 128-bit types, we never do AND immediate, but we need to
541 ;; get the correct number of X's for the number of operands.
542 (define_mode_attr BOOL_REGS_AND_CR0 [(TI "X,X,X,X,X")
552 ;; Start with fixed-point load and store insns. Here we put only the more
553 ;; complex forms. Basic data transfer is done later.
555 (define_expand "zero_extend<mode>di2"
556 [(set (match_operand:DI 0 "gpc_reg_operand" "")
557 (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "")))]
561 (define_insn "*zero_extend<mode>di2_internal1"
562 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
563 (zero_extend:DI (match_operand:QHSI 1 "reg_or_mem_operand" "m,r")))]
564 "TARGET_POWERPC64 && (<MODE>mode != SImode || !TARGET_LFIWZX)"
567 rldicl %0,%1,0,<dbits>"
568 [(set_attr "type" "load,shift")])
570 (define_insn "*zero_extend<mode>di2_internal2"
571 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
572 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "r,r"))
574 (clobber (match_scratch:DI 2 "=r,r"))]
577 rldicl. %2,%1,0,<dbits>
579 [(set_attr "type" "shift")
580 (set_attr "dot" "yes")
581 (set_attr "length" "4,8")])
584 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
585 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" ""))
587 (clobber (match_scratch:DI 2 ""))]
588 "TARGET_POWERPC64 && reload_completed"
590 (zero_extend:DI (match_dup 1)))
592 (compare:CC (match_dup 2)
596 (define_insn "*zero_extend<mode>di2_internal3"
597 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
598 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "r,r"))
600 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
601 (zero_extend:DI (match_dup 1)))]
604 rldicl. %0,%1,0,<dbits>
606 [(set_attr "type" "shift")
607 (set_attr "dot" "yes")
608 (set_attr "length" "4,8")])
611 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
612 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" ""))
614 (set (match_operand:DI 0 "gpc_reg_operand" "")
615 (zero_extend:DI (match_dup 1)))]
616 "TARGET_POWERPC64 && reload_completed"
618 (zero_extend:DI (match_dup 1)))
620 (compare:CC (match_dup 0)
624 (define_insn "*zero_extendsidi2_lfiwzx"
625 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,??wm,!wz,!wu")
626 (zero_extend:DI (match_operand:SI 1 "reg_or_mem_operand" "m,r,r,Z,Z")))]
627 "TARGET_POWERPC64 && TARGET_LFIWZX"
634 [(set_attr "type" "load,shift,mffgpr,fpload,fpload")])
636 (define_insn "extendqidi2"
637 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
638 (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r")))]
641 [(set_attr "type" "exts")])
644 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
645 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
647 (clobber (match_scratch:DI 2 "=r,r"))]
652 [(set_attr "type" "compare")
653 (set_attr "length" "4,8")])
656 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
657 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
659 (clobber (match_scratch:DI 2 ""))]
660 "TARGET_POWERPC64 && reload_completed"
662 (sign_extend:DI (match_dup 1)))
664 (compare:CC (match_dup 2)
669 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
670 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
672 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
673 (sign_extend:DI (match_dup 1)))]
678 [(set_attr "type" "compare")
679 (set_attr "length" "4,8")])
682 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
683 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
685 (set (match_operand:DI 0 "gpc_reg_operand" "")
686 (sign_extend:DI (match_dup 1)))]
687 "TARGET_POWERPC64 && reload_completed"
689 (sign_extend:DI (match_dup 1)))
691 (compare:CC (match_dup 0)
695 (define_expand "extendhidi2"
696 [(set (match_operand:DI 0 "gpc_reg_operand" "")
697 (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "")))]
702 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
703 (sign_extend:DI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
704 "TARGET_POWERPC64 && rs6000_gen_cell_microcode"
708 [(set_attr "type" "load,exts")
709 (set_attr "sign_extend" "yes")])
712 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
713 (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r")))]
714 "TARGET_POWERPC64 && !rs6000_gen_cell_microcode"
716 [(set_attr "type" "exts")])
719 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
720 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
722 (clobber (match_scratch:DI 2 "=r,r"))]
727 [(set_attr "type" "compare")
728 (set_attr "length" "4,8")])
731 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
732 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
734 (clobber (match_scratch:DI 2 ""))]
735 "TARGET_POWERPC64 && reload_completed"
737 (sign_extend:DI (match_dup 1)))
739 (compare:CC (match_dup 2)
744 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
745 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
747 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
748 (sign_extend:DI (match_dup 1)))]
753 [(set_attr "type" "compare")
754 (set_attr "length" "4,8")])
757 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
758 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
760 (set (match_operand:DI 0 "gpc_reg_operand" "")
761 (sign_extend:DI (match_dup 1)))]
762 "TARGET_POWERPC64 && reload_completed"
764 (sign_extend:DI (match_dup 1)))
766 (compare:CC (match_dup 0)
770 (define_expand "extendsidi2"
771 [(set (match_operand:DI 0 "gpc_reg_operand" "")
772 (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")))]
776 (define_insn "*extendsidi2_lfiwax"
777 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,??wm,!wl,!wu")
778 (sign_extend:DI (match_operand:SI 1 "lwa_operand" "Y,r,r,Z,Z")))]
779 "TARGET_POWERPC64 && TARGET_LFIWAX"
786 [(set_attr "type" "load,exts,mffgpr,fpload,fpload")
787 (set_attr "sign_extend" "yes")])
789 (define_insn "*extendsidi2_nocell"
790 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
791 (sign_extend:DI (match_operand:SI 1 "lwa_operand" "Y,r")))]
792 "TARGET_POWERPC64 && rs6000_gen_cell_microcode && !TARGET_LFIWAX"
796 [(set_attr "type" "load,exts")
797 (set_attr "sign_extend" "yes")])
799 (define_insn "*extendsidi2_nocell"
800 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
801 (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r")))]
802 "TARGET_POWERPC64 && !rs6000_gen_cell_microcode"
804 [(set_attr "type" "exts")])
807 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
808 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
810 (clobber (match_scratch:DI 2 "=r,r"))]
815 [(set_attr "type" "compare")
816 (set_attr "length" "4,8")])
819 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
820 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
822 (clobber (match_scratch:DI 2 ""))]
823 "TARGET_POWERPC64 && reload_completed"
825 (sign_extend:DI (match_dup 1)))
827 (compare:CC (match_dup 2)
832 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
833 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
835 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
836 (sign_extend:DI (match_dup 1)))]
841 [(set_attr "type" "compare")
842 (set_attr "length" "4,8")])
845 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
846 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
848 (set (match_operand:DI 0 "gpc_reg_operand" "")
849 (sign_extend:DI (match_dup 1)))]
850 "TARGET_POWERPC64 && reload_completed"
852 (sign_extend:DI (match_dup 1)))
854 (compare:CC (match_dup 0)
858 (define_expand "zero_extendqisi2"
859 [(set (match_operand:SI 0 "gpc_reg_operand" "")
860 (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "")))]
865 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
866 (zero_extend:SI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
871 [(set_attr "type" "load,shift")])
874 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
875 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
877 (clobber (match_scratch:SI 2 "=r,r"))]
882 [(set_attr "type" "logical,compare")
883 (set_attr "dot" "yes")
884 (set_attr "length" "4,8")])
887 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
888 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
890 (clobber (match_scratch:SI 2 ""))]
893 (zero_extend:SI (match_dup 1)))
895 (compare:CC (match_dup 2)
900 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
901 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
903 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
904 (zero_extend:SI (match_dup 1)))]
909 [(set_attr "type" "logical,compare")
910 (set_attr "dot" "yes")
911 (set_attr "length" "4,8")])
914 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
915 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
917 (set (match_operand:SI 0 "gpc_reg_operand" "")
918 (zero_extend:SI (match_dup 1)))]
921 (zero_extend:SI (match_dup 1)))
923 (compare:CC (match_dup 0)
927 (define_insn "extendqisi2"
928 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
929 (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r")))]
932 [(set_attr "type" "exts")])
935 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
936 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
938 (clobber (match_scratch:SI 2 "=r,r"))]
943 [(set_attr "type" "compare")
944 (set_attr "length" "4,8")])
947 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
948 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
950 (clobber (match_scratch:SI 2 ""))]
953 (sign_extend:SI (match_dup 1)))
955 (compare:CC (match_dup 2)
960 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
961 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
963 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
964 (sign_extend:SI (match_dup 1)))]
969 [(set_attr "type" "compare")
970 (set_attr "length" "4,8")])
973 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
974 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
976 (set (match_operand:SI 0 "gpc_reg_operand" "")
977 (sign_extend:SI (match_dup 1)))]
980 (sign_extend:SI (match_dup 1)))
982 (compare:CC (match_dup 0)
987 [(set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
988 (zero_extend:HI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
993 [(set_attr "type" "load,shift")])
996 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
997 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
999 (clobber (match_scratch:HI 2 "=r,r"))]
1004 [(set_attr "type" "logical,compare")
1005 (set_attr "dot" "yes")
1006 (set_attr "length" "4,8")])
1009 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
1010 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
1012 (clobber (match_scratch:HI 2 ""))]
1015 (zero_extend:HI (match_dup 1)))
1017 (compare:CC (match_dup 2)
1022 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1023 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
1025 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
1026 (zero_extend:HI (match_dup 1)))]
1031 [(set_attr "type" "logical,compare")
1032 (set_attr "dot" "yes")
1033 (set_attr "length" "4,8")])
1036 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
1037 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
1039 (set (match_operand:HI 0 "gpc_reg_operand" "")
1040 (zero_extend:HI (match_dup 1)))]
1043 (zero_extend:HI (match_dup 1)))
1045 (compare:CC (match_dup 0)
1049 (define_insn "extendqihi2"
1050 [(set (match_operand:HI 0 "gpc_reg_operand" "=r")
1051 (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r")))]
1054 [(set_attr "type" "exts")])
1057 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1058 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
1060 (clobber (match_scratch:HI 2 "=r,r"))]
1065 [(set_attr "type" "compare")
1066 (set_attr "length" "4,8")])
1069 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
1070 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
1072 (clobber (match_scratch:HI 2 ""))]
1075 (sign_extend:HI (match_dup 1)))
1077 (compare:CC (match_dup 2)
1082 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1083 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
1085 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
1086 (sign_extend:HI (match_dup 1)))]
1091 [(set_attr "type" "compare")
1092 (set_attr "length" "4,8")])
1095 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
1096 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
1098 (set (match_operand:HI 0 "gpc_reg_operand" "")
1099 (sign_extend:HI (match_dup 1)))]
1102 (sign_extend:HI (match_dup 1)))
1104 (compare:CC (match_dup 0)
1108 (define_expand "zero_extendhisi2"
1109 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1110 (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
1115 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1116 (zero_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
1120 rlwinm %0,%1,0,0xffff"
1121 [(set_attr "type" "load,shift")])
1124 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1125 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
1127 (clobber (match_scratch:SI 2 "=r,r"))]
1132 [(set_attr "type" "logical,compare")
1133 (set_attr "dot" "yes")
1134 (set_attr "length" "4,8")])
1137 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
1138 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1140 (clobber (match_scratch:SI 2 ""))]
1143 (zero_extend:SI (match_dup 1)))
1145 (compare:CC (match_dup 2)
1150 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1151 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
1153 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1154 (zero_extend:SI (match_dup 1)))]
1159 [(set_attr "type" "logical,compare")
1160 (set_attr "dot" "yes")
1161 (set_attr "length" "4,8")])
1164 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
1165 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1167 (set (match_operand:SI 0 "gpc_reg_operand" "")
1168 (zero_extend:SI (match_dup 1)))]
1171 (zero_extend:SI (match_dup 1)))
1173 (compare:CC (match_dup 0)
1177 (define_expand "extendhisi2"
1178 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1179 (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
1184 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1185 (sign_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
1186 "rs6000_gen_cell_microcode"
1190 [(set_attr "type" "load,exts")
1191 (set_attr "sign_extend" "yes")])
1194 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1195 (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r")))]
1196 "!rs6000_gen_cell_microcode"
1198 [(set_attr "type" "exts")])
1201 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1202 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
1204 (clobber (match_scratch:SI 2 "=r,r"))]
1209 [(set_attr "type" "compare")
1210 (set_attr "length" "4,8")])
1213 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
1214 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1216 (clobber (match_scratch:SI 2 ""))]
1219 (sign_extend:SI (match_dup 1)))
1221 (compare:CC (match_dup 2)
1226 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1227 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
1229 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1230 (sign_extend:SI (match_dup 1)))]
1235 [(set_attr "type" "compare")
1236 (set_attr "length" "4,8")])
1239 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
1240 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1242 (set (match_operand:SI 0 "gpc_reg_operand" "")
1243 (sign_extend:SI (match_dup 1)))]
1246 (sign_extend:SI (match_dup 1)))
1248 (compare:CC (match_dup 0)
1252 ;; IBM 405, 440, 464 and 476 half-word multiplication operations.
1254 (define_insn "*macchwc"
1255 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1256 (compare:CC (plus:SI (mult:SI (ashiftrt:SI
1257 (match_operand:SI 2 "gpc_reg_operand" "r")
1260 (match_operand:HI 1 "gpc_reg_operand" "r")))
1261 (match_operand:SI 4 "gpc_reg_operand" "0"))
1263 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1264 (plus:SI (mult:SI (ashiftrt:SI
1272 [(set_attr "type" "halfmul")])
1274 (define_insn "*macchw"
1275 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1276 (plus:SI (mult:SI (ashiftrt:SI
1277 (match_operand:SI 2 "gpc_reg_operand" "r")
1280 (match_operand:HI 1 "gpc_reg_operand" "r")))
1281 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1284 [(set_attr "type" "halfmul")])
1286 (define_insn "*macchwuc"
1287 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1288 (compare:CC (plus:SI (mult:SI (lshiftrt:SI
1289 (match_operand:SI 2 "gpc_reg_operand" "r")
1292 (match_operand:HI 1 "gpc_reg_operand" "r")))
1293 (match_operand:SI 4 "gpc_reg_operand" "0"))
1295 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1296 (plus:SI (mult:SI (lshiftrt:SI
1304 [(set_attr "type" "halfmul")])
1306 (define_insn "*macchwu"
1307 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1308 (plus:SI (mult:SI (lshiftrt:SI
1309 (match_operand:SI 2 "gpc_reg_operand" "r")
1312 (match_operand:HI 1 "gpc_reg_operand" "r")))
1313 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1316 [(set_attr "type" "halfmul")])
1318 (define_insn "*machhwc"
1319 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1320 (compare:CC (plus:SI (mult:SI (ashiftrt:SI
1321 (match_operand:SI 1 "gpc_reg_operand" "%r")
1324 (match_operand:SI 2 "gpc_reg_operand" "r")
1326 (match_operand:SI 4 "gpc_reg_operand" "0"))
1328 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1329 (plus:SI (mult:SI (ashiftrt:SI
1338 [(set_attr "type" "halfmul")])
1340 (define_insn "*machhw"
1341 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1342 (plus:SI (mult:SI (ashiftrt:SI
1343 (match_operand:SI 1 "gpc_reg_operand" "%r")
1346 (match_operand:SI 2 "gpc_reg_operand" "r")
1348 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1351 [(set_attr "type" "halfmul")])
1353 (define_insn "*machhwuc"
1354 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1355 (compare:CC (plus:SI (mult:SI (lshiftrt:SI
1356 (match_operand:SI 1 "gpc_reg_operand" "%r")
1359 (match_operand:SI 2 "gpc_reg_operand" "r")
1361 (match_operand:SI 4 "gpc_reg_operand" "0"))
1363 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1364 (plus:SI (mult:SI (lshiftrt:SI
1373 [(set_attr "type" "halfmul")])
1375 (define_insn "*machhwu"
1376 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1377 (plus:SI (mult:SI (lshiftrt:SI
1378 (match_operand:SI 1 "gpc_reg_operand" "%r")
1381 (match_operand:SI 2 "gpc_reg_operand" "r")
1383 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1386 [(set_attr "type" "halfmul")])
1388 (define_insn "*maclhwc"
1389 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1390 (compare:CC (plus:SI (mult:SI (sign_extend:SI
1391 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1393 (match_operand:HI 2 "gpc_reg_operand" "r")))
1394 (match_operand:SI 4 "gpc_reg_operand" "0"))
1396 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1397 (plus:SI (mult:SI (sign_extend:SI
1404 [(set_attr "type" "halfmul")])
1406 (define_insn "*maclhw"
1407 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1408 (plus:SI (mult:SI (sign_extend:SI
1409 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1411 (match_operand:HI 2 "gpc_reg_operand" "r")))
1412 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1415 [(set_attr "type" "halfmul")])
1417 (define_insn "*maclhwuc"
1418 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1419 (compare:CC (plus:SI (mult:SI (zero_extend:SI
1420 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1422 (match_operand:HI 2 "gpc_reg_operand" "r")))
1423 (match_operand:SI 4 "gpc_reg_operand" "0"))
1425 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1426 (plus:SI (mult:SI (zero_extend:SI
1433 [(set_attr "type" "halfmul")])
1435 (define_insn "*maclhwu"
1436 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1437 (plus:SI (mult:SI (zero_extend:SI
1438 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1440 (match_operand:HI 2 "gpc_reg_operand" "r")))
1441 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1444 [(set_attr "type" "halfmul")])
1446 (define_insn "*nmacchwc"
1447 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1448 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1449 (mult:SI (ashiftrt:SI
1450 (match_operand:SI 2 "gpc_reg_operand" "r")
1453 (match_operand:HI 1 "gpc_reg_operand" "r"))))
1455 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1456 (minus:SI (match_dup 4)
1457 (mult:SI (ashiftrt:SI
1464 [(set_attr "type" "halfmul")])
1466 (define_insn "*nmacchw"
1467 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1468 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1469 (mult:SI (ashiftrt:SI
1470 (match_operand:SI 2 "gpc_reg_operand" "r")
1473 (match_operand:HI 1 "gpc_reg_operand" "r")))))]
1476 [(set_attr "type" "halfmul")])
1478 (define_insn "*nmachhwc"
1479 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1480 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1481 (mult:SI (ashiftrt:SI
1482 (match_operand:SI 1 "gpc_reg_operand" "%r")
1485 (match_operand:SI 2 "gpc_reg_operand" "r")
1488 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1489 (minus:SI (match_dup 4)
1490 (mult:SI (ashiftrt:SI
1498 [(set_attr "type" "halfmul")])
1500 (define_insn "*nmachhw"
1501 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1502 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1503 (mult:SI (ashiftrt:SI
1504 (match_operand:SI 1 "gpc_reg_operand" "%r")
1507 (match_operand:SI 2 "gpc_reg_operand" "r")
1511 [(set_attr "type" "halfmul")])
1513 (define_insn "*nmaclhwc"
1514 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1515 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1516 (mult:SI (sign_extend:SI
1517 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1519 (match_operand:HI 2 "gpc_reg_operand" "r"))))
1521 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1522 (minus:SI (match_dup 4)
1523 (mult:SI (sign_extend:SI
1529 [(set_attr "type" "halfmul")])
1531 (define_insn "*nmaclhw"
1532 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1533 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1534 (mult:SI (sign_extend:SI
1535 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1537 (match_operand:HI 2 "gpc_reg_operand" "r")))))]
1540 [(set_attr "type" "halfmul")])
1542 (define_insn "*mulchwc"
1543 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1544 (compare:CC (mult:SI (ashiftrt:SI
1545 (match_operand:SI 2 "gpc_reg_operand" "r")
1548 (match_operand:HI 1 "gpc_reg_operand" "r")))
1550 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1551 (mult:SI (ashiftrt:SI
1558 [(set_attr "type" "halfmul")])
1560 (define_insn "*mulchw"
1561 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1562 (mult:SI (ashiftrt:SI
1563 (match_operand:SI 2 "gpc_reg_operand" "r")
1566 (match_operand:HI 1 "gpc_reg_operand" "r"))))]
1569 [(set_attr "type" "halfmul")])
1571 (define_insn "*mulchwuc"
1572 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1573 (compare:CC (mult:SI (lshiftrt:SI
1574 (match_operand:SI 2 "gpc_reg_operand" "r")
1577 (match_operand:HI 1 "gpc_reg_operand" "r")))
1579 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1580 (mult:SI (lshiftrt:SI
1587 [(set_attr "type" "halfmul")])
1589 (define_insn "*mulchwu"
1590 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1591 (mult:SI (lshiftrt:SI
1592 (match_operand:SI 2 "gpc_reg_operand" "r")
1595 (match_operand:HI 1 "gpc_reg_operand" "r"))))]
1598 [(set_attr "type" "halfmul")])
1600 (define_insn "*mulhhwc"
1601 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1602 (compare:CC (mult:SI (ashiftrt:SI
1603 (match_operand:SI 1 "gpc_reg_operand" "%r")
1606 (match_operand:SI 2 "gpc_reg_operand" "r")
1609 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1610 (mult:SI (ashiftrt:SI
1618 [(set_attr "type" "halfmul")])
1620 (define_insn "*mulhhw"
1621 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1622 (mult:SI (ashiftrt:SI
1623 (match_operand:SI 1 "gpc_reg_operand" "%r")
1626 (match_operand:SI 2 "gpc_reg_operand" "r")
1630 [(set_attr "type" "halfmul")])
1632 (define_insn "*mulhhwuc"
1633 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1634 (compare:CC (mult:SI (lshiftrt:SI
1635 (match_operand:SI 1 "gpc_reg_operand" "%r")
1638 (match_operand:SI 2 "gpc_reg_operand" "r")
1641 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1642 (mult:SI (lshiftrt:SI
1650 [(set_attr "type" "halfmul")])
1652 (define_insn "*mulhhwu"
1653 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1654 (mult:SI (lshiftrt:SI
1655 (match_operand:SI 1 "gpc_reg_operand" "%r")
1658 (match_operand:SI 2 "gpc_reg_operand" "r")
1662 [(set_attr "type" "halfmul")])
1664 (define_insn "*mullhwc"
1665 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1666 (compare:CC (mult:SI (sign_extend:SI
1667 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1669 (match_operand:HI 2 "gpc_reg_operand" "r")))
1671 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1672 (mult:SI (sign_extend:SI
1678 [(set_attr "type" "halfmul")])
1680 (define_insn "*mullhw"
1681 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1682 (mult:SI (sign_extend:SI
1683 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1685 (match_operand:HI 2 "gpc_reg_operand" "r"))))]
1688 [(set_attr "type" "halfmul")])
1690 (define_insn "*mullhwuc"
1691 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1692 (compare:CC (mult:SI (zero_extend:SI
1693 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1695 (match_operand:HI 2 "gpc_reg_operand" "r")))
1697 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1698 (mult:SI (zero_extend:SI
1704 [(set_attr "type" "halfmul")])
1706 (define_insn "*mullhwu"
1707 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1708 (mult:SI (zero_extend:SI
1709 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1711 (match_operand:HI 2 "gpc_reg_operand" "r"))))]
1714 [(set_attr "type" "halfmul")])
1716 ;; IBM 405, 440, 464 and 476 string-search dlmzb instruction support.
1717 (define_insn "dlmzb"
1718 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1719 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
1720 (match_operand:SI 2 "gpc_reg_operand" "r")]
1722 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1723 (unspec:SI [(match_dup 1)
1729 (define_expand "strlensi"
1730 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1731 (unspec:SI [(match_operand:BLK 1 "general_operand" "")
1732 (match_operand:QI 2 "const_int_operand" "")
1733 (match_operand 3 "const_int_operand" "")]
1734 UNSPEC_DLMZB_STRLEN))
1735 (clobber (match_scratch:CC 4 "=x"))]
1736 "TARGET_DLMZB && WORDS_BIG_ENDIAN && !optimize_size"
1738 rtx result = operands[0];
1739 rtx src = operands[1];
1740 rtx search_char = operands[2];
1741 rtx align = operands[3];
1742 rtx addr, scratch_string, word1, word2, scratch_dlmzb;
1743 rtx loop_label, end_label, mem, cr0, cond;
1744 if (search_char != const0_rtx
1745 || GET_CODE (align) != CONST_INT
1746 || INTVAL (align) < 8)
1748 word1 = gen_reg_rtx (SImode);
1749 word2 = gen_reg_rtx (SImode);
1750 scratch_dlmzb = gen_reg_rtx (SImode);
1751 scratch_string = gen_reg_rtx (Pmode);
1752 loop_label = gen_label_rtx ();
1753 end_label = gen_label_rtx ();
1754 addr = force_reg (Pmode, XEXP (src, 0));
1755 emit_move_insn (scratch_string, addr);
1756 emit_label (loop_label);
1757 mem = change_address (src, SImode, scratch_string);
1758 emit_move_insn (word1, mem);
1759 emit_move_insn (word2, adjust_address (mem, SImode, 4));
1760 cr0 = gen_rtx_REG (CCmode, CR0_REGNO);
1761 emit_insn (gen_dlmzb (scratch_dlmzb, word1, word2, cr0));
1762 cond = gen_rtx_NE (VOIDmode, cr0, const0_rtx);
1763 emit_jump_insn (gen_rtx_SET (VOIDmode,
1765 gen_rtx_IF_THEN_ELSE (VOIDmode,
1771 emit_insn (gen_addsi3 (scratch_string, scratch_string, GEN_INT (8)));
1772 emit_jump_insn (gen_rtx_SET (VOIDmode,
1774 gen_rtx_LABEL_REF (VOIDmode, loop_label)));
1776 emit_label (end_label);
1777 emit_insn (gen_addsi3 (scratch_string, scratch_string, scratch_dlmzb));
1778 emit_insn (gen_subsi3 (result, scratch_string, addr));
1779 emit_insn (gen_subsi3 (result, result, const1_rtx));
1783 ;; Fixed-point arithmetic insns.
1785 (define_expand "add<mode>3"
1786 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1787 (plus:SDI (match_operand:SDI 1 "gpc_reg_operand" "")
1788 (match_operand:SDI 2 "reg_or_add_cint_operand" "")))]
1791 if (<MODE>mode == DImode && ! TARGET_POWERPC64)
1793 if (non_short_cint_operand (operands[2], DImode))
1796 else if (GET_CODE (operands[2]) == CONST_INT
1797 && ! add_operand (operands[2], <MODE>mode))
1799 rtx tmp = ((!can_create_pseudo_p ()
1800 || rtx_equal_p (operands[0], operands[1]))
1801 ? operands[0] : gen_reg_rtx (<MODE>mode));
1803 HOST_WIDE_INT val = INTVAL (operands[2]);
1804 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1805 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, <MODE>mode);
1807 if (<MODE>mode == DImode && !satisfies_constraint_L (GEN_INT (rest)))
1810 /* The ordering here is important for the prolog expander.
1811 When space is allocated from the stack, adding 'low' first may
1812 produce a temporary deallocation (which would be bad). */
1813 emit_insn (gen_add<mode>3 (tmp, operands[1], GEN_INT (rest)));
1814 emit_insn (gen_add<mode>3 (operands[0], tmp, GEN_INT (low)));
1819 ;; Discourage ai/addic because of carry but provide it in an alternative
1820 ;; allowing register zero as source.
1821 (define_insn "*add<mode>3_internal1"
1822 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r,?r,r")
1823 (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "%r,b,r,b")
1824 (match_operand:GPR 2 "add_operand" "r,I,I,L")))]
1825 "!DECIMAL_FLOAT_MODE_P (GET_MODE (operands[0])) && !DECIMAL_FLOAT_MODE_P (GET_MODE (operands[1]))"
1831 [(set_attr "type" "add")])
1833 (define_insn "addsi3_high"
1834 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
1835 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
1836 (high:SI (match_operand 2 "" ""))))]
1837 "TARGET_MACHO && !TARGET_64BIT"
1838 "addis %0,%1,ha16(%2)"
1839 [(set_attr "type" "add")])
1841 (define_insn "*add<mode>3_internal2"
1842 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
1843 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "%r,r,r,r")
1844 (match_operand:P 2 "reg_or_short_operand" "r,I,r,I"))
1846 (clobber (match_scratch:P 3 "=r,r,r,r"))]
1853 [(set_attr "type" "add,compare,compare,compare")
1854 (set_attr "dot" "yes")
1855 (set_attr "length" "4,4,8,8")])
1858 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1859 (compare:CC (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1860 (match_operand:GPR 2 "reg_or_short_operand" ""))
1862 (clobber (match_scratch:GPR 3 ""))]
1865 (plus:GPR (match_dup 1)
1868 (compare:CC (match_dup 3)
1872 (define_insn "*add<mode>3_internal3"
1873 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
1874 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "%r,r,r,r")
1875 (match_operand:P 2 "reg_or_short_operand" "r,I,r,I"))
1877 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
1878 (plus:P (match_dup 1)
1886 [(set_attr "type" "add,compare,compare,compare")
1887 (set_attr "dot" "yes")
1888 (set_attr "length" "4,4,8,8")])
1891 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1892 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "")
1893 (match_operand:P 2 "reg_or_short_operand" ""))
1895 (set (match_operand:P 0 "gpc_reg_operand" "")
1896 (plus:P (match_dup 1) (match_dup 2)))]
1899 (plus:P (match_dup 1)
1902 (compare:CC (match_dup 0)
1906 ;; Split an add that we can't do in one insn into two insns, each of which
1907 ;; does one 16-bit part. This is used by combine. Note that the low-order
1908 ;; add should be last in case the result gets used in an address.
1911 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
1912 (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1913 (match_operand:GPR 2 "non_add_cint_operand" "")))]
1915 [(set (match_dup 0) (plus:GPR (match_dup 1) (match_dup 3)))
1916 (set (match_dup 0) (plus:GPR (match_dup 0) (match_dup 4)))]
1918 HOST_WIDE_INT val = INTVAL (operands[2]);
1919 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1920 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, <MODE>mode);
1922 operands[4] = GEN_INT (low);
1923 if (<MODE>mode == SImode || satisfies_constraint_L (GEN_INT (rest)))
1924 operands[3] = GEN_INT (rest);
1925 else if (can_create_pseudo_p ())
1927 operands[3] = gen_reg_rtx (DImode);
1928 emit_move_insn (operands[3], operands[2]);
1929 emit_insn (gen_adddi3 (operands[0], operands[1], operands[3]));
1936 (define_expand "one_cmpl<mode>2"
1937 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1938 (not:SDI (match_operand:SDI 1 "gpc_reg_operand" "")))]
1941 if (<MODE>mode == DImode && !TARGET_POWERPC64)
1943 rs6000_split_logical (operands, NOT, false, false, false, NULL_RTX);
1948 (define_insn "*one_cmpl<mode>2"
1949 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1950 (not:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
1955 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1956 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1958 (clobber (match_scratch:P 2 "=r,r"))]
1963 [(set_attr "type" "logical,compare")
1964 (set_attr "dot" "yes")
1965 (set_attr "length" "4,8")])
1968 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
1969 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" ""))
1971 (clobber (match_scratch:P 2 ""))]
1974 (not:P (match_dup 1)))
1976 (compare:CC (match_dup 2)
1981 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1982 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1984 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
1985 (not:P (match_dup 1)))]
1990 [(set_attr "type" "logical,compare")
1991 (set_attr "dot" "yes")
1992 (set_attr "length" "4,8")])
1995 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
1996 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" ""))
1998 (set (match_operand:P 0 "gpc_reg_operand" "")
1999 (not:P (match_dup 1)))]
2002 (not:P (match_dup 1)))
2004 (compare:CC (match_dup 0)
2009 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
2010 (minus:GPR (match_operand:GPR 1 "reg_or_short_operand" "r,I")
2011 (match_operand:GPR 2 "gpc_reg_operand" "r,r")))]
2016 [(set_attr "type" "add")])
2019 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2020 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "r,r")
2021 (match_operand:P 2 "gpc_reg_operand" "r,r"))
2023 (clobber (match_scratch:P 3 "=r,r"))]
2028 [(set_attr "type" "add")
2029 (set_attr "dot" "yes")
2030 (set_attr "length" "4,8")])
2033 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2034 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "")
2035 (match_operand:P 2 "gpc_reg_operand" ""))
2037 (clobber (match_scratch:P 3 ""))]
2040 (minus:P (match_dup 1)
2043 (compare:CC (match_dup 3)
2048 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2049 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "r,r")
2050 (match_operand:P 2 "gpc_reg_operand" "r,r"))
2052 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
2053 (minus:P (match_dup 1)
2059 [(set_attr "type" "add")
2060 (set_attr "dot" "yes")
2061 (set_attr "length" "4,8")])
2064 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2065 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "")
2066 (match_operand:P 2 "gpc_reg_operand" ""))
2068 (set (match_operand:P 0 "gpc_reg_operand" "")
2069 (minus:P (match_dup 1)
2073 (minus:P (match_dup 1)
2076 (compare:CC (match_dup 0)
2080 (define_expand "sub<mode>3"
2081 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
2082 (minus:SDI (match_operand:SDI 1 "reg_or_short_operand" "")
2083 (match_operand:SDI 2 "reg_or_sub_cint_operand" "")))]
2087 if (GET_CODE (operands[2]) == CONST_INT)
2089 emit_insn (gen_add<mode>3 (operands[0], operands[1],
2090 negate_rtx (<MODE>mode, operands[2])));
2095 (define_expand "neg<mode>2"
2096 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
2097 (neg:SDI (match_operand:SDI 1 "gpc_reg_operand" "")))]
2101 (define_insn "*neg<mode>2_internal"
2102 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2103 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
2106 [(set_attr "type" "add")])
2109 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2110 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
2112 (clobber (match_scratch:P 2 "=r,r"))]
2117 [(set_attr "type" "add")
2118 (set_attr "dot" "yes")
2119 (set_attr "length" "4,8")])
2122 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2123 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" ""))
2125 (clobber (match_scratch:P 2 ""))]
2128 (neg:P (match_dup 1)))
2130 (compare:CC (match_dup 2)
2135 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
2136 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
2138 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
2139 (neg:P (match_dup 1)))]
2144 [(set_attr "type" "add")
2145 (set_attr "dot" "yes")
2146 (set_attr "length" "4,8")])
2149 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
2150 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" ""))
2152 (set (match_operand:P 0 "gpc_reg_operand" "")
2153 (neg:P (match_dup 1)))]
2156 (neg:P (match_dup 1)))
2158 (compare:CC (match_dup 0)
2162 (define_insn "clz<mode>2"
2163 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2164 (clz:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
2167 [(set_attr "type" "cntlz")])
2169 (define_expand "ctz<mode>2"
2171 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))
2172 (parallel [(set (match_dup 3) (and:GPR (match_dup 1)
2174 (clobber (scratch:CC))])
2175 (set (match_dup 4) (clz:GPR (match_dup 3)))
2176 (set (match_operand:GPR 0 "gpc_reg_operand" "")
2177 (minus:GPR (match_dup 5) (match_dup 4)))]
2180 operands[2] = gen_reg_rtx (<MODE>mode);
2181 operands[3] = gen_reg_rtx (<MODE>mode);
2182 operands[4] = gen_reg_rtx (<MODE>mode);
2183 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode) - 1);
2186 (define_expand "ffs<mode>2"
2188 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))
2189 (parallel [(set (match_dup 3) (and:GPR (match_dup 1)
2191 (clobber (scratch:CC))])
2192 (set (match_dup 4) (clz:GPR (match_dup 3)))
2193 (set (match_operand:GPR 0 "gpc_reg_operand" "")
2194 (minus:GPR (match_dup 5) (match_dup 4)))]
2197 operands[2] = gen_reg_rtx (<MODE>mode);
2198 operands[3] = gen_reg_rtx (<MODE>mode);
2199 operands[4] = gen_reg_rtx (<MODE>mode);
2200 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode));
2203 (define_insn "popcntb<mode>2"
2204 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2205 (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")]
2209 [(set_attr "length" "4")
2210 (set_attr "type" "popcnt")])
2212 (define_insn "popcntd<mode>2"
2213 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2214 (popcount:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
2217 [(set_attr "length" "4")
2218 (set_attr "type" "popcnt")])
2220 (define_expand "popcount<mode>2"
2221 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2222 (popcount:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))]
2223 "TARGET_POPCNTB || TARGET_POPCNTD"
2225 rs6000_emit_popcount (operands[0], operands[1]);
2229 (define_insn "parity<mode>2_cmpb"
2230 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2231 (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")] UNSPEC_PARITY))]
2232 "TARGET_CMPB && TARGET_POPCNTB"
2234 [(set_attr "length" "4")
2235 (set_attr "type" "popcnt")])
2237 (define_expand "parity<mode>2"
2238 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2239 (parity:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))]
2242 rs6000_emit_parity (operands[0], operands[1]);
2246 ;; Since the hardware zeros the upper part of the register, save generating the
2247 ;; AND immediate if we are converting to unsigned
2248 (define_insn "*bswaphi2_extenddi"
2249 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
2251 (bswap:HI (match_operand:HI 1 "memory_operand" "Z"))))]
2254 [(set_attr "length" "4")
2255 (set_attr "type" "load")])
2257 (define_insn "*bswaphi2_extendsi"
2258 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2260 (bswap:HI (match_operand:HI 1 "memory_operand" "Z"))))]
2263 [(set_attr "length" "4")
2264 (set_attr "type" "load")])
2266 (define_expand "bswaphi2"
2267 [(parallel [(set (match_operand:HI 0 "reg_or_mem_operand" "")
2269 (match_operand:HI 1 "reg_or_mem_operand" "")))
2270 (clobber (match_scratch:SI 2 ""))])]
2273 if (!REG_P (operands[0]) && !REG_P (operands[1]))
2274 operands[1] = force_reg (HImode, operands[1]);
2277 (define_insn "bswaphi2_internal"
2278 [(set (match_operand:HI 0 "reg_or_mem_operand" "=r,Z,&r")
2280 (match_operand:HI 1 "reg_or_mem_operand" "Z,r,r")))
2281 (clobber (match_scratch:SI 2 "=X,X,&r"))]
2287 [(set_attr "length" "4,4,12")
2288 (set_attr "type" "load,store,*")])
2290 ;; We are always BITS_BIG_ENDIAN, so the (const_int 16) below is
2291 ;; correct for -mlittle as well as -mbig.
2293 [(set (match_operand:HI 0 "gpc_reg_operand" "")
2294 (bswap:HI (match_operand:HI 1 "gpc_reg_operand" "")))
2295 (clobber (match_operand:SI 2 "gpc_reg_operand" ""))]
2298 (zero_extract:SI (match_dup 4)
2302 (and:SI (ashift:SI (match_dup 4)
2304 (const_int 65280))) ;; 0xff00
2306 (ior:SI (match_dup 3)
2310 operands[3] = simplify_gen_subreg (SImode, operands[0], HImode, 0);
2311 operands[4] = simplify_gen_subreg (SImode, operands[1], HImode, 0);
2314 (define_insn "*bswapsi2_extenddi"
2315 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
2317 (bswap:SI (match_operand:SI 1 "memory_operand" "Z"))))]
2320 [(set_attr "length" "4")
2321 (set_attr "type" "load")])
2323 (define_expand "bswapsi2"
2324 [(set (match_operand:SI 0 "reg_or_mem_operand" "")
2326 (match_operand:SI 1 "reg_or_mem_operand" "")))]
2329 if (!REG_P (operands[0]) && !REG_P (operands[1]))
2330 operands[1] = force_reg (SImode, operands[1]);
2333 (define_insn "*bswapsi2_internal"
2334 [(set (match_operand:SI 0 "reg_or_mem_operand" "=r,Z,&r")
2336 (match_operand:SI 1 "reg_or_mem_operand" "Z,r,r")))]
2342 [(set_attr "length" "4,4,12")
2343 (set_attr "type" "load,store,*")])
2345 ;; We are always BITS_BIG_ENDIAN, so the bit positions below in
2346 ;; zero_extract insns do not change for -mlittle.
2348 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2349 (bswap:SI (match_operand:SI 1 "gpc_reg_operand" "")))]
2352 (rotate:SI (match_dup 1) (const_int 8)))
2353 (set (zero_extract:SI (match_dup 0)
2357 (set (zero_extract:SI (match_dup 0)
2360 (rotate:SI (match_dup 1)
2364 (define_expand "bswapdi2"
2365 [(parallel [(set (match_operand:DI 0 "reg_or_mem_operand" "")
2367 (match_operand:DI 1 "reg_or_mem_operand" "")))
2368 (clobber (match_scratch:DI 2 ""))
2369 (clobber (match_scratch:DI 3 ""))
2370 (clobber (match_scratch:DI 4 ""))])]
2373 if (!REG_P (operands[0]) && !REG_P (operands[1]))
2374 operands[1] = force_reg (DImode, operands[1]);
2376 if (!TARGET_POWERPC64)
2378 /* 32-bit mode needs fewer scratch registers, but 32-bit addressing mode
2379 that uses 64-bit registers needs the same scratch registers as 64-bit
2381 emit_insn (gen_bswapdi2_32bit (operands[0], operands[1]));
2386 ;; Power7/cell has ldbrx/stdbrx, so use it directly
2387 (define_insn "*bswapdi2_ldbrx"
2388 [(set (match_operand:DI 0 "reg_or_mem_operand" "=&r,Z,??&r")
2389 (bswap:DI (match_operand:DI 1 "reg_or_mem_operand" "Z,r,r")))
2390 (clobber (match_scratch:DI 2 "=X,X,&r"))
2391 (clobber (match_scratch:DI 3 "=X,X,&r"))
2392 (clobber (match_scratch:DI 4 "=X,X,&r"))]
2393 "TARGET_POWERPC64 && TARGET_LDBRX
2394 && (REG_P (operands[0]) || REG_P (operands[1]))"
2399 [(set_attr "length" "4,4,36")
2400 (set_attr "type" "load,store,*")])
2402 ;; Non-power7/cell, fall back to use lwbrx/stwbrx
2403 (define_insn "*bswapdi2_64bit"
2404 [(set (match_operand:DI 0 "reg_or_mem_operand" "=&r,Z,&r")
2405 (bswap:DI (match_operand:DI 1 "reg_or_mem_operand" "Z,r,r")))
2406 (clobber (match_scratch:DI 2 "=&b,&b,&r"))
2407 (clobber (match_scratch:DI 3 "=&r,&r,&r"))
2408 (clobber (match_scratch:DI 4 "=&r,X,&r"))]
2409 "TARGET_POWERPC64 && !TARGET_LDBRX
2410 && (REG_P (operands[0]) || REG_P (operands[1]))
2411 && !(MEM_P (operands[0]) && MEM_VOLATILE_P (operands[0]))
2412 && !(MEM_P (operands[1]) && MEM_VOLATILE_P (operands[1]))"
2414 [(set_attr "length" "16,12,36")])
2417 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2418 (bswap:DI (match_operand:DI 1 "indexed_or_indirect_operand" "")))
2419 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
2420 (clobber (match_operand:DI 3 "gpc_reg_operand" ""))
2421 (clobber (match_operand:DI 4 "gpc_reg_operand" ""))]
2422 "TARGET_POWERPC64 && !TARGET_LDBRX && reload_completed"
2426 rtx dest = operands[0];
2427 rtx src = operands[1];
2428 rtx op2 = operands[2];
2429 rtx op3 = operands[3];
2430 rtx op4 = operands[4];
2431 rtx op3_32 = simplify_gen_subreg (SImode, op3, DImode,
2432 BYTES_BIG_ENDIAN ? 4 : 0);
2433 rtx op4_32 = simplify_gen_subreg (SImode, op4, DImode,
2434 BYTES_BIG_ENDIAN ? 4 : 0);
2440 addr1 = XEXP (src, 0);
2441 if (GET_CODE (addr1) == PLUS)
2443 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2444 if (TARGET_AVOID_XFORM)
2446 emit_insn (gen_add3_insn (op2, XEXP (addr1, 1), op2));
2450 addr2 = gen_rtx_PLUS (Pmode, op2, XEXP (addr1, 1));
2452 else if (TARGET_AVOID_XFORM)
2454 emit_insn (gen_add3_insn (op2, addr1, GEN_INT (4)));
2459 emit_move_insn (op2, GEN_INT (4));
2460 addr2 = gen_rtx_PLUS (Pmode, op2, addr1);
2463 if (BYTES_BIG_ENDIAN)
2465 word_high = change_address (src, SImode, addr1);
2466 word_low = change_address (src, SImode, addr2);
2470 word_high = change_address (src, SImode, addr2);
2471 word_low = change_address (src, SImode, addr1);
2474 emit_insn (gen_bswapsi2 (op3_32, word_low));
2475 emit_insn (gen_bswapsi2 (op4_32, word_high));
2476 emit_insn (gen_ashldi3 (dest, op3, GEN_INT (32)));
2477 emit_insn (gen_iordi3 (dest, dest, op4));
2481 [(set (match_operand:DI 0 "indexed_or_indirect_operand" "")
2482 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2483 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
2484 (clobber (match_operand:DI 3 "gpc_reg_operand" ""))
2485 (clobber (match_operand:DI 4 "" ""))]
2486 "TARGET_POWERPC64 && !TARGET_LDBRX && reload_completed"
2490 rtx dest = operands[0];
2491 rtx src = operands[1];
2492 rtx op2 = operands[2];
2493 rtx op3 = operands[3];
2494 rtx src_si = simplify_gen_subreg (SImode, src, DImode,
2495 BYTES_BIG_ENDIAN ? 4 : 0);
2496 rtx op3_si = simplify_gen_subreg (SImode, op3, DImode,
2497 BYTES_BIG_ENDIAN ? 4 : 0);
2503 addr1 = XEXP (dest, 0);
2504 if (GET_CODE (addr1) == PLUS)
2506 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2507 if (TARGET_AVOID_XFORM)
2509 emit_insn (gen_add3_insn (op2, XEXP (addr1, 1), op2));
2513 addr2 = gen_rtx_PLUS (Pmode, op2, XEXP (addr1, 1));
2515 else if (TARGET_AVOID_XFORM)
2517 emit_insn (gen_add3_insn (op2, addr1, GEN_INT (4)));
2522 emit_move_insn (op2, GEN_INT (4));
2523 addr2 = gen_rtx_PLUS (Pmode, op2, addr1);
2526 emit_insn (gen_lshrdi3 (op3, src, GEN_INT (32)));
2527 if (BYTES_BIG_ENDIAN)
2529 word_high = change_address (dest, SImode, addr1);
2530 word_low = change_address (dest, SImode, addr2);
2534 word_high = change_address (dest, SImode, addr2);
2535 word_low = change_address (dest, SImode, addr1);
2537 emit_insn (gen_bswapsi2 (word_high, src_si));
2538 emit_insn (gen_bswapsi2 (word_low, op3_si));
2542 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2543 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2544 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
2545 (clobber (match_operand:DI 3 "gpc_reg_operand" ""))
2546 (clobber (match_operand:DI 4 "" ""))]
2547 "TARGET_POWERPC64 && reload_completed"
2551 rtx dest = operands[0];
2552 rtx src = operands[1];
2553 rtx op2 = operands[2];
2554 rtx op3 = operands[3];
2555 int lo_off = BYTES_BIG_ENDIAN ? 4 : 0;
2556 rtx dest_si = simplify_gen_subreg (SImode, dest, DImode, lo_off);
2557 rtx src_si = simplify_gen_subreg (SImode, src, DImode, lo_off);
2558 rtx op2_si = simplify_gen_subreg (SImode, op2, DImode, lo_off);
2559 rtx op3_si = simplify_gen_subreg (SImode, op3, DImode, lo_off);
2561 emit_insn (gen_lshrdi3 (op2, src, GEN_INT (32)));
2562 emit_insn (gen_bswapsi2 (dest_si, src_si));
2563 emit_insn (gen_bswapsi2 (op3_si, op2_si));
2564 emit_insn (gen_ashldi3 (dest, dest, GEN_INT (32)));
2565 emit_insn (gen_iordi3 (dest, dest, op3));
2568 (define_insn "bswapdi2_32bit"
2569 [(set (match_operand:DI 0 "reg_or_mem_operand" "=&r,Z,&r")
2570 (bswap:DI (match_operand:DI 1 "reg_or_mem_operand" "Z,r,r")))
2571 (clobber (match_scratch:SI 2 "=&b,&b,X"))]
2572 "!TARGET_POWERPC64 && (REG_P (operands[0]) || REG_P (operands[1]))"
2574 [(set_attr "length" "16,12,36")])
2577 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2578 (bswap:DI (match_operand:DI 1 "indexed_or_indirect_operand" "")))
2579 (clobber (match_operand:SI 2 "gpc_reg_operand" ""))]
2580 "!TARGET_POWERPC64 && reload_completed"
2584 rtx dest = operands[0];
2585 rtx src = operands[1];
2586 rtx op2 = operands[2];
2587 rtx dest1 = simplify_gen_subreg (SImode, dest, DImode, 0);
2588 rtx dest2 = simplify_gen_subreg (SImode, dest, DImode, 4);
2594 addr1 = XEXP (src, 0);
2595 if (GET_CODE (addr1) == PLUS)
2597 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2598 if (TARGET_AVOID_XFORM)
2600 emit_insn (gen_add3_insn (op2, XEXP (addr1, 1), op2));
2604 addr2 = gen_rtx_PLUS (SImode, op2, XEXP (addr1, 1));
2606 else if (TARGET_AVOID_XFORM)
2608 emit_insn (gen_add3_insn (op2, addr1, GEN_INT (4)));
2613 emit_move_insn (op2, GEN_INT (4));
2614 addr2 = gen_rtx_PLUS (SImode, op2, addr1);
2617 word1 = change_address (src, SImode, addr1);
2618 word2 = change_address (src, SImode, addr2);
2620 emit_insn (gen_bswapsi2 (dest2, word1));
2621 emit_insn (gen_bswapsi2 (dest1, word2));
2625 [(set (match_operand:DI 0 "indexed_or_indirect_operand" "")
2626 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2627 (clobber (match_operand:SI 2 "gpc_reg_operand" ""))]
2628 "!TARGET_POWERPC64 && reload_completed"
2632 rtx dest = operands[0];
2633 rtx src = operands[1];
2634 rtx op2 = operands[2];
2635 rtx src1 = simplify_gen_subreg (SImode, src, DImode, 0);
2636 rtx src2 = simplify_gen_subreg (SImode, src, DImode, 4);
2642 addr1 = XEXP (dest, 0);
2643 if (GET_CODE (addr1) == PLUS)
2645 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2646 if (TARGET_AVOID_XFORM)
2648 emit_insn (gen_add3_insn (op2, XEXP (addr1, 1), op2));
2652 addr2 = gen_rtx_PLUS (SImode, op2, XEXP (addr1, 1));
2654 else if (TARGET_AVOID_XFORM)
2656 emit_insn (gen_add3_insn (op2, addr1, GEN_INT (4)));
2661 emit_move_insn (op2, GEN_INT (4));
2662 addr2 = gen_rtx_PLUS (SImode, op2, addr1);
2665 word1 = change_address (dest, SImode, addr1);
2666 word2 = change_address (dest, SImode, addr2);
2668 emit_insn (gen_bswapsi2 (word2, src1));
2669 emit_insn (gen_bswapsi2 (word1, src2));
2673 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2674 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2675 (clobber (match_operand:SI 2 "" ""))]
2676 "!TARGET_POWERPC64 && reload_completed"
2680 rtx dest = operands[0];
2681 rtx src = operands[1];
2682 rtx src1 = simplify_gen_subreg (SImode, src, DImode, 0);
2683 rtx src2 = simplify_gen_subreg (SImode, src, DImode, 4);
2684 rtx dest1 = simplify_gen_subreg (SImode, dest, DImode, 0);
2685 rtx dest2 = simplify_gen_subreg (SImode, dest, DImode, 4);
2687 emit_insn (gen_bswapsi2 (dest1, src2));
2688 emit_insn (gen_bswapsi2 (dest2, src1));
2691 (define_insn "mulsi3"
2692 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2693 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2694 (match_operand:SI 2 "reg_or_short_operand" "r,I")))]
2699 [(set_attr "type" "mul")
2701 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
2703 (match_operand:SI 2 "short_cint_operand" "")
2704 (const_string "16")]
2705 (const_string "32")))])
2707 (define_insn "*mulsi3_internal1"
2708 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2709 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2710 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2712 (clobber (match_scratch:SI 3 "=r,r"))]
2717 [(set_attr "type" "mul")
2718 (set_attr "dot" "yes")
2719 (set_attr "length" "4,8")])
2722 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
2723 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2724 (match_operand:SI 2 "gpc_reg_operand" ""))
2726 (clobber (match_scratch:SI 3 ""))]
2727 "TARGET_32BIT && reload_completed"
2729 (mult:SI (match_dup 1) (match_dup 2)))
2731 (compare:CC (match_dup 3)
2735 (define_insn "*mulsi3_internal2"
2736 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2737 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2738 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2740 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2741 (mult:SI (match_dup 1) (match_dup 2)))]
2746 [(set_attr "type" "mul")
2747 (set_attr "dot" "yes")
2748 (set_attr "length" "4,8")])
2751 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
2752 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2753 (match_operand:SI 2 "gpc_reg_operand" ""))
2755 (set (match_operand:SI 0 "gpc_reg_operand" "")
2756 (mult:SI (match_dup 1) (match_dup 2)))]
2757 "TARGET_32BIT && reload_completed"
2759 (mult:SI (match_dup 1) (match_dup 2)))
2761 (compare:CC (match_dup 0)
2766 (define_insn "udiv<mode>3"
2767 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2768 (udiv:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2769 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
2772 [(set_attr "type" "div")
2773 (set_attr "size" "<bits>")])
2776 ;; For powers of two we can do srai/aze for divide and then adjust for
2777 ;; modulus. If it isn't a power of two, force operands into register and do
2779 (define_expand "div<mode>3"
2780 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2781 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2782 (match_operand:GPR 2 "reg_or_cint_operand" "")))]
2785 if (GET_CODE (operands[2]) != CONST_INT
2786 || INTVAL (operands[2]) <= 0
2787 || exact_log2 (INTVAL (operands[2])) < 0)
2788 operands[2] = force_reg (<MODE>mode, operands[2]);
2791 (define_insn "*div<mode>3"
2792 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2793 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2794 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
2797 [(set_attr "type" "div")
2798 (set_attr "size" "<bits>")])
2800 (define_expand "mod<mode>3"
2801 [(use (match_operand:GPR 0 "gpc_reg_operand" ""))
2802 (use (match_operand:GPR 1 "gpc_reg_operand" ""))
2803 (use (match_operand:GPR 2 "reg_or_cint_operand" ""))]
2811 if (GET_CODE (operands[2]) != CONST_INT
2812 || INTVAL (operands[2]) <= 0
2813 || (i = exact_log2 (INTVAL (operands[2]))) < 0)
2816 temp1 = gen_reg_rtx (<MODE>mode);
2817 temp2 = gen_reg_rtx (<MODE>mode);
2819 emit_insn (gen_div<mode>3 (temp1, operands[1], operands[2]));
2820 emit_insn (gen_ashl<mode>3 (temp2, temp1, GEN_INT (i)));
2821 emit_insn (gen_sub<mode>3 (operands[0], operands[1], temp2));
2826 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2827 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2828 (match_operand:GPR 2 "exact_log2_cint_operand" "N")))]
2830 "sra<wd>i %0,%1,%p2\;addze %0,%0"
2831 [(set_attr "type" "two")
2832 (set_attr "length" "8")])
2835 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2836 (compare:CC (div:P (match_operand:P 1 "gpc_reg_operand" "r,r")
2837 (match_operand:P 2 "exact_log2_cint_operand" "N,N"))
2839 (clobber (match_scratch:P 3 "=r,r"))]
2842 sra<wd>i %3,%1,%p2\;addze. %3,%3
2844 [(set_attr "type" "compare")
2845 (set_attr "length" "8,12")
2846 (set_attr "cell_micro" "not")])
2849 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2850 (compare:CC (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2851 (match_operand:GPR 2 "exact_log2_cint_operand"
2854 (clobber (match_scratch:GPR 3 ""))]
2857 (div:<MODE> (match_dup 1) (match_dup 2)))
2859 (compare:CC (match_dup 3)
2864 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2865 (compare:CC (div:P (match_operand:P 1 "gpc_reg_operand" "r,r")
2866 (match_operand:P 2 "exact_log2_cint_operand" "N,N"))
2868 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
2869 (div:P (match_dup 1) (match_dup 2)))]
2872 sra<wd>i %0,%1,%p2\;addze. %0,%0
2874 [(set_attr "type" "compare")
2875 (set_attr "length" "8,12")
2876 (set_attr "cell_micro" "not")])
2879 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2880 (compare:CC (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2881 (match_operand:GPR 2 "exact_log2_cint_operand"
2884 (set (match_operand:GPR 0 "gpc_reg_operand" "")
2885 (div:GPR (match_dup 1) (match_dup 2)))]
2888 (div:<MODE> (match_dup 1) (match_dup 2)))
2890 (compare:CC (match_dup 0)
2894 ;; Logical instructions
2895 ;; The logical instructions are mostly combined by using match_operator,
2896 ;; but the plain AND insns are somewhat different because there is no
2897 ;; plain 'andi' (only 'andi.'), no plain 'andis', and there are all
2898 ;; those rotate-and-mask operations. Thus, the AND insns come first.
2900 (define_expand "andsi3"
2902 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2903 (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2904 (match_operand:SI 2 "and_operand" "")))
2905 (clobber (match_scratch:CC 3 ""))])]
2909 (define_insn "andsi3_mc"
2910 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
2911 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
2912 (match_operand:SI 2 "and_operand" "?r,T,K,L")))
2913 (clobber (match_scratch:CC 3 "=X,X,x,x"))]
2914 "rs6000_gen_cell_microcode"
2917 rlwinm %0,%1,0,%m2,%M2
2920 [(set_attr "type" "*,shift,logical,logical")
2921 (set_attr "dot" "no,no,yes,yes")])
2923 (define_insn "andsi3_nomc"
2924 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2925 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2926 (match_operand:SI 2 "and_operand" "?r,T")))
2927 (clobber (match_scratch:CC 3 "=X,X"))]
2928 "!rs6000_gen_cell_microcode"
2931 rlwinm %0,%1,0,%m2,%M2"
2932 [(set_attr "type" "logical,shift")])
2934 (define_insn "andsi3_internal0_nomc"
2935 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2936 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2937 (match_operand:SI 2 "and_operand" "?r,T")))]
2938 "!rs6000_gen_cell_microcode"
2941 rlwinm %0,%1,0,%m2,%M2"
2942 [(set_attr "type" "logical,shift")])
2945 ;; Note to set cr's other than cr0 we do the and immediate and then
2946 ;; the test again -- this avoids a mfcr which on the higher end
2947 ;; machines causes an execution serialization
2949 (define_insn "*andsi3_internal2_mc"
2950 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2951 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2952 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2954 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2955 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2956 "TARGET_32BIT && rs6000_gen_cell_microcode"
2961 rlwinm. %3,%1,0,%m2,%M2
2966 [(set_attr "type" "logical,logical,logical,shift,\
2967 compare,compare,compare,compare")
2968 (set_attr "dot" "yes")
2969 (set_attr "length" "4,4,4,4,8,8,8,8")])
2971 (define_insn "*andsi3_internal3_mc"
2972 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2973 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2974 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2976 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2977 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2978 "TARGET_64BIT && rs6000_gen_cell_microcode"
2983 rlwinm. %3,%1,0,%m2,%M2
2988 [(set_attr "type" "compare,logical,logical,shift,compare,\
2989 compare,compare,compare")
2990 (set_attr "dot" "yes")
2991 (set_attr "length" "8,4,4,4,8,8,8,8")])
2994 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
2995 (compare:CC (and:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2996 (match_operand:GPR 2 "and_operand" ""))
2998 (clobber (match_scratch:GPR 3 ""))
2999 (clobber (match_scratch:CC 4 ""))]
3001 [(parallel [(set (match_dup 3)
3002 (and:<MODE> (match_dup 1)
3004 (clobber (match_dup 4))])
3006 (compare:CC (match_dup 3)
3010 ;; We don't have a 32 bit "and. rt,ra,rb" for ppc64. cr is set from the
3011 ;; whole 64 bit reg, and we don't know what is in the high 32 bits.
3014 [(set (match_operand:CC 0 "cc_reg_operand" "")
3015 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
3016 (match_operand:SI 2 "gpc_reg_operand" ""))
3018 (clobber (match_scratch:SI 3 ""))
3019 (clobber (match_scratch:CC 4 ""))]
3020 "TARGET_POWERPC64 && reload_completed"
3021 [(parallel [(set (match_dup 3)
3022 (and:SI (match_dup 1)
3024 (clobber (match_dup 4))])
3026 (compare:CC (match_dup 3)
3030 (define_insn "*andsi3_internal4"
3031 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
3032 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
3033 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
3035 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
3036 (and:SI (match_dup 1)
3038 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
3039 "TARGET_32BIT && rs6000_gen_cell_microcode"
3044 rlwinm. %0,%1,0,%m2,%M2
3049 [(set_attr "type" "logical,logical,logical,shift,\
3050 compare,compare,compare,compare")
3051 (set_attr "dot" "yes")
3052 (set_attr "length" "4,4,4,4,8,8,8,8")])
3054 (define_insn "*andsi3_internal5_mc"
3055 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
3056 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
3057 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
3059 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
3060 (and:SI (match_dup 1)
3062 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
3063 "TARGET_64BIT && rs6000_gen_cell_microcode"
3068 rlwinm. %0,%1,0,%m2,%M2
3073 [(set_attr "type" "compare,logical,logical,shift,compare,\
3074 compare,compare,compare")
3075 (set_attr "dot" "yes")
3076 (set_attr "length" "8,4,4,4,8,8,8,8")])
3079 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3080 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
3081 (match_operand:SI 2 "and_operand" ""))
3083 (set (match_operand:SI 0 "gpc_reg_operand" "")
3084 (and:SI (match_dup 1)
3086 (clobber (match_scratch:CC 4 ""))]
3088 [(parallel [(set (match_dup 0)
3089 (and:SI (match_dup 1)
3091 (clobber (match_dup 4))])
3093 (compare:CC (match_dup 0)
3098 [(set (match_operand:CC 3 "cc_reg_operand" "")
3099 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
3100 (match_operand:SI 2 "gpc_reg_operand" ""))
3102 (set (match_operand:SI 0 "gpc_reg_operand" "")
3103 (and:SI (match_dup 1)
3105 (clobber (match_scratch:CC 4 ""))]
3106 "TARGET_POWERPC64 && reload_completed"
3107 [(parallel [(set (match_dup 0)
3108 (and:SI (match_dup 1)
3110 (clobber (match_dup 4))])
3112 (compare:CC (match_dup 0)
3116 ;; Handle the PowerPC64 rlwinm corner case
3118 (define_insn_and_split "*andsi3_internal6"
3119 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3120 (and:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3121 (match_operand:SI 2 "mask_operand_wrap" "i")))]
3126 (and:SI (rotate:SI (match_dup 1) (match_dup 3))
3129 (rotate:SI (match_dup 0) (match_dup 5)))]
3132 int mb = extract_MB (operands[2]);
3133 int me = extract_ME (operands[2]);
3134 operands[3] = GEN_INT (me + 1);
3135 operands[5] = GEN_INT (32 - (me + 1));
3136 operands[4] = GEN_INT (~((HOST_WIDE_INT) -1 << (33 + me - mb)));
3138 [(set_attr "length" "8")])
3140 (define_expand "iorsi3"
3141 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3142 (ior:SI (match_operand:SI 1 "gpc_reg_operand" "")
3143 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
3147 if (GET_CODE (operands[2]) == CONST_INT
3148 && ! logical_operand (operands[2], SImode))
3150 HOST_WIDE_INT value = INTVAL (operands[2]);
3151 rtx tmp = ((!can_create_pseudo_p ()
3152 || rtx_equal_p (operands[0], operands[1]))
3153 ? operands[0] : gen_reg_rtx (SImode));
3155 emit_insn (gen_iorsi3 (tmp, operands[1],
3156 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
3157 emit_insn (gen_iorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
3162 (define_expand "xorsi3"
3163 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3164 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
3165 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
3169 if (GET_CODE (operands[2]) == CONST_INT
3170 && ! logical_operand (operands[2], SImode))
3172 HOST_WIDE_INT value = INTVAL (operands[2]);
3173 rtx tmp = ((!can_create_pseudo_p ()
3174 || rtx_equal_p (operands[0], operands[1]))
3175 ? operands[0] : gen_reg_rtx (SImode));
3177 emit_insn (gen_xorsi3 (tmp, operands[1],
3178 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
3179 emit_insn (gen_xorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
3184 (define_insn "*boolsi3_internal1"
3185 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
3186 (match_operator:SI 3 "boolean_or_operator"
3187 [(match_operand:SI 1 "gpc_reg_operand" "%r,r,r")
3188 (match_operand:SI 2 "logical_operand" "r,K,L")]))]
3195 (define_insn "*boolsi3_internal2"
3196 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3197 (compare:CC (match_operator:SI 4 "boolean_or_operator"
3198 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
3199 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3201 (clobber (match_scratch:SI 3 "=r,r"))]
3206 [(set_attr "type" "logical,compare")
3207 (set_attr "dot" "yes")
3208 (set_attr "length" "4,8")])
3211 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3212 (compare:CC (match_operator:SI 4 "boolean_operator"
3213 [(match_operand:SI 1 "gpc_reg_operand" "")
3214 (match_operand:SI 2 "gpc_reg_operand" "")])
3216 (clobber (match_scratch:SI 3 ""))]
3217 "TARGET_32BIT && reload_completed"
3218 [(set (match_dup 3) (match_dup 4))
3220 (compare:CC (match_dup 3)
3224 (define_insn "*boolsi3_internal3"
3225 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3226 (compare:CC (match_operator:SI 4 "boolean_operator"
3227 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
3228 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3230 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3236 [(set_attr "type" "logical,compare")
3237 (set_attr "dot" "yes")
3238 (set_attr "length" "4,8")])
3241 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3242 (compare:CC (match_operator:SI 4 "boolean_operator"
3243 [(match_operand:SI 1 "gpc_reg_operand" "")
3244 (match_operand:SI 2 "gpc_reg_operand" "")])
3246 (set (match_operand:SI 0 "gpc_reg_operand" "")
3248 "TARGET_32BIT && reload_completed"
3249 [(set (match_dup 0) (match_dup 4))
3251 (compare:CC (match_dup 0)
3255 ;; Split a logical operation that we can't do in one insn into two insns,
3256 ;; each of which does one 16-bit part. This is used by combine.
3259 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3260 (match_operator:SI 3 "boolean_or_operator"
3261 [(match_operand:SI 1 "gpc_reg_operand" "")
3262 (match_operand:SI 2 "non_logical_cint_operand" "")]))]
3264 [(set (match_dup 0) (match_dup 4))
3265 (set (match_dup 0) (match_dup 5))]
3269 i = GEN_INT (INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff));
3270 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
3272 i = GEN_INT (INTVAL (operands[2]) & 0xffff);
3273 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
3277 (define_insn "*boolcsi3_internal1"
3278 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3279 (match_operator:SI 3 "boolean_operator"
3280 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
3281 (match_operand:SI 2 "gpc_reg_operand" "r")]))]
3285 (define_insn "*boolcsi3_internal2"
3286 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3287 (compare:CC (match_operator:SI 4 "boolean_operator"
3288 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
3289 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3291 (clobber (match_scratch:SI 3 "=r,r"))]
3296 [(set_attr "type" "compare")
3297 (set_attr "length" "4,8")])
3300 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3301 (compare:CC (match_operator:SI 4 "boolean_operator"
3302 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3303 (match_operand:SI 2 "gpc_reg_operand" "")])
3305 (clobber (match_scratch:SI 3 ""))]
3306 "TARGET_32BIT && reload_completed"
3307 [(set (match_dup 3) (match_dup 4))
3309 (compare:CC (match_dup 3)
3313 (define_insn "*boolcsi3_internal3"
3314 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3315 (compare:CC (match_operator:SI 4 "boolean_operator"
3316 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
3317 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3319 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3325 [(set_attr "type" "compare")
3326 (set_attr "length" "4,8")])
3329 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3330 (compare:CC (match_operator:SI 4 "boolean_operator"
3331 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3332 (match_operand:SI 2 "gpc_reg_operand" "")])
3334 (set (match_operand:SI 0 "gpc_reg_operand" "")
3336 "TARGET_32BIT && reload_completed"
3337 [(set (match_dup 0) (match_dup 4))
3339 (compare:CC (match_dup 0)
3343 (define_insn "*boolccsi3_internal1"
3344 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3345 (match_operator:SI 3 "boolean_operator"
3346 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
3347 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))]))]
3351 (define_insn "*boolccsi3_internal2"
3352 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3353 (compare:CC (match_operator:SI 4 "boolean_operator"
3354 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
3355 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
3357 (clobber (match_scratch:SI 3 "=r,r"))]
3362 [(set_attr "type" "logical,compare")
3363 (set_attr "dot" "yes")
3364 (set_attr "length" "4,8")])
3367 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3368 (compare:CC (match_operator:SI 4 "boolean_operator"
3369 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3370 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
3372 (clobber (match_scratch:SI 3 ""))]
3373 "TARGET_32BIT && reload_completed"
3374 [(set (match_dup 3) (match_dup 4))
3376 (compare:CC (match_dup 3)
3380 (define_insn "*boolccsi3_internal3"
3381 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3382 (compare:CC (match_operator:SI 4 "boolean_operator"
3383 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
3384 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
3386 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3392 [(set_attr "type" "logical,compare")
3393 (set_attr "dot" "yes")
3394 (set_attr "length" "4,8")])
3397 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3398 (compare:CC (match_operator:SI 4 "boolean_operator"
3399 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3400 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
3402 (set (match_operand:SI 0 "gpc_reg_operand" "")
3404 "TARGET_32BIT && reload_completed"
3405 [(set (match_dup 0) (match_dup 4))
3407 (compare:CC (match_dup 0)
3411 ;; Rotate and shift insns, in all their variants. These support shifts,
3412 ;; field inserts and extracts, and various combinations thereof.
3413 (define_expand "insv"
3414 [(set (zero_extract (match_operand 0 "gpc_reg_operand" "")
3415 (match_operand:SI 1 "const_int_operand" "")
3416 (match_operand:SI 2 "const_int_operand" ""))
3417 (match_operand 3 "gpc_reg_operand" ""))]
3421 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3422 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3423 compiler if the address of the structure is taken later. Likewise, do
3424 not handle invalid E500 subregs. */
3425 if (GET_CODE (operands[0]) == SUBREG
3426 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD
3427 || ((TARGET_E500_DOUBLE || TARGET_SPE)
3428 && invalid_e500_subreg (operands[0], GET_MODE (operands[0])))))
3431 if (TARGET_POWERPC64 && GET_MODE (operands[0]) == DImode)
3432 emit_insn (gen_insvdi_internal (operands[0], operands[1], operands[2],
3435 emit_insn (gen_insvsi_internal (operands[0], operands[1], operands[2],
3440 (define_insn "insvsi_internal"
3441 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3442 (match_operand:SI 1 "const_int_operand" "i")
3443 (match_operand:SI 2 "const_int_operand" "i"))
3444 (match_operand:SI 3 "gpc_reg_operand" "r"))]
3448 int start = INTVAL (operands[2]) & 31;
3449 int size = INTVAL (operands[1]) & 31;
3451 operands[4] = GEN_INT (32 - start - size);
3452 operands[1] = GEN_INT (start + size - 1);
3453 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3455 [(set_attr "type" "insert")])
3457 (define_insn "*insvsi_internal1"
3458 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3459 (match_operand:SI 1 "const_int_operand" "i")
3460 (match_operand:SI 2 "const_int_operand" "i"))
3461 (rotate:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3462 (match_operand:SI 4 "const_int_operand" "i")))]
3463 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3466 int shift = INTVAL (operands[4]) & 31;
3467 int start = INTVAL (operands[2]) & 31;
3468 int size = INTVAL (operands[1]) & 31;
3470 operands[4] = GEN_INT (shift - start - size);
3471 operands[1] = GEN_INT (start + size - 1);
3472 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3474 [(set_attr "type" "insert")])
3476 (define_insn "*insvsi_internal2"
3477 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3478 (match_operand:SI 1 "const_int_operand" "i")
3479 (match_operand:SI 2 "const_int_operand" "i"))
3480 (ashiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3481 (match_operand:SI 4 "const_int_operand" "i")))]
3482 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3485 int shift = INTVAL (operands[4]) & 31;
3486 int start = INTVAL (operands[2]) & 31;
3487 int size = INTVAL (operands[1]) & 31;
3489 operands[4] = GEN_INT (32 - shift - start - size);
3490 operands[1] = GEN_INT (start + size - 1);
3491 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3493 [(set_attr "type" "insert")])
3495 (define_insn "*insvsi_internal3"
3496 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3497 (match_operand:SI 1 "const_int_operand" "i")
3498 (match_operand:SI 2 "const_int_operand" "i"))
3499 (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3500 (match_operand:SI 4 "const_int_operand" "i")))]
3501 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3504 int shift = INTVAL (operands[4]) & 31;
3505 int start = INTVAL (operands[2]) & 31;
3506 int size = INTVAL (operands[1]) & 31;
3508 operands[4] = GEN_INT (32 - shift - start - size);
3509 operands[1] = GEN_INT (start + size - 1);
3510 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3512 [(set_attr "type" "insert")])
3514 (define_insn "*insvsi_internal4"
3515 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3516 (match_operand:SI 1 "const_int_operand" "i")
3517 (match_operand:SI 2 "const_int_operand" "i"))
3518 (zero_extract:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3519 (match_operand:SI 4 "const_int_operand" "i")
3520 (match_operand:SI 5 "const_int_operand" "i")))]
3521 "INTVAL (operands[4]) >= INTVAL (operands[1])"
3524 int extract_start = INTVAL (operands[5]) & 31;
3525 int extract_size = INTVAL (operands[4]) & 31;
3526 int insert_start = INTVAL (operands[2]) & 31;
3527 int insert_size = INTVAL (operands[1]) & 31;
3529 /* Align extract field with insert field */
3530 operands[5] = GEN_INT (extract_start + extract_size - insert_start - insert_size);
3531 operands[1] = GEN_INT (insert_start + insert_size - 1);
3532 return \"rlwimi %0,%3,%h5,%h2,%h1\";
3534 [(set_attr "type" "insert")])
3536 ;; combine patterns for rlwimi
3537 (define_insn "*insvsi_internal5"
3538 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3539 (ior:SI (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
3540 (match_operand:SI 1 "mask_operand" "i"))
3541 (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3542 (match_operand:SI 2 "const_int_operand" "i"))
3543 (match_operand:SI 5 "mask_operand" "i"))))]
3544 "INTVAL(operands[1]) == ~INTVAL(operands[5])"
3547 int me = extract_ME(operands[5]);
3548 int mb = extract_MB(operands[5]);
3549 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
3550 operands[2] = GEN_INT(mb);
3551 operands[1] = GEN_INT(me);
3552 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3554 [(set_attr "type" "insert")])
3556 (define_insn "*insvsi_internal6"
3557 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3558 (ior:SI (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3559 (match_operand:SI 2 "const_int_operand" "i"))
3560 (match_operand:SI 5 "mask_operand" "i"))
3561 (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
3562 (match_operand:SI 1 "mask_operand" "i"))))]
3563 "INTVAL(operands[1]) == ~INTVAL(operands[5])"
3566 int me = extract_ME(operands[5]);
3567 int mb = extract_MB(operands[5]);
3568 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
3569 operands[2] = GEN_INT(mb);
3570 operands[1] = GEN_INT(me);
3571 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3573 [(set_attr "type" "insert")])
3575 (define_insn "insvdi_internal"
3576 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3577 (match_operand:SI 1 "const_int_operand" "i")
3578 (match_operand:SI 2 "const_int_operand" "i"))
3579 (match_operand:DI 3 "gpc_reg_operand" "r"))]
3583 int start = INTVAL (operands[2]) & 63;
3584 int size = INTVAL (operands[1]) & 63;
3586 operands[1] = GEN_INT (64 - start - size);
3587 return \"rldimi %0,%3,%H1,%H2\";
3589 [(set_attr "type" "insert")
3590 (set_attr "size" "64")])
3592 (define_insn "*insvdi_internal2"
3593 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3594 (match_operand:SI 1 "const_int_operand" "i")
3595 (match_operand:SI 2 "const_int_operand" "i"))
3596 (ashiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
3597 (match_operand:SI 4 "const_int_operand" "i")))]
3599 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
3602 int shift = INTVAL (operands[4]) & 63;
3603 int start = (INTVAL (operands[2]) & 63) - 32;
3604 int size = INTVAL (operands[1]) & 63;
3606 operands[4] = GEN_INT (64 - shift - start - size);
3607 operands[2] = GEN_INT (start);
3608 operands[1] = GEN_INT (start + size - 1);
3609 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3612 (define_insn "*insvdi_internal3"
3613 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3614 (match_operand:SI 1 "const_int_operand" "i")
3615 (match_operand:SI 2 "const_int_operand" "i"))
3616 (lshiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
3617 (match_operand:SI 4 "const_int_operand" "i")))]
3619 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
3622 int shift = INTVAL (operands[4]) & 63;
3623 int start = (INTVAL (operands[2]) & 63) - 32;
3624 int size = INTVAL (operands[1]) & 63;
3626 operands[4] = GEN_INT (64 - shift - start - size);
3627 operands[2] = GEN_INT (start);
3628 operands[1] = GEN_INT (start + size - 1);
3629 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3632 (define_expand "extzv"
3633 [(set (match_operand 0 "gpc_reg_operand" "")
3634 (zero_extract (match_operand 1 "gpc_reg_operand" "")
3635 (match_operand:SI 2 "const_int_operand" "")
3636 (match_operand:SI 3 "const_int_operand" "")))]
3640 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3641 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3642 compiler if the address of the structure is taken later. */
3643 if (GET_CODE (operands[0]) == SUBREG
3644 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
3647 if (TARGET_POWERPC64 && GET_MODE (operands[1]) == DImode)
3648 emit_insn (gen_extzvdi_internal (operands[0], operands[1], operands[2],
3651 emit_insn (gen_extzvsi_internal (operands[0], operands[1], operands[2],
3656 (define_insn "extzvsi_internal"
3657 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3658 (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3659 (match_operand:SI 2 "const_int_operand" "i")
3660 (match_operand:SI 3 "const_int_operand" "i")))]
3664 int start = INTVAL (operands[3]) & 31;
3665 int size = INTVAL (operands[2]) & 31;
3667 if (start + size >= 32)
3668 operands[3] = const0_rtx;
3670 operands[3] = GEN_INT (start + size);
3671 return \"rlwinm %0,%1,%3,%s2,31\";
3673 [(set_attr "type" "shift")])
3675 (define_insn "*extzvsi_internal1"
3676 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3677 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3678 (match_operand:SI 2 "const_int_operand" "i,i")
3679 (match_operand:SI 3 "const_int_operand" "i,i"))
3681 (clobber (match_scratch:SI 4 "=r,r"))]
3685 int start = INTVAL (operands[3]) & 31;
3686 int size = INTVAL (operands[2]) & 31;
3688 /* Force split for non-cc0 compare. */
3689 if (which_alternative == 1)
3692 /* If the bit-field being tested fits in the upper or lower half of a
3693 word, it is possible to use andiu. or andil. to test it. This is
3694 useful because the condition register set-use delay is smaller for
3695 andi[ul]. than for rlinm. This doesn't work when the starting bit
3696 position is 0 because the LT and GT bits may be set wrong. */
3698 if ((start > 0 && start + size <= 16) || start >= 16)
3700 operands[3] = GEN_INT (((1 << (16 - (start & 15)))
3701 - (1 << (16 - (start & 15) - size))));
3703 return \"andis. %4,%1,%3\";
3705 return \"andi. %4,%1,%3\";
3708 if (start + size >= 32)
3709 operands[3] = const0_rtx;
3711 operands[3] = GEN_INT (start + size);
3712 return \"rlwinm. %4,%1,%3,%s2,31\";
3714 [(set_attr "type" "shift")
3715 (set_attr "dot" "yes")
3716 (set_attr "length" "4,8")])
3719 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3720 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3721 (match_operand:SI 2 "const_int_operand" "")
3722 (match_operand:SI 3 "const_int_operand" ""))
3724 (clobber (match_scratch:SI 4 ""))]
3727 (zero_extract:SI (match_dup 1) (match_dup 2)
3730 (compare:CC (match_dup 4)
3734 (define_insn "*extzvsi_internal2"
3735 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3736 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3737 (match_operand:SI 2 "const_int_operand" "i,i")
3738 (match_operand:SI 3 "const_int_operand" "i,i"))
3740 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3741 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3745 int start = INTVAL (operands[3]) & 31;
3746 int size = INTVAL (operands[2]) & 31;
3748 /* Force split for non-cc0 compare. */
3749 if (which_alternative == 1)
3752 /* Since we are using the output value, we can't ignore any need for
3753 a shift. The bit-field must end at the LSB. */
3754 if (start >= 16 && start + size == 32)
3756 operands[3] = GEN_INT ((1 << size) - 1);
3757 return \"andi. %0,%1,%3\";
3760 if (start + size >= 32)
3761 operands[3] = const0_rtx;
3763 operands[3] = GEN_INT (start + size);
3764 return \"rlwinm. %0,%1,%3,%s2,31\";
3766 [(set_attr "type" "shift")
3767 (set_attr "dot" "yes")
3768 (set_attr "length" "4,8")])
3771 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
3772 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3773 (match_operand:SI 2 "const_int_operand" "")
3774 (match_operand:SI 3 "const_int_operand" ""))
3776 (set (match_operand:SI 0 "gpc_reg_operand" "")
3777 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3780 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))
3782 (compare:CC (match_dup 0)
3786 (define_insn "extzvdi_internal"
3787 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
3788 (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3789 (match_operand:SI 2 "const_int_operand" "i")
3790 (match_operand:SI 3 "const_int_operand" "i")))]
3794 int start = INTVAL (operands[3]) & 63;
3795 int size = INTVAL (operands[2]) & 63;
3797 if (start + size >= 64)
3798 operands[3] = const0_rtx;
3800 operands[3] = GEN_INT (start + size);
3801 operands[2] = GEN_INT (64 - size);
3802 return \"rldicl %0,%1,%3,%2\";
3804 [(set_attr "type" "shift")])
3806 (define_insn "*extzvdi_internal1"
3807 [(set (match_operand:CC 0 "gpc_reg_operand" "=x")
3808 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3809 (match_operand:SI 2 "const_int_operand" "i")
3810 (match_operand:SI 3 "const_int_operand" "i"))
3812 (clobber (match_scratch:DI 4 "=r"))]
3813 "TARGET_64BIT && rs6000_gen_cell_microcode"
3816 int start = INTVAL (operands[3]) & 63;
3817 int size = INTVAL (operands[2]) & 63;
3819 if (start + size >= 64)
3820 operands[3] = const0_rtx;
3822 operands[3] = GEN_INT (start + size);
3823 operands[2] = GEN_INT (64 - size);
3824 return \"rldicl. %4,%1,%3,%2\";
3826 [(set_attr "type" "shift")
3827 (set_attr "dot" "yes")])
3829 (define_insn "*extzvdi_internal2"
3830 [(set (match_operand:CC 4 "gpc_reg_operand" "=x")
3831 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3832 (match_operand:SI 2 "const_int_operand" "i")
3833 (match_operand:SI 3 "const_int_operand" "i"))
3835 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
3836 (zero_extract:DI (match_dup 1) (match_dup 2) (match_dup 3)))]
3837 "TARGET_64BIT && rs6000_gen_cell_microcode"
3840 int start = INTVAL (operands[3]) & 63;
3841 int size = INTVAL (operands[2]) & 63;
3843 if (start + size >= 64)
3844 operands[3] = const0_rtx;
3846 operands[3] = GEN_INT (start + size);
3847 operands[2] = GEN_INT (64 - size);
3848 return \"rldicl. %0,%1,%3,%2\";
3850 [(set_attr "type" "shift")
3851 (set_attr "dot" "yes")])
3853 (define_insn "rotlsi3"
3854 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3855 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3856 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
3859 rlwnm %0,%1,%2,0xffffffff
3860 rlwinm %0,%1,%h2,0xffffffff"
3861 [(set_attr "type" "shift")
3862 (set_attr "var_shift" "yes,no")])
3864 (define_insn "*rotlsi3_64"
3865 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
3867 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3868 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))))]
3871 rlwnm %0,%1,%2,0xffffffff
3872 rlwinm %0,%1,%h2,0xffffffff"
3873 [(set_attr "type" "shift")
3874 (set_attr "var_shift" "yes,no")])
3876 (define_insn "*rotlsi3_internal2"
3877 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3878 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3879 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3881 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
3884 rlwnm. %3,%1,%2,0xffffffff
3885 rlwinm. %3,%1,%h2,0xffffffff
3888 [(set_attr "type" "shift")
3889 (set_attr "var_shift" "yes,no,yes,no")
3890 (set_attr "dot" "yes")
3891 (set_attr "length" "4,4,8,8")])
3894 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3895 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3896 (match_operand:SI 2 "reg_or_cint_operand" ""))
3898 (clobber (match_scratch:SI 3 ""))]
3901 (rotate:SI (match_dup 1) (match_dup 2)))
3903 (compare:CC (match_dup 3)
3907 (define_insn "*rotlsi3_internal3"
3908 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
3909 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3910 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3912 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
3913 (rotate:SI (match_dup 1) (match_dup 2)))]
3916 rlwnm. %0,%1,%2,0xffffffff
3917 rlwinm. %0,%1,%h2,0xffffffff
3920 [(set_attr "type" "shift")
3921 (set_attr "var_shift" "yes,no,yes,no")
3922 (set_attr "dot" "yes")
3923 (set_attr "length" "4,4,8,8")])
3926 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3927 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3928 (match_operand:SI 2 "reg_or_cint_operand" ""))
3930 (set (match_operand:SI 0 "gpc_reg_operand" "")
3931 (rotate:SI (match_dup 1) (match_dup 2)))]
3934 (rotate:SI (match_dup 1) (match_dup 2)))
3936 (compare:CC (match_dup 0)
3940 (define_insn "*rotlsi3_internal4"
3941 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3942 (and:SI (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3943 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
3944 (match_operand:SI 3 "mask_operand" "n,n")))]
3947 rlwnm %0,%1,%2,%m3,%M3
3948 rlwinm %0,%1,%h2,%m3,%M3"
3949 [(set_attr "type" "shift")
3950 (set_attr "var_shift" "yes,no")])
3952 (define_insn "*rotlsi3_internal5"
3953 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3955 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3956 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3957 (match_operand:SI 3 "mask_operand" "n,n,n,n"))
3959 (clobber (match_scratch:SI 4 "=r,r,r,r"))]
3962 rlwnm. %4,%1,%2,%m3,%M3
3963 rlwinm. %4,%1,%h2,%m3,%M3
3966 [(set_attr "type" "shift")
3967 (set_attr "var_shift" "yes,no,yes,no")
3968 (set_attr "dot" "yes")
3969 (set_attr "length" "4,4,8,8")])
3972 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3974 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3975 (match_operand:SI 2 "reg_or_cint_operand" ""))
3976 (match_operand:SI 3 "mask_operand" ""))
3978 (clobber (match_scratch:SI 4 ""))]
3981 (and:SI (rotate:SI (match_dup 1)
3985 (compare:CC (match_dup 4)
3989 (define_insn "*rotlsi3_internal6"
3990 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
3992 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3993 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3994 (match_operand:SI 3 "mask_operand" "n,n,n,n"))
3996 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
3997 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4000 rlwnm. %0,%1,%2,%m3,%M3
4001 rlwinm. %0,%1,%h2,%m3,%M3
4004 [(set_attr "type" "shift")
4005 (set_attr "var_shift" "yes,no,yes,no")
4006 (set_attr "dot" "yes")
4007 (set_attr "length" "4,4,8,8")])
4010 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
4012 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4013 (match_operand:SI 2 "reg_or_cint_operand" ""))
4014 (match_operand:SI 3 "mask_operand" ""))
4016 (set (match_operand:SI 0 "gpc_reg_operand" "")
4017 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4020 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4022 (compare:CC (match_dup 0)
4026 (define_insn "*rotlsi3_internal7le"
4027 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4030 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4031 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
4033 "rlw%I2nm %0,%1,%h2,0xff"
4034 [(set (attr "cell_micro")
4035 (if_then_else (match_operand:SI 2 "const_int_operand" "")
4036 (const_string "not")
4037 (const_string "always")))
4038 (set_attr "type" "shift")])
4040 (define_insn "*rotlsi3_internal7be"
4041 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4044 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4045 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 3)))]
4047 "rlw%I2nm %0,%1,%h2,0xff"
4048 [(set (attr "cell_micro")
4049 (if_then_else (match_operand:SI 2 "const_int_operand" "")
4050 (const_string "not")
4051 (const_string "always")))
4052 (set_attr "type" "shift")])
4054 (define_insn "*rotlsi3_internal8le"
4055 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4056 (compare:CC (zero_extend:SI
4058 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4059 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4061 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4064 rlwnm. %3,%1,%2,0xff
4065 rlwinm. %3,%1,%h2,0xff
4068 [(set_attr "type" "shift")
4069 (set_attr "var_shift" "yes,no,yes,no")
4070 (set_attr "dot" "yes")
4071 (set_attr "length" "4,4,8,8")])
4073 (define_insn "*rotlsi3_internal8be"
4074 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4075 (compare:CC (zero_extend:SI
4077 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4078 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 3))
4080 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4083 rlwnm. %3,%1,%2,0xff
4084 rlwinm. %3,%1,%h2,0xff
4087 [(set_attr "type" "shift")
4088 (set_attr "var_shift" "yes,no,yes,no")
4089 (set_attr "dot" "yes")
4090 (set_attr "length" "4,4,8,8")])
4093 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4094 (compare:CC (zero_extend:SI
4096 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4097 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4099 (clobber (match_scratch:SI 3 ""))]
4100 "!BYTES_BIG_ENDIAN && reload_completed"
4102 (zero_extend:SI (subreg:QI
4103 (rotate:SI (match_dup 1)
4106 (compare:CC (match_dup 3)
4111 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4112 (compare:CC (zero_extend:SI
4114 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4115 (match_operand:SI 2 "reg_or_cint_operand" "")) 3))
4117 (clobber (match_scratch:SI 3 ""))]
4118 "BYTES_BIG_ENDIAN && reload_completed"
4120 (zero_extend:SI (subreg:QI
4121 (rotate:SI (match_dup 1)
4124 (compare:CC (match_dup 3)
4128 (define_insn "*rotlsi3_internal9le"
4129 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4130 (compare:CC (zero_extend:SI
4132 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4133 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4135 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4136 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4139 rlwnm. %0,%1,%2,0xff
4140 rlwinm. %0,%1,%h2,0xff
4143 [(set_attr "type" "shift")
4144 (set_attr "var_shift" "yes,no,yes,no")
4145 (set_attr "dot" "yes")
4146 (set_attr "length" "4,4,8,8")])
4148 (define_insn "*rotlsi3_internal9be"
4149 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4150 (compare:CC (zero_extend:SI
4152 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4153 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 3))
4155 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4156 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 3)))]
4159 rlwnm. %0,%1,%2,0xff
4160 rlwinm. %0,%1,%h2,0xff
4163 [(set_attr "type" "shift")
4164 (set_attr "var_shift" "yes,no,yes,no")
4165 (set_attr "dot" "yes")
4166 (set_attr "length" "4,4,8,8")])
4169 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4170 (compare:CC (zero_extend:SI
4172 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4173 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4175 (set (match_operand:SI 0 "gpc_reg_operand" "")
4176 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4177 "!BYTES_BIG_ENDIAN && reload_completed"
4179 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
4181 (compare:CC (match_dup 0)
4186 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4187 (compare:CC (zero_extend:SI
4189 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4190 (match_operand:SI 2 "reg_or_cint_operand" "")) 3))
4192 (set (match_operand:SI 0 "gpc_reg_operand" "")
4193 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 3)))]
4194 "BYTES_BIG_ENDIAN && reload_completed"
4196 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 3)))
4198 (compare:CC (match_dup 0)
4202 (define_insn "*rotlsi3_internal10le"
4203 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4206 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4207 (match_operand:SI 2 "reg_or_cint_operand" "r,i")) 0)))]
4210 rlwnm %0,%1,%2,0xffff
4211 rlwinm %0,%1,%h2,0xffff"
4212 [(set_attr "type" "shift")
4213 (set_attr "var_shift" "yes,no")])
4215 (define_insn "*rotlsi3_internal10be"
4216 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4219 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4220 (match_operand:SI 2 "reg_or_cint_operand" "r,i")) 2)))]
4223 rlwnm %0,%1,%2,0xffff
4224 rlwinm %0,%1,%h2,0xffff"
4225 [(set_attr "type" "shift")
4226 (set_attr "var_shift" "yes,no")])
4228 (define_insn "*rotlsi3_internal11le"
4229 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4230 (compare:CC (zero_extend:SI
4232 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4233 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4235 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4238 rlwnm. %3,%1,%2,0xffff
4239 rlwinm. %3,%1,%h2,0xffff
4242 [(set_attr "type" "shift")
4243 (set_attr "var_shift" "yes,no,yes,no")
4244 (set_attr "dot" "yes")
4245 (set_attr "length" "4,4,8,8")])
4247 (define_insn "*rotlsi3_internal11be"
4248 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4249 (compare:CC (zero_extend:SI
4251 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4252 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 2))
4254 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4257 rlwnm. %3,%1,%2,0xffff
4258 rlwinm. %3,%1,%h2,0xffff
4261 [(set_attr "type" "shift")
4262 (set_attr "var_shift" "yes,no,yes,no")
4263 (set_attr "dot" "yes")
4264 (set_attr "length" "4,4,8,8")])
4267 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4268 (compare:CC (zero_extend:SI
4270 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4271 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4273 (clobber (match_scratch:SI 3 ""))]
4274 "!BYTES_BIG_ENDIAN && reload_completed"
4276 (zero_extend:SI (subreg:HI
4277 (rotate:SI (match_dup 1)
4280 (compare:CC (match_dup 3)
4285 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4286 (compare:CC (zero_extend:SI
4288 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4289 (match_operand:SI 2 "reg_or_cint_operand" "")) 2))
4291 (clobber (match_scratch:SI 3 ""))]
4292 "BYTES_BIG_ENDIAN && reload_completed"
4294 (zero_extend:SI (subreg:HI
4295 (rotate:SI (match_dup 1)
4298 (compare:CC (match_dup 3)
4302 (define_insn "*rotlsi3_internal12le"
4303 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4304 (compare:CC (zero_extend:SI
4306 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4307 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4309 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4310 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4313 rlwnm. %0,%1,%2,0xffff
4314 rlwinm. %0,%1,%h2,0xffff
4317 [(set_attr "type" "shift")
4318 (set_attr "var_shift" "yes,no,yes,no")
4319 (set_attr "dot" "yes")
4320 (set_attr "length" "4,4,8,8")])
4322 (define_insn "*rotlsi3_internal12be"
4323 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4324 (compare:CC (zero_extend:SI
4326 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4327 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 2))
4329 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4330 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 2)))]
4333 rlwnm. %0,%1,%2,0xffff
4334 rlwinm. %0,%1,%h2,0xffff
4337 [(set_attr "type" "shift")
4338 (set_attr "var_shift" "yes,no,yes,no")
4339 (set_attr "dot" "yes")
4340 (set_attr "length" "4,4,8,8")])
4343 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4344 (compare:CC (zero_extend:SI
4346 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4347 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4349 (set (match_operand:SI 0 "gpc_reg_operand" "")
4350 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4351 "!BYTES_BIG_ENDIAN && reload_completed"
4353 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
4355 (compare:CC (match_dup 0)
4360 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4361 (compare:CC (zero_extend:SI
4363 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4364 (match_operand:SI 2 "reg_or_cint_operand" "")) 2))
4366 (set (match_operand:SI 0 "gpc_reg_operand" "")
4367 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 2)))]
4368 "BYTES_BIG_ENDIAN && reload_completed"
4370 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 2)))
4372 (compare:CC (match_dup 0)
4376 (define_insn "ashlsi3"
4377 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4378 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4379 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
4384 [(set_attr "type" "shift")
4385 (set_attr "var_shift" "yes,no")])
4387 (define_insn "*ashlsi3_64"
4388 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
4390 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4391 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))))]
4396 [(set_attr "type" "shift")
4397 (set_attr "var_shift" "yes,no")])
4400 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4401 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4402 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4404 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4411 [(set_attr "type" "shift")
4412 (set_attr "var_shift" "yes,no,yes,no")
4413 (set_attr "dot" "yes")
4414 (set_attr "length" "4,4,8,8")])
4417 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4418 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4419 (match_operand:SI 2 "reg_or_cint_operand" ""))
4421 (clobber (match_scratch:SI 3 ""))]
4422 "TARGET_32BIT && reload_completed"
4424 (ashift:SI (match_dup 1) (match_dup 2)))
4426 (compare:CC (match_dup 3)
4431 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4432 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4433 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4435 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4436 (ashift:SI (match_dup 1) (match_dup 2)))]
4443 [(set_attr "type" "shift")
4444 (set_attr "var_shift" "yes,no,yes,no")
4445 (set_attr "dot" "yes")
4446 (set_attr "length" "4,4,8,8")])
4449 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4450 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4451 (match_operand:SI 2 "reg_or_cint_operand" ""))
4453 (set (match_operand:SI 0 "gpc_reg_operand" "")
4454 (ashift:SI (match_dup 1) (match_dup 2)))]
4455 "TARGET_32BIT && reload_completed"
4457 (ashift:SI (match_dup 1) (match_dup 2)))
4459 (compare:CC (match_dup 0)
4463 (define_insn "rlwinm"
4464 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4465 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4466 (match_operand:SI 2 "const_int_operand" "i"))
4467 (match_operand:SI 3 "mask_operand" "n")))]
4468 "includes_lshift_p (operands[2], operands[3])"
4469 "rlwinm %0,%1,%h2,%m3,%M3"
4470 [(set_attr "type" "shift")])
4473 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4475 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4476 (match_operand:SI 2 "const_int_operand" "i,i"))
4477 (match_operand:SI 3 "mask_operand" "n,n"))
4479 (clobber (match_scratch:SI 4 "=r,r"))]
4480 "includes_lshift_p (operands[2], operands[3])"
4482 rlwinm. %4,%1,%h2,%m3,%M3
4484 [(set_attr "type" "shift")
4485 (set_attr "dot" "yes")
4486 (set_attr "length" "4,8")])
4489 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4491 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4492 (match_operand:SI 2 "const_int_operand" ""))
4493 (match_operand:SI 3 "mask_operand" ""))
4495 (clobber (match_scratch:SI 4 ""))]
4496 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
4498 (and:SI (ashift:SI (match_dup 1) (match_dup 2))
4501 (compare:CC (match_dup 4)
4506 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4508 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4509 (match_operand:SI 2 "const_int_operand" "i,i"))
4510 (match_operand:SI 3 "mask_operand" "n,n"))
4512 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4513 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4514 "includes_lshift_p (operands[2], operands[3])"
4516 rlwinm. %0,%1,%h2,%m3,%M3
4518 [(set_attr "type" "shift")
4519 (set_attr "dot" "yes")
4520 (set_attr "length" "4,8")])
4523 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
4525 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4526 (match_operand:SI 2 "const_int_operand" ""))
4527 (match_operand:SI 3 "mask_operand" ""))
4529 (set (match_operand:SI 0 "gpc_reg_operand" "")
4530 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4531 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
4533 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4535 (compare:CC (match_dup 0)
4539 (define_insn "lshrsi3"
4540 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
4541 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
4542 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i")))]
4548 [(set_attr "type" "integer,shift,shift")
4549 (set_attr "var_shift" "no,yes,no")])
4551 (define_insn "*lshrsi3_64"
4552 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
4554 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4555 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))))]
4560 [(set_attr "type" "shift")
4561 (set_attr "var_shift" "yes,no")])
4564 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,?y,?y,?y")
4565 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
4566 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i,O,r,i"))
4568 (clobber (match_scratch:SI 3 "=X,r,r,X,r,r"))]
4577 [(set_attr "type" "logical,shift,shift,shift,shift,shift")
4578 (set_attr "var_shift" "no,yes,no,no,yes,no")
4579 (set_attr "dot" "yes")
4580 (set_attr "length" "4,4,4,8,8,8")])
4583 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4584 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4585 (match_operand:SI 2 "reg_or_cint_operand" ""))
4587 (clobber (match_scratch:SI 3 ""))]
4588 "TARGET_32BIT && reload_completed"
4590 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4592 (compare:CC (match_dup 3)
4597 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,?y,?y,?y")
4598 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
4599 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i,O,r,i"))
4601 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
4602 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
4611 [(set_attr "type" "logical,shift,shift,shift,shift,shift")
4612 (set_attr "var_shift" "no,yes,no,no,yes,no")
4613 (set_attr "dot" "yes")
4614 (set_attr "length" "4,4,4,8,8,8")])
4617 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4618 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4619 (match_operand:SI 2 "reg_or_cint_operand" ""))
4621 (set (match_operand:SI 0 "gpc_reg_operand" "")
4622 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
4623 "TARGET_32BIT && reload_completed"
4625 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4627 (compare:CC (match_dup 0)
4632 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4633 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4634 (match_operand:SI 2 "const_int_operand" "i"))
4635 (match_operand:SI 3 "mask_operand" "n")))]
4636 "includes_rshift_p (operands[2], operands[3])"
4637 "rlwinm %0,%1,%s2,%m3,%M3"
4638 [(set_attr "type" "shift")])
4641 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4643 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4644 (match_operand:SI 2 "const_int_operand" "i,i"))
4645 (match_operand:SI 3 "mask_operand" "n,n"))
4647 (clobber (match_scratch:SI 4 "=r,r"))]
4648 "includes_rshift_p (operands[2], operands[3])"
4650 rlwinm. %4,%1,%s2,%m3,%M3
4652 [(set_attr "type" "shift")
4653 (set_attr "dot" "yes")
4654 (set_attr "length" "4,8")])
4657 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4659 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4660 (match_operand:SI 2 "const_int_operand" ""))
4661 (match_operand:SI 3 "mask_operand" ""))
4663 (clobber (match_scratch:SI 4 ""))]
4664 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
4666 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2))
4669 (compare:CC (match_dup 4)
4674 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4676 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4677 (match_operand:SI 2 "const_int_operand" "i,i"))
4678 (match_operand:SI 3 "mask_operand" "n,n"))
4680 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4681 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4682 "includes_rshift_p (operands[2], operands[3])"
4684 rlwinm. %0,%1,%s2,%m3,%M3
4686 [(set_attr "type" "shift")
4687 (set_attr "dot" "yes")
4688 (set_attr "length" "4,8")])
4691 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
4693 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4694 (match_operand:SI 2 "const_int_operand" ""))
4695 (match_operand:SI 3 "mask_operand" ""))
4697 (set (match_operand:SI 0 "gpc_reg_operand" "")
4698 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4699 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
4701 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4703 (compare:CC (match_dup 0)
4707 (define_insn "*lshiftrt_internal1le"
4708 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4711 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4712 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4713 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255))"
4714 "rlwinm %0,%1,%s2,0xff"
4715 [(set_attr "type" "shift")])
4717 (define_insn "*lshiftrt_internal1be"
4718 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4721 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4722 (match_operand:SI 2 "const_int_operand" "i")) 3)))]
4723 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255))"
4724 "rlwinm %0,%1,%s2,0xff"
4725 [(set_attr "type" "shift")])
4727 (define_insn "*lshiftrt_internal2le"
4728 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4732 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4733 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4735 (clobber (match_scratch:SI 3 "=r,r"))]
4736 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255))"
4738 rlwinm. %3,%1,%s2,0xff
4740 [(set_attr "type" "shift")
4741 (set_attr "dot" "yes")
4742 (set_attr "length" "4,8")])
4744 (define_insn "*lshiftrt_internal2be"
4745 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4749 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4750 (match_operand:SI 2 "const_int_operand" "i,i")) 3))
4752 (clobber (match_scratch:SI 3 "=r,r"))]
4753 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255))"
4755 rlwinm. %3,%1,%s2,0xff
4757 [(set_attr "type" "shift")
4758 (set_attr "dot" "yes")
4759 (set_attr "length" "4,8")])
4762 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4766 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4767 (match_operand:SI 2 "const_int_operand" "")) 0))
4769 (clobber (match_scratch:SI 3 ""))]
4770 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4772 (zero_extend:SI (subreg:QI
4773 (lshiftrt:SI (match_dup 1)
4776 (compare:CC (match_dup 3)
4781 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4785 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4786 (match_operand:SI 2 "const_int_operand" "")) 3))
4788 (clobber (match_scratch:SI 3 ""))]
4789 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4791 (zero_extend:SI (subreg:QI
4792 (lshiftrt:SI (match_dup 1)
4795 (compare:CC (match_dup 3)
4799 (define_insn "*lshiftrt_internal3le"
4800 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4804 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4805 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4807 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4808 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4809 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255))"
4811 rlwinm. %0,%1,%s2,0xff
4813 [(set_attr "type" "shift")
4814 (set_attr "dot" "yes")
4815 (set_attr "length" "4,8")])
4817 (define_insn "*lshiftrt_internal3be"
4818 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4822 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4823 (match_operand:SI 2 "const_int_operand" "i,i")) 3))
4825 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4826 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 3)))]
4827 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255))"
4829 rlwinm. %0,%1,%s2,0xff
4831 [(set_attr "type" "shift")
4832 (set_attr "dot" "yes")
4833 (set_attr "length" "4,8")])
4836 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4840 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4841 (match_operand:SI 2 "const_int_operand" "")) 0))
4843 (set (match_operand:SI 0 "gpc_reg_operand" "")
4844 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4845 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4847 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4849 (compare:CC (match_dup 0)
4854 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4858 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4859 (match_operand:SI 2 "const_int_operand" "")) 3))
4861 (set (match_operand:SI 0 "gpc_reg_operand" "")
4862 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 3)))]
4863 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4865 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 3)))
4867 (compare:CC (match_dup 0)
4871 (define_insn "*lshiftrt_internal4le"
4872 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4875 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4876 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4877 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535))"
4878 "rlwinm %0,%1,%s2,0xffff"
4879 [(set_attr "type" "shift")])
4881 (define_insn "*lshiftrt_internal4be"
4882 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4885 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4886 (match_operand:SI 2 "const_int_operand" "i")) 2)))]
4887 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535))"
4888 "rlwinm %0,%1,%s2,0xffff"
4889 [(set_attr "type" "shift")])
4891 (define_insn "*lshiftrt_internal5le"
4892 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4896 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4897 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4899 (clobber (match_scratch:SI 3 "=r,r"))]
4900 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535))"
4902 rlwinm. %3,%1,%s2,0xffff
4904 [(set_attr "type" "shift")
4905 (set_attr "dot" "yes")
4906 (set_attr "length" "4,8")])
4908 (define_insn "*lshiftrt_internal5be"
4909 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4913 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4914 (match_operand:SI 2 "const_int_operand" "i,i")) 2))
4916 (clobber (match_scratch:SI 3 "=r,r"))]
4917 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535))"
4919 rlwinm. %3,%1,%s2,0xffff
4921 [(set_attr "type" "shift")
4922 (set_attr "dot" "yes")
4923 (set_attr "length" "4,8")])
4926 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4930 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4931 (match_operand:SI 2 "const_int_operand" "")) 0))
4933 (clobber (match_scratch:SI 3 ""))]
4934 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4936 (zero_extend:SI (subreg:HI
4937 (lshiftrt:SI (match_dup 1)
4940 (compare:CC (match_dup 3)
4945 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4949 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4950 (match_operand:SI 2 "const_int_operand" "")) 2))
4952 (clobber (match_scratch:SI 3 ""))]
4953 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4955 (zero_extend:SI (subreg:HI
4956 (lshiftrt:SI (match_dup 1)
4959 (compare:CC (match_dup 3)
4963 (define_insn "*lshiftrt_internal5le"
4964 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4968 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4969 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4971 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4972 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4973 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535))"
4975 rlwinm. %0,%1,%s2,0xffff
4977 [(set_attr "type" "shift")
4978 (set_attr "dot" "yes")
4979 (set_attr "length" "4,8")])
4981 (define_insn "*lshiftrt_internal5be"
4982 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4986 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4987 (match_operand:SI 2 "const_int_operand" "i,i")) 2))
4989 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4990 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 2)))]
4991 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535))"
4993 rlwinm. %0,%1,%s2,0xffff
4995 [(set_attr "type" "shift")
4996 (set_attr "dot" "yes")
4997 (set_attr "length" "4,8")])
5000 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
5004 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5005 (match_operand:SI 2 "const_int_operand" "")) 0))
5007 (set (match_operand:SI 0 "gpc_reg_operand" "")
5008 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
5009 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
5011 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
5013 (compare:CC (match_dup 0)
5018 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
5022 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5023 (match_operand:SI 2 "const_int_operand" "")) 2))
5025 (set (match_operand:SI 0 "gpc_reg_operand" "")
5026 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 2)))]
5027 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
5029 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 2)))
5031 (compare:CC (match_dup 0)
5035 (define_insn "ashrsi3"
5036 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
5037 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5038 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
5043 [(set_attr "type" "shift")
5044 (set_attr "var_shift" "yes,no")])
5046 (define_insn "*ashrsi3_64"
5047 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
5049 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5050 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))))]
5055 [(set_attr "type" "shift")
5056 (set_attr "var_shift" "yes,no")])
5059 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
5060 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
5061 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
5063 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
5070 [(set_attr "type" "shift")
5071 (set_attr "var_shift" "yes,no,yes,no")
5072 (set_attr "dot" "yes")
5073 (set_attr "length" "4,4,8,8")])
5076 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
5077 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5078 (match_operand:SI 2 "reg_or_cint_operand" ""))
5080 (clobber (match_scratch:SI 3 ""))]
5083 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5085 (compare:CC (match_dup 3)
5090 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
5091 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
5092 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
5094 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
5095 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
5102 [(set_attr "type" "shift")
5103 (set_attr "var_shift" "yes,no,yes,no")
5104 (set_attr "dot" "yes")
5105 (set_attr "length" "4,4,8,8")])
5107 ;; Builtins to replace a division to generate FRE reciprocal estimate
5108 ;; instructions and the necessary fixup instructions
5109 (define_expand "recip<mode>3"
5110 [(match_operand:RECIPF 0 "gpc_reg_operand" "")
5111 (match_operand:RECIPF 1 "gpc_reg_operand" "")
5112 (match_operand:RECIPF 2 "gpc_reg_operand" "")]
5113 "RS6000_RECIP_HAVE_RE_P (<MODE>mode)"
5115 rs6000_emit_swdiv (operands[0], operands[1], operands[2], false);
5119 ;; Split to create division from FRE/FRES/etc. and fixup instead of the normal
5120 ;; hardware division. This is only done before register allocation and with
5121 ;; -ffast-math. This must appear before the divsf3/divdf3 insns.
5123 [(set (match_operand:RECIPF 0 "gpc_reg_operand" "")
5124 (div:RECIPF (match_operand 1 "gpc_reg_operand" "")
5125 (match_operand 2 "gpc_reg_operand" "")))]
5126 "RS6000_RECIP_AUTO_RE_P (<MODE>mode)
5127 && can_create_pseudo_p () && optimize_insn_for_speed_p ()
5128 && flag_finite_math_only && !flag_trapping_math && flag_reciprocal_math"
5131 rs6000_emit_swdiv (operands[0], operands[1], operands[2], true);
5135 ;; Builtins to replace 1/sqrt(x) with instructions using RSQRTE and the
5136 ;; appropriate fixup.
5137 (define_expand "rsqrt<mode>2"
5138 [(match_operand:RECIPF 0 "gpc_reg_operand" "")
5139 (match_operand:RECIPF 1 "gpc_reg_operand" "")]
5140 "RS6000_RECIP_HAVE_RSQRTE_P (<MODE>mode)"
5142 rs6000_emit_swrsqrt (operands[0], operands[1]);
5147 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
5148 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5149 (match_operand:SI 2 "reg_or_cint_operand" ""))
5151 (set (match_operand:SI 0 "gpc_reg_operand" "")
5152 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
5155 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5157 (compare:CC (match_dup 0)
5162 ;; Floating-point insns, excluding normal data motion. We combine the SF/DF
5163 ;; modes here, and also add in conditional vsx/power8-vector support to access
5164 ;; values in the traditional Altivec registers if the appropriate
5165 ;; -mupper-regs-{df,sf} option is enabled.
5167 (define_expand "abs<mode>2"
5168 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
5169 (abs:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")))]
5170 "TARGET_<MODE>_INSN"
5173 (define_insn "*abs<mode>2_fpr"
5174 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
5175 (abs:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")))]
5180 [(set_attr "type" "fp")
5181 (set_attr "fp_type" "fp_addsub_<Fs>")])
5183 (define_insn "*nabs<mode>2_fpr"
5184 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
5187 (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>"))))]
5192 [(set_attr "type" "fp")
5193 (set_attr "fp_type" "fp_addsub_<Fs>")])
5195 (define_expand "neg<mode>2"
5196 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
5197 (neg:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")))]
5198 "TARGET_<MODE>_INSN"
5201 (define_insn "*neg<mode>2_fpr"
5202 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
5203 (neg:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")))]
5208 [(set_attr "type" "fp")
5209 (set_attr "fp_type" "fp_addsub_<Fs>")])
5211 (define_expand "add<mode>3"
5212 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
5213 (plus:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")
5214 (match_operand:SFDF 2 "gpc_reg_operand" "")))]
5215 "TARGET_<MODE>_INSN"
5218 (define_insn "*add<mode>3_fpr"
5219 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
5220 (plus:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "%<Ff>,<Fv>")
5221 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")))]
5224 fadd<Ftrad> %0,%1,%2
5225 xsadd<Fvsx> %x0,%x1,%x2"
5226 [(set_attr "type" "fp")
5227 (set_attr "fp_type" "fp_addsub_<Fs>")])
5229 (define_expand "sub<mode>3"
5230 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
5231 (minus:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")
5232 (match_operand:SFDF 2 "gpc_reg_operand" "")))]
5233 "TARGET_<MODE>_INSN"
5236 (define_insn "*sub<mode>3_fpr"
5237 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
5238 (minus:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")
5239 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")))]
5242 fsub<Ftrad> %0,%1,%2
5243 xssub<Fvsx> %x0,%x1,%x2"
5244 [(set_attr "type" "fp")
5245 (set_attr "fp_type" "fp_addsub_<Fs>")])
5247 (define_expand "mul<mode>3"
5248 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
5249 (mult:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")
5250 (match_operand:SFDF 2 "gpc_reg_operand" "")))]
5251 "TARGET_<MODE>_INSN"
5254 (define_insn "*mul<mode>3_fpr"
5255 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
5256 (mult:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "%<Ff>,<Fv>")
5257 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")))]
5260 fmul<Ftrad> %0,%1,%2
5261 xsmul<Fvsx> %x0,%x1,%x2"
5262 [(set_attr "type" "dmul")
5263 (set_attr "fp_type" "fp_mul_<Fs>")])
5265 (define_expand "div<mode>3"
5266 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
5267 (div:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")
5268 (match_operand:SFDF 2 "gpc_reg_operand" "")))]
5269 "TARGET_<MODE>_INSN && !TARGET_SIMPLE_FPU"
5272 (define_insn "*div<mode>3_fpr"
5273 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
5274 (div:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")
5275 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")))]
5276 "TARGET_<MODE>_FPR && !TARGET_SIMPLE_FPU"
5278 fdiv<Ftrad> %0,%1,%2
5279 xsdiv<Fvsx> %x0,%x1,%x2"
5280 [(set_attr "type" "<Fs>div")
5281 (set_attr "fp_type" "fp_div_<Fs>")])
5283 (define_insn "sqrt<mode>2"
5284 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
5285 (sqrt:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")))]
5286 "TARGET_<MODE>_FPR && !TARGET_SIMPLE_FPU
5287 && (TARGET_PPC_GPOPT || (<MODE>mode == SFmode && TARGET_XILINX_FPU))"
5290 xssqrt<Fvsx> %x0,%x1"
5291 [(set_attr "type" "<Fs>sqrt")
5292 (set_attr "fp_type" "fp_sqrt_<Fs>")])
5294 ;; Floating point reciprocal approximation
5295 (define_insn "fre<Fs>"
5296 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
5297 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")]
5303 [(set_attr "type" "fp")])
5305 (define_insn "*rsqrt<mode>2"
5306 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
5307 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")]
5309 "RS6000_RECIP_HAVE_RSQRTE_P (<MODE>mode)"
5311 frsqrte<Ftrad> %0,%1
5312 xsrsqrte<Fvsx> %x0,%x1"
5313 [(set_attr "type" "fp")])
5315 ;; Floating point comparisons
5316 (define_insn "*cmp<mode>_fpr"
5317 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y,y")
5318 (compare:CCFP (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")
5319 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")))]
5323 xscmpudp %0,%x1,%x2"
5324 [(set_attr "type" "fpcompare")])
5326 ;; Floating point conversions
5327 (define_expand "extendsfdf2"
5328 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5329 (float_extend:DF (match_operand:SF 1 "reg_or_none500mem_operand" "")))]
5330 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5333 (define_insn_and_split "*extendsfdf2_fpr"
5334 [(set (match_operand:DF 0 "gpc_reg_operand" "=d,?d,d,ws,?ws,wv")
5335 (float_extend:DF (match_operand:SF 1 "reg_or_mem_operand" "0,f,m,0,wy,Z")))]
5336 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5344 "&& reload_completed && REG_P (operands[1]) && REGNO (operands[0]) == REGNO (operands[1])"
5347 emit_note (NOTE_INSN_DELETED);
5350 [(set_attr "type" "fp,fp,fpload,fp,vecsimple,fpload")])
5352 (define_expand "truncdfsf2"
5353 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5354 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "")))]
5355 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5358 (define_insn "*truncdfsf2_fpr"
5359 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5360 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "d")))]
5361 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5363 [(set_attr "type" "fp")])
5365 ;; This expander is here to avoid FLOAT_WORDS_BIGENDIAN tests in
5366 ;; builtins.c and optabs.c that are not correct for IBM long double
5367 ;; when little-endian.
5368 (define_expand "signbittf2"
5370 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "")))
5372 (subreg:DI (match_dup 2) 0))
5375 (set (match_operand:SI 0 "gpc_reg_operand" "")
5378 && TARGET_HARD_FLOAT
5379 && (TARGET_FPRS || TARGET_E500_DOUBLE)
5380 && TARGET_LONG_DOUBLE_128"
5382 operands[2] = gen_reg_rtx (DFmode);
5383 operands[3] = gen_reg_rtx (DImode);
5384 if (TARGET_POWERPC64)
5386 operands[4] = gen_reg_rtx (DImode);
5387 operands[5] = gen_rtx_LSHIFTRT (DImode, operands[3], GEN_INT (63));
5388 operands[6] = gen_rtx_SUBREG (SImode, operands[4],
5389 WORDS_BIG_ENDIAN ? 4 : 0);
5393 operands[4] = gen_reg_rtx (SImode);
5394 operands[5] = gen_rtx_SUBREG (SImode, operands[3],
5395 WORDS_BIG_ENDIAN ? 0 : 4);
5396 operands[6] = gen_rtx_LSHIFTRT (SImode, operands[4], GEN_INT (31));
5400 (define_expand "copysign<mode>3"
5402 (abs:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")))
5404 (neg:SFDF (abs:SFDF (match_dup 1))))
5405 (set (match_operand:SFDF 0 "gpc_reg_operand" "")
5406 (if_then_else:SFDF (ge (match_operand:SFDF 2 "gpc_reg_operand" "")
5410 "TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>
5411 && ((TARGET_PPC_GFXOPT
5412 && !HONOR_NANS (<MODE>mode)
5413 && !HONOR_SIGNED_ZEROS (<MODE>mode))
5415 || VECTOR_UNIT_VSX_P (<MODE>mode))"
5417 if (TARGET_CMPB || VECTOR_UNIT_VSX_P (<MODE>mode))
5419 emit_insn (gen_copysign<mode>3_fcpsgn (operands[0], operands[1],
5424 operands[3] = gen_reg_rtx (<MODE>mode);
5425 operands[4] = gen_reg_rtx (<MODE>mode);
5426 operands[5] = CONST0_RTX (<MODE>mode);
5429 ;; Use an unspec rather providing an if-then-else in RTL, to prevent the
5430 ;; compiler from optimizing -0.0
5431 (define_insn "copysign<mode>3_fcpsgn"
5432 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
5433 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")
5434 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")]
5436 "TARGET_<MODE>_FPR && TARGET_CMPB"
5439 xscpsgn<Fvsx> %x0,%x2,%x1"
5440 [(set_attr "type" "fp")])
5442 ;; For MIN, MAX, and conditional move, we use DEFINE_EXPAND's that involve a
5443 ;; fsel instruction and some auxiliary computations. Then we just have a
5444 ;; single DEFINE_INSN for fsel and the define_splits to make them if made by
5446 ;; For MIN, MAX on non-VSX machines, and conditional move all of the time, we
5447 ;; use DEFINE_EXPAND's that involve a fsel instruction and some auxiliary
5448 ;; computations. Then we just have a single DEFINE_INSN for fsel and the
5449 ;; define_splits to make them if made by combine. On VSX machines we have the
5450 ;; min/max instructions.
5452 ;; On VSX, we only check for TARGET_VSX instead of checking for a vsx/p8 vector
5453 ;; to allow either DF/SF to use only traditional registers.
5455 (define_expand "smax<mode>3"
5456 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
5457 (if_then_else:SFDF (ge (match_operand:SFDF 1 "gpc_reg_operand" "")
5458 (match_operand:SFDF 2 "gpc_reg_operand" ""))
5461 "TARGET_<MODE>_FPR && TARGET_PPC_GFXOPT && !flag_trapping_math"
5463 rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]);
5467 (define_insn "*smax<mode>3_vsx"
5468 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
5469 (smax:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "%<Ff>,<Fv>")
5470 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")))]
5471 "TARGET_<MODE>_FPR && TARGET_VSX"
5472 "xsmaxdp %x0,%x1,%x2"
5473 [(set_attr "type" "fp")])
5475 (define_expand "smin<mode>3"
5476 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
5477 (if_then_else:SFDF (ge (match_operand:SFDF 1 "gpc_reg_operand" "")
5478 (match_operand:SFDF 2 "gpc_reg_operand" ""))
5481 "TARGET_<MODE>_FPR && TARGET_PPC_GFXOPT && !flag_trapping_math"
5483 rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]);
5487 (define_insn "*smin<mode>3_vsx"
5488 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
5489 (smin:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "%<Ff>,<Fv>")
5490 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")))]
5491 "TARGET_<MODE>_FPR && TARGET_VSX"
5492 "xsmindp %x0,%x1,%x2"
5493 [(set_attr "type" "fp")])
5496 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
5497 (match_operator:SFDF 3 "min_max_operator"
5498 [(match_operand:SFDF 1 "gpc_reg_operand" "")
5499 (match_operand:SFDF 2 "gpc_reg_operand" "")]))]
5500 "TARGET_<MODE>_FPR && TARGET_PPC_GFXOPT && !flag_trapping_math
5504 rs6000_emit_minmax (operands[0], GET_CODE (operands[3]), operands[1],
5510 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5511 (match_operator:SF 3 "min_max_operator"
5512 [(match_operand:SF 1 "gpc_reg_operand" "")
5513 (match_operand:SF 2 "gpc_reg_operand" "")]))]
5514 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
5515 && TARGET_SINGLE_FLOAT && !flag_trapping_math"
5518 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
5519 operands[1], operands[2]);
5523 (define_expand "mov<mode>cc"
5524 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
5525 (if_then_else:GPR (match_operand 1 "comparison_operator" "")
5526 (match_operand:GPR 2 "gpc_reg_operand" "")
5527 (match_operand:GPR 3 "gpc_reg_operand" "")))]
5531 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5537 ;; We use the BASE_REGS for the isel input operands because, if rA is
5538 ;; 0, the value of 0 is placed in rD upon truth. Similarly for rB
5539 ;; because we may switch the operands and rB may end up being rA.
5541 ;; We need 2 patterns: an unsigned and a signed pattern. We could
5542 ;; leave out the mode in operand 4 and use one pattern, but reload can
5543 ;; change the mode underneath our feet and then gets confused trying
5544 ;; to reload the value.
5545 (define_insn "isel_signed_<mode>"
5546 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
5548 (match_operator 1 "scc_comparison_operator"
5549 [(match_operand:CC 4 "cc_reg_operand" "y,y")
5551 (match_operand:GPR 2 "reg_or_cint_operand" "O,b")
5552 (match_operand:GPR 3 "gpc_reg_operand" "r,r")))]
5555 { return output_isel (operands); }"
5556 [(set_attr "type" "isel")
5557 (set_attr "length" "4")])
5559 (define_insn "isel_unsigned_<mode>"
5560 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
5562 (match_operator 1 "scc_comparison_operator"
5563 [(match_operand:CCUNS 4 "cc_reg_operand" "y,y")
5565 (match_operand:GPR 2 "reg_or_cint_operand" "O,b")
5566 (match_operand:GPR 3 "gpc_reg_operand" "r,r")))]
5569 { return output_isel (operands); }"
5570 [(set_attr "type" "isel")
5571 (set_attr "length" "4")])
5573 ;; These patterns can be useful for combine; they let combine know that
5574 ;; isel can handle reversed comparisons so long as the operands are
5577 (define_insn "*isel_reversed_signed_<mode>"
5578 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
5580 (match_operator 1 "scc_rev_comparison_operator"
5581 [(match_operand:CC 4 "cc_reg_operand" "y")
5583 (match_operand:GPR 2 "gpc_reg_operand" "b")
5584 (match_operand:GPR 3 "gpc_reg_operand" "b")))]
5587 { return output_isel (operands); }"
5588 [(set_attr "type" "isel")
5589 (set_attr "length" "4")])
5591 (define_insn "*isel_reversed_unsigned_<mode>"
5592 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
5594 (match_operator 1 "scc_rev_comparison_operator"
5595 [(match_operand:CCUNS 4 "cc_reg_operand" "y")
5597 (match_operand:GPR 2 "gpc_reg_operand" "b")
5598 (match_operand:GPR 3 "gpc_reg_operand" "b")))]
5601 { return output_isel (operands); }"
5602 [(set_attr "type" "isel")
5603 (set_attr "length" "4")])
5605 (define_expand "movsfcc"
5606 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5607 (if_then_else:SF (match_operand 1 "comparison_operator" "")
5608 (match_operand:SF 2 "gpc_reg_operand" "")
5609 (match_operand:SF 3 "gpc_reg_operand" "")))]
5610 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5613 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5619 (define_insn "*fselsfsf4"
5620 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5621 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
5622 (match_operand:SF 4 "zero_fp_constant" "F"))
5623 (match_operand:SF 2 "gpc_reg_operand" "f")
5624 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5625 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5627 [(set_attr "type" "fp")])
5629 (define_insn "*fseldfsf4"
5630 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5631 (if_then_else:SF (ge (match_operand:DF 1 "gpc_reg_operand" "d")
5632 (match_operand:DF 4 "zero_fp_constant" "F"))
5633 (match_operand:SF 2 "gpc_reg_operand" "f")
5634 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5635 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_SINGLE_FLOAT"
5637 [(set_attr "type" "fp")])
5639 ;; The conditional move instructions allow us to perform max and min
5640 ;; operations even when
5643 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5644 (match_operator:DF 3 "min_max_operator"
5645 [(match_operand:DF 1 "gpc_reg_operand" "")
5646 (match_operand:DF 2 "gpc_reg_operand" "")]))]
5647 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5648 && !flag_trapping_math"
5651 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
5652 operands[1], operands[2]);
5656 (define_expand "movdfcc"
5657 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5658 (if_then_else:DF (match_operand 1 "comparison_operator" "")
5659 (match_operand:DF 2 "gpc_reg_operand" "")
5660 (match_operand:DF 3 "gpc_reg_operand" "")))]
5661 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5664 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5670 (define_insn "*fseldfdf4"
5671 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
5672 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "d")
5673 (match_operand:DF 4 "zero_fp_constant" "F"))
5674 (match_operand:DF 2 "gpc_reg_operand" "d")
5675 (match_operand:DF 3 "gpc_reg_operand" "d")))]
5676 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5678 [(set_attr "type" "fp")])
5680 (define_insn "*fselsfdf4"
5681 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
5682 (if_then_else:DF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
5683 (match_operand:SF 4 "zero_fp_constant" "F"))
5684 (match_operand:DF 2 "gpc_reg_operand" "d")
5685 (match_operand:DF 3 "gpc_reg_operand" "d")))]
5686 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_SINGLE_FLOAT"
5688 [(set_attr "type" "fp")])
5690 ;; Conversions to and from floating-point.
5692 ; We don't define lfiwax/lfiwzx with the normal definition, because we
5693 ; don't want to support putting SImode in FPR registers.
5694 (define_insn "lfiwax"
5695 [(set (match_operand:DI 0 "gpc_reg_operand" "=d,wm,!wm")
5696 (unspec:DI [(match_operand:SI 1 "reg_or_indexed_operand" "Z,Z,r")]
5698 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWAX"
5703 [(set_attr "type" "fpload,fpload,mffgpr")])
5705 ; This split must be run before register allocation because it allocates the
5706 ; memory slot that is needed to move values to/from the FPR. We don't allocate
5707 ; it earlier to allow for the combiner to merge insns together where it might
5708 ; not be needed and also in case the insns are deleted as dead code.
5710 (define_insn_and_split "floatsi<mode>2_lfiwax"
5711 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d")
5712 (float:SFDF (match_operand:SI 1 "nonimmediate_operand" "r")))
5713 (clobber (match_scratch:DI 2 "=d"))]
5714 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWAX
5715 && <SI_CONVERT_FP> && can_create_pseudo_p ()"
5721 rtx dest = operands[0];
5722 rtx src = operands[1];
5725 if (!MEM_P (src) && TARGET_POWERPC64
5726 && (TARGET_MFPGPR || TARGET_DIRECT_MOVE))
5727 tmp = convert_to_mode (DImode, src, false);
5731 if (GET_CODE (tmp) == SCRATCH)
5732 tmp = gen_reg_rtx (DImode);
5735 src = rs6000_address_for_fpconvert (src);
5736 emit_insn (gen_lfiwax (tmp, src));
5740 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
5741 emit_move_insn (stack, src);
5742 emit_insn (gen_lfiwax (tmp, stack));
5745 emit_insn (gen_floatdi<mode>2 (dest, tmp));
5748 [(set_attr "length" "12")
5749 (set_attr "type" "fpload")])
5751 (define_insn_and_split "floatsi<mode>2_lfiwax_mem"
5752 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d,<rreg2>")
5755 (match_operand:SI 1 "memory_operand" "Z,Z"))))
5756 (clobber (match_scratch:DI 2 "=0,d"))]
5757 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWAX
5764 operands[1] = rs6000_address_for_fpconvert (operands[1]);
5765 if (GET_CODE (operands[2]) == SCRATCH)
5766 operands[2] = gen_reg_rtx (DImode);
5767 emit_insn (gen_lfiwax (operands[2], operands[1]));
5768 emit_insn (gen_floatdi<mode>2 (operands[0], operands[2]));
5771 [(set_attr "length" "8")
5772 (set_attr "type" "fpload")])
5774 (define_insn "lfiwzx"
5775 [(set (match_operand:DI 0 "gpc_reg_operand" "=d,wm,!wm")
5776 (unspec:DI [(match_operand:SI 1 "reg_or_indexed_operand" "Z,Z,r")]
5778 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWZX"
5783 [(set_attr "type" "fpload,fpload,mftgpr")])
5785 (define_insn_and_split "floatunssi<mode>2_lfiwzx"
5786 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d")
5787 (unsigned_float:SFDF (match_operand:SI 1 "nonimmediate_operand" "r")))
5788 (clobber (match_scratch:DI 2 "=d"))]
5789 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWZX
5796 rtx dest = operands[0];
5797 rtx src = operands[1];
5800 if (!MEM_P (src) && TARGET_POWERPC64
5801 && (TARGET_MFPGPR || TARGET_DIRECT_MOVE))
5802 tmp = convert_to_mode (DImode, src, true);
5806 if (GET_CODE (tmp) == SCRATCH)
5807 tmp = gen_reg_rtx (DImode);
5810 src = rs6000_address_for_fpconvert (src);
5811 emit_insn (gen_lfiwzx (tmp, src));
5815 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
5816 emit_move_insn (stack, src);
5817 emit_insn (gen_lfiwzx (tmp, stack));
5820 emit_insn (gen_floatdi<mode>2 (dest, tmp));
5823 [(set_attr "length" "12")
5824 (set_attr "type" "fpload")])
5826 (define_insn_and_split "floatunssi<mode>2_lfiwzx_mem"
5827 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d,<rreg2>")
5828 (unsigned_float:SFDF
5830 (match_operand:SI 1 "memory_operand" "Z,Z"))))
5831 (clobber (match_scratch:DI 2 "=0,d"))]
5832 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWZX
5839 operands[1] = rs6000_address_for_fpconvert (operands[1]);
5840 if (GET_CODE (operands[2]) == SCRATCH)
5841 operands[2] = gen_reg_rtx (DImode);
5842 emit_insn (gen_lfiwzx (operands[2], operands[1]));
5843 emit_insn (gen_floatdi<mode>2 (operands[0], operands[2]));
5846 [(set_attr "length" "8")
5847 (set_attr "type" "fpload")])
5849 ; For each of these conversions, there is a define_expand, a define_insn
5850 ; with a '#' template, and a define_split (with C code). The idea is
5851 ; to allow constant folding with the template of the define_insn,
5852 ; then to have the insns split later (between sched1 and final).
5854 (define_expand "floatsidf2"
5855 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5856 (float:DF (match_operand:SI 1 "nonimmediate_operand" "")))
5859 (clobber (match_dup 4))
5860 (clobber (match_dup 5))
5861 (clobber (match_dup 6))])]
5863 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5866 if (TARGET_E500_DOUBLE)
5868 if (!REG_P (operands[1]))
5869 operands[1] = force_reg (SImode, operands[1]);
5870 emit_insn (gen_spe_floatsidf2 (operands[0], operands[1]));
5873 else if (TARGET_LFIWAX && TARGET_FCFID)
5875 emit_insn (gen_floatsidf2_lfiwax (operands[0], operands[1]));
5878 else if (TARGET_FCFID)
5880 rtx dreg = operands[1];
5882 dreg = force_reg (SImode, dreg);
5883 dreg = convert_to_mode (DImode, dreg, false);
5884 emit_insn (gen_floatdidf2 (operands[0], dreg));
5888 if (!REG_P (operands[1]))
5889 operands[1] = force_reg (SImode, operands[1]);
5890 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5891 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503601774854144\", DFmode));
5892 operands[4] = rs6000_allocate_stack_temp (DFmode, true, false);
5893 operands[5] = gen_reg_rtx (DFmode);
5894 operands[6] = gen_reg_rtx (SImode);
5897 (define_insn_and_split "*floatsidf2_internal"
5898 [(set (match_operand:DF 0 "gpc_reg_operand" "=&d")
5899 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5900 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5901 (use (match_operand:DF 3 "gpc_reg_operand" "d"))
5902 (clobber (match_operand:DF 4 "offsettable_mem_operand" "=o"))
5903 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&d"))
5904 (clobber (match_operand:SI 6 "gpc_reg_operand" "=&r"))]
5905 "! TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5911 rtx lowword, highword;
5912 gcc_assert (MEM_P (operands[4]));
5913 highword = adjust_address (operands[4], SImode, 0);
5914 lowword = adjust_address (operands[4], SImode, 4);
5915 if (! WORDS_BIG_ENDIAN)
5918 tmp = highword; highword = lowword; lowword = tmp;
5921 emit_insn (gen_xorsi3 (operands[6], operands[1],
5922 GEN_INT (~ (HOST_WIDE_INT) 0x7fffffff)));
5923 emit_move_insn (lowword, operands[6]);
5924 emit_move_insn (highword, operands[2]);
5925 emit_move_insn (operands[5], operands[4]);
5926 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5929 [(set_attr "length" "24")
5930 (set_attr "type" "fp")])
5932 ;; If we don't have a direct conversion to single precision, don't enable this
5933 ;; conversion for 32-bit without fast math, because we don't have the insn to
5934 ;; generate the fixup swizzle to avoid double rounding problems.
5935 (define_expand "floatunssisf2"
5936 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5937 (unsigned_float:SF (match_operand:SI 1 "nonimmediate_operand" "")))]
5938 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT
5941 && ((TARGET_FCFIDUS && TARGET_LFIWZX)
5942 || (TARGET_DOUBLE_FLOAT && TARGET_FCFID
5943 && (TARGET_POWERPC64 || flag_unsafe_math_optimizations)))))"
5948 if (!REG_P (operands[1]))
5949 operands[1] = force_reg (SImode, operands[1]);
5951 else if (TARGET_LFIWZX && TARGET_FCFIDUS)
5953 emit_insn (gen_floatunssisf2_lfiwzx (operands[0], operands[1]));
5958 rtx dreg = operands[1];
5960 dreg = force_reg (SImode, dreg);
5961 dreg = convert_to_mode (DImode, dreg, true);
5962 emit_insn (gen_floatdisf2 (operands[0], dreg));
5967 (define_expand "floatunssidf2"
5968 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5969 (unsigned_float:DF (match_operand:SI 1 "nonimmediate_operand" "")))
5972 (clobber (match_dup 4))
5973 (clobber (match_dup 5))])]
5975 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5978 if (TARGET_E500_DOUBLE)
5980 if (!REG_P (operands[1]))
5981 operands[1] = force_reg (SImode, operands[1]);
5982 emit_insn (gen_spe_floatunssidf2 (operands[0], operands[1]));
5985 else if (TARGET_LFIWZX && TARGET_FCFID)
5987 emit_insn (gen_floatunssidf2_lfiwzx (operands[0], operands[1]));
5990 else if (TARGET_FCFID)
5992 rtx dreg = operands[1];
5994 dreg = force_reg (SImode, dreg);
5995 dreg = convert_to_mode (DImode, dreg, true);
5996 emit_insn (gen_floatdidf2 (operands[0], dreg));
6000 if (!REG_P (operands[1]))
6001 operands[1] = force_reg (SImode, operands[1]);
6002 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
6003 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503599627370496\", DFmode));
6004 operands[4] = rs6000_allocate_stack_temp (DFmode, true, false);
6005 operands[5] = gen_reg_rtx (DFmode);
6008 (define_insn_and_split "*floatunssidf2_internal"
6009 [(set (match_operand:DF 0 "gpc_reg_operand" "=&d")
6010 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
6011 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
6012 (use (match_operand:DF 3 "gpc_reg_operand" "d"))
6013 (clobber (match_operand:DF 4 "offsettable_mem_operand" "=o"))
6014 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&d"))]
6015 "! TARGET_FCFIDU && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6016 && !(TARGET_FCFID && TARGET_POWERPC64)"
6022 rtx lowword, highword;
6023 gcc_assert (MEM_P (operands[4]));
6024 highword = adjust_address (operands[4], SImode, 0);
6025 lowword = adjust_address (operands[4], SImode, 4);
6026 if (! WORDS_BIG_ENDIAN)
6029 tmp = highword; highword = lowword; lowword = tmp;
6032 emit_move_insn (lowword, operands[1]);
6033 emit_move_insn (highword, operands[2]);
6034 emit_move_insn (operands[5], operands[4]);
6035 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
6038 [(set_attr "length" "20")
6039 (set_attr "type" "fp")])
6041 (define_expand "fix_trunc<mode>si2"
6042 [(set (match_operand:SI 0 "gpc_reg_operand" "")
6043 (fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "")))]
6044 "TARGET_HARD_FLOAT && ((TARGET_FPRS && <TARGET_FLOAT>) || <E500_CONVERT>)"
6047 if (!<E500_CONVERT>)
6052 emit_insn (gen_fix_trunc<mode>si2_stfiwx (operands[0], operands[1]));
6055 tmp = gen_reg_rtx (DImode);
6056 stack = rs6000_allocate_stack_temp (DImode, true, false);
6057 emit_insn (gen_fix_trunc<mode>si2_internal (operands[0], operands[1],
6064 ; Like the convert to float patterns, this insn must be split before
6065 ; register allocation so that it can allocate the memory slot if it
6067 (define_insn_and_split "fix_trunc<mode>si2_stfiwx"
6068 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
6069 (fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d")))
6070 (clobber (match_scratch:DI 2 "=d"))]
6071 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6072 && (<MODE>mode != SFmode || TARGET_SINGLE_FLOAT)
6073 && TARGET_STFIWX && can_create_pseudo_p ()"
6078 rtx dest = operands[0];
6079 rtx src = operands[1];
6080 rtx tmp = operands[2];
6082 if (GET_CODE (tmp) == SCRATCH)
6083 tmp = gen_reg_rtx (DImode);
6085 emit_insn (gen_fctiwz_<mode> (tmp, src));
6088 dest = rs6000_address_for_fpconvert (dest);
6089 emit_insn (gen_stfiwx (dest, tmp));
6092 else if (TARGET_POWERPC64 && (TARGET_MFPGPR || TARGET_DIRECT_MOVE))
6094 dest = gen_lowpart (DImode, dest);
6095 emit_move_insn (dest, tmp);
6100 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
6101 emit_insn (gen_stfiwx (stack, tmp));
6102 emit_move_insn (dest, stack);
6106 [(set_attr "length" "12")
6107 (set_attr "type" "fp")])
6109 (define_insn_and_split "fix_trunc<mode>si2_internal"
6110 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,?r")
6111 (fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d,<rreg>")))
6112 (clobber (match_operand:DI 2 "gpc_reg_operand" "=1,d"))
6113 (clobber (match_operand:DI 3 "offsettable_mem_operand" "=o,o"))]
6114 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6121 gcc_assert (MEM_P (operands[3]));
6122 lowword = adjust_address (operands[3], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
6124 emit_insn (gen_fctiwz_<mode> (operands[2], operands[1]));
6125 emit_move_insn (operands[3], operands[2]);
6126 emit_move_insn (operands[0], lowword);
6129 [(set_attr "length" "16")
6130 (set_attr "type" "fp")])
6132 (define_expand "fix_trunc<mode>di2"
6133 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6134 (fix:DI (match_operand:SFDF 1 "gpc_reg_operand" "")))]
6135 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
6139 (define_insn "*fix_trunc<mode>di2_fctidz"
6140 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6141 (fix:DI (match_operand:SFDF 1 "gpc_reg_operand" "d")))]
6142 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
6143 && TARGET_FCFID && !VECTOR_UNIT_VSX_P (<MODE>mode)"
6145 [(set_attr "type" "fp")])
6147 (define_expand "fixuns_trunc<mode>si2"
6148 [(set (match_operand:SI 0 "gpc_reg_operand" "")
6149 (unsigned_fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "")))]
6151 && ((TARGET_FPRS && <TARGET_FLOAT> && TARGET_FCTIWUZ && TARGET_STFIWX)
6155 if (!<E500_CONVERT>)
6157 emit_insn (gen_fixuns_trunc<mode>si2_stfiwx (operands[0], operands[1]));
6162 (define_insn_and_split "fixuns_trunc<mode>si2_stfiwx"
6163 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
6164 (unsigned_fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d")))
6165 (clobber (match_scratch:DI 2 "=d"))]
6166 "TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT> && TARGET_FCTIWUZ
6167 && TARGET_STFIWX && can_create_pseudo_p ()"
6172 rtx dest = operands[0];
6173 rtx src = operands[1];
6174 rtx tmp = operands[2];
6176 if (GET_CODE (tmp) == SCRATCH)
6177 tmp = gen_reg_rtx (DImode);
6179 emit_insn (gen_fctiwuz_<mode> (tmp, src));
6182 dest = rs6000_address_for_fpconvert (dest);
6183 emit_insn (gen_stfiwx (dest, tmp));
6186 else if (TARGET_POWERPC64 && (TARGET_MFPGPR || TARGET_DIRECT_MOVE))
6188 dest = gen_lowpart (DImode, dest);
6189 emit_move_insn (dest, tmp);
6194 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
6195 emit_insn (gen_stfiwx (stack, tmp));
6196 emit_move_insn (dest, stack);
6200 [(set_attr "length" "12")
6201 (set_attr "type" "fp")])
6203 (define_expand "fixuns_trunc<mode>di2"
6204 [(set (match_operand:DI 0 "register_operand" "")
6205 (unsigned_fix:DI (match_operand:SFDF 1 "register_operand" "")))]
6206 "TARGET_HARD_FLOAT && (TARGET_FCTIDUZ || VECTOR_UNIT_VSX_P (<MODE>mode))"
6209 (define_insn "*fixuns_trunc<mode>di2_fctiduz"
6210 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6211 (unsigned_fix:DI (match_operand:SFDF 1 "gpc_reg_operand" "d")))]
6212 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
6213 && TARGET_FCTIDUZ && !VECTOR_UNIT_VSX_P (<MODE>mode)"
6215 [(set_attr "type" "fp")])
6217 ; Here, we use (set (reg) (unspec:DI [(fix:SI ...)] UNSPEC_FCTIWZ))
6218 ; rather than (set (subreg:SI (reg)) (fix:SI ...))
6219 ; because the first makes it clear that operand 0 is not live
6220 ; before the instruction.
6221 (define_insn "fctiwz_<mode>"
6222 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6223 (unspec:DI [(fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d"))]
6225 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6227 [(set_attr "type" "fp")])
6229 (define_insn "fctiwuz_<mode>"
6230 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6231 (unspec:DI [(unsigned_fix:SI
6232 (match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>"))]
6234 "TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT> && TARGET_FCTIWUZ"
6236 [(set_attr "type" "fp")])
6238 ;; Only optimize (float (fix x)) -> frz if we are in fast-math mode, since
6239 ;; since the friz instruction does not truncate the value if the floating
6240 ;; point value is < LONG_MIN or > LONG_MAX.
6241 (define_insn "*friz"
6242 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6243 (float:DF (fix:DI (match_operand:DF 1 "gpc_reg_operand" "d"))))]
6244 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_FPRND
6245 && !VECTOR_UNIT_VSX_P (DFmode) && flag_unsafe_math_optimizations
6246 && !flag_trapping_math && TARGET_FRIZ"
6248 [(set_attr "type" "fp")])
6250 ;; Since FCTIWZ doesn't sign extend the upper bits, we have to do a store and a
6251 ;; load to properly sign extend the value, but at least doing a store, load
6252 ;; into a GPR to sign extend, a store from the GPR and a load back into the FPR
6253 ;; if we have 32-bit memory ops
6254 (define_insn_and_split "*round32<mode>2_fprs"
6255 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d")
6257 (fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d"))))
6258 (clobber (match_scratch:DI 2 "=d"))
6259 (clobber (match_scratch:DI 3 "=d"))]
6260 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6261 && <SI_CONVERT_FP> && TARGET_LFIWAX && TARGET_STFIWX && TARGET_FCFID
6262 && can_create_pseudo_p ()"
6267 rtx dest = operands[0];
6268 rtx src = operands[1];
6269 rtx tmp1 = operands[2];
6270 rtx tmp2 = operands[3];
6271 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
6273 if (GET_CODE (tmp1) == SCRATCH)
6274 tmp1 = gen_reg_rtx (DImode);
6275 if (GET_CODE (tmp2) == SCRATCH)
6276 tmp2 = gen_reg_rtx (DImode);
6278 emit_insn (gen_fctiwz_<mode> (tmp1, src));
6279 emit_insn (gen_stfiwx (stack, tmp1));
6280 emit_insn (gen_lfiwax (tmp2, stack));
6281 emit_insn (gen_floatdi<mode>2 (dest, tmp2));
6284 [(set_attr "type" "fpload")
6285 (set_attr "length" "16")])
6287 (define_insn_and_split "*roundu32<mode>2_fprs"
6288 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d")
6289 (unsigned_float:SFDF
6290 (unsigned_fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d"))))
6291 (clobber (match_scratch:DI 2 "=d"))
6292 (clobber (match_scratch:DI 3 "=d"))]
6293 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6294 && TARGET_LFIWZX && TARGET_STFIWX && TARGET_FCFIDU
6295 && can_create_pseudo_p ()"
6300 rtx dest = operands[0];
6301 rtx src = operands[1];
6302 rtx tmp1 = operands[2];
6303 rtx tmp2 = operands[3];
6304 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
6306 if (GET_CODE (tmp1) == SCRATCH)
6307 tmp1 = gen_reg_rtx (DImode);
6308 if (GET_CODE (tmp2) == SCRATCH)
6309 tmp2 = gen_reg_rtx (DImode);
6311 emit_insn (gen_fctiwuz_<mode> (tmp1, src));
6312 emit_insn (gen_stfiwx (stack, tmp1));
6313 emit_insn (gen_lfiwzx (tmp2, stack));
6314 emit_insn (gen_floatdi<mode>2 (dest, tmp2));
6317 [(set_attr "type" "fpload")
6318 (set_attr "length" "16")])
6320 ;; No VSX equivalent to fctid
6321 (define_insn "lrint<mode>di2"
6322 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6323 (unspec:DI [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
6325 "TARGET_<MODE>_FPR && TARGET_FPRND"
6327 [(set_attr "type" "fp")])
6329 (define_insn "btrunc<mode>2"
6330 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
6331 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")]
6333 "TARGET_<MODE>_FPR && TARGET_FPRND"
6337 [(set_attr "type" "fp")
6338 (set_attr "fp_type" "fp_addsub_<Fs>")])
6340 (define_insn "ceil<mode>2"
6341 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
6342 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")]
6344 "TARGET_<MODE>_FPR && TARGET_FPRND"
6348 [(set_attr "type" "fp")
6349 (set_attr "fp_type" "fp_addsub_<Fs>")])
6351 (define_insn "floor<mode>2"
6352 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
6353 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")]
6355 "TARGET_<MODE>_FPR && TARGET_FPRND"
6359 [(set_attr "type" "fp")
6360 (set_attr "fp_type" "fp_addsub_<Fs>")])
6362 ;; No VSX equivalent to frin
6363 (define_insn "round<mode>2"
6364 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
6365 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
6367 "TARGET_<MODE>_FPR && TARGET_FPRND"
6369 [(set_attr "type" "fp")
6370 (set_attr "fp_type" "fp_addsub_<Fs>")])
6372 ; An UNSPEC is used so we don't have to support SImode in FP registers.
6373 (define_insn "stfiwx"
6374 [(set (match_operand:SI 0 "memory_operand" "=Z")
6375 (unspec:SI [(match_operand:DI 1 "gpc_reg_operand" "d")]
6379 [(set_attr "type" "fpstore")])
6381 ;; If we don't have a direct conversion to single precision, don't enable this
6382 ;; conversion for 32-bit without fast math, because we don't have the insn to
6383 ;; generate the fixup swizzle to avoid double rounding problems.
6384 (define_expand "floatsisf2"
6385 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6386 (float:SF (match_operand:SI 1 "nonimmediate_operand" "")))]
6387 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT
6390 && ((TARGET_FCFIDS && TARGET_LFIWAX)
6391 || (TARGET_DOUBLE_FLOAT && TARGET_FCFID
6392 && (TARGET_POWERPC64 || flag_unsafe_math_optimizations)))))"
6397 if (!REG_P (operands[1]))
6398 operands[1] = force_reg (SImode, operands[1]);
6400 else if (TARGET_FCFIDS && TARGET_LFIWAX)
6402 emit_insn (gen_floatsisf2_lfiwax (operands[0], operands[1]));
6405 else if (TARGET_FCFID && TARGET_LFIWAX)
6407 rtx dfreg = gen_reg_rtx (DFmode);
6408 emit_insn (gen_floatsidf2_lfiwax (dfreg, operands[1]));
6409 emit_insn (gen_truncdfsf2 (operands[0], dfreg));
6414 rtx dreg = operands[1];
6416 dreg = force_reg (SImode, dreg);
6417 dreg = convert_to_mode (DImode, dreg, false);
6418 emit_insn (gen_floatdisf2 (operands[0], dreg));
6423 (define_expand "floatdidf2"
6424 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6425 (float:DF (match_operand:DI 1 "gpc_reg_operand" "")))]
6426 "TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS"
6429 (define_insn "*floatdidf2_fpr"
6430 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6431 (float:DF (match_operand:DI 1 "gpc_reg_operand" "d")))]
6432 "TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
6433 && !VECTOR_UNIT_VSX_P (DFmode)"
6435 [(set_attr "type" "fp")])
6437 ; Allow the combiner to merge source memory operands to the conversion so that
6438 ; the optimizer/register allocator doesn't try to load the value too early in a
6439 ; GPR and then use store/load to move it to a FPR and suffer from a store-load
6440 ; hit. We will split after reload to avoid the trip through the GPRs
6442 (define_insn_and_split "*floatdidf2_mem"
6443 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6444 (float:DF (match_operand:DI 1 "memory_operand" "m")))
6445 (clobber (match_scratch:DI 2 "=d"))]
6446 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS && TARGET_FCFID"
6448 "&& reload_completed"
6449 [(set (match_dup 2) (match_dup 1))
6450 (set (match_dup 0) (float:DF (match_dup 2)))]
6452 [(set_attr "length" "8")
6453 (set_attr "type" "fpload")])
6455 (define_expand "floatunsdidf2"
6456 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6458 (match_operand:DI 1 "gpc_reg_operand" "")))]
6459 "TARGET_HARD_FLOAT && (TARGET_FCFIDU || VECTOR_UNIT_VSX_P (DFmode))"
6462 (define_insn "*floatunsdidf2_fcfidu"
6463 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6464 (unsigned_float:DF (match_operand:DI 1 "gpc_reg_operand" "d")))]
6465 "TARGET_HARD_FLOAT && TARGET_FCFIDU && !VECTOR_UNIT_VSX_P (DFmode)"
6467 [(set_attr "type" "fp")
6468 (set_attr "length" "4")])
6470 (define_insn_and_split "*floatunsdidf2_mem"
6471 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6472 (unsigned_float:DF (match_operand:DI 1 "memory_operand" "m")))
6473 (clobber (match_scratch:DI 2 "=d"))]
6474 "TARGET_HARD_FLOAT && (TARGET_FCFIDU || VECTOR_UNIT_VSX_P (DFmode))"
6476 "&& reload_completed"
6477 [(set (match_dup 2) (match_dup 1))
6478 (set (match_dup 0) (unsigned_float:DF (match_dup 2)))]
6480 [(set_attr "length" "8")
6481 (set_attr "type" "fpload")])
6483 (define_expand "floatdisf2"
6484 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6485 (float:SF (match_operand:DI 1 "gpc_reg_operand" "")))]
6486 "TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
6487 && (TARGET_FCFIDS || TARGET_POWERPC64 || flag_unsafe_math_optimizations)"
6492 rtx val = operands[1];
6493 if (!flag_unsafe_math_optimizations)
6495 rtx label = gen_label_rtx ();
6496 val = gen_reg_rtx (DImode);
6497 emit_insn (gen_floatdisf2_internal2 (val, operands[1], label));
6500 emit_insn (gen_floatdisf2_internal1 (operands[0], val));
6505 (define_insn "floatdisf2_fcfids"
6506 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6507 (float:SF (match_operand:DI 1 "gpc_reg_operand" "d")))]
6508 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
6509 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDS"
6511 [(set_attr "type" "fp")])
6513 (define_insn_and_split "*floatdisf2_mem"
6514 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6515 (float:SF (match_operand:DI 1 "memory_operand" "m")))
6516 (clobber (match_scratch:DI 2 "=f"))]
6517 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
6518 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDS"
6520 "&& reload_completed"
6524 emit_move_insn (operands[2], operands[1]);
6525 emit_insn (gen_floatdisf2_fcfids (operands[0], operands[2]));
6528 [(set_attr "length" "8")])
6530 ;; This is not IEEE compliant if rounding mode is "round to nearest".
6531 ;; If the DI->DF conversion is inexact, then it's possible to suffer
6532 ;; from double rounding.
6533 ;; Instead of creating a new cpu type for two FP operations, just use fp
6534 (define_insn_and_split "floatdisf2_internal1"
6535 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6536 (float:SF (match_operand:DI 1 "gpc_reg_operand" "d")))
6537 (clobber (match_scratch:DF 2 "=d"))]
6538 "TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
6540 "&& reload_completed"
6542 (float:DF (match_dup 1)))
6544 (float_truncate:SF (match_dup 2)))]
6546 [(set_attr "length" "8")
6547 (set_attr "type" "fp")])
6549 ;; Twiddles bits to avoid double rounding.
6550 ;; Bits that might be truncated when converting to DFmode are replaced
6551 ;; by a bit that won't be lost at that stage, but is below the SFmode
6552 ;; rounding position.
6553 (define_expand "floatdisf2_internal2"
6554 [(set (match_dup 3) (ashiftrt:DI (match_operand:DI 1 "" "")
6556 (parallel [(set (match_operand:DI 0 "" "") (and:DI (match_dup 1)
6558 (clobber (scratch:CC))])
6559 (set (match_dup 3) (plus:DI (match_dup 3)
6561 (set (match_dup 0) (plus:DI (match_dup 0)
6563 (set (match_dup 4) (compare:CCUNS (match_dup 3)
6565 (set (match_dup 0) (ior:DI (match_dup 0)
6567 (parallel [(set (match_dup 0) (and:DI (match_dup 0)
6569 (clobber (scratch:CC))])
6570 (set (pc) (if_then_else (geu (match_dup 4) (const_int 0))
6571 (label_ref (match_operand:DI 2 "" ""))
6573 (set (match_dup 0) (match_dup 1))]
6574 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
6577 operands[3] = gen_reg_rtx (DImode);
6578 operands[4] = gen_reg_rtx (CCUNSmode);
6581 (define_expand "floatunsdisf2"
6582 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6583 (unsigned_float:SF (match_operand:DI 1 "gpc_reg_operand" "")))]
6584 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
6585 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDUS"
6588 (define_insn "floatunsdisf2_fcfidus"
6589 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6590 (unsigned_float:SF (match_operand:DI 1 "gpc_reg_operand" "d")))]
6591 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
6592 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDUS"
6594 [(set_attr "type" "fp")])
6596 (define_insn_and_split "*floatunsdisf2_mem"
6597 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6598 (unsigned_float:SF (match_operand:DI 1 "memory_operand" "m")))
6599 (clobber (match_scratch:DI 2 "=f"))]
6600 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
6601 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDUS"
6603 "&& reload_completed"
6607 emit_move_insn (operands[2], operands[1]);
6608 emit_insn (gen_floatunsdisf2_fcfidus (operands[0], operands[2]));
6611 [(set_attr "length" "8")
6612 (set_attr "type" "fpload")])
6614 ;; Define the TImode operations that can be done in a small number
6615 ;; of instructions. The & constraints are to prevent the register
6616 ;; allocator from allocating registers that overlap with the inputs
6617 ;; (for example, having an input in 7,8 and an output in 6,7). We
6618 ;; also allow for the output being the same as one of the inputs.
6620 (define_insn "addti3"
6621 [(set (match_operand:TI 0 "gpc_reg_operand" "=&r,&r,r,r")
6622 (plus:TI (match_operand:TI 1 "gpc_reg_operand" "%r,r,0,0")
6623 (match_operand:TI 2 "reg_or_short_operand" "r,I,r,I")))]
6626 if (WORDS_BIG_ENDIAN)
6627 return (GET_CODE (operands[2])) != CONST_INT
6628 ? \"addc %L0,%L1,%L2\;adde %0,%1,%2\"
6629 : \"addic %L0,%L1,%2\;add%G2e %0,%1\";
6631 return (GET_CODE (operands[2])) != CONST_INT
6632 ? \"addc %0,%1,%2\;adde %L0,%L1,%L2\"
6633 : \"addic %0,%1,%2\;add%G2e %L0,%L1\";
6635 [(set_attr "type" "two")
6636 (set_attr "length" "8")])
6638 (define_insn "subti3"
6639 [(set (match_operand:TI 0 "gpc_reg_operand" "=&r,&r,r,r,r")
6640 (minus:TI (match_operand:TI 1 "reg_or_short_operand" "r,I,0,r,I")
6641 (match_operand:TI 2 "gpc_reg_operand" "r,r,r,0,0")))]
6644 if (WORDS_BIG_ENDIAN)
6645 return (GET_CODE (operands[1]) != CONST_INT)
6646 ? \"subfc %L0,%L2,%L1\;subfe %0,%2,%1\"
6647 : \"subfic %L0,%L2,%1\;subf%G1e %0,%2\";
6649 return (GET_CODE (operands[1]) != CONST_INT)
6650 ? \"subfc %0,%2,%1\;subfe %L0,%L2,%L1\"
6651 : \"subfic %0,%2,%1\;subf%G1e %L0,%L2\";
6653 [(set_attr "type" "two")
6654 (set_attr "length" "8")])
6657 ;; Define the DImode operations that can be done in a small number
6658 ;; of instructions. The & constraints are to prevent the register
6659 ;; allocator from allocating registers that overlap with the inputs
6660 ;; (for example, having an input in 7,8 and an output in 6,7). We
6661 ;; also allow for the output being the same as one of the inputs.
6663 (define_insn "*adddi3_noppc64"
6664 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r")
6665 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,0,0")
6666 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I")))]
6667 "! TARGET_POWERPC64"
6670 if (WORDS_BIG_ENDIAN)
6671 return (GET_CODE (operands[2])) != CONST_INT
6672 ? \"addc %L0,%L1,%L2\;adde %0,%1,%2\"
6673 : \"addic %L0,%L1,%2\;add%G2e %0,%1\";
6675 return (GET_CODE (operands[2])) != CONST_INT
6676 ? \"addc %0,%1,%2\;adde %L0,%L1,%L2\"
6677 : \"addic %0,%1,%2\;add%G2e %L0,%L1\";
6679 [(set_attr "type" "two")
6680 (set_attr "length" "8")])
6682 (define_insn "*subdi3_noppc64"
6683 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r,r")
6684 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I,0,r,I")
6685 (match_operand:DI 2 "gpc_reg_operand" "r,r,r,0,0")))]
6686 "! TARGET_POWERPC64"
6689 if (WORDS_BIG_ENDIAN)
6690 return (GET_CODE (operands[1]) != CONST_INT)
6691 ? \"subfc %L0,%L2,%L1\;subfe %0,%2,%1\"
6692 : \"subfic %L0,%L2,%1\;subf%G1e %0,%2\";
6694 return (GET_CODE (operands[1]) != CONST_INT)
6695 ? \"subfc %0,%2,%1\;subfe %L0,%L2,%L1\"
6696 : \"subfic %0,%2,%1\;subf%G1e %L0,%L2\";
6698 [(set_attr "type" "two")
6699 (set_attr "length" "8")])
6701 (define_insn "*negdi2_noppc64"
6702 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6703 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))]
6704 "! TARGET_POWERPC64"
6707 return (WORDS_BIG_ENDIAN)
6708 ? \"subfic %L0,%L1,0\;subfze %0,%1\"
6709 : \"subfic %0,%1,0\;subfze %L0,%L1\";
6711 [(set_attr "type" "two")
6712 (set_attr "length" "8")])
6714 (define_insn "mulsidi3"
6715 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6716 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6717 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
6718 "! TARGET_POWERPC64"
6720 return (WORDS_BIG_ENDIAN)
6721 ? \"mulhw %0,%1,%2\;mullw %L0,%1,%2\"
6722 : \"mulhw %L0,%1,%2\;mullw %0,%1,%2\";
6724 [(set_attr "type" "mul")
6725 (set_attr "length" "8")])
6728 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6729 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6730 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6731 "! TARGET_POWERPC64 && reload_completed"
6734 (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
6735 (sign_extend:DI (match_dup 2)))
6738 (mult:SI (match_dup 1)
6742 int endian = (WORDS_BIG_ENDIAN == 0);
6743 operands[3] = operand_subword (operands[0], endian, 0, DImode);
6744 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
6747 (define_insn "umulsidi3"
6748 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6749 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6750 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
6751 "! TARGET_POWERPC64"
6754 return (WORDS_BIG_ENDIAN)
6755 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
6756 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
6758 [(set_attr "type" "mul")
6759 (set_attr "length" "8")])
6762 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6763 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6764 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6765 "! TARGET_POWERPC64 && reload_completed"
6768 (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
6769 (zero_extend:DI (match_dup 2)))
6772 (mult:SI (match_dup 1)
6776 int endian = (WORDS_BIG_ENDIAN == 0);
6777 operands[3] = operand_subword (operands[0], endian, 0, DImode);
6778 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
6781 (define_insn "smulsi3_highpart"
6782 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6784 (lshiftrt:DI (mult:DI (sign_extend:DI
6785 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6787 (match_operand:SI 2 "gpc_reg_operand" "r")))
6791 [(set_attr "type" "mul")])
6793 (define_insn "umulsi3_highpart"
6794 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6796 (lshiftrt:DI (mult:DI (zero_extend:DI
6797 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6799 (match_operand:SI 2 "gpc_reg_operand" "r")))
6803 [(set_attr "type" "mul")])
6805 ;; Shift by a variable amount is too complex to be worth open-coding. We
6806 ;; just handle shifts by constants.
6807 (define_insn "ashrdi3_no_power"
6808 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
6809 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6810 (match_operand:SI 2 "const_int_operand" "M,i")))]
6814 switch (which_alternative)
6819 if (WORDS_BIG_ENDIAN)
6820 return \"srawi %0,%1,31\;srawi %L0,%1,%h2\";
6822 return \"srawi %L0,%L1,31\;srawi %0,%L1,%h2\";
6824 if (WORDS_BIG_ENDIAN)
6825 return \"srwi %L0,%L1,%h2\;insrwi %L0,%1,%h2,0\;srawi %0,%1,%h2\";
6827 return \"srwi %0,%1,%h2\;insrwi %0,%L1,%h2,0\;srawi %L0,%L1,%h2\";
6830 [(set_attr "type" "two,three")
6831 (set_attr "length" "8,12")])
6833 (define_insn "*ashrdisi3_noppc64be"
6834 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6835 (subreg:SI (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6836 (const_int 32)) 4))]
6837 "TARGET_32BIT && !TARGET_POWERPC64 && WORDS_BIG_ENDIAN"
6840 if (REGNO (operands[0]) == REGNO (operands[1]))
6843 return \"mr %0,%1\";
6845 [(set_attr "length" "4")])
6848 ;; PowerPC64 DImode operations.
6850 (define_insn "muldi3"
6851 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6852 (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6853 (match_operand:DI 2 "reg_or_short_operand" "r,I")))]
6858 [(set_attr "type" "mul")
6860 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
6862 (match_operand:SI 2 "short_cint_operand" "")
6863 (const_string "16")]
6864 (const_string "64")))])
6866 (define_insn "*muldi3_internal1"
6867 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6868 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6869 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6871 (clobber (match_scratch:DI 3 "=r,r"))]
6876 [(set_attr "type" "mul")
6877 (set_attr "size" "64")
6878 (set_attr "dot" "yes")
6879 (set_attr "length" "4,8")])
6882 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6883 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
6884 (match_operand:DI 2 "gpc_reg_operand" ""))
6886 (clobber (match_scratch:DI 3 ""))]
6887 "TARGET_POWERPC64 && reload_completed"
6889 (mult:DI (match_dup 1) (match_dup 2)))
6891 (compare:CC (match_dup 3)
6895 (define_insn "*muldi3_internal2"
6896 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6897 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6898 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6900 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6901 (mult:DI (match_dup 1) (match_dup 2)))]
6906 [(set_attr "type" "mul")
6907 (set_attr "size" "64")
6908 (set_attr "dot" "yes")
6909 (set_attr "length" "4,8")])
6912 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
6913 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
6914 (match_operand:DI 2 "gpc_reg_operand" ""))
6916 (set (match_operand:DI 0 "gpc_reg_operand" "")
6917 (mult:DI (match_dup 1) (match_dup 2)))]
6918 "TARGET_POWERPC64 && reload_completed"
6920 (mult:DI (match_dup 1) (match_dup 2)))
6922 (compare:CC (match_dup 0)
6926 (define_insn "smuldi3_highpart"
6927 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6929 (lshiftrt:TI (mult:TI (sign_extend:TI
6930 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6932 (match_operand:DI 2 "gpc_reg_operand" "r")))
6936 [(set_attr "type" "mul")
6937 (set_attr "size" "64")])
6939 (define_insn "umuldi3_highpart"
6940 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6942 (lshiftrt:TI (mult:TI (zero_extend:TI
6943 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6945 (match_operand:DI 2 "gpc_reg_operand" "r")))
6949 [(set_attr "type" "mul")
6950 (set_attr "size" "64")])
6952 (define_expand "mulditi3"
6953 [(set (match_operand:TI 0 "gpc_reg_operand")
6954 (mult:TI (sign_extend:TI (match_operand:DI 1 "gpc_reg_operand"))
6955 (sign_extend:TI (match_operand:DI 2 "gpc_reg_operand"))))]
6958 rtx l = gen_reg_rtx (DImode), h = gen_reg_rtx (DImode);
6959 emit_insn (gen_muldi3 (l, operands[1], operands[2]));
6960 emit_insn (gen_smuldi3_highpart (h, operands[1], operands[2]));
6961 emit_move_insn (gen_lowpart (DImode, operands[0]), l);
6962 emit_move_insn (gen_highpart (DImode, operands[0]), h);
6966 (define_expand "umulditi3"
6967 [(set (match_operand:TI 0 "gpc_reg_operand")
6968 (mult:TI (zero_extend:TI (match_operand:DI 1 "gpc_reg_operand"))
6969 (zero_extend:TI (match_operand:DI 2 "gpc_reg_operand"))))]
6972 rtx l = gen_reg_rtx (DImode), h = gen_reg_rtx (DImode);
6973 emit_insn (gen_muldi3 (l, operands[1], operands[2]));
6974 emit_insn (gen_umuldi3_highpart (h, operands[1], operands[2]));
6975 emit_move_insn (gen_lowpart (DImode, operands[0]), l);
6976 emit_move_insn (gen_highpart (DImode, operands[0]), h);
6980 (define_insn "rotldi3"
6981 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6982 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6983 (match_operand:DI 2 "reg_or_cint_operand" "r,i")))]
6988 [(set_attr "type" "shift")
6989 (set_attr "var_shift" "yes,no")])
6991 (define_insn "*rotldi3_internal2"
6992 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
6993 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6994 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
6996 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7003 [(set_attr "type" "shift")
7004 (set_attr "var_shift" "yes,no,yes,no")
7005 (set_attr "dot" "yes")
7006 (set_attr "length" "4,4,8,8")])
7009 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7010 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7011 (match_operand:DI 2 "reg_or_cint_operand" ""))
7013 (clobber (match_scratch:DI 3 ""))]
7014 "TARGET_POWERPC64 && reload_completed"
7016 (rotate:DI (match_dup 1) (match_dup 2)))
7018 (compare:CC (match_dup 3)
7022 (define_insn "*rotldi3_internal3"
7023 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7024 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7025 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
7027 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7028 (rotate:DI (match_dup 1) (match_dup 2)))]
7035 [(set_attr "type" "shift")
7036 (set_attr "var_shift" "yes,no,yes,no")
7037 (set_attr "dot" "yes")
7038 (set_attr "length" "4,4,8,8")])
7041 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7042 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7043 (match_operand:DI 2 "reg_or_cint_operand" ""))
7045 (set (match_operand:DI 0 "gpc_reg_operand" "")
7046 (rotate:DI (match_dup 1) (match_dup 2)))]
7047 "TARGET_POWERPC64 && reload_completed"
7049 (rotate:DI (match_dup 1) (match_dup 2)))
7051 (compare:CC (match_dup 0)
7055 (define_insn "*rotldi3_internal4"
7056 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7057 (and:DI (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7058 (match_operand:DI 2 "reg_or_cint_operand" "r,i"))
7059 (match_operand:DI 3 "mask64_operand" "n,n")))]
7062 rldc%B3 %0,%1,%2,%S3
7063 rldic%B3 %0,%1,%H2,%S3"
7064 [(set_attr "type" "shift")
7065 (set_attr "var_shift" "yes,no")])
7067 (define_insn "*rotldi3_internal5"
7068 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7070 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7071 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
7072 (match_operand:DI 3 "mask64_operand" "n,n,n,n"))
7074 (clobber (match_scratch:DI 4 "=r,r,r,r"))]
7077 rldc%B3. %4,%1,%2,%S3
7078 rldic%B3. %4,%1,%H2,%S3
7081 [(set_attr "type" "shift")
7082 (set_attr "var_shift" "yes,no,yes,no")
7083 (set_attr "dot" "yes")
7084 (set_attr "length" "4,4,8,8")])
7087 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7089 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7090 (match_operand:DI 2 "reg_or_cint_operand" ""))
7091 (match_operand:DI 3 "mask64_operand" ""))
7093 (clobber (match_scratch:DI 4 ""))]
7094 "TARGET_POWERPC64 && reload_completed"
7096 (and:DI (rotate:DI (match_dup 1)
7100 (compare:CC (match_dup 4)
7104 (define_insn "*rotldi3_internal6"
7105 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
7107 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7108 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
7109 (match_operand:DI 3 "mask64_operand" "n,n,n,n"))
7111 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7112 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7115 rldc%B3. %0,%1,%2,%S3
7116 rldic%B3. %0,%1,%H2,%S3
7119 [(set_attr "type" "shift")
7120 (set_attr "var_shift" "yes,no,yes,no")
7121 (set_attr "dot" "yes")
7122 (set_attr "length" "4,4,8,8")])
7125 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
7127 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7128 (match_operand:DI 2 "reg_or_cint_operand" ""))
7129 (match_operand:DI 3 "mask64_operand" ""))
7131 (set (match_operand:DI 0 "gpc_reg_operand" "")
7132 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7133 "TARGET_POWERPC64 && reload_completed"
7135 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
7137 (compare:CC (match_dup 0)
7141 (define_insn "*rotldi3_internal7le"
7142 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7145 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7146 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
7147 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN"
7150 rldicl %0,%1,%H2,56"
7151 [(set_attr "type" "shift")
7152 (set_attr "var_shift" "yes,no")])
7154 (define_insn "*rotldi3_internal7be"
7155 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7158 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7159 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 7)))]
7160 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN"
7163 rldicl %0,%1,%H2,56"
7164 [(set_attr "type" "shift")
7165 (set_attr "var_shift" "yes,no")])
7167 (define_insn "*rotldi3_internal8le"
7168 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7169 (compare:CC (zero_extend:DI
7171 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7172 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7174 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7175 "TARGET_64BIT && !BYTES_BIG_ENDIAN"
7178 rldicl. %3,%1,%H2,56
7181 [(set_attr "type" "shift")
7182 (set_attr "var_shift" "yes,no,yes,no")
7183 (set_attr "dot" "yes")
7184 (set_attr "length" "4,4,8,8")])
7186 (define_insn "*rotldi3_internal8be"
7187 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7188 (compare:CC (zero_extend:DI
7190 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7191 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 7))
7193 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7194 "TARGET_64BIT && BYTES_BIG_ENDIAN"
7197 rldicl. %3,%1,%H2,56
7200 [(set_attr "type" "shift")
7201 (set_attr "var_shift" "yes,no,yes,no")
7202 (set_attr "dot" "yes")
7203 (set_attr "length" "4,4,8,8")])
7206 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7207 (compare:CC (zero_extend:DI
7209 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7210 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7212 (clobber (match_scratch:DI 3 ""))]
7213 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN && reload_completed"
7215 (zero_extend:DI (subreg:QI
7216 (rotate:DI (match_dup 1)
7219 (compare:CC (match_dup 3)
7224 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7225 (compare:CC (zero_extend:DI
7227 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7228 (match_operand:DI 2 "reg_or_cint_operand" "")) 7))
7230 (clobber (match_scratch:DI 3 ""))]
7231 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN && reload_completed"
7233 (zero_extend:DI (subreg:QI
7234 (rotate:DI (match_dup 1)
7237 (compare:CC (match_dup 3)
7241 (define_insn "*rotldi3_internal9le"
7242 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7243 (compare:CC (zero_extend:DI
7245 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7246 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7248 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7249 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7250 "TARGET_64BIT && !BYTES_BIG_ENDIAN"
7253 rldicl. %0,%1,%H2,56
7256 [(set_attr "type" "shift")
7257 (set_attr "var_shift" "yes,no,yes,no")
7258 (set_attr "dot" "yes")
7259 (set_attr "length" "4,4,8,8")])
7261 (define_insn "*rotldi3_internal9be"
7262 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7263 (compare:CC (zero_extend:DI
7265 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7266 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 7))
7268 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7269 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 7)))]
7270 "TARGET_64BIT && BYTES_BIG_ENDIAN"
7273 rldicl. %0,%1,%H2,56
7276 [(set_attr "type" "shift")
7277 (set_attr "var_shift" "yes,no,yes,no")
7278 (set_attr "dot" "yes")
7279 (set_attr "length" "4,4,8,8")])
7282 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7283 (compare:CC (zero_extend:DI
7285 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7286 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7288 (set (match_operand:DI 0 "gpc_reg_operand" "")
7289 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7290 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN && reload_completed"
7292 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
7294 (compare:CC (match_dup 0)
7299 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7300 (compare:CC (zero_extend:DI
7302 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7303 (match_operand:DI 2 "reg_or_cint_operand" "")) 7))
7305 (set (match_operand:DI 0 "gpc_reg_operand" "")
7306 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 7)))]
7307 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN && reload_completed"
7309 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 7)))
7311 (compare:CC (match_dup 0)
7315 (define_insn "*rotldi3_internal10le"
7316 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7319 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7320 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
7321 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN"
7324 rldicl %0,%1,%H2,48"
7325 [(set_attr "type" "shift")
7326 (set_attr "var_shift" "yes,no")])
7328 (define_insn "*rotldi3_internal10be"
7329 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7332 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7333 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 6)))]
7334 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN"
7337 rldicl %0,%1,%H2,48"
7338 [(set_attr "type" "shift")
7339 (set_attr "var_shift" "yes,no")])
7341 (define_insn "*rotldi3_internal11le"
7342 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7343 (compare:CC (zero_extend:DI
7345 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7346 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7348 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7349 "TARGET_64BIT && !BYTES_BIG_ENDIAN"
7352 rldicl. %3,%1,%H2,48
7355 [(set_attr "type" "shift")
7356 (set_attr "var_shift" "yes,no,yes,no")
7357 (set_attr "dot" "yes")
7358 (set_attr "length" "4,4,8,8")])
7360 (define_insn "*rotldi3_internal11be"
7361 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7362 (compare:CC (zero_extend:DI
7364 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7365 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 6))
7367 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7368 "TARGET_64BIT && BYTES_BIG_ENDIAN"
7371 rldicl. %3,%1,%H2,48
7374 [(set_attr "type" "shift")
7375 (set_attr "var_shift" "yes,no,yes,no")
7376 (set_attr "dot" "yes")
7377 (set_attr "length" "4,4,8,8")])
7380 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7381 (compare:CC (zero_extend:DI
7383 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7384 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7386 (clobber (match_scratch:DI 3 ""))]
7387 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN && reload_completed"
7389 (zero_extend:DI (subreg:HI
7390 (rotate:DI (match_dup 1)
7393 (compare:CC (match_dup 3)
7398 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7399 (compare:CC (zero_extend:DI
7401 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7402 (match_operand:DI 2 "reg_or_cint_operand" "")) 6))
7404 (clobber (match_scratch:DI 3 ""))]
7405 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN && reload_completed"
7407 (zero_extend:DI (subreg:HI
7408 (rotate:DI (match_dup 1)
7411 (compare:CC (match_dup 3)
7415 (define_insn "*rotldi3_internal12le"
7416 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7417 (compare:CC (zero_extend:DI
7419 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7420 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7422 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7423 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7424 "TARGET_64BIT && !BYTES_BIG_ENDIAN"
7427 rldicl. %0,%1,%H2,48
7430 [(set_attr "type" "shift")
7431 (set_attr "var_shift" "yes,no,yes,no")
7432 (set_attr "dot" "yes")
7433 (set_attr "length" "4,4,8,8")])
7435 (define_insn "*rotldi3_internal12be"
7436 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7437 (compare:CC (zero_extend:DI
7439 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7440 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 6))
7442 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7443 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 6)))]
7444 "TARGET_64BIT && BYTES_BIG_ENDIAN"
7447 rldicl. %0,%1,%H2,48
7450 [(set_attr "type" "shift")
7451 (set_attr "var_shift" "yes,no,yes,no")
7452 (set_attr "dot" "yes")
7453 (set_attr "length" "4,4,8,8")])
7456 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7457 (compare:CC (zero_extend:DI
7459 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7460 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7462 (set (match_operand:DI 0 "gpc_reg_operand" "")
7463 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7464 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN && reload_completed"
7466 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
7468 (compare:CC (match_dup 0)
7473 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7474 (compare:CC (zero_extend:DI
7476 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7477 (match_operand:DI 2 "reg_or_cint_operand" "")) 6))
7479 (set (match_operand:DI 0 "gpc_reg_operand" "")
7480 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 6)))]
7481 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN && reload_completed"
7483 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 6)))
7485 (compare:CC (match_dup 0)
7489 (define_insn "*rotldi3_internal13le"
7490 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7493 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7494 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
7495 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN"
7498 rldicl %0,%1,%H2,32"
7499 [(set_attr "type" "shift")
7500 (set_attr "var_shift" "yes,no")])
7502 (define_insn "*rotldi3_internal13be"
7503 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7506 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7507 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 4)))]
7508 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN"
7511 rldicl %0,%1,%H2,32"
7512 [(set_attr "type" "shift")
7513 (set_attr "var_shift" "yes,no")])
7515 (define_insn "*rotldi3_internal14le"
7516 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7517 (compare:CC (zero_extend:DI
7519 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7520 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7522 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7523 "TARGET_64BIT && !BYTES_BIG_ENDIAN"
7526 rldicl. %3,%1,%H2,32
7529 [(set_attr "type" "shift")
7530 (set_attr "var_shift" "yes,no,yes,no")
7531 (set_attr "dot" "yes")
7532 (set_attr "length" "4,4,8,8")])
7534 (define_insn "*rotldi3_internal14be"
7535 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7536 (compare:CC (zero_extend:DI
7538 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7539 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 4))
7541 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7542 "TARGET_64BIT && BYTES_BIG_ENDIAN"
7545 rldicl. %3,%1,%H2,32
7548 [(set_attr "type" "shift")
7549 (set_attr "var_shift" "yes,no,yes,no")
7550 (set_attr "dot" "yes")
7551 (set_attr "length" "4,4,8,8")])
7554 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7555 (compare:CC (zero_extend:DI
7557 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7558 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7560 (clobber (match_scratch:DI 3 ""))]
7561 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN && reload_completed"
7563 (zero_extend:DI (subreg:SI
7564 (rotate:DI (match_dup 1)
7567 (compare:CC (match_dup 3)
7572 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7573 (compare:CC (zero_extend:DI
7575 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7576 (match_operand:DI 2 "reg_or_cint_operand" "")) 4))
7578 (clobber (match_scratch:DI 3 ""))]
7579 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN && reload_completed"
7581 (zero_extend:DI (subreg:SI
7582 (rotate:DI (match_dup 1)
7585 (compare:CC (match_dup 3)
7589 (define_insn "*rotldi3_internal15le"
7590 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7591 (compare:CC (zero_extend:DI
7593 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7594 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7596 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7597 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7598 "TARGET_64BIT && !BYTES_BIG_ENDIAN"
7601 rldicl. %0,%1,%H2,32
7604 [(set_attr "type" "shift")
7605 (set_attr "var_shift" "yes,no,yes,no")
7606 (set_attr "dot" "yes")
7607 (set_attr "length" "4,4,8,8")])
7609 (define_insn "*rotldi3_internal15be"
7610 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7611 (compare:CC (zero_extend:DI
7613 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7614 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 4))
7616 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7617 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 4)))]
7618 "TARGET_64BIT && BYTES_BIG_ENDIAN"
7621 rldicl. %0,%1,%H2,32
7624 [(set_attr "type" "shift")
7625 (set_attr "var_shift" "yes,no,yes,no")
7626 (set_attr "dot" "yes")
7627 (set_attr "length" "4,4,8,8")])
7630 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7631 (compare:CC (zero_extend:DI
7633 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7634 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7636 (set (match_operand:DI 0 "gpc_reg_operand" "")
7637 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7638 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN && reload_completed"
7640 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
7642 (compare:CC (match_dup 0)
7647 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7648 (compare:CC (zero_extend:DI
7650 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7651 (match_operand:DI 2 "reg_or_cint_operand" "")) 4))
7653 (set (match_operand:DI 0 "gpc_reg_operand" "")
7654 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 4)))]
7655 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN && reload_completed"
7657 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 4)))
7659 (compare:CC (match_dup 0)
7663 (define_expand "ashldi3"
7664 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7665 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7666 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7670 (define_insn "*ashldi3_internal1"
7671 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7672 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7673 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
7678 [(set_attr "type" "shift")
7679 (set_attr "var_shift" "yes,no")])
7681 (define_insn "*ashldi3_internal2"
7682 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7683 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7684 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7686 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7693 [(set_attr "type" "shift")
7694 (set_attr "var_shift" "yes,no,yes,no")
7695 (set_attr "dot" "yes")
7696 (set_attr "length" "4,4,8,8")])
7699 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7700 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7701 (match_operand:SI 2 "reg_or_cint_operand" ""))
7703 (clobber (match_scratch:DI 3 ""))]
7704 "TARGET_POWERPC64 && reload_completed"
7706 (ashift:DI (match_dup 1) (match_dup 2)))
7708 (compare:CC (match_dup 3)
7712 (define_insn "*ashldi3_internal3"
7713 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7714 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7715 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7717 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7718 (ashift:DI (match_dup 1) (match_dup 2)))]
7725 [(set_attr "type" "shift")
7726 (set_attr "var_shift" "yes,no,yes,no")
7727 (set_attr "dot" "yes")
7728 (set_attr "length" "4,4,8,8")])
7731 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7732 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7733 (match_operand:SI 2 "reg_or_cint_operand" ""))
7735 (set (match_operand:DI 0 "gpc_reg_operand" "")
7736 (ashift:DI (match_dup 1) (match_dup 2)))]
7737 "TARGET_POWERPC64 && reload_completed"
7739 (ashift:DI (match_dup 1) (match_dup 2)))
7741 (compare:CC (match_dup 0)
7745 (define_insn "*ashldi3_internal4"
7746 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7747 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7748 (match_operand:SI 2 "const_int_operand" "i"))
7749 (match_operand:DI 3 "const_int_operand" "n")))]
7750 "TARGET_POWERPC64 && includes_rldic_lshift_p (operands[2], operands[3])"
7751 "rldic %0,%1,%H2,%W3"
7752 [(set_attr "type" "shift")])
7754 (define_insn "ashldi3_internal5"
7755 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7757 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7758 (match_operand:SI 2 "const_int_operand" "i,i"))
7759 (match_operand:DI 3 "const_int_operand" "n,n"))
7761 (clobber (match_scratch:DI 4 "=r,r"))]
7762 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
7764 rldic. %4,%1,%H2,%W3
7766 [(set_attr "type" "shift")
7767 (set_attr "dot" "yes")
7768 (set_attr "length" "4,8")])
7771 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7773 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7774 (match_operand:SI 2 "const_int_operand" ""))
7775 (match_operand:DI 3 "const_int_operand" ""))
7777 (clobber (match_scratch:DI 4 ""))]
7778 "TARGET_POWERPC64 && reload_completed
7779 && includes_rldic_lshift_p (operands[2], operands[3])"
7781 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7784 (compare:CC (match_dup 4)
7788 (define_insn "*ashldi3_internal6"
7789 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
7791 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7792 (match_operand:SI 2 "const_int_operand" "i,i"))
7793 (match_operand:DI 3 "const_int_operand" "n,n"))
7795 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7796 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7797 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
7799 rldic. %0,%1,%H2,%W3
7801 [(set_attr "type" "shift")
7802 (set_attr "dot" "yes")
7803 (set_attr "length" "4,8")])
7806 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
7808 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7809 (match_operand:SI 2 "const_int_operand" ""))
7810 (match_operand:DI 3 "const_int_operand" ""))
7812 (set (match_operand:DI 0 "gpc_reg_operand" "")
7813 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7814 "TARGET_POWERPC64 && reload_completed
7815 && includes_rldic_lshift_p (operands[2], operands[3])"
7817 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7820 (compare:CC (match_dup 0)
7824 (define_insn "*ashldi3_internal7"
7825 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7826 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7827 (match_operand:SI 2 "const_int_operand" "i"))
7828 (match_operand:DI 3 "mask64_operand" "n")))]
7829 "TARGET_POWERPC64 && includes_rldicr_lshift_p (operands[2], operands[3])"
7830 "rldicr %0,%1,%H2,%S3"
7831 [(set_attr "type" "shift")])
7833 (define_insn "ashldi3_internal8"
7834 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7836 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7837 (match_operand:SI 2 "const_int_operand" "i,i"))
7838 (match_operand:DI 3 "mask64_operand" "n,n"))
7840 (clobber (match_scratch:DI 4 "=r,r"))]
7841 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
7843 rldicr. %4,%1,%H2,%S3
7845 [(set_attr "type" "shift")
7846 (set_attr "dot" "yes")
7847 (set_attr "length" "4,8")])
7850 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7852 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7853 (match_operand:SI 2 "const_int_operand" ""))
7854 (match_operand:DI 3 "mask64_operand" ""))
7856 (clobber (match_scratch:DI 4 ""))]
7857 "TARGET_POWERPC64 && reload_completed
7858 && includes_rldicr_lshift_p (operands[2], operands[3])"
7860 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7863 (compare:CC (match_dup 4)
7867 (define_insn "*ashldi3_internal9"
7868 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
7870 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7871 (match_operand:SI 2 "const_int_operand" "i,i"))
7872 (match_operand:DI 3 "mask64_operand" "n,n"))
7874 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7875 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7876 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
7878 rldicr. %0,%1,%H2,%S3
7880 [(set_attr "type" "shift")
7881 (set_attr "dot" "yes")
7882 (set_attr "length" "4,8")])
7885 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
7887 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7888 (match_operand:SI 2 "const_int_operand" ""))
7889 (match_operand:DI 3 "mask64_operand" ""))
7891 (set (match_operand:DI 0 "gpc_reg_operand" "")
7892 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7893 "TARGET_POWERPC64 && reload_completed
7894 && includes_rldicr_lshift_p (operands[2], operands[3])"
7896 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7899 (compare:CC (match_dup 0)
7903 (define_expand "lshrdi3"
7904 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7905 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7906 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7910 (define_insn "*lshrdi3_internal1"
7911 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7912 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7913 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
7918 [(set_attr "type" "shift")
7919 (set_attr "var_shift" "yes,no")])
7921 (define_insn "*lshrdi3_internal2"
7922 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7923 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7924 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7926 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7933 [(set_attr "type" "shift")
7934 (set_attr "var_shift" "yes,no,yes,no")
7935 (set_attr "dot" "yes")
7936 (set_attr "length" "4,4,8,8")])
7939 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7940 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7941 (match_operand:SI 2 "reg_or_cint_operand" ""))
7943 (clobber (match_scratch:DI 3 ""))]
7944 "TARGET_POWERPC64 && reload_completed"
7946 (lshiftrt:DI (match_dup 1) (match_dup 2)))
7948 (compare:CC (match_dup 3)
7952 (define_insn "*lshrdi3_internal3"
7953 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7954 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7955 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7957 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7958 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
7965 [(set_attr "type" "shift")
7966 (set_attr "var_shift" "yes,no,yes,no")
7967 (set_attr "dot" "yes")
7968 (set_attr "length" "4,4,8,8")])
7971 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7972 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7973 (match_operand:SI 2 "reg_or_cint_operand" ""))
7975 (set (match_operand:DI 0 "gpc_reg_operand" "")
7976 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
7977 "TARGET_POWERPC64 && reload_completed"
7979 (lshiftrt:DI (match_dup 1) (match_dup 2)))
7981 (compare:CC (match_dup 0)
7985 (define_expand "ashrdi3"
7986 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7987 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7988 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7992 if (TARGET_POWERPC64)
7994 else if (GET_CODE (operands[2]) == CONST_INT)
7996 emit_insn (gen_ashrdi3_no_power (operands[0], operands[1], operands[2]));
8003 (define_insn "*ashrdi3_internal1"
8004 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8005 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
8006 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
8011 [(set_attr "type" "shift")
8012 (set_attr "var_shift" "yes,no")])
8014 (define_insn "*ashrdi3_internal2"
8015 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
8016 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8017 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
8019 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
8026 [(set_attr "type" "shift")
8027 (set_attr "var_shift" "yes,no,yes,no")
8028 (set_attr "dot" "yes")
8029 (set_attr "length" "4,4,8,8")])
8032 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
8033 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
8034 (match_operand:SI 2 "reg_or_cint_operand" ""))
8036 (clobber (match_scratch:DI 3 ""))]
8037 "TARGET_POWERPC64 && reload_completed"
8039 (ashiftrt:DI (match_dup 1) (match_dup 2)))
8041 (compare:CC (match_dup 3)
8045 (define_insn "*ashrdi3_internal3"
8046 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
8047 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8048 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
8050 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
8051 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
8058 [(set_attr "type" "shift")
8059 (set_attr "var_shift" "yes,no,yes,no")
8060 (set_attr "dot" "yes")
8061 (set_attr "length" "4,4,8,8")])
8064 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
8065 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
8066 (match_operand:SI 2 "reg_or_cint_operand" ""))
8068 (set (match_operand:DI 0 "gpc_reg_operand" "")
8069 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
8070 "TARGET_POWERPC64 && reload_completed"
8072 (ashiftrt:DI (match_dup 1) (match_dup 2)))
8074 (compare:CC (match_dup 0)
8078 (define_expand "anddi3"
8080 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8081 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8082 (match_operand:DI 2 "reg_or_cint_operand" "")))
8083 (clobber (match_scratch:CC 3 ""))])]
8086 if (!TARGET_POWERPC64)
8088 rtx cc = gen_rtx_SCRATCH (CCmode);
8089 rs6000_split_logical (operands, AND, false, false, false, cc);
8092 else if (!and64_2_operand (operands[2], DImode))
8093 operands[2] = force_reg (DImode, operands[2]);
8096 (define_insn "anddi3_mc"
8097 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
8098 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r")
8099 (match_operand:DI 2 "and64_2_operand" "?r,S,T,K,J,t")))
8100 (clobber (match_scratch:CC 3 "=X,X,X,x,x,X"))]
8101 "TARGET_POWERPC64 && rs6000_gen_cell_microcode"
8104 rldic%B2 %0,%1,0,%S2
8105 rlwinm %0,%1,0,%m2,%M2
8109 [(set_attr "type" "*,shift,shift,logical,logical,*")
8110 (set_attr "dot" "no,no,no,yes,yes,no")
8111 (set_attr "length" "4,4,4,4,4,8")])
8113 (define_insn "anddi3_nomc"
8114 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
8115 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r")
8116 (match_operand:DI 2 "and64_2_operand" "?r,S,T,t")))
8117 (clobber (match_scratch:CC 3 "=X,X,X,X"))]
8118 "TARGET_POWERPC64 && !rs6000_gen_cell_microcode"
8121 rldic%B2 %0,%1,0,%S2
8122 rlwinm %0,%1,0,%m2,%M2
8124 [(set_attr "type" "*,shift,shift,*")
8125 (set_attr "length" "4,4,4,8")])
8128 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8129 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8130 (match_operand:DI 2 "mask64_2_operand" "")))
8131 (clobber (match_scratch:CC 3 ""))]
8133 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
8134 && !mask_operand (operands[2], DImode)
8135 && !mask64_operand (operands[2], DImode)"
8137 (and:DI (rotate:DI (match_dup 1)
8141 (and:DI (rotate:DI (match_dup 0)
8145 build_mask64_2_operands (operands[2], &operands[4]);
8148 (define_insn "*anddi3_internal2_mc"
8149 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,x,?y,?y,?y,??y,??y,?y")
8150 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r,r,r")
8151 (match_operand:DI 2 "and64_2_operand" "r,S,T,K,J,t,r,S,T,K,J,t"))
8153 (clobber (match_scratch:DI 3 "=r,r,r,r,r,r,r,r,r,r,r,r"))
8154 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,X,X,x,x,X"))]
8155 "TARGET_64BIT && rs6000_gen_cell_microcode"
8158 rldic%B2. %3,%1,0,%S2
8159 rlwinm. %3,%1,0,%m2,%M2
8169 [(set_attr "type" "logical,shift,shift,logical,\
8170 logical,compare,compare,compare,compare,compare,\
8172 (set_attr "dot" "yes")
8173 (set_attr "length" "4,4,4,4,4,8,8,8,8,8,8,12")])
8176 [(set (match_operand:CC 0 "cc_reg_operand" "")
8177 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8178 (match_operand:DI 2 "mask64_2_operand" ""))
8180 (clobber (match_scratch:DI 3 ""))
8181 (clobber (match_scratch:CC 4 ""))]
8182 "TARGET_64BIT && reload_completed
8183 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
8184 && !mask_operand (operands[2], DImode)
8185 && !mask64_operand (operands[2], DImode)"
8187 (and:DI (rotate:DI (match_dup 1)
8190 (parallel [(set (match_dup 0)
8191 (compare:CC (and:DI (rotate:DI (match_dup 3)
8195 (clobber (match_dup 3))])]
8198 build_mask64_2_operands (operands[2], &operands[5]);
8201 (define_insn "*anddi3_internal3_mc"
8202 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,x,x,?y,?y,?y,??y,??y,?y")
8203 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r,r,r")
8204 (match_operand:DI 2 "and64_2_operand" "r,S,T,K,J,t,r,S,T,K,J,t"))
8206 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r,r,r")
8207 (and:DI (match_dup 1) (match_dup 2)))
8208 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,X,X,x,x,X"))]
8209 "TARGET_64BIT && rs6000_gen_cell_microcode"
8212 rldic%B2. %0,%1,0,%S2
8213 rlwinm. %0,%1,0,%m2,%M2
8223 [(set_attr "type" "logical,shift,shift,logical,\
8224 logical,compare,compare,compare,compare,compare,\
8226 (set_attr "dot" "yes")
8227 (set_attr "length" "4,4,4,4,4,8,8,8,8,8,8,12")])
8230 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8231 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8232 (match_operand:DI 2 "and64_2_operand" ""))
8234 (set (match_operand:DI 0 "gpc_reg_operand" "")
8235 (and:DI (match_dup 1) (match_dup 2)))
8236 (clobber (match_scratch:CC 4 ""))]
8237 "TARGET_64BIT && reload_completed"
8238 [(parallel [(set (match_dup 0)
8239 (and:DI (match_dup 1) (match_dup 2)))
8240 (clobber (match_dup 4))])
8242 (compare:CC (match_dup 0)
8247 [(set (match_operand:CC 3 "cc_reg_operand" "")
8248 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8249 (match_operand:DI 2 "mask64_2_operand" ""))
8251 (set (match_operand:DI 0 "gpc_reg_operand" "")
8252 (and:DI (match_dup 1) (match_dup 2)))
8253 (clobber (match_scratch:CC 4 ""))]
8254 "TARGET_64BIT && reload_completed
8255 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
8256 && !mask_operand (operands[2], DImode)
8257 && !mask64_operand (operands[2], DImode)"
8259 (and:DI (rotate:DI (match_dup 1)
8262 (parallel [(set (match_dup 3)
8263 (compare:CC (and:DI (rotate:DI (match_dup 0)
8268 (and:DI (rotate:DI (match_dup 0)
8273 build_mask64_2_operands (operands[2], &operands[5]);
8276 (define_expand "iordi3"
8277 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8278 (ior:DI (match_operand:DI 1 "gpc_reg_operand" "")
8279 (match_operand:DI 2 "reg_or_cint_operand" "")))]
8282 if (!TARGET_POWERPC64)
8284 rs6000_split_logical (operands, IOR, false, false, false, NULL_RTX);
8287 else if (!reg_or_logical_cint_operand (operands[2], DImode))
8288 operands[2] = force_reg (DImode, operands[2]);
8289 else if (non_logical_cint_operand (operands[2], DImode))
8291 HOST_WIDE_INT value;
8292 rtx tmp = ((!can_create_pseudo_p ()
8293 || rtx_equal_p (operands[0], operands[1]))
8294 ? operands[0] : gen_reg_rtx (DImode));
8296 value = INTVAL (operands[2]);
8297 emit_insn (gen_iordi3 (tmp, operands[1],
8298 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
8300 emit_insn (gen_iordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
8305 (define_expand "xordi3"
8306 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8307 (xor:DI (match_operand:DI 1 "gpc_reg_operand" "")
8308 (match_operand:DI 2 "reg_or_cint_operand" "")))]
8311 if (!TARGET_POWERPC64)
8313 rs6000_split_logical (operands, XOR, false, false, false, NULL_RTX);
8316 else if (!reg_or_logical_cint_operand (operands[2], DImode))
8317 operands[2] = force_reg (DImode, operands[2]);
8318 if (non_logical_cint_operand (operands[2], DImode))
8320 HOST_WIDE_INT value;
8321 rtx tmp = ((!can_create_pseudo_p ()
8322 || rtx_equal_p (operands[0], operands[1]))
8323 ? operands[0] : gen_reg_rtx (DImode));
8325 value = INTVAL (operands[2]);
8326 emit_insn (gen_xordi3 (tmp, operands[1],
8327 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
8329 emit_insn (gen_xordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
8334 (define_insn "*booldi3_internal1"
8335 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
8336 (match_operator:DI 3 "boolean_or_operator"
8337 [(match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
8338 (match_operand:DI 2 "logical_operand" "r,K,JF")]))]
8345 (define_insn "*booldi3_internal2"
8346 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
8347 (compare:CC (match_operator:DI 4 "boolean_or_operator"
8348 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
8349 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
8351 (clobber (match_scratch:DI 3 "=r,r"))]
8356 [(set_attr "type" "logical,compare")
8357 (set_attr "dot" "yes")
8358 (set_attr "length" "4,8")])
8361 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8362 (compare:CC (match_operator:DI 4 "boolean_operator"
8363 [(match_operand:DI 1 "gpc_reg_operand" "")
8364 (match_operand:DI 2 "gpc_reg_operand" "")])
8366 (clobber (match_scratch:DI 3 ""))]
8367 "TARGET_POWERPC64 && reload_completed"
8368 [(set (match_dup 3) (match_dup 4))
8370 (compare:CC (match_dup 3)
8374 (define_insn "*booldi3_internal3"
8375 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
8376 (compare:CC (match_operator:DI 4 "boolean_or_operator"
8377 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
8378 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
8380 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8386 [(set_attr "type" "logical,compare")
8387 (set_attr "dot" "yes")
8388 (set_attr "length" "4,8")])
8391 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8392 (compare:CC (match_operator:DI 4 "boolean_operator"
8393 [(match_operand:DI 1 "gpc_reg_operand" "")
8394 (match_operand:DI 2 "gpc_reg_operand" "")])
8396 (set (match_operand:DI 0 "gpc_reg_operand" "")
8398 "TARGET_POWERPC64 && reload_completed"
8399 [(set (match_dup 0) (match_dup 4))
8401 (compare:CC (match_dup 0)
8405 ;; Split a logical operation that we can't do in one insn into two insns,
8406 ;; each of which does one 16-bit part. This is used by combine.
8409 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8410 (match_operator:DI 3 "boolean_or_operator"
8411 [(match_operand:DI 1 "gpc_reg_operand" "")
8412 (match_operand:DI 2 "non_logical_cint_operand" "")]))]
8414 [(set (match_dup 0) (match_dup 4))
8415 (set (match_dup 0) (match_dup 5))]
8420 i3 = GEN_INT (INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff));
8421 i4 = GEN_INT (INTVAL (operands[2]) & 0xffff);
8422 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
8424 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
8428 (define_insn "*boolcdi3_internal1"
8429 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
8430 (match_operator:DI 3 "boolean_operator"
8431 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
8432 (match_operand:DI 2 "gpc_reg_operand" "r")]))]
8436 (define_insn "*boolcdi3_internal2"
8437 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
8438 (compare:CC (match_operator:DI 4 "boolean_operator"
8439 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
8440 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
8442 (clobber (match_scratch:DI 3 "=r,r"))]
8447 [(set_attr "type" "logical,compare")
8448 (set_attr "dot" "yes")
8449 (set_attr "length" "4,8")])
8452 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8453 (compare:CC (match_operator:DI 4 "boolean_operator"
8454 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
8455 (match_operand:DI 2 "gpc_reg_operand" "")])
8457 (clobber (match_scratch:DI 3 ""))]
8458 "TARGET_POWERPC64 && reload_completed"
8459 [(set (match_dup 3) (match_dup 4))
8461 (compare:CC (match_dup 3)
8465 (define_insn "*boolcdi3_internal3"
8466 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
8467 (compare:CC (match_operator:DI 4 "boolean_operator"
8468 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
8469 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
8471 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8477 [(set_attr "type" "logical,compare")
8478 (set_attr "dot" "yes")
8479 (set_attr "length" "4,8")])
8482 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8483 (compare:CC (match_operator:DI 4 "boolean_operator"
8484 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
8485 (match_operand:DI 2 "gpc_reg_operand" "")])
8487 (set (match_operand:DI 0 "gpc_reg_operand" "")
8489 "TARGET_POWERPC64 && reload_completed"
8490 [(set (match_dup 0) (match_dup 4))
8492 (compare:CC (match_dup 0)
8496 (define_insn "*boolccdi3_internal1"
8497 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
8498 (match_operator:DI 3 "boolean_operator"
8499 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
8500 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r"))]))]
8504 (define_insn "*boolccdi3_internal2"
8505 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
8506 (compare:CC (match_operator:DI 4 "boolean_operator"
8507 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
8508 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
8510 (clobber (match_scratch:DI 3 "=r,r"))]
8515 [(set_attr "type" "logical,compare")
8516 (set_attr "dot" "yes")
8517 (set_attr "length" "4,8")])
8520 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8521 (compare:CC (match_operator:DI 4 "boolean_operator"
8522 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
8523 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
8525 (clobber (match_scratch:DI 3 ""))]
8526 "TARGET_POWERPC64 && reload_completed"
8527 [(set (match_dup 3) (match_dup 4))
8529 (compare:CC (match_dup 3)
8533 (define_insn "*boolccdi3_internal3"
8534 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
8535 (compare:CC (match_operator:DI 4 "boolean_operator"
8536 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
8537 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
8539 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8545 [(set_attr "type" "logical,compare")
8546 (set_attr "dot" "yes")
8547 (set_attr "length" "4,8")])
8550 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8551 (compare:CC (match_operator:DI 4 "boolean_operator"
8552 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
8553 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
8555 (set (match_operand:DI 0 "gpc_reg_operand" "")
8557 "TARGET_POWERPC64 && reload_completed"
8558 [(set (match_dup 0) (match_dup 4))
8560 (compare:CC (match_dup 0)
8565 (define_insn "*eqv<mode>3"
8566 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
8568 (xor:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
8569 (match_operand:GPR 2 "gpc_reg_operand" "r"))))]
8572 [(set_attr "type" "integer")
8573 (set_attr "length" "4")])
8576 ;; 128-bit logical operations expanders
8578 (define_expand "and<mode>3"
8579 [(parallel [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
8581 (match_operand:BOOL_128 1 "vlogical_operand" "")
8582 (match_operand:BOOL_128 2 "vlogical_operand" "")))
8583 (clobber (match_scratch:CC 3 ""))])]
8587 (define_expand "ior<mode>3"
8588 [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
8589 (ior:BOOL_128 (match_operand:BOOL_128 1 "vlogical_operand" "")
8590 (match_operand:BOOL_128 2 "vlogical_operand" "")))]
8594 (define_expand "xor<mode>3"
8595 [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
8596 (xor:BOOL_128 (match_operand:BOOL_128 1 "vlogical_operand" "")
8597 (match_operand:BOOL_128 2 "vlogical_operand" "")))]
8601 (define_expand "one_cmpl<mode>2"
8602 [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
8603 (not:BOOL_128 (match_operand:BOOL_128 1 "vlogical_operand" "")))]
8607 (define_expand "nor<mode>3"
8608 [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
8610 (not:BOOL_128 (match_operand:BOOL_128 1 "vlogical_operand" ""))
8611 (not:BOOL_128 (match_operand:BOOL_128 2 "vlogical_operand" ""))))]
8615 (define_expand "andc<mode>3"
8616 [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
8618 (not:BOOL_128 (match_operand:BOOL_128 2 "vlogical_operand" ""))
8619 (match_operand:BOOL_128 1 "vlogical_operand" "")))]
8623 ;; Power8 vector logical instructions.
8624 (define_expand "eqv<mode>3"
8625 [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
8627 (xor:BOOL_128 (match_operand:BOOL_128 1 "vlogical_operand" "")
8628 (match_operand:BOOL_128 2 "vlogical_operand" ""))))]
8629 "<MODE>mode == TImode || <MODE>mode == PTImode || TARGET_P8_VECTOR"
8632 ;; Rewrite nand into canonical form
8633 (define_expand "nand<mode>3"
8634 [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
8636 (not:BOOL_128 (match_operand:BOOL_128 1 "vlogical_operand" ""))
8637 (not:BOOL_128 (match_operand:BOOL_128 2 "vlogical_operand" ""))))]
8638 "<MODE>mode == TImode || <MODE>mode == PTImode || TARGET_P8_VECTOR"
8641 ;; The canonical form is to have the negated element first, so we need to
8642 ;; reverse arguments.
8643 (define_expand "orc<mode>3"
8644 [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
8646 (not:BOOL_128 (match_operand:BOOL_128 2 "vlogical_operand" ""))
8647 (match_operand:BOOL_128 1 "vlogical_operand" "")))]
8648 "<MODE>mode == TImode || <MODE>mode == PTImode || TARGET_P8_VECTOR"
8651 ;; 128-bit logical operations insns and split operations
8652 (define_insn_and_split "*and<mode>3_internal"
8653 [(set (match_operand:BOOL_128 0 "vlogical_operand" "=<BOOL_REGS_OUTPUT>")
8655 (match_operand:BOOL_128 1 "vlogical_operand" "%<BOOL_REGS_OP1>")
8656 (match_operand:BOOL_128 2 "vlogical_operand" "<BOOL_REGS_OP2>")))
8657 (clobber (match_scratch:CC 3 "<BOOL_REGS_AND_CR0>"))]
8660 if (TARGET_VSX && vsx_register_operand (operands[0], <MODE>mode))
8661 return "xxland %x0,%x1,%x2";
8663 if (TARGET_ALTIVEC && altivec_register_operand (operands[0], <MODE>mode))
8664 return "vand %0,%1,%2";
8668 "reload_completed && int_reg_operand (operands[0], <MODE>mode)"
8671 rs6000_split_logical (operands, AND, false, false, false, operands[3]);
8676 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
8677 (const_string "vecsimple")
8678 (const_string "integer")))
8679 (set (attr "length")
8681 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
8684 (match_test "TARGET_POWERPC64")
8686 (const_string "16"))))])
8689 (define_insn_and_split "*bool<mode>3_internal"
8690 [(set (match_operand:BOOL_128 0 "vlogical_operand" "=<BOOL_REGS_OUTPUT>")
8691 (match_operator:BOOL_128 3 "boolean_or_operator"
8692 [(match_operand:BOOL_128 1 "vlogical_operand" "%<BOOL_REGS_OP1>")
8693 (match_operand:BOOL_128 2 "vlogical_operand" "<BOOL_REGS_OP2>")]))]
8696 if (TARGET_VSX && vsx_register_operand (operands[0], <MODE>mode))
8697 return "xxl%q3 %x0,%x1,%x2";
8699 if (TARGET_ALTIVEC && altivec_register_operand (operands[0], <MODE>mode))
8700 return "v%q3 %0,%1,%2";
8704 "reload_completed && int_reg_operand (operands[0], <MODE>mode)"
8707 rs6000_split_logical (operands, GET_CODE (operands[3]), false, false, false,
8713 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
8714 (const_string "vecsimple")
8715 (const_string "integer")))
8716 (set (attr "length")
8718 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
8721 (match_test "TARGET_POWERPC64")
8723 (const_string "16"))))])
8726 (define_insn_and_split "*boolc<mode>3_internal1"
8727 [(set (match_operand:BOOL_128 0 "vlogical_operand" "=<BOOL_REGS_OUTPUT>")
8728 (match_operator:BOOL_128 3 "boolean_operator"
8730 (match_operand:BOOL_128 2 "vlogical_operand" "<BOOL_REGS_OP1>"))
8731 (match_operand:BOOL_128 1 "vlogical_operand" "<BOOL_REGS_OP2>")]))]
8732 "TARGET_P8_VECTOR || (GET_CODE (operands[3]) == AND)"
8734 if (TARGET_VSX && vsx_register_operand (operands[0], <MODE>mode))
8735 return "xxl%q3 %x0,%x1,%x2";
8737 if (TARGET_ALTIVEC && altivec_register_operand (operands[0], <MODE>mode))
8738 return "v%q3 %0,%1,%2";
8742 "(TARGET_P8_VECTOR || (GET_CODE (operands[3]) == AND))
8743 && reload_completed && int_reg_operand (operands[0], <MODE>mode)"
8746 rs6000_split_logical (operands, GET_CODE (operands[3]), false, true, false,
8752 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
8753 (const_string "vecsimple")
8754 (const_string "integer")))
8755 (set (attr "length")
8757 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
8760 (match_test "TARGET_POWERPC64")
8762 (const_string "16"))))])
8764 (define_insn_and_split "*boolc<mode>3_internal2"
8765 [(set (match_operand:TI2 0 "int_reg_operand" "=&r,r,r")
8766 (match_operator:TI2 3 "boolean_operator"
8768 (match_operand:TI2 1 "int_reg_operand" "r,0,r"))
8769 (match_operand:TI2 2 "int_reg_operand" "r,r,0")]))]
8770 "!TARGET_P8_VECTOR && (GET_CODE (operands[3]) != AND)"
8772 "reload_completed && !TARGET_P8_VECTOR && (GET_CODE (operands[3]) != AND)"
8775 rs6000_split_logical (operands, GET_CODE (operands[3]), false, true, false,
8779 [(set_attr "type" "integer")
8780 (set (attr "length")
8782 (match_test "TARGET_POWERPC64")
8784 (const_string "16")))])
8787 (define_insn_and_split "*boolcc<mode>3_internal1"
8788 [(set (match_operand:BOOL_128 0 "vlogical_operand" "=<BOOL_REGS_OUTPUT>")
8789 (match_operator:BOOL_128 3 "boolean_operator"
8791 (match_operand:BOOL_128 1 "vlogical_operand" "<BOOL_REGS_OP1>"))
8793 (match_operand:BOOL_128 2 "vlogical_operand" "<BOOL_REGS_OP2>"))]))]
8794 "TARGET_P8_VECTOR || (GET_CODE (operands[3]) == AND)"
8796 if (TARGET_VSX && vsx_register_operand (operands[0], <MODE>mode))
8797 return "xxl%q3 %x0,%x1,%x2";
8799 if (TARGET_ALTIVEC && altivec_register_operand (operands[0], <MODE>mode))
8800 return "v%q3 %0,%1,%2";
8804 "(TARGET_P8_VECTOR || (GET_CODE (operands[3]) == AND))
8805 && reload_completed && int_reg_operand (operands[0], <MODE>mode)"
8808 rs6000_split_logical (operands, GET_CODE (operands[3]), false, true, true,
8814 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
8815 (const_string "vecsimple")
8816 (const_string "integer")))
8817 (set (attr "length")
8819 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
8822 (match_test "TARGET_POWERPC64")
8824 (const_string "16"))))])
8826 (define_insn_and_split "*boolcc<mode>3_internal2"
8827 [(set (match_operand:TI2 0 "int_reg_operand" "=&r,r,r")
8828 (match_operator:TI2 3 "boolean_operator"
8830 (match_operand:TI2 1 "int_reg_operand" "r,0,r"))
8832 (match_operand:TI2 2 "int_reg_operand" "r,r,0"))]))]
8833 "!TARGET_P8_VECTOR && (GET_CODE (operands[3]) != AND)"
8835 "reload_completed && !TARGET_P8_VECTOR && (GET_CODE (operands[3]) != AND)"
8838 rs6000_split_logical (operands, GET_CODE (operands[3]), false, true, true,
8842 [(set_attr "type" "integer")
8843 (set (attr "length")
8845 (match_test "TARGET_POWERPC64")
8847 (const_string "16")))])
8851 (define_insn_and_split "*eqv<mode>3_internal1"
8852 [(set (match_operand:BOOL_128 0 "vlogical_operand" "=<BOOL_REGS_OUTPUT>")
8855 (match_operand:BOOL_128 1 "vlogical_operand" "<BOOL_REGS_OP1>")
8856 (match_operand:BOOL_128 2 "vlogical_operand" "<BOOL_REGS_OP2>"))))]
8859 if (vsx_register_operand (operands[0], <MODE>mode))
8860 return "xxleqv %x0,%x1,%x2";
8864 "TARGET_P8_VECTOR && reload_completed
8865 && int_reg_operand (operands[0], <MODE>mode)"
8868 rs6000_split_logical (operands, XOR, true, false, false, NULL_RTX);
8873 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
8874 (const_string "vecsimple")
8875 (const_string "integer")))
8876 (set (attr "length")
8878 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
8881 (match_test "TARGET_POWERPC64")
8883 (const_string "16"))))])
8885 (define_insn_and_split "*eqv<mode>3_internal2"
8886 [(set (match_operand:TI2 0 "int_reg_operand" "=&r,r,r")
8889 (match_operand:TI2 1 "int_reg_operand" "r,0,r")
8890 (match_operand:TI2 2 "int_reg_operand" "r,r,0"))))]
8893 "reload_completed && !TARGET_P8_VECTOR"
8896 rs6000_split_logical (operands, XOR, true, false, false, NULL_RTX);
8899 [(set_attr "type" "integer")
8900 (set (attr "length")
8902 (match_test "TARGET_POWERPC64")
8904 (const_string "16")))])
8906 ;; 128-bit one's complement
8907 (define_insn_and_split "*one_cmpl<mode>3_internal"
8908 [(set (match_operand:BOOL_128 0 "vlogical_operand" "=<BOOL_REGS_OUTPUT>")
8910 (match_operand:BOOL_128 1 "vlogical_operand" "<BOOL_REGS_UNARY>")))]
8913 if (TARGET_VSX && vsx_register_operand (operands[0], <MODE>mode))
8914 return "xxlnor %x0,%x1,%x1";
8916 if (TARGET_ALTIVEC && altivec_register_operand (operands[0], <MODE>mode))
8917 return "vnor %0,%1,%1";
8921 "reload_completed && int_reg_operand (operands[0], <MODE>mode)"
8924 rs6000_split_logical (operands, NOT, false, false, false, NULL_RTX);
8929 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
8930 (const_string "vecsimple")
8931 (const_string "integer")))
8932 (set (attr "length")
8934 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
8937 (match_test "TARGET_POWERPC64")
8939 (const_string "16"))))])
8942 ;; Now define ways of moving data around.
8944 ;; Set up a register with a value from the GOT table
8946 (define_expand "movsi_got"
8947 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8948 (unspec:SI [(match_operand:SI 1 "got_operand" "")
8949 (match_dup 2)] UNSPEC_MOVSI_GOT))]
8950 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
8953 if (GET_CODE (operands[1]) == CONST)
8955 rtx offset = const0_rtx;
8956 HOST_WIDE_INT value;
8958 operands[1] = eliminate_constant_term (XEXP (operands[1], 0), &offset);
8959 value = INTVAL (offset);
8962 rtx tmp = (!can_create_pseudo_p ()
8964 : gen_reg_rtx (Pmode));
8965 emit_insn (gen_movsi_got (tmp, operands[1]));
8966 emit_insn (gen_addsi3 (operands[0], tmp, offset));
8971 operands[2] = rs6000_got_register (operands[1]);
8974 (define_insn "*movsi_got_internal"
8975 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8976 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
8977 (match_operand:SI 2 "gpc_reg_operand" "b")]
8979 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
8980 "lwz %0,%a1@got(%2)"
8981 [(set_attr "type" "load")])
8983 ;; Used by sched, shorten_branches and final when the GOT pseudo reg
8984 ;; didn't get allocated to a hard register.
8986 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8987 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
8988 (match_operand:SI 2 "memory_operand" "")]
8990 "DEFAULT_ABI == ABI_V4
8992 && (reload_in_progress || reload_completed)"
8993 [(set (match_dup 0) (match_dup 2))
8994 (set (match_dup 0) (unspec:SI [(match_dup 1)(match_dup 0)]
8998 ;; For SI, we special-case integers that can't be loaded in one insn. We
8999 ;; do the load 16-bits at a time. We could do this by loading from memory,
9000 ;; and this is even supposed to be faster, but it is simpler not to get
9001 ;; integers in the TOC.
9002 (define_insn "movsi_low"
9003 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9004 (mem:SI (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
9005 (match_operand 2 "" ""))))]
9006 "TARGET_MACHO && ! TARGET_64BIT"
9007 "lwz %0,lo16(%2)(%1)"
9008 [(set_attr "type" "load")
9009 (set_attr "length" "4")])
9011 (define_insn "*movsi_internal1"
9012 [(set (match_operand:SI 0 "rs6000_nonimmediate_operand" "=r,r,r,m,r,r,r,r,*c*l,*h,*h")
9013 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,*h,r,r,0"))]
9014 "!TARGET_SINGLE_FPU &&
9015 (gpc_reg_operand (operands[0], SImode) || gpc_reg_operand (operands[1], SImode))"
9028 [(set_attr "type" "*,*,load,store,*,*,*,mfjmpr,mtjmpr,*,*")
9029 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4")])
9031 (define_insn "*movsi_internal1_single"
9032 [(set (match_operand:SI 0 "rs6000_nonimmediate_operand" "=r,r,r,m,r,r,r,r,*c*l,*h,*h,m,*f")
9033 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,*h,r,r,0,f,m"))]
9034 "TARGET_SINGLE_FPU &&
9035 (gpc_reg_operand (operands[0], SImode) || gpc_reg_operand (operands[1], SImode))"
9050 [(set_attr "type" "*,*,load,store,*,*,*,mfjmpr,mtjmpr,*,*,fpstore,fpload")
9051 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4,4,4")])
9053 ;; Split a load of a large constant into the appropriate two-insn
9057 [(set (match_operand:SI 0 "gpc_reg_operand" "")
9058 (match_operand:SI 1 "const_int_operand" ""))]
9059 "(unsigned HOST_WIDE_INT) (INTVAL (operands[1]) + 0x8000) >= 0x10000
9060 && (INTVAL (operands[1]) & 0xffff) != 0"
9064 (ior:SI (match_dup 0)
9068 if (rs6000_emit_set_const (operands[0], operands[1]))
9074 (define_insn "*mov<mode>_internal2"
9075 [(set (match_operand:CC 2 "cc_reg_operand" "=y,x,?y")
9076 (compare:CC (match_operand:P 1 "gpc_reg_operand" "0,r,r")
9078 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r") (match_dup 1))]
9084 [(set_attr "type" "cmp,logical,cmp")
9085 (set_attr "dot" "yes")
9086 (set_attr "length" "4,4,8")])
9089 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
9090 (compare:CC (match_operand:P 1 "gpc_reg_operand" "")
9092 (set (match_operand:P 0 "gpc_reg_operand" "") (match_dup 1))]
9094 [(set (match_dup 0) (match_dup 1))
9096 (compare:CC (match_dup 0)
9100 (define_insn "*movhi_internal"
9101 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,m,r,r,*c*l,*h")
9102 (match_operand:HI 1 "input_operand" "r,m,r,i,*h,r,0"))]
9103 "gpc_reg_operand (operands[0], HImode)
9104 || gpc_reg_operand (operands[1], HImode)"
9113 [(set_attr "type" "*,load,store,*,mfjmpr,mtjmpr,*")])
9115 (define_expand "mov<mode>"
9116 [(set (match_operand:INT 0 "general_operand" "")
9117 (match_operand:INT 1 "any_operand" ""))]
9119 "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
9121 (define_insn "*movqi_internal"
9122 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,m,r,r,*c*l,*h")
9123 (match_operand:QI 1 "input_operand" "r,m,r,i,*h,r,0"))]
9124 "gpc_reg_operand (operands[0], QImode)
9125 || gpc_reg_operand (operands[1], QImode)"
9134 [(set_attr "type" "*,load,store,*,mfjmpr,mtjmpr,*")])
9136 ;; Here is how to move condition codes around. When we store CC data in
9137 ;; an integer register or memory, we store just the high-order 4 bits.
9138 ;; This lets us not shift in the most common case of CR0.
9139 (define_expand "movcc"
9140 [(set (match_operand:CC 0 "nonimmediate_operand" "")
9141 (match_operand:CC 1 "nonimmediate_operand" ""))]
9145 (define_insn "*movcc_internal1"
9146 [(set (match_operand:CC 0 "nonimmediate_operand" "=y,x,?y,y,r,r,r,r,r,cl,r,m")
9147 (match_operand:CC 1 "general_operand" "y,r,r,O,x,y,r,I,h,r,m,r"))]
9148 "register_operand (operands[0], CCmode)
9149 || register_operand (operands[1], CCmode)"
9153 rlwinm %1,%1,%F0,0xffffffff\;mtcrf %R0,%1\;rlwinm %1,%1,%f0,0xffffffff
9156 mfcr %0%Q1\;rlwinm %0,%0,%f1,0xf0000000
9164 (cond [(eq_attr "alternative" "0,3")
9165 (const_string "cr_logical")
9166 (eq_attr "alternative" "1,2")
9167 (const_string "mtcr")
9168 (eq_attr "alternative" "6,7")
9169 (const_string "integer")
9170 (eq_attr "alternative" "8")
9171 (const_string "mfjmpr")
9172 (eq_attr "alternative" "9")
9173 (const_string "mtjmpr")
9174 (eq_attr "alternative" "10")
9175 (const_string "load")
9176 (eq_attr "alternative" "11")
9177 (const_string "store")
9178 (match_test "TARGET_MFCRF")
9179 (const_string "mfcrf")
9181 (const_string "mfcr")))
9182 (set_attr "length" "4,4,12,4,4,8,4,4,4,4,4,4")])
9184 ;; For floating-point, we normally deal with the floating-point registers
9185 ;; unless -msoft-float is used. The sole exception is that parameter passing
9186 ;; can produce floating-point values in fixed-point registers. Unless the
9187 ;; value is a simple constant or already in memory, we deal with this by
9188 ;; allocating memory and copying the value explicitly via that memory location.
9190 ;; Move 32-bit binary/decimal floating point
9191 (define_expand "mov<mode>"
9192 [(set (match_operand:FMOVE32 0 "nonimmediate_operand" "")
9193 (match_operand:FMOVE32 1 "any_operand" ""))]
9195 "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
9198 [(set (match_operand:FMOVE32 0 "gpc_reg_operand" "")
9199 (match_operand:FMOVE32 1 "const_double_operand" ""))]
9201 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
9202 || (GET_CODE (operands[0]) == SUBREG
9203 && GET_CODE (SUBREG_REG (operands[0])) == REG
9204 && REGNO (SUBREG_REG (operands[0])) <= 31))"
9205 [(set (match_dup 2) (match_dup 3))]
9211 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
9212 <real_value_to_target> (rv, l);
9214 if (! TARGET_POWERPC64)
9215 operands[2] = operand_subword (operands[0], 0, 0, <MODE>mode);
9217 operands[2] = gen_lowpart (SImode, operands[0]);
9219 operands[3] = gen_int_mode (l, SImode);
9222 (define_insn "mov<mode>_hardfloat"
9223 [(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")
9224 (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"))]
9225 "(gpc_reg_operand (operands[0], <MODE>mode)
9226 || gpc_reg_operand (operands[1], <MODE>mode))
9227 && (TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT)"
9246 [(set_attr "type" "*,load,store,fp,vecsimple,vecsimple,fpload,fpstore,fpload,fpstore,mftgpr,mffgpr,mtjmpr,mfjmpr,*,*,*")
9247 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,8")])
9249 (define_insn "*mov<mode>_softfloat"
9250 [(set (match_operand:FMOVE32 0 "nonimmediate_operand" "=r,cl,r,r,m,r,r,r,r,*h")
9251 (match_operand:FMOVE32 1 "input_operand" "r,r,h,m,r,I,L,G,Fn,0"))]
9252 "(gpc_reg_operand (operands[0], <MODE>mode)
9253 || gpc_reg_operand (operands[1], <MODE>mode))
9254 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)"
9266 [(set_attr "type" "*,mtjmpr,mfjmpr,load,store,*,*,*,*,*")
9267 (set_attr "length" "4,4,4,4,4,4,4,4,8,4")])
9270 ;; Move 64-bit binary/decimal floating point
9271 (define_expand "mov<mode>"
9272 [(set (match_operand:FMOVE64 0 "nonimmediate_operand" "")
9273 (match_operand:FMOVE64 1 "any_operand" ""))]
9275 "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
9278 [(set (match_operand:FMOVE64 0 "gpc_reg_operand" "")
9279 (match_operand:FMOVE64 1 "const_int_operand" ""))]
9280 "! TARGET_POWERPC64 && reload_completed
9281 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
9282 || (GET_CODE (operands[0]) == SUBREG
9283 && GET_CODE (SUBREG_REG (operands[0])) == REG
9284 && REGNO (SUBREG_REG (operands[0])) <= 31))"
9285 [(set (match_dup 2) (match_dup 4))
9286 (set (match_dup 3) (match_dup 1))]
9289 int endian = (WORDS_BIG_ENDIAN == 0);
9290 HOST_WIDE_INT value = INTVAL (operands[1]);
9292 operands[2] = operand_subword (operands[0], endian, 0, <MODE>mode);
9293 operands[3] = operand_subword (operands[0], 1 - endian, 0, <MODE>mode);
9294 operands[4] = GEN_INT (value >> 32);
9295 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
9299 [(set (match_operand:FMOVE64 0 "gpc_reg_operand" "")
9300 (match_operand:FMOVE64 1 "const_double_operand" ""))]
9301 "! TARGET_POWERPC64 && reload_completed
9302 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
9303 || (GET_CODE (operands[0]) == SUBREG
9304 && GET_CODE (SUBREG_REG (operands[0])) == REG
9305 && REGNO (SUBREG_REG (operands[0])) <= 31))"
9306 [(set (match_dup 2) (match_dup 4))
9307 (set (match_dup 3) (match_dup 5))]
9310 int endian = (WORDS_BIG_ENDIAN == 0);
9314 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
9315 <real_value_to_target> (rv, l);
9317 operands[2] = operand_subword (operands[0], endian, 0, <MODE>mode);
9318 operands[3] = operand_subword (operands[0], 1 - endian, 0, <MODE>mode);
9319 operands[4] = gen_int_mode (l[endian], SImode);
9320 operands[5] = gen_int_mode (l[1 - endian], SImode);
9324 [(set (match_operand:FMOVE64 0 "gpc_reg_operand" "")
9325 (match_operand:FMOVE64 1 "const_double_operand" ""))]
9326 "TARGET_POWERPC64 && reload_completed
9327 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
9328 || (GET_CODE (operands[0]) == SUBREG
9329 && GET_CODE (SUBREG_REG (operands[0])) == REG
9330 && REGNO (SUBREG_REG (operands[0])) <= 31))"
9331 [(set (match_dup 2) (match_dup 3))]
9334 int endian = (WORDS_BIG_ENDIAN == 0);
9339 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
9340 <real_value_to_target> (rv, l);
9342 operands[2] = gen_lowpart (DImode, operands[0]);
9343 /* HIGHPART is lower memory address when WORDS_BIG_ENDIAN. */
9344 val = ((HOST_WIDE_INT)(unsigned long)l[endian] << 32
9345 | ((HOST_WIDE_INT)(unsigned long)l[1 - endian]));
9347 operands[3] = gen_int_mode (val, DImode);
9350 ;; Don't have reload use general registers to load a constant. It is
9351 ;; less efficient than loading the constant into an FP register, since
9352 ;; it will probably be used there.
9354 ;; The move constraints are ordered to prefer floating point registers before
9355 ;; general purpose registers to avoid doing a store and a load to get the value
9356 ;; into a floating point register when it is needed for a floating point
9357 ;; operation. Prefer traditional floating point registers over VSX registers,
9358 ;; since the D-form version of the memory instructions does not need a GPR for
9361 (define_insn "*mov<mode>_hardfloat32"
9362 [(set (match_operand:FMOVE64 0 "nonimmediate_operand" "=m,d,d,wv,Z,wa,wa,Y,r,!r,!r,!r,!r")
9363 (match_operand:FMOVE64 1 "input_operand" "d,m,d,Z,wv,wa,j,r,Y,r,G,H,F"))]
9364 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9365 && (gpc_reg_operand (operands[0], <MODE>mode)
9366 || gpc_reg_operand (operands[1], <MODE>mode))"
9381 [(set_attr "type" "fpstore,fpload,fp,fpload,fpstore,vecsimple,vecsimple,store,load,two,fp,fp,*")
9382 (set_attr "length" "4,4,4,4,4,4,4,8,8,8,8,12,16")])
9384 (define_insn "*mov<mode>_softfloat32"
9385 [(set (match_operand:FMOVE64 0 "nonimmediate_operand" "=Y,r,r,r,r,r")
9386 (match_operand:FMOVE64 1 "input_operand" "r,Y,r,G,H,F"))]
9388 && ((TARGET_FPRS && TARGET_SINGLE_FLOAT)
9389 || TARGET_SOFT_FLOAT || TARGET_E500_SINGLE
9390 || (<MODE>mode == DDmode && TARGET_E500_DOUBLE))
9391 && (gpc_reg_operand (operands[0], <MODE>mode)
9392 || gpc_reg_operand (operands[1], <MODE>mode))"
9394 [(set_attr "type" "store,load,two,*,*,*")
9395 (set_attr "length" "8,8,8,8,12,16")])
9397 ; ld/std require word-aligned displacements -> 'Y' constraint.
9398 ; List Y->r and r->Y before r->r for reload.
9399 (define_insn "*mov<mode>_hardfloat64"
9400 [(set (match_operand:FMOVE64 0 "nonimmediate_operand" "=m,d,d,wv,Z,wa,wa,Y,r,!r,*c*l,!r,*h,!r,!r,!r,r,wg,r,wm")
9401 (match_operand:FMOVE64 1 "input_operand" "d,m,d,Z,wv,wa,j,r,Y,r,r,h,0,G,H,F,wg,r,wm,r"))]
9402 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9403 && (gpc_reg_operand (operands[0], <MODE>mode)
9404 || gpc_reg_operand (operands[1], <MODE>mode))"
9426 [(set_attr "type" "fpstore,fpload,fp,fpload,fpstore,vecsimple,vecsimple,store,load,*,mtjmpr,mfjmpr,*,*,*,*,mftgpr,mffgpr,mftgpr,mffgpr")
9427 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4,4,8,12,16,4,4,4,4")])
9429 (define_insn "*mov<mode>_softfloat64"
9430 [(set (match_operand:FMOVE64 0 "nonimmediate_operand" "=Y,r,r,cl,r,r,r,r,*h")
9431 (match_operand:FMOVE64 1 "input_operand" "r,Y,r,r,h,G,H,F,0"))]
9432 "TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)
9433 && (gpc_reg_operand (operands[0], <MODE>mode)
9434 || gpc_reg_operand (operands[1], <MODE>mode))"
9445 [(set_attr "type" "store,load,*,mtjmpr,mfjmpr,*,*,*,*")
9446 (set_attr "length" "4,4,4,4,4,8,12,16,4")])
9448 (define_expand "mov<mode>"
9449 [(set (match_operand:FMOVE128 0 "general_operand" "")
9450 (match_operand:FMOVE128 1 "any_operand" ""))]
9452 "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
9454 ;; It's important to list Y->r and r->Y before r->r because otherwise
9455 ;; reload, given m->r, will try to pick r->r and reload it, which
9456 ;; doesn't make progress.
9458 ;; We can't split little endian direct moves of TDmode, because the words are
9459 ;; not swapped like they are for TImode or TFmode. Subregs therefore are
9460 ;; problematical. Don't allow direct move for this case.
9462 (define_insn_and_split "*mov<mode>_64bit_dm"
9463 [(set (match_operand:FMOVE128 0 "nonimmediate_operand" "=m,d,d,Y,r,r,r,wm")
9464 (match_operand:FMOVE128 1 "input_operand" "d,m,d,r,YGHF,r,wm,r"))]
9465 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_POWERPC64
9466 && (<MODE>mode != TDmode || WORDS_BIG_ENDIAN)
9467 && (gpc_reg_operand (operands[0], <MODE>mode)
9468 || gpc_reg_operand (operands[1], <MODE>mode))"
9470 "&& reload_completed"
9472 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
9473 [(set_attr "length" "8,8,8,12,12,8,8,8")])
9475 (define_insn_and_split "*movtd_64bit_nodm"
9476 [(set (match_operand:TD 0 "nonimmediate_operand" "=m,d,d,Y,r,r")
9477 (match_operand:TD 1 "input_operand" "d,m,d,r,YGHF,r"))]
9478 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_POWERPC64 && !WORDS_BIG_ENDIAN
9479 && (gpc_reg_operand (operands[0], TDmode)
9480 || gpc_reg_operand (operands[1], TDmode))"
9482 "&& reload_completed"
9484 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
9485 [(set_attr "length" "8,8,8,12,12,8")])
9487 (define_insn_and_split "*mov<mode>_32bit"
9488 [(set (match_operand:FMOVE128 0 "nonimmediate_operand" "=m,d,d,Y,r,r")
9489 (match_operand:FMOVE128 1 "input_operand" "d,m,d,r,YGHF,r"))]
9490 "TARGET_HARD_FLOAT && TARGET_FPRS && !TARGET_POWERPC64
9491 && (gpc_reg_operand (operands[0], <MODE>mode)
9492 || gpc_reg_operand (operands[1], <MODE>mode))"
9494 "&& reload_completed"
9496 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
9497 [(set_attr "length" "8,8,8,20,20,16")])
9499 (define_insn_and_split "*mov<mode>_softfloat"
9500 [(set (match_operand:FMOVE128 0 "rs6000_nonimmediate_operand" "=Y,r,r")
9501 (match_operand:FMOVE128 1 "input_operand" "r,YGHF,r"))]
9502 "(TARGET_SOFT_FLOAT || !TARGET_FPRS)
9503 && (gpc_reg_operand (operands[0], <MODE>mode)
9504 || gpc_reg_operand (operands[1], <MODE>mode))"
9506 "&& reload_completed"
9508 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
9509 [(set_attr "length" "20,20,16")])
9511 (define_expand "extenddftf2"
9512 [(set (match_operand:TF 0 "nonimmediate_operand" "")
9513 (float_extend:TF (match_operand:DF 1 "input_operand" "")))]
9515 && TARGET_HARD_FLOAT
9516 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9517 && TARGET_LONG_DOUBLE_128"
9519 if (TARGET_E500_DOUBLE)
9520 emit_insn (gen_spe_extenddftf2 (operands[0], operands[1]));
9522 emit_insn (gen_extenddftf2_fprs (operands[0], operands[1]));
9526 (define_expand "extenddftf2_fprs"
9527 [(parallel [(set (match_operand:TF 0 "nonimmediate_operand" "")
9528 (float_extend:TF (match_operand:DF 1 "input_operand" "")))
9529 (use (match_dup 2))])]
9531 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9532 && TARGET_LONG_DOUBLE_128"
9534 operands[2] = CONST0_RTX (DFmode);
9535 /* Generate GOT reference early for SVR4 PIC. */
9536 if (DEFAULT_ABI == ABI_V4 && flag_pic)
9537 operands[2] = validize_mem (force_const_mem (DFmode, operands[2]));
9540 (define_insn_and_split "*extenddftf2_internal"
9541 [(set (match_operand:TF 0 "nonimmediate_operand" "=m,Y,d,&d,r")
9542 (float_extend:TF (match_operand:DF 1 "input_operand" "d,r,md,md,rmGHF")))
9543 (use (match_operand:DF 2 "zero_reg_mem_operand" "d,r,m,d,n"))]
9545 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9546 && TARGET_LONG_DOUBLE_128"
9548 "&& reload_completed"
9551 const int lo_word = LONG_DOUBLE_LARGE_FIRST ? GET_MODE_SIZE (DFmode) : 0;
9552 const int hi_word = LONG_DOUBLE_LARGE_FIRST ? 0 : GET_MODE_SIZE (DFmode);
9553 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word),
9555 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word),
9560 (define_expand "extendsftf2"
9561 [(set (match_operand:TF 0 "nonimmediate_operand" "")
9562 (float_extend:TF (match_operand:SF 1 "gpc_reg_operand" "")))]
9564 && TARGET_HARD_FLOAT
9565 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9566 && TARGET_LONG_DOUBLE_128"
9568 rtx tmp = gen_reg_rtx (DFmode);
9569 emit_insn (gen_extendsfdf2 (tmp, operands[1]));
9570 emit_insn (gen_extenddftf2 (operands[0], tmp));
9574 (define_expand "trunctfdf2"
9575 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9576 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "")))]
9578 && TARGET_HARD_FLOAT
9579 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9580 && TARGET_LONG_DOUBLE_128"
9583 (define_insn_and_split "trunctfdf2_internal1"
9584 [(set (match_operand:DF 0 "gpc_reg_operand" "=d,?d")
9585 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "0,d")))]
9586 "!TARGET_IEEEQUAD && !TARGET_XL_COMPAT
9587 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9591 "&& reload_completed && REGNO (operands[0]) == REGNO (operands[1])"
9594 emit_note (NOTE_INSN_DELETED);
9597 [(set_attr "type" "fp")])
9599 (define_insn "trunctfdf2_internal2"
9600 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
9601 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "d")))]
9602 "!TARGET_IEEEQUAD && TARGET_XL_COMPAT
9603 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9604 && TARGET_LONG_DOUBLE_128"
9606 [(set_attr "type" "fp")
9607 (set_attr "fp_type" "fp_addsub_d")])
9609 (define_expand "trunctfsf2"
9610 [(set (match_operand:SF 0 "gpc_reg_operand" "")
9611 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "")))]
9613 && TARGET_HARD_FLOAT
9614 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9615 && TARGET_LONG_DOUBLE_128"
9617 if (TARGET_E500_DOUBLE)
9618 emit_insn (gen_spe_trunctfsf2 (operands[0], operands[1]));
9620 emit_insn (gen_trunctfsf2_fprs (operands[0], operands[1]));
9624 (define_insn_and_split "trunctfsf2_fprs"
9625 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
9626 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "d")))
9627 (clobber (match_scratch:DF 2 "=d"))]
9629 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
9630 && TARGET_LONG_DOUBLE_128"
9632 "&& reload_completed"
9634 (float_truncate:DF (match_dup 1)))
9636 (float_truncate:SF (match_dup 2)))]
9639 (define_expand "floatsitf2"
9640 [(set (match_operand:TF 0 "gpc_reg_operand" "")
9641 (float:TF (match_operand:SI 1 "gpc_reg_operand" "")))]
9643 && TARGET_HARD_FLOAT
9644 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9645 && TARGET_LONG_DOUBLE_128"
9647 rtx tmp = gen_reg_rtx (DFmode);
9648 expand_float (tmp, operands[1], false);
9649 emit_insn (gen_extenddftf2 (operands[0], tmp));
9653 ; fadd, but rounding towards zero.
9654 ; This is probably not the optimal code sequence.
9655 (define_insn "fix_trunc_helper"
9656 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
9657 (unspec:DF [(match_operand:TF 1 "gpc_reg_operand" "d")]
9658 UNSPEC_FIX_TRUNC_TF))
9659 (clobber (match_operand:DF 2 "gpc_reg_operand" "=&d"))]
9660 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
9661 "mffs %2\n\tmtfsb1 31\n\tmtfsb0 30\n\tfadd %0,%1,%L1\n\tmtfsf 1,%2"
9662 [(set_attr "type" "fp")
9663 (set_attr "length" "20")])
9665 (define_expand "fix_trunctfsi2"
9666 [(set (match_operand:SI 0 "gpc_reg_operand" "")
9667 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))]
9668 "!TARGET_IEEEQUAD && TARGET_HARD_FLOAT
9669 && (TARGET_FPRS || TARGET_E500_DOUBLE) && TARGET_LONG_DOUBLE_128"
9671 if (TARGET_E500_DOUBLE)
9672 emit_insn (gen_spe_fix_trunctfsi2 (operands[0], operands[1]));
9674 emit_insn (gen_fix_trunctfsi2_fprs (operands[0], operands[1]));
9678 (define_expand "fix_trunctfsi2_fprs"
9679 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
9680 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))
9681 (clobber (match_dup 2))
9682 (clobber (match_dup 3))
9683 (clobber (match_dup 4))
9684 (clobber (match_dup 5))])]
9686 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9688 operands[2] = gen_reg_rtx (DFmode);
9689 operands[3] = gen_reg_rtx (DFmode);
9690 operands[4] = gen_reg_rtx (DImode);
9691 operands[5] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode));
9694 (define_insn_and_split "*fix_trunctfsi2_internal"
9695 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9696 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "d")))
9697 (clobber (match_operand:DF 2 "gpc_reg_operand" "=d"))
9698 (clobber (match_operand:DF 3 "gpc_reg_operand" "=&d"))
9699 (clobber (match_operand:DI 4 "gpc_reg_operand" "=d"))
9700 (clobber (match_operand:DI 5 "offsettable_mem_operand" "=o"))]
9702 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9708 emit_insn (gen_fix_trunc_helper (operands[2], operands[1], operands[3]));
9710 gcc_assert (MEM_P (operands[5]));
9711 lowword = adjust_address (operands[5], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
9713 emit_insn (gen_fctiwz_df (operands[4], operands[2]));
9714 emit_move_insn (operands[5], operands[4]);
9715 emit_move_insn (operands[0], lowword);
9719 (define_expand "negtf2"
9720 [(set (match_operand:TF 0 "gpc_reg_operand" "")
9721 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "")))]
9723 && TARGET_HARD_FLOAT
9724 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9725 && TARGET_LONG_DOUBLE_128"
9728 (define_insn "negtf2_internal"
9729 [(set (match_operand:TF 0 "gpc_reg_operand" "=d")
9730 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "d")))]
9732 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9735 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
9736 return \"fneg %L0,%L1\;fneg %0,%1\";
9738 return \"fneg %0,%1\;fneg %L0,%L1\";
9740 [(set_attr "type" "fp")
9741 (set_attr "length" "8")])
9743 (define_expand "abstf2"
9744 [(set (match_operand:TF 0 "gpc_reg_operand" "")
9745 (abs:TF (match_operand:TF 1 "gpc_reg_operand" "")))]
9747 && TARGET_HARD_FLOAT
9748 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9749 && TARGET_LONG_DOUBLE_128"
9752 rtx label = gen_label_rtx ();
9753 if (TARGET_E500_DOUBLE)
9755 if (flag_finite_math_only && !flag_trapping_math)
9756 emit_insn (gen_spe_abstf2_tst (operands[0], operands[1], label));
9758 emit_insn (gen_spe_abstf2_cmp (operands[0], operands[1], label));
9761 emit_insn (gen_abstf2_internal (operands[0], operands[1], label));
9766 (define_expand "abstf2_internal"
9767 [(set (match_operand:TF 0 "gpc_reg_operand" "")
9768 (match_operand:TF 1 "gpc_reg_operand" ""))
9769 (set (match_dup 3) (match_dup 5))
9770 (set (match_dup 5) (abs:DF (match_dup 5)))
9771 (set (match_dup 4) (compare:CCFP (match_dup 3) (match_dup 5)))
9772 (set (pc) (if_then_else (eq (match_dup 4) (const_int 0))
9773 (label_ref (match_operand 2 "" ""))
9775 (set (match_dup 6) (neg:DF (match_dup 6)))]
9777 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9778 && TARGET_LONG_DOUBLE_128"
9781 const int hi_word = LONG_DOUBLE_LARGE_FIRST ? 0 : GET_MODE_SIZE (DFmode);
9782 const int lo_word = LONG_DOUBLE_LARGE_FIRST ? GET_MODE_SIZE (DFmode) : 0;
9783 operands[3] = gen_reg_rtx (DFmode);
9784 operands[4] = gen_reg_rtx (CCFPmode);
9785 operands[5] = simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word);
9786 operands[6] = simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word);
9789 ;; Reload helper functions used by rs6000_secondary_reload. The patterns all
9790 ;; must have 3 arguments, and scratch register constraint must be a single
9793 ;; Reload patterns to support gpr load/store with misaligned mem.
9794 ;; and multiple gpr load/store at offset >= 0xfffc
9795 (define_expand "reload_<mode>_store"
9796 [(parallel [(match_operand 0 "memory_operand" "=m")
9797 (match_operand 1 "gpc_reg_operand" "r")
9798 (match_operand:GPR 2 "register_operand" "=&b")])]
9801 rs6000_secondary_reload_gpr (operands[1], operands[0], operands[2], true);
9805 (define_expand "reload_<mode>_load"
9806 [(parallel [(match_operand 0 "gpc_reg_operand" "=r")
9807 (match_operand 1 "memory_operand" "m")
9808 (match_operand:GPR 2 "register_operand" "=b")])]
9811 rs6000_secondary_reload_gpr (operands[0], operands[1], operands[2], false);
9816 ;; Power8 merge instructions to allow direct move to/from floating point
9817 ;; registers in 32-bit mode. We use TF mode to get two registers to move the
9818 ;; individual 32-bit parts across. Subreg doesn't work too well on the TF
9819 ;; value, since it is allocated in reload and not all of the flow information
9820 ;; is setup for it. We have two patterns to do the two moves between gprs and
9821 ;; fprs. There isn't a dependancy between the two, but we could potentially
9822 ;; schedule other instructions between the two instructions. TFmode is
9823 ;; currently limited to traditional FPR registers. If/when this is changed, we
9824 ;; will need to revist %L to make sure it works with VSX registers, or add an
9825 ;; %x version of %L.
9827 (define_insn "p8_fmrgow_<mode>"
9828 [(set (match_operand:FMOVE64X 0 "register_operand" "=d")
9829 (unspec:FMOVE64X [(match_operand:TF 1 "register_operand" "d")]
9830 UNSPEC_P8V_FMRGOW))]
9831 "!TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9833 [(set_attr "type" "vecperm")])
9835 (define_insn "p8_mtvsrwz_1"
9836 [(set (match_operand:TF 0 "register_operand" "=d")
9837 (unspec:TF [(match_operand:SI 1 "register_operand" "r")]
9838 UNSPEC_P8V_MTVSRWZ))]
9839 "!TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9841 [(set_attr "type" "mftgpr")])
9843 (define_insn "p8_mtvsrwz_2"
9844 [(set (match_operand:TF 0 "register_operand" "+d")
9845 (unspec:TF [(match_dup 0)
9846 (match_operand:SI 1 "register_operand" "r")]
9847 UNSPEC_P8V_MTVSRWZ))]
9848 "!TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9850 [(set_attr "type" "mftgpr")])
9852 (define_insn_and_split "reload_fpr_from_gpr<mode>"
9853 [(set (match_operand:FMOVE64X 0 "register_operand" "=ws")
9854 (unspec:FMOVE64X [(match_operand:FMOVE64X 1 "register_operand" "r")]
9855 UNSPEC_P8V_RELOAD_FROM_GPR))
9856 (clobber (match_operand:TF 2 "register_operand" "=d"))]
9857 "!TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9859 "&& reload_completed"
9862 rtx dest = operands[0];
9863 rtx src = operands[1];
9864 rtx tmp = operands[2];
9865 rtx gpr_hi_reg = gen_highpart (SImode, src);
9866 rtx gpr_lo_reg = gen_lowpart (SImode, src);
9868 emit_insn (gen_p8_mtvsrwz_1 (tmp, gpr_hi_reg));
9869 emit_insn (gen_p8_mtvsrwz_2 (tmp, gpr_lo_reg));
9870 emit_insn (gen_p8_fmrgow_<mode> (dest, tmp));
9873 [(set_attr "length" "12")
9874 (set_attr "type" "three")])
9876 ;; Move 128 bit values from GPRs to VSX registers in 64-bit mode
9877 (define_insn "p8_mtvsrd_1"
9878 [(set (match_operand:TF 0 "register_operand" "=ws")
9879 (unspec:TF [(match_operand:DI 1 "register_operand" "r")]
9880 UNSPEC_P8V_MTVSRD))]
9881 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9883 [(set_attr "type" "mftgpr")])
9885 (define_insn "p8_mtvsrd_2"
9886 [(set (match_operand:TF 0 "register_operand" "+ws")
9887 (unspec:TF [(match_dup 0)
9888 (match_operand:DI 1 "register_operand" "r")]
9889 UNSPEC_P8V_MTVSRD))]
9890 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9892 [(set_attr "type" "mftgpr")])
9894 (define_insn "p8_xxpermdi_<mode>"
9895 [(set (match_operand:FMOVE128_GPR 0 "register_operand" "=wa")
9896 (unspec:FMOVE128_GPR [(match_operand:TF 1 "register_operand" "ws")]
9897 UNSPEC_P8V_XXPERMDI))]
9898 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9899 "xxpermdi %x0,%1,%L1,0"
9900 [(set_attr "type" "vecperm")])
9902 (define_insn_and_split "reload_vsx_from_gpr<mode>"
9903 [(set (match_operand:FMOVE128_GPR 0 "register_operand" "=wa")
9904 (unspec:FMOVE128_GPR
9905 [(match_operand:FMOVE128_GPR 1 "register_operand" "r")]
9906 UNSPEC_P8V_RELOAD_FROM_GPR))
9907 (clobber (match_operand:TF 2 "register_operand" "=ws"))]
9908 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9910 "&& reload_completed"
9913 rtx dest = operands[0];
9914 rtx src = operands[1];
9915 rtx tmp = operands[2];
9916 rtx gpr_hi_reg = gen_highpart (DImode, src);
9917 rtx gpr_lo_reg = gen_lowpart (DImode, src);
9919 emit_insn (gen_p8_mtvsrd_1 (tmp, gpr_hi_reg));
9920 emit_insn (gen_p8_mtvsrd_2 (tmp, gpr_lo_reg));
9921 emit_insn (gen_p8_xxpermdi_<mode> (dest, tmp));
9923 [(set_attr "length" "12")
9924 (set_attr "type" "three")])
9927 [(set (match_operand:FMOVE128_GPR 0 "nonimmediate_operand" "")
9928 (match_operand:FMOVE128_GPR 1 "input_operand" ""))]
9930 && (int_reg_operand (operands[0], <MODE>mode)
9931 || int_reg_operand (operands[1], <MODE>mode))"
9933 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
9935 ;; Move SFmode to a VSX from a GPR register. Because scalar floating point
9936 ;; type is stored internally as double precision in the VSX registers, we have
9937 ;; to convert it from the vector format.
9939 (define_insn_and_split "reload_vsx_from_gprsf"
9940 [(set (match_operand:SF 0 "register_operand" "=wa")
9941 (unspec:SF [(match_operand:SF 1 "register_operand" "r")]
9942 UNSPEC_P8V_RELOAD_FROM_GPR))
9943 (clobber (match_operand:DI 2 "register_operand" "=r"))]
9944 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9946 "&& reload_completed"
9949 rtx op0 = operands[0];
9950 rtx op1 = operands[1];
9951 rtx op2 = operands[2];
9952 /* Also use the destination register to hold the unconverted DImode value.
9953 This is conceptually a separate value from OP0, so we use gen_rtx_REG
9954 rather than simplify_gen_subreg. */
9955 rtx op0_di = gen_rtx_REG (DImode, REGNO (op0));
9956 rtx op1_di = simplify_gen_subreg (DImode, op1, SFmode, 0);
9958 /* Move SF value to upper 32-bits for xscvspdpn. */
9959 emit_insn (gen_ashldi3 (op2, op1_di, GEN_INT (32)));
9960 emit_move_insn (op0_di, op2);
9961 emit_insn (gen_vsx_xscvspdpn_directmove (op0, op0_di));
9964 [(set_attr "length" "8")
9965 (set_attr "type" "two")])
9967 ;; Move 128 bit values from VSX registers to GPRs in 64-bit mode by doing a
9968 ;; normal 64-bit move, followed by an xxpermdi to get the bottom 64-bit value,
9969 ;; and then doing a move of that.
9970 (define_insn "p8_mfvsrd_3_<mode>"
9971 [(set (match_operand:DF 0 "register_operand" "=r")
9972 (unspec:DF [(match_operand:FMOVE128_GPR 1 "register_operand" "wa")]
9973 UNSPEC_P8V_RELOAD_FROM_VSX))]
9974 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9976 [(set_attr "type" "mftgpr")])
9978 (define_insn_and_split "reload_gpr_from_vsx<mode>"
9979 [(set (match_operand:FMOVE128_GPR 0 "register_operand" "=r")
9980 (unspec:FMOVE128_GPR
9981 [(match_operand:FMOVE128_GPR 1 "register_operand" "wa")]
9982 UNSPEC_P8V_RELOAD_FROM_VSX))
9983 (clobber (match_operand:FMOVE128_GPR 2 "register_operand" "=wa"))]
9984 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9986 "&& reload_completed"
9989 rtx dest = operands[0];
9990 rtx src = operands[1];
9991 rtx tmp = operands[2];
9992 rtx gpr_hi_reg = gen_highpart (DFmode, dest);
9993 rtx gpr_lo_reg = gen_lowpart (DFmode, dest);
9995 emit_insn (gen_p8_mfvsrd_3_<mode> (gpr_hi_reg, src));
9996 emit_insn (gen_vsx_xxpermdi_<mode> (tmp, src, src, GEN_INT (3)));
9997 emit_insn (gen_p8_mfvsrd_3_<mode> (gpr_lo_reg, tmp));
9999 [(set_attr "length" "12")
10000 (set_attr "type" "three")])
10002 ;; Move SFmode to a GPR from a VSX register. Because scalar floating point
10003 ;; type is stored internally as double precision, we have to convert it to the
10006 (define_insn_and_split "reload_gpr_from_vsxsf"
10007 [(set (match_operand:SF 0 "register_operand" "=r")
10008 (unspec:SF [(match_operand:SF 1 "register_operand" "wa")]
10009 UNSPEC_P8V_RELOAD_FROM_VSX))
10010 (clobber (match_operand:V4SF 2 "register_operand" "=wa"))]
10011 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
10013 "&& reload_completed"
10016 rtx op0 = operands[0];
10017 rtx op1 = operands[1];
10018 rtx op2 = operands[2];
10019 rtx diop0 = simplify_gen_subreg (DImode, op0, SFmode, 0);
10021 emit_insn (gen_vsx_xscvdpspn_scalar (op2, op1));
10022 emit_insn (gen_p8_mfvsrd_4_disf (diop0, op2));
10023 emit_insn (gen_lshrdi3 (diop0, diop0, GEN_INT (32)));
10026 [(set_attr "length" "12")
10027 (set_attr "type" "three")])
10029 (define_insn "p8_mfvsrd_4_disf"
10030 [(set (match_operand:DI 0 "register_operand" "=r")
10031 (unspec:DI [(match_operand:V4SF 1 "register_operand" "wa")]
10032 UNSPEC_P8V_RELOAD_FROM_VSX))]
10033 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
10035 [(set_attr "type" "mftgpr")])
10038 ;; Next come the multi-word integer load and store and the load and store
10041 ;; List r->r after r->Y, otherwise reload will try to reload a
10042 ;; non-offsettable address by using r->r which won't make progress.
10043 ;; Use of fprs is disparaged slightly otherwise reload prefers to reload
10044 ;; a gpr into a fpr instead of reloading an invalid 'Y' address
10045 (define_insn "*movdi_internal32"
10046 [(set (match_operand:DI 0 "rs6000_nonimmediate_operand" "=Y,r,r,?m,?*d,?*d,r")
10047 (match_operand:DI 1 "input_operand" "r,Y,r,d,m,d,IJKnGHF"))]
10048 "! TARGET_POWERPC64
10049 && (gpc_reg_operand (operands[0], DImode)
10050 || gpc_reg_operand (operands[1], DImode))"
10059 [(set_attr "type" "store,load,*,fpstore,fpload,fp,*")])
10062 [(set (match_operand:DI 0 "gpc_reg_operand" "")
10063 (match_operand:DI 1 "const_int_operand" ""))]
10064 "! TARGET_POWERPC64 && reload_completed
10065 && gpr_or_gpr_p (operands[0], operands[1])
10066 && !direct_move_p (operands[0], operands[1])"
10067 [(set (match_dup 2) (match_dup 4))
10068 (set (match_dup 3) (match_dup 1))]
10071 HOST_WIDE_INT value = INTVAL (operands[1]);
10072 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
10074 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
10076 operands[4] = GEN_INT (value >> 32);
10077 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
10081 [(set (match_operand:DIFD 0 "rs6000_nonimmediate_operand" "")
10082 (match_operand:DIFD 1 "input_operand" ""))]
10083 "reload_completed && !TARGET_POWERPC64
10084 && gpr_or_gpr_p (operands[0], operands[1])
10085 && !direct_move_p (operands[0], operands[1])"
10087 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
10089 (define_insn "*movdi_internal64"
10090 [(set (match_operand:DI 0 "nonimmediate_operand" "=Y,r,r,r,r,r,?m,?*d,?*d,r,*h,*h,r,?*wg,r,?*wm")
10091 (match_operand:DI 1 "input_operand" "r,Y,r,I,L,nF,d,m,d,*h,r,0,*wg,r,*wm,r"))]
10093 && (gpc_reg_operand (operands[0], DImode)
10094 || gpc_reg_operand (operands[1], DImode))"
10112 [(set_attr "type" "store,load,*,*,*,*,fpstore,fpload,fp,mfjmpr,mtjmpr,*,mftgpr,mffgpr,mftgpr,mffgpr")
10113 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4,4,4,4")])
10115 ;; Generate all one-bits and clear left or right.
10116 ;; Use (and:DI (rotate:DI ...)) to avoid anddi3 unnecessary clobber.
10118 [(set (match_operand:DI 0 "gpc_reg_operand" "")
10119 (match_operand:DI 1 "mask64_operand" ""))]
10120 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
10121 [(set (match_dup 0) (const_int -1))
10123 (and:DI (rotate:DI (match_dup 0)
10128 ;; Split a load of a large constant into the appropriate five-instruction
10129 ;; sequence. Handle anything in a constant number of insns.
10130 ;; When non-easy constants can go in the TOC, this should use
10131 ;; easy_fp_constant predicate.
10133 [(set (match_operand:DI 0 "gpc_reg_operand" "")
10134 (match_operand:DI 1 "const_int_operand" ""))]
10135 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
10136 [(set (match_dup 0) (match_dup 2))
10137 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
10140 if (rs6000_emit_set_const (operands[0], operands[1]))
10147 [(set (match_operand:DI 0 "gpc_reg_operand" "")
10148 (match_operand:DI 1 "const_scalar_int_operand" ""))]
10149 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
10150 [(set (match_dup 0) (match_dup 2))
10151 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
10154 if (rs6000_emit_set_const (operands[0], operands[1]))
10160 ;; TImode/PTImode is similar, except that we usually want to compute the
10161 ;; address into a register and use lsi/stsi (the exception is during reload).
10163 (define_insn "*mov<mode>_string"
10164 [(set (match_operand:TI2 0 "reg_or_mem_operand" "=Q,Y,????r,????r,????r,r")
10165 (match_operand:TI2 1 "input_operand" "r,r,Q,Y,r,n"))]
10166 "! TARGET_POWERPC64
10167 && (<MODE>mode != TImode || VECTOR_MEM_NONE_P (TImode))
10168 && (gpc_reg_operand (operands[0], <MODE>mode)
10169 || gpc_reg_operand (operands[1], <MODE>mode))"
10172 switch (which_alternative)
10175 gcc_unreachable ();
10178 return \"stswi %1,%P0,16\";
10182 /* If the address is not used in the output, we can use lsi. Otherwise,
10183 fall through to generating four loads. */
10185 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
10186 return \"lswi %0,%P1,16\";
10187 /* ... fall through ... */
10194 [(set_attr "type" "store,store,load,load,*,*")
10195 (set_attr "update" "yes")
10196 (set_attr "indexed" "yes")
10197 (set (attr "cell_micro") (if_then_else (match_test "TARGET_STRING")
10198 (const_string "always")
10199 (const_string "conditional")))])
10201 (define_insn "*mov<mode>_ppc64"
10202 [(set (match_operand:TI2 0 "nonimmediate_operand" "=wQ,Y,r,r,r,r")
10203 (match_operand:TI2 1 "input_operand" "r,r,wQ,Y,r,n"))]
10204 "(TARGET_POWERPC64 && VECTOR_MEM_NONE_P (<MODE>mode)
10205 && (gpc_reg_operand (operands[0], <MODE>mode)
10206 || gpc_reg_operand (operands[1], <MODE>mode)))"
10208 return rs6000_output_move_128bit (operands);
10210 [(set_attr "type" "store,store,load,load,*,*")
10211 (set_attr "length" "8")])
10214 [(set (match_operand:TI2 0 "int_reg_operand" "")
10215 (match_operand:TI2 1 "const_scalar_int_operand" ""))]
10217 && (VECTOR_MEM_NONE_P (<MODE>mode)
10218 || (reload_completed && INT_REGNO_P (REGNO (operands[0]))))"
10219 [(set (match_dup 2) (match_dup 4))
10220 (set (match_dup 3) (match_dup 5))]
10223 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
10225 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
10227 if (CONST_WIDE_INT_P (operands[1]))
10229 operands[4] = GEN_INT (CONST_WIDE_INT_ELT (operands[1], 1));
10230 operands[5] = GEN_INT (CONST_WIDE_INT_ELT (operands[1], 0));
10232 else if (CONST_INT_P (operands[1]))
10234 operands[4] = GEN_INT (- (INTVAL (operands[1]) < 0));
10235 operands[5] = operands[1];
10242 [(set (match_operand:TI2 0 "nonimmediate_operand" "")
10243 (match_operand:TI2 1 "input_operand" ""))]
10245 && gpr_or_gpr_p (operands[0], operands[1])
10246 && !direct_move_p (operands[0], operands[1])
10247 && !quad_load_store_p (operands[0], operands[1])"
10249 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
10251 (define_expand "load_multiple"
10252 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
10253 (match_operand:SI 1 "" ""))
10254 (use (match_operand:SI 2 "" ""))])]
10255 "TARGET_STRING && !TARGET_POWERPC64"
10263 /* Support only loading a constant number of fixed-point registers from
10264 memory and only bother with this if more than two; the machine
10265 doesn't support more than eight. */
10266 if (GET_CODE (operands[2]) != CONST_INT
10267 || INTVAL (operands[2]) <= 2
10268 || INTVAL (operands[2]) > 8
10269 || GET_CODE (operands[1]) != MEM
10270 || GET_CODE (operands[0]) != REG
10271 || REGNO (operands[0]) >= 32)
10274 count = INTVAL (operands[2]);
10275 regno = REGNO (operands[0]);
10277 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
10278 op1 = replace_equiv_address (operands[1],
10279 force_reg (SImode, XEXP (operands[1], 0)));
10281 for (i = 0; i < count; i++)
10282 XVECEXP (operands[3], 0, i)
10283 = gen_rtx_SET (VOIDmode, gen_rtx_REG (SImode, regno + i),
10284 adjust_address_nv (op1, SImode, i * 4));
10287 (define_insn "*ldmsi8"
10288 [(match_parallel 0 "load_multiple_operation"
10289 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10290 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10291 (set (match_operand:SI 3 "gpc_reg_operand" "")
10292 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10293 (set (match_operand:SI 4 "gpc_reg_operand" "")
10294 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
10295 (set (match_operand:SI 5 "gpc_reg_operand" "")
10296 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
10297 (set (match_operand:SI 6 "gpc_reg_operand" "")
10298 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
10299 (set (match_operand:SI 7 "gpc_reg_operand" "")
10300 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
10301 (set (match_operand:SI 8 "gpc_reg_operand" "")
10302 (mem:SI (plus:SI (match_dup 1) (const_int 24))))
10303 (set (match_operand:SI 9 "gpc_reg_operand" "")
10304 (mem:SI (plus:SI (match_dup 1) (const_int 28))))])]
10305 "TARGET_STRING && XVECLEN (operands[0], 0) == 8"
10307 { return rs6000_output_load_multiple (operands); }"
10308 [(set_attr "type" "load")
10309 (set_attr "update" "yes")
10310 (set_attr "indexed" "yes")
10311 (set_attr "length" "32")])
10313 (define_insn "*ldmsi7"
10314 [(match_parallel 0 "load_multiple_operation"
10315 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10316 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10317 (set (match_operand:SI 3 "gpc_reg_operand" "")
10318 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10319 (set (match_operand:SI 4 "gpc_reg_operand" "")
10320 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
10321 (set (match_operand:SI 5 "gpc_reg_operand" "")
10322 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
10323 (set (match_operand:SI 6 "gpc_reg_operand" "")
10324 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
10325 (set (match_operand:SI 7 "gpc_reg_operand" "")
10326 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
10327 (set (match_operand:SI 8 "gpc_reg_operand" "")
10328 (mem:SI (plus:SI (match_dup 1) (const_int 24))))])]
10329 "TARGET_STRING && XVECLEN (operands[0], 0) == 7"
10331 { return rs6000_output_load_multiple (operands); }"
10332 [(set_attr "type" "load")
10333 (set_attr "update" "yes")
10334 (set_attr "indexed" "yes")
10335 (set_attr "length" "32")])
10337 (define_insn "*ldmsi6"
10338 [(match_parallel 0 "load_multiple_operation"
10339 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10340 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10341 (set (match_operand:SI 3 "gpc_reg_operand" "")
10342 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10343 (set (match_operand:SI 4 "gpc_reg_operand" "")
10344 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
10345 (set (match_operand:SI 5 "gpc_reg_operand" "")
10346 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
10347 (set (match_operand:SI 6 "gpc_reg_operand" "")
10348 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
10349 (set (match_operand:SI 7 "gpc_reg_operand" "")
10350 (mem:SI (plus:SI (match_dup 1) (const_int 20))))])]
10351 "TARGET_STRING && XVECLEN (operands[0], 0) == 6"
10353 { return rs6000_output_load_multiple (operands); }"
10354 [(set_attr "type" "load")
10355 (set_attr "update" "yes")
10356 (set_attr "indexed" "yes")
10357 (set_attr "length" "32")])
10359 (define_insn "*ldmsi5"
10360 [(match_parallel 0 "load_multiple_operation"
10361 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10362 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10363 (set (match_operand:SI 3 "gpc_reg_operand" "")
10364 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10365 (set (match_operand:SI 4 "gpc_reg_operand" "")
10366 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
10367 (set (match_operand:SI 5 "gpc_reg_operand" "")
10368 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
10369 (set (match_operand:SI 6 "gpc_reg_operand" "")
10370 (mem:SI (plus:SI (match_dup 1) (const_int 16))))])]
10371 "TARGET_STRING && XVECLEN (operands[0], 0) == 5"
10373 { return rs6000_output_load_multiple (operands); }"
10374 [(set_attr "type" "load")
10375 (set_attr "update" "yes")
10376 (set_attr "indexed" "yes")
10377 (set_attr "length" "32")])
10379 (define_insn "*ldmsi4"
10380 [(match_parallel 0 "load_multiple_operation"
10381 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10382 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10383 (set (match_operand:SI 3 "gpc_reg_operand" "")
10384 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10385 (set (match_operand:SI 4 "gpc_reg_operand" "")
10386 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
10387 (set (match_operand:SI 5 "gpc_reg_operand" "")
10388 (mem:SI (plus:SI (match_dup 1) (const_int 12))))])]
10389 "TARGET_STRING && XVECLEN (operands[0], 0) == 4"
10391 { return rs6000_output_load_multiple (operands); }"
10392 [(set_attr "type" "load")
10393 (set_attr "update" "yes")
10394 (set_attr "indexed" "yes")
10395 (set_attr "length" "32")])
10397 (define_insn "*ldmsi3"
10398 [(match_parallel 0 "load_multiple_operation"
10399 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10400 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10401 (set (match_operand:SI 3 "gpc_reg_operand" "")
10402 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10403 (set (match_operand:SI 4 "gpc_reg_operand" "")
10404 (mem:SI (plus:SI (match_dup 1) (const_int 8))))])]
10405 "TARGET_STRING && XVECLEN (operands[0], 0) == 3"
10407 { return rs6000_output_load_multiple (operands); }"
10408 [(set_attr "type" "load")
10409 (set_attr "update" "yes")
10410 (set_attr "indexed" "yes")
10411 (set_attr "length" "32")])
10413 (define_expand "store_multiple"
10414 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
10415 (match_operand:SI 1 "" ""))
10416 (clobber (scratch:SI))
10417 (use (match_operand:SI 2 "" ""))])]
10418 "TARGET_STRING && !TARGET_POWERPC64"
10427 /* Support only storing a constant number of fixed-point registers to
10428 memory and only bother with this if more than two; the machine
10429 doesn't support more than eight. */
10430 if (GET_CODE (operands[2]) != CONST_INT
10431 || INTVAL (operands[2]) <= 2
10432 || INTVAL (operands[2]) > 8
10433 || GET_CODE (operands[0]) != MEM
10434 || GET_CODE (operands[1]) != REG
10435 || REGNO (operands[1]) >= 32)
10438 count = INTVAL (operands[2]);
10439 regno = REGNO (operands[1]);
10441 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count + 1));
10442 to = force_reg (SImode, XEXP (operands[0], 0));
10443 op0 = replace_equiv_address (operands[0], to);
10445 XVECEXP (operands[3], 0, 0)
10446 = gen_rtx_SET (VOIDmode, adjust_address_nv (op0, SImode, 0), operands[1]);
10447 XVECEXP (operands[3], 0, 1) = gen_rtx_CLOBBER (VOIDmode,
10448 gen_rtx_SCRATCH (SImode));
10450 for (i = 1; i < count; i++)
10451 XVECEXP (operands[3], 0, i + 1)
10452 = gen_rtx_SET (VOIDmode,
10453 adjust_address_nv (op0, SImode, i * 4),
10454 gen_rtx_REG (SImode, regno + i));
10457 (define_insn "*stmsi8"
10458 [(match_parallel 0 "store_multiple_operation"
10459 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10460 (match_operand:SI 2 "gpc_reg_operand" "r"))
10461 (clobber (match_scratch:SI 3 "=X"))
10462 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10463 (match_operand:SI 4 "gpc_reg_operand" "r"))
10464 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10465 (match_operand:SI 5 "gpc_reg_operand" "r"))
10466 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10467 (match_operand:SI 6 "gpc_reg_operand" "r"))
10468 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10469 (match_operand:SI 7 "gpc_reg_operand" "r"))
10470 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10471 (match_operand:SI 8 "gpc_reg_operand" "r"))
10472 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
10473 (match_operand:SI 9 "gpc_reg_operand" "r"))
10474 (set (mem:SI (plus:SI (match_dup 1) (const_int 28)))
10475 (match_operand:SI 10 "gpc_reg_operand" "r"))])]
10476 "TARGET_STRING && XVECLEN (operands[0], 0) == 9"
10478 [(set_attr "type" "store")
10479 (set_attr "update" "yes")
10480 (set_attr "indexed" "yes")
10481 (set_attr "cell_micro" "always")])
10483 (define_insn "*stmsi7"
10484 [(match_parallel 0 "store_multiple_operation"
10485 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10486 (match_operand:SI 2 "gpc_reg_operand" "r"))
10487 (clobber (match_scratch:SI 3 "=X"))
10488 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10489 (match_operand:SI 4 "gpc_reg_operand" "r"))
10490 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10491 (match_operand:SI 5 "gpc_reg_operand" "r"))
10492 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10493 (match_operand:SI 6 "gpc_reg_operand" "r"))
10494 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10495 (match_operand:SI 7 "gpc_reg_operand" "r"))
10496 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10497 (match_operand:SI 8 "gpc_reg_operand" "r"))
10498 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
10499 (match_operand:SI 9 "gpc_reg_operand" "r"))])]
10500 "TARGET_STRING && XVECLEN (operands[0], 0) == 8"
10502 [(set_attr "type" "store")
10503 (set_attr "update" "yes")
10504 (set_attr "indexed" "yes")
10505 (set_attr "cell_micro" "always")])
10507 (define_insn "*stmsi6"
10508 [(match_parallel 0 "store_multiple_operation"
10509 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10510 (match_operand:SI 2 "gpc_reg_operand" "r"))
10511 (clobber (match_scratch:SI 3 "=X"))
10512 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10513 (match_operand:SI 4 "gpc_reg_operand" "r"))
10514 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10515 (match_operand:SI 5 "gpc_reg_operand" "r"))
10516 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10517 (match_operand:SI 6 "gpc_reg_operand" "r"))
10518 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10519 (match_operand:SI 7 "gpc_reg_operand" "r"))
10520 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10521 (match_operand:SI 8 "gpc_reg_operand" "r"))])]
10522 "TARGET_STRING && XVECLEN (operands[0], 0) == 7"
10524 [(set_attr "type" "store")
10525 (set_attr "update" "yes")
10526 (set_attr "indexed" "yes")
10527 (set_attr "cell_micro" "always")])
10529 (define_insn "*stmsi5"
10530 [(match_parallel 0 "store_multiple_operation"
10531 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10532 (match_operand:SI 2 "gpc_reg_operand" "r"))
10533 (clobber (match_scratch:SI 3 "=X"))
10534 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10535 (match_operand:SI 4 "gpc_reg_operand" "r"))
10536 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10537 (match_operand:SI 5 "gpc_reg_operand" "r"))
10538 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10539 (match_operand:SI 6 "gpc_reg_operand" "r"))
10540 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10541 (match_operand:SI 7 "gpc_reg_operand" "r"))])]
10542 "TARGET_STRING && XVECLEN (operands[0], 0) == 6"
10544 [(set_attr "type" "store")
10545 (set_attr "update" "yes")
10546 (set_attr "indexed" "yes")
10547 (set_attr "cell_micro" "always")])
10549 (define_insn "*stmsi4"
10550 [(match_parallel 0 "store_multiple_operation"
10551 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10552 (match_operand:SI 2 "gpc_reg_operand" "r"))
10553 (clobber (match_scratch:SI 3 "=X"))
10554 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10555 (match_operand:SI 4 "gpc_reg_operand" "r"))
10556 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10557 (match_operand:SI 5 "gpc_reg_operand" "r"))
10558 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10559 (match_operand:SI 6 "gpc_reg_operand" "r"))])]
10560 "TARGET_STRING && XVECLEN (operands[0], 0) == 5"
10562 [(set_attr "type" "store")
10563 (set_attr "update" "yes")
10564 (set_attr "indexed" "yes")
10565 (set_attr "cell_micro" "always")])
10567 (define_insn "*stmsi3"
10568 [(match_parallel 0 "store_multiple_operation"
10569 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10570 (match_operand:SI 2 "gpc_reg_operand" "r"))
10571 (clobber (match_scratch:SI 3 "=X"))
10572 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10573 (match_operand:SI 4 "gpc_reg_operand" "r"))
10574 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10575 (match_operand:SI 5 "gpc_reg_operand" "r"))])]
10576 "TARGET_STRING && XVECLEN (operands[0], 0) == 4"
10578 [(set_attr "type" "store")
10579 (set_attr "update" "yes")
10580 (set_attr "indexed" "yes")
10581 (set_attr "cell_micro" "always")])
10583 (define_expand "setmemsi"
10584 [(parallel [(set (match_operand:BLK 0 "" "")
10585 (match_operand 2 "const_int_operand" ""))
10586 (use (match_operand:SI 1 "" ""))
10587 (use (match_operand:SI 3 "" ""))])]
10591 /* If value to set is not zero, use the library routine. */
10592 if (operands[2] != const0_rtx)
10595 if (expand_block_clear (operands))
10601 ;; String/block move insn.
10602 ;; Argument 0 is the destination
10603 ;; Argument 1 is the source
10604 ;; Argument 2 is the length
10605 ;; Argument 3 is the alignment
10607 (define_expand "movmemsi"
10608 [(parallel [(set (match_operand:BLK 0 "" "")
10609 (match_operand:BLK 1 "" ""))
10610 (use (match_operand:SI 2 "" ""))
10611 (use (match_operand:SI 3 "" ""))])]
10615 if (expand_block_move (operands))
10621 ;; Move up to 32 bytes at a time. The fixed registers are needed because the
10622 ;; register allocator doesn't have a clue about allocating 8 word registers.
10623 ;; rD/rS = r5 is preferred, efficient form.
10624 (define_expand "movmemsi_8reg"
10625 [(parallel [(set (match_operand 0 "" "")
10626 (match_operand 1 "" ""))
10627 (use (match_operand 2 "" ""))
10628 (use (match_operand 3 "" ""))
10629 (clobber (reg:SI 5))
10630 (clobber (reg:SI 6))
10631 (clobber (reg:SI 7))
10632 (clobber (reg:SI 8))
10633 (clobber (reg:SI 9))
10634 (clobber (reg:SI 10))
10635 (clobber (reg:SI 11))
10636 (clobber (reg:SI 12))
10637 (clobber (match_scratch:SI 4 ""))])]
10642 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
10643 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
10644 (use (match_operand:SI 2 "immediate_operand" "i"))
10645 (use (match_operand:SI 3 "immediate_operand" "i"))
10646 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10647 (clobber (reg:SI 6))
10648 (clobber (reg:SI 7))
10649 (clobber (reg:SI 8))
10650 (clobber (reg:SI 9))
10651 (clobber (reg:SI 10))
10652 (clobber (reg:SI 11))
10653 (clobber (reg:SI 12))
10654 (clobber (match_scratch:SI 5 "=X"))]
10656 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
10657 || INTVAL (operands[2]) == 0)
10658 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
10659 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
10660 && REGNO (operands[4]) == 5"
10661 "lswi %4,%1,%2\;stswi %4,%0,%2"
10662 [(set_attr "type" "store")
10663 (set_attr "update" "yes")
10664 (set_attr "indexed" "yes")
10665 (set_attr "cell_micro" "always")
10666 (set_attr "length" "8")])
10668 ;; Move up to 24 bytes at a time. The fixed registers are needed because the
10669 ;; register allocator doesn't have a clue about allocating 6 word registers.
10670 ;; rD/rS = r5 is preferred, efficient form.
10671 (define_expand "movmemsi_6reg"
10672 [(parallel [(set (match_operand 0 "" "")
10673 (match_operand 1 "" ""))
10674 (use (match_operand 2 "" ""))
10675 (use (match_operand 3 "" ""))
10676 (clobber (reg:SI 5))
10677 (clobber (reg:SI 6))
10678 (clobber (reg:SI 7))
10679 (clobber (reg:SI 8))
10680 (clobber (reg:SI 9))
10681 (clobber (reg:SI 10))
10682 (clobber (match_scratch:SI 4 ""))])]
10687 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
10688 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
10689 (use (match_operand:SI 2 "immediate_operand" "i"))
10690 (use (match_operand:SI 3 "immediate_operand" "i"))
10691 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10692 (clobber (reg:SI 6))
10693 (clobber (reg:SI 7))
10694 (clobber (reg:SI 8))
10695 (clobber (reg:SI 9))
10696 (clobber (reg:SI 10))
10697 (clobber (match_scratch:SI 5 "=X"))]
10699 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
10700 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
10701 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
10702 && REGNO (operands[4]) == 5"
10703 "lswi %4,%1,%2\;stswi %4,%0,%2"
10704 [(set_attr "type" "store")
10705 (set_attr "update" "yes")
10706 (set_attr "indexed" "yes")
10707 (set_attr "cell_micro" "always")
10708 (set_attr "length" "8")])
10710 ;; Move up to 16 bytes at a time, using 4 fixed registers to avoid spill
10711 ;; problems with TImode.
10712 ;; rD/rS = r5 is preferred, efficient form.
10713 (define_expand "movmemsi_4reg"
10714 [(parallel [(set (match_operand 0 "" "")
10715 (match_operand 1 "" ""))
10716 (use (match_operand 2 "" ""))
10717 (use (match_operand 3 "" ""))
10718 (clobber (reg:SI 5))
10719 (clobber (reg:SI 6))
10720 (clobber (reg:SI 7))
10721 (clobber (reg:SI 8))
10722 (clobber (match_scratch:SI 4 ""))])]
10727 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
10728 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
10729 (use (match_operand:SI 2 "immediate_operand" "i"))
10730 (use (match_operand:SI 3 "immediate_operand" "i"))
10731 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10732 (clobber (reg:SI 6))
10733 (clobber (reg:SI 7))
10734 (clobber (reg:SI 8))
10735 (clobber (match_scratch:SI 5 "=X"))]
10737 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
10738 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
10739 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
10740 && REGNO (operands[4]) == 5"
10741 "lswi %4,%1,%2\;stswi %4,%0,%2"
10742 [(set_attr "type" "store")
10743 (set_attr "update" "yes")
10744 (set_attr "indexed" "yes")
10745 (set_attr "cell_micro" "always")
10746 (set_attr "length" "8")])
10748 ;; Move up to 8 bytes at a time.
10749 (define_expand "movmemsi_2reg"
10750 [(parallel [(set (match_operand 0 "" "")
10751 (match_operand 1 "" ""))
10752 (use (match_operand 2 "" ""))
10753 (use (match_operand 3 "" ""))
10754 (clobber (match_scratch:DI 4 ""))
10755 (clobber (match_scratch:SI 5 ""))])]
10756 "TARGET_STRING && ! TARGET_POWERPC64"
10760 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
10761 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
10762 (use (match_operand:SI 2 "immediate_operand" "i"))
10763 (use (match_operand:SI 3 "immediate_operand" "i"))
10764 (clobber (match_scratch:DI 4 "=&r"))
10765 (clobber (match_scratch:SI 5 "=X"))]
10766 "TARGET_STRING && ! TARGET_POWERPC64
10767 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
10768 "lswi %4,%1,%2\;stswi %4,%0,%2"
10769 [(set_attr "type" "store")
10770 (set_attr "update" "yes")
10771 (set_attr "indexed" "yes")
10772 (set_attr "cell_micro" "always")
10773 (set_attr "length" "8")])
10775 ;; Move up to 4 bytes at a time.
10776 (define_expand "movmemsi_1reg"
10777 [(parallel [(set (match_operand 0 "" "")
10778 (match_operand 1 "" ""))
10779 (use (match_operand 2 "" ""))
10780 (use (match_operand 3 "" ""))
10781 (clobber (match_scratch:SI 4 ""))
10782 (clobber (match_scratch:SI 5 ""))])]
10787 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
10788 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
10789 (use (match_operand:SI 2 "immediate_operand" "i"))
10790 (use (match_operand:SI 3 "immediate_operand" "i"))
10791 (clobber (match_scratch:SI 4 "=&r"))
10792 (clobber (match_scratch:SI 5 "=X"))]
10793 "TARGET_STRING && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
10794 "lswi %4,%1,%2\;stswi %4,%0,%2"
10795 [(set_attr "type" "store")
10796 (set_attr "update" "yes")
10797 (set_attr "indexed" "yes")
10798 (set_attr "cell_micro" "always")
10799 (set_attr "length" "8")])
10801 ;; Define insns that do load or store with update. Some of these we can
10802 ;; get by using pre-decrement or pre-increment, but the hardware can also
10803 ;; do cases where the increment is not the size of the object.
10805 ;; In all these cases, we use operands 0 and 1 for the register being
10806 ;; incremented because those are the operands that local-alloc will
10807 ;; tie and these are the pair most likely to be tieable (and the ones
10808 ;; that will benefit the most).
10810 (define_insn "*movdi_update1"
10811 [(set (match_operand:DI 3 "gpc_reg_operand" "=r,r")
10812 (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
10813 (match_operand:DI 2 "reg_or_aligned_short_operand" "r,I"))))
10814 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
10815 (plus:DI (match_dup 1) (match_dup 2)))]
10816 "TARGET_POWERPC64 && TARGET_UPDATE
10817 && (!avoiding_indexed_address_p (DImode)
10818 || !gpc_reg_operand (operands[2], DImode))"
10822 [(set_attr "type" "load")
10823 (set_attr "update" "yes")
10824 (set_attr "indexed" "yes,no")])
10826 (define_insn "movdi_<mode>_update"
10827 [(set (mem:DI (plus:P (match_operand:P 1 "gpc_reg_operand" "0,0")
10828 (match_operand:P 2 "reg_or_aligned_short_operand" "r,I")))
10829 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
10830 (set (match_operand:P 0 "gpc_reg_operand" "=b,b")
10831 (plus:P (match_dup 1) (match_dup 2)))]
10832 "TARGET_POWERPC64 && TARGET_UPDATE
10833 && (!avoiding_indexed_address_p (Pmode)
10834 || !gpc_reg_operand (operands[2], Pmode)
10835 || (REG_P (operands[0])
10836 && REGNO (operands[0]) == STACK_POINTER_REGNUM))"
10840 [(set_attr "type" "store")
10841 (set_attr "update" "yes")
10842 (set_attr "indexed" "yes,no")])
10844 ;; This pattern is only conditional on TARGET_POWERPC64, as it is
10845 ;; needed for stack allocation, even if the user passes -mno-update.
10846 (define_insn "movdi_<mode>_update_stack"
10847 [(set (mem:DI (plus:P (match_operand:P 1 "gpc_reg_operand" "0,0")
10848 (match_operand:P 2 "reg_or_aligned_short_operand" "r,I")))
10849 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
10850 (set (match_operand:P 0 "gpc_reg_operand" "=b,b")
10851 (plus:P (match_dup 1) (match_dup 2)))]
10856 [(set_attr "type" "store")
10857 (set_attr "update" "yes")
10858 (set_attr "indexed" "yes,no")])
10860 (define_insn "*movsi_update1"
10861 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
10862 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10863 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10864 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10865 (plus:SI (match_dup 1) (match_dup 2)))]
10867 && (!avoiding_indexed_address_p (SImode)
10868 || !gpc_reg_operand (operands[2], SImode))"
10872 [(set_attr "type" "load")
10873 (set_attr "update" "yes")
10874 (set_attr "indexed" "yes,no")])
10876 (define_insn "*movsi_update2"
10877 [(set (match_operand:DI 3 "gpc_reg_operand" "=r")
10879 (mem:SI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0")
10880 (match_operand:DI 2 "gpc_reg_operand" "r")))))
10881 (set (match_operand:DI 0 "gpc_reg_operand" "=b")
10882 (plus:DI (match_dup 1) (match_dup 2)))]
10883 "TARGET_POWERPC64 && rs6000_gen_cell_microcode
10884 && !avoiding_indexed_address_p (DImode)"
10886 [(set_attr "type" "load")
10887 (set_attr "sign_extend" "yes")
10888 (set_attr "update" "yes")
10889 (set_attr "indexed" "yes")])
10891 (define_insn "movsi_update"
10892 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10893 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10894 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
10895 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10896 (plus:SI (match_dup 1) (match_dup 2)))]
10898 && (!avoiding_indexed_address_p (SImode)
10899 || !gpc_reg_operand (operands[2], SImode)
10900 || (REG_P (operands[0])
10901 && REGNO (operands[0]) == STACK_POINTER_REGNUM))"
10905 [(set_attr "type" "store")
10906 (set_attr "update" "yes")
10907 (set_attr "indexed" "yes,no")])
10909 ;; This is an unconditional pattern; needed for stack allocation, even
10910 ;; if the user passes -mno-update.
10911 (define_insn "movsi_update_stack"
10912 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10913 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10914 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
10915 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10916 (plus:SI (match_dup 1) (match_dup 2)))]
10921 [(set_attr "type" "store")
10922 (set_attr "update" "yes")
10923 (set_attr "indexed" "yes,no")])
10925 (define_insn "*movhi_update1"
10926 [(set (match_operand:HI 3 "gpc_reg_operand" "=r,r")
10927 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10928 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10929 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10930 (plus:SI (match_dup 1) (match_dup 2)))]
10932 && (!avoiding_indexed_address_p (SImode)
10933 || !gpc_reg_operand (operands[2], SImode))"
10937 [(set_attr "type" "load")
10938 (set_attr "update" "yes")
10939 (set_attr "indexed" "yes,no")])
10941 (define_insn "*movhi_update2"
10942 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
10944 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10945 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
10946 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10947 (plus:SI (match_dup 1) (match_dup 2)))]
10949 && (!avoiding_indexed_address_p (SImode)
10950 || !gpc_reg_operand (operands[2], SImode))"
10954 [(set_attr "type" "load")
10955 (set_attr "update" "yes")
10956 (set_attr "indexed" "yes,no")])
10958 (define_insn "*movhi_update3"
10959 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
10961 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10962 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
10963 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10964 (plus:SI (match_dup 1) (match_dup 2)))]
10965 "TARGET_UPDATE && rs6000_gen_cell_microcode
10966 && (!avoiding_indexed_address_p (SImode)
10967 || !gpc_reg_operand (operands[2], SImode))"
10971 [(set_attr "type" "load")
10972 (set_attr "sign_extend" "yes")
10973 (set_attr "update" "yes")
10974 (set_attr "indexed" "yes,no")])
10976 (define_insn "*movhi_update4"
10977 [(set (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10978 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10979 (match_operand:HI 3 "gpc_reg_operand" "r,r"))
10980 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10981 (plus:SI (match_dup 1) (match_dup 2)))]
10983 && (!avoiding_indexed_address_p (SImode)
10984 || !gpc_reg_operand (operands[2], SImode))"
10988 [(set_attr "type" "store")
10989 (set_attr "update" "yes")
10990 (set_attr "indexed" "yes,no")])
10992 (define_insn "*movqi_update1"
10993 [(set (match_operand:QI 3 "gpc_reg_operand" "=r,r")
10994 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10995 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10996 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10997 (plus:SI (match_dup 1) (match_dup 2)))]
10999 && (!avoiding_indexed_address_p (SImode)
11000 || !gpc_reg_operand (operands[2], SImode))"
11004 [(set_attr "type" "load")
11005 (set_attr "update" "yes")
11006 (set_attr "indexed" "yes,no")])
11008 (define_insn "*movqi_update2"
11009 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
11011 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11012 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
11013 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11014 (plus:SI (match_dup 1) (match_dup 2)))]
11016 && (!avoiding_indexed_address_p (SImode)
11017 || !gpc_reg_operand (operands[2], SImode))"
11021 [(set_attr "type" "load")
11022 (set_attr "update" "yes")
11023 (set_attr "indexed" "yes,no")])
11025 (define_insn "*movqi_update3"
11026 [(set (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11027 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
11028 (match_operand:QI 3 "gpc_reg_operand" "r,r"))
11029 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11030 (plus:SI (match_dup 1) (match_dup 2)))]
11032 && (!avoiding_indexed_address_p (SImode)
11033 || !gpc_reg_operand (operands[2], SImode))"
11037 [(set_attr "type" "store")
11038 (set_attr "update" "yes")
11039 (set_attr "indexed" "yes,no")])
11041 (define_insn "*movsf_update1"
11042 [(set (match_operand:SF 3 "gpc_reg_operand" "=f,f")
11043 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11044 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
11045 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11046 (plus:SI (match_dup 1) (match_dup 2)))]
11047 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT && TARGET_UPDATE
11048 && (!avoiding_indexed_address_p (SImode)
11049 || !gpc_reg_operand (operands[2], SImode))"
11053 [(set_attr "type" "fpload")
11054 (set_attr "update" "yes")
11055 (set_attr "indexed" "yes,no")])
11057 (define_insn "*movsf_update2"
11058 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11059 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
11060 (match_operand:SF 3 "gpc_reg_operand" "f,f"))
11061 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11062 (plus:SI (match_dup 1) (match_dup 2)))]
11063 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT && TARGET_UPDATE
11064 && (!avoiding_indexed_address_p (SImode)
11065 || !gpc_reg_operand (operands[2], SImode))"
11069 [(set_attr "type" "fpstore")
11070 (set_attr "update" "yes")
11071 (set_attr "indexed" "yes,no")])
11073 (define_insn "*movsf_update3"
11074 [(set (match_operand:SF 3 "gpc_reg_operand" "=r,r")
11075 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11076 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
11077 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11078 (plus:SI (match_dup 1) (match_dup 2)))]
11079 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE
11080 && (!avoiding_indexed_address_p (SImode)
11081 || !gpc_reg_operand (operands[2], SImode))"
11085 [(set_attr "type" "load")
11086 (set_attr "update" "yes")
11087 (set_attr "indexed" "yes,no")])
11089 (define_insn "*movsf_update4"
11090 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11091 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
11092 (match_operand:SF 3 "gpc_reg_operand" "r,r"))
11093 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11094 (plus:SI (match_dup 1) (match_dup 2)))]
11095 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE
11096 && (!avoiding_indexed_address_p (SImode)
11097 || !gpc_reg_operand (operands[2], SImode))"
11101 [(set_attr "type" "store")
11102 (set_attr "update" "yes")
11103 (set_attr "indexed" "yes,no")])
11105 (define_insn "*movdf_update1"
11106 [(set (match_operand:DF 3 "gpc_reg_operand" "=d,d")
11107 (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11108 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
11109 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11110 (plus:SI (match_dup 1) (match_dup 2)))]
11111 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_UPDATE
11112 && (!avoiding_indexed_address_p (SImode)
11113 || !gpc_reg_operand (operands[2], SImode))"
11117 [(set_attr "type" "fpload")
11118 (set_attr "update" "yes")
11119 (set_attr "indexed" "yes,no")])
11121 (define_insn "*movdf_update2"
11122 [(set (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11123 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
11124 (match_operand:DF 3 "gpc_reg_operand" "d,d"))
11125 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11126 (plus:SI (match_dup 1) (match_dup 2)))]
11127 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_UPDATE
11128 && (!avoiding_indexed_address_p (SImode)
11129 || !gpc_reg_operand (operands[2], SImode))"
11133 [(set_attr "type" "fpstore")
11134 (set_attr "update" "yes")
11135 (set_attr "indexed" "yes,no")])
11138 ;; After inserting conditional returns we can sometimes have
11139 ;; unnecessary register moves. Unfortunately we cannot have a
11140 ;; modeless peephole here, because some single SImode sets have early
11141 ;; clobber outputs. Although those sets expand to multi-ppc-insn
11142 ;; sequences, using get_attr_length here will smash the operands
11143 ;; array. Neither is there an early_cobbler_p predicate.
11144 ;; Disallow subregs for E500 so we don't munge frob_di_df_2.
11146 [(set (match_operand:DF 0 "gpc_reg_operand" "")
11147 (match_operand:DF 1 "any_operand" ""))
11148 (set (match_operand:DF 2 "gpc_reg_operand" "")
11150 "!(TARGET_E500_DOUBLE && GET_CODE (operands[2]) == SUBREG)
11151 && peep2_reg_dead_p (2, operands[0])"
11152 [(set (match_dup 2) (match_dup 1))])
11155 [(set (match_operand:SF 0 "gpc_reg_operand" "")
11156 (match_operand:SF 1 "any_operand" ""))
11157 (set (match_operand:SF 2 "gpc_reg_operand" "")
11159 "peep2_reg_dead_p (2, operands[0])"
11160 [(set (match_dup 2) (match_dup 1))])
11165 ;; Mode attributes for different ABIs.
11166 (define_mode_iterator TLSmode [(SI "! TARGET_64BIT") (DI "TARGET_64BIT")])
11167 (define_mode_attr tls_abi_suffix [(SI "32") (DI "64")])
11168 (define_mode_attr tls_sysv_suffix [(SI "si") (DI "di")])
11169 (define_mode_attr tls_insn_suffix [(SI "wz") (DI "d")])
11171 (define_insn_and_split "tls_gd_aix<TLSmode:tls_abi_suffix>"
11172 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11173 (call (mem:TLSmode (match_operand:TLSmode 3 "symbol_ref_operand" "s"))
11174 (match_operand 4 "" "g")))
11175 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11176 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11178 (clobber (reg:SI LR_REGNO))]
11179 "HAVE_AS_TLS && (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)"
11181 if (TARGET_CMODEL != CMODEL_SMALL)
11182 return "addis %0,%1,%2@got@tlsgd@ha\;addi %0,%0,%2@got@tlsgd@l\;"
11185 return "addi %0,%1,%2@got@tlsgd\;bl %z3\;nop";
11187 "&& TARGET_TLS_MARKERS"
11188 [(set (match_dup 0)
11189 (unspec:TLSmode [(match_dup 1)
11192 (parallel [(set (match_dup 0)
11193 (call (mem:TLSmode (match_dup 3))
11195 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD)
11196 (clobber (reg:SI LR_REGNO))])]
11198 [(set_attr "type" "two")
11199 (set (attr "length")
11200 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
11204 (define_insn_and_split "tls_gd_sysv<TLSmode:tls_sysv_suffix>"
11205 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11206 (call (mem:TLSmode (match_operand:TLSmode 3 "symbol_ref_operand" "s"))
11207 (match_operand 4 "" "g")))
11208 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11209 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11211 (clobber (reg:SI LR_REGNO))]
11212 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4"
11216 if (TARGET_SECURE_PLT && flag_pic == 2)
11217 return "addi %0,%1,%2@got@tlsgd\;bl %z3+32768@plt";
11219 return "addi %0,%1,%2@got@tlsgd\;bl %z3@plt";
11222 return "addi %0,%1,%2@got@tlsgd\;bl %z3";
11224 "&& TARGET_TLS_MARKERS"
11225 [(set (match_dup 0)
11226 (unspec:TLSmode [(match_dup 1)
11229 (parallel [(set (match_dup 0)
11230 (call (mem:TLSmode (match_dup 3))
11232 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD)
11233 (clobber (reg:SI LR_REGNO))])]
11235 [(set_attr "type" "two")
11236 (set_attr "length" "8")])
11238 (define_insn_and_split "*tls_gd<TLSmode:tls_abi_suffix>"
11239 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11240 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11241 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11243 "HAVE_AS_TLS && TARGET_TLS_MARKERS"
11244 "addi %0,%1,%2@got@tlsgd"
11245 "&& TARGET_CMODEL != CMODEL_SMALL"
11246 [(set (match_dup 3)
11248 (unspec:TLSmode [(match_dup 1) (match_dup 2)] UNSPEC_TLSGD)))
11250 (lo_sum:TLSmode (match_dup 3)
11251 (unspec:TLSmode [(match_dup 1) (match_dup 2)] UNSPEC_TLSGD)))]
11254 operands[3] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
11256 [(set (attr "length")
11257 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
11261 (define_insn "*tls_gd_high<TLSmode:tls_abi_suffix>"
11262 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11264 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11265 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11267 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
11268 "addis %0,%1,%2@got@tlsgd@ha"
11269 [(set_attr "length" "4")])
11271 (define_insn "*tls_gd_low<TLSmode:tls_abi_suffix>"
11272 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11273 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11274 (unspec:TLSmode [(match_operand:TLSmode 3 "gpc_reg_operand" "b")
11275 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11277 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
11278 "addi %0,%1,%2@got@tlsgd@l"
11279 [(set_attr "length" "4")])
11281 (define_insn "*tls_gd_call_aix<TLSmode:tls_abi_suffix>"
11282 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11283 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
11284 (match_operand 2 "" "g")))
11285 (unspec:TLSmode [(match_operand:TLSmode 3 "rs6000_tls_symbol_ref" "")]
11287 (clobber (reg:SI LR_REGNO))]
11288 "HAVE_AS_TLS && TARGET_TLS_MARKERS
11289 && (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)"
11290 "bl %z1(%3@tlsgd)\;nop"
11291 [(set_attr "type" "branch")
11292 (set_attr "length" "8")])
11294 (define_insn "*tls_gd_call_sysv<TLSmode:tls_abi_suffix>"
11295 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11296 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
11297 (match_operand 2 "" "g")))
11298 (unspec:TLSmode [(match_operand:TLSmode 3 "rs6000_tls_symbol_ref" "")]
11300 (clobber (reg:SI LR_REGNO))]
11301 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4 && TARGET_TLS_MARKERS"
11305 if (TARGET_SECURE_PLT && flag_pic == 2)
11306 return "bl %z1+32768(%3@tlsgd)@plt";
11307 return "bl %z1(%3@tlsgd)@plt";
11309 return "bl %z1(%3@tlsgd)";
11311 [(set_attr "type" "branch")
11312 (set_attr "length" "4")])
11314 (define_insn_and_split "tls_ld_aix<TLSmode:tls_abi_suffix>"
11315 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11316 (call (mem:TLSmode (match_operand:TLSmode 2 "symbol_ref_operand" "s"))
11317 (match_operand 3 "" "g")))
11318 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
11320 (clobber (reg:SI LR_REGNO))]
11321 "HAVE_AS_TLS && (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)"
11323 if (TARGET_CMODEL != CMODEL_SMALL)
11324 return "addis %0,%1,%&@got@tlsld@ha\;addi %0,%0,%&@got@tlsld@l\;"
11327 return "addi %0,%1,%&@got@tlsld\;bl %z2\;nop";
11329 "&& TARGET_TLS_MARKERS"
11330 [(set (match_dup 0)
11331 (unspec:TLSmode [(match_dup 1)]
11333 (parallel [(set (match_dup 0)
11334 (call (mem:TLSmode (match_dup 2))
11336 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
11337 (clobber (reg:SI LR_REGNO))])]
11339 [(set_attr "type" "two")
11340 (set (attr "length")
11341 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
11345 (define_insn_and_split "tls_ld_sysv<TLSmode:tls_sysv_suffix>"
11346 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11347 (call (mem:TLSmode (match_operand:TLSmode 2 "symbol_ref_operand" "s"))
11348 (match_operand 3 "" "g")))
11349 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
11351 (clobber (reg:SI LR_REGNO))]
11352 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4"
11356 if (TARGET_SECURE_PLT && flag_pic == 2)
11357 return "addi %0,%1,%&@got@tlsld\;bl %z2+32768@plt";
11359 return "addi %0,%1,%&@got@tlsld\;bl %z2@plt";
11362 return "addi %0,%1,%&@got@tlsld\;bl %z2";
11364 "&& TARGET_TLS_MARKERS"
11365 [(set (match_dup 0)
11366 (unspec:TLSmode [(match_dup 1)]
11368 (parallel [(set (match_dup 0)
11369 (call (mem:TLSmode (match_dup 2))
11371 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
11372 (clobber (reg:SI LR_REGNO))])]
11374 [(set_attr "length" "8")])
11376 (define_insn_and_split "*tls_ld<TLSmode:tls_abi_suffix>"
11377 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11378 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
11380 "HAVE_AS_TLS && TARGET_TLS_MARKERS"
11381 "addi %0,%1,%&@got@tlsld"
11382 "&& TARGET_CMODEL != CMODEL_SMALL"
11383 [(set (match_dup 2)
11385 (unspec:TLSmode [(const_int 0) (match_dup 1)] UNSPEC_TLSLD)))
11387 (lo_sum:TLSmode (match_dup 2)
11388 (unspec:TLSmode [(const_int 0) (match_dup 1)] UNSPEC_TLSLD)))]
11391 operands[2] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
11393 [(set (attr "length")
11394 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
11398 (define_insn "*tls_ld_high<TLSmode:tls_abi_suffix>"
11399 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11401 (unspec:TLSmode [(const_int 0)
11402 (match_operand:TLSmode 1 "gpc_reg_operand" "b")]
11404 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
11405 "addis %0,%1,%&@got@tlsld@ha"
11406 [(set_attr "length" "4")])
11408 (define_insn "*tls_ld_low<TLSmode:tls_abi_suffix>"
11409 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11410 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11411 (unspec:TLSmode [(const_int 0)
11412 (match_operand:TLSmode 2 "gpc_reg_operand" "b")]
11414 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
11415 "addi %0,%1,%&@got@tlsld@l"
11416 [(set_attr "length" "4")])
11418 (define_insn "*tls_ld_call_aix<TLSmode:tls_abi_suffix>"
11419 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11420 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
11421 (match_operand 2 "" "g")))
11422 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
11423 (clobber (reg:SI LR_REGNO))]
11424 "HAVE_AS_TLS && TARGET_TLS_MARKERS
11425 && (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)"
11426 "bl %z1(%&@tlsld)\;nop"
11427 [(set_attr "type" "branch")
11428 (set_attr "length" "8")])
11430 (define_insn "*tls_ld_call_sysv<TLSmode:tls_abi_suffix>"
11431 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11432 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
11433 (match_operand 2 "" "g")))
11434 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
11435 (clobber (reg:SI LR_REGNO))]
11436 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4 && TARGET_TLS_MARKERS"
11440 if (TARGET_SECURE_PLT && flag_pic == 2)
11441 return "bl %z1+32768(%&@tlsld)@plt";
11442 return "bl %z1(%&@tlsld)@plt";
11444 return "bl %z1(%&@tlsld)";
11446 [(set_attr "type" "branch")
11447 (set_attr "length" "4")])
11449 (define_insn "tls_dtprel_<TLSmode:tls_abi_suffix>"
11450 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11451 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11452 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11453 UNSPEC_TLSDTPREL))]
11455 "addi %0,%1,%2@dtprel")
11457 (define_insn "tls_dtprel_ha_<TLSmode:tls_abi_suffix>"
11458 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11459 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11460 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11461 UNSPEC_TLSDTPRELHA))]
11463 "addis %0,%1,%2@dtprel@ha")
11465 (define_insn "tls_dtprel_lo_<TLSmode:tls_abi_suffix>"
11466 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11467 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11468 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11469 UNSPEC_TLSDTPRELLO))]
11471 "addi %0,%1,%2@dtprel@l")
11473 (define_insn_and_split "tls_got_dtprel_<TLSmode:tls_abi_suffix>"
11474 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11475 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11476 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11477 UNSPEC_TLSGOTDTPREL))]
11479 "l<TLSmode:tls_insn_suffix> %0,%2@got@dtprel(%1)"
11480 "&& TARGET_CMODEL != CMODEL_SMALL"
11481 [(set (match_dup 3)
11483 (unspec:TLSmode [(match_dup 1) (match_dup 2)] UNSPEC_TLSGOTDTPREL)))
11485 (lo_sum:TLSmode (match_dup 3)
11486 (unspec:TLSmode [(match_dup 1) (match_dup 2)] UNSPEC_TLSGOTDTPREL)))]
11489 operands[3] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
11491 [(set (attr "length")
11492 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
11496 (define_insn "*tls_got_dtprel_high<TLSmode:tls_abi_suffix>"
11497 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11499 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11500 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11501 UNSPEC_TLSGOTDTPREL)))]
11502 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
11503 "addis %0,%1,%2@got@dtprel@ha"
11504 [(set_attr "length" "4")])
11506 (define_insn "*tls_got_dtprel_low<TLSmode:tls_abi_suffix>"
11507 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11508 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11509 (unspec:TLSmode [(match_operand:TLSmode 3 "gpc_reg_operand" "b")
11510 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11511 UNSPEC_TLSGOTDTPREL)))]
11512 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
11513 "l<TLSmode:tls_insn_suffix> %0,%2@got@dtprel@l(%1)"
11514 [(set_attr "length" "4")])
11516 (define_insn "tls_tprel_<TLSmode:tls_abi_suffix>"
11517 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11518 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11519 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11522 "addi %0,%1,%2@tprel")
11524 (define_insn "tls_tprel_ha_<TLSmode:tls_abi_suffix>"
11525 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11526 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11527 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11528 UNSPEC_TLSTPRELHA))]
11530 "addis %0,%1,%2@tprel@ha")
11532 (define_insn "tls_tprel_lo_<TLSmode:tls_abi_suffix>"
11533 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11534 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11535 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11536 UNSPEC_TLSTPRELLO))]
11538 "addi %0,%1,%2@tprel@l")
11540 ;; "b" output constraint here and on tls_tls input to support linker tls
11541 ;; optimization. The linker may edit the instructions emitted by a
11542 ;; tls_got_tprel/tls_tls pair to addis,addi.
11543 (define_insn_and_split "tls_got_tprel_<TLSmode:tls_abi_suffix>"
11544 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11545 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11546 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11547 UNSPEC_TLSGOTTPREL))]
11549 "l<TLSmode:tls_insn_suffix> %0,%2@got@tprel(%1)"
11550 "&& TARGET_CMODEL != CMODEL_SMALL"
11551 [(set (match_dup 3)
11553 (unspec:TLSmode [(match_dup 1) (match_dup 2)] UNSPEC_TLSGOTTPREL)))
11555 (lo_sum:TLSmode (match_dup 3)
11556 (unspec:TLSmode [(match_dup 1) (match_dup 2)] UNSPEC_TLSGOTTPREL)))]
11559 operands[3] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
11561 [(set (attr "length")
11562 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
11566 (define_insn "*tls_got_tprel_high<TLSmode:tls_abi_suffix>"
11567 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11569 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11570 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11571 UNSPEC_TLSGOTTPREL)))]
11572 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
11573 "addis %0,%1,%2@got@tprel@ha"
11574 [(set_attr "length" "4")])
11576 (define_insn "*tls_got_tprel_low<TLSmode:tls_abi_suffix>"
11577 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11578 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11579 (unspec:TLSmode [(match_operand:TLSmode 3 "gpc_reg_operand" "b")
11580 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11581 UNSPEC_TLSGOTTPREL)))]
11582 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
11583 "l<TLSmode:tls_insn_suffix> %0,%2@got@tprel@l(%1)"
11584 [(set_attr "length" "4")])
11586 (define_insn "tls_tls_<TLSmode:tls_abi_suffix>"
11587 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11588 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11589 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11591 "TARGET_ELF && HAVE_AS_TLS"
11592 "add %0,%1,%2@tls")
11594 (define_expand "tls_get_tpointer"
11595 [(set (match_operand:SI 0 "gpc_reg_operand" "")
11596 (unspec:SI [(const_int 0)] UNSPEC_TLSTLS))]
11597 "TARGET_XCOFF && HAVE_AS_TLS"
11600 emit_insn (gen_tls_get_tpointer_internal ());
11601 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
11605 (define_insn "tls_get_tpointer_internal"
11607 (unspec:SI [(const_int 0)] UNSPEC_TLSTLS))
11608 (clobber (reg:SI LR_REGNO))]
11609 "TARGET_XCOFF && HAVE_AS_TLS"
11610 "bla __get_tpointer")
11612 (define_expand "tls_get_addr<mode>"
11613 [(set (match_operand:P 0 "gpc_reg_operand" "")
11614 (unspec:P [(match_operand:P 1 "gpc_reg_operand" "")
11615 (match_operand:P 2 "gpc_reg_operand" "")] UNSPEC_TLSTLS))]
11616 "TARGET_XCOFF && HAVE_AS_TLS"
11619 emit_move_insn (gen_rtx_REG (Pmode, 3), operands[1]);
11620 emit_move_insn (gen_rtx_REG (Pmode, 4), operands[2]);
11621 emit_insn (gen_tls_get_addr_internal<mode> ());
11622 emit_move_insn (operands[0], gen_rtx_REG (Pmode, 3));
11626 (define_insn "tls_get_addr_internal<mode>"
11628 (unspec:P [(reg:P 3) (reg:P 4)] UNSPEC_TLSTLS))
11629 (clobber (reg:P 0))
11630 (clobber (reg:P 4))
11631 (clobber (reg:P 5))
11632 (clobber (reg:P 11))
11633 (clobber (reg:CC CR0_REGNO))
11634 (clobber (reg:P LR_REGNO))]
11635 "TARGET_XCOFF && HAVE_AS_TLS"
11636 "bla __tls_get_addr")
11638 ;; Next come insns related to the calling sequence.
11640 ;; First, an insn to allocate new stack space for dynamic use (e.g., alloca).
11641 ;; We move the back-chain and decrement the stack pointer.
11643 (define_expand "allocate_stack"
11644 [(set (match_operand 0 "gpc_reg_operand" "")
11645 (minus (reg 1) (match_operand 1 "reg_or_short_operand" "")))
11647 (minus (reg 1) (match_dup 1)))]
11650 { rtx chain = gen_reg_rtx (Pmode);
11651 rtx stack_bot = gen_rtx_MEM (Pmode, stack_pointer_rtx);
11653 rtx insn, par, set, mem;
11655 emit_move_insn (chain, stack_bot);
11657 /* Check stack bounds if necessary. */
11658 if (crtl->limit_stack)
11661 available = expand_binop (Pmode, sub_optab,
11662 stack_pointer_rtx, stack_limit_rtx,
11663 NULL_RTX, 1, OPTAB_WIDEN);
11664 emit_insn (gen_cond_trap (LTU, available, operands[1], const0_rtx));
11667 if (GET_CODE (operands[1]) != CONST_INT
11668 || INTVAL (operands[1]) < -32767
11669 || INTVAL (operands[1]) > 32768)
11671 neg_op0 = gen_reg_rtx (Pmode);
11673 emit_insn (gen_negsi2 (neg_op0, operands[1]));
11675 emit_insn (gen_negdi2 (neg_op0, operands[1]));
11678 neg_op0 = GEN_INT (- INTVAL (operands[1]));
11680 insn = emit_insn ((* ((TARGET_32BIT) ? gen_movsi_update_stack
11681 : gen_movdi_di_update_stack))
11682 (stack_pointer_rtx, stack_pointer_rtx, neg_op0,
11684 /* Since we didn't use gen_frame_mem to generate the MEM, grab
11685 it now and set the alias set/attributes. The above gen_*_update
11686 calls will generate a PARALLEL with the MEM set being the first
11688 par = PATTERN (insn);
11689 gcc_assert (GET_CODE (par) == PARALLEL);
11690 set = XVECEXP (par, 0, 0);
11691 gcc_assert (GET_CODE (set) == SET);
11692 mem = SET_DEST (set);
11693 gcc_assert (MEM_P (mem));
11694 MEM_NOTRAP_P (mem) = 1;
11695 set_mem_alias_set (mem, get_frame_alias_set ());
11697 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
11701 ;; These patterns say how to save and restore the stack pointer. We need not
11702 ;; save the stack pointer at function level since we are careful to
11703 ;; preserve the backchain. At block level, we have to restore the backchain
11704 ;; when we restore the stack pointer.
11706 ;; For nonlocal gotos, we must save both the stack pointer and its
11707 ;; backchain and restore both. Note that in the nonlocal case, the
11708 ;; save area is a memory location.
11710 (define_expand "save_stack_function"
11711 [(match_operand 0 "any_operand" "")
11712 (match_operand 1 "any_operand" "")]
11716 (define_expand "restore_stack_function"
11717 [(match_operand 0 "any_operand" "")
11718 (match_operand 1 "any_operand" "")]
11722 ;; Adjust stack pointer (op0) to a new value (op1).
11723 ;; First copy old stack backchain to new location, and ensure that the
11724 ;; scheduler won't reorder the sp assignment before the backchain write.
11725 (define_expand "restore_stack_block"
11726 [(set (match_dup 2) (match_dup 3))
11727 (set (match_dup 4) (match_dup 2))
11729 (set (match_operand 0 "register_operand" "")
11730 (match_operand 1 "register_operand" ""))]
11736 operands[1] = force_reg (Pmode, operands[1]);
11737 operands[2] = gen_reg_rtx (Pmode);
11738 operands[3] = gen_frame_mem (Pmode, operands[0]);
11739 operands[4] = gen_frame_mem (Pmode, operands[1]);
11740 p = rtvec_alloc (1);
11741 RTVEC_ELT (p, 0) = gen_rtx_SET (VOIDmode,
11742 gen_frame_mem (BLKmode, operands[0]),
11744 operands[5] = gen_rtx_PARALLEL (VOIDmode, p);
11747 (define_expand "save_stack_nonlocal"
11748 [(set (match_dup 3) (match_dup 4))
11749 (set (match_operand 0 "memory_operand" "") (match_dup 3))
11750 (set (match_dup 2) (match_operand 1 "register_operand" ""))]
11754 int units_per_word = (TARGET_32BIT) ? 4 : 8;
11756 /* Copy the backchain to the first word, sp to the second. */
11757 operands[0] = adjust_address_nv (operands[0], Pmode, 0);
11758 operands[2] = adjust_address_nv (operands[0], Pmode, units_per_word);
11759 operands[3] = gen_reg_rtx (Pmode);
11760 operands[4] = gen_frame_mem (Pmode, operands[1]);
11763 (define_expand "restore_stack_nonlocal"
11764 [(set (match_dup 2) (match_operand 1 "memory_operand" ""))
11765 (set (match_dup 3) (match_dup 4))
11766 (set (match_dup 5) (match_dup 2))
11768 (set (match_operand 0 "register_operand" "") (match_dup 3))]
11772 int units_per_word = (TARGET_32BIT) ? 4 : 8;
11775 /* Restore the backchain from the first word, sp from the second. */
11776 operands[2] = gen_reg_rtx (Pmode);
11777 operands[3] = gen_reg_rtx (Pmode);
11778 operands[1] = adjust_address_nv (operands[1], Pmode, 0);
11779 operands[4] = adjust_address_nv (operands[1], Pmode, units_per_word);
11780 operands[5] = gen_frame_mem (Pmode, operands[3]);
11781 p = rtvec_alloc (1);
11782 RTVEC_ELT (p, 0) = gen_rtx_SET (VOIDmode,
11783 gen_frame_mem (BLKmode, operands[0]),
11785 operands[6] = gen_rtx_PARALLEL (VOIDmode, p);
11788 ;; TOC register handling.
11790 ;; Code to initialize the TOC register...
11792 (define_insn "load_toc_aix_si"
11793 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11794 (unspec:SI [(const_int 0)] UNSPEC_TOC))
11795 (use (reg:SI 2))])]
11796 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2) && TARGET_32BIT"
11800 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
11801 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
11802 operands[2] = gen_rtx_REG (Pmode, 2);
11803 return \"lwz %0,%1(%2)\";
11805 [(set_attr "type" "load")
11806 (set_attr "update" "no")
11807 (set_attr "indexed" "no")])
11809 (define_insn "load_toc_aix_di"
11810 [(parallel [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11811 (unspec:DI [(const_int 0)] UNSPEC_TOC))
11812 (use (reg:DI 2))])]
11813 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2) && TARGET_64BIT"
11817 #ifdef TARGET_RELOCATABLE
11818 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\",
11819 !TARGET_MINIMAL_TOC || TARGET_RELOCATABLE);
11821 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
11824 strcat (buf, \"@toc\");
11825 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
11826 operands[2] = gen_rtx_REG (Pmode, 2);
11827 return \"ld %0,%1(%2)\";
11829 [(set_attr "type" "load")
11830 (set_attr "update" "no")
11831 (set_attr "indexed" "no")])
11833 (define_insn "load_toc_v4_pic_si"
11834 [(set (reg:SI LR_REGNO)
11835 (unspec:SI [(const_int 0)] UNSPEC_TOC))]
11836 "DEFAULT_ABI == ABI_V4 && flag_pic == 1 && TARGET_32BIT"
11837 "bl _GLOBAL_OFFSET_TABLE_@local-4"
11838 [(set_attr "type" "branch")
11839 (set_attr "length" "4")])
11841 (define_expand "load_toc_v4_PIC_1"
11842 [(parallel [(set (reg:SI LR_REGNO)
11843 (match_operand:SI 0 "immediate_operand" "s"))
11844 (use (unspec [(match_dup 0)] UNSPEC_TOC))])]
11845 "TARGET_ELF && DEFAULT_ABI == ABI_V4
11846 && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
11849 (define_insn "load_toc_v4_PIC_1_normal"
11850 [(set (reg:SI LR_REGNO)
11851 (match_operand:SI 0 "immediate_operand" "s"))
11852 (use (unspec [(match_dup 0)] UNSPEC_TOC))]
11853 "!TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI == ABI_V4
11854 && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
11855 "bcl 20,31,%0\\n%0:"
11856 [(set_attr "type" "branch")
11857 (set_attr "length" "4")])
11859 (define_insn "load_toc_v4_PIC_1_476"
11860 [(set (reg:SI LR_REGNO)
11861 (match_operand:SI 0 "immediate_operand" "s"))
11862 (use (unspec [(match_dup 0)] UNSPEC_TOC))]
11863 "TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI == ABI_V4
11864 && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
11868 static char templ[32];
11870 get_ppc476_thunk_name (name);
11871 sprintf (templ, \"bl %s\\n%%0:\", name);
11874 [(set_attr "type" "branch")
11875 (set_attr "length" "4")])
11877 (define_expand "load_toc_v4_PIC_1b"
11878 [(parallel [(set (reg:SI LR_REGNO)
11879 (unspec:SI [(match_operand:SI 0 "immediate_operand" "s")
11880 (label_ref (match_operand 1 "" ""))]
11883 "TARGET_ELF && DEFAULT_ABI == ABI_V4 && flag_pic == 2"
11886 (define_insn "load_toc_v4_PIC_1b_normal"
11887 [(set (reg:SI LR_REGNO)
11888 (unspec:SI [(match_operand:SI 0 "immediate_operand" "s")
11889 (label_ref (match_operand 1 "" ""))]
11892 "!TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI == ABI_V4 && flag_pic == 2"
11893 "bcl 20,31,$+8\;.long %0-$"
11894 [(set_attr "type" "branch")
11895 (set_attr "length" "8")])
11897 (define_insn "load_toc_v4_PIC_1b_476"
11898 [(set (reg:SI LR_REGNO)
11899 (unspec:SI [(match_operand:SI 0 "immediate_operand" "s")
11900 (label_ref (match_operand 1 "" ""))]
11903 "TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI == ABI_V4 && flag_pic == 2"
11907 static char templ[32];
11909 get_ppc476_thunk_name (name);
11910 sprintf (templ, \"bl %s\\n\\tb $+8\\n\\t.long %%0-$\", name);
11913 [(set_attr "type" "branch")
11914 (set_attr "length" "16")])
11916 (define_insn "load_toc_v4_PIC_2"
11917 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11918 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
11919 (minus:SI (match_operand:SI 2 "immediate_operand" "s")
11920 (match_operand:SI 3 "immediate_operand" "s")))))]
11921 "TARGET_ELF && DEFAULT_ABI == ABI_V4 && flag_pic == 2"
11923 [(set_attr "type" "load")])
11925 (define_insn "load_toc_v4_PIC_3b"
11926 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11927 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
11929 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
11930 (match_operand:SI 3 "symbol_ref_operand" "s")))))]
11931 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI == ABI_V4 && flag_pic"
11932 "addis %0,%1,%2-%3@ha")
11934 (define_insn "load_toc_v4_PIC_3c"
11935 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11936 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
11937 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
11938 (match_operand:SI 3 "symbol_ref_operand" "s"))))]
11939 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI == ABI_V4 && flag_pic"
11940 "addi %0,%1,%2-%3@l")
11942 ;; If the TOC is shared over a translation unit, as happens with all
11943 ;; the kinds of PIC that we support, we need to restore the TOC
11944 ;; pointer only when jumping over units of translation.
11945 ;; On Darwin, we need to reload the picbase.
11947 (define_expand "builtin_setjmp_receiver"
11948 [(use (label_ref (match_operand 0 "" "")))]
11949 "(DEFAULT_ABI == ABI_V4 && flag_pic == 1)
11950 || (TARGET_TOC && TARGET_MINIMAL_TOC)
11951 || (DEFAULT_ABI == ABI_DARWIN && flag_pic)"
11955 if (DEFAULT_ABI == ABI_DARWIN)
11957 rtx picrtx = gen_rtx_SYMBOL_REF (Pmode, MACHOPIC_FUNCTION_BASE_NAME);
11958 rtx picreg = gen_rtx_REG (Pmode, RS6000_PIC_OFFSET_TABLE_REGNUM);
11962 crtl->uses_pic_offset_table = 1;
11963 ASM_GENERATE_INTERNAL_LABEL(tmplab, \"LSJR\",
11964 CODE_LABEL_NUMBER (operands[0]));
11965 tmplabrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (tmplab));
11967 emit_insn (gen_load_macho_picbase (tmplabrtx));
11968 emit_move_insn (picreg, gen_rtx_REG (Pmode, LR_REGNO));
11969 emit_insn (gen_macho_correct_pic (picreg, picreg, picrtx, tmplabrtx));
11973 rs6000_emit_load_toc_table (FALSE);
11977 ;; Largetoc support
11978 (define_insn "*largetoc_high"
11979 [(set (match_operand:DI 0 "gpc_reg_operand" "=b*r")
11981 (unspec [(match_operand:DI 1 "" "")
11982 (match_operand:DI 2 "gpc_reg_operand" "b")]
11984 "TARGET_ELF && TARGET_CMODEL != CMODEL_SMALL"
11985 "addis %0,%2,%1@toc@ha")
11987 (define_insn "*largetoc_high_aix<mode>"
11988 [(set (match_operand:P 0 "gpc_reg_operand" "=b*r")
11990 (unspec [(match_operand:P 1 "" "")
11991 (match_operand:P 2 "gpc_reg_operand" "b")]
11993 "TARGET_XCOFF && TARGET_CMODEL != CMODEL_SMALL"
11994 "addis %0,%1@u(%2)")
11996 (define_insn "*largetoc_high_plus"
11997 [(set (match_operand:DI 0 "gpc_reg_operand" "=b*r")
12000 (unspec [(match_operand:DI 1 "" "")
12001 (match_operand:DI 2 "gpc_reg_operand" "b")]
12003 (match_operand:DI 3 "add_cint_operand" "n"))))]
12004 "TARGET_ELF && TARGET_CMODEL != CMODEL_SMALL"
12005 "addis %0,%2,%1+%3@toc@ha")
12007 (define_insn "*largetoc_high_plus_aix<mode>"
12008 [(set (match_operand:P 0 "gpc_reg_operand" "=b*r")
12011 (unspec [(match_operand:P 1 "" "")
12012 (match_operand:P 2 "gpc_reg_operand" "b")]
12014 (match_operand:P 3 "add_cint_operand" "n"))))]
12015 "TARGET_XCOFF && TARGET_CMODEL != CMODEL_SMALL"
12016 "addis %0,%1+%3@u(%2)")
12018 (define_insn "*largetoc_low"
12019 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
12020 (lo_sum:DI (match_operand:DI 1 "gpc_reg_operand" "b,!*r")
12021 (match_operand:DI 2 "" "")))]
12022 "TARGET_ELF && TARGET_CMODEL != CMODEL_SMALL"
12027 (define_insn "*largetoc_low_aix<mode>"
12028 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
12029 (lo_sum:P (match_operand:P 1 "gpc_reg_operand" "b")
12030 (match_operand:P 2 "" "")))]
12031 "TARGET_XCOFF && TARGET_CMODEL != CMODEL_SMALL"
12034 (define_insn_and_split "*tocref<mode>"
12035 [(set (match_operand:P 0 "gpc_reg_operand" "=b*r")
12036 (match_operand:P 1 "small_toc_ref" "R"))]
12039 "&& TARGET_CMODEL != CMODEL_SMALL && reload_completed"
12040 [(set (match_dup 0) (high:P (match_dup 1)))
12041 (set (match_dup 0) (lo_sum:P (match_dup 0) (match_dup 1)))])
12043 ;; Elf specific ways of loading addresses for non-PIC code.
12044 ;; The output of this could be r0, but we make a very strong
12045 ;; preference for a base register because it will usually
12046 ;; be needed there.
12047 (define_insn "elf_high"
12048 [(set (match_operand:SI 0 "gpc_reg_operand" "=b*r")
12049 (high:SI (match_operand 1 "" "")))]
12050 "TARGET_ELF && ! TARGET_64BIT"
12053 (define_insn "elf_low"
12054 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12055 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,!*r")
12056 (match_operand 2 "" "")))]
12057 "TARGET_ELF && ! TARGET_64BIT"
12062 ;; Call and call_value insns
12063 (define_expand "call"
12064 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
12065 (match_operand 1 "" ""))
12066 (use (match_operand 2 "" ""))
12067 (clobber (reg:SI LR_REGNO))])]
12072 if (MACHOPIC_INDIRECT)
12073 operands[0] = machopic_indirect_call_target (operands[0]);
12076 gcc_assert (GET_CODE (operands[0]) == MEM);
12077 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
12079 operands[0] = XEXP (operands[0], 0);
12081 if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
12083 rs6000_call_aix (NULL_RTX, operands[0], operands[1], operands[2]);
12087 if (GET_CODE (operands[0]) != SYMBOL_REF
12088 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[2]) & CALL_LONG) != 0))
12090 if (INTVAL (operands[2]) & CALL_LONG)
12091 operands[0] = rs6000_longcall_ref (operands[0]);
12093 switch (DEFAULT_ABI)
12097 operands[0] = force_reg (Pmode, operands[0]);
12101 gcc_unreachable ();
12106 (define_expand "call_value"
12107 [(parallel [(set (match_operand 0 "" "")
12108 (call (mem:SI (match_operand 1 "address_operand" ""))
12109 (match_operand 2 "" "")))
12110 (use (match_operand 3 "" ""))
12111 (clobber (reg:SI LR_REGNO))])]
12116 if (MACHOPIC_INDIRECT)
12117 operands[1] = machopic_indirect_call_target (operands[1]);
12120 gcc_assert (GET_CODE (operands[1]) == MEM);
12121 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
12123 operands[1] = XEXP (operands[1], 0);
12125 if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
12127 rs6000_call_aix (operands[0], operands[1], operands[2], operands[3]);
12131 if (GET_CODE (operands[1]) != SYMBOL_REF
12132 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[3]) & CALL_LONG) != 0))
12134 if (INTVAL (operands[3]) & CALL_LONG)
12135 operands[1] = rs6000_longcall_ref (operands[1]);
12137 switch (DEFAULT_ABI)
12141 operands[1] = force_reg (Pmode, operands[1]);
12145 gcc_unreachable ();
12150 ;; Call to function in current module. No TOC pointer reload needed.
12151 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
12152 ;; either the function was not prototyped, or it was prototyped as a
12153 ;; variable argument function. It is > 0 if FP registers were passed
12154 ;; and < 0 if they were not.
12156 (define_insn "*call_local32"
12157 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
12158 (match_operand 1 "" "g,g"))
12159 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12160 (clobber (reg:SI LR_REGNO))]
12161 "(INTVAL (operands[2]) & CALL_LONG) == 0"
12164 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12165 output_asm_insn (\"crxor 6,6,6\", operands);
12167 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12168 output_asm_insn (\"creqv 6,6,6\", operands);
12170 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
12172 [(set_attr "type" "branch")
12173 (set_attr "length" "4,8")])
12175 (define_insn "*call_local64"
12176 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
12177 (match_operand 1 "" "g,g"))
12178 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12179 (clobber (reg:SI LR_REGNO))]
12180 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
12183 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12184 output_asm_insn (\"crxor 6,6,6\", operands);
12186 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12187 output_asm_insn (\"creqv 6,6,6\", operands);
12189 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
12191 [(set_attr "type" "branch")
12192 (set_attr "length" "4,8")])
12194 (define_insn "*call_value_local32"
12195 [(set (match_operand 0 "" "")
12196 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
12197 (match_operand 2 "" "g,g")))
12198 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12199 (clobber (reg:SI LR_REGNO))]
12200 "(INTVAL (operands[3]) & CALL_LONG) == 0"
12203 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12204 output_asm_insn (\"crxor 6,6,6\", operands);
12206 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12207 output_asm_insn (\"creqv 6,6,6\", operands);
12209 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
12211 [(set_attr "type" "branch")
12212 (set_attr "length" "4,8")])
12215 (define_insn "*call_value_local64"
12216 [(set (match_operand 0 "" "")
12217 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
12218 (match_operand 2 "" "g,g")))
12219 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12220 (clobber (reg:SI LR_REGNO))]
12221 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
12224 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12225 output_asm_insn (\"crxor 6,6,6\", operands);
12227 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12228 output_asm_insn (\"creqv 6,6,6\", operands);
12230 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
12232 [(set_attr "type" "branch")
12233 (set_attr "length" "4,8")])
12236 ;; A function pointer under System V is just a normal pointer
12237 ;; operands[0] is the function pointer
12238 ;; operands[1] is the stack size to clean up
12239 ;; operands[2] is the value FUNCTION_ARG returns for the VOID argument
12240 ;; which indicates how to set cr1
12242 (define_insn "*call_indirect_nonlocal_sysv<mode>"
12243 [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l,c,*l"))
12244 (match_operand 1 "" "g,g,g,g"))
12245 (use (match_operand:SI 2 "immediate_operand" "O,O,n,n"))
12246 (clobber (reg:SI LR_REGNO))]
12247 "DEFAULT_ABI == ABI_V4
12248 || DEFAULT_ABI == ABI_DARWIN"
12250 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12251 output_asm_insn ("crxor 6,6,6", operands);
12253 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12254 output_asm_insn ("creqv 6,6,6", operands);
12258 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
12259 (set_attr "length" "4,4,8,8")])
12261 (define_insn_and_split "*call_nonlocal_sysv<mode>"
12262 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
12263 (match_operand 1 "" "g,g"))
12264 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12265 (clobber (reg:SI LR_REGNO))]
12266 "(DEFAULT_ABI == ABI_DARWIN
12267 || (DEFAULT_ABI == ABI_V4
12268 && (INTVAL (operands[2]) & CALL_LONG) == 0))"
12270 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12271 output_asm_insn ("crxor 6,6,6", operands);
12273 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12274 output_asm_insn ("creqv 6,6,6", operands);
12277 return output_call(insn, operands, 0, 2);
12279 if (DEFAULT_ABI == ABI_V4 && flag_pic)
12281 gcc_assert (!TARGET_SECURE_PLT);
12282 return "bl %z0@plt";
12288 "DEFAULT_ABI == ABI_V4
12289 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[0])
12290 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12291 [(parallel [(call (mem:SI (match_dup 0))
12293 (use (match_dup 2))
12294 (use (match_dup 3))
12295 (clobber (reg:SI LR_REGNO))])]
12297 operands[3] = pic_offset_table_rtx;
12299 [(set_attr "type" "branch,branch")
12300 (set_attr "length" "4,8")])
12302 (define_insn "*call_nonlocal_sysv_secure<mode>"
12303 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
12304 (match_operand 1 "" "g,g"))
12305 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12306 (use (match_operand:SI 3 "register_operand" "r,r"))
12307 (clobber (reg:SI LR_REGNO))]
12308 "(DEFAULT_ABI == ABI_V4
12309 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[0])
12310 && (INTVAL (operands[2]) & CALL_LONG) == 0)"
12312 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12313 output_asm_insn ("crxor 6,6,6", operands);
12315 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12316 output_asm_insn ("creqv 6,6,6", operands);
12319 /* The magic 32768 offset here and in the other sysv call insns
12320 corresponds to the offset of r30 in .got2, as given by LCTOC1.
12321 See sysv4.h:toc_section. */
12322 return "bl %z0+32768@plt";
12324 return "bl %z0@plt";
12326 [(set_attr "type" "branch,branch")
12327 (set_attr "length" "4,8")])
12329 (define_insn "*call_value_indirect_nonlocal_sysv<mode>"
12330 [(set (match_operand 0 "" "")
12331 (call (mem:SI (match_operand:P 1 "register_operand" "c,*l,c,*l"))
12332 (match_operand 2 "" "g,g,g,g")))
12333 (use (match_operand:SI 3 "immediate_operand" "O,O,n,n"))
12334 (clobber (reg:SI LR_REGNO))]
12335 "DEFAULT_ABI == ABI_V4
12336 || DEFAULT_ABI == ABI_DARWIN"
12338 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12339 output_asm_insn ("crxor 6,6,6", operands);
12341 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12342 output_asm_insn ("creqv 6,6,6", operands);
12346 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
12347 (set_attr "length" "4,4,8,8")])
12349 (define_insn_and_split "*call_value_nonlocal_sysv<mode>"
12350 [(set (match_operand 0 "" "")
12351 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
12352 (match_operand 2 "" "g,g")))
12353 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12354 (clobber (reg:SI LR_REGNO))]
12355 "(DEFAULT_ABI == ABI_DARWIN
12356 || (DEFAULT_ABI == ABI_V4
12357 && (INTVAL (operands[3]) & CALL_LONG) == 0))"
12359 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12360 output_asm_insn ("crxor 6,6,6", operands);
12362 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12363 output_asm_insn ("creqv 6,6,6", operands);
12366 return output_call(insn, operands, 1, 3);
12368 if (DEFAULT_ABI == ABI_V4 && flag_pic)
12370 gcc_assert (!TARGET_SECURE_PLT);
12371 return "bl %z1@plt";
12377 "DEFAULT_ABI == ABI_V4
12378 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[1])
12379 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12380 [(parallel [(set (match_dup 0)
12381 (call (mem:SI (match_dup 1))
12383 (use (match_dup 3))
12384 (use (match_dup 4))
12385 (clobber (reg:SI LR_REGNO))])]
12387 operands[4] = pic_offset_table_rtx;
12389 [(set_attr "type" "branch,branch")
12390 (set_attr "length" "4,8")])
12392 (define_insn "*call_value_nonlocal_sysv_secure<mode>"
12393 [(set (match_operand 0 "" "")
12394 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
12395 (match_operand 2 "" "g,g")))
12396 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12397 (use (match_operand:SI 4 "register_operand" "r,r"))
12398 (clobber (reg:SI LR_REGNO))]
12399 "(DEFAULT_ABI == ABI_V4
12400 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[1])
12401 && (INTVAL (operands[3]) & CALL_LONG) == 0)"
12403 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12404 output_asm_insn ("crxor 6,6,6", operands);
12406 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12407 output_asm_insn ("creqv 6,6,6", operands);
12410 return "bl %z1+32768@plt";
12412 return "bl %z1@plt";
12414 [(set_attr "type" "branch,branch")
12415 (set_attr "length" "4,8")])
12418 ;; Call to AIX abi function in the same module.
12420 (define_insn "*call_local_aix<mode>"
12421 [(call (mem:SI (match_operand:P 0 "current_file_function_operand" "s"))
12422 (match_operand 1 "" "g"))
12423 (clobber (reg:P LR_REGNO))]
12424 "DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2"
12426 [(set_attr "type" "branch")
12427 (set_attr "length" "4")])
12429 (define_insn "*call_value_local_aix<mode>"
12430 [(set (match_operand 0 "" "")
12431 (call (mem:SI (match_operand:P 1 "current_file_function_operand" "s"))
12432 (match_operand 2 "" "g")))
12433 (clobber (reg:P LR_REGNO))]
12434 "DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2"
12436 [(set_attr "type" "branch")
12437 (set_attr "length" "4")])
12439 ;; Call to AIX abi function which may be in another module.
12440 ;; Restore the TOC pointer (r2) after the call.
12442 (define_insn "*call_nonlocal_aix<mode>"
12443 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s"))
12444 (match_operand 1 "" "g"))
12445 (clobber (reg:P LR_REGNO))]
12446 "DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2"
12448 [(set_attr "type" "branch")
12449 (set_attr "length" "8")])
12451 (define_insn "*call_value_nonlocal_aix<mode>"
12452 [(set (match_operand 0 "" "")
12453 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s"))
12454 (match_operand 2 "" "g")))
12455 (clobber (reg:P LR_REGNO))]
12456 "DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2"
12458 [(set_attr "type" "branch")
12459 (set_attr "length" "8")])
12461 ;; Call to indirect functions with the AIX abi using a 3 word descriptor.
12462 ;; Operand0 is the addresss of the function to call
12463 ;; Operand2 is the location in the function descriptor to load r2 from
12464 ;; Operand3 is the stack location to hold the current TOC pointer
12466 (define_insn "*call_indirect_aix<mode>"
12467 [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l"))
12468 (match_operand 1 "" "g,g"))
12469 (use (match_operand:P 2 "memory_operand" "<ptrm>,<ptrm>"))
12470 (set (reg:P TOC_REGNUM) (match_operand:P 3 "memory_operand" "<ptrm>,<ptrm>"))
12471 (clobber (reg:P LR_REGNO))]
12472 "DEFAULT_ABI == ABI_AIX"
12473 "<ptrload> 2,%2\;b%T0l\;<ptrload> 2,%3"
12474 [(set_attr "type" "jmpreg")
12475 (set_attr "length" "12")])
12477 (define_insn "*call_value_indirect_aix<mode>"
12478 [(set (match_operand 0 "" "")
12479 (call (mem:SI (match_operand:P 1 "register_operand" "c,*l"))
12480 (match_operand 2 "" "g,g")))
12481 (use (match_operand:P 3 "memory_operand" "<ptrm>,<ptrm>"))
12482 (set (reg:P TOC_REGNUM) (match_operand:P 4 "memory_operand" "<ptrm>,<ptrm>"))
12483 (clobber (reg:P LR_REGNO))]
12484 "DEFAULT_ABI == ABI_AIX"
12485 "<ptrload> 2,%3\;b%T1l\;<ptrload> 2,%4"
12486 [(set_attr "type" "jmpreg")
12487 (set_attr "length" "12")])
12489 ;; Call to indirect functions with the ELFv2 ABI.
12490 ;; Operand0 is the addresss of the function to call
12491 ;; Operand2 is the stack location to hold the current TOC pointer
12493 (define_insn "*call_indirect_elfv2<mode>"
12494 [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l"))
12495 (match_operand 1 "" "g,g"))
12496 (set (reg:P TOC_REGNUM) (match_operand:P 2 "memory_operand" "<ptrm>,<ptrm>"))
12497 (clobber (reg:P LR_REGNO))]
12498 "DEFAULT_ABI == ABI_ELFv2"
12499 "b%T0l\;<ptrload> 2,%2"
12500 [(set_attr "type" "jmpreg")
12501 (set_attr "length" "8")])
12503 (define_insn "*call_value_indirect_elfv2<mode>"
12504 [(set (match_operand 0 "" "")
12505 (call (mem:SI (match_operand:P 1 "register_operand" "c,*l"))
12506 (match_operand 2 "" "g,g")))
12507 (set (reg:P TOC_REGNUM) (match_operand:P 3 "memory_operand" "<ptrm>,<ptrm>"))
12508 (clobber (reg:P LR_REGNO))]
12509 "DEFAULT_ABI == ABI_ELFv2"
12510 "b%T1l\;<ptrload> 2,%3"
12511 [(set_attr "type" "jmpreg")
12512 (set_attr "length" "8")])
12515 ;; Call subroutine returning any type.
12516 (define_expand "untyped_call"
12517 [(parallel [(call (match_operand 0 "" "")
12519 (match_operand 1 "" "")
12520 (match_operand 2 "" "")])]
12526 emit_call_insn (GEN_CALL (operands[0], const0_rtx, const0_rtx, const0_rtx));
12528 for (i = 0; i < XVECLEN (operands[2], 0); i++)
12530 rtx set = XVECEXP (operands[2], 0, i);
12531 emit_move_insn (SET_DEST (set), SET_SRC (set));
12534 /* The optimizer does not know that the call sets the function value
12535 registers we stored in the result block. We avoid problems by
12536 claiming that all hard registers are used and clobbered at this
12538 emit_insn (gen_blockage ());
12543 ;; sibling call patterns
12544 (define_expand "sibcall"
12545 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
12546 (match_operand 1 "" ""))
12547 (use (match_operand 2 "" ""))
12548 (use (reg:SI LR_REGNO))
12554 if (MACHOPIC_INDIRECT)
12555 operands[0] = machopic_indirect_call_target (operands[0]);
12558 gcc_assert (GET_CODE (operands[0]) == MEM);
12559 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
12561 operands[0] = XEXP (operands[0], 0);
12563 if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
12565 rs6000_sibcall_aix (NULL_RTX, operands[0], operands[1], operands[2]);
12570 (define_expand "sibcall_value"
12571 [(parallel [(set (match_operand 0 "register_operand" "")
12572 (call (mem:SI (match_operand 1 "address_operand" ""))
12573 (match_operand 2 "" "")))
12574 (use (match_operand 3 "" ""))
12575 (use (reg:SI LR_REGNO))
12581 if (MACHOPIC_INDIRECT)
12582 operands[1] = machopic_indirect_call_target (operands[1]);
12585 gcc_assert (GET_CODE (operands[1]) == MEM);
12586 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
12588 operands[1] = XEXP (operands[1], 0);
12590 if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
12592 rs6000_sibcall_aix (operands[0], operands[1], operands[2], operands[3]);
12597 ;; this and similar patterns must be marked as using LR, otherwise
12598 ;; dataflow will try to delete the store into it. This is true
12599 ;; even when the actual reg to jump to is in CTR, when LR was
12600 ;; saved and restored around the PIC-setting BCL.
12601 (define_insn "*sibcall_local32"
12602 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
12603 (match_operand 1 "" "g,g"))
12604 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12605 (use (reg:SI LR_REGNO))
12607 "(INTVAL (operands[2]) & CALL_LONG) == 0"
12610 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12611 output_asm_insn (\"crxor 6,6,6\", operands);
12613 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12614 output_asm_insn (\"creqv 6,6,6\", operands);
12616 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
12618 [(set_attr "type" "branch")
12619 (set_attr "length" "4,8")])
12621 (define_insn "*sibcall_local64"
12622 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
12623 (match_operand 1 "" "g,g"))
12624 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12625 (use (reg:SI LR_REGNO))
12627 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
12630 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12631 output_asm_insn (\"crxor 6,6,6\", operands);
12633 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12634 output_asm_insn (\"creqv 6,6,6\", operands);
12636 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
12638 [(set_attr "type" "branch")
12639 (set_attr "length" "4,8")])
12641 (define_insn "*sibcall_value_local32"
12642 [(set (match_operand 0 "" "")
12643 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
12644 (match_operand 2 "" "g,g")))
12645 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12646 (use (reg:SI LR_REGNO))
12648 "(INTVAL (operands[3]) & CALL_LONG) == 0"
12651 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12652 output_asm_insn (\"crxor 6,6,6\", operands);
12654 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12655 output_asm_insn (\"creqv 6,6,6\", operands);
12657 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
12659 [(set_attr "type" "branch")
12660 (set_attr "length" "4,8")])
12662 (define_insn "*sibcall_value_local64"
12663 [(set (match_operand 0 "" "")
12664 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
12665 (match_operand 2 "" "g,g")))
12666 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12667 (use (reg:SI LR_REGNO))
12669 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
12672 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12673 output_asm_insn (\"crxor 6,6,6\", operands);
12675 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12676 output_asm_insn (\"creqv 6,6,6\", operands);
12678 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
12680 [(set_attr "type" "branch")
12681 (set_attr "length" "4,8")])
12683 (define_insn "*sibcall_nonlocal_sysv<mode>"
12684 [(call (mem:SI (match_operand:P 0 "call_operand" "s,s,c,c"))
12685 (match_operand 1 "" ""))
12686 (use (match_operand 2 "immediate_operand" "O,n,O,n"))
12687 (use (reg:SI LR_REGNO))
12689 "(DEFAULT_ABI == ABI_DARWIN
12690 || DEFAULT_ABI == ABI_V4)
12691 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12694 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12695 output_asm_insn (\"crxor 6,6,6\", operands);
12697 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12698 output_asm_insn (\"creqv 6,6,6\", operands);
12700 if (which_alternative >= 2)
12702 else if (DEFAULT_ABI == ABI_V4 && flag_pic)
12704 gcc_assert (!TARGET_SECURE_PLT);
12705 return \"b %z0@plt\";
12710 [(set_attr "type" "branch")
12711 (set_attr "length" "4,8,4,8")])
12713 (define_insn "*sibcall_value_nonlocal_sysv<mode>"
12714 [(set (match_operand 0 "" "")
12715 (call (mem:SI (match_operand:P 1 "call_operand" "s,s,c,c"))
12716 (match_operand 2 "" "")))
12717 (use (match_operand:SI 3 "immediate_operand" "O,n,O,n"))
12718 (use (reg:SI LR_REGNO))
12720 "(DEFAULT_ABI == ABI_DARWIN
12721 || DEFAULT_ABI == ABI_V4)
12722 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12725 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12726 output_asm_insn (\"crxor 6,6,6\", operands);
12728 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12729 output_asm_insn (\"creqv 6,6,6\", operands);
12731 if (which_alternative >= 2)
12733 else if (DEFAULT_ABI == ABI_V4 && flag_pic)
12735 gcc_assert (!TARGET_SECURE_PLT);
12736 return \"b %z1@plt\";
12741 [(set_attr "type" "branch")
12742 (set_attr "length" "4,8,4,8")])
12744 ;; AIX ABI sibling call patterns.
12746 (define_insn "*sibcall_aix<mode>"
12747 [(call (mem:SI (match_operand:P 0 "call_operand" "s,c"))
12748 (match_operand 1 "" "g,g"))
12750 "DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2"
12754 [(set_attr "type" "branch")
12755 (set_attr "length" "4")])
12757 (define_insn "*sibcall_value_aix<mode>"
12758 [(set (match_operand 0 "" "")
12759 (call (mem:SI (match_operand:P 1 "call_operand" "s,c"))
12760 (match_operand 2 "" "g,g")))
12762 "DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2"
12766 [(set_attr "type" "branch")
12767 (set_attr "length" "4")])
12769 (define_expand "sibcall_epilogue"
12770 [(use (const_int 0))]
12773 if (!TARGET_SCHED_PROLOG)
12774 emit_insn (gen_blockage ());
12775 rs6000_emit_epilogue (TRUE);
12779 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
12780 ;; all of memory. This blocks insns from being moved across this point.
12782 (define_insn "blockage"
12783 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCK)]
12787 (define_expand "probe_stack"
12788 [(set (match_operand 0 "memory_operand" "=m")
12789 (unspec [(const_int 0)] UNSPEC_PROBE_STACK))]
12793 emit_insn (gen_probe_stack_di (operands[0]));
12795 emit_insn (gen_probe_stack_si (operands[0]));
12799 (define_insn "probe_stack_<mode>"
12800 [(set (match_operand:P 0 "memory_operand" "=m")
12801 (unspec:P [(const_int 0)] UNSPEC_PROBE_STACK))]
12804 operands[1] = gen_rtx_REG (Pmode, 0);
12805 return "st<wd>%U0%X0 %1,%0";
12807 [(set_attr "type" "store")
12808 (set (attr "update")
12809 (if_then_else (match_operand 0 "update_address_mem")
12810 (const_string "yes")
12811 (const_string "no")))
12812 (set (attr "indexed")
12813 (if_then_else (match_operand 0 "indexed_address_mem")
12814 (const_string "yes")
12815 (const_string "no")))
12816 (set_attr "length" "4")])
12818 (define_insn "probe_stack_range<P:mode>"
12819 [(set (match_operand:P 0 "register_operand" "=r")
12820 (unspec_volatile:P [(match_operand:P 1 "register_operand" "0")
12821 (match_operand:P 2 "register_operand" "r")]
12822 UNSPECV_PROBE_STACK_RANGE))]
12824 "* return output_probe_stack_range (operands[0], operands[2]);"
12825 [(set_attr "type" "three")])
12827 ;; Compare insns are next. Note that the RS/6000 has two types of compares,
12828 ;; signed & unsigned, and one type of branch.
12830 ;; Start with the DEFINE_EXPANDs to generate the rtl for compares, scc
12831 ;; insns, and branches.
12833 (define_expand "cbranch<mode>4"
12834 [(use (match_operator 0 "rs6000_cbranch_operator"
12835 [(match_operand:GPR 1 "gpc_reg_operand" "")
12836 (match_operand:GPR 2 "reg_or_short_operand" "")]))
12837 (use (match_operand 3 ""))]
12841 /* Take care of the possibility that operands[2] might be negative but
12842 this might be a logical operation. That insn doesn't exist. */
12843 if (GET_CODE (operands[2]) == CONST_INT
12844 && INTVAL (operands[2]) < 0)
12846 operands[2] = force_reg (<MODE>mode, operands[2]);
12847 operands[0] = gen_rtx_fmt_ee (GET_CODE (operands[0]),
12848 GET_MODE (operands[0]),
12849 operands[1], operands[2]);
12852 rs6000_emit_cbranch (<MODE>mode, operands);
12856 (define_expand "cbranch<mode>4"
12857 [(use (match_operator 0 "rs6000_cbranch_operator"
12858 [(match_operand:FP 1 "gpc_reg_operand" "")
12859 (match_operand:FP 2 "gpc_reg_operand" "")]))
12860 (use (match_operand 3 ""))]
12864 rs6000_emit_cbranch (<MODE>mode, operands);
12868 (define_expand "cstore<mode>4"
12869 [(use (match_operator 1 "rs6000_cbranch_operator"
12870 [(match_operand:GPR 2 "gpc_reg_operand" "")
12871 (match_operand:GPR 3 "reg_or_short_operand" "")]))
12872 (clobber (match_operand:SI 0 "register_operand"))]
12876 /* Take care of the possibility that operands[3] might be negative but
12877 this might be a logical operation. That insn doesn't exist. */
12878 if (GET_CODE (operands[3]) == CONST_INT
12879 && INTVAL (operands[3]) < 0)
12881 operands[3] = force_reg (<MODE>mode, operands[3]);
12882 operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]),
12883 GET_MODE (operands[1]),
12884 operands[2], operands[3]);
12887 /* For SNE, we would prefer that the xor/abs sequence be used for integers.
12888 For SEQ, likewise, except that comparisons with zero should be done
12889 with an scc insns. However, due to the order that combine see the
12890 resulting insns, we must, in fact, allow SEQ for integers. Fail in
12891 the cases we don't want to handle or are best handled by portable
12893 if (GET_CODE (operands[1]) == NE)
12895 if ((GET_CODE (operands[1]) == LT || GET_CODE (operands[1]) == LE
12896 || GET_CODE (operands[1]) == GT || GET_CODE (operands[1]) == GE)
12897 && operands[3] == const0_rtx)
12899 rs6000_emit_sCOND (<MODE>mode, operands);
12903 (define_expand "cstore<mode>4"
12904 [(use (match_operator 1 "rs6000_cbranch_operator"
12905 [(match_operand:FP 2 "gpc_reg_operand" "")
12906 (match_operand:FP 3 "gpc_reg_operand" "")]))
12907 (clobber (match_operand:SI 0 "register_operand"))]
12911 rs6000_emit_sCOND (<MODE>mode, operands);
12916 (define_expand "stack_protect_set"
12917 [(match_operand 0 "memory_operand" "")
12918 (match_operand 1 "memory_operand" "")]
12921 #ifdef TARGET_THREAD_SSP_OFFSET
12922 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
12923 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
12924 operands[1] = gen_rtx_MEM (Pmode, addr);
12927 emit_insn (gen_stack_protect_setdi (operands[0], operands[1]));
12929 emit_insn (gen_stack_protect_setsi (operands[0], operands[1]));
12933 (define_insn "stack_protect_setsi"
12934 [(set (match_operand:SI 0 "memory_operand" "=m")
12935 (unspec:SI [(match_operand:SI 1 "memory_operand" "m")] UNSPEC_SP_SET))
12936 (set (match_scratch:SI 2 "=&r") (const_int 0))]
12938 "lwz%U1%X1 %2,%1\;stw%U0%X0 %2,%0\;li %2,0"
12939 [(set_attr "type" "three")
12940 (set_attr "length" "12")])
12942 (define_insn "stack_protect_setdi"
12943 [(set (match_operand:DI 0 "memory_operand" "=Y")
12944 (unspec:DI [(match_operand:DI 1 "memory_operand" "Y")] UNSPEC_SP_SET))
12945 (set (match_scratch:DI 2 "=&r") (const_int 0))]
12947 "ld%U1%X1 %2,%1\;std%U0%X0 %2,%0\;li %2,0"
12948 [(set_attr "type" "three")
12949 (set_attr "length" "12")])
12951 (define_expand "stack_protect_test"
12952 [(match_operand 0 "memory_operand" "")
12953 (match_operand 1 "memory_operand" "")
12954 (match_operand 2 "" "")]
12957 rtx test, op0, op1;
12958 #ifdef TARGET_THREAD_SSP_OFFSET
12959 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
12960 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
12961 operands[1] = gen_rtx_MEM (Pmode, addr);
12964 op1 = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, operands[1]), UNSPEC_SP_TEST);
12965 test = gen_rtx_EQ (VOIDmode, op0, op1);
12966 emit_jump_insn (gen_cbranchsi4 (test, op0, op1, operands[2]));
12970 (define_insn "stack_protect_testsi"
12971 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
12972 (unspec:CCEQ [(match_operand:SI 1 "memory_operand" "m,m")
12973 (match_operand:SI 2 "memory_operand" "m,m")]
12975 (set (match_scratch:SI 4 "=r,r") (const_int 0))
12976 (clobber (match_scratch:SI 3 "=&r,&r"))]
12979 lwz%U1%X1 %3,%1\;lwz%U2%X2 %4,%2\;xor. %3,%3,%4\;li %4,0
12980 lwz%U1%X1 %3,%1\;lwz%U2%X2 %4,%2\;cmplw %0,%3,%4\;li %3,0\;li %4,0"
12981 [(set_attr "length" "16,20")])
12983 (define_insn "stack_protect_testdi"
12984 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
12985 (unspec:CCEQ [(match_operand:DI 1 "memory_operand" "Y,Y")
12986 (match_operand:DI 2 "memory_operand" "Y,Y")]
12988 (set (match_scratch:DI 4 "=r,r") (const_int 0))
12989 (clobber (match_scratch:DI 3 "=&r,&r"))]
12992 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;xor. %3,%3,%4\;li %4,0
12993 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;cmpld %0,%3,%4\;li %3,0\;li %4,0"
12994 [(set_attr "length" "16,20")])
12997 ;; Here are the actual compare insns.
12998 (define_insn "*cmp<mode>_internal1"
12999 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
13000 (compare:CC (match_operand:GPR 1 "gpc_reg_operand" "r")
13001 (match_operand:GPR 2 "reg_or_short_operand" "rI")))]
13003 "cmp<wd>%I2 %0,%1,%2"
13004 [(set_attr "type" "cmp")])
13006 ;; If we are comparing a register for equality with a large constant,
13007 ;; we can do this with an XOR followed by a compare. But this is profitable
13008 ;; only if the large constant is only used for the comparison (and in this
13009 ;; case we already have a register to reuse as scratch).
13011 ;; For 64-bit registers, we could only do so if the constant's bit 15 is clear:
13012 ;; otherwise we'd need to XOR with FFFFFFFF????0000 which is not available.
13015 [(set (match_operand:SI 0 "register_operand")
13016 (match_operand:SI 1 "logical_const_operand" ""))
13017 (set (match_dup 0) (match_operator:SI 3 "boolean_or_operator"
13019 (match_operand:SI 2 "logical_const_operand" "")]))
13020 (set (match_operand:CC 4 "cc_reg_operand" "")
13021 (compare:CC (match_operand:SI 5 "gpc_reg_operand" "")
13024 (if_then_else (match_operator 6 "equality_operator"
13025 [(match_dup 4) (const_int 0)])
13026 (match_operand 7 "" "")
13027 (match_operand 8 "" "")))]
13028 "peep2_reg_dead_p (3, operands[0])
13029 && peep2_reg_dead_p (4, operands[4])"
13030 [(set (match_dup 0) (xor:SI (match_dup 5) (match_dup 9)))
13031 (set (match_dup 4) (compare:CC (match_dup 0) (match_dup 10)))
13032 (set (pc) (if_then_else (match_dup 6) (match_dup 7) (match_dup 8)))]
13035 /* Get the constant we are comparing against, and see what it looks like
13036 when sign-extended from 16 to 32 bits. Then see what constant we could
13037 XOR with SEXTC to get the sign-extended value. */
13038 rtx cnst = simplify_const_binary_operation (GET_CODE (operands[3]),
13040 operands[1], operands[2]);
13041 HOST_WIDE_INT c = INTVAL (cnst);
13042 HOST_WIDE_INT sextc = ((c & 0xffff) ^ 0x8000) - 0x8000;
13043 HOST_WIDE_INT xorv = c ^ sextc;
13045 operands[9] = GEN_INT (xorv);
13046 operands[10] = GEN_INT (sextc);
13049 (define_insn "*cmpsi_internal2"
13050 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
13051 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
13052 (match_operand:SI 2 "reg_or_u_short_operand" "rK")))]
13054 "cmplw%I2 %0,%1,%b2"
13055 [(set_attr "type" "cmp")])
13057 (define_insn "*cmpdi_internal2"
13058 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
13059 (compare:CCUNS (match_operand:DI 1 "gpc_reg_operand" "r")
13060 (match_operand:DI 2 "reg_or_u_short_operand" "rK")))]
13062 "cmpld%I2 %0,%1,%b2"
13063 [(set_attr "type" "cmp")])
13065 ;; The following two insns don't exist as single insns, but if we provide
13066 ;; them, we can swap an add and compare, which will enable us to overlap more
13067 ;; of the required delay between a compare and branch. We generate code for
13068 ;; them by splitting.
13071 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
13072 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
13073 (match_operand:SI 2 "short_cint_operand" "i")))
13074 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
13075 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
13078 [(set_attr "length" "8")])
13081 [(set (match_operand:CCUNS 3 "cc_reg_operand" "=y")
13082 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
13083 (match_operand:SI 2 "u_short_cint_operand" "i")))
13084 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
13085 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
13088 [(set_attr "length" "8")])
13091 [(set (match_operand:CC 3 "cc_reg_operand" "")
13092 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
13093 (match_operand:SI 2 "short_cint_operand" "")))
13094 (set (match_operand:SI 0 "gpc_reg_operand" "")
13095 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
13097 [(set (match_dup 3) (compare:CC (match_dup 1) (match_dup 2)))
13098 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
13101 [(set (match_operand:CCUNS 3 "cc_reg_operand" "")
13102 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "")
13103 (match_operand:SI 2 "u_short_cint_operand" "")))
13104 (set (match_operand:SI 0 "gpc_reg_operand" "")
13105 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
13107 [(set (match_dup 3) (compare:CCUNS (match_dup 1) (match_dup 2)))
13108 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
13110 ;; Only need to compare second words if first words equal
13111 (define_insn "*cmptf_internal1"
13112 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
13113 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "d")
13114 (match_operand:TF 2 "gpc_reg_operand" "d")))]
13115 "!TARGET_IEEEQUAD && !TARGET_XL_COMPAT
13116 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LONG_DOUBLE_128"
13117 "fcmpu %0,%1,%2\;bne %0,$+8\;fcmpu %0,%L1,%L2"
13118 [(set_attr "type" "fpcompare")
13119 (set_attr "length" "12")])
13121 (define_insn_and_split "*cmptf_internal2"
13122 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
13123 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "d")
13124 (match_operand:TF 2 "gpc_reg_operand" "d")))
13125 (clobber (match_scratch:DF 3 "=d"))
13126 (clobber (match_scratch:DF 4 "=d"))
13127 (clobber (match_scratch:DF 5 "=d"))
13128 (clobber (match_scratch:DF 6 "=d"))
13129 (clobber (match_scratch:DF 7 "=d"))
13130 (clobber (match_scratch:DF 8 "=d"))
13131 (clobber (match_scratch:DF 9 "=d"))
13132 (clobber (match_scratch:DF 10 "=d"))
13133 (clobber (match_scratch:GPR 11 "=b"))]
13134 "!TARGET_IEEEQUAD && TARGET_XL_COMPAT
13135 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LONG_DOUBLE_128"
13137 "&& reload_completed"
13138 [(set (match_dup 3) (match_dup 14))
13139 (set (match_dup 4) (match_dup 15))
13140 (set (match_dup 9) (abs:DF (match_dup 5)))
13141 (set (match_dup 0) (compare:CCFP (match_dup 9) (match_dup 3)))
13142 (set (pc) (if_then_else (ne (match_dup 0) (const_int 0))
13143 (label_ref (match_dup 12))
13145 (set (match_dup 0) (compare:CCFP (match_dup 5) (match_dup 7)))
13146 (set (pc) (label_ref (match_dup 13)))
13148 (set (match_dup 10) (minus:DF (match_dup 5) (match_dup 7)))
13149 (set (match_dup 9) (minus:DF (match_dup 6) (match_dup 8)))
13150 (set (match_dup 9) (plus:DF (match_dup 10) (match_dup 9)))
13151 (set (match_dup 0) (compare:CCFP (match_dup 9) (match_dup 4)))
13154 REAL_VALUE_TYPE rv;
13155 const int lo_word = LONG_DOUBLE_LARGE_FIRST ? GET_MODE_SIZE (DFmode) : 0;
13156 const int hi_word = LONG_DOUBLE_LARGE_FIRST ? 0 : GET_MODE_SIZE (DFmode);
13158 operands[5] = simplify_gen_subreg (DFmode, operands[1], TFmode, hi_word);
13159 operands[6] = simplify_gen_subreg (DFmode, operands[1], TFmode, lo_word);
13160 operands[7] = simplify_gen_subreg (DFmode, operands[2], TFmode, hi_word);
13161 operands[8] = simplify_gen_subreg (DFmode, operands[2], TFmode, lo_word);
13162 operands[12] = gen_label_rtx ();
13163 operands[13] = gen_label_rtx ();
13165 operands[14] = force_const_mem (DFmode,
13166 CONST_DOUBLE_FROM_REAL_VALUE (rv, DFmode));
13167 operands[15] = force_const_mem (DFmode,
13168 CONST_DOUBLE_FROM_REAL_VALUE (dconst0,
13173 tocref = create_TOC_reference (XEXP (operands[14], 0), operands[11]);
13174 operands[14] = gen_const_mem (DFmode, tocref);
13175 tocref = create_TOC_reference (XEXP (operands[15], 0), operands[11]);
13176 operands[15] = gen_const_mem (DFmode, tocref);
13177 set_mem_alias_set (operands[14], get_TOC_alias_set ());
13178 set_mem_alias_set (operands[15], get_TOC_alias_set ());
13182 ;; Now we have the scc insns. We can do some combinations because of the
13183 ;; way the machine works.
13185 ;; Note that this is probably faster if we can put an insn between the
13186 ;; mfcr and rlinm, but this is tricky. Let's leave it for now. In most
13187 ;; cases the insns below which don't use an intermediate CR field will
13188 ;; be used instead.
13190 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13191 (match_operator:SI 1 "scc_comparison_operator"
13192 [(match_operand 2 "cc_reg_operand" "y")
13195 "mfcr %0%Q2\;rlwinm %0,%0,%J1,1"
13196 [(set (attr "type")
13197 (cond [(match_test "TARGET_MFCRF")
13198 (const_string "mfcrf")
13200 (const_string "mfcr")))
13201 (set_attr "length" "8")])
13203 ;; Same as above, but get the GT bit.
13204 (define_insn "move_from_CR_gt_bit"
13205 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13206 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_GT))]
13207 "TARGET_HARD_FLOAT && !TARGET_FPRS"
13208 "mfcr %0\;rlwinm %0,%0,%D1,31,31"
13209 [(set_attr "type" "mfcr")
13210 (set_attr "length" "8")])
13212 ;; Same as above, but get the OV/ORDERED bit.
13213 (define_insn "move_from_CR_ov_bit"
13214 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13215 (unspec:SI [(match_operand:CC 1 "cc_reg_operand" "y")]
13218 "mfcr %0\;rlwinm %0,%0,%t1,1"
13219 [(set_attr "type" "mfcr")
13220 (set_attr "length" "8")])
13223 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13224 (match_operator:DI 1 "scc_comparison_operator"
13225 [(match_operand 2 "cc_reg_operand" "y")
13228 "mfcr %0%Q2\;rlwinm %0,%0,%J1,1"
13229 [(set (attr "type")
13230 (cond [(match_test "TARGET_MFCRF")
13231 (const_string "mfcrf")
13233 (const_string "mfcr")))
13234 (set_attr "length" "8")])
13237 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13238 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
13239 [(match_operand 2 "cc_reg_operand" "y,y")
13242 (set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
13243 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
13246 mfcr %3%Q2\;rlwinm. %3,%3,%J1,1
13248 [(set_attr "type" "shift")
13249 (set_attr "dot" "yes")
13250 (set_attr "length" "8,16")])
13253 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13254 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
13255 [(match_operand 2 "cc_reg_operand" "")
13258 (set (match_operand:SI 3 "gpc_reg_operand" "")
13259 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
13260 "TARGET_32BIT && reload_completed"
13261 [(set (match_dup 3)
13262 (match_op_dup 1 [(match_dup 2) (const_int 0)]))
13264 (compare:CC (match_dup 3)
13269 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13270 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
13271 [(match_operand 2 "cc_reg_operand" "y")
13273 (match_operand:SI 3 "const_int_operand" "n")))]
13277 int is_bit = ccr_bit (operands[1], 1);
13278 int put_bit = 31 - (INTVAL (operands[3]) & 31);
13281 if (is_bit >= put_bit)
13282 count = is_bit - put_bit;
13284 count = 32 - (put_bit - is_bit);
13286 operands[4] = GEN_INT (count);
13287 operands[5] = GEN_INT (put_bit);
13289 return \"mfcr %0%Q2\;rlwinm %0,%0,%4,%5,%5\";
13291 [(set (attr "type")
13292 (cond [(match_test "TARGET_MFCRF")
13293 (const_string "mfcrf")
13295 (const_string "mfcr")))
13296 (set_attr "length" "8")])
13299 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13301 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
13302 [(match_operand 2 "cc_reg_operand" "y,y")
13304 (match_operand:SI 3 "const_int_operand" "n,n"))
13306 (set (match_operand:SI 4 "gpc_reg_operand" "=r,r")
13307 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
13312 int is_bit = ccr_bit (operands[1], 1);
13313 int put_bit = 31 - (INTVAL (operands[3]) & 31);
13316 /* Force split for non-cc0 compare. */
13317 if (which_alternative == 1)
13320 if (is_bit >= put_bit)
13321 count = is_bit - put_bit;
13323 count = 32 - (put_bit - is_bit);
13325 operands[5] = GEN_INT (count);
13326 operands[6] = GEN_INT (put_bit);
13328 return \"mfcr %4%Q2\;rlwinm. %4,%4,%5,%6,%6\";
13330 [(set_attr "type" "shift")
13331 (set_attr "dot" "yes")
13332 (set_attr "length" "8,16")])
13335 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
13337 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
13338 [(match_operand 2 "cc_reg_operand" "")
13340 (match_operand:SI 3 "const_int_operand" ""))
13342 (set (match_operand:SI 4 "gpc_reg_operand" "")
13343 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
13346 [(set (match_dup 4)
13347 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
13350 (compare:CC (match_dup 4)
13354 ;; There is a 3 cycle delay between consecutive mfcr instructions
13355 ;; so it is useful to combine 2 scc instructions to use only one mfcr.
13358 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13359 (match_operator:SI 1 "scc_comparison_operator"
13360 [(match_operand 2 "cc_reg_operand" "y")
13362 (set (match_operand:SI 3 "gpc_reg_operand" "=r")
13363 (match_operator:SI 4 "scc_comparison_operator"
13364 [(match_operand 5 "cc_reg_operand" "y")
13366 "REGNO (operands[2]) != REGNO (operands[5])"
13367 "mfcr %3\;rlwinm %0,%3,%J1,1\;rlwinm %3,%3,%J4,1"
13368 [(set_attr "type" "mfcr")
13369 (set_attr "length" "12")])
13372 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13373 (match_operator:DI 1 "scc_comparison_operator"
13374 [(match_operand 2 "cc_reg_operand" "y")
13376 (set (match_operand:DI 3 "gpc_reg_operand" "=r")
13377 (match_operator:DI 4 "scc_comparison_operator"
13378 [(match_operand 5 "cc_reg_operand" "y")
13380 "TARGET_POWERPC64 && REGNO (operands[2]) != REGNO (operands[5])"
13381 "mfcr %3\;rlwinm %0,%3,%J1,1\;rlwinm %3,%3,%J4,1"
13382 [(set_attr "type" "mfcr")
13383 (set_attr "length" "12")])
13385 ;; There are some scc insns that can be done directly, without a compare.
13386 ;; These are faster because they don't involve the communications between
13387 ;; the FXU and branch units. In fact, we will be replacing all of the
13388 ;; integer scc insns here or in the portable methods in emit_store_flag.
13390 ;; Also support (neg (scc ..)) since that construct is used to replace
13391 ;; branches, (plus (scc ..) ..) since that construct is common and
13392 ;; takes no more insns than scc, and (and (neg (scc ..)) ..) in the
13393 ;; cases where it is no more expensive than (neg (scc ..)).
13395 ;; Have reload force a constant into a register for the simple insns that
13396 ;; otherwise won't accept constants. We do this because it is faster than
13397 ;; the cmp/mfcr sequence we would otherwise generate.
13399 (define_mode_attr scc_eq_op2 [(SI "rKLI")
13402 (define_insn_and_split "*eq<mode>"
13403 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
13404 (eq:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
13405 (match_operand:GPR 2 "scc_eq_operand" "<scc_eq_op2>")))]
13409 [(set (match_dup 0)
13410 (clz:GPR (match_dup 3)))
13412 (lshiftrt:GPR (match_dup 0) (match_dup 4)))]
13414 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
13416 /* Use output operand as intermediate. */
13417 operands[3] = operands[0];
13419 if (logical_operand (operands[2], <MODE>mode))
13420 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13421 gen_rtx_XOR (<MODE>mode,
13422 operands[1], operands[2])));
13424 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13425 gen_rtx_PLUS (<MODE>mode, operands[1],
13426 negate_rtx (<MODE>mode,
13430 operands[3] = operands[1];
13432 operands[4] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
13435 (define_insn_and_split "*eq<mode>_compare"
13436 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
13438 (eq:P (match_operand:P 1 "gpc_reg_operand" "=r")
13439 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))
13441 (set (match_operand:P 0 "gpc_reg_operand" "=r")
13442 (eq:P (match_dup 1) (match_dup 2)))]
13446 [(set (match_dup 0)
13447 (clz:P (match_dup 4)))
13448 (parallel [(set (match_dup 3)
13449 (compare:CC (lshiftrt:P (match_dup 0) (match_dup 5))
13452 (lshiftrt:P (match_dup 0) (match_dup 5)))])]
13454 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
13456 /* Use output operand as intermediate. */
13457 operands[4] = operands[0];
13459 if (logical_operand (operands[2], <MODE>mode))
13460 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
13461 gen_rtx_XOR (<MODE>mode,
13462 operands[1], operands[2])));
13464 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
13465 gen_rtx_PLUS (<MODE>mode, operands[1],
13466 negate_rtx (<MODE>mode,
13470 operands[4] = operands[1];
13472 operands[5] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
13475 ;; We have insns of the form shown by the first define_insn below. If
13476 ;; there is something inside the comparison operation, we must split it.
13478 [(set (match_operand:SI 0 "gpc_reg_operand" "")
13479 (plus:SI (match_operator 1 "comparison_operator"
13480 [(match_operand:SI 2 "" "")
13481 (match_operand:SI 3
13482 "reg_or_cint_operand" "")])
13483 (match_operand:SI 4 "gpc_reg_operand" "")))
13484 (clobber (match_operand:SI 5 "register_operand" ""))]
13485 "! gpc_reg_operand (operands[2], SImode)"
13486 [(set (match_dup 5) (match_dup 2))
13487 (set (match_dup 0) (plus:SI (match_op_dup 1 [(match_dup 5) (match_dup 3)])
13490 (define_insn "*plus_eqsi"
13491 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r")
13492 (plus:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
13493 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I"))
13494 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r")))]
13497 xor %0,%1,%2\;subfic %0,%0,0\;addze %0,%3
13498 subfic %0,%1,0\;addze %0,%3
13499 xori %0,%1,%b2\;subfic %0,%0,0\;addze %0,%3
13500 xoris %0,%1,%u2\;subfic %0,%0,0\;addze %0,%3
13501 subfic %0,%1,%2\;subfic %0,%0,0\;addze %0,%3"
13502 [(set_attr "type" "three,two,three,three,three")
13503 (set_attr "length" "12,8,12,12,12")])
13505 (define_insn "*compare_plus_eqsi"
13506 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
13509 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
13510 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
13511 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
13513 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r"))]
13514 "TARGET_32BIT && optimize_size"
13516 xor %4,%1,%2\;subfic %4,%4,0\;addze. %4,%3
13517 subfic %4,%1,0\;addze. %4,%3
13518 xori %4,%1,%b2\;subfic %4,%4,0\;addze. %4,%3
13519 xoris %4,%1,%u2\;subfic %4,%4,0\;addze. %4,%3
13520 subfic %4,%1,%2\;subfic %4,%4,0\;addze. %4,%3
13526 [(set_attr "type" "compare")
13527 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
13530 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13533 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
13534 (match_operand:SI 2 "scc_eq_operand" ""))
13535 (match_operand:SI 3 "gpc_reg_operand" ""))
13537 (clobber (match_scratch:SI 4 ""))]
13538 "TARGET_32BIT && optimize_size && reload_completed"
13539 [(set (match_dup 4)
13540 (plus:SI (eq:SI (match_dup 1)
13544 (compare:CC (match_dup 4)
13548 (define_insn "*plus_eqsi_compare"
13549 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
13552 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
13553 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
13554 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
13556 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r")
13557 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13558 "TARGET_32BIT && optimize_size"
13560 xor %0,%1,%2\;subfic %0,%0,0\;addze. %0,%3
13561 subfic %0,%1,0\;addze. %0,%3
13562 xori %0,%1,%b2\;subfic %0,%0,0\;addze. %0,%3
13563 xoris %0,%1,%u2\;subfic %0,%0,0\;addze. %0,%3
13564 subfic %0,%1,%2\;subfic %0,%0,0\;addze. %0,%3
13570 [(set_attr "type" "compare")
13571 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
13574 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13577 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
13578 (match_operand:SI 2 "scc_eq_operand" ""))
13579 (match_operand:SI 3 "gpc_reg_operand" ""))
13581 (set (match_operand:SI 0 "gpc_reg_operand" "")
13582 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13583 "TARGET_32BIT && optimize_size && reload_completed"
13584 [(set (match_dup 0)
13585 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13587 (compare:CC (match_dup 0)
13591 (define_insn "*neg_eq0<mode>"
13592 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13593 (neg:P (eq:P (match_operand:P 1 "gpc_reg_operand" "r")
13596 "addic %0,%1,-1\;subfe %0,%0,%0"
13597 [(set_attr "type" "two")
13598 (set_attr "length" "8")])
13600 (define_insn_and_split "*neg_eq<mode>"
13601 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13602 (neg:P (eq:P (match_operand:P 1 "gpc_reg_operand" "%r")
13603 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))))]
13607 [(set (match_dup 0) (neg:P (eq:P (match_dup 3) (const_int 0))))]
13609 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
13611 /* Use output operand as intermediate. */
13612 operands[3] = operands[0];
13614 if (logical_operand (operands[2], <MODE>mode))
13615 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13616 gen_rtx_XOR (<MODE>mode,
13617 operands[1], operands[2])));
13619 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13620 gen_rtx_PLUS (<MODE>mode, operands[1],
13621 negate_rtx (<MODE>mode,
13625 operands[3] = operands[1];
13628 (define_insn "*ne0_<mode>"
13629 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13630 (ne:P (match_operand:P 1 "gpc_reg_operand" "r")
13632 (clobber (match_scratch:P 2 "=&r"))]
13633 "!(TARGET_32BIT && TARGET_ISEL)"
13634 "addic %2,%1,-1\;subfe %0,%2,%1"
13635 [(set_attr "type" "two")
13636 (set_attr "length" "8")])
13638 (define_insn "*plus_ne0_<mode>"
13639 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13640 (plus:P (ne:P (match_operand:P 1 "gpc_reg_operand" "r")
13642 (match_operand:P 2 "gpc_reg_operand" "r")))
13643 (clobber (match_scratch:P 3 "=&r"))]
13645 "addic %3,%1,-1\;addze %0,%2"
13646 [(set_attr "type" "two")
13647 (set_attr "length" "8")])
13649 (define_insn "*compare_plus_ne0_<mode>"
13650 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13651 (compare:CC (plus:P (ne:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13653 (match_operand:P 2 "gpc_reg_operand" "r,r"))
13655 (clobber (match_scratch:P 3 "=&r,&r"))
13656 (clobber (match_scratch:P 4 "=X,&r"))]
13659 addic %3,%1,-1\;addze. %3,%2
13661 [(set_attr "type" "compare")
13662 (set_attr "length" "8,12")])
13665 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
13666 (compare:CC (ne:P (match_operand:SI 1 "gpc_reg_operand" "")
13668 (neg:P (match_operand:P 2 "gpc_reg_operand" ""))))
13669 (clobber (match_scratch:P 3 ""))
13670 (clobber (match_scratch:P 4 ""))]
13672 [(parallel [(set (match_dup 3)
13673 (plus:P (ne:P (match_dup 1)
13676 (clobber (match_dup 4))])
13678 (compare:CC (match_dup 3)
13683 (define_insn "*compare_plus_ne0_<mode>_1"
13684 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
13685 (compare:CCEQ (ne:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13687 (neg:P (match_operand:P 2 "gpc_reg_operand" "r,r"))))
13688 (clobber (match_scratch:P 3 "=&r,&r"))
13689 (clobber (match_scratch:P 4 "=X,&r"))]
13692 addic %3,%1,-1\;addze. %3,%2
13694 [(set_attr "type" "compare")
13695 (set_attr "length" "8,12")])
13698 [(set (match_operand:CCEQ 0 "cc_reg_not_micro_cr0_operand" "")
13699 (compare:CCEQ (ne:P (match_operand:SI 1 "gpc_reg_operand" "")
13701 (neg:P (match_operand:P 2 "gpc_reg_operand" ""))))
13702 (clobber (match_scratch:P 3 ""))
13703 (clobber (match_scratch:P 4 ""))]
13705 [(parallel [(set (match_dup 3)
13706 (plus:P (ne:P (match_dup 1)
13709 (clobber (match_dup 4))])
13711 (compare:CC (match_dup 3)
13715 (define_insn "*plus_ne0_<mode>_compare"
13716 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13718 (plus:P (ne:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13720 (match_operand:P 2 "gpc_reg_operand" "r,r"))
13722 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13723 (plus:P (ne:P (match_dup 1)
13726 (clobber (match_scratch:P 3 "=&r,&r"))]
13729 addic %3,%1,-1\;addze. %0,%2
13731 [(set_attr "type" "compare")
13732 (set_attr "length" "8,12")])
13735 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
13737 (plus:P (ne:P (match_operand:P 1 "gpc_reg_operand" "")
13739 (match_operand:P 2 "gpc_reg_operand" ""))
13741 (set (match_operand:P 0 "gpc_reg_operand" "")
13742 (plus:P (ne:P (match_dup 1)
13745 (clobber (match_scratch:P 3 ""))]
13747 [(parallel [(set (match_dup 0)
13748 (plus:P (ne:P (match_dup 1)
13751 (clobber (match_dup 3))])
13753 (compare:CC (match_dup 0)
13757 (define_insn "*leu<mode>"
13758 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13759 (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
13760 (match_operand:P 2 "reg_or_short_operand" "rI")))]
13762 "subf%I2c %0,%1,%2\;li %0,0\;adde %0,%0,%0"
13763 [(set_attr "type" "three")
13764 (set_attr "length" "12")])
13766 (define_insn "*leu<mode>_compare"
13767 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13769 (leu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13770 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
13772 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13773 (leu:P (match_dup 1) (match_dup 2)))]
13776 subf%I2c %0,%1,%2\;li %0,0\;adde. %0,%0,%0
13778 [(set_attr "type" "compare")
13779 (set_attr "length" "12,16")])
13782 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13784 (leu:P (match_operand:P 1 "gpc_reg_operand" "")
13785 (match_operand:P 2 "reg_or_short_operand" ""))
13787 (set (match_operand:P 0 "gpc_reg_operand" "")
13788 (leu:P (match_dup 1) (match_dup 2)))]
13790 [(set (match_dup 0)
13791 (leu:P (match_dup 1) (match_dup 2)))
13793 (compare:CC (match_dup 0)
13797 (define_insn "*plus_leu<mode>"
13798 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
13799 (plus:P (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
13800 (match_operand:P 2 "reg_or_short_operand" "rI"))
13801 (match_operand:P 3 "gpc_reg_operand" "r")))]
13803 "subf%I2c %0,%1,%2\;addze %0,%3"
13804 [(set_attr "type" "two")
13805 (set_attr "length" "8")])
13808 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13810 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13811 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13812 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13814 (clobber (match_scratch:SI 4 "=&r,&r"))]
13817 subf%I2c %4,%1,%2\;addze. %4,%3
13819 [(set_attr "type" "compare")
13820 (set_attr "length" "8,12")])
13823 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13825 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13826 (match_operand:SI 2 "reg_or_short_operand" ""))
13827 (match_operand:SI 3 "gpc_reg_operand" ""))
13829 (clobber (match_scratch:SI 4 ""))]
13830 "TARGET_32BIT && reload_completed"
13831 [(set (match_dup 4)
13832 (plus:SI (leu:SI (match_dup 1) (match_dup 2))
13835 (compare:CC (match_dup 4)
13840 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13842 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13843 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13844 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13846 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13847 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13850 subf%I2c %0,%1,%2\;addze. %0,%3
13852 [(set_attr "type" "compare")
13853 (set_attr "length" "8,12")])
13856 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13858 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13859 (match_operand:SI 2 "reg_or_short_operand" ""))
13860 (match_operand:SI 3 "gpc_reg_operand" ""))
13862 (set (match_operand:SI 0 "gpc_reg_operand" "")
13863 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13864 "TARGET_32BIT && reload_completed"
13865 [(set (match_dup 0)
13866 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13868 (compare:CC (match_dup 0)
13872 (define_insn "*neg_leu<mode>"
13873 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13874 (neg:P (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
13875 (match_operand:P 2 "reg_or_short_operand" "rI"))))]
13877 "subf%I2c %0,%1,%2\;subfe %0,%0,%0\;nand %0,%0,%0"
13878 [(set_attr "type" "three")
13879 (set_attr "length" "12")])
13881 (define_insn "*and_neg_leu<mode>"
13882 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
13884 (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
13885 (match_operand:P 2 "reg_or_short_operand" "rI")))
13886 (match_operand:P 3 "gpc_reg_operand" "r")))]
13888 "subf%I2c %0,%1,%2\;subfe %0,%0,%0\;andc %0,%3,%0"
13889 [(set_attr "type" "three")
13890 (set_attr "length" "12")])
13893 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13896 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13897 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
13898 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13900 (clobber (match_scratch:SI 4 "=&r,&r"))]
13903 subf%I2c %4,%1,%2\;subfe %4,%4,%4\;andc. %4,%3,%4
13905 [(set_attr "type" "compare")
13906 (set_attr "length" "12,16")])
13909 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13912 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13913 (match_operand:SI 2 "reg_or_short_operand" "")))
13914 (match_operand:SI 3 "gpc_reg_operand" ""))
13916 (clobber (match_scratch:SI 4 ""))]
13917 "TARGET_32BIT && reload_completed"
13918 [(set (match_dup 4)
13919 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
13922 (compare:CC (match_dup 4)
13927 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13930 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13931 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
13932 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13934 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13935 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13938 subf%I2c %0,%1,%2\;subfe %0,%0,%0\;andc. %0,%3,%0
13940 [(set_attr "type" "compare")
13941 (set_attr "length" "12,16")])
13944 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13947 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13948 (match_operand:SI 2 "reg_or_short_operand" "")))
13949 (match_operand:SI 3 "gpc_reg_operand" ""))
13951 (set (match_operand:SI 0 "gpc_reg_operand" "")
13952 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13953 "TARGET_32BIT && reload_completed"
13954 [(set (match_dup 0)
13955 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
13958 (compare:CC (match_dup 0)
13962 (define_insn_and_split "*ltu<mode>"
13963 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13964 (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13965 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))]
13969 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
13970 (set (match_dup 0) (neg:P (match_dup 0)))]
13973 (define_insn_and_split "*ltu<mode>_compare"
13974 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
13976 (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
13977 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
13979 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
13980 (ltu:P (match_dup 1) (match_dup 2)))]
13984 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
13985 (parallel [(set (match_dup 3)
13986 (compare:CC (neg:P (match_dup 0)) (const_int 0)))
13987 (set (match_dup 0) (neg:P (match_dup 0)))])]
13990 (define_insn_and_split "*plus_ltu<mode>"
13991 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,r")
13992 (plus:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13993 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))
13994 (match_operand:P 3 "reg_or_short_operand" "rI,rI")))]
13997 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13998 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
13999 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))]
14002 (define_insn_and_split "*plus_ltu<mode>_compare"
14003 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
14005 (plus:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
14006 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
14007 (match_operand:P 3 "gpc_reg_operand" "r,r,r,r"))
14009 (set (match_operand:P 0 "gpc_reg_operand" "=&r,&r,&r,&r")
14010 (plus:P (ltu:P (match_dup 1) (match_dup 2)) (match_dup 3)))]
14013 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
14014 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
14015 (parallel [(set (match_dup 4)
14016 (compare:CC (minus:P (match_dup 3) (match_dup 0))
14018 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))])]
14021 (define_insn "*neg_ltu<mode>"
14022 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
14023 (neg:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14024 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))))]
14027 subfc %0,%2,%1\;subfe %0,%0,%0
14028 addic %0,%1,%n2\;subfe %0,%0,%0"
14029 [(set_attr "type" "two")
14030 (set_attr "length" "8")])
14032 (define_insn "*geu<mode>"
14033 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
14034 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14035 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))]
14038 subfc %0,%2,%1\;li %0,0\;adde %0,%0,%0
14039 addic %0,%1,%n2\;li %0,0\;adde %0,%0,%0"
14040 [(set_attr "type" "three")
14041 (set_attr "length" "12")])
14043 (define_insn "*geu<mode>_compare"
14044 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
14046 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
14047 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
14049 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
14050 (geu:P (match_dup 1) (match_dup 2)))]
14053 subfc %0,%2,%1\;li %0,0\;adde. %0,%0,%0
14054 addic %0,%1,%n2\;li %0,0\;adde. %0,%0,%0
14057 [(set_attr "type" "compare")
14058 (set_attr "length" "12,12,16,16")])
14061 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
14063 (geu:P (match_operand:P 1 "gpc_reg_operand" "")
14064 (match_operand:P 2 "reg_or_neg_short_operand" ""))
14066 (set (match_operand:P 0 "gpc_reg_operand" "")
14067 (geu:P (match_dup 1) (match_dup 2)))]
14069 [(set (match_dup 0)
14070 (geu:P (match_dup 1) (match_dup 2)))
14072 (compare:CC (match_dup 0)
14076 (define_insn "*plus_geu<mode>"
14077 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,&r")
14078 (plus:P (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14079 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))
14080 (match_operand:P 3 "gpc_reg_operand" "r,r")))]
14083 subfc %0,%2,%1\;addze %0,%3
14084 addic %0,%1,%n2\;addze %0,%3"
14085 [(set_attr "type" "two")
14086 (set_attr "length" "8")])
14089 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
14091 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14092 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
14093 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
14095 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
14098 subfc %4,%2,%1\;addze. %4,%3
14099 addic %4,%1,%n2\;addze. %4,%3
14102 [(set_attr "type" "compare")
14103 (set_attr "length" "8,8,12,12")])
14106 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14108 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14109 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
14110 (match_operand:SI 3 "gpc_reg_operand" ""))
14112 (clobber (match_scratch:SI 4 ""))]
14113 "TARGET_32BIT && reload_completed"
14114 [(set (match_dup 4)
14115 (plus:SI (geu:SI (match_dup 1) (match_dup 2))
14118 (compare:CC (match_dup 4)
14123 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
14125 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14126 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
14127 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
14129 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
14130 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14133 subfc %0,%2,%1\;addze. %0,%3
14134 addic %0,%1,%n2\;addze. %0,%3
14137 [(set_attr "type" "compare")
14138 (set_attr "length" "8,8,12,12")])
14141 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14143 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14144 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
14145 (match_operand:SI 3 "gpc_reg_operand" ""))
14147 (set (match_operand:SI 0 "gpc_reg_operand" "")
14148 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14149 "TARGET_32BIT && reload_completed"
14150 [(set (match_dup 0)
14151 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
14153 (compare:CC (match_dup 0)
14157 (define_insn "*neg_geu<mode>"
14158 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
14159 (neg:P (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14160 (match_operand:P 2 "reg_or_short_operand" "r,I"))))]
14163 subfc %0,%2,%1\;subfe %0,%0,%0\;nand %0,%0,%0
14164 subfic %0,%1,-1\;add%I2c %0,%0,%2\;subfe %0,%0,%0"
14165 [(set_attr "type" "three")
14166 (set_attr "length" "12")])
14168 (define_insn "*and_neg_geu<mode>"
14169 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,&r")
14171 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14172 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))
14173 (match_operand:P 3 "gpc_reg_operand" "r,r")))]
14176 subfc %0,%2,%1\;subfe %0,%0,%0\;andc %0,%3,%0
14177 addic %0,%1,%n2\;subfe %0,%0,%0\;andc %0,%3,%0"
14178 [(set_attr "type" "three")
14179 (set_attr "length" "12")])
14182 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
14185 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14186 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
14187 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
14189 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
14192 subfc %4,%2,%1\;subfe %4,%4,%4\;andc. %4,%3,%4
14193 addic %4,%1,%n2\;subfe %4,%4,%4\;andc. %4,%3,%4
14196 [(set_attr "type" "compare")
14197 (set_attr "length" "12,12,16,16")])
14200 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14203 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14204 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
14205 (match_operand:SI 3 "gpc_reg_operand" ""))
14207 (clobber (match_scratch:SI 4 ""))]
14208 "TARGET_32BIT && reload_completed"
14209 [(set (match_dup 4)
14210 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2)))
14213 (compare:CC (match_dup 4)
14218 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
14221 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14222 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
14223 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
14225 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
14226 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
14229 subfc %0,%2,%1\;subfe %0,%0,%0\;andc. %0,%3,%0
14230 addic %0,%1,%n2\;subfe %0,%0,%0\;andc. %0,%3,%0
14233 [(set_attr "type" "compare")
14234 (set_attr "length" "12,12,16,16")])
14237 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14240 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14241 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
14242 (match_operand:SI 3 "gpc_reg_operand" ""))
14244 (set (match_operand:SI 0 "gpc_reg_operand" "")
14245 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
14246 "TARGET_32BIT && reload_completed"
14247 [(set (match_dup 0)
14248 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
14250 (compare:CC (match_dup 0)
14254 (define_insn "*plus_gt0<mode>"
14255 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
14256 (plus:P (gt:P (match_operand:P 1 "gpc_reg_operand" "r")
14258 (match_operand:P 2 "gpc_reg_operand" "r")))]
14260 "addc %0,%1,%1\;subfe %0,%1,%0\;addze %0,%2"
14261 [(set_attr "type" "three")
14262 (set_attr "length" "12")])
14265 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
14267 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14269 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
14271 (clobber (match_scratch:SI 3 "=&r,&r"))]
14274 addc %3,%1,%1\;subfe %3,%1,%3\;addze. %3,%2
14276 [(set_attr "type" "compare")
14277 (set_attr "length" "12,16")])
14280 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14282 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14284 (match_operand:SI 2 "gpc_reg_operand" ""))
14286 (clobber (match_scratch:SI 3 ""))]
14287 "TARGET_32BIT && reload_completed"
14288 [(set (match_dup 3)
14289 (plus:SI (gt:SI (match_dup 1) (const_int 0))
14292 (compare:CC (match_dup 3)
14297 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
14299 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
14301 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
14303 (clobber (match_scratch:DI 3 "=&r,&r"))]
14306 addc %3,%1,%1\;subfe %3,%1,%3\;addze. %3,%2
14308 [(set_attr "type" "compare")
14309 (set_attr "length" "12,16")])
14312 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
14314 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
14316 (match_operand:DI 2 "gpc_reg_operand" ""))
14318 (clobber (match_scratch:DI 3 ""))]
14319 "TARGET_64BIT && reload_completed"
14320 [(set (match_dup 3)
14321 (plus:DI (gt:DI (match_dup 1) (const_int 0))
14324 (compare:CC (match_dup 3)
14329 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
14331 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14333 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
14335 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
14336 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
14339 addc %0,%1,%1\;subfe %0,%1,%0\;addze. %0,%2
14341 [(set_attr "type" "compare")
14342 (set_attr "length" "12,16")])
14345 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
14347 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14349 (match_operand:SI 2 "gpc_reg_operand" ""))
14351 (set (match_operand:SI 0 "gpc_reg_operand" "")
14352 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
14353 "TARGET_32BIT && reload_completed"
14354 [(set (match_dup 0)
14355 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))
14357 (compare:CC (match_dup 0)
14362 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
14364 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
14366 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
14368 (set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
14369 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
14372 addc %0,%1,%1\;subfe %0,%1,%0\;addze. %0,%2
14374 [(set_attr "type" "compare")
14375 (set_attr "length" "12,16")])
14378 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
14380 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
14382 (match_operand:DI 2 "gpc_reg_operand" ""))
14384 (set (match_operand:DI 0 "gpc_reg_operand" "")
14385 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
14386 "TARGET_64BIT && reload_completed"
14387 [(set (match_dup 0)
14388 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))
14390 (compare:CC (match_dup 0)
14394 (define_insn_and_split "*gtu<mode>"
14395 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
14396 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
14397 (match_operand:P 2 "reg_or_short_operand" "rI")))]
14401 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
14402 (set (match_dup 0) (neg:P (match_dup 0)))]
14405 (define_insn_and_split "*gtu<mode>_compare"
14406 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
14408 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14409 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
14411 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
14412 (gtu:P (match_dup 1) (match_dup 2)))]
14416 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
14417 (parallel [(set (match_dup 3)
14418 (compare:CC (neg:P (match_dup 0)) (const_int 0)))
14419 (set (match_dup 0) (neg:P (match_dup 0)))])]
14422 (define_insn_and_split "*plus_gtu<mode>"
14423 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
14424 (plus:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
14425 (match_operand:P 2 "reg_or_short_operand" "rI"))
14426 (match_operand:P 3 "reg_or_short_operand" "rI")))]
14429 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
14430 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
14431 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))]
14434 (define_insn_and_split "*plus_gtu<mode>_compare"
14435 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
14437 (plus:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
14438 (match_operand:P 2 "reg_or_short_operand" "I,r,I,r"))
14439 (match_operand:P 3 "gpc_reg_operand" "r,r,r,r"))
14441 (set (match_operand:P 0 "gpc_reg_operand" "=&r,&r,&r,&r")
14442 (plus:P (gtu:P (match_dup 1) (match_dup 2)) (match_dup 3)))]
14445 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
14446 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
14447 (parallel [(set (match_dup 4)
14448 (compare:CC (minus:P (match_dup 3) (match_dup 0))
14450 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))])]
14453 (define_insn "*neg_gtu<mode>"
14454 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
14455 (neg:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
14456 (match_operand:P 2 "reg_or_short_operand" "rI"))))]
14458 "subf%I2c %0,%1,%2\;subfe %0,%0,%0"
14459 [(set_attr "type" "two")
14460 (set_attr "length" "8")])
14463 ;; Define both directions of branch and return. If we need a reload
14464 ;; register, we'd rather use CR0 since it is much easier to copy a
14465 ;; register CC value to there.
14469 (if_then_else (match_operator 1 "branch_comparison_operator"
14471 "cc_reg_operand" "y")
14473 (label_ref (match_operand 0 "" ""))
14478 return output_cbranch (operands[1], \"%l0\", 0, insn);
14480 [(set_attr "type" "branch")])
14484 (if_then_else (match_operator 0 "branch_comparison_operator"
14486 "cc_reg_operand" "y")
14493 return output_cbranch (operands[0], NULL, 0, insn);
14495 [(set_attr "type" "jmpreg")
14496 (set_attr "length" "4")])
14500 (if_then_else (match_operator 1 "branch_comparison_operator"
14502 "cc_reg_operand" "y")
14505 (label_ref (match_operand 0 "" ""))))]
14509 return output_cbranch (operands[1], \"%l0\", 1, insn);
14511 [(set_attr "type" "branch")])
14515 (if_then_else (match_operator 0 "branch_comparison_operator"
14517 "cc_reg_operand" "y")
14524 return output_cbranch (operands[0], NULL, 1, insn);
14526 [(set_attr "type" "jmpreg")
14527 (set_attr "length" "4")])
14529 ;; Logic on condition register values.
14531 ; This pattern matches things like
14532 ; (set (reg:CCEQ 68) (compare:CCEQ (ior:SI (gt:SI (reg:CCFP 68) (const_int 0))
14533 ; (eq:SI (reg:CCFP 68) (const_int 0)))
14535 ; which are generated by the branch logic.
14536 ; Prefer destructive operations where BT = BB (for crXX BT,BA,BB)
14538 (define_insn "*cceq_ior_compare"
14539 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
14540 (compare:CCEQ (match_operator:SI 1 "boolean_operator"
14541 [(match_operator:SI 2
14542 "branch_positive_comparison_operator"
14544 "cc_reg_operand" "y,y")
14546 (match_operator:SI 4
14547 "branch_positive_comparison_operator"
14549 "cc_reg_operand" "0,y")
14553 "cr%q1 %E0,%j2,%j4"
14554 [(set_attr "type" "cr_logical,delayed_cr")])
14556 ; Why is the constant -1 here, but 1 in the previous pattern?
14557 ; Because ~1 has all but the low bit set.
14559 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
14560 (compare:CCEQ (match_operator:SI 1 "boolean_or_operator"
14561 [(not:SI (match_operator:SI 2
14562 "branch_positive_comparison_operator"
14564 "cc_reg_operand" "y,y")
14566 (match_operator:SI 4
14567 "branch_positive_comparison_operator"
14569 "cc_reg_operand" "0,y")
14573 "cr%q1 %E0,%j2,%j4"
14574 [(set_attr "type" "cr_logical,delayed_cr")])
14576 (define_insn "*cceq_rev_compare"
14577 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
14578 (compare:CCEQ (match_operator:SI 1
14579 "branch_positive_comparison_operator"
14581 "cc_reg_operand" "0,y")
14586 [(set_attr "type" "cr_logical,delayed_cr")])
14588 ;; If we are comparing the result of two comparisons, this can be done
14589 ;; using creqv or crxor.
14591 (define_insn_and_split ""
14592 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
14593 (compare:CCEQ (match_operator 1 "branch_comparison_operator"
14594 [(match_operand 2 "cc_reg_operand" "y")
14596 (match_operator 3 "branch_comparison_operator"
14597 [(match_operand 4 "cc_reg_operand" "y")
14602 [(set (match_dup 0) (compare:CCEQ (xor:SI (match_dup 1) (match_dup 3))
14606 int positive_1, positive_2;
14608 positive_1 = branch_positive_comparison_operator (operands[1],
14609 GET_MODE (operands[1]));
14610 positive_2 = branch_positive_comparison_operator (operands[3],
14611 GET_MODE (operands[3]));
14614 operands[1] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[2]),
14615 GET_CODE (operands[1])),
14617 operands[2], const0_rtx);
14618 else if (GET_MODE (operands[1]) != SImode)
14619 operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]), SImode,
14620 operands[2], const0_rtx);
14623 operands[3] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[4]),
14624 GET_CODE (operands[3])),
14626 operands[4], const0_rtx);
14627 else if (GET_MODE (operands[3]) != SImode)
14628 operands[3] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
14629 operands[4], const0_rtx);
14631 if (positive_1 == positive_2)
14633 operands[1] = gen_rtx_NOT (SImode, operands[1]);
14634 operands[5] = constm1_rtx;
14638 operands[5] = const1_rtx;
14642 ;; Unconditional branch and return.
14644 (define_insn "jump"
14646 (label_ref (match_operand 0 "" "")))]
14649 [(set_attr "type" "branch")])
14651 (define_insn "<return_str>return"
14655 [(set_attr "type" "jmpreg")])
14657 (define_expand "indirect_jump"
14658 [(set (pc) (match_operand 0 "register_operand" ""))])
14660 (define_insn "*indirect_jump<mode>"
14661 [(set (pc) (match_operand:P 0 "register_operand" "c,*l"))]
14666 [(set_attr "type" "jmpreg")])
14668 ;; Table jump for switch statements:
14669 (define_expand "tablejump"
14670 [(use (match_operand 0 "" ""))
14671 (use (label_ref (match_operand 1 "" "")))]
14676 emit_jump_insn (gen_tablejumpsi (operands[0], operands[1]));
14678 emit_jump_insn (gen_tablejumpdi (operands[0], operands[1]));
14682 (define_expand "tablejumpsi"
14683 [(set (match_dup 3)
14684 (plus:SI (match_operand:SI 0 "" "")
14686 (parallel [(set (pc) (match_dup 3))
14687 (use (label_ref (match_operand 1 "" "")))])]
14690 { operands[0] = force_reg (SImode, operands[0]);
14691 operands[2] = force_reg (SImode, gen_rtx_LABEL_REF (SImode, operands[1]));
14692 operands[3] = gen_reg_rtx (SImode);
14695 (define_expand "tablejumpdi"
14696 [(set (match_dup 4)
14697 (sign_extend:DI (match_operand:SI 0 "lwa_operand" "")))
14699 (plus:DI (match_dup 4)
14701 (parallel [(set (pc) (match_dup 3))
14702 (use (label_ref (match_operand 1 "" "")))])]
14705 { operands[2] = force_reg (DImode, gen_rtx_LABEL_REF (DImode, operands[1]));
14706 operands[3] = gen_reg_rtx (DImode);
14707 operands[4] = gen_reg_rtx (DImode);
14710 (define_insn "*tablejump<mode>_internal1"
14712 (match_operand:P 0 "register_operand" "c,*l"))
14713 (use (label_ref (match_operand 1 "" "")))]
14718 [(set_attr "type" "jmpreg")])
14725 (define_insn "group_ending_nop"
14726 [(unspec [(const_int 0)] UNSPEC_GRP_END_NOP)]
14730 if (rs6000_cpu_attr == CPU_POWER6)
14731 return \"ori 1,1,0\";
14732 return \"ori 2,2,0\";
14735 ;; Define the subtract-one-and-jump insns, starting with the template
14736 ;; so loop.c knows what to generate.
14738 (define_expand "doloop_end"
14739 [(use (match_operand 0 "" "")) ; loop pseudo
14740 (use (match_operand 1 "" ""))] ; label
14746 if (GET_MODE (operands[0]) != DImode)
14748 emit_jump_insn (gen_ctrdi (operands[0], operands[1]));
14752 if (GET_MODE (operands[0]) != SImode)
14754 emit_jump_insn (gen_ctrsi (operands[0], operands[1]));
14759 (define_expand "ctr<mode>"
14760 [(parallel [(set (pc)
14761 (if_then_else (ne (match_operand:P 0 "register_operand" "")
14763 (label_ref (match_operand 1 "" ""))
14766 (plus:P (match_dup 0)
14768 (clobber (match_scratch:CC 2 ""))
14769 (clobber (match_scratch:P 3 ""))])]
14773 ;; We need to be able to do this for any operand, including MEM, or we
14774 ;; will cause reload to blow up since we don't allow output reloads on
14776 ;; For the length attribute to be calculated correctly, the
14777 ;; label MUST be operand 0.
14779 (define_insn "*ctr<mode>_internal1"
14781 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
14783 (label_ref (match_operand 0 "" ""))
14785 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*c*l")
14786 (plus:P (match_dup 1)
14788 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14789 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
14793 if (which_alternative != 0)
14795 else if (get_attr_length (insn) == 4)
14796 return \"bdnz %l0\";
14798 return \"bdz $+8\;b %l0\";
14800 [(set_attr "type" "branch")
14801 (set_attr "length" "*,12,16,16")])
14803 (define_insn "*ctr<mode>_internal2"
14805 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
14808 (label_ref (match_operand 0 "" ""))))
14809 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*c*l")
14810 (plus:P (match_dup 1)
14812 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14813 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
14817 if (which_alternative != 0)
14819 else if (get_attr_length (insn) == 4)
14820 return \"bdz %l0\";
14822 return \"bdnz $+8\;b %l0\";
14824 [(set_attr "type" "branch")
14825 (set_attr "length" "*,12,16,16")])
14827 ;; Similar but use EQ
14829 (define_insn "*ctr<mode>_internal5"
14831 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
14833 (label_ref (match_operand 0 "" ""))
14835 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*c*l")
14836 (plus:P (match_dup 1)
14838 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14839 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
14843 if (which_alternative != 0)
14845 else if (get_attr_length (insn) == 4)
14846 return \"bdz %l0\";
14848 return \"bdnz $+8\;b %l0\";
14850 [(set_attr "type" "branch")
14851 (set_attr "length" "*,12,16,16")])
14853 (define_insn "*ctr<mode>_internal6"
14855 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
14858 (label_ref (match_operand 0 "" ""))))
14859 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*c*l")
14860 (plus:P (match_dup 1)
14862 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14863 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
14867 if (which_alternative != 0)
14869 else if (get_attr_length (insn) == 4)
14870 return \"bdnz %l0\";
14872 return \"bdz $+8\;b %l0\";
14874 [(set_attr "type" "branch")
14875 (set_attr "length" "*,12,16,16")])
14877 ;; Now the splitters if we could not allocate the CTR register
14881 (if_then_else (match_operator 2 "comparison_operator"
14882 [(match_operand:P 1 "gpc_reg_operand" "")
14884 (match_operand 5 "" "")
14885 (match_operand 6 "" "")))
14886 (set (match_operand:P 0 "gpc_reg_operand" "")
14887 (plus:P (match_dup 1) (const_int -1)))
14888 (clobber (match_scratch:CC 3 ""))
14889 (clobber (match_scratch:P 4 ""))]
14891 [(parallel [(set (match_dup 3)
14892 (compare:CC (plus:P (match_dup 1)
14896 (plus:P (match_dup 1)
14898 (set (pc) (if_then_else (match_dup 7)
14902 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
14903 operands[3], const0_rtx); }")
14907 (if_then_else (match_operator 2 "comparison_operator"
14908 [(match_operand:P 1 "gpc_reg_operand" "")
14910 (match_operand 5 "" "")
14911 (match_operand 6 "" "")))
14912 (set (match_operand:P 0 "nonimmediate_operand" "")
14913 (plus:P (match_dup 1) (const_int -1)))
14914 (clobber (match_scratch:CC 3 ""))
14915 (clobber (match_scratch:P 4 ""))]
14916 "reload_completed && ! gpc_reg_operand (operands[0], SImode)"
14917 [(parallel [(set (match_dup 3)
14918 (compare:CC (plus:P (match_dup 1)
14922 (plus:P (match_dup 1)
14926 (set (pc) (if_then_else (match_dup 7)
14930 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
14931 operands[3], const0_rtx); }")
14933 (define_insn "trap"
14934 [(trap_if (const_int 1) (const_int 0))]
14937 [(set_attr "type" "trap")])
14939 (define_expand "ctrap<mode>4"
14940 [(trap_if (match_operator 0 "ordered_comparison_operator"
14941 [(match_operand:GPR 1 "register_operand")
14942 (match_operand:GPR 2 "reg_or_short_operand")])
14943 (match_operand 3 "zero_constant" ""))]
14948 [(trap_if (match_operator 0 "ordered_comparison_operator"
14949 [(match_operand:GPR 1 "register_operand" "r")
14950 (match_operand:GPR 2 "reg_or_short_operand" "rI")])
14953 "t<wd>%V0%I2 %1,%2"
14954 [(set_attr "type" "trap")])
14956 ;; Insns related to generating the function prologue and epilogue.
14958 (define_expand "prologue"
14959 [(use (const_int 0))]
14962 rs6000_emit_prologue ();
14963 if (!TARGET_SCHED_PROLOG)
14964 emit_insn (gen_blockage ());
14968 (define_insn "*movesi_from_cr_one"
14969 [(match_parallel 0 "mfcr_operation"
14970 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
14971 (unspec:SI [(match_operand:CC 2 "cc_reg_operand" "y")
14972 (match_operand 3 "immediate_operand" "n")]
14973 UNSPEC_MOVESI_FROM_CR))])]
14979 for (i = 0; i < XVECLEN (operands[0], 0); i++)
14981 mask = INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
14982 operands[4] = GEN_INT (mask);
14983 output_asm_insn (\"mfcr %1,%4\", operands);
14987 [(set_attr "type" "mfcrf")])
14989 (define_insn "movesi_from_cr"
14990 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14991 (unspec:SI [(reg:CC CR0_REGNO) (reg:CC CR1_REGNO)
14992 (reg:CC CR2_REGNO) (reg:CC CR3_REGNO)
14993 (reg:CC CR4_REGNO) (reg:CC CR5_REGNO)
14994 (reg:CC CR6_REGNO) (reg:CC CR7_REGNO)]
14995 UNSPEC_MOVESI_FROM_CR))]
14998 [(set_attr "type" "mfcr")])
15000 (define_insn "*crsave"
15001 [(match_parallel 0 "crsave_operation"
15002 [(set (match_operand:SI 1 "memory_operand" "=m")
15003 (match_operand:SI 2 "gpc_reg_operand" "r"))])]
15006 [(set_attr "type" "store")])
15008 (define_insn "*stmw"
15009 [(match_parallel 0 "stmw_operation"
15010 [(set (match_operand:SI 1 "memory_operand" "=m")
15011 (match_operand:SI 2 "gpc_reg_operand" "r"))])]
15014 [(set_attr "type" "store")
15015 (set_attr "update" "yes")
15016 (set_attr "indexed" "yes")])
15018 ; The following comment applies to:
15022 ; return_and_restore_gpregs*
15023 ; return_and_restore_fpregs*
15024 ; return_and_restore_fpregs_aix*
15026 ; The out-of-line save / restore functions expects one input argument.
15027 ; Since those are not standard call_insn's, we must avoid using
15028 ; MATCH_OPERAND for that argument. That way the register rename
15029 ; optimization will not try to rename this register.
15030 ; Each pattern is repeated for each possible register number used in
15031 ; various ABIs (r11, r1, and for some functions r12)
15033 (define_insn "*save_gpregs_<mode>_r11"
15034 [(match_parallel 0 "any_parallel_operand"
15035 [(clobber (reg:P 65))
15036 (use (match_operand:P 1 "symbol_ref_operand" "s"))
15038 (set (match_operand:P 2 "memory_operand" "=m")
15039 (match_operand:P 3 "gpc_reg_operand" "r"))])]
15042 [(set_attr "type" "branch")
15043 (set_attr "length" "4")])
15045 (define_insn "*save_gpregs_<mode>_r12"
15046 [(match_parallel 0 "any_parallel_operand"
15047 [(clobber (reg:P 65))
15048 (use (match_operand:P 1 "symbol_ref_operand" "s"))
15050 (set (match_operand:P 2 "memory_operand" "=m")
15051 (match_operand:P 3 "gpc_reg_operand" "r"))])]
15054 [(set_attr "type" "branch")
15055 (set_attr "length" "4")])
15057 (define_insn "*save_gpregs_<mode>_r1"
15058 [(match_parallel 0 "any_parallel_operand"
15059 [(clobber (reg:P 65))
15060 (use (match_operand:P 1 "symbol_ref_operand" "s"))
15062 (set (match_operand:P 2 "memory_operand" "=m")
15063 (match_operand:P 3 "gpc_reg_operand" "r"))])]
15066 [(set_attr "type" "branch")
15067 (set_attr "length" "4")])
15069 (define_insn "*save_fpregs_<mode>_r11"
15070 [(match_parallel 0 "any_parallel_operand"
15071 [(clobber (reg:P 65))
15072 (use (match_operand:P 1 "symbol_ref_operand" "s"))
15074 (set (match_operand:DF 2 "memory_operand" "=m")
15075 (match_operand:DF 3 "gpc_reg_operand" "d"))])]
15078 [(set_attr "type" "branch")
15079 (set_attr "length" "4")])
15081 (define_insn "*save_fpregs_<mode>_r12"
15082 [(match_parallel 0 "any_parallel_operand"
15083 [(clobber (reg:P 65))
15084 (use (match_operand:P 1 "symbol_ref_operand" "s"))
15086 (set (match_operand:DF 2 "memory_operand" "=m")
15087 (match_operand:DF 3 "gpc_reg_operand" "d"))])]
15090 [(set_attr "type" "branch")
15091 (set_attr "length" "4")])
15093 (define_insn "*save_fpregs_<mode>_r1"
15094 [(match_parallel 0 "any_parallel_operand"
15095 [(clobber (reg:P 65))
15096 (use (match_operand:P 1 "symbol_ref_operand" "s"))
15098 (set (match_operand:DF 2 "memory_operand" "=m")
15099 (match_operand:DF 3 "gpc_reg_operand" "d"))])]
15102 [(set_attr "type" "branch")
15103 (set_attr "length" "4")])
15105 ; This is to explain that changes to the stack pointer should
15106 ; not be moved over loads from or stores to stack memory.
15107 (define_insn "stack_tie"
15108 [(match_parallel 0 "tie_operand"
15109 [(set (mem:BLK (reg 1)) (const_int 0))])]
15112 [(set_attr "length" "0")])
15114 (define_expand "epilogue"
15115 [(use (const_int 0))]
15118 if (!TARGET_SCHED_PROLOG)
15119 emit_insn (gen_blockage ());
15120 rs6000_emit_epilogue (FALSE);
15124 ; On some processors, doing the mtcrf one CC register at a time is
15125 ; faster (like on the 604e). On others, doing them all at once is
15126 ; faster; for instance, on the 601 and 750.
15128 (define_expand "movsi_to_cr_one"
15129 [(set (match_operand:CC 0 "cc_reg_operand" "")
15130 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "")
15131 (match_dup 2)] UNSPEC_MOVESI_TO_CR))]
15133 "operands[2] = GEN_INT (1 << (75 - REGNO (operands[0])));")
15135 (define_insn "*movsi_to_cr"
15136 [(match_parallel 0 "mtcrf_operation"
15137 [(set (match_operand:CC 1 "cc_reg_operand" "=y")
15138 (unspec:CC [(match_operand:SI 2 "gpc_reg_operand" "r")
15139 (match_operand 3 "immediate_operand" "n")]
15140 UNSPEC_MOVESI_TO_CR))])]
15146 for (i = 0; i < XVECLEN (operands[0], 0); i++)
15147 mask |= INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
15148 operands[4] = GEN_INT (mask);
15149 return \"mtcrf %4,%2\";
15151 [(set_attr "type" "mtcr")])
15153 (define_insn "*mtcrfsi"
15154 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
15155 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
15156 (match_operand 2 "immediate_operand" "n")]
15157 UNSPEC_MOVESI_TO_CR))]
15158 "GET_CODE (operands[0]) == REG
15159 && CR_REGNO_P (REGNO (operands[0]))
15160 && GET_CODE (operands[2]) == CONST_INT
15161 && INTVAL (operands[2]) == 1 << (75 - REGNO (operands[0]))"
15163 [(set_attr "type" "mtcr")])
15165 ; The load-multiple instructions have similar properties.
15166 ; Note that "load_multiple" is a name known to the machine-independent
15167 ; code that actually corresponds to the PowerPC load-string.
15169 (define_insn "*lmw"
15170 [(match_parallel 0 "lmw_operation"
15171 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
15172 (match_operand:SI 2 "memory_operand" "m"))])]
15175 [(set_attr "type" "load")
15176 (set_attr "update" "yes")
15177 (set_attr "indexed" "yes")
15178 (set_attr "cell_micro" "always")])
15180 (define_insn "*return_internal_<mode>"
15182 (use (match_operand:P 0 "register_operand" "lc"))]
15185 [(set_attr "type" "jmpreg")])
15187 ; FIXME: This would probably be somewhat simpler if the Cygnus sibcall
15188 ; stuff was in GCC. Oh, and "any_parallel_operand" is a bit flexible...
15190 ; The following comment applies to:
15194 ; return_and_restore_gpregs*
15195 ; return_and_restore_fpregs*
15196 ; return_and_restore_fpregs_aix*
15198 ; The out-of-line save / restore functions expects one input argument.
15199 ; Since those are not standard call_insn's, we must avoid using
15200 ; MATCH_OPERAND for that argument. That way the register rename
15201 ; optimization will not try to rename this register.
15202 ; Each pattern is repeated for each possible register number used in
15203 ; various ABIs (r11, r1, and for some functions r12)
15205 (define_insn "*restore_gpregs_<mode>_r11"
15206 [(match_parallel 0 "any_parallel_operand"
15207 [(clobber (match_operand:P 1 "register_operand" "=l"))
15208 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15210 (set (match_operand:P 3 "gpc_reg_operand" "=r")
15211 (match_operand:P 4 "memory_operand" "m"))])]
15214 [(set_attr "type" "branch")
15215 (set_attr "length" "4")])
15217 (define_insn "*restore_gpregs_<mode>_r12"
15218 [(match_parallel 0 "any_parallel_operand"
15219 [(clobber (match_operand:P 1 "register_operand" "=l"))
15220 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15222 (set (match_operand:P 3 "gpc_reg_operand" "=r")
15223 (match_operand:P 4 "memory_operand" "m"))])]
15226 [(set_attr "type" "branch")
15227 (set_attr "length" "4")])
15229 (define_insn "*restore_gpregs_<mode>_r1"
15230 [(match_parallel 0 "any_parallel_operand"
15231 [(clobber (match_operand:P 1 "register_operand" "=l"))
15232 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15234 (set (match_operand:P 3 "gpc_reg_operand" "=r")
15235 (match_operand:P 4 "memory_operand" "m"))])]
15238 [(set_attr "type" "branch")
15239 (set_attr "length" "4")])
15241 (define_insn "*return_and_restore_gpregs_<mode>_r11"
15242 [(match_parallel 0 "any_parallel_operand"
15244 (clobber (match_operand:P 1 "register_operand" "=l"))
15245 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15247 (set (match_operand:P 3 "gpc_reg_operand" "=r")
15248 (match_operand:P 4 "memory_operand" "m"))])]
15251 [(set_attr "type" "branch")
15252 (set_attr "length" "4")])
15254 (define_insn "*return_and_restore_gpregs_<mode>_r12"
15255 [(match_parallel 0 "any_parallel_operand"
15257 (clobber (match_operand:P 1 "register_operand" "=l"))
15258 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15260 (set (match_operand:P 3 "gpc_reg_operand" "=r")
15261 (match_operand:P 4 "memory_operand" "m"))])]
15264 [(set_attr "type" "branch")
15265 (set_attr "length" "4")])
15267 (define_insn "*return_and_restore_gpregs_<mode>_r1"
15268 [(match_parallel 0 "any_parallel_operand"
15270 (clobber (match_operand:P 1 "register_operand" "=l"))
15271 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15273 (set (match_operand:P 3 "gpc_reg_operand" "=r")
15274 (match_operand:P 4 "memory_operand" "m"))])]
15277 [(set_attr "type" "branch")
15278 (set_attr "length" "4")])
15280 (define_insn "*return_and_restore_fpregs_<mode>_r11"
15281 [(match_parallel 0 "any_parallel_operand"
15283 (clobber (match_operand:P 1 "register_operand" "=l"))
15284 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15286 (set (match_operand:DF 3 "gpc_reg_operand" "=d")
15287 (match_operand:DF 4 "memory_operand" "m"))])]
15290 [(set_attr "type" "branch")
15291 (set_attr "length" "4")])
15293 (define_insn "*return_and_restore_fpregs_<mode>_r12"
15294 [(match_parallel 0 "any_parallel_operand"
15296 (clobber (match_operand:P 1 "register_operand" "=l"))
15297 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15299 (set (match_operand:DF 3 "gpc_reg_operand" "=d")
15300 (match_operand:DF 4 "memory_operand" "m"))])]
15303 [(set_attr "type" "branch")
15304 (set_attr "length" "4")])
15306 (define_insn "*return_and_restore_fpregs_<mode>_r1"
15307 [(match_parallel 0 "any_parallel_operand"
15309 (clobber (match_operand:P 1 "register_operand" "=l"))
15310 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15312 (set (match_operand:DF 3 "gpc_reg_operand" "=d")
15313 (match_operand:DF 4 "memory_operand" "m"))])]
15316 [(set_attr "type" "branch")
15317 (set_attr "length" "4")])
15319 (define_insn "*return_and_restore_fpregs_aix_<mode>_r11"
15320 [(match_parallel 0 "any_parallel_operand"
15322 (use (match_operand:P 1 "register_operand" "l"))
15323 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15325 (set (match_operand:DF 3 "gpc_reg_operand" "=d")
15326 (match_operand:DF 4 "memory_operand" "m"))])]
15329 [(set_attr "type" "branch")
15330 (set_attr "length" "4")])
15332 (define_insn "*return_and_restore_fpregs_aix_<mode>_r1"
15333 [(match_parallel 0 "any_parallel_operand"
15335 (use (match_operand:P 1 "register_operand" "l"))
15336 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15338 (set (match_operand:DF 3 "gpc_reg_operand" "=d")
15339 (match_operand:DF 4 "memory_operand" "m"))])]
15342 [(set_attr "type" "branch")
15343 (set_attr "length" "4")])
15345 ; This is used in compiling the unwind routines.
15346 (define_expand "eh_return"
15347 [(use (match_operand 0 "general_operand" ""))]
15352 emit_insn (gen_eh_set_lr_si (operands[0]));
15354 emit_insn (gen_eh_set_lr_di (operands[0]));
15358 ; We can't expand this before we know where the link register is stored.
15359 (define_insn "eh_set_lr_<mode>"
15360 [(unspec_volatile [(match_operand:P 0 "register_operand" "r")]
15362 (clobber (match_scratch:P 1 "=&b"))]
15367 [(unspec_volatile [(match_operand 0 "register_operand" "")] UNSPECV_EH_RR)
15368 (clobber (match_scratch 1 ""))]
15373 rs6000_emit_eh_reg_restore (operands[0], operands[1]);
15377 (define_insn "prefetch"
15378 [(prefetch (match_operand 0 "indexed_or_indirect_address" "a")
15379 (match_operand:SI 1 "const_int_operand" "n")
15380 (match_operand:SI 2 "const_int_operand" "n"))]
15384 if (GET_CODE (operands[0]) == REG)
15385 return INTVAL (operands[1]) ? \"dcbtst 0,%0\" : \"dcbt 0,%0\";
15386 return INTVAL (operands[1]) ? \"dcbtst %a0\" : \"dcbt %a0\";
15388 [(set_attr "type" "load")])
15390 (define_insn "bpermd_<mode>"
15391 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
15392 (unspec:P [(match_operand:P 1 "gpc_reg_operand" "r")
15393 (match_operand:P 2 "gpc_reg_operand" "r")] UNSPEC_BPERM))]
15396 [(set_attr "type" "popcnt")])
15399 ;; Builtin fma support. Handle
15400 ;; Note that the conditions for expansion are in the FMA_F iterator.
15402 (define_expand "fma<mode>4"
15403 [(set (match_operand:FMA_F 0 "register_operand" "")
15405 (match_operand:FMA_F 1 "register_operand" "")
15406 (match_operand:FMA_F 2 "register_operand" "")
15407 (match_operand:FMA_F 3 "register_operand" "")))]
15411 (define_insn "*fma<mode>4_fpr"
15412 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>,<Fv>")
15414 (match_operand:SFDF 1 "gpc_reg_operand" "%<Ff>,<Fv>,<Fv>")
15415 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>,0")
15416 (match_operand:SFDF 3 "gpc_reg_operand" "<Ff>,0,<Fv>")))]
15417 "TARGET_<MODE>_FPR"
15419 fmadd<Ftrad> %0,%1,%2,%3
15420 xsmadda<Fvsx> %x0,%x1,%x2
15421 xsmaddm<Fvsx> %x0,%x1,%x3"
15422 [(set_attr "type" "fp")
15423 (set_attr "fp_type" "fp_maddsub_<Fs>")])
15425 ; Altivec only has fma and nfms.
15426 (define_expand "fms<mode>4"
15427 [(set (match_operand:FMA_F 0 "register_operand" "")
15429 (match_operand:FMA_F 1 "register_operand" "")
15430 (match_operand:FMA_F 2 "register_operand" "")
15431 (neg:FMA_F (match_operand:FMA_F 3 "register_operand" ""))))]
15432 "!VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
15435 (define_insn "*fms<mode>4_fpr"
15436 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>,<Fv>")
15438 (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>,<Fv>")
15439 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>,0")
15440 (neg:SFDF (match_operand:SFDF 3 "gpc_reg_operand" "<Ff>,0,<Fv>"))))]
15441 "TARGET_<MODE>_FPR"
15443 fmsub<Ftrad> %0,%1,%2,%3
15444 xsmsuba<Fvsx> %x0,%x1,%x2
15445 xsmsubm<Fvsx> %x0,%x1,%x3"
15446 [(set_attr "type" "fp")
15447 (set_attr "fp_type" "fp_maddsub_<Fs>")])
15449 ;; If signed zeros are ignored, -(a * b - c) = -a * b + c.
15450 (define_expand "fnma<mode>4"
15451 [(set (match_operand:FMA_F 0 "register_operand" "")
15454 (match_operand:FMA_F 1 "register_operand" "")
15455 (match_operand:FMA_F 2 "register_operand" "")
15456 (neg:FMA_F (match_operand:FMA_F 3 "register_operand" "")))))]
15457 "!HONOR_SIGNED_ZEROS (<MODE>mode)"
15460 ;; If signed zeros are ignored, -(a * b + c) = -a * b - c.
15461 (define_expand "fnms<mode>4"
15462 [(set (match_operand:FMA_F 0 "register_operand" "")
15465 (match_operand:FMA_F 1 "register_operand" "")
15466 (match_operand:FMA_F 2 "register_operand" "")
15467 (match_operand:FMA_F 3 "register_operand" ""))))]
15468 "!HONOR_SIGNED_ZEROS (<MODE>mode) && !VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
15471 ; Not an official optab name, but used from builtins.
15472 (define_expand "nfma<mode>4"
15473 [(set (match_operand:FMA_F 0 "register_operand" "")
15476 (match_operand:FMA_F 1 "register_operand" "")
15477 (match_operand:FMA_F 2 "register_operand" "")
15478 (match_operand:FMA_F 3 "register_operand" ""))))]
15479 "!VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
15482 (define_insn "*nfma<mode>4_fpr"
15483 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>,<Fv>")
15486 (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>,<Fv>")
15487 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>,0")
15488 (match_operand:SFDF 3 "gpc_reg_operand" "<Ff>,0,<Fv>"))))]
15489 "TARGET_<MODE>_FPR"
15491 fnmadd<Ftrad> %0,%1,%2,%3
15492 xsnmadda<Fvsx> %x0,%x1,%x2
15493 xsnmaddm<Fvsx> %x0,%x1,%x3"
15494 [(set_attr "type" "fp")
15495 (set_attr "fp_type" "fp_maddsub_<Fs>")])
15497 ; Not an official optab name, but used from builtins.
15498 (define_expand "nfms<mode>4"
15499 [(set (match_operand:FMA_F 0 "register_operand" "")
15502 (match_operand:FMA_F 1 "register_operand" "")
15503 (match_operand:FMA_F 2 "register_operand" "")
15504 (neg:FMA_F (match_operand:FMA_F 3 "register_operand" "")))))]
15508 (define_insn "*nfmssf4_fpr"
15509 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>,<Fv>")
15512 (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>,<Fv>")
15513 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>,0")
15515 (match_operand:SFDF 3 "gpc_reg_operand" "<Ff>,0,<Fv>")))))]
15516 "TARGET_<MODE>_FPR"
15518 fnmsub<Ftrad> %0,%1,%2,%3
15519 xsnmsuba<Fvsx> %x0,%x1,%x2
15520 xsnmsubm<Fvsx> %x0,%x1,%x3"
15521 [(set_attr "type" "fp")
15522 (set_attr "fp_type" "fp_maddsub_<Fs>")])
15525 (define_expand "rs6000_get_timebase"
15526 [(use (match_operand:DI 0 "gpc_reg_operand" ""))]
15529 if (TARGET_POWERPC64)
15530 emit_insn (gen_rs6000_mftb_di (operands[0]));
15532 emit_insn (gen_rs6000_get_timebase_ppc32 (operands[0]));
15536 (define_insn "rs6000_get_timebase_ppc32"
15537 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
15538 (unspec_volatile:DI [(const_int 0)] UNSPECV_MFTB))
15539 (clobber (match_scratch:SI 1 "=r"))
15540 (clobber (match_scratch:CC 2 "=y"))]
15541 "!TARGET_POWERPC64"
15543 if (WORDS_BIG_ENDIAN)
15546 return "mfspr %0,269\;"
15554 return "mftbu %0\;"
15563 return "mfspr %L0,269\;"
15571 return "mftbu %L0\;"
15578 [(set_attr "length" "20")])
15580 (define_insn "rs6000_mftb_<mode>"
15581 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
15582 (unspec_volatile:P [(const_int 0)] UNSPECV_MFTB))]
15586 return "mfspr %0,268";
15592 (define_insn "rs6000_mffs"
15593 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
15594 (unspec_volatile:DF [(const_int 0)] UNSPECV_MFFS))]
15595 "TARGET_HARD_FLOAT && TARGET_FPRS"
15598 (define_insn "rs6000_mtfsf"
15599 [(unspec_volatile [(match_operand:SI 0 "const_int_operand" "i")
15600 (match_operand:DF 1 "gpc_reg_operand" "d")]
15602 "TARGET_HARD_FLOAT && TARGET_FPRS"
15606 ;; Power8 fusion support for fusing an addis instruction with a D-form load of
15607 ;; a GPR. The addis instruction must be adjacent to the load, and use the same
15608 ;; register that is being loaded. The fused ops must be physically adjacent.
15610 ;; We use define_peephole for the actual addis/load, and the register used to
15611 ;; hold the addis value must be the same as the register being loaded. We use
15612 ;; define_peephole2 to change the register used for addis to be the register
15613 ;; being loaded, since we can look at whether it is dead after the load insn.
15616 [(set (match_operand:P 0 "base_reg_operand" "")
15617 (match_operand:P 1 "fusion_gpr_addis" ""))
15618 (set (match_operand:INT1 2 "base_reg_operand" "")
15619 (match_operand:INT1 3 "fusion_gpr_mem_load" ""))]
15620 "TARGET_P8_FUSION && fusion_gpr_load_p (operands, false)"
15622 return emit_fusion_gpr_load (operands);
15624 [(set_attr "type" "load")
15625 (set_attr "length" "8")])
15628 [(set (match_operand:P 0 "base_reg_operand" "")
15629 (match_operand:P 1 "fusion_gpr_addis" ""))
15630 (set (match_operand:INT1 2 "base_reg_operand" "")
15631 (match_operand:INT1 3 "fusion_gpr_mem_load" ""))]
15633 && (REGNO (operands[0]) != REGNO (operands[2])
15634 || GET_CODE (operands[3]) == SIGN_EXTEND)
15635 && fusion_gpr_load_p (operands, true)"
15638 expand_fusion_gpr_load (operands);
15643 ;; Miscellaneous ISA 2.06 (power7) instructions
15644 (define_insn "addg6s"
15645 [(set (match_operand:SI 0 "register_operand" "=r")
15646 (unspec:SI [(match_operand:SI 1 "register_operand" "r")
15647 (match_operand:SI 2 "register_operand" "r")]
15651 [(set_attr "type" "integer")
15652 (set_attr "length" "4")])
15654 (define_insn "cdtbcd"
15655 [(set (match_operand:SI 0 "register_operand" "=r")
15656 (unspec:SI [(match_operand:SI 1 "register_operand" "r")]
15660 [(set_attr "type" "integer")
15661 (set_attr "length" "4")])
15663 (define_insn "cbcdtd"
15664 [(set (match_operand:SI 0 "register_operand" "=r")
15665 (unspec:SI [(match_operand:SI 1 "register_operand" "r")]
15669 [(set_attr "type" "integer")
15670 (set_attr "length" "4")])
15672 (define_int_iterator UNSPEC_DIV_EXTEND [UNSPEC_DIVE
15677 (define_int_attr div_extend [(UNSPEC_DIVE "e")
15678 (UNSPEC_DIVEO "eo")
15679 (UNSPEC_DIVEU "eu")
15680 (UNSPEC_DIVEUO "euo")])
15682 (define_insn "div<div_extend>_<mode>"
15683 [(set (match_operand:GPR 0 "register_operand" "=r")
15684 (unspec:GPR [(match_operand:GPR 1 "register_operand" "r")
15685 (match_operand:GPR 2 "register_operand" "r")]
15686 UNSPEC_DIV_EXTEND))]
15688 "div<wd><div_extend> %0,%1,%2"
15689 [(set_attr "type" "div")
15690 (set_attr "size" "<bits>")])
15693 ;; Pack/unpack 128-bit floating point types that take 2 scalar registers
15695 ; Type of the 64-bit part when packing/unpacking 128-bit floating point types
15696 (define_mode_attr FP128_64 [(TF "DF") (TD "DI")])
15698 (define_expand "unpack<mode>"
15699 [(set (match_operand:<FP128_64> 0 "nonimmediate_operand" "")
15701 [(match_operand:FMOVE128 1 "register_operand" "")
15702 (match_operand:QI 2 "const_0_to_1_operand" "")]
15703 UNSPEC_UNPACK_128BIT))]
15707 (define_insn_and_split "unpack<mode>_dm"
15708 [(set (match_operand:<FP128_64> 0 "nonimmediate_operand" "=d,m,d,r,m")
15710 [(match_operand:FMOVE128 1 "register_operand" "d,d,r,d,r")
15711 (match_operand:QI 2 "const_0_to_1_operand" "i,i,i,i,i")]
15712 UNSPEC_UNPACK_128BIT))]
15713 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
15715 "&& reload_completed"
15716 [(set (match_dup 0) (match_dup 3))]
15718 unsigned fp_regno = REGNO (operands[1]) + UINTVAL (operands[2]);
15720 if (REG_P (operands[0]) && REGNO (operands[0]) == fp_regno)
15722 emit_note (NOTE_INSN_DELETED);
15726 operands[3] = gen_rtx_REG (<FP128_64>mode, fp_regno);
15728 [(set_attr "type" "fp,fpstore,mffgpr,mftgpr,store")
15729 (set_attr "length" "4")])
15731 (define_insn_and_split "unpack<mode>_nodm"
15732 [(set (match_operand:<FP128_64> 0 "nonimmediate_operand" "=d,m")
15734 [(match_operand:FMOVE128 1 "register_operand" "d,d")
15735 (match_operand:QI 2 "const_0_to_1_operand" "i,i")]
15736 UNSPEC_UNPACK_128BIT))]
15737 "!TARGET_POWERPC64 || !TARGET_DIRECT_MOVE"
15739 "&& reload_completed"
15740 [(set (match_dup 0) (match_dup 3))]
15742 unsigned fp_regno = REGNO (operands[1]) + UINTVAL (operands[2]);
15744 if (REG_P (operands[0]) && REGNO (operands[0]) == fp_regno)
15746 emit_note (NOTE_INSN_DELETED);
15750 operands[3] = gen_rtx_REG (<FP128_64>mode, fp_regno);
15752 [(set_attr "type" "fp,fpstore")
15753 (set_attr "length" "4")])
15755 (define_insn_and_split "pack<mode>"
15756 [(set (match_operand:FMOVE128 0 "register_operand" "=d,&d")
15758 [(match_operand:<FP128_64> 1 "register_operand" "0,d")
15759 (match_operand:<FP128_64> 2 "register_operand" "d,d")]
15760 UNSPEC_PACK_128BIT))]
15765 "&& reload_completed && REGNO (operands[0]) != REGNO (operands[1])"
15766 [(set (match_dup 3) (match_dup 1))
15767 (set (match_dup 4) (match_dup 2))]
15769 unsigned dest_hi = REGNO (operands[0]);
15770 unsigned dest_lo = dest_hi + 1;
15772 gcc_assert (!IN_RANGE (REGNO (operands[1]), dest_hi, dest_lo));
15773 gcc_assert (!IN_RANGE (REGNO (operands[2]), dest_hi, dest_lo));
15775 operands[3] = gen_rtx_REG (<FP128_64>mode, dest_hi);
15776 operands[4] = gen_rtx_REG (<FP128_64>mode, dest_lo);
15778 [(set_attr "type" "fp,fp")
15779 (set_attr "length" "4,8")])
15781 (define_insn "unpackv1ti"
15782 [(set (match_operand:DI 0 "register_operand" "=d,d")
15783 (unspec:DI [(match_operand:V1TI 1 "register_operand" "0,wa")
15784 (match_operand:QI 2 "const_0_to_1_operand" "O,i")]
15785 UNSPEC_UNPACK_128BIT))]
15788 if (REGNO (operands[0]) == REGNO (operands[1]) && INTVAL (operands[2]) == 0)
15789 return ASM_COMMENT_START " xxpermdi to same register";
15791 operands[3] = GEN_INT (INTVAL (operands[2]) == 0 ? 0 : 3);
15792 return "xxpermdi %x0,%x1,%x1,%3";
15794 [(set_attr "type" "vecperm")
15795 (set_attr "length" "4")])
15797 (define_insn "packv1ti"
15798 [(set (match_operand:V1TI 0 "register_operand" "=wa")
15800 [(match_operand:DI 1 "register_operand" "d")
15801 (match_operand:DI 2 "register_operand" "d")]
15802 UNSPEC_PACK_128BIT))]
15804 "xxpermdi %x0,%x1,%x2,0"
15805 [(set_attr "type" "vecperm")
15806 (set_attr "length" "4")])
15810 (include "sync.md")
15811 (include "vector.md")
15813 (include "altivec.md")
15816 (include "paired.md")
15817 (include "crypto.md")