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.
28 [(STACK_POINTER_REGNUM 1)
30 (STATIC_CHAIN_REGNUM 11)
31 (HARD_FRAME_POINTER_REGNUM 31)
34 (ARG_POINTER_REGNUM 67)
45 (FIRST_ALTIVEC_REGNO 77)
46 (LAST_ALTIVEC_REGNO 108)
51 (FRAME_POINTER_REGNUM 113)
53 ; ABI defined stack offsets for storing the TOC pointer with AIX calls.
54 (TOC_SAVE_OFFSET_32BIT 20)
55 (TOC_SAVE_OFFSET_64BIT 40)
57 ; Function TOC offset in the AIX function descriptor.
58 (AIX_FUNC_DESC_TOC_32BIT 4)
59 (AIX_FUNC_DESC_TOC_64BIT 8)
61 ; Static chain offset in the AIX function descriptor.
62 (AIX_FUNC_DESC_SC_32BIT 8)
63 (AIX_FUNC_DESC_SC_64BIT 16)
70 (define_c_enum "unspec"
71 [UNSPEC_FRSP ; frsp for POWER machines
72 UNSPEC_PROBE_STACK ; probe stack memory reference
73 UNSPEC_TOCPTR ; address of a word pointing to the TOC
74 UNSPEC_TOC ; address of the TOC (more-or-less)
76 UNSPEC_MV_CR_OV ; move_from_CR_ov_bit
82 UNSPEC_LD_MPIC ; load_macho_picbase
83 UNSPEC_MPIC_CORRECT ; macho_correct_pic
97 UNSPEC_FIX_TRUNC_TF ; fadd, rounding towards zero
98 UNSPEC_MV_CR_GT ; move_from_CR_gt_bit
116 UNSPEC_MACHOPIC_OFFSET
129 ;; UNSPEC_VOLATILE usage
132 (define_c_enum "unspecv"
134 UNSPECV_LL ; load-locked
135 UNSPECV_SC ; store-conditional
136 UNSPECV_PROBE_STACK_RANGE ; probe range of stack addresses
137 UNSPECV_EH_RR ; eh_reg_restore
138 UNSPECV_ISYNC ; isync instruction
139 UNSPECV_MFTB ; move from time base
143 ;; Define an insn type attribute. This is used in function unit delay
145 (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"
146 (const_string "integer"))
148 ;; Define floating point instruction sub-types for use with Xfpu.md
149 (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"))
151 ;; Length (in bytes).
152 ; '(pc)' in the following doesn't include the instruction itself; it is
153 ; calculated as if the instruction had zero size.
154 (define_attr "length" ""
155 (if_then_else (eq_attr "type" "branch")
156 (if_then_else (and (ge (minus (match_dup 0) (pc))
158 (lt (minus (match_dup 0) (pc))
164 ;; Processor type -- this attribute must exactly match the processor_type
165 ;; enumeration in rs6000.h.
167 (define_attr "cpu" "rs64a,mpccore,ppc403,ppc405,ppc440,ppc476,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630,ppc750,ppc7400,ppc7450,ppc8540,ppc8548,ppce300c2,ppce300c3,ppce500mc,ppce500mc64,ppce5500,ppce6500,power4,power5,power6,power7,cell,ppca2,titan"
168 (const (symbol_ref "rs6000_cpu_attr")))
171 ;; If this instruction is microcoded on the CELL processor
172 ; The default for load extended, the recorded instructions and rotate/shifts by a variable is always microcoded
173 (define_attr "cell_micro" "not,conditional,always"
174 (if_then_else (eq_attr "type" "compare,delayed_compare,imul_compare,lmul_compare,load_ext,load_ext_ux,var_shift_rotate,var_delayed_compare")
175 (const_string "always")
176 (const_string "not")))
178 (automata_option "ndfa")
191 (include "e300c2c3.md")
192 (include "e500mc.md")
193 (include "e500mc64.md")
196 (include "power4.md")
197 (include "power5.md")
198 (include "power6.md")
199 (include "power7.md")
205 (include "predicates.md")
206 (include "constraints.md")
208 (include "darwin.md")
213 ; This mode iterator allows :GPR to be used to indicate the allowable size
214 ; of whole values in GPRs.
215 (define_mode_iterator GPR [SI (DI "TARGET_POWERPC64")])
217 ; Any supported integer mode.
218 (define_mode_iterator INT [QI HI SI DI TI])
220 ; Any supported integer mode that fits in one register.
221 (define_mode_iterator INT1 [QI HI SI (DI "TARGET_POWERPC64")])
223 ; extend modes for DImode
224 (define_mode_iterator QHSI [QI HI SI])
226 ; SImode or DImode, even if DImode doesn't fit in GPRs.
227 (define_mode_iterator SDI [SI DI])
229 ; The size of a pointer. Also, the size of the value that a record-condition
230 ; (one with a '.') will compare; and the size used for arithmetic carries.
231 (define_mode_iterator P [(SI "TARGET_32BIT") (DI "TARGET_64BIT")])
233 ; Any hardware-supported floating-point mode
234 (define_mode_iterator FP [
235 (SF "TARGET_HARD_FLOAT
236 && ((TARGET_FPRS && TARGET_SINGLE_FLOAT) || TARGET_E500_SINGLE)")
237 (DF "TARGET_HARD_FLOAT
238 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)")
239 (TF "!TARGET_IEEEQUAD
241 && (TARGET_FPRS || TARGET_E500_DOUBLE)
242 && TARGET_LONG_DOUBLE_128")
246 ; Any fma capable floating-point mode.
247 (define_mode_iterator FMA_F [
248 (SF "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT")
249 (DF "(TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT)
250 || VECTOR_UNIT_VSX_P (DFmode)")
251 (V2SF "TARGET_PAIRED_FLOAT")
252 (V4SF "VECTOR_UNIT_ALTIVEC_OR_VSX_P (V4SFmode)")
253 (V2DF "VECTOR_UNIT_ALTIVEC_OR_VSX_P (V2DFmode)")
256 ; These modes do not fit in integer registers in 32-bit mode.
257 ; but on e500v2, the gpr are 64 bit registers
258 (define_mode_iterator DIFD [DI (DF "!TARGET_E500_DOUBLE") DD])
260 ; Iterator for reciprocal estimate instructions
261 (define_mode_iterator RECIPF [SF DF V4SF V2DF])
263 ; Iterator for just SF/DF
264 (define_mode_iterator SFDF [SF DF])
266 ; Conditional returns.
267 (define_code_iterator any_return [return simple_return])
268 (define_code_attr return_pred [(return "direct_return ()")
269 (simple_return "1")])
270 (define_code_attr return_str [(return "") (simple_return "simple_")])
272 ; Various instructions that come in SI and DI forms.
273 ; A generic w/d attribute, for things like cmpw/cmpd.
274 (define_mode_attr wd [(QI "b") (HI "h") (SI "w") (DI "d")])
277 (define_mode_attr dbits [(QI "56") (HI "48") (SI "32")])
279 ;; ISEL/ISEL64 target selection
280 (define_mode_attr sel [(SI "") (DI "64")])
282 ;; Suffix for reload patterns
283 (define_mode_attr ptrsize [(SI "32bit")
286 (define_mode_attr tptrsize [(SI "TARGET_32BIT")
287 (DI "TARGET_64BIT")])
289 (define_mode_attr mptrsize [(SI "si")
292 (define_mode_attr ptrload [(SI "lwz")
295 (define_mode_attr ptrm [(SI "m")
298 (define_mode_attr rreg [(SF "f")
303 (define_mode_attr rreg2 [(SF "f")
306 (define_mode_attr SI_CONVERT_FP [(SF "TARGET_FCFIDS")
307 (DF "TARGET_FCFID")])
309 (define_mode_attr E500_CONVERT [(SF "!TARGET_FPRS")
310 (DF "TARGET_E500_DOUBLE")])
312 (define_mode_attr TARGET_FLOAT [(SF "TARGET_SINGLE_FLOAT")
313 (DF "TARGET_DOUBLE_FLOAT")])
315 ;; Start with fixed-point load and store insns. Here we put only the more
316 ;; complex forms. Basic data transfer is done later.
318 (define_expand "zero_extend<mode>di2"
319 [(set (match_operand:DI 0 "gpc_reg_operand" "")
320 (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "")))]
324 (define_insn "*zero_extend<mode>di2_internal1"
325 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
326 (zero_extend:DI (match_operand:QHSI 1 "reg_or_mem_operand" "m,r")))]
330 rldicl %0,%1,0,<dbits>"
331 [(set_attr "type" "load,*")])
333 (define_insn "*zero_extend<mode>di2_internal2"
334 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
335 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "r,r"))
337 (clobber (match_scratch:DI 2 "=r,r"))]
340 rldicl. %2,%1,0,<dbits>
342 [(set_attr "type" "compare")
343 (set_attr "length" "4,8")])
346 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
347 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" ""))
349 (clobber (match_scratch:DI 2 ""))]
350 "TARGET_POWERPC64 && reload_completed"
352 (zero_extend:DI (match_dup 1)))
354 (compare:CC (match_dup 2)
358 (define_insn "*zero_extend<mode>di2_internal3"
359 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
360 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "r,r"))
362 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
363 (zero_extend:DI (match_dup 1)))]
366 rldicl. %0,%1,0,<dbits>
368 [(set_attr "type" "compare")
369 (set_attr "length" "4,8")])
372 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
373 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" ""))
375 (set (match_operand:DI 0 "gpc_reg_operand" "")
376 (zero_extend:DI (match_dup 1)))]
377 "TARGET_POWERPC64 && reload_completed"
379 (zero_extend:DI (match_dup 1)))
381 (compare:CC (match_dup 0)
385 (define_insn "extendqidi2"
386 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
387 (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r")))]
390 [(set_attr "type" "exts")])
393 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
394 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
396 (clobber (match_scratch:DI 2 "=r,r"))]
401 [(set_attr "type" "compare")
402 (set_attr "length" "4,8")])
405 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
406 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
408 (clobber (match_scratch:DI 2 ""))]
409 "TARGET_POWERPC64 && reload_completed"
411 (sign_extend:DI (match_dup 1)))
413 (compare:CC (match_dup 2)
418 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
419 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
421 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
422 (sign_extend:DI (match_dup 1)))]
427 [(set_attr "type" "compare")
428 (set_attr "length" "4,8")])
431 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
432 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
434 (set (match_operand:DI 0 "gpc_reg_operand" "")
435 (sign_extend:DI (match_dup 1)))]
436 "TARGET_POWERPC64 && reload_completed"
438 (sign_extend:DI (match_dup 1)))
440 (compare:CC (match_dup 0)
444 (define_expand "extendhidi2"
445 [(set (match_operand:DI 0 "gpc_reg_operand" "")
446 (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "")))]
451 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
452 (sign_extend:DI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
453 "TARGET_POWERPC64 && rs6000_gen_cell_microcode"
457 [(set_attr "type" "load_ext,exts")])
460 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
461 (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r")))]
462 "TARGET_POWERPC64 && !rs6000_gen_cell_microcode"
464 [(set_attr "type" "exts")])
467 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
468 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
470 (clobber (match_scratch:DI 2 "=r,r"))]
475 [(set_attr "type" "compare")
476 (set_attr "length" "4,8")])
479 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
480 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
482 (clobber (match_scratch:DI 2 ""))]
483 "TARGET_POWERPC64 && reload_completed"
485 (sign_extend:DI (match_dup 1)))
487 (compare:CC (match_dup 2)
492 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
493 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
495 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
496 (sign_extend:DI (match_dup 1)))]
501 [(set_attr "type" "compare")
502 (set_attr "length" "4,8")])
505 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
506 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
508 (set (match_operand:DI 0 "gpc_reg_operand" "")
509 (sign_extend:DI (match_dup 1)))]
510 "TARGET_POWERPC64 && reload_completed"
512 (sign_extend:DI (match_dup 1)))
514 (compare:CC (match_dup 0)
518 (define_expand "extendsidi2"
519 [(set (match_operand:DI 0 "gpc_reg_operand" "")
520 (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")))]
525 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
526 (sign_extend:DI (match_operand:SI 1 "lwa_operand" "m,r")))]
527 "TARGET_POWERPC64 && rs6000_gen_cell_microcode"
531 [(set_attr "type" "load_ext,exts")])
534 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
535 (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r")))]
536 "TARGET_POWERPC64 && !rs6000_gen_cell_microcode"
538 [(set_attr "type" "exts")])
541 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
542 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
544 (clobber (match_scratch:DI 2 "=r,r"))]
549 [(set_attr "type" "compare")
550 (set_attr "length" "4,8")])
553 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
554 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
556 (clobber (match_scratch:DI 2 ""))]
557 "TARGET_POWERPC64 && reload_completed"
559 (sign_extend:DI (match_dup 1)))
561 (compare:CC (match_dup 2)
566 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
567 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
569 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
570 (sign_extend:DI (match_dup 1)))]
575 [(set_attr "type" "compare")
576 (set_attr "length" "4,8")])
579 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
580 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
582 (set (match_operand:DI 0 "gpc_reg_operand" "")
583 (sign_extend:DI (match_dup 1)))]
584 "TARGET_POWERPC64 && reload_completed"
586 (sign_extend:DI (match_dup 1)))
588 (compare:CC (match_dup 0)
592 (define_expand "zero_extendqisi2"
593 [(set (match_operand:SI 0 "gpc_reg_operand" "")
594 (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "")))]
599 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
600 (zero_extend:SI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
605 [(set_attr "type" "load,*")])
608 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
609 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
611 (clobber (match_scratch:SI 2 "=r,r"))]
616 [(set_attr "type" "fast_compare,compare")
617 (set_attr "length" "4,8")])
620 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
621 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
623 (clobber (match_scratch:SI 2 ""))]
626 (zero_extend:SI (match_dup 1)))
628 (compare:CC (match_dup 2)
633 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
634 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
636 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
637 (zero_extend:SI (match_dup 1)))]
642 [(set_attr "type" "fast_compare,compare")
643 (set_attr "length" "4,8")])
646 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
647 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
649 (set (match_operand:SI 0 "gpc_reg_operand" "")
650 (zero_extend:SI (match_dup 1)))]
653 (zero_extend:SI (match_dup 1)))
655 (compare:CC (match_dup 0)
659 (define_insn "extendqisi2"
660 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
661 (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r")))]
664 [(set_attr "type" "exts")])
667 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
668 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
670 (clobber (match_scratch:SI 2 "=r,r"))]
675 [(set_attr "type" "compare")
676 (set_attr "length" "4,8")])
679 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
680 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
682 (clobber (match_scratch:SI 2 ""))]
685 (sign_extend:SI (match_dup 1)))
687 (compare:CC (match_dup 2)
692 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
693 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
695 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
696 (sign_extend:SI (match_dup 1)))]
701 [(set_attr "type" "compare")
702 (set_attr "length" "4,8")])
705 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
706 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
708 (set (match_operand:SI 0 "gpc_reg_operand" "")
709 (sign_extend:SI (match_dup 1)))]
712 (sign_extend:SI (match_dup 1)))
714 (compare:CC (match_dup 0)
719 [(set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
720 (zero_extend:HI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
725 [(set_attr "type" "load,*")])
728 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
729 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
731 (clobber (match_scratch:HI 2 "=r,r"))]
736 [(set_attr "type" "fast_compare,compare")
737 (set_attr "length" "4,8")])
740 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
741 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
743 (clobber (match_scratch:HI 2 ""))]
746 (zero_extend:HI (match_dup 1)))
748 (compare:CC (match_dup 2)
753 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
754 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
756 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
757 (zero_extend:HI (match_dup 1)))]
762 [(set_attr "type" "fast_compare,compare")
763 (set_attr "length" "4,8")])
766 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
767 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
769 (set (match_operand:HI 0 "gpc_reg_operand" "")
770 (zero_extend:HI (match_dup 1)))]
773 (zero_extend:HI (match_dup 1)))
775 (compare:CC (match_dup 0)
779 (define_insn "extendqihi2"
780 [(set (match_operand:HI 0 "gpc_reg_operand" "=r")
781 (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r")))]
784 [(set_attr "type" "exts")])
787 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
788 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
790 (clobber (match_scratch:HI 2 "=r,r"))]
795 [(set_attr "type" "compare")
796 (set_attr "length" "4,8")])
799 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
800 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
802 (clobber (match_scratch:HI 2 ""))]
805 (sign_extend:HI (match_dup 1)))
807 (compare:CC (match_dup 2)
812 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
813 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
815 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
816 (sign_extend:HI (match_dup 1)))]
821 [(set_attr "type" "compare")
822 (set_attr "length" "4,8")])
825 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
826 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
828 (set (match_operand:HI 0 "gpc_reg_operand" "")
829 (sign_extend:HI (match_dup 1)))]
832 (sign_extend:HI (match_dup 1)))
834 (compare:CC (match_dup 0)
838 (define_expand "zero_extendhisi2"
839 [(set (match_operand:SI 0 "gpc_reg_operand" "")
840 (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
845 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
846 (zero_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
850 rlwinm %0,%1,0,0xffff"
851 [(set_attr "type" "load,*")])
854 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
855 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
857 (clobber (match_scratch:SI 2 "=r,r"))]
862 [(set_attr "type" "fast_compare,compare")
863 (set_attr "length" "4,8")])
866 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
867 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
869 (clobber (match_scratch:SI 2 ""))]
872 (zero_extend:SI (match_dup 1)))
874 (compare:CC (match_dup 2)
879 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
880 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
882 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
883 (zero_extend:SI (match_dup 1)))]
888 [(set_attr "type" "fast_compare,compare")
889 (set_attr "length" "4,8")])
892 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
893 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
895 (set (match_operand:SI 0 "gpc_reg_operand" "")
896 (zero_extend:SI (match_dup 1)))]
899 (zero_extend:SI (match_dup 1)))
901 (compare:CC (match_dup 0)
905 (define_expand "extendhisi2"
906 [(set (match_operand:SI 0 "gpc_reg_operand" "")
907 (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
912 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
913 (sign_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
914 "rs6000_gen_cell_microcode"
918 [(set_attr "type" "load_ext,exts")])
921 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
922 (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r")))]
923 "!rs6000_gen_cell_microcode"
925 [(set_attr "type" "exts")])
928 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
929 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
931 (clobber (match_scratch:SI 2 "=r,r"))]
936 [(set_attr "type" "compare")
937 (set_attr "length" "4,8")])
940 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
941 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
943 (clobber (match_scratch:SI 2 ""))]
946 (sign_extend:SI (match_dup 1)))
948 (compare:CC (match_dup 2)
953 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
954 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
956 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
957 (sign_extend:SI (match_dup 1)))]
962 [(set_attr "type" "compare")
963 (set_attr "length" "4,8")])
966 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
967 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
969 (set (match_operand:SI 0 "gpc_reg_operand" "")
970 (sign_extend:SI (match_dup 1)))]
973 (sign_extend:SI (match_dup 1)))
975 (compare:CC (match_dup 0)
979 ;; IBM 405, 440, 464 and 476 half-word multiplication operations.
981 (define_insn "*macchwc"
982 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
983 (compare:CC (plus:SI (mult:SI (ashiftrt:SI
984 (match_operand:SI 2 "gpc_reg_operand" "r")
987 (match_operand:HI 1 "gpc_reg_operand" "r")))
988 (match_operand:SI 4 "gpc_reg_operand" "0"))
990 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
991 (plus:SI (mult:SI (ashiftrt:SI
999 [(set_attr "type" "imul3")])
1001 (define_insn "*macchw"
1002 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1003 (plus:SI (mult:SI (ashiftrt:SI
1004 (match_operand:SI 2 "gpc_reg_operand" "r")
1007 (match_operand:HI 1 "gpc_reg_operand" "r")))
1008 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1011 [(set_attr "type" "imul3")])
1013 (define_insn "*macchwuc"
1014 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1015 (compare:CC (plus:SI (mult:SI (lshiftrt:SI
1016 (match_operand:SI 2 "gpc_reg_operand" "r")
1019 (match_operand:HI 1 "gpc_reg_operand" "r")))
1020 (match_operand:SI 4 "gpc_reg_operand" "0"))
1022 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1023 (plus:SI (mult:SI (lshiftrt:SI
1031 [(set_attr "type" "imul3")])
1033 (define_insn "*macchwu"
1034 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1035 (plus:SI (mult:SI (lshiftrt:SI
1036 (match_operand:SI 2 "gpc_reg_operand" "r")
1039 (match_operand:HI 1 "gpc_reg_operand" "r")))
1040 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1043 [(set_attr "type" "imul3")])
1045 (define_insn "*machhwc"
1046 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1047 (compare:CC (plus:SI (mult:SI (ashiftrt:SI
1048 (match_operand:SI 1 "gpc_reg_operand" "%r")
1051 (match_operand:SI 2 "gpc_reg_operand" "r")
1053 (match_operand:SI 4 "gpc_reg_operand" "0"))
1055 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1056 (plus:SI (mult:SI (ashiftrt:SI
1065 [(set_attr "type" "imul3")])
1067 (define_insn "*machhw"
1068 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1069 (plus:SI (mult:SI (ashiftrt:SI
1070 (match_operand:SI 1 "gpc_reg_operand" "%r")
1073 (match_operand:SI 2 "gpc_reg_operand" "r")
1075 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1078 [(set_attr "type" "imul3")])
1080 (define_insn "*machhwuc"
1081 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1082 (compare:CC (plus:SI (mult:SI (lshiftrt:SI
1083 (match_operand:SI 1 "gpc_reg_operand" "%r")
1086 (match_operand:SI 2 "gpc_reg_operand" "r")
1088 (match_operand:SI 4 "gpc_reg_operand" "0"))
1090 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1091 (plus:SI (mult:SI (lshiftrt:SI
1100 [(set_attr "type" "imul3")])
1102 (define_insn "*machhwu"
1103 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1104 (plus:SI (mult:SI (lshiftrt:SI
1105 (match_operand:SI 1 "gpc_reg_operand" "%r")
1108 (match_operand:SI 2 "gpc_reg_operand" "r")
1110 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1113 [(set_attr "type" "imul3")])
1115 (define_insn "*maclhwc"
1116 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1117 (compare:CC (plus:SI (mult:SI (sign_extend:SI
1118 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1120 (match_operand:HI 2 "gpc_reg_operand" "r")))
1121 (match_operand:SI 4 "gpc_reg_operand" "0"))
1123 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1124 (plus:SI (mult:SI (sign_extend:SI
1131 [(set_attr "type" "imul3")])
1133 (define_insn "*maclhw"
1134 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1135 (plus:SI (mult:SI (sign_extend:SI
1136 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1138 (match_operand:HI 2 "gpc_reg_operand" "r")))
1139 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1142 [(set_attr "type" "imul3")])
1144 (define_insn "*maclhwuc"
1145 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1146 (compare:CC (plus:SI (mult:SI (zero_extend:SI
1147 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1149 (match_operand:HI 2 "gpc_reg_operand" "r")))
1150 (match_operand:SI 4 "gpc_reg_operand" "0"))
1152 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1153 (plus:SI (mult:SI (zero_extend:SI
1160 [(set_attr "type" "imul3")])
1162 (define_insn "*maclhwu"
1163 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1164 (plus:SI (mult:SI (zero_extend:SI
1165 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1167 (match_operand:HI 2 "gpc_reg_operand" "r")))
1168 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1171 [(set_attr "type" "imul3")])
1173 (define_insn "*nmacchwc"
1174 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1175 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1176 (mult:SI (ashiftrt:SI
1177 (match_operand:SI 2 "gpc_reg_operand" "r")
1180 (match_operand:HI 1 "gpc_reg_operand" "r"))))
1182 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1183 (minus:SI (match_dup 4)
1184 (mult:SI (ashiftrt:SI
1191 [(set_attr "type" "imul3")])
1193 (define_insn "*nmacchw"
1194 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1195 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1196 (mult:SI (ashiftrt:SI
1197 (match_operand:SI 2 "gpc_reg_operand" "r")
1200 (match_operand:HI 1 "gpc_reg_operand" "r")))))]
1203 [(set_attr "type" "imul3")])
1205 (define_insn "*nmachhwc"
1206 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1207 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1208 (mult:SI (ashiftrt:SI
1209 (match_operand:SI 1 "gpc_reg_operand" "%r")
1212 (match_operand:SI 2 "gpc_reg_operand" "r")
1215 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1216 (minus:SI (match_dup 4)
1217 (mult:SI (ashiftrt:SI
1225 [(set_attr "type" "imul3")])
1227 (define_insn "*nmachhw"
1228 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1229 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1230 (mult:SI (ashiftrt:SI
1231 (match_operand:SI 1 "gpc_reg_operand" "%r")
1234 (match_operand:SI 2 "gpc_reg_operand" "r")
1238 [(set_attr "type" "imul3")])
1240 (define_insn "*nmaclhwc"
1241 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1242 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1243 (mult:SI (sign_extend:SI
1244 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1246 (match_operand:HI 2 "gpc_reg_operand" "r"))))
1248 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1249 (minus:SI (match_dup 4)
1250 (mult:SI (sign_extend:SI
1256 [(set_attr "type" "imul3")])
1258 (define_insn "*nmaclhw"
1259 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1260 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1261 (mult:SI (sign_extend:SI
1262 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1264 (match_operand:HI 2 "gpc_reg_operand" "r")))))]
1267 [(set_attr "type" "imul3")])
1269 (define_insn "*mulchwc"
1270 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1271 (compare:CC (mult:SI (ashiftrt:SI
1272 (match_operand:SI 2 "gpc_reg_operand" "r")
1275 (match_operand:HI 1 "gpc_reg_operand" "r")))
1277 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1278 (mult:SI (ashiftrt:SI
1285 [(set_attr "type" "imul3")])
1287 (define_insn "*mulchw"
1288 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1289 (mult:SI (ashiftrt:SI
1290 (match_operand:SI 2 "gpc_reg_operand" "r")
1293 (match_operand:HI 1 "gpc_reg_operand" "r"))))]
1296 [(set_attr "type" "imul3")])
1298 (define_insn "*mulchwuc"
1299 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1300 (compare:CC (mult:SI (lshiftrt:SI
1301 (match_operand:SI 2 "gpc_reg_operand" "r")
1304 (match_operand:HI 1 "gpc_reg_operand" "r")))
1306 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1307 (mult:SI (lshiftrt:SI
1314 [(set_attr "type" "imul3")])
1316 (define_insn "*mulchwu"
1317 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1318 (mult:SI (lshiftrt:SI
1319 (match_operand:SI 2 "gpc_reg_operand" "r")
1322 (match_operand:HI 1 "gpc_reg_operand" "r"))))]
1325 [(set_attr "type" "imul3")])
1327 (define_insn "*mulhhwc"
1328 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1329 (compare:CC (mult:SI (ashiftrt:SI
1330 (match_operand:SI 1 "gpc_reg_operand" "%r")
1333 (match_operand:SI 2 "gpc_reg_operand" "r")
1336 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1337 (mult:SI (ashiftrt:SI
1345 [(set_attr "type" "imul3")])
1347 (define_insn "*mulhhw"
1348 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1349 (mult:SI (ashiftrt:SI
1350 (match_operand:SI 1 "gpc_reg_operand" "%r")
1353 (match_operand:SI 2 "gpc_reg_operand" "r")
1357 [(set_attr "type" "imul3")])
1359 (define_insn "*mulhhwuc"
1360 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1361 (compare:CC (mult:SI (lshiftrt:SI
1362 (match_operand:SI 1 "gpc_reg_operand" "%r")
1365 (match_operand:SI 2 "gpc_reg_operand" "r")
1368 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1369 (mult:SI (lshiftrt:SI
1377 [(set_attr "type" "imul3")])
1379 (define_insn "*mulhhwu"
1380 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1381 (mult:SI (lshiftrt:SI
1382 (match_operand:SI 1 "gpc_reg_operand" "%r")
1385 (match_operand:SI 2 "gpc_reg_operand" "r")
1389 [(set_attr "type" "imul3")])
1391 (define_insn "*mullhwc"
1392 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1393 (compare:CC (mult:SI (sign_extend:SI
1394 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1396 (match_operand:HI 2 "gpc_reg_operand" "r")))
1398 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1399 (mult:SI (sign_extend:SI
1405 [(set_attr "type" "imul3")])
1407 (define_insn "*mullhw"
1408 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1409 (mult:SI (sign_extend:SI
1410 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1412 (match_operand:HI 2 "gpc_reg_operand" "r"))))]
1415 [(set_attr "type" "imul3")])
1417 (define_insn "*mullhwuc"
1418 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1419 (compare:CC (mult:SI (zero_extend:SI
1420 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1422 (match_operand:HI 2 "gpc_reg_operand" "r")))
1424 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1425 (mult:SI (zero_extend:SI
1431 [(set_attr "type" "imul3")])
1433 (define_insn "*mullhwu"
1434 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1435 (mult:SI (zero_extend:SI
1436 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1438 (match_operand:HI 2 "gpc_reg_operand" "r"))))]
1441 [(set_attr "type" "imul3")])
1443 ;; IBM 405, 440, 464 and 476 string-search dlmzb instruction support.
1444 (define_insn "dlmzb"
1445 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1446 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
1447 (match_operand:SI 2 "gpc_reg_operand" "r")]
1449 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1450 (unspec:SI [(match_dup 1)
1456 (define_expand "strlensi"
1457 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1458 (unspec:SI [(match_operand:BLK 1 "general_operand" "")
1459 (match_operand:QI 2 "const_int_operand" "")
1460 (match_operand 3 "const_int_operand" "")]
1461 UNSPEC_DLMZB_STRLEN))
1462 (clobber (match_scratch:CC 4 "=x"))]
1463 "TARGET_DLMZB && WORDS_BIG_ENDIAN && !optimize_size"
1465 rtx result = operands[0];
1466 rtx src = operands[1];
1467 rtx search_char = operands[2];
1468 rtx align = operands[3];
1469 rtx addr, scratch_string, word1, word2, scratch_dlmzb;
1470 rtx loop_label, end_label, mem, cr0, cond;
1471 if (search_char != const0_rtx
1472 || GET_CODE (align) != CONST_INT
1473 || INTVAL (align) < 8)
1475 word1 = gen_reg_rtx (SImode);
1476 word2 = gen_reg_rtx (SImode);
1477 scratch_dlmzb = gen_reg_rtx (SImode);
1478 scratch_string = gen_reg_rtx (Pmode);
1479 loop_label = gen_label_rtx ();
1480 end_label = gen_label_rtx ();
1481 addr = force_reg (Pmode, XEXP (src, 0));
1482 emit_move_insn (scratch_string, addr);
1483 emit_label (loop_label);
1484 mem = change_address (src, SImode, scratch_string);
1485 emit_move_insn (word1, mem);
1486 emit_move_insn (word2, adjust_address (mem, SImode, 4));
1487 cr0 = gen_rtx_REG (CCmode, CR0_REGNO);
1488 emit_insn (gen_dlmzb (scratch_dlmzb, word1, word2, cr0));
1489 cond = gen_rtx_NE (VOIDmode, cr0, const0_rtx);
1490 emit_jump_insn (gen_rtx_SET (VOIDmode,
1492 gen_rtx_IF_THEN_ELSE (VOIDmode,
1498 emit_insn (gen_addsi3 (scratch_string, scratch_string, GEN_INT (8)));
1499 emit_jump_insn (gen_rtx_SET (VOIDmode,
1501 gen_rtx_LABEL_REF (VOIDmode, loop_label)));
1503 emit_label (end_label);
1504 emit_insn (gen_addsi3 (scratch_string, scratch_string, scratch_dlmzb));
1505 emit_insn (gen_subsi3 (result, scratch_string, addr));
1506 emit_insn (gen_subsi3 (result, result, const1_rtx));
1510 ;; Fixed-point arithmetic insns.
1512 (define_expand "add<mode>3"
1513 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1514 (plus:SDI (match_operand:SDI 1 "gpc_reg_operand" "")
1515 (match_operand:SDI 2 "reg_or_add_cint_operand" "")))]
1518 if (<MODE>mode == DImode && ! TARGET_POWERPC64)
1520 if (non_short_cint_operand (operands[2], DImode))
1523 else if (GET_CODE (operands[2]) == CONST_INT
1524 && ! add_operand (operands[2], <MODE>mode))
1526 rtx tmp = ((!can_create_pseudo_p ()
1527 || rtx_equal_p (operands[0], operands[1]))
1528 ? operands[0] : gen_reg_rtx (<MODE>mode));
1530 HOST_WIDE_INT val = INTVAL (operands[2]);
1531 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1532 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, <MODE>mode);
1534 if (<MODE>mode == DImode && !satisfies_constraint_L (GEN_INT (rest)))
1537 /* The ordering here is important for the prolog expander.
1538 When space is allocated from the stack, adding 'low' first may
1539 produce a temporary deallocation (which would be bad). */
1540 emit_insn (gen_add<mode>3 (tmp, operands[1], GEN_INT (rest)));
1541 emit_insn (gen_add<mode>3 (operands[0], tmp, GEN_INT (low)));
1546 ;; Discourage ai/addic because of carry but provide it in an alternative
1547 ;; allowing register zero as source.
1548 (define_insn "*add<mode>3_internal1"
1549 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r,?r,r")
1550 (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "%r,b,r,b")
1551 (match_operand:GPR 2 "add_operand" "r,I,I,L")))]
1552 "!DECIMAL_FLOAT_MODE_P (GET_MODE (operands[0])) && !DECIMAL_FLOAT_MODE_P (GET_MODE (operands[1]))"
1558 [(set_attr "length" "4,4,4,4")])
1560 (define_insn "addsi3_high"
1561 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
1562 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
1563 (high:SI (match_operand 2 "" ""))))]
1564 "TARGET_MACHO && !TARGET_64BIT"
1565 "addis %0,%1,ha16(%2)"
1566 [(set_attr "length" "4")])
1568 (define_insn "*add<mode>3_internal2"
1569 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
1570 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "%r,r,r,r")
1571 (match_operand:P 2 "reg_or_short_operand" "r,I,r,I"))
1573 (clobber (match_scratch:P 3 "=r,r,r,r"))]
1580 [(set_attr "type" "fast_compare,compare,compare,compare")
1581 (set_attr "length" "4,4,8,8")])
1584 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1585 (compare:CC (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1586 (match_operand:GPR 2 "reg_or_short_operand" ""))
1588 (clobber (match_scratch:GPR 3 ""))]
1591 (plus:GPR (match_dup 1)
1594 (compare:CC (match_dup 3)
1598 (define_insn "*add<mode>3_internal3"
1599 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
1600 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "%r,r,r,r")
1601 (match_operand:P 2 "reg_or_short_operand" "r,I,r,I"))
1603 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
1604 (plus:P (match_dup 1)
1612 [(set_attr "type" "fast_compare,compare,compare,compare")
1613 (set_attr "length" "4,4,8,8")])
1616 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1617 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "")
1618 (match_operand:P 2 "reg_or_short_operand" ""))
1620 (set (match_operand:P 0 "gpc_reg_operand" "")
1621 (plus:P (match_dup 1) (match_dup 2)))]
1624 (plus:P (match_dup 1)
1627 (compare:CC (match_dup 0)
1631 ;; Split an add that we can't do in one insn into two insns, each of which
1632 ;; does one 16-bit part. This is used by combine. Note that the low-order
1633 ;; add should be last in case the result gets used in an address.
1636 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
1637 (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1638 (match_operand:GPR 2 "non_add_cint_operand" "")))]
1640 [(set (match_dup 0) (plus:GPR (match_dup 1) (match_dup 3)))
1641 (set (match_dup 0) (plus:GPR (match_dup 0) (match_dup 4)))]
1643 HOST_WIDE_INT val = INTVAL (operands[2]);
1644 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1645 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, <MODE>mode);
1647 operands[4] = GEN_INT (low);
1648 if (<MODE>mode == SImode || satisfies_constraint_L (GEN_INT (rest)))
1649 operands[3] = GEN_INT (rest);
1650 else if (can_create_pseudo_p ())
1652 operands[3] = gen_reg_rtx (DImode);
1653 emit_move_insn (operands[3], operands[2]);
1654 emit_insn (gen_adddi3 (operands[0], operands[1], operands[3]));
1661 (define_insn "one_cmpl<mode>2"
1662 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1663 (not:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
1668 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1669 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1671 (clobber (match_scratch:P 2 "=r,r"))]
1676 [(set_attr "type" "fast_compare,compare")
1677 (set_attr "length" "4,8")])
1680 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
1681 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" ""))
1683 (clobber (match_scratch:P 2 ""))]
1686 (not:P (match_dup 1)))
1688 (compare:CC (match_dup 2)
1693 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1694 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1696 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
1697 (not:P (match_dup 1)))]
1702 [(set_attr "type" "fast_compare,compare")
1703 (set_attr "length" "4,8")])
1706 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
1707 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" ""))
1709 (set (match_operand:P 0 "gpc_reg_operand" "")
1710 (not:P (match_dup 1)))]
1713 (not:P (match_dup 1)))
1715 (compare:CC (match_dup 0)
1720 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
1721 (minus:GPR (match_operand:GPR 1 "reg_or_short_operand" "r,I")
1722 (match_operand:GPR 2 "gpc_reg_operand" "r,r")))]
1729 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1730 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "r,r")
1731 (match_operand:P 2 "gpc_reg_operand" "r,r"))
1733 (clobber (match_scratch:P 3 "=r,r"))]
1738 [(set_attr "type" "fast_compare")
1739 (set_attr "length" "4,8")])
1742 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1743 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "")
1744 (match_operand:P 2 "gpc_reg_operand" ""))
1746 (clobber (match_scratch:P 3 ""))]
1749 (minus:P (match_dup 1)
1752 (compare:CC (match_dup 3)
1757 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1758 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "r,r")
1759 (match_operand:P 2 "gpc_reg_operand" "r,r"))
1761 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
1762 (minus:P (match_dup 1)
1768 [(set_attr "type" "fast_compare")
1769 (set_attr "length" "4,8")])
1772 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1773 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "")
1774 (match_operand:P 2 "gpc_reg_operand" ""))
1776 (set (match_operand:P 0 "gpc_reg_operand" "")
1777 (minus:P (match_dup 1)
1781 (minus:P (match_dup 1)
1784 (compare:CC (match_dup 0)
1788 (define_expand "sub<mode>3"
1789 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1790 (minus:SDI (match_operand:SDI 1 "reg_or_short_operand" "")
1791 (match_operand:SDI 2 "reg_or_sub_cint_operand" "")))]
1795 if (GET_CODE (operands[2]) == CONST_INT)
1797 emit_insn (gen_add<mode>3 (operands[0], operands[1],
1798 negate_rtx (<MODE>mode, operands[2])));
1803 (define_expand "neg<mode>2"
1804 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1805 (neg:SDI (match_operand:SDI 1 "gpc_reg_operand" "")))]
1809 (define_insn "*neg<mode>2_internal"
1810 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1811 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
1816 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1817 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1819 (clobber (match_scratch:P 2 "=r,r"))]
1824 [(set_attr "type" "fast_compare")
1825 (set_attr "length" "4,8")])
1828 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1829 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" ""))
1831 (clobber (match_scratch:P 2 ""))]
1834 (neg:P (match_dup 1)))
1836 (compare:CC (match_dup 2)
1841 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1842 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1844 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
1845 (neg:P (match_dup 1)))]
1850 [(set_attr "type" "fast_compare")
1851 (set_attr "length" "4,8")])
1854 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1855 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" ""))
1857 (set (match_operand:P 0 "gpc_reg_operand" "")
1858 (neg:P (match_dup 1)))]
1861 (neg:P (match_dup 1)))
1863 (compare:CC (match_dup 0)
1867 (define_insn "clz<mode>2"
1868 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1869 (clz:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
1872 [(set_attr "type" "cntlz")])
1874 (define_expand "ctz<mode>2"
1876 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))
1877 (parallel [(set (match_dup 3) (and:GPR (match_dup 1)
1879 (clobber (scratch:CC))])
1880 (set (match_dup 4) (clz:GPR (match_dup 3)))
1881 (set (match_operand:GPR 0 "gpc_reg_operand" "")
1882 (minus:GPR (match_dup 5) (match_dup 4)))]
1885 operands[2] = gen_reg_rtx (<MODE>mode);
1886 operands[3] = gen_reg_rtx (<MODE>mode);
1887 operands[4] = gen_reg_rtx (<MODE>mode);
1888 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode) - 1);
1891 (define_expand "ffs<mode>2"
1893 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))
1894 (parallel [(set (match_dup 3) (and:GPR (match_dup 1)
1896 (clobber (scratch:CC))])
1897 (set (match_dup 4) (clz:GPR (match_dup 3)))
1898 (set (match_operand:GPR 0 "gpc_reg_operand" "")
1899 (minus:GPR (match_dup 5) (match_dup 4)))]
1902 operands[2] = gen_reg_rtx (<MODE>mode);
1903 operands[3] = gen_reg_rtx (<MODE>mode);
1904 operands[4] = gen_reg_rtx (<MODE>mode);
1905 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode));
1908 (define_insn "popcntb<mode>2"
1909 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1910 (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")]
1914 [(set_attr "length" "4")
1915 (set_attr "type" "popcnt")])
1917 (define_insn "popcntd<mode>2"
1918 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1919 (popcount:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
1922 [(set_attr "length" "4")
1923 (set_attr "type" "popcnt")])
1925 (define_expand "popcount<mode>2"
1926 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
1927 (popcount:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))]
1928 "TARGET_POPCNTB || TARGET_POPCNTD"
1930 rs6000_emit_popcount (operands[0], operands[1]);
1934 (define_insn "parity<mode>2_cmpb"
1935 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1936 (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")] UNSPEC_PARITY))]
1937 "TARGET_CMPB && TARGET_POPCNTB"
1940 (define_expand "parity<mode>2"
1941 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
1942 (parity:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))]
1945 rs6000_emit_parity (operands[0], operands[1]);
1949 ;; Since the hardware zeros the upper part of the register, save generating the
1950 ;; AND immediate if we are converting to unsigned
1951 (define_insn "*bswaphi2_extenddi"
1952 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
1954 (bswap:HI (match_operand:HI 1 "memory_operand" "Z"))))]
1957 [(set_attr "length" "4")
1958 (set_attr "type" "load")])
1960 (define_insn "*bswaphi2_extendsi"
1961 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1963 (bswap:HI (match_operand:HI 1 "memory_operand" "Z"))))]
1966 [(set_attr "length" "4")
1967 (set_attr "type" "load")])
1969 (define_expand "bswaphi2"
1970 [(parallel [(set (match_operand:HI 0 "reg_or_mem_operand" "")
1972 (match_operand:HI 1 "reg_or_mem_operand" "")))
1973 (clobber (match_scratch:SI 2 ""))])]
1976 if (!REG_P (operands[0]) && !REG_P (operands[1]))
1977 operands[1] = force_reg (HImode, operands[1]);
1980 (define_insn "bswaphi2_internal"
1981 [(set (match_operand:HI 0 "reg_or_mem_operand" "=r,Z,&r")
1983 (match_operand:HI 1 "reg_or_mem_operand" "Z,r,r")))
1984 (clobber (match_scratch:SI 2 "=X,X,&r"))]
1990 [(set_attr "length" "4,4,12")
1991 (set_attr "type" "load,store,*")])
1994 [(set (match_operand:HI 0 "gpc_reg_operand" "")
1995 (bswap:HI (match_operand:HI 1 "gpc_reg_operand" "")))
1996 (clobber (match_operand:SI 2 "gpc_reg_operand" ""))]
1999 (zero_extract:SI (match_dup 4)
2003 (and:SI (ashift:SI (match_dup 4)
2005 (const_int 65280))) ;; 0xff00
2007 (ior:SI (match_dup 3)
2011 operands[3] = simplify_gen_subreg (SImode, operands[0], HImode, 0);
2012 operands[4] = simplify_gen_subreg (SImode, operands[1], HImode, 0);
2015 (define_insn "*bswapsi2_extenddi"
2016 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
2018 (bswap:SI (match_operand:SI 1 "memory_operand" "Z"))))]
2021 [(set_attr "length" "4")
2022 (set_attr "type" "load")])
2024 (define_expand "bswapsi2"
2025 [(set (match_operand:SI 0 "reg_or_mem_operand" "")
2027 (match_operand:SI 1 "reg_or_mem_operand" "")))]
2030 if (!REG_P (operands[0]) && !REG_P (operands[1]))
2031 operands[1] = force_reg (SImode, operands[1]);
2034 (define_insn "*bswapsi2_internal"
2035 [(set (match_operand:SI 0 "reg_or_mem_operand" "=r,Z,&r")
2037 (match_operand:SI 1 "reg_or_mem_operand" "Z,r,r")))]
2043 [(set_attr "length" "4,4,12")
2044 (set_attr "type" "load,store,*")])
2047 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2048 (bswap:SI (match_operand:SI 1 "gpc_reg_operand" "")))]
2051 (rotate:SI (match_dup 1) (const_int 8)))
2052 (set (zero_extract:SI (match_dup 0)
2056 (set (zero_extract:SI (match_dup 0)
2059 (rotate:SI (match_dup 1)
2063 (define_expand "bswapdi2"
2064 [(parallel [(set (match_operand:DI 0 "reg_or_mem_operand" "")
2066 (match_operand:DI 1 "reg_or_mem_operand" "")))
2067 (clobber (match_scratch:DI 2 ""))
2068 (clobber (match_scratch:DI 3 ""))
2069 (clobber (match_scratch:DI 4 ""))])]
2072 if (!REG_P (operands[0]) && !REG_P (operands[1]))
2073 operands[1] = force_reg (DImode, operands[1]);
2075 if (!TARGET_POWERPC64)
2077 /* 32-bit mode needs fewer scratch registers, but 32-bit addressing mode
2078 that uses 64-bit registers needs the same scratch registers as 64-bit
2080 emit_insn (gen_bswapdi2_32bit (operands[0], operands[1]));
2085 ;; Power7/cell has ldbrx/stdbrx, so use it directly
2086 (define_insn "*bswapdi2_ldbrx"
2087 [(set (match_operand:DI 0 "reg_or_mem_operand" "=&r,Z,??&r")
2088 (bswap:DI (match_operand:DI 1 "reg_or_mem_operand" "Z,r,r")))
2089 (clobber (match_scratch:DI 2 "=X,X,&r"))
2090 (clobber (match_scratch:DI 3 "=X,X,&r"))
2091 (clobber (match_scratch:DI 4 "=X,X,&r"))]
2092 "TARGET_POWERPC64 && TARGET_LDBRX
2093 && (REG_P (operands[0]) || REG_P (operands[1]))"
2098 [(set_attr "length" "4,4,36")
2099 (set_attr "type" "load,store,*")])
2101 ;; Non-power7/cell, fall back to use lwbrx/stwbrx
2102 (define_insn "*bswapdi2_64bit"
2103 [(set (match_operand:DI 0 "reg_or_mem_operand" "=&r,Z,??&r")
2104 (bswap:DI (match_operand:DI 1 "reg_or_mem_operand" "Z,r,r")))
2105 (clobber (match_scratch:DI 2 "=&b,&b,&r"))
2106 (clobber (match_scratch:DI 3 "=&r,&r,&r"))
2107 (clobber (match_scratch:DI 4 "=&r,X,&r"))]
2108 "TARGET_POWERPC64 && !TARGET_LDBRX
2109 && (REG_P (operands[0]) || REG_P (operands[1]))"
2111 [(set_attr "length" "16,12,36")])
2114 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2115 (bswap:DI (match_operand:DI 1 "indexed_or_indirect_operand" "")))
2116 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
2117 (clobber (match_operand:DI 3 "gpc_reg_operand" ""))
2118 (clobber (match_operand:DI 4 "gpc_reg_operand" ""))]
2119 "TARGET_POWERPC64 && !TARGET_LDBRX && reload_completed"
2123 rtx dest = operands[0];
2124 rtx src = operands[1];
2125 rtx op2 = operands[2];
2126 rtx op3 = operands[3];
2127 rtx op4 = operands[4];
2128 rtx op3_32 = simplify_gen_subreg (SImode, op3, DImode, 4);
2129 rtx op4_32 = simplify_gen_subreg (SImode, op4, DImode, 4);
2135 addr1 = XEXP (src, 0);
2136 if (GET_CODE (addr1) == PLUS)
2138 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2139 if (TARGET_AVOID_XFORM)
2141 emit_insn (gen_add3_insn (op2, XEXP (addr1, 1), op2));
2145 addr2 = gen_rtx_PLUS (Pmode, op2, XEXP (addr1, 1));
2147 else if (TARGET_AVOID_XFORM)
2149 emit_insn (gen_add3_insn (op2, addr1, GEN_INT (4)));
2154 emit_move_insn (op2, GEN_INT (4));
2155 addr2 = gen_rtx_PLUS (Pmode, op2, addr1);
2158 if (BYTES_BIG_ENDIAN)
2160 word_high = change_address (src, SImode, addr1);
2161 word_low = change_address (src, SImode, addr2);
2165 word_high = change_address (src, SImode, addr2);
2166 word_low = change_address (src, SImode, addr1);
2169 emit_insn (gen_bswapsi2 (op3_32, word_low));
2170 emit_insn (gen_bswapsi2 (op4_32, word_high));
2171 emit_insn (gen_ashldi3 (dest, op3, GEN_INT (32)));
2172 emit_insn (gen_iordi3 (dest, dest, op4));
2176 [(set (match_operand:DI 0 "indexed_or_indirect_operand" "")
2177 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2178 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
2179 (clobber (match_operand:DI 3 "gpc_reg_operand" ""))
2180 (clobber (match_operand:DI 4 "" ""))]
2181 "TARGET_POWERPC64 && !TARGET_LDBRX && reload_completed"
2185 rtx dest = operands[0];
2186 rtx src = operands[1];
2187 rtx op2 = operands[2];
2188 rtx op3 = operands[3];
2189 rtx src_si = simplify_gen_subreg (SImode, src, DImode, 4);
2190 rtx op3_si = simplify_gen_subreg (SImode, op3, DImode, 4);
2196 addr1 = XEXP (dest, 0);
2197 if (GET_CODE (addr1) == PLUS)
2199 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2200 if (TARGET_AVOID_XFORM)
2202 emit_insn (gen_add3_insn (op2, XEXP (addr1, 1), op2));
2206 addr2 = gen_rtx_PLUS (Pmode, op2, XEXP (addr1, 1));
2208 else if (TARGET_AVOID_XFORM)
2210 emit_insn (gen_add3_insn (op2, addr1, GEN_INT (4)));
2215 emit_move_insn (op2, GEN_INT (4));
2216 addr2 = gen_rtx_PLUS (Pmode, op2, addr1);
2219 emit_insn (gen_lshrdi3 (op3, src, GEN_INT (32)));
2220 if (BYTES_BIG_ENDIAN)
2222 word_high = change_address (dest, SImode, addr1);
2223 word_low = change_address (dest, SImode, addr2);
2224 emit_insn (gen_bswapsi2 (word_high, src_si));
2225 emit_insn (gen_bswapsi2 (word_low, op3_si));
2229 word_high = change_address (dest, SImode, addr2);
2230 word_low = change_address (dest, SImode, addr1);
2231 emit_insn (gen_bswapsi2 (word_low, src_si));
2232 emit_insn (gen_bswapsi2 (word_high, op3_si));
2237 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2238 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2239 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
2240 (clobber (match_operand:DI 3 "gpc_reg_operand" ""))
2241 (clobber (match_operand:DI 4 "" ""))]
2242 "TARGET_POWERPC64 && reload_completed"
2246 rtx dest = operands[0];
2247 rtx src = operands[1];
2248 rtx op2 = operands[2];
2249 rtx op3 = operands[3];
2250 rtx dest_si = simplify_gen_subreg (SImode, dest, DImode, 4);
2251 rtx src_si = simplify_gen_subreg (SImode, src, DImode, 4);
2252 rtx op2_si = simplify_gen_subreg (SImode, op2, DImode, 4);
2253 rtx op3_si = simplify_gen_subreg (SImode, op3, DImode, 4);
2255 emit_insn (gen_lshrdi3 (op2, src, GEN_INT (32)));
2256 emit_insn (gen_bswapsi2 (dest_si, src_si));
2257 emit_insn (gen_bswapsi2 (op3_si, op2_si));
2258 emit_insn (gen_ashldi3 (dest, dest, GEN_INT (32)));
2259 emit_insn (gen_iordi3 (dest, dest, op3));
2262 (define_insn "bswapdi2_32bit"
2263 [(set (match_operand:DI 0 "reg_or_mem_operand" "=&r,Z,??&r")
2264 (bswap:DI (match_operand:DI 1 "reg_or_mem_operand" "Z,r,r")))
2265 (clobber (match_scratch:SI 2 "=&b,&b,X"))]
2266 "!TARGET_POWERPC64 && (REG_P (operands[0]) || REG_P (operands[1]))"
2268 [(set_attr "length" "16,12,36")])
2271 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2272 (bswap:DI (match_operand:DI 1 "indexed_or_indirect_operand" "")))
2273 (clobber (match_operand:SI 2 "gpc_reg_operand" ""))]
2274 "!TARGET_POWERPC64 && reload_completed"
2278 rtx dest = operands[0];
2279 rtx src = operands[1];
2280 rtx op2 = operands[2];
2281 rtx dest_hi = simplify_gen_subreg (SImode, dest, DImode, 0);
2282 rtx dest_lo = simplify_gen_subreg (SImode, dest, DImode, 4);
2288 addr1 = XEXP (src, 0);
2289 if (GET_CODE (addr1) == PLUS)
2291 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2292 if (TARGET_AVOID_XFORM)
2294 emit_insn (gen_add3_insn (op2, XEXP (addr1, 1), op2));
2298 addr2 = gen_rtx_PLUS (SImode, op2, XEXP (addr1, 1));
2300 else if (TARGET_AVOID_XFORM)
2302 emit_insn (gen_add3_insn (op2, addr1, GEN_INT (4)));
2307 emit_move_insn (op2, GEN_INT (4));
2308 addr2 = gen_rtx_PLUS (SImode, op2, addr1);
2311 if (BYTES_BIG_ENDIAN)
2313 word_high = change_address (src, SImode, addr1);
2314 word_low = change_address (src, SImode, addr2);
2318 word_high = change_address (src, SImode, addr2);
2319 word_low = change_address (src, SImode, addr1);
2322 emit_insn (gen_bswapsi2 (dest_hi, word_low));
2323 emit_insn (gen_bswapsi2 (dest_lo, word_high));
2327 [(set (match_operand:DI 0 "indexed_or_indirect_operand" "")
2328 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2329 (clobber (match_operand:SI 2 "gpc_reg_operand" ""))]
2330 "!TARGET_POWERPC64 && reload_completed"
2334 rtx dest = operands[0];
2335 rtx src = operands[1];
2336 rtx op2 = operands[2];
2337 rtx src_high = simplify_gen_subreg (SImode, src, DImode, 0);
2338 rtx src_low = simplify_gen_subreg (SImode, src, DImode, 4);
2344 addr1 = XEXP (dest, 0);
2345 if (GET_CODE (addr1) == PLUS)
2347 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2348 if (TARGET_AVOID_XFORM)
2350 emit_insn (gen_add3_insn (op2, XEXP (addr1, 1), op2));
2354 addr2 = gen_rtx_PLUS (SImode, op2, XEXP (addr1, 1));
2356 else if (TARGET_AVOID_XFORM)
2358 emit_insn (gen_add3_insn (op2, addr1, GEN_INT (4)));
2363 emit_move_insn (op2, GEN_INT (4));
2364 addr2 = gen_rtx_PLUS (SImode, op2, addr1);
2367 if (BYTES_BIG_ENDIAN)
2369 word_high = change_address (dest, SImode, addr1);
2370 word_low = change_address (dest, SImode, addr2);
2374 word_high = change_address (dest, SImode, addr2);
2375 word_low = change_address (dest, SImode, addr1);
2378 emit_insn (gen_bswapsi2 (word_high, src_low));
2379 emit_insn (gen_bswapsi2 (word_low, src_high));
2383 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2384 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2385 (clobber (match_operand:SI 2 "" ""))]
2386 "!TARGET_POWERPC64 && reload_completed"
2390 rtx dest = operands[0];
2391 rtx src = operands[1];
2392 rtx src_high = simplify_gen_subreg (SImode, src, DImode, 0);
2393 rtx src_low = simplify_gen_subreg (SImode, src, DImode, 4);
2394 rtx dest_high = simplify_gen_subreg (SImode, dest, DImode, 0);
2395 rtx dest_low = simplify_gen_subreg (SImode, dest, DImode, 4);
2397 emit_insn (gen_bswapsi2 (dest_high, src_low));
2398 emit_insn (gen_bswapsi2 (dest_low, src_high));
2401 (define_insn "mulsi3"
2402 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2403 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2404 (match_operand:SI 2 "reg_or_short_operand" "r,I")))]
2410 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
2411 (const_string "imul3")
2412 (match_operand:SI 2 "short_cint_operand" "")
2413 (const_string "imul2")]
2414 (const_string "imul")))])
2416 (define_insn "*mulsi3_internal1"
2417 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2418 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2419 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2421 (clobber (match_scratch:SI 3 "=r,r"))]
2426 [(set_attr "type" "imul_compare")
2427 (set_attr "length" "4,8")])
2430 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
2431 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2432 (match_operand:SI 2 "gpc_reg_operand" ""))
2434 (clobber (match_scratch:SI 3 ""))]
2437 (mult:SI (match_dup 1) (match_dup 2)))
2439 (compare:CC (match_dup 3)
2443 (define_insn "*mulsi3_internal2"
2444 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2445 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2446 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2448 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2449 (mult:SI (match_dup 1) (match_dup 2)))]
2454 [(set_attr "type" "imul_compare")
2455 (set_attr "length" "4,8")])
2458 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
2459 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2460 (match_operand:SI 2 "gpc_reg_operand" ""))
2462 (set (match_operand:SI 0 "gpc_reg_operand" "")
2463 (mult:SI (match_dup 1) (match_dup 2)))]
2466 (mult:SI (match_dup 1) (match_dup 2)))
2468 (compare:CC (match_dup 0)
2473 (define_insn "udiv<mode>3"
2474 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2475 (udiv:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2476 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
2480 (cond [(match_operand:SI 0 "" "")
2481 (const_string "idiv")]
2482 (const_string "ldiv")))])
2485 ;; For powers of two we can do srai/aze for divide and then adjust for
2486 ;; modulus. If it isn't a power of two, force operands into register and do
2488 (define_expand "div<mode>3"
2489 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2490 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2491 (match_operand:GPR 2 "reg_or_cint_operand" "")))]
2494 if (GET_CODE (operands[2]) != CONST_INT
2495 || INTVAL (operands[2]) <= 0
2496 || exact_log2 (INTVAL (operands[2])) < 0)
2497 operands[2] = force_reg (<MODE>mode, operands[2]);
2500 (define_insn "*div<mode>3"
2501 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2502 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2503 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
2507 (cond [(match_operand:SI 0 "" "")
2508 (const_string "idiv")]
2509 (const_string "ldiv")))])
2511 (define_expand "mod<mode>3"
2512 [(use (match_operand:GPR 0 "gpc_reg_operand" ""))
2513 (use (match_operand:GPR 1 "gpc_reg_operand" ""))
2514 (use (match_operand:GPR 2 "reg_or_cint_operand" ""))]
2522 if (GET_CODE (operands[2]) != CONST_INT
2523 || INTVAL (operands[2]) <= 0
2524 || (i = exact_log2 (INTVAL (operands[2]))) < 0)
2527 temp1 = gen_reg_rtx (<MODE>mode);
2528 temp2 = gen_reg_rtx (<MODE>mode);
2530 emit_insn (gen_div<mode>3 (temp1, operands[1], operands[2]));
2531 emit_insn (gen_ashl<mode>3 (temp2, temp1, GEN_INT (i)));
2532 emit_insn (gen_sub<mode>3 (operands[0], operands[1], temp2));
2537 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2538 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2539 (match_operand:GPR 2 "exact_log2_cint_operand" "N")))]
2541 "sra<wd>i %0,%1,%p2\;addze %0,%0"
2542 [(set_attr "type" "two")
2543 (set_attr "length" "8")])
2546 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2547 (compare:CC (div:P (match_operand:P 1 "gpc_reg_operand" "r,r")
2548 (match_operand:P 2 "exact_log2_cint_operand" "N,N"))
2550 (clobber (match_scratch:P 3 "=r,r"))]
2553 sra<wd>i %3,%1,%p2\;addze. %3,%3
2555 [(set_attr "type" "compare")
2556 (set_attr "length" "8,12")
2557 (set_attr "cell_micro" "not")])
2560 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2561 (compare:CC (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2562 (match_operand:GPR 2 "exact_log2_cint_operand"
2565 (clobber (match_scratch:GPR 3 ""))]
2568 (div:<MODE> (match_dup 1) (match_dup 2)))
2570 (compare:CC (match_dup 3)
2575 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2576 (compare:CC (div:P (match_operand:P 1 "gpc_reg_operand" "r,r")
2577 (match_operand:P 2 "exact_log2_cint_operand" "N,N"))
2579 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
2580 (div:P (match_dup 1) (match_dup 2)))]
2583 sra<wd>i %0,%1,%p2\;addze. %0,%0
2585 [(set_attr "type" "compare")
2586 (set_attr "length" "8,12")
2587 (set_attr "cell_micro" "not")])
2590 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2591 (compare:CC (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2592 (match_operand:GPR 2 "exact_log2_cint_operand"
2595 (set (match_operand:GPR 0 "gpc_reg_operand" "")
2596 (div:GPR (match_dup 1) (match_dup 2)))]
2599 (div:<MODE> (match_dup 1) (match_dup 2)))
2601 (compare:CC (match_dup 0)
2605 ;; Logical instructions
2606 ;; The logical instructions are mostly combined by using match_operator,
2607 ;; but the plain AND insns are somewhat different because there is no
2608 ;; plain 'andi' (only 'andi.'), no plain 'andis', and there are all
2609 ;; those rotate-and-mask operations. Thus, the AND insns come first.
2611 (define_expand "andsi3"
2613 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2614 (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2615 (match_operand:SI 2 "and_operand" "")))
2616 (clobber (match_scratch:CC 3 ""))])]
2620 (define_insn "andsi3_mc"
2621 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
2622 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
2623 (match_operand:SI 2 "and_operand" "?r,T,K,L")))
2624 (clobber (match_scratch:CC 3 "=X,X,x,x"))]
2625 "rs6000_gen_cell_microcode"
2628 rlwinm %0,%1,0,%m2,%M2
2631 [(set_attr "type" "*,*,fast_compare,fast_compare")])
2633 (define_insn "andsi3_nomc"
2634 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2635 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2636 (match_operand:SI 2 "and_operand" "?r,T")))
2637 (clobber (match_scratch:CC 3 "=X,X"))]
2638 "!rs6000_gen_cell_microcode"
2641 rlwinm %0,%1,0,%m2,%M2")
2643 (define_insn "andsi3_internal0_nomc"
2644 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2645 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2646 (match_operand:SI 2 "and_operand" "?r,T")))]
2647 "!rs6000_gen_cell_microcode"
2650 rlwinm %0,%1,0,%m2,%M2")
2653 ;; Note to set cr's other than cr0 we do the and immediate and then
2654 ;; the test again -- this avoids a mfcr which on the higher end
2655 ;; machines causes an execution serialization
2657 (define_insn "*andsi3_internal2_mc"
2658 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2659 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2660 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2662 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2663 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2664 "TARGET_32BIT && rs6000_gen_cell_microcode"
2669 rlwinm. %3,%1,0,%m2,%M2
2674 [(set_attr "type" "fast_compare,fast_compare,fast_compare,delayed_compare,\
2675 compare,compare,compare,compare")
2676 (set_attr "length" "4,4,4,4,8,8,8,8")])
2678 (define_insn "*andsi3_internal3_mc"
2679 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2680 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2681 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2683 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2684 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2685 "TARGET_64BIT && rs6000_gen_cell_microcode"
2690 rlwinm. %3,%1,0,%m2,%M2
2695 [(set_attr "type" "compare,fast_compare,fast_compare,delayed_compare,compare,\
2696 compare,compare,compare")
2697 (set_attr "length" "8,4,4,4,8,8,8,8")])
2700 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
2701 (compare:CC (and:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2702 (match_operand:GPR 2 "and_operand" ""))
2704 (clobber (match_scratch:GPR 3 ""))
2705 (clobber (match_scratch:CC 4 ""))]
2707 [(parallel [(set (match_dup 3)
2708 (and:<MODE> (match_dup 1)
2710 (clobber (match_dup 4))])
2712 (compare:CC (match_dup 3)
2716 ;; We don't have a 32 bit "and. rt,ra,rb" for ppc64. cr is set from the
2717 ;; whole 64 bit reg, and we don't know what is in the high 32 bits.
2720 [(set (match_operand:CC 0 "cc_reg_operand" "")
2721 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2722 (match_operand:SI 2 "gpc_reg_operand" ""))
2724 (clobber (match_scratch:SI 3 ""))
2725 (clobber (match_scratch:CC 4 ""))]
2726 "TARGET_POWERPC64 && reload_completed"
2727 [(parallel [(set (match_dup 3)
2728 (and:SI (match_dup 1)
2730 (clobber (match_dup 4))])
2732 (compare:CC (match_dup 3)
2736 (define_insn "*andsi3_internal4"
2737 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2738 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2739 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2741 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
2742 (and:SI (match_dup 1)
2744 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2745 "TARGET_32BIT && rs6000_gen_cell_microcode"
2750 rlwinm. %0,%1,0,%m2,%M2
2755 [(set_attr "type" "fast_compare,fast_compare,fast_compare,delayed_compare,\
2756 compare,compare,compare,compare")
2757 (set_attr "length" "4,4,4,4,8,8,8,8")])
2759 (define_insn "*andsi3_internal5_mc"
2760 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2761 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2762 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2764 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
2765 (and:SI (match_dup 1)
2767 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2768 "TARGET_64BIT && rs6000_gen_cell_microcode"
2773 rlwinm. %0,%1,0,%m2,%M2
2778 [(set_attr "type" "compare,fast_compare,fast_compare,delayed_compare,compare,\
2779 compare,compare,compare")
2780 (set_attr "length" "8,4,4,4,8,8,8,8")])
2783 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
2784 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2785 (match_operand:SI 2 "and_operand" ""))
2787 (set (match_operand:SI 0 "gpc_reg_operand" "")
2788 (and:SI (match_dup 1)
2790 (clobber (match_scratch:CC 4 ""))]
2792 [(parallel [(set (match_dup 0)
2793 (and:SI (match_dup 1)
2795 (clobber (match_dup 4))])
2797 (compare:CC (match_dup 0)
2802 [(set (match_operand:CC 3 "cc_reg_operand" "")
2803 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2804 (match_operand:SI 2 "gpc_reg_operand" ""))
2806 (set (match_operand:SI 0 "gpc_reg_operand" "")
2807 (and:SI (match_dup 1)
2809 (clobber (match_scratch:CC 4 ""))]
2810 "TARGET_POWERPC64 && reload_completed"
2811 [(parallel [(set (match_dup 0)
2812 (and:SI (match_dup 1)
2814 (clobber (match_dup 4))])
2816 (compare:CC (match_dup 0)
2820 ;; Handle the PowerPC64 rlwinm corner case
2822 (define_insn_and_split "*andsi3_internal6"
2823 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2824 (and:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2825 (match_operand:SI 2 "mask_operand_wrap" "i")))]
2830 (and:SI (rotate:SI (match_dup 1) (match_dup 3))
2833 (rotate:SI (match_dup 0) (match_dup 5)))]
2836 int mb = extract_MB (operands[2]);
2837 int me = extract_ME (operands[2]);
2838 operands[3] = GEN_INT (me + 1);
2839 operands[5] = GEN_INT (32 - (me + 1));
2840 operands[4] = GEN_INT (~((HOST_WIDE_INT) -1 << (33 + me - mb)));
2842 [(set_attr "length" "8")])
2844 (define_expand "iorsi3"
2845 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2846 (ior:SI (match_operand:SI 1 "gpc_reg_operand" "")
2847 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
2851 if (GET_CODE (operands[2]) == CONST_INT
2852 && ! logical_operand (operands[2], SImode))
2854 HOST_WIDE_INT value = INTVAL (operands[2]);
2855 rtx tmp = ((!can_create_pseudo_p ()
2856 || rtx_equal_p (operands[0], operands[1]))
2857 ? operands[0] : gen_reg_rtx (SImode));
2859 emit_insn (gen_iorsi3 (tmp, operands[1],
2860 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
2861 emit_insn (gen_iorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
2866 (define_expand "xorsi3"
2867 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2868 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
2869 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
2873 if (GET_CODE (operands[2]) == CONST_INT
2874 && ! logical_operand (operands[2], SImode))
2876 HOST_WIDE_INT value = INTVAL (operands[2]);
2877 rtx tmp = ((!can_create_pseudo_p ()
2878 || rtx_equal_p (operands[0], operands[1]))
2879 ? operands[0] : gen_reg_rtx (SImode));
2881 emit_insn (gen_xorsi3 (tmp, operands[1],
2882 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
2883 emit_insn (gen_xorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
2888 (define_insn "*boolsi3_internal1"
2889 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
2890 (match_operator:SI 3 "boolean_or_operator"
2891 [(match_operand:SI 1 "gpc_reg_operand" "%r,r,r")
2892 (match_operand:SI 2 "logical_operand" "r,K,L")]))]
2899 (define_insn "*boolsi3_internal2"
2900 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2901 (compare:CC (match_operator:SI 4 "boolean_or_operator"
2902 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
2903 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
2905 (clobber (match_scratch:SI 3 "=r,r"))]
2910 [(set_attr "type" "fast_compare,compare")
2911 (set_attr "length" "4,8")])
2914 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
2915 (compare:CC (match_operator:SI 4 "boolean_operator"
2916 [(match_operand:SI 1 "gpc_reg_operand" "")
2917 (match_operand:SI 2 "gpc_reg_operand" "")])
2919 (clobber (match_scratch:SI 3 ""))]
2920 "TARGET_32BIT && reload_completed"
2921 [(set (match_dup 3) (match_dup 4))
2923 (compare:CC (match_dup 3)
2927 (define_insn "*boolsi3_internal3"
2928 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2929 (compare:CC (match_operator:SI 4 "boolean_operator"
2930 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
2931 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
2933 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2939 [(set_attr "type" "fast_compare,compare")
2940 (set_attr "length" "4,8")])
2943 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
2944 (compare:CC (match_operator:SI 4 "boolean_operator"
2945 [(match_operand:SI 1 "gpc_reg_operand" "")
2946 (match_operand:SI 2 "gpc_reg_operand" "")])
2948 (set (match_operand:SI 0 "gpc_reg_operand" "")
2950 "TARGET_32BIT && reload_completed"
2951 [(set (match_dup 0) (match_dup 4))
2953 (compare:CC (match_dup 0)
2957 ;; Split a logical operation that we can't do in one insn into two insns,
2958 ;; each of which does one 16-bit part. This is used by combine.
2961 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2962 (match_operator:SI 3 "boolean_or_operator"
2963 [(match_operand:SI 1 "gpc_reg_operand" "")
2964 (match_operand:SI 2 "non_logical_cint_operand" "")]))]
2966 [(set (match_dup 0) (match_dup 4))
2967 (set (match_dup 0) (match_dup 5))]
2971 i = GEN_INT (INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff));
2972 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
2974 i = GEN_INT (INTVAL (operands[2]) & 0xffff);
2975 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
2979 (define_insn "*boolcsi3_internal1"
2980 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2981 (match_operator:SI 3 "boolean_operator"
2982 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
2983 (match_operand:SI 2 "gpc_reg_operand" "r")]))]
2987 (define_insn "*boolcsi3_internal2"
2988 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2989 (compare:CC (match_operator:SI 4 "boolean_operator"
2990 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
2991 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
2993 (clobber (match_scratch:SI 3 "=r,r"))]
2998 [(set_attr "type" "compare")
2999 (set_attr "length" "4,8")])
3002 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3003 (compare:CC (match_operator:SI 4 "boolean_operator"
3004 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3005 (match_operand:SI 2 "gpc_reg_operand" "")])
3007 (clobber (match_scratch:SI 3 ""))]
3008 "TARGET_32BIT && reload_completed"
3009 [(set (match_dup 3) (match_dup 4))
3011 (compare:CC (match_dup 3)
3015 (define_insn "*boolcsi3_internal3"
3016 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3017 (compare:CC (match_operator:SI 4 "boolean_operator"
3018 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
3019 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3021 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3027 [(set_attr "type" "compare")
3028 (set_attr "length" "4,8")])
3031 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3032 (compare:CC (match_operator:SI 4 "boolean_operator"
3033 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3034 (match_operand:SI 2 "gpc_reg_operand" "")])
3036 (set (match_operand:SI 0 "gpc_reg_operand" "")
3038 "TARGET_32BIT && reload_completed"
3039 [(set (match_dup 0) (match_dup 4))
3041 (compare:CC (match_dup 0)
3045 (define_insn "*boolccsi3_internal1"
3046 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3047 (match_operator:SI 3 "boolean_operator"
3048 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
3049 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))]))]
3053 (define_insn "*boolccsi3_internal2"
3054 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3055 (compare:CC (match_operator:SI 4 "boolean_operator"
3056 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
3057 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
3059 (clobber (match_scratch:SI 3 "=r,r"))]
3064 [(set_attr "type" "fast_compare,compare")
3065 (set_attr "length" "4,8")])
3068 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3069 (compare:CC (match_operator:SI 4 "boolean_operator"
3070 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3071 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
3073 (clobber (match_scratch:SI 3 ""))]
3074 "TARGET_32BIT && reload_completed"
3075 [(set (match_dup 3) (match_dup 4))
3077 (compare:CC (match_dup 3)
3081 (define_insn "*boolccsi3_internal3"
3082 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3083 (compare:CC (match_operator:SI 4 "boolean_operator"
3084 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
3085 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
3087 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3093 [(set_attr "type" "fast_compare,compare")
3094 (set_attr "length" "4,8")])
3097 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3098 (compare:CC (match_operator:SI 4 "boolean_operator"
3099 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3100 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
3102 (set (match_operand:SI 0 "gpc_reg_operand" "")
3104 "TARGET_32BIT && reload_completed"
3105 [(set (match_dup 0) (match_dup 4))
3107 (compare:CC (match_dup 0)
3111 ;; Rotate and shift insns, in all their variants. These support shifts,
3112 ;; field inserts and extracts, and various combinations thereof.
3113 (define_expand "insv"
3114 [(set (zero_extract (match_operand 0 "gpc_reg_operand" "")
3115 (match_operand:SI 1 "const_int_operand" "")
3116 (match_operand:SI 2 "const_int_operand" ""))
3117 (match_operand 3 "gpc_reg_operand" ""))]
3121 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3122 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3123 compiler if the address of the structure is taken later. Likewise, do
3124 not handle invalid E500 subregs. */
3125 if (GET_CODE (operands[0]) == SUBREG
3126 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD
3127 || ((TARGET_E500_DOUBLE || TARGET_SPE)
3128 && invalid_e500_subreg (operands[0], GET_MODE (operands[0])))))
3131 if (TARGET_POWERPC64 && GET_MODE (operands[0]) == DImode)
3132 emit_insn (gen_insvdi_internal (operands[0], operands[1], operands[2],
3135 emit_insn (gen_insvsi_internal (operands[0], operands[1], operands[2],
3140 (define_insn "insvsi_internal"
3141 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3142 (match_operand:SI 1 "const_int_operand" "i")
3143 (match_operand:SI 2 "const_int_operand" "i"))
3144 (match_operand:SI 3 "gpc_reg_operand" "r"))]
3148 int start = INTVAL (operands[2]) & 31;
3149 int size = INTVAL (operands[1]) & 31;
3151 operands[4] = GEN_INT (32 - start - size);
3152 operands[1] = GEN_INT (start + size - 1);
3153 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3155 [(set_attr "type" "insert_word")])
3157 (define_insn "*insvsi_internal1"
3158 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3159 (match_operand:SI 1 "const_int_operand" "i")
3160 (match_operand:SI 2 "const_int_operand" "i"))
3161 (rotate:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3162 (match_operand:SI 4 "const_int_operand" "i")))]
3163 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3166 int shift = INTVAL (operands[4]) & 31;
3167 int start = INTVAL (operands[2]) & 31;
3168 int size = INTVAL (operands[1]) & 31;
3170 operands[4] = GEN_INT (shift - start - size);
3171 operands[1] = GEN_INT (start + size - 1);
3172 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3174 [(set_attr "type" "insert_word")])
3176 (define_insn "*insvsi_internal2"
3177 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3178 (match_operand:SI 1 "const_int_operand" "i")
3179 (match_operand:SI 2 "const_int_operand" "i"))
3180 (ashiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3181 (match_operand:SI 4 "const_int_operand" "i")))]
3182 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3185 int shift = INTVAL (operands[4]) & 31;
3186 int start = INTVAL (operands[2]) & 31;
3187 int size = INTVAL (operands[1]) & 31;
3189 operands[4] = GEN_INT (32 - shift - start - size);
3190 operands[1] = GEN_INT (start + size - 1);
3191 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3193 [(set_attr "type" "insert_word")])
3195 (define_insn "*insvsi_internal3"
3196 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3197 (match_operand:SI 1 "const_int_operand" "i")
3198 (match_operand:SI 2 "const_int_operand" "i"))
3199 (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3200 (match_operand:SI 4 "const_int_operand" "i")))]
3201 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3204 int shift = INTVAL (operands[4]) & 31;
3205 int start = INTVAL (operands[2]) & 31;
3206 int size = INTVAL (operands[1]) & 31;
3208 operands[4] = GEN_INT (32 - shift - start - size);
3209 operands[1] = GEN_INT (start + size - 1);
3210 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3212 [(set_attr "type" "insert_word")])
3214 (define_insn "*insvsi_internal4"
3215 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3216 (match_operand:SI 1 "const_int_operand" "i")
3217 (match_operand:SI 2 "const_int_operand" "i"))
3218 (zero_extract:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3219 (match_operand:SI 4 "const_int_operand" "i")
3220 (match_operand:SI 5 "const_int_operand" "i")))]
3221 "INTVAL (operands[4]) >= INTVAL (operands[1])"
3224 int extract_start = INTVAL (operands[5]) & 31;
3225 int extract_size = INTVAL (operands[4]) & 31;
3226 int insert_start = INTVAL (operands[2]) & 31;
3227 int insert_size = INTVAL (operands[1]) & 31;
3229 /* Align extract field with insert field */
3230 operands[5] = GEN_INT (extract_start + extract_size - insert_start - insert_size);
3231 operands[1] = GEN_INT (insert_start + insert_size - 1);
3232 return \"rlwimi %0,%3,%h5,%h2,%h1\";
3234 [(set_attr "type" "insert_word")])
3236 ;; combine patterns for rlwimi
3237 (define_insn "*insvsi_internal5"
3238 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3239 (ior:SI (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
3240 (match_operand:SI 1 "mask_operand" "i"))
3241 (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3242 (match_operand:SI 2 "const_int_operand" "i"))
3243 (match_operand:SI 5 "mask_operand" "i"))))]
3244 "INTVAL(operands[1]) == ~INTVAL(operands[5])"
3247 int me = extract_ME(operands[5]);
3248 int mb = extract_MB(operands[5]);
3249 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
3250 operands[2] = GEN_INT(mb);
3251 operands[1] = GEN_INT(me);
3252 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3254 [(set_attr "type" "insert_word")])
3256 (define_insn "*insvsi_internal6"
3257 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3258 (ior:SI (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3259 (match_operand:SI 2 "const_int_operand" "i"))
3260 (match_operand:SI 5 "mask_operand" "i"))
3261 (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
3262 (match_operand:SI 1 "mask_operand" "i"))))]
3263 "INTVAL(operands[1]) == ~INTVAL(operands[5])"
3266 int me = extract_ME(operands[5]);
3267 int mb = extract_MB(operands[5]);
3268 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
3269 operands[2] = GEN_INT(mb);
3270 operands[1] = GEN_INT(me);
3271 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3273 [(set_attr "type" "insert_word")])
3275 (define_insn "insvdi_internal"
3276 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3277 (match_operand:SI 1 "const_int_operand" "i")
3278 (match_operand:SI 2 "const_int_operand" "i"))
3279 (match_operand:DI 3 "gpc_reg_operand" "r"))]
3283 int start = INTVAL (operands[2]) & 63;
3284 int size = INTVAL (operands[1]) & 63;
3286 operands[1] = GEN_INT (64 - start - size);
3287 return \"rldimi %0,%3,%H1,%H2\";
3289 [(set_attr "type" "insert_dword")])
3291 (define_insn "*insvdi_internal2"
3292 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3293 (match_operand:SI 1 "const_int_operand" "i")
3294 (match_operand:SI 2 "const_int_operand" "i"))
3295 (ashiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
3296 (match_operand:SI 4 "const_int_operand" "i")))]
3298 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
3301 int shift = INTVAL (operands[4]) & 63;
3302 int start = (INTVAL (operands[2]) & 63) - 32;
3303 int size = INTVAL (operands[1]) & 63;
3305 operands[4] = GEN_INT (64 - shift - start - size);
3306 operands[2] = GEN_INT (start);
3307 operands[1] = GEN_INT (start + size - 1);
3308 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3311 (define_insn "*insvdi_internal3"
3312 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3313 (match_operand:SI 1 "const_int_operand" "i")
3314 (match_operand:SI 2 "const_int_operand" "i"))
3315 (lshiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
3316 (match_operand:SI 4 "const_int_operand" "i")))]
3318 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
3321 int shift = INTVAL (operands[4]) & 63;
3322 int start = (INTVAL (operands[2]) & 63) - 32;
3323 int size = INTVAL (operands[1]) & 63;
3325 operands[4] = GEN_INT (64 - shift - start - size);
3326 operands[2] = GEN_INT (start);
3327 operands[1] = GEN_INT (start + size - 1);
3328 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3331 (define_expand "extzv"
3332 [(set (match_operand 0 "gpc_reg_operand" "")
3333 (zero_extract (match_operand 1 "gpc_reg_operand" "")
3334 (match_operand:SI 2 "const_int_operand" "")
3335 (match_operand:SI 3 "const_int_operand" "")))]
3339 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3340 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3341 compiler if the address of the structure is taken later. */
3342 if (GET_CODE (operands[0]) == SUBREG
3343 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
3346 if (TARGET_POWERPC64 && GET_MODE (operands[1]) == DImode)
3347 emit_insn (gen_extzvdi_internal (operands[0], operands[1], operands[2],
3350 emit_insn (gen_extzvsi_internal (operands[0], operands[1], operands[2],
3355 (define_insn "extzvsi_internal"
3356 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3357 (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3358 (match_operand:SI 2 "const_int_operand" "i")
3359 (match_operand:SI 3 "const_int_operand" "i")))]
3363 int start = INTVAL (operands[3]) & 31;
3364 int size = INTVAL (operands[2]) & 31;
3366 if (start + size >= 32)
3367 operands[3] = const0_rtx;
3369 operands[3] = GEN_INT (start + size);
3370 return \"rlwinm %0,%1,%3,%s2,31\";
3373 (define_insn "*extzvsi_internal1"
3374 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3375 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3376 (match_operand:SI 2 "const_int_operand" "i,i")
3377 (match_operand:SI 3 "const_int_operand" "i,i"))
3379 (clobber (match_scratch:SI 4 "=r,r"))]
3383 int start = INTVAL (operands[3]) & 31;
3384 int size = INTVAL (operands[2]) & 31;
3386 /* Force split for non-cc0 compare. */
3387 if (which_alternative == 1)
3390 /* If the bit-field being tested fits in the upper or lower half of a
3391 word, it is possible to use andiu. or andil. to test it. This is
3392 useful because the condition register set-use delay is smaller for
3393 andi[ul]. than for rlinm. This doesn't work when the starting bit
3394 position is 0 because the LT and GT bits may be set wrong. */
3396 if ((start > 0 && start + size <= 16) || start >= 16)
3398 operands[3] = GEN_INT (((1 << (16 - (start & 15)))
3399 - (1 << (16 - (start & 15) - size))));
3401 return \"andis. %4,%1,%3\";
3403 return \"andi. %4,%1,%3\";
3406 if (start + size >= 32)
3407 operands[3] = const0_rtx;
3409 operands[3] = GEN_INT (start + size);
3410 return \"rlwinm. %4,%1,%3,%s2,31\";
3412 [(set_attr "type" "delayed_compare")
3413 (set_attr "length" "4,8")])
3416 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3417 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3418 (match_operand:SI 2 "const_int_operand" "")
3419 (match_operand:SI 3 "const_int_operand" ""))
3421 (clobber (match_scratch:SI 4 ""))]
3424 (zero_extract:SI (match_dup 1) (match_dup 2)
3427 (compare:CC (match_dup 4)
3431 (define_insn "*extzvsi_internal2"
3432 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3433 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3434 (match_operand:SI 2 "const_int_operand" "i,i")
3435 (match_operand:SI 3 "const_int_operand" "i,i"))
3437 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3438 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3442 int start = INTVAL (operands[3]) & 31;
3443 int size = INTVAL (operands[2]) & 31;
3445 /* Force split for non-cc0 compare. */
3446 if (which_alternative == 1)
3449 /* Since we are using the output value, we can't ignore any need for
3450 a shift. The bit-field must end at the LSB. */
3451 if (start >= 16 && start + size == 32)
3453 operands[3] = GEN_INT ((1 << size) - 1);
3454 return \"andi. %0,%1,%3\";
3457 if (start + size >= 32)
3458 operands[3] = const0_rtx;
3460 operands[3] = GEN_INT (start + size);
3461 return \"rlwinm. %0,%1,%3,%s2,31\";
3463 [(set_attr "type" "delayed_compare")
3464 (set_attr "length" "4,8")])
3467 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
3468 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3469 (match_operand:SI 2 "const_int_operand" "")
3470 (match_operand:SI 3 "const_int_operand" ""))
3472 (set (match_operand:SI 0 "gpc_reg_operand" "")
3473 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3476 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))
3478 (compare:CC (match_dup 0)
3482 (define_insn "extzvdi_internal"
3483 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
3484 (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3485 (match_operand:SI 2 "const_int_operand" "i")
3486 (match_operand:SI 3 "const_int_operand" "i")))]
3490 int start = INTVAL (operands[3]) & 63;
3491 int size = INTVAL (operands[2]) & 63;
3493 if (start + size >= 64)
3494 operands[3] = const0_rtx;
3496 operands[3] = GEN_INT (start + size);
3497 operands[2] = GEN_INT (64 - size);
3498 return \"rldicl %0,%1,%3,%2\";
3501 (define_insn "*extzvdi_internal1"
3502 [(set (match_operand:CC 0 "gpc_reg_operand" "=x")
3503 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3504 (match_operand:SI 2 "const_int_operand" "i")
3505 (match_operand:SI 3 "const_int_operand" "i"))
3507 (clobber (match_scratch:DI 4 "=r"))]
3508 "TARGET_64BIT && rs6000_gen_cell_microcode"
3511 int start = INTVAL (operands[3]) & 63;
3512 int size = INTVAL (operands[2]) & 63;
3514 if (start + size >= 64)
3515 operands[3] = const0_rtx;
3517 operands[3] = GEN_INT (start + size);
3518 operands[2] = GEN_INT (64 - size);
3519 return \"rldicl. %4,%1,%3,%2\";
3521 [(set_attr "type" "compare")])
3523 (define_insn "*extzvdi_internal2"
3524 [(set (match_operand:CC 4 "gpc_reg_operand" "=x")
3525 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3526 (match_operand:SI 2 "const_int_operand" "i")
3527 (match_operand:SI 3 "const_int_operand" "i"))
3529 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
3530 (zero_extract:DI (match_dup 1) (match_dup 2) (match_dup 3)))]
3531 "TARGET_64BIT && rs6000_gen_cell_microcode"
3534 int start = INTVAL (operands[3]) & 63;
3535 int size = INTVAL (operands[2]) & 63;
3537 if (start + size >= 64)
3538 operands[3] = const0_rtx;
3540 operands[3] = GEN_INT (start + size);
3541 operands[2] = GEN_INT (64 - size);
3542 return \"rldicl. %0,%1,%3,%2\";
3544 [(set_attr "type" "compare")])
3546 (define_insn "rotlsi3"
3547 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3548 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3549 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
3552 rlwnm %0,%1,%2,0xffffffff
3553 rlwinm %0,%1,%h2,0xffffffff"
3554 [(set_attr "type" "var_shift_rotate,integer")])
3556 (define_insn "*rotlsi3_64"
3557 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
3559 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3560 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))))]
3563 rlwnm %0,%1,%2,0xffffffff
3564 rlwinm %0,%1,%h2,0xffffffff"
3565 [(set_attr "type" "var_shift_rotate,integer")])
3567 (define_insn "*rotlsi3_internal2"
3568 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3569 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3570 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3572 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
3575 rlwnm. %3,%1,%2,0xffffffff
3576 rlwinm. %3,%1,%h2,0xffffffff
3579 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3580 (set_attr "length" "4,4,8,8")])
3583 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3584 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3585 (match_operand:SI 2 "reg_or_cint_operand" ""))
3587 (clobber (match_scratch:SI 3 ""))]
3590 (rotate:SI (match_dup 1) (match_dup 2)))
3592 (compare:CC (match_dup 3)
3596 (define_insn "*rotlsi3_internal3"
3597 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
3598 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3599 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3601 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
3602 (rotate:SI (match_dup 1) (match_dup 2)))]
3605 rlwnm. %0,%1,%2,0xffffffff
3606 rlwinm. %0,%1,%h2,0xffffffff
3609 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3610 (set_attr "length" "4,4,8,8")])
3613 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3614 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3615 (match_operand:SI 2 "reg_or_cint_operand" ""))
3617 (set (match_operand:SI 0 "gpc_reg_operand" "")
3618 (rotate:SI (match_dup 1) (match_dup 2)))]
3621 (rotate:SI (match_dup 1) (match_dup 2)))
3623 (compare:CC (match_dup 0)
3627 (define_insn "*rotlsi3_internal4"
3628 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3629 (and:SI (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3630 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
3631 (match_operand:SI 3 "mask_operand" "n,n")))]
3634 rlwnm %0,%1,%2,%m3,%M3
3635 rlwinm %0,%1,%h2,%m3,%M3"
3636 [(set_attr "type" "var_shift_rotate,integer")])
3638 (define_insn "*rotlsi3_internal5"
3639 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3641 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3642 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3643 (match_operand:SI 3 "mask_operand" "n,n,n,n"))
3645 (clobber (match_scratch:SI 4 "=r,r,r,r"))]
3648 rlwnm. %4,%1,%2,%m3,%M3
3649 rlwinm. %4,%1,%h2,%m3,%M3
3652 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3653 (set_attr "length" "4,4,8,8")])
3656 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3658 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3659 (match_operand:SI 2 "reg_or_cint_operand" ""))
3660 (match_operand:SI 3 "mask_operand" ""))
3662 (clobber (match_scratch:SI 4 ""))]
3665 (and:SI (rotate:SI (match_dup 1)
3669 (compare:CC (match_dup 4)
3673 (define_insn "*rotlsi3_internal6"
3674 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
3676 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3677 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3678 (match_operand:SI 3 "mask_operand" "n,n,n,n"))
3680 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
3681 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3684 rlwnm. %0,%1,%2,%m3,%M3
3685 rlwinm. %0,%1,%h2,%m3,%M3
3688 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3689 (set_attr "length" "4,4,8,8")])
3692 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
3694 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3695 (match_operand:SI 2 "reg_or_cint_operand" ""))
3696 (match_operand:SI 3 "mask_operand" ""))
3698 (set (match_operand:SI 0 "gpc_reg_operand" "")
3699 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3702 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
3704 (compare:CC (match_dup 0)
3708 (define_insn "*rotlsi3_internal7"
3709 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3712 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3713 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
3715 "rlw%I2nm %0,%1,%h2,0xff"
3716 [(set (attr "cell_micro")
3717 (if_then_else (match_operand:SI 2 "const_int_operand" "")
3718 (const_string "not")
3719 (const_string "always")))])
3721 (define_insn "*rotlsi3_internal8"
3722 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3723 (compare:CC (zero_extend:SI
3725 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3726 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
3728 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
3731 rlwnm. %3,%1,%2,0xff
3732 rlwinm. %3,%1,%h2,0xff
3735 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3736 (set_attr "length" "4,4,8,8")])
3739 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3740 (compare:CC (zero_extend:SI
3742 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3743 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3745 (clobber (match_scratch:SI 3 ""))]
3748 (zero_extend:SI (subreg:QI
3749 (rotate:SI (match_dup 1)
3752 (compare:CC (match_dup 3)
3756 (define_insn "*rotlsi3_internal9"
3757 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
3758 (compare:CC (zero_extend:SI
3760 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3761 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
3763 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
3764 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3767 rlwnm. %0,%1,%2,0xff
3768 rlwinm. %0,%1,%h2,0xff
3771 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3772 (set_attr "length" "4,4,8,8")])
3775 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3776 (compare:CC (zero_extend:SI
3778 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3779 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3781 (set (match_operand:SI 0 "gpc_reg_operand" "")
3782 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3785 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
3787 (compare:CC (match_dup 0)
3791 (define_insn "*rotlsi3_internal10"
3792 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3795 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3796 (match_operand:SI 2 "reg_or_cint_operand" "r,i")) 0)))]
3799 rlwnm %0,%1,%2,0xffff
3800 rlwinm %0,%1,%h2,0xffff"
3801 [(set_attr "type" "var_shift_rotate,integer")])
3804 (define_insn "*rotlsi3_internal11"
3805 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3806 (compare:CC (zero_extend:SI
3808 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3809 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
3811 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
3814 rlwnm. %3,%1,%2,0xffff
3815 rlwinm. %3,%1,%h2,0xffff
3818 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3819 (set_attr "length" "4,4,8,8")])
3822 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3823 (compare:CC (zero_extend:SI
3825 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3826 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3828 (clobber (match_scratch:SI 3 ""))]
3831 (zero_extend:SI (subreg:HI
3832 (rotate:SI (match_dup 1)
3835 (compare:CC (match_dup 3)
3839 (define_insn "*rotlsi3_internal12"
3840 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
3841 (compare:CC (zero_extend:SI
3843 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3844 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
3846 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
3847 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3850 rlwnm. %0,%1,%2,0xffff
3851 rlwinm. %0,%1,%h2,0xffff
3854 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3855 (set_attr "length" "4,4,8,8")])
3858 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3859 (compare:CC (zero_extend:SI
3861 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3862 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3864 (set (match_operand:SI 0 "gpc_reg_operand" "")
3865 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3868 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
3870 (compare:CC (match_dup 0)
3874 (define_insn "ashlsi3"
3875 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3876 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3877 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
3882 [(set_attr "type" "var_shift_rotate,shift")])
3884 (define_insn "*ashlsi3_64"
3885 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
3887 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3888 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))))]
3893 [(set_attr "type" "var_shift_rotate,shift")])
3896 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3897 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3898 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3900 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
3907 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3908 (set_attr "length" "4,4,8,8")])
3911 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3912 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3913 (match_operand:SI 2 "reg_or_cint_operand" ""))
3915 (clobber (match_scratch:SI 3 ""))]
3916 "TARGET_32BIT && reload_completed"
3918 (ashift:SI (match_dup 1) (match_dup 2)))
3920 (compare:CC (match_dup 3)
3925 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
3926 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3927 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3929 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
3930 (ashift:SI (match_dup 1) (match_dup 2)))]
3937 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3938 (set_attr "length" "4,4,8,8")])
3941 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3942 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3943 (match_operand:SI 2 "reg_or_cint_operand" ""))
3945 (set (match_operand:SI 0 "gpc_reg_operand" "")
3946 (ashift:SI (match_dup 1) (match_dup 2)))]
3947 "TARGET_32BIT && reload_completed"
3949 (ashift:SI (match_dup 1) (match_dup 2)))
3951 (compare:CC (match_dup 0)
3955 (define_insn "rlwinm"
3956 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3957 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3958 (match_operand:SI 2 "const_int_operand" "i"))
3959 (match_operand:SI 3 "mask_operand" "n")))]
3960 "includes_lshift_p (operands[2], operands[3])"
3961 "rlwinm %0,%1,%h2,%m3,%M3")
3964 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3966 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3967 (match_operand:SI 2 "const_int_operand" "i,i"))
3968 (match_operand:SI 3 "mask_operand" "n,n"))
3970 (clobber (match_scratch:SI 4 "=r,r"))]
3971 "includes_lshift_p (operands[2], operands[3])"
3973 rlwinm. %4,%1,%h2,%m3,%M3
3975 [(set_attr "type" "delayed_compare")
3976 (set_attr "length" "4,8")])
3979 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3981 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3982 (match_operand:SI 2 "const_int_operand" ""))
3983 (match_operand:SI 3 "mask_operand" ""))
3985 (clobber (match_scratch:SI 4 ""))]
3986 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
3988 (and:SI (ashift:SI (match_dup 1) (match_dup 2))
3991 (compare:CC (match_dup 4)
3996 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3998 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3999 (match_operand:SI 2 "const_int_operand" "i,i"))
4000 (match_operand:SI 3 "mask_operand" "n,n"))
4002 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4003 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4004 "includes_lshift_p (operands[2], operands[3])"
4006 rlwinm. %0,%1,%h2,%m3,%M3
4008 [(set_attr "type" "delayed_compare")
4009 (set_attr "length" "4,8")])
4012 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
4014 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4015 (match_operand:SI 2 "const_int_operand" ""))
4016 (match_operand:SI 3 "mask_operand" ""))
4018 (set (match_operand:SI 0 "gpc_reg_operand" "")
4019 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4020 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
4022 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4024 (compare:CC (match_dup 0)
4028 (define_insn "lshrsi3"
4029 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
4030 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
4031 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i")))]
4037 [(set_attr "type" "integer,var_shift_rotate,shift")])
4039 (define_insn "*lshrsi3_64"
4040 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
4042 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4043 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))))]
4048 [(set_attr "type" "var_shift_rotate,shift")])
4051 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,?y,?y,?y")
4052 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
4053 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i,O,r,i"))
4055 (clobber (match_scratch:SI 3 "=X,r,r,X,r,r"))]
4064 [(set_attr "type" "delayed_compare,var_delayed_compare,delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4065 (set_attr "length" "4,4,4,8,8,8")])
4068 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4069 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4070 (match_operand:SI 2 "reg_or_cint_operand" ""))
4072 (clobber (match_scratch:SI 3 ""))]
4073 "TARGET_32BIT && reload_completed"
4075 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4077 (compare:CC (match_dup 3)
4082 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,?y,?y,?y")
4083 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
4084 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i,O,r,i"))
4086 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
4087 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
4096 [(set_attr "type" "delayed_compare,var_delayed_compare,delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4097 (set_attr "length" "4,4,4,8,8,8")])
4100 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4101 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4102 (match_operand:SI 2 "reg_or_cint_operand" ""))
4104 (set (match_operand:SI 0 "gpc_reg_operand" "")
4105 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
4106 "TARGET_32BIT && reload_completed"
4108 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4110 (compare:CC (match_dup 0)
4115 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4116 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4117 (match_operand:SI 2 "const_int_operand" "i"))
4118 (match_operand:SI 3 "mask_operand" "n")))]
4119 "includes_rshift_p (operands[2], operands[3])"
4120 "rlwinm %0,%1,%s2,%m3,%M3")
4123 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4125 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4126 (match_operand:SI 2 "const_int_operand" "i,i"))
4127 (match_operand:SI 3 "mask_operand" "n,n"))
4129 (clobber (match_scratch:SI 4 "=r,r"))]
4130 "includes_rshift_p (operands[2], operands[3])"
4132 rlwinm. %4,%1,%s2,%m3,%M3
4134 [(set_attr "type" "delayed_compare")
4135 (set_attr "length" "4,8")])
4138 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4140 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4141 (match_operand:SI 2 "const_int_operand" ""))
4142 (match_operand:SI 3 "mask_operand" ""))
4144 (clobber (match_scratch:SI 4 ""))]
4145 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
4147 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2))
4150 (compare:CC (match_dup 4)
4155 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4157 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4158 (match_operand:SI 2 "const_int_operand" "i,i"))
4159 (match_operand:SI 3 "mask_operand" "n,n"))
4161 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4162 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4163 "includes_rshift_p (operands[2], operands[3])"
4165 rlwinm. %0,%1,%s2,%m3,%M3
4167 [(set_attr "type" "delayed_compare")
4168 (set_attr "length" "4,8")])
4171 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
4173 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4174 (match_operand:SI 2 "const_int_operand" ""))
4175 (match_operand:SI 3 "mask_operand" ""))
4177 (set (match_operand:SI 0 "gpc_reg_operand" "")
4178 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4179 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
4181 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4183 (compare:CC (match_dup 0)
4188 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4191 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4192 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4193 "includes_rshift_p (operands[2], GEN_INT (255))"
4194 "rlwinm %0,%1,%s2,0xff")
4197 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4201 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4202 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4204 (clobber (match_scratch:SI 3 "=r,r"))]
4205 "includes_rshift_p (operands[2], GEN_INT (255))"
4207 rlwinm. %3,%1,%s2,0xff
4209 [(set_attr "type" "delayed_compare")
4210 (set_attr "length" "4,8")])
4213 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4217 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4218 (match_operand:SI 2 "const_int_operand" "")) 0))
4220 (clobber (match_scratch:SI 3 ""))]
4221 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4223 (zero_extend:SI (subreg:QI
4224 (lshiftrt:SI (match_dup 1)
4227 (compare:CC (match_dup 3)
4232 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4236 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4237 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4239 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4240 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4241 "includes_rshift_p (operands[2], GEN_INT (255))"
4243 rlwinm. %0,%1,%s2,0xff
4245 [(set_attr "type" "delayed_compare")
4246 (set_attr "length" "4,8")])
4249 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4253 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4254 (match_operand:SI 2 "const_int_operand" "")) 0))
4256 (set (match_operand:SI 0 "gpc_reg_operand" "")
4257 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4258 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4260 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4262 (compare:CC (match_dup 0)
4267 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4270 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4271 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4272 "includes_rshift_p (operands[2], GEN_INT (65535))"
4273 "rlwinm %0,%1,%s2,0xffff")
4276 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4280 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4281 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4283 (clobber (match_scratch:SI 3 "=r,r"))]
4284 "includes_rshift_p (operands[2], GEN_INT (65535))"
4286 rlwinm. %3,%1,%s2,0xffff
4288 [(set_attr "type" "delayed_compare")
4289 (set_attr "length" "4,8")])
4292 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4296 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4297 (match_operand:SI 2 "const_int_operand" "")) 0))
4299 (clobber (match_scratch:SI 3 ""))]
4300 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4302 (zero_extend:SI (subreg:HI
4303 (lshiftrt:SI (match_dup 1)
4306 (compare:CC (match_dup 3)
4311 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4315 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4316 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4318 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4319 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4320 "includes_rshift_p (operands[2], GEN_INT (65535))"
4322 rlwinm. %0,%1,%s2,0xffff
4324 [(set_attr "type" "delayed_compare")
4325 (set_attr "length" "4,8")])
4328 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4332 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4333 (match_operand:SI 2 "const_int_operand" "")) 0))
4335 (set (match_operand:SI 0 "gpc_reg_operand" "")
4336 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4337 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4339 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4341 (compare:CC (match_dup 0)
4345 (define_insn "ashrsi3"
4346 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4347 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4348 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
4353 [(set_attr "type" "var_shift_rotate,shift")])
4355 (define_insn "*ashrsi3_64"
4356 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
4358 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4359 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))))]
4364 [(set_attr "type" "var_shift_rotate,shift")])
4367 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4368 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4369 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4371 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4378 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4379 (set_attr "length" "4,4,8,8")])
4382 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4383 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4384 (match_operand:SI 2 "reg_or_cint_operand" ""))
4386 (clobber (match_scratch:SI 3 ""))]
4389 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4391 (compare:CC (match_dup 3)
4396 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4397 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4398 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4400 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4401 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
4408 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4409 (set_attr "length" "4,4,8,8")])
4411 ;; Builtins to replace a division to generate FRE reciprocal estimate
4412 ;; instructions and the necessary fixup instructions
4413 (define_expand "recip<mode>3"
4414 [(match_operand:RECIPF 0 "gpc_reg_operand" "")
4415 (match_operand:RECIPF 1 "gpc_reg_operand" "")
4416 (match_operand:RECIPF 2 "gpc_reg_operand" "")]
4417 "RS6000_RECIP_HAVE_RE_P (<MODE>mode)"
4419 rs6000_emit_swdiv (operands[0], operands[1], operands[2], false);
4423 ;; Split to create division from FRE/FRES/etc. and fixup instead of the normal
4424 ;; hardware division. This is only done before register allocation and with
4425 ;; -ffast-math. This must appear before the divsf3/divdf3 insns.
4427 [(set (match_operand:RECIPF 0 "gpc_reg_operand" "")
4428 (div:RECIPF (match_operand 1 "gpc_reg_operand" "")
4429 (match_operand 2 "gpc_reg_operand" "")))]
4430 "RS6000_RECIP_AUTO_RE_P (<MODE>mode)
4431 && can_create_pseudo_p () && optimize_insn_for_speed_p ()
4432 && flag_finite_math_only && !flag_trapping_math && flag_reciprocal_math"
4435 rs6000_emit_swdiv (operands[0], operands[1], operands[2], true);
4439 ;; Builtins to replace 1/sqrt(x) with instructions using RSQRTE and the
4440 ;; appropriate fixup.
4441 (define_expand "rsqrt<mode>2"
4442 [(match_operand:RECIPF 0 "gpc_reg_operand" "")
4443 (match_operand:RECIPF 1 "gpc_reg_operand" "")]
4444 "RS6000_RECIP_HAVE_RSQRTE_P (<MODE>mode)"
4446 rs6000_emit_swrsqrt (operands[0], operands[1]);
4451 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4452 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4453 (match_operand:SI 2 "reg_or_cint_operand" ""))
4455 (set (match_operand:SI 0 "gpc_reg_operand" "")
4456 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
4459 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4461 (compare:CC (match_dup 0)
4465 ;; Floating-point insns, excluding normal data motion.
4467 ;; PowerPC has a full set of single-precision floating point instructions.
4469 ;; For the POWER architecture, we pretend that we have both SFmode and
4470 ;; DFmode insns, while, in fact, all fp insns are actually done in double.
4471 ;; The only conversions we will do will be when storing to memory. In that
4472 ;; case, we will use the "frsp" instruction before storing.
4474 ;; Note that when we store into a single-precision memory location, we need to
4475 ;; use the frsp insn first. If the register being stored isn't dead, we
4476 ;; need a scratch register for the frsp. But this is difficult when the store
4477 ;; is done by reload. It is not incorrect to do the frsp on the register in
4478 ;; this case, we just lose precision that we would have otherwise gotten but
4479 ;; is not guaranteed. Perhaps this should be tightened up at some point.
4481 (define_expand "extendsfdf2"
4482 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4483 (float_extend:DF (match_operand:SF 1 "reg_or_none500mem_operand" "")))]
4484 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
4487 (define_insn_and_split "*extendsfdf2_fpr"
4488 [(set (match_operand:DF 0 "gpc_reg_operand" "=d,?d,d")
4489 (float_extend:DF (match_operand:SF 1 "reg_or_mem_operand" "0,f,m")))]
4490 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
4495 "&& reload_completed && REG_P (operands[1]) && REGNO (operands[0]) == REGNO (operands[1])"
4498 emit_note (NOTE_INSN_DELETED);
4501 [(set_attr "type" "fp,fp,fpload")])
4503 (define_expand "truncdfsf2"
4504 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4505 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "")))]
4506 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
4509 (define_insn "*truncdfsf2_fpr"
4510 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4511 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "d")))]
4512 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
4514 [(set_attr "type" "fp")])
4516 (define_expand "negsf2"
4517 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4518 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
4519 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
4522 (define_insn "*negsf2"
4523 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4524 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4525 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
4527 [(set_attr "type" "fp")])
4529 (define_expand "abssf2"
4530 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4531 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
4532 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
4535 (define_insn "*abssf2"
4536 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4537 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4538 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
4540 [(set_attr "type" "fp")])
4543 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4544 (neg:SF (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f"))))]
4545 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
4547 [(set_attr "type" "fp")])
4549 (define_expand "addsf3"
4550 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4551 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "")
4552 (match_operand:SF 2 "gpc_reg_operand" "")))]
4553 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
4557 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4558 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4559 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4560 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
4562 [(set_attr "type" "fp")
4563 (set_attr "fp_type" "fp_addsub_s")])
4565 (define_expand "subsf3"
4566 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4567 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "")
4568 (match_operand:SF 2 "gpc_reg_operand" "")))]
4569 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
4573 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4574 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4575 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4576 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
4578 [(set_attr "type" "fp")
4579 (set_attr "fp_type" "fp_addsub_s")])
4581 (define_expand "mulsf3"
4582 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4583 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "")
4584 (match_operand:SF 2 "gpc_reg_operand" "")))]
4585 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
4589 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4590 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4591 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4592 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
4594 [(set_attr "type" "fp")
4595 (set_attr "fp_type" "fp_mul_s")])
4597 (define_expand "divsf3"
4598 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4599 (div:SF (match_operand:SF 1 "gpc_reg_operand" "")
4600 (match_operand:SF 2 "gpc_reg_operand" "")))]
4601 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
4605 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4606 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4607 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4608 "TARGET_HARD_FLOAT && TARGET_FPRS
4609 && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
4611 [(set_attr "type" "sdiv")])
4614 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4615 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))]
4618 [(set_attr "type" "fp")])
4620 ; builtin fmaf support
4621 (define_insn "*fmasf4_fpr"
4622 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4623 (fma:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4624 (match_operand:SF 2 "gpc_reg_operand" "f")
4625 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4626 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
4627 "fmadds %0,%1,%2,%3"
4628 [(set_attr "type" "fp")
4629 (set_attr "fp_type" "fp_maddsub_s")])
4631 (define_insn "*fmssf4_fpr"
4632 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4633 (fma:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4634 (match_operand:SF 2 "gpc_reg_operand" "f")
4635 (neg:SF (match_operand:SF 3 "gpc_reg_operand" "f"))))]
4636 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
4637 "fmsubs %0,%1,%2,%3"
4638 [(set_attr "type" "fp")
4639 (set_attr "fp_type" "fp_maddsub_s")])
4641 (define_insn "*nfmasf4_fpr"
4642 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4643 (neg:SF (fma:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4644 (match_operand:SF 2 "gpc_reg_operand" "f")
4645 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
4646 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
4647 "fnmadds %0,%1,%2,%3"
4648 [(set_attr "type" "fp")
4649 (set_attr "fp_type" "fp_maddsub_s")])
4651 (define_insn "*nfmssf4_fpr"
4652 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4653 (neg:SF (fma:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4654 (match_operand:SF 2 "gpc_reg_operand" "f")
4655 (neg:SF (match_operand:SF 3 "gpc_reg_operand" "f")))))]
4656 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
4657 "fnmsubs %0,%1,%2,%3"
4658 [(set_attr "type" "fp")
4659 (set_attr "fp_type" "fp_maddsub_s")])
4661 (define_expand "sqrtsf2"
4662 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4663 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
4664 "(TARGET_PPC_GPOPT || TARGET_XILINX_FPU)
4665 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
4666 && !TARGET_SIMPLE_FPU"
4670 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4671 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4672 "(TARGET_PPC_GPOPT || TARGET_XILINX_FPU) && TARGET_HARD_FLOAT
4673 && TARGET_FPRS && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
4675 [(set_attr "type" "ssqrt")])
4677 (define_insn "*rsqrtsf_internal1"
4678 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4679 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")]
4683 [(set_attr "type" "fp")])
4685 (define_expand "copysign<mode>3"
4687 (abs:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")))
4689 (neg:SFDF (abs:SFDF (match_dup 1))))
4690 (set (match_operand:SFDF 0 "gpc_reg_operand" "")
4691 (if_then_else:SFDF (ge (match_operand:SFDF 2 "gpc_reg_operand" "")
4695 "TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>
4696 && ((TARGET_PPC_GFXOPT
4697 && !HONOR_NANS (<MODE>mode)
4698 && !HONOR_SIGNED_ZEROS (<MODE>mode))
4700 || VECTOR_UNIT_VSX_P (<MODE>mode))"
4702 if (TARGET_CMPB || VECTOR_UNIT_VSX_P (<MODE>mode))
4704 emit_insn (gen_copysign<mode>3_fcpsgn (operands[0], operands[1],
4709 operands[3] = gen_reg_rtx (<MODE>mode);
4710 operands[4] = gen_reg_rtx (<MODE>mode);
4711 operands[5] = CONST0_RTX (<MODE>mode);
4714 ;; Use an unspec rather providing an if-then-else in RTL, to prevent the
4715 ;; compiler from optimizing -0.0
4716 (define_insn "copysign<mode>3_fcpsgn"
4717 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
4718 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")
4719 (match_operand:SFDF 2 "gpc_reg_operand" "<rreg2>")]
4721 "TARGET_CMPB && !VECTOR_UNIT_VSX_P (<MODE>mode)"
4723 [(set_attr "type" "fp")])
4725 ;; For MIN, MAX, and conditional move, we use DEFINE_EXPAND's that involve a
4726 ;; fsel instruction and some auxiliary computations. Then we just have a
4727 ;; single DEFINE_INSN for fsel and the define_splits to make them if made by
4729 (define_expand "smaxsf3"
4730 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4731 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
4732 (match_operand:SF 2 "gpc_reg_operand" ""))
4735 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
4736 && TARGET_SINGLE_FLOAT && !flag_trapping_math"
4737 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
4739 (define_expand "sminsf3"
4740 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4741 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
4742 (match_operand:SF 2 "gpc_reg_operand" ""))
4745 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
4746 && TARGET_SINGLE_FLOAT && !flag_trapping_math"
4747 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
4750 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4751 (match_operator:SF 3 "min_max_operator"
4752 [(match_operand:SF 1 "gpc_reg_operand" "")
4753 (match_operand:SF 2 "gpc_reg_operand" "")]))]
4754 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
4755 && TARGET_SINGLE_FLOAT && !flag_trapping_math"
4758 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
4759 operands[1], operands[2]);
4763 (define_expand "mov<mode>cc"
4764 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
4765 (if_then_else:GPR (match_operand 1 "comparison_operator" "")
4766 (match_operand:GPR 2 "gpc_reg_operand" "")
4767 (match_operand:GPR 3 "gpc_reg_operand" "")))]
4771 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
4777 ;; We use the BASE_REGS for the isel input operands because, if rA is
4778 ;; 0, the value of 0 is placed in rD upon truth. Similarly for rB
4779 ;; because we may switch the operands and rB may end up being rA.
4781 ;; We need 2 patterns: an unsigned and a signed pattern. We could
4782 ;; leave out the mode in operand 4 and use one pattern, but reload can
4783 ;; change the mode underneath our feet and then gets confused trying
4784 ;; to reload the value.
4785 (define_insn "isel_signed_<mode>"
4786 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
4788 (match_operator 1 "scc_comparison_operator"
4789 [(match_operand:CC 4 "cc_reg_operand" "y,y")
4791 (match_operand:GPR 2 "reg_or_cint_operand" "O,b")
4792 (match_operand:GPR 3 "gpc_reg_operand" "r,r")))]
4795 { return output_isel (operands); }"
4796 [(set_attr "type" "isel")
4797 (set_attr "length" "4")])
4799 (define_insn "isel_unsigned_<mode>"
4800 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
4802 (match_operator 1 "scc_comparison_operator"
4803 [(match_operand:CCUNS 4 "cc_reg_operand" "y,y")
4805 (match_operand:GPR 2 "reg_or_cint_operand" "O,b")
4806 (match_operand:GPR 3 "gpc_reg_operand" "r,r")))]
4809 { return output_isel (operands); }"
4810 [(set_attr "type" "isel")
4811 (set_attr "length" "4")])
4813 ;; These patterns can be useful for combine; they let combine know that
4814 ;; isel can handle reversed comparisons so long as the operands are
4817 (define_insn "*isel_reversed_signed_<mode>"
4818 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
4820 (match_operator 1 "scc_rev_comparison_operator"
4821 [(match_operand:CC 4 "cc_reg_operand" "y")
4823 (match_operand:GPR 2 "gpc_reg_operand" "b")
4824 (match_operand:GPR 3 "gpc_reg_operand" "b")))]
4827 { return output_isel (operands); }"
4828 [(set_attr "type" "isel")
4829 (set_attr "length" "4")])
4831 (define_insn "*isel_reversed_unsigned_<mode>"
4832 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
4834 (match_operator 1 "scc_rev_comparison_operator"
4835 [(match_operand:CCUNS 4 "cc_reg_operand" "y")
4837 (match_operand:GPR 2 "gpc_reg_operand" "b")
4838 (match_operand:GPR 3 "gpc_reg_operand" "b")))]
4841 { return output_isel (operands); }"
4842 [(set_attr "type" "isel")
4843 (set_attr "length" "4")])
4845 (define_expand "movsfcc"
4846 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4847 (if_then_else:SF (match_operand 1 "comparison_operator" "")
4848 (match_operand:SF 2 "gpc_reg_operand" "")
4849 (match_operand:SF 3 "gpc_reg_operand" "")))]
4850 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
4853 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
4859 (define_insn "*fselsfsf4"
4860 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4861 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
4862 (match_operand:SF 4 "zero_fp_constant" "F"))
4863 (match_operand:SF 2 "gpc_reg_operand" "f")
4864 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4865 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
4867 [(set_attr "type" "fp")])
4869 (define_insn "*fseldfsf4"
4870 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4871 (if_then_else:SF (ge (match_operand:DF 1 "gpc_reg_operand" "d")
4872 (match_operand:DF 4 "zero_fp_constant" "F"))
4873 (match_operand:SF 2 "gpc_reg_operand" "f")
4874 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4875 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_SINGLE_FLOAT"
4877 [(set_attr "type" "fp")])
4879 (define_expand "negdf2"
4880 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4881 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
4882 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
4885 (define_insn "*negdf2_fpr"
4886 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
4887 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "d")))]
4888 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
4889 && !VECTOR_UNIT_VSX_P (DFmode)"
4891 [(set_attr "type" "fp")])
4893 (define_expand "absdf2"
4894 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4895 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
4896 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
4899 (define_insn "*absdf2_fpr"
4900 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
4901 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "d")))]
4902 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
4903 && !VECTOR_UNIT_VSX_P (DFmode)"
4905 [(set_attr "type" "fp")])
4907 (define_insn "*nabsdf2_fpr"
4908 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
4909 (neg:DF (abs:DF (match_operand:DF 1 "gpc_reg_operand" "d"))))]
4910 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
4911 && !VECTOR_UNIT_VSX_P (DFmode)"
4913 [(set_attr "type" "fp")])
4915 (define_expand "adddf3"
4916 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4917 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "")
4918 (match_operand:DF 2 "gpc_reg_operand" "")))]
4919 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
4922 (define_insn "*adddf3_fpr"
4923 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
4924 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
4925 (match_operand:DF 2 "gpc_reg_operand" "d")))]
4926 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
4927 && !VECTOR_UNIT_VSX_P (DFmode)"
4929 [(set_attr "type" "fp")
4930 (set_attr "fp_type" "fp_addsub_d")])
4932 (define_expand "subdf3"
4933 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4934 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "")
4935 (match_operand:DF 2 "gpc_reg_operand" "")))]
4936 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
4939 (define_insn "*subdf3_fpr"
4940 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
4941 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "d")
4942 (match_operand:DF 2 "gpc_reg_operand" "d")))]
4943 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
4944 && !VECTOR_UNIT_VSX_P (DFmode)"
4946 [(set_attr "type" "fp")
4947 (set_attr "fp_type" "fp_addsub_d")])
4949 (define_expand "muldf3"
4950 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4951 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "")
4952 (match_operand:DF 2 "gpc_reg_operand" "")))]
4953 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
4956 (define_insn "*muldf3_fpr"
4957 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
4958 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
4959 (match_operand:DF 2 "gpc_reg_operand" "d")))]
4960 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
4961 && !VECTOR_UNIT_VSX_P (DFmode)"
4963 [(set_attr "type" "dmul")
4964 (set_attr "fp_type" "fp_mul_d")])
4966 (define_expand "divdf3"
4967 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4968 (div:DF (match_operand:DF 1 "gpc_reg_operand" "")
4969 (match_operand:DF 2 "gpc_reg_operand" "")))]
4971 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)
4972 && !TARGET_SIMPLE_FPU"
4975 (define_insn "*divdf3_fpr"
4976 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
4977 (div:DF (match_operand:DF 1 "gpc_reg_operand" "d")
4978 (match_operand:DF 2 "gpc_reg_operand" "d")))]
4979 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && !TARGET_SIMPLE_FPU
4980 && !VECTOR_UNIT_VSX_P (DFmode)"
4982 [(set_attr "type" "ddiv")])
4984 (define_insn "*fred_fpr"
4985 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4986 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))]
4987 "TARGET_FRE && !VECTOR_UNIT_VSX_P (DFmode)"
4989 [(set_attr "type" "fp")])
4991 (define_insn "*rsqrtdf_internal1"
4992 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
4993 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "d")]
4995 "TARGET_FRSQRTE && !VECTOR_UNIT_VSX_P (DFmode)"
4997 [(set_attr "type" "fp")])
4999 ; builtin fma support
5000 (define_insn "*fmadf4_fpr"
5001 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5002 (fma:DF (match_operand:DF 1 "gpc_reg_operand" "f")
5003 (match_operand:DF 2 "gpc_reg_operand" "f")
5004 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5005 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5006 && VECTOR_UNIT_NONE_P (DFmode)"
5008 [(set_attr "type" "fp")
5009 (set_attr "fp_type" "fp_maddsub_d")])
5011 (define_insn "*fmsdf4_fpr"
5012 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5013 (fma:DF (match_operand:DF 1 "gpc_reg_operand" "f")
5014 (match_operand:DF 2 "gpc_reg_operand" "f")
5015 (neg:DF (match_operand:DF 3 "gpc_reg_operand" "f"))))]
5016 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5017 && VECTOR_UNIT_NONE_P (DFmode)"
5019 [(set_attr "type" "fp")
5020 (set_attr "fp_type" "fp_maddsub_d")])
5022 (define_insn "*nfmadf4_fpr"
5023 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5024 (neg:DF (fma:DF (match_operand:DF 1 "gpc_reg_operand" "f")
5025 (match_operand:DF 2 "gpc_reg_operand" "f")
5026 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
5027 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5028 && VECTOR_UNIT_NONE_P (DFmode)"
5029 "fnmadd %0,%1,%2,%3"
5030 [(set_attr "type" "fp")
5031 (set_attr "fp_type" "fp_maddsub_d")])
5033 (define_insn "*nfmsdf4_fpr"
5034 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5035 (neg:DF (fma:DF (match_operand:DF 1 "gpc_reg_operand" "f")
5036 (match_operand:DF 2 "gpc_reg_operand" "f")
5037 (neg:DF (match_operand:DF 3 "gpc_reg_operand" "f")))))]
5038 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5039 && VECTOR_UNIT_NONE_P (DFmode)"
5040 "fnmsub %0,%1,%2,%3"
5041 [(set_attr "type" "fp")
5042 (set_attr "fp_type" "fp_maddsub_d")])
5044 (define_expand "sqrtdf2"
5045 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5046 (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
5047 "TARGET_PPC_GPOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5050 (define_insn "*sqrtdf2_fpr"
5051 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
5052 (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "d")))]
5053 "TARGET_PPC_GPOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5054 && !VECTOR_UNIT_VSX_P (DFmode)"
5056 [(set_attr "type" "dsqrt")])
5058 ;; The conditional move instructions allow us to perform max and min
5059 ;; operations even when
5061 (define_expand "smaxdf3"
5062 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5063 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
5064 (match_operand:DF 2 "gpc_reg_operand" ""))
5067 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5068 && !flag_trapping_math"
5069 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
5071 (define_expand "smindf3"
5072 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5073 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
5074 (match_operand:DF 2 "gpc_reg_operand" ""))
5077 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5078 && !flag_trapping_math"
5079 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
5082 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5083 (match_operator:DF 3 "min_max_operator"
5084 [(match_operand:DF 1 "gpc_reg_operand" "")
5085 (match_operand:DF 2 "gpc_reg_operand" "")]))]
5086 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5087 && !flag_trapping_math"
5090 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
5091 operands[1], operands[2]);
5095 (define_expand "movdfcc"
5096 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5097 (if_then_else:DF (match_operand 1 "comparison_operator" "")
5098 (match_operand:DF 2 "gpc_reg_operand" "")
5099 (match_operand:DF 3 "gpc_reg_operand" "")))]
5100 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5103 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5109 (define_insn "*fseldfdf4"
5110 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
5111 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "d")
5112 (match_operand:DF 4 "zero_fp_constant" "F"))
5113 (match_operand:DF 2 "gpc_reg_operand" "d")
5114 (match_operand:DF 3 "gpc_reg_operand" "d")))]
5115 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5117 [(set_attr "type" "fp")])
5119 (define_insn "*fselsfdf4"
5120 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
5121 (if_then_else:DF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
5122 (match_operand:SF 4 "zero_fp_constant" "F"))
5123 (match_operand:DF 2 "gpc_reg_operand" "d")
5124 (match_operand:DF 3 "gpc_reg_operand" "d")))]
5125 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_SINGLE_FLOAT"
5127 [(set_attr "type" "fp")])
5129 ;; Conversions to and from floating-point.
5131 ; We don't define lfiwax/lfiwzx with the normal definition, because we
5132 ; don't want to support putting SImode in FPR registers.
5133 (define_insn "lfiwax"
5134 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
5135 (unspec:DI [(match_operand:SI 1 "indexed_or_indirect_operand" "Z")]
5137 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWAX"
5139 [(set_attr "type" "fpload")])
5141 ; This split must be run before register allocation because it allocates the
5142 ; memory slot that is needed to move values to/from the FPR. We don't allocate
5143 ; it earlier to allow for the combiner to merge insns together where it might
5144 ; not be needed and also in case the insns are deleted as dead code.
5146 (define_insn_and_split "floatsi<mode>2_lfiwax"
5147 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d")
5148 (float:SFDF (match_operand:SI 1 "nonimmediate_operand" "r")))
5149 (clobber (match_scratch:DI 2 "=d"))]
5150 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWAX
5151 && <SI_CONVERT_FP> && can_create_pseudo_p ()"
5157 rtx dest = operands[0];
5158 rtx src = operands[1];
5161 if (!MEM_P (src) && TARGET_MFPGPR && TARGET_POWERPC64)
5162 tmp = convert_to_mode (DImode, src, false);
5166 if (GET_CODE (tmp) == SCRATCH)
5167 tmp = gen_reg_rtx (DImode);
5170 src = rs6000_address_for_fpconvert (src);
5171 emit_insn (gen_lfiwax (tmp, src));
5175 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
5176 emit_move_insn (stack, src);
5177 emit_insn (gen_lfiwax (tmp, stack));
5180 emit_insn (gen_floatdi<mode>2 (dest, tmp));
5183 [(set_attr "length" "12")
5184 (set_attr "type" "fpload")])
5186 (define_insn_and_split "floatsi<mode>2_lfiwax_mem"
5187 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d,<rreg2>")
5190 (match_operand:SI 1 "memory_operand" "Z,Z"))))
5191 (clobber (match_scratch:DI 2 "=0,d"))]
5192 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWAX
5199 operands[1] = rs6000_address_for_fpconvert (operands[1]);
5200 if (GET_CODE (operands[2]) == SCRATCH)
5201 operands[2] = gen_reg_rtx (DImode);
5202 emit_insn (gen_lfiwax (operands[2], operands[1]));
5203 emit_insn (gen_floatdi<mode>2 (operands[0], operands[2]));
5206 [(set_attr "length" "8")
5207 (set_attr "type" "fpload")])
5209 (define_insn "lfiwzx"
5210 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
5211 (unspec:DI [(match_operand:SI 1 "indexed_or_indirect_operand" "Z")]
5213 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWZX"
5215 [(set_attr "type" "fpload")])
5217 (define_insn_and_split "floatunssi<mode>2_lfiwzx"
5218 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d")
5219 (unsigned_float:SFDF (match_operand:SI 1 "nonimmediate_operand" "r")))
5220 (clobber (match_scratch:DI 2 "=d"))]
5221 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWZX
5228 rtx dest = operands[0];
5229 rtx src = operands[1];
5232 if (!MEM_P (src) && TARGET_MFPGPR && TARGET_POWERPC64)
5233 tmp = convert_to_mode (DImode, src, true);
5237 if (GET_CODE (tmp) == SCRATCH)
5238 tmp = gen_reg_rtx (DImode);
5241 src = rs6000_address_for_fpconvert (src);
5242 emit_insn (gen_lfiwzx (tmp, src));
5246 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
5247 emit_move_insn (stack, src);
5248 emit_insn (gen_lfiwzx (tmp, stack));
5251 emit_insn (gen_floatdi<mode>2 (dest, tmp));
5254 [(set_attr "length" "12")
5255 (set_attr "type" "fpload")])
5257 (define_insn_and_split "floatunssi<mode>2_lfiwzx_mem"
5258 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d,<rreg2>")
5259 (unsigned_float:SFDF
5261 (match_operand:SI 1 "memory_operand" "Z,Z"))))
5262 (clobber (match_scratch:DI 2 "=0,d"))]
5263 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWZX
5270 operands[1] = rs6000_address_for_fpconvert (operands[1]);
5271 if (GET_CODE (operands[2]) == SCRATCH)
5272 operands[2] = gen_reg_rtx (DImode);
5273 emit_insn (gen_lfiwzx (operands[2], operands[1]));
5274 emit_insn (gen_floatdi<mode>2 (operands[0], operands[2]));
5277 [(set_attr "length" "8")
5278 (set_attr "type" "fpload")])
5280 ; For each of these conversions, there is a define_expand, a define_insn
5281 ; with a '#' template, and a define_split (with C code). The idea is
5282 ; to allow constant folding with the template of the define_insn,
5283 ; then to have the insns split later (between sched1 and final).
5285 (define_expand "floatsidf2"
5286 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5287 (float:DF (match_operand:SI 1 "nonimmediate_operand" "")))
5290 (clobber (match_dup 4))
5291 (clobber (match_dup 5))
5292 (clobber (match_dup 6))])]
5294 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5297 if (TARGET_E500_DOUBLE)
5299 if (!REG_P (operands[1]))
5300 operands[1] = force_reg (SImode, operands[1]);
5301 emit_insn (gen_spe_floatsidf2 (operands[0], operands[1]));
5304 else if (TARGET_LFIWAX && TARGET_FCFID)
5306 emit_insn (gen_floatsidf2_lfiwax (operands[0], operands[1]));
5309 else if (TARGET_FCFID)
5311 rtx dreg = operands[1];
5313 dreg = force_reg (SImode, dreg);
5314 dreg = convert_to_mode (DImode, dreg, false);
5315 emit_insn (gen_floatdidf2 (operands[0], dreg));
5319 if (!REG_P (operands[1]))
5320 operands[1] = force_reg (SImode, operands[1]);
5321 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5322 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503601774854144\", DFmode));
5323 operands[4] = rs6000_allocate_stack_temp (DFmode, true, false);
5324 operands[5] = gen_reg_rtx (DFmode);
5325 operands[6] = gen_reg_rtx (SImode);
5328 (define_insn_and_split "*floatsidf2_internal"
5329 [(set (match_operand:DF 0 "gpc_reg_operand" "=&d")
5330 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5331 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5332 (use (match_operand:DF 3 "gpc_reg_operand" "d"))
5333 (clobber (match_operand:DF 4 "offsettable_mem_operand" "=o"))
5334 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&d"))
5335 (clobber (match_operand:SI 6 "gpc_reg_operand" "=&r"))]
5336 "! TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5342 rtx lowword, highword;
5343 gcc_assert (MEM_P (operands[4]));
5344 highword = adjust_address (operands[4], SImode, 0);
5345 lowword = adjust_address (operands[4], SImode, 4);
5346 if (! WORDS_BIG_ENDIAN)
5349 tmp = highword; highword = lowword; lowword = tmp;
5352 emit_insn (gen_xorsi3 (operands[6], operands[1],
5353 GEN_INT (~ (HOST_WIDE_INT) 0x7fffffff)));
5354 emit_move_insn (lowword, operands[6]);
5355 emit_move_insn (highword, operands[2]);
5356 emit_move_insn (operands[5], operands[4]);
5357 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5360 [(set_attr "length" "24")
5361 (set_attr "type" "fp")])
5363 ;; If we don't have a direct conversion to single precision, don't enable this
5364 ;; conversion for 32-bit without fast math, because we don't have the insn to
5365 ;; generate the fixup swizzle to avoid double rounding problems.
5366 (define_expand "floatunssisf2"
5367 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5368 (unsigned_float:SF (match_operand:SI 1 "nonimmediate_operand" "")))]
5369 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT
5372 && ((TARGET_FCFIDUS && TARGET_LFIWZX)
5373 || (TARGET_DOUBLE_FLOAT && TARGET_FCFID
5374 && (TARGET_POWERPC64 || flag_unsafe_math_optimizations)))))"
5379 if (!REG_P (operands[1]))
5380 operands[1] = force_reg (SImode, operands[1]);
5382 else if (TARGET_LFIWZX && TARGET_FCFIDUS)
5384 emit_insn (gen_floatunssisf2_lfiwzx (operands[0], operands[1]));
5389 rtx dreg = operands[1];
5391 dreg = force_reg (SImode, dreg);
5392 dreg = convert_to_mode (DImode, dreg, true);
5393 emit_insn (gen_floatdisf2 (operands[0], dreg));
5398 (define_expand "floatunssidf2"
5399 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5400 (unsigned_float:DF (match_operand:SI 1 "nonimmediate_operand" "")))
5403 (clobber (match_dup 4))
5404 (clobber (match_dup 5))])]
5406 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5409 if (TARGET_E500_DOUBLE)
5411 if (!REG_P (operands[1]))
5412 operands[1] = force_reg (SImode, operands[1]);
5413 emit_insn (gen_spe_floatunssidf2 (operands[0], operands[1]));
5416 else if (TARGET_LFIWZX && TARGET_FCFID)
5418 emit_insn (gen_floatunssidf2_lfiwzx (operands[0], operands[1]));
5421 else if (TARGET_FCFID)
5423 rtx dreg = operands[1];
5425 dreg = force_reg (SImode, dreg);
5426 dreg = convert_to_mode (DImode, dreg, true);
5427 emit_insn (gen_floatdidf2 (operands[0], dreg));
5431 if (!REG_P (operands[1]))
5432 operands[1] = force_reg (SImode, operands[1]);
5433 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5434 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503599627370496\", DFmode));
5435 operands[4] = rs6000_allocate_stack_temp (DFmode, true, false);
5436 operands[5] = gen_reg_rtx (DFmode);
5439 (define_insn_and_split "*floatunssidf2_internal"
5440 [(set (match_operand:DF 0 "gpc_reg_operand" "=&d")
5441 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5442 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5443 (use (match_operand:DF 3 "gpc_reg_operand" "d"))
5444 (clobber (match_operand:DF 4 "offsettable_mem_operand" "=o"))
5445 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&d"))]
5446 "! TARGET_FCFIDU && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5447 && !(TARGET_FCFID && TARGET_POWERPC64)"
5453 rtx lowword, highword;
5454 gcc_assert (MEM_P (operands[4]));
5455 highword = adjust_address (operands[4], SImode, 0);
5456 lowword = adjust_address (operands[4], SImode, 4);
5457 if (! WORDS_BIG_ENDIAN)
5460 tmp = highword; highword = lowword; lowword = tmp;
5463 emit_move_insn (lowword, operands[1]);
5464 emit_move_insn (highword, operands[2]);
5465 emit_move_insn (operands[5], operands[4]);
5466 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5469 [(set_attr "length" "20")
5470 (set_attr "type" "fp")])
5472 (define_expand "fix_trunc<mode>si2"
5473 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5474 (fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "")))]
5475 "TARGET_HARD_FLOAT && ((TARGET_FPRS && <TARGET_FLOAT>) || <E500_CONVERT>)"
5478 if (!<E500_CONVERT>)
5483 emit_insn (gen_fix_trunc<mode>si2_stfiwx (operands[0], operands[1]));
5486 tmp = gen_reg_rtx (DImode);
5487 stack = rs6000_allocate_stack_temp (DImode, true, false);
5488 emit_insn (gen_fix_trunc<mode>si2_internal (operands[0], operands[1],
5495 ; Like the convert to float patterns, this insn must be split before
5496 ; register allocation so that it can allocate the memory slot if it
5498 (define_insn_and_split "fix_trunc<mode>si2_stfiwx"
5499 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
5500 (fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d")))
5501 (clobber (match_scratch:DI 2 "=d"))]
5502 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5503 && (<MODE>mode != SFmode || TARGET_SINGLE_FLOAT)
5504 && TARGET_STFIWX && can_create_pseudo_p ()"
5509 rtx dest = operands[0];
5510 rtx src = operands[1];
5511 rtx tmp = operands[2];
5513 if (GET_CODE (tmp) == SCRATCH)
5514 tmp = gen_reg_rtx (DImode);
5516 emit_insn (gen_fctiwz_<mode> (tmp, src));
5519 dest = rs6000_address_for_fpconvert (dest);
5520 emit_insn (gen_stfiwx (dest, tmp));
5523 else if (TARGET_MFPGPR && TARGET_POWERPC64)
5525 dest = gen_lowpart (DImode, dest);
5526 emit_move_insn (dest, tmp);
5531 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
5532 emit_insn (gen_stfiwx (stack, tmp));
5533 emit_move_insn (dest, stack);
5537 [(set_attr "length" "12")
5538 (set_attr "type" "fp")])
5540 (define_insn_and_split "fix_trunc<mode>si2_internal"
5541 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,?r")
5542 (fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d,<rreg>")))
5543 (clobber (match_operand:DI 2 "gpc_reg_operand" "=1,d"))
5544 (clobber (match_operand:DI 3 "offsettable_mem_operand" "=o,o"))]
5545 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5552 gcc_assert (MEM_P (operands[3]));
5553 lowword = adjust_address (operands[3], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
5555 emit_insn (gen_fctiwz_<mode> (operands[2], operands[1]));
5556 emit_move_insn (operands[3], operands[2]);
5557 emit_move_insn (operands[0], lowword);
5560 [(set_attr "length" "16")
5561 (set_attr "type" "fp")])
5563 (define_expand "fix_trunc<mode>di2"
5564 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5565 (fix:DI (match_operand:SFDF 1 "gpc_reg_operand" "")))]
5566 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
5570 (define_insn "*fix_trunc<mode>di2_fctidz"
5571 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
5572 (fix:DI (match_operand:SFDF 1 "gpc_reg_operand" "d")))]
5573 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
5574 && TARGET_FCFID && !VECTOR_UNIT_VSX_P (<MODE>mode)"
5576 [(set_attr "type" "fp")])
5578 (define_expand "fixuns_trunc<mode>si2"
5579 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5580 (unsigned_fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "")))]
5582 && ((TARGET_FPRS && <TARGET_FLOAT> && TARGET_FCTIWUZ && TARGET_STFIWX)
5586 if (!<E500_CONVERT>)
5588 emit_insn (gen_fixuns_trunc<mode>si2_stfiwx (operands[0], operands[1]));
5593 (define_insn_and_split "fixuns_trunc<mode>si2_stfiwx"
5594 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
5595 (unsigned_fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d")))
5596 (clobber (match_scratch:DI 2 "=d"))]
5597 "TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT> && TARGET_FCTIWUZ
5598 && TARGET_STFIWX && can_create_pseudo_p ()"
5603 rtx dest = operands[0];
5604 rtx src = operands[1];
5605 rtx tmp = operands[2];
5607 if (GET_CODE (tmp) == SCRATCH)
5608 tmp = gen_reg_rtx (DImode);
5610 emit_insn (gen_fctiwuz_<mode> (tmp, src));
5613 dest = rs6000_address_for_fpconvert (dest);
5614 emit_insn (gen_stfiwx (dest, tmp));
5617 else if (TARGET_MFPGPR && TARGET_POWERPC64)
5619 dest = gen_lowpart (DImode, dest);
5620 emit_move_insn (dest, tmp);
5625 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
5626 emit_insn (gen_stfiwx (stack, tmp));
5627 emit_move_insn (dest, stack);
5631 [(set_attr "length" "12")
5632 (set_attr "type" "fp")])
5634 (define_expand "fixuns_trunc<mode>di2"
5635 [(set (match_operand:DI 0 "register_operand" "")
5636 (unsigned_fix:DI (match_operand:SFDF 1 "register_operand" "")))]
5637 "TARGET_HARD_FLOAT && (TARGET_FCTIDUZ || VECTOR_UNIT_VSX_P (<MODE>mode))"
5640 (define_insn "*fixuns_trunc<mode>di2_fctiduz"
5641 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
5642 (unsigned_fix:DI (match_operand:SFDF 1 "gpc_reg_operand" "d")))]
5643 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
5644 && TARGET_FCTIDUZ && !VECTOR_UNIT_VSX_P (<MODE>mode)"
5646 [(set_attr "type" "fp")])
5648 ; Here, we use (set (reg) (unspec:DI [(fix:SI ...)] UNSPEC_FCTIWZ))
5649 ; rather than (set (subreg:SI (reg)) (fix:SI ...))
5650 ; because the first makes it clear that operand 0 is not live
5651 ; before the instruction.
5652 (define_insn "fctiwz_<mode>"
5653 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
5654 (unspec:DI [(fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d"))]
5656 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5658 [(set_attr "type" "fp")])
5660 (define_insn "fctiwuz_<mode>"
5661 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
5662 (unspec:DI [(unsigned_fix:SI
5663 (match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>"))]
5665 "TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT> && TARGET_FCTIWUZ"
5667 [(set_attr "type" "fp")])
5669 ;; Only optimize (float (fix x)) -> frz if we are in fast-math mode, since
5670 ;; since the friz instruction does not truncate the value if the floating
5671 ;; point value is < LONG_MIN or > LONG_MAX.
5672 (define_insn "*friz"
5673 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
5674 (float:DF (fix:DI (match_operand:DF 1 "gpc_reg_operand" "d"))))]
5675 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_FPRND
5676 && !VECTOR_UNIT_VSX_P (DFmode) && flag_unsafe_math_optimizations
5677 && !flag_trapping_math && TARGET_FRIZ"
5679 [(set_attr "type" "fp")])
5681 ;; Since FCTIWZ doesn't sign extend the upper bits, we have to do a store and a
5682 ;; load to properly sign extend the value, but at least doing a store, load
5683 ;; into a GPR to sign extend, a store from the GPR and a load back into the FPR
5684 ;; if we have 32-bit memory ops
5685 (define_insn_and_split "*round32<mode>2_fprs"
5686 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d")
5688 (fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d"))))
5689 (clobber (match_scratch:DI 2 "=d"))
5690 (clobber (match_scratch:DI 3 "=d"))]
5691 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5692 && <SI_CONVERT_FP> && TARGET_LFIWAX && TARGET_STFIWX && TARGET_FCFID
5693 && can_create_pseudo_p ()"
5698 rtx dest = operands[0];
5699 rtx src = operands[1];
5700 rtx tmp1 = operands[2];
5701 rtx tmp2 = operands[3];
5702 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
5704 if (GET_CODE (tmp1) == SCRATCH)
5705 tmp1 = gen_reg_rtx (DImode);
5706 if (GET_CODE (tmp2) == SCRATCH)
5707 tmp2 = gen_reg_rtx (DImode);
5709 emit_insn (gen_fctiwz_<mode> (tmp1, src));
5710 emit_insn (gen_stfiwx (stack, tmp1));
5711 emit_insn (gen_lfiwax (tmp2, stack));
5712 emit_insn (gen_floatdi<mode>2 (dest, tmp2));
5715 [(set_attr "type" "fpload")
5716 (set_attr "length" "16")])
5718 (define_insn_and_split "*roundu32<mode>2_fprs"
5719 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d")
5720 (unsigned_float:SFDF
5721 (unsigned_fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d"))))
5722 (clobber (match_scratch:DI 2 "=d"))
5723 (clobber (match_scratch:DI 3 "=d"))]
5724 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5725 && TARGET_LFIWZX && TARGET_STFIWX && TARGET_FCFIDU
5726 && can_create_pseudo_p ()"
5731 rtx dest = operands[0];
5732 rtx src = operands[1];
5733 rtx tmp1 = operands[2];
5734 rtx tmp2 = operands[3];
5735 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
5737 if (GET_CODE (tmp1) == SCRATCH)
5738 tmp1 = gen_reg_rtx (DImode);
5739 if (GET_CODE (tmp2) == SCRATCH)
5740 tmp2 = gen_reg_rtx (DImode);
5742 emit_insn (gen_fctiwuz_<mode> (tmp1, src));
5743 emit_insn (gen_stfiwx (stack, tmp1));
5744 emit_insn (gen_lfiwzx (tmp2, stack));
5745 emit_insn (gen_floatdi<mode>2 (dest, tmp2));
5748 [(set_attr "type" "fpload")
5749 (set_attr "length" "16")])
5751 ;; No VSX equivalent to fctid
5752 (define_insn "lrint<mode>di2"
5753 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
5754 (unspec:DI [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
5756 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
5758 [(set_attr "type" "fp")])
5760 (define_expand "btrunc<mode>2"
5761 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
5762 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "")]
5764 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
5767 (define_insn "*btrunc<mode>2_fpr"
5768 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
5769 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
5771 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>
5772 && !VECTOR_UNIT_VSX_P (<MODE>mode)"
5774 [(set_attr "type" "fp")])
5776 (define_expand "ceil<mode>2"
5777 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
5778 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "")]
5780 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
5783 (define_insn "*ceil<mode>2_fpr"
5784 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
5785 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
5787 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>
5788 && !VECTOR_UNIT_VSX_P (<MODE>mode)"
5790 [(set_attr "type" "fp")])
5792 (define_expand "floor<mode>2"
5793 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
5794 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "")]
5796 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
5799 (define_insn "*floor<mode>2_fpr"
5800 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
5801 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
5803 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>
5804 && !VECTOR_UNIT_VSX_P (<MODE>mode)"
5806 [(set_attr "type" "fp")])
5808 ;; No VSX equivalent to frin
5809 (define_insn "round<mode>2"
5810 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
5811 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
5813 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
5815 [(set_attr "type" "fp")])
5817 ; An UNSPEC is used so we don't have to support SImode in FP registers.
5818 (define_insn "stfiwx"
5819 [(set (match_operand:SI 0 "memory_operand" "=Z")
5820 (unspec:SI [(match_operand:DI 1 "gpc_reg_operand" "d")]
5824 [(set_attr "type" "fpstore")])
5826 ;; If we don't have a direct conversion to single precision, don't enable this
5827 ;; conversion for 32-bit without fast math, because we don't have the insn to
5828 ;; generate the fixup swizzle to avoid double rounding problems.
5829 (define_expand "floatsisf2"
5830 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5831 (float:SF (match_operand:SI 1 "nonimmediate_operand" "")))]
5832 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT
5835 && ((TARGET_FCFIDS && TARGET_LFIWAX)
5836 || (TARGET_DOUBLE_FLOAT && TARGET_FCFID
5837 && (TARGET_POWERPC64 || flag_unsafe_math_optimizations)))))"
5842 if (!REG_P (operands[1]))
5843 operands[1] = force_reg (SImode, operands[1]);
5845 else if (TARGET_FCFIDS && TARGET_LFIWAX)
5847 emit_insn (gen_floatsisf2_lfiwax (operands[0], operands[1]));
5850 else if (TARGET_FCFID && TARGET_LFIWAX)
5852 rtx dfreg = gen_reg_rtx (DFmode);
5853 emit_insn (gen_floatsidf2_lfiwax (dfreg, operands[1]));
5854 emit_insn (gen_truncdfsf2 (operands[0], dfreg));
5859 rtx dreg = operands[1];
5861 dreg = force_reg (SImode, dreg);
5862 dreg = convert_to_mode (DImode, dreg, false);
5863 emit_insn (gen_floatdisf2 (operands[0], dreg));
5868 (define_expand "floatdidf2"
5869 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5870 (float:DF (match_operand:DI 1 "gpc_reg_operand" "")))]
5871 "TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS"
5874 (define_insn "*floatdidf2_fpr"
5875 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
5876 (float:DF (match_operand:DI 1 "gpc_reg_operand" "d")))]
5877 "TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
5878 && !VECTOR_UNIT_VSX_P (DFmode)"
5880 [(set_attr "type" "fp")])
5882 ; Allow the combiner to merge source memory operands to the conversion so that
5883 ; the optimizer/register allocator doesn't try to load the value too early in a
5884 ; GPR and then use store/load to move it to a FPR and suffer from a store-load
5885 ; hit. We will split after reload to avoid the trip through the GPRs
5887 (define_insn_and_split "*floatdidf2_mem"
5888 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
5889 (float:DF (match_operand:DI 1 "memory_operand" "m")))
5890 (clobber (match_scratch:DI 2 "=d"))]
5891 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS && TARGET_FCFID"
5893 "&& reload_completed"
5894 [(set (match_dup 2) (match_dup 1))
5895 (set (match_dup 0) (float:DF (match_dup 2)))]
5897 [(set_attr "length" "8")
5898 (set_attr "type" "fpload")])
5900 (define_expand "floatunsdidf2"
5901 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5903 (match_operand:DI 1 "gpc_reg_operand" "")))]
5904 "TARGET_HARD_FLOAT && (TARGET_FCFIDU || VECTOR_UNIT_VSX_P (DFmode))"
5907 (define_insn "*floatunsdidf2_fcfidu"
5908 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
5909 (unsigned_float:DF (match_operand:DI 1 "gpc_reg_operand" "d")))]
5910 "TARGET_HARD_FLOAT && TARGET_FCFIDU && !VECTOR_UNIT_VSX_P (DFmode)"
5912 [(set_attr "type" "fp")
5913 (set_attr "length" "4")])
5915 (define_insn_and_split "*floatunsdidf2_mem"
5916 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
5917 (unsigned_float:DF (match_operand:DI 1 "memory_operand" "m")))
5918 (clobber (match_scratch:DI 2 "=d"))]
5919 "TARGET_HARD_FLOAT && (TARGET_FCFIDU || VECTOR_UNIT_VSX_P (DFmode))"
5921 "&& reload_completed"
5922 [(set (match_dup 2) (match_dup 1))
5923 (set (match_dup 0) (unsigned_float:DF (match_dup 2)))]
5925 [(set_attr "length" "8")
5926 (set_attr "type" "fpload")])
5928 (define_expand "floatdisf2"
5929 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5930 (float:SF (match_operand:DI 1 "gpc_reg_operand" "")))]
5931 "TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
5932 && (TARGET_FCFIDS || TARGET_POWERPC64 || flag_unsafe_math_optimizations)"
5937 rtx val = operands[1];
5938 if (!flag_unsafe_math_optimizations)
5940 rtx label = gen_label_rtx ();
5941 val = gen_reg_rtx (DImode);
5942 emit_insn (gen_floatdisf2_internal2 (val, operands[1], label));
5945 emit_insn (gen_floatdisf2_internal1 (operands[0], val));
5950 (define_insn "floatdisf2_fcfids"
5951 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5952 (float:SF (match_operand:DI 1 "gpc_reg_operand" "d")))]
5953 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
5954 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDS"
5956 [(set_attr "type" "fp")])
5958 (define_insn_and_split "*floatdisf2_mem"
5959 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5960 (float:SF (match_operand:DI 1 "memory_operand" "m")))
5961 (clobber (match_scratch:DI 2 "=f"))]
5962 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
5963 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDS"
5965 "&& reload_completed"
5969 emit_move_insn (operands[2], operands[1]);
5970 emit_insn (gen_floatdisf2_fcfids (operands[0], operands[2]));
5973 [(set_attr "length" "8")])
5975 ;; This is not IEEE compliant if rounding mode is "round to nearest".
5976 ;; If the DI->DF conversion is inexact, then it's possible to suffer
5977 ;; from double rounding.
5978 ;; Instead of creating a new cpu type for two FP operations, just use fp
5979 (define_insn_and_split "floatdisf2_internal1"
5980 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5981 (float:SF (match_operand:DI 1 "gpc_reg_operand" "d")))
5982 (clobber (match_scratch:DF 2 "=d"))]
5983 "TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5985 "&& reload_completed"
5987 (float:DF (match_dup 1)))
5989 (float_truncate:SF (match_dup 2)))]
5991 [(set_attr "length" "8")
5992 (set_attr "type" "fp")])
5994 ;; Twiddles bits to avoid double rounding.
5995 ;; Bits that might be truncated when converting to DFmode are replaced
5996 ;; by a bit that won't be lost at that stage, but is below the SFmode
5997 ;; rounding position.
5998 (define_expand "floatdisf2_internal2"
5999 [(set (match_dup 3) (ashiftrt:DI (match_operand:DI 1 "" "")
6001 (parallel [(set (match_operand:DI 0 "" "") (and:DI (match_dup 1)
6003 (clobber (scratch:CC))])
6004 (set (match_dup 3) (plus:DI (match_dup 3)
6006 (set (match_dup 0) (plus:DI (match_dup 0)
6008 (set (match_dup 4) (compare:CCUNS (match_dup 3)
6010 (set (match_dup 0) (ior:DI (match_dup 0)
6012 (parallel [(set (match_dup 0) (and:DI (match_dup 0)
6014 (clobber (scratch:CC))])
6015 (set (pc) (if_then_else (geu (match_dup 4) (const_int 0))
6016 (label_ref (match_operand:DI 2 "" ""))
6018 (set (match_dup 0) (match_dup 1))]
6019 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
6022 operands[3] = gen_reg_rtx (DImode);
6023 operands[4] = gen_reg_rtx (CCUNSmode);
6026 (define_expand "floatunsdisf2"
6027 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6028 (unsigned_float:SF (match_operand:DI 1 "gpc_reg_operand" "")))]
6029 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
6030 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDUS"
6033 (define_insn "floatunsdisf2_fcfidus"
6034 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6035 (unsigned_float:SF (match_operand:DI 1 "gpc_reg_operand" "d")))]
6036 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
6037 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDUS"
6039 [(set_attr "type" "fp")])
6041 (define_insn_and_split "*floatunsdisf2_mem"
6042 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6043 (unsigned_float:SF (match_operand:DI 1 "memory_operand" "m")))
6044 (clobber (match_scratch:DI 2 "=f"))]
6045 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
6046 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDUS"
6048 "&& reload_completed"
6052 emit_move_insn (operands[2], operands[1]);
6053 emit_insn (gen_floatunsdisf2_fcfidus (operands[0], operands[2]));
6056 [(set_attr "length" "8")
6057 (set_attr "type" "fpload")])
6059 ;; Define the DImode operations that can be done in a small number
6060 ;; of instructions. The & constraints are to prevent the register
6061 ;; allocator from allocating registers that overlap with the inputs
6062 ;; (for example, having an input in 7,8 and an output in 6,7). We
6063 ;; also allow for the output being the same as one of the inputs.
6065 (define_insn "*adddi3_noppc64"
6066 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r")
6067 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,0,0")
6068 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I")))]
6069 "! TARGET_POWERPC64"
6072 if (WORDS_BIG_ENDIAN)
6073 return (GET_CODE (operands[2])) != CONST_INT
6074 ? \"addc %L0,%L1,%L2\;adde %0,%1,%2\"
6075 : \"addic %L0,%L1,%2\;add%G2e %0,%1\";
6077 return (GET_CODE (operands[2])) != CONST_INT
6078 ? \"addc %0,%1,%2\;adde %L0,%L1,%L2\"
6079 : \"addic %0,%1,%2\;add%G2e %L0,%L1\";
6081 [(set_attr "type" "two")
6082 (set_attr "length" "8")])
6084 (define_insn "*subdi3_noppc64"
6085 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r,r")
6086 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I,0,r,I")
6087 (match_operand:DI 2 "gpc_reg_operand" "r,r,r,0,0")))]
6088 "! TARGET_POWERPC64"
6091 if (WORDS_BIG_ENDIAN)
6092 return (GET_CODE (operands[1]) != CONST_INT)
6093 ? \"subfc %L0,%L2,%L1\;subfe %0,%2,%1\"
6094 : \"subfic %L0,%L2,%1\;subf%G1e %0,%2\";
6096 return (GET_CODE (operands[1]) != CONST_INT)
6097 ? \"subfc %0,%2,%1\;subfe %L0,%L2,%L1\"
6098 : \"subfic %0,%2,%1\;subf%G1e %L0,%L2\";
6100 [(set_attr "type" "two")
6101 (set_attr "length" "8")])
6103 (define_insn "*negdi2_noppc64"
6104 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6105 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))]
6106 "! TARGET_POWERPC64"
6109 return (WORDS_BIG_ENDIAN)
6110 ? \"subfic %L0,%L1,0\;subfze %0,%1\"
6111 : \"subfic %0,%1,0\;subfze %L0,%L1\";
6113 [(set_attr "type" "two")
6114 (set_attr "length" "8")])
6116 (define_insn "mulsidi3"
6117 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6118 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6119 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
6120 "! TARGET_POWERPC64"
6122 return (WORDS_BIG_ENDIAN)
6123 ? \"mulhw %0,%1,%2\;mullw %L0,%1,%2\"
6124 : \"mulhw %L0,%1,%2\;mullw %0,%1,%2\";
6126 [(set_attr "type" "imul")
6127 (set_attr "length" "8")])
6130 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6131 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6132 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6133 "! TARGET_POWERPC64 && reload_completed"
6136 (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
6137 (sign_extend:DI (match_dup 2)))
6140 (mult:SI (match_dup 1)
6144 int endian = (WORDS_BIG_ENDIAN == 0);
6145 operands[3] = operand_subword (operands[0], endian, 0, DImode);
6146 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
6149 (define_insn "umulsidi3"
6150 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6151 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6152 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
6153 "! TARGET_POWERPC64"
6156 return (WORDS_BIG_ENDIAN)
6157 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
6158 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
6160 [(set_attr "type" "imul")
6161 (set_attr "length" "8")])
6164 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6165 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6166 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6167 "! TARGET_POWERPC64 && reload_completed"
6170 (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
6171 (zero_extend:DI (match_dup 2)))
6174 (mult:SI (match_dup 1)
6178 int endian = (WORDS_BIG_ENDIAN == 0);
6179 operands[3] = operand_subword (operands[0], endian, 0, DImode);
6180 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
6183 (define_insn "smulsi3_highpart"
6184 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6186 (lshiftrt:DI (mult:DI (sign_extend:DI
6187 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6189 (match_operand:SI 2 "gpc_reg_operand" "r")))
6193 [(set_attr "type" "imul")])
6195 (define_insn "umulsi3_highpart"
6196 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6198 (lshiftrt:DI (mult:DI (zero_extend:DI
6199 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6201 (match_operand:SI 2 "gpc_reg_operand" "r")))
6205 [(set_attr "type" "imul")])
6207 ;; Shift by a variable amount is too complex to be worth open-coding. We
6208 ;; just handle shifts by constants.
6209 (define_insn "ashrdi3_no_power"
6210 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
6211 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6212 (match_operand:SI 2 "const_int_operand" "M,i")))]
6213 "TARGET_32BIT && !TARGET_POWERPC64 && WORDS_BIG_ENDIAN"
6215 srawi %0,%1,31\;srawi %L0,%1,%h2
6216 srwi %L0,%L1,%h2\;insrwi %L0,%1,%h2,0\;srawi %0,%1,%h2"
6217 [(set_attr "type" "two,three")
6218 (set_attr "length" "8,12")])
6220 (define_insn "*ashrdisi3_noppc64"
6221 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6222 (subreg:SI (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6223 (const_int 32)) 4))]
6224 "TARGET_32BIT && !TARGET_POWERPC64"
6227 if (REGNO (operands[0]) == REGNO (operands[1]))
6230 return \"mr %0,%1\";
6232 [(set_attr "length" "4")])
6235 ;; PowerPC64 DImode operations.
6237 (define_insn "muldi3"
6238 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6239 (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6240 (match_operand:DI 2 "reg_or_short_operand" "r,I")))]
6246 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
6247 (const_string "imul3")
6248 (match_operand:SI 2 "short_cint_operand" "")
6249 (const_string "imul2")]
6250 (const_string "lmul")))])
6252 (define_insn "*muldi3_internal1"
6253 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6254 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6255 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6257 (clobber (match_scratch:DI 3 "=r,r"))]
6262 [(set_attr "type" "lmul_compare")
6263 (set_attr "length" "4,8")])
6266 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6267 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
6268 (match_operand:DI 2 "gpc_reg_operand" ""))
6270 (clobber (match_scratch:DI 3 ""))]
6271 "TARGET_POWERPC64 && reload_completed"
6273 (mult:DI (match_dup 1) (match_dup 2)))
6275 (compare:CC (match_dup 3)
6279 (define_insn "*muldi3_internal2"
6280 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6281 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6282 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6284 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6285 (mult:DI (match_dup 1) (match_dup 2)))]
6290 [(set_attr "type" "lmul_compare")
6291 (set_attr "length" "4,8")])
6294 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
6295 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
6296 (match_operand:DI 2 "gpc_reg_operand" ""))
6298 (set (match_operand:DI 0 "gpc_reg_operand" "")
6299 (mult:DI (match_dup 1) (match_dup 2)))]
6300 "TARGET_POWERPC64 && reload_completed"
6302 (mult:DI (match_dup 1) (match_dup 2)))
6304 (compare:CC (match_dup 0)
6308 (define_insn "smuldi3_highpart"
6309 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6311 (lshiftrt:TI (mult:TI (sign_extend:TI
6312 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6314 (match_operand:DI 2 "gpc_reg_operand" "r")))
6318 [(set_attr "type" "lmul")])
6320 (define_insn "umuldi3_highpart"
6321 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6323 (lshiftrt:TI (mult:TI (zero_extend:TI
6324 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6326 (match_operand:DI 2 "gpc_reg_operand" "r")))
6330 [(set_attr "type" "lmul")])
6332 (define_expand "mulditi3"
6333 [(set (match_operand:TI 0 "gpc_reg_operand")
6334 (mult:TI (sign_extend:TI (match_operand:DI 1 "gpc_reg_operand"))
6335 (sign_extend:TI (match_operand:DI 2 "gpc_reg_operand"))))]
6338 rtx l = gen_reg_rtx (DImode), h = gen_reg_rtx (DImode);
6339 emit_insn (gen_muldi3 (l, operands[1], operands[2]));
6340 emit_insn (gen_smuldi3_highpart (h, operands[1], operands[2]));
6341 emit_move_insn (gen_lowpart (DImode, operands[0]), l);
6342 emit_move_insn (gen_highpart (DImode, operands[0]), h);
6346 (define_expand "umulditi3"
6347 [(set (match_operand:TI 0 "gpc_reg_operand")
6348 (mult:TI (zero_extend:TI (match_operand:DI 1 "gpc_reg_operand"))
6349 (zero_extend:TI (match_operand:DI 2 "gpc_reg_operand"))))]
6352 rtx l = gen_reg_rtx (DImode), h = gen_reg_rtx (DImode);
6353 emit_insn (gen_muldi3 (l, operands[1], operands[2]));
6354 emit_insn (gen_umuldi3_highpart (h, operands[1], operands[2]));
6355 emit_move_insn (gen_lowpart (DImode, operands[0]), l);
6356 emit_move_insn (gen_highpart (DImode, operands[0]), h);
6360 (define_insn "rotldi3"
6361 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6362 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6363 (match_operand:DI 2 "reg_or_cint_operand" "r,i")))]
6368 [(set_attr "type" "var_shift_rotate,integer")])
6370 (define_insn "*rotldi3_internal2"
6371 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
6372 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6373 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
6375 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
6382 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6383 (set_attr "length" "4,4,8,8")])
6386 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
6387 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6388 (match_operand:DI 2 "reg_or_cint_operand" ""))
6390 (clobber (match_scratch:DI 3 ""))]
6391 "TARGET_POWERPC64 && reload_completed"
6393 (rotate:DI (match_dup 1) (match_dup 2)))
6395 (compare:CC (match_dup 3)
6399 (define_insn "*rotldi3_internal3"
6400 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
6401 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6402 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
6404 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
6405 (rotate:DI (match_dup 1) (match_dup 2)))]
6412 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6413 (set_attr "length" "4,4,8,8")])
6416 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
6417 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6418 (match_operand:DI 2 "reg_or_cint_operand" ""))
6420 (set (match_operand:DI 0 "gpc_reg_operand" "")
6421 (rotate:DI (match_dup 1) (match_dup 2)))]
6422 "TARGET_POWERPC64 && reload_completed"
6424 (rotate:DI (match_dup 1) (match_dup 2)))
6426 (compare:CC (match_dup 0)
6430 (define_insn "*rotldi3_internal4"
6431 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6432 (and:DI (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6433 (match_operand:DI 2 "reg_or_cint_operand" "r,i"))
6434 (match_operand:DI 3 "mask64_operand" "n,n")))]
6437 rldc%B3 %0,%1,%2,%S3
6438 rldic%B3 %0,%1,%H2,%S3"
6439 [(set_attr "type" "var_shift_rotate,integer")])
6441 (define_insn "*rotldi3_internal5"
6442 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
6444 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6445 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
6446 (match_operand:DI 3 "mask64_operand" "n,n,n,n"))
6448 (clobber (match_scratch:DI 4 "=r,r,r,r"))]
6451 rldc%B3. %4,%1,%2,%S3
6452 rldic%B3. %4,%1,%H2,%S3
6455 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6456 (set_attr "length" "4,4,8,8")])
6459 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
6461 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6462 (match_operand:DI 2 "reg_or_cint_operand" ""))
6463 (match_operand:DI 3 "mask64_operand" ""))
6465 (clobber (match_scratch:DI 4 ""))]
6466 "TARGET_POWERPC64 && reload_completed"
6468 (and:DI (rotate:DI (match_dup 1)
6472 (compare:CC (match_dup 4)
6476 (define_insn "*rotldi3_internal6"
6477 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
6479 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6480 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
6481 (match_operand:DI 3 "mask64_operand" "n,n,n,n"))
6483 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
6484 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6487 rldc%B3. %0,%1,%2,%S3
6488 rldic%B3. %0,%1,%H2,%S3
6491 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6492 (set_attr "length" "4,4,8,8")])
6495 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
6497 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6498 (match_operand:DI 2 "reg_or_cint_operand" ""))
6499 (match_operand:DI 3 "mask64_operand" ""))
6501 (set (match_operand:DI 0 "gpc_reg_operand" "")
6502 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6503 "TARGET_POWERPC64 && reload_completed"
6505 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
6507 (compare:CC (match_dup 0)
6511 (define_insn "*rotldi3_internal7"
6512 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6515 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6516 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
6520 rldicl %0,%1,%H2,56"
6521 [(set_attr "type" "var_shift_rotate,integer")])
6523 (define_insn "*rotldi3_internal8"
6524 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
6525 (compare:CC (zero_extend:DI
6527 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6528 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
6530 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
6534 rldicl. %3,%1,%H2,56
6537 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6538 (set_attr "length" "4,4,8,8")])
6541 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
6542 (compare:CC (zero_extend:DI
6544 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6545 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6547 (clobber (match_scratch:DI 3 ""))]
6548 "TARGET_POWERPC64 && reload_completed"
6550 (zero_extend:DI (subreg:QI
6551 (rotate:DI (match_dup 1)
6554 (compare:CC (match_dup 3)
6558 (define_insn "*rotldi3_internal9"
6559 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
6560 (compare:CC (zero_extend:DI
6562 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6563 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
6565 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
6566 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6570 rldicl. %0,%1,%H2,56
6573 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6574 (set_attr "length" "4,4,8,8")])
6577 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
6578 (compare:CC (zero_extend:DI
6580 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6581 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6583 (set (match_operand:DI 0 "gpc_reg_operand" "")
6584 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6585 "TARGET_POWERPC64 && reload_completed"
6587 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
6589 (compare:CC (match_dup 0)
6593 (define_insn "*rotldi3_internal10"
6594 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6597 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6598 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
6602 rldicl %0,%1,%H2,48"
6603 [(set_attr "type" "var_shift_rotate,integer")])
6605 (define_insn "*rotldi3_internal11"
6606 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
6607 (compare:CC (zero_extend:DI
6609 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6610 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
6612 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
6616 rldicl. %3,%1,%H2,48
6619 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6620 (set_attr "length" "4,4,8,8")])
6623 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
6624 (compare:CC (zero_extend:DI
6626 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6627 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6629 (clobber (match_scratch:DI 3 ""))]
6630 "TARGET_POWERPC64 && reload_completed"
6632 (zero_extend:DI (subreg:HI
6633 (rotate:DI (match_dup 1)
6636 (compare:CC (match_dup 3)
6640 (define_insn "*rotldi3_internal12"
6641 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
6642 (compare:CC (zero_extend:DI
6644 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6645 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
6647 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
6648 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6652 rldicl. %0,%1,%H2,48
6655 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6656 (set_attr "length" "4,4,8,8")])
6659 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
6660 (compare:CC (zero_extend:DI
6662 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6663 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6665 (set (match_operand:DI 0 "gpc_reg_operand" "")
6666 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6667 "TARGET_POWERPC64 && reload_completed"
6669 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
6671 (compare:CC (match_dup 0)
6675 (define_insn "*rotldi3_internal13"
6676 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6679 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6680 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
6684 rldicl %0,%1,%H2,32"
6685 [(set_attr "type" "var_shift_rotate,integer")])
6687 (define_insn "*rotldi3_internal14"
6688 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
6689 (compare:CC (zero_extend:DI
6691 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6692 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
6694 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
6698 rldicl. %3,%1,%H2,32
6701 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6702 (set_attr "length" "4,4,8,8")])
6705 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
6706 (compare:CC (zero_extend:DI
6708 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6709 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6711 (clobber (match_scratch:DI 3 ""))]
6712 "TARGET_POWERPC64 && reload_completed"
6714 (zero_extend:DI (subreg:SI
6715 (rotate:DI (match_dup 1)
6718 (compare:CC (match_dup 3)
6722 (define_insn "*rotldi3_internal15"
6723 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
6724 (compare:CC (zero_extend:DI
6726 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6727 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
6729 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
6730 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6734 rldicl. %0,%1,%H2,32
6737 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6738 (set_attr "length" "4,4,8,8")])
6741 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
6742 (compare:CC (zero_extend:DI
6744 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6745 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6747 (set (match_operand:DI 0 "gpc_reg_operand" "")
6748 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6749 "TARGET_POWERPC64 && reload_completed"
6751 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
6753 (compare:CC (match_dup 0)
6757 (define_expand "ashldi3"
6758 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6759 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6760 (match_operand:SI 2 "reg_or_cint_operand" "")))]
6764 (define_insn "*ashldi3_internal1"
6765 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6766 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6767 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
6772 [(set_attr "type" "var_shift_rotate,shift")])
6774 (define_insn "*ashldi3_internal2"
6775 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
6776 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6777 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
6779 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
6786 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6787 (set_attr "length" "4,4,8,8")])
6790 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6791 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6792 (match_operand:SI 2 "reg_or_cint_operand" ""))
6794 (clobber (match_scratch:DI 3 ""))]
6795 "TARGET_POWERPC64 && reload_completed"
6797 (ashift:DI (match_dup 1) (match_dup 2)))
6799 (compare:CC (match_dup 3)
6803 (define_insn "*ashldi3_internal3"
6804 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
6805 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6806 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
6808 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
6809 (ashift:DI (match_dup 1) (match_dup 2)))]
6816 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6817 (set_attr "length" "4,4,8,8")])
6820 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6821 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6822 (match_operand:SI 2 "reg_or_cint_operand" ""))
6824 (set (match_operand:DI 0 "gpc_reg_operand" "")
6825 (ashift:DI (match_dup 1) (match_dup 2)))]
6826 "TARGET_POWERPC64 && reload_completed"
6828 (ashift:DI (match_dup 1) (match_dup 2)))
6830 (compare:CC (match_dup 0)
6834 (define_insn "*ashldi3_internal4"
6835 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6836 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6837 (match_operand:SI 2 "const_int_operand" "i"))
6838 (match_operand:DI 3 "const_int_operand" "n")))]
6839 "TARGET_POWERPC64 && includes_rldic_lshift_p (operands[2], operands[3])"
6840 "rldic %0,%1,%H2,%W3")
6842 (define_insn "ashldi3_internal5"
6843 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6845 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6846 (match_operand:SI 2 "const_int_operand" "i,i"))
6847 (match_operand:DI 3 "const_int_operand" "n,n"))
6849 (clobber (match_scratch:DI 4 "=r,r"))]
6850 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
6852 rldic. %4,%1,%H2,%W3
6854 [(set_attr "type" "compare")
6855 (set_attr "length" "4,8")])
6858 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
6860 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6861 (match_operand:SI 2 "const_int_operand" ""))
6862 (match_operand:DI 3 "const_int_operand" ""))
6864 (clobber (match_scratch:DI 4 ""))]
6865 "TARGET_POWERPC64 && reload_completed
6866 && includes_rldic_lshift_p (operands[2], operands[3])"
6868 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
6871 (compare:CC (match_dup 4)
6875 (define_insn "*ashldi3_internal6"
6876 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
6878 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6879 (match_operand:SI 2 "const_int_operand" "i,i"))
6880 (match_operand:DI 3 "const_int_operand" "n,n"))
6882 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6883 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6884 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
6886 rldic. %0,%1,%H2,%W3
6888 [(set_attr "type" "compare")
6889 (set_attr "length" "4,8")])
6892 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
6894 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6895 (match_operand:SI 2 "const_int_operand" ""))
6896 (match_operand:DI 3 "const_int_operand" ""))
6898 (set (match_operand:DI 0 "gpc_reg_operand" "")
6899 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6900 "TARGET_POWERPC64 && reload_completed
6901 && includes_rldic_lshift_p (operands[2], operands[3])"
6903 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
6906 (compare:CC (match_dup 0)
6910 (define_insn "*ashldi3_internal7"
6911 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6912 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6913 (match_operand:SI 2 "const_int_operand" "i"))
6914 (match_operand:DI 3 "mask64_operand" "n")))]
6915 "TARGET_POWERPC64 && includes_rldicr_lshift_p (operands[2], operands[3])"
6916 "rldicr %0,%1,%H2,%S3")
6918 (define_insn "ashldi3_internal8"
6919 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6921 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6922 (match_operand:SI 2 "const_int_operand" "i,i"))
6923 (match_operand:DI 3 "mask64_operand" "n,n"))
6925 (clobber (match_scratch:DI 4 "=r,r"))]
6926 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
6928 rldicr. %4,%1,%H2,%S3
6930 [(set_attr "type" "compare")
6931 (set_attr "length" "4,8")])
6934 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
6936 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6937 (match_operand:SI 2 "const_int_operand" ""))
6938 (match_operand:DI 3 "mask64_operand" ""))
6940 (clobber (match_scratch:DI 4 ""))]
6941 "TARGET_POWERPC64 && reload_completed
6942 && includes_rldicr_lshift_p (operands[2], operands[3])"
6944 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
6947 (compare:CC (match_dup 4)
6951 (define_insn "*ashldi3_internal9"
6952 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
6954 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6955 (match_operand:SI 2 "const_int_operand" "i,i"))
6956 (match_operand:DI 3 "mask64_operand" "n,n"))
6958 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6959 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6960 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
6962 rldicr. %0,%1,%H2,%S3
6964 [(set_attr "type" "compare")
6965 (set_attr "length" "4,8")])
6968 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
6970 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6971 (match_operand:SI 2 "const_int_operand" ""))
6972 (match_operand:DI 3 "mask64_operand" ""))
6974 (set (match_operand:DI 0 "gpc_reg_operand" "")
6975 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6976 "TARGET_POWERPC64 && reload_completed
6977 && includes_rldicr_lshift_p (operands[2], operands[3])"
6979 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
6982 (compare:CC (match_dup 0)
6986 (define_expand "lshrdi3"
6987 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6988 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
6989 (match_operand:SI 2 "reg_or_cint_operand" "")))]
6993 (define_insn "*lshrdi3_internal1"
6994 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6995 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6996 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
7001 [(set_attr "type" "var_shift_rotate,shift")])
7003 (define_insn "*lshrdi3_internal2"
7004 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7005 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7006 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7008 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7015 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7016 (set_attr "length" "4,4,8,8")])
7019 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7020 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7021 (match_operand:SI 2 "reg_or_cint_operand" ""))
7023 (clobber (match_scratch:DI 3 ""))]
7024 "TARGET_POWERPC64 && reload_completed"
7026 (lshiftrt:DI (match_dup 1) (match_dup 2)))
7028 (compare:CC (match_dup 3)
7032 (define_insn "*lshrdi3_internal3"
7033 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7034 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7035 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7037 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7038 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
7045 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7046 (set_attr "length" "4,4,8,8")])
7049 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7050 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7051 (match_operand:SI 2 "reg_or_cint_operand" ""))
7053 (set (match_operand:DI 0 "gpc_reg_operand" "")
7054 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
7055 "TARGET_POWERPC64 && reload_completed"
7057 (lshiftrt:DI (match_dup 1) (match_dup 2)))
7059 (compare:CC (match_dup 0)
7063 (define_expand "ashrdi3"
7064 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7065 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7066 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7070 if (TARGET_POWERPC64)
7072 else if (TARGET_32BIT && GET_CODE (operands[2]) == CONST_INT
7073 && WORDS_BIG_ENDIAN)
7075 emit_insn (gen_ashrdi3_no_power (operands[0], operands[1], operands[2]));
7082 (define_insn "*ashrdi3_internal1"
7083 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7084 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7085 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
7090 [(set_attr "type" "var_shift_rotate,shift")])
7092 (define_insn "*ashrdi3_internal2"
7093 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7094 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7095 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7097 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7104 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7105 (set_attr "length" "4,4,8,8")])
7108 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7109 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7110 (match_operand:SI 2 "reg_or_cint_operand" ""))
7112 (clobber (match_scratch:DI 3 ""))]
7113 "TARGET_POWERPC64 && reload_completed"
7115 (ashiftrt:DI (match_dup 1) (match_dup 2)))
7117 (compare:CC (match_dup 3)
7121 (define_insn "*ashrdi3_internal3"
7122 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7123 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7124 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7126 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7127 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
7134 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7135 (set_attr "length" "4,4,8,8")])
7138 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7139 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7140 (match_operand:SI 2 "reg_or_cint_operand" ""))
7142 (set (match_operand:DI 0 "gpc_reg_operand" "")
7143 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
7144 "TARGET_POWERPC64 && reload_completed"
7146 (ashiftrt:DI (match_dup 1) (match_dup 2)))
7148 (compare:CC (match_dup 0)
7152 (define_expand "anddi3"
7154 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7155 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7156 (match_operand:DI 2 "and64_2_operand" "")))
7157 (clobber (match_scratch:CC 3 ""))])]
7161 (define_insn "anddi3_mc"
7162 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
7163 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r")
7164 (match_operand:DI 2 "and64_2_operand" "?r,S,T,K,J,t")))
7165 (clobber (match_scratch:CC 3 "=X,X,X,x,x,X"))]
7166 "TARGET_POWERPC64 && rs6000_gen_cell_microcode"
7169 rldic%B2 %0,%1,0,%S2
7170 rlwinm %0,%1,0,%m2,%M2
7174 [(set_attr "type" "*,*,*,fast_compare,fast_compare,*")
7175 (set_attr "length" "4,4,4,4,4,8")])
7177 (define_insn "anddi3_nomc"
7178 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7179 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r")
7180 (match_operand:DI 2 "and64_2_operand" "?r,S,T,t")))
7181 (clobber (match_scratch:CC 3 "=X,X,X,X"))]
7182 "TARGET_POWERPC64 && !rs6000_gen_cell_microcode"
7185 rldic%B2 %0,%1,0,%S2
7186 rlwinm %0,%1,0,%m2,%M2
7188 [(set_attr "length" "4,4,4,8")])
7191 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7192 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7193 (match_operand:DI 2 "mask64_2_operand" "")))
7194 (clobber (match_scratch:CC 3 ""))]
7196 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7197 && !mask_operand (operands[2], DImode)
7198 && !mask64_operand (operands[2], DImode)"
7200 (and:DI (rotate:DI (match_dup 1)
7204 (and:DI (rotate:DI (match_dup 0)
7208 build_mask64_2_operands (operands[2], &operands[4]);
7211 (define_insn "*anddi3_internal2_mc"
7212 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,x,?y,?y,?y,??y,??y,?y")
7213 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r,r,r")
7214 (match_operand:DI 2 "and64_2_operand" "r,S,T,K,J,t,r,S,T,K,J,t"))
7216 (clobber (match_scratch:DI 3 "=r,r,r,r,r,r,r,r,r,r,r,r"))
7217 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,X,X,x,x,X"))]
7218 "TARGET_64BIT && rs6000_gen_cell_microcode"
7221 rldic%B2. %3,%1,0,%S2
7222 rlwinm. %3,%1,0,%m2,%M2
7232 [(set_attr "type" "fast_compare,compare,delayed_compare,fast_compare,\
7233 fast_compare,compare,compare,compare,compare,compare,\
7235 (set_attr "length" "4,4,4,4,4,8,8,8,8,8,8,12")])
7238 [(set (match_operand:CC 0 "cc_reg_operand" "")
7239 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7240 (match_operand:DI 2 "mask64_2_operand" ""))
7242 (clobber (match_scratch:DI 3 ""))
7243 (clobber (match_scratch:CC 4 ""))]
7244 "TARGET_64BIT && reload_completed
7245 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7246 && !mask_operand (operands[2], DImode)
7247 && !mask64_operand (operands[2], DImode)"
7249 (and:DI (rotate:DI (match_dup 1)
7252 (parallel [(set (match_dup 0)
7253 (compare:CC (and:DI (rotate:DI (match_dup 3)
7257 (clobber (match_dup 3))])]
7260 build_mask64_2_operands (operands[2], &operands[5]);
7263 (define_insn "*anddi3_internal3_mc"
7264 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,x,x,?y,?y,?y,??y,??y,?y")
7265 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r,r,r")
7266 (match_operand:DI 2 "and64_2_operand" "r,S,T,K,J,t,r,S,T,K,J,t"))
7268 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r,r,r")
7269 (and:DI (match_dup 1) (match_dup 2)))
7270 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,X,X,x,x,X"))]
7271 "TARGET_64BIT && rs6000_gen_cell_microcode"
7274 rldic%B2. %0,%1,0,%S2
7275 rlwinm. %0,%1,0,%m2,%M2
7285 [(set_attr "type" "fast_compare,compare,delayed_compare,fast_compare,\
7286 fast_compare,compare,compare,compare,compare,compare,\
7288 (set_attr "length" "4,4,4,4,4,8,8,8,8,8,8,12")])
7291 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7292 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7293 (match_operand:DI 2 "and64_2_operand" ""))
7295 (set (match_operand:DI 0 "gpc_reg_operand" "")
7296 (and:DI (match_dup 1) (match_dup 2)))
7297 (clobber (match_scratch:CC 4 ""))]
7298 "TARGET_64BIT && reload_completed"
7299 [(parallel [(set (match_dup 0)
7300 (and:DI (match_dup 1) (match_dup 2)))
7301 (clobber (match_dup 4))])
7303 (compare:CC (match_dup 0)
7308 [(set (match_operand:CC 3 "cc_reg_operand" "")
7309 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7310 (match_operand:DI 2 "mask64_2_operand" ""))
7312 (set (match_operand:DI 0 "gpc_reg_operand" "")
7313 (and:DI (match_dup 1) (match_dup 2)))
7314 (clobber (match_scratch:CC 4 ""))]
7315 "TARGET_64BIT && reload_completed
7316 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7317 && !mask_operand (operands[2], DImode)
7318 && !mask64_operand (operands[2], DImode)"
7320 (and:DI (rotate:DI (match_dup 1)
7323 (parallel [(set (match_dup 3)
7324 (compare:CC (and:DI (rotate:DI (match_dup 0)
7329 (and:DI (rotate:DI (match_dup 0)
7334 build_mask64_2_operands (operands[2], &operands[5]);
7337 (define_expand "iordi3"
7338 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7339 (ior:DI (match_operand:DI 1 "gpc_reg_operand" "")
7340 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
7344 if (non_logical_cint_operand (operands[2], DImode))
7346 HOST_WIDE_INT value;
7347 rtx tmp = ((!can_create_pseudo_p ()
7348 || rtx_equal_p (operands[0], operands[1]))
7349 ? operands[0] : gen_reg_rtx (DImode));
7351 if (GET_CODE (operands[2]) == CONST_INT)
7353 value = INTVAL (operands[2]);
7354 emit_insn (gen_iordi3 (tmp, operands[1],
7355 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
7359 value = CONST_DOUBLE_LOW (operands[2]);
7360 emit_insn (gen_iordi3 (tmp, operands[1],
7361 immed_double_const (value
7362 & (~ (HOST_WIDE_INT) 0xffff),
7366 emit_insn (gen_iordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
7371 (define_expand "xordi3"
7372 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7373 (xor:DI (match_operand:DI 1 "gpc_reg_operand" "")
7374 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
7378 if (non_logical_cint_operand (operands[2], DImode))
7380 HOST_WIDE_INT value;
7381 rtx tmp = ((!can_create_pseudo_p ()
7382 || rtx_equal_p (operands[0], operands[1]))
7383 ? operands[0] : gen_reg_rtx (DImode));
7385 if (GET_CODE (operands[2]) == CONST_INT)
7387 value = INTVAL (operands[2]);
7388 emit_insn (gen_xordi3 (tmp, operands[1],
7389 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
7393 value = CONST_DOUBLE_LOW (operands[2]);
7394 emit_insn (gen_xordi3 (tmp, operands[1],
7395 immed_double_const (value
7396 & (~ (HOST_WIDE_INT) 0xffff),
7400 emit_insn (gen_xordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
7405 (define_insn "*booldi3_internal1"
7406 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
7407 (match_operator:DI 3 "boolean_or_operator"
7408 [(match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
7409 (match_operand:DI 2 "logical_operand" "r,K,JF")]))]
7416 (define_insn "*booldi3_internal2"
7417 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7418 (compare:CC (match_operator:DI 4 "boolean_or_operator"
7419 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
7420 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7422 (clobber (match_scratch:DI 3 "=r,r"))]
7427 [(set_attr "type" "fast_compare,compare")
7428 (set_attr "length" "4,8")])
7431 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7432 (compare:CC (match_operator:DI 4 "boolean_operator"
7433 [(match_operand:DI 1 "gpc_reg_operand" "")
7434 (match_operand:DI 2 "gpc_reg_operand" "")])
7436 (clobber (match_scratch:DI 3 ""))]
7437 "TARGET_POWERPC64 && reload_completed"
7438 [(set (match_dup 3) (match_dup 4))
7440 (compare:CC (match_dup 3)
7444 (define_insn "*booldi3_internal3"
7445 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7446 (compare:CC (match_operator:DI 4 "boolean_or_operator"
7447 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
7448 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7450 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7456 [(set_attr "type" "fast_compare,compare")
7457 (set_attr "length" "4,8")])
7460 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7461 (compare:CC (match_operator:DI 4 "boolean_operator"
7462 [(match_operand:DI 1 "gpc_reg_operand" "")
7463 (match_operand:DI 2 "gpc_reg_operand" "")])
7465 (set (match_operand:DI 0 "gpc_reg_operand" "")
7467 "TARGET_POWERPC64 && reload_completed"
7468 [(set (match_dup 0) (match_dup 4))
7470 (compare:CC (match_dup 0)
7474 ;; Split a logical operation that we can't do in one insn into two insns,
7475 ;; each of which does one 16-bit part. This is used by combine.
7478 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7479 (match_operator:DI 3 "boolean_or_operator"
7480 [(match_operand:DI 1 "gpc_reg_operand" "")
7481 (match_operand:DI 2 "non_logical_cint_operand" "")]))]
7483 [(set (match_dup 0) (match_dup 4))
7484 (set (match_dup 0) (match_dup 5))]
7489 if (GET_CODE (operands[2]) == CONST_DOUBLE)
7491 HOST_WIDE_INT value = CONST_DOUBLE_LOW (operands[2]);
7492 i3 = immed_double_const (value & (~ (HOST_WIDE_INT) 0xffff),
7494 i4 = GEN_INT (value & 0xffff);
7498 i3 = GEN_INT (INTVAL (operands[2])
7499 & (~ (HOST_WIDE_INT) 0xffff));
7500 i4 = GEN_INT (INTVAL (operands[2]) & 0xffff);
7502 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
7504 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
7508 (define_insn "*boolcdi3_internal1"
7509 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7510 (match_operator:DI 3 "boolean_operator"
7511 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
7512 (match_operand:DI 2 "gpc_reg_operand" "r")]))]
7516 (define_insn "*boolcdi3_internal2"
7517 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7518 (compare:CC (match_operator:DI 4 "boolean_operator"
7519 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
7520 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7522 (clobber (match_scratch:DI 3 "=r,r"))]
7527 [(set_attr "type" "fast_compare,compare")
7528 (set_attr "length" "4,8")])
7531 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7532 (compare:CC (match_operator:DI 4 "boolean_operator"
7533 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7534 (match_operand:DI 2 "gpc_reg_operand" "")])
7536 (clobber (match_scratch:DI 3 ""))]
7537 "TARGET_POWERPC64 && reload_completed"
7538 [(set (match_dup 3) (match_dup 4))
7540 (compare:CC (match_dup 3)
7544 (define_insn "*boolcdi3_internal3"
7545 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7546 (compare:CC (match_operator:DI 4 "boolean_operator"
7547 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
7548 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7550 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7556 [(set_attr "type" "fast_compare,compare")
7557 (set_attr "length" "4,8")])
7560 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7561 (compare:CC (match_operator:DI 4 "boolean_operator"
7562 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7563 (match_operand:DI 2 "gpc_reg_operand" "")])
7565 (set (match_operand:DI 0 "gpc_reg_operand" "")
7567 "TARGET_POWERPC64 && reload_completed"
7568 [(set (match_dup 0) (match_dup 4))
7570 (compare:CC (match_dup 0)
7574 (define_insn "*boolccdi3_internal1"
7575 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7576 (match_operator:DI 3 "boolean_operator"
7577 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
7578 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r"))]))]
7582 (define_insn "*boolccdi3_internal2"
7583 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7584 (compare:CC (match_operator:DI 4 "boolean_operator"
7585 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
7586 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
7588 (clobber (match_scratch:DI 3 "=r,r"))]
7593 [(set_attr "type" "fast_compare,compare")
7594 (set_attr "length" "4,8")])
7597 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7598 (compare:CC (match_operator:DI 4 "boolean_operator"
7599 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7600 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
7602 (clobber (match_scratch:DI 3 ""))]
7603 "TARGET_POWERPC64 && reload_completed"
7604 [(set (match_dup 3) (match_dup 4))
7606 (compare:CC (match_dup 3)
7610 (define_insn "*boolccdi3_internal3"
7611 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7612 (compare:CC (match_operator:DI 4 "boolean_operator"
7613 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
7614 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
7616 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7622 [(set_attr "type" "fast_compare,compare")
7623 (set_attr "length" "4,8")])
7626 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7627 (compare:CC (match_operator:DI 4 "boolean_operator"
7628 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7629 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
7631 (set (match_operand:DI 0 "gpc_reg_operand" "")
7633 "TARGET_POWERPC64 && reload_completed"
7634 [(set (match_dup 0) (match_dup 4))
7636 (compare:CC (match_dup 0)
7640 ;; Now define ways of moving data around.
7642 ;; Set up a register with a value from the GOT table
7644 (define_expand "movsi_got"
7645 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7646 (unspec:SI [(match_operand:SI 1 "got_operand" "")
7647 (match_dup 2)] UNSPEC_MOVSI_GOT))]
7648 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
7651 if (GET_CODE (operands[1]) == CONST)
7653 rtx offset = const0_rtx;
7654 HOST_WIDE_INT value;
7656 operands[1] = eliminate_constant_term (XEXP (operands[1], 0), &offset);
7657 value = INTVAL (offset);
7660 rtx tmp = (!can_create_pseudo_p ()
7662 : gen_reg_rtx (Pmode));
7663 emit_insn (gen_movsi_got (tmp, operands[1]));
7664 emit_insn (gen_addsi3 (operands[0], tmp, offset));
7669 operands[2] = rs6000_got_register (operands[1]);
7672 (define_insn "*movsi_got_internal"
7673 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7674 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
7675 (match_operand:SI 2 "gpc_reg_operand" "b")]
7677 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
7678 "lwz %0,%a1@got(%2)"
7679 [(set_attr "type" "load")])
7681 ;; Used by sched, shorten_branches and final when the GOT pseudo reg
7682 ;; didn't get allocated to a hard register.
7684 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7685 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
7686 (match_operand:SI 2 "memory_operand" "")]
7688 "DEFAULT_ABI == ABI_V4
7690 && (reload_in_progress || reload_completed)"
7691 [(set (match_dup 0) (match_dup 2))
7692 (set (match_dup 0) (unspec:SI [(match_dup 1)(match_dup 0)]
7696 ;; For SI, we special-case integers that can't be loaded in one insn. We
7697 ;; do the load 16-bits at a time. We could do this by loading from memory,
7698 ;; and this is even supposed to be faster, but it is simpler not to get
7699 ;; integers in the TOC.
7700 (define_insn "movsi_low"
7701 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7702 (mem:SI (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
7703 (match_operand 2 "" ""))))]
7704 "TARGET_MACHO && ! TARGET_64BIT"
7705 "lwz %0,lo16(%2)(%1)"
7706 [(set_attr "type" "load")
7707 (set_attr "length" "4")])
7709 (define_insn "*movsi_internal1"
7710 [(set (match_operand:SI 0 "rs6000_nonimmediate_operand" "=r,r,r,m,r,r,r,r,*c*l,*h,*h")
7711 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,*h,r,r,0"))]
7712 "!TARGET_SINGLE_FPU &&
7713 (gpc_reg_operand (operands[0], SImode) || gpc_reg_operand (operands[1], SImode))"
7726 [(set_attr "type" "*,*,load,store,*,*,*,mfjmpr,mtjmpr,*,*")
7727 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4")])
7729 (define_insn "*movsi_internal1_single"
7730 [(set (match_operand:SI 0 "rs6000_nonimmediate_operand" "=r,r,r,m,r,r,r,r,*c*l,*h,*h,m,*f")
7731 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,*h,r,r,0,f,m"))]
7732 "TARGET_SINGLE_FPU &&
7733 (gpc_reg_operand (operands[0], SImode) || gpc_reg_operand (operands[1], SImode))"
7748 [(set_attr "type" "*,*,load,store,*,*,*,mfjmpr,mtjmpr,*,*,*,*")
7749 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4,4,4")])
7751 ;; Split a load of a large constant into the appropriate two-insn
7755 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7756 (match_operand:SI 1 "const_int_operand" ""))]
7757 "(unsigned HOST_WIDE_INT) (INTVAL (operands[1]) + 0x8000) >= 0x10000
7758 && (INTVAL (operands[1]) & 0xffff) != 0"
7762 (ior:SI (match_dup 0)
7765 { rtx tem = rs6000_emit_set_const (operands[0], SImode, operands[1], 2);
7767 if (tem == operands[0])
7773 (define_insn "*mov<mode>_internal2"
7774 [(set (match_operand:CC 2 "cc_reg_operand" "=y,x,?y")
7775 (compare:CC (match_operand:P 1 "gpc_reg_operand" "0,r,r")
7777 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r") (match_dup 1))]
7783 [(set_attr "type" "cmp,compare,cmp")
7784 (set_attr "length" "4,4,8")])
7787 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
7788 (compare:CC (match_operand:P 1 "gpc_reg_operand" "")
7790 (set (match_operand:P 0 "gpc_reg_operand" "") (match_dup 1))]
7792 [(set (match_dup 0) (match_dup 1))
7794 (compare:CC (match_dup 0)
7798 (define_insn "*movhi_internal"
7799 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,m,r,r,*c*l,*h")
7800 (match_operand:HI 1 "input_operand" "r,m,r,i,*h,r,0"))]
7801 "gpc_reg_operand (operands[0], HImode)
7802 || gpc_reg_operand (operands[1], HImode)"
7811 [(set_attr "type" "*,load,store,*,mfjmpr,mtjmpr,*")])
7813 (define_expand "mov<mode>"
7814 [(set (match_operand:INT 0 "general_operand" "")
7815 (match_operand:INT 1 "any_operand" ""))]
7817 "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
7819 (define_insn "*movqi_internal"
7820 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,m,r,r,*c*l,*h")
7821 (match_operand:QI 1 "input_operand" "r,m,r,i,*h,r,0"))]
7822 "gpc_reg_operand (operands[0], QImode)
7823 || gpc_reg_operand (operands[1], QImode)"
7832 [(set_attr "type" "*,load,store,*,mfjmpr,mtjmpr,*")])
7834 ;; Here is how to move condition codes around. When we store CC data in
7835 ;; an integer register or memory, we store just the high-order 4 bits.
7836 ;; This lets us not shift in the most common case of CR0.
7837 (define_expand "movcc"
7838 [(set (match_operand:CC 0 "nonimmediate_operand" "")
7839 (match_operand:CC 1 "nonimmediate_operand" ""))]
7843 (define_insn "*movcc_internal1"
7844 [(set (match_operand:CC 0 "nonimmediate_operand" "=y,x,?y,y,r,r,r,r,r,cl,r,m")
7845 (match_operand:CC 1 "general_operand" "y,r,r,O,x,y,r,I,h,r,m,r"))]
7846 "register_operand (operands[0], CCmode)
7847 || register_operand (operands[1], CCmode)"
7851 rlwinm %1,%1,%F0,0xffffffff\;mtcrf %R0,%1\;rlwinm %1,%1,%f0,0xffffffff
7854 mfcr %0%Q1\;rlwinm %0,%0,%f1,0xf0000000
7862 (cond [(eq_attr "alternative" "0,3")
7863 (const_string "cr_logical")
7864 (eq_attr "alternative" "1,2")
7865 (const_string "mtcr")
7866 (eq_attr "alternative" "6,7")
7867 (const_string "integer")
7868 (eq_attr "alternative" "8")
7869 (const_string "mfjmpr")
7870 (eq_attr "alternative" "9")
7871 (const_string "mtjmpr")
7872 (eq_attr "alternative" "10")
7873 (const_string "load")
7874 (eq_attr "alternative" "11")
7875 (const_string "store")
7876 (match_test "TARGET_MFCRF")
7877 (const_string "mfcrf")
7879 (const_string "mfcr")))
7880 (set_attr "length" "4,4,12,4,4,8,4,4,4,4,4,4")])
7882 ;; For floating-point, we normally deal with the floating-point registers
7883 ;; unless -msoft-float is used. The sole exception is that parameter passing
7884 ;; can produce floating-point values in fixed-point registers. Unless the
7885 ;; value is a simple constant or already in memory, we deal with this by
7886 ;; allocating memory and copying the value explicitly via that memory location.
7887 (define_expand "movsf"
7888 [(set (match_operand:SF 0 "nonimmediate_operand" "")
7889 (match_operand:SF 1 "any_operand" ""))]
7891 "{ rs6000_emit_move (operands[0], operands[1], SFmode); DONE; }")
7894 [(set (match_operand:SF 0 "gpc_reg_operand" "")
7895 (match_operand:SF 1 "const_double_operand" ""))]
7897 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
7898 || (GET_CODE (operands[0]) == SUBREG
7899 && GET_CODE (SUBREG_REG (operands[0])) == REG
7900 && REGNO (SUBREG_REG (operands[0])) <= 31))"
7901 [(set (match_dup 2) (match_dup 3))]
7907 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
7908 REAL_VALUE_TO_TARGET_SINGLE (rv, l);
7910 if (! TARGET_POWERPC64)
7911 operands[2] = operand_subword (operands[0], 0, 0, SFmode);
7913 operands[2] = gen_lowpart (SImode, operands[0]);
7915 operands[3] = gen_int_mode (l, SImode);
7918 (define_insn "*movsf_hardfloat"
7919 [(set (match_operand:SF 0 "nonimmediate_operand" "=!r,!r,m,f,f,m,*c*l,!r,*h,!r,!r")
7920 (match_operand:SF 1 "input_operand" "r,m,r,f,m,f,r,h,0,G,Fn"))]
7921 "(gpc_reg_operand (operands[0], SFmode)
7922 || gpc_reg_operand (operands[1], SFmode))
7923 && (TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT)"
7936 [(set_attr "type" "*,load,store,fp,fpload,fpstore,mtjmpr,mfjmpr,*,*,*")
7937 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,8")])
7939 (define_insn "*movsf_softfloat"
7940 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,cl,r,r,m,r,r,r,r,*h")
7941 (match_operand:SF 1 "input_operand" "r,r,h,m,r,I,L,G,Fn,0"))]
7942 "(gpc_reg_operand (operands[0], SFmode)
7943 || gpc_reg_operand (operands[1], SFmode))
7944 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)"
7956 [(set_attr "type" "*,mtjmpr,mfjmpr,load,store,*,*,*,*,*")
7957 (set_attr "length" "4,4,4,4,4,4,4,4,8,4")])
7960 (define_expand "movdf"
7961 [(set (match_operand:DF 0 "nonimmediate_operand" "")
7962 (match_operand:DF 1 "any_operand" ""))]
7964 "{ rs6000_emit_move (operands[0], operands[1], DFmode); DONE; }")
7967 [(set (match_operand:DF 0 "gpc_reg_operand" "")
7968 (match_operand:DF 1 "const_int_operand" ""))]
7969 "! TARGET_POWERPC64 && reload_completed
7970 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
7971 || (GET_CODE (operands[0]) == SUBREG
7972 && GET_CODE (SUBREG_REG (operands[0])) == REG
7973 && REGNO (SUBREG_REG (operands[0])) <= 31))"
7974 [(set (match_dup 2) (match_dup 4))
7975 (set (match_dup 3) (match_dup 1))]
7978 int endian = (WORDS_BIG_ENDIAN == 0);
7979 HOST_WIDE_INT value = INTVAL (operands[1]);
7981 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
7982 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
7983 #if HOST_BITS_PER_WIDE_INT == 32
7984 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
7986 operands[4] = GEN_INT (value >> 32);
7987 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
7992 [(set (match_operand:DF 0 "gpc_reg_operand" "")
7993 (match_operand:DF 1 "const_double_operand" ""))]
7994 "! TARGET_POWERPC64 && reload_completed
7995 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
7996 || (GET_CODE (operands[0]) == SUBREG
7997 && GET_CODE (SUBREG_REG (operands[0])) == REG
7998 && REGNO (SUBREG_REG (operands[0])) <= 31))"
7999 [(set (match_dup 2) (match_dup 4))
8000 (set (match_dup 3) (match_dup 5))]
8003 int endian = (WORDS_BIG_ENDIAN == 0);
8007 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8008 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
8010 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
8011 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
8012 operands[4] = gen_int_mode (l[endian], SImode);
8013 operands[5] = gen_int_mode (l[1 - endian], SImode);
8017 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8018 (match_operand:DF 1 "const_double_operand" ""))]
8019 "TARGET_POWERPC64 && reload_completed
8020 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8021 || (GET_CODE (operands[0]) == SUBREG
8022 && GET_CODE (SUBREG_REG (operands[0])) == REG
8023 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8024 [(set (match_dup 2) (match_dup 3))]
8027 int endian = (WORDS_BIG_ENDIAN == 0);
8030 #if HOST_BITS_PER_WIDE_INT >= 64
8034 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8035 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
8037 operands[2] = gen_lowpart (DImode, operands[0]);
8038 /* HIGHPART is lower memory address when WORDS_BIG_ENDIAN. */
8039 #if HOST_BITS_PER_WIDE_INT >= 64
8040 val = ((HOST_WIDE_INT)(unsigned long)l[endian] << 32
8041 | ((HOST_WIDE_INT)(unsigned long)l[1 - endian]));
8043 operands[3] = gen_int_mode (val, DImode);
8045 operands[3] = immed_double_const (l[1 - endian], l[endian], DImode);
8049 ;; Don't have reload use general registers to load a constant. It is
8050 ;; less efficient than loading the constant into an FP register, since
8051 ;; it will probably be used there.
8053 ;; The move constraints are ordered to prefer floating point registers before
8054 ;; general purpose registers to avoid doing a store and a load to get the value
8055 ;; into a floating point register when it is needed for a floating point
8056 ;; operation. Prefer traditional floating point registers over VSX registers,
8057 ;; since the D-form version of the memory instructions does not need a GPR for
8060 (define_insn "*movdf_hardfloat32"
8061 [(set (match_operand:DF 0 "nonimmediate_operand" "=m,d,d,ws,?wa,Z,?Z,ws,?wa,wa,Y,r,!r,!r,!r,!r")
8062 (match_operand:DF 1 "input_operand" "d,m,d,Z,Z,ws,wa,ws,wa,j,r,Y,r,G,H,F"))]
8063 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
8064 && (gpc_reg_operand (operands[0], DFmode)
8065 || gpc_reg_operand (operands[1], DFmode))"
8083 [(set_attr "type" "fpstore,fpload,fp,fpload,fpload,fpstore,fpstore,vecsimple,vecsimple,vecsimple,store,load,two,fp,fp,*")
8084 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,8,8,8,8,12,16")])
8086 (define_insn "*movdf_softfloat32"
8087 [(set (match_operand:DF 0 "nonimmediate_operand" "=Y,r,r,r,r,r")
8088 (match_operand:DF 1 "input_operand" "r,Y,r,G,H,F"))]
8090 && ((TARGET_FPRS && TARGET_SINGLE_FLOAT)
8091 || TARGET_SOFT_FLOAT || TARGET_E500_SINGLE)
8092 && (gpc_reg_operand (operands[0], DFmode)
8093 || gpc_reg_operand (operands[1], DFmode))"
8095 [(set_attr "type" "store,load,two,*,*,*")
8096 (set_attr "length" "8,8,8,8,12,16")])
8098 ;; Reload patterns to support gpr load/store with misaligned mem.
8099 ;; and multiple gpr load/store at offset >= 0xfffc
8100 (define_expand "reload_<mode>_store"
8101 [(parallel [(match_operand 0 "memory_operand" "=m")
8102 (match_operand 1 "gpc_reg_operand" "r")
8103 (match_operand:GPR 2 "register_operand" "=&b")])]
8106 rs6000_secondary_reload_gpr (operands[1], operands[0], operands[2], true);
8110 (define_expand "reload_<mode>_load"
8111 [(parallel [(match_operand 0 "gpc_reg_operand" "=r")
8112 (match_operand 1 "memory_operand" "m")
8113 (match_operand:GPR 2 "register_operand" "=b")])]
8116 rs6000_secondary_reload_gpr (operands[0], operands[1], operands[2], false);
8120 ; ld/std require word-aligned displacements -> 'Y' constraint.
8121 ; List Y->r and r->Y before r->r for reload.
8122 (define_insn "*movdf_hardfloat64_mfpgpr"
8123 [(set (match_operand:DF 0 "nonimmediate_operand" "=Y,r,!r,ws,?wa,ws,?wa,Z,?Z,m,d,d,wa,*c*l,!r,*h,!r,!r,!r,r,d")
8124 (match_operand:DF 1 "input_operand" "r,Y,r,ws,?wa,Z,Z,ws,wa,d,m,d,j,r,h,0,G,H,F,d,r"))]
8125 "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
8126 && TARGET_DOUBLE_FLOAT
8127 && (gpc_reg_operand (operands[0], DFmode)
8128 || gpc_reg_operand (operands[1], DFmode))"
8151 [(set_attr "type" "store,load,*,fp,fp,fpload,fpload,fpstore,fpstore,fpstore,fpload,fp,vecsimple,mtjmpr,mfjmpr,*,*,*,*,mftgpr,mffgpr")
8152 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,8,12,16,4,4")])
8154 ; ld/std require word-aligned displacements -> 'Y' constraint.
8155 ; List Y->r and r->Y before r->r for reload.
8156 (define_insn "*movdf_hardfloat64"
8157 [(set (match_operand:DF 0 "nonimmediate_operand" "=m,d,d,Y,r,!r,ws,?wa,Z,?Z,ws,?wa,wa,*c*l,!r,*h,!r,!r,!r")
8158 (match_operand:DF 1 "input_operand" "d,m,d,r,Y,r,Z,Z,ws,wa,ws,wa,j,r,h,0,G,H,F"))]
8159 "TARGET_POWERPC64 && !TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
8160 && TARGET_DOUBLE_FLOAT
8161 && (gpc_reg_operand (operands[0], DFmode)
8162 || gpc_reg_operand (operands[1], DFmode))"
8183 [(set_attr "type" "fpstore,fpload,fp,store,load,*,fpload,fpload,fpstore,fpstore,vecsimple,vecsimple,vecsimple,mtjmpr,mfjmpr,*,*,*,*")
8184 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,8,12,16")])
8186 (define_insn "*movdf_softfloat64"
8187 [(set (match_operand:DF 0 "nonimmediate_operand" "=Y,r,r,cl,r,r,r,r,*h")
8188 (match_operand:DF 1 "input_operand" "r,Y,r,r,h,G,H,F,0"))]
8189 "TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)
8190 && (gpc_reg_operand (operands[0], DFmode)
8191 || gpc_reg_operand (operands[1], DFmode))"
8202 [(set_attr "type" "store,load,*,mtjmpr,mfjmpr,*,*,*,*")
8203 (set_attr "length" "4,4,4,4,4,8,12,16,4")])
8205 (define_expand "movtf"
8206 [(set (match_operand:TF 0 "general_operand" "")
8207 (match_operand:TF 1 "any_operand" ""))]
8208 "!TARGET_IEEEQUAD && TARGET_LONG_DOUBLE_128"
8209 "{ rs6000_emit_move (operands[0], operands[1], TFmode); DONE; }")
8211 ;; It's important to list Y->r and r->Y before r->r because otherwise
8212 ;; reload, given m->r, will try to pick r->r and reload it, which
8213 ;; doesn't make progress.
8214 (define_insn_and_split "*movtf_internal"
8215 [(set (match_operand:TF 0 "nonimmediate_operand" "=m,d,d,Y,r,r")
8216 (match_operand:TF 1 "input_operand" "d,m,d,r,YGHF,r"))]
8218 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128
8219 && (gpc_reg_operand (operands[0], TFmode)
8220 || gpc_reg_operand (operands[1], TFmode))"
8222 "&& reload_completed"
8224 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
8225 [(set_attr "length" "8,8,8,20,20,16")])
8227 (define_insn_and_split "*movtf_softfloat"
8228 [(set (match_operand:TF 0 "rs6000_nonimmediate_operand" "=Y,r,r")
8229 (match_operand:TF 1 "input_operand" "r,YGHF,r"))]
8231 && (TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_LONG_DOUBLE_128
8232 && (gpc_reg_operand (operands[0], TFmode)
8233 || gpc_reg_operand (operands[1], TFmode))"
8235 "&& reload_completed"
8237 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
8238 [(set_attr "length" "20,20,16")])
8240 (define_expand "extenddftf2"
8241 [(set (match_operand:TF 0 "nonimmediate_operand" "")
8242 (float_extend:TF (match_operand:DF 1 "input_operand" "")))]
8244 && TARGET_HARD_FLOAT
8245 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8246 && TARGET_LONG_DOUBLE_128"
8248 if (TARGET_E500_DOUBLE)
8249 emit_insn (gen_spe_extenddftf2 (operands[0], operands[1]));
8251 emit_insn (gen_extenddftf2_fprs (operands[0], operands[1]));
8255 (define_expand "extenddftf2_fprs"
8256 [(parallel [(set (match_operand:TF 0 "nonimmediate_operand" "")
8257 (float_extend:TF (match_operand:DF 1 "input_operand" "")))
8258 (use (match_dup 2))])]
8260 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
8261 && TARGET_LONG_DOUBLE_128"
8263 operands[2] = CONST0_RTX (DFmode);
8264 /* Generate GOT reference early for SVR4 PIC. */
8265 if (DEFAULT_ABI == ABI_V4 && flag_pic)
8266 operands[2] = validize_mem (force_const_mem (DFmode, operands[2]));
8269 (define_insn_and_split "*extenddftf2_internal"
8270 [(set (match_operand:TF 0 "nonimmediate_operand" "=m,Y,d,&d,r")
8271 (float_extend:TF (match_operand:DF 1 "input_operand" "d,r,md,md,rmGHF")))
8272 (use (match_operand:DF 2 "zero_reg_mem_operand" "d,r,m,d,n"))]
8274 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
8275 && TARGET_LONG_DOUBLE_128"
8277 "&& reload_completed"
8280 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
8281 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
8282 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word),
8284 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word),
8289 (define_expand "extendsftf2"
8290 [(set (match_operand:TF 0 "nonimmediate_operand" "")
8291 (float_extend:TF (match_operand:SF 1 "gpc_reg_operand" "")))]
8293 && TARGET_HARD_FLOAT
8294 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8295 && TARGET_LONG_DOUBLE_128"
8297 rtx tmp = gen_reg_rtx (DFmode);
8298 emit_insn (gen_extendsfdf2 (tmp, operands[1]));
8299 emit_insn (gen_extenddftf2 (operands[0], tmp));
8303 (define_expand "trunctfdf2"
8304 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8305 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "")))]
8307 && TARGET_HARD_FLOAT
8308 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8309 && TARGET_LONG_DOUBLE_128"
8312 (define_insn_and_split "trunctfdf2_internal1"
8313 [(set (match_operand:DF 0 "gpc_reg_operand" "=d,?d")
8314 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "0,d")))]
8315 "!TARGET_IEEEQUAD && !TARGET_XL_COMPAT
8316 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8320 "&& reload_completed && REGNO (operands[0]) == REGNO (operands[1])"
8323 emit_note (NOTE_INSN_DELETED);
8326 [(set_attr "type" "fp")])
8328 (define_insn "trunctfdf2_internal2"
8329 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
8330 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "d")))]
8331 "!TARGET_IEEEQUAD && TARGET_XL_COMPAT
8332 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
8333 && TARGET_LONG_DOUBLE_128"
8335 [(set_attr "type" "fp")
8336 (set_attr "fp_type" "fp_addsub_d")])
8338 (define_expand "trunctfsf2"
8339 [(set (match_operand:SF 0 "gpc_reg_operand" "")
8340 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "")))]
8342 && TARGET_HARD_FLOAT
8343 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8344 && TARGET_LONG_DOUBLE_128"
8346 if (TARGET_E500_DOUBLE)
8347 emit_insn (gen_spe_trunctfsf2 (operands[0], operands[1]));
8349 emit_insn (gen_trunctfsf2_fprs (operands[0], operands[1]));
8353 (define_insn_and_split "trunctfsf2_fprs"
8354 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
8355 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "d")))
8356 (clobber (match_scratch:DF 2 "=d"))]
8358 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
8359 && TARGET_LONG_DOUBLE_128"
8361 "&& reload_completed"
8363 (float_truncate:DF (match_dup 1)))
8365 (float_truncate:SF (match_dup 2)))]
8368 (define_expand "floatsitf2"
8369 [(set (match_operand:TF 0 "gpc_reg_operand" "")
8370 (float:TF (match_operand:SI 1 "gpc_reg_operand" "")))]
8372 && TARGET_HARD_FLOAT
8373 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8374 && TARGET_LONG_DOUBLE_128"
8376 rtx tmp = gen_reg_rtx (DFmode);
8377 expand_float (tmp, operands[1], false);
8378 emit_insn (gen_extenddftf2 (operands[0], tmp));
8382 ; fadd, but rounding towards zero.
8383 ; This is probably not the optimal code sequence.
8384 (define_insn "fix_trunc_helper"
8385 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
8386 (unspec:DF [(match_operand:TF 1 "gpc_reg_operand" "d")]
8387 UNSPEC_FIX_TRUNC_TF))
8388 (clobber (match_operand:DF 2 "gpc_reg_operand" "=&d"))]
8389 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
8390 "mffs %2\n\tmtfsb1 31\n\tmtfsb0 30\n\tfadd %0,%1,%L1\n\tmtfsf 1,%2"
8391 [(set_attr "type" "fp")
8392 (set_attr "length" "20")])
8394 (define_expand "fix_trunctfsi2"
8395 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8396 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))]
8397 "!TARGET_IEEEQUAD && TARGET_HARD_FLOAT
8398 && (TARGET_FPRS || TARGET_E500_DOUBLE) && TARGET_LONG_DOUBLE_128"
8400 if (TARGET_E500_DOUBLE)
8401 emit_insn (gen_spe_fix_trunctfsi2 (operands[0], operands[1]));
8403 emit_insn (gen_fix_trunctfsi2_fprs (operands[0], operands[1]));
8407 (define_expand "fix_trunctfsi2_fprs"
8408 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
8409 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))
8410 (clobber (match_dup 2))
8411 (clobber (match_dup 3))
8412 (clobber (match_dup 4))
8413 (clobber (match_dup 5))])]
8415 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8417 operands[2] = gen_reg_rtx (DFmode);
8418 operands[3] = gen_reg_rtx (DFmode);
8419 operands[4] = gen_reg_rtx (DImode);
8420 operands[5] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode));
8423 (define_insn_and_split "*fix_trunctfsi2_internal"
8424 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8425 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "d")))
8426 (clobber (match_operand:DF 2 "gpc_reg_operand" "=d"))
8427 (clobber (match_operand:DF 3 "gpc_reg_operand" "=&d"))
8428 (clobber (match_operand:DI 4 "gpc_reg_operand" "=d"))
8429 (clobber (match_operand:DI 5 "offsettable_mem_operand" "=o"))]
8431 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8437 emit_insn (gen_fix_trunc_helper (operands[2], operands[1], operands[3]));
8439 gcc_assert (MEM_P (operands[5]));
8440 lowword = adjust_address (operands[5], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
8442 emit_insn (gen_fctiwz_df (operands[4], operands[2]));
8443 emit_move_insn (operands[5], operands[4]);
8444 emit_move_insn (operands[0], lowword);
8448 (define_expand "negtf2"
8449 [(set (match_operand:TF 0 "gpc_reg_operand" "")
8450 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "")))]
8452 && TARGET_HARD_FLOAT
8453 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8454 && TARGET_LONG_DOUBLE_128"
8457 (define_insn "negtf2_internal"
8458 [(set (match_operand:TF 0 "gpc_reg_operand" "=d")
8459 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "d")))]
8461 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8464 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8465 return \"fneg %L0,%L1\;fneg %0,%1\";
8467 return \"fneg %0,%1\;fneg %L0,%L1\";
8469 [(set_attr "type" "fp")
8470 (set_attr "length" "8")])
8472 (define_expand "abstf2"
8473 [(set (match_operand:TF 0 "gpc_reg_operand" "")
8474 (abs:TF (match_operand:TF 1 "gpc_reg_operand" "")))]
8476 && TARGET_HARD_FLOAT
8477 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8478 && TARGET_LONG_DOUBLE_128"
8481 rtx label = gen_label_rtx ();
8482 if (TARGET_E500_DOUBLE)
8484 if (flag_finite_math_only && !flag_trapping_math)
8485 emit_insn (gen_spe_abstf2_tst (operands[0], operands[1], label));
8487 emit_insn (gen_spe_abstf2_cmp (operands[0], operands[1], label));
8490 emit_insn (gen_abstf2_internal (operands[0], operands[1], label));
8495 (define_expand "abstf2_internal"
8496 [(set (match_operand:TF 0 "gpc_reg_operand" "")
8497 (match_operand:TF 1 "gpc_reg_operand" ""))
8498 (set (match_dup 3) (match_dup 5))
8499 (set (match_dup 5) (abs:DF (match_dup 5)))
8500 (set (match_dup 4) (compare:CCFP (match_dup 3) (match_dup 5)))
8501 (set (pc) (if_then_else (eq (match_dup 4) (const_int 0))
8502 (label_ref (match_operand 2 "" ""))
8504 (set (match_dup 6) (neg:DF (match_dup 6)))]
8506 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
8507 && TARGET_LONG_DOUBLE_128"
8510 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
8511 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
8512 operands[3] = gen_reg_rtx (DFmode);
8513 operands[4] = gen_reg_rtx (CCFPmode);
8514 operands[5] = simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word);
8515 operands[6] = simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word);
8518 ;; Next come the multi-word integer load and store and the load and store
8521 ;; List r->r after r->Y, otherwise reload will try to reload a
8522 ;; non-offsettable address by using r->r which won't make progress.
8523 ;; Use of fprs is disparaged slightly otherwise reload prefers to reload
8524 ;; a gpr into a fpr instead of reloading an invalid 'Y' address
8525 (define_insn "*movdi_internal32"
8526 [(set (match_operand:DI 0 "rs6000_nonimmediate_operand" "=Y,r,r,?m,?*d,?*d,r,?wa")
8527 (match_operand:DI 1 "input_operand" "r,Y,r,d,m,d,IJKnGHF,O"))]
8529 && (gpc_reg_operand (operands[0], DImode)
8530 || gpc_reg_operand (operands[1], DImode))"
8540 [(set_attr "type" "store,load,*,fpstore,fpload,fp,*,vecsimple")])
8543 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8544 (match_operand:DI 1 "const_int_operand" ""))]
8545 "! TARGET_POWERPC64 && reload_completed
8546 && gpr_or_gpr_p (operands[0], operands[1])"
8547 [(set (match_dup 2) (match_dup 4))
8548 (set (match_dup 3) (match_dup 1))]
8551 HOST_WIDE_INT value = INTVAL (operands[1]);
8552 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
8554 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
8556 #if HOST_BITS_PER_WIDE_INT == 32
8557 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
8559 operands[4] = GEN_INT (value >> 32);
8560 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
8565 [(set (match_operand:DIFD 0 "rs6000_nonimmediate_operand" "")
8566 (match_operand:DIFD 1 "input_operand" ""))]
8567 "reload_completed && !TARGET_POWERPC64
8568 && gpr_or_gpr_p (operands[0], operands[1])"
8570 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
8572 (define_insn "*movdi_mfpgpr"
8573 [(set (match_operand:DI 0 "nonimmediate_operand" "=Y,r,r,r,r,r,?m,?*d,?*d,r,*h,*h,r,?*d")
8574 (match_operand:DI 1 "input_operand" "r,Y,r,I,L,nF,d,m,d,*h,r,0,*d,r"))]
8575 "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
8576 && (gpc_reg_operand (operands[0], DImode)
8577 || gpc_reg_operand (operands[1], DImode))"
8593 [(set_attr "type" "store,load,*,*,*,*,fpstore,fpload,fp,mfjmpr,mtjmpr,*,mftgpr,mffgpr")
8594 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4,4")])
8596 (define_insn "*movdi_internal64"
8597 [(set (match_operand:DI 0 "nonimmediate_operand" "=Y,r,r,r,r,r,?m,?*d,?*d,r,*h,*h,?wa")
8598 (match_operand:DI 1 "input_operand" "r,Y,r,I,L,nF,d,m,d,*h,r,0,O"))]
8599 "TARGET_POWERPC64 && (!TARGET_MFPGPR || !TARGET_HARD_FLOAT || !TARGET_FPRS)
8600 && (gpc_reg_operand (operands[0], DImode)
8601 || gpc_reg_operand (operands[1], DImode))"
8616 [(set_attr "type" "store,load,*,*,*,*,fpstore,fpload,fp,mfjmpr,mtjmpr,*,vecsimple")
8617 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4")])
8619 ;; immediate value valid for a single instruction hiding in a const_double
8621 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
8622 (match_operand:DI 1 "const_double_operand" "F"))]
8623 "HOST_BITS_PER_WIDE_INT == 32 && TARGET_POWERPC64
8624 && GET_CODE (operands[1]) == CONST_DOUBLE
8625 && num_insns_constant (operands[1], DImode) == 1"
8628 return ((unsigned HOST_WIDE_INT)
8629 (CONST_DOUBLE_LOW (operands[1]) + 0x8000) < 0x10000)
8630 ? \"li %0,%1\" : \"lis %0,%v1\";
8633 ;; Generate all one-bits and clear left or right.
8634 ;; Use (and:DI (rotate:DI ...)) to avoid anddi3 unnecessary clobber.
8636 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8637 (match_operand:DI 1 "mask64_operand" ""))]
8638 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
8639 [(set (match_dup 0) (const_int -1))
8641 (and:DI (rotate:DI (match_dup 0)
8646 ;; Split a load of a large constant into the appropriate five-instruction
8647 ;; sequence. Handle anything in a constant number of insns.
8648 ;; When non-easy constants can go in the TOC, this should use
8649 ;; easy_fp_constant predicate.
8651 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8652 (match_operand:DI 1 "const_int_operand" ""))]
8653 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
8654 [(set (match_dup 0) (match_dup 2))
8655 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
8657 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
8659 if (tem == operands[0])
8666 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8667 (match_operand:DI 1 "const_double_operand" ""))]
8668 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
8669 [(set (match_dup 0) (match_dup 2))
8670 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
8672 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
8674 if (tem == operands[0])
8680 ;; TImode is similar, except that we usually want to compute the address into
8681 ;; a register and use lsi/stsi (the exception is during reload).
8683 (define_insn "*movti_string"
8684 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,Y,????r,????r,????r,r")
8685 (match_operand:TI 1 "input_operand" "r,r,Q,Y,r,n"))]
8687 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
8690 switch (which_alternative)
8696 return \"stswi %1,%P0,16\";
8700 /* If the address is not used in the output, we can use lsi. Otherwise,
8701 fall through to generating four loads. */
8703 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
8704 return \"lswi %0,%P1,16\";
8705 /* ... fall through ... */
8712 [(set_attr "type" "store_ux,store_ux,load_ux,load_ux,*,*")
8713 (set (attr "cell_micro") (if_then_else (match_test "TARGET_STRING")
8714 (const_string "always")
8715 (const_string "conditional")))])
8717 (define_insn "*movti_ppc64"
8718 [(set (match_operand:TI 0 "nonimmediate_operand" "=Y,r,r")
8719 (match_operand:TI 1 "input_operand" "r,Y,r"))]
8720 "(TARGET_POWERPC64 && (gpc_reg_operand (operands[0], TImode)
8721 || gpc_reg_operand (operands[1], TImode)))
8722 && VECTOR_MEM_NONE_P (TImode)"
8724 [(set_attr "type" "store,load,*")])
8727 [(set (match_operand:TI 0 "gpc_reg_operand" "")
8728 (match_operand:TI 1 "const_double_operand" ""))]
8729 "TARGET_POWERPC64 && VECTOR_MEM_NONE_P (TImode)"
8730 [(set (match_dup 2) (match_dup 4))
8731 (set (match_dup 3) (match_dup 5))]
8734 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
8736 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
8738 if (GET_CODE (operands[1]) == CONST_DOUBLE)
8740 operands[4] = GEN_INT (CONST_DOUBLE_HIGH (operands[1]));
8741 operands[5] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
8743 else if (GET_CODE (operands[1]) == CONST_INT)
8745 operands[4] = GEN_INT (- (INTVAL (operands[1]) < 0));
8746 operands[5] = operands[1];
8753 [(set (match_operand:TI 0 "nonimmediate_operand" "")
8754 (match_operand:TI 1 "input_operand" ""))]
8755 "reload_completed && VECTOR_MEM_NONE_P (TImode)
8756 && gpr_or_gpr_p (operands[0], operands[1])"
8758 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
8760 (define_expand "load_multiple"
8761 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
8762 (match_operand:SI 1 "" ""))
8763 (use (match_operand:SI 2 "" ""))])]
8764 "TARGET_STRING && !TARGET_POWERPC64"
8772 /* Support only loading a constant number of fixed-point registers from
8773 memory and only bother with this if more than two; the machine
8774 doesn't support more than eight. */
8775 if (GET_CODE (operands[2]) != CONST_INT
8776 || INTVAL (operands[2]) <= 2
8777 || INTVAL (operands[2]) > 8
8778 || GET_CODE (operands[1]) != MEM
8779 || GET_CODE (operands[0]) != REG
8780 || REGNO (operands[0]) >= 32)
8783 count = INTVAL (operands[2]);
8784 regno = REGNO (operands[0]);
8786 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
8787 op1 = replace_equiv_address (operands[1],
8788 force_reg (SImode, XEXP (operands[1], 0)));
8790 for (i = 0; i < count; i++)
8791 XVECEXP (operands[3], 0, i)
8792 = gen_rtx_SET (VOIDmode, gen_rtx_REG (SImode, regno + i),
8793 adjust_address_nv (op1, SImode, i * 4));
8796 (define_insn "*ldmsi8"
8797 [(match_parallel 0 "load_multiple_operation"
8798 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8799 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8800 (set (match_operand:SI 3 "gpc_reg_operand" "")
8801 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8802 (set (match_operand:SI 4 "gpc_reg_operand" "")
8803 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8804 (set (match_operand:SI 5 "gpc_reg_operand" "")
8805 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8806 (set (match_operand:SI 6 "gpc_reg_operand" "")
8807 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
8808 (set (match_operand:SI 7 "gpc_reg_operand" "")
8809 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
8810 (set (match_operand:SI 8 "gpc_reg_operand" "")
8811 (mem:SI (plus:SI (match_dup 1) (const_int 24))))
8812 (set (match_operand:SI 9 "gpc_reg_operand" "")
8813 (mem:SI (plus:SI (match_dup 1) (const_int 28))))])]
8814 "TARGET_STRING && XVECLEN (operands[0], 0) == 8"
8816 { return rs6000_output_load_multiple (operands); }"
8817 [(set_attr "type" "load_ux")
8818 (set_attr "length" "32")])
8820 (define_insn "*ldmsi7"
8821 [(match_parallel 0 "load_multiple_operation"
8822 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8823 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8824 (set (match_operand:SI 3 "gpc_reg_operand" "")
8825 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8826 (set (match_operand:SI 4 "gpc_reg_operand" "")
8827 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8828 (set (match_operand:SI 5 "gpc_reg_operand" "")
8829 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8830 (set (match_operand:SI 6 "gpc_reg_operand" "")
8831 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
8832 (set (match_operand:SI 7 "gpc_reg_operand" "")
8833 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
8834 (set (match_operand:SI 8 "gpc_reg_operand" "")
8835 (mem:SI (plus:SI (match_dup 1) (const_int 24))))])]
8836 "TARGET_STRING && XVECLEN (operands[0], 0) == 7"
8838 { return rs6000_output_load_multiple (operands); }"
8839 [(set_attr "type" "load_ux")
8840 (set_attr "length" "32")])
8842 (define_insn "*ldmsi6"
8843 [(match_parallel 0 "load_multiple_operation"
8844 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8845 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8846 (set (match_operand:SI 3 "gpc_reg_operand" "")
8847 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8848 (set (match_operand:SI 4 "gpc_reg_operand" "")
8849 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8850 (set (match_operand:SI 5 "gpc_reg_operand" "")
8851 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8852 (set (match_operand:SI 6 "gpc_reg_operand" "")
8853 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
8854 (set (match_operand:SI 7 "gpc_reg_operand" "")
8855 (mem:SI (plus:SI (match_dup 1) (const_int 20))))])]
8856 "TARGET_STRING && XVECLEN (operands[0], 0) == 6"
8858 { return rs6000_output_load_multiple (operands); }"
8859 [(set_attr "type" "load_ux")
8860 (set_attr "length" "32")])
8862 (define_insn "*ldmsi5"
8863 [(match_parallel 0 "load_multiple_operation"
8864 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8865 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8866 (set (match_operand:SI 3 "gpc_reg_operand" "")
8867 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8868 (set (match_operand:SI 4 "gpc_reg_operand" "")
8869 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8870 (set (match_operand:SI 5 "gpc_reg_operand" "")
8871 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8872 (set (match_operand:SI 6 "gpc_reg_operand" "")
8873 (mem:SI (plus:SI (match_dup 1) (const_int 16))))])]
8874 "TARGET_STRING && XVECLEN (operands[0], 0) == 5"
8876 { return rs6000_output_load_multiple (operands); }"
8877 [(set_attr "type" "load_ux")
8878 (set_attr "length" "32")])
8880 (define_insn "*ldmsi4"
8881 [(match_parallel 0 "load_multiple_operation"
8882 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8883 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8884 (set (match_operand:SI 3 "gpc_reg_operand" "")
8885 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8886 (set (match_operand:SI 4 "gpc_reg_operand" "")
8887 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8888 (set (match_operand:SI 5 "gpc_reg_operand" "")
8889 (mem:SI (plus:SI (match_dup 1) (const_int 12))))])]
8890 "TARGET_STRING && XVECLEN (operands[0], 0) == 4"
8892 { return rs6000_output_load_multiple (operands); }"
8893 [(set_attr "type" "load_ux")
8894 (set_attr "length" "32")])
8896 (define_insn "*ldmsi3"
8897 [(match_parallel 0 "load_multiple_operation"
8898 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8899 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8900 (set (match_operand:SI 3 "gpc_reg_operand" "")
8901 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8902 (set (match_operand:SI 4 "gpc_reg_operand" "")
8903 (mem:SI (plus:SI (match_dup 1) (const_int 8))))])]
8904 "TARGET_STRING && XVECLEN (operands[0], 0) == 3"
8906 { return rs6000_output_load_multiple (operands); }"
8907 [(set_attr "type" "load_ux")
8908 (set_attr "length" "32")])
8910 (define_expand "store_multiple"
8911 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
8912 (match_operand:SI 1 "" ""))
8913 (clobber (scratch:SI))
8914 (use (match_operand:SI 2 "" ""))])]
8915 "TARGET_STRING && !TARGET_POWERPC64"
8924 /* Support only storing a constant number of fixed-point registers to
8925 memory and only bother with this if more than two; the machine
8926 doesn't support more than eight. */
8927 if (GET_CODE (operands[2]) != CONST_INT
8928 || INTVAL (operands[2]) <= 2
8929 || INTVAL (operands[2]) > 8
8930 || GET_CODE (operands[0]) != MEM
8931 || GET_CODE (operands[1]) != REG
8932 || REGNO (operands[1]) >= 32)
8935 count = INTVAL (operands[2]);
8936 regno = REGNO (operands[1]);
8938 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count + 1));
8939 to = force_reg (SImode, XEXP (operands[0], 0));
8940 op0 = replace_equiv_address (operands[0], to);
8942 XVECEXP (operands[3], 0, 0)
8943 = gen_rtx_SET (VOIDmode, adjust_address_nv (op0, SImode, 0), operands[1]);
8944 XVECEXP (operands[3], 0, 1) = gen_rtx_CLOBBER (VOIDmode,
8945 gen_rtx_SCRATCH (SImode));
8947 for (i = 1; i < count; i++)
8948 XVECEXP (operands[3], 0, i + 1)
8949 = gen_rtx_SET (VOIDmode,
8950 adjust_address_nv (op0, SImode, i * 4),
8951 gen_rtx_REG (SImode, regno + i));
8954 (define_insn "*stmsi8"
8955 [(match_parallel 0 "store_multiple_operation"
8956 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
8957 (match_operand:SI 2 "gpc_reg_operand" "r"))
8958 (clobber (match_scratch:SI 3 "=X"))
8959 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
8960 (match_operand:SI 4 "gpc_reg_operand" "r"))
8961 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
8962 (match_operand:SI 5 "gpc_reg_operand" "r"))
8963 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
8964 (match_operand:SI 6 "gpc_reg_operand" "r"))
8965 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
8966 (match_operand:SI 7 "gpc_reg_operand" "r"))
8967 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
8968 (match_operand:SI 8 "gpc_reg_operand" "r"))
8969 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
8970 (match_operand:SI 9 "gpc_reg_operand" "r"))
8971 (set (mem:SI (plus:SI (match_dup 1) (const_int 28)))
8972 (match_operand:SI 10 "gpc_reg_operand" "r"))])]
8973 "TARGET_STRING && XVECLEN (operands[0], 0) == 9"
8975 [(set_attr "type" "store_ux")
8976 (set_attr "cell_micro" "always")])
8978 (define_insn "*stmsi7"
8979 [(match_parallel 0 "store_multiple_operation"
8980 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
8981 (match_operand:SI 2 "gpc_reg_operand" "r"))
8982 (clobber (match_scratch:SI 3 "=X"))
8983 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
8984 (match_operand:SI 4 "gpc_reg_operand" "r"))
8985 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
8986 (match_operand:SI 5 "gpc_reg_operand" "r"))
8987 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
8988 (match_operand:SI 6 "gpc_reg_operand" "r"))
8989 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
8990 (match_operand:SI 7 "gpc_reg_operand" "r"))
8991 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
8992 (match_operand:SI 8 "gpc_reg_operand" "r"))
8993 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
8994 (match_operand:SI 9 "gpc_reg_operand" "r"))])]
8995 "TARGET_STRING && XVECLEN (operands[0], 0) == 8"
8997 [(set_attr "type" "store_ux")
8998 (set_attr "cell_micro" "always")])
9000 (define_insn "*stmsi6"
9001 [(match_parallel 0 "store_multiple_operation"
9002 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9003 (match_operand:SI 2 "gpc_reg_operand" "r"))
9004 (clobber (match_scratch:SI 3 "=X"))
9005 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9006 (match_operand:SI 4 "gpc_reg_operand" "r"))
9007 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9008 (match_operand:SI 5 "gpc_reg_operand" "r"))
9009 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9010 (match_operand:SI 6 "gpc_reg_operand" "r"))
9011 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9012 (match_operand:SI 7 "gpc_reg_operand" "r"))
9013 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9014 (match_operand:SI 8 "gpc_reg_operand" "r"))])]
9015 "TARGET_STRING && XVECLEN (operands[0], 0) == 7"
9017 [(set_attr "type" "store_ux")
9018 (set_attr "cell_micro" "always")])
9020 (define_insn "*stmsi5"
9021 [(match_parallel 0 "store_multiple_operation"
9022 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9023 (match_operand:SI 2 "gpc_reg_operand" "r"))
9024 (clobber (match_scratch:SI 3 "=X"))
9025 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9026 (match_operand:SI 4 "gpc_reg_operand" "r"))
9027 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9028 (match_operand:SI 5 "gpc_reg_operand" "r"))
9029 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9030 (match_operand:SI 6 "gpc_reg_operand" "r"))
9031 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9032 (match_operand:SI 7 "gpc_reg_operand" "r"))])]
9033 "TARGET_STRING && XVECLEN (operands[0], 0) == 6"
9035 [(set_attr "type" "store_ux")
9036 (set_attr "cell_micro" "always")])
9038 (define_insn "*stmsi4"
9039 [(match_parallel 0 "store_multiple_operation"
9040 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9041 (match_operand:SI 2 "gpc_reg_operand" "r"))
9042 (clobber (match_scratch:SI 3 "=X"))
9043 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9044 (match_operand:SI 4 "gpc_reg_operand" "r"))
9045 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9046 (match_operand:SI 5 "gpc_reg_operand" "r"))
9047 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9048 (match_operand:SI 6 "gpc_reg_operand" "r"))])]
9049 "TARGET_STRING && XVECLEN (operands[0], 0) == 5"
9051 [(set_attr "type" "store_ux")
9052 (set_attr "cell_micro" "always")])
9054 (define_insn "*stmsi3"
9055 [(match_parallel 0 "store_multiple_operation"
9056 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9057 (match_operand:SI 2 "gpc_reg_operand" "r"))
9058 (clobber (match_scratch:SI 3 "=X"))
9059 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9060 (match_operand:SI 4 "gpc_reg_operand" "r"))
9061 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9062 (match_operand:SI 5 "gpc_reg_operand" "r"))])]
9063 "TARGET_STRING && XVECLEN (operands[0], 0) == 4"
9065 [(set_attr "type" "store_ux")
9066 (set_attr "cell_micro" "always")])
9068 (define_expand "setmemsi"
9069 [(parallel [(set (match_operand:BLK 0 "" "")
9070 (match_operand 2 "const_int_operand" ""))
9071 (use (match_operand:SI 1 "" ""))
9072 (use (match_operand:SI 3 "" ""))])]
9076 /* If value to set is not zero, use the library routine. */
9077 if (operands[2] != const0_rtx)
9080 if (expand_block_clear (operands))
9086 ;; String/block move insn.
9087 ;; Argument 0 is the destination
9088 ;; Argument 1 is the source
9089 ;; Argument 2 is the length
9090 ;; Argument 3 is the alignment
9092 (define_expand "movmemsi"
9093 [(parallel [(set (match_operand:BLK 0 "" "")
9094 (match_operand:BLK 1 "" ""))
9095 (use (match_operand:SI 2 "" ""))
9096 (use (match_operand:SI 3 "" ""))])]
9100 if (expand_block_move (operands))
9106 ;; Move up to 32 bytes at a time. The fixed registers are needed because the
9107 ;; register allocator doesn't have a clue about allocating 8 word registers.
9108 ;; rD/rS = r5 is preferred, efficient form.
9109 (define_expand "movmemsi_8reg"
9110 [(parallel [(set (match_operand 0 "" "")
9111 (match_operand 1 "" ""))
9112 (use (match_operand 2 "" ""))
9113 (use (match_operand 3 "" ""))
9114 (clobber (reg:SI 5))
9115 (clobber (reg:SI 6))
9116 (clobber (reg:SI 7))
9117 (clobber (reg:SI 8))
9118 (clobber (reg:SI 9))
9119 (clobber (reg:SI 10))
9120 (clobber (reg:SI 11))
9121 (clobber (reg:SI 12))
9122 (clobber (match_scratch:SI 4 ""))])]
9127 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
9128 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
9129 (use (match_operand:SI 2 "immediate_operand" "i"))
9130 (use (match_operand:SI 3 "immediate_operand" "i"))
9131 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
9132 (clobber (reg:SI 6))
9133 (clobber (reg:SI 7))
9134 (clobber (reg:SI 8))
9135 (clobber (reg:SI 9))
9136 (clobber (reg:SI 10))
9137 (clobber (reg:SI 11))
9138 (clobber (reg:SI 12))
9139 (clobber (match_scratch:SI 5 "=X"))]
9141 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
9142 || INTVAL (operands[2]) == 0)
9143 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
9144 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
9145 && REGNO (operands[4]) == 5"
9146 "lswi %4,%1,%2\;stswi %4,%0,%2"
9147 [(set_attr "type" "store_ux")
9148 (set_attr "cell_micro" "always")
9149 (set_attr "length" "8")])
9151 ;; Move up to 24 bytes at a time. The fixed registers are needed because the
9152 ;; register allocator doesn't have a clue about allocating 6 word registers.
9153 ;; rD/rS = r5 is preferred, efficient form.
9154 (define_expand "movmemsi_6reg"
9155 [(parallel [(set (match_operand 0 "" "")
9156 (match_operand 1 "" ""))
9157 (use (match_operand 2 "" ""))
9158 (use (match_operand 3 "" ""))
9159 (clobber (reg:SI 5))
9160 (clobber (reg:SI 6))
9161 (clobber (reg:SI 7))
9162 (clobber (reg:SI 8))
9163 (clobber (reg:SI 9))
9164 (clobber (reg:SI 10))
9165 (clobber (match_scratch:SI 4 ""))])]
9170 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
9171 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
9172 (use (match_operand:SI 2 "immediate_operand" "i"))
9173 (use (match_operand:SI 3 "immediate_operand" "i"))
9174 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
9175 (clobber (reg:SI 6))
9176 (clobber (reg:SI 7))
9177 (clobber (reg:SI 8))
9178 (clobber (reg:SI 9))
9179 (clobber (reg:SI 10))
9180 (clobber (match_scratch:SI 5 "=X"))]
9182 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
9183 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
9184 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
9185 && REGNO (operands[4]) == 5"
9186 "lswi %4,%1,%2\;stswi %4,%0,%2"
9187 [(set_attr "type" "store_ux")
9188 (set_attr "cell_micro" "always")
9189 (set_attr "length" "8")])
9191 ;; Move up to 16 bytes at a time, using 4 fixed registers to avoid spill
9192 ;; problems with TImode.
9193 ;; rD/rS = r5 is preferred, efficient form.
9194 (define_expand "movmemsi_4reg"
9195 [(parallel [(set (match_operand 0 "" "")
9196 (match_operand 1 "" ""))
9197 (use (match_operand 2 "" ""))
9198 (use (match_operand 3 "" ""))
9199 (clobber (reg:SI 5))
9200 (clobber (reg:SI 6))
9201 (clobber (reg:SI 7))
9202 (clobber (reg:SI 8))
9203 (clobber (match_scratch:SI 4 ""))])]
9208 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
9209 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
9210 (use (match_operand:SI 2 "immediate_operand" "i"))
9211 (use (match_operand:SI 3 "immediate_operand" "i"))
9212 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
9213 (clobber (reg:SI 6))
9214 (clobber (reg:SI 7))
9215 (clobber (reg:SI 8))
9216 (clobber (match_scratch:SI 5 "=X"))]
9218 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
9219 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
9220 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
9221 && REGNO (operands[4]) == 5"
9222 "lswi %4,%1,%2\;stswi %4,%0,%2"
9223 [(set_attr "type" "store_ux")
9224 (set_attr "cell_micro" "always")
9225 (set_attr "length" "8")])
9227 ;; Move up to 8 bytes at a time.
9228 (define_expand "movmemsi_2reg"
9229 [(parallel [(set (match_operand 0 "" "")
9230 (match_operand 1 "" ""))
9231 (use (match_operand 2 "" ""))
9232 (use (match_operand 3 "" ""))
9233 (clobber (match_scratch:DI 4 ""))
9234 (clobber (match_scratch:SI 5 ""))])]
9235 "TARGET_STRING && ! TARGET_POWERPC64"
9239 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9240 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9241 (use (match_operand:SI 2 "immediate_operand" "i"))
9242 (use (match_operand:SI 3 "immediate_operand" "i"))
9243 (clobber (match_scratch:DI 4 "=&r"))
9244 (clobber (match_scratch:SI 5 "=X"))]
9245 "TARGET_STRING && ! TARGET_POWERPC64
9246 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
9247 "lswi %4,%1,%2\;stswi %4,%0,%2"
9248 [(set_attr "type" "store_ux")
9249 (set_attr "cell_micro" "always")
9250 (set_attr "length" "8")])
9252 ;; Move up to 4 bytes at a time.
9253 (define_expand "movmemsi_1reg"
9254 [(parallel [(set (match_operand 0 "" "")
9255 (match_operand 1 "" ""))
9256 (use (match_operand 2 "" ""))
9257 (use (match_operand 3 "" ""))
9258 (clobber (match_scratch:SI 4 ""))
9259 (clobber (match_scratch:SI 5 ""))])]
9264 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
9265 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
9266 (use (match_operand:SI 2 "immediate_operand" "i"))
9267 (use (match_operand:SI 3 "immediate_operand" "i"))
9268 (clobber (match_scratch:SI 4 "=&r"))
9269 (clobber (match_scratch:SI 5 "=X"))]
9270 "TARGET_STRING && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
9271 "lswi %4,%1,%2\;stswi %4,%0,%2"
9272 [(set_attr "type" "store_ux")
9273 (set_attr "cell_micro" "always")
9274 (set_attr "length" "8")])
9276 ;; Define insns that do load or store with update. Some of these we can
9277 ;; get by using pre-decrement or pre-increment, but the hardware can also
9278 ;; do cases where the increment is not the size of the object.
9280 ;; In all these cases, we use operands 0 and 1 for the register being
9281 ;; incremented because those are the operands that local-alloc will
9282 ;; tie and these are the pair most likely to be tieable (and the ones
9283 ;; that will benefit the most).
9285 (define_insn "*movdi_update1"
9286 [(set (match_operand:DI 3 "gpc_reg_operand" "=r,r")
9287 (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
9288 (match_operand:DI 2 "reg_or_aligned_short_operand" "r,I"))))
9289 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
9290 (plus:DI (match_dup 1) (match_dup 2)))]
9291 "TARGET_POWERPC64 && TARGET_UPDATE
9292 && (!avoiding_indexed_address_p (DImode)
9293 || !gpc_reg_operand (operands[2], DImode))"
9297 [(set_attr "type" "load_ux,load_u")])
9299 (define_insn "movdi_<mode>_update"
9300 [(set (mem:DI (plus:P (match_operand:P 1 "gpc_reg_operand" "0,0")
9301 (match_operand:P 2 "reg_or_aligned_short_operand" "r,I")))
9302 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
9303 (set (match_operand:P 0 "gpc_reg_operand" "=b,b")
9304 (plus:P (match_dup 1) (match_dup 2)))]
9305 "TARGET_POWERPC64 && TARGET_UPDATE
9306 && (!avoiding_indexed_address_p (Pmode)
9307 || !gpc_reg_operand (operands[2], Pmode)
9308 || (REG_P (operands[0])
9309 && REGNO (operands[0]) == STACK_POINTER_REGNUM))"
9313 [(set_attr "type" "store_ux,store_u")])
9315 ;; This pattern is only conditional on TARGET_POWERPC64, as it is
9316 ;; needed for stack allocation, even if the user passes -mno-update.
9317 (define_insn "movdi_<mode>_update_stack"
9318 [(set (mem:DI (plus:P (match_operand:P 1 "gpc_reg_operand" "0,0")
9319 (match_operand:P 2 "reg_or_aligned_short_operand" "r,I")))
9320 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
9321 (set (match_operand:P 0 "gpc_reg_operand" "=b,b")
9322 (plus:P (match_dup 1) (match_dup 2)))]
9327 [(set_attr "type" "store_ux,store_u")])
9329 (define_insn "*movsi_update1"
9330 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9331 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9332 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9333 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9334 (plus:SI (match_dup 1) (match_dup 2)))]
9336 && (!avoiding_indexed_address_p (SImode)
9337 || !gpc_reg_operand (operands[2], SImode))"
9341 [(set_attr "type" "load_ux,load_u")])
9343 (define_insn "*movsi_update2"
9344 [(set (match_operand:DI 3 "gpc_reg_operand" "=r")
9346 (mem:SI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0")
9347 (match_operand:DI 2 "gpc_reg_operand" "r")))))
9348 (set (match_operand:DI 0 "gpc_reg_operand" "=b")
9349 (plus:DI (match_dup 1) (match_dup 2)))]
9350 "TARGET_POWERPC64 && rs6000_gen_cell_microcode
9351 && !avoiding_indexed_address_p (DImode)"
9353 [(set_attr "type" "load_ext_ux")])
9355 (define_insn "movsi_update"
9356 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9357 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9358 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
9359 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9360 (plus:SI (match_dup 1) (match_dup 2)))]
9362 && (!avoiding_indexed_address_p (SImode)
9363 || !gpc_reg_operand (operands[2], SImode)
9364 || (REG_P (operands[0])
9365 && REGNO (operands[0]) == STACK_POINTER_REGNUM))"
9369 [(set_attr "type" "store_ux,store_u")])
9371 ;; This is an unconditional pattern; needed for stack allocation, even
9372 ;; if the user passes -mno-update.
9373 (define_insn "movsi_update_stack"
9374 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9375 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9376 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
9377 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9378 (plus:SI (match_dup 1) (match_dup 2)))]
9383 [(set_attr "type" "store_ux,store_u")])
9385 (define_insn "*movhi_update1"
9386 [(set (match_operand:HI 3 "gpc_reg_operand" "=r,r")
9387 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9388 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9389 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9390 (plus:SI (match_dup 1) (match_dup 2)))]
9392 && (!avoiding_indexed_address_p (SImode)
9393 || !gpc_reg_operand (operands[2], SImode))"
9397 [(set_attr "type" "load_ux,load_u")])
9399 (define_insn "*movhi_update2"
9400 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9402 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9403 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9404 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9405 (plus:SI (match_dup 1) (match_dup 2)))]
9407 && (!avoiding_indexed_address_p (SImode)
9408 || !gpc_reg_operand (operands[2], SImode))"
9412 [(set_attr "type" "load_ux,load_u")])
9414 (define_insn "*movhi_update3"
9415 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9417 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9418 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9419 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9420 (plus:SI (match_dup 1) (match_dup 2)))]
9421 "TARGET_UPDATE && rs6000_gen_cell_microcode
9422 && (!avoiding_indexed_address_p (SImode)
9423 || !gpc_reg_operand (operands[2], SImode))"
9427 [(set_attr "type" "load_ext_ux,load_ext_u")])
9429 (define_insn "*movhi_update4"
9430 [(set (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9431 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9432 (match_operand:HI 3 "gpc_reg_operand" "r,r"))
9433 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9434 (plus:SI (match_dup 1) (match_dup 2)))]
9436 && (!avoiding_indexed_address_p (SImode)
9437 || !gpc_reg_operand (operands[2], SImode))"
9441 [(set_attr "type" "store_ux,store_u")])
9443 (define_insn "*movqi_update1"
9444 [(set (match_operand:QI 3 "gpc_reg_operand" "=r,r")
9445 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9446 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9447 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9448 (plus:SI (match_dup 1) (match_dup 2)))]
9450 && (!avoiding_indexed_address_p (SImode)
9451 || !gpc_reg_operand (operands[2], SImode))"
9455 [(set_attr "type" "load_ux,load_u")])
9457 (define_insn "*movqi_update2"
9458 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9460 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9461 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9462 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9463 (plus:SI (match_dup 1) (match_dup 2)))]
9465 && (!avoiding_indexed_address_p (SImode)
9466 || !gpc_reg_operand (operands[2], SImode))"
9470 [(set_attr "type" "load_ux,load_u")])
9472 (define_insn "*movqi_update3"
9473 [(set (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9474 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9475 (match_operand:QI 3 "gpc_reg_operand" "r,r"))
9476 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9477 (plus:SI (match_dup 1) (match_dup 2)))]
9479 && (!avoiding_indexed_address_p (SImode)
9480 || !gpc_reg_operand (operands[2], SImode))"
9484 [(set_attr "type" "store_ux,store_u")])
9486 (define_insn "*movsf_update1"
9487 [(set (match_operand:SF 3 "gpc_reg_operand" "=f,f")
9488 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9489 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9490 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9491 (plus:SI (match_dup 1) (match_dup 2)))]
9492 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT && TARGET_UPDATE
9493 && (!avoiding_indexed_address_p (SImode)
9494 || !gpc_reg_operand (operands[2], SImode))"
9498 [(set_attr "type" "fpload_ux,fpload_u")])
9500 (define_insn "*movsf_update2"
9501 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9502 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9503 (match_operand:SF 3 "gpc_reg_operand" "f,f"))
9504 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9505 (plus:SI (match_dup 1) (match_dup 2)))]
9506 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT && TARGET_UPDATE
9507 && (!avoiding_indexed_address_p (SImode)
9508 || !gpc_reg_operand (operands[2], SImode))"
9512 [(set_attr "type" "fpstore_ux,fpstore_u")])
9514 (define_insn "*movsf_update3"
9515 [(set (match_operand:SF 3 "gpc_reg_operand" "=r,r")
9516 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9517 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9518 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9519 (plus:SI (match_dup 1) (match_dup 2)))]
9520 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE
9521 && (!avoiding_indexed_address_p (SImode)
9522 || !gpc_reg_operand (operands[2], SImode))"
9526 [(set_attr "type" "load_ux,load_u")])
9528 (define_insn "*movsf_update4"
9529 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9530 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9531 (match_operand:SF 3 "gpc_reg_operand" "r,r"))
9532 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9533 (plus:SI (match_dup 1) (match_dup 2)))]
9534 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE
9535 && (!avoiding_indexed_address_p (SImode)
9536 || !gpc_reg_operand (operands[2], SImode))"
9540 [(set_attr "type" "store_ux,store_u")])
9542 (define_insn "*movdf_update1"
9543 [(set (match_operand:DF 3 "gpc_reg_operand" "=d,d")
9544 (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9545 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9546 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9547 (plus:SI (match_dup 1) (match_dup 2)))]
9548 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_UPDATE
9549 && (!avoiding_indexed_address_p (SImode)
9550 || !gpc_reg_operand (operands[2], SImode))"
9554 [(set_attr "type" "fpload_ux,fpload_u")])
9556 (define_insn "*movdf_update2"
9557 [(set (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9558 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9559 (match_operand:DF 3 "gpc_reg_operand" "d,d"))
9560 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9561 (plus:SI (match_dup 1) (match_dup 2)))]
9562 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_UPDATE
9563 && (!avoiding_indexed_address_p (SImode)
9564 || !gpc_reg_operand (operands[2], SImode))"
9568 [(set_attr "type" "fpstore_ux,fpstore_u")])
9571 ;; After inserting conditional returns we can sometimes have
9572 ;; unnecessary register moves. Unfortunately we cannot have a
9573 ;; modeless peephole here, because some single SImode sets have early
9574 ;; clobber outputs. Although those sets expand to multi-ppc-insn
9575 ;; sequences, using get_attr_length here will smash the operands
9576 ;; array. Neither is there an early_cobbler_p predicate.
9577 ;; Disallow subregs for E500 so we don't munge frob_di_df_2.
9579 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9580 (match_operand:DF 1 "any_operand" ""))
9581 (set (match_operand:DF 2 "gpc_reg_operand" "")
9583 "!(TARGET_E500_DOUBLE && GET_CODE (operands[2]) == SUBREG)
9584 && peep2_reg_dead_p (2, operands[0])"
9585 [(set (match_dup 2) (match_dup 1))])
9588 [(set (match_operand:SF 0 "gpc_reg_operand" "")
9589 (match_operand:SF 1 "any_operand" ""))
9590 (set (match_operand:SF 2 "gpc_reg_operand" "")
9592 "peep2_reg_dead_p (2, operands[0])"
9593 [(set (match_dup 2) (match_dup 1))])
9598 ;; Mode attributes for different ABIs.
9599 (define_mode_iterator TLSmode [(SI "! TARGET_64BIT") (DI "TARGET_64BIT")])
9600 (define_mode_attr tls_abi_suffix [(SI "32") (DI "64")])
9601 (define_mode_attr tls_sysv_suffix [(SI "si") (DI "di")])
9602 (define_mode_attr tls_insn_suffix [(SI "wz") (DI "d")])
9604 (define_insn_and_split "tls_gd_aix<TLSmode:tls_abi_suffix>"
9605 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
9606 (call (mem:TLSmode (match_operand:TLSmode 3 "symbol_ref_operand" "s"))
9607 (match_operand 4 "" "g")))
9608 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
9609 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
9611 (clobber (reg:SI LR_REGNO))]
9612 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX"
9614 if (TARGET_CMODEL != CMODEL_SMALL)
9615 return "addis %0,%1,%2@got@tlsgd@ha\;addi %0,%0,%2@got@tlsgd@l\;"
9618 return "addi %0,%1,%2@got@tlsgd\;bl %z3\;nop";
9620 "&& TARGET_TLS_MARKERS"
9622 (unspec:TLSmode [(match_dup 1)
9625 (parallel [(set (match_dup 0)
9626 (call (mem:TLSmode (match_dup 3))
9628 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD)
9629 (clobber (reg:SI LR_REGNO))])]
9631 [(set_attr "type" "two")
9632 (set (attr "length")
9633 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
9637 (define_insn_and_split "tls_gd_sysv<TLSmode:tls_sysv_suffix>"
9638 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
9639 (call (mem:TLSmode (match_operand:TLSmode 3 "symbol_ref_operand" "s"))
9640 (match_operand 4 "" "g")))
9641 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
9642 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
9644 (clobber (reg:SI LR_REGNO))]
9645 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4"
9649 if (TARGET_SECURE_PLT && flag_pic == 2)
9650 return "addi %0,%1,%2@got@tlsgd\;bl %z3+32768@plt";
9652 return "addi %0,%1,%2@got@tlsgd\;bl %z3@plt";
9655 return "addi %0,%1,%2@got@tlsgd\;bl %z3";
9657 "&& TARGET_TLS_MARKERS"
9659 (unspec:TLSmode [(match_dup 1)
9662 (parallel [(set (match_dup 0)
9663 (call (mem:TLSmode (match_dup 3))
9665 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD)
9666 (clobber (reg:SI LR_REGNO))])]
9668 [(set_attr "type" "two")
9669 (set_attr "length" "8")])
9671 (define_insn_and_split "*tls_gd<TLSmode:tls_abi_suffix>"
9672 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
9673 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
9674 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
9676 "HAVE_AS_TLS && TARGET_TLS_MARKERS"
9677 "addi %0,%1,%2@got@tlsgd"
9678 "&& TARGET_CMODEL != CMODEL_SMALL"
9681 (unspec:TLSmode [(match_dup 1) (match_dup 2)] UNSPEC_TLSGD)))
9683 (lo_sum:TLSmode (match_dup 3)
9684 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD)))]
9687 operands[3] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
9689 [(set (attr "length")
9690 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
9694 (define_insn "*tls_gd_high<TLSmode:tls_abi_suffix>"
9695 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
9697 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
9698 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
9700 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
9701 "addis %0,%1,%2@got@tlsgd@ha"
9702 [(set_attr "length" "4")])
9704 (define_insn "*tls_gd_low<TLSmode:tls_abi_suffix>"
9705 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
9706 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
9707 (unspec:TLSmode [(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
9709 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
9710 "addi %0,%1,%2@got@tlsgd@l"
9711 [(set_attr "length" "4")])
9713 (define_insn "*tls_gd_call_aix<TLSmode:tls_abi_suffix>"
9714 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
9715 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
9716 (match_operand 2 "" "g")))
9717 (unspec:TLSmode [(match_operand:TLSmode 3 "rs6000_tls_symbol_ref" "")]
9719 (clobber (reg:SI LR_REGNO))]
9720 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX && TARGET_TLS_MARKERS"
9721 "bl %z1(%3@tlsgd)\;nop"
9722 [(set_attr "type" "branch")
9723 (set_attr "length" "8")])
9725 (define_insn "*tls_gd_call_sysv<TLSmode:tls_abi_suffix>"
9726 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
9727 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
9728 (match_operand 2 "" "g")))
9729 (unspec:TLSmode [(match_operand:TLSmode 3 "rs6000_tls_symbol_ref" "")]
9731 (clobber (reg:SI LR_REGNO))]
9732 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4 && TARGET_TLS_MARKERS"
9736 if (TARGET_SECURE_PLT && flag_pic == 2)
9737 return "bl %z1+32768(%3@tlsgd)@plt";
9738 return "bl %z1(%3@tlsgd)@plt";
9740 return "bl %z1(%3@tlsgd)";
9742 [(set_attr "type" "branch")
9743 (set_attr "length" "4")])
9745 (define_insn_and_split "tls_ld_aix<TLSmode:tls_abi_suffix>"
9746 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
9747 (call (mem:TLSmode (match_operand:TLSmode 2 "symbol_ref_operand" "s"))
9748 (match_operand 3 "" "g")))
9749 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
9751 (clobber (reg:SI LR_REGNO))]
9752 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX"
9754 if (TARGET_CMODEL != CMODEL_SMALL)
9755 return "addis %0,%1,%&@got@tlsld@ha\;addi %0,%0,%&@got@tlsld@l\;"
9758 return "addi %0,%1,%&@got@tlsld\;bl %z2\;nop";
9760 "&& TARGET_TLS_MARKERS"
9762 (unspec:TLSmode [(match_dup 1)]
9764 (parallel [(set (match_dup 0)
9765 (call (mem:TLSmode (match_dup 2))
9767 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
9768 (clobber (reg:SI LR_REGNO))])]
9770 [(set_attr "type" "two")
9771 (set (attr "length")
9772 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
9776 (define_insn_and_split "tls_ld_sysv<TLSmode:tls_sysv_suffix>"
9777 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
9778 (call (mem:TLSmode (match_operand:TLSmode 2 "symbol_ref_operand" "s"))
9779 (match_operand 3 "" "g")))
9780 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
9782 (clobber (reg:SI LR_REGNO))]
9783 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4"
9787 if (TARGET_SECURE_PLT && flag_pic == 2)
9788 return "addi %0,%1,%&@got@tlsld\;bl %z2+32768@plt";
9790 return "addi %0,%1,%&@got@tlsld\;bl %z2@plt";
9793 return "addi %0,%1,%&@got@tlsld\;bl %z2";
9795 "&& TARGET_TLS_MARKERS"
9797 (unspec:TLSmode [(match_dup 1)]
9799 (parallel [(set (match_dup 0)
9800 (call (mem:TLSmode (match_dup 2))
9802 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
9803 (clobber (reg:SI LR_REGNO))])]
9805 [(set_attr "length" "8")])
9807 (define_insn_and_split "*tls_ld<TLSmode:tls_abi_suffix>"
9808 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
9809 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
9811 "HAVE_AS_TLS && TARGET_TLS_MARKERS"
9812 "addi %0,%1,%&@got@tlsld"
9813 "&& TARGET_CMODEL != CMODEL_SMALL"
9816 (unspec:TLSmode [(const_int 0) (match_dup 1)] UNSPEC_TLSLD)))
9818 (lo_sum:TLSmode (match_dup 2)
9819 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)))]
9822 operands[2] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
9824 [(set (attr "length")
9825 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
9829 (define_insn "*tls_ld_high<TLSmode:tls_abi_suffix>"
9830 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
9832 (unspec:TLSmode [(const_int 0)
9833 (match_operand:TLSmode 1 "gpc_reg_operand" "b")]
9835 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
9836 "addis %0,%1,%&@got@tlsld@ha"
9837 [(set_attr "length" "4")])
9839 (define_insn "*tls_ld_low<TLSmode:tls_abi_suffix>"
9840 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
9841 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
9842 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)))]
9843 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
9844 "addi %0,%1,%&@got@tlsld@l"
9845 [(set_attr "length" "4")])
9847 (define_insn "*tls_ld_call_aix<TLSmode:tls_abi_suffix>"
9848 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
9849 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
9850 (match_operand 2 "" "g")))
9851 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
9852 (clobber (reg:SI LR_REGNO))]
9853 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX && TARGET_TLS_MARKERS"
9854 "bl %z1(%&@tlsld)\;nop"
9855 [(set_attr "type" "branch")
9856 (set_attr "length" "8")])
9858 (define_insn "*tls_ld_call_sysv<TLSmode:tls_abi_suffix>"
9859 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
9860 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
9861 (match_operand 2 "" "g")))
9862 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
9863 (clobber (reg:SI LR_REGNO))]
9864 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4 && TARGET_TLS_MARKERS"
9868 if (TARGET_SECURE_PLT && flag_pic == 2)
9869 return "bl %z1+32768(%&@tlsld)@plt";
9870 return "bl %z1(%&@tlsld)@plt";
9872 return "bl %z1(%&@tlsld)";
9874 [(set_attr "type" "branch")
9875 (set_attr "length" "4")])
9877 (define_insn "tls_dtprel_<TLSmode:tls_abi_suffix>"
9878 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
9879 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
9880 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
9883 "addi %0,%1,%2@dtprel")
9885 (define_insn "tls_dtprel_ha_<TLSmode:tls_abi_suffix>"
9886 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
9887 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
9888 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
9889 UNSPEC_TLSDTPRELHA))]
9891 "addis %0,%1,%2@dtprel@ha")
9893 (define_insn "tls_dtprel_lo_<TLSmode:tls_abi_suffix>"
9894 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
9895 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
9896 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
9897 UNSPEC_TLSDTPRELLO))]
9899 "addi %0,%1,%2@dtprel@l")
9901 (define_insn_and_split "tls_got_dtprel_<TLSmode:tls_abi_suffix>"
9902 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
9903 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
9904 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
9905 UNSPEC_TLSGOTDTPREL))]
9907 "l<TLSmode:tls_insn_suffix> %0,%2@got@dtprel(%1)"
9908 "&& TARGET_CMODEL != CMODEL_SMALL"
9911 (unspec:TLSmode [(match_dup 1) (match_dup 2)] UNSPEC_TLSGOTDTPREL)))
9913 (lo_sum:TLSmode (match_dup 3)
9914 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGOTDTPREL)))]
9917 operands[3] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
9919 [(set (attr "length")
9920 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
9924 (define_insn "*tls_got_dtprel_high<TLSmode:tls_abi_suffix>"
9925 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
9927 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
9928 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
9929 UNSPEC_TLSGOTDTPREL)))]
9930 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
9931 "addis %0,%1,%2@got@dtprel@ha"
9932 [(set_attr "length" "4")])
9934 (define_insn "*tls_got_dtprel_low<TLSmode:tls_abi_suffix>"
9935 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
9936 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
9937 (unspec:TLSmode [(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
9938 UNSPEC_TLSGOTDTPREL)))]
9939 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
9940 "l<TLSmode:tls_insn_suffix> %0,%2@got@dtprel@l(%1)"
9941 [(set_attr "length" "4")])
9943 (define_insn "tls_tprel_<TLSmode:tls_abi_suffix>"
9944 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
9945 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
9946 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
9949 "addi %0,%1,%2@tprel")
9951 (define_insn "tls_tprel_ha_<TLSmode:tls_abi_suffix>"
9952 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
9953 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
9954 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
9955 UNSPEC_TLSTPRELHA))]
9957 "addis %0,%1,%2@tprel@ha")
9959 (define_insn "tls_tprel_lo_<TLSmode:tls_abi_suffix>"
9960 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
9961 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
9962 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
9963 UNSPEC_TLSTPRELLO))]
9965 "addi %0,%1,%2@tprel@l")
9967 ;; "b" output constraint here and on tls_tls input to support linker tls
9968 ;; optimization. The linker may edit the instructions emitted by a
9969 ;; tls_got_tprel/tls_tls pair to addis,addi.
9970 (define_insn_and_split "tls_got_tprel_<TLSmode:tls_abi_suffix>"
9971 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
9972 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
9973 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
9974 UNSPEC_TLSGOTTPREL))]
9976 "l<TLSmode:tls_insn_suffix> %0,%2@got@tprel(%1)"
9977 "&& TARGET_CMODEL != CMODEL_SMALL"
9980 (unspec:TLSmode [(match_dup 1) (match_dup 2)] UNSPEC_TLSGOTTPREL)))
9982 (lo_sum:TLSmode (match_dup 3)
9983 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGOTTPREL)))]
9986 operands[3] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
9988 [(set (attr "length")
9989 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
9993 (define_insn "*tls_got_tprel_high<TLSmode:tls_abi_suffix>"
9994 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
9996 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
9997 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
9998 UNSPEC_TLSGOTTPREL)))]
9999 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
10000 "addis %0,%1,%2@got@tprel@ha"
10001 [(set_attr "length" "4")])
10003 (define_insn "*tls_got_tprel_low<TLSmode:tls_abi_suffix>"
10004 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
10005 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
10006 (unspec:TLSmode [(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10007 UNSPEC_TLSGOTTPREL)))]
10008 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
10009 "l<TLSmode:tls_insn_suffix> %0,%2@got@tprel@l(%1)"
10010 [(set_attr "length" "4")])
10012 (define_insn "tls_tls_<TLSmode:tls_abi_suffix>"
10013 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
10014 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10015 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10017 "TARGET_ELF && HAVE_AS_TLS"
10018 "add %0,%1,%2@tls")
10020 (define_expand "tls_get_tpointer"
10021 [(set (match_operand:SI 0 "gpc_reg_operand" "")
10022 (unspec:SI [(const_int 0)] UNSPEC_TLSTLS))]
10023 "TARGET_XCOFF && HAVE_AS_TLS"
10026 emit_insn (gen_tls_get_tpointer_internal ());
10027 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
10031 (define_insn "tls_get_tpointer_internal"
10033 (unspec:SI [(const_int 0)] UNSPEC_TLSTLS))
10034 (clobber (reg:SI LR_REGNO))]
10035 "TARGET_XCOFF && HAVE_AS_TLS"
10036 "bla __get_tpointer")
10038 (define_expand "tls_get_addr<mode>"
10039 [(set (match_operand:P 0 "gpc_reg_operand" "")
10040 (unspec:P [(match_operand:P 1 "gpc_reg_operand" "")
10041 (match_operand:P 2 "gpc_reg_operand" "")] UNSPEC_TLSTLS))]
10042 "TARGET_XCOFF && HAVE_AS_TLS"
10045 emit_move_insn (gen_rtx_REG (Pmode, 3), operands[1]);
10046 emit_move_insn (gen_rtx_REG (Pmode, 4), operands[2]);
10047 emit_insn (gen_tls_get_addr_internal<mode> ());
10048 emit_move_insn (operands[0], gen_rtx_REG (Pmode, 3));
10052 (define_insn "tls_get_addr_internal<mode>"
10054 (unspec:P [(reg:P 3) (reg:P 4)] UNSPEC_TLSTLS))
10055 (clobber (reg:P 0))
10056 (clobber (reg:P 4))
10057 (clobber (reg:P 5))
10058 (clobber (reg:P 11))
10059 (clobber (reg:CC CR0_REGNO))
10060 (clobber (reg:P LR_REGNO))]
10061 "TARGET_XCOFF && HAVE_AS_TLS"
10062 "bla __tls_get_addr")
10064 ;; Next come insns related to the calling sequence.
10066 ;; First, an insn to allocate new stack space for dynamic use (e.g., alloca).
10067 ;; We move the back-chain and decrement the stack pointer.
10069 (define_expand "allocate_stack"
10070 [(set (match_operand 0 "gpc_reg_operand" "")
10071 (minus (reg 1) (match_operand 1 "reg_or_short_operand" "")))
10073 (minus (reg 1) (match_dup 1)))]
10076 { rtx chain = gen_reg_rtx (Pmode);
10077 rtx stack_bot = gen_rtx_MEM (Pmode, stack_pointer_rtx);
10079 rtx insn, par, set, mem;
10081 emit_move_insn (chain, stack_bot);
10083 /* Check stack bounds if necessary. */
10084 if (crtl->limit_stack)
10087 available = expand_binop (Pmode, sub_optab,
10088 stack_pointer_rtx, stack_limit_rtx,
10089 NULL_RTX, 1, OPTAB_WIDEN);
10090 emit_insn (gen_cond_trap (LTU, available, operands[1], const0_rtx));
10093 if (GET_CODE (operands[1]) != CONST_INT
10094 || INTVAL (operands[1]) < -32767
10095 || INTVAL (operands[1]) > 32768)
10097 neg_op0 = gen_reg_rtx (Pmode);
10099 emit_insn (gen_negsi2 (neg_op0, operands[1]));
10101 emit_insn (gen_negdi2 (neg_op0, operands[1]));
10104 neg_op0 = GEN_INT (- INTVAL (operands[1]));
10106 insn = emit_insn ((* ((TARGET_32BIT) ? gen_movsi_update_stack
10107 : gen_movdi_di_update_stack))
10108 (stack_pointer_rtx, stack_pointer_rtx, neg_op0,
10110 /* Since we didn't use gen_frame_mem to generate the MEM, grab
10111 it now and set the alias set/attributes. The above gen_*_update
10112 calls will generate a PARALLEL with the MEM set being the first
10114 par = PATTERN (insn);
10115 gcc_assert (GET_CODE (par) == PARALLEL);
10116 set = XVECEXP (par, 0, 0);
10117 gcc_assert (GET_CODE (set) == SET);
10118 mem = SET_DEST (set);
10119 gcc_assert (MEM_P (mem));
10120 MEM_NOTRAP_P (mem) = 1;
10121 set_mem_alias_set (mem, get_frame_alias_set ());
10123 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
10127 ;; These patterns say how to save and restore the stack pointer. We need not
10128 ;; save the stack pointer at function level since we are careful to
10129 ;; preserve the backchain. At block level, we have to restore the backchain
10130 ;; when we restore the stack pointer.
10132 ;; For nonlocal gotos, we must save both the stack pointer and its
10133 ;; backchain and restore both. Note that in the nonlocal case, the
10134 ;; save area is a memory location.
10136 (define_expand "save_stack_function"
10137 [(match_operand 0 "any_operand" "")
10138 (match_operand 1 "any_operand" "")]
10142 (define_expand "restore_stack_function"
10143 [(match_operand 0 "any_operand" "")
10144 (match_operand 1 "any_operand" "")]
10148 ;; Adjust stack pointer (op0) to a new value (op1).
10149 ;; First copy old stack backchain to new location, and ensure that the
10150 ;; scheduler won't reorder the sp assignment before the backchain write.
10151 (define_expand "restore_stack_block"
10152 [(set (match_dup 2) (match_dup 3))
10153 (set (match_dup 4) (match_dup 2))
10155 (set (match_operand 0 "register_operand" "")
10156 (match_operand 1 "register_operand" ""))]
10162 operands[1] = force_reg (Pmode, operands[1]);
10163 operands[2] = gen_reg_rtx (Pmode);
10164 operands[3] = gen_frame_mem (Pmode, operands[0]);
10165 operands[4] = gen_frame_mem (Pmode, operands[1]);
10166 p = rtvec_alloc (1);
10167 RTVEC_ELT (p, 0) = gen_rtx_SET (VOIDmode,
10168 gen_frame_mem (BLKmode, operands[0]),
10170 operands[5] = gen_rtx_PARALLEL (VOIDmode, p);
10173 (define_expand "save_stack_nonlocal"
10174 [(set (match_dup 3) (match_dup 4))
10175 (set (match_operand 0 "memory_operand" "") (match_dup 3))
10176 (set (match_dup 2) (match_operand 1 "register_operand" ""))]
10180 int units_per_word = (TARGET_32BIT) ? 4 : 8;
10182 /* Copy the backchain to the first word, sp to the second. */
10183 operands[0] = adjust_address_nv (operands[0], Pmode, 0);
10184 operands[2] = adjust_address_nv (operands[0], Pmode, units_per_word);
10185 operands[3] = gen_reg_rtx (Pmode);
10186 operands[4] = gen_frame_mem (Pmode, operands[1]);
10189 (define_expand "restore_stack_nonlocal"
10190 [(set (match_dup 2) (match_operand 1 "memory_operand" ""))
10191 (set (match_dup 3) (match_dup 4))
10192 (set (match_dup 5) (match_dup 2))
10194 (set (match_operand 0 "register_operand" "") (match_dup 3))]
10198 int units_per_word = (TARGET_32BIT) ? 4 : 8;
10201 /* Restore the backchain from the first word, sp from the second. */
10202 operands[2] = gen_reg_rtx (Pmode);
10203 operands[3] = gen_reg_rtx (Pmode);
10204 operands[1] = adjust_address_nv (operands[1], Pmode, 0);
10205 operands[4] = adjust_address_nv (operands[1], Pmode, units_per_word);
10206 operands[5] = gen_frame_mem (Pmode, operands[3]);
10207 p = rtvec_alloc (1);
10208 RTVEC_ELT (p, 0) = gen_rtx_SET (VOIDmode,
10209 gen_frame_mem (BLKmode, operands[0]),
10211 operands[6] = gen_rtx_PARALLEL (VOIDmode, p);
10214 ;; TOC register handling.
10216 ;; Code to initialize the TOC register...
10218 (define_insn "load_toc_aix_si"
10219 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10220 (unspec:SI [(const_int 0)] UNSPEC_TOC))
10221 (use (reg:SI 2))])]
10222 "DEFAULT_ABI == ABI_AIX && TARGET_32BIT"
10226 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
10227 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
10228 operands[2] = gen_rtx_REG (Pmode, 2);
10229 return \"lwz %0,%1(%2)\";
10231 [(set_attr "type" "load")])
10233 (define_insn "load_toc_aix_di"
10234 [(parallel [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10235 (unspec:DI [(const_int 0)] UNSPEC_TOC))
10236 (use (reg:DI 2))])]
10237 "DEFAULT_ABI == ABI_AIX && TARGET_64BIT"
10241 #ifdef TARGET_RELOCATABLE
10242 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\",
10243 !TARGET_MINIMAL_TOC || TARGET_RELOCATABLE);
10245 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
10248 strcat (buf, \"@toc\");
10249 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
10250 operands[2] = gen_rtx_REG (Pmode, 2);
10251 return \"ld %0,%1(%2)\";
10253 [(set_attr "type" "load")])
10255 (define_insn "load_toc_v4_pic_si"
10256 [(set (reg:SI LR_REGNO)
10257 (unspec:SI [(const_int 0)] UNSPEC_TOC))]
10258 "DEFAULT_ABI == ABI_V4 && flag_pic == 1 && TARGET_32BIT"
10259 "bl _GLOBAL_OFFSET_TABLE_@local-4"
10260 [(set_attr "type" "branch")
10261 (set_attr "length" "4")])
10263 (define_expand "load_toc_v4_PIC_1"
10264 [(parallel [(set (reg:SI LR_REGNO)
10265 (match_operand:SI 0 "immediate_operand" "s"))
10266 (use (unspec [(match_dup 0)] UNSPEC_TOC))])]
10267 "TARGET_ELF && DEFAULT_ABI != ABI_AIX
10268 && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
10271 (define_insn "load_toc_v4_PIC_1_normal"
10272 [(set (reg:SI LR_REGNO)
10273 (match_operand:SI 0 "immediate_operand" "s"))
10274 (use (unspec [(match_dup 0)] UNSPEC_TOC))]
10275 "!TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI != ABI_AIX
10276 && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
10277 "bcl 20,31,%0\\n%0:"
10278 [(set_attr "type" "branch")
10279 (set_attr "length" "4")])
10281 (define_insn "load_toc_v4_PIC_1_476"
10282 [(set (reg:SI LR_REGNO)
10283 (match_operand:SI 0 "immediate_operand" "s"))
10284 (use (unspec [(match_dup 0)] UNSPEC_TOC))]
10285 "TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI != ABI_AIX
10286 && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
10290 static char templ[32];
10292 get_ppc476_thunk_name (name);
10293 sprintf (templ, \"bl %s\\n%%0:\", name);
10296 [(set_attr "type" "branch")
10297 (set_attr "length" "4")])
10299 (define_expand "load_toc_v4_PIC_1b"
10300 [(parallel [(set (reg:SI LR_REGNO)
10301 (unspec:SI [(match_operand:SI 0 "immediate_operand" "s")
10302 (label_ref (match_operand 1 "" ""))]
10305 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
10308 (define_insn "load_toc_v4_PIC_1b_normal"
10309 [(set (reg:SI LR_REGNO)
10310 (unspec:SI [(match_operand:SI 0 "immediate_operand" "s")
10311 (label_ref (match_operand 1 "" ""))]
10314 "!TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
10315 "bcl 20,31,$+8\;.long %0-$"
10316 [(set_attr "type" "branch")
10317 (set_attr "length" "8")])
10319 (define_insn "load_toc_v4_PIC_1b_476"
10320 [(set (reg:SI LR_REGNO)
10321 (unspec:SI [(match_operand:SI 0 "immediate_operand" "s")
10322 (label_ref (match_operand 1 "" ""))]
10325 "TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
10329 static char templ[32];
10331 get_ppc476_thunk_name (name);
10332 sprintf (templ, \"bl %s\\n\\tb $+8\\n\\t.long %%0-$\", name);
10335 [(set_attr "type" "branch")
10336 (set_attr "length" "16")])
10338 (define_insn "load_toc_v4_PIC_2"
10339 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10340 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
10341 (minus:SI (match_operand:SI 2 "immediate_operand" "s")
10342 (match_operand:SI 3 "immediate_operand" "s")))))]
10343 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
10345 [(set_attr "type" "load")])
10347 (define_insn "load_toc_v4_PIC_3b"
10348 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10349 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
10351 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
10352 (match_operand:SI 3 "symbol_ref_operand" "s")))))]
10353 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
10354 "addis %0,%1,%2-%3@ha")
10356 (define_insn "load_toc_v4_PIC_3c"
10357 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10358 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
10359 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
10360 (match_operand:SI 3 "symbol_ref_operand" "s"))))]
10361 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
10362 "addi %0,%1,%2-%3@l")
10364 ;; If the TOC is shared over a translation unit, as happens with all
10365 ;; the kinds of PIC that we support, we need to restore the TOC
10366 ;; pointer only when jumping over units of translation.
10367 ;; On Darwin, we need to reload the picbase.
10369 (define_expand "builtin_setjmp_receiver"
10370 [(use (label_ref (match_operand 0 "" "")))]
10371 "(DEFAULT_ABI == ABI_V4 && flag_pic == 1)
10372 || (TARGET_TOC && TARGET_MINIMAL_TOC)
10373 || (DEFAULT_ABI == ABI_DARWIN && flag_pic)"
10377 if (DEFAULT_ABI == ABI_DARWIN)
10379 rtx picrtx = gen_rtx_SYMBOL_REF (Pmode, MACHOPIC_FUNCTION_BASE_NAME);
10380 rtx picreg = gen_rtx_REG (Pmode, RS6000_PIC_OFFSET_TABLE_REGNUM);
10384 crtl->uses_pic_offset_table = 1;
10385 ASM_GENERATE_INTERNAL_LABEL(tmplab, \"LSJR\",
10386 CODE_LABEL_NUMBER (operands[0]));
10387 tmplabrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (tmplab));
10389 emit_insn (gen_load_macho_picbase (tmplabrtx));
10390 emit_move_insn (picreg, gen_rtx_REG (Pmode, LR_REGNO));
10391 emit_insn (gen_macho_correct_pic (picreg, picreg, picrtx, tmplabrtx));
10395 rs6000_emit_load_toc_table (FALSE);
10399 ;; Largetoc support
10400 (define_insn "*largetoc_high"
10401 [(set (match_operand:DI 0 "gpc_reg_operand" "=b*r")
10403 (unspec [(match_operand:DI 1 "" "")
10404 (match_operand:DI 2 "gpc_reg_operand" "b")]
10406 "TARGET_ELF && TARGET_CMODEL != CMODEL_SMALL"
10407 "addis %0,%2,%1@toc@ha")
10409 (define_insn "*largetoc_high_aix<mode>"
10410 [(set (match_operand:P 0 "gpc_reg_operand" "=b*r")
10412 (unspec [(match_operand:P 1 "" "")
10413 (match_operand:P 2 "gpc_reg_operand" "b")]
10415 "TARGET_XCOFF && TARGET_CMODEL != CMODEL_SMALL"
10416 "addis %0,%1@u(%2)")
10418 (define_insn "*largetoc_high_plus"
10419 [(set (match_operand:DI 0 "gpc_reg_operand" "=b*r")
10422 (unspec [(match_operand:DI 1 "" "")
10423 (match_operand:DI 2 "gpc_reg_operand" "b")]
10425 (match_operand 3 "const_int_operand" "n"))))]
10426 "TARGET_ELF && TARGET_CMODEL != CMODEL_SMALL"
10427 "addis %0,%2,%1+%3@toc@ha")
10429 (define_insn "*largetoc_high_plus_aix<mode>"
10430 [(set (match_operand:P 0 "gpc_reg_operand" "=b*r")
10433 (unspec [(match_operand:P 1 "" "")
10434 (match_operand:P 2 "gpc_reg_operand" "b")]
10436 (match_operand 3 "const_int_operand" "n"))))]
10437 "TARGET_XCOFF && TARGET_CMODEL != CMODEL_SMALL"
10438 "addis %0,%1+%3@u(%2)")
10440 (define_insn "*largetoc_low"
10441 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
10442 (lo_sum:DI (match_operand:DI 1 "gpc_reg_operand" "b,!*r")
10443 (match_operand:DI 2 "" "")))]
10444 "TARGET_ELF && TARGET_CMODEL != CMODEL_SMALL"
10449 (define_insn "*largetoc_low_aix<mode>"
10450 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
10451 (lo_sum:P (match_operand:P 1 "gpc_reg_operand" "b")
10452 (match_operand:P 2 "" "")))]
10453 "TARGET_XCOFF && TARGET_CMODEL != CMODEL_SMALL"
10456 (define_insn_and_split "*tocref<mode>"
10457 [(set (match_operand:P 0 "gpc_reg_operand" "=b*r")
10458 (match_operand:P 1 "small_toc_ref" "R"))]
10461 "&& TARGET_CMODEL != CMODEL_SMALL && reload_completed"
10462 [(set (match_dup 0) (high:P (match_dup 1)))
10463 (set (match_dup 0) (lo_sum:P (match_dup 0) (match_dup 1)))])
10465 ;; Elf specific ways of loading addresses for non-PIC code.
10466 ;; The output of this could be r0, but we make a very strong
10467 ;; preference for a base register because it will usually
10468 ;; be needed there.
10469 (define_insn "elf_high"
10470 [(set (match_operand:SI 0 "gpc_reg_operand" "=b*r")
10471 (high:SI (match_operand 1 "" "")))]
10472 "TARGET_ELF && ! TARGET_64BIT"
10475 (define_insn "elf_low"
10476 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
10477 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,!*r")
10478 (match_operand 2 "" "")))]
10479 "TARGET_ELF && ! TARGET_64BIT"
10484 ;; Call and call_value insns
10485 (define_expand "call"
10486 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
10487 (match_operand 1 "" ""))
10488 (use (match_operand 2 "" ""))
10489 (clobber (reg:SI LR_REGNO))])]
10494 if (MACHOPIC_INDIRECT)
10495 operands[0] = machopic_indirect_call_target (operands[0]);
10498 gcc_assert (GET_CODE (operands[0]) == MEM);
10499 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
10501 operands[0] = XEXP (operands[0], 0);
10503 if (GET_CODE (operands[0]) != SYMBOL_REF
10504 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[0]))
10505 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[2]) & CALL_LONG) != 0))
10507 if (INTVAL (operands[2]) & CALL_LONG)
10508 operands[0] = rs6000_longcall_ref (operands[0]);
10510 switch (DEFAULT_ABI)
10514 operands[0] = force_reg (Pmode, operands[0]);
10518 /* AIX function pointers are really pointers to a three word
10520 rs6000_call_indirect_aix (NULL_RTX, operands[0], operands[1]);
10524 gcc_unreachable ();
10529 (define_expand "call_value"
10530 [(parallel [(set (match_operand 0 "" "")
10531 (call (mem:SI (match_operand 1 "address_operand" ""))
10532 (match_operand 2 "" "")))
10533 (use (match_operand 3 "" ""))
10534 (clobber (reg:SI LR_REGNO))])]
10539 if (MACHOPIC_INDIRECT)
10540 operands[1] = machopic_indirect_call_target (operands[1]);
10543 gcc_assert (GET_CODE (operands[1]) == MEM);
10544 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
10546 operands[1] = XEXP (operands[1], 0);
10548 if (GET_CODE (operands[1]) != SYMBOL_REF
10549 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[1]))
10550 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[3]) & CALL_LONG) != 0))
10552 if (INTVAL (operands[3]) & CALL_LONG)
10553 operands[1] = rs6000_longcall_ref (operands[1]);
10555 switch (DEFAULT_ABI)
10559 operands[1] = force_reg (Pmode, operands[1]);
10563 /* AIX function pointers are really pointers to a three word
10565 rs6000_call_indirect_aix (operands[0], operands[1], operands[2]);
10569 gcc_unreachable ();
10574 ;; Call to function in current module. No TOC pointer reload needed.
10575 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
10576 ;; either the function was not prototyped, or it was prototyped as a
10577 ;; variable argument function. It is > 0 if FP registers were passed
10578 ;; and < 0 if they were not.
10580 (define_insn "*call_local32"
10581 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
10582 (match_operand 1 "" "g,g"))
10583 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10584 (clobber (reg:SI LR_REGNO))]
10585 "(INTVAL (operands[2]) & CALL_LONG) == 0"
10588 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10589 output_asm_insn (\"crxor 6,6,6\", operands);
10591 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10592 output_asm_insn (\"creqv 6,6,6\", operands);
10594 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
10596 [(set_attr "type" "branch")
10597 (set_attr "length" "4,8")])
10599 (define_insn "*call_local64"
10600 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
10601 (match_operand 1 "" "g,g"))
10602 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10603 (clobber (reg:SI LR_REGNO))]
10604 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
10607 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10608 output_asm_insn (\"crxor 6,6,6\", operands);
10610 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10611 output_asm_insn (\"creqv 6,6,6\", operands);
10613 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
10615 [(set_attr "type" "branch")
10616 (set_attr "length" "4,8")])
10618 (define_insn "*call_value_local32"
10619 [(set (match_operand 0 "" "")
10620 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
10621 (match_operand 2 "" "g,g")))
10622 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10623 (clobber (reg:SI LR_REGNO))]
10624 "(INTVAL (operands[3]) & CALL_LONG) == 0"
10627 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10628 output_asm_insn (\"crxor 6,6,6\", operands);
10630 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10631 output_asm_insn (\"creqv 6,6,6\", operands);
10633 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
10635 [(set_attr "type" "branch")
10636 (set_attr "length" "4,8")])
10639 (define_insn "*call_value_local64"
10640 [(set (match_operand 0 "" "")
10641 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
10642 (match_operand 2 "" "g,g")))
10643 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10644 (clobber (reg:SI LR_REGNO))]
10645 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
10648 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10649 output_asm_insn (\"crxor 6,6,6\", operands);
10651 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10652 output_asm_insn (\"creqv 6,6,6\", operands);
10654 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
10656 [(set_attr "type" "branch")
10657 (set_attr "length" "4,8")])
10659 ;; Call to indirect functions with the AIX abi using a 3 word descriptor.
10660 ;; Operand0 is the addresss of the function to call
10661 ;; Operand1 is the flag for System V.4 for unprototyped or FP registers
10662 ;; Operand2 is the location in the function descriptor to load r2 from
10663 ;; Operand3 is the stack location to hold the current TOC pointer
10665 (define_insn "call_indirect_aix<ptrsize>"
10666 [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l"))
10667 (match_operand 1 "" "g,g"))
10668 (use (match_operand:P 2 "memory_operand" "<ptrm>,<ptrm>"))
10669 (set (reg:P TOC_REGNUM) (match_operand:P 3 "memory_operand" "<ptrm>,<ptrm>"))
10670 (use (reg:P STATIC_CHAIN_REGNUM))
10671 (clobber (reg:P LR_REGNO))]
10672 "DEFAULT_ABI == ABI_AIX && TARGET_POINTERS_TO_NESTED_FUNCTIONS"
10673 "<ptrload> 2,%2\;b%T0l\;<ptrload> 2,%3"
10674 [(set_attr "type" "jmpreg")
10675 (set_attr "length" "12")])
10677 ;; Like call_indirect_aix<ptrsize>, but no use of the static chain
10678 ;; Operand0 is the addresss of the function to call
10679 ;; Operand1 is the flag for System V.4 for unprototyped or FP registers
10680 ;; Operand2 is the location in the function descriptor to load r2 from
10681 ;; Operand3 is the stack location to hold the current TOC pointer
10683 (define_insn "call_indirect_aix<ptrsize>_nor11"
10684 [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l"))
10685 (match_operand 1 "" "g,g"))
10686 (use (match_operand:P 2 "memory_operand" "<ptrm>,<ptrm>"))
10687 (set (reg:P TOC_REGNUM) (match_operand:P 3 "memory_operand" "<ptrm>,<ptrm>"))
10688 (clobber (reg:P LR_REGNO))]
10689 "DEFAULT_ABI == ABI_AIX && !TARGET_POINTERS_TO_NESTED_FUNCTIONS"
10690 "<ptrload> 2,%2\;b%T0l\;<ptrload> 2,%3"
10691 [(set_attr "type" "jmpreg")
10692 (set_attr "length" "12")])
10694 ;; Operand0 is the return result of the function
10695 ;; Operand1 is the addresss of the function to call
10696 ;; Operand2 is the flag for System V.4 for unprototyped or FP registers
10697 ;; Operand3 is the location in the function descriptor to load r2 from
10698 ;; Operand4 is the stack location to hold the current TOC pointer
10700 (define_insn "call_value_indirect_aix<ptrsize>"
10701 [(set (match_operand 0 "" "")
10702 (call (mem:SI (match_operand:P 1 "register_operand" "c,*l"))
10703 (match_operand 2 "" "g,g")))
10704 (use (match_operand:P 3 "memory_operand" "<ptrm>,<ptrm>"))
10705 (set (reg:P TOC_REGNUM) (match_operand:P 4 "memory_operand" "<ptrm>,<ptrm>"))
10706 (use (reg:P STATIC_CHAIN_REGNUM))
10707 (clobber (reg:P LR_REGNO))]
10708 "DEFAULT_ABI == ABI_AIX && TARGET_POINTERS_TO_NESTED_FUNCTIONS"
10709 "<ptrload> 2,%3\;b%T1l\;<ptrload> 2,%4"
10710 [(set_attr "type" "jmpreg")
10711 (set_attr "length" "12")])
10713 ;; Like call_value_indirect_aix<ptrsize>, but no use of the static chain
10714 ;; Operand0 is the return result of the function
10715 ;; Operand1 is the addresss of the function to call
10716 ;; Operand2 is the flag for System V.4 for unprototyped or FP registers
10717 ;; Operand3 is the location in the function descriptor to load r2 from
10718 ;; Operand4 is the stack location to hold the current TOC pointer
10720 (define_insn "call_value_indirect_aix<ptrsize>_nor11"
10721 [(set (match_operand 0 "" "")
10722 (call (mem:SI (match_operand:P 1 "register_operand" "c,*l"))
10723 (match_operand 2 "" "g,g")))
10724 (use (match_operand:P 3 "memory_operand" "<ptrm>,<ptrm>"))
10725 (set (reg:P TOC_REGNUM) (match_operand:P 4 "memory_operand" "<ptrm>,<ptrm>"))
10726 (clobber (reg:P LR_REGNO))]
10727 "DEFAULT_ABI == ABI_AIX && !TARGET_POINTERS_TO_NESTED_FUNCTIONS"
10728 "<ptrload> 2,%3\;b%T1l\;<ptrload> 2,%4"
10729 [(set_attr "type" "jmpreg")
10730 (set_attr "length" "12")])
10732 ;; Call to function which may be in another module. Restore the TOC
10733 ;; pointer (r2) after the call unless this is System V.
10734 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
10735 ;; either the function was not prototyped, or it was prototyped as a
10736 ;; variable argument function. It is > 0 if FP registers were passed
10737 ;; and < 0 if they were not.
10739 (define_insn "*call_nonlocal_aix32"
10740 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
10741 (match_operand 1 "" "g"))
10742 (use (match_operand:SI 2 "immediate_operand" "O"))
10743 (clobber (reg:SI LR_REGNO))]
10745 && DEFAULT_ABI == ABI_AIX
10746 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10748 [(set_attr "type" "branch")
10749 (set_attr "length" "8")])
10751 (define_insn "*call_nonlocal_aix64"
10752 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
10753 (match_operand 1 "" "g"))
10754 (use (match_operand:SI 2 "immediate_operand" "O"))
10755 (clobber (reg:SI LR_REGNO))]
10757 && DEFAULT_ABI == ABI_AIX
10758 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10760 [(set_attr "type" "branch")
10761 (set_attr "length" "8")])
10763 (define_insn "*call_value_nonlocal_aix32"
10764 [(set (match_operand 0 "" "")
10765 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
10766 (match_operand 2 "" "g")))
10767 (use (match_operand:SI 3 "immediate_operand" "O"))
10768 (clobber (reg:SI LR_REGNO))]
10770 && DEFAULT_ABI == ABI_AIX
10771 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10773 [(set_attr "type" "branch")
10774 (set_attr "length" "8")])
10776 (define_insn "*call_value_nonlocal_aix64"
10777 [(set (match_operand 0 "" "")
10778 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
10779 (match_operand 2 "" "g")))
10780 (use (match_operand:SI 3 "immediate_operand" "O"))
10781 (clobber (reg:SI LR_REGNO))]
10783 && DEFAULT_ABI == ABI_AIX
10784 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10786 [(set_attr "type" "branch")
10787 (set_attr "length" "8")])
10789 ;; A function pointer under System V is just a normal pointer
10790 ;; operands[0] is the function pointer
10791 ;; operands[1] is the stack size to clean up
10792 ;; operands[2] is the value FUNCTION_ARG returns for the VOID argument
10793 ;; which indicates how to set cr1
10795 (define_insn "*call_indirect_nonlocal_sysv<mode>"
10796 [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l,c,*l"))
10797 (match_operand 1 "" "g,g,g,g"))
10798 (use (match_operand:SI 2 "immediate_operand" "O,O,n,n"))
10799 (clobber (reg:SI LR_REGNO))]
10800 "DEFAULT_ABI == ABI_V4
10801 || DEFAULT_ABI == ABI_DARWIN"
10803 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10804 output_asm_insn ("crxor 6,6,6", operands);
10806 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10807 output_asm_insn ("creqv 6,6,6", operands);
10811 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
10812 (set_attr "length" "4,4,8,8")])
10814 (define_insn_and_split "*call_nonlocal_sysv<mode>"
10815 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
10816 (match_operand 1 "" "g,g"))
10817 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10818 (clobber (reg:SI LR_REGNO))]
10819 "(DEFAULT_ABI == ABI_DARWIN
10820 || (DEFAULT_ABI == ABI_V4
10821 && (INTVAL (operands[2]) & CALL_LONG) == 0))"
10823 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10824 output_asm_insn ("crxor 6,6,6", operands);
10826 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10827 output_asm_insn ("creqv 6,6,6", operands);
10830 return output_call(insn, operands, 0, 2);
10832 if (DEFAULT_ABI == ABI_V4 && flag_pic)
10834 gcc_assert (!TARGET_SECURE_PLT);
10835 return "bl %z0@plt";
10841 "DEFAULT_ABI == ABI_V4
10842 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[0])
10843 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10844 [(parallel [(call (mem:SI (match_dup 0))
10846 (use (match_dup 2))
10847 (use (match_dup 3))
10848 (clobber (reg:SI LR_REGNO))])]
10850 operands[3] = pic_offset_table_rtx;
10852 [(set_attr "type" "branch,branch")
10853 (set_attr "length" "4,8")])
10855 (define_insn "*call_nonlocal_sysv_secure<mode>"
10856 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
10857 (match_operand 1 "" "g,g"))
10858 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10859 (use (match_operand:SI 3 "register_operand" "r,r"))
10860 (clobber (reg:SI LR_REGNO))]
10861 "(DEFAULT_ABI == ABI_V4
10862 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[0])
10863 && (INTVAL (operands[2]) & CALL_LONG) == 0)"
10865 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10866 output_asm_insn ("crxor 6,6,6", operands);
10868 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10869 output_asm_insn ("creqv 6,6,6", operands);
10872 /* The magic 32768 offset here and in the other sysv call insns
10873 corresponds to the offset of r30 in .got2, as given by LCTOC1.
10874 See sysv4.h:toc_section. */
10875 return "bl %z0+32768@plt";
10877 return "bl %z0@plt";
10879 [(set_attr "type" "branch,branch")
10880 (set_attr "length" "4,8")])
10882 (define_insn "*call_value_indirect_nonlocal_sysv<mode>"
10883 [(set (match_operand 0 "" "")
10884 (call (mem:SI (match_operand:P 1 "register_operand" "c,*l,c,*l"))
10885 (match_operand 2 "" "g,g,g,g")))
10886 (use (match_operand:SI 3 "immediate_operand" "O,O,n,n"))
10887 (clobber (reg:SI LR_REGNO))]
10888 "DEFAULT_ABI == ABI_V4
10889 || DEFAULT_ABI == ABI_DARWIN"
10891 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10892 output_asm_insn ("crxor 6,6,6", operands);
10894 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10895 output_asm_insn ("creqv 6,6,6", operands);
10899 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
10900 (set_attr "length" "4,4,8,8")])
10902 (define_insn_and_split "*call_value_nonlocal_sysv<mode>"
10903 [(set (match_operand 0 "" "")
10904 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
10905 (match_operand 2 "" "g,g")))
10906 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10907 (clobber (reg:SI LR_REGNO))]
10908 "(DEFAULT_ABI == ABI_DARWIN
10909 || (DEFAULT_ABI == ABI_V4
10910 && (INTVAL (operands[3]) & CALL_LONG) == 0))"
10912 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10913 output_asm_insn ("crxor 6,6,6", operands);
10915 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10916 output_asm_insn ("creqv 6,6,6", operands);
10919 return output_call(insn, operands, 1, 3);
10921 if (DEFAULT_ABI == ABI_V4 && flag_pic)
10923 gcc_assert (!TARGET_SECURE_PLT);
10924 return "bl %z1@plt";
10930 "DEFAULT_ABI == ABI_V4
10931 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[1])
10932 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10933 [(parallel [(set (match_dup 0)
10934 (call (mem:SI (match_dup 1))
10936 (use (match_dup 3))
10937 (use (match_dup 4))
10938 (clobber (reg:SI LR_REGNO))])]
10940 operands[4] = pic_offset_table_rtx;
10942 [(set_attr "type" "branch,branch")
10943 (set_attr "length" "4,8")])
10945 (define_insn "*call_value_nonlocal_sysv_secure<mode>"
10946 [(set (match_operand 0 "" "")
10947 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
10948 (match_operand 2 "" "g,g")))
10949 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10950 (use (match_operand:SI 4 "register_operand" "r,r"))
10951 (clobber (reg:SI LR_REGNO))]
10952 "(DEFAULT_ABI == ABI_V4
10953 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[1])
10954 && (INTVAL (operands[3]) & CALL_LONG) == 0)"
10956 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10957 output_asm_insn ("crxor 6,6,6", operands);
10959 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10960 output_asm_insn ("creqv 6,6,6", operands);
10963 return "bl %z1+32768@plt";
10965 return "bl %z1@plt";
10967 [(set_attr "type" "branch,branch")
10968 (set_attr "length" "4,8")])
10970 ;; Call subroutine returning any type.
10971 (define_expand "untyped_call"
10972 [(parallel [(call (match_operand 0 "" "")
10974 (match_operand 1 "" "")
10975 (match_operand 2 "" "")])]
10981 emit_call_insn (GEN_CALL (operands[0], const0_rtx, const0_rtx, const0_rtx));
10983 for (i = 0; i < XVECLEN (operands[2], 0); i++)
10985 rtx set = XVECEXP (operands[2], 0, i);
10986 emit_move_insn (SET_DEST (set), SET_SRC (set));
10989 /* The optimizer does not know that the call sets the function value
10990 registers we stored in the result block. We avoid problems by
10991 claiming that all hard registers are used and clobbered at this
10993 emit_insn (gen_blockage ());
10998 ;; sibling call patterns
10999 (define_expand "sibcall"
11000 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
11001 (match_operand 1 "" ""))
11002 (use (match_operand 2 "" ""))
11003 (use (reg:SI LR_REGNO))
11009 if (MACHOPIC_INDIRECT)
11010 operands[0] = machopic_indirect_call_target (operands[0]);
11013 gcc_assert (GET_CODE (operands[0]) == MEM);
11014 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
11016 operands[0] = XEXP (operands[0], 0);
11019 ;; this and similar patterns must be marked as using LR, otherwise
11020 ;; dataflow will try to delete the store into it. This is true
11021 ;; even when the actual reg to jump to is in CTR, when LR was
11022 ;; saved and restored around the PIC-setting BCL.
11023 (define_insn "*sibcall_local32"
11024 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
11025 (match_operand 1 "" "g,g"))
11026 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11027 (use (reg:SI LR_REGNO))
11029 "(INTVAL (operands[2]) & CALL_LONG) == 0"
11032 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11033 output_asm_insn (\"crxor 6,6,6\", operands);
11035 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11036 output_asm_insn (\"creqv 6,6,6\", operands);
11038 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
11040 [(set_attr "type" "branch")
11041 (set_attr "length" "4,8")])
11043 (define_insn "*sibcall_local64"
11044 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
11045 (match_operand 1 "" "g,g"))
11046 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11047 (use (reg:SI LR_REGNO))
11049 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
11052 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11053 output_asm_insn (\"crxor 6,6,6\", operands);
11055 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11056 output_asm_insn (\"creqv 6,6,6\", operands);
11058 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
11060 [(set_attr "type" "branch")
11061 (set_attr "length" "4,8")])
11063 (define_insn "*sibcall_value_local32"
11064 [(set (match_operand 0 "" "")
11065 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
11066 (match_operand 2 "" "g,g")))
11067 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11068 (use (reg:SI LR_REGNO))
11070 "(INTVAL (operands[3]) & CALL_LONG) == 0"
11073 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11074 output_asm_insn (\"crxor 6,6,6\", operands);
11076 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11077 output_asm_insn (\"creqv 6,6,6\", operands);
11079 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
11081 [(set_attr "type" "branch")
11082 (set_attr "length" "4,8")])
11085 (define_insn "*sibcall_value_local64"
11086 [(set (match_operand 0 "" "")
11087 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
11088 (match_operand 2 "" "g,g")))
11089 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11090 (use (reg:SI LR_REGNO))
11092 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
11095 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11096 output_asm_insn (\"crxor 6,6,6\", operands);
11098 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11099 output_asm_insn (\"creqv 6,6,6\", operands);
11101 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
11103 [(set_attr "type" "branch")
11104 (set_attr "length" "4,8")])
11106 (define_insn "*sibcall_nonlocal_aix<mode>"
11107 [(call (mem:SI (match_operand:P 0 "call_operand" "s,c"))
11108 (match_operand 1 "" "g,g"))
11109 (use (match_operand:SI 2 "immediate_operand" "O,O"))
11110 (use (reg:SI LR_REGNO))
11112 "DEFAULT_ABI == ABI_AIX
11113 && (INTVAL (operands[2]) & CALL_LONG) == 0"
11117 [(set_attr "type" "branch")
11118 (set_attr "length" "4")])
11120 (define_insn "*sibcall_value_nonlocal_aix<mode>"
11121 [(set (match_operand 0 "" "")
11122 (call (mem:SI (match_operand:P 1 "call_operand" "s,c"))
11123 (match_operand 2 "" "g,g")))
11124 (use (match_operand:SI 3 "immediate_operand" "O,O"))
11125 (use (reg:SI LR_REGNO))
11127 "DEFAULT_ABI == ABI_AIX
11128 && (INTVAL (operands[3]) & CALL_LONG) == 0"
11132 [(set_attr "type" "branch")
11133 (set_attr "length" "4")])
11135 (define_insn "*sibcall_nonlocal_sysv<mode>"
11136 [(call (mem:SI (match_operand:P 0 "call_operand" "s,s,c,c"))
11137 (match_operand 1 "" ""))
11138 (use (match_operand 2 "immediate_operand" "O,n,O,n"))
11139 (use (reg:SI LR_REGNO))
11141 "(DEFAULT_ABI == ABI_DARWIN
11142 || DEFAULT_ABI == ABI_V4)
11143 && (INTVAL (operands[2]) & CALL_LONG) == 0"
11146 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11147 output_asm_insn (\"crxor 6,6,6\", operands);
11149 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11150 output_asm_insn (\"creqv 6,6,6\", operands);
11152 if (which_alternative >= 2)
11154 else if (DEFAULT_ABI == ABI_V4 && flag_pic)
11156 gcc_assert (!TARGET_SECURE_PLT);
11157 return \"b %z0@plt\";
11162 [(set_attr "type" "branch")
11163 (set_attr "length" "4,8,4,8")])
11165 (define_expand "sibcall_value"
11166 [(parallel [(set (match_operand 0 "register_operand" "")
11167 (call (mem:SI (match_operand 1 "address_operand" ""))
11168 (match_operand 2 "" "")))
11169 (use (match_operand 3 "" ""))
11170 (use (reg:SI LR_REGNO))
11176 if (MACHOPIC_INDIRECT)
11177 operands[1] = machopic_indirect_call_target (operands[1]);
11180 gcc_assert (GET_CODE (operands[1]) == MEM);
11181 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
11183 operands[1] = XEXP (operands[1], 0);
11186 (define_insn "*sibcall_value_nonlocal_sysv<mode>"
11187 [(set (match_operand 0 "" "")
11188 (call (mem:SI (match_operand:P 1 "call_operand" "s,s,c,c"))
11189 (match_operand 2 "" "")))
11190 (use (match_operand:SI 3 "immediate_operand" "O,n,O,n"))
11191 (use (reg:SI LR_REGNO))
11193 "(DEFAULT_ABI == ABI_DARWIN
11194 || DEFAULT_ABI == ABI_V4)
11195 && (INTVAL (operands[3]) & CALL_LONG) == 0"
11198 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11199 output_asm_insn (\"crxor 6,6,6\", operands);
11201 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11202 output_asm_insn (\"creqv 6,6,6\", operands);
11204 if (which_alternative >= 2)
11206 else if (DEFAULT_ABI == ABI_V4 && flag_pic)
11208 gcc_assert (!TARGET_SECURE_PLT);
11209 return \"b %z1@plt\";
11214 [(set_attr "type" "branch")
11215 (set_attr "length" "4,8,4,8")])
11217 (define_expand "sibcall_epilogue"
11218 [(use (const_int 0))]
11221 if (!TARGET_SCHED_PROLOG)
11222 emit_insn (gen_blockage ());
11223 rs6000_emit_epilogue (TRUE);
11227 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
11228 ;; all of memory. This blocks insns from being moved across this point.
11230 (define_insn "blockage"
11231 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCK)]
11235 (define_expand "probe_stack"
11236 [(set (match_operand 0 "memory_operand" "=m")
11237 (unspec [(const_int 0)] UNSPEC_PROBE_STACK))]
11241 emit_insn (gen_probe_stack_di (operands[0]));
11243 emit_insn (gen_probe_stack_si (operands[0]));
11247 (define_insn "probe_stack_<mode>"
11248 [(set (match_operand:P 0 "memory_operand" "=m")
11249 (unspec:P [(const_int 0)] UNSPEC_PROBE_STACK))]
11252 operands[1] = gen_rtx_REG (Pmode, 0);
11253 return "st<wd>%U0%X0 %1,%0";
11255 [(set_attr "type" "store")
11256 (set_attr "length" "4")])
11258 (define_insn "probe_stack_range<P:mode>"
11259 [(set (match_operand:P 0 "register_operand" "=r")
11260 (unspec_volatile:P [(match_operand:P 1 "register_operand" "0")
11261 (match_operand:P 2 "register_operand" "r")]
11262 UNSPECV_PROBE_STACK_RANGE))]
11264 "* return output_probe_stack_range (operands[0], operands[2]);"
11265 [(set_attr "type" "three")])
11267 ;; Compare insns are next. Note that the RS/6000 has two types of compares,
11268 ;; signed & unsigned, and one type of branch.
11270 ;; Start with the DEFINE_EXPANDs to generate the rtl for compares, scc
11271 ;; insns, and branches.
11273 (define_expand "cbranch<mode>4"
11274 [(use (match_operator 0 "rs6000_cbranch_operator"
11275 [(match_operand:GPR 1 "gpc_reg_operand" "")
11276 (match_operand:GPR 2 "reg_or_short_operand" "")]))
11277 (use (match_operand 3 ""))]
11281 /* Take care of the possibility that operands[2] might be negative but
11282 this might be a logical operation. That insn doesn't exist. */
11283 if (GET_CODE (operands[2]) == CONST_INT
11284 && INTVAL (operands[2]) < 0)
11286 operands[2] = force_reg (<MODE>mode, operands[2]);
11287 operands[0] = gen_rtx_fmt_ee (GET_CODE (operands[0]),
11288 GET_MODE (operands[0]),
11289 operands[1], operands[2]);
11292 rs6000_emit_cbranch (<MODE>mode, operands);
11296 (define_expand "cbranch<mode>4"
11297 [(use (match_operator 0 "rs6000_cbranch_operator"
11298 [(match_operand:FP 1 "gpc_reg_operand" "")
11299 (match_operand:FP 2 "gpc_reg_operand" "")]))
11300 (use (match_operand 3 ""))]
11304 rs6000_emit_cbranch (<MODE>mode, operands);
11308 (define_expand "cstore<mode>4"
11309 [(use (match_operator 1 "rs6000_cbranch_operator"
11310 [(match_operand:GPR 2 "gpc_reg_operand" "")
11311 (match_operand:GPR 3 "reg_or_short_operand" "")]))
11312 (clobber (match_operand:SI 0 "register_operand"))]
11316 /* Take care of the possibility that operands[3] might be negative but
11317 this might be a logical operation. That insn doesn't exist. */
11318 if (GET_CODE (operands[3]) == CONST_INT
11319 && INTVAL (operands[3]) < 0)
11321 operands[3] = force_reg (<MODE>mode, operands[3]);
11322 operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]),
11323 GET_MODE (operands[1]),
11324 operands[2], operands[3]);
11327 /* For SNE, we would prefer that the xor/abs sequence be used for integers.
11328 For SEQ, likewise, except that comparisons with zero should be done
11329 with an scc insns. However, due to the order that combine see the
11330 resulting insns, we must, in fact, allow SEQ for integers. Fail in
11331 the cases we don't want to handle or are best handled by portable
11333 if (GET_CODE (operands[1]) == NE)
11335 if ((GET_CODE (operands[1]) == LT || GET_CODE (operands[1]) == LE
11336 || GET_CODE (operands[1]) == GT || GET_CODE (operands[1]) == GE)
11337 && operands[3] == const0_rtx)
11339 rs6000_emit_sCOND (<MODE>mode, operands);
11343 (define_expand "cstore<mode>4"
11344 [(use (match_operator 1 "rs6000_cbranch_operator"
11345 [(match_operand:FP 2 "gpc_reg_operand" "")
11346 (match_operand:FP 3 "gpc_reg_operand" "")]))
11347 (clobber (match_operand:SI 0 "register_operand"))]
11351 rs6000_emit_sCOND (<MODE>mode, operands);
11356 (define_expand "stack_protect_set"
11357 [(match_operand 0 "memory_operand" "")
11358 (match_operand 1 "memory_operand" "")]
11361 #ifdef TARGET_THREAD_SSP_OFFSET
11362 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
11363 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
11364 operands[1] = gen_rtx_MEM (Pmode, addr);
11367 emit_insn (gen_stack_protect_setdi (operands[0], operands[1]));
11369 emit_insn (gen_stack_protect_setsi (operands[0], operands[1]));
11373 (define_insn "stack_protect_setsi"
11374 [(set (match_operand:SI 0 "memory_operand" "=m")
11375 (unspec:SI [(match_operand:SI 1 "memory_operand" "m")] UNSPEC_SP_SET))
11376 (set (match_scratch:SI 2 "=&r") (const_int 0))]
11378 "lwz%U1%X1 %2,%1\;stw%U0%X0 %2,%0\;li %2,0"
11379 [(set_attr "type" "three")
11380 (set_attr "length" "12")])
11382 (define_insn "stack_protect_setdi"
11383 [(set (match_operand:DI 0 "memory_operand" "=Y")
11384 (unspec:DI [(match_operand:DI 1 "memory_operand" "Y")] UNSPEC_SP_SET))
11385 (set (match_scratch:DI 2 "=&r") (const_int 0))]
11387 "ld%U1%X1 %2,%1\;std%U0%X0 %2,%0\;li %2,0"
11388 [(set_attr "type" "three")
11389 (set_attr "length" "12")])
11391 (define_expand "stack_protect_test"
11392 [(match_operand 0 "memory_operand" "")
11393 (match_operand 1 "memory_operand" "")
11394 (match_operand 2 "" "")]
11397 rtx test, op0, op1;
11398 #ifdef TARGET_THREAD_SSP_OFFSET
11399 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
11400 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
11401 operands[1] = gen_rtx_MEM (Pmode, addr);
11404 op1 = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, operands[1]), UNSPEC_SP_TEST);
11405 test = gen_rtx_EQ (VOIDmode, op0, op1);
11406 emit_jump_insn (gen_cbranchsi4 (test, op0, op1, operands[2]));
11410 (define_insn "stack_protect_testsi"
11411 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
11412 (unspec:CCEQ [(match_operand:SI 1 "memory_operand" "m,m")
11413 (match_operand:SI 2 "memory_operand" "m,m")]
11415 (set (match_scratch:SI 4 "=r,r") (const_int 0))
11416 (clobber (match_scratch:SI 3 "=&r,&r"))]
11419 lwz%U1%X1 %3,%1\;lwz%U2%X2 %4,%2\;xor. %3,%3,%4\;li %4,0
11420 lwz%U1%X1 %3,%1\;lwz%U2%X2 %4,%2\;cmplw %0,%3,%4\;li %3,0\;li %4,0"
11421 [(set_attr "length" "16,20")])
11423 (define_insn "stack_protect_testdi"
11424 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
11425 (unspec:CCEQ [(match_operand:DI 1 "memory_operand" "Y,Y")
11426 (match_operand:DI 2 "memory_operand" "Y,Y")]
11428 (set (match_scratch:DI 4 "=r,r") (const_int 0))
11429 (clobber (match_scratch:DI 3 "=&r,&r"))]
11432 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;xor. %3,%3,%4\;li %4,0
11433 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;cmpld %0,%3,%4\;li %3,0\;li %4,0"
11434 [(set_attr "length" "16,20")])
11437 ;; Here are the actual compare insns.
11438 (define_insn "*cmp<mode>_internal1"
11439 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
11440 (compare:CC (match_operand:GPR 1 "gpc_reg_operand" "r")
11441 (match_operand:GPR 2 "reg_or_short_operand" "rI")))]
11443 "cmp<wd>%I2 %0,%1,%2"
11444 [(set_attr "type" "cmp")])
11446 ;; If we are comparing a register for equality with a large constant,
11447 ;; we can do this with an XOR followed by a compare. But this is profitable
11448 ;; only if the large constant is only used for the comparison (and in this
11449 ;; case we already have a register to reuse as scratch).
11451 ;; For 64-bit registers, we could only do so if the constant's bit 15 is clear:
11452 ;; otherwise we'd need to XOR with FFFFFFFF????0000 which is not available.
11455 [(set (match_operand:SI 0 "register_operand")
11456 (match_operand:SI 1 "logical_const_operand" ""))
11457 (set (match_dup 0) (match_operator:SI 3 "boolean_or_operator"
11459 (match_operand:SI 2 "logical_const_operand" "")]))
11460 (set (match_operand:CC 4 "cc_reg_operand" "")
11461 (compare:CC (match_operand:SI 5 "gpc_reg_operand" "")
11464 (if_then_else (match_operator 6 "equality_operator"
11465 [(match_dup 4) (const_int 0)])
11466 (match_operand 7 "" "")
11467 (match_operand 8 "" "")))]
11468 "peep2_reg_dead_p (3, operands[0])
11469 && peep2_reg_dead_p (4, operands[4])"
11470 [(set (match_dup 0) (xor:SI (match_dup 5) (match_dup 9)))
11471 (set (match_dup 4) (compare:CC (match_dup 0) (match_dup 10)))
11472 (set (pc) (if_then_else (match_dup 6) (match_dup 7) (match_dup 8)))]
11475 /* Get the constant we are comparing against, and see what it looks like
11476 when sign-extended from 16 to 32 bits. Then see what constant we could
11477 XOR with SEXTC to get the sign-extended value. */
11478 rtx cnst = simplify_const_binary_operation (GET_CODE (operands[3]),
11480 operands[1], operands[2]);
11481 HOST_WIDE_INT c = INTVAL (cnst);
11482 HOST_WIDE_INT sextc = ((c & 0xffff) ^ 0x8000) - 0x8000;
11483 HOST_WIDE_INT xorv = c ^ sextc;
11485 operands[9] = GEN_INT (xorv);
11486 operands[10] = GEN_INT (sextc);
11489 (define_insn "*cmpsi_internal2"
11490 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
11491 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
11492 (match_operand:SI 2 "reg_or_u_short_operand" "rK")))]
11494 "cmplw%I2 %0,%1,%b2"
11495 [(set_attr "type" "cmp")])
11497 (define_insn "*cmpdi_internal2"
11498 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
11499 (compare:CCUNS (match_operand:DI 1 "gpc_reg_operand" "r")
11500 (match_operand:DI 2 "reg_or_u_short_operand" "rK")))]
11502 "cmpld%I2 %0,%1,%b2"
11503 [(set_attr "type" "cmp")])
11505 ;; The following two insns don't exist as single insns, but if we provide
11506 ;; them, we can swap an add and compare, which will enable us to overlap more
11507 ;; of the required delay between a compare and branch. We generate code for
11508 ;; them by splitting.
11511 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
11512 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
11513 (match_operand:SI 2 "short_cint_operand" "i")))
11514 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
11515 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
11518 [(set_attr "length" "8")])
11521 [(set (match_operand:CCUNS 3 "cc_reg_operand" "=y")
11522 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
11523 (match_operand:SI 2 "u_short_cint_operand" "i")))
11524 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
11525 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
11528 [(set_attr "length" "8")])
11531 [(set (match_operand:CC 3 "cc_reg_operand" "")
11532 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
11533 (match_operand:SI 2 "short_cint_operand" "")))
11534 (set (match_operand:SI 0 "gpc_reg_operand" "")
11535 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
11537 [(set (match_dup 3) (compare:CC (match_dup 1) (match_dup 2)))
11538 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
11541 [(set (match_operand:CCUNS 3 "cc_reg_operand" "")
11542 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "")
11543 (match_operand:SI 2 "u_short_cint_operand" "")))
11544 (set (match_operand:SI 0 "gpc_reg_operand" "")
11545 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
11547 [(set (match_dup 3) (compare:CCUNS (match_dup 1) (match_dup 2)))
11548 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
11550 (define_insn "*cmpsf_internal1"
11551 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11552 (compare:CCFP (match_operand:SF 1 "gpc_reg_operand" "f")
11553 (match_operand:SF 2 "gpc_reg_operand" "f")))]
11554 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
11556 [(set_attr "type" "fpcompare")])
11558 (define_insn "*cmpdf_internal1"
11559 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11560 (compare:CCFP (match_operand:DF 1 "gpc_reg_operand" "d")
11561 (match_operand:DF 2 "gpc_reg_operand" "d")))]
11562 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
11563 && !VECTOR_UNIT_VSX_P (DFmode)"
11565 [(set_attr "type" "fpcompare")])
11567 ;; Only need to compare second words if first words equal
11568 (define_insn "*cmptf_internal1"
11569 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11570 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "d")
11571 (match_operand:TF 2 "gpc_reg_operand" "d")))]
11572 "!TARGET_IEEEQUAD && !TARGET_XL_COMPAT
11573 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LONG_DOUBLE_128"
11574 "fcmpu %0,%1,%2\;bne %0,$+8\;fcmpu %0,%L1,%L2"
11575 [(set_attr "type" "fpcompare")
11576 (set_attr "length" "12")])
11578 (define_insn_and_split "*cmptf_internal2"
11579 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11580 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "d")
11581 (match_operand:TF 2 "gpc_reg_operand" "d")))
11582 (clobber (match_scratch:DF 3 "=d"))
11583 (clobber (match_scratch:DF 4 "=d"))
11584 (clobber (match_scratch:DF 5 "=d"))
11585 (clobber (match_scratch:DF 6 "=d"))
11586 (clobber (match_scratch:DF 7 "=d"))
11587 (clobber (match_scratch:DF 8 "=d"))
11588 (clobber (match_scratch:DF 9 "=d"))
11589 (clobber (match_scratch:DF 10 "=d"))
11590 (clobber (match_scratch:GPR 11 "=b"))]
11591 "!TARGET_IEEEQUAD && TARGET_XL_COMPAT
11592 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LONG_DOUBLE_128"
11594 "&& reload_completed"
11595 [(set (match_dup 3) (match_dup 14))
11596 (set (match_dup 4) (match_dup 15))
11597 (set (match_dup 9) (abs:DF (match_dup 5)))
11598 (set (match_dup 0) (compare:CCFP (match_dup 9) (match_dup 3)))
11599 (set (pc) (if_then_else (ne (match_dup 0) (const_int 0))
11600 (label_ref (match_dup 12))
11602 (set (match_dup 0) (compare:CCFP (match_dup 5) (match_dup 7)))
11603 (set (pc) (label_ref (match_dup 13)))
11605 (set (match_dup 10) (minus:DF (match_dup 5) (match_dup 7)))
11606 (set (match_dup 9) (minus:DF (match_dup 6) (match_dup 8)))
11607 (set (match_dup 9) (plus:DF (match_dup 10) (match_dup 9)))
11608 (set (match_dup 0) (compare:CCFP (match_dup 9) (match_dup 4)))
11611 REAL_VALUE_TYPE rv;
11612 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
11613 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
11615 operands[5] = simplify_gen_subreg (DFmode, operands[1], TFmode, hi_word);
11616 operands[6] = simplify_gen_subreg (DFmode, operands[1], TFmode, lo_word);
11617 operands[7] = simplify_gen_subreg (DFmode, operands[2], TFmode, hi_word);
11618 operands[8] = simplify_gen_subreg (DFmode, operands[2], TFmode, lo_word);
11619 operands[12] = gen_label_rtx ();
11620 operands[13] = gen_label_rtx ();
11622 operands[14] = force_const_mem (DFmode,
11623 CONST_DOUBLE_FROM_REAL_VALUE (rv, DFmode));
11624 operands[15] = force_const_mem (DFmode,
11625 CONST_DOUBLE_FROM_REAL_VALUE (dconst0,
11630 tocref = create_TOC_reference (XEXP (operands[14], 0), operands[11]);
11631 operands[14] = gen_const_mem (DFmode, tocref);
11632 tocref = create_TOC_reference (XEXP (operands[15], 0), operands[11]);
11633 operands[15] = gen_const_mem (DFmode, tocref);
11634 set_mem_alias_set (operands[14], get_TOC_alias_set ());
11635 set_mem_alias_set (operands[15], get_TOC_alias_set ());
11639 ;; Now we have the scc insns. We can do some combinations because of the
11640 ;; way the machine works.
11642 ;; Note that this is probably faster if we can put an insn between the
11643 ;; mfcr and rlinm, but this is tricky. Let's leave it for now. In most
11644 ;; cases the insns below which don't use an intermediate CR field will
11645 ;; be used instead.
11647 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11648 (match_operator:SI 1 "scc_comparison_operator"
11649 [(match_operand 2 "cc_reg_operand" "y")
11652 "mfcr %0%Q2\;rlwinm %0,%0,%J1,1"
11653 [(set (attr "type")
11654 (cond [(match_test "TARGET_MFCRF")
11655 (const_string "mfcrf")
11657 (const_string "mfcr")))
11658 (set_attr "length" "8")])
11660 ;; Same as above, but get the GT bit.
11661 (define_insn "move_from_CR_gt_bit"
11662 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11663 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_GT))]
11664 "TARGET_HARD_FLOAT && !TARGET_FPRS"
11665 "mfcr %0\;rlwinm %0,%0,%D1,31,31"
11666 [(set_attr "type" "mfcr")
11667 (set_attr "length" "8")])
11669 ;; Same as above, but get the OV/ORDERED bit.
11670 (define_insn "move_from_CR_ov_bit"
11671 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11672 (unspec:SI [(match_operand:CC 1 "cc_reg_operand" "y")]
11675 "mfcr %0\;rlwinm %0,%0,%t1,1"
11676 [(set_attr "type" "mfcr")
11677 (set_attr "length" "8")])
11680 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11681 (match_operator:DI 1 "scc_comparison_operator"
11682 [(match_operand 2 "cc_reg_operand" "y")
11685 "mfcr %0%Q2\;rlwinm %0,%0,%J1,1"
11686 [(set (attr "type")
11687 (cond [(match_test "TARGET_MFCRF")
11688 (const_string "mfcrf")
11690 (const_string "mfcr")))
11691 (set_attr "length" "8")])
11694 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11695 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
11696 [(match_operand 2 "cc_reg_operand" "y,y")
11699 (set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
11700 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
11703 mfcr %3%Q2\;rlwinm. %3,%3,%J1,1
11705 [(set_attr "type" "delayed_compare")
11706 (set_attr "length" "8,16")])
11709 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11710 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
11711 [(match_operand 2 "cc_reg_operand" "")
11714 (set (match_operand:SI 3 "gpc_reg_operand" "")
11715 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
11716 "TARGET_32BIT && reload_completed"
11717 [(set (match_dup 3)
11718 (match_op_dup 1 [(match_dup 2) (const_int 0)]))
11720 (compare:CC (match_dup 3)
11725 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11726 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
11727 [(match_operand 2 "cc_reg_operand" "y")
11729 (match_operand:SI 3 "const_int_operand" "n")))]
11733 int is_bit = ccr_bit (operands[1], 1);
11734 int put_bit = 31 - (INTVAL (operands[3]) & 31);
11737 if (is_bit >= put_bit)
11738 count = is_bit - put_bit;
11740 count = 32 - (put_bit - is_bit);
11742 operands[4] = GEN_INT (count);
11743 operands[5] = GEN_INT (put_bit);
11745 return \"mfcr %0%Q2\;rlwinm %0,%0,%4,%5,%5\";
11747 [(set (attr "type")
11748 (cond [(match_test "TARGET_MFCRF")
11749 (const_string "mfcrf")
11751 (const_string "mfcr")))
11752 (set_attr "length" "8")])
11755 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11757 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
11758 [(match_operand 2 "cc_reg_operand" "y,y")
11760 (match_operand:SI 3 "const_int_operand" "n,n"))
11762 (set (match_operand:SI 4 "gpc_reg_operand" "=r,r")
11763 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
11768 int is_bit = ccr_bit (operands[1], 1);
11769 int put_bit = 31 - (INTVAL (operands[3]) & 31);
11772 /* Force split for non-cc0 compare. */
11773 if (which_alternative == 1)
11776 if (is_bit >= put_bit)
11777 count = is_bit - put_bit;
11779 count = 32 - (put_bit - is_bit);
11781 operands[5] = GEN_INT (count);
11782 operands[6] = GEN_INT (put_bit);
11784 return \"mfcr %4%Q2\;rlwinm. %4,%4,%5,%6,%6\";
11786 [(set_attr "type" "delayed_compare")
11787 (set_attr "length" "8,16")])
11790 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
11792 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
11793 [(match_operand 2 "cc_reg_operand" "")
11795 (match_operand:SI 3 "const_int_operand" ""))
11797 (set (match_operand:SI 4 "gpc_reg_operand" "")
11798 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
11801 [(set (match_dup 4)
11802 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
11805 (compare:CC (match_dup 4)
11809 ;; There is a 3 cycle delay between consecutive mfcr instructions
11810 ;; so it is useful to combine 2 scc instructions to use only one mfcr.
11813 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11814 (match_operator:SI 1 "scc_comparison_operator"
11815 [(match_operand 2 "cc_reg_operand" "y")
11817 (set (match_operand:SI 3 "gpc_reg_operand" "=r")
11818 (match_operator:SI 4 "scc_comparison_operator"
11819 [(match_operand 5 "cc_reg_operand" "y")
11821 "REGNO (operands[2]) != REGNO (operands[5])"
11822 "mfcr %3\;rlwinm %0,%3,%J1,1\;rlwinm %3,%3,%J4,1"
11823 [(set_attr "type" "mfcr")
11824 (set_attr "length" "12")])
11827 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11828 (match_operator:DI 1 "scc_comparison_operator"
11829 [(match_operand 2 "cc_reg_operand" "y")
11831 (set (match_operand:DI 3 "gpc_reg_operand" "=r")
11832 (match_operator:DI 4 "scc_comparison_operator"
11833 [(match_operand 5 "cc_reg_operand" "y")
11835 "TARGET_POWERPC64 && REGNO (operands[2]) != REGNO (operands[5])"
11836 "mfcr %3\;rlwinm %0,%3,%J1,1\;rlwinm %3,%3,%J4,1"
11837 [(set_attr "type" "mfcr")
11838 (set_attr "length" "12")])
11840 ;; There are some scc insns that can be done directly, without a compare.
11841 ;; These are faster because they don't involve the communications between
11842 ;; the FXU and branch units. In fact, we will be replacing all of the
11843 ;; integer scc insns here or in the portable methods in emit_store_flag.
11845 ;; Also support (neg (scc ..)) since that construct is used to replace
11846 ;; branches, (plus (scc ..) ..) since that construct is common and
11847 ;; takes no more insns than scc, and (and (neg (scc ..)) ..) in the
11848 ;; cases where it is no more expensive than (neg (scc ..)).
11850 ;; Have reload force a constant into a register for the simple insns that
11851 ;; otherwise won't accept constants. We do this because it is faster than
11852 ;; the cmp/mfcr sequence we would otherwise generate.
11854 (define_mode_attr scc_eq_op2 [(SI "rKLI")
11857 (define_insn_and_split "*eq<mode>"
11858 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
11859 (eq:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
11860 (match_operand:GPR 2 "scc_eq_operand" "<scc_eq_op2>")))]
11864 [(set (match_dup 0)
11865 (clz:GPR (match_dup 3)))
11867 (lshiftrt:GPR (match_dup 0) (match_dup 4)))]
11869 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
11871 /* Use output operand as intermediate. */
11872 operands[3] = operands[0];
11874 if (logical_operand (operands[2], <MODE>mode))
11875 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
11876 gen_rtx_XOR (<MODE>mode,
11877 operands[1], operands[2])));
11879 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
11880 gen_rtx_PLUS (<MODE>mode, operands[1],
11881 negate_rtx (<MODE>mode,
11885 operands[3] = operands[1];
11887 operands[4] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
11890 (define_insn_and_split "*eq<mode>_compare"
11891 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
11893 (eq:P (match_operand:P 1 "gpc_reg_operand" "=r")
11894 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))
11896 (set (match_operand:P 0 "gpc_reg_operand" "=r")
11897 (eq:P (match_dup 1) (match_dup 2)))]
11901 [(set (match_dup 0)
11902 (clz:P (match_dup 4)))
11903 (parallel [(set (match_dup 3)
11904 (compare:CC (lshiftrt:P (match_dup 0) (match_dup 5))
11907 (lshiftrt:P (match_dup 0) (match_dup 5)))])]
11909 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
11911 /* Use output operand as intermediate. */
11912 operands[4] = operands[0];
11914 if (logical_operand (operands[2], <MODE>mode))
11915 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
11916 gen_rtx_XOR (<MODE>mode,
11917 operands[1], operands[2])));
11919 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
11920 gen_rtx_PLUS (<MODE>mode, operands[1],
11921 negate_rtx (<MODE>mode,
11925 operands[4] = operands[1];
11927 operands[5] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
11930 ;; We have insns of the form shown by the first define_insn below. If
11931 ;; there is something inside the comparison operation, we must split it.
11933 [(set (match_operand:SI 0 "gpc_reg_operand" "")
11934 (plus:SI (match_operator 1 "comparison_operator"
11935 [(match_operand:SI 2 "" "")
11936 (match_operand:SI 3
11937 "reg_or_cint_operand" "")])
11938 (match_operand:SI 4 "gpc_reg_operand" "")))
11939 (clobber (match_operand:SI 5 "register_operand" ""))]
11940 "! gpc_reg_operand (operands[2], SImode)"
11941 [(set (match_dup 5) (match_dup 2))
11942 (set (match_dup 0) (plus:SI (match_op_dup 1 [(match_dup 5) (match_dup 3)])
11945 (define_insn "*plus_eqsi"
11946 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r")
11947 (plus:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
11948 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I"))
11949 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r")))]
11952 xor %0,%1,%2\;subfic %0,%0,0\;addze %0,%3
11953 subfic %0,%1,0\;addze %0,%3
11954 xori %0,%1,%b2\;subfic %0,%0,0\;addze %0,%3
11955 xoris %0,%1,%u2\;subfic %0,%0,0\;addze %0,%3
11956 subfic %0,%1,%2\;subfic %0,%0,0\;addze %0,%3"
11957 [(set_attr "type" "three,two,three,three,three")
11958 (set_attr "length" "12,8,12,12,12")])
11960 (define_insn "*compare_plus_eqsi"
11961 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
11964 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
11965 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
11966 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
11968 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r"))]
11969 "TARGET_32BIT && optimize_size"
11971 xor %4,%1,%2\;subfic %4,%4,0\;addze. %4,%3
11972 subfic %4,%1,0\;addze. %4,%3
11973 xori %4,%1,%b2\;subfic %4,%4,0\;addze. %4,%3
11974 xoris %4,%1,%u2\;subfic %4,%4,0\;addze. %4,%3
11975 subfic %4,%1,%2\;subfic %4,%4,0\;addze. %4,%3
11981 [(set_attr "type" "compare")
11982 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
11985 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11988 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
11989 (match_operand:SI 2 "scc_eq_operand" ""))
11990 (match_operand:SI 3 "gpc_reg_operand" ""))
11992 (clobber (match_scratch:SI 4 ""))]
11993 "TARGET_32BIT && optimize_size && reload_completed"
11994 [(set (match_dup 4)
11995 (plus:SI (eq:SI (match_dup 1)
11999 (compare:CC (match_dup 4)
12003 (define_insn "*plus_eqsi_compare"
12004 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
12007 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
12008 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
12009 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
12011 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r")
12012 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12013 "TARGET_32BIT && optimize_size"
12015 xor %0,%1,%2\;subfic %0,%0,0\;addze. %0,%3
12016 subfic %0,%1,0\;addze. %0,%3
12017 xori %0,%1,%b2\;subfic %0,%0,0\;addze. %0,%3
12018 xoris %0,%1,%u2\;subfic %0,%0,0\;addze. %0,%3
12019 subfic %0,%1,%2\;subfic %0,%0,0\;addze. %0,%3
12025 [(set_attr "type" "compare")
12026 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
12029 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12032 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
12033 (match_operand:SI 2 "scc_eq_operand" ""))
12034 (match_operand:SI 3 "gpc_reg_operand" ""))
12036 (set (match_operand:SI 0 "gpc_reg_operand" "")
12037 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12038 "TARGET_32BIT && optimize_size && reload_completed"
12039 [(set (match_dup 0)
12040 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12042 (compare:CC (match_dup 0)
12046 (define_insn "*neg_eq0<mode>"
12047 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
12048 (neg:P (eq:P (match_operand:P 1 "gpc_reg_operand" "r")
12051 "addic %0,%1,-1\;subfe %0,%0,%0"
12052 [(set_attr "type" "two")
12053 (set_attr "length" "8")])
12055 (define_insn_and_split "*neg_eq<mode>"
12056 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
12057 (neg:P (eq:P (match_operand:P 1 "gpc_reg_operand" "%r")
12058 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))))]
12062 [(set (match_dup 0) (neg:P (eq:P (match_dup 3) (const_int 0))))]
12064 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
12066 /* Use output operand as intermediate. */
12067 operands[3] = operands[0];
12069 if (logical_operand (operands[2], <MODE>mode))
12070 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
12071 gen_rtx_XOR (<MODE>mode,
12072 operands[1], operands[2])));
12074 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
12075 gen_rtx_PLUS (<MODE>mode, operands[1],
12076 negate_rtx (<MODE>mode,
12080 operands[3] = operands[1];
12083 (define_insn "*ne0_<mode>"
12084 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
12085 (ne:P (match_operand:P 1 "gpc_reg_operand" "r")
12087 (clobber (match_scratch:P 2 "=&r"))]
12088 "!(TARGET_32BIT && TARGET_ISEL)"
12089 "addic %2,%1,-1\;subfe %0,%2,%1"
12090 [(set_attr "type" "two")
12091 (set_attr "length" "8")])
12093 (define_insn "*plus_ne0_<mode>"
12094 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
12095 (plus:P (ne:P (match_operand:P 1 "gpc_reg_operand" "r")
12097 (match_operand:P 2 "gpc_reg_operand" "r")))
12098 (clobber (match_scratch:P 3 "=&r"))]
12100 "addic %3,%1,-1\;addze %0,%2"
12101 [(set_attr "type" "two")
12102 (set_attr "length" "8")])
12104 (define_insn "*compare_plus_ne0_<mode>"
12105 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12106 (compare:CC (plus:P (ne:P (match_operand:P 1 "gpc_reg_operand" "r,r")
12108 (match_operand:P 2 "gpc_reg_operand" "r,r"))
12110 (clobber (match_scratch:P 3 "=&r,&r"))
12111 (clobber (match_scratch:P 4 "=X,&r"))]
12114 addic %3,%1,-1\;addze. %3,%2
12116 [(set_attr "type" "compare")
12117 (set_attr "length" "8,12")])
12120 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
12121 (compare:CC (ne:P (match_operand:SI 1 "gpc_reg_operand" "")
12123 (neg:P (match_operand:P 2 "gpc_reg_operand" ""))))
12124 (clobber (match_scratch:P 3 ""))
12125 (clobber (match_scratch:P 4 ""))]
12127 [(parallel [(set (match_dup 3)
12128 (plus:P (ne:P (match_dup 1)
12131 (clobber (match_dup 4))])
12133 (compare:CC (match_dup 3)
12138 (define_insn "*compare_plus_ne0_<mode>_1"
12139 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
12140 (compare:CCEQ (ne:P (match_operand:P 1 "gpc_reg_operand" "r,r")
12142 (neg:P (match_operand:P 2 "gpc_reg_operand" "r,r"))))
12143 (clobber (match_scratch:P 3 "=&r,&r"))
12144 (clobber (match_scratch:P 4 "=X,&r"))]
12147 addic %3,%1,-1\;addze. %3,%2
12149 [(set_attr "type" "compare")
12150 (set_attr "length" "8,12")])
12153 [(set (match_operand:CCEQ 0 "cc_reg_not_micro_cr0_operand" "")
12154 (compare:CCEQ (ne:P (match_operand:SI 1 "gpc_reg_operand" "")
12156 (neg:P (match_operand:P 2 "gpc_reg_operand" ""))))
12157 (clobber (match_scratch:P 3 ""))
12158 (clobber (match_scratch:P 4 ""))]
12160 [(parallel [(set (match_dup 3)
12161 (plus:P (ne:P (match_dup 1)
12164 (clobber (match_dup 4))])
12166 (compare:CC (match_dup 3)
12170 (define_insn "*plus_ne0_<mode>_compare"
12171 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12173 (plus:P (ne:P (match_operand:P 1 "gpc_reg_operand" "r,r")
12175 (match_operand:P 2 "gpc_reg_operand" "r,r"))
12177 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
12178 (plus:P (ne:P (match_dup 1)
12181 (clobber (match_scratch:P 3 "=&r,&r"))]
12184 addic %3,%1,-1\;addze. %0,%2
12186 [(set_attr "type" "compare")
12187 (set_attr "length" "8,12")])
12190 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
12192 (plus:P (ne:P (match_operand:P 1 "gpc_reg_operand" "")
12194 (match_operand:P 2 "gpc_reg_operand" ""))
12196 (set (match_operand:P 0 "gpc_reg_operand" "")
12197 (plus:P (ne:P (match_dup 1)
12200 (clobber (match_scratch:P 3 ""))]
12202 [(parallel [(set (match_dup 0)
12203 (plus:P (ne:P (match_dup 1)
12206 (clobber (match_dup 3))])
12208 (compare:CC (match_dup 0)
12212 (define_insn "*leu<mode>"
12213 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
12214 (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
12215 (match_operand:P 2 "reg_or_short_operand" "rI")))]
12217 "subf%I2c %0,%1,%2\;li %0,0\;adde %0,%0,%0"
12218 [(set_attr "type" "three")
12219 (set_attr "length" "12")])
12221 (define_insn "*leu<mode>_compare"
12222 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12224 (leu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
12225 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
12227 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
12228 (leu:P (match_dup 1) (match_dup 2)))]
12231 subf%I2c %0,%1,%2\;li %0,0\;adde. %0,%0,%0
12233 [(set_attr "type" "compare")
12234 (set_attr "length" "12,16")])
12237 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12239 (leu:P (match_operand:P 1 "gpc_reg_operand" "")
12240 (match_operand:P 2 "reg_or_short_operand" ""))
12242 (set (match_operand:P 0 "gpc_reg_operand" "")
12243 (leu:P (match_dup 1) (match_dup 2)))]
12245 [(set (match_dup 0)
12246 (leu:P (match_dup 1) (match_dup 2)))
12248 (compare:CC (match_dup 0)
12252 (define_insn "*plus_leu<mode>"
12253 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
12254 (plus:P (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
12255 (match_operand:P 2 "reg_or_short_operand" "rI"))
12256 (match_operand:P 3 "gpc_reg_operand" "r")))]
12258 "subf%I2c %0,%1,%2\;addze %0,%3"
12259 [(set_attr "type" "two")
12260 (set_attr "length" "8")])
12263 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12265 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12266 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12267 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12269 (clobber (match_scratch:SI 4 "=&r,&r"))]
12272 subf%I2c %4,%1,%2\;addze. %4,%3
12274 [(set_attr "type" "compare")
12275 (set_attr "length" "8,12")])
12278 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12280 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12281 (match_operand:SI 2 "reg_or_short_operand" ""))
12282 (match_operand:SI 3 "gpc_reg_operand" ""))
12284 (clobber (match_scratch:SI 4 ""))]
12285 "TARGET_32BIT && reload_completed"
12286 [(set (match_dup 4)
12287 (plus:SI (leu:SI (match_dup 1) (match_dup 2))
12290 (compare:CC (match_dup 4)
12295 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12297 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12298 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12299 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12301 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12302 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12305 subf%I2c %0,%1,%2\;addze. %0,%3
12307 [(set_attr "type" "compare")
12308 (set_attr "length" "8,12")])
12311 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12313 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12314 (match_operand:SI 2 "reg_or_short_operand" ""))
12315 (match_operand:SI 3 "gpc_reg_operand" ""))
12317 (set (match_operand:SI 0 "gpc_reg_operand" "")
12318 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12319 "TARGET_32BIT && reload_completed"
12320 [(set (match_dup 0)
12321 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12323 (compare:CC (match_dup 0)
12327 (define_insn "*neg_leu<mode>"
12328 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
12329 (neg:P (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
12330 (match_operand:P 2 "reg_or_short_operand" "rI"))))]
12332 "subf%I2c %0,%1,%2\;subfe %0,%0,%0\;nand %0,%0,%0"
12333 [(set_attr "type" "three")
12334 (set_attr "length" "12")])
12336 (define_insn "*and_neg_leu<mode>"
12337 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
12339 (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
12340 (match_operand:P 2 "reg_or_short_operand" "rI")))
12341 (match_operand:P 3 "gpc_reg_operand" "r")))]
12343 "subf%I2c %0,%1,%2\;subfe %0,%0,%0\;andc %0,%3,%0"
12344 [(set_attr "type" "three")
12345 (set_attr "length" "12")])
12348 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12351 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12352 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
12353 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12355 (clobber (match_scratch:SI 4 "=&r,&r"))]
12358 subf%I2c %4,%1,%2\;subfe %4,%4,%4\;andc. %4,%3,%4
12360 [(set_attr "type" "compare")
12361 (set_attr "length" "12,16")])
12364 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12367 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12368 (match_operand:SI 2 "reg_or_short_operand" "")))
12369 (match_operand:SI 3 "gpc_reg_operand" ""))
12371 (clobber (match_scratch:SI 4 ""))]
12372 "TARGET_32BIT && reload_completed"
12373 [(set (match_dup 4)
12374 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
12377 (compare:CC (match_dup 4)
12382 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12385 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12386 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
12387 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12389 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12390 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12393 subf%I2c %0,%1,%2\;subfe %0,%0,%0\;andc. %0,%3,%0
12395 [(set_attr "type" "compare")
12396 (set_attr "length" "12,16")])
12399 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12402 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12403 (match_operand:SI 2 "reg_or_short_operand" "")))
12404 (match_operand:SI 3 "gpc_reg_operand" ""))
12406 (set (match_operand:SI 0 "gpc_reg_operand" "")
12407 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12408 "TARGET_32BIT && reload_completed"
12409 [(set (match_dup 0)
12410 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
12413 (compare:CC (match_dup 0)
12417 (define_insn_and_split "*ltu<mode>"
12418 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
12419 (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
12420 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))]
12424 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
12425 (set (match_dup 0) (neg:P (match_dup 0)))]
12428 (define_insn_and_split "*ltu<mode>_compare"
12429 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
12431 (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
12432 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
12434 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
12435 (ltu:P (match_dup 1) (match_dup 2)))]
12439 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
12440 (parallel [(set (match_dup 3)
12441 (compare:CC (neg:P (match_dup 0)) (const_int 0)))
12442 (set (match_dup 0) (neg:P (match_dup 0)))])]
12445 (define_insn_and_split "*plus_ltu<mode>"
12446 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,r")
12447 (plus:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
12448 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))
12449 (match_operand:P 3 "reg_or_short_operand" "rI,rI")))]
12452 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
12453 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
12454 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))]
12457 (define_insn_and_split "*plus_ltu<mode>_compare"
12458 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12460 (plus:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
12461 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
12462 (match_operand:P 3 "gpc_reg_operand" "r,r,r,r"))
12464 (set (match_operand:P 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12465 (plus:P (ltu:P (match_dup 1) (match_dup 2)) (match_dup 3)))]
12468 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
12469 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
12470 (parallel [(set (match_dup 4)
12471 (compare:CC (minus:P (match_dup 3) (match_dup 0))
12473 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))])]
12476 (define_insn "*neg_ltu<mode>"
12477 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
12478 (neg:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
12479 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))))]
12482 subfc %0,%2,%1\;subfe %0,%0,%0
12483 addic %0,%1,%n2\;subfe %0,%0,%0"
12484 [(set_attr "type" "two")
12485 (set_attr "length" "8")])
12487 (define_insn "*geu<mode>"
12488 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
12489 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
12490 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))]
12493 subfc %0,%2,%1\;li %0,0\;adde %0,%0,%0
12494 addic %0,%1,%n2\;li %0,0\;adde %0,%0,%0"
12495 [(set_attr "type" "three")
12496 (set_attr "length" "12")])
12498 (define_insn "*geu<mode>_compare"
12499 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
12501 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
12502 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
12504 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
12505 (geu:P (match_dup 1) (match_dup 2)))]
12508 subfc %0,%2,%1\;li %0,0\;adde. %0,%0,%0
12509 addic %0,%1,%n2\;li %0,0\;adde. %0,%0,%0
12512 [(set_attr "type" "compare")
12513 (set_attr "length" "12,12,16,16")])
12516 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
12518 (geu:P (match_operand:P 1 "gpc_reg_operand" "")
12519 (match_operand:P 2 "reg_or_neg_short_operand" ""))
12521 (set (match_operand:P 0 "gpc_reg_operand" "")
12522 (geu:P (match_dup 1) (match_dup 2)))]
12524 [(set (match_dup 0)
12525 (geu:P (match_dup 1) (match_dup 2)))
12527 (compare:CC (match_dup 0)
12531 (define_insn "*plus_geu<mode>"
12532 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,&r")
12533 (plus:P (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
12534 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))
12535 (match_operand:P 3 "gpc_reg_operand" "r,r")))]
12538 subfc %0,%2,%1\;addze %0,%3
12539 addic %0,%1,%n2\;addze %0,%3"
12540 [(set_attr "type" "two")
12541 (set_attr "length" "8")])
12544 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12546 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12547 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12548 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12550 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12553 subfc %4,%2,%1\;addze. %4,%3
12554 addic %4,%1,%n2\;addze. %4,%3
12557 [(set_attr "type" "compare")
12558 (set_attr "length" "8,8,12,12")])
12561 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12563 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12564 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12565 (match_operand:SI 3 "gpc_reg_operand" ""))
12567 (clobber (match_scratch:SI 4 ""))]
12568 "TARGET_32BIT && reload_completed"
12569 [(set (match_dup 4)
12570 (plus:SI (geu:SI (match_dup 1) (match_dup 2))
12573 (compare:CC (match_dup 4)
12578 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12580 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12581 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12582 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12584 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12585 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12588 subfc %0,%2,%1\;addze. %0,%3
12589 addic %0,%1,%n2\;addze. %0,%3
12592 [(set_attr "type" "compare")
12593 (set_attr "length" "8,8,12,12")])
12596 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12598 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12599 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12600 (match_operand:SI 3 "gpc_reg_operand" ""))
12602 (set (match_operand:SI 0 "gpc_reg_operand" "")
12603 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12604 "TARGET_32BIT && reload_completed"
12605 [(set (match_dup 0)
12606 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12608 (compare:CC (match_dup 0)
12612 (define_insn "*neg_geu<mode>"
12613 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
12614 (neg:P (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
12615 (match_operand:P 2 "reg_or_short_operand" "r,I"))))]
12618 subfc %0,%2,%1\;subfe %0,%0,%0\;nand %0,%0,%0
12619 subfic %0,%1,-1\;add%I2c %0,%0,%2\;subfe %0,%0,%0"
12620 [(set_attr "type" "three")
12621 (set_attr "length" "12")])
12623 (define_insn "*and_neg_geu<mode>"
12624 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,&r")
12626 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
12627 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))
12628 (match_operand:P 3 "gpc_reg_operand" "r,r")))]
12631 subfc %0,%2,%1\;subfe %0,%0,%0\;andc %0,%3,%0
12632 addic %0,%1,%n2\;subfe %0,%0,%0\;andc %0,%3,%0"
12633 [(set_attr "type" "three")
12634 (set_attr "length" "12")])
12637 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12640 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12641 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
12642 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12644 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12647 subfc %4,%2,%1\;subfe %4,%4,%4\;andc. %4,%3,%4
12648 addic %4,%1,%n2\;subfe %4,%4,%4\;andc. %4,%3,%4
12651 [(set_attr "type" "compare")
12652 (set_attr "length" "12,12,16,16")])
12655 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12658 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12659 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
12660 (match_operand:SI 3 "gpc_reg_operand" ""))
12662 (clobber (match_scratch:SI 4 ""))]
12663 "TARGET_32BIT && reload_completed"
12664 [(set (match_dup 4)
12665 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2)))
12668 (compare:CC (match_dup 4)
12673 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12676 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12677 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
12678 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12680 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12681 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12684 subfc %0,%2,%1\;subfe %0,%0,%0\;andc. %0,%3,%0
12685 addic %0,%1,%n2\;subfe %0,%0,%0\;andc. %0,%3,%0
12688 [(set_attr "type" "compare")
12689 (set_attr "length" "12,12,16,16")])
12692 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12695 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12696 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
12697 (match_operand:SI 3 "gpc_reg_operand" ""))
12699 (set (match_operand:SI 0 "gpc_reg_operand" "")
12700 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12701 "TARGET_32BIT && reload_completed"
12702 [(set (match_dup 0)
12703 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
12705 (compare:CC (match_dup 0)
12709 (define_insn "*plus_gt0<mode>"
12710 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
12711 (plus:P (gt:P (match_operand:P 1 "gpc_reg_operand" "r")
12713 (match_operand:P 2 "gpc_reg_operand" "r")))]
12715 "addc %0,%1,%1\;subfe %0,%1,%0\;addze %0,%2"
12716 [(set_attr "type" "three")
12717 (set_attr "length" "12")])
12720 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12722 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12724 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
12726 (clobber (match_scratch:SI 3 "=&r,&r"))]
12729 addc %3,%1,%1\;subfe %3,%1,%3\;addze. %3,%2
12731 [(set_attr "type" "compare")
12732 (set_attr "length" "12,16")])
12735 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12737 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12739 (match_operand:SI 2 "gpc_reg_operand" ""))
12741 (clobber (match_scratch:SI 3 ""))]
12742 "TARGET_32BIT && reload_completed"
12743 [(set (match_dup 3)
12744 (plus:SI (gt:SI (match_dup 1) (const_int 0))
12747 (compare:CC (match_dup 3)
12752 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12754 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12756 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
12758 (clobber (match_scratch:DI 3 "=&r,&r"))]
12761 addc %3,%1,%1\;subfe %3,%1,%3\;addze. %3,%2
12763 [(set_attr "type" "compare")
12764 (set_attr "length" "12,16")])
12767 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
12769 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
12771 (match_operand:DI 2 "gpc_reg_operand" ""))
12773 (clobber (match_scratch:DI 3 ""))]
12774 "TARGET_64BIT && reload_completed"
12775 [(set (match_dup 3)
12776 (plus:DI (gt:DI (match_dup 1) (const_int 0))
12779 (compare:CC (match_dup 3)
12784 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12786 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12788 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
12790 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12791 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
12794 addc %0,%1,%1\;subfe %0,%1,%0\;addze. %0,%2
12796 [(set_attr "type" "compare")
12797 (set_attr "length" "12,16")])
12800 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12802 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12804 (match_operand:SI 2 "gpc_reg_operand" ""))
12806 (set (match_operand:SI 0 "gpc_reg_operand" "")
12807 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
12808 "TARGET_32BIT && reload_completed"
12809 [(set (match_dup 0)
12810 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))
12812 (compare:CC (match_dup 0)
12817 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12819 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12821 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
12823 (set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
12824 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
12827 addc %0,%1,%1\;subfe %0,%1,%0\;addze. %0,%2
12829 [(set_attr "type" "compare")
12830 (set_attr "length" "12,16")])
12833 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
12835 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
12837 (match_operand:DI 2 "gpc_reg_operand" ""))
12839 (set (match_operand:DI 0 "gpc_reg_operand" "")
12840 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
12841 "TARGET_64BIT && reload_completed"
12842 [(set (match_dup 0)
12843 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))
12845 (compare:CC (match_dup 0)
12849 (define_insn_and_split "*gtu<mode>"
12850 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
12851 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
12852 (match_operand:P 2 "reg_or_short_operand" "rI")))]
12856 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
12857 (set (match_dup 0) (neg:P (match_dup 0)))]
12860 (define_insn_and_split "*gtu<mode>_compare"
12861 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12863 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
12864 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
12866 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
12867 (gtu:P (match_dup 1) (match_dup 2)))]
12871 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
12872 (parallel [(set (match_dup 3)
12873 (compare:CC (neg:P (match_dup 0)) (const_int 0)))
12874 (set (match_dup 0) (neg:P (match_dup 0)))])]
12877 (define_insn_and_split "*plus_gtu<mode>"
12878 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
12879 (plus:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
12880 (match_operand:P 2 "reg_or_short_operand" "rI"))
12881 (match_operand:P 3 "reg_or_short_operand" "rI")))]
12884 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
12885 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
12886 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))]
12889 (define_insn_and_split "*plus_gtu<mode>_compare"
12890 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12892 (plus:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
12893 (match_operand:P 2 "reg_or_short_operand" "I,r,I,r"))
12894 (match_operand:P 3 "gpc_reg_operand" "r,r,r,r"))
12896 (set (match_operand:P 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12897 (plus:P (gtu:P (match_dup 1) (match_dup 2)) (match_dup 3)))]
12900 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
12901 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
12902 (parallel [(set (match_dup 4)
12903 (compare:CC (minus:P (match_dup 3) (match_dup 0))
12905 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))])]
12908 (define_insn "*neg_gtu<mode>"
12909 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
12910 (neg:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
12911 (match_operand:P 2 "reg_or_short_operand" "rI"))))]
12913 "subf%I2c %0,%1,%2\;subfe %0,%0,%0"
12914 [(set_attr "type" "two")
12915 (set_attr "length" "8")])
12918 ;; Define both directions of branch and return. If we need a reload
12919 ;; register, we'd rather use CR0 since it is much easier to copy a
12920 ;; register CC value to there.
12924 (if_then_else (match_operator 1 "branch_comparison_operator"
12926 "cc_reg_operand" "y")
12928 (label_ref (match_operand 0 "" ""))
12933 return output_cbranch (operands[1], \"%l0\", 0, insn);
12935 [(set_attr "type" "branch")])
12939 (if_then_else (match_operator 0 "branch_comparison_operator"
12941 "cc_reg_operand" "y")
12948 return output_cbranch (operands[0], NULL, 0, insn);
12950 [(set_attr "type" "jmpreg")
12951 (set_attr "length" "4")])
12955 (if_then_else (match_operator 1 "branch_comparison_operator"
12957 "cc_reg_operand" "y")
12960 (label_ref (match_operand 0 "" ""))))]
12964 return output_cbranch (operands[1], \"%l0\", 1, insn);
12966 [(set_attr "type" "branch")])
12970 (if_then_else (match_operator 0 "branch_comparison_operator"
12972 "cc_reg_operand" "y")
12979 return output_cbranch (operands[0], NULL, 1, insn);
12981 [(set_attr "type" "jmpreg")
12982 (set_attr "length" "4")])
12984 ;; Logic on condition register values.
12986 ; This pattern matches things like
12987 ; (set (reg:CCEQ 68) (compare:CCEQ (ior:SI (gt:SI (reg:CCFP 68) (const_int 0))
12988 ; (eq:SI (reg:CCFP 68) (const_int 0)))
12990 ; which are generated by the branch logic.
12991 ; Prefer destructive operations where BT = BB (for crXX BT,BA,BB)
12993 (define_insn "*cceq_ior_compare"
12994 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
12995 (compare:CCEQ (match_operator:SI 1 "boolean_operator"
12996 [(match_operator:SI 2
12997 "branch_positive_comparison_operator"
12999 "cc_reg_operand" "y,y")
13001 (match_operator:SI 4
13002 "branch_positive_comparison_operator"
13004 "cc_reg_operand" "0,y")
13008 "cr%q1 %E0,%j2,%j4"
13009 [(set_attr "type" "cr_logical,delayed_cr")])
13011 ; Why is the constant -1 here, but 1 in the previous pattern?
13012 ; Because ~1 has all but the low bit set.
13014 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13015 (compare:CCEQ (match_operator:SI 1 "boolean_or_operator"
13016 [(not:SI (match_operator:SI 2
13017 "branch_positive_comparison_operator"
13019 "cc_reg_operand" "y,y")
13021 (match_operator:SI 4
13022 "branch_positive_comparison_operator"
13024 "cc_reg_operand" "0,y")
13028 "cr%q1 %E0,%j2,%j4"
13029 [(set_attr "type" "cr_logical,delayed_cr")])
13031 (define_insn "*cceq_rev_compare"
13032 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13033 (compare:CCEQ (match_operator:SI 1
13034 "branch_positive_comparison_operator"
13036 "cc_reg_operand" "0,y")
13041 [(set_attr "type" "cr_logical,delayed_cr")])
13043 ;; If we are comparing the result of two comparisons, this can be done
13044 ;; using creqv or crxor.
13046 (define_insn_and_split ""
13047 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
13048 (compare:CCEQ (match_operator 1 "branch_comparison_operator"
13049 [(match_operand 2 "cc_reg_operand" "y")
13051 (match_operator 3 "branch_comparison_operator"
13052 [(match_operand 4 "cc_reg_operand" "y")
13057 [(set (match_dup 0) (compare:CCEQ (xor:SI (match_dup 1) (match_dup 3))
13061 int positive_1, positive_2;
13063 positive_1 = branch_positive_comparison_operator (operands[1],
13064 GET_MODE (operands[1]));
13065 positive_2 = branch_positive_comparison_operator (operands[3],
13066 GET_MODE (operands[3]));
13069 operands[1] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[2]),
13070 GET_CODE (operands[1])),
13072 operands[2], const0_rtx);
13073 else if (GET_MODE (operands[1]) != SImode)
13074 operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]), SImode,
13075 operands[2], const0_rtx);
13078 operands[3] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[4]),
13079 GET_CODE (operands[3])),
13081 operands[4], const0_rtx);
13082 else if (GET_MODE (operands[3]) != SImode)
13083 operands[3] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
13084 operands[4], const0_rtx);
13086 if (positive_1 == positive_2)
13088 operands[1] = gen_rtx_NOT (SImode, operands[1]);
13089 operands[5] = constm1_rtx;
13093 operands[5] = const1_rtx;
13097 ;; Unconditional branch and return.
13099 (define_insn "jump"
13101 (label_ref (match_operand 0 "" "")))]
13104 [(set_attr "type" "branch")])
13106 (define_insn "<return_str>return"
13110 [(set_attr "type" "jmpreg")])
13112 (define_expand "indirect_jump"
13113 [(set (pc) (match_operand 0 "register_operand" ""))])
13115 (define_insn "*indirect_jump<mode>"
13116 [(set (pc) (match_operand:P 0 "register_operand" "c,*l"))]
13121 [(set_attr "type" "jmpreg")])
13123 ;; Table jump for switch statements:
13124 (define_expand "tablejump"
13125 [(use (match_operand 0 "" ""))
13126 (use (label_ref (match_operand 1 "" "")))]
13131 emit_jump_insn (gen_tablejumpsi (operands[0], operands[1]));
13133 emit_jump_insn (gen_tablejumpdi (operands[0], operands[1]));
13137 (define_expand "tablejumpsi"
13138 [(set (match_dup 3)
13139 (plus:SI (match_operand:SI 0 "" "")
13141 (parallel [(set (pc) (match_dup 3))
13142 (use (label_ref (match_operand 1 "" "")))])]
13145 { operands[0] = force_reg (SImode, operands[0]);
13146 operands[2] = force_reg (SImode, gen_rtx_LABEL_REF (SImode, operands[1]));
13147 operands[3] = gen_reg_rtx (SImode);
13150 (define_expand "tablejumpdi"
13151 [(set (match_dup 4)
13152 (sign_extend:DI (match_operand:SI 0 "lwa_operand" "")))
13154 (plus:DI (match_dup 4)
13156 (parallel [(set (pc) (match_dup 3))
13157 (use (label_ref (match_operand 1 "" "")))])]
13160 { operands[2] = force_reg (DImode, gen_rtx_LABEL_REF (DImode, operands[1]));
13161 operands[3] = gen_reg_rtx (DImode);
13162 operands[4] = gen_reg_rtx (DImode);
13165 (define_insn "*tablejump<mode>_internal1"
13167 (match_operand:P 0 "register_operand" "c,*l"))
13168 (use (label_ref (match_operand 1 "" "")))]
13173 [(set_attr "type" "jmpreg")])
13180 (define_insn "group_ending_nop"
13181 [(unspec [(const_int 0)] UNSPEC_GRP_END_NOP)]
13185 if (rs6000_cpu_attr == CPU_POWER6)
13186 return \"ori 1,1,0\";
13187 return \"ori 2,2,0\";
13190 ;; Define the subtract-one-and-jump insns, starting with the template
13191 ;; so loop.c knows what to generate.
13193 (define_expand "doloop_end"
13194 [(use (match_operand 0 "" "")) ; loop pseudo
13195 (use (match_operand 1 "" "")) ; iterations; zero if unknown
13196 (use (match_operand 2 "" "")) ; max iterations
13197 (use (match_operand 3 "" "")) ; loop level
13198 (use (match_operand 4 "" "")) ; label
13199 (use (match_operand 5 "" ""))] ; flag: 1 if loop entered at top, else 0
13203 /* Only use this on innermost loops. */
13204 if (INTVAL (operands[3]) > 1)
13208 if (GET_MODE (operands[0]) != DImode)
13210 emit_jump_insn (gen_ctrdi (operands[0], operands[4]));
13214 if (GET_MODE (operands[0]) != SImode)
13216 emit_jump_insn (gen_ctrsi (operands[0], operands[4]));
13221 (define_expand "ctr<mode>"
13222 [(parallel [(set (pc)
13223 (if_then_else (ne (match_operand:P 0 "register_operand" "")
13225 (label_ref (match_operand 1 "" ""))
13228 (plus:P (match_dup 0)
13230 (clobber (match_scratch:CC 2 ""))
13231 (clobber (match_scratch:P 3 ""))])]
13235 ;; We need to be able to do this for any operand, including MEM, or we
13236 ;; will cause reload to blow up since we don't allow output reloads on
13238 ;; For the length attribute to be calculated correctly, the
13239 ;; label MUST be operand 0.
13241 (define_insn "*ctr<mode>_internal1"
13243 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
13245 (label_ref (match_operand 0 "" ""))
13247 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*c*l")
13248 (plus:P (match_dup 1)
13250 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
13251 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
13255 if (which_alternative != 0)
13257 else if (get_attr_length (insn) == 4)
13258 return \"bdnz %l0\";
13260 return \"bdz $+8\;b %l0\";
13262 [(set_attr "type" "branch")
13263 (set_attr "length" "*,12,16,16")])
13265 (define_insn "*ctr<mode>_internal2"
13267 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
13270 (label_ref (match_operand 0 "" ""))))
13271 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*c*l")
13272 (plus:P (match_dup 1)
13274 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
13275 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
13279 if (which_alternative != 0)
13281 else if (get_attr_length (insn) == 4)
13282 return \"bdz %l0\";
13284 return \"bdnz $+8\;b %l0\";
13286 [(set_attr "type" "branch")
13287 (set_attr "length" "*,12,16,16")])
13289 ;; Similar but use EQ
13291 (define_insn "*ctr<mode>_internal5"
13293 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
13295 (label_ref (match_operand 0 "" ""))
13297 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*c*l")
13298 (plus:P (match_dup 1)
13300 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
13301 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
13305 if (which_alternative != 0)
13307 else if (get_attr_length (insn) == 4)
13308 return \"bdz %l0\";
13310 return \"bdnz $+8\;b %l0\";
13312 [(set_attr "type" "branch")
13313 (set_attr "length" "*,12,16,16")])
13315 (define_insn "*ctr<mode>_internal6"
13317 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
13320 (label_ref (match_operand 0 "" ""))))
13321 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*c*l")
13322 (plus:P (match_dup 1)
13324 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
13325 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
13329 if (which_alternative != 0)
13331 else if (get_attr_length (insn) == 4)
13332 return \"bdnz %l0\";
13334 return \"bdz $+8\;b %l0\";
13336 [(set_attr "type" "branch")
13337 (set_attr "length" "*,12,16,16")])
13339 ;; Now the splitters if we could not allocate the CTR register
13343 (if_then_else (match_operator 2 "comparison_operator"
13344 [(match_operand:P 1 "gpc_reg_operand" "")
13346 (match_operand 5 "" "")
13347 (match_operand 6 "" "")))
13348 (set (match_operand:P 0 "gpc_reg_operand" "")
13349 (plus:P (match_dup 1) (const_int -1)))
13350 (clobber (match_scratch:CC 3 ""))
13351 (clobber (match_scratch:P 4 ""))]
13353 [(parallel [(set (match_dup 3)
13354 (compare:CC (plus:P (match_dup 1)
13358 (plus:P (match_dup 1)
13360 (set (pc) (if_then_else (match_dup 7)
13364 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
13365 operands[3], const0_rtx); }")
13369 (if_then_else (match_operator 2 "comparison_operator"
13370 [(match_operand:P 1 "gpc_reg_operand" "")
13372 (match_operand 5 "" "")
13373 (match_operand 6 "" "")))
13374 (set (match_operand:P 0 "nonimmediate_operand" "")
13375 (plus:P (match_dup 1) (const_int -1)))
13376 (clobber (match_scratch:CC 3 ""))
13377 (clobber (match_scratch:P 4 ""))]
13378 "reload_completed && ! gpc_reg_operand (operands[0], SImode)"
13379 [(parallel [(set (match_dup 3)
13380 (compare:CC (plus:P (match_dup 1)
13384 (plus:P (match_dup 1)
13388 (set (pc) (if_then_else (match_dup 7)
13392 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
13393 operands[3], const0_rtx); }")
13395 (define_insn "trap"
13396 [(trap_if (const_int 1) (const_int 0))]
13399 [(set_attr "type" "trap")])
13401 (define_expand "ctrap<mode>4"
13402 [(trap_if (match_operator 0 "ordered_comparison_operator"
13403 [(match_operand:GPR 1 "register_operand")
13404 (match_operand:GPR 2 "reg_or_short_operand")])
13405 (match_operand 3 "zero_constant" ""))]
13410 [(trap_if (match_operator 0 "ordered_comparison_operator"
13411 [(match_operand:GPR 1 "register_operand" "r")
13412 (match_operand:GPR 2 "reg_or_short_operand" "rI")])
13415 "t<wd>%V0%I2 %1,%2"
13416 [(set_attr "type" "trap")])
13418 ;; Insns related to generating the function prologue and epilogue.
13420 (define_expand "prologue"
13421 [(use (const_int 0))]
13424 rs6000_emit_prologue ();
13425 if (!TARGET_SCHED_PROLOG)
13426 emit_insn (gen_blockage ());
13430 (define_insn "*movesi_from_cr_one"
13431 [(match_parallel 0 "mfcr_operation"
13432 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
13433 (unspec:SI [(match_operand:CC 2 "cc_reg_operand" "y")
13434 (match_operand 3 "immediate_operand" "n")]
13435 UNSPEC_MOVESI_FROM_CR))])]
13441 for (i = 0; i < XVECLEN (operands[0], 0); i++)
13443 mask = INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
13444 operands[4] = GEN_INT (mask);
13445 output_asm_insn (\"mfcr %1,%4\", operands);
13449 [(set_attr "type" "mfcrf")])
13451 (define_insn "movesi_from_cr"
13452 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13453 (unspec:SI [(reg:CC CR0_REGNO) (reg:CC CR1_REGNO)
13454 (reg:CC CR2_REGNO) (reg:CC CR3_REGNO)
13455 (reg:CC CR4_REGNO) (reg:CC CR5_REGNO)
13456 (reg:CC CR6_REGNO) (reg:CC CR7_REGNO)]
13457 UNSPEC_MOVESI_FROM_CR))]
13460 [(set_attr "type" "mfcr")])
13462 (define_insn "*stmw"
13463 [(match_parallel 0 "stmw_operation"
13464 [(set (match_operand:SI 1 "memory_operand" "=m")
13465 (match_operand:SI 2 "gpc_reg_operand" "r"))])]
13468 [(set_attr "type" "store_ux")])
13470 ; The following comment applies to:
13474 ; return_and_restore_gpregs*
13475 ; return_and_restore_fpregs*
13476 ; return_and_restore_fpregs_aix*
13478 ; The out-of-line save / restore functions expects one input argument.
13479 ; Since those are not standard call_insn's, we must avoid using
13480 ; MATCH_OPERAND for that argument. That way the register rename
13481 ; optimization will not try to rename this register.
13482 ; Each pattern is repeated for each possible register number used in
13483 ; various ABIs (r11, r1, and for some functions r12)
13485 (define_insn "*save_gpregs_<mode>_r11"
13486 [(match_parallel 0 "any_parallel_operand"
13487 [(clobber (reg:P 65))
13488 (use (match_operand:P 1 "symbol_ref_operand" "s"))
13490 (set (match_operand:P 2 "memory_operand" "=m")
13491 (match_operand:P 3 "gpc_reg_operand" "r"))])]
13494 [(set_attr "type" "branch")
13495 (set_attr "length" "4")])
13497 (define_insn "*save_gpregs_<mode>_r12"
13498 [(match_parallel 0 "any_parallel_operand"
13499 [(clobber (reg:P 65))
13500 (use (match_operand:P 1 "symbol_ref_operand" "s"))
13502 (set (match_operand:P 2 "memory_operand" "=m")
13503 (match_operand:P 3 "gpc_reg_operand" "r"))])]
13506 [(set_attr "type" "branch")
13507 (set_attr "length" "4")])
13509 (define_insn "*save_gpregs_<mode>_r1"
13510 [(match_parallel 0 "any_parallel_operand"
13511 [(clobber (reg:P 65))
13512 (use (match_operand:P 1 "symbol_ref_operand" "s"))
13514 (set (match_operand:P 2 "memory_operand" "=m")
13515 (match_operand:P 3 "gpc_reg_operand" "r"))])]
13518 [(set_attr "type" "branch")
13519 (set_attr "length" "4")])
13521 (define_insn "*save_fpregs_<mode>_r11"
13522 [(match_parallel 0 "any_parallel_operand"
13523 [(clobber (reg:P 65))
13524 (use (match_operand:P 1 "symbol_ref_operand" "s"))
13526 (set (match_operand:DF 2 "memory_operand" "=m")
13527 (match_operand:DF 3 "gpc_reg_operand" "d"))])]
13530 [(set_attr "type" "branch")
13531 (set_attr "length" "4")])
13533 (define_insn "*save_fpregs_<mode>_r12"
13534 [(match_parallel 0 "any_parallel_operand"
13535 [(clobber (reg:P 65))
13536 (use (match_operand:P 1 "symbol_ref_operand" "s"))
13538 (set (match_operand:DF 2 "memory_operand" "=m")
13539 (match_operand:DF 3 "gpc_reg_operand" "d"))])]
13542 [(set_attr "type" "branch")
13543 (set_attr "length" "4")])
13545 (define_insn "*save_fpregs_<mode>_r1"
13546 [(match_parallel 0 "any_parallel_operand"
13547 [(clobber (reg:P 65))
13548 (use (match_operand:P 1 "symbol_ref_operand" "s"))
13550 (set (match_operand:DF 2 "memory_operand" "=m")
13551 (match_operand:DF 3 "gpc_reg_operand" "d"))])]
13554 [(set_attr "type" "branch")
13555 (set_attr "length" "4")])
13557 ; This is to explain that changes to the stack pointer should
13558 ; not be moved over loads from or stores to stack memory.
13559 (define_insn "stack_tie"
13560 [(match_parallel 0 "tie_operand"
13561 [(set (mem:BLK (reg 1)) (const_int 0))])]
13564 [(set_attr "length" "0")])
13566 (define_expand "epilogue"
13567 [(use (const_int 0))]
13570 if (!TARGET_SCHED_PROLOG)
13571 emit_insn (gen_blockage ());
13572 rs6000_emit_epilogue (FALSE);
13576 ; On some processors, doing the mtcrf one CC register at a time is
13577 ; faster (like on the 604e). On others, doing them all at once is
13578 ; faster; for instance, on the 601 and 750.
13580 (define_expand "movsi_to_cr_one"
13581 [(set (match_operand:CC 0 "cc_reg_operand" "")
13582 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "")
13583 (match_dup 2)] UNSPEC_MOVESI_TO_CR))]
13585 "operands[2] = GEN_INT (1 << (75 - REGNO (operands[0])));")
13587 (define_insn "*movsi_to_cr"
13588 [(match_parallel 0 "mtcrf_operation"
13589 [(set (match_operand:CC 1 "cc_reg_operand" "=y")
13590 (unspec:CC [(match_operand:SI 2 "gpc_reg_operand" "r")
13591 (match_operand 3 "immediate_operand" "n")]
13592 UNSPEC_MOVESI_TO_CR))])]
13598 for (i = 0; i < XVECLEN (operands[0], 0); i++)
13599 mask |= INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
13600 operands[4] = GEN_INT (mask);
13601 return \"mtcrf %4,%2\";
13603 [(set_attr "type" "mtcr")])
13605 (define_insn "*mtcrfsi"
13606 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
13607 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
13608 (match_operand 2 "immediate_operand" "n")]
13609 UNSPEC_MOVESI_TO_CR))]
13610 "GET_CODE (operands[0]) == REG
13611 && CR_REGNO_P (REGNO (operands[0]))
13612 && GET_CODE (operands[2]) == CONST_INT
13613 && INTVAL (operands[2]) == 1 << (75 - REGNO (operands[0]))"
13615 [(set_attr "type" "mtcr")])
13617 ; The load-multiple instructions have similar properties.
13618 ; Note that "load_multiple" is a name known to the machine-independent
13619 ; code that actually corresponds to the PowerPC load-string.
13621 (define_insn "*lmw"
13622 [(match_parallel 0 "lmw_operation"
13623 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
13624 (match_operand:SI 2 "memory_operand" "m"))])]
13627 [(set_attr "type" "load_ux")
13628 (set_attr "cell_micro" "always")])
13630 (define_insn "*return_internal_<mode>"
13632 (use (match_operand:P 0 "register_operand" "lc"))]
13635 [(set_attr "type" "jmpreg")])
13637 ; FIXME: This would probably be somewhat simpler if the Cygnus sibcall
13638 ; stuff was in GCC. Oh, and "any_parallel_operand" is a bit flexible...
13640 ; The following comment applies to:
13644 ; return_and_restore_gpregs*
13645 ; return_and_restore_fpregs*
13646 ; return_and_restore_fpregs_aix*
13648 ; The out-of-line save / restore functions expects one input argument.
13649 ; Since those are not standard call_insn's, we must avoid using
13650 ; MATCH_OPERAND for that argument. That way the register rename
13651 ; optimization will not try to rename this register.
13652 ; Each pattern is repeated for each possible register number used in
13653 ; various ABIs (r11, r1, and for some functions r12)
13655 (define_insn "*restore_gpregs_<mode>_r11"
13656 [(match_parallel 0 "any_parallel_operand"
13657 [(clobber (match_operand:P 1 "register_operand" "=l"))
13658 (use (match_operand:P 2 "symbol_ref_operand" "s"))
13660 (set (match_operand:P 3 "gpc_reg_operand" "=r")
13661 (match_operand:P 4 "memory_operand" "m"))])]
13664 [(set_attr "type" "branch")
13665 (set_attr "length" "4")])
13667 (define_insn "*restore_gpregs_<mode>_r12"
13668 [(match_parallel 0 "any_parallel_operand"
13669 [(clobber (match_operand:P 1 "register_operand" "=l"))
13670 (use (match_operand:P 2 "symbol_ref_operand" "s"))
13672 (set (match_operand:P 3 "gpc_reg_operand" "=r")
13673 (match_operand:P 4 "memory_operand" "m"))])]
13676 [(set_attr "type" "branch")
13677 (set_attr "length" "4")])
13679 (define_insn "*restore_gpregs_<mode>_r1"
13680 [(match_parallel 0 "any_parallel_operand"
13681 [(clobber (match_operand:P 1 "register_operand" "=l"))
13682 (use (match_operand:P 2 "symbol_ref_operand" "s"))
13684 (set (match_operand:P 3 "gpc_reg_operand" "=r")
13685 (match_operand:P 4 "memory_operand" "m"))])]
13688 [(set_attr "type" "branch")
13689 (set_attr "length" "4")])
13691 (define_insn "*return_and_restore_gpregs_<mode>_r11"
13692 [(match_parallel 0 "any_parallel_operand"
13694 (clobber (match_operand:P 1 "register_operand" "=l"))
13695 (use (match_operand:P 2 "symbol_ref_operand" "s"))
13697 (set (match_operand:P 3 "gpc_reg_operand" "=r")
13698 (match_operand:P 4 "memory_operand" "m"))])]
13701 [(set_attr "type" "branch")
13702 (set_attr "length" "4")])
13704 (define_insn "*return_and_restore_gpregs_<mode>_r12"
13705 [(match_parallel 0 "any_parallel_operand"
13707 (clobber (match_operand:P 1 "register_operand" "=l"))
13708 (use (match_operand:P 2 "symbol_ref_operand" "s"))
13710 (set (match_operand:P 3 "gpc_reg_operand" "=r")
13711 (match_operand:P 4 "memory_operand" "m"))])]
13714 [(set_attr "type" "branch")
13715 (set_attr "length" "4")])
13717 (define_insn "*return_and_restore_gpregs_<mode>_r1"
13718 [(match_parallel 0 "any_parallel_operand"
13720 (clobber (match_operand:P 1 "register_operand" "=l"))
13721 (use (match_operand:P 2 "symbol_ref_operand" "s"))
13723 (set (match_operand:P 3 "gpc_reg_operand" "=r")
13724 (match_operand:P 4 "memory_operand" "m"))])]
13727 [(set_attr "type" "branch")
13728 (set_attr "length" "4")])
13730 (define_insn "*return_and_restore_fpregs_<mode>_r11"
13731 [(match_parallel 0 "any_parallel_operand"
13733 (clobber (match_operand:P 1 "register_operand" "=l"))
13734 (use (match_operand:P 2 "symbol_ref_operand" "s"))
13736 (set (match_operand:DF 3 "gpc_reg_operand" "=d")
13737 (match_operand:DF 4 "memory_operand" "m"))])]
13740 [(set_attr "type" "branch")
13741 (set_attr "length" "4")])
13743 (define_insn "*return_and_restore_fpregs_<mode>_r12"
13744 [(match_parallel 0 "any_parallel_operand"
13746 (clobber (match_operand:P 1 "register_operand" "=l"))
13747 (use (match_operand:P 2 "symbol_ref_operand" "s"))
13749 (set (match_operand:DF 3 "gpc_reg_operand" "=d")
13750 (match_operand:DF 4 "memory_operand" "m"))])]
13753 [(set_attr "type" "branch")
13754 (set_attr "length" "4")])
13756 (define_insn "*return_and_restore_fpregs_<mode>_r1"
13757 [(match_parallel 0 "any_parallel_operand"
13759 (clobber (match_operand:P 1 "register_operand" "=l"))
13760 (use (match_operand:P 2 "symbol_ref_operand" "s"))
13762 (set (match_operand:DF 3 "gpc_reg_operand" "=d")
13763 (match_operand:DF 4 "memory_operand" "m"))])]
13766 [(set_attr "type" "branch")
13767 (set_attr "length" "4")])
13769 (define_insn "*return_and_restore_fpregs_aix_<mode>_r11"
13770 [(match_parallel 0 "any_parallel_operand"
13772 (use (match_operand:P 1 "register_operand" "l"))
13773 (use (match_operand:P 2 "symbol_ref_operand" "s"))
13775 (set (match_operand:DF 3 "gpc_reg_operand" "=d")
13776 (match_operand:DF 4 "memory_operand" "m"))])]
13779 [(set_attr "type" "branch")
13780 (set_attr "length" "4")])
13782 (define_insn "*return_and_restore_fpregs_aix_<mode>_r1"
13783 [(match_parallel 0 "any_parallel_operand"
13785 (use (match_operand:P 1 "register_operand" "l"))
13786 (use (match_operand:P 2 "symbol_ref_operand" "s"))
13788 (set (match_operand:DF 3 "gpc_reg_operand" "=d")
13789 (match_operand:DF 4 "memory_operand" "m"))])]
13792 [(set_attr "type" "branch")
13793 (set_attr "length" "4")])
13795 ; This is used in compiling the unwind routines.
13796 (define_expand "eh_return"
13797 [(use (match_operand 0 "general_operand" ""))]
13802 emit_insn (gen_eh_set_lr_si (operands[0]));
13804 emit_insn (gen_eh_set_lr_di (operands[0]));
13808 ; We can't expand this before we know where the link register is stored.
13809 (define_insn "eh_set_lr_<mode>"
13810 [(unspec_volatile [(match_operand:P 0 "register_operand" "r")]
13812 (clobber (match_scratch:P 1 "=&b"))]
13817 [(unspec_volatile [(match_operand 0 "register_operand" "")] UNSPECV_EH_RR)
13818 (clobber (match_scratch 1 ""))]
13823 rs6000_emit_eh_reg_restore (operands[0], operands[1]);
13827 (define_insn "prefetch"
13828 [(prefetch (match_operand 0 "indexed_or_indirect_address" "a")
13829 (match_operand:SI 1 "const_int_operand" "n")
13830 (match_operand:SI 2 "const_int_operand" "n"))]
13834 if (GET_CODE (operands[0]) == REG)
13835 return INTVAL (operands[1]) ? \"dcbtst 0,%0\" : \"dcbt 0,%0\";
13836 return INTVAL (operands[1]) ? \"dcbtst %a0\" : \"dcbt %a0\";
13838 [(set_attr "type" "load")])
13840 (define_insn "bpermd_<mode>"
13841 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13842 (unspec:P [(match_operand:P 1 "gpc_reg_operand" "r")
13843 (match_operand:P 2 "gpc_reg_operand" "r")] UNSPEC_BPERM))]
13846 [(set_attr "type" "integer")])
13849 ;; Builtin fma support. Handle
13850 ;; Note that the conditions for expansion are in the FMA_F iterator.
13852 (define_expand "fma<mode>4"
13853 [(set (match_operand:FMA_F 0 "register_operand" "")
13855 (match_operand:FMA_F 1 "register_operand" "")
13856 (match_operand:FMA_F 2 "register_operand" "")
13857 (match_operand:FMA_F 3 "register_operand" "")))]
13861 ; Altivec only has fma and nfms.
13862 (define_expand "fms<mode>4"
13863 [(set (match_operand:FMA_F 0 "register_operand" "")
13865 (match_operand:FMA_F 1 "register_operand" "")
13866 (match_operand:FMA_F 2 "register_operand" "")
13867 (neg:FMA_F (match_operand:FMA_F 3 "register_operand" ""))))]
13868 "!VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
13871 ;; If signed zeros are ignored, -(a * b - c) = -a * b + c.
13872 (define_expand "fnma<mode>4"
13873 [(set (match_operand:FMA_F 0 "register_operand" "")
13876 (match_operand:FMA_F 1 "register_operand" "")
13877 (match_operand:FMA_F 2 "register_operand" "")
13878 (neg:FMA_F (match_operand:FMA_F 3 "register_operand" "")))))]
13879 "!HONOR_SIGNED_ZEROS (<MODE>mode)"
13882 ;; If signed zeros are ignored, -(a * b + c) = -a * b - c.
13883 (define_expand "fnms<mode>4"
13884 [(set (match_operand:FMA_F 0 "register_operand" "")
13887 (match_operand:FMA_F 1 "register_operand" "")
13888 (match_operand:FMA_F 2 "register_operand" "")
13889 (match_operand:FMA_F 3 "register_operand" ""))))]
13890 "!HONOR_SIGNED_ZEROS (<MODE>mode) && !VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
13893 ; Not an official optab name, but used from builtins.
13894 (define_expand "nfma<mode>4"
13895 [(set (match_operand:FMA_F 0 "register_operand" "")
13898 (match_operand:FMA_F 1 "register_operand" "")
13899 (match_operand:FMA_F 2 "register_operand" "")
13900 (match_operand:FMA_F 3 "register_operand" ""))))]
13901 "!VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
13904 ; Not an official optab name, but used from builtins.
13905 (define_expand "nfms<mode>4"
13906 [(set (match_operand:FMA_F 0 "register_operand" "")
13909 (match_operand:FMA_F 1 "register_operand" "")
13910 (match_operand:FMA_F 2 "register_operand" "")
13911 (neg:FMA_F (match_operand:FMA_F 3 "register_operand" "")))))]
13915 (define_expand "rs6000_get_timebase"
13916 [(use (match_operand:DI 0 "gpc_reg_operand" ""))]
13919 if (TARGET_POWERPC64)
13920 emit_insn (gen_rs6000_mftb_di (operands[0]));
13922 emit_insn (gen_rs6000_get_timebase_ppc32 (operands[0]));
13926 (define_insn "rs6000_get_timebase_ppc32"
13927 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13928 (unspec_volatile:DI [(const_int 0)] UNSPECV_MFTB))
13929 (clobber (match_scratch:SI 1 "=r"))
13930 (clobber (match_scratch:CC 2 "=y"))]
13931 "!TARGET_POWERPC64"
13933 if (WORDS_BIG_ENDIAN)
13936 return "mfspr %0,269\;"
13944 return "mftbu %0\;"
13953 return "mfspr %L0,269\;"
13961 return "mftbu %L0\;"
13969 (define_insn "rs6000_mftb_<mode>"
13970 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13971 (unspec_volatile:P [(const_int 0)] UNSPECV_MFTB))]
13975 return "mfspr %0,268";
13982 (include "sync.md")
13983 (include "vector.md")
13985 (include "altivec.md")
13988 (include "paired.md")