1 ;; Machine description for IBM RISC System 6000 (POWER) for GNU C compiler
2 ;; Copyright (C) 1990-2013 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)
57 ; ABI defined stack offsets for storing the TOC pointer with AIX calls.
58 (TOC_SAVE_OFFSET_32BIT 20)
59 (TOC_SAVE_OFFSET_64BIT 40)
61 ; Function TOC offset in the AIX function descriptor.
62 (AIX_FUNC_DESC_TOC_32BIT 4)
63 (AIX_FUNC_DESC_TOC_64BIT 8)
65 ; Static chain offset in the AIX function descriptor.
66 (AIX_FUNC_DESC_SC_32BIT 8)
67 (AIX_FUNC_DESC_SC_64BIT 16)
74 (define_c_enum "unspec"
75 [UNSPEC_FRSP ; frsp for POWER machines
76 UNSPEC_PROBE_STACK ; probe stack memory reference
77 UNSPEC_TOCPTR ; address of a word pointing to the TOC
78 UNSPEC_TOC ; address of the TOC (more-or-less)
80 UNSPEC_MV_CR_OV ; move_from_CR_ov_bit
86 UNSPEC_LD_MPIC ; load_macho_picbase
87 UNSPEC_MPIC_CORRECT ; macho_correct_pic
101 UNSPEC_FIX_TRUNC_TF ; fadd, rounding towards zero
102 UNSPEC_MV_CR_GT ; move_from_CR_gt_bit
120 UNSPEC_MACHOPIC_OFFSET
132 UNSPEC_P8V_RELOAD_FROM_GPR
135 UNSPEC_P8V_RELOAD_FROM_VSX
140 ;; UNSPEC_VOLATILE usage
143 (define_c_enum "unspecv"
145 UNSPECV_LL ; load-locked
146 UNSPECV_SC ; store-conditional
147 UNSPECV_PROBE_STACK_RANGE ; probe range of stack addresses
148 UNSPECV_EH_RR ; eh_reg_restore
149 UNSPECV_ISYNC ; isync instruction
150 UNSPECV_MFTB ; move from time base
154 ;; Define an insn type attribute. This is used in function unit delay
156 (define_attr "type" "integer,two,three,load,load_ext,load_ext_u,load_ext_ux,load_ux,load_u,store,store_ux,store_u,fpload,fpload_ux,fpload_u,fpstore,fpstore_ux,fpstore_u,vecload,vecstore,imul,imul2,imul3,lmul,idiv,ldiv,insert_word,branch,cmp,fast_compare,compare,var_delayed_compare,delayed_compare,imul_compare,lmul_compare,fpcompare,cr_logical,delayed_cr,mfcr,mfcrf,mtcr,mfjmpr,mtjmpr,fp,fpsimple,dmul,sdiv,ddiv,ssqrt,dsqrt,jmpreg,brinc,vecsimple,veccomplex,vecdiv,veccmp,veccmpsimple,vecperm,vecfloat,vecfdiv,vecdouble,isync,sync,load_l,store_c,shift,trap,insert_dword,var_shift_rotate,cntlz,exts,mffgpr,mftgpr,isel,popcnt,crypto"
157 (const_string "integer"))
159 ;; Define floating point instruction sub-types for use with Xfpu.md
160 (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"))
162 ;; Length (in bytes).
163 ; '(pc)' in the following doesn't include the instruction itself; it is
164 ; calculated as if the instruction had zero size.
165 (define_attr "length" ""
166 (if_then_else (eq_attr "type" "branch")
167 (if_then_else (and (ge (minus (match_dup 0) (pc))
169 (lt (minus (match_dup 0) (pc))
175 ;; Processor type -- this attribute must exactly match the processor_type
176 ;; enumeration in rs6000-opts.h.
178 "ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630,
179 ppc750,ppc7400,ppc7450,
180 ppc403,ppc405,ppc440,ppc476,
181 ppc8540,ppc8548,ppce300c2,ppce300c3,ppce500mc,ppce500mc64,ppce5500,ppce6500,
182 power4,power5,power6,power7,power8,
183 rs64a,mpccore,cell,ppca2,titan"
184 (const (symbol_ref "rs6000_cpu_attr")))
187 ;; If this instruction is microcoded on the CELL processor
188 ; The default for load extended, the recorded instructions and rotate/shifts by a variable is always microcoded
189 (define_attr "cell_micro" "not,conditional,always"
190 (if_then_else (eq_attr "type" "compare,delayed_compare,imul_compare,lmul_compare,load_ext,load_ext_ux,var_shift_rotate,var_delayed_compare")
191 (const_string "always")
192 (const_string "not")))
194 (automata_option "ndfa")
207 (include "e300c2c3.md")
208 (include "e500mc.md")
209 (include "e500mc64.md")
212 (include "power4.md")
213 (include "power5.md")
214 (include "power6.md")
215 (include "power7.md")
221 (include "predicates.md")
222 (include "constraints.md")
224 (include "darwin.md")
229 ; This mode iterator allows :GPR to be used to indicate the allowable size
230 ; of whole values in GPRs.
231 (define_mode_iterator GPR [SI (DI "TARGET_POWERPC64")])
233 ; Any supported integer mode.
234 (define_mode_iterator INT [QI HI SI DI TI PTI])
236 ; Any supported integer mode that fits in one register.
237 (define_mode_iterator INT1 [QI HI SI (DI "TARGET_POWERPC64")])
239 ; extend modes for DImode
240 (define_mode_iterator QHSI [QI HI SI])
242 ; QImode or HImode for small atomic ops
243 (define_mode_iterator QHI [QI HI])
245 ; HImode or SImode for sign extended fusion ops
246 (define_mode_iterator HSI [HI SI])
248 ; SImode or DImode, even if DImode doesn't fit in GPRs.
249 (define_mode_iterator SDI [SI DI])
251 ; The size of a pointer. Also, the size of the value that a record-condition
252 ; (one with a '.') will compare; and the size used for arithmetic carries.
253 (define_mode_iterator P [(SI "TARGET_32BIT") (DI "TARGET_64BIT")])
255 ; Iterator to add PTImode along with TImode (TImode can go in VSX registers,
256 ; PTImode is GPR only)
257 (define_mode_iterator TI2 [TI PTI])
259 ; Any hardware-supported floating-point mode
260 (define_mode_iterator FP [
261 (SF "TARGET_HARD_FLOAT
262 && ((TARGET_FPRS && TARGET_SINGLE_FLOAT) || TARGET_E500_SINGLE)")
263 (DF "TARGET_HARD_FLOAT
264 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)")
265 (TF "!TARGET_IEEEQUAD
267 && (TARGET_FPRS || TARGET_E500_DOUBLE)
268 && TARGET_LONG_DOUBLE_128")
272 ; Any fma capable floating-point mode.
273 (define_mode_iterator FMA_F [
274 (SF "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT")
275 (DF "(TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT)
276 || VECTOR_UNIT_VSX_P (DFmode)")
277 (V2SF "TARGET_PAIRED_FLOAT")
278 (V4SF "VECTOR_UNIT_ALTIVEC_OR_VSX_P (V4SFmode)")
279 (V2DF "VECTOR_UNIT_ALTIVEC_OR_VSX_P (V2DFmode)")
282 ; Floating point move iterators to combine binary and decimal moves
283 (define_mode_iterator FMOVE32 [SF SD])
284 (define_mode_iterator FMOVE64 [DF DD])
285 (define_mode_iterator FMOVE64X [DI DF DD])
286 (define_mode_iterator FMOVE128 [(TF "!TARGET_IEEEQUAD && TARGET_LONG_DOUBLE_128")
287 (TD "TARGET_HARD_FLOAT && TARGET_FPRS")])
289 ; Iterators for 128 bit types for direct move
290 (define_mode_iterator FMOVE128_GPR [(TI "TARGET_VSX_TIMODE")
298 ; Whether a floating point move is ok, don't allow SD without hardware FP
299 (define_mode_attr fmove_ok [(SF "")
301 (SD "TARGET_HARD_FLOAT && TARGET_FPRS")
304 ; Convert REAL_VALUE to the appropriate bits
305 (define_mode_attr real_value_to_target [(SF "REAL_VALUE_TO_TARGET_SINGLE")
306 (DF "REAL_VALUE_TO_TARGET_DOUBLE")
307 (SD "REAL_VALUE_TO_TARGET_DECIMAL32")
308 (DD "REAL_VALUE_TO_TARGET_DECIMAL64")])
310 ; Definitions for load to 32-bit fpr register
311 (define_mode_attr f32_lr [(SF "f") (SD "wz")])
312 (define_mode_attr f32_lm [(SF "m") (SD "Z")])
313 (define_mode_attr f32_li [(SF "lfs%U1%X1 %0,%1") (SD "lfiwzx %0,%y1")])
314 (define_mode_attr f32_lv [(SF "lxsspx %0,%y1") (SD "lxsiwzx %0,%y1")])
316 ; Definitions for store from 32-bit fpr register
317 (define_mode_attr f32_sr [(SF "f") (SD "wx")])
318 (define_mode_attr f32_sm [(SF "m") (SD "Z")])
319 (define_mode_attr f32_si [(SF "stfs%U0%X0 %1,%0") (SD "stfiwx %1,%y0")])
320 (define_mode_attr f32_sv [(SF "stxsspx %1,%y0") (SD "stxsiwzx %1,%y0")])
322 ; Definitions for 32-bit fpr direct move
323 (define_mode_attr f32_dm [(SF "wn") (SD "wm")])
325 ; These modes do not fit in integer registers in 32-bit mode.
326 ; but on e500v2, the gpr are 64 bit registers
327 (define_mode_iterator DIFD [DI (DF "!TARGET_E500_DOUBLE") DD])
329 ; Iterator for reciprocal estimate instructions
330 (define_mode_iterator RECIPF [SF DF V4SF V2DF])
332 ; Iterator for just SF/DF
333 (define_mode_iterator SFDF [SF DF])
335 ; Conditional returns.
336 (define_code_iterator any_return [return simple_return])
337 (define_code_attr return_pred [(return "direct_return ()")
338 (simple_return "1")])
339 (define_code_attr return_str [(return "") (simple_return "simple_")])
341 ; Various instructions that come in SI and DI forms.
342 ; A generic w/d attribute, for things like cmpw/cmpd.
343 (define_mode_attr wd [(QI "b")
353 (define_mode_attr dbits [(QI "56") (HI "48") (SI "32")])
355 ;; ISEL/ISEL64 target selection
356 (define_mode_attr sel [(SI "") (DI "64")])
358 ;; Suffix for reload patterns
359 (define_mode_attr ptrsize [(SI "32bit")
362 (define_mode_attr tptrsize [(SI "TARGET_32BIT")
363 (DI "TARGET_64BIT")])
365 (define_mode_attr mptrsize [(SI "si")
368 (define_mode_attr ptrload [(SI "lwz")
371 (define_mode_attr ptrm [(SI "m")
374 (define_mode_attr rreg [(SF "f")
379 (define_mode_attr rreg2 [(SF "f")
382 (define_mode_attr SI_CONVERT_FP [(SF "TARGET_FCFIDS")
383 (DF "TARGET_FCFID")])
385 (define_mode_attr E500_CONVERT [(SF "!TARGET_FPRS")
386 (DF "TARGET_E500_DOUBLE")])
388 (define_mode_attr TARGET_FLOAT [(SF "TARGET_SINGLE_FLOAT")
389 (DF "TARGET_DOUBLE_FLOAT")])
391 ;; Start with fixed-point load and store insns. Here we put only the more
392 ;; complex forms. Basic data transfer is done later.
394 (define_expand "zero_extend<mode>di2"
395 [(set (match_operand:DI 0 "gpc_reg_operand" "")
396 (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "")))]
400 (define_insn "*zero_extend<mode>di2_internal1"
401 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
402 (zero_extend:DI (match_operand:QHSI 1 "reg_or_mem_operand" "m,r")))]
403 "TARGET_POWERPC64 && (<MODE>mode != SImode || !TARGET_LFIWZX)"
406 rldicl %0,%1,0,<dbits>"
407 [(set_attr_alternative "type"
409 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
410 (const_string "load_ux")
412 (match_test "update_address_mem (operands[1], VOIDmode)")
413 (const_string "load_u")
414 (const_string "load")))
415 (const_string "*")])])
417 (define_insn "*zero_extend<mode>di2_internal2"
418 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
419 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "r,r"))
421 (clobber (match_scratch:DI 2 "=r,r"))]
424 rldicl. %2,%1,0,<dbits>
426 [(set_attr "type" "compare")
427 (set_attr "length" "4,8")])
430 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
431 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" ""))
433 (clobber (match_scratch:DI 2 ""))]
434 "TARGET_POWERPC64 && reload_completed"
436 (zero_extend:DI (match_dup 1)))
438 (compare:CC (match_dup 2)
442 (define_insn "*zero_extend<mode>di2_internal3"
443 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
444 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "r,r"))
446 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
447 (zero_extend:DI (match_dup 1)))]
450 rldicl. %0,%1,0,<dbits>
452 [(set_attr "type" "compare")
453 (set_attr "length" "4,8")])
456 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
457 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" ""))
459 (set (match_operand:DI 0 "gpc_reg_operand" "")
460 (zero_extend:DI (match_dup 1)))]
461 "TARGET_POWERPC64 && reload_completed"
463 (zero_extend:DI (match_dup 1)))
465 (compare:CC (match_dup 0)
469 (define_insn "*zero_extendsidi2_lfiwzx"
470 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,??wm,!wz,!wm")
471 (zero_extend:DI (match_operand:SI 1 "reg_or_mem_operand" "m,r,r,Z,Z")))]
472 "TARGET_POWERPC64 && TARGET_LFIWZX"
479 [(set_attr_alternative "type"
481 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
482 (const_string "load_ux")
484 (match_test "update_address_mem (operands[1], VOIDmode)")
485 (const_string "load_u")
486 (const_string "load")))
488 (const_string "mffgpr")
489 (const_string "fpload")
490 (const_string "fpload")])])
492 (define_insn "extendqidi2"
493 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
494 (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r")))]
497 [(set_attr "type" "exts")])
500 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
501 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
503 (clobber (match_scratch:DI 2 "=r,r"))]
508 [(set_attr "type" "compare")
509 (set_attr "length" "4,8")])
512 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
513 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
515 (clobber (match_scratch:DI 2 ""))]
516 "TARGET_POWERPC64 && reload_completed"
518 (sign_extend:DI (match_dup 1)))
520 (compare:CC (match_dup 2)
525 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
526 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
528 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
529 (sign_extend:DI (match_dup 1)))]
534 [(set_attr "type" "compare")
535 (set_attr "length" "4,8")])
538 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
539 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
541 (set (match_operand:DI 0 "gpc_reg_operand" "")
542 (sign_extend:DI (match_dup 1)))]
543 "TARGET_POWERPC64 && reload_completed"
545 (sign_extend:DI (match_dup 1)))
547 (compare:CC (match_dup 0)
551 (define_expand "extendhidi2"
552 [(set (match_operand:DI 0 "gpc_reg_operand" "")
553 (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "")))]
558 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
559 (sign_extend:DI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
560 "TARGET_POWERPC64 && rs6000_gen_cell_microcode"
564 [(set_attr_alternative "type"
566 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
567 (const_string "load_ext_ux")
569 (match_test "update_address_mem (operands[1], VOIDmode)")
570 (const_string "load_ext_u")
571 (const_string "load_ext")))
572 (const_string "exts")])])
575 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
576 (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r")))]
577 "TARGET_POWERPC64 && !rs6000_gen_cell_microcode"
579 [(set_attr "type" "exts")])
582 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
583 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
585 (clobber (match_scratch:DI 2 "=r,r"))]
590 [(set_attr "type" "compare")
591 (set_attr "length" "4,8")])
594 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
595 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
597 (clobber (match_scratch:DI 2 ""))]
598 "TARGET_POWERPC64 && reload_completed"
600 (sign_extend:DI (match_dup 1)))
602 (compare:CC (match_dup 2)
607 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
608 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
610 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
611 (sign_extend:DI (match_dup 1)))]
616 [(set_attr "type" "compare")
617 (set_attr "length" "4,8")])
620 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
621 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
623 (set (match_operand:DI 0 "gpc_reg_operand" "")
624 (sign_extend:DI (match_dup 1)))]
625 "TARGET_POWERPC64 && reload_completed"
627 (sign_extend:DI (match_dup 1)))
629 (compare:CC (match_dup 0)
633 (define_expand "extendsidi2"
634 [(set (match_operand:DI 0 "gpc_reg_operand" "")
635 (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")))]
639 (define_insn "*extendsidi2_lfiwax"
640 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,??wm,!wl,!wm")
641 (sign_extend:DI (match_operand:SI 1 "lwa_operand" "m,r,r,Z,Z")))]
642 "TARGET_POWERPC64 && TARGET_LFIWAX"
649 [(set_attr_alternative "type"
651 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
652 (const_string "load_ext_ux")
654 (match_test "update_address_mem (operands[1], VOIDmode)")
655 (const_string "load_ext_u")
656 (const_string "load_ext")))
657 (const_string "exts")
658 (const_string "mffgpr")
659 (const_string "fpload")
660 (const_string "fpload")])])
662 (define_insn "*extendsidi2_nocell"
663 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
664 (sign_extend:DI (match_operand:SI 1 "lwa_operand" "m,r")))]
665 "TARGET_POWERPC64 && rs6000_gen_cell_microcode && !TARGET_LFIWAX"
669 [(set_attr_alternative "type"
671 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
672 (const_string "load_ext_ux")
674 (match_test "update_address_mem (operands[1], VOIDmode)")
675 (const_string "load_ext_u")
676 (const_string "load_ext")))
677 (const_string "exts")])])
679 (define_insn "*extendsidi2_nocell"
680 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
681 (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r")))]
682 "TARGET_POWERPC64 && !rs6000_gen_cell_microcode"
684 [(set_attr "type" "exts")])
687 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
688 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
690 (clobber (match_scratch:DI 2 "=r,r"))]
695 [(set_attr "type" "compare")
696 (set_attr "length" "4,8")])
699 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
700 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
702 (clobber (match_scratch:DI 2 ""))]
703 "TARGET_POWERPC64 && reload_completed"
705 (sign_extend:DI (match_dup 1)))
707 (compare:CC (match_dup 2)
712 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
713 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
715 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
716 (sign_extend:DI (match_dup 1)))]
721 [(set_attr "type" "compare")
722 (set_attr "length" "4,8")])
725 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
726 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
728 (set (match_operand:DI 0 "gpc_reg_operand" "")
729 (sign_extend:DI (match_dup 1)))]
730 "TARGET_POWERPC64 && reload_completed"
732 (sign_extend:DI (match_dup 1)))
734 (compare:CC (match_dup 0)
738 (define_expand "zero_extendqisi2"
739 [(set (match_operand:SI 0 "gpc_reg_operand" "")
740 (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "")))]
745 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
746 (zero_extend:SI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
751 [(set_attr_alternative "type"
753 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
754 (const_string "load_ux")
756 (match_test "update_address_mem (operands[1], VOIDmode)")
757 (const_string "load_u")
758 (const_string "load")))
759 (const_string "*")])])
762 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
763 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
765 (clobber (match_scratch:SI 2 "=r,r"))]
770 [(set_attr "type" "fast_compare,compare")
771 (set_attr "length" "4,8")])
774 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
775 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
777 (clobber (match_scratch:SI 2 ""))]
780 (zero_extend:SI (match_dup 1)))
782 (compare:CC (match_dup 2)
787 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
788 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
790 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
791 (zero_extend:SI (match_dup 1)))]
796 [(set_attr "type" "fast_compare,compare")
797 (set_attr "length" "4,8")])
800 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
801 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
803 (set (match_operand:SI 0 "gpc_reg_operand" "")
804 (zero_extend:SI (match_dup 1)))]
807 (zero_extend:SI (match_dup 1)))
809 (compare:CC (match_dup 0)
813 (define_insn "extendqisi2"
814 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
815 (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r")))]
818 [(set_attr "type" "exts")])
821 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
822 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
824 (clobber (match_scratch:SI 2 "=r,r"))]
829 [(set_attr "type" "compare")
830 (set_attr "length" "4,8")])
833 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
834 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
836 (clobber (match_scratch:SI 2 ""))]
839 (sign_extend:SI (match_dup 1)))
841 (compare:CC (match_dup 2)
846 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
847 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
849 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
850 (sign_extend:SI (match_dup 1)))]
855 [(set_attr "type" "compare")
856 (set_attr "length" "4,8")])
859 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
860 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
862 (set (match_operand:SI 0 "gpc_reg_operand" "")
863 (sign_extend:SI (match_dup 1)))]
866 (sign_extend:SI (match_dup 1)))
868 (compare:CC (match_dup 0)
873 [(set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
874 (zero_extend:HI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
879 [(set_attr_alternative "type"
881 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
882 (const_string "load_ux")
884 (match_test "update_address_mem (operands[1], VOIDmode)")
885 (const_string "load_u")
886 (const_string "load")))
887 (const_string "*")])])
890 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
891 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
893 (clobber (match_scratch:HI 2 "=r,r"))]
898 [(set_attr "type" "fast_compare,compare")
899 (set_attr "length" "4,8")])
902 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
903 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
905 (clobber (match_scratch:HI 2 ""))]
908 (zero_extend:HI (match_dup 1)))
910 (compare:CC (match_dup 2)
915 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
916 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
918 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
919 (zero_extend:HI (match_dup 1)))]
924 [(set_attr "type" "fast_compare,compare")
925 (set_attr "length" "4,8")])
928 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
929 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
931 (set (match_operand:HI 0 "gpc_reg_operand" "")
932 (zero_extend:HI (match_dup 1)))]
935 (zero_extend:HI (match_dup 1)))
937 (compare:CC (match_dup 0)
941 (define_insn "extendqihi2"
942 [(set (match_operand:HI 0 "gpc_reg_operand" "=r")
943 (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r")))]
946 [(set_attr "type" "exts")])
949 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
950 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
952 (clobber (match_scratch:HI 2 "=r,r"))]
957 [(set_attr "type" "compare")
958 (set_attr "length" "4,8")])
961 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
962 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
964 (clobber (match_scratch:HI 2 ""))]
967 (sign_extend:HI (match_dup 1)))
969 (compare:CC (match_dup 2)
974 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
975 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
977 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
978 (sign_extend:HI (match_dup 1)))]
983 [(set_attr "type" "compare")
984 (set_attr "length" "4,8")])
987 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
988 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
990 (set (match_operand:HI 0 "gpc_reg_operand" "")
991 (sign_extend:HI (match_dup 1)))]
994 (sign_extend:HI (match_dup 1)))
996 (compare:CC (match_dup 0)
1000 (define_expand "zero_extendhisi2"
1001 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1002 (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
1007 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1008 (zero_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
1012 rlwinm %0,%1,0,0xffff"
1013 [(set_attr_alternative "type"
1015 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
1016 (const_string "load_ux")
1018 (match_test "update_address_mem (operands[1], VOIDmode)")
1019 (const_string "load_u")
1020 (const_string "load")))
1021 (const_string "*")])])
1024 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1025 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
1027 (clobber (match_scratch:SI 2 "=r,r"))]
1032 [(set_attr "type" "fast_compare,compare")
1033 (set_attr "length" "4,8")])
1036 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
1037 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1039 (clobber (match_scratch:SI 2 ""))]
1042 (zero_extend:SI (match_dup 1)))
1044 (compare:CC (match_dup 2)
1049 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1050 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
1052 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1053 (zero_extend:SI (match_dup 1)))]
1058 [(set_attr "type" "fast_compare,compare")
1059 (set_attr "length" "4,8")])
1062 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
1063 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1065 (set (match_operand:SI 0 "gpc_reg_operand" "")
1066 (zero_extend:SI (match_dup 1)))]
1069 (zero_extend:SI (match_dup 1)))
1071 (compare:CC (match_dup 0)
1075 (define_expand "extendhisi2"
1076 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1077 (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
1082 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1083 (sign_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
1084 "rs6000_gen_cell_microcode"
1088 [(set_attr_alternative "type"
1090 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
1091 (const_string "load_ext_ux")
1093 (match_test "update_address_mem (operands[1], VOIDmode)")
1094 (const_string "load_ext_u")
1095 (const_string "load_ext")))
1096 (const_string "exts")])])
1099 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1100 (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r")))]
1101 "!rs6000_gen_cell_microcode"
1103 [(set_attr "type" "exts")])
1106 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1107 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
1109 (clobber (match_scratch:SI 2 "=r,r"))]
1114 [(set_attr "type" "compare")
1115 (set_attr "length" "4,8")])
1118 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
1119 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1121 (clobber (match_scratch:SI 2 ""))]
1124 (sign_extend:SI (match_dup 1)))
1126 (compare:CC (match_dup 2)
1131 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1132 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
1134 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1135 (sign_extend:SI (match_dup 1)))]
1140 [(set_attr "type" "compare")
1141 (set_attr "length" "4,8")])
1144 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
1145 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1147 (set (match_operand:SI 0 "gpc_reg_operand" "")
1148 (sign_extend:SI (match_dup 1)))]
1151 (sign_extend:SI (match_dup 1)))
1153 (compare:CC (match_dup 0)
1157 ;; IBM 405, 440, 464 and 476 half-word multiplication operations.
1159 (define_insn "*macchwc"
1160 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1161 (compare:CC (plus:SI (mult:SI (ashiftrt:SI
1162 (match_operand:SI 2 "gpc_reg_operand" "r")
1165 (match_operand:HI 1 "gpc_reg_operand" "r")))
1166 (match_operand:SI 4 "gpc_reg_operand" "0"))
1168 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1169 (plus:SI (mult:SI (ashiftrt:SI
1177 [(set_attr "type" "imul3")])
1179 (define_insn "*macchw"
1180 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1181 (plus:SI (mult:SI (ashiftrt:SI
1182 (match_operand:SI 2 "gpc_reg_operand" "r")
1185 (match_operand:HI 1 "gpc_reg_operand" "r")))
1186 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1189 [(set_attr "type" "imul3")])
1191 (define_insn "*macchwuc"
1192 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1193 (compare:CC (plus:SI (mult:SI (lshiftrt:SI
1194 (match_operand:SI 2 "gpc_reg_operand" "r")
1197 (match_operand:HI 1 "gpc_reg_operand" "r")))
1198 (match_operand:SI 4 "gpc_reg_operand" "0"))
1200 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1201 (plus:SI (mult:SI (lshiftrt:SI
1209 [(set_attr "type" "imul3")])
1211 (define_insn "*macchwu"
1212 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1213 (plus:SI (mult:SI (lshiftrt:SI
1214 (match_operand:SI 2 "gpc_reg_operand" "r")
1217 (match_operand:HI 1 "gpc_reg_operand" "r")))
1218 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1221 [(set_attr "type" "imul3")])
1223 (define_insn "*machhwc"
1224 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1225 (compare:CC (plus:SI (mult:SI (ashiftrt:SI
1226 (match_operand:SI 1 "gpc_reg_operand" "%r")
1229 (match_operand:SI 2 "gpc_reg_operand" "r")
1231 (match_operand:SI 4 "gpc_reg_operand" "0"))
1233 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1234 (plus:SI (mult:SI (ashiftrt:SI
1243 [(set_attr "type" "imul3")])
1245 (define_insn "*machhw"
1246 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1247 (plus:SI (mult:SI (ashiftrt:SI
1248 (match_operand:SI 1 "gpc_reg_operand" "%r")
1251 (match_operand:SI 2 "gpc_reg_operand" "r")
1253 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1256 [(set_attr "type" "imul3")])
1258 (define_insn "*machhwuc"
1259 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1260 (compare:CC (plus:SI (mult:SI (lshiftrt:SI
1261 (match_operand:SI 1 "gpc_reg_operand" "%r")
1264 (match_operand:SI 2 "gpc_reg_operand" "r")
1266 (match_operand:SI 4 "gpc_reg_operand" "0"))
1268 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1269 (plus:SI (mult:SI (lshiftrt:SI
1278 [(set_attr "type" "imul3")])
1280 (define_insn "*machhwu"
1281 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1282 (plus:SI (mult:SI (lshiftrt:SI
1283 (match_operand:SI 1 "gpc_reg_operand" "%r")
1286 (match_operand:SI 2 "gpc_reg_operand" "r")
1288 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1291 [(set_attr "type" "imul3")])
1293 (define_insn "*maclhwc"
1294 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1295 (compare:CC (plus:SI (mult:SI (sign_extend:SI
1296 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1298 (match_operand:HI 2 "gpc_reg_operand" "r")))
1299 (match_operand:SI 4 "gpc_reg_operand" "0"))
1301 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1302 (plus:SI (mult:SI (sign_extend:SI
1309 [(set_attr "type" "imul3")])
1311 (define_insn "*maclhw"
1312 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1313 (plus:SI (mult:SI (sign_extend:SI
1314 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1316 (match_operand:HI 2 "gpc_reg_operand" "r")))
1317 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1320 [(set_attr "type" "imul3")])
1322 (define_insn "*maclhwuc"
1323 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1324 (compare:CC (plus:SI (mult:SI (zero_extend:SI
1325 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1327 (match_operand:HI 2 "gpc_reg_operand" "r")))
1328 (match_operand:SI 4 "gpc_reg_operand" "0"))
1330 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1331 (plus:SI (mult:SI (zero_extend:SI
1338 [(set_attr "type" "imul3")])
1340 (define_insn "*maclhwu"
1341 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1342 (plus:SI (mult:SI (zero_extend:SI
1343 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1345 (match_operand:HI 2 "gpc_reg_operand" "r")))
1346 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1349 [(set_attr "type" "imul3")])
1351 (define_insn "*nmacchwc"
1352 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1353 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1354 (mult:SI (ashiftrt:SI
1355 (match_operand:SI 2 "gpc_reg_operand" "r")
1358 (match_operand:HI 1 "gpc_reg_operand" "r"))))
1360 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1361 (minus:SI (match_dup 4)
1362 (mult:SI (ashiftrt:SI
1369 [(set_attr "type" "imul3")])
1371 (define_insn "*nmacchw"
1372 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1373 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1374 (mult:SI (ashiftrt:SI
1375 (match_operand:SI 2 "gpc_reg_operand" "r")
1378 (match_operand:HI 1 "gpc_reg_operand" "r")))))]
1381 [(set_attr "type" "imul3")])
1383 (define_insn "*nmachhwc"
1384 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1385 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1386 (mult:SI (ashiftrt:SI
1387 (match_operand:SI 1 "gpc_reg_operand" "%r")
1390 (match_operand:SI 2 "gpc_reg_operand" "r")
1393 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1394 (minus:SI (match_dup 4)
1395 (mult:SI (ashiftrt:SI
1403 [(set_attr "type" "imul3")])
1405 (define_insn "*nmachhw"
1406 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1407 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1408 (mult:SI (ashiftrt:SI
1409 (match_operand:SI 1 "gpc_reg_operand" "%r")
1412 (match_operand:SI 2 "gpc_reg_operand" "r")
1416 [(set_attr "type" "imul3")])
1418 (define_insn "*nmaclhwc"
1419 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1420 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1421 (mult:SI (sign_extend:SI
1422 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1424 (match_operand:HI 2 "gpc_reg_operand" "r"))))
1426 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1427 (minus:SI (match_dup 4)
1428 (mult:SI (sign_extend:SI
1434 [(set_attr "type" "imul3")])
1436 (define_insn "*nmaclhw"
1437 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1438 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1439 (mult:SI (sign_extend:SI
1440 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1442 (match_operand:HI 2 "gpc_reg_operand" "r")))))]
1445 [(set_attr "type" "imul3")])
1447 (define_insn "*mulchwc"
1448 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1449 (compare:CC (mult:SI (ashiftrt:SI
1450 (match_operand:SI 2 "gpc_reg_operand" "r")
1453 (match_operand:HI 1 "gpc_reg_operand" "r")))
1455 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1456 (mult:SI (ashiftrt:SI
1463 [(set_attr "type" "imul3")])
1465 (define_insn "*mulchw"
1466 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1467 (mult:SI (ashiftrt:SI
1468 (match_operand:SI 2 "gpc_reg_operand" "r")
1471 (match_operand:HI 1 "gpc_reg_operand" "r"))))]
1474 [(set_attr "type" "imul3")])
1476 (define_insn "*mulchwuc"
1477 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1478 (compare:CC (mult:SI (lshiftrt:SI
1479 (match_operand:SI 2 "gpc_reg_operand" "r")
1482 (match_operand:HI 1 "gpc_reg_operand" "r")))
1484 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1485 (mult:SI (lshiftrt:SI
1492 [(set_attr "type" "imul3")])
1494 (define_insn "*mulchwu"
1495 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1496 (mult:SI (lshiftrt:SI
1497 (match_operand:SI 2 "gpc_reg_operand" "r")
1500 (match_operand:HI 1 "gpc_reg_operand" "r"))))]
1503 [(set_attr "type" "imul3")])
1505 (define_insn "*mulhhwc"
1506 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1507 (compare:CC (mult:SI (ashiftrt:SI
1508 (match_operand:SI 1 "gpc_reg_operand" "%r")
1511 (match_operand:SI 2 "gpc_reg_operand" "r")
1514 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1515 (mult:SI (ashiftrt:SI
1523 [(set_attr "type" "imul3")])
1525 (define_insn "*mulhhw"
1526 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1527 (mult:SI (ashiftrt:SI
1528 (match_operand:SI 1 "gpc_reg_operand" "%r")
1531 (match_operand:SI 2 "gpc_reg_operand" "r")
1535 [(set_attr "type" "imul3")])
1537 (define_insn "*mulhhwuc"
1538 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1539 (compare:CC (mult:SI (lshiftrt:SI
1540 (match_operand:SI 1 "gpc_reg_operand" "%r")
1543 (match_operand:SI 2 "gpc_reg_operand" "r")
1546 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1547 (mult:SI (lshiftrt:SI
1555 [(set_attr "type" "imul3")])
1557 (define_insn "*mulhhwu"
1558 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1559 (mult:SI (lshiftrt:SI
1560 (match_operand:SI 1 "gpc_reg_operand" "%r")
1563 (match_operand:SI 2 "gpc_reg_operand" "r")
1567 [(set_attr "type" "imul3")])
1569 (define_insn "*mullhwc"
1570 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1571 (compare:CC (mult:SI (sign_extend:SI
1572 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1574 (match_operand:HI 2 "gpc_reg_operand" "r")))
1576 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1577 (mult:SI (sign_extend:SI
1583 [(set_attr "type" "imul3")])
1585 (define_insn "*mullhw"
1586 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1587 (mult:SI (sign_extend:SI
1588 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1590 (match_operand:HI 2 "gpc_reg_operand" "r"))))]
1593 [(set_attr "type" "imul3")])
1595 (define_insn "*mullhwuc"
1596 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1597 (compare:CC (mult:SI (zero_extend:SI
1598 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1600 (match_operand:HI 2 "gpc_reg_operand" "r")))
1602 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1603 (mult:SI (zero_extend:SI
1609 [(set_attr "type" "imul3")])
1611 (define_insn "*mullhwu"
1612 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1613 (mult:SI (zero_extend:SI
1614 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1616 (match_operand:HI 2 "gpc_reg_operand" "r"))))]
1619 [(set_attr "type" "imul3")])
1621 ;; IBM 405, 440, 464 and 476 string-search dlmzb instruction support.
1622 (define_insn "dlmzb"
1623 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1624 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
1625 (match_operand:SI 2 "gpc_reg_operand" "r")]
1627 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1628 (unspec:SI [(match_dup 1)
1634 (define_expand "strlensi"
1635 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1636 (unspec:SI [(match_operand:BLK 1 "general_operand" "")
1637 (match_operand:QI 2 "const_int_operand" "")
1638 (match_operand 3 "const_int_operand" "")]
1639 UNSPEC_DLMZB_STRLEN))
1640 (clobber (match_scratch:CC 4 "=x"))]
1641 "TARGET_DLMZB && WORDS_BIG_ENDIAN && !optimize_size"
1643 rtx result = operands[0];
1644 rtx src = operands[1];
1645 rtx search_char = operands[2];
1646 rtx align = operands[3];
1647 rtx addr, scratch_string, word1, word2, scratch_dlmzb;
1648 rtx loop_label, end_label, mem, cr0, cond;
1649 if (search_char != const0_rtx
1650 || GET_CODE (align) != CONST_INT
1651 || INTVAL (align) < 8)
1653 word1 = gen_reg_rtx (SImode);
1654 word2 = gen_reg_rtx (SImode);
1655 scratch_dlmzb = gen_reg_rtx (SImode);
1656 scratch_string = gen_reg_rtx (Pmode);
1657 loop_label = gen_label_rtx ();
1658 end_label = gen_label_rtx ();
1659 addr = force_reg (Pmode, XEXP (src, 0));
1660 emit_move_insn (scratch_string, addr);
1661 emit_label (loop_label);
1662 mem = change_address (src, SImode, scratch_string);
1663 emit_move_insn (word1, mem);
1664 emit_move_insn (word2, adjust_address (mem, SImode, 4));
1665 cr0 = gen_rtx_REG (CCmode, CR0_REGNO);
1666 emit_insn (gen_dlmzb (scratch_dlmzb, word1, word2, cr0));
1667 cond = gen_rtx_NE (VOIDmode, cr0, const0_rtx);
1668 emit_jump_insn (gen_rtx_SET (VOIDmode,
1670 gen_rtx_IF_THEN_ELSE (VOIDmode,
1676 emit_insn (gen_addsi3 (scratch_string, scratch_string, GEN_INT (8)));
1677 emit_jump_insn (gen_rtx_SET (VOIDmode,
1679 gen_rtx_LABEL_REF (VOIDmode, loop_label)));
1681 emit_label (end_label);
1682 emit_insn (gen_addsi3 (scratch_string, scratch_string, scratch_dlmzb));
1683 emit_insn (gen_subsi3 (result, scratch_string, addr));
1684 emit_insn (gen_subsi3 (result, result, const1_rtx));
1688 ;; Fixed-point arithmetic insns.
1690 (define_expand "add<mode>3"
1691 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1692 (plus:SDI (match_operand:SDI 1 "gpc_reg_operand" "")
1693 (match_operand:SDI 2 "reg_or_add_cint_operand" "")))]
1696 if (<MODE>mode == DImode && ! TARGET_POWERPC64)
1698 if (non_short_cint_operand (operands[2], DImode))
1701 else if (GET_CODE (operands[2]) == CONST_INT
1702 && ! add_operand (operands[2], <MODE>mode))
1704 rtx tmp = ((!can_create_pseudo_p ()
1705 || rtx_equal_p (operands[0], operands[1]))
1706 ? operands[0] : gen_reg_rtx (<MODE>mode));
1708 HOST_WIDE_INT val = INTVAL (operands[2]);
1709 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1710 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, <MODE>mode);
1712 if (<MODE>mode == DImode && !satisfies_constraint_L (GEN_INT (rest)))
1715 /* The ordering here is important for the prolog expander.
1716 When space is allocated from the stack, adding 'low' first may
1717 produce a temporary deallocation (which would be bad). */
1718 emit_insn (gen_add<mode>3 (tmp, operands[1], GEN_INT (rest)));
1719 emit_insn (gen_add<mode>3 (operands[0], tmp, GEN_INT (low)));
1724 ;; Discourage ai/addic because of carry but provide it in an alternative
1725 ;; allowing register zero as source.
1726 (define_insn "*add<mode>3_internal1"
1727 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r,?r,r")
1728 (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "%r,b,r,b")
1729 (match_operand:GPR 2 "add_operand" "r,I,I,L")))]
1730 "!DECIMAL_FLOAT_MODE_P (GET_MODE (operands[0])) && !DECIMAL_FLOAT_MODE_P (GET_MODE (operands[1]))"
1736 [(set_attr "length" "4,4,4,4")])
1738 (define_insn "addsi3_high"
1739 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
1740 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
1741 (high:SI (match_operand 2 "" ""))))]
1742 "TARGET_MACHO && !TARGET_64BIT"
1743 "addis %0,%1,ha16(%2)"
1744 [(set_attr "length" "4")])
1746 (define_insn "*add<mode>3_internal2"
1747 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
1748 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "%r,r,r,r")
1749 (match_operand:P 2 "reg_or_short_operand" "r,I,r,I"))
1751 (clobber (match_scratch:P 3 "=r,r,r,r"))]
1758 [(set_attr "type" "fast_compare,compare,compare,compare")
1759 (set_attr "length" "4,4,8,8")])
1762 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1763 (compare:CC (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1764 (match_operand:GPR 2 "reg_or_short_operand" ""))
1766 (clobber (match_scratch:GPR 3 ""))]
1769 (plus:GPR (match_dup 1)
1772 (compare:CC (match_dup 3)
1776 (define_insn "*add<mode>3_internal3"
1777 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
1778 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "%r,r,r,r")
1779 (match_operand:P 2 "reg_or_short_operand" "r,I,r,I"))
1781 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
1782 (plus:P (match_dup 1)
1790 [(set_attr "type" "fast_compare,compare,compare,compare")
1791 (set_attr "length" "4,4,8,8")])
1794 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1795 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "")
1796 (match_operand:P 2 "reg_or_short_operand" ""))
1798 (set (match_operand:P 0 "gpc_reg_operand" "")
1799 (plus:P (match_dup 1) (match_dup 2)))]
1802 (plus:P (match_dup 1)
1805 (compare:CC (match_dup 0)
1809 ;; Split an add that we can't do in one insn into two insns, each of which
1810 ;; does one 16-bit part. This is used by combine. Note that the low-order
1811 ;; add should be last in case the result gets used in an address.
1814 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
1815 (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1816 (match_operand:GPR 2 "non_add_cint_operand" "")))]
1818 [(set (match_dup 0) (plus:GPR (match_dup 1) (match_dup 3)))
1819 (set (match_dup 0) (plus:GPR (match_dup 0) (match_dup 4)))]
1821 HOST_WIDE_INT val = INTVAL (operands[2]);
1822 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1823 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, <MODE>mode);
1825 operands[4] = GEN_INT (low);
1826 if (<MODE>mode == SImode || satisfies_constraint_L (GEN_INT (rest)))
1827 operands[3] = GEN_INT (rest);
1828 else if (can_create_pseudo_p ())
1830 operands[3] = gen_reg_rtx (DImode);
1831 emit_move_insn (operands[3], operands[2]);
1832 emit_insn (gen_adddi3 (operands[0], operands[1], operands[3]));
1839 (define_insn "one_cmpl<mode>2"
1840 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1841 (not:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
1846 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1847 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1849 (clobber (match_scratch:P 2 "=r,r"))]
1854 [(set_attr "type" "fast_compare,compare")
1855 (set_attr "length" "4,8")])
1858 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
1859 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" ""))
1861 (clobber (match_scratch:P 2 ""))]
1864 (not:P (match_dup 1)))
1866 (compare:CC (match_dup 2)
1871 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1872 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1874 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
1875 (not:P (match_dup 1)))]
1880 [(set_attr "type" "fast_compare,compare")
1881 (set_attr "length" "4,8")])
1884 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
1885 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" ""))
1887 (set (match_operand:P 0 "gpc_reg_operand" "")
1888 (not:P (match_dup 1)))]
1891 (not:P (match_dup 1)))
1893 (compare:CC (match_dup 0)
1898 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
1899 (minus:GPR (match_operand:GPR 1 "reg_or_short_operand" "r,I")
1900 (match_operand:GPR 2 "gpc_reg_operand" "r,r")))]
1907 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1908 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "r,r")
1909 (match_operand:P 2 "gpc_reg_operand" "r,r"))
1911 (clobber (match_scratch:P 3 "=r,r"))]
1916 [(set_attr "type" "fast_compare")
1917 (set_attr "length" "4,8")])
1920 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1921 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "")
1922 (match_operand:P 2 "gpc_reg_operand" ""))
1924 (clobber (match_scratch:P 3 ""))]
1927 (minus:P (match_dup 1)
1930 (compare:CC (match_dup 3)
1935 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1936 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "r,r")
1937 (match_operand:P 2 "gpc_reg_operand" "r,r"))
1939 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
1940 (minus:P (match_dup 1)
1946 [(set_attr "type" "fast_compare")
1947 (set_attr "length" "4,8")])
1950 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1951 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "")
1952 (match_operand:P 2 "gpc_reg_operand" ""))
1954 (set (match_operand:P 0 "gpc_reg_operand" "")
1955 (minus:P (match_dup 1)
1959 (minus:P (match_dup 1)
1962 (compare:CC (match_dup 0)
1966 (define_expand "sub<mode>3"
1967 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1968 (minus:SDI (match_operand:SDI 1 "reg_or_short_operand" "")
1969 (match_operand:SDI 2 "reg_or_sub_cint_operand" "")))]
1973 if (GET_CODE (operands[2]) == CONST_INT)
1975 emit_insn (gen_add<mode>3 (operands[0], operands[1],
1976 negate_rtx (<MODE>mode, operands[2])));
1981 (define_expand "neg<mode>2"
1982 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1983 (neg:SDI (match_operand:SDI 1 "gpc_reg_operand" "")))]
1987 (define_insn "*neg<mode>2_internal"
1988 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1989 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
1994 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1995 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1997 (clobber (match_scratch:P 2 "=r,r"))]
2002 [(set_attr "type" "fast_compare")
2003 (set_attr "length" "4,8")])
2006 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2007 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" ""))
2009 (clobber (match_scratch:P 2 ""))]
2012 (neg:P (match_dup 1)))
2014 (compare:CC (match_dup 2)
2019 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
2020 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
2022 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
2023 (neg:P (match_dup 1)))]
2028 [(set_attr "type" "fast_compare")
2029 (set_attr "length" "4,8")])
2032 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
2033 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" ""))
2035 (set (match_operand:P 0 "gpc_reg_operand" "")
2036 (neg:P (match_dup 1)))]
2039 (neg:P (match_dup 1)))
2041 (compare:CC (match_dup 0)
2045 (define_insn "clz<mode>2"
2046 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2047 (clz:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
2050 [(set_attr "type" "cntlz")])
2052 (define_expand "ctz<mode>2"
2054 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))
2055 (parallel [(set (match_dup 3) (and:GPR (match_dup 1)
2057 (clobber (scratch:CC))])
2058 (set (match_dup 4) (clz:GPR (match_dup 3)))
2059 (set (match_operand:GPR 0 "gpc_reg_operand" "")
2060 (minus:GPR (match_dup 5) (match_dup 4)))]
2063 operands[2] = gen_reg_rtx (<MODE>mode);
2064 operands[3] = gen_reg_rtx (<MODE>mode);
2065 operands[4] = gen_reg_rtx (<MODE>mode);
2066 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode) - 1);
2069 (define_expand "ffs<mode>2"
2071 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))
2072 (parallel [(set (match_dup 3) (and:GPR (match_dup 1)
2074 (clobber (scratch:CC))])
2075 (set (match_dup 4) (clz:GPR (match_dup 3)))
2076 (set (match_operand:GPR 0 "gpc_reg_operand" "")
2077 (minus:GPR (match_dup 5) (match_dup 4)))]
2080 operands[2] = gen_reg_rtx (<MODE>mode);
2081 operands[3] = gen_reg_rtx (<MODE>mode);
2082 operands[4] = gen_reg_rtx (<MODE>mode);
2083 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode));
2086 (define_insn "popcntb<mode>2"
2087 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2088 (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")]
2092 [(set_attr "length" "4")
2093 (set_attr "type" "popcnt")])
2095 (define_insn "popcntd<mode>2"
2096 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2097 (popcount:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
2100 [(set_attr "length" "4")
2101 (set_attr "type" "popcnt")])
2103 (define_expand "popcount<mode>2"
2104 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2105 (popcount:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))]
2106 "TARGET_POPCNTB || TARGET_POPCNTD"
2108 rs6000_emit_popcount (operands[0], operands[1]);
2112 (define_insn "parity<mode>2_cmpb"
2113 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2114 (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")] UNSPEC_PARITY))]
2115 "TARGET_CMPB && TARGET_POPCNTB"
2117 [(set_attr "length" "4")
2118 (set_attr "type" "popcnt")])
2120 (define_expand "parity<mode>2"
2121 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2122 (parity:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))]
2125 rs6000_emit_parity (operands[0], operands[1]);
2129 ;; Since the hardware zeros the upper part of the register, save generating the
2130 ;; AND immediate if we are converting to unsigned
2131 (define_insn "*bswaphi2_extenddi"
2132 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
2134 (bswap:HI (match_operand:HI 1 "memory_operand" "Z"))))]
2137 [(set_attr "length" "4")
2138 (set_attr "type" "load")])
2140 (define_insn "*bswaphi2_extendsi"
2141 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2143 (bswap:HI (match_operand:HI 1 "memory_operand" "Z"))))]
2146 [(set_attr "length" "4")
2147 (set_attr "type" "load")])
2149 (define_expand "bswaphi2"
2150 [(parallel [(set (match_operand:HI 0 "reg_or_mem_operand" "")
2152 (match_operand:HI 1 "reg_or_mem_operand" "")))
2153 (clobber (match_scratch:SI 2 ""))])]
2156 if (!REG_P (operands[0]) && !REG_P (operands[1]))
2157 operands[1] = force_reg (HImode, operands[1]);
2160 (define_insn "bswaphi2_internal"
2161 [(set (match_operand:HI 0 "reg_or_mem_operand" "=r,Z,&r")
2163 (match_operand:HI 1 "reg_or_mem_operand" "Z,r,r")))
2164 (clobber (match_scratch:SI 2 "=X,X,&r"))]
2170 [(set_attr "length" "4,4,12")
2171 (set_attr "type" "load,store,*")])
2173 ;; We are always BITS_BIG_ENDIAN, so the (const_int 16) below is
2174 ;; correct for -mlittle as well as -mbig.
2176 [(set (match_operand:HI 0 "gpc_reg_operand" "")
2177 (bswap:HI (match_operand:HI 1 "gpc_reg_operand" "")))
2178 (clobber (match_operand:SI 2 "gpc_reg_operand" ""))]
2181 (zero_extract:SI (match_dup 4)
2185 (and:SI (ashift:SI (match_dup 4)
2187 (const_int 65280))) ;; 0xff00
2189 (ior:SI (match_dup 3)
2193 operands[3] = simplify_gen_subreg (SImode, operands[0], HImode, 0);
2194 operands[4] = simplify_gen_subreg (SImode, operands[1], HImode, 0);
2197 (define_insn "*bswapsi2_extenddi"
2198 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
2200 (bswap:SI (match_operand:SI 1 "memory_operand" "Z"))))]
2203 [(set_attr "length" "4")
2204 (set_attr "type" "load")])
2206 (define_expand "bswapsi2"
2207 [(set (match_operand:SI 0 "reg_or_mem_operand" "")
2209 (match_operand:SI 1 "reg_or_mem_operand" "")))]
2212 if (!REG_P (operands[0]) && !REG_P (operands[1]))
2213 operands[1] = force_reg (SImode, operands[1]);
2216 (define_insn "*bswapsi2_internal"
2217 [(set (match_operand:SI 0 "reg_or_mem_operand" "=r,Z,&r")
2219 (match_operand:SI 1 "reg_or_mem_operand" "Z,r,r")))]
2225 [(set_attr "length" "4,4,12")
2226 (set_attr "type" "load,store,*")])
2228 ;; We are always BITS_BIG_ENDIAN, so the bit positions below in
2229 ;; zero_extract insns do not change for -mlittle.
2231 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2232 (bswap:SI (match_operand:SI 1 "gpc_reg_operand" "")))]
2235 (rotate:SI (match_dup 1) (const_int 8)))
2236 (set (zero_extract:SI (match_dup 0)
2240 (set (zero_extract:SI (match_dup 0)
2243 (rotate:SI (match_dup 1)
2247 (define_expand "bswapdi2"
2248 [(parallel [(set (match_operand:DI 0 "reg_or_mem_operand" "")
2250 (match_operand:DI 1 "reg_or_mem_operand" "")))
2251 (clobber (match_scratch:DI 2 ""))
2252 (clobber (match_scratch:DI 3 ""))
2253 (clobber (match_scratch:DI 4 ""))])]
2256 if (!REG_P (operands[0]) && !REG_P (operands[1]))
2257 operands[1] = force_reg (DImode, operands[1]);
2259 if (!TARGET_POWERPC64)
2261 /* 32-bit mode needs fewer scratch registers, but 32-bit addressing mode
2262 that uses 64-bit registers needs the same scratch registers as 64-bit
2264 emit_insn (gen_bswapdi2_32bit (operands[0], operands[1]));
2269 ;; Power7/cell has ldbrx/stdbrx, so use it directly
2270 (define_insn "*bswapdi2_ldbrx"
2271 [(set (match_operand:DI 0 "reg_or_mem_operand" "=&r,Z,??&r")
2272 (bswap:DI (match_operand:DI 1 "reg_or_mem_operand" "Z,r,r")))
2273 (clobber (match_scratch:DI 2 "=X,X,&r"))
2274 (clobber (match_scratch:DI 3 "=X,X,&r"))
2275 (clobber (match_scratch:DI 4 "=X,X,&r"))]
2276 "TARGET_POWERPC64 && TARGET_LDBRX
2277 && (REG_P (operands[0]) || REG_P (operands[1]))"
2282 [(set_attr "length" "4,4,36")
2283 (set_attr "type" "load,store,*")])
2285 ;; Non-power7/cell, fall back to use lwbrx/stwbrx
2286 (define_insn "*bswapdi2_64bit"
2287 [(set (match_operand:DI 0 "reg_or_mem_operand" "=&r,Z,??&r")
2288 (bswap:DI (match_operand:DI 1 "reg_or_mem_operand" "Z,r,r")))
2289 (clobber (match_scratch:DI 2 "=&b,&b,&r"))
2290 (clobber (match_scratch:DI 3 "=&r,&r,&r"))
2291 (clobber (match_scratch:DI 4 "=&r,X,&r"))]
2292 "TARGET_POWERPC64 && !TARGET_LDBRX
2293 && (REG_P (operands[0]) || REG_P (operands[1]))"
2295 [(set_attr "length" "16,12,36")])
2298 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2299 (bswap:DI (match_operand:DI 1 "indexed_or_indirect_operand" "")))
2300 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
2301 (clobber (match_operand:DI 3 "gpc_reg_operand" ""))
2302 (clobber (match_operand:DI 4 "gpc_reg_operand" ""))]
2303 "TARGET_POWERPC64 && !TARGET_LDBRX && reload_completed"
2307 rtx dest = operands[0];
2308 rtx src = operands[1];
2309 rtx op2 = operands[2];
2310 rtx op3 = operands[3];
2311 rtx op4 = operands[4];
2312 rtx op3_32 = simplify_gen_subreg (SImode, op3, DImode,
2313 BYTES_BIG_ENDIAN ? 4 : 0);
2314 rtx op4_32 = simplify_gen_subreg (SImode, op4, DImode,
2315 BYTES_BIG_ENDIAN ? 4 : 0);
2321 addr1 = XEXP (src, 0);
2322 if (GET_CODE (addr1) == PLUS)
2324 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2325 if (TARGET_AVOID_XFORM)
2327 emit_insn (gen_add3_insn (op2, XEXP (addr1, 1), op2));
2331 addr2 = gen_rtx_PLUS (Pmode, op2, XEXP (addr1, 1));
2333 else if (TARGET_AVOID_XFORM)
2335 emit_insn (gen_add3_insn (op2, addr1, GEN_INT (4)));
2340 emit_move_insn (op2, GEN_INT (4));
2341 addr2 = gen_rtx_PLUS (Pmode, op2, addr1);
2344 if (BYTES_BIG_ENDIAN)
2346 word_high = change_address (src, SImode, addr1);
2347 word_low = change_address (src, SImode, addr2);
2351 word_high = change_address (src, SImode, addr2);
2352 word_low = change_address (src, SImode, addr1);
2355 emit_insn (gen_bswapsi2 (op3_32, word_low));
2356 emit_insn (gen_bswapsi2 (op4_32, word_high));
2357 emit_insn (gen_ashldi3 (dest, op3, GEN_INT (32)));
2358 emit_insn (gen_iordi3 (dest, dest, op4));
2362 [(set (match_operand:DI 0 "indexed_or_indirect_operand" "")
2363 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2364 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
2365 (clobber (match_operand:DI 3 "gpc_reg_operand" ""))
2366 (clobber (match_operand:DI 4 "" ""))]
2367 "TARGET_POWERPC64 && !TARGET_LDBRX && reload_completed"
2371 rtx dest = operands[0];
2372 rtx src = operands[1];
2373 rtx op2 = operands[2];
2374 rtx op3 = operands[3];
2375 rtx src_si = simplify_gen_subreg (SImode, src, DImode,
2376 BYTES_BIG_ENDIAN ? 4 : 0);
2377 rtx op3_si = simplify_gen_subreg (SImode, op3, DImode,
2378 BYTES_BIG_ENDIAN ? 4 : 0);
2384 addr1 = XEXP (dest, 0);
2385 if (GET_CODE (addr1) == PLUS)
2387 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2388 if (TARGET_AVOID_XFORM)
2390 emit_insn (gen_add3_insn (op2, XEXP (addr1, 1), op2));
2394 addr2 = gen_rtx_PLUS (Pmode, op2, XEXP (addr1, 1));
2396 else if (TARGET_AVOID_XFORM)
2398 emit_insn (gen_add3_insn (op2, addr1, GEN_INT (4)));
2403 emit_move_insn (op2, GEN_INT (4));
2404 addr2 = gen_rtx_PLUS (Pmode, op2, addr1);
2407 emit_insn (gen_lshrdi3 (op3, src, GEN_INT (32)));
2408 if (BYTES_BIG_ENDIAN)
2410 word_high = change_address (dest, SImode, addr1);
2411 word_low = change_address (dest, SImode, addr2);
2415 word_high = change_address (dest, SImode, addr2);
2416 word_low = change_address (dest, SImode, addr1);
2418 emit_insn (gen_bswapsi2 (word_high, src_si));
2419 emit_insn (gen_bswapsi2 (word_low, op3_si));
2423 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2424 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2425 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
2426 (clobber (match_operand:DI 3 "gpc_reg_operand" ""))
2427 (clobber (match_operand:DI 4 "" ""))]
2428 "TARGET_POWERPC64 && reload_completed"
2432 rtx dest = operands[0];
2433 rtx src = operands[1];
2434 rtx op2 = operands[2];
2435 rtx op3 = operands[3];
2436 int lo_off = BYTES_BIG_ENDIAN ? 4 : 0;
2437 rtx dest_si = simplify_gen_subreg (SImode, dest, DImode, lo_off);
2438 rtx src_si = simplify_gen_subreg (SImode, src, DImode, lo_off);
2439 rtx op2_si = simplify_gen_subreg (SImode, op2, DImode, lo_off);
2440 rtx op3_si = simplify_gen_subreg (SImode, op3, DImode, lo_off);
2442 emit_insn (gen_lshrdi3 (op2, src, GEN_INT (32)));
2443 emit_insn (gen_bswapsi2 (dest_si, src_si));
2444 emit_insn (gen_bswapsi2 (op3_si, op2_si));
2445 emit_insn (gen_ashldi3 (dest, dest, GEN_INT (32)));
2446 emit_insn (gen_iordi3 (dest, dest, op3));
2449 (define_insn "bswapdi2_32bit"
2450 [(set (match_operand:DI 0 "reg_or_mem_operand" "=&r,Z,??&r")
2451 (bswap:DI (match_operand:DI 1 "reg_or_mem_operand" "Z,r,r")))
2452 (clobber (match_scratch:SI 2 "=&b,&b,X"))]
2453 "!TARGET_POWERPC64 && (REG_P (operands[0]) || REG_P (operands[1]))"
2455 [(set_attr "length" "16,12,36")])
2458 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2459 (bswap:DI (match_operand:DI 1 "indexed_or_indirect_operand" "")))
2460 (clobber (match_operand:SI 2 "gpc_reg_operand" ""))]
2461 "!TARGET_POWERPC64 && reload_completed"
2465 rtx dest = operands[0];
2466 rtx src = operands[1];
2467 rtx op2 = operands[2];
2468 rtx dest1 = simplify_gen_subreg (SImode, dest, DImode, 0);
2469 rtx dest2 = simplify_gen_subreg (SImode, dest, DImode, 4);
2475 addr1 = XEXP (src, 0);
2476 if (GET_CODE (addr1) == PLUS)
2478 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2479 if (TARGET_AVOID_XFORM)
2481 emit_insn (gen_add3_insn (op2, XEXP (addr1, 1), op2));
2485 addr2 = gen_rtx_PLUS (SImode, op2, XEXP (addr1, 1));
2487 else if (TARGET_AVOID_XFORM)
2489 emit_insn (gen_add3_insn (op2, addr1, GEN_INT (4)));
2494 emit_move_insn (op2, GEN_INT (4));
2495 addr2 = gen_rtx_PLUS (SImode, op2, addr1);
2498 word1 = change_address (src, SImode, addr1);
2499 word2 = change_address (src, SImode, addr2);
2501 emit_insn (gen_bswapsi2 (dest2, word1));
2502 emit_insn (gen_bswapsi2 (dest1, word2));
2506 [(set (match_operand:DI 0 "indexed_or_indirect_operand" "")
2507 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2508 (clobber (match_operand:SI 2 "gpc_reg_operand" ""))]
2509 "!TARGET_POWERPC64 && reload_completed"
2513 rtx dest = operands[0];
2514 rtx src = operands[1];
2515 rtx op2 = operands[2];
2516 rtx src1 = simplify_gen_subreg (SImode, src, DImode, 0);
2517 rtx src2 = simplify_gen_subreg (SImode, src, DImode, 4);
2523 addr1 = XEXP (dest, 0);
2524 if (GET_CODE (addr1) == PLUS)
2526 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2527 if (TARGET_AVOID_XFORM)
2529 emit_insn (gen_add3_insn (op2, XEXP (addr1, 1), op2));
2533 addr2 = gen_rtx_PLUS (SImode, op2, XEXP (addr1, 1));
2535 else if (TARGET_AVOID_XFORM)
2537 emit_insn (gen_add3_insn (op2, addr1, GEN_INT (4)));
2542 emit_move_insn (op2, GEN_INT (4));
2543 addr2 = gen_rtx_PLUS (SImode, op2, addr1);
2546 word1 = change_address (dest, SImode, addr1);
2547 word2 = change_address (dest, SImode, addr2);
2549 emit_insn (gen_bswapsi2 (word2, src1));
2550 emit_insn (gen_bswapsi2 (word1, src2));
2554 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2555 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2556 (clobber (match_operand:SI 2 "" ""))]
2557 "!TARGET_POWERPC64 && reload_completed"
2561 rtx dest = operands[0];
2562 rtx src = operands[1];
2563 rtx src1 = simplify_gen_subreg (SImode, src, DImode, 0);
2564 rtx src2 = simplify_gen_subreg (SImode, src, DImode, 4);
2565 rtx dest1 = simplify_gen_subreg (SImode, dest, DImode, 0);
2566 rtx dest2 = simplify_gen_subreg (SImode, dest, DImode, 4);
2568 emit_insn (gen_bswapsi2 (dest1, src2));
2569 emit_insn (gen_bswapsi2 (dest2, src1));
2572 (define_insn "mulsi3"
2573 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2574 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2575 (match_operand:SI 2 "reg_or_short_operand" "r,I")))]
2581 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
2582 (const_string "imul3")
2583 (match_operand:SI 2 "short_cint_operand" "")
2584 (const_string "imul2")]
2585 (const_string "imul")))])
2587 (define_insn "*mulsi3_internal1"
2588 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2589 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2590 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2592 (clobber (match_scratch:SI 3 "=r,r"))]
2597 [(set_attr "type" "imul_compare")
2598 (set_attr "length" "4,8")])
2601 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
2602 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2603 (match_operand:SI 2 "gpc_reg_operand" ""))
2605 (clobber (match_scratch:SI 3 ""))]
2608 (mult:SI (match_dup 1) (match_dup 2)))
2610 (compare:CC (match_dup 3)
2614 (define_insn "*mulsi3_internal2"
2615 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2616 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2617 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2619 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2620 (mult:SI (match_dup 1) (match_dup 2)))]
2625 [(set_attr "type" "imul_compare")
2626 (set_attr "length" "4,8")])
2629 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
2630 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2631 (match_operand:SI 2 "gpc_reg_operand" ""))
2633 (set (match_operand:SI 0 "gpc_reg_operand" "")
2634 (mult:SI (match_dup 1) (match_dup 2)))]
2637 (mult:SI (match_dup 1) (match_dup 2)))
2639 (compare:CC (match_dup 0)
2644 (define_insn "udiv<mode>3"
2645 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2646 (udiv:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2647 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
2651 (cond [(match_operand:SI 0 "" "")
2652 (const_string "idiv")]
2653 (const_string "ldiv")))])
2656 ;; For powers of two we can do srai/aze for divide and then adjust for
2657 ;; modulus. If it isn't a power of two, force operands into register and do
2659 (define_expand "div<mode>3"
2660 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2661 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2662 (match_operand:GPR 2 "reg_or_cint_operand" "")))]
2665 if (GET_CODE (operands[2]) != CONST_INT
2666 || INTVAL (operands[2]) <= 0
2667 || exact_log2 (INTVAL (operands[2])) < 0)
2668 operands[2] = force_reg (<MODE>mode, operands[2]);
2671 (define_insn "*div<mode>3"
2672 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2673 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2674 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
2678 (cond [(match_operand:SI 0 "" "")
2679 (const_string "idiv")]
2680 (const_string "ldiv")))])
2682 (define_expand "mod<mode>3"
2683 [(use (match_operand:GPR 0 "gpc_reg_operand" ""))
2684 (use (match_operand:GPR 1 "gpc_reg_operand" ""))
2685 (use (match_operand:GPR 2 "reg_or_cint_operand" ""))]
2693 if (GET_CODE (operands[2]) != CONST_INT
2694 || INTVAL (operands[2]) <= 0
2695 || (i = exact_log2 (INTVAL (operands[2]))) < 0)
2698 temp1 = gen_reg_rtx (<MODE>mode);
2699 temp2 = gen_reg_rtx (<MODE>mode);
2701 emit_insn (gen_div<mode>3 (temp1, operands[1], operands[2]));
2702 emit_insn (gen_ashl<mode>3 (temp2, temp1, GEN_INT (i)));
2703 emit_insn (gen_sub<mode>3 (operands[0], operands[1], temp2));
2708 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2709 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2710 (match_operand:GPR 2 "exact_log2_cint_operand" "N")))]
2712 "sra<wd>i %0,%1,%p2\;addze %0,%0"
2713 [(set_attr "type" "two")
2714 (set_attr "length" "8")])
2717 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2718 (compare:CC (div:P (match_operand:P 1 "gpc_reg_operand" "r,r")
2719 (match_operand:P 2 "exact_log2_cint_operand" "N,N"))
2721 (clobber (match_scratch:P 3 "=r,r"))]
2724 sra<wd>i %3,%1,%p2\;addze. %3,%3
2726 [(set_attr "type" "compare")
2727 (set_attr "length" "8,12")
2728 (set_attr "cell_micro" "not")])
2731 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2732 (compare:CC (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2733 (match_operand:GPR 2 "exact_log2_cint_operand"
2736 (clobber (match_scratch:GPR 3 ""))]
2739 (div:<MODE> (match_dup 1) (match_dup 2)))
2741 (compare:CC (match_dup 3)
2746 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2747 (compare:CC (div:P (match_operand:P 1 "gpc_reg_operand" "r,r")
2748 (match_operand:P 2 "exact_log2_cint_operand" "N,N"))
2750 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
2751 (div:P (match_dup 1) (match_dup 2)))]
2754 sra<wd>i %0,%1,%p2\;addze. %0,%0
2756 [(set_attr "type" "compare")
2757 (set_attr "length" "8,12")
2758 (set_attr "cell_micro" "not")])
2761 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2762 (compare:CC (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2763 (match_operand:GPR 2 "exact_log2_cint_operand"
2766 (set (match_operand:GPR 0 "gpc_reg_operand" "")
2767 (div:GPR (match_dup 1) (match_dup 2)))]
2770 (div:<MODE> (match_dup 1) (match_dup 2)))
2772 (compare:CC (match_dup 0)
2776 ;; Logical instructions
2777 ;; The logical instructions are mostly combined by using match_operator,
2778 ;; but the plain AND insns are somewhat different because there is no
2779 ;; plain 'andi' (only 'andi.'), no plain 'andis', and there are all
2780 ;; those rotate-and-mask operations. Thus, the AND insns come first.
2782 (define_expand "andsi3"
2784 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2785 (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2786 (match_operand:SI 2 "and_operand" "")))
2787 (clobber (match_scratch:CC 3 ""))])]
2791 (define_insn "andsi3_mc"
2792 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
2793 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
2794 (match_operand:SI 2 "and_operand" "?r,T,K,L")))
2795 (clobber (match_scratch:CC 3 "=X,X,x,x"))]
2796 "rs6000_gen_cell_microcode"
2799 rlwinm %0,%1,0,%m2,%M2
2802 [(set_attr "type" "*,*,fast_compare,fast_compare")])
2804 (define_insn "andsi3_nomc"
2805 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2806 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2807 (match_operand:SI 2 "and_operand" "?r,T")))
2808 (clobber (match_scratch:CC 3 "=X,X"))]
2809 "!rs6000_gen_cell_microcode"
2812 rlwinm %0,%1,0,%m2,%M2")
2814 (define_insn "andsi3_internal0_nomc"
2815 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2816 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2817 (match_operand:SI 2 "and_operand" "?r,T")))]
2818 "!rs6000_gen_cell_microcode"
2821 rlwinm %0,%1,0,%m2,%M2")
2824 ;; Note to set cr's other than cr0 we do the and immediate and then
2825 ;; the test again -- this avoids a mfcr which on the higher end
2826 ;; machines causes an execution serialization
2828 (define_insn "*andsi3_internal2_mc"
2829 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2830 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2831 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2833 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2834 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2835 "TARGET_32BIT && rs6000_gen_cell_microcode"
2840 rlwinm. %3,%1,0,%m2,%M2
2845 [(set_attr "type" "fast_compare,fast_compare,fast_compare,delayed_compare,\
2846 compare,compare,compare,compare")
2847 (set_attr "length" "4,4,4,4,8,8,8,8")])
2849 (define_insn "*andsi3_internal3_mc"
2850 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2851 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2852 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2854 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2855 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2856 "TARGET_64BIT && rs6000_gen_cell_microcode"
2861 rlwinm. %3,%1,0,%m2,%M2
2866 [(set_attr "type" "compare,fast_compare,fast_compare,delayed_compare,compare,\
2867 compare,compare,compare")
2868 (set_attr "length" "8,4,4,4,8,8,8,8")])
2871 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
2872 (compare:CC (and:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2873 (match_operand:GPR 2 "and_operand" ""))
2875 (clobber (match_scratch:GPR 3 ""))
2876 (clobber (match_scratch:CC 4 ""))]
2878 [(parallel [(set (match_dup 3)
2879 (and:<MODE> (match_dup 1)
2881 (clobber (match_dup 4))])
2883 (compare:CC (match_dup 3)
2887 ;; We don't have a 32 bit "and. rt,ra,rb" for ppc64. cr is set from the
2888 ;; whole 64 bit reg, and we don't know what is in the high 32 bits.
2891 [(set (match_operand:CC 0 "cc_reg_operand" "")
2892 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2893 (match_operand:SI 2 "gpc_reg_operand" ""))
2895 (clobber (match_scratch:SI 3 ""))
2896 (clobber (match_scratch:CC 4 ""))]
2897 "TARGET_POWERPC64 && reload_completed"
2898 [(parallel [(set (match_dup 3)
2899 (and:SI (match_dup 1)
2901 (clobber (match_dup 4))])
2903 (compare:CC (match_dup 3)
2907 (define_insn "*andsi3_internal4"
2908 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2909 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2910 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2912 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
2913 (and:SI (match_dup 1)
2915 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2916 "TARGET_32BIT && rs6000_gen_cell_microcode"
2921 rlwinm. %0,%1,0,%m2,%M2
2926 [(set_attr "type" "fast_compare,fast_compare,fast_compare,delayed_compare,\
2927 compare,compare,compare,compare")
2928 (set_attr "length" "4,4,4,4,8,8,8,8")])
2930 (define_insn "*andsi3_internal5_mc"
2931 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2932 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2933 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2935 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
2936 (and:SI (match_dup 1)
2938 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2939 "TARGET_64BIT && rs6000_gen_cell_microcode"
2944 rlwinm. %0,%1,0,%m2,%M2
2949 [(set_attr "type" "compare,fast_compare,fast_compare,delayed_compare,compare,\
2950 compare,compare,compare")
2951 (set_attr "length" "8,4,4,4,8,8,8,8")])
2954 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
2955 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2956 (match_operand:SI 2 "and_operand" ""))
2958 (set (match_operand:SI 0 "gpc_reg_operand" "")
2959 (and:SI (match_dup 1)
2961 (clobber (match_scratch:CC 4 ""))]
2963 [(parallel [(set (match_dup 0)
2964 (and:SI (match_dup 1)
2966 (clobber (match_dup 4))])
2968 (compare:CC (match_dup 0)
2973 [(set (match_operand:CC 3 "cc_reg_operand" "")
2974 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2975 (match_operand:SI 2 "gpc_reg_operand" ""))
2977 (set (match_operand:SI 0 "gpc_reg_operand" "")
2978 (and:SI (match_dup 1)
2980 (clobber (match_scratch:CC 4 ""))]
2981 "TARGET_POWERPC64 && reload_completed"
2982 [(parallel [(set (match_dup 0)
2983 (and:SI (match_dup 1)
2985 (clobber (match_dup 4))])
2987 (compare:CC (match_dup 0)
2991 ;; Handle the PowerPC64 rlwinm corner case
2993 (define_insn_and_split "*andsi3_internal6"
2994 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2995 (and:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2996 (match_operand:SI 2 "mask_operand_wrap" "i")))]
3001 (and:SI (rotate:SI (match_dup 1) (match_dup 3))
3004 (rotate:SI (match_dup 0) (match_dup 5)))]
3007 int mb = extract_MB (operands[2]);
3008 int me = extract_ME (operands[2]);
3009 operands[3] = GEN_INT (me + 1);
3010 operands[5] = GEN_INT (32 - (me + 1));
3011 operands[4] = GEN_INT (~((HOST_WIDE_INT) -1 << (33 + me - mb)));
3013 [(set_attr "length" "8")])
3015 (define_expand "iorsi3"
3016 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3017 (ior:SI (match_operand:SI 1 "gpc_reg_operand" "")
3018 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
3022 if (GET_CODE (operands[2]) == CONST_INT
3023 && ! logical_operand (operands[2], SImode))
3025 HOST_WIDE_INT value = INTVAL (operands[2]);
3026 rtx tmp = ((!can_create_pseudo_p ()
3027 || rtx_equal_p (operands[0], operands[1]))
3028 ? operands[0] : gen_reg_rtx (SImode));
3030 emit_insn (gen_iorsi3 (tmp, operands[1],
3031 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
3032 emit_insn (gen_iorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
3037 (define_expand "xorsi3"
3038 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3039 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
3040 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
3044 if (GET_CODE (operands[2]) == CONST_INT
3045 && ! logical_operand (operands[2], SImode))
3047 HOST_WIDE_INT value = INTVAL (operands[2]);
3048 rtx tmp = ((!can_create_pseudo_p ()
3049 || rtx_equal_p (operands[0], operands[1]))
3050 ? operands[0] : gen_reg_rtx (SImode));
3052 emit_insn (gen_xorsi3 (tmp, operands[1],
3053 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
3054 emit_insn (gen_xorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
3059 (define_insn "*boolsi3_internal1"
3060 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
3061 (match_operator:SI 3 "boolean_or_operator"
3062 [(match_operand:SI 1 "gpc_reg_operand" "%r,r,r")
3063 (match_operand:SI 2 "logical_operand" "r,K,L")]))]
3070 (define_insn "*boolsi3_internal2"
3071 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3072 (compare:CC (match_operator:SI 4 "boolean_or_operator"
3073 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
3074 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3076 (clobber (match_scratch:SI 3 "=r,r"))]
3081 [(set_attr "type" "fast_compare,compare")
3082 (set_attr "length" "4,8")])
3085 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3086 (compare:CC (match_operator:SI 4 "boolean_operator"
3087 [(match_operand:SI 1 "gpc_reg_operand" "")
3088 (match_operand:SI 2 "gpc_reg_operand" "")])
3090 (clobber (match_scratch:SI 3 ""))]
3091 "TARGET_32BIT && reload_completed"
3092 [(set (match_dup 3) (match_dup 4))
3094 (compare:CC (match_dup 3)
3098 (define_insn "*boolsi3_internal3"
3099 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3100 (compare:CC (match_operator:SI 4 "boolean_operator"
3101 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
3102 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3104 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3110 [(set_attr "type" "fast_compare,compare")
3111 (set_attr "length" "4,8")])
3114 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3115 (compare:CC (match_operator:SI 4 "boolean_operator"
3116 [(match_operand:SI 1 "gpc_reg_operand" "")
3117 (match_operand:SI 2 "gpc_reg_operand" "")])
3119 (set (match_operand:SI 0 "gpc_reg_operand" "")
3121 "TARGET_32BIT && reload_completed"
3122 [(set (match_dup 0) (match_dup 4))
3124 (compare:CC (match_dup 0)
3128 ;; Split a logical operation that we can't do in one insn into two insns,
3129 ;; each of which does one 16-bit part. This is used by combine.
3132 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3133 (match_operator:SI 3 "boolean_or_operator"
3134 [(match_operand:SI 1 "gpc_reg_operand" "")
3135 (match_operand:SI 2 "non_logical_cint_operand" "")]))]
3137 [(set (match_dup 0) (match_dup 4))
3138 (set (match_dup 0) (match_dup 5))]
3142 i = GEN_INT (INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff));
3143 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
3145 i = GEN_INT (INTVAL (operands[2]) & 0xffff);
3146 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
3150 (define_insn "*boolcsi3_internal1"
3151 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3152 (match_operator:SI 3 "boolean_operator"
3153 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
3154 (match_operand:SI 2 "gpc_reg_operand" "r")]))]
3158 (define_insn "*boolcsi3_internal2"
3159 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3160 (compare:CC (match_operator:SI 4 "boolean_operator"
3161 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
3162 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3164 (clobber (match_scratch:SI 3 "=r,r"))]
3169 [(set_attr "type" "compare")
3170 (set_attr "length" "4,8")])
3173 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3174 (compare:CC (match_operator:SI 4 "boolean_operator"
3175 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3176 (match_operand:SI 2 "gpc_reg_operand" "")])
3178 (clobber (match_scratch:SI 3 ""))]
3179 "TARGET_32BIT && reload_completed"
3180 [(set (match_dup 3) (match_dup 4))
3182 (compare:CC (match_dup 3)
3186 (define_insn "*boolcsi3_internal3"
3187 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3188 (compare:CC (match_operator:SI 4 "boolean_operator"
3189 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
3190 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3192 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3198 [(set_attr "type" "compare")
3199 (set_attr "length" "4,8")])
3202 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3203 (compare:CC (match_operator:SI 4 "boolean_operator"
3204 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3205 (match_operand:SI 2 "gpc_reg_operand" "")])
3207 (set (match_operand:SI 0 "gpc_reg_operand" "")
3209 "TARGET_32BIT && reload_completed"
3210 [(set (match_dup 0) (match_dup 4))
3212 (compare:CC (match_dup 0)
3216 (define_insn "*boolccsi3_internal1"
3217 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3218 (match_operator:SI 3 "boolean_operator"
3219 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
3220 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))]))]
3224 (define_insn "*boolccsi3_internal2"
3225 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3226 (compare:CC (match_operator:SI 4 "boolean_operator"
3227 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
3228 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
3230 (clobber (match_scratch:SI 3 "=r,r"))]
3235 [(set_attr "type" "fast_compare,compare")
3236 (set_attr "length" "4,8")])
3239 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3240 (compare:CC (match_operator:SI 4 "boolean_operator"
3241 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3242 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
3244 (clobber (match_scratch:SI 3 ""))]
3245 "TARGET_32BIT && reload_completed"
3246 [(set (match_dup 3) (match_dup 4))
3248 (compare:CC (match_dup 3)
3252 (define_insn "*boolccsi3_internal3"
3253 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3254 (compare:CC (match_operator:SI 4 "boolean_operator"
3255 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
3256 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
3258 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3264 [(set_attr "type" "fast_compare,compare")
3265 (set_attr "length" "4,8")])
3268 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3269 (compare:CC (match_operator:SI 4 "boolean_operator"
3270 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3271 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
3273 (set (match_operand:SI 0 "gpc_reg_operand" "")
3275 "TARGET_32BIT && reload_completed"
3276 [(set (match_dup 0) (match_dup 4))
3278 (compare:CC (match_dup 0)
3282 ;; Rotate and shift insns, in all their variants. These support shifts,
3283 ;; field inserts and extracts, and various combinations thereof.
3284 (define_expand "insv"
3285 [(set (zero_extract (match_operand 0 "gpc_reg_operand" "")
3286 (match_operand:SI 1 "const_int_operand" "")
3287 (match_operand:SI 2 "const_int_operand" ""))
3288 (match_operand 3 "gpc_reg_operand" ""))]
3292 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3293 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3294 compiler if the address of the structure is taken later. Likewise, do
3295 not handle invalid E500 subregs. */
3296 if (GET_CODE (operands[0]) == SUBREG
3297 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD
3298 || ((TARGET_E500_DOUBLE || TARGET_SPE)
3299 && invalid_e500_subreg (operands[0], GET_MODE (operands[0])))))
3302 if (TARGET_POWERPC64 && GET_MODE (operands[0]) == DImode)
3303 emit_insn (gen_insvdi_internal (operands[0], operands[1], operands[2],
3306 emit_insn (gen_insvsi_internal (operands[0], operands[1], operands[2],
3311 (define_insn "insvsi_internal"
3312 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3313 (match_operand:SI 1 "const_int_operand" "i")
3314 (match_operand:SI 2 "const_int_operand" "i"))
3315 (match_operand:SI 3 "gpc_reg_operand" "r"))]
3319 int start = INTVAL (operands[2]) & 31;
3320 int size = INTVAL (operands[1]) & 31;
3322 operands[4] = GEN_INT (32 - start - size);
3323 operands[1] = GEN_INT (start + size - 1);
3324 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3326 [(set_attr "type" "insert_word")])
3328 (define_insn "*insvsi_internal1"
3329 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3330 (match_operand:SI 1 "const_int_operand" "i")
3331 (match_operand:SI 2 "const_int_operand" "i"))
3332 (rotate:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3333 (match_operand:SI 4 "const_int_operand" "i")))]
3334 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3337 int shift = INTVAL (operands[4]) & 31;
3338 int start = INTVAL (operands[2]) & 31;
3339 int size = INTVAL (operands[1]) & 31;
3341 operands[4] = GEN_INT (shift - start - size);
3342 operands[1] = GEN_INT (start + size - 1);
3343 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3345 [(set_attr "type" "insert_word")])
3347 (define_insn "*insvsi_internal2"
3348 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3349 (match_operand:SI 1 "const_int_operand" "i")
3350 (match_operand:SI 2 "const_int_operand" "i"))
3351 (ashiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3352 (match_operand:SI 4 "const_int_operand" "i")))]
3353 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3356 int shift = INTVAL (operands[4]) & 31;
3357 int start = INTVAL (operands[2]) & 31;
3358 int size = INTVAL (operands[1]) & 31;
3360 operands[4] = GEN_INT (32 - shift - start - size);
3361 operands[1] = GEN_INT (start + size - 1);
3362 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3364 [(set_attr "type" "insert_word")])
3366 (define_insn "*insvsi_internal3"
3367 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3368 (match_operand:SI 1 "const_int_operand" "i")
3369 (match_operand:SI 2 "const_int_operand" "i"))
3370 (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3371 (match_operand:SI 4 "const_int_operand" "i")))]
3372 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3375 int shift = INTVAL (operands[4]) & 31;
3376 int start = INTVAL (operands[2]) & 31;
3377 int size = INTVAL (operands[1]) & 31;
3379 operands[4] = GEN_INT (32 - shift - start - size);
3380 operands[1] = GEN_INT (start + size - 1);
3381 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3383 [(set_attr "type" "insert_word")])
3385 (define_insn "*insvsi_internal4"
3386 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3387 (match_operand:SI 1 "const_int_operand" "i")
3388 (match_operand:SI 2 "const_int_operand" "i"))
3389 (zero_extract:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3390 (match_operand:SI 4 "const_int_operand" "i")
3391 (match_operand:SI 5 "const_int_operand" "i")))]
3392 "INTVAL (operands[4]) >= INTVAL (operands[1])"
3395 int extract_start = INTVAL (operands[5]) & 31;
3396 int extract_size = INTVAL (operands[4]) & 31;
3397 int insert_start = INTVAL (operands[2]) & 31;
3398 int insert_size = INTVAL (operands[1]) & 31;
3400 /* Align extract field with insert field */
3401 operands[5] = GEN_INT (extract_start + extract_size - insert_start - insert_size);
3402 operands[1] = GEN_INT (insert_start + insert_size - 1);
3403 return \"rlwimi %0,%3,%h5,%h2,%h1\";
3405 [(set_attr "type" "insert_word")])
3407 ;; combine patterns for rlwimi
3408 (define_insn "*insvsi_internal5"
3409 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3410 (ior:SI (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
3411 (match_operand:SI 1 "mask_operand" "i"))
3412 (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3413 (match_operand:SI 2 "const_int_operand" "i"))
3414 (match_operand:SI 5 "mask_operand" "i"))))]
3415 "INTVAL(operands[1]) == ~INTVAL(operands[5])"
3418 int me = extract_ME(operands[5]);
3419 int mb = extract_MB(operands[5]);
3420 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
3421 operands[2] = GEN_INT(mb);
3422 operands[1] = GEN_INT(me);
3423 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3425 [(set_attr "type" "insert_word")])
3427 (define_insn "*insvsi_internal6"
3428 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3429 (ior:SI (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3430 (match_operand:SI 2 "const_int_operand" "i"))
3431 (match_operand:SI 5 "mask_operand" "i"))
3432 (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
3433 (match_operand:SI 1 "mask_operand" "i"))))]
3434 "INTVAL(operands[1]) == ~INTVAL(operands[5])"
3437 int me = extract_ME(operands[5]);
3438 int mb = extract_MB(operands[5]);
3439 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
3440 operands[2] = GEN_INT(mb);
3441 operands[1] = GEN_INT(me);
3442 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3444 [(set_attr "type" "insert_word")])
3446 (define_insn "insvdi_internal"
3447 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3448 (match_operand:SI 1 "const_int_operand" "i")
3449 (match_operand:SI 2 "const_int_operand" "i"))
3450 (match_operand:DI 3 "gpc_reg_operand" "r"))]
3454 int start = INTVAL (operands[2]) & 63;
3455 int size = INTVAL (operands[1]) & 63;
3457 operands[1] = GEN_INT (64 - start - size);
3458 return \"rldimi %0,%3,%H1,%H2\";
3460 [(set_attr "type" "insert_dword")])
3462 (define_insn "*insvdi_internal2"
3463 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3464 (match_operand:SI 1 "const_int_operand" "i")
3465 (match_operand:SI 2 "const_int_operand" "i"))
3466 (ashiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
3467 (match_operand:SI 4 "const_int_operand" "i")))]
3469 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
3472 int shift = INTVAL (operands[4]) & 63;
3473 int start = (INTVAL (operands[2]) & 63) - 32;
3474 int size = INTVAL (operands[1]) & 63;
3476 operands[4] = GEN_INT (64 - shift - start - size);
3477 operands[2] = GEN_INT (start);
3478 operands[1] = GEN_INT (start + size - 1);
3479 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3482 (define_insn "*insvdi_internal3"
3483 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3484 (match_operand:SI 1 "const_int_operand" "i")
3485 (match_operand:SI 2 "const_int_operand" "i"))
3486 (lshiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
3487 (match_operand:SI 4 "const_int_operand" "i")))]
3489 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
3492 int shift = INTVAL (operands[4]) & 63;
3493 int start = (INTVAL (operands[2]) & 63) - 32;
3494 int size = INTVAL (operands[1]) & 63;
3496 operands[4] = GEN_INT (64 - shift - start - size);
3497 operands[2] = GEN_INT (start);
3498 operands[1] = GEN_INT (start + size - 1);
3499 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3502 (define_expand "extzv"
3503 [(set (match_operand 0 "gpc_reg_operand" "")
3504 (zero_extract (match_operand 1 "gpc_reg_operand" "")
3505 (match_operand:SI 2 "const_int_operand" "")
3506 (match_operand:SI 3 "const_int_operand" "")))]
3510 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3511 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3512 compiler if the address of the structure is taken later. */
3513 if (GET_CODE (operands[0]) == SUBREG
3514 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
3517 if (TARGET_POWERPC64 && GET_MODE (operands[1]) == DImode)
3518 emit_insn (gen_extzvdi_internal (operands[0], operands[1], operands[2],
3521 emit_insn (gen_extzvsi_internal (operands[0], operands[1], operands[2],
3526 (define_insn "extzvsi_internal"
3527 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3528 (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3529 (match_operand:SI 2 "const_int_operand" "i")
3530 (match_operand:SI 3 "const_int_operand" "i")))]
3534 int start = INTVAL (operands[3]) & 31;
3535 int size = INTVAL (operands[2]) & 31;
3537 if (start + size >= 32)
3538 operands[3] = const0_rtx;
3540 operands[3] = GEN_INT (start + size);
3541 return \"rlwinm %0,%1,%3,%s2,31\";
3544 (define_insn "*extzvsi_internal1"
3545 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3546 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3547 (match_operand:SI 2 "const_int_operand" "i,i")
3548 (match_operand:SI 3 "const_int_operand" "i,i"))
3550 (clobber (match_scratch:SI 4 "=r,r"))]
3554 int start = INTVAL (operands[3]) & 31;
3555 int size = INTVAL (operands[2]) & 31;
3557 /* Force split for non-cc0 compare. */
3558 if (which_alternative == 1)
3561 /* If the bit-field being tested fits in the upper or lower half of a
3562 word, it is possible to use andiu. or andil. to test it. This is
3563 useful because the condition register set-use delay is smaller for
3564 andi[ul]. than for rlinm. This doesn't work when the starting bit
3565 position is 0 because the LT and GT bits may be set wrong. */
3567 if ((start > 0 && start + size <= 16) || start >= 16)
3569 operands[3] = GEN_INT (((1 << (16 - (start & 15)))
3570 - (1 << (16 - (start & 15) - size))));
3572 return \"andis. %4,%1,%3\";
3574 return \"andi. %4,%1,%3\";
3577 if (start + size >= 32)
3578 operands[3] = const0_rtx;
3580 operands[3] = GEN_INT (start + size);
3581 return \"rlwinm. %4,%1,%3,%s2,31\";
3583 [(set_attr "type" "delayed_compare")
3584 (set_attr "length" "4,8")])
3587 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3588 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3589 (match_operand:SI 2 "const_int_operand" "")
3590 (match_operand:SI 3 "const_int_operand" ""))
3592 (clobber (match_scratch:SI 4 ""))]
3595 (zero_extract:SI (match_dup 1) (match_dup 2)
3598 (compare:CC (match_dup 4)
3602 (define_insn "*extzvsi_internal2"
3603 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3604 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3605 (match_operand:SI 2 "const_int_operand" "i,i")
3606 (match_operand:SI 3 "const_int_operand" "i,i"))
3608 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3609 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3613 int start = INTVAL (operands[3]) & 31;
3614 int size = INTVAL (operands[2]) & 31;
3616 /* Force split for non-cc0 compare. */
3617 if (which_alternative == 1)
3620 /* Since we are using the output value, we can't ignore any need for
3621 a shift. The bit-field must end at the LSB. */
3622 if (start >= 16 && start + size == 32)
3624 operands[3] = GEN_INT ((1 << size) - 1);
3625 return \"andi. %0,%1,%3\";
3628 if (start + size >= 32)
3629 operands[3] = const0_rtx;
3631 operands[3] = GEN_INT (start + size);
3632 return \"rlwinm. %0,%1,%3,%s2,31\";
3634 [(set_attr "type" "delayed_compare")
3635 (set_attr "length" "4,8")])
3638 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
3639 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3640 (match_operand:SI 2 "const_int_operand" "")
3641 (match_operand:SI 3 "const_int_operand" ""))
3643 (set (match_operand:SI 0 "gpc_reg_operand" "")
3644 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3647 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))
3649 (compare:CC (match_dup 0)
3653 (define_insn "extzvdi_internal"
3654 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
3655 (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3656 (match_operand:SI 2 "const_int_operand" "i")
3657 (match_operand:SI 3 "const_int_operand" "i")))]
3661 int start = INTVAL (operands[3]) & 63;
3662 int size = INTVAL (operands[2]) & 63;
3664 if (start + size >= 64)
3665 operands[3] = const0_rtx;
3667 operands[3] = GEN_INT (start + size);
3668 operands[2] = GEN_INT (64 - size);
3669 return \"rldicl %0,%1,%3,%2\";
3672 (define_insn "*extzvdi_internal1"
3673 [(set (match_operand:CC 0 "gpc_reg_operand" "=x")
3674 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3675 (match_operand:SI 2 "const_int_operand" "i")
3676 (match_operand:SI 3 "const_int_operand" "i"))
3678 (clobber (match_scratch:DI 4 "=r"))]
3679 "TARGET_64BIT && rs6000_gen_cell_microcode"
3682 int start = INTVAL (operands[3]) & 63;
3683 int size = INTVAL (operands[2]) & 63;
3685 if (start + size >= 64)
3686 operands[3] = const0_rtx;
3688 operands[3] = GEN_INT (start + size);
3689 operands[2] = GEN_INT (64 - size);
3690 return \"rldicl. %4,%1,%3,%2\";
3692 [(set_attr "type" "compare")])
3694 (define_insn "*extzvdi_internal2"
3695 [(set (match_operand:CC 4 "gpc_reg_operand" "=x")
3696 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3697 (match_operand:SI 2 "const_int_operand" "i")
3698 (match_operand:SI 3 "const_int_operand" "i"))
3700 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
3701 (zero_extract:DI (match_dup 1) (match_dup 2) (match_dup 3)))]
3702 "TARGET_64BIT && rs6000_gen_cell_microcode"
3705 int start = INTVAL (operands[3]) & 63;
3706 int size = INTVAL (operands[2]) & 63;
3708 if (start + size >= 64)
3709 operands[3] = const0_rtx;
3711 operands[3] = GEN_INT (start + size);
3712 operands[2] = GEN_INT (64 - size);
3713 return \"rldicl. %0,%1,%3,%2\";
3715 [(set_attr "type" "compare")])
3717 (define_insn "rotlsi3"
3718 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3719 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3720 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
3723 rlwnm %0,%1,%2,0xffffffff
3724 rlwinm %0,%1,%h2,0xffffffff"
3725 [(set_attr "type" "var_shift_rotate,integer")])
3727 (define_insn "*rotlsi3_64"
3728 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
3730 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3731 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))))]
3734 rlwnm %0,%1,%2,0xffffffff
3735 rlwinm %0,%1,%h2,0xffffffff"
3736 [(set_attr "type" "var_shift_rotate,integer")])
3738 (define_insn "*rotlsi3_internal2"
3739 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3740 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3741 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3743 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
3746 rlwnm. %3,%1,%2,0xffffffff
3747 rlwinm. %3,%1,%h2,0xffffffff
3750 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3751 (set_attr "length" "4,4,8,8")])
3754 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3755 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3756 (match_operand:SI 2 "reg_or_cint_operand" ""))
3758 (clobber (match_scratch:SI 3 ""))]
3761 (rotate:SI (match_dup 1) (match_dup 2)))
3763 (compare:CC (match_dup 3)
3767 (define_insn "*rotlsi3_internal3"
3768 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
3769 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3770 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3772 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
3773 (rotate:SI (match_dup 1) (match_dup 2)))]
3776 rlwnm. %0,%1,%2,0xffffffff
3777 rlwinm. %0,%1,%h2,0xffffffff
3780 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3781 (set_attr "length" "4,4,8,8")])
3784 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3785 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3786 (match_operand:SI 2 "reg_or_cint_operand" ""))
3788 (set (match_operand:SI 0 "gpc_reg_operand" "")
3789 (rotate:SI (match_dup 1) (match_dup 2)))]
3792 (rotate:SI (match_dup 1) (match_dup 2)))
3794 (compare:CC (match_dup 0)
3798 (define_insn "*rotlsi3_internal4"
3799 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3800 (and:SI (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3801 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
3802 (match_operand:SI 3 "mask_operand" "n,n")))]
3805 rlwnm %0,%1,%2,%m3,%M3
3806 rlwinm %0,%1,%h2,%m3,%M3"
3807 [(set_attr "type" "var_shift_rotate,integer")])
3809 (define_insn "*rotlsi3_internal5"
3810 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3812 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3813 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3814 (match_operand:SI 3 "mask_operand" "n,n,n,n"))
3816 (clobber (match_scratch:SI 4 "=r,r,r,r"))]
3819 rlwnm. %4,%1,%2,%m3,%M3
3820 rlwinm. %4,%1,%h2,%m3,%M3
3823 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3824 (set_attr "length" "4,4,8,8")])
3827 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3829 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3830 (match_operand:SI 2 "reg_or_cint_operand" ""))
3831 (match_operand:SI 3 "mask_operand" ""))
3833 (clobber (match_scratch:SI 4 ""))]
3836 (and:SI (rotate:SI (match_dup 1)
3840 (compare:CC (match_dup 4)
3844 (define_insn "*rotlsi3_internal6"
3845 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
3847 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3848 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3849 (match_operand:SI 3 "mask_operand" "n,n,n,n"))
3851 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
3852 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3855 rlwnm. %0,%1,%2,%m3,%M3
3856 rlwinm. %0,%1,%h2,%m3,%M3
3859 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3860 (set_attr "length" "4,4,8,8")])
3863 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
3865 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3866 (match_operand:SI 2 "reg_or_cint_operand" ""))
3867 (match_operand:SI 3 "mask_operand" ""))
3869 (set (match_operand:SI 0 "gpc_reg_operand" "")
3870 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3873 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
3875 (compare:CC (match_dup 0)
3879 (define_insn "*rotlsi3_internal7le"
3880 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3883 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3884 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
3886 "rlw%I2nm %0,%1,%h2,0xff"
3887 [(set (attr "cell_micro")
3888 (if_then_else (match_operand:SI 2 "const_int_operand" "")
3889 (const_string "not")
3890 (const_string "always")))])
3892 (define_insn "*rotlsi3_internal7be"
3893 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3896 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3897 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 3)))]
3899 "rlw%I2nm %0,%1,%h2,0xff"
3900 [(set (attr "cell_micro")
3901 (if_then_else (match_operand:SI 2 "const_int_operand" "")
3902 (const_string "not")
3903 (const_string "always")))])
3905 (define_insn "*rotlsi3_internal8le"
3906 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3907 (compare:CC (zero_extend:SI
3909 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3910 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
3912 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
3915 rlwnm. %3,%1,%2,0xff
3916 rlwinm. %3,%1,%h2,0xff
3919 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3920 (set_attr "length" "4,4,8,8")])
3922 (define_insn "*rotlsi3_internal8be"
3923 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3924 (compare:CC (zero_extend:SI
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")) 3))
3929 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
3932 rlwnm. %3,%1,%2,0xff
3933 rlwinm. %3,%1,%h2,0xff
3936 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3937 (set_attr "length" "4,4,8,8")])
3940 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3941 (compare:CC (zero_extend:SI
3943 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3944 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3946 (clobber (match_scratch:SI 3 ""))]
3947 "!BYTES_BIG_ENDIAN && reload_completed"
3949 (zero_extend:SI (subreg:QI
3950 (rotate:SI (match_dup 1)
3953 (compare:CC (match_dup 3)
3958 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3959 (compare:CC (zero_extend:SI
3961 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3962 (match_operand:SI 2 "reg_or_cint_operand" "")) 3))
3964 (clobber (match_scratch:SI 3 ""))]
3965 "BYTES_BIG_ENDIAN && reload_completed"
3967 (zero_extend:SI (subreg:QI
3968 (rotate:SI (match_dup 1)
3971 (compare:CC (match_dup 3)
3975 (define_insn "*rotlsi3_internal9le"
3976 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
3977 (compare:CC (zero_extend:SI
3979 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3980 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
3982 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
3983 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3986 rlwnm. %0,%1,%2,0xff
3987 rlwinm. %0,%1,%h2,0xff
3990 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3991 (set_attr "length" "4,4,8,8")])
3993 (define_insn "*rotlsi3_internal9be"
3994 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
3995 (compare:CC (zero_extend:SI
3997 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3998 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 3))
4000 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4001 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 3)))]
4004 rlwnm. %0,%1,%2,0xff
4005 rlwinm. %0,%1,%h2,0xff
4008 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4009 (set_attr "length" "4,4,8,8")])
4012 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4013 (compare:CC (zero_extend:SI
4015 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4016 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4018 (set (match_operand:SI 0 "gpc_reg_operand" "")
4019 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4020 "!BYTES_BIG_ENDIAN && reload_completed"
4022 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
4024 (compare:CC (match_dup 0)
4029 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4030 (compare:CC (zero_extend:SI
4032 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4033 (match_operand:SI 2 "reg_or_cint_operand" "")) 3))
4035 (set (match_operand:SI 0 "gpc_reg_operand" "")
4036 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 3)))]
4037 "BYTES_BIG_ENDIAN && reload_completed"
4039 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 3)))
4041 (compare:CC (match_dup 0)
4045 (define_insn "*rotlsi3_internal10le"
4046 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4049 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4050 (match_operand:SI 2 "reg_or_cint_operand" "r,i")) 0)))]
4053 rlwnm %0,%1,%2,0xffff
4054 rlwinm %0,%1,%h2,0xffff"
4055 [(set_attr "type" "var_shift_rotate,integer")])
4057 (define_insn "*rotlsi3_internal10be"
4058 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4061 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4062 (match_operand:SI 2 "reg_or_cint_operand" "r,i")) 2)))]
4065 rlwnm %0,%1,%2,0xffff
4066 rlwinm %0,%1,%h2,0xffff"
4067 [(set_attr "type" "var_shift_rotate,integer")])
4069 (define_insn "*rotlsi3_internal11le"
4070 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4071 (compare:CC (zero_extend:SI
4073 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4074 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4076 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4079 rlwnm. %3,%1,%2,0xffff
4080 rlwinm. %3,%1,%h2,0xffff
4083 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4084 (set_attr "length" "4,4,8,8")])
4086 (define_insn "*rotlsi3_internal11be"
4087 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4088 (compare:CC (zero_extend:SI
4090 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4091 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 2))
4093 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4096 rlwnm. %3,%1,%2,0xffff
4097 rlwinm. %3,%1,%h2,0xffff
4100 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4101 (set_attr "length" "4,4,8,8")])
4104 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4105 (compare:CC (zero_extend:SI
4107 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4108 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4110 (clobber (match_scratch:SI 3 ""))]
4111 "!BYTES_BIG_ENDIAN && reload_completed"
4113 (zero_extend:SI (subreg:HI
4114 (rotate:SI (match_dup 1)
4117 (compare:CC (match_dup 3)
4122 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4123 (compare:CC (zero_extend:SI
4125 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4126 (match_operand:SI 2 "reg_or_cint_operand" "")) 2))
4128 (clobber (match_scratch:SI 3 ""))]
4129 "BYTES_BIG_ENDIAN && reload_completed"
4131 (zero_extend:SI (subreg:HI
4132 (rotate:SI (match_dup 1)
4135 (compare:CC (match_dup 3)
4139 (define_insn "*rotlsi3_internal12le"
4140 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4141 (compare:CC (zero_extend:SI
4143 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4144 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4146 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4147 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4150 rlwnm. %0,%1,%2,0xffff
4151 rlwinm. %0,%1,%h2,0xffff
4154 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4155 (set_attr "length" "4,4,8,8")])
4157 (define_insn "*rotlsi3_internal12be"
4158 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4159 (compare:CC (zero_extend:SI
4161 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4162 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 2))
4164 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4165 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 2)))]
4168 rlwnm. %0,%1,%2,0xffff
4169 rlwinm. %0,%1,%h2,0xffff
4172 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4173 (set_attr "length" "4,4,8,8")])
4176 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4177 (compare:CC (zero_extend:SI
4179 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4180 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4182 (set (match_operand:SI 0 "gpc_reg_operand" "")
4183 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4184 "!BYTES_BIG_ENDIAN && reload_completed"
4186 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
4188 (compare:CC (match_dup 0)
4193 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4194 (compare:CC (zero_extend:SI
4196 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4197 (match_operand:SI 2 "reg_or_cint_operand" "")) 2))
4199 (set (match_operand:SI 0 "gpc_reg_operand" "")
4200 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 2)))]
4201 "BYTES_BIG_ENDIAN && reload_completed"
4203 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 2)))
4205 (compare:CC (match_dup 0)
4209 (define_insn "ashlsi3"
4210 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4211 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4212 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
4217 [(set_attr "type" "var_shift_rotate,shift")])
4219 (define_insn "*ashlsi3_64"
4220 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
4222 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4223 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))))]
4228 [(set_attr "type" "var_shift_rotate,shift")])
4231 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4232 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4233 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4235 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4242 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4243 (set_attr "length" "4,4,8,8")])
4246 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4247 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4248 (match_operand:SI 2 "reg_or_cint_operand" ""))
4250 (clobber (match_scratch:SI 3 ""))]
4251 "TARGET_32BIT && reload_completed"
4253 (ashift:SI (match_dup 1) (match_dup 2)))
4255 (compare:CC (match_dup 3)
4260 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4261 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4262 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4264 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4265 (ashift:SI (match_dup 1) (match_dup 2)))]
4272 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4273 (set_attr "length" "4,4,8,8")])
4276 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4277 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4278 (match_operand:SI 2 "reg_or_cint_operand" ""))
4280 (set (match_operand:SI 0 "gpc_reg_operand" "")
4281 (ashift:SI (match_dup 1) (match_dup 2)))]
4282 "TARGET_32BIT && reload_completed"
4284 (ashift:SI (match_dup 1) (match_dup 2)))
4286 (compare:CC (match_dup 0)
4290 (define_insn "rlwinm"
4291 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4292 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4293 (match_operand:SI 2 "const_int_operand" "i"))
4294 (match_operand:SI 3 "mask_operand" "n")))]
4295 "includes_lshift_p (operands[2], operands[3])"
4296 "rlwinm %0,%1,%h2,%m3,%M3")
4299 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4301 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4302 (match_operand:SI 2 "const_int_operand" "i,i"))
4303 (match_operand:SI 3 "mask_operand" "n,n"))
4305 (clobber (match_scratch:SI 4 "=r,r"))]
4306 "includes_lshift_p (operands[2], operands[3])"
4308 rlwinm. %4,%1,%h2,%m3,%M3
4310 [(set_attr "type" "delayed_compare")
4311 (set_attr "length" "4,8")])
4314 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4316 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4317 (match_operand:SI 2 "const_int_operand" ""))
4318 (match_operand:SI 3 "mask_operand" ""))
4320 (clobber (match_scratch:SI 4 ""))]
4321 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
4323 (and:SI (ashift:SI (match_dup 1) (match_dup 2))
4326 (compare:CC (match_dup 4)
4331 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4333 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4334 (match_operand:SI 2 "const_int_operand" "i,i"))
4335 (match_operand:SI 3 "mask_operand" "n,n"))
4337 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4338 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4339 "includes_lshift_p (operands[2], operands[3])"
4341 rlwinm. %0,%1,%h2,%m3,%M3
4343 [(set_attr "type" "delayed_compare")
4344 (set_attr "length" "4,8")])
4347 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
4349 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4350 (match_operand:SI 2 "const_int_operand" ""))
4351 (match_operand:SI 3 "mask_operand" ""))
4353 (set (match_operand:SI 0 "gpc_reg_operand" "")
4354 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4355 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
4357 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4359 (compare:CC (match_dup 0)
4363 (define_insn "lshrsi3"
4364 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
4365 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
4366 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i")))]
4372 [(set_attr "type" "integer,var_shift_rotate,shift")])
4374 (define_insn "*lshrsi3_64"
4375 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
4377 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4378 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))))]
4383 [(set_attr "type" "var_shift_rotate,shift")])
4386 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,?y,?y,?y")
4387 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
4388 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i,O,r,i"))
4390 (clobber (match_scratch:SI 3 "=X,r,r,X,r,r"))]
4399 [(set_attr "type" "fast_compare,var_delayed_compare,delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4400 (set_attr "length" "4,4,4,8,8,8")])
4403 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4404 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4405 (match_operand:SI 2 "reg_or_cint_operand" ""))
4407 (clobber (match_scratch:SI 3 ""))]
4408 "TARGET_32BIT && reload_completed"
4410 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4412 (compare:CC (match_dup 3)
4417 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,?y,?y,?y")
4418 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
4419 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i,O,r,i"))
4421 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
4422 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
4431 [(set_attr "type" "fast_compare,var_delayed_compare,delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4432 (set_attr "length" "4,4,4,8,8,8")])
4435 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4436 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4437 (match_operand:SI 2 "reg_or_cint_operand" ""))
4439 (set (match_operand:SI 0 "gpc_reg_operand" "")
4440 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
4441 "TARGET_32BIT && reload_completed"
4443 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4445 (compare:CC (match_dup 0)
4450 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4451 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4452 (match_operand:SI 2 "const_int_operand" "i"))
4453 (match_operand:SI 3 "mask_operand" "n")))]
4454 "includes_rshift_p (operands[2], operands[3])"
4455 "rlwinm %0,%1,%s2,%m3,%M3")
4458 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4460 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4461 (match_operand:SI 2 "const_int_operand" "i,i"))
4462 (match_operand:SI 3 "mask_operand" "n,n"))
4464 (clobber (match_scratch:SI 4 "=r,r"))]
4465 "includes_rshift_p (operands[2], operands[3])"
4467 rlwinm. %4,%1,%s2,%m3,%M3
4469 [(set_attr "type" "delayed_compare")
4470 (set_attr "length" "4,8")])
4473 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4475 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4476 (match_operand:SI 2 "const_int_operand" ""))
4477 (match_operand:SI 3 "mask_operand" ""))
4479 (clobber (match_scratch:SI 4 ""))]
4480 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
4482 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2))
4485 (compare:CC (match_dup 4)
4490 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4492 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4493 (match_operand:SI 2 "const_int_operand" "i,i"))
4494 (match_operand:SI 3 "mask_operand" "n,n"))
4496 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4497 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4498 "includes_rshift_p (operands[2], operands[3])"
4500 rlwinm. %0,%1,%s2,%m3,%M3
4502 [(set_attr "type" "delayed_compare")
4503 (set_attr "length" "4,8")])
4506 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
4508 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4509 (match_operand:SI 2 "const_int_operand" ""))
4510 (match_operand:SI 3 "mask_operand" ""))
4512 (set (match_operand:SI 0 "gpc_reg_operand" "")
4513 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4514 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
4516 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4518 (compare:CC (match_dup 0)
4522 (define_insn "*lshiftrt_internal1le"
4523 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4526 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4527 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4528 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255))"
4529 "rlwinm %0,%1,%s2,0xff")
4531 (define_insn "*lshiftrt_internal1be"
4532 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4535 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4536 (match_operand:SI 2 "const_int_operand" "i")) 3)))]
4537 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255))"
4538 "rlwinm %0,%1,%s2,0xff")
4540 (define_insn "*lshiftrt_internal2le"
4541 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4545 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4546 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4548 (clobber (match_scratch:SI 3 "=r,r"))]
4549 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255))"
4551 rlwinm. %3,%1,%s2,0xff
4553 [(set_attr "type" "delayed_compare")
4554 (set_attr "length" "4,8")])
4556 (define_insn "*lshiftrt_internal2be"
4557 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4561 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4562 (match_operand:SI 2 "const_int_operand" "i,i")) 3))
4564 (clobber (match_scratch:SI 3 "=r,r"))]
4565 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255))"
4567 rlwinm. %3,%1,%s2,0xff
4569 [(set_attr "type" "delayed_compare")
4570 (set_attr "length" "4,8")])
4573 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4577 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4578 (match_operand:SI 2 "const_int_operand" "")) 0))
4580 (clobber (match_scratch:SI 3 ""))]
4581 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4583 (zero_extend:SI (subreg:QI
4584 (lshiftrt:SI (match_dup 1)
4587 (compare:CC (match_dup 3)
4592 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4596 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4597 (match_operand:SI 2 "const_int_operand" "")) 3))
4599 (clobber (match_scratch:SI 3 ""))]
4600 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4602 (zero_extend:SI (subreg:QI
4603 (lshiftrt:SI (match_dup 1)
4606 (compare:CC (match_dup 3)
4610 (define_insn "*lshiftrt_internal3le"
4611 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4615 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4616 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4618 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4619 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4620 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255))"
4622 rlwinm. %0,%1,%s2,0xff
4624 [(set_attr "type" "delayed_compare")
4625 (set_attr "length" "4,8")])
4627 (define_insn "*lshiftrt_internal3be"
4628 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4632 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4633 (match_operand:SI 2 "const_int_operand" "i,i")) 3))
4635 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4636 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 3)))]
4637 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255))"
4639 rlwinm. %0,%1,%s2,0xff
4641 [(set_attr "type" "delayed_compare")
4642 (set_attr "length" "4,8")])
4645 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4649 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4650 (match_operand:SI 2 "const_int_operand" "")) 0))
4652 (set (match_operand:SI 0 "gpc_reg_operand" "")
4653 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4654 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4656 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4658 (compare:CC (match_dup 0)
4663 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4667 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4668 (match_operand:SI 2 "const_int_operand" "")) 3))
4670 (set (match_operand:SI 0 "gpc_reg_operand" "")
4671 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 3)))]
4672 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4674 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 3)))
4676 (compare:CC (match_dup 0)
4680 (define_insn "*lshiftrt_internal4le"
4681 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4684 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4685 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4686 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535))"
4687 "rlwinm %0,%1,%s2,0xffff")
4689 (define_insn "*lshiftrt_internal4be"
4690 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4693 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4694 (match_operand:SI 2 "const_int_operand" "i")) 2)))]
4695 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535))"
4696 "rlwinm %0,%1,%s2,0xffff")
4698 (define_insn "*lshiftrt_internal5le"
4699 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4703 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4704 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4706 (clobber (match_scratch:SI 3 "=r,r"))]
4707 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535))"
4709 rlwinm. %3,%1,%s2,0xffff
4711 [(set_attr "type" "delayed_compare")
4712 (set_attr "length" "4,8")])
4714 (define_insn "*lshiftrt_internal5be"
4715 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4719 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4720 (match_operand:SI 2 "const_int_operand" "i,i")) 2))
4722 (clobber (match_scratch:SI 3 "=r,r"))]
4723 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535))"
4725 rlwinm. %3,%1,%s2,0xffff
4727 [(set_attr "type" "delayed_compare")
4728 (set_attr "length" "4,8")])
4731 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4735 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4736 (match_operand:SI 2 "const_int_operand" "")) 0))
4738 (clobber (match_scratch:SI 3 ""))]
4739 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4741 (zero_extend:SI (subreg:HI
4742 (lshiftrt:SI (match_dup 1)
4745 (compare:CC (match_dup 3)
4750 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4754 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4755 (match_operand:SI 2 "const_int_operand" "")) 2))
4757 (clobber (match_scratch:SI 3 ""))]
4758 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4760 (zero_extend:SI (subreg:HI
4761 (lshiftrt:SI (match_dup 1)
4764 (compare:CC (match_dup 3)
4768 (define_insn "*lshiftrt_internal5le"
4769 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4773 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4774 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4776 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4777 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4778 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535))"
4780 rlwinm. %0,%1,%s2,0xffff
4782 [(set_attr "type" "delayed_compare")
4783 (set_attr "length" "4,8")])
4785 (define_insn "*lshiftrt_internal5be"
4786 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4790 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4791 (match_operand:SI 2 "const_int_operand" "i,i")) 2))
4793 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4794 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 2)))]
4795 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535))"
4797 rlwinm. %0,%1,%s2,0xffff
4799 [(set_attr "type" "delayed_compare")
4800 (set_attr "length" "4,8")])
4803 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4807 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4808 (match_operand:SI 2 "const_int_operand" "")) 0))
4810 (set (match_operand:SI 0 "gpc_reg_operand" "")
4811 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4812 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4814 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4816 (compare:CC (match_dup 0)
4821 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4825 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4826 (match_operand:SI 2 "const_int_operand" "")) 2))
4828 (set (match_operand:SI 0 "gpc_reg_operand" "")
4829 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 2)))]
4830 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4832 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 2)))
4834 (compare:CC (match_dup 0)
4838 (define_insn "ashrsi3"
4839 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4840 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4841 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
4846 [(set_attr "type" "var_shift_rotate,shift")])
4848 (define_insn "*ashrsi3_64"
4849 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
4851 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4852 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))))]
4857 [(set_attr "type" "var_shift_rotate,shift")])
4860 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4861 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4862 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4864 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4871 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4872 (set_attr "length" "4,4,8,8")])
4875 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4876 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4877 (match_operand:SI 2 "reg_or_cint_operand" ""))
4879 (clobber (match_scratch:SI 3 ""))]
4882 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4884 (compare:CC (match_dup 3)
4889 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4890 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4891 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4893 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4894 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
4901 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4902 (set_attr "length" "4,4,8,8")])
4904 ;; Builtins to replace a division to generate FRE reciprocal estimate
4905 ;; instructions and the necessary fixup instructions
4906 (define_expand "recip<mode>3"
4907 [(match_operand:RECIPF 0 "gpc_reg_operand" "")
4908 (match_operand:RECIPF 1 "gpc_reg_operand" "")
4909 (match_operand:RECIPF 2 "gpc_reg_operand" "")]
4910 "RS6000_RECIP_HAVE_RE_P (<MODE>mode)"
4912 rs6000_emit_swdiv (operands[0], operands[1], operands[2], false);
4916 ;; Split to create division from FRE/FRES/etc. and fixup instead of the normal
4917 ;; hardware division. This is only done before register allocation and with
4918 ;; -ffast-math. This must appear before the divsf3/divdf3 insns.
4920 [(set (match_operand:RECIPF 0 "gpc_reg_operand" "")
4921 (div:RECIPF (match_operand 1 "gpc_reg_operand" "")
4922 (match_operand 2 "gpc_reg_operand" "")))]
4923 "RS6000_RECIP_AUTO_RE_P (<MODE>mode)
4924 && can_create_pseudo_p () && optimize_insn_for_speed_p ()
4925 && flag_finite_math_only && !flag_trapping_math && flag_reciprocal_math"
4928 rs6000_emit_swdiv (operands[0], operands[1], operands[2], true);
4932 ;; Builtins to replace 1/sqrt(x) with instructions using RSQRTE and the
4933 ;; appropriate fixup.
4934 (define_expand "rsqrt<mode>2"
4935 [(match_operand:RECIPF 0 "gpc_reg_operand" "")
4936 (match_operand:RECIPF 1 "gpc_reg_operand" "")]
4937 "RS6000_RECIP_HAVE_RSQRTE_P (<MODE>mode)"
4939 rs6000_emit_swrsqrt (operands[0], operands[1]);
4944 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4945 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4946 (match_operand:SI 2 "reg_or_cint_operand" ""))
4948 (set (match_operand:SI 0 "gpc_reg_operand" "")
4949 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
4952 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4954 (compare:CC (match_dup 0)
4958 ;; Floating-point insns, excluding normal data motion.
4960 ;; PowerPC has a full set of single-precision floating point instructions.
4962 ;; For the POWER architecture, we pretend that we have both SFmode and
4963 ;; DFmode insns, while, in fact, all fp insns are actually done in double.
4964 ;; The only conversions we will do will be when storing to memory. In that
4965 ;; case, we will use the "frsp" instruction before storing.
4967 ;; Note that when we store into a single-precision memory location, we need to
4968 ;; use the frsp insn first. If the register being stored isn't dead, we
4969 ;; need a scratch register for the frsp. But this is difficult when the store
4970 ;; is done by reload. It is not incorrect to do the frsp on the register in
4971 ;; this case, we just lose precision that we would have otherwise gotten but
4972 ;; is not guaranteed. Perhaps this should be tightened up at some point.
4974 (define_expand "extendsfdf2"
4975 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4976 (float_extend:DF (match_operand:SF 1 "reg_or_none500mem_operand" "")))]
4977 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
4980 (define_insn_and_split "*extendsfdf2_fpr"
4981 [(set (match_operand:DF 0 "gpc_reg_operand" "=d,?d,d")
4982 (float_extend:DF (match_operand:SF 1 "reg_or_mem_operand" "0,f,m")))]
4983 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
4988 "&& reload_completed && REG_P (operands[1]) && REGNO (operands[0]) == REGNO (operands[1])"
4991 emit_note (NOTE_INSN_DELETED);
4994 [(set_attr_alternative "type"
4995 [(const_string "fp")
4998 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
4999 (const_string "fpload_ux")
5001 (match_test "update_address_mem (operands[1], VOIDmode)")
5002 (const_string "fpload_u")
5003 (const_string "fpload")))])])
5005 (define_expand "truncdfsf2"
5006 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5007 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "")))]
5008 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5011 (define_insn "*truncdfsf2_fpr"
5012 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5013 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "d")))]
5014 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5016 [(set_attr "type" "fp")])
5018 (define_expand "negsf2"
5019 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5020 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
5021 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
5024 (define_insn "*negsf2"
5025 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5026 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5027 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5029 [(set_attr "type" "fp")])
5031 (define_expand "abssf2"
5032 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5033 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
5034 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
5037 (define_insn "*abssf2"
5038 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5039 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5040 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5042 [(set_attr "type" "fp")])
5045 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5046 (neg:SF (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f"))))]
5047 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5049 [(set_attr "type" "fp")])
5051 (define_expand "addsf3"
5052 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5053 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "")
5054 (match_operand:SF 2 "gpc_reg_operand" "")))]
5055 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
5059 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5060 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5061 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5062 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5064 [(set_attr "type" "fp")
5065 (set_attr "fp_type" "fp_addsub_s")])
5067 (define_expand "subsf3"
5068 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5069 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "")
5070 (match_operand:SF 2 "gpc_reg_operand" "")))]
5071 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
5075 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5076 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5077 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5078 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5080 [(set_attr "type" "fp")
5081 (set_attr "fp_type" "fp_addsub_s")])
5083 (define_expand "mulsf3"
5084 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5085 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "")
5086 (match_operand:SF 2 "gpc_reg_operand" "")))]
5087 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
5091 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5092 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5093 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5094 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5096 [(set_attr "type" "fp")
5097 (set_attr "fp_type" "fp_mul_s")])
5099 (define_expand "divsf3"
5100 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5101 (div:SF (match_operand:SF 1 "gpc_reg_operand" "")
5102 (match_operand:SF 2 "gpc_reg_operand" "")))]
5103 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
5107 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5108 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5109 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5110 "TARGET_HARD_FLOAT && TARGET_FPRS
5111 && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
5113 [(set_attr "type" "sdiv")])
5116 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5117 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))]
5120 [(set_attr "type" "fp")])
5122 ; builtin fmaf support
5123 (define_insn "*fmasf4_fpr"
5124 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5125 (fma:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5126 (match_operand:SF 2 "gpc_reg_operand" "f")
5127 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5128 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5129 "fmadds %0,%1,%2,%3"
5130 [(set_attr "type" "fp")
5131 (set_attr "fp_type" "fp_maddsub_s")])
5133 (define_insn "*fmssf4_fpr"
5134 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5135 (fma:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5136 (match_operand:SF 2 "gpc_reg_operand" "f")
5137 (neg:SF (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5138 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5139 "fmsubs %0,%1,%2,%3"
5140 [(set_attr "type" "fp")
5141 (set_attr "fp_type" "fp_maddsub_s")])
5143 (define_insn "*nfmasf4_fpr"
5144 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5145 (neg:SF (fma:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5146 (match_operand:SF 2 "gpc_reg_operand" "f")
5147 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5148 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5149 "fnmadds %0,%1,%2,%3"
5150 [(set_attr "type" "fp")
5151 (set_attr "fp_type" "fp_maddsub_s")])
5153 (define_insn "*nfmssf4_fpr"
5154 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5155 (neg:SF (fma:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5156 (match_operand:SF 2 "gpc_reg_operand" "f")
5157 (neg:SF (match_operand:SF 3 "gpc_reg_operand" "f")))))]
5158 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5159 "fnmsubs %0,%1,%2,%3"
5160 [(set_attr "type" "fp")
5161 (set_attr "fp_type" "fp_maddsub_s")])
5163 (define_expand "sqrtsf2"
5164 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5165 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
5166 "(TARGET_PPC_GPOPT || TARGET_XILINX_FPU)
5167 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
5168 && !TARGET_SIMPLE_FPU"
5172 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5173 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5174 "(TARGET_PPC_GPOPT || TARGET_XILINX_FPU) && TARGET_HARD_FLOAT
5175 && TARGET_FPRS && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
5177 [(set_attr "type" "ssqrt")])
5179 (define_insn "*rsqrtsf_internal1"
5180 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5181 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")]
5185 [(set_attr "type" "fp")])
5187 ;; This expander is here to avoid FLOAT_WORDS_BIGENDIAN tests in
5188 ;; builtins.c and optabs.c that are not correct for IBM long double
5189 ;; when little-endian.
5190 (define_expand "signbittf2"
5192 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "")))
5194 (subreg:DI (match_dup 2) 0))
5197 (set (match_operand:SI 0 "gpc_reg_operand" "")
5200 && TARGET_HARD_FLOAT
5201 && (TARGET_FPRS || TARGET_E500_DOUBLE)
5202 && TARGET_LONG_DOUBLE_128"
5204 operands[2] = gen_reg_rtx (DFmode);
5205 operands[3] = gen_reg_rtx (DImode);
5206 if (TARGET_POWERPC64)
5208 operands[4] = gen_reg_rtx (DImode);
5209 operands[5] = gen_rtx_LSHIFTRT (DImode, operands[3], GEN_INT (63));
5210 operands[6] = gen_rtx_SUBREG (SImode, operands[4],
5211 WORDS_BIG_ENDIAN ? 4 : 0);
5215 operands[4] = gen_reg_rtx (SImode);
5216 operands[5] = gen_rtx_SUBREG (SImode, operands[3],
5217 WORDS_BIG_ENDIAN ? 0 : 4);
5218 operands[6] = gen_rtx_LSHIFTRT (SImode, operands[4], GEN_INT (31));
5222 (define_expand "copysign<mode>3"
5224 (abs:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")))
5226 (neg:SFDF (abs:SFDF (match_dup 1))))
5227 (set (match_operand:SFDF 0 "gpc_reg_operand" "")
5228 (if_then_else:SFDF (ge (match_operand:SFDF 2 "gpc_reg_operand" "")
5232 "TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>
5233 && ((TARGET_PPC_GFXOPT
5234 && !HONOR_NANS (<MODE>mode)
5235 && !HONOR_SIGNED_ZEROS (<MODE>mode))
5237 || VECTOR_UNIT_VSX_P (<MODE>mode))"
5239 if (TARGET_CMPB || VECTOR_UNIT_VSX_P (<MODE>mode))
5241 emit_insn (gen_copysign<mode>3_fcpsgn (operands[0], operands[1],
5246 operands[3] = gen_reg_rtx (<MODE>mode);
5247 operands[4] = gen_reg_rtx (<MODE>mode);
5248 operands[5] = CONST0_RTX (<MODE>mode);
5251 ;; Use an unspec rather providing an if-then-else in RTL, to prevent the
5252 ;; compiler from optimizing -0.0
5253 (define_insn "copysign<mode>3_fcpsgn"
5254 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
5255 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")
5256 (match_operand:SFDF 2 "gpc_reg_operand" "<rreg2>")]
5258 "TARGET_CMPB && !VECTOR_UNIT_VSX_P (<MODE>mode)"
5260 [(set_attr "type" "fp")])
5262 ;; For MIN, MAX, and conditional move, we use DEFINE_EXPAND's that involve a
5263 ;; fsel instruction and some auxiliary computations. Then we just have a
5264 ;; single DEFINE_INSN for fsel and the define_splits to make them if made by
5266 (define_expand "smaxsf3"
5267 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5268 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
5269 (match_operand:SF 2 "gpc_reg_operand" ""))
5272 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
5273 && TARGET_SINGLE_FLOAT && !flag_trapping_math"
5274 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
5276 (define_expand "sminsf3"
5277 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5278 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
5279 (match_operand:SF 2 "gpc_reg_operand" ""))
5282 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
5283 && TARGET_SINGLE_FLOAT && !flag_trapping_math"
5284 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
5287 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5288 (match_operator:SF 3 "min_max_operator"
5289 [(match_operand:SF 1 "gpc_reg_operand" "")
5290 (match_operand:SF 2 "gpc_reg_operand" "")]))]
5291 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
5292 && TARGET_SINGLE_FLOAT && !flag_trapping_math"
5295 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
5296 operands[1], operands[2]);
5300 (define_expand "mov<mode>cc"
5301 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
5302 (if_then_else:GPR (match_operand 1 "comparison_operator" "")
5303 (match_operand:GPR 2 "gpc_reg_operand" "")
5304 (match_operand:GPR 3 "gpc_reg_operand" "")))]
5308 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5314 ;; We use the BASE_REGS for the isel input operands because, if rA is
5315 ;; 0, the value of 0 is placed in rD upon truth. Similarly for rB
5316 ;; because we may switch the operands and rB may end up being rA.
5318 ;; We need 2 patterns: an unsigned and a signed pattern. We could
5319 ;; leave out the mode in operand 4 and use one pattern, but reload can
5320 ;; change the mode underneath our feet and then gets confused trying
5321 ;; to reload the value.
5322 (define_insn "isel_signed_<mode>"
5323 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
5325 (match_operator 1 "scc_comparison_operator"
5326 [(match_operand:CC 4 "cc_reg_operand" "y,y")
5328 (match_operand:GPR 2 "reg_or_cint_operand" "O,b")
5329 (match_operand:GPR 3 "gpc_reg_operand" "r,r")))]
5332 { return output_isel (operands); }"
5333 [(set_attr "type" "isel")
5334 (set_attr "length" "4")])
5336 (define_insn "isel_unsigned_<mode>"
5337 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
5339 (match_operator 1 "scc_comparison_operator"
5340 [(match_operand:CCUNS 4 "cc_reg_operand" "y,y")
5342 (match_operand:GPR 2 "reg_or_cint_operand" "O,b")
5343 (match_operand:GPR 3 "gpc_reg_operand" "r,r")))]
5346 { return output_isel (operands); }"
5347 [(set_attr "type" "isel")
5348 (set_attr "length" "4")])
5350 ;; These patterns can be useful for combine; they let combine know that
5351 ;; isel can handle reversed comparisons so long as the operands are
5354 (define_insn "*isel_reversed_signed_<mode>"
5355 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
5357 (match_operator 1 "scc_rev_comparison_operator"
5358 [(match_operand:CC 4 "cc_reg_operand" "y")
5360 (match_operand:GPR 2 "gpc_reg_operand" "b")
5361 (match_operand:GPR 3 "gpc_reg_operand" "b")))]
5364 { return output_isel (operands); }"
5365 [(set_attr "type" "isel")
5366 (set_attr "length" "4")])
5368 (define_insn "*isel_reversed_unsigned_<mode>"
5369 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
5371 (match_operator 1 "scc_rev_comparison_operator"
5372 [(match_operand:CCUNS 4 "cc_reg_operand" "y")
5374 (match_operand:GPR 2 "gpc_reg_operand" "b")
5375 (match_operand:GPR 3 "gpc_reg_operand" "b")))]
5378 { return output_isel (operands); }"
5379 [(set_attr "type" "isel")
5380 (set_attr "length" "4")])
5382 (define_expand "movsfcc"
5383 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5384 (if_then_else:SF (match_operand 1 "comparison_operator" "")
5385 (match_operand:SF 2 "gpc_reg_operand" "")
5386 (match_operand:SF 3 "gpc_reg_operand" "")))]
5387 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5390 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5396 (define_insn "*fselsfsf4"
5397 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5398 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
5399 (match_operand:SF 4 "zero_fp_constant" "F"))
5400 (match_operand:SF 2 "gpc_reg_operand" "f")
5401 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5402 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5404 [(set_attr "type" "fp")])
5406 (define_insn "*fseldfsf4"
5407 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5408 (if_then_else:SF (ge (match_operand:DF 1 "gpc_reg_operand" "d")
5409 (match_operand:DF 4 "zero_fp_constant" "F"))
5410 (match_operand:SF 2 "gpc_reg_operand" "f")
5411 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5412 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_SINGLE_FLOAT"
5414 [(set_attr "type" "fp")])
5416 (define_expand "negdf2"
5417 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5418 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
5419 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5422 (define_insn "*negdf2_fpr"
5423 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
5424 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "d")))]
5425 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5426 && !VECTOR_UNIT_VSX_P (DFmode)"
5428 [(set_attr "type" "fp")])
5430 (define_expand "absdf2"
5431 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5432 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
5433 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5436 (define_insn "*absdf2_fpr"
5437 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
5438 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "d")))]
5439 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5440 && !VECTOR_UNIT_VSX_P (DFmode)"
5442 [(set_attr "type" "fp")])
5444 (define_insn "*nabsdf2_fpr"
5445 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
5446 (neg:DF (abs:DF (match_operand:DF 1 "gpc_reg_operand" "d"))))]
5447 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5448 && !VECTOR_UNIT_VSX_P (DFmode)"
5450 [(set_attr "type" "fp")])
5452 (define_expand "adddf3"
5453 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5454 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "")
5455 (match_operand:DF 2 "gpc_reg_operand" "")))]
5456 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5459 (define_insn "*adddf3_fpr"
5460 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
5461 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
5462 (match_operand:DF 2 "gpc_reg_operand" "d")))]
5463 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5464 && !VECTOR_UNIT_VSX_P (DFmode)"
5466 [(set_attr "type" "fp")
5467 (set_attr "fp_type" "fp_addsub_d")])
5469 (define_expand "subdf3"
5470 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5471 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "")
5472 (match_operand:DF 2 "gpc_reg_operand" "")))]
5473 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5476 (define_insn "*subdf3_fpr"
5477 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
5478 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "d")
5479 (match_operand:DF 2 "gpc_reg_operand" "d")))]
5480 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5481 && !VECTOR_UNIT_VSX_P (DFmode)"
5483 [(set_attr "type" "fp")
5484 (set_attr "fp_type" "fp_addsub_d")])
5486 (define_expand "muldf3"
5487 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5488 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "")
5489 (match_operand:DF 2 "gpc_reg_operand" "")))]
5490 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5493 (define_insn "*muldf3_fpr"
5494 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
5495 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
5496 (match_operand:DF 2 "gpc_reg_operand" "d")))]
5497 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5498 && !VECTOR_UNIT_VSX_P (DFmode)"
5500 [(set_attr "type" "dmul")
5501 (set_attr "fp_type" "fp_mul_d")])
5503 (define_expand "divdf3"
5504 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5505 (div:DF (match_operand:DF 1 "gpc_reg_operand" "")
5506 (match_operand:DF 2 "gpc_reg_operand" "")))]
5508 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)
5509 && !TARGET_SIMPLE_FPU"
5512 (define_insn "*divdf3_fpr"
5513 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
5514 (div:DF (match_operand:DF 1 "gpc_reg_operand" "d")
5515 (match_operand:DF 2 "gpc_reg_operand" "d")))]
5516 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && !TARGET_SIMPLE_FPU
5517 && !VECTOR_UNIT_VSX_P (DFmode)"
5519 [(set_attr "type" "ddiv")])
5521 (define_insn "*fred_fpr"
5522 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5523 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))]
5524 "TARGET_FRE && !VECTOR_UNIT_VSX_P (DFmode)"
5526 [(set_attr "type" "fp")])
5528 (define_insn "*rsqrtdf_internal1"
5529 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
5530 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "d")]
5532 "TARGET_FRSQRTE && !VECTOR_UNIT_VSX_P (DFmode)"
5534 [(set_attr "type" "fp")])
5536 ; builtin fma support
5537 (define_insn "*fmadf4_fpr"
5538 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5539 (fma:DF (match_operand:DF 1 "gpc_reg_operand" "f")
5540 (match_operand:DF 2 "gpc_reg_operand" "f")
5541 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5542 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5543 && VECTOR_UNIT_NONE_P (DFmode)"
5545 [(set_attr "type" "fp")
5546 (set_attr "fp_type" "fp_maddsub_d")])
5548 (define_insn "*fmsdf4_fpr"
5549 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5550 (fma:DF (match_operand:DF 1 "gpc_reg_operand" "f")
5551 (match_operand:DF 2 "gpc_reg_operand" "f")
5552 (neg:DF (match_operand:DF 3 "gpc_reg_operand" "f"))))]
5553 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5554 && VECTOR_UNIT_NONE_P (DFmode)"
5556 [(set_attr "type" "fp")
5557 (set_attr "fp_type" "fp_maddsub_d")])
5559 (define_insn "*nfmadf4_fpr"
5560 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5561 (neg:DF (fma:DF (match_operand:DF 1 "gpc_reg_operand" "f")
5562 (match_operand:DF 2 "gpc_reg_operand" "f")
5563 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
5564 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5565 && VECTOR_UNIT_NONE_P (DFmode)"
5566 "fnmadd %0,%1,%2,%3"
5567 [(set_attr "type" "fp")
5568 (set_attr "fp_type" "fp_maddsub_d")])
5570 (define_insn "*nfmsdf4_fpr"
5571 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5572 (neg:DF (fma:DF (match_operand:DF 1 "gpc_reg_operand" "f")
5573 (match_operand:DF 2 "gpc_reg_operand" "f")
5574 (neg:DF (match_operand:DF 3 "gpc_reg_operand" "f")))))]
5575 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5576 && VECTOR_UNIT_NONE_P (DFmode)"
5577 "fnmsub %0,%1,%2,%3"
5578 [(set_attr "type" "fp")
5579 (set_attr "fp_type" "fp_maddsub_d")])
5581 (define_expand "sqrtdf2"
5582 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5583 (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
5584 "TARGET_PPC_GPOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5587 (define_insn "*sqrtdf2_fpr"
5588 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
5589 (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "d")))]
5590 "TARGET_PPC_GPOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5591 && !VECTOR_UNIT_VSX_P (DFmode)"
5593 [(set_attr "type" "dsqrt")])
5595 ;; The conditional move instructions allow us to perform max and min
5596 ;; operations even when
5598 (define_expand "smaxdf3"
5599 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5600 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
5601 (match_operand:DF 2 "gpc_reg_operand" ""))
5604 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5605 && !flag_trapping_math"
5606 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
5608 (define_expand "smindf3"
5609 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5610 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
5611 (match_operand:DF 2 "gpc_reg_operand" ""))
5614 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5615 && !flag_trapping_math"
5616 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
5619 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5620 (match_operator:DF 3 "min_max_operator"
5621 [(match_operand:DF 1 "gpc_reg_operand" "")
5622 (match_operand:DF 2 "gpc_reg_operand" "")]))]
5623 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5624 && !flag_trapping_math"
5627 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
5628 operands[1], operands[2]);
5632 (define_expand "movdfcc"
5633 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5634 (if_then_else:DF (match_operand 1 "comparison_operator" "")
5635 (match_operand:DF 2 "gpc_reg_operand" "")
5636 (match_operand:DF 3 "gpc_reg_operand" "")))]
5637 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5640 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5646 (define_insn "*fseldfdf4"
5647 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
5648 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "d")
5649 (match_operand:DF 4 "zero_fp_constant" "F"))
5650 (match_operand:DF 2 "gpc_reg_operand" "d")
5651 (match_operand:DF 3 "gpc_reg_operand" "d")))]
5652 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5654 [(set_attr "type" "fp")])
5656 (define_insn "*fselsfdf4"
5657 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
5658 (if_then_else:DF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
5659 (match_operand:SF 4 "zero_fp_constant" "F"))
5660 (match_operand:DF 2 "gpc_reg_operand" "d")
5661 (match_operand:DF 3 "gpc_reg_operand" "d")))]
5662 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_SINGLE_FLOAT"
5664 [(set_attr "type" "fp")])
5666 ;; Conversions to and from floating-point.
5668 ; We don't define lfiwax/lfiwzx with the normal definition, because we
5669 ; don't want to support putting SImode in FPR registers.
5670 (define_insn "lfiwax"
5671 [(set (match_operand:DI 0 "gpc_reg_operand" "=d,wm,!wm")
5672 (unspec:DI [(match_operand:SI 1 "reg_or_indexed_operand" "Z,Z,r")]
5674 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWAX"
5679 [(set_attr "type" "fpload,fpload,mffgpr")])
5681 ; This split must be run before register allocation because it allocates the
5682 ; memory slot that is needed to move values to/from the FPR. We don't allocate
5683 ; it earlier to allow for the combiner to merge insns together where it might
5684 ; not be needed and also in case the insns are deleted as dead code.
5686 (define_insn_and_split "floatsi<mode>2_lfiwax"
5687 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d")
5688 (float:SFDF (match_operand:SI 1 "nonimmediate_operand" "r")))
5689 (clobber (match_scratch:DI 2 "=d"))]
5690 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWAX
5691 && <SI_CONVERT_FP> && can_create_pseudo_p ()"
5697 rtx dest = operands[0];
5698 rtx src = operands[1];
5701 if (!MEM_P (src) && TARGET_POWERPC64
5702 && (TARGET_MFPGPR || TARGET_DIRECT_MOVE))
5703 tmp = convert_to_mode (DImode, src, false);
5707 if (GET_CODE (tmp) == SCRATCH)
5708 tmp = gen_reg_rtx (DImode);
5711 src = rs6000_address_for_fpconvert (src);
5712 emit_insn (gen_lfiwax (tmp, src));
5716 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
5717 emit_move_insn (stack, src);
5718 emit_insn (gen_lfiwax (tmp, stack));
5721 emit_insn (gen_floatdi<mode>2 (dest, tmp));
5724 [(set_attr "length" "12")
5725 (set_attr "type" "fpload")])
5727 (define_insn_and_split "floatsi<mode>2_lfiwax_mem"
5728 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d,<rreg2>")
5731 (match_operand:SI 1 "memory_operand" "Z,Z"))))
5732 (clobber (match_scratch:DI 2 "=0,d"))]
5733 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWAX
5740 operands[1] = rs6000_address_for_fpconvert (operands[1]);
5741 if (GET_CODE (operands[2]) == SCRATCH)
5742 operands[2] = gen_reg_rtx (DImode);
5743 emit_insn (gen_lfiwax (operands[2], operands[1]));
5744 emit_insn (gen_floatdi<mode>2 (operands[0], operands[2]));
5747 [(set_attr "length" "8")
5748 (set_attr "type" "fpload")])
5750 (define_insn "lfiwzx"
5751 [(set (match_operand:DI 0 "gpc_reg_operand" "=d,wm,!wm")
5752 (unspec:DI [(match_operand:SI 1 "reg_or_indexed_operand" "Z,Z,r")]
5754 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWZX"
5759 [(set_attr "type" "fpload,fpload,mftgpr")])
5761 (define_insn_and_split "floatunssi<mode>2_lfiwzx"
5762 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d")
5763 (unsigned_float:SFDF (match_operand:SI 1 "nonimmediate_operand" "r")))
5764 (clobber (match_scratch:DI 2 "=d"))]
5765 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWZX
5772 rtx dest = operands[0];
5773 rtx src = operands[1];
5776 if (!MEM_P (src) && TARGET_POWERPC64
5777 && (TARGET_MFPGPR || TARGET_DIRECT_MOVE))
5778 tmp = convert_to_mode (DImode, src, true);
5782 if (GET_CODE (tmp) == SCRATCH)
5783 tmp = gen_reg_rtx (DImode);
5786 src = rs6000_address_for_fpconvert (src);
5787 emit_insn (gen_lfiwzx (tmp, src));
5791 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
5792 emit_move_insn (stack, src);
5793 emit_insn (gen_lfiwzx (tmp, stack));
5796 emit_insn (gen_floatdi<mode>2 (dest, tmp));
5799 [(set_attr "length" "12")
5800 (set_attr "type" "fpload")])
5802 (define_insn_and_split "floatunssi<mode>2_lfiwzx_mem"
5803 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d,<rreg2>")
5804 (unsigned_float:SFDF
5806 (match_operand:SI 1 "memory_operand" "Z,Z"))))
5807 (clobber (match_scratch:DI 2 "=0,d"))]
5808 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWZX
5815 operands[1] = rs6000_address_for_fpconvert (operands[1]);
5816 if (GET_CODE (operands[2]) == SCRATCH)
5817 operands[2] = gen_reg_rtx (DImode);
5818 emit_insn (gen_lfiwzx (operands[2], operands[1]));
5819 emit_insn (gen_floatdi<mode>2 (operands[0], operands[2]));
5822 [(set_attr "length" "8")
5823 (set_attr "type" "fpload")])
5825 ; For each of these conversions, there is a define_expand, a define_insn
5826 ; with a '#' template, and a define_split (with C code). The idea is
5827 ; to allow constant folding with the template of the define_insn,
5828 ; then to have the insns split later (between sched1 and final).
5830 (define_expand "floatsidf2"
5831 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5832 (float:DF (match_operand:SI 1 "nonimmediate_operand" "")))
5835 (clobber (match_dup 4))
5836 (clobber (match_dup 5))
5837 (clobber (match_dup 6))])]
5839 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5842 if (TARGET_E500_DOUBLE)
5844 if (!REG_P (operands[1]))
5845 operands[1] = force_reg (SImode, operands[1]);
5846 emit_insn (gen_spe_floatsidf2 (operands[0], operands[1]));
5849 else if (TARGET_LFIWAX && TARGET_FCFID)
5851 emit_insn (gen_floatsidf2_lfiwax (operands[0], operands[1]));
5854 else if (TARGET_FCFID)
5856 rtx dreg = operands[1];
5858 dreg = force_reg (SImode, dreg);
5859 dreg = convert_to_mode (DImode, dreg, false);
5860 emit_insn (gen_floatdidf2 (operands[0], dreg));
5864 if (!REG_P (operands[1]))
5865 operands[1] = force_reg (SImode, operands[1]);
5866 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5867 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503601774854144\", DFmode));
5868 operands[4] = rs6000_allocate_stack_temp (DFmode, true, false);
5869 operands[5] = gen_reg_rtx (DFmode);
5870 operands[6] = gen_reg_rtx (SImode);
5873 (define_insn_and_split "*floatsidf2_internal"
5874 [(set (match_operand:DF 0 "gpc_reg_operand" "=&d")
5875 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5876 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5877 (use (match_operand:DF 3 "gpc_reg_operand" "d"))
5878 (clobber (match_operand:DF 4 "offsettable_mem_operand" "=o"))
5879 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&d"))
5880 (clobber (match_operand:SI 6 "gpc_reg_operand" "=&r"))]
5881 "! TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5887 rtx lowword, highword;
5888 gcc_assert (MEM_P (operands[4]));
5889 highword = adjust_address (operands[4], SImode, 0);
5890 lowword = adjust_address (operands[4], SImode, 4);
5891 if (! WORDS_BIG_ENDIAN)
5894 tmp = highword; highword = lowword; lowword = tmp;
5897 emit_insn (gen_xorsi3 (operands[6], operands[1],
5898 GEN_INT (~ (HOST_WIDE_INT) 0x7fffffff)));
5899 emit_move_insn (lowword, operands[6]);
5900 emit_move_insn (highword, operands[2]);
5901 emit_move_insn (operands[5], operands[4]);
5902 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5905 [(set_attr "length" "24")
5906 (set_attr "type" "fp")])
5908 ;; If we don't have a direct conversion to single precision, don't enable this
5909 ;; conversion for 32-bit without fast math, because we don't have the insn to
5910 ;; generate the fixup swizzle to avoid double rounding problems.
5911 (define_expand "floatunssisf2"
5912 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5913 (unsigned_float:SF (match_operand:SI 1 "nonimmediate_operand" "")))]
5914 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT
5917 && ((TARGET_FCFIDUS && TARGET_LFIWZX)
5918 || (TARGET_DOUBLE_FLOAT && TARGET_FCFID
5919 && (TARGET_POWERPC64 || flag_unsafe_math_optimizations)))))"
5924 if (!REG_P (operands[1]))
5925 operands[1] = force_reg (SImode, operands[1]);
5927 else if (TARGET_LFIWZX && TARGET_FCFIDUS)
5929 emit_insn (gen_floatunssisf2_lfiwzx (operands[0], operands[1]));
5934 rtx dreg = operands[1];
5936 dreg = force_reg (SImode, dreg);
5937 dreg = convert_to_mode (DImode, dreg, true);
5938 emit_insn (gen_floatdisf2 (operands[0], dreg));
5943 (define_expand "floatunssidf2"
5944 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5945 (unsigned_float:DF (match_operand:SI 1 "nonimmediate_operand" "")))
5948 (clobber (match_dup 4))
5949 (clobber (match_dup 5))])]
5951 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5954 if (TARGET_E500_DOUBLE)
5956 if (!REG_P (operands[1]))
5957 operands[1] = force_reg (SImode, operands[1]);
5958 emit_insn (gen_spe_floatunssidf2 (operands[0], operands[1]));
5961 else if (TARGET_LFIWZX && TARGET_FCFID)
5963 emit_insn (gen_floatunssidf2_lfiwzx (operands[0], operands[1]));
5966 else if (TARGET_FCFID)
5968 rtx dreg = operands[1];
5970 dreg = force_reg (SImode, dreg);
5971 dreg = convert_to_mode (DImode, dreg, true);
5972 emit_insn (gen_floatdidf2 (operands[0], dreg));
5976 if (!REG_P (operands[1]))
5977 operands[1] = force_reg (SImode, operands[1]);
5978 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5979 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503599627370496\", DFmode));
5980 operands[4] = rs6000_allocate_stack_temp (DFmode, true, false);
5981 operands[5] = gen_reg_rtx (DFmode);
5984 (define_insn_and_split "*floatunssidf2_internal"
5985 [(set (match_operand:DF 0 "gpc_reg_operand" "=&d")
5986 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5987 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5988 (use (match_operand:DF 3 "gpc_reg_operand" "d"))
5989 (clobber (match_operand:DF 4 "offsettable_mem_operand" "=o"))
5990 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&d"))]
5991 "! TARGET_FCFIDU && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5992 && !(TARGET_FCFID && TARGET_POWERPC64)"
5998 rtx lowword, highword;
5999 gcc_assert (MEM_P (operands[4]));
6000 highword = adjust_address (operands[4], SImode, 0);
6001 lowword = adjust_address (operands[4], SImode, 4);
6002 if (! WORDS_BIG_ENDIAN)
6005 tmp = highword; highword = lowword; lowword = tmp;
6008 emit_move_insn (lowword, operands[1]);
6009 emit_move_insn (highword, operands[2]);
6010 emit_move_insn (operands[5], operands[4]);
6011 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
6014 [(set_attr "length" "20")
6015 (set_attr "type" "fp")])
6017 (define_expand "fix_trunc<mode>si2"
6018 [(set (match_operand:SI 0 "gpc_reg_operand" "")
6019 (fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "")))]
6020 "TARGET_HARD_FLOAT && ((TARGET_FPRS && <TARGET_FLOAT>) || <E500_CONVERT>)"
6023 if (!<E500_CONVERT>)
6028 emit_insn (gen_fix_trunc<mode>si2_stfiwx (operands[0], operands[1]));
6031 tmp = gen_reg_rtx (DImode);
6032 stack = rs6000_allocate_stack_temp (DImode, true, false);
6033 emit_insn (gen_fix_trunc<mode>si2_internal (operands[0], operands[1],
6040 ; Like the convert to float patterns, this insn must be split before
6041 ; register allocation so that it can allocate the memory slot if it
6043 (define_insn_and_split "fix_trunc<mode>si2_stfiwx"
6044 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
6045 (fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d")))
6046 (clobber (match_scratch:DI 2 "=d"))]
6047 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6048 && (<MODE>mode != SFmode || TARGET_SINGLE_FLOAT)
6049 && TARGET_STFIWX && can_create_pseudo_p ()"
6054 rtx dest = operands[0];
6055 rtx src = operands[1];
6056 rtx tmp = operands[2];
6058 if (GET_CODE (tmp) == SCRATCH)
6059 tmp = gen_reg_rtx (DImode);
6061 emit_insn (gen_fctiwz_<mode> (tmp, src));
6064 dest = rs6000_address_for_fpconvert (dest);
6065 emit_insn (gen_stfiwx (dest, tmp));
6068 else if (TARGET_POWERPC64 && (TARGET_MFPGPR || TARGET_DIRECT_MOVE))
6070 dest = gen_lowpart (DImode, dest);
6071 emit_move_insn (dest, tmp);
6076 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
6077 emit_insn (gen_stfiwx (stack, tmp));
6078 emit_move_insn (dest, stack);
6082 [(set_attr "length" "12")
6083 (set_attr "type" "fp")])
6085 (define_insn_and_split "fix_trunc<mode>si2_internal"
6086 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,?r")
6087 (fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d,<rreg>")))
6088 (clobber (match_operand:DI 2 "gpc_reg_operand" "=1,d"))
6089 (clobber (match_operand:DI 3 "offsettable_mem_operand" "=o,o"))]
6090 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6097 gcc_assert (MEM_P (operands[3]));
6098 lowword = adjust_address (operands[3], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
6100 emit_insn (gen_fctiwz_<mode> (operands[2], operands[1]));
6101 emit_move_insn (operands[3], operands[2]);
6102 emit_move_insn (operands[0], lowword);
6105 [(set_attr "length" "16")
6106 (set_attr "type" "fp")])
6108 (define_expand "fix_trunc<mode>di2"
6109 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6110 (fix:DI (match_operand:SFDF 1 "gpc_reg_operand" "")))]
6111 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
6115 (define_insn "*fix_trunc<mode>di2_fctidz"
6116 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6117 (fix:DI (match_operand:SFDF 1 "gpc_reg_operand" "d")))]
6118 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
6119 && TARGET_FCFID && !VECTOR_UNIT_VSX_P (<MODE>mode)"
6121 [(set_attr "type" "fp")])
6123 (define_expand "fixuns_trunc<mode>si2"
6124 [(set (match_operand:SI 0 "gpc_reg_operand" "")
6125 (unsigned_fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "")))]
6127 && ((TARGET_FPRS && <TARGET_FLOAT> && TARGET_FCTIWUZ && TARGET_STFIWX)
6131 if (!<E500_CONVERT>)
6133 emit_insn (gen_fixuns_trunc<mode>si2_stfiwx (operands[0], operands[1]));
6138 (define_insn_and_split "fixuns_trunc<mode>si2_stfiwx"
6139 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
6140 (unsigned_fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d")))
6141 (clobber (match_scratch:DI 2 "=d"))]
6142 "TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT> && TARGET_FCTIWUZ
6143 && TARGET_STFIWX && can_create_pseudo_p ()"
6148 rtx dest = operands[0];
6149 rtx src = operands[1];
6150 rtx tmp = operands[2];
6152 if (GET_CODE (tmp) == SCRATCH)
6153 tmp = gen_reg_rtx (DImode);
6155 emit_insn (gen_fctiwuz_<mode> (tmp, src));
6158 dest = rs6000_address_for_fpconvert (dest);
6159 emit_insn (gen_stfiwx (dest, tmp));
6162 else if (TARGET_POWERPC64 && (TARGET_MFPGPR || TARGET_DIRECT_MOVE))
6164 dest = gen_lowpart (DImode, dest);
6165 emit_move_insn (dest, tmp);
6170 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
6171 emit_insn (gen_stfiwx (stack, tmp));
6172 emit_move_insn (dest, stack);
6176 [(set_attr "length" "12")
6177 (set_attr "type" "fp")])
6179 (define_expand "fixuns_trunc<mode>di2"
6180 [(set (match_operand:DI 0 "register_operand" "")
6181 (unsigned_fix:DI (match_operand:SFDF 1 "register_operand" "")))]
6182 "TARGET_HARD_FLOAT && (TARGET_FCTIDUZ || VECTOR_UNIT_VSX_P (<MODE>mode))"
6185 (define_insn "*fixuns_trunc<mode>di2_fctiduz"
6186 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6187 (unsigned_fix:DI (match_operand:SFDF 1 "gpc_reg_operand" "d")))]
6188 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
6189 && TARGET_FCTIDUZ && !VECTOR_UNIT_VSX_P (<MODE>mode)"
6191 [(set_attr "type" "fp")])
6193 ; Here, we use (set (reg) (unspec:DI [(fix:SI ...)] UNSPEC_FCTIWZ))
6194 ; rather than (set (subreg:SI (reg)) (fix:SI ...))
6195 ; because the first makes it clear that operand 0 is not live
6196 ; before the instruction.
6197 (define_insn "fctiwz_<mode>"
6198 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6199 (unspec:DI [(fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d"))]
6201 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6203 [(set_attr "type" "fp")])
6205 (define_insn "fctiwuz_<mode>"
6206 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6207 (unspec:DI [(unsigned_fix:SI
6208 (match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>"))]
6210 "TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT> && TARGET_FCTIWUZ"
6212 [(set_attr "type" "fp")])
6214 ;; Only optimize (float (fix x)) -> frz if we are in fast-math mode, since
6215 ;; since the friz instruction does not truncate the value if the floating
6216 ;; point value is < LONG_MIN or > LONG_MAX.
6217 (define_insn "*friz"
6218 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6219 (float:DF (fix:DI (match_operand:DF 1 "gpc_reg_operand" "d"))))]
6220 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_FPRND
6221 && !VECTOR_UNIT_VSX_P (DFmode) && flag_unsafe_math_optimizations
6222 && !flag_trapping_math && TARGET_FRIZ"
6224 [(set_attr "type" "fp")])
6226 ;; Since FCTIWZ doesn't sign extend the upper bits, we have to do a store and a
6227 ;; load to properly sign extend the value, but at least doing a store, load
6228 ;; into a GPR to sign extend, a store from the GPR and a load back into the FPR
6229 ;; if we have 32-bit memory ops
6230 (define_insn_and_split "*round32<mode>2_fprs"
6231 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d")
6233 (fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d"))))
6234 (clobber (match_scratch:DI 2 "=d"))
6235 (clobber (match_scratch:DI 3 "=d"))]
6236 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6237 && <SI_CONVERT_FP> && TARGET_LFIWAX && TARGET_STFIWX && TARGET_FCFID
6238 && can_create_pseudo_p ()"
6243 rtx dest = operands[0];
6244 rtx src = operands[1];
6245 rtx tmp1 = operands[2];
6246 rtx tmp2 = operands[3];
6247 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
6249 if (GET_CODE (tmp1) == SCRATCH)
6250 tmp1 = gen_reg_rtx (DImode);
6251 if (GET_CODE (tmp2) == SCRATCH)
6252 tmp2 = gen_reg_rtx (DImode);
6254 emit_insn (gen_fctiwz_<mode> (tmp1, src));
6255 emit_insn (gen_stfiwx (stack, tmp1));
6256 emit_insn (gen_lfiwax (tmp2, stack));
6257 emit_insn (gen_floatdi<mode>2 (dest, tmp2));
6260 [(set_attr "type" "fpload")
6261 (set_attr "length" "16")])
6263 (define_insn_and_split "*roundu32<mode>2_fprs"
6264 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d")
6265 (unsigned_float:SFDF
6266 (unsigned_fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d"))))
6267 (clobber (match_scratch:DI 2 "=d"))
6268 (clobber (match_scratch:DI 3 "=d"))]
6269 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6270 && TARGET_LFIWZX && TARGET_STFIWX && TARGET_FCFIDU
6271 && can_create_pseudo_p ()"
6276 rtx dest = operands[0];
6277 rtx src = operands[1];
6278 rtx tmp1 = operands[2];
6279 rtx tmp2 = operands[3];
6280 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
6282 if (GET_CODE (tmp1) == SCRATCH)
6283 tmp1 = gen_reg_rtx (DImode);
6284 if (GET_CODE (tmp2) == SCRATCH)
6285 tmp2 = gen_reg_rtx (DImode);
6287 emit_insn (gen_fctiwuz_<mode> (tmp1, src));
6288 emit_insn (gen_stfiwx (stack, tmp1));
6289 emit_insn (gen_lfiwzx (tmp2, stack));
6290 emit_insn (gen_floatdi<mode>2 (dest, tmp2));
6293 [(set_attr "type" "fpload")
6294 (set_attr "length" "16")])
6296 ;; No VSX equivalent to fctid
6297 (define_insn "lrint<mode>di2"
6298 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6299 (unspec:DI [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
6301 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
6303 [(set_attr "type" "fp")])
6305 (define_expand "btrunc<mode>2"
6306 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
6307 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "")]
6309 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
6312 (define_insn "*btrunc<mode>2_fpr"
6313 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
6314 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
6316 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>
6317 && !VECTOR_UNIT_VSX_P (<MODE>mode)"
6319 [(set_attr "type" "fp")])
6321 (define_expand "ceil<mode>2"
6322 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
6323 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "")]
6325 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
6328 (define_insn "*ceil<mode>2_fpr"
6329 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
6330 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
6332 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>
6333 && !VECTOR_UNIT_VSX_P (<MODE>mode)"
6335 [(set_attr "type" "fp")])
6337 (define_expand "floor<mode>2"
6338 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
6339 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "")]
6341 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
6344 (define_insn "*floor<mode>2_fpr"
6345 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
6346 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
6348 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>
6349 && !VECTOR_UNIT_VSX_P (<MODE>mode)"
6351 [(set_attr "type" "fp")])
6353 ;; No VSX equivalent to frin
6354 (define_insn "round<mode>2"
6355 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
6356 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
6358 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
6360 [(set_attr "type" "fp")])
6362 ; An UNSPEC is used so we don't have to support SImode in FP registers.
6363 (define_insn "stfiwx"
6364 [(set (match_operand:SI 0 "memory_operand" "=Z")
6365 (unspec:SI [(match_operand:DI 1 "gpc_reg_operand" "d")]
6369 [(set_attr "type" "fpstore")])
6371 ;; If we don't have a direct conversion to single precision, don't enable this
6372 ;; conversion for 32-bit without fast math, because we don't have the insn to
6373 ;; generate the fixup swizzle to avoid double rounding problems.
6374 (define_expand "floatsisf2"
6375 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6376 (float:SF (match_operand:SI 1 "nonimmediate_operand" "")))]
6377 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT
6380 && ((TARGET_FCFIDS && TARGET_LFIWAX)
6381 || (TARGET_DOUBLE_FLOAT && TARGET_FCFID
6382 && (TARGET_POWERPC64 || flag_unsafe_math_optimizations)))))"
6387 if (!REG_P (operands[1]))
6388 operands[1] = force_reg (SImode, operands[1]);
6390 else if (TARGET_FCFIDS && TARGET_LFIWAX)
6392 emit_insn (gen_floatsisf2_lfiwax (operands[0], operands[1]));
6395 else if (TARGET_FCFID && TARGET_LFIWAX)
6397 rtx dfreg = gen_reg_rtx (DFmode);
6398 emit_insn (gen_floatsidf2_lfiwax (dfreg, operands[1]));
6399 emit_insn (gen_truncdfsf2 (operands[0], dfreg));
6404 rtx dreg = operands[1];
6406 dreg = force_reg (SImode, dreg);
6407 dreg = convert_to_mode (DImode, dreg, false);
6408 emit_insn (gen_floatdisf2 (operands[0], dreg));
6413 (define_expand "floatdidf2"
6414 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6415 (float:DF (match_operand:DI 1 "gpc_reg_operand" "")))]
6416 "TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS"
6419 (define_insn "*floatdidf2_fpr"
6420 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6421 (float:DF (match_operand:DI 1 "gpc_reg_operand" "d")))]
6422 "TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
6423 && !VECTOR_UNIT_VSX_P (DFmode)"
6425 [(set_attr "type" "fp")])
6427 ; Allow the combiner to merge source memory operands to the conversion so that
6428 ; the optimizer/register allocator doesn't try to load the value too early in a
6429 ; GPR and then use store/load to move it to a FPR and suffer from a store-load
6430 ; hit. We will split after reload to avoid the trip through the GPRs
6432 (define_insn_and_split "*floatdidf2_mem"
6433 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6434 (float:DF (match_operand:DI 1 "memory_operand" "m")))
6435 (clobber (match_scratch:DI 2 "=d"))]
6436 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS && TARGET_FCFID"
6438 "&& reload_completed"
6439 [(set (match_dup 2) (match_dup 1))
6440 (set (match_dup 0) (float:DF (match_dup 2)))]
6442 [(set_attr "length" "8")
6443 (set_attr "type" "fpload")])
6445 (define_expand "floatunsdidf2"
6446 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6448 (match_operand:DI 1 "gpc_reg_operand" "")))]
6449 "TARGET_HARD_FLOAT && (TARGET_FCFIDU || VECTOR_UNIT_VSX_P (DFmode))"
6452 (define_insn "*floatunsdidf2_fcfidu"
6453 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6454 (unsigned_float:DF (match_operand:DI 1 "gpc_reg_operand" "d")))]
6455 "TARGET_HARD_FLOAT && TARGET_FCFIDU && !VECTOR_UNIT_VSX_P (DFmode)"
6457 [(set_attr "type" "fp")
6458 (set_attr "length" "4")])
6460 (define_insn_and_split "*floatunsdidf2_mem"
6461 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6462 (unsigned_float:DF (match_operand:DI 1 "memory_operand" "m")))
6463 (clobber (match_scratch:DI 2 "=d"))]
6464 "TARGET_HARD_FLOAT && (TARGET_FCFIDU || VECTOR_UNIT_VSX_P (DFmode))"
6466 "&& reload_completed"
6467 [(set (match_dup 2) (match_dup 1))
6468 (set (match_dup 0) (unsigned_float:DF (match_dup 2)))]
6470 [(set_attr "length" "8")
6471 (set_attr "type" "fpload")])
6473 (define_expand "floatdisf2"
6474 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6475 (float:SF (match_operand:DI 1 "gpc_reg_operand" "")))]
6476 "TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
6477 && (TARGET_FCFIDS || TARGET_POWERPC64 || flag_unsafe_math_optimizations)"
6482 rtx val = operands[1];
6483 if (!flag_unsafe_math_optimizations)
6485 rtx label = gen_label_rtx ();
6486 val = gen_reg_rtx (DImode);
6487 emit_insn (gen_floatdisf2_internal2 (val, operands[1], label));
6490 emit_insn (gen_floatdisf2_internal1 (operands[0], val));
6495 (define_insn "floatdisf2_fcfids"
6496 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6497 (float:SF (match_operand:DI 1 "gpc_reg_operand" "d")))]
6498 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
6499 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDS"
6501 [(set_attr "type" "fp")])
6503 (define_insn_and_split "*floatdisf2_mem"
6504 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6505 (float:SF (match_operand:DI 1 "memory_operand" "m")))
6506 (clobber (match_scratch:DI 2 "=f"))]
6507 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
6508 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDS"
6510 "&& reload_completed"
6514 emit_move_insn (operands[2], operands[1]);
6515 emit_insn (gen_floatdisf2_fcfids (operands[0], operands[2]));
6518 [(set_attr "length" "8")])
6520 ;; This is not IEEE compliant if rounding mode is "round to nearest".
6521 ;; If the DI->DF conversion is inexact, then it's possible to suffer
6522 ;; from double rounding.
6523 ;; Instead of creating a new cpu type for two FP operations, just use fp
6524 (define_insn_and_split "floatdisf2_internal1"
6525 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6526 (float:SF (match_operand:DI 1 "gpc_reg_operand" "d")))
6527 (clobber (match_scratch:DF 2 "=d"))]
6528 "TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
6530 "&& reload_completed"
6532 (float:DF (match_dup 1)))
6534 (float_truncate:SF (match_dup 2)))]
6536 [(set_attr "length" "8")
6537 (set_attr "type" "fp")])
6539 ;; Twiddles bits to avoid double rounding.
6540 ;; Bits that might be truncated when converting to DFmode are replaced
6541 ;; by a bit that won't be lost at that stage, but is below the SFmode
6542 ;; rounding position.
6543 (define_expand "floatdisf2_internal2"
6544 [(set (match_dup 3) (ashiftrt:DI (match_operand:DI 1 "" "")
6546 (parallel [(set (match_operand:DI 0 "" "") (and:DI (match_dup 1)
6548 (clobber (scratch:CC))])
6549 (set (match_dup 3) (plus:DI (match_dup 3)
6551 (set (match_dup 0) (plus:DI (match_dup 0)
6553 (set (match_dup 4) (compare:CCUNS (match_dup 3)
6555 (set (match_dup 0) (ior:DI (match_dup 0)
6557 (parallel [(set (match_dup 0) (and:DI (match_dup 0)
6559 (clobber (scratch:CC))])
6560 (set (pc) (if_then_else (geu (match_dup 4) (const_int 0))
6561 (label_ref (match_operand:DI 2 "" ""))
6563 (set (match_dup 0) (match_dup 1))]
6564 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
6567 operands[3] = gen_reg_rtx (DImode);
6568 operands[4] = gen_reg_rtx (CCUNSmode);
6571 (define_expand "floatunsdisf2"
6572 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6573 (unsigned_float:SF (match_operand:DI 1 "gpc_reg_operand" "")))]
6574 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
6575 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDUS"
6578 (define_insn "floatunsdisf2_fcfidus"
6579 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6580 (unsigned_float:SF (match_operand:DI 1 "gpc_reg_operand" "d")))]
6581 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
6582 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDUS"
6584 [(set_attr "type" "fp")])
6586 (define_insn_and_split "*floatunsdisf2_mem"
6587 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6588 (unsigned_float:SF (match_operand:DI 1 "memory_operand" "m")))
6589 (clobber (match_scratch:DI 2 "=f"))]
6590 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
6591 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDUS"
6593 "&& reload_completed"
6597 emit_move_insn (operands[2], operands[1]);
6598 emit_insn (gen_floatunsdisf2_fcfidus (operands[0], operands[2]));
6601 [(set_attr "length" "8")
6602 (set_attr "type" "fpload")])
6604 ;; Define the DImode operations that can be done in a small number
6605 ;; of instructions. The & constraints are to prevent the register
6606 ;; allocator from allocating registers that overlap with the inputs
6607 ;; (for example, having an input in 7,8 and an output in 6,7). We
6608 ;; also allow for the output being the same as one of the inputs.
6610 (define_insn "*adddi3_noppc64"
6611 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r")
6612 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,0,0")
6613 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I")))]
6614 "! TARGET_POWERPC64"
6617 if (WORDS_BIG_ENDIAN)
6618 return (GET_CODE (operands[2])) != CONST_INT
6619 ? \"addc %L0,%L1,%L2\;adde %0,%1,%2\"
6620 : \"addic %L0,%L1,%2\;add%G2e %0,%1\";
6622 return (GET_CODE (operands[2])) != CONST_INT
6623 ? \"addc %0,%1,%2\;adde %L0,%L1,%L2\"
6624 : \"addic %0,%1,%2\;add%G2e %L0,%L1\";
6626 [(set_attr "type" "two")
6627 (set_attr "length" "8")])
6629 (define_insn "*subdi3_noppc64"
6630 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r,r")
6631 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I,0,r,I")
6632 (match_operand:DI 2 "gpc_reg_operand" "r,r,r,0,0")))]
6633 "! TARGET_POWERPC64"
6636 if (WORDS_BIG_ENDIAN)
6637 return (GET_CODE (operands[1]) != CONST_INT)
6638 ? \"subfc %L0,%L2,%L1\;subfe %0,%2,%1\"
6639 : \"subfic %L0,%L2,%1\;subf%G1e %0,%2\";
6641 return (GET_CODE (operands[1]) != CONST_INT)
6642 ? \"subfc %0,%2,%1\;subfe %L0,%L2,%L1\"
6643 : \"subfic %0,%2,%1\;subf%G1e %L0,%L2\";
6645 [(set_attr "type" "two")
6646 (set_attr "length" "8")])
6648 (define_insn "*negdi2_noppc64"
6649 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6650 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))]
6651 "! TARGET_POWERPC64"
6654 return (WORDS_BIG_ENDIAN)
6655 ? \"subfic %L0,%L1,0\;subfze %0,%1\"
6656 : \"subfic %0,%1,0\;subfze %L0,%L1\";
6658 [(set_attr "type" "two")
6659 (set_attr "length" "8")])
6661 (define_insn "mulsidi3"
6662 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6663 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6664 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
6665 "! TARGET_POWERPC64"
6667 return (WORDS_BIG_ENDIAN)
6668 ? \"mulhw %0,%1,%2\;mullw %L0,%1,%2\"
6669 : \"mulhw %L0,%1,%2\;mullw %0,%1,%2\";
6671 [(set_attr "type" "imul")
6672 (set_attr "length" "8")])
6675 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6676 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6677 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6678 "! TARGET_POWERPC64 && reload_completed"
6681 (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
6682 (sign_extend:DI (match_dup 2)))
6685 (mult:SI (match_dup 1)
6689 int endian = (WORDS_BIG_ENDIAN == 0);
6690 operands[3] = operand_subword (operands[0], endian, 0, DImode);
6691 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
6694 (define_insn "umulsidi3"
6695 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6696 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6697 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
6698 "! TARGET_POWERPC64"
6701 return (WORDS_BIG_ENDIAN)
6702 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
6703 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
6705 [(set_attr "type" "imul")
6706 (set_attr "length" "8")])
6709 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6710 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6711 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6712 "! TARGET_POWERPC64 && reload_completed"
6715 (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
6716 (zero_extend:DI (match_dup 2)))
6719 (mult:SI (match_dup 1)
6723 int endian = (WORDS_BIG_ENDIAN == 0);
6724 operands[3] = operand_subword (operands[0], endian, 0, DImode);
6725 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
6728 (define_insn "smulsi3_highpart"
6729 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6731 (lshiftrt:DI (mult:DI (sign_extend:DI
6732 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6734 (match_operand:SI 2 "gpc_reg_operand" "r")))
6738 [(set_attr "type" "imul")])
6740 (define_insn "umulsi3_highpart"
6741 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6743 (lshiftrt:DI (mult:DI (zero_extend:DI
6744 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6746 (match_operand:SI 2 "gpc_reg_operand" "r")))
6750 [(set_attr "type" "imul")])
6752 ;; Shift by a variable amount is too complex to be worth open-coding. We
6753 ;; just handle shifts by constants.
6754 (define_insn "ashrdi3_no_power"
6755 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
6756 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6757 (match_operand:SI 2 "const_int_operand" "M,i")))]
6761 switch (which_alternative)
6766 if (WORDS_BIG_ENDIAN)
6767 return \"srawi %0,%1,31\;srawi %L0,%1,%h2\";
6769 return \"srawi %L0,%L1,31\;srawi %0,%L1,%h2\";
6771 if (WORDS_BIG_ENDIAN)
6772 return \"srwi %L0,%L1,%h2\;insrwi %L0,%1,%h2,0\;srawi %0,%1,%h2\";
6774 return \"srwi %0,%1,%h2\;insrwi %0,%L1,%h2,0\;srawi %L0,%L1,%h2\";
6777 [(set_attr "type" "two,three")
6778 (set_attr "length" "8,12")])
6780 (define_insn "*ashrdisi3_noppc64be"
6781 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6782 (subreg:SI (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6783 (const_int 32)) 4))]
6784 "TARGET_32BIT && !TARGET_POWERPC64 && WORDS_BIG_ENDIAN"
6787 if (REGNO (operands[0]) == REGNO (operands[1]))
6790 return \"mr %0,%1\";
6792 [(set_attr "length" "4")])
6795 ;; PowerPC64 DImode operations.
6797 (define_insn "muldi3"
6798 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6799 (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6800 (match_operand:DI 2 "reg_or_short_operand" "r,I")))]
6806 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
6807 (const_string "imul3")
6808 (match_operand:SI 2 "short_cint_operand" "")
6809 (const_string "imul2")]
6810 (const_string "lmul")))])
6812 (define_insn "*muldi3_internal1"
6813 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6814 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6815 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6817 (clobber (match_scratch:DI 3 "=r,r"))]
6822 [(set_attr "type" "lmul_compare")
6823 (set_attr "length" "4,8")])
6826 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6827 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
6828 (match_operand:DI 2 "gpc_reg_operand" ""))
6830 (clobber (match_scratch:DI 3 ""))]
6831 "TARGET_POWERPC64 && reload_completed"
6833 (mult:DI (match_dup 1) (match_dup 2)))
6835 (compare:CC (match_dup 3)
6839 (define_insn "*muldi3_internal2"
6840 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6841 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6842 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6844 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6845 (mult:DI (match_dup 1) (match_dup 2)))]
6850 [(set_attr "type" "lmul_compare")
6851 (set_attr "length" "4,8")])
6854 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
6855 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
6856 (match_operand:DI 2 "gpc_reg_operand" ""))
6858 (set (match_operand:DI 0 "gpc_reg_operand" "")
6859 (mult:DI (match_dup 1) (match_dup 2)))]
6860 "TARGET_POWERPC64 && reload_completed"
6862 (mult:DI (match_dup 1) (match_dup 2)))
6864 (compare:CC (match_dup 0)
6868 (define_insn "smuldi3_highpart"
6869 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6871 (lshiftrt:TI (mult:TI (sign_extend:TI
6872 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6874 (match_operand:DI 2 "gpc_reg_operand" "r")))
6878 [(set_attr "type" "lmul")])
6880 (define_insn "umuldi3_highpart"
6881 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6883 (lshiftrt:TI (mult:TI (zero_extend:TI
6884 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6886 (match_operand:DI 2 "gpc_reg_operand" "r")))
6890 [(set_attr "type" "lmul")])
6892 (define_expand "mulditi3"
6893 [(set (match_operand:TI 0 "gpc_reg_operand")
6894 (mult:TI (sign_extend:TI (match_operand:DI 1 "gpc_reg_operand"))
6895 (sign_extend:TI (match_operand:DI 2 "gpc_reg_operand"))))]
6898 rtx l = gen_reg_rtx (DImode), h = gen_reg_rtx (DImode);
6899 emit_insn (gen_muldi3 (l, operands[1], operands[2]));
6900 emit_insn (gen_smuldi3_highpart (h, operands[1], operands[2]));
6901 emit_move_insn (gen_lowpart (DImode, operands[0]), l);
6902 emit_move_insn (gen_highpart (DImode, operands[0]), h);
6906 (define_expand "umulditi3"
6907 [(set (match_operand:TI 0 "gpc_reg_operand")
6908 (mult:TI (zero_extend:TI (match_operand:DI 1 "gpc_reg_operand"))
6909 (zero_extend:TI (match_operand:DI 2 "gpc_reg_operand"))))]
6912 rtx l = gen_reg_rtx (DImode), h = gen_reg_rtx (DImode);
6913 emit_insn (gen_muldi3 (l, operands[1], operands[2]));
6914 emit_insn (gen_umuldi3_highpart (h, operands[1], operands[2]));
6915 emit_move_insn (gen_lowpart (DImode, operands[0]), l);
6916 emit_move_insn (gen_highpart (DImode, operands[0]), h);
6920 (define_insn "rotldi3"
6921 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6922 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6923 (match_operand:DI 2 "reg_or_cint_operand" "r,i")))]
6928 [(set_attr "type" "var_shift_rotate,integer")])
6930 (define_insn "*rotldi3_internal2"
6931 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
6932 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6933 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
6935 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
6942 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6943 (set_attr "length" "4,4,8,8")])
6946 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
6947 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6948 (match_operand:DI 2 "reg_or_cint_operand" ""))
6950 (clobber (match_scratch:DI 3 ""))]
6951 "TARGET_POWERPC64 && reload_completed"
6953 (rotate:DI (match_dup 1) (match_dup 2)))
6955 (compare:CC (match_dup 3)
6959 (define_insn "*rotldi3_internal3"
6960 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
6961 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6962 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
6964 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
6965 (rotate:DI (match_dup 1) (match_dup 2)))]
6972 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6973 (set_attr "length" "4,4,8,8")])
6976 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
6977 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6978 (match_operand:DI 2 "reg_or_cint_operand" ""))
6980 (set (match_operand:DI 0 "gpc_reg_operand" "")
6981 (rotate:DI (match_dup 1) (match_dup 2)))]
6982 "TARGET_POWERPC64 && reload_completed"
6984 (rotate:DI (match_dup 1) (match_dup 2)))
6986 (compare:CC (match_dup 0)
6990 (define_insn "*rotldi3_internal4"
6991 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6992 (and:DI (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6993 (match_operand:DI 2 "reg_or_cint_operand" "r,i"))
6994 (match_operand:DI 3 "mask64_operand" "n,n")))]
6997 rldc%B3 %0,%1,%2,%S3
6998 rldic%B3 %0,%1,%H2,%S3"
6999 [(set_attr "type" "var_shift_rotate,integer")])
7001 (define_insn "*rotldi3_internal5"
7002 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7004 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7005 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
7006 (match_operand:DI 3 "mask64_operand" "n,n,n,n"))
7008 (clobber (match_scratch:DI 4 "=r,r,r,r"))]
7011 rldc%B3. %4,%1,%2,%S3
7012 rldic%B3. %4,%1,%H2,%S3
7015 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7016 (set_attr "length" "4,4,8,8")])
7019 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7021 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7022 (match_operand:DI 2 "reg_or_cint_operand" ""))
7023 (match_operand:DI 3 "mask64_operand" ""))
7025 (clobber (match_scratch:DI 4 ""))]
7026 "TARGET_POWERPC64 && reload_completed"
7028 (and:DI (rotate:DI (match_dup 1)
7032 (compare:CC (match_dup 4)
7036 (define_insn "*rotldi3_internal6"
7037 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
7039 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7040 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
7041 (match_operand:DI 3 "mask64_operand" "n,n,n,n"))
7043 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7044 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7047 rldc%B3. %0,%1,%2,%S3
7048 rldic%B3. %0,%1,%H2,%S3
7051 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7052 (set_attr "length" "4,4,8,8")])
7055 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
7057 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7058 (match_operand:DI 2 "reg_or_cint_operand" ""))
7059 (match_operand:DI 3 "mask64_operand" ""))
7061 (set (match_operand:DI 0 "gpc_reg_operand" "")
7062 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7063 "TARGET_POWERPC64 && reload_completed"
7065 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
7067 (compare:CC (match_dup 0)
7071 (define_insn "*rotldi3_internal7le"
7072 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7075 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7076 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
7077 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN"
7080 rldicl %0,%1,%H2,56"
7081 [(set_attr "type" "var_shift_rotate,integer")])
7083 (define_insn "*rotldi3_internal7be"
7084 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7087 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7088 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 7)))]
7089 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN"
7092 rldicl %0,%1,%H2,56"
7093 [(set_attr "type" "var_shift_rotate,integer")])
7095 (define_insn "*rotldi3_internal8le"
7096 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7097 (compare:CC (zero_extend:DI
7099 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7100 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7102 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7103 "TARGET_64BIT && !BYTES_BIG_ENDIAN"
7106 rldicl. %3,%1,%H2,56
7109 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7110 (set_attr "length" "4,4,8,8")])
7112 (define_insn "*rotldi3_internal8be"
7113 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7114 (compare:CC (zero_extend:DI
7116 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7117 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 7))
7119 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7120 "TARGET_64BIT && BYTES_BIG_ENDIAN"
7123 rldicl. %3,%1,%H2,56
7126 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7127 (set_attr "length" "4,4,8,8")])
7130 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7131 (compare:CC (zero_extend:DI
7133 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7134 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7136 (clobber (match_scratch:DI 3 ""))]
7137 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN && reload_completed"
7139 (zero_extend:DI (subreg:QI
7140 (rotate:DI (match_dup 1)
7143 (compare:CC (match_dup 3)
7148 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7149 (compare:CC (zero_extend:DI
7151 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7152 (match_operand:DI 2 "reg_or_cint_operand" "")) 7))
7154 (clobber (match_scratch:DI 3 ""))]
7155 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN && reload_completed"
7157 (zero_extend:DI (subreg:QI
7158 (rotate:DI (match_dup 1)
7161 (compare:CC (match_dup 3)
7165 (define_insn "*rotldi3_internal9le"
7166 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7167 (compare:CC (zero_extend:DI
7169 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7170 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7172 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7173 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7174 "TARGET_64BIT && !BYTES_BIG_ENDIAN"
7177 rldicl. %0,%1,%H2,56
7180 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7181 (set_attr "length" "4,4,8,8")])
7183 (define_insn "*rotldi3_internal9be"
7184 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7185 (compare:CC (zero_extend:DI
7187 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7188 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 7))
7190 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7191 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 7)))]
7192 "TARGET_64BIT && BYTES_BIG_ENDIAN"
7195 rldicl. %0,%1,%H2,56
7198 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7199 (set_attr "length" "4,4,8,8")])
7202 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7203 (compare:CC (zero_extend:DI
7205 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7206 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7208 (set (match_operand:DI 0 "gpc_reg_operand" "")
7209 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7210 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN && reload_completed"
7212 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
7214 (compare:CC (match_dup 0)
7219 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7220 (compare:CC (zero_extend:DI
7222 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7223 (match_operand:DI 2 "reg_or_cint_operand" "")) 7))
7225 (set (match_operand:DI 0 "gpc_reg_operand" "")
7226 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 7)))]
7227 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN && reload_completed"
7229 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 7)))
7231 (compare:CC (match_dup 0)
7235 (define_insn "*rotldi3_internal10le"
7236 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7239 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7240 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
7241 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN"
7244 rldicl %0,%1,%H2,48"
7245 [(set_attr "type" "var_shift_rotate,integer")])
7247 (define_insn "*rotldi3_internal10be"
7248 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7251 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7252 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 6)))]
7253 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN"
7256 rldicl %0,%1,%H2,48"
7257 [(set_attr "type" "var_shift_rotate,integer")])
7259 (define_insn "*rotldi3_internal11le"
7260 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7261 (compare:CC (zero_extend:DI
7263 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7264 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7266 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7267 "TARGET_64BIT && !BYTES_BIG_ENDIAN"
7270 rldicl. %3,%1,%H2,48
7273 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7274 (set_attr "length" "4,4,8,8")])
7276 (define_insn "*rotldi3_internal11be"
7277 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7278 (compare:CC (zero_extend:DI
7280 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7281 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 6))
7283 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7284 "TARGET_64BIT && BYTES_BIG_ENDIAN"
7287 rldicl. %3,%1,%H2,48
7290 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7291 (set_attr "length" "4,4,8,8")])
7294 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7295 (compare:CC (zero_extend:DI
7297 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7298 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7300 (clobber (match_scratch:DI 3 ""))]
7301 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN && reload_completed"
7303 (zero_extend:DI (subreg:HI
7304 (rotate:DI (match_dup 1)
7307 (compare:CC (match_dup 3)
7312 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7313 (compare:CC (zero_extend:DI
7315 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7316 (match_operand:DI 2 "reg_or_cint_operand" "")) 6))
7318 (clobber (match_scratch:DI 3 ""))]
7319 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN && reload_completed"
7321 (zero_extend:DI (subreg:HI
7322 (rotate:DI (match_dup 1)
7325 (compare:CC (match_dup 3)
7329 (define_insn "*rotldi3_internal12le"
7330 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7331 (compare:CC (zero_extend:DI
7333 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7334 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7336 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7337 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7338 "TARGET_64BIT && !BYTES_BIG_ENDIAN"
7341 rldicl. %0,%1,%H2,48
7344 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7345 (set_attr "length" "4,4,8,8")])
7347 (define_insn "*rotldi3_internal12be"
7348 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7349 (compare:CC (zero_extend:DI
7351 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7352 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 6))
7354 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7355 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 6)))]
7356 "TARGET_64BIT && BYTES_BIG_ENDIAN"
7359 rldicl. %0,%1,%H2,48
7362 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7363 (set_attr "length" "4,4,8,8")])
7366 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7367 (compare:CC (zero_extend:DI
7369 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7370 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7372 (set (match_operand:DI 0 "gpc_reg_operand" "")
7373 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7374 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN && reload_completed"
7376 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
7378 (compare:CC (match_dup 0)
7383 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7384 (compare:CC (zero_extend:DI
7386 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7387 (match_operand:DI 2 "reg_or_cint_operand" "")) 6))
7389 (set (match_operand:DI 0 "gpc_reg_operand" "")
7390 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 6)))]
7391 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN && reload_completed"
7393 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 6)))
7395 (compare:CC (match_dup 0)
7399 (define_insn "*rotldi3_internal13le"
7400 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7403 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7404 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
7405 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN"
7408 rldicl %0,%1,%H2,32"
7409 [(set_attr "type" "var_shift_rotate,integer")])
7411 (define_insn "*rotldi3_internal13be"
7412 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7415 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7416 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 4)))]
7417 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN"
7420 rldicl %0,%1,%H2,32"
7421 [(set_attr "type" "var_shift_rotate,integer")])
7423 (define_insn "*rotldi3_internal14le"
7424 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7425 (compare:CC (zero_extend:DI
7427 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7428 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7430 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7431 "TARGET_64BIT && !BYTES_BIG_ENDIAN"
7434 rldicl. %3,%1,%H2,32
7437 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7438 (set_attr "length" "4,4,8,8")])
7440 (define_insn "*rotldi3_internal14be"
7441 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7442 (compare:CC (zero_extend:DI
7444 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7445 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 4))
7447 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7448 "TARGET_64BIT && BYTES_BIG_ENDIAN"
7451 rldicl. %3,%1,%H2,32
7454 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7455 (set_attr "length" "4,4,8,8")])
7458 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7459 (compare:CC (zero_extend:DI
7461 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7462 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7464 (clobber (match_scratch:DI 3 ""))]
7465 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN && reload_completed"
7467 (zero_extend:DI (subreg:SI
7468 (rotate:DI (match_dup 1)
7471 (compare:CC (match_dup 3)
7476 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7477 (compare:CC (zero_extend:DI
7479 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7480 (match_operand:DI 2 "reg_or_cint_operand" "")) 4))
7482 (clobber (match_scratch:DI 3 ""))]
7483 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN && reload_completed"
7485 (zero_extend:DI (subreg:SI
7486 (rotate:DI (match_dup 1)
7489 (compare:CC (match_dup 3)
7493 (define_insn "*rotldi3_internal15le"
7494 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7495 (compare:CC (zero_extend:DI
7497 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7498 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7500 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7501 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7502 "TARGET_64BIT && !BYTES_BIG_ENDIAN"
7505 rldicl. %0,%1,%H2,32
7508 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7509 (set_attr "length" "4,4,8,8")])
7511 (define_insn "*rotldi3_internal15be"
7512 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7513 (compare:CC (zero_extend:DI
7515 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7516 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 4))
7518 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7519 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 4)))]
7520 "TARGET_64BIT && BYTES_BIG_ENDIAN"
7523 rldicl. %0,%1,%H2,32
7526 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7527 (set_attr "length" "4,4,8,8")])
7530 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7531 (compare:CC (zero_extend:DI
7533 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7534 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7536 (set (match_operand:DI 0 "gpc_reg_operand" "")
7537 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7538 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN && reload_completed"
7540 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
7542 (compare:CC (match_dup 0)
7547 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7548 (compare:CC (zero_extend:DI
7550 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7551 (match_operand:DI 2 "reg_or_cint_operand" "")) 4))
7553 (set (match_operand:DI 0 "gpc_reg_operand" "")
7554 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 4)))]
7555 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN && reload_completed"
7557 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 4)))
7559 (compare:CC (match_dup 0)
7563 (define_expand "ashldi3"
7564 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7565 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7566 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7570 (define_insn "*ashldi3_internal1"
7571 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7572 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7573 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
7578 [(set_attr "type" "var_shift_rotate,shift")])
7580 (define_insn "*ashldi3_internal2"
7581 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7582 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7583 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7585 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7592 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7593 (set_attr "length" "4,4,8,8")])
7596 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7597 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7598 (match_operand:SI 2 "reg_or_cint_operand" ""))
7600 (clobber (match_scratch:DI 3 ""))]
7601 "TARGET_POWERPC64 && reload_completed"
7603 (ashift:DI (match_dup 1) (match_dup 2)))
7605 (compare:CC (match_dup 3)
7609 (define_insn "*ashldi3_internal3"
7610 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7611 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7612 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7614 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7615 (ashift:DI (match_dup 1) (match_dup 2)))]
7622 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7623 (set_attr "length" "4,4,8,8")])
7626 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7627 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7628 (match_operand:SI 2 "reg_or_cint_operand" ""))
7630 (set (match_operand:DI 0 "gpc_reg_operand" "")
7631 (ashift:DI (match_dup 1) (match_dup 2)))]
7632 "TARGET_POWERPC64 && reload_completed"
7634 (ashift:DI (match_dup 1) (match_dup 2)))
7636 (compare:CC (match_dup 0)
7640 (define_insn "*ashldi3_internal4"
7641 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7642 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7643 (match_operand:SI 2 "const_int_operand" "i"))
7644 (match_operand:DI 3 "const_int_operand" "n")))]
7645 "TARGET_POWERPC64 && includes_rldic_lshift_p (operands[2], operands[3])"
7646 "rldic %0,%1,%H2,%W3")
7648 (define_insn "ashldi3_internal5"
7649 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7651 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7652 (match_operand:SI 2 "const_int_operand" "i,i"))
7653 (match_operand:DI 3 "const_int_operand" "n,n"))
7655 (clobber (match_scratch:DI 4 "=r,r"))]
7656 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
7658 rldic. %4,%1,%H2,%W3
7660 [(set_attr "type" "compare")
7661 (set_attr "length" "4,8")])
7664 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7666 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7667 (match_operand:SI 2 "const_int_operand" ""))
7668 (match_operand:DI 3 "const_int_operand" ""))
7670 (clobber (match_scratch:DI 4 ""))]
7671 "TARGET_POWERPC64 && reload_completed
7672 && includes_rldic_lshift_p (operands[2], operands[3])"
7674 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7677 (compare:CC (match_dup 4)
7681 (define_insn "*ashldi3_internal6"
7682 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
7684 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7685 (match_operand:SI 2 "const_int_operand" "i,i"))
7686 (match_operand:DI 3 "const_int_operand" "n,n"))
7688 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7689 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7690 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
7692 rldic. %0,%1,%H2,%W3
7694 [(set_attr "type" "compare")
7695 (set_attr "length" "4,8")])
7698 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
7700 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7701 (match_operand:SI 2 "const_int_operand" ""))
7702 (match_operand:DI 3 "const_int_operand" ""))
7704 (set (match_operand:DI 0 "gpc_reg_operand" "")
7705 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7706 "TARGET_POWERPC64 && reload_completed
7707 && includes_rldic_lshift_p (operands[2], operands[3])"
7709 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7712 (compare:CC (match_dup 0)
7716 (define_insn "*ashldi3_internal7"
7717 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7718 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7719 (match_operand:SI 2 "const_int_operand" "i"))
7720 (match_operand:DI 3 "mask64_operand" "n")))]
7721 "TARGET_POWERPC64 && includes_rldicr_lshift_p (operands[2], operands[3])"
7722 "rldicr %0,%1,%H2,%S3")
7724 (define_insn "ashldi3_internal8"
7725 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7727 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7728 (match_operand:SI 2 "const_int_operand" "i,i"))
7729 (match_operand:DI 3 "mask64_operand" "n,n"))
7731 (clobber (match_scratch:DI 4 "=r,r"))]
7732 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
7734 rldicr. %4,%1,%H2,%S3
7736 [(set_attr "type" "compare")
7737 (set_attr "length" "4,8")])
7740 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7742 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7743 (match_operand:SI 2 "const_int_operand" ""))
7744 (match_operand:DI 3 "mask64_operand" ""))
7746 (clobber (match_scratch:DI 4 ""))]
7747 "TARGET_POWERPC64 && reload_completed
7748 && includes_rldicr_lshift_p (operands[2], operands[3])"
7750 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7753 (compare:CC (match_dup 4)
7757 (define_insn "*ashldi3_internal9"
7758 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
7760 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7761 (match_operand:SI 2 "const_int_operand" "i,i"))
7762 (match_operand:DI 3 "mask64_operand" "n,n"))
7764 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7765 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7766 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
7768 rldicr. %0,%1,%H2,%S3
7770 [(set_attr "type" "compare")
7771 (set_attr "length" "4,8")])
7774 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
7776 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7777 (match_operand:SI 2 "const_int_operand" ""))
7778 (match_operand:DI 3 "mask64_operand" ""))
7780 (set (match_operand:DI 0 "gpc_reg_operand" "")
7781 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7782 "TARGET_POWERPC64 && reload_completed
7783 && includes_rldicr_lshift_p (operands[2], operands[3])"
7785 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7788 (compare:CC (match_dup 0)
7792 (define_expand "lshrdi3"
7793 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7794 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7795 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7799 (define_insn "*lshrdi3_internal1"
7800 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7801 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7802 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
7807 [(set_attr "type" "var_shift_rotate,shift")])
7809 (define_insn "*lshrdi3_internal2"
7810 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7811 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7812 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7814 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7821 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7822 (set_attr "length" "4,4,8,8")])
7825 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7826 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7827 (match_operand:SI 2 "reg_or_cint_operand" ""))
7829 (clobber (match_scratch:DI 3 ""))]
7830 "TARGET_POWERPC64 && reload_completed"
7832 (lshiftrt:DI (match_dup 1) (match_dup 2)))
7834 (compare:CC (match_dup 3)
7838 (define_insn "*lshrdi3_internal3"
7839 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7840 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7841 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7843 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7844 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
7851 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7852 (set_attr "length" "4,4,8,8")])
7855 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7856 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7857 (match_operand:SI 2 "reg_or_cint_operand" ""))
7859 (set (match_operand:DI 0 "gpc_reg_operand" "")
7860 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
7861 "TARGET_POWERPC64 && reload_completed"
7863 (lshiftrt:DI (match_dup 1) (match_dup 2)))
7865 (compare:CC (match_dup 0)
7869 (define_expand "ashrdi3"
7870 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7871 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7872 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7876 if (TARGET_POWERPC64)
7878 else if (GET_CODE (operands[2]) == CONST_INT)
7880 emit_insn (gen_ashrdi3_no_power (operands[0], operands[1], operands[2]));
7887 (define_insn "*ashrdi3_internal1"
7888 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7889 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7890 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
7895 [(set_attr "type" "var_shift_rotate,shift")])
7897 (define_insn "*ashrdi3_internal2"
7898 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7899 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7900 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7902 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7909 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7910 (set_attr "length" "4,4,8,8")])
7913 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7914 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7915 (match_operand:SI 2 "reg_or_cint_operand" ""))
7917 (clobber (match_scratch:DI 3 ""))]
7918 "TARGET_POWERPC64 && reload_completed"
7920 (ashiftrt:DI (match_dup 1) (match_dup 2)))
7922 (compare:CC (match_dup 3)
7926 (define_insn "*ashrdi3_internal3"
7927 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7928 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7929 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7931 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7932 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
7939 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7940 (set_attr "length" "4,4,8,8")])
7943 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7944 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7945 (match_operand:SI 2 "reg_or_cint_operand" ""))
7947 (set (match_operand:DI 0 "gpc_reg_operand" "")
7948 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
7949 "TARGET_POWERPC64 && reload_completed"
7951 (ashiftrt:DI (match_dup 1) (match_dup 2)))
7953 (compare:CC (match_dup 0)
7957 (define_expand "anddi3"
7959 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7960 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7961 (match_operand:DI 2 "and64_2_operand" "")))
7962 (clobber (match_scratch:CC 3 ""))])]
7966 (define_insn "anddi3_mc"
7967 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
7968 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r")
7969 (match_operand:DI 2 "and64_2_operand" "?r,S,T,K,J,t")))
7970 (clobber (match_scratch:CC 3 "=X,X,X,x,x,X"))]
7971 "TARGET_POWERPC64 && rs6000_gen_cell_microcode"
7974 rldic%B2 %0,%1,0,%S2
7975 rlwinm %0,%1,0,%m2,%M2
7979 [(set_attr "type" "*,*,*,fast_compare,fast_compare,*")
7980 (set_attr "length" "4,4,4,4,4,8")])
7982 (define_insn "anddi3_nomc"
7983 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7984 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r")
7985 (match_operand:DI 2 "and64_2_operand" "?r,S,T,t")))
7986 (clobber (match_scratch:CC 3 "=X,X,X,X"))]
7987 "TARGET_POWERPC64 && !rs6000_gen_cell_microcode"
7990 rldic%B2 %0,%1,0,%S2
7991 rlwinm %0,%1,0,%m2,%M2
7993 [(set_attr "length" "4,4,4,8")])
7996 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7997 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7998 (match_operand:DI 2 "mask64_2_operand" "")))
7999 (clobber (match_scratch:CC 3 ""))]
8001 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
8002 && !mask_operand (operands[2], DImode)
8003 && !mask64_operand (operands[2], DImode)"
8005 (and:DI (rotate:DI (match_dup 1)
8009 (and:DI (rotate:DI (match_dup 0)
8013 build_mask64_2_operands (operands[2], &operands[4]);
8016 (define_insn "*anddi3_internal2_mc"
8017 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,x,?y,?y,?y,??y,??y,?y")
8018 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r,r,r")
8019 (match_operand:DI 2 "and64_2_operand" "r,S,T,K,J,t,r,S,T,K,J,t"))
8021 (clobber (match_scratch:DI 3 "=r,r,r,r,r,r,r,r,r,r,r,r"))
8022 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,X,X,x,x,X"))]
8023 "TARGET_64BIT && rs6000_gen_cell_microcode"
8026 rldic%B2. %3,%1,0,%S2
8027 rlwinm. %3,%1,0,%m2,%M2
8037 [(set_attr "type" "fast_compare,compare,delayed_compare,fast_compare,\
8038 fast_compare,compare,compare,compare,compare,compare,\
8040 (set_attr "length" "4,4,4,4,4,8,8,8,8,8,8,12")])
8043 [(set (match_operand:CC 0 "cc_reg_operand" "")
8044 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8045 (match_operand:DI 2 "mask64_2_operand" ""))
8047 (clobber (match_scratch:DI 3 ""))
8048 (clobber (match_scratch:CC 4 ""))]
8049 "TARGET_64BIT && reload_completed
8050 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
8051 && !mask_operand (operands[2], DImode)
8052 && !mask64_operand (operands[2], DImode)"
8054 (and:DI (rotate:DI (match_dup 1)
8057 (parallel [(set (match_dup 0)
8058 (compare:CC (and:DI (rotate:DI (match_dup 3)
8062 (clobber (match_dup 3))])]
8065 build_mask64_2_operands (operands[2], &operands[5]);
8068 (define_insn "*anddi3_internal3_mc"
8069 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,x,x,?y,?y,?y,??y,??y,?y")
8070 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r,r,r")
8071 (match_operand:DI 2 "and64_2_operand" "r,S,T,K,J,t,r,S,T,K,J,t"))
8073 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r,r,r")
8074 (and:DI (match_dup 1) (match_dup 2)))
8075 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,X,X,x,x,X"))]
8076 "TARGET_64BIT && rs6000_gen_cell_microcode"
8079 rldic%B2. %0,%1,0,%S2
8080 rlwinm. %0,%1,0,%m2,%M2
8090 [(set_attr "type" "fast_compare,compare,delayed_compare,fast_compare,\
8091 fast_compare,compare,compare,compare,compare,compare,\
8093 (set_attr "length" "4,4,4,4,4,8,8,8,8,8,8,12")])
8096 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8097 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8098 (match_operand:DI 2 "and64_2_operand" ""))
8100 (set (match_operand:DI 0 "gpc_reg_operand" "")
8101 (and:DI (match_dup 1) (match_dup 2)))
8102 (clobber (match_scratch:CC 4 ""))]
8103 "TARGET_64BIT && reload_completed"
8104 [(parallel [(set (match_dup 0)
8105 (and:DI (match_dup 1) (match_dup 2)))
8106 (clobber (match_dup 4))])
8108 (compare:CC (match_dup 0)
8113 [(set (match_operand:CC 3 "cc_reg_operand" "")
8114 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8115 (match_operand:DI 2 "mask64_2_operand" ""))
8117 (set (match_operand:DI 0 "gpc_reg_operand" "")
8118 (and:DI (match_dup 1) (match_dup 2)))
8119 (clobber (match_scratch:CC 4 ""))]
8120 "TARGET_64BIT && reload_completed
8121 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
8122 && !mask_operand (operands[2], DImode)
8123 && !mask64_operand (operands[2], DImode)"
8125 (and:DI (rotate:DI (match_dup 1)
8128 (parallel [(set (match_dup 3)
8129 (compare:CC (and:DI (rotate:DI (match_dup 0)
8134 (and:DI (rotate:DI (match_dup 0)
8139 build_mask64_2_operands (operands[2], &operands[5]);
8142 (define_expand "iordi3"
8143 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8144 (ior:DI (match_operand:DI 1 "gpc_reg_operand" "")
8145 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
8149 if (non_logical_cint_operand (operands[2], DImode))
8151 HOST_WIDE_INT value;
8152 rtx tmp = ((!can_create_pseudo_p ()
8153 || rtx_equal_p (operands[0], operands[1]))
8154 ? operands[0] : gen_reg_rtx (DImode));
8156 value = INTVAL (operands[2]);
8157 emit_insn (gen_iordi3 (tmp, operands[1],
8158 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
8160 emit_insn (gen_iordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
8165 (define_expand "xordi3"
8166 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8167 (xor:DI (match_operand:DI 1 "gpc_reg_operand" "")
8168 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
8172 if (non_logical_cint_operand (operands[2], DImode))
8174 HOST_WIDE_INT value;
8175 rtx tmp = ((!can_create_pseudo_p ()
8176 || rtx_equal_p (operands[0], operands[1]))
8177 ? operands[0] : gen_reg_rtx (DImode));
8179 value = INTVAL (operands[2]);
8180 emit_insn (gen_xordi3 (tmp, operands[1],
8181 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
8183 emit_insn (gen_xordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
8188 (define_insn "*booldi3_internal1"
8189 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
8190 (match_operator:DI 3 "boolean_or_operator"
8191 [(match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
8192 (match_operand:DI 2 "logical_operand" "r,K,JF")]))]
8199 (define_insn "*booldi3_internal2"
8200 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
8201 (compare:CC (match_operator:DI 4 "boolean_or_operator"
8202 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
8203 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
8205 (clobber (match_scratch:DI 3 "=r,r"))]
8210 [(set_attr "type" "fast_compare,compare")
8211 (set_attr "length" "4,8")])
8214 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8215 (compare:CC (match_operator:DI 4 "boolean_operator"
8216 [(match_operand:DI 1 "gpc_reg_operand" "")
8217 (match_operand:DI 2 "gpc_reg_operand" "")])
8219 (clobber (match_scratch:DI 3 ""))]
8220 "TARGET_POWERPC64 && reload_completed"
8221 [(set (match_dup 3) (match_dup 4))
8223 (compare:CC (match_dup 3)
8227 (define_insn "*booldi3_internal3"
8228 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
8229 (compare:CC (match_operator:DI 4 "boolean_or_operator"
8230 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
8231 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
8233 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8239 [(set_attr "type" "fast_compare,compare")
8240 (set_attr "length" "4,8")])
8243 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8244 (compare:CC (match_operator:DI 4 "boolean_operator"
8245 [(match_operand:DI 1 "gpc_reg_operand" "")
8246 (match_operand:DI 2 "gpc_reg_operand" "")])
8248 (set (match_operand:DI 0 "gpc_reg_operand" "")
8250 "TARGET_POWERPC64 && reload_completed"
8251 [(set (match_dup 0) (match_dup 4))
8253 (compare:CC (match_dup 0)
8257 ;; Split a logical operation that we can't do in one insn into two insns,
8258 ;; each of which does one 16-bit part. This is used by combine.
8261 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8262 (match_operator:DI 3 "boolean_or_operator"
8263 [(match_operand:DI 1 "gpc_reg_operand" "")
8264 (match_operand:DI 2 "non_logical_cint_operand" "")]))]
8266 [(set (match_dup 0) (match_dup 4))
8267 (set (match_dup 0) (match_dup 5))]
8272 i3 = GEN_INT (INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff));
8273 i4 = GEN_INT (INTVAL (operands[2]) & 0xffff);
8274 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
8276 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
8280 (define_insn "*boolcdi3_internal1"
8281 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
8282 (match_operator:DI 3 "boolean_operator"
8283 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
8284 (match_operand:DI 2 "gpc_reg_operand" "r")]))]
8288 (define_insn "*boolcdi3_internal2"
8289 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
8290 (compare:CC (match_operator:DI 4 "boolean_operator"
8291 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
8292 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
8294 (clobber (match_scratch:DI 3 "=r,r"))]
8299 [(set_attr "type" "fast_compare,compare")
8300 (set_attr "length" "4,8")])
8303 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8304 (compare:CC (match_operator:DI 4 "boolean_operator"
8305 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
8306 (match_operand:DI 2 "gpc_reg_operand" "")])
8308 (clobber (match_scratch:DI 3 ""))]
8309 "TARGET_POWERPC64 && reload_completed"
8310 [(set (match_dup 3) (match_dup 4))
8312 (compare:CC (match_dup 3)
8316 (define_insn "*boolcdi3_internal3"
8317 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
8318 (compare:CC (match_operator:DI 4 "boolean_operator"
8319 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
8320 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
8322 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8328 [(set_attr "type" "fast_compare,compare")
8329 (set_attr "length" "4,8")])
8332 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8333 (compare:CC (match_operator:DI 4 "boolean_operator"
8334 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
8335 (match_operand:DI 2 "gpc_reg_operand" "")])
8337 (set (match_operand:DI 0 "gpc_reg_operand" "")
8339 "TARGET_POWERPC64 && reload_completed"
8340 [(set (match_dup 0) (match_dup 4))
8342 (compare:CC (match_dup 0)
8346 (define_insn "*boolccdi3_internal1"
8347 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
8348 (match_operator:DI 3 "boolean_operator"
8349 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
8350 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r"))]))]
8354 (define_insn "*boolccdi3_internal2"
8355 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
8356 (compare:CC (match_operator:DI 4 "boolean_operator"
8357 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
8358 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
8360 (clobber (match_scratch:DI 3 "=r,r"))]
8365 [(set_attr "type" "fast_compare,compare")
8366 (set_attr "length" "4,8")])
8369 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8370 (compare:CC (match_operator:DI 4 "boolean_operator"
8371 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
8372 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
8374 (clobber (match_scratch:DI 3 ""))]
8375 "TARGET_POWERPC64 && reload_completed"
8376 [(set (match_dup 3) (match_dup 4))
8378 (compare:CC (match_dup 3)
8382 (define_insn "*boolccdi3_internal3"
8383 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
8384 (compare:CC (match_operator:DI 4 "boolean_operator"
8385 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
8386 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
8388 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8394 [(set_attr "type" "fast_compare,compare")
8395 (set_attr "length" "4,8")])
8398 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8399 (compare:CC (match_operator:DI 4 "boolean_operator"
8400 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
8401 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
8403 (set (match_operand:DI 0 "gpc_reg_operand" "")
8405 "TARGET_POWERPC64 && reload_completed"
8406 [(set (match_dup 0) (match_dup 4))
8408 (compare:CC (match_dup 0)
8413 (define_insn "*eqv<mode>3"
8414 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
8416 (xor:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
8417 (match_operand:GPR 2 "gpc_reg_operand" "r"))))]
8420 [(set_attr "type" "integer")
8421 (set_attr "length" "4")])
8424 ;; Now define ways of moving data around.
8426 ;; Set up a register with a value from the GOT table
8428 (define_expand "movsi_got"
8429 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8430 (unspec:SI [(match_operand:SI 1 "got_operand" "")
8431 (match_dup 2)] UNSPEC_MOVSI_GOT))]
8432 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
8435 if (GET_CODE (operands[1]) == CONST)
8437 rtx offset = const0_rtx;
8438 HOST_WIDE_INT value;
8440 operands[1] = eliminate_constant_term (XEXP (operands[1], 0), &offset);
8441 value = INTVAL (offset);
8444 rtx tmp = (!can_create_pseudo_p ()
8446 : gen_reg_rtx (Pmode));
8447 emit_insn (gen_movsi_got (tmp, operands[1]));
8448 emit_insn (gen_addsi3 (operands[0], tmp, offset));
8453 operands[2] = rs6000_got_register (operands[1]);
8456 (define_insn "*movsi_got_internal"
8457 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8458 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
8459 (match_operand:SI 2 "gpc_reg_operand" "b")]
8461 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
8462 "lwz %0,%a1@got(%2)"
8463 [(set_attr "type" "load")])
8465 ;; Used by sched, shorten_branches and final when the GOT pseudo reg
8466 ;; didn't get allocated to a hard register.
8468 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8469 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
8470 (match_operand:SI 2 "memory_operand" "")]
8472 "DEFAULT_ABI == ABI_V4
8474 && (reload_in_progress || reload_completed)"
8475 [(set (match_dup 0) (match_dup 2))
8476 (set (match_dup 0) (unspec:SI [(match_dup 1)(match_dup 0)]
8480 ;; For SI, we special-case integers that can't be loaded in one insn. We
8481 ;; do the load 16-bits at a time. We could do this by loading from memory,
8482 ;; and this is even supposed to be faster, but it is simpler not to get
8483 ;; integers in the TOC.
8484 (define_insn "movsi_low"
8485 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8486 (mem:SI (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
8487 (match_operand 2 "" ""))))]
8488 "TARGET_MACHO && ! TARGET_64BIT"
8489 "lwz %0,lo16(%2)(%1)"
8490 [(set_attr "type" "load")
8491 (set_attr "length" "4")])
8493 (define_insn "*movsi_internal1"
8494 [(set (match_operand:SI 0 "rs6000_nonimmediate_operand" "=r,r,r,m,r,r,r,r,*c*l,*h,*h")
8495 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,*h,r,r,0"))]
8496 "!TARGET_SINGLE_FPU &&
8497 (gpc_reg_operand (operands[0], SImode) || gpc_reg_operand (operands[1], SImode))"
8510 [(set_attr_alternative "type"
8514 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
8515 (const_string "load_ux")
8517 (match_test "update_address_mem (operands[1], VOIDmode)")
8518 (const_string "load_u")
8519 (const_string "load")))
8521 (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
8522 (const_string "store_ux")
8524 (match_test "update_address_mem (operands[0], VOIDmode)")
8525 (const_string "store_u")
8526 (const_string "store")))
8530 (const_string "mfjmpr")
8531 (const_string "mtjmpr")
8533 (const_string "*")])
8535 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4")])
8537 (define_insn "*movsi_internal1_single"
8538 [(set (match_operand:SI 0 "rs6000_nonimmediate_operand" "=r,r,r,m,r,r,r,r,*c*l,*h,*h,m,*f")
8539 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,*h,r,r,0,f,m"))]
8540 "TARGET_SINGLE_FPU &&
8541 (gpc_reg_operand (operands[0], SImode) || gpc_reg_operand (operands[1], SImode))"
8556 [(set_attr_alternative "type"
8560 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
8561 (const_string "load_ux")
8563 (match_test "update_address_mem (operands[1], VOIDmode)")
8564 (const_string "load_u")
8565 (const_string "load")))
8567 (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
8568 (const_string "store_ux")
8570 (match_test "update_address_mem (operands[0], VOIDmode)")
8571 (const_string "store_u")
8572 (const_string "store")))
8576 (const_string "mfjmpr")
8577 (const_string "mtjmpr")
8581 (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
8582 (const_string "fpstore_ux")
8584 (match_test "update_address_mem (operands[0], VOIDmode)")
8585 (const_string "fpstore_u")
8586 (const_string "fpstore")))
8588 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
8589 (const_string "fpload_ux")
8591 (match_test "update_address_mem (operands[1], VOIDmode)")
8592 (const_string "fpload_u")
8593 (const_string "fpload")))])
8594 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4,4,4")])
8596 ;; Split a load of a large constant into the appropriate two-insn
8600 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8601 (match_operand:SI 1 "const_int_operand" ""))]
8602 "(unsigned HOST_WIDE_INT) (INTVAL (operands[1]) + 0x8000) >= 0x10000
8603 && (INTVAL (operands[1]) & 0xffff) != 0"
8607 (ior:SI (match_dup 0)
8610 { rtx tem = rs6000_emit_set_const (operands[0], SImode, operands[1], 2);
8612 if (tem == operands[0])
8618 (define_insn "*mov<mode>_internal2"
8619 [(set (match_operand:CC 2 "cc_reg_operand" "=y,x,?y")
8620 (compare:CC (match_operand:P 1 "gpc_reg_operand" "0,r,r")
8622 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r") (match_dup 1))]
8628 [(set_attr "type" "cmp,fast_compare,cmp")
8629 (set_attr "length" "4,4,8")])
8632 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
8633 (compare:CC (match_operand:P 1 "gpc_reg_operand" "")
8635 (set (match_operand:P 0 "gpc_reg_operand" "") (match_dup 1))]
8637 [(set (match_dup 0) (match_dup 1))
8639 (compare:CC (match_dup 0)
8643 (define_insn "*movhi_internal"
8644 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,m,r,r,*c*l,*h")
8645 (match_operand:HI 1 "input_operand" "r,m,r,i,*h,r,0"))]
8646 "gpc_reg_operand (operands[0], HImode)
8647 || gpc_reg_operand (operands[1], HImode)"
8656 [(set_attr_alternative "type"
8659 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
8660 (const_string "load_ux")
8662 (match_test "update_address_mem (operands[1], VOIDmode)")
8663 (const_string "load_u")
8664 (const_string "load")))
8666 (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
8667 (const_string "store_ux")
8669 (match_test "update_address_mem (operands[0], VOIDmode)")
8670 (const_string "store_u")
8671 (const_string "store")))
8673 (const_string "mfjmpr")
8674 (const_string "mtjmpr")
8675 (const_string "*")])])
8677 (define_expand "mov<mode>"
8678 [(set (match_operand:INT 0 "general_operand" "")
8679 (match_operand:INT 1 "any_operand" ""))]
8681 "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
8683 (define_insn "*movqi_internal"
8684 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,m,r,r,*c*l,*h")
8685 (match_operand:QI 1 "input_operand" "r,m,r,i,*h,r,0"))]
8686 "gpc_reg_operand (operands[0], QImode)
8687 || gpc_reg_operand (operands[1], QImode)"
8696 [(set_attr_alternative "type"
8699 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
8700 (const_string "load_ux")
8702 (match_test "update_address_mem (operands[1], VOIDmode)")
8703 (const_string "load_u")
8704 (const_string "load")))
8706 (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
8707 (const_string "store_ux")
8709 (match_test "update_address_mem (operands[0], VOIDmode)")
8710 (const_string "store_u")
8711 (const_string "store")))
8713 (const_string "mfjmpr")
8714 (const_string "mtjmpr")
8715 (const_string "*")])])
8717 ;; Here is how to move condition codes around. When we store CC data in
8718 ;; an integer register or memory, we store just the high-order 4 bits.
8719 ;; This lets us not shift in the most common case of CR0.
8720 (define_expand "movcc"
8721 [(set (match_operand:CC 0 "nonimmediate_operand" "")
8722 (match_operand:CC 1 "nonimmediate_operand" ""))]
8726 (define_insn "*movcc_internal1"
8727 [(set (match_operand:CC 0 "nonimmediate_operand" "=y,x,?y,y,r,r,r,r,r,cl,r,m")
8728 (match_operand:CC 1 "general_operand" "y,r,r,O,x,y,r,I,h,r,m,r"))]
8729 "register_operand (operands[0], CCmode)
8730 || register_operand (operands[1], CCmode)"
8734 rlwinm %1,%1,%F0,0xffffffff\;mtcrf %R0,%1\;rlwinm %1,%1,%f0,0xffffffff
8737 mfcr %0%Q1\;rlwinm %0,%0,%f1,0xf0000000
8745 (cond [(eq_attr "alternative" "0,3")
8746 (const_string "cr_logical")
8747 (eq_attr "alternative" "1,2")
8748 (const_string "mtcr")
8749 (eq_attr "alternative" "6,7")
8750 (const_string "integer")
8751 (eq_attr "alternative" "8")
8752 (const_string "mfjmpr")
8753 (eq_attr "alternative" "9")
8754 (const_string "mtjmpr")
8755 (eq_attr "alternative" "10")
8757 (match_test "update_indexed_address_mem (operands[1],
8759 (const_string "load_ux")
8761 (match_test "update_address_mem (operands[1], VOIDmode)")
8762 (const_string "load_u")
8763 (const_string "load")))
8764 (eq_attr "alternative" "11")
8766 (match_test "update_indexed_address_mem (operands[0],
8768 (const_string "store_ux")
8770 (match_test "update_address_mem (operands[0], VOIDmode)")
8771 (const_string "store_u")
8772 (const_string "store")))
8773 (match_test "TARGET_MFCRF")
8774 (const_string "mfcrf")
8776 (const_string "mfcr")))
8777 (set_attr "length" "4,4,12,4,4,8,4,4,4,4,4,4")])
8779 ;; For floating-point, we normally deal with the floating-point registers
8780 ;; unless -msoft-float is used. The sole exception is that parameter passing
8781 ;; can produce floating-point values in fixed-point registers. Unless the
8782 ;; value is a simple constant or already in memory, we deal with this by
8783 ;; allocating memory and copying the value explicitly via that memory location.
8785 ;; Move 32-bit binary/decimal floating point
8786 (define_expand "mov<mode>"
8787 [(set (match_operand:FMOVE32 0 "nonimmediate_operand" "")
8788 (match_operand:FMOVE32 1 "any_operand" ""))]
8790 "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
8793 [(set (match_operand:FMOVE32 0 "gpc_reg_operand" "")
8794 (match_operand:FMOVE32 1 "const_double_operand" ""))]
8796 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8797 || (GET_CODE (operands[0]) == SUBREG
8798 && GET_CODE (SUBREG_REG (operands[0])) == REG
8799 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8800 [(set (match_dup 2) (match_dup 3))]
8806 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8807 <real_value_to_target> (rv, l);
8809 if (! TARGET_POWERPC64)
8810 operands[2] = operand_subword (operands[0], 0, 0, <MODE>mode);
8812 operands[2] = gen_lowpart (SImode, operands[0]);
8814 operands[3] = gen_int_mode (l, SImode);
8817 (define_insn "mov<mode>_hardfloat"
8818 [(set (match_operand:FMOVE32 0 "nonimmediate_operand" "=!r,!r,m,f,wa,wa,<f32_lr>,<f32_sm>,wm,Z,?<f32_dm>,?r,*c*l,!r,*h,!r,!r")
8819 (match_operand:FMOVE32 1 "input_operand" "r,m,r,f,wa,j,<f32_lm>,<f32_sr>,Z,wm,r,<f32_dm>,r,h,0,G,Fn"))]
8820 "(gpc_reg_operand (operands[0], <MODE>mode)
8821 || gpc_reg_operand (operands[1], <MODE>mode))
8822 && (TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT)"
8841 [(set_attr_alternative "type"
8844 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
8845 (const_string "load_ux")
8847 (match_test "update_address_mem (operands[1], VOIDmode)")
8848 (const_string "load_u")
8849 (const_string "load")))
8851 (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
8852 (const_string "store_ux")
8854 (match_test "update_address_mem (operands[0], VOIDmode)")
8855 (const_string "store_u")
8856 (const_string "store")))
8858 (const_string "vecsimple")
8859 (const_string "vecsimple")
8861 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
8862 (const_string "fpload_ux")
8864 (match_test "update_address_mem (operands[1], VOIDmode)")
8865 (const_string "fpload_u")
8866 (const_string "fpload")))
8868 (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
8869 (const_string "fpstore_ux")
8871 (match_test "update_address_mem (operands[0], VOIDmode)")
8872 (const_string "fpstore_u")
8873 (const_string "fpstore")))
8874 (const_string "fpload")
8875 (const_string "fpstore")
8876 (const_string "mftgpr")
8877 (const_string "mffgpr")
8878 (const_string "mtjmpr")
8879 (const_string "mfjmpr")
8882 (const_string "*")])
8883 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,8")])
8885 (define_insn "*mov<mode>_softfloat"
8886 [(set (match_operand:FMOVE32 0 "nonimmediate_operand" "=r,cl,r,r,m,r,r,r,r,*h")
8887 (match_operand:FMOVE32 1 "input_operand" "r,r,h,m,r,I,L,G,Fn,0"))]
8888 "(gpc_reg_operand (operands[0], <MODE>mode)
8889 || gpc_reg_operand (operands[1], <MODE>mode))
8890 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)"
8902 [(set_attr_alternative "type"
8904 (const_string "mtjmpr")
8905 (const_string "mfjmpr")
8907 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
8908 (const_string "load_ux")
8910 (match_test "update_address_mem (operands[1], VOIDmode)")
8911 (const_string "load_u")
8912 (const_string "load")))
8914 (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
8915 (const_string "store_ux")
8917 (match_test "update_address_mem (operands[0], VOIDmode)")
8918 (const_string "store_u")
8919 (const_string "store")))
8924 (const_string "*")])
8925 (set_attr "length" "4,4,4,4,4,4,4,4,8,4")])
8928 ;; Move 64-bit binary/decimal floating point
8929 (define_expand "mov<mode>"
8930 [(set (match_operand:FMOVE64 0 "nonimmediate_operand" "")
8931 (match_operand:FMOVE64 1 "any_operand" ""))]
8933 "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
8936 [(set (match_operand:FMOVE64 0 "gpc_reg_operand" "")
8937 (match_operand:FMOVE64 1 "const_int_operand" ""))]
8938 "! TARGET_POWERPC64 && reload_completed
8939 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8940 || (GET_CODE (operands[0]) == SUBREG
8941 && GET_CODE (SUBREG_REG (operands[0])) == REG
8942 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8943 [(set (match_dup 2) (match_dup 4))
8944 (set (match_dup 3) (match_dup 1))]
8947 int endian = (WORDS_BIG_ENDIAN == 0);
8948 HOST_WIDE_INT value = INTVAL (operands[1]);
8950 operands[2] = operand_subword (operands[0], endian, 0, <MODE>mode);
8951 operands[3] = operand_subword (operands[0], 1 - endian, 0, <MODE>mode);
8952 operands[4] = GEN_INT (value >> 32);
8953 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
8957 [(set (match_operand:FMOVE64 0 "gpc_reg_operand" "")
8958 (match_operand:FMOVE64 1 "const_double_operand" ""))]
8959 "! TARGET_POWERPC64 && reload_completed
8960 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8961 || (GET_CODE (operands[0]) == SUBREG
8962 && GET_CODE (SUBREG_REG (operands[0])) == REG
8963 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8964 [(set (match_dup 2) (match_dup 4))
8965 (set (match_dup 3) (match_dup 5))]
8968 int endian = (WORDS_BIG_ENDIAN == 0);
8972 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8973 <real_value_to_target> (rv, l);
8975 operands[2] = operand_subword (operands[0], endian, 0, <MODE>mode);
8976 operands[3] = operand_subword (operands[0], 1 - endian, 0, <MODE>mode);
8977 operands[4] = gen_int_mode (l[endian], SImode);
8978 operands[5] = gen_int_mode (l[1 - endian], SImode);
8982 [(set (match_operand:FMOVE64 0 "gpc_reg_operand" "")
8983 (match_operand:FMOVE64 1 "const_double_operand" ""))]
8984 "TARGET_POWERPC64 && reload_completed
8985 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8986 || (GET_CODE (operands[0]) == SUBREG
8987 && GET_CODE (SUBREG_REG (operands[0])) == REG
8988 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8989 [(set (match_dup 2) (match_dup 3))]
8992 int endian = (WORDS_BIG_ENDIAN == 0);
8997 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8998 <real_value_to_target> (rv, l);
9000 operands[2] = gen_lowpart (DImode, operands[0]);
9001 /* HIGHPART is lower memory address when WORDS_BIG_ENDIAN. */
9002 val = ((HOST_WIDE_INT)(unsigned long)l[endian] << 32
9003 | ((HOST_WIDE_INT)(unsigned long)l[1 - endian]));
9005 operands[3] = gen_int_mode (val, DImode);
9008 ;; Don't have reload use general registers to load a constant. It is
9009 ;; less efficient than loading the constant into an FP register, since
9010 ;; it will probably be used there.
9012 ;; The move constraints are ordered to prefer floating point registers before
9013 ;; general purpose registers to avoid doing a store and a load to get the value
9014 ;; into a floating point register when it is needed for a floating point
9015 ;; operation. Prefer traditional floating point registers over VSX registers,
9016 ;; since the D-form version of the memory instructions does not need a GPR for
9019 (define_insn "*mov<mode>_hardfloat32"
9020 [(set (match_operand:FMOVE64 0 "nonimmediate_operand" "=m,d,d,ws,?wa,Z,?Z,ws,?wa,wa,Y,r,!r,!r,!r,!r")
9021 (match_operand:FMOVE64 1 "input_operand" "d,m,d,Z,Z,ws,wa,ws,wa,j,r,Y,r,G,H,F"))]
9022 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9023 && (gpc_reg_operand (operands[0], <MODE>mode)
9024 || gpc_reg_operand (operands[1], <MODE>mode))"
9042 [(set_attr_alternative "type"
9044 (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
9045 (const_string "fpstore_ux")
9047 (match_test "update_address_mem (operands[0], VOIDmode)")
9048 (const_string "fpstore_u")
9049 (const_string "fpstore")))
9051 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
9052 (const_string "fpload_ux")
9054 (match_test "update_address_mem (operands[1], VOIDmode)")
9055 (const_string "fpload_u")
9056 (const_string "fpload")))
9059 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
9060 (const_string "fpload_ux")
9061 (const_string "fpload"))
9063 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
9064 (const_string "fpload_ux")
9065 (const_string "fpload"))
9067 (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
9068 (const_string "fpstore_ux")
9069 (const_string "fpstore"))
9071 (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
9072 (const_string "fpstore_ux")
9073 (const_string "fpstore"))
9074 (const_string "vecsimple")
9075 (const_string "vecsimple")
9076 (const_string "vecsimple")
9077 (const_string "store")
9078 (const_string "load")
9079 (const_string "two")
9082 (const_string "*")])
9083 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,8,8,8,8,12,16")])
9085 (define_insn "*mov<mode>_softfloat32"
9086 [(set (match_operand:FMOVE64 0 "nonimmediate_operand" "=Y,r,r,r,r,r")
9087 (match_operand:FMOVE64 1 "input_operand" "r,Y,r,G,H,F"))]
9089 && ((TARGET_FPRS && TARGET_SINGLE_FLOAT)
9090 || TARGET_SOFT_FLOAT || TARGET_E500_SINGLE)
9091 && (gpc_reg_operand (operands[0], <MODE>mode)
9092 || gpc_reg_operand (operands[1], <MODE>mode))"
9094 [(set_attr "type" "store,load,two,*,*,*")
9095 (set_attr "length" "8,8,8,8,12,16")])
9097 ; ld/std require word-aligned displacements -> 'Y' constraint.
9098 ; List Y->r and r->Y before r->r for reload.
9099 (define_insn "*mov<mode>_hardfloat64"
9100 [(set (match_operand:FMOVE64 0 "nonimmediate_operand" "=m,d,d,ws,?wa,Z,?Z,ws,?wa,wa,Y,r,!r,*c*l,!r,*h,!r,!r,!r,r,wg,r,wm")
9101 (match_operand:FMOVE64 1 "input_operand" "d,m,d,Z,Z,ws,wa,ws,wa,j,r,Y,r,r,h,0,G,H,F,wg,r,wm,r"))]
9102 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9103 && (gpc_reg_operand (operands[0], <MODE>mode)
9104 || gpc_reg_operand (operands[1], <MODE>mode))"
9129 [(set_attr_alternative "type"
9131 (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
9132 (const_string "fpstore_ux")
9134 (match_test "update_address_mem (operands[0], VOIDmode)")
9135 (const_string "fpstore_u")
9136 (const_string "fpstore")))
9138 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
9139 (const_string "fpload_ux")
9141 (match_test "update_address_mem (operands[1], VOIDmode)")
9142 (const_string "fpload_u")
9143 (const_string "fpload")))
9146 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
9147 (const_string "fpload_ux")
9148 (const_string "fpload"))
9150 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
9151 (const_string "fpload_ux")
9152 (const_string "fpload"))
9154 (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
9155 (const_string "fpstore_ux")
9156 (const_string "fpstore"))
9158 (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
9159 (const_string "fpstore_ux")
9160 (const_string "fpstore"))
9161 (const_string "vecsimple")
9162 (const_string "vecsimple")
9163 (const_string "vecsimple")
9165 (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
9166 (const_string "store_ux")
9168 (match_test "update_address_mem (operands[0], VOIDmode)")
9169 (const_string "store_u")
9170 (const_string "store")))
9172 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
9173 (const_string "load_ux")
9175 (match_test "update_address_mem (operands[1], VOIDmode)")
9176 (const_string "load_u")
9177 (const_string "load")))
9179 (const_string "mtjmpr")
9180 (const_string "mfjmpr")
9185 (const_string "mftgpr")
9186 (const_string "mffgpr")
9187 (const_string "mftgpr")
9188 (const_string "mffgpr")])
9189 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,8,12,16,4,4,4,4")])
9191 (define_insn "*mov<mode>_softfloat64"
9192 [(set (match_operand:FMOVE64 0 "nonimmediate_operand" "=Y,r,r,cl,r,r,r,r,*h")
9193 (match_operand:FMOVE64 1 "input_operand" "r,Y,r,r,h,G,H,F,0"))]
9194 "TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)
9195 && (gpc_reg_operand (operands[0], <MODE>mode)
9196 || gpc_reg_operand (operands[1], <MODE>mode))"
9207 [(set_attr_alternative "type"
9209 (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
9210 (const_string "store_ux")
9212 (match_test "update_address_mem (operands[0], VOIDmode)")
9213 (const_string "store_u")
9214 (const_string "store")))
9216 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
9217 (const_string "load_ux")
9219 (match_test "update_address_mem (operands[1], VOIDmode)")
9220 (const_string "load_u")
9221 (const_string "load")))
9223 (const_string "mtjmpr")
9224 (const_string "mfjmpr")
9228 (const_string "*")])
9229 (set_attr "length" "4,4,4,4,4,8,12,16,4")])
9231 (define_expand "mov<mode>"
9232 [(set (match_operand:FMOVE128 0 "general_operand" "")
9233 (match_operand:FMOVE128 1 "any_operand" ""))]
9235 "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
9237 ;; It's important to list Y->r and r->Y before r->r because otherwise
9238 ;; reload, given m->r, will try to pick r->r and reload it, which
9239 ;; doesn't make progress.
9240 (define_insn_and_split "*mov<mode>_internal"
9241 [(set (match_operand:FMOVE128 0 "nonimmediate_operand" "=m,d,d,Y,r,r")
9242 (match_operand:FMOVE128 1 "input_operand" "d,m,d,r,YGHF,r"))]
9243 "TARGET_HARD_FLOAT && TARGET_FPRS
9244 && (gpc_reg_operand (operands[0], <MODE>mode)
9245 || gpc_reg_operand (operands[1], <MODE>mode))"
9247 "&& reload_completed"
9249 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
9250 [(set_attr "length" "8,8,8,20,20,16")])
9252 (define_insn_and_split "*mov<mode>_softfloat"
9253 [(set (match_operand:FMOVE128 0 "rs6000_nonimmediate_operand" "=Y,r,r")
9254 (match_operand:FMOVE128 1 "input_operand" "r,YGHF,r"))]
9255 "(TARGET_SOFT_FLOAT || !TARGET_FPRS)
9256 && (gpc_reg_operand (operands[0], <MODE>mode)
9257 || gpc_reg_operand (operands[1], <MODE>mode))"
9259 "&& reload_completed"
9261 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
9262 [(set_attr "length" "20,20,16")])
9264 (define_expand "extenddftf2"
9265 [(set (match_operand:TF 0 "nonimmediate_operand" "")
9266 (float_extend:TF (match_operand:DF 1 "input_operand" "")))]
9268 && TARGET_HARD_FLOAT
9269 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9270 && TARGET_LONG_DOUBLE_128"
9272 if (TARGET_E500_DOUBLE)
9273 emit_insn (gen_spe_extenddftf2 (operands[0], operands[1]));
9275 emit_insn (gen_extenddftf2_fprs (operands[0], operands[1]));
9279 (define_expand "extenddftf2_fprs"
9280 [(parallel [(set (match_operand:TF 0 "nonimmediate_operand" "")
9281 (float_extend:TF (match_operand:DF 1 "input_operand" "")))
9282 (use (match_dup 2))])]
9284 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9285 && TARGET_LONG_DOUBLE_128"
9287 operands[2] = CONST0_RTX (DFmode);
9288 /* Generate GOT reference early for SVR4 PIC. */
9289 if (DEFAULT_ABI == ABI_V4 && flag_pic)
9290 operands[2] = validize_mem (force_const_mem (DFmode, operands[2]));
9293 (define_insn_and_split "*extenddftf2_internal"
9294 [(set (match_operand:TF 0 "nonimmediate_operand" "=m,Y,d,&d,r")
9295 (float_extend:TF (match_operand:DF 1 "input_operand" "d,r,md,md,rmGHF")))
9296 (use (match_operand:DF 2 "zero_reg_mem_operand" "d,r,m,d,n"))]
9298 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9299 && TARGET_LONG_DOUBLE_128"
9301 "&& reload_completed"
9304 const int lo_word = LONG_DOUBLE_LARGE_FIRST ? GET_MODE_SIZE (DFmode) : 0;
9305 const int hi_word = LONG_DOUBLE_LARGE_FIRST ? 0 : GET_MODE_SIZE (DFmode);
9306 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word),
9308 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word),
9313 (define_expand "extendsftf2"
9314 [(set (match_operand:TF 0 "nonimmediate_operand" "")
9315 (float_extend:TF (match_operand:SF 1 "gpc_reg_operand" "")))]
9317 && TARGET_HARD_FLOAT
9318 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9319 && TARGET_LONG_DOUBLE_128"
9321 rtx tmp = gen_reg_rtx (DFmode);
9322 emit_insn (gen_extendsfdf2 (tmp, operands[1]));
9323 emit_insn (gen_extenddftf2 (operands[0], tmp));
9327 (define_expand "trunctfdf2"
9328 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9329 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "")))]
9331 && TARGET_HARD_FLOAT
9332 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9333 && TARGET_LONG_DOUBLE_128"
9336 (define_insn_and_split "trunctfdf2_internal1"
9337 [(set (match_operand:DF 0 "gpc_reg_operand" "=d,?d")
9338 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "0,d")))]
9339 "!TARGET_IEEEQUAD && !TARGET_XL_COMPAT
9340 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9344 "&& reload_completed && REGNO (operands[0]) == REGNO (operands[1])"
9347 emit_note (NOTE_INSN_DELETED);
9350 [(set_attr "type" "fp")])
9352 (define_insn "trunctfdf2_internal2"
9353 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
9354 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "d")))]
9355 "!TARGET_IEEEQUAD && TARGET_XL_COMPAT
9356 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9357 && TARGET_LONG_DOUBLE_128"
9359 [(set_attr "type" "fp")
9360 (set_attr "fp_type" "fp_addsub_d")])
9362 (define_expand "trunctfsf2"
9363 [(set (match_operand:SF 0 "gpc_reg_operand" "")
9364 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "")))]
9366 && TARGET_HARD_FLOAT
9367 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9368 && TARGET_LONG_DOUBLE_128"
9370 if (TARGET_E500_DOUBLE)
9371 emit_insn (gen_spe_trunctfsf2 (operands[0], operands[1]));
9373 emit_insn (gen_trunctfsf2_fprs (operands[0], operands[1]));
9377 (define_insn_and_split "trunctfsf2_fprs"
9378 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
9379 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "d")))
9380 (clobber (match_scratch:DF 2 "=d"))]
9382 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
9383 && TARGET_LONG_DOUBLE_128"
9385 "&& reload_completed"
9387 (float_truncate:DF (match_dup 1)))
9389 (float_truncate:SF (match_dup 2)))]
9392 (define_expand "floatsitf2"
9393 [(set (match_operand:TF 0 "gpc_reg_operand" "")
9394 (float:TF (match_operand:SI 1 "gpc_reg_operand" "")))]
9396 && TARGET_HARD_FLOAT
9397 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9398 && TARGET_LONG_DOUBLE_128"
9400 rtx tmp = gen_reg_rtx (DFmode);
9401 expand_float (tmp, operands[1], false);
9402 emit_insn (gen_extenddftf2 (operands[0], tmp));
9406 ; fadd, but rounding towards zero.
9407 ; This is probably not the optimal code sequence.
9408 (define_insn "fix_trunc_helper"
9409 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
9410 (unspec:DF [(match_operand:TF 1 "gpc_reg_operand" "d")]
9411 UNSPEC_FIX_TRUNC_TF))
9412 (clobber (match_operand:DF 2 "gpc_reg_operand" "=&d"))]
9413 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
9414 "mffs %2\n\tmtfsb1 31\n\tmtfsb0 30\n\tfadd %0,%1,%L1\n\tmtfsf 1,%2"
9415 [(set_attr "type" "fp")
9416 (set_attr "length" "20")])
9418 (define_expand "fix_trunctfsi2"
9419 [(set (match_operand:SI 0 "gpc_reg_operand" "")
9420 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))]
9421 "!TARGET_IEEEQUAD && TARGET_HARD_FLOAT
9422 && (TARGET_FPRS || TARGET_E500_DOUBLE) && TARGET_LONG_DOUBLE_128"
9424 if (TARGET_E500_DOUBLE)
9425 emit_insn (gen_spe_fix_trunctfsi2 (operands[0], operands[1]));
9427 emit_insn (gen_fix_trunctfsi2_fprs (operands[0], operands[1]));
9431 (define_expand "fix_trunctfsi2_fprs"
9432 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
9433 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))
9434 (clobber (match_dup 2))
9435 (clobber (match_dup 3))
9436 (clobber (match_dup 4))
9437 (clobber (match_dup 5))])]
9439 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9441 operands[2] = gen_reg_rtx (DFmode);
9442 operands[3] = gen_reg_rtx (DFmode);
9443 operands[4] = gen_reg_rtx (DImode);
9444 operands[5] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode));
9447 (define_insn_and_split "*fix_trunctfsi2_internal"
9448 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9449 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "d")))
9450 (clobber (match_operand:DF 2 "gpc_reg_operand" "=d"))
9451 (clobber (match_operand:DF 3 "gpc_reg_operand" "=&d"))
9452 (clobber (match_operand:DI 4 "gpc_reg_operand" "=d"))
9453 (clobber (match_operand:DI 5 "offsettable_mem_operand" "=o"))]
9455 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9461 emit_insn (gen_fix_trunc_helper (operands[2], operands[1], operands[3]));
9463 gcc_assert (MEM_P (operands[5]));
9464 lowword = adjust_address (operands[5], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
9466 emit_insn (gen_fctiwz_df (operands[4], operands[2]));
9467 emit_move_insn (operands[5], operands[4]);
9468 emit_move_insn (operands[0], lowword);
9472 (define_expand "negtf2"
9473 [(set (match_operand:TF 0 "gpc_reg_operand" "")
9474 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "")))]
9476 && TARGET_HARD_FLOAT
9477 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9478 && TARGET_LONG_DOUBLE_128"
9481 (define_insn "negtf2_internal"
9482 [(set (match_operand:TF 0 "gpc_reg_operand" "=d")
9483 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "d")))]
9485 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9488 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
9489 return \"fneg %L0,%L1\;fneg %0,%1\";
9491 return \"fneg %0,%1\;fneg %L0,%L1\";
9493 [(set_attr "type" "fp")
9494 (set_attr "length" "8")])
9496 (define_expand "abstf2"
9497 [(set (match_operand:TF 0 "gpc_reg_operand" "")
9498 (abs:TF (match_operand:TF 1 "gpc_reg_operand" "")))]
9500 && TARGET_HARD_FLOAT
9501 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9502 && TARGET_LONG_DOUBLE_128"
9505 rtx label = gen_label_rtx ();
9506 if (TARGET_E500_DOUBLE)
9508 if (flag_finite_math_only && !flag_trapping_math)
9509 emit_insn (gen_spe_abstf2_tst (operands[0], operands[1], label));
9511 emit_insn (gen_spe_abstf2_cmp (operands[0], operands[1], label));
9514 emit_insn (gen_abstf2_internal (operands[0], operands[1], label));
9519 (define_expand "abstf2_internal"
9520 [(set (match_operand:TF 0 "gpc_reg_operand" "")
9521 (match_operand:TF 1 "gpc_reg_operand" ""))
9522 (set (match_dup 3) (match_dup 5))
9523 (set (match_dup 5) (abs:DF (match_dup 5)))
9524 (set (match_dup 4) (compare:CCFP (match_dup 3) (match_dup 5)))
9525 (set (pc) (if_then_else (eq (match_dup 4) (const_int 0))
9526 (label_ref (match_operand 2 "" ""))
9528 (set (match_dup 6) (neg:DF (match_dup 6)))]
9530 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9531 && TARGET_LONG_DOUBLE_128"
9534 const int hi_word = LONG_DOUBLE_LARGE_FIRST ? 0 : GET_MODE_SIZE (DFmode);
9535 const int lo_word = LONG_DOUBLE_LARGE_FIRST ? GET_MODE_SIZE (DFmode) : 0;
9536 operands[3] = gen_reg_rtx (DFmode);
9537 operands[4] = gen_reg_rtx (CCFPmode);
9538 operands[5] = simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word);
9539 operands[6] = simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word);
9542 ;; Reload helper functions used by rs6000_secondary_reload. The patterns all
9543 ;; must have 3 arguments, and scratch register constraint must be a single
9546 ;; Reload patterns to support gpr load/store with misaligned mem.
9547 ;; and multiple gpr load/store at offset >= 0xfffc
9548 (define_expand "reload_<mode>_store"
9549 [(parallel [(match_operand 0 "memory_operand" "=m")
9550 (match_operand 1 "gpc_reg_operand" "r")
9551 (match_operand:GPR 2 "register_operand" "=&b")])]
9554 rs6000_secondary_reload_gpr (operands[1], operands[0], operands[2], true);
9558 (define_expand "reload_<mode>_load"
9559 [(parallel [(match_operand 0 "gpc_reg_operand" "=r")
9560 (match_operand 1 "memory_operand" "m")
9561 (match_operand:GPR 2 "register_operand" "=b")])]
9564 rs6000_secondary_reload_gpr (operands[0], operands[1], operands[2], false);
9569 ;; Power8 merge instructions to allow direct move to/from floating point
9570 ;; registers in 32-bit mode. We use TF mode to get two registers to move the
9571 ;; individual 32-bit parts across. Subreg doesn't work too well on the TF
9572 ;; value, since it is allocated in reload and not all of the flow information
9573 ;; is setup for it. We have two patterns to do the two moves between gprs and
9574 ;; fprs. There isn't a dependancy between the two, but we could potentially
9575 ;; schedule other instructions between the two instructions. TFmode is
9576 ;; currently limited to traditional FPR registers. If/when this is changed, we
9577 ;; will need to revist %L to make sure it works with VSX registers, or add an
9578 ;; %x version of %L.
9580 (define_insn "p8_fmrgow_<mode>"
9581 [(set (match_operand:FMOVE64X 0 "register_operand" "=d")
9582 (unspec:FMOVE64X [(match_operand:TF 1 "register_operand" "d")]
9583 UNSPEC_P8V_FMRGOW))]
9584 "!TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9586 [(set_attr "type" "vecperm")])
9588 (define_insn "p8_mtvsrwz_1"
9589 [(set (match_operand:TF 0 "register_operand" "=d")
9590 (unspec:TF [(match_operand:SI 1 "register_operand" "r")]
9591 UNSPEC_P8V_MTVSRWZ))]
9592 "!TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9594 [(set_attr "type" "mftgpr")])
9596 (define_insn "p8_mtvsrwz_2"
9597 [(set (match_operand:TF 0 "register_operand" "+d")
9598 (unspec:TF [(match_dup 0)
9599 (match_operand:SI 1 "register_operand" "r")]
9600 UNSPEC_P8V_MTVSRWZ))]
9601 "!TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9603 [(set_attr "type" "mftgpr")])
9605 (define_insn_and_split "reload_fpr_from_gpr<mode>"
9606 [(set (match_operand:FMOVE64X 0 "register_operand" "=ws")
9607 (unspec:FMOVE64X [(match_operand:FMOVE64X 1 "register_operand" "r")]
9608 UNSPEC_P8V_RELOAD_FROM_GPR))
9609 (clobber (match_operand:TF 2 "register_operand" "=d"))]
9610 "!TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9612 "&& reload_completed"
9615 rtx dest = operands[0];
9616 rtx src = operands[1];
9617 rtx tmp = operands[2];
9618 rtx gpr_hi_reg = gen_highpart (SImode, src);
9619 rtx gpr_lo_reg = gen_lowpart (SImode, src);
9621 emit_insn (gen_p8_mtvsrwz_1 (tmp, gpr_hi_reg));
9622 emit_insn (gen_p8_mtvsrwz_2 (tmp, gpr_lo_reg));
9623 emit_insn (gen_p8_fmrgow_<mode> (dest, tmp));
9626 [(set_attr "length" "12")
9627 (set_attr "type" "three")])
9629 ;; Move 128 bit values from GPRs to VSX registers in 64-bit mode
9630 (define_insn "p8_mtvsrd_1"
9631 [(set (match_operand:TF 0 "register_operand" "=ws")
9632 (unspec:TF [(match_operand:DI 1 "register_operand" "r")]
9633 UNSPEC_P8V_MTVSRD))]
9634 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9636 [(set_attr "type" "mftgpr")])
9638 (define_insn "p8_mtvsrd_2"
9639 [(set (match_operand:TF 0 "register_operand" "+ws")
9640 (unspec:TF [(match_dup 0)
9641 (match_operand:DI 1 "register_operand" "r")]
9642 UNSPEC_P8V_MTVSRD))]
9643 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9645 [(set_attr "type" "mftgpr")])
9647 (define_insn "p8_xxpermdi_<mode>"
9648 [(set (match_operand:FMOVE128_GPR 0 "register_operand" "=wa")
9649 (unspec:FMOVE128_GPR [(match_operand:TF 1 "register_operand" "ws")]
9650 UNSPEC_P8V_XXPERMDI))]
9651 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9652 "xxpermdi %x0,%1,%L1,0"
9653 [(set_attr "type" "vecperm")])
9655 (define_insn_and_split "reload_vsx_from_gpr<mode>"
9656 [(set (match_operand:FMOVE128_GPR 0 "register_operand" "=wa")
9657 (unspec:FMOVE128_GPR
9658 [(match_operand:FMOVE128_GPR 1 "register_operand" "r")]
9659 UNSPEC_P8V_RELOAD_FROM_GPR))
9660 (clobber (match_operand:TF 2 "register_operand" "=ws"))]
9661 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
9663 "&& reload_completed"
9666 rtx dest = operands[0];
9667 rtx src = operands[1];
9668 rtx tmp = operands[2];
9669 rtx gpr_hi_reg = gen_highpart (DImode, src);
9670 rtx gpr_lo_reg = gen_lowpart (DImode, src);
9672 emit_insn (gen_p8_mtvsrd_1 (tmp, gpr_hi_reg));
9673 emit_insn (gen_p8_mtvsrd_2 (tmp, gpr_lo_reg));
9674 emit_insn (gen_p8_xxpermdi_<mode> (dest, tmp));
9676 [(set_attr "length" "12")
9677 (set_attr "type" "three")])
9679 ;; Move SFmode to a VSX from a GPR register. Because scalar floating point
9680 ;; type is stored internally as double precision in the VSX registers, we have
9681 ;; to convert it from the vector format.
9683 (define_insn_and_split "reload_vsx_from_gprsf"
9684 [(set (match_operand:SF 0 "register_operand" "=wa")
9685 (unspec:SF [(match_operand:SF 1 "register_operand" "r")]
9686 UNSPEC_P8V_RELOAD_FROM_GPR))
9687 (clobber (match_operand:DI 2 "register_operand" "=r"))]
9688 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE && WORDS_BIG_ENDIAN"
9690 "&& reload_completed"
9693 rtx op0 = operands[0];
9694 rtx op1 = operands[1];
9695 rtx op2 = operands[2];
9696 rtx op0_di = simplify_gen_subreg (DImode, op0, SFmode, 0);
9697 rtx op1_di = simplify_gen_subreg (DImode, op1, SFmode, 0);
9699 /* Move SF value to upper 32-bits for xscvspdpn. */
9700 emit_insn (gen_ashldi3 (op2, op1_di, GEN_INT (32)));
9701 emit_move_insn (op0_di, op2);
9702 emit_insn (gen_vsx_xscvspdpn_directmove (op0, op0));
9705 [(set_attr "length" "8")
9706 (set_attr "type" "two")])
9708 ;; Move 128 bit values from VSX registers to GPRs in 64-bit mode by doing a
9709 ;; normal 64-bit move, followed by an xxpermdi to get the bottom 64-bit value,
9710 ;; and then doing a move of that.
9711 (define_insn "p8_mfvsrd_3_<mode>"
9712 [(set (match_operand:DF 0 "register_operand" "=r")
9713 (unspec:DF [(match_operand:FMOVE128_GPR 1 "register_operand" "wa")]
9714 UNSPEC_P8V_RELOAD_FROM_VSX))]
9715 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE && WORDS_BIG_ENDIAN"
9717 [(set_attr "type" "mftgpr")])
9719 (define_insn_and_split "reload_gpr_from_vsx<mode>"
9720 [(set (match_operand:FMOVE128_GPR 0 "register_operand" "=r")
9721 (unspec:FMOVE128_GPR
9722 [(match_operand:FMOVE128_GPR 1 "register_operand" "wa")]
9723 UNSPEC_P8V_RELOAD_FROM_VSX))
9724 (clobber (match_operand:FMOVE128_GPR 2 "register_operand" "=wa"))]
9725 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE && WORDS_BIG_ENDIAN"
9727 "&& reload_completed"
9730 rtx dest = operands[0];
9731 rtx src = operands[1];
9732 rtx tmp = operands[2];
9733 rtx gpr_hi_reg = gen_highpart (DFmode, dest);
9734 rtx gpr_lo_reg = gen_lowpart (DFmode, dest);
9736 emit_insn (gen_p8_mfvsrd_3_<mode> (gpr_hi_reg, src));
9737 emit_insn (gen_vsx_xxpermdi_<mode> (tmp, src, src, GEN_INT (3)));
9738 emit_insn (gen_p8_mfvsrd_3_<mode> (gpr_lo_reg, tmp));
9740 [(set_attr "length" "12")
9741 (set_attr "type" "three")])
9743 ;; Move SFmode to a GPR from a VSX register. Because scalar floating point
9744 ;; type is stored internally as double precision, we have to convert it to the
9747 (define_insn_and_split "reload_gpr_from_vsxsf"
9748 [(set (match_operand:SF 0 "register_operand" "=r")
9749 (unspec:SF [(match_operand:SF 1 "register_operand" "wa")]
9750 UNSPEC_P8V_RELOAD_FROM_VSX))
9751 (clobber (match_operand:V4SF 2 "register_operand" "=wa"))]
9752 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE && WORDS_BIG_ENDIAN"
9754 "&& reload_completed"
9757 rtx op0 = operands[0];
9758 rtx op1 = operands[1];
9759 rtx op2 = operands[2];
9760 rtx diop0 = simplify_gen_subreg (DImode, op0, SFmode, 0);
9762 emit_insn (gen_vsx_xscvdpspn_scalar (op2, op1));
9763 emit_insn (gen_p8_mfvsrd_4_disf (diop0, op2));
9764 emit_insn (gen_lshrdi3 (diop0, diop0, GEN_INT (32)));
9767 [(set_attr "length" "12")
9768 (set_attr "type" "three")])
9770 (define_insn "p8_mfvsrd_4_disf"
9771 [(set (match_operand:DI 0 "register_operand" "=r")
9772 (unspec:DI [(match_operand:V4SF 1 "register_operand" "wa")]
9773 UNSPEC_P8V_RELOAD_FROM_VSX))]
9774 "TARGET_POWERPC64 && TARGET_DIRECT_MOVE && WORDS_BIG_ENDIAN"
9776 [(set_attr "type" "mftgpr")])
9779 ;; Next come the multi-word integer load and store and the load and store
9782 ;; List r->r after r->Y, otherwise reload will try to reload a
9783 ;; non-offsettable address by using r->r which won't make progress.
9784 ;; Use of fprs is disparaged slightly otherwise reload prefers to reload
9785 ;; a gpr into a fpr instead of reloading an invalid 'Y' address
9786 (define_insn "*movdi_internal32"
9787 [(set (match_operand:DI 0 "rs6000_nonimmediate_operand" "=Y,r,r,?m,?*d,?*d,r,?wa")
9788 (match_operand:DI 1 "input_operand" "r,Y,r,d,m,d,IJKnGHF,O"))]
9790 && (gpc_reg_operand (operands[0], DImode)
9791 || gpc_reg_operand (operands[1], DImode))"
9801 [(set_attr_alternative "type"
9802 [(const_string "store")
9803 (const_string "load")
9806 (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
9807 (const_string "fpstore_ux")
9809 (match_test "update_address_mem (operands[0], VOIDmode)")
9810 (const_string "fpstore_u")
9811 (const_string "fpstore")))
9813 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
9814 (const_string "fpload_ux")
9816 (match_test "update_address_mem (operands[1], VOIDmode)")
9817 (const_string "fpload_u")
9818 (const_string "fpload")))
9821 (const_string "vecsimple")])])
9824 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9825 (match_operand:DI 1 "const_int_operand" ""))]
9826 "! TARGET_POWERPC64 && reload_completed
9827 && gpr_or_gpr_p (operands[0], operands[1])
9828 && !direct_move_p (operands[0], operands[1])"
9829 [(set (match_dup 2) (match_dup 4))
9830 (set (match_dup 3) (match_dup 1))]
9833 HOST_WIDE_INT value = INTVAL (operands[1]);
9834 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
9836 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
9838 operands[4] = GEN_INT (value >> 32);
9839 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
9843 [(set (match_operand:DIFD 0 "rs6000_nonimmediate_operand" "")
9844 (match_operand:DIFD 1 "input_operand" ""))]
9845 "reload_completed && !TARGET_POWERPC64
9846 && gpr_or_gpr_p (operands[0], operands[1])
9847 && !direct_move_p (operands[0], operands[1])"
9849 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
9851 (define_insn "*movdi_internal64"
9852 [(set (match_operand:DI 0 "nonimmediate_operand" "=Y,r,r,r,r,r,?m,?*d,?*d,?Z,?wa,?wa,r,*h,*h,?wa,r,?*wg,r,?*wm")
9853 (match_operand:DI 1 "input_operand" "r,Y,r,I,L,nF,d,m,d,wa,Z,wa,*h,r,0,O,*wg,r,*wm,r"))]
9855 && (gpc_reg_operand (operands[0], DImode)
9856 || gpc_reg_operand (operands[1], DImode))"
9878 [(set_attr_alternative "type"
9880 (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
9881 (const_string "store_ux")
9883 (match_test "update_address_mem (operands[0], VOIDmode)")
9884 (const_string "store_u")
9885 (const_string "store")))
9887 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
9888 (const_string "load_ux")
9890 (match_test "update_address_mem (operands[1], VOIDmode)")
9891 (const_string "load_u")
9892 (const_string "load")))
9898 (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
9899 (const_string "fpstore_ux")
9901 (match_test "update_address_mem (operands[0], VOIDmode)")
9902 (const_string "fpstore_u")
9903 (const_string "fpstore")))
9905 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
9906 (const_string "fpload_ux")
9908 (match_test "update_address_mem (operands[1], VOIDmode)")
9909 (const_string "fpload_u")
9910 (const_string "fpload")))
9913 (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
9914 (const_string "fpstore_ux")
9915 (const_string "fpstore"))
9917 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
9918 (const_string "fpload_ux")
9919 (const_string "fpload"))
9920 (const_string "vecsimple")
9921 (const_string "mfjmpr")
9922 (const_string "mtjmpr")
9924 (const_string "vecsimple")
9925 (const_string "mftgpr")
9926 (const_string "mffgpr")
9927 (const_string "mftgpr")
9928 (const_string "mffgpr")])
9929 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4,4,4,4,4,4,4,4")])
9931 ;; Generate all one-bits and clear left or right.
9932 ;; Use (and:DI (rotate:DI ...)) to avoid anddi3 unnecessary clobber.
9934 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9935 (match_operand:DI 1 "mask64_operand" ""))]
9936 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
9937 [(set (match_dup 0) (const_int -1))
9939 (and:DI (rotate:DI (match_dup 0)
9944 ;; Split a load of a large constant into the appropriate five-instruction
9945 ;; sequence. Handle anything in a constant number of insns.
9946 ;; When non-easy constants can go in the TOC, this should use
9947 ;; easy_fp_constant predicate.
9949 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9950 (match_operand:DI 1 "const_int_operand" ""))]
9951 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
9952 [(set (match_dup 0) (match_dup 2))
9953 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
9955 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
9957 if (tem == operands[0])
9964 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9965 (match_operand:DI 1 "const_double_operand" ""))]
9966 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
9967 [(set (match_dup 0) (match_dup 2))
9968 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
9970 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
9972 if (tem == operands[0])
9978 ;; TImode/PTImode is similar, except that we usually want to compute the
9979 ;; address into a register and use lsi/stsi (the exception is during reload).
9981 (define_insn "*mov<mode>_string"
9982 [(set (match_operand:TI2 0 "reg_or_mem_operand" "=Q,Y,????r,????r,????r,r")
9983 (match_operand:TI2 1 "input_operand" "r,r,Q,Y,r,n"))]
9985 && (<MODE>mode != TImode || VECTOR_MEM_NONE_P (TImode))
9986 && (gpc_reg_operand (operands[0], <MODE>mode)
9987 || gpc_reg_operand (operands[1], <MODE>mode))"
9990 switch (which_alternative)
9996 return \"stswi %1,%P0,16\";
10000 /* If the address is not used in the output, we can use lsi. Otherwise,
10001 fall through to generating four loads. */
10003 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
10004 return \"lswi %0,%P1,16\";
10005 /* ... fall through ... */
10012 [(set_attr "type" "store_ux,store_ux,load_ux,load_ux,*,*")
10013 (set (attr "cell_micro") (if_then_else (match_test "TARGET_STRING")
10014 (const_string "always")
10015 (const_string "conditional")))])
10017 (define_insn "*mov<mode>_ppc64"
10018 [(set (match_operand:TI2 0 "nonimmediate_operand" "=Y,r,r,r")
10019 (match_operand:TI2 1 "input_operand" "r,Y,r,F"))]
10020 "(TARGET_POWERPC64 && VECTOR_MEM_NONE_P (<MODE>mode)
10021 && (gpc_reg_operand (operands[0], <MODE>mode)
10022 || gpc_reg_operand (operands[1], <MODE>mode)))"
10024 [(set_attr "type" "store,load,*,*")])
10027 [(set (match_operand:TI2 0 "int_reg_operand" "")
10028 (match_operand:TI2 1 "const_double_operand" ""))]
10030 && (VECTOR_MEM_NONE_P (<MODE>mode)
10031 || (reload_completed && INT_REGNO_P (REGNO (operands[0]))))"
10032 [(set (match_dup 2) (match_dup 4))
10033 (set (match_dup 3) (match_dup 5))]
10036 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
10038 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
10040 if (GET_CODE (operands[1]) == CONST_DOUBLE)
10042 operands[4] = GEN_INT (CONST_DOUBLE_HIGH (operands[1]));
10043 operands[5] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
10045 else if (GET_CODE (operands[1]) == CONST_INT)
10047 operands[4] = GEN_INT (- (INTVAL (operands[1]) < 0));
10048 operands[5] = operands[1];
10055 [(set (match_operand:TI2 0 "nonimmediate_operand" "")
10056 (match_operand:TI2 1 "input_operand" ""))]
10058 && gpr_or_gpr_p (operands[0], operands[1])
10059 && !direct_move_p (operands[0], operands[1])
10060 && !quad_load_store_p (operands[0], operands[1])"
10062 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
10064 (define_expand "load_multiple"
10065 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
10066 (match_operand:SI 1 "" ""))
10067 (use (match_operand:SI 2 "" ""))])]
10068 "TARGET_STRING && !TARGET_POWERPC64"
10076 /* Support only loading a constant number of fixed-point registers from
10077 memory and only bother with this if more than two; the machine
10078 doesn't support more than eight. */
10079 if (GET_CODE (operands[2]) != CONST_INT
10080 || INTVAL (operands[2]) <= 2
10081 || INTVAL (operands[2]) > 8
10082 || GET_CODE (operands[1]) != MEM
10083 || GET_CODE (operands[0]) != REG
10084 || REGNO (operands[0]) >= 32)
10087 count = INTVAL (operands[2]);
10088 regno = REGNO (operands[0]);
10090 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
10091 op1 = replace_equiv_address (operands[1],
10092 force_reg (SImode, XEXP (operands[1], 0)));
10094 for (i = 0; i < count; i++)
10095 XVECEXP (operands[3], 0, i)
10096 = gen_rtx_SET (VOIDmode, gen_rtx_REG (SImode, regno + i),
10097 adjust_address_nv (op1, SImode, i * 4));
10100 (define_insn "*ldmsi8"
10101 [(match_parallel 0 "load_multiple_operation"
10102 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10103 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10104 (set (match_operand:SI 3 "gpc_reg_operand" "")
10105 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10106 (set (match_operand:SI 4 "gpc_reg_operand" "")
10107 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
10108 (set (match_operand:SI 5 "gpc_reg_operand" "")
10109 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
10110 (set (match_operand:SI 6 "gpc_reg_operand" "")
10111 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
10112 (set (match_operand:SI 7 "gpc_reg_operand" "")
10113 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
10114 (set (match_operand:SI 8 "gpc_reg_operand" "")
10115 (mem:SI (plus:SI (match_dup 1) (const_int 24))))
10116 (set (match_operand:SI 9 "gpc_reg_operand" "")
10117 (mem:SI (plus:SI (match_dup 1) (const_int 28))))])]
10118 "TARGET_STRING && XVECLEN (operands[0], 0) == 8"
10120 { return rs6000_output_load_multiple (operands); }"
10121 [(set_attr "type" "load_ux")
10122 (set_attr "length" "32")])
10124 (define_insn "*ldmsi7"
10125 [(match_parallel 0 "load_multiple_operation"
10126 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10127 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10128 (set (match_operand:SI 3 "gpc_reg_operand" "")
10129 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10130 (set (match_operand:SI 4 "gpc_reg_operand" "")
10131 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
10132 (set (match_operand:SI 5 "gpc_reg_operand" "")
10133 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
10134 (set (match_operand:SI 6 "gpc_reg_operand" "")
10135 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
10136 (set (match_operand:SI 7 "gpc_reg_operand" "")
10137 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
10138 (set (match_operand:SI 8 "gpc_reg_operand" "")
10139 (mem:SI (plus:SI (match_dup 1) (const_int 24))))])]
10140 "TARGET_STRING && XVECLEN (operands[0], 0) == 7"
10142 { return rs6000_output_load_multiple (operands); }"
10143 [(set_attr "type" "load_ux")
10144 (set_attr "length" "32")])
10146 (define_insn "*ldmsi6"
10147 [(match_parallel 0 "load_multiple_operation"
10148 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10149 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10150 (set (match_operand:SI 3 "gpc_reg_operand" "")
10151 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10152 (set (match_operand:SI 4 "gpc_reg_operand" "")
10153 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
10154 (set (match_operand:SI 5 "gpc_reg_operand" "")
10155 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
10156 (set (match_operand:SI 6 "gpc_reg_operand" "")
10157 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
10158 (set (match_operand:SI 7 "gpc_reg_operand" "")
10159 (mem:SI (plus:SI (match_dup 1) (const_int 20))))])]
10160 "TARGET_STRING && XVECLEN (operands[0], 0) == 6"
10162 { return rs6000_output_load_multiple (operands); }"
10163 [(set_attr "type" "load_ux")
10164 (set_attr "length" "32")])
10166 (define_insn "*ldmsi5"
10167 [(match_parallel 0 "load_multiple_operation"
10168 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10169 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10170 (set (match_operand:SI 3 "gpc_reg_operand" "")
10171 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10172 (set (match_operand:SI 4 "gpc_reg_operand" "")
10173 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
10174 (set (match_operand:SI 5 "gpc_reg_operand" "")
10175 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
10176 (set (match_operand:SI 6 "gpc_reg_operand" "")
10177 (mem:SI (plus:SI (match_dup 1) (const_int 16))))])]
10178 "TARGET_STRING && XVECLEN (operands[0], 0) == 5"
10180 { return rs6000_output_load_multiple (operands); }"
10181 [(set_attr "type" "load_ux")
10182 (set_attr "length" "32")])
10184 (define_insn "*ldmsi4"
10185 [(match_parallel 0 "load_multiple_operation"
10186 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10187 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10188 (set (match_operand:SI 3 "gpc_reg_operand" "")
10189 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10190 (set (match_operand:SI 4 "gpc_reg_operand" "")
10191 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
10192 (set (match_operand:SI 5 "gpc_reg_operand" "")
10193 (mem:SI (plus:SI (match_dup 1) (const_int 12))))])]
10194 "TARGET_STRING && XVECLEN (operands[0], 0) == 4"
10196 { return rs6000_output_load_multiple (operands); }"
10197 [(set_attr "type" "load_ux")
10198 (set_attr "length" "32")])
10200 (define_insn "*ldmsi3"
10201 [(match_parallel 0 "load_multiple_operation"
10202 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10203 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10204 (set (match_operand:SI 3 "gpc_reg_operand" "")
10205 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10206 (set (match_operand:SI 4 "gpc_reg_operand" "")
10207 (mem:SI (plus:SI (match_dup 1) (const_int 8))))])]
10208 "TARGET_STRING && XVECLEN (operands[0], 0) == 3"
10210 { return rs6000_output_load_multiple (operands); }"
10211 [(set_attr "type" "load_ux")
10212 (set_attr "length" "32")])
10214 (define_expand "store_multiple"
10215 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
10216 (match_operand:SI 1 "" ""))
10217 (clobber (scratch:SI))
10218 (use (match_operand:SI 2 "" ""))])]
10219 "TARGET_STRING && !TARGET_POWERPC64"
10228 /* Support only storing a constant number of fixed-point registers to
10229 memory and only bother with this if more than two; the machine
10230 doesn't support more than eight. */
10231 if (GET_CODE (operands[2]) != CONST_INT
10232 || INTVAL (operands[2]) <= 2
10233 || INTVAL (operands[2]) > 8
10234 || GET_CODE (operands[0]) != MEM
10235 || GET_CODE (operands[1]) != REG
10236 || REGNO (operands[1]) >= 32)
10239 count = INTVAL (operands[2]);
10240 regno = REGNO (operands[1]);
10242 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count + 1));
10243 to = force_reg (SImode, XEXP (operands[0], 0));
10244 op0 = replace_equiv_address (operands[0], to);
10246 XVECEXP (operands[3], 0, 0)
10247 = gen_rtx_SET (VOIDmode, adjust_address_nv (op0, SImode, 0), operands[1]);
10248 XVECEXP (operands[3], 0, 1) = gen_rtx_CLOBBER (VOIDmode,
10249 gen_rtx_SCRATCH (SImode));
10251 for (i = 1; i < count; i++)
10252 XVECEXP (operands[3], 0, i + 1)
10253 = gen_rtx_SET (VOIDmode,
10254 adjust_address_nv (op0, SImode, i * 4),
10255 gen_rtx_REG (SImode, regno + i));
10258 (define_insn "*stmsi8"
10259 [(match_parallel 0 "store_multiple_operation"
10260 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10261 (match_operand:SI 2 "gpc_reg_operand" "r"))
10262 (clobber (match_scratch:SI 3 "=X"))
10263 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10264 (match_operand:SI 4 "gpc_reg_operand" "r"))
10265 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10266 (match_operand:SI 5 "gpc_reg_operand" "r"))
10267 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10268 (match_operand:SI 6 "gpc_reg_operand" "r"))
10269 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10270 (match_operand:SI 7 "gpc_reg_operand" "r"))
10271 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10272 (match_operand:SI 8 "gpc_reg_operand" "r"))
10273 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
10274 (match_operand:SI 9 "gpc_reg_operand" "r"))
10275 (set (mem:SI (plus:SI (match_dup 1) (const_int 28)))
10276 (match_operand:SI 10 "gpc_reg_operand" "r"))])]
10277 "TARGET_STRING && XVECLEN (operands[0], 0) == 9"
10279 [(set_attr "type" "store_ux")
10280 (set_attr "cell_micro" "always")])
10282 (define_insn "*stmsi7"
10283 [(match_parallel 0 "store_multiple_operation"
10284 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10285 (match_operand:SI 2 "gpc_reg_operand" "r"))
10286 (clobber (match_scratch:SI 3 "=X"))
10287 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10288 (match_operand:SI 4 "gpc_reg_operand" "r"))
10289 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10290 (match_operand:SI 5 "gpc_reg_operand" "r"))
10291 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10292 (match_operand:SI 6 "gpc_reg_operand" "r"))
10293 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10294 (match_operand:SI 7 "gpc_reg_operand" "r"))
10295 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10296 (match_operand:SI 8 "gpc_reg_operand" "r"))
10297 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
10298 (match_operand:SI 9 "gpc_reg_operand" "r"))])]
10299 "TARGET_STRING && XVECLEN (operands[0], 0) == 8"
10301 [(set_attr "type" "store_ux")
10302 (set_attr "cell_micro" "always")])
10304 (define_insn "*stmsi6"
10305 [(match_parallel 0 "store_multiple_operation"
10306 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10307 (match_operand:SI 2 "gpc_reg_operand" "r"))
10308 (clobber (match_scratch:SI 3 "=X"))
10309 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10310 (match_operand:SI 4 "gpc_reg_operand" "r"))
10311 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10312 (match_operand:SI 5 "gpc_reg_operand" "r"))
10313 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10314 (match_operand:SI 6 "gpc_reg_operand" "r"))
10315 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10316 (match_operand:SI 7 "gpc_reg_operand" "r"))
10317 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10318 (match_operand:SI 8 "gpc_reg_operand" "r"))])]
10319 "TARGET_STRING && XVECLEN (operands[0], 0) == 7"
10321 [(set_attr "type" "store_ux")
10322 (set_attr "cell_micro" "always")])
10324 (define_insn "*stmsi5"
10325 [(match_parallel 0 "store_multiple_operation"
10326 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10327 (match_operand:SI 2 "gpc_reg_operand" "r"))
10328 (clobber (match_scratch:SI 3 "=X"))
10329 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10330 (match_operand:SI 4 "gpc_reg_operand" "r"))
10331 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10332 (match_operand:SI 5 "gpc_reg_operand" "r"))
10333 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10334 (match_operand:SI 6 "gpc_reg_operand" "r"))
10335 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10336 (match_operand:SI 7 "gpc_reg_operand" "r"))])]
10337 "TARGET_STRING && XVECLEN (operands[0], 0) == 6"
10339 [(set_attr "type" "store_ux")
10340 (set_attr "cell_micro" "always")])
10342 (define_insn "*stmsi4"
10343 [(match_parallel 0 "store_multiple_operation"
10344 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10345 (match_operand:SI 2 "gpc_reg_operand" "r"))
10346 (clobber (match_scratch:SI 3 "=X"))
10347 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10348 (match_operand:SI 4 "gpc_reg_operand" "r"))
10349 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10350 (match_operand:SI 5 "gpc_reg_operand" "r"))
10351 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10352 (match_operand:SI 6 "gpc_reg_operand" "r"))])]
10353 "TARGET_STRING && XVECLEN (operands[0], 0) == 5"
10355 [(set_attr "type" "store_ux")
10356 (set_attr "cell_micro" "always")])
10358 (define_insn "*stmsi3"
10359 [(match_parallel 0 "store_multiple_operation"
10360 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10361 (match_operand:SI 2 "gpc_reg_operand" "r"))
10362 (clobber (match_scratch:SI 3 "=X"))
10363 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10364 (match_operand:SI 4 "gpc_reg_operand" "r"))
10365 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10366 (match_operand:SI 5 "gpc_reg_operand" "r"))])]
10367 "TARGET_STRING && XVECLEN (operands[0], 0) == 4"
10369 [(set_attr "type" "store_ux")
10370 (set_attr "cell_micro" "always")])
10372 (define_expand "setmemsi"
10373 [(parallel [(set (match_operand:BLK 0 "" "")
10374 (match_operand 2 "const_int_operand" ""))
10375 (use (match_operand:SI 1 "" ""))
10376 (use (match_operand:SI 3 "" ""))])]
10380 /* If value to set is not zero, use the library routine. */
10381 if (operands[2] != const0_rtx)
10384 if (expand_block_clear (operands))
10390 ;; String/block move insn.
10391 ;; Argument 0 is the destination
10392 ;; Argument 1 is the source
10393 ;; Argument 2 is the length
10394 ;; Argument 3 is the alignment
10396 (define_expand "movmemsi"
10397 [(parallel [(set (match_operand:BLK 0 "" "")
10398 (match_operand:BLK 1 "" ""))
10399 (use (match_operand:SI 2 "" ""))
10400 (use (match_operand:SI 3 "" ""))])]
10404 if (expand_block_move (operands))
10410 ;; Move up to 32 bytes at a time. The fixed registers are needed because the
10411 ;; register allocator doesn't have a clue about allocating 8 word registers.
10412 ;; rD/rS = r5 is preferred, efficient form.
10413 (define_expand "movmemsi_8reg"
10414 [(parallel [(set (match_operand 0 "" "")
10415 (match_operand 1 "" ""))
10416 (use (match_operand 2 "" ""))
10417 (use (match_operand 3 "" ""))
10418 (clobber (reg:SI 5))
10419 (clobber (reg:SI 6))
10420 (clobber (reg:SI 7))
10421 (clobber (reg:SI 8))
10422 (clobber (reg:SI 9))
10423 (clobber (reg:SI 10))
10424 (clobber (reg:SI 11))
10425 (clobber (reg:SI 12))
10426 (clobber (match_scratch:SI 4 ""))])]
10431 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
10432 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
10433 (use (match_operand:SI 2 "immediate_operand" "i"))
10434 (use (match_operand:SI 3 "immediate_operand" "i"))
10435 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10436 (clobber (reg:SI 6))
10437 (clobber (reg:SI 7))
10438 (clobber (reg:SI 8))
10439 (clobber (reg:SI 9))
10440 (clobber (reg:SI 10))
10441 (clobber (reg:SI 11))
10442 (clobber (reg:SI 12))
10443 (clobber (match_scratch:SI 5 "=X"))]
10445 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
10446 || INTVAL (operands[2]) == 0)
10447 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
10448 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
10449 && REGNO (operands[4]) == 5"
10450 "lswi %4,%1,%2\;stswi %4,%0,%2"
10451 [(set_attr "type" "store_ux")
10452 (set_attr "cell_micro" "always")
10453 (set_attr "length" "8")])
10455 ;; Move up to 24 bytes at a time. The fixed registers are needed because the
10456 ;; register allocator doesn't have a clue about allocating 6 word registers.
10457 ;; rD/rS = r5 is preferred, efficient form.
10458 (define_expand "movmemsi_6reg"
10459 [(parallel [(set (match_operand 0 "" "")
10460 (match_operand 1 "" ""))
10461 (use (match_operand 2 "" ""))
10462 (use (match_operand 3 "" ""))
10463 (clobber (reg:SI 5))
10464 (clobber (reg:SI 6))
10465 (clobber (reg:SI 7))
10466 (clobber (reg:SI 8))
10467 (clobber (reg:SI 9))
10468 (clobber (reg:SI 10))
10469 (clobber (match_scratch:SI 4 ""))])]
10474 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
10475 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
10476 (use (match_operand:SI 2 "immediate_operand" "i"))
10477 (use (match_operand:SI 3 "immediate_operand" "i"))
10478 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10479 (clobber (reg:SI 6))
10480 (clobber (reg:SI 7))
10481 (clobber (reg:SI 8))
10482 (clobber (reg:SI 9))
10483 (clobber (reg:SI 10))
10484 (clobber (match_scratch:SI 5 "=X"))]
10486 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
10487 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
10488 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
10489 && REGNO (operands[4]) == 5"
10490 "lswi %4,%1,%2\;stswi %4,%0,%2"
10491 [(set_attr "type" "store_ux")
10492 (set_attr "cell_micro" "always")
10493 (set_attr "length" "8")])
10495 ;; Move up to 16 bytes at a time, using 4 fixed registers to avoid spill
10496 ;; problems with TImode.
10497 ;; rD/rS = r5 is preferred, efficient form.
10498 (define_expand "movmemsi_4reg"
10499 [(parallel [(set (match_operand 0 "" "")
10500 (match_operand 1 "" ""))
10501 (use (match_operand 2 "" ""))
10502 (use (match_operand 3 "" ""))
10503 (clobber (reg:SI 5))
10504 (clobber (reg:SI 6))
10505 (clobber (reg:SI 7))
10506 (clobber (reg:SI 8))
10507 (clobber (match_scratch:SI 4 ""))])]
10512 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
10513 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
10514 (use (match_operand:SI 2 "immediate_operand" "i"))
10515 (use (match_operand:SI 3 "immediate_operand" "i"))
10516 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10517 (clobber (reg:SI 6))
10518 (clobber (reg:SI 7))
10519 (clobber (reg:SI 8))
10520 (clobber (match_scratch:SI 5 "=X"))]
10522 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
10523 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
10524 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
10525 && REGNO (operands[4]) == 5"
10526 "lswi %4,%1,%2\;stswi %4,%0,%2"
10527 [(set_attr "type" "store_ux")
10528 (set_attr "cell_micro" "always")
10529 (set_attr "length" "8")])
10531 ;; Move up to 8 bytes at a time.
10532 (define_expand "movmemsi_2reg"
10533 [(parallel [(set (match_operand 0 "" "")
10534 (match_operand 1 "" ""))
10535 (use (match_operand 2 "" ""))
10536 (use (match_operand 3 "" ""))
10537 (clobber (match_scratch:DI 4 ""))
10538 (clobber (match_scratch:SI 5 ""))])]
10539 "TARGET_STRING && ! TARGET_POWERPC64"
10543 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
10544 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
10545 (use (match_operand:SI 2 "immediate_operand" "i"))
10546 (use (match_operand:SI 3 "immediate_operand" "i"))
10547 (clobber (match_scratch:DI 4 "=&r"))
10548 (clobber (match_scratch:SI 5 "=X"))]
10549 "TARGET_STRING && ! TARGET_POWERPC64
10550 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
10551 "lswi %4,%1,%2\;stswi %4,%0,%2"
10552 [(set_attr "type" "store_ux")
10553 (set_attr "cell_micro" "always")
10554 (set_attr "length" "8")])
10556 ;; Move up to 4 bytes at a time.
10557 (define_expand "movmemsi_1reg"
10558 [(parallel [(set (match_operand 0 "" "")
10559 (match_operand 1 "" ""))
10560 (use (match_operand 2 "" ""))
10561 (use (match_operand 3 "" ""))
10562 (clobber (match_scratch:SI 4 ""))
10563 (clobber (match_scratch:SI 5 ""))])]
10568 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
10569 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
10570 (use (match_operand:SI 2 "immediate_operand" "i"))
10571 (use (match_operand:SI 3 "immediate_operand" "i"))
10572 (clobber (match_scratch:SI 4 "=&r"))
10573 (clobber (match_scratch:SI 5 "=X"))]
10574 "TARGET_STRING && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
10575 "lswi %4,%1,%2\;stswi %4,%0,%2"
10576 [(set_attr "type" "store_ux")
10577 (set_attr "cell_micro" "always")
10578 (set_attr "length" "8")])
10580 ;; Define insns that do load or store with update. Some of these we can
10581 ;; get by using pre-decrement or pre-increment, but the hardware can also
10582 ;; do cases where the increment is not the size of the object.
10584 ;; In all these cases, we use operands 0 and 1 for the register being
10585 ;; incremented because those are the operands that local-alloc will
10586 ;; tie and these are the pair most likely to be tieable (and the ones
10587 ;; that will benefit the most).
10589 (define_insn "*movdi_update1"
10590 [(set (match_operand:DI 3 "gpc_reg_operand" "=r,r")
10591 (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
10592 (match_operand:DI 2 "reg_or_aligned_short_operand" "r,I"))))
10593 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
10594 (plus:DI (match_dup 1) (match_dup 2)))]
10595 "TARGET_POWERPC64 && TARGET_UPDATE
10596 && (!avoiding_indexed_address_p (DImode)
10597 || !gpc_reg_operand (operands[2], DImode))"
10601 [(set_attr "type" "load_ux,load_u")])
10603 (define_insn "movdi_<mode>_update"
10604 [(set (mem:DI (plus:P (match_operand:P 1 "gpc_reg_operand" "0,0")
10605 (match_operand:P 2 "reg_or_aligned_short_operand" "r,I")))
10606 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
10607 (set (match_operand:P 0 "gpc_reg_operand" "=b,b")
10608 (plus:P (match_dup 1) (match_dup 2)))]
10609 "TARGET_POWERPC64 && TARGET_UPDATE
10610 && (!avoiding_indexed_address_p (Pmode)
10611 || !gpc_reg_operand (operands[2], Pmode)
10612 || (REG_P (operands[0])
10613 && REGNO (operands[0]) == STACK_POINTER_REGNUM))"
10617 [(set_attr "type" "store_ux,store_u")])
10619 ;; This pattern is only conditional on TARGET_POWERPC64, as it is
10620 ;; needed for stack allocation, even if the user passes -mno-update.
10621 (define_insn "movdi_<mode>_update_stack"
10622 [(set (mem:DI (plus:P (match_operand:P 1 "gpc_reg_operand" "0,0")
10623 (match_operand:P 2 "reg_or_aligned_short_operand" "r,I")))
10624 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
10625 (set (match_operand:P 0 "gpc_reg_operand" "=b,b")
10626 (plus:P (match_dup 1) (match_dup 2)))]
10631 [(set_attr "type" "store_ux,store_u")])
10633 (define_insn "*movsi_update1"
10634 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
10635 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10636 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10637 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10638 (plus:SI (match_dup 1) (match_dup 2)))]
10640 && (!avoiding_indexed_address_p (SImode)
10641 || !gpc_reg_operand (operands[2], SImode))"
10645 [(set_attr "type" "load_ux,load_u")])
10647 (define_insn "*movsi_update2"
10648 [(set (match_operand:DI 3 "gpc_reg_operand" "=r")
10650 (mem:SI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0")
10651 (match_operand:DI 2 "gpc_reg_operand" "r")))))
10652 (set (match_operand:DI 0 "gpc_reg_operand" "=b")
10653 (plus:DI (match_dup 1) (match_dup 2)))]
10654 "TARGET_POWERPC64 && rs6000_gen_cell_microcode
10655 && !avoiding_indexed_address_p (DImode)"
10657 [(set_attr "type" "load_ext_ux")])
10659 (define_insn "movsi_update"
10660 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10661 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10662 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
10663 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10664 (plus:SI (match_dup 1) (match_dup 2)))]
10666 && (!avoiding_indexed_address_p (SImode)
10667 || !gpc_reg_operand (operands[2], SImode)
10668 || (REG_P (operands[0])
10669 && REGNO (operands[0]) == STACK_POINTER_REGNUM))"
10673 [(set_attr "type" "store_ux,store_u")])
10675 ;; This is an unconditional pattern; needed for stack allocation, even
10676 ;; if the user passes -mno-update.
10677 (define_insn "movsi_update_stack"
10678 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10679 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10680 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
10681 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10682 (plus:SI (match_dup 1) (match_dup 2)))]
10687 [(set_attr "type" "store_ux,store_u")])
10689 (define_insn "*movhi_update1"
10690 [(set (match_operand:HI 3 "gpc_reg_operand" "=r,r")
10691 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10692 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10693 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10694 (plus:SI (match_dup 1) (match_dup 2)))]
10696 && (!avoiding_indexed_address_p (SImode)
10697 || !gpc_reg_operand (operands[2], SImode))"
10701 [(set_attr "type" "load_ux,load_u")])
10703 (define_insn "*movhi_update2"
10704 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
10706 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10707 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
10708 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10709 (plus:SI (match_dup 1) (match_dup 2)))]
10711 && (!avoiding_indexed_address_p (SImode)
10712 || !gpc_reg_operand (operands[2], SImode))"
10716 [(set_attr "type" "load_ux,load_u")])
10718 (define_insn "*movhi_update3"
10719 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
10721 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10722 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
10723 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10724 (plus:SI (match_dup 1) (match_dup 2)))]
10725 "TARGET_UPDATE && rs6000_gen_cell_microcode
10726 && (!avoiding_indexed_address_p (SImode)
10727 || !gpc_reg_operand (operands[2], SImode))"
10731 [(set_attr "type" "load_ext_ux,load_ext_u")])
10733 (define_insn "*movhi_update4"
10734 [(set (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10735 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10736 (match_operand:HI 3 "gpc_reg_operand" "r,r"))
10737 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10738 (plus:SI (match_dup 1) (match_dup 2)))]
10740 && (!avoiding_indexed_address_p (SImode)
10741 || !gpc_reg_operand (operands[2], SImode))"
10745 [(set_attr "type" "store_ux,store_u")])
10747 (define_insn "*movqi_update1"
10748 [(set (match_operand:QI 3 "gpc_reg_operand" "=r,r")
10749 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10750 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10751 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10752 (plus:SI (match_dup 1) (match_dup 2)))]
10754 && (!avoiding_indexed_address_p (SImode)
10755 || !gpc_reg_operand (operands[2], SImode))"
10759 [(set_attr "type" "load_ux,load_u")])
10761 (define_insn "*movqi_update2"
10762 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
10764 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10765 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
10766 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10767 (plus:SI (match_dup 1) (match_dup 2)))]
10769 && (!avoiding_indexed_address_p (SImode)
10770 || !gpc_reg_operand (operands[2], SImode))"
10774 [(set_attr "type" "load_ux,load_u")])
10776 (define_insn "*movqi_update3"
10777 [(set (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10778 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10779 (match_operand:QI 3 "gpc_reg_operand" "r,r"))
10780 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10781 (plus:SI (match_dup 1) (match_dup 2)))]
10783 && (!avoiding_indexed_address_p (SImode)
10784 || !gpc_reg_operand (operands[2], SImode))"
10788 [(set_attr "type" "store_ux,store_u")])
10790 (define_insn "*movsf_update1"
10791 [(set (match_operand:SF 3 "gpc_reg_operand" "=f,f")
10792 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10793 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10794 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10795 (plus:SI (match_dup 1) (match_dup 2)))]
10796 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT && TARGET_UPDATE
10797 && (!avoiding_indexed_address_p (SImode)
10798 || !gpc_reg_operand (operands[2], SImode))"
10802 [(set_attr "type" "fpload_ux,fpload_u")])
10804 (define_insn "*movsf_update2"
10805 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10806 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10807 (match_operand:SF 3 "gpc_reg_operand" "f,f"))
10808 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10809 (plus:SI (match_dup 1) (match_dup 2)))]
10810 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT && TARGET_UPDATE
10811 && (!avoiding_indexed_address_p (SImode)
10812 || !gpc_reg_operand (operands[2], SImode))"
10816 [(set_attr "type" "fpstore_ux,fpstore_u")])
10818 (define_insn "*movsf_update3"
10819 [(set (match_operand:SF 3 "gpc_reg_operand" "=r,r")
10820 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10821 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10822 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10823 (plus:SI (match_dup 1) (match_dup 2)))]
10824 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE
10825 && (!avoiding_indexed_address_p (SImode)
10826 || !gpc_reg_operand (operands[2], SImode))"
10830 [(set_attr "type" "load_ux,load_u")])
10832 (define_insn "*movsf_update4"
10833 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10834 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10835 (match_operand:SF 3 "gpc_reg_operand" "r,r"))
10836 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10837 (plus:SI (match_dup 1) (match_dup 2)))]
10838 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE
10839 && (!avoiding_indexed_address_p (SImode)
10840 || !gpc_reg_operand (operands[2], SImode))"
10844 [(set_attr "type" "store_ux,store_u")])
10846 (define_insn "*movdf_update1"
10847 [(set (match_operand:DF 3 "gpc_reg_operand" "=d,d")
10848 (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10849 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10850 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10851 (plus:SI (match_dup 1) (match_dup 2)))]
10852 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_UPDATE
10853 && (!avoiding_indexed_address_p (SImode)
10854 || !gpc_reg_operand (operands[2], SImode))"
10858 [(set_attr "type" "fpload_ux,fpload_u")])
10860 (define_insn "*movdf_update2"
10861 [(set (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10862 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10863 (match_operand:DF 3 "gpc_reg_operand" "d,d"))
10864 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10865 (plus:SI (match_dup 1) (match_dup 2)))]
10866 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_UPDATE
10867 && (!avoiding_indexed_address_p (SImode)
10868 || !gpc_reg_operand (operands[2], SImode))"
10872 [(set_attr "type" "fpstore_ux,fpstore_u")])
10875 ;; After inserting conditional returns we can sometimes have
10876 ;; unnecessary register moves. Unfortunately we cannot have a
10877 ;; modeless peephole here, because some single SImode sets have early
10878 ;; clobber outputs. Although those sets expand to multi-ppc-insn
10879 ;; sequences, using get_attr_length here will smash the operands
10880 ;; array. Neither is there an early_cobbler_p predicate.
10881 ;; Disallow subregs for E500 so we don't munge frob_di_df_2.
10883 [(set (match_operand:DF 0 "gpc_reg_operand" "")
10884 (match_operand:DF 1 "any_operand" ""))
10885 (set (match_operand:DF 2 "gpc_reg_operand" "")
10887 "!(TARGET_E500_DOUBLE && GET_CODE (operands[2]) == SUBREG)
10888 && peep2_reg_dead_p (2, operands[0])"
10889 [(set (match_dup 2) (match_dup 1))])
10892 [(set (match_operand:SF 0 "gpc_reg_operand" "")
10893 (match_operand:SF 1 "any_operand" ""))
10894 (set (match_operand:SF 2 "gpc_reg_operand" "")
10896 "peep2_reg_dead_p (2, operands[0])"
10897 [(set (match_dup 2) (match_dup 1))])
10902 ;; Mode attributes for different ABIs.
10903 (define_mode_iterator TLSmode [(SI "! TARGET_64BIT") (DI "TARGET_64BIT")])
10904 (define_mode_attr tls_abi_suffix [(SI "32") (DI "64")])
10905 (define_mode_attr tls_sysv_suffix [(SI "si") (DI "di")])
10906 (define_mode_attr tls_insn_suffix [(SI "wz") (DI "d")])
10908 (define_insn_and_split "tls_gd_aix<TLSmode:tls_abi_suffix>"
10909 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10910 (call (mem:TLSmode (match_operand:TLSmode 3 "symbol_ref_operand" "s"))
10911 (match_operand 4 "" "g")))
10912 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10913 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10915 (clobber (reg:SI LR_REGNO))]
10916 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX"
10918 if (TARGET_CMODEL != CMODEL_SMALL)
10919 return "addis %0,%1,%2@got@tlsgd@ha\;addi %0,%0,%2@got@tlsgd@l\;"
10922 return "addi %0,%1,%2@got@tlsgd\;bl %z3\;nop";
10924 "&& TARGET_TLS_MARKERS"
10925 [(set (match_dup 0)
10926 (unspec:TLSmode [(match_dup 1)
10929 (parallel [(set (match_dup 0)
10930 (call (mem:TLSmode (match_dup 3))
10932 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD)
10933 (clobber (reg:SI LR_REGNO))])]
10935 [(set_attr "type" "two")
10936 (set (attr "length")
10937 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
10941 (define_insn_and_split "tls_gd_sysv<TLSmode:tls_sysv_suffix>"
10942 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10943 (call (mem:TLSmode (match_operand:TLSmode 3 "symbol_ref_operand" "s"))
10944 (match_operand 4 "" "g")))
10945 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10946 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10948 (clobber (reg:SI LR_REGNO))]
10949 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4"
10953 if (TARGET_SECURE_PLT && flag_pic == 2)
10954 return "addi %0,%1,%2@got@tlsgd\;bl %z3+32768@plt";
10956 return "addi %0,%1,%2@got@tlsgd\;bl %z3@plt";
10959 return "addi %0,%1,%2@got@tlsgd\;bl %z3";
10961 "&& TARGET_TLS_MARKERS"
10962 [(set (match_dup 0)
10963 (unspec:TLSmode [(match_dup 1)
10966 (parallel [(set (match_dup 0)
10967 (call (mem:TLSmode (match_dup 3))
10969 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD)
10970 (clobber (reg:SI LR_REGNO))])]
10972 [(set_attr "type" "two")
10973 (set_attr "length" "8")])
10975 (define_insn_and_split "*tls_gd<TLSmode:tls_abi_suffix>"
10976 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10977 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10978 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10980 "HAVE_AS_TLS && TARGET_TLS_MARKERS"
10981 "addi %0,%1,%2@got@tlsgd"
10982 "&& TARGET_CMODEL != CMODEL_SMALL"
10983 [(set (match_dup 3)
10985 (unspec:TLSmode [(match_dup 1) (match_dup 2)] UNSPEC_TLSGD)))
10987 (lo_sum:TLSmode (match_dup 3)
10988 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD)))]
10991 operands[3] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
10993 [(set (attr "length")
10994 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
10998 (define_insn "*tls_gd_high<TLSmode:tls_abi_suffix>"
10999 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11001 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11002 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11004 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
11005 "addis %0,%1,%2@got@tlsgd@ha"
11006 [(set_attr "length" "4")])
11008 (define_insn "*tls_gd_low<TLSmode:tls_abi_suffix>"
11009 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11010 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11011 (unspec:TLSmode [(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11013 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
11014 "addi %0,%1,%2@got@tlsgd@l"
11015 [(set_attr "length" "4")])
11017 (define_insn "*tls_gd_call_aix<TLSmode:tls_abi_suffix>"
11018 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11019 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
11020 (match_operand 2 "" "g")))
11021 (unspec:TLSmode [(match_operand:TLSmode 3 "rs6000_tls_symbol_ref" "")]
11023 (clobber (reg:SI LR_REGNO))]
11024 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX && TARGET_TLS_MARKERS"
11025 "bl %z1(%3@tlsgd)\;nop"
11026 [(set_attr "type" "branch")
11027 (set_attr "length" "8")])
11029 (define_insn "*tls_gd_call_sysv<TLSmode:tls_abi_suffix>"
11030 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11031 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
11032 (match_operand 2 "" "g")))
11033 (unspec:TLSmode [(match_operand:TLSmode 3 "rs6000_tls_symbol_ref" "")]
11035 (clobber (reg:SI LR_REGNO))]
11036 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4 && TARGET_TLS_MARKERS"
11040 if (TARGET_SECURE_PLT && flag_pic == 2)
11041 return "bl %z1+32768(%3@tlsgd)@plt";
11042 return "bl %z1(%3@tlsgd)@plt";
11044 return "bl %z1(%3@tlsgd)";
11046 [(set_attr "type" "branch")
11047 (set_attr "length" "4")])
11049 (define_insn_and_split "tls_ld_aix<TLSmode:tls_abi_suffix>"
11050 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11051 (call (mem:TLSmode (match_operand:TLSmode 2 "symbol_ref_operand" "s"))
11052 (match_operand 3 "" "g")))
11053 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
11055 (clobber (reg:SI LR_REGNO))]
11056 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX"
11058 if (TARGET_CMODEL != CMODEL_SMALL)
11059 return "addis %0,%1,%&@got@tlsld@ha\;addi %0,%0,%&@got@tlsld@l\;"
11062 return "addi %0,%1,%&@got@tlsld\;bl %z2\;nop";
11064 "&& TARGET_TLS_MARKERS"
11065 [(set (match_dup 0)
11066 (unspec:TLSmode [(match_dup 1)]
11068 (parallel [(set (match_dup 0)
11069 (call (mem:TLSmode (match_dup 2))
11071 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
11072 (clobber (reg:SI LR_REGNO))])]
11074 [(set_attr "type" "two")
11075 (set (attr "length")
11076 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
11080 (define_insn_and_split "tls_ld_sysv<TLSmode:tls_sysv_suffix>"
11081 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11082 (call (mem:TLSmode (match_operand:TLSmode 2 "symbol_ref_operand" "s"))
11083 (match_operand 3 "" "g")))
11084 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
11086 (clobber (reg:SI LR_REGNO))]
11087 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4"
11091 if (TARGET_SECURE_PLT && flag_pic == 2)
11092 return "addi %0,%1,%&@got@tlsld\;bl %z2+32768@plt";
11094 return "addi %0,%1,%&@got@tlsld\;bl %z2@plt";
11097 return "addi %0,%1,%&@got@tlsld\;bl %z2";
11099 "&& TARGET_TLS_MARKERS"
11100 [(set (match_dup 0)
11101 (unspec:TLSmode [(match_dup 1)]
11103 (parallel [(set (match_dup 0)
11104 (call (mem:TLSmode (match_dup 2))
11106 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
11107 (clobber (reg:SI LR_REGNO))])]
11109 [(set_attr "length" "8")])
11111 (define_insn_and_split "*tls_ld<TLSmode:tls_abi_suffix>"
11112 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11113 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
11115 "HAVE_AS_TLS && TARGET_TLS_MARKERS"
11116 "addi %0,%1,%&@got@tlsld"
11117 "&& TARGET_CMODEL != CMODEL_SMALL"
11118 [(set (match_dup 2)
11120 (unspec:TLSmode [(const_int 0) (match_dup 1)] UNSPEC_TLSLD)))
11122 (lo_sum:TLSmode (match_dup 2)
11123 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)))]
11126 operands[2] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
11128 [(set (attr "length")
11129 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
11133 (define_insn "*tls_ld_high<TLSmode:tls_abi_suffix>"
11134 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11136 (unspec:TLSmode [(const_int 0)
11137 (match_operand:TLSmode 1 "gpc_reg_operand" "b")]
11139 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
11140 "addis %0,%1,%&@got@tlsld@ha"
11141 [(set_attr "length" "4")])
11143 (define_insn "*tls_ld_low<TLSmode:tls_abi_suffix>"
11144 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11145 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11146 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)))]
11147 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
11148 "addi %0,%1,%&@got@tlsld@l"
11149 [(set_attr "length" "4")])
11151 (define_insn "*tls_ld_call_aix<TLSmode:tls_abi_suffix>"
11152 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11153 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
11154 (match_operand 2 "" "g")))
11155 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
11156 (clobber (reg:SI LR_REGNO))]
11157 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX && TARGET_TLS_MARKERS"
11158 "bl %z1(%&@tlsld)\;nop"
11159 [(set_attr "type" "branch")
11160 (set_attr "length" "8")])
11162 (define_insn "*tls_ld_call_sysv<TLSmode:tls_abi_suffix>"
11163 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11164 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
11165 (match_operand 2 "" "g")))
11166 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
11167 (clobber (reg:SI LR_REGNO))]
11168 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4 && TARGET_TLS_MARKERS"
11172 if (TARGET_SECURE_PLT && flag_pic == 2)
11173 return "bl %z1+32768(%&@tlsld)@plt";
11174 return "bl %z1(%&@tlsld)@plt";
11176 return "bl %z1(%&@tlsld)";
11178 [(set_attr "type" "branch")
11179 (set_attr "length" "4")])
11181 (define_insn "tls_dtprel_<TLSmode:tls_abi_suffix>"
11182 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11183 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11184 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11185 UNSPEC_TLSDTPREL))]
11187 "addi %0,%1,%2@dtprel")
11189 (define_insn "tls_dtprel_ha_<TLSmode:tls_abi_suffix>"
11190 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11191 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11192 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11193 UNSPEC_TLSDTPRELHA))]
11195 "addis %0,%1,%2@dtprel@ha")
11197 (define_insn "tls_dtprel_lo_<TLSmode:tls_abi_suffix>"
11198 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11199 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11200 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11201 UNSPEC_TLSDTPRELLO))]
11203 "addi %0,%1,%2@dtprel@l")
11205 (define_insn_and_split "tls_got_dtprel_<TLSmode:tls_abi_suffix>"
11206 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11207 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11208 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11209 UNSPEC_TLSGOTDTPREL))]
11211 "l<TLSmode:tls_insn_suffix> %0,%2@got@dtprel(%1)"
11212 "&& TARGET_CMODEL != CMODEL_SMALL"
11213 [(set (match_dup 3)
11215 (unspec:TLSmode [(match_dup 1) (match_dup 2)] UNSPEC_TLSGOTDTPREL)))
11217 (lo_sum:TLSmode (match_dup 3)
11218 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGOTDTPREL)))]
11221 operands[3] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
11223 [(set (attr "length")
11224 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
11228 (define_insn "*tls_got_dtprel_high<TLSmode:tls_abi_suffix>"
11229 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11231 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11232 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11233 UNSPEC_TLSGOTDTPREL)))]
11234 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
11235 "addis %0,%1,%2@got@dtprel@ha"
11236 [(set_attr "length" "4")])
11238 (define_insn "*tls_got_dtprel_low<TLSmode:tls_abi_suffix>"
11239 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11240 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11241 (unspec:TLSmode [(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11242 UNSPEC_TLSGOTDTPREL)))]
11243 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
11244 "l<TLSmode:tls_insn_suffix> %0,%2@got@dtprel@l(%1)"
11245 [(set_attr "length" "4")])
11247 (define_insn "tls_tprel_<TLSmode:tls_abi_suffix>"
11248 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11249 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11250 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11253 "addi %0,%1,%2@tprel")
11255 (define_insn "tls_tprel_ha_<TLSmode:tls_abi_suffix>"
11256 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11257 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11258 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11259 UNSPEC_TLSTPRELHA))]
11261 "addis %0,%1,%2@tprel@ha")
11263 (define_insn "tls_tprel_lo_<TLSmode:tls_abi_suffix>"
11264 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11265 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11266 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11267 UNSPEC_TLSTPRELLO))]
11269 "addi %0,%1,%2@tprel@l")
11271 ;; "b" output constraint here and on tls_tls input to support linker tls
11272 ;; optimization. The linker may edit the instructions emitted by a
11273 ;; tls_got_tprel/tls_tls pair to addis,addi.
11274 (define_insn_and_split "tls_got_tprel_<TLSmode:tls_abi_suffix>"
11275 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11276 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11277 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11278 UNSPEC_TLSGOTTPREL))]
11280 "l<TLSmode:tls_insn_suffix> %0,%2@got@tprel(%1)"
11281 "&& TARGET_CMODEL != CMODEL_SMALL"
11282 [(set (match_dup 3)
11284 (unspec:TLSmode [(match_dup 1) (match_dup 2)] UNSPEC_TLSGOTTPREL)))
11286 (lo_sum:TLSmode (match_dup 3)
11287 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGOTTPREL)))]
11290 operands[3] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
11292 [(set (attr "length")
11293 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
11297 (define_insn "*tls_got_tprel_high<TLSmode:tls_abi_suffix>"
11298 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11300 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11301 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11302 UNSPEC_TLSGOTTPREL)))]
11303 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
11304 "addis %0,%1,%2@got@tprel@ha"
11305 [(set_attr "length" "4")])
11307 (define_insn "*tls_got_tprel_low<TLSmode:tls_abi_suffix>"
11308 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11309 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11310 (unspec:TLSmode [(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11311 UNSPEC_TLSGOTTPREL)))]
11312 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
11313 "l<TLSmode:tls_insn_suffix> %0,%2@got@tprel@l(%1)"
11314 [(set_attr "length" "4")])
11316 (define_insn "tls_tls_<TLSmode:tls_abi_suffix>"
11317 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11318 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11319 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11321 "TARGET_ELF && HAVE_AS_TLS"
11322 "add %0,%1,%2@tls")
11324 (define_expand "tls_get_tpointer"
11325 [(set (match_operand:SI 0 "gpc_reg_operand" "")
11326 (unspec:SI [(const_int 0)] UNSPEC_TLSTLS))]
11327 "TARGET_XCOFF && HAVE_AS_TLS"
11330 emit_insn (gen_tls_get_tpointer_internal ());
11331 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
11335 (define_insn "tls_get_tpointer_internal"
11337 (unspec:SI [(const_int 0)] UNSPEC_TLSTLS))
11338 (clobber (reg:SI LR_REGNO))]
11339 "TARGET_XCOFF && HAVE_AS_TLS"
11340 "bla __get_tpointer")
11342 (define_expand "tls_get_addr<mode>"
11343 [(set (match_operand:P 0 "gpc_reg_operand" "")
11344 (unspec:P [(match_operand:P 1 "gpc_reg_operand" "")
11345 (match_operand:P 2 "gpc_reg_operand" "")] UNSPEC_TLSTLS))]
11346 "TARGET_XCOFF && HAVE_AS_TLS"
11349 emit_move_insn (gen_rtx_REG (Pmode, 3), operands[1]);
11350 emit_move_insn (gen_rtx_REG (Pmode, 4), operands[2]);
11351 emit_insn (gen_tls_get_addr_internal<mode> ());
11352 emit_move_insn (operands[0], gen_rtx_REG (Pmode, 3));
11356 (define_insn "tls_get_addr_internal<mode>"
11358 (unspec:P [(reg:P 3) (reg:P 4)] UNSPEC_TLSTLS))
11359 (clobber (reg:P 0))
11360 (clobber (reg:P 4))
11361 (clobber (reg:P 5))
11362 (clobber (reg:P 11))
11363 (clobber (reg:CC CR0_REGNO))
11364 (clobber (reg:P LR_REGNO))]
11365 "TARGET_XCOFF && HAVE_AS_TLS"
11366 "bla __tls_get_addr")
11368 ;; Next come insns related to the calling sequence.
11370 ;; First, an insn to allocate new stack space for dynamic use (e.g., alloca).
11371 ;; We move the back-chain and decrement the stack pointer.
11373 (define_expand "allocate_stack"
11374 [(set (match_operand 0 "gpc_reg_operand" "")
11375 (minus (reg 1) (match_operand 1 "reg_or_short_operand" "")))
11377 (minus (reg 1) (match_dup 1)))]
11380 { rtx chain = gen_reg_rtx (Pmode);
11381 rtx stack_bot = gen_rtx_MEM (Pmode, stack_pointer_rtx);
11383 rtx insn, par, set, mem;
11385 emit_move_insn (chain, stack_bot);
11387 /* Check stack bounds if necessary. */
11388 if (crtl->limit_stack)
11391 available = expand_binop (Pmode, sub_optab,
11392 stack_pointer_rtx, stack_limit_rtx,
11393 NULL_RTX, 1, OPTAB_WIDEN);
11394 emit_insn (gen_cond_trap (LTU, available, operands[1], const0_rtx));
11397 if (GET_CODE (operands[1]) != CONST_INT
11398 || INTVAL (operands[1]) < -32767
11399 || INTVAL (operands[1]) > 32768)
11401 neg_op0 = gen_reg_rtx (Pmode);
11403 emit_insn (gen_negsi2 (neg_op0, operands[1]));
11405 emit_insn (gen_negdi2 (neg_op0, operands[1]));
11408 neg_op0 = GEN_INT (- INTVAL (operands[1]));
11410 insn = emit_insn ((* ((TARGET_32BIT) ? gen_movsi_update_stack
11411 : gen_movdi_di_update_stack))
11412 (stack_pointer_rtx, stack_pointer_rtx, neg_op0,
11414 /* Since we didn't use gen_frame_mem to generate the MEM, grab
11415 it now and set the alias set/attributes. The above gen_*_update
11416 calls will generate a PARALLEL with the MEM set being the first
11418 par = PATTERN (insn);
11419 gcc_assert (GET_CODE (par) == PARALLEL);
11420 set = XVECEXP (par, 0, 0);
11421 gcc_assert (GET_CODE (set) == SET);
11422 mem = SET_DEST (set);
11423 gcc_assert (MEM_P (mem));
11424 MEM_NOTRAP_P (mem) = 1;
11425 set_mem_alias_set (mem, get_frame_alias_set ());
11427 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
11431 ;; These patterns say how to save and restore the stack pointer. We need not
11432 ;; save the stack pointer at function level since we are careful to
11433 ;; preserve the backchain. At block level, we have to restore the backchain
11434 ;; when we restore the stack pointer.
11436 ;; For nonlocal gotos, we must save both the stack pointer and its
11437 ;; backchain and restore both. Note that in the nonlocal case, the
11438 ;; save area is a memory location.
11440 (define_expand "save_stack_function"
11441 [(match_operand 0 "any_operand" "")
11442 (match_operand 1 "any_operand" "")]
11446 (define_expand "restore_stack_function"
11447 [(match_operand 0 "any_operand" "")
11448 (match_operand 1 "any_operand" "")]
11452 ;; Adjust stack pointer (op0) to a new value (op1).
11453 ;; First copy old stack backchain to new location, and ensure that the
11454 ;; scheduler won't reorder the sp assignment before the backchain write.
11455 (define_expand "restore_stack_block"
11456 [(set (match_dup 2) (match_dup 3))
11457 (set (match_dup 4) (match_dup 2))
11459 (set (match_operand 0 "register_operand" "")
11460 (match_operand 1 "register_operand" ""))]
11466 operands[1] = force_reg (Pmode, operands[1]);
11467 operands[2] = gen_reg_rtx (Pmode);
11468 operands[3] = gen_frame_mem (Pmode, operands[0]);
11469 operands[4] = gen_frame_mem (Pmode, operands[1]);
11470 p = rtvec_alloc (1);
11471 RTVEC_ELT (p, 0) = gen_rtx_SET (VOIDmode,
11472 gen_frame_mem (BLKmode, operands[0]),
11474 operands[5] = gen_rtx_PARALLEL (VOIDmode, p);
11477 (define_expand "save_stack_nonlocal"
11478 [(set (match_dup 3) (match_dup 4))
11479 (set (match_operand 0 "memory_operand" "") (match_dup 3))
11480 (set (match_dup 2) (match_operand 1 "register_operand" ""))]
11484 int units_per_word = (TARGET_32BIT) ? 4 : 8;
11486 /* Copy the backchain to the first word, sp to the second. */
11487 operands[0] = adjust_address_nv (operands[0], Pmode, 0);
11488 operands[2] = adjust_address_nv (operands[0], Pmode, units_per_word);
11489 operands[3] = gen_reg_rtx (Pmode);
11490 operands[4] = gen_frame_mem (Pmode, operands[1]);
11493 (define_expand "restore_stack_nonlocal"
11494 [(set (match_dup 2) (match_operand 1 "memory_operand" ""))
11495 (set (match_dup 3) (match_dup 4))
11496 (set (match_dup 5) (match_dup 2))
11498 (set (match_operand 0 "register_operand" "") (match_dup 3))]
11502 int units_per_word = (TARGET_32BIT) ? 4 : 8;
11505 /* Restore the backchain from the first word, sp from the second. */
11506 operands[2] = gen_reg_rtx (Pmode);
11507 operands[3] = gen_reg_rtx (Pmode);
11508 operands[1] = adjust_address_nv (operands[1], Pmode, 0);
11509 operands[4] = adjust_address_nv (operands[1], Pmode, units_per_word);
11510 operands[5] = gen_frame_mem (Pmode, operands[3]);
11511 p = rtvec_alloc (1);
11512 RTVEC_ELT (p, 0) = gen_rtx_SET (VOIDmode,
11513 gen_frame_mem (BLKmode, operands[0]),
11515 operands[6] = gen_rtx_PARALLEL (VOIDmode, p);
11518 ;; TOC register handling.
11520 ;; Code to initialize the TOC register...
11522 (define_insn "load_toc_aix_si"
11523 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11524 (unspec:SI [(const_int 0)] UNSPEC_TOC))
11525 (use (reg:SI 2))])]
11526 "DEFAULT_ABI == ABI_AIX && TARGET_32BIT"
11530 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
11531 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
11532 operands[2] = gen_rtx_REG (Pmode, 2);
11533 return \"lwz %0,%1(%2)\";
11535 [(set_attr "type" "load")])
11537 (define_insn "load_toc_aix_di"
11538 [(parallel [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11539 (unspec:DI [(const_int 0)] UNSPEC_TOC))
11540 (use (reg:DI 2))])]
11541 "DEFAULT_ABI == ABI_AIX && TARGET_64BIT"
11545 #ifdef TARGET_RELOCATABLE
11546 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\",
11547 !TARGET_MINIMAL_TOC || TARGET_RELOCATABLE);
11549 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
11552 strcat (buf, \"@toc\");
11553 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
11554 operands[2] = gen_rtx_REG (Pmode, 2);
11555 return \"ld %0,%1(%2)\";
11557 [(set_attr "type" "load")])
11559 (define_insn "load_toc_v4_pic_si"
11560 [(set (reg:SI LR_REGNO)
11561 (unspec:SI [(const_int 0)] UNSPEC_TOC))]
11562 "DEFAULT_ABI == ABI_V4 && flag_pic == 1 && TARGET_32BIT"
11563 "bl _GLOBAL_OFFSET_TABLE_@local-4"
11564 [(set_attr "type" "branch")
11565 (set_attr "length" "4")])
11567 (define_expand "load_toc_v4_PIC_1"
11568 [(parallel [(set (reg:SI LR_REGNO)
11569 (match_operand:SI 0 "immediate_operand" "s"))
11570 (use (unspec [(match_dup 0)] UNSPEC_TOC))])]
11571 "TARGET_ELF && DEFAULT_ABI != ABI_AIX
11572 && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
11575 (define_insn "load_toc_v4_PIC_1_normal"
11576 [(set (reg:SI LR_REGNO)
11577 (match_operand:SI 0 "immediate_operand" "s"))
11578 (use (unspec [(match_dup 0)] UNSPEC_TOC))]
11579 "!TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI != ABI_AIX
11580 && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
11581 "bcl 20,31,%0\\n%0:"
11582 [(set_attr "type" "branch")
11583 (set_attr "length" "4")])
11585 (define_insn "load_toc_v4_PIC_1_476"
11586 [(set (reg:SI LR_REGNO)
11587 (match_operand:SI 0 "immediate_operand" "s"))
11588 (use (unspec [(match_dup 0)] UNSPEC_TOC))]
11589 "TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI != ABI_AIX
11590 && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
11594 static char templ[32];
11596 get_ppc476_thunk_name (name);
11597 sprintf (templ, \"bl %s\\n%%0:\", name);
11600 [(set_attr "type" "branch")
11601 (set_attr "length" "4")])
11603 (define_expand "load_toc_v4_PIC_1b"
11604 [(parallel [(set (reg:SI LR_REGNO)
11605 (unspec:SI [(match_operand:SI 0 "immediate_operand" "s")
11606 (label_ref (match_operand 1 "" ""))]
11609 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
11612 (define_insn "load_toc_v4_PIC_1b_normal"
11613 [(set (reg:SI LR_REGNO)
11614 (unspec:SI [(match_operand:SI 0 "immediate_operand" "s")
11615 (label_ref (match_operand 1 "" ""))]
11618 "!TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
11619 "bcl 20,31,$+8\;.long %0-$"
11620 [(set_attr "type" "branch")
11621 (set_attr "length" "8")])
11623 (define_insn "load_toc_v4_PIC_1b_476"
11624 [(set (reg:SI LR_REGNO)
11625 (unspec:SI [(match_operand:SI 0 "immediate_operand" "s")
11626 (label_ref (match_operand 1 "" ""))]
11629 "TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
11633 static char templ[32];
11635 get_ppc476_thunk_name (name);
11636 sprintf (templ, \"bl %s\\n\\tb $+8\\n\\t.long %%0-$\", name);
11639 [(set_attr "type" "branch")
11640 (set_attr "length" "16")])
11642 (define_insn "load_toc_v4_PIC_2"
11643 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11644 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
11645 (minus:SI (match_operand:SI 2 "immediate_operand" "s")
11646 (match_operand:SI 3 "immediate_operand" "s")))))]
11647 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
11649 [(set_attr "type" "load")])
11651 (define_insn "load_toc_v4_PIC_3b"
11652 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11653 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
11655 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
11656 (match_operand:SI 3 "symbol_ref_operand" "s")))))]
11657 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
11658 "addis %0,%1,%2-%3@ha")
11660 (define_insn "load_toc_v4_PIC_3c"
11661 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11662 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
11663 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
11664 (match_operand:SI 3 "symbol_ref_operand" "s"))))]
11665 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
11666 "addi %0,%1,%2-%3@l")
11668 ;; If the TOC is shared over a translation unit, as happens with all
11669 ;; the kinds of PIC that we support, we need to restore the TOC
11670 ;; pointer only when jumping over units of translation.
11671 ;; On Darwin, we need to reload the picbase.
11673 (define_expand "builtin_setjmp_receiver"
11674 [(use (label_ref (match_operand 0 "" "")))]
11675 "(DEFAULT_ABI == ABI_V4 && flag_pic == 1)
11676 || (TARGET_TOC && TARGET_MINIMAL_TOC)
11677 || (DEFAULT_ABI == ABI_DARWIN && flag_pic)"
11681 if (DEFAULT_ABI == ABI_DARWIN)
11683 rtx picrtx = gen_rtx_SYMBOL_REF (Pmode, MACHOPIC_FUNCTION_BASE_NAME);
11684 rtx picreg = gen_rtx_REG (Pmode, RS6000_PIC_OFFSET_TABLE_REGNUM);
11688 crtl->uses_pic_offset_table = 1;
11689 ASM_GENERATE_INTERNAL_LABEL(tmplab, \"LSJR\",
11690 CODE_LABEL_NUMBER (operands[0]));
11691 tmplabrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (tmplab));
11693 emit_insn (gen_load_macho_picbase (tmplabrtx));
11694 emit_move_insn (picreg, gen_rtx_REG (Pmode, LR_REGNO));
11695 emit_insn (gen_macho_correct_pic (picreg, picreg, picrtx, tmplabrtx));
11699 rs6000_emit_load_toc_table (FALSE);
11703 ;; Largetoc support
11704 (define_insn "*largetoc_high"
11705 [(set (match_operand:DI 0 "gpc_reg_operand" "=b*r")
11707 (unspec [(match_operand:DI 1 "" "")
11708 (match_operand:DI 2 "gpc_reg_operand" "b")]
11710 "TARGET_ELF && TARGET_CMODEL != CMODEL_SMALL"
11711 "addis %0,%2,%1@toc@ha")
11713 (define_insn "*largetoc_high_aix<mode>"
11714 [(set (match_operand:P 0 "gpc_reg_operand" "=b*r")
11716 (unspec [(match_operand:P 1 "" "")
11717 (match_operand:P 2 "gpc_reg_operand" "b")]
11719 "TARGET_XCOFF && TARGET_CMODEL != CMODEL_SMALL"
11720 "addis %0,%1@u(%2)")
11722 (define_insn "*largetoc_high_plus"
11723 [(set (match_operand:DI 0 "gpc_reg_operand" "=b*r")
11726 (unspec [(match_operand:DI 1 "" "")
11727 (match_operand:DI 2 "gpc_reg_operand" "b")]
11729 (match_operand 3 "const_int_operand" "n"))))]
11730 "TARGET_ELF && TARGET_CMODEL != CMODEL_SMALL"
11731 "addis %0,%2,%1+%3@toc@ha")
11733 (define_insn "*largetoc_high_plus_aix<mode>"
11734 [(set (match_operand:P 0 "gpc_reg_operand" "=b*r")
11737 (unspec [(match_operand:P 1 "" "")
11738 (match_operand:P 2 "gpc_reg_operand" "b")]
11740 (match_operand 3 "const_int_operand" "n"))))]
11741 "TARGET_XCOFF && TARGET_CMODEL != CMODEL_SMALL"
11742 "addis %0,%1+%3@u(%2)")
11744 (define_insn "*largetoc_low"
11745 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
11746 (lo_sum:DI (match_operand:DI 1 "gpc_reg_operand" "b,!*r")
11747 (match_operand:DI 2 "" "")))]
11748 "TARGET_ELF && TARGET_CMODEL != CMODEL_SMALL"
11753 (define_insn "*largetoc_low_aix<mode>"
11754 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
11755 (lo_sum:P (match_operand:P 1 "gpc_reg_operand" "b")
11756 (match_operand:P 2 "" "")))]
11757 "TARGET_XCOFF && TARGET_CMODEL != CMODEL_SMALL"
11760 (define_insn_and_split "*tocref<mode>"
11761 [(set (match_operand:P 0 "gpc_reg_operand" "=b*r")
11762 (match_operand:P 1 "small_toc_ref" "R"))]
11765 "&& TARGET_CMODEL != CMODEL_SMALL && reload_completed"
11766 [(set (match_dup 0) (high:P (match_dup 1)))
11767 (set (match_dup 0) (lo_sum:P (match_dup 0) (match_dup 1)))])
11769 ;; Elf specific ways of loading addresses for non-PIC code.
11770 ;; The output of this could be r0, but we make a very strong
11771 ;; preference for a base register because it will usually
11772 ;; be needed there.
11773 (define_insn "elf_high"
11774 [(set (match_operand:SI 0 "gpc_reg_operand" "=b*r")
11775 (high:SI (match_operand 1 "" "")))]
11776 "TARGET_ELF && ! TARGET_64BIT"
11779 (define_insn "elf_low"
11780 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11781 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,!*r")
11782 (match_operand 2 "" "")))]
11783 "TARGET_ELF && ! TARGET_64BIT"
11788 ;; Call and call_value insns
11789 (define_expand "call"
11790 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
11791 (match_operand 1 "" ""))
11792 (use (match_operand 2 "" ""))
11793 (clobber (reg:SI LR_REGNO))])]
11798 if (MACHOPIC_INDIRECT)
11799 operands[0] = machopic_indirect_call_target (operands[0]);
11802 gcc_assert (GET_CODE (operands[0]) == MEM);
11803 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
11805 operands[0] = XEXP (operands[0], 0);
11807 if (GET_CODE (operands[0]) != SYMBOL_REF
11808 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[0]))
11809 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[2]) & CALL_LONG) != 0))
11811 if (INTVAL (operands[2]) & CALL_LONG)
11812 operands[0] = rs6000_longcall_ref (operands[0]);
11814 switch (DEFAULT_ABI)
11818 operands[0] = force_reg (Pmode, operands[0]);
11822 /* AIX function pointers are really pointers to a three word
11824 rs6000_call_indirect_aix (NULL_RTX, operands[0], operands[1]);
11828 gcc_unreachable ();
11833 (define_expand "call_value"
11834 [(parallel [(set (match_operand 0 "" "")
11835 (call (mem:SI (match_operand 1 "address_operand" ""))
11836 (match_operand 2 "" "")))
11837 (use (match_operand 3 "" ""))
11838 (clobber (reg:SI LR_REGNO))])]
11843 if (MACHOPIC_INDIRECT)
11844 operands[1] = machopic_indirect_call_target (operands[1]);
11847 gcc_assert (GET_CODE (operands[1]) == MEM);
11848 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
11850 operands[1] = XEXP (operands[1], 0);
11852 if (GET_CODE (operands[1]) != SYMBOL_REF
11853 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[1]))
11854 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[3]) & CALL_LONG) != 0))
11856 if (INTVAL (operands[3]) & CALL_LONG)
11857 operands[1] = rs6000_longcall_ref (operands[1]);
11859 switch (DEFAULT_ABI)
11863 operands[1] = force_reg (Pmode, operands[1]);
11867 /* AIX function pointers are really pointers to a three word
11869 rs6000_call_indirect_aix (operands[0], operands[1], operands[2]);
11873 gcc_unreachable ();
11878 ;; Call to function in current module. No TOC pointer reload needed.
11879 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
11880 ;; either the function was not prototyped, or it was prototyped as a
11881 ;; variable argument function. It is > 0 if FP registers were passed
11882 ;; and < 0 if they were not.
11884 (define_insn "*call_local32"
11885 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
11886 (match_operand 1 "" "g,g"))
11887 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11888 (clobber (reg:SI LR_REGNO))]
11889 "(INTVAL (operands[2]) & CALL_LONG) == 0"
11892 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11893 output_asm_insn (\"crxor 6,6,6\", operands);
11895 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11896 output_asm_insn (\"creqv 6,6,6\", operands);
11898 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
11900 [(set_attr "type" "branch")
11901 (set_attr "length" "4,8")])
11903 (define_insn "*call_local64"
11904 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
11905 (match_operand 1 "" "g,g"))
11906 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11907 (clobber (reg:SI LR_REGNO))]
11908 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
11911 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11912 output_asm_insn (\"crxor 6,6,6\", operands);
11914 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11915 output_asm_insn (\"creqv 6,6,6\", operands);
11917 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
11919 [(set_attr "type" "branch")
11920 (set_attr "length" "4,8")])
11922 (define_insn "*call_value_local32"
11923 [(set (match_operand 0 "" "")
11924 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
11925 (match_operand 2 "" "g,g")))
11926 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11927 (clobber (reg:SI LR_REGNO))]
11928 "(INTVAL (operands[3]) & CALL_LONG) == 0"
11931 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11932 output_asm_insn (\"crxor 6,6,6\", operands);
11934 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11935 output_asm_insn (\"creqv 6,6,6\", operands);
11937 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
11939 [(set_attr "type" "branch")
11940 (set_attr "length" "4,8")])
11943 (define_insn "*call_value_local64"
11944 [(set (match_operand 0 "" "")
11945 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
11946 (match_operand 2 "" "g,g")))
11947 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11948 (clobber (reg:SI LR_REGNO))]
11949 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
11952 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11953 output_asm_insn (\"crxor 6,6,6\", operands);
11955 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11956 output_asm_insn (\"creqv 6,6,6\", operands);
11958 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
11960 [(set_attr "type" "branch")
11961 (set_attr "length" "4,8")])
11963 ;; Call to indirect functions with the AIX abi using a 3 word descriptor.
11964 ;; Operand0 is the addresss of the function to call
11965 ;; Operand1 is the flag for System V.4 for unprototyped or FP registers
11966 ;; Operand2 is the location in the function descriptor to load r2 from
11967 ;; Operand3 is the stack location to hold the current TOC pointer
11969 (define_insn "call_indirect_aix<ptrsize>"
11970 [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l"))
11971 (match_operand 1 "" "g,g"))
11972 (use (match_operand:P 2 "memory_operand" "<ptrm>,<ptrm>"))
11973 (set (reg:P TOC_REGNUM) (match_operand:P 3 "memory_operand" "<ptrm>,<ptrm>"))
11974 (use (reg:P STATIC_CHAIN_REGNUM))
11975 (clobber (reg:P LR_REGNO))]
11976 "DEFAULT_ABI == ABI_AIX && TARGET_POINTERS_TO_NESTED_FUNCTIONS"
11977 "<ptrload> 2,%2\;b%T0l\;<ptrload> 2,%3"
11978 [(set_attr "type" "jmpreg")
11979 (set_attr "length" "12")])
11981 ;; Like call_indirect_aix<ptrsize>, but no use of the static chain
11982 ;; Operand0 is the addresss of the function to call
11983 ;; Operand1 is the flag for System V.4 for unprototyped or FP registers
11984 ;; Operand2 is the location in the function descriptor to load r2 from
11985 ;; Operand3 is the stack location to hold the current TOC pointer
11987 (define_insn "call_indirect_aix<ptrsize>_nor11"
11988 [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l"))
11989 (match_operand 1 "" "g,g"))
11990 (use (match_operand:P 2 "memory_operand" "<ptrm>,<ptrm>"))
11991 (set (reg:P TOC_REGNUM) (match_operand:P 3 "memory_operand" "<ptrm>,<ptrm>"))
11992 (clobber (reg:P LR_REGNO))]
11993 "DEFAULT_ABI == ABI_AIX && !TARGET_POINTERS_TO_NESTED_FUNCTIONS"
11994 "<ptrload> 2,%2\;b%T0l\;<ptrload> 2,%3"
11995 [(set_attr "type" "jmpreg")
11996 (set_attr "length" "12")])
11998 ;; Operand0 is the return result of the function
11999 ;; Operand1 is the addresss of the function to call
12000 ;; Operand2 is the flag for System V.4 for unprototyped or FP registers
12001 ;; Operand3 is the location in the function descriptor to load r2 from
12002 ;; Operand4 is the stack location to hold the current TOC pointer
12004 (define_insn "call_value_indirect_aix<ptrsize>"
12005 [(set (match_operand 0 "" "")
12006 (call (mem:SI (match_operand:P 1 "register_operand" "c,*l"))
12007 (match_operand 2 "" "g,g")))
12008 (use (match_operand:P 3 "memory_operand" "<ptrm>,<ptrm>"))
12009 (set (reg:P TOC_REGNUM) (match_operand:P 4 "memory_operand" "<ptrm>,<ptrm>"))
12010 (use (reg:P STATIC_CHAIN_REGNUM))
12011 (clobber (reg:P LR_REGNO))]
12012 "DEFAULT_ABI == ABI_AIX && TARGET_POINTERS_TO_NESTED_FUNCTIONS"
12013 "<ptrload> 2,%3\;b%T1l\;<ptrload> 2,%4"
12014 [(set_attr "type" "jmpreg")
12015 (set_attr "length" "12")])
12017 ;; Like call_value_indirect_aix<ptrsize>, but no use of the static chain
12018 ;; Operand0 is the return result of the function
12019 ;; Operand1 is the addresss of the function to call
12020 ;; Operand2 is the flag for System V.4 for unprototyped or FP registers
12021 ;; Operand3 is the location in the function descriptor to load r2 from
12022 ;; Operand4 is the stack location to hold the current TOC pointer
12024 (define_insn "call_value_indirect_aix<ptrsize>_nor11"
12025 [(set (match_operand 0 "" "")
12026 (call (mem:SI (match_operand:P 1 "register_operand" "c,*l"))
12027 (match_operand 2 "" "g,g")))
12028 (use (match_operand:P 3 "memory_operand" "<ptrm>,<ptrm>"))
12029 (set (reg:P TOC_REGNUM) (match_operand:P 4 "memory_operand" "<ptrm>,<ptrm>"))
12030 (clobber (reg:P LR_REGNO))]
12031 "DEFAULT_ABI == ABI_AIX && !TARGET_POINTERS_TO_NESTED_FUNCTIONS"
12032 "<ptrload> 2,%3\;b%T1l\;<ptrload> 2,%4"
12033 [(set_attr "type" "jmpreg")
12034 (set_attr "length" "12")])
12036 ;; Call to function which may be in another module. Restore the TOC
12037 ;; pointer (r2) after the call unless this is System V.
12038 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
12039 ;; either the function was not prototyped, or it was prototyped as a
12040 ;; variable argument function. It is > 0 if FP registers were passed
12041 ;; and < 0 if they were not.
12043 (define_insn "*call_nonlocal_aix32"
12044 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
12045 (match_operand 1 "" "g"))
12046 (use (match_operand:SI 2 "immediate_operand" "O"))
12047 (clobber (reg:SI LR_REGNO))]
12049 && DEFAULT_ABI == ABI_AIX
12050 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12052 [(set_attr "type" "branch")
12053 (set_attr "length" "8")])
12055 (define_insn "*call_nonlocal_aix64"
12056 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
12057 (match_operand 1 "" "g"))
12058 (use (match_operand:SI 2 "immediate_operand" "O"))
12059 (clobber (reg:SI LR_REGNO))]
12061 && DEFAULT_ABI == ABI_AIX
12062 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12064 [(set_attr "type" "branch")
12065 (set_attr "length" "8")])
12067 (define_insn "*call_value_nonlocal_aix32"
12068 [(set (match_operand 0 "" "")
12069 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
12070 (match_operand 2 "" "g")))
12071 (use (match_operand:SI 3 "immediate_operand" "O"))
12072 (clobber (reg:SI LR_REGNO))]
12074 && DEFAULT_ABI == ABI_AIX
12075 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12077 [(set_attr "type" "branch")
12078 (set_attr "length" "8")])
12080 (define_insn "*call_value_nonlocal_aix64"
12081 [(set (match_operand 0 "" "")
12082 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
12083 (match_operand 2 "" "g")))
12084 (use (match_operand:SI 3 "immediate_operand" "O"))
12085 (clobber (reg:SI LR_REGNO))]
12087 && DEFAULT_ABI == ABI_AIX
12088 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12090 [(set_attr "type" "branch")
12091 (set_attr "length" "8")])
12093 ;; A function pointer under System V is just a normal pointer
12094 ;; operands[0] is the function pointer
12095 ;; operands[1] is the stack size to clean up
12096 ;; operands[2] is the value FUNCTION_ARG returns for the VOID argument
12097 ;; which indicates how to set cr1
12099 (define_insn "*call_indirect_nonlocal_sysv<mode>"
12100 [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l,c,*l"))
12101 (match_operand 1 "" "g,g,g,g"))
12102 (use (match_operand:SI 2 "immediate_operand" "O,O,n,n"))
12103 (clobber (reg:SI LR_REGNO))]
12104 "DEFAULT_ABI == ABI_V4
12105 || DEFAULT_ABI == ABI_DARWIN"
12107 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12108 output_asm_insn ("crxor 6,6,6", operands);
12110 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12111 output_asm_insn ("creqv 6,6,6", operands);
12115 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
12116 (set_attr "length" "4,4,8,8")])
12118 (define_insn_and_split "*call_nonlocal_sysv<mode>"
12119 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
12120 (match_operand 1 "" "g,g"))
12121 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12122 (clobber (reg:SI LR_REGNO))]
12123 "(DEFAULT_ABI == ABI_DARWIN
12124 || (DEFAULT_ABI == ABI_V4
12125 && (INTVAL (operands[2]) & CALL_LONG) == 0))"
12127 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12128 output_asm_insn ("crxor 6,6,6", operands);
12130 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12131 output_asm_insn ("creqv 6,6,6", operands);
12134 return output_call(insn, operands, 0, 2);
12136 if (DEFAULT_ABI == ABI_V4 && flag_pic)
12138 gcc_assert (!TARGET_SECURE_PLT);
12139 return "bl %z0@plt";
12145 "DEFAULT_ABI == ABI_V4
12146 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[0])
12147 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12148 [(parallel [(call (mem:SI (match_dup 0))
12150 (use (match_dup 2))
12151 (use (match_dup 3))
12152 (clobber (reg:SI LR_REGNO))])]
12154 operands[3] = pic_offset_table_rtx;
12156 [(set_attr "type" "branch,branch")
12157 (set_attr "length" "4,8")])
12159 (define_insn "*call_nonlocal_sysv_secure<mode>"
12160 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
12161 (match_operand 1 "" "g,g"))
12162 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12163 (use (match_operand:SI 3 "register_operand" "r,r"))
12164 (clobber (reg:SI LR_REGNO))]
12165 "(DEFAULT_ABI == ABI_V4
12166 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[0])
12167 && (INTVAL (operands[2]) & CALL_LONG) == 0)"
12169 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12170 output_asm_insn ("crxor 6,6,6", operands);
12172 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12173 output_asm_insn ("creqv 6,6,6", operands);
12176 /* The magic 32768 offset here and in the other sysv call insns
12177 corresponds to the offset of r30 in .got2, as given by LCTOC1.
12178 See sysv4.h:toc_section. */
12179 return "bl %z0+32768@plt";
12181 return "bl %z0@plt";
12183 [(set_attr "type" "branch,branch")
12184 (set_attr "length" "4,8")])
12186 (define_insn "*call_value_indirect_nonlocal_sysv<mode>"
12187 [(set (match_operand 0 "" "")
12188 (call (mem:SI (match_operand:P 1 "register_operand" "c,*l,c,*l"))
12189 (match_operand 2 "" "g,g,g,g")))
12190 (use (match_operand:SI 3 "immediate_operand" "O,O,n,n"))
12191 (clobber (reg:SI LR_REGNO))]
12192 "DEFAULT_ABI == ABI_V4
12193 || DEFAULT_ABI == ABI_DARWIN"
12195 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12196 output_asm_insn ("crxor 6,6,6", operands);
12198 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12199 output_asm_insn ("creqv 6,6,6", operands);
12203 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
12204 (set_attr "length" "4,4,8,8")])
12206 (define_insn_and_split "*call_value_nonlocal_sysv<mode>"
12207 [(set (match_operand 0 "" "")
12208 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
12209 (match_operand 2 "" "g,g")))
12210 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12211 (clobber (reg:SI LR_REGNO))]
12212 "(DEFAULT_ABI == ABI_DARWIN
12213 || (DEFAULT_ABI == ABI_V4
12214 && (INTVAL (operands[3]) & CALL_LONG) == 0))"
12216 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12217 output_asm_insn ("crxor 6,6,6", operands);
12219 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12220 output_asm_insn ("creqv 6,6,6", operands);
12223 return output_call(insn, operands, 1, 3);
12225 if (DEFAULT_ABI == ABI_V4 && flag_pic)
12227 gcc_assert (!TARGET_SECURE_PLT);
12228 return "bl %z1@plt";
12234 "DEFAULT_ABI == ABI_V4
12235 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[1])
12236 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12237 [(parallel [(set (match_dup 0)
12238 (call (mem:SI (match_dup 1))
12240 (use (match_dup 3))
12241 (use (match_dup 4))
12242 (clobber (reg:SI LR_REGNO))])]
12244 operands[4] = pic_offset_table_rtx;
12246 [(set_attr "type" "branch,branch")
12247 (set_attr "length" "4,8")])
12249 (define_insn "*call_value_nonlocal_sysv_secure<mode>"
12250 [(set (match_operand 0 "" "")
12251 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
12252 (match_operand 2 "" "g,g")))
12253 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12254 (use (match_operand:SI 4 "register_operand" "r,r"))
12255 (clobber (reg:SI LR_REGNO))]
12256 "(DEFAULT_ABI == ABI_V4
12257 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[1])
12258 && (INTVAL (operands[3]) & CALL_LONG) == 0)"
12260 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12261 output_asm_insn ("crxor 6,6,6", operands);
12263 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12264 output_asm_insn ("creqv 6,6,6", operands);
12267 return "bl %z1+32768@plt";
12269 return "bl %z1@plt";
12271 [(set_attr "type" "branch,branch")
12272 (set_attr "length" "4,8")])
12274 ;; Call subroutine returning any type.
12275 (define_expand "untyped_call"
12276 [(parallel [(call (match_operand 0 "" "")
12278 (match_operand 1 "" "")
12279 (match_operand 2 "" "")])]
12285 emit_call_insn (GEN_CALL (operands[0], const0_rtx, const0_rtx, const0_rtx));
12287 for (i = 0; i < XVECLEN (operands[2], 0); i++)
12289 rtx set = XVECEXP (operands[2], 0, i);
12290 emit_move_insn (SET_DEST (set), SET_SRC (set));
12293 /* The optimizer does not know that the call sets the function value
12294 registers we stored in the result block. We avoid problems by
12295 claiming that all hard registers are used and clobbered at this
12297 emit_insn (gen_blockage ());
12302 ;; sibling call patterns
12303 (define_expand "sibcall"
12304 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
12305 (match_operand 1 "" ""))
12306 (use (match_operand 2 "" ""))
12307 (use (reg:SI LR_REGNO))
12313 if (MACHOPIC_INDIRECT)
12314 operands[0] = machopic_indirect_call_target (operands[0]);
12317 gcc_assert (GET_CODE (operands[0]) == MEM);
12318 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
12320 operands[0] = XEXP (operands[0], 0);
12323 ;; this and similar patterns must be marked as using LR, otherwise
12324 ;; dataflow will try to delete the store into it. This is true
12325 ;; even when the actual reg to jump to is in CTR, when LR was
12326 ;; saved and restored around the PIC-setting BCL.
12327 (define_insn "*sibcall_local32"
12328 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
12329 (match_operand 1 "" "g,g"))
12330 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12331 (use (reg:SI LR_REGNO))
12333 "(INTVAL (operands[2]) & CALL_LONG) == 0"
12336 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12337 output_asm_insn (\"crxor 6,6,6\", operands);
12339 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12340 output_asm_insn (\"creqv 6,6,6\", operands);
12342 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
12344 [(set_attr "type" "branch")
12345 (set_attr "length" "4,8")])
12347 (define_insn "*sibcall_local64"
12348 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
12349 (match_operand 1 "" "g,g"))
12350 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12351 (use (reg:SI LR_REGNO))
12353 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
12356 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12357 output_asm_insn (\"crxor 6,6,6\", operands);
12359 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12360 output_asm_insn (\"creqv 6,6,6\", operands);
12362 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
12364 [(set_attr "type" "branch")
12365 (set_attr "length" "4,8")])
12367 (define_insn "*sibcall_value_local32"
12368 [(set (match_operand 0 "" "")
12369 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
12370 (match_operand 2 "" "g,g")))
12371 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12372 (use (reg:SI LR_REGNO))
12374 "(INTVAL (operands[3]) & CALL_LONG) == 0"
12377 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12378 output_asm_insn (\"crxor 6,6,6\", operands);
12380 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12381 output_asm_insn (\"creqv 6,6,6\", operands);
12383 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
12385 [(set_attr "type" "branch")
12386 (set_attr "length" "4,8")])
12389 (define_insn "*sibcall_value_local64"
12390 [(set (match_operand 0 "" "")
12391 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
12392 (match_operand 2 "" "g,g")))
12393 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12394 (use (reg:SI LR_REGNO))
12396 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
12399 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12400 output_asm_insn (\"crxor 6,6,6\", operands);
12402 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12403 output_asm_insn (\"creqv 6,6,6\", operands);
12405 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
12407 [(set_attr "type" "branch")
12408 (set_attr "length" "4,8")])
12410 (define_insn "*sibcall_nonlocal_aix<mode>"
12411 [(call (mem:SI (match_operand:P 0 "call_operand" "s,c"))
12412 (match_operand 1 "" "g,g"))
12413 (use (match_operand:SI 2 "immediate_operand" "O,O"))
12414 (use (reg:SI LR_REGNO))
12416 "DEFAULT_ABI == ABI_AIX
12417 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12421 [(set_attr "type" "branch")
12422 (set_attr "length" "4")])
12424 (define_insn "*sibcall_value_nonlocal_aix<mode>"
12425 [(set (match_operand 0 "" "")
12426 (call (mem:SI (match_operand:P 1 "call_operand" "s,c"))
12427 (match_operand 2 "" "g,g")))
12428 (use (match_operand:SI 3 "immediate_operand" "O,O"))
12429 (use (reg:SI LR_REGNO))
12431 "DEFAULT_ABI == ABI_AIX
12432 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12436 [(set_attr "type" "branch")
12437 (set_attr "length" "4")])
12439 (define_insn "*sibcall_nonlocal_sysv<mode>"
12440 [(call (mem:SI (match_operand:P 0 "call_operand" "s,s,c,c"))
12441 (match_operand 1 "" ""))
12442 (use (match_operand 2 "immediate_operand" "O,n,O,n"))
12443 (use (reg:SI LR_REGNO))
12445 "(DEFAULT_ABI == ABI_DARWIN
12446 || DEFAULT_ABI == ABI_V4)
12447 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12450 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12451 output_asm_insn (\"crxor 6,6,6\", operands);
12453 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12454 output_asm_insn (\"creqv 6,6,6\", operands);
12456 if (which_alternative >= 2)
12458 else if (DEFAULT_ABI == ABI_V4 && flag_pic)
12460 gcc_assert (!TARGET_SECURE_PLT);
12461 return \"b %z0@plt\";
12466 [(set_attr "type" "branch")
12467 (set_attr "length" "4,8,4,8")])
12469 (define_expand "sibcall_value"
12470 [(parallel [(set (match_operand 0 "register_operand" "")
12471 (call (mem:SI (match_operand 1 "address_operand" ""))
12472 (match_operand 2 "" "")))
12473 (use (match_operand 3 "" ""))
12474 (use (reg:SI LR_REGNO))
12480 if (MACHOPIC_INDIRECT)
12481 operands[1] = machopic_indirect_call_target (operands[1]);
12484 gcc_assert (GET_CODE (operands[1]) == MEM);
12485 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
12487 operands[1] = XEXP (operands[1], 0);
12490 (define_insn "*sibcall_value_nonlocal_sysv<mode>"
12491 [(set (match_operand 0 "" "")
12492 (call (mem:SI (match_operand:P 1 "call_operand" "s,s,c,c"))
12493 (match_operand 2 "" "")))
12494 (use (match_operand:SI 3 "immediate_operand" "O,n,O,n"))
12495 (use (reg:SI LR_REGNO))
12497 "(DEFAULT_ABI == ABI_DARWIN
12498 || DEFAULT_ABI == ABI_V4)
12499 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12502 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12503 output_asm_insn (\"crxor 6,6,6\", operands);
12505 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12506 output_asm_insn (\"creqv 6,6,6\", operands);
12508 if (which_alternative >= 2)
12510 else if (DEFAULT_ABI == ABI_V4 && flag_pic)
12512 gcc_assert (!TARGET_SECURE_PLT);
12513 return \"b %z1@plt\";
12518 [(set_attr "type" "branch")
12519 (set_attr "length" "4,8,4,8")])
12521 (define_expand "sibcall_epilogue"
12522 [(use (const_int 0))]
12525 if (!TARGET_SCHED_PROLOG)
12526 emit_insn (gen_blockage ());
12527 rs6000_emit_epilogue (TRUE);
12531 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
12532 ;; all of memory. This blocks insns from being moved across this point.
12534 (define_insn "blockage"
12535 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCK)]
12539 (define_expand "probe_stack"
12540 [(set (match_operand 0 "memory_operand" "=m")
12541 (unspec [(const_int 0)] UNSPEC_PROBE_STACK))]
12545 emit_insn (gen_probe_stack_di (operands[0]));
12547 emit_insn (gen_probe_stack_si (operands[0]));
12551 (define_insn "probe_stack_<mode>"
12552 [(set (match_operand:P 0 "memory_operand" "=m")
12553 (unspec:P [(const_int 0)] UNSPEC_PROBE_STACK))]
12556 operands[1] = gen_rtx_REG (Pmode, 0);
12557 return "st<wd>%U0%X0 %1,%0";
12559 [(set (attr "type")
12561 (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
12562 (const_string "store_ux")
12564 (match_test "update_address_mem (operands[0], VOIDmode)")
12565 (const_string "store_u")
12566 (const_string "store"))))
12567 (set_attr "length" "4")])
12569 (define_insn "probe_stack_range<P:mode>"
12570 [(set (match_operand:P 0 "register_operand" "=r")
12571 (unspec_volatile:P [(match_operand:P 1 "register_operand" "0")
12572 (match_operand:P 2 "register_operand" "r")]
12573 UNSPECV_PROBE_STACK_RANGE))]
12575 "* return output_probe_stack_range (operands[0], operands[2]);"
12576 [(set_attr "type" "three")])
12578 ;; Compare insns are next. Note that the RS/6000 has two types of compares,
12579 ;; signed & unsigned, and one type of branch.
12581 ;; Start with the DEFINE_EXPANDs to generate the rtl for compares, scc
12582 ;; insns, and branches.
12584 (define_expand "cbranch<mode>4"
12585 [(use (match_operator 0 "rs6000_cbranch_operator"
12586 [(match_operand:GPR 1 "gpc_reg_operand" "")
12587 (match_operand:GPR 2 "reg_or_short_operand" "")]))
12588 (use (match_operand 3 ""))]
12592 /* Take care of the possibility that operands[2] might be negative but
12593 this might be a logical operation. That insn doesn't exist. */
12594 if (GET_CODE (operands[2]) == CONST_INT
12595 && INTVAL (operands[2]) < 0)
12597 operands[2] = force_reg (<MODE>mode, operands[2]);
12598 operands[0] = gen_rtx_fmt_ee (GET_CODE (operands[0]),
12599 GET_MODE (operands[0]),
12600 operands[1], operands[2]);
12603 rs6000_emit_cbranch (<MODE>mode, operands);
12607 (define_expand "cbranch<mode>4"
12608 [(use (match_operator 0 "rs6000_cbranch_operator"
12609 [(match_operand:FP 1 "gpc_reg_operand" "")
12610 (match_operand:FP 2 "gpc_reg_operand" "")]))
12611 (use (match_operand 3 ""))]
12615 rs6000_emit_cbranch (<MODE>mode, operands);
12619 (define_expand "cstore<mode>4"
12620 [(use (match_operator 1 "rs6000_cbranch_operator"
12621 [(match_operand:GPR 2 "gpc_reg_operand" "")
12622 (match_operand:GPR 3 "reg_or_short_operand" "")]))
12623 (clobber (match_operand:SI 0 "register_operand"))]
12627 /* Take care of the possibility that operands[3] might be negative but
12628 this might be a logical operation. That insn doesn't exist. */
12629 if (GET_CODE (operands[3]) == CONST_INT
12630 && INTVAL (operands[3]) < 0)
12632 operands[3] = force_reg (<MODE>mode, operands[3]);
12633 operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]),
12634 GET_MODE (operands[1]),
12635 operands[2], operands[3]);
12638 /* For SNE, we would prefer that the xor/abs sequence be used for integers.
12639 For SEQ, likewise, except that comparisons with zero should be done
12640 with an scc insns. However, due to the order that combine see the
12641 resulting insns, we must, in fact, allow SEQ for integers. Fail in
12642 the cases we don't want to handle or are best handled by portable
12644 if (GET_CODE (operands[1]) == NE)
12646 if ((GET_CODE (operands[1]) == LT || GET_CODE (operands[1]) == LE
12647 || GET_CODE (operands[1]) == GT || GET_CODE (operands[1]) == GE)
12648 && operands[3] == const0_rtx)
12650 rs6000_emit_sCOND (<MODE>mode, operands);
12654 (define_expand "cstore<mode>4"
12655 [(use (match_operator 1 "rs6000_cbranch_operator"
12656 [(match_operand:FP 2 "gpc_reg_operand" "")
12657 (match_operand:FP 3 "gpc_reg_operand" "")]))
12658 (clobber (match_operand:SI 0 "register_operand"))]
12662 rs6000_emit_sCOND (<MODE>mode, operands);
12667 (define_expand "stack_protect_set"
12668 [(match_operand 0 "memory_operand" "")
12669 (match_operand 1 "memory_operand" "")]
12672 #ifdef TARGET_THREAD_SSP_OFFSET
12673 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
12674 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
12675 operands[1] = gen_rtx_MEM (Pmode, addr);
12678 emit_insn (gen_stack_protect_setdi (operands[0], operands[1]));
12680 emit_insn (gen_stack_protect_setsi (operands[0], operands[1]));
12684 (define_insn "stack_protect_setsi"
12685 [(set (match_operand:SI 0 "memory_operand" "=m")
12686 (unspec:SI [(match_operand:SI 1 "memory_operand" "m")] UNSPEC_SP_SET))
12687 (set (match_scratch:SI 2 "=&r") (const_int 0))]
12689 "lwz%U1%X1 %2,%1\;stw%U0%X0 %2,%0\;li %2,0"
12690 [(set_attr "type" "three")
12691 (set_attr "length" "12")])
12693 (define_insn "stack_protect_setdi"
12694 [(set (match_operand:DI 0 "memory_operand" "=Y")
12695 (unspec:DI [(match_operand:DI 1 "memory_operand" "Y")] UNSPEC_SP_SET))
12696 (set (match_scratch:DI 2 "=&r") (const_int 0))]
12698 "ld%U1%X1 %2,%1\;std%U0%X0 %2,%0\;li %2,0"
12699 [(set_attr "type" "three")
12700 (set_attr "length" "12")])
12702 (define_expand "stack_protect_test"
12703 [(match_operand 0 "memory_operand" "")
12704 (match_operand 1 "memory_operand" "")
12705 (match_operand 2 "" "")]
12708 rtx test, op0, op1;
12709 #ifdef TARGET_THREAD_SSP_OFFSET
12710 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
12711 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
12712 operands[1] = gen_rtx_MEM (Pmode, addr);
12715 op1 = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, operands[1]), UNSPEC_SP_TEST);
12716 test = gen_rtx_EQ (VOIDmode, op0, op1);
12717 emit_jump_insn (gen_cbranchsi4 (test, op0, op1, operands[2]));
12721 (define_insn "stack_protect_testsi"
12722 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
12723 (unspec:CCEQ [(match_operand:SI 1 "memory_operand" "m,m")
12724 (match_operand:SI 2 "memory_operand" "m,m")]
12726 (set (match_scratch:SI 4 "=r,r") (const_int 0))
12727 (clobber (match_scratch:SI 3 "=&r,&r"))]
12730 lwz%U1%X1 %3,%1\;lwz%U2%X2 %4,%2\;xor. %3,%3,%4\;li %4,0
12731 lwz%U1%X1 %3,%1\;lwz%U2%X2 %4,%2\;cmplw %0,%3,%4\;li %3,0\;li %4,0"
12732 [(set_attr "length" "16,20")])
12734 (define_insn "stack_protect_testdi"
12735 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
12736 (unspec:CCEQ [(match_operand:DI 1 "memory_operand" "Y,Y")
12737 (match_operand:DI 2 "memory_operand" "Y,Y")]
12739 (set (match_scratch:DI 4 "=r,r") (const_int 0))
12740 (clobber (match_scratch:DI 3 "=&r,&r"))]
12743 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;xor. %3,%3,%4\;li %4,0
12744 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;cmpld %0,%3,%4\;li %3,0\;li %4,0"
12745 [(set_attr "length" "16,20")])
12748 ;; Here are the actual compare insns.
12749 (define_insn "*cmp<mode>_internal1"
12750 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
12751 (compare:CC (match_operand:GPR 1 "gpc_reg_operand" "r")
12752 (match_operand:GPR 2 "reg_or_short_operand" "rI")))]
12754 "cmp<wd>%I2 %0,%1,%2"
12755 [(set_attr "type" "cmp")])
12757 ;; If we are comparing a register for equality with a large constant,
12758 ;; we can do this with an XOR followed by a compare. But this is profitable
12759 ;; only if the large constant is only used for the comparison (and in this
12760 ;; case we already have a register to reuse as scratch).
12762 ;; For 64-bit registers, we could only do so if the constant's bit 15 is clear:
12763 ;; otherwise we'd need to XOR with FFFFFFFF????0000 which is not available.
12766 [(set (match_operand:SI 0 "register_operand")
12767 (match_operand:SI 1 "logical_const_operand" ""))
12768 (set (match_dup 0) (match_operator:SI 3 "boolean_or_operator"
12770 (match_operand:SI 2 "logical_const_operand" "")]))
12771 (set (match_operand:CC 4 "cc_reg_operand" "")
12772 (compare:CC (match_operand:SI 5 "gpc_reg_operand" "")
12775 (if_then_else (match_operator 6 "equality_operator"
12776 [(match_dup 4) (const_int 0)])
12777 (match_operand 7 "" "")
12778 (match_operand 8 "" "")))]
12779 "peep2_reg_dead_p (3, operands[0])
12780 && peep2_reg_dead_p (4, operands[4])"
12781 [(set (match_dup 0) (xor:SI (match_dup 5) (match_dup 9)))
12782 (set (match_dup 4) (compare:CC (match_dup 0) (match_dup 10)))
12783 (set (pc) (if_then_else (match_dup 6) (match_dup 7) (match_dup 8)))]
12786 /* Get the constant we are comparing against, and see what it looks like
12787 when sign-extended from 16 to 32 bits. Then see what constant we could
12788 XOR with SEXTC to get the sign-extended value. */
12789 rtx cnst = simplify_const_binary_operation (GET_CODE (operands[3]),
12791 operands[1], operands[2]);
12792 HOST_WIDE_INT c = INTVAL (cnst);
12793 HOST_WIDE_INT sextc = ((c & 0xffff) ^ 0x8000) - 0x8000;
12794 HOST_WIDE_INT xorv = c ^ sextc;
12796 operands[9] = GEN_INT (xorv);
12797 operands[10] = GEN_INT (sextc);
12800 (define_insn "*cmpsi_internal2"
12801 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
12802 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
12803 (match_operand:SI 2 "reg_or_u_short_operand" "rK")))]
12805 "cmplw%I2 %0,%1,%b2"
12806 [(set_attr "type" "cmp")])
12808 (define_insn "*cmpdi_internal2"
12809 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
12810 (compare:CCUNS (match_operand:DI 1 "gpc_reg_operand" "r")
12811 (match_operand:DI 2 "reg_or_u_short_operand" "rK")))]
12813 "cmpld%I2 %0,%1,%b2"
12814 [(set_attr "type" "cmp")])
12816 ;; The following two insns don't exist as single insns, but if we provide
12817 ;; them, we can swap an add and compare, which will enable us to overlap more
12818 ;; of the required delay between a compare and branch. We generate code for
12819 ;; them by splitting.
12822 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
12823 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
12824 (match_operand:SI 2 "short_cint_operand" "i")))
12825 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
12826 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
12829 [(set_attr "length" "8")])
12832 [(set (match_operand:CCUNS 3 "cc_reg_operand" "=y")
12833 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
12834 (match_operand:SI 2 "u_short_cint_operand" "i")))
12835 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
12836 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
12839 [(set_attr "length" "8")])
12842 [(set (match_operand:CC 3 "cc_reg_operand" "")
12843 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
12844 (match_operand:SI 2 "short_cint_operand" "")))
12845 (set (match_operand:SI 0 "gpc_reg_operand" "")
12846 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
12848 [(set (match_dup 3) (compare:CC (match_dup 1) (match_dup 2)))
12849 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
12852 [(set (match_operand:CCUNS 3 "cc_reg_operand" "")
12853 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "")
12854 (match_operand:SI 2 "u_short_cint_operand" "")))
12855 (set (match_operand:SI 0 "gpc_reg_operand" "")
12856 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
12858 [(set (match_dup 3) (compare:CCUNS (match_dup 1) (match_dup 2)))
12859 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
12861 (define_insn "*cmpsf_internal1"
12862 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
12863 (compare:CCFP (match_operand:SF 1 "gpc_reg_operand" "f")
12864 (match_operand:SF 2 "gpc_reg_operand" "f")))]
12865 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
12867 [(set_attr "type" "fpcompare")])
12869 (define_insn "*cmpdf_internal1"
12870 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
12871 (compare:CCFP (match_operand:DF 1 "gpc_reg_operand" "d")
12872 (match_operand:DF 2 "gpc_reg_operand" "d")))]
12873 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
12874 && !VECTOR_UNIT_VSX_P (DFmode)"
12876 [(set_attr "type" "fpcompare")])
12878 ;; Only need to compare second words if first words equal
12879 (define_insn "*cmptf_internal1"
12880 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
12881 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "d")
12882 (match_operand:TF 2 "gpc_reg_operand" "d")))]
12883 "!TARGET_IEEEQUAD && !TARGET_XL_COMPAT
12884 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LONG_DOUBLE_128"
12885 "fcmpu %0,%1,%2\;bne %0,$+8\;fcmpu %0,%L1,%L2"
12886 [(set_attr "type" "fpcompare")
12887 (set_attr "length" "12")])
12889 (define_insn_and_split "*cmptf_internal2"
12890 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
12891 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "d")
12892 (match_operand:TF 2 "gpc_reg_operand" "d")))
12893 (clobber (match_scratch:DF 3 "=d"))
12894 (clobber (match_scratch:DF 4 "=d"))
12895 (clobber (match_scratch:DF 5 "=d"))
12896 (clobber (match_scratch:DF 6 "=d"))
12897 (clobber (match_scratch:DF 7 "=d"))
12898 (clobber (match_scratch:DF 8 "=d"))
12899 (clobber (match_scratch:DF 9 "=d"))
12900 (clobber (match_scratch:DF 10 "=d"))
12901 (clobber (match_scratch:GPR 11 "=b"))]
12902 "!TARGET_IEEEQUAD && TARGET_XL_COMPAT
12903 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LONG_DOUBLE_128"
12905 "&& reload_completed"
12906 [(set (match_dup 3) (match_dup 14))
12907 (set (match_dup 4) (match_dup 15))
12908 (set (match_dup 9) (abs:DF (match_dup 5)))
12909 (set (match_dup 0) (compare:CCFP (match_dup 9) (match_dup 3)))
12910 (set (pc) (if_then_else (ne (match_dup 0) (const_int 0))
12911 (label_ref (match_dup 12))
12913 (set (match_dup 0) (compare:CCFP (match_dup 5) (match_dup 7)))
12914 (set (pc) (label_ref (match_dup 13)))
12916 (set (match_dup 10) (minus:DF (match_dup 5) (match_dup 7)))
12917 (set (match_dup 9) (minus:DF (match_dup 6) (match_dup 8)))
12918 (set (match_dup 9) (plus:DF (match_dup 10) (match_dup 9)))
12919 (set (match_dup 0) (compare:CCFP (match_dup 9) (match_dup 4)))
12922 REAL_VALUE_TYPE rv;
12923 const int lo_word = LONG_DOUBLE_LARGE_FIRST ? GET_MODE_SIZE (DFmode) : 0;
12924 const int hi_word = LONG_DOUBLE_LARGE_FIRST ? 0 : GET_MODE_SIZE (DFmode);
12926 operands[5] = simplify_gen_subreg (DFmode, operands[1], TFmode, hi_word);
12927 operands[6] = simplify_gen_subreg (DFmode, operands[1], TFmode, lo_word);
12928 operands[7] = simplify_gen_subreg (DFmode, operands[2], TFmode, hi_word);
12929 operands[8] = simplify_gen_subreg (DFmode, operands[2], TFmode, lo_word);
12930 operands[12] = gen_label_rtx ();
12931 operands[13] = gen_label_rtx ();
12933 operands[14] = force_const_mem (DFmode,
12934 CONST_DOUBLE_FROM_REAL_VALUE (rv, DFmode));
12935 operands[15] = force_const_mem (DFmode,
12936 CONST_DOUBLE_FROM_REAL_VALUE (dconst0,
12941 tocref = create_TOC_reference (XEXP (operands[14], 0), operands[11]);
12942 operands[14] = gen_const_mem (DFmode, tocref);
12943 tocref = create_TOC_reference (XEXP (operands[15], 0), operands[11]);
12944 operands[15] = gen_const_mem (DFmode, tocref);
12945 set_mem_alias_set (operands[14], get_TOC_alias_set ());
12946 set_mem_alias_set (operands[15], get_TOC_alias_set ());
12950 ;; Now we have the scc insns. We can do some combinations because of the
12951 ;; way the machine works.
12953 ;; Note that this is probably faster if we can put an insn between the
12954 ;; mfcr and rlinm, but this is tricky. Let's leave it for now. In most
12955 ;; cases the insns below which don't use an intermediate CR field will
12956 ;; be used instead.
12958 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12959 (match_operator:SI 1 "scc_comparison_operator"
12960 [(match_operand 2 "cc_reg_operand" "y")
12963 "mfcr %0%Q2\;rlwinm %0,%0,%J1,1"
12964 [(set (attr "type")
12965 (cond [(match_test "TARGET_MFCRF")
12966 (const_string "mfcrf")
12968 (const_string "mfcr")))
12969 (set_attr "length" "8")])
12971 ;; Same as above, but get the GT bit.
12972 (define_insn "move_from_CR_gt_bit"
12973 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12974 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_GT))]
12975 "TARGET_HARD_FLOAT && !TARGET_FPRS"
12976 "mfcr %0\;rlwinm %0,%0,%D1,31,31"
12977 [(set_attr "type" "mfcr")
12978 (set_attr "length" "8")])
12980 ;; Same as above, but get the OV/ORDERED bit.
12981 (define_insn "move_from_CR_ov_bit"
12982 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12983 (unspec:SI [(match_operand:CC 1 "cc_reg_operand" "y")]
12986 "mfcr %0\;rlwinm %0,%0,%t1,1"
12987 [(set_attr "type" "mfcr")
12988 (set_attr "length" "8")])
12991 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12992 (match_operator:DI 1 "scc_comparison_operator"
12993 [(match_operand 2 "cc_reg_operand" "y")
12996 "mfcr %0%Q2\;rlwinm %0,%0,%J1,1"
12997 [(set (attr "type")
12998 (cond [(match_test "TARGET_MFCRF")
12999 (const_string "mfcrf")
13001 (const_string "mfcr")))
13002 (set_attr "length" "8")])
13005 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13006 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
13007 [(match_operand 2 "cc_reg_operand" "y,y")
13010 (set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
13011 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
13014 mfcr %3%Q2\;rlwinm. %3,%3,%J1,1
13016 [(set_attr "type" "delayed_compare")
13017 (set_attr "length" "8,16")])
13020 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13021 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
13022 [(match_operand 2 "cc_reg_operand" "")
13025 (set (match_operand:SI 3 "gpc_reg_operand" "")
13026 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
13027 "TARGET_32BIT && reload_completed"
13028 [(set (match_dup 3)
13029 (match_op_dup 1 [(match_dup 2) (const_int 0)]))
13031 (compare:CC (match_dup 3)
13036 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13037 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
13038 [(match_operand 2 "cc_reg_operand" "y")
13040 (match_operand:SI 3 "const_int_operand" "n")))]
13044 int is_bit = ccr_bit (operands[1], 1);
13045 int put_bit = 31 - (INTVAL (operands[3]) & 31);
13048 if (is_bit >= put_bit)
13049 count = is_bit - put_bit;
13051 count = 32 - (put_bit - is_bit);
13053 operands[4] = GEN_INT (count);
13054 operands[5] = GEN_INT (put_bit);
13056 return \"mfcr %0%Q2\;rlwinm %0,%0,%4,%5,%5\";
13058 [(set (attr "type")
13059 (cond [(match_test "TARGET_MFCRF")
13060 (const_string "mfcrf")
13062 (const_string "mfcr")))
13063 (set_attr "length" "8")])
13066 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13068 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
13069 [(match_operand 2 "cc_reg_operand" "y,y")
13071 (match_operand:SI 3 "const_int_operand" "n,n"))
13073 (set (match_operand:SI 4 "gpc_reg_operand" "=r,r")
13074 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
13079 int is_bit = ccr_bit (operands[1], 1);
13080 int put_bit = 31 - (INTVAL (operands[3]) & 31);
13083 /* Force split for non-cc0 compare. */
13084 if (which_alternative == 1)
13087 if (is_bit >= put_bit)
13088 count = is_bit - put_bit;
13090 count = 32 - (put_bit - is_bit);
13092 operands[5] = GEN_INT (count);
13093 operands[6] = GEN_INT (put_bit);
13095 return \"mfcr %4%Q2\;rlwinm. %4,%4,%5,%6,%6\";
13097 [(set_attr "type" "delayed_compare")
13098 (set_attr "length" "8,16")])
13101 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
13103 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
13104 [(match_operand 2 "cc_reg_operand" "")
13106 (match_operand:SI 3 "const_int_operand" ""))
13108 (set (match_operand:SI 4 "gpc_reg_operand" "")
13109 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
13112 [(set (match_dup 4)
13113 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
13116 (compare:CC (match_dup 4)
13120 ;; There is a 3 cycle delay between consecutive mfcr instructions
13121 ;; so it is useful to combine 2 scc instructions to use only one mfcr.
13124 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13125 (match_operator:SI 1 "scc_comparison_operator"
13126 [(match_operand 2 "cc_reg_operand" "y")
13128 (set (match_operand:SI 3 "gpc_reg_operand" "=r")
13129 (match_operator:SI 4 "scc_comparison_operator"
13130 [(match_operand 5 "cc_reg_operand" "y")
13132 "REGNO (operands[2]) != REGNO (operands[5])"
13133 "mfcr %3\;rlwinm %0,%3,%J1,1\;rlwinm %3,%3,%J4,1"
13134 [(set_attr "type" "mfcr")
13135 (set_attr "length" "12")])
13138 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13139 (match_operator:DI 1 "scc_comparison_operator"
13140 [(match_operand 2 "cc_reg_operand" "y")
13142 (set (match_operand:DI 3 "gpc_reg_operand" "=r")
13143 (match_operator:DI 4 "scc_comparison_operator"
13144 [(match_operand 5 "cc_reg_operand" "y")
13146 "TARGET_POWERPC64 && REGNO (operands[2]) != REGNO (operands[5])"
13147 "mfcr %3\;rlwinm %0,%3,%J1,1\;rlwinm %3,%3,%J4,1"
13148 [(set_attr "type" "mfcr")
13149 (set_attr "length" "12")])
13151 ;; There are some scc insns that can be done directly, without a compare.
13152 ;; These are faster because they don't involve the communications between
13153 ;; the FXU and branch units. In fact, we will be replacing all of the
13154 ;; integer scc insns here or in the portable methods in emit_store_flag.
13156 ;; Also support (neg (scc ..)) since that construct is used to replace
13157 ;; branches, (plus (scc ..) ..) since that construct is common and
13158 ;; takes no more insns than scc, and (and (neg (scc ..)) ..) in the
13159 ;; cases where it is no more expensive than (neg (scc ..)).
13161 ;; Have reload force a constant into a register for the simple insns that
13162 ;; otherwise won't accept constants. We do this because it is faster than
13163 ;; the cmp/mfcr sequence we would otherwise generate.
13165 (define_mode_attr scc_eq_op2 [(SI "rKLI")
13168 (define_insn_and_split "*eq<mode>"
13169 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
13170 (eq:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
13171 (match_operand:GPR 2 "scc_eq_operand" "<scc_eq_op2>")))]
13175 [(set (match_dup 0)
13176 (clz:GPR (match_dup 3)))
13178 (lshiftrt:GPR (match_dup 0) (match_dup 4)))]
13180 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
13182 /* Use output operand as intermediate. */
13183 operands[3] = operands[0];
13185 if (logical_operand (operands[2], <MODE>mode))
13186 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13187 gen_rtx_XOR (<MODE>mode,
13188 operands[1], operands[2])));
13190 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13191 gen_rtx_PLUS (<MODE>mode, operands[1],
13192 negate_rtx (<MODE>mode,
13196 operands[3] = operands[1];
13198 operands[4] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
13201 (define_insn_and_split "*eq<mode>_compare"
13202 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
13204 (eq:P (match_operand:P 1 "gpc_reg_operand" "=r")
13205 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))
13207 (set (match_operand:P 0 "gpc_reg_operand" "=r")
13208 (eq:P (match_dup 1) (match_dup 2)))]
13212 [(set (match_dup 0)
13213 (clz:P (match_dup 4)))
13214 (parallel [(set (match_dup 3)
13215 (compare:CC (lshiftrt:P (match_dup 0) (match_dup 5))
13218 (lshiftrt:P (match_dup 0) (match_dup 5)))])]
13220 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
13222 /* Use output operand as intermediate. */
13223 operands[4] = operands[0];
13225 if (logical_operand (operands[2], <MODE>mode))
13226 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
13227 gen_rtx_XOR (<MODE>mode,
13228 operands[1], operands[2])));
13230 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
13231 gen_rtx_PLUS (<MODE>mode, operands[1],
13232 negate_rtx (<MODE>mode,
13236 operands[4] = operands[1];
13238 operands[5] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
13241 ;; We have insns of the form shown by the first define_insn below. If
13242 ;; there is something inside the comparison operation, we must split it.
13244 [(set (match_operand:SI 0 "gpc_reg_operand" "")
13245 (plus:SI (match_operator 1 "comparison_operator"
13246 [(match_operand:SI 2 "" "")
13247 (match_operand:SI 3
13248 "reg_or_cint_operand" "")])
13249 (match_operand:SI 4 "gpc_reg_operand" "")))
13250 (clobber (match_operand:SI 5 "register_operand" ""))]
13251 "! gpc_reg_operand (operands[2], SImode)"
13252 [(set (match_dup 5) (match_dup 2))
13253 (set (match_dup 0) (plus:SI (match_op_dup 1 [(match_dup 5) (match_dup 3)])
13256 (define_insn "*plus_eqsi"
13257 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r")
13258 (plus:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
13259 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I"))
13260 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r")))]
13263 xor %0,%1,%2\;subfic %0,%0,0\;addze %0,%3
13264 subfic %0,%1,0\;addze %0,%3
13265 xori %0,%1,%b2\;subfic %0,%0,0\;addze %0,%3
13266 xoris %0,%1,%u2\;subfic %0,%0,0\;addze %0,%3
13267 subfic %0,%1,%2\;subfic %0,%0,0\;addze %0,%3"
13268 [(set_attr "type" "three,two,three,three,three")
13269 (set_attr "length" "12,8,12,12,12")])
13271 (define_insn "*compare_plus_eqsi"
13272 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
13275 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
13276 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
13277 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
13279 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r"))]
13280 "TARGET_32BIT && optimize_size"
13282 xor %4,%1,%2\;subfic %4,%4,0\;addze. %4,%3
13283 subfic %4,%1,0\;addze. %4,%3
13284 xori %4,%1,%b2\;subfic %4,%4,0\;addze. %4,%3
13285 xoris %4,%1,%u2\;subfic %4,%4,0\;addze. %4,%3
13286 subfic %4,%1,%2\;subfic %4,%4,0\;addze. %4,%3
13292 [(set_attr "type" "compare")
13293 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
13296 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13299 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
13300 (match_operand:SI 2 "scc_eq_operand" ""))
13301 (match_operand:SI 3 "gpc_reg_operand" ""))
13303 (clobber (match_scratch:SI 4 ""))]
13304 "TARGET_32BIT && optimize_size && reload_completed"
13305 [(set (match_dup 4)
13306 (plus:SI (eq:SI (match_dup 1)
13310 (compare:CC (match_dup 4)
13314 (define_insn "*plus_eqsi_compare"
13315 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
13318 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
13319 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
13320 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
13322 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r")
13323 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13324 "TARGET_32BIT && optimize_size"
13326 xor %0,%1,%2\;subfic %0,%0,0\;addze. %0,%3
13327 subfic %0,%1,0\;addze. %0,%3
13328 xori %0,%1,%b2\;subfic %0,%0,0\;addze. %0,%3
13329 xoris %0,%1,%u2\;subfic %0,%0,0\;addze. %0,%3
13330 subfic %0,%1,%2\;subfic %0,%0,0\;addze. %0,%3
13336 [(set_attr "type" "compare")
13337 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
13340 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13343 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
13344 (match_operand:SI 2 "scc_eq_operand" ""))
13345 (match_operand:SI 3 "gpc_reg_operand" ""))
13347 (set (match_operand:SI 0 "gpc_reg_operand" "")
13348 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13349 "TARGET_32BIT && optimize_size && reload_completed"
13350 [(set (match_dup 0)
13351 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13353 (compare:CC (match_dup 0)
13357 (define_insn "*neg_eq0<mode>"
13358 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13359 (neg:P (eq:P (match_operand:P 1 "gpc_reg_operand" "r")
13362 "addic %0,%1,-1\;subfe %0,%0,%0"
13363 [(set_attr "type" "two")
13364 (set_attr "length" "8")])
13366 (define_insn_and_split "*neg_eq<mode>"
13367 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13368 (neg:P (eq:P (match_operand:P 1 "gpc_reg_operand" "%r")
13369 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))))]
13373 [(set (match_dup 0) (neg:P (eq:P (match_dup 3) (const_int 0))))]
13375 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
13377 /* Use output operand as intermediate. */
13378 operands[3] = operands[0];
13380 if (logical_operand (operands[2], <MODE>mode))
13381 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13382 gen_rtx_XOR (<MODE>mode,
13383 operands[1], operands[2])));
13385 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13386 gen_rtx_PLUS (<MODE>mode, operands[1],
13387 negate_rtx (<MODE>mode,
13391 operands[3] = operands[1];
13394 (define_insn "*ne0_<mode>"
13395 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13396 (ne:P (match_operand:P 1 "gpc_reg_operand" "r")
13398 (clobber (match_scratch:P 2 "=&r"))]
13399 "!(TARGET_32BIT && TARGET_ISEL)"
13400 "addic %2,%1,-1\;subfe %0,%2,%1"
13401 [(set_attr "type" "two")
13402 (set_attr "length" "8")])
13404 (define_insn "*plus_ne0_<mode>"
13405 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13406 (plus:P (ne:P (match_operand:P 1 "gpc_reg_operand" "r")
13408 (match_operand:P 2 "gpc_reg_operand" "r")))
13409 (clobber (match_scratch:P 3 "=&r"))]
13411 "addic %3,%1,-1\;addze %0,%2"
13412 [(set_attr "type" "two")
13413 (set_attr "length" "8")])
13415 (define_insn "*compare_plus_ne0_<mode>"
13416 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13417 (compare:CC (plus:P (ne:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13419 (match_operand:P 2 "gpc_reg_operand" "r,r"))
13421 (clobber (match_scratch:P 3 "=&r,&r"))
13422 (clobber (match_scratch:P 4 "=X,&r"))]
13425 addic %3,%1,-1\;addze. %3,%2
13427 [(set_attr "type" "compare")
13428 (set_attr "length" "8,12")])
13431 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
13432 (compare:CC (ne:P (match_operand:SI 1 "gpc_reg_operand" "")
13434 (neg:P (match_operand:P 2 "gpc_reg_operand" ""))))
13435 (clobber (match_scratch:P 3 ""))
13436 (clobber (match_scratch:P 4 ""))]
13438 [(parallel [(set (match_dup 3)
13439 (plus:P (ne:P (match_dup 1)
13442 (clobber (match_dup 4))])
13444 (compare:CC (match_dup 3)
13449 (define_insn "*compare_plus_ne0_<mode>_1"
13450 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
13451 (compare:CCEQ (ne:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13453 (neg:P (match_operand:P 2 "gpc_reg_operand" "r,r"))))
13454 (clobber (match_scratch:P 3 "=&r,&r"))
13455 (clobber (match_scratch:P 4 "=X,&r"))]
13458 addic %3,%1,-1\;addze. %3,%2
13460 [(set_attr "type" "compare")
13461 (set_attr "length" "8,12")])
13464 [(set (match_operand:CCEQ 0 "cc_reg_not_micro_cr0_operand" "")
13465 (compare:CCEQ (ne:P (match_operand:SI 1 "gpc_reg_operand" "")
13467 (neg:P (match_operand:P 2 "gpc_reg_operand" ""))))
13468 (clobber (match_scratch:P 3 ""))
13469 (clobber (match_scratch:P 4 ""))]
13471 [(parallel [(set (match_dup 3)
13472 (plus:P (ne:P (match_dup 1)
13475 (clobber (match_dup 4))])
13477 (compare:CC (match_dup 3)
13481 (define_insn "*plus_ne0_<mode>_compare"
13482 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13484 (plus:P (ne:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13486 (match_operand:P 2 "gpc_reg_operand" "r,r"))
13488 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13489 (plus:P (ne:P (match_dup 1)
13492 (clobber (match_scratch:P 3 "=&r,&r"))]
13495 addic %3,%1,-1\;addze. %0,%2
13497 [(set_attr "type" "compare")
13498 (set_attr "length" "8,12")])
13501 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
13503 (plus:P (ne:P (match_operand:P 1 "gpc_reg_operand" "")
13505 (match_operand:P 2 "gpc_reg_operand" ""))
13507 (set (match_operand:P 0 "gpc_reg_operand" "")
13508 (plus:P (ne:P (match_dup 1)
13511 (clobber (match_scratch:P 3 ""))]
13513 [(parallel [(set (match_dup 0)
13514 (plus:P (ne:P (match_dup 1)
13517 (clobber (match_dup 3))])
13519 (compare:CC (match_dup 0)
13523 (define_insn "*leu<mode>"
13524 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13525 (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
13526 (match_operand:P 2 "reg_or_short_operand" "rI")))]
13528 "subf%I2c %0,%1,%2\;li %0,0\;adde %0,%0,%0"
13529 [(set_attr "type" "three")
13530 (set_attr "length" "12")])
13532 (define_insn "*leu<mode>_compare"
13533 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13535 (leu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13536 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
13538 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13539 (leu:P (match_dup 1) (match_dup 2)))]
13542 subf%I2c %0,%1,%2\;li %0,0\;adde. %0,%0,%0
13544 [(set_attr "type" "compare")
13545 (set_attr "length" "12,16")])
13548 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13550 (leu:P (match_operand:P 1 "gpc_reg_operand" "")
13551 (match_operand:P 2 "reg_or_short_operand" ""))
13553 (set (match_operand:P 0 "gpc_reg_operand" "")
13554 (leu:P (match_dup 1) (match_dup 2)))]
13556 [(set (match_dup 0)
13557 (leu:P (match_dup 1) (match_dup 2)))
13559 (compare:CC (match_dup 0)
13563 (define_insn "*plus_leu<mode>"
13564 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
13565 (plus:P (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
13566 (match_operand:P 2 "reg_or_short_operand" "rI"))
13567 (match_operand:P 3 "gpc_reg_operand" "r")))]
13569 "subf%I2c %0,%1,%2\;addze %0,%3"
13570 [(set_attr "type" "two")
13571 (set_attr "length" "8")])
13574 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13576 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13577 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13578 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13580 (clobber (match_scratch:SI 4 "=&r,&r"))]
13583 subf%I2c %4,%1,%2\;addze. %4,%3
13585 [(set_attr "type" "compare")
13586 (set_attr "length" "8,12")])
13589 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13591 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13592 (match_operand:SI 2 "reg_or_short_operand" ""))
13593 (match_operand:SI 3 "gpc_reg_operand" ""))
13595 (clobber (match_scratch:SI 4 ""))]
13596 "TARGET_32BIT && reload_completed"
13597 [(set (match_dup 4)
13598 (plus:SI (leu:SI (match_dup 1) (match_dup 2))
13601 (compare:CC (match_dup 4)
13606 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13608 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13609 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13610 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13612 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13613 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13616 subf%I2c %0,%1,%2\;addze. %0,%3
13618 [(set_attr "type" "compare")
13619 (set_attr "length" "8,12")])
13622 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13624 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13625 (match_operand:SI 2 "reg_or_short_operand" ""))
13626 (match_operand:SI 3 "gpc_reg_operand" ""))
13628 (set (match_operand:SI 0 "gpc_reg_operand" "")
13629 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13630 "TARGET_32BIT && reload_completed"
13631 [(set (match_dup 0)
13632 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13634 (compare:CC (match_dup 0)
13638 (define_insn "*neg_leu<mode>"
13639 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13640 (neg:P (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
13641 (match_operand:P 2 "reg_or_short_operand" "rI"))))]
13643 "subf%I2c %0,%1,%2\;subfe %0,%0,%0\;nand %0,%0,%0"
13644 [(set_attr "type" "three")
13645 (set_attr "length" "12")])
13647 (define_insn "*and_neg_leu<mode>"
13648 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
13650 (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
13651 (match_operand:P 2 "reg_or_short_operand" "rI")))
13652 (match_operand:P 3 "gpc_reg_operand" "r")))]
13654 "subf%I2c %0,%1,%2\;subfe %0,%0,%0\;andc %0,%3,%0"
13655 [(set_attr "type" "three")
13656 (set_attr "length" "12")])
13659 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13662 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13663 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
13664 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13666 (clobber (match_scratch:SI 4 "=&r,&r"))]
13669 subf%I2c %4,%1,%2\;subfe %4,%4,%4\;andc. %4,%3,%4
13671 [(set_attr "type" "compare")
13672 (set_attr "length" "12,16")])
13675 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13678 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13679 (match_operand:SI 2 "reg_or_short_operand" "")))
13680 (match_operand:SI 3 "gpc_reg_operand" ""))
13682 (clobber (match_scratch:SI 4 ""))]
13683 "TARGET_32BIT && reload_completed"
13684 [(set (match_dup 4)
13685 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
13688 (compare:CC (match_dup 4)
13693 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13696 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13697 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
13698 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13700 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13701 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13704 subf%I2c %0,%1,%2\;subfe %0,%0,%0\;andc. %0,%3,%0
13706 [(set_attr "type" "compare")
13707 (set_attr "length" "12,16")])
13710 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13713 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13714 (match_operand:SI 2 "reg_or_short_operand" "")))
13715 (match_operand:SI 3 "gpc_reg_operand" ""))
13717 (set (match_operand:SI 0 "gpc_reg_operand" "")
13718 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13719 "TARGET_32BIT && reload_completed"
13720 [(set (match_dup 0)
13721 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
13724 (compare:CC (match_dup 0)
13728 (define_insn_and_split "*ltu<mode>"
13729 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13730 (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13731 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))]
13735 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
13736 (set (match_dup 0) (neg:P (match_dup 0)))]
13739 (define_insn_and_split "*ltu<mode>_compare"
13740 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
13742 (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
13743 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
13745 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
13746 (ltu:P (match_dup 1) (match_dup 2)))]
13750 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
13751 (parallel [(set (match_dup 3)
13752 (compare:CC (neg:P (match_dup 0)) (const_int 0)))
13753 (set (match_dup 0) (neg:P (match_dup 0)))])]
13756 (define_insn_and_split "*plus_ltu<mode>"
13757 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,r")
13758 (plus:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13759 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))
13760 (match_operand:P 3 "reg_or_short_operand" "rI,rI")))]
13763 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13764 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
13765 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))]
13768 (define_insn_and_split "*plus_ltu<mode>_compare"
13769 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13771 (plus:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
13772 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
13773 (match_operand:P 3 "gpc_reg_operand" "r,r,r,r"))
13775 (set (match_operand:P 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13776 (plus:P (ltu:P (match_dup 1) (match_dup 2)) (match_dup 3)))]
13779 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13780 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
13781 (parallel [(set (match_dup 4)
13782 (compare:CC (minus:P (match_dup 3) (match_dup 0))
13784 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))])]
13787 (define_insn "*neg_ltu<mode>"
13788 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13789 (neg:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13790 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))))]
13793 subfc %0,%2,%1\;subfe %0,%0,%0
13794 addic %0,%1,%n2\;subfe %0,%0,%0"
13795 [(set_attr "type" "two")
13796 (set_attr "length" "8")])
13798 (define_insn "*geu<mode>"
13799 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13800 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13801 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))]
13804 subfc %0,%2,%1\;li %0,0\;adde %0,%0,%0
13805 addic %0,%1,%n2\;li %0,0\;adde %0,%0,%0"
13806 [(set_attr "type" "three")
13807 (set_attr "length" "12")])
13809 (define_insn "*geu<mode>_compare"
13810 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
13812 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
13813 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
13815 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
13816 (geu:P (match_dup 1) (match_dup 2)))]
13819 subfc %0,%2,%1\;li %0,0\;adde. %0,%0,%0
13820 addic %0,%1,%n2\;li %0,0\;adde. %0,%0,%0
13823 [(set_attr "type" "compare")
13824 (set_attr "length" "12,12,16,16")])
13827 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
13829 (geu:P (match_operand:P 1 "gpc_reg_operand" "")
13830 (match_operand:P 2 "reg_or_neg_short_operand" ""))
13832 (set (match_operand:P 0 "gpc_reg_operand" "")
13833 (geu:P (match_dup 1) (match_dup 2)))]
13835 [(set (match_dup 0)
13836 (geu:P (match_dup 1) (match_dup 2)))
13838 (compare:CC (match_dup 0)
13842 (define_insn "*plus_geu<mode>"
13843 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,&r")
13844 (plus:P (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13845 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))
13846 (match_operand:P 3 "gpc_reg_operand" "r,r")))]
13849 subfc %0,%2,%1\;addze %0,%3
13850 addic %0,%1,%n2\;addze %0,%3"
13851 [(set_attr "type" "two")
13852 (set_attr "length" "8")])
13855 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13857 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13858 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
13859 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13861 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
13864 subfc %4,%2,%1\;addze. %4,%3
13865 addic %4,%1,%n2\;addze. %4,%3
13868 [(set_attr "type" "compare")
13869 (set_attr "length" "8,8,12,12")])
13872 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13874 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13875 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
13876 (match_operand:SI 3 "gpc_reg_operand" ""))
13878 (clobber (match_scratch:SI 4 ""))]
13879 "TARGET_32BIT && reload_completed"
13880 [(set (match_dup 4)
13881 (plus:SI (geu:SI (match_dup 1) (match_dup 2))
13884 (compare:CC (match_dup 4)
13889 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13891 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13892 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
13893 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13895 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13896 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13899 subfc %0,%2,%1\;addze. %0,%3
13900 addic %0,%1,%n2\;addze. %0,%3
13903 [(set_attr "type" "compare")
13904 (set_attr "length" "8,8,12,12")])
13907 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13909 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13910 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
13911 (match_operand:SI 3 "gpc_reg_operand" ""))
13913 (set (match_operand:SI 0 "gpc_reg_operand" "")
13914 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13915 "TARGET_32BIT && reload_completed"
13916 [(set (match_dup 0)
13917 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13919 (compare:CC (match_dup 0)
13923 (define_insn "*neg_geu<mode>"
13924 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13925 (neg:P (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13926 (match_operand:P 2 "reg_or_short_operand" "r,I"))))]
13929 subfc %0,%2,%1\;subfe %0,%0,%0\;nand %0,%0,%0
13930 subfic %0,%1,-1\;add%I2c %0,%0,%2\;subfe %0,%0,%0"
13931 [(set_attr "type" "three")
13932 (set_attr "length" "12")])
13934 (define_insn "*and_neg_geu<mode>"
13935 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,&r")
13937 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13938 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))
13939 (match_operand:P 3 "gpc_reg_operand" "r,r")))]
13942 subfc %0,%2,%1\;subfe %0,%0,%0\;andc %0,%3,%0
13943 addic %0,%1,%n2\;subfe %0,%0,%0\;andc %0,%3,%0"
13944 [(set_attr "type" "three")
13945 (set_attr "length" "12")])
13948 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13951 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13952 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
13953 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13955 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
13958 subfc %4,%2,%1\;subfe %4,%4,%4\;andc. %4,%3,%4
13959 addic %4,%1,%n2\;subfe %4,%4,%4\;andc. %4,%3,%4
13962 [(set_attr "type" "compare")
13963 (set_attr "length" "12,12,16,16")])
13966 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13969 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13970 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
13971 (match_operand:SI 3 "gpc_reg_operand" ""))
13973 (clobber (match_scratch:SI 4 ""))]
13974 "TARGET_32BIT && reload_completed"
13975 [(set (match_dup 4)
13976 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2)))
13979 (compare:CC (match_dup 4)
13984 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13987 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13988 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
13989 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13991 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13992 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13995 subfc %0,%2,%1\;subfe %0,%0,%0\;andc. %0,%3,%0
13996 addic %0,%1,%n2\;subfe %0,%0,%0\;andc. %0,%3,%0
13999 [(set_attr "type" "compare")
14000 (set_attr "length" "12,12,16,16")])
14003 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14006 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14007 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
14008 (match_operand:SI 3 "gpc_reg_operand" ""))
14010 (set (match_operand:SI 0 "gpc_reg_operand" "")
14011 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
14012 "TARGET_32BIT && reload_completed"
14013 [(set (match_dup 0)
14014 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
14016 (compare:CC (match_dup 0)
14020 (define_insn "*plus_gt0<mode>"
14021 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
14022 (plus:P (gt:P (match_operand:P 1 "gpc_reg_operand" "r")
14024 (match_operand:P 2 "gpc_reg_operand" "r")))]
14026 "addc %0,%1,%1\;subfe %0,%1,%0\;addze %0,%2"
14027 [(set_attr "type" "three")
14028 (set_attr "length" "12")])
14031 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
14033 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14035 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
14037 (clobber (match_scratch:SI 3 "=&r,&r"))]
14040 addc %3,%1,%1\;subfe %3,%1,%3\;addze. %3,%2
14042 [(set_attr "type" "compare")
14043 (set_attr "length" "12,16")])
14046 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14048 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14050 (match_operand:SI 2 "gpc_reg_operand" ""))
14052 (clobber (match_scratch:SI 3 ""))]
14053 "TARGET_32BIT && reload_completed"
14054 [(set (match_dup 3)
14055 (plus:SI (gt:SI (match_dup 1) (const_int 0))
14058 (compare:CC (match_dup 3)
14063 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
14065 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
14067 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
14069 (clobber (match_scratch:DI 3 "=&r,&r"))]
14072 addc %3,%1,%1\;subfe %3,%1,%3\;addze. %3,%2
14074 [(set_attr "type" "compare")
14075 (set_attr "length" "12,16")])
14078 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
14080 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
14082 (match_operand:DI 2 "gpc_reg_operand" ""))
14084 (clobber (match_scratch:DI 3 ""))]
14085 "TARGET_64BIT && reload_completed"
14086 [(set (match_dup 3)
14087 (plus:DI (gt:DI (match_dup 1) (const_int 0))
14090 (compare:CC (match_dup 3)
14095 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
14097 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14099 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
14101 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
14102 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
14105 addc %0,%1,%1\;subfe %0,%1,%0\;addze. %0,%2
14107 [(set_attr "type" "compare")
14108 (set_attr "length" "12,16")])
14111 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
14113 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14115 (match_operand:SI 2 "gpc_reg_operand" ""))
14117 (set (match_operand:SI 0 "gpc_reg_operand" "")
14118 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
14119 "TARGET_32BIT && reload_completed"
14120 [(set (match_dup 0)
14121 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))
14123 (compare:CC (match_dup 0)
14128 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
14130 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
14132 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
14134 (set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
14135 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
14138 addc %0,%1,%1\;subfe %0,%1,%0\;addze. %0,%2
14140 [(set_attr "type" "compare")
14141 (set_attr "length" "12,16")])
14144 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
14146 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
14148 (match_operand:DI 2 "gpc_reg_operand" ""))
14150 (set (match_operand:DI 0 "gpc_reg_operand" "")
14151 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
14152 "TARGET_64BIT && reload_completed"
14153 [(set (match_dup 0)
14154 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))
14156 (compare:CC (match_dup 0)
14160 (define_insn_and_split "*gtu<mode>"
14161 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
14162 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
14163 (match_operand:P 2 "reg_or_short_operand" "rI")))]
14167 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
14168 (set (match_dup 0) (neg:P (match_dup 0)))]
14171 (define_insn_and_split "*gtu<mode>_compare"
14172 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
14174 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14175 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
14177 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
14178 (gtu:P (match_dup 1) (match_dup 2)))]
14182 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
14183 (parallel [(set (match_dup 3)
14184 (compare:CC (neg:P (match_dup 0)) (const_int 0)))
14185 (set (match_dup 0) (neg:P (match_dup 0)))])]
14188 (define_insn_and_split "*plus_gtu<mode>"
14189 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
14190 (plus:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
14191 (match_operand:P 2 "reg_or_short_operand" "rI"))
14192 (match_operand:P 3 "reg_or_short_operand" "rI")))]
14195 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
14196 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
14197 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))]
14200 (define_insn_and_split "*plus_gtu<mode>_compare"
14201 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
14203 (plus:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
14204 (match_operand:P 2 "reg_or_short_operand" "I,r,I,r"))
14205 (match_operand:P 3 "gpc_reg_operand" "r,r,r,r"))
14207 (set (match_operand:P 0 "gpc_reg_operand" "=&r,&r,&r,&r")
14208 (plus:P (gtu:P (match_dup 1) (match_dup 2)) (match_dup 3)))]
14211 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
14212 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
14213 (parallel [(set (match_dup 4)
14214 (compare:CC (minus:P (match_dup 3) (match_dup 0))
14216 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))])]
14219 (define_insn "*neg_gtu<mode>"
14220 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
14221 (neg:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
14222 (match_operand:P 2 "reg_or_short_operand" "rI"))))]
14224 "subf%I2c %0,%1,%2\;subfe %0,%0,%0"
14225 [(set_attr "type" "two")
14226 (set_attr "length" "8")])
14229 ;; Define both directions of branch and return. If we need a reload
14230 ;; register, we'd rather use CR0 since it is much easier to copy a
14231 ;; register CC value to there.
14235 (if_then_else (match_operator 1 "branch_comparison_operator"
14237 "cc_reg_operand" "y")
14239 (label_ref (match_operand 0 "" ""))
14244 return output_cbranch (operands[1], \"%l0\", 0, insn);
14246 [(set_attr "type" "branch")])
14250 (if_then_else (match_operator 0 "branch_comparison_operator"
14252 "cc_reg_operand" "y")
14259 return output_cbranch (operands[0], NULL, 0, insn);
14261 [(set_attr "type" "jmpreg")
14262 (set_attr "length" "4")])
14266 (if_then_else (match_operator 1 "branch_comparison_operator"
14268 "cc_reg_operand" "y")
14271 (label_ref (match_operand 0 "" ""))))]
14275 return output_cbranch (operands[1], \"%l0\", 1, insn);
14277 [(set_attr "type" "branch")])
14281 (if_then_else (match_operator 0 "branch_comparison_operator"
14283 "cc_reg_operand" "y")
14290 return output_cbranch (operands[0], NULL, 1, insn);
14292 [(set_attr "type" "jmpreg")
14293 (set_attr "length" "4")])
14295 ;; Logic on condition register values.
14297 ; This pattern matches things like
14298 ; (set (reg:CCEQ 68) (compare:CCEQ (ior:SI (gt:SI (reg:CCFP 68) (const_int 0))
14299 ; (eq:SI (reg:CCFP 68) (const_int 0)))
14301 ; which are generated by the branch logic.
14302 ; Prefer destructive operations where BT = BB (for crXX BT,BA,BB)
14304 (define_insn "*cceq_ior_compare"
14305 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
14306 (compare:CCEQ (match_operator:SI 1 "boolean_operator"
14307 [(match_operator:SI 2
14308 "branch_positive_comparison_operator"
14310 "cc_reg_operand" "y,y")
14312 (match_operator:SI 4
14313 "branch_positive_comparison_operator"
14315 "cc_reg_operand" "0,y")
14319 "cr%q1 %E0,%j2,%j4"
14320 [(set_attr "type" "cr_logical,delayed_cr")])
14322 ; Why is the constant -1 here, but 1 in the previous pattern?
14323 ; Because ~1 has all but the low bit set.
14325 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
14326 (compare:CCEQ (match_operator:SI 1 "boolean_or_operator"
14327 [(not:SI (match_operator:SI 2
14328 "branch_positive_comparison_operator"
14330 "cc_reg_operand" "y,y")
14332 (match_operator:SI 4
14333 "branch_positive_comparison_operator"
14335 "cc_reg_operand" "0,y")
14339 "cr%q1 %E0,%j2,%j4"
14340 [(set_attr "type" "cr_logical,delayed_cr")])
14342 (define_insn "*cceq_rev_compare"
14343 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
14344 (compare:CCEQ (match_operator:SI 1
14345 "branch_positive_comparison_operator"
14347 "cc_reg_operand" "0,y")
14352 [(set_attr "type" "cr_logical,delayed_cr")])
14354 ;; If we are comparing the result of two comparisons, this can be done
14355 ;; using creqv or crxor.
14357 (define_insn_and_split ""
14358 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
14359 (compare:CCEQ (match_operator 1 "branch_comparison_operator"
14360 [(match_operand 2 "cc_reg_operand" "y")
14362 (match_operator 3 "branch_comparison_operator"
14363 [(match_operand 4 "cc_reg_operand" "y")
14368 [(set (match_dup 0) (compare:CCEQ (xor:SI (match_dup 1) (match_dup 3))
14372 int positive_1, positive_2;
14374 positive_1 = branch_positive_comparison_operator (operands[1],
14375 GET_MODE (operands[1]));
14376 positive_2 = branch_positive_comparison_operator (operands[3],
14377 GET_MODE (operands[3]));
14380 operands[1] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[2]),
14381 GET_CODE (operands[1])),
14383 operands[2], const0_rtx);
14384 else if (GET_MODE (operands[1]) != SImode)
14385 operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]), SImode,
14386 operands[2], const0_rtx);
14389 operands[3] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[4]),
14390 GET_CODE (operands[3])),
14392 operands[4], const0_rtx);
14393 else if (GET_MODE (operands[3]) != SImode)
14394 operands[3] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
14395 operands[4], const0_rtx);
14397 if (positive_1 == positive_2)
14399 operands[1] = gen_rtx_NOT (SImode, operands[1]);
14400 operands[5] = constm1_rtx;
14404 operands[5] = const1_rtx;
14408 ;; Unconditional branch and return.
14410 (define_insn "jump"
14412 (label_ref (match_operand 0 "" "")))]
14415 [(set_attr "type" "branch")])
14417 (define_insn "<return_str>return"
14421 [(set_attr "type" "jmpreg")])
14423 (define_expand "indirect_jump"
14424 [(set (pc) (match_operand 0 "register_operand" ""))])
14426 (define_insn "*indirect_jump<mode>"
14427 [(set (pc) (match_operand:P 0 "register_operand" "c,*l"))]
14432 [(set_attr "type" "jmpreg")])
14434 ;; Table jump for switch statements:
14435 (define_expand "tablejump"
14436 [(use (match_operand 0 "" ""))
14437 (use (label_ref (match_operand 1 "" "")))]
14442 emit_jump_insn (gen_tablejumpsi (operands[0], operands[1]));
14444 emit_jump_insn (gen_tablejumpdi (operands[0], operands[1]));
14448 (define_expand "tablejumpsi"
14449 [(set (match_dup 3)
14450 (plus:SI (match_operand:SI 0 "" "")
14452 (parallel [(set (pc) (match_dup 3))
14453 (use (label_ref (match_operand 1 "" "")))])]
14456 { operands[0] = force_reg (SImode, operands[0]);
14457 operands[2] = force_reg (SImode, gen_rtx_LABEL_REF (SImode, operands[1]));
14458 operands[3] = gen_reg_rtx (SImode);
14461 (define_expand "tablejumpdi"
14462 [(set (match_dup 4)
14463 (sign_extend:DI (match_operand:SI 0 "lwa_operand" "")))
14465 (plus:DI (match_dup 4)
14467 (parallel [(set (pc) (match_dup 3))
14468 (use (label_ref (match_operand 1 "" "")))])]
14471 { operands[2] = force_reg (DImode, gen_rtx_LABEL_REF (DImode, operands[1]));
14472 operands[3] = gen_reg_rtx (DImode);
14473 operands[4] = gen_reg_rtx (DImode);
14476 (define_insn "*tablejump<mode>_internal1"
14478 (match_operand:P 0 "register_operand" "c,*l"))
14479 (use (label_ref (match_operand 1 "" "")))]
14484 [(set_attr "type" "jmpreg")])
14491 (define_insn "group_ending_nop"
14492 [(unspec [(const_int 0)] UNSPEC_GRP_END_NOP)]
14496 if (rs6000_cpu_attr == CPU_POWER6)
14497 return \"ori 1,1,0\";
14498 return \"ori 2,2,0\";
14501 ;; Define the subtract-one-and-jump insns, starting with the template
14502 ;; so loop.c knows what to generate.
14504 (define_expand "doloop_end"
14505 [(use (match_operand 0 "" "")) ; loop pseudo
14506 (use (match_operand 1 "" "")) ; iterations; zero if unknown
14507 (use (match_operand 2 "" "")) ; max iterations
14508 (use (match_operand 3 "" "")) ; loop level
14509 (use (match_operand 4 "" "")) ; label
14510 (use (match_operand 5 "" ""))] ; flag: 1 if loop entered at top, else 0
14514 /* Only use this on innermost loops. */
14515 if (INTVAL (operands[3]) > 1)
14519 if (GET_MODE (operands[0]) != DImode)
14521 emit_jump_insn (gen_ctrdi (operands[0], operands[4]));
14525 if (GET_MODE (operands[0]) != SImode)
14527 emit_jump_insn (gen_ctrsi (operands[0], operands[4]));
14532 (define_expand "ctr<mode>"
14533 [(parallel [(set (pc)
14534 (if_then_else (ne (match_operand:P 0 "register_operand" "")
14536 (label_ref (match_operand 1 "" ""))
14539 (plus:P (match_dup 0)
14541 (clobber (match_scratch:CC 2 ""))
14542 (clobber (match_scratch:P 3 ""))])]
14546 ;; We need to be able to do this for any operand, including MEM, or we
14547 ;; will cause reload to blow up since we don't allow output reloads on
14549 ;; For the length attribute to be calculated correctly, the
14550 ;; label MUST be operand 0.
14552 (define_insn "*ctr<mode>_internal1"
14554 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
14556 (label_ref (match_operand 0 "" ""))
14558 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*c*l")
14559 (plus:P (match_dup 1)
14561 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14562 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
14566 if (which_alternative != 0)
14568 else if (get_attr_length (insn) == 4)
14569 return \"bdnz %l0\";
14571 return \"bdz $+8\;b %l0\";
14573 [(set_attr "type" "branch")
14574 (set_attr "length" "*,12,16,16")])
14576 (define_insn "*ctr<mode>_internal2"
14578 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
14581 (label_ref (match_operand 0 "" ""))))
14582 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*c*l")
14583 (plus:P (match_dup 1)
14585 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14586 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
14590 if (which_alternative != 0)
14592 else if (get_attr_length (insn) == 4)
14593 return \"bdz %l0\";
14595 return \"bdnz $+8\;b %l0\";
14597 [(set_attr "type" "branch")
14598 (set_attr "length" "*,12,16,16")])
14600 ;; Similar but use EQ
14602 (define_insn "*ctr<mode>_internal5"
14604 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
14606 (label_ref (match_operand 0 "" ""))
14608 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*c*l")
14609 (plus:P (match_dup 1)
14611 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14612 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
14616 if (which_alternative != 0)
14618 else if (get_attr_length (insn) == 4)
14619 return \"bdz %l0\";
14621 return \"bdnz $+8\;b %l0\";
14623 [(set_attr "type" "branch")
14624 (set_attr "length" "*,12,16,16")])
14626 (define_insn "*ctr<mode>_internal6"
14628 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
14631 (label_ref (match_operand 0 "" ""))))
14632 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*c*l")
14633 (plus:P (match_dup 1)
14635 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14636 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
14640 if (which_alternative != 0)
14642 else if (get_attr_length (insn) == 4)
14643 return \"bdnz %l0\";
14645 return \"bdz $+8\;b %l0\";
14647 [(set_attr "type" "branch")
14648 (set_attr "length" "*,12,16,16")])
14650 ;; Now the splitters if we could not allocate the CTR register
14654 (if_then_else (match_operator 2 "comparison_operator"
14655 [(match_operand:P 1 "gpc_reg_operand" "")
14657 (match_operand 5 "" "")
14658 (match_operand 6 "" "")))
14659 (set (match_operand:P 0 "gpc_reg_operand" "")
14660 (plus:P (match_dup 1) (const_int -1)))
14661 (clobber (match_scratch:CC 3 ""))
14662 (clobber (match_scratch:P 4 ""))]
14664 [(parallel [(set (match_dup 3)
14665 (compare:CC (plus:P (match_dup 1)
14669 (plus:P (match_dup 1)
14671 (set (pc) (if_then_else (match_dup 7)
14675 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
14676 operands[3], const0_rtx); }")
14680 (if_then_else (match_operator 2 "comparison_operator"
14681 [(match_operand:P 1 "gpc_reg_operand" "")
14683 (match_operand 5 "" "")
14684 (match_operand 6 "" "")))
14685 (set (match_operand:P 0 "nonimmediate_operand" "")
14686 (plus:P (match_dup 1) (const_int -1)))
14687 (clobber (match_scratch:CC 3 ""))
14688 (clobber (match_scratch:P 4 ""))]
14689 "reload_completed && ! gpc_reg_operand (operands[0], SImode)"
14690 [(parallel [(set (match_dup 3)
14691 (compare:CC (plus:P (match_dup 1)
14695 (plus:P (match_dup 1)
14699 (set (pc) (if_then_else (match_dup 7)
14703 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
14704 operands[3], const0_rtx); }")
14706 (define_insn "trap"
14707 [(trap_if (const_int 1) (const_int 0))]
14710 [(set_attr "type" "trap")])
14712 (define_expand "ctrap<mode>4"
14713 [(trap_if (match_operator 0 "ordered_comparison_operator"
14714 [(match_operand:GPR 1 "register_operand")
14715 (match_operand:GPR 2 "reg_or_short_operand")])
14716 (match_operand 3 "zero_constant" ""))]
14721 [(trap_if (match_operator 0 "ordered_comparison_operator"
14722 [(match_operand:GPR 1 "register_operand" "r")
14723 (match_operand:GPR 2 "reg_or_short_operand" "rI")])
14726 "t<wd>%V0%I2 %1,%2"
14727 [(set_attr "type" "trap")])
14729 ;; Insns related to generating the function prologue and epilogue.
14731 (define_expand "prologue"
14732 [(use (const_int 0))]
14735 rs6000_emit_prologue ();
14736 if (!TARGET_SCHED_PROLOG)
14737 emit_insn (gen_blockage ());
14741 (define_insn "*movesi_from_cr_one"
14742 [(match_parallel 0 "mfcr_operation"
14743 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
14744 (unspec:SI [(match_operand:CC 2 "cc_reg_operand" "y")
14745 (match_operand 3 "immediate_operand" "n")]
14746 UNSPEC_MOVESI_FROM_CR))])]
14752 for (i = 0; i < XVECLEN (operands[0], 0); i++)
14754 mask = INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
14755 operands[4] = GEN_INT (mask);
14756 output_asm_insn (\"mfcr %1,%4\", operands);
14760 [(set_attr "type" "mfcrf")])
14762 (define_insn "movesi_from_cr"
14763 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14764 (unspec:SI [(reg:CC CR0_REGNO) (reg:CC CR1_REGNO)
14765 (reg:CC CR2_REGNO) (reg:CC CR3_REGNO)
14766 (reg:CC CR4_REGNO) (reg:CC CR5_REGNO)
14767 (reg:CC CR6_REGNO) (reg:CC CR7_REGNO)]
14768 UNSPEC_MOVESI_FROM_CR))]
14771 [(set_attr "type" "mfcr")])
14773 (define_insn "*stmw"
14774 [(match_parallel 0 "stmw_operation"
14775 [(set (match_operand:SI 1 "memory_operand" "=m")
14776 (match_operand:SI 2 "gpc_reg_operand" "r"))])]
14779 [(set_attr "type" "store_ux")])
14781 ; The following comment applies to:
14785 ; return_and_restore_gpregs*
14786 ; return_and_restore_fpregs*
14787 ; return_and_restore_fpregs_aix*
14789 ; The out-of-line save / restore functions expects one input argument.
14790 ; Since those are not standard call_insn's, we must avoid using
14791 ; MATCH_OPERAND for that argument. That way the register rename
14792 ; optimization will not try to rename this register.
14793 ; Each pattern is repeated for each possible register number used in
14794 ; various ABIs (r11, r1, and for some functions r12)
14796 (define_insn "*save_gpregs_<mode>_r11"
14797 [(match_parallel 0 "any_parallel_operand"
14798 [(clobber (reg:P 65))
14799 (use (match_operand:P 1 "symbol_ref_operand" "s"))
14801 (set (match_operand:P 2 "memory_operand" "=m")
14802 (match_operand:P 3 "gpc_reg_operand" "r"))])]
14805 [(set_attr "type" "branch")
14806 (set_attr "length" "4")])
14808 (define_insn "*save_gpregs_<mode>_r12"
14809 [(match_parallel 0 "any_parallel_operand"
14810 [(clobber (reg:P 65))
14811 (use (match_operand:P 1 "symbol_ref_operand" "s"))
14813 (set (match_operand:P 2 "memory_operand" "=m")
14814 (match_operand:P 3 "gpc_reg_operand" "r"))])]
14817 [(set_attr "type" "branch")
14818 (set_attr "length" "4")])
14820 (define_insn "*save_gpregs_<mode>_r1"
14821 [(match_parallel 0 "any_parallel_operand"
14822 [(clobber (reg:P 65))
14823 (use (match_operand:P 1 "symbol_ref_operand" "s"))
14825 (set (match_operand:P 2 "memory_operand" "=m")
14826 (match_operand:P 3 "gpc_reg_operand" "r"))])]
14829 [(set_attr "type" "branch")
14830 (set_attr "length" "4")])
14832 (define_insn "*save_fpregs_<mode>_r11"
14833 [(match_parallel 0 "any_parallel_operand"
14834 [(clobber (reg:P 65))
14835 (use (match_operand:P 1 "symbol_ref_operand" "s"))
14837 (set (match_operand:DF 2 "memory_operand" "=m")
14838 (match_operand:DF 3 "gpc_reg_operand" "d"))])]
14841 [(set_attr "type" "branch")
14842 (set_attr "length" "4")])
14844 (define_insn "*save_fpregs_<mode>_r12"
14845 [(match_parallel 0 "any_parallel_operand"
14846 [(clobber (reg:P 65))
14847 (use (match_operand:P 1 "symbol_ref_operand" "s"))
14849 (set (match_operand:DF 2 "memory_operand" "=m")
14850 (match_operand:DF 3 "gpc_reg_operand" "d"))])]
14853 [(set_attr "type" "branch")
14854 (set_attr "length" "4")])
14856 (define_insn "*save_fpregs_<mode>_r1"
14857 [(match_parallel 0 "any_parallel_operand"
14858 [(clobber (reg:P 65))
14859 (use (match_operand:P 1 "symbol_ref_operand" "s"))
14861 (set (match_operand:DF 2 "memory_operand" "=m")
14862 (match_operand:DF 3 "gpc_reg_operand" "d"))])]
14865 [(set_attr "type" "branch")
14866 (set_attr "length" "4")])
14868 ; This is to explain that changes to the stack pointer should
14869 ; not be moved over loads from or stores to stack memory.
14870 (define_insn "stack_tie"
14871 [(match_parallel 0 "tie_operand"
14872 [(set (mem:BLK (reg 1)) (const_int 0))])]
14875 [(set_attr "length" "0")])
14877 (define_expand "epilogue"
14878 [(use (const_int 0))]
14881 if (!TARGET_SCHED_PROLOG)
14882 emit_insn (gen_blockage ());
14883 rs6000_emit_epilogue (FALSE);
14887 ; On some processors, doing the mtcrf one CC register at a time is
14888 ; faster (like on the 604e). On others, doing them all at once is
14889 ; faster; for instance, on the 601 and 750.
14891 (define_expand "movsi_to_cr_one"
14892 [(set (match_operand:CC 0 "cc_reg_operand" "")
14893 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "")
14894 (match_dup 2)] UNSPEC_MOVESI_TO_CR))]
14896 "operands[2] = GEN_INT (1 << (75 - REGNO (operands[0])));")
14898 (define_insn "*movsi_to_cr"
14899 [(match_parallel 0 "mtcrf_operation"
14900 [(set (match_operand:CC 1 "cc_reg_operand" "=y")
14901 (unspec:CC [(match_operand:SI 2 "gpc_reg_operand" "r")
14902 (match_operand 3 "immediate_operand" "n")]
14903 UNSPEC_MOVESI_TO_CR))])]
14909 for (i = 0; i < XVECLEN (operands[0], 0); i++)
14910 mask |= INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
14911 operands[4] = GEN_INT (mask);
14912 return \"mtcrf %4,%2\";
14914 [(set_attr "type" "mtcr")])
14916 (define_insn "*mtcrfsi"
14917 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
14918 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
14919 (match_operand 2 "immediate_operand" "n")]
14920 UNSPEC_MOVESI_TO_CR))]
14921 "GET_CODE (operands[0]) == REG
14922 && CR_REGNO_P (REGNO (operands[0]))
14923 && GET_CODE (operands[2]) == CONST_INT
14924 && INTVAL (operands[2]) == 1 << (75 - REGNO (operands[0]))"
14926 [(set_attr "type" "mtcr")])
14928 ; The load-multiple instructions have similar properties.
14929 ; Note that "load_multiple" is a name known to the machine-independent
14930 ; code that actually corresponds to the PowerPC load-string.
14932 (define_insn "*lmw"
14933 [(match_parallel 0 "lmw_operation"
14934 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
14935 (match_operand:SI 2 "memory_operand" "m"))])]
14938 [(set_attr "type" "load_ux")
14939 (set_attr "cell_micro" "always")])
14941 (define_insn "*return_internal_<mode>"
14943 (use (match_operand:P 0 "register_operand" "lc"))]
14946 [(set_attr "type" "jmpreg")])
14948 ; FIXME: This would probably be somewhat simpler if the Cygnus sibcall
14949 ; stuff was in GCC. Oh, and "any_parallel_operand" is a bit flexible...
14951 ; The following comment applies to:
14955 ; return_and_restore_gpregs*
14956 ; return_and_restore_fpregs*
14957 ; return_and_restore_fpregs_aix*
14959 ; The out-of-line save / restore functions expects one input argument.
14960 ; Since those are not standard call_insn's, we must avoid using
14961 ; MATCH_OPERAND for that argument. That way the register rename
14962 ; optimization will not try to rename this register.
14963 ; Each pattern is repeated for each possible register number used in
14964 ; various ABIs (r11, r1, and for some functions r12)
14966 (define_insn "*restore_gpregs_<mode>_r11"
14967 [(match_parallel 0 "any_parallel_operand"
14968 [(clobber (match_operand:P 1 "register_operand" "=l"))
14969 (use (match_operand:P 2 "symbol_ref_operand" "s"))
14971 (set (match_operand:P 3 "gpc_reg_operand" "=r")
14972 (match_operand:P 4 "memory_operand" "m"))])]
14975 [(set_attr "type" "branch")
14976 (set_attr "length" "4")])
14978 (define_insn "*restore_gpregs_<mode>_r12"
14979 [(match_parallel 0 "any_parallel_operand"
14980 [(clobber (match_operand:P 1 "register_operand" "=l"))
14981 (use (match_operand:P 2 "symbol_ref_operand" "s"))
14983 (set (match_operand:P 3 "gpc_reg_operand" "=r")
14984 (match_operand:P 4 "memory_operand" "m"))])]
14987 [(set_attr "type" "branch")
14988 (set_attr "length" "4")])
14990 (define_insn "*restore_gpregs_<mode>_r1"
14991 [(match_parallel 0 "any_parallel_operand"
14992 [(clobber (match_operand:P 1 "register_operand" "=l"))
14993 (use (match_operand:P 2 "symbol_ref_operand" "s"))
14995 (set (match_operand:P 3 "gpc_reg_operand" "=r")
14996 (match_operand:P 4 "memory_operand" "m"))])]
14999 [(set_attr "type" "branch")
15000 (set_attr "length" "4")])
15002 (define_insn "*return_and_restore_gpregs_<mode>_r11"
15003 [(match_parallel 0 "any_parallel_operand"
15005 (clobber (match_operand:P 1 "register_operand" "=l"))
15006 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15008 (set (match_operand:P 3 "gpc_reg_operand" "=r")
15009 (match_operand:P 4 "memory_operand" "m"))])]
15012 [(set_attr "type" "branch")
15013 (set_attr "length" "4")])
15015 (define_insn "*return_and_restore_gpregs_<mode>_r12"
15016 [(match_parallel 0 "any_parallel_operand"
15018 (clobber (match_operand:P 1 "register_operand" "=l"))
15019 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15021 (set (match_operand:P 3 "gpc_reg_operand" "=r")
15022 (match_operand:P 4 "memory_operand" "m"))])]
15025 [(set_attr "type" "branch")
15026 (set_attr "length" "4")])
15028 (define_insn "*return_and_restore_gpregs_<mode>_r1"
15029 [(match_parallel 0 "any_parallel_operand"
15031 (clobber (match_operand:P 1 "register_operand" "=l"))
15032 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15034 (set (match_operand:P 3 "gpc_reg_operand" "=r")
15035 (match_operand:P 4 "memory_operand" "m"))])]
15038 [(set_attr "type" "branch")
15039 (set_attr "length" "4")])
15041 (define_insn "*return_and_restore_fpregs_<mode>_r11"
15042 [(match_parallel 0 "any_parallel_operand"
15044 (clobber (match_operand:P 1 "register_operand" "=l"))
15045 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15047 (set (match_operand:DF 3 "gpc_reg_operand" "=d")
15048 (match_operand:DF 4 "memory_operand" "m"))])]
15051 [(set_attr "type" "branch")
15052 (set_attr "length" "4")])
15054 (define_insn "*return_and_restore_fpregs_<mode>_r12"
15055 [(match_parallel 0 "any_parallel_operand"
15057 (clobber (match_operand:P 1 "register_operand" "=l"))
15058 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15060 (set (match_operand:DF 3 "gpc_reg_operand" "=d")
15061 (match_operand:DF 4 "memory_operand" "m"))])]
15064 [(set_attr "type" "branch")
15065 (set_attr "length" "4")])
15067 (define_insn "*return_and_restore_fpregs_<mode>_r1"
15068 [(match_parallel 0 "any_parallel_operand"
15070 (clobber (match_operand:P 1 "register_operand" "=l"))
15071 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15073 (set (match_operand:DF 3 "gpc_reg_operand" "=d")
15074 (match_operand:DF 4 "memory_operand" "m"))])]
15077 [(set_attr "type" "branch")
15078 (set_attr "length" "4")])
15080 (define_insn "*return_and_restore_fpregs_aix_<mode>_r11"
15081 [(match_parallel 0 "any_parallel_operand"
15083 (use (match_operand:P 1 "register_operand" "l"))
15084 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15086 (set (match_operand:DF 3 "gpc_reg_operand" "=d")
15087 (match_operand:DF 4 "memory_operand" "m"))])]
15090 [(set_attr "type" "branch")
15091 (set_attr "length" "4")])
15093 (define_insn "*return_and_restore_fpregs_aix_<mode>_r1"
15094 [(match_parallel 0 "any_parallel_operand"
15096 (use (match_operand:P 1 "register_operand" "l"))
15097 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15099 (set (match_operand:DF 3 "gpc_reg_operand" "=d")
15100 (match_operand:DF 4 "memory_operand" "m"))])]
15103 [(set_attr "type" "branch")
15104 (set_attr "length" "4")])
15106 ; This is used in compiling the unwind routines.
15107 (define_expand "eh_return"
15108 [(use (match_operand 0 "general_operand" ""))]
15113 emit_insn (gen_eh_set_lr_si (operands[0]));
15115 emit_insn (gen_eh_set_lr_di (operands[0]));
15119 ; We can't expand this before we know where the link register is stored.
15120 (define_insn "eh_set_lr_<mode>"
15121 [(unspec_volatile [(match_operand:P 0 "register_operand" "r")]
15123 (clobber (match_scratch:P 1 "=&b"))]
15128 [(unspec_volatile [(match_operand 0 "register_operand" "")] UNSPECV_EH_RR)
15129 (clobber (match_scratch 1 ""))]
15134 rs6000_emit_eh_reg_restore (operands[0], operands[1]);
15138 (define_insn "prefetch"
15139 [(prefetch (match_operand 0 "indexed_or_indirect_address" "a")
15140 (match_operand:SI 1 "const_int_operand" "n")
15141 (match_operand:SI 2 "const_int_operand" "n"))]
15145 if (GET_CODE (operands[0]) == REG)
15146 return INTVAL (operands[1]) ? \"dcbtst 0,%0\" : \"dcbt 0,%0\";
15147 return INTVAL (operands[1]) ? \"dcbtst %a0\" : \"dcbt %a0\";
15149 [(set_attr "type" "load")])
15151 (define_insn "bpermd_<mode>"
15152 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
15153 (unspec:P [(match_operand:P 1 "gpc_reg_operand" "r")
15154 (match_operand:P 2 "gpc_reg_operand" "r")] UNSPEC_BPERM))]
15157 [(set_attr "type" "popcnt")])
15160 ;; Builtin fma support. Handle
15161 ;; Note that the conditions for expansion are in the FMA_F iterator.
15163 (define_expand "fma<mode>4"
15164 [(set (match_operand:FMA_F 0 "register_operand" "")
15166 (match_operand:FMA_F 1 "register_operand" "")
15167 (match_operand:FMA_F 2 "register_operand" "")
15168 (match_operand:FMA_F 3 "register_operand" "")))]
15172 ; Altivec only has fma and nfms.
15173 (define_expand "fms<mode>4"
15174 [(set (match_operand:FMA_F 0 "register_operand" "")
15176 (match_operand:FMA_F 1 "register_operand" "")
15177 (match_operand:FMA_F 2 "register_operand" "")
15178 (neg:FMA_F (match_operand:FMA_F 3 "register_operand" ""))))]
15179 "!VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
15182 ;; If signed zeros are ignored, -(a * b - c) = -a * b + c.
15183 (define_expand "fnma<mode>4"
15184 [(set (match_operand:FMA_F 0 "register_operand" "")
15187 (match_operand:FMA_F 1 "register_operand" "")
15188 (match_operand:FMA_F 2 "register_operand" "")
15189 (neg:FMA_F (match_operand:FMA_F 3 "register_operand" "")))))]
15190 "!HONOR_SIGNED_ZEROS (<MODE>mode)"
15193 ;; If signed zeros are ignored, -(a * b + c) = -a * b - c.
15194 (define_expand "fnms<mode>4"
15195 [(set (match_operand:FMA_F 0 "register_operand" "")
15198 (match_operand:FMA_F 1 "register_operand" "")
15199 (match_operand:FMA_F 2 "register_operand" "")
15200 (match_operand:FMA_F 3 "register_operand" ""))))]
15201 "!HONOR_SIGNED_ZEROS (<MODE>mode) && !VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
15204 ; Not an official optab name, but used from builtins.
15205 (define_expand "nfma<mode>4"
15206 [(set (match_operand:FMA_F 0 "register_operand" "")
15209 (match_operand:FMA_F 1 "register_operand" "")
15210 (match_operand:FMA_F 2 "register_operand" "")
15211 (match_operand:FMA_F 3 "register_operand" ""))))]
15212 "!VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
15215 ; Not an official optab name, but used from builtins.
15216 (define_expand "nfms<mode>4"
15217 [(set (match_operand:FMA_F 0 "register_operand" "")
15220 (match_operand:FMA_F 1 "register_operand" "")
15221 (match_operand:FMA_F 2 "register_operand" "")
15222 (neg:FMA_F (match_operand:FMA_F 3 "register_operand" "")))))]
15226 (define_expand "rs6000_get_timebase"
15227 [(use (match_operand:DI 0 "gpc_reg_operand" ""))]
15230 if (TARGET_POWERPC64)
15231 emit_insn (gen_rs6000_mftb_di (operands[0]));
15233 emit_insn (gen_rs6000_get_timebase_ppc32 (operands[0]));
15237 (define_insn "rs6000_get_timebase_ppc32"
15238 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
15239 (unspec_volatile:DI [(const_int 0)] UNSPECV_MFTB))
15240 (clobber (match_scratch:SI 1 "=r"))
15241 (clobber (match_scratch:CC 2 "=y"))]
15242 "!TARGET_POWERPC64"
15244 if (WORDS_BIG_ENDIAN)
15247 return "mfspr %0,269\;"
15255 return "mftbu %0\;"
15264 return "mfspr %L0,269\;"
15272 return "mftbu %L0\;"
15280 (define_insn "rs6000_mftb_<mode>"
15281 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
15282 (unspec_volatile:P [(const_int 0)] UNSPECV_MFTB))]
15286 return "mfspr %0,268";
15293 (include "sync.md")
15294 (include "vector.md")
15296 (include "altivec.md")
15299 (include "paired.md")
15300 (include "crypto.md")