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
164 exts,cntlz,popcnt,isel,
165 load,store,fpload,fpstore,vecload,vecstore,
167 branch,jmpreg,mfjmpr,mtjmpr,trap,isync,sync,load_l,store_c,
168 compare,fast_compare,
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 mul.
183 (define_attr "dot" "no,yes" (const_string "no"))
185 ;; Does this instruction sign-extend its result?
186 ;; This is used for load insns.
187 (define_attr "sign_extend" "no,yes" (const_string "no"))
189 ;; Does this instruction use indexed (that is, reg+reg) addressing?
190 ;; This is used for load and store insns. If operand 0 or 1 is a MEM
191 ;; it is automatically set based on that. If a load or store instruction
192 ;; has fewer than two operands it needs to set this attribute manually
193 ;; or the compiler will crash.
194 (define_attr "indexed" "no,yes"
195 (if_then_else (ior (match_operand 0 "indexed_address_mem")
196 (match_operand 1 "indexed_address_mem"))
198 (const_string "no")))
200 ;; Does this instruction use update addressing?
201 ;; This is used for load and store insns. See the comments for "indexed".
202 (define_attr "update" "no,yes"
203 (if_then_else (ior (match_operand 0 "update_address_mem")
204 (match_operand 1 "update_address_mem"))
206 (const_string "no")))
208 ;; Is this instruction using a shift amount from a register?
209 ;; This is used for shift insns.
210 (define_attr "var_shift" "no,yes" (const_string "no"))
212 ;; Define floating point instruction sub-types for use with Xfpu.md
213 (define_attr "fp_type" "fp_default,fp_addsub_s,fp_addsub_d,fp_mul_s,fp_mul_d,fp_div_s,fp_div_d,fp_maddsub_s,fp_maddsub_d,fp_sqrt_s,fp_sqrt_d" (const_string "fp_default"))
215 ;; Length (in bytes).
216 ; '(pc)' in the following doesn't include the instruction itself; it is
217 ; calculated as if the instruction had zero size.
218 (define_attr "length" ""
219 (if_then_else (eq_attr "type" "branch")
220 (if_then_else (and (ge (minus (match_dup 0) (pc))
222 (lt (minus (match_dup 0) (pc))
228 ;; Processor type -- this attribute must exactly match the processor_type
229 ;; enumeration in rs6000-opts.h.
231 "ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630,
232 ppc750,ppc7400,ppc7450,
233 ppc403,ppc405,ppc440,ppc476,
234 ppc8540,ppc8548,ppce300c2,ppce300c3,ppce500mc,ppce500mc64,ppce5500,ppce6500,
235 power4,power5,power6,power7,power8,
236 rs64a,mpccore,cell,ppca2,titan"
237 (const (symbol_ref "rs6000_cpu_attr")))
240 ;; If this instruction is microcoded on the CELL processor
241 ; The default for load extended, the recorded instructions and rotate/shifts by a variable is always microcoded
242 (define_attr "cell_micro" "not,conditional,always"
243 (if_then_else (ior (eq_attr "type" "compare")
244 (and (eq_attr "type" "shift,mul")
245 (eq_attr "dot" "yes"))
246 (and (eq_attr "type" "load")
247 (eq_attr "sign_extend" "yes"))
248 (and (eq_attr "type" "shift")
249 (eq_attr "var_shift" "yes")))
250 (const_string "always")
251 (const_string "not")))
253 (automata_option "ndfa")
266 (include "e300c2c3.md")
267 (include "e500mc.md")
268 (include "e500mc64.md")
271 (include "power4.md")
272 (include "power5.md")
273 (include "power6.md")
274 (include "power7.md")
275 (include "power8.md")
281 (include "predicates.md")
282 (include "constraints.md")
284 (include "darwin.md")
289 ; This mode iterator allows :GPR to be used to indicate the allowable size
290 ; of whole values in GPRs.
291 (define_mode_iterator GPR [SI (DI "TARGET_POWERPC64")])
293 ; Any supported integer mode.
294 (define_mode_iterator INT [QI HI SI DI TI PTI])
296 ; Any supported integer mode that fits in one register.
297 (define_mode_iterator INT1 [QI HI SI (DI "TARGET_POWERPC64")])
299 ; extend modes for DImode
300 (define_mode_iterator QHSI [QI HI SI])
302 ; QImode or HImode for small atomic ops
303 (define_mode_iterator QHI [QI HI])
305 ; HImode or SImode for sign extended fusion ops
306 (define_mode_iterator HSI [HI SI])
308 ; SImode or DImode, even if DImode doesn't fit in GPRs.
309 (define_mode_iterator SDI [SI DI])
311 ; The size of a pointer. Also, the size of the value that a record-condition
312 ; (one with a '.') will compare; and the size used for arithmetic carries.
313 (define_mode_iterator P [(SI "TARGET_32BIT") (DI "TARGET_64BIT")])
315 ; Iterator to add PTImode along with TImode (TImode can go in VSX registers,
316 ; PTImode is GPR only)
317 (define_mode_iterator TI2 [TI PTI])
319 ; Any hardware-supported floating-point mode
320 (define_mode_iterator FP [
321 (SF "TARGET_HARD_FLOAT
322 && ((TARGET_FPRS && TARGET_SINGLE_FLOAT) || TARGET_E500_SINGLE)")
323 (DF "TARGET_HARD_FLOAT
324 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)")
325 (TF "!TARGET_IEEEQUAD
327 && (TARGET_FPRS || TARGET_E500_DOUBLE)
328 && TARGET_LONG_DOUBLE_128")
332 ; Any fma capable floating-point mode.
333 (define_mode_iterator FMA_F [
334 (SF "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT")
335 (DF "(TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT)
336 || VECTOR_UNIT_VSX_P (DFmode)")
337 (V2SF "TARGET_PAIRED_FLOAT")
338 (V4SF "VECTOR_UNIT_ALTIVEC_OR_VSX_P (V4SFmode)")
339 (V2DF "VECTOR_UNIT_ALTIVEC_OR_VSX_P (V2DFmode)")
342 ; Floating point move iterators to combine binary and decimal moves
343 (define_mode_iterator FMOVE32 [SF SD])
344 (define_mode_iterator FMOVE64 [DF DD])
345 (define_mode_iterator FMOVE64X [DI DF DD])
346 (define_mode_iterator FMOVE128 [(TF "!TARGET_IEEEQUAD && TARGET_LONG_DOUBLE_128")
347 (TD "TARGET_HARD_FLOAT && TARGET_FPRS")])
349 ; Iterators for 128 bit types for direct move
350 (define_mode_iterator FMOVE128_GPR [(TI "TARGET_VSX_TIMODE")
359 ; Whether a floating point move is ok, don't allow SD without hardware FP
360 (define_mode_attr fmove_ok [(SF "")
362 (SD "TARGET_HARD_FLOAT && TARGET_FPRS")
365 ; Convert REAL_VALUE to the appropriate bits
366 (define_mode_attr real_value_to_target [(SF "REAL_VALUE_TO_TARGET_SINGLE")
367 (DF "REAL_VALUE_TO_TARGET_DOUBLE")
368 (SD "REAL_VALUE_TO_TARGET_DECIMAL32")
369 (DD "REAL_VALUE_TO_TARGET_DECIMAL64")])
371 ; Definitions for load to 32-bit fpr register
372 (define_mode_attr f32_lr [(SF "f") (SD "wz")])
373 (define_mode_attr f32_lm [(SF "m") (SD "Z")])
374 (define_mode_attr f32_li [(SF "lfs%U1%X1 %0,%1") (SD "lfiwzx %0,%y1")])
375 (define_mode_attr f32_lv [(SF "lxsspx %x0,%y1") (SD "lxsiwzx %x0,%y1")])
377 ; Definitions for store from 32-bit fpr register
378 (define_mode_attr f32_sr [(SF "f") (SD "wx")])
379 (define_mode_attr f32_sm [(SF "m") (SD "Z")])
380 (define_mode_attr f32_si [(SF "stfs%U0%X0 %1,%0") (SD "stfiwx %1,%y0")])
381 (define_mode_attr f32_sv [(SF "stxsspx %x1,%y0") (SD "stxsiwzx %x1,%y0")])
383 ; Definitions for 32-bit fpr direct move
384 (define_mode_attr f32_dm [(SF "wn") (SD "wm")])
386 ; These modes do not fit in integer registers in 32-bit mode.
387 ; but on e500v2, the gpr are 64 bit registers
388 (define_mode_iterator DIFD [DI (DF "!TARGET_E500_DOUBLE") DD])
390 ; Iterator for reciprocal estimate instructions
391 (define_mode_iterator RECIPF [SF DF V4SF V2DF])
393 ; Iterator for just SF/DF
394 (define_mode_iterator SFDF [SF DF])
396 ; SF/DF suffix for traditional floating instructions
397 (define_mode_attr Ftrad [(SF "s") (DF "")])
399 ; SF/DF suffix for VSX instructions
400 (define_mode_attr Fvsx [(SF "sp") (DF "dp")])
402 ; SF/DF constraint for arithmetic on traditional floating point registers
403 (define_mode_attr Ff [(SF "f") (DF "d")])
405 ; SF/DF constraint for arithmetic on VSX registers
406 (define_mode_attr Fv [(SF "wy") (DF "ws")])
408 ; s/d suffix for things like fp_addsub_s/fp_addsub_d
409 (define_mode_attr Fs [(SF "s") (DF "d")])
412 (define_mode_attr Ffre [(SF "fres") (DF "fre")])
413 (define_mode_attr FFRE [(SF "FRES") (DF "FRE")])
415 ; Conditional returns.
416 (define_code_iterator any_return [return simple_return])
417 (define_code_attr return_pred [(return "direct_return ()")
418 (simple_return "1")])
419 (define_code_attr return_str [(return "") (simple_return "simple_")])
421 ; Various instructions that come in SI and DI forms.
422 ; A generic w/d attribute, for things like cmpw/cmpd.
423 (define_mode_attr wd [(QI "b")
432 ;; How many bits in this mode?
433 (define_mode_attr bits [(QI "8") (HI "16") (SI "32") (DI "64")])
436 (define_mode_attr dbits [(QI "56") (HI "48") (SI "32")])
438 ;; ISEL/ISEL64 target selection
439 (define_mode_attr sel [(SI "") (DI "64")])
441 ;; Suffix for reload patterns
442 (define_mode_attr ptrsize [(SI "32bit")
445 (define_mode_attr tptrsize [(SI "TARGET_32BIT")
446 (DI "TARGET_64BIT")])
448 (define_mode_attr mptrsize [(SI "si")
451 (define_mode_attr ptrload [(SI "lwz")
454 (define_mode_attr ptrm [(SI "m")
457 (define_mode_attr rreg [(SF "f")
464 (define_mode_attr rreg2 [(SF "f")
467 (define_mode_attr SI_CONVERT_FP [(SF "TARGET_FCFIDS")
468 (DF "TARGET_FCFID")])
470 (define_mode_attr E500_CONVERT [(SF "!TARGET_FPRS")
471 (DF "TARGET_E500_DOUBLE")])
473 (define_mode_attr TARGET_FLOAT [(SF "TARGET_SINGLE_FLOAT")
474 (DF "TARGET_DOUBLE_FLOAT")])
476 ;; Mode iterator for logical operations on 128-bit types
477 (define_mode_iterator BOOL_128 [TI
479 (V16QI "TARGET_ALTIVEC")
480 (V8HI "TARGET_ALTIVEC")
481 (V4SI "TARGET_ALTIVEC")
482 (V4SF "TARGET_ALTIVEC")
483 (V2DI "TARGET_ALTIVEC")
484 (V2DF "TARGET_ALTIVEC")
485 (V1TI "TARGET_ALTIVEC")])
487 ;; For the GPRs we use 3 constraints for register outputs, two that are the
488 ;; same as the output register, and a third where the output register is an
489 ;; early clobber, so we don't have to deal with register overlaps. For the
490 ;; vector types, we prefer to use the vector registers. For TI mode, allow
493 ;; Mode attribute for boolean operation register constraints for output
494 (define_mode_attr BOOL_REGS_OUTPUT [(TI "&r,r,r,wa,v")
496 (V16QI "wa,v,&?r,?r,?r")
497 (V8HI "wa,v,&?r,?r,?r")
498 (V4SI "wa,v,&?r,?r,?r")
499 (V4SF "wa,v,&?r,?r,?r")
500 (V2DI "wa,v,&?r,?r,?r")
501 (V2DF "wa,v,&?r,?r,?r")
502 (V1TI "wa,v,&?r,?r,?r")])
504 ;; Mode attribute for boolean operation register constraints for operand1
505 (define_mode_attr BOOL_REGS_OP1 [(TI "r,0,r,wa,v")
513 (V1TI "wa,v,r,0,r")])
515 ;; Mode attribute for boolean operation register constraints for operand2
516 (define_mode_attr BOOL_REGS_OP2 [(TI "r,r,0,wa,v")
524 (V1TI "wa,v,r,r,0")])
526 ;; Mode attribute for boolean operation register constraints for operand1
527 ;; for one_cmpl. To simplify things, we repeat the constraint where 0
528 ;; is used for operand1 or operand2
529 (define_mode_attr BOOL_REGS_UNARY [(TI "r,0,0,wa,v")
537 (V1TI "wa,v,r,0,0")])
539 ;; Mode attribute for the clobber of CC0 for AND expansion.
540 ;; For the 128-bit types, we never do AND immediate, but we need to
541 ;; get the correct number of X's for the number of operands.
542 (define_mode_attr BOOL_REGS_AND_CR0 [(TI "X,X,X,X,X")
552 ;; Start with fixed-point load and store insns. Here we put only the more
553 ;; complex forms. Basic data transfer is done later.
555 (define_expand "zero_extend<mode>di2"
556 [(set (match_operand:DI 0 "gpc_reg_operand" "")
557 (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "")))]
561 (define_insn "*zero_extend<mode>di2_internal1"
562 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
563 (zero_extend:DI (match_operand:QHSI 1 "reg_or_mem_operand" "m,r")))]
564 "TARGET_POWERPC64 && (<MODE>mode != SImode || !TARGET_LFIWZX)"
567 rldicl %0,%1,0,<dbits>"
568 [(set_attr "type" "load,*")])
570 (define_insn "*zero_extend<mode>di2_internal2"
571 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
572 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "r,r"))
574 (clobber (match_scratch:DI 2 "=r,r"))]
577 rldicl. %2,%1,0,<dbits>
579 [(set_attr "type" "compare")
580 (set_attr "length" "4,8")])
583 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
584 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" ""))
586 (clobber (match_scratch:DI 2 ""))]
587 "TARGET_POWERPC64 && reload_completed"
589 (zero_extend:DI (match_dup 1)))
591 (compare:CC (match_dup 2)
595 (define_insn "*zero_extend<mode>di2_internal3"
596 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
597 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "r,r"))
599 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
600 (zero_extend:DI (match_dup 1)))]
603 rldicl. %0,%1,0,<dbits>
605 [(set_attr "type" "compare")
606 (set_attr "length" "4,8")])
609 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
610 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" ""))
612 (set (match_operand:DI 0 "gpc_reg_operand" "")
613 (zero_extend:DI (match_dup 1)))]
614 "TARGET_POWERPC64 && reload_completed"
616 (zero_extend:DI (match_dup 1)))
618 (compare:CC (match_dup 0)
622 (define_insn "*zero_extendsidi2_lfiwzx"
623 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,??wm,!wz,!wu")
624 (zero_extend:DI (match_operand:SI 1 "reg_or_mem_operand" "m,r,r,Z,Z")))]
625 "TARGET_POWERPC64 && TARGET_LFIWZX"
632 [(set_attr "type" "load,*,mffgpr,fpload,fpload")])
634 (define_insn "extendqidi2"
635 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
636 (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r")))]
639 [(set_attr "type" "exts")])
642 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
643 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
645 (clobber (match_scratch:DI 2 "=r,r"))]
650 [(set_attr "type" "compare")
651 (set_attr "length" "4,8")])
654 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
655 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
657 (clobber (match_scratch:DI 2 ""))]
658 "TARGET_POWERPC64 && reload_completed"
660 (sign_extend:DI (match_dup 1)))
662 (compare:CC (match_dup 2)
667 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
668 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
670 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
671 (sign_extend:DI (match_dup 1)))]
676 [(set_attr "type" "compare")
677 (set_attr "length" "4,8")])
680 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
681 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
683 (set (match_operand:DI 0 "gpc_reg_operand" "")
684 (sign_extend:DI (match_dup 1)))]
685 "TARGET_POWERPC64 && reload_completed"
687 (sign_extend:DI (match_dup 1)))
689 (compare:CC (match_dup 0)
693 (define_expand "extendhidi2"
694 [(set (match_operand:DI 0 "gpc_reg_operand" "")
695 (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "")))]
700 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
701 (sign_extend:DI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
702 "TARGET_POWERPC64 && rs6000_gen_cell_microcode"
706 [(set_attr "type" "load,exts")
707 (set_attr "sign_extend" "yes")])
710 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
711 (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r")))]
712 "TARGET_POWERPC64 && !rs6000_gen_cell_microcode"
714 [(set_attr "type" "exts")])
717 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
718 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
720 (clobber (match_scratch:DI 2 "=r,r"))]
725 [(set_attr "type" "compare")
726 (set_attr "length" "4,8")])
729 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
730 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
732 (clobber (match_scratch:DI 2 ""))]
733 "TARGET_POWERPC64 && reload_completed"
735 (sign_extend:DI (match_dup 1)))
737 (compare:CC (match_dup 2)
742 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
743 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
745 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
746 (sign_extend:DI (match_dup 1)))]
751 [(set_attr "type" "compare")
752 (set_attr "length" "4,8")])
755 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
756 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
758 (set (match_operand:DI 0 "gpc_reg_operand" "")
759 (sign_extend:DI (match_dup 1)))]
760 "TARGET_POWERPC64 && reload_completed"
762 (sign_extend:DI (match_dup 1)))
764 (compare:CC (match_dup 0)
768 (define_expand "extendsidi2"
769 [(set (match_operand:DI 0 "gpc_reg_operand" "")
770 (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")))]
774 (define_insn "*extendsidi2_lfiwax"
775 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,??wm,!wl,!wu")
776 (sign_extend:DI (match_operand:SI 1 "lwa_operand" "Y,r,r,Z,Z")))]
777 "TARGET_POWERPC64 && TARGET_LFIWAX"
784 [(set_attr "type" "load,exts,mffgpr,fpload,fpload")
785 (set_attr "sign_extend" "yes")])
787 (define_insn "*extendsidi2_nocell"
788 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
789 (sign_extend:DI (match_operand:SI 1 "lwa_operand" "Y,r")))]
790 "TARGET_POWERPC64 && rs6000_gen_cell_microcode && !TARGET_LFIWAX"
794 [(set_attr "type" "load,exts")
795 (set_attr "sign_extend" "yes")])
797 (define_insn "*extendsidi2_nocell"
798 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
799 (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r")))]
800 "TARGET_POWERPC64 && !rs6000_gen_cell_microcode"
802 [(set_attr "type" "exts")])
805 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
806 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
808 (clobber (match_scratch:DI 2 "=r,r"))]
813 [(set_attr "type" "compare")
814 (set_attr "length" "4,8")])
817 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
818 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
820 (clobber (match_scratch:DI 2 ""))]
821 "TARGET_POWERPC64 && reload_completed"
823 (sign_extend:DI (match_dup 1)))
825 (compare:CC (match_dup 2)
830 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
831 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
833 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
834 (sign_extend:DI (match_dup 1)))]
839 [(set_attr "type" "compare")
840 (set_attr "length" "4,8")])
843 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
844 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
846 (set (match_operand:DI 0 "gpc_reg_operand" "")
847 (sign_extend:DI (match_dup 1)))]
848 "TARGET_POWERPC64 && reload_completed"
850 (sign_extend:DI (match_dup 1)))
852 (compare:CC (match_dup 0)
856 (define_expand "zero_extendqisi2"
857 [(set (match_operand:SI 0 "gpc_reg_operand" "")
858 (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "")))]
863 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
864 (zero_extend:SI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
869 [(set_attr "type" "load,*")])
872 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
873 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
875 (clobber (match_scratch:SI 2 "=r,r"))]
880 [(set_attr "type" "fast_compare,compare")
881 (set_attr "length" "4,8")])
884 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
885 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
887 (clobber (match_scratch:SI 2 ""))]
890 (zero_extend:SI (match_dup 1)))
892 (compare:CC (match_dup 2)
897 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
898 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
900 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
901 (zero_extend:SI (match_dup 1)))]
906 [(set_attr "type" "fast_compare,compare")
907 (set_attr "length" "4,8")])
910 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
911 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
913 (set (match_operand:SI 0 "gpc_reg_operand" "")
914 (zero_extend:SI (match_dup 1)))]
917 (zero_extend:SI (match_dup 1)))
919 (compare:CC (match_dup 0)
923 (define_insn "extendqisi2"
924 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
925 (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r")))]
928 [(set_attr "type" "exts")])
931 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
932 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
934 (clobber (match_scratch:SI 2 "=r,r"))]
939 [(set_attr "type" "compare")
940 (set_attr "length" "4,8")])
943 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
944 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
946 (clobber (match_scratch:SI 2 ""))]
949 (sign_extend:SI (match_dup 1)))
951 (compare:CC (match_dup 2)
956 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
957 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
959 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
960 (sign_extend:SI (match_dup 1)))]
965 [(set_attr "type" "compare")
966 (set_attr "length" "4,8")])
969 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
970 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
972 (set (match_operand:SI 0 "gpc_reg_operand" "")
973 (sign_extend:SI (match_dup 1)))]
976 (sign_extend:SI (match_dup 1)))
978 (compare:CC (match_dup 0)
983 [(set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
984 (zero_extend:HI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
989 [(set_attr "type" "load,*")])
992 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
993 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
995 (clobber (match_scratch:HI 2 "=r,r"))]
1000 [(set_attr "type" "fast_compare,compare")
1001 (set_attr "length" "4,8")])
1004 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
1005 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
1007 (clobber (match_scratch:HI 2 ""))]
1010 (zero_extend:HI (match_dup 1)))
1012 (compare:CC (match_dup 2)
1017 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1018 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
1020 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
1021 (zero_extend:HI (match_dup 1)))]
1026 [(set_attr "type" "fast_compare,compare")
1027 (set_attr "length" "4,8")])
1030 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
1031 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
1033 (set (match_operand:HI 0 "gpc_reg_operand" "")
1034 (zero_extend:HI (match_dup 1)))]
1037 (zero_extend:HI (match_dup 1)))
1039 (compare:CC (match_dup 0)
1043 (define_insn "extendqihi2"
1044 [(set (match_operand:HI 0 "gpc_reg_operand" "=r")
1045 (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r")))]
1048 [(set_attr "type" "exts")])
1051 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1052 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
1054 (clobber (match_scratch:HI 2 "=r,r"))]
1059 [(set_attr "type" "compare")
1060 (set_attr "length" "4,8")])
1063 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
1064 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
1066 (clobber (match_scratch:HI 2 ""))]
1069 (sign_extend:HI (match_dup 1)))
1071 (compare:CC (match_dup 2)
1076 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1077 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
1079 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
1080 (sign_extend:HI (match_dup 1)))]
1085 [(set_attr "type" "compare")
1086 (set_attr "length" "4,8")])
1089 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
1090 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
1092 (set (match_operand:HI 0 "gpc_reg_operand" "")
1093 (sign_extend:HI (match_dup 1)))]
1096 (sign_extend:HI (match_dup 1)))
1098 (compare:CC (match_dup 0)
1102 (define_expand "zero_extendhisi2"
1103 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1104 (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
1109 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1110 (zero_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
1114 rlwinm %0,%1,0,0xffff"
1115 [(set_attr "type" "load,*")])
1118 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1119 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
1121 (clobber (match_scratch:SI 2 "=r,r"))]
1126 [(set_attr "type" "fast_compare,compare")
1127 (set_attr "length" "4,8")])
1130 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
1131 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1133 (clobber (match_scratch:SI 2 ""))]
1136 (zero_extend:SI (match_dup 1)))
1138 (compare:CC (match_dup 2)
1143 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1144 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
1146 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1147 (zero_extend:SI (match_dup 1)))]
1152 [(set_attr "type" "fast_compare,compare")
1153 (set_attr "length" "4,8")])
1156 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
1157 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1159 (set (match_operand:SI 0 "gpc_reg_operand" "")
1160 (zero_extend:SI (match_dup 1)))]
1163 (zero_extend:SI (match_dup 1)))
1165 (compare:CC (match_dup 0)
1169 (define_expand "extendhisi2"
1170 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1171 (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
1176 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1177 (sign_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
1178 "rs6000_gen_cell_microcode"
1182 [(set_attr "type" "load,exts")
1183 (set_attr "sign_extend" "yes")])
1186 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1187 (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r")))]
1188 "!rs6000_gen_cell_microcode"
1190 [(set_attr "type" "exts")])
1193 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1194 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
1196 (clobber (match_scratch:SI 2 "=r,r"))]
1201 [(set_attr "type" "compare")
1202 (set_attr "length" "4,8")])
1205 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
1206 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1208 (clobber (match_scratch:SI 2 ""))]
1211 (sign_extend:SI (match_dup 1)))
1213 (compare:CC (match_dup 2)
1218 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1219 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
1221 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1222 (sign_extend:SI (match_dup 1)))]
1227 [(set_attr "type" "compare")
1228 (set_attr "length" "4,8")])
1231 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
1232 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1234 (set (match_operand:SI 0 "gpc_reg_operand" "")
1235 (sign_extend:SI (match_dup 1)))]
1238 (sign_extend:SI (match_dup 1)))
1240 (compare:CC (match_dup 0)
1244 ;; IBM 405, 440, 464 and 476 half-word multiplication operations.
1246 (define_insn "*macchwc"
1247 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1248 (compare:CC (plus:SI (mult:SI (ashiftrt:SI
1249 (match_operand:SI 2 "gpc_reg_operand" "r")
1252 (match_operand:HI 1 "gpc_reg_operand" "r")))
1253 (match_operand:SI 4 "gpc_reg_operand" "0"))
1255 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1256 (plus:SI (mult:SI (ashiftrt:SI
1264 [(set_attr "type" "halfmul")])
1266 (define_insn "*macchw"
1267 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1268 (plus:SI (mult:SI (ashiftrt:SI
1269 (match_operand:SI 2 "gpc_reg_operand" "r")
1272 (match_operand:HI 1 "gpc_reg_operand" "r")))
1273 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1276 [(set_attr "type" "halfmul")])
1278 (define_insn "*macchwuc"
1279 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1280 (compare:CC (plus:SI (mult:SI (lshiftrt:SI
1281 (match_operand:SI 2 "gpc_reg_operand" "r")
1284 (match_operand:HI 1 "gpc_reg_operand" "r")))
1285 (match_operand:SI 4 "gpc_reg_operand" "0"))
1287 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1288 (plus:SI (mult:SI (lshiftrt:SI
1296 [(set_attr "type" "halfmul")])
1298 (define_insn "*macchwu"
1299 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1300 (plus:SI (mult:SI (lshiftrt:SI
1301 (match_operand:SI 2 "gpc_reg_operand" "r")
1304 (match_operand:HI 1 "gpc_reg_operand" "r")))
1305 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1308 [(set_attr "type" "halfmul")])
1310 (define_insn "*machhwc"
1311 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1312 (compare:CC (plus:SI (mult:SI (ashiftrt:SI
1313 (match_operand:SI 1 "gpc_reg_operand" "%r")
1316 (match_operand:SI 2 "gpc_reg_operand" "r")
1318 (match_operand:SI 4 "gpc_reg_operand" "0"))
1320 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1321 (plus:SI (mult:SI (ashiftrt:SI
1330 [(set_attr "type" "halfmul")])
1332 (define_insn "*machhw"
1333 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1334 (plus:SI (mult:SI (ashiftrt:SI
1335 (match_operand:SI 1 "gpc_reg_operand" "%r")
1338 (match_operand:SI 2 "gpc_reg_operand" "r")
1340 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1343 [(set_attr "type" "halfmul")])
1345 (define_insn "*machhwuc"
1346 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1347 (compare:CC (plus:SI (mult:SI (lshiftrt:SI
1348 (match_operand:SI 1 "gpc_reg_operand" "%r")
1351 (match_operand:SI 2 "gpc_reg_operand" "r")
1353 (match_operand:SI 4 "gpc_reg_operand" "0"))
1355 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1356 (plus:SI (mult:SI (lshiftrt:SI
1365 [(set_attr "type" "halfmul")])
1367 (define_insn "*machhwu"
1368 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1369 (plus:SI (mult:SI (lshiftrt:SI
1370 (match_operand:SI 1 "gpc_reg_operand" "%r")
1373 (match_operand:SI 2 "gpc_reg_operand" "r")
1375 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1378 [(set_attr "type" "halfmul")])
1380 (define_insn "*maclhwc"
1381 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1382 (compare:CC (plus:SI (mult:SI (sign_extend:SI
1383 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1385 (match_operand:HI 2 "gpc_reg_operand" "r")))
1386 (match_operand:SI 4 "gpc_reg_operand" "0"))
1388 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1389 (plus:SI (mult:SI (sign_extend:SI
1396 [(set_attr "type" "halfmul")])
1398 (define_insn "*maclhw"
1399 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1400 (plus:SI (mult:SI (sign_extend:SI
1401 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1403 (match_operand:HI 2 "gpc_reg_operand" "r")))
1404 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1407 [(set_attr "type" "halfmul")])
1409 (define_insn "*maclhwuc"
1410 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1411 (compare:CC (plus:SI (mult:SI (zero_extend:SI
1412 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1414 (match_operand:HI 2 "gpc_reg_operand" "r")))
1415 (match_operand:SI 4 "gpc_reg_operand" "0"))
1417 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1418 (plus:SI (mult:SI (zero_extend:SI
1425 [(set_attr "type" "halfmul")])
1427 (define_insn "*maclhwu"
1428 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1429 (plus:SI (mult:SI (zero_extend:SI
1430 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1432 (match_operand:HI 2 "gpc_reg_operand" "r")))
1433 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1436 [(set_attr "type" "halfmul")])
1438 (define_insn "*nmacchwc"
1439 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1440 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1441 (mult:SI (ashiftrt:SI
1442 (match_operand:SI 2 "gpc_reg_operand" "r")
1445 (match_operand:HI 1 "gpc_reg_operand" "r"))))
1447 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1448 (minus:SI (match_dup 4)
1449 (mult:SI (ashiftrt:SI
1456 [(set_attr "type" "halfmul")])
1458 (define_insn "*nmacchw"
1459 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1460 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1461 (mult:SI (ashiftrt:SI
1462 (match_operand:SI 2 "gpc_reg_operand" "r")
1465 (match_operand:HI 1 "gpc_reg_operand" "r")))))]
1468 [(set_attr "type" "halfmul")])
1470 (define_insn "*nmachhwc"
1471 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1472 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1473 (mult:SI (ashiftrt:SI
1474 (match_operand:SI 1 "gpc_reg_operand" "%r")
1477 (match_operand:SI 2 "gpc_reg_operand" "r")
1480 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1481 (minus:SI (match_dup 4)
1482 (mult:SI (ashiftrt:SI
1490 [(set_attr "type" "halfmul")])
1492 (define_insn "*nmachhw"
1493 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1494 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1495 (mult:SI (ashiftrt:SI
1496 (match_operand:SI 1 "gpc_reg_operand" "%r")
1499 (match_operand:SI 2 "gpc_reg_operand" "r")
1503 [(set_attr "type" "halfmul")])
1505 (define_insn "*nmaclhwc"
1506 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1507 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1508 (mult:SI (sign_extend:SI
1509 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1511 (match_operand:HI 2 "gpc_reg_operand" "r"))))
1513 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1514 (minus:SI (match_dup 4)
1515 (mult:SI (sign_extend:SI
1521 [(set_attr "type" "halfmul")])
1523 (define_insn "*nmaclhw"
1524 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1525 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1526 (mult:SI (sign_extend:SI
1527 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1529 (match_operand:HI 2 "gpc_reg_operand" "r")))))]
1532 [(set_attr "type" "halfmul")])
1534 (define_insn "*mulchwc"
1535 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1536 (compare:CC (mult:SI (ashiftrt:SI
1537 (match_operand:SI 2 "gpc_reg_operand" "r")
1540 (match_operand:HI 1 "gpc_reg_operand" "r")))
1542 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1543 (mult:SI (ashiftrt:SI
1550 [(set_attr "type" "halfmul")])
1552 (define_insn "*mulchw"
1553 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1554 (mult:SI (ashiftrt:SI
1555 (match_operand:SI 2 "gpc_reg_operand" "r")
1558 (match_operand:HI 1 "gpc_reg_operand" "r"))))]
1561 [(set_attr "type" "halfmul")])
1563 (define_insn "*mulchwuc"
1564 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1565 (compare:CC (mult:SI (lshiftrt:SI
1566 (match_operand:SI 2 "gpc_reg_operand" "r")
1569 (match_operand:HI 1 "gpc_reg_operand" "r")))
1571 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1572 (mult:SI (lshiftrt:SI
1579 [(set_attr "type" "halfmul")])
1581 (define_insn "*mulchwu"
1582 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1583 (mult:SI (lshiftrt:SI
1584 (match_operand:SI 2 "gpc_reg_operand" "r")
1587 (match_operand:HI 1 "gpc_reg_operand" "r"))))]
1590 [(set_attr "type" "halfmul")])
1592 (define_insn "*mulhhwc"
1593 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1594 (compare:CC (mult:SI (ashiftrt:SI
1595 (match_operand:SI 1 "gpc_reg_operand" "%r")
1598 (match_operand:SI 2 "gpc_reg_operand" "r")
1601 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1602 (mult:SI (ashiftrt:SI
1610 [(set_attr "type" "halfmul")])
1612 (define_insn "*mulhhw"
1613 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1614 (mult:SI (ashiftrt:SI
1615 (match_operand:SI 1 "gpc_reg_operand" "%r")
1618 (match_operand:SI 2 "gpc_reg_operand" "r")
1622 [(set_attr "type" "halfmul")])
1624 (define_insn "*mulhhwuc"
1625 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1626 (compare:CC (mult:SI (lshiftrt:SI
1627 (match_operand:SI 1 "gpc_reg_operand" "%r")
1630 (match_operand:SI 2 "gpc_reg_operand" "r")
1633 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1634 (mult:SI (lshiftrt:SI
1642 [(set_attr "type" "halfmul")])
1644 (define_insn "*mulhhwu"
1645 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1646 (mult:SI (lshiftrt:SI
1647 (match_operand:SI 1 "gpc_reg_operand" "%r")
1650 (match_operand:SI 2 "gpc_reg_operand" "r")
1654 [(set_attr "type" "halfmul")])
1656 (define_insn "*mullhwc"
1657 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1658 (compare:CC (mult:SI (sign_extend:SI
1659 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1661 (match_operand:HI 2 "gpc_reg_operand" "r")))
1663 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1664 (mult:SI (sign_extend:SI
1670 [(set_attr "type" "halfmul")])
1672 (define_insn "*mullhw"
1673 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1674 (mult:SI (sign_extend:SI
1675 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1677 (match_operand:HI 2 "gpc_reg_operand" "r"))))]
1680 [(set_attr "type" "halfmul")])
1682 (define_insn "*mullhwuc"
1683 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1684 (compare:CC (mult:SI (zero_extend:SI
1685 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1687 (match_operand:HI 2 "gpc_reg_operand" "r")))
1689 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1690 (mult:SI (zero_extend:SI
1696 [(set_attr "type" "halfmul")])
1698 (define_insn "*mullhwu"
1699 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1700 (mult:SI (zero_extend:SI
1701 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1703 (match_operand:HI 2 "gpc_reg_operand" "r"))))]
1706 [(set_attr "type" "halfmul")])
1708 ;; IBM 405, 440, 464 and 476 string-search dlmzb instruction support.
1709 (define_insn "dlmzb"
1710 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1711 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
1712 (match_operand:SI 2 "gpc_reg_operand" "r")]
1714 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1715 (unspec:SI [(match_dup 1)
1721 (define_expand "strlensi"
1722 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1723 (unspec:SI [(match_operand:BLK 1 "general_operand" "")
1724 (match_operand:QI 2 "const_int_operand" "")
1725 (match_operand 3 "const_int_operand" "")]
1726 UNSPEC_DLMZB_STRLEN))
1727 (clobber (match_scratch:CC 4 "=x"))]
1728 "TARGET_DLMZB && WORDS_BIG_ENDIAN && !optimize_size"
1730 rtx result = operands[0];
1731 rtx src = operands[1];
1732 rtx search_char = operands[2];
1733 rtx align = operands[3];
1734 rtx addr, scratch_string, word1, word2, scratch_dlmzb;
1735 rtx loop_label, end_label, mem, cr0, cond;
1736 if (search_char != const0_rtx
1737 || GET_CODE (align) != CONST_INT
1738 || INTVAL (align) < 8)
1740 word1 = gen_reg_rtx (SImode);
1741 word2 = gen_reg_rtx (SImode);
1742 scratch_dlmzb = gen_reg_rtx (SImode);
1743 scratch_string = gen_reg_rtx (Pmode);
1744 loop_label = gen_label_rtx ();
1745 end_label = gen_label_rtx ();
1746 addr = force_reg (Pmode, XEXP (src, 0));
1747 emit_move_insn (scratch_string, addr);
1748 emit_label (loop_label);
1749 mem = change_address (src, SImode, scratch_string);
1750 emit_move_insn (word1, mem);
1751 emit_move_insn (word2, adjust_address (mem, SImode, 4));
1752 cr0 = gen_rtx_REG (CCmode, CR0_REGNO);
1753 emit_insn (gen_dlmzb (scratch_dlmzb, word1, word2, cr0));
1754 cond = gen_rtx_NE (VOIDmode, cr0, const0_rtx);
1755 emit_jump_insn (gen_rtx_SET (VOIDmode,
1757 gen_rtx_IF_THEN_ELSE (VOIDmode,
1763 emit_insn (gen_addsi3 (scratch_string, scratch_string, GEN_INT (8)));
1764 emit_jump_insn (gen_rtx_SET (VOIDmode,
1766 gen_rtx_LABEL_REF (VOIDmode, loop_label)));
1768 emit_label (end_label);
1769 emit_insn (gen_addsi3 (scratch_string, scratch_string, scratch_dlmzb));
1770 emit_insn (gen_subsi3 (result, scratch_string, addr));
1771 emit_insn (gen_subsi3 (result, result, const1_rtx));
1775 ;; Fixed-point arithmetic insns.
1777 (define_expand "add<mode>3"
1778 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1779 (plus:SDI (match_operand:SDI 1 "gpc_reg_operand" "")
1780 (match_operand:SDI 2 "reg_or_add_cint_operand" "")))]
1783 if (<MODE>mode == DImode && ! TARGET_POWERPC64)
1785 if (non_short_cint_operand (operands[2], DImode))
1788 else if (GET_CODE (operands[2]) == CONST_INT
1789 && ! add_operand (operands[2], <MODE>mode))
1791 rtx tmp = ((!can_create_pseudo_p ()
1792 || rtx_equal_p (operands[0], operands[1]))
1793 ? operands[0] : gen_reg_rtx (<MODE>mode));
1795 HOST_WIDE_INT val = INTVAL (operands[2]);
1796 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1797 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, <MODE>mode);
1799 if (<MODE>mode == DImode && !satisfies_constraint_L (GEN_INT (rest)))
1802 /* The ordering here is important for the prolog expander.
1803 When space is allocated from the stack, adding 'low' first may
1804 produce a temporary deallocation (which would be bad). */
1805 emit_insn (gen_add<mode>3 (tmp, operands[1], GEN_INT (rest)));
1806 emit_insn (gen_add<mode>3 (operands[0], tmp, GEN_INT (low)));
1811 ;; Discourage ai/addic because of carry but provide it in an alternative
1812 ;; allowing register zero as source.
1813 (define_insn "*add<mode>3_internal1"
1814 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r,?r,r")
1815 (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "%r,b,r,b")
1816 (match_operand:GPR 2 "add_operand" "r,I,I,L")))]
1817 "!DECIMAL_FLOAT_MODE_P (GET_MODE (operands[0])) && !DECIMAL_FLOAT_MODE_P (GET_MODE (operands[1]))"
1823 [(set_attr "length" "4,4,4,4")])
1825 (define_insn "addsi3_high"
1826 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
1827 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
1828 (high:SI (match_operand 2 "" ""))))]
1829 "TARGET_MACHO && !TARGET_64BIT"
1830 "addis %0,%1,ha16(%2)"
1831 [(set_attr "length" "4")])
1833 (define_insn "*add<mode>3_internal2"
1834 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
1835 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "%r,r,r,r")
1836 (match_operand:P 2 "reg_or_short_operand" "r,I,r,I"))
1838 (clobber (match_scratch:P 3 "=r,r,r,r"))]
1845 [(set_attr "type" "fast_compare,compare,compare,compare")
1846 (set_attr "length" "4,4,8,8")])
1849 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1850 (compare:CC (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1851 (match_operand:GPR 2 "reg_or_short_operand" ""))
1853 (clobber (match_scratch:GPR 3 ""))]
1856 (plus:GPR (match_dup 1)
1859 (compare:CC (match_dup 3)
1863 (define_insn "*add<mode>3_internal3"
1864 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
1865 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "%r,r,r,r")
1866 (match_operand:P 2 "reg_or_short_operand" "r,I,r,I"))
1868 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
1869 (plus:P (match_dup 1)
1877 [(set_attr "type" "fast_compare,compare,compare,compare")
1878 (set_attr "length" "4,4,8,8")])
1881 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1882 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "")
1883 (match_operand:P 2 "reg_or_short_operand" ""))
1885 (set (match_operand:P 0 "gpc_reg_operand" "")
1886 (plus:P (match_dup 1) (match_dup 2)))]
1889 (plus:P (match_dup 1)
1892 (compare:CC (match_dup 0)
1896 ;; Split an add that we can't do in one insn into two insns, each of which
1897 ;; does one 16-bit part. This is used by combine. Note that the low-order
1898 ;; add should be last in case the result gets used in an address.
1901 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
1902 (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1903 (match_operand:GPR 2 "non_add_cint_operand" "")))]
1905 [(set (match_dup 0) (plus:GPR (match_dup 1) (match_dup 3)))
1906 (set (match_dup 0) (plus:GPR (match_dup 0) (match_dup 4)))]
1908 HOST_WIDE_INT val = INTVAL (operands[2]);
1909 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1910 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, <MODE>mode);
1912 operands[4] = GEN_INT (low);
1913 if (<MODE>mode == SImode || satisfies_constraint_L (GEN_INT (rest)))
1914 operands[3] = GEN_INT (rest);
1915 else if (can_create_pseudo_p ())
1917 operands[3] = gen_reg_rtx (DImode);
1918 emit_move_insn (operands[3], operands[2]);
1919 emit_insn (gen_adddi3 (operands[0], operands[1], operands[3]));
1926 (define_expand "one_cmpl<mode>2"
1927 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1928 (not:SDI (match_operand:SDI 1 "gpc_reg_operand" "")))]
1931 if (<MODE>mode == DImode && !TARGET_POWERPC64)
1933 rs6000_split_logical (operands, NOT, false, false, false, NULL_RTX);
1938 (define_insn "*one_cmpl<mode>2"
1939 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1940 (not:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
1945 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1946 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1948 (clobber (match_scratch:P 2 "=r,r"))]
1953 [(set_attr "type" "fast_compare,compare")
1954 (set_attr "length" "4,8")])
1957 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
1958 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" ""))
1960 (clobber (match_scratch:P 2 ""))]
1963 (not:P (match_dup 1)))
1965 (compare:CC (match_dup 2)
1970 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1971 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1973 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
1974 (not:P (match_dup 1)))]
1979 [(set_attr "type" "fast_compare,compare")
1980 (set_attr "length" "4,8")])
1983 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
1984 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" ""))
1986 (set (match_operand:P 0 "gpc_reg_operand" "")
1987 (not:P (match_dup 1)))]
1990 (not:P (match_dup 1)))
1992 (compare:CC (match_dup 0)
1997 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
1998 (minus:GPR (match_operand:GPR 1 "reg_or_short_operand" "r,I")
1999 (match_operand:GPR 2 "gpc_reg_operand" "r,r")))]
2006 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2007 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "r,r")
2008 (match_operand:P 2 "gpc_reg_operand" "r,r"))
2010 (clobber (match_scratch:P 3 "=r,r"))]
2015 [(set_attr "type" "fast_compare")
2016 (set_attr "length" "4,8")])
2019 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2020 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "")
2021 (match_operand:P 2 "gpc_reg_operand" ""))
2023 (clobber (match_scratch:P 3 ""))]
2026 (minus:P (match_dup 1)
2029 (compare:CC (match_dup 3)
2034 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2035 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "r,r")
2036 (match_operand:P 2 "gpc_reg_operand" "r,r"))
2038 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
2039 (minus:P (match_dup 1)
2045 [(set_attr "type" "fast_compare")
2046 (set_attr "length" "4,8")])
2049 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2050 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "")
2051 (match_operand:P 2 "gpc_reg_operand" ""))
2053 (set (match_operand:P 0 "gpc_reg_operand" "")
2054 (minus:P (match_dup 1)
2058 (minus:P (match_dup 1)
2061 (compare:CC (match_dup 0)
2065 (define_expand "sub<mode>3"
2066 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
2067 (minus:SDI (match_operand:SDI 1 "reg_or_short_operand" "")
2068 (match_operand:SDI 2 "reg_or_sub_cint_operand" "")))]
2072 if (GET_CODE (operands[2]) == CONST_INT)
2074 emit_insn (gen_add<mode>3 (operands[0], operands[1],
2075 negate_rtx (<MODE>mode, operands[2])));
2080 (define_expand "neg<mode>2"
2081 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
2082 (neg:SDI (match_operand:SDI 1 "gpc_reg_operand" "")))]
2086 (define_insn "*neg<mode>2_internal"
2087 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2088 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
2093 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2094 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
2096 (clobber (match_scratch:P 2 "=r,r"))]
2101 [(set_attr "type" "fast_compare")
2102 (set_attr "length" "4,8")])
2105 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2106 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" ""))
2108 (clobber (match_scratch:P 2 ""))]
2111 (neg:P (match_dup 1)))
2113 (compare:CC (match_dup 2)
2118 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
2119 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
2121 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
2122 (neg:P (match_dup 1)))]
2127 [(set_attr "type" "fast_compare")
2128 (set_attr "length" "4,8")])
2131 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
2132 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" ""))
2134 (set (match_operand:P 0 "gpc_reg_operand" "")
2135 (neg:P (match_dup 1)))]
2138 (neg:P (match_dup 1)))
2140 (compare:CC (match_dup 0)
2144 (define_insn "clz<mode>2"
2145 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2146 (clz:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
2149 [(set_attr "type" "cntlz")])
2151 (define_expand "ctz<mode>2"
2153 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))
2154 (parallel [(set (match_dup 3) (and:GPR (match_dup 1)
2156 (clobber (scratch:CC))])
2157 (set (match_dup 4) (clz:GPR (match_dup 3)))
2158 (set (match_operand:GPR 0 "gpc_reg_operand" "")
2159 (minus:GPR (match_dup 5) (match_dup 4)))]
2162 operands[2] = gen_reg_rtx (<MODE>mode);
2163 operands[3] = gen_reg_rtx (<MODE>mode);
2164 operands[4] = gen_reg_rtx (<MODE>mode);
2165 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode) - 1);
2168 (define_expand "ffs<mode>2"
2170 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))
2171 (parallel [(set (match_dup 3) (and:GPR (match_dup 1)
2173 (clobber (scratch:CC))])
2174 (set (match_dup 4) (clz:GPR (match_dup 3)))
2175 (set (match_operand:GPR 0 "gpc_reg_operand" "")
2176 (minus:GPR (match_dup 5) (match_dup 4)))]
2179 operands[2] = gen_reg_rtx (<MODE>mode);
2180 operands[3] = gen_reg_rtx (<MODE>mode);
2181 operands[4] = gen_reg_rtx (<MODE>mode);
2182 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode));
2185 (define_insn "popcntb<mode>2"
2186 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2187 (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")]
2191 [(set_attr "length" "4")
2192 (set_attr "type" "popcnt")])
2194 (define_insn "popcntd<mode>2"
2195 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2196 (popcount:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
2199 [(set_attr "length" "4")
2200 (set_attr "type" "popcnt")])
2202 (define_expand "popcount<mode>2"
2203 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2204 (popcount:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))]
2205 "TARGET_POPCNTB || TARGET_POPCNTD"
2207 rs6000_emit_popcount (operands[0], operands[1]);
2211 (define_insn "parity<mode>2_cmpb"
2212 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2213 (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")] UNSPEC_PARITY))]
2214 "TARGET_CMPB && TARGET_POPCNTB"
2216 [(set_attr "length" "4")
2217 (set_attr "type" "popcnt")])
2219 (define_expand "parity<mode>2"
2220 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2221 (parity:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))]
2224 rs6000_emit_parity (operands[0], operands[1]);
2228 ;; Since the hardware zeros the upper part of the register, save generating the
2229 ;; AND immediate if we are converting to unsigned
2230 (define_insn "*bswaphi2_extenddi"
2231 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
2233 (bswap:HI (match_operand:HI 1 "memory_operand" "Z"))))]
2236 [(set_attr "length" "4")
2237 (set_attr "type" "load")])
2239 (define_insn "*bswaphi2_extendsi"
2240 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2242 (bswap:HI (match_operand:HI 1 "memory_operand" "Z"))))]
2245 [(set_attr "length" "4")
2246 (set_attr "type" "load")])
2248 (define_expand "bswaphi2"
2249 [(parallel [(set (match_operand:HI 0 "reg_or_mem_operand" "")
2251 (match_operand:HI 1 "reg_or_mem_operand" "")))
2252 (clobber (match_scratch:SI 2 ""))])]
2255 if (!REG_P (operands[0]) && !REG_P (operands[1]))
2256 operands[1] = force_reg (HImode, operands[1]);
2259 (define_insn "bswaphi2_internal"
2260 [(set (match_operand:HI 0 "reg_or_mem_operand" "=r,Z,&r")
2262 (match_operand:HI 1 "reg_or_mem_operand" "Z,r,r")))
2263 (clobber (match_scratch:SI 2 "=X,X,&r"))]
2269 [(set_attr "length" "4,4,12")
2270 (set_attr "type" "load,store,*")])
2272 ;; We are always BITS_BIG_ENDIAN, so the (const_int 16) below is
2273 ;; correct for -mlittle as well as -mbig.
2275 [(set (match_operand:HI 0 "gpc_reg_operand" "")
2276 (bswap:HI (match_operand:HI 1 "gpc_reg_operand" "")))
2277 (clobber (match_operand:SI 2 "gpc_reg_operand" ""))]
2280 (zero_extract:SI (match_dup 4)
2284 (and:SI (ashift:SI (match_dup 4)
2286 (const_int 65280))) ;; 0xff00
2288 (ior:SI (match_dup 3)
2292 operands[3] = simplify_gen_subreg (SImode, operands[0], HImode, 0);
2293 operands[4] = simplify_gen_subreg (SImode, operands[1], HImode, 0);
2296 (define_insn "*bswapsi2_extenddi"
2297 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
2299 (bswap:SI (match_operand:SI 1 "memory_operand" "Z"))))]
2302 [(set_attr "length" "4")
2303 (set_attr "type" "load")])
2305 (define_expand "bswapsi2"
2306 [(set (match_operand:SI 0 "reg_or_mem_operand" "")
2308 (match_operand:SI 1 "reg_or_mem_operand" "")))]
2311 if (!REG_P (operands[0]) && !REG_P (operands[1]))
2312 operands[1] = force_reg (SImode, operands[1]);
2315 (define_insn "*bswapsi2_internal"
2316 [(set (match_operand:SI 0 "reg_or_mem_operand" "=r,Z,&r")
2318 (match_operand:SI 1 "reg_or_mem_operand" "Z,r,r")))]
2324 [(set_attr "length" "4,4,12")
2325 (set_attr "type" "load,store,*")])
2327 ;; We are always BITS_BIG_ENDIAN, so the bit positions below in
2328 ;; zero_extract insns do not change for -mlittle.
2330 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2331 (bswap:SI (match_operand:SI 1 "gpc_reg_operand" "")))]
2334 (rotate:SI (match_dup 1) (const_int 8)))
2335 (set (zero_extract:SI (match_dup 0)
2339 (set (zero_extract:SI (match_dup 0)
2342 (rotate:SI (match_dup 1)
2346 (define_expand "bswapdi2"
2347 [(parallel [(set (match_operand:DI 0 "reg_or_mem_operand" "")
2349 (match_operand:DI 1 "reg_or_mem_operand" "")))
2350 (clobber (match_scratch:DI 2 ""))
2351 (clobber (match_scratch:DI 3 ""))
2352 (clobber (match_scratch:DI 4 ""))])]
2355 if (!REG_P (operands[0]) && !REG_P (operands[1]))
2356 operands[1] = force_reg (DImode, operands[1]);
2358 if (!TARGET_POWERPC64)
2360 /* 32-bit mode needs fewer scratch registers, but 32-bit addressing mode
2361 that uses 64-bit registers needs the same scratch registers as 64-bit
2363 emit_insn (gen_bswapdi2_32bit (operands[0], operands[1]));
2368 ;; Power7/cell has ldbrx/stdbrx, so use it directly
2369 (define_insn "*bswapdi2_ldbrx"
2370 [(set (match_operand:DI 0 "reg_or_mem_operand" "=&r,Z,??&r")
2371 (bswap:DI (match_operand:DI 1 "reg_or_mem_operand" "Z,r,r")))
2372 (clobber (match_scratch:DI 2 "=X,X,&r"))
2373 (clobber (match_scratch:DI 3 "=X,X,&r"))
2374 (clobber (match_scratch:DI 4 "=X,X,&r"))]
2375 "TARGET_POWERPC64 && TARGET_LDBRX
2376 && (REG_P (operands[0]) || REG_P (operands[1]))"
2381 [(set_attr "length" "4,4,36")
2382 (set_attr "type" "load,store,*")])
2384 ;; Non-power7/cell, fall back to use lwbrx/stwbrx
2385 (define_insn "*bswapdi2_64bit"
2386 [(set (match_operand:DI 0 "reg_or_mem_operand" "=&r,Z,&r")
2387 (bswap:DI (match_operand:DI 1 "reg_or_mem_operand" "Z,r,r")))
2388 (clobber (match_scratch:DI 2 "=&b,&b,&r"))
2389 (clobber (match_scratch:DI 3 "=&r,&r,&r"))
2390 (clobber (match_scratch:DI 4 "=&r,X,&r"))]
2391 "TARGET_POWERPC64 && !TARGET_LDBRX
2392 && (REG_P (operands[0]) || REG_P (operands[1]))
2393 && !(MEM_P (operands[0]) && MEM_VOLATILE_P (operands[0]))
2394 && !(MEM_P (operands[1]) && MEM_VOLATILE_P (operands[1]))"
2396 [(set_attr "length" "16,12,36")])
2399 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2400 (bswap:DI (match_operand:DI 1 "indexed_or_indirect_operand" "")))
2401 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
2402 (clobber (match_operand:DI 3 "gpc_reg_operand" ""))
2403 (clobber (match_operand:DI 4 "gpc_reg_operand" ""))]
2404 "TARGET_POWERPC64 && !TARGET_LDBRX && reload_completed"
2408 rtx dest = operands[0];
2409 rtx src = operands[1];
2410 rtx op2 = operands[2];
2411 rtx op3 = operands[3];
2412 rtx op4 = operands[4];
2413 rtx op3_32 = simplify_gen_subreg (SImode, op3, DImode,
2414 BYTES_BIG_ENDIAN ? 4 : 0);
2415 rtx op4_32 = simplify_gen_subreg (SImode, op4, DImode,
2416 BYTES_BIG_ENDIAN ? 4 : 0);
2422 addr1 = XEXP (src, 0);
2423 if (GET_CODE (addr1) == PLUS)
2425 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2426 if (TARGET_AVOID_XFORM)
2428 emit_insn (gen_add3_insn (op2, XEXP (addr1, 1), op2));
2432 addr2 = gen_rtx_PLUS (Pmode, op2, XEXP (addr1, 1));
2434 else if (TARGET_AVOID_XFORM)
2436 emit_insn (gen_add3_insn (op2, addr1, GEN_INT (4)));
2441 emit_move_insn (op2, GEN_INT (4));
2442 addr2 = gen_rtx_PLUS (Pmode, op2, addr1);
2445 if (BYTES_BIG_ENDIAN)
2447 word_high = change_address (src, SImode, addr1);
2448 word_low = change_address (src, SImode, addr2);
2452 word_high = change_address (src, SImode, addr2);
2453 word_low = change_address (src, SImode, addr1);
2456 emit_insn (gen_bswapsi2 (op3_32, word_low));
2457 emit_insn (gen_bswapsi2 (op4_32, word_high));
2458 emit_insn (gen_ashldi3 (dest, op3, GEN_INT (32)));
2459 emit_insn (gen_iordi3 (dest, dest, op4));
2463 [(set (match_operand:DI 0 "indexed_or_indirect_operand" "")
2464 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2465 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
2466 (clobber (match_operand:DI 3 "gpc_reg_operand" ""))
2467 (clobber (match_operand:DI 4 "" ""))]
2468 "TARGET_POWERPC64 && !TARGET_LDBRX && reload_completed"
2472 rtx dest = operands[0];
2473 rtx src = operands[1];
2474 rtx op2 = operands[2];
2475 rtx op3 = operands[3];
2476 rtx src_si = simplify_gen_subreg (SImode, src, DImode,
2477 BYTES_BIG_ENDIAN ? 4 : 0);
2478 rtx op3_si = simplify_gen_subreg (SImode, op3, DImode,
2479 BYTES_BIG_ENDIAN ? 4 : 0);
2485 addr1 = XEXP (dest, 0);
2486 if (GET_CODE (addr1) == PLUS)
2488 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2489 if (TARGET_AVOID_XFORM)
2491 emit_insn (gen_add3_insn (op2, XEXP (addr1, 1), op2));
2495 addr2 = gen_rtx_PLUS (Pmode, op2, XEXP (addr1, 1));
2497 else if (TARGET_AVOID_XFORM)
2499 emit_insn (gen_add3_insn (op2, addr1, GEN_INT (4)));
2504 emit_move_insn (op2, GEN_INT (4));
2505 addr2 = gen_rtx_PLUS (Pmode, op2, addr1);
2508 emit_insn (gen_lshrdi3 (op3, src, GEN_INT (32)));
2509 if (BYTES_BIG_ENDIAN)
2511 word_high = change_address (dest, SImode, addr1);
2512 word_low = change_address (dest, SImode, addr2);
2516 word_high = change_address (dest, SImode, addr2);
2517 word_low = change_address (dest, SImode, addr1);
2519 emit_insn (gen_bswapsi2 (word_high, src_si));
2520 emit_insn (gen_bswapsi2 (word_low, op3_si));
2524 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2525 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2526 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
2527 (clobber (match_operand:DI 3 "gpc_reg_operand" ""))
2528 (clobber (match_operand:DI 4 "" ""))]
2529 "TARGET_POWERPC64 && reload_completed"
2533 rtx dest = operands[0];
2534 rtx src = operands[1];
2535 rtx op2 = operands[2];
2536 rtx op3 = operands[3];
2537 int lo_off = BYTES_BIG_ENDIAN ? 4 : 0;
2538 rtx dest_si = simplify_gen_subreg (SImode, dest, DImode, lo_off);
2539 rtx src_si = simplify_gen_subreg (SImode, src, DImode, lo_off);
2540 rtx op2_si = simplify_gen_subreg (SImode, op2, DImode, lo_off);
2541 rtx op3_si = simplify_gen_subreg (SImode, op3, DImode, lo_off);
2543 emit_insn (gen_lshrdi3 (op2, src, GEN_INT (32)));
2544 emit_insn (gen_bswapsi2 (dest_si, src_si));
2545 emit_insn (gen_bswapsi2 (op3_si, op2_si));
2546 emit_insn (gen_ashldi3 (dest, dest, GEN_INT (32)));
2547 emit_insn (gen_iordi3 (dest, dest, op3));
2550 (define_insn "bswapdi2_32bit"
2551 [(set (match_operand:DI 0 "reg_or_mem_operand" "=&r,Z,&r")
2552 (bswap:DI (match_operand:DI 1 "reg_or_mem_operand" "Z,r,r")))
2553 (clobber (match_scratch:SI 2 "=&b,&b,X"))]
2554 "!TARGET_POWERPC64 && (REG_P (operands[0]) || REG_P (operands[1]))"
2556 [(set_attr "length" "16,12,36")])
2559 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2560 (bswap:DI (match_operand:DI 1 "indexed_or_indirect_operand" "")))
2561 (clobber (match_operand:SI 2 "gpc_reg_operand" ""))]
2562 "!TARGET_POWERPC64 && reload_completed"
2566 rtx dest = operands[0];
2567 rtx src = operands[1];
2568 rtx op2 = operands[2];
2569 rtx dest1 = simplify_gen_subreg (SImode, dest, DImode, 0);
2570 rtx dest2 = simplify_gen_subreg (SImode, dest, DImode, 4);
2576 addr1 = XEXP (src, 0);
2577 if (GET_CODE (addr1) == PLUS)
2579 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2580 if (TARGET_AVOID_XFORM)
2582 emit_insn (gen_add3_insn (op2, XEXP (addr1, 1), op2));
2586 addr2 = gen_rtx_PLUS (SImode, op2, XEXP (addr1, 1));
2588 else if (TARGET_AVOID_XFORM)
2590 emit_insn (gen_add3_insn (op2, addr1, GEN_INT (4)));
2595 emit_move_insn (op2, GEN_INT (4));
2596 addr2 = gen_rtx_PLUS (SImode, op2, addr1);
2599 word1 = change_address (src, SImode, addr1);
2600 word2 = change_address (src, SImode, addr2);
2602 emit_insn (gen_bswapsi2 (dest2, word1));
2603 emit_insn (gen_bswapsi2 (dest1, word2));
2607 [(set (match_operand:DI 0 "indexed_or_indirect_operand" "")
2608 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2609 (clobber (match_operand:SI 2 "gpc_reg_operand" ""))]
2610 "!TARGET_POWERPC64 && reload_completed"
2614 rtx dest = operands[0];
2615 rtx src = operands[1];
2616 rtx op2 = operands[2];
2617 rtx src1 = simplify_gen_subreg (SImode, src, DImode, 0);
2618 rtx src2 = simplify_gen_subreg (SImode, src, DImode, 4);
2624 addr1 = XEXP (dest, 0);
2625 if (GET_CODE (addr1) == PLUS)
2627 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2628 if (TARGET_AVOID_XFORM)
2630 emit_insn (gen_add3_insn (op2, XEXP (addr1, 1), op2));
2634 addr2 = gen_rtx_PLUS (SImode, op2, XEXP (addr1, 1));
2636 else if (TARGET_AVOID_XFORM)
2638 emit_insn (gen_add3_insn (op2, addr1, GEN_INT (4)));
2643 emit_move_insn (op2, GEN_INT (4));
2644 addr2 = gen_rtx_PLUS (SImode, op2, addr1);
2647 word1 = change_address (dest, SImode, addr1);
2648 word2 = change_address (dest, SImode, addr2);
2650 emit_insn (gen_bswapsi2 (word2, src1));
2651 emit_insn (gen_bswapsi2 (word1, src2));
2655 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2656 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2657 (clobber (match_operand:SI 2 "" ""))]
2658 "!TARGET_POWERPC64 && reload_completed"
2662 rtx dest = operands[0];
2663 rtx src = operands[1];
2664 rtx src1 = simplify_gen_subreg (SImode, src, DImode, 0);
2665 rtx src2 = simplify_gen_subreg (SImode, src, DImode, 4);
2666 rtx dest1 = simplify_gen_subreg (SImode, dest, DImode, 0);
2667 rtx dest2 = simplify_gen_subreg (SImode, dest, DImode, 4);
2669 emit_insn (gen_bswapsi2 (dest1, src2));
2670 emit_insn (gen_bswapsi2 (dest2, src1));
2673 (define_insn "mulsi3"
2674 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2675 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2676 (match_operand:SI 2 "reg_or_short_operand" "r,I")))]
2681 [(set_attr "type" "mul")
2683 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
2685 (match_operand:SI 2 "short_cint_operand" "")
2686 (const_string "16")]
2687 (const_string "32")))])
2689 (define_insn "*mulsi3_internal1"
2690 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2691 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2692 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2694 (clobber (match_scratch:SI 3 "=r,r"))]
2699 [(set_attr "type" "mul")
2700 (set_attr "dot" "yes")
2701 (set_attr "length" "4,8")])
2704 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
2705 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2706 (match_operand:SI 2 "gpc_reg_operand" ""))
2708 (clobber (match_scratch:SI 3 ""))]
2709 "TARGET_32BIT && reload_completed"
2711 (mult:SI (match_dup 1) (match_dup 2)))
2713 (compare:CC (match_dup 3)
2717 (define_insn "*mulsi3_internal2"
2718 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2719 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2720 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2722 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2723 (mult:SI (match_dup 1) (match_dup 2)))]
2728 [(set_attr "type" "mul")
2729 (set_attr "dot" "yes")
2730 (set_attr "length" "4,8")])
2733 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
2734 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2735 (match_operand:SI 2 "gpc_reg_operand" ""))
2737 (set (match_operand:SI 0 "gpc_reg_operand" "")
2738 (mult:SI (match_dup 1) (match_dup 2)))]
2739 "TARGET_32BIT && reload_completed"
2741 (mult:SI (match_dup 1) (match_dup 2)))
2743 (compare:CC (match_dup 0)
2748 (define_insn "udiv<mode>3"
2749 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2750 (udiv:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2751 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
2754 [(set_attr "type" "div")
2755 (set_attr "size" "<bits>")])
2758 ;; For powers of two we can do srai/aze for divide and then adjust for
2759 ;; modulus. If it isn't a power of two, force operands into register and do
2761 (define_expand "div<mode>3"
2762 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2763 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2764 (match_operand:GPR 2 "reg_or_cint_operand" "")))]
2767 if (GET_CODE (operands[2]) != CONST_INT
2768 || INTVAL (operands[2]) <= 0
2769 || exact_log2 (INTVAL (operands[2])) < 0)
2770 operands[2] = force_reg (<MODE>mode, operands[2]);
2773 (define_insn "*div<mode>3"
2774 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2775 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2776 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
2779 [(set_attr "type" "div")
2780 (set_attr "size" "<bits>")])
2782 (define_expand "mod<mode>3"
2783 [(use (match_operand:GPR 0 "gpc_reg_operand" ""))
2784 (use (match_operand:GPR 1 "gpc_reg_operand" ""))
2785 (use (match_operand:GPR 2 "reg_or_cint_operand" ""))]
2793 if (GET_CODE (operands[2]) != CONST_INT
2794 || INTVAL (operands[2]) <= 0
2795 || (i = exact_log2 (INTVAL (operands[2]))) < 0)
2798 temp1 = gen_reg_rtx (<MODE>mode);
2799 temp2 = gen_reg_rtx (<MODE>mode);
2801 emit_insn (gen_div<mode>3 (temp1, operands[1], operands[2]));
2802 emit_insn (gen_ashl<mode>3 (temp2, temp1, GEN_INT (i)));
2803 emit_insn (gen_sub<mode>3 (operands[0], operands[1], temp2));
2808 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2809 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2810 (match_operand:GPR 2 "exact_log2_cint_operand" "N")))]
2812 "sra<wd>i %0,%1,%p2\;addze %0,%0"
2813 [(set_attr "type" "two")
2814 (set_attr "length" "8")])
2817 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2818 (compare:CC (div:P (match_operand:P 1 "gpc_reg_operand" "r,r")
2819 (match_operand:P 2 "exact_log2_cint_operand" "N,N"))
2821 (clobber (match_scratch:P 3 "=r,r"))]
2824 sra<wd>i %3,%1,%p2\;addze. %3,%3
2826 [(set_attr "type" "compare")
2827 (set_attr "length" "8,12")
2828 (set_attr "cell_micro" "not")])
2831 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2832 (compare:CC (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2833 (match_operand:GPR 2 "exact_log2_cint_operand"
2836 (clobber (match_scratch:GPR 3 ""))]
2839 (div:<MODE> (match_dup 1) (match_dup 2)))
2841 (compare:CC (match_dup 3)
2846 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2847 (compare:CC (div:P (match_operand:P 1 "gpc_reg_operand" "r,r")
2848 (match_operand:P 2 "exact_log2_cint_operand" "N,N"))
2850 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
2851 (div:P (match_dup 1) (match_dup 2)))]
2854 sra<wd>i %0,%1,%p2\;addze. %0,%0
2856 [(set_attr "type" "compare")
2857 (set_attr "length" "8,12")
2858 (set_attr "cell_micro" "not")])
2861 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2862 (compare:CC (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2863 (match_operand:GPR 2 "exact_log2_cint_operand"
2866 (set (match_operand:GPR 0 "gpc_reg_operand" "")
2867 (div:GPR (match_dup 1) (match_dup 2)))]
2870 (div:<MODE> (match_dup 1) (match_dup 2)))
2872 (compare:CC (match_dup 0)
2876 ;; Logical instructions
2877 ;; The logical instructions are mostly combined by using match_operator,
2878 ;; but the plain AND insns are somewhat different because there is no
2879 ;; plain 'andi' (only 'andi.'), no plain 'andis', and there are all
2880 ;; those rotate-and-mask operations. Thus, the AND insns come first.
2882 (define_expand "andsi3"
2884 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2885 (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2886 (match_operand:SI 2 "and_operand" "")))
2887 (clobber (match_scratch:CC 3 ""))])]
2891 (define_insn "andsi3_mc"
2892 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
2893 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
2894 (match_operand:SI 2 "and_operand" "?r,T,K,L")))
2895 (clobber (match_scratch:CC 3 "=X,X,x,x"))]
2896 "rs6000_gen_cell_microcode"
2899 rlwinm %0,%1,0,%m2,%M2
2902 [(set_attr "type" "*,*,fast_compare,fast_compare")])
2904 (define_insn "andsi3_nomc"
2905 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2906 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2907 (match_operand:SI 2 "and_operand" "?r,T")))
2908 (clobber (match_scratch:CC 3 "=X,X"))]
2909 "!rs6000_gen_cell_microcode"
2912 rlwinm %0,%1,0,%m2,%M2")
2914 (define_insn "andsi3_internal0_nomc"
2915 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2916 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2917 (match_operand:SI 2 "and_operand" "?r,T")))]
2918 "!rs6000_gen_cell_microcode"
2921 rlwinm %0,%1,0,%m2,%M2")
2924 ;; Note to set cr's other than cr0 we do the and immediate and then
2925 ;; the test again -- this avoids a mfcr which on the higher end
2926 ;; machines causes an execution serialization
2928 (define_insn "*andsi3_internal2_mc"
2929 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2930 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2931 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2933 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2934 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2935 "TARGET_32BIT && rs6000_gen_cell_microcode"
2940 rlwinm. %3,%1,0,%m2,%M2
2945 [(set_attr "type" "fast_compare,fast_compare,fast_compare,shift,\
2946 compare,compare,compare,compare")
2947 (set_attr "dot" "yes")
2948 (set_attr "length" "4,4,4,4,8,8,8,8")])
2950 (define_insn "*andsi3_internal3_mc"
2951 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2952 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2953 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2955 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2956 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2957 "TARGET_64BIT && rs6000_gen_cell_microcode"
2962 rlwinm. %3,%1,0,%m2,%M2
2967 [(set_attr "type" "compare,fast_compare,fast_compare,shift,compare,\
2968 compare,compare,compare")
2969 (set_attr "dot" "yes")
2970 (set_attr "length" "8,4,4,4,8,8,8,8")])
2973 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
2974 (compare:CC (and:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2975 (match_operand:GPR 2 "and_operand" ""))
2977 (clobber (match_scratch:GPR 3 ""))
2978 (clobber (match_scratch:CC 4 ""))]
2980 [(parallel [(set (match_dup 3)
2981 (and:<MODE> (match_dup 1)
2983 (clobber (match_dup 4))])
2985 (compare:CC (match_dup 3)
2989 ;; We don't have a 32 bit "and. rt,ra,rb" for ppc64. cr is set from the
2990 ;; whole 64 bit reg, and we don't know what is in the high 32 bits.
2993 [(set (match_operand:CC 0 "cc_reg_operand" "")
2994 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2995 (match_operand:SI 2 "gpc_reg_operand" ""))
2997 (clobber (match_scratch:SI 3 ""))
2998 (clobber (match_scratch:CC 4 ""))]
2999 "TARGET_POWERPC64 && reload_completed"
3000 [(parallel [(set (match_dup 3)
3001 (and:SI (match_dup 1)
3003 (clobber (match_dup 4))])
3005 (compare:CC (match_dup 3)
3009 (define_insn "*andsi3_internal4"
3010 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
3011 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
3012 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
3014 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
3015 (and:SI (match_dup 1)
3017 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
3018 "TARGET_32BIT && rs6000_gen_cell_microcode"
3023 rlwinm. %0,%1,0,%m2,%M2
3028 [(set_attr "type" "fast_compare,fast_compare,fast_compare,shift,\
3029 compare,compare,compare,compare")
3030 (set_attr "dot" "yes")
3031 (set_attr "length" "4,4,4,4,8,8,8,8")])
3033 (define_insn "*andsi3_internal5_mc"
3034 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
3035 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
3036 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
3038 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
3039 (and:SI (match_dup 1)
3041 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
3042 "TARGET_64BIT && rs6000_gen_cell_microcode"
3047 rlwinm. %0,%1,0,%m2,%M2
3052 [(set_attr "type" "compare,fast_compare,fast_compare,shift,compare,\
3053 compare,compare,compare")
3054 (set_attr "dot" "yes")
3055 (set_attr "length" "8,4,4,4,8,8,8,8")])
3058 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3059 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
3060 (match_operand:SI 2 "and_operand" ""))
3062 (set (match_operand:SI 0 "gpc_reg_operand" "")
3063 (and:SI (match_dup 1)
3065 (clobber (match_scratch:CC 4 ""))]
3067 [(parallel [(set (match_dup 0)
3068 (and:SI (match_dup 1)
3070 (clobber (match_dup 4))])
3072 (compare:CC (match_dup 0)
3077 [(set (match_operand:CC 3 "cc_reg_operand" "")
3078 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
3079 (match_operand:SI 2 "gpc_reg_operand" ""))
3081 (set (match_operand:SI 0 "gpc_reg_operand" "")
3082 (and:SI (match_dup 1)
3084 (clobber (match_scratch:CC 4 ""))]
3085 "TARGET_POWERPC64 && reload_completed"
3086 [(parallel [(set (match_dup 0)
3087 (and:SI (match_dup 1)
3089 (clobber (match_dup 4))])
3091 (compare:CC (match_dup 0)
3095 ;; Handle the PowerPC64 rlwinm corner case
3097 (define_insn_and_split "*andsi3_internal6"
3098 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3099 (and:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3100 (match_operand:SI 2 "mask_operand_wrap" "i")))]
3105 (and:SI (rotate:SI (match_dup 1) (match_dup 3))
3108 (rotate:SI (match_dup 0) (match_dup 5)))]
3111 int mb = extract_MB (operands[2]);
3112 int me = extract_ME (operands[2]);
3113 operands[3] = GEN_INT (me + 1);
3114 operands[5] = GEN_INT (32 - (me + 1));
3115 operands[4] = GEN_INT (~((HOST_WIDE_INT) -1 << (33 + me - mb)));
3117 [(set_attr "length" "8")])
3119 (define_expand "iorsi3"
3120 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3121 (ior:SI (match_operand:SI 1 "gpc_reg_operand" "")
3122 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
3126 if (GET_CODE (operands[2]) == CONST_INT
3127 && ! logical_operand (operands[2], SImode))
3129 HOST_WIDE_INT value = INTVAL (operands[2]);
3130 rtx tmp = ((!can_create_pseudo_p ()
3131 || rtx_equal_p (operands[0], operands[1]))
3132 ? operands[0] : gen_reg_rtx (SImode));
3134 emit_insn (gen_iorsi3 (tmp, operands[1],
3135 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
3136 emit_insn (gen_iorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
3141 (define_expand "xorsi3"
3142 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3143 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
3144 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
3148 if (GET_CODE (operands[2]) == CONST_INT
3149 && ! logical_operand (operands[2], SImode))
3151 HOST_WIDE_INT value = INTVAL (operands[2]);
3152 rtx tmp = ((!can_create_pseudo_p ()
3153 || rtx_equal_p (operands[0], operands[1]))
3154 ? operands[0] : gen_reg_rtx (SImode));
3156 emit_insn (gen_xorsi3 (tmp, operands[1],
3157 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
3158 emit_insn (gen_xorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
3163 (define_insn "*boolsi3_internal1"
3164 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
3165 (match_operator:SI 3 "boolean_or_operator"
3166 [(match_operand:SI 1 "gpc_reg_operand" "%r,r,r")
3167 (match_operand:SI 2 "logical_operand" "r,K,L")]))]
3174 (define_insn "*boolsi3_internal2"
3175 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3176 (compare:CC (match_operator:SI 4 "boolean_or_operator"
3177 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
3178 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3180 (clobber (match_scratch:SI 3 "=r,r"))]
3185 [(set_attr "type" "fast_compare,compare")
3186 (set_attr "length" "4,8")])
3189 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3190 (compare:CC (match_operator:SI 4 "boolean_operator"
3191 [(match_operand:SI 1 "gpc_reg_operand" "")
3192 (match_operand:SI 2 "gpc_reg_operand" "")])
3194 (clobber (match_scratch:SI 3 ""))]
3195 "TARGET_32BIT && reload_completed"
3196 [(set (match_dup 3) (match_dup 4))
3198 (compare:CC (match_dup 3)
3202 (define_insn "*boolsi3_internal3"
3203 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3204 (compare:CC (match_operator:SI 4 "boolean_operator"
3205 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
3206 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3208 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3214 [(set_attr "type" "fast_compare,compare")
3215 (set_attr "length" "4,8")])
3218 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3219 (compare:CC (match_operator:SI 4 "boolean_operator"
3220 [(match_operand:SI 1 "gpc_reg_operand" "")
3221 (match_operand:SI 2 "gpc_reg_operand" "")])
3223 (set (match_operand:SI 0 "gpc_reg_operand" "")
3225 "TARGET_32BIT && reload_completed"
3226 [(set (match_dup 0) (match_dup 4))
3228 (compare:CC (match_dup 0)
3232 ;; Split a logical operation that we can't do in one insn into two insns,
3233 ;; each of which does one 16-bit part. This is used by combine.
3236 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3237 (match_operator:SI 3 "boolean_or_operator"
3238 [(match_operand:SI 1 "gpc_reg_operand" "")
3239 (match_operand:SI 2 "non_logical_cint_operand" "")]))]
3241 [(set (match_dup 0) (match_dup 4))
3242 (set (match_dup 0) (match_dup 5))]
3246 i = GEN_INT (INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff));
3247 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
3249 i = GEN_INT (INTVAL (operands[2]) & 0xffff);
3250 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
3254 (define_insn "*boolcsi3_internal1"
3255 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3256 (match_operator:SI 3 "boolean_operator"
3257 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
3258 (match_operand:SI 2 "gpc_reg_operand" "r")]))]
3262 (define_insn "*boolcsi3_internal2"
3263 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3264 (compare:CC (match_operator:SI 4 "boolean_operator"
3265 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
3266 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3268 (clobber (match_scratch:SI 3 "=r,r"))]
3273 [(set_attr "type" "compare")
3274 (set_attr "length" "4,8")])
3277 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3278 (compare:CC (match_operator:SI 4 "boolean_operator"
3279 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3280 (match_operand:SI 2 "gpc_reg_operand" "")])
3282 (clobber (match_scratch:SI 3 ""))]
3283 "TARGET_32BIT && reload_completed"
3284 [(set (match_dup 3) (match_dup 4))
3286 (compare:CC (match_dup 3)
3290 (define_insn "*boolcsi3_internal3"
3291 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3292 (compare:CC (match_operator:SI 4 "boolean_operator"
3293 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
3294 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3296 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3302 [(set_attr "type" "compare")
3303 (set_attr "length" "4,8")])
3306 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3307 (compare:CC (match_operator:SI 4 "boolean_operator"
3308 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3309 (match_operand:SI 2 "gpc_reg_operand" "")])
3311 (set (match_operand:SI 0 "gpc_reg_operand" "")
3313 "TARGET_32BIT && reload_completed"
3314 [(set (match_dup 0) (match_dup 4))
3316 (compare:CC (match_dup 0)
3320 (define_insn "*boolccsi3_internal1"
3321 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3322 (match_operator:SI 3 "boolean_operator"
3323 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
3324 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))]))]
3328 (define_insn "*boolccsi3_internal2"
3329 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3330 (compare:CC (match_operator:SI 4 "boolean_operator"
3331 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
3332 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
3334 (clobber (match_scratch:SI 3 "=r,r"))]
3339 [(set_attr "type" "fast_compare,compare")
3340 (set_attr "length" "4,8")])
3343 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3344 (compare:CC (match_operator:SI 4 "boolean_operator"
3345 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3346 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
3348 (clobber (match_scratch:SI 3 ""))]
3349 "TARGET_32BIT && reload_completed"
3350 [(set (match_dup 3) (match_dup 4))
3352 (compare:CC (match_dup 3)
3356 (define_insn "*boolccsi3_internal3"
3357 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3358 (compare:CC (match_operator:SI 4 "boolean_operator"
3359 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
3360 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
3362 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3368 [(set_attr "type" "fast_compare,compare")
3369 (set_attr "length" "4,8")])
3372 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3373 (compare:CC (match_operator:SI 4 "boolean_operator"
3374 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3375 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
3377 (set (match_operand:SI 0 "gpc_reg_operand" "")
3379 "TARGET_32BIT && reload_completed"
3380 [(set (match_dup 0) (match_dup 4))
3382 (compare:CC (match_dup 0)
3386 ;; Rotate and shift insns, in all their variants. These support shifts,
3387 ;; field inserts and extracts, and various combinations thereof.
3388 (define_expand "insv"
3389 [(set (zero_extract (match_operand 0 "gpc_reg_operand" "")
3390 (match_operand:SI 1 "const_int_operand" "")
3391 (match_operand:SI 2 "const_int_operand" ""))
3392 (match_operand 3 "gpc_reg_operand" ""))]
3396 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3397 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3398 compiler if the address of the structure is taken later. Likewise, do
3399 not handle invalid E500 subregs. */
3400 if (GET_CODE (operands[0]) == SUBREG
3401 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD
3402 || ((TARGET_E500_DOUBLE || TARGET_SPE)
3403 && invalid_e500_subreg (operands[0], GET_MODE (operands[0])))))
3406 if (TARGET_POWERPC64 && GET_MODE (operands[0]) == DImode)
3407 emit_insn (gen_insvdi_internal (operands[0], operands[1], operands[2],
3410 emit_insn (gen_insvsi_internal (operands[0], operands[1], operands[2],
3415 (define_insn "insvsi_internal"
3416 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3417 (match_operand:SI 1 "const_int_operand" "i")
3418 (match_operand:SI 2 "const_int_operand" "i"))
3419 (match_operand:SI 3 "gpc_reg_operand" "r"))]
3423 int start = INTVAL (operands[2]) & 31;
3424 int size = INTVAL (operands[1]) & 31;
3426 operands[4] = GEN_INT (32 - start - size);
3427 operands[1] = GEN_INT (start + size - 1);
3428 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3430 [(set_attr "type" "insert")])
3432 (define_insn "*insvsi_internal1"
3433 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3434 (match_operand:SI 1 "const_int_operand" "i")
3435 (match_operand:SI 2 "const_int_operand" "i"))
3436 (rotate:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3437 (match_operand:SI 4 "const_int_operand" "i")))]
3438 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3441 int shift = INTVAL (operands[4]) & 31;
3442 int start = INTVAL (operands[2]) & 31;
3443 int size = INTVAL (operands[1]) & 31;
3445 operands[4] = GEN_INT (shift - start - size);
3446 operands[1] = GEN_INT (start + size - 1);
3447 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3449 [(set_attr "type" "insert")])
3451 (define_insn "*insvsi_internal2"
3452 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3453 (match_operand:SI 1 "const_int_operand" "i")
3454 (match_operand:SI 2 "const_int_operand" "i"))
3455 (ashiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3456 (match_operand:SI 4 "const_int_operand" "i")))]
3457 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3460 int shift = INTVAL (operands[4]) & 31;
3461 int start = INTVAL (operands[2]) & 31;
3462 int size = INTVAL (operands[1]) & 31;
3464 operands[4] = GEN_INT (32 - shift - start - size);
3465 operands[1] = GEN_INT (start + size - 1);
3466 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3468 [(set_attr "type" "insert")])
3470 (define_insn "*insvsi_internal3"
3471 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3472 (match_operand:SI 1 "const_int_operand" "i")
3473 (match_operand:SI 2 "const_int_operand" "i"))
3474 (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3475 (match_operand:SI 4 "const_int_operand" "i")))]
3476 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3479 int shift = INTVAL (operands[4]) & 31;
3480 int start = INTVAL (operands[2]) & 31;
3481 int size = INTVAL (operands[1]) & 31;
3483 operands[4] = GEN_INT (32 - shift - start - size);
3484 operands[1] = GEN_INT (start + size - 1);
3485 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3487 [(set_attr "type" "insert")])
3489 (define_insn "*insvsi_internal4"
3490 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3491 (match_operand:SI 1 "const_int_operand" "i")
3492 (match_operand:SI 2 "const_int_operand" "i"))
3493 (zero_extract:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3494 (match_operand:SI 4 "const_int_operand" "i")
3495 (match_operand:SI 5 "const_int_operand" "i")))]
3496 "INTVAL (operands[4]) >= INTVAL (operands[1])"
3499 int extract_start = INTVAL (operands[5]) & 31;
3500 int extract_size = INTVAL (operands[4]) & 31;
3501 int insert_start = INTVAL (operands[2]) & 31;
3502 int insert_size = INTVAL (operands[1]) & 31;
3504 /* Align extract field with insert field */
3505 operands[5] = GEN_INT (extract_start + extract_size - insert_start - insert_size);
3506 operands[1] = GEN_INT (insert_start + insert_size - 1);
3507 return \"rlwimi %0,%3,%h5,%h2,%h1\";
3509 [(set_attr "type" "insert")])
3511 ;; combine patterns for rlwimi
3512 (define_insn "*insvsi_internal5"
3513 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3514 (ior:SI (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
3515 (match_operand:SI 1 "mask_operand" "i"))
3516 (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3517 (match_operand:SI 2 "const_int_operand" "i"))
3518 (match_operand:SI 5 "mask_operand" "i"))))]
3519 "INTVAL(operands[1]) == ~INTVAL(operands[5])"
3522 int me = extract_ME(operands[5]);
3523 int mb = extract_MB(operands[5]);
3524 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
3525 operands[2] = GEN_INT(mb);
3526 operands[1] = GEN_INT(me);
3527 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3529 [(set_attr "type" "insert")])
3531 (define_insn "*insvsi_internal6"
3532 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3533 (ior:SI (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3534 (match_operand:SI 2 "const_int_operand" "i"))
3535 (match_operand:SI 5 "mask_operand" "i"))
3536 (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
3537 (match_operand:SI 1 "mask_operand" "i"))))]
3538 "INTVAL(operands[1]) == ~INTVAL(operands[5])"
3541 int me = extract_ME(operands[5]);
3542 int mb = extract_MB(operands[5]);
3543 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
3544 operands[2] = GEN_INT(mb);
3545 operands[1] = GEN_INT(me);
3546 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3548 [(set_attr "type" "insert")])
3550 (define_insn "insvdi_internal"
3551 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3552 (match_operand:SI 1 "const_int_operand" "i")
3553 (match_operand:SI 2 "const_int_operand" "i"))
3554 (match_operand:DI 3 "gpc_reg_operand" "r"))]
3558 int start = INTVAL (operands[2]) & 63;
3559 int size = INTVAL (operands[1]) & 63;
3561 operands[1] = GEN_INT (64 - start - size);
3562 return \"rldimi %0,%3,%H1,%H2\";
3564 [(set_attr "type" "insert")
3565 (set_attr "size" "64")])
3567 (define_insn "*insvdi_internal2"
3568 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3569 (match_operand:SI 1 "const_int_operand" "i")
3570 (match_operand:SI 2 "const_int_operand" "i"))
3571 (ashiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
3572 (match_operand:SI 4 "const_int_operand" "i")))]
3574 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
3577 int shift = INTVAL (operands[4]) & 63;
3578 int start = (INTVAL (operands[2]) & 63) - 32;
3579 int size = INTVAL (operands[1]) & 63;
3581 operands[4] = GEN_INT (64 - shift - start - size);
3582 operands[2] = GEN_INT (start);
3583 operands[1] = GEN_INT (start + size - 1);
3584 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3587 (define_insn "*insvdi_internal3"
3588 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3589 (match_operand:SI 1 "const_int_operand" "i")
3590 (match_operand:SI 2 "const_int_operand" "i"))
3591 (lshiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
3592 (match_operand:SI 4 "const_int_operand" "i")))]
3594 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
3597 int shift = INTVAL (operands[4]) & 63;
3598 int start = (INTVAL (operands[2]) & 63) - 32;
3599 int size = INTVAL (operands[1]) & 63;
3601 operands[4] = GEN_INT (64 - shift - start - size);
3602 operands[2] = GEN_INT (start);
3603 operands[1] = GEN_INT (start + size - 1);
3604 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3607 (define_expand "extzv"
3608 [(set (match_operand 0 "gpc_reg_operand" "")
3609 (zero_extract (match_operand 1 "gpc_reg_operand" "")
3610 (match_operand:SI 2 "const_int_operand" "")
3611 (match_operand:SI 3 "const_int_operand" "")))]
3615 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3616 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3617 compiler if the address of the structure is taken later. */
3618 if (GET_CODE (operands[0]) == SUBREG
3619 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
3622 if (TARGET_POWERPC64 && GET_MODE (operands[1]) == DImode)
3623 emit_insn (gen_extzvdi_internal (operands[0], operands[1], operands[2],
3626 emit_insn (gen_extzvsi_internal (operands[0], operands[1], operands[2],
3631 (define_insn "extzvsi_internal"
3632 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3633 (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3634 (match_operand:SI 2 "const_int_operand" "i")
3635 (match_operand:SI 3 "const_int_operand" "i")))]
3639 int start = INTVAL (operands[3]) & 31;
3640 int size = INTVAL (operands[2]) & 31;
3642 if (start + size >= 32)
3643 operands[3] = const0_rtx;
3645 operands[3] = GEN_INT (start + size);
3646 return \"rlwinm %0,%1,%3,%s2,31\";
3649 (define_insn "*extzvsi_internal1"
3650 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3651 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3652 (match_operand:SI 2 "const_int_operand" "i,i")
3653 (match_operand:SI 3 "const_int_operand" "i,i"))
3655 (clobber (match_scratch:SI 4 "=r,r"))]
3659 int start = INTVAL (operands[3]) & 31;
3660 int size = INTVAL (operands[2]) & 31;
3662 /* Force split for non-cc0 compare. */
3663 if (which_alternative == 1)
3666 /* If the bit-field being tested fits in the upper or lower half of a
3667 word, it is possible to use andiu. or andil. to test it. This is
3668 useful because the condition register set-use delay is smaller for
3669 andi[ul]. than for rlinm. This doesn't work when the starting bit
3670 position is 0 because the LT and GT bits may be set wrong. */
3672 if ((start > 0 && start + size <= 16) || start >= 16)
3674 operands[3] = GEN_INT (((1 << (16 - (start & 15)))
3675 - (1 << (16 - (start & 15) - size))));
3677 return \"andis. %4,%1,%3\";
3679 return \"andi. %4,%1,%3\";
3682 if (start + size >= 32)
3683 operands[3] = const0_rtx;
3685 operands[3] = GEN_INT (start + size);
3686 return \"rlwinm. %4,%1,%3,%s2,31\";
3688 [(set_attr "type" "shift")
3689 (set_attr "dot" "yes")
3690 (set_attr "length" "4,8")])
3693 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3694 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3695 (match_operand:SI 2 "const_int_operand" "")
3696 (match_operand:SI 3 "const_int_operand" ""))
3698 (clobber (match_scratch:SI 4 ""))]
3701 (zero_extract:SI (match_dup 1) (match_dup 2)
3704 (compare:CC (match_dup 4)
3708 (define_insn "*extzvsi_internal2"
3709 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3710 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3711 (match_operand:SI 2 "const_int_operand" "i,i")
3712 (match_operand:SI 3 "const_int_operand" "i,i"))
3714 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3715 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3719 int start = INTVAL (operands[3]) & 31;
3720 int size = INTVAL (operands[2]) & 31;
3722 /* Force split for non-cc0 compare. */
3723 if (which_alternative == 1)
3726 /* Since we are using the output value, we can't ignore any need for
3727 a shift. The bit-field must end at the LSB. */
3728 if (start >= 16 && start + size == 32)
3730 operands[3] = GEN_INT ((1 << size) - 1);
3731 return \"andi. %0,%1,%3\";
3734 if (start + size >= 32)
3735 operands[3] = const0_rtx;
3737 operands[3] = GEN_INT (start + size);
3738 return \"rlwinm. %0,%1,%3,%s2,31\";
3740 [(set_attr "type" "shift")
3741 (set_attr "dot" "yes")
3742 (set_attr "length" "4,8")])
3745 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
3746 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3747 (match_operand:SI 2 "const_int_operand" "")
3748 (match_operand:SI 3 "const_int_operand" ""))
3750 (set (match_operand:SI 0 "gpc_reg_operand" "")
3751 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3754 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))
3756 (compare:CC (match_dup 0)
3760 (define_insn "extzvdi_internal"
3761 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
3762 (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3763 (match_operand:SI 2 "const_int_operand" "i")
3764 (match_operand:SI 3 "const_int_operand" "i")))]
3768 int start = INTVAL (operands[3]) & 63;
3769 int size = INTVAL (operands[2]) & 63;
3771 if (start + size >= 64)
3772 operands[3] = const0_rtx;
3774 operands[3] = GEN_INT (start + size);
3775 operands[2] = GEN_INT (64 - size);
3776 return \"rldicl %0,%1,%3,%2\";
3779 (define_insn "*extzvdi_internal1"
3780 [(set (match_operand:CC 0 "gpc_reg_operand" "=x")
3781 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3782 (match_operand:SI 2 "const_int_operand" "i")
3783 (match_operand:SI 3 "const_int_operand" "i"))
3785 (clobber (match_scratch:DI 4 "=r"))]
3786 "TARGET_64BIT && rs6000_gen_cell_microcode"
3789 int start = INTVAL (operands[3]) & 63;
3790 int size = INTVAL (operands[2]) & 63;
3792 if (start + size >= 64)
3793 operands[3] = const0_rtx;
3795 operands[3] = GEN_INT (start + size);
3796 operands[2] = GEN_INT (64 - size);
3797 return \"rldicl. %4,%1,%3,%2\";
3799 [(set_attr "type" "compare")])
3801 (define_insn "*extzvdi_internal2"
3802 [(set (match_operand:CC 4 "gpc_reg_operand" "=x")
3803 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3804 (match_operand:SI 2 "const_int_operand" "i")
3805 (match_operand:SI 3 "const_int_operand" "i"))
3807 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
3808 (zero_extract:DI (match_dup 1) (match_dup 2) (match_dup 3)))]
3809 "TARGET_64BIT && rs6000_gen_cell_microcode"
3812 int start = INTVAL (operands[3]) & 63;
3813 int size = INTVAL (operands[2]) & 63;
3815 if (start + size >= 64)
3816 operands[3] = const0_rtx;
3818 operands[3] = GEN_INT (start + size);
3819 operands[2] = GEN_INT (64 - size);
3820 return \"rldicl. %0,%1,%3,%2\";
3822 [(set_attr "type" "compare")])
3824 (define_insn "rotlsi3"
3825 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3826 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3827 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
3830 rlwnm %0,%1,%2,0xffffffff
3831 rlwinm %0,%1,%h2,0xffffffff"
3832 [(set_attr "type" "shift,integer")
3833 (set_attr "var_shift" "yes,no")])
3835 (define_insn "*rotlsi3_64"
3836 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
3838 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3839 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))))]
3842 rlwnm %0,%1,%2,0xffffffff
3843 rlwinm %0,%1,%h2,0xffffffff"
3844 [(set_attr "type" "shift,integer")
3845 (set_attr "var_shift" "yes,no")])
3847 (define_insn "*rotlsi3_internal2"
3848 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3849 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3850 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3852 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
3855 rlwnm. %3,%1,%2,0xffffffff
3856 rlwinm. %3,%1,%h2,0xffffffff
3859 [(set_attr "type" "shift")
3860 (set_attr "var_shift" "yes,no,yes,no")
3861 (set_attr "dot" "yes")
3862 (set_attr "length" "4,4,8,8")])
3865 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3866 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3867 (match_operand:SI 2 "reg_or_cint_operand" ""))
3869 (clobber (match_scratch:SI 3 ""))]
3872 (rotate:SI (match_dup 1) (match_dup 2)))
3874 (compare:CC (match_dup 3)
3878 (define_insn "*rotlsi3_internal3"
3879 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
3880 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3881 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3883 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
3884 (rotate:SI (match_dup 1) (match_dup 2)))]
3887 rlwnm. %0,%1,%2,0xffffffff
3888 rlwinm. %0,%1,%h2,0xffffffff
3891 [(set_attr "type" "shift")
3892 (set_attr "var_shift" "yes,no,yes,no")
3893 (set_attr "dot" "yes")
3894 (set_attr "length" "4,4,8,8")])
3897 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3898 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3899 (match_operand:SI 2 "reg_or_cint_operand" ""))
3901 (set (match_operand:SI 0 "gpc_reg_operand" "")
3902 (rotate:SI (match_dup 1) (match_dup 2)))]
3905 (rotate:SI (match_dup 1) (match_dup 2)))
3907 (compare:CC (match_dup 0)
3911 (define_insn "*rotlsi3_internal4"
3912 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3913 (and:SI (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3914 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
3915 (match_operand:SI 3 "mask_operand" "n,n")))]
3918 rlwnm %0,%1,%2,%m3,%M3
3919 rlwinm %0,%1,%h2,%m3,%M3"
3920 [(set_attr "type" "shift,integer")
3921 (set_attr "var_shift" "yes,no")])
3923 (define_insn "*rotlsi3_internal5"
3924 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3926 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3927 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3928 (match_operand:SI 3 "mask_operand" "n,n,n,n"))
3930 (clobber (match_scratch:SI 4 "=r,r,r,r"))]
3933 rlwnm. %4,%1,%2,%m3,%M3
3934 rlwinm. %4,%1,%h2,%m3,%M3
3937 [(set_attr "type" "shift")
3938 (set_attr "var_shift" "yes,no,yes,no")
3939 (set_attr "dot" "yes")
3940 (set_attr "length" "4,4,8,8")])
3943 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3945 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3946 (match_operand:SI 2 "reg_or_cint_operand" ""))
3947 (match_operand:SI 3 "mask_operand" ""))
3949 (clobber (match_scratch:SI 4 ""))]
3952 (and:SI (rotate:SI (match_dup 1)
3956 (compare:CC (match_dup 4)
3960 (define_insn "*rotlsi3_internal6"
3961 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
3963 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3964 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3965 (match_operand:SI 3 "mask_operand" "n,n,n,n"))
3967 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
3968 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3971 rlwnm. %0,%1,%2,%m3,%M3
3972 rlwinm. %0,%1,%h2,%m3,%M3
3975 [(set_attr "type" "shift")
3976 (set_attr "var_shift" "yes,no,yes,no")
3977 (set_attr "dot" "yes")
3978 (set_attr "length" "4,4,8,8")])
3981 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
3983 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3984 (match_operand:SI 2 "reg_or_cint_operand" ""))
3985 (match_operand:SI 3 "mask_operand" ""))
3987 (set (match_operand:SI 0 "gpc_reg_operand" "")
3988 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3991 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
3993 (compare:CC (match_dup 0)
3997 (define_insn "*rotlsi3_internal7le"
3998 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4001 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4002 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
4004 "rlw%I2nm %0,%1,%h2,0xff"
4005 [(set (attr "cell_micro")
4006 (if_then_else (match_operand:SI 2 "const_int_operand" "")
4007 (const_string "not")
4008 (const_string "always")))])
4010 (define_insn "*rotlsi3_internal7be"
4011 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4014 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4015 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 3)))]
4017 "rlw%I2nm %0,%1,%h2,0xff"
4018 [(set (attr "cell_micro")
4019 (if_then_else (match_operand:SI 2 "const_int_operand" "")
4020 (const_string "not")
4021 (const_string "always")))])
4023 (define_insn "*rotlsi3_internal8le"
4024 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4025 (compare:CC (zero_extend:SI
4027 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4028 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4030 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4033 rlwnm. %3,%1,%2,0xff
4034 rlwinm. %3,%1,%h2,0xff
4037 [(set_attr "type" "shift")
4038 (set_attr "var_shift" "yes,no,yes,no")
4039 (set_attr "dot" "yes")
4040 (set_attr "length" "4,4,8,8")])
4042 (define_insn "*rotlsi3_internal8be"
4043 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4044 (compare:CC (zero_extend:SI
4046 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4047 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 3))
4049 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4052 rlwnm. %3,%1,%2,0xff
4053 rlwinm. %3,%1,%h2,0xff
4056 [(set_attr "type" "shift")
4057 (set_attr "var_shift" "yes,no,yes,no")
4058 (set_attr "dot" "yes")
4059 (set_attr "length" "4,4,8,8")])
4062 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4063 (compare:CC (zero_extend:SI
4065 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4066 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4068 (clobber (match_scratch:SI 3 ""))]
4069 "!BYTES_BIG_ENDIAN && reload_completed"
4071 (zero_extend:SI (subreg:QI
4072 (rotate:SI (match_dup 1)
4075 (compare:CC (match_dup 3)
4080 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4081 (compare:CC (zero_extend:SI
4083 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4084 (match_operand:SI 2 "reg_or_cint_operand" "")) 3))
4086 (clobber (match_scratch:SI 3 ""))]
4087 "BYTES_BIG_ENDIAN && reload_completed"
4089 (zero_extend:SI (subreg:QI
4090 (rotate:SI (match_dup 1)
4093 (compare:CC (match_dup 3)
4097 (define_insn "*rotlsi3_internal9le"
4098 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4099 (compare:CC (zero_extend:SI
4101 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4102 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4104 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4105 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4108 rlwnm. %0,%1,%2,0xff
4109 rlwinm. %0,%1,%h2,0xff
4112 [(set_attr "type" "shift")
4113 (set_attr "var_shift" "yes,no,yes,no")
4114 (set_attr "dot" "yes")
4115 (set_attr "length" "4,4,8,8")])
4117 (define_insn "*rotlsi3_internal9be"
4118 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4119 (compare:CC (zero_extend:SI
4121 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4122 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 3))
4124 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4125 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 3)))]
4128 rlwnm. %0,%1,%2,0xff
4129 rlwinm. %0,%1,%h2,0xff
4132 [(set_attr "type" "shift")
4133 (set_attr "var_shift" "yes,no,yes,no")
4134 (set_attr "dot" "yes")
4135 (set_attr "length" "4,4,8,8")])
4138 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4139 (compare:CC (zero_extend:SI
4141 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4142 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4144 (set (match_operand:SI 0 "gpc_reg_operand" "")
4145 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4146 "!BYTES_BIG_ENDIAN && reload_completed"
4148 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
4150 (compare:CC (match_dup 0)
4155 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4156 (compare:CC (zero_extend:SI
4158 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4159 (match_operand:SI 2 "reg_or_cint_operand" "")) 3))
4161 (set (match_operand:SI 0 "gpc_reg_operand" "")
4162 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 3)))]
4163 "BYTES_BIG_ENDIAN && reload_completed"
4165 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 3)))
4167 (compare:CC (match_dup 0)
4171 (define_insn "*rotlsi3_internal10le"
4172 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4175 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4176 (match_operand:SI 2 "reg_or_cint_operand" "r,i")) 0)))]
4179 rlwnm %0,%1,%2,0xffff
4180 rlwinm %0,%1,%h2,0xffff"
4181 [(set_attr "type" "shift,integer")
4182 (set_attr "var_shift" "yes,no")])
4184 (define_insn "*rotlsi3_internal10be"
4185 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4188 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4189 (match_operand:SI 2 "reg_or_cint_operand" "r,i")) 2)))]
4192 rlwnm %0,%1,%2,0xffff
4193 rlwinm %0,%1,%h2,0xffff"
4194 [(set_attr "type" "shift,integer")
4195 (set_attr "var_shift" "yes,no")])
4197 (define_insn "*rotlsi3_internal11le"
4198 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4199 (compare:CC (zero_extend:SI
4201 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4202 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4204 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4207 rlwnm. %3,%1,%2,0xffff
4208 rlwinm. %3,%1,%h2,0xffff
4211 [(set_attr "type" "shift")
4212 (set_attr "var_shift" "yes,no,yes,no")
4213 (set_attr "dot" "yes")
4214 (set_attr "length" "4,4,8,8")])
4216 (define_insn "*rotlsi3_internal11be"
4217 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4218 (compare:CC (zero_extend:SI
4220 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4221 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 2))
4223 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4226 rlwnm. %3,%1,%2,0xffff
4227 rlwinm. %3,%1,%h2,0xffff
4230 [(set_attr "type" "shift")
4231 (set_attr "var_shift" "yes,no,yes,no")
4232 (set_attr "dot" "yes")
4233 (set_attr "length" "4,4,8,8")])
4236 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4237 (compare:CC (zero_extend:SI
4239 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4240 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4242 (clobber (match_scratch:SI 3 ""))]
4243 "!BYTES_BIG_ENDIAN && reload_completed"
4245 (zero_extend:SI (subreg:HI
4246 (rotate:SI (match_dup 1)
4249 (compare:CC (match_dup 3)
4254 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4255 (compare:CC (zero_extend:SI
4257 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4258 (match_operand:SI 2 "reg_or_cint_operand" "")) 2))
4260 (clobber (match_scratch:SI 3 ""))]
4261 "BYTES_BIG_ENDIAN && reload_completed"
4263 (zero_extend:SI (subreg:HI
4264 (rotate:SI (match_dup 1)
4267 (compare:CC (match_dup 3)
4271 (define_insn "*rotlsi3_internal12le"
4272 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4273 (compare:CC (zero_extend:SI
4275 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4276 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4278 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4279 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4282 rlwnm. %0,%1,%2,0xffff
4283 rlwinm. %0,%1,%h2,0xffff
4286 [(set_attr "type" "shift")
4287 (set_attr "var_shift" "yes,no,yes,no")
4288 (set_attr "dot" "yes")
4289 (set_attr "length" "4,4,8,8")])
4291 (define_insn "*rotlsi3_internal12be"
4292 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4293 (compare:CC (zero_extend:SI
4295 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4296 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 2))
4298 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4299 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 2)))]
4302 rlwnm. %0,%1,%2,0xffff
4303 rlwinm. %0,%1,%h2,0xffff
4306 [(set_attr "type" "shift")
4307 (set_attr "var_shift" "yes,no,yes,no")
4308 (set_attr "dot" "yes")
4309 (set_attr "length" "4,4,8,8")])
4312 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4313 (compare:CC (zero_extend:SI
4315 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4316 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4318 (set (match_operand:SI 0 "gpc_reg_operand" "")
4319 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4320 "!BYTES_BIG_ENDIAN && reload_completed"
4322 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
4324 (compare:CC (match_dup 0)
4329 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4330 (compare:CC (zero_extend:SI
4332 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4333 (match_operand:SI 2 "reg_or_cint_operand" "")) 2))
4335 (set (match_operand:SI 0 "gpc_reg_operand" "")
4336 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 2)))]
4337 "BYTES_BIG_ENDIAN && reload_completed"
4339 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 2)))
4341 (compare:CC (match_dup 0)
4345 (define_insn "ashlsi3"
4346 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4347 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4348 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
4353 [(set_attr "type" "shift")
4354 (set_attr "var_shift" "yes,no")])
4356 (define_insn "*ashlsi3_64"
4357 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
4359 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4360 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))))]
4365 [(set_attr "type" "shift")
4366 (set_attr "var_shift" "yes,no")])
4369 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4370 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4371 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4373 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4380 [(set_attr "type" "shift")
4381 (set_attr "var_shift" "yes,no,yes,no")
4382 (set_attr "dot" "yes")
4383 (set_attr "length" "4,4,8,8")])
4386 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4387 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4388 (match_operand:SI 2 "reg_or_cint_operand" ""))
4390 (clobber (match_scratch:SI 3 ""))]
4391 "TARGET_32BIT && reload_completed"
4393 (ashift:SI (match_dup 1) (match_dup 2)))
4395 (compare:CC (match_dup 3)
4400 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4401 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4402 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4404 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4405 (ashift:SI (match_dup 1) (match_dup 2)))]
4412 [(set_attr "type" "shift")
4413 (set_attr "var_shift" "yes,no,yes,no")
4414 (set_attr "dot" "yes")
4415 (set_attr "length" "4,4,8,8")])
4418 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4419 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4420 (match_operand:SI 2 "reg_or_cint_operand" ""))
4422 (set (match_operand:SI 0 "gpc_reg_operand" "")
4423 (ashift:SI (match_dup 1) (match_dup 2)))]
4424 "TARGET_32BIT && reload_completed"
4426 (ashift:SI (match_dup 1) (match_dup 2)))
4428 (compare:CC (match_dup 0)
4432 (define_insn "rlwinm"
4433 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4434 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4435 (match_operand:SI 2 "const_int_operand" "i"))
4436 (match_operand:SI 3 "mask_operand" "n")))]
4437 "includes_lshift_p (operands[2], operands[3])"
4438 "rlwinm %0,%1,%h2,%m3,%M3")
4441 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4443 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4444 (match_operand:SI 2 "const_int_operand" "i,i"))
4445 (match_operand:SI 3 "mask_operand" "n,n"))
4447 (clobber (match_scratch:SI 4 "=r,r"))]
4448 "includes_lshift_p (operands[2], operands[3])"
4450 rlwinm. %4,%1,%h2,%m3,%M3
4452 [(set_attr "type" "shift")
4453 (set_attr "dot" "yes")
4454 (set_attr "length" "4,8")])
4457 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4459 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4460 (match_operand:SI 2 "const_int_operand" ""))
4461 (match_operand:SI 3 "mask_operand" ""))
4463 (clobber (match_scratch:SI 4 ""))]
4464 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
4466 (and:SI (ashift:SI (match_dup 1) (match_dup 2))
4469 (compare:CC (match_dup 4)
4474 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4476 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4477 (match_operand:SI 2 "const_int_operand" "i,i"))
4478 (match_operand:SI 3 "mask_operand" "n,n"))
4480 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4481 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4482 "includes_lshift_p (operands[2], operands[3])"
4484 rlwinm. %0,%1,%h2,%m3,%M3
4486 [(set_attr "type" "shift")
4487 (set_attr "dot" "yes")
4488 (set_attr "length" "4,8")])
4491 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
4493 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4494 (match_operand:SI 2 "const_int_operand" ""))
4495 (match_operand:SI 3 "mask_operand" ""))
4497 (set (match_operand:SI 0 "gpc_reg_operand" "")
4498 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4499 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
4501 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4503 (compare:CC (match_dup 0)
4507 (define_insn "lshrsi3"
4508 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
4509 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
4510 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i")))]
4516 [(set_attr "type" "integer,shift,shift")
4517 (set_attr "var_shift" "no,yes,no")])
4519 (define_insn "*lshrsi3_64"
4520 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
4522 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4523 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))))]
4528 [(set_attr "type" "shift")
4529 (set_attr "var_shift" "yes,no")])
4532 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,?y,?y,?y")
4533 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
4534 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i,O,r,i"))
4536 (clobber (match_scratch:SI 3 "=X,r,r,X,r,r"))]
4545 [(set_attr "type" "fast_compare,shift,shift,shift,shift,shift")
4546 (set_attr "var_shift" "no,yes,no,no,yes,no")
4547 (set_attr "dot" "yes")
4548 (set_attr "length" "4,4,4,8,8,8")])
4551 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4552 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4553 (match_operand:SI 2 "reg_or_cint_operand" ""))
4555 (clobber (match_scratch:SI 3 ""))]
4556 "TARGET_32BIT && reload_completed"
4558 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4560 (compare:CC (match_dup 3)
4565 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,?y,?y,?y")
4566 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
4567 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i,O,r,i"))
4569 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
4570 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
4579 [(set_attr "type" "fast_compare,shift,shift,shift,shift,shift")
4580 (set_attr "var_shift" "no,yes,no,no,yes,no")
4581 (set_attr "dot" "yes")
4582 (set_attr "length" "4,4,4,8,8,8")])
4585 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4586 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4587 (match_operand:SI 2 "reg_or_cint_operand" ""))
4589 (set (match_operand:SI 0 "gpc_reg_operand" "")
4590 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
4591 "TARGET_32BIT && reload_completed"
4593 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4595 (compare:CC (match_dup 0)
4600 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4601 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4602 (match_operand:SI 2 "const_int_operand" "i"))
4603 (match_operand:SI 3 "mask_operand" "n")))]
4604 "includes_rshift_p (operands[2], operands[3])"
4605 "rlwinm %0,%1,%s2,%m3,%M3")
4608 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4610 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4611 (match_operand:SI 2 "const_int_operand" "i,i"))
4612 (match_operand:SI 3 "mask_operand" "n,n"))
4614 (clobber (match_scratch:SI 4 "=r,r"))]
4615 "includes_rshift_p (operands[2], operands[3])"
4617 rlwinm. %4,%1,%s2,%m3,%M3
4619 [(set_attr "type" "shift")
4620 (set_attr "dot" "yes")
4621 (set_attr "length" "4,8")])
4624 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4626 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4627 (match_operand:SI 2 "const_int_operand" ""))
4628 (match_operand:SI 3 "mask_operand" ""))
4630 (clobber (match_scratch:SI 4 ""))]
4631 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
4633 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2))
4636 (compare:CC (match_dup 4)
4641 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4643 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4644 (match_operand:SI 2 "const_int_operand" "i,i"))
4645 (match_operand:SI 3 "mask_operand" "n,n"))
4647 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4648 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4649 "includes_rshift_p (operands[2], operands[3])"
4651 rlwinm. %0,%1,%s2,%m3,%M3
4653 [(set_attr "type" "shift")
4654 (set_attr "dot" "yes")
4655 (set_attr "length" "4,8")])
4658 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
4660 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4661 (match_operand:SI 2 "const_int_operand" ""))
4662 (match_operand:SI 3 "mask_operand" ""))
4664 (set (match_operand:SI 0 "gpc_reg_operand" "")
4665 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4666 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
4668 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4670 (compare:CC (match_dup 0)
4674 (define_insn "*lshiftrt_internal1le"
4675 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4678 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4679 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4680 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255))"
4681 "rlwinm %0,%1,%s2,0xff")
4683 (define_insn "*lshiftrt_internal1be"
4684 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4687 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4688 (match_operand:SI 2 "const_int_operand" "i")) 3)))]
4689 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255))"
4690 "rlwinm %0,%1,%s2,0xff")
4692 (define_insn "*lshiftrt_internal2le"
4693 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4697 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4698 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4700 (clobber (match_scratch:SI 3 "=r,r"))]
4701 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255))"
4703 rlwinm. %3,%1,%s2,0xff
4705 [(set_attr "type" "shift")
4706 (set_attr "dot" "yes")
4707 (set_attr "length" "4,8")])
4709 (define_insn "*lshiftrt_internal2be"
4710 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4714 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4715 (match_operand:SI 2 "const_int_operand" "i,i")) 3))
4717 (clobber (match_scratch:SI 3 "=r,r"))]
4718 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255))"
4720 rlwinm. %3,%1,%s2,0xff
4722 [(set_attr "type" "shift")
4723 (set_attr "dot" "yes")
4724 (set_attr "length" "4,8")])
4727 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4731 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4732 (match_operand:SI 2 "const_int_operand" "")) 0))
4734 (clobber (match_scratch:SI 3 ""))]
4735 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4737 (zero_extend:SI (subreg:QI
4738 (lshiftrt:SI (match_dup 1)
4741 (compare:CC (match_dup 3)
4746 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4750 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4751 (match_operand:SI 2 "const_int_operand" "")) 3))
4753 (clobber (match_scratch:SI 3 ""))]
4754 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4756 (zero_extend:SI (subreg:QI
4757 (lshiftrt:SI (match_dup 1)
4760 (compare:CC (match_dup 3)
4764 (define_insn "*lshiftrt_internal3le"
4765 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4769 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4770 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4772 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4773 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4774 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255))"
4776 rlwinm. %0,%1,%s2,0xff
4778 [(set_attr "type" "shift")
4779 (set_attr "dot" "yes")
4780 (set_attr "length" "4,8")])
4782 (define_insn "*lshiftrt_internal3be"
4783 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4787 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4788 (match_operand:SI 2 "const_int_operand" "i,i")) 3))
4790 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4791 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 3)))]
4792 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255))"
4794 rlwinm. %0,%1,%s2,0xff
4796 [(set_attr "type" "shift")
4797 (set_attr "dot" "yes")
4798 (set_attr "length" "4,8")])
4801 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4805 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4806 (match_operand:SI 2 "const_int_operand" "")) 0))
4808 (set (match_operand:SI 0 "gpc_reg_operand" "")
4809 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4810 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4812 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4814 (compare:CC (match_dup 0)
4819 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4823 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4824 (match_operand:SI 2 "const_int_operand" "")) 3))
4826 (set (match_operand:SI 0 "gpc_reg_operand" "")
4827 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 3)))]
4828 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4830 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 3)))
4832 (compare:CC (match_dup 0)
4836 (define_insn "*lshiftrt_internal4le"
4837 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4840 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4841 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4842 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535))"
4843 "rlwinm %0,%1,%s2,0xffff")
4845 (define_insn "*lshiftrt_internal4be"
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")) 2)))]
4851 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535))"
4852 "rlwinm %0,%1,%s2,0xffff")
4854 (define_insn "*lshiftrt_internal5le"
4855 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4859 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4860 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4862 (clobber (match_scratch:SI 3 "=r,r"))]
4863 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535))"
4865 rlwinm. %3,%1,%s2,0xffff
4867 [(set_attr "type" "shift")
4868 (set_attr "dot" "yes")
4869 (set_attr "length" "4,8")])
4871 (define_insn "*lshiftrt_internal5be"
4872 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4876 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4877 (match_operand:SI 2 "const_int_operand" "i,i")) 2))
4879 (clobber (match_scratch:SI 3 "=r,r"))]
4880 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535))"
4882 rlwinm. %3,%1,%s2,0xffff
4884 [(set_attr "type" "shift")
4885 (set_attr "dot" "yes")
4886 (set_attr "length" "4,8")])
4889 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4893 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4894 (match_operand:SI 2 "const_int_operand" "")) 0))
4896 (clobber (match_scratch:SI 3 ""))]
4897 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4899 (zero_extend:SI (subreg:HI
4900 (lshiftrt:SI (match_dup 1)
4903 (compare:CC (match_dup 3)
4908 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4912 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4913 (match_operand:SI 2 "const_int_operand" "")) 2))
4915 (clobber (match_scratch:SI 3 ""))]
4916 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4918 (zero_extend:SI (subreg:HI
4919 (lshiftrt:SI (match_dup 1)
4922 (compare:CC (match_dup 3)
4926 (define_insn "*lshiftrt_internal5le"
4927 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4931 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4932 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4934 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4935 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4936 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535))"
4938 rlwinm. %0,%1,%s2,0xffff
4940 [(set_attr "type" "shift")
4941 (set_attr "dot" "yes")
4942 (set_attr "length" "4,8")])
4944 (define_insn "*lshiftrt_internal5be"
4945 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4949 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4950 (match_operand:SI 2 "const_int_operand" "i,i")) 2))
4952 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4953 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 2)))]
4954 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535))"
4956 rlwinm. %0,%1,%s2,0xffff
4958 [(set_attr "type" "shift")
4959 (set_attr "dot" "yes")
4960 (set_attr "length" "4,8")])
4963 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4967 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4968 (match_operand:SI 2 "const_int_operand" "")) 0))
4970 (set (match_operand:SI 0 "gpc_reg_operand" "")
4971 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4972 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4974 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4976 (compare:CC (match_dup 0)
4981 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4985 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4986 (match_operand:SI 2 "const_int_operand" "")) 2))
4988 (set (match_operand:SI 0 "gpc_reg_operand" "")
4989 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 2)))]
4990 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4992 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 2)))
4994 (compare:CC (match_dup 0)
4998 (define_insn "ashrsi3"
4999 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
5000 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5001 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
5006 [(set_attr "type" "shift")
5007 (set_attr "var_shift" "yes,no")])
5009 (define_insn "*ashrsi3_64"
5010 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
5012 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5013 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))))]
5018 [(set_attr "type" "shift")
5019 (set_attr "var_shift" "yes,no")])
5022 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
5023 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
5024 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
5026 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
5033 [(set_attr "type" "shift")
5034 (set_attr "var_shift" "yes,no,yes,no")
5035 (set_attr "dot" "yes")
5036 (set_attr "length" "4,4,8,8")])
5039 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
5040 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5041 (match_operand:SI 2 "reg_or_cint_operand" ""))
5043 (clobber (match_scratch:SI 3 ""))]
5046 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5048 (compare:CC (match_dup 3)
5053 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
5054 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
5055 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
5057 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
5058 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
5065 [(set_attr "type" "shift")
5066 (set_attr "var_shift" "yes,no,yes,no")
5067 (set_attr "dot" "yes")
5068 (set_attr "length" "4,4,8,8")])
5070 ;; Builtins to replace a division to generate FRE reciprocal estimate
5071 ;; instructions and the necessary fixup instructions
5072 (define_expand "recip<mode>3"
5073 [(match_operand:RECIPF 0 "gpc_reg_operand" "")
5074 (match_operand:RECIPF 1 "gpc_reg_operand" "")
5075 (match_operand:RECIPF 2 "gpc_reg_operand" "")]
5076 "RS6000_RECIP_HAVE_RE_P (<MODE>mode)"
5078 rs6000_emit_swdiv (operands[0], operands[1], operands[2], false);
5082 ;; Split to create division from FRE/FRES/etc. and fixup instead of the normal
5083 ;; hardware division. This is only done before register allocation and with
5084 ;; -ffast-math. This must appear before the divsf3/divdf3 insns.
5086 [(set (match_operand:RECIPF 0 "gpc_reg_operand" "")
5087 (div:RECIPF (match_operand 1 "gpc_reg_operand" "")
5088 (match_operand 2 "gpc_reg_operand" "")))]
5089 "RS6000_RECIP_AUTO_RE_P (<MODE>mode)
5090 && can_create_pseudo_p () && optimize_insn_for_speed_p ()
5091 && flag_finite_math_only && !flag_trapping_math && flag_reciprocal_math"
5094 rs6000_emit_swdiv (operands[0], operands[1], operands[2], true);
5098 ;; Builtins to replace 1/sqrt(x) with instructions using RSQRTE and the
5099 ;; appropriate fixup.
5100 (define_expand "rsqrt<mode>2"
5101 [(match_operand:RECIPF 0 "gpc_reg_operand" "")
5102 (match_operand:RECIPF 1 "gpc_reg_operand" "")]
5103 "RS6000_RECIP_HAVE_RSQRTE_P (<MODE>mode)"
5105 rs6000_emit_swrsqrt (operands[0], operands[1]);
5110 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
5111 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5112 (match_operand:SI 2 "reg_or_cint_operand" ""))
5114 (set (match_operand:SI 0 "gpc_reg_operand" "")
5115 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
5118 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5120 (compare:CC (match_dup 0)
5125 ;; Floating-point insns, excluding normal data motion. We combine the SF/DF
5126 ;; modes here, and also add in conditional vsx/power8-vector support to access
5127 ;; values in the traditional Altivec registers if the appropriate
5128 ;; -mupper-regs-{df,sf} option is enabled.
5130 (define_expand "abs<mode>2"
5131 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
5132 (abs:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")))]
5133 "TARGET_<MODE>_INSN"
5136 (define_insn "*abs<mode>2_fpr"
5137 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
5138 (abs:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")))]
5143 [(set_attr "type" "fp")
5144 (set_attr "fp_type" "fp_addsub_<Fs>")])
5146 (define_insn "*nabs<mode>2_fpr"
5147 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
5150 (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>"))))]
5155 [(set_attr "type" "fp")
5156 (set_attr "fp_type" "fp_addsub_<Fs>")])
5158 (define_expand "neg<mode>2"
5159 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
5160 (neg:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")))]
5161 "TARGET_<MODE>_INSN"
5164 (define_insn "*neg<mode>2_fpr"
5165 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
5166 (neg:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")))]
5171 [(set_attr "type" "fp")
5172 (set_attr "fp_type" "fp_addsub_<Fs>")])
5174 (define_expand "add<mode>3"
5175 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
5176 (plus:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")
5177 (match_operand:SFDF 2 "gpc_reg_operand" "")))]
5178 "TARGET_<MODE>_INSN"
5181 (define_insn "*add<mode>3_fpr"
5182 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
5183 (plus:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "%<Ff>,<Fv>")
5184 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")))]
5187 fadd<Ftrad> %0,%1,%2
5188 xsadd<Fvsx> %x0,%x1,%x2"
5189 [(set_attr "type" "fp")
5190 (set_attr "fp_type" "fp_addsub_<Fs>")])
5192 (define_expand "sub<mode>3"
5193 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
5194 (minus:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")
5195 (match_operand:SFDF 2 "gpc_reg_operand" "")))]
5196 "TARGET_<MODE>_INSN"
5199 (define_insn "*sub<mode>3_fpr"
5200 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
5201 (minus:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")
5202 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")))]
5205 fsub<Ftrad> %0,%1,%2
5206 xssub<Fvsx> %x0,%x1,%x2"
5207 [(set_attr "type" "fp")
5208 (set_attr "fp_type" "fp_addsub_<Fs>")])
5210 (define_expand "mul<mode>3"
5211 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
5212 (mult:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")
5213 (match_operand:SFDF 2 "gpc_reg_operand" "")))]
5214 "TARGET_<MODE>_INSN"
5217 (define_insn "*mul<mode>3_fpr"
5218 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
5219 (mult:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "%<Ff>,<Fv>")
5220 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")))]
5223 fmul<Ftrad> %0,%1,%2
5224 xsmul<Fvsx> %x0,%x1,%x2"
5225 [(set_attr "type" "dmul")
5226 (set_attr "fp_type" "fp_mul_<Fs>")])
5228 (define_expand "div<mode>3"
5229 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
5230 (div:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")
5231 (match_operand:SFDF 2 "gpc_reg_operand" "")))]
5232 "TARGET_<MODE>_INSN && !TARGET_SIMPLE_FPU"
5235 (define_insn "*div<mode>3_fpr"
5236 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
5237 (div:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")
5238 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")))]
5239 "TARGET_<MODE>_FPR && !TARGET_SIMPLE_FPU"
5241 fdiv<Ftrad> %0,%1,%2
5242 xsdiv<Fvsx> %x0,%x1,%x2"
5243 [(set_attr "type" "<Fs>div")
5244 (set_attr "fp_type" "fp_div_<Fs>")])
5246 (define_insn "sqrt<mode>2"
5247 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
5248 (sqrt:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")))]
5249 "TARGET_<MODE>_FPR && !TARGET_SIMPLE_FPU
5250 && (TARGET_PPC_GPOPT || (<MODE>mode == SFmode && TARGET_XILINX_FPU))"
5253 xssqrt<Fvsx> %x0,%x1"
5254 [(set_attr "type" "<Fs>sqrt")
5255 (set_attr "fp_type" "fp_sqrt_<Fs>")])
5257 ;; Floating point reciprocal approximation
5258 (define_insn "fre<Fs>"
5259 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
5260 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")]
5266 [(set_attr "type" "fp")])
5268 (define_insn "*rsqrt<mode>2"
5269 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
5270 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")]
5272 "RS6000_RECIP_HAVE_RSQRTE_P (<MODE>mode)"
5274 frsqrte<Ftrad> %0,%1
5275 xsrsqrte<Fvsx> %x0,%x1"
5276 [(set_attr "type" "fp")])
5278 ;; Floating point comparisons
5279 (define_insn "*cmp<mode>_fpr"
5280 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y,y")
5281 (compare:CCFP (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")
5282 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")))]
5286 xscmpudp %0,%x1,%x2"
5287 [(set_attr "type" "fpcompare")])
5289 ;; Floating point conversions
5290 (define_expand "extendsfdf2"
5291 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5292 (float_extend:DF (match_operand:SF 1 "reg_or_none500mem_operand" "")))]
5293 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5296 (define_insn_and_split "*extendsfdf2_fpr"
5297 [(set (match_operand:DF 0 "gpc_reg_operand" "=d,?d,d,ws,?ws,wv")
5298 (float_extend:DF (match_operand:SF 1 "reg_or_mem_operand" "0,f,m,0,wy,Z")))]
5299 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5307 "&& reload_completed && REG_P (operands[1]) && REGNO (operands[0]) == REGNO (operands[1])"
5310 emit_note (NOTE_INSN_DELETED);
5313 [(set_attr "type" "fp,fp,fpload,fp,vecsimple,fpload")])
5315 (define_expand "truncdfsf2"
5316 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5317 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "")))]
5318 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5321 (define_insn "*truncdfsf2_fpr"
5322 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5323 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "d")))]
5324 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5326 [(set_attr "type" "fp")])
5328 ;; This expander is here to avoid FLOAT_WORDS_BIGENDIAN tests in
5329 ;; builtins.c and optabs.c that are not correct for IBM long double
5330 ;; when little-endian.
5331 (define_expand "signbittf2"
5333 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "")))
5335 (subreg:DI (match_dup 2) 0))
5338 (set (match_operand:SI 0 "gpc_reg_operand" "")
5341 && TARGET_HARD_FLOAT
5342 && (TARGET_FPRS || TARGET_E500_DOUBLE)
5343 && TARGET_LONG_DOUBLE_128"
5345 operands[2] = gen_reg_rtx (DFmode);
5346 operands[3] = gen_reg_rtx (DImode);
5347 if (TARGET_POWERPC64)
5349 operands[4] = gen_reg_rtx (DImode);
5350 operands[5] = gen_rtx_LSHIFTRT (DImode, operands[3], GEN_INT (63));
5351 operands[6] = gen_rtx_SUBREG (SImode, operands[4],
5352 WORDS_BIG_ENDIAN ? 4 : 0);
5356 operands[4] = gen_reg_rtx (SImode);
5357 operands[5] = gen_rtx_SUBREG (SImode, operands[3],
5358 WORDS_BIG_ENDIAN ? 0 : 4);
5359 operands[6] = gen_rtx_LSHIFTRT (SImode, operands[4], GEN_INT (31));
5363 (define_expand "copysign<mode>3"
5365 (abs:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")))
5367 (neg:SFDF (abs:SFDF (match_dup 1))))
5368 (set (match_operand:SFDF 0 "gpc_reg_operand" "")
5369 (if_then_else:SFDF (ge (match_operand:SFDF 2 "gpc_reg_operand" "")
5373 "TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>
5374 && ((TARGET_PPC_GFXOPT
5375 && !HONOR_NANS (<MODE>mode)
5376 && !HONOR_SIGNED_ZEROS (<MODE>mode))
5378 || VECTOR_UNIT_VSX_P (<MODE>mode))"
5380 if (TARGET_CMPB || VECTOR_UNIT_VSX_P (<MODE>mode))
5382 emit_insn (gen_copysign<mode>3_fcpsgn (operands[0], operands[1],
5387 operands[3] = gen_reg_rtx (<MODE>mode);
5388 operands[4] = gen_reg_rtx (<MODE>mode);
5389 operands[5] = CONST0_RTX (<MODE>mode);
5392 ;; Use an unspec rather providing an if-then-else in RTL, to prevent the
5393 ;; compiler from optimizing -0.0
5394 (define_insn "copysign<mode>3_fcpsgn"
5395 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
5396 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")
5397 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")]
5399 "TARGET_<MODE>_FPR && TARGET_CMPB"
5402 xscpsgn<Fvsx> %x0,%x2,%x1"
5403 [(set_attr "type" "fp")])
5405 ;; For MIN, MAX, and conditional move, we use DEFINE_EXPAND's that involve a
5406 ;; fsel instruction and some auxiliary computations. Then we just have a
5407 ;; single DEFINE_INSN for fsel and the define_splits to make them if made by
5409 ;; For MIN, MAX on non-VSX machines, and conditional move all of the time, we
5410 ;; use DEFINE_EXPAND's that involve a fsel instruction and some auxiliary
5411 ;; computations. Then we just have a single DEFINE_INSN for fsel and the
5412 ;; define_splits to make them if made by combine. On VSX machines we have the
5413 ;; min/max instructions.
5415 ;; On VSX, we only check for TARGET_VSX instead of checking for a vsx/p8 vector
5416 ;; to allow either DF/SF to use only traditional registers.
5418 (define_expand "smax<mode>3"
5419 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
5420 (if_then_else:SFDF (ge (match_operand:SFDF 1 "gpc_reg_operand" "")
5421 (match_operand:SFDF 2 "gpc_reg_operand" ""))
5424 "TARGET_<MODE>_FPR && TARGET_PPC_GFXOPT && !flag_trapping_math"
5426 rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]);
5430 (define_insn "*smax<mode>3_vsx"
5431 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
5432 (smax:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "%<Ff>,<Fv>")
5433 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")))]
5434 "TARGET_<MODE>_FPR && TARGET_VSX"
5435 "xsmaxdp %x0,%x1,%x2"
5436 [(set_attr "type" "fp")])
5438 (define_expand "smin<mode>3"
5439 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
5440 (if_then_else:SFDF (ge (match_operand:SFDF 1 "gpc_reg_operand" "")
5441 (match_operand:SFDF 2 "gpc_reg_operand" ""))
5444 "TARGET_<MODE>_FPR && TARGET_PPC_GFXOPT && !flag_trapping_math"
5446 rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]);
5450 (define_insn "*smin<mode>3_vsx"
5451 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
5452 (smin:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "%<Ff>,<Fv>")
5453 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")))]
5454 "TARGET_<MODE>_FPR && TARGET_VSX"
5455 "xsmindp %x0,%x1,%x2"
5456 [(set_attr "type" "fp")])
5459 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
5460 (match_operator:SFDF 3 "min_max_operator"
5461 [(match_operand:SFDF 1 "gpc_reg_operand" "")
5462 (match_operand:SFDF 2 "gpc_reg_operand" "")]))]
5463 "TARGET_<MODE>_FPR && TARGET_PPC_GFXOPT && !flag_trapping_math
5467 rs6000_emit_minmax (operands[0], GET_CODE (operands[3]), operands[1],
5473 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5474 (match_operator:SF 3 "min_max_operator"
5475 [(match_operand:SF 1 "gpc_reg_operand" "")
5476 (match_operand:SF 2 "gpc_reg_operand" "")]))]
5477 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
5478 && TARGET_SINGLE_FLOAT && !flag_trapping_math"
5481 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
5482 operands[1], operands[2]);
5486 (define_expand "mov<mode>cc"
5487 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
5488 (if_then_else:GPR (match_operand 1 "comparison_operator" "")
5489 (match_operand:GPR 2 "gpc_reg_operand" "")
5490 (match_operand:GPR 3 "gpc_reg_operand" "")))]
5494 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5500 ;; We use the BASE_REGS for the isel input operands because, if rA is
5501 ;; 0, the value of 0 is placed in rD upon truth. Similarly for rB
5502 ;; because we may switch the operands and rB may end up being rA.
5504 ;; We need 2 patterns: an unsigned and a signed pattern. We could
5505 ;; leave out the mode in operand 4 and use one pattern, but reload can
5506 ;; change the mode underneath our feet and then gets confused trying
5507 ;; to reload the value.
5508 (define_insn "isel_signed_<mode>"
5509 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
5511 (match_operator 1 "scc_comparison_operator"
5512 [(match_operand:CC 4 "cc_reg_operand" "y,y")
5514 (match_operand:GPR 2 "reg_or_cint_operand" "O,b")
5515 (match_operand:GPR 3 "gpc_reg_operand" "r,r")))]
5518 { return output_isel (operands); }"
5519 [(set_attr "type" "isel")
5520 (set_attr "length" "4")])
5522 (define_insn "isel_unsigned_<mode>"
5523 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
5525 (match_operator 1 "scc_comparison_operator"
5526 [(match_operand:CCUNS 4 "cc_reg_operand" "y,y")
5528 (match_operand:GPR 2 "reg_or_cint_operand" "O,b")
5529 (match_operand:GPR 3 "gpc_reg_operand" "r,r")))]
5532 { return output_isel (operands); }"
5533 [(set_attr "type" "isel")
5534 (set_attr "length" "4")])
5536 ;; These patterns can be useful for combine; they let combine know that
5537 ;; isel can handle reversed comparisons so long as the operands are
5540 (define_insn "*isel_reversed_signed_<mode>"
5541 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
5543 (match_operator 1 "scc_rev_comparison_operator"
5544 [(match_operand:CC 4 "cc_reg_operand" "y")
5546 (match_operand:GPR 2 "gpc_reg_operand" "b")
5547 (match_operand:GPR 3 "gpc_reg_operand" "b")))]
5550 { return output_isel (operands); }"
5551 [(set_attr "type" "isel")
5552 (set_attr "length" "4")])
5554 (define_insn "*isel_reversed_unsigned_<mode>"
5555 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
5557 (match_operator 1 "scc_rev_comparison_operator"
5558 [(match_operand:CCUNS 4 "cc_reg_operand" "y")
5560 (match_operand:GPR 2 "gpc_reg_operand" "b")
5561 (match_operand:GPR 3 "gpc_reg_operand" "b")))]
5564 { return output_isel (operands); }"
5565 [(set_attr "type" "isel")
5566 (set_attr "length" "4")])
5568 (define_expand "movsfcc"
5569 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5570 (if_then_else:SF (match_operand 1 "comparison_operator" "")
5571 (match_operand:SF 2 "gpc_reg_operand" "")
5572 (match_operand:SF 3 "gpc_reg_operand" "")))]
5573 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5576 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5582 (define_insn "*fselsfsf4"
5583 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5584 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
5585 (match_operand:SF 4 "zero_fp_constant" "F"))
5586 (match_operand:SF 2 "gpc_reg_operand" "f")
5587 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5588 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5590 [(set_attr "type" "fp")])
5592 (define_insn "*fseldfsf4"
5593 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5594 (if_then_else:SF (ge (match_operand:DF 1 "gpc_reg_operand" "d")
5595 (match_operand:DF 4 "zero_fp_constant" "F"))
5596 (match_operand:SF 2 "gpc_reg_operand" "f")
5597 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5598 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_SINGLE_FLOAT"
5600 [(set_attr "type" "fp")])
5602 ;; The conditional move instructions allow us to perform max and min
5603 ;; operations even when
5606 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5607 (match_operator:DF 3 "min_max_operator"
5608 [(match_operand:DF 1 "gpc_reg_operand" "")
5609 (match_operand:DF 2 "gpc_reg_operand" "")]))]
5610 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5611 && !flag_trapping_math"
5614 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
5615 operands[1], operands[2]);
5619 (define_expand "movdfcc"
5620 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5621 (if_then_else:DF (match_operand 1 "comparison_operator" "")
5622 (match_operand:DF 2 "gpc_reg_operand" "")
5623 (match_operand:DF 3 "gpc_reg_operand" "")))]
5624 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5627 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5633 (define_insn "*fseldfdf4"
5634 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
5635 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "d")
5636 (match_operand:DF 4 "zero_fp_constant" "F"))
5637 (match_operand:DF 2 "gpc_reg_operand" "d")
5638 (match_operand:DF 3 "gpc_reg_operand" "d")))]
5639 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5641 [(set_attr "type" "fp")])
5643 (define_insn "*fselsfdf4"
5644 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
5645 (if_then_else:DF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
5646 (match_operand:SF 4 "zero_fp_constant" "F"))
5647 (match_operand:DF 2 "gpc_reg_operand" "d")
5648 (match_operand:DF 3 "gpc_reg_operand" "d")))]
5649 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_SINGLE_FLOAT"
5651 [(set_attr "type" "fp")])
5653 ;; Conversions to and from floating-point.
5655 ; We don't define lfiwax/lfiwzx with the normal definition, because we
5656 ; don't want to support putting SImode in FPR registers.
5657 (define_insn "lfiwax"
5658 [(set (match_operand:DI 0 "gpc_reg_operand" "=d,wm,!wm")
5659 (unspec:DI [(match_operand:SI 1 "reg_or_indexed_operand" "Z,Z,r")]
5661 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWAX"
5666 [(set_attr "type" "fpload,fpload,mffgpr")])
5668 ; This split must be run before register allocation because it allocates the
5669 ; memory slot that is needed to move values to/from the FPR. We don't allocate
5670 ; it earlier to allow for the combiner to merge insns together where it might
5671 ; not be needed and also in case the insns are deleted as dead code.
5673 (define_insn_and_split "floatsi<mode>2_lfiwax"
5674 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d")
5675 (float:SFDF (match_operand:SI 1 "nonimmediate_operand" "r")))
5676 (clobber (match_scratch:DI 2 "=d"))]
5677 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWAX
5678 && <SI_CONVERT_FP> && can_create_pseudo_p ()"
5684 rtx dest = operands[0];
5685 rtx src = operands[1];
5688 if (!MEM_P (src) && TARGET_POWERPC64
5689 && (TARGET_MFPGPR || TARGET_DIRECT_MOVE))
5690 tmp = convert_to_mode (DImode, src, false);
5694 if (GET_CODE (tmp) == SCRATCH)
5695 tmp = gen_reg_rtx (DImode);
5698 src = rs6000_address_for_fpconvert (src);
5699 emit_insn (gen_lfiwax (tmp, src));
5703 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
5704 emit_move_insn (stack, src);
5705 emit_insn (gen_lfiwax (tmp, stack));
5708 emit_insn (gen_floatdi<mode>2 (dest, tmp));
5711 [(set_attr "length" "12")
5712 (set_attr "type" "fpload")])
5714 (define_insn_and_split "floatsi<mode>2_lfiwax_mem"
5715 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d,<rreg2>")
5718 (match_operand:SI 1 "memory_operand" "Z,Z"))))
5719 (clobber (match_scratch:DI 2 "=0,d"))]
5720 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWAX
5727 operands[1] = rs6000_address_for_fpconvert (operands[1]);
5728 if (GET_CODE (operands[2]) == SCRATCH)
5729 operands[2] = gen_reg_rtx (DImode);
5730 emit_insn (gen_lfiwax (operands[2], operands[1]));
5731 emit_insn (gen_floatdi<mode>2 (operands[0], operands[2]));
5734 [(set_attr "length" "8")
5735 (set_attr "type" "fpload")])
5737 (define_insn "lfiwzx"
5738 [(set (match_operand:DI 0 "gpc_reg_operand" "=d,wm,!wm")
5739 (unspec:DI [(match_operand:SI 1 "reg_or_indexed_operand" "Z,Z,r")]
5741 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWZX"
5746 [(set_attr "type" "fpload,fpload,mftgpr")])
5748 (define_insn_and_split "floatunssi<mode>2_lfiwzx"
5749 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d")
5750 (unsigned_float:SFDF (match_operand:SI 1 "nonimmediate_operand" "r")))
5751 (clobber (match_scratch:DI 2 "=d"))]
5752 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWZX
5759 rtx dest = operands[0];
5760 rtx src = operands[1];
5763 if (!MEM_P (src) && TARGET_POWERPC64
5764 && (TARGET_MFPGPR || TARGET_DIRECT_MOVE))
5765 tmp = convert_to_mode (DImode, src, true);
5769 if (GET_CODE (tmp) == SCRATCH)
5770 tmp = gen_reg_rtx (DImode);
5773 src = rs6000_address_for_fpconvert (src);
5774 emit_insn (gen_lfiwzx (tmp, src));
5778 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
5779 emit_move_insn (stack, src);
5780 emit_insn (gen_lfiwzx (tmp, stack));
5783 emit_insn (gen_floatdi<mode>2 (dest, tmp));
5786 [(set_attr "length" "12")
5787 (set_attr "type" "fpload")])
5789 (define_insn_and_split "floatunssi<mode>2_lfiwzx_mem"
5790 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d,<rreg2>")
5791 (unsigned_float:SFDF
5793 (match_operand:SI 1 "memory_operand" "Z,Z"))))
5794 (clobber (match_scratch:DI 2 "=0,d"))]
5795 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWZX
5802 operands[1] = rs6000_address_for_fpconvert (operands[1]);
5803 if (GET_CODE (operands[2]) == SCRATCH)
5804 operands[2] = gen_reg_rtx (DImode);
5805 emit_insn (gen_lfiwzx (operands[2], operands[1]));
5806 emit_insn (gen_floatdi<mode>2 (operands[0], operands[2]));
5809 [(set_attr "length" "8")
5810 (set_attr "type" "fpload")])
5812 ; For each of these conversions, there is a define_expand, a define_insn
5813 ; with a '#' template, and a define_split (with C code). The idea is
5814 ; to allow constant folding with the template of the define_insn,
5815 ; then to have the insns split later (between sched1 and final).
5817 (define_expand "floatsidf2"
5818 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5819 (float:DF (match_operand:SI 1 "nonimmediate_operand" "")))
5822 (clobber (match_dup 4))
5823 (clobber (match_dup 5))
5824 (clobber (match_dup 6))])]
5826 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5829 if (TARGET_E500_DOUBLE)
5831 if (!REG_P (operands[1]))
5832 operands[1] = force_reg (SImode, operands[1]);
5833 emit_insn (gen_spe_floatsidf2 (operands[0], operands[1]));
5836 else if (TARGET_LFIWAX && TARGET_FCFID)
5838 emit_insn (gen_floatsidf2_lfiwax (operands[0], operands[1]));
5841 else if (TARGET_FCFID)
5843 rtx dreg = operands[1];
5845 dreg = force_reg (SImode, dreg);
5846 dreg = convert_to_mode (DImode, dreg, false);
5847 emit_insn (gen_floatdidf2 (operands[0], dreg));
5851 if (!REG_P (operands[1]))
5852 operands[1] = force_reg (SImode, operands[1]);
5853 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5854 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503601774854144\", DFmode));
5855 operands[4] = rs6000_allocate_stack_temp (DFmode, true, false);
5856 operands[5] = gen_reg_rtx (DFmode);
5857 operands[6] = gen_reg_rtx (SImode);
5860 (define_insn_and_split "*floatsidf2_internal"
5861 [(set (match_operand:DF 0 "gpc_reg_operand" "=&d")
5862 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5863 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5864 (use (match_operand:DF 3 "gpc_reg_operand" "d"))
5865 (clobber (match_operand:DF 4 "offsettable_mem_operand" "=o"))
5866 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&d"))
5867 (clobber (match_operand:SI 6 "gpc_reg_operand" "=&r"))]
5868 "! TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5874 rtx lowword, highword;
5875 gcc_assert (MEM_P (operands[4]));
5876 highword = adjust_address (operands[4], SImode, 0);
5877 lowword = adjust_address (operands[4], SImode, 4);
5878 if (! WORDS_BIG_ENDIAN)
5881 tmp = highword; highword = lowword; lowword = tmp;
5884 emit_insn (gen_xorsi3 (operands[6], operands[1],
5885 GEN_INT (~ (HOST_WIDE_INT) 0x7fffffff)));
5886 emit_move_insn (lowword, operands[6]);
5887 emit_move_insn (highword, operands[2]);
5888 emit_move_insn (operands[5], operands[4]);
5889 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5892 [(set_attr "length" "24")
5893 (set_attr "type" "fp")])
5895 ;; If we don't have a direct conversion to single precision, don't enable this
5896 ;; conversion for 32-bit without fast math, because we don't have the insn to
5897 ;; generate the fixup swizzle to avoid double rounding problems.
5898 (define_expand "floatunssisf2"
5899 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5900 (unsigned_float:SF (match_operand:SI 1 "nonimmediate_operand" "")))]
5901 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT
5904 && ((TARGET_FCFIDUS && TARGET_LFIWZX)
5905 || (TARGET_DOUBLE_FLOAT && TARGET_FCFID
5906 && (TARGET_POWERPC64 || flag_unsafe_math_optimizations)))))"
5911 if (!REG_P (operands[1]))
5912 operands[1] = force_reg (SImode, operands[1]);
5914 else if (TARGET_LFIWZX && TARGET_FCFIDUS)
5916 emit_insn (gen_floatunssisf2_lfiwzx (operands[0], operands[1]));
5921 rtx dreg = operands[1];
5923 dreg = force_reg (SImode, dreg);
5924 dreg = convert_to_mode (DImode, dreg, true);
5925 emit_insn (gen_floatdisf2 (operands[0], dreg));
5930 (define_expand "floatunssidf2"
5931 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5932 (unsigned_float:DF (match_operand:SI 1 "nonimmediate_operand" "")))
5935 (clobber (match_dup 4))
5936 (clobber (match_dup 5))])]
5938 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5941 if (TARGET_E500_DOUBLE)
5943 if (!REG_P (operands[1]))
5944 operands[1] = force_reg (SImode, operands[1]);
5945 emit_insn (gen_spe_floatunssidf2 (operands[0], operands[1]));
5948 else if (TARGET_LFIWZX && TARGET_FCFID)
5950 emit_insn (gen_floatunssidf2_lfiwzx (operands[0], operands[1]));
5953 else if (TARGET_FCFID)
5955 rtx dreg = operands[1];
5957 dreg = force_reg (SImode, dreg);
5958 dreg = convert_to_mode (DImode, dreg, true);
5959 emit_insn (gen_floatdidf2 (operands[0], dreg));
5963 if (!REG_P (operands[1]))
5964 operands[1] = force_reg (SImode, operands[1]);
5965 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5966 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503599627370496\", DFmode));
5967 operands[4] = rs6000_allocate_stack_temp (DFmode, true, false);
5968 operands[5] = gen_reg_rtx (DFmode);
5971 (define_insn_and_split "*floatunssidf2_internal"
5972 [(set (match_operand:DF 0 "gpc_reg_operand" "=&d")
5973 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5974 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5975 (use (match_operand:DF 3 "gpc_reg_operand" "d"))
5976 (clobber (match_operand:DF 4 "offsettable_mem_operand" "=o"))
5977 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&d"))]
5978 "! TARGET_FCFIDU && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5979 && !(TARGET_FCFID && TARGET_POWERPC64)"
5985 rtx lowword, highword;
5986 gcc_assert (MEM_P (operands[4]));
5987 highword = adjust_address (operands[4], SImode, 0);
5988 lowword = adjust_address (operands[4], SImode, 4);
5989 if (! WORDS_BIG_ENDIAN)
5992 tmp = highword; highword = lowword; lowword = tmp;
5995 emit_move_insn (lowword, operands[1]);
5996 emit_move_insn (highword, operands[2]);
5997 emit_move_insn (operands[5], operands[4]);
5998 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
6001 [(set_attr "length" "20")
6002 (set_attr "type" "fp")])
6004 (define_expand "fix_trunc<mode>si2"
6005 [(set (match_operand:SI 0 "gpc_reg_operand" "")
6006 (fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "")))]
6007 "TARGET_HARD_FLOAT && ((TARGET_FPRS && <TARGET_FLOAT>) || <E500_CONVERT>)"
6010 if (!<E500_CONVERT>)
6015 emit_insn (gen_fix_trunc<mode>si2_stfiwx (operands[0], operands[1]));
6018 tmp = gen_reg_rtx (DImode);
6019 stack = rs6000_allocate_stack_temp (DImode, true, false);
6020 emit_insn (gen_fix_trunc<mode>si2_internal (operands[0], operands[1],
6027 ; Like the convert to float patterns, this insn must be split before
6028 ; register allocation so that it can allocate the memory slot if it
6030 (define_insn_and_split "fix_trunc<mode>si2_stfiwx"
6031 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
6032 (fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d")))
6033 (clobber (match_scratch:DI 2 "=d"))]
6034 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6035 && (<MODE>mode != SFmode || TARGET_SINGLE_FLOAT)
6036 && TARGET_STFIWX && can_create_pseudo_p ()"
6041 rtx dest = operands[0];
6042 rtx src = operands[1];
6043 rtx tmp = operands[2];
6045 if (GET_CODE (tmp) == SCRATCH)
6046 tmp = gen_reg_rtx (DImode);
6048 emit_insn (gen_fctiwz_<mode> (tmp, src));
6051 dest = rs6000_address_for_fpconvert (dest);
6052 emit_insn (gen_stfiwx (dest, tmp));
6055 else if (TARGET_POWERPC64 && (TARGET_MFPGPR || TARGET_DIRECT_MOVE))
6057 dest = gen_lowpart (DImode, dest);
6058 emit_move_insn (dest, tmp);
6063 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
6064 emit_insn (gen_stfiwx (stack, tmp));
6065 emit_move_insn (dest, stack);
6069 [(set_attr "length" "12")
6070 (set_attr "type" "fp")])
6072 (define_insn_and_split "fix_trunc<mode>si2_internal"
6073 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,?r")
6074 (fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d,<rreg>")))
6075 (clobber (match_operand:DI 2 "gpc_reg_operand" "=1,d"))
6076 (clobber (match_operand:DI 3 "offsettable_mem_operand" "=o,o"))]
6077 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6084 gcc_assert (MEM_P (operands[3]));
6085 lowword = adjust_address (operands[3], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
6087 emit_insn (gen_fctiwz_<mode> (operands[2], operands[1]));
6088 emit_move_insn (operands[3], operands[2]);
6089 emit_move_insn (operands[0], lowword);
6092 [(set_attr "length" "16")
6093 (set_attr "type" "fp")])
6095 (define_expand "fix_trunc<mode>di2"
6096 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6097 (fix:DI (match_operand:SFDF 1 "gpc_reg_operand" "")))]
6098 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
6102 (define_insn "*fix_trunc<mode>di2_fctidz"
6103 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6104 (fix:DI (match_operand:SFDF 1 "gpc_reg_operand" "d")))]
6105 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
6106 && TARGET_FCFID && !VECTOR_UNIT_VSX_P (<MODE>mode)"
6108 [(set_attr "type" "fp")])
6110 (define_expand "fixuns_trunc<mode>si2"
6111 [(set (match_operand:SI 0 "gpc_reg_operand" "")
6112 (unsigned_fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "")))]
6114 && ((TARGET_FPRS && <TARGET_FLOAT> && TARGET_FCTIWUZ && TARGET_STFIWX)
6118 if (!<E500_CONVERT>)
6120 emit_insn (gen_fixuns_trunc<mode>si2_stfiwx (operands[0], operands[1]));
6125 (define_insn_and_split "fixuns_trunc<mode>si2_stfiwx"
6126 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
6127 (unsigned_fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d")))
6128 (clobber (match_scratch:DI 2 "=d"))]
6129 "TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT> && TARGET_FCTIWUZ
6130 && TARGET_STFIWX && can_create_pseudo_p ()"
6135 rtx dest = operands[0];
6136 rtx src = operands[1];
6137 rtx tmp = operands[2];
6139 if (GET_CODE (tmp) == SCRATCH)
6140 tmp = gen_reg_rtx (DImode);
6142 emit_insn (gen_fctiwuz_<mode> (tmp, src));
6145 dest = rs6000_address_for_fpconvert (dest);
6146 emit_insn (gen_stfiwx (dest, tmp));
6149 else if (TARGET_POWERPC64 && (TARGET_MFPGPR || TARGET_DIRECT_MOVE))
6151 dest = gen_lowpart (DImode, dest);
6152 emit_move_insn (dest, tmp);
6157 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
6158 emit_insn (gen_stfiwx (stack, tmp));
6159 emit_move_insn (dest, stack);
6163 [(set_attr "length" "12")
6164 (set_attr "type" "fp")])
6166 (define_expand "fixuns_trunc<mode>di2"
6167 [(set (match_operand:DI 0 "register_operand" "")
6168 (unsigned_fix:DI (match_operand:SFDF 1 "register_operand" "")))]
6169 "TARGET_HARD_FLOAT && (TARGET_FCTIDUZ || VECTOR_UNIT_VSX_P (<MODE>mode))"
6172 (define_insn "*fixuns_trunc<mode>di2_fctiduz"
6173 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6174 (unsigned_fix:DI (match_operand:SFDF 1 "gpc_reg_operand" "d")))]
6175 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
6176 && TARGET_FCTIDUZ && !VECTOR_UNIT_VSX_P (<MODE>mode)"
6178 [(set_attr "type" "fp")])
6180 ; Here, we use (set (reg) (unspec:DI [(fix:SI ...)] UNSPEC_FCTIWZ))
6181 ; rather than (set (subreg:SI (reg)) (fix:SI ...))
6182 ; because the first makes it clear that operand 0 is not live
6183 ; before the instruction.
6184 (define_insn "fctiwz_<mode>"
6185 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6186 (unspec:DI [(fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d"))]
6188 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6190 [(set_attr "type" "fp")])
6192 (define_insn "fctiwuz_<mode>"
6193 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6194 (unspec:DI [(unsigned_fix:SI
6195 (match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>"))]
6197 "TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT> && TARGET_FCTIWUZ"
6199 [(set_attr "type" "fp")])
6201 ;; Only optimize (float (fix x)) -> frz if we are in fast-math mode, since
6202 ;; since the friz instruction does not truncate the value if the floating
6203 ;; point value is < LONG_MIN or > LONG_MAX.
6204 (define_insn "*friz"
6205 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6206 (float:DF (fix:DI (match_operand:DF 1 "gpc_reg_operand" "d"))))]
6207 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_FPRND
6208 && !VECTOR_UNIT_VSX_P (DFmode) && flag_unsafe_math_optimizations
6209 && !flag_trapping_math && TARGET_FRIZ"
6211 [(set_attr "type" "fp")])
6213 ;; Since FCTIWZ doesn't sign extend the upper bits, we have to do a store and a
6214 ;; load to properly sign extend the value, but at least doing a store, load
6215 ;; into a GPR to sign extend, a store from the GPR and a load back into the FPR
6216 ;; if we have 32-bit memory ops
6217 (define_insn_and_split "*round32<mode>2_fprs"
6218 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d")
6220 (fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d"))))
6221 (clobber (match_scratch:DI 2 "=d"))
6222 (clobber (match_scratch:DI 3 "=d"))]
6223 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6224 && <SI_CONVERT_FP> && TARGET_LFIWAX && TARGET_STFIWX && TARGET_FCFID
6225 && can_create_pseudo_p ()"
6230 rtx dest = operands[0];
6231 rtx src = operands[1];
6232 rtx tmp1 = operands[2];
6233 rtx tmp2 = operands[3];
6234 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
6236 if (GET_CODE (tmp1) == SCRATCH)
6237 tmp1 = gen_reg_rtx (DImode);
6238 if (GET_CODE (tmp2) == SCRATCH)
6239 tmp2 = gen_reg_rtx (DImode);
6241 emit_insn (gen_fctiwz_<mode> (tmp1, src));
6242 emit_insn (gen_stfiwx (stack, tmp1));
6243 emit_insn (gen_lfiwax (tmp2, stack));
6244 emit_insn (gen_floatdi<mode>2 (dest, tmp2));
6247 [(set_attr "type" "fpload")
6248 (set_attr "length" "16")])
6250 (define_insn_and_split "*roundu32<mode>2_fprs"
6251 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d")
6252 (unsigned_float:SFDF
6253 (unsigned_fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d"))))
6254 (clobber (match_scratch:DI 2 "=d"))
6255 (clobber (match_scratch:DI 3 "=d"))]
6256 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6257 && TARGET_LFIWZX && TARGET_STFIWX && TARGET_FCFIDU
6258 && can_create_pseudo_p ()"
6263 rtx dest = operands[0];
6264 rtx src = operands[1];
6265 rtx tmp1 = operands[2];
6266 rtx tmp2 = operands[3];
6267 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
6269 if (GET_CODE (tmp1) == SCRATCH)
6270 tmp1 = gen_reg_rtx (DImode);
6271 if (GET_CODE (tmp2) == SCRATCH)
6272 tmp2 = gen_reg_rtx (DImode);
6274 emit_insn (gen_fctiwuz_<mode> (tmp1, src));
6275 emit_insn (gen_stfiwx (stack, tmp1));
6276 emit_insn (gen_lfiwzx (tmp2, stack));
6277 emit_insn (gen_floatdi<mode>2 (dest, tmp2));
6280 [(set_attr "type" "fpload")
6281 (set_attr "length" "16")])
6283 ;; No VSX equivalent to fctid
6284 (define_insn "lrint<mode>di2"
6285 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6286 (unspec:DI [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
6288 "TARGET_<MODE>_FPR && TARGET_FPRND"
6290 [(set_attr "type" "fp")])
6292 (define_insn "btrunc<mode>2"
6293 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
6294 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")]
6296 "TARGET_<MODE>_FPR && TARGET_FPRND"
6300 [(set_attr "type" "fp")
6301 (set_attr "fp_type" "fp_addsub_<Fs>")])
6303 (define_insn "ceil<mode>2"
6304 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
6305 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")]
6307 "TARGET_<MODE>_FPR && TARGET_FPRND"
6311 [(set_attr "type" "fp")
6312 (set_attr "fp_type" "fp_addsub_<Fs>")])
6314 (define_insn "floor<mode>2"
6315 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
6316 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")]
6318 "TARGET_<MODE>_FPR && TARGET_FPRND"
6322 [(set_attr "type" "fp")
6323 (set_attr "fp_type" "fp_addsub_<Fs>")])
6325 ;; No VSX equivalent to frin
6326 (define_insn "round<mode>2"
6327 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
6328 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
6330 "TARGET_<MODE>_FPR && TARGET_FPRND"
6332 [(set_attr "type" "fp")
6333 (set_attr "fp_type" "fp_addsub_<Fs>")])
6335 ; An UNSPEC is used so we don't have to support SImode in FP registers.
6336 (define_insn "stfiwx"
6337 [(set (match_operand:SI 0 "memory_operand" "=Z")
6338 (unspec:SI [(match_operand:DI 1 "gpc_reg_operand" "d")]
6342 [(set_attr "type" "fpstore")])
6344 ;; If we don't have a direct conversion to single precision, don't enable this
6345 ;; conversion for 32-bit without fast math, because we don't have the insn to
6346 ;; generate the fixup swizzle to avoid double rounding problems.
6347 (define_expand "floatsisf2"
6348 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6349 (float:SF (match_operand:SI 1 "nonimmediate_operand" "")))]
6350 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT
6353 && ((TARGET_FCFIDS && TARGET_LFIWAX)
6354 || (TARGET_DOUBLE_FLOAT && TARGET_FCFID
6355 && (TARGET_POWERPC64 || flag_unsafe_math_optimizations)))))"
6360 if (!REG_P (operands[1]))
6361 operands[1] = force_reg (SImode, operands[1]);
6363 else if (TARGET_FCFIDS && TARGET_LFIWAX)
6365 emit_insn (gen_floatsisf2_lfiwax (operands[0], operands[1]));
6368 else if (TARGET_FCFID && TARGET_LFIWAX)
6370 rtx dfreg = gen_reg_rtx (DFmode);
6371 emit_insn (gen_floatsidf2_lfiwax (dfreg, operands[1]));
6372 emit_insn (gen_truncdfsf2 (operands[0], dfreg));
6377 rtx dreg = operands[1];
6379 dreg = force_reg (SImode, dreg);
6380 dreg = convert_to_mode (DImode, dreg, false);
6381 emit_insn (gen_floatdisf2 (operands[0], dreg));
6386 (define_expand "floatdidf2"
6387 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6388 (float:DF (match_operand:DI 1 "gpc_reg_operand" "")))]
6389 "TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS"
6392 (define_insn "*floatdidf2_fpr"
6393 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6394 (float:DF (match_operand:DI 1 "gpc_reg_operand" "d")))]
6395 "TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
6396 && !VECTOR_UNIT_VSX_P (DFmode)"
6398 [(set_attr "type" "fp")])
6400 ; Allow the combiner to merge source memory operands to the conversion so that
6401 ; the optimizer/register allocator doesn't try to load the value too early in a
6402 ; GPR and then use store/load to move it to a FPR and suffer from a store-load
6403 ; hit. We will split after reload to avoid the trip through the GPRs
6405 (define_insn_and_split "*floatdidf2_mem"
6406 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6407 (float:DF (match_operand:DI 1 "memory_operand" "m")))
6408 (clobber (match_scratch:DI 2 "=d"))]
6409 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS && TARGET_FCFID"
6411 "&& reload_completed"
6412 [(set (match_dup 2) (match_dup 1))
6413 (set (match_dup 0) (float:DF (match_dup 2)))]
6415 [(set_attr "length" "8")
6416 (set_attr "type" "fpload")])
6418 (define_expand "floatunsdidf2"
6419 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6421 (match_operand:DI 1 "gpc_reg_operand" "")))]
6422 "TARGET_HARD_FLOAT && (TARGET_FCFIDU || VECTOR_UNIT_VSX_P (DFmode))"
6425 (define_insn "*floatunsdidf2_fcfidu"
6426 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6427 (unsigned_float:DF (match_operand:DI 1 "gpc_reg_operand" "d")))]
6428 "TARGET_HARD_FLOAT && TARGET_FCFIDU && !VECTOR_UNIT_VSX_P (DFmode)"
6430 [(set_attr "type" "fp")
6431 (set_attr "length" "4")])
6433 (define_insn_and_split "*floatunsdidf2_mem"
6434 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6435 (unsigned_float:DF (match_operand:DI 1 "memory_operand" "m")))
6436 (clobber (match_scratch:DI 2 "=d"))]
6437 "TARGET_HARD_FLOAT && (TARGET_FCFIDU || VECTOR_UNIT_VSX_P (DFmode))"
6439 "&& reload_completed"
6440 [(set (match_dup 2) (match_dup 1))
6441 (set (match_dup 0) (unsigned_float:DF (match_dup 2)))]
6443 [(set_attr "length" "8")
6444 (set_attr "type" "fpload")])
6446 (define_expand "floatdisf2"
6447 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6448 (float:SF (match_operand:DI 1 "gpc_reg_operand" "")))]
6449 "TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
6450 && (TARGET_FCFIDS || TARGET_POWERPC64 || flag_unsafe_math_optimizations)"
6455 rtx val = operands[1];
6456 if (!flag_unsafe_math_optimizations)
6458 rtx label = gen_label_rtx ();
6459 val = gen_reg_rtx (DImode);
6460 emit_insn (gen_floatdisf2_internal2 (val, operands[1], label));
6463 emit_insn (gen_floatdisf2_internal1 (operands[0], val));
6468 (define_insn "floatdisf2_fcfids"
6469 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6470 (float:SF (match_operand:DI 1 "gpc_reg_operand" "d")))]
6471 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
6472 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDS"
6474 [(set_attr "type" "fp")])
6476 (define_insn_and_split "*floatdisf2_mem"
6477 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6478 (float:SF (match_operand:DI 1 "memory_operand" "m")))
6479 (clobber (match_scratch:DI 2 "=f"))]
6480 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
6481 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDS"
6483 "&& reload_completed"
6487 emit_move_insn (operands[2], operands[1]);
6488 emit_insn (gen_floatdisf2_fcfids (operands[0], operands[2]));
6491 [(set_attr "length" "8")])
6493 ;; This is not IEEE compliant if rounding mode is "round to nearest".
6494 ;; If the DI->DF conversion is inexact, then it's possible to suffer
6495 ;; from double rounding.
6496 ;; Instead of creating a new cpu type for two FP operations, just use fp
6497 (define_insn_and_split "floatdisf2_internal1"
6498 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6499 (float:SF (match_operand:DI 1 "gpc_reg_operand" "d")))
6500 (clobber (match_scratch:DF 2 "=d"))]
6501 "TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
6503 "&& reload_completed"
6505 (float:DF (match_dup 1)))
6507 (float_truncate:SF (match_dup 2)))]
6509 [(set_attr "length" "8")
6510 (set_attr "type" "fp")])
6512 ;; Twiddles bits to avoid double rounding.
6513 ;; Bits that might be truncated when converting to DFmode are replaced
6514 ;; by a bit that won't be lost at that stage, but is below the SFmode
6515 ;; rounding position.
6516 (define_expand "floatdisf2_internal2"
6517 [(set (match_dup 3) (ashiftrt:DI (match_operand:DI 1 "" "")
6519 (parallel [(set (match_operand:DI 0 "" "") (and:DI (match_dup 1)
6521 (clobber (scratch:CC))])
6522 (set (match_dup 3) (plus:DI (match_dup 3)
6524 (set (match_dup 0) (plus:DI (match_dup 0)
6526 (set (match_dup 4) (compare:CCUNS (match_dup 3)
6528 (set (match_dup 0) (ior:DI (match_dup 0)
6530 (parallel [(set (match_dup 0) (and:DI (match_dup 0)
6532 (clobber (scratch:CC))])
6533 (set (pc) (if_then_else (geu (match_dup 4) (const_int 0))
6534 (label_ref (match_operand:DI 2 "" ""))
6536 (set (match_dup 0) (match_dup 1))]
6537 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
6540 operands[3] = gen_reg_rtx (DImode);
6541 operands[4] = gen_reg_rtx (CCUNSmode);
6544 (define_expand "floatunsdisf2"
6545 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6546 (unsigned_float:SF (match_operand:DI 1 "gpc_reg_operand" "")))]
6547 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
6548 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDUS"
6551 (define_insn "floatunsdisf2_fcfidus"
6552 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6553 (unsigned_float:SF (match_operand:DI 1 "gpc_reg_operand" "d")))]
6554 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
6555 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDUS"
6557 [(set_attr "type" "fp")])
6559 (define_insn_and_split "*floatunsdisf2_mem"
6560 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6561 (unsigned_float:SF (match_operand:DI 1 "memory_operand" "m")))
6562 (clobber (match_scratch:DI 2 "=f"))]
6563 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
6564 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDUS"
6566 "&& reload_completed"
6570 emit_move_insn (operands[2], operands[1]);
6571 emit_insn (gen_floatunsdisf2_fcfidus (operands[0], operands[2]));
6574 [(set_attr "length" "8")
6575 (set_attr "type" "fpload")])
6577 ;; Define the TImode operations that can be done in a small number
6578 ;; of instructions. The & constraints are to prevent the register
6579 ;; allocator from allocating registers that overlap with the inputs
6580 ;; (for example, having an input in 7,8 and an output in 6,7). We
6581 ;; also allow for the output being the same as one of the inputs.
6583 (define_insn "addti3"
6584 [(set (match_operand:TI 0 "gpc_reg_operand" "=&r,&r,r,r")
6585 (plus:TI (match_operand:TI 1 "gpc_reg_operand" "%r,r,0,0")
6586 (match_operand:TI 2 "reg_or_short_operand" "r,I,r,I")))]
6589 if (WORDS_BIG_ENDIAN)
6590 return (GET_CODE (operands[2])) != CONST_INT
6591 ? \"addc %L0,%L1,%L2\;adde %0,%1,%2\"
6592 : \"addic %L0,%L1,%2\;add%G2e %0,%1\";
6594 return (GET_CODE (operands[2])) != CONST_INT
6595 ? \"addc %0,%1,%2\;adde %L0,%L1,%L2\"
6596 : \"addic %0,%1,%2\;add%G2e %L0,%L1\";
6598 [(set_attr "type" "two")
6599 (set_attr "length" "8")])
6601 (define_insn "subti3"
6602 [(set (match_operand:TI 0 "gpc_reg_operand" "=&r,&r,r,r,r")
6603 (minus:TI (match_operand:TI 1 "reg_or_short_operand" "r,I,0,r,I")
6604 (match_operand:TI 2 "gpc_reg_operand" "r,r,r,0,0")))]
6607 if (WORDS_BIG_ENDIAN)
6608 return (GET_CODE (operands[1]) != CONST_INT)
6609 ? \"subfc %L0,%L2,%L1\;subfe %0,%2,%1\"
6610 : \"subfic %L0,%L2,%1\;subf%G1e %0,%2\";
6612 return (GET_CODE (operands[1]) != CONST_INT)
6613 ? \"subfc %0,%2,%1\;subfe %L0,%L2,%L1\"
6614 : \"subfic %0,%2,%1\;subf%G1e %L0,%L2\";
6616 [(set_attr "type" "two")
6617 (set_attr "length" "8")])
6620 ;; Define the DImode operations that can be done in a small number
6621 ;; of instructions. The & constraints are to prevent the register
6622 ;; allocator from allocating registers that overlap with the inputs
6623 ;; (for example, having an input in 7,8 and an output in 6,7). We
6624 ;; also allow for the output being the same as one of the inputs.
6626 (define_insn "*adddi3_noppc64"
6627 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r")
6628 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,0,0")
6629 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I")))]
6630 "! TARGET_POWERPC64"
6633 if (WORDS_BIG_ENDIAN)
6634 return (GET_CODE (operands[2])) != CONST_INT
6635 ? \"addc %L0,%L1,%L2\;adde %0,%1,%2\"
6636 : \"addic %L0,%L1,%2\;add%G2e %0,%1\";
6638 return (GET_CODE (operands[2])) != CONST_INT
6639 ? \"addc %0,%1,%2\;adde %L0,%L1,%L2\"
6640 : \"addic %0,%1,%2\;add%G2e %L0,%L1\";
6642 [(set_attr "type" "two")
6643 (set_attr "length" "8")])
6645 (define_insn "*subdi3_noppc64"
6646 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r,r")
6647 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I,0,r,I")
6648 (match_operand:DI 2 "gpc_reg_operand" "r,r,r,0,0")))]
6649 "! TARGET_POWERPC64"
6652 if (WORDS_BIG_ENDIAN)
6653 return (GET_CODE (operands[1]) != CONST_INT)
6654 ? \"subfc %L0,%L2,%L1\;subfe %0,%2,%1\"
6655 : \"subfic %L0,%L2,%1\;subf%G1e %0,%2\";
6657 return (GET_CODE (operands[1]) != CONST_INT)
6658 ? \"subfc %0,%2,%1\;subfe %L0,%L2,%L1\"
6659 : \"subfic %0,%2,%1\;subf%G1e %L0,%L2\";
6661 [(set_attr "type" "two")
6662 (set_attr "length" "8")])
6664 (define_insn "*negdi2_noppc64"
6665 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6666 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))]
6667 "! TARGET_POWERPC64"
6670 return (WORDS_BIG_ENDIAN)
6671 ? \"subfic %L0,%L1,0\;subfze %0,%1\"
6672 : \"subfic %0,%1,0\;subfze %L0,%L1\";
6674 [(set_attr "type" "two")
6675 (set_attr "length" "8")])
6677 (define_insn "mulsidi3"
6678 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6679 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6680 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
6681 "! TARGET_POWERPC64"
6683 return (WORDS_BIG_ENDIAN)
6684 ? \"mulhw %0,%1,%2\;mullw %L0,%1,%2\"
6685 : \"mulhw %L0,%1,%2\;mullw %0,%1,%2\";
6687 [(set_attr "type" "mul")
6688 (set_attr "length" "8")])
6691 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6692 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6693 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6694 "! TARGET_POWERPC64 && reload_completed"
6697 (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
6698 (sign_extend:DI (match_dup 2)))
6701 (mult:SI (match_dup 1)
6705 int endian = (WORDS_BIG_ENDIAN == 0);
6706 operands[3] = operand_subword (operands[0], endian, 0, DImode);
6707 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
6710 (define_insn "umulsidi3"
6711 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6712 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6713 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
6714 "! TARGET_POWERPC64"
6717 return (WORDS_BIG_ENDIAN)
6718 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
6719 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
6721 [(set_attr "type" "mul")
6722 (set_attr "length" "8")])
6725 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6726 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6727 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6728 "! TARGET_POWERPC64 && reload_completed"
6731 (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
6732 (zero_extend:DI (match_dup 2)))
6735 (mult:SI (match_dup 1)
6739 int endian = (WORDS_BIG_ENDIAN == 0);
6740 operands[3] = operand_subword (operands[0], endian, 0, DImode);
6741 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
6744 (define_insn "smulsi3_highpart"
6745 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6747 (lshiftrt:DI (mult:DI (sign_extend:DI
6748 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6750 (match_operand:SI 2 "gpc_reg_operand" "r")))
6754 [(set_attr "type" "mul")])
6756 (define_insn "umulsi3_highpart"
6757 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6759 (lshiftrt:DI (mult:DI (zero_extend:DI
6760 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6762 (match_operand:SI 2 "gpc_reg_operand" "r")))
6766 [(set_attr "type" "mul")])
6768 ;; Shift by a variable amount is too complex to be worth open-coding. We
6769 ;; just handle shifts by constants.
6770 (define_insn "ashrdi3_no_power"
6771 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
6772 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6773 (match_operand:SI 2 "const_int_operand" "M,i")))]
6777 switch (which_alternative)
6782 if (WORDS_BIG_ENDIAN)
6783 return \"srawi %0,%1,31\;srawi %L0,%1,%h2\";
6785 return \"srawi %L0,%L1,31\;srawi %0,%L1,%h2\";
6787 if (WORDS_BIG_ENDIAN)
6788 return \"srwi %L0,%L1,%h2\;insrwi %L0,%1,%h2,0\;srawi %0,%1,%h2\";
6790 return \"srwi %0,%1,%h2\;insrwi %0,%L1,%h2,0\;srawi %L0,%L1,%h2\";
6793 [(set_attr "type" "two,three")
6794 (set_attr "length" "8,12")])
6796 (define_insn "*ashrdisi3_noppc64be"
6797 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6798 (subreg:SI (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6799 (const_int 32)) 4))]
6800 "TARGET_32BIT && !TARGET_POWERPC64 && WORDS_BIG_ENDIAN"
6803 if (REGNO (operands[0]) == REGNO (operands[1]))
6806 return \"mr %0,%1\";
6808 [(set_attr "length" "4")])
6811 ;; PowerPC64 DImode operations.
6813 (define_insn "muldi3"
6814 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6815 (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6816 (match_operand:DI 2 "reg_or_short_operand" "r,I")))]
6821 [(set_attr "type" "mul")
6823 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
6825 (match_operand:SI 2 "short_cint_operand" "")
6826 (const_string "16")]
6827 (const_string "64")))])
6829 (define_insn "*muldi3_internal1"
6830 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6831 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6832 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6834 (clobber (match_scratch:DI 3 "=r,r"))]
6839 [(set_attr "type" "mul")
6840 (set_attr "size" "64")
6841 (set_attr "dot" "yes")
6842 (set_attr "length" "4,8")])
6845 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6846 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
6847 (match_operand:DI 2 "gpc_reg_operand" ""))
6849 (clobber (match_scratch:DI 3 ""))]
6850 "TARGET_POWERPC64 && reload_completed"
6852 (mult:DI (match_dup 1) (match_dup 2)))
6854 (compare:CC (match_dup 3)
6858 (define_insn "*muldi3_internal2"
6859 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6860 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6861 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6863 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6864 (mult:DI (match_dup 1) (match_dup 2)))]
6869 [(set_attr "type" "mul")
6870 (set_attr "size" "64")
6871 (set_attr "dot" "yes")
6872 (set_attr "length" "4,8")])
6875 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
6876 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
6877 (match_operand:DI 2 "gpc_reg_operand" ""))
6879 (set (match_operand:DI 0 "gpc_reg_operand" "")
6880 (mult:DI (match_dup 1) (match_dup 2)))]
6881 "TARGET_POWERPC64 && reload_completed"
6883 (mult:DI (match_dup 1) (match_dup 2)))
6885 (compare:CC (match_dup 0)
6889 (define_insn "smuldi3_highpart"
6890 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6892 (lshiftrt:TI (mult:TI (sign_extend:TI
6893 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6895 (match_operand:DI 2 "gpc_reg_operand" "r")))
6899 [(set_attr "type" "mul")
6900 (set_attr "size" "64")])
6902 (define_insn "umuldi3_highpart"
6903 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6905 (lshiftrt:TI (mult:TI (zero_extend:TI
6906 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6908 (match_operand:DI 2 "gpc_reg_operand" "r")))
6912 [(set_attr "type" "mul")
6913 (set_attr "size" "64")])
6915 (define_expand "mulditi3"
6916 [(set (match_operand:TI 0 "gpc_reg_operand")
6917 (mult:TI (sign_extend:TI (match_operand:DI 1 "gpc_reg_operand"))
6918 (sign_extend:TI (match_operand:DI 2 "gpc_reg_operand"))))]
6921 rtx l = gen_reg_rtx (DImode), h = gen_reg_rtx (DImode);
6922 emit_insn (gen_muldi3 (l, operands[1], operands[2]));
6923 emit_insn (gen_smuldi3_highpart (h, operands[1], operands[2]));
6924 emit_move_insn (gen_lowpart (DImode, operands[0]), l);
6925 emit_move_insn (gen_highpart (DImode, operands[0]), h);
6929 (define_expand "umulditi3"
6930 [(set (match_operand:TI 0 "gpc_reg_operand")
6931 (mult:TI (zero_extend:TI (match_operand:DI 1 "gpc_reg_operand"))
6932 (zero_extend:TI (match_operand:DI 2 "gpc_reg_operand"))))]
6935 rtx l = gen_reg_rtx (DImode), h = gen_reg_rtx (DImode);
6936 emit_insn (gen_muldi3 (l, operands[1], operands[2]));
6937 emit_insn (gen_umuldi3_highpart (h, operands[1], operands[2]));
6938 emit_move_insn (gen_lowpart (DImode, operands[0]), l);
6939 emit_move_insn (gen_highpart (DImode, operands[0]), h);
6943 (define_insn "rotldi3"
6944 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6945 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6946 (match_operand:DI 2 "reg_or_cint_operand" "r,i")))]
6951 [(set_attr "type" "shift,integer")
6952 (set_attr "var_shift" "yes,no")])
6954 (define_insn "*rotldi3_internal2"
6955 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
6956 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6957 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
6959 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
6966 [(set_attr "type" "shift")
6967 (set_attr "var_shift" "yes,no,yes,no")
6968 (set_attr "dot" "yes")
6969 (set_attr "length" "4,4,8,8")])
6972 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
6973 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6974 (match_operand:DI 2 "reg_or_cint_operand" ""))
6976 (clobber (match_scratch:DI 3 ""))]
6977 "TARGET_POWERPC64 && reload_completed"
6979 (rotate:DI (match_dup 1) (match_dup 2)))
6981 (compare:CC (match_dup 3)
6985 (define_insn "*rotldi3_internal3"
6986 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
6987 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6988 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
6990 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
6991 (rotate:DI (match_dup 1) (match_dup 2)))]
6998 [(set_attr "type" "shift")
6999 (set_attr "var_shift" "yes,no,yes,no")
7000 (set_attr "dot" "yes")
7001 (set_attr "length" "4,4,8,8")])
7004 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7005 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7006 (match_operand:DI 2 "reg_or_cint_operand" ""))
7008 (set (match_operand:DI 0 "gpc_reg_operand" "")
7009 (rotate:DI (match_dup 1) (match_dup 2)))]
7010 "TARGET_POWERPC64 && reload_completed"
7012 (rotate:DI (match_dup 1) (match_dup 2)))
7014 (compare:CC (match_dup 0)
7018 (define_insn "*rotldi3_internal4"
7019 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7020 (and:DI (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7021 (match_operand:DI 2 "reg_or_cint_operand" "r,i"))
7022 (match_operand:DI 3 "mask64_operand" "n,n")))]
7025 rldc%B3 %0,%1,%2,%S3
7026 rldic%B3 %0,%1,%H2,%S3"
7027 [(set_attr "type" "shift,integer")
7028 (set_attr "var_shift" "yes,no")])
7030 (define_insn "*rotldi3_internal5"
7031 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7033 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7034 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
7035 (match_operand:DI 3 "mask64_operand" "n,n,n,n"))
7037 (clobber (match_scratch:DI 4 "=r,r,r,r"))]
7040 rldc%B3. %4,%1,%2,%S3
7041 rldic%B3. %4,%1,%H2,%S3
7044 [(set_attr "type" "shift")
7045 (set_attr "var_shift" "yes,no,yes,no")
7046 (set_attr "dot" "yes")
7047 (set_attr "length" "4,4,8,8")])
7050 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7052 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7053 (match_operand:DI 2 "reg_or_cint_operand" ""))
7054 (match_operand:DI 3 "mask64_operand" ""))
7056 (clobber (match_scratch:DI 4 ""))]
7057 "TARGET_POWERPC64 && reload_completed"
7059 (and:DI (rotate:DI (match_dup 1)
7063 (compare:CC (match_dup 4)
7067 (define_insn "*rotldi3_internal6"
7068 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
7070 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7071 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
7072 (match_operand:DI 3 "mask64_operand" "n,n,n,n"))
7074 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7075 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7078 rldc%B3. %0,%1,%2,%S3
7079 rldic%B3. %0,%1,%H2,%S3
7082 [(set_attr "type" "shift")
7083 (set_attr "var_shift" "yes,no,yes,no")
7084 (set_attr "dot" "yes")
7085 (set_attr "length" "4,4,8,8")])
7088 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
7090 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7091 (match_operand:DI 2 "reg_or_cint_operand" ""))
7092 (match_operand:DI 3 "mask64_operand" ""))
7094 (set (match_operand:DI 0 "gpc_reg_operand" "")
7095 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7096 "TARGET_POWERPC64 && reload_completed"
7098 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
7100 (compare:CC (match_dup 0)
7104 (define_insn "*rotldi3_internal7le"
7105 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7108 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7109 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
7110 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN"
7113 rldicl %0,%1,%H2,56"
7114 [(set_attr "type" "shift,integer")
7115 (set_attr "var_shift" "yes,no")])
7117 (define_insn "*rotldi3_internal7be"
7118 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7121 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7122 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 7)))]
7123 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN"
7126 rldicl %0,%1,%H2,56"
7127 [(set_attr "type" "shift,integer")
7128 (set_attr "var_shift" "yes,no")])
7130 (define_insn "*rotldi3_internal8le"
7131 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7132 (compare:CC (zero_extend:DI
7134 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7135 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7137 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7138 "TARGET_64BIT && !BYTES_BIG_ENDIAN"
7141 rldicl. %3,%1,%H2,56
7144 [(set_attr "type" "shift")
7145 (set_attr "var_shift" "yes,no,yes,no")
7146 (set_attr "dot" "yes")
7147 (set_attr "length" "4,4,8,8")])
7149 (define_insn "*rotldi3_internal8be"
7150 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7151 (compare:CC (zero_extend:DI
7153 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7154 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 7))
7156 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7157 "TARGET_64BIT && BYTES_BIG_ENDIAN"
7160 rldicl. %3,%1,%H2,56
7163 [(set_attr "type" "shift")
7164 (set_attr "var_shift" "yes,no,yes,no")
7165 (set_attr "dot" "yes")
7166 (set_attr "length" "4,4,8,8")])
7169 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7170 (compare:CC (zero_extend:DI
7172 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7173 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7175 (clobber (match_scratch:DI 3 ""))]
7176 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN && reload_completed"
7178 (zero_extend:DI (subreg:QI
7179 (rotate:DI (match_dup 1)
7182 (compare:CC (match_dup 3)
7187 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7188 (compare:CC (zero_extend:DI
7190 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7191 (match_operand:DI 2 "reg_or_cint_operand" "")) 7))
7193 (clobber (match_scratch:DI 3 ""))]
7194 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN && reload_completed"
7196 (zero_extend:DI (subreg:QI
7197 (rotate:DI (match_dup 1)
7200 (compare:CC (match_dup 3)
7204 (define_insn "*rotldi3_internal9le"
7205 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7206 (compare:CC (zero_extend:DI
7208 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7209 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7211 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7212 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7213 "TARGET_64BIT && !BYTES_BIG_ENDIAN"
7216 rldicl. %0,%1,%H2,56
7219 [(set_attr "type" "shift")
7220 (set_attr "var_shift" "yes,no,yes,no")
7221 (set_attr "dot" "yes")
7222 (set_attr "length" "4,4,8,8")])
7224 (define_insn "*rotldi3_internal9be"
7225 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7226 (compare:CC (zero_extend:DI
7228 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7229 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 7))
7231 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7232 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 7)))]
7233 "TARGET_64BIT && BYTES_BIG_ENDIAN"
7236 rldicl. %0,%1,%H2,56
7239 [(set_attr "type" "shift")
7240 (set_attr "var_shift" "yes,no,yes,no")
7241 (set_attr "dot" "yes")
7242 (set_attr "length" "4,4,8,8")])
7245 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7246 (compare:CC (zero_extend:DI
7248 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7249 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7251 (set (match_operand:DI 0 "gpc_reg_operand" "")
7252 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7253 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN && reload_completed"
7255 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
7257 (compare:CC (match_dup 0)
7262 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7263 (compare:CC (zero_extend:DI
7265 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7266 (match_operand:DI 2 "reg_or_cint_operand" "")) 7))
7268 (set (match_operand:DI 0 "gpc_reg_operand" "")
7269 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 7)))]
7270 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN && reload_completed"
7272 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 7)))
7274 (compare:CC (match_dup 0)
7278 (define_insn "*rotldi3_internal10le"
7279 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7282 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7283 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
7284 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN"
7287 rldicl %0,%1,%H2,48"
7288 [(set_attr "type" "shift,integer")
7289 (set_attr "var_shift" "yes,no")])
7291 (define_insn "*rotldi3_internal10be"
7292 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7295 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7296 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 6)))]
7297 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN"
7300 rldicl %0,%1,%H2,48"
7301 [(set_attr "type" "shift,integer")
7302 (set_attr "var_shift" "yes,no")])
7304 (define_insn "*rotldi3_internal11le"
7305 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7306 (compare:CC (zero_extend:DI
7308 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7309 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7311 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7312 "TARGET_64BIT && !BYTES_BIG_ENDIAN"
7315 rldicl. %3,%1,%H2,48
7318 [(set_attr "type" "shift")
7319 (set_attr "var_shift" "yes,no,yes,no")
7320 (set_attr "dot" "yes")
7321 (set_attr "length" "4,4,8,8")])
7323 (define_insn "*rotldi3_internal11be"
7324 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7325 (compare:CC (zero_extend:DI
7327 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7328 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 6))
7330 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7331 "TARGET_64BIT && BYTES_BIG_ENDIAN"
7334 rldicl. %3,%1,%H2,48
7337 [(set_attr "type" "shift")
7338 (set_attr "var_shift" "yes,no,yes,no")
7339 (set_attr "dot" "yes")
7340 (set_attr "length" "4,4,8,8")])
7343 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7344 (compare:CC (zero_extend:DI
7346 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7347 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7349 (clobber (match_scratch:DI 3 ""))]
7350 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN && reload_completed"
7352 (zero_extend:DI (subreg:HI
7353 (rotate:DI (match_dup 1)
7356 (compare:CC (match_dup 3)
7361 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7362 (compare:CC (zero_extend:DI
7364 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7365 (match_operand:DI 2 "reg_or_cint_operand" "")) 6))
7367 (clobber (match_scratch:DI 3 ""))]
7368 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN && reload_completed"
7370 (zero_extend:DI (subreg:HI
7371 (rotate:DI (match_dup 1)
7374 (compare:CC (match_dup 3)
7378 (define_insn "*rotldi3_internal12le"
7379 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7380 (compare:CC (zero_extend:DI
7382 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7383 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7385 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7386 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7387 "TARGET_64BIT && !BYTES_BIG_ENDIAN"
7390 rldicl. %0,%1,%H2,48
7393 [(set_attr "type" "shift")
7394 (set_attr "var_shift" "yes,no,yes,no")
7395 (set_attr "dot" "yes")
7396 (set_attr "length" "4,4,8,8")])
7398 (define_insn "*rotldi3_internal12be"
7399 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7400 (compare:CC (zero_extend:DI
7402 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7403 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 6))
7405 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7406 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 6)))]
7407 "TARGET_64BIT && BYTES_BIG_ENDIAN"
7410 rldicl. %0,%1,%H2,48
7413 [(set_attr "type" "shift")
7414 (set_attr "var_shift" "yes,no,yes,no")
7415 (set_attr "dot" "yes")
7416 (set_attr "length" "4,4,8,8")])
7419 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7420 (compare:CC (zero_extend:DI
7422 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7423 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7425 (set (match_operand:DI 0 "gpc_reg_operand" "")
7426 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7427 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN && reload_completed"
7429 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
7431 (compare:CC (match_dup 0)
7436 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7437 (compare:CC (zero_extend:DI
7439 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7440 (match_operand:DI 2 "reg_or_cint_operand" "")) 6))
7442 (set (match_operand:DI 0 "gpc_reg_operand" "")
7443 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 6)))]
7444 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN && reload_completed"
7446 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 6)))
7448 (compare:CC (match_dup 0)
7452 (define_insn "*rotldi3_internal13le"
7453 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7456 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7457 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
7458 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN"
7461 rldicl %0,%1,%H2,32"
7462 [(set_attr "type" "shift,integer")
7463 (set_attr "var_shift" "yes,no")])
7465 (define_insn "*rotldi3_internal13be"
7466 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7469 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7470 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 4)))]
7471 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN"
7474 rldicl %0,%1,%H2,32"
7475 [(set_attr "type" "shift,integer")
7476 (set_attr "var_shift" "yes,no")])
7478 (define_insn "*rotldi3_internal14le"
7479 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7480 (compare:CC (zero_extend:DI
7482 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7483 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7485 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7486 "TARGET_64BIT && !BYTES_BIG_ENDIAN"
7489 rldicl. %3,%1,%H2,32
7492 [(set_attr "type" "shift")
7493 (set_attr "var_shift" "yes,no,yes,no")
7494 (set_attr "dot" "yes")
7495 (set_attr "length" "4,4,8,8")])
7497 (define_insn "*rotldi3_internal14be"
7498 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7499 (compare:CC (zero_extend:DI
7501 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7502 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 4))
7504 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7505 "TARGET_64BIT && BYTES_BIG_ENDIAN"
7508 rldicl. %3,%1,%H2,32
7511 [(set_attr "type" "shift")
7512 (set_attr "var_shift" "yes,no,yes,no")
7513 (set_attr "dot" "yes")
7514 (set_attr "length" "4,4,8,8")])
7517 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7518 (compare:CC (zero_extend:DI
7520 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7521 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7523 (clobber (match_scratch:DI 3 ""))]
7524 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN && reload_completed"
7526 (zero_extend:DI (subreg:SI
7527 (rotate:DI (match_dup 1)
7530 (compare:CC (match_dup 3)
7535 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7536 (compare:CC (zero_extend:DI
7538 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7539 (match_operand:DI 2 "reg_or_cint_operand" "")) 4))
7541 (clobber (match_scratch:DI 3 ""))]
7542 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN && reload_completed"
7544 (zero_extend:DI (subreg:SI
7545 (rotate:DI (match_dup 1)
7548 (compare:CC (match_dup 3)
7552 (define_insn "*rotldi3_internal15le"
7553 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7554 (compare:CC (zero_extend:DI
7556 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7557 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7559 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7560 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7561 "TARGET_64BIT && !BYTES_BIG_ENDIAN"
7564 rldicl. %0,%1,%H2,32
7567 [(set_attr "type" "shift")
7568 (set_attr "var_shift" "yes,no,yes,no")
7569 (set_attr "dot" "yes")
7570 (set_attr "length" "4,4,8,8")])
7572 (define_insn "*rotldi3_internal15be"
7573 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7574 (compare:CC (zero_extend:DI
7576 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7577 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 4))
7579 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7580 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 4)))]
7581 "TARGET_64BIT && BYTES_BIG_ENDIAN"
7584 rldicl. %0,%1,%H2,32
7587 [(set_attr "type" "shift")
7588 (set_attr "var_shift" "yes,no,yes,no")
7589 (set_attr "dot" "yes")
7590 (set_attr "length" "4,4,8,8")])
7593 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7594 (compare:CC (zero_extend:DI
7596 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7597 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7599 (set (match_operand:DI 0 "gpc_reg_operand" "")
7600 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7601 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN && reload_completed"
7603 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
7605 (compare:CC (match_dup 0)
7610 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7611 (compare:CC (zero_extend:DI
7613 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7614 (match_operand:DI 2 "reg_or_cint_operand" "")) 4))
7616 (set (match_operand:DI 0 "gpc_reg_operand" "")
7617 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 4)))]
7618 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN && reload_completed"
7620 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 4)))
7622 (compare:CC (match_dup 0)
7626 (define_expand "ashldi3"
7627 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7628 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7629 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7633 (define_insn "*ashldi3_internal1"
7634 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7635 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7636 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
7641 [(set_attr "type" "shift")
7642 (set_attr "var_shift" "yes,no")])
7644 (define_insn "*ashldi3_internal2"
7645 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7646 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7647 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7649 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7656 [(set_attr "type" "shift")
7657 (set_attr "var_shift" "yes,no,yes,no")
7658 (set_attr "dot" "yes")
7659 (set_attr "length" "4,4,8,8")])
7662 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7663 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7664 (match_operand:SI 2 "reg_or_cint_operand" ""))
7666 (clobber (match_scratch:DI 3 ""))]
7667 "TARGET_POWERPC64 && reload_completed"
7669 (ashift:DI (match_dup 1) (match_dup 2)))
7671 (compare:CC (match_dup 3)
7675 (define_insn "*ashldi3_internal3"
7676 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7677 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7678 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7680 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7681 (ashift:DI (match_dup 1) (match_dup 2)))]
7688 [(set_attr "type" "shift")
7689 (set_attr "var_shift" "yes,no,yes,no")
7690 (set_attr "dot" "yes")
7691 (set_attr "length" "4,4,8,8")])
7694 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7695 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7696 (match_operand:SI 2 "reg_or_cint_operand" ""))
7698 (set (match_operand:DI 0 "gpc_reg_operand" "")
7699 (ashift:DI (match_dup 1) (match_dup 2)))]
7700 "TARGET_POWERPC64 && reload_completed"
7702 (ashift:DI (match_dup 1) (match_dup 2)))
7704 (compare:CC (match_dup 0)
7708 (define_insn "*ashldi3_internal4"
7709 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7710 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7711 (match_operand:SI 2 "const_int_operand" "i"))
7712 (match_operand:DI 3 "const_int_operand" "n")))]
7713 "TARGET_POWERPC64 && includes_rldic_lshift_p (operands[2], operands[3])"
7714 "rldic %0,%1,%H2,%W3")
7716 (define_insn "ashldi3_internal5"
7717 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7719 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7720 (match_operand:SI 2 "const_int_operand" "i,i"))
7721 (match_operand:DI 3 "const_int_operand" "n,n"))
7723 (clobber (match_scratch:DI 4 "=r,r"))]
7724 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
7726 rldic. %4,%1,%H2,%W3
7728 [(set_attr "type" "compare")
7729 (set_attr "length" "4,8")])
7732 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7734 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7735 (match_operand:SI 2 "const_int_operand" ""))
7736 (match_operand:DI 3 "const_int_operand" ""))
7738 (clobber (match_scratch:DI 4 ""))]
7739 "TARGET_POWERPC64 && reload_completed
7740 && includes_rldic_lshift_p (operands[2], operands[3])"
7742 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7745 (compare:CC (match_dup 4)
7749 (define_insn "*ashldi3_internal6"
7750 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
7752 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7753 (match_operand:SI 2 "const_int_operand" "i,i"))
7754 (match_operand:DI 3 "const_int_operand" "n,n"))
7756 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7757 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7758 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
7760 rldic. %0,%1,%H2,%W3
7762 [(set_attr "type" "compare")
7763 (set_attr "length" "4,8")])
7766 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
7768 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7769 (match_operand:SI 2 "const_int_operand" ""))
7770 (match_operand:DI 3 "const_int_operand" ""))
7772 (set (match_operand:DI 0 "gpc_reg_operand" "")
7773 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7774 "TARGET_POWERPC64 && reload_completed
7775 && includes_rldic_lshift_p (operands[2], operands[3])"
7777 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7780 (compare:CC (match_dup 0)
7784 (define_insn "*ashldi3_internal7"
7785 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7786 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7787 (match_operand:SI 2 "const_int_operand" "i"))
7788 (match_operand:DI 3 "mask64_operand" "n")))]
7789 "TARGET_POWERPC64 && includes_rldicr_lshift_p (operands[2], operands[3])"
7790 "rldicr %0,%1,%H2,%S3")
7792 (define_insn "ashldi3_internal8"
7793 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7795 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7796 (match_operand:SI 2 "const_int_operand" "i,i"))
7797 (match_operand:DI 3 "mask64_operand" "n,n"))
7799 (clobber (match_scratch:DI 4 "=r,r"))]
7800 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
7802 rldicr. %4,%1,%H2,%S3
7804 [(set_attr "type" "compare")
7805 (set_attr "length" "4,8")])
7808 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7810 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7811 (match_operand:SI 2 "const_int_operand" ""))
7812 (match_operand:DI 3 "mask64_operand" ""))
7814 (clobber (match_scratch:DI 4 ""))]
7815 "TARGET_POWERPC64 && reload_completed
7816 && includes_rldicr_lshift_p (operands[2], operands[3])"
7818 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7821 (compare:CC (match_dup 4)
7825 (define_insn "*ashldi3_internal9"
7826 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
7828 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7829 (match_operand:SI 2 "const_int_operand" "i,i"))
7830 (match_operand:DI 3 "mask64_operand" "n,n"))
7832 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7833 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7834 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
7836 rldicr. %0,%1,%H2,%S3
7838 [(set_attr "type" "compare")
7839 (set_attr "length" "4,8")])
7842 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
7844 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7845 (match_operand:SI 2 "const_int_operand" ""))
7846 (match_operand:DI 3 "mask64_operand" ""))
7848 (set (match_operand:DI 0 "gpc_reg_operand" "")
7849 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7850 "TARGET_POWERPC64 && reload_completed
7851 && includes_rldicr_lshift_p (operands[2], operands[3])"
7853 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7856 (compare:CC (match_dup 0)
7860 (define_expand "lshrdi3"
7861 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7862 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7863 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7867 (define_insn "*lshrdi3_internal1"
7868 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7869 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7870 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
7875 [(set_attr "type" "shift")
7876 (set_attr "var_shift" "yes,no")])
7878 (define_insn "*lshrdi3_internal2"
7879 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7880 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7881 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7883 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7890 [(set_attr "type" "shift")
7891 (set_attr "var_shift" "yes,no,yes,no")
7892 (set_attr "dot" "yes")
7893 (set_attr "length" "4,4,8,8")])
7896 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7897 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7898 (match_operand:SI 2 "reg_or_cint_operand" ""))
7900 (clobber (match_scratch:DI 3 ""))]
7901 "TARGET_POWERPC64 && reload_completed"
7903 (lshiftrt:DI (match_dup 1) (match_dup 2)))
7905 (compare:CC (match_dup 3)
7909 (define_insn "*lshrdi3_internal3"
7910 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7911 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7912 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7914 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7915 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
7922 [(set_attr "type" "shift")
7923 (set_attr "var_shift" "yes,no,yes,no")
7924 (set_attr "dot" "yes")
7925 (set_attr "length" "4,4,8,8")])
7928 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7929 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7930 (match_operand:SI 2 "reg_or_cint_operand" ""))
7932 (set (match_operand:DI 0 "gpc_reg_operand" "")
7933 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
7934 "TARGET_POWERPC64 && reload_completed"
7936 (lshiftrt:DI (match_dup 1) (match_dup 2)))
7938 (compare:CC (match_dup 0)
7942 (define_expand "ashrdi3"
7943 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7944 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7945 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7949 if (TARGET_POWERPC64)
7951 else if (GET_CODE (operands[2]) == CONST_INT)
7953 emit_insn (gen_ashrdi3_no_power (operands[0], operands[1], operands[2]));
7960 (define_insn "*ashrdi3_internal1"
7961 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7962 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7963 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
7968 [(set_attr "type" "shift")
7969 (set_attr "var_shift" "yes,no")])
7971 (define_insn "*ashrdi3_internal2"
7972 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7973 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7974 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7976 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7983 [(set_attr "type" "shift")
7984 (set_attr "var_shift" "yes,no,yes,no")
7985 (set_attr "dot" "yes")
7986 (set_attr "length" "4,4,8,8")])
7989 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7990 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7991 (match_operand:SI 2 "reg_or_cint_operand" ""))
7993 (clobber (match_scratch:DI 3 ""))]
7994 "TARGET_POWERPC64 && reload_completed"
7996 (ashiftrt:DI (match_dup 1) (match_dup 2)))
7998 (compare:CC (match_dup 3)
8002 (define_insn "*ashrdi3_internal3"
8003 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
8004 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8005 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
8007 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
8008 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
8015 [(set_attr "type" "shift")
8016 (set_attr "var_shift" "yes,no,yes,no")
8017 (set_attr "dot" "yes")
8018 (set_attr "length" "4,4,8,8")])
8021 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
8022 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
8023 (match_operand:SI 2 "reg_or_cint_operand" ""))
8025 (set (match_operand:DI 0 "gpc_reg_operand" "")
8026 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
8027 "TARGET_POWERPC64 && reload_completed"
8029 (ashiftrt:DI (match_dup 1) (match_dup 2)))
8031 (compare:CC (match_dup 0)
8035 (define_expand "anddi3"
8037 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8038 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8039 (match_operand:DI 2 "reg_or_cint_operand" "")))
8040 (clobber (match_scratch:CC 3 ""))])]
8043 if (!TARGET_POWERPC64)
8045 rtx cc = gen_rtx_SCRATCH (CCmode);
8046 rs6000_split_logical (operands, AND, false, false, false, cc);
8049 else if (!and64_2_operand (operands[2], DImode))
8050 operands[2] = force_reg (DImode, operands[2]);
8053 (define_insn "anddi3_mc"
8054 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
8055 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r")
8056 (match_operand:DI 2 "and64_2_operand" "?r,S,T,K,J,t")))
8057 (clobber (match_scratch:CC 3 "=X,X,X,x,x,X"))]
8058 "TARGET_POWERPC64 && rs6000_gen_cell_microcode"
8061 rldic%B2 %0,%1,0,%S2
8062 rlwinm %0,%1,0,%m2,%M2
8066 [(set_attr "type" "*,*,*,fast_compare,fast_compare,*")
8067 (set_attr "length" "4,4,4,4,4,8")])
8069 (define_insn "anddi3_nomc"
8070 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
8071 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r")
8072 (match_operand:DI 2 "and64_2_operand" "?r,S,T,t")))
8073 (clobber (match_scratch:CC 3 "=X,X,X,X"))]
8074 "TARGET_POWERPC64 && !rs6000_gen_cell_microcode"
8077 rldic%B2 %0,%1,0,%S2
8078 rlwinm %0,%1,0,%m2,%M2
8080 [(set_attr "length" "4,4,4,8")])
8083 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8084 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8085 (match_operand:DI 2 "mask64_2_operand" "")))
8086 (clobber (match_scratch:CC 3 ""))]
8088 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
8089 && !mask_operand (operands[2], DImode)
8090 && !mask64_operand (operands[2], DImode)"
8092 (and:DI (rotate:DI (match_dup 1)
8096 (and:DI (rotate:DI (match_dup 0)
8100 build_mask64_2_operands (operands[2], &operands[4]);
8103 (define_insn "*anddi3_internal2_mc"
8104 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,x,?y,?y,?y,??y,??y,?y")
8105 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r,r,r")
8106 (match_operand:DI 2 "and64_2_operand" "r,S,T,K,J,t,r,S,T,K,J,t"))
8108 (clobber (match_scratch:DI 3 "=r,r,r,r,r,r,r,r,r,r,r,r"))
8109 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,X,X,x,x,X"))]
8110 "TARGET_64BIT && rs6000_gen_cell_microcode"
8113 rldic%B2. %3,%1,0,%S2
8114 rlwinm. %3,%1,0,%m2,%M2
8124 [(set_attr "type" "fast_compare,compare,shift,fast_compare,\
8125 fast_compare,compare,compare,compare,compare,compare,\
8127 (set_attr "dot" "yes")
8128 (set_attr "length" "4,4,4,4,4,8,8,8,8,8,8,12")])
8131 [(set (match_operand:CC 0 "cc_reg_operand" "")
8132 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8133 (match_operand:DI 2 "mask64_2_operand" ""))
8135 (clobber (match_scratch:DI 3 ""))
8136 (clobber (match_scratch:CC 4 ""))]
8137 "TARGET_64BIT && reload_completed
8138 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
8139 && !mask_operand (operands[2], DImode)
8140 && !mask64_operand (operands[2], DImode)"
8142 (and:DI (rotate:DI (match_dup 1)
8145 (parallel [(set (match_dup 0)
8146 (compare:CC (and:DI (rotate:DI (match_dup 3)
8150 (clobber (match_dup 3))])]
8153 build_mask64_2_operands (operands[2], &operands[5]);
8156 (define_insn "*anddi3_internal3_mc"
8157 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,x,x,?y,?y,?y,??y,??y,?y")
8158 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r,r,r")
8159 (match_operand:DI 2 "and64_2_operand" "r,S,T,K,J,t,r,S,T,K,J,t"))
8161 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r,r,r")
8162 (and:DI (match_dup 1) (match_dup 2)))
8163 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,X,X,x,x,X"))]
8164 "TARGET_64BIT && rs6000_gen_cell_microcode"
8167 rldic%B2. %0,%1,0,%S2
8168 rlwinm. %0,%1,0,%m2,%M2
8178 [(set_attr "type" "fast_compare,compare,shift,fast_compare,\
8179 fast_compare,compare,compare,compare,compare,compare,\
8181 (set_attr "dot" "yes")
8182 (set_attr "length" "4,4,4,4,4,8,8,8,8,8,8,12")])
8185 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8186 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8187 (match_operand:DI 2 "and64_2_operand" ""))
8189 (set (match_operand:DI 0 "gpc_reg_operand" "")
8190 (and:DI (match_dup 1) (match_dup 2)))
8191 (clobber (match_scratch:CC 4 ""))]
8192 "TARGET_64BIT && reload_completed"
8193 [(parallel [(set (match_dup 0)
8194 (and:DI (match_dup 1) (match_dup 2)))
8195 (clobber (match_dup 4))])
8197 (compare:CC (match_dup 0)
8202 [(set (match_operand:CC 3 "cc_reg_operand" "")
8203 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8204 (match_operand:DI 2 "mask64_2_operand" ""))
8206 (set (match_operand:DI 0 "gpc_reg_operand" "")
8207 (and:DI (match_dup 1) (match_dup 2)))
8208 (clobber (match_scratch:CC 4 ""))]
8209 "TARGET_64BIT && reload_completed
8210 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
8211 && !mask_operand (operands[2], DImode)
8212 && !mask64_operand (operands[2], DImode)"
8214 (and:DI (rotate:DI (match_dup 1)
8217 (parallel [(set (match_dup 3)
8218 (compare:CC (and:DI (rotate:DI (match_dup 0)
8223 (and:DI (rotate:DI (match_dup 0)
8228 build_mask64_2_operands (operands[2], &operands[5]);
8231 (define_expand "iordi3"
8232 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8233 (ior:DI (match_operand:DI 1 "gpc_reg_operand" "")
8234 (match_operand:DI 2 "reg_or_cint_operand" "")))]
8237 if (!TARGET_POWERPC64)
8239 rs6000_split_logical (operands, IOR, false, false, false, NULL_RTX);
8242 else if (!reg_or_logical_cint_operand (operands[2], DImode))
8243 operands[2] = force_reg (DImode, operands[2]);
8244 else if (non_logical_cint_operand (operands[2], DImode))
8246 HOST_WIDE_INT value;
8247 rtx tmp = ((!can_create_pseudo_p ()
8248 || rtx_equal_p (operands[0], operands[1]))
8249 ? operands[0] : gen_reg_rtx (DImode));
8251 value = INTVAL (operands[2]);
8252 emit_insn (gen_iordi3 (tmp, operands[1],
8253 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
8255 emit_insn (gen_iordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
8260 (define_expand "xordi3"
8261 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8262 (xor:DI (match_operand:DI 1 "gpc_reg_operand" "")
8263 (match_operand:DI 2 "reg_or_cint_operand" "")))]
8266 if (!TARGET_POWERPC64)
8268 rs6000_split_logical (operands, XOR, false, false, false, NULL_RTX);
8271 else if (!reg_or_logical_cint_operand (operands[2], DImode))
8272 operands[2] = force_reg (DImode, operands[2]);
8273 if (non_logical_cint_operand (operands[2], DImode))
8275 HOST_WIDE_INT value;
8276 rtx tmp = ((!can_create_pseudo_p ()
8277 || rtx_equal_p (operands[0], operands[1]))
8278 ? operands[0] : gen_reg_rtx (DImode));
8280 value = INTVAL (operands[2]);
8281 emit_insn (gen_xordi3 (tmp, operands[1],
8282 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
8284 emit_insn (gen_xordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
8289 (define_insn "*booldi3_internal1"
8290 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
8291 (match_operator:DI 3 "boolean_or_operator"
8292 [(match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
8293 (match_operand:DI 2 "logical_operand" "r,K,JF")]))]
8300 (define_insn "*booldi3_internal2"
8301 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
8302 (compare:CC (match_operator:DI 4 "boolean_or_operator"
8303 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
8304 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
8306 (clobber (match_scratch:DI 3 "=r,r"))]
8311 [(set_attr "type" "fast_compare,compare")
8312 (set_attr "length" "4,8")])
8315 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8316 (compare:CC (match_operator:DI 4 "boolean_operator"
8317 [(match_operand:DI 1 "gpc_reg_operand" "")
8318 (match_operand:DI 2 "gpc_reg_operand" "")])
8320 (clobber (match_scratch:DI 3 ""))]
8321 "TARGET_POWERPC64 && reload_completed"
8322 [(set (match_dup 3) (match_dup 4))
8324 (compare:CC (match_dup 3)
8328 (define_insn "*booldi3_internal3"
8329 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
8330 (compare:CC (match_operator:DI 4 "boolean_or_operator"
8331 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
8332 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
8334 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8340 [(set_attr "type" "fast_compare,compare")
8341 (set_attr "length" "4,8")])
8344 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8345 (compare:CC (match_operator:DI 4 "boolean_operator"
8346 [(match_operand:DI 1 "gpc_reg_operand" "")
8347 (match_operand:DI 2 "gpc_reg_operand" "")])
8349 (set (match_operand:DI 0 "gpc_reg_operand" "")
8351 "TARGET_POWERPC64 && reload_completed"
8352 [(set (match_dup 0) (match_dup 4))
8354 (compare:CC (match_dup 0)
8358 ;; Split a logical operation that we can't do in one insn into two insns,
8359 ;; each of which does one 16-bit part. This is used by combine.
8362 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8363 (match_operator:DI 3 "boolean_or_operator"
8364 [(match_operand:DI 1 "gpc_reg_operand" "")
8365 (match_operand:DI 2 "non_logical_cint_operand" "")]))]
8367 [(set (match_dup 0) (match_dup 4))
8368 (set (match_dup 0) (match_dup 5))]
8373 i3 = GEN_INT (INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff));
8374 i4 = GEN_INT (INTVAL (operands[2]) & 0xffff);
8375 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
8377 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
8381 (define_insn "*boolcdi3_internal1"
8382 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
8383 (match_operator:DI 3 "boolean_operator"
8384 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
8385 (match_operand:DI 2 "gpc_reg_operand" "r")]))]
8389 (define_insn "*boolcdi3_internal2"
8390 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
8391 (compare:CC (match_operator:DI 4 "boolean_operator"
8392 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
8393 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
8395 (clobber (match_scratch:DI 3 "=r,r"))]
8400 [(set_attr "type" "fast_compare,compare")
8401 (set_attr "length" "4,8")])
8404 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8405 (compare:CC (match_operator:DI 4 "boolean_operator"
8406 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
8407 (match_operand:DI 2 "gpc_reg_operand" "")])
8409 (clobber (match_scratch:DI 3 ""))]
8410 "TARGET_POWERPC64 && reload_completed"
8411 [(set (match_dup 3) (match_dup 4))
8413 (compare:CC (match_dup 3)
8417 (define_insn "*boolcdi3_internal3"
8418 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
8419 (compare:CC (match_operator:DI 4 "boolean_operator"
8420 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
8421 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
8423 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8429 [(set_attr "type" "fast_compare,compare")
8430 (set_attr "length" "4,8")])
8433 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8434 (compare:CC (match_operator:DI 4 "boolean_operator"
8435 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
8436 (match_operand:DI 2 "gpc_reg_operand" "")])
8438 (set (match_operand:DI 0 "gpc_reg_operand" "")
8440 "TARGET_POWERPC64 && reload_completed"
8441 [(set (match_dup 0) (match_dup 4))
8443 (compare:CC (match_dup 0)
8447 (define_insn "*boolccdi3_internal1"
8448 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
8449 (match_operator:DI 3 "boolean_operator"
8450 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
8451 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r"))]))]
8455 (define_insn "*boolccdi3_internal2"
8456 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
8457 (compare:CC (match_operator:DI 4 "boolean_operator"
8458 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
8459 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
8461 (clobber (match_scratch:DI 3 "=r,r"))]
8466 [(set_attr "type" "fast_compare,compare")
8467 (set_attr "length" "4,8")])
8470 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8471 (compare:CC (match_operator:DI 4 "boolean_operator"
8472 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
8473 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
8475 (clobber (match_scratch:DI 3 ""))]
8476 "TARGET_POWERPC64 && reload_completed"
8477 [(set (match_dup 3) (match_dup 4))
8479 (compare:CC (match_dup 3)
8483 (define_insn "*boolccdi3_internal3"
8484 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
8485 (compare:CC (match_operator:DI 4 "boolean_operator"
8486 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
8487 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
8489 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8495 [(set_attr "type" "fast_compare,compare")
8496 (set_attr "length" "4,8")])
8499 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8500 (compare:CC (match_operator:DI 4 "boolean_operator"
8501 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
8502 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
8504 (set (match_operand:DI 0 "gpc_reg_operand" "")
8506 "TARGET_POWERPC64 && reload_completed"
8507 [(set (match_dup 0) (match_dup 4))
8509 (compare:CC (match_dup 0)
8514 (define_insn "*eqv<mode>3"
8515 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
8517 (xor:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
8518 (match_operand:GPR 2 "gpc_reg_operand" "r"))))]
8521 [(set_attr "type" "integer")
8522 (set_attr "length" "4")])
8525 ;; 128-bit logical operations expanders
8527 (define_expand "and<mode>3"
8528 [(parallel [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
8530 (match_operand:BOOL_128 1 "vlogical_operand" "")
8531 (match_operand:BOOL_128 2 "vlogical_operand" "")))
8532 (clobber (match_scratch:CC 3 ""))])]
8536 (define_expand "ior<mode>3"
8537 [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
8538 (ior:BOOL_128 (match_operand:BOOL_128 1 "vlogical_operand" "")
8539 (match_operand:BOOL_128 2 "vlogical_operand" "")))]
8543 (define_expand "xor<mode>3"
8544 [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
8545 (xor:BOOL_128 (match_operand:BOOL_128 1 "vlogical_operand" "")
8546 (match_operand:BOOL_128 2 "vlogical_operand" "")))]
8550 (define_expand "one_cmpl<mode>2"
8551 [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
8552 (not:BOOL_128 (match_operand:BOOL_128 1 "vlogical_operand" "")))]
8556 (define_expand "nor<mode>3"
8557 [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
8559 (not:BOOL_128 (match_operand:BOOL_128 1 "vlogical_operand" ""))
8560 (not:BOOL_128 (match_operand:BOOL_128 2 "vlogical_operand" ""))))]
8564 (define_expand "andc<mode>3"
8565 [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
8567 (not:BOOL_128 (match_operand:BOOL_128 2 "vlogical_operand" ""))
8568 (match_operand:BOOL_128 1 "vlogical_operand" "")))]
8572 ;; Power8 vector logical instructions.
8573 (define_expand "eqv<mode>3"
8574 [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
8576 (xor:BOOL_128 (match_operand:BOOL_128 1 "vlogical_operand" "")
8577 (match_operand:BOOL_128 2 "vlogical_operand" ""))))]
8578 "<MODE>mode == TImode || <MODE>mode == PTImode || TARGET_P8_VECTOR"
8581 ;; Rewrite nand into canonical form
8582 (define_expand "nand<mode>3"
8583 [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
8585 (not:BOOL_128 (match_operand:BOOL_128 1 "vlogical_operand" ""))
8586 (not:BOOL_128 (match_operand:BOOL_128 2 "vlogical_operand" ""))))]
8587 "<MODE>mode == TImode || <MODE>mode == PTImode || TARGET_P8_VECTOR"
8590 ;; The canonical form is to have the negated element first, so we need to
8591 ;; reverse arguments.
8592 (define_expand "orc<mode>3"
8593 [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
8595 (not:BOOL_128 (match_operand:BOOL_128 2 "vlogical_operand" ""))
8596 (match_operand:BOOL_128 1 "vlogical_operand" "")))]
8597 "<MODE>mode == TImode || <MODE>mode == PTImode || TARGET_P8_VECTOR"
8600 ;; 128-bit logical operations insns and split operations
8601 (define_insn_and_split "*and<mode>3_internal"
8602 [(set (match_operand:BOOL_128 0 "vlogical_operand" "=<BOOL_REGS_OUTPUT>")
8604 (match_operand:BOOL_128 1 "vlogical_operand" "%<BOOL_REGS_OP1>")
8605 (match_operand:BOOL_128 2 "vlogical_operand" "<BOOL_REGS_OP2>")))
8606 (clobber (match_scratch:CC 3 "<BOOL_REGS_AND_CR0>"))]
8609 if (TARGET_VSX && vsx_register_operand (operands[0], <MODE>mode))
8610 return "xxland %x0,%x1,%x2";
8612 if (TARGET_ALTIVEC && altivec_register_operand (operands[0], <MODE>mode))
8613 return "vand %0,%1,%2";
8617 "reload_completed && int_reg_operand (operands[0], <MODE>mode)"
8620 rs6000_split_logical (operands, AND, false, false, false, operands[3]);
8625 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
8626 (const_string "vecsimple")
8627 (const_string "integer")))
8628 (set (attr "length")
8630 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
8633 (match_test "TARGET_POWERPC64")
8635 (const_string "16"))))])
8638 (define_insn_and_split "*bool<mode>3_internal"
8639 [(set (match_operand:BOOL_128 0 "vlogical_operand" "=<BOOL_REGS_OUTPUT>")
8640 (match_operator:BOOL_128 3 "boolean_or_operator"
8641 [(match_operand:BOOL_128 1 "vlogical_operand" "%<BOOL_REGS_OP1>")
8642 (match_operand:BOOL_128 2 "vlogical_operand" "<BOOL_REGS_OP2>")]))]
8645 if (TARGET_VSX && vsx_register_operand (operands[0], <MODE>mode))
8646 return "xxl%q3 %x0,%x1,%x2";
8648 if (TARGET_ALTIVEC && altivec_register_operand (operands[0], <MODE>mode))
8649 return "v%q3 %0,%1,%2";
8653 "reload_completed && int_reg_operand (operands[0], <MODE>mode)"
8656 rs6000_split_logical (operands, GET_CODE (operands[3]), false, false, false,
8662 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
8663 (const_string "vecsimple")
8664 (const_string "integer")))
8665 (set (attr "length")
8667 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
8670 (match_test "TARGET_POWERPC64")
8672 (const_string "16"))))])
8675 (define_insn_and_split "*boolc<mode>3_internal1"
8676 [(set (match_operand:BOOL_128 0 "vlogical_operand" "=<BOOL_REGS_OUTPUT>")
8677 (match_operator:BOOL_128 3 "boolean_operator"
8679 (match_operand:BOOL_128 2 "vlogical_operand" "<BOOL_REGS_OP1>"))
8680 (match_operand:BOOL_128 1 "vlogical_operand" "<BOOL_REGS_OP2>")]))]
8681 "TARGET_P8_VECTOR || (GET_CODE (operands[3]) == AND)"
8683 if (TARGET_VSX && vsx_register_operand (operands[0], <MODE>mode))
8684 return "xxl%q3 %x0,%x1,%x2";
8686 if (TARGET_ALTIVEC && altivec_register_operand (operands[0], <MODE>mode))
8687 return "v%q3 %0,%1,%2";
8691 "(TARGET_P8_VECTOR || (GET_CODE (operands[3]) == AND))
8692 && reload_completed && int_reg_operand (operands[0], <MODE>mode)"
8695 rs6000_split_logical (operands, GET_CODE (operands[3]), false, true, false,
8701 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
8702 (const_string "vecsimple")
8703 (const_string "integer")))
8704 (set (attr "length")
8706 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
8709 (match_test "TARGET_POWERPC64")
8711 (const_string "16"))))])
8713 (define_insn_and_split "*boolc<mode>3_internal2"
8714 [(set (match_operand:TI2 0 "int_reg_operand" "=&r,r,r")
8715 (match_operator:TI2 3 "boolean_operator"
8717 (match_operand:TI2 1 "int_reg_operand" "r,0,r"))
8718 (match_operand:TI2 2 "int_reg_operand" "r,r,0")]))]
8719 "!TARGET_P8_VECTOR && (GET_CODE (operands[3]) != AND)"
8721 "reload_completed && !TARGET_P8_VECTOR && (GET_CODE (operands[3]) != AND)"
8724 rs6000_split_logical (operands, GET_CODE (operands[3]), false, true, false,
8728 [(set_attr "type" "integer")
8729 (set (attr "length")
8731 (match_test "TARGET_POWERPC64")
8733 (const_string "16")))])
8736 (define_insn_and_split "*boolcc<mode>3_internal1"
8737 [(set (match_operand:BOOL_128 0 "vlogical_operand" "=<BOOL_REGS_OUTPUT>")
8738 (match_operator:BOOL_128 3 "boolean_operator"
8740 (match_operand:BOOL_128 1 "vlogical_operand" "<BOOL_REGS_OP1>"))
8742 (match_operand:BOOL_128 2 "vlogical_operand" "<BOOL_REGS_OP2>"))]))]
8743 "TARGET_P8_VECTOR || (GET_CODE (operands[3]) == AND)"
8745 if (TARGET_VSX && vsx_register_operand (operands[0], <MODE>mode))
8746 return "xxl%q3 %x0,%x1,%x2";
8748 if (TARGET_ALTIVEC && altivec_register_operand (operands[0], <MODE>mode))
8749 return "v%q3 %0,%1,%2";
8753 "(TARGET_P8_VECTOR || (GET_CODE (operands[3]) == AND))
8754 && reload_completed && int_reg_operand (operands[0], <MODE>mode)"
8757 rs6000_split_logical (operands, GET_CODE (operands[3]), false, true, true,
8763 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
8764 (const_string "vecsimple")
8765 (const_string "integer")))
8766 (set (attr "length")
8768 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
8771 (match_test "TARGET_POWERPC64")
8773 (const_string "16"))))])
8775 (define_insn_and_split "*boolcc<mode>3_internal2"
8776 [(set (match_operand:TI2 0 "int_reg_operand" "=&r,r,r")
8777 (match_operator:TI2 3 "boolean_operator"
8779 (match_operand:TI2 1 "int_reg_operand" "r,0,r"))
8781 (match_operand:TI2 2 "int_reg_operand" "r,r,0"))]))]
8782 "!TARGET_P8_VECTOR && (GET_CODE (operands[3]) != AND)"
8784 "reload_completed && !TARGET_P8_VECTOR && (GET_CODE (operands[3]) != AND)"
8787 rs6000_split_logical (operands, GET_CODE (operands[3]), false, true, true,
8791 [(set_attr "type" "integer")
8792 (set (attr "length")
8794 (match_test "TARGET_POWERPC64")
8796 (const_string "16")))])
8800 (define_insn_and_split "*eqv<mode>3_internal1"
8801 [(set (match_operand:BOOL_128 0 "vlogical_operand" "=<BOOL_REGS_OUTPUT>")
8804 (match_operand:BOOL_128 1 "vlogical_operand" "<BOOL_REGS_OP1>")
8805 (match_operand:BOOL_128 2 "vlogical_operand" "<BOOL_REGS_OP2>"))))]
8808 if (vsx_register_operand (operands[0], <MODE>mode))
8809 return "xxleqv %x0,%x1,%x2";
8813 "TARGET_P8_VECTOR && reload_completed
8814 && int_reg_operand (operands[0], <MODE>mode)"
8817 rs6000_split_logical (operands, XOR, true, false, false, NULL_RTX);
8822 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
8823 (const_string "vecsimple")
8824 (const_string "integer")))
8825 (set (attr "length")
8827 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
8830 (match_test "TARGET_POWERPC64")
8832 (const_string "16"))))])
8834 (define_insn_and_split "*eqv<mode>3_internal2"
8835 [(set (match_operand:TI2 0 "int_reg_operand" "=&r,r,r")
8838 (match_operand:TI2 1 "int_reg_operand" "r,0,r")
8839 (match_operand:TI2 2 "int_reg_operand" "r,r,0"))))]
8842 "reload_completed && !TARGET_P8_VECTOR"
8845 rs6000_split_logical (operands, XOR, true, false, false, NULL_RTX);
8848 [(set_attr "type" "integer")
8849 (set (attr "length")
8851 (match_test "TARGET_POWERPC64")
8853 (const_string "16")))])
8855 ;; 128-bit one's complement
8856 (define_insn_and_split "*one_cmpl<mode>3_internal"
8857 [(set (match_operand:BOOL_128 0 "vlogical_operand" "=<BOOL_REGS_OUTPUT>")
8859 (match_operand:BOOL_128 1 "vlogical_operand" "<BOOL_REGS_UNARY>")))]
8862 if (TARGET_VSX && vsx_register_operand (operands[0], <MODE>mode))
8863 return "xxlnor %x0,%x1,%x1";
8865 if (TARGET_ALTIVEC && altivec_register_operand (operands[0], <MODE>mode))
8866 return "vnor %0,%1,%1";
8870 "reload_completed && int_reg_operand (operands[0], <MODE>mode)"
8873 rs6000_split_logical (operands, NOT, false, false, false, NULL_RTX);
8878 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
8879 (const_string "vecsimple")
8880 (const_string "integer")))
8881 (set (attr "length")
8883 (match_test "vsx_register_operand (operands[0], <MODE>mode)")
8886 (match_test "TARGET_POWERPC64")
8888 (const_string "16"))))])
8891 ;; Now define ways of moving data around.
8893 ;; Set up a register with a value from the GOT table
8895 (define_expand "movsi_got"
8896 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8897 (unspec:SI [(match_operand:SI 1 "got_operand" "")
8898 (match_dup 2)] UNSPEC_MOVSI_GOT))]
8899 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
8902 if (GET_CODE (operands[1]) == CONST)
8904 rtx offset = const0_rtx;
8905 HOST_WIDE_INT value;
8907 operands[1] = eliminate_constant_term (XEXP (operands[1], 0), &offset);
8908 value = INTVAL (offset);
8911 rtx tmp = (!can_create_pseudo_p ()
8913 : gen_reg_rtx (Pmode));
8914 emit_insn (gen_movsi_got (tmp, operands[1]));
8915 emit_insn (gen_addsi3 (operands[0], tmp, offset));
8920 operands[2] = rs6000_got_register (operands[1]);
8923 (define_insn "*movsi_got_internal"
8924 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8925 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
8926 (match_operand:SI 2 "gpc_reg_operand" "b")]
8928 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
8929 "lwz %0,%a1@got(%2)"
8930 [(set_attr "type" "load")])
8932 ;; Used by sched, shorten_branches and final when the GOT pseudo reg
8933 ;; didn't get allocated to a hard register.
8935 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8936 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
8937 (match_operand:SI 2 "memory_operand" "")]
8939 "DEFAULT_ABI == ABI_V4
8941 && (reload_in_progress || reload_completed)"
8942 [(set (match_dup 0) (match_dup 2))
8943 (set (match_dup 0) (unspec:SI [(match_dup 1)(match_dup 0)]
8947 ;; For SI, we special-case integers that can't be loaded in one insn. We
8948 ;; do the load 16-bits at a time. We could do this by loading from memory,
8949 ;; and this is even supposed to be faster, but it is simpler not to get
8950 ;; integers in the TOC.
8951 (define_insn "movsi_low"
8952 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8953 (mem:SI (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
8954 (match_operand 2 "" ""))))]
8955 "TARGET_MACHO && ! TARGET_64BIT"
8956 "lwz %0,lo16(%2)(%1)"
8957 [(set_attr "type" "load")
8958 (set_attr "length" "4")])
8960 (define_insn "*movsi_internal1"
8961 [(set (match_operand:SI 0 "rs6000_nonimmediate_operand" "=r,r,r,m,r,r,r,r,*c*l,*h,*h")
8962 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,*h,r,r,0"))]
8963 "!TARGET_SINGLE_FPU &&
8964 (gpc_reg_operand (operands[0], SImode) || gpc_reg_operand (operands[1], SImode))"
8977 [(set_attr "type" "*,*,load,store,*,*,*,mfjmpr,mtjmpr,*,*")
8978 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4")])
8980 (define_insn "*movsi_internal1_single"
8981 [(set (match_operand:SI 0 "rs6000_nonimmediate_operand" "=r,r,r,m,r,r,r,r,*c*l,*h,*h,m,*f")
8982 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,*h,r,r,0,f,m"))]
8983 "TARGET_SINGLE_FPU &&
8984 (gpc_reg_operand (operands[0], SImode) || gpc_reg_operand (operands[1], SImode))"
8999 [(set_attr "type" "*,*,load,store,*,*,*,mfjmpr,mtjmpr,*,*,fpstore,fpload")
9000 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4,4,4")])
9002 ;; Split a load of a large constant into the appropriate two-insn
9006 [(set (match_operand:SI 0 "gpc_reg_operand" "")
9007 (match_operand:SI 1 "const_int_operand" ""))]
9008 "(unsigned HOST_WIDE_INT) (INTVAL (operands[1]) + 0x8000) >= 0x10000
9009 && (INTVAL (operands[1]) & 0xffff) != 0"
9013 (ior:SI (match_dup 0)
9016 { rtx tem = rs6000_emit_set_const (operands[0], SImode, operands[1], 2);
9018 if (tem == operands[0])
9024 (define_insn "*mov<mode>_internal2"
9025 [(set (match_operand:CC 2 "cc_reg_operand" "=y,x,?y")
9026 (compare:CC (match_operand:P 1 "gpc_reg_operand" "0,r,r")
9028 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r") (match_dup 1))]
9034 [(set_attr "type" "cmp,fast_compare,cmp")
9035 (set_attr "length" "4,4,8")])
9038 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
9039 (compare:CC (match_operand:P 1 "gpc_reg_operand" "")
9041 (set (match_operand:P 0 "gpc_reg_operand" "") (match_dup 1))]
9043 [(set (match_dup 0) (match_dup 1))
9045 (compare:CC (match_dup 0)
9049 (define_insn "*movhi_internal"
9050 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,m,r,r,*c*l,*h")
9051 (match_operand:HI 1 "input_operand" "r,m,r,i,*h,r,0"))]
9052 "gpc_reg_operand (operands[0], HImode)
9053 || gpc_reg_operand (operands[1], HImode)"
9062 [(set_attr "type" "*,load,store,*,mfjmpr,mtjmpr,*")])
9064 (define_expand "mov<mode>"
9065 [(set (match_operand:INT 0 "general_operand" "")
9066 (match_operand:INT 1 "any_operand" ""))]
9068 "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
9070 (define_insn "*movqi_internal"
9071 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,m,r,r,*c*l,*h")
9072 (match_operand:QI 1 "input_operand" "r,m,r,i,*h,r,0"))]
9073 "gpc_reg_operand (operands[0], QImode)
9074 || gpc_reg_operand (operands[1], QImode)"
9083 [(set_attr "type" "*,load,store,*,mfjmpr,mtjmpr,*")])
9085 ;; Here is how to move condition codes around. When we store CC data in
9086 ;; an integer register or memory, we store just the high-order 4 bits.
9087 ;; This lets us not shift in the most common case of CR0.
9088 (define_expand "movcc"
9089 [(set (match_operand:CC 0 "nonimmediate_operand" "")
9090 (match_operand:CC 1 "nonimmediate_operand" ""))]
9094 (define_insn "*movcc_internal1"
9095 [(set (match_operand:CC 0 "nonimmediate_operand" "=y,x,?y,y,r,r,r,r,r,cl,r,m")
9096 (match_operand:CC 1 "general_operand" "y,r,r,O,x,y,r,I,h,r,m,r"))]
9097 "register_operand (operands[0], CCmode)
9098 || register_operand (operands[1], CCmode)"
9102 rlwinm %1,%1,%F0,0xffffffff\;mtcrf %R0,%1\;rlwinm %1,%1,%f0,0xffffffff
9105 mfcr %0%Q1\;rlwinm %0,%0,%f1,0xf0000000
9113 (cond [(eq_attr "alternative" "0,3")
9114 (const_string "cr_logical")
9115 (eq_attr "alternative" "1,2")
9116 (const_string "mtcr")
9117 (eq_attr "alternative" "6,7")
9118 (const_string "integer")
9119 (eq_attr "alternative" "8")
9120 (const_string "mfjmpr")
9121 (eq_attr "alternative" "9")
9122 (const_string "mtjmpr")
9123 (eq_attr "alternative" "10")
9124 (const_string "load")
9125 (eq_attr "alternative" "11")
9126 (const_string "store")
9127 (match_test "TARGET_MFCRF")
9128 (const_string "mfcrf")
9130 (const_string "mfcr")))
9131 (set_attr "length" "4,4,12,4,4,8,4,4,4,4,4,4")])
9133 ;; For floating-point, we normally deal with the floating-point registers
9134 ;; unless -msoft-float is used. The sole exception is that parameter passing
9135 ;; can produce floating-point values in fixed-point registers. Unless the
9136 ;; value is a simple constant or already in memory, we deal with this by
9137 ;; allocating memory and copying the value explicitly via that memory location.
9139 ;; Move 32-bit binary/decimal floating point
9140 (define_expand "mov<mode>"
9141 [(set (match_operand:FMOVE32 0 "nonimmediate_operand" "")
9142 (match_operand:FMOVE32 1 "any_operand" ""))]
9144 "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
9147 [(set (match_operand:FMOVE32 0 "gpc_reg_operand" "")
9148 (match_operand:FMOVE32 1 "const_double_operand" ""))]
9150 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
9151 || (GET_CODE (operands[0]) == SUBREG
9152 && GET_CODE (SUBREG_REG (operands[0])) == REG
9153 && REGNO (SUBREG_REG (operands[0])) <= 31))"
9154 [(set (match_dup 2) (match_dup 3))]
9160 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
9161 <real_value_to_target> (rv, l);
9163 if (! TARGET_POWERPC64)
9164 operands[2] = operand_subword (operands[0], 0, 0, <MODE>mode);
9166 operands[2] = gen_lowpart (SImode, operands[0]);
9168 operands[3] = gen_int_mode (l, SImode);
9171 (define_insn "mov<mode>_hardfloat"
9172 [(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")
9173 (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"))]
9174 "(gpc_reg_operand (operands[0], <MODE>mode)
9175 || gpc_reg_operand (operands[1], <MODE>mode))
9176 && (TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT)"
9195 [(set_attr "type" "*,load,store,fp,vecsimple,vecsimple,fpload,fpstore,fpload,fpstore,mftgpr,mffgpr,mtjmpr,mfjmpr,*,*,*")
9196 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,8")])
9198 (define_insn "*mov<mode>_softfloat"
9199 [(set (match_operand:FMOVE32 0 "nonimmediate_operand" "=r,cl,r,r,m,r,r,r,r,*h")
9200 (match_operand:FMOVE32 1 "input_operand" "r,r,h,m,r,I,L,G,Fn,0"))]
9201 "(gpc_reg_operand (operands[0], <MODE>mode)
9202 || gpc_reg_operand (operands[1], <MODE>mode))
9203 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)"
9215 [(set_attr "type" "*,mtjmpr,mfjmpr,load,store,*,*,*,*,*")
9216 (set_attr "length" "4,4,4,4,4,4,4,4,8,4")])
9219 ;; Move 64-bit binary/decimal floating point
9220 (define_expand "mov<mode>"
9221 [(set (match_operand:FMOVE64 0 "nonimmediate_operand" "")
9222 (match_operand:FMOVE64 1 "any_operand" ""))]
9224 "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
9227 [(set (match_operand:FMOVE64 0 "gpc_reg_operand" "")
9228 (match_operand:FMOVE64 1 "const_int_operand" ""))]
9229 "! TARGET_POWERPC64 && reload_completed
9230 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
9231 || (GET_CODE (operands[0]) == SUBREG
9232 && GET_CODE (SUBREG_REG (operands[0])) == REG
9233 && REGNO (SUBREG_REG (operands[0])) <= 31))"
9234 [(set (match_dup 2) (match_dup 4))
9235 (set (match_dup 3) (match_dup 1))]
9238 int endian = (WORDS_BIG_ENDIAN == 0);
9239 HOST_WIDE_INT value = INTVAL (operands[1]);
9241 operands[2] = operand_subword (operands[0], endian, 0, <MODE>mode);
9242 operands[3] = operand_subword (operands[0], 1 - endian, 0, <MODE>mode);
9243 operands[4] = GEN_INT (value >> 32);
9244 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
9248 [(set (match_operand:FMOVE64 0 "gpc_reg_operand" "")
9249 (match_operand:FMOVE64 1 "const_double_operand" ""))]
9250 "! TARGET_POWERPC64 && reload_completed
9251 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
9252 || (GET_CODE (operands[0]) == SUBREG
9253 && GET_CODE (SUBREG_REG (operands[0])) == REG
9254 && REGNO (SUBREG_REG (operands[0])) <= 31))"
9255 [(set (match_dup 2) (match_dup 4))
9256 (set (match_dup 3) (match_dup 5))]
9259 int endian = (WORDS_BIG_ENDIAN == 0);
9263 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
9264 <real_value_to_target> (rv, l);
9266 operands[2] = operand_subword (operands[0], endian, 0, <MODE>mode);
9267 operands[3] = operand_subword (operands[0], 1 - endian, 0, <MODE>mode);
9268 operands[4] = gen_int_mode (l[endian], SImode);
9269 operands[5] = gen_int_mode (l[1 - endian], SImode);
9273 [(set (match_operand:FMOVE64 0 "gpc_reg_operand" "")
9274 (match_operand:FMOVE64 1 "const_double_operand" ""))]
9275 "TARGET_POWERPC64 && reload_completed
9276 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
9277 || (GET_CODE (operands[0]) == SUBREG
9278 && GET_CODE (SUBREG_REG (operands[0])) == REG
9279 && REGNO (SUBREG_REG (operands[0])) <= 31))"
9280 [(set (match_dup 2) (match_dup 3))]
9283 int endian = (WORDS_BIG_ENDIAN == 0);
9288 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
9289 <real_value_to_target> (rv, l);
9291 operands[2] = gen_lowpart (DImode, operands[0]);
9292 /* HIGHPART is lower memory address when WORDS_BIG_ENDIAN. */
9293 val = ((HOST_WIDE_INT)(unsigned long)l[endian] << 32
9294 | ((HOST_WIDE_INT)(unsigned long)l[1 - endian]));
9296 operands[3] = gen_int_mode (val, DImode);
9299 ;; Don't have reload use general registers to load a constant. It is
9300 ;; less efficient than loading the constant into an FP register, since
9301 ;; it will probably be used there.
9303 ;; The move constraints are ordered to prefer floating point registers before
9304 ;; general purpose registers to avoid doing a store and a load to get the value
9305 ;; into a floating point register when it is needed for a floating point
9306 ;; operation. Prefer traditional floating point registers over VSX registers,
9307 ;; since the D-form version of the memory instructions does not need a GPR for
9310 (define_insn "*mov<mode>_hardfloat32"
9311 [(set (match_operand:FMOVE64 0 "nonimmediate_operand" "=m,d,d,wv,Z,wa,wa,Y,r,!r,!r,!r,!r")
9312 (match_operand:FMOVE64 1 "input_operand" "d,m,d,Z,wv,wa,j,r,Y,r,G,H,F"))]
9313 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9314 && (gpc_reg_operand (operands[0], <MODE>mode)
9315 || gpc_reg_operand (operands[1], <MODE>mode))"
9330 [(set_attr "type" "fpstore,fpload,fp,fpload,fpstore,vecsimple,vecsimple,store,load,two,fp,fp,*")
9331 (set_attr "length" "4,4,4,4,4,4,4,8,8,8,8,12,16")])
9333 (define_insn "*mov<mode>_softfloat32"
9334 [(set (match_operand:FMOVE64 0 "nonimmediate_operand" "=Y,r,r,r,r,r")
9335 (match_operand:FMOVE64 1 "input_operand" "r,Y,r,G,H,F"))]
9337 && ((TARGET_FPRS && TARGET_SINGLE_FLOAT)
9338 || TARGET_SOFT_FLOAT || TARGET_E500_SINGLE
9339 || (<MODE>mode == DDmode && TARGET_E500_DOUBLE))
9340 && (gpc_reg_operand (operands[0], <MODE>mode)
9341 || gpc_reg_operand (operands[1], <MODE>mode))"
9343 [(set_attr "type" "store,load,two,*,*,*")
9344 (set_attr "length" "8,8,8,8,12,16")])
9346 ; ld/std require word-aligned displacements -> 'Y' constraint.
9347 ; List Y->r and r->Y before r->r for reload.
9348 (define_insn "*mov<mode>_hardfloat64"
9349 [(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")
9350 (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"))]
9351 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9352 && (gpc_reg_operand (operands[0], <MODE>mode)
9353 || gpc_reg_operand (operands[1], <MODE>mode))"
9375 [(set_attr "type" "fpstore,fpload,fp,fpload,fpstore,vecsimple,vecsimple,store,load,*,mtjmpr,mfjmpr,*,*,*,*,mftgpr,mffgpr,mftgpr,mffgpr")
9376 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4,4,8,12,16,4,4,4,4")])
9378 (define_insn "*mov<mode>_softfloat64"
9379 [(set (match_operand:FMOVE64 0 "nonimmediate_operand" "=Y,r,r,cl,r,r,r,r,*h")
9380 (match_operand:FMOVE64 1 "input_operand" "r,Y,r,r,h,G,H,F,0"))]
9381 "TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)
9382 && (gpc_reg_operand (operands[0], <MODE>mode)
9383 || gpc_reg_operand (operands[1], <MODE>mode))"
9394 [(set_attr "type" "store,load,*,mtjmpr,mfjmpr,*,*,*,*")
9395 (set_attr "length" "4,4,4,4,4,8,12,16,4")])
9397 (define_expand "mov<mode>"
9398 [(set (match_operand:FMOVE128 0 "general_operand" "")
9399 (match_operand:FMOVE128 1 "any_operand" ""))]
9401 "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
9403 ;; It's important to list Y->r and r->Y before r->r because otherwise
9404 ;; reload, given m->r, will try to pick r->r and reload it, which
9405 ;; doesn't make progress.
9407 ;; We can't split little endian direct moves of TDmode, because the words are
9408 ;; not swapped like they are for TImode or TFmode. Subregs therefore are
9409 ;; problematical. Don't allow direct move for this case.
9411 (define_insn_and_split "*mov<mode>_64bit_dm"
9412 [(set (match_operand:FMOVE128 0 "nonimmediate_operand" "=m,d,d,Y,r,r,r,wm")
9413 (match_operand:FMOVE128 1 "input_operand" "d,m,d,r,YGHF,r,wm,r"))]
9414 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_POWERPC64
9415 && (<MODE>mode != TDmode || WORDS_BIG_ENDIAN)
9416 && (gpc_reg_operand (operands[0], <MODE>mode)
9417 || gpc_reg_operand (operands[1], <MODE>mode))"
9419 "&& reload_completed"
9421 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
9422 [(set_attr "length" "8,8,8,12,12,8,8,8")])
9424 (define_insn_and_split "*movtd_64bit_nodm"
9425 [(set (match_operand:TD 0 "nonimmediate_operand" "=m,d,d,Y,r,r")
9426 (match_operand:TD 1 "input_operand" "d,m,d,r,YGHF,r"))]
9427 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_POWERPC64 && !WORDS_BIG_ENDIAN
9428 && (gpc_reg_operand (operands[0], TDmode)
9429 || gpc_reg_operand (operands[1], TDmode))"
9431 "&& reload_completed"
9433 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
9434 [(set_attr "length" "8,8,8,12,12,8")])
9436 (define_insn_and_split "*mov<mode>_32bit"
9437 [(set (match_operand:FMOVE128 0 "nonimmediate_operand" "=m,d,d,Y,r,r")
9438 (match_operand:FMOVE128 1 "input_operand" "d,m,d,r,YGHF,r"))]
9439 "TARGET_HARD_FLOAT && TARGET_FPRS && !TARGET_POWERPC64
9440 && (gpc_reg_operand (operands[0], <MODE>mode)
9441 || gpc_reg_operand (operands[1], <MODE>mode))"
9443 "&& reload_completed"
9445 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
9446 [(set_attr "length" "8,8,8,20,20,16")])
9448 (define_insn_and_split "*mov<mode>_softfloat"
9449 [(set (match_operand:FMOVE128 0 "rs6000_nonimmediate_operand" "=Y,r,r")
9450 (match_operand:FMOVE128 1 "input_operand" "r,YGHF,r"))]
9451 "(TARGET_SOFT_FLOAT || !TARGET_FPRS)
9452 && (gpc_reg_operand (operands[0], <MODE>mode)
9453 || gpc_reg_operand (operands[1], <MODE>mode))"
9455 "&& reload_completed"
9457 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
9458 [(set_attr "length" "20,20,16")])
9460 (define_expand "extenddftf2"
9461 [(set (match_operand:TF 0 "nonimmediate_operand" "")
9462 (float_extend:TF (match_operand:DF 1 "input_operand" "")))]
9464 && TARGET_HARD_FLOAT
9465 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9466 && TARGET_LONG_DOUBLE_128"
9468 if (TARGET_E500_DOUBLE)
9469 emit_insn (gen_spe_extenddftf2 (operands[0], operands[1]));
9471 emit_insn (gen_extenddftf2_fprs (operands[0], operands[1]));
9475 (define_expand "extenddftf2_fprs"
9476 [(parallel [(set (match_operand:TF 0 "nonimmediate_operand" "")
9477 (float_extend:TF (match_operand:DF 1 "input_operand" "")))
9478 (use (match_dup 2))])]
9480 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9481 && TARGET_LONG_DOUBLE_128"
9483 operands[2] = CONST0_RTX (DFmode);
9484 /* Generate GOT reference early for SVR4 PIC. */
9485 if (DEFAULT_ABI == ABI_V4 && flag_pic)
9486 operands[2] = validize_mem (force_const_mem (DFmode, operands[2]));
9489 (define_insn_and_split "*extenddftf2_internal"
9490 [(set (match_operand:TF 0 "nonimmediate_operand" "=m,Y,d,&d,r")
9491 (float_extend:TF (match_operand:DF 1 "input_operand" "d,r,md,md,rmGHF")))
9492 (use (match_operand:DF 2 "zero_reg_mem_operand" "d,r,m,d,n"))]
9494 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9495 && TARGET_LONG_DOUBLE_128"
9497 "&& reload_completed"
9500 const int lo_word = LONG_DOUBLE_LARGE_FIRST ? GET_MODE_SIZE (DFmode) : 0;
9501 const int hi_word = LONG_DOUBLE_LARGE_FIRST ? 0 : GET_MODE_SIZE (DFmode);
9502 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word),
9504 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word),
9509 (define_expand "extendsftf2"
9510 [(set (match_operand:TF 0 "nonimmediate_operand" "")
9511 (float_extend:TF (match_operand:SF 1 "gpc_reg_operand" "")))]
9513 && TARGET_HARD_FLOAT
9514 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9515 && TARGET_LONG_DOUBLE_128"
9517 rtx tmp = gen_reg_rtx (DFmode);
9518 emit_insn (gen_extendsfdf2 (tmp, operands[1]));
9519 emit_insn (gen_extenddftf2 (operands[0], tmp));
9523 (define_expand "trunctfdf2"
9524 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9525 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "")))]
9527 && TARGET_HARD_FLOAT
9528 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9529 && TARGET_LONG_DOUBLE_128"
9532 (define_insn_and_split "trunctfdf2_internal1"
9533 [(set (match_operand:DF 0 "gpc_reg_operand" "=d,?d")
9534 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "0,d")))]
9535 "!TARGET_IEEEQUAD && !TARGET_XL_COMPAT
9536 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9540 "&& reload_completed && REGNO (operands[0]) == REGNO (operands[1])"
9543 emit_note (NOTE_INSN_DELETED);
9546 [(set_attr "type" "fp")])
9548 (define_insn "trunctfdf2_internal2"
9549 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
9550 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "d")))]
9551 "!TARGET_IEEEQUAD && TARGET_XL_COMPAT
9552 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9553 && TARGET_LONG_DOUBLE_128"
9555 [(set_attr "type" "fp")
9556 (set_attr "fp_type" "fp_addsub_d")])
9558 (define_expand "trunctfsf2"
9559 [(set (match_operand:SF 0 "gpc_reg_operand" "")
9560 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "")))]
9562 && TARGET_HARD_FLOAT
9563 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9564 && TARGET_LONG_DOUBLE_128"
9566 if (TARGET_E500_DOUBLE)
9567 emit_insn (gen_spe_trunctfsf2 (operands[0], operands[1]));
9569 emit_insn (gen_trunctfsf2_fprs (operands[0], operands[1]));
9573 (define_insn_and_split "trunctfsf2_fprs"
9574 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
9575 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "d")))
9576 (clobber (match_scratch:DF 2 "=d"))]
9578 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
9579 && TARGET_LONG_DOUBLE_128"
9581 "&& reload_completed"
9583 (float_truncate:DF (match_dup 1)))
9585 (float_truncate:SF (match_dup 2)))]
9588 (define_expand "floatsitf2"
9589 [(set (match_operand:TF 0 "gpc_reg_operand" "")
9590 (float:TF (match_operand:SI 1 "gpc_reg_operand" "")))]
9592 && TARGET_HARD_FLOAT
9593 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9594 && TARGET_LONG_DOUBLE_128"
9596 rtx tmp = gen_reg_rtx (DFmode);
9597 expand_float (tmp, operands[1], false);
9598 emit_insn (gen_extenddftf2 (operands[0], tmp));
9602 ; fadd, but rounding towards zero.
9603 ; This is probably not the optimal code sequence.
9604 (define_insn "fix_trunc_helper"
9605 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
9606 (unspec:DF [(match_operand:TF 1 "gpc_reg_operand" "d")]
9607 UNSPEC_FIX_TRUNC_TF))
9608 (clobber (match_operand:DF 2 "gpc_reg_operand" "=&d"))]
9609 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
9610 "mffs %2\n\tmtfsb1 31\n\tmtfsb0 30\n\tfadd %0,%1,%L1\n\tmtfsf 1,%2"
9611 [(set_attr "type" "fp")
9612 (set_attr "length" "20")])
9614 (define_expand "fix_trunctfsi2"
9615 [(set (match_operand:SI 0 "gpc_reg_operand" "")
9616 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))]
9617 "!TARGET_IEEEQUAD && TARGET_HARD_FLOAT
9618 && (TARGET_FPRS || TARGET_E500_DOUBLE) && TARGET_LONG_DOUBLE_128"
9620 if (TARGET_E500_DOUBLE)
9621 emit_insn (gen_spe_fix_trunctfsi2 (operands[0], operands[1]));
9623 emit_insn (gen_fix_trunctfsi2_fprs (operands[0], operands[1]));
9627 (define_expand "fix_trunctfsi2_fprs"
9628 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
9629 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))
9630 (clobber (match_dup 2))
9631 (clobber (match_dup 3))
9632 (clobber (match_dup 4))
9633 (clobber (match_dup 5))])]
9635 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9637 operands[2] = gen_reg_rtx (DFmode);
9638 operands[3] = gen_reg_rtx (DFmode);
9639 operands[4] = gen_reg_rtx (DImode);
9640 operands[5] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode));
9643 (define_insn_and_split "*fix_trunctfsi2_internal"
9644 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9645 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "d")))
9646 (clobber (match_operand:DF 2 "gpc_reg_operand" "=d"))
9647 (clobber (match_operand:DF 3 "gpc_reg_operand" "=&d"))
9648 (clobber (match_operand:DI 4 "gpc_reg_operand" "=d"))
9649 (clobber (match_operand:DI 5 "offsettable_mem_operand" "=o"))]
9651 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9657 emit_insn (gen_fix_trunc_helper (operands[2], operands[1], operands[3]));
9659 gcc_assert (MEM_P (operands[5]));
9660 lowword = adjust_address (operands[5], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
9662 emit_insn (gen_fctiwz_df (operands[4], operands[2]));
9663 emit_move_insn (operands[5], operands[4]);
9664 emit_move_insn (operands[0], lowword);
9668 (define_expand "negtf2"
9669 [(set (match_operand:TF 0 "gpc_reg_operand" "")
9670 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "")))]
9672 && TARGET_HARD_FLOAT
9673 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9674 && TARGET_LONG_DOUBLE_128"
9677 (define_insn "negtf2_internal"
9678 [(set (match_operand:TF 0 "gpc_reg_operand" "=d")
9679 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "d")))]
9681 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9684 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
9685 return \"fneg %L0,%L1\;fneg %0,%1\";
9687 return \"fneg %0,%1\;fneg %L0,%L1\";
9689 [(set_attr "type" "fp")
9690 (set_attr "length" "8")])
9692 (define_expand "abstf2"
9693 [(set (match_operand:TF 0 "gpc_reg_operand" "")
9694 (abs:TF (match_operand:TF 1 "gpc_reg_operand" "")))]
9696 && TARGET_HARD_FLOAT
9697 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9698 && TARGET_LONG_DOUBLE_128"
9701 rtx label = gen_label_rtx ();
9702 if (TARGET_E500_DOUBLE)
9704 if (flag_finite_math_only && !flag_trapping_math)
9705 emit_insn (gen_spe_abstf2_tst (operands[0], operands[1], label));
9707 emit_insn (gen_spe_abstf2_cmp (operands[0], operands[1], label));
9710 emit_insn (gen_abstf2_internal (operands[0], operands[1], label));
9715 (define_expand "abstf2_internal"
9716 [(set (match_operand:TF 0 "gpc_reg_operand" "")
9717 (match_operand:TF 1 "gpc_reg_operand" ""))
9718 (set (match_dup 3) (match_dup 5))
9719 (set (match_dup 5) (abs:DF (match_dup 5)))
9720 (set (match_dup 4) (compare:CCFP (match_dup 3) (match_dup 5)))
9721 (set (pc) (if_then_else (eq (match_dup 4) (const_int 0))
9722 (label_ref (match_operand 2 "" ""))
9724 (set (match_dup 6) (neg:DF (match_dup 6)))]
9726 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9727 && TARGET_LONG_DOUBLE_128"
9730 const int hi_word = LONG_DOUBLE_LARGE_FIRST ? 0 : GET_MODE_SIZE (DFmode);
9731 const int lo_word = LONG_DOUBLE_LARGE_FIRST ? GET_MODE_SIZE (DFmode) : 0;
9732 operands[3] = gen_reg_rtx (DFmode);
9733 operands[4] = gen_reg_rtx (CCFPmode);
9734 operands[5] = simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word);
9735 operands[6] = simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word);
9738 ;; Reload helper functions used by rs6000_secondary_reload. The patterns all
9739 ;; must have 3 arguments, and scratch register constraint must be a single
9742 ;; Reload patterns to support gpr load/store with misaligned mem.
9743 ;; and multiple gpr load/store at offset >= 0xfffc
9744 (define_expand "reload_<mode>_store"
9745 [(parallel [(match_operand 0 "memory_operand" "=m")
9746 (match_operand 1 "gpc_reg_operand" "r")
9747 (match_operand:GPR 2 "register_operand" "=&b")])]
9750 rs6000_secondary_reload_gpr (operands[1], operands[0], operands[2], true);
9754 (define_expand "reload_<mode>_load"
9755 [(parallel [(match_operand 0 "gpc_reg_operand" "=r")
9756 (match_operand 1 "memory_operand" "m")
9757 (match_operand:GPR 2 "register_operand" "=b")])]
9760 rs6000_secondary_reload_gpr (operands[0], operands[1], operands[2], false);
9765 ;; Power8 merge instructions to allow direct move to/from floating point
9766 ;; registers in 32-bit mode. We use TF mode to get two registers to move the
9767 ;; individual 32-bit parts across. Subreg doesn't work too well on the TF
9768 ;; value, since it is allocated in reload and not all of the flow information
9769 ;; is setup for it. We have two patterns to do the two moves between gprs and
9770 ;; fprs. There isn't a dependancy between the two, but we could potentially
9771 ;; schedule other instructions between the two instructions. TFmode is
9772 ;; currently limited to traditional FPR registers. If/when this is changed, we
9773 ;; will need to revist %L to make sure it works with VSX registers, or add an
9774 ;; %x version of %L.
9776 (define_insn "p8_fmrgow_<mode>"
9777 [(set (match_operand:FMOVE64X 0 "register_operand" "=d")
9778 (unspec:FMOVE64X [(match_operand:TF 1 "register_operand" "d")]
9779 UNSPEC_P8V_FMRGOW))]
9780 "!TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9782 [(set_attr "type" "vecperm")])
9784 (define_insn "p8_mtvsrwz_1"
9785 [(set (match_operand:TF 0 "register_operand" "=d")
9786 (unspec:TF [(match_operand:SI 1 "register_operand" "r")]
9787 UNSPEC_P8V_MTVSRWZ))]
9788 "!TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9790 [(set_attr "type" "mftgpr")])
9792 (define_insn "p8_mtvsrwz_2"
9793 [(set (match_operand:TF 0 "register_operand" "+d")
9794 (unspec:TF [(match_dup 0)
9795 (match_operand:SI 1 "register_operand" "r")]
9796 UNSPEC_P8V_MTVSRWZ))]
9797 "!TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9799 [(set_attr "type" "mftgpr")])
9801 (define_insn_and_split "reload_fpr_from_gpr<mode>"
9802 [(set (match_operand:FMOVE64X 0 "register_operand" "=ws")
9803 (unspec:FMOVE64X [(match_operand:FMOVE64X 1 "register_operand" "r")]
9804 UNSPEC_P8V_RELOAD_FROM_GPR))
9805 (clobber (match_operand:TF 2 "register_operand" "=d"))]
9806 "!TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9808 "&& reload_completed"
9811 rtx dest = operands[0];
9812 rtx src = operands[1];
9813 rtx tmp = operands[2];
9814 rtx gpr_hi_reg = gen_highpart (SImode, src);
9815 rtx gpr_lo_reg = gen_lowpart (SImode, src);
9817 emit_insn (gen_p8_mtvsrwz_1 (tmp, gpr_hi_reg));
9818 emit_insn (gen_p8_mtvsrwz_2 (tmp, gpr_lo_reg));
9819 emit_insn (gen_p8_fmrgow_<mode> (dest, tmp));
9822 [(set_attr "length" "12")
9823 (set_attr "type" "three")])
9825 ;; Move 128 bit values from GPRs to VSX registers in 64-bit mode
9826 (define_insn "p8_mtvsrd_1"
9827 [(set (match_operand:TF 0 "register_operand" "=ws")
9828 (unspec:TF [(match_operand:DI 1 "register_operand" "r")]
9829 UNSPEC_P8V_MTVSRD))]
9830 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9832 [(set_attr "type" "mftgpr")])
9834 (define_insn "p8_mtvsrd_2"
9835 [(set (match_operand:TF 0 "register_operand" "+ws")
9836 (unspec:TF [(match_dup 0)
9837 (match_operand:DI 1 "register_operand" "r")]
9838 UNSPEC_P8V_MTVSRD))]
9839 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9841 [(set_attr "type" "mftgpr")])
9843 (define_insn "p8_xxpermdi_<mode>"
9844 [(set (match_operand:FMOVE128_GPR 0 "register_operand" "=wa")
9845 (unspec:FMOVE128_GPR [(match_operand:TF 1 "register_operand" "ws")]
9846 UNSPEC_P8V_XXPERMDI))]
9847 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9848 "xxpermdi %x0,%1,%L1,0"
9849 [(set_attr "type" "vecperm")])
9851 (define_insn_and_split "reload_vsx_from_gpr<mode>"
9852 [(set (match_operand:FMOVE128_GPR 0 "register_operand" "=wa")
9853 (unspec:FMOVE128_GPR
9854 [(match_operand:FMOVE128_GPR 1 "register_operand" "r")]
9855 UNSPEC_P8V_RELOAD_FROM_GPR))
9856 (clobber (match_operand:TF 2 "register_operand" "=ws"))]
9857 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9859 "&& reload_completed"
9862 rtx dest = operands[0];
9863 rtx src = operands[1];
9864 rtx tmp = operands[2];
9865 rtx gpr_hi_reg = gen_highpart (DImode, src);
9866 rtx gpr_lo_reg = gen_lowpart (DImode, src);
9868 emit_insn (gen_p8_mtvsrd_1 (tmp, gpr_hi_reg));
9869 emit_insn (gen_p8_mtvsrd_2 (tmp, gpr_lo_reg));
9870 emit_insn (gen_p8_xxpermdi_<mode> (dest, tmp));
9872 [(set_attr "length" "12")
9873 (set_attr "type" "three")])
9876 [(set (match_operand:FMOVE128_GPR 0 "nonimmediate_operand" "")
9877 (match_operand:FMOVE128_GPR 1 "input_operand" ""))]
9879 && (int_reg_operand (operands[0], <MODE>mode)
9880 || int_reg_operand (operands[1], <MODE>mode))"
9882 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
9884 ;; Move SFmode to a VSX from a GPR register. Because scalar floating point
9885 ;; type is stored internally as double precision in the VSX registers, we have
9886 ;; to convert it from the vector format.
9888 (define_insn_and_split "reload_vsx_from_gprsf"
9889 [(set (match_operand:SF 0 "register_operand" "=wa")
9890 (unspec:SF [(match_operand:SF 1 "register_operand" "r")]
9891 UNSPEC_P8V_RELOAD_FROM_GPR))
9892 (clobber (match_operand:DI 2 "register_operand" "=r"))]
9893 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9895 "&& reload_completed"
9898 rtx op0 = operands[0];
9899 rtx op1 = operands[1];
9900 rtx op2 = operands[2];
9901 /* Also use the destination register to hold the unconverted DImode value.
9902 This is conceptually a separate value from OP0, so we use gen_rtx_REG
9903 rather than simplify_gen_subreg. */
9904 rtx op0_di = gen_rtx_REG (DImode, REGNO (op0));
9905 rtx op1_di = simplify_gen_subreg (DImode, op1, SFmode, 0);
9907 /* Move SF value to upper 32-bits for xscvspdpn. */
9908 emit_insn (gen_ashldi3 (op2, op1_di, GEN_INT (32)));
9909 emit_move_insn (op0_di, op2);
9910 emit_insn (gen_vsx_xscvspdpn_directmove (op0, op0_di));
9913 [(set_attr "length" "8")
9914 (set_attr "type" "two")])
9916 ;; Move 128 bit values from VSX registers to GPRs in 64-bit mode by doing a
9917 ;; normal 64-bit move, followed by an xxpermdi to get the bottom 64-bit value,
9918 ;; and then doing a move of that.
9919 (define_insn "p8_mfvsrd_3_<mode>"
9920 [(set (match_operand:DF 0 "register_operand" "=r")
9921 (unspec:DF [(match_operand:FMOVE128_GPR 1 "register_operand" "wa")]
9922 UNSPEC_P8V_RELOAD_FROM_VSX))]
9923 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9925 [(set_attr "type" "mftgpr")])
9927 (define_insn_and_split "reload_gpr_from_vsx<mode>"
9928 [(set (match_operand:FMOVE128_GPR 0 "register_operand" "=r")
9929 (unspec:FMOVE128_GPR
9930 [(match_operand:FMOVE128_GPR 1 "register_operand" "wa")]
9931 UNSPEC_P8V_RELOAD_FROM_VSX))
9932 (clobber (match_operand:FMOVE128_GPR 2 "register_operand" "=wa"))]
9933 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9935 "&& reload_completed"
9938 rtx dest = operands[0];
9939 rtx src = operands[1];
9940 rtx tmp = operands[2];
9941 rtx gpr_hi_reg = gen_highpart (DFmode, dest);
9942 rtx gpr_lo_reg = gen_lowpart (DFmode, dest);
9944 emit_insn (gen_p8_mfvsrd_3_<mode> (gpr_hi_reg, src));
9945 emit_insn (gen_vsx_xxpermdi_<mode> (tmp, src, src, GEN_INT (3)));
9946 emit_insn (gen_p8_mfvsrd_3_<mode> (gpr_lo_reg, tmp));
9948 [(set_attr "length" "12")
9949 (set_attr "type" "three")])
9951 ;; Move SFmode to a GPR from a VSX register. Because scalar floating point
9952 ;; type is stored internally as double precision, we have to convert it to the
9955 (define_insn_and_split "reload_gpr_from_vsxsf"
9956 [(set (match_operand:SF 0 "register_operand" "=r")
9957 (unspec:SF [(match_operand:SF 1 "register_operand" "wa")]
9958 UNSPEC_P8V_RELOAD_FROM_VSX))
9959 (clobber (match_operand:V4SF 2 "register_operand" "=wa"))]
9960 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9962 "&& reload_completed"
9965 rtx op0 = operands[0];
9966 rtx op1 = operands[1];
9967 rtx op2 = operands[2];
9968 rtx diop0 = simplify_gen_subreg (DImode, op0, SFmode, 0);
9970 emit_insn (gen_vsx_xscvdpspn_scalar (op2, op1));
9971 emit_insn (gen_p8_mfvsrd_4_disf (diop0, op2));
9972 emit_insn (gen_lshrdi3 (diop0, diop0, GEN_INT (32)));
9975 [(set_attr "length" "12")
9976 (set_attr "type" "three")])
9978 (define_insn "p8_mfvsrd_4_disf"
9979 [(set (match_operand:DI 0 "register_operand" "=r")
9980 (unspec:DI [(match_operand:V4SF 1 "register_operand" "wa")]
9981 UNSPEC_P8V_RELOAD_FROM_VSX))]
9982 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9984 [(set_attr "type" "mftgpr")])
9987 ;; Next come the multi-word integer load and store and the load and store
9990 ;; List r->r after r->Y, otherwise reload will try to reload a
9991 ;; non-offsettable address by using r->r which won't make progress.
9992 ;; Use of fprs is disparaged slightly otherwise reload prefers to reload
9993 ;; a gpr into a fpr instead of reloading an invalid 'Y' address
9994 (define_insn "*movdi_internal32"
9995 [(set (match_operand:DI 0 "rs6000_nonimmediate_operand" "=Y,r,r,?m,?*d,?*d,r")
9996 (match_operand:DI 1 "input_operand" "r,Y,r,d,m,d,IJKnGHF"))]
9998 && (gpc_reg_operand (operands[0], DImode)
9999 || gpc_reg_operand (operands[1], DImode))"
10008 [(set_attr "type" "store,load,*,fpstore,fpload,fp,*")])
10011 [(set (match_operand:DI 0 "gpc_reg_operand" "")
10012 (match_operand:DI 1 "const_int_operand" ""))]
10013 "! TARGET_POWERPC64 && reload_completed
10014 && gpr_or_gpr_p (operands[0], operands[1])
10015 && !direct_move_p (operands[0], operands[1])"
10016 [(set (match_dup 2) (match_dup 4))
10017 (set (match_dup 3) (match_dup 1))]
10020 HOST_WIDE_INT value = INTVAL (operands[1]);
10021 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
10023 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
10025 operands[4] = GEN_INT (value >> 32);
10026 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
10030 [(set (match_operand:DIFD 0 "rs6000_nonimmediate_operand" "")
10031 (match_operand:DIFD 1 "input_operand" ""))]
10032 "reload_completed && !TARGET_POWERPC64
10033 && gpr_or_gpr_p (operands[0], operands[1])
10034 && !direct_move_p (operands[0], operands[1])"
10036 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
10038 (define_insn "*movdi_internal64"
10039 [(set (match_operand:DI 0 "nonimmediate_operand" "=Y,r,r,r,r,r,?m,?*d,?*d,r,*h,*h,r,?*wg,r,?*wm")
10040 (match_operand:DI 1 "input_operand" "r,Y,r,I,L,nF,d,m,d,*h,r,0,*wg,r,*wm,r"))]
10042 && (gpc_reg_operand (operands[0], DImode)
10043 || gpc_reg_operand (operands[1], DImode))"
10061 [(set_attr "type" "store,load,*,*,*,*,fpstore,fpload,fp,mfjmpr,mtjmpr,*,mftgpr,mffgpr,mftgpr,mffgpr")
10062 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4,4,4,4")])
10064 ;; Generate all one-bits and clear left or right.
10065 ;; Use (and:DI (rotate:DI ...)) to avoid anddi3 unnecessary clobber.
10067 [(set (match_operand:DI 0 "gpc_reg_operand" "")
10068 (match_operand:DI 1 "mask64_operand" ""))]
10069 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
10070 [(set (match_dup 0) (const_int -1))
10072 (and:DI (rotate:DI (match_dup 0)
10077 ;; Split a load of a large constant into the appropriate five-instruction
10078 ;; sequence. Handle anything in a constant number of insns.
10079 ;; When non-easy constants can go in the TOC, this should use
10080 ;; easy_fp_constant predicate.
10082 [(set (match_operand:DI 0 "gpc_reg_operand" "")
10083 (match_operand:DI 1 "const_int_operand" ""))]
10084 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
10085 [(set (match_dup 0) (match_dup 2))
10086 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
10088 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
10090 if (tem == operands[0])
10097 [(set (match_operand:DI 0 "gpc_reg_operand" "")
10098 (match_operand:DI 1 "const_scalar_int_operand" ""))]
10099 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
10100 [(set (match_dup 0) (match_dup 2))
10101 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
10103 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
10105 if (tem == operands[0])
10111 ;; TImode/PTImode is similar, except that we usually want to compute the
10112 ;; address into a register and use lsi/stsi (the exception is during reload).
10114 (define_insn "*mov<mode>_string"
10115 [(set (match_operand:TI2 0 "reg_or_mem_operand" "=Q,Y,????r,????r,????r,r")
10116 (match_operand:TI2 1 "input_operand" "r,r,Q,Y,r,n"))]
10117 "! TARGET_POWERPC64
10118 && (<MODE>mode != TImode || VECTOR_MEM_NONE_P (TImode))
10119 && (gpc_reg_operand (operands[0], <MODE>mode)
10120 || gpc_reg_operand (operands[1], <MODE>mode))"
10123 switch (which_alternative)
10126 gcc_unreachable ();
10129 return \"stswi %1,%P0,16\";
10133 /* If the address is not used in the output, we can use lsi. Otherwise,
10134 fall through to generating four loads. */
10136 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
10137 return \"lswi %0,%P1,16\";
10138 /* ... fall through ... */
10145 [(set_attr "type" "store,store,load,load,*,*")
10146 (set_attr "update" "yes")
10147 (set_attr "indexed" "yes")
10148 (set (attr "cell_micro") (if_then_else (match_test "TARGET_STRING")
10149 (const_string "always")
10150 (const_string "conditional")))])
10152 (define_insn "*mov<mode>_ppc64"
10153 [(set (match_operand:TI2 0 "nonimmediate_operand" "=wQ,Y,r,r,r,r")
10154 (match_operand:TI2 1 "input_operand" "r,r,wQ,Y,r,n"))]
10155 "(TARGET_POWERPC64 && VECTOR_MEM_NONE_P (<MODE>mode)
10156 && (gpc_reg_operand (operands[0], <MODE>mode)
10157 || gpc_reg_operand (operands[1], <MODE>mode)))"
10159 return rs6000_output_move_128bit (operands);
10161 [(set_attr "type" "store,store,load,load,*,*")
10162 (set_attr "length" "8")])
10165 [(set (match_operand:TI2 0 "int_reg_operand" "")
10166 (match_operand:TI2 1 "const_scalar_int_operand" ""))]
10168 && (VECTOR_MEM_NONE_P (<MODE>mode)
10169 || (reload_completed && INT_REGNO_P (REGNO (operands[0]))))"
10170 [(set (match_dup 2) (match_dup 4))
10171 (set (match_dup 3) (match_dup 5))]
10174 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
10176 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
10178 if (CONST_WIDE_INT_P (operands[1]))
10180 operands[4] = GEN_INT (CONST_WIDE_INT_ELT (operands[1], 1));
10181 operands[5] = GEN_INT (CONST_WIDE_INT_ELT (operands[1], 0));
10183 else if (CONST_INT_P (operands[1]))
10185 operands[4] = GEN_INT (- (INTVAL (operands[1]) < 0));
10186 operands[5] = operands[1];
10193 [(set (match_operand:TI2 0 "nonimmediate_operand" "")
10194 (match_operand:TI2 1 "input_operand" ""))]
10196 && gpr_or_gpr_p (operands[0], operands[1])
10197 && !direct_move_p (operands[0], operands[1])
10198 && !quad_load_store_p (operands[0], operands[1])"
10200 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
10202 (define_expand "load_multiple"
10203 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
10204 (match_operand:SI 1 "" ""))
10205 (use (match_operand:SI 2 "" ""))])]
10206 "TARGET_STRING && !TARGET_POWERPC64"
10214 /* Support only loading a constant number of fixed-point registers from
10215 memory and only bother with this if more than two; the machine
10216 doesn't support more than eight. */
10217 if (GET_CODE (operands[2]) != CONST_INT
10218 || INTVAL (operands[2]) <= 2
10219 || INTVAL (operands[2]) > 8
10220 || GET_CODE (operands[1]) != MEM
10221 || GET_CODE (operands[0]) != REG
10222 || REGNO (operands[0]) >= 32)
10225 count = INTVAL (operands[2]);
10226 regno = REGNO (operands[0]);
10228 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
10229 op1 = replace_equiv_address (operands[1],
10230 force_reg (SImode, XEXP (operands[1], 0)));
10232 for (i = 0; i < count; i++)
10233 XVECEXP (operands[3], 0, i)
10234 = gen_rtx_SET (VOIDmode, gen_rtx_REG (SImode, regno + i),
10235 adjust_address_nv (op1, SImode, i * 4));
10238 (define_insn "*ldmsi8"
10239 [(match_parallel 0 "load_multiple_operation"
10240 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10241 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10242 (set (match_operand:SI 3 "gpc_reg_operand" "")
10243 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10244 (set (match_operand:SI 4 "gpc_reg_operand" "")
10245 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
10246 (set (match_operand:SI 5 "gpc_reg_operand" "")
10247 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
10248 (set (match_operand:SI 6 "gpc_reg_operand" "")
10249 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
10250 (set (match_operand:SI 7 "gpc_reg_operand" "")
10251 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
10252 (set (match_operand:SI 8 "gpc_reg_operand" "")
10253 (mem:SI (plus:SI (match_dup 1) (const_int 24))))
10254 (set (match_operand:SI 9 "gpc_reg_operand" "")
10255 (mem:SI (plus:SI (match_dup 1) (const_int 28))))])]
10256 "TARGET_STRING && XVECLEN (operands[0], 0) == 8"
10258 { return rs6000_output_load_multiple (operands); }"
10259 [(set_attr "type" "load")
10260 (set_attr "update" "yes")
10261 (set_attr "indexed" "yes")
10262 (set_attr "length" "32")])
10264 (define_insn "*ldmsi7"
10265 [(match_parallel 0 "load_multiple_operation"
10266 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10267 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10268 (set (match_operand:SI 3 "gpc_reg_operand" "")
10269 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10270 (set (match_operand:SI 4 "gpc_reg_operand" "")
10271 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
10272 (set (match_operand:SI 5 "gpc_reg_operand" "")
10273 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
10274 (set (match_operand:SI 6 "gpc_reg_operand" "")
10275 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
10276 (set (match_operand:SI 7 "gpc_reg_operand" "")
10277 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
10278 (set (match_operand:SI 8 "gpc_reg_operand" "")
10279 (mem:SI (plus:SI (match_dup 1) (const_int 24))))])]
10280 "TARGET_STRING && XVECLEN (operands[0], 0) == 7"
10282 { return rs6000_output_load_multiple (operands); }"
10283 [(set_attr "type" "load")
10284 (set_attr "update" "yes")
10285 (set_attr "indexed" "yes")
10286 (set_attr "length" "32")])
10288 (define_insn "*ldmsi6"
10289 [(match_parallel 0 "load_multiple_operation"
10290 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10291 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10292 (set (match_operand:SI 3 "gpc_reg_operand" "")
10293 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10294 (set (match_operand:SI 4 "gpc_reg_operand" "")
10295 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
10296 (set (match_operand:SI 5 "gpc_reg_operand" "")
10297 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
10298 (set (match_operand:SI 6 "gpc_reg_operand" "")
10299 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
10300 (set (match_operand:SI 7 "gpc_reg_operand" "")
10301 (mem:SI (plus:SI (match_dup 1) (const_int 20))))])]
10302 "TARGET_STRING && XVECLEN (operands[0], 0) == 6"
10304 { return rs6000_output_load_multiple (operands); }"
10305 [(set_attr "type" "load")
10306 (set_attr "update" "yes")
10307 (set_attr "indexed" "yes")
10308 (set_attr "length" "32")])
10310 (define_insn "*ldmsi5"
10311 [(match_parallel 0 "load_multiple_operation"
10312 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10313 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10314 (set (match_operand:SI 3 "gpc_reg_operand" "")
10315 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10316 (set (match_operand:SI 4 "gpc_reg_operand" "")
10317 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
10318 (set (match_operand:SI 5 "gpc_reg_operand" "")
10319 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
10320 (set (match_operand:SI 6 "gpc_reg_operand" "")
10321 (mem:SI (plus:SI (match_dup 1) (const_int 16))))])]
10322 "TARGET_STRING && XVECLEN (operands[0], 0) == 5"
10324 { return rs6000_output_load_multiple (operands); }"
10325 [(set_attr "type" "load")
10326 (set_attr "update" "yes")
10327 (set_attr "indexed" "yes")
10328 (set_attr "length" "32")])
10330 (define_insn "*ldmsi4"
10331 [(match_parallel 0 "load_multiple_operation"
10332 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10333 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10334 (set (match_operand:SI 3 "gpc_reg_operand" "")
10335 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10336 (set (match_operand:SI 4 "gpc_reg_operand" "")
10337 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
10338 (set (match_operand:SI 5 "gpc_reg_operand" "")
10339 (mem:SI (plus:SI (match_dup 1) (const_int 12))))])]
10340 "TARGET_STRING && XVECLEN (operands[0], 0) == 4"
10342 { return rs6000_output_load_multiple (operands); }"
10343 [(set_attr "type" "load")
10344 (set_attr "update" "yes")
10345 (set_attr "indexed" "yes")
10346 (set_attr "length" "32")])
10348 (define_insn "*ldmsi3"
10349 [(match_parallel 0 "load_multiple_operation"
10350 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10351 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10352 (set (match_operand:SI 3 "gpc_reg_operand" "")
10353 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10354 (set (match_operand:SI 4 "gpc_reg_operand" "")
10355 (mem:SI (plus:SI (match_dup 1) (const_int 8))))])]
10356 "TARGET_STRING && XVECLEN (operands[0], 0) == 3"
10358 { return rs6000_output_load_multiple (operands); }"
10359 [(set_attr "type" "load")
10360 (set_attr "update" "yes")
10361 (set_attr "indexed" "yes")
10362 (set_attr "length" "32")])
10364 (define_expand "store_multiple"
10365 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
10366 (match_operand:SI 1 "" ""))
10367 (clobber (scratch:SI))
10368 (use (match_operand:SI 2 "" ""))])]
10369 "TARGET_STRING && !TARGET_POWERPC64"
10378 /* Support only storing a constant number of fixed-point registers to
10379 memory and only bother with this if more than two; the machine
10380 doesn't support more than eight. */
10381 if (GET_CODE (operands[2]) != CONST_INT
10382 || INTVAL (operands[2]) <= 2
10383 || INTVAL (operands[2]) > 8
10384 || GET_CODE (operands[0]) != MEM
10385 || GET_CODE (operands[1]) != REG
10386 || REGNO (operands[1]) >= 32)
10389 count = INTVAL (operands[2]);
10390 regno = REGNO (operands[1]);
10392 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count + 1));
10393 to = force_reg (SImode, XEXP (operands[0], 0));
10394 op0 = replace_equiv_address (operands[0], to);
10396 XVECEXP (operands[3], 0, 0)
10397 = gen_rtx_SET (VOIDmode, adjust_address_nv (op0, SImode, 0), operands[1]);
10398 XVECEXP (operands[3], 0, 1) = gen_rtx_CLOBBER (VOIDmode,
10399 gen_rtx_SCRATCH (SImode));
10401 for (i = 1; i < count; i++)
10402 XVECEXP (operands[3], 0, i + 1)
10403 = gen_rtx_SET (VOIDmode,
10404 adjust_address_nv (op0, SImode, i * 4),
10405 gen_rtx_REG (SImode, regno + i));
10408 (define_insn "*stmsi8"
10409 [(match_parallel 0 "store_multiple_operation"
10410 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10411 (match_operand:SI 2 "gpc_reg_operand" "r"))
10412 (clobber (match_scratch:SI 3 "=X"))
10413 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10414 (match_operand:SI 4 "gpc_reg_operand" "r"))
10415 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10416 (match_operand:SI 5 "gpc_reg_operand" "r"))
10417 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10418 (match_operand:SI 6 "gpc_reg_operand" "r"))
10419 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10420 (match_operand:SI 7 "gpc_reg_operand" "r"))
10421 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10422 (match_operand:SI 8 "gpc_reg_operand" "r"))
10423 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
10424 (match_operand:SI 9 "gpc_reg_operand" "r"))
10425 (set (mem:SI (plus:SI (match_dup 1) (const_int 28)))
10426 (match_operand:SI 10 "gpc_reg_operand" "r"))])]
10427 "TARGET_STRING && XVECLEN (operands[0], 0) == 9"
10429 [(set_attr "type" "store")
10430 (set_attr "update" "yes")
10431 (set_attr "indexed" "yes")
10432 (set_attr "cell_micro" "always")])
10434 (define_insn "*stmsi7"
10435 [(match_parallel 0 "store_multiple_operation"
10436 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10437 (match_operand:SI 2 "gpc_reg_operand" "r"))
10438 (clobber (match_scratch:SI 3 "=X"))
10439 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10440 (match_operand:SI 4 "gpc_reg_operand" "r"))
10441 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10442 (match_operand:SI 5 "gpc_reg_operand" "r"))
10443 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10444 (match_operand:SI 6 "gpc_reg_operand" "r"))
10445 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10446 (match_operand:SI 7 "gpc_reg_operand" "r"))
10447 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10448 (match_operand:SI 8 "gpc_reg_operand" "r"))
10449 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
10450 (match_operand:SI 9 "gpc_reg_operand" "r"))])]
10451 "TARGET_STRING && XVECLEN (operands[0], 0) == 8"
10453 [(set_attr "type" "store")
10454 (set_attr "update" "yes")
10455 (set_attr "indexed" "yes")
10456 (set_attr "cell_micro" "always")])
10458 (define_insn "*stmsi6"
10459 [(match_parallel 0 "store_multiple_operation"
10460 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10461 (match_operand:SI 2 "gpc_reg_operand" "r"))
10462 (clobber (match_scratch:SI 3 "=X"))
10463 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10464 (match_operand:SI 4 "gpc_reg_operand" "r"))
10465 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10466 (match_operand:SI 5 "gpc_reg_operand" "r"))
10467 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10468 (match_operand:SI 6 "gpc_reg_operand" "r"))
10469 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10470 (match_operand:SI 7 "gpc_reg_operand" "r"))
10471 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10472 (match_operand:SI 8 "gpc_reg_operand" "r"))])]
10473 "TARGET_STRING && XVECLEN (operands[0], 0) == 7"
10475 [(set_attr "type" "store")
10476 (set_attr "update" "yes")
10477 (set_attr "indexed" "yes")
10478 (set_attr "cell_micro" "always")])
10480 (define_insn "*stmsi5"
10481 [(match_parallel 0 "store_multiple_operation"
10482 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10483 (match_operand:SI 2 "gpc_reg_operand" "r"))
10484 (clobber (match_scratch:SI 3 "=X"))
10485 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10486 (match_operand:SI 4 "gpc_reg_operand" "r"))
10487 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10488 (match_operand:SI 5 "gpc_reg_operand" "r"))
10489 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10490 (match_operand:SI 6 "gpc_reg_operand" "r"))
10491 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10492 (match_operand:SI 7 "gpc_reg_operand" "r"))])]
10493 "TARGET_STRING && XVECLEN (operands[0], 0) == 6"
10495 [(set_attr "type" "store")
10496 (set_attr "update" "yes")
10497 (set_attr "indexed" "yes")
10498 (set_attr "cell_micro" "always")])
10500 (define_insn "*stmsi4"
10501 [(match_parallel 0 "store_multiple_operation"
10502 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10503 (match_operand:SI 2 "gpc_reg_operand" "r"))
10504 (clobber (match_scratch:SI 3 "=X"))
10505 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10506 (match_operand:SI 4 "gpc_reg_operand" "r"))
10507 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10508 (match_operand:SI 5 "gpc_reg_operand" "r"))
10509 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10510 (match_operand:SI 6 "gpc_reg_operand" "r"))])]
10511 "TARGET_STRING && XVECLEN (operands[0], 0) == 5"
10513 [(set_attr "type" "store")
10514 (set_attr "update" "yes")
10515 (set_attr "indexed" "yes")
10516 (set_attr "cell_micro" "always")])
10518 (define_insn "*stmsi3"
10519 [(match_parallel 0 "store_multiple_operation"
10520 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10521 (match_operand:SI 2 "gpc_reg_operand" "r"))
10522 (clobber (match_scratch:SI 3 "=X"))
10523 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10524 (match_operand:SI 4 "gpc_reg_operand" "r"))
10525 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10526 (match_operand:SI 5 "gpc_reg_operand" "r"))])]
10527 "TARGET_STRING && XVECLEN (operands[0], 0) == 4"
10529 [(set_attr "type" "store")
10530 (set_attr "update" "yes")
10531 (set_attr "indexed" "yes")
10532 (set_attr "cell_micro" "always")])
10534 (define_expand "setmemsi"
10535 [(parallel [(set (match_operand:BLK 0 "" "")
10536 (match_operand 2 "const_int_operand" ""))
10537 (use (match_operand:SI 1 "" ""))
10538 (use (match_operand:SI 3 "" ""))])]
10542 /* If value to set is not zero, use the library routine. */
10543 if (operands[2] != const0_rtx)
10546 if (expand_block_clear (operands))
10552 ;; String/block move insn.
10553 ;; Argument 0 is the destination
10554 ;; Argument 1 is the source
10555 ;; Argument 2 is the length
10556 ;; Argument 3 is the alignment
10558 (define_expand "movmemsi"
10559 [(parallel [(set (match_operand:BLK 0 "" "")
10560 (match_operand:BLK 1 "" ""))
10561 (use (match_operand:SI 2 "" ""))
10562 (use (match_operand:SI 3 "" ""))])]
10566 if (expand_block_move (operands))
10572 ;; Move up to 32 bytes at a time. The fixed registers are needed because the
10573 ;; register allocator doesn't have a clue about allocating 8 word registers.
10574 ;; rD/rS = r5 is preferred, efficient form.
10575 (define_expand "movmemsi_8reg"
10576 [(parallel [(set (match_operand 0 "" "")
10577 (match_operand 1 "" ""))
10578 (use (match_operand 2 "" ""))
10579 (use (match_operand 3 "" ""))
10580 (clobber (reg:SI 5))
10581 (clobber (reg:SI 6))
10582 (clobber (reg:SI 7))
10583 (clobber (reg:SI 8))
10584 (clobber (reg:SI 9))
10585 (clobber (reg:SI 10))
10586 (clobber (reg:SI 11))
10587 (clobber (reg:SI 12))
10588 (clobber (match_scratch:SI 4 ""))])]
10593 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
10594 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
10595 (use (match_operand:SI 2 "immediate_operand" "i"))
10596 (use (match_operand:SI 3 "immediate_operand" "i"))
10597 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10598 (clobber (reg:SI 6))
10599 (clobber (reg:SI 7))
10600 (clobber (reg:SI 8))
10601 (clobber (reg:SI 9))
10602 (clobber (reg:SI 10))
10603 (clobber (reg:SI 11))
10604 (clobber (reg:SI 12))
10605 (clobber (match_scratch:SI 5 "=X"))]
10607 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
10608 || INTVAL (operands[2]) == 0)
10609 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
10610 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
10611 && REGNO (operands[4]) == 5"
10612 "lswi %4,%1,%2\;stswi %4,%0,%2"
10613 [(set_attr "type" "store")
10614 (set_attr "update" "yes")
10615 (set_attr "indexed" "yes")
10616 (set_attr "cell_micro" "always")
10617 (set_attr "length" "8")])
10619 ;; Move up to 24 bytes at a time. The fixed registers are needed because the
10620 ;; register allocator doesn't have a clue about allocating 6 word registers.
10621 ;; rD/rS = r5 is preferred, efficient form.
10622 (define_expand "movmemsi_6reg"
10623 [(parallel [(set (match_operand 0 "" "")
10624 (match_operand 1 "" ""))
10625 (use (match_operand 2 "" ""))
10626 (use (match_operand 3 "" ""))
10627 (clobber (reg:SI 5))
10628 (clobber (reg:SI 6))
10629 (clobber (reg:SI 7))
10630 (clobber (reg:SI 8))
10631 (clobber (reg:SI 9))
10632 (clobber (reg:SI 10))
10633 (clobber (match_scratch:SI 4 ""))])]
10638 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
10639 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
10640 (use (match_operand:SI 2 "immediate_operand" "i"))
10641 (use (match_operand:SI 3 "immediate_operand" "i"))
10642 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10643 (clobber (reg:SI 6))
10644 (clobber (reg:SI 7))
10645 (clobber (reg:SI 8))
10646 (clobber (reg:SI 9))
10647 (clobber (reg:SI 10))
10648 (clobber (match_scratch:SI 5 "=X"))]
10650 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
10651 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
10652 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
10653 && REGNO (operands[4]) == 5"
10654 "lswi %4,%1,%2\;stswi %4,%0,%2"
10655 [(set_attr "type" "store")
10656 (set_attr "update" "yes")
10657 (set_attr "indexed" "yes")
10658 (set_attr "cell_micro" "always")
10659 (set_attr "length" "8")])
10661 ;; Move up to 16 bytes at a time, using 4 fixed registers to avoid spill
10662 ;; problems with TImode.
10663 ;; rD/rS = r5 is preferred, efficient form.
10664 (define_expand "movmemsi_4reg"
10665 [(parallel [(set (match_operand 0 "" "")
10666 (match_operand 1 "" ""))
10667 (use (match_operand 2 "" ""))
10668 (use (match_operand 3 "" ""))
10669 (clobber (reg:SI 5))
10670 (clobber (reg:SI 6))
10671 (clobber (reg:SI 7))
10672 (clobber (reg:SI 8))
10673 (clobber (match_scratch:SI 4 ""))])]
10678 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
10679 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
10680 (use (match_operand:SI 2 "immediate_operand" "i"))
10681 (use (match_operand:SI 3 "immediate_operand" "i"))
10682 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10683 (clobber (reg:SI 6))
10684 (clobber (reg:SI 7))
10685 (clobber (reg:SI 8))
10686 (clobber (match_scratch:SI 5 "=X"))]
10688 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
10689 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
10690 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
10691 && REGNO (operands[4]) == 5"
10692 "lswi %4,%1,%2\;stswi %4,%0,%2"
10693 [(set_attr "type" "store")
10694 (set_attr "update" "yes")
10695 (set_attr "indexed" "yes")
10696 (set_attr "cell_micro" "always")
10697 (set_attr "length" "8")])
10699 ;; Move up to 8 bytes at a time.
10700 (define_expand "movmemsi_2reg"
10701 [(parallel [(set (match_operand 0 "" "")
10702 (match_operand 1 "" ""))
10703 (use (match_operand 2 "" ""))
10704 (use (match_operand 3 "" ""))
10705 (clobber (match_scratch:DI 4 ""))
10706 (clobber (match_scratch:SI 5 ""))])]
10707 "TARGET_STRING && ! TARGET_POWERPC64"
10711 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
10712 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
10713 (use (match_operand:SI 2 "immediate_operand" "i"))
10714 (use (match_operand:SI 3 "immediate_operand" "i"))
10715 (clobber (match_scratch:DI 4 "=&r"))
10716 (clobber (match_scratch:SI 5 "=X"))]
10717 "TARGET_STRING && ! TARGET_POWERPC64
10718 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
10719 "lswi %4,%1,%2\;stswi %4,%0,%2"
10720 [(set_attr "type" "store")
10721 (set_attr "update" "yes")
10722 (set_attr "indexed" "yes")
10723 (set_attr "cell_micro" "always")
10724 (set_attr "length" "8")])
10726 ;; Move up to 4 bytes at a time.
10727 (define_expand "movmemsi_1reg"
10728 [(parallel [(set (match_operand 0 "" "")
10729 (match_operand 1 "" ""))
10730 (use (match_operand 2 "" ""))
10731 (use (match_operand 3 "" ""))
10732 (clobber (match_scratch:SI 4 ""))
10733 (clobber (match_scratch:SI 5 ""))])]
10738 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
10739 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
10740 (use (match_operand:SI 2 "immediate_operand" "i"))
10741 (use (match_operand:SI 3 "immediate_operand" "i"))
10742 (clobber (match_scratch:SI 4 "=&r"))
10743 (clobber (match_scratch:SI 5 "=X"))]
10744 "TARGET_STRING && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
10745 "lswi %4,%1,%2\;stswi %4,%0,%2"
10746 [(set_attr "type" "store")
10747 (set_attr "update" "yes")
10748 (set_attr "indexed" "yes")
10749 (set_attr "cell_micro" "always")
10750 (set_attr "length" "8")])
10752 ;; Define insns that do load or store with update. Some of these we can
10753 ;; get by using pre-decrement or pre-increment, but the hardware can also
10754 ;; do cases where the increment is not the size of the object.
10756 ;; In all these cases, we use operands 0 and 1 for the register being
10757 ;; incremented because those are the operands that local-alloc will
10758 ;; tie and these are the pair most likely to be tieable (and the ones
10759 ;; that will benefit the most).
10761 (define_insn "*movdi_update1"
10762 [(set (match_operand:DI 3 "gpc_reg_operand" "=r,r")
10763 (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
10764 (match_operand:DI 2 "reg_or_aligned_short_operand" "r,I"))))
10765 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
10766 (plus:DI (match_dup 1) (match_dup 2)))]
10767 "TARGET_POWERPC64 && TARGET_UPDATE
10768 && (!avoiding_indexed_address_p (DImode)
10769 || !gpc_reg_operand (operands[2], DImode))"
10773 [(set_attr "type" "load")
10774 (set_attr "update" "yes")
10775 (set_attr "indexed" "yes,no")])
10777 (define_insn "movdi_<mode>_update"
10778 [(set (mem:DI (plus:P (match_operand:P 1 "gpc_reg_operand" "0,0")
10779 (match_operand:P 2 "reg_or_aligned_short_operand" "r,I")))
10780 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
10781 (set (match_operand:P 0 "gpc_reg_operand" "=b,b")
10782 (plus:P (match_dup 1) (match_dup 2)))]
10783 "TARGET_POWERPC64 && TARGET_UPDATE
10784 && (!avoiding_indexed_address_p (Pmode)
10785 || !gpc_reg_operand (operands[2], Pmode)
10786 || (REG_P (operands[0])
10787 && REGNO (operands[0]) == STACK_POINTER_REGNUM))"
10791 [(set_attr "type" "store")
10792 (set_attr "update" "yes")
10793 (set_attr "indexed" "yes,no")])
10795 ;; This pattern is only conditional on TARGET_POWERPC64, as it is
10796 ;; needed for stack allocation, even if the user passes -mno-update.
10797 (define_insn "movdi_<mode>_update_stack"
10798 [(set (mem:DI (plus:P (match_operand:P 1 "gpc_reg_operand" "0,0")
10799 (match_operand:P 2 "reg_or_aligned_short_operand" "r,I")))
10800 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
10801 (set (match_operand:P 0 "gpc_reg_operand" "=b,b")
10802 (plus:P (match_dup 1) (match_dup 2)))]
10807 [(set_attr "type" "store")
10808 (set_attr "update" "yes")
10809 (set_attr "indexed" "yes,no")])
10811 (define_insn "*movsi_update1"
10812 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
10813 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10814 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10815 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10816 (plus:SI (match_dup 1) (match_dup 2)))]
10818 && (!avoiding_indexed_address_p (SImode)
10819 || !gpc_reg_operand (operands[2], SImode))"
10823 [(set_attr "type" "load")
10824 (set_attr "update" "yes")
10825 (set_attr "indexed" "yes,no")])
10827 (define_insn "*movsi_update2"
10828 [(set (match_operand:DI 3 "gpc_reg_operand" "=r")
10830 (mem:SI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0")
10831 (match_operand:DI 2 "gpc_reg_operand" "r")))))
10832 (set (match_operand:DI 0 "gpc_reg_operand" "=b")
10833 (plus:DI (match_dup 1) (match_dup 2)))]
10834 "TARGET_POWERPC64 && rs6000_gen_cell_microcode
10835 && !avoiding_indexed_address_p (DImode)"
10837 [(set_attr "type" "load")
10838 (set_attr "sign_extend" "yes")
10839 (set_attr "update" "yes")
10840 (set_attr "indexed" "yes")])
10842 (define_insn "movsi_update"
10843 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10844 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10845 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
10846 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10847 (plus:SI (match_dup 1) (match_dup 2)))]
10849 && (!avoiding_indexed_address_p (SImode)
10850 || !gpc_reg_operand (operands[2], SImode)
10851 || (REG_P (operands[0])
10852 && REGNO (operands[0]) == STACK_POINTER_REGNUM))"
10856 [(set_attr "type" "store")
10857 (set_attr "update" "yes")
10858 (set_attr "indexed" "yes,no")])
10860 ;; This is an unconditional pattern; needed for stack allocation, even
10861 ;; if the user passes -mno-update.
10862 (define_insn "movsi_update_stack"
10863 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10864 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10865 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
10866 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10867 (plus:SI (match_dup 1) (match_dup 2)))]
10872 [(set_attr "type" "store")
10873 (set_attr "update" "yes")
10874 (set_attr "indexed" "yes,no")])
10876 (define_insn "*movhi_update1"
10877 [(set (match_operand:HI 3 "gpc_reg_operand" "=r,r")
10878 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10879 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10880 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10881 (plus:SI (match_dup 1) (match_dup 2)))]
10883 && (!avoiding_indexed_address_p (SImode)
10884 || !gpc_reg_operand (operands[2], SImode))"
10888 [(set_attr "type" "load")
10889 (set_attr "update" "yes")
10890 (set_attr "indexed" "yes,no")])
10892 (define_insn "*movhi_update2"
10893 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
10895 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10896 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
10897 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10898 (plus:SI (match_dup 1) (match_dup 2)))]
10900 && (!avoiding_indexed_address_p (SImode)
10901 || !gpc_reg_operand (operands[2], SImode))"
10905 [(set_attr "type" "load")
10906 (set_attr "update" "yes")
10907 (set_attr "indexed" "yes,no")])
10909 (define_insn "*movhi_update3"
10910 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
10912 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10913 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
10914 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10915 (plus:SI (match_dup 1) (match_dup 2)))]
10916 "TARGET_UPDATE && rs6000_gen_cell_microcode
10917 && (!avoiding_indexed_address_p (SImode)
10918 || !gpc_reg_operand (operands[2], SImode))"
10922 [(set_attr "type" "load")
10923 (set_attr "sign_extend" "yes")
10924 (set_attr "update" "yes")
10925 (set_attr "indexed" "yes,no")])
10927 (define_insn "*movhi_update4"
10928 [(set (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10929 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10930 (match_operand:HI 3 "gpc_reg_operand" "r,r"))
10931 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10932 (plus:SI (match_dup 1) (match_dup 2)))]
10934 && (!avoiding_indexed_address_p (SImode)
10935 || !gpc_reg_operand (operands[2], SImode))"
10939 [(set_attr "type" "store")
10940 (set_attr "update" "yes")
10941 (set_attr "indexed" "yes,no")])
10943 (define_insn "*movqi_update1"
10944 [(set (match_operand:QI 3 "gpc_reg_operand" "=r,r")
10945 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10946 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10947 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10948 (plus:SI (match_dup 1) (match_dup 2)))]
10950 && (!avoiding_indexed_address_p (SImode)
10951 || !gpc_reg_operand (operands[2], SImode))"
10955 [(set_attr "type" "load")
10956 (set_attr "update" "yes")
10957 (set_attr "indexed" "yes,no")])
10959 (define_insn "*movqi_update2"
10960 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
10962 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10963 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
10964 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10965 (plus:SI (match_dup 1) (match_dup 2)))]
10967 && (!avoiding_indexed_address_p (SImode)
10968 || !gpc_reg_operand (operands[2], SImode))"
10972 [(set_attr "type" "load")
10973 (set_attr "update" "yes")
10974 (set_attr "indexed" "yes,no")])
10976 (define_insn "*movqi_update3"
10977 [(set (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10978 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10979 (match_operand:QI 3 "gpc_reg_operand" "r,r"))
10980 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10981 (plus:SI (match_dup 1) (match_dup 2)))]
10983 && (!avoiding_indexed_address_p (SImode)
10984 || !gpc_reg_operand (operands[2], SImode))"
10988 [(set_attr "type" "store")
10989 (set_attr "update" "yes")
10990 (set_attr "indexed" "yes,no")])
10992 (define_insn "*movsf_update1"
10993 [(set (match_operand:SF 3 "gpc_reg_operand" "=f,f")
10994 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10995 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10996 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10997 (plus:SI (match_dup 1) (match_dup 2)))]
10998 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT && TARGET_UPDATE
10999 && (!avoiding_indexed_address_p (SImode)
11000 || !gpc_reg_operand (operands[2], SImode))"
11004 [(set_attr "type" "fpload")
11005 (set_attr "update" "yes")
11006 (set_attr "indexed" "yes,no")])
11008 (define_insn "*movsf_update2"
11009 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11010 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
11011 (match_operand:SF 3 "gpc_reg_operand" "f,f"))
11012 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11013 (plus:SI (match_dup 1) (match_dup 2)))]
11014 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT && TARGET_UPDATE
11015 && (!avoiding_indexed_address_p (SImode)
11016 || !gpc_reg_operand (operands[2], SImode))"
11020 [(set_attr "type" "fpstore")
11021 (set_attr "update" "yes")
11022 (set_attr "indexed" "yes,no")])
11024 (define_insn "*movsf_update3"
11025 [(set (match_operand:SF 3 "gpc_reg_operand" "=r,r")
11026 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11027 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
11028 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11029 (plus:SI (match_dup 1) (match_dup 2)))]
11030 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE
11031 && (!avoiding_indexed_address_p (SImode)
11032 || !gpc_reg_operand (operands[2], SImode))"
11036 [(set_attr "type" "load")
11037 (set_attr "update" "yes")
11038 (set_attr "indexed" "yes,no")])
11040 (define_insn "*movsf_update4"
11041 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11042 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
11043 (match_operand:SF 3 "gpc_reg_operand" "r,r"))
11044 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11045 (plus:SI (match_dup 1) (match_dup 2)))]
11046 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE
11047 && (!avoiding_indexed_address_p (SImode)
11048 || !gpc_reg_operand (operands[2], SImode))"
11052 [(set_attr "type" "store")
11053 (set_attr "update" "yes")
11054 (set_attr "indexed" "yes,no")])
11056 (define_insn "*movdf_update1"
11057 [(set (match_operand:DF 3 "gpc_reg_operand" "=d,d")
11058 (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11059 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
11060 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11061 (plus:SI (match_dup 1) (match_dup 2)))]
11062 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_UPDATE
11063 && (!avoiding_indexed_address_p (SImode)
11064 || !gpc_reg_operand (operands[2], SImode))"
11068 [(set_attr "type" "fpload")
11069 (set_attr "update" "yes")
11070 (set_attr "indexed" "yes,no")])
11072 (define_insn "*movdf_update2"
11073 [(set (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11074 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
11075 (match_operand:DF 3 "gpc_reg_operand" "d,d"))
11076 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11077 (plus:SI (match_dup 1) (match_dup 2)))]
11078 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_UPDATE
11079 && (!avoiding_indexed_address_p (SImode)
11080 || !gpc_reg_operand (operands[2], SImode))"
11084 [(set_attr "type" "fpstore")
11085 (set_attr "update" "yes")
11086 (set_attr "indexed" "yes,no")])
11089 ;; After inserting conditional returns we can sometimes have
11090 ;; unnecessary register moves. Unfortunately we cannot have a
11091 ;; modeless peephole here, because some single SImode sets have early
11092 ;; clobber outputs. Although those sets expand to multi-ppc-insn
11093 ;; sequences, using get_attr_length here will smash the operands
11094 ;; array. Neither is there an early_cobbler_p predicate.
11095 ;; Disallow subregs for E500 so we don't munge frob_di_df_2.
11097 [(set (match_operand:DF 0 "gpc_reg_operand" "")
11098 (match_operand:DF 1 "any_operand" ""))
11099 (set (match_operand:DF 2 "gpc_reg_operand" "")
11101 "!(TARGET_E500_DOUBLE && GET_CODE (operands[2]) == SUBREG)
11102 && peep2_reg_dead_p (2, operands[0])"
11103 [(set (match_dup 2) (match_dup 1))])
11106 [(set (match_operand:SF 0 "gpc_reg_operand" "")
11107 (match_operand:SF 1 "any_operand" ""))
11108 (set (match_operand:SF 2 "gpc_reg_operand" "")
11110 "peep2_reg_dead_p (2, operands[0])"
11111 [(set (match_dup 2) (match_dup 1))])
11116 ;; Mode attributes for different ABIs.
11117 (define_mode_iterator TLSmode [(SI "! TARGET_64BIT") (DI "TARGET_64BIT")])
11118 (define_mode_attr tls_abi_suffix [(SI "32") (DI "64")])
11119 (define_mode_attr tls_sysv_suffix [(SI "si") (DI "di")])
11120 (define_mode_attr tls_insn_suffix [(SI "wz") (DI "d")])
11122 (define_insn_and_split "tls_gd_aix<TLSmode:tls_abi_suffix>"
11123 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11124 (call (mem:TLSmode (match_operand:TLSmode 3 "symbol_ref_operand" "s"))
11125 (match_operand 4 "" "g")))
11126 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11127 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11129 (clobber (reg:SI LR_REGNO))]
11130 "HAVE_AS_TLS && (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)"
11132 if (TARGET_CMODEL != CMODEL_SMALL)
11133 return "addis %0,%1,%2@got@tlsgd@ha\;addi %0,%0,%2@got@tlsgd@l\;"
11136 return "addi %0,%1,%2@got@tlsgd\;bl %z3\;nop";
11138 "&& TARGET_TLS_MARKERS"
11139 [(set (match_dup 0)
11140 (unspec:TLSmode [(match_dup 1)
11143 (parallel [(set (match_dup 0)
11144 (call (mem:TLSmode (match_dup 3))
11146 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD)
11147 (clobber (reg:SI LR_REGNO))])]
11149 [(set_attr "type" "two")
11150 (set (attr "length")
11151 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
11155 (define_insn_and_split "tls_gd_sysv<TLSmode:tls_sysv_suffix>"
11156 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11157 (call (mem:TLSmode (match_operand:TLSmode 3 "symbol_ref_operand" "s"))
11158 (match_operand 4 "" "g")))
11159 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11160 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11162 (clobber (reg:SI LR_REGNO))]
11163 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4"
11167 if (TARGET_SECURE_PLT && flag_pic == 2)
11168 return "addi %0,%1,%2@got@tlsgd\;bl %z3+32768@plt";
11170 return "addi %0,%1,%2@got@tlsgd\;bl %z3@plt";
11173 return "addi %0,%1,%2@got@tlsgd\;bl %z3";
11175 "&& TARGET_TLS_MARKERS"
11176 [(set (match_dup 0)
11177 (unspec:TLSmode [(match_dup 1)
11180 (parallel [(set (match_dup 0)
11181 (call (mem:TLSmode (match_dup 3))
11183 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD)
11184 (clobber (reg:SI LR_REGNO))])]
11186 [(set_attr "type" "two")
11187 (set_attr "length" "8")])
11189 (define_insn_and_split "*tls_gd<TLSmode:tls_abi_suffix>"
11190 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11191 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11192 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11194 "HAVE_AS_TLS && TARGET_TLS_MARKERS"
11195 "addi %0,%1,%2@got@tlsgd"
11196 "&& TARGET_CMODEL != CMODEL_SMALL"
11197 [(set (match_dup 3)
11199 (unspec:TLSmode [(match_dup 1) (match_dup 2)] UNSPEC_TLSGD)))
11201 (lo_sum:TLSmode (match_dup 3)
11202 (unspec:TLSmode [(match_dup 1) (match_dup 2)] UNSPEC_TLSGD)))]
11205 operands[3] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
11207 [(set (attr "length")
11208 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
11212 (define_insn "*tls_gd_high<TLSmode:tls_abi_suffix>"
11213 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11215 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11216 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11218 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
11219 "addis %0,%1,%2@got@tlsgd@ha"
11220 [(set_attr "length" "4")])
11222 (define_insn "*tls_gd_low<TLSmode:tls_abi_suffix>"
11223 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11224 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11225 (unspec:TLSmode [(match_operand:TLSmode 3 "gpc_reg_operand" "b")
11226 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11228 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
11229 "addi %0,%1,%2@got@tlsgd@l"
11230 [(set_attr "length" "4")])
11232 (define_insn "*tls_gd_call_aix<TLSmode:tls_abi_suffix>"
11233 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11234 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
11235 (match_operand 2 "" "g")))
11236 (unspec:TLSmode [(match_operand:TLSmode 3 "rs6000_tls_symbol_ref" "")]
11238 (clobber (reg:SI LR_REGNO))]
11239 "HAVE_AS_TLS && TARGET_TLS_MARKERS
11240 && (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)"
11241 "bl %z1(%3@tlsgd)\;nop"
11242 [(set_attr "type" "branch")
11243 (set_attr "length" "8")])
11245 (define_insn "*tls_gd_call_sysv<TLSmode:tls_abi_suffix>"
11246 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11247 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
11248 (match_operand 2 "" "g")))
11249 (unspec:TLSmode [(match_operand:TLSmode 3 "rs6000_tls_symbol_ref" "")]
11251 (clobber (reg:SI LR_REGNO))]
11252 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4 && TARGET_TLS_MARKERS"
11256 if (TARGET_SECURE_PLT && flag_pic == 2)
11257 return "bl %z1+32768(%3@tlsgd)@plt";
11258 return "bl %z1(%3@tlsgd)@plt";
11260 return "bl %z1(%3@tlsgd)";
11262 [(set_attr "type" "branch")
11263 (set_attr "length" "4")])
11265 (define_insn_and_split "tls_ld_aix<TLSmode:tls_abi_suffix>"
11266 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11267 (call (mem:TLSmode (match_operand:TLSmode 2 "symbol_ref_operand" "s"))
11268 (match_operand 3 "" "g")))
11269 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
11271 (clobber (reg:SI LR_REGNO))]
11272 "HAVE_AS_TLS && (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)"
11274 if (TARGET_CMODEL != CMODEL_SMALL)
11275 return "addis %0,%1,%&@got@tlsld@ha\;addi %0,%0,%&@got@tlsld@l\;"
11278 return "addi %0,%1,%&@got@tlsld\;bl %z2\;nop";
11280 "&& TARGET_TLS_MARKERS"
11281 [(set (match_dup 0)
11282 (unspec:TLSmode [(match_dup 1)]
11284 (parallel [(set (match_dup 0)
11285 (call (mem:TLSmode (match_dup 2))
11287 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
11288 (clobber (reg:SI LR_REGNO))])]
11290 [(set_attr "type" "two")
11291 (set (attr "length")
11292 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
11296 (define_insn_and_split "tls_ld_sysv<TLSmode:tls_sysv_suffix>"
11297 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11298 (call (mem:TLSmode (match_operand:TLSmode 2 "symbol_ref_operand" "s"))
11299 (match_operand 3 "" "g")))
11300 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
11302 (clobber (reg:SI LR_REGNO))]
11303 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4"
11307 if (TARGET_SECURE_PLT && flag_pic == 2)
11308 return "addi %0,%1,%&@got@tlsld\;bl %z2+32768@plt";
11310 return "addi %0,%1,%&@got@tlsld\;bl %z2@plt";
11313 return "addi %0,%1,%&@got@tlsld\;bl %z2";
11315 "&& TARGET_TLS_MARKERS"
11316 [(set (match_dup 0)
11317 (unspec:TLSmode [(match_dup 1)]
11319 (parallel [(set (match_dup 0)
11320 (call (mem:TLSmode (match_dup 2))
11322 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
11323 (clobber (reg:SI LR_REGNO))])]
11325 [(set_attr "length" "8")])
11327 (define_insn_and_split "*tls_ld<TLSmode:tls_abi_suffix>"
11328 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11329 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
11331 "HAVE_AS_TLS && TARGET_TLS_MARKERS"
11332 "addi %0,%1,%&@got@tlsld"
11333 "&& TARGET_CMODEL != CMODEL_SMALL"
11334 [(set (match_dup 2)
11336 (unspec:TLSmode [(const_int 0) (match_dup 1)] UNSPEC_TLSLD)))
11338 (lo_sum:TLSmode (match_dup 2)
11339 (unspec:TLSmode [(const_int 0) (match_dup 1)] UNSPEC_TLSLD)))]
11342 operands[2] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
11344 [(set (attr "length")
11345 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
11349 (define_insn "*tls_ld_high<TLSmode:tls_abi_suffix>"
11350 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11352 (unspec:TLSmode [(const_int 0)
11353 (match_operand:TLSmode 1 "gpc_reg_operand" "b")]
11355 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
11356 "addis %0,%1,%&@got@tlsld@ha"
11357 [(set_attr "length" "4")])
11359 (define_insn "*tls_ld_low<TLSmode:tls_abi_suffix>"
11360 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11361 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11362 (unspec:TLSmode [(const_int 0)
11363 (match_operand:TLSmode 2 "gpc_reg_operand" "b")]
11365 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
11366 "addi %0,%1,%&@got@tlsld@l"
11367 [(set_attr "length" "4")])
11369 (define_insn "*tls_ld_call_aix<TLSmode:tls_abi_suffix>"
11370 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11371 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
11372 (match_operand 2 "" "g")))
11373 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
11374 (clobber (reg:SI LR_REGNO))]
11375 "HAVE_AS_TLS && TARGET_TLS_MARKERS
11376 && (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)"
11377 "bl %z1(%&@tlsld)\;nop"
11378 [(set_attr "type" "branch")
11379 (set_attr "length" "8")])
11381 (define_insn "*tls_ld_call_sysv<TLSmode:tls_abi_suffix>"
11382 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11383 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
11384 (match_operand 2 "" "g")))
11385 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
11386 (clobber (reg:SI LR_REGNO))]
11387 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4 && TARGET_TLS_MARKERS"
11391 if (TARGET_SECURE_PLT && flag_pic == 2)
11392 return "bl %z1+32768(%&@tlsld)@plt";
11393 return "bl %z1(%&@tlsld)@plt";
11395 return "bl %z1(%&@tlsld)";
11397 [(set_attr "type" "branch")
11398 (set_attr "length" "4")])
11400 (define_insn "tls_dtprel_<TLSmode:tls_abi_suffix>"
11401 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11402 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11403 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11404 UNSPEC_TLSDTPREL))]
11406 "addi %0,%1,%2@dtprel")
11408 (define_insn "tls_dtprel_ha_<TLSmode:tls_abi_suffix>"
11409 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11410 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11411 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11412 UNSPEC_TLSDTPRELHA))]
11414 "addis %0,%1,%2@dtprel@ha")
11416 (define_insn "tls_dtprel_lo_<TLSmode:tls_abi_suffix>"
11417 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11418 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11419 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11420 UNSPEC_TLSDTPRELLO))]
11422 "addi %0,%1,%2@dtprel@l")
11424 (define_insn_and_split "tls_got_dtprel_<TLSmode:tls_abi_suffix>"
11425 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11426 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11427 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11428 UNSPEC_TLSGOTDTPREL))]
11430 "l<TLSmode:tls_insn_suffix> %0,%2@got@dtprel(%1)"
11431 "&& TARGET_CMODEL != CMODEL_SMALL"
11432 [(set (match_dup 3)
11434 (unspec:TLSmode [(match_dup 1) (match_dup 2)] UNSPEC_TLSGOTDTPREL)))
11436 (lo_sum:TLSmode (match_dup 3)
11437 (unspec:TLSmode [(match_dup 1) (match_dup 2)] UNSPEC_TLSGOTDTPREL)))]
11440 operands[3] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
11442 [(set (attr "length")
11443 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
11447 (define_insn "*tls_got_dtprel_high<TLSmode:tls_abi_suffix>"
11448 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11450 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11451 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11452 UNSPEC_TLSGOTDTPREL)))]
11453 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
11454 "addis %0,%1,%2@got@dtprel@ha"
11455 [(set_attr "length" "4")])
11457 (define_insn "*tls_got_dtprel_low<TLSmode:tls_abi_suffix>"
11458 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11459 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11460 (unspec:TLSmode [(match_operand:TLSmode 3 "gpc_reg_operand" "b")
11461 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11462 UNSPEC_TLSGOTDTPREL)))]
11463 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
11464 "l<TLSmode:tls_insn_suffix> %0,%2@got@dtprel@l(%1)"
11465 [(set_attr "length" "4")])
11467 (define_insn "tls_tprel_<TLSmode:tls_abi_suffix>"
11468 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11469 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11470 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11473 "addi %0,%1,%2@tprel")
11475 (define_insn "tls_tprel_ha_<TLSmode:tls_abi_suffix>"
11476 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11477 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11478 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11479 UNSPEC_TLSTPRELHA))]
11481 "addis %0,%1,%2@tprel@ha")
11483 (define_insn "tls_tprel_lo_<TLSmode:tls_abi_suffix>"
11484 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11485 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11486 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11487 UNSPEC_TLSTPRELLO))]
11489 "addi %0,%1,%2@tprel@l")
11491 ;; "b" output constraint here and on tls_tls input to support linker tls
11492 ;; optimization. The linker may edit the instructions emitted by a
11493 ;; tls_got_tprel/tls_tls pair to addis,addi.
11494 (define_insn_and_split "tls_got_tprel_<TLSmode:tls_abi_suffix>"
11495 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11496 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11497 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11498 UNSPEC_TLSGOTTPREL))]
11500 "l<TLSmode:tls_insn_suffix> %0,%2@got@tprel(%1)"
11501 "&& TARGET_CMODEL != CMODEL_SMALL"
11502 [(set (match_dup 3)
11504 (unspec:TLSmode [(match_dup 1) (match_dup 2)] UNSPEC_TLSGOTTPREL)))
11506 (lo_sum:TLSmode (match_dup 3)
11507 (unspec:TLSmode [(match_dup 1) (match_dup 2)] UNSPEC_TLSGOTTPREL)))]
11510 operands[3] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
11512 [(set (attr "length")
11513 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
11517 (define_insn "*tls_got_tprel_high<TLSmode:tls_abi_suffix>"
11518 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11520 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11521 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11522 UNSPEC_TLSGOTTPREL)))]
11523 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
11524 "addis %0,%1,%2@got@tprel@ha"
11525 [(set_attr "length" "4")])
11527 (define_insn "*tls_got_tprel_low<TLSmode:tls_abi_suffix>"
11528 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11529 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11530 (unspec:TLSmode [(match_operand:TLSmode 3 "gpc_reg_operand" "b")
11531 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11532 UNSPEC_TLSGOTTPREL)))]
11533 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
11534 "l<TLSmode:tls_insn_suffix> %0,%2@got@tprel@l(%1)"
11535 [(set_attr "length" "4")])
11537 (define_insn "tls_tls_<TLSmode:tls_abi_suffix>"
11538 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11539 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11540 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11542 "TARGET_ELF && HAVE_AS_TLS"
11543 "add %0,%1,%2@tls")
11545 (define_expand "tls_get_tpointer"
11546 [(set (match_operand:SI 0 "gpc_reg_operand" "")
11547 (unspec:SI [(const_int 0)] UNSPEC_TLSTLS))]
11548 "TARGET_XCOFF && HAVE_AS_TLS"
11551 emit_insn (gen_tls_get_tpointer_internal ());
11552 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
11556 (define_insn "tls_get_tpointer_internal"
11558 (unspec:SI [(const_int 0)] UNSPEC_TLSTLS))
11559 (clobber (reg:SI LR_REGNO))]
11560 "TARGET_XCOFF && HAVE_AS_TLS"
11561 "bla __get_tpointer")
11563 (define_expand "tls_get_addr<mode>"
11564 [(set (match_operand:P 0 "gpc_reg_operand" "")
11565 (unspec:P [(match_operand:P 1 "gpc_reg_operand" "")
11566 (match_operand:P 2 "gpc_reg_operand" "")] UNSPEC_TLSTLS))]
11567 "TARGET_XCOFF && HAVE_AS_TLS"
11570 emit_move_insn (gen_rtx_REG (Pmode, 3), operands[1]);
11571 emit_move_insn (gen_rtx_REG (Pmode, 4), operands[2]);
11572 emit_insn (gen_tls_get_addr_internal<mode> ());
11573 emit_move_insn (operands[0], gen_rtx_REG (Pmode, 3));
11577 (define_insn "tls_get_addr_internal<mode>"
11579 (unspec:P [(reg:P 3) (reg:P 4)] UNSPEC_TLSTLS))
11580 (clobber (reg:P 0))
11581 (clobber (reg:P 4))
11582 (clobber (reg:P 5))
11583 (clobber (reg:P 11))
11584 (clobber (reg:CC CR0_REGNO))
11585 (clobber (reg:P LR_REGNO))]
11586 "TARGET_XCOFF && HAVE_AS_TLS"
11587 "bla __tls_get_addr")
11589 ;; Next come insns related to the calling sequence.
11591 ;; First, an insn to allocate new stack space for dynamic use (e.g., alloca).
11592 ;; We move the back-chain and decrement the stack pointer.
11594 (define_expand "allocate_stack"
11595 [(set (match_operand 0 "gpc_reg_operand" "")
11596 (minus (reg 1) (match_operand 1 "reg_or_short_operand" "")))
11598 (minus (reg 1) (match_dup 1)))]
11601 { rtx chain = gen_reg_rtx (Pmode);
11602 rtx stack_bot = gen_rtx_MEM (Pmode, stack_pointer_rtx);
11604 rtx insn, par, set, mem;
11606 emit_move_insn (chain, stack_bot);
11608 /* Check stack bounds if necessary. */
11609 if (crtl->limit_stack)
11612 available = expand_binop (Pmode, sub_optab,
11613 stack_pointer_rtx, stack_limit_rtx,
11614 NULL_RTX, 1, OPTAB_WIDEN);
11615 emit_insn (gen_cond_trap (LTU, available, operands[1], const0_rtx));
11618 if (GET_CODE (operands[1]) != CONST_INT
11619 || INTVAL (operands[1]) < -32767
11620 || INTVAL (operands[1]) > 32768)
11622 neg_op0 = gen_reg_rtx (Pmode);
11624 emit_insn (gen_negsi2 (neg_op0, operands[1]));
11626 emit_insn (gen_negdi2 (neg_op0, operands[1]));
11629 neg_op0 = GEN_INT (- INTVAL (operands[1]));
11631 insn = emit_insn ((* ((TARGET_32BIT) ? gen_movsi_update_stack
11632 : gen_movdi_di_update_stack))
11633 (stack_pointer_rtx, stack_pointer_rtx, neg_op0,
11635 /* Since we didn't use gen_frame_mem to generate the MEM, grab
11636 it now and set the alias set/attributes. The above gen_*_update
11637 calls will generate a PARALLEL with the MEM set being the first
11639 par = PATTERN (insn);
11640 gcc_assert (GET_CODE (par) == PARALLEL);
11641 set = XVECEXP (par, 0, 0);
11642 gcc_assert (GET_CODE (set) == SET);
11643 mem = SET_DEST (set);
11644 gcc_assert (MEM_P (mem));
11645 MEM_NOTRAP_P (mem) = 1;
11646 set_mem_alias_set (mem, get_frame_alias_set ());
11648 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
11652 ;; These patterns say how to save and restore the stack pointer. We need not
11653 ;; save the stack pointer at function level since we are careful to
11654 ;; preserve the backchain. At block level, we have to restore the backchain
11655 ;; when we restore the stack pointer.
11657 ;; For nonlocal gotos, we must save both the stack pointer and its
11658 ;; backchain and restore both. Note that in the nonlocal case, the
11659 ;; save area is a memory location.
11661 (define_expand "save_stack_function"
11662 [(match_operand 0 "any_operand" "")
11663 (match_operand 1 "any_operand" "")]
11667 (define_expand "restore_stack_function"
11668 [(match_operand 0 "any_operand" "")
11669 (match_operand 1 "any_operand" "")]
11673 ;; Adjust stack pointer (op0) to a new value (op1).
11674 ;; First copy old stack backchain to new location, and ensure that the
11675 ;; scheduler won't reorder the sp assignment before the backchain write.
11676 (define_expand "restore_stack_block"
11677 [(set (match_dup 2) (match_dup 3))
11678 (set (match_dup 4) (match_dup 2))
11680 (set (match_operand 0 "register_operand" "")
11681 (match_operand 1 "register_operand" ""))]
11687 operands[1] = force_reg (Pmode, operands[1]);
11688 operands[2] = gen_reg_rtx (Pmode);
11689 operands[3] = gen_frame_mem (Pmode, operands[0]);
11690 operands[4] = gen_frame_mem (Pmode, operands[1]);
11691 p = rtvec_alloc (1);
11692 RTVEC_ELT (p, 0) = gen_rtx_SET (VOIDmode,
11693 gen_frame_mem (BLKmode, operands[0]),
11695 operands[5] = gen_rtx_PARALLEL (VOIDmode, p);
11698 (define_expand "save_stack_nonlocal"
11699 [(set (match_dup 3) (match_dup 4))
11700 (set (match_operand 0 "memory_operand" "") (match_dup 3))
11701 (set (match_dup 2) (match_operand 1 "register_operand" ""))]
11705 int units_per_word = (TARGET_32BIT) ? 4 : 8;
11707 /* Copy the backchain to the first word, sp to the second. */
11708 operands[0] = adjust_address_nv (operands[0], Pmode, 0);
11709 operands[2] = adjust_address_nv (operands[0], Pmode, units_per_word);
11710 operands[3] = gen_reg_rtx (Pmode);
11711 operands[4] = gen_frame_mem (Pmode, operands[1]);
11714 (define_expand "restore_stack_nonlocal"
11715 [(set (match_dup 2) (match_operand 1 "memory_operand" ""))
11716 (set (match_dup 3) (match_dup 4))
11717 (set (match_dup 5) (match_dup 2))
11719 (set (match_operand 0 "register_operand" "") (match_dup 3))]
11723 int units_per_word = (TARGET_32BIT) ? 4 : 8;
11726 /* Restore the backchain from the first word, sp from the second. */
11727 operands[2] = gen_reg_rtx (Pmode);
11728 operands[3] = gen_reg_rtx (Pmode);
11729 operands[1] = adjust_address_nv (operands[1], Pmode, 0);
11730 operands[4] = adjust_address_nv (operands[1], Pmode, units_per_word);
11731 operands[5] = gen_frame_mem (Pmode, operands[3]);
11732 p = rtvec_alloc (1);
11733 RTVEC_ELT (p, 0) = gen_rtx_SET (VOIDmode,
11734 gen_frame_mem (BLKmode, operands[0]),
11736 operands[6] = gen_rtx_PARALLEL (VOIDmode, p);
11739 ;; TOC register handling.
11741 ;; Code to initialize the TOC register...
11743 (define_insn "load_toc_aix_si"
11744 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11745 (unspec:SI [(const_int 0)] UNSPEC_TOC))
11746 (use (reg:SI 2))])]
11747 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2) && TARGET_32BIT"
11751 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
11752 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
11753 operands[2] = gen_rtx_REG (Pmode, 2);
11754 return \"lwz %0,%1(%2)\";
11756 [(set_attr "type" "load")
11757 (set_attr "update" "no")
11758 (set_attr "indexed" "no")])
11760 (define_insn "load_toc_aix_di"
11761 [(parallel [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11762 (unspec:DI [(const_int 0)] UNSPEC_TOC))
11763 (use (reg:DI 2))])]
11764 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2) && TARGET_64BIT"
11768 #ifdef TARGET_RELOCATABLE
11769 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\",
11770 !TARGET_MINIMAL_TOC || TARGET_RELOCATABLE);
11772 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
11775 strcat (buf, \"@toc\");
11776 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
11777 operands[2] = gen_rtx_REG (Pmode, 2);
11778 return \"ld %0,%1(%2)\";
11780 [(set_attr "type" "load")
11781 (set_attr "update" "no")
11782 (set_attr "indexed" "no")])
11784 (define_insn "load_toc_v4_pic_si"
11785 [(set (reg:SI LR_REGNO)
11786 (unspec:SI [(const_int 0)] UNSPEC_TOC))]
11787 "DEFAULT_ABI == ABI_V4 && flag_pic == 1 && TARGET_32BIT"
11788 "bl _GLOBAL_OFFSET_TABLE_@local-4"
11789 [(set_attr "type" "branch")
11790 (set_attr "length" "4")])
11792 (define_expand "load_toc_v4_PIC_1"
11793 [(parallel [(set (reg:SI LR_REGNO)
11794 (match_operand:SI 0 "immediate_operand" "s"))
11795 (use (unspec [(match_dup 0)] UNSPEC_TOC))])]
11796 "TARGET_ELF && DEFAULT_ABI == ABI_V4
11797 && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
11800 (define_insn "load_toc_v4_PIC_1_normal"
11801 [(set (reg:SI LR_REGNO)
11802 (match_operand:SI 0 "immediate_operand" "s"))
11803 (use (unspec [(match_dup 0)] UNSPEC_TOC))]
11804 "!TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI == ABI_V4
11805 && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
11806 "bcl 20,31,%0\\n%0:"
11807 [(set_attr "type" "branch")
11808 (set_attr "length" "4")])
11810 (define_insn "load_toc_v4_PIC_1_476"
11811 [(set (reg:SI LR_REGNO)
11812 (match_operand:SI 0 "immediate_operand" "s"))
11813 (use (unspec [(match_dup 0)] UNSPEC_TOC))]
11814 "TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI == ABI_V4
11815 && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
11819 static char templ[32];
11821 get_ppc476_thunk_name (name);
11822 sprintf (templ, \"bl %s\\n%%0:\", name);
11825 [(set_attr "type" "branch")
11826 (set_attr "length" "4")])
11828 (define_expand "load_toc_v4_PIC_1b"
11829 [(parallel [(set (reg:SI LR_REGNO)
11830 (unspec:SI [(match_operand:SI 0 "immediate_operand" "s")
11831 (label_ref (match_operand 1 "" ""))]
11834 "TARGET_ELF && DEFAULT_ABI == ABI_V4 && flag_pic == 2"
11837 (define_insn "load_toc_v4_PIC_1b_normal"
11838 [(set (reg:SI LR_REGNO)
11839 (unspec:SI [(match_operand:SI 0 "immediate_operand" "s")
11840 (label_ref (match_operand 1 "" ""))]
11843 "!TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI == ABI_V4 && flag_pic == 2"
11844 "bcl 20,31,$+8\;.long %0-$"
11845 [(set_attr "type" "branch")
11846 (set_attr "length" "8")])
11848 (define_insn "load_toc_v4_PIC_1b_476"
11849 [(set (reg:SI LR_REGNO)
11850 (unspec:SI [(match_operand:SI 0 "immediate_operand" "s")
11851 (label_ref (match_operand 1 "" ""))]
11854 "TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI == ABI_V4 && flag_pic == 2"
11858 static char templ[32];
11860 get_ppc476_thunk_name (name);
11861 sprintf (templ, \"bl %s\\n\\tb $+8\\n\\t.long %%0-$\", name);
11864 [(set_attr "type" "branch")
11865 (set_attr "length" "16")])
11867 (define_insn "load_toc_v4_PIC_2"
11868 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11869 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
11870 (minus:SI (match_operand:SI 2 "immediate_operand" "s")
11871 (match_operand:SI 3 "immediate_operand" "s")))))]
11872 "TARGET_ELF && DEFAULT_ABI == ABI_V4 && flag_pic == 2"
11874 [(set_attr "type" "load")])
11876 (define_insn "load_toc_v4_PIC_3b"
11877 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11878 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
11880 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
11881 (match_operand:SI 3 "symbol_ref_operand" "s")))))]
11882 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI == ABI_V4 && flag_pic"
11883 "addis %0,%1,%2-%3@ha")
11885 (define_insn "load_toc_v4_PIC_3c"
11886 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11887 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
11888 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
11889 (match_operand:SI 3 "symbol_ref_operand" "s"))))]
11890 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI == ABI_V4 && flag_pic"
11891 "addi %0,%1,%2-%3@l")
11893 ;; If the TOC is shared over a translation unit, as happens with all
11894 ;; the kinds of PIC that we support, we need to restore the TOC
11895 ;; pointer only when jumping over units of translation.
11896 ;; On Darwin, we need to reload the picbase.
11898 (define_expand "builtin_setjmp_receiver"
11899 [(use (label_ref (match_operand 0 "" "")))]
11900 "(DEFAULT_ABI == ABI_V4 && flag_pic == 1)
11901 || (TARGET_TOC && TARGET_MINIMAL_TOC)
11902 || (DEFAULT_ABI == ABI_DARWIN && flag_pic)"
11906 if (DEFAULT_ABI == ABI_DARWIN)
11908 rtx picrtx = gen_rtx_SYMBOL_REF (Pmode, MACHOPIC_FUNCTION_BASE_NAME);
11909 rtx picreg = gen_rtx_REG (Pmode, RS6000_PIC_OFFSET_TABLE_REGNUM);
11913 crtl->uses_pic_offset_table = 1;
11914 ASM_GENERATE_INTERNAL_LABEL(tmplab, \"LSJR\",
11915 CODE_LABEL_NUMBER (operands[0]));
11916 tmplabrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (tmplab));
11918 emit_insn (gen_load_macho_picbase (tmplabrtx));
11919 emit_move_insn (picreg, gen_rtx_REG (Pmode, LR_REGNO));
11920 emit_insn (gen_macho_correct_pic (picreg, picreg, picrtx, tmplabrtx));
11924 rs6000_emit_load_toc_table (FALSE);
11928 ;; Largetoc support
11929 (define_insn "*largetoc_high"
11930 [(set (match_operand:DI 0 "gpc_reg_operand" "=b*r")
11932 (unspec [(match_operand:DI 1 "" "")
11933 (match_operand:DI 2 "gpc_reg_operand" "b")]
11935 "TARGET_ELF && TARGET_CMODEL != CMODEL_SMALL"
11936 "addis %0,%2,%1@toc@ha")
11938 (define_insn "*largetoc_high_aix<mode>"
11939 [(set (match_operand:P 0 "gpc_reg_operand" "=b*r")
11941 (unspec [(match_operand:P 1 "" "")
11942 (match_operand:P 2 "gpc_reg_operand" "b")]
11944 "TARGET_XCOFF && TARGET_CMODEL != CMODEL_SMALL"
11945 "addis %0,%1@u(%2)")
11947 (define_insn "*largetoc_high_plus"
11948 [(set (match_operand:DI 0 "gpc_reg_operand" "=b*r")
11951 (unspec [(match_operand:DI 1 "" "")
11952 (match_operand:DI 2 "gpc_reg_operand" "b")]
11954 (match_operand:DI 3 "add_cint_operand" "n"))))]
11955 "TARGET_ELF && TARGET_CMODEL != CMODEL_SMALL"
11956 "addis %0,%2,%1+%3@toc@ha")
11958 (define_insn "*largetoc_high_plus_aix<mode>"
11959 [(set (match_operand:P 0 "gpc_reg_operand" "=b*r")
11962 (unspec [(match_operand:P 1 "" "")
11963 (match_operand:P 2 "gpc_reg_operand" "b")]
11965 (match_operand:P 3 "add_cint_operand" "n"))))]
11966 "TARGET_XCOFF && TARGET_CMODEL != CMODEL_SMALL"
11967 "addis %0,%1+%3@u(%2)")
11969 (define_insn "*largetoc_low"
11970 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
11971 (lo_sum:DI (match_operand:DI 1 "gpc_reg_operand" "b,!*r")
11972 (match_operand:DI 2 "" "")))]
11973 "TARGET_ELF && TARGET_CMODEL != CMODEL_SMALL"
11978 (define_insn "*largetoc_low_aix<mode>"
11979 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
11980 (lo_sum:P (match_operand:P 1 "gpc_reg_operand" "b")
11981 (match_operand:P 2 "" "")))]
11982 "TARGET_XCOFF && TARGET_CMODEL != CMODEL_SMALL"
11985 (define_insn_and_split "*tocref<mode>"
11986 [(set (match_operand:P 0 "gpc_reg_operand" "=b*r")
11987 (match_operand:P 1 "small_toc_ref" "R"))]
11990 "&& TARGET_CMODEL != CMODEL_SMALL && reload_completed"
11991 [(set (match_dup 0) (high:P (match_dup 1)))
11992 (set (match_dup 0) (lo_sum:P (match_dup 0) (match_dup 1)))])
11994 ;; Elf specific ways of loading addresses for non-PIC code.
11995 ;; The output of this could be r0, but we make a very strong
11996 ;; preference for a base register because it will usually
11997 ;; be needed there.
11998 (define_insn "elf_high"
11999 [(set (match_operand:SI 0 "gpc_reg_operand" "=b*r")
12000 (high:SI (match_operand 1 "" "")))]
12001 "TARGET_ELF && ! TARGET_64BIT"
12004 (define_insn "elf_low"
12005 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12006 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,!*r")
12007 (match_operand 2 "" "")))]
12008 "TARGET_ELF && ! TARGET_64BIT"
12013 ;; Call and call_value insns
12014 (define_expand "call"
12015 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
12016 (match_operand 1 "" ""))
12017 (use (match_operand 2 "" ""))
12018 (clobber (reg:SI LR_REGNO))])]
12023 if (MACHOPIC_INDIRECT)
12024 operands[0] = machopic_indirect_call_target (operands[0]);
12027 gcc_assert (GET_CODE (operands[0]) == MEM);
12028 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
12030 operands[0] = XEXP (operands[0], 0);
12032 if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
12034 rs6000_call_aix (NULL_RTX, operands[0], operands[1], operands[2]);
12038 if (GET_CODE (operands[0]) != SYMBOL_REF
12039 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[2]) & CALL_LONG) != 0))
12041 if (INTVAL (operands[2]) & CALL_LONG)
12042 operands[0] = rs6000_longcall_ref (operands[0]);
12044 switch (DEFAULT_ABI)
12048 operands[0] = force_reg (Pmode, operands[0]);
12052 gcc_unreachable ();
12057 (define_expand "call_value"
12058 [(parallel [(set (match_operand 0 "" "")
12059 (call (mem:SI (match_operand 1 "address_operand" ""))
12060 (match_operand 2 "" "")))
12061 (use (match_operand 3 "" ""))
12062 (clobber (reg:SI LR_REGNO))])]
12067 if (MACHOPIC_INDIRECT)
12068 operands[1] = machopic_indirect_call_target (operands[1]);
12071 gcc_assert (GET_CODE (operands[1]) == MEM);
12072 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
12074 operands[1] = XEXP (operands[1], 0);
12076 if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
12078 rs6000_call_aix (operands[0], operands[1], operands[2], operands[3]);
12082 if (GET_CODE (operands[1]) != SYMBOL_REF
12083 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[3]) & CALL_LONG) != 0))
12085 if (INTVAL (operands[3]) & CALL_LONG)
12086 operands[1] = rs6000_longcall_ref (operands[1]);
12088 switch (DEFAULT_ABI)
12092 operands[1] = force_reg (Pmode, operands[1]);
12096 gcc_unreachable ();
12101 ;; Call to function in current module. No TOC pointer reload needed.
12102 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
12103 ;; either the function was not prototyped, or it was prototyped as a
12104 ;; variable argument function. It is > 0 if FP registers were passed
12105 ;; and < 0 if they were not.
12107 (define_insn "*call_local32"
12108 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
12109 (match_operand 1 "" "g,g"))
12110 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12111 (clobber (reg:SI LR_REGNO))]
12112 "(INTVAL (operands[2]) & CALL_LONG) == 0"
12115 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12116 output_asm_insn (\"crxor 6,6,6\", operands);
12118 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12119 output_asm_insn (\"creqv 6,6,6\", operands);
12121 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
12123 [(set_attr "type" "branch")
12124 (set_attr "length" "4,8")])
12126 (define_insn "*call_local64"
12127 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
12128 (match_operand 1 "" "g,g"))
12129 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12130 (clobber (reg:SI LR_REGNO))]
12131 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
12134 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12135 output_asm_insn (\"crxor 6,6,6\", operands);
12137 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12138 output_asm_insn (\"creqv 6,6,6\", operands);
12140 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
12142 [(set_attr "type" "branch")
12143 (set_attr "length" "4,8")])
12145 (define_insn "*call_value_local32"
12146 [(set (match_operand 0 "" "")
12147 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
12148 (match_operand 2 "" "g,g")))
12149 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12150 (clobber (reg:SI LR_REGNO))]
12151 "(INTVAL (operands[3]) & CALL_LONG) == 0"
12154 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12155 output_asm_insn (\"crxor 6,6,6\", operands);
12157 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12158 output_asm_insn (\"creqv 6,6,6\", operands);
12160 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
12162 [(set_attr "type" "branch")
12163 (set_attr "length" "4,8")])
12166 (define_insn "*call_value_local64"
12167 [(set (match_operand 0 "" "")
12168 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
12169 (match_operand 2 "" "g,g")))
12170 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12171 (clobber (reg:SI LR_REGNO))]
12172 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
12175 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12176 output_asm_insn (\"crxor 6,6,6\", operands);
12178 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12179 output_asm_insn (\"creqv 6,6,6\", operands);
12181 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
12183 [(set_attr "type" "branch")
12184 (set_attr "length" "4,8")])
12187 ;; A function pointer under System V is just a normal pointer
12188 ;; operands[0] is the function pointer
12189 ;; operands[1] is the stack size to clean up
12190 ;; operands[2] is the value FUNCTION_ARG returns for the VOID argument
12191 ;; which indicates how to set cr1
12193 (define_insn "*call_indirect_nonlocal_sysv<mode>"
12194 [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l,c,*l"))
12195 (match_operand 1 "" "g,g,g,g"))
12196 (use (match_operand:SI 2 "immediate_operand" "O,O,n,n"))
12197 (clobber (reg:SI LR_REGNO))]
12198 "DEFAULT_ABI == ABI_V4
12199 || DEFAULT_ABI == ABI_DARWIN"
12201 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12202 output_asm_insn ("crxor 6,6,6", operands);
12204 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12205 output_asm_insn ("creqv 6,6,6", operands);
12209 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
12210 (set_attr "length" "4,4,8,8")])
12212 (define_insn_and_split "*call_nonlocal_sysv<mode>"
12213 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
12214 (match_operand 1 "" "g,g"))
12215 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12216 (clobber (reg:SI LR_REGNO))]
12217 "(DEFAULT_ABI == ABI_DARWIN
12218 || (DEFAULT_ABI == ABI_V4
12219 && (INTVAL (operands[2]) & CALL_LONG) == 0))"
12221 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12222 output_asm_insn ("crxor 6,6,6", operands);
12224 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12225 output_asm_insn ("creqv 6,6,6", operands);
12228 return output_call(insn, operands, 0, 2);
12230 if (DEFAULT_ABI == ABI_V4 && flag_pic)
12232 gcc_assert (!TARGET_SECURE_PLT);
12233 return "bl %z0@plt";
12239 "DEFAULT_ABI == ABI_V4
12240 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[0])
12241 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12242 [(parallel [(call (mem:SI (match_dup 0))
12244 (use (match_dup 2))
12245 (use (match_dup 3))
12246 (clobber (reg:SI LR_REGNO))])]
12248 operands[3] = pic_offset_table_rtx;
12250 [(set_attr "type" "branch,branch")
12251 (set_attr "length" "4,8")])
12253 (define_insn "*call_nonlocal_sysv_secure<mode>"
12254 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
12255 (match_operand 1 "" "g,g"))
12256 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12257 (use (match_operand:SI 3 "register_operand" "r,r"))
12258 (clobber (reg:SI LR_REGNO))]
12259 "(DEFAULT_ABI == ABI_V4
12260 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[0])
12261 && (INTVAL (operands[2]) & CALL_LONG) == 0)"
12263 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12264 output_asm_insn ("crxor 6,6,6", operands);
12266 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12267 output_asm_insn ("creqv 6,6,6", operands);
12270 /* The magic 32768 offset here and in the other sysv call insns
12271 corresponds to the offset of r30 in .got2, as given by LCTOC1.
12272 See sysv4.h:toc_section. */
12273 return "bl %z0+32768@plt";
12275 return "bl %z0@plt";
12277 [(set_attr "type" "branch,branch")
12278 (set_attr "length" "4,8")])
12280 (define_insn "*call_value_indirect_nonlocal_sysv<mode>"
12281 [(set (match_operand 0 "" "")
12282 (call (mem:SI (match_operand:P 1 "register_operand" "c,*l,c,*l"))
12283 (match_operand 2 "" "g,g,g,g")))
12284 (use (match_operand:SI 3 "immediate_operand" "O,O,n,n"))
12285 (clobber (reg:SI LR_REGNO))]
12286 "DEFAULT_ABI == ABI_V4
12287 || DEFAULT_ABI == ABI_DARWIN"
12289 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12290 output_asm_insn ("crxor 6,6,6", operands);
12292 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12293 output_asm_insn ("creqv 6,6,6", operands);
12297 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
12298 (set_attr "length" "4,4,8,8")])
12300 (define_insn_and_split "*call_value_nonlocal_sysv<mode>"
12301 [(set (match_operand 0 "" "")
12302 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
12303 (match_operand 2 "" "g,g")))
12304 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12305 (clobber (reg:SI LR_REGNO))]
12306 "(DEFAULT_ABI == ABI_DARWIN
12307 || (DEFAULT_ABI == ABI_V4
12308 && (INTVAL (operands[3]) & CALL_LONG) == 0))"
12310 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12311 output_asm_insn ("crxor 6,6,6", operands);
12313 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12314 output_asm_insn ("creqv 6,6,6", operands);
12317 return output_call(insn, operands, 1, 3);
12319 if (DEFAULT_ABI == ABI_V4 && flag_pic)
12321 gcc_assert (!TARGET_SECURE_PLT);
12322 return "bl %z1@plt";
12328 "DEFAULT_ABI == ABI_V4
12329 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[1])
12330 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12331 [(parallel [(set (match_dup 0)
12332 (call (mem:SI (match_dup 1))
12334 (use (match_dup 3))
12335 (use (match_dup 4))
12336 (clobber (reg:SI LR_REGNO))])]
12338 operands[4] = pic_offset_table_rtx;
12340 [(set_attr "type" "branch,branch")
12341 (set_attr "length" "4,8")])
12343 (define_insn "*call_value_nonlocal_sysv_secure<mode>"
12344 [(set (match_operand 0 "" "")
12345 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
12346 (match_operand 2 "" "g,g")))
12347 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12348 (use (match_operand:SI 4 "register_operand" "r,r"))
12349 (clobber (reg:SI LR_REGNO))]
12350 "(DEFAULT_ABI == ABI_V4
12351 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[1])
12352 && (INTVAL (operands[3]) & CALL_LONG) == 0)"
12354 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12355 output_asm_insn ("crxor 6,6,6", operands);
12357 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12358 output_asm_insn ("creqv 6,6,6", operands);
12361 return "bl %z1+32768@plt";
12363 return "bl %z1@plt";
12365 [(set_attr "type" "branch,branch")
12366 (set_attr "length" "4,8")])
12369 ;; Call to AIX abi function in the same module.
12371 (define_insn "*call_local_aix<mode>"
12372 [(call (mem:SI (match_operand:P 0 "current_file_function_operand" "s"))
12373 (match_operand 1 "" "g"))
12374 (clobber (reg:P LR_REGNO))]
12375 "DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2"
12377 [(set_attr "type" "branch")
12378 (set_attr "length" "4")])
12380 (define_insn "*call_value_local_aix<mode>"
12381 [(set (match_operand 0 "" "")
12382 (call (mem:SI (match_operand:P 1 "current_file_function_operand" "s"))
12383 (match_operand 2 "" "g")))
12384 (clobber (reg:P LR_REGNO))]
12385 "DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2"
12387 [(set_attr "type" "branch")
12388 (set_attr "length" "4")])
12390 ;; Call to AIX abi function which may be in another module.
12391 ;; Restore the TOC pointer (r2) after the call.
12393 (define_insn "*call_nonlocal_aix<mode>"
12394 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s"))
12395 (match_operand 1 "" "g"))
12396 (clobber (reg:P LR_REGNO))]
12397 "DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2"
12399 [(set_attr "type" "branch")
12400 (set_attr "length" "8")])
12402 (define_insn "*call_value_nonlocal_aix<mode>"
12403 [(set (match_operand 0 "" "")
12404 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s"))
12405 (match_operand 2 "" "g")))
12406 (clobber (reg:P LR_REGNO))]
12407 "DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2"
12409 [(set_attr "type" "branch")
12410 (set_attr "length" "8")])
12412 ;; Call to indirect functions with the AIX abi using a 3 word descriptor.
12413 ;; Operand0 is the addresss of the function to call
12414 ;; Operand2 is the location in the function descriptor to load r2 from
12415 ;; Operand3 is the stack location to hold the current TOC pointer
12417 (define_insn "*call_indirect_aix<mode>"
12418 [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l"))
12419 (match_operand 1 "" "g,g"))
12420 (use (match_operand:P 2 "memory_operand" "<ptrm>,<ptrm>"))
12421 (set (reg:P TOC_REGNUM) (match_operand:P 3 "memory_operand" "<ptrm>,<ptrm>"))
12422 (clobber (reg:P LR_REGNO))]
12423 "DEFAULT_ABI == ABI_AIX"
12424 "<ptrload> 2,%2\;b%T0l\;<ptrload> 2,%3"
12425 [(set_attr "type" "jmpreg")
12426 (set_attr "length" "12")])
12428 (define_insn "*call_value_indirect_aix<mode>"
12429 [(set (match_operand 0 "" "")
12430 (call (mem:SI (match_operand:P 1 "register_operand" "c,*l"))
12431 (match_operand 2 "" "g,g")))
12432 (use (match_operand:P 3 "memory_operand" "<ptrm>,<ptrm>"))
12433 (set (reg:P TOC_REGNUM) (match_operand:P 4 "memory_operand" "<ptrm>,<ptrm>"))
12434 (clobber (reg:P LR_REGNO))]
12435 "DEFAULT_ABI == ABI_AIX"
12436 "<ptrload> 2,%3\;b%T1l\;<ptrload> 2,%4"
12437 [(set_attr "type" "jmpreg")
12438 (set_attr "length" "12")])
12440 ;; Call to indirect functions with the ELFv2 ABI.
12441 ;; Operand0 is the addresss of the function to call
12442 ;; Operand2 is the stack location to hold the current TOC pointer
12444 (define_insn "*call_indirect_elfv2<mode>"
12445 [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l"))
12446 (match_operand 1 "" "g,g"))
12447 (set (reg:P TOC_REGNUM) (match_operand:P 2 "memory_operand" "<ptrm>,<ptrm>"))
12448 (clobber (reg:P LR_REGNO))]
12449 "DEFAULT_ABI == ABI_ELFv2"
12450 "b%T0l\;<ptrload> 2,%2"
12451 [(set_attr "type" "jmpreg")
12452 (set_attr "length" "8")])
12454 (define_insn "*call_value_indirect_elfv2<mode>"
12455 [(set (match_operand 0 "" "")
12456 (call (mem:SI (match_operand:P 1 "register_operand" "c,*l"))
12457 (match_operand 2 "" "g,g")))
12458 (set (reg:P TOC_REGNUM) (match_operand:P 3 "memory_operand" "<ptrm>,<ptrm>"))
12459 (clobber (reg:P LR_REGNO))]
12460 "DEFAULT_ABI == ABI_ELFv2"
12461 "b%T1l\;<ptrload> 2,%3"
12462 [(set_attr "type" "jmpreg")
12463 (set_attr "length" "8")])
12466 ;; Call subroutine returning any type.
12467 (define_expand "untyped_call"
12468 [(parallel [(call (match_operand 0 "" "")
12470 (match_operand 1 "" "")
12471 (match_operand 2 "" "")])]
12477 emit_call_insn (GEN_CALL (operands[0], const0_rtx, const0_rtx, const0_rtx));
12479 for (i = 0; i < XVECLEN (operands[2], 0); i++)
12481 rtx set = XVECEXP (operands[2], 0, i);
12482 emit_move_insn (SET_DEST (set), SET_SRC (set));
12485 /* The optimizer does not know that the call sets the function value
12486 registers we stored in the result block. We avoid problems by
12487 claiming that all hard registers are used and clobbered at this
12489 emit_insn (gen_blockage ());
12494 ;; sibling call patterns
12495 (define_expand "sibcall"
12496 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
12497 (match_operand 1 "" ""))
12498 (use (match_operand 2 "" ""))
12499 (use (reg:SI LR_REGNO))
12505 if (MACHOPIC_INDIRECT)
12506 operands[0] = machopic_indirect_call_target (operands[0]);
12509 gcc_assert (GET_CODE (operands[0]) == MEM);
12510 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
12512 operands[0] = XEXP (operands[0], 0);
12514 if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
12516 rs6000_sibcall_aix (NULL_RTX, operands[0], operands[1], operands[2]);
12521 (define_expand "sibcall_value"
12522 [(parallel [(set (match_operand 0 "register_operand" "")
12523 (call (mem:SI (match_operand 1 "address_operand" ""))
12524 (match_operand 2 "" "")))
12525 (use (match_operand 3 "" ""))
12526 (use (reg:SI LR_REGNO))
12532 if (MACHOPIC_INDIRECT)
12533 operands[1] = machopic_indirect_call_target (operands[1]);
12536 gcc_assert (GET_CODE (operands[1]) == MEM);
12537 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
12539 operands[1] = XEXP (operands[1], 0);
12541 if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
12543 rs6000_sibcall_aix (operands[0], operands[1], operands[2], operands[3]);
12548 ;; this and similar patterns must be marked as using LR, otherwise
12549 ;; dataflow will try to delete the store into it. This is true
12550 ;; even when the actual reg to jump to is in CTR, when LR was
12551 ;; saved and restored around the PIC-setting BCL.
12552 (define_insn "*sibcall_local32"
12553 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
12554 (match_operand 1 "" "g,g"))
12555 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12556 (use (reg:SI LR_REGNO))
12558 "(INTVAL (operands[2]) & CALL_LONG) == 0"
12561 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12562 output_asm_insn (\"crxor 6,6,6\", operands);
12564 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12565 output_asm_insn (\"creqv 6,6,6\", operands);
12567 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
12569 [(set_attr "type" "branch")
12570 (set_attr "length" "4,8")])
12572 (define_insn "*sibcall_local64"
12573 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
12574 (match_operand 1 "" "g,g"))
12575 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12576 (use (reg:SI LR_REGNO))
12578 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
12581 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12582 output_asm_insn (\"crxor 6,6,6\", operands);
12584 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12585 output_asm_insn (\"creqv 6,6,6\", operands);
12587 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
12589 [(set_attr "type" "branch")
12590 (set_attr "length" "4,8")])
12592 (define_insn "*sibcall_value_local32"
12593 [(set (match_operand 0 "" "")
12594 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
12595 (match_operand 2 "" "g,g")))
12596 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12597 (use (reg:SI LR_REGNO))
12599 "(INTVAL (operands[3]) & CALL_LONG) == 0"
12602 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12603 output_asm_insn (\"crxor 6,6,6\", operands);
12605 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12606 output_asm_insn (\"creqv 6,6,6\", operands);
12608 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
12610 [(set_attr "type" "branch")
12611 (set_attr "length" "4,8")])
12613 (define_insn "*sibcall_value_local64"
12614 [(set (match_operand 0 "" "")
12615 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
12616 (match_operand 2 "" "g,g")))
12617 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12618 (use (reg:SI LR_REGNO))
12620 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
12623 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12624 output_asm_insn (\"crxor 6,6,6\", operands);
12626 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12627 output_asm_insn (\"creqv 6,6,6\", operands);
12629 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
12631 [(set_attr "type" "branch")
12632 (set_attr "length" "4,8")])
12634 (define_insn "*sibcall_nonlocal_sysv<mode>"
12635 [(call (mem:SI (match_operand:P 0 "call_operand" "s,s,c,c"))
12636 (match_operand 1 "" ""))
12637 (use (match_operand 2 "immediate_operand" "O,n,O,n"))
12638 (use (reg:SI LR_REGNO))
12640 "(DEFAULT_ABI == ABI_DARWIN
12641 || DEFAULT_ABI == ABI_V4)
12642 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12645 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12646 output_asm_insn (\"crxor 6,6,6\", operands);
12648 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12649 output_asm_insn (\"creqv 6,6,6\", operands);
12651 if (which_alternative >= 2)
12653 else if (DEFAULT_ABI == ABI_V4 && flag_pic)
12655 gcc_assert (!TARGET_SECURE_PLT);
12656 return \"b %z0@plt\";
12661 [(set_attr "type" "branch")
12662 (set_attr "length" "4,8,4,8")])
12664 (define_insn "*sibcall_value_nonlocal_sysv<mode>"
12665 [(set (match_operand 0 "" "")
12666 (call (mem:SI (match_operand:P 1 "call_operand" "s,s,c,c"))
12667 (match_operand 2 "" "")))
12668 (use (match_operand:SI 3 "immediate_operand" "O,n,O,n"))
12669 (use (reg:SI LR_REGNO))
12671 "(DEFAULT_ABI == ABI_DARWIN
12672 || DEFAULT_ABI == ABI_V4)
12673 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12676 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12677 output_asm_insn (\"crxor 6,6,6\", operands);
12679 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12680 output_asm_insn (\"creqv 6,6,6\", operands);
12682 if (which_alternative >= 2)
12684 else if (DEFAULT_ABI == ABI_V4 && flag_pic)
12686 gcc_assert (!TARGET_SECURE_PLT);
12687 return \"b %z1@plt\";
12692 [(set_attr "type" "branch")
12693 (set_attr "length" "4,8,4,8")])
12695 ;; AIX ABI sibling call patterns.
12697 (define_insn "*sibcall_aix<mode>"
12698 [(call (mem:SI (match_operand:P 0 "call_operand" "s,c"))
12699 (match_operand 1 "" "g,g"))
12701 "DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2"
12705 [(set_attr "type" "branch")
12706 (set_attr "length" "4")])
12708 (define_insn "*sibcall_value_aix<mode>"
12709 [(set (match_operand 0 "" "")
12710 (call (mem:SI (match_operand:P 1 "call_operand" "s,c"))
12711 (match_operand 2 "" "g,g")))
12713 "DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2"
12717 [(set_attr "type" "branch")
12718 (set_attr "length" "4")])
12720 (define_expand "sibcall_epilogue"
12721 [(use (const_int 0))]
12724 if (!TARGET_SCHED_PROLOG)
12725 emit_insn (gen_blockage ());
12726 rs6000_emit_epilogue (TRUE);
12730 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
12731 ;; all of memory. This blocks insns from being moved across this point.
12733 (define_insn "blockage"
12734 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCK)]
12738 (define_expand "probe_stack"
12739 [(set (match_operand 0 "memory_operand" "=m")
12740 (unspec [(const_int 0)] UNSPEC_PROBE_STACK))]
12744 emit_insn (gen_probe_stack_di (operands[0]));
12746 emit_insn (gen_probe_stack_si (operands[0]));
12750 (define_insn "probe_stack_<mode>"
12751 [(set (match_operand:P 0 "memory_operand" "=m")
12752 (unspec:P [(const_int 0)] UNSPEC_PROBE_STACK))]
12755 operands[1] = gen_rtx_REG (Pmode, 0);
12756 return "st<wd>%U0%X0 %1,%0";
12758 [(set_attr "type" "store")
12759 (set (attr "update")
12760 (if_then_else (match_operand 0 "update_address_mem")
12761 (const_string "yes")
12762 (const_string "no")))
12763 (set (attr "indexed")
12764 (if_then_else (match_operand 0 "indexed_address_mem")
12765 (const_string "yes")
12766 (const_string "no")))
12767 (set_attr "length" "4")])
12769 (define_insn "probe_stack_range<P:mode>"
12770 [(set (match_operand:P 0 "register_operand" "=r")
12771 (unspec_volatile:P [(match_operand:P 1 "register_operand" "0")
12772 (match_operand:P 2 "register_operand" "r")]
12773 UNSPECV_PROBE_STACK_RANGE))]
12775 "* return output_probe_stack_range (operands[0], operands[2]);"
12776 [(set_attr "type" "three")])
12778 ;; Compare insns are next. Note that the RS/6000 has two types of compares,
12779 ;; signed & unsigned, and one type of branch.
12781 ;; Start with the DEFINE_EXPANDs to generate the rtl for compares, scc
12782 ;; insns, and branches.
12784 (define_expand "cbranch<mode>4"
12785 [(use (match_operator 0 "rs6000_cbranch_operator"
12786 [(match_operand:GPR 1 "gpc_reg_operand" "")
12787 (match_operand:GPR 2 "reg_or_short_operand" "")]))
12788 (use (match_operand 3 ""))]
12792 /* Take care of the possibility that operands[2] might be negative but
12793 this might be a logical operation. That insn doesn't exist. */
12794 if (GET_CODE (operands[2]) == CONST_INT
12795 && INTVAL (operands[2]) < 0)
12797 operands[2] = force_reg (<MODE>mode, operands[2]);
12798 operands[0] = gen_rtx_fmt_ee (GET_CODE (operands[0]),
12799 GET_MODE (operands[0]),
12800 operands[1], operands[2]);
12803 rs6000_emit_cbranch (<MODE>mode, operands);
12807 (define_expand "cbranch<mode>4"
12808 [(use (match_operator 0 "rs6000_cbranch_operator"
12809 [(match_operand:FP 1 "gpc_reg_operand" "")
12810 (match_operand:FP 2 "gpc_reg_operand" "")]))
12811 (use (match_operand 3 ""))]
12815 rs6000_emit_cbranch (<MODE>mode, operands);
12819 (define_expand "cstore<mode>4"
12820 [(use (match_operator 1 "rs6000_cbranch_operator"
12821 [(match_operand:GPR 2 "gpc_reg_operand" "")
12822 (match_operand:GPR 3 "reg_or_short_operand" "")]))
12823 (clobber (match_operand:SI 0 "register_operand"))]
12827 /* Take care of the possibility that operands[3] might be negative but
12828 this might be a logical operation. That insn doesn't exist. */
12829 if (GET_CODE (operands[3]) == CONST_INT
12830 && INTVAL (operands[3]) < 0)
12832 operands[3] = force_reg (<MODE>mode, operands[3]);
12833 operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]),
12834 GET_MODE (operands[1]),
12835 operands[2], operands[3]);
12838 /* For SNE, we would prefer that the xor/abs sequence be used for integers.
12839 For SEQ, likewise, except that comparisons with zero should be done
12840 with an scc insns. However, due to the order that combine see the
12841 resulting insns, we must, in fact, allow SEQ for integers. Fail in
12842 the cases we don't want to handle or are best handled by portable
12844 if (GET_CODE (operands[1]) == NE)
12846 if ((GET_CODE (operands[1]) == LT || GET_CODE (operands[1]) == LE
12847 || GET_CODE (operands[1]) == GT || GET_CODE (operands[1]) == GE)
12848 && operands[3] == const0_rtx)
12850 rs6000_emit_sCOND (<MODE>mode, operands);
12854 (define_expand "cstore<mode>4"
12855 [(use (match_operator 1 "rs6000_cbranch_operator"
12856 [(match_operand:FP 2 "gpc_reg_operand" "")
12857 (match_operand:FP 3 "gpc_reg_operand" "")]))
12858 (clobber (match_operand:SI 0 "register_operand"))]
12862 rs6000_emit_sCOND (<MODE>mode, operands);
12867 (define_expand "stack_protect_set"
12868 [(match_operand 0 "memory_operand" "")
12869 (match_operand 1 "memory_operand" "")]
12872 #ifdef TARGET_THREAD_SSP_OFFSET
12873 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
12874 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
12875 operands[1] = gen_rtx_MEM (Pmode, addr);
12878 emit_insn (gen_stack_protect_setdi (operands[0], operands[1]));
12880 emit_insn (gen_stack_protect_setsi (operands[0], operands[1]));
12884 (define_insn "stack_protect_setsi"
12885 [(set (match_operand:SI 0 "memory_operand" "=m")
12886 (unspec:SI [(match_operand:SI 1 "memory_operand" "m")] UNSPEC_SP_SET))
12887 (set (match_scratch:SI 2 "=&r") (const_int 0))]
12889 "lwz%U1%X1 %2,%1\;stw%U0%X0 %2,%0\;li %2,0"
12890 [(set_attr "type" "three")
12891 (set_attr "length" "12")])
12893 (define_insn "stack_protect_setdi"
12894 [(set (match_operand:DI 0 "memory_operand" "=Y")
12895 (unspec:DI [(match_operand:DI 1 "memory_operand" "Y")] UNSPEC_SP_SET))
12896 (set (match_scratch:DI 2 "=&r") (const_int 0))]
12898 "ld%U1%X1 %2,%1\;std%U0%X0 %2,%0\;li %2,0"
12899 [(set_attr "type" "three")
12900 (set_attr "length" "12")])
12902 (define_expand "stack_protect_test"
12903 [(match_operand 0 "memory_operand" "")
12904 (match_operand 1 "memory_operand" "")
12905 (match_operand 2 "" "")]
12908 rtx test, op0, op1;
12909 #ifdef TARGET_THREAD_SSP_OFFSET
12910 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
12911 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
12912 operands[1] = gen_rtx_MEM (Pmode, addr);
12915 op1 = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, operands[1]), UNSPEC_SP_TEST);
12916 test = gen_rtx_EQ (VOIDmode, op0, op1);
12917 emit_jump_insn (gen_cbranchsi4 (test, op0, op1, operands[2]));
12921 (define_insn "stack_protect_testsi"
12922 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
12923 (unspec:CCEQ [(match_operand:SI 1 "memory_operand" "m,m")
12924 (match_operand:SI 2 "memory_operand" "m,m")]
12926 (set (match_scratch:SI 4 "=r,r") (const_int 0))
12927 (clobber (match_scratch:SI 3 "=&r,&r"))]
12930 lwz%U1%X1 %3,%1\;lwz%U2%X2 %4,%2\;xor. %3,%3,%4\;li %4,0
12931 lwz%U1%X1 %3,%1\;lwz%U2%X2 %4,%2\;cmplw %0,%3,%4\;li %3,0\;li %4,0"
12932 [(set_attr "length" "16,20")])
12934 (define_insn "stack_protect_testdi"
12935 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
12936 (unspec:CCEQ [(match_operand:DI 1 "memory_operand" "Y,Y")
12937 (match_operand:DI 2 "memory_operand" "Y,Y")]
12939 (set (match_scratch:DI 4 "=r,r") (const_int 0))
12940 (clobber (match_scratch:DI 3 "=&r,&r"))]
12943 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;xor. %3,%3,%4\;li %4,0
12944 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;cmpld %0,%3,%4\;li %3,0\;li %4,0"
12945 [(set_attr "length" "16,20")])
12948 ;; Here are the actual compare insns.
12949 (define_insn "*cmp<mode>_internal1"
12950 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
12951 (compare:CC (match_operand:GPR 1 "gpc_reg_operand" "r")
12952 (match_operand:GPR 2 "reg_or_short_operand" "rI")))]
12954 "cmp<wd>%I2 %0,%1,%2"
12955 [(set_attr "type" "cmp")])
12957 ;; If we are comparing a register for equality with a large constant,
12958 ;; we can do this with an XOR followed by a compare. But this is profitable
12959 ;; only if the large constant is only used for the comparison (and in this
12960 ;; case we already have a register to reuse as scratch).
12962 ;; For 64-bit registers, we could only do so if the constant's bit 15 is clear:
12963 ;; otherwise we'd need to XOR with FFFFFFFF????0000 which is not available.
12966 [(set (match_operand:SI 0 "register_operand")
12967 (match_operand:SI 1 "logical_const_operand" ""))
12968 (set (match_dup 0) (match_operator:SI 3 "boolean_or_operator"
12970 (match_operand:SI 2 "logical_const_operand" "")]))
12971 (set (match_operand:CC 4 "cc_reg_operand" "")
12972 (compare:CC (match_operand:SI 5 "gpc_reg_operand" "")
12975 (if_then_else (match_operator 6 "equality_operator"
12976 [(match_dup 4) (const_int 0)])
12977 (match_operand 7 "" "")
12978 (match_operand 8 "" "")))]
12979 "peep2_reg_dead_p (3, operands[0])
12980 && peep2_reg_dead_p (4, operands[4])"
12981 [(set (match_dup 0) (xor:SI (match_dup 5) (match_dup 9)))
12982 (set (match_dup 4) (compare:CC (match_dup 0) (match_dup 10)))
12983 (set (pc) (if_then_else (match_dup 6) (match_dup 7) (match_dup 8)))]
12986 /* Get the constant we are comparing against, and see what it looks like
12987 when sign-extended from 16 to 32 bits. Then see what constant we could
12988 XOR with SEXTC to get the sign-extended value. */
12989 rtx cnst = simplify_const_binary_operation (GET_CODE (operands[3]),
12991 operands[1], operands[2]);
12992 HOST_WIDE_INT c = INTVAL (cnst);
12993 HOST_WIDE_INT sextc = ((c & 0xffff) ^ 0x8000) - 0x8000;
12994 HOST_WIDE_INT xorv = c ^ sextc;
12996 operands[9] = GEN_INT (xorv);
12997 operands[10] = GEN_INT (sextc);
13000 (define_insn "*cmpsi_internal2"
13001 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
13002 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
13003 (match_operand:SI 2 "reg_or_u_short_operand" "rK")))]
13005 "cmplw%I2 %0,%1,%b2"
13006 [(set_attr "type" "cmp")])
13008 (define_insn "*cmpdi_internal2"
13009 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
13010 (compare:CCUNS (match_operand:DI 1 "gpc_reg_operand" "r")
13011 (match_operand:DI 2 "reg_or_u_short_operand" "rK")))]
13013 "cmpld%I2 %0,%1,%b2"
13014 [(set_attr "type" "cmp")])
13016 ;; The following two insns don't exist as single insns, but if we provide
13017 ;; them, we can swap an add and compare, which will enable us to overlap more
13018 ;; of the required delay between a compare and branch. We generate code for
13019 ;; them by splitting.
13022 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
13023 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
13024 (match_operand:SI 2 "short_cint_operand" "i")))
13025 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
13026 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
13029 [(set_attr "length" "8")])
13032 [(set (match_operand:CCUNS 3 "cc_reg_operand" "=y")
13033 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
13034 (match_operand:SI 2 "u_short_cint_operand" "i")))
13035 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
13036 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
13039 [(set_attr "length" "8")])
13042 [(set (match_operand:CC 3 "cc_reg_operand" "")
13043 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
13044 (match_operand:SI 2 "short_cint_operand" "")))
13045 (set (match_operand:SI 0 "gpc_reg_operand" "")
13046 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
13048 [(set (match_dup 3) (compare:CC (match_dup 1) (match_dup 2)))
13049 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
13052 [(set (match_operand:CCUNS 3 "cc_reg_operand" "")
13053 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "")
13054 (match_operand:SI 2 "u_short_cint_operand" "")))
13055 (set (match_operand:SI 0 "gpc_reg_operand" "")
13056 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
13058 [(set (match_dup 3) (compare:CCUNS (match_dup 1) (match_dup 2)))
13059 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
13061 ;; Only need to compare second words if first words equal
13062 (define_insn "*cmptf_internal1"
13063 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
13064 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "d")
13065 (match_operand:TF 2 "gpc_reg_operand" "d")))]
13066 "!TARGET_IEEEQUAD && !TARGET_XL_COMPAT
13067 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LONG_DOUBLE_128"
13068 "fcmpu %0,%1,%2\;bne %0,$+8\;fcmpu %0,%L1,%L2"
13069 [(set_attr "type" "fpcompare")
13070 (set_attr "length" "12")])
13072 (define_insn_and_split "*cmptf_internal2"
13073 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
13074 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "d")
13075 (match_operand:TF 2 "gpc_reg_operand" "d")))
13076 (clobber (match_scratch:DF 3 "=d"))
13077 (clobber (match_scratch:DF 4 "=d"))
13078 (clobber (match_scratch:DF 5 "=d"))
13079 (clobber (match_scratch:DF 6 "=d"))
13080 (clobber (match_scratch:DF 7 "=d"))
13081 (clobber (match_scratch:DF 8 "=d"))
13082 (clobber (match_scratch:DF 9 "=d"))
13083 (clobber (match_scratch:DF 10 "=d"))
13084 (clobber (match_scratch:GPR 11 "=b"))]
13085 "!TARGET_IEEEQUAD && TARGET_XL_COMPAT
13086 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LONG_DOUBLE_128"
13088 "&& reload_completed"
13089 [(set (match_dup 3) (match_dup 14))
13090 (set (match_dup 4) (match_dup 15))
13091 (set (match_dup 9) (abs:DF (match_dup 5)))
13092 (set (match_dup 0) (compare:CCFP (match_dup 9) (match_dup 3)))
13093 (set (pc) (if_then_else (ne (match_dup 0) (const_int 0))
13094 (label_ref (match_dup 12))
13096 (set (match_dup 0) (compare:CCFP (match_dup 5) (match_dup 7)))
13097 (set (pc) (label_ref (match_dup 13)))
13099 (set (match_dup 10) (minus:DF (match_dup 5) (match_dup 7)))
13100 (set (match_dup 9) (minus:DF (match_dup 6) (match_dup 8)))
13101 (set (match_dup 9) (plus:DF (match_dup 10) (match_dup 9)))
13102 (set (match_dup 0) (compare:CCFP (match_dup 9) (match_dup 4)))
13105 REAL_VALUE_TYPE rv;
13106 const int lo_word = LONG_DOUBLE_LARGE_FIRST ? GET_MODE_SIZE (DFmode) : 0;
13107 const int hi_word = LONG_DOUBLE_LARGE_FIRST ? 0 : GET_MODE_SIZE (DFmode);
13109 operands[5] = simplify_gen_subreg (DFmode, operands[1], TFmode, hi_word);
13110 operands[6] = simplify_gen_subreg (DFmode, operands[1], TFmode, lo_word);
13111 operands[7] = simplify_gen_subreg (DFmode, operands[2], TFmode, hi_word);
13112 operands[8] = simplify_gen_subreg (DFmode, operands[2], TFmode, lo_word);
13113 operands[12] = gen_label_rtx ();
13114 operands[13] = gen_label_rtx ();
13116 operands[14] = force_const_mem (DFmode,
13117 CONST_DOUBLE_FROM_REAL_VALUE (rv, DFmode));
13118 operands[15] = force_const_mem (DFmode,
13119 CONST_DOUBLE_FROM_REAL_VALUE (dconst0,
13124 tocref = create_TOC_reference (XEXP (operands[14], 0), operands[11]);
13125 operands[14] = gen_const_mem (DFmode, tocref);
13126 tocref = create_TOC_reference (XEXP (operands[15], 0), operands[11]);
13127 operands[15] = gen_const_mem (DFmode, tocref);
13128 set_mem_alias_set (operands[14], get_TOC_alias_set ());
13129 set_mem_alias_set (operands[15], get_TOC_alias_set ());
13133 ;; Now we have the scc insns. We can do some combinations because of the
13134 ;; way the machine works.
13136 ;; Note that this is probably faster if we can put an insn between the
13137 ;; mfcr and rlinm, but this is tricky. Let's leave it for now. In most
13138 ;; cases the insns below which don't use an intermediate CR field will
13139 ;; be used instead.
13141 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13142 (match_operator:SI 1 "scc_comparison_operator"
13143 [(match_operand 2 "cc_reg_operand" "y")
13146 "mfcr %0%Q2\;rlwinm %0,%0,%J1,1"
13147 [(set (attr "type")
13148 (cond [(match_test "TARGET_MFCRF")
13149 (const_string "mfcrf")
13151 (const_string "mfcr")))
13152 (set_attr "length" "8")])
13154 ;; Same as above, but get the GT bit.
13155 (define_insn "move_from_CR_gt_bit"
13156 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13157 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_GT))]
13158 "TARGET_HARD_FLOAT && !TARGET_FPRS"
13159 "mfcr %0\;rlwinm %0,%0,%D1,31,31"
13160 [(set_attr "type" "mfcr")
13161 (set_attr "length" "8")])
13163 ;; Same as above, but get the OV/ORDERED bit.
13164 (define_insn "move_from_CR_ov_bit"
13165 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13166 (unspec:SI [(match_operand:CC 1 "cc_reg_operand" "y")]
13169 "mfcr %0\;rlwinm %0,%0,%t1,1"
13170 [(set_attr "type" "mfcr")
13171 (set_attr "length" "8")])
13174 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13175 (match_operator:DI 1 "scc_comparison_operator"
13176 [(match_operand 2 "cc_reg_operand" "y")
13179 "mfcr %0%Q2\;rlwinm %0,%0,%J1,1"
13180 [(set (attr "type")
13181 (cond [(match_test "TARGET_MFCRF")
13182 (const_string "mfcrf")
13184 (const_string "mfcr")))
13185 (set_attr "length" "8")])
13188 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13189 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
13190 [(match_operand 2 "cc_reg_operand" "y,y")
13193 (set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
13194 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
13197 mfcr %3%Q2\;rlwinm. %3,%3,%J1,1
13199 [(set_attr "type" "shift")
13200 (set_attr "dot" "yes")
13201 (set_attr "length" "8,16")])
13204 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13205 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
13206 [(match_operand 2 "cc_reg_operand" "")
13209 (set (match_operand:SI 3 "gpc_reg_operand" "")
13210 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
13211 "TARGET_32BIT && reload_completed"
13212 [(set (match_dup 3)
13213 (match_op_dup 1 [(match_dup 2) (const_int 0)]))
13215 (compare:CC (match_dup 3)
13220 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13221 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
13222 [(match_operand 2 "cc_reg_operand" "y")
13224 (match_operand:SI 3 "const_int_operand" "n")))]
13228 int is_bit = ccr_bit (operands[1], 1);
13229 int put_bit = 31 - (INTVAL (operands[3]) & 31);
13232 if (is_bit >= put_bit)
13233 count = is_bit - put_bit;
13235 count = 32 - (put_bit - is_bit);
13237 operands[4] = GEN_INT (count);
13238 operands[5] = GEN_INT (put_bit);
13240 return \"mfcr %0%Q2\;rlwinm %0,%0,%4,%5,%5\";
13242 [(set (attr "type")
13243 (cond [(match_test "TARGET_MFCRF")
13244 (const_string "mfcrf")
13246 (const_string "mfcr")))
13247 (set_attr "length" "8")])
13250 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13252 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
13253 [(match_operand 2 "cc_reg_operand" "y,y")
13255 (match_operand:SI 3 "const_int_operand" "n,n"))
13257 (set (match_operand:SI 4 "gpc_reg_operand" "=r,r")
13258 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
13263 int is_bit = ccr_bit (operands[1], 1);
13264 int put_bit = 31 - (INTVAL (operands[3]) & 31);
13267 /* Force split for non-cc0 compare. */
13268 if (which_alternative == 1)
13271 if (is_bit >= put_bit)
13272 count = is_bit - put_bit;
13274 count = 32 - (put_bit - is_bit);
13276 operands[5] = GEN_INT (count);
13277 operands[6] = GEN_INT (put_bit);
13279 return \"mfcr %4%Q2\;rlwinm. %4,%4,%5,%6,%6\";
13281 [(set_attr "type" "shift")
13282 (set_attr "dot" "yes")
13283 (set_attr "length" "8,16")])
13286 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
13288 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
13289 [(match_operand 2 "cc_reg_operand" "")
13291 (match_operand:SI 3 "const_int_operand" ""))
13293 (set (match_operand:SI 4 "gpc_reg_operand" "")
13294 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
13297 [(set (match_dup 4)
13298 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
13301 (compare:CC (match_dup 4)
13305 ;; There is a 3 cycle delay between consecutive mfcr instructions
13306 ;; so it is useful to combine 2 scc instructions to use only one mfcr.
13309 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13310 (match_operator:SI 1 "scc_comparison_operator"
13311 [(match_operand 2 "cc_reg_operand" "y")
13313 (set (match_operand:SI 3 "gpc_reg_operand" "=r")
13314 (match_operator:SI 4 "scc_comparison_operator"
13315 [(match_operand 5 "cc_reg_operand" "y")
13317 "REGNO (operands[2]) != REGNO (operands[5])"
13318 "mfcr %3\;rlwinm %0,%3,%J1,1\;rlwinm %3,%3,%J4,1"
13319 [(set_attr "type" "mfcr")
13320 (set_attr "length" "12")])
13323 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13324 (match_operator:DI 1 "scc_comparison_operator"
13325 [(match_operand 2 "cc_reg_operand" "y")
13327 (set (match_operand:DI 3 "gpc_reg_operand" "=r")
13328 (match_operator:DI 4 "scc_comparison_operator"
13329 [(match_operand 5 "cc_reg_operand" "y")
13331 "TARGET_POWERPC64 && REGNO (operands[2]) != REGNO (operands[5])"
13332 "mfcr %3\;rlwinm %0,%3,%J1,1\;rlwinm %3,%3,%J4,1"
13333 [(set_attr "type" "mfcr")
13334 (set_attr "length" "12")])
13336 ;; There are some scc insns that can be done directly, without a compare.
13337 ;; These are faster because they don't involve the communications between
13338 ;; the FXU and branch units. In fact, we will be replacing all of the
13339 ;; integer scc insns here or in the portable methods in emit_store_flag.
13341 ;; Also support (neg (scc ..)) since that construct is used to replace
13342 ;; branches, (plus (scc ..) ..) since that construct is common and
13343 ;; takes no more insns than scc, and (and (neg (scc ..)) ..) in the
13344 ;; cases where it is no more expensive than (neg (scc ..)).
13346 ;; Have reload force a constant into a register for the simple insns that
13347 ;; otherwise won't accept constants. We do this because it is faster than
13348 ;; the cmp/mfcr sequence we would otherwise generate.
13350 (define_mode_attr scc_eq_op2 [(SI "rKLI")
13353 (define_insn_and_split "*eq<mode>"
13354 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
13355 (eq:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
13356 (match_operand:GPR 2 "scc_eq_operand" "<scc_eq_op2>")))]
13360 [(set (match_dup 0)
13361 (clz:GPR (match_dup 3)))
13363 (lshiftrt:GPR (match_dup 0) (match_dup 4)))]
13365 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
13367 /* Use output operand as intermediate. */
13368 operands[3] = operands[0];
13370 if (logical_operand (operands[2], <MODE>mode))
13371 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13372 gen_rtx_XOR (<MODE>mode,
13373 operands[1], operands[2])));
13375 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13376 gen_rtx_PLUS (<MODE>mode, operands[1],
13377 negate_rtx (<MODE>mode,
13381 operands[3] = operands[1];
13383 operands[4] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
13386 (define_insn_and_split "*eq<mode>_compare"
13387 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
13389 (eq:P (match_operand:P 1 "gpc_reg_operand" "=r")
13390 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))
13392 (set (match_operand:P 0 "gpc_reg_operand" "=r")
13393 (eq:P (match_dup 1) (match_dup 2)))]
13397 [(set (match_dup 0)
13398 (clz:P (match_dup 4)))
13399 (parallel [(set (match_dup 3)
13400 (compare:CC (lshiftrt:P (match_dup 0) (match_dup 5))
13403 (lshiftrt:P (match_dup 0) (match_dup 5)))])]
13405 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
13407 /* Use output operand as intermediate. */
13408 operands[4] = operands[0];
13410 if (logical_operand (operands[2], <MODE>mode))
13411 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
13412 gen_rtx_XOR (<MODE>mode,
13413 operands[1], operands[2])));
13415 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
13416 gen_rtx_PLUS (<MODE>mode, operands[1],
13417 negate_rtx (<MODE>mode,
13421 operands[4] = operands[1];
13423 operands[5] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
13426 ;; We have insns of the form shown by the first define_insn below. If
13427 ;; there is something inside the comparison operation, we must split it.
13429 [(set (match_operand:SI 0 "gpc_reg_operand" "")
13430 (plus:SI (match_operator 1 "comparison_operator"
13431 [(match_operand:SI 2 "" "")
13432 (match_operand:SI 3
13433 "reg_or_cint_operand" "")])
13434 (match_operand:SI 4 "gpc_reg_operand" "")))
13435 (clobber (match_operand:SI 5 "register_operand" ""))]
13436 "! gpc_reg_operand (operands[2], SImode)"
13437 [(set (match_dup 5) (match_dup 2))
13438 (set (match_dup 0) (plus:SI (match_op_dup 1 [(match_dup 5) (match_dup 3)])
13441 (define_insn "*plus_eqsi"
13442 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r")
13443 (plus:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
13444 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I"))
13445 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r")))]
13448 xor %0,%1,%2\;subfic %0,%0,0\;addze %0,%3
13449 subfic %0,%1,0\;addze %0,%3
13450 xori %0,%1,%b2\;subfic %0,%0,0\;addze %0,%3
13451 xoris %0,%1,%u2\;subfic %0,%0,0\;addze %0,%3
13452 subfic %0,%1,%2\;subfic %0,%0,0\;addze %0,%3"
13453 [(set_attr "type" "three,two,three,three,three")
13454 (set_attr "length" "12,8,12,12,12")])
13456 (define_insn "*compare_plus_eqsi"
13457 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
13460 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
13461 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
13462 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
13464 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r"))]
13465 "TARGET_32BIT && optimize_size"
13467 xor %4,%1,%2\;subfic %4,%4,0\;addze. %4,%3
13468 subfic %4,%1,0\;addze. %4,%3
13469 xori %4,%1,%b2\;subfic %4,%4,0\;addze. %4,%3
13470 xoris %4,%1,%u2\;subfic %4,%4,0\;addze. %4,%3
13471 subfic %4,%1,%2\;subfic %4,%4,0\;addze. %4,%3
13477 [(set_attr "type" "compare")
13478 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
13481 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13484 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
13485 (match_operand:SI 2 "scc_eq_operand" ""))
13486 (match_operand:SI 3 "gpc_reg_operand" ""))
13488 (clobber (match_scratch:SI 4 ""))]
13489 "TARGET_32BIT && optimize_size && reload_completed"
13490 [(set (match_dup 4)
13491 (plus:SI (eq:SI (match_dup 1)
13495 (compare:CC (match_dup 4)
13499 (define_insn "*plus_eqsi_compare"
13500 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
13503 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
13504 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
13505 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
13507 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r")
13508 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13509 "TARGET_32BIT && optimize_size"
13511 xor %0,%1,%2\;subfic %0,%0,0\;addze. %0,%3
13512 subfic %0,%1,0\;addze. %0,%3
13513 xori %0,%1,%b2\;subfic %0,%0,0\;addze. %0,%3
13514 xoris %0,%1,%u2\;subfic %0,%0,0\;addze. %0,%3
13515 subfic %0,%1,%2\;subfic %0,%0,0\;addze. %0,%3
13521 [(set_attr "type" "compare")
13522 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
13525 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13528 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
13529 (match_operand:SI 2 "scc_eq_operand" ""))
13530 (match_operand:SI 3 "gpc_reg_operand" ""))
13532 (set (match_operand:SI 0 "gpc_reg_operand" "")
13533 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13534 "TARGET_32BIT && optimize_size && reload_completed"
13535 [(set (match_dup 0)
13536 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13538 (compare:CC (match_dup 0)
13542 (define_insn "*neg_eq0<mode>"
13543 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13544 (neg:P (eq:P (match_operand:P 1 "gpc_reg_operand" "r")
13547 "addic %0,%1,-1\;subfe %0,%0,%0"
13548 [(set_attr "type" "two")
13549 (set_attr "length" "8")])
13551 (define_insn_and_split "*neg_eq<mode>"
13552 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13553 (neg:P (eq:P (match_operand:P 1 "gpc_reg_operand" "%r")
13554 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))))]
13558 [(set (match_dup 0) (neg:P (eq:P (match_dup 3) (const_int 0))))]
13560 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
13562 /* Use output operand as intermediate. */
13563 operands[3] = operands[0];
13565 if (logical_operand (operands[2], <MODE>mode))
13566 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13567 gen_rtx_XOR (<MODE>mode,
13568 operands[1], operands[2])));
13570 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13571 gen_rtx_PLUS (<MODE>mode, operands[1],
13572 negate_rtx (<MODE>mode,
13576 operands[3] = operands[1];
13579 (define_insn "*ne0_<mode>"
13580 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13581 (ne:P (match_operand:P 1 "gpc_reg_operand" "r")
13583 (clobber (match_scratch:P 2 "=&r"))]
13584 "!(TARGET_32BIT && TARGET_ISEL)"
13585 "addic %2,%1,-1\;subfe %0,%2,%1"
13586 [(set_attr "type" "two")
13587 (set_attr "length" "8")])
13589 (define_insn "*plus_ne0_<mode>"
13590 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13591 (plus:P (ne:P (match_operand:P 1 "gpc_reg_operand" "r")
13593 (match_operand:P 2 "gpc_reg_operand" "r")))
13594 (clobber (match_scratch:P 3 "=&r"))]
13596 "addic %3,%1,-1\;addze %0,%2"
13597 [(set_attr "type" "two")
13598 (set_attr "length" "8")])
13600 (define_insn "*compare_plus_ne0_<mode>"
13601 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13602 (compare:CC (plus:P (ne:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13604 (match_operand:P 2 "gpc_reg_operand" "r,r"))
13606 (clobber (match_scratch:P 3 "=&r,&r"))
13607 (clobber (match_scratch:P 4 "=X,&r"))]
13610 addic %3,%1,-1\;addze. %3,%2
13612 [(set_attr "type" "compare")
13613 (set_attr "length" "8,12")])
13616 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
13617 (compare:CC (ne:P (match_operand:SI 1 "gpc_reg_operand" "")
13619 (neg:P (match_operand:P 2 "gpc_reg_operand" ""))))
13620 (clobber (match_scratch:P 3 ""))
13621 (clobber (match_scratch:P 4 ""))]
13623 [(parallel [(set (match_dup 3)
13624 (plus:P (ne:P (match_dup 1)
13627 (clobber (match_dup 4))])
13629 (compare:CC (match_dup 3)
13634 (define_insn "*compare_plus_ne0_<mode>_1"
13635 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
13636 (compare:CCEQ (ne:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13638 (neg:P (match_operand:P 2 "gpc_reg_operand" "r,r"))))
13639 (clobber (match_scratch:P 3 "=&r,&r"))
13640 (clobber (match_scratch:P 4 "=X,&r"))]
13643 addic %3,%1,-1\;addze. %3,%2
13645 [(set_attr "type" "compare")
13646 (set_attr "length" "8,12")])
13649 [(set (match_operand:CCEQ 0 "cc_reg_not_micro_cr0_operand" "")
13650 (compare:CCEQ (ne:P (match_operand:SI 1 "gpc_reg_operand" "")
13652 (neg:P (match_operand:P 2 "gpc_reg_operand" ""))))
13653 (clobber (match_scratch:P 3 ""))
13654 (clobber (match_scratch:P 4 ""))]
13656 [(parallel [(set (match_dup 3)
13657 (plus:P (ne:P (match_dup 1)
13660 (clobber (match_dup 4))])
13662 (compare:CC (match_dup 3)
13666 (define_insn "*plus_ne0_<mode>_compare"
13667 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13669 (plus:P (ne:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13671 (match_operand:P 2 "gpc_reg_operand" "r,r"))
13673 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13674 (plus:P (ne:P (match_dup 1)
13677 (clobber (match_scratch:P 3 "=&r,&r"))]
13680 addic %3,%1,-1\;addze. %0,%2
13682 [(set_attr "type" "compare")
13683 (set_attr "length" "8,12")])
13686 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
13688 (plus:P (ne:P (match_operand:P 1 "gpc_reg_operand" "")
13690 (match_operand:P 2 "gpc_reg_operand" ""))
13692 (set (match_operand:P 0 "gpc_reg_operand" "")
13693 (plus:P (ne:P (match_dup 1)
13696 (clobber (match_scratch:P 3 ""))]
13698 [(parallel [(set (match_dup 0)
13699 (plus:P (ne:P (match_dup 1)
13702 (clobber (match_dup 3))])
13704 (compare:CC (match_dup 0)
13708 (define_insn "*leu<mode>"
13709 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13710 (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
13711 (match_operand:P 2 "reg_or_short_operand" "rI")))]
13713 "subf%I2c %0,%1,%2\;li %0,0\;adde %0,%0,%0"
13714 [(set_attr "type" "three")
13715 (set_attr "length" "12")])
13717 (define_insn "*leu<mode>_compare"
13718 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13720 (leu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13721 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
13723 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13724 (leu:P (match_dup 1) (match_dup 2)))]
13727 subf%I2c %0,%1,%2\;li %0,0\;adde. %0,%0,%0
13729 [(set_attr "type" "compare")
13730 (set_attr "length" "12,16")])
13733 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13735 (leu:P (match_operand:P 1 "gpc_reg_operand" "")
13736 (match_operand:P 2 "reg_or_short_operand" ""))
13738 (set (match_operand:P 0 "gpc_reg_operand" "")
13739 (leu:P (match_dup 1) (match_dup 2)))]
13741 [(set (match_dup 0)
13742 (leu:P (match_dup 1) (match_dup 2)))
13744 (compare:CC (match_dup 0)
13748 (define_insn "*plus_leu<mode>"
13749 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
13750 (plus:P (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
13751 (match_operand:P 2 "reg_or_short_operand" "rI"))
13752 (match_operand:P 3 "gpc_reg_operand" "r")))]
13754 "subf%I2c %0,%1,%2\;addze %0,%3"
13755 [(set_attr "type" "two")
13756 (set_attr "length" "8")])
13759 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13761 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13762 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13763 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13765 (clobber (match_scratch:SI 4 "=&r,&r"))]
13768 subf%I2c %4,%1,%2\;addze. %4,%3
13770 [(set_attr "type" "compare")
13771 (set_attr "length" "8,12")])
13774 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13776 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13777 (match_operand:SI 2 "reg_or_short_operand" ""))
13778 (match_operand:SI 3 "gpc_reg_operand" ""))
13780 (clobber (match_scratch:SI 4 ""))]
13781 "TARGET_32BIT && reload_completed"
13782 [(set (match_dup 4)
13783 (plus:SI (leu:SI (match_dup 1) (match_dup 2))
13786 (compare:CC (match_dup 4)
13791 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13793 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13794 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13795 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13797 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13798 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13801 subf%I2c %0,%1,%2\;addze. %0,%3
13803 [(set_attr "type" "compare")
13804 (set_attr "length" "8,12")])
13807 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13809 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13810 (match_operand:SI 2 "reg_or_short_operand" ""))
13811 (match_operand:SI 3 "gpc_reg_operand" ""))
13813 (set (match_operand:SI 0 "gpc_reg_operand" "")
13814 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13815 "TARGET_32BIT && reload_completed"
13816 [(set (match_dup 0)
13817 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13819 (compare:CC (match_dup 0)
13823 (define_insn "*neg_leu<mode>"
13824 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13825 (neg:P (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
13826 (match_operand:P 2 "reg_or_short_operand" "rI"))))]
13828 "subf%I2c %0,%1,%2\;subfe %0,%0,%0\;nand %0,%0,%0"
13829 [(set_attr "type" "three")
13830 (set_attr "length" "12")])
13832 (define_insn "*and_neg_leu<mode>"
13833 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
13835 (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
13836 (match_operand:P 2 "reg_or_short_operand" "rI")))
13837 (match_operand:P 3 "gpc_reg_operand" "r")))]
13839 "subf%I2c %0,%1,%2\;subfe %0,%0,%0\;andc %0,%3,%0"
13840 [(set_attr "type" "three")
13841 (set_attr "length" "12")])
13844 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13847 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13848 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
13849 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13851 (clobber (match_scratch:SI 4 "=&r,&r"))]
13854 subf%I2c %4,%1,%2\;subfe %4,%4,%4\;andc. %4,%3,%4
13856 [(set_attr "type" "compare")
13857 (set_attr "length" "12,16")])
13860 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13863 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13864 (match_operand:SI 2 "reg_or_short_operand" "")))
13865 (match_operand:SI 3 "gpc_reg_operand" ""))
13867 (clobber (match_scratch:SI 4 ""))]
13868 "TARGET_32BIT && reload_completed"
13869 [(set (match_dup 4)
13870 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
13873 (compare:CC (match_dup 4)
13878 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13881 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13882 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
13883 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13885 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13886 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13889 subf%I2c %0,%1,%2\;subfe %0,%0,%0\;andc. %0,%3,%0
13891 [(set_attr "type" "compare")
13892 (set_attr "length" "12,16")])
13895 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13898 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13899 (match_operand:SI 2 "reg_or_short_operand" "")))
13900 (match_operand:SI 3 "gpc_reg_operand" ""))
13902 (set (match_operand:SI 0 "gpc_reg_operand" "")
13903 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13904 "TARGET_32BIT && reload_completed"
13905 [(set (match_dup 0)
13906 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
13909 (compare:CC (match_dup 0)
13913 (define_insn_and_split "*ltu<mode>"
13914 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13915 (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13916 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))]
13920 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
13921 (set (match_dup 0) (neg:P (match_dup 0)))]
13924 (define_insn_and_split "*ltu<mode>_compare"
13925 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
13927 (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
13928 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
13930 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
13931 (ltu:P (match_dup 1) (match_dup 2)))]
13935 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
13936 (parallel [(set (match_dup 3)
13937 (compare:CC (neg:P (match_dup 0)) (const_int 0)))
13938 (set (match_dup 0) (neg:P (match_dup 0)))])]
13941 (define_insn_and_split "*plus_ltu<mode>"
13942 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,r")
13943 (plus:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13944 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))
13945 (match_operand:P 3 "reg_or_short_operand" "rI,rI")))]
13948 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13949 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
13950 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))]
13953 (define_insn_and_split "*plus_ltu<mode>_compare"
13954 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13956 (plus:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
13957 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
13958 (match_operand:P 3 "gpc_reg_operand" "r,r,r,r"))
13960 (set (match_operand:P 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13961 (plus:P (ltu:P (match_dup 1) (match_dup 2)) (match_dup 3)))]
13964 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13965 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
13966 (parallel [(set (match_dup 4)
13967 (compare:CC (minus:P (match_dup 3) (match_dup 0))
13969 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))])]
13972 (define_insn "*neg_ltu<mode>"
13973 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13974 (neg:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13975 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))))]
13978 subfc %0,%2,%1\;subfe %0,%0,%0
13979 addic %0,%1,%n2\;subfe %0,%0,%0"
13980 [(set_attr "type" "two")
13981 (set_attr "length" "8")])
13983 (define_insn "*geu<mode>"
13984 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13985 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13986 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))]
13989 subfc %0,%2,%1\;li %0,0\;adde %0,%0,%0
13990 addic %0,%1,%n2\;li %0,0\;adde %0,%0,%0"
13991 [(set_attr "type" "three")
13992 (set_attr "length" "12")])
13994 (define_insn "*geu<mode>_compare"
13995 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
13997 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
13998 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
14000 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
14001 (geu:P (match_dup 1) (match_dup 2)))]
14004 subfc %0,%2,%1\;li %0,0\;adde. %0,%0,%0
14005 addic %0,%1,%n2\;li %0,0\;adde. %0,%0,%0
14008 [(set_attr "type" "compare")
14009 (set_attr "length" "12,12,16,16")])
14012 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
14014 (geu:P (match_operand:P 1 "gpc_reg_operand" "")
14015 (match_operand:P 2 "reg_or_neg_short_operand" ""))
14017 (set (match_operand:P 0 "gpc_reg_operand" "")
14018 (geu:P (match_dup 1) (match_dup 2)))]
14020 [(set (match_dup 0)
14021 (geu:P (match_dup 1) (match_dup 2)))
14023 (compare:CC (match_dup 0)
14027 (define_insn "*plus_geu<mode>"
14028 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,&r")
14029 (plus:P (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14030 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))
14031 (match_operand:P 3 "gpc_reg_operand" "r,r")))]
14034 subfc %0,%2,%1\;addze %0,%3
14035 addic %0,%1,%n2\;addze %0,%3"
14036 [(set_attr "type" "two")
14037 (set_attr "length" "8")])
14040 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
14042 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14043 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
14044 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
14046 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
14049 subfc %4,%2,%1\;addze. %4,%3
14050 addic %4,%1,%n2\;addze. %4,%3
14053 [(set_attr "type" "compare")
14054 (set_attr "length" "8,8,12,12")])
14057 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14059 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14060 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
14061 (match_operand:SI 3 "gpc_reg_operand" ""))
14063 (clobber (match_scratch:SI 4 ""))]
14064 "TARGET_32BIT && reload_completed"
14065 [(set (match_dup 4)
14066 (plus:SI (geu:SI (match_dup 1) (match_dup 2))
14069 (compare:CC (match_dup 4)
14074 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
14076 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14077 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
14078 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
14080 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
14081 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14084 subfc %0,%2,%1\;addze. %0,%3
14085 addic %0,%1,%n2\;addze. %0,%3
14088 [(set_attr "type" "compare")
14089 (set_attr "length" "8,8,12,12")])
14092 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14094 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14095 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
14096 (match_operand:SI 3 "gpc_reg_operand" ""))
14098 (set (match_operand:SI 0 "gpc_reg_operand" "")
14099 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14100 "TARGET_32BIT && reload_completed"
14101 [(set (match_dup 0)
14102 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
14104 (compare:CC (match_dup 0)
14108 (define_insn "*neg_geu<mode>"
14109 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
14110 (neg:P (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14111 (match_operand:P 2 "reg_or_short_operand" "r,I"))))]
14114 subfc %0,%2,%1\;subfe %0,%0,%0\;nand %0,%0,%0
14115 subfic %0,%1,-1\;add%I2c %0,%0,%2\;subfe %0,%0,%0"
14116 [(set_attr "type" "three")
14117 (set_attr "length" "12")])
14119 (define_insn "*and_neg_geu<mode>"
14120 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,&r")
14122 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14123 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))
14124 (match_operand:P 3 "gpc_reg_operand" "r,r")))]
14127 subfc %0,%2,%1\;subfe %0,%0,%0\;andc %0,%3,%0
14128 addic %0,%1,%n2\;subfe %0,%0,%0\;andc %0,%3,%0"
14129 [(set_attr "type" "three")
14130 (set_attr "length" "12")])
14133 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
14136 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14137 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
14138 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
14140 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
14143 subfc %4,%2,%1\;subfe %4,%4,%4\;andc. %4,%3,%4
14144 addic %4,%1,%n2\;subfe %4,%4,%4\;andc. %4,%3,%4
14147 [(set_attr "type" "compare")
14148 (set_attr "length" "12,12,16,16")])
14151 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14154 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14155 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
14156 (match_operand:SI 3 "gpc_reg_operand" ""))
14158 (clobber (match_scratch:SI 4 ""))]
14159 "TARGET_32BIT && reload_completed"
14160 [(set (match_dup 4)
14161 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2)))
14164 (compare:CC (match_dup 4)
14169 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
14172 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14173 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
14174 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
14176 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
14177 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
14180 subfc %0,%2,%1\;subfe %0,%0,%0\;andc. %0,%3,%0
14181 addic %0,%1,%n2\;subfe %0,%0,%0\;andc. %0,%3,%0
14184 [(set_attr "type" "compare")
14185 (set_attr "length" "12,12,16,16")])
14188 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14191 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14192 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
14193 (match_operand:SI 3 "gpc_reg_operand" ""))
14195 (set (match_operand:SI 0 "gpc_reg_operand" "")
14196 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
14197 "TARGET_32BIT && reload_completed"
14198 [(set (match_dup 0)
14199 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
14201 (compare:CC (match_dup 0)
14205 (define_insn "*plus_gt0<mode>"
14206 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
14207 (plus:P (gt:P (match_operand:P 1 "gpc_reg_operand" "r")
14209 (match_operand:P 2 "gpc_reg_operand" "r")))]
14211 "addc %0,%1,%1\;subfe %0,%1,%0\;addze %0,%2"
14212 [(set_attr "type" "three")
14213 (set_attr "length" "12")])
14216 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
14218 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14220 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
14222 (clobber (match_scratch:SI 3 "=&r,&r"))]
14225 addc %3,%1,%1\;subfe %3,%1,%3\;addze. %3,%2
14227 [(set_attr "type" "compare")
14228 (set_attr "length" "12,16")])
14231 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14233 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14235 (match_operand:SI 2 "gpc_reg_operand" ""))
14237 (clobber (match_scratch:SI 3 ""))]
14238 "TARGET_32BIT && reload_completed"
14239 [(set (match_dup 3)
14240 (plus:SI (gt:SI (match_dup 1) (const_int 0))
14243 (compare:CC (match_dup 3)
14248 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
14250 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
14252 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
14254 (clobber (match_scratch:DI 3 "=&r,&r"))]
14257 addc %3,%1,%1\;subfe %3,%1,%3\;addze. %3,%2
14259 [(set_attr "type" "compare")
14260 (set_attr "length" "12,16")])
14263 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
14265 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
14267 (match_operand:DI 2 "gpc_reg_operand" ""))
14269 (clobber (match_scratch:DI 3 ""))]
14270 "TARGET_64BIT && reload_completed"
14271 [(set (match_dup 3)
14272 (plus:DI (gt:DI (match_dup 1) (const_int 0))
14275 (compare:CC (match_dup 3)
14280 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
14282 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14284 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
14286 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
14287 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
14290 addc %0,%1,%1\;subfe %0,%1,%0\;addze. %0,%2
14292 [(set_attr "type" "compare")
14293 (set_attr "length" "12,16")])
14296 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
14298 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14300 (match_operand:SI 2 "gpc_reg_operand" ""))
14302 (set (match_operand:SI 0 "gpc_reg_operand" "")
14303 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
14304 "TARGET_32BIT && reload_completed"
14305 [(set (match_dup 0)
14306 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))
14308 (compare:CC (match_dup 0)
14313 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
14315 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
14317 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
14319 (set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
14320 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
14323 addc %0,%1,%1\;subfe %0,%1,%0\;addze. %0,%2
14325 [(set_attr "type" "compare")
14326 (set_attr "length" "12,16")])
14329 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
14331 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
14333 (match_operand:DI 2 "gpc_reg_operand" ""))
14335 (set (match_operand:DI 0 "gpc_reg_operand" "")
14336 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
14337 "TARGET_64BIT && reload_completed"
14338 [(set (match_dup 0)
14339 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))
14341 (compare:CC (match_dup 0)
14345 (define_insn_and_split "*gtu<mode>"
14346 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
14347 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
14348 (match_operand:P 2 "reg_or_short_operand" "rI")))]
14352 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
14353 (set (match_dup 0) (neg:P (match_dup 0)))]
14356 (define_insn_and_split "*gtu<mode>_compare"
14357 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
14359 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14360 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
14362 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
14363 (gtu:P (match_dup 1) (match_dup 2)))]
14367 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
14368 (parallel [(set (match_dup 3)
14369 (compare:CC (neg:P (match_dup 0)) (const_int 0)))
14370 (set (match_dup 0) (neg:P (match_dup 0)))])]
14373 (define_insn_and_split "*plus_gtu<mode>"
14374 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
14375 (plus:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
14376 (match_operand:P 2 "reg_or_short_operand" "rI"))
14377 (match_operand:P 3 "reg_or_short_operand" "rI")))]
14380 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
14381 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
14382 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))]
14385 (define_insn_and_split "*plus_gtu<mode>_compare"
14386 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
14388 (plus:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
14389 (match_operand:P 2 "reg_or_short_operand" "I,r,I,r"))
14390 (match_operand:P 3 "gpc_reg_operand" "r,r,r,r"))
14392 (set (match_operand:P 0 "gpc_reg_operand" "=&r,&r,&r,&r")
14393 (plus:P (gtu:P (match_dup 1) (match_dup 2)) (match_dup 3)))]
14396 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
14397 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
14398 (parallel [(set (match_dup 4)
14399 (compare:CC (minus:P (match_dup 3) (match_dup 0))
14401 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))])]
14404 (define_insn "*neg_gtu<mode>"
14405 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
14406 (neg:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
14407 (match_operand:P 2 "reg_or_short_operand" "rI"))))]
14409 "subf%I2c %0,%1,%2\;subfe %0,%0,%0"
14410 [(set_attr "type" "two")
14411 (set_attr "length" "8")])
14414 ;; Define both directions of branch and return. If we need a reload
14415 ;; register, we'd rather use CR0 since it is much easier to copy a
14416 ;; register CC value to there.
14420 (if_then_else (match_operator 1 "branch_comparison_operator"
14422 "cc_reg_operand" "y")
14424 (label_ref (match_operand 0 "" ""))
14429 return output_cbranch (operands[1], \"%l0\", 0, insn);
14431 [(set_attr "type" "branch")])
14435 (if_then_else (match_operator 0 "branch_comparison_operator"
14437 "cc_reg_operand" "y")
14444 return output_cbranch (operands[0], NULL, 0, insn);
14446 [(set_attr "type" "jmpreg")
14447 (set_attr "length" "4")])
14451 (if_then_else (match_operator 1 "branch_comparison_operator"
14453 "cc_reg_operand" "y")
14456 (label_ref (match_operand 0 "" ""))))]
14460 return output_cbranch (operands[1], \"%l0\", 1, insn);
14462 [(set_attr "type" "branch")])
14466 (if_then_else (match_operator 0 "branch_comparison_operator"
14468 "cc_reg_operand" "y")
14475 return output_cbranch (operands[0], NULL, 1, insn);
14477 [(set_attr "type" "jmpreg")
14478 (set_attr "length" "4")])
14480 ;; Logic on condition register values.
14482 ; This pattern matches things like
14483 ; (set (reg:CCEQ 68) (compare:CCEQ (ior:SI (gt:SI (reg:CCFP 68) (const_int 0))
14484 ; (eq:SI (reg:CCFP 68) (const_int 0)))
14486 ; which are generated by the branch logic.
14487 ; Prefer destructive operations where BT = BB (for crXX BT,BA,BB)
14489 (define_insn "*cceq_ior_compare"
14490 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
14491 (compare:CCEQ (match_operator:SI 1 "boolean_operator"
14492 [(match_operator:SI 2
14493 "branch_positive_comparison_operator"
14495 "cc_reg_operand" "y,y")
14497 (match_operator:SI 4
14498 "branch_positive_comparison_operator"
14500 "cc_reg_operand" "0,y")
14504 "cr%q1 %E0,%j2,%j4"
14505 [(set_attr "type" "cr_logical,delayed_cr")])
14507 ; Why is the constant -1 here, but 1 in the previous pattern?
14508 ; Because ~1 has all but the low bit set.
14510 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
14511 (compare:CCEQ (match_operator:SI 1 "boolean_or_operator"
14512 [(not:SI (match_operator:SI 2
14513 "branch_positive_comparison_operator"
14515 "cc_reg_operand" "y,y")
14517 (match_operator:SI 4
14518 "branch_positive_comparison_operator"
14520 "cc_reg_operand" "0,y")
14524 "cr%q1 %E0,%j2,%j4"
14525 [(set_attr "type" "cr_logical,delayed_cr")])
14527 (define_insn "*cceq_rev_compare"
14528 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
14529 (compare:CCEQ (match_operator:SI 1
14530 "branch_positive_comparison_operator"
14532 "cc_reg_operand" "0,y")
14537 [(set_attr "type" "cr_logical,delayed_cr")])
14539 ;; If we are comparing the result of two comparisons, this can be done
14540 ;; using creqv or crxor.
14542 (define_insn_and_split ""
14543 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
14544 (compare:CCEQ (match_operator 1 "branch_comparison_operator"
14545 [(match_operand 2 "cc_reg_operand" "y")
14547 (match_operator 3 "branch_comparison_operator"
14548 [(match_operand 4 "cc_reg_operand" "y")
14553 [(set (match_dup 0) (compare:CCEQ (xor:SI (match_dup 1) (match_dup 3))
14557 int positive_1, positive_2;
14559 positive_1 = branch_positive_comparison_operator (operands[1],
14560 GET_MODE (operands[1]));
14561 positive_2 = branch_positive_comparison_operator (operands[3],
14562 GET_MODE (operands[3]));
14565 operands[1] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[2]),
14566 GET_CODE (operands[1])),
14568 operands[2], const0_rtx);
14569 else if (GET_MODE (operands[1]) != SImode)
14570 operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]), SImode,
14571 operands[2], const0_rtx);
14574 operands[3] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[4]),
14575 GET_CODE (operands[3])),
14577 operands[4], const0_rtx);
14578 else if (GET_MODE (operands[3]) != SImode)
14579 operands[3] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
14580 operands[4], const0_rtx);
14582 if (positive_1 == positive_2)
14584 operands[1] = gen_rtx_NOT (SImode, operands[1]);
14585 operands[5] = constm1_rtx;
14589 operands[5] = const1_rtx;
14593 ;; Unconditional branch and return.
14595 (define_insn "jump"
14597 (label_ref (match_operand 0 "" "")))]
14600 [(set_attr "type" "branch")])
14602 (define_insn "<return_str>return"
14606 [(set_attr "type" "jmpreg")])
14608 (define_expand "indirect_jump"
14609 [(set (pc) (match_operand 0 "register_operand" ""))])
14611 (define_insn "*indirect_jump<mode>"
14612 [(set (pc) (match_operand:P 0 "register_operand" "c,*l"))]
14617 [(set_attr "type" "jmpreg")])
14619 ;; Table jump for switch statements:
14620 (define_expand "tablejump"
14621 [(use (match_operand 0 "" ""))
14622 (use (label_ref (match_operand 1 "" "")))]
14627 emit_jump_insn (gen_tablejumpsi (operands[0], operands[1]));
14629 emit_jump_insn (gen_tablejumpdi (operands[0], operands[1]));
14633 (define_expand "tablejumpsi"
14634 [(set (match_dup 3)
14635 (plus:SI (match_operand:SI 0 "" "")
14637 (parallel [(set (pc) (match_dup 3))
14638 (use (label_ref (match_operand 1 "" "")))])]
14641 { operands[0] = force_reg (SImode, operands[0]);
14642 operands[2] = force_reg (SImode, gen_rtx_LABEL_REF (SImode, operands[1]));
14643 operands[3] = gen_reg_rtx (SImode);
14646 (define_expand "tablejumpdi"
14647 [(set (match_dup 4)
14648 (sign_extend:DI (match_operand:SI 0 "lwa_operand" "")))
14650 (plus:DI (match_dup 4)
14652 (parallel [(set (pc) (match_dup 3))
14653 (use (label_ref (match_operand 1 "" "")))])]
14656 { operands[2] = force_reg (DImode, gen_rtx_LABEL_REF (DImode, operands[1]));
14657 operands[3] = gen_reg_rtx (DImode);
14658 operands[4] = gen_reg_rtx (DImode);
14661 (define_insn "*tablejump<mode>_internal1"
14663 (match_operand:P 0 "register_operand" "c,*l"))
14664 (use (label_ref (match_operand 1 "" "")))]
14669 [(set_attr "type" "jmpreg")])
14676 (define_insn "group_ending_nop"
14677 [(unspec [(const_int 0)] UNSPEC_GRP_END_NOP)]
14681 if (rs6000_cpu_attr == CPU_POWER6)
14682 return \"ori 1,1,0\";
14683 return \"ori 2,2,0\";
14686 ;; Define the subtract-one-and-jump insns, starting with the template
14687 ;; so loop.c knows what to generate.
14689 (define_expand "doloop_end"
14690 [(use (match_operand 0 "" "")) ; loop pseudo
14691 (use (match_operand 1 "" ""))] ; label
14697 if (GET_MODE (operands[0]) != DImode)
14699 emit_jump_insn (gen_ctrdi (operands[0], operands[1]));
14703 if (GET_MODE (operands[0]) != SImode)
14705 emit_jump_insn (gen_ctrsi (operands[0], operands[1]));
14710 (define_expand "ctr<mode>"
14711 [(parallel [(set (pc)
14712 (if_then_else (ne (match_operand:P 0 "register_operand" "")
14714 (label_ref (match_operand 1 "" ""))
14717 (plus:P (match_dup 0)
14719 (clobber (match_scratch:CC 2 ""))
14720 (clobber (match_scratch:P 3 ""))])]
14724 ;; We need to be able to do this for any operand, including MEM, or we
14725 ;; will cause reload to blow up since we don't allow output reloads on
14727 ;; For the length attribute to be calculated correctly, the
14728 ;; label MUST be operand 0.
14730 (define_insn "*ctr<mode>_internal1"
14732 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
14734 (label_ref (match_operand 0 "" ""))
14736 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*c*l")
14737 (plus:P (match_dup 1)
14739 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14740 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
14744 if (which_alternative != 0)
14746 else if (get_attr_length (insn) == 4)
14747 return \"bdnz %l0\";
14749 return \"bdz $+8\;b %l0\";
14751 [(set_attr "type" "branch")
14752 (set_attr "length" "*,12,16,16")])
14754 (define_insn "*ctr<mode>_internal2"
14756 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
14759 (label_ref (match_operand 0 "" ""))))
14760 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*c*l")
14761 (plus:P (match_dup 1)
14763 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14764 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
14768 if (which_alternative != 0)
14770 else if (get_attr_length (insn) == 4)
14771 return \"bdz %l0\";
14773 return \"bdnz $+8\;b %l0\";
14775 [(set_attr "type" "branch")
14776 (set_attr "length" "*,12,16,16")])
14778 ;; Similar but use EQ
14780 (define_insn "*ctr<mode>_internal5"
14782 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
14784 (label_ref (match_operand 0 "" ""))
14786 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*c*l")
14787 (plus:P (match_dup 1)
14789 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14790 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
14794 if (which_alternative != 0)
14796 else if (get_attr_length (insn) == 4)
14797 return \"bdz %l0\";
14799 return \"bdnz $+8\;b %l0\";
14801 [(set_attr "type" "branch")
14802 (set_attr "length" "*,12,16,16")])
14804 (define_insn "*ctr<mode>_internal6"
14806 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
14809 (label_ref (match_operand 0 "" ""))))
14810 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*c*l")
14811 (plus:P (match_dup 1)
14813 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14814 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
14818 if (which_alternative != 0)
14820 else if (get_attr_length (insn) == 4)
14821 return \"bdnz %l0\";
14823 return \"bdz $+8\;b %l0\";
14825 [(set_attr "type" "branch")
14826 (set_attr "length" "*,12,16,16")])
14828 ;; Now the splitters if we could not allocate the CTR register
14832 (if_then_else (match_operator 2 "comparison_operator"
14833 [(match_operand:P 1 "gpc_reg_operand" "")
14835 (match_operand 5 "" "")
14836 (match_operand 6 "" "")))
14837 (set (match_operand:P 0 "gpc_reg_operand" "")
14838 (plus:P (match_dup 1) (const_int -1)))
14839 (clobber (match_scratch:CC 3 ""))
14840 (clobber (match_scratch:P 4 ""))]
14842 [(parallel [(set (match_dup 3)
14843 (compare:CC (plus:P (match_dup 1)
14847 (plus:P (match_dup 1)
14849 (set (pc) (if_then_else (match_dup 7)
14853 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
14854 operands[3], const0_rtx); }")
14858 (if_then_else (match_operator 2 "comparison_operator"
14859 [(match_operand:P 1 "gpc_reg_operand" "")
14861 (match_operand 5 "" "")
14862 (match_operand 6 "" "")))
14863 (set (match_operand:P 0 "nonimmediate_operand" "")
14864 (plus:P (match_dup 1) (const_int -1)))
14865 (clobber (match_scratch:CC 3 ""))
14866 (clobber (match_scratch:P 4 ""))]
14867 "reload_completed && ! gpc_reg_operand (operands[0], SImode)"
14868 [(parallel [(set (match_dup 3)
14869 (compare:CC (plus:P (match_dup 1)
14873 (plus:P (match_dup 1)
14877 (set (pc) (if_then_else (match_dup 7)
14881 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
14882 operands[3], const0_rtx); }")
14884 (define_insn "trap"
14885 [(trap_if (const_int 1) (const_int 0))]
14888 [(set_attr "type" "trap")])
14890 (define_expand "ctrap<mode>4"
14891 [(trap_if (match_operator 0 "ordered_comparison_operator"
14892 [(match_operand:GPR 1 "register_operand")
14893 (match_operand:GPR 2 "reg_or_short_operand")])
14894 (match_operand 3 "zero_constant" ""))]
14899 [(trap_if (match_operator 0 "ordered_comparison_operator"
14900 [(match_operand:GPR 1 "register_operand" "r")
14901 (match_operand:GPR 2 "reg_or_short_operand" "rI")])
14904 "t<wd>%V0%I2 %1,%2"
14905 [(set_attr "type" "trap")])
14907 ;; Insns related to generating the function prologue and epilogue.
14909 (define_expand "prologue"
14910 [(use (const_int 0))]
14913 rs6000_emit_prologue ();
14914 if (!TARGET_SCHED_PROLOG)
14915 emit_insn (gen_blockage ());
14919 (define_insn "*movesi_from_cr_one"
14920 [(match_parallel 0 "mfcr_operation"
14921 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
14922 (unspec:SI [(match_operand:CC 2 "cc_reg_operand" "y")
14923 (match_operand 3 "immediate_operand" "n")]
14924 UNSPEC_MOVESI_FROM_CR))])]
14930 for (i = 0; i < XVECLEN (operands[0], 0); i++)
14932 mask = INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
14933 operands[4] = GEN_INT (mask);
14934 output_asm_insn (\"mfcr %1,%4\", operands);
14938 [(set_attr "type" "mfcrf")])
14940 (define_insn "movesi_from_cr"
14941 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14942 (unspec:SI [(reg:CC CR0_REGNO) (reg:CC CR1_REGNO)
14943 (reg:CC CR2_REGNO) (reg:CC CR3_REGNO)
14944 (reg:CC CR4_REGNO) (reg:CC CR5_REGNO)
14945 (reg:CC CR6_REGNO) (reg:CC CR7_REGNO)]
14946 UNSPEC_MOVESI_FROM_CR))]
14949 [(set_attr "type" "mfcr")])
14951 (define_insn "*crsave"
14952 [(match_parallel 0 "crsave_operation"
14953 [(set (match_operand:SI 1 "memory_operand" "=m")
14954 (match_operand:SI 2 "gpc_reg_operand" "r"))])]
14957 [(set_attr "type" "store")])
14959 (define_insn "*stmw"
14960 [(match_parallel 0 "stmw_operation"
14961 [(set (match_operand:SI 1 "memory_operand" "=m")
14962 (match_operand:SI 2 "gpc_reg_operand" "r"))])]
14965 [(set_attr "type" "store")
14966 (set_attr "update" "yes")
14967 (set_attr "indexed" "yes")])
14969 ; The following comment applies to:
14973 ; return_and_restore_gpregs*
14974 ; return_and_restore_fpregs*
14975 ; return_and_restore_fpregs_aix*
14977 ; The out-of-line save / restore functions expects one input argument.
14978 ; Since those are not standard call_insn's, we must avoid using
14979 ; MATCH_OPERAND for that argument. That way the register rename
14980 ; optimization will not try to rename this register.
14981 ; Each pattern is repeated for each possible register number used in
14982 ; various ABIs (r11, r1, and for some functions r12)
14984 (define_insn "*save_gpregs_<mode>_r11"
14985 [(match_parallel 0 "any_parallel_operand"
14986 [(clobber (reg:P 65))
14987 (use (match_operand:P 1 "symbol_ref_operand" "s"))
14989 (set (match_operand:P 2 "memory_operand" "=m")
14990 (match_operand:P 3 "gpc_reg_operand" "r"))])]
14993 [(set_attr "type" "branch")
14994 (set_attr "length" "4")])
14996 (define_insn "*save_gpregs_<mode>_r12"
14997 [(match_parallel 0 "any_parallel_operand"
14998 [(clobber (reg:P 65))
14999 (use (match_operand:P 1 "symbol_ref_operand" "s"))
15001 (set (match_operand:P 2 "memory_operand" "=m")
15002 (match_operand:P 3 "gpc_reg_operand" "r"))])]
15005 [(set_attr "type" "branch")
15006 (set_attr "length" "4")])
15008 (define_insn "*save_gpregs_<mode>_r1"
15009 [(match_parallel 0 "any_parallel_operand"
15010 [(clobber (reg:P 65))
15011 (use (match_operand:P 1 "symbol_ref_operand" "s"))
15013 (set (match_operand:P 2 "memory_operand" "=m")
15014 (match_operand:P 3 "gpc_reg_operand" "r"))])]
15017 [(set_attr "type" "branch")
15018 (set_attr "length" "4")])
15020 (define_insn "*save_fpregs_<mode>_r11"
15021 [(match_parallel 0 "any_parallel_operand"
15022 [(clobber (reg:P 65))
15023 (use (match_operand:P 1 "symbol_ref_operand" "s"))
15025 (set (match_operand:DF 2 "memory_operand" "=m")
15026 (match_operand:DF 3 "gpc_reg_operand" "d"))])]
15029 [(set_attr "type" "branch")
15030 (set_attr "length" "4")])
15032 (define_insn "*save_fpregs_<mode>_r12"
15033 [(match_parallel 0 "any_parallel_operand"
15034 [(clobber (reg:P 65))
15035 (use (match_operand:P 1 "symbol_ref_operand" "s"))
15037 (set (match_operand:DF 2 "memory_operand" "=m")
15038 (match_operand:DF 3 "gpc_reg_operand" "d"))])]
15041 [(set_attr "type" "branch")
15042 (set_attr "length" "4")])
15044 (define_insn "*save_fpregs_<mode>_r1"
15045 [(match_parallel 0 "any_parallel_operand"
15046 [(clobber (reg:P 65))
15047 (use (match_operand:P 1 "symbol_ref_operand" "s"))
15049 (set (match_operand:DF 2 "memory_operand" "=m")
15050 (match_operand:DF 3 "gpc_reg_operand" "d"))])]
15053 [(set_attr "type" "branch")
15054 (set_attr "length" "4")])
15056 ; This is to explain that changes to the stack pointer should
15057 ; not be moved over loads from or stores to stack memory.
15058 (define_insn "stack_tie"
15059 [(match_parallel 0 "tie_operand"
15060 [(set (mem:BLK (reg 1)) (const_int 0))])]
15063 [(set_attr "length" "0")])
15065 (define_expand "epilogue"
15066 [(use (const_int 0))]
15069 if (!TARGET_SCHED_PROLOG)
15070 emit_insn (gen_blockage ());
15071 rs6000_emit_epilogue (FALSE);
15075 ; On some processors, doing the mtcrf one CC register at a time is
15076 ; faster (like on the 604e). On others, doing them all at once is
15077 ; faster; for instance, on the 601 and 750.
15079 (define_expand "movsi_to_cr_one"
15080 [(set (match_operand:CC 0 "cc_reg_operand" "")
15081 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "")
15082 (match_dup 2)] UNSPEC_MOVESI_TO_CR))]
15084 "operands[2] = GEN_INT (1 << (75 - REGNO (operands[0])));")
15086 (define_insn "*movsi_to_cr"
15087 [(match_parallel 0 "mtcrf_operation"
15088 [(set (match_operand:CC 1 "cc_reg_operand" "=y")
15089 (unspec:CC [(match_operand:SI 2 "gpc_reg_operand" "r")
15090 (match_operand 3 "immediate_operand" "n")]
15091 UNSPEC_MOVESI_TO_CR))])]
15097 for (i = 0; i < XVECLEN (operands[0], 0); i++)
15098 mask |= INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
15099 operands[4] = GEN_INT (mask);
15100 return \"mtcrf %4,%2\";
15102 [(set_attr "type" "mtcr")])
15104 (define_insn "*mtcrfsi"
15105 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
15106 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
15107 (match_operand 2 "immediate_operand" "n")]
15108 UNSPEC_MOVESI_TO_CR))]
15109 "GET_CODE (operands[0]) == REG
15110 && CR_REGNO_P (REGNO (operands[0]))
15111 && GET_CODE (operands[2]) == CONST_INT
15112 && INTVAL (operands[2]) == 1 << (75 - REGNO (operands[0]))"
15114 [(set_attr "type" "mtcr")])
15116 ; The load-multiple instructions have similar properties.
15117 ; Note that "load_multiple" is a name known to the machine-independent
15118 ; code that actually corresponds to the PowerPC load-string.
15120 (define_insn "*lmw"
15121 [(match_parallel 0 "lmw_operation"
15122 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
15123 (match_operand:SI 2 "memory_operand" "m"))])]
15126 [(set_attr "type" "load")
15127 (set_attr "update" "yes")
15128 (set_attr "indexed" "yes")
15129 (set_attr "cell_micro" "always")])
15131 (define_insn "*return_internal_<mode>"
15133 (use (match_operand:P 0 "register_operand" "lc"))]
15136 [(set_attr "type" "jmpreg")])
15138 ; FIXME: This would probably be somewhat simpler if the Cygnus sibcall
15139 ; stuff was in GCC. Oh, and "any_parallel_operand" is a bit flexible...
15141 ; The following comment applies to:
15145 ; return_and_restore_gpregs*
15146 ; return_and_restore_fpregs*
15147 ; return_and_restore_fpregs_aix*
15149 ; The out-of-line save / restore functions expects one input argument.
15150 ; Since those are not standard call_insn's, we must avoid using
15151 ; MATCH_OPERAND for that argument. That way the register rename
15152 ; optimization will not try to rename this register.
15153 ; Each pattern is repeated for each possible register number used in
15154 ; various ABIs (r11, r1, and for some functions r12)
15156 (define_insn "*restore_gpregs_<mode>_r11"
15157 [(match_parallel 0 "any_parallel_operand"
15158 [(clobber (match_operand:P 1 "register_operand" "=l"))
15159 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15161 (set (match_operand:P 3 "gpc_reg_operand" "=r")
15162 (match_operand:P 4 "memory_operand" "m"))])]
15165 [(set_attr "type" "branch")
15166 (set_attr "length" "4")])
15168 (define_insn "*restore_gpregs_<mode>_r12"
15169 [(match_parallel 0 "any_parallel_operand"
15170 [(clobber (match_operand:P 1 "register_operand" "=l"))
15171 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15173 (set (match_operand:P 3 "gpc_reg_operand" "=r")
15174 (match_operand:P 4 "memory_operand" "m"))])]
15177 [(set_attr "type" "branch")
15178 (set_attr "length" "4")])
15180 (define_insn "*restore_gpregs_<mode>_r1"
15181 [(match_parallel 0 "any_parallel_operand"
15182 [(clobber (match_operand:P 1 "register_operand" "=l"))
15183 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15185 (set (match_operand:P 3 "gpc_reg_operand" "=r")
15186 (match_operand:P 4 "memory_operand" "m"))])]
15189 [(set_attr "type" "branch")
15190 (set_attr "length" "4")])
15192 (define_insn "*return_and_restore_gpregs_<mode>_r11"
15193 [(match_parallel 0 "any_parallel_operand"
15195 (clobber (match_operand:P 1 "register_operand" "=l"))
15196 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15198 (set (match_operand:P 3 "gpc_reg_operand" "=r")
15199 (match_operand:P 4 "memory_operand" "m"))])]
15202 [(set_attr "type" "branch")
15203 (set_attr "length" "4")])
15205 (define_insn "*return_and_restore_gpregs_<mode>_r12"
15206 [(match_parallel 0 "any_parallel_operand"
15208 (clobber (match_operand:P 1 "register_operand" "=l"))
15209 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15211 (set (match_operand:P 3 "gpc_reg_operand" "=r")
15212 (match_operand:P 4 "memory_operand" "m"))])]
15215 [(set_attr "type" "branch")
15216 (set_attr "length" "4")])
15218 (define_insn "*return_and_restore_gpregs_<mode>_r1"
15219 [(match_parallel 0 "any_parallel_operand"
15221 (clobber (match_operand:P 1 "register_operand" "=l"))
15222 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15224 (set (match_operand:P 3 "gpc_reg_operand" "=r")
15225 (match_operand:P 4 "memory_operand" "m"))])]
15228 [(set_attr "type" "branch")
15229 (set_attr "length" "4")])
15231 (define_insn "*return_and_restore_fpregs_<mode>_r11"
15232 [(match_parallel 0 "any_parallel_operand"
15234 (clobber (match_operand:P 1 "register_operand" "=l"))
15235 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15237 (set (match_operand:DF 3 "gpc_reg_operand" "=d")
15238 (match_operand:DF 4 "memory_operand" "m"))])]
15241 [(set_attr "type" "branch")
15242 (set_attr "length" "4")])
15244 (define_insn "*return_and_restore_fpregs_<mode>_r12"
15245 [(match_parallel 0 "any_parallel_operand"
15247 (clobber (match_operand:P 1 "register_operand" "=l"))
15248 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15250 (set (match_operand:DF 3 "gpc_reg_operand" "=d")
15251 (match_operand:DF 4 "memory_operand" "m"))])]
15254 [(set_attr "type" "branch")
15255 (set_attr "length" "4")])
15257 (define_insn "*return_and_restore_fpregs_<mode>_r1"
15258 [(match_parallel 0 "any_parallel_operand"
15260 (clobber (match_operand:P 1 "register_operand" "=l"))
15261 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15263 (set (match_operand:DF 3 "gpc_reg_operand" "=d")
15264 (match_operand:DF 4 "memory_operand" "m"))])]
15267 [(set_attr "type" "branch")
15268 (set_attr "length" "4")])
15270 (define_insn "*return_and_restore_fpregs_aix_<mode>_r11"
15271 [(match_parallel 0 "any_parallel_operand"
15273 (use (match_operand:P 1 "register_operand" "l"))
15274 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15276 (set (match_operand:DF 3 "gpc_reg_operand" "=d")
15277 (match_operand:DF 4 "memory_operand" "m"))])]
15280 [(set_attr "type" "branch")
15281 (set_attr "length" "4")])
15283 (define_insn "*return_and_restore_fpregs_aix_<mode>_r1"
15284 [(match_parallel 0 "any_parallel_operand"
15286 (use (match_operand:P 1 "register_operand" "l"))
15287 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15289 (set (match_operand:DF 3 "gpc_reg_operand" "=d")
15290 (match_operand:DF 4 "memory_operand" "m"))])]
15293 [(set_attr "type" "branch")
15294 (set_attr "length" "4")])
15296 ; This is used in compiling the unwind routines.
15297 (define_expand "eh_return"
15298 [(use (match_operand 0 "general_operand" ""))]
15303 emit_insn (gen_eh_set_lr_si (operands[0]));
15305 emit_insn (gen_eh_set_lr_di (operands[0]));
15309 ; We can't expand this before we know where the link register is stored.
15310 (define_insn "eh_set_lr_<mode>"
15311 [(unspec_volatile [(match_operand:P 0 "register_operand" "r")]
15313 (clobber (match_scratch:P 1 "=&b"))]
15318 [(unspec_volatile [(match_operand 0 "register_operand" "")] UNSPECV_EH_RR)
15319 (clobber (match_scratch 1 ""))]
15324 rs6000_emit_eh_reg_restore (operands[0], operands[1]);
15328 (define_insn "prefetch"
15329 [(prefetch (match_operand 0 "indexed_or_indirect_address" "a")
15330 (match_operand:SI 1 "const_int_operand" "n")
15331 (match_operand:SI 2 "const_int_operand" "n"))]
15335 if (GET_CODE (operands[0]) == REG)
15336 return INTVAL (operands[1]) ? \"dcbtst 0,%0\" : \"dcbt 0,%0\";
15337 return INTVAL (operands[1]) ? \"dcbtst %a0\" : \"dcbt %a0\";
15339 [(set_attr "type" "load")])
15341 (define_insn "bpermd_<mode>"
15342 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
15343 (unspec:P [(match_operand:P 1 "gpc_reg_operand" "r")
15344 (match_operand:P 2 "gpc_reg_operand" "r")] UNSPEC_BPERM))]
15347 [(set_attr "type" "popcnt")])
15350 ;; Builtin fma support. Handle
15351 ;; Note that the conditions for expansion are in the FMA_F iterator.
15353 (define_expand "fma<mode>4"
15354 [(set (match_operand:FMA_F 0 "register_operand" "")
15356 (match_operand:FMA_F 1 "register_operand" "")
15357 (match_operand:FMA_F 2 "register_operand" "")
15358 (match_operand:FMA_F 3 "register_operand" "")))]
15362 (define_insn "*fma<mode>4_fpr"
15363 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>,<Fv>")
15365 (match_operand:SFDF 1 "gpc_reg_operand" "%<Ff>,<Fv>,<Fv>")
15366 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>,0")
15367 (match_operand:SFDF 3 "gpc_reg_operand" "<Ff>,0,<Fv>")))]
15368 "TARGET_<MODE>_FPR"
15370 fmadd<Ftrad> %0,%1,%2,%3
15371 xsmadda<Fvsx> %x0,%x1,%x2
15372 xsmaddm<Fvsx> %x0,%x1,%x3"
15373 [(set_attr "type" "fp")
15374 (set_attr "fp_type" "fp_maddsub_<Fs>")])
15376 ; Altivec only has fma and nfms.
15377 (define_expand "fms<mode>4"
15378 [(set (match_operand:FMA_F 0 "register_operand" "")
15380 (match_operand:FMA_F 1 "register_operand" "")
15381 (match_operand:FMA_F 2 "register_operand" "")
15382 (neg:FMA_F (match_operand:FMA_F 3 "register_operand" ""))))]
15383 "!VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
15386 (define_insn "*fms<mode>4_fpr"
15387 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>,<Fv>")
15389 (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>,<Fv>")
15390 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>,0")
15391 (neg:SFDF (match_operand:SFDF 3 "gpc_reg_operand" "<Ff>,0,<Fv>"))))]
15392 "TARGET_<MODE>_FPR"
15394 fmsub<Ftrad> %0,%1,%2,%3
15395 xsmsuba<Fvsx> %x0,%x1,%x2
15396 xsmsubm<Fvsx> %x0,%x1,%x3"
15397 [(set_attr "type" "fp")
15398 (set_attr "fp_type" "fp_maddsub_<Fs>")])
15400 ;; If signed zeros are ignored, -(a * b - c) = -a * b + c.
15401 (define_expand "fnma<mode>4"
15402 [(set (match_operand:FMA_F 0 "register_operand" "")
15405 (match_operand:FMA_F 1 "register_operand" "")
15406 (match_operand:FMA_F 2 "register_operand" "")
15407 (neg:FMA_F (match_operand:FMA_F 3 "register_operand" "")))))]
15408 "!HONOR_SIGNED_ZEROS (<MODE>mode)"
15411 ;; If signed zeros are ignored, -(a * b + c) = -a * b - c.
15412 (define_expand "fnms<mode>4"
15413 [(set (match_operand:FMA_F 0 "register_operand" "")
15416 (match_operand:FMA_F 1 "register_operand" "")
15417 (match_operand:FMA_F 2 "register_operand" "")
15418 (match_operand:FMA_F 3 "register_operand" ""))))]
15419 "!HONOR_SIGNED_ZEROS (<MODE>mode) && !VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
15422 ; Not an official optab name, but used from builtins.
15423 (define_expand "nfma<mode>4"
15424 [(set (match_operand:FMA_F 0 "register_operand" "")
15427 (match_operand:FMA_F 1 "register_operand" "")
15428 (match_operand:FMA_F 2 "register_operand" "")
15429 (match_operand:FMA_F 3 "register_operand" ""))))]
15430 "!VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
15433 (define_insn "*nfma<mode>4_fpr"
15434 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>,<Fv>")
15437 (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>,<Fv>")
15438 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>,0")
15439 (match_operand:SFDF 3 "gpc_reg_operand" "<Ff>,0,<Fv>"))))]
15440 "TARGET_<MODE>_FPR"
15442 fnmadd<Ftrad> %0,%1,%2,%3
15443 xsnmadda<Fvsx> %x0,%x1,%x2
15444 xsnmaddm<Fvsx> %x0,%x1,%x3"
15445 [(set_attr "type" "fp")
15446 (set_attr "fp_type" "fp_maddsub_<Fs>")])
15448 ; Not an official optab name, but used from builtins.
15449 (define_expand "nfms<mode>4"
15450 [(set (match_operand:FMA_F 0 "register_operand" "")
15453 (match_operand:FMA_F 1 "register_operand" "")
15454 (match_operand:FMA_F 2 "register_operand" "")
15455 (neg:FMA_F (match_operand:FMA_F 3 "register_operand" "")))))]
15459 (define_insn "*nfmssf4_fpr"
15460 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>,<Fv>")
15463 (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>,<Fv>")
15464 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>,0")
15466 (match_operand:SFDF 3 "gpc_reg_operand" "<Ff>,0,<Fv>")))))]
15467 "TARGET_<MODE>_FPR"
15469 fnmsub<Ftrad> %0,%1,%2,%3
15470 xsnmsuba<Fvsx> %x0,%x1,%x2
15471 xsnmsubm<Fvsx> %x0,%x1,%x3"
15472 [(set_attr "type" "fp")
15473 (set_attr "fp_type" "fp_maddsub_<Fs>")])
15476 (define_expand "rs6000_get_timebase"
15477 [(use (match_operand:DI 0 "gpc_reg_operand" ""))]
15480 if (TARGET_POWERPC64)
15481 emit_insn (gen_rs6000_mftb_di (operands[0]));
15483 emit_insn (gen_rs6000_get_timebase_ppc32 (operands[0]));
15487 (define_insn "rs6000_get_timebase_ppc32"
15488 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
15489 (unspec_volatile:DI [(const_int 0)] UNSPECV_MFTB))
15490 (clobber (match_scratch:SI 1 "=r"))
15491 (clobber (match_scratch:CC 2 "=y"))]
15492 "!TARGET_POWERPC64"
15494 if (WORDS_BIG_ENDIAN)
15497 return "mfspr %0,269\;"
15505 return "mftbu %0\;"
15514 return "mfspr %L0,269\;"
15522 return "mftbu %L0\;"
15529 [(set_attr "length" "20")])
15531 (define_insn "rs6000_mftb_<mode>"
15532 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
15533 (unspec_volatile:P [(const_int 0)] UNSPECV_MFTB))]
15537 return "mfspr %0,268";
15543 (define_insn "rs6000_mffs"
15544 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
15545 (unspec_volatile:DF [(const_int 0)] UNSPECV_MFFS))]
15546 "TARGET_HARD_FLOAT && TARGET_FPRS"
15549 (define_insn "rs6000_mtfsf"
15550 [(unspec_volatile [(match_operand:SI 0 "const_int_operand" "i")
15551 (match_operand:DF 1 "gpc_reg_operand" "d")]
15553 "TARGET_HARD_FLOAT && TARGET_FPRS"
15557 ;; Power8 fusion support for fusing an addis instruction with a D-form load of
15558 ;; a GPR. The addis instruction must be adjacent to the load, and use the same
15559 ;; register that is being loaded. The fused ops must be physically adjacent.
15561 ;; We use define_peephole for the actual addis/load, and the register used to
15562 ;; hold the addis value must be the same as the register being loaded. We use
15563 ;; define_peephole2 to change the register used for addis to be the register
15564 ;; being loaded, since we can look at whether it is dead after the load insn.
15567 [(set (match_operand:P 0 "base_reg_operand" "")
15568 (match_operand:P 1 "fusion_gpr_addis" ""))
15569 (set (match_operand:INT1 2 "base_reg_operand" "")
15570 (match_operand:INT1 3 "fusion_gpr_mem_load" ""))]
15571 "TARGET_P8_FUSION && fusion_gpr_load_p (operands, false)"
15573 return emit_fusion_gpr_load (operands);
15575 [(set_attr "type" "load")
15576 (set_attr "length" "8")])
15579 [(set (match_operand:P 0 "base_reg_operand" "")
15580 (match_operand:P 1 "fusion_gpr_addis" ""))
15581 (set (match_operand:INT1 2 "base_reg_operand" "")
15582 (match_operand:INT1 3 "fusion_gpr_mem_load" ""))]
15584 && (REGNO (operands[0]) != REGNO (operands[2])
15585 || GET_CODE (operands[3]) == SIGN_EXTEND)
15586 && fusion_gpr_load_p (operands, true)"
15589 expand_fusion_gpr_load (operands);
15594 ;; Miscellaneous ISA 2.06 (power7) instructions
15595 (define_insn "addg6s"
15596 [(set (match_operand:SI 0 "register_operand" "=r")
15597 (unspec:SI [(match_operand:SI 1 "register_operand" "r")
15598 (match_operand:SI 2 "register_operand" "r")]
15602 [(set_attr "type" "integer")
15603 (set_attr "length" "4")])
15605 (define_insn "cdtbcd"
15606 [(set (match_operand:SI 0 "register_operand" "=r")
15607 (unspec:SI [(match_operand:SI 1 "register_operand" "r")]
15611 [(set_attr "type" "integer")
15612 (set_attr "length" "4")])
15614 (define_insn "cbcdtd"
15615 [(set (match_operand:SI 0 "register_operand" "=r")
15616 (unspec:SI [(match_operand:SI 1 "register_operand" "r")]
15620 [(set_attr "type" "integer")
15621 (set_attr "length" "4")])
15623 (define_int_iterator UNSPEC_DIV_EXTEND [UNSPEC_DIVE
15628 (define_int_attr div_extend [(UNSPEC_DIVE "e")
15629 (UNSPEC_DIVEO "eo")
15630 (UNSPEC_DIVEU "eu")
15631 (UNSPEC_DIVEUO "euo")])
15633 (define_insn "div<div_extend>_<mode>"
15634 [(set (match_operand:GPR 0 "register_operand" "=r")
15635 (unspec:GPR [(match_operand:GPR 1 "register_operand" "r")
15636 (match_operand:GPR 2 "register_operand" "r")]
15637 UNSPEC_DIV_EXTEND))]
15639 "div<wd><div_extend> %0,%1,%2"
15640 [(set_attr "type" "div")
15641 (set_attr "size" "<bits>")])
15644 ;; Pack/unpack 128-bit floating point types that take 2 scalar registers
15646 ; Type of the 64-bit part when packing/unpacking 128-bit floating point types
15647 (define_mode_attr FP128_64 [(TF "DF") (TD "DI")])
15649 (define_expand "unpack<mode>"
15650 [(set (match_operand:<FP128_64> 0 "nonimmediate_operand" "")
15652 [(match_operand:FMOVE128 1 "register_operand" "")
15653 (match_operand:QI 2 "const_0_to_1_operand" "")]
15654 UNSPEC_UNPACK_128BIT))]
15658 ;; The Advance Toolchain 7.0-3 added private builtins: __builtin_longdouble_dw0
15659 ;; and __builtin_longdouble_dw1 to optimize glibc. Add support for these
15662 (define_expand "unpacktf_0"
15663 [(set (match_operand:DF 0 "nonimmediate_operand" "")
15664 (unspec:DF [(match_operand:TF 1 "register_operand" "")
15666 UNSPEC_UNPACK_128BIT))]
15670 (define_expand "unpacktf_1"
15671 [(set (match_operand:DF 0 "nonimmediate_operand" "")
15672 (unspec:DF [(match_operand:TF 1 "register_operand" "")
15674 UNSPEC_UNPACK_128BIT))]
15678 (define_insn_and_split "unpack<mode>_dm"
15679 [(set (match_operand:<FP128_64> 0 "nonimmediate_operand" "=d,m,d,r,m")
15681 [(match_operand:FMOVE128 1 "register_operand" "d,d,r,d,r")
15682 (match_operand:QI 2 "const_0_to_1_operand" "i,i,i,i,i")]
15683 UNSPEC_UNPACK_128BIT))]
15684 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
15686 "&& reload_completed"
15687 [(set (match_dup 0) (match_dup 3))]
15689 unsigned fp_regno = REGNO (operands[1]) + UINTVAL (operands[2]);
15691 if (REG_P (operands[0]) && REGNO (operands[0]) == fp_regno)
15693 emit_note (NOTE_INSN_DELETED);
15697 operands[3] = gen_rtx_REG (<FP128_64>mode, fp_regno);
15699 [(set_attr "type" "fp,fpstore,mffgpr,mftgpr,store")
15700 (set_attr "length" "4")])
15702 (define_insn_and_split "unpack<mode>_nodm"
15703 [(set (match_operand:<FP128_64> 0 "nonimmediate_operand" "=d,m")
15705 [(match_operand:FMOVE128 1 "register_operand" "d,d")
15706 (match_operand:QI 2 "const_0_to_1_operand" "i,i")]
15707 UNSPEC_UNPACK_128BIT))]
15708 "!TARGET_POWERPC64 || !TARGET_DIRECT_MOVE"
15710 "&& reload_completed"
15711 [(set (match_dup 0) (match_dup 3))]
15713 unsigned fp_regno = REGNO (operands[1]) + UINTVAL (operands[2]);
15715 if (REG_P (operands[0]) && REGNO (operands[0]) == fp_regno)
15717 emit_note (NOTE_INSN_DELETED);
15721 operands[3] = gen_rtx_REG (<FP128_64>mode, fp_regno);
15723 [(set_attr "type" "fp,fpstore")
15724 (set_attr "length" "4")])
15726 (define_insn_and_split "pack<mode>"
15727 [(set (match_operand:FMOVE128 0 "register_operand" "=d,&d")
15729 [(match_operand:<FP128_64> 1 "register_operand" "0,d")
15730 (match_operand:<FP128_64> 2 "register_operand" "d,d")]
15731 UNSPEC_PACK_128BIT))]
15736 "&& reload_completed && REGNO (operands[0]) != REGNO (operands[1])"
15737 [(set (match_dup 3) (match_dup 1))
15738 (set (match_dup 4) (match_dup 2))]
15740 unsigned dest_hi = REGNO (operands[0]);
15741 unsigned dest_lo = dest_hi + 1;
15743 gcc_assert (!IN_RANGE (REGNO (operands[1]), dest_hi, dest_lo));
15744 gcc_assert (!IN_RANGE (REGNO (operands[2]), dest_hi, dest_lo));
15746 operands[3] = gen_rtx_REG (<FP128_64>mode, dest_hi);
15747 operands[4] = gen_rtx_REG (<FP128_64>mode, dest_lo);
15749 [(set_attr "type" "fp,fp")
15750 (set_attr "length" "4,8")])
15752 (define_insn "unpackv1ti"
15753 [(set (match_operand:DI 0 "register_operand" "=d,d")
15754 (unspec:DI [(match_operand:V1TI 1 "register_operand" "0,wa")
15755 (match_operand:QI 2 "const_0_to_1_operand" "O,i")]
15756 UNSPEC_UNPACK_128BIT))]
15759 if (REGNO (operands[0]) == REGNO (operands[1]) && INTVAL (operands[2]) == 0)
15760 return ASM_COMMENT_START " xxpermdi to same register";
15762 operands[3] = GEN_INT (INTVAL (operands[2]) == 0 ? 0 : 3);
15763 return "xxpermdi %x0,%x1,%x1,%3";
15765 [(set_attr "type" "vecperm")
15766 (set_attr "length" "4")])
15768 (define_insn "packv1ti"
15769 [(set (match_operand:V1TI 0 "register_operand" "=wa")
15771 [(match_operand:DI 1 "register_operand" "d")
15772 (match_operand:DI 2 "register_operand" "d")]
15773 UNSPEC_PACK_128BIT))]
15775 "xxpermdi %x0,%x1,%x2,0"
15776 [(set_attr "type" "vecperm")
15777 (set_attr "length" "4")])
15781 (include "sync.md")
15782 (include "vector.md")
15784 (include "altivec.md")
15787 (include "paired.md")
15788 (include "crypto.md")