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
133 ;; UNSPEC_VOLATILE usage
136 (define_c_enum "unspecv"
138 UNSPECV_LL ; load-locked
139 UNSPECV_SC ; store-conditional
140 UNSPECV_PROBE_STACK_RANGE ; probe range of stack addresses
141 UNSPECV_EH_RR ; eh_reg_restore
142 UNSPECV_ISYNC ; isync instruction
143 UNSPECV_MFTB ; move from time base
147 ;; Define an insn type attribute. This is used in function unit delay
149 (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"
150 (const_string "integer"))
152 ;; Define floating point instruction sub-types for use with Xfpu.md
153 (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"))
155 ;; Length (in bytes).
156 ; '(pc)' in the following doesn't include the instruction itself; it is
157 ; calculated as if the instruction had zero size.
158 (define_attr "length" ""
159 (if_then_else (eq_attr "type" "branch")
160 (if_then_else (and (ge (minus (match_dup 0) (pc))
162 (lt (minus (match_dup 0) (pc))
168 ;; Processor type -- this attribute must exactly match the processor_type
169 ;; enumeration in rs6000-opts.h.
171 "ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630,
172 ppc750,ppc7400,ppc7450,
173 ppc403,ppc405,ppc440,ppc476,
174 ppc8540,ppc8548,ppce300c2,ppce300c3,ppce500mc,ppce500mc64,ppce5500,ppce6500,
175 power4,power5,power6,power7,power8,
176 rs64a,mpccore,cell,ppca2,titan"
177 (const (symbol_ref "rs6000_cpu_attr")))
180 ;; If this instruction is microcoded on the CELL processor
181 ; The default for load extended, the recorded instructions and rotate/shifts by a variable is always microcoded
182 (define_attr "cell_micro" "not,conditional,always"
183 (if_then_else (eq_attr "type" "compare,delayed_compare,imul_compare,lmul_compare,load_ext,load_ext_ux,var_shift_rotate,var_delayed_compare")
184 (const_string "always")
185 (const_string "not")))
187 (automata_option "ndfa")
200 (include "e300c2c3.md")
201 (include "e500mc.md")
202 (include "e500mc64.md")
205 (include "power4.md")
206 (include "power5.md")
207 (include "power6.md")
208 (include "power7.md")
214 (include "predicates.md")
215 (include "constraints.md")
217 (include "darwin.md")
222 ; This mode iterator allows :GPR to be used to indicate the allowable size
223 ; of whole values in GPRs.
224 (define_mode_iterator GPR [SI (DI "TARGET_POWERPC64")])
226 ; Any supported integer mode.
227 (define_mode_iterator INT [QI HI SI DI TI PTI])
229 ; Any supported integer mode that fits in one register.
230 (define_mode_iterator INT1 [QI HI SI (DI "TARGET_POWERPC64")])
232 ; extend modes for DImode
233 (define_mode_iterator QHSI [QI HI SI])
235 ; SImode or DImode, even if DImode doesn't fit in GPRs.
236 (define_mode_iterator SDI [SI DI])
238 ; The size of a pointer. Also, the size of the value that a record-condition
239 ; (one with a '.') will compare; and the size used for arithmetic carries.
240 (define_mode_iterator P [(SI "TARGET_32BIT") (DI "TARGET_64BIT")])
242 ; Iterator to add PTImode along with TImode (TImode can go in VSX registers,
243 ; PTImode is GPR only)
244 (define_mode_iterator TI2 [TI PTI])
246 ; Any hardware-supported floating-point mode
247 (define_mode_iterator FP [
248 (SF "TARGET_HARD_FLOAT
249 && ((TARGET_FPRS && TARGET_SINGLE_FLOAT) || TARGET_E500_SINGLE)")
250 (DF "TARGET_HARD_FLOAT
251 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)")
252 (TF "!TARGET_IEEEQUAD
254 && (TARGET_FPRS || TARGET_E500_DOUBLE)
255 && TARGET_LONG_DOUBLE_128")
259 ; Any fma capable floating-point mode.
260 (define_mode_iterator FMA_F [
261 (SF "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT")
262 (DF "(TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT)
263 || VECTOR_UNIT_VSX_P (DFmode)")
264 (V2SF "TARGET_PAIRED_FLOAT")
265 (V4SF "VECTOR_UNIT_ALTIVEC_OR_VSX_P (V4SFmode)")
266 (V2DF "VECTOR_UNIT_ALTIVEC_OR_VSX_P (V2DFmode)")
269 ; Floating point move iterators to combine binary and decimal moves
270 (define_mode_iterator FMOVE32 [SF SD])
271 (define_mode_iterator FMOVE64 [DF DD])
272 (define_mode_iterator FMOVE64X [DI DF DD])
273 (define_mode_iterator FMOVE128 [(TF "!TARGET_IEEEQUAD && TARGET_LONG_DOUBLE_128")
274 (TD "TARGET_HARD_FLOAT && TARGET_FPRS")])
276 ; Whether a floating point move is ok, don't allow SD without hardware FP
277 (define_mode_attr fmove_ok [(SF "")
279 (SD "TARGET_HARD_FLOAT && TARGET_FPRS")
282 ; Convert REAL_VALUE to the appropriate bits
283 (define_mode_attr real_value_to_target [(SF "REAL_VALUE_TO_TARGET_SINGLE")
284 (DF "REAL_VALUE_TO_TARGET_DOUBLE")
285 (SD "REAL_VALUE_TO_TARGET_DECIMAL32")
286 (DD "REAL_VALUE_TO_TARGET_DECIMAL64")])
288 ; Definitions for load to 32-bit fpr register
289 (define_mode_attr f32_lr [(SF "f") (SD "wz")])
290 (define_mode_attr f32_lm [(SF "m") (SD "Z")])
291 (define_mode_attr f32_li [(SF "lfs%U1%X1 %0,%1") (SD "lfiwzx %0,%y1")])
293 ; Definitions for store from 32-bit fpr register
294 (define_mode_attr f32_sr [(SF "f") (SD "wx")])
295 (define_mode_attr f32_sm [(SF "m") (SD "Z")])
296 (define_mode_attr f32_si [(SF "stfs%U0%X0 %1,%0") (SD "stfiwx %1,%y0")])
298 ; These modes do not fit in integer registers in 32-bit mode.
299 ; but on e500v2, the gpr are 64 bit registers
300 (define_mode_iterator DIFD [DI (DF "!TARGET_E500_DOUBLE") DD])
302 ; Iterator for reciprocal estimate instructions
303 (define_mode_iterator RECIPF [SF DF V4SF V2DF])
305 ; Iterator for just SF/DF
306 (define_mode_iterator SFDF [SF DF])
308 ; Conditional returns.
309 (define_code_iterator any_return [return simple_return])
310 (define_code_attr return_pred [(return "direct_return ()")
311 (simple_return "1")])
312 (define_code_attr return_str [(return "") (simple_return "simple_")])
314 ; Various instructions that come in SI and DI forms.
315 ; A generic w/d attribute, for things like cmpw/cmpd.
316 (define_mode_attr wd [(QI "b")
326 (define_mode_attr dbits [(QI "56") (HI "48") (SI "32")])
328 ;; ISEL/ISEL64 target selection
329 (define_mode_attr sel [(SI "") (DI "64")])
331 ;; Suffix for reload patterns
332 (define_mode_attr ptrsize [(SI "32bit")
335 (define_mode_attr tptrsize [(SI "TARGET_32BIT")
336 (DI "TARGET_64BIT")])
338 (define_mode_attr mptrsize [(SI "si")
341 (define_mode_attr ptrload [(SI "lwz")
344 (define_mode_attr ptrm [(SI "m")
347 (define_mode_attr rreg [(SF "f")
352 (define_mode_attr rreg2 [(SF "f")
355 (define_mode_attr SI_CONVERT_FP [(SF "TARGET_FCFIDS")
356 (DF "TARGET_FCFID")])
358 (define_mode_attr E500_CONVERT [(SF "!TARGET_FPRS")
359 (DF "TARGET_E500_DOUBLE")])
361 (define_mode_attr TARGET_FLOAT [(SF "TARGET_SINGLE_FLOAT")
362 (DF "TARGET_DOUBLE_FLOAT")])
364 ;; Start with fixed-point load and store insns. Here we put only the more
365 ;; complex forms. Basic data transfer is done later.
367 (define_expand "zero_extend<mode>di2"
368 [(set (match_operand:DI 0 "gpc_reg_operand" "")
369 (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "")))]
373 (define_insn "*zero_extend<mode>di2_internal1"
374 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
375 (zero_extend:DI (match_operand:QHSI 1 "reg_or_mem_operand" "m,r")))]
379 rldicl %0,%1,0,<dbits>"
380 [(set_attr_alternative "type"
382 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
383 (const_string "load_ux")
385 (match_test "update_address_mem (operands[1], VOIDmode)")
386 (const_string "load_u")
387 (const_string "load")))
388 (const_string "*")])])
390 (define_insn "*zero_extend<mode>di2_internal2"
391 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
392 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "r,r"))
394 (clobber (match_scratch:DI 2 "=r,r"))]
397 rldicl. %2,%1,0,<dbits>
399 [(set_attr "type" "compare")
400 (set_attr "length" "4,8")])
403 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
404 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" ""))
406 (clobber (match_scratch:DI 2 ""))]
407 "TARGET_POWERPC64 && reload_completed"
409 (zero_extend:DI (match_dup 1)))
411 (compare:CC (match_dup 2)
415 (define_insn "*zero_extend<mode>di2_internal3"
416 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
417 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "r,r"))
419 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
420 (zero_extend:DI (match_dup 1)))]
423 rldicl. %0,%1,0,<dbits>
425 [(set_attr "type" "compare")
426 (set_attr "length" "4,8")])
429 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
430 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" ""))
432 (set (match_operand:DI 0 "gpc_reg_operand" "")
433 (zero_extend:DI (match_dup 1)))]
434 "TARGET_POWERPC64 && reload_completed"
436 (zero_extend:DI (match_dup 1)))
438 (compare:CC (match_dup 0)
442 (define_insn "extendqidi2"
443 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
444 (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r")))]
447 [(set_attr "type" "exts")])
450 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
451 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
453 (clobber (match_scratch:DI 2 "=r,r"))]
458 [(set_attr "type" "compare")
459 (set_attr "length" "4,8")])
462 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
463 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
465 (clobber (match_scratch:DI 2 ""))]
466 "TARGET_POWERPC64 && reload_completed"
468 (sign_extend:DI (match_dup 1)))
470 (compare:CC (match_dup 2)
475 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
476 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
478 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
479 (sign_extend:DI (match_dup 1)))]
484 [(set_attr "type" "compare")
485 (set_attr "length" "4,8")])
488 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
489 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
491 (set (match_operand:DI 0 "gpc_reg_operand" "")
492 (sign_extend:DI (match_dup 1)))]
493 "TARGET_POWERPC64 && reload_completed"
495 (sign_extend:DI (match_dup 1)))
497 (compare:CC (match_dup 0)
501 (define_expand "extendhidi2"
502 [(set (match_operand:DI 0 "gpc_reg_operand" "")
503 (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "")))]
508 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
509 (sign_extend:DI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
510 "TARGET_POWERPC64 && rs6000_gen_cell_microcode"
514 [(set_attr_alternative "type"
516 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
517 (const_string "load_ext_ux")
519 (match_test "update_address_mem (operands[1], VOIDmode)")
520 (const_string "load_ext_u")
521 (const_string "load_ext")))
522 (const_string "exts")])])
525 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
526 (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r")))]
527 "TARGET_POWERPC64 && !rs6000_gen_cell_microcode"
529 [(set_attr "type" "exts")])
532 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
533 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
535 (clobber (match_scratch:DI 2 "=r,r"))]
540 [(set_attr "type" "compare")
541 (set_attr "length" "4,8")])
544 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
545 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
547 (clobber (match_scratch:DI 2 ""))]
548 "TARGET_POWERPC64 && reload_completed"
550 (sign_extend:DI (match_dup 1)))
552 (compare:CC (match_dup 2)
557 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
558 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
560 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
561 (sign_extend:DI (match_dup 1)))]
566 [(set_attr "type" "compare")
567 (set_attr "length" "4,8")])
570 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
571 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
573 (set (match_operand:DI 0 "gpc_reg_operand" "")
574 (sign_extend:DI (match_dup 1)))]
575 "TARGET_POWERPC64 && reload_completed"
577 (sign_extend:DI (match_dup 1)))
579 (compare:CC (match_dup 0)
583 (define_expand "extendsidi2"
584 [(set (match_operand:DI 0 "gpc_reg_operand" "")
585 (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")))]
590 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
591 (sign_extend:DI (match_operand:SI 1 "lwa_operand" "m,r")))]
592 "TARGET_POWERPC64 && rs6000_gen_cell_microcode"
596 [(set_attr_alternative "type"
598 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
599 (const_string "load_ext_ux")
601 (match_test "update_address_mem (operands[1], VOIDmode)")
602 (const_string "load_ext_u")
603 (const_string "load_ext")))
604 (const_string "exts")])])
607 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
608 (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r")))]
609 "TARGET_POWERPC64 && !rs6000_gen_cell_microcode"
611 [(set_attr "type" "exts")])
614 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
615 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
617 (clobber (match_scratch:DI 2 "=r,r"))]
622 [(set_attr "type" "compare")
623 (set_attr "length" "4,8")])
626 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
627 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
629 (clobber (match_scratch:DI 2 ""))]
630 "TARGET_POWERPC64 && reload_completed"
632 (sign_extend:DI (match_dup 1)))
634 (compare:CC (match_dup 2)
639 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
640 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
642 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
643 (sign_extend:DI (match_dup 1)))]
648 [(set_attr "type" "compare")
649 (set_attr "length" "4,8")])
652 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
653 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
655 (set (match_operand:DI 0 "gpc_reg_operand" "")
656 (sign_extend:DI (match_dup 1)))]
657 "TARGET_POWERPC64 && reload_completed"
659 (sign_extend:DI (match_dup 1)))
661 (compare:CC (match_dup 0)
665 (define_expand "zero_extendqisi2"
666 [(set (match_operand:SI 0 "gpc_reg_operand" "")
667 (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "")))]
672 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
673 (zero_extend:SI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
678 [(set_attr_alternative "type"
680 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
681 (const_string "load_ux")
683 (match_test "update_address_mem (operands[1], VOIDmode)")
684 (const_string "load_u")
685 (const_string "load")))
686 (const_string "*")])])
689 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
690 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
692 (clobber (match_scratch:SI 2 "=r,r"))]
697 [(set_attr "type" "fast_compare,compare")
698 (set_attr "length" "4,8")])
701 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
702 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
704 (clobber (match_scratch:SI 2 ""))]
707 (zero_extend:SI (match_dup 1)))
709 (compare:CC (match_dup 2)
714 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
715 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
717 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
718 (zero_extend:SI (match_dup 1)))]
723 [(set_attr "type" "fast_compare,compare")
724 (set_attr "length" "4,8")])
727 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
728 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
730 (set (match_operand:SI 0 "gpc_reg_operand" "")
731 (zero_extend:SI (match_dup 1)))]
734 (zero_extend:SI (match_dup 1)))
736 (compare:CC (match_dup 0)
740 (define_insn "extendqisi2"
741 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
742 (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r")))]
745 [(set_attr "type" "exts")])
748 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
749 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
751 (clobber (match_scratch:SI 2 "=r,r"))]
756 [(set_attr "type" "compare")
757 (set_attr "length" "4,8")])
760 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
761 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
763 (clobber (match_scratch:SI 2 ""))]
766 (sign_extend:SI (match_dup 1)))
768 (compare:CC (match_dup 2)
773 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
774 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
776 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
777 (sign_extend:SI (match_dup 1)))]
782 [(set_attr "type" "compare")
783 (set_attr "length" "4,8")])
786 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
787 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
789 (set (match_operand:SI 0 "gpc_reg_operand" "")
790 (sign_extend:SI (match_dup 1)))]
793 (sign_extend:SI (match_dup 1)))
795 (compare:CC (match_dup 0)
800 [(set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
801 (zero_extend:HI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
806 [(set_attr_alternative "type"
808 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
809 (const_string "load_ux")
811 (match_test "update_address_mem (operands[1], VOIDmode)")
812 (const_string "load_u")
813 (const_string "load")))
814 (const_string "*")])])
817 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
818 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
820 (clobber (match_scratch:HI 2 "=r,r"))]
825 [(set_attr "type" "fast_compare,compare")
826 (set_attr "length" "4,8")])
829 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
830 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
832 (clobber (match_scratch:HI 2 ""))]
835 (zero_extend:HI (match_dup 1)))
837 (compare:CC (match_dup 2)
842 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
843 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
845 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
846 (zero_extend:HI (match_dup 1)))]
851 [(set_attr "type" "fast_compare,compare")
852 (set_attr "length" "4,8")])
855 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
856 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
858 (set (match_operand:HI 0 "gpc_reg_operand" "")
859 (zero_extend:HI (match_dup 1)))]
862 (zero_extend:HI (match_dup 1)))
864 (compare:CC (match_dup 0)
868 (define_insn "extendqihi2"
869 [(set (match_operand:HI 0 "gpc_reg_operand" "=r")
870 (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r")))]
873 [(set_attr "type" "exts")])
876 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
877 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
879 (clobber (match_scratch:HI 2 "=r,r"))]
884 [(set_attr "type" "compare")
885 (set_attr "length" "4,8")])
888 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
889 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
891 (clobber (match_scratch:HI 2 ""))]
894 (sign_extend:HI (match_dup 1)))
896 (compare:CC (match_dup 2)
901 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
902 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
904 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
905 (sign_extend:HI (match_dup 1)))]
910 [(set_attr "type" "compare")
911 (set_attr "length" "4,8")])
914 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
915 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
917 (set (match_operand:HI 0 "gpc_reg_operand" "")
918 (sign_extend:HI (match_dup 1)))]
921 (sign_extend:HI (match_dup 1)))
923 (compare:CC (match_dup 0)
927 (define_expand "zero_extendhisi2"
928 [(set (match_operand:SI 0 "gpc_reg_operand" "")
929 (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
934 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
935 (zero_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
939 rlwinm %0,%1,0,0xffff"
940 [(set_attr_alternative "type"
942 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
943 (const_string "load_ux")
945 (match_test "update_address_mem (operands[1], VOIDmode)")
946 (const_string "load_u")
947 (const_string "load")))
948 (const_string "*")])])
951 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
952 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
954 (clobber (match_scratch:SI 2 "=r,r"))]
959 [(set_attr "type" "fast_compare,compare")
960 (set_attr "length" "4,8")])
963 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
964 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
966 (clobber (match_scratch:SI 2 ""))]
969 (zero_extend:SI (match_dup 1)))
971 (compare:CC (match_dup 2)
976 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
977 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
979 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
980 (zero_extend:SI (match_dup 1)))]
985 [(set_attr "type" "fast_compare,compare")
986 (set_attr "length" "4,8")])
989 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
990 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
992 (set (match_operand:SI 0 "gpc_reg_operand" "")
993 (zero_extend:SI (match_dup 1)))]
996 (zero_extend:SI (match_dup 1)))
998 (compare:CC (match_dup 0)
1002 (define_expand "extendhisi2"
1003 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1004 (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
1009 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1010 (sign_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
1011 "rs6000_gen_cell_microcode"
1015 [(set_attr_alternative "type"
1017 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
1018 (const_string "load_ext_ux")
1020 (match_test "update_address_mem (operands[1], VOIDmode)")
1021 (const_string "load_ext_u")
1022 (const_string "load_ext")))
1023 (const_string "exts")])])
1026 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1027 (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r")))]
1028 "!rs6000_gen_cell_microcode"
1030 [(set_attr "type" "exts")])
1033 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1034 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
1036 (clobber (match_scratch:SI 2 "=r,r"))]
1041 [(set_attr "type" "compare")
1042 (set_attr "length" "4,8")])
1045 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
1046 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1048 (clobber (match_scratch:SI 2 ""))]
1051 (sign_extend:SI (match_dup 1)))
1053 (compare:CC (match_dup 2)
1058 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1059 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
1061 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1062 (sign_extend:SI (match_dup 1)))]
1067 [(set_attr "type" "compare")
1068 (set_attr "length" "4,8")])
1071 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
1072 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1074 (set (match_operand:SI 0 "gpc_reg_operand" "")
1075 (sign_extend:SI (match_dup 1)))]
1078 (sign_extend:SI (match_dup 1)))
1080 (compare:CC (match_dup 0)
1084 ;; IBM 405, 440, 464 and 476 half-word multiplication operations.
1086 (define_insn "*macchwc"
1087 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1088 (compare:CC (plus:SI (mult:SI (ashiftrt:SI
1089 (match_operand:SI 2 "gpc_reg_operand" "r")
1092 (match_operand:HI 1 "gpc_reg_operand" "r")))
1093 (match_operand:SI 4 "gpc_reg_operand" "0"))
1095 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1096 (plus:SI (mult:SI (ashiftrt:SI
1104 [(set_attr "type" "imul3")])
1106 (define_insn "*macchw"
1107 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1108 (plus:SI (mult:SI (ashiftrt:SI
1109 (match_operand:SI 2 "gpc_reg_operand" "r")
1112 (match_operand:HI 1 "gpc_reg_operand" "r")))
1113 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1116 [(set_attr "type" "imul3")])
1118 (define_insn "*macchwuc"
1119 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1120 (compare:CC (plus:SI (mult:SI (lshiftrt:SI
1121 (match_operand:SI 2 "gpc_reg_operand" "r")
1124 (match_operand:HI 1 "gpc_reg_operand" "r")))
1125 (match_operand:SI 4 "gpc_reg_operand" "0"))
1127 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1128 (plus:SI (mult:SI (lshiftrt:SI
1136 [(set_attr "type" "imul3")])
1138 (define_insn "*macchwu"
1139 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1140 (plus:SI (mult:SI (lshiftrt:SI
1141 (match_operand:SI 2 "gpc_reg_operand" "r")
1144 (match_operand:HI 1 "gpc_reg_operand" "r")))
1145 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1148 [(set_attr "type" "imul3")])
1150 (define_insn "*machhwc"
1151 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1152 (compare:CC (plus:SI (mult:SI (ashiftrt:SI
1153 (match_operand:SI 1 "gpc_reg_operand" "%r")
1156 (match_operand:SI 2 "gpc_reg_operand" "r")
1158 (match_operand:SI 4 "gpc_reg_operand" "0"))
1160 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1161 (plus:SI (mult:SI (ashiftrt:SI
1170 [(set_attr "type" "imul3")])
1172 (define_insn "*machhw"
1173 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1174 (plus:SI (mult:SI (ashiftrt:SI
1175 (match_operand:SI 1 "gpc_reg_operand" "%r")
1178 (match_operand:SI 2 "gpc_reg_operand" "r")
1180 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1183 [(set_attr "type" "imul3")])
1185 (define_insn "*machhwuc"
1186 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1187 (compare:CC (plus:SI (mult:SI (lshiftrt:SI
1188 (match_operand:SI 1 "gpc_reg_operand" "%r")
1191 (match_operand:SI 2 "gpc_reg_operand" "r")
1193 (match_operand:SI 4 "gpc_reg_operand" "0"))
1195 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1196 (plus:SI (mult:SI (lshiftrt:SI
1205 [(set_attr "type" "imul3")])
1207 (define_insn "*machhwu"
1208 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1209 (plus:SI (mult:SI (lshiftrt:SI
1210 (match_operand:SI 1 "gpc_reg_operand" "%r")
1213 (match_operand:SI 2 "gpc_reg_operand" "r")
1215 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1218 [(set_attr "type" "imul3")])
1220 (define_insn "*maclhwc"
1221 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1222 (compare:CC (plus:SI (mult:SI (sign_extend:SI
1223 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1225 (match_operand:HI 2 "gpc_reg_operand" "r")))
1226 (match_operand:SI 4 "gpc_reg_operand" "0"))
1228 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1229 (plus:SI (mult:SI (sign_extend:SI
1236 [(set_attr "type" "imul3")])
1238 (define_insn "*maclhw"
1239 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1240 (plus:SI (mult:SI (sign_extend:SI
1241 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1243 (match_operand:HI 2 "gpc_reg_operand" "r")))
1244 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1247 [(set_attr "type" "imul3")])
1249 (define_insn "*maclhwuc"
1250 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1251 (compare:CC (plus:SI (mult:SI (zero_extend:SI
1252 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1254 (match_operand:HI 2 "gpc_reg_operand" "r")))
1255 (match_operand:SI 4 "gpc_reg_operand" "0"))
1257 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1258 (plus:SI (mult:SI (zero_extend:SI
1265 [(set_attr "type" "imul3")])
1267 (define_insn "*maclhwu"
1268 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1269 (plus:SI (mult:SI (zero_extend:SI
1270 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1272 (match_operand:HI 2 "gpc_reg_operand" "r")))
1273 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1276 [(set_attr "type" "imul3")])
1278 (define_insn "*nmacchwc"
1279 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1280 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1281 (mult:SI (ashiftrt:SI
1282 (match_operand:SI 2 "gpc_reg_operand" "r")
1285 (match_operand:HI 1 "gpc_reg_operand" "r"))))
1287 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1288 (minus:SI (match_dup 4)
1289 (mult:SI (ashiftrt:SI
1296 [(set_attr "type" "imul3")])
1298 (define_insn "*nmacchw"
1299 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1300 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1301 (mult:SI (ashiftrt:SI
1302 (match_operand:SI 2 "gpc_reg_operand" "r")
1305 (match_operand:HI 1 "gpc_reg_operand" "r")))))]
1308 [(set_attr "type" "imul3")])
1310 (define_insn "*nmachhwc"
1311 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1312 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1313 (mult:SI (ashiftrt:SI
1314 (match_operand:SI 1 "gpc_reg_operand" "%r")
1317 (match_operand:SI 2 "gpc_reg_operand" "r")
1320 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1321 (minus:SI (match_dup 4)
1322 (mult:SI (ashiftrt:SI
1330 [(set_attr "type" "imul3")])
1332 (define_insn "*nmachhw"
1333 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1334 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1335 (mult:SI (ashiftrt:SI
1336 (match_operand:SI 1 "gpc_reg_operand" "%r")
1339 (match_operand:SI 2 "gpc_reg_operand" "r")
1343 [(set_attr "type" "imul3")])
1345 (define_insn "*nmaclhwc"
1346 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1347 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1348 (mult:SI (sign_extend:SI
1349 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1351 (match_operand:HI 2 "gpc_reg_operand" "r"))))
1353 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1354 (minus:SI (match_dup 4)
1355 (mult:SI (sign_extend:SI
1361 [(set_attr "type" "imul3")])
1363 (define_insn "*nmaclhw"
1364 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1365 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1366 (mult:SI (sign_extend:SI
1367 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1369 (match_operand:HI 2 "gpc_reg_operand" "r")))))]
1372 [(set_attr "type" "imul3")])
1374 (define_insn "*mulchwc"
1375 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1376 (compare:CC (mult:SI (ashiftrt:SI
1377 (match_operand:SI 2 "gpc_reg_operand" "r")
1380 (match_operand:HI 1 "gpc_reg_operand" "r")))
1382 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1383 (mult:SI (ashiftrt:SI
1390 [(set_attr "type" "imul3")])
1392 (define_insn "*mulchw"
1393 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1394 (mult:SI (ashiftrt:SI
1395 (match_operand:SI 2 "gpc_reg_operand" "r")
1398 (match_operand:HI 1 "gpc_reg_operand" "r"))))]
1401 [(set_attr "type" "imul3")])
1403 (define_insn "*mulchwuc"
1404 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1405 (compare:CC (mult:SI (lshiftrt:SI
1406 (match_operand:SI 2 "gpc_reg_operand" "r")
1409 (match_operand:HI 1 "gpc_reg_operand" "r")))
1411 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1412 (mult:SI (lshiftrt:SI
1419 [(set_attr "type" "imul3")])
1421 (define_insn "*mulchwu"
1422 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1423 (mult:SI (lshiftrt:SI
1424 (match_operand:SI 2 "gpc_reg_operand" "r")
1427 (match_operand:HI 1 "gpc_reg_operand" "r"))))]
1430 [(set_attr "type" "imul3")])
1432 (define_insn "*mulhhwc"
1433 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1434 (compare:CC (mult:SI (ashiftrt:SI
1435 (match_operand:SI 1 "gpc_reg_operand" "%r")
1438 (match_operand:SI 2 "gpc_reg_operand" "r")
1441 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1442 (mult:SI (ashiftrt:SI
1450 [(set_attr "type" "imul3")])
1452 (define_insn "*mulhhw"
1453 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1454 (mult:SI (ashiftrt:SI
1455 (match_operand:SI 1 "gpc_reg_operand" "%r")
1458 (match_operand:SI 2 "gpc_reg_operand" "r")
1462 [(set_attr "type" "imul3")])
1464 (define_insn "*mulhhwuc"
1465 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1466 (compare:CC (mult:SI (lshiftrt:SI
1467 (match_operand:SI 1 "gpc_reg_operand" "%r")
1470 (match_operand:SI 2 "gpc_reg_operand" "r")
1473 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1474 (mult:SI (lshiftrt:SI
1482 [(set_attr "type" "imul3")])
1484 (define_insn "*mulhhwu"
1485 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1486 (mult:SI (lshiftrt:SI
1487 (match_operand:SI 1 "gpc_reg_operand" "%r")
1490 (match_operand:SI 2 "gpc_reg_operand" "r")
1494 [(set_attr "type" "imul3")])
1496 (define_insn "*mullhwc"
1497 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1498 (compare:CC (mult:SI (sign_extend:SI
1499 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1501 (match_operand:HI 2 "gpc_reg_operand" "r")))
1503 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1504 (mult:SI (sign_extend:SI
1510 [(set_attr "type" "imul3")])
1512 (define_insn "*mullhw"
1513 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1514 (mult:SI (sign_extend:SI
1515 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1517 (match_operand:HI 2 "gpc_reg_operand" "r"))))]
1520 [(set_attr "type" "imul3")])
1522 (define_insn "*mullhwuc"
1523 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1524 (compare:CC (mult:SI (zero_extend:SI
1525 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1527 (match_operand:HI 2 "gpc_reg_operand" "r")))
1529 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1530 (mult:SI (zero_extend:SI
1536 [(set_attr "type" "imul3")])
1538 (define_insn "*mullhwu"
1539 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1540 (mult:SI (zero_extend:SI
1541 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1543 (match_operand:HI 2 "gpc_reg_operand" "r"))))]
1546 [(set_attr "type" "imul3")])
1548 ;; IBM 405, 440, 464 and 476 string-search dlmzb instruction support.
1549 (define_insn "dlmzb"
1550 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1551 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
1552 (match_operand:SI 2 "gpc_reg_operand" "r")]
1554 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1555 (unspec:SI [(match_dup 1)
1561 (define_expand "strlensi"
1562 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1563 (unspec:SI [(match_operand:BLK 1 "general_operand" "")
1564 (match_operand:QI 2 "const_int_operand" "")
1565 (match_operand 3 "const_int_operand" "")]
1566 UNSPEC_DLMZB_STRLEN))
1567 (clobber (match_scratch:CC 4 "=x"))]
1568 "TARGET_DLMZB && WORDS_BIG_ENDIAN && !optimize_size"
1570 rtx result = operands[0];
1571 rtx src = operands[1];
1572 rtx search_char = operands[2];
1573 rtx align = operands[3];
1574 rtx addr, scratch_string, word1, word2, scratch_dlmzb;
1575 rtx loop_label, end_label, mem, cr0, cond;
1576 if (search_char != const0_rtx
1577 || GET_CODE (align) != CONST_INT
1578 || INTVAL (align) < 8)
1580 word1 = gen_reg_rtx (SImode);
1581 word2 = gen_reg_rtx (SImode);
1582 scratch_dlmzb = gen_reg_rtx (SImode);
1583 scratch_string = gen_reg_rtx (Pmode);
1584 loop_label = gen_label_rtx ();
1585 end_label = gen_label_rtx ();
1586 addr = force_reg (Pmode, XEXP (src, 0));
1587 emit_move_insn (scratch_string, addr);
1588 emit_label (loop_label);
1589 mem = change_address (src, SImode, scratch_string);
1590 emit_move_insn (word1, mem);
1591 emit_move_insn (word2, adjust_address (mem, SImode, 4));
1592 cr0 = gen_rtx_REG (CCmode, CR0_REGNO);
1593 emit_insn (gen_dlmzb (scratch_dlmzb, word1, word2, cr0));
1594 cond = gen_rtx_NE (VOIDmode, cr0, const0_rtx);
1595 emit_jump_insn (gen_rtx_SET (VOIDmode,
1597 gen_rtx_IF_THEN_ELSE (VOIDmode,
1603 emit_insn (gen_addsi3 (scratch_string, scratch_string, GEN_INT (8)));
1604 emit_jump_insn (gen_rtx_SET (VOIDmode,
1606 gen_rtx_LABEL_REF (VOIDmode, loop_label)));
1608 emit_label (end_label);
1609 emit_insn (gen_addsi3 (scratch_string, scratch_string, scratch_dlmzb));
1610 emit_insn (gen_subsi3 (result, scratch_string, addr));
1611 emit_insn (gen_subsi3 (result, result, const1_rtx));
1615 ;; Fixed-point arithmetic insns.
1617 (define_expand "add<mode>3"
1618 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1619 (plus:SDI (match_operand:SDI 1 "gpc_reg_operand" "")
1620 (match_operand:SDI 2 "reg_or_add_cint_operand" "")))]
1623 if (<MODE>mode == DImode && ! TARGET_POWERPC64)
1625 if (non_short_cint_operand (operands[2], DImode))
1628 else if (GET_CODE (operands[2]) == CONST_INT
1629 && ! add_operand (operands[2], <MODE>mode))
1631 rtx tmp = ((!can_create_pseudo_p ()
1632 || rtx_equal_p (operands[0], operands[1]))
1633 ? operands[0] : gen_reg_rtx (<MODE>mode));
1635 HOST_WIDE_INT val = INTVAL (operands[2]);
1636 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1637 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, <MODE>mode);
1639 if (<MODE>mode == DImode && !satisfies_constraint_L (GEN_INT (rest)))
1642 /* The ordering here is important for the prolog expander.
1643 When space is allocated from the stack, adding 'low' first may
1644 produce a temporary deallocation (which would be bad). */
1645 emit_insn (gen_add<mode>3 (tmp, operands[1], GEN_INT (rest)));
1646 emit_insn (gen_add<mode>3 (operands[0], tmp, GEN_INT (low)));
1651 ;; Discourage ai/addic because of carry but provide it in an alternative
1652 ;; allowing register zero as source.
1653 (define_insn "*add<mode>3_internal1"
1654 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r,?r,r")
1655 (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "%r,b,r,b")
1656 (match_operand:GPR 2 "add_operand" "r,I,I,L")))]
1657 "!DECIMAL_FLOAT_MODE_P (GET_MODE (operands[0])) && !DECIMAL_FLOAT_MODE_P (GET_MODE (operands[1]))"
1663 [(set_attr "length" "4,4,4,4")])
1665 (define_insn "addsi3_high"
1666 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
1667 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
1668 (high:SI (match_operand 2 "" ""))))]
1669 "TARGET_MACHO && !TARGET_64BIT"
1670 "addis %0,%1,ha16(%2)"
1671 [(set_attr "length" "4")])
1673 (define_insn "*add<mode>3_internal2"
1674 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
1675 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "%r,r,r,r")
1676 (match_operand:P 2 "reg_or_short_operand" "r,I,r,I"))
1678 (clobber (match_scratch:P 3 "=r,r,r,r"))]
1685 [(set_attr "type" "fast_compare,compare,compare,compare")
1686 (set_attr "length" "4,4,8,8")])
1689 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1690 (compare:CC (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1691 (match_operand:GPR 2 "reg_or_short_operand" ""))
1693 (clobber (match_scratch:GPR 3 ""))]
1696 (plus:GPR (match_dup 1)
1699 (compare:CC (match_dup 3)
1703 (define_insn "*add<mode>3_internal3"
1704 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
1705 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "%r,r,r,r")
1706 (match_operand:P 2 "reg_or_short_operand" "r,I,r,I"))
1708 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
1709 (plus:P (match_dup 1)
1717 [(set_attr "type" "fast_compare,compare,compare,compare")
1718 (set_attr "length" "4,4,8,8")])
1721 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1722 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "")
1723 (match_operand:P 2 "reg_or_short_operand" ""))
1725 (set (match_operand:P 0 "gpc_reg_operand" "")
1726 (plus:P (match_dup 1) (match_dup 2)))]
1729 (plus:P (match_dup 1)
1732 (compare:CC (match_dup 0)
1736 ;; Split an add that we can't do in one insn into two insns, each of which
1737 ;; does one 16-bit part. This is used by combine. Note that the low-order
1738 ;; add should be last in case the result gets used in an address.
1741 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
1742 (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1743 (match_operand:GPR 2 "non_add_cint_operand" "")))]
1745 [(set (match_dup 0) (plus:GPR (match_dup 1) (match_dup 3)))
1746 (set (match_dup 0) (plus:GPR (match_dup 0) (match_dup 4)))]
1748 HOST_WIDE_INT val = INTVAL (operands[2]);
1749 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1750 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, <MODE>mode);
1752 operands[4] = GEN_INT (low);
1753 if (<MODE>mode == SImode || satisfies_constraint_L (GEN_INT (rest)))
1754 operands[3] = GEN_INT (rest);
1755 else if (can_create_pseudo_p ())
1757 operands[3] = gen_reg_rtx (DImode);
1758 emit_move_insn (operands[3], operands[2]);
1759 emit_insn (gen_adddi3 (operands[0], operands[1], operands[3]));
1766 (define_insn "one_cmpl<mode>2"
1767 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1768 (not:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
1773 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1774 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1776 (clobber (match_scratch:P 2 "=r,r"))]
1781 [(set_attr "type" "fast_compare,compare")
1782 (set_attr "length" "4,8")])
1785 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
1786 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" ""))
1788 (clobber (match_scratch:P 2 ""))]
1791 (not:P (match_dup 1)))
1793 (compare:CC (match_dup 2)
1798 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1799 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1801 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
1802 (not:P (match_dup 1)))]
1807 [(set_attr "type" "fast_compare,compare")
1808 (set_attr "length" "4,8")])
1811 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
1812 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" ""))
1814 (set (match_operand:P 0 "gpc_reg_operand" "")
1815 (not:P (match_dup 1)))]
1818 (not:P (match_dup 1)))
1820 (compare:CC (match_dup 0)
1825 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
1826 (minus:GPR (match_operand:GPR 1 "reg_or_short_operand" "r,I")
1827 (match_operand:GPR 2 "gpc_reg_operand" "r,r")))]
1834 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1835 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "r,r")
1836 (match_operand:P 2 "gpc_reg_operand" "r,r"))
1838 (clobber (match_scratch:P 3 "=r,r"))]
1843 [(set_attr "type" "fast_compare")
1844 (set_attr "length" "4,8")])
1847 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1848 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "")
1849 (match_operand:P 2 "gpc_reg_operand" ""))
1851 (clobber (match_scratch:P 3 ""))]
1854 (minus:P (match_dup 1)
1857 (compare:CC (match_dup 3)
1862 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1863 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "r,r")
1864 (match_operand:P 2 "gpc_reg_operand" "r,r"))
1866 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
1867 (minus:P (match_dup 1)
1873 [(set_attr "type" "fast_compare")
1874 (set_attr "length" "4,8")])
1877 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1878 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "")
1879 (match_operand:P 2 "gpc_reg_operand" ""))
1881 (set (match_operand:P 0 "gpc_reg_operand" "")
1882 (minus:P (match_dup 1)
1886 (minus:P (match_dup 1)
1889 (compare:CC (match_dup 0)
1893 (define_expand "sub<mode>3"
1894 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1895 (minus:SDI (match_operand:SDI 1 "reg_or_short_operand" "")
1896 (match_operand:SDI 2 "reg_or_sub_cint_operand" "")))]
1900 if (GET_CODE (operands[2]) == CONST_INT)
1902 emit_insn (gen_add<mode>3 (operands[0], operands[1],
1903 negate_rtx (<MODE>mode, operands[2])));
1908 (define_expand "neg<mode>2"
1909 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1910 (neg:SDI (match_operand:SDI 1 "gpc_reg_operand" "")))]
1914 (define_insn "*neg<mode>2_internal"
1915 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1916 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
1921 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1922 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1924 (clobber (match_scratch:P 2 "=r,r"))]
1929 [(set_attr "type" "fast_compare")
1930 (set_attr "length" "4,8")])
1933 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1934 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" ""))
1936 (clobber (match_scratch:P 2 ""))]
1939 (neg:P (match_dup 1)))
1941 (compare:CC (match_dup 2)
1946 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1947 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1949 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
1950 (neg:P (match_dup 1)))]
1955 [(set_attr "type" "fast_compare")
1956 (set_attr "length" "4,8")])
1959 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1960 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" ""))
1962 (set (match_operand:P 0 "gpc_reg_operand" "")
1963 (neg:P (match_dup 1)))]
1966 (neg:P (match_dup 1)))
1968 (compare:CC (match_dup 0)
1972 (define_insn "clz<mode>2"
1973 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1974 (clz:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
1977 [(set_attr "type" "cntlz")])
1979 (define_expand "ctz<mode>2"
1981 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))
1982 (parallel [(set (match_dup 3) (and:GPR (match_dup 1)
1984 (clobber (scratch:CC))])
1985 (set (match_dup 4) (clz:GPR (match_dup 3)))
1986 (set (match_operand:GPR 0 "gpc_reg_operand" "")
1987 (minus:GPR (match_dup 5) (match_dup 4)))]
1990 operands[2] = gen_reg_rtx (<MODE>mode);
1991 operands[3] = gen_reg_rtx (<MODE>mode);
1992 operands[4] = gen_reg_rtx (<MODE>mode);
1993 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode) - 1);
1996 (define_expand "ffs<mode>2"
1998 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))
1999 (parallel [(set (match_dup 3) (and:GPR (match_dup 1)
2001 (clobber (scratch:CC))])
2002 (set (match_dup 4) (clz:GPR (match_dup 3)))
2003 (set (match_operand:GPR 0 "gpc_reg_operand" "")
2004 (minus:GPR (match_dup 5) (match_dup 4)))]
2007 operands[2] = gen_reg_rtx (<MODE>mode);
2008 operands[3] = gen_reg_rtx (<MODE>mode);
2009 operands[4] = gen_reg_rtx (<MODE>mode);
2010 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode));
2013 (define_insn "popcntb<mode>2"
2014 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2015 (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")]
2019 [(set_attr "length" "4")
2020 (set_attr "type" "popcnt")])
2022 (define_insn "popcntd<mode>2"
2023 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2024 (popcount:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
2027 [(set_attr "length" "4")
2028 (set_attr "type" "popcnt")])
2030 (define_expand "popcount<mode>2"
2031 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2032 (popcount:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))]
2033 "TARGET_POPCNTB || TARGET_POPCNTD"
2035 rs6000_emit_popcount (operands[0], operands[1]);
2039 (define_insn "parity<mode>2_cmpb"
2040 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2041 (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")] UNSPEC_PARITY))]
2042 "TARGET_CMPB && TARGET_POPCNTB"
2045 (define_expand "parity<mode>2"
2046 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2047 (parity:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))]
2050 rs6000_emit_parity (operands[0], operands[1]);
2054 ;; Since the hardware zeros the upper part of the register, save generating the
2055 ;; AND immediate if we are converting to unsigned
2056 (define_insn "*bswaphi2_extenddi"
2057 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
2059 (bswap:HI (match_operand:HI 1 "memory_operand" "Z"))))]
2062 [(set_attr "length" "4")
2063 (set_attr "type" "load")])
2065 (define_insn "*bswaphi2_extendsi"
2066 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2068 (bswap:HI (match_operand:HI 1 "memory_operand" "Z"))))]
2071 [(set_attr "length" "4")
2072 (set_attr "type" "load")])
2074 (define_expand "bswaphi2"
2075 [(parallel [(set (match_operand:HI 0 "reg_or_mem_operand" "")
2077 (match_operand:HI 1 "reg_or_mem_operand" "")))
2078 (clobber (match_scratch:SI 2 ""))])]
2081 if (!REG_P (operands[0]) && !REG_P (operands[1]))
2082 operands[1] = force_reg (HImode, operands[1]);
2085 (define_insn "bswaphi2_internal"
2086 [(set (match_operand:HI 0 "reg_or_mem_operand" "=r,Z,&r")
2088 (match_operand:HI 1 "reg_or_mem_operand" "Z,r,r")))
2089 (clobber (match_scratch:SI 2 "=X,X,&r"))]
2095 [(set_attr "length" "4,4,12")
2096 (set_attr "type" "load,store,*")])
2098 ;; We are always BITS_BIG_ENDIAN, so the (const_int 16) below is
2099 ;; correct for -mlittle as well as -mbig.
2101 [(set (match_operand:HI 0 "gpc_reg_operand" "")
2102 (bswap:HI (match_operand:HI 1 "gpc_reg_operand" "")))
2103 (clobber (match_operand:SI 2 "gpc_reg_operand" ""))]
2106 (zero_extract:SI (match_dup 4)
2110 (and:SI (ashift:SI (match_dup 4)
2112 (const_int 65280))) ;; 0xff00
2114 (ior:SI (match_dup 3)
2118 operands[3] = simplify_gen_subreg (SImode, operands[0], HImode, 0);
2119 operands[4] = simplify_gen_subreg (SImode, operands[1], HImode, 0);
2122 (define_insn "*bswapsi2_extenddi"
2123 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
2125 (bswap:SI (match_operand:SI 1 "memory_operand" "Z"))))]
2128 [(set_attr "length" "4")
2129 (set_attr "type" "load")])
2131 (define_expand "bswapsi2"
2132 [(set (match_operand:SI 0 "reg_or_mem_operand" "")
2134 (match_operand:SI 1 "reg_or_mem_operand" "")))]
2137 if (!REG_P (operands[0]) && !REG_P (operands[1]))
2138 operands[1] = force_reg (SImode, operands[1]);
2141 (define_insn "*bswapsi2_internal"
2142 [(set (match_operand:SI 0 "reg_or_mem_operand" "=r,Z,&r")
2144 (match_operand:SI 1 "reg_or_mem_operand" "Z,r,r")))]
2150 [(set_attr "length" "4,4,12")
2151 (set_attr "type" "load,store,*")])
2153 ;; We are always BITS_BIG_ENDIAN, so the bit positions below in
2154 ;; zero_extract insns do not change for -mlittle.
2156 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2157 (bswap:SI (match_operand:SI 1 "gpc_reg_operand" "")))]
2160 (rotate:SI (match_dup 1) (const_int 8)))
2161 (set (zero_extract:SI (match_dup 0)
2165 (set (zero_extract:SI (match_dup 0)
2168 (rotate:SI (match_dup 1)
2172 (define_expand "bswapdi2"
2173 [(parallel [(set (match_operand:DI 0 "reg_or_mem_operand" "")
2175 (match_operand:DI 1 "reg_or_mem_operand" "")))
2176 (clobber (match_scratch:DI 2 ""))
2177 (clobber (match_scratch:DI 3 ""))
2178 (clobber (match_scratch:DI 4 ""))])]
2181 if (!REG_P (operands[0]) && !REG_P (operands[1]))
2182 operands[1] = force_reg (DImode, operands[1]);
2184 if (!TARGET_POWERPC64)
2186 /* 32-bit mode needs fewer scratch registers, but 32-bit addressing mode
2187 that uses 64-bit registers needs the same scratch registers as 64-bit
2189 emit_insn (gen_bswapdi2_32bit (operands[0], operands[1]));
2194 ;; Power7/cell has ldbrx/stdbrx, so use it directly
2195 (define_insn "*bswapdi2_ldbrx"
2196 [(set (match_operand:DI 0 "reg_or_mem_operand" "=&r,Z,??&r")
2197 (bswap:DI (match_operand:DI 1 "reg_or_mem_operand" "Z,r,r")))
2198 (clobber (match_scratch:DI 2 "=X,X,&r"))
2199 (clobber (match_scratch:DI 3 "=X,X,&r"))
2200 (clobber (match_scratch:DI 4 "=X,X,&r"))]
2201 "TARGET_POWERPC64 && TARGET_LDBRX
2202 && (REG_P (operands[0]) || REG_P (operands[1]))"
2207 [(set_attr "length" "4,4,36")
2208 (set_attr "type" "load,store,*")])
2210 ;; Non-power7/cell, fall back to use lwbrx/stwbrx
2211 (define_insn "*bswapdi2_64bit"
2212 [(set (match_operand:DI 0 "reg_or_mem_operand" "=&r,Z,??&r")
2213 (bswap:DI (match_operand:DI 1 "reg_or_mem_operand" "Z,r,r")))
2214 (clobber (match_scratch:DI 2 "=&b,&b,&r"))
2215 (clobber (match_scratch:DI 3 "=&r,&r,&r"))
2216 (clobber (match_scratch:DI 4 "=&r,X,&r"))]
2217 "TARGET_POWERPC64 && !TARGET_LDBRX
2218 && (REG_P (operands[0]) || REG_P (operands[1]))"
2220 [(set_attr "length" "16,12,36")])
2223 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2224 (bswap:DI (match_operand:DI 1 "indexed_or_indirect_operand" "")))
2225 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
2226 (clobber (match_operand:DI 3 "gpc_reg_operand" ""))
2227 (clobber (match_operand:DI 4 "gpc_reg_operand" ""))]
2228 "TARGET_POWERPC64 && !TARGET_LDBRX && reload_completed"
2232 rtx dest = operands[0];
2233 rtx src = operands[1];
2234 rtx op2 = operands[2];
2235 rtx op3 = operands[3];
2236 rtx op4 = operands[4];
2237 rtx op3_32 = simplify_gen_subreg (SImode, op3, DImode,
2238 BYTES_BIG_ENDIAN ? 4 : 0);
2239 rtx op4_32 = simplify_gen_subreg (SImode, op4, DImode,
2240 BYTES_BIG_ENDIAN ? 4 : 0);
2246 addr1 = XEXP (src, 0);
2247 if (GET_CODE (addr1) == PLUS)
2249 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2250 if (TARGET_AVOID_XFORM)
2252 emit_insn (gen_add3_insn (op2, XEXP (addr1, 1), op2));
2256 addr2 = gen_rtx_PLUS (Pmode, op2, XEXP (addr1, 1));
2258 else if (TARGET_AVOID_XFORM)
2260 emit_insn (gen_add3_insn (op2, addr1, GEN_INT (4)));
2265 emit_move_insn (op2, GEN_INT (4));
2266 addr2 = gen_rtx_PLUS (Pmode, op2, addr1);
2269 if (BYTES_BIG_ENDIAN)
2271 word_high = change_address (src, SImode, addr1);
2272 word_low = change_address (src, SImode, addr2);
2276 word_high = change_address (src, SImode, addr2);
2277 word_low = change_address (src, SImode, addr1);
2280 emit_insn (gen_bswapsi2 (op3_32, word_low));
2281 emit_insn (gen_bswapsi2 (op4_32, word_high));
2282 emit_insn (gen_ashldi3 (dest, op3, GEN_INT (32)));
2283 emit_insn (gen_iordi3 (dest, dest, op4));
2287 [(set (match_operand:DI 0 "indexed_or_indirect_operand" "")
2288 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2289 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
2290 (clobber (match_operand:DI 3 "gpc_reg_operand" ""))
2291 (clobber (match_operand:DI 4 "" ""))]
2292 "TARGET_POWERPC64 && !TARGET_LDBRX && reload_completed"
2296 rtx dest = operands[0];
2297 rtx src = operands[1];
2298 rtx op2 = operands[2];
2299 rtx op3 = operands[3];
2300 rtx src_si = simplify_gen_subreg (SImode, src, DImode,
2301 BYTES_BIG_ENDIAN ? 4 : 0);
2302 rtx op3_si = simplify_gen_subreg (SImode, op3, DImode,
2303 BYTES_BIG_ENDIAN ? 4 : 0);
2309 addr1 = XEXP (dest, 0);
2310 if (GET_CODE (addr1) == PLUS)
2312 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2313 if (TARGET_AVOID_XFORM)
2315 emit_insn (gen_add3_insn (op2, XEXP (addr1, 1), op2));
2319 addr2 = gen_rtx_PLUS (Pmode, op2, XEXP (addr1, 1));
2321 else if (TARGET_AVOID_XFORM)
2323 emit_insn (gen_add3_insn (op2, addr1, GEN_INT (4)));
2328 emit_move_insn (op2, GEN_INT (4));
2329 addr2 = gen_rtx_PLUS (Pmode, op2, addr1);
2332 emit_insn (gen_lshrdi3 (op3, src, GEN_INT (32)));
2333 if (BYTES_BIG_ENDIAN)
2335 word_high = change_address (dest, SImode, addr1);
2336 word_low = change_address (dest, SImode, addr2);
2340 word_high = change_address (dest, SImode, addr2);
2341 word_low = change_address (dest, SImode, addr1);
2343 emit_insn (gen_bswapsi2 (word_high, src_si));
2344 emit_insn (gen_bswapsi2 (word_low, op3_si));
2348 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2349 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2350 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
2351 (clobber (match_operand:DI 3 "gpc_reg_operand" ""))
2352 (clobber (match_operand:DI 4 "" ""))]
2353 "TARGET_POWERPC64 && reload_completed"
2357 rtx dest = operands[0];
2358 rtx src = operands[1];
2359 rtx op2 = operands[2];
2360 rtx op3 = operands[3];
2361 int lo_off = BYTES_BIG_ENDIAN ? 4 : 0;
2362 rtx dest_si = simplify_gen_subreg (SImode, dest, DImode, lo_off);
2363 rtx src_si = simplify_gen_subreg (SImode, src, DImode, lo_off);
2364 rtx op2_si = simplify_gen_subreg (SImode, op2, DImode, lo_off);
2365 rtx op3_si = simplify_gen_subreg (SImode, op3, DImode, lo_off);
2367 emit_insn (gen_lshrdi3 (op2, src, GEN_INT (32)));
2368 emit_insn (gen_bswapsi2 (dest_si, src_si));
2369 emit_insn (gen_bswapsi2 (op3_si, op2_si));
2370 emit_insn (gen_ashldi3 (dest, dest, GEN_INT (32)));
2371 emit_insn (gen_iordi3 (dest, dest, op3));
2374 (define_insn "bswapdi2_32bit"
2375 [(set (match_operand:DI 0 "reg_or_mem_operand" "=&r,Z,??&r")
2376 (bswap:DI (match_operand:DI 1 "reg_or_mem_operand" "Z,r,r")))
2377 (clobber (match_scratch:SI 2 "=&b,&b,X"))]
2378 "!TARGET_POWERPC64 && (REG_P (operands[0]) || REG_P (operands[1]))"
2380 [(set_attr "length" "16,12,36")])
2383 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2384 (bswap:DI (match_operand:DI 1 "indexed_or_indirect_operand" "")))
2385 (clobber (match_operand:SI 2 "gpc_reg_operand" ""))]
2386 "!TARGET_POWERPC64 && reload_completed"
2390 rtx dest = operands[0];
2391 rtx src = operands[1];
2392 rtx op2 = operands[2];
2393 rtx dest1 = simplify_gen_subreg (SImode, dest, DImode, 0);
2394 rtx dest2 = simplify_gen_subreg (SImode, dest, DImode, 4);
2400 addr1 = XEXP (src, 0);
2401 if (GET_CODE (addr1) == PLUS)
2403 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2404 if (TARGET_AVOID_XFORM)
2406 emit_insn (gen_add3_insn (op2, XEXP (addr1, 1), op2));
2410 addr2 = gen_rtx_PLUS (SImode, op2, XEXP (addr1, 1));
2412 else if (TARGET_AVOID_XFORM)
2414 emit_insn (gen_add3_insn (op2, addr1, GEN_INT (4)));
2419 emit_move_insn (op2, GEN_INT (4));
2420 addr2 = gen_rtx_PLUS (SImode, op2, addr1);
2423 word1 = change_address (src, SImode, addr1);
2424 word2 = change_address (src, SImode, addr2);
2426 emit_insn (gen_bswapsi2 (dest2, word1));
2427 emit_insn (gen_bswapsi2 (dest1, word2));
2431 [(set (match_operand:DI 0 "indexed_or_indirect_operand" "")
2432 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2433 (clobber (match_operand:SI 2 "gpc_reg_operand" ""))]
2434 "!TARGET_POWERPC64 && reload_completed"
2438 rtx dest = operands[0];
2439 rtx src = operands[1];
2440 rtx op2 = operands[2];
2441 rtx src1 = simplify_gen_subreg (SImode, src, DImode, 0);
2442 rtx src2 = simplify_gen_subreg (SImode, src, DImode, 4);
2448 addr1 = XEXP (dest, 0);
2449 if (GET_CODE (addr1) == PLUS)
2451 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2452 if (TARGET_AVOID_XFORM)
2454 emit_insn (gen_add3_insn (op2, XEXP (addr1, 1), op2));
2458 addr2 = gen_rtx_PLUS (SImode, op2, XEXP (addr1, 1));
2460 else if (TARGET_AVOID_XFORM)
2462 emit_insn (gen_add3_insn (op2, addr1, GEN_INT (4)));
2467 emit_move_insn (op2, GEN_INT (4));
2468 addr2 = gen_rtx_PLUS (SImode, op2, addr1);
2471 word1 = change_address (dest, SImode, addr1);
2472 word2 = change_address (dest, SImode, addr2);
2474 emit_insn (gen_bswapsi2 (word2, src1));
2475 emit_insn (gen_bswapsi2 (word1, src2));
2479 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2480 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2481 (clobber (match_operand:SI 2 "" ""))]
2482 "!TARGET_POWERPC64 && reload_completed"
2486 rtx dest = operands[0];
2487 rtx src = operands[1];
2488 rtx src1 = simplify_gen_subreg (SImode, src, DImode, 0);
2489 rtx src2 = simplify_gen_subreg (SImode, src, DImode, 4);
2490 rtx dest1 = simplify_gen_subreg (SImode, dest, DImode, 0);
2491 rtx dest2 = simplify_gen_subreg (SImode, dest, DImode, 4);
2493 emit_insn (gen_bswapsi2 (dest1, src2));
2494 emit_insn (gen_bswapsi2 (dest2, src1));
2497 (define_insn "mulsi3"
2498 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2499 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2500 (match_operand:SI 2 "reg_or_short_operand" "r,I")))]
2506 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
2507 (const_string "imul3")
2508 (match_operand:SI 2 "short_cint_operand" "")
2509 (const_string "imul2")]
2510 (const_string "imul")))])
2512 (define_insn "*mulsi3_internal1"
2513 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2514 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2515 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2517 (clobber (match_scratch:SI 3 "=r,r"))]
2522 [(set_attr "type" "imul_compare")
2523 (set_attr "length" "4,8")])
2526 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
2527 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2528 (match_operand:SI 2 "gpc_reg_operand" ""))
2530 (clobber (match_scratch:SI 3 ""))]
2533 (mult:SI (match_dup 1) (match_dup 2)))
2535 (compare:CC (match_dup 3)
2539 (define_insn "*mulsi3_internal2"
2540 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2541 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2542 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2544 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2545 (mult:SI (match_dup 1) (match_dup 2)))]
2550 [(set_attr "type" "imul_compare")
2551 (set_attr "length" "4,8")])
2554 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
2555 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2556 (match_operand:SI 2 "gpc_reg_operand" ""))
2558 (set (match_operand:SI 0 "gpc_reg_operand" "")
2559 (mult:SI (match_dup 1) (match_dup 2)))]
2562 (mult:SI (match_dup 1) (match_dup 2)))
2564 (compare:CC (match_dup 0)
2569 (define_insn "udiv<mode>3"
2570 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2571 (udiv:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2572 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
2576 (cond [(match_operand:SI 0 "" "")
2577 (const_string "idiv")]
2578 (const_string "ldiv")))])
2581 ;; For powers of two we can do srai/aze for divide and then adjust for
2582 ;; modulus. If it isn't a power of two, force operands into register and do
2584 (define_expand "div<mode>3"
2585 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2586 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2587 (match_operand:GPR 2 "reg_or_cint_operand" "")))]
2590 if (GET_CODE (operands[2]) != CONST_INT
2591 || INTVAL (operands[2]) <= 0
2592 || exact_log2 (INTVAL (operands[2])) < 0)
2593 operands[2] = force_reg (<MODE>mode, operands[2]);
2596 (define_insn "*div<mode>3"
2597 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2598 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2599 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
2603 (cond [(match_operand:SI 0 "" "")
2604 (const_string "idiv")]
2605 (const_string "ldiv")))])
2607 (define_expand "mod<mode>3"
2608 [(use (match_operand:GPR 0 "gpc_reg_operand" ""))
2609 (use (match_operand:GPR 1 "gpc_reg_operand" ""))
2610 (use (match_operand:GPR 2 "reg_or_cint_operand" ""))]
2618 if (GET_CODE (operands[2]) != CONST_INT
2619 || INTVAL (operands[2]) <= 0
2620 || (i = exact_log2 (INTVAL (operands[2]))) < 0)
2623 temp1 = gen_reg_rtx (<MODE>mode);
2624 temp2 = gen_reg_rtx (<MODE>mode);
2626 emit_insn (gen_div<mode>3 (temp1, operands[1], operands[2]));
2627 emit_insn (gen_ashl<mode>3 (temp2, temp1, GEN_INT (i)));
2628 emit_insn (gen_sub<mode>3 (operands[0], operands[1], temp2));
2633 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2634 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2635 (match_operand:GPR 2 "exact_log2_cint_operand" "N")))]
2637 "sra<wd>i %0,%1,%p2\;addze %0,%0"
2638 [(set_attr "type" "two")
2639 (set_attr "length" "8")])
2642 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2643 (compare:CC (div:P (match_operand:P 1 "gpc_reg_operand" "r,r")
2644 (match_operand:P 2 "exact_log2_cint_operand" "N,N"))
2646 (clobber (match_scratch:P 3 "=r,r"))]
2649 sra<wd>i %3,%1,%p2\;addze. %3,%3
2651 [(set_attr "type" "compare")
2652 (set_attr "length" "8,12")
2653 (set_attr "cell_micro" "not")])
2656 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2657 (compare:CC (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2658 (match_operand:GPR 2 "exact_log2_cint_operand"
2661 (clobber (match_scratch:GPR 3 ""))]
2664 (div:<MODE> (match_dup 1) (match_dup 2)))
2666 (compare:CC (match_dup 3)
2671 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2672 (compare:CC (div:P (match_operand:P 1 "gpc_reg_operand" "r,r")
2673 (match_operand:P 2 "exact_log2_cint_operand" "N,N"))
2675 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
2676 (div:P (match_dup 1) (match_dup 2)))]
2679 sra<wd>i %0,%1,%p2\;addze. %0,%0
2681 [(set_attr "type" "compare")
2682 (set_attr "length" "8,12")
2683 (set_attr "cell_micro" "not")])
2686 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2687 (compare:CC (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2688 (match_operand:GPR 2 "exact_log2_cint_operand"
2691 (set (match_operand:GPR 0 "gpc_reg_operand" "")
2692 (div:GPR (match_dup 1) (match_dup 2)))]
2695 (div:<MODE> (match_dup 1) (match_dup 2)))
2697 (compare:CC (match_dup 0)
2701 ;; Logical instructions
2702 ;; The logical instructions are mostly combined by using match_operator,
2703 ;; but the plain AND insns are somewhat different because there is no
2704 ;; plain 'andi' (only 'andi.'), no plain 'andis', and there are all
2705 ;; those rotate-and-mask operations. Thus, the AND insns come first.
2707 (define_expand "andsi3"
2709 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2710 (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2711 (match_operand:SI 2 "and_operand" "")))
2712 (clobber (match_scratch:CC 3 ""))])]
2716 (define_insn "andsi3_mc"
2717 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
2718 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
2719 (match_operand:SI 2 "and_operand" "?r,T,K,L")))
2720 (clobber (match_scratch:CC 3 "=X,X,x,x"))]
2721 "rs6000_gen_cell_microcode"
2724 rlwinm %0,%1,0,%m2,%M2
2727 [(set_attr "type" "*,*,fast_compare,fast_compare")])
2729 (define_insn "andsi3_nomc"
2730 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2731 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2732 (match_operand:SI 2 "and_operand" "?r,T")))
2733 (clobber (match_scratch:CC 3 "=X,X"))]
2734 "!rs6000_gen_cell_microcode"
2737 rlwinm %0,%1,0,%m2,%M2")
2739 (define_insn "andsi3_internal0_nomc"
2740 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2741 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2742 (match_operand:SI 2 "and_operand" "?r,T")))]
2743 "!rs6000_gen_cell_microcode"
2746 rlwinm %0,%1,0,%m2,%M2")
2749 ;; Note to set cr's other than cr0 we do the and immediate and then
2750 ;; the test again -- this avoids a mfcr which on the higher end
2751 ;; machines causes an execution serialization
2753 (define_insn "*andsi3_internal2_mc"
2754 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2755 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2756 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2758 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2759 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2760 "TARGET_32BIT && rs6000_gen_cell_microcode"
2765 rlwinm. %3,%1,0,%m2,%M2
2770 [(set_attr "type" "fast_compare,fast_compare,fast_compare,delayed_compare,\
2771 compare,compare,compare,compare")
2772 (set_attr "length" "4,4,4,4,8,8,8,8")])
2774 (define_insn "*andsi3_internal3_mc"
2775 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2776 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2777 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2779 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2780 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2781 "TARGET_64BIT && rs6000_gen_cell_microcode"
2786 rlwinm. %3,%1,0,%m2,%M2
2791 [(set_attr "type" "compare,fast_compare,fast_compare,delayed_compare,compare,\
2792 compare,compare,compare")
2793 (set_attr "length" "8,4,4,4,8,8,8,8")])
2796 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
2797 (compare:CC (and:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2798 (match_operand:GPR 2 "and_operand" ""))
2800 (clobber (match_scratch:GPR 3 ""))
2801 (clobber (match_scratch:CC 4 ""))]
2803 [(parallel [(set (match_dup 3)
2804 (and:<MODE> (match_dup 1)
2806 (clobber (match_dup 4))])
2808 (compare:CC (match_dup 3)
2812 ;; We don't have a 32 bit "and. rt,ra,rb" for ppc64. cr is set from the
2813 ;; whole 64 bit reg, and we don't know what is in the high 32 bits.
2816 [(set (match_operand:CC 0 "cc_reg_operand" "")
2817 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2818 (match_operand:SI 2 "gpc_reg_operand" ""))
2820 (clobber (match_scratch:SI 3 ""))
2821 (clobber (match_scratch:CC 4 ""))]
2822 "TARGET_POWERPC64 && reload_completed"
2823 [(parallel [(set (match_dup 3)
2824 (and:SI (match_dup 1)
2826 (clobber (match_dup 4))])
2828 (compare:CC (match_dup 3)
2832 (define_insn "*andsi3_internal4"
2833 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2834 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2835 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2837 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
2838 (and:SI (match_dup 1)
2840 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2841 "TARGET_32BIT && rs6000_gen_cell_microcode"
2846 rlwinm. %0,%1,0,%m2,%M2
2851 [(set_attr "type" "fast_compare,fast_compare,fast_compare,delayed_compare,\
2852 compare,compare,compare,compare")
2853 (set_attr "length" "4,4,4,4,8,8,8,8")])
2855 (define_insn "*andsi3_internal5_mc"
2856 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2857 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2858 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2860 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
2861 (and:SI (match_dup 1)
2863 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2864 "TARGET_64BIT && rs6000_gen_cell_microcode"
2869 rlwinm. %0,%1,0,%m2,%M2
2874 [(set_attr "type" "compare,fast_compare,fast_compare,delayed_compare,compare,\
2875 compare,compare,compare")
2876 (set_attr "length" "8,4,4,4,8,8,8,8")])
2879 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
2880 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2881 (match_operand:SI 2 "and_operand" ""))
2883 (set (match_operand:SI 0 "gpc_reg_operand" "")
2884 (and:SI (match_dup 1)
2886 (clobber (match_scratch:CC 4 ""))]
2888 [(parallel [(set (match_dup 0)
2889 (and:SI (match_dup 1)
2891 (clobber (match_dup 4))])
2893 (compare:CC (match_dup 0)
2898 [(set (match_operand:CC 3 "cc_reg_operand" "")
2899 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2900 (match_operand:SI 2 "gpc_reg_operand" ""))
2902 (set (match_operand:SI 0 "gpc_reg_operand" "")
2903 (and:SI (match_dup 1)
2905 (clobber (match_scratch:CC 4 ""))]
2906 "TARGET_POWERPC64 && reload_completed"
2907 [(parallel [(set (match_dup 0)
2908 (and:SI (match_dup 1)
2910 (clobber (match_dup 4))])
2912 (compare:CC (match_dup 0)
2916 ;; Handle the PowerPC64 rlwinm corner case
2918 (define_insn_and_split "*andsi3_internal6"
2919 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2920 (and:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2921 (match_operand:SI 2 "mask_operand_wrap" "i")))]
2926 (and:SI (rotate:SI (match_dup 1) (match_dup 3))
2929 (rotate:SI (match_dup 0) (match_dup 5)))]
2932 int mb = extract_MB (operands[2]);
2933 int me = extract_ME (operands[2]);
2934 operands[3] = GEN_INT (me + 1);
2935 operands[5] = GEN_INT (32 - (me + 1));
2936 operands[4] = GEN_INT (~((HOST_WIDE_INT) -1 << (33 + me - mb)));
2938 [(set_attr "length" "8")])
2940 (define_expand "iorsi3"
2941 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2942 (ior:SI (match_operand:SI 1 "gpc_reg_operand" "")
2943 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
2947 if (GET_CODE (operands[2]) == CONST_INT
2948 && ! logical_operand (operands[2], SImode))
2950 HOST_WIDE_INT value = INTVAL (operands[2]);
2951 rtx tmp = ((!can_create_pseudo_p ()
2952 || rtx_equal_p (operands[0], operands[1]))
2953 ? operands[0] : gen_reg_rtx (SImode));
2955 emit_insn (gen_iorsi3 (tmp, operands[1],
2956 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
2957 emit_insn (gen_iorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
2962 (define_expand "xorsi3"
2963 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2964 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
2965 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
2969 if (GET_CODE (operands[2]) == CONST_INT
2970 && ! logical_operand (operands[2], SImode))
2972 HOST_WIDE_INT value = INTVAL (operands[2]);
2973 rtx tmp = ((!can_create_pseudo_p ()
2974 || rtx_equal_p (operands[0], operands[1]))
2975 ? operands[0] : gen_reg_rtx (SImode));
2977 emit_insn (gen_xorsi3 (tmp, operands[1],
2978 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
2979 emit_insn (gen_xorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
2984 (define_insn "*boolsi3_internal1"
2985 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
2986 (match_operator:SI 3 "boolean_or_operator"
2987 [(match_operand:SI 1 "gpc_reg_operand" "%r,r,r")
2988 (match_operand:SI 2 "logical_operand" "r,K,L")]))]
2995 (define_insn "*boolsi3_internal2"
2996 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2997 (compare:CC (match_operator:SI 4 "boolean_or_operator"
2998 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
2999 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3001 (clobber (match_scratch:SI 3 "=r,r"))]
3006 [(set_attr "type" "fast_compare,compare")
3007 (set_attr "length" "4,8")])
3010 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3011 (compare:CC (match_operator:SI 4 "boolean_operator"
3012 [(match_operand:SI 1 "gpc_reg_operand" "")
3013 (match_operand:SI 2 "gpc_reg_operand" "")])
3015 (clobber (match_scratch:SI 3 ""))]
3016 "TARGET_32BIT && reload_completed"
3017 [(set (match_dup 3) (match_dup 4))
3019 (compare:CC (match_dup 3)
3023 (define_insn "*boolsi3_internal3"
3024 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3025 (compare:CC (match_operator:SI 4 "boolean_operator"
3026 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
3027 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3029 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3035 [(set_attr "type" "fast_compare,compare")
3036 (set_attr "length" "4,8")])
3039 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3040 (compare:CC (match_operator:SI 4 "boolean_operator"
3041 [(match_operand:SI 1 "gpc_reg_operand" "")
3042 (match_operand:SI 2 "gpc_reg_operand" "")])
3044 (set (match_operand:SI 0 "gpc_reg_operand" "")
3046 "TARGET_32BIT && reload_completed"
3047 [(set (match_dup 0) (match_dup 4))
3049 (compare:CC (match_dup 0)
3053 ;; Split a logical operation that we can't do in one insn into two insns,
3054 ;; each of which does one 16-bit part. This is used by combine.
3057 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3058 (match_operator:SI 3 "boolean_or_operator"
3059 [(match_operand:SI 1 "gpc_reg_operand" "")
3060 (match_operand:SI 2 "non_logical_cint_operand" "")]))]
3062 [(set (match_dup 0) (match_dup 4))
3063 (set (match_dup 0) (match_dup 5))]
3067 i = GEN_INT (INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff));
3068 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
3070 i = GEN_INT (INTVAL (operands[2]) & 0xffff);
3071 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
3075 (define_insn "*boolcsi3_internal1"
3076 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3077 (match_operator:SI 3 "boolean_operator"
3078 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
3079 (match_operand:SI 2 "gpc_reg_operand" "r")]))]
3083 (define_insn "*boolcsi3_internal2"
3084 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3085 (compare:CC (match_operator:SI 4 "boolean_operator"
3086 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
3087 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3089 (clobber (match_scratch:SI 3 "=r,r"))]
3094 [(set_attr "type" "compare")
3095 (set_attr "length" "4,8")])
3098 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3099 (compare:CC (match_operator:SI 4 "boolean_operator"
3100 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3101 (match_operand:SI 2 "gpc_reg_operand" "")])
3103 (clobber (match_scratch:SI 3 ""))]
3104 "TARGET_32BIT && reload_completed"
3105 [(set (match_dup 3) (match_dup 4))
3107 (compare:CC (match_dup 3)
3111 (define_insn "*boolcsi3_internal3"
3112 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3113 (compare:CC (match_operator:SI 4 "boolean_operator"
3114 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
3115 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3117 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3123 [(set_attr "type" "compare")
3124 (set_attr "length" "4,8")])
3127 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3128 (compare:CC (match_operator:SI 4 "boolean_operator"
3129 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3130 (match_operand:SI 2 "gpc_reg_operand" "")])
3132 (set (match_operand:SI 0 "gpc_reg_operand" "")
3134 "TARGET_32BIT && reload_completed"
3135 [(set (match_dup 0) (match_dup 4))
3137 (compare:CC (match_dup 0)
3141 (define_insn "*boolccsi3_internal1"
3142 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3143 (match_operator:SI 3 "boolean_operator"
3144 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
3145 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))]))]
3149 (define_insn "*boolccsi3_internal2"
3150 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3151 (compare:CC (match_operator:SI 4 "boolean_operator"
3152 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
3153 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
3155 (clobber (match_scratch:SI 3 "=r,r"))]
3160 [(set_attr "type" "fast_compare,compare")
3161 (set_attr "length" "4,8")])
3164 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3165 (compare:CC (match_operator:SI 4 "boolean_operator"
3166 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3167 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
3169 (clobber (match_scratch:SI 3 ""))]
3170 "TARGET_32BIT && reload_completed"
3171 [(set (match_dup 3) (match_dup 4))
3173 (compare:CC (match_dup 3)
3177 (define_insn "*boolccsi3_internal3"
3178 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3179 (compare:CC (match_operator:SI 4 "boolean_operator"
3180 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
3181 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
3183 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3189 [(set_attr "type" "fast_compare,compare")
3190 (set_attr "length" "4,8")])
3193 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3194 (compare:CC (match_operator:SI 4 "boolean_operator"
3195 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3196 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
3198 (set (match_operand:SI 0 "gpc_reg_operand" "")
3200 "TARGET_32BIT && reload_completed"
3201 [(set (match_dup 0) (match_dup 4))
3203 (compare:CC (match_dup 0)
3207 ;; Rotate and shift insns, in all their variants. These support shifts,
3208 ;; field inserts and extracts, and various combinations thereof.
3209 (define_expand "insv"
3210 [(set (zero_extract (match_operand 0 "gpc_reg_operand" "")
3211 (match_operand:SI 1 "const_int_operand" "")
3212 (match_operand:SI 2 "const_int_operand" ""))
3213 (match_operand 3 "gpc_reg_operand" ""))]
3217 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3218 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3219 compiler if the address of the structure is taken later. Likewise, do
3220 not handle invalid E500 subregs. */
3221 if (GET_CODE (operands[0]) == SUBREG
3222 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD
3223 || ((TARGET_E500_DOUBLE || TARGET_SPE)
3224 && invalid_e500_subreg (operands[0], GET_MODE (operands[0])))))
3227 if (TARGET_POWERPC64 && GET_MODE (operands[0]) == DImode)
3228 emit_insn (gen_insvdi_internal (operands[0], operands[1], operands[2],
3231 emit_insn (gen_insvsi_internal (operands[0], operands[1], operands[2],
3236 (define_insn "insvsi_internal"
3237 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3238 (match_operand:SI 1 "const_int_operand" "i")
3239 (match_operand:SI 2 "const_int_operand" "i"))
3240 (match_operand:SI 3 "gpc_reg_operand" "r"))]
3244 int start = INTVAL (operands[2]) & 31;
3245 int size = INTVAL (operands[1]) & 31;
3247 operands[4] = GEN_INT (32 - start - size);
3248 operands[1] = GEN_INT (start + size - 1);
3249 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3251 [(set_attr "type" "insert_word")])
3253 (define_insn "*insvsi_internal1"
3254 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3255 (match_operand:SI 1 "const_int_operand" "i")
3256 (match_operand:SI 2 "const_int_operand" "i"))
3257 (rotate:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3258 (match_operand:SI 4 "const_int_operand" "i")))]
3259 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3262 int shift = INTVAL (operands[4]) & 31;
3263 int start = INTVAL (operands[2]) & 31;
3264 int size = INTVAL (operands[1]) & 31;
3266 operands[4] = GEN_INT (shift - start - size);
3267 operands[1] = GEN_INT (start + size - 1);
3268 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3270 [(set_attr "type" "insert_word")])
3272 (define_insn "*insvsi_internal2"
3273 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3274 (match_operand:SI 1 "const_int_operand" "i")
3275 (match_operand:SI 2 "const_int_operand" "i"))
3276 (ashiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3277 (match_operand:SI 4 "const_int_operand" "i")))]
3278 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3281 int shift = INTVAL (operands[4]) & 31;
3282 int start = INTVAL (operands[2]) & 31;
3283 int size = INTVAL (operands[1]) & 31;
3285 operands[4] = GEN_INT (32 - shift - start - size);
3286 operands[1] = GEN_INT (start + size - 1);
3287 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3289 [(set_attr "type" "insert_word")])
3291 (define_insn "*insvsi_internal3"
3292 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3293 (match_operand:SI 1 "const_int_operand" "i")
3294 (match_operand:SI 2 "const_int_operand" "i"))
3295 (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3296 (match_operand:SI 4 "const_int_operand" "i")))]
3297 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3300 int shift = INTVAL (operands[4]) & 31;
3301 int start = INTVAL (operands[2]) & 31;
3302 int size = INTVAL (operands[1]) & 31;
3304 operands[4] = GEN_INT (32 - shift - start - size);
3305 operands[1] = GEN_INT (start + size - 1);
3306 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3308 [(set_attr "type" "insert_word")])
3310 (define_insn "*insvsi_internal4"
3311 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3312 (match_operand:SI 1 "const_int_operand" "i")
3313 (match_operand:SI 2 "const_int_operand" "i"))
3314 (zero_extract:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3315 (match_operand:SI 4 "const_int_operand" "i")
3316 (match_operand:SI 5 "const_int_operand" "i")))]
3317 "INTVAL (operands[4]) >= INTVAL (operands[1])"
3320 int extract_start = INTVAL (operands[5]) & 31;
3321 int extract_size = INTVAL (operands[4]) & 31;
3322 int insert_start = INTVAL (operands[2]) & 31;
3323 int insert_size = INTVAL (operands[1]) & 31;
3325 /* Align extract field with insert field */
3326 operands[5] = GEN_INT (extract_start + extract_size - insert_start - insert_size);
3327 operands[1] = GEN_INT (insert_start + insert_size - 1);
3328 return \"rlwimi %0,%3,%h5,%h2,%h1\";
3330 [(set_attr "type" "insert_word")])
3332 ;; combine patterns for rlwimi
3333 (define_insn "*insvsi_internal5"
3334 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3335 (ior:SI (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
3336 (match_operand:SI 1 "mask_operand" "i"))
3337 (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3338 (match_operand:SI 2 "const_int_operand" "i"))
3339 (match_operand:SI 5 "mask_operand" "i"))))]
3340 "INTVAL(operands[1]) == ~INTVAL(operands[5])"
3343 int me = extract_ME(operands[5]);
3344 int mb = extract_MB(operands[5]);
3345 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
3346 operands[2] = GEN_INT(mb);
3347 operands[1] = GEN_INT(me);
3348 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3350 [(set_attr "type" "insert_word")])
3352 (define_insn "*insvsi_internal6"
3353 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3354 (ior:SI (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3355 (match_operand:SI 2 "const_int_operand" "i"))
3356 (match_operand:SI 5 "mask_operand" "i"))
3357 (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
3358 (match_operand:SI 1 "mask_operand" "i"))))]
3359 "INTVAL(operands[1]) == ~INTVAL(operands[5])"
3362 int me = extract_ME(operands[5]);
3363 int mb = extract_MB(operands[5]);
3364 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
3365 operands[2] = GEN_INT(mb);
3366 operands[1] = GEN_INT(me);
3367 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3369 [(set_attr "type" "insert_word")])
3371 (define_insn "insvdi_internal"
3372 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3373 (match_operand:SI 1 "const_int_operand" "i")
3374 (match_operand:SI 2 "const_int_operand" "i"))
3375 (match_operand:DI 3 "gpc_reg_operand" "r"))]
3379 int start = INTVAL (operands[2]) & 63;
3380 int size = INTVAL (operands[1]) & 63;
3382 operands[1] = GEN_INT (64 - start - size);
3383 return \"rldimi %0,%3,%H1,%H2\";
3385 [(set_attr "type" "insert_dword")])
3387 (define_insn "*insvdi_internal2"
3388 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3389 (match_operand:SI 1 "const_int_operand" "i")
3390 (match_operand:SI 2 "const_int_operand" "i"))
3391 (ashiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
3392 (match_operand:SI 4 "const_int_operand" "i")))]
3394 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
3397 int shift = INTVAL (operands[4]) & 63;
3398 int start = (INTVAL (operands[2]) & 63) - 32;
3399 int size = INTVAL (operands[1]) & 63;
3401 operands[4] = GEN_INT (64 - shift - start - size);
3402 operands[2] = GEN_INT (start);
3403 operands[1] = GEN_INT (start + size - 1);
3404 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3407 (define_insn "*insvdi_internal3"
3408 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3409 (match_operand:SI 1 "const_int_operand" "i")
3410 (match_operand:SI 2 "const_int_operand" "i"))
3411 (lshiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
3412 (match_operand:SI 4 "const_int_operand" "i")))]
3414 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
3417 int shift = INTVAL (operands[4]) & 63;
3418 int start = (INTVAL (operands[2]) & 63) - 32;
3419 int size = INTVAL (operands[1]) & 63;
3421 operands[4] = GEN_INT (64 - shift - start - size);
3422 operands[2] = GEN_INT (start);
3423 operands[1] = GEN_INT (start + size - 1);
3424 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3427 (define_expand "extzv"
3428 [(set (match_operand 0 "gpc_reg_operand" "")
3429 (zero_extract (match_operand 1 "gpc_reg_operand" "")
3430 (match_operand:SI 2 "const_int_operand" "")
3431 (match_operand:SI 3 "const_int_operand" "")))]
3435 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3436 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3437 compiler if the address of the structure is taken later. */
3438 if (GET_CODE (operands[0]) == SUBREG
3439 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
3442 if (TARGET_POWERPC64 && GET_MODE (operands[1]) == DImode)
3443 emit_insn (gen_extzvdi_internal (operands[0], operands[1], operands[2],
3446 emit_insn (gen_extzvsi_internal (operands[0], operands[1], operands[2],
3451 (define_insn "extzvsi_internal"
3452 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3453 (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3454 (match_operand:SI 2 "const_int_operand" "i")
3455 (match_operand:SI 3 "const_int_operand" "i")))]
3459 int start = INTVAL (operands[3]) & 31;
3460 int size = INTVAL (operands[2]) & 31;
3462 if (start + size >= 32)
3463 operands[3] = const0_rtx;
3465 operands[3] = GEN_INT (start + size);
3466 return \"rlwinm %0,%1,%3,%s2,31\";
3469 (define_insn "*extzvsi_internal1"
3470 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3471 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3472 (match_operand:SI 2 "const_int_operand" "i,i")
3473 (match_operand:SI 3 "const_int_operand" "i,i"))
3475 (clobber (match_scratch:SI 4 "=r,r"))]
3479 int start = INTVAL (operands[3]) & 31;
3480 int size = INTVAL (operands[2]) & 31;
3482 /* Force split for non-cc0 compare. */
3483 if (which_alternative == 1)
3486 /* If the bit-field being tested fits in the upper or lower half of a
3487 word, it is possible to use andiu. or andil. to test it. This is
3488 useful because the condition register set-use delay is smaller for
3489 andi[ul]. than for rlinm. This doesn't work when the starting bit
3490 position is 0 because the LT and GT bits may be set wrong. */
3492 if ((start > 0 && start + size <= 16) || start >= 16)
3494 operands[3] = GEN_INT (((1 << (16 - (start & 15)))
3495 - (1 << (16 - (start & 15) - size))));
3497 return \"andis. %4,%1,%3\";
3499 return \"andi. %4,%1,%3\";
3502 if (start + size >= 32)
3503 operands[3] = const0_rtx;
3505 operands[3] = GEN_INT (start + size);
3506 return \"rlwinm. %4,%1,%3,%s2,31\";
3508 [(set_attr "type" "delayed_compare")
3509 (set_attr "length" "4,8")])
3512 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3513 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3514 (match_operand:SI 2 "const_int_operand" "")
3515 (match_operand:SI 3 "const_int_operand" ""))
3517 (clobber (match_scratch:SI 4 ""))]
3520 (zero_extract:SI (match_dup 1) (match_dup 2)
3523 (compare:CC (match_dup 4)
3527 (define_insn "*extzvsi_internal2"
3528 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3529 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3530 (match_operand:SI 2 "const_int_operand" "i,i")
3531 (match_operand:SI 3 "const_int_operand" "i,i"))
3533 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3534 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3538 int start = INTVAL (operands[3]) & 31;
3539 int size = INTVAL (operands[2]) & 31;
3541 /* Force split for non-cc0 compare. */
3542 if (which_alternative == 1)
3545 /* Since we are using the output value, we can't ignore any need for
3546 a shift. The bit-field must end at the LSB. */
3547 if (start >= 16 && start + size == 32)
3549 operands[3] = GEN_INT ((1 << size) - 1);
3550 return \"andi. %0,%1,%3\";
3553 if (start + size >= 32)
3554 operands[3] = const0_rtx;
3556 operands[3] = GEN_INT (start + size);
3557 return \"rlwinm. %0,%1,%3,%s2,31\";
3559 [(set_attr "type" "delayed_compare")
3560 (set_attr "length" "4,8")])
3563 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
3564 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3565 (match_operand:SI 2 "const_int_operand" "")
3566 (match_operand:SI 3 "const_int_operand" ""))
3568 (set (match_operand:SI 0 "gpc_reg_operand" "")
3569 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3572 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))
3574 (compare:CC (match_dup 0)
3578 (define_insn "extzvdi_internal"
3579 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
3580 (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3581 (match_operand:SI 2 "const_int_operand" "i")
3582 (match_operand:SI 3 "const_int_operand" "i")))]
3586 int start = INTVAL (operands[3]) & 63;
3587 int size = INTVAL (operands[2]) & 63;
3589 if (start + size >= 64)
3590 operands[3] = const0_rtx;
3592 operands[3] = GEN_INT (start + size);
3593 operands[2] = GEN_INT (64 - size);
3594 return \"rldicl %0,%1,%3,%2\";
3597 (define_insn "*extzvdi_internal1"
3598 [(set (match_operand:CC 0 "gpc_reg_operand" "=x")
3599 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3600 (match_operand:SI 2 "const_int_operand" "i")
3601 (match_operand:SI 3 "const_int_operand" "i"))
3603 (clobber (match_scratch:DI 4 "=r"))]
3604 "TARGET_64BIT && rs6000_gen_cell_microcode"
3607 int start = INTVAL (operands[3]) & 63;
3608 int size = INTVAL (operands[2]) & 63;
3610 if (start + size >= 64)
3611 operands[3] = const0_rtx;
3613 operands[3] = GEN_INT (start + size);
3614 operands[2] = GEN_INT (64 - size);
3615 return \"rldicl. %4,%1,%3,%2\";
3617 [(set_attr "type" "compare")])
3619 (define_insn "*extzvdi_internal2"
3620 [(set (match_operand:CC 4 "gpc_reg_operand" "=x")
3621 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3622 (match_operand:SI 2 "const_int_operand" "i")
3623 (match_operand:SI 3 "const_int_operand" "i"))
3625 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
3626 (zero_extract:DI (match_dup 1) (match_dup 2) (match_dup 3)))]
3627 "TARGET_64BIT && rs6000_gen_cell_microcode"
3630 int start = INTVAL (operands[3]) & 63;
3631 int size = INTVAL (operands[2]) & 63;
3633 if (start + size >= 64)
3634 operands[3] = const0_rtx;
3636 operands[3] = GEN_INT (start + size);
3637 operands[2] = GEN_INT (64 - size);
3638 return \"rldicl. %0,%1,%3,%2\";
3640 [(set_attr "type" "compare")])
3642 (define_insn "rotlsi3"
3643 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3644 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3645 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
3648 rlwnm %0,%1,%2,0xffffffff
3649 rlwinm %0,%1,%h2,0xffffffff"
3650 [(set_attr "type" "var_shift_rotate,integer")])
3652 (define_insn "*rotlsi3_64"
3653 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
3655 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3656 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))))]
3659 rlwnm %0,%1,%2,0xffffffff
3660 rlwinm %0,%1,%h2,0xffffffff"
3661 [(set_attr "type" "var_shift_rotate,integer")])
3663 (define_insn "*rotlsi3_internal2"
3664 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3665 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3666 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3668 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
3671 rlwnm. %3,%1,%2,0xffffffff
3672 rlwinm. %3,%1,%h2,0xffffffff
3675 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3676 (set_attr "length" "4,4,8,8")])
3679 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3680 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3681 (match_operand:SI 2 "reg_or_cint_operand" ""))
3683 (clobber (match_scratch:SI 3 ""))]
3686 (rotate:SI (match_dup 1) (match_dup 2)))
3688 (compare:CC (match_dup 3)
3692 (define_insn "*rotlsi3_internal3"
3693 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
3694 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3695 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3697 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
3698 (rotate:SI (match_dup 1) (match_dup 2)))]
3701 rlwnm. %0,%1,%2,0xffffffff
3702 rlwinm. %0,%1,%h2,0xffffffff
3705 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3706 (set_attr "length" "4,4,8,8")])
3709 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3710 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3711 (match_operand:SI 2 "reg_or_cint_operand" ""))
3713 (set (match_operand:SI 0 "gpc_reg_operand" "")
3714 (rotate:SI (match_dup 1) (match_dup 2)))]
3717 (rotate:SI (match_dup 1) (match_dup 2)))
3719 (compare:CC (match_dup 0)
3723 (define_insn "*rotlsi3_internal4"
3724 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3725 (and:SI (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3726 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
3727 (match_operand:SI 3 "mask_operand" "n,n")))]
3730 rlwnm %0,%1,%2,%m3,%M3
3731 rlwinm %0,%1,%h2,%m3,%M3"
3732 [(set_attr "type" "var_shift_rotate,integer")])
3734 (define_insn "*rotlsi3_internal5"
3735 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3737 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3738 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3739 (match_operand:SI 3 "mask_operand" "n,n,n,n"))
3741 (clobber (match_scratch:SI 4 "=r,r,r,r"))]
3744 rlwnm. %4,%1,%2,%m3,%M3
3745 rlwinm. %4,%1,%h2,%m3,%M3
3748 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3749 (set_attr "length" "4,4,8,8")])
3752 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3754 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3755 (match_operand:SI 2 "reg_or_cint_operand" ""))
3756 (match_operand:SI 3 "mask_operand" ""))
3758 (clobber (match_scratch:SI 4 ""))]
3761 (and:SI (rotate:SI (match_dup 1)
3765 (compare:CC (match_dup 4)
3769 (define_insn "*rotlsi3_internal6"
3770 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
3772 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3773 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3774 (match_operand:SI 3 "mask_operand" "n,n,n,n"))
3776 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
3777 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3780 rlwnm. %0,%1,%2,%m3,%M3
3781 rlwinm. %0,%1,%h2,%m3,%M3
3784 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3785 (set_attr "length" "4,4,8,8")])
3788 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
3790 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3791 (match_operand:SI 2 "reg_or_cint_operand" ""))
3792 (match_operand:SI 3 "mask_operand" ""))
3794 (set (match_operand:SI 0 "gpc_reg_operand" "")
3795 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3798 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
3800 (compare:CC (match_dup 0)
3804 (define_insn "*rotlsi3_internal7le"
3805 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3808 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3809 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
3811 "rlw%I2nm %0,%1,%h2,0xff"
3812 [(set (attr "cell_micro")
3813 (if_then_else (match_operand:SI 2 "const_int_operand" "")
3814 (const_string "not")
3815 (const_string "always")))])
3817 (define_insn "*rotlsi3_internal7be"
3818 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3821 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3822 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 3)))]
3824 "rlw%I2nm %0,%1,%h2,0xff"
3825 [(set (attr "cell_micro")
3826 (if_then_else (match_operand:SI 2 "const_int_operand" "")
3827 (const_string "not")
3828 (const_string "always")))])
3830 (define_insn "*rotlsi3_internal8le"
3831 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3832 (compare:CC (zero_extend:SI
3834 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3835 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
3837 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
3840 rlwnm. %3,%1,%2,0xff
3841 rlwinm. %3,%1,%h2,0xff
3844 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3845 (set_attr "length" "4,4,8,8")])
3847 (define_insn "*rotlsi3_internal8be"
3848 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3849 (compare:CC (zero_extend:SI
3851 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3852 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 3))
3854 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
3857 rlwnm. %3,%1,%2,0xff
3858 rlwinm. %3,%1,%h2,0xff
3861 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3862 (set_attr "length" "4,4,8,8")])
3865 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3866 (compare:CC (zero_extend:SI
3868 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3869 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3871 (clobber (match_scratch:SI 3 ""))]
3872 "!BYTES_BIG_ENDIAN && reload_completed"
3874 (zero_extend:SI (subreg:QI
3875 (rotate:SI (match_dup 1)
3878 (compare:CC (match_dup 3)
3883 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3884 (compare:CC (zero_extend:SI
3886 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3887 (match_operand:SI 2 "reg_or_cint_operand" "")) 3))
3889 (clobber (match_scratch:SI 3 ""))]
3890 "BYTES_BIG_ENDIAN && reload_completed"
3892 (zero_extend:SI (subreg:QI
3893 (rotate:SI (match_dup 1)
3896 (compare:CC (match_dup 3)
3900 (define_insn "*rotlsi3_internal9le"
3901 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
3902 (compare:CC (zero_extend:SI
3904 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3905 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
3907 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
3908 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3911 rlwnm. %0,%1,%2,0xff
3912 rlwinm. %0,%1,%h2,0xff
3915 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3916 (set_attr "length" "4,4,8,8")])
3918 (define_insn "*rotlsi3_internal9be"
3919 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
3920 (compare:CC (zero_extend:SI
3922 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3923 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 3))
3925 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
3926 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 3)))]
3929 rlwnm. %0,%1,%2,0xff
3930 rlwinm. %0,%1,%h2,0xff
3933 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3934 (set_attr "length" "4,4,8,8")])
3937 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3938 (compare:CC (zero_extend:SI
3940 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3941 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3943 (set (match_operand:SI 0 "gpc_reg_operand" "")
3944 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3945 "!BYTES_BIG_ENDIAN && reload_completed"
3947 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
3949 (compare:CC (match_dup 0)
3954 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3955 (compare:CC (zero_extend:SI
3957 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3958 (match_operand:SI 2 "reg_or_cint_operand" "")) 3))
3960 (set (match_operand:SI 0 "gpc_reg_operand" "")
3961 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 3)))]
3962 "BYTES_BIG_ENDIAN && reload_completed"
3964 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 3)))
3966 (compare:CC (match_dup 0)
3970 (define_insn "*rotlsi3_internal10le"
3971 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3974 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3975 (match_operand:SI 2 "reg_or_cint_operand" "r,i")) 0)))]
3978 rlwnm %0,%1,%2,0xffff
3979 rlwinm %0,%1,%h2,0xffff"
3980 [(set_attr "type" "var_shift_rotate,integer")])
3982 (define_insn "*rotlsi3_internal10be"
3983 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3986 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3987 (match_operand:SI 2 "reg_or_cint_operand" "r,i")) 2)))]
3990 rlwnm %0,%1,%2,0xffff
3991 rlwinm %0,%1,%h2,0xffff"
3992 [(set_attr "type" "var_shift_rotate,integer")])
3994 (define_insn "*rotlsi3_internal11le"
3995 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3996 (compare:CC (zero_extend:SI
3998 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3999 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4001 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4004 rlwnm. %3,%1,%2,0xffff
4005 rlwinm. %3,%1,%h2,0xffff
4008 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4009 (set_attr "length" "4,4,8,8")])
4011 (define_insn "*rotlsi3_internal11be"
4012 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4013 (compare:CC (zero_extend:SI
4015 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4016 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 2))
4018 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4021 rlwnm. %3,%1,%2,0xffff
4022 rlwinm. %3,%1,%h2,0xffff
4025 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4026 (set_attr "length" "4,4,8,8")])
4029 [(set (match_operand:CC 0 "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" "")) 0))
4035 (clobber (match_scratch:SI 3 ""))]
4036 "!BYTES_BIG_ENDIAN && reload_completed"
4038 (zero_extend:SI (subreg:HI
4039 (rotate:SI (match_dup 1)
4042 (compare:CC (match_dup 3)
4047 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4048 (compare:CC (zero_extend:SI
4050 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4051 (match_operand:SI 2 "reg_or_cint_operand" "")) 2))
4053 (clobber (match_scratch:SI 3 ""))]
4054 "BYTES_BIG_ENDIAN && reload_completed"
4056 (zero_extend:SI (subreg:HI
4057 (rotate:SI (match_dup 1)
4060 (compare:CC (match_dup 3)
4064 (define_insn "*rotlsi3_internal12le"
4065 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4066 (compare:CC (zero_extend:SI
4068 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4069 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4071 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4072 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4075 rlwnm. %0,%1,%2,0xffff
4076 rlwinm. %0,%1,%h2,0xffff
4079 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4080 (set_attr "length" "4,4,8,8")])
4082 (define_insn "*rotlsi3_internal12be"
4083 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4084 (compare:CC (zero_extend:SI
4086 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4087 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 2))
4089 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4090 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 2)))]
4093 rlwnm. %0,%1,%2,0xffff
4094 rlwinm. %0,%1,%h2,0xffff
4097 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4098 (set_attr "length" "4,4,8,8")])
4101 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4102 (compare:CC (zero_extend:SI
4104 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4105 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4107 (set (match_operand:SI 0 "gpc_reg_operand" "")
4108 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4109 "!BYTES_BIG_ENDIAN && reload_completed"
4111 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
4113 (compare:CC (match_dup 0)
4118 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4119 (compare:CC (zero_extend:SI
4121 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4122 (match_operand:SI 2 "reg_or_cint_operand" "")) 2))
4124 (set (match_operand:SI 0 "gpc_reg_operand" "")
4125 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 2)))]
4126 "BYTES_BIG_ENDIAN && reload_completed"
4128 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 2)))
4130 (compare:CC (match_dup 0)
4134 (define_insn "ashlsi3"
4135 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4136 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4137 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
4142 [(set_attr "type" "var_shift_rotate,shift")])
4144 (define_insn "*ashlsi3_64"
4145 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
4147 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4148 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))))]
4153 [(set_attr "type" "var_shift_rotate,shift")])
4156 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4157 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4158 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4160 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4167 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4168 (set_attr "length" "4,4,8,8")])
4171 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4172 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4173 (match_operand:SI 2 "reg_or_cint_operand" ""))
4175 (clobber (match_scratch:SI 3 ""))]
4176 "TARGET_32BIT && reload_completed"
4178 (ashift:SI (match_dup 1) (match_dup 2)))
4180 (compare:CC (match_dup 3)
4185 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4186 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4187 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4189 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4190 (ashift:SI (match_dup 1) (match_dup 2)))]
4197 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4198 (set_attr "length" "4,4,8,8")])
4201 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4202 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4203 (match_operand:SI 2 "reg_or_cint_operand" ""))
4205 (set (match_operand:SI 0 "gpc_reg_operand" "")
4206 (ashift:SI (match_dup 1) (match_dup 2)))]
4207 "TARGET_32BIT && reload_completed"
4209 (ashift:SI (match_dup 1) (match_dup 2)))
4211 (compare:CC (match_dup 0)
4215 (define_insn "rlwinm"
4216 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4217 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4218 (match_operand:SI 2 "const_int_operand" "i"))
4219 (match_operand:SI 3 "mask_operand" "n")))]
4220 "includes_lshift_p (operands[2], operands[3])"
4221 "rlwinm %0,%1,%h2,%m3,%M3")
4224 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4226 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4227 (match_operand:SI 2 "const_int_operand" "i,i"))
4228 (match_operand:SI 3 "mask_operand" "n,n"))
4230 (clobber (match_scratch:SI 4 "=r,r"))]
4231 "includes_lshift_p (operands[2], operands[3])"
4233 rlwinm. %4,%1,%h2,%m3,%M3
4235 [(set_attr "type" "delayed_compare")
4236 (set_attr "length" "4,8")])
4239 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4241 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4242 (match_operand:SI 2 "const_int_operand" ""))
4243 (match_operand:SI 3 "mask_operand" ""))
4245 (clobber (match_scratch:SI 4 ""))]
4246 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
4248 (and:SI (ashift:SI (match_dup 1) (match_dup 2))
4251 (compare:CC (match_dup 4)
4256 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4258 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4259 (match_operand:SI 2 "const_int_operand" "i,i"))
4260 (match_operand:SI 3 "mask_operand" "n,n"))
4262 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4263 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4264 "includes_lshift_p (operands[2], operands[3])"
4266 rlwinm. %0,%1,%h2,%m3,%M3
4268 [(set_attr "type" "delayed_compare")
4269 (set_attr "length" "4,8")])
4272 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
4274 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4275 (match_operand:SI 2 "const_int_operand" ""))
4276 (match_operand:SI 3 "mask_operand" ""))
4278 (set (match_operand:SI 0 "gpc_reg_operand" "")
4279 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4280 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
4282 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4284 (compare:CC (match_dup 0)
4288 (define_insn "lshrsi3"
4289 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
4290 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
4291 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i")))]
4297 [(set_attr "type" "integer,var_shift_rotate,shift")])
4299 (define_insn "*lshrsi3_64"
4300 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
4302 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4303 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))))]
4308 [(set_attr "type" "var_shift_rotate,shift")])
4311 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,?y,?y,?y")
4312 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
4313 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i,O,r,i"))
4315 (clobber (match_scratch:SI 3 "=X,r,r,X,r,r"))]
4324 [(set_attr "type" "delayed_compare,var_delayed_compare,delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4325 (set_attr "length" "4,4,4,8,8,8")])
4328 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4329 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4330 (match_operand:SI 2 "reg_or_cint_operand" ""))
4332 (clobber (match_scratch:SI 3 ""))]
4333 "TARGET_32BIT && reload_completed"
4335 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4337 (compare:CC (match_dup 3)
4342 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,?y,?y,?y")
4343 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
4344 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i,O,r,i"))
4346 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
4347 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
4356 [(set_attr "type" "delayed_compare,var_delayed_compare,delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4357 (set_attr "length" "4,4,4,8,8,8")])
4360 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4361 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4362 (match_operand:SI 2 "reg_or_cint_operand" ""))
4364 (set (match_operand:SI 0 "gpc_reg_operand" "")
4365 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
4366 "TARGET_32BIT && reload_completed"
4368 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4370 (compare:CC (match_dup 0)
4375 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4376 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4377 (match_operand:SI 2 "const_int_operand" "i"))
4378 (match_operand:SI 3 "mask_operand" "n")))]
4379 "includes_rshift_p (operands[2], operands[3])"
4380 "rlwinm %0,%1,%s2,%m3,%M3")
4383 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4385 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4386 (match_operand:SI 2 "const_int_operand" "i,i"))
4387 (match_operand:SI 3 "mask_operand" "n,n"))
4389 (clobber (match_scratch:SI 4 "=r,r"))]
4390 "includes_rshift_p (operands[2], operands[3])"
4392 rlwinm. %4,%1,%s2,%m3,%M3
4394 [(set_attr "type" "delayed_compare")
4395 (set_attr "length" "4,8")])
4398 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4400 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4401 (match_operand:SI 2 "const_int_operand" ""))
4402 (match_operand:SI 3 "mask_operand" ""))
4404 (clobber (match_scratch:SI 4 ""))]
4405 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
4407 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2))
4410 (compare:CC (match_dup 4)
4415 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4417 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4418 (match_operand:SI 2 "const_int_operand" "i,i"))
4419 (match_operand:SI 3 "mask_operand" "n,n"))
4421 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4422 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4423 "includes_rshift_p (operands[2], operands[3])"
4425 rlwinm. %0,%1,%s2,%m3,%M3
4427 [(set_attr "type" "delayed_compare")
4428 (set_attr "length" "4,8")])
4431 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
4433 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4434 (match_operand:SI 2 "const_int_operand" ""))
4435 (match_operand:SI 3 "mask_operand" ""))
4437 (set (match_operand:SI 0 "gpc_reg_operand" "")
4438 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4439 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
4441 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4443 (compare:CC (match_dup 0)
4447 (define_insn "*lshiftrt_internal1le"
4448 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4451 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4452 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4453 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255))"
4454 "rlwinm %0,%1,%s2,0xff")
4456 (define_insn "*lshiftrt_internal1be"
4457 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4460 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4461 (match_operand:SI 2 "const_int_operand" "i")) 3)))]
4462 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255))"
4463 "rlwinm %0,%1,%s2,0xff")
4465 (define_insn "*lshiftrt_internal2le"
4466 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4470 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4471 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4473 (clobber (match_scratch:SI 3 "=r,r"))]
4474 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255))"
4476 rlwinm. %3,%1,%s2,0xff
4478 [(set_attr "type" "delayed_compare")
4479 (set_attr "length" "4,8")])
4481 (define_insn "*lshiftrt_internal2be"
4482 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4486 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4487 (match_operand:SI 2 "const_int_operand" "i,i")) 3))
4489 (clobber (match_scratch:SI 3 "=r,r"))]
4490 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255))"
4492 rlwinm. %3,%1,%s2,0xff
4494 [(set_attr "type" "delayed_compare")
4495 (set_attr "length" "4,8")])
4498 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4502 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4503 (match_operand:SI 2 "const_int_operand" "")) 0))
4505 (clobber (match_scratch:SI 3 ""))]
4506 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4508 (zero_extend:SI (subreg:QI
4509 (lshiftrt:SI (match_dup 1)
4512 (compare:CC (match_dup 3)
4517 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4521 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4522 (match_operand:SI 2 "const_int_operand" "")) 3))
4524 (clobber (match_scratch:SI 3 ""))]
4525 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4527 (zero_extend:SI (subreg:QI
4528 (lshiftrt:SI (match_dup 1)
4531 (compare:CC (match_dup 3)
4535 (define_insn "*lshiftrt_internal3le"
4536 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4540 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4541 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4543 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4544 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4545 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255))"
4547 rlwinm. %0,%1,%s2,0xff
4549 [(set_attr "type" "delayed_compare")
4550 (set_attr "length" "4,8")])
4552 (define_insn "*lshiftrt_internal3be"
4553 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4557 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4558 (match_operand:SI 2 "const_int_operand" "i,i")) 3))
4560 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4561 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 3)))]
4562 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255))"
4564 rlwinm. %0,%1,%s2,0xff
4566 [(set_attr "type" "delayed_compare")
4567 (set_attr "length" "4,8")])
4570 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4574 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4575 (match_operand:SI 2 "const_int_operand" "")) 0))
4577 (set (match_operand:SI 0 "gpc_reg_operand" "")
4578 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4579 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4581 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4583 (compare:CC (match_dup 0)
4588 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4592 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4593 (match_operand:SI 2 "const_int_operand" "")) 3))
4595 (set (match_operand:SI 0 "gpc_reg_operand" "")
4596 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 3)))]
4597 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4599 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 3)))
4601 (compare:CC (match_dup 0)
4605 (define_insn "*lshiftrt_internal4le"
4606 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4609 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4610 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4611 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535))"
4612 "rlwinm %0,%1,%s2,0xffff")
4614 (define_insn "*lshiftrt_internal4be"
4615 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4618 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4619 (match_operand:SI 2 "const_int_operand" "i")) 2)))]
4620 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535))"
4621 "rlwinm %0,%1,%s2,0xffff")
4623 (define_insn "*lshiftrt_internal5le"
4624 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4628 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4629 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4631 (clobber (match_scratch:SI 3 "=r,r"))]
4632 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535))"
4634 rlwinm. %3,%1,%s2,0xffff
4636 [(set_attr "type" "delayed_compare")
4637 (set_attr "length" "4,8")])
4639 (define_insn "*lshiftrt_internal5be"
4640 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4644 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4645 (match_operand:SI 2 "const_int_operand" "i,i")) 2))
4647 (clobber (match_scratch:SI 3 "=r,r"))]
4648 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535))"
4650 rlwinm. %3,%1,%s2,0xffff
4652 [(set_attr "type" "delayed_compare")
4653 (set_attr "length" "4,8")])
4656 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4660 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4661 (match_operand:SI 2 "const_int_operand" "")) 0))
4663 (clobber (match_scratch:SI 3 ""))]
4664 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4666 (zero_extend:SI (subreg:HI
4667 (lshiftrt:SI (match_dup 1)
4670 (compare:CC (match_dup 3)
4675 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4679 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4680 (match_operand:SI 2 "const_int_operand" "")) 2))
4682 (clobber (match_scratch:SI 3 ""))]
4683 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4685 (zero_extend:SI (subreg:HI
4686 (lshiftrt:SI (match_dup 1)
4689 (compare:CC (match_dup 3)
4693 (define_insn "*lshiftrt_internal5le"
4694 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4698 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4699 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4701 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4702 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4703 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535))"
4705 rlwinm. %0,%1,%s2,0xffff
4707 [(set_attr "type" "delayed_compare")
4708 (set_attr "length" "4,8")])
4710 (define_insn "*lshiftrt_internal5be"
4711 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4715 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4716 (match_operand:SI 2 "const_int_operand" "i,i")) 2))
4718 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4719 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 2)))]
4720 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535))"
4722 rlwinm. %0,%1,%s2,0xffff
4724 [(set_attr "type" "delayed_compare")
4725 (set_attr "length" "4,8")])
4728 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4732 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4733 (match_operand:SI 2 "const_int_operand" "")) 0))
4735 (set (match_operand:SI 0 "gpc_reg_operand" "")
4736 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4737 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4739 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4741 (compare:CC (match_dup 0)
4746 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4750 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4751 (match_operand:SI 2 "const_int_operand" "")) 2))
4753 (set (match_operand:SI 0 "gpc_reg_operand" "")
4754 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 2)))]
4755 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4757 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 2)))
4759 (compare:CC (match_dup 0)
4763 (define_insn "ashrsi3"
4764 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4765 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4766 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
4771 [(set_attr "type" "var_shift_rotate,shift")])
4773 (define_insn "*ashrsi3_64"
4774 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
4776 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4777 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))))]
4782 [(set_attr "type" "var_shift_rotate,shift")])
4785 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4786 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4787 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4789 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4796 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4797 (set_attr "length" "4,4,8,8")])
4800 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4801 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4802 (match_operand:SI 2 "reg_or_cint_operand" ""))
4804 (clobber (match_scratch:SI 3 ""))]
4807 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4809 (compare:CC (match_dup 3)
4814 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4815 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4816 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4818 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4819 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
4826 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4827 (set_attr "length" "4,4,8,8")])
4829 ;; Builtins to replace a division to generate FRE reciprocal estimate
4830 ;; instructions and the necessary fixup instructions
4831 (define_expand "recip<mode>3"
4832 [(match_operand:RECIPF 0 "gpc_reg_operand" "")
4833 (match_operand:RECIPF 1 "gpc_reg_operand" "")
4834 (match_operand:RECIPF 2 "gpc_reg_operand" "")]
4835 "RS6000_RECIP_HAVE_RE_P (<MODE>mode)"
4837 rs6000_emit_swdiv (operands[0], operands[1], operands[2], false);
4841 ;; Split to create division from FRE/FRES/etc. and fixup instead of the normal
4842 ;; hardware division. This is only done before register allocation and with
4843 ;; -ffast-math. This must appear before the divsf3/divdf3 insns.
4845 [(set (match_operand:RECIPF 0 "gpc_reg_operand" "")
4846 (div:RECIPF (match_operand 1 "gpc_reg_operand" "")
4847 (match_operand 2 "gpc_reg_operand" "")))]
4848 "RS6000_RECIP_AUTO_RE_P (<MODE>mode)
4849 && can_create_pseudo_p () && optimize_insn_for_speed_p ()
4850 && flag_finite_math_only && !flag_trapping_math && flag_reciprocal_math"
4853 rs6000_emit_swdiv (operands[0], operands[1], operands[2], true);
4857 ;; Builtins to replace 1/sqrt(x) with instructions using RSQRTE and the
4858 ;; appropriate fixup.
4859 (define_expand "rsqrt<mode>2"
4860 [(match_operand:RECIPF 0 "gpc_reg_operand" "")
4861 (match_operand:RECIPF 1 "gpc_reg_operand" "")]
4862 "RS6000_RECIP_HAVE_RSQRTE_P (<MODE>mode)"
4864 rs6000_emit_swrsqrt (operands[0], operands[1]);
4869 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4870 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4871 (match_operand:SI 2 "reg_or_cint_operand" ""))
4873 (set (match_operand:SI 0 "gpc_reg_operand" "")
4874 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
4877 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4879 (compare:CC (match_dup 0)
4883 ;; Floating-point insns, excluding normal data motion.
4885 ;; PowerPC has a full set of single-precision floating point instructions.
4887 ;; For the POWER architecture, we pretend that we have both SFmode and
4888 ;; DFmode insns, while, in fact, all fp insns are actually done in double.
4889 ;; The only conversions we will do will be when storing to memory. In that
4890 ;; case, we will use the "frsp" instruction before storing.
4892 ;; Note that when we store into a single-precision memory location, we need to
4893 ;; use the frsp insn first. If the register being stored isn't dead, we
4894 ;; need a scratch register for the frsp. But this is difficult when the store
4895 ;; is done by reload. It is not incorrect to do the frsp on the register in
4896 ;; this case, we just lose precision that we would have otherwise gotten but
4897 ;; is not guaranteed. Perhaps this should be tightened up at some point.
4899 (define_expand "extendsfdf2"
4900 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4901 (float_extend:DF (match_operand:SF 1 "reg_or_none500mem_operand" "")))]
4902 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
4905 (define_insn_and_split "*extendsfdf2_fpr"
4906 [(set (match_operand:DF 0 "gpc_reg_operand" "=d,?d,d")
4907 (float_extend:DF (match_operand:SF 1 "reg_or_mem_operand" "0,f,m")))]
4908 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
4913 "&& reload_completed && REG_P (operands[1]) && REGNO (operands[0]) == REGNO (operands[1])"
4916 emit_note (NOTE_INSN_DELETED);
4919 [(set_attr_alternative "type"
4920 [(const_string "fp")
4923 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
4924 (const_string "fpload_ux")
4926 (match_test "update_address_mem (operands[1], VOIDmode)")
4927 (const_string "fpload_u")
4928 (const_string "fpload")))])])
4930 (define_expand "truncdfsf2"
4931 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4932 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "")))]
4933 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
4936 (define_insn "*truncdfsf2_fpr"
4937 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4938 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "d")))]
4939 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
4941 [(set_attr "type" "fp")])
4943 (define_expand "negsf2"
4944 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4945 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
4946 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
4949 (define_insn "*negsf2"
4950 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4951 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4952 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
4954 [(set_attr "type" "fp")])
4956 (define_expand "abssf2"
4957 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4958 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
4959 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
4962 (define_insn "*abssf2"
4963 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4964 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4965 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
4967 [(set_attr "type" "fp")])
4970 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4971 (neg:SF (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f"))))]
4972 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
4974 [(set_attr "type" "fp")])
4976 (define_expand "addsf3"
4977 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4978 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "")
4979 (match_operand:SF 2 "gpc_reg_operand" "")))]
4980 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
4984 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4985 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4986 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4987 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
4989 [(set_attr "type" "fp")
4990 (set_attr "fp_type" "fp_addsub_s")])
4992 (define_expand "subsf3"
4993 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4994 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "")
4995 (match_operand:SF 2 "gpc_reg_operand" "")))]
4996 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
5000 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5001 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5002 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5003 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5005 [(set_attr "type" "fp")
5006 (set_attr "fp_type" "fp_addsub_s")])
5008 (define_expand "mulsf3"
5009 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5010 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "")
5011 (match_operand:SF 2 "gpc_reg_operand" "")))]
5012 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
5016 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5017 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5018 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5019 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5021 [(set_attr "type" "fp")
5022 (set_attr "fp_type" "fp_mul_s")])
5024 (define_expand "divsf3"
5025 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5026 (div:SF (match_operand:SF 1 "gpc_reg_operand" "")
5027 (match_operand:SF 2 "gpc_reg_operand" "")))]
5028 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
5032 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5033 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5034 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5035 "TARGET_HARD_FLOAT && TARGET_FPRS
5036 && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
5038 [(set_attr "type" "sdiv")])
5041 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5042 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))]
5045 [(set_attr "type" "fp")])
5047 ; builtin fmaf support
5048 (define_insn "*fmasf4_fpr"
5049 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5050 (fma:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5051 (match_operand:SF 2 "gpc_reg_operand" "f")
5052 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5053 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5054 "fmadds %0,%1,%2,%3"
5055 [(set_attr "type" "fp")
5056 (set_attr "fp_type" "fp_maddsub_s")])
5058 (define_insn "*fmssf4_fpr"
5059 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5060 (fma:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5061 (match_operand:SF 2 "gpc_reg_operand" "f")
5062 (neg:SF (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5063 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5064 "fmsubs %0,%1,%2,%3"
5065 [(set_attr "type" "fp")
5066 (set_attr "fp_type" "fp_maddsub_s")])
5068 (define_insn "*nfmasf4_fpr"
5069 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5070 (neg:SF (fma:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5071 (match_operand:SF 2 "gpc_reg_operand" "f")
5072 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5073 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5074 "fnmadds %0,%1,%2,%3"
5075 [(set_attr "type" "fp")
5076 (set_attr "fp_type" "fp_maddsub_s")])
5078 (define_insn "*nfmssf4_fpr"
5079 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5080 (neg:SF (fma:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5081 (match_operand:SF 2 "gpc_reg_operand" "f")
5082 (neg:SF (match_operand:SF 3 "gpc_reg_operand" "f")))))]
5083 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5084 "fnmsubs %0,%1,%2,%3"
5085 [(set_attr "type" "fp")
5086 (set_attr "fp_type" "fp_maddsub_s")])
5088 (define_expand "sqrtsf2"
5089 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5090 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
5091 "(TARGET_PPC_GPOPT || TARGET_XILINX_FPU)
5092 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
5093 && !TARGET_SIMPLE_FPU"
5097 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5098 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5099 "(TARGET_PPC_GPOPT || TARGET_XILINX_FPU) && TARGET_HARD_FLOAT
5100 && TARGET_FPRS && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
5102 [(set_attr "type" "ssqrt")])
5104 (define_insn "*rsqrtsf_internal1"
5105 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5106 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")]
5110 [(set_attr "type" "fp")])
5112 (define_expand "copysign<mode>3"
5114 (abs:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")))
5116 (neg:SFDF (abs:SFDF (match_dup 1))))
5117 (set (match_operand:SFDF 0 "gpc_reg_operand" "")
5118 (if_then_else:SFDF (ge (match_operand:SFDF 2 "gpc_reg_operand" "")
5122 "TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>
5123 && ((TARGET_PPC_GFXOPT
5124 && !HONOR_NANS (<MODE>mode)
5125 && !HONOR_SIGNED_ZEROS (<MODE>mode))
5127 || VECTOR_UNIT_VSX_P (<MODE>mode))"
5129 if (TARGET_CMPB || VECTOR_UNIT_VSX_P (<MODE>mode))
5131 emit_insn (gen_copysign<mode>3_fcpsgn (operands[0], operands[1],
5136 operands[3] = gen_reg_rtx (<MODE>mode);
5137 operands[4] = gen_reg_rtx (<MODE>mode);
5138 operands[5] = CONST0_RTX (<MODE>mode);
5141 ;; Use an unspec rather providing an if-then-else in RTL, to prevent the
5142 ;; compiler from optimizing -0.0
5143 (define_insn "copysign<mode>3_fcpsgn"
5144 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
5145 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")
5146 (match_operand:SFDF 2 "gpc_reg_operand" "<rreg2>")]
5148 "TARGET_CMPB && !VECTOR_UNIT_VSX_P (<MODE>mode)"
5150 [(set_attr "type" "fp")])
5152 ;; For MIN, MAX, and conditional move, we use DEFINE_EXPAND's that involve a
5153 ;; fsel instruction and some auxiliary computations. Then we just have a
5154 ;; single DEFINE_INSN for fsel and the define_splits to make them if made by
5156 (define_expand "smaxsf3"
5157 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5158 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
5159 (match_operand:SF 2 "gpc_reg_operand" ""))
5162 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
5163 && TARGET_SINGLE_FLOAT && !flag_trapping_math"
5164 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
5166 (define_expand "sminsf3"
5167 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5168 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
5169 (match_operand:SF 2 "gpc_reg_operand" ""))
5172 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
5173 && TARGET_SINGLE_FLOAT && !flag_trapping_math"
5174 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
5177 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5178 (match_operator:SF 3 "min_max_operator"
5179 [(match_operand:SF 1 "gpc_reg_operand" "")
5180 (match_operand:SF 2 "gpc_reg_operand" "")]))]
5181 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
5182 && TARGET_SINGLE_FLOAT && !flag_trapping_math"
5185 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
5186 operands[1], operands[2]);
5190 (define_expand "mov<mode>cc"
5191 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
5192 (if_then_else:GPR (match_operand 1 "comparison_operator" "")
5193 (match_operand:GPR 2 "gpc_reg_operand" "")
5194 (match_operand:GPR 3 "gpc_reg_operand" "")))]
5198 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5204 ;; We use the BASE_REGS for the isel input operands because, if rA is
5205 ;; 0, the value of 0 is placed in rD upon truth. Similarly for rB
5206 ;; because we may switch the operands and rB may end up being rA.
5208 ;; We need 2 patterns: an unsigned and a signed pattern. We could
5209 ;; leave out the mode in operand 4 and use one pattern, but reload can
5210 ;; change the mode underneath our feet and then gets confused trying
5211 ;; to reload the value.
5212 (define_insn "isel_signed_<mode>"
5213 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
5215 (match_operator 1 "scc_comparison_operator"
5216 [(match_operand:CC 4 "cc_reg_operand" "y,y")
5218 (match_operand:GPR 2 "reg_or_cint_operand" "O,b")
5219 (match_operand:GPR 3 "gpc_reg_operand" "r,r")))]
5222 { return output_isel (operands); }"
5223 [(set_attr "type" "isel")
5224 (set_attr "length" "4")])
5226 (define_insn "isel_unsigned_<mode>"
5227 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
5229 (match_operator 1 "scc_comparison_operator"
5230 [(match_operand:CCUNS 4 "cc_reg_operand" "y,y")
5232 (match_operand:GPR 2 "reg_or_cint_operand" "O,b")
5233 (match_operand:GPR 3 "gpc_reg_operand" "r,r")))]
5236 { return output_isel (operands); }"
5237 [(set_attr "type" "isel")
5238 (set_attr "length" "4")])
5240 ;; These patterns can be useful for combine; they let combine know that
5241 ;; isel can handle reversed comparisons so long as the operands are
5244 (define_insn "*isel_reversed_signed_<mode>"
5245 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
5247 (match_operator 1 "scc_rev_comparison_operator"
5248 [(match_operand:CC 4 "cc_reg_operand" "y")
5250 (match_operand:GPR 2 "gpc_reg_operand" "b")
5251 (match_operand:GPR 3 "gpc_reg_operand" "b")))]
5254 { return output_isel (operands); }"
5255 [(set_attr "type" "isel")
5256 (set_attr "length" "4")])
5258 (define_insn "*isel_reversed_unsigned_<mode>"
5259 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
5261 (match_operator 1 "scc_rev_comparison_operator"
5262 [(match_operand:CCUNS 4 "cc_reg_operand" "y")
5264 (match_operand:GPR 2 "gpc_reg_operand" "b")
5265 (match_operand:GPR 3 "gpc_reg_operand" "b")))]
5268 { return output_isel (operands); }"
5269 [(set_attr "type" "isel")
5270 (set_attr "length" "4")])
5272 (define_expand "movsfcc"
5273 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5274 (if_then_else:SF (match_operand 1 "comparison_operator" "")
5275 (match_operand:SF 2 "gpc_reg_operand" "")
5276 (match_operand:SF 3 "gpc_reg_operand" "")))]
5277 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5280 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5286 (define_insn "*fselsfsf4"
5287 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5288 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
5289 (match_operand:SF 4 "zero_fp_constant" "F"))
5290 (match_operand:SF 2 "gpc_reg_operand" "f")
5291 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5292 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5294 [(set_attr "type" "fp")])
5296 (define_insn "*fseldfsf4"
5297 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5298 (if_then_else:SF (ge (match_operand:DF 1 "gpc_reg_operand" "d")
5299 (match_operand:DF 4 "zero_fp_constant" "F"))
5300 (match_operand:SF 2 "gpc_reg_operand" "f")
5301 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5302 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_SINGLE_FLOAT"
5304 [(set_attr "type" "fp")])
5306 (define_expand "negdf2"
5307 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5308 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
5309 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5312 (define_insn "*negdf2_fpr"
5313 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
5314 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "d")))]
5315 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5316 && !VECTOR_UNIT_VSX_P (DFmode)"
5318 [(set_attr "type" "fp")])
5320 (define_expand "absdf2"
5321 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5322 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
5323 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5326 (define_insn "*absdf2_fpr"
5327 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
5328 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "d")))]
5329 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5330 && !VECTOR_UNIT_VSX_P (DFmode)"
5332 [(set_attr "type" "fp")])
5334 (define_insn "*nabsdf2_fpr"
5335 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
5336 (neg:DF (abs:DF (match_operand:DF 1 "gpc_reg_operand" "d"))))]
5337 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5338 && !VECTOR_UNIT_VSX_P (DFmode)"
5340 [(set_attr "type" "fp")])
5342 (define_expand "adddf3"
5343 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5344 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "")
5345 (match_operand:DF 2 "gpc_reg_operand" "")))]
5346 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5349 (define_insn "*adddf3_fpr"
5350 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
5351 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
5352 (match_operand:DF 2 "gpc_reg_operand" "d")))]
5353 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5354 && !VECTOR_UNIT_VSX_P (DFmode)"
5356 [(set_attr "type" "fp")
5357 (set_attr "fp_type" "fp_addsub_d")])
5359 (define_expand "subdf3"
5360 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5361 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "")
5362 (match_operand:DF 2 "gpc_reg_operand" "")))]
5363 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5366 (define_insn "*subdf3_fpr"
5367 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
5368 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "d")
5369 (match_operand:DF 2 "gpc_reg_operand" "d")))]
5370 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5371 && !VECTOR_UNIT_VSX_P (DFmode)"
5373 [(set_attr "type" "fp")
5374 (set_attr "fp_type" "fp_addsub_d")])
5376 (define_expand "muldf3"
5377 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5378 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "")
5379 (match_operand:DF 2 "gpc_reg_operand" "")))]
5380 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5383 (define_insn "*muldf3_fpr"
5384 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
5385 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
5386 (match_operand:DF 2 "gpc_reg_operand" "d")))]
5387 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5388 && !VECTOR_UNIT_VSX_P (DFmode)"
5390 [(set_attr "type" "dmul")
5391 (set_attr "fp_type" "fp_mul_d")])
5393 (define_expand "divdf3"
5394 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5395 (div:DF (match_operand:DF 1 "gpc_reg_operand" "")
5396 (match_operand:DF 2 "gpc_reg_operand" "")))]
5398 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)
5399 && !TARGET_SIMPLE_FPU"
5402 (define_insn "*divdf3_fpr"
5403 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
5404 (div:DF (match_operand:DF 1 "gpc_reg_operand" "d")
5405 (match_operand:DF 2 "gpc_reg_operand" "d")))]
5406 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && !TARGET_SIMPLE_FPU
5407 && !VECTOR_UNIT_VSX_P (DFmode)"
5409 [(set_attr "type" "ddiv")])
5411 (define_insn "*fred_fpr"
5412 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5413 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))]
5414 "TARGET_FRE && !VECTOR_UNIT_VSX_P (DFmode)"
5416 [(set_attr "type" "fp")])
5418 (define_insn "*rsqrtdf_internal1"
5419 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
5420 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "d")]
5422 "TARGET_FRSQRTE && !VECTOR_UNIT_VSX_P (DFmode)"
5424 [(set_attr "type" "fp")])
5426 ; builtin fma support
5427 (define_insn "*fmadf4_fpr"
5428 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5429 (fma:DF (match_operand:DF 1 "gpc_reg_operand" "f")
5430 (match_operand:DF 2 "gpc_reg_operand" "f")
5431 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5432 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5433 && VECTOR_UNIT_NONE_P (DFmode)"
5435 [(set_attr "type" "fp")
5436 (set_attr "fp_type" "fp_maddsub_d")])
5438 (define_insn "*fmsdf4_fpr"
5439 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5440 (fma:DF (match_operand:DF 1 "gpc_reg_operand" "f")
5441 (match_operand:DF 2 "gpc_reg_operand" "f")
5442 (neg:DF (match_operand:DF 3 "gpc_reg_operand" "f"))))]
5443 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5444 && VECTOR_UNIT_NONE_P (DFmode)"
5446 [(set_attr "type" "fp")
5447 (set_attr "fp_type" "fp_maddsub_d")])
5449 (define_insn "*nfmadf4_fpr"
5450 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5451 (neg:DF (fma:DF (match_operand:DF 1 "gpc_reg_operand" "f")
5452 (match_operand:DF 2 "gpc_reg_operand" "f")
5453 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
5454 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5455 && VECTOR_UNIT_NONE_P (DFmode)"
5456 "fnmadd %0,%1,%2,%3"
5457 [(set_attr "type" "fp")
5458 (set_attr "fp_type" "fp_maddsub_d")])
5460 (define_insn "*nfmsdf4_fpr"
5461 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5462 (neg:DF (fma:DF (match_operand:DF 1 "gpc_reg_operand" "f")
5463 (match_operand:DF 2 "gpc_reg_operand" "f")
5464 (neg:DF (match_operand:DF 3 "gpc_reg_operand" "f")))))]
5465 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5466 && VECTOR_UNIT_NONE_P (DFmode)"
5467 "fnmsub %0,%1,%2,%3"
5468 [(set_attr "type" "fp")
5469 (set_attr "fp_type" "fp_maddsub_d")])
5471 (define_expand "sqrtdf2"
5472 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5473 (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
5474 "TARGET_PPC_GPOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5477 (define_insn "*sqrtdf2_fpr"
5478 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
5479 (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "d")))]
5480 "TARGET_PPC_GPOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5481 && !VECTOR_UNIT_VSX_P (DFmode)"
5483 [(set_attr "type" "dsqrt")])
5485 ;; The conditional move instructions allow us to perform max and min
5486 ;; operations even when
5488 (define_expand "smaxdf3"
5489 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5490 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
5491 (match_operand:DF 2 "gpc_reg_operand" ""))
5494 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5495 && !flag_trapping_math"
5496 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
5498 (define_expand "smindf3"
5499 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5500 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
5501 (match_operand:DF 2 "gpc_reg_operand" ""))
5504 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5505 && !flag_trapping_math"
5506 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
5509 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5510 (match_operator:DF 3 "min_max_operator"
5511 [(match_operand:DF 1 "gpc_reg_operand" "")
5512 (match_operand:DF 2 "gpc_reg_operand" "")]))]
5513 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5514 && !flag_trapping_math"
5517 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
5518 operands[1], operands[2]);
5522 (define_expand "movdfcc"
5523 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5524 (if_then_else:DF (match_operand 1 "comparison_operator" "")
5525 (match_operand:DF 2 "gpc_reg_operand" "")
5526 (match_operand:DF 3 "gpc_reg_operand" "")))]
5527 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5530 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5536 (define_insn "*fseldfdf4"
5537 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
5538 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "d")
5539 (match_operand:DF 4 "zero_fp_constant" "F"))
5540 (match_operand:DF 2 "gpc_reg_operand" "d")
5541 (match_operand:DF 3 "gpc_reg_operand" "d")))]
5542 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5544 [(set_attr "type" "fp")])
5546 (define_insn "*fselsfdf4"
5547 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
5548 (if_then_else:DF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
5549 (match_operand:SF 4 "zero_fp_constant" "F"))
5550 (match_operand:DF 2 "gpc_reg_operand" "d")
5551 (match_operand:DF 3 "gpc_reg_operand" "d")))]
5552 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_SINGLE_FLOAT"
5554 [(set_attr "type" "fp")])
5556 ;; Conversions to and from floating-point.
5558 ; We don't define lfiwax/lfiwzx with the normal definition, because we
5559 ; don't want to support putting SImode in FPR registers.
5560 (define_insn "lfiwax"
5561 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
5562 (unspec:DI [(match_operand:SI 1 "indexed_or_indirect_operand" "Z")]
5564 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWAX"
5566 [(set_attr "type" "fpload")])
5568 ; This split must be run before register allocation because it allocates the
5569 ; memory slot that is needed to move values to/from the FPR. We don't allocate
5570 ; it earlier to allow for the combiner to merge insns together where it might
5571 ; not be needed and also in case the insns are deleted as dead code.
5573 (define_insn_and_split "floatsi<mode>2_lfiwax"
5574 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d")
5575 (float:SFDF (match_operand:SI 1 "nonimmediate_operand" "r")))
5576 (clobber (match_scratch:DI 2 "=d"))]
5577 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWAX
5578 && <SI_CONVERT_FP> && can_create_pseudo_p ()"
5584 rtx dest = operands[0];
5585 rtx src = operands[1];
5588 if (!MEM_P (src) && TARGET_MFPGPR && TARGET_POWERPC64)
5589 tmp = convert_to_mode (DImode, src, false);
5593 if (GET_CODE (tmp) == SCRATCH)
5594 tmp = gen_reg_rtx (DImode);
5597 src = rs6000_address_for_fpconvert (src);
5598 emit_insn (gen_lfiwax (tmp, src));
5602 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
5603 emit_move_insn (stack, src);
5604 emit_insn (gen_lfiwax (tmp, stack));
5607 emit_insn (gen_floatdi<mode>2 (dest, tmp));
5610 [(set_attr "length" "12")
5611 (set_attr "type" "fpload")])
5613 (define_insn_and_split "floatsi<mode>2_lfiwax_mem"
5614 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d,<rreg2>")
5617 (match_operand:SI 1 "memory_operand" "Z,Z"))))
5618 (clobber (match_scratch:DI 2 "=0,d"))]
5619 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWAX
5626 operands[1] = rs6000_address_for_fpconvert (operands[1]);
5627 if (GET_CODE (operands[2]) == SCRATCH)
5628 operands[2] = gen_reg_rtx (DImode);
5629 emit_insn (gen_lfiwax (operands[2], operands[1]));
5630 emit_insn (gen_floatdi<mode>2 (operands[0], operands[2]));
5633 [(set_attr "length" "8")
5634 (set_attr "type" "fpload")])
5636 (define_insn "lfiwzx"
5637 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
5638 (unspec:DI [(match_operand:SI 1 "indexed_or_indirect_operand" "Z")]
5640 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWZX"
5642 [(set_attr "type" "fpload")])
5644 (define_insn_and_split "floatunssi<mode>2_lfiwzx"
5645 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d")
5646 (unsigned_float:SFDF (match_operand:SI 1 "nonimmediate_operand" "r")))
5647 (clobber (match_scratch:DI 2 "=d"))]
5648 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWZX
5655 rtx dest = operands[0];
5656 rtx src = operands[1];
5659 if (!MEM_P (src) && TARGET_MFPGPR && TARGET_POWERPC64)
5660 tmp = convert_to_mode (DImode, src, true);
5664 if (GET_CODE (tmp) == SCRATCH)
5665 tmp = gen_reg_rtx (DImode);
5668 src = rs6000_address_for_fpconvert (src);
5669 emit_insn (gen_lfiwzx (tmp, src));
5673 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
5674 emit_move_insn (stack, src);
5675 emit_insn (gen_lfiwzx (tmp, stack));
5678 emit_insn (gen_floatdi<mode>2 (dest, tmp));
5681 [(set_attr "length" "12")
5682 (set_attr "type" "fpload")])
5684 (define_insn_and_split "floatunssi<mode>2_lfiwzx_mem"
5685 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d,<rreg2>")
5686 (unsigned_float:SFDF
5688 (match_operand:SI 1 "memory_operand" "Z,Z"))))
5689 (clobber (match_scratch:DI 2 "=0,d"))]
5690 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWZX
5697 operands[1] = rs6000_address_for_fpconvert (operands[1]);
5698 if (GET_CODE (operands[2]) == SCRATCH)
5699 operands[2] = gen_reg_rtx (DImode);
5700 emit_insn (gen_lfiwzx (operands[2], operands[1]));
5701 emit_insn (gen_floatdi<mode>2 (operands[0], operands[2]));
5704 [(set_attr "length" "8")
5705 (set_attr "type" "fpload")])
5707 ; For each of these conversions, there is a define_expand, a define_insn
5708 ; with a '#' template, and a define_split (with C code). The idea is
5709 ; to allow constant folding with the template of the define_insn,
5710 ; then to have the insns split later (between sched1 and final).
5712 (define_expand "floatsidf2"
5713 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5714 (float:DF (match_operand:SI 1 "nonimmediate_operand" "")))
5717 (clobber (match_dup 4))
5718 (clobber (match_dup 5))
5719 (clobber (match_dup 6))])]
5721 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5724 if (TARGET_E500_DOUBLE)
5726 if (!REG_P (operands[1]))
5727 operands[1] = force_reg (SImode, operands[1]);
5728 emit_insn (gen_spe_floatsidf2 (operands[0], operands[1]));
5731 else if (TARGET_LFIWAX && TARGET_FCFID)
5733 emit_insn (gen_floatsidf2_lfiwax (operands[0], operands[1]));
5736 else if (TARGET_FCFID)
5738 rtx dreg = operands[1];
5740 dreg = force_reg (SImode, dreg);
5741 dreg = convert_to_mode (DImode, dreg, false);
5742 emit_insn (gen_floatdidf2 (operands[0], dreg));
5746 if (!REG_P (operands[1]))
5747 operands[1] = force_reg (SImode, operands[1]);
5748 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5749 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503601774854144\", DFmode));
5750 operands[4] = rs6000_allocate_stack_temp (DFmode, true, false);
5751 operands[5] = gen_reg_rtx (DFmode);
5752 operands[6] = gen_reg_rtx (SImode);
5755 (define_insn_and_split "*floatsidf2_internal"
5756 [(set (match_operand:DF 0 "gpc_reg_operand" "=&d")
5757 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5758 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5759 (use (match_operand:DF 3 "gpc_reg_operand" "d"))
5760 (clobber (match_operand:DF 4 "offsettable_mem_operand" "=o"))
5761 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&d"))
5762 (clobber (match_operand:SI 6 "gpc_reg_operand" "=&r"))]
5763 "! TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5769 rtx lowword, highword;
5770 gcc_assert (MEM_P (operands[4]));
5771 highword = adjust_address (operands[4], SImode, 0);
5772 lowword = adjust_address (operands[4], SImode, 4);
5773 if (! WORDS_BIG_ENDIAN)
5776 tmp = highword; highword = lowword; lowword = tmp;
5779 emit_insn (gen_xorsi3 (operands[6], operands[1],
5780 GEN_INT (~ (HOST_WIDE_INT) 0x7fffffff)));
5781 emit_move_insn (lowword, operands[6]);
5782 emit_move_insn (highword, operands[2]);
5783 emit_move_insn (operands[5], operands[4]);
5784 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5787 [(set_attr "length" "24")
5788 (set_attr "type" "fp")])
5790 ;; If we don't have a direct conversion to single precision, don't enable this
5791 ;; conversion for 32-bit without fast math, because we don't have the insn to
5792 ;; generate the fixup swizzle to avoid double rounding problems.
5793 (define_expand "floatunssisf2"
5794 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5795 (unsigned_float:SF (match_operand:SI 1 "nonimmediate_operand" "")))]
5796 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT
5799 && ((TARGET_FCFIDUS && TARGET_LFIWZX)
5800 || (TARGET_DOUBLE_FLOAT && TARGET_FCFID
5801 && (TARGET_POWERPC64 || flag_unsafe_math_optimizations)))))"
5806 if (!REG_P (operands[1]))
5807 operands[1] = force_reg (SImode, operands[1]);
5809 else if (TARGET_LFIWZX && TARGET_FCFIDUS)
5811 emit_insn (gen_floatunssisf2_lfiwzx (operands[0], operands[1]));
5816 rtx dreg = operands[1];
5818 dreg = force_reg (SImode, dreg);
5819 dreg = convert_to_mode (DImode, dreg, true);
5820 emit_insn (gen_floatdisf2 (operands[0], dreg));
5825 (define_expand "floatunssidf2"
5826 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5827 (unsigned_float:DF (match_operand:SI 1 "nonimmediate_operand" "")))
5830 (clobber (match_dup 4))
5831 (clobber (match_dup 5))])]
5833 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5836 if (TARGET_E500_DOUBLE)
5838 if (!REG_P (operands[1]))
5839 operands[1] = force_reg (SImode, operands[1]);
5840 emit_insn (gen_spe_floatunssidf2 (operands[0], operands[1]));
5843 else if (TARGET_LFIWZX && TARGET_FCFID)
5845 emit_insn (gen_floatunssidf2_lfiwzx (operands[0], operands[1]));
5848 else if (TARGET_FCFID)
5850 rtx dreg = operands[1];
5852 dreg = force_reg (SImode, dreg);
5853 dreg = convert_to_mode (DImode, dreg, true);
5854 emit_insn (gen_floatdidf2 (operands[0], dreg));
5858 if (!REG_P (operands[1]))
5859 operands[1] = force_reg (SImode, operands[1]);
5860 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5861 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503599627370496\", DFmode));
5862 operands[4] = rs6000_allocate_stack_temp (DFmode, true, false);
5863 operands[5] = gen_reg_rtx (DFmode);
5866 (define_insn_and_split "*floatunssidf2_internal"
5867 [(set (match_operand:DF 0 "gpc_reg_operand" "=&d")
5868 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5869 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5870 (use (match_operand:DF 3 "gpc_reg_operand" "d"))
5871 (clobber (match_operand:DF 4 "offsettable_mem_operand" "=o"))
5872 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&d"))]
5873 "! TARGET_FCFIDU && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5874 && !(TARGET_FCFID && TARGET_POWERPC64)"
5880 rtx lowword, highword;
5881 gcc_assert (MEM_P (operands[4]));
5882 highword = adjust_address (operands[4], SImode, 0);
5883 lowword = adjust_address (operands[4], SImode, 4);
5884 if (! WORDS_BIG_ENDIAN)
5887 tmp = highword; highword = lowword; lowword = tmp;
5890 emit_move_insn (lowword, operands[1]);
5891 emit_move_insn (highword, operands[2]);
5892 emit_move_insn (operands[5], operands[4]);
5893 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5896 [(set_attr "length" "20")
5897 (set_attr "type" "fp")])
5899 (define_expand "fix_trunc<mode>si2"
5900 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5901 (fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "")))]
5902 "TARGET_HARD_FLOAT && ((TARGET_FPRS && <TARGET_FLOAT>) || <E500_CONVERT>)"
5905 if (!<E500_CONVERT>)
5910 emit_insn (gen_fix_trunc<mode>si2_stfiwx (operands[0], operands[1]));
5913 tmp = gen_reg_rtx (DImode);
5914 stack = rs6000_allocate_stack_temp (DImode, true, false);
5915 emit_insn (gen_fix_trunc<mode>si2_internal (operands[0], operands[1],
5922 ; Like the convert to float patterns, this insn must be split before
5923 ; register allocation so that it can allocate the memory slot if it
5925 (define_insn_and_split "fix_trunc<mode>si2_stfiwx"
5926 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
5927 (fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d")))
5928 (clobber (match_scratch:DI 2 "=d"))]
5929 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5930 && (<MODE>mode != SFmode || TARGET_SINGLE_FLOAT)
5931 && TARGET_STFIWX && can_create_pseudo_p ()"
5936 rtx dest = operands[0];
5937 rtx src = operands[1];
5938 rtx tmp = operands[2];
5940 if (GET_CODE (tmp) == SCRATCH)
5941 tmp = gen_reg_rtx (DImode);
5943 emit_insn (gen_fctiwz_<mode> (tmp, src));
5946 dest = rs6000_address_for_fpconvert (dest);
5947 emit_insn (gen_stfiwx (dest, tmp));
5950 else if (TARGET_MFPGPR && TARGET_POWERPC64)
5952 dest = gen_lowpart (DImode, dest);
5953 emit_move_insn (dest, tmp);
5958 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
5959 emit_insn (gen_stfiwx (stack, tmp));
5960 emit_move_insn (dest, stack);
5964 [(set_attr "length" "12")
5965 (set_attr "type" "fp")])
5967 (define_insn_and_split "fix_trunc<mode>si2_internal"
5968 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,?r")
5969 (fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d,<rreg>")))
5970 (clobber (match_operand:DI 2 "gpc_reg_operand" "=1,d"))
5971 (clobber (match_operand:DI 3 "offsettable_mem_operand" "=o,o"))]
5972 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5979 gcc_assert (MEM_P (operands[3]));
5980 lowword = adjust_address (operands[3], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
5982 emit_insn (gen_fctiwz_<mode> (operands[2], operands[1]));
5983 emit_move_insn (operands[3], operands[2]);
5984 emit_move_insn (operands[0], lowword);
5987 [(set_attr "length" "16")
5988 (set_attr "type" "fp")])
5990 (define_expand "fix_trunc<mode>di2"
5991 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5992 (fix:DI (match_operand:SFDF 1 "gpc_reg_operand" "")))]
5993 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
5997 (define_insn "*fix_trunc<mode>di2_fctidz"
5998 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
5999 (fix:DI (match_operand:SFDF 1 "gpc_reg_operand" "d")))]
6000 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
6001 && TARGET_FCFID && !VECTOR_UNIT_VSX_P (<MODE>mode)"
6003 [(set_attr "type" "fp")])
6005 (define_expand "fixuns_trunc<mode>si2"
6006 [(set (match_operand:SI 0 "gpc_reg_operand" "")
6007 (unsigned_fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "")))]
6009 && ((TARGET_FPRS && <TARGET_FLOAT> && TARGET_FCTIWUZ && TARGET_STFIWX)
6013 if (!<E500_CONVERT>)
6015 emit_insn (gen_fixuns_trunc<mode>si2_stfiwx (operands[0], operands[1]));
6020 (define_insn_and_split "fixuns_trunc<mode>si2_stfiwx"
6021 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
6022 (unsigned_fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d")))
6023 (clobber (match_scratch:DI 2 "=d"))]
6024 "TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT> && TARGET_FCTIWUZ
6025 && TARGET_STFIWX && can_create_pseudo_p ()"
6030 rtx dest = operands[0];
6031 rtx src = operands[1];
6032 rtx tmp = operands[2];
6034 if (GET_CODE (tmp) == SCRATCH)
6035 tmp = gen_reg_rtx (DImode);
6037 emit_insn (gen_fctiwuz_<mode> (tmp, src));
6040 dest = rs6000_address_for_fpconvert (dest);
6041 emit_insn (gen_stfiwx (dest, tmp));
6044 else if (TARGET_MFPGPR && TARGET_POWERPC64)
6046 dest = gen_lowpart (DImode, dest);
6047 emit_move_insn (dest, tmp);
6052 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
6053 emit_insn (gen_stfiwx (stack, tmp));
6054 emit_move_insn (dest, stack);
6058 [(set_attr "length" "12")
6059 (set_attr "type" "fp")])
6061 (define_expand "fixuns_trunc<mode>di2"
6062 [(set (match_operand:DI 0 "register_operand" "")
6063 (unsigned_fix:DI (match_operand:SFDF 1 "register_operand" "")))]
6064 "TARGET_HARD_FLOAT && (TARGET_FCTIDUZ || VECTOR_UNIT_VSX_P (<MODE>mode))"
6067 (define_insn "*fixuns_trunc<mode>di2_fctiduz"
6068 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6069 (unsigned_fix:DI (match_operand:SFDF 1 "gpc_reg_operand" "d")))]
6070 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
6071 && TARGET_FCTIDUZ && !VECTOR_UNIT_VSX_P (<MODE>mode)"
6073 [(set_attr "type" "fp")])
6075 ; Here, we use (set (reg) (unspec:DI [(fix:SI ...)] UNSPEC_FCTIWZ))
6076 ; rather than (set (subreg:SI (reg)) (fix:SI ...))
6077 ; because the first makes it clear that operand 0 is not live
6078 ; before the instruction.
6079 (define_insn "fctiwz_<mode>"
6080 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6081 (unspec:DI [(fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d"))]
6083 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6085 [(set_attr "type" "fp")])
6087 (define_insn "fctiwuz_<mode>"
6088 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6089 (unspec:DI [(unsigned_fix:SI
6090 (match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>"))]
6092 "TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT> && TARGET_FCTIWUZ"
6094 [(set_attr "type" "fp")])
6096 ;; Only optimize (float (fix x)) -> frz if we are in fast-math mode, since
6097 ;; since the friz instruction does not truncate the value if the floating
6098 ;; point value is < LONG_MIN or > LONG_MAX.
6099 (define_insn "*friz"
6100 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6101 (float:DF (fix:DI (match_operand:DF 1 "gpc_reg_operand" "d"))))]
6102 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_FPRND
6103 && !VECTOR_UNIT_VSX_P (DFmode) && flag_unsafe_math_optimizations
6104 && !flag_trapping_math && TARGET_FRIZ"
6106 [(set_attr "type" "fp")])
6108 ;; Since FCTIWZ doesn't sign extend the upper bits, we have to do a store and a
6109 ;; load to properly sign extend the value, but at least doing a store, load
6110 ;; into a GPR to sign extend, a store from the GPR and a load back into the FPR
6111 ;; if we have 32-bit memory ops
6112 (define_insn_and_split "*round32<mode>2_fprs"
6113 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d")
6115 (fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d"))))
6116 (clobber (match_scratch:DI 2 "=d"))
6117 (clobber (match_scratch:DI 3 "=d"))]
6118 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6119 && <SI_CONVERT_FP> && TARGET_LFIWAX && TARGET_STFIWX && TARGET_FCFID
6120 && can_create_pseudo_p ()"
6125 rtx dest = operands[0];
6126 rtx src = operands[1];
6127 rtx tmp1 = operands[2];
6128 rtx tmp2 = operands[3];
6129 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
6131 if (GET_CODE (tmp1) == SCRATCH)
6132 tmp1 = gen_reg_rtx (DImode);
6133 if (GET_CODE (tmp2) == SCRATCH)
6134 tmp2 = gen_reg_rtx (DImode);
6136 emit_insn (gen_fctiwz_<mode> (tmp1, src));
6137 emit_insn (gen_stfiwx (stack, tmp1));
6138 emit_insn (gen_lfiwax (tmp2, stack));
6139 emit_insn (gen_floatdi<mode>2 (dest, tmp2));
6142 [(set_attr "type" "fpload")
6143 (set_attr "length" "16")])
6145 (define_insn_and_split "*roundu32<mode>2_fprs"
6146 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d")
6147 (unsigned_float:SFDF
6148 (unsigned_fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d"))))
6149 (clobber (match_scratch:DI 2 "=d"))
6150 (clobber (match_scratch:DI 3 "=d"))]
6151 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6152 && TARGET_LFIWZX && TARGET_STFIWX && TARGET_FCFIDU
6153 && can_create_pseudo_p ()"
6158 rtx dest = operands[0];
6159 rtx src = operands[1];
6160 rtx tmp1 = operands[2];
6161 rtx tmp2 = operands[3];
6162 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
6164 if (GET_CODE (tmp1) == SCRATCH)
6165 tmp1 = gen_reg_rtx (DImode);
6166 if (GET_CODE (tmp2) == SCRATCH)
6167 tmp2 = gen_reg_rtx (DImode);
6169 emit_insn (gen_fctiwuz_<mode> (tmp1, src));
6170 emit_insn (gen_stfiwx (stack, tmp1));
6171 emit_insn (gen_lfiwzx (tmp2, stack));
6172 emit_insn (gen_floatdi<mode>2 (dest, tmp2));
6175 [(set_attr "type" "fpload")
6176 (set_attr "length" "16")])
6178 ;; No VSX equivalent to fctid
6179 (define_insn "lrint<mode>di2"
6180 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6181 (unspec:DI [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
6183 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
6185 [(set_attr "type" "fp")])
6187 (define_expand "btrunc<mode>2"
6188 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
6189 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "")]
6191 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
6194 (define_insn "*btrunc<mode>2_fpr"
6195 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
6196 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
6198 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>
6199 && !VECTOR_UNIT_VSX_P (<MODE>mode)"
6201 [(set_attr "type" "fp")])
6203 (define_expand "ceil<mode>2"
6204 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
6205 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "")]
6207 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
6210 (define_insn "*ceil<mode>2_fpr"
6211 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
6212 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
6214 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>
6215 && !VECTOR_UNIT_VSX_P (<MODE>mode)"
6217 [(set_attr "type" "fp")])
6219 (define_expand "floor<mode>2"
6220 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
6221 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "")]
6223 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
6226 (define_insn "*floor<mode>2_fpr"
6227 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
6228 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
6230 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>
6231 && !VECTOR_UNIT_VSX_P (<MODE>mode)"
6233 [(set_attr "type" "fp")])
6235 ;; No VSX equivalent to frin
6236 (define_insn "round<mode>2"
6237 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
6238 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
6240 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
6242 [(set_attr "type" "fp")])
6244 ; An UNSPEC is used so we don't have to support SImode in FP registers.
6245 (define_insn "stfiwx"
6246 [(set (match_operand:SI 0 "memory_operand" "=Z")
6247 (unspec:SI [(match_operand:DI 1 "gpc_reg_operand" "d")]
6251 [(set_attr "type" "fpstore")])
6253 ;; If we don't have a direct conversion to single precision, don't enable this
6254 ;; conversion for 32-bit without fast math, because we don't have the insn to
6255 ;; generate the fixup swizzle to avoid double rounding problems.
6256 (define_expand "floatsisf2"
6257 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6258 (float:SF (match_operand:SI 1 "nonimmediate_operand" "")))]
6259 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT
6262 && ((TARGET_FCFIDS && TARGET_LFIWAX)
6263 || (TARGET_DOUBLE_FLOAT && TARGET_FCFID
6264 && (TARGET_POWERPC64 || flag_unsafe_math_optimizations)))))"
6269 if (!REG_P (operands[1]))
6270 operands[1] = force_reg (SImode, operands[1]);
6272 else if (TARGET_FCFIDS && TARGET_LFIWAX)
6274 emit_insn (gen_floatsisf2_lfiwax (operands[0], operands[1]));
6277 else if (TARGET_FCFID && TARGET_LFIWAX)
6279 rtx dfreg = gen_reg_rtx (DFmode);
6280 emit_insn (gen_floatsidf2_lfiwax (dfreg, operands[1]));
6281 emit_insn (gen_truncdfsf2 (operands[0], dfreg));
6286 rtx dreg = operands[1];
6288 dreg = force_reg (SImode, dreg);
6289 dreg = convert_to_mode (DImode, dreg, false);
6290 emit_insn (gen_floatdisf2 (operands[0], dreg));
6295 (define_expand "floatdidf2"
6296 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6297 (float:DF (match_operand:DI 1 "gpc_reg_operand" "")))]
6298 "TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS"
6301 (define_insn "*floatdidf2_fpr"
6302 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6303 (float:DF (match_operand:DI 1 "gpc_reg_operand" "d")))]
6304 "TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
6305 && !VECTOR_UNIT_VSX_P (DFmode)"
6307 [(set_attr "type" "fp")])
6309 ; Allow the combiner to merge source memory operands to the conversion so that
6310 ; the optimizer/register allocator doesn't try to load the value too early in a
6311 ; GPR and then use store/load to move it to a FPR and suffer from a store-load
6312 ; hit. We will split after reload to avoid the trip through the GPRs
6314 (define_insn_and_split "*floatdidf2_mem"
6315 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6316 (float:DF (match_operand:DI 1 "memory_operand" "m")))
6317 (clobber (match_scratch:DI 2 "=d"))]
6318 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS && TARGET_FCFID"
6320 "&& reload_completed"
6321 [(set (match_dup 2) (match_dup 1))
6322 (set (match_dup 0) (float:DF (match_dup 2)))]
6324 [(set_attr "length" "8")
6325 (set_attr "type" "fpload")])
6327 (define_expand "floatunsdidf2"
6328 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6330 (match_operand:DI 1 "gpc_reg_operand" "")))]
6331 "TARGET_HARD_FLOAT && (TARGET_FCFIDU || VECTOR_UNIT_VSX_P (DFmode))"
6334 (define_insn "*floatunsdidf2_fcfidu"
6335 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6336 (unsigned_float:DF (match_operand:DI 1 "gpc_reg_operand" "d")))]
6337 "TARGET_HARD_FLOAT && TARGET_FCFIDU && !VECTOR_UNIT_VSX_P (DFmode)"
6339 [(set_attr "type" "fp")
6340 (set_attr "length" "4")])
6342 (define_insn_and_split "*floatunsdidf2_mem"
6343 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6344 (unsigned_float:DF (match_operand:DI 1 "memory_operand" "m")))
6345 (clobber (match_scratch:DI 2 "=d"))]
6346 "TARGET_HARD_FLOAT && (TARGET_FCFIDU || VECTOR_UNIT_VSX_P (DFmode))"
6348 "&& reload_completed"
6349 [(set (match_dup 2) (match_dup 1))
6350 (set (match_dup 0) (unsigned_float:DF (match_dup 2)))]
6352 [(set_attr "length" "8")
6353 (set_attr "type" "fpload")])
6355 (define_expand "floatdisf2"
6356 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6357 (float:SF (match_operand:DI 1 "gpc_reg_operand" "")))]
6358 "TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
6359 && (TARGET_FCFIDS || TARGET_POWERPC64 || flag_unsafe_math_optimizations)"
6364 rtx val = operands[1];
6365 if (!flag_unsafe_math_optimizations)
6367 rtx label = gen_label_rtx ();
6368 val = gen_reg_rtx (DImode);
6369 emit_insn (gen_floatdisf2_internal2 (val, operands[1], label));
6372 emit_insn (gen_floatdisf2_internal1 (operands[0], val));
6377 (define_insn "floatdisf2_fcfids"
6378 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6379 (float:SF (match_operand:DI 1 "gpc_reg_operand" "d")))]
6380 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
6381 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDS"
6383 [(set_attr "type" "fp")])
6385 (define_insn_and_split "*floatdisf2_mem"
6386 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6387 (float:SF (match_operand:DI 1 "memory_operand" "m")))
6388 (clobber (match_scratch:DI 2 "=f"))]
6389 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
6390 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDS"
6392 "&& reload_completed"
6396 emit_move_insn (operands[2], operands[1]);
6397 emit_insn (gen_floatdisf2_fcfids (operands[0], operands[2]));
6400 [(set_attr "length" "8")])
6402 ;; This is not IEEE compliant if rounding mode is "round to nearest".
6403 ;; If the DI->DF conversion is inexact, then it's possible to suffer
6404 ;; from double rounding.
6405 ;; Instead of creating a new cpu type for two FP operations, just use fp
6406 (define_insn_and_split "floatdisf2_internal1"
6407 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6408 (float:SF (match_operand:DI 1 "gpc_reg_operand" "d")))
6409 (clobber (match_scratch:DF 2 "=d"))]
6410 "TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
6412 "&& reload_completed"
6414 (float:DF (match_dup 1)))
6416 (float_truncate:SF (match_dup 2)))]
6418 [(set_attr "length" "8")
6419 (set_attr "type" "fp")])
6421 ;; Twiddles bits to avoid double rounding.
6422 ;; Bits that might be truncated when converting to DFmode are replaced
6423 ;; by a bit that won't be lost at that stage, but is below the SFmode
6424 ;; rounding position.
6425 (define_expand "floatdisf2_internal2"
6426 [(set (match_dup 3) (ashiftrt:DI (match_operand:DI 1 "" "")
6428 (parallel [(set (match_operand:DI 0 "" "") (and:DI (match_dup 1)
6430 (clobber (scratch:CC))])
6431 (set (match_dup 3) (plus:DI (match_dup 3)
6433 (set (match_dup 0) (plus:DI (match_dup 0)
6435 (set (match_dup 4) (compare:CCUNS (match_dup 3)
6437 (set (match_dup 0) (ior:DI (match_dup 0)
6439 (parallel [(set (match_dup 0) (and:DI (match_dup 0)
6441 (clobber (scratch:CC))])
6442 (set (pc) (if_then_else (geu (match_dup 4) (const_int 0))
6443 (label_ref (match_operand:DI 2 "" ""))
6445 (set (match_dup 0) (match_dup 1))]
6446 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
6449 operands[3] = gen_reg_rtx (DImode);
6450 operands[4] = gen_reg_rtx (CCUNSmode);
6453 (define_expand "floatunsdisf2"
6454 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6455 (unsigned_float:SF (match_operand:DI 1 "gpc_reg_operand" "")))]
6456 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
6457 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDUS"
6460 (define_insn "floatunsdisf2_fcfidus"
6461 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6462 (unsigned_float:SF (match_operand:DI 1 "gpc_reg_operand" "d")))]
6463 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
6464 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDUS"
6466 [(set_attr "type" "fp")])
6468 (define_insn_and_split "*floatunsdisf2_mem"
6469 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6470 (unsigned_float:SF (match_operand:DI 1 "memory_operand" "m")))
6471 (clobber (match_scratch:DI 2 "=f"))]
6472 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
6473 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDUS"
6475 "&& reload_completed"
6479 emit_move_insn (operands[2], operands[1]);
6480 emit_insn (gen_floatunsdisf2_fcfidus (operands[0], operands[2]));
6483 [(set_attr "length" "8")
6484 (set_attr "type" "fpload")])
6486 ;; Define the DImode operations that can be done in a small number
6487 ;; of instructions. The & constraints are to prevent the register
6488 ;; allocator from allocating registers that overlap with the inputs
6489 ;; (for example, having an input in 7,8 and an output in 6,7). We
6490 ;; also allow for the output being the same as one of the inputs.
6492 (define_insn "*adddi3_noppc64"
6493 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r")
6494 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,0,0")
6495 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I")))]
6496 "! TARGET_POWERPC64"
6499 if (WORDS_BIG_ENDIAN)
6500 return (GET_CODE (operands[2])) != CONST_INT
6501 ? \"addc %L0,%L1,%L2\;adde %0,%1,%2\"
6502 : \"addic %L0,%L1,%2\;add%G2e %0,%1\";
6504 return (GET_CODE (operands[2])) != CONST_INT
6505 ? \"addc %0,%1,%2\;adde %L0,%L1,%L2\"
6506 : \"addic %0,%1,%2\;add%G2e %L0,%L1\";
6508 [(set_attr "type" "two")
6509 (set_attr "length" "8")])
6511 (define_insn "*subdi3_noppc64"
6512 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r,r")
6513 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I,0,r,I")
6514 (match_operand:DI 2 "gpc_reg_operand" "r,r,r,0,0")))]
6515 "! TARGET_POWERPC64"
6518 if (WORDS_BIG_ENDIAN)
6519 return (GET_CODE (operands[1]) != CONST_INT)
6520 ? \"subfc %L0,%L2,%L1\;subfe %0,%2,%1\"
6521 : \"subfic %L0,%L2,%1\;subf%G1e %0,%2\";
6523 return (GET_CODE (operands[1]) != CONST_INT)
6524 ? \"subfc %0,%2,%1\;subfe %L0,%L2,%L1\"
6525 : \"subfic %0,%2,%1\;subf%G1e %L0,%L2\";
6527 [(set_attr "type" "two")
6528 (set_attr "length" "8")])
6530 (define_insn "*negdi2_noppc64"
6531 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6532 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))]
6533 "! TARGET_POWERPC64"
6536 return (WORDS_BIG_ENDIAN)
6537 ? \"subfic %L0,%L1,0\;subfze %0,%1\"
6538 : \"subfic %0,%1,0\;subfze %L0,%L1\";
6540 [(set_attr "type" "two")
6541 (set_attr "length" "8")])
6543 (define_insn "mulsidi3"
6544 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6545 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6546 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
6547 "! TARGET_POWERPC64"
6549 return (WORDS_BIG_ENDIAN)
6550 ? \"mulhw %0,%1,%2\;mullw %L0,%1,%2\"
6551 : \"mulhw %L0,%1,%2\;mullw %0,%1,%2\";
6553 [(set_attr "type" "imul")
6554 (set_attr "length" "8")])
6557 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6558 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6559 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6560 "! TARGET_POWERPC64 && reload_completed"
6563 (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
6564 (sign_extend:DI (match_dup 2)))
6567 (mult:SI (match_dup 1)
6571 int endian = (WORDS_BIG_ENDIAN == 0);
6572 operands[3] = operand_subword (operands[0], endian, 0, DImode);
6573 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
6576 (define_insn "umulsidi3"
6577 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6578 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6579 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
6580 "! TARGET_POWERPC64"
6583 return (WORDS_BIG_ENDIAN)
6584 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
6585 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
6587 [(set_attr "type" "imul")
6588 (set_attr "length" "8")])
6591 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6592 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6593 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6594 "! TARGET_POWERPC64 && reload_completed"
6597 (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
6598 (zero_extend:DI (match_dup 2)))
6601 (mult:SI (match_dup 1)
6605 int endian = (WORDS_BIG_ENDIAN == 0);
6606 operands[3] = operand_subword (operands[0], endian, 0, DImode);
6607 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
6610 (define_insn "smulsi3_highpart"
6611 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6613 (lshiftrt:DI (mult:DI (sign_extend:DI
6614 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6616 (match_operand:SI 2 "gpc_reg_operand" "r")))
6620 [(set_attr "type" "imul")])
6622 (define_insn "umulsi3_highpart"
6623 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6625 (lshiftrt:DI (mult:DI (zero_extend:DI
6626 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6628 (match_operand:SI 2 "gpc_reg_operand" "r")))
6632 [(set_attr "type" "imul")])
6634 ;; Shift by a variable amount is too complex to be worth open-coding. We
6635 ;; just handle shifts by constants.
6636 (define_insn "ashrdi3_no_power"
6637 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
6638 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6639 (match_operand:SI 2 "const_int_operand" "M,i")))]
6643 switch (which_alternative)
6648 if (WORDS_BIG_ENDIAN)
6649 return \"srawi %0,%1,31\;srawi %L0,%1,%h2\";
6651 return \"srawi %L0,%L1,31\;srawi %0,%L1,%h2\";
6653 if (WORDS_BIG_ENDIAN)
6654 return \"srwi %L0,%L1,%h2\;insrwi %L0,%1,%h2,0\;srawi %0,%1,%h2\";
6656 return \"srwi %0,%1,%h2\;insrwi %0,%L1,%h2,0\;srawi %L0,%L1,%h2\";
6659 [(set_attr "type" "two,three")
6660 (set_attr "length" "8,12")])
6662 (define_insn "*ashrdisi3_noppc64be"
6663 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6664 (subreg:SI (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6665 (const_int 32)) 4))]
6666 "TARGET_32BIT && !TARGET_POWERPC64 && WORDS_BIG_ENDIAN"
6669 if (REGNO (operands[0]) == REGNO (operands[1]))
6672 return \"mr %0,%1\";
6674 [(set_attr "length" "4")])
6677 ;; PowerPC64 DImode operations.
6679 (define_insn "muldi3"
6680 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6681 (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6682 (match_operand:DI 2 "reg_or_short_operand" "r,I")))]
6688 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
6689 (const_string "imul3")
6690 (match_operand:SI 2 "short_cint_operand" "")
6691 (const_string "imul2")]
6692 (const_string "lmul")))])
6694 (define_insn "*muldi3_internal1"
6695 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6696 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6697 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6699 (clobber (match_scratch:DI 3 "=r,r"))]
6704 [(set_attr "type" "lmul_compare")
6705 (set_attr "length" "4,8")])
6708 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6709 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
6710 (match_operand:DI 2 "gpc_reg_operand" ""))
6712 (clobber (match_scratch:DI 3 ""))]
6713 "TARGET_POWERPC64 && reload_completed"
6715 (mult:DI (match_dup 1) (match_dup 2)))
6717 (compare:CC (match_dup 3)
6721 (define_insn "*muldi3_internal2"
6722 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6723 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6724 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6726 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6727 (mult:DI (match_dup 1) (match_dup 2)))]
6732 [(set_attr "type" "lmul_compare")
6733 (set_attr "length" "4,8")])
6736 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
6737 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
6738 (match_operand:DI 2 "gpc_reg_operand" ""))
6740 (set (match_operand:DI 0 "gpc_reg_operand" "")
6741 (mult:DI (match_dup 1) (match_dup 2)))]
6742 "TARGET_POWERPC64 && reload_completed"
6744 (mult:DI (match_dup 1) (match_dup 2)))
6746 (compare:CC (match_dup 0)
6750 (define_insn "smuldi3_highpart"
6751 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6753 (lshiftrt:TI (mult:TI (sign_extend:TI
6754 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6756 (match_operand:DI 2 "gpc_reg_operand" "r")))
6760 [(set_attr "type" "lmul")])
6762 (define_insn "umuldi3_highpart"
6763 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6765 (lshiftrt:TI (mult:TI (zero_extend:TI
6766 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6768 (match_operand:DI 2 "gpc_reg_operand" "r")))
6772 [(set_attr "type" "lmul")])
6774 (define_expand "mulditi3"
6775 [(set (match_operand:TI 0 "gpc_reg_operand")
6776 (mult:TI (sign_extend:TI (match_operand:DI 1 "gpc_reg_operand"))
6777 (sign_extend:TI (match_operand:DI 2 "gpc_reg_operand"))))]
6780 rtx l = gen_reg_rtx (DImode), h = gen_reg_rtx (DImode);
6781 emit_insn (gen_muldi3 (l, operands[1], operands[2]));
6782 emit_insn (gen_smuldi3_highpart (h, operands[1], operands[2]));
6783 emit_move_insn (gen_lowpart (DImode, operands[0]), l);
6784 emit_move_insn (gen_highpart (DImode, operands[0]), h);
6788 (define_expand "umulditi3"
6789 [(set (match_operand:TI 0 "gpc_reg_operand")
6790 (mult:TI (zero_extend:TI (match_operand:DI 1 "gpc_reg_operand"))
6791 (zero_extend:TI (match_operand:DI 2 "gpc_reg_operand"))))]
6794 rtx l = gen_reg_rtx (DImode), h = gen_reg_rtx (DImode);
6795 emit_insn (gen_muldi3 (l, operands[1], operands[2]));
6796 emit_insn (gen_umuldi3_highpart (h, operands[1], operands[2]));
6797 emit_move_insn (gen_lowpart (DImode, operands[0]), l);
6798 emit_move_insn (gen_highpart (DImode, operands[0]), h);
6802 (define_insn "rotldi3"
6803 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6804 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6805 (match_operand:DI 2 "reg_or_cint_operand" "r,i")))]
6810 [(set_attr "type" "var_shift_rotate,integer")])
6812 (define_insn "*rotldi3_internal2"
6813 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
6814 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6815 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
6817 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
6824 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6825 (set_attr "length" "4,4,8,8")])
6828 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
6829 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6830 (match_operand:DI 2 "reg_or_cint_operand" ""))
6832 (clobber (match_scratch:DI 3 ""))]
6833 "TARGET_POWERPC64 && reload_completed"
6835 (rotate:DI (match_dup 1) (match_dup 2)))
6837 (compare:CC (match_dup 3)
6841 (define_insn "*rotldi3_internal3"
6842 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
6843 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6844 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
6846 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
6847 (rotate:DI (match_dup 1) (match_dup 2)))]
6854 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6855 (set_attr "length" "4,4,8,8")])
6858 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
6859 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6860 (match_operand:DI 2 "reg_or_cint_operand" ""))
6862 (set (match_operand:DI 0 "gpc_reg_operand" "")
6863 (rotate:DI (match_dup 1) (match_dup 2)))]
6864 "TARGET_POWERPC64 && reload_completed"
6866 (rotate:DI (match_dup 1) (match_dup 2)))
6868 (compare:CC (match_dup 0)
6872 (define_insn "*rotldi3_internal4"
6873 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6874 (and:DI (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6875 (match_operand:DI 2 "reg_or_cint_operand" "r,i"))
6876 (match_operand:DI 3 "mask64_operand" "n,n")))]
6879 rldc%B3 %0,%1,%2,%S3
6880 rldic%B3 %0,%1,%H2,%S3"
6881 [(set_attr "type" "var_shift_rotate,integer")])
6883 (define_insn "*rotldi3_internal5"
6884 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
6886 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6887 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
6888 (match_operand:DI 3 "mask64_operand" "n,n,n,n"))
6890 (clobber (match_scratch:DI 4 "=r,r,r,r"))]
6893 rldc%B3. %4,%1,%2,%S3
6894 rldic%B3. %4,%1,%H2,%S3
6897 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6898 (set_attr "length" "4,4,8,8")])
6901 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
6903 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6904 (match_operand:DI 2 "reg_or_cint_operand" ""))
6905 (match_operand:DI 3 "mask64_operand" ""))
6907 (clobber (match_scratch:DI 4 ""))]
6908 "TARGET_POWERPC64 && reload_completed"
6910 (and:DI (rotate:DI (match_dup 1)
6914 (compare:CC (match_dup 4)
6918 (define_insn "*rotldi3_internal6"
6919 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
6921 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6922 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
6923 (match_operand:DI 3 "mask64_operand" "n,n,n,n"))
6925 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
6926 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6929 rldc%B3. %0,%1,%2,%S3
6930 rldic%B3. %0,%1,%H2,%S3
6933 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6934 (set_attr "length" "4,4,8,8")])
6937 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
6939 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6940 (match_operand:DI 2 "reg_or_cint_operand" ""))
6941 (match_operand:DI 3 "mask64_operand" ""))
6943 (set (match_operand:DI 0 "gpc_reg_operand" "")
6944 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6945 "TARGET_POWERPC64 && reload_completed"
6947 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
6949 (compare:CC (match_dup 0)
6953 (define_insn "*rotldi3_internal7le"
6954 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6957 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6958 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
6959 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN"
6962 rldicl %0,%1,%H2,56"
6963 [(set_attr "type" "var_shift_rotate,integer")])
6965 (define_insn "*rotldi3_internal7be"
6966 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6969 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6970 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 7)))]
6971 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN"
6974 rldicl %0,%1,%H2,56"
6975 [(set_attr "type" "var_shift_rotate,integer")])
6977 (define_insn "*rotldi3_internal8le"
6978 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
6979 (compare:CC (zero_extend:DI
6981 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6982 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
6984 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
6985 "TARGET_64BIT && !BYTES_BIG_ENDIAN"
6988 rldicl. %3,%1,%H2,56
6991 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6992 (set_attr "length" "4,4,8,8")])
6994 (define_insn "*rotldi3_internal8be"
6995 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
6996 (compare:CC (zero_extend:DI
6998 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6999 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 7))
7001 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7002 "TARGET_64BIT && BYTES_BIG_ENDIAN"
7005 rldicl. %3,%1,%H2,56
7008 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7009 (set_attr "length" "4,4,8,8")])
7012 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7013 (compare:CC (zero_extend:DI
7015 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7016 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7018 (clobber (match_scratch:DI 3 ""))]
7019 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN && reload_completed"
7021 (zero_extend:DI (subreg:QI
7022 (rotate:DI (match_dup 1)
7025 (compare:CC (match_dup 3)
7030 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7031 (compare:CC (zero_extend:DI
7033 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7034 (match_operand:DI 2 "reg_or_cint_operand" "")) 7))
7036 (clobber (match_scratch:DI 3 ""))]
7037 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN && reload_completed"
7039 (zero_extend:DI (subreg:QI
7040 (rotate:DI (match_dup 1)
7043 (compare:CC (match_dup 3)
7047 (define_insn "*rotldi3_internal9le"
7048 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7049 (compare:CC (zero_extend:DI
7051 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7052 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7054 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7055 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7056 "TARGET_64BIT && !BYTES_BIG_ENDIAN"
7059 rldicl. %0,%1,%H2,56
7062 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7063 (set_attr "length" "4,4,8,8")])
7065 (define_insn "*rotldi3_internal9be"
7066 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7067 (compare:CC (zero_extend:DI
7069 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7070 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 7))
7072 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7073 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 7)))]
7074 "TARGET_64BIT && BYTES_BIG_ENDIAN"
7077 rldicl. %0,%1,%H2,56
7080 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7081 (set_attr "length" "4,4,8,8")])
7084 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7085 (compare:CC (zero_extend:DI
7087 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7088 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7090 (set (match_operand:DI 0 "gpc_reg_operand" "")
7091 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7092 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN && reload_completed"
7094 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
7096 (compare:CC (match_dup 0)
7101 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7102 (compare:CC (zero_extend:DI
7104 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7105 (match_operand:DI 2 "reg_or_cint_operand" "")) 7))
7107 (set (match_operand:DI 0 "gpc_reg_operand" "")
7108 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 7)))]
7109 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN && reload_completed"
7111 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 7)))
7113 (compare:CC (match_dup 0)
7117 (define_insn "*rotldi3_internal10le"
7118 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7121 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7122 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
7123 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN"
7126 rldicl %0,%1,%H2,48"
7127 [(set_attr "type" "var_shift_rotate,integer")])
7129 (define_insn "*rotldi3_internal10be"
7130 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7133 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7134 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 6)))]
7135 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN"
7138 rldicl %0,%1,%H2,48"
7139 [(set_attr "type" "var_shift_rotate,integer")])
7141 (define_insn "*rotldi3_internal11le"
7142 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7143 (compare:CC (zero_extend:DI
7145 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7146 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7148 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7149 "TARGET_64BIT && !BYTES_BIG_ENDIAN"
7152 rldicl. %3,%1,%H2,48
7155 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7156 (set_attr "length" "4,4,8,8")])
7158 (define_insn "*rotldi3_internal11be"
7159 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7160 (compare:CC (zero_extend:DI
7162 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7163 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 6))
7165 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7166 "TARGET_64BIT && BYTES_BIG_ENDIAN"
7169 rldicl. %3,%1,%H2,48
7172 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7173 (set_attr "length" "4,4,8,8")])
7176 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7177 (compare:CC (zero_extend:DI
7179 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7180 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7182 (clobber (match_scratch:DI 3 ""))]
7183 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN && reload_completed"
7185 (zero_extend:DI (subreg:HI
7186 (rotate:DI (match_dup 1)
7189 (compare:CC (match_dup 3)
7194 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7195 (compare:CC (zero_extend:DI
7197 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7198 (match_operand:DI 2 "reg_or_cint_operand" "")) 6))
7200 (clobber (match_scratch:DI 3 ""))]
7201 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN && reload_completed"
7203 (zero_extend:DI (subreg:HI
7204 (rotate:DI (match_dup 1)
7207 (compare:CC (match_dup 3)
7211 (define_insn "*rotldi3_internal12le"
7212 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7213 (compare:CC (zero_extend:DI
7215 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7216 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7218 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7219 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7220 "TARGET_64BIT && !BYTES_BIG_ENDIAN"
7223 rldicl. %0,%1,%H2,48
7226 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7227 (set_attr "length" "4,4,8,8")])
7229 (define_insn "*rotldi3_internal12be"
7230 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7231 (compare:CC (zero_extend:DI
7233 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7234 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 6))
7236 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7237 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 6)))]
7238 "TARGET_64BIT && BYTES_BIG_ENDIAN"
7241 rldicl. %0,%1,%H2,48
7244 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7245 (set_attr "length" "4,4,8,8")])
7248 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7249 (compare:CC (zero_extend:DI
7251 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7252 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7254 (set (match_operand:DI 0 "gpc_reg_operand" "")
7255 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7256 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN && reload_completed"
7258 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
7260 (compare:CC (match_dup 0)
7265 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7266 (compare:CC (zero_extend:DI
7268 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7269 (match_operand:DI 2 "reg_or_cint_operand" "")) 6))
7271 (set (match_operand:DI 0 "gpc_reg_operand" "")
7272 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 6)))]
7273 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN && reload_completed"
7275 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 6)))
7277 (compare:CC (match_dup 0)
7281 (define_insn "*rotldi3_internal13le"
7282 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7285 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7286 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
7287 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN"
7290 rldicl %0,%1,%H2,32"
7291 [(set_attr "type" "var_shift_rotate,integer")])
7293 (define_insn "*rotldi3_internal13be"
7294 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7297 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7298 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 4)))]
7299 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN"
7302 rldicl %0,%1,%H2,32"
7303 [(set_attr "type" "var_shift_rotate,integer")])
7305 (define_insn "*rotldi3_internal14le"
7306 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7307 (compare:CC (zero_extend:DI
7309 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7310 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7312 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7313 "TARGET_64BIT && !BYTES_BIG_ENDIAN"
7316 rldicl. %3,%1,%H2,32
7319 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7320 (set_attr "length" "4,4,8,8")])
7322 (define_insn "*rotldi3_internal14be"
7323 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7324 (compare:CC (zero_extend:DI
7326 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7327 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 4))
7329 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7330 "TARGET_64BIT && BYTES_BIG_ENDIAN"
7333 rldicl. %3,%1,%H2,32
7336 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7337 (set_attr "length" "4,4,8,8")])
7340 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7341 (compare:CC (zero_extend:DI
7343 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7344 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7346 (clobber (match_scratch:DI 3 ""))]
7347 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN && reload_completed"
7349 (zero_extend:DI (subreg:SI
7350 (rotate:DI (match_dup 1)
7353 (compare:CC (match_dup 3)
7358 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7359 (compare:CC (zero_extend:DI
7361 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7362 (match_operand:DI 2 "reg_or_cint_operand" "")) 4))
7364 (clobber (match_scratch:DI 3 ""))]
7365 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN && reload_completed"
7367 (zero_extend:DI (subreg:SI
7368 (rotate:DI (match_dup 1)
7371 (compare:CC (match_dup 3)
7375 (define_insn "*rotldi3_internal15le"
7376 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7377 (compare:CC (zero_extend:DI
7379 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7380 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7382 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7383 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7384 "TARGET_64BIT && !BYTES_BIG_ENDIAN"
7387 rldicl. %0,%1,%H2,32
7390 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7391 (set_attr "length" "4,4,8,8")])
7393 (define_insn "*rotldi3_internal15be"
7394 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7395 (compare:CC (zero_extend:DI
7397 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7398 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 4))
7400 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7401 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 4)))]
7402 "TARGET_64BIT && BYTES_BIG_ENDIAN"
7405 rldicl. %0,%1,%H2,32
7408 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7409 (set_attr "length" "4,4,8,8")])
7412 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7413 (compare:CC (zero_extend:DI
7415 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7416 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7418 (set (match_operand:DI 0 "gpc_reg_operand" "")
7419 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7420 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN && reload_completed"
7422 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
7424 (compare:CC (match_dup 0)
7429 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7430 (compare:CC (zero_extend:DI
7432 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7433 (match_operand:DI 2 "reg_or_cint_operand" "")) 4))
7435 (set (match_operand:DI 0 "gpc_reg_operand" "")
7436 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 4)))]
7437 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN && reload_completed"
7439 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 4)))
7441 (compare:CC (match_dup 0)
7445 (define_expand "ashldi3"
7446 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7447 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7448 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7452 (define_insn "*ashldi3_internal1"
7453 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7454 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7455 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
7460 [(set_attr "type" "var_shift_rotate,shift")])
7462 (define_insn "*ashldi3_internal2"
7463 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7464 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7465 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7467 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7474 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7475 (set_attr "length" "4,4,8,8")])
7478 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7479 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7480 (match_operand:SI 2 "reg_or_cint_operand" ""))
7482 (clobber (match_scratch:DI 3 ""))]
7483 "TARGET_POWERPC64 && reload_completed"
7485 (ashift:DI (match_dup 1) (match_dup 2)))
7487 (compare:CC (match_dup 3)
7491 (define_insn "*ashldi3_internal3"
7492 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7493 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7494 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7496 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7497 (ashift:DI (match_dup 1) (match_dup 2)))]
7504 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7505 (set_attr "length" "4,4,8,8")])
7508 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7509 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7510 (match_operand:SI 2 "reg_or_cint_operand" ""))
7512 (set (match_operand:DI 0 "gpc_reg_operand" "")
7513 (ashift:DI (match_dup 1) (match_dup 2)))]
7514 "TARGET_POWERPC64 && reload_completed"
7516 (ashift:DI (match_dup 1) (match_dup 2)))
7518 (compare:CC (match_dup 0)
7522 (define_insn "*ashldi3_internal4"
7523 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7524 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7525 (match_operand:SI 2 "const_int_operand" "i"))
7526 (match_operand:DI 3 "const_int_operand" "n")))]
7527 "TARGET_POWERPC64 && includes_rldic_lshift_p (operands[2], operands[3])"
7528 "rldic %0,%1,%H2,%W3")
7530 (define_insn "ashldi3_internal5"
7531 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7533 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7534 (match_operand:SI 2 "const_int_operand" "i,i"))
7535 (match_operand:DI 3 "const_int_operand" "n,n"))
7537 (clobber (match_scratch:DI 4 "=r,r"))]
7538 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
7540 rldic. %4,%1,%H2,%W3
7542 [(set_attr "type" "compare")
7543 (set_attr "length" "4,8")])
7546 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7548 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7549 (match_operand:SI 2 "const_int_operand" ""))
7550 (match_operand:DI 3 "const_int_operand" ""))
7552 (clobber (match_scratch:DI 4 ""))]
7553 "TARGET_POWERPC64 && reload_completed
7554 && includes_rldic_lshift_p (operands[2], operands[3])"
7556 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7559 (compare:CC (match_dup 4)
7563 (define_insn "*ashldi3_internal6"
7564 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
7566 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7567 (match_operand:SI 2 "const_int_operand" "i,i"))
7568 (match_operand:DI 3 "const_int_operand" "n,n"))
7570 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7571 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7572 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
7574 rldic. %0,%1,%H2,%W3
7576 [(set_attr "type" "compare")
7577 (set_attr "length" "4,8")])
7580 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
7582 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7583 (match_operand:SI 2 "const_int_operand" ""))
7584 (match_operand:DI 3 "const_int_operand" ""))
7586 (set (match_operand:DI 0 "gpc_reg_operand" "")
7587 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7588 "TARGET_POWERPC64 && reload_completed
7589 && includes_rldic_lshift_p (operands[2], operands[3])"
7591 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7594 (compare:CC (match_dup 0)
7598 (define_insn "*ashldi3_internal7"
7599 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7600 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7601 (match_operand:SI 2 "const_int_operand" "i"))
7602 (match_operand:DI 3 "mask64_operand" "n")))]
7603 "TARGET_POWERPC64 && includes_rldicr_lshift_p (operands[2], operands[3])"
7604 "rldicr %0,%1,%H2,%S3")
7606 (define_insn "ashldi3_internal8"
7607 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7609 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7610 (match_operand:SI 2 "const_int_operand" "i,i"))
7611 (match_operand:DI 3 "mask64_operand" "n,n"))
7613 (clobber (match_scratch:DI 4 "=r,r"))]
7614 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
7616 rldicr. %4,%1,%H2,%S3
7618 [(set_attr "type" "compare")
7619 (set_attr "length" "4,8")])
7622 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7624 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7625 (match_operand:SI 2 "const_int_operand" ""))
7626 (match_operand:DI 3 "mask64_operand" ""))
7628 (clobber (match_scratch:DI 4 ""))]
7629 "TARGET_POWERPC64 && reload_completed
7630 && includes_rldicr_lshift_p (operands[2], operands[3])"
7632 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7635 (compare:CC (match_dup 4)
7639 (define_insn "*ashldi3_internal9"
7640 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
7642 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7643 (match_operand:SI 2 "const_int_operand" "i,i"))
7644 (match_operand:DI 3 "mask64_operand" "n,n"))
7646 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7647 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7648 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
7650 rldicr. %0,%1,%H2,%S3
7652 [(set_attr "type" "compare")
7653 (set_attr "length" "4,8")])
7656 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
7658 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7659 (match_operand:SI 2 "const_int_operand" ""))
7660 (match_operand:DI 3 "mask64_operand" ""))
7662 (set (match_operand:DI 0 "gpc_reg_operand" "")
7663 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7664 "TARGET_POWERPC64 && reload_completed
7665 && includes_rldicr_lshift_p (operands[2], operands[3])"
7667 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7670 (compare:CC (match_dup 0)
7674 (define_expand "lshrdi3"
7675 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7676 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7677 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7681 (define_insn "*lshrdi3_internal1"
7682 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7683 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7684 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
7689 [(set_attr "type" "var_shift_rotate,shift")])
7691 (define_insn "*lshrdi3_internal2"
7692 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7693 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7694 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7696 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7703 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7704 (set_attr "length" "4,4,8,8")])
7707 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7708 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7709 (match_operand:SI 2 "reg_or_cint_operand" ""))
7711 (clobber (match_scratch:DI 3 ""))]
7712 "TARGET_POWERPC64 && reload_completed"
7714 (lshiftrt:DI (match_dup 1) (match_dup 2)))
7716 (compare:CC (match_dup 3)
7720 (define_insn "*lshrdi3_internal3"
7721 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7722 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7723 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7725 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7726 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
7733 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7734 (set_attr "length" "4,4,8,8")])
7737 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7738 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7739 (match_operand:SI 2 "reg_or_cint_operand" ""))
7741 (set (match_operand:DI 0 "gpc_reg_operand" "")
7742 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
7743 "TARGET_POWERPC64 && reload_completed"
7745 (lshiftrt:DI (match_dup 1) (match_dup 2)))
7747 (compare:CC (match_dup 0)
7751 (define_expand "ashrdi3"
7752 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7753 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7754 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7758 if (TARGET_POWERPC64)
7760 else if (GET_CODE (operands[2]) == CONST_INT)
7762 emit_insn (gen_ashrdi3_no_power (operands[0], operands[1], operands[2]));
7769 (define_insn "*ashrdi3_internal1"
7770 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7771 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7772 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
7777 [(set_attr "type" "var_shift_rotate,shift")])
7779 (define_insn "*ashrdi3_internal2"
7780 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7781 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7782 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7784 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7791 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7792 (set_attr "length" "4,4,8,8")])
7795 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7796 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7797 (match_operand:SI 2 "reg_or_cint_operand" ""))
7799 (clobber (match_scratch:DI 3 ""))]
7800 "TARGET_POWERPC64 && reload_completed"
7802 (ashiftrt:DI (match_dup 1) (match_dup 2)))
7804 (compare:CC (match_dup 3)
7808 (define_insn "*ashrdi3_internal3"
7809 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7810 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7811 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7813 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7814 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
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 3 "cc_reg_not_cr0_operand" "")
7826 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7827 (match_operand:SI 2 "reg_or_cint_operand" ""))
7829 (set (match_operand:DI 0 "gpc_reg_operand" "")
7830 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
7831 "TARGET_POWERPC64 && reload_completed"
7833 (ashiftrt:DI (match_dup 1) (match_dup 2)))
7835 (compare:CC (match_dup 0)
7839 (define_expand "anddi3"
7841 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7842 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7843 (match_operand:DI 2 "and64_2_operand" "")))
7844 (clobber (match_scratch:CC 3 ""))])]
7848 (define_insn "anddi3_mc"
7849 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
7850 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r")
7851 (match_operand:DI 2 "and64_2_operand" "?r,S,T,K,J,t")))
7852 (clobber (match_scratch:CC 3 "=X,X,X,x,x,X"))]
7853 "TARGET_POWERPC64 && rs6000_gen_cell_microcode"
7856 rldic%B2 %0,%1,0,%S2
7857 rlwinm %0,%1,0,%m2,%M2
7861 [(set_attr "type" "*,*,*,fast_compare,fast_compare,*")
7862 (set_attr "length" "4,4,4,4,4,8")])
7864 (define_insn "anddi3_nomc"
7865 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7866 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r")
7867 (match_operand:DI 2 "and64_2_operand" "?r,S,T,t")))
7868 (clobber (match_scratch:CC 3 "=X,X,X,X"))]
7869 "TARGET_POWERPC64 && !rs6000_gen_cell_microcode"
7872 rldic%B2 %0,%1,0,%S2
7873 rlwinm %0,%1,0,%m2,%M2
7875 [(set_attr "length" "4,4,4,8")])
7878 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7879 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7880 (match_operand:DI 2 "mask64_2_operand" "")))
7881 (clobber (match_scratch:CC 3 ""))]
7883 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7884 && !mask_operand (operands[2], DImode)
7885 && !mask64_operand (operands[2], DImode)"
7887 (and:DI (rotate:DI (match_dup 1)
7891 (and:DI (rotate:DI (match_dup 0)
7895 build_mask64_2_operands (operands[2], &operands[4]);
7898 (define_insn "*anddi3_internal2_mc"
7899 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,x,?y,?y,?y,??y,??y,?y")
7900 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r,r,r")
7901 (match_operand:DI 2 "and64_2_operand" "r,S,T,K,J,t,r,S,T,K,J,t"))
7903 (clobber (match_scratch:DI 3 "=r,r,r,r,r,r,r,r,r,r,r,r"))
7904 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,X,X,x,x,X"))]
7905 "TARGET_64BIT && rs6000_gen_cell_microcode"
7908 rldic%B2. %3,%1,0,%S2
7909 rlwinm. %3,%1,0,%m2,%M2
7919 [(set_attr "type" "fast_compare,compare,delayed_compare,fast_compare,\
7920 fast_compare,compare,compare,compare,compare,compare,\
7922 (set_attr "length" "4,4,4,4,4,8,8,8,8,8,8,12")])
7925 [(set (match_operand:CC 0 "cc_reg_operand" "")
7926 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7927 (match_operand:DI 2 "mask64_2_operand" ""))
7929 (clobber (match_scratch:DI 3 ""))
7930 (clobber (match_scratch:CC 4 ""))]
7931 "TARGET_64BIT && reload_completed
7932 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7933 && !mask_operand (operands[2], DImode)
7934 && !mask64_operand (operands[2], DImode)"
7936 (and:DI (rotate:DI (match_dup 1)
7939 (parallel [(set (match_dup 0)
7940 (compare:CC (and:DI (rotate:DI (match_dup 3)
7944 (clobber (match_dup 3))])]
7947 build_mask64_2_operands (operands[2], &operands[5]);
7950 (define_insn "*anddi3_internal3_mc"
7951 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,x,x,?y,?y,?y,??y,??y,?y")
7952 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r,r,r")
7953 (match_operand:DI 2 "and64_2_operand" "r,S,T,K,J,t,r,S,T,K,J,t"))
7955 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r,r,r")
7956 (and:DI (match_dup 1) (match_dup 2)))
7957 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,X,X,x,x,X"))]
7958 "TARGET_64BIT && rs6000_gen_cell_microcode"
7961 rldic%B2. %0,%1,0,%S2
7962 rlwinm. %0,%1,0,%m2,%M2
7972 [(set_attr "type" "fast_compare,compare,delayed_compare,fast_compare,\
7973 fast_compare,compare,compare,compare,compare,compare,\
7975 (set_attr "length" "4,4,4,4,4,8,8,8,8,8,8,12")])
7978 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7979 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7980 (match_operand:DI 2 "and64_2_operand" ""))
7982 (set (match_operand:DI 0 "gpc_reg_operand" "")
7983 (and:DI (match_dup 1) (match_dup 2)))
7984 (clobber (match_scratch:CC 4 ""))]
7985 "TARGET_64BIT && reload_completed"
7986 [(parallel [(set (match_dup 0)
7987 (and:DI (match_dup 1) (match_dup 2)))
7988 (clobber (match_dup 4))])
7990 (compare:CC (match_dup 0)
7995 [(set (match_operand:CC 3 "cc_reg_operand" "")
7996 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7997 (match_operand:DI 2 "mask64_2_operand" ""))
7999 (set (match_operand:DI 0 "gpc_reg_operand" "")
8000 (and:DI (match_dup 1) (match_dup 2)))
8001 (clobber (match_scratch:CC 4 ""))]
8002 "TARGET_64BIT && reload_completed
8003 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
8004 && !mask_operand (operands[2], DImode)
8005 && !mask64_operand (operands[2], DImode)"
8007 (and:DI (rotate:DI (match_dup 1)
8010 (parallel [(set (match_dup 3)
8011 (compare:CC (and:DI (rotate:DI (match_dup 0)
8016 (and:DI (rotate:DI (match_dup 0)
8021 build_mask64_2_operands (operands[2], &operands[5]);
8024 (define_expand "iordi3"
8025 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8026 (ior:DI (match_operand:DI 1 "gpc_reg_operand" "")
8027 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
8031 if (non_logical_cint_operand (operands[2], DImode))
8033 HOST_WIDE_INT value;
8034 rtx tmp = ((!can_create_pseudo_p ()
8035 || rtx_equal_p (operands[0], operands[1]))
8036 ? operands[0] : gen_reg_rtx (DImode));
8038 value = INTVAL (operands[2]);
8039 emit_insn (gen_iordi3 (tmp, operands[1],
8040 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
8042 emit_insn (gen_iordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
8047 (define_expand "xordi3"
8048 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8049 (xor:DI (match_operand:DI 1 "gpc_reg_operand" "")
8050 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
8054 if (non_logical_cint_operand (operands[2], DImode))
8056 HOST_WIDE_INT value;
8057 rtx tmp = ((!can_create_pseudo_p ()
8058 || rtx_equal_p (operands[0], operands[1]))
8059 ? operands[0] : gen_reg_rtx (DImode));
8061 value = INTVAL (operands[2]);
8062 emit_insn (gen_xordi3 (tmp, operands[1],
8063 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
8065 emit_insn (gen_xordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
8070 (define_insn "*booldi3_internal1"
8071 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
8072 (match_operator:DI 3 "boolean_or_operator"
8073 [(match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
8074 (match_operand:DI 2 "logical_operand" "r,K,JF")]))]
8081 (define_insn "*booldi3_internal2"
8082 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
8083 (compare:CC (match_operator:DI 4 "boolean_or_operator"
8084 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
8085 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
8087 (clobber (match_scratch:DI 3 "=r,r"))]
8092 [(set_attr "type" "fast_compare,compare")
8093 (set_attr "length" "4,8")])
8096 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8097 (compare:CC (match_operator:DI 4 "boolean_operator"
8098 [(match_operand:DI 1 "gpc_reg_operand" "")
8099 (match_operand:DI 2 "gpc_reg_operand" "")])
8101 (clobber (match_scratch:DI 3 ""))]
8102 "TARGET_POWERPC64 && reload_completed"
8103 [(set (match_dup 3) (match_dup 4))
8105 (compare:CC (match_dup 3)
8109 (define_insn "*booldi3_internal3"
8110 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
8111 (compare:CC (match_operator:DI 4 "boolean_or_operator"
8112 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
8113 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
8115 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8121 [(set_attr "type" "fast_compare,compare")
8122 (set_attr "length" "4,8")])
8125 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8126 (compare:CC (match_operator:DI 4 "boolean_operator"
8127 [(match_operand:DI 1 "gpc_reg_operand" "")
8128 (match_operand:DI 2 "gpc_reg_operand" "")])
8130 (set (match_operand:DI 0 "gpc_reg_operand" "")
8132 "TARGET_POWERPC64 && reload_completed"
8133 [(set (match_dup 0) (match_dup 4))
8135 (compare:CC (match_dup 0)
8139 ;; Split a logical operation that we can't do in one insn into two insns,
8140 ;; each of which does one 16-bit part. This is used by combine.
8143 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8144 (match_operator:DI 3 "boolean_or_operator"
8145 [(match_operand:DI 1 "gpc_reg_operand" "")
8146 (match_operand:DI 2 "non_logical_cint_operand" "")]))]
8148 [(set (match_dup 0) (match_dup 4))
8149 (set (match_dup 0) (match_dup 5))]
8154 i3 = GEN_INT (INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff));
8155 i4 = GEN_INT (INTVAL (operands[2]) & 0xffff);
8156 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
8158 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
8162 (define_insn "*boolcdi3_internal1"
8163 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
8164 (match_operator:DI 3 "boolean_operator"
8165 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
8166 (match_operand:DI 2 "gpc_reg_operand" "r")]))]
8170 (define_insn "*boolcdi3_internal2"
8171 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
8172 (compare:CC (match_operator:DI 4 "boolean_operator"
8173 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
8174 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
8176 (clobber (match_scratch:DI 3 "=r,r"))]
8181 [(set_attr "type" "fast_compare,compare")
8182 (set_attr "length" "4,8")])
8185 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8186 (compare:CC (match_operator:DI 4 "boolean_operator"
8187 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
8188 (match_operand:DI 2 "gpc_reg_operand" "")])
8190 (clobber (match_scratch:DI 3 ""))]
8191 "TARGET_POWERPC64 && reload_completed"
8192 [(set (match_dup 3) (match_dup 4))
8194 (compare:CC (match_dup 3)
8198 (define_insn "*boolcdi3_internal3"
8199 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
8200 (compare:CC (match_operator:DI 4 "boolean_operator"
8201 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
8202 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
8204 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8210 [(set_attr "type" "fast_compare,compare")
8211 (set_attr "length" "4,8")])
8214 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8215 (compare:CC (match_operator:DI 4 "boolean_operator"
8216 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
8217 (match_operand:DI 2 "gpc_reg_operand" "")])
8219 (set (match_operand:DI 0 "gpc_reg_operand" "")
8221 "TARGET_POWERPC64 && reload_completed"
8222 [(set (match_dup 0) (match_dup 4))
8224 (compare:CC (match_dup 0)
8228 (define_insn "*boolccdi3_internal1"
8229 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
8230 (match_operator:DI 3 "boolean_operator"
8231 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
8232 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r"))]))]
8236 (define_insn "*boolccdi3_internal2"
8237 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
8238 (compare:CC (match_operator:DI 4 "boolean_operator"
8239 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
8240 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
8242 (clobber (match_scratch:DI 3 "=r,r"))]
8247 [(set_attr "type" "fast_compare,compare")
8248 (set_attr "length" "4,8")])
8251 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8252 (compare:CC (match_operator:DI 4 "boolean_operator"
8253 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
8254 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
8256 (clobber (match_scratch:DI 3 ""))]
8257 "TARGET_POWERPC64 && reload_completed"
8258 [(set (match_dup 3) (match_dup 4))
8260 (compare:CC (match_dup 3)
8264 (define_insn "*boolccdi3_internal3"
8265 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
8266 (compare:CC (match_operator:DI 4 "boolean_operator"
8267 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
8268 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
8270 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8276 [(set_attr "type" "fast_compare,compare")
8277 (set_attr "length" "4,8")])
8280 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8281 (compare:CC (match_operator:DI 4 "boolean_operator"
8282 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
8283 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
8285 (set (match_operand:DI 0 "gpc_reg_operand" "")
8287 "TARGET_POWERPC64 && reload_completed"
8288 [(set (match_dup 0) (match_dup 4))
8290 (compare:CC (match_dup 0)
8294 ;; Now define ways of moving data around.
8296 ;; Set up a register with a value from the GOT table
8298 (define_expand "movsi_got"
8299 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8300 (unspec:SI [(match_operand:SI 1 "got_operand" "")
8301 (match_dup 2)] UNSPEC_MOVSI_GOT))]
8302 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
8305 if (GET_CODE (operands[1]) == CONST)
8307 rtx offset = const0_rtx;
8308 HOST_WIDE_INT value;
8310 operands[1] = eliminate_constant_term (XEXP (operands[1], 0), &offset);
8311 value = INTVAL (offset);
8314 rtx tmp = (!can_create_pseudo_p ()
8316 : gen_reg_rtx (Pmode));
8317 emit_insn (gen_movsi_got (tmp, operands[1]));
8318 emit_insn (gen_addsi3 (operands[0], tmp, offset));
8323 operands[2] = rs6000_got_register (operands[1]);
8326 (define_insn "*movsi_got_internal"
8327 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8328 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
8329 (match_operand:SI 2 "gpc_reg_operand" "b")]
8331 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
8332 "lwz %0,%a1@got(%2)"
8333 [(set_attr "type" "load")])
8335 ;; Used by sched, shorten_branches and final when the GOT pseudo reg
8336 ;; didn't get allocated to a hard register.
8338 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8339 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
8340 (match_operand:SI 2 "memory_operand" "")]
8342 "DEFAULT_ABI == ABI_V4
8344 && (reload_in_progress || reload_completed)"
8345 [(set (match_dup 0) (match_dup 2))
8346 (set (match_dup 0) (unspec:SI [(match_dup 1)(match_dup 0)]
8350 ;; For SI, we special-case integers that can't be loaded in one insn. We
8351 ;; do the load 16-bits at a time. We could do this by loading from memory,
8352 ;; and this is even supposed to be faster, but it is simpler not to get
8353 ;; integers in the TOC.
8354 (define_insn "movsi_low"
8355 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8356 (mem:SI (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
8357 (match_operand 2 "" ""))))]
8358 "TARGET_MACHO && ! TARGET_64BIT"
8359 "lwz %0,lo16(%2)(%1)"
8360 [(set_attr "type" "load")
8361 (set_attr "length" "4")])
8363 (define_insn "*movsi_internal1"
8364 [(set (match_operand:SI 0 "rs6000_nonimmediate_operand" "=r,r,r,m,r,r,r,r,*c*l,*h,*h")
8365 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,*h,r,r,0"))]
8366 "!TARGET_SINGLE_FPU &&
8367 (gpc_reg_operand (operands[0], SImode) || gpc_reg_operand (operands[1], SImode))"
8380 [(set_attr_alternative "type"
8384 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
8385 (const_string "load_ux")
8387 (match_test "update_address_mem (operands[1], VOIDmode)")
8388 (const_string "load_u")
8389 (const_string "load")))
8391 (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
8392 (const_string "store_ux")
8394 (match_test "update_address_mem (operands[0], VOIDmode)")
8395 (const_string "store_u")
8396 (const_string "store")))
8400 (const_string "mfjmpr")
8401 (const_string "mtjmpr")
8403 (const_string "*")])
8405 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4")])
8407 (define_insn "*movsi_internal1_single"
8408 [(set (match_operand:SI 0 "rs6000_nonimmediate_operand" "=r,r,r,m,r,r,r,r,*c*l,*h,*h,m,*f")
8409 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,*h,r,r,0,f,m"))]
8410 "TARGET_SINGLE_FPU &&
8411 (gpc_reg_operand (operands[0], SImode) || gpc_reg_operand (operands[1], SImode))"
8426 [(set_attr_alternative "type"
8430 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
8431 (const_string "load_ux")
8433 (match_test "update_address_mem (operands[1], VOIDmode)")
8434 (const_string "load_u")
8435 (const_string "load")))
8437 (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
8438 (const_string "store_ux")
8440 (match_test "update_address_mem (operands[0], VOIDmode)")
8441 (const_string "store_u")
8442 (const_string "store")))
8446 (const_string "mfjmpr")
8447 (const_string "mtjmpr")
8451 (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
8452 (const_string "fpstore_ux")
8454 (match_test "update_address_mem (operands[0], VOIDmode)")
8455 (const_string "fpstore_u")
8456 (const_string "fpstore")))
8458 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
8459 (const_string "fpload_ux")
8461 (match_test "update_address_mem (operands[1], VOIDmode)")
8462 (const_string "fpload_u")
8463 (const_string "fpload")))])
8464 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4,4,4")])
8466 ;; Split a load of a large constant into the appropriate two-insn
8470 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8471 (match_operand:SI 1 "const_int_operand" ""))]
8472 "(unsigned HOST_WIDE_INT) (INTVAL (operands[1]) + 0x8000) >= 0x10000
8473 && (INTVAL (operands[1]) & 0xffff) != 0"
8477 (ior:SI (match_dup 0)
8480 { rtx tem = rs6000_emit_set_const (operands[0], SImode, operands[1], 2);
8482 if (tem == operands[0])
8488 (define_insn "*mov<mode>_internal2"
8489 [(set (match_operand:CC 2 "cc_reg_operand" "=y,x,?y")
8490 (compare:CC (match_operand:P 1 "gpc_reg_operand" "0,r,r")
8492 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r") (match_dup 1))]
8498 [(set_attr "type" "cmp,compare,cmp")
8499 (set_attr "length" "4,4,8")])
8502 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
8503 (compare:CC (match_operand:P 1 "gpc_reg_operand" "")
8505 (set (match_operand:P 0 "gpc_reg_operand" "") (match_dup 1))]
8507 [(set (match_dup 0) (match_dup 1))
8509 (compare:CC (match_dup 0)
8513 (define_insn "*movhi_internal"
8514 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,m,r,r,*c*l,*h")
8515 (match_operand:HI 1 "input_operand" "r,m,r,i,*h,r,0"))]
8516 "gpc_reg_operand (operands[0], HImode)
8517 || gpc_reg_operand (operands[1], HImode)"
8526 [(set_attr_alternative "type"
8529 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
8530 (const_string "load_ux")
8532 (match_test "update_address_mem (operands[1], VOIDmode)")
8533 (const_string "load_u")
8534 (const_string "load")))
8536 (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
8537 (const_string "store_ux")
8539 (match_test "update_address_mem (operands[0], VOIDmode)")
8540 (const_string "store_u")
8541 (const_string "store")))
8543 (const_string "mfjmpr")
8544 (const_string "mtjmpr")
8545 (const_string "*")])])
8547 (define_expand "mov<mode>"
8548 [(set (match_operand:INT 0 "general_operand" "")
8549 (match_operand:INT 1 "any_operand" ""))]
8551 "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
8553 (define_insn "*movqi_internal"
8554 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,m,r,r,*c*l,*h")
8555 (match_operand:QI 1 "input_operand" "r,m,r,i,*h,r,0"))]
8556 "gpc_reg_operand (operands[0], QImode)
8557 || gpc_reg_operand (operands[1], QImode)"
8566 [(set_attr_alternative "type"
8569 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
8570 (const_string "load_ux")
8572 (match_test "update_address_mem (operands[1], VOIDmode)")
8573 (const_string "load_u")
8574 (const_string "load")))
8576 (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
8577 (const_string "store_ux")
8579 (match_test "update_address_mem (operands[0], VOIDmode)")
8580 (const_string "store_u")
8581 (const_string "store")))
8583 (const_string "mfjmpr")
8584 (const_string "mtjmpr")
8585 (const_string "*")])])
8587 ;; Here is how to move condition codes around. When we store CC data in
8588 ;; an integer register or memory, we store just the high-order 4 bits.
8589 ;; This lets us not shift in the most common case of CR0.
8590 (define_expand "movcc"
8591 [(set (match_operand:CC 0 "nonimmediate_operand" "")
8592 (match_operand:CC 1 "nonimmediate_operand" ""))]
8596 (define_insn "*movcc_internal1"
8597 [(set (match_operand:CC 0 "nonimmediate_operand" "=y,x,?y,y,r,r,r,r,r,cl,r,m")
8598 (match_operand:CC 1 "general_operand" "y,r,r,O,x,y,r,I,h,r,m,r"))]
8599 "register_operand (operands[0], CCmode)
8600 || register_operand (operands[1], CCmode)"
8604 rlwinm %1,%1,%F0,0xffffffff\;mtcrf %R0,%1\;rlwinm %1,%1,%f0,0xffffffff
8607 mfcr %0%Q1\;rlwinm %0,%0,%f1,0xf0000000
8615 (cond [(eq_attr "alternative" "0,3")
8616 (const_string "cr_logical")
8617 (eq_attr "alternative" "1,2")
8618 (const_string "mtcr")
8619 (eq_attr "alternative" "6,7")
8620 (const_string "integer")
8621 (eq_attr "alternative" "8")
8622 (const_string "mfjmpr")
8623 (eq_attr "alternative" "9")
8624 (const_string "mtjmpr")
8625 (eq_attr "alternative" "10")
8627 (match_test "update_indexed_address_mem (operands[1],
8629 (const_string "load_ux")
8631 (match_test "update_address_mem (operands[1], VOIDmode)")
8632 (const_string "load_u")
8633 (const_string "load")))
8634 (eq_attr "alternative" "11")
8636 (match_test "update_indexed_address_mem (operands[0],
8638 (const_string "store_ux")
8640 (match_test "update_address_mem (operands[0], VOIDmode)")
8641 (const_string "store_u")
8642 (const_string "store")))
8643 (match_test "TARGET_MFCRF")
8644 (const_string "mfcrf")
8646 (const_string "mfcr")))
8647 (set_attr "length" "4,4,12,4,4,8,4,4,4,4,4,4")])
8649 ;; For floating-point, we normally deal with the floating-point registers
8650 ;; unless -msoft-float is used. The sole exception is that parameter passing
8651 ;; can produce floating-point values in fixed-point registers. Unless the
8652 ;; value is a simple constant or already in memory, we deal with this by
8653 ;; allocating memory and copying the value explicitly via that memory location.
8655 ;; Move 32-bit binary/decimal floating point
8656 (define_expand "mov<mode>"
8657 [(set (match_operand:FMOVE32 0 "nonimmediate_operand" "")
8658 (match_operand:FMOVE32 1 "any_operand" ""))]
8660 "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
8663 [(set (match_operand:FMOVE32 0 "gpc_reg_operand" "")
8664 (match_operand:FMOVE32 1 "const_double_operand" ""))]
8666 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8667 || (GET_CODE (operands[0]) == SUBREG
8668 && GET_CODE (SUBREG_REG (operands[0])) == REG
8669 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8670 [(set (match_dup 2) (match_dup 3))]
8676 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8677 <real_value_to_target> (rv, l);
8679 if (! TARGET_POWERPC64)
8680 operands[2] = operand_subword (operands[0], 0, 0, <MODE>mode);
8682 operands[2] = gen_lowpart (SImode, operands[0]);
8684 operands[3] = gen_int_mode (l, SImode);
8687 (define_insn "mov<mode>_hardfloat"
8688 [(set (match_operand:FMOVE32 0 "nonimmediate_operand" "=!r,!r,m,f,wa,wa,<f32_lr>,<f32_sm>,*c*l,!r,*h,!r,!r")
8689 (match_operand:FMOVE32 1 "input_operand" "r,m,r,f,wa,j,<f32_lm>,<f32_sr>,r,h,0,G,Fn"))]
8690 "(gpc_reg_operand (operands[0], <MODE>mode)
8691 || gpc_reg_operand (operands[1], <MODE>mode))
8692 && (TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT)"
8707 [(set_attr_alternative "type"
8710 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
8711 (const_string "load_ux")
8713 (match_test "update_address_mem (operands[1], VOIDmode)")
8714 (const_string "load_u")
8715 (const_string "load")))
8717 (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
8718 (const_string "store_ux")
8720 (match_test "update_address_mem (operands[0], VOIDmode)")
8721 (const_string "store_u")
8722 (const_string "store")))
8724 (const_string "vecsimple")
8725 (const_string "vecsimple")
8727 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
8728 (const_string "fpload_ux")
8730 (match_test "update_address_mem (operands[1], VOIDmode)")
8731 (const_string "fpload_u")
8732 (const_string "fpload")))
8734 (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
8735 (const_string "fpstore_ux")
8737 (match_test "update_address_mem (operands[0], VOIDmode)")
8738 (const_string "fpstore_u")
8739 (const_string "fpstore")))
8740 (const_string "mtjmpr")
8741 (const_string "mfjmpr")
8744 (const_string "*")])
8745 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4,8")])
8747 (define_insn "*mov<mode>_softfloat"
8748 [(set (match_operand:FMOVE32 0 "nonimmediate_operand" "=r,cl,r,r,m,r,r,r,r,*h")
8749 (match_operand:FMOVE32 1 "input_operand" "r, r,h,m,r,I,L,G,Fn,0"))]
8750 "(gpc_reg_operand (operands[0], <MODE>mode)
8751 || gpc_reg_operand (operands[1], <MODE>mode))
8752 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)"
8764 [(set_attr_alternative "type"
8766 (const_string "mtjmpr")
8767 (const_string "mfjmpr")
8769 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
8770 (const_string "load_ux")
8772 (match_test "update_address_mem (operands[1], VOIDmode)")
8773 (const_string "load_u")
8774 (const_string "load")))
8776 (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
8777 (const_string "store_ux")
8779 (match_test "update_address_mem (operands[0], VOIDmode)")
8780 (const_string "store_u")
8781 (const_string "store")))
8786 (const_string "*")])
8787 (set_attr "length" "4,4,4,4,4,4,4,4,8,4")])
8790 ;; Move 64-bit binary/decimal floating point
8791 (define_expand "mov<mode>"
8792 [(set (match_operand:FMOVE64 0 "nonimmediate_operand" "")
8793 (match_operand:FMOVE64 1 "any_operand" ""))]
8795 "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
8798 [(set (match_operand:FMOVE64 0 "gpc_reg_operand" "")
8799 (match_operand:FMOVE64 1 "const_int_operand" ""))]
8800 "! TARGET_POWERPC64 && reload_completed
8801 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8802 || (GET_CODE (operands[0]) == SUBREG
8803 && GET_CODE (SUBREG_REG (operands[0])) == REG
8804 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8805 [(set (match_dup 2) (match_dup 4))
8806 (set (match_dup 3) (match_dup 1))]
8809 int endian = (WORDS_BIG_ENDIAN == 0);
8810 HOST_WIDE_INT value = INTVAL (operands[1]);
8812 operands[2] = operand_subword (operands[0], endian, 0, <MODE>mode);
8813 operands[3] = operand_subword (operands[0], 1 - endian, 0, <MODE>mode);
8814 operands[4] = GEN_INT (value >> 32);
8815 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
8819 [(set (match_operand:FMOVE64 0 "gpc_reg_operand" "")
8820 (match_operand:FMOVE64 1 "const_double_operand" ""))]
8821 "! TARGET_POWERPC64 && reload_completed
8822 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8823 || (GET_CODE (operands[0]) == SUBREG
8824 && GET_CODE (SUBREG_REG (operands[0])) == REG
8825 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8826 [(set (match_dup 2) (match_dup 4))
8827 (set (match_dup 3) (match_dup 5))]
8830 int endian = (WORDS_BIG_ENDIAN == 0);
8834 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8835 <real_value_to_target> (rv, l);
8837 operands[2] = operand_subword (operands[0], endian, 0, <MODE>mode);
8838 operands[3] = operand_subword (operands[0], 1 - endian, 0, <MODE>mode);
8839 operands[4] = gen_int_mode (l[endian], SImode);
8840 operands[5] = gen_int_mode (l[1 - endian], SImode);
8844 [(set (match_operand:FMOVE64 0 "gpc_reg_operand" "")
8845 (match_operand:FMOVE64 1 "const_double_operand" ""))]
8846 "TARGET_POWERPC64 && reload_completed
8847 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8848 || (GET_CODE (operands[0]) == SUBREG
8849 && GET_CODE (SUBREG_REG (operands[0])) == REG
8850 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8851 [(set (match_dup 2) (match_dup 3))]
8854 int endian = (WORDS_BIG_ENDIAN == 0);
8859 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8860 <real_value_to_target> (rv, l);
8862 operands[2] = gen_lowpart (DImode, operands[0]);
8863 /* HIGHPART is lower memory address when WORDS_BIG_ENDIAN. */
8864 val = ((HOST_WIDE_INT)(unsigned long)l[endian] << 32
8865 | ((HOST_WIDE_INT)(unsigned long)l[1 - endian]));
8867 operands[3] = gen_int_mode (val, DImode);
8870 ;; Don't have reload use general registers to load a constant. It is
8871 ;; less efficient than loading the constant into an FP register, since
8872 ;; it will probably be used there.
8874 ;; The move constraints are ordered to prefer floating point registers before
8875 ;; general purpose registers to avoid doing a store and a load to get the value
8876 ;; into a floating point register when it is needed for a floating point
8877 ;; operation. Prefer traditional floating point registers over VSX registers,
8878 ;; since the D-form version of the memory instructions does not need a GPR for
8881 (define_insn "*mov<mode>_hardfloat32"
8882 [(set (match_operand:FMOVE64 0 "nonimmediate_operand" "=m,d,d,ws,?wa,Z,?Z,ws,?wa,wa,Y,r,!r,!r,!r,!r")
8883 (match_operand:FMOVE64 1 "input_operand" "d,m,d,Z,Z,ws,wa,ws,wa,j,r,Y,r,G,H,F"))]
8884 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
8885 && (gpc_reg_operand (operands[0], <MODE>mode)
8886 || gpc_reg_operand (operands[1], <MODE>mode))"
8904 [(set_attr_alternative "type"
8906 (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
8907 (const_string "fpstore_ux")
8909 (match_test "update_address_mem (operands[0], VOIDmode)")
8910 (const_string "fpstore_u")
8911 (const_string "fpstore")))
8913 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
8914 (const_string "fpload_ux")
8916 (match_test "update_address_mem (operands[1], VOIDmode)")
8917 (const_string "fpload_u")
8918 (const_string "fpload")))
8921 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
8922 (const_string "fpload_ux")
8923 (const_string "fpload"))
8925 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
8926 (const_string "fpload_ux")
8927 (const_string "fpload"))
8929 (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
8930 (const_string "fpstore_ux")
8931 (const_string "fpstore"))
8933 (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
8934 (const_string "fpstore_ux")
8935 (const_string "fpstore"))
8936 (const_string "vecsimple")
8937 (const_string "vecsimple")
8938 (const_string "vecsimple")
8939 (const_string "store")
8940 (const_string "load")
8941 (const_string "two")
8944 (const_string "*")])
8945 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,8,8,8,8,12,16")])
8947 (define_insn "*mov<mode>_softfloat32"
8948 [(set (match_operand:FMOVE64 0 "nonimmediate_operand" "=Y,r,r,r,r,r")
8949 (match_operand:FMOVE64 1 "input_operand" "r,Y,r,G,H,F"))]
8951 && ((TARGET_FPRS && TARGET_SINGLE_FLOAT)
8952 || TARGET_SOFT_FLOAT || TARGET_E500_SINGLE)
8953 && (gpc_reg_operand (operands[0], <MODE>mode)
8954 || gpc_reg_operand (operands[1], <MODE>mode))"
8956 [(set_attr "type" "store,load,two,*,*,*")
8957 (set_attr "length" "8,8,8,8,12,16")])
8959 ; ld/std require word-aligned displacements -> 'Y' constraint.
8960 ; List Y->r and r->Y before r->r for reload.
8961 (define_insn "*mov<mode>_hardfloat64"
8962 [(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")
8963 (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"))]
8964 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
8965 && (gpc_reg_operand (operands[0], <MODE>mode)
8966 || gpc_reg_operand (operands[1], <MODE>mode))"
8989 [(set_attr_alternative "type"
8991 (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
8992 (const_string "fpstore_ux")
8994 (match_test "update_address_mem (operands[0], VOIDmode)")
8995 (const_string "fpstore_u")
8996 (const_string "fpstore")))
8998 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
8999 (const_string "fpload_ux")
9001 (match_test "update_address_mem (operands[1], VOIDmode)")
9002 (const_string "fpload_u")
9003 (const_string "fpload")))
9006 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
9007 (const_string "fpload_ux")
9008 (const_string "fpload"))
9010 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
9011 (const_string "fpload_ux")
9012 (const_string "fpload"))
9014 (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
9015 (const_string "fpstore_ux")
9016 (const_string "fpstore"))
9018 (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
9019 (const_string "fpstore_ux")
9020 (const_string "fpstore"))
9021 (const_string "vecsimple")
9022 (const_string "vecsimple")
9023 (const_string "vecsimple")
9025 (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
9026 (const_string "store_ux")
9028 (match_test "update_address_mem (operands[0], VOIDmode)")
9029 (const_string "store_u")
9030 (const_string "store")))
9032 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
9033 (const_string "load_ux")
9035 (match_test "update_address_mem (operands[1], VOIDmode)")
9036 (const_string "load_u")
9037 (const_string "load")))
9039 (const_string "mtjmpr")
9040 (const_string "mfjmpr")
9045 (const_string "mftgpr")
9046 (const_string "mffgpr")])
9047 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,8,12,16,4,4")])
9049 (define_insn "*mov<mode>_softfloat64"
9050 [(set (match_operand:FMOVE64 0 "nonimmediate_operand" "=Y,r,r,cl,r,r,r,r,*h")
9051 (match_operand:FMOVE64 1 "input_operand" "r,Y,r,r,h,G,H,F,0"))]
9052 "TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)
9053 && (gpc_reg_operand (operands[0], <MODE>mode)
9054 || gpc_reg_operand (operands[1], <MODE>mode))"
9065 [(set_attr_alternative "type"
9067 (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
9068 (const_string "store_ux")
9070 (match_test "update_address_mem (operands[0], VOIDmode)")
9071 (const_string "store_u")
9072 (const_string "store")))
9074 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
9075 (const_string "load_ux")
9077 (match_test "update_address_mem (operands[1], VOIDmode)")
9078 (const_string "load_u")
9079 (const_string "load")))
9081 (const_string "mtjmpr")
9082 (const_string "mfjmpr")
9086 (const_string "*")])
9087 (set_attr "length" "4,4,4,4,4,8,12,16,4")])
9089 (define_expand "mov<mode>"
9090 [(set (match_operand:FMOVE128 0 "general_operand" "")
9091 (match_operand:FMOVE128 1 "any_operand" ""))]
9093 "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
9095 ;; It's important to list Y->r and r->Y before r->r because otherwise
9096 ;; reload, given m->r, will try to pick r->r and reload it, which
9097 ;; doesn't make progress.
9098 (define_insn_and_split "*mov<mode>_internal"
9099 [(set (match_operand:FMOVE128 0 "nonimmediate_operand" "=m,d,d,Y,r,r")
9100 (match_operand:FMOVE128 1 "input_operand" "d,m,d,r,YGHF,r"))]
9101 "TARGET_HARD_FLOAT && TARGET_FPRS
9102 && (gpc_reg_operand (operands[0], <MODE>mode)
9103 || gpc_reg_operand (operands[1], <MODE>mode))"
9105 "&& reload_completed"
9107 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
9108 [(set_attr "length" "8,8,8,20,20,16")])
9110 (define_insn_and_split "*mov<mode>_softfloat"
9111 [(set (match_operand:FMOVE128 0 "rs6000_nonimmediate_operand" "=Y,r,r")
9112 (match_operand:FMOVE128 1 "input_operand" "r,YGHF,r"))]
9113 "(TARGET_SOFT_FLOAT || !TARGET_FPRS)
9114 && (gpc_reg_operand (operands[0], <MODE>mode)
9115 || gpc_reg_operand (operands[1], <MODE>mode))"
9117 "&& reload_completed"
9119 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
9120 [(set_attr "length" "20,20,16")])
9122 (define_expand "extenddftf2"
9123 [(set (match_operand:TF 0 "nonimmediate_operand" "")
9124 (float_extend:TF (match_operand:DF 1 "input_operand" "")))]
9126 && TARGET_HARD_FLOAT
9127 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9128 && TARGET_LONG_DOUBLE_128"
9130 if (TARGET_E500_DOUBLE)
9131 emit_insn (gen_spe_extenddftf2 (operands[0], operands[1]));
9133 emit_insn (gen_extenddftf2_fprs (operands[0], operands[1]));
9137 (define_expand "extenddftf2_fprs"
9138 [(parallel [(set (match_operand:TF 0 "nonimmediate_operand" "")
9139 (float_extend:TF (match_operand:DF 1 "input_operand" "")))
9140 (use (match_dup 2))])]
9142 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9143 && TARGET_LONG_DOUBLE_128"
9145 operands[2] = CONST0_RTX (DFmode);
9146 /* Generate GOT reference early for SVR4 PIC. */
9147 if (DEFAULT_ABI == ABI_V4 && flag_pic)
9148 operands[2] = validize_mem (force_const_mem (DFmode, operands[2]));
9151 (define_insn_and_split "*extenddftf2_internal"
9152 [(set (match_operand:TF 0 "nonimmediate_operand" "=m,Y,d,&d,r")
9153 (float_extend:TF (match_operand:DF 1 "input_operand" "d,r,md,md,rmGHF")))
9154 (use (match_operand:DF 2 "zero_reg_mem_operand" "d,r,m,d,n"))]
9156 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9157 && TARGET_LONG_DOUBLE_128"
9159 "&& reload_completed"
9162 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
9163 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
9164 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word),
9166 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word),
9171 (define_expand "extendsftf2"
9172 [(set (match_operand:TF 0 "nonimmediate_operand" "")
9173 (float_extend:TF (match_operand:SF 1 "gpc_reg_operand" "")))]
9175 && TARGET_HARD_FLOAT
9176 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9177 && TARGET_LONG_DOUBLE_128"
9179 rtx tmp = gen_reg_rtx (DFmode);
9180 emit_insn (gen_extendsfdf2 (tmp, operands[1]));
9181 emit_insn (gen_extenddftf2 (operands[0], tmp));
9185 (define_expand "trunctfdf2"
9186 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9187 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "")))]
9189 && TARGET_HARD_FLOAT
9190 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9191 && TARGET_LONG_DOUBLE_128"
9194 (define_insn_and_split "trunctfdf2_internal1"
9195 [(set (match_operand:DF 0 "gpc_reg_operand" "=d,?d")
9196 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "0,d")))]
9197 "!TARGET_IEEEQUAD && !TARGET_XL_COMPAT
9198 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9202 "&& reload_completed && REGNO (operands[0]) == REGNO (operands[1])"
9205 emit_note (NOTE_INSN_DELETED);
9208 [(set_attr "type" "fp")])
9210 (define_insn "trunctfdf2_internal2"
9211 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
9212 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "d")))]
9213 "!TARGET_IEEEQUAD && TARGET_XL_COMPAT
9214 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9215 && TARGET_LONG_DOUBLE_128"
9217 [(set_attr "type" "fp")
9218 (set_attr "fp_type" "fp_addsub_d")])
9220 (define_expand "trunctfsf2"
9221 [(set (match_operand:SF 0 "gpc_reg_operand" "")
9222 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "")))]
9224 && TARGET_HARD_FLOAT
9225 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9226 && TARGET_LONG_DOUBLE_128"
9228 if (TARGET_E500_DOUBLE)
9229 emit_insn (gen_spe_trunctfsf2 (operands[0], operands[1]));
9231 emit_insn (gen_trunctfsf2_fprs (operands[0], operands[1]));
9235 (define_insn_and_split "trunctfsf2_fprs"
9236 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
9237 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "d")))
9238 (clobber (match_scratch:DF 2 "=d"))]
9240 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
9241 && TARGET_LONG_DOUBLE_128"
9243 "&& reload_completed"
9245 (float_truncate:DF (match_dup 1)))
9247 (float_truncate:SF (match_dup 2)))]
9250 (define_expand "floatsitf2"
9251 [(set (match_operand:TF 0 "gpc_reg_operand" "")
9252 (float:TF (match_operand:SI 1 "gpc_reg_operand" "")))]
9254 && TARGET_HARD_FLOAT
9255 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9256 && TARGET_LONG_DOUBLE_128"
9258 rtx tmp = gen_reg_rtx (DFmode);
9259 expand_float (tmp, operands[1], false);
9260 emit_insn (gen_extenddftf2 (operands[0], tmp));
9264 ; fadd, but rounding towards zero.
9265 ; This is probably not the optimal code sequence.
9266 (define_insn "fix_trunc_helper"
9267 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
9268 (unspec:DF [(match_operand:TF 1 "gpc_reg_operand" "d")]
9269 UNSPEC_FIX_TRUNC_TF))
9270 (clobber (match_operand:DF 2 "gpc_reg_operand" "=&d"))]
9271 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
9272 "mffs %2\n\tmtfsb1 31\n\tmtfsb0 30\n\tfadd %0,%1,%L1\n\tmtfsf 1,%2"
9273 [(set_attr "type" "fp")
9274 (set_attr "length" "20")])
9276 (define_expand "fix_trunctfsi2"
9277 [(set (match_operand:SI 0 "gpc_reg_operand" "")
9278 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))]
9279 "!TARGET_IEEEQUAD && TARGET_HARD_FLOAT
9280 && (TARGET_FPRS || TARGET_E500_DOUBLE) && TARGET_LONG_DOUBLE_128"
9282 if (TARGET_E500_DOUBLE)
9283 emit_insn (gen_spe_fix_trunctfsi2 (operands[0], operands[1]));
9285 emit_insn (gen_fix_trunctfsi2_fprs (operands[0], operands[1]));
9289 (define_expand "fix_trunctfsi2_fprs"
9290 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
9291 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))
9292 (clobber (match_dup 2))
9293 (clobber (match_dup 3))
9294 (clobber (match_dup 4))
9295 (clobber (match_dup 5))])]
9297 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9299 operands[2] = gen_reg_rtx (DFmode);
9300 operands[3] = gen_reg_rtx (DFmode);
9301 operands[4] = gen_reg_rtx (DImode);
9302 operands[5] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode));
9305 (define_insn_and_split "*fix_trunctfsi2_internal"
9306 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9307 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "d")))
9308 (clobber (match_operand:DF 2 "gpc_reg_operand" "=d"))
9309 (clobber (match_operand:DF 3 "gpc_reg_operand" "=&d"))
9310 (clobber (match_operand:DI 4 "gpc_reg_operand" "=d"))
9311 (clobber (match_operand:DI 5 "offsettable_mem_operand" "=o"))]
9313 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9319 emit_insn (gen_fix_trunc_helper (operands[2], operands[1], operands[3]));
9321 gcc_assert (MEM_P (operands[5]));
9322 lowword = adjust_address (operands[5], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
9324 emit_insn (gen_fctiwz_df (operands[4], operands[2]));
9325 emit_move_insn (operands[5], operands[4]);
9326 emit_move_insn (operands[0], lowword);
9330 (define_expand "negtf2"
9331 [(set (match_operand:TF 0 "gpc_reg_operand" "")
9332 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "")))]
9334 && TARGET_HARD_FLOAT
9335 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9336 && TARGET_LONG_DOUBLE_128"
9339 (define_insn "negtf2_internal"
9340 [(set (match_operand:TF 0 "gpc_reg_operand" "=d")
9341 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "d")))]
9343 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9346 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
9347 return \"fneg %L0,%L1\;fneg %0,%1\";
9349 return \"fneg %0,%1\;fneg %L0,%L1\";
9351 [(set_attr "type" "fp")
9352 (set_attr "length" "8")])
9354 (define_expand "abstf2"
9355 [(set (match_operand:TF 0 "gpc_reg_operand" "")
9356 (abs:TF (match_operand:TF 1 "gpc_reg_operand" "")))]
9358 && TARGET_HARD_FLOAT
9359 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9360 && TARGET_LONG_DOUBLE_128"
9363 rtx label = gen_label_rtx ();
9364 if (TARGET_E500_DOUBLE)
9366 if (flag_finite_math_only && !flag_trapping_math)
9367 emit_insn (gen_spe_abstf2_tst (operands[0], operands[1], label));
9369 emit_insn (gen_spe_abstf2_cmp (operands[0], operands[1], label));
9372 emit_insn (gen_abstf2_internal (operands[0], operands[1], label));
9377 (define_expand "abstf2_internal"
9378 [(set (match_operand:TF 0 "gpc_reg_operand" "")
9379 (match_operand:TF 1 "gpc_reg_operand" ""))
9380 (set (match_dup 3) (match_dup 5))
9381 (set (match_dup 5) (abs:DF (match_dup 5)))
9382 (set (match_dup 4) (compare:CCFP (match_dup 3) (match_dup 5)))
9383 (set (pc) (if_then_else (eq (match_dup 4) (const_int 0))
9384 (label_ref (match_operand 2 "" ""))
9386 (set (match_dup 6) (neg:DF (match_dup 6)))]
9388 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9389 && TARGET_LONG_DOUBLE_128"
9392 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
9393 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
9394 operands[3] = gen_reg_rtx (DFmode);
9395 operands[4] = gen_reg_rtx (CCFPmode);
9396 operands[5] = simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word);
9397 operands[6] = simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word);
9400 ;; Reload helper functions used by rs6000_secondary_reload. The patterns all
9401 ;; must have 3 arguments, and scratch register constraint must be a single
9404 ;; Reload patterns to support gpr load/store with misaligned mem.
9405 ;; and multiple gpr load/store at offset >= 0xfffc
9406 (define_expand "reload_<mode>_store"
9407 [(parallel [(match_operand 0 "memory_operand" "=m")
9408 (match_operand 1 "gpc_reg_operand" "r")
9409 (match_operand:GPR 2 "register_operand" "=&b")])]
9412 rs6000_secondary_reload_gpr (operands[1], operands[0], operands[2], true);
9416 (define_expand "reload_<mode>_load"
9417 [(parallel [(match_operand 0 "gpc_reg_operand" "=r")
9418 (match_operand 1 "memory_operand" "m")
9419 (match_operand:GPR 2 "register_operand" "=b")])]
9422 rs6000_secondary_reload_gpr (operands[0], operands[1], operands[2], false);
9427 ;; Next come the multi-word integer load and store and the load and store
9430 ;; List r->r after r->Y, otherwise reload will try to reload a
9431 ;; non-offsettable address by using r->r which won't make progress.
9432 ;; Use of fprs is disparaged slightly otherwise reload prefers to reload
9433 ;; a gpr into a fpr instead of reloading an invalid 'Y' address
9434 (define_insn "*movdi_internal32"
9435 [(set (match_operand:DI 0 "rs6000_nonimmediate_operand" "=Y,r,r,?m,?*d,?*d,r,?wa")
9436 (match_operand:DI 1 "input_operand" "r,Y,r,d,m,d,IJKnGHF,O"))]
9438 && (gpc_reg_operand (operands[0], DImode)
9439 || gpc_reg_operand (operands[1], DImode))"
9449 [(set_attr_alternative "type"
9450 [(const_string "store")
9451 (const_string "load")
9454 (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
9455 (const_string "fpstore_ux")
9457 (match_test "update_address_mem (operands[0], VOIDmode)")
9458 (const_string "fpstore_u")
9459 (const_string "fpstore")))
9461 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
9462 (const_string "fpload_ux")
9464 (match_test "update_address_mem (operands[1], VOIDmode)")
9465 (const_string "fpload_u")
9466 (const_string "fpload")))
9469 (const_string "vecsimple")])])
9472 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9473 (match_operand:DI 1 "const_int_operand" ""))]
9474 "! TARGET_POWERPC64 && reload_completed
9475 && gpr_or_gpr_p (operands[0], operands[1])"
9476 [(set (match_dup 2) (match_dup 4))
9477 (set (match_dup 3) (match_dup 1))]
9480 HOST_WIDE_INT value = INTVAL (operands[1]);
9481 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
9483 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
9485 operands[4] = GEN_INT (value >> 32);
9486 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
9490 [(set (match_operand:DIFD 0 "rs6000_nonimmediate_operand" "")
9491 (match_operand:DIFD 1 "input_operand" ""))]
9492 "reload_completed && !TARGET_POWERPC64
9493 && gpr_or_gpr_p (operands[0], operands[1])"
9495 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
9497 (define_insn "*movdi_internal64"
9498 [(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")
9499 (match_operand:DI 1 "input_operand" "r,Y,r,I,L,nF,d,m,d,wa,Z,wa,*h,r,0,O,*wg,r"))]
9501 && (gpc_reg_operand (operands[0], DImode)
9502 || gpc_reg_operand (operands[1], DImode))"
9522 [(set_attr_alternative "type"
9524 (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
9525 (const_string "store_ux")
9527 (match_test "update_address_mem (operands[0], VOIDmode)")
9528 (const_string "store_u")
9529 (const_string "store")))
9531 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
9532 (const_string "load_ux")
9534 (match_test "update_address_mem (operands[1], VOIDmode)")
9535 (const_string "load_u")
9536 (const_string "load")))
9542 (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
9543 (const_string "fpstore_ux")
9545 (match_test "update_address_mem (operands[0], VOIDmode)")
9546 (const_string "fpstore_u")
9547 (const_string "fpstore")))
9549 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
9550 (const_string "fpload_ux")
9552 (match_test "update_address_mem (operands[1], VOIDmode)")
9553 (const_string "fpload_u")
9554 (const_string "fpload")))
9557 (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
9558 (const_string "fpstore_ux")
9559 (const_string "fpstore"))
9561 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
9562 (const_string "fpload_ux")
9563 (const_string "fpload"))
9564 (const_string "vecsimple")
9565 (const_string "mfjmpr")
9566 (const_string "mtjmpr")
9568 (const_string "vecsimple")
9569 (const_string "mftgpr")
9570 (const_string "mffgpr")])
9571 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4,4,4,4,4,4")])
9573 ;; Generate all one-bits and clear left or right.
9574 ;; Use (and:DI (rotate:DI ...)) to avoid anddi3 unnecessary clobber.
9576 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9577 (match_operand:DI 1 "mask64_operand" ""))]
9578 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
9579 [(set (match_dup 0) (const_int -1))
9581 (and:DI (rotate:DI (match_dup 0)
9586 ;; Split a load of a large constant into the appropriate five-instruction
9587 ;; sequence. Handle anything in a constant number of insns.
9588 ;; When non-easy constants can go in the TOC, this should use
9589 ;; easy_fp_constant predicate.
9591 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9592 (match_operand:DI 1 "const_int_operand" ""))]
9593 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
9594 [(set (match_dup 0) (match_dup 2))
9595 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
9597 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
9599 if (tem == operands[0])
9606 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9607 (match_operand:DI 1 "const_double_operand" ""))]
9608 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
9609 [(set (match_dup 0) (match_dup 2))
9610 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
9612 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
9614 if (tem == operands[0])
9620 ;; TImode/PTImode is similar, except that we usually want to compute the
9621 ;; address into a register and use lsi/stsi (the exception is during reload).
9623 (define_insn "*mov<mode>_string"
9624 [(set (match_operand:TI2 0 "reg_or_mem_operand" "=Q,Y,????r,????r,????r,r")
9625 (match_operand:TI2 1 "input_operand" "r,r,Q,Y,r,n"))]
9627 && (<MODE>mode != TImode || VECTOR_MEM_NONE_P (TImode))
9628 && (gpc_reg_operand (operands[0], <MODE>mode)
9629 || gpc_reg_operand (operands[1], <MODE>mode))"
9632 switch (which_alternative)
9638 return \"stswi %1,%P0,16\";
9642 /* If the address is not used in the output, we can use lsi. Otherwise,
9643 fall through to generating four loads. */
9645 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
9646 return \"lswi %0,%P1,16\";
9647 /* ... fall through ... */
9654 [(set_attr "type" "store_ux,store_ux,load_ux,load_ux,*,*")
9655 (set (attr "cell_micro") (if_then_else (match_test "TARGET_STRING")
9656 (const_string "always")
9657 (const_string "conditional")))])
9659 (define_insn "*mov<mode>_ppc64"
9660 [(set (match_operand:TI2 0 "nonimmediate_operand" "=Y,r,r")
9661 (match_operand:TI2 1 "input_operand" "r,Y,r"))]
9663 && (<MODE>mode != TImode || VECTOR_MEM_NONE_P (TImode))
9664 && (gpc_reg_operand (operands[0], <MODE>mode)
9665 || gpc_reg_operand (operands[1], <MODE>mode)))"
9667 [(set_attr "type" "store,load,*")])
9670 [(set (match_operand:TI2 0 "gpc_reg_operand" "")
9671 (match_operand:TI2 1 "const_double_operand" ""))]
9673 [(set (match_dup 2) (match_dup 4))
9674 (set (match_dup 3) (match_dup 5))]
9677 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
9679 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
9681 if (GET_CODE (operands[1]) == CONST_DOUBLE)
9683 operands[4] = GEN_INT (CONST_DOUBLE_HIGH (operands[1]));
9684 operands[5] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
9686 else if (GET_CODE (operands[1]) == CONST_INT)
9688 operands[4] = GEN_INT (- (INTVAL (operands[1]) < 0));
9689 operands[5] = operands[1];
9696 [(set (match_operand:TI2 0 "nonimmediate_operand" "")
9697 (match_operand:TI2 1 "input_operand" ""))]
9699 && gpr_or_gpr_p (operands[0], operands[1])"
9701 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
9703 (define_expand "load_multiple"
9704 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
9705 (match_operand:SI 1 "" ""))
9706 (use (match_operand:SI 2 "" ""))])]
9707 "TARGET_STRING && !TARGET_POWERPC64"
9715 /* Support only loading a constant number of fixed-point registers from
9716 memory and only bother with this if more than two; the machine
9717 doesn't support more than eight. */
9718 if (GET_CODE (operands[2]) != CONST_INT
9719 || INTVAL (operands[2]) <= 2
9720 || INTVAL (operands[2]) > 8
9721 || GET_CODE (operands[1]) != MEM
9722 || GET_CODE (operands[0]) != REG
9723 || REGNO (operands[0]) >= 32)
9726 count = INTVAL (operands[2]);
9727 regno = REGNO (operands[0]);
9729 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
9730 op1 = replace_equiv_address (operands[1],
9731 force_reg (SImode, XEXP (operands[1], 0)));
9733 for (i = 0; i < count; i++)
9734 XVECEXP (operands[3], 0, i)
9735 = gen_rtx_SET (VOIDmode, gen_rtx_REG (SImode, regno + i),
9736 adjust_address_nv (op1, SImode, i * 4));
9739 (define_insn "*ldmsi8"
9740 [(match_parallel 0 "load_multiple_operation"
9741 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9742 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9743 (set (match_operand:SI 3 "gpc_reg_operand" "")
9744 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9745 (set (match_operand:SI 4 "gpc_reg_operand" "")
9746 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9747 (set (match_operand:SI 5 "gpc_reg_operand" "")
9748 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
9749 (set (match_operand:SI 6 "gpc_reg_operand" "")
9750 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
9751 (set (match_operand:SI 7 "gpc_reg_operand" "")
9752 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
9753 (set (match_operand:SI 8 "gpc_reg_operand" "")
9754 (mem:SI (plus:SI (match_dup 1) (const_int 24))))
9755 (set (match_operand:SI 9 "gpc_reg_operand" "")
9756 (mem:SI (plus:SI (match_dup 1) (const_int 28))))])]
9757 "TARGET_STRING && XVECLEN (operands[0], 0) == 8"
9759 { return rs6000_output_load_multiple (operands); }"
9760 [(set_attr "type" "load_ux")
9761 (set_attr "length" "32")])
9763 (define_insn "*ldmsi7"
9764 [(match_parallel 0 "load_multiple_operation"
9765 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9766 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9767 (set (match_operand:SI 3 "gpc_reg_operand" "")
9768 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9769 (set (match_operand:SI 4 "gpc_reg_operand" "")
9770 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9771 (set (match_operand:SI 5 "gpc_reg_operand" "")
9772 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
9773 (set (match_operand:SI 6 "gpc_reg_operand" "")
9774 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
9775 (set (match_operand:SI 7 "gpc_reg_operand" "")
9776 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
9777 (set (match_operand:SI 8 "gpc_reg_operand" "")
9778 (mem:SI (plus:SI (match_dup 1) (const_int 24))))])]
9779 "TARGET_STRING && XVECLEN (operands[0], 0) == 7"
9781 { return rs6000_output_load_multiple (operands); }"
9782 [(set_attr "type" "load_ux")
9783 (set_attr "length" "32")])
9785 (define_insn "*ldmsi6"
9786 [(match_parallel 0 "load_multiple_operation"
9787 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9788 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9789 (set (match_operand:SI 3 "gpc_reg_operand" "")
9790 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9791 (set (match_operand:SI 4 "gpc_reg_operand" "")
9792 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9793 (set (match_operand:SI 5 "gpc_reg_operand" "")
9794 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
9795 (set (match_operand:SI 6 "gpc_reg_operand" "")
9796 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
9797 (set (match_operand:SI 7 "gpc_reg_operand" "")
9798 (mem:SI (plus:SI (match_dup 1) (const_int 20))))])]
9799 "TARGET_STRING && XVECLEN (operands[0], 0) == 6"
9801 { return rs6000_output_load_multiple (operands); }"
9802 [(set_attr "type" "load_ux")
9803 (set_attr "length" "32")])
9805 (define_insn "*ldmsi5"
9806 [(match_parallel 0 "load_multiple_operation"
9807 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9808 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9809 (set (match_operand:SI 3 "gpc_reg_operand" "")
9810 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9811 (set (match_operand:SI 4 "gpc_reg_operand" "")
9812 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9813 (set (match_operand:SI 5 "gpc_reg_operand" "")
9814 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
9815 (set (match_operand:SI 6 "gpc_reg_operand" "")
9816 (mem:SI (plus:SI (match_dup 1) (const_int 16))))])]
9817 "TARGET_STRING && XVECLEN (operands[0], 0) == 5"
9819 { return rs6000_output_load_multiple (operands); }"
9820 [(set_attr "type" "load_ux")
9821 (set_attr "length" "32")])
9823 (define_insn "*ldmsi4"
9824 [(match_parallel 0 "load_multiple_operation"
9825 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9826 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9827 (set (match_operand:SI 3 "gpc_reg_operand" "")
9828 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9829 (set (match_operand:SI 4 "gpc_reg_operand" "")
9830 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9831 (set (match_operand:SI 5 "gpc_reg_operand" "")
9832 (mem:SI (plus:SI (match_dup 1) (const_int 12))))])]
9833 "TARGET_STRING && XVECLEN (operands[0], 0) == 4"
9835 { return rs6000_output_load_multiple (operands); }"
9836 [(set_attr "type" "load_ux")
9837 (set_attr "length" "32")])
9839 (define_insn "*ldmsi3"
9840 [(match_parallel 0 "load_multiple_operation"
9841 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9842 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9843 (set (match_operand:SI 3 "gpc_reg_operand" "")
9844 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9845 (set (match_operand:SI 4 "gpc_reg_operand" "")
9846 (mem:SI (plus:SI (match_dup 1) (const_int 8))))])]
9847 "TARGET_STRING && XVECLEN (operands[0], 0) == 3"
9849 { return rs6000_output_load_multiple (operands); }"
9850 [(set_attr "type" "load_ux")
9851 (set_attr "length" "32")])
9853 (define_expand "store_multiple"
9854 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
9855 (match_operand:SI 1 "" ""))
9856 (clobber (scratch:SI))
9857 (use (match_operand:SI 2 "" ""))])]
9858 "TARGET_STRING && !TARGET_POWERPC64"
9867 /* Support only storing a constant number of fixed-point registers to
9868 memory and only bother with this if more than two; the machine
9869 doesn't support more than eight. */
9870 if (GET_CODE (operands[2]) != CONST_INT
9871 || INTVAL (operands[2]) <= 2
9872 || INTVAL (operands[2]) > 8
9873 || GET_CODE (operands[0]) != MEM
9874 || GET_CODE (operands[1]) != REG
9875 || REGNO (operands[1]) >= 32)
9878 count = INTVAL (operands[2]);
9879 regno = REGNO (operands[1]);
9881 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count + 1));
9882 to = force_reg (SImode, XEXP (operands[0], 0));
9883 op0 = replace_equiv_address (operands[0], to);
9885 XVECEXP (operands[3], 0, 0)
9886 = gen_rtx_SET (VOIDmode, adjust_address_nv (op0, SImode, 0), operands[1]);
9887 XVECEXP (operands[3], 0, 1) = gen_rtx_CLOBBER (VOIDmode,
9888 gen_rtx_SCRATCH (SImode));
9890 for (i = 1; i < count; i++)
9891 XVECEXP (operands[3], 0, i + 1)
9892 = gen_rtx_SET (VOIDmode,
9893 adjust_address_nv (op0, SImode, i * 4),
9894 gen_rtx_REG (SImode, regno + i));
9897 (define_insn "*stmsi8"
9898 [(match_parallel 0 "store_multiple_operation"
9899 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9900 (match_operand:SI 2 "gpc_reg_operand" "r"))
9901 (clobber (match_scratch:SI 3 "=X"))
9902 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9903 (match_operand:SI 4 "gpc_reg_operand" "r"))
9904 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9905 (match_operand:SI 5 "gpc_reg_operand" "r"))
9906 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9907 (match_operand:SI 6 "gpc_reg_operand" "r"))
9908 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9909 (match_operand:SI 7 "gpc_reg_operand" "r"))
9910 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9911 (match_operand:SI 8 "gpc_reg_operand" "r"))
9912 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
9913 (match_operand:SI 9 "gpc_reg_operand" "r"))
9914 (set (mem:SI (plus:SI (match_dup 1) (const_int 28)))
9915 (match_operand:SI 10 "gpc_reg_operand" "r"))])]
9916 "TARGET_STRING && XVECLEN (operands[0], 0) == 9"
9918 [(set_attr "type" "store_ux")
9919 (set_attr "cell_micro" "always")])
9921 (define_insn "*stmsi7"
9922 [(match_parallel 0 "store_multiple_operation"
9923 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9924 (match_operand:SI 2 "gpc_reg_operand" "r"))
9925 (clobber (match_scratch:SI 3 "=X"))
9926 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9927 (match_operand:SI 4 "gpc_reg_operand" "r"))
9928 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9929 (match_operand:SI 5 "gpc_reg_operand" "r"))
9930 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9931 (match_operand:SI 6 "gpc_reg_operand" "r"))
9932 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9933 (match_operand:SI 7 "gpc_reg_operand" "r"))
9934 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9935 (match_operand:SI 8 "gpc_reg_operand" "r"))
9936 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
9937 (match_operand:SI 9 "gpc_reg_operand" "r"))])]
9938 "TARGET_STRING && XVECLEN (operands[0], 0) == 8"
9940 [(set_attr "type" "store_ux")
9941 (set_attr "cell_micro" "always")])
9943 (define_insn "*stmsi6"
9944 [(match_parallel 0 "store_multiple_operation"
9945 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9946 (match_operand:SI 2 "gpc_reg_operand" "r"))
9947 (clobber (match_scratch:SI 3 "=X"))
9948 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9949 (match_operand:SI 4 "gpc_reg_operand" "r"))
9950 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9951 (match_operand:SI 5 "gpc_reg_operand" "r"))
9952 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9953 (match_operand:SI 6 "gpc_reg_operand" "r"))
9954 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9955 (match_operand:SI 7 "gpc_reg_operand" "r"))
9956 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9957 (match_operand:SI 8 "gpc_reg_operand" "r"))])]
9958 "TARGET_STRING && XVECLEN (operands[0], 0) == 7"
9960 [(set_attr "type" "store_ux")
9961 (set_attr "cell_micro" "always")])
9963 (define_insn "*stmsi5"
9964 [(match_parallel 0 "store_multiple_operation"
9965 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9966 (match_operand:SI 2 "gpc_reg_operand" "r"))
9967 (clobber (match_scratch:SI 3 "=X"))
9968 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9969 (match_operand:SI 4 "gpc_reg_operand" "r"))
9970 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9971 (match_operand:SI 5 "gpc_reg_operand" "r"))
9972 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9973 (match_operand:SI 6 "gpc_reg_operand" "r"))
9974 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9975 (match_operand:SI 7 "gpc_reg_operand" "r"))])]
9976 "TARGET_STRING && XVECLEN (operands[0], 0) == 6"
9978 [(set_attr "type" "store_ux")
9979 (set_attr "cell_micro" "always")])
9981 (define_insn "*stmsi4"
9982 [(match_parallel 0 "store_multiple_operation"
9983 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9984 (match_operand:SI 2 "gpc_reg_operand" "r"))
9985 (clobber (match_scratch:SI 3 "=X"))
9986 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9987 (match_operand:SI 4 "gpc_reg_operand" "r"))
9988 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9989 (match_operand:SI 5 "gpc_reg_operand" "r"))
9990 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9991 (match_operand:SI 6 "gpc_reg_operand" "r"))])]
9992 "TARGET_STRING && XVECLEN (operands[0], 0) == 5"
9994 [(set_attr "type" "store_ux")
9995 (set_attr "cell_micro" "always")])
9997 (define_insn "*stmsi3"
9998 [(match_parallel 0 "store_multiple_operation"
9999 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10000 (match_operand:SI 2 "gpc_reg_operand" "r"))
10001 (clobber (match_scratch:SI 3 "=X"))
10002 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10003 (match_operand:SI 4 "gpc_reg_operand" "r"))
10004 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10005 (match_operand:SI 5 "gpc_reg_operand" "r"))])]
10006 "TARGET_STRING && XVECLEN (operands[0], 0) == 4"
10008 [(set_attr "type" "store_ux")
10009 (set_attr "cell_micro" "always")])
10011 (define_expand "setmemsi"
10012 [(parallel [(set (match_operand:BLK 0 "" "")
10013 (match_operand 2 "const_int_operand" ""))
10014 (use (match_operand:SI 1 "" ""))
10015 (use (match_operand:SI 3 "" ""))])]
10019 /* If value to set is not zero, use the library routine. */
10020 if (operands[2] != const0_rtx)
10023 if (expand_block_clear (operands))
10029 ;; String/block move insn.
10030 ;; Argument 0 is the destination
10031 ;; Argument 1 is the source
10032 ;; Argument 2 is the length
10033 ;; Argument 3 is the alignment
10035 (define_expand "movmemsi"
10036 [(parallel [(set (match_operand:BLK 0 "" "")
10037 (match_operand:BLK 1 "" ""))
10038 (use (match_operand:SI 2 "" ""))
10039 (use (match_operand:SI 3 "" ""))])]
10043 if (expand_block_move (operands))
10049 ;; Move up to 32 bytes at a time. The fixed registers are needed because the
10050 ;; register allocator doesn't have a clue about allocating 8 word registers.
10051 ;; rD/rS = r5 is preferred, efficient form.
10052 (define_expand "movmemsi_8reg"
10053 [(parallel [(set (match_operand 0 "" "")
10054 (match_operand 1 "" ""))
10055 (use (match_operand 2 "" ""))
10056 (use (match_operand 3 "" ""))
10057 (clobber (reg:SI 5))
10058 (clobber (reg:SI 6))
10059 (clobber (reg:SI 7))
10060 (clobber (reg:SI 8))
10061 (clobber (reg:SI 9))
10062 (clobber (reg:SI 10))
10063 (clobber (reg:SI 11))
10064 (clobber (reg:SI 12))
10065 (clobber (match_scratch:SI 4 ""))])]
10070 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
10071 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
10072 (use (match_operand:SI 2 "immediate_operand" "i"))
10073 (use (match_operand:SI 3 "immediate_operand" "i"))
10074 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10075 (clobber (reg:SI 6))
10076 (clobber (reg:SI 7))
10077 (clobber (reg:SI 8))
10078 (clobber (reg:SI 9))
10079 (clobber (reg:SI 10))
10080 (clobber (reg:SI 11))
10081 (clobber (reg:SI 12))
10082 (clobber (match_scratch:SI 5 "=X"))]
10084 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
10085 || INTVAL (operands[2]) == 0)
10086 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
10087 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
10088 && REGNO (operands[4]) == 5"
10089 "lswi %4,%1,%2\;stswi %4,%0,%2"
10090 [(set_attr "type" "store_ux")
10091 (set_attr "cell_micro" "always")
10092 (set_attr "length" "8")])
10094 ;; Move up to 24 bytes at a time. The fixed registers are needed because the
10095 ;; register allocator doesn't have a clue about allocating 6 word registers.
10096 ;; rD/rS = r5 is preferred, efficient form.
10097 (define_expand "movmemsi_6reg"
10098 [(parallel [(set (match_operand 0 "" "")
10099 (match_operand 1 "" ""))
10100 (use (match_operand 2 "" ""))
10101 (use (match_operand 3 "" ""))
10102 (clobber (reg:SI 5))
10103 (clobber (reg:SI 6))
10104 (clobber (reg:SI 7))
10105 (clobber (reg:SI 8))
10106 (clobber (reg:SI 9))
10107 (clobber (reg:SI 10))
10108 (clobber (match_scratch:SI 4 ""))])]
10113 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
10114 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
10115 (use (match_operand:SI 2 "immediate_operand" "i"))
10116 (use (match_operand:SI 3 "immediate_operand" "i"))
10117 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10118 (clobber (reg:SI 6))
10119 (clobber (reg:SI 7))
10120 (clobber (reg:SI 8))
10121 (clobber (reg:SI 9))
10122 (clobber (reg:SI 10))
10123 (clobber (match_scratch:SI 5 "=X"))]
10125 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
10126 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
10127 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
10128 && REGNO (operands[4]) == 5"
10129 "lswi %4,%1,%2\;stswi %4,%0,%2"
10130 [(set_attr "type" "store_ux")
10131 (set_attr "cell_micro" "always")
10132 (set_attr "length" "8")])
10134 ;; Move up to 16 bytes at a time, using 4 fixed registers to avoid spill
10135 ;; problems with TImode.
10136 ;; rD/rS = r5 is preferred, efficient form.
10137 (define_expand "movmemsi_4reg"
10138 [(parallel [(set (match_operand 0 "" "")
10139 (match_operand 1 "" ""))
10140 (use (match_operand 2 "" ""))
10141 (use (match_operand 3 "" ""))
10142 (clobber (reg:SI 5))
10143 (clobber (reg:SI 6))
10144 (clobber (reg:SI 7))
10145 (clobber (reg:SI 8))
10146 (clobber (match_scratch:SI 4 ""))])]
10151 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
10152 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
10153 (use (match_operand:SI 2 "immediate_operand" "i"))
10154 (use (match_operand:SI 3 "immediate_operand" "i"))
10155 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10156 (clobber (reg:SI 6))
10157 (clobber (reg:SI 7))
10158 (clobber (reg:SI 8))
10159 (clobber (match_scratch:SI 5 "=X"))]
10161 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
10162 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
10163 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
10164 && REGNO (operands[4]) == 5"
10165 "lswi %4,%1,%2\;stswi %4,%0,%2"
10166 [(set_attr "type" "store_ux")
10167 (set_attr "cell_micro" "always")
10168 (set_attr "length" "8")])
10170 ;; Move up to 8 bytes at a time.
10171 (define_expand "movmemsi_2reg"
10172 [(parallel [(set (match_operand 0 "" "")
10173 (match_operand 1 "" ""))
10174 (use (match_operand 2 "" ""))
10175 (use (match_operand 3 "" ""))
10176 (clobber (match_scratch:DI 4 ""))
10177 (clobber (match_scratch:SI 5 ""))])]
10178 "TARGET_STRING && ! TARGET_POWERPC64"
10182 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
10183 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
10184 (use (match_operand:SI 2 "immediate_operand" "i"))
10185 (use (match_operand:SI 3 "immediate_operand" "i"))
10186 (clobber (match_scratch:DI 4 "=&r"))
10187 (clobber (match_scratch:SI 5 "=X"))]
10188 "TARGET_STRING && ! TARGET_POWERPC64
10189 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
10190 "lswi %4,%1,%2\;stswi %4,%0,%2"
10191 [(set_attr "type" "store_ux")
10192 (set_attr "cell_micro" "always")
10193 (set_attr "length" "8")])
10195 ;; Move up to 4 bytes at a time.
10196 (define_expand "movmemsi_1reg"
10197 [(parallel [(set (match_operand 0 "" "")
10198 (match_operand 1 "" ""))
10199 (use (match_operand 2 "" ""))
10200 (use (match_operand 3 "" ""))
10201 (clobber (match_scratch:SI 4 ""))
10202 (clobber (match_scratch:SI 5 ""))])]
10207 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
10208 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
10209 (use (match_operand:SI 2 "immediate_operand" "i"))
10210 (use (match_operand:SI 3 "immediate_operand" "i"))
10211 (clobber (match_scratch:SI 4 "=&r"))
10212 (clobber (match_scratch:SI 5 "=X"))]
10213 "TARGET_STRING && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
10214 "lswi %4,%1,%2\;stswi %4,%0,%2"
10215 [(set_attr "type" "store_ux")
10216 (set_attr "cell_micro" "always")
10217 (set_attr "length" "8")])
10219 ;; Define insns that do load or store with update. Some of these we can
10220 ;; get by using pre-decrement or pre-increment, but the hardware can also
10221 ;; do cases where the increment is not the size of the object.
10223 ;; In all these cases, we use operands 0 and 1 for the register being
10224 ;; incremented because those are the operands that local-alloc will
10225 ;; tie and these are the pair most likely to be tieable (and the ones
10226 ;; that will benefit the most).
10228 (define_insn "*movdi_update1"
10229 [(set (match_operand:DI 3 "gpc_reg_operand" "=r,r")
10230 (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
10231 (match_operand:DI 2 "reg_or_aligned_short_operand" "r,I"))))
10232 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
10233 (plus:DI (match_dup 1) (match_dup 2)))]
10234 "TARGET_POWERPC64 && TARGET_UPDATE
10235 && (!avoiding_indexed_address_p (DImode)
10236 || !gpc_reg_operand (operands[2], DImode))"
10240 [(set_attr "type" "load_ux,load_u")])
10242 (define_insn "movdi_<mode>_update"
10243 [(set (mem:DI (plus:P (match_operand:P 1 "gpc_reg_operand" "0,0")
10244 (match_operand:P 2 "reg_or_aligned_short_operand" "r,I")))
10245 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
10246 (set (match_operand:P 0 "gpc_reg_operand" "=b,b")
10247 (plus:P (match_dup 1) (match_dup 2)))]
10248 "TARGET_POWERPC64 && TARGET_UPDATE
10249 && (!avoiding_indexed_address_p (Pmode)
10250 || !gpc_reg_operand (operands[2], Pmode)
10251 || (REG_P (operands[0])
10252 && REGNO (operands[0]) == STACK_POINTER_REGNUM))"
10256 [(set_attr "type" "store_ux,store_u")])
10258 ;; This pattern is only conditional on TARGET_POWERPC64, as it is
10259 ;; needed for stack allocation, even if the user passes -mno-update.
10260 (define_insn "movdi_<mode>_update_stack"
10261 [(set (mem:DI (plus:P (match_operand:P 1 "gpc_reg_operand" "0,0")
10262 (match_operand:P 2 "reg_or_aligned_short_operand" "r,I")))
10263 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
10264 (set (match_operand:P 0 "gpc_reg_operand" "=b,b")
10265 (plus:P (match_dup 1) (match_dup 2)))]
10270 [(set_attr "type" "store_ux,store_u")])
10272 (define_insn "*movsi_update1"
10273 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
10274 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10275 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10276 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10277 (plus:SI (match_dup 1) (match_dup 2)))]
10279 && (!avoiding_indexed_address_p (SImode)
10280 || !gpc_reg_operand (operands[2], SImode))"
10284 [(set_attr "type" "load_ux,load_u")])
10286 (define_insn "*movsi_update2"
10287 [(set (match_operand:DI 3 "gpc_reg_operand" "=r")
10289 (mem:SI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0")
10290 (match_operand:DI 2 "gpc_reg_operand" "r")))))
10291 (set (match_operand:DI 0 "gpc_reg_operand" "=b")
10292 (plus:DI (match_dup 1) (match_dup 2)))]
10293 "TARGET_POWERPC64 && rs6000_gen_cell_microcode
10294 && !avoiding_indexed_address_p (DImode)"
10296 [(set_attr "type" "load_ext_ux")])
10298 (define_insn "movsi_update"
10299 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10300 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10301 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
10302 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10303 (plus:SI (match_dup 1) (match_dup 2)))]
10305 && (!avoiding_indexed_address_p (SImode)
10306 || !gpc_reg_operand (operands[2], SImode)
10307 || (REG_P (operands[0])
10308 && REGNO (operands[0]) == STACK_POINTER_REGNUM))"
10312 [(set_attr "type" "store_ux,store_u")])
10314 ;; This is an unconditional pattern; needed for stack allocation, even
10315 ;; if the user passes -mno-update.
10316 (define_insn "movsi_update_stack"
10317 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10318 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10319 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
10320 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10321 (plus:SI (match_dup 1) (match_dup 2)))]
10326 [(set_attr "type" "store_ux,store_u")])
10328 (define_insn "*movhi_update1"
10329 [(set (match_operand:HI 3 "gpc_reg_operand" "=r,r")
10330 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10331 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10332 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10333 (plus:SI (match_dup 1) (match_dup 2)))]
10335 && (!avoiding_indexed_address_p (SImode)
10336 || !gpc_reg_operand (operands[2], SImode))"
10340 [(set_attr "type" "load_ux,load_u")])
10342 (define_insn "*movhi_update2"
10343 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
10345 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10346 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
10347 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10348 (plus:SI (match_dup 1) (match_dup 2)))]
10350 && (!avoiding_indexed_address_p (SImode)
10351 || !gpc_reg_operand (operands[2], SImode))"
10355 [(set_attr "type" "load_ux,load_u")])
10357 (define_insn "*movhi_update3"
10358 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
10360 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10361 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
10362 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10363 (plus:SI (match_dup 1) (match_dup 2)))]
10364 "TARGET_UPDATE && rs6000_gen_cell_microcode
10365 && (!avoiding_indexed_address_p (SImode)
10366 || !gpc_reg_operand (operands[2], SImode))"
10370 [(set_attr "type" "load_ext_ux,load_ext_u")])
10372 (define_insn "*movhi_update4"
10373 [(set (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10374 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10375 (match_operand:HI 3 "gpc_reg_operand" "r,r"))
10376 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10377 (plus:SI (match_dup 1) (match_dup 2)))]
10379 && (!avoiding_indexed_address_p (SImode)
10380 || !gpc_reg_operand (operands[2], SImode))"
10384 [(set_attr "type" "store_ux,store_u")])
10386 (define_insn "*movqi_update1"
10387 [(set (match_operand:QI 3 "gpc_reg_operand" "=r,r")
10388 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10389 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10390 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10391 (plus:SI (match_dup 1) (match_dup 2)))]
10393 && (!avoiding_indexed_address_p (SImode)
10394 || !gpc_reg_operand (operands[2], SImode))"
10398 [(set_attr "type" "load_ux,load_u")])
10400 (define_insn "*movqi_update2"
10401 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
10403 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10404 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
10405 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10406 (plus:SI (match_dup 1) (match_dup 2)))]
10408 && (!avoiding_indexed_address_p (SImode)
10409 || !gpc_reg_operand (operands[2], SImode))"
10413 [(set_attr "type" "load_ux,load_u")])
10415 (define_insn "*movqi_update3"
10416 [(set (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10417 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10418 (match_operand:QI 3 "gpc_reg_operand" "r,r"))
10419 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10420 (plus:SI (match_dup 1) (match_dup 2)))]
10422 && (!avoiding_indexed_address_p (SImode)
10423 || !gpc_reg_operand (operands[2], SImode))"
10427 [(set_attr "type" "store_ux,store_u")])
10429 (define_insn "*movsf_update1"
10430 [(set (match_operand:SF 3 "gpc_reg_operand" "=f,f")
10431 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10432 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10433 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10434 (plus:SI (match_dup 1) (match_dup 2)))]
10435 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT && TARGET_UPDATE
10436 && (!avoiding_indexed_address_p (SImode)
10437 || !gpc_reg_operand (operands[2], SImode))"
10441 [(set_attr "type" "fpload_ux,fpload_u")])
10443 (define_insn "*movsf_update2"
10444 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10445 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10446 (match_operand:SF 3 "gpc_reg_operand" "f,f"))
10447 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10448 (plus:SI (match_dup 1) (match_dup 2)))]
10449 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT && TARGET_UPDATE
10450 && (!avoiding_indexed_address_p (SImode)
10451 || !gpc_reg_operand (operands[2], SImode))"
10455 [(set_attr "type" "fpstore_ux,fpstore_u")])
10457 (define_insn "*movsf_update3"
10458 [(set (match_operand:SF 3 "gpc_reg_operand" "=r,r")
10459 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10460 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10461 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10462 (plus:SI (match_dup 1) (match_dup 2)))]
10463 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE
10464 && (!avoiding_indexed_address_p (SImode)
10465 || !gpc_reg_operand (operands[2], SImode))"
10469 [(set_attr "type" "load_ux,load_u")])
10471 (define_insn "*movsf_update4"
10472 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10473 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10474 (match_operand:SF 3 "gpc_reg_operand" "r,r"))
10475 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10476 (plus:SI (match_dup 1) (match_dup 2)))]
10477 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE
10478 && (!avoiding_indexed_address_p (SImode)
10479 || !gpc_reg_operand (operands[2], SImode))"
10483 [(set_attr "type" "store_ux,store_u")])
10485 (define_insn "*movdf_update1"
10486 [(set (match_operand:DF 3 "gpc_reg_operand" "=d,d")
10487 (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10488 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10489 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10490 (plus:SI (match_dup 1) (match_dup 2)))]
10491 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_UPDATE
10492 && (!avoiding_indexed_address_p (SImode)
10493 || !gpc_reg_operand (operands[2], SImode))"
10497 [(set_attr "type" "fpload_ux,fpload_u")])
10499 (define_insn "*movdf_update2"
10500 [(set (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10501 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10502 (match_operand:DF 3 "gpc_reg_operand" "d,d"))
10503 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10504 (plus:SI (match_dup 1) (match_dup 2)))]
10505 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_UPDATE
10506 && (!avoiding_indexed_address_p (SImode)
10507 || !gpc_reg_operand (operands[2], SImode))"
10511 [(set_attr "type" "fpstore_ux,fpstore_u")])
10514 ;; After inserting conditional returns we can sometimes have
10515 ;; unnecessary register moves. Unfortunately we cannot have a
10516 ;; modeless peephole here, because some single SImode sets have early
10517 ;; clobber outputs. Although those sets expand to multi-ppc-insn
10518 ;; sequences, using get_attr_length here will smash the operands
10519 ;; array. Neither is there an early_cobbler_p predicate.
10520 ;; Disallow subregs for E500 so we don't munge frob_di_df_2.
10522 [(set (match_operand:DF 0 "gpc_reg_operand" "")
10523 (match_operand:DF 1 "any_operand" ""))
10524 (set (match_operand:DF 2 "gpc_reg_operand" "")
10526 "!(TARGET_E500_DOUBLE && GET_CODE (operands[2]) == SUBREG)
10527 && peep2_reg_dead_p (2, operands[0])"
10528 [(set (match_dup 2) (match_dup 1))])
10531 [(set (match_operand:SF 0 "gpc_reg_operand" "")
10532 (match_operand:SF 1 "any_operand" ""))
10533 (set (match_operand:SF 2 "gpc_reg_operand" "")
10535 "peep2_reg_dead_p (2, operands[0])"
10536 [(set (match_dup 2) (match_dup 1))])
10541 ;; Mode attributes for different ABIs.
10542 (define_mode_iterator TLSmode [(SI "! TARGET_64BIT") (DI "TARGET_64BIT")])
10543 (define_mode_attr tls_abi_suffix [(SI "32") (DI "64")])
10544 (define_mode_attr tls_sysv_suffix [(SI "si") (DI "di")])
10545 (define_mode_attr tls_insn_suffix [(SI "wz") (DI "d")])
10547 (define_insn_and_split "tls_gd_aix<TLSmode:tls_abi_suffix>"
10548 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10549 (call (mem:TLSmode (match_operand:TLSmode 3 "symbol_ref_operand" "s"))
10550 (match_operand 4 "" "g")))
10551 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10552 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10554 (clobber (reg:SI LR_REGNO))]
10555 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX"
10557 if (TARGET_CMODEL != CMODEL_SMALL)
10558 return "addis %0,%1,%2@got@tlsgd@ha\;addi %0,%0,%2@got@tlsgd@l\;"
10561 return "addi %0,%1,%2@got@tlsgd\;bl %z3\;nop";
10563 "&& TARGET_TLS_MARKERS"
10564 [(set (match_dup 0)
10565 (unspec:TLSmode [(match_dup 1)
10568 (parallel [(set (match_dup 0)
10569 (call (mem:TLSmode (match_dup 3))
10571 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD)
10572 (clobber (reg:SI LR_REGNO))])]
10574 [(set_attr "type" "two")
10575 (set (attr "length")
10576 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
10580 (define_insn_and_split "tls_gd_sysv<TLSmode:tls_sysv_suffix>"
10581 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10582 (call (mem:TLSmode (match_operand:TLSmode 3 "symbol_ref_operand" "s"))
10583 (match_operand 4 "" "g")))
10584 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10585 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10587 (clobber (reg:SI LR_REGNO))]
10588 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4"
10592 if (TARGET_SECURE_PLT && flag_pic == 2)
10593 return "addi %0,%1,%2@got@tlsgd\;bl %z3+32768@plt";
10595 return "addi %0,%1,%2@got@tlsgd\;bl %z3@plt";
10598 return "addi %0,%1,%2@got@tlsgd\;bl %z3";
10600 "&& TARGET_TLS_MARKERS"
10601 [(set (match_dup 0)
10602 (unspec:TLSmode [(match_dup 1)
10605 (parallel [(set (match_dup 0)
10606 (call (mem:TLSmode (match_dup 3))
10608 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD)
10609 (clobber (reg:SI LR_REGNO))])]
10611 [(set_attr "type" "two")
10612 (set_attr "length" "8")])
10614 (define_insn_and_split "*tls_gd<TLSmode:tls_abi_suffix>"
10615 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10616 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10617 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10619 "HAVE_AS_TLS && TARGET_TLS_MARKERS"
10620 "addi %0,%1,%2@got@tlsgd"
10621 "&& TARGET_CMODEL != CMODEL_SMALL"
10622 [(set (match_dup 3)
10624 (unspec:TLSmode [(match_dup 1) (match_dup 2)] UNSPEC_TLSGD)))
10626 (lo_sum:TLSmode (match_dup 3)
10627 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD)))]
10630 operands[3] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
10632 [(set (attr "length")
10633 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
10637 (define_insn "*tls_gd_high<TLSmode:tls_abi_suffix>"
10638 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10640 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10641 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10643 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
10644 "addis %0,%1,%2@got@tlsgd@ha"
10645 [(set_attr "length" "4")])
10647 (define_insn "*tls_gd_low<TLSmode:tls_abi_suffix>"
10648 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10649 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
10650 (unspec:TLSmode [(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10652 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
10653 "addi %0,%1,%2@got@tlsgd@l"
10654 [(set_attr "length" "4")])
10656 (define_insn "*tls_gd_call_aix<TLSmode:tls_abi_suffix>"
10657 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10658 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
10659 (match_operand 2 "" "g")))
10660 (unspec:TLSmode [(match_operand:TLSmode 3 "rs6000_tls_symbol_ref" "")]
10662 (clobber (reg:SI LR_REGNO))]
10663 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX && TARGET_TLS_MARKERS"
10664 "bl %z1(%3@tlsgd)\;nop"
10665 [(set_attr "type" "branch")
10666 (set_attr "length" "8")])
10668 (define_insn "*tls_gd_call_sysv<TLSmode:tls_abi_suffix>"
10669 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10670 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
10671 (match_operand 2 "" "g")))
10672 (unspec:TLSmode [(match_operand:TLSmode 3 "rs6000_tls_symbol_ref" "")]
10674 (clobber (reg:SI LR_REGNO))]
10675 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4 && TARGET_TLS_MARKERS"
10679 if (TARGET_SECURE_PLT && flag_pic == 2)
10680 return "bl %z1+32768(%3@tlsgd)@plt";
10681 return "bl %z1(%3@tlsgd)@plt";
10683 return "bl %z1(%3@tlsgd)";
10685 [(set_attr "type" "branch")
10686 (set_attr "length" "4")])
10688 (define_insn_and_split "tls_ld_aix<TLSmode:tls_abi_suffix>"
10689 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10690 (call (mem:TLSmode (match_operand:TLSmode 2 "symbol_ref_operand" "s"))
10691 (match_operand 3 "" "g")))
10692 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
10694 (clobber (reg:SI LR_REGNO))]
10695 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX"
10697 if (TARGET_CMODEL != CMODEL_SMALL)
10698 return "addis %0,%1,%&@got@tlsld@ha\;addi %0,%0,%&@got@tlsld@l\;"
10701 return "addi %0,%1,%&@got@tlsld\;bl %z2\;nop";
10703 "&& TARGET_TLS_MARKERS"
10704 [(set (match_dup 0)
10705 (unspec:TLSmode [(match_dup 1)]
10707 (parallel [(set (match_dup 0)
10708 (call (mem:TLSmode (match_dup 2))
10710 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
10711 (clobber (reg:SI LR_REGNO))])]
10713 [(set_attr "type" "two")
10714 (set (attr "length")
10715 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
10719 (define_insn_and_split "tls_ld_sysv<TLSmode:tls_sysv_suffix>"
10720 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10721 (call (mem:TLSmode (match_operand:TLSmode 2 "symbol_ref_operand" "s"))
10722 (match_operand 3 "" "g")))
10723 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
10725 (clobber (reg:SI LR_REGNO))]
10726 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4"
10730 if (TARGET_SECURE_PLT && flag_pic == 2)
10731 return "addi %0,%1,%&@got@tlsld\;bl %z2+32768@plt";
10733 return "addi %0,%1,%&@got@tlsld\;bl %z2@plt";
10736 return "addi %0,%1,%&@got@tlsld\;bl %z2";
10738 "&& TARGET_TLS_MARKERS"
10739 [(set (match_dup 0)
10740 (unspec:TLSmode [(match_dup 1)]
10742 (parallel [(set (match_dup 0)
10743 (call (mem:TLSmode (match_dup 2))
10745 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
10746 (clobber (reg:SI LR_REGNO))])]
10748 [(set_attr "length" "8")])
10750 (define_insn_and_split "*tls_ld<TLSmode:tls_abi_suffix>"
10751 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10752 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
10754 "HAVE_AS_TLS && TARGET_TLS_MARKERS"
10755 "addi %0,%1,%&@got@tlsld"
10756 "&& TARGET_CMODEL != CMODEL_SMALL"
10757 [(set (match_dup 2)
10759 (unspec:TLSmode [(const_int 0) (match_dup 1)] UNSPEC_TLSLD)))
10761 (lo_sum:TLSmode (match_dup 2)
10762 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)))]
10765 operands[2] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
10767 [(set (attr "length")
10768 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
10772 (define_insn "*tls_ld_high<TLSmode:tls_abi_suffix>"
10773 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10775 (unspec:TLSmode [(const_int 0)
10776 (match_operand:TLSmode 1 "gpc_reg_operand" "b")]
10778 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
10779 "addis %0,%1,%&@got@tlsld@ha"
10780 [(set_attr "length" "4")])
10782 (define_insn "*tls_ld_low<TLSmode:tls_abi_suffix>"
10783 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10784 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
10785 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)))]
10786 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
10787 "addi %0,%1,%&@got@tlsld@l"
10788 [(set_attr "length" "4")])
10790 (define_insn "*tls_ld_call_aix<TLSmode:tls_abi_suffix>"
10791 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10792 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
10793 (match_operand 2 "" "g")))
10794 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
10795 (clobber (reg:SI LR_REGNO))]
10796 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX && TARGET_TLS_MARKERS"
10797 "bl %z1(%&@tlsld)\;nop"
10798 [(set_attr "type" "branch")
10799 (set_attr "length" "8")])
10801 (define_insn "*tls_ld_call_sysv<TLSmode:tls_abi_suffix>"
10802 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10803 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
10804 (match_operand 2 "" "g")))
10805 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
10806 (clobber (reg:SI LR_REGNO))]
10807 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4 && TARGET_TLS_MARKERS"
10811 if (TARGET_SECURE_PLT && flag_pic == 2)
10812 return "bl %z1+32768(%&@tlsld)@plt";
10813 return "bl %z1(%&@tlsld)@plt";
10815 return "bl %z1(%&@tlsld)";
10817 [(set_attr "type" "branch")
10818 (set_attr "length" "4")])
10820 (define_insn "tls_dtprel_<TLSmode:tls_abi_suffix>"
10821 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
10822 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10823 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10824 UNSPEC_TLSDTPREL))]
10826 "addi %0,%1,%2@dtprel")
10828 (define_insn "tls_dtprel_ha_<TLSmode:tls_abi_suffix>"
10829 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
10830 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10831 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10832 UNSPEC_TLSDTPRELHA))]
10834 "addis %0,%1,%2@dtprel@ha")
10836 (define_insn "tls_dtprel_lo_<TLSmode:tls_abi_suffix>"
10837 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
10838 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10839 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10840 UNSPEC_TLSDTPRELLO))]
10842 "addi %0,%1,%2@dtprel@l")
10844 (define_insn_and_split "tls_got_dtprel_<TLSmode:tls_abi_suffix>"
10845 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
10846 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10847 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10848 UNSPEC_TLSGOTDTPREL))]
10850 "l<TLSmode:tls_insn_suffix> %0,%2@got@dtprel(%1)"
10851 "&& TARGET_CMODEL != CMODEL_SMALL"
10852 [(set (match_dup 3)
10854 (unspec:TLSmode [(match_dup 1) (match_dup 2)] UNSPEC_TLSGOTDTPREL)))
10856 (lo_sum:TLSmode (match_dup 3)
10857 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGOTDTPREL)))]
10860 operands[3] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
10862 [(set (attr "length")
10863 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
10867 (define_insn "*tls_got_dtprel_high<TLSmode:tls_abi_suffix>"
10868 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10870 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10871 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10872 UNSPEC_TLSGOTDTPREL)))]
10873 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
10874 "addis %0,%1,%2@got@dtprel@ha"
10875 [(set_attr "length" "4")])
10877 (define_insn "*tls_got_dtprel_low<TLSmode:tls_abi_suffix>"
10878 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
10879 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
10880 (unspec:TLSmode [(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10881 UNSPEC_TLSGOTDTPREL)))]
10882 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
10883 "l<TLSmode:tls_insn_suffix> %0,%2@got@dtprel@l(%1)"
10884 [(set_attr "length" "4")])
10886 (define_insn "tls_tprel_<TLSmode:tls_abi_suffix>"
10887 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
10888 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10889 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10892 "addi %0,%1,%2@tprel")
10894 (define_insn "tls_tprel_ha_<TLSmode:tls_abi_suffix>"
10895 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
10896 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10897 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10898 UNSPEC_TLSTPRELHA))]
10900 "addis %0,%1,%2@tprel@ha")
10902 (define_insn "tls_tprel_lo_<TLSmode:tls_abi_suffix>"
10903 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
10904 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10905 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10906 UNSPEC_TLSTPRELLO))]
10908 "addi %0,%1,%2@tprel@l")
10910 ;; "b" output constraint here and on tls_tls input to support linker tls
10911 ;; optimization. The linker may edit the instructions emitted by a
10912 ;; tls_got_tprel/tls_tls pair to addis,addi.
10913 (define_insn_and_split "tls_got_tprel_<TLSmode:tls_abi_suffix>"
10914 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10915 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10916 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10917 UNSPEC_TLSGOTTPREL))]
10919 "l<TLSmode:tls_insn_suffix> %0,%2@got@tprel(%1)"
10920 "&& TARGET_CMODEL != CMODEL_SMALL"
10921 [(set (match_dup 3)
10923 (unspec:TLSmode [(match_dup 1) (match_dup 2)] UNSPEC_TLSGOTTPREL)))
10925 (lo_sum:TLSmode (match_dup 3)
10926 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGOTTPREL)))]
10929 operands[3] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
10931 [(set (attr "length")
10932 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
10936 (define_insn "*tls_got_tprel_high<TLSmode:tls_abi_suffix>"
10937 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10939 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10940 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10941 UNSPEC_TLSGOTTPREL)))]
10942 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
10943 "addis %0,%1,%2@got@tprel@ha"
10944 [(set_attr "length" "4")])
10946 (define_insn "*tls_got_tprel_low<TLSmode:tls_abi_suffix>"
10947 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
10948 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
10949 (unspec:TLSmode [(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10950 UNSPEC_TLSGOTTPREL)))]
10951 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
10952 "l<TLSmode:tls_insn_suffix> %0,%2@got@tprel@l(%1)"
10953 [(set_attr "length" "4")])
10955 (define_insn "tls_tls_<TLSmode:tls_abi_suffix>"
10956 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
10957 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10958 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10960 "TARGET_ELF && HAVE_AS_TLS"
10961 "add %0,%1,%2@tls")
10963 (define_expand "tls_get_tpointer"
10964 [(set (match_operand:SI 0 "gpc_reg_operand" "")
10965 (unspec:SI [(const_int 0)] UNSPEC_TLSTLS))]
10966 "TARGET_XCOFF && HAVE_AS_TLS"
10969 emit_insn (gen_tls_get_tpointer_internal ());
10970 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
10974 (define_insn "tls_get_tpointer_internal"
10976 (unspec:SI [(const_int 0)] UNSPEC_TLSTLS))
10977 (clobber (reg:SI LR_REGNO))]
10978 "TARGET_XCOFF && HAVE_AS_TLS"
10979 "bla __get_tpointer")
10981 (define_expand "tls_get_addr<mode>"
10982 [(set (match_operand:P 0 "gpc_reg_operand" "")
10983 (unspec:P [(match_operand:P 1 "gpc_reg_operand" "")
10984 (match_operand:P 2 "gpc_reg_operand" "")] UNSPEC_TLSTLS))]
10985 "TARGET_XCOFF && HAVE_AS_TLS"
10988 emit_move_insn (gen_rtx_REG (Pmode, 3), operands[1]);
10989 emit_move_insn (gen_rtx_REG (Pmode, 4), operands[2]);
10990 emit_insn (gen_tls_get_addr_internal<mode> ());
10991 emit_move_insn (operands[0], gen_rtx_REG (Pmode, 3));
10995 (define_insn "tls_get_addr_internal<mode>"
10997 (unspec:P [(reg:P 3) (reg:P 4)] UNSPEC_TLSTLS))
10998 (clobber (reg:P 0))
10999 (clobber (reg:P 4))
11000 (clobber (reg:P 5))
11001 (clobber (reg:P 11))
11002 (clobber (reg:CC CR0_REGNO))
11003 (clobber (reg:P LR_REGNO))]
11004 "TARGET_XCOFF && HAVE_AS_TLS"
11005 "bla __tls_get_addr")
11007 ;; Next come insns related to the calling sequence.
11009 ;; First, an insn to allocate new stack space for dynamic use (e.g., alloca).
11010 ;; We move the back-chain and decrement the stack pointer.
11012 (define_expand "allocate_stack"
11013 [(set (match_operand 0 "gpc_reg_operand" "")
11014 (minus (reg 1) (match_operand 1 "reg_or_short_operand" "")))
11016 (minus (reg 1) (match_dup 1)))]
11019 { rtx chain = gen_reg_rtx (Pmode);
11020 rtx stack_bot = gen_rtx_MEM (Pmode, stack_pointer_rtx);
11022 rtx insn, par, set, mem;
11024 emit_move_insn (chain, stack_bot);
11026 /* Check stack bounds if necessary. */
11027 if (crtl->limit_stack)
11030 available = expand_binop (Pmode, sub_optab,
11031 stack_pointer_rtx, stack_limit_rtx,
11032 NULL_RTX, 1, OPTAB_WIDEN);
11033 emit_insn (gen_cond_trap (LTU, available, operands[1], const0_rtx));
11036 if (GET_CODE (operands[1]) != CONST_INT
11037 || INTVAL (operands[1]) < -32767
11038 || INTVAL (operands[1]) > 32768)
11040 neg_op0 = gen_reg_rtx (Pmode);
11042 emit_insn (gen_negsi2 (neg_op0, operands[1]));
11044 emit_insn (gen_negdi2 (neg_op0, operands[1]));
11047 neg_op0 = GEN_INT (- INTVAL (operands[1]));
11049 insn = emit_insn ((* ((TARGET_32BIT) ? gen_movsi_update_stack
11050 : gen_movdi_di_update_stack))
11051 (stack_pointer_rtx, stack_pointer_rtx, neg_op0,
11053 /* Since we didn't use gen_frame_mem to generate the MEM, grab
11054 it now and set the alias set/attributes. The above gen_*_update
11055 calls will generate a PARALLEL with the MEM set being the first
11057 par = PATTERN (insn);
11058 gcc_assert (GET_CODE (par) == PARALLEL);
11059 set = XVECEXP (par, 0, 0);
11060 gcc_assert (GET_CODE (set) == SET);
11061 mem = SET_DEST (set);
11062 gcc_assert (MEM_P (mem));
11063 MEM_NOTRAP_P (mem) = 1;
11064 set_mem_alias_set (mem, get_frame_alias_set ());
11066 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
11070 ;; These patterns say how to save and restore the stack pointer. We need not
11071 ;; save the stack pointer at function level since we are careful to
11072 ;; preserve the backchain. At block level, we have to restore the backchain
11073 ;; when we restore the stack pointer.
11075 ;; For nonlocal gotos, we must save both the stack pointer and its
11076 ;; backchain and restore both. Note that in the nonlocal case, the
11077 ;; save area is a memory location.
11079 (define_expand "save_stack_function"
11080 [(match_operand 0 "any_operand" "")
11081 (match_operand 1 "any_operand" "")]
11085 (define_expand "restore_stack_function"
11086 [(match_operand 0 "any_operand" "")
11087 (match_operand 1 "any_operand" "")]
11091 ;; Adjust stack pointer (op0) to a new value (op1).
11092 ;; First copy old stack backchain to new location, and ensure that the
11093 ;; scheduler won't reorder the sp assignment before the backchain write.
11094 (define_expand "restore_stack_block"
11095 [(set (match_dup 2) (match_dup 3))
11096 (set (match_dup 4) (match_dup 2))
11098 (set (match_operand 0 "register_operand" "")
11099 (match_operand 1 "register_operand" ""))]
11105 operands[1] = force_reg (Pmode, operands[1]);
11106 operands[2] = gen_reg_rtx (Pmode);
11107 operands[3] = gen_frame_mem (Pmode, operands[0]);
11108 operands[4] = gen_frame_mem (Pmode, operands[1]);
11109 p = rtvec_alloc (1);
11110 RTVEC_ELT (p, 0) = gen_rtx_SET (VOIDmode,
11111 gen_frame_mem (BLKmode, operands[0]),
11113 operands[5] = gen_rtx_PARALLEL (VOIDmode, p);
11116 (define_expand "save_stack_nonlocal"
11117 [(set (match_dup 3) (match_dup 4))
11118 (set (match_operand 0 "memory_operand" "") (match_dup 3))
11119 (set (match_dup 2) (match_operand 1 "register_operand" ""))]
11123 int units_per_word = (TARGET_32BIT) ? 4 : 8;
11125 /* Copy the backchain to the first word, sp to the second. */
11126 operands[0] = adjust_address_nv (operands[0], Pmode, 0);
11127 operands[2] = adjust_address_nv (operands[0], Pmode, units_per_word);
11128 operands[3] = gen_reg_rtx (Pmode);
11129 operands[4] = gen_frame_mem (Pmode, operands[1]);
11132 (define_expand "restore_stack_nonlocal"
11133 [(set (match_dup 2) (match_operand 1 "memory_operand" ""))
11134 (set (match_dup 3) (match_dup 4))
11135 (set (match_dup 5) (match_dup 2))
11137 (set (match_operand 0 "register_operand" "") (match_dup 3))]
11141 int units_per_word = (TARGET_32BIT) ? 4 : 8;
11144 /* Restore the backchain from the first word, sp from the second. */
11145 operands[2] = gen_reg_rtx (Pmode);
11146 operands[3] = gen_reg_rtx (Pmode);
11147 operands[1] = adjust_address_nv (operands[1], Pmode, 0);
11148 operands[4] = adjust_address_nv (operands[1], Pmode, units_per_word);
11149 operands[5] = gen_frame_mem (Pmode, operands[3]);
11150 p = rtvec_alloc (1);
11151 RTVEC_ELT (p, 0) = gen_rtx_SET (VOIDmode,
11152 gen_frame_mem (BLKmode, operands[0]),
11154 operands[6] = gen_rtx_PARALLEL (VOIDmode, p);
11157 ;; TOC register handling.
11159 ;; Code to initialize the TOC register...
11161 (define_insn "load_toc_aix_si"
11162 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11163 (unspec:SI [(const_int 0)] UNSPEC_TOC))
11164 (use (reg:SI 2))])]
11165 "DEFAULT_ABI == ABI_AIX && TARGET_32BIT"
11169 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
11170 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
11171 operands[2] = gen_rtx_REG (Pmode, 2);
11172 return \"lwz %0,%1(%2)\";
11174 [(set_attr "type" "load")])
11176 (define_insn "load_toc_aix_di"
11177 [(parallel [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11178 (unspec:DI [(const_int 0)] UNSPEC_TOC))
11179 (use (reg:DI 2))])]
11180 "DEFAULT_ABI == ABI_AIX && TARGET_64BIT"
11184 #ifdef TARGET_RELOCATABLE
11185 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\",
11186 !TARGET_MINIMAL_TOC || TARGET_RELOCATABLE);
11188 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
11191 strcat (buf, \"@toc\");
11192 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
11193 operands[2] = gen_rtx_REG (Pmode, 2);
11194 return \"ld %0,%1(%2)\";
11196 [(set_attr "type" "load")])
11198 (define_insn "load_toc_v4_pic_si"
11199 [(set (reg:SI LR_REGNO)
11200 (unspec:SI [(const_int 0)] UNSPEC_TOC))]
11201 "DEFAULT_ABI == ABI_V4 && flag_pic == 1 && TARGET_32BIT"
11202 "bl _GLOBAL_OFFSET_TABLE_@local-4"
11203 [(set_attr "type" "branch")
11204 (set_attr "length" "4")])
11206 (define_expand "load_toc_v4_PIC_1"
11207 [(parallel [(set (reg:SI LR_REGNO)
11208 (match_operand:SI 0 "immediate_operand" "s"))
11209 (use (unspec [(match_dup 0)] UNSPEC_TOC))])]
11210 "TARGET_ELF && DEFAULT_ABI != ABI_AIX
11211 && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
11214 (define_insn "load_toc_v4_PIC_1_normal"
11215 [(set (reg:SI LR_REGNO)
11216 (match_operand:SI 0 "immediate_operand" "s"))
11217 (use (unspec [(match_dup 0)] UNSPEC_TOC))]
11218 "!TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI != ABI_AIX
11219 && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
11220 "bcl 20,31,%0\\n%0:"
11221 [(set_attr "type" "branch")
11222 (set_attr "length" "4")])
11224 (define_insn "load_toc_v4_PIC_1_476"
11225 [(set (reg:SI LR_REGNO)
11226 (match_operand:SI 0 "immediate_operand" "s"))
11227 (use (unspec [(match_dup 0)] UNSPEC_TOC))]
11228 "TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI != ABI_AIX
11229 && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
11233 static char templ[32];
11235 get_ppc476_thunk_name (name);
11236 sprintf (templ, \"bl %s\\n%%0:\", name);
11239 [(set_attr "type" "branch")
11240 (set_attr "length" "4")])
11242 (define_expand "load_toc_v4_PIC_1b"
11243 [(parallel [(set (reg:SI LR_REGNO)
11244 (unspec:SI [(match_operand:SI 0 "immediate_operand" "s")
11245 (label_ref (match_operand 1 "" ""))]
11248 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
11251 (define_insn "load_toc_v4_PIC_1b_normal"
11252 [(set (reg:SI LR_REGNO)
11253 (unspec:SI [(match_operand:SI 0 "immediate_operand" "s")
11254 (label_ref (match_operand 1 "" ""))]
11257 "!TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
11258 "bcl 20,31,$+8\;.long %0-$"
11259 [(set_attr "type" "branch")
11260 (set_attr "length" "8")])
11262 (define_insn "load_toc_v4_PIC_1b_476"
11263 [(set (reg:SI LR_REGNO)
11264 (unspec:SI [(match_operand:SI 0 "immediate_operand" "s")
11265 (label_ref (match_operand 1 "" ""))]
11268 "TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
11272 static char templ[32];
11274 get_ppc476_thunk_name (name);
11275 sprintf (templ, \"bl %s\\n\\tb $+8\\n\\t.long %%0-$\", name);
11278 [(set_attr "type" "branch")
11279 (set_attr "length" "16")])
11281 (define_insn "load_toc_v4_PIC_2"
11282 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11283 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
11284 (minus:SI (match_operand:SI 2 "immediate_operand" "s")
11285 (match_operand:SI 3 "immediate_operand" "s")))))]
11286 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
11288 [(set_attr "type" "load")])
11290 (define_insn "load_toc_v4_PIC_3b"
11291 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11292 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
11294 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
11295 (match_operand:SI 3 "symbol_ref_operand" "s")))))]
11296 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
11297 "addis %0,%1,%2-%3@ha")
11299 (define_insn "load_toc_v4_PIC_3c"
11300 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11301 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
11302 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
11303 (match_operand:SI 3 "symbol_ref_operand" "s"))))]
11304 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
11305 "addi %0,%1,%2-%3@l")
11307 ;; If the TOC is shared over a translation unit, as happens with all
11308 ;; the kinds of PIC that we support, we need to restore the TOC
11309 ;; pointer only when jumping over units of translation.
11310 ;; On Darwin, we need to reload the picbase.
11312 (define_expand "builtin_setjmp_receiver"
11313 [(use (label_ref (match_operand 0 "" "")))]
11314 "(DEFAULT_ABI == ABI_V4 && flag_pic == 1)
11315 || (TARGET_TOC && TARGET_MINIMAL_TOC)
11316 || (DEFAULT_ABI == ABI_DARWIN && flag_pic)"
11320 if (DEFAULT_ABI == ABI_DARWIN)
11322 rtx picrtx = gen_rtx_SYMBOL_REF (Pmode, MACHOPIC_FUNCTION_BASE_NAME);
11323 rtx picreg = gen_rtx_REG (Pmode, RS6000_PIC_OFFSET_TABLE_REGNUM);
11327 crtl->uses_pic_offset_table = 1;
11328 ASM_GENERATE_INTERNAL_LABEL(tmplab, \"LSJR\",
11329 CODE_LABEL_NUMBER (operands[0]));
11330 tmplabrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (tmplab));
11332 emit_insn (gen_load_macho_picbase (tmplabrtx));
11333 emit_move_insn (picreg, gen_rtx_REG (Pmode, LR_REGNO));
11334 emit_insn (gen_macho_correct_pic (picreg, picreg, picrtx, tmplabrtx));
11338 rs6000_emit_load_toc_table (FALSE);
11342 ;; Largetoc support
11343 (define_insn "*largetoc_high"
11344 [(set (match_operand:DI 0 "gpc_reg_operand" "=b*r")
11346 (unspec [(match_operand:DI 1 "" "")
11347 (match_operand:DI 2 "gpc_reg_operand" "b")]
11349 "TARGET_ELF && TARGET_CMODEL != CMODEL_SMALL"
11350 "addis %0,%2,%1@toc@ha")
11352 (define_insn "*largetoc_high_aix<mode>"
11353 [(set (match_operand:P 0 "gpc_reg_operand" "=b*r")
11355 (unspec [(match_operand:P 1 "" "")
11356 (match_operand:P 2 "gpc_reg_operand" "b")]
11358 "TARGET_XCOFF && TARGET_CMODEL != CMODEL_SMALL"
11359 "addis %0,%1@u(%2)")
11361 (define_insn "*largetoc_high_plus"
11362 [(set (match_operand:DI 0 "gpc_reg_operand" "=b*r")
11365 (unspec [(match_operand:DI 1 "" "")
11366 (match_operand:DI 2 "gpc_reg_operand" "b")]
11368 (match_operand 3 "const_int_operand" "n"))))]
11369 "TARGET_ELF && TARGET_CMODEL != CMODEL_SMALL"
11370 "addis %0,%2,%1+%3@toc@ha")
11372 (define_insn "*largetoc_high_plus_aix<mode>"
11373 [(set (match_operand:P 0 "gpc_reg_operand" "=b*r")
11376 (unspec [(match_operand:P 1 "" "")
11377 (match_operand:P 2 "gpc_reg_operand" "b")]
11379 (match_operand 3 "const_int_operand" "n"))))]
11380 "TARGET_XCOFF && TARGET_CMODEL != CMODEL_SMALL"
11381 "addis %0,%1+%3@u(%2)")
11383 (define_insn "*largetoc_low"
11384 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
11385 (lo_sum:DI (match_operand:DI 1 "gpc_reg_operand" "b,!*r")
11386 (match_operand:DI 2 "" "")))]
11387 "TARGET_ELF && TARGET_CMODEL != CMODEL_SMALL"
11392 (define_insn "*largetoc_low_aix<mode>"
11393 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
11394 (lo_sum:P (match_operand:P 1 "gpc_reg_operand" "b")
11395 (match_operand:P 2 "" "")))]
11396 "TARGET_XCOFF && TARGET_CMODEL != CMODEL_SMALL"
11399 (define_insn_and_split "*tocref<mode>"
11400 [(set (match_operand:P 0 "gpc_reg_operand" "=b*r")
11401 (match_operand:P 1 "small_toc_ref" "R"))]
11404 "&& TARGET_CMODEL != CMODEL_SMALL && reload_completed"
11405 [(set (match_dup 0) (high:P (match_dup 1)))
11406 (set (match_dup 0) (lo_sum:P (match_dup 0) (match_dup 1)))])
11408 ;; Elf specific ways of loading addresses for non-PIC code.
11409 ;; The output of this could be r0, but we make a very strong
11410 ;; preference for a base register because it will usually
11411 ;; be needed there.
11412 (define_insn "elf_high"
11413 [(set (match_operand:SI 0 "gpc_reg_operand" "=b*r")
11414 (high:SI (match_operand 1 "" "")))]
11415 "TARGET_ELF && ! TARGET_64BIT"
11418 (define_insn "elf_low"
11419 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11420 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,!*r")
11421 (match_operand 2 "" "")))]
11422 "TARGET_ELF && ! TARGET_64BIT"
11427 ;; Call and call_value insns
11428 (define_expand "call"
11429 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
11430 (match_operand 1 "" ""))
11431 (use (match_operand 2 "" ""))
11432 (clobber (reg:SI LR_REGNO))])]
11437 if (MACHOPIC_INDIRECT)
11438 operands[0] = machopic_indirect_call_target (operands[0]);
11441 gcc_assert (GET_CODE (operands[0]) == MEM);
11442 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
11444 operands[0] = XEXP (operands[0], 0);
11446 if (GET_CODE (operands[0]) != SYMBOL_REF
11447 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[0]))
11448 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[2]) & CALL_LONG) != 0))
11450 if (INTVAL (operands[2]) & CALL_LONG)
11451 operands[0] = rs6000_longcall_ref (operands[0]);
11453 switch (DEFAULT_ABI)
11457 operands[0] = force_reg (Pmode, operands[0]);
11461 /* AIX function pointers are really pointers to a three word
11463 rs6000_call_indirect_aix (NULL_RTX, operands[0], operands[1]);
11467 gcc_unreachable ();
11472 (define_expand "call_value"
11473 [(parallel [(set (match_operand 0 "" "")
11474 (call (mem:SI (match_operand 1 "address_operand" ""))
11475 (match_operand 2 "" "")))
11476 (use (match_operand 3 "" ""))
11477 (clobber (reg:SI LR_REGNO))])]
11482 if (MACHOPIC_INDIRECT)
11483 operands[1] = machopic_indirect_call_target (operands[1]);
11486 gcc_assert (GET_CODE (operands[1]) == MEM);
11487 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
11489 operands[1] = XEXP (operands[1], 0);
11491 if (GET_CODE (operands[1]) != SYMBOL_REF
11492 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[1]))
11493 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[3]) & CALL_LONG) != 0))
11495 if (INTVAL (operands[3]) & CALL_LONG)
11496 operands[1] = rs6000_longcall_ref (operands[1]);
11498 switch (DEFAULT_ABI)
11502 operands[1] = force_reg (Pmode, operands[1]);
11506 /* AIX function pointers are really pointers to a three word
11508 rs6000_call_indirect_aix (operands[0], operands[1], operands[2]);
11512 gcc_unreachable ();
11517 ;; Call to function in current module. No TOC pointer reload needed.
11518 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
11519 ;; either the function was not prototyped, or it was prototyped as a
11520 ;; variable argument function. It is > 0 if FP registers were passed
11521 ;; and < 0 if they were not.
11523 (define_insn "*call_local32"
11524 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
11525 (match_operand 1 "" "g,g"))
11526 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11527 (clobber (reg:SI LR_REGNO))]
11528 "(INTVAL (operands[2]) & CALL_LONG) == 0"
11531 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11532 output_asm_insn (\"crxor 6,6,6\", operands);
11534 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11535 output_asm_insn (\"creqv 6,6,6\", operands);
11537 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
11539 [(set_attr "type" "branch")
11540 (set_attr "length" "4,8")])
11542 (define_insn "*call_local64"
11543 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
11544 (match_operand 1 "" "g,g"))
11545 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11546 (clobber (reg:SI LR_REGNO))]
11547 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
11550 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11551 output_asm_insn (\"crxor 6,6,6\", operands);
11553 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11554 output_asm_insn (\"creqv 6,6,6\", operands);
11556 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
11558 [(set_attr "type" "branch")
11559 (set_attr "length" "4,8")])
11561 (define_insn "*call_value_local32"
11562 [(set (match_operand 0 "" "")
11563 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
11564 (match_operand 2 "" "g,g")))
11565 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11566 (clobber (reg:SI LR_REGNO))]
11567 "(INTVAL (operands[3]) & CALL_LONG) == 0"
11570 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11571 output_asm_insn (\"crxor 6,6,6\", operands);
11573 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11574 output_asm_insn (\"creqv 6,6,6\", operands);
11576 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
11578 [(set_attr "type" "branch")
11579 (set_attr "length" "4,8")])
11582 (define_insn "*call_value_local64"
11583 [(set (match_operand 0 "" "")
11584 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
11585 (match_operand 2 "" "g,g")))
11586 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11587 (clobber (reg:SI LR_REGNO))]
11588 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
11591 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11592 output_asm_insn (\"crxor 6,6,6\", operands);
11594 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11595 output_asm_insn (\"creqv 6,6,6\", operands);
11597 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
11599 [(set_attr "type" "branch")
11600 (set_attr "length" "4,8")])
11602 ;; Call to indirect functions with the AIX abi using a 3 word descriptor.
11603 ;; Operand0 is the addresss of the function to call
11604 ;; Operand1 is the flag for System V.4 for unprototyped or FP registers
11605 ;; Operand2 is the location in the function descriptor to load r2 from
11606 ;; Operand3 is the stack location to hold the current TOC pointer
11608 (define_insn "call_indirect_aix<ptrsize>"
11609 [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l"))
11610 (match_operand 1 "" "g,g"))
11611 (use (match_operand:P 2 "memory_operand" "<ptrm>,<ptrm>"))
11612 (set (reg:P TOC_REGNUM) (match_operand:P 3 "memory_operand" "<ptrm>,<ptrm>"))
11613 (use (reg:P STATIC_CHAIN_REGNUM))
11614 (clobber (reg:P LR_REGNO))]
11615 "DEFAULT_ABI == ABI_AIX && TARGET_POINTERS_TO_NESTED_FUNCTIONS"
11616 "<ptrload> 2,%2\;b%T0l\;<ptrload> 2,%3"
11617 [(set_attr "type" "jmpreg")
11618 (set_attr "length" "12")])
11620 ;; Like call_indirect_aix<ptrsize>, but no use of the static chain
11621 ;; Operand0 is the addresss of the function to call
11622 ;; Operand1 is the flag for System V.4 for unprototyped or FP registers
11623 ;; Operand2 is the location in the function descriptor to load r2 from
11624 ;; Operand3 is the stack location to hold the current TOC pointer
11626 (define_insn "call_indirect_aix<ptrsize>_nor11"
11627 [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l"))
11628 (match_operand 1 "" "g,g"))
11629 (use (match_operand:P 2 "memory_operand" "<ptrm>,<ptrm>"))
11630 (set (reg:P TOC_REGNUM) (match_operand:P 3 "memory_operand" "<ptrm>,<ptrm>"))
11631 (clobber (reg:P LR_REGNO))]
11632 "DEFAULT_ABI == ABI_AIX && !TARGET_POINTERS_TO_NESTED_FUNCTIONS"
11633 "<ptrload> 2,%2\;b%T0l\;<ptrload> 2,%3"
11634 [(set_attr "type" "jmpreg")
11635 (set_attr "length" "12")])
11637 ;; Operand0 is the return result of the function
11638 ;; Operand1 is the addresss of the function to call
11639 ;; Operand2 is the flag for System V.4 for unprototyped or FP registers
11640 ;; Operand3 is the location in the function descriptor to load r2 from
11641 ;; Operand4 is the stack location to hold the current TOC pointer
11643 (define_insn "call_value_indirect_aix<ptrsize>"
11644 [(set (match_operand 0 "" "")
11645 (call (mem:SI (match_operand:P 1 "register_operand" "c,*l"))
11646 (match_operand 2 "" "g,g")))
11647 (use (match_operand:P 3 "memory_operand" "<ptrm>,<ptrm>"))
11648 (set (reg:P TOC_REGNUM) (match_operand:P 4 "memory_operand" "<ptrm>,<ptrm>"))
11649 (use (reg:P STATIC_CHAIN_REGNUM))
11650 (clobber (reg:P LR_REGNO))]
11651 "DEFAULT_ABI == ABI_AIX && TARGET_POINTERS_TO_NESTED_FUNCTIONS"
11652 "<ptrload> 2,%3\;b%T1l\;<ptrload> 2,%4"
11653 [(set_attr "type" "jmpreg")
11654 (set_attr "length" "12")])
11656 ;; Like call_value_indirect_aix<ptrsize>, but no use of the static chain
11657 ;; Operand0 is the return result of the function
11658 ;; Operand1 is the addresss of the function to call
11659 ;; Operand2 is the flag for System V.4 for unprototyped or FP registers
11660 ;; Operand3 is the location in the function descriptor to load r2 from
11661 ;; Operand4 is the stack location to hold the current TOC pointer
11663 (define_insn "call_value_indirect_aix<ptrsize>_nor11"
11664 [(set (match_operand 0 "" "")
11665 (call (mem:SI (match_operand:P 1 "register_operand" "c,*l"))
11666 (match_operand 2 "" "g,g")))
11667 (use (match_operand:P 3 "memory_operand" "<ptrm>,<ptrm>"))
11668 (set (reg:P TOC_REGNUM) (match_operand:P 4 "memory_operand" "<ptrm>,<ptrm>"))
11669 (clobber (reg:P LR_REGNO))]
11670 "DEFAULT_ABI == ABI_AIX && !TARGET_POINTERS_TO_NESTED_FUNCTIONS"
11671 "<ptrload> 2,%3\;b%T1l\;<ptrload> 2,%4"
11672 [(set_attr "type" "jmpreg")
11673 (set_attr "length" "12")])
11675 ;; Call to function which may be in another module. Restore the TOC
11676 ;; pointer (r2) after the call unless this is System V.
11677 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
11678 ;; either the function was not prototyped, or it was prototyped as a
11679 ;; variable argument function. It is > 0 if FP registers were passed
11680 ;; and < 0 if they were not.
11682 (define_insn "*call_nonlocal_aix32"
11683 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
11684 (match_operand 1 "" "g"))
11685 (use (match_operand:SI 2 "immediate_operand" "O"))
11686 (clobber (reg:SI LR_REGNO))]
11688 && DEFAULT_ABI == ABI_AIX
11689 && (INTVAL (operands[2]) & CALL_LONG) == 0"
11691 [(set_attr "type" "branch")
11692 (set_attr "length" "8")])
11694 (define_insn "*call_nonlocal_aix64"
11695 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
11696 (match_operand 1 "" "g"))
11697 (use (match_operand:SI 2 "immediate_operand" "O"))
11698 (clobber (reg:SI LR_REGNO))]
11700 && DEFAULT_ABI == ABI_AIX
11701 && (INTVAL (operands[2]) & CALL_LONG) == 0"
11703 [(set_attr "type" "branch")
11704 (set_attr "length" "8")])
11706 (define_insn "*call_value_nonlocal_aix32"
11707 [(set (match_operand 0 "" "")
11708 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
11709 (match_operand 2 "" "g")))
11710 (use (match_operand:SI 3 "immediate_operand" "O"))
11711 (clobber (reg:SI LR_REGNO))]
11713 && DEFAULT_ABI == ABI_AIX
11714 && (INTVAL (operands[3]) & CALL_LONG) == 0"
11716 [(set_attr "type" "branch")
11717 (set_attr "length" "8")])
11719 (define_insn "*call_value_nonlocal_aix64"
11720 [(set (match_operand 0 "" "")
11721 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
11722 (match_operand 2 "" "g")))
11723 (use (match_operand:SI 3 "immediate_operand" "O"))
11724 (clobber (reg:SI LR_REGNO))]
11726 && DEFAULT_ABI == ABI_AIX
11727 && (INTVAL (operands[3]) & CALL_LONG) == 0"
11729 [(set_attr "type" "branch")
11730 (set_attr "length" "8")])
11732 ;; A function pointer under System V is just a normal pointer
11733 ;; operands[0] is the function pointer
11734 ;; operands[1] is the stack size to clean up
11735 ;; operands[2] is the value FUNCTION_ARG returns for the VOID argument
11736 ;; which indicates how to set cr1
11738 (define_insn "*call_indirect_nonlocal_sysv<mode>"
11739 [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l,c,*l"))
11740 (match_operand 1 "" "g,g,g,g"))
11741 (use (match_operand:SI 2 "immediate_operand" "O,O,n,n"))
11742 (clobber (reg:SI LR_REGNO))]
11743 "DEFAULT_ABI == ABI_V4
11744 || DEFAULT_ABI == ABI_DARWIN"
11746 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11747 output_asm_insn ("crxor 6,6,6", operands);
11749 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11750 output_asm_insn ("creqv 6,6,6", operands);
11754 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
11755 (set_attr "length" "4,4,8,8")])
11757 (define_insn_and_split "*call_nonlocal_sysv<mode>"
11758 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
11759 (match_operand 1 "" "g,g"))
11760 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11761 (clobber (reg:SI LR_REGNO))]
11762 "(DEFAULT_ABI == ABI_DARWIN
11763 || (DEFAULT_ABI == ABI_V4
11764 && (INTVAL (operands[2]) & CALL_LONG) == 0))"
11766 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11767 output_asm_insn ("crxor 6,6,6", operands);
11769 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11770 output_asm_insn ("creqv 6,6,6", operands);
11773 return output_call(insn, operands, 0, 2);
11775 if (DEFAULT_ABI == ABI_V4 && flag_pic)
11777 gcc_assert (!TARGET_SECURE_PLT);
11778 return "bl %z0@plt";
11784 "DEFAULT_ABI == ABI_V4
11785 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[0])
11786 && (INTVAL (operands[2]) & CALL_LONG) == 0"
11787 [(parallel [(call (mem:SI (match_dup 0))
11789 (use (match_dup 2))
11790 (use (match_dup 3))
11791 (clobber (reg:SI LR_REGNO))])]
11793 operands[3] = pic_offset_table_rtx;
11795 [(set_attr "type" "branch,branch")
11796 (set_attr "length" "4,8")])
11798 (define_insn "*call_nonlocal_sysv_secure<mode>"
11799 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
11800 (match_operand 1 "" "g,g"))
11801 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11802 (use (match_operand:SI 3 "register_operand" "r,r"))
11803 (clobber (reg:SI LR_REGNO))]
11804 "(DEFAULT_ABI == ABI_V4
11805 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[0])
11806 && (INTVAL (operands[2]) & CALL_LONG) == 0)"
11808 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11809 output_asm_insn ("crxor 6,6,6", operands);
11811 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11812 output_asm_insn ("creqv 6,6,6", operands);
11815 /* The magic 32768 offset here and in the other sysv call insns
11816 corresponds to the offset of r30 in .got2, as given by LCTOC1.
11817 See sysv4.h:toc_section. */
11818 return "bl %z0+32768@plt";
11820 return "bl %z0@plt";
11822 [(set_attr "type" "branch,branch")
11823 (set_attr "length" "4,8")])
11825 (define_insn "*call_value_indirect_nonlocal_sysv<mode>"
11826 [(set (match_operand 0 "" "")
11827 (call (mem:SI (match_operand:P 1 "register_operand" "c,*l,c,*l"))
11828 (match_operand 2 "" "g,g,g,g")))
11829 (use (match_operand:SI 3 "immediate_operand" "O,O,n,n"))
11830 (clobber (reg:SI LR_REGNO))]
11831 "DEFAULT_ABI == ABI_V4
11832 || DEFAULT_ABI == ABI_DARWIN"
11834 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11835 output_asm_insn ("crxor 6,6,6", operands);
11837 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11838 output_asm_insn ("creqv 6,6,6", operands);
11842 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
11843 (set_attr "length" "4,4,8,8")])
11845 (define_insn_and_split "*call_value_nonlocal_sysv<mode>"
11846 [(set (match_operand 0 "" "")
11847 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
11848 (match_operand 2 "" "g,g")))
11849 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11850 (clobber (reg:SI LR_REGNO))]
11851 "(DEFAULT_ABI == ABI_DARWIN
11852 || (DEFAULT_ABI == ABI_V4
11853 && (INTVAL (operands[3]) & CALL_LONG) == 0))"
11855 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11856 output_asm_insn ("crxor 6,6,6", operands);
11858 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11859 output_asm_insn ("creqv 6,6,6", operands);
11862 return output_call(insn, operands, 1, 3);
11864 if (DEFAULT_ABI == ABI_V4 && flag_pic)
11866 gcc_assert (!TARGET_SECURE_PLT);
11867 return "bl %z1@plt";
11873 "DEFAULT_ABI == ABI_V4
11874 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[1])
11875 && (INTVAL (operands[3]) & CALL_LONG) == 0"
11876 [(parallel [(set (match_dup 0)
11877 (call (mem:SI (match_dup 1))
11879 (use (match_dup 3))
11880 (use (match_dup 4))
11881 (clobber (reg:SI LR_REGNO))])]
11883 operands[4] = pic_offset_table_rtx;
11885 [(set_attr "type" "branch,branch")
11886 (set_attr "length" "4,8")])
11888 (define_insn "*call_value_nonlocal_sysv_secure<mode>"
11889 [(set (match_operand 0 "" "")
11890 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
11891 (match_operand 2 "" "g,g")))
11892 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11893 (use (match_operand:SI 4 "register_operand" "r,r"))
11894 (clobber (reg:SI LR_REGNO))]
11895 "(DEFAULT_ABI == ABI_V4
11896 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[1])
11897 && (INTVAL (operands[3]) & CALL_LONG) == 0)"
11899 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11900 output_asm_insn ("crxor 6,6,6", operands);
11902 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11903 output_asm_insn ("creqv 6,6,6", operands);
11906 return "bl %z1+32768@plt";
11908 return "bl %z1@plt";
11910 [(set_attr "type" "branch,branch")
11911 (set_attr "length" "4,8")])
11913 ;; Call subroutine returning any type.
11914 (define_expand "untyped_call"
11915 [(parallel [(call (match_operand 0 "" "")
11917 (match_operand 1 "" "")
11918 (match_operand 2 "" "")])]
11924 emit_call_insn (GEN_CALL (operands[0], const0_rtx, const0_rtx, const0_rtx));
11926 for (i = 0; i < XVECLEN (operands[2], 0); i++)
11928 rtx set = XVECEXP (operands[2], 0, i);
11929 emit_move_insn (SET_DEST (set), SET_SRC (set));
11932 /* The optimizer does not know that the call sets the function value
11933 registers we stored in the result block. We avoid problems by
11934 claiming that all hard registers are used and clobbered at this
11936 emit_insn (gen_blockage ());
11941 ;; sibling call patterns
11942 (define_expand "sibcall"
11943 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
11944 (match_operand 1 "" ""))
11945 (use (match_operand 2 "" ""))
11946 (use (reg:SI LR_REGNO))
11952 if (MACHOPIC_INDIRECT)
11953 operands[0] = machopic_indirect_call_target (operands[0]);
11956 gcc_assert (GET_CODE (operands[0]) == MEM);
11957 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
11959 operands[0] = XEXP (operands[0], 0);
11962 ;; this and similar patterns must be marked as using LR, otherwise
11963 ;; dataflow will try to delete the store into it. This is true
11964 ;; even when the actual reg to jump to is in CTR, when LR was
11965 ;; saved and restored around the PIC-setting BCL.
11966 (define_insn "*sibcall_local32"
11967 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
11968 (match_operand 1 "" "g,g"))
11969 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11970 (use (reg:SI LR_REGNO))
11972 "(INTVAL (operands[2]) & CALL_LONG) == 0"
11975 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11976 output_asm_insn (\"crxor 6,6,6\", operands);
11978 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11979 output_asm_insn (\"creqv 6,6,6\", operands);
11981 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
11983 [(set_attr "type" "branch")
11984 (set_attr "length" "4,8")])
11986 (define_insn "*sibcall_local64"
11987 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
11988 (match_operand 1 "" "g,g"))
11989 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11990 (use (reg:SI LR_REGNO))
11992 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
11995 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11996 output_asm_insn (\"crxor 6,6,6\", operands);
11998 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11999 output_asm_insn (\"creqv 6,6,6\", operands);
12001 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
12003 [(set_attr "type" "branch")
12004 (set_attr "length" "4,8")])
12006 (define_insn "*sibcall_value_local32"
12007 [(set (match_operand 0 "" "")
12008 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
12009 (match_operand 2 "" "g,g")))
12010 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12011 (use (reg:SI LR_REGNO))
12013 "(INTVAL (operands[3]) & CALL_LONG) == 0"
12016 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12017 output_asm_insn (\"crxor 6,6,6\", operands);
12019 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12020 output_asm_insn (\"creqv 6,6,6\", operands);
12022 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
12024 [(set_attr "type" "branch")
12025 (set_attr "length" "4,8")])
12028 (define_insn "*sibcall_value_local64"
12029 [(set (match_operand 0 "" "")
12030 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
12031 (match_operand 2 "" "g,g")))
12032 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12033 (use (reg:SI LR_REGNO))
12035 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
12038 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12039 output_asm_insn (\"crxor 6,6,6\", operands);
12041 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12042 output_asm_insn (\"creqv 6,6,6\", operands);
12044 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
12046 [(set_attr "type" "branch")
12047 (set_attr "length" "4,8")])
12049 (define_insn "*sibcall_nonlocal_aix<mode>"
12050 [(call (mem:SI (match_operand:P 0 "call_operand" "s,c"))
12051 (match_operand 1 "" "g,g"))
12052 (use (match_operand:SI 2 "immediate_operand" "O,O"))
12053 (use (reg:SI LR_REGNO))
12055 "DEFAULT_ABI == ABI_AIX
12056 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12060 [(set_attr "type" "branch")
12061 (set_attr "length" "4")])
12063 (define_insn "*sibcall_value_nonlocal_aix<mode>"
12064 [(set (match_operand 0 "" "")
12065 (call (mem:SI (match_operand:P 1 "call_operand" "s,c"))
12066 (match_operand 2 "" "g,g")))
12067 (use (match_operand:SI 3 "immediate_operand" "O,O"))
12068 (use (reg:SI LR_REGNO))
12070 "DEFAULT_ABI == ABI_AIX
12071 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12075 [(set_attr "type" "branch")
12076 (set_attr "length" "4")])
12078 (define_insn "*sibcall_nonlocal_sysv<mode>"
12079 [(call (mem:SI (match_operand:P 0 "call_operand" "s,s,c,c"))
12080 (match_operand 1 "" ""))
12081 (use (match_operand 2 "immediate_operand" "O,n,O,n"))
12082 (use (reg:SI LR_REGNO))
12084 "(DEFAULT_ABI == ABI_DARWIN
12085 || DEFAULT_ABI == ABI_V4)
12086 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12089 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12090 output_asm_insn (\"crxor 6,6,6\", operands);
12092 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12093 output_asm_insn (\"creqv 6,6,6\", operands);
12095 if (which_alternative >= 2)
12097 else if (DEFAULT_ABI == ABI_V4 && flag_pic)
12099 gcc_assert (!TARGET_SECURE_PLT);
12100 return \"b %z0@plt\";
12105 [(set_attr "type" "branch")
12106 (set_attr "length" "4,8,4,8")])
12108 (define_expand "sibcall_value"
12109 [(parallel [(set (match_operand 0 "register_operand" "")
12110 (call (mem:SI (match_operand 1 "address_operand" ""))
12111 (match_operand 2 "" "")))
12112 (use (match_operand 3 "" ""))
12113 (use (reg:SI LR_REGNO))
12119 if (MACHOPIC_INDIRECT)
12120 operands[1] = machopic_indirect_call_target (operands[1]);
12123 gcc_assert (GET_CODE (operands[1]) == MEM);
12124 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
12126 operands[1] = XEXP (operands[1], 0);
12129 (define_insn "*sibcall_value_nonlocal_sysv<mode>"
12130 [(set (match_operand 0 "" "")
12131 (call (mem:SI (match_operand:P 1 "call_operand" "s,s,c,c"))
12132 (match_operand 2 "" "")))
12133 (use (match_operand:SI 3 "immediate_operand" "O,n,O,n"))
12134 (use (reg:SI LR_REGNO))
12136 "(DEFAULT_ABI == ABI_DARWIN
12137 || DEFAULT_ABI == ABI_V4)
12138 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12141 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12142 output_asm_insn (\"crxor 6,6,6\", operands);
12144 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12145 output_asm_insn (\"creqv 6,6,6\", operands);
12147 if (which_alternative >= 2)
12149 else if (DEFAULT_ABI == ABI_V4 && flag_pic)
12151 gcc_assert (!TARGET_SECURE_PLT);
12152 return \"b %z1@plt\";
12157 [(set_attr "type" "branch")
12158 (set_attr "length" "4,8,4,8")])
12160 (define_expand "sibcall_epilogue"
12161 [(use (const_int 0))]
12164 if (!TARGET_SCHED_PROLOG)
12165 emit_insn (gen_blockage ());
12166 rs6000_emit_epilogue (TRUE);
12170 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
12171 ;; all of memory. This blocks insns from being moved across this point.
12173 (define_insn "blockage"
12174 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCK)]
12178 (define_expand "probe_stack"
12179 [(set (match_operand 0 "memory_operand" "=m")
12180 (unspec [(const_int 0)] UNSPEC_PROBE_STACK))]
12184 emit_insn (gen_probe_stack_di (operands[0]));
12186 emit_insn (gen_probe_stack_si (operands[0]));
12190 (define_insn "probe_stack_<mode>"
12191 [(set (match_operand:P 0 "memory_operand" "=m")
12192 (unspec:P [(const_int 0)] UNSPEC_PROBE_STACK))]
12195 operands[1] = gen_rtx_REG (Pmode, 0);
12196 return "st<wd>%U0%X0 %1,%0";
12198 [(set (attr "type")
12200 (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
12201 (const_string "store_ux")
12203 (match_test "update_address_mem (operands[0], VOIDmode)")
12204 (const_string "store_u")
12205 (const_string "store"))))
12206 (set_attr "length" "4")])
12208 (define_insn "probe_stack_range<P:mode>"
12209 [(set (match_operand:P 0 "register_operand" "=r")
12210 (unspec_volatile:P [(match_operand:P 1 "register_operand" "0")
12211 (match_operand:P 2 "register_operand" "r")]
12212 UNSPECV_PROBE_STACK_RANGE))]
12214 "* return output_probe_stack_range (operands[0], operands[2]);"
12215 [(set_attr "type" "three")])
12217 ;; Compare insns are next. Note that the RS/6000 has two types of compares,
12218 ;; signed & unsigned, and one type of branch.
12220 ;; Start with the DEFINE_EXPANDs to generate the rtl for compares, scc
12221 ;; insns, and branches.
12223 (define_expand "cbranch<mode>4"
12224 [(use (match_operator 0 "rs6000_cbranch_operator"
12225 [(match_operand:GPR 1 "gpc_reg_operand" "")
12226 (match_operand:GPR 2 "reg_or_short_operand" "")]))
12227 (use (match_operand 3 ""))]
12231 /* Take care of the possibility that operands[2] might be negative but
12232 this might be a logical operation. That insn doesn't exist. */
12233 if (GET_CODE (operands[2]) == CONST_INT
12234 && INTVAL (operands[2]) < 0)
12236 operands[2] = force_reg (<MODE>mode, operands[2]);
12237 operands[0] = gen_rtx_fmt_ee (GET_CODE (operands[0]),
12238 GET_MODE (operands[0]),
12239 operands[1], operands[2]);
12242 rs6000_emit_cbranch (<MODE>mode, operands);
12246 (define_expand "cbranch<mode>4"
12247 [(use (match_operator 0 "rs6000_cbranch_operator"
12248 [(match_operand:FP 1 "gpc_reg_operand" "")
12249 (match_operand:FP 2 "gpc_reg_operand" "")]))
12250 (use (match_operand 3 ""))]
12254 rs6000_emit_cbranch (<MODE>mode, operands);
12258 (define_expand "cstore<mode>4"
12259 [(use (match_operator 1 "rs6000_cbranch_operator"
12260 [(match_operand:GPR 2 "gpc_reg_operand" "")
12261 (match_operand:GPR 3 "reg_or_short_operand" "")]))
12262 (clobber (match_operand:SI 0 "register_operand"))]
12266 /* Take care of the possibility that operands[3] might be negative but
12267 this might be a logical operation. That insn doesn't exist. */
12268 if (GET_CODE (operands[3]) == CONST_INT
12269 && INTVAL (operands[3]) < 0)
12271 operands[3] = force_reg (<MODE>mode, operands[3]);
12272 operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]),
12273 GET_MODE (operands[1]),
12274 operands[2], operands[3]);
12277 /* For SNE, we would prefer that the xor/abs sequence be used for integers.
12278 For SEQ, likewise, except that comparisons with zero should be done
12279 with an scc insns. However, due to the order that combine see the
12280 resulting insns, we must, in fact, allow SEQ for integers. Fail in
12281 the cases we don't want to handle or are best handled by portable
12283 if (GET_CODE (operands[1]) == NE)
12285 if ((GET_CODE (operands[1]) == LT || GET_CODE (operands[1]) == LE
12286 || GET_CODE (operands[1]) == GT || GET_CODE (operands[1]) == GE)
12287 && operands[3] == const0_rtx)
12289 rs6000_emit_sCOND (<MODE>mode, operands);
12293 (define_expand "cstore<mode>4"
12294 [(use (match_operator 1 "rs6000_cbranch_operator"
12295 [(match_operand:FP 2 "gpc_reg_operand" "")
12296 (match_operand:FP 3 "gpc_reg_operand" "")]))
12297 (clobber (match_operand:SI 0 "register_operand"))]
12301 rs6000_emit_sCOND (<MODE>mode, operands);
12306 (define_expand "stack_protect_set"
12307 [(match_operand 0 "memory_operand" "")
12308 (match_operand 1 "memory_operand" "")]
12311 #ifdef TARGET_THREAD_SSP_OFFSET
12312 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
12313 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
12314 operands[1] = gen_rtx_MEM (Pmode, addr);
12317 emit_insn (gen_stack_protect_setdi (operands[0], operands[1]));
12319 emit_insn (gen_stack_protect_setsi (operands[0], operands[1]));
12323 (define_insn "stack_protect_setsi"
12324 [(set (match_operand:SI 0 "memory_operand" "=m")
12325 (unspec:SI [(match_operand:SI 1 "memory_operand" "m")] UNSPEC_SP_SET))
12326 (set (match_scratch:SI 2 "=&r") (const_int 0))]
12328 "lwz%U1%X1 %2,%1\;stw%U0%X0 %2,%0\;li %2,0"
12329 [(set_attr "type" "three")
12330 (set_attr "length" "12")])
12332 (define_insn "stack_protect_setdi"
12333 [(set (match_operand:DI 0 "memory_operand" "=Y")
12334 (unspec:DI [(match_operand:DI 1 "memory_operand" "Y")] UNSPEC_SP_SET))
12335 (set (match_scratch:DI 2 "=&r") (const_int 0))]
12337 "ld%U1%X1 %2,%1\;std%U0%X0 %2,%0\;li %2,0"
12338 [(set_attr "type" "three")
12339 (set_attr "length" "12")])
12341 (define_expand "stack_protect_test"
12342 [(match_operand 0 "memory_operand" "")
12343 (match_operand 1 "memory_operand" "")
12344 (match_operand 2 "" "")]
12347 rtx test, op0, op1;
12348 #ifdef TARGET_THREAD_SSP_OFFSET
12349 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
12350 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
12351 operands[1] = gen_rtx_MEM (Pmode, addr);
12354 op1 = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, operands[1]), UNSPEC_SP_TEST);
12355 test = gen_rtx_EQ (VOIDmode, op0, op1);
12356 emit_jump_insn (gen_cbranchsi4 (test, op0, op1, operands[2]));
12360 (define_insn "stack_protect_testsi"
12361 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
12362 (unspec:CCEQ [(match_operand:SI 1 "memory_operand" "m,m")
12363 (match_operand:SI 2 "memory_operand" "m,m")]
12365 (set (match_scratch:SI 4 "=r,r") (const_int 0))
12366 (clobber (match_scratch:SI 3 "=&r,&r"))]
12369 lwz%U1%X1 %3,%1\;lwz%U2%X2 %4,%2\;xor. %3,%3,%4\;li %4,0
12370 lwz%U1%X1 %3,%1\;lwz%U2%X2 %4,%2\;cmplw %0,%3,%4\;li %3,0\;li %4,0"
12371 [(set_attr "length" "16,20")])
12373 (define_insn "stack_protect_testdi"
12374 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
12375 (unspec:CCEQ [(match_operand:DI 1 "memory_operand" "Y,Y")
12376 (match_operand:DI 2 "memory_operand" "Y,Y")]
12378 (set (match_scratch:DI 4 "=r,r") (const_int 0))
12379 (clobber (match_scratch:DI 3 "=&r,&r"))]
12382 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;xor. %3,%3,%4\;li %4,0
12383 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;cmpld %0,%3,%4\;li %3,0\;li %4,0"
12384 [(set_attr "length" "16,20")])
12387 ;; Here are the actual compare insns.
12388 (define_insn "*cmp<mode>_internal1"
12389 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
12390 (compare:CC (match_operand:GPR 1 "gpc_reg_operand" "r")
12391 (match_operand:GPR 2 "reg_or_short_operand" "rI")))]
12393 "cmp<wd>%I2 %0,%1,%2"
12394 [(set_attr "type" "cmp")])
12396 ;; If we are comparing a register for equality with a large constant,
12397 ;; we can do this with an XOR followed by a compare. But this is profitable
12398 ;; only if the large constant is only used for the comparison (and in this
12399 ;; case we already have a register to reuse as scratch).
12401 ;; For 64-bit registers, we could only do so if the constant's bit 15 is clear:
12402 ;; otherwise we'd need to XOR with FFFFFFFF????0000 which is not available.
12405 [(set (match_operand:SI 0 "register_operand")
12406 (match_operand:SI 1 "logical_const_operand" ""))
12407 (set (match_dup 0) (match_operator:SI 3 "boolean_or_operator"
12409 (match_operand:SI 2 "logical_const_operand" "")]))
12410 (set (match_operand:CC 4 "cc_reg_operand" "")
12411 (compare:CC (match_operand:SI 5 "gpc_reg_operand" "")
12414 (if_then_else (match_operator 6 "equality_operator"
12415 [(match_dup 4) (const_int 0)])
12416 (match_operand 7 "" "")
12417 (match_operand 8 "" "")))]
12418 "peep2_reg_dead_p (3, operands[0])
12419 && peep2_reg_dead_p (4, operands[4])"
12420 [(set (match_dup 0) (xor:SI (match_dup 5) (match_dup 9)))
12421 (set (match_dup 4) (compare:CC (match_dup 0) (match_dup 10)))
12422 (set (pc) (if_then_else (match_dup 6) (match_dup 7) (match_dup 8)))]
12425 /* Get the constant we are comparing against, and see what it looks like
12426 when sign-extended from 16 to 32 bits. Then see what constant we could
12427 XOR with SEXTC to get the sign-extended value. */
12428 rtx cnst = simplify_const_binary_operation (GET_CODE (operands[3]),
12430 operands[1], operands[2]);
12431 HOST_WIDE_INT c = INTVAL (cnst);
12432 HOST_WIDE_INT sextc = ((c & 0xffff) ^ 0x8000) - 0x8000;
12433 HOST_WIDE_INT xorv = c ^ sextc;
12435 operands[9] = GEN_INT (xorv);
12436 operands[10] = GEN_INT (sextc);
12439 (define_insn "*cmpsi_internal2"
12440 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
12441 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
12442 (match_operand:SI 2 "reg_or_u_short_operand" "rK")))]
12444 "cmplw%I2 %0,%1,%b2"
12445 [(set_attr "type" "cmp")])
12447 (define_insn "*cmpdi_internal2"
12448 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
12449 (compare:CCUNS (match_operand:DI 1 "gpc_reg_operand" "r")
12450 (match_operand:DI 2 "reg_or_u_short_operand" "rK")))]
12452 "cmpld%I2 %0,%1,%b2"
12453 [(set_attr "type" "cmp")])
12455 ;; The following two insns don't exist as single insns, but if we provide
12456 ;; them, we can swap an add and compare, which will enable us to overlap more
12457 ;; of the required delay between a compare and branch. We generate code for
12458 ;; them by splitting.
12461 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
12462 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
12463 (match_operand:SI 2 "short_cint_operand" "i")))
12464 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
12465 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
12468 [(set_attr "length" "8")])
12471 [(set (match_operand:CCUNS 3 "cc_reg_operand" "=y")
12472 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
12473 (match_operand:SI 2 "u_short_cint_operand" "i")))
12474 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
12475 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
12478 [(set_attr "length" "8")])
12481 [(set (match_operand:CC 3 "cc_reg_operand" "")
12482 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
12483 (match_operand:SI 2 "short_cint_operand" "")))
12484 (set (match_operand:SI 0 "gpc_reg_operand" "")
12485 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
12487 [(set (match_dup 3) (compare:CC (match_dup 1) (match_dup 2)))
12488 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
12491 [(set (match_operand:CCUNS 3 "cc_reg_operand" "")
12492 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "")
12493 (match_operand:SI 2 "u_short_cint_operand" "")))
12494 (set (match_operand:SI 0 "gpc_reg_operand" "")
12495 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
12497 [(set (match_dup 3) (compare:CCUNS (match_dup 1) (match_dup 2)))
12498 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
12500 (define_insn "*cmpsf_internal1"
12501 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
12502 (compare:CCFP (match_operand:SF 1 "gpc_reg_operand" "f")
12503 (match_operand:SF 2 "gpc_reg_operand" "f")))]
12504 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
12506 [(set_attr "type" "fpcompare")])
12508 (define_insn "*cmpdf_internal1"
12509 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
12510 (compare:CCFP (match_operand:DF 1 "gpc_reg_operand" "d")
12511 (match_operand:DF 2 "gpc_reg_operand" "d")))]
12512 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
12513 && !VECTOR_UNIT_VSX_P (DFmode)"
12515 [(set_attr "type" "fpcompare")])
12517 ;; Only need to compare second words if first words equal
12518 (define_insn "*cmptf_internal1"
12519 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
12520 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "d")
12521 (match_operand:TF 2 "gpc_reg_operand" "d")))]
12522 "!TARGET_IEEEQUAD && !TARGET_XL_COMPAT
12523 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LONG_DOUBLE_128"
12524 "fcmpu %0,%1,%2\;bne %0,$+8\;fcmpu %0,%L1,%L2"
12525 [(set_attr "type" "fpcompare")
12526 (set_attr "length" "12")])
12528 (define_insn_and_split "*cmptf_internal2"
12529 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
12530 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "d")
12531 (match_operand:TF 2 "gpc_reg_operand" "d")))
12532 (clobber (match_scratch:DF 3 "=d"))
12533 (clobber (match_scratch:DF 4 "=d"))
12534 (clobber (match_scratch:DF 5 "=d"))
12535 (clobber (match_scratch:DF 6 "=d"))
12536 (clobber (match_scratch:DF 7 "=d"))
12537 (clobber (match_scratch:DF 8 "=d"))
12538 (clobber (match_scratch:DF 9 "=d"))
12539 (clobber (match_scratch:DF 10 "=d"))
12540 (clobber (match_scratch:GPR 11 "=b"))]
12541 "!TARGET_IEEEQUAD && TARGET_XL_COMPAT
12542 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LONG_DOUBLE_128"
12544 "&& reload_completed"
12545 [(set (match_dup 3) (match_dup 14))
12546 (set (match_dup 4) (match_dup 15))
12547 (set (match_dup 9) (abs:DF (match_dup 5)))
12548 (set (match_dup 0) (compare:CCFP (match_dup 9) (match_dup 3)))
12549 (set (pc) (if_then_else (ne (match_dup 0) (const_int 0))
12550 (label_ref (match_dup 12))
12552 (set (match_dup 0) (compare:CCFP (match_dup 5) (match_dup 7)))
12553 (set (pc) (label_ref (match_dup 13)))
12555 (set (match_dup 10) (minus:DF (match_dup 5) (match_dup 7)))
12556 (set (match_dup 9) (minus:DF (match_dup 6) (match_dup 8)))
12557 (set (match_dup 9) (plus:DF (match_dup 10) (match_dup 9)))
12558 (set (match_dup 0) (compare:CCFP (match_dup 9) (match_dup 4)))
12561 REAL_VALUE_TYPE rv;
12562 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
12563 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
12565 operands[5] = simplify_gen_subreg (DFmode, operands[1], TFmode, hi_word);
12566 operands[6] = simplify_gen_subreg (DFmode, operands[1], TFmode, lo_word);
12567 operands[7] = simplify_gen_subreg (DFmode, operands[2], TFmode, hi_word);
12568 operands[8] = simplify_gen_subreg (DFmode, operands[2], TFmode, lo_word);
12569 operands[12] = gen_label_rtx ();
12570 operands[13] = gen_label_rtx ();
12572 operands[14] = force_const_mem (DFmode,
12573 CONST_DOUBLE_FROM_REAL_VALUE (rv, DFmode));
12574 operands[15] = force_const_mem (DFmode,
12575 CONST_DOUBLE_FROM_REAL_VALUE (dconst0,
12580 tocref = create_TOC_reference (XEXP (operands[14], 0), operands[11]);
12581 operands[14] = gen_const_mem (DFmode, tocref);
12582 tocref = create_TOC_reference (XEXP (operands[15], 0), operands[11]);
12583 operands[15] = gen_const_mem (DFmode, tocref);
12584 set_mem_alias_set (operands[14], get_TOC_alias_set ());
12585 set_mem_alias_set (operands[15], get_TOC_alias_set ());
12589 ;; Now we have the scc insns. We can do some combinations because of the
12590 ;; way the machine works.
12592 ;; Note that this is probably faster if we can put an insn between the
12593 ;; mfcr and rlinm, but this is tricky. Let's leave it for now. In most
12594 ;; cases the insns below which don't use an intermediate CR field will
12595 ;; be used instead.
12597 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12598 (match_operator:SI 1 "scc_comparison_operator"
12599 [(match_operand 2 "cc_reg_operand" "y")
12602 "mfcr %0%Q2\;rlwinm %0,%0,%J1,1"
12603 [(set (attr "type")
12604 (cond [(match_test "TARGET_MFCRF")
12605 (const_string "mfcrf")
12607 (const_string "mfcr")))
12608 (set_attr "length" "8")])
12610 ;; Same as above, but get the GT bit.
12611 (define_insn "move_from_CR_gt_bit"
12612 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12613 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_GT))]
12614 "TARGET_HARD_FLOAT && !TARGET_FPRS"
12615 "mfcr %0\;rlwinm %0,%0,%D1,31,31"
12616 [(set_attr "type" "mfcr")
12617 (set_attr "length" "8")])
12619 ;; Same as above, but get the OV/ORDERED bit.
12620 (define_insn "move_from_CR_ov_bit"
12621 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12622 (unspec:SI [(match_operand:CC 1 "cc_reg_operand" "y")]
12625 "mfcr %0\;rlwinm %0,%0,%t1,1"
12626 [(set_attr "type" "mfcr")
12627 (set_attr "length" "8")])
12630 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12631 (match_operator:DI 1 "scc_comparison_operator"
12632 [(match_operand 2 "cc_reg_operand" "y")
12635 "mfcr %0%Q2\;rlwinm %0,%0,%J1,1"
12636 [(set (attr "type")
12637 (cond [(match_test "TARGET_MFCRF")
12638 (const_string "mfcrf")
12640 (const_string "mfcr")))
12641 (set_attr "length" "8")])
12644 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12645 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
12646 [(match_operand 2 "cc_reg_operand" "y,y")
12649 (set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
12650 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
12653 mfcr %3%Q2\;rlwinm. %3,%3,%J1,1
12655 [(set_attr "type" "delayed_compare")
12656 (set_attr "length" "8,16")])
12659 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12660 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
12661 [(match_operand 2 "cc_reg_operand" "")
12664 (set (match_operand:SI 3 "gpc_reg_operand" "")
12665 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
12666 "TARGET_32BIT && reload_completed"
12667 [(set (match_dup 3)
12668 (match_op_dup 1 [(match_dup 2) (const_int 0)]))
12670 (compare:CC (match_dup 3)
12675 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12676 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
12677 [(match_operand 2 "cc_reg_operand" "y")
12679 (match_operand:SI 3 "const_int_operand" "n")))]
12683 int is_bit = ccr_bit (operands[1], 1);
12684 int put_bit = 31 - (INTVAL (operands[3]) & 31);
12687 if (is_bit >= put_bit)
12688 count = is_bit - put_bit;
12690 count = 32 - (put_bit - is_bit);
12692 operands[4] = GEN_INT (count);
12693 operands[5] = GEN_INT (put_bit);
12695 return \"mfcr %0%Q2\;rlwinm %0,%0,%4,%5,%5\";
12697 [(set (attr "type")
12698 (cond [(match_test "TARGET_MFCRF")
12699 (const_string "mfcrf")
12701 (const_string "mfcr")))
12702 (set_attr "length" "8")])
12705 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12707 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
12708 [(match_operand 2 "cc_reg_operand" "y,y")
12710 (match_operand:SI 3 "const_int_operand" "n,n"))
12712 (set (match_operand:SI 4 "gpc_reg_operand" "=r,r")
12713 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
12718 int is_bit = ccr_bit (operands[1], 1);
12719 int put_bit = 31 - (INTVAL (operands[3]) & 31);
12722 /* Force split for non-cc0 compare. */
12723 if (which_alternative == 1)
12726 if (is_bit >= put_bit)
12727 count = is_bit - put_bit;
12729 count = 32 - (put_bit - is_bit);
12731 operands[5] = GEN_INT (count);
12732 operands[6] = GEN_INT (put_bit);
12734 return \"mfcr %4%Q2\;rlwinm. %4,%4,%5,%6,%6\";
12736 [(set_attr "type" "delayed_compare")
12737 (set_attr "length" "8,16")])
12740 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
12742 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
12743 [(match_operand 2 "cc_reg_operand" "")
12745 (match_operand:SI 3 "const_int_operand" ""))
12747 (set (match_operand:SI 4 "gpc_reg_operand" "")
12748 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
12751 [(set (match_dup 4)
12752 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
12755 (compare:CC (match_dup 4)
12759 ;; There is a 3 cycle delay between consecutive mfcr instructions
12760 ;; so it is useful to combine 2 scc instructions to use only one mfcr.
12763 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12764 (match_operator:SI 1 "scc_comparison_operator"
12765 [(match_operand 2 "cc_reg_operand" "y")
12767 (set (match_operand:SI 3 "gpc_reg_operand" "=r")
12768 (match_operator:SI 4 "scc_comparison_operator"
12769 [(match_operand 5 "cc_reg_operand" "y")
12771 "REGNO (operands[2]) != REGNO (operands[5])"
12772 "mfcr %3\;rlwinm %0,%3,%J1,1\;rlwinm %3,%3,%J4,1"
12773 [(set_attr "type" "mfcr")
12774 (set_attr "length" "12")])
12777 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12778 (match_operator:DI 1 "scc_comparison_operator"
12779 [(match_operand 2 "cc_reg_operand" "y")
12781 (set (match_operand:DI 3 "gpc_reg_operand" "=r")
12782 (match_operator:DI 4 "scc_comparison_operator"
12783 [(match_operand 5 "cc_reg_operand" "y")
12785 "TARGET_POWERPC64 && REGNO (operands[2]) != REGNO (operands[5])"
12786 "mfcr %3\;rlwinm %0,%3,%J1,1\;rlwinm %3,%3,%J4,1"
12787 [(set_attr "type" "mfcr")
12788 (set_attr "length" "12")])
12790 ;; There are some scc insns that can be done directly, without a compare.
12791 ;; These are faster because they don't involve the communications between
12792 ;; the FXU and branch units. In fact, we will be replacing all of the
12793 ;; integer scc insns here or in the portable methods in emit_store_flag.
12795 ;; Also support (neg (scc ..)) since that construct is used to replace
12796 ;; branches, (plus (scc ..) ..) since that construct is common and
12797 ;; takes no more insns than scc, and (and (neg (scc ..)) ..) in the
12798 ;; cases where it is no more expensive than (neg (scc ..)).
12800 ;; Have reload force a constant into a register for the simple insns that
12801 ;; otherwise won't accept constants. We do this because it is faster than
12802 ;; the cmp/mfcr sequence we would otherwise generate.
12804 (define_mode_attr scc_eq_op2 [(SI "rKLI")
12807 (define_insn_and_split "*eq<mode>"
12808 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
12809 (eq:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
12810 (match_operand:GPR 2 "scc_eq_operand" "<scc_eq_op2>")))]
12814 [(set (match_dup 0)
12815 (clz:GPR (match_dup 3)))
12817 (lshiftrt:GPR (match_dup 0) (match_dup 4)))]
12819 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
12821 /* Use output operand as intermediate. */
12822 operands[3] = operands[0];
12824 if (logical_operand (operands[2], <MODE>mode))
12825 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
12826 gen_rtx_XOR (<MODE>mode,
12827 operands[1], operands[2])));
12829 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
12830 gen_rtx_PLUS (<MODE>mode, operands[1],
12831 negate_rtx (<MODE>mode,
12835 operands[3] = operands[1];
12837 operands[4] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
12840 (define_insn_and_split "*eq<mode>_compare"
12841 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
12843 (eq:P (match_operand:P 1 "gpc_reg_operand" "=r")
12844 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))
12846 (set (match_operand:P 0 "gpc_reg_operand" "=r")
12847 (eq:P (match_dup 1) (match_dup 2)))]
12851 [(set (match_dup 0)
12852 (clz:P (match_dup 4)))
12853 (parallel [(set (match_dup 3)
12854 (compare:CC (lshiftrt:P (match_dup 0) (match_dup 5))
12857 (lshiftrt:P (match_dup 0) (match_dup 5)))])]
12859 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
12861 /* Use output operand as intermediate. */
12862 operands[4] = operands[0];
12864 if (logical_operand (operands[2], <MODE>mode))
12865 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
12866 gen_rtx_XOR (<MODE>mode,
12867 operands[1], operands[2])));
12869 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
12870 gen_rtx_PLUS (<MODE>mode, operands[1],
12871 negate_rtx (<MODE>mode,
12875 operands[4] = operands[1];
12877 operands[5] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
12880 ;; We have insns of the form shown by the first define_insn below. If
12881 ;; there is something inside the comparison operation, we must split it.
12883 [(set (match_operand:SI 0 "gpc_reg_operand" "")
12884 (plus:SI (match_operator 1 "comparison_operator"
12885 [(match_operand:SI 2 "" "")
12886 (match_operand:SI 3
12887 "reg_or_cint_operand" "")])
12888 (match_operand:SI 4 "gpc_reg_operand" "")))
12889 (clobber (match_operand:SI 5 "register_operand" ""))]
12890 "! gpc_reg_operand (operands[2], SImode)"
12891 [(set (match_dup 5) (match_dup 2))
12892 (set (match_dup 0) (plus:SI (match_op_dup 1 [(match_dup 5) (match_dup 3)])
12895 (define_insn "*plus_eqsi"
12896 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r")
12897 (plus:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
12898 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I"))
12899 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r")))]
12902 xor %0,%1,%2\;subfic %0,%0,0\;addze %0,%3
12903 subfic %0,%1,0\;addze %0,%3
12904 xori %0,%1,%b2\;subfic %0,%0,0\;addze %0,%3
12905 xoris %0,%1,%u2\;subfic %0,%0,0\;addze %0,%3
12906 subfic %0,%1,%2\;subfic %0,%0,0\;addze %0,%3"
12907 [(set_attr "type" "three,two,three,three,three")
12908 (set_attr "length" "12,8,12,12,12")])
12910 (define_insn "*compare_plus_eqsi"
12911 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
12914 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
12915 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
12916 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
12918 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r"))]
12919 "TARGET_32BIT && optimize_size"
12921 xor %4,%1,%2\;subfic %4,%4,0\;addze. %4,%3
12922 subfic %4,%1,0\;addze. %4,%3
12923 xori %4,%1,%b2\;subfic %4,%4,0\;addze. %4,%3
12924 xoris %4,%1,%u2\;subfic %4,%4,0\;addze. %4,%3
12925 subfic %4,%1,%2\;subfic %4,%4,0\;addze. %4,%3
12931 [(set_attr "type" "compare")
12932 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
12935 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12938 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
12939 (match_operand:SI 2 "scc_eq_operand" ""))
12940 (match_operand:SI 3 "gpc_reg_operand" ""))
12942 (clobber (match_scratch:SI 4 ""))]
12943 "TARGET_32BIT && optimize_size && reload_completed"
12944 [(set (match_dup 4)
12945 (plus:SI (eq:SI (match_dup 1)
12949 (compare:CC (match_dup 4)
12953 (define_insn "*plus_eqsi_compare"
12954 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
12957 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
12958 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
12959 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
12961 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r")
12962 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12963 "TARGET_32BIT && optimize_size"
12965 xor %0,%1,%2\;subfic %0,%0,0\;addze. %0,%3
12966 subfic %0,%1,0\;addze. %0,%3
12967 xori %0,%1,%b2\;subfic %0,%0,0\;addze. %0,%3
12968 xoris %0,%1,%u2\;subfic %0,%0,0\;addze. %0,%3
12969 subfic %0,%1,%2\;subfic %0,%0,0\;addze. %0,%3
12975 [(set_attr "type" "compare")
12976 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
12979 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12982 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
12983 (match_operand:SI 2 "scc_eq_operand" ""))
12984 (match_operand:SI 3 "gpc_reg_operand" ""))
12986 (set (match_operand:SI 0 "gpc_reg_operand" "")
12987 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12988 "TARGET_32BIT && optimize_size && reload_completed"
12989 [(set (match_dup 0)
12990 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12992 (compare:CC (match_dup 0)
12996 (define_insn "*neg_eq0<mode>"
12997 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
12998 (neg:P (eq:P (match_operand:P 1 "gpc_reg_operand" "r")
13001 "addic %0,%1,-1\;subfe %0,%0,%0"
13002 [(set_attr "type" "two")
13003 (set_attr "length" "8")])
13005 (define_insn_and_split "*neg_eq<mode>"
13006 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13007 (neg:P (eq:P (match_operand:P 1 "gpc_reg_operand" "%r")
13008 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))))]
13012 [(set (match_dup 0) (neg:P (eq:P (match_dup 3) (const_int 0))))]
13014 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
13016 /* Use output operand as intermediate. */
13017 operands[3] = operands[0];
13019 if (logical_operand (operands[2], <MODE>mode))
13020 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13021 gen_rtx_XOR (<MODE>mode,
13022 operands[1], operands[2])));
13024 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13025 gen_rtx_PLUS (<MODE>mode, operands[1],
13026 negate_rtx (<MODE>mode,
13030 operands[3] = operands[1];
13033 (define_insn "*ne0_<mode>"
13034 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13035 (ne:P (match_operand:P 1 "gpc_reg_operand" "r")
13037 (clobber (match_scratch:P 2 "=&r"))]
13038 "!(TARGET_32BIT && TARGET_ISEL)"
13039 "addic %2,%1,-1\;subfe %0,%2,%1"
13040 [(set_attr "type" "two")
13041 (set_attr "length" "8")])
13043 (define_insn "*plus_ne0_<mode>"
13044 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13045 (plus:P (ne:P (match_operand:P 1 "gpc_reg_operand" "r")
13047 (match_operand:P 2 "gpc_reg_operand" "r")))
13048 (clobber (match_scratch:P 3 "=&r"))]
13050 "addic %3,%1,-1\;addze %0,%2"
13051 [(set_attr "type" "two")
13052 (set_attr "length" "8")])
13054 (define_insn "*compare_plus_ne0_<mode>"
13055 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13056 (compare:CC (plus:P (ne:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13058 (match_operand:P 2 "gpc_reg_operand" "r,r"))
13060 (clobber (match_scratch:P 3 "=&r,&r"))
13061 (clobber (match_scratch:P 4 "=X,&r"))]
13064 addic %3,%1,-1\;addze. %3,%2
13066 [(set_attr "type" "compare")
13067 (set_attr "length" "8,12")])
13070 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
13071 (compare:CC (ne:P (match_operand:SI 1 "gpc_reg_operand" "")
13073 (neg:P (match_operand:P 2 "gpc_reg_operand" ""))))
13074 (clobber (match_scratch:P 3 ""))
13075 (clobber (match_scratch:P 4 ""))]
13077 [(parallel [(set (match_dup 3)
13078 (plus:P (ne:P (match_dup 1)
13081 (clobber (match_dup 4))])
13083 (compare:CC (match_dup 3)
13088 (define_insn "*compare_plus_ne0_<mode>_1"
13089 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
13090 (compare:CCEQ (ne:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13092 (neg:P (match_operand:P 2 "gpc_reg_operand" "r,r"))))
13093 (clobber (match_scratch:P 3 "=&r,&r"))
13094 (clobber (match_scratch:P 4 "=X,&r"))]
13097 addic %3,%1,-1\;addze. %3,%2
13099 [(set_attr "type" "compare")
13100 (set_attr "length" "8,12")])
13103 [(set (match_operand:CCEQ 0 "cc_reg_not_micro_cr0_operand" "")
13104 (compare:CCEQ (ne:P (match_operand:SI 1 "gpc_reg_operand" "")
13106 (neg:P (match_operand:P 2 "gpc_reg_operand" ""))))
13107 (clobber (match_scratch:P 3 ""))
13108 (clobber (match_scratch:P 4 ""))]
13110 [(parallel [(set (match_dup 3)
13111 (plus:P (ne:P (match_dup 1)
13114 (clobber (match_dup 4))])
13116 (compare:CC (match_dup 3)
13120 (define_insn "*plus_ne0_<mode>_compare"
13121 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13123 (plus:P (ne:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13125 (match_operand:P 2 "gpc_reg_operand" "r,r"))
13127 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13128 (plus:P (ne:P (match_dup 1)
13131 (clobber (match_scratch:P 3 "=&r,&r"))]
13134 addic %3,%1,-1\;addze. %0,%2
13136 [(set_attr "type" "compare")
13137 (set_attr "length" "8,12")])
13140 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
13142 (plus:P (ne:P (match_operand:P 1 "gpc_reg_operand" "")
13144 (match_operand:P 2 "gpc_reg_operand" ""))
13146 (set (match_operand:P 0 "gpc_reg_operand" "")
13147 (plus:P (ne:P (match_dup 1)
13150 (clobber (match_scratch:P 3 ""))]
13152 [(parallel [(set (match_dup 0)
13153 (plus:P (ne:P (match_dup 1)
13156 (clobber (match_dup 3))])
13158 (compare:CC (match_dup 0)
13162 (define_insn "*leu<mode>"
13163 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13164 (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
13165 (match_operand:P 2 "reg_or_short_operand" "rI")))]
13167 "subf%I2c %0,%1,%2\;li %0,0\;adde %0,%0,%0"
13168 [(set_attr "type" "three")
13169 (set_attr "length" "12")])
13171 (define_insn "*leu<mode>_compare"
13172 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13174 (leu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13175 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
13177 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13178 (leu:P (match_dup 1) (match_dup 2)))]
13181 subf%I2c %0,%1,%2\;li %0,0\;adde. %0,%0,%0
13183 [(set_attr "type" "compare")
13184 (set_attr "length" "12,16")])
13187 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13189 (leu:P (match_operand:P 1 "gpc_reg_operand" "")
13190 (match_operand:P 2 "reg_or_short_operand" ""))
13192 (set (match_operand:P 0 "gpc_reg_operand" "")
13193 (leu:P (match_dup 1) (match_dup 2)))]
13195 [(set (match_dup 0)
13196 (leu:P (match_dup 1) (match_dup 2)))
13198 (compare:CC (match_dup 0)
13202 (define_insn "*plus_leu<mode>"
13203 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
13204 (plus:P (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
13205 (match_operand:P 2 "reg_or_short_operand" "rI"))
13206 (match_operand:P 3 "gpc_reg_operand" "r")))]
13208 "subf%I2c %0,%1,%2\;addze %0,%3"
13209 [(set_attr "type" "two")
13210 (set_attr "length" "8")])
13213 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13215 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13216 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13217 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13219 (clobber (match_scratch:SI 4 "=&r,&r"))]
13222 subf%I2c %4,%1,%2\;addze. %4,%3
13224 [(set_attr "type" "compare")
13225 (set_attr "length" "8,12")])
13228 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13230 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13231 (match_operand:SI 2 "reg_or_short_operand" ""))
13232 (match_operand:SI 3 "gpc_reg_operand" ""))
13234 (clobber (match_scratch:SI 4 ""))]
13235 "TARGET_32BIT && reload_completed"
13236 [(set (match_dup 4)
13237 (plus:SI (leu:SI (match_dup 1) (match_dup 2))
13240 (compare:CC (match_dup 4)
13245 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13247 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13248 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13249 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13251 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13252 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13255 subf%I2c %0,%1,%2\;addze. %0,%3
13257 [(set_attr "type" "compare")
13258 (set_attr "length" "8,12")])
13261 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13263 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13264 (match_operand:SI 2 "reg_or_short_operand" ""))
13265 (match_operand:SI 3 "gpc_reg_operand" ""))
13267 (set (match_operand:SI 0 "gpc_reg_operand" "")
13268 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13269 "TARGET_32BIT && reload_completed"
13270 [(set (match_dup 0)
13271 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13273 (compare:CC (match_dup 0)
13277 (define_insn "*neg_leu<mode>"
13278 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13279 (neg:P (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
13280 (match_operand:P 2 "reg_or_short_operand" "rI"))))]
13282 "subf%I2c %0,%1,%2\;subfe %0,%0,%0\;nand %0,%0,%0"
13283 [(set_attr "type" "three")
13284 (set_attr "length" "12")])
13286 (define_insn "*and_neg_leu<mode>"
13287 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
13289 (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
13290 (match_operand:P 2 "reg_or_short_operand" "rI")))
13291 (match_operand:P 3 "gpc_reg_operand" "r")))]
13293 "subf%I2c %0,%1,%2\;subfe %0,%0,%0\;andc %0,%3,%0"
13294 [(set_attr "type" "three")
13295 (set_attr "length" "12")])
13298 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13301 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13302 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
13303 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13305 (clobber (match_scratch:SI 4 "=&r,&r"))]
13308 subf%I2c %4,%1,%2\;subfe %4,%4,%4\;andc. %4,%3,%4
13310 [(set_attr "type" "compare")
13311 (set_attr "length" "12,16")])
13314 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13317 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13318 (match_operand:SI 2 "reg_or_short_operand" "")))
13319 (match_operand:SI 3 "gpc_reg_operand" ""))
13321 (clobber (match_scratch:SI 4 ""))]
13322 "TARGET_32BIT && reload_completed"
13323 [(set (match_dup 4)
13324 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
13327 (compare:CC (match_dup 4)
13332 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13335 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13336 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
13337 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13339 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13340 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13343 subf%I2c %0,%1,%2\;subfe %0,%0,%0\;andc. %0,%3,%0
13345 [(set_attr "type" "compare")
13346 (set_attr "length" "12,16")])
13349 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13352 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13353 (match_operand:SI 2 "reg_or_short_operand" "")))
13354 (match_operand:SI 3 "gpc_reg_operand" ""))
13356 (set (match_operand:SI 0 "gpc_reg_operand" "")
13357 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13358 "TARGET_32BIT && reload_completed"
13359 [(set (match_dup 0)
13360 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
13363 (compare:CC (match_dup 0)
13367 (define_insn_and_split "*ltu<mode>"
13368 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13369 (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13370 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))]
13374 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
13375 (set (match_dup 0) (neg:P (match_dup 0)))]
13378 (define_insn_and_split "*ltu<mode>_compare"
13379 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
13381 (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
13382 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
13384 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
13385 (ltu:P (match_dup 1) (match_dup 2)))]
13389 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
13390 (parallel [(set (match_dup 3)
13391 (compare:CC (neg:P (match_dup 0)) (const_int 0)))
13392 (set (match_dup 0) (neg:P (match_dup 0)))])]
13395 (define_insn_and_split "*plus_ltu<mode>"
13396 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,r")
13397 (plus:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13398 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))
13399 (match_operand:P 3 "reg_or_short_operand" "rI,rI")))]
13402 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13403 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
13404 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))]
13407 (define_insn_and_split "*plus_ltu<mode>_compare"
13408 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13410 (plus:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
13411 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
13412 (match_operand:P 3 "gpc_reg_operand" "r,r,r,r"))
13414 (set (match_operand:P 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13415 (plus:P (ltu:P (match_dup 1) (match_dup 2)) (match_dup 3)))]
13418 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13419 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
13420 (parallel [(set (match_dup 4)
13421 (compare:CC (minus:P (match_dup 3) (match_dup 0))
13423 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))])]
13426 (define_insn "*neg_ltu<mode>"
13427 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13428 (neg:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13429 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))))]
13432 subfc %0,%2,%1\;subfe %0,%0,%0
13433 addic %0,%1,%n2\;subfe %0,%0,%0"
13434 [(set_attr "type" "two")
13435 (set_attr "length" "8")])
13437 (define_insn "*geu<mode>"
13438 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13439 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13440 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))]
13443 subfc %0,%2,%1\;li %0,0\;adde %0,%0,%0
13444 addic %0,%1,%n2\;li %0,0\;adde %0,%0,%0"
13445 [(set_attr "type" "three")
13446 (set_attr "length" "12")])
13448 (define_insn "*geu<mode>_compare"
13449 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
13451 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
13452 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
13454 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
13455 (geu:P (match_dup 1) (match_dup 2)))]
13458 subfc %0,%2,%1\;li %0,0\;adde. %0,%0,%0
13459 addic %0,%1,%n2\;li %0,0\;adde. %0,%0,%0
13462 [(set_attr "type" "compare")
13463 (set_attr "length" "12,12,16,16")])
13466 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
13468 (geu:P (match_operand:P 1 "gpc_reg_operand" "")
13469 (match_operand:P 2 "reg_or_neg_short_operand" ""))
13471 (set (match_operand:P 0 "gpc_reg_operand" "")
13472 (geu:P (match_dup 1) (match_dup 2)))]
13474 [(set (match_dup 0)
13475 (geu:P (match_dup 1) (match_dup 2)))
13477 (compare:CC (match_dup 0)
13481 (define_insn "*plus_geu<mode>"
13482 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,&r")
13483 (plus:P (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13484 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))
13485 (match_operand:P 3 "gpc_reg_operand" "r,r")))]
13488 subfc %0,%2,%1\;addze %0,%3
13489 addic %0,%1,%n2\;addze %0,%3"
13490 [(set_attr "type" "two")
13491 (set_attr "length" "8")])
13494 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13496 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13497 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
13498 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13500 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
13503 subfc %4,%2,%1\;addze. %4,%3
13504 addic %4,%1,%n2\;addze. %4,%3
13507 [(set_attr "type" "compare")
13508 (set_attr "length" "8,8,12,12")])
13511 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13513 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13514 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
13515 (match_operand:SI 3 "gpc_reg_operand" ""))
13517 (clobber (match_scratch:SI 4 ""))]
13518 "TARGET_32BIT && reload_completed"
13519 [(set (match_dup 4)
13520 (plus:SI (geu:SI (match_dup 1) (match_dup 2))
13523 (compare:CC (match_dup 4)
13528 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13530 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13531 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
13532 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13534 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13535 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13538 subfc %0,%2,%1\;addze. %0,%3
13539 addic %0,%1,%n2\;addze. %0,%3
13542 [(set_attr "type" "compare")
13543 (set_attr "length" "8,8,12,12")])
13546 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13548 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13549 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
13550 (match_operand:SI 3 "gpc_reg_operand" ""))
13552 (set (match_operand:SI 0 "gpc_reg_operand" "")
13553 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13554 "TARGET_32BIT && reload_completed"
13555 [(set (match_dup 0)
13556 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13558 (compare:CC (match_dup 0)
13562 (define_insn "*neg_geu<mode>"
13563 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13564 (neg:P (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13565 (match_operand:P 2 "reg_or_short_operand" "r,I"))))]
13568 subfc %0,%2,%1\;subfe %0,%0,%0\;nand %0,%0,%0
13569 subfic %0,%1,-1\;add%I2c %0,%0,%2\;subfe %0,%0,%0"
13570 [(set_attr "type" "three")
13571 (set_attr "length" "12")])
13573 (define_insn "*and_neg_geu<mode>"
13574 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,&r")
13576 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13577 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))
13578 (match_operand:P 3 "gpc_reg_operand" "r,r")))]
13581 subfc %0,%2,%1\;subfe %0,%0,%0\;andc %0,%3,%0
13582 addic %0,%1,%n2\;subfe %0,%0,%0\;andc %0,%3,%0"
13583 [(set_attr "type" "three")
13584 (set_attr "length" "12")])
13587 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13590 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13591 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
13592 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13594 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
13597 subfc %4,%2,%1\;subfe %4,%4,%4\;andc. %4,%3,%4
13598 addic %4,%1,%n2\;subfe %4,%4,%4\;andc. %4,%3,%4
13601 [(set_attr "type" "compare")
13602 (set_attr "length" "12,12,16,16")])
13605 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13608 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13609 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
13610 (match_operand:SI 3 "gpc_reg_operand" ""))
13612 (clobber (match_scratch:SI 4 ""))]
13613 "TARGET_32BIT && reload_completed"
13614 [(set (match_dup 4)
13615 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2)))
13618 (compare:CC (match_dup 4)
13623 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13626 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13627 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
13628 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13630 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13631 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13634 subfc %0,%2,%1\;subfe %0,%0,%0\;andc. %0,%3,%0
13635 addic %0,%1,%n2\;subfe %0,%0,%0\;andc. %0,%3,%0
13638 [(set_attr "type" "compare")
13639 (set_attr "length" "12,12,16,16")])
13642 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13645 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13646 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
13647 (match_operand:SI 3 "gpc_reg_operand" ""))
13649 (set (match_operand:SI 0 "gpc_reg_operand" "")
13650 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13651 "TARGET_32BIT && reload_completed"
13652 [(set (match_dup 0)
13653 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
13655 (compare:CC (match_dup 0)
13659 (define_insn "*plus_gt0<mode>"
13660 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
13661 (plus:P (gt:P (match_operand:P 1 "gpc_reg_operand" "r")
13663 (match_operand:P 2 "gpc_reg_operand" "r")))]
13665 "addc %0,%1,%1\;subfe %0,%1,%0\;addze %0,%2"
13666 [(set_attr "type" "three")
13667 (set_attr "length" "12")])
13670 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13672 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13674 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
13676 (clobber (match_scratch:SI 3 "=&r,&r"))]
13679 addc %3,%1,%1\;subfe %3,%1,%3\;addze. %3,%2
13681 [(set_attr "type" "compare")
13682 (set_attr "length" "12,16")])
13685 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13687 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13689 (match_operand:SI 2 "gpc_reg_operand" ""))
13691 (clobber (match_scratch:SI 3 ""))]
13692 "TARGET_32BIT && reload_completed"
13693 [(set (match_dup 3)
13694 (plus:SI (gt:SI (match_dup 1) (const_int 0))
13697 (compare:CC (match_dup 3)
13702 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13704 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13706 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
13708 (clobber (match_scratch:DI 3 "=&r,&r"))]
13711 addc %3,%1,%1\;subfe %3,%1,%3\;addze. %3,%2
13713 [(set_attr "type" "compare")
13714 (set_attr "length" "12,16")])
13717 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
13719 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
13721 (match_operand:DI 2 "gpc_reg_operand" ""))
13723 (clobber (match_scratch:DI 3 ""))]
13724 "TARGET_64BIT && reload_completed"
13725 [(set (match_dup 3)
13726 (plus:DI (gt:DI (match_dup 1) (const_int 0))
13729 (compare:CC (match_dup 3)
13734 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13736 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13738 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
13740 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13741 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
13744 addc %0,%1,%1\;subfe %0,%1,%0\;addze. %0,%2
13746 [(set_attr "type" "compare")
13747 (set_attr "length" "12,16")])
13750 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13752 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13754 (match_operand:SI 2 "gpc_reg_operand" ""))
13756 (set (match_operand:SI 0 "gpc_reg_operand" "")
13757 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
13758 "TARGET_32BIT && reload_completed"
13759 [(set (match_dup 0)
13760 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))
13762 (compare:CC (match_dup 0)
13767 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13769 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13771 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
13773 (set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
13774 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
13777 addc %0,%1,%1\;subfe %0,%1,%0\;addze. %0,%2
13779 [(set_attr "type" "compare")
13780 (set_attr "length" "12,16")])
13783 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
13785 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
13787 (match_operand:DI 2 "gpc_reg_operand" ""))
13789 (set (match_operand:DI 0 "gpc_reg_operand" "")
13790 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
13791 "TARGET_64BIT && reload_completed"
13792 [(set (match_dup 0)
13793 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))
13795 (compare:CC (match_dup 0)
13799 (define_insn_and_split "*gtu<mode>"
13800 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13801 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
13802 (match_operand:P 2 "reg_or_short_operand" "rI")))]
13806 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
13807 (set (match_dup 0) (neg:P (match_dup 0)))]
13810 (define_insn_and_split "*gtu<mode>_compare"
13811 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13813 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13814 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
13816 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13817 (gtu:P (match_dup 1) (match_dup 2)))]
13821 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
13822 (parallel [(set (match_dup 3)
13823 (compare:CC (neg:P (match_dup 0)) (const_int 0)))
13824 (set (match_dup 0) (neg:P (match_dup 0)))])]
13827 (define_insn_and_split "*plus_gtu<mode>"
13828 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
13829 (plus:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
13830 (match_operand:P 2 "reg_or_short_operand" "rI"))
13831 (match_operand:P 3 "reg_or_short_operand" "rI")))]
13834 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13835 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
13836 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))]
13839 (define_insn_and_split "*plus_gtu<mode>_compare"
13840 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13842 (plus:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
13843 (match_operand:P 2 "reg_or_short_operand" "I,r,I,r"))
13844 (match_operand:P 3 "gpc_reg_operand" "r,r,r,r"))
13846 (set (match_operand:P 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13847 (plus:P (gtu:P (match_dup 1) (match_dup 2)) (match_dup 3)))]
13850 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13851 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
13852 (parallel [(set (match_dup 4)
13853 (compare:CC (minus:P (match_dup 3) (match_dup 0))
13855 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))])]
13858 (define_insn "*neg_gtu<mode>"
13859 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13860 (neg:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
13861 (match_operand:P 2 "reg_or_short_operand" "rI"))))]
13863 "subf%I2c %0,%1,%2\;subfe %0,%0,%0"
13864 [(set_attr "type" "two")
13865 (set_attr "length" "8")])
13868 ;; Define both directions of branch and return. If we need a reload
13869 ;; register, we'd rather use CR0 since it is much easier to copy a
13870 ;; register CC value to there.
13874 (if_then_else (match_operator 1 "branch_comparison_operator"
13876 "cc_reg_operand" "y")
13878 (label_ref (match_operand 0 "" ""))
13883 return output_cbranch (operands[1], \"%l0\", 0, insn);
13885 [(set_attr "type" "branch")])
13889 (if_then_else (match_operator 0 "branch_comparison_operator"
13891 "cc_reg_operand" "y")
13898 return output_cbranch (operands[0], NULL, 0, insn);
13900 [(set_attr "type" "jmpreg")
13901 (set_attr "length" "4")])
13905 (if_then_else (match_operator 1 "branch_comparison_operator"
13907 "cc_reg_operand" "y")
13910 (label_ref (match_operand 0 "" ""))))]
13914 return output_cbranch (operands[1], \"%l0\", 1, insn);
13916 [(set_attr "type" "branch")])
13920 (if_then_else (match_operator 0 "branch_comparison_operator"
13922 "cc_reg_operand" "y")
13929 return output_cbranch (operands[0], NULL, 1, insn);
13931 [(set_attr "type" "jmpreg")
13932 (set_attr "length" "4")])
13934 ;; Logic on condition register values.
13936 ; This pattern matches things like
13937 ; (set (reg:CCEQ 68) (compare:CCEQ (ior:SI (gt:SI (reg:CCFP 68) (const_int 0))
13938 ; (eq:SI (reg:CCFP 68) (const_int 0)))
13940 ; which are generated by the branch logic.
13941 ; Prefer destructive operations where BT = BB (for crXX BT,BA,BB)
13943 (define_insn "*cceq_ior_compare"
13944 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13945 (compare:CCEQ (match_operator:SI 1 "boolean_operator"
13946 [(match_operator:SI 2
13947 "branch_positive_comparison_operator"
13949 "cc_reg_operand" "y,y")
13951 (match_operator:SI 4
13952 "branch_positive_comparison_operator"
13954 "cc_reg_operand" "0,y")
13958 "cr%q1 %E0,%j2,%j4"
13959 [(set_attr "type" "cr_logical,delayed_cr")])
13961 ; Why is the constant -1 here, but 1 in the previous pattern?
13962 ; Because ~1 has all but the low bit set.
13964 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13965 (compare:CCEQ (match_operator:SI 1 "boolean_or_operator"
13966 [(not:SI (match_operator:SI 2
13967 "branch_positive_comparison_operator"
13969 "cc_reg_operand" "y,y")
13971 (match_operator:SI 4
13972 "branch_positive_comparison_operator"
13974 "cc_reg_operand" "0,y")
13978 "cr%q1 %E0,%j2,%j4"
13979 [(set_attr "type" "cr_logical,delayed_cr")])
13981 (define_insn "*cceq_rev_compare"
13982 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13983 (compare:CCEQ (match_operator:SI 1
13984 "branch_positive_comparison_operator"
13986 "cc_reg_operand" "0,y")
13991 [(set_attr "type" "cr_logical,delayed_cr")])
13993 ;; If we are comparing the result of two comparisons, this can be done
13994 ;; using creqv or crxor.
13996 (define_insn_and_split ""
13997 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
13998 (compare:CCEQ (match_operator 1 "branch_comparison_operator"
13999 [(match_operand 2 "cc_reg_operand" "y")
14001 (match_operator 3 "branch_comparison_operator"
14002 [(match_operand 4 "cc_reg_operand" "y")
14007 [(set (match_dup 0) (compare:CCEQ (xor:SI (match_dup 1) (match_dup 3))
14011 int positive_1, positive_2;
14013 positive_1 = branch_positive_comparison_operator (operands[1],
14014 GET_MODE (operands[1]));
14015 positive_2 = branch_positive_comparison_operator (operands[3],
14016 GET_MODE (operands[3]));
14019 operands[1] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[2]),
14020 GET_CODE (operands[1])),
14022 operands[2], const0_rtx);
14023 else if (GET_MODE (operands[1]) != SImode)
14024 operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]), SImode,
14025 operands[2], const0_rtx);
14028 operands[3] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[4]),
14029 GET_CODE (operands[3])),
14031 operands[4], const0_rtx);
14032 else if (GET_MODE (operands[3]) != SImode)
14033 operands[3] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
14034 operands[4], const0_rtx);
14036 if (positive_1 == positive_2)
14038 operands[1] = gen_rtx_NOT (SImode, operands[1]);
14039 operands[5] = constm1_rtx;
14043 operands[5] = const1_rtx;
14047 ;; Unconditional branch and return.
14049 (define_insn "jump"
14051 (label_ref (match_operand 0 "" "")))]
14054 [(set_attr "type" "branch")])
14056 (define_insn "<return_str>return"
14060 [(set_attr "type" "jmpreg")])
14062 (define_expand "indirect_jump"
14063 [(set (pc) (match_operand 0 "register_operand" ""))])
14065 (define_insn "*indirect_jump<mode>"
14066 [(set (pc) (match_operand:P 0 "register_operand" "c,*l"))]
14071 [(set_attr "type" "jmpreg")])
14073 ;; Table jump for switch statements:
14074 (define_expand "tablejump"
14075 [(use (match_operand 0 "" ""))
14076 (use (label_ref (match_operand 1 "" "")))]
14081 emit_jump_insn (gen_tablejumpsi (operands[0], operands[1]));
14083 emit_jump_insn (gen_tablejumpdi (operands[0], operands[1]));
14087 (define_expand "tablejumpsi"
14088 [(set (match_dup 3)
14089 (plus:SI (match_operand:SI 0 "" "")
14091 (parallel [(set (pc) (match_dup 3))
14092 (use (label_ref (match_operand 1 "" "")))])]
14095 { operands[0] = force_reg (SImode, operands[0]);
14096 operands[2] = force_reg (SImode, gen_rtx_LABEL_REF (SImode, operands[1]));
14097 operands[3] = gen_reg_rtx (SImode);
14100 (define_expand "tablejumpdi"
14101 [(set (match_dup 4)
14102 (sign_extend:DI (match_operand:SI 0 "lwa_operand" "")))
14104 (plus:DI (match_dup 4)
14106 (parallel [(set (pc) (match_dup 3))
14107 (use (label_ref (match_operand 1 "" "")))])]
14110 { operands[2] = force_reg (DImode, gen_rtx_LABEL_REF (DImode, operands[1]));
14111 operands[3] = gen_reg_rtx (DImode);
14112 operands[4] = gen_reg_rtx (DImode);
14115 (define_insn "*tablejump<mode>_internal1"
14117 (match_operand:P 0 "register_operand" "c,*l"))
14118 (use (label_ref (match_operand 1 "" "")))]
14123 [(set_attr "type" "jmpreg")])
14130 (define_insn "group_ending_nop"
14131 [(unspec [(const_int 0)] UNSPEC_GRP_END_NOP)]
14135 if (rs6000_cpu_attr == CPU_POWER6)
14136 return \"ori 1,1,0\";
14137 return \"ori 2,2,0\";
14140 ;; Define the subtract-one-and-jump insns, starting with the template
14141 ;; so loop.c knows what to generate.
14143 (define_expand "doloop_end"
14144 [(use (match_operand 0 "" "")) ; loop pseudo
14145 (use (match_operand 1 "" "")) ; iterations; zero if unknown
14146 (use (match_operand 2 "" "")) ; max iterations
14147 (use (match_operand 3 "" "")) ; loop level
14148 (use (match_operand 4 "" "")) ; label
14149 (use (match_operand 5 "" ""))] ; flag: 1 if loop entered at top, else 0
14153 /* Only use this on innermost loops. */
14154 if (INTVAL (operands[3]) > 1)
14158 if (GET_MODE (operands[0]) != DImode)
14160 emit_jump_insn (gen_ctrdi (operands[0], operands[4]));
14164 if (GET_MODE (operands[0]) != SImode)
14166 emit_jump_insn (gen_ctrsi (operands[0], operands[4]));
14171 (define_expand "ctr<mode>"
14172 [(parallel [(set (pc)
14173 (if_then_else (ne (match_operand:P 0 "register_operand" "")
14175 (label_ref (match_operand 1 "" ""))
14178 (plus:P (match_dup 0)
14180 (clobber (match_scratch:CC 2 ""))
14181 (clobber (match_scratch:P 3 ""))])]
14185 ;; We need to be able to do this for any operand, including MEM, or we
14186 ;; will cause reload to blow up since we don't allow output reloads on
14188 ;; For the length attribute to be calculated correctly, the
14189 ;; label MUST be operand 0.
14191 (define_insn "*ctr<mode>_internal1"
14193 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
14195 (label_ref (match_operand 0 "" ""))
14197 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*c*l")
14198 (plus:P (match_dup 1)
14200 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14201 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
14205 if (which_alternative != 0)
14207 else if (get_attr_length (insn) == 4)
14208 return \"bdnz %l0\";
14210 return \"bdz $+8\;b %l0\";
14212 [(set_attr "type" "branch")
14213 (set_attr "length" "*,12,16,16")])
14215 (define_insn "*ctr<mode>_internal2"
14217 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
14220 (label_ref (match_operand 0 "" ""))))
14221 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*c*l")
14222 (plus:P (match_dup 1)
14224 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14225 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
14229 if (which_alternative != 0)
14231 else if (get_attr_length (insn) == 4)
14232 return \"bdz %l0\";
14234 return \"bdnz $+8\;b %l0\";
14236 [(set_attr "type" "branch")
14237 (set_attr "length" "*,12,16,16")])
14239 ;; Similar but use EQ
14241 (define_insn "*ctr<mode>_internal5"
14243 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
14245 (label_ref (match_operand 0 "" ""))
14247 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*c*l")
14248 (plus:P (match_dup 1)
14250 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14251 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
14255 if (which_alternative != 0)
14257 else if (get_attr_length (insn) == 4)
14258 return \"bdz %l0\";
14260 return \"bdnz $+8\;b %l0\";
14262 [(set_attr "type" "branch")
14263 (set_attr "length" "*,12,16,16")])
14265 (define_insn "*ctr<mode>_internal6"
14267 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
14270 (label_ref (match_operand 0 "" ""))))
14271 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*c*l")
14272 (plus:P (match_dup 1)
14274 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14275 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
14279 if (which_alternative != 0)
14281 else if (get_attr_length (insn) == 4)
14282 return \"bdnz %l0\";
14284 return \"bdz $+8\;b %l0\";
14286 [(set_attr "type" "branch")
14287 (set_attr "length" "*,12,16,16")])
14289 ;; Now the splitters if we could not allocate the CTR register
14293 (if_then_else (match_operator 2 "comparison_operator"
14294 [(match_operand:P 1 "gpc_reg_operand" "")
14296 (match_operand 5 "" "")
14297 (match_operand 6 "" "")))
14298 (set (match_operand:P 0 "gpc_reg_operand" "")
14299 (plus:P (match_dup 1) (const_int -1)))
14300 (clobber (match_scratch:CC 3 ""))
14301 (clobber (match_scratch:P 4 ""))]
14303 [(parallel [(set (match_dup 3)
14304 (compare:CC (plus:P (match_dup 1)
14308 (plus:P (match_dup 1)
14310 (set (pc) (if_then_else (match_dup 7)
14314 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
14315 operands[3], const0_rtx); }")
14319 (if_then_else (match_operator 2 "comparison_operator"
14320 [(match_operand:P 1 "gpc_reg_operand" "")
14322 (match_operand 5 "" "")
14323 (match_operand 6 "" "")))
14324 (set (match_operand:P 0 "nonimmediate_operand" "")
14325 (plus:P (match_dup 1) (const_int -1)))
14326 (clobber (match_scratch:CC 3 ""))
14327 (clobber (match_scratch:P 4 ""))]
14328 "reload_completed && ! gpc_reg_operand (operands[0], SImode)"
14329 [(parallel [(set (match_dup 3)
14330 (compare:CC (plus:P (match_dup 1)
14334 (plus:P (match_dup 1)
14338 (set (pc) (if_then_else (match_dup 7)
14342 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
14343 operands[3], const0_rtx); }")
14345 (define_insn "trap"
14346 [(trap_if (const_int 1) (const_int 0))]
14349 [(set_attr "type" "trap")])
14351 (define_expand "ctrap<mode>4"
14352 [(trap_if (match_operator 0 "ordered_comparison_operator"
14353 [(match_operand:GPR 1 "register_operand")
14354 (match_operand:GPR 2 "reg_or_short_operand")])
14355 (match_operand 3 "zero_constant" ""))]
14360 [(trap_if (match_operator 0 "ordered_comparison_operator"
14361 [(match_operand:GPR 1 "register_operand" "r")
14362 (match_operand:GPR 2 "reg_or_short_operand" "rI")])
14365 "t<wd>%V0%I2 %1,%2"
14366 [(set_attr "type" "trap")])
14368 ;; Insns related to generating the function prologue and epilogue.
14370 (define_expand "prologue"
14371 [(use (const_int 0))]
14374 rs6000_emit_prologue ();
14375 if (!TARGET_SCHED_PROLOG)
14376 emit_insn (gen_blockage ());
14380 (define_insn "*movesi_from_cr_one"
14381 [(match_parallel 0 "mfcr_operation"
14382 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
14383 (unspec:SI [(match_operand:CC 2 "cc_reg_operand" "y")
14384 (match_operand 3 "immediate_operand" "n")]
14385 UNSPEC_MOVESI_FROM_CR))])]
14391 for (i = 0; i < XVECLEN (operands[0], 0); i++)
14393 mask = INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
14394 operands[4] = GEN_INT (mask);
14395 output_asm_insn (\"mfcr %1,%4\", operands);
14399 [(set_attr "type" "mfcrf")])
14401 (define_insn "movesi_from_cr"
14402 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14403 (unspec:SI [(reg:CC CR0_REGNO) (reg:CC CR1_REGNO)
14404 (reg:CC CR2_REGNO) (reg:CC CR3_REGNO)
14405 (reg:CC CR4_REGNO) (reg:CC CR5_REGNO)
14406 (reg:CC CR6_REGNO) (reg:CC CR7_REGNO)]
14407 UNSPEC_MOVESI_FROM_CR))]
14410 [(set_attr "type" "mfcr")])
14412 (define_insn "*stmw"
14413 [(match_parallel 0 "stmw_operation"
14414 [(set (match_operand:SI 1 "memory_operand" "=m")
14415 (match_operand:SI 2 "gpc_reg_operand" "r"))])]
14418 [(set_attr "type" "store_ux")])
14420 ; The following comment applies to:
14424 ; return_and_restore_gpregs*
14425 ; return_and_restore_fpregs*
14426 ; return_and_restore_fpregs_aix*
14428 ; The out-of-line save / restore functions expects one input argument.
14429 ; Since those are not standard call_insn's, we must avoid using
14430 ; MATCH_OPERAND for that argument. That way the register rename
14431 ; optimization will not try to rename this register.
14432 ; Each pattern is repeated for each possible register number used in
14433 ; various ABIs (r11, r1, and for some functions r12)
14435 (define_insn "*save_gpregs_<mode>_r11"
14436 [(match_parallel 0 "any_parallel_operand"
14437 [(clobber (reg:P 65))
14438 (use (match_operand:P 1 "symbol_ref_operand" "s"))
14440 (set (match_operand:P 2 "memory_operand" "=m")
14441 (match_operand:P 3 "gpc_reg_operand" "r"))])]
14444 [(set_attr "type" "branch")
14445 (set_attr "length" "4")])
14447 (define_insn "*save_gpregs_<mode>_r12"
14448 [(match_parallel 0 "any_parallel_operand"
14449 [(clobber (reg:P 65))
14450 (use (match_operand:P 1 "symbol_ref_operand" "s"))
14452 (set (match_operand:P 2 "memory_operand" "=m")
14453 (match_operand:P 3 "gpc_reg_operand" "r"))])]
14456 [(set_attr "type" "branch")
14457 (set_attr "length" "4")])
14459 (define_insn "*save_gpregs_<mode>_r1"
14460 [(match_parallel 0 "any_parallel_operand"
14461 [(clobber (reg:P 65))
14462 (use (match_operand:P 1 "symbol_ref_operand" "s"))
14464 (set (match_operand:P 2 "memory_operand" "=m")
14465 (match_operand:P 3 "gpc_reg_operand" "r"))])]
14468 [(set_attr "type" "branch")
14469 (set_attr "length" "4")])
14471 (define_insn "*save_fpregs_<mode>_r11"
14472 [(match_parallel 0 "any_parallel_operand"
14473 [(clobber (reg:P 65))
14474 (use (match_operand:P 1 "symbol_ref_operand" "s"))
14476 (set (match_operand:DF 2 "memory_operand" "=m")
14477 (match_operand:DF 3 "gpc_reg_operand" "d"))])]
14480 [(set_attr "type" "branch")
14481 (set_attr "length" "4")])
14483 (define_insn "*save_fpregs_<mode>_r12"
14484 [(match_parallel 0 "any_parallel_operand"
14485 [(clobber (reg:P 65))
14486 (use (match_operand:P 1 "symbol_ref_operand" "s"))
14488 (set (match_operand:DF 2 "memory_operand" "=m")
14489 (match_operand:DF 3 "gpc_reg_operand" "d"))])]
14492 [(set_attr "type" "branch")
14493 (set_attr "length" "4")])
14495 (define_insn "*save_fpregs_<mode>_r1"
14496 [(match_parallel 0 "any_parallel_operand"
14497 [(clobber (reg:P 65))
14498 (use (match_operand:P 1 "symbol_ref_operand" "s"))
14500 (set (match_operand:DF 2 "memory_operand" "=m")
14501 (match_operand:DF 3 "gpc_reg_operand" "d"))])]
14504 [(set_attr "type" "branch")
14505 (set_attr "length" "4")])
14507 ; This is to explain that changes to the stack pointer should
14508 ; not be moved over loads from or stores to stack memory.
14509 (define_insn "stack_tie"
14510 [(match_parallel 0 "tie_operand"
14511 [(set (mem:BLK (reg 1)) (const_int 0))])]
14514 [(set_attr "length" "0")])
14516 (define_expand "epilogue"
14517 [(use (const_int 0))]
14520 if (!TARGET_SCHED_PROLOG)
14521 emit_insn (gen_blockage ());
14522 rs6000_emit_epilogue (FALSE);
14526 ; On some processors, doing the mtcrf one CC register at a time is
14527 ; faster (like on the 604e). On others, doing them all at once is
14528 ; faster; for instance, on the 601 and 750.
14530 (define_expand "movsi_to_cr_one"
14531 [(set (match_operand:CC 0 "cc_reg_operand" "")
14532 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "")
14533 (match_dup 2)] UNSPEC_MOVESI_TO_CR))]
14535 "operands[2] = GEN_INT (1 << (75 - REGNO (operands[0])));")
14537 (define_insn "*movsi_to_cr"
14538 [(match_parallel 0 "mtcrf_operation"
14539 [(set (match_operand:CC 1 "cc_reg_operand" "=y")
14540 (unspec:CC [(match_operand:SI 2 "gpc_reg_operand" "r")
14541 (match_operand 3 "immediate_operand" "n")]
14542 UNSPEC_MOVESI_TO_CR))])]
14548 for (i = 0; i < XVECLEN (operands[0], 0); i++)
14549 mask |= INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
14550 operands[4] = GEN_INT (mask);
14551 return \"mtcrf %4,%2\";
14553 [(set_attr "type" "mtcr")])
14555 (define_insn "*mtcrfsi"
14556 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
14557 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
14558 (match_operand 2 "immediate_operand" "n")]
14559 UNSPEC_MOVESI_TO_CR))]
14560 "GET_CODE (operands[0]) == REG
14561 && CR_REGNO_P (REGNO (operands[0]))
14562 && GET_CODE (operands[2]) == CONST_INT
14563 && INTVAL (operands[2]) == 1 << (75 - REGNO (operands[0]))"
14565 [(set_attr "type" "mtcr")])
14567 ; The load-multiple instructions have similar properties.
14568 ; Note that "load_multiple" is a name known to the machine-independent
14569 ; code that actually corresponds to the PowerPC load-string.
14571 (define_insn "*lmw"
14572 [(match_parallel 0 "lmw_operation"
14573 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
14574 (match_operand:SI 2 "memory_operand" "m"))])]
14577 [(set_attr "type" "load_ux")
14578 (set_attr "cell_micro" "always")])
14580 (define_insn "*return_internal_<mode>"
14582 (use (match_operand:P 0 "register_operand" "lc"))]
14585 [(set_attr "type" "jmpreg")])
14587 ; FIXME: This would probably be somewhat simpler if the Cygnus sibcall
14588 ; stuff was in GCC. Oh, and "any_parallel_operand" is a bit flexible...
14590 ; The following comment applies to:
14594 ; return_and_restore_gpregs*
14595 ; return_and_restore_fpregs*
14596 ; return_and_restore_fpregs_aix*
14598 ; The out-of-line save / restore functions expects one input argument.
14599 ; Since those are not standard call_insn's, we must avoid using
14600 ; MATCH_OPERAND for that argument. That way the register rename
14601 ; optimization will not try to rename this register.
14602 ; Each pattern is repeated for each possible register number used in
14603 ; various ABIs (r11, r1, and for some functions r12)
14605 (define_insn "*restore_gpregs_<mode>_r11"
14606 [(match_parallel 0 "any_parallel_operand"
14607 [(clobber (match_operand:P 1 "register_operand" "=l"))
14608 (use (match_operand:P 2 "symbol_ref_operand" "s"))
14610 (set (match_operand:P 3 "gpc_reg_operand" "=r")
14611 (match_operand:P 4 "memory_operand" "m"))])]
14614 [(set_attr "type" "branch")
14615 (set_attr "length" "4")])
14617 (define_insn "*restore_gpregs_<mode>_r12"
14618 [(match_parallel 0 "any_parallel_operand"
14619 [(clobber (match_operand:P 1 "register_operand" "=l"))
14620 (use (match_operand:P 2 "symbol_ref_operand" "s"))
14622 (set (match_operand:P 3 "gpc_reg_operand" "=r")
14623 (match_operand:P 4 "memory_operand" "m"))])]
14626 [(set_attr "type" "branch")
14627 (set_attr "length" "4")])
14629 (define_insn "*restore_gpregs_<mode>_r1"
14630 [(match_parallel 0 "any_parallel_operand"
14631 [(clobber (match_operand:P 1 "register_operand" "=l"))
14632 (use (match_operand:P 2 "symbol_ref_operand" "s"))
14634 (set (match_operand:P 3 "gpc_reg_operand" "=r")
14635 (match_operand:P 4 "memory_operand" "m"))])]
14638 [(set_attr "type" "branch")
14639 (set_attr "length" "4")])
14641 (define_insn "*return_and_restore_gpregs_<mode>_r11"
14642 [(match_parallel 0 "any_parallel_operand"
14644 (clobber (match_operand:P 1 "register_operand" "=l"))
14645 (use (match_operand:P 2 "symbol_ref_operand" "s"))
14647 (set (match_operand:P 3 "gpc_reg_operand" "=r")
14648 (match_operand:P 4 "memory_operand" "m"))])]
14651 [(set_attr "type" "branch")
14652 (set_attr "length" "4")])
14654 (define_insn "*return_and_restore_gpregs_<mode>_r12"
14655 [(match_parallel 0 "any_parallel_operand"
14657 (clobber (match_operand:P 1 "register_operand" "=l"))
14658 (use (match_operand:P 2 "symbol_ref_operand" "s"))
14660 (set (match_operand:P 3 "gpc_reg_operand" "=r")
14661 (match_operand:P 4 "memory_operand" "m"))])]
14664 [(set_attr "type" "branch")
14665 (set_attr "length" "4")])
14667 (define_insn "*return_and_restore_gpregs_<mode>_r1"
14668 [(match_parallel 0 "any_parallel_operand"
14670 (clobber (match_operand:P 1 "register_operand" "=l"))
14671 (use (match_operand:P 2 "symbol_ref_operand" "s"))
14673 (set (match_operand:P 3 "gpc_reg_operand" "=r")
14674 (match_operand:P 4 "memory_operand" "m"))])]
14677 [(set_attr "type" "branch")
14678 (set_attr "length" "4")])
14680 (define_insn "*return_and_restore_fpregs_<mode>_r11"
14681 [(match_parallel 0 "any_parallel_operand"
14683 (clobber (match_operand:P 1 "register_operand" "=l"))
14684 (use (match_operand:P 2 "symbol_ref_operand" "s"))
14686 (set (match_operand:DF 3 "gpc_reg_operand" "=d")
14687 (match_operand:DF 4 "memory_operand" "m"))])]
14690 [(set_attr "type" "branch")
14691 (set_attr "length" "4")])
14693 (define_insn "*return_and_restore_fpregs_<mode>_r12"
14694 [(match_parallel 0 "any_parallel_operand"
14696 (clobber (match_operand:P 1 "register_operand" "=l"))
14697 (use (match_operand:P 2 "symbol_ref_operand" "s"))
14699 (set (match_operand:DF 3 "gpc_reg_operand" "=d")
14700 (match_operand:DF 4 "memory_operand" "m"))])]
14703 [(set_attr "type" "branch")
14704 (set_attr "length" "4")])
14706 (define_insn "*return_and_restore_fpregs_<mode>_r1"
14707 [(match_parallel 0 "any_parallel_operand"
14709 (clobber (match_operand:P 1 "register_operand" "=l"))
14710 (use (match_operand:P 2 "symbol_ref_operand" "s"))
14712 (set (match_operand:DF 3 "gpc_reg_operand" "=d")
14713 (match_operand:DF 4 "memory_operand" "m"))])]
14716 [(set_attr "type" "branch")
14717 (set_attr "length" "4")])
14719 (define_insn "*return_and_restore_fpregs_aix_<mode>_r11"
14720 [(match_parallel 0 "any_parallel_operand"
14722 (use (match_operand:P 1 "register_operand" "l"))
14723 (use (match_operand:P 2 "symbol_ref_operand" "s"))
14725 (set (match_operand:DF 3 "gpc_reg_operand" "=d")
14726 (match_operand:DF 4 "memory_operand" "m"))])]
14729 [(set_attr "type" "branch")
14730 (set_attr "length" "4")])
14732 (define_insn "*return_and_restore_fpregs_aix_<mode>_r1"
14733 [(match_parallel 0 "any_parallel_operand"
14735 (use (match_operand:P 1 "register_operand" "l"))
14736 (use (match_operand:P 2 "symbol_ref_operand" "s"))
14738 (set (match_operand:DF 3 "gpc_reg_operand" "=d")
14739 (match_operand:DF 4 "memory_operand" "m"))])]
14742 [(set_attr "type" "branch")
14743 (set_attr "length" "4")])
14745 ; This is used in compiling the unwind routines.
14746 (define_expand "eh_return"
14747 [(use (match_operand 0 "general_operand" ""))]
14752 emit_insn (gen_eh_set_lr_si (operands[0]));
14754 emit_insn (gen_eh_set_lr_di (operands[0]));
14758 ; We can't expand this before we know where the link register is stored.
14759 (define_insn "eh_set_lr_<mode>"
14760 [(unspec_volatile [(match_operand:P 0 "register_operand" "r")]
14762 (clobber (match_scratch:P 1 "=&b"))]
14767 [(unspec_volatile [(match_operand 0 "register_operand" "")] UNSPECV_EH_RR)
14768 (clobber (match_scratch 1 ""))]
14773 rs6000_emit_eh_reg_restore (operands[0], operands[1]);
14777 (define_insn "prefetch"
14778 [(prefetch (match_operand 0 "indexed_or_indirect_address" "a")
14779 (match_operand:SI 1 "const_int_operand" "n")
14780 (match_operand:SI 2 "const_int_operand" "n"))]
14784 if (GET_CODE (operands[0]) == REG)
14785 return INTVAL (operands[1]) ? \"dcbtst 0,%0\" : \"dcbt 0,%0\";
14786 return INTVAL (operands[1]) ? \"dcbtst %a0\" : \"dcbt %a0\";
14788 [(set_attr "type" "load")])
14790 (define_insn "bpermd_<mode>"
14791 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
14792 (unspec:P [(match_operand:P 1 "gpc_reg_operand" "r")
14793 (match_operand:P 2 "gpc_reg_operand" "r")] UNSPEC_BPERM))]
14796 [(set_attr "type" "popcnt")])
14799 ;; Builtin fma support. Handle
14800 ;; Note that the conditions for expansion are in the FMA_F iterator.
14802 (define_expand "fma<mode>4"
14803 [(set (match_operand:FMA_F 0 "register_operand" "")
14805 (match_operand:FMA_F 1 "register_operand" "")
14806 (match_operand:FMA_F 2 "register_operand" "")
14807 (match_operand:FMA_F 3 "register_operand" "")))]
14811 ; Altivec only has fma and nfms.
14812 (define_expand "fms<mode>4"
14813 [(set (match_operand:FMA_F 0 "register_operand" "")
14815 (match_operand:FMA_F 1 "register_operand" "")
14816 (match_operand:FMA_F 2 "register_operand" "")
14817 (neg:FMA_F (match_operand:FMA_F 3 "register_operand" ""))))]
14818 "!VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
14821 ;; If signed zeros are ignored, -(a * b - c) = -a * b + c.
14822 (define_expand "fnma<mode>4"
14823 [(set (match_operand:FMA_F 0 "register_operand" "")
14826 (match_operand:FMA_F 1 "register_operand" "")
14827 (match_operand:FMA_F 2 "register_operand" "")
14828 (neg:FMA_F (match_operand:FMA_F 3 "register_operand" "")))))]
14829 "!HONOR_SIGNED_ZEROS (<MODE>mode)"
14832 ;; If signed zeros are ignored, -(a * b + c) = -a * b - c.
14833 (define_expand "fnms<mode>4"
14834 [(set (match_operand:FMA_F 0 "register_operand" "")
14837 (match_operand:FMA_F 1 "register_operand" "")
14838 (match_operand:FMA_F 2 "register_operand" "")
14839 (match_operand:FMA_F 3 "register_operand" ""))))]
14840 "!HONOR_SIGNED_ZEROS (<MODE>mode) && !VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
14843 ; Not an official optab name, but used from builtins.
14844 (define_expand "nfma<mode>4"
14845 [(set (match_operand:FMA_F 0 "register_operand" "")
14848 (match_operand:FMA_F 1 "register_operand" "")
14849 (match_operand:FMA_F 2 "register_operand" "")
14850 (match_operand:FMA_F 3 "register_operand" ""))))]
14851 "!VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
14854 ; Not an official optab name, but used from builtins.
14855 (define_expand "nfms<mode>4"
14856 [(set (match_operand:FMA_F 0 "register_operand" "")
14859 (match_operand:FMA_F 1 "register_operand" "")
14860 (match_operand:FMA_F 2 "register_operand" "")
14861 (neg:FMA_F (match_operand:FMA_F 3 "register_operand" "")))))]
14865 (define_expand "rs6000_get_timebase"
14866 [(use (match_operand:DI 0 "gpc_reg_operand" ""))]
14869 if (TARGET_POWERPC64)
14870 emit_insn (gen_rs6000_mftb_di (operands[0]));
14872 emit_insn (gen_rs6000_get_timebase_ppc32 (operands[0]));
14876 (define_insn "rs6000_get_timebase_ppc32"
14877 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
14878 (unspec_volatile:DI [(const_int 0)] UNSPECV_MFTB))
14879 (clobber (match_scratch:SI 1 "=r"))
14880 (clobber (match_scratch:CC 2 "=y"))]
14881 "!TARGET_POWERPC64"
14883 if (WORDS_BIG_ENDIAN)
14886 return "mfspr %0,269\;"
14894 return "mftbu %0\;"
14903 return "mfspr %L0,269\;"
14911 return "mftbu %L0\;"
14919 (define_insn "rs6000_mftb_<mode>"
14920 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
14921 (unspec_volatile:P [(const_int 0)] UNSPECV_MFTB))]
14925 return "mfspr %0,268";
14932 (include "sync.md")
14933 (include "vector.md")
14935 (include "altivec.md")
14938 (include "paired.md")
14939 (include "crypto.md")