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 ;; Bitmask for shift instructions
442 (define_mode_attr hH [(SI "h") (DI "H")])
444 ;; Suffix for reload patterns
445 (define_mode_attr ptrsize [(SI "32bit")
448 (define_mode_attr tptrsize [(SI "TARGET_32BIT")
449 (DI "TARGET_64BIT")])
451 (define_mode_attr mptrsize [(SI "si")
454 (define_mode_attr ptrload [(SI "lwz")
457 (define_mode_attr ptrm [(SI "m")
460 (define_mode_attr rreg [(SF "f")
467 (define_mode_attr rreg2 [(SF "f")
470 (define_mode_attr SI_CONVERT_FP [(SF "TARGET_FCFIDS")
471 (DF "TARGET_FCFID")])
473 (define_mode_attr E500_CONVERT [(SF "!TARGET_FPRS")
474 (DF "TARGET_E500_DOUBLE")])
476 (define_mode_attr TARGET_FLOAT [(SF "TARGET_SINGLE_FLOAT")
477 (DF "TARGET_DOUBLE_FLOAT")])
479 ;; Mode iterator for logical operations on 128-bit types
480 (define_mode_iterator BOOL_128 [TI
482 (V16QI "TARGET_ALTIVEC")
483 (V8HI "TARGET_ALTIVEC")
484 (V4SI "TARGET_ALTIVEC")
485 (V4SF "TARGET_ALTIVEC")
486 (V2DI "TARGET_ALTIVEC")
487 (V2DF "TARGET_ALTIVEC")
488 (V1TI "TARGET_ALTIVEC")])
490 ;; For the GPRs we use 3 constraints for register outputs, two that are the
491 ;; same as the output register, and a third where the output register is an
492 ;; early clobber, so we don't have to deal with register overlaps. For the
493 ;; vector types, we prefer to use the vector registers. For TI mode, allow
496 ;; Mode attribute for boolean operation register constraints for output
497 (define_mode_attr BOOL_REGS_OUTPUT [(TI "&r,r,r,wa,v")
499 (V16QI "wa,v,&?r,?r,?r")
500 (V8HI "wa,v,&?r,?r,?r")
501 (V4SI "wa,v,&?r,?r,?r")
502 (V4SF "wa,v,&?r,?r,?r")
503 (V2DI "wa,v,&?r,?r,?r")
504 (V2DF "wa,v,&?r,?r,?r")
505 (V1TI "wa,v,&?r,?r,?r")])
507 ;; Mode attribute for boolean operation register constraints for operand1
508 (define_mode_attr BOOL_REGS_OP1 [(TI "r,0,r,wa,v")
516 (V1TI "wa,v,r,0,r")])
518 ;; Mode attribute for boolean operation register constraints for operand2
519 (define_mode_attr BOOL_REGS_OP2 [(TI "r,r,0,wa,v")
527 (V1TI "wa,v,r,r,0")])
529 ;; Mode attribute for boolean operation register constraints for operand1
530 ;; for one_cmpl. To simplify things, we repeat the constraint where 0
531 ;; is used for operand1 or operand2
532 (define_mode_attr BOOL_REGS_UNARY [(TI "r,0,0,wa,v")
540 (V1TI "wa,v,r,0,0")])
542 ;; Mode attribute for the clobber of CC0 for AND expansion.
543 ;; For the 128-bit types, we never do AND immediate, but we need to
544 ;; get the correct number of X's for the number of operands.
545 (define_mode_attr BOOL_REGS_AND_CR0 [(TI "X,X,X,X,X")
555 ;; Start with fixed-point load and store insns. Here we put only the more
556 ;; complex forms. Basic data transfer is done later.
558 (define_expand "zero_extend<mode>di2"
559 [(set (match_operand:DI 0 "gpc_reg_operand" "")
560 (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "")))]
564 (define_insn "*zero_extend<mode>di2_internal1"
565 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
566 (zero_extend:DI (match_operand:QHSI 1 "reg_or_mem_operand" "m,r")))]
567 "TARGET_POWERPC64 && (<MODE>mode != SImode || !TARGET_LFIWZX)"
570 rldicl %0,%1,0,<dbits>"
571 [(set_attr "type" "load,shift")])
573 (define_insn "*zero_extend<mode>di2_internal2"
574 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
575 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "r,r"))
577 (clobber (match_scratch:DI 2 "=r,r"))]
580 rldicl. %2,%1,0,<dbits>
582 [(set_attr "type" "shift")
583 (set_attr "dot" "yes")
584 (set_attr "length" "4,8")])
587 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
588 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" ""))
590 (clobber (match_scratch:DI 2 ""))]
591 "TARGET_POWERPC64 && reload_completed"
593 (zero_extend:DI (match_dup 1)))
595 (compare:CC (match_dup 2)
599 (define_insn "*zero_extend<mode>di2_internal3"
600 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
601 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "r,r"))
603 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
604 (zero_extend:DI (match_dup 1)))]
607 rldicl. %0,%1,0,<dbits>
609 [(set_attr "type" "shift")
610 (set_attr "dot" "yes")
611 (set_attr "length" "4,8")])
614 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
615 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" ""))
617 (set (match_operand:DI 0 "gpc_reg_operand" "")
618 (zero_extend:DI (match_dup 1)))]
619 "TARGET_POWERPC64 && reload_completed"
621 (zero_extend:DI (match_dup 1)))
623 (compare:CC (match_dup 0)
627 (define_insn "*zero_extendsidi2_lfiwzx"
628 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,??wm,!wz,!wu")
629 (zero_extend:DI (match_operand:SI 1 "reg_or_mem_operand" "m,r,r,Z,Z")))]
630 "TARGET_POWERPC64 && TARGET_LFIWZX"
637 [(set_attr "type" "load,shift,mffgpr,fpload,fpload")])
639 (define_insn "extendqidi2"
640 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
641 (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r")))]
644 [(set_attr "type" "exts")])
647 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
648 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
650 (clobber (match_scratch:DI 2 "=r,r"))]
655 [(set_attr "type" "compare")
656 (set_attr "length" "4,8")])
659 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
660 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
662 (clobber (match_scratch:DI 2 ""))]
663 "TARGET_POWERPC64 && reload_completed"
665 (sign_extend:DI (match_dup 1)))
667 (compare:CC (match_dup 2)
672 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
673 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
675 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
676 (sign_extend:DI (match_dup 1)))]
681 [(set_attr "type" "compare")
682 (set_attr "length" "4,8")])
685 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
686 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
688 (set (match_operand:DI 0 "gpc_reg_operand" "")
689 (sign_extend:DI (match_dup 1)))]
690 "TARGET_POWERPC64 && reload_completed"
692 (sign_extend:DI (match_dup 1)))
694 (compare:CC (match_dup 0)
698 (define_expand "extendhidi2"
699 [(set (match_operand:DI 0 "gpc_reg_operand" "")
700 (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "")))]
705 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
706 (sign_extend:DI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
707 "TARGET_POWERPC64 && rs6000_gen_cell_microcode"
711 [(set_attr "type" "load,exts")
712 (set_attr "sign_extend" "yes")])
715 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
716 (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r")))]
717 "TARGET_POWERPC64 && !rs6000_gen_cell_microcode"
719 [(set_attr "type" "exts")])
722 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
723 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
725 (clobber (match_scratch:DI 2 "=r,r"))]
730 [(set_attr "type" "compare")
731 (set_attr "length" "4,8")])
734 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
735 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
737 (clobber (match_scratch:DI 2 ""))]
738 "TARGET_POWERPC64 && reload_completed"
740 (sign_extend:DI (match_dup 1)))
742 (compare:CC (match_dup 2)
747 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
748 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
750 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
751 (sign_extend:DI (match_dup 1)))]
756 [(set_attr "type" "compare")
757 (set_attr "length" "4,8")])
760 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
761 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
763 (set (match_operand:DI 0 "gpc_reg_operand" "")
764 (sign_extend:DI (match_dup 1)))]
765 "TARGET_POWERPC64 && reload_completed"
767 (sign_extend:DI (match_dup 1)))
769 (compare:CC (match_dup 0)
773 (define_expand "extendsidi2"
774 [(set (match_operand:DI 0 "gpc_reg_operand" "")
775 (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")))]
779 (define_insn "*extendsidi2_lfiwax"
780 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,??wm,!wl,!wu")
781 (sign_extend:DI (match_operand:SI 1 "lwa_operand" "Y,r,r,Z,Z")))]
782 "TARGET_POWERPC64 && TARGET_LFIWAX"
789 [(set_attr "type" "load,exts,mffgpr,fpload,fpload")
790 (set_attr "sign_extend" "yes")])
792 (define_insn "*extendsidi2_nocell"
793 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
794 (sign_extend:DI (match_operand:SI 1 "lwa_operand" "Y,r")))]
795 "TARGET_POWERPC64 && rs6000_gen_cell_microcode && !TARGET_LFIWAX"
799 [(set_attr "type" "load,exts")
800 (set_attr "sign_extend" "yes")])
802 (define_insn "*extendsidi2_nocell"
803 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
804 (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r")))]
805 "TARGET_POWERPC64 && !rs6000_gen_cell_microcode"
807 [(set_attr "type" "exts")])
810 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
811 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
813 (clobber (match_scratch:DI 2 "=r,r"))]
818 [(set_attr "type" "compare")
819 (set_attr "length" "4,8")])
822 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
823 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
825 (clobber (match_scratch:DI 2 ""))]
826 "TARGET_POWERPC64 && reload_completed"
828 (sign_extend:DI (match_dup 1)))
830 (compare:CC (match_dup 2)
835 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
836 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
838 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
839 (sign_extend:DI (match_dup 1)))]
844 [(set_attr "type" "compare")
845 (set_attr "length" "4,8")])
848 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
849 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
851 (set (match_operand:DI 0 "gpc_reg_operand" "")
852 (sign_extend:DI (match_dup 1)))]
853 "TARGET_POWERPC64 && reload_completed"
855 (sign_extend:DI (match_dup 1)))
857 (compare:CC (match_dup 0)
861 (define_expand "zero_extendqisi2"
862 [(set (match_operand:SI 0 "gpc_reg_operand" "")
863 (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "")))]
868 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
869 (zero_extend:SI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
874 [(set_attr "type" "load,shift")])
877 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
878 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
880 (clobber (match_scratch:SI 2 "=r,r"))]
885 [(set_attr "type" "logical,compare")
886 (set_attr "dot" "yes")
887 (set_attr "length" "4,8")])
890 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
891 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
893 (clobber (match_scratch:SI 2 ""))]
896 (zero_extend:SI (match_dup 1)))
898 (compare:CC (match_dup 2)
903 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
904 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
906 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
907 (zero_extend:SI (match_dup 1)))]
912 [(set_attr "type" "logical,compare")
913 (set_attr "dot" "yes")
914 (set_attr "length" "4,8")])
917 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
918 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
920 (set (match_operand:SI 0 "gpc_reg_operand" "")
921 (zero_extend:SI (match_dup 1)))]
924 (zero_extend:SI (match_dup 1)))
926 (compare:CC (match_dup 0)
930 (define_insn "extendqisi2"
931 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
932 (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r")))]
935 [(set_attr "type" "exts")])
938 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
939 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
941 (clobber (match_scratch:SI 2 "=r,r"))]
946 [(set_attr "type" "compare")
947 (set_attr "length" "4,8")])
950 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
951 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
953 (clobber (match_scratch:SI 2 ""))]
956 (sign_extend:SI (match_dup 1)))
958 (compare:CC (match_dup 2)
963 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
964 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
966 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
967 (sign_extend:SI (match_dup 1)))]
972 [(set_attr "type" "compare")
973 (set_attr "length" "4,8")])
976 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
977 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
979 (set (match_operand:SI 0 "gpc_reg_operand" "")
980 (sign_extend:SI (match_dup 1)))]
983 (sign_extend:SI (match_dup 1)))
985 (compare:CC (match_dup 0)
990 [(set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
991 (zero_extend:HI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
996 [(set_attr "type" "load,shift")])
999 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1000 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
1002 (clobber (match_scratch:HI 2 "=r,r"))]
1007 [(set_attr "type" "logical,compare")
1008 (set_attr "dot" "yes")
1009 (set_attr "length" "4,8")])
1012 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
1013 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
1015 (clobber (match_scratch:HI 2 ""))]
1018 (zero_extend:HI (match_dup 1)))
1020 (compare:CC (match_dup 2)
1025 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1026 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
1028 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
1029 (zero_extend:HI (match_dup 1)))]
1034 [(set_attr "type" "logical,compare")
1035 (set_attr "dot" "yes")
1036 (set_attr "length" "4,8")])
1039 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
1040 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
1042 (set (match_operand:HI 0 "gpc_reg_operand" "")
1043 (zero_extend:HI (match_dup 1)))]
1046 (zero_extend:HI (match_dup 1)))
1048 (compare:CC (match_dup 0)
1052 (define_insn "extendqihi2"
1053 [(set (match_operand:HI 0 "gpc_reg_operand" "=r")
1054 (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r")))]
1057 [(set_attr "type" "exts")])
1060 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1061 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
1063 (clobber (match_scratch:HI 2 "=r,r"))]
1068 [(set_attr "type" "compare")
1069 (set_attr "length" "4,8")])
1072 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
1073 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
1075 (clobber (match_scratch:HI 2 ""))]
1078 (sign_extend:HI (match_dup 1)))
1080 (compare:CC (match_dup 2)
1085 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1086 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
1088 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
1089 (sign_extend:HI (match_dup 1)))]
1094 [(set_attr "type" "compare")
1095 (set_attr "length" "4,8")])
1098 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
1099 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
1101 (set (match_operand:HI 0 "gpc_reg_operand" "")
1102 (sign_extend:HI (match_dup 1)))]
1105 (sign_extend:HI (match_dup 1)))
1107 (compare:CC (match_dup 0)
1111 (define_expand "zero_extendhisi2"
1112 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1113 (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
1118 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1119 (zero_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
1123 rlwinm %0,%1,0,0xffff"
1124 [(set_attr "type" "load,shift")])
1127 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1128 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
1130 (clobber (match_scratch:SI 2 "=r,r"))]
1135 [(set_attr "type" "logical,compare")
1136 (set_attr "dot" "yes")
1137 (set_attr "length" "4,8")])
1140 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
1141 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1143 (clobber (match_scratch:SI 2 ""))]
1146 (zero_extend:SI (match_dup 1)))
1148 (compare:CC (match_dup 2)
1153 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1154 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
1156 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1157 (zero_extend:SI (match_dup 1)))]
1162 [(set_attr "type" "logical,compare")
1163 (set_attr "dot" "yes")
1164 (set_attr "length" "4,8")])
1167 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
1168 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1170 (set (match_operand:SI 0 "gpc_reg_operand" "")
1171 (zero_extend:SI (match_dup 1)))]
1174 (zero_extend:SI (match_dup 1)))
1176 (compare:CC (match_dup 0)
1180 (define_expand "extendhisi2"
1181 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1182 (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
1187 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1188 (sign_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
1189 "rs6000_gen_cell_microcode"
1193 [(set_attr "type" "load,exts")
1194 (set_attr "sign_extend" "yes")])
1197 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1198 (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r")))]
1199 "!rs6000_gen_cell_microcode"
1201 [(set_attr "type" "exts")])
1204 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1205 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
1207 (clobber (match_scratch:SI 2 "=r,r"))]
1212 [(set_attr "type" "compare")
1213 (set_attr "length" "4,8")])
1216 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
1217 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1219 (clobber (match_scratch:SI 2 ""))]
1222 (sign_extend:SI (match_dup 1)))
1224 (compare:CC (match_dup 2)
1229 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1230 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
1232 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1233 (sign_extend:SI (match_dup 1)))]
1238 [(set_attr "type" "compare")
1239 (set_attr "length" "4,8")])
1242 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
1243 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1245 (set (match_operand:SI 0 "gpc_reg_operand" "")
1246 (sign_extend:SI (match_dup 1)))]
1249 (sign_extend:SI (match_dup 1)))
1251 (compare:CC (match_dup 0)
1255 ;; IBM 405, 440, 464 and 476 half-word multiplication operations.
1257 (define_insn "*macchwc"
1258 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1259 (compare:CC (plus:SI (mult:SI (ashiftrt:SI
1260 (match_operand:SI 2 "gpc_reg_operand" "r")
1263 (match_operand:HI 1 "gpc_reg_operand" "r")))
1264 (match_operand:SI 4 "gpc_reg_operand" "0"))
1266 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1267 (plus:SI (mult:SI (ashiftrt:SI
1275 [(set_attr "type" "halfmul")])
1277 (define_insn "*macchw"
1278 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1279 (plus:SI (mult:SI (ashiftrt:SI
1280 (match_operand:SI 2 "gpc_reg_operand" "r")
1283 (match_operand:HI 1 "gpc_reg_operand" "r")))
1284 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1287 [(set_attr "type" "halfmul")])
1289 (define_insn "*macchwuc"
1290 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1291 (compare:CC (plus:SI (mult:SI (lshiftrt:SI
1292 (match_operand:SI 2 "gpc_reg_operand" "r")
1295 (match_operand:HI 1 "gpc_reg_operand" "r")))
1296 (match_operand:SI 4 "gpc_reg_operand" "0"))
1298 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1299 (plus:SI (mult:SI (lshiftrt:SI
1307 [(set_attr "type" "halfmul")])
1309 (define_insn "*macchwu"
1310 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1311 (plus:SI (mult:SI (lshiftrt:SI
1312 (match_operand:SI 2 "gpc_reg_operand" "r")
1315 (match_operand:HI 1 "gpc_reg_operand" "r")))
1316 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1319 [(set_attr "type" "halfmul")])
1321 (define_insn "*machhwc"
1322 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1323 (compare:CC (plus:SI (mult:SI (ashiftrt:SI
1324 (match_operand:SI 1 "gpc_reg_operand" "%r")
1327 (match_operand:SI 2 "gpc_reg_operand" "r")
1329 (match_operand:SI 4 "gpc_reg_operand" "0"))
1331 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1332 (plus:SI (mult:SI (ashiftrt:SI
1341 [(set_attr "type" "halfmul")])
1343 (define_insn "*machhw"
1344 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1345 (plus:SI (mult:SI (ashiftrt:SI
1346 (match_operand:SI 1 "gpc_reg_operand" "%r")
1349 (match_operand:SI 2 "gpc_reg_operand" "r")
1351 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1354 [(set_attr "type" "halfmul")])
1356 (define_insn "*machhwuc"
1357 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1358 (compare:CC (plus:SI (mult:SI (lshiftrt:SI
1359 (match_operand:SI 1 "gpc_reg_operand" "%r")
1362 (match_operand:SI 2 "gpc_reg_operand" "r")
1364 (match_operand:SI 4 "gpc_reg_operand" "0"))
1366 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1367 (plus:SI (mult:SI (lshiftrt:SI
1376 [(set_attr "type" "halfmul")])
1378 (define_insn "*machhwu"
1379 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1380 (plus:SI (mult:SI (lshiftrt:SI
1381 (match_operand:SI 1 "gpc_reg_operand" "%r")
1384 (match_operand:SI 2 "gpc_reg_operand" "r")
1386 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1389 [(set_attr "type" "halfmul")])
1391 (define_insn "*maclhwc"
1392 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1393 (compare:CC (plus:SI (mult:SI (sign_extend:SI
1394 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1396 (match_operand:HI 2 "gpc_reg_operand" "r")))
1397 (match_operand:SI 4 "gpc_reg_operand" "0"))
1399 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1400 (plus:SI (mult:SI (sign_extend:SI
1407 [(set_attr "type" "halfmul")])
1409 (define_insn "*maclhw"
1410 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1411 (plus:SI (mult:SI (sign_extend:SI
1412 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1414 (match_operand:HI 2 "gpc_reg_operand" "r")))
1415 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1418 [(set_attr "type" "halfmul")])
1420 (define_insn "*maclhwuc"
1421 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1422 (compare:CC (plus:SI (mult:SI (zero_extend:SI
1423 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1425 (match_operand:HI 2 "gpc_reg_operand" "r")))
1426 (match_operand:SI 4 "gpc_reg_operand" "0"))
1428 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1429 (plus:SI (mult:SI (zero_extend:SI
1436 [(set_attr "type" "halfmul")])
1438 (define_insn "*maclhwu"
1439 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1440 (plus:SI (mult:SI (zero_extend:SI
1441 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1443 (match_operand:HI 2 "gpc_reg_operand" "r")))
1444 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1447 [(set_attr "type" "halfmul")])
1449 (define_insn "*nmacchwc"
1450 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1451 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1452 (mult:SI (ashiftrt:SI
1453 (match_operand:SI 2 "gpc_reg_operand" "r")
1456 (match_operand:HI 1 "gpc_reg_operand" "r"))))
1458 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1459 (minus:SI (match_dup 4)
1460 (mult:SI (ashiftrt:SI
1467 [(set_attr "type" "halfmul")])
1469 (define_insn "*nmacchw"
1470 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1471 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1472 (mult:SI (ashiftrt:SI
1473 (match_operand:SI 2 "gpc_reg_operand" "r")
1476 (match_operand:HI 1 "gpc_reg_operand" "r")))))]
1479 [(set_attr "type" "halfmul")])
1481 (define_insn "*nmachhwc"
1482 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1483 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1484 (mult:SI (ashiftrt:SI
1485 (match_operand:SI 1 "gpc_reg_operand" "%r")
1488 (match_operand:SI 2 "gpc_reg_operand" "r")
1491 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1492 (minus:SI (match_dup 4)
1493 (mult:SI (ashiftrt:SI
1501 [(set_attr "type" "halfmul")])
1503 (define_insn "*nmachhw"
1504 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1505 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1506 (mult:SI (ashiftrt:SI
1507 (match_operand:SI 1 "gpc_reg_operand" "%r")
1510 (match_operand:SI 2 "gpc_reg_operand" "r")
1514 [(set_attr "type" "halfmul")])
1516 (define_insn "*nmaclhwc"
1517 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1518 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1519 (mult:SI (sign_extend:SI
1520 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1522 (match_operand:HI 2 "gpc_reg_operand" "r"))))
1524 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1525 (minus:SI (match_dup 4)
1526 (mult:SI (sign_extend:SI
1532 [(set_attr "type" "halfmul")])
1534 (define_insn "*nmaclhw"
1535 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1536 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1537 (mult:SI (sign_extend:SI
1538 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1540 (match_operand:HI 2 "gpc_reg_operand" "r")))))]
1543 [(set_attr "type" "halfmul")])
1545 (define_insn "*mulchwc"
1546 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1547 (compare:CC (mult:SI (ashiftrt:SI
1548 (match_operand:SI 2 "gpc_reg_operand" "r")
1551 (match_operand:HI 1 "gpc_reg_operand" "r")))
1553 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1554 (mult:SI (ashiftrt:SI
1561 [(set_attr "type" "halfmul")])
1563 (define_insn "*mulchw"
1564 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1565 (mult:SI (ashiftrt:SI
1566 (match_operand:SI 2 "gpc_reg_operand" "r")
1569 (match_operand:HI 1 "gpc_reg_operand" "r"))))]
1572 [(set_attr "type" "halfmul")])
1574 (define_insn "*mulchwuc"
1575 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1576 (compare:CC (mult:SI (lshiftrt:SI
1577 (match_operand:SI 2 "gpc_reg_operand" "r")
1580 (match_operand:HI 1 "gpc_reg_operand" "r")))
1582 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1583 (mult:SI (lshiftrt:SI
1590 [(set_attr "type" "halfmul")])
1592 (define_insn "*mulchwu"
1593 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1594 (mult:SI (lshiftrt:SI
1595 (match_operand:SI 2 "gpc_reg_operand" "r")
1598 (match_operand:HI 1 "gpc_reg_operand" "r"))))]
1601 [(set_attr "type" "halfmul")])
1603 (define_insn "*mulhhwc"
1604 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1605 (compare:CC (mult:SI (ashiftrt:SI
1606 (match_operand:SI 1 "gpc_reg_operand" "%r")
1609 (match_operand:SI 2 "gpc_reg_operand" "r")
1612 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1613 (mult:SI (ashiftrt:SI
1621 [(set_attr "type" "halfmul")])
1623 (define_insn "*mulhhw"
1624 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1625 (mult:SI (ashiftrt:SI
1626 (match_operand:SI 1 "gpc_reg_operand" "%r")
1629 (match_operand:SI 2 "gpc_reg_operand" "r")
1633 [(set_attr "type" "halfmul")])
1635 (define_insn "*mulhhwuc"
1636 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1637 (compare:CC (mult:SI (lshiftrt:SI
1638 (match_operand:SI 1 "gpc_reg_operand" "%r")
1641 (match_operand:SI 2 "gpc_reg_operand" "r")
1644 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1645 (mult:SI (lshiftrt:SI
1653 [(set_attr "type" "halfmul")])
1655 (define_insn "*mulhhwu"
1656 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1657 (mult:SI (lshiftrt:SI
1658 (match_operand:SI 1 "gpc_reg_operand" "%r")
1661 (match_operand:SI 2 "gpc_reg_operand" "r")
1665 [(set_attr "type" "halfmul")])
1667 (define_insn "*mullhwc"
1668 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1669 (compare:CC (mult:SI (sign_extend:SI
1670 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1672 (match_operand:HI 2 "gpc_reg_operand" "r")))
1674 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1675 (mult:SI (sign_extend:SI
1681 [(set_attr "type" "halfmul")])
1683 (define_insn "*mullhw"
1684 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1685 (mult:SI (sign_extend:SI
1686 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1688 (match_operand:HI 2 "gpc_reg_operand" "r"))))]
1691 [(set_attr "type" "halfmul")])
1693 (define_insn "*mullhwuc"
1694 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1695 (compare:CC (mult:SI (zero_extend:SI
1696 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1698 (match_operand:HI 2 "gpc_reg_operand" "r")))
1700 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1701 (mult:SI (zero_extend:SI
1707 [(set_attr "type" "halfmul")])
1709 (define_insn "*mullhwu"
1710 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1711 (mult:SI (zero_extend:SI
1712 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1714 (match_operand:HI 2 "gpc_reg_operand" "r"))))]
1717 [(set_attr "type" "halfmul")])
1719 ;; IBM 405, 440, 464 and 476 string-search dlmzb instruction support.
1720 (define_insn "dlmzb"
1721 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1722 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
1723 (match_operand:SI 2 "gpc_reg_operand" "r")]
1725 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1726 (unspec:SI [(match_dup 1)
1732 (define_expand "strlensi"
1733 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1734 (unspec:SI [(match_operand:BLK 1 "general_operand" "")
1735 (match_operand:QI 2 "const_int_operand" "")
1736 (match_operand 3 "const_int_operand" "")]
1737 UNSPEC_DLMZB_STRLEN))
1738 (clobber (match_scratch:CC 4 "=x"))]
1739 "TARGET_DLMZB && WORDS_BIG_ENDIAN && !optimize_size"
1741 rtx result = operands[0];
1742 rtx src = operands[1];
1743 rtx search_char = operands[2];
1744 rtx align = operands[3];
1745 rtx addr, scratch_string, word1, word2, scratch_dlmzb;
1746 rtx loop_label, end_label, mem, cr0, cond;
1747 if (search_char != const0_rtx
1748 || GET_CODE (align) != CONST_INT
1749 || INTVAL (align) < 8)
1751 word1 = gen_reg_rtx (SImode);
1752 word2 = gen_reg_rtx (SImode);
1753 scratch_dlmzb = gen_reg_rtx (SImode);
1754 scratch_string = gen_reg_rtx (Pmode);
1755 loop_label = gen_label_rtx ();
1756 end_label = gen_label_rtx ();
1757 addr = force_reg (Pmode, XEXP (src, 0));
1758 emit_move_insn (scratch_string, addr);
1759 emit_label (loop_label);
1760 mem = change_address (src, SImode, scratch_string);
1761 emit_move_insn (word1, mem);
1762 emit_move_insn (word2, adjust_address (mem, SImode, 4));
1763 cr0 = gen_rtx_REG (CCmode, CR0_REGNO);
1764 emit_insn (gen_dlmzb (scratch_dlmzb, word1, word2, cr0));
1765 cond = gen_rtx_NE (VOIDmode, cr0, const0_rtx);
1766 emit_jump_insn (gen_rtx_SET (VOIDmode,
1768 gen_rtx_IF_THEN_ELSE (VOIDmode,
1774 emit_insn (gen_addsi3 (scratch_string, scratch_string, GEN_INT (8)));
1775 emit_jump_insn (gen_rtx_SET (VOIDmode,
1777 gen_rtx_LABEL_REF (VOIDmode, loop_label)));
1779 emit_label (end_label);
1780 emit_insn (gen_addsi3 (scratch_string, scratch_string, scratch_dlmzb));
1781 emit_insn (gen_subsi3 (result, scratch_string, addr));
1782 emit_insn (gen_subsi3 (result, result, const1_rtx));
1786 ;; Fixed-point arithmetic insns.
1788 (define_expand "add<mode>3"
1789 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1790 (plus:SDI (match_operand:SDI 1 "gpc_reg_operand" "")
1791 (match_operand:SDI 2 "reg_or_add_cint_operand" "")))]
1794 if (<MODE>mode == DImode && ! TARGET_POWERPC64)
1796 if (non_short_cint_operand (operands[2], DImode))
1799 else if (GET_CODE (operands[2]) == CONST_INT
1800 && ! add_operand (operands[2], <MODE>mode))
1802 rtx tmp = ((!can_create_pseudo_p ()
1803 || rtx_equal_p (operands[0], operands[1]))
1804 ? operands[0] : gen_reg_rtx (<MODE>mode));
1806 HOST_WIDE_INT val = INTVAL (operands[2]);
1807 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1808 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, <MODE>mode);
1810 if (<MODE>mode == DImode && !satisfies_constraint_L (GEN_INT (rest)))
1813 /* The ordering here is important for the prolog expander.
1814 When space is allocated from the stack, adding 'low' first may
1815 produce a temporary deallocation (which would be bad). */
1816 emit_insn (gen_add<mode>3 (tmp, operands[1], GEN_INT (rest)));
1817 emit_insn (gen_add<mode>3 (operands[0], tmp, GEN_INT (low)));
1822 ;; Discourage ai/addic because of carry but provide it in an alternative
1823 ;; allowing register zero as source.
1824 (define_insn "*add<mode>3_internal1"
1825 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r,?r,r")
1826 (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "%r,b,r,b")
1827 (match_operand:GPR 2 "add_operand" "r,I,I,L")))]
1828 "!DECIMAL_FLOAT_MODE_P (GET_MODE (operands[0])) && !DECIMAL_FLOAT_MODE_P (GET_MODE (operands[1]))"
1834 [(set_attr "type" "add")])
1836 (define_insn "addsi3_high"
1837 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
1838 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
1839 (high:SI (match_operand 2 "" ""))))]
1840 "TARGET_MACHO && !TARGET_64BIT"
1841 "addis %0,%1,ha16(%2)"
1842 [(set_attr "type" "add")])
1844 (define_insn "*add<mode>3_internal2"
1845 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
1846 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "%r,r,r,r")
1847 (match_operand:P 2 "reg_or_short_operand" "r,I,r,I"))
1849 (clobber (match_scratch:P 3 "=r,r,r,r"))]
1856 [(set_attr "type" "add,compare,compare,compare")
1857 (set_attr "dot" "yes")
1858 (set_attr "length" "4,4,8,8")])
1861 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1862 (compare:CC (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1863 (match_operand:GPR 2 "reg_or_short_operand" ""))
1865 (clobber (match_scratch:GPR 3 ""))]
1868 (plus:GPR (match_dup 1)
1871 (compare:CC (match_dup 3)
1875 (define_insn "*add<mode>3_internal3"
1876 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
1877 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "%r,r,r,r")
1878 (match_operand:P 2 "reg_or_short_operand" "r,I,r,I"))
1880 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
1881 (plus:P (match_dup 1)
1889 [(set_attr "type" "add,compare,compare,compare")
1890 (set_attr "dot" "yes")
1891 (set_attr "length" "4,4,8,8")])
1894 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1895 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "")
1896 (match_operand:P 2 "reg_or_short_operand" ""))
1898 (set (match_operand:P 0 "gpc_reg_operand" "")
1899 (plus:P (match_dup 1) (match_dup 2)))]
1902 (plus:P (match_dup 1)
1905 (compare:CC (match_dup 0)
1909 ;; Split an add that we can't do in one insn into two insns, each of which
1910 ;; does one 16-bit part. This is used by combine. Note that the low-order
1911 ;; add should be last in case the result gets used in an address.
1914 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
1915 (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1916 (match_operand:GPR 2 "non_add_cint_operand" "")))]
1918 [(set (match_dup 0) (plus:GPR (match_dup 1) (match_dup 3)))
1919 (set (match_dup 0) (plus:GPR (match_dup 0) (match_dup 4)))]
1921 HOST_WIDE_INT val = INTVAL (operands[2]);
1922 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1923 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, <MODE>mode);
1925 operands[4] = GEN_INT (low);
1926 if (<MODE>mode == SImode || satisfies_constraint_L (GEN_INT (rest)))
1927 operands[3] = GEN_INT (rest);
1928 else if (can_create_pseudo_p ())
1930 operands[3] = gen_reg_rtx (DImode);
1931 emit_move_insn (operands[3], operands[2]);
1932 emit_insn (gen_adddi3 (operands[0], operands[1], operands[3]));
1939 (define_expand "one_cmpl<mode>2"
1940 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1941 (not:SDI (match_operand:SDI 1 "gpc_reg_operand" "")))]
1944 if (<MODE>mode == DImode && !TARGET_POWERPC64)
1946 rs6000_split_logical (operands, NOT, false, false, false, NULL_RTX);
1951 (define_insn "*one_cmpl<mode>2"
1952 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1953 (not:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
1958 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1959 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1961 (clobber (match_scratch:P 2 "=r,r"))]
1966 [(set_attr "type" "logical,compare")
1967 (set_attr "dot" "yes")
1968 (set_attr "length" "4,8")])
1971 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
1972 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" ""))
1974 (clobber (match_scratch:P 2 ""))]
1977 (not:P (match_dup 1)))
1979 (compare:CC (match_dup 2)
1984 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1985 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1987 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
1988 (not:P (match_dup 1)))]
1993 [(set_attr "type" "logical,compare")
1994 (set_attr "dot" "yes")
1995 (set_attr "length" "4,8")])
1998 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
1999 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" ""))
2001 (set (match_operand:P 0 "gpc_reg_operand" "")
2002 (not:P (match_dup 1)))]
2005 (not:P (match_dup 1)))
2007 (compare:CC (match_dup 0)
2012 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
2013 (minus:GPR (match_operand:GPR 1 "reg_or_short_operand" "r,I")
2014 (match_operand:GPR 2 "gpc_reg_operand" "r,r")))]
2019 [(set_attr "type" "add")])
2022 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2023 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "r,r")
2024 (match_operand:P 2 "gpc_reg_operand" "r,r"))
2026 (clobber (match_scratch:P 3 "=r,r"))]
2031 [(set_attr "type" "add")
2032 (set_attr "dot" "yes")
2033 (set_attr "length" "4,8")])
2036 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2037 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "")
2038 (match_operand:P 2 "gpc_reg_operand" ""))
2040 (clobber (match_scratch:P 3 ""))]
2043 (minus:P (match_dup 1)
2046 (compare:CC (match_dup 3)
2051 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2052 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "r,r")
2053 (match_operand:P 2 "gpc_reg_operand" "r,r"))
2055 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
2056 (minus:P (match_dup 1)
2062 [(set_attr "type" "add")
2063 (set_attr "dot" "yes")
2064 (set_attr "length" "4,8")])
2067 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2068 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "")
2069 (match_operand:P 2 "gpc_reg_operand" ""))
2071 (set (match_operand:P 0 "gpc_reg_operand" "")
2072 (minus:P (match_dup 1)
2076 (minus:P (match_dup 1)
2079 (compare:CC (match_dup 0)
2083 (define_expand "sub<mode>3"
2084 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
2085 (minus:SDI (match_operand:SDI 1 "reg_or_short_operand" "")
2086 (match_operand:SDI 2 "reg_or_sub_cint_operand" "")))]
2090 if (GET_CODE (operands[2]) == CONST_INT)
2092 emit_insn (gen_add<mode>3 (operands[0], operands[1],
2093 negate_rtx (<MODE>mode, operands[2])));
2098 (define_expand "neg<mode>2"
2099 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
2100 (neg:SDI (match_operand:SDI 1 "gpc_reg_operand" "")))]
2104 (define_insn "*neg<mode>2_internal"
2105 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2106 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
2109 [(set_attr "type" "add")])
2112 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2113 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
2115 (clobber (match_scratch:P 2 "=r,r"))]
2120 [(set_attr "type" "add")
2121 (set_attr "dot" "yes")
2122 (set_attr "length" "4,8")])
2125 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2126 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" ""))
2128 (clobber (match_scratch:P 2 ""))]
2131 (neg:P (match_dup 1)))
2133 (compare:CC (match_dup 2)
2138 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
2139 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
2141 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
2142 (neg:P (match_dup 1)))]
2147 [(set_attr "type" "add")
2148 (set_attr "dot" "yes")
2149 (set_attr "length" "4,8")])
2152 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
2153 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" ""))
2155 (set (match_operand:P 0 "gpc_reg_operand" "")
2156 (neg:P (match_dup 1)))]
2159 (neg:P (match_dup 1)))
2161 (compare:CC (match_dup 0)
2165 (define_insn "clz<mode>2"
2166 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2167 (clz:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
2170 [(set_attr "type" "cntlz")])
2172 (define_expand "ctz<mode>2"
2174 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))
2175 (parallel [(set (match_dup 3) (and:GPR (match_dup 1)
2177 (clobber (scratch:CC))])
2178 (set (match_dup 4) (clz:GPR (match_dup 3)))
2179 (set (match_operand:GPR 0 "gpc_reg_operand" "")
2180 (minus:GPR (match_dup 5) (match_dup 4)))]
2183 operands[2] = gen_reg_rtx (<MODE>mode);
2184 operands[3] = gen_reg_rtx (<MODE>mode);
2185 operands[4] = gen_reg_rtx (<MODE>mode);
2186 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode) - 1);
2189 (define_expand "ffs<mode>2"
2191 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))
2192 (parallel [(set (match_dup 3) (and:GPR (match_dup 1)
2194 (clobber (scratch:CC))])
2195 (set (match_dup 4) (clz:GPR (match_dup 3)))
2196 (set (match_operand:GPR 0 "gpc_reg_operand" "")
2197 (minus:GPR (match_dup 5) (match_dup 4)))]
2200 operands[2] = gen_reg_rtx (<MODE>mode);
2201 operands[3] = gen_reg_rtx (<MODE>mode);
2202 operands[4] = gen_reg_rtx (<MODE>mode);
2203 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode));
2206 (define_insn "popcntb<mode>2"
2207 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2208 (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")]
2212 [(set_attr "length" "4")
2213 (set_attr "type" "popcnt")])
2215 (define_insn "popcntd<mode>2"
2216 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2217 (popcount:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
2220 [(set_attr "length" "4")
2221 (set_attr "type" "popcnt")])
2223 (define_expand "popcount<mode>2"
2224 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2225 (popcount:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))]
2226 "TARGET_POPCNTB || TARGET_POPCNTD"
2228 rs6000_emit_popcount (operands[0], operands[1]);
2232 (define_insn "parity<mode>2_cmpb"
2233 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2234 (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")] UNSPEC_PARITY))]
2235 "TARGET_CMPB && TARGET_POPCNTB"
2237 [(set_attr "length" "4")
2238 (set_attr "type" "popcnt")])
2240 (define_expand "parity<mode>2"
2241 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2242 (parity:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))]
2245 rs6000_emit_parity (operands[0], operands[1]);
2249 ;; Since the hardware zeros the upper part of the register, save generating the
2250 ;; AND immediate if we are converting to unsigned
2251 (define_insn "*bswaphi2_extenddi"
2252 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
2254 (bswap:HI (match_operand:HI 1 "memory_operand" "Z"))))]
2257 [(set_attr "length" "4")
2258 (set_attr "type" "load")])
2260 (define_insn "*bswaphi2_extendsi"
2261 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2263 (bswap:HI (match_operand:HI 1 "memory_operand" "Z"))))]
2266 [(set_attr "length" "4")
2267 (set_attr "type" "load")])
2269 (define_expand "bswaphi2"
2270 [(parallel [(set (match_operand:HI 0 "reg_or_mem_operand" "")
2272 (match_operand:HI 1 "reg_or_mem_operand" "")))
2273 (clobber (match_scratch:SI 2 ""))])]
2276 if (!REG_P (operands[0]) && !REG_P (operands[1]))
2277 operands[1] = force_reg (HImode, operands[1]);
2280 (define_insn "bswaphi2_internal"
2281 [(set (match_operand:HI 0 "reg_or_mem_operand" "=r,Z,&r")
2283 (match_operand:HI 1 "reg_or_mem_operand" "Z,r,r")))
2284 (clobber (match_scratch:SI 2 "=X,X,&r"))]
2290 [(set_attr "length" "4,4,12")
2291 (set_attr "type" "load,store,*")])
2293 ;; We are always BITS_BIG_ENDIAN, so the (const_int 16) below is
2294 ;; correct for -mlittle as well as -mbig.
2296 [(set (match_operand:HI 0 "gpc_reg_operand" "")
2297 (bswap:HI (match_operand:HI 1 "gpc_reg_operand" "")))
2298 (clobber (match_operand:SI 2 "gpc_reg_operand" ""))]
2301 (zero_extract:SI (match_dup 4)
2305 (and:SI (ashift:SI (match_dup 4)
2307 (const_int 65280))) ;; 0xff00
2309 (ior:SI (match_dup 3)
2313 operands[3] = simplify_gen_subreg (SImode, operands[0], HImode, 0);
2314 operands[4] = simplify_gen_subreg (SImode, operands[1], HImode, 0);
2317 (define_insn "*bswapsi2_extenddi"
2318 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
2320 (bswap:SI (match_operand:SI 1 "memory_operand" "Z"))))]
2323 [(set_attr "length" "4")
2324 (set_attr "type" "load")])
2326 (define_expand "bswapsi2"
2327 [(set (match_operand:SI 0 "reg_or_mem_operand" "")
2329 (match_operand:SI 1 "reg_or_mem_operand" "")))]
2332 if (!REG_P (operands[0]) && !REG_P (operands[1]))
2333 operands[1] = force_reg (SImode, operands[1]);
2336 (define_insn "*bswapsi2_internal"
2337 [(set (match_operand:SI 0 "reg_or_mem_operand" "=r,Z,&r")
2339 (match_operand:SI 1 "reg_or_mem_operand" "Z,r,r")))]
2345 [(set_attr "length" "4,4,12")
2346 (set_attr "type" "load,store,*")])
2348 ;; We are always BITS_BIG_ENDIAN, so the bit positions below in
2349 ;; zero_extract insns do not change for -mlittle.
2351 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2352 (bswap:SI (match_operand:SI 1 "gpc_reg_operand" "")))]
2355 (rotate:SI (match_dup 1) (const_int 8)))
2356 (set (zero_extract:SI (match_dup 0)
2360 (set (zero_extract:SI (match_dup 0)
2363 (rotate:SI (match_dup 1)
2367 (define_expand "bswapdi2"
2368 [(parallel [(set (match_operand:DI 0 "reg_or_mem_operand" "")
2370 (match_operand:DI 1 "reg_or_mem_operand" "")))
2371 (clobber (match_scratch:DI 2 ""))
2372 (clobber (match_scratch:DI 3 ""))
2373 (clobber (match_scratch:DI 4 ""))])]
2376 if (!REG_P (operands[0]) && !REG_P (operands[1]))
2377 operands[1] = force_reg (DImode, operands[1]);
2379 if (!TARGET_POWERPC64)
2381 /* 32-bit mode needs fewer scratch registers, but 32-bit addressing mode
2382 that uses 64-bit registers needs the same scratch registers as 64-bit
2384 emit_insn (gen_bswapdi2_32bit (operands[0], operands[1]));
2389 ;; Power7/cell has ldbrx/stdbrx, so use it directly
2390 (define_insn "*bswapdi2_ldbrx"
2391 [(set (match_operand:DI 0 "reg_or_mem_operand" "=&r,Z,??&r")
2392 (bswap:DI (match_operand:DI 1 "reg_or_mem_operand" "Z,r,r")))
2393 (clobber (match_scratch:DI 2 "=X,X,&r"))
2394 (clobber (match_scratch:DI 3 "=X,X,&r"))
2395 (clobber (match_scratch:DI 4 "=X,X,&r"))]
2396 "TARGET_POWERPC64 && TARGET_LDBRX
2397 && (REG_P (operands[0]) || REG_P (operands[1]))"
2402 [(set_attr "length" "4,4,36")
2403 (set_attr "type" "load,store,*")])
2405 ;; Non-power7/cell, fall back to use lwbrx/stwbrx
2406 (define_insn "*bswapdi2_64bit"
2407 [(set (match_operand:DI 0 "reg_or_mem_operand" "=&r,Z,&r")
2408 (bswap:DI (match_operand:DI 1 "reg_or_mem_operand" "Z,r,r")))
2409 (clobber (match_scratch:DI 2 "=&b,&b,&r"))
2410 (clobber (match_scratch:DI 3 "=&r,&r,&r"))
2411 (clobber (match_scratch:DI 4 "=&r,X,&r"))]
2412 "TARGET_POWERPC64 && !TARGET_LDBRX
2413 && (REG_P (operands[0]) || REG_P (operands[1]))
2414 && !(MEM_P (operands[0]) && MEM_VOLATILE_P (operands[0]))
2415 && !(MEM_P (operands[1]) && MEM_VOLATILE_P (operands[1]))"
2417 [(set_attr "length" "16,12,36")])
2420 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2421 (bswap:DI (match_operand:DI 1 "indexed_or_indirect_operand" "")))
2422 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
2423 (clobber (match_operand:DI 3 "gpc_reg_operand" ""))
2424 (clobber (match_operand:DI 4 "gpc_reg_operand" ""))]
2425 "TARGET_POWERPC64 && !TARGET_LDBRX && reload_completed"
2429 rtx dest = operands[0];
2430 rtx src = operands[1];
2431 rtx op2 = operands[2];
2432 rtx op3 = operands[3];
2433 rtx op4 = operands[4];
2434 rtx op3_32 = simplify_gen_subreg (SImode, op3, DImode,
2435 BYTES_BIG_ENDIAN ? 4 : 0);
2436 rtx op4_32 = simplify_gen_subreg (SImode, op4, DImode,
2437 BYTES_BIG_ENDIAN ? 4 : 0);
2443 addr1 = XEXP (src, 0);
2444 if (GET_CODE (addr1) == PLUS)
2446 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2447 if (TARGET_AVOID_XFORM)
2449 emit_insn (gen_add3_insn (op2, XEXP (addr1, 1), op2));
2453 addr2 = gen_rtx_PLUS (Pmode, op2, XEXP (addr1, 1));
2455 else if (TARGET_AVOID_XFORM)
2457 emit_insn (gen_add3_insn (op2, addr1, GEN_INT (4)));
2462 emit_move_insn (op2, GEN_INT (4));
2463 addr2 = gen_rtx_PLUS (Pmode, op2, addr1);
2466 if (BYTES_BIG_ENDIAN)
2468 word_high = change_address (src, SImode, addr1);
2469 word_low = change_address (src, SImode, addr2);
2473 word_high = change_address (src, SImode, addr2);
2474 word_low = change_address (src, SImode, addr1);
2477 emit_insn (gen_bswapsi2 (op3_32, word_low));
2478 emit_insn (gen_bswapsi2 (op4_32, word_high));
2479 emit_insn (gen_ashldi3 (dest, op3, GEN_INT (32)));
2480 emit_insn (gen_iordi3 (dest, dest, op4));
2485 [(set (match_operand:DI 0 "indexed_or_indirect_operand" "")
2486 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2487 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
2488 (clobber (match_operand:DI 3 "gpc_reg_operand" ""))
2489 (clobber (match_operand:DI 4 "" ""))]
2490 "TARGET_POWERPC64 && !TARGET_LDBRX && reload_completed"
2494 rtx dest = operands[0];
2495 rtx src = operands[1];
2496 rtx op2 = operands[2];
2497 rtx op3 = operands[3];
2498 rtx src_si = simplify_gen_subreg (SImode, src, DImode,
2499 BYTES_BIG_ENDIAN ? 4 : 0);
2500 rtx op3_si = simplify_gen_subreg (SImode, op3, DImode,
2501 BYTES_BIG_ENDIAN ? 4 : 0);
2507 addr1 = XEXP (dest, 0);
2508 if (GET_CODE (addr1) == PLUS)
2510 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2511 if (TARGET_AVOID_XFORM)
2513 emit_insn (gen_add3_insn (op2, XEXP (addr1, 1), op2));
2517 addr2 = gen_rtx_PLUS (Pmode, op2, XEXP (addr1, 1));
2519 else if (TARGET_AVOID_XFORM)
2521 emit_insn (gen_add3_insn (op2, addr1, GEN_INT (4)));
2526 emit_move_insn (op2, GEN_INT (4));
2527 addr2 = gen_rtx_PLUS (Pmode, op2, addr1);
2530 emit_insn (gen_lshrdi3 (op3, src, GEN_INT (32)));
2531 if (BYTES_BIG_ENDIAN)
2533 word_high = change_address (dest, SImode, addr1);
2534 word_low = change_address (dest, SImode, addr2);
2538 word_high = change_address (dest, SImode, addr2);
2539 word_low = change_address (dest, SImode, addr1);
2541 emit_insn (gen_bswapsi2 (word_high, src_si));
2542 emit_insn (gen_bswapsi2 (word_low, op3_si));
2547 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2548 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2549 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
2550 (clobber (match_operand:DI 3 "gpc_reg_operand" ""))
2551 (clobber (match_operand:DI 4 "" ""))]
2552 "TARGET_POWERPC64 && reload_completed"
2556 rtx dest = operands[0];
2557 rtx src = operands[1];
2558 rtx op2 = operands[2];
2559 rtx op3 = operands[3];
2560 int lo_off = BYTES_BIG_ENDIAN ? 4 : 0;
2561 rtx dest_si = simplify_gen_subreg (SImode, dest, DImode, lo_off);
2562 rtx src_si = simplify_gen_subreg (SImode, src, DImode, lo_off);
2563 rtx op2_si = simplify_gen_subreg (SImode, op2, DImode, lo_off);
2564 rtx op3_si = simplify_gen_subreg (SImode, op3, DImode, lo_off);
2566 emit_insn (gen_lshrdi3 (op2, src, GEN_INT (32)));
2567 emit_insn (gen_bswapsi2 (dest_si, src_si));
2568 emit_insn (gen_bswapsi2 (op3_si, op2_si));
2569 emit_insn (gen_ashldi3 (dest, dest, GEN_INT (32)));
2570 emit_insn (gen_iordi3 (dest, dest, op3));
2574 (define_insn "bswapdi2_32bit"
2575 [(set (match_operand:DI 0 "reg_or_mem_operand" "=&r,Z,&r")
2576 (bswap:DI (match_operand:DI 1 "reg_or_mem_operand" "Z,r,r")))
2577 (clobber (match_scratch:SI 2 "=&b,&b,X"))]
2578 "!TARGET_POWERPC64 && (REG_P (operands[0]) || REG_P (operands[1]))"
2580 [(set_attr "length" "16,12,36")])
2583 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2584 (bswap:DI (match_operand:DI 1 "indexed_or_indirect_operand" "")))
2585 (clobber (match_operand:SI 2 "gpc_reg_operand" ""))]
2586 "!TARGET_POWERPC64 && reload_completed"
2590 rtx dest = operands[0];
2591 rtx src = operands[1];
2592 rtx op2 = operands[2];
2593 rtx dest1 = simplify_gen_subreg (SImode, dest, DImode, 0);
2594 rtx dest2 = simplify_gen_subreg (SImode, dest, DImode, 4);
2600 addr1 = XEXP (src, 0);
2601 if (GET_CODE (addr1) == PLUS)
2603 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2604 if (TARGET_AVOID_XFORM)
2606 emit_insn (gen_add3_insn (op2, XEXP (addr1, 1), op2));
2610 addr2 = gen_rtx_PLUS (SImode, op2, XEXP (addr1, 1));
2612 else if (TARGET_AVOID_XFORM)
2614 emit_insn (gen_add3_insn (op2, addr1, GEN_INT (4)));
2619 emit_move_insn (op2, GEN_INT (4));
2620 addr2 = gen_rtx_PLUS (SImode, op2, addr1);
2623 word1 = change_address (src, SImode, addr1);
2624 word2 = change_address (src, SImode, addr2);
2626 emit_insn (gen_bswapsi2 (dest2, word1));
2627 emit_insn (gen_bswapsi2 (dest1, word2));
2632 [(set (match_operand:DI 0 "indexed_or_indirect_operand" "")
2633 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2634 (clobber (match_operand:SI 2 "gpc_reg_operand" ""))]
2635 "!TARGET_POWERPC64 && reload_completed"
2639 rtx dest = operands[0];
2640 rtx src = operands[1];
2641 rtx op2 = operands[2];
2642 rtx src1 = simplify_gen_subreg (SImode, src, DImode, 0);
2643 rtx src2 = simplify_gen_subreg (SImode, src, DImode, 4);
2649 addr1 = XEXP (dest, 0);
2650 if (GET_CODE (addr1) == PLUS)
2652 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2653 if (TARGET_AVOID_XFORM)
2655 emit_insn (gen_add3_insn (op2, XEXP (addr1, 1), op2));
2659 addr2 = gen_rtx_PLUS (SImode, op2, XEXP (addr1, 1));
2661 else if (TARGET_AVOID_XFORM)
2663 emit_insn (gen_add3_insn (op2, addr1, GEN_INT (4)));
2668 emit_move_insn (op2, GEN_INT (4));
2669 addr2 = gen_rtx_PLUS (SImode, op2, addr1);
2672 word1 = change_address (dest, SImode, addr1);
2673 word2 = change_address (dest, SImode, addr2);
2675 emit_insn (gen_bswapsi2 (word2, src1));
2676 emit_insn (gen_bswapsi2 (word1, src2));
2681 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2682 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2683 (clobber (match_operand:SI 2 "" ""))]
2684 "!TARGET_POWERPC64 && reload_completed"
2688 rtx dest = operands[0];
2689 rtx src = operands[1];
2690 rtx src1 = simplify_gen_subreg (SImode, src, DImode, 0);
2691 rtx src2 = simplify_gen_subreg (SImode, src, DImode, 4);
2692 rtx dest1 = simplify_gen_subreg (SImode, dest, DImode, 0);
2693 rtx dest2 = simplify_gen_subreg (SImode, dest, DImode, 4);
2695 emit_insn (gen_bswapsi2 (dest1, src2));
2696 emit_insn (gen_bswapsi2 (dest2, src1));
2700 (define_insn "mulsi3"
2701 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2702 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2703 (match_operand:SI 2 "reg_or_short_operand" "r,I")))]
2708 [(set_attr "type" "mul")
2710 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
2712 (match_operand:SI 2 "short_cint_operand" "")
2713 (const_string "16")]
2714 (const_string "32")))])
2716 (define_insn "*mulsi3_internal1"
2717 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2718 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2719 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2721 (clobber (match_scratch:SI 3 "=r,r"))]
2726 [(set_attr "type" "mul")
2727 (set_attr "dot" "yes")
2728 (set_attr "length" "4,8")])
2731 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
2732 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2733 (match_operand:SI 2 "gpc_reg_operand" ""))
2735 (clobber (match_scratch:SI 3 ""))]
2736 "TARGET_32BIT && reload_completed"
2738 (mult:SI (match_dup 1) (match_dup 2)))
2740 (compare:CC (match_dup 3)
2744 (define_insn "*mulsi3_internal2"
2745 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2746 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2747 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2749 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2750 (mult:SI (match_dup 1) (match_dup 2)))]
2755 [(set_attr "type" "mul")
2756 (set_attr "dot" "yes")
2757 (set_attr "length" "4,8")])
2760 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
2761 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2762 (match_operand:SI 2 "gpc_reg_operand" ""))
2764 (set (match_operand:SI 0 "gpc_reg_operand" "")
2765 (mult:SI (match_dup 1) (match_dup 2)))]
2766 "TARGET_32BIT && reload_completed"
2768 (mult:SI (match_dup 1) (match_dup 2)))
2770 (compare:CC (match_dup 0)
2775 (define_insn "udiv<mode>3"
2776 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2777 (udiv:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2778 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
2781 [(set_attr "type" "div")
2782 (set_attr "size" "<bits>")])
2785 ;; For powers of two we can do srai/aze for divide and then adjust for
2786 ;; modulus. If it isn't a power of two, force operands into register and do
2788 (define_expand "div<mode>3"
2789 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2790 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2791 (match_operand:GPR 2 "reg_or_cint_operand" "")))]
2794 if (GET_CODE (operands[2]) != CONST_INT
2795 || INTVAL (operands[2]) <= 0
2796 || exact_log2 (INTVAL (operands[2])) < 0)
2797 operands[2] = force_reg (<MODE>mode, operands[2]);
2800 (define_insn "*div<mode>3"
2801 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2802 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2803 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
2806 [(set_attr "type" "div")
2807 (set_attr "size" "<bits>")])
2809 (define_expand "mod<mode>3"
2810 [(use (match_operand:GPR 0 "gpc_reg_operand" ""))
2811 (use (match_operand:GPR 1 "gpc_reg_operand" ""))
2812 (use (match_operand:GPR 2 "reg_or_cint_operand" ""))]
2820 if (GET_CODE (operands[2]) != CONST_INT
2821 || INTVAL (operands[2]) <= 0
2822 || (i = exact_log2 (INTVAL (operands[2]))) < 0)
2825 temp1 = gen_reg_rtx (<MODE>mode);
2826 temp2 = gen_reg_rtx (<MODE>mode);
2828 emit_insn (gen_div<mode>3 (temp1, operands[1], operands[2]));
2829 emit_insn (gen_ashl<mode>3 (temp2, temp1, GEN_INT (i)));
2830 emit_insn (gen_sub<mode>3 (operands[0], operands[1], temp2));
2835 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2836 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2837 (match_operand:GPR 2 "exact_log2_cint_operand" "N")))]
2839 "sra<wd>i %0,%1,%p2\;addze %0,%0"
2840 [(set_attr "type" "two")
2841 (set_attr "length" "8")])
2844 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2845 (compare:CC (div:P (match_operand:P 1 "gpc_reg_operand" "r,r")
2846 (match_operand:P 2 "exact_log2_cint_operand" "N,N"))
2848 (clobber (match_scratch:P 3 "=r,r"))]
2851 sra<wd>i %3,%1,%p2\;addze. %3,%3
2853 [(set_attr "type" "compare")
2854 (set_attr "length" "8,12")
2855 (set_attr "cell_micro" "not")])
2858 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2859 (compare:CC (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2860 (match_operand:GPR 2 "exact_log2_cint_operand"
2863 (clobber (match_scratch:GPR 3 ""))]
2866 (div:<MODE> (match_dup 1) (match_dup 2)))
2868 (compare:CC (match_dup 3)
2873 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2874 (compare:CC (div:P (match_operand:P 1 "gpc_reg_operand" "r,r")
2875 (match_operand:P 2 "exact_log2_cint_operand" "N,N"))
2877 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
2878 (div:P (match_dup 1) (match_dup 2)))]
2881 sra<wd>i %0,%1,%p2\;addze. %0,%0
2883 [(set_attr "type" "compare")
2884 (set_attr "length" "8,12")
2885 (set_attr "cell_micro" "not")])
2888 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2889 (compare:CC (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2890 (match_operand:GPR 2 "exact_log2_cint_operand"
2893 (set (match_operand:GPR 0 "gpc_reg_operand" "")
2894 (div:GPR (match_dup 1) (match_dup 2)))]
2897 (div:<MODE> (match_dup 1) (match_dup 2)))
2899 (compare:CC (match_dup 0)
2903 ;; Logical instructions
2904 ;; The logical instructions are mostly combined by using match_operator,
2905 ;; but the plain AND insns are somewhat different because there is no
2906 ;; plain 'andi' (only 'andi.'), no plain 'andis', and there are all
2907 ;; those rotate-and-mask operations. Thus, the AND insns come first.
2909 (define_expand "andsi3"
2911 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2912 (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2913 (match_operand:SI 2 "and_operand" "")))
2914 (clobber (match_scratch:CC 3 ""))])]
2918 (define_insn "andsi3_mc"
2919 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
2920 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
2921 (match_operand:SI 2 "and_operand" "?r,T,K,L")))
2922 (clobber (match_scratch:CC 3 "=X,X,x,x"))]
2923 "rs6000_gen_cell_microcode"
2926 rlwinm %0,%1,0,%m2,%M2
2929 [(set_attr "type" "*,shift,logical,logical")
2930 (set_attr "dot" "no,no,yes,yes")])
2932 (define_insn "andsi3_nomc"
2933 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2934 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2935 (match_operand:SI 2 "and_operand" "?r,T")))
2936 (clobber (match_scratch:CC 3 "=X,X"))]
2937 "!rs6000_gen_cell_microcode"
2940 rlwinm %0,%1,0,%m2,%M2"
2941 [(set_attr "type" "logical,shift")])
2943 (define_insn "andsi3_internal0_nomc"
2944 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2945 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2946 (match_operand:SI 2 "and_operand" "?r,T")))]
2947 "!rs6000_gen_cell_microcode"
2950 rlwinm %0,%1,0,%m2,%M2"
2951 [(set_attr "type" "logical,shift")])
2954 ;; Note to set cr's other than cr0 we do the and immediate and then
2955 ;; the test again -- this avoids a mfcr which on the higher end
2956 ;; machines causes an execution serialization
2958 (define_insn "*andsi3_internal2_mc"
2959 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2960 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2961 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2963 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2964 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2965 "TARGET_32BIT && rs6000_gen_cell_microcode"
2970 rlwinm. %3,%1,0,%m2,%M2
2975 [(set_attr "type" "logical,logical,logical,shift,\
2976 compare,compare,compare,compare")
2977 (set_attr "dot" "yes")
2978 (set_attr "length" "4,4,4,4,8,8,8,8")])
2980 (define_insn "*andsi3_internal3_mc"
2981 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2982 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2983 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2985 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2986 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2987 "TARGET_64BIT && rs6000_gen_cell_microcode"
2992 rlwinm. %3,%1,0,%m2,%M2
2997 [(set_attr "type" "compare,logical,logical,shift,compare,\
2998 compare,compare,compare")
2999 (set_attr "dot" "yes")
3000 (set_attr "length" "8,4,4,4,8,8,8,8")])
3003 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3004 (compare:CC (and:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
3005 (match_operand:GPR 2 "and_operand" ""))
3007 (clobber (match_scratch:GPR 3 ""))
3008 (clobber (match_scratch:CC 4 ""))]
3010 [(parallel [(set (match_dup 3)
3011 (and:<MODE> (match_dup 1)
3013 (clobber (match_dup 4))])
3015 (compare:CC (match_dup 3)
3019 ;; We don't have a 32 bit "and. rt,ra,rb" for ppc64. cr is set from the
3020 ;; whole 64 bit reg, and we don't know what is in the high 32 bits.
3023 [(set (match_operand:CC 0 "cc_reg_operand" "")
3024 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
3025 (match_operand:SI 2 "gpc_reg_operand" ""))
3027 (clobber (match_scratch:SI 3 ""))
3028 (clobber (match_scratch:CC 4 ""))]
3029 "TARGET_POWERPC64 && reload_completed"
3030 [(parallel [(set (match_dup 3)
3031 (and:SI (match_dup 1)
3033 (clobber (match_dup 4))])
3035 (compare:CC (match_dup 3)
3039 (define_insn "*andsi3_internal4"
3040 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
3041 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
3042 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
3044 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
3045 (and:SI (match_dup 1)
3047 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
3048 "TARGET_32BIT && rs6000_gen_cell_microcode"
3053 rlwinm. %0,%1,0,%m2,%M2
3058 [(set_attr "type" "logical,logical,logical,shift,\
3059 compare,compare,compare,compare")
3060 (set_attr "dot" "yes")
3061 (set_attr "length" "4,4,4,4,8,8,8,8")])
3063 (define_insn "*andsi3_internal5_mc"
3064 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
3065 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
3066 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
3068 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
3069 (and:SI (match_dup 1)
3071 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
3072 "TARGET_64BIT && rs6000_gen_cell_microcode"
3077 rlwinm. %0,%1,0,%m2,%M2
3082 [(set_attr "type" "compare,logical,logical,shift,compare,\
3083 compare,compare,compare")
3084 (set_attr "dot" "yes")
3085 (set_attr "length" "8,4,4,4,8,8,8,8")])
3088 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3089 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
3090 (match_operand:SI 2 "and_operand" ""))
3092 (set (match_operand:SI 0 "gpc_reg_operand" "")
3093 (and:SI (match_dup 1)
3095 (clobber (match_scratch:CC 4 ""))]
3097 [(parallel [(set (match_dup 0)
3098 (and:SI (match_dup 1)
3100 (clobber (match_dup 4))])
3102 (compare:CC (match_dup 0)
3107 [(set (match_operand:CC 3 "cc_reg_operand" "")
3108 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
3109 (match_operand:SI 2 "gpc_reg_operand" ""))
3111 (set (match_operand:SI 0 "gpc_reg_operand" "")
3112 (and:SI (match_dup 1)
3114 (clobber (match_scratch:CC 4 ""))]
3115 "TARGET_POWERPC64 && reload_completed"
3116 [(parallel [(set (match_dup 0)
3117 (and:SI (match_dup 1)
3119 (clobber (match_dup 4))])
3121 (compare:CC (match_dup 0)
3125 ;; Handle the PowerPC64 rlwinm corner case
3127 (define_insn_and_split "*andsi3_internal6"
3128 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3129 (and:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3130 (match_operand:SI 2 "mask_operand_wrap" "i")))]
3135 (and:SI (rotate:SI (match_dup 1) (match_dup 3))
3138 (rotate:SI (match_dup 0) (match_dup 5)))]
3141 int mb = extract_MB (operands[2]);
3142 int me = extract_ME (operands[2]);
3143 operands[3] = GEN_INT (me + 1);
3144 operands[5] = GEN_INT (32 - (me + 1));
3145 operands[4] = GEN_INT (~((HOST_WIDE_INT) -1 << (33 + me - mb)));
3147 [(set_attr "length" "8")])
3149 (define_expand "iorsi3"
3150 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3151 (ior:SI (match_operand:SI 1 "gpc_reg_operand" "")
3152 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
3156 if (GET_CODE (operands[2]) == CONST_INT
3157 && ! logical_operand (operands[2], SImode))
3159 HOST_WIDE_INT value = INTVAL (operands[2]);
3160 rtx tmp = ((!can_create_pseudo_p ()
3161 || rtx_equal_p (operands[0], operands[1]))
3162 ? operands[0] : gen_reg_rtx (SImode));
3164 emit_insn (gen_iorsi3 (tmp, operands[1],
3165 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
3166 emit_insn (gen_iorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
3171 (define_expand "xorsi3"
3172 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3173 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
3174 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
3178 if (GET_CODE (operands[2]) == CONST_INT
3179 && ! logical_operand (operands[2], SImode))
3181 HOST_WIDE_INT value = INTVAL (operands[2]);
3182 rtx tmp = ((!can_create_pseudo_p ()
3183 || rtx_equal_p (operands[0], operands[1]))
3184 ? operands[0] : gen_reg_rtx (SImode));
3186 emit_insn (gen_xorsi3 (tmp, operands[1],
3187 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
3188 emit_insn (gen_xorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
3193 (define_insn "*boolsi3_internal1"
3194 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
3195 (match_operator:SI 3 "boolean_or_operator"
3196 [(match_operand:SI 1 "gpc_reg_operand" "%r,r,r")
3197 (match_operand:SI 2 "logical_operand" "r,K,L")]))]
3204 (define_insn "*boolsi3_internal2"
3205 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3206 (compare:CC (match_operator:SI 4 "boolean_or_operator"
3207 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
3208 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3210 (clobber (match_scratch:SI 3 "=r,r"))]
3215 [(set_attr "type" "logical,compare")
3216 (set_attr "dot" "yes")
3217 (set_attr "length" "4,8")])
3220 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3221 (compare:CC (match_operator:SI 4 "boolean_operator"
3222 [(match_operand:SI 1 "gpc_reg_operand" "")
3223 (match_operand:SI 2 "gpc_reg_operand" "")])
3225 (clobber (match_scratch:SI 3 ""))]
3226 "TARGET_32BIT && reload_completed"
3227 [(set (match_dup 3) (match_dup 4))
3229 (compare:CC (match_dup 3)
3233 (define_insn "*boolsi3_internal3"
3234 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3235 (compare:CC (match_operator:SI 4 "boolean_operator"
3236 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
3237 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3239 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3245 [(set_attr "type" "logical,compare")
3246 (set_attr "dot" "yes")
3247 (set_attr "length" "4,8")])
3250 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3251 (compare:CC (match_operator:SI 4 "boolean_operator"
3252 [(match_operand:SI 1 "gpc_reg_operand" "")
3253 (match_operand:SI 2 "gpc_reg_operand" "")])
3255 (set (match_operand:SI 0 "gpc_reg_operand" "")
3257 "TARGET_32BIT && reload_completed"
3258 [(set (match_dup 0) (match_dup 4))
3260 (compare:CC (match_dup 0)
3264 ;; Split a logical operation that we can't do in one insn into two insns,
3265 ;; each of which does one 16-bit part. This is used by combine.
3268 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3269 (match_operator:SI 3 "boolean_or_operator"
3270 [(match_operand:SI 1 "gpc_reg_operand" "")
3271 (match_operand:SI 2 "non_logical_cint_operand" "")]))]
3273 [(set (match_dup 0) (match_dup 4))
3274 (set (match_dup 0) (match_dup 5))]
3278 i = GEN_INT (INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff));
3279 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
3281 i = GEN_INT (INTVAL (operands[2]) & 0xffff);
3282 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
3286 (define_insn "*boolcsi3_internal1"
3287 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3288 (match_operator:SI 3 "boolean_operator"
3289 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
3290 (match_operand:SI 2 "gpc_reg_operand" "r")]))]
3294 (define_insn "*boolcsi3_internal2"
3295 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3296 (compare:CC (match_operator:SI 4 "boolean_operator"
3297 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
3298 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3300 (clobber (match_scratch:SI 3 "=r,r"))]
3305 [(set_attr "type" "compare")
3306 (set_attr "length" "4,8")])
3309 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3310 (compare:CC (match_operator:SI 4 "boolean_operator"
3311 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3312 (match_operand:SI 2 "gpc_reg_operand" "")])
3314 (clobber (match_scratch:SI 3 ""))]
3315 "TARGET_32BIT && reload_completed"
3316 [(set (match_dup 3) (match_dup 4))
3318 (compare:CC (match_dup 3)
3322 (define_insn "*boolcsi3_internal3"
3323 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3324 (compare:CC (match_operator:SI 4 "boolean_operator"
3325 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
3326 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3328 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3334 [(set_attr "type" "compare")
3335 (set_attr "length" "4,8")])
3338 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3339 (compare:CC (match_operator:SI 4 "boolean_operator"
3340 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3341 (match_operand:SI 2 "gpc_reg_operand" "")])
3343 (set (match_operand:SI 0 "gpc_reg_operand" "")
3345 "TARGET_32BIT && reload_completed"
3346 [(set (match_dup 0) (match_dup 4))
3348 (compare:CC (match_dup 0)
3352 (define_insn "*boolccsi3_internal1"
3353 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3354 (match_operator:SI 3 "boolean_operator"
3355 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
3356 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))]))]
3360 (define_insn "*boolccsi3_internal2"
3361 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3362 (compare:CC (match_operator:SI 4 "boolean_operator"
3363 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
3364 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
3366 (clobber (match_scratch:SI 3 "=r,r"))]
3371 [(set_attr "type" "logical,compare")
3372 (set_attr "dot" "yes")
3373 (set_attr "length" "4,8")])
3376 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3377 (compare:CC (match_operator:SI 4 "boolean_operator"
3378 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3379 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
3381 (clobber (match_scratch:SI 3 ""))]
3382 "TARGET_32BIT && reload_completed"
3383 [(set (match_dup 3) (match_dup 4))
3385 (compare:CC (match_dup 3)
3389 (define_insn "*boolccsi3_internal3"
3390 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3391 (compare:CC (match_operator:SI 4 "boolean_operator"
3392 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
3393 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
3395 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3401 [(set_attr "type" "logical,compare")
3402 (set_attr "dot" "yes")
3403 (set_attr "length" "4,8")])
3406 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3407 (compare:CC (match_operator:SI 4 "boolean_operator"
3408 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3409 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
3411 (set (match_operand:SI 0 "gpc_reg_operand" "")
3413 "TARGET_32BIT && reload_completed"
3414 [(set (match_dup 0) (match_dup 4))
3416 (compare:CC (match_dup 0)
3420 ;; Rotate and shift insns, in all their variants. These support shifts,
3421 ;; field inserts and extracts, and various combinations thereof.
3422 (define_expand "insv"
3423 [(set (zero_extract (match_operand 0 "gpc_reg_operand" "")
3424 (match_operand:SI 1 "const_int_operand" "")
3425 (match_operand:SI 2 "const_int_operand" ""))
3426 (match_operand 3 "gpc_reg_operand" ""))]
3430 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3431 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3432 compiler if the address of the structure is taken later. Likewise, do
3433 not handle invalid E500 subregs. */
3434 if (GET_CODE (operands[0]) == SUBREG
3435 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD
3436 || ((TARGET_E500_DOUBLE || TARGET_SPE)
3437 && invalid_e500_subreg (operands[0], GET_MODE (operands[0])))))
3440 if (TARGET_POWERPC64 && GET_MODE (operands[0]) == DImode)
3441 emit_insn (gen_insvdi_internal (operands[0], operands[1], operands[2],
3444 emit_insn (gen_insvsi_internal (operands[0], operands[1], operands[2],
3449 (define_insn "insvsi_internal"
3450 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3451 (match_operand:SI 1 "const_int_operand" "i")
3452 (match_operand:SI 2 "const_int_operand" "i"))
3453 (match_operand:SI 3 "gpc_reg_operand" "r"))]
3457 int start = INTVAL (operands[2]) & 31;
3458 int size = INTVAL (operands[1]) & 31;
3460 operands[4] = GEN_INT (32 - start - size);
3461 operands[1] = GEN_INT (start + size - 1);
3462 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3464 [(set_attr "type" "insert")])
3466 (define_insn "*insvsi_internal1"
3467 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3468 (match_operand:SI 1 "const_int_operand" "i")
3469 (match_operand:SI 2 "const_int_operand" "i"))
3470 (rotate:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3471 (match_operand:SI 4 "const_int_operand" "i")))]
3472 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3475 int shift = INTVAL (operands[4]) & 31;
3476 int start = INTVAL (operands[2]) & 31;
3477 int size = INTVAL (operands[1]) & 31;
3479 operands[4] = GEN_INT (shift - start - size);
3480 operands[1] = GEN_INT (start + size - 1);
3481 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3483 [(set_attr "type" "insert")])
3485 (define_insn "*insvsi_internal2"
3486 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3487 (match_operand:SI 1 "const_int_operand" "i")
3488 (match_operand:SI 2 "const_int_operand" "i"))
3489 (ashiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3490 (match_operand:SI 4 "const_int_operand" "i")))]
3491 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3494 int shift = INTVAL (operands[4]) & 31;
3495 int start = INTVAL (operands[2]) & 31;
3496 int size = INTVAL (operands[1]) & 31;
3498 operands[4] = GEN_INT (32 - shift - start - size);
3499 operands[1] = GEN_INT (start + size - 1);
3500 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3502 [(set_attr "type" "insert")])
3504 (define_insn "*insvsi_internal3"
3505 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3506 (match_operand:SI 1 "const_int_operand" "i")
3507 (match_operand:SI 2 "const_int_operand" "i"))
3508 (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3509 (match_operand:SI 4 "const_int_operand" "i")))]
3510 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3513 int shift = INTVAL (operands[4]) & 31;
3514 int start = INTVAL (operands[2]) & 31;
3515 int size = INTVAL (operands[1]) & 31;
3517 operands[4] = GEN_INT (32 - shift - start - size);
3518 operands[1] = GEN_INT (start + size - 1);
3519 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3521 [(set_attr "type" "insert")])
3523 (define_insn "*insvsi_internal4"
3524 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3525 (match_operand:SI 1 "const_int_operand" "i")
3526 (match_operand:SI 2 "const_int_operand" "i"))
3527 (zero_extract:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3528 (match_operand:SI 4 "const_int_operand" "i")
3529 (match_operand:SI 5 "const_int_operand" "i")))]
3530 "INTVAL (operands[4]) >= INTVAL (operands[1])"
3533 int extract_start = INTVAL (operands[5]) & 31;
3534 int extract_size = INTVAL (operands[4]) & 31;
3535 int insert_start = INTVAL (operands[2]) & 31;
3536 int insert_size = INTVAL (operands[1]) & 31;
3538 /* Align extract field with insert field */
3539 operands[5] = GEN_INT (extract_start + extract_size - insert_start - insert_size);
3540 operands[1] = GEN_INT (insert_start + insert_size - 1);
3541 return \"rlwimi %0,%3,%h5,%h2,%h1\";
3543 [(set_attr "type" "insert")])
3545 ;; combine patterns for rlwimi
3546 (define_insn "*insvsi_internal5"
3547 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3548 (ior:SI (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
3549 (match_operand:SI 1 "mask_operand" "i"))
3550 (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3551 (match_operand:SI 2 "const_int_operand" "i"))
3552 (match_operand:SI 5 "mask_operand" "i"))))]
3553 "INTVAL(operands[1]) == ~INTVAL(operands[5])"
3556 int me = extract_ME(operands[5]);
3557 int mb = extract_MB(operands[5]);
3558 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
3559 operands[2] = GEN_INT(mb);
3560 operands[1] = GEN_INT(me);
3561 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3563 [(set_attr "type" "insert")])
3565 (define_insn "*insvsi_internal6"
3566 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3567 (ior:SI (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3568 (match_operand:SI 2 "const_int_operand" "i"))
3569 (match_operand:SI 5 "mask_operand" "i"))
3570 (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
3571 (match_operand:SI 1 "mask_operand" "i"))))]
3572 "INTVAL(operands[1]) == ~INTVAL(operands[5])"
3575 int me = extract_ME(operands[5]);
3576 int mb = extract_MB(operands[5]);
3577 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
3578 operands[2] = GEN_INT(mb);
3579 operands[1] = GEN_INT(me);
3580 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3582 [(set_attr "type" "insert")])
3584 (define_insn "insvdi_internal"
3585 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3586 (match_operand:SI 1 "const_int_operand" "i")
3587 (match_operand:SI 2 "const_int_operand" "i"))
3588 (match_operand:DI 3 "gpc_reg_operand" "r"))]
3592 int start = INTVAL (operands[2]) & 63;
3593 int size = INTVAL (operands[1]) & 63;
3595 operands[1] = GEN_INT (64 - start - size);
3596 return \"rldimi %0,%3,%H1,%H2\";
3598 [(set_attr "type" "insert")
3599 (set_attr "size" "64")])
3601 (define_insn "*insvdi_internal2"
3602 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3603 (match_operand:SI 1 "const_int_operand" "i")
3604 (match_operand:SI 2 "const_int_operand" "i"))
3605 (ashiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
3606 (match_operand:SI 4 "const_int_operand" "i")))]
3608 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
3611 int shift = INTVAL (operands[4]) & 63;
3612 int start = (INTVAL (operands[2]) & 63) - 32;
3613 int size = INTVAL (operands[1]) & 63;
3615 operands[4] = GEN_INT (64 - shift - start - size);
3616 operands[2] = GEN_INT (start);
3617 operands[1] = GEN_INT (start + size - 1);
3618 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3621 (define_insn "*insvdi_internal3"
3622 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3623 (match_operand:SI 1 "const_int_operand" "i")
3624 (match_operand:SI 2 "const_int_operand" "i"))
3625 (lshiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
3626 (match_operand:SI 4 "const_int_operand" "i")))]
3628 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
3631 int shift = INTVAL (operands[4]) & 63;
3632 int start = (INTVAL (operands[2]) & 63) - 32;
3633 int size = INTVAL (operands[1]) & 63;
3635 operands[4] = GEN_INT (64 - shift - start - size);
3636 operands[2] = GEN_INT (start);
3637 operands[1] = GEN_INT (start + size - 1);
3638 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3641 (define_expand "extzv"
3642 [(set (match_operand 0 "gpc_reg_operand" "")
3643 (zero_extract (match_operand 1 "gpc_reg_operand" "")
3644 (match_operand:SI 2 "const_int_operand" "")
3645 (match_operand:SI 3 "const_int_operand" "")))]
3649 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3650 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3651 compiler if the address of the structure is taken later. */
3652 if (GET_CODE (operands[0]) == SUBREG
3653 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
3656 if (TARGET_POWERPC64 && GET_MODE (operands[1]) == DImode)
3657 emit_insn (gen_extzvdi_internal (operands[0], operands[1], operands[2],
3660 emit_insn (gen_extzvsi_internal (operands[0], operands[1], operands[2],
3665 (define_insn "extzvsi_internal"
3666 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3667 (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3668 (match_operand:SI 2 "const_int_operand" "i")
3669 (match_operand:SI 3 "const_int_operand" "i")))]
3673 int start = INTVAL (operands[3]) & 31;
3674 int size = INTVAL (operands[2]) & 31;
3676 if (start + size >= 32)
3677 operands[3] = const0_rtx;
3679 operands[3] = GEN_INT (start + size);
3680 return \"rlwinm %0,%1,%3,%s2,31\";
3682 [(set_attr "type" "shift")])
3684 (define_insn "*extzvsi_internal1"
3685 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3686 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3687 (match_operand:SI 2 "const_int_operand" "i,i")
3688 (match_operand:SI 3 "const_int_operand" "i,i"))
3690 (clobber (match_scratch:SI 4 "=r,r"))]
3694 int start = INTVAL (operands[3]) & 31;
3695 int size = INTVAL (operands[2]) & 31;
3697 /* Force split for non-cc0 compare. */
3698 if (which_alternative == 1)
3701 /* If the bit-field being tested fits in the upper or lower half of a
3702 word, it is possible to use andiu. or andil. to test it. This is
3703 useful because the condition register set-use delay is smaller for
3704 andi[ul]. than for rlinm. This doesn't work when the starting bit
3705 position is 0 because the LT and GT bits may be set wrong. */
3707 if ((start > 0 && start + size <= 16) || start >= 16)
3709 operands[3] = GEN_INT (((1 << (16 - (start & 15)))
3710 - (1 << (16 - (start & 15) - size))));
3712 return \"andis. %4,%1,%3\";
3714 return \"andi. %4,%1,%3\";
3717 if (start + size >= 32)
3718 operands[3] = const0_rtx;
3720 operands[3] = GEN_INT (start + size);
3721 return \"rlwinm. %4,%1,%3,%s2,31\";
3723 [(set_attr "type" "shift")
3724 (set_attr "dot" "yes")
3725 (set_attr "length" "4,8")])
3728 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3729 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3730 (match_operand:SI 2 "const_int_operand" "")
3731 (match_operand:SI 3 "const_int_operand" ""))
3733 (clobber (match_scratch:SI 4 ""))]
3736 (zero_extract:SI (match_dup 1) (match_dup 2)
3739 (compare:CC (match_dup 4)
3743 (define_insn "*extzvsi_internal2"
3744 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3745 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3746 (match_operand:SI 2 "const_int_operand" "i,i")
3747 (match_operand:SI 3 "const_int_operand" "i,i"))
3749 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3750 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3754 int start = INTVAL (operands[3]) & 31;
3755 int size = INTVAL (operands[2]) & 31;
3757 /* Force split for non-cc0 compare. */
3758 if (which_alternative == 1)
3761 /* Since we are using the output value, we can't ignore any need for
3762 a shift. The bit-field must end at the LSB. */
3763 if (start >= 16 && start + size == 32)
3765 operands[3] = GEN_INT ((1 << size) - 1);
3766 return \"andi. %0,%1,%3\";
3769 if (start + size >= 32)
3770 operands[3] = const0_rtx;
3772 operands[3] = GEN_INT (start + size);
3773 return \"rlwinm. %0,%1,%3,%s2,31\";
3775 [(set_attr "type" "shift")
3776 (set_attr "dot" "yes")
3777 (set_attr "length" "4,8")])
3780 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
3781 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3782 (match_operand:SI 2 "const_int_operand" "")
3783 (match_operand:SI 3 "const_int_operand" ""))
3785 (set (match_operand:SI 0 "gpc_reg_operand" "")
3786 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3789 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))
3791 (compare:CC (match_dup 0)
3795 (define_insn "extzvdi_internal"
3796 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
3797 (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3798 (match_operand:SI 2 "const_int_operand" "i")
3799 (match_operand:SI 3 "const_int_operand" "i")))]
3803 int start = INTVAL (operands[3]) & 63;
3804 int size = INTVAL (operands[2]) & 63;
3806 if (start + size >= 64)
3807 operands[3] = const0_rtx;
3809 operands[3] = GEN_INT (start + size);
3810 operands[2] = GEN_INT (64 - size);
3811 return \"rldicl %0,%1,%3,%2\";
3813 [(set_attr "type" "shift")])
3815 (define_insn "*extzvdi_internal1"
3816 [(set (match_operand:CC 0 "gpc_reg_operand" "=x")
3817 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3818 (match_operand:SI 2 "const_int_operand" "i")
3819 (match_operand:SI 3 "const_int_operand" "i"))
3821 (clobber (match_scratch:DI 4 "=r"))]
3822 "TARGET_64BIT && rs6000_gen_cell_microcode"
3825 int start = INTVAL (operands[3]) & 63;
3826 int size = INTVAL (operands[2]) & 63;
3828 if (start + size >= 64)
3829 operands[3] = const0_rtx;
3831 operands[3] = GEN_INT (start + size);
3832 operands[2] = GEN_INT (64 - size);
3833 return \"rldicl. %4,%1,%3,%2\";
3835 [(set_attr "type" "shift")
3836 (set_attr "dot" "yes")])
3838 (define_insn "*extzvdi_internal2"
3839 [(set (match_operand:CC 4 "gpc_reg_operand" "=x")
3840 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3841 (match_operand:SI 2 "const_int_operand" "i")
3842 (match_operand:SI 3 "const_int_operand" "i"))
3844 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
3845 (zero_extract:DI (match_dup 1) (match_dup 2) (match_dup 3)))]
3846 "TARGET_64BIT && rs6000_gen_cell_microcode"
3849 int start = INTVAL (operands[3]) & 63;
3850 int size = INTVAL (operands[2]) & 63;
3852 if (start + size >= 64)
3853 operands[3] = const0_rtx;
3855 operands[3] = GEN_INT (start + size);
3856 operands[2] = GEN_INT (64 - size);
3857 return \"rldicl. %0,%1,%3,%2\";
3859 [(set_attr "type" "shift")
3860 (set_attr "dot" "yes")])
3863 (define_insn "rotl<mode>3"
3864 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
3865 (rotate:GPR (match_operand:GPR 1 "gpc_reg_operand" "r,r")
3866 (match_operand:GPR 2 "reg_or_cint_operand" "r,n")))]
3870 rotl<wd>i %0,%1,%<hH>2"
3871 [(set_attr "type" "shift")
3872 (set_attr "var_shift" "yes,no")])
3874 (define_insn "*rotlsi3_64"
3875 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
3877 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3878 (match_operand:SI 2 "reg_or_cint_operand" "r,n"))))]
3883 [(set_attr "type" "shift")
3884 (set_attr "var_shift" "yes,no")])
3886 (define_insn_and_split "*rotl<mode>3_dot"
3887 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
3888 (compare:CC (rotate:GPR (match_operand:GPR 1 "gpc_reg_operand" "r,r,r,r")
3889 (match_operand:GPR 2 "reg_or_cint_operand" "r,n,r,n"))
3891 (clobber (match_scratch:GPR 0 "=r,r,r,r"))]
3892 "<MODE>mode == Pmode && rs6000_gen_cell_microcode"
3895 rotl<wd>i. %0,%1,%<hH>2
3898 "&& reload_completed"
3900 (rotate:GPR (match_dup 1)
3903 (compare:CC (match_dup 0)
3906 [(set_attr "type" "shift")
3907 (set_attr "var_shift" "yes,no,yes,no")
3908 (set_attr "dot" "yes")
3909 (set_attr "length" "4,4,8,8")])
3911 (define_insn_and_split "*rotl<mode>3_dot2"
3912 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
3913 (compare:CC (rotate:GPR (match_operand:GPR 1 "gpc_reg_operand" "r,r,r,r")
3914 (match_operand:GPR 2 "reg_or_cint_operand" "r,n,r,n"))
3916 (set (match_operand:GPR 0 "gpc_reg_operand" "=r,r,r,r")
3917 (rotate:GPR (match_dup 1)
3919 "<MODE>mode == Pmode && rs6000_gen_cell_microcode"
3922 rotl<wd>i. %0,%1,%<hH>2
3925 "&& reload_completed"
3927 (rotate:GPR (match_dup 1)
3930 (compare:CC (match_dup 0)
3933 [(set_attr "type" "shift")
3934 (set_attr "var_shift" "yes,no,yes,no")
3935 (set_attr "dot" "yes")
3936 (set_attr "length" "4,4,8,8")])
3939 (define_insn "*rotlsi3_internal4"
3940 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3941 (and:SI (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3942 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
3943 (match_operand:SI 3 "mask_operand" "n,n")))]
3946 rlwnm %0,%1,%2,%m3,%M3
3947 rlwinm %0,%1,%h2,%m3,%M3"
3948 [(set_attr "type" "shift")
3949 (set_attr "var_shift" "yes,no")])
3951 (define_insn "*rotlsi3_internal5"
3952 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3954 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3955 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3956 (match_operand:SI 3 "mask_operand" "n,n,n,n"))
3958 (clobber (match_scratch:SI 4 "=r,r,r,r"))]
3961 rlwnm. %4,%1,%2,%m3,%M3
3962 rlwinm. %4,%1,%h2,%m3,%M3
3965 [(set_attr "type" "shift")
3966 (set_attr "var_shift" "yes,no,yes,no")
3967 (set_attr "dot" "yes")
3968 (set_attr "length" "4,4,8,8")])
3971 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3973 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3974 (match_operand:SI 2 "reg_or_cint_operand" ""))
3975 (match_operand:SI 3 "mask_operand" ""))
3977 (clobber (match_scratch:SI 4 ""))]
3980 (and:SI (rotate:SI (match_dup 1)
3984 (compare:CC (match_dup 4)
3988 (define_insn "*rotlsi3_internal6"
3989 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
3991 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3992 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3993 (match_operand:SI 3 "mask_operand" "n,n,n,n"))
3995 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
3996 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3999 rlwnm. %0,%1,%2,%m3,%M3
4000 rlwinm. %0,%1,%h2,%m3,%M3
4003 [(set_attr "type" "shift")
4004 (set_attr "var_shift" "yes,no,yes,no")
4005 (set_attr "dot" "yes")
4006 (set_attr "length" "4,4,8,8")])
4009 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
4011 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4012 (match_operand:SI 2 "reg_or_cint_operand" ""))
4013 (match_operand:SI 3 "mask_operand" ""))
4015 (set (match_operand:SI 0 "gpc_reg_operand" "")
4016 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4019 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4021 (compare:CC (match_dup 0)
4025 (define_insn "*rotlsi3_internal7le"
4026 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4029 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4030 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
4032 "rlw%I2nm %0,%1,%h2,0xff"
4033 [(set (attr "cell_micro")
4034 (if_then_else (match_operand:SI 2 "const_int_operand" "")
4035 (const_string "not")
4036 (const_string "always")))
4037 (set_attr "type" "shift")])
4039 (define_insn "*rotlsi3_internal7be"
4040 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4043 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4044 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 3)))]
4046 "rlw%I2nm %0,%1,%h2,0xff"
4047 [(set (attr "cell_micro")
4048 (if_then_else (match_operand:SI 2 "const_int_operand" "")
4049 (const_string "not")
4050 (const_string "always")))
4051 (set_attr "type" "shift")])
4053 (define_insn "*rotlsi3_internal8le"
4054 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4055 (compare:CC (zero_extend:SI
4057 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4058 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4060 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4063 rlwnm. %3,%1,%2,0xff
4064 rlwinm. %3,%1,%h2,0xff
4067 [(set_attr "type" "shift")
4068 (set_attr "var_shift" "yes,no,yes,no")
4069 (set_attr "dot" "yes")
4070 (set_attr "length" "4,4,8,8")])
4072 (define_insn "*rotlsi3_internal8be"
4073 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4074 (compare:CC (zero_extend:SI
4076 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4077 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 3))
4079 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4082 rlwnm. %3,%1,%2,0xff
4083 rlwinm. %3,%1,%h2,0xff
4086 [(set_attr "type" "shift")
4087 (set_attr "var_shift" "yes,no,yes,no")
4088 (set_attr "dot" "yes")
4089 (set_attr "length" "4,4,8,8")])
4092 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4093 (compare:CC (zero_extend:SI
4095 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4096 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4098 (clobber (match_scratch:SI 3 ""))]
4099 "!BYTES_BIG_ENDIAN && reload_completed"
4101 (zero_extend:SI (subreg:QI
4102 (rotate:SI (match_dup 1)
4105 (compare:CC (match_dup 3)
4110 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4111 (compare:CC (zero_extend:SI
4113 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4114 (match_operand:SI 2 "reg_or_cint_operand" "")) 3))
4116 (clobber (match_scratch:SI 3 ""))]
4117 "BYTES_BIG_ENDIAN && reload_completed"
4119 (zero_extend:SI (subreg:QI
4120 (rotate:SI (match_dup 1)
4123 (compare:CC (match_dup 3)
4127 (define_insn "*rotlsi3_internal9le"
4128 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4129 (compare:CC (zero_extend:SI
4131 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4132 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4134 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4135 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4138 rlwnm. %0,%1,%2,0xff
4139 rlwinm. %0,%1,%h2,0xff
4142 [(set_attr "type" "shift")
4143 (set_attr "var_shift" "yes,no,yes,no")
4144 (set_attr "dot" "yes")
4145 (set_attr "length" "4,4,8,8")])
4147 (define_insn "*rotlsi3_internal9be"
4148 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4149 (compare:CC (zero_extend:SI
4151 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4152 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 3))
4154 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4155 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 3)))]
4158 rlwnm. %0,%1,%2,0xff
4159 rlwinm. %0,%1,%h2,0xff
4162 [(set_attr "type" "shift")
4163 (set_attr "var_shift" "yes,no,yes,no")
4164 (set_attr "dot" "yes")
4165 (set_attr "length" "4,4,8,8")])
4168 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4169 (compare:CC (zero_extend:SI
4171 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4172 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4174 (set (match_operand:SI 0 "gpc_reg_operand" "")
4175 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4176 "!BYTES_BIG_ENDIAN && reload_completed"
4178 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
4180 (compare:CC (match_dup 0)
4185 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4186 (compare:CC (zero_extend:SI
4188 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4189 (match_operand:SI 2 "reg_or_cint_operand" "")) 3))
4191 (set (match_operand:SI 0 "gpc_reg_operand" "")
4192 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 3)))]
4193 "BYTES_BIG_ENDIAN && reload_completed"
4195 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 3)))
4197 (compare:CC (match_dup 0)
4201 (define_insn "*rotlsi3_internal10le"
4202 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4205 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4206 (match_operand:SI 2 "reg_or_cint_operand" "r,i")) 0)))]
4209 rlwnm %0,%1,%2,0xffff
4210 rlwinm %0,%1,%h2,0xffff"
4211 [(set_attr "type" "shift")
4212 (set_attr "var_shift" "yes,no")])
4214 (define_insn "*rotlsi3_internal10be"
4215 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4218 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4219 (match_operand:SI 2 "reg_or_cint_operand" "r,i")) 2)))]
4222 rlwnm %0,%1,%2,0xffff
4223 rlwinm %0,%1,%h2,0xffff"
4224 [(set_attr "type" "shift")
4225 (set_attr "var_shift" "yes,no")])
4227 (define_insn "*rotlsi3_internal11le"
4228 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4229 (compare:CC (zero_extend:SI
4231 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4232 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4234 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4237 rlwnm. %3,%1,%2,0xffff
4238 rlwinm. %3,%1,%h2,0xffff
4241 [(set_attr "type" "shift")
4242 (set_attr "var_shift" "yes,no,yes,no")
4243 (set_attr "dot" "yes")
4244 (set_attr "length" "4,4,8,8")])
4246 (define_insn "*rotlsi3_internal11be"
4247 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4248 (compare:CC (zero_extend:SI
4250 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4251 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 2))
4253 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4256 rlwnm. %3,%1,%2,0xffff
4257 rlwinm. %3,%1,%h2,0xffff
4260 [(set_attr "type" "shift")
4261 (set_attr "var_shift" "yes,no,yes,no")
4262 (set_attr "dot" "yes")
4263 (set_attr "length" "4,4,8,8")])
4266 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4267 (compare:CC (zero_extend:SI
4269 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4270 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4272 (clobber (match_scratch:SI 3 ""))]
4273 "!BYTES_BIG_ENDIAN && reload_completed"
4275 (zero_extend:SI (subreg:HI
4276 (rotate:SI (match_dup 1)
4279 (compare:CC (match_dup 3)
4284 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4285 (compare:CC (zero_extend:SI
4287 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4288 (match_operand:SI 2 "reg_or_cint_operand" "")) 2))
4290 (clobber (match_scratch:SI 3 ""))]
4291 "BYTES_BIG_ENDIAN && reload_completed"
4293 (zero_extend:SI (subreg:HI
4294 (rotate:SI (match_dup 1)
4297 (compare:CC (match_dup 3)
4301 (define_insn "*rotlsi3_internal12le"
4302 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4303 (compare:CC (zero_extend:SI
4305 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4306 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4308 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4309 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4312 rlwnm. %0,%1,%2,0xffff
4313 rlwinm. %0,%1,%h2,0xffff
4316 [(set_attr "type" "shift")
4317 (set_attr "var_shift" "yes,no,yes,no")
4318 (set_attr "dot" "yes")
4319 (set_attr "length" "4,4,8,8")])
4321 (define_insn "*rotlsi3_internal12be"
4322 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4323 (compare:CC (zero_extend:SI
4325 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4326 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 2))
4328 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4329 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 2)))]
4332 rlwnm. %0,%1,%2,0xffff
4333 rlwinm. %0,%1,%h2,0xffff
4336 [(set_attr "type" "shift")
4337 (set_attr "var_shift" "yes,no,yes,no")
4338 (set_attr "dot" "yes")
4339 (set_attr "length" "4,4,8,8")])
4342 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4343 (compare:CC (zero_extend:SI
4345 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4346 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4348 (set (match_operand:SI 0 "gpc_reg_operand" "")
4349 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4350 "!BYTES_BIG_ENDIAN && reload_completed"
4352 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
4354 (compare:CC (match_dup 0)
4359 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4360 (compare:CC (zero_extend:SI
4362 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4363 (match_operand:SI 2 "reg_or_cint_operand" "")) 2))
4365 (set (match_operand:SI 0 "gpc_reg_operand" "")
4366 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 2)))]
4367 "BYTES_BIG_ENDIAN && reload_completed"
4369 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 2)))
4371 (compare:CC (match_dup 0)
4376 (define_insn "ashl<mode>3"
4377 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
4378 (ashift:GPR (match_operand:GPR 1 "gpc_reg_operand" "r,r")
4379 (match_operand:GPR 2 "reg_or_cint_operand" "r,n")))]
4383 sl<wd>i %0,%1,%<hH>2"
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,n"))))]
4396 [(set_attr "type" "shift")
4397 (set_attr "var_shift" "yes,no")])
4399 (define_insn_and_split "*ashl<mode>3_dot"
4400 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4401 (compare:CC (ashift:GPR (match_operand:GPR 1 "gpc_reg_operand" "r,r,r,r")
4402 (match_operand:GPR 2 "reg_or_cint_operand" "r,n,r,n"))
4404 (clobber (match_scratch:GPR 0 "=r,r,r,r"))]
4405 "<MODE>mode == Pmode && rs6000_gen_cell_microcode"
4408 sl<wd>i. %0,%1,%<hH>2
4411 "&& reload_completed"
4413 (ashift:GPR (match_dup 1)
4416 (compare:CC (match_dup 0)
4419 [(set_attr "type" "shift")
4420 (set_attr "var_shift" "yes,no,yes,no")
4421 (set_attr "dot" "yes")
4422 (set_attr "length" "4,4,8,8")])
4424 (define_insn_and_split "*ashl<mode>3_dot2"
4425 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4426 (compare:CC (ashift:GPR (match_operand:GPR 1 "gpc_reg_operand" "r,r,r,r")
4427 (match_operand:GPR 2 "reg_or_cint_operand" "r,n,r,n"))
4429 (set (match_operand:GPR 0 "gpc_reg_operand" "=r,r,r,r")
4430 (ashift:GPR (match_dup 1)
4432 "<MODE>mode == Pmode && rs6000_gen_cell_microcode"
4435 sl<wd>i. %0,%1,%<hH>2
4438 "&& reload_completed"
4440 (ashift:GPR (match_dup 1)
4443 (compare:CC (match_dup 0)
4446 [(set_attr "type" "shift")
4447 (set_attr "var_shift" "yes,no,yes,no")
4448 (set_attr "dot" "yes")
4449 (set_attr "length" "4,4,8,8")])
4452 (define_insn "rlwinm"
4453 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4454 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4455 (match_operand:SI 2 "const_int_operand" "i"))
4456 (match_operand:SI 3 "mask_operand" "n")))]
4457 "includes_lshift_p (operands[2], operands[3])"
4458 "rlwinm %0,%1,%h2,%m3,%M3"
4459 [(set_attr "type" "shift")])
4462 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4464 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4465 (match_operand:SI 2 "const_int_operand" "i,i"))
4466 (match_operand:SI 3 "mask_operand" "n,n"))
4468 (clobber (match_scratch:SI 4 "=r,r"))]
4469 "includes_lshift_p (operands[2], operands[3])"
4471 rlwinm. %4,%1,%h2,%m3,%M3
4473 [(set_attr "type" "shift")
4474 (set_attr "dot" "yes")
4475 (set_attr "length" "4,8")])
4478 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4480 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4481 (match_operand:SI 2 "const_int_operand" ""))
4482 (match_operand:SI 3 "mask_operand" ""))
4484 (clobber (match_scratch:SI 4 ""))]
4485 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
4487 (and:SI (ashift:SI (match_dup 1) (match_dup 2))
4490 (compare:CC (match_dup 4)
4495 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4497 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4498 (match_operand:SI 2 "const_int_operand" "i,i"))
4499 (match_operand:SI 3 "mask_operand" "n,n"))
4501 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4502 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4503 "includes_lshift_p (operands[2], operands[3])"
4505 rlwinm. %0,%1,%h2,%m3,%M3
4507 [(set_attr "type" "shift")
4508 (set_attr "dot" "yes")
4509 (set_attr "length" "4,8")])
4512 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
4514 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4515 (match_operand:SI 2 "const_int_operand" ""))
4516 (match_operand:SI 3 "mask_operand" ""))
4518 (set (match_operand:SI 0 "gpc_reg_operand" "")
4519 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4520 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
4522 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4524 (compare:CC (match_dup 0)
4529 (define_insn "lshr<mode>3"
4530 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
4531 (lshiftrt:GPR (match_operand:GPR 1 "gpc_reg_operand" "r,r")
4532 (match_operand:GPR 2 "reg_or_cint_operand" "r,n")))]
4536 sr<wd>i %0,%1,%<hH>2"
4537 [(set_attr "type" "shift")
4538 (set_attr "var_shift" "yes,no")])
4540 (define_insn "*lshrsi3_64"
4541 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
4543 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4544 (match_operand:SI 2 "reg_or_cint_operand" "r,n"))))]
4549 [(set_attr "type" "shift")
4550 (set_attr "var_shift" "yes,no")])
4552 (define_insn_and_split "*lshr<mode>3_dot"
4553 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4554 (compare:CC (lshiftrt:GPR (match_operand:GPR 1 "gpc_reg_operand" "r,r,r,r")
4555 (match_operand:GPR 2 "reg_or_cint_operand" "r,n,r,n"))
4557 (clobber (match_scratch:GPR 0 "=r,r,r,r"))]
4558 "<MODE>mode == Pmode && rs6000_gen_cell_microcode"
4561 sr<wd>i. %0,%1,%<hH>2
4564 "&& reload_completed"
4566 (lshiftrt:GPR (match_dup 1)
4569 (compare:CC (match_dup 0)
4572 [(set_attr "type" "shift")
4573 (set_attr "var_shift" "yes,no,yes,no")
4574 (set_attr "dot" "yes")
4575 (set_attr "length" "4,4,8,8")])
4577 (define_insn_and_split "*lshr<mode>3_dot2"
4578 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4579 (compare:CC (lshiftrt:GPR (match_operand:GPR 1 "gpc_reg_operand" "r,r,r,r")
4580 (match_operand:GPR 2 "reg_or_cint_operand" "r,n,r,n"))
4582 (set (match_operand:GPR 0 "gpc_reg_operand" "=r,r,r,r")
4583 (lshiftrt:GPR (match_dup 1)
4585 "<MODE>mode == Pmode && rs6000_gen_cell_microcode"
4588 sr<wd>i. %0,%1,%<hH>2
4591 "&& reload_completed"
4593 (lshiftrt:GPR (match_dup 1)
4596 (compare:CC (match_dup 0)
4599 [(set_attr "type" "shift")
4600 (set_attr "var_shift" "yes,no,yes,no")
4601 (set_attr "dot" "yes")
4602 (set_attr "length" "4,4,8,8")])
4606 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4607 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4608 (match_operand:SI 2 "const_int_operand" "i"))
4609 (match_operand:SI 3 "mask_operand" "n")))]
4610 "includes_rshift_p (operands[2], operands[3])"
4611 "rlwinm %0,%1,%s2,%m3,%M3"
4612 [(set_attr "type" "shift")])
4615 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4617 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4618 (match_operand:SI 2 "const_int_operand" "i,i"))
4619 (match_operand:SI 3 "mask_operand" "n,n"))
4621 (clobber (match_scratch:SI 4 "=r,r"))]
4622 "includes_rshift_p (operands[2], operands[3])"
4624 rlwinm. %4,%1,%s2,%m3,%M3
4626 [(set_attr "type" "shift")
4627 (set_attr "dot" "yes")
4628 (set_attr "length" "4,8")])
4631 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4633 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4634 (match_operand:SI 2 "const_int_operand" ""))
4635 (match_operand:SI 3 "mask_operand" ""))
4637 (clobber (match_scratch:SI 4 ""))]
4638 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
4640 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2))
4643 (compare:CC (match_dup 4)
4648 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4650 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4651 (match_operand:SI 2 "const_int_operand" "i,i"))
4652 (match_operand:SI 3 "mask_operand" "n,n"))
4654 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4655 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4656 "includes_rshift_p (operands[2], operands[3])"
4658 rlwinm. %0,%1,%s2,%m3,%M3
4660 [(set_attr "type" "shift")
4661 (set_attr "dot" "yes")
4662 (set_attr "length" "4,8")])
4665 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
4667 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4668 (match_operand:SI 2 "const_int_operand" ""))
4669 (match_operand:SI 3 "mask_operand" ""))
4671 (set (match_operand:SI 0 "gpc_reg_operand" "")
4672 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4673 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
4675 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4677 (compare:CC (match_dup 0)
4681 (define_insn "*lshiftrt_internal1le"
4682 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4685 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4686 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4687 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255))"
4688 "rlwinm %0,%1,%s2,0xff"
4689 [(set_attr "type" "shift")])
4691 (define_insn "*lshiftrt_internal1be"
4692 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4695 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4696 (match_operand:SI 2 "const_int_operand" "i")) 3)))]
4697 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255))"
4698 "rlwinm %0,%1,%s2,0xff"
4699 [(set_attr "type" "shift")])
4701 (define_insn "*lshiftrt_internal2le"
4702 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4706 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4707 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4709 (clobber (match_scratch:SI 3 "=r,r"))]
4710 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255))"
4712 rlwinm. %3,%1,%s2,0xff
4714 [(set_attr "type" "shift")
4715 (set_attr "dot" "yes")
4716 (set_attr "length" "4,8")])
4718 (define_insn "*lshiftrt_internal2be"
4719 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4723 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4724 (match_operand:SI 2 "const_int_operand" "i,i")) 3))
4726 (clobber (match_scratch:SI 3 "=r,r"))]
4727 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255))"
4729 rlwinm. %3,%1,%s2,0xff
4731 [(set_attr "type" "shift")
4732 (set_attr "dot" "yes")
4733 (set_attr "length" "4,8")])
4736 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4740 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4741 (match_operand:SI 2 "const_int_operand" "")) 0))
4743 (clobber (match_scratch:SI 3 ""))]
4744 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4746 (zero_extend:SI (subreg:QI
4747 (lshiftrt:SI (match_dup 1)
4750 (compare:CC (match_dup 3)
4755 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4759 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4760 (match_operand:SI 2 "const_int_operand" "")) 3))
4762 (clobber (match_scratch:SI 3 ""))]
4763 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4765 (zero_extend:SI (subreg:QI
4766 (lshiftrt:SI (match_dup 1)
4769 (compare:CC (match_dup 3)
4773 (define_insn "*lshiftrt_internal3le"
4774 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4778 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4779 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4781 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4782 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4783 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255))"
4785 rlwinm. %0,%1,%s2,0xff
4787 [(set_attr "type" "shift")
4788 (set_attr "dot" "yes")
4789 (set_attr "length" "4,8")])
4791 (define_insn "*lshiftrt_internal3be"
4792 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4796 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4797 (match_operand:SI 2 "const_int_operand" "i,i")) 3))
4799 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4800 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 3)))]
4801 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255))"
4803 rlwinm. %0,%1,%s2,0xff
4805 [(set_attr "type" "shift")
4806 (set_attr "dot" "yes")
4807 (set_attr "length" "4,8")])
4810 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4814 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4815 (match_operand:SI 2 "const_int_operand" "")) 0))
4817 (set (match_operand:SI 0 "gpc_reg_operand" "")
4818 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4819 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4821 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4823 (compare:CC (match_dup 0)
4828 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4832 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4833 (match_operand:SI 2 "const_int_operand" "")) 3))
4835 (set (match_operand:SI 0 "gpc_reg_operand" "")
4836 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 3)))]
4837 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4839 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 3)))
4841 (compare:CC (match_dup 0)
4845 (define_insn "*lshiftrt_internal4le"
4846 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4849 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4850 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4851 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535))"
4852 "rlwinm %0,%1,%s2,0xffff"
4853 [(set_attr "type" "shift")])
4855 (define_insn "*lshiftrt_internal4be"
4856 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4859 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4860 (match_operand:SI 2 "const_int_operand" "i")) 2)))]
4861 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535))"
4862 "rlwinm %0,%1,%s2,0xffff"
4863 [(set_attr "type" "shift")])
4865 (define_insn "*lshiftrt_internal5le"
4866 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4870 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4871 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4873 (clobber (match_scratch:SI 3 "=r,r"))]
4874 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535))"
4876 rlwinm. %3,%1,%s2,0xffff
4878 [(set_attr "type" "shift")
4879 (set_attr "dot" "yes")
4880 (set_attr "length" "4,8")])
4882 (define_insn "*lshiftrt_internal5be"
4883 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4887 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4888 (match_operand:SI 2 "const_int_operand" "i,i")) 2))
4890 (clobber (match_scratch:SI 3 "=r,r"))]
4891 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535))"
4893 rlwinm. %3,%1,%s2,0xffff
4895 [(set_attr "type" "shift")
4896 (set_attr "dot" "yes")
4897 (set_attr "length" "4,8")])
4900 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4904 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4905 (match_operand:SI 2 "const_int_operand" "")) 0))
4907 (clobber (match_scratch:SI 3 ""))]
4908 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4910 (zero_extend:SI (subreg:HI
4911 (lshiftrt:SI (match_dup 1)
4914 (compare:CC (match_dup 3)
4919 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4923 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4924 (match_operand:SI 2 "const_int_operand" "")) 2))
4926 (clobber (match_scratch:SI 3 ""))]
4927 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4929 (zero_extend:SI (subreg:HI
4930 (lshiftrt:SI (match_dup 1)
4933 (compare:CC (match_dup 3)
4937 (define_insn "*lshiftrt_internal5le"
4938 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4942 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4943 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4945 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4946 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4947 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535))"
4949 rlwinm. %0,%1,%s2,0xffff
4951 [(set_attr "type" "shift")
4952 (set_attr "dot" "yes")
4953 (set_attr "length" "4,8")])
4955 (define_insn "*lshiftrt_internal5be"
4956 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4960 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4961 (match_operand:SI 2 "const_int_operand" "i,i")) 2))
4963 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4964 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 2)))]
4965 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535))"
4967 rlwinm. %0,%1,%s2,0xffff
4969 [(set_attr "type" "shift")
4970 (set_attr "dot" "yes")
4971 (set_attr "length" "4,8")])
4974 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4978 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4979 (match_operand:SI 2 "const_int_operand" "")) 0))
4981 (set (match_operand:SI 0 "gpc_reg_operand" "")
4982 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4983 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4985 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4987 (compare:CC (match_dup 0)
4992 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4996 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4997 (match_operand:SI 2 "const_int_operand" "")) 2))
4999 (set (match_operand:SI 0 "gpc_reg_operand" "")
5000 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 2)))]
5001 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
5003 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 2)))
5005 (compare:CC (match_dup 0)
5010 (define_expand "ashr<mode>3"
5011 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
5012 (ashiftrt:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
5013 (match_operand:GPR 2 "reg_or_cint_operand" "")))]
5016 /* The generic code does not generate optimal code for the low word
5017 (it should be a rlwimi and a rot). Until we have target code to
5018 solve this generically, keep this expander. */
5020 if (<MODE>mode == DImode && !TARGET_POWERPC64)
5022 if (CONST_INT_P (operands[2]))
5024 emit_insn (gen_ashrdi3_no_power (operands[0], operands[1], operands[2]));
5032 (define_insn "*ashr<mode>3"
5033 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
5034 (ashiftrt:GPR (match_operand:GPR 1 "gpc_reg_operand" "r,r")
5035 (match_operand:GPR 2 "reg_or_cint_operand" "r,n")))]
5039 sra<wd>i %0,%1,%<hH>2"
5040 [(set_attr "type" "shift")
5041 (set_attr "var_shift" "yes,no")])
5043 (define_insn "*ashrsi3_64"
5044 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
5046 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5047 (match_operand:SI 2 "reg_or_cint_operand" "r,n"))))]
5052 [(set_attr "type" "shift")
5053 (set_attr "var_shift" "yes,no")])
5055 (define_insn_and_split "*ashr<mode>3_dot"
5056 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
5057 (compare:CC (ashiftrt:GPR (match_operand:GPR 1 "gpc_reg_operand" "r,r,r,r")
5058 (match_operand:GPR 2 "reg_or_cint_operand" "r,n,r,n"))
5060 (clobber (match_scratch:GPR 0 "=r,r,r,r"))]
5061 "<MODE>mode == Pmode && rs6000_gen_cell_microcode"
5064 sra<wd>i. %0,%1,%<hH>2
5067 "&& reload_completed"
5069 (ashiftrt:GPR (match_dup 1)
5072 (compare:CC (match_dup 0)
5075 [(set_attr "type" "shift")
5076 (set_attr "var_shift" "yes,no,yes,no")
5077 (set_attr "dot" "yes")
5078 (set_attr "length" "4,4,8,8")])
5080 (define_insn_and_split "*ashr<mode>3_dot2"
5081 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
5082 (compare:CC (ashiftrt:GPR (match_operand:GPR 1 "gpc_reg_operand" "r,r,r,r")
5083 (match_operand:GPR 2 "reg_or_cint_operand" "r,n,r,n"))
5085 (set (match_operand:GPR 0 "gpc_reg_operand" "=r,r,r,r")
5086 (ashiftrt:GPR (match_dup 1)
5088 "<MODE>mode == Pmode && rs6000_gen_cell_microcode"
5091 sra<wd>i. %0,%1,%<hH>2
5094 "&& reload_completed"
5096 (ashiftrt:GPR (match_dup 1)
5099 (compare:CC (match_dup 0)
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]);
5146 ;; Floating-point insns, excluding normal data motion. We combine the SF/DF
5147 ;; modes here, and also add in conditional vsx/power8-vector support to access
5148 ;; values in the traditional Altivec registers if the appropriate
5149 ;; -mupper-regs-{df,sf} option is enabled.
5151 (define_expand "abs<mode>2"
5152 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
5153 (abs:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")))]
5154 "TARGET_<MODE>_INSN"
5157 (define_insn "*abs<mode>2_fpr"
5158 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
5159 (abs:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")))]
5164 [(set_attr "type" "fp")
5165 (set_attr "fp_type" "fp_addsub_<Fs>")])
5167 (define_insn "*nabs<mode>2_fpr"
5168 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
5171 (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>"))))]
5176 [(set_attr "type" "fp")
5177 (set_attr "fp_type" "fp_addsub_<Fs>")])
5179 (define_expand "neg<mode>2"
5180 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
5181 (neg:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")))]
5182 "TARGET_<MODE>_INSN"
5185 (define_insn "*neg<mode>2_fpr"
5186 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
5187 (neg:SFDF (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 "add<mode>3"
5196 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
5197 (plus:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")
5198 (match_operand:SFDF 2 "gpc_reg_operand" "")))]
5199 "TARGET_<MODE>_INSN"
5202 (define_insn "*add<mode>3_fpr"
5203 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
5204 (plus:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "%<Ff>,<Fv>")
5205 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")))]
5208 fadd<Ftrad> %0,%1,%2
5209 xsadd<Fvsx> %x0,%x1,%x2"
5210 [(set_attr "type" "fp")
5211 (set_attr "fp_type" "fp_addsub_<Fs>")])
5213 (define_expand "sub<mode>3"
5214 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
5215 (minus:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")
5216 (match_operand:SFDF 2 "gpc_reg_operand" "")))]
5217 "TARGET_<MODE>_INSN"
5220 (define_insn "*sub<mode>3_fpr"
5221 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
5222 (minus:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")
5223 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")))]
5226 fsub<Ftrad> %0,%1,%2
5227 xssub<Fvsx> %x0,%x1,%x2"
5228 [(set_attr "type" "fp")
5229 (set_attr "fp_type" "fp_addsub_<Fs>")])
5231 (define_expand "mul<mode>3"
5232 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
5233 (mult:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")
5234 (match_operand:SFDF 2 "gpc_reg_operand" "")))]
5235 "TARGET_<MODE>_INSN"
5238 (define_insn "*mul<mode>3_fpr"
5239 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
5240 (mult:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "%<Ff>,<Fv>")
5241 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")))]
5244 fmul<Ftrad> %0,%1,%2
5245 xsmul<Fvsx> %x0,%x1,%x2"
5246 [(set_attr "type" "dmul")
5247 (set_attr "fp_type" "fp_mul_<Fs>")])
5249 (define_expand "div<mode>3"
5250 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
5251 (div:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")
5252 (match_operand:SFDF 2 "gpc_reg_operand" "")))]
5253 "TARGET_<MODE>_INSN && !TARGET_SIMPLE_FPU"
5256 (define_insn "*div<mode>3_fpr"
5257 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
5258 (div:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")
5259 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")))]
5260 "TARGET_<MODE>_FPR && !TARGET_SIMPLE_FPU"
5262 fdiv<Ftrad> %0,%1,%2
5263 xsdiv<Fvsx> %x0,%x1,%x2"
5264 [(set_attr "type" "<Fs>div")
5265 (set_attr "fp_type" "fp_div_<Fs>")])
5267 (define_insn "sqrt<mode>2"
5268 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
5269 (sqrt:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")))]
5270 "TARGET_<MODE>_FPR && !TARGET_SIMPLE_FPU
5271 && (TARGET_PPC_GPOPT || (<MODE>mode == SFmode && TARGET_XILINX_FPU))"
5274 xssqrt<Fvsx> %x0,%x1"
5275 [(set_attr "type" "<Fs>sqrt")
5276 (set_attr "fp_type" "fp_sqrt_<Fs>")])
5278 ;; Floating point reciprocal approximation
5279 (define_insn "fre<Fs>"
5280 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
5281 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")]
5287 [(set_attr "type" "fp")])
5289 (define_insn "*rsqrt<mode>2"
5290 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
5291 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")]
5293 "RS6000_RECIP_HAVE_RSQRTE_P (<MODE>mode)"
5295 frsqrte<Ftrad> %0,%1
5296 xsrsqrte<Fvsx> %x0,%x1"
5297 [(set_attr "type" "fp")])
5299 ;; Floating point comparisons
5300 (define_insn "*cmp<mode>_fpr"
5301 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y,y")
5302 (compare:CCFP (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")
5303 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")))]
5307 xscmpudp %0,%x1,%x2"
5308 [(set_attr "type" "fpcompare")])
5310 ;; Floating point conversions
5311 (define_expand "extendsfdf2"
5312 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5313 (float_extend:DF (match_operand:SF 1 "reg_or_none500mem_operand" "")))]
5314 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5317 (define_insn_and_split "*extendsfdf2_fpr"
5318 [(set (match_operand:DF 0 "gpc_reg_operand" "=d,?d,d,ws,?ws,wv")
5319 (float_extend:DF (match_operand:SF 1 "reg_or_mem_operand" "0,f,m,0,wy,Z")))]
5320 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5328 "&& reload_completed && REG_P (operands[1]) && REGNO (operands[0]) == REGNO (operands[1])"
5331 emit_note (NOTE_INSN_DELETED);
5334 [(set_attr "type" "fp,fp,fpload,fp,vecsimple,fpload")])
5336 (define_expand "truncdfsf2"
5337 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5338 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "")))]
5339 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5342 (define_insn "*truncdfsf2_fpr"
5343 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5344 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "d")))]
5345 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5347 [(set_attr "type" "fp")])
5349 ;; This expander is here to avoid FLOAT_WORDS_BIGENDIAN tests in
5350 ;; builtins.c and optabs.c that are not correct for IBM long double
5351 ;; when little-endian.
5352 (define_expand "signbittf2"
5354 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "")))
5356 (subreg:DI (match_dup 2) 0))
5359 (set (match_operand:SI 0 "gpc_reg_operand" "")
5362 && TARGET_HARD_FLOAT
5363 && (TARGET_FPRS || TARGET_E500_DOUBLE)
5364 && TARGET_LONG_DOUBLE_128"
5366 operands[2] = gen_reg_rtx (DFmode);
5367 operands[3] = gen_reg_rtx (DImode);
5368 if (TARGET_POWERPC64)
5370 operands[4] = gen_reg_rtx (DImode);
5371 operands[5] = gen_rtx_LSHIFTRT (DImode, operands[3], GEN_INT (63));
5372 operands[6] = gen_rtx_SUBREG (SImode, operands[4],
5373 WORDS_BIG_ENDIAN ? 4 : 0);
5377 operands[4] = gen_reg_rtx (SImode);
5378 operands[5] = gen_rtx_SUBREG (SImode, operands[3],
5379 WORDS_BIG_ENDIAN ? 0 : 4);
5380 operands[6] = gen_rtx_LSHIFTRT (SImode, operands[4], GEN_INT (31));
5384 (define_expand "copysign<mode>3"
5386 (abs:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")))
5388 (neg:SFDF (abs:SFDF (match_dup 1))))
5389 (set (match_operand:SFDF 0 "gpc_reg_operand" "")
5390 (if_then_else:SFDF (ge (match_operand:SFDF 2 "gpc_reg_operand" "")
5394 "TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>
5395 && ((TARGET_PPC_GFXOPT
5396 && !HONOR_NANS (<MODE>mode)
5397 && !HONOR_SIGNED_ZEROS (<MODE>mode))
5399 || VECTOR_UNIT_VSX_P (<MODE>mode))"
5401 if (TARGET_CMPB || VECTOR_UNIT_VSX_P (<MODE>mode))
5403 emit_insn (gen_copysign<mode>3_fcpsgn (operands[0], operands[1],
5408 operands[3] = gen_reg_rtx (<MODE>mode);
5409 operands[4] = gen_reg_rtx (<MODE>mode);
5410 operands[5] = CONST0_RTX (<MODE>mode);
5413 ;; Use an unspec rather providing an if-then-else in RTL, to prevent the
5414 ;; compiler from optimizing -0.0
5415 (define_insn "copysign<mode>3_fcpsgn"
5416 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
5417 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")
5418 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")]
5420 "TARGET_<MODE>_FPR && TARGET_CMPB"
5423 xscpsgn<Fvsx> %x0,%x2,%x1"
5424 [(set_attr "type" "fp")])
5426 ;; For MIN, MAX, and conditional move, we use DEFINE_EXPAND's that involve a
5427 ;; fsel instruction and some auxiliary computations. Then we just have a
5428 ;; single DEFINE_INSN for fsel and the define_splits to make them if made by
5430 ;; For MIN, MAX on non-VSX machines, and conditional move all of the time, we
5431 ;; use DEFINE_EXPAND's that involve a fsel instruction and some auxiliary
5432 ;; computations. Then we just have a single DEFINE_INSN for fsel and the
5433 ;; define_splits to make them if made by combine. On VSX machines we have the
5434 ;; min/max instructions.
5436 ;; On VSX, we only check for TARGET_VSX instead of checking for a vsx/p8 vector
5437 ;; to allow either DF/SF to use only traditional registers.
5439 (define_expand "smax<mode>3"
5440 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
5441 (if_then_else:SFDF (ge (match_operand:SFDF 1 "gpc_reg_operand" "")
5442 (match_operand:SFDF 2 "gpc_reg_operand" ""))
5445 "TARGET_<MODE>_FPR && TARGET_PPC_GFXOPT && !flag_trapping_math"
5447 rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]);
5451 (define_insn "*smax<mode>3_vsx"
5452 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
5453 (smax:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "%<Ff>,<Fv>")
5454 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")))]
5455 "TARGET_<MODE>_FPR && TARGET_VSX"
5456 "xsmaxdp %x0,%x1,%x2"
5457 [(set_attr "type" "fp")])
5459 (define_expand "smin<mode>3"
5460 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
5461 (if_then_else:SFDF (ge (match_operand:SFDF 1 "gpc_reg_operand" "")
5462 (match_operand:SFDF 2 "gpc_reg_operand" ""))
5465 "TARGET_<MODE>_FPR && TARGET_PPC_GFXOPT && !flag_trapping_math"
5467 rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]);
5471 (define_insn "*smin<mode>3_vsx"
5472 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
5473 (smin:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "%<Ff>,<Fv>")
5474 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")))]
5475 "TARGET_<MODE>_FPR && TARGET_VSX"
5476 "xsmindp %x0,%x1,%x2"
5477 [(set_attr "type" "fp")])
5480 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
5481 (match_operator:SFDF 3 "min_max_operator"
5482 [(match_operand:SFDF 1 "gpc_reg_operand" "")
5483 (match_operand:SFDF 2 "gpc_reg_operand" "")]))]
5484 "TARGET_<MODE>_FPR && TARGET_PPC_GFXOPT && !flag_trapping_math
5488 rs6000_emit_minmax (operands[0], GET_CODE (operands[3]), operands[1],
5494 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5495 (match_operator:SF 3 "min_max_operator"
5496 [(match_operand:SF 1 "gpc_reg_operand" "")
5497 (match_operand:SF 2 "gpc_reg_operand" "")]))]
5498 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
5499 && TARGET_SINGLE_FLOAT && !flag_trapping_math"
5502 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
5503 operands[1], operands[2]);
5507 (define_expand "mov<mode>cc"
5508 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
5509 (if_then_else:GPR (match_operand 1 "comparison_operator" "")
5510 (match_operand:GPR 2 "gpc_reg_operand" "")
5511 (match_operand:GPR 3 "gpc_reg_operand" "")))]
5515 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5521 ;; We use the BASE_REGS for the isel input operands because, if rA is
5522 ;; 0, the value of 0 is placed in rD upon truth. Similarly for rB
5523 ;; because we may switch the operands and rB may end up being rA.
5525 ;; We need 2 patterns: an unsigned and a signed pattern. We could
5526 ;; leave out the mode in operand 4 and use one pattern, but reload can
5527 ;; change the mode underneath our feet and then gets confused trying
5528 ;; to reload the value.
5529 (define_insn "isel_signed_<mode>"
5530 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
5532 (match_operator 1 "scc_comparison_operator"
5533 [(match_operand:CC 4 "cc_reg_operand" "y,y")
5535 (match_operand:GPR 2 "reg_or_cint_operand" "O,b")
5536 (match_operand:GPR 3 "gpc_reg_operand" "r,r")))]
5539 { return output_isel (operands); }"
5540 [(set_attr "type" "isel")
5541 (set_attr "length" "4")])
5543 (define_insn "isel_unsigned_<mode>"
5544 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
5546 (match_operator 1 "scc_comparison_operator"
5547 [(match_operand:CCUNS 4 "cc_reg_operand" "y,y")
5549 (match_operand:GPR 2 "reg_or_cint_operand" "O,b")
5550 (match_operand:GPR 3 "gpc_reg_operand" "r,r")))]
5553 { return output_isel (operands); }"
5554 [(set_attr "type" "isel")
5555 (set_attr "length" "4")])
5557 ;; These patterns can be useful for combine; they let combine know that
5558 ;; isel can handle reversed comparisons so long as the operands are
5561 (define_insn "*isel_reversed_signed_<mode>"
5562 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
5564 (match_operator 1 "scc_rev_comparison_operator"
5565 [(match_operand:CC 4 "cc_reg_operand" "y")
5567 (match_operand:GPR 2 "gpc_reg_operand" "b")
5568 (match_operand:GPR 3 "gpc_reg_operand" "b")))]
5571 { return output_isel (operands); }"
5572 [(set_attr "type" "isel")
5573 (set_attr "length" "4")])
5575 (define_insn "*isel_reversed_unsigned_<mode>"
5576 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
5578 (match_operator 1 "scc_rev_comparison_operator"
5579 [(match_operand:CCUNS 4 "cc_reg_operand" "y")
5581 (match_operand:GPR 2 "gpc_reg_operand" "b")
5582 (match_operand:GPR 3 "gpc_reg_operand" "b")))]
5585 { return output_isel (operands); }"
5586 [(set_attr "type" "isel")
5587 (set_attr "length" "4")])
5589 (define_expand "movsfcc"
5590 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5591 (if_then_else:SF (match_operand 1 "comparison_operator" "")
5592 (match_operand:SF 2 "gpc_reg_operand" "")
5593 (match_operand:SF 3 "gpc_reg_operand" "")))]
5594 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5597 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5603 (define_insn "*fselsfsf4"
5604 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5605 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
5606 (match_operand:SF 4 "zero_fp_constant" "F"))
5607 (match_operand:SF 2 "gpc_reg_operand" "f")
5608 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5609 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5611 [(set_attr "type" "fp")])
5613 (define_insn "*fseldfsf4"
5614 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5615 (if_then_else:SF (ge (match_operand:DF 1 "gpc_reg_operand" "d")
5616 (match_operand:DF 4 "zero_fp_constant" "F"))
5617 (match_operand:SF 2 "gpc_reg_operand" "f")
5618 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5619 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_SINGLE_FLOAT"
5621 [(set_attr "type" "fp")])
5623 ;; The conditional move instructions allow us to perform max and min
5624 ;; operations even when
5627 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5628 (match_operator:DF 3 "min_max_operator"
5629 [(match_operand:DF 1 "gpc_reg_operand" "")
5630 (match_operand:DF 2 "gpc_reg_operand" "")]))]
5631 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5632 && !flag_trapping_math"
5635 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
5636 operands[1], operands[2]);
5640 (define_expand "movdfcc"
5641 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5642 (if_then_else:DF (match_operand 1 "comparison_operator" "")
5643 (match_operand:DF 2 "gpc_reg_operand" "")
5644 (match_operand:DF 3 "gpc_reg_operand" "")))]
5645 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5648 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5654 (define_insn "*fseldfdf4"
5655 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
5656 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "d")
5657 (match_operand:DF 4 "zero_fp_constant" "F"))
5658 (match_operand:DF 2 "gpc_reg_operand" "d")
5659 (match_operand:DF 3 "gpc_reg_operand" "d")))]
5660 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5662 [(set_attr "type" "fp")])
5664 (define_insn "*fselsfdf4"
5665 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
5666 (if_then_else:DF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
5667 (match_operand:SF 4 "zero_fp_constant" "F"))
5668 (match_operand:DF 2 "gpc_reg_operand" "d")
5669 (match_operand:DF 3 "gpc_reg_operand" "d")))]
5670 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_SINGLE_FLOAT"
5672 [(set_attr "type" "fp")])
5674 ;; Conversions to and from floating-point.
5676 ; We don't define lfiwax/lfiwzx with the normal definition, because we
5677 ; don't want to support putting SImode in FPR registers.
5678 (define_insn "lfiwax"
5679 [(set (match_operand:DI 0 "gpc_reg_operand" "=d,wm,!wm")
5680 (unspec:DI [(match_operand:SI 1 "reg_or_indexed_operand" "Z,Z,r")]
5682 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWAX"
5687 [(set_attr "type" "fpload,fpload,mffgpr")])
5689 ; This split must be run before register allocation because it allocates the
5690 ; memory slot that is needed to move values to/from the FPR. We don't allocate
5691 ; it earlier to allow for the combiner to merge insns together where it might
5692 ; not be needed and also in case the insns are deleted as dead code.
5694 (define_insn_and_split "floatsi<mode>2_lfiwax"
5695 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d")
5696 (float:SFDF (match_operand:SI 1 "nonimmediate_operand" "r")))
5697 (clobber (match_scratch:DI 2 "=d"))]
5698 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWAX
5699 && <SI_CONVERT_FP> && can_create_pseudo_p ()"
5705 rtx dest = operands[0];
5706 rtx src = operands[1];
5709 if (!MEM_P (src) && TARGET_POWERPC64
5710 && (TARGET_MFPGPR || TARGET_DIRECT_MOVE))
5711 tmp = convert_to_mode (DImode, src, false);
5715 if (GET_CODE (tmp) == SCRATCH)
5716 tmp = gen_reg_rtx (DImode);
5719 src = rs6000_address_for_fpconvert (src);
5720 emit_insn (gen_lfiwax (tmp, src));
5724 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
5725 emit_move_insn (stack, src);
5726 emit_insn (gen_lfiwax (tmp, stack));
5729 emit_insn (gen_floatdi<mode>2 (dest, tmp));
5732 [(set_attr "length" "12")
5733 (set_attr "type" "fpload")])
5735 (define_insn_and_split "floatsi<mode>2_lfiwax_mem"
5736 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d,<rreg2>")
5739 (match_operand:SI 1 "memory_operand" "Z,Z"))))
5740 (clobber (match_scratch:DI 2 "=0,d"))]
5741 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWAX
5748 operands[1] = rs6000_address_for_fpconvert (operands[1]);
5749 if (GET_CODE (operands[2]) == SCRATCH)
5750 operands[2] = gen_reg_rtx (DImode);
5751 emit_insn (gen_lfiwax (operands[2], operands[1]));
5752 emit_insn (gen_floatdi<mode>2 (operands[0], operands[2]));
5755 [(set_attr "length" "8")
5756 (set_attr "type" "fpload")])
5758 (define_insn "lfiwzx"
5759 [(set (match_operand:DI 0 "gpc_reg_operand" "=d,wm,!wm")
5760 (unspec:DI [(match_operand:SI 1 "reg_or_indexed_operand" "Z,Z,r")]
5762 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWZX"
5767 [(set_attr "type" "fpload,fpload,mftgpr")])
5769 (define_insn_and_split "floatunssi<mode>2_lfiwzx"
5770 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d")
5771 (unsigned_float:SFDF (match_operand:SI 1 "nonimmediate_operand" "r")))
5772 (clobber (match_scratch:DI 2 "=d"))]
5773 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWZX
5780 rtx dest = operands[0];
5781 rtx src = operands[1];
5784 if (!MEM_P (src) && TARGET_POWERPC64
5785 && (TARGET_MFPGPR || TARGET_DIRECT_MOVE))
5786 tmp = convert_to_mode (DImode, src, true);
5790 if (GET_CODE (tmp) == SCRATCH)
5791 tmp = gen_reg_rtx (DImode);
5794 src = rs6000_address_for_fpconvert (src);
5795 emit_insn (gen_lfiwzx (tmp, src));
5799 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
5800 emit_move_insn (stack, src);
5801 emit_insn (gen_lfiwzx (tmp, stack));
5804 emit_insn (gen_floatdi<mode>2 (dest, tmp));
5807 [(set_attr "length" "12")
5808 (set_attr "type" "fpload")])
5810 (define_insn_and_split "floatunssi<mode>2_lfiwzx_mem"
5811 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d,<rreg2>")
5812 (unsigned_float:SFDF
5814 (match_operand:SI 1 "memory_operand" "Z,Z"))))
5815 (clobber (match_scratch:DI 2 "=0,d"))]
5816 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWZX
5823 operands[1] = rs6000_address_for_fpconvert (operands[1]);
5824 if (GET_CODE (operands[2]) == SCRATCH)
5825 operands[2] = gen_reg_rtx (DImode);
5826 emit_insn (gen_lfiwzx (operands[2], operands[1]));
5827 emit_insn (gen_floatdi<mode>2 (operands[0], operands[2]));
5830 [(set_attr "length" "8")
5831 (set_attr "type" "fpload")])
5833 ; For each of these conversions, there is a define_expand, a define_insn
5834 ; with a '#' template, and a define_split (with C code). The idea is
5835 ; to allow constant folding with the template of the define_insn,
5836 ; then to have the insns split later (between sched1 and final).
5838 (define_expand "floatsidf2"
5839 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5840 (float:DF (match_operand:SI 1 "nonimmediate_operand" "")))
5843 (clobber (match_dup 4))
5844 (clobber (match_dup 5))
5845 (clobber (match_dup 6))])]
5847 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5850 if (TARGET_E500_DOUBLE)
5852 if (!REG_P (operands[1]))
5853 operands[1] = force_reg (SImode, operands[1]);
5854 emit_insn (gen_spe_floatsidf2 (operands[0], operands[1]));
5857 else if (TARGET_LFIWAX && TARGET_FCFID)
5859 emit_insn (gen_floatsidf2_lfiwax (operands[0], operands[1]));
5862 else if (TARGET_FCFID)
5864 rtx dreg = operands[1];
5866 dreg = force_reg (SImode, dreg);
5867 dreg = convert_to_mode (DImode, dreg, false);
5868 emit_insn (gen_floatdidf2 (operands[0], dreg));
5872 if (!REG_P (operands[1]))
5873 operands[1] = force_reg (SImode, operands[1]);
5874 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5875 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503601774854144\", DFmode));
5876 operands[4] = rs6000_allocate_stack_temp (DFmode, true, false);
5877 operands[5] = gen_reg_rtx (DFmode);
5878 operands[6] = gen_reg_rtx (SImode);
5881 (define_insn_and_split "*floatsidf2_internal"
5882 [(set (match_operand:DF 0 "gpc_reg_operand" "=&d")
5883 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5884 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5885 (use (match_operand:DF 3 "gpc_reg_operand" "d"))
5886 (clobber (match_operand:DF 4 "offsettable_mem_operand" "=o"))
5887 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&d"))
5888 (clobber (match_operand:SI 6 "gpc_reg_operand" "=&r"))]
5889 "! TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5895 rtx lowword, highword;
5896 gcc_assert (MEM_P (operands[4]));
5897 highword = adjust_address (operands[4], SImode, 0);
5898 lowword = adjust_address (operands[4], SImode, 4);
5899 if (! WORDS_BIG_ENDIAN)
5902 tmp = highword; highword = lowword; lowword = tmp;
5905 emit_insn (gen_xorsi3 (operands[6], operands[1],
5906 GEN_INT (~ (HOST_WIDE_INT) 0x7fffffff)));
5907 emit_move_insn (lowword, operands[6]);
5908 emit_move_insn (highword, operands[2]);
5909 emit_move_insn (operands[5], operands[4]);
5910 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5913 [(set_attr "length" "24")
5914 (set_attr "type" "fp")])
5916 ;; If we don't have a direct conversion to single precision, don't enable this
5917 ;; conversion for 32-bit without fast math, because we don't have the insn to
5918 ;; generate the fixup swizzle to avoid double rounding problems.
5919 (define_expand "floatunssisf2"
5920 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5921 (unsigned_float:SF (match_operand:SI 1 "nonimmediate_operand" "")))]
5922 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT
5925 && ((TARGET_FCFIDUS && TARGET_LFIWZX)
5926 || (TARGET_DOUBLE_FLOAT && TARGET_FCFID
5927 && (TARGET_POWERPC64 || flag_unsafe_math_optimizations)))))"
5932 if (!REG_P (operands[1]))
5933 operands[1] = force_reg (SImode, operands[1]);
5935 else if (TARGET_LFIWZX && TARGET_FCFIDUS)
5937 emit_insn (gen_floatunssisf2_lfiwzx (operands[0], operands[1]));
5942 rtx dreg = operands[1];
5944 dreg = force_reg (SImode, dreg);
5945 dreg = convert_to_mode (DImode, dreg, true);
5946 emit_insn (gen_floatdisf2 (operands[0], dreg));
5951 (define_expand "floatunssidf2"
5952 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5953 (unsigned_float:DF (match_operand:SI 1 "nonimmediate_operand" "")))
5956 (clobber (match_dup 4))
5957 (clobber (match_dup 5))])]
5959 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5962 if (TARGET_E500_DOUBLE)
5964 if (!REG_P (operands[1]))
5965 operands[1] = force_reg (SImode, operands[1]);
5966 emit_insn (gen_spe_floatunssidf2 (operands[0], operands[1]));
5969 else if (TARGET_LFIWZX && TARGET_FCFID)
5971 emit_insn (gen_floatunssidf2_lfiwzx (operands[0], operands[1]));
5974 else if (TARGET_FCFID)
5976 rtx dreg = operands[1];
5978 dreg = force_reg (SImode, dreg);
5979 dreg = convert_to_mode (DImode, dreg, true);
5980 emit_insn (gen_floatdidf2 (operands[0], dreg));
5984 if (!REG_P (operands[1]))
5985 operands[1] = force_reg (SImode, operands[1]);
5986 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5987 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503599627370496\", DFmode));
5988 operands[4] = rs6000_allocate_stack_temp (DFmode, true, false);
5989 operands[5] = gen_reg_rtx (DFmode);
5992 (define_insn_and_split "*floatunssidf2_internal"
5993 [(set (match_operand:DF 0 "gpc_reg_operand" "=&d")
5994 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5995 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5996 (use (match_operand:DF 3 "gpc_reg_operand" "d"))
5997 (clobber (match_operand:DF 4 "offsettable_mem_operand" "=o"))
5998 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&d"))]
5999 "! TARGET_FCFIDU && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6000 && !(TARGET_FCFID && TARGET_POWERPC64)"
6006 rtx lowword, highword;
6007 gcc_assert (MEM_P (operands[4]));
6008 highword = adjust_address (operands[4], SImode, 0);
6009 lowword = adjust_address (operands[4], SImode, 4);
6010 if (! WORDS_BIG_ENDIAN)
6013 tmp = highword; highword = lowword; lowword = tmp;
6016 emit_move_insn (lowword, operands[1]);
6017 emit_move_insn (highword, operands[2]);
6018 emit_move_insn (operands[5], operands[4]);
6019 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
6022 [(set_attr "length" "20")
6023 (set_attr "type" "fp")])
6025 (define_expand "fix_trunc<mode>si2"
6026 [(set (match_operand:SI 0 "gpc_reg_operand" "")
6027 (fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "")))]
6028 "TARGET_HARD_FLOAT && ((TARGET_FPRS && <TARGET_FLOAT>) || <E500_CONVERT>)"
6031 if (!<E500_CONVERT>)
6036 emit_insn (gen_fix_trunc<mode>si2_stfiwx (operands[0], operands[1]));
6039 tmp = gen_reg_rtx (DImode);
6040 stack = rs6000_allocate_stack_temp (DImode, true, false);
6041 emit_insn (gen_fix_trunc<mode>si2_internal (operands[0], operands[1],
6048 ; Like the convert to float patterns, this insn must be split before
6049 ; register allocation so that it can allocate the memory slot if it
6051 (define_insn_and_split "fix_trunc<mode>si2_stfiwx"
6052 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
6053 (fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d")))
6054 (clobber (match_scratch:DI 2 "=d"))]
6055 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6056 && (<MODE>mode != SFmode || TARGET_SINGLE_FLOAT)
6057 && TARGET_STFIWX && can_create_pseudo_p ()"
6062 rtx dest = operands[0];
6063 rtx src = operands[1];
6064 rtx tmp = operands[2];
6066 if (GET_CODE (tmp) == SCRATCH)
6067 tmp = gen_reg_rtx (DImode);
6069 emit_insn (gen_fctiwz_<mode> (tmp, src));
6072 dest = rs6000_address_for_fpconvert (dest);
6073 emit_insn (gen_stfiwx (dest, tmp));
6076 else if (TARGET_POWERPC64 && (TARGET_MFPGPR || TARGET_DIRECT_MOVE))
6078 dest = gen_lowpart (DImode, dest);
6079 emit_move_insn (dest, tmp);
6084 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
6085 emit_insn (gen_stfiwx (stack, tmp));
6086 emit_move_insn (dest, stack);
6090 [(set_attr "length" "12")
6091 (set_attr "type" "fp")])
6093 (define_insn_and_split "fix_trunc<mode>si2_internal"
6094 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,?r")
6095 (fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d,<rreg>")))
6096 (clobber (match_operand:DI 2 "gpc_reg_operand" "=1,d"))
6097 (clobber (match_operand:DI 3 "offsettable_mem_operand" "=o,o"))]
6098 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6105 gcc_assert (MEM_P (operands[3]));
6106 lowword = adjust_address (operands[3], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
6108 emit_insn (gen_fctiwz_<mode> (operands[2], operands[1]));
6109 emit_move_insn (operands[3], operands[2]);
6110 emit_move_insn (operands[0], lowword);
6113 [(set_attr "length" "16")
6114 (set_attr "type" "fp")])
6116 (define_expand "fix_trunc<mode>di2"
6117 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6118 (fix:DI (match_operand:SFDF 1 "gpc_reg_operand" "")))]
6119 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
6123 (define_insn "*fix_trunc<mode>di2_fctidz"
6124 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6125 (fix:DI (match_operand:SFDF 1 "gpc_reg_operand" "d")))]
6126 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
6127 && TARGET_FCFID && !VECTOR_UNIT_VSX_P (<MODE>mode)"
6129 [(set_attr "type" "fp")])
6131 (define_expand "fixuns_trunc<mode>si2"
6132 [(set (match_operand:SI 0 "gpc_reg_operand" "")
6133 (unsigned_fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "")))]
6135 && ((TARGET_FPRS && <TARGET_FLOAT> && TARGET_FCTIWUZ && TARGET_STFIWX)
6139 if (!<E500_CONVERT>)
6141 emit_insn (gen_fixuns_trunc<mode>si2_stfiwx (operands[0], operands[1]));
6146 (define_insn_and_split "fixuns_trunc<mode>si2_stfiwx"
6147 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
6148 (unsigned_fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d")))
6149 (clobber (match_scratch:DI 2 "=d"))]
6150 "TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT> && TARGET_FCTIWUZ
6151 && TARGET_STFIWX && can_create_pseudo_p ()"
6156 rtx dest = operands[0];
6157 rtx src = operands[1];
6158 rtx tmp = operands[2];
6160 if (GET_CODE (tmp) == SCRATCH)
6161 tmp = gen_reg_rtx (DImode);
6163 emit_insn (gen_fctiwuz_<mode> (tmp, src));
6166 dest = rs6000_address_for_fpconvert (dest);
6167 emit_insn (gen_stfiwx (dest, tmp));
6170 else if (TARGET_POWERPC64 && (TARGET_MFPGPR || TARGET_DIRECT_MOVE))
6172 dest = gen_lowpart (DImode, dest);
6173 emit_move_insn (dest, tmp);
6178 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
6179 emit_insn (gen_stfiwx (stack, tmp));
6180 emit_move_insn (dest, stack);
6184 [(set_attr "length" "12")
6185 (set_attr "type" "fp")])
6187 (define_expand "fixuns_trunc<mode>di2"
6188 [(set (match_operand:DI 0 "register_operand" "")
6189 (unsigned_fix:DI (match_operand:SFDF 1 "register_operand" "")))]
6190 "TARGET_HARD_FLOAT && (TARGET_FCTIDUZ || VECTOR_UNIT_VSX_P (<MODE>mode))"
6193 (define_insn "*fixuns_trunc<mode>di2_fctiduz"
6194 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6195 (unsigned_fix:DI (match_operand:SFDF 1 "gpc_reg_operand" "d")))]
6196 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
6197 && TARGET_FCTIDUZ && !VECTOR_UNIT_VSX_P (<MODE>mode)"
6199 [(set_attr "type" "fp")])
6201 ; Here, we use (set (reg) (unspec:DI [(fix:SI ...)] UNSPEC_FCTIWZ))
6202 ; rather than (set (subreg:SI (reg)) (fix:SI ...))
6203 ; because the first makes it clear that operand 0 is not live
6204 ; before the instruction.
6205 (define_insn "fctiwz_<mode>"
6206 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6207 (unspec:DI [(fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d"))]
6209 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6211 [(set_attr "type" "fp")])
6213 (define_insn "fctiwuz_<mode>"
6214 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6215 (unspec:DI [(unsigned_fix:SI
6216 (match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>"))]
6218 "TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT> && TARGET_FCTIWUZ"
6220 [(set_attr "type" "fp")])
6222 ;; Only optimize (float (fix x)) -> frz if we are in fast-math mode, since
6223 ;; since the friz instruction does not truncate the value if the floating
6224 ;; point value is < LONG_MIN or > LONG_MAX.
6225 (define_insn "*friz"
6226 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6227 (float:DF (fix:DI (match_operand:DF 1 "gpc_reg_operand" "d"))))]
6228 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_FPRND
6229 && !VECTOR_UNIT_VSX_P (DFmode) && flag_unsafe_math_optimizations
6230 && !flag_trapping_math && TARGET_FRIZ"
6232 [(set_attr "type" "fp")])
6234 ;; Since FCTIWZ doesn't sign extend the upper bits, we have to do a store and a
6235 ;; load to properly sign extend the value, but at least doing a store, load
6236 ;; into a GPR to sign extend, a store from the GPR and a load back into the FPR
6237 ;; if we have 32-bit memory ops
6238 (define_insn_and_split "*round32<mode>2_fprs"
6239 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d")
6241 (fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d"))))
6242 (clobber (match_scratch:DI 2 "=d"))
6243 (clobber (match_scratch:DI 3 "=d"))]
6244 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6245 && <SI_CONVERT_FP> && TARGET_LFIWAX && TARGET_STFIWX && TARGET_FCFID
6246 && can_create_pseudo_p ()"
6251 rtx dest = operands[0];
6252 rtx src = operands[1];
6253 rtx tmp1 = operands[2];
6254 rtx tmp2 = operands[3];
6255 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
6257 if (GET_CODE (tmp1) == SCRATCH)
6258 tmp1 = gen_reg_rtx (DImode);
6259 if (GET_CODE (tmp2) == SCRATCH)
6260 tmp2 = gen_reg_rtx (DImode);
6262 emit_insn (gen_fctiwz_<mode> (tmp1, src));
6263 emit_insn (gen_stfiwx (stack, tmp1));
6264 emit_insn (gen_lfiwax (tmp2, stack));
6265 emit_insn (gen_floatdi<mode>2 (dest, tmp2));
6268 [(set_attr "type" "fpload")
6269 (set_attr "length" "16")])
6271 (define_insn_and_split "*roundu32<mode>2_fprs"
6272 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d")
6273 (unsigned_float:SFDF
6274 (unsigned_fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d"))))
6275 (clobber (match_scratch:DI 2 "=d"))
6276 (clobber (match_scratch:DI 3 "=d"))]
6277 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6278 && TARGET_LFIWZX && TARGET_STFIWX && TARGET_FCFIDU
6279 && can_create_pseudo_p ()"
6284 rtx dest = operands[0];
6285 rtx src = operands[1];
6286 rtx tmp1 = operands[2];
6287 rtx tmp2 = operands[3];
6288 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
6290 if (GET_CODE (tmp1) == SCRATCH)
6291 tmp1 = gen_reg_rtx (DImode);
6292 if (GET_CODE (tmp2) == SCRATCH)
6293 tmp2 = gen_reg_rtx (DImode);
6295 emit_insn (gen_fctiwuz_<mode> (tmp1, src));
6296 emit_insn (gen_stfiwx (stack, tmp1));
6297 emit_insn (gen_lfiwzx (tmp2, stack));
6298 emit_insn (gen_floatdi<mode>2 (dest, tmp2));
6301 [(set_attr "type" "fpload")
6302 (set_attr "length" "16")])
6304 ;; No VSX equivalent to fctid
6305 (define_insn "lrint<mode>di2"
6306 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6307 (unspec:DI [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
6309 "TARGET_<MODE>_FPR && TARGET_FPRND"
6311 [(set_attr "type" "fp")])
6313 (define_insn "btrunc<mode>2"
6314 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
6315 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")]
6317 "TARGET_<MODE>_FPR && TARGET_FPRND"
6321 [(set_attr "type" "fp")
6322 (set_attr "fp_type" "fp_addsub_<Fs>")])
6324 (define_insn "ceil<mode>2"
6325 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
6326 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")]
6328 "TARGET_<MODE>_FPR && TARGET_FPRND"
6332 [(set_attr "type" "fp")
6333 (set_attr "fp_type" "fp_addsub_<Fs>")])
6335 (define_insn "floor<mode>2"
6336 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
6337 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")]
6339 "TARGET_<MODE>_FPR && TARGET_FPRND"
6343 [(set_attr "type" "fp")
6344 (set_attr "fp_type" "fp_addsub_<Fs>")])
6346 ;; No VSX equivalent to frin
6347 (define_insn "round<mode>2"
6348 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
6349 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
6351 "TARGET_<MODE>_FPR && TARGET_FPRND"
6353 [(set_attr "type" "fp")
6354 (set_attr "fp_type" "fp_addsub_<Fs>")])
6356 ; An UNSPEC is used so we don't have to support SImode in FP registers.
6357 (define_insn "stfiwx"
6358 [(set (match_operand:SI 0 "memory_operand" "=Z")
6359 (unspec:SI [(match_operand:DI 1 "gpc_reg_operand" "d")]
6363 [(set_attr "type" "fpstore")])
6365 ;; If we don't have a direct conversion to single precision, don't enable this
6366 ;; conversion for 32-bit without fast math, because we don't have the insn to
6367 ;; generate the fixup swizzle to avoid double rounding problems.
6368 (define_expand "floatsisf2"
6369 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6370 (float:SF (match_operand:SI 1 "nonimmediate_operand" "")))]
6371 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT
6374 && ((TARGET_FCFIDS && TARGET_LFIWAX)
6375 || (TARGET_DOUBLE_FLOAT && TARGET_FCFID
6376 && (TARGET_POWERPC64 || flag_unsafe_math_optimizations)))))"
6381 if (!REG_P (operands[1]))
6382 operands[1] = force_reg (SImode, operands[1]);
6384 else if (TARGET_FCFIDS && TARGET_LFIWAX)
6386 emit_insn (gen_floatsisf2_lfiwax (operands[0], operands[1]));
6389 else if (TARGET_FCFID && TARGET_LFIWAX)
6391 rtx dfreg = gen_reg_rtx (DFmode);
6392 emit_insn (gen_floatsidf2_lfiwax (dfreg, operands[1]));
6393 emit_insn (gen_truncdfsf2 (operands[0], dfreg));
6398 rtx dreg = operands[1];
6400 dreg = force_reg (SImode, dreg);
6401 dreg = convert_to_mode (DImode, dreg, false);
6402 emit_insn (gen_floatdisf2 (operands[0], dreg));
6407 (define_expand "floatdidf2"
6408 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6409 (float:DF (match_operand:DI 1 "gpc_reg_operand" "")))]
6410 "TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS"
6413 (define_insn "*floatdidf2_fpr"
6414 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6415 (float:DF (match_operand:DI 1 "gpc_reg_operand" "d")))]
6416 "TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
6417 && !VECTOR_UNIT_VSX_P (DFmode)"
6419 [(set_attr "type" "fp")])
6421 ; Allow the combiner to merge source memory operands to the conversion so that
6422 ; the optimizer/register allocator doesn't try to load the value too early in a
6423 ; GPR and then use store/load to move it to a FPR and suffer from a store-load
6424 ; hit. We will split after reload to avoid the trip through the GPRs
6426 (define_insn_and_split "*floatdidf2_mem"
6427 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6428 (float:DF (match_operand:DI 1 "memory_operand" "m")))
6429 (clobber (match_scratch:DI 2 "=d"))]
6430 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS && TARGET_FCFID"
6432 "&& reload_completed"
6433 [(set (match_dup 2) (match_dup 1))
6434 (set (match_dup 0) (float:DF (match_dup 2)))]
6436 [(set_attr "length" "8")
6437 (set_attr "type" "fpload")])
6439 (define_expand "floatunsdidf2"
6440 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6442 (match_operand:DI 1 "gpc_reg_operand" "")))]
6443 "TARGET_HARD_FLOAT && (TARGET_FCFIDU || VECTOR_UNIT_VSX_P (DFmode))"
6446 (define_insn "*floatunsdidf2_fcfidu"
6447 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6448 (unsigned_float:DF (match_operand:DI 1 "gpc_reg_operand" "d")))]
6449 "TARGET_HARD_FLOAT && TARGET_FCFIDU && !VECTOR_UNIT_VSX_P (DFmode)"
6451 [(set_attr "type" "fp")
6452 (set_attr "length" "4")])
6454 (define_insn_and_split "*floatunsdidf2_mem"
6455 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6456 (unsigned_float:DF (match_operand:DI 1 "memory_operand" "m")))
6457 (clobber (match_scratch:DI 2 "=d"))]
6458 "TARGET_HARD_FLOAT && (TARGET_FCFIDU || VECTOR_UNIT_VSX_P (DFmode))"
6460 "&& reload_completed"
6461 [(set (match_dup 2) (match_dup 1))
6462 (set (match_dup 0) (unsigned_float:DF (match_dup 2)))]
6464 [(set_attr "length" "8")
6465 (set_attr "type" "fpload")])
6467 (define_expand "floatdisf2"
6468 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6469 (float:SF (match_operand:DI 1 "gpc_reg_operand" "")))]
6470 "TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
6471 && (TARGET_FCFIDS || TARGET_POWERPC64 || flag_unsafe_math_optimizations)"
6476 rtx val = operands[1];
6477 if (!flag_unsafe_math_optimizations)
6479 rtx label = gen_label_rtx ();
6480 val = gen_reg_rtx (DImode);
6481 emit_insn (gen_floatdisf2_internal2 (val, operands[1], label));
6484 emit_insn (gen_floatdisf2_internal1 (operands[0], val));
6489 (define_insn "floatdisf2_fcfids"
6490 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6491 (float:SF (match_operand:DI 1 "gpc_reg_operand" "d")))]
6492 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
6493 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDS"
6495 [(set_attr "type" "fp")])
6497 (define_insn_and_split "*floatdisf2_mem"
6498 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6499 (float:SF (match_operand:DI 1 "memory_operand" "m")))
6500 (clobber (match_scratch:DI 2 "=f"))]
6501 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
6502 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDS"
6504 "&& reload_completed"
6508 emit_move_insn (operands[2], operands[1]);
6509 emit_insn (gen_floatdisf2_fcfids (operands[0], operands[2]));
6512 [(set_attr "length" "8")])
6514 ;; This is not IEEE compliant if rounding mode is "round to nearest".
6515 ;; If the DI->DF conversion is inexact, then it's possible to suffer
6516 ;; from double rounding.
6517 ;; Instead of creating a new cpu type for two FP operations, just use fp
6518 (define_insn_and_split "floatdisf2_internal1"
6519 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6520 (float:SF (match_operand:DI 1 "gpc_reg_operand" "d")))
6521 (clobber (match_scratch:DF 2 "=d"))]
6522 "TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
6524 "&& reload_completed"
6526 (float:DF (match_dup 1)))
6528 (float_truncate:SF (match_dup 2)))]
6530 [(set_attr "length" "8")
6531 (set_attr "type" "fp")])
6533 ;; Twiddles bits to avoid double rounding.
6534 ;; Bits that might be truncated when converting to DFmode are replaced
6535 ;; by a bit that won't be lost at that stage, but is below the SFmode
6536 ;; rounding position.
6537 (define_expand "floatdisf2_internal2"
6538 [(set (match_dup 3) (ashiftrt:DI (match_operand:DI 1 "" "")
6540 (parallel [(set (match_operand:DI 0 "" "") (and:DI (match_dup 1)
6542 (clobber (scratch:CC))])
6543 (set (match_dup 3) (plus:DI (match_dup 3)
6545 (set (match_dup 0) (plus:DI (match_dup 0)
6547 (set (match_dup 4) (compare:CCUNS (match_dup 3)
6549 (set (match_dup 0) (ior:DI (match_dup 0)
6551 (parallel [(set (match_dup 0) (and:DI (match_dup 0)
6553 (clobber (scratch:CC))])
6554 (set (pc) (if_then_else (geu (match_dup 4) (const_int 0))
6555 (label_ref (match_operand:DI 2 "" ""))
6557 (set (match_dup 0) (match_dup 1))]
6558 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
6561 operands[3] = gen_reg_rtx (DImode);
6562 operands[4] = gen_reg_rtx (CCUNSmode);
6565 (define_expand "floatunsdisf2"
6566 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6567 (unsigned_float:SF (match_operand:DI 1 "gpc_reg_operand" "")))]
6568 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
6569 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDUS"
6572 (define_insn "floatunsdisf2_fcfidus"
6573 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6574 (unsigned_float:SF (match_operand:DI 1 "gpc_reg_operand" "d")))]
6575 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
6576 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDUS"
6578 [(set_attr "type" "fp")])
6580 (define_insn_and_split "*floatunsdisf2_mem"
6581 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6582 (unsigned_float:SF (match_operand:DI 1 "memory_operand" "m")))
6583 (clobber (match_scratch:DI 2 "=f"))]
6584 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
6585 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDUS"
6587 "&& reload_completed"
6591 emit_move_insn (operands[2], operands[1]);
6592 emit_insn (gen_floatunsdisf2_fcfidus (operands[0], operands[2]));
6595 [(set_attr "length" "8")
6596 (set_attr "type" "fpload")])
6598 ;; Define the TImode operations that can be done in a small number
6599 ;; of instructions. The & constraints are to prevent the register
6600 ;; allocator from allocating registers that overlap with the inputs
6601 ;; (for example, having an input in 7,8 and an output in 6,7). We
6602 ;; also allow for the output being the same as one of the inputs.
6604 (define_insn "addti3"
6605 [(set (match_operand:TI 0 "gpc_reg_operand" "=&r,&r,r,r")
6606 (plus:TI (match_operand:TI 1 "gpc_reg_operand" "%r,r,0,0")
6607 (match_operand:TI 2 "reg_or_short_operand" "r,I,r,I")))]
6610 if (WORDS_BIG_ENDIAN)
6611 return (GET_CODE (operands[2])) != CONST_INT
6612 ? \"addc %L0,%L1,%L2\;adde %0,%1,%2\"
6613 : \"addic %L0,%L1,%2\;add%G2e %0,%1\";
6615 return (GET_CODE (operands[2])) != CONST_INT
6616 ? \"addc %0,%1,%2\;adde %L0,%L1,%L2\"
6617 : \"addic %0,%1,%2\;add%G2e %L0,%L1\";
6619 [(set_attr "type" "two")
6620 (set_attr "length" "8")])
6622 (define_insn "subti3"
6623 [(set (match_operand:TI 0 "gpc_reg_operand" "=&r,&r,r,r,r")
6624 (minus:TI (match_operand:TI 1 "reg_or_short_operand" "r,I,0,r,I")
6625 (match_operand:TI 2 "gpc_reg_operand" "r,r,r,0,0")))]
6628 if (WORDS_BIG_ENDIAN)
6629 return (GET_CODE (operands[1]) != CONST_INT)
6630 ? \"subfc %L0,%L2,%L1\;subfe %0,%2,%1\"
6631 : \"subfic %L0,%L2,%1\;subf%G1e %0,%2\";
6633 return (GET_CODE (operands[1]) != CONST_INT)
6634 ? \"subfc %0,%2,%1\;subfe %L0,%L2,%L1\"
6635 : \"subfic %0,%2,%1\;subf%G1e %L0,%L2\";
6637 [(set_attr "type" "two")
6638 (set_attr "length" "8")])
6641 ;; Define the DImode operations that can be done in a small number
6642 ;; of instructions. The & constraints are to prevent the register
6643 ;; allocator from allocating registers that overlap with the inputs
6644 ;; (for example, having an input in 7,8 and an output in 6,7). We
6645 ;; also allow for the output being the same as one of the inputs.
6647 (define_insn "*adddi3_noppc64"
6648 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r")
6649 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,0,0")
6650 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I")))]
6651 "! TARGET_POWERPC64"
6654 if (WORDS_BIG_ENDIAN)
6655 return (GET_CODE (operands[2])) != CONST_INT
6656 ? \"addc %L0,%L1,%L2\;adde %0,%1,%2\"
6657 : \"addic %L0,%L1,%2\;add%G2e %0,%1\";
6659 return (GET_CODE (operands[2])) != CONST_INT
6660 ? \"addc %0,%1,%2\;adde %L0,%L1,%L2\"
6661 : \"addic %0,%1,%2\;add%G2e %L0,%L1\";
6663 [(set_attr "type" "two")
6664 (set_attr "length" "8")])
6666 (define_insn "*subdi3_noppc64"
6667 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r,r")
6668 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I,0,r,I")
6669 (match_operand:DI 2 "gpc_reg_operand" "r,r,r,0,0")))]
6670 "! TARGET_POWERPC64"
6673 if (WORDS_BIG_ENDIAN)
6674 return (GET_CODE (operands[1]) != CONST_INT)
6675 ? \"subfc %L0,%L2,%L1\;subfe %0,%2,%1\"
6676 : \"subfic %L0,%L2,%1\;subf%G1e %0,%2\";
6678 return (GET_CODE (operands[1]) != CONST_INT)
6679 ? \"subfc %0,%2,%1\;subfe %L0,%L2,%L1\"
6680 : \"subfic %0,%2,%1\;subf%G1e %L0,%L2\";
6682 [(set_attr "type" "two")
6683 (set_attr "length" "8")])
6685 (define_insn "*negdi2_noppc64"
6686 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6687 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))]
6688 "! TARGET_POWERPC64"
6691 return (WORDS_BIG_ENDIAN)
6692 ? \"subfic %L0,%L1,0\;subfze %0,%1\"
6693 : \"subfic %0,%1,0\;subfze %L0,%L1\";
6695 [(set_attr "type" "two")
6696 (set_attr "length" "8")])
6698 (define_insn "mulsidi3"
6699 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6700 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6701 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
6702 "! TARGET_POWERPC64"
6704 return (WORDS_BIG_ENDIAN)
6705 ? \"mulhw %0,%1,%2\;mullw %L0,%1,%2\"
6706 : \"mulhw %L0,%1,%2\;mullw %0,%1,%2\";
6708 [(set_attr "type" "mul")
6709 (set_attr "length" "8")])
6712 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6713 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6714 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6715 "! TARGET_POWERPC64 && reload_completed"
6718 (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
6719 (sign_extend:DI (match_dup 2)))
6722 (mult:SI (match_dup 1)
6726 int endian = (WORDS_BIG_ENDIAN == 0);
6727 operands[3] = operand_subword (operands[0], endian, 0, DImode);
6728 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
6731 (define_insn "umulsidi3"
6732 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6733 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6734 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
6735 "! TARGET_POWERPC64"
6738 return (WORDS_BIG_ENDIAN)
6739 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
6740 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
6742 [(set_attr "type" "mul")
6743 (set_attr "length" "8")])
6746 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6747 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6748 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6749 "! TARGET_POWERPC64 && reload_completed"
6752 (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
6753 (zero_extend:DI (match_dup 2)))
6756 (mult:SI (match_dup 1)
6760 int endian = (WORDS_BIG_ENDIAN == 0);
6761 operands[3] = operand_subword (operands[0], endian, 0, DImode);
6762 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
6765 (define_insn "smulsi3_highpart"
6766 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6768 (lshiftrt:DI (mult:DI (sign_extend:DI
6769 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6771 (match_operand:SI 2 "gpc_reg_operand" "r")))
6775 [(set_attr "type" "mul")])
6777 (define_insn "umulsi3_highpart"
6778 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6780 (lshiftrt:DI (mult:DI (zero_extend:DI
6781 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6783 (match_operand:SI 2 "gpc_reg_operand" "r")))
6787 [(set_attr "type" "mul")])
6789 ;; Shift by a variable amount is too complex to be worth open-coding. We
6790 ;; just handle shifts by constants.
6791 (define_insn "ashrdi3_no_power"
6792 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
6793 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6794 (match_operand:SI 2 "const_int_operand" "M,i")))]
6798 switch (which_alternative)
6803 if (WORDS_BIG_ENDIAN)
6804 return \"srawi %0,%1,31\;srawi %L0,%1,%h2\";
6806 return \"srawi %L0,%L1,31\;srawi %0,%L1,%h2\";
6808 if (WORDS_BIG_ENDIAN)
6809 return \"srwi %L0,%L1,%h2\;insrwi %L0,%1,%h2,0\;srawi %0,%1,%h2\";
6811 return \"srwi %0,%1,%h2\;insrwi %0,%L1,%h2,0\;srawi %L0,%L1,%h2\";
6814 [(set_attr "type" "two,three")
6815 (set_attr "length" "8,12")])
6817 (define_insn "*ashrdisi3_noppc64be"
6818 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6819 (subreg:SI (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6820 (const_int 32)) 4))]
6821 "TARGET_32BIT && !TARGET_POWERPC64 && WORDS_BIG_ENDIAN"
6824 if (REGNO (operands[0]) == REGNO (operands[1]))
6827 return \"mr %0,%1\";
6829 [(set_attr "length" "4")])
6832 ;; PowerPC64 DImode operations.
6834 (define_insn "muldi3"
6835 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6836 (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6837 (match_operand:DI 2 "reg_or_short_operand" "r,I")))]
6842 [(set_attr "type" "mul")
6844 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
6846 (match_operand:SI 2 "short_cint_operand" "")
6847 (const_string "16")]
6848 (const_string "64")))])
6850 (define_insn "*muldi3_internal1"
6851 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6852 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6853 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6855 (clobber (match_scratch:DI 3 "=r,r"))]
6860 [(set_attr "type" "mul")
6861 (set_attr "size" "64")
6862 (set_attr "dot" "yes")
6863 (set_attr "length" "4,8")])
6866 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6867 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
6868 (match_operand:DI 2 "gpc_reg_operand" ""))
6870 (clobber (match_scratch:DI 3 ""))]
6871 "TARGET_POWERPC64 && reload_completed"
6873 (mult:DI (match_dup 1) (match_dup 2)))
6875 (compare:CC (match_dup 3)
6879 (define_insn "*muldi3_internal2"
6880 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6881 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6882 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6884 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6885 (mult:DI (match_dup 1) (match_dup 2)))]
6890 [(set_attr "type" "mul")
6891 (set_attr "size" "64")
6892 (set_attr "dot" "yes")
6893 (set_attr "length" "4,8")])
6896 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
6897 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
6898 (match_operand:DI 2 "gpc_reg_operand" ""))
6900 (set (match_operand:DI 0 "gpc_reg_operand" "")
6901 (mult:DI (match_dup 1) (match_dup 2)))]
6902 "TARGET_POWERPC64 && reload_completed"
6904 (mult:DI (match_dup 1) (match_dup 2)))
6906 (compare:CC (match_dup 0)
6910 (define_insn "smuldi3_highpart"
6911 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6913 (lshiftrt:TI (mult:TI (sign_extend:TI
6914 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6916 (match_operand:DI 2 "gpc_reg_operand" "r")))
6920 [(set_attr "type" "mul")
6921 (set_attr "size" "64")])
6923 (define_insn "umuldi3_highpart"
6924 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6926 (lshiftrt:TI (mult:TI (zero_extend:TI
6927 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6929 (match_operand:DI 2 "gpc_reg_operand" "r")))
6933 [(set_attr "type" "mul")
6934 (set_attr "size" "64")])
6936 (define_expand "mulditi3"
6937 [(set (match_operand:TI 0 "gpc_reg_operand")
6938 (mult:TI (sign_extend:TI (match_operand:DI 1 "gpc_reg_operand"))
6939 (sign_extend:TI (match_operand:DI 2 "gpc_reg_operand"))))]
6942 rtx l = gen_reg_rtx (DImode), h = gen_reg_rtx (DImode);
6943 emit_insn (gen_muldi3 (l, operands[1], operands[2]));
6944 emit_insn (gen_smuldi3_highpart (h, operands[1], operands[2]));
6945 emit_move_insn (gen_lowpart (DImode, operands[0]), l);
6946 emit_move_insn (gen_highpart (DImode, operands[0]), h);
6950 (define_expand "umulditi3"
6951 [(set (match_operand:TI 0 "gpc_reg_operand")
6952 (mult:TI (zero_extend:TI (match_operand:DI 1 "gpc_reg_operand"))
6953 (zero_extend:TI (match_operand:DI 2 "gpc_reg_operand"))))]
6956 rtx l = gen_reg_rtx (DImode), h = gen_reg_rtx (DImode);
6957 emit_insn (gen_muldi3 (l, operands[1], operands[2]));
6958 emit_insn (gen_umuldi3_highpart (h, operands[1], operands[2]));
6959 emit_move_insn (gen_lowpart (DImode, operands[0]), l);
6960 emit_move_insn (gen_highpart (DImode, operands[0]), h);
6964 (define_insn "*rotldi3_internal4"
6965 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6966 (and:DI (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6967 (match_operand:DI 2 "reg_or_cint_operand" "r,i"))
6968 (match_operand:DI 3 "mask64_operand" "n,n")))]
6971 rldc%B3 %0,%1,%2,%S3
6972 rldic%B3 %0,%1,%H2,%S3"
6973 [(set_attr "type" "shift")
6974 (set_attr "var_shift" "yes,no")])
6976 (define_insn "*rotldi3_internal5"
6977 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
6979 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6980 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
6981 (match_operand:DI 3 "mask64_operand" "n,n,n,n"))
6983 (clobber (match_scratch:DI 4 "=r,r,r,r"))]
6986 rldc%B3. %4,%1,%2,%S3
6987 rldic%B3. %4,%1,%H2,%S3
6990 [(set_attr "type" "shift")
6991 (set_attr "var_shift" "yes,no,yes,no")
6992 (set_attr "dot" "yes")
6993 (set_attr "length" "4,4,8,8")])
6996 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
6998 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6999 (match_operand:DI 2 "reg_or_cint_operand" ""))
7000 (match_operand:DI 3 "mask64_operand" ""))
7002 (clobber (match_scratch:DI 4 ""))]
7003 "TARGET_POWERPC64 && reload_completed"
7005 (and:DI (rotate:DI (match_dup 1)
7009 (compare:CC (match_dup 4)
7013 (define_insn "*rotldi3_internal6"
7014 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
7016 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7017 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
7018 (match_operand:DI 3 "mask64_operand" "n,n,n,n"))
7020 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7021 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7024 rldc%B3. %0,%1,%2,%S3
7025 rldic%B3. %0,%1,%H2,%S3
7028 [(set_attr "type" "shift")
7029 (set_attr "var_shift" "yes,no,yes,no")
7030 (set_attr "dot" "yes")
7031 (set_attr "length" "4,4,8,8")])
7034 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
7036 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7037 (match_operand:DI 2 "reg_or_cint_operand" ""))
7038 (match_operand:DI 3 "mask64_operand" ""))
7040 (set (match_operand:DI 0 "gpc_reg_operand" "")
7041 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7042 "TARGET_POWERPC64 && reload_completed"
7044 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
7046 (compare:CC (match_dup 0)
7050 (define_insn "*rotldi3_internal7le"
7051 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7054 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7055 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
7056 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN"
7059 rldicl %0,%1,%H2,56"
7060 [(set_attr "type" "shift")
7061 (set_attr "var_shift" "yes,no")])
7063 (define_insn "*rotldi3_internal7be"
7064 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7067 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7068 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 7)))]
7069 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN"
7072 rldicl %0,%1,%H2,56"
7073 [(set_attr "type" "shift")
7074 (set_attr "var_shift" "yes,no")])
7076 (define_insn "*rotldi3_internal8le"
7077 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7078 (compare:CC (zero_extend:DI
7080 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7081 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7083 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7084 "TARGET_64BIT && !BYTES_BIG_ENDIAN"
7087 rldicl. %3,%1,%H2,56
7090 [(set_attr "type" "shift")
7091 (set_attr "var_shift" "yes,no,yes,no")
7092 (set_attr "dot" "yes")
7093 (set_attr "length" "4,4,8,8")])
7095 (define_insn "*rotldi3_internal8be"
7096 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7097 (compare:CC (zero_extend:DI
7099 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7100 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 7))
7102 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7103 "TARGET_64BIT && BYTES_BIG_ENDIAN"
7106 rldicl. %3,%1,%H2,56
7109 [(set_attr "type" "shift")
7110 (set_attr "var_shift" "yes,no,yes,no")
7111 (set_attr "dot" "yes")
7112 (set_attr "length" "4,4,8,8")])
7115 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7116 (compare:CC (zero_extend:DI
7118 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7119 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7121 (clobber (match_scratch:DI 3 ""))]
7122 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN && reload_completed"
7124 (zero_extend:DI (subreg:QI
7125 (rotate:DI (match_dup 1)
7128 (compare:CC (match_dup 3)
7133 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7134 (compare:CC (zero_extend:DI
7136 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7137 (match_operand:DI 2 "reg_or_cint_operand" "")) 7))
7139 (clobber (match_scratch:DI 3 ""))]
7140 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN && reload_completed"
7142 (zero_extend:DI (subreg:QI
7143 (rotate:DI (match_dup 1)
7146 (compare:CC (match_dup 3)
7150 (define_insn "*rotldi3_internal9le"
7151 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7152 (compare:CC (zero_extend:DI
7154 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7155 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7157 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7158 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7159 "TARGET_64BIT && !BYTES_BIG_ENDIAN"
7162 rldicl. %0,%1,%H2,56
7165 [(set_attr "type" "shift")
7166 (set_attr "var_shift" "yes,no,yes,no")
7167 (set_attr "dot" "yes")
7168 (set_attr "length" "4,4,8,8")])
7170 (define_insn "*rotldi3_internal9be"
7171 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7172 (compare:CC (zero_extend:DI
7174 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7175 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 7))
7177 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7178 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 7)))]
7179 "TARGET_64BIT && BYTES_BIG_ENDIAN"
7182 rldicl. %0,%1,%H2,56
7185 [(set_attr "type" "shift")
7186 (set_attr "var_shift" "yes,no,yes,no")
7187 (set_attr "dot" "yes")
7188 (set_attr "length" "4,4,8,8")])
7191 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7192 (compare:CC (zero_extend:DI
7194 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7195 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7197 (set (match_operand:DI 0 "gpc_reg_operand" "")
7198 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7199 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN && reload_completed"
7201 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
7203 (compare:CC (match_dup 0)
7208 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7209 (compare:CC (zero_extend:DI
7211 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7212 (match_operand:DI 2 "reg_or_cint_operand" "")) 7))
7214 (set (match_operand:DI 0 "gpc_reg_operand" "")
7215 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 7)))]
7216 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN && reload_completed"
7218 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 7)))
7220 (compare:CC (match_dup 0)
7224 (define_insn "*rotldi3_internal10le"
7225 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7228 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7229 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
7230 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN"
7233 rldicl %0,%1,%H2,48"
7234 [(set_attr "type" "shift")
7235 (set_attr "var_shift" "yes,no")])
7237 (define_insn "*rotldi3_internal10be"
7238 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7241 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7242 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 6)))]
7243 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN"
7246 rldicl %0,%1,%H2,48"
7247 [(set_attr "type" "shift")
7248 (set_attr "var_shift" "yes,no")])
7250 (define_insn "*rotldi3_internal11le"
7251 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7252 (compare:CC (zero_extend:DI
7254 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7255 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7257 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7258 "TARGET_64BIT && !BYTES_BIG_ENDIAN"
7261 rldicl. %3,%1,%H2,48
7264 [(set_attr "type" "shift")
7265 (set_attr "var_shift" "yes,no,yes,no")
7266 (set_attr "dot" "yes")
7267 (set_attr "length" "4,4,8,8")])
7269 (define_insn "*rotldi3_internal11be"
7270 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7271 (compare:CC (zero_extend:DI
7273 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7274 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 6))
7276 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7277 "TARGET_64BIT && BYTES_BIG_ENDIAN"
7280 rldicl. %3,%1,%H2,48
7283 [(set_attr "type" "shift")
7284 (set_attr "var_shift" "yes,no,yes,no")
7285 (set_attr "dot" "yes")
7286 (set_attr "length" "4,4,8,8")])
7289 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7290 (compare:CC (zero_extend:DI
7292 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7293 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7295 (clobber (match_scratch:DI 3 ""))]
7296 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN && reload_completed"
7298 (zero_extend:DI (subreg:HI
7299 (rotate:DI (match_dup 1)
7302 (compare:CC (match_dup 3)
7307 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7308 (compare:CC (zero_extend:DI
7310 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7311 (match_operand:DI 2 "reg_or_cint_operand" "")) 6))
7313 (clobber (match_scratch:DI 3 ""))]
7314 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN && reload_completed"
7316 (zero_extend:DI (subreg:HI
7317 (rotate:DI (match_dup 1)
7320 (compare:CC (match_dup 3)
7324 (define_insn "*rotldi3_internal12le"
7325 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7326 (compare:CC (zero_extend:DI
7328 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7329 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7331 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7332 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7333 "TARGET_64BIT && !BYTES_BIG_ENDIAN"
7336 rldicl. %0,%1,%H2,48
7339 [(set_attr "type" "shift")
7340 (set_attr "var_shift" "yes,no,yes,no")
7341 (set_attr "dot" "yes")
7342 (set_attr "length" "4,4,8,8")])
7344 (define_insn "*rotldi3_internal12be"
7345 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7346 (compare:CC (zero_extend:DI
7348 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7349 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 6))
7351 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7352 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 6)))]
7353 "TARGET_64BIT && BYTES_BIG_ENDIAN"
7356 rldicl. %0,%1,%H2,48
7359 [(set_attr "type" "shift")
7360 (set_attr "var_shift" "yes,no,yes,no")
7361 (set_attr "dot" "yes")
7362 (set_attr "length" "4,4,8,8")])
7365 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7366 (compare:CC (zero_extend:DI
7368 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7369 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7371 (set (match_operand:DI 0 "gpc_reg_operand" "")
7372 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7373 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN && reload_completed"
7375 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
7377 (compare:CC (match_dup 0)
7382 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7383 (compare:CC (zero_extend:DI
7385 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7386 (match_operand:DI 2 "reg_or_cint_operand" "")) 6))
7388 (set (match_operand:DI 0 "gpc_reg_operand" "")
7389 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 6)))]
7390 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN && reload_completed"
7392 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 6)))
7394 (compare:CC (match_dup 0)
7398 (define_insn "*rotldi3_internal13le"
7399 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7402 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7403 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
7404 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN"
7407 rldicl %0,%1,%H2,32"
7408 [(set_attr "type" "shift")
7409 (set_attr "var_shift" "yes,no")])
7411 (define_insn "*rotldi3_internal13be"
7412 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7415 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7416 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 4)))]
7417 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN"
7420 rldicl %0,%1,%H2,32"
7421 [(set_attr "type" "shift")
7422 (set_attr "var_shift" "yes,no")])
7424 (define_insn "*rotldi3_internal14le"
7425 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7426 (compare:CC (zero_extend:DI
7428 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7429 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7431 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7432 "TARGET_64BIT && !BYTES_BIG_ENDIAN"
7435 rldicl. %3,%1,%H2,32
7438 [(set_attr "type" "shift")
7439 (set_attr "var_shift" "yes,no,yes,no")
7440 (set_attr "dot" "yes")
7441 (set_attr "length" "4,4,8,8")])
7443 (define_insn "*rotldi3_internal14be"
7444 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7445 (compare:CC (zero_extend:DI
7447 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7448 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 4))
7450 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7451 "TARGET_64BIT && BYTES_BIG_ENDIAN"
7454 rldicl. %3,%1,%H2,32
7457 [(set_attr "type" "shift")
7458 (set_attr "var_shift" "yes,no,yes,no")
7459 (set_attr "dot" "yes")
7460 (set_attr "length" "4,4,8,8")])
7463 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7464 (compare:CC (zero_extend:DI
7466 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7467 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7469 (clobber (match_scratch:DI 3 ""))]
7470 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN && reload_completed"
7472 (zero_extend:DI (subreg:SI
7473 (rotate:DI (match_dup 1)
7476 (compare:CC (match_dup 3)
7481 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7482 (compare:CC (zero_extend:DI
7484 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7485 (match_operand:DI 2 "reg_or_cint_operand" "")) 4))
7487 (clobber (match_scratch:DI 3 ""))]
7488 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN && reload_completed"
7490 (zero_extend:DI (subreg:SI
7491 (rotate:DI (match_dup 1)
7494 (compare:CC (match_dup 3)
7498 (define_insn "*rotldi3_internal15le"
7499 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7500 (compare:CC (zero_extend:DI
7502 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7503 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7505 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7506 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7507 "TARGET_64BIT && !BYTES_BIG_ENDIAN"
7510 rldicl. %0,%1,%H2,32
7513 [(set_attr "type" "shift")
7514 (set_attr "var_shift" "yes,no,yes,no")
7515 (set_attr "dot" "yes")
7516 (set_attr "length" "4,4,8,8")])
7518 (define_insn "*rotldi3_internal15be"
7519 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7520 (compare:CC (zero_extend:DI
7522 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7523 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 4))
7525 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7526 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 4)))]
7527 "TARGET_64BIT && BYTES_BIG_ENDIAN"
7530 rldicl. %0,%1,%H2,32
7533 [(set_attr "type" "shift")
7534 (set_attr "var_shift" "yes,no,yes,no")
7535 (set_attr "dot" "yes")
7536 (set_attr "length" "4,4,8,8")])
7539 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7540 (compare:CC (zero_extend:DI
7542 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7543 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7545 (set (match_operand:DI 0 "gpc_reg_operand" "")
7546 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7547 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN && reload_completed"
7549 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
7551 (compare:CC (match_dup 0)
7556 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7557 (compare:CC (zero_extend:DI
7559 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7560 (match_operand:DI 2 "reg_or_cint_operand" "")) 4))
7562 (set (match_operand:DI 0 "gpc_reg_operand" "")
7563 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 4)))]
7564 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN && reload_completed"
7566 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 4)))
7568 (compare:CC (match_dup 0)
7572 (define_insn "*ashldi3_internal4"
7573 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7574 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7575 (match_operand:SI 2 "const_int_operand" "i"))
7576 (match_operand:DI 3 "const_int_operand" "n")))]
7577 "TARGET_POWERPC64 && includes_rldic_lshift_p (operands[2], operands[3])"
7578 "rldic %0,%1,%H2,%W3"
7579 [(set_attr "type" "shift")])
7581 (define_insn "ashldi3_internal5"
7582 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7584 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7585 (match_operand:SI 2 "const_int_operand" "i,i"))
7586 (match_operand:DI 3 "const_int_operand" "n,n"))
7588 (clobber (match_scratch:DI 4 "=r,r"))]
7589 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
7591 rldic. %4,%1,%H2,%W3
7593 [(set_attr "type" "shift")
7594 (set_attr "dot" "yes")
7595 (set_attr "length" "4,8")])
7598 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7600 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7601 (match_operand:SI 2 "const_int_operand" ""))
7602 (match_operand:DI 3 "const_int_operand" ""))
7604 (clobber (match_scratch:DI 4 ""))]
7605 "TARGET_POWERPC64 && reload_completed
7606 && includes_rldic_lshift_p (operands[2], operands[3])"
7608 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7611 (compare:CC (match_dup 4)
7615 (define_insn "*ashldi3_internal6"
7616 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
7618 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7619 (match_operand:SI 2 "const_int_operand" "i,i"))
7620 (match_operand:DI 3 "const_int_operand" "n,n"))
7622 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7623 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7624 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
7626 rldic. %0,%1,%H2,%W3
7628 [(set_attr "type" "shift")
7629 (set_attr "dot" "yes")
7630 (set_attr "length" "4,8")])
7633 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
7635 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7636 (match_operand:SI 2 "const_int_operand" ""))
7637 (match_operand:DI 3 "const_int_operand" ""))
7639 (set (match_operand:DI 0 "gpc_reg_operand" "")
7640 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7641 "TARGET_POWERPC64 && reload_completed
7642 && includes_rldic_lshift_p (operands[2], operands[3])"
7644 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7647 (compare:CC (match_dup 0)
7651 (define_insn "*ashldi3_internal7"
7652 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7653 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7654 (match_operand:SI 2 "const_int_operand" "i"))
7655 (match_operand:DI 3 "mask64_operand" "n")))]
7656 "TARGET_POWERPC64 && includes_rldicr_lshift_p (operands[2], operands[3])"
7657 "rldicr %0,%1,%H2,%S3"
7658 [(set_attr "type" "shift")])
7660 (define_insn "ashldi3_internal8"
7661 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7663 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7664 (match_operand:SI 2 "const_int_operand" "i,i"))
7665 (match_operand:DI 3 "mask64_operand" "n,n"))
7667 (clobber (match_scratch:DI 4 "=r,r"))]
7668 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
7670 rldicr. %4,%1,%H2,%S3
7672 [(set_attr "type" "shift")
7673 (set_attr "dot" "yes")
7674 (set_attr "length" "4,8")])
7677 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7679 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7680 (match_operand:SI 2 "const_int_operand" ""))
7681 (match_operand:DI 3 "mask64_operand" ""))
7683 (clobber (match_scratch:DI 4 ""))]
7684 "TARGET_POWERPC64 && reload_completed
7685 && includes_rldicr_lshift_p (operands[2], operands[3])"
7687 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7690 (compare:CC (match_dup 4)
7694 (define_insn "*ashldi3_internal9"
7695 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
7697 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7698 (match_operand:SI 2 "const_int_operand" "i,i"))
7699 (match_operand:DI 3 "mask64_operand" "n,n"))
7701 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7702 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7703 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
7705 rldicr. %0,%1,%H2,%S3
7707 [(set_attr "type" "shift")
7708 (set_attr "dot" "yes")
7709 (set_attr "length" "4,8")])
7712 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
7714 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7715 (match_operand:SI 2 "const_int_operand" ""))
7716 (match_operand:DI 3 "mask64_operand" ""))
7718 (set (match_operand:DI 0 "gpc_reg_operand" "")
7719 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7720 "TARGET_POWERPC64 && reload_completed
7721 && includes_rldicr_lshift_p (operands[2], operands[3])"
7723 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7726 (compare:CC (match_dup 0)
7730 (define_expand "anddi3"
7732 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7733 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7734 (match_operand:DI 2 "reg_or_cint_operand" "")))
7735 (clobber (match_scratch:CC 3 ""))])]
7738 if (!TARGET_POWERPC64)
7740 rtx cc = gen_rtx_SCRATCH (CCmode);
7741 rs6000_split_logical (operands, AND, false, false, false, cc);
7744 else if (!and64_2_operand (operands[2], DImode))
7745 operands[2] = force_reg (DImode, operands[2]);
7748 (define_insn "anddi3_mc"
7749 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
7750 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r")
7751 (match_operand:DI 2 "and64_2_operand" "?r,S,T,K,J,t")))
7752 (clobber (match_scratch:CC 3 "=X,X,X,x,x,X"))]
7753 "TARGET_POWERPC64 && rs6000_gen_cell_microcode"
7756 rldic%B2 %0,%1,0,%S2
7757 rlwinm %0,%1,0,%m2,%M2
7761 [(set_attr "type" "*,shift,shift,logical,logical,*")
7762 (set_attr "dot" "no,no,no,yes,yes,no")
7763 (set_attr "length" "4,4,4,4,4,8")])
7765 (define_insn "anddi3_nomc"
7766 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7767 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r")
7768 (match_operand:DI 2 "and64_2_operand" "?r,S,T,t")))
7769 (clobber (match_scratch:CC 3 "=X,X,X,X"))]
7770 "TARGET_POWERPC64 && !rs6000_gen_cell_microcode"
7773 rldic%B2 %0,%1,0,%S2
7774 rlwinm %0,%1,0,%m2,%M2
7776 [(set_attr "type" "*,shift,shift,*")
7777 (set_attr "length" "4,4,4,8")])
7780 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7781 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7782 (match_operand:DI 2 "mask64_2_operand" "")))
7783 (clobber (match_scratch:CC 3 ""))]
7785 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7786 && !mask_operand (operands[2], DImode)
7787 && !mask64_operand (operands[2], DImode)"
7789 (and:DI (rotate:DI (match_dup 1)
7793 (and:DI (rotate:DI (match_dup 0)
7797 build_mask64_2_operands (operands[2], &operands[4]);
7800 (define_insn "*anddi3_internal2_mc"
7801 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,x,?y,?y,?y,??y,??y,?y")
7802 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r,r,r")
7803 (match_operand:DI 2 "and64_2_operand" "r,S,T,K,J,t,r,S,T,K,J,t"))
7805 (clobber (match_scratch:DI 3 "=r,r,r,r,r,r,r,r,r,r,r,r"))
7806 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,X,X,x,x,X"))]
7807 "TARGET_64BIT && rs6000_gen_cell_microcode"
7810 rldic%B2. %3,%1,0,%S2
7811 rlwinm. %3,%1,0,%m2,%M2
7821 [(set_attr "type" "logical,shift,shift,logical,\
7822 logical,compare,compare,compare,compare,compare,\
7824 (set_attr "dot" "yes")
7825 (set_attr "length" "4,4,4,4,4,8,8,8,8,8,8,12")])
7828 [(set (match_operand:CC 0 "cc_reg_operand" "")
7829 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7830 (match_operand:DI 2 "mask64_2_operand" ""))
7832 (clobber (match_scratch:DI 3 ""))
7833 (clobber (match_scratch:CC 4 ""))]
7834 "TARGET_64BIT && reload_completed
7835 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7836 && !mask_operand (operands[2], DImode)
7837 && !mask64_operand (operands[2], DImode)"
7839 (and:DI (rotate:DI (match_dup 1)
7842 (parallel [(set (match_dup 0)
7843 (compare:CC (and:DI (rotate:DI (match_dup 3)
7847 (clobber (match_dup 3))])]
7850 build_mask64_2_operands (operands[2], &operands[5]);
7853 (define_insn "*anddi3_internal3_mc"
7854 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,x,x,?y,?y,?y,??y,??y,?y")
7855 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r,r,r")
7856 (match_operand:DI 2 "and64_2_operand" "r,S,T,K,J,t,r,S,T,K,J,t"))
7858 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r,r,r")
7859 (and:DI (match_dup 1) (match_dup 2)))
7860 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,X,X,x,x,X"))]
7861 "TARGET_64BIT && rs6000_gen_cell_microcode"
7864 rldic%B2. %0,%1,0,%S2
7865 rlwinm. %0,%1,0,%m2,%M2
7875 [(set_attr "type" "logical,shift,shift,logical,\
7876 logical,compare,compare,compare,compare,compare,\
7878 (set_attr "dot" "yes")
7879 (set_attr "length" "4,4,4,4,4,8,8,8,8,8,8,12")])
7882 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7883 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7884 (match_operand:DI 2 "and64_2_operand" ""))
7886 (set (match_operand:DI 0 "gpc_reg_operand" "")
7887 (and:DI (match_dup 1) (match_dup 2)))
7888 (clobber (match_scratch:CC 4 ""))]
7889 "TARGET_64BIT && reload_completed"
7890 [(parallel [(set (match_dup 0)
7891 (and:DI (match_dup 1) (match_dup 2)))
7892 (clobber (match_dup 4))])
7894 (compare:CC (match_dup 0)
7899 [(set (match_operand:CC 3 "cc_reg_operand" "")
7900 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7901 (match_operand:DI 2 "mask64_2_operand" ""))
7903 (set (match_operand:DI 0 "gpc_reg_operand" "")
7904 (and:DI (match_dup 1) (match_dup 2)))
7905 (clobber (match_scratch:CC 4 ""))]
7906 "TARGET_64BIT && reload_completed
7907 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7908 && !mask_operand (operands[2], DImode)
7909 && !mask64_operand (operands[2], DImode)"
7911 (and:DI (rotate:DI (match_dup 1)
7914 (parallel [(set (match_dup 3)
7915 (compare:CC (and:DI (rotate:DI (match_dup 0)
7920 (and:DI (rotate:DI (match_dup 0)
7925 build_mask64_2_operands (operands[2], &operands[5]);
7928 (define_expand "iordi3"
7929 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7930 (ior:DI (match_operand:DI 1 "gpc_reg_operand" "")
7931 (match_operand:DI 2 "reg_or_cint_operand" "")))]
7934 if (!TARGET_POWERPC64)
7936 rs6000_split_logical (operands, IOR, false, false, false, NULL_RTX);
7939 else if (!reg_or_logical_cint_operand (operands[2], DImode))
7940 operands[2] = force_reg (DImode, operands[2]);
7941 else if (non_logical_cint_operand (operands[2], DImode))
7943 HOST_WIDE_INT value;
7944 rtx tmp = ((!can_create_pseudo_p ()
7945 || rtx_equal_p (operands[0], operands[1]))
7946 ? operands[0] : gen_reg_rtx (DImode));
7948 value = INTVAL (operands[2]);
7949 emit_insn (gen_iordi3 (tmp, operands[1],
7950 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
7952 emit_insn (gen_iordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
7957 (define_expand "xordi3"
7958 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7959 (xor:DI (match_operand:DI 1 "gpc_reg_operand" "")
7960 (match_operand:DI 2 "reg_or_cint_operand" "")))]
7963 if (!TARGET_POWERPC64)
7965 rs6000_split_logical (operands, XOR, false, false, false, NULL_RTX);
7968 else if (!reg_or_logical_cint_operand (operands[2], DImode))
7969 operands[2] = force_reg (DImode, operands[2]);
7970 if (non_logical_cint_operand (operands[2], DImode))
7972 HOST_WIDE_INT value;
7973 rtx tmp = ((!can_create_pseudo_p ()
7974 || rtx_equal_p (operands[0], operands[1]))
7975 ? operands[0] : gen_reg_rtx (DImode));
7977 value = INTVAL (operands[2]);
7978 emit_insn (gen_xordi3 (tmp, operands[1],
7979 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
7981 emit_insn (gen_xordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
7986 (define_insn "*booldi3_internal1"
7987 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
7988 (match_operator:DI 3 "boolean_or_operator"
7989 [(match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
7990 (match_operand:DI 2 "logical_operand" "r,K,JF")]))]
7997 (define_insn "*booldi3_internal2"
7998 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7999 (compare:CC (match_operator:DI 4 "boolean_or_operator"
8000 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
8001 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
8003 (clobber (match_scratch:DI 3 "=r,r"))]
8008 [(set_attr "type" "logical,compare")
8009 (set_attr "dot" "yes")
8010 (set_attr "length" "4,8")])
8013 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8014 (compare:CC (match_operator:DI 4 "boolean_operator"
8015 [(match_operand:DI 1 "gpc_reg_operand" "")
8016 (match_operand:DI 2 "gpc_reg_operand" "")])
8018 (clobber (match_scratch:DI 3 ""))]
8019 "TARGET_POWERPC64 && reload_completed"
8020 [(set (match_dup 3) (match_dup 4))
8022 (compare:CC (match_dup 3)
8026 (define_insn "*booldi3_internal3"
8027 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
8028 (compare:CC (match_operator:DI 4 "boolean_or_operator"
8029 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
8030 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
8032 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8038 [(set_attr "type" "logical,compare")
8039 (set_attr "dot" "yes")
8040 (set_attr "length" "4,8")])
8043 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8044 (compare:CC (match_operator:DI 4 "boolean_operator"
8045 [(match_operand:DI 1 "gpc_reg_operand" "")
8046 (match_operand:DI 2 "gpc_reg_operand" "")])
8048 (set (match_operand:DI 0 "gpc_reg_operand" "")
8050 "TARGET_POWERPC64 && reload_completed"
8051 [(set (match_dup 0) (match_dup 4))
8053 (compare:CC (match_dup 0)
8057 ;; Split a logical operation that we can't do in one insn into two insns,
8058 ;; each of which does one 16-bit part. This is used by combine.
8061 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8062 (match_operator:DI 3 "boolean_or_operator"
8063 [(match_operand:DI 1 "gpc_reg_operand" "")
8064 (match_operand:DI 2 "non_logical_cint_operand" "")]))]
8066 [(set (match_dup 0) (match_dup 4))
8067 (set (match_dup 0) (match_dup 5))]
8072 i3 = GEN_INT (INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff));
8073 i4 = GEN_INT (INTVAL (operands[2]) & 0xffff);
8074 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
8076 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
8080 (define_insn "*boolcdi3_internal1"
8081 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
8082 (match_operator:DI 3 "boolean_operator"
8083 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
8084 (match_operand:DI 2 "gpc_reg_operand" "r")]))]
8088 (define_insn "*boolcdi3_internal2"
8089 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
8090 (compare:CC (match_operator:DI 4 "boolean_operator"
8091 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
8092 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
8094 (clobber (match_scratch:DI 3 "=r,r"))]
8099 [(set_attr "type" "logical,compare")
8100 (set_attr "dot" "yes")
8101 (set_attr "length" "4,8")])
8104 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8105 (compare:CC (match_operator:DI 4 "boolean_operator"
8106 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
8107 (match_operand:DI 2 "gpc_reg_operand" "")])
8109 (clobber (match_scratch:DI 3 ""))]
8110 "TARGET_POWERPC64 && reload_completed"
8111 [(set (match_dup 3) (match_dup 4))
8113 (compare:CC (match_dup 3)
8117 (define_insn "*boolcdi3_internal3"
8118 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
8119 (compare:CC (match_operator:DI 4 "boolean_operator"
8120 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
8121 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
8123 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8129 [(set_attr "type" "logical,compare")
8130 (set_attr "dot" "yes")
8131 (set_attr "length" "4,8")])
8134 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8135 (compare:CC (match_operator:DI 4 "boolean_operator"
8136 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
8137 (match_operand:DI 2 "gpc_reg_operand" "")])
8139 (set (match_operand:DI 0 "gpc_reg_operand" "")
8141 "TARGET_POWERPC64 && reload_completed"
8142 [(set (match_dup 0) (match_dup 4))
8144 (compare:CC (match_dup 0)
8148 (define_insn "*boolccdi3_internal1"
8149 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
8150 (match_operator:DI 3 "boolean_operator"
8151 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
8152 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r"))]))]
8156 (define_insn "*boolccdi3_internal2"
8157 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
8158 (compare:CC (match_operator:DI 4 "boolean_operator"
8159 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
8160 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
8162 (clobber (match_scratch:DI 3 "=r,r"))]
8167 [(set_attr "type" "logical,compare")
8168 (set_attr "dot" "yes")
8169 (set_attr "length" "4,8")])
8172 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8173 (compare:CC (match_operator:DI 4 "boolean_operator"
8174 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
8175 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
8177 (clobber (match_scratch:DI 3 ""))]
8178 "TARGET_POWERPC64 && reload_completed"
8179 [(set (match_dup 3) (match_dup 4))
8181 (compare:CC (match_dup 3)
8185 (define_insn "*boolccdi3_internal3"
8186 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
8187 (compare:CC (match_operator:DI 4 "boolean_operator"
8188 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
8189 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
8191 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8197 [(set_attr "type" "logical,compare")
8198 (set_attr "dot" "yes")
8199 (set_attr "length" "4,8")])
8202 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8203 (compare:CC (match_operator:DI 4 "boolean_operator"
8204 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
8205 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
8207 (set (match_operand:DI 0 "gpc_reg_operand" "")
8209 "TARGET_POWERPC64 && reload_completed"
8210 [(set (match_dup 0) (match_dup 4))
8212 (compare:CC (match_dup 0)
8217 (define_insn "*eqv<mode>3"
8218 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
8220 (xor:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
8221 (match_operand:GPR 2 "gpc_reg_operand" "r"))))]
8224 [(set_attr "type" "integer")
8225 (set_attr "length" "4")])
8228 ;; 128-bit logical operations expanders
8230 (define_expand "and<mode>3"
8231 [(parallel [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
8233 (match_operand:BOOL_128 1 "vlogical_operand" "")
8234 (match_operand:BOOL_128 2 "vlogical_operand" "")))
8235 (clobber (match_scratch:CC 3 ""))])]
8239 (define_expand "ior<mode>3"
8240 [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
8241 (ior:BOOL_128 (match_operand:BOOL_128 1 "vlogical_operand" "")
8242 (match_operand:BOOL_128 2 "vlogical_operand" "")))]
8246 (define_expand "xor<mode>3"
8247 [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
8248 (xor:BOOL_128 (match_operand:BOOL_128 1 "vlogical_operand" "")
8249 (match_operand:BOOL_128 2 "vlogical_operand" "")))]
8253 (define_expand "one_cmpl<mode>2"
8254 [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
8255 (not:BOOL_128 (match_operand:BOOL_128 1 "vlogical_operand" "")))]
8259 (define_expand "nor<mode>3"
8260 [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
8262 (not:BOOL_128 (match_operand:BOOL_128 1 "vlogical_operand" ""))
8263 (not:BOOL_128 (match_operand:BOOL_128 2 "vlogical_operand" ""))))]
8267 (define_expand "andc<mode>3"
8268 [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
8270 (not:BOOL_128 (match_operand:BOOL_128 2 "vlogical_operand" ""))
8271 (match_operand:BOOL_128 1 "vlogical_operand" "")))]
8275 ;; Power8 vector logical instructions.
8276 (define_expand "eqv<mode>3"
8277 [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
8279 (xor:BOOL_128 (match_operand:BOOL_128 1 "vlogical_operand" "")
8280 (match_operand:BOOL_128 2 "vlogical_operand" ""))))]
8281 "<MODE>mode == TImode || <MODE>mode == PTImode || TARGET_P8_VECTOR"
8284 ;; Rewrite nand into canonical form
8285 (define_expand "nand<mode>3"
8286 [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
8288 (not:BOOL_128 (match_operand:BOOL_128 1 "vlogical_operand" ""))
8289 (not:BOOL_128 (match_operand:BOOL_128 2 "vlogical_operand" ""))))]
8290 "<MODE>mode == TImode || <MODE>mode == PTImode || TARGET_P8_VECTOR"
8293 ;; The canonical form is to have the negated element first, so we need to
8294 ;; reverse arguments.
8295 (define_expand "orc<mode>3"
8296 [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
8298 (not:BOOL_128 (match_operand:BOOL_128 2 "vlogical_operand" ""))
8299 (match_operand:BOOL_128 1 "vlogical_operand" "")))]
8300 "<MODE>mode == TImode || <MODE>mode == PTImode || TARGET_P8_VECTOR"
8303 ;; 128-bit logical operations insns and split operations
8304 (define_insn_and_split "*and<mode>3_internal"
8305 [(set (match_operand:BOOL_128 0 "vlogical_operand" "=<BOOL_REGS_OUTPUT>")
8307 (match_operand:BOOL_128 1 "vlogical_operand" "%<BOOL_REGS_OP1>")
8308 (match_operand:BOOL_128 2 "vlogical_operand" "<BOOL_REGS_OP2>")))
8309 (clobber (match_scratch:CC 3 "<BOOL_REGS_AND_CR0>"))]
8312 if (TARGET_VSX && vsx_register_operand (operands[0], <MODE>mode))
8313 return "xxland %x0,%x1,%x2";
8315 if (TARGET_ALTIVEC && altivec_register_operand (operands[0], <MODE>mode))
8316 return "vand %0,%1,%2";
8320 "reload_completed && int_reg_operand (operands[0], <MODE>mode)"
8323 rs6000_split_logical (operands, AND, false, false, false, operands[3]);
8328 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
8329 (const_string "vecsimple")
8330 (const_string "integer")))
8331 (set (attr "length")
8333 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
8336 (match_test "TARGET_POWERPC64")
8338 (const_string "16"))))])
8341 (define_insn_and_split "*bool<mode>3_internal"
8342 [(set (match_operand:BOOL_128 0 "vlogical_operand" "=<BOOL_REGS_OUTPUT>")
8343 (match_operator:BOOL_128 3 "boolean_or_operator"
8344 [(match_operand:BOOL_128 1 "vlogical_operand" "%<BOOL_REGS_OP1>")
8345 (match_operand:BOOL_128 2 "vlogical_operand" "<BOOL_REGS_OP2>")]))]
8348 if (TARGET_VSX && vsx_register_operand (operands[0], <MODE>mode))
8349 return "xxl%q3 %x0,%x1,%x2";
8351 if (TARGET_ALTIVEC && altivec_register_operand (operands[0], <MODE>mode))
8352 return "v%q3 %0,%1,%2";
8356 "reload_completed && int_reg_operand (operands[0], <MODE>mode)"
8359 rs6000_split_logical (operands, GET_CODE (operands[3]), false, false, false,
8365 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
8366 (const_string "vecsimple")
8367 (const_string "integer")))
8368 (set (attr "length")
8370 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
8373 (match_test "TARGET_POWERPC64")
8375 (const_string "16"))))])
8378 (define_insn_and_split "*boolc<mode>3_internal1"
8379 [(set (match_operand:BOOL_128 0 "vlogical_operand" "=<BOOL_REGS_OUTPUT>")
8380 (match_operator:BOOL_128 3 "boolean_operator"
8382 (match_operand:BOOL_128 2 "vlogical_operand" "<BOOL_REGS_OP1>"))
8383 (match_operand:BOOL_128 1 "vlogical_operand" "<BOOL_REGS_OP2>")]))]
8384 "TARGET_P8_VECTOR || (GET_CODE (operands[3]) == AND)"
8386 if (TARGET_VSX && vsx_register_operand (operands[0], <MODE>mode))
8387 return "xxl%q3 %x0,%x1,%x2";
8389 if (TARGET_ALTIVEC && altivec_register_operand (operands[0], <MODE>mode))
8390 return "v%q3 %0,%1,%2";
8394 "(TARGET_P8_VECTOR || (GET_CODE (operands[3]) == AND))
8395 && reload_completed && int_reg_operand (operands[0], <MODE>mode)"
8398 rs6000_split_logical (operands, GET_CODE (operands[3]), false, true, false,
8404 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
8405 (const_string "vecsimple")
8406 (const_string "integer")))
8407 (set (attr "length")
8409 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
8412 (match_test "TARGET_POWERPC64")
8414 (const_string "16"))))])
8416 (define_insn_and_split "*boolc<mode>3_internal2"
8417 [(set (match_operand:TI2 0 "int_reg_operand" "=&r,r,r")
8418 (match_operator:TI2 3 "boolean_operator"
8420 (match_operand:TI2 1 "int_reg_operand" "r,0,r"))
8421 (match_operand:TI2 2 "int_reg_operand" "r,r,0")]))]
8422 "!TARGET_P8_VECTOR && (GET_CODE (operands[3]) != AND)"
8424 "reload_completed && !TARGET_P8_VECTOR && (GET_CODE (operands[3]) != AND)"
8427 rs6000_split_logical (operands, GET_CODE (operands[3]), false, true, false,
8431 [(set_attr "type" "integer")
8432 (set (attr "length")
8434 (match_test "TARGET_POWERPC64")
8436 (const_string "16")))])
8439 (define_insn_and_split "*boolcc<mode>3_internal1"
8440 [(set (match_operand:BOOL_128 0 "vlogical_operand" "=<BOOL_REGS_OUTPUT>")
8441 (match_operator:BOOL_128 3 "boolean_operator"
8443 (match_operand:BOOL_128 1 "vlogical_operand" "<BOOL_REGS_OP1>"))
8445 (match_operand:BOOL_128 2 "vlogical_operand" "<BOOL_REGS_OP2>"))]))]
8446 "TARGET_P8_VECTOR || (GET_CODE (operands[3]) == AND)"
8448 if (TARGET_VSX && vsx_register_operand (operands[0], <MODE>mode))
8449 return "xxl%q3 %x0,%x1,%x2";
8451 if (TARGET_ALTIVEC && altivec_register_operand (operands[0], <MODE>mode))
8452 return "v%q3 %0,%1,%2";
8456 "(TARGET_P8_VECTOR || (GET_CODE (operands[3]) == AND))
8457 && reload_completed && int_reg_operand (operands[0], <MODE>mode)"
8460 rs6000_split_logical (operands, GET_CODE (operands[3]), false, true, true,
8466 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
8467 (const_string "vecsimple")
8468 (const_string "integer")))
8469 (set (attr "length")
8471 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
8474 (match_test "TARGET_POWERPC64")
8476 (const_string "16"))))])
8478 (define_insn_and_split "*boolcc<mode>3_internal2"
8479 [(set (match_operand:TI2 0 "int_reg_operand" "=&r,r,r")
8480 (match_operator:TI2 3 "boolean_operator"
8482 (match_operand:TI2 1 "int_reg_operand" "r,0,r"))
8484 (match_operand:TI2 2 "int_reg_operand" "r,r,0"))]))]
8485 "!TARGET_P8_VECTOR && (GET_CODE (operands[3]) != AND)"
8487 "reload_completed && !TARGET_P8_VECTOR && (GET_CODE (operands[3]) != AND)"
8490 rs6000_split_logical (operands, GET_CODE (operands[3]), false, true, true,
8494 [(set_attr "type" "integer")
8495 (set (attr "length")
8497 (match_test "TARGET_POWERPC64")
8499 (const_string "16")))])
8503 (define_insn_and_split "*eqv<mode>3_internal1"
8504 [(set (match_operand:BOOL_128 0 "vlogical_operand" "=<BOOL_REGS_OUTPUT>")
8507 (match_operand:BOOL_128 1 "vlogical_operand" "<BOOL_REGS_OP1>")
8508 (match_operand:BOOL_128 2 "vlogical_operand" "<BOOL_REGS_OP2>"))))]
8511 if (vsx_register_operand (operands[0], <MODE>mode))
8512 return "xxleqv %x0,%x1,%x2";
8516 "TARGET_P8_VECTOR && reload_completed
8517 && int_reg_operand (operands[0], <MODE>mode)"
8520 rs6000_split_logical (operands, XOR, true, false, false, NULL_RTX);
8525 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
8526 (const_string "vecsimple")
8527 (const_string "integer")))
8528 (set (attr "length")
8530 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
8533 (match_test "TARGET_POWERPC64")
8535 (const_string "16"))))])
8537 (define_insn_and_split "*eqv<mode>3_internal2"
8538 [(set (match_operand:TI2 0 "int_reg_operand" "=&r,r,r")
8541 (match_operand:TI2 1 "int_reg_operand" "r,0,r")
8542 (match_operand:TI2 2 "int_reg_operand" "r,r,0"))))]
8545 "reload_completed && !TARGET_P8_VECTOR"
8548 rs6000_split_logical (operands, XOR, true, false, false, NULL_RTX);
8551 [(set_attr "type" "integer")
8552 (set (attr "length")
8554 (match_test "TARGET_POWERPC64")
8556 (const_string "16")))])
8558 ;; 128-bit one's complement
8559 (define_insn_and_split "*one_cmpl<mode>3_internal"
8560 [(set (match_operand:BOOL_128 0 "vlogical_operand" "=<BOOL_REGS_OUTPUT>")
8562 (match_operand:BOOL_128 1 "vlogical_operand" "<BOOL_REGS_UNARY>")))]
8565 if (TARGET_VSX && vsx_register_operand (operands[0], <MODE>mode))
8566 return "xxlnor %x0,%x1,%x1";
8568 if (TARGET_ALTIVEC && altivec_register_operand (operands[0], <MODE>mode))
8569 return "vnor %0,%1,%1";
8573 "reload_completed && int_reg_operand (operands[0], <MODE>mode)"
8576 rs6000_split_logical (operands, NOT, false, false, false, NULL_RTX);
8581 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
8582 (const_string "vecsimple")
8583 (const_string "integer")))
8584 (set (attr "length")
8586 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
8589 (match_test "TARGET_POWERPC64")
8591 (const_string "16"))))])
8594 ;; Now define ways of moving data around.
8596 ;; Set up a register with a value from the GOT table
8598 (define_expand "movsi_got"
8599 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8600 (unspec:SI [(match_operand:SI 1 "got_operand" "")
8601 (match_dup 2)] UNSPEC_MOVSI_GOT))]
8602 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
8605 if (GET_CODE (operands[1]) == CONST)
8607 rtx offset = const0_rtx;
8608 HOST_WIDE_INT value;
8610 operands[1] = eliminate_constant_term (XEXP (operands[1], 0), &offset);
8611 value = INTVAL (offset);
8614 rtx tmp = (!can_create_pseudo_p ()
8616 : gen_reg_rtx (Pmode));
8617 emit_insn (gen_movsi_got (tmp, operands[1]));
8618 emit_insn (gen_addsi3 (operands[0], tmp, offset));
8623 operands[2] = rs6000_got_register (operands[1]);
8626 (define_insn "*movsi_got_internal"
8627 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8628 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
8629 (match_operand:SI 2 "gpc_reg_operand" "b")]
8631 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
8632 "lwz %0,%a1@got(%2)"
8633 [(set_attr "type" "load")])
8635 ;; Used by sched, shorten_branches and final when the GOT pseudo reg
8636 ;; didn't get allocated to a hard register.
8638 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8639 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
8640 (match_operand:SI 2 "memory_operand" "")]
8642 "DEFAULT_ABI == ABI_V4
8644 && (reload_in_progress || reload_completed)"
8645 [(set (match_dup 0) (match_dup 2))
8646 (set (match_dup 0) (unspec:SI [(match_dup 1)(match_dup 0)]
8650 ;; For SI, we special-case integers that can't be loaded in one insn. We
8651 ;; do the load 16-bits at a time. We could do this by loading from memory,
8652 ;; and this is even supposed to be faster, but it is simpler not to get
8653 ;; integers in the TOC.
8654 (define_insn "movsi_low"
8655 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8656 (mem:SI (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
8657 (match_operand 2 "" ""))))]
8658 "TARGET_MACHO && ! TARGET_64BIT"
8659 "lwz %0,lo16(%2)(%1)"
8660 [(set_attr "type" "load")
8661 (set_attr "length" "4")])
8663 (define_insn "*movsi_internal1"
8664 [(set (match_operand:SI 0 "rs6000_nonimmediate_operand" "=r,r,r,m,r,r,r,r,*c*l,*h,*h")
8665 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,*h,r,r,0"))]
8666 "!TARGET_SINGLE_FPU &&
8667 (gpc_reg_operand (operands[0], SImode) || gpc_reg_operand (operands[1], SImode))"
8680 [(set_attr "type" "*,*,load,store,*,*,*,mfjmpr,mtjmpr,*,*")
8681 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4")])
8683 (define_insn "*movsi_internal1_single"
8684 [(set (match_operand:SI 0 "rs6000_nonimmediate_operand" "=r,r,r,m,r,r,r,r,*c*l,*h,*h,m,*f")
8685 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,*h,r,r,0,f,m"))]
8686 "TARGET_SINGLE_FPU &&
8687 (gpc_reg_operand (operands[0], SImode) || gpc_reg_operand (operands[1], SImode))"
8702 [(set_attr "type" "*,*,load,store,*,*,*,mfjmpr,mtjmpr,*,*,fpstore,fpload")
8703 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4,4,4")])
8705 ;; Split a load of a large constant into the appropriate two-insn
8709 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8710 (match_operand:SI 1 "const_int_operand" ""))]
8711 "(unsigned HOST_WIDE_INT) (INTVAL (operands[1]) + 0x8000) >= 0x10000
8712 && (INTVAL (operands[1]) & 0xffff) != 0"
8716 (ior:SI (match_dup 0)
8720 if (rs6000_emit_set_const (operands[0], operands[1]))
8726 (define_insn "*mov<mode>_internal2"
8727 [(set (match_operand:CC 2 "cc_reg_operand" "=y,x,?y")
8728 (compare:CC (match_operand:P 1 "gpc_reg_operand" "0,r,r")
8730 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r") (match_dup 1))]
8736 [(set_attr "type" "cmp,logical,cmp")
8737 (set_attr "dot" "yes")
8738 (set_attr "length" "4,4,8")])
8741 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
8742 (compare:CC (match_operand:P 1 "gpc_reg_operand" "")
8744 (set (match_operand:P 0 "gpc_reg_operand" "") (match_dup 1))]
8746 [(set (match_dup 0) (match_dup 1))
8748 (compare:CC (match_dup 0)
8752 (define_insn "*movhi_internal"
8753 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,m,r,r,*c*l,*h")
8754 (match_operand:HI 1 "input_operand" "r,m,r,i,*h,r,0"))]
8755 "gpc_reg_operand (operands[0], HImode)
8756 || gpc_reg_operand (operands[1], HImode)"
8765 [(set_attr "type" "*,load,store,*,mfjmpr,mtjmpr,*")])
8767 (define_expand "mov<mode>"
8768 [(set (match_operand:INT 0 "general_operand" "")
8769 (match_operand:INT 1 "any_operand" ""))]
8771 "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
8773 (define_insn "*movqi_internal"
8774 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,m,r,r,*c*l,*h")
8775 (match_operand:QI 1 "input_operand" "r,m,r,i,*h,r,0"))]
8776 "gpc_reg_operand (operands[0], QImode)
8777 || gpc_reg_operand (operands[1], QImode)"
8786 [(set_attr "type" "*,load,store,*,mfjmpr,mtjmpr,*")])
8788 ;; Here is how to move condition codes around. When we store CC data in
8789 ;; an integer register or memory, we store just the high-order 4 bits.
8790 ;; This lets us not shift in the most common case of CR0.
8791 (define_expand "movcc"
8792 [(set (match_operand:CC 0 "nonimmediate_operand" "")
8793 (match_operand:CC 1 "nonimmediate_operand" ""))]
8797 (define_insn "*movcc_internal1"
8798 [(set (match_operand:CC 0 "nonimmediate_operand" "=y,x,?y,y,r,r,r,r,r,cl,r,m")
8799 (match_operand:CC 1 "general_operand" "y,r,r,O,x,y,r,I,h,r,m,r"))]
8800 "register_operand (operands[0], CCmode)
8801 || register_operand (operands[1], CCmode)"
8805 rlwinm %1,%1,%F0,0xffffffff\;mtcrf %R0,%1\;rlwinm %1,%1,%f0,0xffffffff
8808 mfcr %0%Q1\;rlwinm %0,%0,%f1,0xf0000000
8816 (cond [(eq_attr "alternative" "0,3")
8817 (const_string "cr_logical")
8818 (eq_attr "alternative" "1,2")
8819 (const_string "mtcr")
8820 (eq_attr "alternative" "6,7")
8821 (const_string "integer")
8822 (eq_attr "alternative" "8")
8823 (const_string "mfjmpr")
8824 (eq_attr "alternative" "9")
8825 (const_string "mtjmpr")
8826 (eq_attr "alternative" "10")
8827 (const_string "load")
8828 (eq_attr "alternative" "11")
8829 (const_string "store")
8830 (match_test "TARGET_MFCRF")
8831 (const_string "mfcrf")
8833 (const_string "mfcr")))
8834 (set_attr "length" "4,4,12,4,4,8,4,4,4,4,4,4")])
8836 ;; For floating-point, we normally deal with the floating-point registers
8837 ;; unless -msoft-float is used. The sole exception is that parameter passing
8838 ;; can produce floating-point values in fixed-point registers. Unless the
8839 ;; value is a simple constant or already in memory, we deal with this by
8840 ;; allocating memory and copying the value explicitly via that memory location.
8842 ;; Move 32-bit binary/decimal floating point
8843 (define_expand "mov<mode>"
8844 [(set (match_operand:FMOVE32 0 "nonimmediate_operand" "")
8845 (match_operand:FMOVE32 1 "any_operand" ""))]
8847 "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
8850 [(set (match_operand:FMOVE32 0 "gpc_reg_operand" "")
8851 (match_operand:FMOVE32 1 "const_double_operand" ""))]
8853 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8854 || (GET_CODE (operands[0]) == SUBREG
8855 && GET_CODE (SUBREG_REG (operands[0])) == REG
8856 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8857 [(set (match_dup 2) (match_dup 3))]
8863 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8864 <real_value_to_target> (rv, l);
8866 if (! TARGET_POWERPC64)
8867 operands[2] = operand_subword (operands[0], 0, 0, <MODE>mode);
8869 operands[2] = gen_lowpart (SImode, operands[0]);
8871 operands[3] = gen_int_mode (l, SImode);
8874 (define_insn "mov<mode>_hardfloat"
8875 [(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")
8876 (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"))]
8877 "(gpc_reg_operand (operands[0], <MODE>mode)
8878 || gpc_reg_operand (operands[1], <MODE>mode))
8879 && (TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT)"
8898 [(set_attr "type" "*,load,store,fp,vecsimple,vecsimple,fpload,fpstore,fpload,fpstore,mftgpr,mffgpr,mtjmpr,mfjmpr,*,*,*")
8899 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,8")])
8901 (define_insn "*mov<mode>_softfloat"
8902 [(set (match_operand:FMOVE32 0 "nonimmediate_operand" "=r,cl,r,r,m,r,r,r,r,*h")
8903 (match_operand:FMOVE32 1 "input_operand" "r,r,h,m,r,I,L,G,Fn,0"))]
8904 "(gpc_reg_operand (operands[0], <MODE>mode)
8905 || gpc_reg_operand (operands[1], <MODE>mode))
8906 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)"
8918 [(set_attr "type" "*,mtjmpr,mfjmpr,load,store,*,*,*,*,*")
8919 (set_attr "length" "4,4,4,4,4,4,4,4,8,4")])
8922 ;; Move 64-bit binary/decimal floating point
8923 (define_expand "mov<mode>"
8924 [(set (match_operand:FMOVE64 0 "nonimmediate_operand" "")
8925 (match_operand:FMOVE64 1 "any_operand" ""))]
8927 "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
8930 [(set (match_operand:FMOVE64 0 "gpc_reg_operand" "")
8931 (match_operand:FMOVE64 1 "const_int_operand" ""))]
8932 "! TARGET_POWERPC64 && reload_completed
8933 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8934 || (GET_CODE (operands[0]) == SUBREG
8935 && GET_CODE (SUBREG_REG (operands[0])) == REG
8936 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8937 [(set (match_dup 2) (match_dup 4))
8938 (set (match_dup 3) (match_dup 1))]
8941 int endian = (WORDS_BIG_ENDIAN == 0);
8942 HOST_WIDE_INT value = INTVAL (operands[1]);
8944 operands[2] = operand_subword (operands[0], endian, 0, <MODE>mode);
8945 operands[3] = operand_subword (operands[0], 1 - endian, 0, <MODE>mode);
8946 operands[4] = GEN_INT (value >> 32);
8947 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
8951 [(set (match_operand:FMOVE64 0 "gpc_reg_operand" "")
8952 (match_operand:FMOVE64 1 "const_double_operand" ""))]
8953 "! TARGET_POWERPC64 && reload_completed
8954 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8955 || (GET_CODE (operands[0]) == SUBREG
8956 && GET_CODE (SUBREG_REG (operands[0])) == REG
8957 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8958 [(set (match_dup 2) (match_dup 4))
8959 (set (match_dup 3) (match_dup 5))]
8962 int endian = (WORDS_BIG_ENDIAN == 0);
8966 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8967 <real_value_to_target> (rv, l);
8969 operands[2] = operand_subword (operands[0], endian, 0, <MODE>mode);
8970 operands[3] = operand_subword (operands[0], 1 - endian, 0, <MODE>mode);
8971 operands[4] = gen_int_mode (l[endian], SImode);
8972 operands[5] = gen_int_mode (l[1 - endian], SImode);
8976 [(set (match_operand:FMOVE64 0 "gpc_reg_operand" "")
8977 (match_operand:FMOVE64 1 "const_double_operand" ""))]
8978 "TARGET_POWERPC64 && reload_completed
8979 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8980 || (GET_CODE (operands[0]) == SUBREG
8981 && GET_CODE (SUBREG_REG (operands[0])) == REG
8982 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8983 [(set (match_dup 2) (match_dup 3))]
8986 int endian = (WORDS_BIG_ENDIAN == 0);
8991 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8992 <real_value_to_target> (rv, l);
8994 operands[2] = gen_lowpart (DImode, operands[0]);
8995 /* HIGHPART is lower memory address when WORDS_BIG_ENDIAN. */
8996 val = ((HOST_WIDE_INT)(unsigned long)l[endian] << 32
8997 | ((HOST_WIDE_INT)(unsigned long)l[1 - endian]));
8999 operands[3] = gen_int_mode (val, DImode);
9002 ;; Don't have reload use general registers to load a constant. It is
9003 ;; less efficient than loading the constant into an FP register, since
9004 ;; it will probably be used there.
9006 ;; The move constraints are ordered to prefer floating point registers before
9007 ;; general purpose registers to avoid doing a store and a load to get the value
9008 ;; into a floating point register when it is needed for a floating point
9009 ;; operation. Prefer traditional floating point registers over VSX registers,
9010 ;; since the D-form version of the memory instructions does not need a GPR for
9013 (define_insn "*mov<mode>_hardfloat32"
9014 [(set (match_operand:FMOVE64 0 "nonimmediate_operand" "=m,d,d,wv,Z,wa,wa,Y,r,!r,!r,!r,!r")
9015 (match_operand:FMOVE64 1 "input_operand" "d,m,d,Z,wv,wa,j,r,Y,r,G,H,F"))]
9016 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9017 && (gpc_reg_operand (operands[0], <MODE>mode)
9018 || gpc_reg_operand (operands[1], <MODE>mode))"
9033 [(set_attr "type" "fpstore,fpload,fp,fpload,fpstore,vecsimple,vecsimple,store,load,two,fp,fp,*")
9034 (set_attr "length" "4,4,4,4,4,4,4,8,8,8,8,12,16")])
9036 (define_insn "*mov<mode>_softfloat32"
9037 [(set (match_operand:FMOVE64 0 "nonimmediate_operand" "=Y,r,r,r,r,r")
9038 (match_operand:FMOVE64 1 "input_operand" "r,Y,r,G,H,F"))]
9040 && ((TARGET_FPRS && TARGET_SINGLE_FLOAT)
9041 || TARGET_SOFT_FLOAT || TARGET_E500_SINGLE
9042 || (<MODE>mode == DDmode && TARGET_E500_DOUBLE))
9043 && (gpc_reg_operand (operands[0], <MODE>mode)
9044 || gpc_reg_operand (operands[1], <MODE>mode))"
9046 [(set_attr "type" "store,load,two,*,*,*")
9047 (set_attr "length" "8,8,8,8,12,16")])
9049 ; ld/std require word-aligned displacements -> 'Y' constraint.
9050 ; List Y->r and r->Y before r->r for reload.
9051 (define_insn "*mov<mode>_hardfloat64"
9052 [(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")
9053 (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"))]
9054 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9055 && (gpc_reg_operand (operands[0], <MODE>mode)
9056 || gpc_reg_operand (operands[1], <MODE>mode))"
9078 [(set_attr "type" "fpstore,fpload,fp,fpload,fpstore,vecsimple,vecsimple,store,load,*,mtjmpr,mfjmpr,*,*,*,*,mftgpr,mffgpr,mftgpr,mffgpr")
9079 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4,4,8,12,16,4,4,4,4")])
9081 (define_insn "*mov<mode>_softfloat64"
9082 [(set (match_operand:FMOVE64 0 "nonimmediate_operand" "=Y,r,r,cl,r,r,r,r,*h")
9083 (match_operand:FMOVE64 1 "input_operand" "r,Y,r,r,h,G,H,F,0"))]
9084 "TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)
9085 && (gpc_reg_operand (operands[0], <MODE>mode)
9086 || gpc_reg_operand (operands[1], <MODE>mode))"
9097 [(set_attr "type" "store,load,*,mtjmpr,mfjmpr,*,*,*,*")
9098 (set_attr "length" "4,4,4,4,4,8,12,16,4")])
9100 (define_expand "mov<mode>"
9101 [(set (match_operand:FMOVE128 0 "general_operand" "")
9102 (match_operand:FMOVE128 1 "any_operand" ""))]
9104 "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
9106 ;; It's important to list Y->r and r->Y before r->r because otherwise
9107 ;; reload, given m->r, will try to pick r->r and reload it, which
9108 ;; doesn't make progress.
9110 ;; We can't split little endian direct moves of TDmode, because the words are
9111 ;; not swapped like they are for TImode or TFmode. Subregs therefore are
9112 ;; problematical. Don't allow direct move for this case.
9114 (define_insn_and_split "*mov<mode>_64bit_dm"
9115 [(set (match_operand:FMOVE128 0 "nonimmediate_operand" "=m,d,d,Y,r,r,r,wm")
9116 (match_operand:FMOVE128 1 "input_operand" "d,m,d,r,YGHF,r,wm,r"))]
9117 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_POWERPC64
9118 && (<MODE>mode != TDmode || WORDS_BIG_ENDIAN)
9119 && (gpc_reg_operand (operands[0], <MODE>mode)
9120 || gpc_reg_operand (operands[1], <MODE>mode))"
9122 "&& reload_completed"
9124 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
9125 [(set_attr "length" "8,8,8,12,12,8,8,8")])
9127 (define_insn_and_split "*movtd_64bit_nodm"
9128 [(set (match_operand:TD 0 "nonimmediate_operand" "=m,d,d,Y,r,r")
9129 (match_operand:TD 1 "input_operand" "d,m,d,r,YGHF,r"))]
9130 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_POWERPC64 && !WORDS_BIG_ENDIAN
9131 && (gpc_reg_operand (operands[0], TDmode)
9132 || gpc_reg_operand (operands[1], TDmode))"
9134 "&& reload_completed"
9136 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
9137 [(set_attr "length" "8,8,8,12,12,8")])
9139 (define_insn_and_split "*mov<mode>_32bit"
9140 [(set (match_operand:FMOVE128 0 "nonimmediate_operand" "=m,d,d,Y,r,r")
9141 (match_operand:FMOVE128 1 "input_operand" "d,m,d,r,YGHF,r"))]
9142 "TARGET_HARD_FLOAT && TARGET_FPRS && !TARGET_POWERPC64
9143 && (gpc_reg_operand (operands[0], <MODE>mode)
9144 || gpc_reg_operand (operands[1], <MODE>mode))"
9146 "&& reload_completed"
9148 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
9149 [(set_attr "length" "8,8,8,20,20,16")])
9151 (define_insn_and_split "*mov<mode>_softfloat"
9152 [(set (match_operand:FMOVE128 0 "rs6000_nonimmediate_operand" "=Y,r,r")
9153 (match_operand:FMOVE128 1 "input_operand" "r,YGHF,r"))]
9154 "(TARGET_SOFT_FLOAT || !TARGET_FPRS)
9155 && (gpc_reg_operand (operands[0], <MODE>mode)
9156 || gpc_reg_operand (operands[1], <MODE>mode))"
9158 "&& reload_completed"
9160 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
9161 [(set_attr "length" "20,20,16")])
9163 (define_expand "extenddftf2"
9164 [(set (match_operand:TF 0 "nonimmediate_operand" "")
9165 (float_extend:TF (match_operand:DF 1 "input_operand" "")))]
9167 && TARGET_HARD_FLOAT
9168 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9169 && TARGET_LONG_DOUBLE_128"
9171 if (TARGET_E500_DOUBLE)
9172 emit_insn (gen_spe_extenddftf2 (operands[0], operands[1]));
9174 emit_insn (gen_extenddftf2_fprs (operands[0], operands[1]));
9178 (define_expand "extenddftf2_fprs"
9179 [(parallel [(set (match_operand:TF 0 "nonimmediate_operand" "")
9180 (float_extend:TF (match_operand:DF 1 "input_operand" "")))
9181 (use (match_dup 2))])]
9183 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9184 && TARGET_LONG_DOUBLE_128"
9186 operands[2] = CONST0_RTX (DFmode);
9187 /* Generate GOT reference early for SVR4 PIC. */
9188 if (DEFAULT_ABI == ABI_V4 && flag_pic)
9189 operands[2] = validize_mem (force_const_mem (DFmode, operands[2]));
9192 (define_insn_and_split "*extenddftf2_internal"
9193 [(set (match_operand:TF 0 "nonimmediate_operand" "=m,Y,d,&d,r")
9194 (float_extend:TF (match_operand:DF 1 "input_operand" "d,r,md,md,rmGHF")))
9195 (use (match_operand:DF 2 "zero_reg_mem_operand" "d,r,m,d,n"))]
9197 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9198 && TARGET_LONG_DOUBLE_128"
9200 "&& reload_completed"
9203 const int lo_word = LONG_DOUBLE_LARGE_FIRST ? GET_MODE_SIZE (DFmode) : 0;
9204 const int hi_word = LONG_DOUBLE_LARGE_FIRST ? 0 : GET_MODE_SIZE (DFmode);
9205 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word),
9207 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word),
9212 (define_expand "extendsftf2"
9213 [(set (match_operand:TF 0 "nonimmediate_operand" "")
9214 (float_extend:TF (match_operand:SF 1 "gpc_reg_operand" "")))]
9216 && TARGET_HARD_FLOAT
9217 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9218 && TARGET_LONG_DOUBLE_128"
9220 rtx tmp = gen_reg_rtx (DFmode);
9221 emit_insn (gen_extendsfdf2 (tmp, operands[1]));
9222 emit_insn (gen_extenddftf2 (operands[0], tmp));
9226 (define_expand "trunctfdf2"
9227 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9228 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "")))]
9230 && TARGET_HARD_FLOAT
9231 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9232 && TARGET_LONG_DOUBLE_128"
9235 (define_insn_and_split "trunctfdf2_internal1"
9236 [(set (match_operand:DF 0 "gpc_reg_operand" "=d,?d")
9237 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "0,d")))]
9238 "!TARGET_IEEEQUAD && !TARGET_XL_COMPAT
9239 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9243 "&& reload_completed && REGNO (operands[0]) == REGNO (operands[1])"
9246 emit_note (NOTE_INSN_DELETED);
9249 [(set_attr "type" "fp")])
9251 (define_insn "trunctfdf2_internal2"
9252 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
9253 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "d")))]
9254 "!TARGET_IEEEQUAD && TARGET_XL_COMPAT
9255 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9256 && TARGET_LONG_DOUBLE_128"
9258 [(set_attr "type" "fp")
9259 (set_attr "fp_type" "fp_addsub_d")])
9261 (define_expand "trunctfsf2"
9262 [(set (match_operand:SF 0 "gpc_reg_operand" "")
9263 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "")))]
9265 && TARGET_HARD_FLOAT
9266 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9267 && TARGET_LONG_DOUBLE_128"
9269 if (TARGET_E500_DOUBLE)
9270 emit_insn (gen_spe_trunctfsf2 (operands[0], operands[1]));
9272 emit_insn (gen_trunctfsf2_fprs (operands[0], operands[1]));
9276 (define_insn_and_split "trunctfsf2_fprs"
9277 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
9278 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "d")))
9279 (clobber (match_scratch:DF 2 "=d"))]
9281 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
9282 && TARGET_LONG_DOUBLE_128"
9284 "&& reload_completed"
9286 (float_truncate:DF (match_dup 1)))
9288 (float_truncate:SF (match_dup 2)))]
9291 (define_expand "floatsitf2"
9292 [(set (match_operand:TF 0 "gpc_reg_operand" "")
9293 (float:TF (match_operand:SI 1 "gpc_reg_operand" "")))]
9295 && TARGET_HARD_FLOAT
9296 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9297 && TARGET_LONG_DOUBLE_128"
9299 rtx tmp = gen_reg_rtx (DFmode);
9300 expand_float (tmp, operands[1], false);
9301 emit_insn (gen_extenddftf2 (operands[0], tmp));
9305 ; fadd, but rounding towards zero.
9306 ; This is probably not the optimal code sequence.
9307 (define_insn "fix_trunc_helper"
9308 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
9309 (unspec:DF [(match_operand:TF 1 "gpc_reg_operand" "d")]
9310 UNSPEC_FIX_TRUNC_TF))
9311 (clobber (match_operand:DF 2 "gpc_reg_operand" "=&d"))]
9312 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
9313 "mffs %2\n\tmtfsb1 31\n\tmtfsb0 30\n\tfadd %0,%1,%L1\n\tmtfsf 1,%2"
9314 [(set_attr "type" "fp")
9315 (set_attr "length" "20")])
9317 (define_expand "fix_trunctfsi2"
9318 [(set (match_operand:SI 0 "gpc_reg_operand" "")
9319 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))]
9320 "!TARGET_IEEEQUAD && TARGET_HARD_FLOAT
9321 && (TARGET_FPRS || TARGET_E500_DOUBLE) && TARGET_LONG_DOUBLE_128"
9323 if (TARGET_E500_DOUBLE)
9324 emit_insn (gen_spe_fix_trunctfsi2 (operands[0], operands[1]));
9326 emit_insn (gen_fix_trunctfsi2_fprs (operands[0], operands[1]));
9330 (define_expand "fix_trunctfsi2_fprs"
9331 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
9332 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))
9333 (clobber (match_dup 2))
9334 (clobber (match_dup 3))
9335 (clobber (match_dup 4))
9336 (clobber (match_dup 5))])]
9338 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9340 operands[2] = gen_reg_rtx (DFmode);
9341 operands[3] = gen_reg_rtx (DFmode);
9342 operands[4] = gen_reg_rtx (DImode);
9343 operands[5] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode));
9346 (define_insn_and_split "*fix_trunctfsi2_internal"
9347 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9348 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "d")))
9349 (clobber (match_operand:DF 2 "gpc_reg_operand" "=d"))
9350 (clobber (match_operand:DF 3 "gpc_reg_operand" "=&d"))
9351 (clobber (match_operand:DI 4 "gpc_reg_operand" "=d"))
9352 (clobber (match_operand:DI 5 "offsettable_mem_operand" "=o"))]
9354 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9360 emit_insn (gen_fix_trunc_helper (operands[2], operands[1], operands[3]));
9362 gcc_assert (MEM_P (operands[5]));
9363 lowword = adjust_address (operands[5], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
9365 emit_insn (gen_fctiwz_df (operands[4], operands[2]));
9366 emit_move_insn (operands[5], operands[4]);
9367 emit_move_insn (operands[0], lowword);
9371 (define_expand "negtf2"
9372 [(set (match_operand:TF 0 "gpc_reg_operand" "")
9373 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "")))]
9375 && TARGET_HARD_FLOAT
9376 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9377 && TARGET_LONG_DOUBLE_128"
9380 (define_insn "negtf2_internal"
9381 [(set (match_operand:TF 0 "gpc_reg_operand" "=d")
9382 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "d")))]
9384 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9387 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
9388 return \"fneg %L0,%L1\;fneg %0,%1\";
9390 return \"fneg %0,%1\;fneg %L0,%L1\";
9392 [(set_attr "type" "fp")
9393 (set_attr "length" "8")])
9395 (define_expand "abstf2"
9396 [(set (match_operand:TF 0 "gpc_reg_operand" "")
9397 (abs:TF (match_operand:TF 1 "gpc_reg_operand" "")))]
9399 && TARGET_HARD_FLOAT
9400 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9401 && TARGET_LONG_DOUBLE_128"
9404 rtx label = gen_label_rtx ();
9405 if (TARGET_E500_DOUBLE)
9407 if (flag_finite_math_only && !flag_trapping_math)
9408 emit_insn (gen_spe_abstf2_tst (operands[0], operands[1], label));
9410 emit_insn (gen_spe_abstf2_cmp (operands[0], operands[1], label));
9413 emit_insn (gen_abstf2_internal (operands[0], operands[1], label));
9418 (define_expand "abstf2_internal"
9419 [(set (match_operand:TF 0 "gpc_reg_operand" "")
9420 (match_operand:TF 1 "gpc_reg_operand" ""))
9421 (set (match_dup 3) (match_dup 5))
9422 (set (match_dup 5) (abs:DF (match_dup 5)))
9423 (set (match_dup 4) (compare:CCFP (match_dup 3) (match_dup 5)))
9424 (set (pc) (if_then_else (eq (match_dup 4) (const_int 0))
9425 (label_ref (match_operand 2 "" ""))
9427 (set (match_dup 6) (neg:DF (match_dup 6)))]
9429 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9430 && TARGET_LONG_DOUBLE_128"
9433 const int hi_word = LONG_DOUBLE_LARGE_FIRST ? 0 : GET_MODE_SIZE (DFmode);
9434 const int lo_word = LONG_DOUBLE_LARGE_FIRST ? GET_MODE_SIZE (DFmode) : 0;
9435 operands[3] = gen_reg_rtx (DFmode);
9436 operands[4] = gen_reg_rtx (CCFPmode);
9437 operands[5] = simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word);
9438 operands[6] = simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word);
9441 ;; Reload helper functions used by rs6000_secondary_reload. The patterns all
9442 ;; must have 3 arguments, and scratch register constraint must be a single
9445 ;; Reload patterns to support gpr load/store with misaligned mem.
9446 ;; and multiple gpr load/store at offset >= 0xfffc
9447 (define_expand "reload_<mode>_store"
9448 [(parallel [(match_operand 0 "memory_operand" "=m")
9449 (match_operand 1 "gpc_reg_operand" "r")
9450 (match_operand:GPR 2 "register_operand" "=&b")])]
9453 rs6000_secondary_reload_gpr (operands[1], operands[0], operands[2], true);
9457 (define_expand "reload_<mode>_load"
9458 [(parallel [(match_operand 0 "gpc_reg_operand" "=r")
9459 (match_operand 1 "memory_operand" "m")
9460 (match_operand:GPR 2 "register_operand" "=b")])]
9463 rs6000_secondary_reload_gpr (operands[0], operands[1], operands[2], false);
9468 ;; Power8 merge instructions to allow direct move to/from floating point
9469 ;; registers in 32-bit mode. We use TF mode to get two registers to move the
9470 ;; individual 32-bit parts across. Subreg doesn't work too well on the TF
9471 ;; value, since it is allocated in reload and not all of the flow information
9472 ;; is setup for it. We have two patterns to do the two moves between gprs and
9473 ;; fprs. There isn't a dependancy between the two, but we could potentially
9474 ;; schedule other instructions between the two instructions. TFmode is
9475 ;; currently limited to traditional FPR registers. If/when this is changed, we
9476 ;; will need to revist %L to make sure it works with VSX registers, or add an
9477 ;; %x version of %L.
9479 (define_insn "p8_fmrgow_<mode>"
9480 [(set (match_operand:FMOVE64X 0 "register_operand" "=d")
9481 (unspec:FMOVE64X [(match_operand:TF 1 "register_operand" "d")]
9482 UNSPEC_P8V_FMRGOW))]
9483 "!TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9485 [(set_attr "type" "vecperm")])
9487 (define_insn "p8_mtvsrwz_1"
9488 [(set (match_operand:TF 0 "register_operand" "=d")
9489 (unspec:TF [(match_operand:SI 1 "register_operand" "r")]
9490 UNSPEC_P8V_MTVSRWZ))]
9491 "!TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9493 [(set_attr "type" "mftgpr")])
9495 (define_insn "p8_mtvsrwz_2"
9496 [(set (match_operand:TF 0 "register_operand" "+d")
9497 (unspec:TF [(match_dup 0)
9498 (match_operand:SI 1 "register_operand" "r")]
9499 UNSPEC_P8V_MTVSRWZ))]
9500 "!TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9502 [(set_attr "type" "mftgpr")])
9504 (define_insn_and_split "reload_fpr_from_gpr<mode>"
9505 [(set (match_operand:FMOVE64X 0 "register_operand" "=ws")
9506 (unspec:FMOVE64X [(match_operand:FMOVE64X 1 "register_operand" "r")]
9507 UNSPEC_P8V_RELOAD_FROM_GPR))
9508 (clobber (match_operand:TF 2 "register_operand" "=d"))]
9509 "!TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9511 "&& reload_completed"
9514 rtx dest = operands[0];
9515 rtx src = operands[1];
9516 rtx tmp = operands[2];
9517 rtx gpr_hi_reg = gen_highpart (SImode, src);
9518 rtx gpr_lo_reg = gen_lowpart (SImode, src);
9520 emit_insn (gen_p8_mtvsrwz_1 (tmp, gpr_hi_reg));
9521 emit_insn (gen_p8_mtvsrwz_2 (tmp, gpr_lo_reg));
9522 emit_insn (gen_p8_fmrgow_<mode> (dest, tmp));
9525 [(set_attr "length" "12")
9526 (set_attr "type" "three")])
9528 ;; Move 128 bit values from GPRs to VSX registers in 64-bit mode
9529 (define_insn "p8_mtvsrd_1"
9530 [(set (match_operand:TF 0 "register_operand" "=ws")
9531 (unspec:TF [(match_operand:DI 1 "register_operand" "r")]
9532 UNSPEC_P8V_MTVSRD))]
9533 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9535 [(set_attr "type" "mftgpr")])
9537 (define_insn "p8_mtvsrd_2"
9538 [(set (match_operand:TF 0 "register_operand" "+ws")
9539 (unspec:TF [(match_dup 0)
9540 (match_operand:DI 1 "register_operand" "r")]
9541 UNSPEC_P8V_MTVSRD))]
9542 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9544 [(set_attr "type" "mftgpr")])
9546 (define_insn "p8_xxpermdi_<mode>"
9547 [(set (match_operand:FMOVE128_GPR 0 "register_operand" "=wa")
9548 (unspec:FMOVE128_GPR [(match_operand:TF 1 "register_operand" "ws")]
9549 UNSPEC_P8V_XXPERMDI))]
9550 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9551 "xxpermdi %x0,%1,%L1,0"
9552 [(set_attr "type" "vecperm")])
9554 (define_insn_and_split "reload_vsx_from_gpr<mode>"
9555 [(set (match_operand:FMOVE128_GPR 0 "register_operand" "=wa")
9556 (unspec:FMOVE128_GPR
9557 [(match_operand:FMOVE128_GPR 1 "register_operand" "r")]
9558 UNSPEC_P8V_RELOAD_FROM_GPR))
9559 (clobber (match_operand:TF 2 "register_operand" "=ws"))]
9560 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9562 "&& reload_completed"
9565 rtx dest = operands[0];
9566 rtx src = operands[1];
9567 rtx tmp = operands[2];
9568 rtx gpr_hi_reg = gen_highpart (DImode, src);
9569 rtx gpr_lo_reg = gen_lowpart (DImode, src);
9571 emit_insn (gen_p8_mtvsrd_1 (tmp, gpr_hi_reg));
9572 emit_insn (gen_p8_mtvsrd_2 (tmp, gpr_lo_reg));
9573 emit_insn (gen_p8_xxpermdi_<mode> (dest, tmp));
9575 [(set_attr "length" "12")
9576 (set_attr "type" "three")])
9579 [(set (match_operand:FMOVE128_GPR 0 "nonimmediate_operand" "")
9580 (match_operand:FMOVE128_GPR 1 "input_operand" ""))]
9582 && (int_reg_operand (operands[0], <MODE>mode)
9583 || int_reg_operand (operands[1], <MODE>mode))"
9585 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
9587 ;; Move SFmode to a VSX from a GPR register. Because scalar floating point
9588 ;; type is stored internally as double precision in the VSX registers, we have
9589 ;; to convert it from the vector format.
9591 (define_insn_and_split "reload_vsx_from_gprsf"
9592 [(set (match_operand:SF 0 "register_operand" "=wa")
9593 (unspec:SF [(match_operand:SF 1 "register_operand" "r")]
9594 UNSPEC_P8V_RELOAD_FROM_GPR))
9595 (clobber (match_operand:DI 2 "register_operand" "=r"))]
9596 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9598 "&& reload_completed"
9601 rtx op0 = operands[0];
9602 rtx op1 = operands[1];
9603 rtx op2 = operands[2];
9604 /* Also use the destination register to hold the unconverted DImode value.
9605 This is conceptually a separate value from OP0, so we use gen_rtx_REG
9606 rather than simplify_gen_subreg. */
9607 rtx op0_di = gen_rtx_REG (DImode, REGNO (op0));
9608 rtx op1_di = simplify_gen_subreg (DImode, op1, SFmode, 0);
9610 /* Move SF value to upper 32-bits for xscvspdpn. */
9611 emit_insn (gen_ashldi3 (op2, op1_di, GEN_INT (32)));
9612 emit_move_insn (op0_di, op2);
9613 emit_insn (gen_vsx_xscvspdpn_directmove (op0, op0_di));
9616 [(set_attr "length" "8")
9617 (set_attr "type" "two")])
9619 ;; Move 128 bit values from VSX registers to GPRs in 64-bit mode by doing a
9620 ;; normal 64-bit move, followed by an xxpermdi to get the bottom 64-bit value,
9621 ;; and then doing a move of that.
9622 (define_insn "p8_mfvsrd_3_<mode>"
9623 [(set (match_operand:DF 0 "register_operand" "=r")
9624 (unspec:DF [(match_operand:FMOVE128_GPR 1 "register_operand" "wa")]
9625 UNSPEC_P8V_RELOAD_FROM_VSX))]
9626 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9628 [(set_attr "type" "mftgpr")])
9630 (define_insn_and_split "reload_gpr_from_vsx<mode>"
9631 [(set (match_operand:FMOVE128_GPR 0 "register_operand" "=r")
9632 (unspec:FMOVE128_GPR
9633 [(match_operand:FMOVE128_GPR 1 "register_operand" "wa")]
9634 UNSPEC_P8V_RELOAD_FROM_VSX))
9635 (clobber (match_operand:FMOVE128_GPR 2 "register_operand" "=wa"))]
9636 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9638 "&& reload_completed"
9641 rtx dest = operands[0];
9642 rtx src = operands[1];
9643 rtx tmp = operands[2];
9644 rtx gpr_hi_reg = gen_highpart (DFmode, dest);
9645 rtx gpr_lo_reg = gen_lowpart (DFmode, dest);
9647 emit_insn (gen_p8_mfvsrd_3_<mode> (gpr_hi_reg, src));
9648 emit_insn (gen_vsx_xxpermdi_<mode> (tmp, src, src, GEN_INT (3)));
9649 emit_insn (gen_p8_mfvsrd_3_<mode> (gpr_lo_reg, tmp));
9651 [(set_attr "length" "12")
9652 (set_attr "type" "three")])
9654 ;; Move SFmode to a GPR from a VSX register. Because scalar floating point
9655 ;; type is stored internally as double precision, we have to convert it to the
9658 (define_insn_and_split "reload_gpr_from_vsxsf"
9659 [(set (match_operand:SF 0 "register_operand" "=r")
9660 (unspec:SF [(match_operand:SF 1 "register_operand" "wa")]
9661 UNSPEC_P8V_RELOAD_FROM_VSX))
9662 (clobber (match_operand:V4SF 2 "register_operand" "=wa"))]
9663 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9665 "&& reload_completed"
9668 rtx op0 = operands[0];
9669 rtx op1 = operands[1];
9670 rtx op2 = operands[2];
9671 rtx diop0 = simplify_gen_subreg (DImode, op0, SFmode, 0);
9673 emit_insn (gen_vsx_xscvdpspn_scalar (op2, op1));
9674 emit_insn (gen_p8_mfvsrd_4_disf (diop0, op2));
9675 emit_insn (gen_lshrdi3 (diop0, diop0, GEN_INT (32)));
9678 [(set_attr "length" "12")
9679 (set_attr "type" "three")])
9681 (define_insn "p8_mfvsrd_4_disf"
9682 [(set (match_operand:DI 0 "register_operand" "=r")
9683 (unspec:DI [(match_operand:V4SF 1 "register_operand" "wa")]
9684 UNSPEC_P8V_RELOAD_FROM_VSX))]
9685 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9687 [(set_attr "type" "mftgpr")])
9690 ;; Next come the multi-word integer load and store and the load and store
9693 ;; List r->r after r->Y, otherwise reload will try to reload a
9694 ;; non-offsettable address by using r->r which won't make progress.
9695 ;; Use of fprs is disparaged slightly otherwise reload prefers to reload
9696 ;; a gpr into a fpr instead of reloading an invalid 'Y' address
9697 (define_insn "*movdi_internal32"
9698 [(set (match_operand:DI 0 "rs6000_nonimmediate_operand" "=Y,r,r,?m,?*d,?*d,r")
9699 (match_operand:DI 1 "input_operand" "r,Y,r,d,m,d,IJKnGHF"))]
9701 && (gpc_reg_operand (operands[0], DImode)
9702 || gpc_reg_operand (operands[1], DImode))"
9711 [(set_attr "type" "store,load,*,fpstore,fpload,fp,*")])
9714 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9715 (match_operand:DI 1 "const_int_operand" ""))]
9716 "! TARGET_POWERPC64 && reload_completed
9717 && gpr_or_gpr_p (operands[0], operands[1])
9718 && !direct_move_p (operands[0], operands[1])"
9719 [(set (match_dup 2) (match_dup 4))
9720 (set (match_dup 3) (match_dup 1))]
9723 HOST_WIDE_INT value = INTVAL (operands[1]);
9724 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
9726 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
9728 operands[4] = GEN_INT (value >> 32);
9729 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
9733 [(set (match_operand:DIFD 0 "rs6000_nonimmediate_operand" "")
9734 (match_operand:DIFD 1 "input_operand" ""))]
9735 "reload_completed && !TARGET_POWERPC64
9736 && gpr_or_gpr_p (operands[0], operands[1])
9737 && !direct_move_p (operands[0], operands[1])"
9739 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
9741 (define_insn "*movdi_internal64"
9742 [(set (match_operand:DI 0 "nonimmediate_operand" "=Y,r,r,r,r,r,?m,?*d,?*d,r,*h,*h,r,?*wg,r,?*wm")
9743 (match_operand:DI 1 "input_operand" "r,Y,r,I,L,nF,d,m,d,*h,r,0,*wg,r,*wm,r"))]
9745 && (gpc_reg_operand (operands[0], DImode)
9746 || gpc_reg_operand (operands[1], DImode))"
9764 [(set_attr "type" "store,load,*,*,*,*,fpstore,fpload,fp,mfjmpr,mtjmpr,*,mftgpr,mffgpr,mftgpr,mffgpr")
9765 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4,4,4,4")])
9767 ;; Generate all one-bits and clear left or right.
9768 ;; Use (and:DI (rotate:DI ...)) to avoid anddi3 unnecessary clobber.
9770 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9771 (match_operand:DI 1 "mask64_operand" ""))]
9772 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
9773 [(set (match_dup 0) (const_int -1))
9775 (and:DI (rotate:DI (match_dup 0)
9780 ;; Split a load of a large constant into the appropriate five-instruction
9781 ;; sequence. Handle anything in a constant number of insns.
9782 ;; When non-easy constants can go in the TOC, this should use
9783 ;; easy_fp_constant predicate.
9785 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9786 (match_operand:DI 1 "const_int_operand" ""))]
9787 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
9788 [(set (match_dup 0) (match_dup 2))
9789 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
9792 if (rs6000_emit_set_const (operands[0], operands[1]))
9799 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9800 (match_operand:DI 1 "const_scalar_int_operand" ""))]
9801 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
9802 [(set (match_dup 0) (match_dup 2))
9803 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
9806 if (rs6000_emit_set_const (operands[0], operands[1]))
9812 ;; TImode/PTImode is similar, except that we usually want to compute the
9813 ;; address into a register and use lsi/stsi (the exception is during reload).
9815 (define_insn "*mov<mode>_string"
9816 [(set (match_operand:TI2 0 "reg_or_mem_operand" "=Q,Y,????r,????r,????r,r")
9817 (match_operand:TI2 1 "input_operand" "r,r,Q,Y,r,n"))]
9819 && (<MODE>mode != TImode || VECTOR_MEM_NONE_P (TImode))
9820 && (gpc_reg_operand (operands[0], <MODE>mode)
9821 || gpc_reg_operand (operands[1], <MODE>mode))"
9824 switch (which_alternative)
9830 return \"stswi %1,%P0,16\";
9834 /* If the address is not used in the output, we can use lsi. Otherwise,
9835 fall through to generating four loads. */
9837 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
9838 return \"lswi %0,%P1,16\";
9839 /* ... fall through ... */
9846 [(set_attr "type" "store,store,load,load,*,*")
9847 (set_attr "update" "yes")
9848 (set_attr "indexed" "yes")
9849 (set (attr "cell_micro") (if_then_else (match_test "TARGET_STRING")
9850 (const_string "always")
9851 (const_string "conditional")))])
9853 (define_insn "*mov<mode>_ppc64"
9854 [(set (match_operand:TI2 0 "nonimmediate_operand" "=wQ,Y,r,r,r,r")
9855 (match_operand:TI2 1 "input_operand" "r,r,wQ,Y,r,n"))]
9856 "(TARGET_POWERPC64 && VECTOR_MEM_NONE_P (<MODE>mode)
9857 && (gpc_reg_operand (operands[0], <MODE>mode)
9858 || gpc_reg_operand (operands[1], <MODE>mode)))"
9860 return rs6000_output_move_128bit (operands);
9862 [(set_attr "type" "store,store,load,load,*,*")
9863 (set_attr "length" "8")])
9866 [(set (match_operand:TI2 0 "int_reg_operand" "")
9867 (match_operand:TI2 1 "const_scalar_int_operand" ""))]
9869 && (VECTOR_MEM_NONE_P (<MODE>mode)
9870 || (reload_completed && INT_REGNO_P (REGNO (operands[0]))))"
9871 [(set (match_dup 2) (match_dup 4))
9872 (set (match_dup 3) (match_dup 5))]
9875 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
9877 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
9879 if (CONST_WIDE_INT_P (operands[1]))
9881 operands[4] = GEN_INT (CONST_WIDE_INT_ELT (operands[1], 1));
9882 operands[5] = GEN_INT (CONST_WIDE_INT_ELT (operands[1], 0));
9884 else if (CONST_INT_P (operands[1]))
9886 operands[4] = GEN_INT (- (INTVAL (operands[1]) < 0));
9887 operands[5] = operands[1];
9894 [(set (match_operand:TI2 0 "nonimmediate_operand" "")
9895 (match_operand:TI2 1 "input_operand" ""))]
9897 && gpr_or_gpr_p (operands[0], operands[1])
9898 && !direct_move_p (operands[0], operands[1])
9899 && !quad_load_store_p (operands[0], operands[1])"
9901 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
9903 (define_expand "load_multiple"
9904 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
9905 (match_operand:SI 1 "" ""))
9906 (use (match_operand:SI 2 "" ""))])]
9907 "TARGET_STRING && !TARGET_POWERPC64"
9915 /* Support only loading a constant number of fixed-point registers from
9916 memory and only bother with this if more than two; the machine
9917 doesn't support more than eight. */
9918 if (GET_CODE (operands[2]) != CONST_INT
9919 || INTVAL (operands[2]) <= 2
9920 || INTVAL (operands[2]) > 8
9921 || GET_CODE (operands[1]) != MEM
9922 || GET_CODE (operands[0]) != REG
9923 || REGNO (operands[0]) >= 32)
9926 count = INTVAL (operands[2]);
9927 regno = REGNO (operands[0]);
9929 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
9930 op1 = replace_equiv_address (operands[1],
9931 force_reg (SImode, XEXP (operands[1], 0)));
9933 for (i = 0; i < count; i++)
9934 XVECEXP (operands[3], 0, i)
9935 = gen_rtx_SET (VOIDmode, gen_rtx_REG (SImode, regno + i),
9936 adjust_address_nv (op1, SImode, i * 4));
9939 (define_insn "*ldmsi8"
9940 [(match_parallel 0 "load_multiple_operation"
9941 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9942 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9943 (set (match_operand:SI 3 "gpc_reg_operand" "")
9944 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9945 (set (match_operand:SI 4 "gpc_reg_operand" "")
9946 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9947 (set (match_operand:SI 5 "gpc_reg_operand" "")
9948 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
9949 (set (match_operand:SI 6 "gpc_reg_operand" "")
9950 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
9951 (set (match_operand:SI 7 "gpc_reg_operand" "")
9952 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
9953 (set (match_operand:SI 8 "gpc_reg_operand" "")
9954 (mem:SI (plus:SI (match_dup 1) (const_int 24))))
9955 (set (match_operand:SI 9 "gpc_reg_operand" "")
9956 (mem:SI (plus:SI (match_dup 1) (const_int 28))))])]
9957 "TARGET_STRING && XVECLEN (operands[0], 0) == 8"
9959 { return rs6000_output_load_multiple (operands); }"
9960 [(set_attr "type" "load")
9961 (set_attr "update" "yes")
9962 (set_attr "indexed" "yes")
9963 (set_attr "length" "32")])
9965 (define_insn "*ldmsi7"
9966 [(match_parallel 0 "load_multiple_operation"
9967 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9968 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9969 (set (match_operand:SI 3 "gpc_reg_operand" "")
9970 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9971 (set (match_operand:SI 4 "gpc_reg_operand" "")
9972 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9973 (set (match_operand:SI 5 "gpc_reg_operand" "")
9974 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
9975 (set (match_operand:SI 6 "gpc_reg_operand" "")
9976 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
9977 (set (match_operand:SI 7 "gpc_reg_operand" "")
9978 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
9979 (set (match_operand:SI 8 "gpc_reg_operand" "")
9980 (mem:SI (plus:SI (match_dup 1) (const_int 24))))])]
9981 "TARGET_STRING && XVECLEN (operands[0], 0) == 7"
9983 { return rs6000_output_load_multiple (operands); }"
9984 [(set_attr "type" "load")
9985 (set_attr "update" "yes")
9986 (set_attr "indexed" "yes")
9987 (set_attr "length" "32")])
9989 (define_insn "*ldmsi6"
9990 [(match_parallel 0 "load_multiple_operation"
9991 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9992 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9993 (set (match_operand:SI 3 "gpc_reg_operand" "")
9994 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9995 (set (match_operand:SI 4 "gpc_reg_operand" "")
9996 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9997 (set (match_operand:SI 5 "gpc_reg_operand" "")
9998 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
9999 (set (match_operand:SI 6 "gpc_reg_operand" "")
10000 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
10001 (set (match_operand:SI 7 "gpc_reg_operand" "")
10002 (mem:SI (plus:SI (match_dup 1) (const_int 20))))])]
10003 "TARGET_STRING && XVECLEN (operands[0], 0) == 6"
10005 { return rs6000_output_load_multiple (operands); }"
10006 [(set_attr "type" "load")
10007 (set_attr "update" "yes")
10008 (set_attr "indexed" "yes")
10009 (set_attr "length" "32")])
10011 (define_insn "*ldmsi5"
10012 [(match_parallel 0 "load_multiple_operation"
10013 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10014 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10015 (set (match_operand:SI 3 "gpc_reg_operand" "")
10016 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10017 (set (match_operand:SI 4 "gpc_reg_operand" "")
10018 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
10019 (set (match_operand:SI 5 "gpc_reg_operand" "")
10020 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
10021 (set (match_operand:SI 6 "gpc_reg_operand" "")
10022 (mem:SI (plus:SI (match_dup 1) (const_int 16))))])]
10023 "TARGET_STRING && XVECLEN (operands[0], 0) == 5"
10025 { return rs6000_output_load_multiple (operands); }"
10026 [(set_attr "type" "load")
10027 (set_attr "update" "yes")
10028 (set_attr "indexed" "yes")
10029 (set_attr "length" "32")])
10031 (define_insn "*ldmsi4"
10032 [(match_parallel 0 "load_multiple_operation"
10033 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10034 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10035 (set (match_operand:SI 3 "gpc_reg_operand" "")
10036 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10037 (set (match_operand:SI 4 "gpc_reg_operand" "")
10038 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
10039 (set (match_operand:SI 5 "gpc_reg_operand" "")
10040 (mem:SI (plus:SI (match_dup 1) (const_int 12))))])]
10041 "TARGET_STRING && XVECLEN (operands[0], 0) == 4"
10043 { return rs6000_output_load_multiple (operands); }"
10044 [(set_attr "type" "load")
10045 (set_attr "update" "yes")
10046 (set_attr "indexed" "yes")
10047 (set_attr "length" "32")])
10049 (define_insn "*ldmsi3"
10050 [(match_parallel 0 "load_multiple_operation"
10051 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10052 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10053 (set (match_operand:SI 3 "gpc_reg_operand" "")
10054 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10055 (set (match_operand:SI 4 "gpc_reg_operand" "")
10056 (mem:SI (plus:SI (match_dup 1) (const_int 8))))])]
10057 "TARGET_STRING && XVECLEN (operands[0], 0) == 3"
10059 { return rs6000_output_load_multiple (operands); }"
10060 [(set_attr "type" "load")
10061 (set_attr "update" "yes")
10062 (set_attr "indexed" "yes")
10063 (set_attr "length" "32")])
10065 (define_expand "store_multiple"
10066 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
10067 (match_operand:SI 1 "" ""))
10068 (clobber (scratch:SI))
10069 (use (match_operand:SI 2 "" ""))])]
10070 "TARGET_STRING && !TARGET_POWERPC64"
10079 /* Support only storing a constant number of fixed-point registers to
10080 memory and only bother with this if more than two; the machine
10081 doesn't support more than eight. */
10082 if (GET_CODE (operands[2]) != CONST_INT
10083 || INTVAL (operands[2]) <= 2
10084 || INTVAL (operands[2]) > 8
10085 || GET_CODE (operands[0]) != MEM
10086 || GET_CODE (operands[1]) != REG
10087 || REGNO (operands[1]) >= 32)
10090 count = INTVAL (operands[2]);
10091 regno = REGNO (operands[1]);
10093 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count + 1));
10094 to = force_reg (SImode, XEXP (operands[0], 0));
10095 op0 = replace_equiv_address (operands[0], to);
10097 XVECEXP (operands[3], 0, 0)
10098 = gen_rtx_SET (VOIDmode, adjust_address_nv (op0, SImode, 0), operands[1]);
10099 XVECEXP (operands[3], 0, 1) = gen_rtx_CLOBBER (VOIDmode,
10100 gen_rtx_SCRATCH (SImode));
10102 for (i = 1; i < count; i++)
10103 XVECEXP (operands[3], 0, i + 1)
10104 = gen_rtx_SET (VOIDmode,
10105 adjust_address_nv (op0, SImode, i * 4),
10106 gen_rtx_REG (SImode, regno + i));
10109 (define_insn "*stmsi8"
10110 [(match_parallel 0 "store_multiple_operation"
10111 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10112 (match_operand:SI 2 "gpc_reg_operand" "r"))
10113 (clobber (match_scratch:SI 3 "=X"))
10114 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10115 (match_operand:SI 4 "gpc_reg_operand" "r"))
10116 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10117 (match_operand:SI 5 "gpc_reg_operand" "r"))
10118 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10119 (match_operand:SI 6 "gpc_reg_operand" "r"))
10120 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10121 (match_operand:SI 7 "gpc_reg_operand" "r"))
10122 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10123 (match_operand:SI 8 "gpc_reg_operand" "r"))
10124 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
10125 (match_operand:SI 9 "gpc_reg_operand" "r"))
10126 (set (mem:SI (plus:SI (match_dup 1) (const_int 28)))
10127 (match_operand:SI 10 "gpc_reg_operand" "r"))])]
10128 "TARGET_STRING && XVECLEN (operands[0], 0) == 9"
10130 [(set_attr "type" "store")
10131 (set_attr "update" "yes")
10132 (set_attr "indexed" "yes")
10133 (set_attr "cell_micro" "always")])
10135 (define_insn "*stmsi7"
10136 [(match_parallel 0 "store_multiple_operation"
10137 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10138 (match_operand:SI 2 "gpc_reg_operand" "r"))
10139 (clobber (match_scratch:SI 3 "=X"))
10140 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10141 (match_operand:SI 4 "gpc_reg_operand" "r"))
10142 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10143 (match_operand:SI 5 "gpc_reg_operand" "r"))
10144 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10145 (match_operand:SI 6 "gpc_reg_operand" "r"))
10146 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10147 (match_operand:SI 7 "gpc_reg_operand" "r"))
10148 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10149 (match_operand:SI 8 "gpc_reg_operand" "r"))
10150 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
10151 (match_operand:SI 9 "gpc_reg_operand" "r"))])]
10152 "TARGET_STRING && XVECLEN (operands[0], 0) == 8"
10154 [(set_attr "type" "store")
10155 (set_attr "update" "yes")
10156 (set_attr "indexed" "yes")
10157 (set_attr "cell_micro" "always")])
10159 (define_insn "*stmsi6"
10160 [(match_parallel 0 "store_multiple_operation"
10161 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10162 (match_operand:SI 2 "gpc_reg_operand" "r"))
10163 (clobber (match_scratch:SI 3 "=X"))
10164 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10165 (match_operand:SI 4 "gpc_reg_operand" "r"))
10166 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10167 (match_operand:SI 5 "gpc_reg_operand" "r"))
10168 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10169 (match_operand:SI 6 "gpc_reg_operand" "r"))
10170 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10171 (match_operand:SI 7 "gpc_reg_operand" "r"))
10172 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10173 (match_operand:SI 8 "gpc_reg_operand" "r"))])]
10174 "TARGET_STRING && XVECLEN (operands[0], 0) == 7"
10176 [(set_attr "type" "store")
10177 (set_attr "update" "yes")
10178 (set_attr "indexed" "yes")
10179 (set_attr "cell_micro" "always")])
10181 (define_insn "*stmsi5"
10182 [(match_parallel 0 "store_multiple_operation"
10183 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10184 (match_operand:SI 2 "gpc_reg_operand" "r"))
10185 (clobber (match_scratch:SI 3 "=X"))
10186 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10187 (match_operand:SI 4 "gpc_reg_operand" "r"))
10188 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10189 (match_operand:SI 5 "gpc_reg_operand" "r"))
10190 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10191 (match_operand:SI 6 "gpc_reg_operand" "r"))
10192 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10193 (match_operand:SI 7 "gpc_reg_operand" "r"))])]
10194 "TARGET_STRING && XVECLEN (operands[0], 0) == 6"
10196 [(set_attr "type" "store")
10197 (set_attr "update" "yes")
10198 (set_attr "indexed" "yes")
10199 (set_attr "cell_micro" "always")])
10201 (define_insn "*stmsi4"
10202 [(match_parallel 0 "store_multiple_operation"
10203 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10204 (match_operand:SI 2 "gpc_reg_operand" "r"))
10205 (clobber (match_scratch:SI 3 "=X"))
10206 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10207 (match_operand:SI 4 "gpc_reg_operand" "r"))
10208 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10209 (match_operand:SI 5 "gpc_reg_operand" "r"))
10210 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10211 (match_operand:SI 6 "gpc_reg_operand" "r"))])]
10212 "TARGET_STRING && XVECLEN (operands[0], 0) == 5"
10214 [(set_attr "type" "store")
10215 (set_attr "update" "yes")
10216 (set_attr "indexed" "yes")
10217 (set_attr "cell_micro" "always")])
10219 (define_insn "*stmsi3"
10220 [(match_parallel 0 "store_multiple_operation"
10221 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10222 (match_operand:SI 2 "gpc_reg_operand" "r"))
10223 (clobber (match_scratch:SI 3 "=X"))
10224 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10225 (match_operand:SI 4 "gpc_reg_operand" "r"))
10226 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10227 (match_operand:SI 5 "gpc_reg_operand" "r"))])]
10228 "TARGET_STRING && XVECLEN (operands[0], 0) == 4"
10230 [(set_attr "type" "store")
10231 (set_attr "update" "yes")
10232 (set_attr "indexed" "yes")
10233 (set_attr "cell_micro" "always")])
10235 (define_expand "setmemsi"
10236 [(parallel [(set (match_operand:BLK 0 "" "")
10237 (match_operand 2 "const_int_operand" ""))
10238 (use (match_operand:SI 1 "" ""))
10239 (use (match_operand:SI 3 "" ""))])]
10243 /* If value to set is not zero, use the library routine. */
10244 if (operands[2] != const0_rtx)
10247 if (expand_block_clear (operands))
10253 ;; String/block move insn.
10254 ;; Argument 0 is the destination
10255 ;; Argument 1 is the source
10256 ;; Argument 2 is the length
10257 ;; Argument 3 is the alignment
10259 (define_expand "movmemsi"
10260 [(parallel [(set (match_operand:BLK 0 "" "")
10261 (match_operand:BLK 1 "" ""))
10262 (use (match_operand:SI 2 "" ""))
10263 (use (match_operand:SI 3 "" ""))])]
10267 if (expand_block_move (operands))
10273 ;; Move up to 32 bytes at a time. The fixed registers are needed because the
10274 ;; register allocator doesn't have a clue about allocating 8 word registers.
10275 ;; rD/rS = r5 is preferred, efficient form.
10276 (define_expand "movmemsi_8reg"
10277 [(parallel [(set (match_operand 0 "" "")
10278 (match_operand 1 "" ""))
10279 (use (match_operand 2 "" ""))
10280 (use (match_operand 3 "" ""))
10281 (clobber (reg:SI 5))
10282 (clobber (reg:SI 6))
10283 (clobber (reg:SI 7))
10284 (clobber (reg:SI 8))
10285 (clobber (reg:SI 9))
10286 (clobber (reg:SI 10))
10287 (clobber (reg:SI 11))
10288 (clobber (reg:SI 12))
10289 (clobber (match_scratch:SI 4 ""))])]
10294 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
10295 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
10296 (use (match_operand:SI 2 "immediate_operand" "i"))
10297 (use (match_operand:SI 3 "immediate_operand" "i"))
10298 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10299 (clobber (reg:SI 6))
10300 (clobber (reg:SI 7))
10301 (clobber (reg:SI 8))
10302 (clobber (reg:SI 9))
10303 (clobber (reg:SI 10))
10304 (clobber (reg:SI 11))
10305 (clobber (reg:SI 12))
10306 (clobber (match_scratch:SI 5 "=X"))]
10308 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
10309 || INTVAL (operands[2]) == 0)
10310 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
10311 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
10312 && REGNO (operands[4]) == 5"
10313 "lswi %4,%1,%2\;stswi %4,%0,%2"
10314 [(set_attr "type" "store")
10315 (set_attr "update" "yes")
10316 (set_attr "indexed" "yes")
10317 (set_attr "cell_micro" "always")
10318 (set_attr "length" "8")])
10320 ;; Move up to 24 bytes at a time. The fixed registers are needed because the
10321 ;; register allocator doesn't have a clue about allocating 6 word registers.
10322 ;; rD/rS = r5 is preferred, efficient form.
10323 (define_expand "movmemsi_6reg"
10324 [(parallel [(set (match_operand 0 "" "")
10325 (match_operand 1 "" ""))
10326 (use (match_operand 2 "" ""))
10327 (use (match_operand 3 "" ""))
10328 (clobber (reg:SI 5))
10329 (clobber (reg:SI 6))
10330 (clobber (reg:SI 7))
10331 (clobber (reg:SI 8))
10332 (clobber (reg:SI 9))
10333 (clobber (reg:SI 10))
10334 (clobber (match_scratch:SI 4 ""))])]
10339 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
10340 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
10341 (use (match_operand:SI 2 "immediate_operand" "i"))
10342 (use (match_operand:SI 3 "immediate_operand" "i"))
10343 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10344 (clobber (reg:SI 6))
10345 (clobber (reg:SI 7))
10346 (clobber (reg:SI 8))
10347 (clobber (reg:SI 9))
10348 (clobber (reg:SI 10))
10349 (clobber (match_scratch:SI 5 "=X"))]
10351 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
10352 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
10353 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
10354 && REGNO (operands[4]) == 5"
10355 "lswi %4,%1,%2\;stswi %4,%0,%2"
10356 [(set_attr "type" "store")
10357 (set_attr "update" "yes")
10358 (set_attr "indexed" "yes")
10359 (set_attr "cell_micro" "always")
10360 (set_attr "length" "8")])
10362 ;; Move up to 16 bytes at a time, using 4 fixed registers to avoid spill
10363 ;; problems with TImode.
10364 ;; rD/rS = r5 is preferred, efficient form.
10365 (define_expand "movmemsi_4reg"
10366 [(parallel [(set (match_operand 0 "" "")
10367 (match_operand 1 "" ""))
10368 (use (match_operand 2 "" ""))
10369 (use (match_operand 3 "" ""))
10370 (clobber (reg:SI 5))
10371 (clobber (reg:SI 6))
10372 (clobber (reg:SI 7))
10373 (clobber (reg:SI 8))
10374 (clobber (match_scratch:SI 4 ""))])]
10379 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
10380 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
10381 (use (match_operand:SI 2 "immediate_operand" "i"))
10382 (use (match_operand:SI 3 "immediate_operand" "i"))
10383 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10384 (clobber (reg:SI 6))
10385 (clobber (reg:SI 7))
10386 (clobber (reg:SI 8))
10387 (clobber (match_scratch:SI 5 "=X"))]
10389 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
10390 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
10391 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
10392 && REGNO (operands[4]) == 5"
10393 "lswi %4,%1,%2\;stswi %4,%0,%2"
10394 [(set_attr "type" "store")
10395 (set_attr "update" "yes")
10396 (set_attr "indexed" "yes")
10397 (set_attr "cell_micro" "always")
10398 (set_attr "length" "8")])
10400 ;; Move up to 8 bytes at a time.
10401 (define_expand "movmemsi_2reg"
10402 [(parallel [(set (match_operand 0 "" "")
10403 (match_operand 1 "" ""))
10404 (use (match_operand 2 "" ""))
10405 (use (match_operand 3 "" ""))
10406 (clobber (match_scratch:DI 4 ""))
10407 (clobber (match_scratch:SI 5 ""))])]
10408 "TARGET_STRING && ! TARGET_POWERPC64"
10412 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
10413 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
10414 (use (match_operand:SI 2 "immediate_operand" "i"))
10415 (use (match_operand:SI 3 "immediate_operand" "i"))
10416 (clobber (match_scratch:DI 4 "=&r"))
10417 (clobber (match_scratch:SI 5 "=X"))]
10418 "TARGET_STRING && ! TARGET_POWERPC64
10419 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
10420 "lswi %4,%1,%2\;stswi %4,%0,%2"
10421 [(set_attr "type" "store")
10422 (set_attr "update" "yes")
10423 (set_attr "indexed" "yes")
10424 (set_attr "cell_micro" "always")
10425 (set_attr "length" "8")])
10427 ;; Move up to 4 bytes at a time.
10428 (define_expand "movmemsi_1reg"
10429 [(parallel [(set (match_operand 0 "" "")
10430 (match_operand 1 "" ""))
10431 (use (match_operand 2 "" ""))
10432 (use (match_operand 3 "" ""))
10433 (clobber (match_scratch:SI 4 ""))
10434 (clobber (match_scratch:SI 5 ""))])]
10439 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
10440 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
10441 (use (match_operand:SI 2 "immediate_operand" "i"))
10442 (use (match_operand:SI 3 "immediate_operand" "i"))
10443 (clobber (match_scratch:SI 4 "=&r"))
10444 (clobber (match_scratch:SI 5 "=X"))]
10445 "TARGET_STRING && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
10446 "lswi %4,%1,%2\;stswi %4,%0,%2"
10447 [(set_attr "type" "store")
10448 (set_attr "update" "yes")
10449 (set_attr "indexed" "yes")
10450 (set_attr "cell_micro" "always")
10451 (set_attr "length" "8")])
10453 ;; Define insns that do load or store with update. Some of these we can
10454 ;; get by using pre-decrement or pre-increment, but the hardware can also
10455 ;; do cases where the increment is not the size of the object.
10457 ;; In all these cases, we use operands 0 and 1 for the register being
10458 ;; incremented because those are the operands that local-alloc will
10459 ;; tie and these are the pair most likely to be tieable (and the ones
10460 ;; that will benefit the most).
10462 (define_insn "*movdi_update1"
10463 [(set (match_operand:DI 3 "gpc_reg_operand" "=r,r")
10464 (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
10465 (match_operand:DI 2 "reg_or_aligned_short_operand" "r,I"))))
10466 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
10467 (plus:DI (match_dup 1) (match_dup 2)))]
10468 "TARGET_POWERPC64 && TARGET_UPDATE
10469 && (!avoiding_indexed_address_p (DImode)
10470 || !gpc_reg_operand (operands[2], DImode))"
10474 [(set_attr "type" "load")
10475 (set_attr "update" "yes")
10476 (set_attr "indexed" "yes,no")])
10478 (define_insn "movdi_<mode>_update"
10479 [(set (mem:DI (plus:P (match_operand:P 1 "gpc_reg_operand" "0,0")
10480 (match_operand:P 2 "reg_or_aligned_short_operand" "r,I")))
10481 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
10482 (set (match_operand:P 0 "gpc_reg_operand" "=b,b")
10483 (plus:P (match_dup 1) (match_dup 2)))]
10484 "TARGET_POWERPC64 && TARGET_UPDATE
10485 && (!avoiding_indexed_address_p (Pmode)
10486 || !gpc_reg_operand (operands[2], Pmode)
10487 || (REG_P (operands[0])
10488 && REGNO (operands[0]) == STACK_POINTER_REGNUM))"
10492 [(set_attr "type" "store")
10493 (set_attr "update" "yes")
10494 (set_attr "indexed" "yes,no")])
10496 ;; This pattern is only conditional on TARGET_POWERPC64, as it is
10497 ;; needed for stack allocation, even if the user passes -mno-update.
10498 (define_insn "movdi_<mode>_update_stack"
10499 [(set (mem:DI (plus:P (match_operand:P 1 "gpc_reg_operand" "0,0")
10500 (match_operand:P 2 "reg_or_aligned_short_operand" "r,I")))
10501 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
10502 (set (match_operand:P 0 "gpc_reg_operand" "=b,b")
10503 (plus:P (match_dup 1) (match_dup 2)))]
10508 [(set_attr "type" "store")
10509 (set_attr "update" "yes")
10510 (set_attr "indexed" "yes,no")])
10512 (define_insn "*movsi_update1"
10513 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
10514 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10515 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10516 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10517 (plus:SI (match_dup 1) (match_dup 2)))]
10519 && (!avoiding_indexed_address_p (SImode)
10520 || !gpc_reg_operand (operands[2], SImode))"
10524 [(set_attr "type" "load")
10525 (set_attr "update" "yes")
10526 (set_attr "indexed" "yes,no")])
10528 (define_insn "*movsi_update2"
10529 [(set (match_operand:DI 3 "gpc_reg_operand" "=r")
10531 (mem:SI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0")
10532 (match_operand:DI 2 "gpc_reg_operand" "r")))))
10533 (set (match_operand:DI 0 "gpc_reg_operand" "=b")
10534 (plus:DI (match_dup 1) (match_dup 2)))]
10535 "TARGET_POWERPC64 && rs6000_gen_cell_microcode
10536 && !avoiding_indexed_address_p (DImode)"
10538 [(set_attr "type" "load")
10539 (set_attr "sign_extend" "yes")
10540 (set_attr "update" "yes")
10541 (set_attr "indexed" "yes")])
10543 (define_insn "movsi_update"
10544 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10545 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10546 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
10547 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10548 (plus:SI (match_dup 1) (match_dup 2)))]
10550 && (!avoiding_indexed_address_p (SImode)
10551 || !gpc_reg_operand (operands[2], SImode)
10552 || (REG_P (operands[0])
10553 && REGNO (operands[0]) == STACK_POINTER_REGNUM))"
10557 [(set_attr "type" "store")
10558 (set_attr "update" "yes")
10559 (set_attr "indexed" "yes,no")])
10561 ;; This is an unconditional pattern; needed for stack allocation, even
10562 ;; if the user passes -mno-update.
10563 (define_insn "movsi_update_stack"
10564 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10565 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10566 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
10567 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10568 (plus:SI (match_dup 1) (match_dup 2)))]
10573 [(set_attr "type" "store")
10574 (set_attr "update" "yes")
10575 (set_attr "indexed" "yes,no")])
10577 (define_insn "*movhi_update1"
10578 [(set (match_operand:HI 3 "gpc_reg_operand" "=r,r")
10579 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10580 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10581 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10582 (plus:SI (match_dup 1) (match_dup 2)))]
10584 && (!avoiding_indexed_address_p (SImode)
10585 || !gpc_reg_operand (operands[2], SImode))"
10589 [(set_attr "type" "load")
10590 (set_attr "update" "yes")
10591 (set_attr "indexed" "yes,no")])
10593 (define_insn "*movhi_update2"
10594 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
10596 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10597 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
10598 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10599 (plus:SI (match_dup 1) (match_dup 2)))]
10601 && (!avoiding_indexed_address_p (SImode)
10602 || !gpc_reg_operand (operands[2], SImode))"
10606 [(set_attr "type" "load")
10607 (set_attr "update" "yes")
10608 (set_attr "indexed" "yes,no")])
10610 (define_insn "*movhi_update3"
10611 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
10613 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10614 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
10615 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10616 (plus:SI (match_dup 1) (match_dup 2)))]
10617 "TARGET_UPDATE && rs6000_gen_cell_microcode
10618 && (!avoiding_indexed_address_p (SImode)
10619 || !gpc_reg_operand (operands[2], SImode))"
10623 [(set_attr "type" "load")
10624 (set_attr "sign_extend" "yes")
10625 (set_attr "update" "yes")
10626 (set_attr "indexed" "yes,no")])
10628 (define_insn "*movhi_update4"
10629 [(set (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10630 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10631 (match_operand:HI 3 "gpc_reg_operand" "r,r"))
10632 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10633 (plus:SI (match_dup 1) (match_dup 2)))]
10635 && (!avoiding_indexed_address_p (SImode)
10636 || !gpc_reg_operand (operands[2], SImode))"
10640 [(set_attr "type" "store")
10641 (set_attr "update" "yes")
10642 (set_attr "indexed" "yes,no")])
10644 (define_insn "*movqi_update1"
10645 [(set (match_operand:QI 3 "gpc_reg_operand" "=r,r")
10646 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10647 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10648 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10649 (plus:SI (match_dup 1) (match_dup 2)))]
10651 && (!avoiding_indexed_address_p (SImode)
10652 || !gpc_reg_operand (operands[2], SImode))"
10656 [(set_attr "type" "load")
10657 (set_attr "update" "yes")
10658 (set_attr "indexed" "yes,no")])
10660 (define_insn "*movqi_update2"
10661 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
10663 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10664 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
10665 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10666 (plus:SI (match_dup 1) (match_dup 2)))]
10668 && (!avoiding_indexed_address_p (SImode)
10669 || !gpc_reg_operand (operands[2], SImode))"
10673 [(set_attr "type" "load")
10674 (set_attr "update" "yes")
10675 (set_attr "indexed" "yes,no")])
10677 (define_insn "*movqi_update3"
10678 [(set (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10679 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10680 (match_operand:QI 3 "gpc_reg_operand" "r,r"))
10681 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10682 (plus:SI (match_dup 1) (match_dup 2)))]
10684 && (!avoiding_indexed_address_p (SImode)
10685 || !gpc_reg_operand (operands[2], SImode))"
10689 [(set_attr "type" "store")
10690 (set_attr "update" "yes")
10691 (set_attr "indexed" "yes,no")])
10693 (define_insn "*movsf_update1"
10694 [(set (match_operand:SF 3 "gpc_reg_operand" "=f,f")
10695 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10696 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10697 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10698 (plus:SI (match_dup 1) (match_dup 2)))]
10699 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT && TARGET_UPDATE
10700 && (!avoiding_indexed_address_p (SImode)
10701 || !gpc_reg_operand (operands[2], SImode))"
10705 [(set_attr "type" "fpload")
10706 (set_attr "update" "yes")
10707 (set_attr "indexed" "yes,no")])
10709 (define_insn "*movsf_update2"
10710 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10711 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10712 (match_operand:SF 3 "gpc_reg_operand" "f,f"))
10713 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10714 (plus:SI (match_dup 1) (match_dup 2)))]
10715 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT && TARGET_UPDATE
10716 && (!avoiding_indexed_address_p (SImode)
10717 || !gpc_reg_operand (operands[2], SImode))"
10721 [(set_attr "type" "fpstore")
10722 (set_attr "update" "yes")
10723 (set_attr "indexed" "yes,no")])
10725 (define_insn "*movsf_update3"
10726 [(set (match_operand:SF 3 "gpc_reg_operand" "=r,r")
10727 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10728 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10729 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10730 (plus:SI (match_dup 1) (match_dup 2)))]
10731 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE
10732 && (!avoiding_indexed_address_p (SImode)
10733 || !gpc_reg_operand (operands[2], SImode))"
10737 [(set_attr "type" "load")
10738 (set_attr "update" "yes")
10739 (set_attr "indexed" "yes,no")])
10741 (define_insn "*movsf_update4"
10742 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10743 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10744 (match_operand:SF 3 "gpc_reg_operand" "r,r"))
10745 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10746 (plus:SI (match_dup 1) (match_dup 2)))]
10747 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE
10748 && (!avoiding_indexed_address_p (SImode)
10749 || !gpc_reg_operand (operands[2], SImode))"
10753 [(set_attr "type" "store")
10754 (set_attr "update" "yes")
10755 (set_attr "indexed" "yes,no")])
10757 (define_insn "*movdf_update1"
10758 [(set (match_operand:DF 3 "gpc_reg_operand" "=d,d")
10759 (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10760 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10761 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10762 (plus:SI (match_dup 1) (match_dup 2)))]
10763 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_UPDATE
10764 && (!avoiding_indexed_address_p (SImode)
10765 || !gpc_reg_operand (operands[2], SImode))"
10769 [(set_attr "type" "fpload")
10770 (set_attr "update" "yes")
10771 (set_attr "indexed" "yes,no")])
10773 (define_insn "*movdf_update2"
10774 [(set (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10775 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10776 (match_operand:DF 3 "gpc_reg_operand" "d,d"))
10777 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10778 (plus:SI (match_dup 1) (match_dup 2)))]
10779 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_UPDATE
10780 && (!avoiding_indexed_address_p (SImode)
10781 || !gpc_reg_operand (operands[2], SImode))"
10785 [(set_attr "type" "fpstore")
10786 (set_attr "update" "yes")
10787 (set_attr "indexed" "yes,no")])
10790 ;; After inserting conditional returns we can sometimes have
10791 ;; unnecessary register moves. Unfortunately we cannot have a
10792 ;; modeless peephole here, because some single SImode sets have early
10793 ;; clobber outputs. Although those sets expand to multi-ppc-insn
10794 ;; sequences, using get_attr_length here will smash the operands
10795 ;; array. Neither is there an early_cobbler_p predicate.
10796 ;; Disallow subregs for E500 so we don't munge frob_di_df_2.
10798 [(set (match_operand:DF 0 "gpc_reg_operand" "")
10799 (match_operand:DF 1 "any_operand" ""))
10800 (set (match_operand:DF 2 "gpc_reg_operand" "")
10802 "!(TARGET_E500_DOUBLE && GET_CODE (operands[2]) == SUBREG)
10803 && peep2_reg_dead_p (2, operands[0])"
10804 [(set (match_dup 2) (match_dup 1))])
10807 [(set (match_operand:SF 0 "gpc_reg_operand" "")
10808 (match_operand:SF 1 "any_operand" ""))
10809 (set (match_operand:SF 2 "gpc_reg_operand" "")
10811 "peep2_reg_dead_p (2, operands[0])"
10812 [(set (match_dup 2) (match_dup 1))])
10817 ;; Mode attributes for different ABIs.
10818 (define_mode_iterator TLSmode [(SI "! TARGET_64BIT") (DI "TARGET_64BIT")])
10819 (define_mode_attr tls_abi_suffix [(SI "32") (DI "64")])
10820 (define_mode_attr tls_sysv_suffix [(SI "si") (DI "di")])
10821 (define_mode_attr tls_insn_suffix [(SI "wz") (DI "d")])
10823 (define_insn_and_split "tls_gd_aix<TLSmode:tls_abi_suffix>"
10824 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10825 (call (mem:TLSmode (match_operand:TLSmode 3 "symbol_ref_operand" "s"))
10826 (match_operand 4 "" "g")))
10827 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10828 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10830 (clobber (reg:SI LR_REGNO))]
10831 "HAVE_AS_TLS && (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)"
10833 if (TARGET_CMODEL != CMODEL_SMALL)
10834 return "addis %0,%1,%2@got@tlsgd@ha\;addi %0,%0,%2@got@tlsgd@l\;"
10837 return "addi %0,%1,%2@got@tlsgd\;bl %z3\;nop";
10839 "&& TARGET_TLS_MARKERS"
10840 [(set (match_dup 0)
10841 (unspec:TLSmode [(match_dup 1)
10844 (parallel [(set (match_dup 0)
10845 (call (mem:TLSmode (match_dup 3))
10847 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD)
10848 (clobber (reg:SI LR_REGNO))])]
10850 [(set_attr "type" "two")
10851 (set (attr "length")
10852 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
10856 (define_insn_and_split "tls_gd_sysv<TLSmode:tls_sysv_suffix>"
10857 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10858 (call (mem:TLSmode (match_operand:TLSmode 3 "symbol_ref_operand" "s"))
10859 (match_operand 4 "" "g")))
10860 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10861 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10863 (clobber (reg:SI LR_REGNO))]
10864 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4"
10868 if (TARGET_SECURE_PLT && flag_pic == 2)
10869 return "addi %0,%1,%2@got@tlsgd\;bl %z3+32768@plt";
10871 return "addi %0,%1,%2@got@tlsgd\;bl %z3@plt";
10874 return "addi %0,%1,%2@got@tlsgd\;bl %z3";
10876 "&& TARGET_TLS_MARKERS"
10877 [(set (match_dup 0)
10878 (unspec:TLSmode [(match_dup 1)
10881 (parallel [(set (match_dup 0)
10882 (call (mem:TLSmode (match_dup 3))
10884 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD)
10885 (clobber (reg:SI LR_REGNO))])]
10887 [(set_attr "type" "two")
10888 (set_attr "length" "8")])
10890 (define_insn_and_split "*tls_gd<TLSmode:tls_abi_suffix>"
10891 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10892 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10893 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10895 "HAVE_AS_TLS && TARGET_TLS_MARKERS"
10896 "addi %0,%1,%2@got@tlsgd"
10897 "&& TARGET_CMODEL != CMODEL_SMALL"
10898 [(set (match_dup 3)
10900 (unspec:TLSmode [(match_dup 1) (match_dup 2)] UNSPEC_TLSGD)))
10902 (lo_sum:TLSmode (match_dup 3)
10903 (unspec:TLSmode [(match_dup 1) (match_dup 2)] UNSPEC_TLSGD)))]
10906 operands[3] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
10908 [(set (attr "length")
10909 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
10913 (define_insn "*tls_gd_high<TLSmode:tls_abi_suffix>"
10914 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10916 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10917 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10919 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
10920 "addis %0,%1,%2@got@tlsgd@ha"
10921 [(set_attr "length" "4")])
10923 (define_insn "*tls_gd_low<TLSmode:tls_abi_suffix>"
10924 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10925 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
10926 (unspec:TLSmode [(match_operand:TLSmode 3 "gpc_reg_operand" "b")
10927 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10929 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
10930 "addi %0,%1,%2@got@tlsgd@l"
10931 [(set_attr "length" "4")])
10933 (define_insn "*tls_gd_call_aix<TLSmode:tls_abi_suffix>"
10934 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10935 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
10936 (match_operand 2 "" "g")))
10937 (unspec:TLSmode [(match_operand:TLSmode 3 "rs6000_tls_symbol_ref" "")]
10939 (clobber (reg:SI LR_REGNO))]
10940 "HAVE_AS_TLS && TARGET_TLS_MARKERS
10941 && (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)"
10942 "bl %z1(%3@tlsgd)\;nop"
10943 [(set_attr "type" "branch")
10944 (set_attr "length" "8")])
10946 (define_insn "*tls_gd_call_sysv<TLSmode:tls_abi_suffix>"
10947 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10948 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
10949 (match_operand 2 "" "g")))
10950 (unspec:TLSmode [(match_operand:TLSmode 3 "rs6000_tls_symbol_ref" "")]
10952 (clobber (reg:SI LR_REGNO))]
10953 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4 && TARGET_TLS_MARKERS"
10957 if (TARGET_SECURE_PLT && flag_pic == 2)
10958 return "bl %z1+32768(%3@tlsgd)@plt";
10959 return "bl %z1(%3@tlsgd)@plt";
10961 return "bl %z1(%3@tlsgd)";
10963 [(set_attr "type" "branch")
10964 (set_attr "length" "4")])
10966 (define_insn_and_split "tls_ld_aix<TLSmode:tls_abi_suffix>"
10967 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10968 (call (mem:TLSmode (match_operand:TLSmode 2 "symbol_ref_operand" "s"))
10969 (match_operand 3 "" "g")))
10970 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
10972 (clobber (reg:SI LR_REGNO))]
10973 "HAVE_AS_TLS && (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)"
10975 if (TARGET_CMODEL != CMODEL_SMALL)
10976 return "addis %0,%1,%&@got@tlsld@ha\;addi %0,%0,%&@got@tlsld@l\;"
10979 return "addi %0,%1,%&@got@tlsld\;bl %z2\;nop";
10981 "&& TARGET_TLS_MARKERS"
10982 [(set (match_dup 0)
10983 (unspec:TLSmode [(match_dup 1)]
10985 (parallel [(set (match_dup 0)
10986 (call (mem:TLSmode (match_dup 2))
10988 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
10989 (clobber (reg:SI LR_REGNO))])]
10991 [(set_attr "type" "two")
10992 (set (attr "length")
10993 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
10997 (define_insn_and_split "tls_ld_sysv<TLSmode:tls_sysv_suffix>"
10998 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10999 (call (mem:TLSmode (match_operand:TLSmode 2 "symbol_ref_operand" "s"))
11000 (match_operand 3 "" "g")))
11001 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
11003 (clobber (reg:SI LR_REGNO))]
11004 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4"
11008 if (TARGET_SECURE_PLT && flag_pic == 2)
11009 return "addi %0,%1,%&@got@tlsld\;bl %z2+32768@plt";
11011 return "addi %0,%1,%&@got@tlsld\;bl %z2@plt";
11014 return "addi %0,%1,%&@got@tlsld\;bl %z2";
11016 "&& TARGET_TLS_MARKERS"
11017 [(set (match_dup 0)
11018 (unspec:TLSmode [(match_dup 1)]
11020 (parallel [(set (match_dup 0)
11021 (call (mem:TLSmode (match_dup 2))
11023 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
11024 (clobber (reg:SI LR_REGNO))])]
11026 [(set_attr "length" "8")])
11028 (define_insn_and_split "*tls_ld<TLSmode:tls_abi_suffix>"
11029 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11030 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
11032 "HAVE_AS_TLS && TARGET_TLS_MARKERS"
11033 "addi %0,%1,%&@got@tlsld"
11034 "&& TARGET_CMODEL != CMODEL_SMALL"
11035 [(set (match_dup 2)
11037 (unspec:TLSmode [(const_int 0) (match_dup 1)] UNSPEC_TLSLD)))
11039 (lo_sum:TLSmode (match_dup 2)
11040 (unspec:TLSmode [(const_int 0) (match_dup 1)] UNSPEC_TLSLD)))]
11043 operands[2] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
11045 [(set (attr "length")
11046 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
11050 (define_insn "*tls_ld_high<TLSmode:tls_abi_suffix>"
11051 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11053 (unspec:TLSmode [(const_int 0)
11054 (match_operand:TLSmode 1 "gpc_reg_operand" "b")]
11056 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
11057 "addis %0,%1,%&@got@tlsld@ha"
11058 [(set_attr "length" "4")])
11060 (define_insn "*tls_ld_low<TLSmode:tls_abi_suffix>"
11061 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11062 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11063 (unspec:TLSmode [(const_int 0)
11064 (match_operand:TLSmode 2 "gpc_reg_operand" "b")]
11066 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
11067 "addi %0,%1,%&@got@tlsld@l"
11068 [(set_attr "length" "4")])
11070 (define_insn "*tls_ld_call_aix<TLSmode:tls_abi_suffix>"
11071 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11072 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
11073 (match_operand 2 "" "g")))
11074 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
11075 (clobber (reg:SI LR_REGNO))]
11076 "HAVE_AS_TLS && TARGET_TLS_MARKERS
11077 && (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)"
11078 "bl %z1(%&@tlsld)\;nop"
11079 [(set_attr "type" "branch")
11080 (set_attr "length" "8")])
11082 (define_insn "*tls_ld_call_sysv<TLSmode:tls_abi_suffix>"
11083 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11084 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
11085 (match_operand 2 "" "g")))
11086 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
11087 (clobber (reg:SI LR_REGNO))]
11088 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4 && TARGET_TLS_MARKERS"
11092 if (TARGET_SECURE_PLT && flag_pic == 2)
11093 return "bl %z1+32768(%&@tlsld)@plt";
11094 return "bl %z1(%&@tlsld)@plt";
11096 return "bl %z1(%&@tlsld)";
11098 [(set_attr "type" "branch")
11099 (set_attr "length" "4")])
11101 (define_insn "tls_dtprel_<TLSmode:tls_abi_suffix>"
11102 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11103 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11104 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11105 UNSPEC_TLSDTPREL))]
11107 "addi %0,%1,%2@dtprel")
11109 (define_insn "tls_dtprel_ha_<TLSmode:tls_abi_suffix>"
11110 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11111 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11112 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11113 UNSPEC_TLSDTPRELHA))]
11115 "addis %0,%1,%2@dtprel@ha")
11117 (define_insn "tls_dtprel_lo_<TLSmode:tls_abi_suffix>"
11118 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11119 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11120 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11121 UNSPEC_TLSDTPRELLO))]
11123 "addi %0,%1,%2@dtprel@l")
11125 (define_insn_and_split "tls_got_dtprel_<TLSmode:tls_abi_suffix>"
11126 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11127 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11128 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11129 UNSPEC_TLSGOTDTPREL))]
11131 "l<TLSmode:tls_insn_suffix> %0,%2@got@dtprel(%1)"
11132 "&& TARGET_CMODEL != CMODEL_SMALL"
11133 [(set (match_dup 3)
11135 (unspec:TLSmode [(match_dup 1) (match_dup 2)] UNSPEC_TLSGOTDTPREL)))
11137 (lo_sum:TLSmode (match_dup 3)
11138 (unspec:TLSmode [(match_dup 1) (match_dup 2)] UNSPEC_TLSGOTDTPREL)))]
11141 operands[3] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
11143 [(set (attr "length")
11144 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
11148 (define_insn "*tls_got_dtprel_high<TLSmode:tls_abi_suffix>"
11149 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11151 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11152 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11153 UNSPEC_TLSGOTDTPREL)))]
11154 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
11155 "addis %0,%1,%2@got@dtprel@ha"
11156 [(set_attr "length" "4")])
11158 (define_insn "*tls_got_dtprel_low<TLSmode:tls_abi_suffix>"
11159 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11160 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11161 (unspec:TLSmode [(match_operand:TLSmode 3 "gpc_reg_operand" "b")
11162 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11163 UNSPEC_TLSGOTDTPREL)))]
11164 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
11165 "l<TLSmode:tls_insn_suffix> %0,%2@got@dtprel@l(%1)"
11166 [(set_attr "length" "4")])
11168 (define_insn "tls_tprel_<TLSmode:tls_abi_suffix>"
11169 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11170 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11171 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11174 "addi %0,%1,%2@tprel")
11176 (define_insn "tls_tprel_ha_<TLSmode:tls_abi_suffix>"
11177 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11178 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11179 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11180 UNSPEC_TLSTPRELHA))]
11182 "addis %0,%1,%2@tprel@ha")
11184 (define_insn "tls_tprel_lo_<TLSmode:tls_abi_suffix>"
11185 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11186 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11187 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11188 UNSPEC_TLSTPRELLO))]
11190 "addi %0,%1,%2@tprel@l")
11192 ;; "b" output constraint here and on tls_tls input to support linker tls
11193 ;; optimization. The linker may edit the instructions emitted by a
11194 ;; tls_got_tprel/tls_tls pair to addis,addi.
11195 (define_insn_and_split "tls_got_tprel_<TLSmode:tls_abi_suffix>"
11196 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11197 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11198 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11199 UNSPEC_TLSGOTTPREL))]
11201 "l<TLSmode:tls_insn_suffix> %0,%2@got@tprel(%1)"
11202 "&& TARGET_CMODEL != CMODEL_SMALL"
11203 [(set (match_dup 3)
11205 (unspec:TLSmode [(match_dup 1) (match_dup 2)] UNSPEC_TLSGOTTPREL)))
11207 (lo_sum:TLSmode (match_dup 3)
11208 (unspec:TLSmode [(match_dup 1) (match_dup 2)] UNSPEC_TLSGOTTPREL)))]
11211 operands[3] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
11213 [(set (attr "length")
11214 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
11218 (define_insn "*tls_got_tprel_high<TLSmode:tls_abi_suffix>"
11219 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11221 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11222 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11223 UNSPEC_TLSGOTTPREL)))]
11224 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
11225 "addis %0,%1,%2@got@tprel@ha"
11226 [(set_attr "length" "4")])
11228 (define_insn "*tls_got_tprel_low<TLSmode:tls_abi_suffix>"
11229 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11230 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11231 (unspec:TLSmode [(match_operand:TLSmode 3 "gpc_reg_operand" "b")
11232 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11233 UNSPEC_TLSGOTTPREL)))]
11234 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
11235 "l<TLSmode:tls_insn_suffix> %0,%2@got@tprel@l(%1)"
11236 [(set_attr "length" "4")])
11238 (define_insn "tls_tls_<TLSmode:tls_abi_suffix>"
11239 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11240 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11241 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11243 "TARGET_ELF && HAVE_AS_TLS"
11244 "add %0,%1,%2@tls")
11246 (define_expand "tls_get_tpointer"
11247 [(set (match_operand:SI 0 "gpc_reg_operand" "")
11248 (unspec:SI [(const_int 0)] UNSPEC_TLSTLS))]
11249 "TARGET_XCOFF && HAVE_AS_TLS"
11252 emit_insn (gen_tls_get_tpointer_internal ());
11253 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
11257 (define_insn "tls_get_tpointer_internal"
11259 (unspec:SI [(const_int 0)] UNSPEC_TLSTLS))
11260 (clobber (reg:SI LR_REGNO))]
11261 "TARGET_XCOFF && HAVE_AS_TLS"
11262 "bla __get_tpointer")
11264 (define_expand "tls_get_addr<mode>"
11265 [(set (match_operand:P 0 "gpc_reg_operand" "")
11266 (unspec:P [(match_operand:P 1 "gpc_reg_operand" "")
11267 (match_operand:P 2 "gpc_reg_operand" "")] UNSPEC_TLSTLS))]
11268 "TARGET_XCOFF && HAVE_AS_TLS"
11271 emit_move_insn (gen_rtx_REG (Pmode, 3), operands[1]);
11272 emit_move_insn (gen_rtx_REG (Pmode, 4), operands[2]);
11273 emit_insn (gen_tls_get_addr_internal<mode> ());
11274 emit_move_insn (operands[0], gen_rtx_REG (Pmode, 3));
11278 (define_insn "tls_get_addr_internal<mode>"
11280 (unspec:P [(reg:P 3) (reg:P 4)] UNSPEC_TLSTLS))
11281 (clobber (reg:P 0))
11282 (clobber (reg:P 4))
11283 (clobber (reg:P 5))
11284 (clobber (reg:P 11))
11285 (clobber (reg:CC CR0_REGNO))
11286 (clobber (reg:P LR_REGNO))]
11287 "TARGET_XCOFF && HAVE_AS_TLS"
11288 "bla __tls_get_addr")
11290 ;; Next come insns related to the calling sequence.
11292 ;; First, an insn to allocate new stack space for dynamic use (e.g., alloca).
11293 ;; We move the back-chain and decrement the stack pointer.
11295 (define_expand "allocate_stack"
11296 [(set (match_operand 0 "gpc_reg_operand" "")
11297 (minus (reg 1) (match_operand 1 "reg_or_short_operand" "")))
11299 (minus (reg 1) (match_dup 1)))]
11302 { rtx chain = gen_reg_rtx (Pmode);
11303 rtx stack_bot = gen_rtx_MEM (Pmode, stack_pointer_rtx);
11305 rtx insn, par, set, mem;
11307 emit_move_insn (chain, stack_bot);
11309 /* Check stack bounds if necessary. */
11310 if (crtl->limit_stack)
11313 available = expand_binop (Pmode, sub_optab,
11314 stack_pointer_rtx, stack_limit_rtx,
11315 NULL_RTX, 1, OPTAB_WIDEN);
11316 emit_insn (gen_cond_trap (LTU, available, operands[1], const0_rtx));
11319 if (GET_CODE (operands[1]) != CONST_INT
11320 || INTVAL (operands[1]) < -32767
11321 || INTVAL (operands[1]) > 32768)
11323 neg_op0 = gen_reg_rtx (Pmode);
11325 emit_insn (gen_negsi2 (neg_op0, operands[1]));
11327 emit_insn (gen_negdi2 (neg_op0, operands[1]));
11330 neg_op0 = GEN_INT (- INTVAL (operands[1]));
11332 insn = emit_insn ((* ((TARGET_32BIT) ? gen_movsi_update_stack
11333 : gen_movdi_di_update_stack))
11334 (stack_pointer_rtx, stack_pointer_rtx, neg_op0,
11336 /* Since we didn't use gen_frame_mem to generate the MEM, grab
11337 it now and set the alias set/attributes. The above gen_*_update
11338 calls will generate a PARALLEL with the MEM set being the first
11340 par = PATTERN (insn);
11341 gcc_assert (GET_CODE (par) == PARALLEL);
11342 set = XVECEXP (par, 0, 0);
11343 gcc_assert (GET_CODE (set) == SET);
11344 mem = SET_DEST (set);
11345 gcc_assert (MEM_P (mem));
11346 MEM_NOTRAP_P (mem) = 1;
11347 set_mem_alias_set (mem, get_frame_alias_set ());
11349 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
11353 ;; These patterns say how to save and restore the stack pointer. We need not
11354 ;; save the stack pointer at function level since we are careful to
11355 ;; preserve the backchain. At block level, we have to restore the backchain
11356 ;; when we restore the stack pointer.
11358 ;; For nonlocal gotos, we must save both the stack pointer and its
11359 ;; backchain and restore both. Note that in the nonlocal case, the
11360 ;; save area is a memory location.
11362 (define_expand "save_stack_function"
11363 [(match_operand 0 "any_operand" "")
11364 (match_operand 1 "any_operand" "")]
11368 (define_expand "restore_stack_function"
11369 [(match_operand 0 "any_operand" "")
11370 (match_operand 1 "any_operand" "")]
11374 ;; Adjust stack pointer (op0) to a new value (op1).
11375 ;; First copy old stack backchain to new location, and ensure that the
11376 ;; scheduler won't reorder the sp assignment before the backchain write.
11377 (define_expand "restore_stack_block"
11378 [(set (match_dup 2) (match_dup 3))
11379 (set (match_dup 4) (match_dup 2))
11381 (set (match_operand 0 "register_operand" "")
11382 (match_operand 1 "register_operand" ""))]
11388 operands[1] = force_reg (Pmode, operands[1]);
11389 operands[2] = gen_reg_rtx (Pmode);
11390 operands[3] = gen_frame_mem (Pmode, operands[0]);
11391 operands[4] = gen_frame_mem (Pmode, operands[1]);
11392 p = rtvec_alloc (1);
11393 RTVEC_ELT (p, 0) = gen_rtx_SET (VOIDmode,
11394 gen_frame_mem (BLKmode, operands[0]),
11396 operands[5] = gen_rtx_PARALLEL (VOIDmode, p);
11399 (define_expand "save_stack_nonlocal"
11400 [(set (match_dup 3) (match_dup 4))
11401 (set (match_operand 0 "memory_operand" "") (match_dup 3))
11402 (set (match_dup 2) (match_operand 1 "register_operand" ""))]
11406 int units_per_word = (TARGET_32BIT) ? 4 : 8;
11408 /* Copy the backchain to the first word, sp to the second. */
11409 operands[0] = adjust_address_nv (operands[0], Pmode, 0);
11410 operands[2] = adjust_address_nv (operands[0], Pmode, units_per_word);
11411 operands[3] = gen_reg_rtx (Pmode);
11412 operands[4] = gen_frame_mem (Pmode, operands[1]);
11415 (define_expand "restore_stack_nonlocal"
11416 [(set (match_dup 2) (match_operand 1 "memory_operand" ""))
11417 (set (match_dup 3) (match_dup 4))
11418 (set (match_dup 5) (match_dup 2))
11420 (set (match_operand 0 "register_operand" "") (match_dup 3))]
11424 int units_per_word = (TARGET_32BIT) ? 4 : 8;
11427 /* Restore the backchain from the first word, sp from the second. */
11428 operands[2] = gen_reg_rtx (Pmode);
11429 operands[3] = gen_reg_rtx (Pmode);
11430 operands[1] = adjust_address_nv (operands[1], Pmode, 0);
11431 operands[4] = adjust_address_nv (operands[1], Pmode, units_per_word);
11432 operands[5] = gen_frame_mem (Pmode, operands[3]);
11433 p = rtvec_alloc (1);
11434 RTVEC_ELT (p, 0) = gen_rtx_SET (VOIDmode,
11435 gen_frame_mem (BLKmode, operands[0]),
11437 operands[6] = gen_rtx_PARALLEL (VOIDmode, p);
11440 ;; TOC register handling.
11442 ;; Code to initialize the TOC register...
11444 (define_insn "load_toc_aix_si"
11445 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11446 (unspec:SI [(const_int 0)] UNSPEC_TOC))
11447 (use (reg:SI 2))])]
11448 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2) && TARGET_32BIT"
11452 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
11453 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
11454 operands[2] = gen_rtx_REG (Pmode, 2);
11455 return \"lwz %0,%1(%2)\";
11457 [(set_attr "type" "load")
11458 (set_attr "update" "no")
11459 (set_attr "indexed" "no")])
11461 (define_insn "load_toc_aix_di"
11462 [(parallel [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11463 (unspec:DI [(const_int 0)] UNSPEC_TOC))
11464 (use (reg:DI 2))])]
11465 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2) && TARGET_64BIT"
11469 #ifdef TARGET_RELOCATABLE
11470 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\",
11471 !TARGET_MINIMAL_TOC || TARGET_RELOCATABLE);
11473 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
11476 strcat (buf, \"@toc\");
11477 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
11478 operands[2] = gen_rtx_REG (Pmode, 2);
11479 return \"ld %0,%1(%2)\";
11481 [(set_attr "type" "load")
11482 (set_attr "update" "no")
11483 (set_attr "indexed" "no")])
11485 (define_insn "load_toc_v4_pic_si"
11486 [(set (reg:SI LR_REGNO)
11487 (unspec:SI [(const_int 0)] UNSPEC_TOC))]
11488 "DEFAULT_ABI == ABI_V4 && flag_pic == 1 && TARGET_32BIT"
11489 "bl _GLOBAL_OFFSET_TABLE_@local-4"
11490 [(set_attr "type" "branch")
11491 (set_attr "length" "4")])
11493 (define_expand "load_toc_v4_PIC_1"
11494 [(parallel [(set (reg:SI LR_REGNO)
11495 (match_operand:SI 0 "immediate_operand" "s"))
11496 (use (unspec [(match_dup 0)] UNSPEC_TOC))])]
11497 "TARGET_ELF && DEFAULT_ABI == ABI_V4
11498 && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
11501 (define_insn "load_toc_v4_PIC_1_normal"
11502 [(set (reg:SI LR_REGNO)
11503 (match_operand:SI 0 "immediate_operand" "s"))
11504 (use (unspec [(match_dup 0)] UNSPEC_TOC))]
11505 "!TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI == ABI_V4
11506 && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
11507 "bcl 20,31,%0\\n%0:"
11508 [(set_attr "type" "branch")
11509 (set_attr "length" "4")])
11511 (define_insn "load_toc_v4_PIC_1_476"
11512 [(set (reg:SI LR_REGNO)
11513 (match_operand:SI 0 "immediate_operand" "s"))
11514 (use (unspec [(match_dup 0)] UNSPEC_TOC))]
11515 "TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI == ABI_V4
11516 && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
11520 static char templ[32];
11522 get_ppc476_thunk_name (name);
11523 sprintf (templ, \"bl %s\\n%%0:\", name);
11526 [(set_attr "type" "branch")
11527 (set_attr "length" "4")])
11529 (define_expand "load_toc_v4_PIC_1b"
11530 [(parallel [(set (reg:SI LR_REGNO)
11531 (unspec:SI [(match_operand:SI 0 "immediate_operand" "s")
11532 (label_ref (match_operand 1 "" ""))]
11535 "TARGET_ELF && DEFAULT_ABI == ABI_V4 && flag_pic == 2"
11538 (define_insn "load_toc_v4_PIC_1b_normal"
11539 [(set (reg:SI LR_REGNO)
11540 (unspec:SI [(match_operand:SI 0 "immediate_operand" "s")
11541 (label_ref (match_operand 1 "" ""))]
11544 "!TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI == ABI_V4 && flag_pic == 2"
11545 "bcl 20,31,$+8\;.long %0-$"
11546 [(set_attr "type" "branch")
11547 (set_attr "length" "8")])
11549 (define_insn "load_toc_v4_PIC_1b_476"
11550 [(set (reg:SI LR_REGNO)
11551 (unspec:SI [(match_operand:SI 0 "immediate_operand" "s")
11552 (label_ref (match_operand 1 "" ""))]
11555 "TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI == ABI_V4 && flag_pic == 2"
11559 static char templ[32];
11561 get_ppc476_thunk_name (name);
11562 sprintf (templ, \"bl %s\\n\\tb $+8\\n\\t.long %%0-$\", name);
11565 [(set_attr "type" "branch")
11566 (set_attr "length" "16")])
11568 (define_insn "load_toc_v4_PIC_2"
11569 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11570 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
11571 (minus:SI (match_operand:SI 2 "immediate_operand" "s")
11572 (match_operand:SI 3 "immediate_operand" "s")))))]
11573 "TARGET_ELF && DEFAULT_ABI == ABI_V4 && flag_pic == 2"
11575 [(set_attr "type" "load")])
11577 (define_insn "load_toc_v4_PIC_3b"
11578 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11579 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
11581 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
11582 (match_operand:SI 3 "symbol_ref_operand" "s")))))]
11583 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI == ABI_V4 && flag_pic"
11584 "addis %0,%1,%2-%3@ha")
11586 (define_insn "load_toc_v4_PIC_3c"
11587 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11588 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
11589 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
11590 (match_operand:SI 3 "symbol_ref_operand" "s"))))]
11591 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI == ABI_V4 && flag_pic"
11592 "addi %0,%1,%2-%3@l")
11594 ;; If the TOC is shared over a translation unit, as happens with all
11595 ;; the kinds of PIC that we support, we need to restore the TOC
11596 ;; pointer only when jumping over units of translation.
11597 ;; On Darwin, we need to reload the picbase.
11599 (define_expand "builtin_setjmp_receiver"
11600 [(use (label_ref (match_operand 0 "" "")))]
11601 "(DEFAULT_ABI == ABI_V4 && flag_pic == 1)
11602 || (TARGET_TOC && TARGET_MINIMAL_TOC)
11603 || (DEFAULT_ABI == ABI_DARWIN && flag_pic)"
11607 if (DEFAULT_ABI == ABI_DARWIN)
11609 rtx picrtx = gen_rtx_SYMBOL_REF (Pmode, MACHOPIC_FUNCTION_BASE_NAME);
11610 rtx picreg = gen_rtx_REG (Pmode, RS6000_PIC_OFFSET_TABLE_REGNUM);
11614 crtl->uses_pic_offset_table = 1;
11615 ASM_GENERATE_INTERNAL_LABEL(tmplab, \"LSJR\",
11616 CODE_LABEL_NUMBER (operands[0]));
11617 tmplabrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (tmplab));
11619 emit_insn (gen_load_macho_picbase (tmplabrtx));
11620 emit_move_insn (picreg, gen_rtx_REG (Pmode, LR_REGNO));
11621 emit_insn (gen_macho_correct_pic (picreg, picreg, picrtx, tmplabrtx));
11625 rs6000_emit_load_toc_table (FALSE);
11629 ;; Largetoc support
11630 (define_insn "*largetoc_high"
11631 [(set (match_operand:DI 0 "gpc_reg_operand" "=b*r")
11633 (unspec [(match_operand:DI 1 "" "")
11634 (match_operand:DI 2 "gpc_reg_operand" "b")]
11636 "TARGET_ELF && TARGET_CMODEL != CMODEL_SMALL"
11637 "addis %0,%2,%1@toc@ha")
11639 (define_insn "*largetoc_high_aix<mode>"
11640 [(set (match_operand:P 0 "gpc_reg_operand" "=b*r")
11642 (unspec [(match_operand:P 1 "" "")
11643 (match_operand:P 2 "gpc_reg_operand" "b")]
11645 "TARGET_XCOFF && TARGET_CMODEL != CMODEL_SMALL"
11646 "addis %0,%1@u(%2)")
11648 (define_insn "*largetoc_high_plus"
11649 [(set (match_operand:DI 0 "gpc_reg_operand" "=b*r")
11652 (unspec [(match_operand:DI 1 "" "")
11653 (match_operand:DI 2 "gpc_reg_operand" "b")]
11655 (match_operand:DI 3 "add_cint_operand" "n"))))]
11656 "TARGET_ELF && TARGET_CMODEL != CMODEL_SMALL"
11657 "addis %0,%2,%1+%3@toc@ha")
11659 (define_insn "*largetoc_high_plus_aix<mode>"
11660 [(set (match_operand:P 0 "gpc_reg_operand" "=b*r")
11663 (unspec [(match_operand:P 1 "" "")
11664 (match_operand:P 2 "gpc_reg_operand" "b")]
11666 (match_operand:P 3 "add_cint_operand" "n"))))]
11667 "TARGET_XCOFF && TARGET_CMODEL != CMODEL_SMALL"
11668 "addis %0,%1+%3@u(%2)")
11670 (define_insn "*largetoc_low"
11671 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
11672 (lo_sum:DI (match_operand:DI 1 "gpc_reg_operand" "b,!*r")
11673 (match_operand:DI 2 "" "")))]
11674 "TARGET_ELF && TARGET_CMODEL != CMODEL_SMALL"
11679 (define_insn "*largetoc_low_aix<mode>"
11680 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
11681 (lo_sum:P (match_operand:P 1 "gpc_reg_operand" "b")
11682 (match_operand:P 2 "" "")))]
11683 "TARGET_XCOFF && TARGET_CMODEL != CMODEL_SMALL"
11686 (define_insn_and_split "*tocref<mode>"
11687 [(set (match_operand:P 0 "gpc_reg_operand" "=b*r")
11688 (match_operand:P 1 "small_toc_ref" "R"))]
11691 "&& TARGET_CMODEL != CMODEL_SMALL && reload_completed"
11692 [(set (match_dup 0) (high:P (match_dup 1)))
11693 (set (match_dup 0) (lo_sum:P (match_dup 0) (match_dup 1)))])
11695 ;; Elf specific ways of loading addresses for non-PIC code.
11696 ;; The output of this could be r0, but we make a very strong
11697 ;; preference for a base register because it will usually
11698 ;; be needed there.
11699 (define_insn "elf_high"
11700 [(set (match_operand:SI 0 "gpc_reg_operand" "=b*r")
11701 (high:SI (match_operand 1 "" "")))]
11702 "TARGET_ELF && ! TARGET_64BIT"
11705 (define_insn "elf_low"
11706 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11707 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,!*r")
11708 (match_operand 2 "" "")))]
11709 "TARGET_ELF && ! TARGET_64BIT"
11714 ;; Call and call_value insns
11715 (define_expand "call"
11716 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
11717 (match_operand 1 "" ""))
11718 (use (match_operand 2 "" ""))
11719 (clobber (reg:SI LR_REGNO))])]
11724 if (MACHOPIC_INDIRECT)
11725 operands[0] = machopic_indirect_call_target (operands[0]);
11728 gcc_assert (GET_CODE (operands[0]) == MEM);
11729 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
11731 operands[0] = XEXP (operands[0], 0);
11733 if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
11735 rs6000_call_aix (NULL_RTX, operands[0], operands[1], operands[2]);
11739 if (GET_CODE (operands[0]) != SYMBOL_REF
11740 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[2]) & CALL_LONG) != 0))
11742 if (INTVAL (operands[2]) & CALL_LONG)
11743 operands[0] = rs6000_longcall_ref (operands[0]);
11745 switch (DEFAULT_ABI)
11749 operands[0] = force_reg (Pmode, operands[0]);
11753 gcc_unreachable ();
11758 (define_expand "call_value"
11759 [(parallel [(set (match_operand 0 "" "")
11760 (call (mem:SI (match_operand 1 "address_operand" ""))
11761 (match_operand 2 "" "")))
11762 (use (match_operand 3 "" ""))
11763 (clobber (reg:SI LR_REGNO))])]
11768 if (MACHOPIC_INDIRECT)
11769 operands[1] = machopic_indirect_call_target (operands[1]);
11772 gcc_assert (GET_CODE (operands[1]) == MEM);
11773 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
11775 operands[1] = XEXP (operands[1], 0);
11777 if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
11779 rs6000_call_aix (operands[0], operands[1], operands[2], operands[3]);
11783 if (GET_CODE (operands[1]) != SYMBOL_REF
11784 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[3]) & CALL_LONG) != 0))
11786 if (INTVAL (operands[3]) & CALL_LONG)
11787 operands[1] = rs6000_longcall_ref (operands[1]);
11789 switch (DEFAULT_ABI)
11793 operands[1] = force_reg (Pmode, operands[1]);
11797 gcc_unreachable ();
11802 ;; Call to function in current module. No TOC pointer reload needed.
11803 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
11804 ;; either the function was not prototyped, or it was prototyped as a
11805 ;; variable argument function. It is > 0 if FP registers were passed
11806 ;; and < 0 if they were not.
11808 (define_insn "*call_local32"
11809 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
11810 (match_operand 1 "" "g,g"))
11811 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11812 (clobber (reg:SI LR_REGNO))]
11813 "(INTVAL (operands[2]) & CALL_LONG) == 0"
11816 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11817 output_asm_insn (\"crxor 6,6,6\", operands);
11819 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11820 output_asm_insn (\"creqv 6,6,6\", operands);
11822 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
11824 [(set_attr "type" "branch")
11825 (set_attr "length" "4,8")])
11827 (define_insn "*call_local64"
11828 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
11829 (match_operand 1 "" "g,g"))
11830 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11831 (clobber (reg:SI LR_REGNO))]
11832 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
11835 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11836 output_asm_insn (\"crxor 6,6,6\", operands);
11838 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11839 output_asm_insn (\"creqv 6,6,6\", operands);
11841 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
11843 [(set_attr "type" "branch")
11844 (set_attr "length" "4,8")])
11846 (define_insn "*call_value_local32"
11847 [(set (match_operand 0 "" "")
11848 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
11849 (match_operand 2 "" "g,g")))
11850 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11851 (clobber (reg:SI LR_REGNO))]
11852 "(INTVAL (operands[3]) & CALL_LONG) == 0"
11855 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11856 output_asm_insn (\"crxor 6,6,6\", operands);
11858 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11859 output_asm_insn (\"creqv 6,6,6\", operands);
11861 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
11863 [(set_attr "type" "branch")
11864 (set_attr "length" "4,8")])
11867 (define_insn "*call_value_local64"
11868 [(set (match_operand 0 "" "")
11869 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
11870 (match_operand 2 "" "g,g")))
11871 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11872 (clobber (reg:SI LR_REGNO))]
11873 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
11876 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11877 output_asm_insn (\"crxor 6,6,6\", operands);
11879 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11880 output_asm_insn (\"creqv 6,6,6\", operands);
11882 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
11884 [(set_attr "type" "branch")
11885 (set_attr "length" "4,8")])
11888 ;; A function pointer under System V is just a normal pointer
11889 ;; operands[0] is the function pointer
11890 ;; operands[1] is the stack size to clean up
11891 ;; operands[2] is the value FUNCTION_ARG returns for the VOID argument
11892 ;; which indicates how to set cr1
11894 (define_insn "*call_indirect_nonlocal_sysv<mode>"
11895 [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l,c,*l"))
11896 (match_operand 1 "" "g,g,g,g"))
11897 (use (match_operand:SI 2 "immediate_operand" "O,O,n,n"))
11898 (clobber (reg:SI LR_REGNO))]
11899 "DEFAULT_ABI == ABI_V4
11900 || DEFAULT_ABI == ABI_DARWIN"
11902 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11903 output_asm_insn ("crxor 6,6,6", operands);
11905 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11906 output_asm_insn ("creqv 6,6,6", operands);
11910 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
11911 (set_attr "length" "4,4,8,8")])
11913 (define_insn_and_split "*call_nonlocal_sysv<mode>"
11914 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
11915 (match_operand 1 "" "g,g"))
11916 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11917 (clobber (reg:SI LR_REGNO))]
11918 "(DEFAULT_ABI == ABI_DARWIN
11919 || (DEFAULT_ABI == ABI_V4
11920 && (INTVAL (operands[2]) & CALL_LONG) == 0))"
11922 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11923 output_asm_insn ("crxor 6,6,6", operands);
11925 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11926 output_asm_insn ("creqv 6,6,6", operands);
11929 return output_call(insn, operands, 0, 2);
11931 if (DEFAULT_ABI == ABI_V4 && flag_pic)
11933 gcc_assert (!TARGET_SECURE_PLT);
11934 return "bl %z0@plt";
11940 "DEFAULT_ABI == ABI_V4
11941 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[0])
11942 && (INTVAL (operands[2]) & CALL_LONG) == 0"
11943 [(parallel [(call (mem:SI (match_dup 0))
11945 (use (match_dup 2))
11946 (use (match_dup 3))
11947 (clobber (reg:SI LR_REGNO))])]
11949 operands[3] = pic_offset_table_rtx;
11951 [(set_attr "type" "branch,branch")
11952 (set_attr "length" "4,8")])
11954 (define_insn "*call_nonlocal_sysv_secure<mode>"
11955 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
11956 (match_operand 1 "" "g,g"))
11957 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11958 (use (match_operand:SI 3 "register_operand" "r,r"))
11959 (clobber (reg:SI LR_REGNO))]
11960 "(DEFAULT_ABI == ABI_V4
11961 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[0])
11962 && (INTVAL (operands[2]) & CALL_LONG) == 0)"
11964 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11965 output_asm_insn ("crxor 6,6,6", operands);
11967 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11968 output_asm_insn ("creqv 6,6,6", operands);
11971 /* The magic 32768 offset here and in the other sysv call insns
11972 corresponds to the offset of r30 in .got2, as given by LCTOC1.
11973 See sysv4.h:toc_section. */
11974 return "bl %z0+32768@plt";
11976 return "bl %z0@plt";
11978 [(set_attr "type" "branch,branch")
11979 (set_attr "length" "4,8")])
11981 (define_insn "*call_value_indirect_nonlocal_sysv<mode>"
11982 [(set (match_operand 0 "" "")
11983 (call (mem:SI (match_operand:P 1 "register_operand" "c,*l,c,*l"))
11984 (match_operand 2 "" "g,g,g,g")))
11985 (use (match_operand:SI 3 "immediate_operand" "O,O,n,n"))
11986 (clobber (reg:SI LR_REGNO))]
11987 "DEFAULT_ABI == ABI_V4
11988 || DEFAULT_ABI == ABI_DARWIN"
11990 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11991 output_asm_insn ("crxor 6,6,6", operands);
11993 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11994 output_asm_insn ("creqv 6,6,6", operands);
11998 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
11999 (set_attr "length" "4,4,8,8")])
12001 (define_insn_and_split "*call_value_nonlocal_sysv<mode>"
12002 [(set (match_operand 0 "" "")
12003 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
12004 (match_operand 2 "" "g,g")))
12005 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12006 (clobber (reg:SI LR_REGNO))]
12007 "(DEFAULT_ABI == ABI_DARWIN
12008 || (DEFAULT_ABI == ABI_V4
12009 && (INTVAL (operands[3]) & CALL_LONG) == 0))"
12011 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12012 output_asm_insn ("crxor 6,6,6", operands);
12014 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12015 output_asm_insn ("creqv 6,6,6", operands);
12018 return output_call(insn, operands, 1, 3);
12020 if (DEFAULT_ABI == ABI_V4 && flag_pic)
12022 gcc_assert (!TARGET_SECURE_PLT);
12023 return "bl %z1@plt";
12029 "DEFAULT_ABI == ABI_V4
12030 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[1])
12031 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12032 [(parallel [(set (match_dup 0)
12033 (call (mem:SI (match_dup 1))
12035 (use (match_dup 3))
12036 (use (match_dup 4))
12037 (clobber (reg:SI LR_REGNO))])]
12039 operands[4] = pic_offset_table_rtx;
12041 [(set_attr "type" "branch,branch")
12042 (set_attr "length" "4,8")])
12044 (define_insn "*call_value_nonlocal_sysv_secure<mode>"
12045 [(set (match_operand 0 "" "")
12046 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
12047 (match_operand 2 "" "g,g")))
12048 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12049 (use (match_operand:SI 4 "register_operand" "r,r"))
12050 (clobber (reg:SI LR_REGNO))]
12051 "(DEFAULT_ABI == ABI_V4
12052 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[1])
12053 && (INTVAL (operands[3]) & CALL_LONG) == 0)"
12055 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12056 output_asm_insn ("crxor 6,6,6", operands);
12058 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12059 output_asm_insn ("creqv 6,6,6", operands);
12062 return "bl %z1+32768@plt";
12064 return "bl %z1@plt";
12066 [(set_attr "type" "branch,branch")
12067 (set_attr "length" "4,8")])
12070 ;; Call to AIX abi function in the same module.
12072 (define_insn "*call_local_aix<mode>"
12073 [(call (mem:SI (match_operand:P 0 "current_file_function_operand" "s"))
12074 (match_operand 1 "" "g"))
12075 (clobber (reg:P LR_REGNO))]
12076 "DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2"
12078 [(set_attr "type" "branch")
12079 (set_attr "length" "4")])
12081 (define_insn "*call_value_local_aix<mode>"
12082 [(set (match_operand 0 "" "")
12083 (call (mem:SI (match_operand:P 1 "current_file_function_operand" "s"))
12084 (match_operand 2 "" "g")))
12085 (clobber (reg:P LR_REGNO))]
12086 "DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2"
12088 [(set_attr "type" "branch")
12089 (set_attr "length" "4")])
12091 ;; Call to AIX abi function which may be in another module.
12092 ;; Restore the TOC pointer (r2) after the call.
12094 (define_insn "*call_nonlocal_aix<mode>"
12095 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s"))
12096 (match_operand 1 "" "g"))
12097 (clobber (reg:P LR_REGNO))]
12098 "DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2"
12100 [(set_attr "type" "branch")
12101 (set_attr "length" "8")])
12103 (define_insn "*call_value_nonlocal_aix<mode>"
12104 [(set (match_operand 0 "" "")
12105 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s"))
12106 (match_operand 2 "" "g")))
12107 (clobber (reg:P LR_REGNO))]
12108 "DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2"
12110 [(set_attr "type" "branch")
12111 (set_attr "length" "8")])
12113 ;; Call to indirect functions with the AIX abi using a 3 word descriptor.
12114 ;; Operand0 is the addresss of the function to call
12115 ;; Operand2 is the location in the function descriptor to load r2 from
12116 ;; Operand3 is the stack location to hold the current TOC pointer
12118 (define_insn "*call_indirect_aix<mode>"
12119 [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l"))
12120 (match_operand 1 "" "g,g"))
12121 (use (match_operand:P 2 "memory_operand" "<ptrm>,<ptrm>"))
12122 (set (reg:P TOC_REGNUM) (match_operand:P 3 "memory_operand" "<ptrm>,<ptrm>"))
12123 (clobber (reg:P LR_REGNO))]
12124 "DEFAULT_ABI == ABI_AIX"
12125 "<ptrload> 2,%2\;b%T0l\;<ptrload> 2,%3"
12126 [(set_attr "type" "jmpreg")
12127 (set_attr "length" "12")])
12129 (define_insn "*call_value_indirect_aix<mode>"
12130 [(set (match_operand 0 "" "")
12131 (call (mem:SI (match_operand:P 1 "register_operand" "c,*l"))
12132 (match_operand 2 "" "g,g")))
12133 (use (match_operand:P 3 "memory_operand" "<ptrm>,<ptrm>"))
12134 (set (reg:P TOC_REGNUM) (match_operand:P 4 "memory_operand" "<ptrm>,<ptrm>"))
12135 (clobber (reg:P LR_REGNO))]
12136 "DEFAULT_ABI == ABI_AIX"
12137 "<ptrload> 2,%3\;b%T1l\;<ptrload> 2,%4"
12138 [(set_attr "type" "jmpreg")
12139 (set_attr "length" "12")])
12141 ;; Call to indirect functions with the ELFv2 ABI.
12142 ;; Operand0 is the addresss of the function to call
12143 ;; Operand2 is the stack location to hold the current TOC pointer
12145 (define_insn "*call_indirect_elfv2<mode>"
12146 [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l"))
12147 (match_operand 1 "" "g,g"))
12148 (set (reg:P TOC_REGNUM) (match_operand:P 2 "memory_operand" "<ptrm>,<ptrm>"))
12149 (clobber (reg:P LR_REGNO))]
12150 "DEFAULT_ABI == ABI_ELFv2"
12151 "b%T0l\;<ptrload> 2,%2"
12152 [(set_attr "type" "jmpreg")
12153 (set_attr "length" "8")])
12155 (define_insn "*call_value_indirect_elfv2<mode>"
12156 [(set (match_operand 0 "" "")
12157 (call (mem:SI (match_operand:P 1 "register_operand" "c,*l"))
12158 (match_operand 2 "" "g,g")))
12159 (set (reg:P TOC_REGNUM) (match_operand:P 3 "memory_operand" "<ptrm>,<ptrm>"))
12160 (clobber (reg:P LR_REGNO))]
12161 "DEFAULT_ABI == ABI_ELFv2"
12162 "b%T1l\;<ptrload> 2,%3"
12163 [(set_attr "type" "jmpreg")
12164 (set_attr "length" "8")])
12167 ;; Call subroutine returning any type.
12168 (define_expand "untyped_call"
12169 [(parallel [(call (match_operand 0 "" "")
12171 (match_operand 1 "" "")
12172 (match_operand 2 "" "")])]
12178 emit_call_insn (GEN_CALL (operands[0], const0_rtx, const0_rtx, const0_rtx));
12180 for (i = 0; i < XVECLEN (operands[2], 0); i++)
12182 rtx set = XVECEXP (operands[2], 0, i);
12183 emit_move_insn (SET_DEST (set), SET_SRC (set));
12186 /* The optimizer does not know that the call sets the function value
12187 registers we stored in the result block. We avoid problems by
12188 claiming that all hard registers are used and clobbered at this
12190 emit_insn (gen_blockage ());
12195 ;; sibling call patterns
12196 (define_expand "sibcall"
12197 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
12198 (match_operand 1 "" ""))
12199 (use (match_operand 2 "" ""))
12200 (use (reg:SI LR_REGNO))
12206 if (MACHOPIC_INDIRECT)
12207 operands[0] = machopic_indirect_call_target (operands[0]);
12210 gcc_assert (GET_CODE (operands[0]) == MEM);
12211 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
12213 operands[0] = XEXP (operands[0], 0);
12215 if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
12217 rs6000_sibcall_aix (NULL_RTX, operands[0], operands[1], operands[2]);
12222 (define_expand "sibcall_value"
12223 [(parallel [(set (match_operand 0 "register_operand" "")
12224 (call (mem:SI (match_operand 1 "address_operand" ""))
12225 (match_operand 2 "" "")))
12226 (use (match_operand 3 "" ""))
12227 (use (reg:SI LR_REGNO))
12233 if (MACHOPIC_INDIRECT)
12234 operands[1] = machopic_indirect_call_target (operands[1]);
12237 gcc_assert (GET_CODE (operands[1]) == MEM);
12238 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
12240 operands[1] = XEXP (operands[1], 0);
12242 if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
12244 rs6000_sibcall_aix (operands[0], operands[1], operands[2], operands[3]);
12249 ;; this and similar patterns must be marked as using LR, otherwise
12250 ;; dataflow will try to delete the store into it. This is true
12251 ;; even when the actual reg to jump to is in CTR, when LR was
12252 ;; saved and restored around the PIC-setting BCL.
12253 (define_insn "*sibcall_local32"
12254 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
12255 (match_operand 1 "" "g,g"))
12256 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12257 (use (reg:SI LR_REGNO))
12259 "(INTVAL (operands[2]) & CALL_LONG) == 0"
12262 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12263 output_asm_insn (\"crxor 6,6,6\", operands);
12265 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12266 output_asm_insn (\"creqv 6,6,6\", operands);
12268 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
12270 [(set_attr "type" "branch")
12271 (set_attr "length" "4,8")])
12273 (define_insn "*sibcall_local64"
12274 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
12275 (match_operand 1 "" "g,g"))
12276 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12277 (use (reg:SI LR_REGNO))
12279 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
12282 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12283 output_asm_insn (\"crxor 6,6,6\", operands);
12285 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12286 output_asm_insn (\"creqv 6,6,6\", operands);
12288 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
12290 [(set_attr "type" "branch")
12291 (set_attr "length" "4,8")])
12293 (define_insn "*sibcall_value_local32"
12294 [(set (match_operand 0 "" "")
12295 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
12296 (match_operand 2 "" "g,g")))
12297 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12298 (use (reg:SI LR_REGNO))
12300 "(INTVAL (operands[3]) & CALL_LONG) == 0"
12303 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12304 output_asm_insn (\"crxor 6,6,6\", operands);
12306 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12307 output_asm_insn (\"creqv 6,6,6\", operands);
12309 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
12311 [(set_attr "type" "branch")
12312 (set_attr "length" "4,8")])
12314 (define_insn "*sibcall_value_local64"
12315 [(set (match_operand 0 "" "")
12316 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
12317 (match_operand 2 "" "g,g")))
12318 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12319 (use (reg:SI LR_REGNO))
12321 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
12324 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12325 output_asm_insn (\"crxor 6,6,6\", operands);
12327 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12328 output_asm_insn (\"creqv 6,6,6\", operands);
12330 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
12332 [(set_attr "type" "branch")
12333 (set_attr "length" "4,8")])
12335 (define_insn "*sibcall_nonlocal_sysv<mode>"
12336 [(call (mem:SI (match_operand:P 0 "call_operand" "s,s,c,c"))
12337 (match_operand 1 "" ""))
12338 (use (match_operand 2 "immediate_operand" "O,n,O,n"))
12339 (use (reg:SI LR_REGNO))
12341 "(DEFAULT_ABI == ABI_DARWIN
12342 || DEFAULT_ABI == ABI_V4)
12343 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12346 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12347 output_asm_insn (\"crxor 6,6,6\", operands);
12349 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12350 output_asm_insn (\"creqv 6,6,6\", operands);
12352 if (which_alternative >= 2)
12354 else if (DEFAULT_ABI == ABI_V4 && flag_pic)
12356 gcc_assert (!TARGET_SECURE_PLT);
12357 return \"b %z0@plt\";
12362 [(set_attr "type" "branch")
12363 (set_attr "length" "4,8,4,8")])
12365 (define_insn "*sibcall_value_nonlocal_sysv<mode>"
12366 [(set (match_operand 0 "" "")
12367 (call (mem:SI (match_operand:P 1 "call_operand" "s,s,c,c"))
12368 (match_operand 2 "" "")))
12369 (use (match_operand:SI 3 "immediate_operand" "O,n,O,n"))
12370 (use (reg:SI LR_REGNO))
12372 "(DEFAULT_ABI == ABI_DARWIN
12373 || DEFAULT_ABI == ABI_V4)
12374 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12377 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12378 output_asm_insn (\"crxor 6,6,6\", operands);
12380 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12381 output_asm_insn (\"creqv 6,6,6\", operands);
12383 if (which_alternative >= 2)
12385 else if (DEFAULT_ABI == ABI_V4 && flag_pic)
12387 gcc_assert (!TARGET_SECURE_PLT);
12388 return \"b %z1@plt\";
12393 [(set_attr "type" "branch")
12394 (set_attr "length" "4,8,4,8")])
12396 ;; AIX ABI sibling call patterns.
12398 (define_insn "*sibcall_aix<mode>"
12399 [(call (mem:SI (match_operand:P 0 "call_operand" "s,c"))
12400 (match_operand 1 "" "g,g"))
12402 "DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2"
12406 [(set_attr "type" "branch")
12407 (set_attr "length" "4")])
12409 (define_insn "*sibcall_value_aix<mode>"
12410 [(set (match_operand 0 "" "")
12411 (call (mem:SI (match_operand:P 1 "call_operand" "s,c"))
12412 (match_operand 2 "" "g,g")))
12414 "DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2"
12418 [(set_attr "type" "branch")
12419 (set_attr "length" "4")])
12421 (define_expand "sibcall_epilogue"
12422 [(use (const_int 0))]
12425 if (!TARGET_SCHED_PROLOG)
12426 emit_insn (gen_blockage ());
12427 rs6000_emit_epilogue (TRUE);
12431 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
12432 ;; all of memory. This blocks insns from being moved across this point.
12434 (define_insn "blockage"
12435 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCK)]
12439 (define_expand "probe_stack"
12440 [(set (match_operand 0 "memory_operand" "=m")
12441 (unspec [(const_int 0)] UNSPEC_PROBE_STACK))]
12445 emit_insn (gen_probe_stack_di (operands[0]));
12447 emit_insn (gen_probe_stack_si (operands[0]));
12451 (define_insn "probe_stack_<mode>"
12452 [(set (match_operand:P 0 "memory_operand" "=m")
12453 (unspec:P [(const_int 0)] UNSPEC_PROBE_STACK))]
12456 operands[1] = gen_rtx_REG (Pmode, 0);
12457 return "st<wd>%U0%X0 %1,%0";
12459 [(set_attr "type" "store")
12460 (set (attr "update")
12461 (if_then_else (match_operand 0 "update_address_mem")
12462 (const_string "yes")
12463 (const_string "no")))
12464 (set (attr "indexed")
12465 (if_then_else (match_operand 0 "indexed_address_mem")
12466 (const_string "yes")
12467 (const_string "no")))
12468 (set_attr "length" "4")])
12470 (define_insn "probe_stack_range<P:mode>"
12471 [(set (match_operand:P 0 "register_operand" "=r")
12472 (unspec_volatile:P [(match_operand:P 1 "register_operand" "0")
12473 (match_operand:P 2 "register_operand" "r")]
12474 UNSPECV_PROBE_STACK_RANGE))]
12476 "* return output_probe_stack_range (operands[0], operands[2]);"
12477 [(set_attr "type" "three")])
12479 ;; Compare insns are next. Note that the RS/6000 has two types of compares,
12480 ;; signed & unsigned, and one type of branch.
12482 ;; Start with the DEFINE_EXPANDs to generate the rtl for compares, scc
12483 ;; insns, and branches.
12485 (define_expand "cbranch<mode>4"
12486 [(use (match_operator 0 "rs6000_cbranch_operator"
12487 [(match_operand:GPR 1 "gpc_reg_operand" "")
12488 (match_operand:GPR 2 "reg_or_short_operand" "")]))
12489 (use (match_operand 3 ""))]
12493 /* Take care of the possibility that operands[2] might be negative but
12494 this might be a logical operation. That insn doesn't exist. */
12495 if (GET_CODE (operands[2]) == CONST_INT
12496 && INTVAL (operands[2]) < 0)
12498 operands[2] = force_reg (<MODE>mode, operands[2]);
12499 operands[0] = gen_rtx_fmt_ee (GET_CODE (operands[0]),
12500 GET_MODE (operands[0]),
12501 operands[1], operands[2]);
12504 rs6000_emit_cbranch (<MODE>mode, operands);
12508 (define_expand "cbranch<mode>4"
12509 [(use (match_operator 0 "rs6000_cbranch_operator"
12510 [(match_operand:FP 1 "gpc_reg_operand" "")
12511 (match_operand:FP 2 "gpc_reg_operand" "")]))
12512 (use (match_operand 3 ""))]
12516 rs6000_emit_cbranch (<MODE>mode, operands);
12520 (define_expand "cstore<mode>4"
12521 [(use (match_operator 1 "rs6000_cbranch_operator"
12522 [(match_operand:GPR 2 "gpc_reg_operand" "")
12523 (match_operand:GPR 3 "reg_or_short_operand" "")]))
12524 (clobber (match_operand:SI 0 "register_operand"))]
12528 /* Take care of the possibility that operands[3] might be negative but
12529 this might be a logical operation. That insn doesn't exist. */
12530 if (GET_CODE (operands[3]) == CONST_INT
12531 && INTVAL (operands[3]) < 0)
12533 operands[3] = force_reg (<MODE>mode, operands[3]);
12534 operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]),
12535 GET_MODE (operands[1]),
12536 operands[2], operands[3]);
12539 /* For SNE, we would prefer that the xor/abs sequence be used for integers.
12540 For SEQ, likewise, except that comparisons with zero should be done
12541 with an scc insns. However, due to the order that combine see the
12542 resulting insns, we must, in fact, allow SEQ for integers. Fail in
12543 the cases we don't want to handle or are best handled by portable
12545 if (GET_CODE (operands[1]) == NE)
12547 if ((GET_CODE (operands[1]) == LT || GET_CODE (operands[1]) == LE
12548 || GET_CODE (operands[1]) == GT || GET_CODE (operands[1]) == GE)
12549 && operands[3] == const0_rtx)
12551 rs6000_emit_sCOND (<MODE>mode, operands);
12555 (define_expand "cstore<mode>4"
12556 [(use (match_operator 1 "rs6000_cbranch_operator"
12557 [(match_operand:FP 2 "gpc_reg_operand" "")
12558 (match_operand:FP 3 "gpc_reg_operand" "")]))
12559 (clobber (match_operand:SI 0 "register_operand"))]
12563 rs6000_emit_sCOND (<MODE>mode, operands);
12568 (define_expand "stack_protect_set"
12569 [(match_operand 0 "memory_operand" "")
12570 (match_operand 1 "memory_operand" "")]
12573 #ifdef TARGET_THREAD_SSP_OFFSET
12574 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
12575 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
12576 operands[1] = gen_rtx_MEM (Pmode, addr);
12579 emit_insn (gen_stack_protect_setdi (operands[0], operands[1]));
12581 emit_insn (gen_stack_protect_setsi (operands[0], operands[1]));
12585 (define_insn "stack_protect_setsi"
12586 [(set (match_operand:SI 0 "memory_operand" "=m")
12587 (unspec:SI [(match_operand:SI 1 "memory_operand" "m")] UNSPEC_SP_SET))
12588 (set (match_scratch:SI 2 "=&r") (const_int 0))]
12590 "lwz%U1%X1 %2,%1\;stw%U0%X0 %2,%0\;li %2,0"
12591 [(set_attr "type" "three")
12592 (set_attr "length" "12")])
12594 (define_insn "stack_protect_setdi"
12595 [(set (match_operand:DI 0 "memory_operand" "=Y")
12596 (unspec:DI [(match_operand:DI 1 "memory_operand" "Y")] UNSPEC_SP_SET))
12597 (set (match_scratch:DI 2 "=&r") (const_int 0))]
12599 "ld%U1%X1 %2,%1\;std%U0%X0 %2,%0\;li %2,0"
12600 [(set_attr "type" "three")
12601 (set_attr "length" "12")])
12603 (define_expand "stack_protect_test"
12604 [(match_operand 0 "memory_operand" "")
12605 (match_operand 1 "memory_operand" "")
12606 (match_operand 2 "" "")]
12609 rtx test, op0, op1;
12610 #ifdef TARGET_THREAD_SSP_OFFSET
12611 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
12612 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
12613 operands[1] = gen_rtx_MEM (Pmode, addr);
12616 op1 = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, operands[1]), UNSPEC_SP_TEST);
12617 test = gen_rtx_EQ (VOIDmode, op0, op1);
12618 emit_jump_insn (gen_cbranchsi4 (test, op0, op1, operands[2]));
12622 (define_insn "stack_protect_testsi"
12623 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
12624 (unspec:CCEQ [(match_operand:SI 1 "memory_operand" "m,m")
12625 (match_operand:SI 2 "memory_operand" "m,m")]
12627 (set (match_scratch:SI 4 "=r,r") (const_int 0))
12628 (clobber (match_scratch:SI 3 "=&r,&r"))]
12631 lwz%U1%X1 %3,%1\;lwz%U2%X2 %4,%2\;xor. %3,%3,%4\;li %4,0
12632 lwz%U1%X1 %3,%1\;lwz%U2%X2 %4,%2\;cmplw %0,%3,%4\;li %3,0\;li %4,0"
12633 [(set_attr "length" "16,20")])
12635 (define_insn "stack_protect_testdi"
12636 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
12637 (unspec:CCEQ [(match_operand:DI 1 "memory_operand" "Y,Y")
12638 (match_operand:DI 2 "memory_operand" "Y,Y")]
12640 (set (match_scratch:DI 4 "=r,r") (const_int 0))
12641 (clobber (match_scratch:DI 3 "=&r,&r"))]
12644 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;xor. %3,%3,%4\;li %4,0
12645 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;cmpld %0,%3,%4\;li %3,0\;li %4,0"
12646 [(set_attr "length" "16,20")])
12649 ;; Here are the actual compare insns.
12650 (define_insn "*cmp<mode>_internal1"
12651 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
12652 (compare:CC (match_operand:GPR 1 "gpc_reg_operand" "r")
12653 (match_operand:GPR 2 "reg_or_short_operand" "rI")))]
12655 "cmp<wd>%I2 %0,%1,%2"
12656 [(set_attr "type" "cmp")])
12658 ;; If we are comparing a register for equality with a large constant,
12659 ;; we can do this with an XOR followed by a compare. But this is profitable
12660 ;; only if the large constant is only used for the comparison (and in this
12661 ;; case we already have a register to reuse as scratch).
12663 ;; For 64-bit registers, we could only do so if the constant's bit 15 is clear:
12664 ;; otherwise we'd need to XOR with FFFFFFFF????0000 which is not available.
12667 [(set (match_operand:SI 0 "register_operand")
12668 (match_operand:SI 1 "logical_const_operand" ""))
12669 (set (match_dup 0) (match_operator:SI 3 "boolean_or_operator"
12671 (match_operand:SI 2 "logical_const_operand" "")]))
12672 (set (match_operand:CC 4 "cc_reg_operand" "")
12673 (compare:CC (match_operand:SI 5 "gpc_reg_operand" "")
12676 (if_then_else (match_operator 6 "equality_operator"
12677 [(match_dup 4) (const_int 0)])
12678 (match_operand 7 "" "")
12679 (match_operand 8 "" "")))]
12680 "peep2_reg_dead_p (3, operands[0])
12681 && peep2_reg_dead_p (4, operands[4])"
12682 [(set (match_dup 0) (xor:SI (match_dup 5) (match_dup 9)))
12683 (set (match_dup 4) (compare:CC (match_dup 0) (match_dup 10)))
12684 (set (pc) (if_then_else (match_dup 6) (match_dup 7) (match_dup 8)))]
12687 /* Get the constant we are comparing against, and see what it looks like
12688 when sign-extended from 16 to 32 bits. Then see what constant we could
12689 XOR with SEXTC to get the sign-extended value. */
12690 rtx cnst = simplify_const_binary_operation (GET_CODE (operands[3]),
12692 operands[1], operands[2]);
12693 HOST_WIDE_INT c = INTVAL (cnst);
12694 HOST_WIDE_INT sextc = ((c & 0xffff) ^ 0x8000) - 0x8000;
12695 HOST_WIDE_INT xorv = c ^ sextc;
12697 operands[9] = GEN_INT (xorv);
12698 operands[10] = GEN_INT (sextc);
12701 (define_insn "*cmpsi_internal2"
12702 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
12703 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
12704 (match_operand:SI 2 "reg_or_u_short_operand" "rK")))]
12706 "cmplw%I2 %0,%1,%b2"
12707 [(set_attr "type" "cmp")])
12709 (define_insn "*cmpdi_internal2"
12710 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
12711 (compare:CCUNS (match_operand:DI 1 "gpc_reg_operand" "r")
12712 (match_operand:DI 2 "reg_or_u_short_operand" "rK")))]
12714 "cmpld%I2 %0,%1,%b2"
12715 [(set_attr "type" "cmp")])
12717 ;; The following two insns don't exist as single insns, but if we provide
12718 ;; them, we can swap an add and compare, which will enable us to overlap more
12719 ;; of the required delay between a compare and branch. We generate code for
12720 ;; them by splitting.
12723 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
12724 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
12725 (match_operand:SI 2 "short_cint_operand" "i")))
12726 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
12727 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
12730 [(set_attr "length" "8")])
12733 [(set (match_operand:CCUNS 3 "cc_reg_operand" "=y")
12734 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
12735 (match_operand:SI 2 "u_short_cint_operand" "i")))
12736 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
12737 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
12740 [(set_attr "length" "8")])
12743 [(set (match_operand:CC 3 "cc_reg_operand" "")
12744 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
12745 (match_operand:SI 2 "short_cint_operand" "")))
12746 (set (match_operand:SI 0 "gpc_reg_operand" "")
12747 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
12749 [(set (match_dup 3) (compare:CC (match_dup 1) (match_dup 2)))
12750 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
12753 [(set (match_operand:CCUNS 3 "cc_reg_operand" "")
12754 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "")
12755 (match_operand:SI 2 "u_short_cint_operand" "")))
12756 (set (match_operand:SI 0 "gpc_reg_operand" "")
12757 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
12759 [(set (match_dup 3) (compare:CCUNS (match_dup 1) (match_dup 2)))
12760 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
12762 ;; Only need to compare second words if first words equal
12763 (define_insn "*cmptf_internal1"
12764 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
12765 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "d")
12766 (match_operand:TF 2 "gpc_reg_operand" "d")))]
12767 "!TARGET_IEEEQUAD && !TARGET_XL_COMPAT
12768 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LONG_DOUBLE_128"
12769 "fcmpu %0,%1,%2\;bne %0,$+8\;fcmpu %0,%L1,%L2"
12770 [(set_attr "type" "fpcompare")
12771 (set_attr "length" "12")])
12773 (define_insn_and_split "*cmptf_internal2"
12774 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
12775 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "d")
12776 (match_operand:TF 2 "gpc_reg_operand" "d")))
12777 (clobber (match_scratch:DF 3 "=d"))
12778 (clobber (match_scratch:DF 4 "=d"))
12779 (clobber (match_scratch:DF 5 "=d"))
12780 (clobber (match_scratch:DF 6 "=d"))
12781 (clobber (match_scratch:DF 7 "=d"))
12782 (clobber (match_scratch:DF 8 "=d"))
12783 (clobber (match_scratch:DF 9 "=d"))
12784 (clobber (match_scratch:DF 10 "=d"))
12785 (clobber (match_scratch:GPR 11 "=b"))]
12786 "!TARGET_IEEEQUAD && TARGET_XL_COMPAT
12787 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LONG_DOUBLE_128"
12789 "&& reload_completed"
12790 [(set (match_dup 3) (match_dup 14))
12791 (set (match_dup 4) (match_dup 15))
12792 (set (match_dup 9) (abs:DF (match_dup 5)))
12793 (set (match_dup 0) (compare:CCFP (match_dup 9) (match_dup 3)))
12794 (set (pc) (if_then_else (ne (match_dup 0) (const_int 0))
12795 (label_ref (match_dup 12))
12797 (set (match_dup 0) (compare:CCFP (match_dup 5) (match_dup 7)))
12798 (set (pc) (label_ref (match_dup 13)))
12800 (set (match_dup 10) (minus:DF (match_dup 5) (match_dup 7)))
12801 (set (match_dup 9) (minus:DF (match_dup 6) (match_dup 8)))
12802 (set (match_dup 9) (plus:DF (match_dup 10) (match_dup 9)))
12803 (set (match_dup 0) (compare:CCFP (match_dup 9) (match_dup 4)))
12806 REAL_VALUE_TYPE rv;
12807 const int lo_word = LONG_DOUBLE_LARGE_FIRST ? GET_MODE_SIZE (DFmode) : 0;
12808 const int hi_word = LONG_DOUBLE_LARGE_FIRST ? 0 : GET_MODE_SIZE (DFmode);
12810 operands[5] = simplify_gen_subreg (DFmode, operands[1], TFmode, hi_word);
12811 operands[6] = simplify_gen_subreg (DFmode, operands[1], TFmode, lo_word);
12812 operands[7] = simplify_gen_subreg (DFmode, operands[2], TFmode, hi_word);
12813 operands[8] = simplify_gen_subreg (DFmode, operands[2], TFmode, lo_word);
12814 operands[12] = gen_label_rtx ();
12815 operands[13] = gen_label_rtx ();
12817 operands[14] = force_const_mem (DFmode,
12818 CONST_DOUBLE_FROM_REAL_VALUE (rv, DFmode));
12819 operands[15] = force_const_mem (DFmode,
12820 CONST_DOUBLE_FROM_REAL_VALUE (dconst0,
12825 tocref = create_TOC_reference (XEXP (operands[14], 0), operands[11]);
12826 operands[14] = gen_const_mem (DFmode, tocref);
12827 tocref = create_TOC_reference (XEXP (operands[15], 0), operands[11]);
12828 operands[15] = gen_const_mem (DFmode, tocref);
12829 set_mem_alias_set (operands[14], get_TOC_alias_set ());
12830 set_mem_alias_set (operands[15], get_TOC_alias_set ());
12834 ;; Now we have the scc insns. We can do some combinations because of the
12835 ;; way the machine works.
12837 ;; Note that this is probably faster if we can put an insn between the
12838 ;; mfcr and rlinm, but this is tricky. Let's leave it for now. In most
12839 ;; cases the insns below which don't use an intermediate CR field will
12840 ;; be used instead.
12842 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12843 (match_operator:SI 1 "scc_comparison_operator"
12844 [(match_operand 2 "cc_reg_operand" "y")
12847 "mfcr %0%Q2\;rlwinm %0,%0,%J1,1"
12848 [(set (attr "type")
12849 (cond [(match_test "TARGET_MFCRF")
12850 (const_string "mfcrf")
12852 (const_string "mfcr")))
12853 (set_attr "length" "8")])
12855 ;; Same as above, but get the GT bit.
12856 (define_insn "move_from_CR_gt_bit"
12857 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12858 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_GT))]
12859 "TARGET_HARD_FLOAT && !TARGET_FPRS"
12860 "mfcr %0\;rlwinm %0,%0,%D1,31,31"
12861 [(set_attr "type" "mfcr")
12862 (set_attr "length" "8")])
12864 ;; Same as above, but get the OV/ORDERED bit.
12865 (define_insn "move_from_CR_ov_bit"
12866 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12867 (unspec:SI [(match_operand:CC 1 "cc_reg_operand" "y")]
12870 "mfcr %0\;rlwinm %0,%0,%t1,1"
12871 [(set_attr "type" "mfcr")
12872 (set_attr "length" "8")])
12875 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12876 (match_operator:DI 1 "scc_comparison_operator"
12877 [(match_operand 2 "cc_reg_operand" "y")
12880 "mfcr %0%Q2\;rlwinm %0,%0,%J1,1"
12881 [(set (attr "type")
12882 (cond [(match_test "TARGET_MFCRF")
12883 (const_string "mfcrf")
12885 (const_string "mfcr")))
12886 (set_attr "length" "8")])
12889 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12890 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
12891 [(match_operand 2 "cc_reg_operand" "y,y")
12894 (set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
12895 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
12898 mfcr %3%Q2\;rlwinm. %3,%3,%J1,1
12900 [(set_attr "type" "shift")
12901 (set_attr "dot" "yes")
12902 (set_attr "length" "8,16")])
12905 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12906 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
12907 [(match_operand 2 "cc_reg_operand" "")
12910 (set (match_operand:SI 3 "gpc_reg_operand" "")
12911 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
12912 "TARGET_32BIT && reload_completed"
12913 [(set (match_dup 3)
12914 (match_op_dup 1 [(match_dup 2) (const_int 0)]))
12916 (compare:CC (match_dup 3)
12921 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12922 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
12923 [(match_operand 2 "cc_reg_operand" "y")
12925 (match_operand:SI 3 "const_int_operand" "n")))]
12929 int is_bit = ccr_bit (operands[1], 1);
12930 int put_bit = 31 - (INTVAL (operands[3]) & 31);
12933 if (is_bit >= put_bit)
12934 count = is_bit - put_bit;
12936 count = 32 - (put_bit - is_bit);
12938 operands[4] = GEN_INT (count);
12939 operands[5] = GEN_INT (put_bit);
12941 return \"mfcr %0%Q2\;rlwinm %0,%0,%4,%5,%5\";
12943 [(set (attr "type")
12944 (cond [(match_test "TARGET_MFCRF")
12945 (const_string "mfcrf")
12947 (const_string "mfcr")))
12948 (set_attr "length" "8")])
12951 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12953 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
12954 [(match_operand 2 "cc_reg_operand" "y,y")
12956 (match_operand:SI 3 "const_int_operand" "n,n"))
12958 (set (match_operand:SI 4 "gpc_reg_operand" "=r,r")
12959 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
12964 int is_bit = ccr_bit (operands[1], 1);
12965 int put_bit = 31 - (INTVAL (operands[3]) & 31);
12968 /* Force split for non-cc0 compare. */
12969 if (which_alternative == 1)
12972 if (is_bit >= put_bit)
12973 count = is_bit - put_bit;
12975 count = 32 - (put_bit - is_bit);
12977 operands[5] = GEN_INT (count);
12978 operands[6] = GEN_INT (put_bit);
12980 return \"mfcr %4%Q2\;rlwinm. %4,%4,%5,%6,%6\";
12982 [(set_attr "type" "shift")
12983 (set_attr "dot" "yes")
12984 (set_attr "length" "8,16")])
12987 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
12989 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
12990 [(match_operand 2 "cc_reg_operand" "")
12992 (match_operand:SI 3 "const_int_operand" ""))
12994 (set (match_operand:SI 4 "gpc_reg_operand" "")
12995 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
12998 [(set (match_dup 4)
12999 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
13002 (compare:CC (match_dup 4)
13006 ;; There is a 3 cycle delay between consecutive mfcr instructions
13007 ;; so it is useful to combine 2 scc instructions to use only one mfcr.
13010 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13011 (match_operator:SI 1 "scc_comparison_operator"
13012 [(match_operand 2 "cc_reg_operand" "y")
13014 (set (match_operand:SI 3 "gpc_reg_operand" "=r")
13015 (match_operator:SI 4 "scc_comparison_operator"
13016 [(match_operand 5 "cc_reg_operand" "y")
13018 "REGNO (operands[2]) != REGNO (operands[5])"
13019 "mfcr %3\;rlwinm %0,%3,%J1,1\;rlwinm %3,%3,%J4,1"
13020 [(set_attr "type" "mfcr")
13021 (set_attr "length" "12")])
13024 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13025 (match_operator:DI 1 "scc_comparison_operator"
13026 [(match_operand 2 "cc_reg_operand" "y")
13028 (set (match_operand:DI 3 "gpc_reg_operand" "=r")
13029 (match_operator:DI 4 "scc_comparison_operator"
13030 [(match_operand 5 "cc_reg_operand" "y")
13032 "TARGET_POWERPC64 && REGNO (operands[2]) != REGNO (operands[5])"
13033 "mfcr %3\;rlwinm %0,%3,%J1,1\;rlwinm %3,%3,%J4,1"
13034 [(set_attr "type" "mfcr")
13035 (set_attr "length" "12")])
13037 ;; There are some scc insns that can be done directly, without a compare.
13038 ;; These are faster because they don't involve the communications between
13039 ;; the FXU and branch units. In fact, we will be replacing all of the
13040 ;; integer scc insns here or in the portable methods in emit_store_flag.
13042 ;; Also support (neg (scc ..)) since that construct is used to replace
13043 ;; branches, (plus (scc ..) ..) since that construct is common and
13044 ;; takes no more insns than scc, and (and (neg (scc ..)) ..) in the
13045 ;; cases where it is no more expensive than (neg (scc ..)).
13047 ;; Have reload force a constant into a register for the simple insns that
13048 ;; otherwise won't accept constants. We do this because it is faster than
13049 ;; the cmp/mfcr sequence we would otherwise generate.
13051 (define_mode_attr scc_eq_op2 [(SI "rKLI")
13054 (define_insn_and_split "*eq<mode>"
13055 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
13056 (eq:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
13057 (match_operand:GPR 2 "scc_eq_operand" "<scc_eq_op2>")))]
13061 [(set (match_dup 0)
13062 (clz:GPR (match_dup 3)))
13064 (lshiftrt:GPR (match_dup 0) (match_dup 4)))]
13066 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
13068 /* Use output operand as intermediate. */
13069 operands[3] = operands[0];
13071 if (logical_operand (operands[2], <MODE>mode))
13072 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13073 gen_rtx_XOR (<MODE>mode,
13074 operands[1], operands[2])));
13076 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13077 gen_rtx_PLUS (<MODE>mode, operands[1],
13078 negate_rtx (<MODE>mode,
13082 operands[3] = operands[1];
13084 operands[4] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
13087 (define_insn_and_split "*eq<mode>_compare"
13088 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
13090 (eq:P (match_operand:P 1 "gpc_reg_operand" "=r")
13091 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))
13093 (set (match_operand:P 0 "gpc_reg_operand" "=r")
13094 (eq:P (match_dup 1) (match_dup 2)))]
13098 [(set (match_dup 0)
13099 (clz:P (match_dup 4)))
13100 (parallel [(set (match_dup 3)
13101 (compare:CC (lshiftrt:P (match_dup 0) (match_dup 5))
13104 (lshiftrt:P (match_dup 0) (match_dup 5)))])]
13106 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
13108 /* Use output operand as intermediate. */
13109 operands[4] = operands[0];
13111 if (logical_operand (operands[2], <MODE>mode))
13112 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
13113 gen_rtx_XOR (<MODE>mode,
13114 operands[1], operands[2])));
13116 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
13117 gen_rtx_PLUS (<MODE>mode, operands[1],
13118 negate_rtx (<MODE>mode,
13122 operands[4] = operands[1];
13124 operands[5] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
13127 ;; We have insns of the form shown by the first define_insn below. If
13128 ;; there is something inside the comparison operation, we must split it.
13130 [(set (match_operand:SI 0 "gpc_reg_operand" "")
13131 (plus:SI (match_operator 1 "comparison_operator"
13132 [(match_operand:SI 2 "" "")
13133 (match_operand:SI 3
13134 "reg_or_cint_operand" "")])
13135 (match_operand:SI 4 "gpc_reg_operand" "")))
13136 (clobber (match_operand:SI 5 "register_operand" ""))]
13137 "! gpc_reg_operand (operands[2], SImode)"
13138 [(set (match_dup 5) (match_dup 2))
13139 (set (match_dup 0) (plus:SI (match_op_dup 1 [(match_dup 5) (match_dup 3)])
13142 (define_insn "*plus_eqsi"
13143 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r")
13144 (plus:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
13145 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I"))
13146 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r")))]
13149 xor %0,%1,%2\;subfic %0,%0,0\;addze %0,%3
13150 subfic %0,%1,0\;addze %0,%3
13151 xori %0,%1,%b2\;subfic %0,%0,0\;addze %0,%3
13152 xoris %0,%1,%u2\;subfic %0,%0,0\;addze %0,%3
13153 subfic %0,%1,%2\;subfic %0,%0,0\;addze %0,%3"
13154 [(set_attr "type" "three,two,three,three,three")
13155 (set_attr "length" "12,8,12,12,12")])
13157 (define_insn "*compare_plus_eqsi"
13158 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
13161 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
13162 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
13163 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
13165 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r"))]
13166 "TARGET_32BIT && optimize_size"
13168 xor %4,%1,%2\;subfic %4,%4,0\;addze. %4,%3
13169 subfic %4,%1,0\;addze. %4,%3
13170 xori %4,%1,%b2\;subfic %4,%4,0\;addze. %4,%3
13171 xoris %4,%1,%u2\;subfic %4,%4,0\;addze. %4,%3
13172 subfic %4,%1,%2\;subfic %4,%4,0\;addze. %4,%3
13178 [(set_attr "type" "compare")
13179 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
13182 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13185 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
13186 (match_operand:SI 2 "scc_eq_operand" ""))
13187 (match_operand:SI 3 "gpc_reg_operand" ""))
13189 (clobber (match_scratch:SI 4 ""))]
13190 "TARGET_32BIT && optimize_size && reload_completed"
13191 [(set (match_dup 4)
13192 (plus:SI (eq:SI (match_dup 1)
13196 (compare:CC (match_dup 4)
13200 (define_insn "*plus_eqsi_compare"
13201 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
13204 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
13205 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
13206 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
13208 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r")
13209 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13210 "TARGET_32BIT && optimize_size"
13212 xor %0,%1,%2\;subfic %0,%0,0\;addze. %0,%3
13213 subfic %0,%1,0\;addze. %0,%3
13214 xori %0,%1,%b2\;subfic %0,%0,0\;addze. %0,%3
13215 xoris %0,%1,%u2\;subfic %0,%0,0\;addze. %0,%3
13216 subfic %0,%1,%2\;subfic %0,%0,0\;addze. %0,%3
13222 [(set_attr "type" "compare")
13223 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
13226 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13229 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
13230 (match_operand:SI 2 "scc_eq_operand" ""))
13231 (match_operand:SI 3 "gpc_reg_operand" ""))
13233 (set (match_operand:SI 0 "gpc_reg_operand" "")
13234 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13235 "TARGET_32BIT && optimize_size && reload_completed"
13236 [(set (match_dup 0)
13237 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13239 (compare:CC (match_dup 0)
13243 (define_insn "*neg_eq0<mode>"
13244 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13245 (neg:P (eq:P (match_operand:P 1 "gpc_reg_operand" "r")
13248 "addic %0,%1,-1\;subfe %0,%0,%0"
13249 [(set_attr "type" "two")
13250 (set_attr "length" "8")])
13252 (define_insn_and_split "*neg_eq<mode>"
13253 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13254 (neg:P (eq:P (match_operand:P 1 "gpc_reg_operand" "%r")
13255 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))))]
13259 [(set (match_dup 0) (neg:P (eq:P (match_dup 3) (const_int 0))))]
13261 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
13263 /* Use output operand as intermediate. */
13264 operands[3] = operands[0];
13266 if (logical_operand (operands[2], <MODE>mode))
13267 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13268 gen_rtx_XOR (<MODE>mode,
13269 operands[1], operands[2])));
13271 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13272 gen_rtx_PLUS (<MODE>mode, operands[1],
13273 negate_rtx (<MODE>mode,
13277 operands[3] = operands[1];
13280 (define_insn "*ne0_<mode>"
13281 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13282 (ne:P (match_operand:P 1 "gpc_reg_operand" "r")
13284 (clobber (match_scratch:P 2 "=&r"))]
13285 "!(TARGET_32BIT && TARGET_ISEL)"
13286 "addic %2,%1,-1\;subfe %0,%2,%1"
13287 [(set_attr "type" "two")
13288 (set_attr "length" "8")])
13290 (define_insn "*plus_ne0_<mode>"
13291 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13292 (plus:P (ne:P (match_operand:P 1 "gpc_reg_operand" "r")
13294 (match_operand:P 2 "gpc_reg_operand" "r")))
13295 (clobber (match_scratch:P 3 "=&r"))]
13297 "addic %3,%1,-1\;addze %0,%2"
13298 [(set_attr "type" "two")
13299 (set_attr "length" "8")])
13301 (define_insn "*compare_plus_ne0_<mode>"
13302 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13303 (compare:CC (plus:P (ne:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13305 (match_operand:P 2 "gpc_reg_operand" "r,r"))
13307 (clobber (match_scratch:P 3 "=&r,&r"))
13308 (clobber (match_scratch:P 4 "=X,&r"))]
13311 addic %3,%1,-1\;addze. %3,%2
13313 [(set_attr "type" "compare")
13314 (set_attr "length" "8,12")])
13317 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
13318 (compare:CC (ne:P (match_operand:SI 1 "gpc_reg_operand" "")
13320 (neg:P (match_operand:P 2 "gpc_reg_operand" ""))))
13321 (clobber (match_scratch:P 3 ""))
13322 (clobber (match_scratch:P 4 ""))]
13324 [(parallel [(set (match_dup 3)
13325 (plus:P (ne:P (match_dup 1)
13328 (clobber (match_dup 4))])
13330 (compare:CC (match_dup 3)
13335 (define_insn "*compare_plus_ne0_<mode>_1"
13336 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
13337 (compare:CCEQ (ne:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13339 (neg:P (match_operand:P 2 "gpc_reg_operand" "r,r"))))
13340 (clobber (match_scratch:P 3 "=&r,&r"))
13341 (clobber (match_scratch:P 4 "=X,&r"))]
13344 addic %3,%1,-1\;addze. %3,%2
13346 [(set_attr "type" "compare")
13347 (set_attr "length" "8,12")])
13350 [(set (match_operand:CCEQ 0 "cc_reg_not_micro_cr0_operand" "")
13351 (compare:CCEQ (ne:P (match_operand:SI 1 "gpc_reg_operand" "")
13353 (neg:P (match_operand:P 2 "gpc_reg_operand" ""))))
13354 (clobber (match_scratch:P 3 ""))
13355 (clobber (match_scratch:P 4 ""))]
13357 [(parallel [(set (match_dup 3)
13358 (plus:P (ne:P (match_dup 1)
13361 (clobber (match_dup 4))])
13363 (compare:CC (match_dup 3)
13367 (define_insn "*plus_ne0_<mode>_compare"
13368 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13370 (plus:P (ne:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13372 (match_operand:P 2 "gpc_reg_operand" "r,r"))
13374 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13375 (plus:P (ne:P (match_dup 1)
13378 (clobber (match_scratch:P 3 "=&r,&r"))]
13381 addic %3,%1,-1\;addze. %0,%2
13383 [(set_attr "type" "compare")
13384 (set_attr "length" "8,12")])
13387 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
13389 (plus:P (ne:P (match_operand:P 1 "gpc_reg_operand" "")
13391 (match_operand:P 2 "gpc_reg_operand" ""))
13393 (set (match_operand:P 0 "gpc_reg_operand" "")
13394 (plus:P (ne:P (match_dup 1)
13397 (clobber (match_scratch:P 3 ""))]
13399 [(parallel [(set (match_dup 0)
13400 (plus:P (ne:P (match_dup 1)
13403 (clobber (match_dup 3))])
13405 (compare:CC (match_dup 0)
13409 (define_insn "*leu<mode>"
13410 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13411 (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
13412 (match_operand:P 2 "reg_or_short_operand" "rI")))]
13414 "subf%I2c %0,%1,%2\;li %0,0\;adde %0,%0,%0"
13415 [(set_attr "type" "three")
13416 (set_attr "length" "12")])
13418 (define_insn "*leu<mode>_compare"
13419 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13421 (leu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13422 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
13424 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13425 (leu:P (match_dup 1) (match_dup 2)))]
13428 subf%I2c %0,%1,%2\;li %0,0\;adde. %0,%0,%0
13430 [(set_attr "type" "compare")
13431 (set_attr "length" "12,16")])
13434 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13436 (leu:P (match_operand:P 1 "gpc_reg_operand" "")
13437 (match_operand:P 2 "reg_or_short_operand" ""))
13439 (set (match_operand:P 0 "gpc_reg_operand" "")
13440 (leu:P (match_dup 1) (match_dup 2)))]
13442 [(set (match_dup 0)
13443 (leu:P (match_dup 1) (match_dup 2)))
13445 (compare:CC (match_dup 0)
13449 (define_insn "*plus_leu<mode>"
13450 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
13451 (plus:P (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
13452 (match_operand:P 2 "reg_or_short_operand" "rI"))
13453 (match_operand:P 3 "gpc_reg_operand" "r")))]
13455 "subf%I2c %0,%1,%2\;addze %0,%3"
13456 [(set_attr "type" "two")
13457 (set_attr "length" "8")])
13460 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13462 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13463 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13464 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13466 (clobber (match_scratch:SI 4 "=&r,&r"))]
13469 subf%I2c %4,%1,%2\;addze. %4,%3
13471 [(set_attr "type" "compare")
13472 (set_attr "length" "8,12")])
13475 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13477 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13478 (match_operand:SI 2 "reg_or_short_operand" ""))
13479 (match_operand:SI 3 "gpc_reg_operand" ""))
13481 (clobber (match_scratch:SI 4 ""))]
13482 "TARGET_32BIT && reload_completed"
13483 [(set (match_dup 4)
13484 (plus:SI (leu:SI (match_dup 1) (match_dup 2))
13487 (compare:CC (match_dup 4)
13492 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13494 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13495 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13496 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13498 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13499 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13502 subf%I2c %0,%1,%2\;addze. %0,%3
13504 [(set_attr "type" "compare")
13505 (set_attr "length" "8,12")])
13508 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13510 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13511 (match_operand:SI 2 "reg_or_short_operand" ""))
13512 (match_operand:SI 3 "gpc_reg_operand" ""))
13514 (set (match_operand:SI 0 "gpc_reg_operand" "")
13515 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13516 "TARGET_32BIT && reload_completed"
13517 [(set (match_dup 0)
13518 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13520 (compare:CC (match_dup 0)
13524 (define_insn "*neg_leu<mode>"
13525 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13526 (neg:P (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
13527 (match_operand:P 2 "reg_or_short_operand" "rI"))))]
13529 "subf%I2c %0,%1,%2\;subfe %0,%0,%0\;nand %0,%0,%0"
13530 [(set_attr "type" "three")
13531 (set_attr "length" "12")])
13533 (define_insn "*and_neg_leu<mode>"
13534 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
13536 (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
13537 (match_operand:P 2 "reg_or_short_operand" "rI")))
13538 (match_operand:P 3 "gpc_reg_operand" "r")))]
13540 "subf%I2c %0,%1,%2\;subfe %0,%0,%0\;andc %0,%3,%0"
13541 [(set_attr "type" "three")
13542 (set_attr "length" "12")])
13545 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13548 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13549 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
13550 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13552 (clobber (match_scratch:SI 4 "=&r,&r"))]
13555 subf%I2c %4,%1,%2\;subfe %4,%4,%4\;andc. %4,%3,%4
13557 [(set_attr "type" "compare")
13558 (set_attr "length" "12,16")])
13561 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13564 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13565 (match_operand:SI 2 "reg_or_short_operand" "")))
13566 (match_operand:SI 3 "gpc_reg_operand" ""))
13568 (clobber (match_scratch:SI 4 ""))]
13569 "TARGET_32BIT && reload_completed"
13570 [(set (match_dup 4)
13571 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
13574 (compare:CC (match_dup 4)
13579 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13582 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13583 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
13584 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13586 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13587 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13590 subf%I2c %0,%1,%2\;subfe %0,%0,%0\;andc. %0,%3,%0
13592 [(set_attr "type" "compare")
13593 (set_attr "length" "12,16")])
13596 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13599 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13600 (match_operand:SI 2 "reg_or_short_operand" "")))
13601 (match_operand:SI 3 "gpc_reg_operand" ""))
13603 (set (match_operand:SI 0 "gpc_reg_operand" "")
13604 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13605 "TARGET_32BIT && reload_completed"
13606 [(set (match_dup 0)
13607 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
13610 (compare:CC (match_dup 0)
13614 (define_insn_and_split "*ltu<mode>"
13615 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13616 (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13617 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))]
13621 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
13622 (set (match_dup 0) (neg:P (match_dup 0)))]
13625 (define_insn_and_split "*ltu<mode>_compare"
13626 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
13628 (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
13629 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
13631 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
13632 (ltu:P (match_dup 1) (match_dup 2)))]
13636 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
13637 (parallel [(set (match_dup 3)
13638 (compare:CC (neg:P (match_dup 0)) (const_int 0)))
13639 (set (match_dup 0) (neg:P (match_dup 0)))])]
13642 (define_insn_and_split "*plus_ltu<mode>"
13643 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,r")
13644 (plus:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13645 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))
13646 (match_operand:P 3 "reg_or_short_operand" "rI,rI")))]
13649 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13650 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
13651 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))]
13654 (define_insn_and_split "*plus_ltu<mode>_compare"
13655 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13657 (plus:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
13658 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
13659 (match_operand:P 3 "gpc_reg_operand" "r,r,r,r"))
13661 (set (match_operand:P 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13662 (plus:P (ltu:P (match_dup 1) (match_dup 2)) (match_dup 3)))]
13665 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13666 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
13667 (parallel [(set (match_dup 4)
13668 (compare:CC (minus:P (match_dup 3) (match_dup 0))
13670 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))])]
13673 (define_insn "*neg_ltu<mode>"
13674 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13675 (neg:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13676 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))))]
13679 subfc %0,%2,%1\;subfe %0,%0,%0
13680 addic %0,%1,%n2\;subfe %0,%0,%0"
13681 [(set_attr "type" "two")
13682 (set_attr "length" "8")])
13684 (define_insn "*geu<mode>"
13685 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13686 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13687 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))]
13690 subfc %0,%2,%1\;li %0,0\;adde %0,%0,%0
13691 addic %0,%1,%n2\;li %0,0\;adde %0,%0,%0"
13692 [(set_attr "type" "three")
13693 (set_attr "length" "12")])
13695 (define_insn "*geu<mode>_compare"
13696 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
13698 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
13699 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
13701 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
13702 (geu:P (match_dup 1) (match_dup 2)))]
13705 subfc %0,%2,%1\;li %0,0\;adde. %0,%0,%0
13706 addic %0,%1,%n2\;li %0,0\;adde. %0,%0,%0
13709 [(set_attr "type" "compare")
13710 (set_attr "length" "12,12,16,16")])
13713 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
13715 (geu:P (match_operand:P 1 "gpc_reg_operand" "")
13716 (match_operand:P 2 "reg_or_neg_short_operand" ""))
13718 (set (match_operand:P 0 "gpc_reg_operand" "")
13719 (geu:P (match_dup 1) (match_dup 2)))]
13721 [(set (match_dup 0)
13722 (geu:P (match_dup 1) (match_dup 2)))
13724 (compare:CC (match_dup 0)
13728 (define_insn "*plus_geu<mode>"
13729 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,&r")
13730 (plus:P (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13731 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))
13732 (match_operand:P 3 "gpc_reg_operand" "r,r")))]
13735 subfc %0,%2,%1\;addze %0,%3
13736 addic %0,%1,%n2\;addze %0,%3"
13737 [(set_attr "type" "two")
13738 (set_attr "length" "8")])
13741 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13743 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13744 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
13745 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13747 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
13750 subfc %4,%2,%1\;addze. %4,%3
13751 addic %4,%1,%n2\;addze. %4,%3
13754 [(set_attr "type" "compare")
13755 (set_attr "length" "8,8,12,12")])
13758 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13760 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13761 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
13762 (match_operand:SI 3 "gpc_reg_operand" ""))
13764 (clobber (match_scratch:SI 4 ""))]
13765 "TARGET_32BIT && reload_completed"
13766 [(set (match_dup 4)
13767 (plus:SI (geu:SI (match_dup 1) (match_dup 2))
13770 (compare:CC (match_dup 4)
13775 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13777 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13778 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
13779 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13781 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13782 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13785 subfc %0,%2,%1\;addze. %0,%3
13786 addic %0,%1,%n2\;addze. %0,%3
13789 [(set_attr "type" "compare")
13790 (set_attr "length" "8,8,12,12")])
13793 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13795 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13796 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
13797 (match_operand:SI 3 "gpc_reg_operand" ""))
13799 (set (match_operand:SI 0 "gpc_reg_operand" "")
13800 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13801 "TARGET_32BIT && reload_completed"
13802 [(set (match_dup 0)
13803 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13805 (compare:CC (match_dup 0)
13809 (define_insn "*neg_geu<mode>"
13810 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13811 (neg:P (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13812 (match_operand:P 2 "reg_or_short_operand" "r,I"))))]
13815 subfc %0,%2,%1\;subfe %0,%0,%0\;nand %0,%0,%0
13816 subfic %0,%1,-1\;add%I2c %0,%0,%2\;subfe %0,%0,%0"
13817 [(set_attr "type" "three")
13818 (set_attr "length" "12")])
13820 (define_insn "*and_neg_geu<mode>"
13821 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,&r")
13823 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13824 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))
13825 (match_operand:P 3 "gpc_reg_operand" "r,r")))]
13828 subfc %0,%2,%1\;subfe %0,%0,%0\;andc %0,%3,%0
13829 addic %0,%1,%n2\;subfe %0,%0,%0\;andc %0,%3,%0"
13830 [(set_attr "type" "three")
13831 (set_attr "length" "12")])
13834 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13837 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13838 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
13839 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13841 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
13844 subfc %4,%2,%1\;subfe %4,%4,%4\;andc. %4,%3,%4
13845 addic %4,%1,%n2\;subfe %4,%4,%4\;andc. %4,%3,%4
13848 [(set_attr "type" "compare")
13849 (set_attr "length" "12,12,16,16")])
13852 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13855 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13856 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
13857 (match_operand:SI 3 "gpc_reg_operand" ""))
13859 (clobber (match_scratch:SI 4 ""))]
13860 "TARGET_32BIT && reload_completed"
13861 [(set (match_dup 4)
13862 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2)))
13865 (compare:CC (match_dup 4)
13870 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13873 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13874 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
13875 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13877 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13878 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13881 subfc %0,%2,%1\;subfe %0,%0,%0\;andc. %0,%3,%0
13882 addic %0,%1,%n2\;subfe %0,%0,%0\;andc. %0,%3,%0
13885 [(set_attr "type" "compare")
13886 (set_attr "length" "12,12,16,16")])
13889 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13892 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13893 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
13894 (match_operand:SI 3 "gpc_reg_operand" ""))
13896 (set (match_operand:SI 0 "gpc_reg_operand" "")
13897 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13898 "TARGET_32BIT && reload_completed"
13899 [(set (match_dup 0)
13900 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
13902 (compare:CC (match_dup 0)
13906 (define_insn "*plus_gt0<mode>"
13907 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
13908 (plus:P (gt:P (match_operand:P 1 "gpc_reg_operand" "r")
13910 (match_operand:P 2 "gpc_reg_operand" "r")))]
13912 "addc %0,%1,%1\;subfe %0,%1,%0\;addze %0,%2"
13913 [(set_attr "type" "three")
13914 (set_attr "length" "12")])
13917 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13919 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13921 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
13923 (clobber (match_scratch:SI 3 "=&r,&r"))]
13926 addc %3,%1,%1\;subfe %3,%1,%3\;addze. %3,%2
13928 [(set_attr "type" "compare")
13929 (set_attr "length" "12,16")])
13932 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13934 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13936 (match_operand:SI 2 "gpc_reg_operand" ""))
13938 (clobber (match_scratch:SI 3 ""))]
13939 "TARGET_32BIT && reload_completed"
13940 [(set (match_dup 3)
13941 (plus:SI (gt:SI (match_dup 1) (const_int 0))
13944 (compare:CC (match_dup 3)
13949 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13951 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13953 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
13955 (clobber (match_scratch:DI 3 "=&r,&r"))]
13958 addc %3,%1,%1\;subfe %3,%1,%3\;addze. %3,%2
13960 [(set_attr "type" "compare")
13961 (set_attr "length" "12,16")])
13964 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
13966 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
13968 (match_operand:DI 2 "gpc_reg_operand" ""))
13970 (clobber (match_scratch:DI 3 ""))]
13971 "TARGET_64BIT && reload_completed"
13972 [(set (match_dup 3)
13973 (plus:DI (gt:DI (match_dup 1) (const_int 0))
13976 (compare:CC (match_dup 3)
13981 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13983 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13985 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
13987 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13988 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
13991 addc %0,%1,%1\;subfe %0,%1,%0\;addze. %0,%2
13993 [(set_attr "type" "compare")
13994 (set_attr "length" "12,16")])
13997 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13999 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14001 (match_operand:SI 2 "gpc_reg_operand" ""))
14003 (set (match_operand:SI 0 "gpc_reg_operand" "")
14004 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
14005 "TARGET_32BIT && reload_completed"
14006 [(set (match_dup 0)
14007 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))
14009 (compare:CC (match_dup 0)
14014 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
14016 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
14018 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
14020 (set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
14021 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
14024 addc %0,%1,%1\;subfe %0,%1,%0\;addze. %0,%2
14026 [(set_attr "type" "compare")
14027 (set_attr "length" "12,16")])
14030 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
14032 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
14034 (match_operand:DI 2 "gpc_reg_operand" ""))
14036 (set (match_operand:DI 0 "gpc_reg_operand" "")
14037 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
14038 "TARGET_64BIT && reload_completed"
14039 [(set (match_dup 0)
14040 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))
14042 (compare:CC (match_dup 0)
14046 (define_insn_and_split "*gtu<mode>"
14047 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
14048 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
14049 (match_operand:P 2 "reg_or_short_operand" "rI")))]
14053 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
14054 (set (match_dup 0) (neg:P (match_dup 0)))]
14057 (define_insn_and_split "*gtu<mode>_compare"
14058 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
14060 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14061 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
14063 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
14064 (gtu:P (match_dup 1) (match_dup 2)))]
14068 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
14069 (parallel [(set (match_dup 3)
14070 (compare:CC (neg:P (match_dup 0)) (const_int 0)))
14071 (set (match_dup 0) (neg:P (match_dup 0)))])]
14074 (define_insn_and_split "*plus_gtu<mode>"
14075 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
14076 (plus:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
14077 (match_operand:P 2 "reg_or_short_operand" "rI"))
14078 (match_operand:P 3 "reg_or_short_operand" "rI")))]
14081 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
14082 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
14083 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))]
14086 (define_insn_and_split "*plus_gtu<mode>_compare"
14087 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
14089 (plus:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
14090 (match_operand:P 2 "reg_or_short_operand" "I,r,I,r"))
14091 (match_operand:P 3 "gpc_reg_operand" "r,r,r,r"))
14093 (set (match_operand:P 0 "gpc_reg_operand" "=&r,&r,&r,&r")
14094 (plus:P (gtu:P (match_dup 1) (match_dup 2)) (match_dup 3)))]
14097 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
14098 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
14099 (parallel [(set (match_dup 4)
14100 (compare:CC (minus:P (match_dup 3) (match_dup 0))
14102 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))])]
14105 (define_insn "*neg_gtu<mode>"
14106 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
14107 (neg:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
14108 (match_operand:P 2 "reg_or_short_operand" "rI"))))]
14110 "subf%I2c %0,%1,%2\;subfe %0,%0,%0"
14111 [(set_attr "type" "two")
14112 (set_attr "length" "8")])
14115 ;; Define both directions of branch and return. If we need a reload
14116 ;; register, we'd rather use CR0 since it is much easier to copy a
14117 ;; register CC value to there.
14121 (if_then_else (match_operator 1 "branch_comparison_operator"
14123 "cc_reg_operand" "y")
14125 (label_ref (match_operand 0 "" ""))
14130 return output_cbranch (operands[1], \"%l0\", 0, insn);
14132 [(set_attr "type" "branch")])
14136 (if_then_else (match_operator 0 "branch_comparison_operator"
14138 "cc_reg_operand" "y")
14145 return output_cbranch (operands[0], NULL, 0, insn);
14147 [(set_attr "type" "jmpreg")
14148 (set_attr "length" "4")])
14152 (if_then_else (match_operator 1 "branch_comparison_operator"
14154 "cc_reg_operand" "y")
14157 (label_ref (match_operand 0 "" ""))))]
14161 return output_cbranch (operands[1], \"%l0\", 1, insn);
14163 [(set_attr "type" "branch")])
14167 (if_then_else (match_operator 0 "branch_comparison_operator"
14169 "cc_reg_operand" "y")
14176 return output_cbranch (operands[0], NULL, 1, insn);
14178 [(set_attr "type" "jmpreg")
14179 (set_attr "length" "4")])
14181 ;; Logic on condition register values.
14183 ; This pattern matches things like
14184 ; (set (reg:CCEQ 68) (compare:CCEQ (ior:SI (gt:SI (reg:CCFP 68) (const_int 0))
14185 ; (eq:SI (reg:CCFP 68) (const_int 0)))
14187 ; which are generated by the branch logic.
14188 ; Prefer destructive operations where BT = BB (for crXX BT,BA,BB)
14190 (define_insn "*cceq_ior_compare"
14191 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
14192 (compare:CCEQ (match_operator:SI 1 "boolean_operator"
14193 [(match_operator:SI 2
14194 "branch_positive_comparison_operator"
14196 "cc_reg_operand" "y,y")
14198 (match_operator:SI 4
14199 "branch_positive_comparison_operator"
14201 "cc_reg_operand" "0,y")
14205 "cr%q1 %E0,%j2,%j4"
14206 [(set_attr "type" "cr_logical,delayed_cr")])
14208 ; Why is the constant -1 here, but 1 in the previous pattern?
14209 ; Because ~1 has all but the low bit set.
14211 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
14212 (compare:CCEQ (match_operator:SI 1 "boolean_or_operator"
14213 [(not:SI (match_operator:SI 2
14214 "branch_positive_comparison_operator"
14216 "cc_reg_operand" "y,y")
14218 (match_operator:SI 4
14219 "branch_positive_comparison_operator"
14221 "cc_reg_operand" "0,y")
14225 "cr%q1 %E0,%j2,%j4"
14226 [(set_attr "type" "cr_logical,delayed_cr")])
14228 (define_insn "*cceq_rev_compare"
14229 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
14230 (compare:CCEQ (match_operator:SI 1
14231 "branch_positive_comparison_operator"
14233 "cc_reg_operand" "0,y")
14238 [(set_attr "type" "cr_logical,delayed_cr")])
14240 ;; If we are comparing the result of two comparisons, this can be done
14241 ;; using creqv or crxor.
14243 (define_insn_and_split ""
14244 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
14245 (compare:CCEQ (match_operator 1 "branch_comparison_operator"
14246 [(match_operand 2 "cc_reg_operand" "y")
14248 (match_operator 3 "branch_comparison_operator"
14249 [(match_operand 4 "cc_reg_operand" "y")
14254 [(set (match_dup 0) (compare:CCEQ (xor:SI (match_dup 1) (match_dup 3))
14258 int positive_1, positive_2;
14260 positive_1 = branch_positive_comparison_operator (operands[1],
14261 GET_MODE (operands[1]));
14262 positive_2 = branch_positive_comparison_operator (operands[3],
14263 GET_MODE (operands[3]));
14266 operands[1] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[2]),
14267 GET_CODE (operands[1])),
14269 operands[2], const0_rtx);
14270 else if (GET_MODE (operands[1]) != SImode)
14271 operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]), SImode,
14272 operands[2], const0_rtx);
14275 operands[3] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[4]),
14276 GET_CODE (operands[3])),
14278 operands[4], const0_rtx);
14279 else if (GET_MODE (operands[3]) != SImode)
14280 operands[3] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
14281 operands[4], const0_rtx);
14283 if (positive_1 == positive_2)
14285 operands[1] = gen_rtx_NOT (SImode, operands[1]);
14286 operands[5] = constm1_rtx;
14290 operands[5] = const1_rtx;
14294 ;; Unconditional branch and return.
14296 (define_insn "jump"
14298 (label_ref (match_operand 0 "" "")))]
14301 [(set_attr "type" "branch")])
14303 (define_insn "<return_str>return"
14307 [(set_attr "type" "jmpreg")])
14309 (define_expand "indirect_jump"
14310 [(set (pc) (match_operand 0 "register_operand" ""))])
14312 (define_insn "*indirect_jump<mode>"
14313 [(set (pc) (match_operand:P 0 "register_operand" "c,*l"))]
14318 [(set_attr "type" "jmpreg")])
14320 ;; Table jump for switch statements:
14321 (define_expand "tablejump"
14322 [(use (match_operand 0 "" ""))
14323 (use (label_ref (match_operand 1 "" "")))]
14328 emit_jump_insn (gen_tablejumpsi (operands[0], operands[1]));
14330 emit_jump_insn (gen_tablejumpdi (operands[0], operands[1]));
14334 (define_expand "tablejumpsi"
14335 [(set (match_dup 3)
14336 (plus:SI (match_operand:SI 0 "" "")
14338 (parallel [(set (pc) (match_dup 3))
14339 (use (label_ref (match_operand 1 "" "")))])]
14342 { operands[0] = force_reg (SImode, operands[0]);
14343 operands[2] = force_reg (SImode, gen_rtx_LABEL_REF (SImode, operands[1]));
14344 operands[3] = gen_reg_rtx (SImode);
14347 (define_expand "tablejumpdi"
14348 [(set (match_dup 4)
14349 (sign_extend:DI (match_operand:SI 0 "lwa_operand" "")))
14351 (plus:DI (match_dup 4)
14353 (parallel [(set (pc) (match_dup 3))
14354 (use (label_ref (match_operand 1 "" "")))])]
14357 { operands[2] = force_reg (DImode, gen_rtx_LABEL_REF (DImode, operands[1]));
14358 operands[3] = gen_reg_rtx (DImode);
14359 operands[4] = gen_reg_rtx (DImode);
14362 (define_insn "*tablejump<mode>_internal1"
14364 (match_operand:P 0 "register_operand" "c,*l"))
14365 (use (label_ref (match_operand 1 "" "")))]
14370 [(set_attr "type" "jmpreg")])
14377 (define_insn "group_ending_nop"
14378 [(unspec [(const_int 0)] UNSPEC_GRP_END_NOP)]
14382 if (rs6000_cpu_attr == CPU_POWER6)
14383 return \"ori 1,1,0\";
14384 return \"ori 2,2,0\";
14387 ;; Define the subtract-one-and-jump insns, starting with the template
14388 ;; so loop.c knows what to generate.
14390 (define_expand "doloop_end"
14391 [(use (match_operand 0 "" "")) ; loop pseudo
14392 (use (match_operand 1 "" ""))] ; label
14398 if (GET_MODE (operands[0]) != DImode)
14400 emit_jump_insn (gen_ctrdi (operands[0], operands[1]));
14404 if (GET_MODE (operands[0]) != SImode)
14406 emit_jump_insn (gen_ctrsi (operands[0], operands[1]));
14411 (define_expand "ctr<mode>"
14412 [(parallel [(set (pc)
14413 (if_then_else (ne (match_operand:P 0 "register_operand" "")
14415 (label_ref (match_operand 1 "" ""))
14418 (plus:P (match_dup 0)
14420 (clobber (match_scratch:CC 2 ""))
14421 (clobber (match_scratch:P 3 ""))])]
14425 ;; We need to be able to do this for any operand, including MEM, or we
14426 ;; will cause reload to blow up since we don't allow output reloads on
14428 ;; For the length attribute to be calculated correctly, the
14429 ;; label MUST be operand 0.
14431 (define_insn "*ctr<mode>_internal1"
14433 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
14435 (label_ref (match_operand 0 "" ""))
14437 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*c*l")
14438 (plus:P (match_dup 1)
14440 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14441 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
14445 if (which_alternative != 0)
14447 else if (get_attr_length (insn) == 4)
14448 return \"bdnz %l0\";
14450 return \"bdz $+8\;b %l0\";
14452 [(set_attr "type" "branch")
14453 (set_attr "length" "*,12,16,16")])
14455 (define_insn "*ctr<mode>_internal2"
14457 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
14460 (label_ref (match_operand 0 "" ""))))
14461 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*c*l")
14462 (plus:P (match_dup 1)
14464 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14465 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
14469 if (which_alternative != 0)
14471 else if (get_attr_length (insn) == 4)
14472 return \"bdz %l0\";
14474 return \"bdnz $+8\;b %l0\";
14476 [(set_attr "type" "branch")
14477 (set_attr "length" "*,12,16,16")])
14479 ;; Similar but use EQ
14481 (define_insn "*ctr<mode>_internal5"
14483 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
14485 (label_ref (match_operand 0 "" ""))
14487 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*c*l")
14488 (plus:P (match_dup 1)
14490 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14491 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
14495 if (which_alternative != 0)
14497 else if (get_attr_length (insn) == 4)
14498 return \"bdz %l0\";
14500 return \"bdnz $+8\;b %l0\";
14502 [(set_attr "type" "branch")
14503 (set_attr "length" "*,12,16,16")])
14505 (define_insn "*ctr<mode>_internal6"
14507 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
14510 (label_ref (match_operand 0 "" ""))))
14511 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*c*l")
14512 (plus:P (match_dup 1)
14514 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14515 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
14519 if (which_alternative != 0)
14521 else if (get_attr_length (insn) == 4)
14522 return \"bdnz %l0\";
14524 return \"bdz $+8\;b %l0\";
14526 [(set_attr "type" "branch")
14527 (set_attr "length" "*,12,16,16")])
14529 ;; Now the splitters if we could not allocate the CTR register
14533 (if_then_else (match_operator 2 "comparison_operator"
14534 [(match_operand:P 1 "gpc_reg_operand" "")
14536 (match_operand 5 "" "")
14537 (match_operand 6 "" "")))
14538 (set (match_operand:P 0 "gpc_reg_operand" "")
14539 (plus:P (match_dup 1) (const_int -1)))
14540 (clobber (match_scratch:CC 3 ""))
14541 (clobber (match_scratch:P 4 ""))]
14543 [(parallel [(set (match_dup 3)
14544 (compare:CC (plus:P (match_dup 1)
14548 (plus:P (match_dup 1)
14550 (set (pc) (if_then_else (match_dup 7)
14554 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
14555 operands[3], const0_rtx); }")
14559 (if_then_else (match_operator 2 "comparison_operator"
14560 [(match_operand:P 1 "gpc_reg_operand" "")
14562 (match_operand 5 "" "")
14563 (match_operand 6 "" "")))
14564 (set (match_operand:P 0 "nonimmediate_operand" "")
14565 (plus:P (match_dup 1) (const_int -1)))
14566 (clobber (match_scratch:CC 3 ""))
14567 (clobber (match_scratch:P 4 ""))]
14568 "reload_completed && ! gpc_reg_operand (operands[0], SImode)"
14569 [(parallel [(set (match_dup 3)
14570 (compare:CC (plus:P (match_dup 1)
14574 (plus:P (match_dup 1)
14578 (set (pc) (if_then_else (match_dup 7)
14582 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
14583 operands[3], const0_rtx); }")
14585 (define_insn "trap"
14586 [(trap_if (const_int 1) (const_int 0))]
14589 [(set_attr "type" "trap")])
14591 (define_expand "ctrap<mode>4"
14592 [(trap_if (match_operator 0 "ordered_comparison_operator"
14593 [(match_operand:GPR 1 "register_operand")
14594 (match_operand:GPR 2 "reg_or_short_operand")])
14595 (match_operand 3 "zero_constant" ""))]
14600 [(trap_if (match_operator 0 "ordered_comparison_operator"
14601 [(match_operand:GPR 1 "register_operand" "r")
14602 (match_operand:GPR 2 "reg_or_short_operand" "rI")])
14605 "t<wd>%V0%I2 %1,%2"
14606 [(set_attr "type" "trap")])
14608 ;; Insns related to generating the function prologue and epilogue.
14610 (define_expand "prologue"
14611 [(use (const_int 0))]
14614 rs6000_emit_prologue ();
14615 if (!TARGET_SCHED_PROLOG)
14616 emit_insn (gen_blockage ());
14620 (define_insn "*movesi_from_cr_one"
14621 [(match_parallel 0 "mfcr_operation"
14622 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
14623 (unspec:SI [(match_operand:CC 2 "cc_reg_operand" "y")
14624 (match_operand 3 "immediate_operand" "n")]
14625 UNSPEC_MOVESI_FROM_CR))])]
14631 for (i = 0; i < XVECLEN (operands[0], 0); i++)
14633 mask = INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
14634 operands[4] = GEN_INT (mask);
14635 output_asm_insn (\"mfcr %1,%4\", operands);
14639 [(set_attr "type" "mfcrf")])
14641 (define_insn "movesi_from_cr"
14642 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14643 (unspec:SI [(reg:CC CR0_REGNO) (reg:CC CR1_REGNO)
14644 (reg:CC CR2_REGNO) (reg:CC CR3_REGNO)
14645 (reg:CC CR4_REGNO) (reg:CC CR5_REGNO)
14646 (reg:CC CR6_REGNO) (reg:CC CR7_REGNO)]
14647 UNSPEC_MOVESI_FROM_CR))]
14650 [(set_attr "type" "mfcr")])
14652 (define_insn "*crsave"
14653 [(match_parallel 0 "crsave_operation"
14654 [(set (match_operand:SI 1 "memory_operand" "=m")
14655 (match_operand:SI 2 "gpc_reg_operand" "r"))])]
14658 [(set_attr "type" "store")])
14660 (define_insn "*stmw"
14661 [(match_parallel 0 "stmw_operation"
14662 [(set (match_operand:SI 1 "memory_operand" "=m")
14663 (match_operand:SI 2 "gpc_reg_operand" "r"))])]
14666 [(set_attr "type" "store")
14667 (set_attr "update" "yes")
14668 (set_attr "indexed" "yes")])
14670 ; The following comment applies to:
14674 ; return_and_restore_gpregs*
14675 ; return_and_restore_fpregs*
14676 ; return_and_restore_fpregs_aix*
14678 ; The out-of-line save / restore functions expects one input argument.
14679 ; Since those are not standard call_insn's, we must avoid using
14680 ; MATCH_OPERAND for that argument. That way the register rename
14681 ; optimization will not try to rename this register.
14682 ; Each pattern is repeated for each possible register number used in
14683 ; various ABIs (r11, r1, and for some functions r12)
14685 (define_insn "*save_gpregs_<mode>_r11"
14686 [(match_parallel 0 "any_parallel_operand"
14687 [(clobber (reg:P 65))
14688 (use (match_operand:P 1 "symbol_ref_operand" "s"))
14690 (set (match_operand:P 2 "memory_operand" "=m")
14691 (match_operand:P 3 "gpc_reg_operand" "r"))])]
14694 [(set_attr "type" "branch")
14695 (set_attr "length" "4")])
14697 (define_insn "*save_gpregs_<mode>_r12"
14698 [(match_parallel 0 "any_parallel_operand"
14699 [(clobber (reg:P 65))
14700 (use (match_operand:P 1 "symbol_ref_operand" "s"))
14702 (set (match_operand:P 2 "memory_operand" "=m")
14703 (match_operand:P 3 "gpc_reg_operand" "r"))])]
14706 [(set_attr "type" "branch")
14707 (set_attr "length" "4")])
14709 (define_insn "*save_gpregs_<mode>_r1"
14710 [(match_parallel 0 "any_parallel_operand"
14711 [(clobber (reg:P 65))
14712 (use (match_operand:P 1 "symbol_ref_operand" "s"))
14714 (set (match_operand:P 2 "memory_operand" "=m")
14715 (match_operand:P 3 "gpc_reg_operand" "r"))])]
14718 [(set_attr "type" "branch")
14719 (set_attr "length" "4")])
14721 (define_insn "*save_fpregs_<mode>_r11"
14722 [(match_parallel 0 "any_parallel_operand"
14723 [(clobber (reg:P 65))
14724 (use (match_operand:P 1 "symbol_ref_operand" "s"))
14726 (set (match_operand:DF 2 "memory_operand" "=m")
14727 (match_operand:DF 3 "gpc_reg_operand" "d"))])]
14730 [(set_attr "type" "branch")
14731 (set_attr "length" "4")])
14733 (define_insn "*save_fpregs_<mode>_r12"
14734 [(match_parallel 0 "any_parallel_operand"
14735 [(clobber (reg:P 65))
14736 (use (match_operand:P 1 "symbol_ref_operand" "s"))
14738 (set (match_operand:DF 2 "memory_operand" "=m")
14739 (match_operand:DF 3 "gpc_reg_operand" "d"))])]
14742 [(set_attr "type" "branch")
14743 (set_attr "length" "4")])
14745 (define_insn "*save_fpregs_<mode>_r1"
14746 [(match_parallel 0 "any_parallel_operand"
14747 [(clobber (reg:P 65))
14748 (use (match_operand:P 1 "symbol_ref_operand" "s"))
14750 (set (match_operand:DF 2 "memory_operand" "=m")
14751 (match_operand:DF 3 "gpc_reg_operand" "d"))])]
14754 [(set_attr "type" "branch")
14755 (set_attr "length" "4")])
14757 ; This is to explain that changes to the stack pointer should
14758 ; not be moved over loads from or stores to stack memory.
14759 (define_insn "stack_tie"
14760 [(match_parallel 0 "tie_operand"
14761 [(set (mem:BLK (reg 1)) (const_int 0))])]
14764 [(set_attr "length" "0")])
14766 (define_expand "epilogue"
14767 [(use (const_int 0))]
14770 if (!TARGET_SCHED_PROLOG)
14771 emit_insn (gen_blockage ());
14772 rs6000_emit_epilogue (FALSE);
14776 ; On some processors, doing the mtcrf one CC register at a time is
14777 ; faster (like on the 604e). On others, doing them all at once is
14778 ; faster; for instance, on the 601 and 750.
14780 (define_expand "movsi_to_cr_one"
14781 [(set (match_operand:CC 0 "cc_reg_operand" "")
14782 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "")
14783 (match_dup 2)] UNSPEC_MOVESI_TO_CR))]
14785 "operands[2] = GEN_INT (1 << (75 - REGNO (operands[0])));")
14787 (define_insn "*movsi_to_cr"
14788 [(match_parallel 0 "mtcrf_operation"
14789 [(set (match_operand:CC 1 "cc_reg_operand" "=y")
14790 (unspec:CC [(match_operand:SI 2 "gpc_reg_operand" "r")
14791 (match_operand 3 "immediate_operand" "n")]
14792 UNSPEC_MOVESI_TO_CR))])]
14798 for (i = 0; i < XVECLEN (operands[0], 0); i++)
14799 mask |= INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
14800 operands[4] = GEN_INT (mask);
14801 return \"mtcrf %4,%2\";
14803 [(set_attr "type" "mtcr")])
14805 (define_insn "*mtcrfsi"
14806 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
14807 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
14808 (match_operand 2 "immediate_operand" "n")]
14809 UNSPEC_MOVESI_TO_CR))]
14810 "GET_CODE (operands[0]) == REG
14811 && CR_REGNO_P (REGNO (operands[0]))
14812 && GET_CODE (operands[2]) == CONST_INT
14813 && INTVAL (operands[2]) == 1 << (75 - REGNO (operands[0]))"
14815 [(set_attr "type" "mtcr")])
14817 ; The load-multiple instructions have similar properties.
14818 ; Note that "load_multiple" is a name known to the machine-independent
14819 ; code that actually corresponds to the PowerPC load-string.
14821 (define_insn "*lmw"
14822 [(match_parallel 0 "lmw_operation"
14823 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
14824 (match_operand:SI 2 "memory_operand" "m"))])]
14827 [(set_attr "type" "load")
14828 (set_attr "update" "yes")
14829 (set_attr "indexed" "yes")
14830 (set_attr "cell_micro" "always")])
14832 (define_insn "*return_internal_<mode>"
14834 (use (match_operand:P 0 "register_operand" "lc"))]
14837 [(set_attr "type" "jmpreg")])
14839 ; FIXME: This would probably be somewhat simpler if the Cygnus sibcall
14840 ; stuff was in GCC. Oh, and "any_parallel_operand" is a bit flexible...
14842 ; The following comment applies to:
14846 ; return_and_restore_gpregs*
14847 ; return_and_restore_fpregs*
14848 ; return_and_restore_fpregs_aix*
14850 ; The out-of-line save / restore functions expects one input argument.
14851 ; Since those are not standard call_insn's, we must avoid using
14852 ; MATCH_OPERAND for that argument. That way the register rename
14853 ; optimization will not try to rename this register.
14854 ; Each pattern is repeated for each possible register number used in
14855 ; various ABIs (r11, r1, and for some functions r12)
14857 (define_insn "*restore_gpregs_<mode>_r11"
14858 [(match_parallel 0 "any_parallel_operand"
14859 [(clobber (match_operand:P 1 "register_operand" "=l"))
14860 (use (match_operand:P 2 "symbol_ref_operand" "s"))
14862 (set (match_operand:P 3 "gpc_reg_operand" "=r")
14863 (match_operand:P 4 "memory_operand" "m"))])]
14866 [(set_attr "type" "branch")
14867 (set_attr "length" "4")])
14869 (define_insn "*restore_gpregs_<mode>_r12"
14870 [(match_parallel 0 "any_parallel_operand"
14871 [(clobber (match_operand:P 1 "register_operand" "=l"))
14872 (use (match_operand:P 2 "symbol_ref_operand" "s"))
14874 (set (match_operand:P 3 "gpc_reg_operand" "=r")
14875 (match_operand:P 4 "memory_operand" "m"))])]
14878 [(set_attr "type" "branch")
14879 (set_attr "length" "4")])
14881 (define_insn "*restore_gpregs_<mode>_r1"
14882 [(match_parallel 0 "any_parallel_operand"
14883 [(clobber (match_operand:P 1 "register_operand" "=l"))
14884 (use (match_operand:P 2 "symbol_ref_operand" "s"))
14886 (set (match_operand:P 3 "gpc_reg_operand" "=r")
14887 (match_operand:P 4 "memory_operand" "m"))])]
14890 [(set_attr "type" "branch")
14891 (set_attr "length" "4")])
14893 (define_insn "*return_and_restore_gpregs_<mode>_r11"
14894 [(match_parallel 0 "any_parallel_operand"
14896 (clobber (match_operand:P 1 "register_operand" "=l"))
14897 (use (match_operand:P 2 "symbol_ref_operand" "s"))
14899 (set (match_operand:P 3 "gpc_reg_operand" "=r")
14900 (match_operand:P 4 "memory_operand" "m"))])]
14903 [(set_attr "type" "branch")
14904 (set_attr "length" "4")])
14906 (define_insn "*return_and_restore_gpregs_<mode>_r12"
14907 [(match_parallel 0 "any_parallel_operand"
14909 (clobber (match_operand:P 1 "register_operand" "=l"))
14910 (use (match_operand:P 2 "symbol_ref_operand" "s"))
14912 (set (match_operand:P 3 "gpc_reg_operand" "=r")
14913 (match_operand:P 4 "memory_operand" "m"))])]
14916 [(set_attr "type" "branch")
14917 (set_attr "length" "4")])
14919 (define_insn "*return_and_restore_gpregs_<mode>_r1"
14920 [(match_parallel 0 "any_parallel_operand"
14922 (clobber (match_operand:P 1 "register_operand" "=l"))
14923 (use (match_operand:P 2 "symbol_ref_operand" "s"))
14925 (set (match_operand:P 3 "gpc_reg_operand" "=r")
14926 (match_operand:P 4 "memory_operand" "m"))])]
14929 [(set_attr "type" "branch")
14930 (set_attr "length" "4")])
14932 (define_insn "*return_and_restore_fpregs_<mode>_r11"
14933 [(match_parallel 0 "any_parallel_operand"
14935 (clobber (match_operand:P 1 "register_operand" "=l"))
14936 (use (match_operand:P 2 "symbol_ref_operand" "s"))
14938 (set (match_operand:DF 3 "gpc_reg_operand" "=d")
14939 (match_operand:DF 4 "memory_operand" "m"))])]
14942 [(set_attr "type" "branch")
14943 (set_attr "length" "4")])
14945 (define_insn "*return_and_restore_fpregs_<mode>_r12"
14946 [(match_parallel 0 "any_parallel_operand"
14948 (clobber (match_operand:P 1 "register_operand" "=l"))
14949 (use (match_operand:P 2 "symbol_ref_operand" "s"))
14951 (set (match_operand:DF 3 "gpc_reg_operand" "=d")
14952 (match_operand:DF 4 "memory_operand" "m"))])]
14955 [(set_attr "type" "branch")
14956 (set_attr "length" "4")])
14958 (define_insn "*return_and_restore_fpregs_<mode>_r1"
14959 [(match_parallel 0 "any_parallel_operand"
14961 (clobber (match_operand:P 1 "register_operand" "=l"))
14962 (use (match_operand:P 2 "symbol_ref_operand" "s"))
14964 (set (match_operand:DF 3 "gpc_reg_operand" "=d")
14965 (match_operand:DF 4 "memory_operand" "m"))])]
14968 [(set_attr "type" "branch")
14969 (set_attr "length" "4")])
14971 (define_insn "*return_and_restore_fpregs_aix_<mode>_r11"
14972 [(match_parallel 0 "any_parallel_operand"
14974 (use (match_operand:P 1 "register_operand" "l"))
14975 (use (match_operand:P 2 "symbol_ref_operand" "s"))
14977 (set (match_operand:DF 3 "gpc_reg_operand" "=d")
14978 (match_operand:DF 4 "memory_operand" "m"))])]
14981 [(set_attr "type" "branch")
14982 (set_attr "length" "4")])
14984 (define_insn "*return_and_restore_fpregs_aix_<mode>_r1"
14985 [(match_parallel 0 "any_parallel_operand"
14987 (use (match_operand:P 1 "register_operand" "l"))
14988 (use (match_operand:P 2 "symbol_ref_operand" "s"))
14990 (set (match_operand:DF 3 "gpc_reg_operand" "=d")
14991 (match_operand:DF 4 "memory_operand" "m"))])]
14994 [(set_attr "type" "branch")
14995 (set_attr "length" "4")])
14997 ; This is used in compiling the unwind routines.
14998 (define_expand "eh_return"
14999 [(use (match_operand 0 "general_operand" ""))]
15004 emit_insn (gen_eh_set_lr_si (operands[0]));
15006 emit_insn (gen_eh_set_lr_di (operands[0]));
15010 ; We can't expand this before we know where the link register is stored.
15011 (define_insn "eh_set_lr_<mode>"
15012 [(unspec_volatile [(match_operand:P 0 "register_operand" "r")]
15014 (clobber (match_scratch:P 1 "=&b"))]
15019 [(unspec_volatile [(match_operand 0 "register_operand" "")] UNSPECV_EH_RR)
15020 (clobber (match_scratch 1 ""))]
15025 rs6000_emit_eh_reg_restore (operands[0], operands[1]);
15029 (define_insn "prefetch"
15030 [(prefetch (match_operand 0 "indexed_or_indirect_address" "a")
15031 (match_operand:SI 1 "const_int_operand" "n")
15032 (match_operand:SI 2 "const_int_operand" "n"))]
15036 if (GET_CODE (operands[0]) == REG)
15037 return INTVAL (operands[1]) ? \"dcbtst 0,%0\" : \"dcbt 0,%0\";
15038 return INTVAL (operands[1]) ? \"dcbtst %a0\" : \"dcbt %a0\";
15040 [(set_attr "type" "load")])
15042 (define_insn "bpermd_<mode>"
15043 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
15044 (unspec:P [(match_operand:P 1 "gpc_reg_operand" "r")
15045 (match_operand:P 2 "gpc_reg_operand" "r")] UNSPEC_BPERM))]
15048 [(set_attr "type" "popcnt")])
15051 ;; Builtin fma support. Handle
15052 ;; Note that the conditions for expansion are in the FMA_F iterator.
15054 (define_expand "fma<mode>4"
15055 [(set (match_operand:FMA_F 0 "register_operand" "")
15057 (match_operand:FMA_F 1 "register_operand" "")
15058 (match_operand:FMA_F 2 "register_operand" "")
15059 (match_operand:FMA_F 3 "register_operand" "")))]
15063 (define_insn "*fma<mode>4_fpr"
15064 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>,<Fv>")
15066 (match_operand:SFDF 1 "gpc_reg_operand" "%<Ff>,<Fv>,<Fv>")
15067 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>,0")
15068 (match_operand:SFDF 3 "gpc_reg_operand" "<Ff>,0,<Fv>")))]
15069 "TARGET_<MODE>_FPR"
15071 fmadd<Ftrad> %0,%1,%2,%3
15072 xsmadda<Fvsx> %x0,%x1,%x2
15073 xsmaddm<Fvsx> %x0,%x1,%x3"
15074 [(set_attr "type" "fp")
15075 (set_attr "fp_type" "fp_maddsub_<Fs>")])
15077 ; Altivec only has fma and nfms.
15078 (define_expand "fms<mode>4"
15079 [(set (match_operand:FMA_F 0 "register_operand" "")
15081 (match_operand:FMA_F 1 "register_operand" "")
15082 (match_operand:FMA_F 2 "register_operand" "")
15083 (neg:FMA_F (match_operand:FMA_F 3 "register_operand" ""))))]
15084 "!VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
15087 (define_insn "*fms<mode>4_fpr"
15088 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>,<Fv>")
15090 (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>,<Fv>")
15091 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>,0")
15092 (neg:SFDF (match_operand:SFDF 3 "gpc_reg_operand" "<Ff>,0,<Fv>"))))]
15093 "TARGET_<MODE>_FPR"
15095 fmsub<Ftrad> %0,%1,%2,%3
15096 xsmsuba<Fvsx> %x0,%x1,%x2
15097 xsmsubm<Fvsx> %x0,%x1,%x3"
15098 [(set_attr "type" "fp")
15099 (set_attr "fp_type" "fp_maddsub_<Fs>")])
15101 ;; If signed zeros are ignored, -(a * b - c) = -a * b + c.
15102 (define_expand "fnma<mode>4"
15103 [(set (match_operand:FMA_F 0 "register_operand" "")
15106 (match_operand:FMA_F 1 "register_operand" "")
15107 (match_operand:FMA_F 2 "register_operand" "")
15108 (neg:FMA_F (match_operand:FMA_F 3 "register_operand" "")))))]
15109 "!HONOR_SIGNED_ZEROS (<MODE>mode)"
15112 ;; If signed zeros are ignored, -(a * b + c) = -a * b - c.
15113 (define_expand "fnms<mode>4"
15114 [(set (match_operand:FMA_F 0 "register_operand" "")
15117 (match_operand:FMA_F 1 "register_operand" "")
15118 (match_operand:FMA_F 2 "register_operand" "")
15119 (match_operand:FMA_F 3 "register_operand" ""))))]
15120 "!HONOR_SIGNED_ZEROS (<MODE>mode) && !VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
15123 ; Not an official optab name, but used from builtins.
15124 (define_expand "nfma<mode>4"
15125 [(set (match_operand:FMA_F 0 "register_operand" "")
15128 (match_operand:FMA_F 1 "register_operand" "")
15129 (match_operand:FMA_F 2 "register_operand" "")
15130 (match_operand:FMA_F 3 "register_operand" ""))))]
15131 "!VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
15134 (define_insn "*nfma<mode>4_fpr"
15135 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>,<Fv>")
15138 (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>,<Fv>")
15139 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>,0")
15140 (match_operand:SFDF 3 "gpc_reg_operand" "<Ff>,0,<Fv>"))))]
15141 "TARGET_<MODE>_FPR"
15143 fnmadd<Ftrad> %0,%1,%2,%3
15144 xsnmadda<Fvsx> %x0,%x1,%x2
15145 xsnmaddm<Fvsx> %x0,%x1,%x3"
15146 [(set_attr "type" "fp")
15147 (set_attr "fp_type" "fp_maddsub_<Fs>")])
15149 ; Not an official optab name, but used from builtins.
15150 (define_expand "nfms<mode>4"
15151 [(set (match_operand:FMA_F 0 "register_operand" "")
15154 (match_operand:FMA_F 1 "register_operand" "")
15155 (match_operand:FMA_F 2 "register_operand" "")
15156 (neg:FMA_F (match_operand:FMA_F 3 "register_operand" "")))))]
15160 (define_insn "*nfmssf4_fpr"
15161 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>,<Fv>")
15164 (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>,<Fv>")
15165 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>,0")
15167 (match_operand:SFDF 3 "gpc_reg_operand" "<Ff>,0,<Fv>")))))]
15168 "TARGET_<MODE>_FPR"
15170 fnmsub<Ftrad> %0,%1,%2,%3
15171 xsnmsuba<Fvsx> %x0,%x1,%x2
15172 xsnmsubm<Fvsx> %x0,%x1,%x3"
15173 [(set_attr "type" "fp")
15174 (set_attr "fp_type" "fp_maddsub_<Fs>")])
15177 (define_expand "rs6000_get_timebase"
15178 [(use (match_operand:DI 0 "gpc_reg_operand" ""))]
15181 if (TARGET_POWERPC64)
15182 emit_insn (gen_rs6000_mftb_di (operands[0]));
15184 emit_insn (gen_rs6000_get_timebase_ppc32 (operands[0]));
15188 (define_insn "rs6000_get_timebase_ppc32"
15189 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
15190 (unspec_volatile:DI [(const_int 0)] UNSPECV_MFTB))
15191 (clobber (match_scratch:SI 1 "=r"))
15192 (clobber (match_scratch:CC 2 "=y"))]
15193 "!TARGET_POWERPC64"
15195 if (WORDS_BIG_ENDIAN)
15198 return "mfspr %0,269\;"
15206 return "mftbu %0\;"
15215 return "mfspr %L0,269\;"
15223 return "mftbu %L0\;"
15230 [(set_attr "length" "20")])
15232 (define_insn "rs6000_mftb_<mode>"
15233 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
15234 (unspec_volatile:P [(const_int 0)] UNSPECV_MFTB))]
15238 return "mfspr %0,268";
15244 (define_insn "rs6000_mffs"
15245 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
15246 (unspec_volatile:DF [(const_int 0)] UNSPECV_MFFS))]
15247 "TARGET_HARD_FLOAT && TARGET_FPRS"
15250 (define_insn "rs6000_mtfsf"
15251 [(unspec_volatile [(match_operand:SI 0 "const_int_operand" "i")
15252 (match_operand:DF 1 "gpc_reg_operand" "d")]
15254 "TARGET_HARD_FLOAT && TARGET_FPRS"
15258 ;; Power8 fusion support for fusing an addis instruction with a D-form load of
15259 ;; a GPR. The addis instruction must be adjacent to the load, and use the same
15260 ;; register that is being loaded. The fused ops must be physically adjacent.
15262 ;; We use define_peephole for the actual addis/load, and the register used to
15263 ;; hold the addis value must be the same as the register being loaded. We use
15264 ;; define_peephole2 to change the register used for addis to be the register
15265 ;; being loaded, since we can look at whether it is dead after the load insn.
15268 [(set (match_operand:P 0 "base_reg_operand" "")
15269 (match_operand:P 1 "fusion_gpr_addis" ""))
15270 (set (match_operand:INT1 2 "base_reg_operand" "")
15271 (match_operand:INT1 3 "fusion_gpr_mem_load" ""))]
15272 "TARGET_P8_FUSION && fusion_gpr_load_p (operands, false)"
15274 return emit_fusion_gpr_load (operands);
15276 [(set_attr "type" "load")
15277 (set_attr "length" "8")])
15280 [(set (match_operand:P 0 "base_reg_operand" "")
15281 (match_operand:P 1 "fusion_gpr_addis" ""))
15282 (set (match_operand:INT1 2 "base_reg_operand" "")
15283 (match_operand:INT1 3 "fusion_gpr_mem_load" ""))]
15285 && (REGNO (operands[0]) != REGNO (operands[2])
15286 || GET_CODE (operands[3]) == SIGN_EXTEND)
15287 && fusion_gpr_load_p (operands, true)"
15290 expand_fusion_gpr_load (operands);
15295 ;; Miscellaneous ISA 2.06 (power7) instructions
15296 (define_insn "addg6s"
15297 [(set (match_operand:SI 0 "register_operand" "=r")
15298 (unspec:SI [(match_operand:SI 1 "register_operand" "r")
15299 (match_operand:SI 2 "register_operand" "r")]
15303 [(set_attr "type" "integer")
15304 (set_attr "length" "4")])
15306 (define_insn "cdtbcd"
15307 [(set (match_operand:SI 0 "register_operand" "=r")
15308 (unspec:SI [(match_operand:SI 1 "register_operand" "r")]
15312 [(set_attr "type" "integer")
15313 (set_attr "length" "4")])
15315 (define_insn "cbcdtd"
15316 [(set (match_operand:SI 0 "register_operand" "=r")
15317 (unspec:SI [(match_operand:SI 1 "register_operand" "r")]
15321 [(set_attr "type" "integer")
15322 (set_attr "length" "4")])
15324 (define_int_iterator UNSPEC_DIV_EXTEND [UNSPEC_DIVE
15329 (define_int_attr div_extend [(UNSPEC_DIVE "e")
15330 (UNSPEC_DIVEO "eo")
15331 (UNSPEC_DIVEU "eu")
15332 (UNSPEC_DIVEUO "euo")])
15334 (define_insn "div<div_extend>_<mode>"
15335 [(set (match_operand:GPR 0 "register_operand" "=r")
15336 (unspec:GPR [(match_operand:GPR 1 "register_operand" "r")
15337 (match_operand:GPR 2 "register_operand" "r")]
15338 UNSPEC_DIV_EXTEND))]
15340 "div<wd><div_extend> %0,%1,%2"
15341 [(set_attr "type" "div")
15342 (set_attr "size" "<bits>")])
15345 ;; Pack/unpack 128-bit floating point types that take 2 scalar registers
15347 ; Type of the 64-bit part when packing/unpacking 128-bit floating point types
15348 (define_mode_attr FP128_64 [(TF "DF") (TD "DI")])
15350 (define_expand "unpack<mode>"
15351 [(set (match_operand:<FP128_64> 0 "nonimmediate_operand" "")
15353 [(match_operand:FMOVE128 1 "register_operand" "")
15354 (match_operand:QI 2 "const_0_to_1_operand" "")]
15355 UNSPEC_UNPACK_128BIT))]
15359 (define_insn_and_split "unpack<mode>_dm"
15360 [(set (match_operand:<FP128_64> 0 "nonimmediate_operand" "=d,m,d,r,m")
15362 [(match_operand:FMOVE128 1 "register_operand" "d,d,r,d,r")
15363 (match_operand:QI 2 "const_0_to_1_operand" "i,i,i,i,i")]
15364 UNSPEC_UNPACK_128BIT))]
15365 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
15367 "&& reload_completed"
15368 [(set (match_dup 0) (match_dup 3))]
15370 unsigned fp_regno = REGNO (operands[1]) + UINTVAL (operands[2]);
15372 if (REG_P (operands[0]) && REGNO (operands[0]) == fp_regno)
15374 emit_note (NOTE_INSN_DELETED);
15378 operands[3] = gen_rtx_REG (<FP128_64>mode, fp_regno);
15380 [(set_attr "type" "fp,fpstore,mffgpr,mftgpr,store")
15381 (set_attr "length" "4")])
15383 (define_insn_and_split "unpack<mode>_nodm"
15384 [(set (match_operand:<FP128_64> 0 "nonimmediate_operand" "=d,m")
15386 [(match_operand:FMOVE128 1 "register_operand" "d,d")
15387 (match_operand:QI 2 "const_0_to_1_operand" "i,i")]
15388 UNSPEC_UNPACK_128BIT))]
15389 "!TARGET_POWERPC64 || !TARGET_DIRECT_MOVE"
15391 "&& reload_completed"
15392 [(set (match_dup 0) (match_dup 3))]
15394 unsigned fp_regno = REGNO (operands[1]) + UINTVAL (operands[2]);
15396 if (REG_P (operands[0]) && REGNO (operands[0]) == fp_regno)
15398 emit_note (NOTE_INSN_DELETED);
15402 operands[3] = gen_rtx_REG (<FP128_64>mode, fp_regno);
15404 [(set_attr "type" "fp,fpstore")
15405 (set_attr "length" "4")])
15407 (define_insn_and_split "pack<mode>"
15408 [(set (match_operand:FMOVE128 0 "register_operand" "=d,&d")
15410 [(match_operand:<FP128_64> 1 "register_operand" "0,d")
15411 (match_operand:<FP128_64> 2 "register_operand" "d,d")]
15412 UNSPEC_PACK_128BIT))]
15417 "&& reload_completed && REGNO (operands[0]) != REGNO (operands[1])"
15418 [(set (match_dup 3) (match_dup 1))
15419 (set (match_dup 4) (match_dup 2))]
15421 unsigned dest_hi = REGNO (operands[0]);
15422 unsigned dest_lo = dest_hi + 1;
15424 gcc_assert (!IN_RANGE (REGNO (operands[1]), dest_hi, dest_lo));
15425 gcc_assert (!IN_RANGE (REGNO (operands[2]), dest_hi, dest_lo));
15427 operands[3] = gen_rtx_REG (<FP128_64>mode, dest_hi);
15428 operands[4] = gen_rtx_REG (<FP128_64>mode, dest_lo);
15430 [(set_attr "type" "fp,fp")
15431 (set_attr "length" "4,8")])
15433 (define_insn "unpackv1ti"
15434 [(set (match_operand:DI 0 "register_operand" "=d,d")
15435 (unspec:DI [(match_operand:V1TI 1 "register_operand" "0,wa")
15436 (match_operand:QI 2 "const_0_to_1_operand" "O,i")]
15437 UNSPEC_UNPACK_128BIT))]
15440 if (REGNO (operands[0]) == REGNO (operands[1]) && INTVAL (operands[2]) == 0)
15441 return ASM_COMMENT_START " xxpermdi to same register";
15443 operands[3] = GEN_INT (INTVAL (operands[2]) == 0 ? 0 : 3);
15444 return "xxpermdi %x0,%x1,%x1,%3";
15446 [(set_attr "type" "vecperm")
15447 (set_attr "length" "4")])
15449 (define_insn "packv1ti"
15450 [(set (match_operand:V1TI 0 "register_operand" "=wa")
15452 [(match_operand:DI 1 "register_operand" "d")
15453 (match_operand:DI 2 "register_operand" "d")]
15454 UNSPEC_PACK_128BIT))]
15456 "xxpermdi %x0,%x1,%x2,0"
15457 [(set_attr "type" "vecperm")
15458 (set_attr "length" "4")])
15462 (include "sync.md")
15463 (include "vector.md")
15465 (include "altivec.md")
15468 (include "paired.md")
15469 (include "crypto.md")