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,*")])
1993 ;; We are always BITS_BIG_ENDIAN, so the (const_int 16) below is
1994 ;; correct for -mlittle as well as -mbig.
1996 [(set (match_operand:HI 0 "gpc_reg_operand" "")
1997 (bswap:HI (match_operand:HI 1 "gpc_reg_operand" "")))
1998 (clobber (match_operand:SI 2 "gpc_reg_operand" ""))]
2001 (zero_extract:SI (match_dup 4)
2005 (and:SI (ashift:SI (match_dup 4)
2007 (const_int 65280))) ;; 0xff00
2009 (ior:SI (match_dup 3)
2013 operands[3] = simplify_gen_subreg (SImode, operands[0], HImode, 0);
2014 operands[4] = simplify_gen_subreg (SImode, operands[1], HImode, 0);
2017 (define_insn "*bswapsi2_extenddi"
2018 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
2020 (bswap:SI (match_operand:SI 1 "memory_operand" "Z"))))]
2023 [(set_attr "length" "4")
2024 (set_attr "type" "load")])
2026 (define_expand "bswapsi2"
2027 [(set (match_operand:SI 0 "reg_or_mem_operand" "")
2029 (match_operand:SI 1 "reg_or_mem_operand" "")))]
2032 if (!REG_P (operands[0]) && !REG_P (operands[1]))
2033 operands[1] = force_reg (SImode, operands[1]);
2036 (define_insn "*bswapsi2_internal"
2037 [(set (match_operand:SI 0 "reg_or_mem_operand" "=r,Z,&r")
2039 (match_operand:SI 1 "reg_or_mem_operand" "Z,r,r")))]
2045 [(set_attr "length" "4,4,12")
2046 (set_attr "type" "load,store,*")])
2048 ;; We are always BITS_BIG_ENDIAN, so the bit positions below in
2049 ;; zero_extract insns do not change for -mlittle.
2051 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2052 (bswap:SI (match_operand:SI 1 "gpc_reg_operand" "")))]
2055 (rotate:SI (match_dup 1) (const_int 8)))
2056 (set (zero_extract:SI (match_dup 0)
2060 (set (zero_extract:SI (match_dup 0)
2063 (rotate:SI (match_dup 1)
2067 (define_expand "bswapdi2"
2068 [(parallel [(set (match_operand:DI 0 "reg_or_mem_operand" "")
2070 (match_operand:DI 1 "reg_or_mem_operand" "")))
2071 (clobber (match_scratch:DI 2 ""))
2072 (clobber (match_scratch:DI 3 ""))
2073 (clobber (match_scratch:DI 4 ""))])]
2076 if (!REG_P (operands[0]) && !REG_P (operands[1]))
2077 operands[1] = force_reg (DImode, operands[1]);
2079 if (!TARGET_POWERPC64)
2081 /* 32-bit mode needs fewer scratch registers, but 32-bit addressing mode
2082 that uses 64-bit registers needs the same scratch registers as 64-bit
2084 emit_insn (gen_bswapdi2_32bit (operands[0], operands[1]));
2089 ;; Power7/cell has ldbrx/stdbrx, so use it directly
2090 (define_insn "*bswapdi2_ldbrx"
2091 [(set (match_operand:DI 0 "reg_or_mem_operand" "=&r,Z,??&r")
2092 (bswap:DI (match_operand:DI 1 "reg_or_mem_operand" "Z,r,r")))
2093 (clobber (match_scratch:DI 2 "=X,X,&r"))
2094 (clobber (match_scratch:DI 3 "=X,X,&r"))
2095 (clobber (match_scratch:DI 4 "=X,X,&r"))]
2096 "TARGET_POWERPC64 && TARGET_LDBRX
2097 && (REG_P (operands[0]) || REG_P (operands[1]))"
2102 [(set_attr "length" "4,4,36")
2103 (set_attr "type" "load,store,*")])
2105 ;; Non-power7/cell, fall back to use lwbrx/stwbrx
2106 (define_insn "*bswapdi2_64bit"
2107 [(set (match_operand:DI 0 "reg_or_mem_operand" "=&r,Z,??&r")
2108 (bswap:DI (match_operand:DI 1 "reg_or_mem_operand" "Z,r,r")))
2109 (clobber (match_scratch:DI 2 "=&b,&b,&r"))
2110 (clobber (match_scratch:DI 3 "=&r,&r,&r"))
2111 (clobber (match_scratch:DI 4 "=&r,X,&r"))]
2112 "TARGET_POWERPC64 && !TARGET_LDBRX
2113 && (REG_P (operands[0]) || REG_P (operands[1]))
2114 && !(MEM_P (operands[0]) && MEM_VOLATILE_P (operands[0]))
2115 && !(MEM_P (operands[1]) && MEM_VOLATILE_P (operands[1]))"
2117 [(set_attr "length" "16,12,36")])
2120 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2121 (bswap:DI (match_operand:DI 1 "indexed_or_indirect_operand" "")))
2122 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
2123 (clobber (match_operand:DI 3 "gpc_reg_operand" ""))
2124 (clobber (match_operand:DI 4 "gpc_reg_operand" ""))]
2125 "TARGET_POWERPC64 && !TARGET_LDBRX && reload_completed"
2129 rtx dest = operands[0];
2130 rtx src = operands[1];
2131 rtx op2 = operands[2];
2132 rtx op3 = operands[3];
2133 rtx op4 = operands[4];
2134 rtx op3_32 = simplify_gen_subreg (SImode, op3, DImode,
2135 BYTES_BIG_ENDIAN ? 4 : 0);
2136 rtx op4_32 = simplify_gen_subreg (SImode, op4, DImode,
2137 BYTES_BIG_ENDIAN ? 4 : 0);
2143 addr1 = XEXP (src, 0);
2144 if (GET_CODE (addr1) == PLUS)
2146 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2147 if (TARGET_AVOID_XFORM)
2149 emit_insn (gen_add3_insn (op2, XEXP (addr1, 1), op2));
2153 addr2 = gen_rtx_PLUS (Pmode, op2, XEXP (addr1, 1));
2155 else if (TARGET_AVOID_XFORM)
2157 emit_insn (gen_add3_insn (op2, addr1, GEN_INT (4)));
2162 emit_move_insn (op2, GEN_INT (4));
2163 addr2 = gen_rtx_PLUS (Pmode, op2, addr1);
2166 if (BYTES_BIG_ENDIAN)
2168 word_high = change_address (src, SImode, addr1);
2169 word_low = change_address (src, SImode, addr2);
2173 word_high = change_address (src, SImode, addr2);
2174 word_low = change_address (src, SImode, addr1);
2177 emit_insn (gen_bswapsi2 (op3_32, word_low));
2178 emit_insn (gen_bswapsi2 (op4_32, word_high));
2179 emit_insn (gen_ashldi3 (dest, op3, GEN_INT (32)));
2180 emit_insn (gen_iordi3 (dest, dest, op4));
2184 [(set (match_operand:DI 0 "indexed_or_indirect_operand" "")
2185 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2186 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
2187 (clobber (match_operand:DI 3 "gpc_reg_operand" ""))
2188 (clobber (match_operand:DI 4 "" ""))]
2189 "TARGET_POWERPC64 && !TARGET_LDBRX && reload_completed"
2193 rtx dest = operands[0];
2194 rtx src = operands[1];
2195 rtx op2 = operands[2];
2196 rtx op3 = operands[3];
2197 rtx src_si = simplify_gen_subreg (SImode, src, DImode,
2198 BYTES_BIG_ENDIAN ? 4 : 0);
2199 rtx op3_si = simplify_gen_subreg (SImode, op3, DImode,
2200 BYTES_BIG_ENDIAN ? 4 : 0);
2206 addr1 = XEXP (dest, 0);
2207 if (GET_CODE (addr1) == PLUS)
2209 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2210 if (TARGET_AVOID_XFORM)
2212 emit_insn (gen_add3_insn (op2, XEXP (addr1, 1), op2));
2216 addr2 = gen_rtx_PLUS (Pmode, op2, XEXP (addr1, 1));
2218 else if (TARGET_AVOID_XFORM)
2220 emit_insn (gen_add3_insn (op2, addr1, GEN_INT (4)));
2225 emit_move_insn (op2, GEN_INT (4));
2226 addr2 = gen_rtx_PLUS (Pmode, op2, addr1);
2229 emit_insn (gen_lshrdi3 (op3, src, GEN_INT (32)));
2230 if (BYTES_BIG_ENDIAN)
2232 word_high = change_address (dest, SImode, addr1);
2233 word_low = change_address (dest, SImode, addr2);
2237 word_high = change_address (dest, SImode, addr2);
2238 word_low = change_address (dest, SImode, addr1);
2240 emit_insn (gen_bswapsi2 (word_high, src_si));
2241 emit_insn (gen_bswapsi2 (word_low, op3_si));
2245 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2246 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2247 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
2248 (clobber (match_operand:DI 3 "gpc_reg_operand" ""))
2249 (clobber (match_operand:DI 4 "" ""))]
2250 "TARGET_POWERPC64 && reload_completed"
2254 rtx dest = operands[0];
2255 rtx src = operands[1];
2256 rtx op2 = operands[2];
2257 rtx op3 = operands[3];
2258 int lo_off = BYTES_BIG_ENDIAN ? 4 : 0;
2259 rtx dest_si = simplify_gen_subreg (SImode, dest, DImode, lo_off);
2260 rtx src_si = simplify_gen_subreg (SImode, src, DImode, lo_off);
2261 rtx op2_si = simplify_gen_subreg (SImode, op2, DImode, lo_off);
2262 rtx op3_si = simplify_gen_subreg (SImode, op3, DImode, lo_off);
2264 emit_insn (gen_lshrdi3 (op2, src, GEN_INT (32)));
2265 emit_insn (gen_bswapsi2 (dest_si, src_si));
2266 emit_insn (gen_bswapsi2 (op3_si, op2_si));
2267 emit_insn (gen_ashldi3 (dest, dest, GEN_INT (32)));
2268 emit_insn (gen_iordi3 (dest, dest, op3));
2271 (define_insn "bswapdi2_32bit"
2272 [(set (match_operand:DI 0 "reg_or_mem_operand" "=&r,Z,??&r")
2273 (bswap:DI (match_operand:DI 1 "reg_or_mem_operand" "Z,r,r")))
2274 (clobber (match_scratch:SI 2 "=&b,&b,X"))]
2275 "!TARGET_POWERPC64 && (REG_P (operands[0]) || REG_P (operands[1]))"
2277 [(set_attr "length" "16,12,36")])
2280 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2281 (bswap:DI (match_operand:DI 1 "indexed_or_indirect_operand" "")))
2282 (clobber (match_operand:SI 2 "gpc_reg_operand" ""))]
2283 "!TARGET_POWERPC64 && reload_completed"
2287 rtx dest = operands[0];
2288 rtx src = operands[1];
2289 rtx op2 = operands[2];
2290 rtx dest1 = simplify_gen_subreg (SImode, dest, DImode, 0);
2291 rtx dest2 = simplify_gen_subreg (SImode, dest, DImode, 4);
2297 addr1 = XEXP (src, 0);
2298 if (GET_CODE (addr1) == PLUS)
2300 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2301 if (TARGET_AVOID_XFORM)
2303 emit_insn (gen_add3_insn (op2, XEXP (addr1, 1), op2));
2307 addr2 = gen_rtx_PLUS (SImode, op2, XEXP (addr1, 1));
2309 else if (TARGET_AVOID_XFORM)
2311 emit_insn (gen_add3_insn (op2, addr1, GEN_INT (4)));
2316 emit_move_insn (op2, GEN_INT (4));
2317 addr2 = gen_rtx_PLUS (SImode, op2, addr1);
2320 word1 = change_address (src, SImode, addr1);
2321 word2 = change_address (src, SImode, addr2);
2323 emit_insn (gen_bswapsi2 (dest2, word1));
2324 emit_insn (gen_bswapsi2 (dest1, word2));
2328 [(set (match_operand:DI 0 "indexed_or_indirect_operand" "")
2329 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2330 (clobber (match_operand:SI 2 "gpc_reg_operand" ""))]
2331 "!TARGET_POWERPC64 && reload_completed"
2335 rtx dest = operands[0];
2336 rtx src = operands[1];
2337 rtx op2 = operands[2];
2338 rtx src1 = simplify_gen_subreg (SImode, src, DImode, 0);
2339 rtx src2 = simplify_gen_subreg (SImode, src, DImode, 4);
2345 addr1 = XEXP (dest, 0);
2346 if (GET_CODE (addr1) == PLUS)
2348 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2349 if (TARGET_AVOID_XFORM)
2351 emit_insn (gen_add3_insn (op2, XEXP (addr1, 1), op2));
2355 addr2 = gen_rtx_PLUS (SImode, op2, XEXP (addr1, 1));
2357 else if (TARGET_AVOID_XFORM)
2359 emit_insn (gen_add3_insn (op2, addr1, GEN_INT (4)));
2364 emit_move_insn (op2, GEN_INT (4));
2365 addr2 = gen_rtx_PLUS (SImode, op2, addr1);
2368 word1 = change_address (dest, SImode, addr1);
2369 word2 = change_address (dest, SImode, addr2);
2371 emit_insn (gen_bswapsi2 (word2, src1));
2372 emit_insn (gen_bswapsi2 (word1, src2));
2376 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2377 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2378 (clobber (match_operand:SI 2 "" ""))]
2379 "!TARGET_POWERPC64 && reload_completed"
2383 rtx dest = operands[0];
2384 rtx src = operands[1];
2385 rtx src1 = simplify_gen_subreg (SImode, src, DImode, 0);
2386 rtx src2 = simplify_gen_subreg (SImode, src, DImode, 4);
2387 rtx dest1 = simplify_gen_subreg (SImode, dest, DImode, 0);
2388 rtx dest2 = simplify_gen_subreg (SImode, dest, DImode, 4);
2390 emit_insn (gen_bswapsi2 (dest1, src2));
2391 emit_insn (gen_bswapsi2 (dest2, src1));
2394 (define_insn "mulsi3"
2395 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2396 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2397 (match_operand:SI 2 "reg_or_short_operand" "r,I")))]
2403 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
2404 (const_string "imul3")
2405 (match_operand:SI 2 "short_cint_operand" "")
2406 (const_string "imul2")]
2407 (const_string "imul")))])
2409 (define_insn "*mulsi3_internal1"
2410 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2411 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2412 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2414 (clobber (match_scratch:SI 3 "=r,r"))]
2419 [(set_attr "type" "imul_compare")
2420 (set_attr "length" "4,8")])
2423 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
2424 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2425 (match_operand:SI 2 "gpc_reg_operand" ""))
2427 (clobber (match_scratch:SI 3 ""))]
2430 (mult:SI (match_dup 1) (match_dup 2)))
2432 (compare:CC (match_dup 3)
2436 (define_insn "*mulsi3_internal2"
2437 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2438 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2439 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2441 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2442 (mult:SI (match_dup 1) (match_dup 2)))]
2447 [(set_attr "type" "imul_compare")
2448 (set_attr "length" "4,8")])
2451 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
2452 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2453 (match_operand:SI 2 "gpc_reg_operand" ""))
2455 (set (match_operand:SI 0 "gpc_reg_operand" "")
2456 (mult:SI (match_dup 1) (match_dup 2)))]
2459 (mult:SI (match_dup 1) (match_dup 2)))
2461 (compare:CC (match_dup 0)
2466 (define_insn "udiv<mode>3"
2467 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2468 (udiv:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2469 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
2473 (cond [(match_operand:SI 0 "" "")
2474 (const_string "idiv")]
2475 (const_string "ldiv")))])
2478 ;; For powers of two we can do srai/aze for divide and then adjust for
2479 ;; modulus. If it isn't a power of two, force operands into register and do
2481 (define_expand "div<mode>3"
2482 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2483 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2484 (match_operand:GPR 2 "reg_or_cint_operand" "")))]
2487 if (GET_CODE (operands[2]) != CONST_INT
2488 || INTVAL (operands[2]) <= 0
2489 || exact_log2 (INTVAL (operands[2])) < 0)
2490 operands[2] = force_reg (<MODE>mode, operands[2]);
2493 (define_insn "*div<mode>3"
2494 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2495 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2496 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
2500 (cond [(match_operand:SI 0 "" "")
2501 (const_string "idiv")]
2502 (const_string "ldiv")))])
2504 (define_expand "mod<mode>3"
2505 [(use (match_operand:GPR 0 "gpc_reg_operand" ""))
2506 (use (match_operand:GPR 1 "gpc_reg_operand" ""))
2507 (use (match_operand:GPR 2 "reg_or_cint_operand" ""))]
2515 if (GET_CODE (operands[2]) != CONST_INT
2516 || INTVAL (operands[2]) <= 0
2517 || (i = exact_log2 (INTVAL (operands[2]))) < 0)
2520 temp1 = gen_reg_rtx (<MODE>mode);
2521 temp2 = gen_reg_rtx (<MODE>mode);
2523 emit_insn (gen_div<mode>3 (temp1, operands[1], operands[2]));
2524 emit_insn (gen_ashl<mode>3 (temp2, temp1, GEN_INT (i)));
2525 emit_insn (gen_sub<mode>3 (operands[0], operands[1], temp2));
2530 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2531 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2532 (match_operand:GPR 2 "exact_log2_cint_operand" "N")))]
2534 "sra<wd>i %0,%1,%p2\;addze %0,%0"
2535 [(set_attr "type" "two")
2536 (set_attr "length" "8")])
2539 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2540 (compare:CC (div:P (match_operand:P 1 "gpc_reg_operand" "r,r")
2541 (match_operand:P 2 "exact_log2_cint_operand" "N,N"))
2543 (clobber (match_scratch:P 3 "=r,r"))]
2546 sra<wd>i %3,%1,%p2\;addze. %3,%3
2548 [(set_attr "type" "compare")
2549 (set_attr "length" "8,12")
2550 (set_attr "cell_micro" "not")])
2553 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2554 (compare:CC (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2555 (match_operand:GPR 2 "exact_log2_cint_operand"
2558 (clobber (match_scratch:GPR 3 ""))]
2561 (div:<MODE> (match_dup 1) (match_dup 2)))
2563 (compare:CC (match_dup 3)
2568 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2569 (compare:CC (div:P (match_operand:P 1 "gpc_reg_operand" "r,r")
2570 (match_operand:P 2 "exact_log2_cint_operand" "N,N"))
2572 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
2573 (div:P (match_dup 1) (match_dup 2)))]
2576 sra<wd>i %0,%1,%p2\;addze. %0,%0
2578 [(set_attr "type" "compare")
2579 (set_attr "length" "8,12")
2580 (set_attr "cell_micro" "not")])
2583 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2584 (compare:CC (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2585 (match_operand:GPR 2 "exact_log2_cint_operand"
2588 (set (match_operand:GPR 0 "gpc_reg_operand" "")
2589 (div:GPR (match_dup 1) (match_dup 2)))]
2592 (div:<MODE> (match_dup 1) (match_dup 2)))
2594 (compare:CC (match_dup 0)
2598 ;; Logical instructions
2599 ;; The logical instructions are mostly combined by using match_operator,
2600 ;; but the plain AND insns are somewhat different because there is no
2601 ;; plain 'andi' (only 'andi.'), no plain 'andis', and there are all
2602 ;; those rotate-and-mask operations. Thus, the AND insns come first.
2604 (define_expand "andsi3"
2606 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2607 (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2608 (match_operand:SI 2 "and_operand" "")))
2609 (clobber (match_scratch:CC 3 ""))])]
2613 (define_insn "andsi3_mc"
2614 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
2615 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
2616 (match_operand:SI 2 "and_operand" "?r,T,K,L")))
2617 (clobber (match_scratch:CC 3 "=X,X,x,x"))]
2618 "rs6000_gen_cell_microcode"
2621 rlwinm %0,%1,0,%m2,%M2
2624 [(set_attr "type" "*,*,fast_compare,fast_compare")])
2626 (define_insn "andsi3_nomc"
2627 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2628 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2629 (match_operand:SI 2 "and_operand" "?r,T")))
2630 (clobber (match_scratch:CC 3 "=X,X"))]
2631 "!rs6000_gen_cell_microcode"
2634 rlwinm %0,%1,0,%m2,%M2")
2636 (define_insn "andsi3_internal0_nomc"
2637 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2638 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2639 (match_operand:SI 2 "and_operand" "?r,T")))]
2640 "!rs6000_gen_cell_microcode"
2643 rlwinm %0,%1,0,%m2,%M2")
2646 ;; Note to set cr's other than cr0 we do the and immediate and then
2647 ;; the test again -- this avoids a mfcr which on the higher end
2648 ;; machines causes an execution serialization
2650 (define_insn "*andsi3_internal2_mc"
2651 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2652 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2653 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2655 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2656 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2657 "TARGET_32BIT && rs6000_gen_cell_microcode"
2662 rlwinm. %3,%1,0,%m2,%M2
2667 [(set_attr "type" "fast_compare,fast_compare,fast_compare,delayed_compare,\
2668 compare,compare,compare,compare")
2669 (set_attr "length" "4,4,4,4,8,8,8,8")])
2671 (define_insn "*andsi3_internal3_mc"
2672 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2673 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2674 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2676 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2677 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2678 "TARGET_64BIT && rs6000_gen_cell_microcode"
2683 rlwinm. %3,%1,0,%m2,%M2
2688 [(set_attr "type" "compare,fast_compare,fast_compare,delayed_compare,compare,\
2689 compare,compare,compare")
2690 (set_attr "length" "8,4,4,4,8,8,8,8")])
2693 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
2694 (compare:CC (and:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2695 (match_operand:GPR 2 "and_operand" ""))
2697 (clobber (match_scratch:GPR 3 ""))
2698 (clobber (match_scratch:CC 4 ""))]
2700 [(parallel [(set (match_dup 3)
2701 (and:<MODE> (match_dup 1)
2703 (clobber (match_dup 4))])
2705 (compare:CC (match_dup 3)
2709 ;; We don't have a 32 bit "and. rt,ra,rb" for ppc64. cr is set from the
2710 ;; whole 64 bit reg, and we don't know what is in the high 32 bits.
2713 [(set (match_operand:CC 0 "cc_reg_operand" "")
2714 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2715 (match_operand:SI 2 "gpc_reg_operand" ""))
2717 (clobber (match_scratch:SI 3 ""))
2718 (clobber (match_scratch:CC 4 ""))]
2719 "TARGET_POWERPC64 && reload_completed"
2720 [(parallel [(set (match_dup 3)
2721 (and:SI (match_dup 1)
2723 (clobber (match_dup 4))])
2725 (compare:CC (match_dup 3)
2729 (define_insn "*andsi3_internal4"
2730 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2731 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2732 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2734 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
2735 (and:SI (match_dup 1)
2737 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2738 "TARGET_32BIT && rs6000_gen_cell_microcode"
2743 rlwinm. %0,%1,0,%m2,%M2
2748 [(set_attr "type" "fast_compare,fast_compare,fast_compare,delayed_compare,\
2749 compare,compare,compare,compare")
2750 (set_attr "length" "4,4,4,4,8,8,8,8")])
2752 (define_insn "*andsi3_internal5_mc"
2753 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2754 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2755 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2757 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
2758 (and:SI (match_dup 1)
2760 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2761 "TARGET_64BIT && rs6000_gen_cell_microcode"
2766 rlwinm. %0,%1,0,%m2,%M2
2771 [(set_attr "type" "compare,fast_compare,fast_compare,delayed_compare,compare,\
2772 compare,compare,compare")
2773 (set_attr "length" "8,4,4,4,8,8,8,8")])
2776 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
2777 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2778 (match_operand:SI 2 "and_operand" ""))
2780 (set (match_operand:SI 0 "gpc_reg_operand" "")
2781 (and:SI (match_dup 1)
2783 (clobber (match_scratch:CC 4 ""))]
2785 [(parallel [(set (match_dup 0)
2786 (and:SI (match_dup 1)
2788 (clobber (match_dup 4))])
2790 (compare:CC (match_dup 0)
2795 [(set (match_operand:CC 3 "cc_reg_operand" "")
2796 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2797 (match_operand:SI 2 "gpc_reg_operand" ""))
2799 (set (match_operand:SI 0 "gpc_reg_operand" "")
2800 (and:SI (match_dup 1)
2802 (clobber (match_scratch:CC 4 ""))]
2803 "TARGET_POWERPC64 && reload_completed"
2804 [(parallel [(set (match_dup 0)
2805 (and:SI (match_dup 1)
2807 (clobber (match_dup 4))])
2809 (compare:CC (match_dup 0)
2813 ;; Handle the PowerPC64 rlwinm corner case
2815 (define_insn_and_split "*andsi3_internal6"
2816 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2817 (and:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2818 (match_operand:SI 2 "mask_operand_wrap" "i")))]
2823 (and:SI (rotate:SI (match_dup 1) (match_dup 3))
2826 (rotate:SI (match_dup 0) (match_dup 5)))]
2829 int mb = extract_MB (operands[2]);
2830 int me = extract_ME (operands[2]);
2831 operands[3] = GEN_INT (me + 1);
2832 operands[5] = GEN_INT (32 - (me + 1));
2833 operands[4] = GEN_INT (~((HOST_WIDE_INT) -1 << (33 + me - mb)));
2835 [(set_attr "length" "8")])
2837 (define_expand "iorsi3"
2838 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2839 (ior:SI (match_operand:SI 1 "gpc_reg_operand" "")
2840 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
2844 if (GET_CODE (operands[2]) == CONST_INT
2845 && ! logical_operand (operands[2], SImode))
2847 HOST_WIDE_INT value = INTVAL (operands[2]);
2848 rtx tmp = ((!can_create_pseudo_p ()
2849 || rtx_equal_p (operands[0], operands[1]))
2850 ? operands[0] : gen_reg_rtx (SImode));
2852 emit_insn (gen_iorsi3 (tmp, operands[1],
2853 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
2854 emit_insn (gen_iorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
2859 (define_expand "xorsi3"
2860 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2861 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
2862 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
2866 if (GET_CODE (operands[2]) == CONST_INT
2867 && ! logical_operand (operands[2], SImode))
2869 HOST_WIDE_INT value = INTVAL (operands[2]);
2870 rtx tmp = ((!can_create_pseudo_p ()
2871 || rtx_equal_p (operands[0], operands[1]))
2872 ? operands[0] : gen_reg_rtx (SImode));
2874 emit_insn (gen_xorsi3 (tmp, operands[1],
2875 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
2876 emit_insn (gen_xorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
2881 (define_insn "*boolsi3_internal1"
2882 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
2883 (match_operator:SI 3 "boolean_or_operator"
2884 [(match_operand:SI 1 "gpc_reg_operand" "%r,r,r")
2885 (match_operand:SI 2 "logical_operand" "r,K,L")]))]
2892 (define_insn "*boolsi3_internal2"
2893 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2894 (compare:CC (match_operator:SI 4 "boolean_or_operator"
2895 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
2896 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
2898 (clobber (match_scratch:SI 3 "=r,r"))]
2903 [(set_attr "type" "fast_compare,compare")
2904 (set_attr "length" "4,8")])
2907 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
2908 (compare:CC (match_operator:SI 4 "boolean_operator"
2909 [(match_operand:SI 1 "gpc_reg_operand" "")
2910 (match_operand:SI 2 "gpc_reg_operand" "")])
2912 (clobber (match_scratch:SI 3 ""))]
2913 "TARGET_32BIT && reload_completed"
2914 [(set (match_dup 3) (match_dup 4))
2916 (compare:CC (match_dup 3)
2920 (define_insn "*boolsi3_internal3"
2921 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2922 (compare:CC (match_operator:SI 4 "boolean_operator"
2923 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
2924 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
2926 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2932 [(set_attr "type" "fast_compare,compare")
2933 (set_attr "length" "4,8")])
2936 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
2937 (compare:CC (match_operator:SI 4 "boolean_operator"
2938 [(match_operand:SI 1 "gpc_reg_operand" "")
2939 (match_operand:SI 2 "gpc_reg_operand" "")])
2941 (set (match_operand:SI 0 "gpc_reg_operand" "")
2943 "TARGET_32BIT && reload_completed"
2944 [(set (match_dup 0) (match_dup 4))
2946 (compare:CC (match_dup 0)
2950 ;; Split a logical operation that we can't do in one insn into two insns,
2951 ;; each of which does one 16-bit part. This is used by combine.
2954 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2955 (match_operator:SI 3 "boolean_or_operator"
2956 [(match_operand:SI 1 "gpc_reg_operand" "")
2957 (match_operand:SI 2 "non_logical_cint_operand" "")]))]
2959 [(set (match_dup 0) (match_dup 4))
2960 (set (match_dup 0) (match_dup 5))]
2964 i = GEN_INT (INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff));
2965 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
2967 i = GEN_INT (INTVAL (operands[2]) & 0xffff);
2968 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
2972 (define_insn "*boolcsi3_internal1"
2973 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2974 (match_operator:SI 3 "boolean_operator"
2975 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
2976 (match_operand:SI 2 "gpc_reg_operand" "r")]))]
2980 (define_insn "*boolcsi3_internal2"
2981 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2982 (compare:CC (match_operator:SI 4 "boolean_operator"
2983 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
2984 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
2986 (clobber (match_scratch:SI 3 "=r,r"))]
2991 [(set_attr "type" "compare")
2992 (set_attr "length" "4,8")])
2995 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
2996 (compare:CC (match_operator:SI 4 "boolean_operator"
2997 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
2998 (match_operand:SI 2 "gpc_reg_operand" "")])
3000 (clobber (match_scratch:SI 3 ""))]
3001 "TARGET_32BIT && reload_completed"
3002 [(set (match_dup 3) (match_dup 4))
3004 (compare:CC (match_dup 3)
3008 (define_insn "*boolcsi3_internal3"
3009 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3010 (compare:CC (match_operator:SI 4 "boolean_operator"
3011 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
3012 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3014 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3020 [(set_attr "type" "compare")
3021 (set_attr "length" "4,8")])
3024 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3025 (compare:CC (match_operator:SI 4 "boolean_operator"
3026 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3027 (match_operand:SI 2 "gpc_reg_operand" "")])
3029 (set (match_operand:SI 0 "gpc_reg_operand" "")
3031 "TARGET_32BIT && reload_completed"
3032 [(set (match_dup 0) (match_dup 4))
3034 (compare:CC (match_dup 0)
3038 (define_insn "*boolccsi3_internal1"
3039 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3040 (match_operator:SI 3 "boolean_operator"
3041 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
3042 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))]))]
3046 (define_insn "*boolccsi3_internal2"
3047 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3048 (compare:CC (match_operator:SI 4 "boolean_operator"
3049 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
3050 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
3052 (clobber (match_scratch:SI 3 "=r,r"))]
3057 [(set_attr "type" "fast_compare,compare")
3058 (set_attr "length" "4,8")])
3061 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3062 (compare:CC (match_operator:SI 4 "boolean_operator"
3063 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3064 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
3066 (clobber (match_scratch:SI 3 ""))]
3067 "TARGET_32BIT && reload_completed"
3068 [(set (match_dup 3) (match_dup 4))
3070 (compare:CC (match_dup 3)
3074 (define_insn "*boolccsi3_internal3"
3075 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3076 (compare:CC (match_operator:SI 4 "boolean_operator"
3077 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
3078 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
3080 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3086 [(set_attr "type" "fast_compare,compare")
3087 (set_attr "length" "4,8")])
3090 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3091 (compare:CC (match_operator:SI 4 "boolean_operator"
3092 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3093 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
3095 (set (match_operand:SI 0 "gpc_reg_operand" "")
3097 "TARGET_32BIT && reload_completed"
3098 [(set (match_dup 0) (match_dup 4))
3100 (compare:CC (match_dup 0)
3104 ;; Rotate and shift insns, in all their variants. These support shifts,
3105 ;; field inserts and extracts, and various combinations thereof.
3106 (define_expand "insv"
3107 [(set (zero_extract (match_operand 0 "gpc_reg_operand" "")
3108 (match_operand:SI 1 "const_int_operand" "")
3109 (match_operand:SI 2 "const_int_operand" ""))
3110 (match_operand 3 "gpc_reg_operand" ""))]
3114 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3115 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3116 compiler if the address of the structure is taken later. Likewise, do
3117 not handle invalid E500 subregs. */
3118 if (GET_CODE (operands[0]) == SUBREG
3119 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD
3120 || ((TARGET_E500_DOUBLE || TARGET_SPE)
3121 && invalid_e500_subreg (operands[0], GET_MODE (operands[0])))))
3124 if (TARGET_POWERPC64 && GET_MODE (operands[0]) == DImode)
3125 emit_insn (gen_insvdi_internal (operands[0], operands[1], operands[2],
3128 emit_insn (gen_insvsi_internal (operands[0], operands[1], operands[2],
3133 (define_insn "insvsi_internal"
3134 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3135 (match_operand:SI 1 "const_int_operand" "i")
3136 (match_operand:SI 2 "const_int_operand" "i"))
3137 (match_operand:SI 3 "gpc_reg_operand" "r"))]
3141 int start = INTVAL (operands[2]) & 31;
3142 int size = INTVAL (operands[1]) & 31;
3144 operands[4] = GEN_INT (32 - start - size);
3145 operands[1] = GEN_INT (start + size - 1);
3146 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3148 [(set_attr "type" "insert_word")])
3150 (define_insn "*insvsi_internal1"
3151 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3152 (match_operand:SI 1 "const_int_operand" "i")
3153 (match_operand:SI 2 "const_int_operand" "i"))
3154 (rotate:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3155 (match_operand:SI 4 "const_int_operand" "i")))]
3156 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3159 int shift = INTVAL (operands[4]) & 31;
3160 int start = INTVAL (operands[2]) & 31;
3161 int size = INTVAL (operands[1]) & 31;
3163 operands[4] = GEN_INT (shift - start - size);
3164 operands[1] = GEN_INT (start + size - 1);
3165 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3167 [(set_attr "type" "insert_word")])
3169 (define_insn "*insvsi_internal2"
3170 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3171 (match_operand:SI 1 "const_int_operand" "i")
3172 (match_operand:SI 2 "const_int_operand" "i"))
3173 (ashiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3174 (match_operand:SI 4 "const_int_operand" "i")))]
3175 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3178 int shift = INTVAL (operands[4]) & 31;
3179 int start = INTVAL (operands[2]) & 31;
3180 int size = INTVAL (operands[1]) & 31;
3182 operands[4] = GEN_INT (32 - shift - start - size);
3183 operands[1] = GEN_INT (start + size - 1);
3184 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3186 [(set_attr "type" "insert_word")])
3188 (define_insn "*insvsi_internal3"
3189 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3190 (match_operand:SI 1 "const_int_operand" "i")
3191 (match_operand:SI 2 "const_int_operand" "i"))
3192 (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3193 (match_operand:SI 4 "const_int_operand" "i")))]
3194 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3197 int shift = INTVAL (operands[4]) & 31;
3198 int start = INTVAL (operands[2]) & 31;
3199 int size = INTVAL (operands[1]) & 31;
3201 operands[4] = GEN_INT (32 - shift - start - size);
3202 operands[1] = GEN_INT (start + size - 1);
3203 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3205 [(set_attr "type" "insert_word")])
3207 (define_insn "*insvsi_internal4"
3208 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3209 (match_operand:SI 1 "const_int_operand" "i")
3210 (match_operand:SI 2 "const_int_operand" "i"))
3211 (zero_extract:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3212 (match_operand:SI 4 "const_int_operand" "i")
3213 (match_operand:SI 5 "const_int_operand" "i")))]
3214 "INTVAL (operands[4]) >= INTVAL (operands[1])"
3217 int extract_start = INTVAL (operands[5]) & 31;
3218 int extract_size = INTVAL (operands[4]) & 31;
3219 int insert_start = INTVAL (operands[2]) & 31;
3220 int insert_size = INTVAL (operands[1]) & 31;
3222 /* Align extract field with insert field */
3223 operands[5] = GEN_INT (extract_start + extract_size - insert_start - insert_size);
3224 operands[1] = GEN_INT (insert_start + insert_size - 1);
3225 return \"rlwimi %0,%3,%h5,%h2,%h1\";
3227 [(set_attr "type" "insert_word")])
3229 ;; combine patterns for rlwimi
3230 (define_insn "*insvsi_internal5"
3231 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3232 (ior:SI (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
3233 (match_operand:SI 1 "mask_operand" "i"))
3234 (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3235 (match_operand:SI 2 "const_int_operand" "i"))
3236 (match_operand:SI 5 "mask_operand" "i"))))]
3237 "INTVAL(operands[1]) == ~INTVAL(operands[5])"
3240 int me = extract_ME(operands[5]);
3241 int mb = extract_MB(operands[5]);
3242 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
3243 operands[2] = GEN_INT(mb);
3244 operands[1] = GEN_INT(me);
3245 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3247 [(set_attr "type" "insert_word")])
3249 (define_insn "*insvsi_internal6"
3250 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3251 (ior:SI (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3252 (match_operand:SI 2 "const_int_operand" "i"))
3253 (match_operand:SI 5 "mask_operand" "i"))
3254 (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
3255 (match_operand:SI 1 "mask_operand" "i"))))]
3256 "INTVAL(operands[1]) == ~INTVAL(operands[5])"
3259 int me = extract_ME(operands[5]);
3260 int mb = extract_MB(operands[5]);
3261 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
3262 operands[2] = GEN_INT(mb);
3263 operands[1] = GEN_INT(me);
3264 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3266 [(set_attr "type" "insert_word")])
3268 (define_insn "insvdi_internal"
3269 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3270 (match_operand:SI 1 "const_int_operand" "i")
3271 (match_operand:SI 2 "const_int_operand" "i"))
3272 (match_operand:DI 3 "gpc_reg_operand" "r"))]
3276 int start = INTVAL (operands[2]) & 63;
3277 int size = INTVAL (operands[1]) & 63;
3279 operands[1] = GEN_INT (64 - start - size);
3280 return \"rldimi %0,%3,%H1,%H2\";
3282 [(set_attr "type" "insert_dword")])
3284 (define_insn "*insvdi_internal2"
3285 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3286 (match_operand:SI 1 "const_int_operand" "i")
3287 (match_operand:SI 2 "const_int_operand" "i"))
3288 (ashiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
3289 (match_operand:SI 4 "const_int_operand" "i")))]
3291 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
3294 int shift = INTVAL (operands[4]) & 63;
3295 int start = (INTVAL (operands[2]) & 63) - 32;
3296 int size = INTVAL (operands[1]) & 63;
3298 operands[4] = GEN_INT (64 - shift - start - size);
3299 operands[2] = GEN_INT (start);
3300 operands[1] = GEN_INT (start + size - 1);
3301 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3304 (define_insn "*insvdi_internal3"
3305 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3306 (match_operand:SI 1 "const_int_operand" "i")
3307 (match_operand:SI 2 "const_int_operand" "i"))
3308 (lshiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
3309 (match_operand:SI 4 "const_int_operand" "i")))]
3311 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
3314 int shift = INTVAL (operands[4]) & 63;
3315 int start = (INTVAL (operands[2]) & 63) - 32;
3316 int size = INTVAL (operands[1]) & 63;
3318 operands[4] = GEN_INT (64 - shift - start - size);
3319 operands[2] = GEN_INT (start);
3320 operands[1] = GEN_INT (start + size - 1);
3321 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3324 (define_expand "extzv"
3325 [(set (match_operand 0 "gpc_reg_operand" "")
3326 (zero_extract (match_operand 1 "gpc_reg_operand" "")
3327 (match_operand:SI 2 "const_int_operand" "")
3328 (match_operand:SI 3 "const_int_operand" "")))]
3332 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3333 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3334 compiler if the address of the structure is taken later. */
3335 if (GET_CODE (operands[0]) == SUBREG
3336 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
3339 if (TARGET_POWERPC64 && GET_MODE (operands[1]) == DImode)
3340 emit_insn (gen_extzvdi_internal (operands[0], operands[1], operands[2],
3343 emit_insn (gen_extzvsi_internal (operands[0], operands[1], operands[2],
3348 (define_insn "extzvsi_internal"
3349 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3350 (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3351 (match_operand:SI 2 "const_int_operand" "i")
3352 (match_operand:SI 3 "const_int_operand" "i")))]
3356 int start = INTVAL (operands[3]) & 31;
3357 int size = INTVAL (operands[2]) & 31;
3359 if (start + size >= 32)
3360 operands[3] = const0_rtx;
3362 operands[3] = GEN_INT (start + size);
3363 return \"rlwinm %0,%1,%3,%s2,31\";
3366 (define_insn "*extzvsi_internal1"
3367 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3368 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3369 (match_operand:SI 2 "const_int_operand" "i,i")
3370 (match_operand:SI 3 "const_int_operand" "i,i"))
3372 (clobber (match_scratch:SI 4 "=r,r"))]
3376 int start = INTVAL (operands[3]) & 31;
3377 int size = INTVAL (operands[2]) & 31;
3379 /* Force split for non-cc0 compare. */
3380 if (which_alternative == 1)
3383 /* If the bit-field being tested fits in the upper or lower half of a
3384 word, it is possible to use andiu. or andil. to test it. This is
3385 useful because the condition register set-use delay is smaller for
3386 andi[ul]. than for rlinm. This doesn't work when the starting bit
3387 position is 0 because the LT and GT bits may be set wrong. */
3389 if ((start > 0 && start + size <= 16) || start >= 16)
3391 operands[3] = GEN_INT (((1 << (16 - (start & 15)))
3392 - (1 << (16 - (start & 15) - size))));
3394 return \"andis. %4,%1,%3\";
3396 return \"andi. %4,%1,%3\";
3399 if (start + size >= 32)
3400 operands[3] = const0_rtx;
3402 operands[3] = GEN_INT (start + size);
3403 return \"rlwinm. %4,%1,%3,%s2,31\";
3405 [(set_attr "type" "delayed_compare")
3406 (set_attr "length" "4,8")])
3409 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3410 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3411 (match_operand:SI 2 "const_int_operand" "")
3412 (match_operand:SI 3 "const_int_operand" ""))
3414 (clobber (match_scratch:SI 4 ""))]
3417 (zero_extract:SI (match_dup 1) (match_dup 2)
3420 (compare:CC (match_dup 4)
3424 (define_insn "*extzvsi_internal2"
3425 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3426 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3427 (match_operand:SI 2 "const_int_operand" "i,i")
3428 (match_operand:SI 3 "const_int_operand" "i,i"))
3430 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3431 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3435 int start = INTVAL (operands[3]) & 31;
3436 int size = INTVAL (operands[2]) & 31;
3438 /* Force split for non-cc0 compare. */
3439 if (which_alternative == 1)
3442 /* Since we are using the output value, we can't ignore any need for
3443 a shift. The bit-field must end at the LSB. */
3444 if (start >= 16 && start + size == 32)
3446 operands[3] = GEN_INT ((1 << size) - 1);
3447 return \"andi. %0,%1,%3\";
3450 if (start + size >= 32)
3451 operands[3] = const0_rtx;
3453 operands[3] = GEN_INT (start + size);
3454 return \"rlwinm. %0,%1,%3,%s2,31\";
3456 [(set_attr "type" "delayed_compare")
3457 (set_attr "length" "4,8")])
3460 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
3461 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3462 (match_operand:SI 2 "const_int_operand" "")
3463 (match_operand:SI 3 "const_int_operand" ""))
3465 (set (match_operand:SI 0 "gpc_reg_operand" "")
3466 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3469 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))
3471 (compare:CC (match_dup 0)
3475 (define_insn "extzvdi_internal"
3476 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
3477 (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3478 (match_operand:SI 2 "const_int_operand" "i")
3479 (match_operand:SI 3 "const_int_operand" "i")))]
3483 int start = INTVAL (operands[3]) & 63;
3484 int size = INTVAL (operands[2]) & 63;
3486 if (start + size >= 64)
3487 operands[3] = const0_rtx;
3489 operands[3] = GEN_INT (start + size);
3490 operands[2] = GEN_INT (64 - size);
3491 return \"rldicl %0,%1,%3,%2\";
3494 (define_insn "*extzvdi_internal1"
3495 [(set (match_operand:CC 0 "gpc_reg_operand" "=x")
3496 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3497 (match_operand:SI 2 "const_int_operand" "i")
3498 (match_operand:SI 3 "const_int_operand" "i"))
3500 (clobber (match_scratch:DI 4 "=r"))]
3501 "TARGET_64BIT && rs6000_gen_cell_microcode"
3504 int start = INTVAL (operands[3]) & 63;
3505 int size = INTVAL (operands[2]) & 63;
3507 if (start + size >= 64)
3508 operands[3] = const0_rtx;
3510 operands[3] = GEN_INT (start + size);
3511 operands[2] = GEN_INT (64 - size);
3512 return \"rldicl. %4,%1,%3,%2\";
3514 [(set_attr "type" "compare")])
3516 (define_insn "*extzvdi_internal2"
3517 [(set (match_operand:CC 4 "gpc_reg_operand" "=x")
3518 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3519 (match_operand:SI 2 "const_int_operand" "i")
3520 (match_operand:SI 3 "const_int_operand" "i"))
3522 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
3523 (zero_extract:DI (match_dup 1) (match_dup 2) (match_dup 3)))]
3524 "TARGET_64BIT && rs6000_gen_cell_microcode"
3527 int start = INTVAL (operands[3]) & 63;
3528 int size = INTVAL (operands[2]) & 63;
3530 if (start + size >= 64)
3531 operands[3] = const0_rtx;
3533 operands[3] = GEN_INT (start + size);
3534 operands[2] = GEN_INT (64 - size);
3535 return \"rldicl. %0,%1,%3,%2\";
3537 [(set_attr "type" "compare")])
3539 (define_insn "rotlsi3"
3540 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3541 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3542 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
3545 rlwnm %0,%1,%2,0xffffffff
3546 rlwinm %0,%1,%h2,0xffffffff"
3547 [(set_attr "type" "var_shift_rotate,integer")])
3549 (define_insn "*rotlsi3_64"
3550 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
3552 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3553 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))))]
3556 rlwnm %0,%1,%2,0xffffffff
3557 rlwinm %0,%1,%h2,0xffffffff"
3558 [(set_attr "type" "var_shift_rotate,integer")])
3560 (define_insn "*rotlsi3_internal2"
3561 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3562 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3563 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3565 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
3568 rlwnm. %3,%1,%2,0xffffffff
3569 rlwinm. %3,%1,%h2,0xffffffff
3572 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3573 (set_attr "length" "4,4,8,8")])
3576 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3577 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3578 (match_operand:SI 2 "reg_or_cint_operand" ""))
3580 (clobber (match_scratch:SI 3 ""))]
3583 (rotate:SI (match_dup 1) (match_dup 2)))
3585 (compare:CC (match_dup 3)
3589 (define_insn "*rotlsi3_internal3"
3590 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
3591 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3592 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3594 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
3595 (rotate:SI (match_dup 1) (match_dup 2)))]
3598 rlwnm. %0,%1,%2,0xffffffff
3599 rlwinm. %0,%1,%h2,0xffffffff
3602 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3603 (set_attr "length" "4,4,8,8")])
3606 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3607 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3608 (match_operand:SI 2 "reg_or_cint_operand" ""))
3610 (set (match_operand:SI 0 "gpc_reg_operand" "")
3611 (rotate:SI (match_dup 1) (match_dup 2)))]
3614 (rotate:SI (match_dup 1) (match_dup 2)))
3616 (compare:CC (match_dup 0)
3620 (define_insn "*rotlsi3_internal4"
3621 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3622 (and:SI (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3623 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
3624 (match_operand:SI 3 "mask_operand" "n,n")))]
3627 rlwnm %0,%1,%2,%m3,%M3
3628 rlwinm %0,%1,%h2,%m3,%M3"
3629 [(set_attr "type" "var_shift_rotate,integer")])
3631 (define_insn "*rotlsi3_internal5"
3632 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3634 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3635 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3636 (match_operand:SI 3 "mask_operand" "n,n,n,n"))
3638 (clobber (match_scratch:SI 4 "=r,r,r,r"))]
3641 rlwnm. %4,%1,%2,%m3,%M3
3642 rlwinm. %4,%1,%h2,%m3,%M3
3645 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3646 (set_attr "length" "4,4,8,8")])
3649 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3651 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3652 (match_operand:SI 2 "reg_or_cint_operand" ""))
3653 (match_operand:SI 3 "mask_operand" ""))
3655 (clobber (match_scratch:SI 4 ""))]
3658 (and:SI (rotate:SI (match_dup 1)
3662 (compare:CC (match_dup 4)
3666 (define_insn "*rotlsi3_internal6"
3667 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
3669 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3670 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3671 (match_operand:SI 3 "mask_operand" "n,n,n,n"))
3673 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
3674 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3677 rlwnm. %0,%1,%2,%m3,%M3
3678 rlwinm. %0,%1,%h2,%m3,%M3
3681 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3682 (set_attr "length" "4,4,8,8")])
3685 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
3687 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3688 (match_operand:SI 2 "reg_or_cint_operand" ""))
3689 (match_operand:SI 3 "mask_operand" ""))
3691 (set (match_operand:SI 0 "gpc_reg_operand" "")
3692 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3695 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
3697 (compare:CC (match_dup 0)
3701 (define_insn "*rotlsi3_internal7"
3702 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3705 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3706 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
3708 "rlw%I2nm %0,%1,%h2,0xff"
3709 [(set (attr "cell_micro")
3710 (if_then_else (match_operand:SI 2 "const_int_operand" "")
3711 (const_string "not")
3712 (const_string "always")))])
3714 (define_insn "*rotlsi3_internal8"
3715 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3716 (compare:CC (zero_extend:SI
3718 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3719 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
3721 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
3724 rlwnm. %3,%1,%2,0xff
3725 rlwinm. %3,%1,%h2,0xff
3728 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3729 (set_attr "length" "4,4,8,8")])
3732 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3733 (compare:CC (zero_extend:SI
3735 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3736 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3738 (clobber (match_scratch:SI 3 ""))]
3741 (zero_extend:SI (subreg:QI
3742 (rotate:SI (match_dup 1)
3745 (compare:CC (match_dup 3)
3749 (define_insn "*rotlsi3_internal9"
3750 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
3751 (compare:CC (zero_extend:SI
3753 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3754 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
3756 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
3757 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3760 rlwnm. %0,%1,%2,0xff
3761 rlwinm. %0,%1,%h2,0xff
3764 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3765 (set_attr "length" "4,4,8,8")])
3768 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3769 (compare:CC (zero_extend:SI
3771 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3772 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3774 (set (match_operand:SI 0 "gpc_reg_operand" "")
3775 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3778 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
3780 (compare:CC (match_dup 0)
3784 (define_insn "*rotlsi3_internal10"
3785 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3788 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3789 (match_operand:SI 2 "reg_or_cint_operand" "r,i")) 0)))]
3792 rlwnm %0,%1,%2,0xffff
3793 rlwinm %0,%1,%h2,0xffff"
3794 [(set_attr "type" "var_shift_rotate,integer")])
3797 (define_insn "*rotlsi3_internal11"
3798 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3799 (compare:CC (zero_extend:SI
3801 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3802 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
3804 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
3807 rlwnm. %3,%1,%2,0xffff
3808 rlwinm. %3,%1,%h2,0xffff
3811 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3812 (set_attr "length" "4,4,8,8")])
3815 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3816 (compare:CC (zero_extend:SI
3818 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3819 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3821 (clobber (match_scratch:SI 3 ""))]
3824 (zero_extend:SI (subreg:HI
3825 (rotate:SI (match_dup 1)
3828 (compare:CC (match_dup 3)
3832 (define_insn "*rotlsi3_internal12"
3833 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
3834 (compare:CC (zero_extend:SI
3836 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3837 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
3839 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
3840 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3843 rlwnm. %0,%1,%2,0xffff
3844 rlwinm. %0,%1,%h2,0xffff
3847 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3848 (set_attr "length" "4,4,8,8")])
3851 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3852 (compare:CC (zero_extend:SI
3854 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3855 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3857 (set (match_operand:SI 0 "gpc_reg_operand" "")
3858 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3861 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
3863 (compare:CC (match_dup 0)
3867 (define_insn "ashlsi3"
3868 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3869 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3870 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
3875 [(set_attr "type" "var_shift_rotate,shift")])
3877 (define_insn "*ashlsi3_64"
3878 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
3880 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3881 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))))]
3886 [(set_attr "type" "var_shift_rotate,shift")])
3889 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3890 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3891 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3893 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
3900 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3901 (set_attr "length" "4,4,8,8")])
3904 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3905 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3906 (match_operand:SI 2 "reg_or_cint_operand" ""))
3908 (clobber (match_scratch:SI 3 ""))]
3909 "TARGET_32BIT && reload_completed"
3911 (ashift:SI (match_dup 1) (match_dup 2)))
3913 (compare:CC (match_dup 3)
3918 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
3919 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3920 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3922 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
3923 (ashift:SI (match_dup 1) (match_dup 2)))]
3930 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3931 (set_attr "length" "4,4,8,8")])
3934 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3935 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3936 (match_operand:SI 2 "reg_or_cint_operand" ""))
3938 (set (match_operand:SI 0 "gpc_reg_operand" "")
3939 (ashift:SI (match_dup 1) (match_dup 2)))]
3940 "TARGET_32BIT && reload_completed"
3942 (ashift:SI (match_dup 1) (match_dup 2)))
3944 (compare:CC (match_dup 0)
3948 (define_insn "rlwinm"
3949 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3950 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3951 (match_operand:SI 2 "const_int_operand" "i"))
3952 (match_operand:SI 3 "mask_operand" "n")))]
3953 "includes_lshift_p (operands[2], operands[3])"
3954 "rlwinm %0,%1,%h2,%m3,%M3")
3957 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3959 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3960 (match_operand:SI 2 "const_int_operand" "i,i"))
3961 (match_operand:SI 3 "mask_operand" "n,n"))
3963 (clobber (match_scratch:SI 4 "=r,r"))]
3964 "includes_lshift_p (operands[2], operands[3])"
3966 rlwinm. %4,%1,%h2,%m3,%M3
3968 [(set_attr "type" "delayed_compare")
3969 (set_attr "length" "4,8")])
3972 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3974 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3975 (match_operand:SI 2 "const_int_operand" ""))
3976 (match_operand:SI 3 "mask_operand" ""))
3978 (clobber (match_scratch:SI 4 ""))]
3979 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
3981 (and:SI (ashift:SI (match_dup 1) (match_dup 2))
3984 (compare:CC (match_dup 4)
3989 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3991 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3992 (match_operand:SI 2 "const_int_operand" "i,i"))
3993 (match_operand:SI 3 "mask_operand" "n,n"))
3995 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3996 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3997 "includes_lshift_p (operands[2], operands[3])"
3999 rlwinm. %0,%1,%h2,%m3,%M3
4001 [(set_attr "type" "delayed_compare")
4002 (set_attr "length" "4,8")])
4005 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
4007 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4008 (match_operand:SI 2 "const_int_operand" ""))
4009 (match_operand:SI 3 "mask_operand" ""))
4011 (set (match_operand:SI 0 "gpc_reg_operand" "")
4012 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4013 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
4015 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4017 (compare:CC (match_dup 0)
4021 (define_insn "lshrsi3"
4022 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
4023 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
4024 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i")))]
4030 [(set_attr "type" "integer,var_shift_rotate,shift")])
4032 (define_insn "*lshrsi3_64"
4033 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
4035 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4036 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))))]
4041 [(set_attr "type" "var_shift_rotate,shift")])
4044 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,?y,?y,?y")
4045 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
4046 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i,O,r,i"))
4048 (clobber (match_scratch:SI 3 "=X,r,r,X,r,r"))]
4057 [(set_attr "type" "delayed_compare,var_delayed_compare,delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4058 (set_attr "length" "4,4,4,8,8,8")])
4061 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4062 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4063 (match_operand:SI 2 "reg_or_cint_operand" ""))
4065 (clobber (match_scratch:SI 3 ""))]
4066 "TARGET_32BIT && reload_completed"
4068 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4070 (compare:CC (match_dup 3)
4075 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,?y,?y,?y")
4076 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
4077 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i,O,r,i"))
4079 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
4080 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
4089 [(set_attr "type" "delayed_compare,var_delayed_compare,delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4090 (set_attr "length" "4,4,4,8,8,8")])
4093 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4094 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4095 (match_operand:SI 2 "reg_or_cint_operand" ""))
4097 (set (match_operand:SI 0 "gpc_reg_operand" "")
4098 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
4099 "TARGET_32BIT && reload_completed"
4101 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4103 (compare:CC (match_dup 0)
4108 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4109 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4110 (match_operand:SI 2 "const_int_operand" "i"))
4111 (match_operand:SI 3 "mask_operand" "n")))]
4112 "includes_rshift_p (operands[2], operands[3])"
4113 "rlwinm %0,%1,%s2,%m3,%M3")
4116 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4118 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4119 (match_operand:SI 2 "const_int_operand" "i,i"))
4120 (match_operand:SI 3 "mask_operand" "n,n"))
4122 (clobber (match_scratch:SI 4 "=r,r"))]
4123 "includes_rshift_p (operands[2], operands[3])"
4125 rlwinm. %4,%1,%s2,%m3,%M3
4127 [(set_attr "type" "delayed_compare")
4128 (set_attr "length" "4,8")])
4131 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4133 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4134 (match_operand:SI 2 "const_int_operand" ""))
4135 (match_operand:SI 3 "mask_operand" ""))
4137 (clobber (match_scratch:SI 4 ""))]
4138 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
4140 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2))
4143 (compare:CC (match_dup 4)
4148 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4150 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4151 (match_operand:SI 2 "const_int_operand" "i,i"))
4152 (match_operand:SI 3 "mask_operand" "n,n"))
4154 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4155 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4156 "includes_rshift_p (operands[2], operands[3])"
4158 rlwinm. %0,%1,%s2,%m3,%M3
4160 [(set_attr "type" "delayed_compare")
4161 (set_attr "length" "4,8")])
4164 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
4166 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4167 (match_operand:SI 2 "const_int_operand" ""))
4168 (match_operand:SI 3 "mask_operand" ""))
4170 (set (match_operand:SI 0 "gpc_reg_operand" "")
4171 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4172 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
4174 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4176 (compare:CC (match_dup 0)
4181 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4184 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4185 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4186 "includes_rshift_p (operands[2], GEN_INT (255))"
4187 "rlwinm %0,%1,%s2,0xff")
4190 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4194 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4195 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4197 (clobber (match_scratch:SI 3 "=r,r"))]
4198 "includes_rshift_p (operands[2], GEN_INT (255))"
4200 rlwinm. %3,%1,%s2,0xff
4202 [(set_attr "type" "delayed_compare")
4203 (set_attr "length" "4,8")])
4206 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4210 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4211 (match_operand:SI 2 "const_int_operand" "")) 0))
4213 (clobber (match_scratch:SI 3 ""))]
4214 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4216 (zero_extend:SI (subreg:QI
4217 (lshiftrt:SI (match_dup 1)
4220 (compare:CC (match_dup 3)
4225 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4229 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4230 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4232 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4233 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4234 "includes_rshift_p (operands[2], GEN_INT (255))"
4236 rlwinm. %0,%1,%s2,0xff
4238 [(set_attr "type" "delayed_compare")
4239 (set_attr "length" "4,8")])
4242 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4246 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4247 (match_operand:SI 2 "const_int_operand" "")) 0))
4249 (set (match_operand:SI 0 "gpc_reg_operand" "")
4250 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4251 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4253 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4255 (compare:CC (match_dup 0)
4260 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4263 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4264 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4265 "includes_rshift_p (operands[2], GEN_INT (65535))"
4266 "rlwinm %0,%1,%s2,0xffff")
4269 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4273 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4274 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4276 (clobber (match_scratch:SI 3 "=r,r"))]
4277 "includes_rshift_p (operands[2], GEN_INT (65535))"
4279 rlwinm. %3,%1,%s2,0xffff
4281 [(set_attr "type" "delayed_compare")
4282 (set_attr "length" "4,8")])
4285 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4289 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4290 (match_operand:SI 2 "const_int_operand" "")) 0))
4292 (clobber (match_scratch:SI 3 ""))]
4293 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4295 (zero_extend:SI (subreg:HI
4296 (lshiftrt:SI (match_dup 1)
4299 (compare:CC (match_dup 3)
4304 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4308 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4309 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4311 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4312 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4313 "includes_rshift_p (operands[2], GEN_INT (65535))"
4315 rlwinm. %0,%1,%s2,0xffff
4317 [(set_attr "type" "delayed_compare")
4318 (set_attr "length" "4,8")])
4321 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4325 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4326 (match_operand:SI 2 "const_int_operand" "")) 0))
4328 (set (match_operand:SI 0 "gpc_reg_operand" "")
4329 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4330 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4332 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4334 (compare:CC (match_dup 0)
4338 (define_insn "ashrsi3"
4339 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4340 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4341 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
4346 [(set_attr "type" "var_shift_rotate,shift")])
4348 (define_insn "*ashrsi3_64"
4349 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
4351 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4352 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))))]
4357 [(set_attr "type" "var_shift_rotate,shift")])
4360 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4361 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4362 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4364 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4371 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4372 (set_attr "length" "4,4,8,8")])
4375 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4376 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4377 (match_operand:SI 2 "reg_or_cint_operand" ""))
4379 (clobber (match_scratch:SI 3 ""))]
4382 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4384 (compare:CC (match_dup 3)
4389 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4390 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4391 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4393 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4394 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
4401 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4402 (set_attr "length" "4,4,8,8")])
4404 ;; Builtins to replace a division to generate FRE reciprocal estimate
4405 ;; instructions and the necessary fixup instructions
4406 (define_expand "recip<mode>3"
4407 [(match_operand:RECIPF 0 "gpc_reg_operand" "")
4408 (match_operand:RECIPF 1 "gpc_reg_operand" "")
4409 (match_operand:RECIPF 2 "gpc_reg_operand" "")]
4410 "RS6000_RECIP_HAVE_RE_P (<MODE>mode)"
4412 rs6000_emit_swdiv (operands[0], operands[1], operands[2], false);
4416 ;; Split to create division from FRE/FRES/etc. and fixup instead of the normal
4417 ;; hardware division. This is only done before register allocation and with
4418 ;; -ffast-math. This must appear before the divsf3/divdf3 insns.
4420 [(set (match_operand:RECIPF 0 "gpc_reg_operand" "")
4421 (div:RECIPF (match_operand 1 "gpc_reg_operand" "")
4422 (match_operand 2 "gpc_reg_operand" "")))]
4423 "RS6000_RECIP_AUTO_RE_P (<MODE>mode)
4424 && can_create_pseudo_p () && optimize_insn_for_speed_p ()
4425 && flag_finite_math_only && !flag_trapping_math && flag_reciprocal_math"
4428 rs6000_emit_swdiv (operands[0], operands[1], operands[2], true);
4432 ;; Builtins to replace 1/sqrt(x) with instructions using RSQRTE and the
4433 ;; appropriate fixup.
4434 (define_expand "rsqrt<mode>2"
4435 [(match_operand:RECIPF 0 "gpc_reg_operand" "")
4436 (match_operand:RECIPF 1 "gpc_reg_operand" "")]
4437 "RS6000_RECIP_HAVE_RSQRTE_P (<MODE>mode)"
4439 rs6000_emit_swrsqrt (operands[0], operands[1]);
4444 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4445 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4446 (match_operand:SI 2 "reg_or_cint_operand" ""))
4448 (set (match_operand:SI 0 "gpc_reg_operand" "")
4449 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
4452 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4454 (compare:CC (match_dup 0)
4458 ;; Floating-point insns, excluding normal data motion.
4460 ;; PowerPC has a full set of single-precision floating point instructions.
4462 ;; For the POWER architecture, we pretend that we have both SFmode and
4463 ;; DFmode insns, while, in fact, all fp insns are actually done in double.
4464 ;; The only conversions we will do will be when storing to memory. In that
4465 ;; case, we will use the "frsp" instruction before storing.
4467 ;; Note that when we store into a single-precision memory location, we need to
4468 ;; use the frsp insn first. If the register being stored isn't dead, we
4469 ;; need a scratch register for the frsp. But this is difficult when the store
4470 ;; is done by reload. It is not incorrect to do the frsp on the register in
4471 ;; this case, we just lose precision that we would have otherwise gotten but
4472 ;; is not guaranteed. Perhaps this should be tightened up at some point.
4474 (define_expand "extendsfdf2"
4475 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4476 (float_extend:DF (match_operand:SF 1 "reg_or_none500mem_operand" "")))]
4477 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
4480 (define_insn_and_split "*extendsfdf2_fpr"
4481 [(set (match_operand:DF 0 "gpc_reg_operand" "=d,?d,d")
4482 (float_extend:DF (match_operand:SF 1 "reg_or_mem_operand" "0,f,m")))]
4483 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
4488 "&& reload_completed && REG_P (operands[1]) && REGNO (operands[0]) == REGNO (operands[1])"
4491 emit_note (NOTE_INSN_DELETED);
4494 [(set_attr "type" "fp,fp,fpload")])
4496 (define_expand "truncdfsf2"
4497 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4498 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "")))]
4499 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
4502 (define_insn "*truncdfsf2_fpr"
4503 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4504 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "d")))]
4505 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
4507 [(set_attr "type" "fp")])
4509 (define_expand "negsf2"
4510 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4511 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
4512 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
4515 (define_insn "*negsf2"
4516 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4517 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4518 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
4520 [(set_attr "type" "fp")])
4522 (define_expand "abssf2"
4523 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4524 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
4525 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
4528 (define_insn "*abssf2"
4529 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4530 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4531 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
4533 [(set_attr "type" "fp")])
4536 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4537 (neg:SF (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f"))))]
4538 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
4540 [(set_attr "type" "fp")])
4542 (define_expand "addsf3"
4543 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4544 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "")
4545 (match_operand:SF 2 "gpc_reg_operand" "")))]
4546 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
4550 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4551 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4552 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4553 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
4555 [(set_attr "type" "fp")
4556 (set_attr "fp_type" "fp_addsub_s")])
4558 (define_expand "subsf3"
4559 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4560 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "")
4561 (match_operand:SF 2 "gpc_reg_operand" "")))]
4562 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
4566 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4567 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4568 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4569 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
4571 [(set_attr "type" "fp")
4572 (set_attr "fp_type" "fp_addsub_s")])
4574 (define_expand "mulsf3"
4575 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4576 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "")
4577 (match_operand:SF 2 "gpc_reg_operand" "")))]
4578 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
4582 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4583 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4584 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4585 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
4587 [(set_attr "type" "fp")
4588 (set_attr "fp_type" "fp_mul_s")])
4590 (define_expand "divsf3"
4591 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4592 (div:SF (match_operand:SF 1 "gpc_reg_operand" "")
4593 (match_operand:SF 2 "gpc_reg_operand" "")))]
4594 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
4598 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4599 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4600 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4601 "TARGET_HARD_FLOAT && TARGET_FPRS
4602 && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
4604 [(set_attr "type" "sdiv")])
4607 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4608 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))]
4611 [(set_attr "type" "fp")])
4613 ; builtin fmaf support
4614 (define_insn "*fmasf4_fpr"
4615 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4616 (fma:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4617 (match_operand:SF 2 "gpc_reg_operand" "f")
4618 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4619 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
4620 "fmadds %0,%1,%2,%3"
4621 [(set_attr "type" "fp")
4622 (set_attr "fp_type" "fp_maddsub_s")])
4624 (define_insn "*fmssf4_fpr"
4625 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4626 (fma:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4627 (match_operand:SF 2 "gpc_reg_operand" "f")
4628 (neg:SF (match_operand:SF 3 "gpc_reg_operand" "f"))))]
4629 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
4630 "fmsubs %0,%1,%2,%3"
4631 [(set_attr "type" "fp")
4632 (set_attr "fp_type" "fp_maddsub_s")])
4634 (define_insn "*nfmasf4_fpr"
4635 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4636 (neg:SF (fma:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4637 (match_operand:SF 2 "gpc_reg_operand" "f")
4638 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
4639 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
4640 "fnmadds %0,%1,%2,%3"
4641 [(set_attr "type" "fp")
4642 (set_attr "fp_type" "fp_maddsub_s")])
4644 (define_insn "*nfmssf4_fpr"
4645 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4646 (neg:SF (fma:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4647 (match_operand:SF 2 "gpc_reg_operand" "f")
4648 (neg:SF (match_operand:SF 3 "gpc_reg_operand" "f")))))]
4649 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
4650 "fnmsubs %0,%1,%2,%3"
4651 [(set_attr "type" "fp")
4652 (set_attr "fp_type" "fp_maddsub_s")])
4654 (define_expand "sqrtsf2"
4655 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4656 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
4657 "(TARGET_PPC_GPOPT || TARGET_XILINX_FPU)
4658 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
4659 && !TARGET_SIMPLE_FPU"
4663 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4664 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4665 "(TARGET_PPC_GPOPT || TARGET_XILINX_FPU) && TARGET_HARD_FLOAT
4666 && TARGET_FPRS && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
4668 [(set_attr "type" "ssqrt")])
4670 (define_insn "*rsqrtsf_internal1"
4671 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4672 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")]
4676 [(set_attr "type" "fp")])
4678 ;; This expander is here to avoid FLOAT_WORDS_BIGENDIAN tests in
4679 ;; builtins.c and optabs.c that are not correct for IBM long double
4680 ;; when little-endian.
4681 (define_expand "signbittf2"
4683 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "")))
4685 (subreg:DI (match_dup 2) 0))
4688 (set (match_operand:SI 0 "gpc_reg_operand" "")
4691 && TARGET_HARD_FLOAT
4692 && (TARGET_FPRS || TARGET_E500_DOUBLE)
4693 && TARGET_LONG_DOUBLE_128"
4695 operands[2] = gen_reg_rtx (DFmode);
4696 operands[3] = gen_reg_rtx (DImode);
4697 if (TARGET_POWERPC64)
4699 operands[4] = gen_reg_rtx (DImode);
4700 operands[5] = gen_rtx_LSHIFTRT (DImode, operands[3], GEN_INT (63));
4701 operands[6] = gen_rtx_SUBREG (SImode, operands[4],
4702 WORDS_BIG_ENDIAN ? 4 : 0);
4706 operands[4] = gen_reg_rtx (SImode);
4707 operands[5] = gen_rtx_SUBREG (SImode, operands[3],
4708 WORDS_BIG_ENDIAN ? 0 : 4);
4709 operands[6] = gen_rtx_LSHIFTRT (SImode, operands[4], GEN_INT (31));
4713 (define_expand "copysign<mode>3"
4715 (abs:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")))
4717 (neg:SFDF (abs:SFDF (match_dup 1))))
4718 (set (match_operand:SFDF 0 "gpc_reg_operand" "")
4719 (if_then_else:SFDF (ge (match_operand:SFDF 2 "gpc_reg_operand" "")
4723 "TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>
4724 && ((TARGET_PPC_GFXOPT
4725 && !HONOR_NANS (<MODE>mode)
4726 && !HONOR_SIGNED_ZEROS (<MODE>mode))
4728 || VECTOR_UNIT_VSX_P (<MODE>mode))"
4730 if (TARGET_CMPB || VECTOR_UNIT_VSX_P (<MODE>mode))
4732 emit_insn (gen_copysign<mode>3_fcpsgn (operands[0], operands[1],
4737 operands[3] = gen_reg_rtx (<MODE>mode);
4738 operands[4] = gen_reg_rtx (<MODE>mode);
4739 operands[5] = CONST0_RTX (<MODE>mode);
4742 ;; Use an unspec rather providing an if-then-else in RTL, to prevent the
4743 ;; compiler from optimizing -0.0
4744 (define_insn "copysign<mode>3_fcpsgn"
4745 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
4746 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")
4747 (match_operand:SFDF 2 "gpc_reg_operand" "<rreg2>")]
4749 "TARGET_CMPB && !VECTOR_UNIT_VSX_P (<MODE>mode)"
4751 [(set_attr "type" "fp")])
4753 ;; For MIN, MAX, and conditional move, we use DEFINE_EXPAND's that involve a
4754 ;; fsel instruction and some auxiliary computations. Then we just have a
4755 ;; single DEFINE_INSN for fsel and the define_splits to make them if made by
4757 (define_expand "smaxsf3"
4758 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4759 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
4760 (match_operand:SF 2 "gpc_reg_operand" ""))
4763 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
4764 && TARGET_SINGLE_FLOAT && !flag_trapping_math"
4765 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
4767 (define_expand "sminsf3"
4768 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4769 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
4770 (match_operand:SF 2 "gpc_reg_operand" ""))
4773 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
4774 && TARGET_SINGLE_FLOAT && !flag_trapping_math"
4775 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
4778 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4779 (match_operator:SF 3 "min_max_operator"
4780 [(match_operand:SF 1 "gpc_reg_operand" "")
4781 (match_operand:SF 2 "gpc_reg_operand" "")]))]
4782 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
4783 && TARGET_SINGLE_FLOAT && !flag_trapping_math"
4786 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
4787 operands[1], operands[2]);
4791 (define_expand "mov<mode>cc"
4792 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
4793 (if_then_else:GPR (match_operand 1 "comparison_operator" "")
4794 (match_operand:GPR 2 "gpc_reg_operand" "")
4795 (match_operand:GPR 3 "gpc_reg_operand" "")))]
4799 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
4805 ;; We use the BASE_REGS for the isel input operands because, if rA is
4806 ;; 0, the value of 0 is placed in rD upon truth. Similarly for rB
4807 ;; because we may switch the operands and rB may end up being rA.
4809 ;; We need 2 patterns: an unsigned and a signed pattern. We could
4810 ;; leave out the mode in operand 4 and use one pattern, but reload can
4811 ;; change the mode underneath our feet and then gets confused trying
4812 ;; to reload the value.
4813 (define_insn "isel_signed_<mode>"
4814 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
4816 (match_operator 1 "scc_comparison_operator"
4817 [(match_operand:CC 4 "cc_reg_operand" "y,y")
4819 (match_operand:GPR 2 "reg_or_cint_operand" "O,b")
4820 (match_operand:GPR 3 "gpc_reg_operand" "r,r")))]
4823 { return output_isel (operands); }"
4824 [(set_attr "type" "isel")
4825 (set_attr "length" "4")])
4827 (define_insn "isel_unsigned_<mode>"
4828 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
4830 (match_operator 1 "scc_comparison_operator"
4831 [(match_operand:CCUNS 4 "cc_reg_operand" "y,y")
4833 (match_operand:GPR 2 "reg_or_cint_operand" "O,b")
4834 (match_operand:GPR 3 "gpc_reg_operand" "r,r")))]
4837 { return output_isel (operands); }"
4838 [(set_attr "type" "isel")
4839 (set_attr "length" "4")])
4841 ;; These patterns can be useful for combine; they let combine know that
4842 ;; isel can handle reversed comparisons so long as the operands are
4845 (define_insn "*isel_reversed_signed_<mode>"
4846 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
4848 (match_operator 1 "scc_rev_comparison_operator"
4849 [(match_operand:CC 4 "cc_reg_operand" "y")
4851 (match_operand:GPR 2 "gpc_reg_operand" "b")
4852 (match_operand:GPR 3 "gpc_reg_operand" "b")))]
4855 { return output_isel (operands); }"
4856 [(set_attr "type" "isel")
4857 (set_attr "length" "4")])
4859 (define_insn "*isel_reversed_unsigned_<mode>"
4860 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
4862 (match_operator 1 "scc_rev_comparison_operator"
4863 [(match_operand:CCUNS 4 "cc_reg_operand" "y")
4865 (match_operand:GPR 2 "gpc_reg_operand" "b")
4866 (match_operand:GPR 3 "gpc_reg_operand" "b")))]
4869 { return output_isel (operands); }"
4870 [(set_attr "type" "isel")
4871 (set_attr "length" "4")])
4873 (define_expand "movsfcc"
4874 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4875 (if_then_else:SF (match_operand 1 "comparison_operator" "")
4876 (match_operand:SF 2 "gpc_reg_operand" "")
4877 (match_operand:SF 3 "gpc_reg_operand" "")))]
4878 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
4881 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
4887 (define_insn "*fselsfsf4"
4888 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4889 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
4890 (match_operand:SF 4 "zero_fp_constant" "F"))
4891 (match_operand:SF 2 "gpc_reg_operand" "f")
4892 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4893 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
4895 [(set_attr "type" "fp")])
4897 (define_insn "*fseldfsf4"
4898 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4899 (if_then_else:SF (ge (match_operand:DF 1 "gpc_reg_operand" "d")
4900 (match_operand:DF 4 "zero_fp_constant" "F"))
4901 (match_operand:SF 2 "gpc_reg_operand" "f")
4902 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4903 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_SINGLE_FLOAT"
4905 [(set_attr "type" "fp")])
4907 (define_expand "negdf2"
4908 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4909 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
4910 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
4913 (define_insn "*negdf2_fpr"
4914 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
4915 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "d")))]
4916 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
4917 && !VECTOR_UNIT_VSX_P (DFmode)"
4919 [(set_attr "type" "fp")])
4921 (define_expand "absdf2"
4922 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4923 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
4924 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
4927 (define_insn "*absdf2_fpr"
4928 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
4929 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "d")))]
4930 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
4931 && !VECTOR_UNIT_VSX_P (DFmode)"
4933 [(set_attr "type" "fp")])
4935 (define_insn "*nabsdf2_fpr"
4936 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
4937 (neg:DF (abs:DF (match_operand:DF 1 "gpc_reg_operand" "d"))))]
4938 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
4939 && !VECTOR_UNIT_VSX_P (DFmode)"
4941 [(set_attr "type" "fp")])
4943 (define_expand "adddf3"
4944 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4945 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "")
4946 (match_operand:DF 2 "gpc_reg_operand" "")))]
4947 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
4950 (define_insn "*adddf3_fpr"
4951 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
4952 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
4953 (match_operand:DF 2 "gpc_reg_operand" "d")))]
4954 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
4955 && !VECTOR_UNIT_VSX_P (DFmode)"
4957 [(set_attr "type" "fp")
4958 (set_attr "fp_type" "fp_addsub_d")])
4960 (define_expand "subdf3"
4961 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4962 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "")
4963 (match_operand:DF 2 "gpc_reg_operand" "")))]
4964 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
4967 (define_insn "*subdf3_fpr"
4968 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
4969 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "d")
4970 (match_operand:DF 2 "gpc_reg_operand" "d")))]
4971 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
4972 && !VECTOR_UNIT_VSX_P (DFmode)"
4974 [(set_attr "type" "fp")
4975 (set_attr "fp_type" "fp_addsub_d")])
4977 (define_expand "muldf3"
4978 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4979 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "")
4980 (match_operand:DF 2 "gpc_reg_operand" "")))]
4981 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
4984 (define_insn "*muldf3_fpr"
4985 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
4986 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
4987 (match_operand:DF 2 "gpc_reg_operand" "d")))]
4988 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
4989 && !VECTOR_UNIT_VSX_P (DFmode)"
4991 [(set_attr "type" "dmul")
4992 (set_attr "fp_type" "fp_mul_d")])
4994 (define_expand "divdf3"
4995 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4996 (div:DF (match_operand:DF 1 "gpc_reg_operand" "")
4997 (match_operand:DF 2 "gpc_reg_operand" "")))]
4999 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)
5000 && !TARGET_SIMPLE_FPU"
5003 (define_insn "*divdf3_fpr"
5004 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
5005 (div:DF (match_operand:DF 1 "gpc_reg_operand" "d")
5006 (match_operand:DF 2 "gpc_reg_operand" "d")))]
5007 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && !TARGET_SIMPLE_FPU
5008 && !VECTOR_UNIT_VSX_P (DFmode)"
5010 [(set_attr "type" "ddiv")])
5012 (define_insn "*fred_fpr"
5013 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5014 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))]
5015 "TARGET_FRE && !VECTOR_UNIT_VSX_P (DFmode)"
5017 [(set_attr "type" "fp")])
5019 (define_insn "*rsqrtdf_internal1"
5020 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
5021 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "d")]
5023 "TARGET_FRSQRTE && !VECTOR_UNIT_VSX_P (DFmode)"
5025 [(set_attr "type" "fp")])
5027 ; builtin fma support
5028 (define_insn "*fmadf4_fpr"
5029 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5030 (fma:DF (match_operand:DF 1 "gpc_reg_operand" "f")
5031 (match_operand:DF 2 "gpc_reg_operand" "f")
5032 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5033 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5034 && VECTOR_UNIT_NONE_P (DFmode)"
5036 [(set_attr "type" "fp")
5037 (set_attr "fp_type" "fp_maddsub_d")])
5039 (define_insn "*fmsdf4_fpr"
5040 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5041 (fma:DF (match_operand:DF 1 "gpc_reg_operand" "f")
5042 (match_operand:DF 2 "gpc_reg_operand" "f")
5043 (neg:DF (match_operand:DF 3 "gpc_reg_operand" "f"))))]
5044 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5045 && VECTOR_UNIT_NONE_P (DFmode)"
5047 [(set_attr "type" "fp")
5048 (set_attr "fp_type" "fp_maddsub_d")])
5050 (define_insn "*nfmadf4_fpr"
5051 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5052 (neg:DF (fma:DF (match_operand:DF 1 "gpc_reg_operand" "f")
5053 (match_operand:DF 2 "gpc_reg_operand" "f")
5054 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
5055 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5056 && VECTOR_UNIT_NONE_P (DFmode)"
5057 "fnmadd %0,%1,%2,%3"
5058 [(set_attr "type" "fp")
5059 (set_attr "fp_type" "fp_maddsub_d")])
5061 (define_insn "*nfmsdf4_fpr"
5062 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5063 (neg:DF (fma:DF (match_operand:DF 1 "gpc_reg_operand" "f")
5064 (match_operand:DF 2 "gpc_reg_operand" "f")
5065 (neg:DF (match_operand:DF 3 "gpc_reg_operand" "f")))))]
5066 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5067 && VECTOR_UNIT_NONE_P (DFmode)"
5068 "fnmsub %0,%1,%2,%3"
5069 [(set_attr "type" "fp")
5070 (set_attr "fp_type" "fp_maddsub_d")])
5072 (define_expand "sqrtdf2"
5073 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5074 (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
5075 "TARGET_PPC_GPOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5078 (define_insn "*sqrtdf2_fpr"
5079 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
5080 (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "d")))]
5081 "TARGET_PPC_GPOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5082 && !VECTOR_UNIT_VSX_P (DFmode)"
5084 [(set_attr "type" "dsqrt")])
5086 ;; The conditional move instructions allow us to perform max and min
5087 ;; operations even when
5089 (define_expand "smaxdf3"
5090 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5091 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
5092 (match_operand:DF 2 "gpc_reg_operand" ""))
5095 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5096 && !flag_trapping_math"
5097 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
5099 (define_expand "smindf3"
5100 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5101 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
5102 (match_operand:DF 2 "gpc_reg_operand" ""))
5105 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5106 && !flag_trapping_math"
5107 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
5110 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5111 (match_operator:DF 3 "min_max_operator"
5112 [(match_operand:DF 1 "gpc_reg_operand" "")
5113 (match_operand:DF 2 "gpc_reg_operand" "")]))]
5114 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5115 && !flag_trapping_math"
5118 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
5119 operands[1], operands[2]);
5123 (define_expand "movdfcc"
5124 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5125 (if_then_else:DF (match_operand 1 "comparison_operator" "")
5126 (match_operand:DF 2 "gpc_reg_operand" "")
5127 (match_operand:DF 3 "gpc_reg_operand" "")))]
5128 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5131 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5137 (define_insn "*fseldfdf4"
5138 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
5139 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "d")
5140 (match_operand:DF 4 "zero_fp_constant" "F"))
5141 (match_operand:DF 2 "gpc_reg_operand" "d")
5142 (match_operand:DF 3 "gpc_reg_operand" "d")))]
5143 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5145 [(set_attr "type" "fp")])
5147 (define_insn "*fselsfdf4"
5148 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
5149 (if_then_else:DF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
5150 (match_operand:SF 4 "zero_fp_constant" "F"))
5151 (match_operand:DF 2 "gpc_reg_operand" "d")
5152 (match_operand:DF 3 "gpc_reg_operand" "d")))]
5153 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_SINGLE_FLOAT"
5155 [(set_attr "type" "fp")])
5157 ;; Conversions to and from floating-point.
5159 ; We don't define lfiwax/lfiwzx with the normal definition, because we
5160 ; don't want to support putting SImode in FPR registers.
5161 (define_insn "lfiwax"
5162 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
5163 (unspec:DI [(match_operand:SI 1 "indexed_or_indirect_operand" "Z")]
5165 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWAX"
5167 [(set_attr "type" "fpload")])
5169 ; This split must be run before register allocation because it allocates the
5170 ; memory slot that is needed to move values to/from the FPR. We don't allocate
5171 ; it earlier to allow for the combiner to merge insns together where it might
5172 ; not be needed and also in case the insns are deleted as dead code.
5174 (define_insn_and_split "floatsi<mode>2_lfiwax"
5175 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d")
5176 (float:SFDF (match_operand:SI 1 "nonimmediate_operand" "r")))
5177 (clobber (match_scratch:DI 2 "=d"))]
5178 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWAX
5179 && <SI_CONVERT_FP> && can_create_pseudo_p ()"
5185 rtx dest = operands[0];
5186 rtx src = operands[1];
5189 if (!MEM_P (src) && TARGET_MFPGPR && TARGET_POWERPC64)
5190 tmp = convert_to_mode (DImode, src, false);
5194 if (GET_CODE (tmp) == SCRATCH)
5195 tmp = gen_reg_rtx (DImode);
5198 src = rs6000_address_for_fpconvert (src);
5199 emit_insn (gen_lfiwax (tmp, src));
5203 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
5204 emit_move_insn (stack, src);
5205 emit_insn (gen_lfiwax (tmp, stack));
5208 emit_insn (gen_floatdi<mode>2 (dest, tmp));
5211 [(set_attr "length" "12")
5212 (set_attr "type" "fpload")])
5214 (define_insn_and_split "floatsi<mode>2_lfiwax_mem"
5215 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d,<rreg2>")
5218 (match_operand:SI 1 "memory_operand" "Z,Z"))))
5219 (clobber (match_scratch:DI 2 "=0,d"))]
5220 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWAX
5227 operands[1] = rs6000_address_for_fpconvert (operands[1]);
5228 if (GET_CODE (operands[2]) == SCRATCH)
5229 operands[2] = gen_reg_rtx (DImode);
5230 emit_insn (gen_lfiwax (operands[2], operands[1]));
5231 emit_insn (gen_floatdi<mode>2 (operands[0], operands[2]));
5234 [(set_attr "length" "8")
5235 (set_attr "type" "fpload")])
5237 (define_insn "lfiwzx"
5238 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
5239 (unspec:DI [(match_operand:SI 1 "indexed_or_indirect_operand" "Z")]
5241 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWZX"
5243 [(set_attr "type" "fpload")])
5245 (define_insn_and_split "floatunssi<mode>2_lfiwzx"
5246 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d")
5247 (unsigned_float:SFDF (match_operand:SI 1 "nonimmediate_operand" "r")))
5248 (clobber (match_scratch:DI 2 "=d"))]
5249 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWZX
5256 rtx dest = operands[0];
5257 rtx src = operands[1];
5260 if (!MEM_P (src) && TARGET_MFPGPR && TARGET_POWERPC64)
5261 tmp = convert_to_mode (DImode, src, true);
5265 if (GET_CODE (tmp) == SCRATCH)
5266 tmp = gen_reg_rtx (DImode);
5269 src = rs6000_address_for_fpconvert (src);
5270 emit_insn (gen_lfiwzx (tmp, src));
5274 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
5275 emit_move_insn (stack, src);
5276 emit_insn (gen_lfiwzx (tmp, stack));
5279 emit_insn (gen_floatdi<mode>2 (dest, tmp));
5282 [(set_attr "length" "12")
5283 (set_attr "type" "fpload")])
5285 (define_insn_and_split "floatunssi<mode>2_lfiwzx_mem"
5286 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d,<rreg2>")
5287 (unsigned_float:SFDF
5289 (match_operand:SI 1 "memory_operand" "Z,Z"))))
5290 (clobber (match_scratch:DI 2 "=0,d"))]
5291 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWZX
5298 operands[1] = rs6000_address_for_fpconvert (operands[1]);
5299 if (GET_CODE (operands[2]) == SCRATCH)
5300 operands[2] = gen_reg_rtx (DImode);
5301 emit_insn (gen_lfiwzx (operands[2], operands[1]));
5302 emit_insn (gen_floatdi<mode>2 (operands[0], operands[2]));
5305 [(set_attr "length" "8")
5306 (set_attr "type" "fpload")])
5308 ; For each of these conversions, there is a define_expand, a define_insn
5309 ; with a '#' template, and a define_split (with C code). The idea is
5310 ; to allow constant folding with the template of the define_insn,
5311 ; then to have the insns split later (between sched1 and final).
5313 (define_expand "floatsidf2"
5314 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5315 (float:DF (match_operand:SI 1 "nonimmediate_operand" "")))
5318 (clobber (match_dup 4))
5319 (clobber (match_dup 5))
5320 (clobber (match_dup 6))])]
5322 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5325 if (TARGET_E500_DOUBLE)
5327 if (!REG_P (operands[1]))
5328 operands[1] = force_reg (SImode, operands[1]);
5329 emit_insn (gen_spe_floatsidf2 (operands[0], operands[1]));
5332 else if (TARGET_LFIWAX && TARGET_FCFID)
5334 emit_insn (gen_floatsidf2_lfiwax (operands[0], operands[1]));
5337 else if (TARGET_FCFID)
5339 rtx dreg = operands[1];
5341 dreg = force_reg (SImode, dreg);
5342 dreg = convert_to_mode (DImode, dreg, false);
5343 emit_insn (gen_floatdidf2 (operands[0], dreg));
5347 if (!REG_P (operands[1]))
5348 operands[1] = force_reg (SImode, operands[1]);
5349 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5350 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503601774854144\", DFmode));
5351 operands[4] = rs6000_allocate_stack_temp (DFmode, true, false);
5352 operands[5] = gen_reg_rtx (DFmode);
5353 operands[6] = gen_reg_rtx (SImode);
5356 (define_insn_and_split "*floatsidf2_internal"
5357 [(set (match_operand:DF 0 "gpc_reg_operand" "=&d")
5358 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5359 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5360 (use (match_operand:DF 3 "gpc_reg_operand" "d"))
5361 (clobber (match_operand:DF 4 "offsettable_mem_operand" "=o"))
5362 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&d"))
5363 (clobber (match_operand:SI 6 "gpc_reg_operand" "=&r"))]
5364 "! TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5370 rtx lowword, highword;
5371 gcc_assert (MEM_P (operands[4]));
5372 highword = adjust_address (operands[4], SImode, 0);
5373 lowword = adjust_address (operands[4], SImode, 4);
5374 if (! WORDS_BIG_ENDIAN)
5377 tmp = highword; highword = lowword; lowword = tmp;
5380 emit_insn (gen_xorsi3 (operands[6], operands[1],
5381 GEN_INT (~ (HOST_WIDE_INT) 0x7fffffff)));
5382 emit_move_insn (lowword, operands[6]);
5383 emit_move_insn (highword, operands[2]);
5384 emit_move_insn (operands[5], operands[4]);
5385 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5388 [(set_attr "length" "24")
5389 (set_attr "type" "fp")])
5391 ;; If we don't have a direct conversion to single precision, don't enable this
5392 ;; conversion for 32-bit without fast math, because we don't have the insn to
5393 ;; generate the fixup swizzle to avoid double rounding problems.
5394 (define_expand "floatunssisf2"
5395 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5396 (unsigned_float:SF (match_operand:SI 1 "nonimmediate_operand" "")))]
5397 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT
5400 && ((TARGET_FCFIDUS && TARGET_LFIWZX)
5401 || (TARGET_DOUBLE_FLOAT && TARGET_FCFID
5402 && (TARGET_POWERPC64 || flag_unsafe_math_optimizations)))))"
5407 if (!REG_P (operands[1]))
5408 operands[1] = force_reg (SImode, operands[1]);
5410 else if (TARGET_LFIWZX && TARGET_FCFIDUS)
5412 emit_insn (gen_floatunssisf2_lfiwzx (operands[0], operands[1]));
5417 rtx dreg = operands[1];
5419 dreg = force_reg (SImode, dreg);
5420 dreg = convert_to_mode (DImode, dreg, true);
5421 emit_insn (gen_floatdisf2 (operands[0], dreg));
5426 (define_expand "floatunssidf2"
5427 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5428 (unsigned_float:DF (match_operand:SI 1 "nonimmediate_operand" "")))
5431 (clobber (match_dup 4))
5432 (clobber (match_dup 5))])]
5434 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5437 if (TARGET_E500_DOUBLE)
5439 if (!REG_P (operands[1]))
5440 operands[1] = force_reg (SImode, operands[1]);
5441 emit_insn (gen_spe_floatunssidf2 (operands[0], operands[1]));
5444 else if (TARGET_LFIWZX && TARGET_FCFID)
5446 emit_insn (gen_floatunssidf2_lfiwzx (operands[0], operands[1]));
5449 else if (TARGET_FCFID)
5451 rtx dreg = operands[1];
5453 dreg = force_reg (SImode, dreg);
5454 dreg = convert_to_mode (DImode, dreg, true);
5455 emit_insn (gen_floatdidf2 (operands[0], dreg));
5459 if (!REG_P (operands[1]))
5460 operands[1] = force_reg (SImode, operands[1]);
5461 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5462 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503599627370496\", DFmode));
5463 operands[4] = rs6000_allocate_stack_temp (DFmode, true, false);
5464 operands[5] = gen_reg_rtx (DFmode);
5467 (define_insn_and_split "*floatunssidf2_internal"
5468 [(set (match_operand:DF 0 "gpc_reg_operand" "=&d")
5469 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5470 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5471 (use (match_operand:DF 3 "gpc_reg_operand" "d"))
5472 (clobber (match_operand:DF 4 "offsettable_mem_operand" "=o"))
5473 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&d"))]
5474 "! TARGET_FCFIDU && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5475 && !(TARGET_FCFID && TARGET_POWERPC64)"
5481 rtx lowword, highword;
5482 gcc_assert (MEM_P (operands[4]));
5483 highword = adjust_address (operands[4], SImode, 0);
5484 lowword = adjust_address (operands[4], SImode, 4);
5485 if (! WORDS_BIG_ENDIAN)
5488 tmp = highword; highword = lowword; lowword = tmp;
5491 emit_move_insn (lowword, operands[1]);
5492 emit_move_insn (highword, operands[2]);
5493 emit_move_insn (operands[5], operands[4]);
5494 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5497 [(set_attr "length" "20")
5498 (set_attr "type" "fp")])
5500 (define_expand "fix_trunc<mode>si2"
5501 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5502 (fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "")))]
5503 "TARGET_HARD_FLOAT && ((TARGET_FPRS && <TARGET_FLOAT>) || <E500_CONVERT>)"
5506 if (!<E500_CONVERT>)
5511 emit_insn (gen_fix_trunc<mode>si2_stfiwx (operands[0], operands[1]));
5514 tmp = gen_reg_rtx (DImode);
5515 stack = rs6000_allocate_stack_temp (DImode, true, false);
5516 emit_insn (gen_fix_trunc<mode>si2_internal (operands[0], operands[1],
5523 ; Like the convert to float patterns, this insn must be split before
5524 ; register allocation so that it can allocate the memory slot if it
5526 (define_insn_and_split "fix_trunc<mode>si2_stfiwx"
5527 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
5528 (fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d")))
5529 (clobber (match_scratch:DI 2 "=d"))]
5530 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5531 && (<MODE>mode != SFmode || TARGET_SINGLE_FLOAT)
5532 && TARGET_STFIWX && can_create_pseudo_p ()"
5537 rtx dest = operands[0];
5538 rtx src = operands[1];
5539 rtx tmp = operands[2];
5541 if (GET_CODE (tmp) == SCRATCH)
5542 tmp = gen_reg_rtx (DImode);
5544 emit_insn (gen_fctiwz_<mode> (tmp, src));
5547 dest = rs6000_address_for_fpconvert (dest);
5548 emit_insn (gen_stfiwx (dest, tmp));
5551 else if (TARGET_MFPGPR && TARGET_POWERPC64)
5553 dest = gen_lowpart (DImode, dest);
5554 emit_move_insn (dest, tmp);
5559 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
5560 emit_insn (gen_stfiwx (stack, tmp));
5561 emit_move_insn (dest, stack);
5565 [(set_attr "length" "12")
5566 (set_attr "type" "fp")])
5568 (define_insn_and_split "fix_trunc<mode>si2_internal"
5569 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,?r")
5570 (fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d,<rreg>")))
5571 (clobber (match_operand:DI 2 "gpc_reg_operand" "=1,d"))
5572 (clobber (match_operand:DI 3 "offsettable_mem_operand" "=o,o"))]
5573 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5580 gcc_assert (MEM_P (operands[3]));
5581 lowword = adjust_address (operands[3], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
5583 emit_insn (gen_fctiwz_<mode> (operands[2], operands[1]));
5584 emit_move_insn (operands[3], operands[2]);
5585 emit_move_insn (operands[0], lowword);
5588 [(set_attr "length" "16")
5589 (set_attr "type" "fp")])
5591 (define_expand "fix_trunc<mode>di2"
5592 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5593 (fix:DI (match_operand:SFDF 1 "gpc_reg_operand" "")))]
5594 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
5598 (define_insn "*fix_trunc<mode>di2_fctidz"
5599 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
5600 (fix:DI (match_operand:SFDF 1 "gpc_reg_operand" "d")))]
5601 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
5602 && TARGET_FCFID && !VECTOR_UNIT_VSX_P (<MODE>mode)"
5604 [(set_attr "type" "fp")])
5606 (define_expand "fixuns_trunc<mode>si2"
5607 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5608 (unsigned_fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "")))]
5610 && ((TARGET_FPRS && <TARGET_FLOAT> && TARGET_FCTIWUZ && TARGET_STFIWX)
5614 if (!<E500_CONVERT>)
5616 emit_insn (gen_fixuns_trunc<mode>si2_stfiwx (operands[0], operands[1]));
5621 (define_insn_and_split "fixuns_trunc<mode>si2_stfiwx"
5622 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
5623 (unsigned_fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d")))
5624 (clobber (match_scratch:DI 2 "=d"))]
5625 "TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT> && TARGET_FCTIWUZ
5626 && TARGET_STFIWX && can_create_pseudo_p ()"
5631 rtx dest = operands[0];
5632 rtx src = operands[1];
5633 rtx tmp = operands[2];
5635 if (GET_CODE (tmp) == SCRATCH)
5636 tmp = gen_reg_rtx (DImode);
5638 emit_insn (gen_fctiwuz_<mode> (tmp, src));
5641 dest = rs6000_address_for_fpconvert (dest);
5642 emit_insn (gen_stfiwx (dest, tmp));
5645 else if (TARGET_MFPGPR && TARGET_POWERPC64)
5647 dest = gen_lowpart (DImode, dest);
5648 emit_move_insn (dest, tmp);
5653 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
5654 emit_insn (gen_stfiwx (stack, tmp));
5655 emit_move_insn (dest, stack);
5659 [(set_attr "length" "12")
5660 (set_attr "type" "fp")])
5662 (define_expand "fixuns_trunc<mode>di2"
5663 [(set (match_operand:DI 0 "register_operand" "")
5664 (unsigned_fix:DI (match_operand:SFDF 1 "register_operand" "")))]
5665 "TARGET_HARD_FLOAT && (TARGET_FCTIDUZ || VECTOR_UNIT_VSX_P (<MODE>mode))"
5668 (define_insn "*fixuns_trunc<mode>di2_fctiduz"
5669 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
5670 (unsigned_fix:DI (match_operand:SFDF 1 "gpc_reg_operand" "d")))]
5671 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
5672 && TARGET_FCTIDUZ && !VECTOR_UNIT_VSX_P (<MODE>mode)"
5674 [(set_attr "type" "fp")])
5676 ; Here, we use (set (reg) (unspec:DI [(fix:SI ...)] UNSPEC_FCTIWZ))
5677 ; rather than (set (subreg:SI (reg)) (fix:SI ...))
5678 ; because the first makes it clear that operand 0 is not live
5679 ; before the instruction.
5680 (define_insn "fctiwz_<mode>"
5681 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
5682 (unspec:DI [(fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d"))]
5684 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5686 [(set_attr "type" "fp")])
5688 (define_insn "fctiwuz_<mode>"
5689 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
5690 (unspec:DI [(unsigned_fix:SI
5691 (match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>"))]
5693 "TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT> && TARGET_FCTIWUZ"
5695 [(set_attr "type" "fp")])
5697 ;; Only optimize (float (fix x)) -> frz if we are in fast-math mode, since
5698 ;; since the friz instruction does not truncate the value if the floating
5699 ;; point value is < LONG_MIN or > LONG_MAX.
5700 (define_insn "*friz"
5701 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
5702 (float:DF (fix:DI (match_operand:DF 1 "gpc_reg_operand" "d"))))]
5703 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_FPRND
5704 && !VECTOR_UNIT_VSX_P (DFmode) && flag_unsafe_math_optimizations
5705 && !flag_trapping_math && TARGET_FRIZ"
5707 [(set_attr "type" "fp")])
5709 ;; Since FCTIWZ doesn't sign extend the upper bits, we have to do a store and a
5710 ;; load to properly sign extend the value, but at least doing a store, load
5711 ;; into a GPR to sign extend, a store from the GPR and a load back into the FPR
5712 ;; if we have 32-bit memory ops
5713 (define_insn_and_split "*round32<mode>2_fprs"
5714 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d")
5716 (fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d"))))
5717 (clobber (match_scratch:DI 2 "=d"))
5718 (clobber (match_scratch:DI 3 "=d"))]
5719 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5720 && <SI_CONVERT_FP> && TARGET_LFIWAX && TARGET_STFIWX && TARGET_FCFID
5721 && can_create_pseudo_p ()"
5726 rtx dest = operands[0];
5727 rtx src = operands[1];
5728 rtx tmp1 = operands[2];
5729 rtx tmp2 = operands[3];
5730 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
5732 if (GET_CODE (tmp1) == SCRATCH)
5733 tmp1 = gen_reg_rtx (DImode);
5734 if (GET_CODE (tmp2) == SCRATCH)
5735 tmp2 = gen_reg_rtx (DImode);
5737 emit_insn (gen_fctiwz_<mode> (tmp1, src));
5738 emit_insn (gen_stfiwx (stack, tmp1));
5739 emit_insn (gen_lfiwax (tmp2, stack));
5740 emit_insn (gen_floatdi<mode>2 (dest, tmp2));
5743 [(set_attr "type" "fpload")
5744 (set_attr "length" "16")])
5746 (define_insn_and_split "*roundu32<mode>2_fprs"
5747 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d")
5748 (unsigned_float:SFDF
5749 (unsigned_fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d"))))
5750 (clobber (match_scratch:DI 2 "=d"))
5751 (clobber (match_scratch:DI 3 "=d"))]
5752 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5753 && TARGET_LFIWZX && TARGET_STFIWX && TARGET_FCFIDU
5754 && can_create_pseudo_p ()"
5759 rtx dest = operands[0];
5760 rtx src = operands[1];
5761 rtx tmp1 = operands[2];
5762 rtx tmp2 = operands[3];
5763 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
5765 if (GET_CODE (tmp1) == SCRATCH)
5766 tmp1 = gen_reg_rtx (DImode);
5767 if (GET_CODE (tmp2) == SCRATCH)
5768 tmp2 = gen_reg_rtx (DImode);
5770 emit_insn (gen_fctiwuz_<mode> (tmp1, src));
5771 emit_insn (gen_stfiwx (stack, tmp1));
5772 emit_insn (gen_lfiwzx (tmp2, stack));
5773 emit_insn (gen_floatdi<mode>2 (dest, tmp2));
5776 [(set_attr "type" "fpload")
5777 (set_attr "length" "16")])
5779 ;; No VSX equivalent to fctid
5780 (define_insn "lrint<mode>di2"
5781 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
5782 (unspec:DI [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
5784 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
5786 [(set_attr "type" "fp")])
5788 (define_expand "btrunc<mode>2"
5789 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
5790 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "")]
5792 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
5795 (define_insn "*btrunc<mode>2_fpr"
5796 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
5797 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
5799 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>
5800 && !VECTOR_UNIT_VSX_P (<MODE>mode)"
5802 [(set_attr "type" "fp")])
5804 (define_expand "ceil<mode>2"
5805 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
5806 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "")]
5808 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
5811 (define_insn "*ceil<mode>2_fpr"
5812 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
5813 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
5815 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>
5816 && !VECTOR_UNIT_VSX_P (<MODE>mode)"
5818 [(set_attr "type" "fp")])
5820 (define_expand "floor<mode>2"
5821 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
5822 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "")]
5824 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
5827 (define_insn "*floor<mode>2_fpr"
5828 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
5829 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
5831 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>
5832 && !VECTOR_UNIT_VSX_P (<MODE>mode)"
5834 [(set_attr "type" "fp")])
5836 ;; No VSX equivalent to frin
5837 (define_insn "round<mode>2"
5838 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
5839 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
5841 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
5843 [(set_attr "type" "fp")])
5845 ; An UNSPEC is used so we don't have to support SImode in FP registers.
5846 (define_insn "stfiwx"
5847 [(set (match_operand:SI 0 "memory_operand" "=Z")
5848 (unspec:SI [(match_operand:DI 1 "gpc_reg_operand" "d")]
5852 [(set_attr "type" "fpstore")])
5854 ;; If we don't have a direct conversion to single precision, don't enable this
5855 ;; conversion for 32-bit without fast math, because we don't have the insn to
5856 ;; generate the fixup swizzle to avoid double rounding problems.
5857 (define_expand "floatsisf2"
5858 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5859 (float:SF (match_operand:SI 1 "nonimmediate_operand" "")))]
5860 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT
5863 && ((TARGET_FCFIDS && TARGET_LFIWAX)
5864 || (TARGET_DOUBLE_FLOAT && TARGET_FCFID
5865 && (TARGET_POWERPC64 || flag_unsafe_math_optimizations)))))"
5870 if (!REG_P (operands[1]))
5871 operands[1] = force_reg (SImode, operands[1]);
5873 else if (TARGET_FCFIDS && TARGET_LFIWAX)
5875 emit_insn (gen_floatsisf2_lfiwax (operands[0], operands[1]));
5878 else if (TARGET_FCFID && TARGET_LFIWAX)
5880 rtx dfreg = gen_reg_rtx (DFmode);
5881 emit_insn (gen_floatsidf2_lfiwax (dfreg, operands[1]));
5882 emit_insn (gen_truncdfsf2 (operands[0], dfreg));
5887 rtx dreg = operands[1];
5889 dreg = force_reg (SImode, dreg);
5890 dreg = convert_to_mode (DImode, dreg, false);
5891 emit_insn (gen_floatdisf2 (operands[0], dreg));
5896 (define_expand "floatdidf2"
5897 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5898 (float:DF (match_operand:DI 1 "gpc_reg_operand" "")))]
5899 "TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS"
5902 (define_insn "*floatdidf2_fpr"
5903 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
5904 (float:DF (match_operand:DI 1 "gpc_reg_operand" "d")))]
5905 "TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
5906 && !VECTOR_UNIT_VSX_P (DFmode)"
5908 [(set_attr "type" "fp")])
5910 ; Allow the combiner to merge source memory operands to the conversion so that
5911 ; the optimizer/register allocator doesn't try to load the value too early in a
5912 ; GPR and then use store/load to move it to a FPR and suffer from a store-load
5913 ; hit. We will split after reload to avoid the trip through the GPRs
5915 (define_insn_and_split "*floatdidf2_mem"
5916 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
5917 (float:DF (match_operand:DI 1 "memory_operand" "m")))
5918 (clobber (match_scratch:DI 2 "=d"))]
5919 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS && TARGET_FCFID"
5921 "&& reload_completed"
5922 [(set (match_dup 2) (match_dup 1))
5923 (set (match_dup 0) (float:DF (match_dup 2)))]
5925 [(set_attr "length" "8")
5926 (set_attr "type" "fpload")])
5928 (define_expand "floatunsdidf2"
5929 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5931 (match_operand:DI 1 "gpc_reg_operand" "")))]
5932 "TARGET_HARD_FLOAT && (TARGET_FCFIDU || VECTOR_UNIT_VSX_P (DFmode))"
5935 (define_insn "*floatunsdidf2_fcfidu"
5936 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
5937 (unsigned_float:DF (match_operand:DI 1 "gpc_reg_operand" "d")))]
5938 "TARGET_HARD_FLOAT && TARGET_FCFIDU && !VECTOR_UNIT_VSX_P (DFmode)"
5940 [(set_attr "type" "fp")
5941 (set_attr "length" "4")])
5943 (define_insn_and_split "*floatunsdidf2_mem"
5944 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
5945 (unsigned_float:DF (match_operand:DI 1 "memory_operand" "m")))
5946 (clobber (match_scratch:DI 2 "=d"))]
5947 "TARGET_HARD_FLOAT && (TARGET_FCFIDU || VECTOR_UNIT_VSX_P (DFmode))"
5949 "&& reload_completed"
5950 [(set (match_dup 2) (match_dup 1))
5951 (set (match_dup 0) (unsigned_float:DF (match_dup 2)))]
5953 [(set_attr "length" "8")
5954 (set_attr "type" "fpload")])
5956 (define_expand "floatdisf2"
5957 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5958 (float:SF (match_operand:DI 1 "gpc_reg_operand" "")))]
5959 "TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
5960 && (TARGET_FCFIDS || TARGET_POWERPC64 || flag_unsafe_math_optimizations)"
5965 rtx val = operands[1];
5966 if (!flag_unsafe_math_optimizations)
5968 rtx label = gen_label_rtx ();
5969 val = gen_reg_rtx (DImode);
5970 emit_insn (gen_floatdisf2_internal2 (val, operands[1], label));
5973 emit_insn (gen_floatdisf2_internal1 (operands[0], val));
5978 (define_insn "floatdisf2_fcfids"
5979 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5980 (float:SF (match_operand:DI 1 "gpc_reg_operand" "d")))]
5981 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
5982 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDS"
5984 [(set_attr "type" "fp")])
5986 (define_insn_and_split "*floatdisf2_mem"
5987 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5988 (float:SF (match_operand:DI 1 "memory_operand" "m")))
5989 (clobber (match_scratch:DI 2 "=f"))]
5990 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
5991 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDS"
5993 "&& reload_completed"
5997 emit_move_insn (operands[2], operands[1]);
5998 emit_insn (gen_floatdisf2_fcfids (operands[0], operands[2]));
6001 [(set_attr "length" "8")])
6003 ;; This is not IEEE compliant if rounding mode is "round to nearest".
6004 ;; If the DI->DF conversion is inexact, then it's possible to suffer
6005 ;; from double rounding.
6006 ;; Instead of creating a new cpu type for two FP operations, just use fp
6007 (define_insn_and_split "floatdisf2_internal1"
6008 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6009 (float:SF (match_operand:DI 1 "gpc_reg_operand" "d")))
6010 (clobber (match_scratch:DF 2 "=d"))]
6011 "TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
6013 "&& reload_completed"
6015 (float:DF (match_dup 1)))
6017 (float_truncate:SF (match_dup 2)))]
6019 [(set_attr "length" "8")
6020 (set_attr "type" "fp")])
6022 ;; Twiddles bits to avoid double rounding.
6023 ;; Bits that might be truncated when converting to DFmode are replaced
6024 ;; by a bit that won't be lost at that stage, but is below the SFmode
6025 ;; rounding position.
6026 (define_expand "floatdisf2_internal2"
6027 [(set (match_dup 3) (ashiftrt:DI (match_operand:DI 1 "" "")
6029 (parallel [(set (match_operand:DI 0 "" "") (and:DI (match_dup 1)
6031 (clobber (scratch:CC))])
6032 (set (match_dup 3) (plus:DI (match_dup 3)
6034 (set (match_dup 0) (plus:DI (match_dup 0)
6036 (set (match_dup 4) (compare:CCUNS (match_dup 3)
6038 (set (match_dup 0) (ior:DI (match_dup 0)
6040 (parallel [(set (match_dup 0) (and:DI (match_dup 0)
6042 (clobber (scratch:CC))])
6043 (set (pc) (if_then_else (geu (match_dup 4) (const_int 0))
6044 (label_ref (match_operand:DI 2 "" ""))
6046 (set (match_dup 0) (match_dup 1))]
6047 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
6050 operands[3] = gen_reg_rtx (DImode);
6051 operands[4] = gen_reg_rtx (CCUNSmode);
6054 (define_expand "floatunsdisf2"
6055 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6056 (unsigned_float:SF (match_operand:DI 1 "gpc_reg_operand" "")))]
6057 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
6058 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDUS"
6061 (define_insn "floatunsdisf2_fcfidus"
6062 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6063 (unsigned_float:SF (match_operand:DI 1 "gpc_reg_operand" "d")))]
6064 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
6065 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDUS"
6067 [(set_attr "type" "fp")])
6069 (define_insn_and_split "*floatunsdisf2_mem"
6070 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6071 (unsigned_float:SF (match_operand:DI 1 "memory_operand" "m")))
6072 (clobber (match_scratch:DI 2 "=f"))]
6073 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
6074 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDUS"
6076 "&& reload_completed"
6080 emit_move_insn (operands[2], operands[1]);
6081 emit_insn (gen_floatunsdisf2_fcfidus (operands[0], operands[2]));
6084 [(set_attr "length" "8")
6085 (set_attr "type" "fpload")])
6087 ;; Define the DImode operations that can be done in a small number
6088 ;; of instructions. The & constraints are to prevent the register
6089 ;; allocator from allocating registers that overlap with the inputs
6090 ;; (for example, having an input in 7,8 and an output in 6,7). We
6091 ;; also allow for the output being the same as one of the inputs.
6093 (define_insn "*adddi3_noppc64"
6094 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r")
6095 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,0,0")
6096 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I")))]
6097 "! TARGET_POWERPC64"
6100 if (WORDS_BIG_ENDIAN)
6101 return (GET_CODE (operands[2])) != CONST_INT
6102 ? \"addc %L0,%L1,%L2\;adde %0,%1,%2\"
6103 : \"addic %L0,%L1,%2\;add%G2e %0,%1\";
6105 return (GET_CODE (operands[2])) != CONST_INT
6106 ? \"addc %0,%1,%2\;adde %L0,%L1,%L2\"
6107 : \"addic %0,%1,%2\;add%G2e %L0,%L1\";
6109 [(set_attr "type" "two")
6110 (set_attr "length" "8")])
6112 (define_insn "*subdi3_noppc64"
6113 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r,r")
6114 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I,0,r,I")
6115 (match_operand:DI 2 "gpc_reg_operand" "r,r,r,0,0")))]
6116 "! TARGET_POWERPC64"
6119 if (WORDS_BIG_ENDIAN)
6120 return (GET_CODE (operands[1]) != CONST_INT)
6121 ? \"subfc %L0,%L2,%L1\;subfe %0,%2,%1\"
6122 : \"subfic %L0,%L2,%1\;subf%G1e %0,%2\";
6124 return (GET_CODE (operands[1]) != CONST_INT)
6125 ? \"subfc %0,%2,%1\;subfe %L0,%L2,%L1\"
6126 : \"subfic %0,%2,%1\;subf%G1e %L0,%L2\";
6128 [(set_attr "type" "two")
6129 (set_attr "length" "8")])
6131 (define_insn "*negdi2_noppc64"
6132 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6133 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))]
6134 "! TARGET_POWERPC64"
6137 return (WORDS_BIG_ENDIAN)
6138 ? \"subfic %L0,%L1,0\;subfze %0,%1\"
6139 : \"subfic %0,%1,0\;subfze %L0,%L1\";
6141 [(set_attr "type" "two")
6142 (set_attr "length" "8")])
6144 (define_insn "mulsidi3"
6145 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6146 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6147 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
6148 "! TARGET_POWERPC64"
6150 return (WORDS_BIG_ENDIAN)
6151 ? \"mulhw %0,%1,%2\;mullw %L0,%1,%2\"
6152 : \"mulhw %L0,%1,%2\;mullw %0,%1,%2\";
6154 [(set_attr "type" "imul")
6155 (set_attr "length" "8")])
6158 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6159 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6160 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6161 "! TARGET_POWERPC64 && reload_completed"
6164 (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
6165 (sign_extend:DI (match_dup 2)))
6168 (mult:SI (match_dup 1)
6172 int endian = (WORDS_BIG_ENDIAN == 0);
6173 operands[3] = operand_subword (operands[0], endian, 0, DImode);
6174 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
6177 (define_insn "umulsidi3"
6178 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6179 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6180 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
6181 "! TARGET_POWERPC64"
6184 return (WORDS_BIG_ENDIAN)
6185 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
6186 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
6188 [(set_attr "type" "imul")
6189 (set_attr "length" "8")])
6192 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6193 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6194 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6195 "! TARGET_POWERPC64 && reload_completed"
6198 (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
6199 (zero_extend:DI (match_dup 2)))
6202 (mult:SI (match_dup 1)
6206 int endian = (WORDS_BIG_ENDIAN == 0);
6207 operands[3] = operand_subword (operands[0], endian, 0, DImode);
6208 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
6211 (define_insn "smulsi3_highpart"
6212 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6214 (lshiftrt:DI (mult:DI (sign_extend:DI
6215 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6217 (match_operand:SI 2 "gpc_reg_operand" "r")))
6221 [(set_attr "type" "imul")])
6223 (define_insn "umulsi3_highpart"
6224 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6226 (lshiftrt:DI (mult:DI (zero_extend:DI
6227 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6229 (match_operand:SI 2 "gpc_reg_operand" "r")))
6233 [(set_attr "type" "imul")])
6235 ;; Shift by a variable amount is too complex to be worth open-coding. We
6236 ;; just handle shifts by constants.
6237 (define_insn "ashrdi3_no_power"
6238 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
6239 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6240 (match_operand:SI 2 "const_int_operand" "M,i")))]
6244 switch (which_alternative)
6249 if (WORDS_BIG_ENDIAN)
6250 return \"srawi %0,%1,31\;srawi %L0,%1,%h2\";
6252 return \"srawi %L0,%L1,31\;srawi %0,%L1,%h2\";
6254 if (WORDS_BIG_ENDIAN)
6255 return \"srwi %L0,%L1,%h2\;insrwi %L0,%1,%h2,0\;srawi %0,%1,%h2\";
6257 return \"srwi %0,%1,%h2\;insrwi %0,%L1,%h2,0\;srawi %L0,%L1,%h2\";
6260 [(set_attr "type" "two,three")
6261 (set_attr "length" "8,12")])
6263 (define_insn "*ashrdisi3_noppc64"
6264 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6265 (subreg:SI (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6266 (const_int 32)) 4))]
6267 "TARGET_32BIT && !TARGET_POWERPC64"
6270 if (REGNO (operands[0]) == REGNO (operands[1]))
6273 return \"mr %0,%1\";
6275 [(set_attr "length" "4")])
6278 ;; PowerPC64 DImode operations.
6280 (define_insn "muldi3"
6281 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6282 (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6283 (match_operand:DI 2 "reg_or_short_operand" "r,I")))]
6289 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
6290 (const_string "imul3")
6291 (match_operand:SI 2 "short_cint_operand" "")
6292 (const_string "imul2")]
6293 (const_string "lmul")))])
6295 (define_insn "*muldi3_internal1"
6296 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6297 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6298 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6300 (clobber (match_scratch:DI 3 "=r,r"))]
6305 [(set_attr "type" "lmul_compare")
6306 (set_attr "length" "4,8")])
6309 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6310 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
6311 (match_operand:DI 2 "gpc_reg_operand" ""))
6313 (clobber (match_scratch:DI 3 ""))]
6314 "TARGET_POWERPC64 && reload_completed"
6316 (mult:DI (match_dup 1) (match_dup 2)))
6318 (compare:CC (match_dup 3)
6322 (define_insn "*muldi3_internal2"
6323 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6324 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6325 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6327 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6328 (mult:DI (match_dup 1) (match_dup 2)))]
6333 [(set_attr "type" "lmul_compare")
6334 (set_attr "length" "4,8")])
6337 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
6338 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
6339 (match_operand:DI 2 "gpc_reg_operand" ""))
6341 (set (match_operand:DI 0 "gpc_reg_operand" "")
6342 (mult:DI (match_dup 1) (match_dup 2)))]
6343 "TARGET_POWERPC64 && reload_completed"
6345 (mult:DI (match_dup 1) (match_dup 2)))
6347 (compare:CC (match_dup 0)
6351 (define_insn "smuldi3_highpart"
6352 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6354 (lshiftrt:TI (mult:TI (sign_extend:TI
6355 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6357 (match_operand:DI 2 "gpc_reg_operand" "r")))
6361 [(set_attr "type" "lmul")])
6363 (define_insn "umuldi3_highpart"
6364 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6366 (lshiftrt:TI (mult:TI (zero_extend:TI
6367 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6369 (match_operand:DI 2 "gpc_reg_operand" "r")))
6373 [(set_attr "type" "lmul")])
6375 (define_expand "mulditi3"
6376 [(set (match_operand:TI 0 "gpc_reg_operand")
6377 (mult:TI (sign_extend:TI (match_operand:DI 1 "gpc_reg_operand"))
6378 (sign_extend:TI (match_operand:DI 2 "gpc_reg_operand"))))]
6381 rtx l = gen_reg_rtx (DImode), h = gen_reg_rtx (DImode);
6382 emit_insn (gen_muldi3 (l, operands[1], operands[2]));
6383 emit_insn (gen_smuldi3_highpart (h, operands[1], operands[2]));
6384 emit_move_insn (gen_lowpart (DImode, operands[0]), l);
6385 emit_move_insn (gen_highpart (DImode, operands[0]), h);
6389 (define_expand "umulditi3"
6390 [(set (match_operand:TI 0 "gpc_reg_operand")
6391 (mult:TI (zero_extend:TI (match_operand:DI 1 "gpc_reg_operand"))
6392 (zero_extend:TI (match_operand:DI 2 "gpc_reg_operand"))))]
6395 rtx l = gen_reg_rtx (DImode), h = gen_reg_rtx (DImode);
6396 emit_insn (gen_muldi3 (l, operands[1], operands[2]));
6397 emit_insn (gen_umuldi3_highpart (h, operands[1], operands[2]));
6398 emit_move_insn (gen_lowpart (DImode, operands[0]), l);
6399 emit_move_insn (gen_highpart (DImode, operands[0]), h);
6403 (define_insn "rotldi3"
6404 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6405 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6406 (match_operand:DI 2 "reg_or_cint_operand" "r,i")))]
6411 [(set_attr "type" "var_shift_rotate,integer")])
6413 (define_insn "*rotldi3_internal2"
6414 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
6415 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6416 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
6418 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
6425 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6426 (set_attr "length" "4,4,8,8")])
6429 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
6430 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6431 (match_operand:DI 2 "reg_or_cint_operand" ""))
6433 (clobber (match_scratch:DI 3 ""))]
6434 "TARGET_POWERPC64 && reload_completed"
6436 (rotate:DI (match_dup 1) (match_dup 2)))
6438 (compare:CC (match_dup 3)
6442 (define_insn "*rotldi3_internal3"
6443 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
6444 (compare:CC (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"))
6447 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
6448 (rotate:DI (match_dup 1) (match_dup 2)))]
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 3 "cc_reg_not_micro_cr0_operand" "")
6460 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6461 (match_operand:DI 2 "reg_or_cint_operand" ""))
6463 (set (match_operand:DI 0 "gpc_reg_operand" "")
6464 (rotate:DI (match_dup 1) (match_dup 2)))]
6465 "TARGET_POWERPC64 && reload_completed"
6467 (rotate:DI (match_dup 1) (match_dup 2)))
6469 (compare:CC (match_dup 0)
6473 (define_insn "*rotldi3_internal4"
6474 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6475 (and:DI (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6476 (match_operand:DI 2 "reg_or_cint_operand" "r,i"))
6477 (match_operand:DI 3 "mask64_operand" "n,n")))]
6480 rldc%B3 %0,%1,%2,%S3
6481 rldic%B3 %0,%1,%H2,%S3"
6482 [(set_attr "type" "var_shift_rotate,integer")])
6484 (define_insn "*rotldi3_internal5"
6485 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
6487 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6488 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
6489 (match_operand:DI 3 "mask64_operand" "n,n,n,n"))
6491 (clobber (match_scratch:DI 4 "=r,r,r,r"))]
6494 rldc%B3. %4,%1,%2,%S3
6495 rldic%B3. %4,%1,%H2,%S3
6498 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6499 (set_attr "length" "4,4,8,8")])
6502 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
6504 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6505 (match_operand:DI 2 "reg_or_cint_operand" ""))
6506 (match_operand:DI 3 "mask64_operand" ""))
6508 (clobber (match_scratch:DI 4 ""))]
6509 "TARGET_POWERPC64 && reload_completed"
6511 (and:DI (rotate:DI (match_dup 1)
6515 (compare:CC (match_dup 4)
6519 (define_insn "*rotldi3_internal6"
6520 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
6522 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6523 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
6524 (match_operand:DI 3 "mask64_operand" "n,n,n,n"))
6526 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
6527 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6530 rldc%B3. %0,%1,%2,%S3
6531 rldic%B3. %0,%1,%H2,%S3
6534 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6535 (set_attr "length" "4,4,8,8")])
6538 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
6540 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6541 (match_operand:DI 2 "reg_or_cint_operand" ""))
6542 (match_operand:DI 3 "mask64_operand" ""))
6544 (set (match_operand:DI 0 "gpc_reg_operand" "")
6545 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6546 "TARGET_POWERPC64 && reload_completed"
6548 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
6550 (compare:CC (match_dup 0)
6554 (define_insn "*rotldi3_internal7"
6555 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6558 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6559 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
6563 rldicl %0,%1,%H2,56"
6564 [(set_attr "type" "var_shift_rotate,integer")])
6566 (define_insn "*rotldi3_internal8"
6567 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
6568 (compare:CC (zero_extend:DI
6570 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6571 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
6573 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
6577 rldicl. %3,%1,%H2,56
6580 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6581 (set_attr "length" "4,4,8,8")])
6584 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
6585 (compare:CC (zero_extend:DI
6587 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6588 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6590 (clobber (match_scratch:DI 3 ""))]
6591 "TARGET_POWERPC64 && reload_completed"
6593 (zero_extend:DI (subreg:QI
6594 (rotate:DI (match_dup 1)
6597 (compare:CC (match_dup 3)
6601 (define_insn "*rotldi3_internal9"
6602 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
6603 (compare:CC (zero_extend:DI
6605 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6606 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
6608 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
6609 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6613 rldicl. %0,%1,%H2,56
6616 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6617 (set_attr "length" "4,4,8,8")])
6620 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
6621 (compare:CC (zero_extend:DI
6623 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6624 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6626 (set (match_operand:DI 0 "gpc_reg_operand" "")
6627 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6628 "TARGET_POWERPC64 && reload_completed"
6630 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
6632 (compare:CC (match_dup 0)
6636 (define_insn "*rotldi3_internal10"
6637 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6640 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6641 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
6645 rldicl %0,%1,%H2,48"
6646 [(set_attr "type" "var_shift_rotate,integer")])
6648 (define_insn "*rotldi3_internal11"
6649 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
6650 (compare:CC (zero_extend:DI
6652 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6653 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
6655 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
6659 rldicl. %3,%1,%H2,48
6662 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6663 (set_attr "length" "4,4,8,8")])
6666 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
6667 (compare:CC (zero_extend:DI
6669 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6670 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6672 (clobber (match_scratch:DI 3 ""))]
6673 "TARGET_POWERPC64 && reload_completed"
6675 (zero_extend:DI (subreg:HI
6676 (rotate:DI (match_dup 1)
6679 (compare:CC (match_dup 3)
6683 (define_insn "*rotldi3_internal12"
6684 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
6685 (compare:CC (zero_extend:DI
6687 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6688 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
6690 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
6691 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6695 rldicl. %0,%1,%H2,48
6698 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6699 (set_attr "length" "4,4,8,8")])
6702 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
6703 (compare:CC (zero_extend:DI
6705 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6706 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6708 (set (match_operand:DI 0 "gpc_reg_operand" "")
6709 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6710 "TARGET_POWERPC64 && reload_completed"
6712 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
6714 (compare:CC (match_dup 0)
6718 (define_insn "*rotldi3_internal13"
6719 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6722 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6723 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
6727 rldicl %0,%1,%H2,32"
6728 [(set_attr "type" "var_shift_rotate,integer")])
6730 (define_insn "*rotldi3_internal14"
6731 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
6732 (compare:CC (zero_extend:DI
6734 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6735 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
6737 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
6741 rldicl. %3,%1,%H2,32
6744 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6745 (set_attr "length" "4,4,8,8")])
6748 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
6749 (compare:CC (zero_extend:DI
6751 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6752 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6754 (clobber (match_scratch:DI 3 ""))]
6755 "TARGET_POWERPC64 && reload_completed"
6757 (zero_extend:DI (subreg:SI
6758 (rotate:DI (match_dup 1)
6761 (compare:CC (match_dup 3)
6765 (define_insn "*rotldi3_internal15"
6766 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
6767 (compare:CC (zero_extend:DI
6769 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6770 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
6772 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
6773 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6777 rldicl. %0,%1,%H2,32
6780 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6781 (set_attr "length" "4,4,8,8")])
6784 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
6785 (compare:CC (zero_extend:DI
6787 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6788 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6790 (set (match_operand:DI 0 "gpc_reg_operand" "")
6791 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6792 "TARGET_POWERPC64 && reload_completed"
6794 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
6796 (compare:CC (match_dup 0)
6800 (define_expand "ashldi3"
6801 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6802 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6803 (match_operand:SI 2 "reg_or_cint_operand" "")))]
6807 (define_insn "*ashldi3_internal1"
6808 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6809 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6810 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
6815 [(set_attr "type" "var_shift_rotate,shift")])
6817 (define_insn "*ashldi3_internal2"
6818 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
6819 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6820 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
6822 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
6829 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6830 (set_attr "length" "4,4,8,8")])
6833 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6834 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6835 (match_operand:SI 2 "reg_or_cint_operand" ""))
6837 (clobber (match_scratch:DI 3 ""))]
6838 "TARGET_POWERPC64 && reload_completed"
6840 (ashift:DI (match_dup 1) (match_dup 2)))
6842 (compare:CC (match_dup 3)
6846 (define_insn "*ashldi3_internal3"
6847 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
6848 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6849 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
6851 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
6852 (ashift:DI (match_dup 1) (match_dup 2)))]
6859 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6860 (set_attr "length" "4,4,8,8")])
6863 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6864 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6865 (match_operand:SI 2 "reg_or_cint_operand" ""))
6867 (set (match_operand:DI 0 "gpc_reg_operand" "")
6868 (ashift:DI (match_dup 1) (match_dup 2)))]
6869 "TARGET_POWERPC64 && reload_completed"
6871 (ashift:DI (match_dup 1) (match_dup 2)))
6873 (compare:CC (match_dup 0)
6877 (define_insn "*ashldi3_internal4"
6878 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6879 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6880 (match_operand:SI 2 "const_int_operand" "i"))
6881 (match_operand:DI 3 "const_int_operand" "n")))]
6882 "TARGET_POWERPC64 && includes_rldic_lshift_p (operands[2], operands[3])"
6883 "rldic %0,%1,%H2,%W3")
6885 (define_insn "ashldi3_internal5"
6886 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6888 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6889 (match_operand:SI 2 "const_int_operand" "i,i"))
6890 (match_operand:DI 3 "const_int_operand" "n,n"))
6892 (clobber (match_scratch:DI 4 "=r,r"))]
6893 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
6895 rldic. %4,%1,%H2,%W3
6897 [(set_attr "type" "compare")
6898 (set_attr "length" "4,8")])
6901 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
6903 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6904 (match_operand:SI 2 "const_int_operand" ""))
6905 (match_operand:DI 3 "const_int_operand" ""))
6907 (clobber (match_scratch:DI 4 ""))]
6908 "TARGET_POWERPC64 && reload_completed
6909 && includes_rldic_lshift_p (operands[2], operands[3])"
6911 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
6914 (compare:CC (match_dup 4)
6918 (define_insn "*ashldi3_internal6"
6919 [(set (match_operand:CC 4 "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 "const_int_operand" "n,n"))
6925 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6926 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6927 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
6929 rldic. %0,%1,%H2,%W3
6931 [(set_attr "type" "compare")
6932 (set_attr "length" "4,8")])
6935 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
6937 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6938 (match_operand:SI 2 "const_int_operand" ""))
6939 (match_operand:DI 3 "const_int_operand" ""))
6941 (set (match_operand:DI 0 "gpc_reg_operand" "")
6942 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6943 "TARGET_POWERPC64 && reload_completed
6944 && includes_rldic_lshift_p (operands[2], operands[3])"
6946 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
6949 (compare:CC (match_dup 0)
6953 (define_insn "*ashldi3_internal7"
6954 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6955 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6956 (match_operand:SI 2 "const_int_operand" "i"))
6957 (match_operand:DI 3 "mask64_operand" "n")))]
6958 "TARGET_POWERPC64 && includes_rldicr_lshift_p (operands[2], operands[3])"
6959 "rldicr %0,%1,%H2,%S3")
6961 (define_insn "ashldi3_internal8"
6962 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6964 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6965 (match_operand:SI 2 "const_int_operand" "i,i"))
6966 (match_operand:DI 3 "mask64_operand" "n,n"))
6968 (clobber (match_scratch:DI 4 "=r,r"))]
6969 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
6971 rldicr. %4,%1,%H2,%S3
6973 [(set_attr "type" "compare")
6974 (set_attr "length" "4,8")])
6977 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
6979 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6980 (match_operand:SI 2 "const_int_operand" ""))
6981 (match_operand:DI 3 "mask64_operand" ""))
6983 (clobber (match_scratch:DI 4 ""))]
6984 "TARGET_POWERPC64 && reload_completed
6985 && includes_rldicr_lshift_p (operands[2], operands[3])"
6987 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
6990 (compare:CC (match_dup 4)
6994 (define_insn "*ashldi3_internal9"
6995 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
6997 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6998 (match_operand:SI 2 "const_int_operand" "i,i"))
6999 (match_operand:DI 3 "mask64_operand" "n,n"))
7001 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7002 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7003 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
7005 rldicr. %0,%1,%H2,%S3
7007 [(set_attr "type" "compare")
7008 (set_attr "length" "4,8")])
7011 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
7013 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7014 (match_operand:SI 2 "const_int_operand" ""))
7015 (match_operand:DI 3 "mask64_operand" ""))
7017 (set (match_operand:DI 0 "gpc_reg_operand" "")
7018 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7019 "TARGET_POWERPC64 && reload_completed
7020 && includes_rldicr_lshift_p (operands[2], operands[3])"
7022 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7025 (compare:CC (match_dup 0)
7029 (define_expand "lshrdi3"
7030 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7031 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7032 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7036 (define_insn "*lshrdi3_internal1"
7037 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7038 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7039 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
7044 [(set_attr "type" "var_shift_rotate,shift")])
7046 (define_insn "*lshrdi3_internal2"
7047 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7048 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7049 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7051 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7058 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7059 (set_attr "length" "4,4,8,8")])
7062 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7063 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7064 (match_operand:SI 2 "reg_or_cint_operand" ""))
7066 (clobber (match_scratch:DI 3 ""))]
7067 "TARGET_POWERPC64 && reload_completed"
7069 (lshiftrt:DI (match_dup 1) (match_dup 2)))
7071 (compare:CC (match_dup 3)
7075 (define_insn "*lshrdi3_internal3"
7076 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7077 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7078 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7080 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7081 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
7088 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7089 (set_attr "length" "4,4,8,8")])
7092 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7093 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7094 (match_operand:SI 2 "reg_or_cint_operand" ""))
7096 (set (match_operand:DI 0 "gpc_reg_operand" "")
7097 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
7098 "TARGET_POWERPC64 && reload_completed"
7100 (lshiftrt:DI (match_dup 1) (match_dup 2)))
7102 (compare:CC (match_dup 0)
7106 (define_expand "ashrdi3"
7107 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7108 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7109 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7113 if (TARGET_POWERPC64)
7115 else if (GET_CODE (operands[2]) == CONST_INT)
7117 emit_insn (gen_ashrdi3_no_power (operands[0], operands[1], operands[2]));
7124 (define_insn "*ashrdi3_internal1"
7125 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7126 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7127 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
7132 [(set_attr "type" "var_shift_rotate,shift")])
7134 (define_insn "*ashrdi3_internal2"
7135 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7136 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7137 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7139 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7146 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7147 (set_attr "length" "4,4,8,8")])
7150 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7151 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7152 (match_operand:SI 2 "reg_or_cint_operand" ""))
7154 (clobber (match_scratch:DI 3 ""))]
7155 "TARGET_POWERPC64 && reload_completed"
7157 (ashiftrt:DI (match_dup 1) (match_dup 2)))
7159 (compare:CC (match_dup 3)
7163 (define_insn "*ashrdi3_internal3"
7164 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7165 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7166 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7168 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7169 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
7176 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7177 (set_attr "length" "4,4,8,8")])
7180 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7181 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7182 (match_operand:SI 2 "reg_or_cint_operand" ""))
7184 (set (match_operand:DI 0 "gpc_reg_operand" "")
7185 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
7186 "TARGET_POWERPC64 && reload_completed"
7188 (ashiftrt:DI (match_dup 1) (match_dup 2)))
7190 (compare:CC (match_dup 0)
7194 (define_expand "anddi3"
7196 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7197 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7198 (match_operand:DI 2 "and64_2_operand" "")))
7199 (clobber (match_scratch:CC 3 ""))])]
7203 (define_insn "anddi3_mc"
7204 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
7205 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r")
7206 (match_operand:DI 2 "and64_2_operand" "?r,S,T,K,J,t")))
7207 (clobber (match_scratch:CC 3 "=X,X,X,x,x,X"))]
7208 "TARGET_POWERPC64 && rs6000_gen_cell_microcode"
7211 rldic%B2 %0,%1,0,%S2
7212 rlwinm %0,%1,0,%m2,%M2
7216 [(set_attr "type" "*,*,*,fast_compare,fast_compare,*")
7217 (set_attr "length" "4,4,4,4,4,8")])
7219 (define_insn "anddi3_nomc"
7220 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7221 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r")
7222 (match_operand:DI 2 "and64_2_operand" "?r,S,T,t")))
7223 (clobber (match_scratch:CC 3 "=X,X,X,X"))]
7224 "TARGET_POWERPC64 && !rs6000_gen_cell_microcode"
7227 rldic%B2 %0,%1,0,%S2
7228 rlwinm %0,%1,0,%m2,%M2
7230 [(set_attr "length" "4,4,4,8")])
7233 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7234 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7235 (match_operand:DI 2 "mask64_2_operand" "")))
7236 (clobber (match_scratch:CC 3 ""))]
7238 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7239 && !mask_operand (operands[2], DImode)
7240 && !mask64_operand (operands[2], DImode)"
7242 (and:DI (rotate:DI (match_dup 1)
7246 (and:DI (rotate:DI (match_dup 0)
7250 build_mask64_2_operands (operands[2], &operands[4]);
7253 (define_insn "*anddi3_internal2_mc"
7254 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,x,?y,?y,?y,??y,??y,?y")
7255 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r,r,r")
7256 (match_operand:DI 2 "and64_2_operand" "r,S,T,K,J,t,r,S,T,K,J,t"))
7258 (clobber (match_scratch:DI 3 "=r,r,r,r,r,r,r,r,r,r,r,r"))
7259 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,X,X,x,x,X"))]
7260 "TARGET_64BIT && rs6000_gen_cell_microcode"
7263 rldic%B2. %3,%1,0,%S2
7264 rlwinm. %3,%1,0,%m2,%M2
7274 [(set_attr "type" "fast_compare,compare,delayed_compare,fast_compare,\
7275 fast_compare,compare,compare,compare,compare,compare,\
7277 (set_attr "length" "4,4,4,4,4,8,8,8,8,8,8,12")])
7280 [(set (match_operand:CC 0 "cc_reg_operand" "")
7281 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7282 (match_operand:DI 2 "mask64_2_operand" ""))
7284 (clobber (match_scratch:DI 3 ""))
7285 (clobber (match_scratch:CC 4 ""))]
7286 "TARGET_64BIT && reload_completed
7287 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7288 && !mask_operand (operands[2], DImode)
7289 && !mask64_operand (operands[2], DImode)"
7291 (and:DI (rotate:DI (match_dup 1)
7294 (parallel [(set (match_dup 0)
7295 (compare:CC (and:DI (rotate:DI (match_dup 3)
7299 (clobber (match_dup 3))])]
7302 build_mask64_2_operands (operands[2], &operands[5]);
7305 (define_insn "*anddi3_internal3_mc"
7306 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,x,x,?y,?y,?y,??y,??y,?y")
7307 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r,r,r")
7308 (match_operand:DI 2 "and64_2_operand" "r,S,T,K,J,t,r,S,T,K,J,t"))
7310 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r,r,r")
7311 (and:DI (match_dup 1) (match_dup 2)))
7312 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,X,X,x,x,X"))]
7313 "TARGET_64BIT && rs6000_gen_cell_microcode"
7316 rldic%B2. %0,%1,0,%S2
7317 rlwinm. %0,%1,0,%m2,%M2
7327 [(set_attr "type" "fast_compare,compare,delayed_compare,fast_compare,\
7328 fast_compare,compare,compare,compare,compare,compare,\
7330 (set_attr "length" "4,4,4,4,4,8,8,8,8,8,8,12")])
7333 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7334 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7335 (match_operand:DI 2 "and64_2_operand" ""))
7337 (set (match_operand:DI 0 "gpc_reg_operand" "")
7338 (and:DI (match_dup 1) (match_dup 2)))
7339 (clobber (match_scratch:CC 4 ""))]
7340 "TARGET_64BIT && reload_completed"
7341 [(parallel [(set (match_dup 0)
7342 (and:DI (match_dup 1) (match_dup 2)))
7343 (clobber (match_dup 4))])
7345 (compare:CC (match_dup 0)
7350 [(set (match_operand:CC 3 "cc_reg_operand" "")
7351 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7352 (match_operand:DI 2 "mask64_2_operand" ""))
7354 (set (match_operand:DI 0 "gpc_reg_operand" "")
7355 (and:DI (match_dup 1) (match_dup 2)))
7356 (clobber (match_scratch:CC 4 ""))]
7357 "TARGET_64BIT && reload_completed
7358 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7359 && !mask_operand (operands[2], DImode)
7360 && !mask64_operand (operands[2], DImode)"
7362 (and:DI (rotate:DI (match_dup 1)
7365 (parallel [(set (match_dup 3)
7366 (compare:CC (and:DI (rotate:DI (match_dup 0)
7371 (and:DI (rotate:DI (match_dup 0)
7376 build_mask64_2_operands (operands[2], &operands[5]);
7379 (define_expand "iordi3"
7380 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7381 (ior:DI (match_operand:DI 1 "gpc_reg_operand" "")
7382 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
7386 if (non_logical_cint_operand (operands[2], DImode))
7388 HOST_WIDE_INT value;
7389 rtx tmp = ((!can_create_pseudo_p ()
7390 || rtx_equal_p (operands[0], operands[1]))
7391 ? operands[0] : gen_reg_rtx (DImode));
7393 if (GET_CODE (operands[2]) == CONST_INT)
7395 value = INTVAL (operands[2]);
7396 emit_insn (gen_iordi3 (tmp, operands[1],
7397 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
7401 value = CONST_DOUBLE_LOW (operands[2]);
7402 emit_insn (gen_iordi3 (tmp, operands[1],
7403 immed_double_const (value
7404 & (~ (HOST_WIDE_INT) 0xffff),
7408 emit_insn (gen_iordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
7413 (define_expand "xordi3"
7414 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7415 (xor:DI (match_operand:DI 1 "gpc_reg_operand" "")
7416 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
7420 if (non_logical_cint_operand (operands[2], DImode))
7422 HOST_WIDE_INT value;
7423 rtx tmp = ((!can_create_pseudo_p ()
7424 || rtx_equal_p (operands[0], operands[1]))
7425 ? operands[0] : gen_reg_rtx (DImode));
7427 if (GET_CODE (operands[2]) == CONST_INT)
7429 value = INTVAL (operands[2]);
7430 emit_insn (gen_xordi3 (tmp, operands[1],
7431 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
7435 value = CONST_DOUBLE_LOW (operands[2]);
7436 emit_insn (gen_xordi3 (tmp, operands[1],
7437 immed_double_const (value
7438 & (~ (HOST_WIDE_INT) 0xffff),
7442 emit_insn (gen_xordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
7447 (define_insn "*booldi3_internal1"
7448 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
7449 (match_operator:DI 3 "boolean_or_operator"
7450 [(match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
7451 (match_operand:DI 2 "logical_operand" "r,K,JF")]))]
7458 (define_insn "*booldi3_internal2"
7459 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7460 (compare:CC (match_operator:DI 4 "boolean_or_operator"
7461 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
7462 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7464 (clobber (match_scratch:DI 3 "=r,r"))]
7469 [(set_attr "type" "fast_compare,compare")
7470 (set_attr "length" "4,8")])
7473 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7474 (compare:CC (match_operator:DI 4 "boolean_operator"
7475 [(match_operand:DI 1 "gpc_reg_operand" "")
7476 (match_operand:DI 2 "gpc_reg_operand" "")])
7478 (clobber (match_scratch:DI 3 ""))]
7479 "TARGET_POWERPC64 && reload_completed"
7480 [(set (match_dup 3) (match_dup 4))
7482 (compare:CC (match_dup 3)
7486 (define_insn "*booldi3_internal3"
7487 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7488 (compare:CC (match_operator:DI 4 "boolean_or_operator"
7489 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
7490 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7492 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7498 [(set_attr "type" "fast_compare,compare")
7499 (set_attr "length" "4,8")])
7502 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7503 (compare:CC (match_operator:DI 4 "boolean_operator"
7504 [(match_operand:DI 1 "gpc_reg_operand" "")
7505 (match_operand:DI 2 "gpc_reg_operand" "")])
7507 (set (match_operand:DI 0 "gpc_reg_operand" "")
7509 "TARGET_POWERPC64 && reload_completed"
7510 [(set (match_dup 0) (match_dup 4))
7512 (compare:CC (match_dup 0)
7516 ;; Split a logical operation that we can't do in one insn into two insns,
7517 ;; each of which does one 16-bit part. This is used by combine.
7520 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7521 (match_operator:DI 3 "boolean_or_operator"
7522 [(match_operand:DI 1 "gpc_reg_operand" "")
7523 (match_operand:DI 2 "non_logical_cint_operand" "")]))]
7525 [(set (match_dup 0) (match_dup 4))
7526 (set (match_dup 0) (match_dup 5))]
7531 if (GET_CODE (operands[2]) == CONST_DOUBLE)
7533 HOST_WIDE_INT value = CONST_DOUBLE_LOW (operands[2]);
7534 i3 = immed_double_const (value & (~ (HOST_WIDE_INT) 0xffff),
7536 i4 = GEN_INT (value & 0xffff);
7540 i3 = GEN_INT (INTVAL (operands[2])
7541 & (~ (HOST_WIDE_INT) 0xffff));
7542 i4 = GEN_INT (INTVAL (operands[2]) & 0xffff);
7544 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
7546 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
7550 (define_insn "*boolcdi3_internal1"
7551 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7552 (match_operator:DI 3 "boolean_operator"
7553 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
7554 (match_operand:DI 2 "gpc_reg_operand" "r")]))]
7558 (define_insn "*boolcdi3_internal2"
7559 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7560 (compare:CC (match_operator:DI 4 "boolean_operator"
7561 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
7562 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7564 (clobber (match_scratch:DI 3 "=r,r"))]
7569 [(set_attr "type" "fast_compare,compare")
7570 (set_attr "length" "4,8")])
7573 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7574 (compare:CC (match_operator:DI 4 "boolean_operator"
7575 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7576 (match_operand:DI 2 "gpc_reg_operand" "")])
7578 (clobber (match_scratch:DI 3 ""))]
7579 "TARGET_POWERPC64 && reload_completed"
7580 [(set (match_dup 3) (match_dup 4))
7582 (compare:CC (match_dup 3)
7586 (define_insn "*boolcdi3_internal3"
7587 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7588 (compare:CC (match_operator:DI 4 "boolean_operator"
7589 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
7590 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7592 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7598 [(set_attr "type" "fast_compare,compare")
7599 (set_attr "length" "4,8")])
7602 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7603 (compare:CC (match_operator:DI 4 "boolean_operator"
7604 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7605 (match_operand:DI 2 "gpc_reg_operand" "")])
7607 (set (match_operand:DI 0 "gpc_reg_operand" "")
7609 "TARGET_POWERPC64 && reload_completed"
7610 [(set (match_dup 0) (match_dup 4))
7612 (compare:CC (match_dup 0)
7616 (define_insn "*boolccdi3_internal1"
7617 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7618 (match_operator:DI 3 "boolean_operator"
7619 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
7620 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r"))]))]
7624 (define_insn "*boolccdi3_internal2"
7625 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7626 (compare:CC (match_operator:DI 4 "boolean_operator"
7627 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
7628 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
7630 (clobber (match_scratch:DI 3 "=r,r"))]
7635 [(set_attr "type" "fast_compare,compare")
7636 (set_attr "length" "4,8")])
7639 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7640 (compare:CC (match_operator:DI 4 "boolean_operator"
7641 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7642 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
7644 (clobber (match_scratch:DI 3 ""))]
7645 "TARGET_POWERPC64 && reload_completed"
7646 [(set (match_dup 3) (match_dup 4))
7648 (compare:CC (match_dup 3)
7652 (define_insn "*boolccdi3_internal3"
7653 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7654 (compare:CC (match_operator:DI 4 "boolean_operator"
7655 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
7656 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
7658 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7664 [(set_attr "type" "fast_compare,compare")
7665 (set_attr "length" "4,8")])
7668 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7669 (compare:CC (match_operator:DI 4 "boolean_operator"
7670 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7671 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
7673 (set (match_operand:DI 0 "gpc_reg_operand" "")
7675 "TARGET_POWERPC64 && reload_completed"
7676 [(set (match_dup 0) (match_dup 4))
7678 (compare:CC (match_dup 0)
7682 ;; Now define ways of moving data around.
7684 ;; Set up a register with a value from the GOT table
7686 (define_expand "movsi_got"
7687 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7688 (unspec:SI [(match_operand:SI 1 "got_operand" "")
7689 (match_dup 2)] UNSPEC_MOVSI_GOT))]
7690 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
7693 if (GET_CODE (operands[1]) == CONST)
7695 rtx offset = const0_rtx;
7696 HOST_WIDE_INT value;
7698 operands[1] = eliminate_constant_term (XEXP (operands[1], 0), &offset);
7699 value = INTVAL (offset);
7702 rtx tmp = (!can_create_pseudo_p ()
7704 : gen_reg_rtx (Pmode));
7705 emit_insn (gen_movsi_got (tmp, operands[1]));
7706 emit_insn (gen_addsi3 (operands[0], tmp, offset));
7711 operands[2] = rs6000_got_register (operands[1]);
7714 (define_insn "*movsi_got_internal"
7715 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7716 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
7717 (match_operand:SI 2 "gpc_reg_operand" "b")]
7719 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
7720 "lwz %0,%a1@got(%2)"
7721 [(set_attr "type" "load")])
7723 ;; Used by sched, shorten_branches and final when the GOT pseudo reg
7724 ;; didn't get allocated to a hard register.
7726 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7727 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
7728 (match_operand:SI 2 "memory_operand" "")]
7730 "DEFAULT_ABI == ABI_V4
7732 && (reload_in_progress || reload_completed)"
7733 [(set (match_dup 0) (match_dup 2))
7734 (set (match_dup 0) (unspec:SI [(match_dup 1)(match_dup 0)]
7738 ;; For SI, we special-case integers that can't be loaded in one insn. We
7739 ;; do the load 16-bits at a time. We could do this by loading from memory,
7740 ;; and this is even supposed to be faster, but it is simpler not to get
7741 ;; integers in the TOC.
7742 (define_insn "movsi_low"
7743 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7744 (mem:SI (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
7745 (match_operand 2 "" ""))))]
7746 "TARGET_MACHO && ! TARGET_64BIT"
7747 "lwz %0,lo16(%2)(%1)"
7748 [(set_attr "type" "load")
7749 (set_attr "length" "4")])
7751 (define_insn "*movsi_internal1"
7752 [(set (match_operand:SI 0 "rs6000_nonimmediate_operand" "=r,r,r,m,r,r,r,r,*c*l,*h,*h")
7753 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,*h,r,r,0"))]
7754 "!TARGET_SINGLE_FPU &&
7755 (gpc_reg_operand (operands[0], SImode) || gpc_reg_operand (operands[1], SImode))"
7768 [(set_attr "type" "*,*,load,store,*,*,*,mfjmpr,mtjmpr,*,*")
7769 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4")])
7771 (define_insn "*movsi_internal1_single"
7772 [(set (match_operand:SI 0 "rs6000_nonimmediate_operand" "=r,r,r,m,r,r,r,r,*c*l,*h,*h,m,*f")
7773 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,*h,r,r,0,f,m"))]
7774 "TARGET_SINGLE_FPU &&
7775 (gpc_reg_operand (operands[0], SImode) || gpc_reg_operand (operands[1], SImode))"
7790 [(set_attr "type" "*,*,load,store,*,*,*,mfjmpr,mtjmpr,*,*,*,*")
7791 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4,4,4")])
7793 ;; Split a load of a large constant into the appropriate two-insn
7797 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7798 (match_operand:SI 1 "const_int_operand" ""))]
7799 "(unsigned HOST_WIDE_INT) (INTVAL (operands[1]) + 0x8000) >= 0x10000
7800 && (INTVAL (operands[1]) & 0xffff) != 0"
7804 (ior:SI (match_dup 0)
7807 { rtx tem = rs6000_emit_set_const (operands[0], SImode, operands[1], 2);
7809 if (tem == operands[0])
7815 (define_insn "*mov<mode>_internal2"
7816 [(set (match_operand:CC 2 "cc_reg_operand" "=y,x,?y")
7817 (compare:CC (match_operand:P 1 "gpc_reg_operand" "0,r,r")
7819 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r") (match_dup 1))]
7825 [(set_attr "type" "cmp,compare,cmp")
7826 (set_attr "length" "4,4,8")])
7829 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
7830 (compare:CC (match_operand:P 1 "gpc_reg_operand" "")
7832 (set (match_operand:P 0 "gpc_reg_operand" "") (match_dup 1))]
7834 [(set (match_dup 0) (match_dup 1))
7836 (compare:CC (match_dup 0)
7840 (define_insn "*movhi_internal"
7841 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,m,r,r,*c*l,*h")
7842 (match_operand:HI 1 "input_operand" "r,m,r,i,*h,r,0"))]
7843 "gpc_reg_operand (operands[0], HImode)
7844 || gpc_reg_operand (operands[1], HImode)"
7853 [(set_attr "type" "*,load,store,*,mfjmpr,mtjmpr,*")])
7855 (define_expand "mov<mode>"
7856 [(set (match_operand:INT 0 "general_operand" "")
7857 (match_operand:INT 1 "any_operand" ""))]
7859 "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
7861 (define_insn "*movqi_internal"
7862 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,m,r,r,*c*l,*h")
7863 (match_operand:QI 1 "input_operand" "r,m,r,i,*h,r,0"))]
7864 "gpc_reg_operand (operands[0], QImode)
7865 || gpc_reg_operand (operands[1], QImode)"
7874 [(set_attr "type" "*,load,store,*,mfjmpr,mtjmpr,*")])
7876 ;; Here is how to move condition codes around. When we store CC data in
7877 ;; an integer register or memory, we store just the high-order 4 bits.
7878 ;; This lets us not shift in the most common case of CR0.
7879 (define_expand "movcc"
7880 [(set (match_operand:CC 0 "nonimmediate_operand" "")
7881 (match_operand:CC 1 "nonimmediate_operand" ""))]
7885 (define_insn "*movcc_internal1"
7886 [(set (match_operand:CC 0 "nonimmediate_operand" "=y,x,?y,y,r,r,r,r,r,cl,r,m")
7887 (match_operand:CC 1 "general_operand" "y,r,r,O,x,y,r,I,h,r,m,r"))]
7888 "register_operand (operands[0], CCmode)
7889 || register_operand (operands[1], CCmode)"
7893 rlwinm %1,%1,%F0,0xffffffff\;mtcrf %R0,%1\;rlwinm %1,%1,%f0,0xffffffff
7896 mfcr %0%Q1\;rlwinm %0,%0,%f1,0xf0000000
7904 (cond [(eq_attr "alternative" "0,3")
7905 (const_string "cr_logical")
7906 (eq_attr "alternative" "1,2")
7907 (const_string "mtcr")
7908 (eq_attr "alternative" "6,7")
7909 (const_string "integer")
7910 (eq_attr "alternative" "8")
7911 (const_string "mfjmpr")
7912 (eq_attr "alternative" "9")
7913 (const_string "mtjmpr")
7914 (eq_attr "alternative" "10")
7915 (const_string "load")
7916 (eq_attr "alternative" "11")
7917 (const_string "store")
7918 (match_test "TARGET_MFCRF")
7919 (const_string "mfcrf")
7921 (const_string "mfcr")))
7922 (set_attr "length" "4,4,12,4,4,8,4,4,4,4,4,4")])
7924 ;; For floating-point, we normally deal with the floating-point registers
7925 ;; unless -msoft-float is used. The sole exception is that parameter passing
7926 ;; can produce floating-point values in fixed-point registers. Unless the
7927 ;; value is a simple constant or already in memory, we deal with this by
7928 ;; allocating memory and copying the value explicitly via that memory location.
7929 (define_expand "movsf"
7930 [(set (match_operand:SF 0 "nonimmediate_operand" "")
7931 (match_operand:SF 1 "any_operand" ""))]
7933 "{ rs6000_emit_move (operands[0], operands[1], SFmode); DONE; }")
7936 [(set (match_operand:SF 0 "gpc_reg_operand" "")
7937 (match_operand:SF 1 "const_double_operand" ""))]
7939 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
7940 || (GET_CODE (operands[0]) == SUBREG
7941 && GET_CODE (SUBREG_REG (operands[0])) == REG
7942 && REGNO (SUBREG_REG (operands[0])) <= 31))"
7943 [(set (match_dup 2) (match_dup 3))]
7949 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
7950 REAL_VALUE_TO_TARGET_SINGLE (rv, l);
7952 if (! TARGET_POWERPC64)
7953 operands[2] = operand_subword (operands[0], 0, 0, SFmode);
7955 operands[2] = gen_lowpart (SImode, operands[0]);
7957 operands[3] = gen_int_mode (l, SImode);
7960 (define_insn "*movsf_hardfloat"
7961 [(set (match_operand:SF 0 "nonimmediate_operand" "=!r,!r,m,f,f,m,*c*l,!r,*h,!r,!r")
7962 (match_operand:SF 1 "input_operand" "r,m,r,f,m,f,r,h,0,G,Fn"))]
7963 "(gpc_reg_operand (operands[0], SFmode)
7964 || gpc_reg_operand (operands[1], SFmode))
7965 && (TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT)"
7978 [(set_attr "type" "*,load,store,fp,fpload,fpstore,mtjmpr,mfjmpr,*,*,*")
7979 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,8")])
7981 (define_insn "*movsf_softfloat"
7982 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,cl,r,r,m,r,r,r,r,*h")
7983 (match_operand:SF 1 "input_operand" "r,r,h,m,r,I,L,G,Fn,0"))]
7984 "(gpc_reg_operand (operands[0], SFmode)
7985 || gpc_reg_operand (operands[1], SFmode))
7986 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)"
7998 [(set_attr "type" "*,mtjmpr,mfjmpr,load,store,*,*,*,*,*")
7999 (set_attr "length" "4,4,4,4,4,4,4,4,8,4")])
8002 (define_expand "movdf"
8003 [(set (match_operand:DF 0 "nonimmediate_operand" "")
8004 (match_operand:DF 1 "any_operand" ""))]
8006 "{ rs6000_emit_move (operands[0], operands[1], DFmode); DONE; }")
8009 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8010 (match_operand:DF 1 "const_int_operand" ""))]
8011 "! TARGET_POWERPC64 && reload_completed
8012 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8013 || (GET_CODE (operands[0]) == SUBREG
8014 && GET_CODE (SUBREG_REG (operands[0])) == REG
8015 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8016 [(set (match_dup 2) (match_dup 4))
8017 (set (match_dup 3) (match_dup 1))]
8020 int endian = (WORDS_BIG_ENDIAN == 0);
8021 HOST_WIDE_INT value = INTVAL (operands[1]);
8023 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
8024 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
8025 #if HOST_BITS_PER_WIDE_INT == 32
8026 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
8028 operands[4] = GEN_INT (value >> 32);
8029 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
8034 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8035 (match_operand:DF 1 "const_double_operand" ""))]
8036 "! TARGET_POWERPC64 && reload_completed
8037 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8038 || (GET_CODE (operands[0]) == SUBREG
8039 && GET_CODE (SUBREG_REG (operands[0])) == REG
8040 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8041 [(set (match_dup 2) (match_dup 4))
8042 (set (match_dup 3) (match_dup 5))]
8045 int endian = (WORDS_BIG_ENDIAN == 0);
8049 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8050 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
8052 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
8053 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
8054 operands[4] = gen_int_mode (l[endian], SImode);
8055 operands[5] = gen_int_mode (l[1 - endian], SImode);
8059 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8060 (match_operand:DF 1 "const_double_operand" ""))]
8061 "TARGET_POWERPC64 && reload_completed
8062 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8063 || (GET_CODE (operands[0]) == SUBREG
8064 && GET_CODE (SUBREG_REG (operands[0])) == REG
8065 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8066 [(set (match_dup 2) (match_dup 3))]
8069 int endian = (WORDS_BIG_ENDIAN == 0);
8072 #if HOST_BITS_PER_WIDE_INT >= 64
8076 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8077 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
8079 operands[2] = gen_lowpart (DImode, operands[0]);
8080 /* HIGHPART is lower memory address when WORDS_BIG_ENDIAN. */
8081 #if HOST_BITS_PER_WIDE_INT >= 64
8082 val = ((HOST_WIDE_INT)(unsigned long)l[endian] << 32
8083 | ((HOST_WIDE_INT)(unsigned long)l[1 - endian]));
8085 operands[3] = gen_int_mode (val, DImode);
8087 operands[3] = immed_double_const (l[1 - endian], l[endian], DImode);
8091 ;; Don't have reload use general registers to load a constant. It is
8092 ;; less efficient than loading the constant into an FP register, since
8093 ;; it will probably be used there.
8095 ;; The move constraints are ordered to prefer floating point registers before
8096 ;; general purpose registers to avoid doing a store and a load to get the value
8097 ;; into a floating point register when it is needed for a floating point
8098 ;; operation. Prefer traditional floating point registers over VSX registers,
8099 ;; since the D-form version of the memory instructions does not need a GPR for
8102 (define_insn "*movdf_hardfloat32"
8103 [(set (match_operand:DF 0 "nonimmediate_operand" "=m,d,d,ws,?wa,Z,?Z,ws,?wa,wa,Y,r,!r,!r,!r,!r")
8104 (match_operand:DF 1 "input_operand" "d,m,d,Z,Z,ws,wa,ws,wa,j,r,Y,r,G,H,F"))]
8105 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
8106 && (gpc_reg_operand (operands[0], DFmode)
8107 || gpc_reg_operand (operands[1], DFmode))"
8125 [(set_attr "type" "fpstore,fpload,fp,fpload,fpload,fpstore,fpstore,vecsimple,vecsimple,vecsimple,store,load,two,fp,fp,*")
8126 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,8,8,8,8,12,16")])
8128 (define_insn "*movdf_softfloat32"
8129 [(set (match_operand:DF 0 "nonimmediate_operand" "=Y,r,r,r,r,r")
8130 (match_operand:DF 1 "input_operand" "r,Y,r,G,H,F"))]
8132 && ((TARGET_FPRS && TARGET_SINGLE_FLOAT)
8133 || TARGET_SOFT_FLOAT || TARGET_E500_SINGLE)
8134 && (gpc_reg_operand (operands[0], DFmode)
8135 || gpc_reg_operand (operands[1], DFmode))"
8137 [(set_attr "type" "store,load,two,*,*,*")
8138 (set_attr "length" "8,8,8,8,12,16")])
8140 ;; Reload patterns to support gpr load/store with misaligned mem.
8141 ;; and multiple gpr load/store at offset >= 0xfffc
8142 (define_expand "reload_<mode>_store"
8143 [(parallel [(match_operand 0 "memory_operand" "=m")
8144 (match_operand 1 "gpc_reg_operand" "r")
8145 (match_operand:GPR 2 "register_operand" "=&b")])]
8148 rs6000_secondary_reload_gpr (operands[1], operands[0], operands[2], true);
8152 (define_expand "reload_<mode>_load"
8153 [(parallel [(match_operand 0 "gpc_reg_operand" "=r")
8154 (match_operand 1 "memory_operand" "m")
8155 (match_operand:GPR 2 "register_operand" "=b")])]
8158 rs6000_secondary_reload_gpr (operands[0], operands[1], operands[2], false);
8162 ; ld/std require word-aligned displacements -> 'Y' constraint.
8163 ; List Y->r and r->Y before r->r for reload.
8164 (define_insn "*movdf_hardfloat64_mfpgpr"
8165 [(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")
8166 (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"))]
8167 "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
8168 && TARGET_DOUBLE_FLOAT
8169 && (gpc_reg_operand (operands[0], DFmode)
8170 || gpc_reg_operand (operands[1], DFmode))"
8193 [(set_attr "type" "store,load,*,fp,fp,fpload,fpload,fpstore,fpstore,fpstore,fpload,fp,vecsimple,mtjmpr,mfjmpr,*,*,*,*,mftgpr,mffgpr")
8194 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,8,12,16,4,4")])
8196 ; ld/std require word-aligned displacements -> 'Y' constraint.
8197 ; List Y->r and r->Y before r->r for reload.
8198 (define_insn "*movdf_hardfloat64"
8199 [(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")
8200 (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"))]
8201 "TARGET_POWERPC64 && !TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
8202 && TARGET_DOUBLE_FLOAT
8203 && (gpc_reg_operand (operands[0], DFmode)
8204 || gpc_reg_operand (operands[1], DFmode))"
8225 [(set_attr "type" "fpstore,fpload,fp,store,load,*,fpload,fpload,fpstore,fpstore,vecsimple,vecsimple,vecsimple,mtjmpr,mfjmpr,*,*,*,*")
8226 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,8,12,16")])
8228 (define_insn "*movdf_softfloat64"
8229 [(set (match_operand:DF 0 "nonimmediate_operand" "=Y,r,r,cl,r,r,r,r,*h")
8230 (match_operand:DF 1 "input_operand" "r,Y,r,r,h,G,H,F,0"))]
8231 "TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)
8232 && (gpc_reg_operand (operands[0], DFmode)
8233 || gpc_reg_operand (operands[1], DFmode))"
8244 [(set_attr "type" "store,load,*,mtjmpr,mfjmpr,*,*,*,*")
8245 (set_attr "length" "4,4,4,4,4,8,12,16,4")])
8247 (define_expand "movtf"
8248 [(set (match_operand:TF 0 "general_operand" "")
8249 (match_operand:TF 1 "any_operand" ""))]
8250 "!TARGET_IEEEQUAD && TARGET_LONG_DOUBLE_128"
8251 "{ rs6000_emit_move (operands[0], operands[1], TFmode); DONE; }")
8253 ;; It's important to list Y->r and r->Y before r->r because otherwise
8254 ;; reload, given m->r, will try to pick r->r and reload it, which
8255 ;; doesn't make progress.
8256 (define_insn_and_split "*movtf_internal"
8257 [(set (match_operand:TF 0 "nonimmediate_operand" "=m,d,d,Y,r,r")
8258 (match_operand:TF 1 "input_operand" "d,m,d,r,YGHF,r"))]
8260 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128
8261 && (gpc_reg_operand (operands[0], TFmode)
8262 || gpc_reg_operand (operands[1], TFmode))"
8264 "&& reload_completed"
8266 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
8267 [(set_attr "length" "8,8,8,20,20,16")])
8269 (define_insn_and_split "*movtf_softfloat"
8270 [(set (match_operand:TF 0 "rs6000_nonimmediate_operand" "=Y,r,r")
8271 (match_operand:TF 1 "input_operand" "r,YGHF,r"))]
8273 && (TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_LONG_DOUBLE_128
8274 && (gpc_reg_operand (operands[0], TFmode)
8275 || gpc_reg_operand (operands[1], TFmode))"
8277 "&& reload_completed"
8279 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
8280 [(set_attr "length" "20,20,16")])
8282 (define_expand "extenddftf2"
8283 [(set (match_operand:TF 0 "nonimmediate_operand" "")
8284 (float_extend:TF (match_operand:DF 1 "input_operand" "")))]
8286 && TARGET_HARD_FLOAT
8287 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8288 && TARGET_LONG_DOUBLE_128"
8290 if (TARGET_E500_DOUBLE)
8291 emit_insn (gen_spe_extenddftf2 (operands[0], operands[1]));
8293 emit_insn (gen_extenddftf2_fprs (operands[0], operands[1]));
8297 (define_expand "extenddftf2_fprs"
8298 [(parallel [(set (match_operand:TF 0 "nonimmediate_operand" "")
8299 (float_extend:TF (match_operand:DF 1 "input_operand" "")))
8300 (use (match_dup 2))])]
8302 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
8303 && TARGET_LONG_DOUBLE_128"
8305 operands[2] = CONST0_RTX (DFmode);
8306 /* Generate GOT reference early for SVR4 PIC. */
8307 if (DEFAULT_ABI == ABI_V4 && flag_pic)
8308 operands[2] = validize_mem (force_const_mem (DFmode, operands[2]));
8311 (define_insn_and_split "*extenddftf2_internal"
8312 [(set (match_operand:TF 0 "nonimmediate_operand" "=m,Y,d,&d,r")
8313 (float_extend:TF (match_operand:DF 1 "input_operand" "d,r,md,md,rmGHF")))
8314 (use (match_operand:DF 2 "zero_reg_mem_operand" "d,r,m,d,n"))]
8316 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
8317 && TARGET_LONG_DOUBLE_128"
8319 "&& reload_completed"
8322 const int lo_word = LONG_DOUBLE_LARGE_FIRST ? GET_MODE_SIZE (DFmode) : 0;
8323 const int hi_word = LONG_DOUBLE_LARGE_FIRST ? 0 : GET_MODE_SIZE (DFmode);
8324 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word),
8326 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word),
8331 (define_expand "extendsftf2"
8332 [(set (match_operand:TF 0 "nonimmediate_operand" "")
8333 (float_extend:TF (match_operand:SF 1 "gpc_reg_operand" "")))]
8335 && TARGET_HARD_FLOAT
8336 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8337 && TARGET_LONG_DOUBLE_128"
8339 rtx tmp = gen_reg_rtx (DFmode);
8340 emit_insn (gen_extendsfdf2 (tmp, operands[1]));
8341 emit_insn (gen_extenddftf2 (operands[0], tmp));
8345 (define_expand "trunctfdf2"
8346 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8347 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "")))]
8349 && TARGET_HARD_FLOAT
8350 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8351 && TARGET_LONG_DOUBLE_128"
8354 (define_insn_and_split "trunctfdf2_internal1"
8355 [(set (match_operand:DF 0 "gpc_reg_operand" "=d,?d")
8356 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "0,d")))]
8357 "!TARGET_IEEEQUAD && !TARGET_XL_COMPAT
8358 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8362 "&& reload_completed && REGNO (operands[0]) == REGNO (operands[1])"
8365 emit_note (NOTE_INSN_DELETED);
8368 [(set_attr "type" "fp")])
8370 (define_insn "trunctfdf2_internal2"
8371 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
8372 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "d")))]
8373 "!TARGET_IEEEQUAD && TARGET_XL_COMPAT
8374 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
8375 && TARGET_LONG_DOUBLE_128"
8377 [(set_attr "type" "fp")
8378 (set_attr "fp_type" "fp_addsub_d")])
8380 (define_expand "trunctfsf2"
8381 [(set (match_operand:SF 0 "gpc_reg_operand" "")
8382 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "")))]
8384 && TARGET_HARD_FLOAT
8385 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8386 && TARGET_LONG_DOUBLE_128"
8388 if (TARGET_E500_DOUBLE)
8389 emit_insn (gen_spe_trunctfsf2 (operands[0], operands[1]));
8391 emit_insn (gen_trunctfsf2_fprs (operands[0], operands[1]));
8395 (define_insn_and_split "trunctfsf2_fprs"
8396 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
8397 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "d")))
8398 (clobber (match_scratch:DF 2 "=d"))]
8400 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
8401 && TARGET_LONG_DOUBLE_128"
8403 "&& reload_completed"
8405 (float_truncate:DF (match_dup 1)))
8407 (float_truncate:SF (match_dup 2)))]
8410 (define_expand "floatsitf2"
8411 [(set (match_operand:TF 0 "gpc_reg_operand" "")
8412 (float:TF (match_operand:SI 1 "gpc_reg_operand" "")))]
8414 && TARGET_HARD_FLOAT
8415 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8416 && TARGET_LONG_DOUBLE_128"
8418 rtx tmp = gen_reg_rtx (DFmode);
8419 expand_float (tmp, operands[1], false);
8420 emit_insn (gen_extenddftf2 (operands[0], tmp));
8424 ; fadd, but rounding towards zero.
8425 ; This is probably not the optimal code sequence.
8426 (define_insn "fix_trunc_helper"
8427 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
8428 (unspec:DF [(match_operand:TF 1 "gpc_reg_operand" "d")]
8429 UNSPEC_FIX_TRUNC_TF))
8430 (clobber (match_operand:DF 2 "gpc_reg_operand" "=&d"))]
8431 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
8432 "mffs %2\n\tmtfsb1 31\n\tmtfsb0 30\n\tfadd %0,%1,%L1\n\tmtfsf 1,%2"
8433 [(set_attr "type" "fp")
8434 (set_attr "length" "20")])
8436 (define_expand "fix_trunctfsi2"
8437 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8438 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))]
8439 "!TARGET_IEEEQUAD && TARGET_HARD_FLOAT
8440 && (TARGET_FPRS || TARGET_E500_DOUBLE) && TARGET_LONG_DOUBLE_128"
8442 if (TARGET_E500_DOUBLE)
8443 emit_insn (gen_spe_fix_trunctfsi2 (operands[0], operands[1]));
8445 emit_insn (gen_fix_trunctfsi2_fprs (operands[0], operands[1]));
8449 (define_expand "fix_trunctfsi2_fprs"
8450 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
8451 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))
8452 (clobber (match_dup 2))
8453 (clobber (match_dup 3))
8454 (clobber (match_dup 4))
8455 (clobber (match_dup 5))])]
8457 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8459 operands[2] = gen_reg_rtx (DFmode);
8460 operands[3] = gen_reg_rtx (DFmode);
8461 operands[4] = gen_reg_rtx (DImode);
8462 operands[5] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode));
8465 (define_insn_and_split "*fix_trunctfsi2_internal"
8466 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8467 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "d")))
8468 (clobber (match_operand:DF 2 "gpc_reg_operand" "=d"))
8469 (clobber (match_operand:DF 3 "gpc_reg_operand" "=&d"))
8470 (clobber (match_operand:DI 4 "gpc_reg_operand" "=d"))
8471 (clobber (match_operand:DI 5 "offsettable_mem_operand" "=o"))]
8473 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8479 emit_insn (gen_fix_trunc_helper (operands[2], operands[1], operands[3]));
8481 gcc_assert (MEM_P (operands[5]));
8482 lowword = adjust_address (operands[5], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
8484 emit_insn (gen_fctiwz_df (operands[4], operands[2]));
8485 emit_move_insn (operands[5], operands[4]);
8486 emit_move_insn (operands[0], lowword);
8490 (define_expand "negtf2"
8491 [(set (match_operand:TF 0 "gpc_reg_operand" "")
8492 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "")))]
8494 && TARGET_HARD_FLOAT
8495 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8496 && TARGET_LONG_DOUBLE_128"
8499 (define_insn "negtf2_internal"
8500 [(set (match_operand:TF 0 "gpc_reg_operand" "=d")
8501 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "d")))]
8503 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8506 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8507 return \"fneg %L0,%L1\;fneg %0,%1\";
8509 return \"fneg %0,%1\;fneg %L0,%L1\";
8511 [(set_attr "type" "fp")
8512 (set_attr "length" "8")])
8514 (define_expand "abstf2"
8515 [(set (match_operand:TF 0 "gpc_reg_operand" "")
8516 (abs:TF (match_operand:TF 1 "gpc_reg_operand" "")))]
8518 && TARGET_HARD_FLOAT
8519 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8520 && TARGET_LONG_DOUBLE_128"
8523 rtx label = gen_label_rtx ();
8524 if (TARGET_E500_DOUBLE)
8526 if (flag_finite_math_only && !flag_trapping_math)
8527 emit_insn (gen_spe_abstf2_tst (operands[0], operands[1], label));
8529 emit_insn (gen_spe_abstf2_cmp (operands[0], operands[1], label));
8532 emit_insn (gen_abstf2_internal (operands[0], operands[1], label));
8537 (define_expand "abstf2_internal"
8538 [(set (match_operand:TF 0 "gpc_reg_operand" "")
8539 (match_operand:TF 1 "gpc_reg_operand" ""))
8540 (set (match_dup 3) (match_dup 5))
8541 (set (match_dup 5) (abs:DF (match_dup 5)))
8542 (set (match_dup 4) (compare:CCFP (match_dup 3) (match_dup 5)))
8543 (set (pc) (if_then_else (eq (match_dup 4) (const_int 0))
8544 (label_ref (match_operand 2 "" ""))
8546 (set (match_dup 6) (neg:DF (match_dup 6)))]
8548 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
8549 && TARGET_LONG_DOUBLE_128"
8552 const int hi_word = LONG_DOUBLE_LARGE_FIRST ? 0 : GET_MODE_SIZE (DFmode);
8553 const int lo_word = LONG_DOUBLE_LARGE_FIRST ? GET_MODE_SIZE (DFmode) : 0;
8554 operands[3] = gen_reg_rtx (DFmode);
8555 operands[4] = gen_reg_rtx (CCFPmode);
8556 operands[5] = simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word);
8557 operands[6] = simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word);
8560 ;; Next come the multi-word integer load and store and the load and store
8563 ;; List r->r after r->Y, otherwise reload will try to reload a
8564 ;; non-offsettable address by using r->r which won't make progress.
8565 ;; Use of fprs is disparaged slightly otherwise reload prefers to reload
8566 ;; a gpr into a fpr instead of reloading an invalid 'Y' address
8567 (define_insn "*movdi_internal32"
8568 [(set (match_operand:DI 0 "rs6000_nonimmediate_operand" "=Y,r,r,?m,?*d,?*d,r,?wa")
8569 (match_operand:DI 1 "input_operand" "r,Y,r,d,m,d,IJKnGHF,O"))]
8571 && (gpc_reg_operand (operands[0], DImode)
8572 || gpc_reg_operand (operands[1], DImode))"
8582 [(set_attr "type" "store,load,*,fpstore,fpload,fp,*,vecsimple")])
8585 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8586 (match_operand:DI 1 "const_int_operand" ""))]
8587 "! TARGET_POWERPC64 && reload_completed
8588 && gpr_or_gpr_p (operands[0], operands[1])"
8589 [(set (match_dup 2) (match_dup 4))
8590 (set (match_dup 3) (match_dup 1))]
8593 HOST_WIDE_INT value = INTVAL (operands[1]);
8594 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
8596 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
8598 #if HOST_BITS_PER_WIDE_INT == 32
8599 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
8601 operands[4] = GEN_INT (value >> 32);
8602 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
8607 [(set (match_operand:DIFD 0 "rs6000_nonimmediate_operand" "")
8608 (match_operand:DIFD 1 "input_operand" ""))]
8609 "reload_completed && !TARGET_POWERPC64
8610 && gpr_or_gpr_p (operands[0], operands[1])"
8612 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
8614 (define_insn "*movdi_mfpgpr"
8615 [(set (match_operand:DI 0 "nonimmediate_operand" "=Y,r,r,r,r,r,?m,?*d,?*d,r,*h,*h,r,?*d")
8616 (match_operand:DI 1 "input_operand" "r,Y,r,I,L,nF,d,m,d,*h,r,0,*d,r"))]
8617 "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
8618 && (gpc_reg_operand (operands[0], DImode)
8619 || gpc_reg_operand (operands[1], DImode))"
8635 [(set_attr "type" "store,load,*,*,*,*,fpstore,fpload,fp,mfjmpr,mtjmpr,*,mftgpr,mffgpr")
8636 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4,4")])
8638 (define_insn "*movdi_internal64"
8639 [(set (match_operand:DI 0 "nonimmediate_operand" "=Y,r,r,r,r,r,?m,?*d,?*d,r,*h,*h,?wa")
8640 (match_operand:DI 1 "input_operand" "r,Y,r,I,L,nF,d,m,d,*h,r,0,O"))]
8641 "TARGET_POWERPC64 && (!TARGET_MFPGPR || !TARGET_HARD_FLOAT || !TARGET_FPRS)
8642 && (gpc_reg_operand (operands[0], DImode)
8643 || gpc_reg_operand (operands[1], DImode))"
8658 [(set_attr "type" "store,load,*,*,*,*,fpstore,fpload,fp,mfjmpr,mtjmpr,*,vecsimple")
8659 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4")])
8661 ;; immediate value valid for a single instruction hiding in a const_double
8663 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
8664 (match_operand:DI 1 "const_double_operand" "F"))]
8665 "HOST_BITS_PER_WIDE_INT == 32 && TARGET_POWERPC64
8666 && GET_CODE (operands[1]) == CONST_DOUBLE
8667 && num_insns_constant (operands[1], DImode) == 1"
8670 return ((unsigned HOST_WIDE_INT)
8671 (CONST_DOUBLE_LOW (operands[1]) + 0x8000) < 0x10000)
8672 ? \"li %0,%1\" : \"lis %0,%v1\";
8675 ;; Generate all one-bits and clear left or right.
8676 ;; Use (and:DI (rotate:DI ...)) to avoid anddi3 unnecessary clobber.
8678 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8679 (match_operand:DI 1 "mask64_operand" ""))]
8680 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
8681 [(set (match_dup 0) (const_int -1))
8683 (and:DI (rotate:DI (match_dup 0)
8688 ;; Split a load of a large constant into the appropriate five-instruction
8689 ;; sequence. Handle anything in a constant number of insns.
8690 ;; When non-easy constants can go in the TOC, this should use
8691 ;; easy_fp_constant predicate.
8693 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8694 (match_operand:DI 1 "const_int_operand" ""))]
8695 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
8696 [(set (match_dup 0) (match_dup 2))
8697 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
8699 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
8701 if (tem == operands[0])
8708 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8709 (match_operand:DI 1 "const_double_operand" ""))]
8710 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
8711 [(set (match_dup 0) (match_dup 2))
8712 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
8714 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
8716 if (tem == operands[0])
8722 ;; TImode is similar, except that we usually want to compute the address into
8723 ;; a register and use lsi/stsi (the exception is during reload).
8725 (define_insn "*movti_string"
8726 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,Y,????r,????r,????r,r")
8727 (match_operand:TI 1 "input_operand" "r,r,Q,Y,r,n"))]
8729 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
8732 switch (which_alternative)
8738 return \"stswi %1,%P0,16\";
8742 /* If the address is not used in the output, we can use lsi. Otherwise,
8743 fall through to generating four loads. */
8745 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
8746 return \"lswi %0,%P1,16\";
8747 /* ... fall through ... */
8754 [(set_attr "type" "store_ux,store_ux,load_ux,load_ux,*,*")
8755 (set (attr "cell_micro") (if_then_else (match_test "TARGET_STRING")
8756 (const_string "always")
8757 (const_string "conditional")))])
8759 (define_insn "*movti_ppc64"
8760 [(set (match_operand:TI 0 "nonimmediate_operand" "=Y,r,r")
8761 (match_operand:TI 1 "input_operand" "r,Y,r"))]
8762 "(TARGET_POWERPC64 && (gpc_reg_operand (operands[0], TImode)
8763 || gpc_reg_operand (operands[1], TImode)))
8764 && VECTOR_MEM_NONE_P (TImode)"
8766 [(set_attr "type" "store,load,*")])
8769 [(set (match_operand:TI 0 "gpc_reg_operand" "")
8770 (match_operand:TI 1 "const_double_operand" ""))]
8771 "TARGET_POWERPC64 && VECTOR_MEM_NONE_P (TImode)"
8772 [(set (match_dup 2) (match_dup 4))
8773 (set (match_dup 3) (match_dup 5))]
8776 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
8778 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
8780 if (GET_CODE (operands[1]) == CONST_DOUBLE)
8782 operands[4] = GEN_INT (CONST_DOUBLE_HIGH (operands[1]));
8783 operands[5] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
8785 else if (GET_CODE (operands[1]) == CONST_INT)
8787 operands[4] = GEN_INT (- (INTVAL (operands[1]) < 0));
8788 operands[5] = operands[1];
8795 [(set (match_operand:TI 0 "nonimmediate_operand" "")
8796 (match_operand:TI 1 "input_operand" ""))]
8797 "reload_completed && VECTOR_MEM_NONE_P (TImode)
8798 && gpr_or_gpr_p (operands[0], operands[1])"
8800 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
8802 (define_expand "load_multiple"
8803 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
8804 (match_operand:SI 1 "" ""))
8805 (use (match_operand:SI 2 "" ""))])]
8806 "TARGET_STRING && !TARGET_POWERPC64"
8814 /* Support only loading a constant number of fixed-point registers from
8815 memory and only bother with this if more than two; the machine
8816 doesn't support more than eight. */
8817 if (GET_CODE (operands[2]) != CONST_INT
8818 || INTVAL (operands[2]) <= 2
8819 || INTVAL (operands[2]) > 8
8820 || GET_CODE (operands[1]) != MEM
8821 || GET_CODE (operands[0]) != REG
8822 || REGNO (operands[0]) >= 32)
8825 count = INTVAL (operands[2]);
8826 regno = REGNO (operands[0]);
8828 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
8829 op1 = replace_equiv_address (operands[1],
8830 force_reg (SImode, XEXP (operands[1], 0)));
8832 for (i = 0; i < count; i++)
8833 XVECEXP (operands[3], 0, i)
8834 = gen_rtx_SET (VOIDmode, gen_rtx_REG (SImode, regno + i),
8835 adjust_address_nv (op1, SImode, i * 4));
8838 (define_insn "*ldmsi8"
8839 [(match_parallel 0 "load_multiple_operation"
8840 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8841 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8842 (set (match_operand:SI 3 "gpc_reg_operand" "")
8843 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8844 (set (match_operand:SI 4 "gpc_reg_operand" "")
8845 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8846 (set (match_operand:SI 5 "gpc_reg_operand" "")
8847 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8848 (set (match_operand:SI 6 "gpc_reg_operand" "")
8849 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
8850 (set (match_operand:SI 7 "gpc_reg_operand" "")
8851 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
8852 (set (match_operand:SI 8 "gpc_reg_operand" "")
8853 (mem:SI (plus:SI (match_dup 1) (const_int 24))))
8854 (set (match_operand:SI 9 "gpc_reg_operand" "")
8855 (mem:SI (plus:SI (match_dup 1) (const_int 28))))])]
8856 "TARGET_STRING && XVECLEN (operands[0], 0) == 8"
8858 { return rs6000_output_load_multiple (operands); }"
8859 [(set_attr "type" "load_ux")
8860 (set_attr "length" "32")])
8862 (define_insn "*ldmsi7"
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 (set (match_operand:SI 7 "gpc_reg_operand" "")
8875 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
8876 (set (match_operand:SI 8 "gpc_reg_operand" "")
8877 (mem:SI (plus:SI (match_dup 1) (const_int 24))))])]
8878 "TARGET_STRING && XVECLEN (operands[0], 0) == 7"
8880 { return rs6000_output_load_multiple (operands); }"
8881 [(set_attr "type" "load_ux")
8882 (set_attr "length" "32")])
8884 (define_insn "*ldmsi6"
8885 [(match_parallel 0 "load_multiple_operation"
8886 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8887 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8888 (set (match_operand:SI 3 "gpc_reg_operand" "")
8889 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8890 (set (match_operand:SI 4 "gpc_reg_operand" "")
8891 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8892 (set (match_operand:SI 5 "gpc_reg_operand" "")
8893 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8894 (set (match_operand:SI 6 "gpc_reg_operand" "")
8895 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
8896 (set (match_operand:SI 7 "gpc_reg_operand" "")
8897 (mem:SI (plus:SI (match_dup 1) (const_int 20))))])]
8898 "TARGET_STRING && XVECLEN (operands[0], 0) == 6"
8900 { return rs6000_output_load_multiple (operands); }"
8901 [(set_attr "type" "load_ux")
8902 (set_attr "length" "32")])
8904 (define_insn "*ldmsi5"
8905 [(match_parallel 0 "load_multiple_operation"
8906 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8907 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8908 (set (match_operand:SI 3 "gpc_reg_operand" "")
8909 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8910 (set (match_operand:SI 4 "gpc_reg_operand" "")
8911 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8912 (set (match_operand:SI 5 "gpc_reg_operand" "")
8913 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8914 (set (match_operand:SI 6 "gpc_reg_operand" "")
8915 (mem:SI (plus:SI (match_dup 1) (const_int 16))))])]
8916 "TARGET_STRING && XVECLEN (operands[0], 0) == 5"
8918 { return rs6000_output_load_multiple (operands); }"
8919 [(set_attr "type" "load_ux")
8920 (set_attr "length" "32")])
8922 (define_insn "*ldmsi4"
8923 [(match_parallel 0 "load_multiple_operation"
8924 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8925 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8926 (set (match_operand:SI 3 "gpc_reg_operand" "")
8927 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8928 (set (match_operand:SI 4 "gpc_reg_operand" "")
8929 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8930 (set (match_operand:SI 5 "gpc_reg_operand" "")
8931 (mem:SI (plus:SI (match_dup 1) (const_int 12))))])]
8932 "TARGET_STRING && XVECLEN (operands[0], 0) == 4"
8934 { return rs6000_output_load_multiple (operands); }"
8935 [(set_attr "type" "load_ux")
8936 (set_attr "length" "32")])
8938 (define_insn "*ldmsi3"
8939 [(match_parallel 0 "load_multiple_operation"
8940 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8941 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8942 (set (match_operand:SI 3 "gpc_reg_operand" "")
8943 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8944 (set (match_operand:SI 4 "gpc_reg_operand" "")
8945 (mem:SI (plus:SI (match_dup 1) (const_int 8))))])]
8946 "TARGET_STRING && XVECLEN (operands[0], 0) == 3"
8948 { return rs6000_output_load_multiple (operands); }"
8949 [(set_attr "type" "load_ux")
8950 (set_attr "length" "32")])
8952 (define_expand "store_multiple"
8953 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
8954 (match_operand:SI 1 "" ""))
8955 (clobber (scratch:SI))
8956 (use (match_operand:SI 2 "" ""))])]
8957 "TARGET_STRING && !TARGET_POWERPC64"
8966 /* Support only storing a constant number of fixed-point registers to
8967 memory and only bother with this if more than two; the machine
8968 doesn't support more than eight. */
8969 if (GET_CODE (operands[2]) != CONST_INT
8970 || INTVAL (operands[2]) <= 2
8971 || INTVAL (operands[2]) > 8
8972 || GET_CODE (operands[0]) != MEM
8973 || GET_CODE (operands[1]) != REG
8974 || REGNO (operands[1]) >= 32)
8977 count = INTVAL (operands[2]);
8978 regno = REGNO (operands[1]);
8980 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count + 1));
8981 to = force_reg (SImode, XEXP (operands[0], 0));
8982 op0 = replace_equiv_address (operands[0], to);
8984 XVECEXP (operands[3], 0, 0)
8985 = gen_rtx_SET (VOIDmode, adjust_address_nv (op0, SImode, 0), operands[1]);
8986 XVECEXP (operands[3], 0, 1) = gen_rtx_CLOBBER (VOIDmode,
8987 gen_rtx_SCRATCH (SImode));
8989 for (i = 1; i < count; i++)
8990 XVECEXP (operands[3], 0, i + 1)
8991 = gen_rtx_SET (VOIDmode,
8992 adjust_address_nv (op0, SImode, i * 4),
8993 gen_rtx_REG (SImode, regno + i));
8996 (define_insn "*stmsi8"
8997 [(match_parallel 0 "store_multiple_operation"
8998 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
8999 (match_operand:SI 2 "gpc_reg_operand" "r"))
9000 (clobber (match_scratch:SI 3 "=X"))
9001 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9002 (match_operand:SI 4 "gpc_reg_operand" "r"))
9003 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9004 (match_operand:SI 5 "gpc_reg_operand" "r"))
9005 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9006 (match_operand:SI 6 "gpc_reg_operand" "r"))
9007 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9008 (match_operand:SI 7 "gpc_reg_operand" "r"))
9009 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9010 (match_operand:SI 8 "gpc_reg_operand" "r"))
9011 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
9012 (match_operand:SI 9 "gpc_reg_operand" "r"))
9013 (set (mem:SI (plus:SI (match_dup 1) (const_int 28)))
9014 (match_operand:SI 10 "gpc_reg_operand" "r"))])]
9015 "TARGET_STRING && XVECLEN (operands[0], 0) == 9"
9017 [(set_attr "type" "store_ux")
9018 (set_attr "cell_micro" "always")])
9020 (define_insn "*stmsi7"
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 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9034 (match_operand:SI 8 "gpc_reg_operand" "r"))
9035 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
9036 (match_operand:SI 9 "gpc_reg_operand" "r"))])]
9037 "TARGET_STRING && XVECLEN (operands[0], 0) == 8"
9039 [(set_attr "type" "store_ux")
9040 (set_attr "cell_micro" "always")])
9042 (define_insn "*stmsi6"
9043 [(match_parallel 0 "store_multiple_operation"
9044 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9045 (match_operand:SI 2 "gpc_reg_operand" "r"))
9046 (clobber (match_scratch:SI 3 "=X"))
9047 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9048 (match_operand:SI 4 "gpc_reg_operand" "r"))
9049 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9050 (match_operand:SI 5 "gpc_reg_operand" "r"))
9051 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9052 (match_operand:SI 6 "gpc_reg_operand" "r"))
9053 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9054 (match_operand:SI 7 "gpc_reg_operand" "r"))
9055 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9056 (match_operand:SI 8 "gpc_reg_operand" "r"))])]
9057 "TARGET_STRING && XVECLEN (operands[0], 0) == 7"
9059 [(set_attr "type" "store_ux")
9060 (set_attr "cell_micro" "always")])
9062 (define_insn "*stmsi5"
9063 [(match_parallel 0 "store_multiple_operation"
9064 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9065 (match_operand:SI 2 "gpc_reg_operand" "r"))
9066 (clobber (match_scratch:SI 3 "=X"))
9067 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9068 (match_operand:SI 4 "gpc_reg_operand" "r"))
9069 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9070 (match_operand:SI 5 "gpc_reg_operand" "r"))
9071 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9072 (match_operand:SI 6 "gpc_reg_operand" "r"))
9073 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9074 (match_operand:SI 7 "gpc_reg_operand" "r"))])]
9075 "TARGET_STRING && XVECLEN (operands[0], 0) == 6"
9077 [(set_attr "type" "store_ux")
9078 (set_attr "cell_micro" "always")])
9080 (define_insn "*stmsi4"
9081 [(match_parallel 0 "store_multiple_operation"
9082 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9083 (match_operand:SI 2 "gpc_reg_operand" "r"))
9084 (clobber (match_scratch:SI 3 "=X"))
9085 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9086 (match_operand:SI 4 "gpc_reg_operand" "r"))
9087 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9088 (match_operand:SI 5 "gpc_reg_operand" "r"))
9089 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9090 (match_operand:SI 6 "gpc_reg_operand" "r"))])]
9091 "TARGET_STRING && XVECLEN (operands[0], 0) == 5"
9093 [(set_attr "type" "store_ux")
9094 (set_attr "cell_micro" "always")])
9096 (define_insn "*stmsi3"
9097 [(match_parallel 0 "store_multiple_operation"
9098 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9099 (match_operand:SI 2 "gpc_reg_operand" "r"))
9100 (clobber (match_scratch:SI 3 "=X"))
9101 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9102 (match_operand:SI 4 "gpc_reg_operand" "r"))
9103 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9104 (match_operand:SI 5 "gpc_reg_operand" "r"))])]
9105 "TARGET_STRING && XVECLEN (operands[0], 0) == 4"
9107 [(set_attr "type" "store_ux")
9108 (set_attr "cell_micro" "always")])
9110 (define_expand "setmemsi"
9111 [(parallel [(set (match_operand:BLK 0 "" "")
9112 (match_operand 2 "const_int_operand" ""))
9113 (use (match_operand:SI 1 "" ""))
9114 (use (match_operand:SI 3 "" ""))])]
9118 /* If value to set is not zero, use the library routine. */
9119 if (operands[2] != const0_rtx)
9122 if (expand_block_clear (operands))
9128 ;; String/block move insn.
9129 ;; Argument 0 is the destination
9130 ;; Argument 1 is the source
9131 ;; Argument 2 is the length
9132 ;; Argument 3 is the alignment
9134 (define_expand "movmemsi"
9135 [(parallel [(set (match_operand:BLK 0 "" "")
9136 (match_operand:BLK 1 "" ""))
9137 (use (match_operand:SI 2 "" ""))
9138 (use (match_operand:SI 3 "" ""))])]
9142 if (expand_block_move (operands))
9148 ;; Move up to 32 bytes at a time. The fixed registers are needed because the
9149 ;; register allocator doesn't have a clue about allocating 8 word registers.
9150 ;; rD/rS = r5 is preferred, efficient form.
9151 (define_expand "movmemsi_8reg"
9152 [(parallel [(set (match_operand 0 "" "")
9153 (match_operand 1 "" ""))
9154 (use (match_operand 2 "" ""))
9155 (use (match_operand 3 "" ""))
9156 (clobber (reg:SI 5))
9157 (clobber (reg:SI 6))
9158 (clobber (reg:SI 7))
9159 (clobber (reg:SI 8))
9160 (clobber (reg:SI 9))
9161 (clobber (reg:SI 10))
9162 (clobber (reg:SI 11))
9163 (clobber (reg:SI 12))
9164 (clobber (match_scratch:SI 4 ""))])]
9169 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
9170 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
9171 (use (match_operand:SI 2 "immediate_operand" "i"))
9172 (use (match_operand:SI 3 "immediate_operand" "i"))
9173 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
9174 (clobber (reg:SI 6))
9175 (clobber (reg:SI 7))
9176 (clobber (reg:SI 8))
9177 (clobber (reg:SI 9))
9178 (clobber (reg:SI 10))
9179 (clobber (reg:SI 11))
9180 (clobber (reg:SI 12))
9181 (clobber (match_scratch:SI 5 "=X"))]
9183 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
9184 || INTVAL (operands[2]) == 0)
9185 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
9186 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
9187 && REGNO (operands[4]) == 5"
9188 "lswi %4,%1,%2\;stswi %4,%0,%2"
9189 [(set_attr "type" "store_ux")
9190 (set_attr "cell_micro" "always")
9191 (set_attr "length" "8")])
9193 ;; Move up to 24 bytes at a time. The fixed registers are needed because the
9194 ;; register allocator doesn't have a clue about allocating 6 word registers.
9195 ;; rD/rS = r5 is preferred, efficient form.
9196 (define_expand "movmemsi_6reg"
9197 [(parallel [(set (match_operand 0 "" "")
9198 (match_operand 1 "" ""))
9199 (use (match_operand 2 "" ""))
9200 (use (match_operand 3 "" ""))
9201 (clobber (reg:SI 5))
9202 (clobber (reg:SI 6))
9203 (clobber (reg:SI 7))
9204 (clobber (reg:SI 8))
9205 (clobber (reg:SI 9))
9206 (clobber (reg:SI 10))
9207 (clobber (match_scratch:SI 4 ""))])]
9212 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
9213 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
9214 (use (match_operand:SI 2 "immediate_operand" "i"))
9215 (use (match_operand:SI 3 "immediate_operand" "i"))
9216 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
9217 (clobber (reg:SI 6))
9218 (clobber (reg:SI 7))
9219 (clobber (reg:SI 8))
9220 (clobber (reg:SI 9))
9221 (clobber (reg:SI 10))
9222 (clobber (match_scratch:SI 5 "=X"))]
9224 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
9225 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
9226 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
9227 && REGNO (operands[4]) == 5"
9228 "lswi %4,%1,%2\;stswi %4,%0,%2"
9229 [(set_attr "type" "store_ux")
9230 (set_attr "cell_micro" "always")
9231 (set_attr "length" "8")])
9233 ;; Move up to 16 bytes at a time, using 4 fixed registers to avoid spill
9234 ;; problems with TImode.
9235 ;; rD/rS = r5 is preferred, efficient form.
9236 (define_expand "movmemsi_4reg"
9237 [(parallel [(set (match_operand 0 "" "")
9238 (match_operand 1 "" ""))
9239 (use (match_operand 2 "" ""))
9240 (use (match_operand 3 "" ""))
9241 (clobber (reg:SI 5))
9242 (clobber (reg:SI 6))
9243 (clobber (reg:SI 7))
9244 (clobber (reg:SI 8))
9245 (clobber (match_scratch:SI 4 ""))])]
9250 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
9251 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
9252 (use (match_operand:SI 2 "immediate_operand" "i"))
9253 (use (match_operand:SI 3 "immediate_operand" "i"))
9254 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
9255 (clobber (reg:SI 6))
9256 (clobber (reg:SI 7))
9257 (clobber (reg:SI 8))
9258 (clobber (match_scratch:SI 5 "=X"))]
9260 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
9261 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
9262 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
9263 && REGNO (operands[4]) == 5"
9264 "lswi %4,%1,%2\;stswi %4,%0,%2"
9265 [(set_attr "type" "store_ux")
9266 (set_attr "cell_micro" "always")
9267 (set_attr "length" "8")])
9269 ;; Move up to 8 bytes at a time.
9270 (define_expand "movmemsi_2reg"
9271 [(parallel [(set (match_operand 0 "" "")
9272 (match_operand 1 "" ""))
9273 (use (match_operand 2 "" ""))
9274 (use (match_operand 3 "" ""))
9275 (clobber (match_scratch:DI 4 ""))
9276 (clobber (match_scratch:SI 5 ""))])]
9277 "TARGET_STRING && ! TARGET_POWERPC64"
9281 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9282 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9283 (use (match_operand:SI 2 "immediate_operand" "i"))
9284 (use (match_operand:SI 3 "immediate_operand" "i"))
9285 (clobber (match_scratch:DI 4 "=&r"))
9286 (clobber (match_scratch:SI 5 "=X"))]
9287 "TARGET_STRING && ! TARGET_POWERPC64
9288 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
9289 "lswi %4,%1,%2\;stswi %4,%0,%2"
9290 [(set_attr "type" "store_ux")
9291 (set_attr "cell_micro" "always")
9292 (set_attr "length" "8")])
9294 ;; Move up to 4 bytes at a time.
9295 (define_expand "movmemsi_1reg"
9296 [(parallel [(set (match_operand 0 "" "")
9297 (match_operand 1 "" ""))
9298 (use (match_operand 2 "" ""))
9299 (use (match_operand 3 "" ""))
9300 (clobber (match_scratch:SI 4 ""))
9301 (clobber (match_scratch:SI 5 ""))])]
9306 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
9307 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
9308 (use (match_operand:SI 2 "immediate_operand" "i"))
9309 (use (match_operand:SI 3 "immediate_operand" "i"))
9310 (clobber (match_scratch:SI 4 "=&r"))
9311 (clobber (match_scratch:SI 5 "=X"))]
9312 "TARGET_STRING && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
9313 "lswi %4,%1,%2\;stswi %4,%0,%2"
9314 [(set_attr "type" "store_ux")
9315 (set_attr "cell_micro" "always")
9316 (set_attr "length" "8")])
9318 ;; Define insns that do load or store with update. Some of these we can
9319 ;; get by using pre-decrement or pre-increment, but the hardware can also
9320 ;; do cases where the increment is not the size of the object.
9322 ;; In all these cases, we use operands 0 and 1 for the register being
9323 ;; incremented because those are the operands that local-alloc will
9324 ;; tie and these are the pair most likely to be tieable (and the ones
9325 ;; that will benefit the most).
9327 (define_insn "*movdi_update1"
9328 [(set (match_operand:DI 3 "gpc_reg_operand" "=r,r")
9329 (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
9330 (match_operand:DI 2 "reg_or_aligned_short_operand" "r,I"))))
9331 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
9332 (plus:DI (match_dup 1) (match_dup 2)))]
9333 "TARGET_POWERPC64 && TARGET_UPDATE
9334 && (!avoiding_indexed_address_p (DImode)
9335 || !gpc_reg_operand (operands[2], DImode))"
9339 [(set_attr "type" "load_ux,load_u")])
9341 (define_insn "movdi_<mode>_update"
9342 [(set (mem:DI (plus:P (match_operand:P 1 "gpc_reg_operand" "0,0")
9343 (match_operand:P 2 "reg_or_aligned_short_operand" "r,I")))
9344 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
9345 (set (match_operand:P 0 "gpc_reg_operand" "=b,b")
9346 (plus:P (match_dup 1) (match_dup 2)))]
9347 "TARGET_POWERPC64 && TARGET_UPDATE
9348 && (!avoiding_indexed_address_p (Pmode)
9349 || !gpc_reg_operand (operands[2], Pmode)
9350 || (REG_P (operands[0])
9351 && REGNO (operands[0]) == STACK_POINTER_REGNUM))"
9355 [(set_attr "type" "store_ux,store_u")])
9357 ;; This pattern is only conditional on TARGET_POWERPC64, as it is
9358 ;; needed for stack allocation, even if the user passes -mno-update.
9359 (define_insn "movdi_<mode>_update_stack"
9360 [(set (mem:DI (plus:P (match_operand:P 1 "gpc_reg_operand" "0,0")
9361 (match_operand:P 2 "reg_or_aligned_short_operand" "r,I")))
9362 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
9363 (set (match_operand:P 0 "gpc_reg_operand" "=b,b")
9364 (plus:P (match_dup 1) (match_dup 2)))]
9369 [(set_attr "type" "store_ux,store_u")])
9371 (define_insn "*movsi_update1"
9372 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9373 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9374 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9375 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9376 (plus:SI (match_dup 1) (match_dup 2)))]
9378 && (!avoiding_indexed_address_p (SImode)
9379 || !gpc_reg_operand (operands[2], SImode))"
9383 [(set_attr "type" "load_ux,load_u")])
9385 (define_insn "*movsi_update2"
9386 [(set (match_operand:DI 3 "gpc_reg_operand" "=r")
9388 (mem:SI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0")
9389 (match_operand:DI 2 "gpc_reg_operand" "r")))))
9390 (set (match_operand:DI 0 "gpc_reg_operand" "=b")
9391 (plus:DI (match_dup 1) (match_dup 2)))]
9392 "TARGET_POWERPC64 && rs6000_gen_cell_microcode
9393 && !avoiding_indexed_address_p (DImode)"
9395 [(set_attr "type" "load_ext_ux")])
9397 (define_insn "movsi_update"
9398 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9399 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9400 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
9401 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9402 (plus:SI (match_dup 1) (match_dup 2)))]
9404 && (!avoiding_indexed_address_p (SImode)
9405 || !gpc_reg_operand (operands[2], SImode)
9406 || (REG_P (operands[0])
9407 && REGNO (operands[0]) == STACK_POINTER_REGNUM))"
9411 [(set_attr "type" "store_ux,store_u")])
9413 ;; This is an unconditional pattern; needed for stack allocation, even
9414 ;; if the user passes -mno-update.
9415 (define_insn "movsi_update_stack"
9416 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9417 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9418 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
9419 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9420 (plus:SI (match_dup 1) (match_dup 2)))]
9425 [(set_attr "type" "store_ux,store_u")])
9427 (define_insn "*movhi_update1"
9428 [(set (match_operand:HI 3 "gpc_reg_operand" "=r,r")
9429 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9430 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9431 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9432 (plus:SI (match_dup 1) (match_dup 2)))]
9434 && (!avoiding_indexed_address_p (SImode)
9435 || !gpc_reg_operand (operands[2], SImode))"
9439 [(set_attr "type" "load_ux,load_u")])
9441 (define_insn "*movhi_update2"
9442 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9444 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9445 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9446 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9447 (plus:SI (match_dup 1) (match_dup 2)))]
9449 && (!avoiding_indexed_address_p (SImode)
9450 || !gpc_reg_operand (operands[2], SImode))"
9454 [(set_attr "type" "load_ux,load_u")])
9456 (define_insn "*movhi_update3"
9457 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9459 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9460 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9461 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9462 (plus:SI (match_dup 1) (match_dup 2)))]
9463 "TARGET_UPDATE && rs6000_gen_cell_microcode
9464 && (!avoiding_indexed_address_p (SImode)
9465 || !gpc_reg_operand (operands[2], SImode))"
9469 [(set_attr "type" "load_ext_ux,load_ext_u")])
9471 (define_insn "*movhi_update4"
9472 [(set (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9473 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9474 (match_operand:HI 3 "gpc_reg_operand" "r,r"))
9475 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9476 (plus:SI (match_dup 1) (match_dup 2)))]
9478 && (!avoiding_indexed_address_p (SImode)
9479 || !gpc_reg_operand (operands[2], SImode))"
9483 [(set_attr "type" "store_ux,store_u")])
9485 (define_insn "*movqi_update1"
9486 [(set (match_operand:QI 3 "gpc_reg_operand" "=r,r")
9487 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9488 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9489 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9490 (plus:SI (match_dup 1) (match_dup 2)))]
9492 && (!avoiding_indexed_address_p (SImode)
9493 || !gpc_reg_operand (operands[2], SImode))"
9497 [(set_attr "type" "load_ux,load_u")])
9499 (define_insn "*movqi_update2"
9500 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9502 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9503 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9504 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9505 (plus:SI (match_dup 1) (match_dup 2)))]
9507 && (!avoiding_indexed_address_p (SImode)
9508 || !gpc_reg_operand (operands[2], SImode))"
9512 [(set_attr "type" "load_ux,load_u")])
9514 (define_insn "*movqi_update3"
9515 [(set (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9516 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9517 (match_operand:QI 3 "gpc_reg_operand" "r,r"))
9518 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9519 (plus:SI (match_dup 1) (match_dup 2)))]
9521 && (!avoiding_indexed_address_p (SImode)
9522 || !gpc_reg_operand (operands[2], SImode))"
9526 [(set_attr "type" "store_ux,store_u")])
9528 (define_insn "*movsf_update1"
9529 [(set (match_operand:SF 3 "gpc_reg_operand" "=f,f")
9530 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9531 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9532 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9533 (plus:SI (match_dup 1) (match_dup 2)))]
9534 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT && TARGET_UPDATE
9535 && (!avoiding_indexed_address_p (SImode)
9536 || !gpc_reg_operand (operands[2], SImode))"
9540 [(set_attr "type" "fpload_ux,fpload_u")])
9542 (define_insn "*movsf_update2"
9543 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9544 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9545 (match_operand:SF 3 "gpc_reg_operand" "f,f"))
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_SINGLE_FLOAT && TARGET_UPDATE
9549 && (!avoiding_indexed_address_p (SImode)
9550 || !gpc_reg_operand (operands[2], SImode))"
9554 [(set_attr "type" "fpstore_ux,fpstore_u")])
9556 (define_insn "*movsf_update3"
9557 [(set (match_operand:SF 3 "gpc_reg_operand" "=r,r")
9558 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9559 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9560 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9561 (plus:SI (match_dup 1) (match_dup 2)))]
9562 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE
9563 && (!avoiding_indexed_address_p (SImode)
9564 || !gpc_reg_operand (operands[2], SImode))"
9568 [(set_attr "type" "load_ux,load_u")])
9570 (define_insn "*movsf_update4"
9571 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9572 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9573 (match_operand:SF 3 "gpc_reg_operand" "r,r"))
9574 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9575 (plus:SI (match_dup 1) (match_dup 2)))]
9576 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE
9577 && (!avoiding_indexed_address_p (SImode)
9578 || !gpc_reg_operand (operands[2], SImode))"
9582 [(set_attr "type" "store_ux,store_u")])
9584 (define_insn "*movdf_update1"
9585 [(set (match_operand:DF 3 "gpc_reg_operand" "=d,d")
9586 (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9587 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9588 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9589 (plus:SI (match_dup 1) (match_dup 2)))]
9590 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_UPDATE
9591 && (!avoiding_indexed_address_p (SImode)
9592 || !gpc_reg_operand (operands[2], SImode))"
9596 [(set_attr "type" "fpload_ux,fpload_u")])
9598 (define_insn "*movdf_update2"
9599 [(set (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9600 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9601 (match_operand:DF 3 "gpc_reg_operand" "d,d"))
9602 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9603 (plus:SI (match_dup 1) (match_dup 2)))]
9604 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_UPDATE
9605 && (!avoiding_indexed_address_p (SImode)
9606 || !gpc_reg_operand (operands[2], SImode))"
9610 [(set_attr "type" "fpstore_ux,fpstore_u")])
9613 ;; After inserting conditional returns we can sometimes have
9614 ;; unnecessary register moves. Unfortunately we cannot have a
9615 ;; modeless peephole here, because some single SImode sets have early
9616 ;; clobber outputs. Although those sets expand to multi-ppc-insn
9617 ;; sequences, using get_attr_length here will smash the operands
9618 ;; array. Neither is there an early_cobbler_p predicate.
9619 ;; Disallow subregs for E500 so we don't munge frob_di_df_2.
9621 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9622 (match_operand:DF 1 "any_operand" ""))
9623 (set (match_operand:DF 2 "gpc_reg_operand" "")
9625 "!(TARGET_E500_DOUBLE && GET_CODE (operands[2]) == SUBREG)
9626 && peep2_reg_dead_p (2, operands[0])"
9627 [(set (match_dup 2) (match_dup 1))])
9630 [(set (match_operand:SF 0 "gpc_reg_operand" "")
9631 (match_operand:SF 1 "any_operand" ""))
9632 (set (match_operand:SF 2 "gpc_reg_operand" "")
9634 "peep2_reg_dead_p (2, operands[0])"
9635 [(set (match_dup 2) (match_dup 1))])
9640 ;; Mode attributes for different ABIs.
9641 (define_mode_iterator TLSmode [(SI "! TARGET_64BIT") (DI "TARGET_64BIT")])
9642 (define_mode_attr tls_abi_suffix [(SI "32") (DI "64")])
9643 (define_mode_attr tls_sysv_suffix [(SI "si") (DI "di")])
9644 (define_mode_attr tls_insn_suffix [(SI "wz") (DI "d")])
9646 (define_insn_and_split "tls_gd_aix<TLSmode:tls_abi_suffix>"
9647 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
9648 (call (mem:TLSmode (match_operand:TLSmode 3 "symbol_ref_operand" "s"))
9649 (match_operand 4 "" "g")))
9650 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
9651 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
9653 (clobber (reg:SI LR_REGNO))]
9654 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX"
9656 if (TARGET_CMODEL != CMODEL_SMALL)
9657 return "addis %0,%1,%2@got@tlsgd@ha\;addi %0,%0,%2@got@tlsgd@l\;"
9660 return "addi %0,%1,%2@got@tlsgd\;bl %z3\;nop";
9662 "&& TARGET_TLS_MARKERS"
9664 (unspec:TLSmode [(match_dup 1)
9667 (parallel [(set (match_dup 0)
9668 (call (mem:TLSmode (match_dup 3))
9670 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD)
9671 (clobber (reg:SI LR_REGNO))])]
9673 [(set_attr "type" "two")
9674 (set (attr "length")
9675 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
9679 (define_insn_and_split "tls_gd_sysv<TLSmode:tls_sysv_suffix>"
9680 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
9681 (call (mem:TLSmode (match_operand:TLSmode 3 "symbol_ref_operand" "s"))
9682 (match_operand 4 "" "g")))
9683 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
9684 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
9686 (clobber (reg:SI LR_REGNO))]
9687 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4"
9691 if (TARGET_SECURE_PLT && flag_pic == 2)
9692 return "addi %0,%1,%2@got@tlsgd\;bl %z3+32768@plt";
9694 return "addi %0,%1,%2@got@tlsgd\;bl %z3@plt";
9697 return "addi %0,%1,%2@got@tlsgd\;bl %z3";
9699 "&& TARGET_TLS_MARKERS"
9701 (unspec:TLSmode [(match_dup 1)
9704 (parallel [(set (match_dup 0)
9705 (call (mem:TLSmode (match_dup 3))
9707 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD)
9708 (clobber (reg:SI LR_REGNO))])]
9710 [(set_attr "type" "two")
9711 (set_attr "length" "8")])
9713 (define_insn_and_split "*tls_gd<TLSmode:tls_abi_suffix>"
9714 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
9715 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
9716 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
9718 "HAVE_AS_TLS && TARGET_TLS_MARKERS"
9719 "addi %0,%1,%2@got@tlsgd"
9720 "&& TARGET_CMODEL != CMODEL_SMALL"
9723 (unspec:TLSmode [(match_dup 1) (match_dup 2)] UNSPEC_TLSGD)))
9725 (lo_sum:TLSmode (match_dup 3)
9726 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD)))]
9729 operands[3] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
9731 [(set (attr "length")
9732 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
9736 (define_insn "*tls_gd_high<TLSmode:tls_abi_suffix>"
9737 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
9739 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
9740 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
9742 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
9743 "addis %0,%1,%2@got@tlsgd@ha"
9744 [(set_attr "length" "4")])
9746 (define_insn "*tls_gd_low<TLSmode:tls_abi_suffix>"
9747 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
9748 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
9749 (unspec:TLSmode [(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
9751 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
9752 "addi %0,%1,%2@got@tlsgd@l"
9753 [(set_attr "length" "4")])
9755 (define_insn "*tls_gd_call_aix<TLSmode:tls_abi_suffix>"
9756 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
9757 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
9758 (match_operand 2 "" "g")))
9759 (unspec:TLSmode [(match_operand:TLSmode 3 "rs6000_tls_symbol_ref" "")]
9761 (clobber (reg:SI LR_REGNO))]
9762 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX && TARGET_TLS_MARKERS"
9763 "bl %z1(%3@tlsgd)\;nop"
9764 [(set_attr "type" "branch")
9765 (set_attr "length" "8")])
9767 (define_insn "*tls_gd_call_sysv<TLSmode:tls_abi_suffix>"
9768 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
9769 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
9770 (match_operand 2 "" "g")))
9771 (unspec:TLSmode [(match_operand:TLSmode 3 "rs6000_tls_symbol_ref" "")]
9773 (clobber (reg:SI LR_REGNO))]
9774 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4 && TARGET_TLS_MARKERS"
9778 if (TARGET_SECURE_PLT && flag_pic == 2)
9779 return "bl %z1+32768(%3@tlsgd)@plt";
9780 return "bl %z1(%3@tlsgd)@plt";
9782 return "bl %z1(%3@tlsgd)";
9784 [(set_attr "type" "branch")
9785 (set_attr "length" "4")])
9787 (define_insn_and_split "tls_ld_aix<TLSmode:tls_abi_suffix>"
9788 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
9789 (call (mem:TLSmode (match_operand:TLSmode 2 "symbol_ref_operand" "s"))
9790 (match_operand 3 "" "g")))
9791 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
9793 (clobber (reg:SI LR_REGNO))]
9794 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX"
9796 if (TARGET_CMODEL != CMODEL_SMALL)
9797 return "addis %0,%1,%&@got@tlsld@ha\;addi %0,%0,%&@got@tlsld@l\;"
9800 return "addi %0,%1,%&@got@tlsld\;bl %z2\;nop";
9802 "&& TARGET_TLS_MARKERS"
9804 (unspec:TLSmode [(match_dup 1)]
9806 (parallel [(set (match_dup 0)
9807 (call (mem:TLSmode (match_dup 2))
9809 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
9810 (clobber (reg:SI LR_REGNO))])]
9812 [(set_attr "type" "two")
9813 (set (attr "length")
9814 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
9818 (define_insn_and_split "tls_ld_sysv<TLSmode:tls_sysv_suffix>"
9819 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
9820 (call (mem:TLSmode (match_operand:TLSmode 2 "symbol_ref_operand" "s"))
9821 (match_operand 3 "" "g")))
9822 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
9824 (clobber (reg:SI LR_REGNO))]
9825 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4"
9829 if (TARGET_SECURE_PLT && flag_pic == 2)
9830 return "addi %0,%1,%&@got@tlsld\;bl %z2+32768@plt";
9832 return "addi %0,%1,%&@got@tlsld\;bl %z2@plt";
9835 return "addi %0,%1,%&@got@tlsld\;bl %z2";
9837 "&& TARGET_TLS_MARKERS"
9839 (unspec:TLSmode [(match_dup 1)]
9841 (parallel [(set (match_dup 0)
9842 (call (mem:TLSmode (match_dup 2))
9844 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
9845 (clobber (reg:SI LR_REGNO))])]
9847 [(set_attr "length" "8")])
9849 (define_insn_and_split "*tls_ld<TLSmode:tls_abi_suffix>"
9850 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
9851 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
9853 "HAVE_AS_TLS && TARGET_TLS_MARKERS"
9854 "addi %0,%1,%&@got@tlsld"
9855 "&& TARGET_CMODEL != CMODEL_SMALL"
9858 (unspec:TLSmode [(const_int 0) (match_dup 1)] UNSPEC_TLSLD)))
9860 (lo_sum:TLSmode (match_dup 2)
9861 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)))]
9864 operands[2] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
9866 [(set (attr "length")
9867 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
9871 (define_insn "*tls_ld_high<TLSmode:tls_abi_suffix>"
9872 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
9874 (unspec:TLSmode [(const_int 0)
9875 (match_operand:TLSmode 1 "gpc_reg_operand" "b")]
9877 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
9878 "addis %0,%1,%&@got@tlsld@ha"
9879 [(set_attr "length" "4")])
9881 (define_insn "*tls_ld_low<TLSmode:tls_abi_suffix>"
9882 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
9883 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
9884 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)))]
9885 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
9886 "addi %0,%1,%&@got@tlsld@l"
9887 [(set_attr "length" "4")])
9889 (define_insn "*tls_ld_call_aix<TLSmode:tls_abi_suffix>"
9890 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
9891 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
9892 (match_operand 2 "" "g")))
9893 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
9894 (clobber (reg:SI LR_REGNO))]
9895 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX && TARGET_TLS_MARKERS"
9896 "bl %z1(%&@tlsld)\;nop"
9897 [(set_attr "type" "branch")
9898 (set_attr "length" "8")])
9900 (define_insn "*tls_ld_call_sysv<TLSmode:tls_abi_suffix>"
9901 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
9902 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
9903 (match_operand 2 "" "g")))
9904 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
9905 (clobber (reg:SI LR_REGNO))]
9906 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4 && TARGET_TLS_MARKERS"
9910 if (TARGET_SECURE_PLT && flag_pic == 2)
9911 return "bl %z1+32768(%&@tlsld)@plt";
9912 return "bl %z1(%&@tlsld)@plt";
9914 return "bl %z1(%&@tlsld)";
9916 [(set_attr "type" "branch")
9917 (set_attr "length" "4")])
9919 (define_insn "tls_dtprel_<TLSmode:tls_abi_suffix>"
9920 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
9921 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
9922 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
9925 "addi %0,%1,%2@dtprel")
9927 (define_insn "tls_dtprel_ha_<TLSmode:tls_abi_suffix>"
9928 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
9929 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
9930 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
9931 UNSPEC_TLSDTPRELHA))]
9933 "addis %0,%1,%2@dtprel@ha")
9935 (define_insn "tls_dtprel_lo_<TLSmode:tls_abi_suffix>"
9936 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
9937 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
9938 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
9939 UNSPEC_TLSDTPRELLO))]
9941 "addi %0,%1,%2@dtprel@l")
9943 (define_insn_and_split "tls_got_dtprel_<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" "")]
9947 UNSPEC_TLSGOTDTPREL))]
9949 "l<TLSmode:tls_insn_suffix> %0,%2@got@dtprel(%1)"
9950 "&& TARGET_CMODEL != CMODEL_SMALL"
9953 (unspec:TLSmode [(match_dup 1) (match_dup 2)] UNSPEC_TLSGOTDTPREL)))
9955 (lo_sum:TLSmode (match_dup 3)
9956 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGOTDTPREL)))]
9959 operands[3] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
9961 [(set (attr "length")
9962 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
9966 (define_insn "*tls_got_dtprel_high<TLSmode:tls_abi_suffix>"
9967 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
9969 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
9970 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
9971 UNSPEC_TLSGOTDTPREL)))]
9972 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
9973 "addis %0,%1,%2@got@dtprel@ha"
9974 [(set_attr "length" "4")])
9976 (define_insn "*tls_got_dtprel_low<TLSmode:tls_abi_suffix>"
9977 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
9978 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
9979 (unspec:TLSmode [(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
9980 UNSPEC_TLSGOTDTPREL)))]
9981 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
9982 "l<TLSmode:tls_insn_suffix> %0,%2@got@dtprel@l(%1)"
9983 [(set_attr "length" "4")])
9985 (define_insn "tls_tprel_<TLSmode:tls_abi_suffix>"
9986 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
9987 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
9988 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
9991 "addi %0,%1,%2@tprel")
9993 (define_insn "tls_tprel_ha_<TLSmode:tls_abi_suffix>"
9994 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
9995 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
9996 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
9997 UNSPEC_TLSTPRELHA))]
9999 "addis %0,%1,%2@tprel@ha")
10001 (define_insn "tls_tprel_lo_<TLSmode:tls_abi_suffix>"
10002 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
10003 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10004 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10005 UNSPEC_TLSTPRELLO))]
10007 "addi %0,%1,%2@tprel@l")
10009 ;; "b" output constraint here and on tls_tls input to support linker tls
10010 ;; optimization. The linker may edit the instructions emitted by a
10011 ;; tls_got_tprel/tls_tls pair to addis,addi.
10012 (define_insn_and_split "tls_got_tprel_<TLSmode:tls_abi_suffix>"
10013 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10014 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10015 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10016 UNSPEC_TLSGOTTPREL))]
10018 "l<TLSmode:tls_insn_suffix> %0,%2@got@tprel(%1)"
10019 "&& TARGET_CMODEL != CMODEL_SMALL"
10020 [(set (match_dup 3)
10022 (unspec:TLSmode [(match_dup 1) (match_dup 2)] UNSPEC_TLSGOTTPREL)))
10024 (lo_sum:TLSmode (match_dup 3)
10025 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGOTTPREL)))]
10028 operands[3] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
10030 [(set (attr "length")
10031 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
10035 (define_insn "*tls_got_tprel_high<TLSmode:tls_abi_suffix>"
10036 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10038 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10039 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10040 UNSPEC_TLSGOTTPREL)))]
10041 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
10042 "addis %0,%1,%2@got@tprel@ha"
10043 [(set_attr "length" "4")])
10045 (define_insn "*tls_got_tprel_low<TLSmode:tls_abi_suffix>"
10046 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
10047 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
10048 (unspec:TLSmode [(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10049 UNSPEC_TLSGOTTPREL)))]
10050 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
10051 "l<TLSmode:tls_insn_suffix> %0,%2@got@tprel@l(%1)"
10052 [(set_attr "length" "4")])
10054 (define_insn "tls_tls_<TLSmode:tls_abi_suffix>"
10055 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
10056 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10057 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10059 "TARGET_ELF && HAVE_AS_TLS"
10060 "add %0,%1,%2@tls")
10062 (define_expand "tls_get_tpointer"
10063 [(set (match_operand:SI 0 "gpc_reg_operand" "")
10064 (unspec:SI [(const_int 0)] UNSPEC_TLSTLS))]
10065 "TARGET_XCOFF && HAVE_AS_TLS"
10068 emit_insn (gen_tls_get_tpointer_internal ());
10069 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
10073 (define_insn "tls_get_tpointer_internal"
10075 (unspec:SI [(const_int 0)] UNSPEC_TLSTLS))
10076 (clobber (reg:SI LR_REGNO))]
10077 "TARGET_XCOFF && HAVE_AS_TLS"
10078 "bla __get_tpointer")
10080 (define_expand "tls_get_addr<mode>"
10081 [(set (match_operand:P 0 "gpc_reg_operand" "")
10082 (unspec:P [(match_operand:P 1 "gpc_reg_operand" "")
10083 (match_operand:P 2 "gpc_reg_operand" "")] UNSPEC_TLSTLS))]
10084 "TARGET_XCOFF && HAVE_AS_TLS"
10087 emit_move_insn (gen_rtx_REG (Pmode, 3), operands[1]);
10088 emit_move_insn (gen_rtx_REG (Pmode, 4), operands[2]);
10089 emit_insn (gen_tls_get_addr_internal<mode> ());
10090 emit_move_insn (operands[0], gen_rtx_REG (Pmode, 3));
10094 (define_insn "tls_get_addr_internal<mode>"
10096 (unspec:P [(reg:P 3) (reg:P 4)] UNSPEC_TLSTLS))
10097 (clobber (reg:P 0))
10098 (clobber (reg:P 4))
10099 (clobber (reg:P 5))
10100 (clobber (reg:P 11))
10101 (clobber (reg:CC CR0_REGNO))
10102 (clobber (reg:P LR_REGNO))]
10103 "TARGET_XCOFF && HAVE_AS_TLS"
10104 "bla __tls_get_addr")
10106 ;; Next come insns related to the calling sequence.
10108 ;; First, an insn to allocate new stack space for dynamic use (e.g., alloca).
10109 ;; We move the back-chain and decrement the stack pointer.
10111 (define_expand "allocate_stack"
10112 [(set (match_operand 0 "gpc_reg_operand" "")
10113 (minus (reg 1) (match_operand 1 "reg_or_short_operand" "")))
10115 (minus (reg 1) (match_dup 1)))]
10118 { rtx chain = gen_reg_rtx (Pmode);
10119 rtx stack_bot = gen_rtx_MEM (Pmode, stack_pointer_rtx);
10121 rtx insn, par, set, mem;
10123 emit_move_insn (chain, stack_bot);
10125 /* Check stack bounds if necessary. */
10126 if (crtl->limit_stack)
10129 available = expand_binop (Pmode, sub_optab,
10130 stack_pointer_rtx, stack_limit_rtx,
10131 NULL_RTX, 1, OPTAB_WIDEN);
10132 emit_insn (gen_cond_trap (LTU, available, operands[1], const0_rtx));
10135 if (GET_CODE (operands[1]) != CONST_INT
10136 || INTVAL (operands[1]) < -32767
10137 || INTVAL (operands[1]) > 32768)
10139 neg_op0 = gen_reg_rtx (Pmode);
10141 emit_insn (gen_negsi2 (neg_op0, operands[1]));
10143 emit_insn (gen_negdi2 (neg_op0, operands[1]));
10146 neg_op0 = GEN_INT (- INTVAL (operands[1]));
10148 insn = emit_insn ((* ((TARGET_32BIT) ? gen_movsi_update_stack
10149 : gen_movdi_di_update_stack))
10150 (stack_pointer_rtx, stack_pointer_rtx, neg_op0,
10152 /* Since we didn't use gen_frame_mem to generate the MEM, grab
10153 it now and set the alias set/attributes. The above gen_*_update
10154 calls will generate a PARALLEL with the MEM set being the first
10156 par = PATTERN (insn);
10157 gcc_assert (GET_CODE (par) == PARALLEL);
10158 set = XVECEXP (par, 0, 0);
10159 gcc_assert (GET_CODE (set) == SET);
10160 mem = SET_DEST (set);
10161 gcc_assert (MEM_P (mem));
10162 MEM_NOTRAP_P (mem) = 1;
10163 set_mem_alias_set (mem, get_frame_alias_set ());
10165 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
10169 ;; These patterns say how to save and restore the stack pointer. We need not
10170 ;; save the stack pointer at function level since we are careful to
10171 ;; preserve the backchain. At block level, we have to restore the backchain
10172 ;; when we restore the stack pointer.
10174 ;; For nonlocal gotos, we must save both the stack pointer and its
10175 ;; backchain and restore both. Note that in the nonlocal case, the
10176 ;; save area is a memory location.
10178 (define_expand "save_stack_function"
10179 [(match_operand 0 "any_operand" "")
10180 (match_operand 1 "any_operand" "")]
10184 (define_expand "restore_stack_function"
10185 [(match_operand 0 "any_operand" "")
10186 (match_operand 1 "any_operand" "")]
10190 ;; Adjust stack pointer (op0) to a new value (op1).
10191 ;; First copy old stack backchain to new location, and ensure that the
10192 ;; scheduler won't reorder the sp assignment before the backchain write.
10193 (define_expand "restore_stack_block"
10194 [(set (match_dup 2) (match_dup 3))
10195 (set (match_dup 4) (match_dup 2))
10197 (set (match_operand 0 "register_operand" "")
10198 (match_operand 1 "register_operand" ""))]
10204 operands[1] = force_reg (Pmode, operands[1]);
10205 operands[2] = gen_reg_rtx (Pmode);
10206 operands[3] = gen_frame_mem (Pmode, operands[0]);
10207 operands[4] = gen_frame_mem (Pmode, operands[1]);
10208 p = rtvec_alloc (1);
10209 RTVEC_ELT (p, 0) = gen_rtx_SET (VOIDmode,
10210 gen_frame_mem (BLKmode, operands[0]),
10212 operands[5] = gen_rtx_PARALLEL (VOIDmode, p);
10215 (define_expand "save_stack_nonlocal"
10216 [(set (match_dup 3) (match_dup 4))
10217 (set (match_operand 0 "memory_operand" "") (match_dup 3))
10218 (set (match_dup 2) (match_operand 1 "register_operand" ""))]
10222 int units_per_word = (TARGET_32BIT) ? 4 : 8;
10224 /* Copy the backchain to the first word, sp to the second. */
10225 operands[0] = adjust_address_nv (operands[0], Pmode, 0);
10226 operands[2] = adjust_address_nv (operands[0], Pmode, units_per_word);
10227 operands[3] = gen_reg_rtx (Pmode);
10228 operands[4] = gen_frame_mem (Pmode, operands[1]);
10231 (define_expand "restore_stack_nonlocal"
10232 [(set (match_dup 2) (match_operand 1 "memory_operand" ""))
10233 (set (match_dup 3) (match_dup 4))
10234 (set (match_dup 5) (match_dup 2))
10236 (set (match_operand 0 "register_operand" "") (match_dup 3))]
10240 int units_per_word = (TARGET_32BIT) ? 4 : 8;
10243 /* Restore the backchain from the first word, sp from the second. */
10244 operands[2] = gen_reg_rtx (Pmode);
10245 operands[3] = gen_reg_rtx (Pmode);
10246 operands[1] = adjust_address_nv (operands[1], Pmode, 0);
10247 operands[4] = adjust_address_nv (operands[1], Pmode, units_per_word);
10248 operands[5] = gen_frame_mem (Pmode, operands[3]);
10249 p = rtvec_alloc (1);
10250 RTVEC_ELT (p, 0) = gen_rtx_SET (VOIDmode,
10251 gen_frame_mem (BLKmode, operands[0]),
10253 operands[6] = gen_rtx_PARALLEL (VOIDmode, p);
10256 ;; TOC register handling.
10258 ;; Code to initialize the TOC register...
10260 (define_insn "load_toc_aix_si"
10261 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10262 (unspec:SI [(const_int 0)] UNSPEC_TOC))
10263 (use (reg:SI 2))])]
10264 "DEFAULT_ABI == ABI_AIX && TARGET_32BIT"
10268 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
10269 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
10270 operands[2] = gen_rtx_REG (Pmode, 2);
10271 return \"lwz %0,%1(%2)\";
10273 [(set_attr "type" "load")])
10275 (define_insn "load_toc_aix_di"
10276 [(parallel [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10277 (unspec:DI [(const_int 0)] UNSPEC_TOC))
10278 (use (reg:DI 2))])]
10279 "DEFAULT_ABI == ABI_AIX && TARGET_64BIT"
10283 #ifdef TARGET_RELOCATABLE
10284 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\",
10285 !TARGET_MINIMAL_TOC || TARGET_RELOCATABLE);
10287 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
10290 strcat (buf, \"@toc\");
10291 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
10292 operands[2] = gen_rtx_REG (Pmode, 2);
10293 return \"ld %0,%1(%2)\";
10295 [(set_attr "type" "load")])
10297 (define_insn "load_toc_v4_pic_si"
10298 [(set (reg:SI LR_REGNO)
10299 (unspec:SI [(const_int 0)] UNSPEC_TOC))]
10300 "DEFAULT_ABI == ABI_V4 && flag_pic == 1 && TARGET_32BIT"
10301 "bl _GLOBAL_OFFSET_TABLE_@local-4"
10302 [(set_attr "type" "branch")
10303 (set_attr "length" "4")])
10305 (define_expand "load_toc_v4_PIC_1"
10306 [(parallel [(set (reg:SI LR_REGNO)
10307 (match_operand:SI 0 "immediate_operand" "s"))
10308 (use (unspec [(match_dup 0)] UNSPEC_TOC))])]
10309 "TARGET_ELF && DEFAULT_ABI != ABI_AIX
10310 && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
10313 (define_insn "load_toc_v4_PIC_1_normal"
10314 [(set (reg:SI LR_REGNO)
10315 (match_operand:SI 0 "immediate_operand" "s"))
10316 (use (unspec [(match_dup 0)] UNSPEC_TOC))]
10317 "!TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI != ABI_AIX
10318 && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
10319 "bcl 20,31,%0\\n%0:"
10320 [(set_attr "type" "branch")
10321 (set_attr "length" "4")])
10323 (define_insn "load_toc_v4_PIC_1_476"
10324 [(set (reg:SI LR_REGNO)
10325 (match_operand:SI 0 "immediate_operand" "s"))
10326 (use (unspec [(match_dup 0)] UNSPEC_TOC))]
10327 "TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI != ABI_AIX
10328 && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
10332 static char templ[32];
10334 get_ppc476_thunk_name (name);
10335 sprintf (templ, \"bl %s\\n%%0:\", name);
10338 [(set_attr "type" "branch")
10339 (set_attr "length" "4")])
10341 (define_expand "load_toc_v4_PIC_1b"
10342 [(parallel [(set (reg:SI LR_REGNO)
10343 (unspec:SI [(match_operand:SI 0 "immediate_operand" "s")
10344 (label_ref (match_operand 1 "" ""))]
10347 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
10350 (define_insn "load_toc_v4_PIC_1b_normal"
10351 [(set (reg:SI LR_REGNO)
10352 (unspec:SI [(match_operand:SI 0 "immediate_operand" "s")
10353 (label_ref (match_operand 1 "" ""))]
10356 "!TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
10357 "bcl 20,31,$+8\;.long %0-$"
10358 [(set_attr "type" "branch")
10359 (set_attr "length" "8")])
10361 (define_insn "load_toc_v4_PIC_1b_476"
10362 [(set (reg:SI LR_REGNO)
10363 (unspec:SI [(match_operand:SI 0 "immediate_operand" "s")
10364 (label_ref (match_operand 1 "" ""))]
10367 "TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
10371 static char templ[32];
10373 get_ppc476_thunk_name (name);
10374 sprintf (templ, \"bl %s\\n\\tb $+8\\n\\t.long %%0-$\", name);
10377 [(set_attr "type" "branch")
10378 (set_attr "length" "16")])
10380 (define_insn "load_toc_v4_PIC_2"
10381 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10382 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
10383 (minus:SI (match_operand:SI 2 "immediate_operand" "s")
10384 (match_operand:SI 3 "immediate_operand" "s")))))]
10385 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
10387 [(set_attr "type" "load")])
10389 (define_insn "load_toc_v4_PIC_3b"
10390 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10391 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
10393 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
10394 (match_operand:SI 3 "symbol_ref_operand" "s")))))]
10395 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
10396 "addis %0,%1,%2-%3@ha")
10398 (define_insn "load_toc_v4_PIC_3c"
10399 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10400 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
10401 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
10402 (match_operand:SI 3 "symbol_ref_operand" "s"))))]
10403 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
10404 "addi %0,%1,%2-%3@l")
10406 ;; If the TOC is shared over a translation unit, as happens with all
10407 ;; the kinds of PIC that we support, we need to restore the TOC
10408 ;; pointer only when jumping over units of translation.
10409 ;; On Darwin, we need to reload the picbase.
10411 (define_expand "builtin_setjmp_receiver"
10412 [(use (label_ref (match_operand 0 "" "")))]
10413 "(DEFAULT_ABI == ABI_V4 && flag_pic == 1)
10414 || (TARGET_TOC && TARGET_MINIMAL_TOC)
10415 || (DEFAULT_ABI == ABI_DARWIN && flag_pic)"
10419 if (DEFAULT_ABI == ABI_DARWIN)
10421 rtx picrtx = gen_rtx_SYMBOL_REF (Pmode, MACHOPIC_FUNCTION_BASE_NAME);
10422 rtx picreg = gen_rtx_REG (Pmode, RS6000_PIC_OFFSET_TABLE_REGNUM);
10426 crtl->uses_pic_offset_table = 1;
10427 ASM_GENERATE_INTERNAL_LABEL(tmplab, \"LSJR\",
10428 CODE_LABEL_NUMBER (operands[0]));
10429 tmplabrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (tmplab));
10431 emit_insn (gen_load_macho_picbase (tmplabrtx));
10432 emit_move_insn (picreg, gen_rtx_REG (Pmode, LR_REGNO));
10433 emit_insn (gen_macho_correct_pic (picreg, picreg, picrtx, tmplabrtx));
10437 rs6000_emit_load_toc_table (FALSE);
10441 ;; Largetoc support
10442 (define_insn "*largetoc_high"
10443 [(set (match_operand:DI 0 "gpc_reg_operand" "=b*r")
10445 (unspec [(match_operand:DI 1 "" "")
10446 (match_operand:DI 2 "gpc_reg_operand" "b")]
10448 "TARGET_ELF && TARGET_CMODEL != CMODEL_SMALL"
10449 "addis %0,%2,%1@toc@ha")
10451 (define_insn "*largetoc_high_aix<mode>"
10452 [(set (match_operand:P 0 "gpc_reg_operand" "=b*r")
10454 (unspec [(match_operand:P 1 "" "")
10455 (match_operand:P 2 "gpc_reg_operand" "b")]
10457 "TARGET_XCOFF && TARGET_CMODEL != CMODEL_SMALL"
10458 "addis %0,%1@u(%2)")
10460 (define_insn "*largetoc_high_plus"
10461 [(set (match_operand:DI 0 "gpc_reg_operand" "=b*r")
10464 (unspec [(match_operand:DI 1 "" "")
10465 (match_operand:DI 2 "gpc_reg_operand" "b")]
10467 (match_operand:DI 3 "add_cint_operand" "n"))))]
10468 "TARGET_ELF && TARGET_CMODEL != CMODEL_SMALL"
10469 "addis %0,%2,%1+%3@toc@ha")
10471 (define_insn "*largetoc_high_plus_aix<mode>"
10472 [(set (match_operand:P 0 "gpc_reg_operand" "=b*r")
10475 (unspec [(match_operand:P 1 "" "")
10476 (match_operand:P 2 "gpc_reg_operand" "b")]
10478 (match_operand:P 3 "add_cint_operand" "n"))))]
10479 "TARGET_XCOFF && TARGET_CMODEL != CMODEL_SMALL"
10480 "addis %0,%1+%3@u(%2)")
10482 (define_insn "*largetoc_low"
10483 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
10484 (lo_sum:DI (match_operand:DI 1 "gpc_reg_operand" "b,!*r")
10485 (match_operand:DI 2 "" "")))]
10486 "TARGET_ELF && TARGET_CMODEL != CMODEL_SMALL"
10491 (define_insn "*largetoc_low_aix<mode>"
10492 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
10493 (lo_sum:P (match_operand:P 1 "gpc_reg_operand" "b")
10494 (match_operand:P 2 "" "")))]
10495 "TARGET_XCOFF && TARGET_CMODEL != CMODEL_SMALL"
10498 (define_insn_and_split "*tocref<mode>"
10499 [(set (match_operand:P 0 "gpc_reg_operand" "=b*r")
10500 (match_operand:P 1 "small_toc_ref" "R"))]
10503 "&& TARGET_CMODEL != CMODEL_SMALL && reload_completed"
10504 [(set (match_dup 0) (high:P (match_dup 1)))
10505 (set (match_dup 0) (lo_sum:P (match_dup 0) (match_dup 1)))])
10507 ;; Elf specific ways of loading addresses for non-PIC code.
10508 ;; The output of this could be r0, but we make a very strong
10509 ;; preference for a base register because it will usually
10510 ;; be needed there.
10511 (define_insn "elf_high"
10512 [(set (match_operand:SI 0 "gpc_reg_operand" "=b*r")
10513 (high:SI (match_operand 1 "" "")))]
10514 "TARGET_ELF && ! TARGET_64BIT"
10517 (define_insn "elf_low"
10518 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
10519 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,!*r")
10520 (match_operand 2 "" "")))]
10521 "TARGET_ELF && ! TARGET_64BIT"
10526 ;; Call and call_value insns
10527 (define_expand "call"
10528 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
10529 (match_operand 1 "" ""))
10530 (use (match_operand 2 "" ""))
10531 (clobber (reg:SI LR_REGNO))])]
10536 if (MACHOPIC_INDIRECT)
10537 operands[0] = machopic_indirect_call_target (operands[0]);
10540 gcc_assert (GET_CODE (operands[0]) == MEM);
10541 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
10543 operands[0] = XEXP (operands[0], 0);
10545 if (GET_CODE (operands[0]) != SYMBOL_REF
10546 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[0]))
10547 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[2]) & CALL_LONG) != 0))
10549 if (INTVAL (operands[2]) & CALL_LONG)
10550 operands[0] = rs6000_longcall_ref (operands[0]);
10552 switch (DEFAULT_ABI)
10556 operands[0] = force_reg (Pmode, operands[0]);
10560 /* AIX function pointers are really pointers to a three word
10562 rs6000_call_indirect_aix (NULL_RTX, operands[0], operands[1]);
10566 gcc_unreachable ();
10571 (define_expand "call_value"
10572 [(parallel [(set (match_operand 0 "" "")
10573 (call (mem:SI (match_operand 1 "address_operand" ""))
10574 (match_operand 2 "" "")))
10575 (use (match_operand 3 "" ""))
10576 (clobber (reg:SI LR_REGNO))])]
10581 if (MACHOPIC_INDIRECT)
10582 operands[1] = machopic_indirect_call_target (operands[1]);
10585 gcc_assert (GET_CODE (operands[1]) == MEM);
10586 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
10588 operands[1] = XEXP (operands[1], 0);
10590 if (GET_CODE (operands[1]) != SYMBOL_REF
10591 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[1]))
10592 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[3]) & CALL_LONG) != 0))
10594 if (INTVAL (operands[3]) & CALL_LONG)
10595 operands[1] = rs6000_longcall_ref (operands[1]);
10597 switch (DEFAULT_ABI)
10601 operands[1] = force_reg (Pmode, operands[1]);
10605 /* AIX function pointers are really pointers to a three word
10607 rs6000_call_indirect_aix (operands[0], operands[1], operands[2]);
10611 gcc_unreachable ();
10616 ;; Call to function in current module. No TOC pointer reload needed.
10617 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
10618 ;; either the function was not prototyped, or it was prototyped as a
10619 ;; variable argument function. It is > 0 if FP registers were passed
10620 ;; and < 0 if they were not.
10622 (define_insn "*call_local32"
10623 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
10624 (match_operand 1 "" "g,g"))
10625 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10626 (clobber (reg:SI LR_REGNO))]
10627 "(INTVAL (operands[2]) & CALL_LONG) == 0"
10630 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10631 output_asm_insn (\"crxor 6,6,6\", operands);
10633 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10634 output_asm_insn (\"creqv 6,6,6\", operands);
10636 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
10638 [(set_attr "type" "branch")
10639 (set_attr "length" "4,8")])
10641 (define_insn "*call_local64"
10642 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
10643 (match_operand 1 "" "g,g"))
10644 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10645 (clobber (reg:SI LR_REGNO))]
10646 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
10649 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10650 output_asm_insn (\"crxor 6,6,6\", operands);
10652 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10653 output_asm_insn (\"creqv 6,6,6\", operands);
10655 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
10657 [(set_attr "type" "branch")
10658 (set_attr "length" "4,8")])
10660 (define_insn "*call_value_local32"
10661 [(set (match_operand 0 "" "")
10662 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
10663 (match_operand 2 "" "g,g")))
10664 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10665 (clobber (reg:SI LR_REGNO))]
10666 "(INTVAL (operands[3]) & CALL_LONG) == 0"
10669 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10670 output_asm_insn (\"crxor 6,6,6\", operands);
10672 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10673 output_asm_insn (\"creqv 6,6,6\", operands);
10675 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
10677 [(set_attr "type" "branch")
10678 (set_attr "length" "4,8")])
10681 (define_insn "*call_value_local64"
10682 [(set (match_operand 0 "" "")
10683 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
10684 (match_operand 2 "" "g,g")))
10685 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10686 (clobber (reg:SI LR_REGNO))]
10687 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
10690 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10691 output_asm_insn (\"crxor 6,6,6\", operands);
10693 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10694 output_asm_insn (\"creqv 6,6,6\", operands);
10696 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
10698 [(set_attr "type" "branch")
10699 (set_attr "length" "4,8")])
10701 ;; Call to indirect functions with the AIX abi using a 3 word descriptor.
10702 ;; Operand0 is the addresss of the function to call
10703 ;; Operand1 is the flag for System V.4 for unprototyped or FP registers
10704 ;; Operand2 is the location in the function descriptor to load r2 from
10705 ;; Operand3 is the stack location to hold the current TOC pointer
10707 (define_insn "call_indirect_aix<ptrsize>"
10708 [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l"))
10709 (match_operand 1 "" "g,g"))
10710 (use (match_operand:P 2 "memory_operand" "<ptrm>,<ptrm>"))
10711 (set (reg:P TOC_REGNUM) (match_operand:P 3 "memory_operand" "<ptrm>,<ptrm>"))
10712 (use (reg:P STATIC_CHAIN_REGNUM))
10713 (clobber (reg:P LR_REGNO))]
10714 "DEFAULT_ABI == ABI_AIX && TARGET_POINTERS_TO_NESTED_FUNCTIONS"
10715 "<ptrload> 2,%2\;b%T0l\;<ptrload> 2,%3"
10716 [(set_attr "type" "jmpreg")
10717 (set_attr "length" "12")])
10719 ;; Like call_indirect_aix<ptrsize>, but no use of the static chain
10720 ;; Operand0 is the addresss of the function to call
10721 ;; Operand1 is the flag for System V.4 for unprototyped or FP registers
10722 ;; Operand2 is the location in the function descriptor to load r2 from
10723 ;; Operand3 is the stack location to hold the current TOC pointer
10725 (define_insn "call_indirect_aix<ptrsize>_nor11"
10726 [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l"))
10727 (match_operand 1 "" "g,g"))
10728 (use (match_operand:P 2 "memory_operand" "<ptrm>,<ptrm>"))
10729 (set (reg:P TOC_REGNUM) (match_operand:P 3 "memory_operand" "<ptrm>,<ptrm>"))
10730 (clobber (reg:P LR_REGNO))]
10731 "DEFAULT_ABI == ABI_AIX && !TARGET_POINTERS_TO_NESTED_FUNCTIONS"
10732 "<ptrload> 2,%2\;b%T0l\;<ptrload> 2,%3"
10733 [(set_attr "type" "jmpreg")
10734 (set_attr "length" "12")])
10736 ;; Operand0 is the return result of the function
10737 ;; Operand1 is the addresss of the function to call
10738 ;; Operand2 is the flag for System V.4 for unprototyped or FP registers
10739 ;; Operand3 is the location in the function descriptor to load r2 from
10740 ;; Operand4 is the stack location to hold the current TOC pointer
10742 (define_insn "call_value_indirect_aix<ptrsize>"
10743 [(set (match_operand 0 "" "")
10744 (call (mem:SI (match_operand:P 1 "register_operand" "c,*l"))
10745 (match_operand 2 "" "g,g")))
10746 (use (match_operand:P 3 "memory_operand" "<ptrm>,<ptrm>"))
10747 (set (reg:P TOC_REGNUM) (match_operand:P 4 "memory_operand" "<ptrm>,<ptrm>"))
10748 (use (reg:P STATIC_CHAIN_REGNUM))
10749 (clobber (reg:P LR_REGNO))]
10750 "DEFAULT_ABI == ABI_AIX && TARGET_POINTERS_TO_NESTED_FUNCTIONS"
10751 "<ptrload> 2,%3\;b%T1l\;<ptrload> 2,%4"
10752 [(set_attr "type" "jmpreg")
10753 (set_attr "length" "12")])
10755 ;; Like call_value_indirect_aix<ptrsize>, but no use of the static chain
10756 ;; Operand0 is the return result of the function
10757 ;; Operand1 is the addresss of the function to call
10758 ;; Operand2 is the flag for System V.4 for unprototyped or FP registers
10759 ;; Operand3 is the location in the function descriptor to load r2 from
10760 ;; Operand4 is the stack location to hold the current TOC pointer
10762 (define_insn "call_value_indirect_aix<ptrsize>_nor11"
10763 [(set (match_operand 0 "" "")
10764 (call (mem:SI (match_operand:P 1 "register_operand" "c,*l"))
10765 (match_operand 2 "" "g,g")))
10766 (use (match_operand:P 3 "memory_operand" "<ptrm>,<ptrm>"))
10767 (set (reg:P TOC_REGNUM) (match_operand:P 4 "memory_operand" "<ptrm>,<ptrm>"))
10768 (clobber (reg:P LR_REGNO))]
10769 "DEFAULT_ABI == ABI_AIX && !TARGET_POINTERS_TO_NESTED_FUNCTIONS"
10770 "<ptrload> 2,%3\;b%T1l\;<ptrload> 2,%4"
10771 [(set_attr "type" "jmpreg")
10772 (set_attr "length" "12")])
10774 ;; Call to function which may be in another module. Restore the TOC
10775 ;; pointer (r2) after the call unless this is System V.
10776 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
10777 ;; either the function was not prototyped, or it was prototyped as a
10778 ;; variable argument function. It is > 0 if FP registers were passed
10779 ;; and < 0 if they were not.
10781 (define_insn "*call_nonlocal_aix32"
10782 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
10783 (match_operand 1 "" "g"))
10784 (use (match_operand:SI 2 "immediate_operand" "O"))
10785 (clobber (reg:SI LR_REGNO))]
10787 && DEFAULT_ABI == ABI_AIX
10788 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10790 [(set_attr "type" "branch")
10791 (set_attr "length" "8")])
10793 (define_insn "*call_nonlocal_aix64"
10794 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
10795 (match_operand 1 "" "g"))
10796 (use (match_operand:SI 2 "immediate_operand" "O"))
10797 (clobber (reg:SI LR_REGNO))]
10799 && DEFAULT_ABI == ABI_AIX
10800 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10802 [(set_attr "type" "branch")
10803 (set_attr "length" "8")])
10805 (define_insn "*call_value_nonlocal_aix32"
10806 [(set (match_operand 0 "" "")
10807 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
10808 (match_operand 2 "" "g")))
10809 (use (match_operand:SI 3 "immediate_operand" "O"))
10810 (clobber (reg:SI LR_REGNO))]
10812 && DEFAULT_ABI == ABI_AIX
10813 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10815 [(set_attr "type" "branch")
10816 (set_attr "length" "8")])
10818 (define_insn "*call_value_nonlocal_aix64"
10819 [(set (match_operand 0 "" "")
10820 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
10821 (match_operand 2 "" "g")))
10822 (use (match_operand:SI 3 "immediate_operand" "O"))
10823 (clobber (reg:SI LR_REGNO))]
10825 && DEFAULT_ABI == ABI_AIX
10826 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10828 [(set_attr "type" "branch")
10829 (set_attr "length" "8")])
10831 ;; A function pointer under System V is just a normal pointer
10832 ;; operands[0] is the function pointer
10833 ;; operands[1] is the stack size to clean up
10834 ;; operands[2] is the value FUNCTION_ARG returns for the VOID argument
10835 ;; which indicates how to set cr1
10837 (define_insn "*call_indirect_nonlocal_sysv<mode>"
10838 [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l,c,*l"))
10839 (match_operand 1 "" "g,g,g,g"))
10840 (use (match_operand:SI 2 "immediate_operand" "O,O,n,n"))
10841 (clobber (reg:SI LR_REGNO))]
10842 "DEFAULT_ABI == ABI_V4
10843 || DEFAULT_ABI == ABI_DARWIN"
10845 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10846 output_asm_insn ("crxor 6,6,6", operands);
10848 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10849 output_asm_insn ("creqv 6,6,6", operands);
10853 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
10854 (set_attr "length" "4,4,8,8")])
10856 (define_insn_and_split "*call_nonlocal_sysv<mode>"
10857 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
10858 (match_operand 1 "" "g,g"))
10859 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10860 (clobber (reg:SI LR_REGNO))]
10861 "(DEFAULT_ABI == ABI_DARWIN
10862 || (DEFAULT_ABI == ABI_V4
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 return output_call(insn, operands, 0, 2);
10874 if (DEFAULT_ABI == ABI_V4 && flag_pic)
10876 gcc_assert (!TARGET_SECURE_PLT);
10877 return "bl %z0@plt";
10883 "DEFAULT_ABI == ABI_V4
10884 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[0])
10885 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10886 [(parallel [(call (mem:SI (match_dup 0))
10888 (use (match_dup 2))
10889 (use (match_dup 3))
10890 (clobber (reg:SI LR_REGNO))])]
10892 operands[3] = pic_offset_table_rtx;
10894 [(set_attr "type" "branch,branch")
10895 (set_attr "length" "4,8")])
10897 (define_insn "*call_nonlocal_sysv_secure<mode>"
10898 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
10899 (match_operand 1 "" "g,g"))
10900 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10901 (use (match_operand:SI 3 "register_operand" "r,r"))
10902 (clobber (reg:SI LR_REGNO))]
10903 "(DEFAULT_ABI == ABI_V4
10904 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[0])
10905 && (INTVAL (operands[2]) & CALL_LONG) == 0)"
10907 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10908 output_asm_insn ("crxor 6,6,6", operands);
10910 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10911 output_asm_insn ("creqv 6,6,6", operands);
10914 /* The magic 32768 offset here and in the other sysv call insns
10915 corresponds to the offset of r30 in .got2, as given by LCTOC1.
10916 See sysv4.h:toc_section. */
10917 return "bl %z0+32768@plt";
10919 return "bl %z0@plt";
10921 [(set_attr "type" "branch,branch")
10922 (set_attr "length" "4,8")])
10924 (define_insn "*call_value_indirect_nonlocal_sysv<mode>"
10925 [(set (match_operand 0 "" "")
10926 (call (mem:SI (match_operand:P 1 "register_operand" "c,*l,c,*l"))
10927 (match_operand 2 "" "g,g,g,g")))
10928 (use (match_operand:SI 3 "immediate_operand" "O,O,n,n"))
10929 (clobber (reg:SI LR_REGNO))]
10930 "DEFAULT_ABI == ABI_V4
10931 || DEFAULT_ABI == ABI_DARWIN"
10933 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10934 output_asm_insn ("crxor 6,6,6", operands);
10936 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10937 output_asm_insn ("creqv 6,6,6", operands);
10941 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
10942 (set_attr "length" "4,4,8,8")])
10944 (define_insn_and_split "*call_value_nonlocal_sysv<mode>"
10945 [(set (match_operand 0 "" "")
10946 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
10947 (match_operand 2 "" "g,g")))
10948 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10949 (clobber (reg:SI LR_REGNO))]
10950 "(DEFAULT_ABI == ABI_DARWIN
10951 || (DEFAULT_ABI == ABI_V4
10952 && (INTVAL (operands[3]) & CALL_LONG) == 0))"
10954 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10955 output_asm_insn ("crxor 6,6,6", operands);
10957 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10958 output_asm_insn ("creqv 6,6,6", operands);
10961 return output_call(insn, operands, 1, 3);
10963 if (DEFAULT_ABI == ABI_V4 && flag_pic)
10965 gcc_assert (!TARGET_SECURE_PLT);
10966 return "bl %z1@plt";
10972 "DEFAULT_ABI == ABI_V4
10973 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[1])
10974 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10975 [(parallel [(set (match_dup 0)
10976 (call (mem:SI (match_dup 1))
10978 (use (match_dup 3))
10979 (use (match_dup 4))
10980 (clobber (reg:SI LR_REGNO))])]
10982 operands[4] = pic_offset_table_rtx;
10984 [(set_attr "type" "branch,branch")
10985 (set_attr "length" "4,8")])
10987 (define_insn "*call_value_nonlocal_sysv_secure<mode>"
10988 [(set (match_operand 0 "" "")
10989 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
10990 (match_operand 2 "" "g,g")))
10991 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10992 (use (match_operand:SI 4 "register_operand" "r,r"))
10993 (clobber (reg:SI LR_REGNO))]
10994 "(DEFAULT_ABI == ABI_V4
10995 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[1])
10996 && (INTVAL (operands[3]) & CALL_LONG) == 0)"
10998 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10999 output_asm_insn ("crxor 6,6,6", operands);
11001 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11002 output_asm_insn ("creqv 6,6,6", operands);
11005 return "bl %z1+32768@plt";
11007 return "bl %z1@plt";
11009 [(set_attr "type" "branch,branch")
11010 (set_attr "length" "4,8")])
11012 ;; Call subroutine returning any type.
11013 (define_expand "untyped_call"
11014 [(parallel [(call (match_operand 0 "" "")
11016 (match_operand 1 "" "")
11017 (match_operand 2 "" "")])]
11023 emit_call_insn (GEN_CALL (operands[0], const0_rtx, const0_rtx, const0_rtx));
11025 for (i = 0; i < XVECLEN (operands[2], 0); i++)
11027 rtx set = XVECEXP (operands[2], 0, i);
11028 emit_move_insn (SET_DEST (set), SET_SRC (set));
11031 /* The optimizer does not know that the call sets the function value
11032 registers we stored in the result block. We avoid problems by
11033 claiming that all hard registers are used and clobbered at this
11035 emit_insn (gen_blockage ());
11040 ;; sibling call patterns
11041 (define_expand "sibcall"
11042 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
11043 (match_operand 1 "" ""))
11044 (use (match_operand 2 "" ""))
11045 (use (reg:SI LR_REGNO))
11051 if (MACHOPIC_INDIRECT)
11052 operands[0] = machopic_indirect_call_target (operands[0]);
11055 gcc_assert (GET_CODE (operands[0]) == MEM);
11056 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
11058 operands[0] = XEXP (operands[0], 0);
11061 ;; this and similar patterns must be marked as using LR, otherwise
11062 ;; dataflow will try to delete the store into it. This is true
11063 ;; even when the actual reg to jump to is in CTR, when LR was
11064 ;; saved and restored around the PIC-setting BCL.
11065 (define_insn "*sibcall_local32"
11066 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
11067 (match_operand 1 "" "g,g"))
11068 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11069 (use (reg:SI LR_REGNO))
11071 "(INTVAL (operands[2]) & CALL_LONG) == 0"
11074 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11075 output_asm_insn (\"crxor 6,6,6\", operands);
11077 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11078 output_asm_insn (\"creqv 6,6,6\", operands);
11080 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
11082 [(set_attr "type" "branch")
11083 (set_attr "length" "4,8")])
11085 (define_insn "*sibcall_local64"
11086 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
11087 (match_operand 1 "" "g,g"))
11088 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11089 (use (reg:SI LR_REGNO))
11091 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
11094 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11095 output_asm_insn (\"crxor 6,6,6\", operands);
11097 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11098 output_asm_insn (\"creqv 6,6,6\", operands);
11100 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
11102 [(set_attr "type" "branch")
11103 (set_attr "length" "4,8")])
11105 (define_insn "*sibcall_value_local32"
11106 [(set (match_operand 0 "" "")
11107 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
11108 (match_operand 2 "" "g,g")))
11109 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11110 (use (reg:SI LR_REGNO))
11112 "(INTVAL (operands[3]) & CALL_LONG) == 0"
11115 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11116 output_asm_insn (\"crxor 6,6,6\", operands);
11118 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11119 output_asm_insn (\"creqv 6,6,6\", operands);
11121 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
11123 [(set_attr "type" "branch")
11124 (set_attr "length" "4,8")])
11127 (define_insn "*sibcall_value_local64"
11128 [(set (match_operand 0 "" "")
11129 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
11130 (match_operand 2 "" "g,g")))
11131 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11132 (use (reg:SI LR_REGNO))
11134 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
11137 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11138 output_asm_insn (\"crxor 6,6,6\", operands);
11140 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11141 output_asm_insn (\"creqv 6,6,6\", operands);
11143 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
11145 [(set_attr "type" "branch")
11146 (set_attr "length" "4,8")])
11148 (define_insn "*sibcall_nonlocal_aix<mode>"
11149 [(call (mem:SI (match_operand:P 0 "call_operand" "s,c"))
11150 (match_operand 1 "" "g,g"))
11151 (use (match_operand:SI 2 "immediate_operand" "O,O"))
11152 (use (reg:SI LR_REGNO))
11154 "DEFAULT_ABI == ABI_AIX
11155 && (INTVAL (operands[2]) & CALL_LONG) == 0"
11159 [(set_attr "type" "branch")
11160 (set_attr "length" "4")])
11162 (define_insn "*sibcall_value_nonlocal_aix<mode>"
11163 [(set (match_operand 0 "" "")
11164 (call (mem:SI (match_operand:P 1 "call_operand" "s,c"))
11165 (match_operand 2 "" "g,g")))
11166 (use (match_operand:SI 3 "immediate_operand" "O,O"))
11167 (use (reg:SI LR_REGNO))
11169 "DEFAULT_ABI == ABI_AIX
11170 && (INTVAL (operands[3]) & CALL_LONG) == 0"
11174 [(set_attr "type" "branch")
11175 (set_attr "length" "4")])
11177 (define_insn "*sibcall_nonlocal_sysv<mode>"
11178 [(call (mem:SI (match_operand:P 0 "call_operand" "s,s,c,c"))
11179 (match_operand 1 "" ""))
11180 (use (match_operand 2 "immediate_operand" "O,n,O,n"))
11181 (use (reg:SI LR_REGNO))
11183 "(DEFAULT_ABI == ABI_DARWIN
11184 || DEFAULT_ABI == ABI_V4)
11185 && (INTVAL (operands[2]) & CALL_LONG) == 0"
11188 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11189 output_asm_insn (\"crxor 6,6,6\", operands);
11191 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11192 output_asm_insn (\"creqv 6,6,6\", operands);
11194 if (which_alternative >= 2)
11196 else if (DEFAULT_ABI == ABI_V4 && flag_pic)
11198 gcc_assert (!TARGET_SECURE_PLT);
11199 return \"b %z0@plt\";
11204 [(set_attr "type" "branch")
11205 (set_attr "length" "4,8,4,8")])
11207 (define_expand "sibcall_value"
11208 [(parallel [(set (match_operand 0 "register_operand" "")
11209 (call (mem:SI (match_operand 1 "address_operand" ""))
11210 (match_operand 2 "" "")))
11211 (use (match_operand 3 "" ""))
11212 (use (reg:SI LR_REGNO))
11218 if (MACHOPIC_INDIRECT)
11219 operands[1] = machopic_indirect_call_target (operands[1]);
11222 gcc_assert (GET_CODE (operands[1]) == MEM);
11223 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
11225 operands[1] = XEXP (operands[1], 0);
11228 (define_insn "*sibcall_value_nonlocal_sysv<mode>"
11229 [(set (match_operand 0 "" "")
11230 (call (mem:SI (match_operand:P 1 "call_operand" "s,s,c,c"))
11231 (match_operand 2 "" "")))
11232 (use (match_operand:SI 3 "immediate_operand" "O,n,O,n"))
11233 (use (reg:SI LR_REGNO))
11235 "(DEFAULT_ABI == ABI_DARWIN
11236 || DEFAULT_ABI == ABI_V4)
11237 && (INTVAL (operands[3]) & CALL_LONG) == 0"
11240 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11241 output_asm_insn (\"crxor 6,6,6\", operands);
11243 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11244 output_asm_insn (\"creqv 6,6,6\", operands);
11246 if (which_alternative >= 2)
11248 else if (DEFAULT_ABI == ABI_V4 && flag_pic)
11250 gcc_assert (!TARGET_SECURE_PLT);
11251 return \"b %z1@plt\";
11256 [(set_attr "type" "branch")
11257 (set_attr "length" "4,8,4,8")])
11259 (define_expand "sibcall_epilogue"
11260 [(use (const_int 0))]
11263 if (!TARGET_SCHED_PROLOG)
11264 emit_insn (gen_blockage ());
11265 rs6000_emit_epilogue (TRUE);
11269 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
11270 ;; all of memory. This blocks insns from being moved across this point.
11272 (define_insn "blockage"
11273 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCK)]
11277 (define_expand "probe_stack"
11278 [(set (match_operand 0 "memory_operand" "=m")
11279 (unspec [(const_int 0)] UNSPEC_PROBE_STACK))]
11283 emit_insn (gen_probe_stack_di (operands[0]));
11285 emit_insn (gen_probe_stack_si (operands[0]));
11289 (define_insn "probe_stack_<mode>"
11290 [(set (match_operand:P 0 "memory_operand" "=m")
11291 (unspec:P [(const_int 0)] UNSPEC_PROBE_STACK))]
11294 operands[1] = gen_rtx_REG (Pmode, 0);
11295 return "st<wd>%U0%X0 %1,%0";
11297 [(set_attr "type" "store")
11298 (set_attr "length" "4")])
11300 (define_insn "probe_stack_range<P:mode>"
11301 [(set (match_operand:P 0 "register_operand" "=r")
11302 (unspec_volatile:P [(match_operand:P 1 "register_operand" "0")
11303 (match_operand:P 2 "register_operand" "r")]
11304 UNSPECV_PROBE_STACK_RANGE))]
11306 "* return output_probe_stack_range (operands[0], operands[2]);"
11307 [(set_attr "type" "three")])
11309 ;; Compare insns are next. Note that the RS/6000 has two types of compares,
11310 ;; signed & unsigned, and one type of branch.
11312 ;; Start with the DEFINE_EXPANDs to generate the rtl for compares, scc
11313 ;; insns, and branches.
11315 (define_expand "cbranch<mode>4"
11316 [(use (match_operator 0 "rs6000_cbranch_operator"
11317 [(match_operand:GPR 1 "gpc_reg_operand" "")
11318 (match_operand:GPR 2 "reg_or_short_operand" "")]))
11319 (use (match_operand 3 ""))]
11323 /* Take care of the possibility that operands[2] might be negative but
11324 this might be a logical operation. That insn doesn't exist. */
11325 if (GET_CODE (operands[2]) == CONST_INT
11326 && INTVAL (operands[2]) < 0)
11328 operands[2] = force_reg (<MODE>mode, operands[2]);
11329 operands[0] = gen_rtx_fmt_ee (GET_CODE (operands[0]),
11330 GET_MODE (operands[0]),
11331 operands[1], operands[2]);
11334 rs6000_emit_cbranch (<MODE>mode, operands);
11338 (define_expand "cbranch<mode>4"
11339 [(use (match_operator 0 "rs6000_cbranch_operator"
11340 [(match_operand:FP 1 "gpc_reg_operand" "")
11341 (match_operand:FP 2 "gpc_reg_operand" "")]))
11342 (use (match_operand 3 ""))]
11346 rs6000_emit_cbranch (<MODE>mode, operands);
11350 (define_expand "cstore<mode>4"
11351 [(use (match_operator 1 "rs6000_cbranch_operator"
11352 [(match_operand:GPR 2 "gpc_reg_operand" "")
11353 (match_operand:GPR 3 "reg_or_short_operand" "")]))
11354 (clobber (match_operand:SI 0 "register_operand"))]
11358 /* Take care of the possibility that operands[3] might be negative but
11359 this might be a logical operation. That insn doesn't exist. */
11360 if (GET_CODE (operands[3]) == CONST_INT
11361 && INTVAL (operands[3]) < 0)
11363 operands[3] = force_reg (<MODE>mode, operands[3]);
11364 operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]),
11365 GET_MODE (operands[1]),
11366 operands[2], operands[3]);
11369 /* For SNE, we would prefer that the xor/abs sequence be used for integers.
11370 For SEQ, likewise, except that comparisons with zero should be done
11371 with an scc insns. However, due to the order that combine see the
11372 resulting insns, we must, in fact, allow SEQ for integers. Fail in
11373 the cases we don't want to handle or are best handled by portable
11375 if (GET_CODE (operands[1]) == NE)
11377 if ((GET_CODE (operands[1]) == LT || GET_CODE (operands[1]) == LE
11378 || GET_CODE (operands[1]) == GT || GET_CODE (operands[1]) == GE)
11379 && operands[3] == const0_rtx)
11381 rs6000_emit_sCOND (<MODE>mode, operands);
11385 (define_expand "cstore<mode>4"
11386 [(use (match_operator 1 "rs6000_cbranch_operator"
11387 [(match_operand:FP 2 "gpc_reg_operand" "")
11388 (match_operand:FP 3 "gpc_reg_operand" "")]))
11389 (clobber (match_operand:SI 0 "register_operand"))]
11393 rs6000_emit_sCOND (<MODE>mode, operands);
11398 (define_expand "stack_protect_set"
11399 [(match_operand 0 "memory_operand" "")
11400 (match_operand 1 "memory_operand" "")]
11403 #ifdef TARGET_THREAD_SSP_OFFSET
11404 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
11405 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
11406 operands[1] = gen_rtx_MEM (Pmode, addr);
11409 emit_insn (gen_stack_protect_setdi (operands[0], operands[1]));
11411 emit_insn (gen_stack_protect_setsi (operands[0], operands[1]));
11415 (define_insn "stack_protect_setsi"
11416 [(set (match_operand:SI 0 "memory_operand" "=m")
11417 (unspec:SI [(match_operand:SI 1 "memory_operand" "m")] UNSPEC_SP_SET))
11418 (set (match_scratch:SI 2 "=&r") (const_int 0))]
11420 "lwz%U1%X1 %2,%1\;stw%U0%X0 %2,%0\;li %2,0"
11421 [(set_attr "type" "three")
11422 (set_attr "length" "12")])
11424 (define_insn "stack_protect_setdi"
11425 [(set (match_operand:DI 0 "memory_operand" "=Y")
11426 (unspec:DI [(match_operand:DI 1 "memory_operand" "Y")] UNSPEC_SP_SET))
11427 (set (match_scratch:DI 2 "=&r") (const_int 0))]
11429 "ld%U1%X1 %2,%1\;std%U0%X0 %2,%0\;li %2,0"
11430 [(set_attr "type" "three")
11431 (set_attr "length" "12")])
11433 (define_expand "stack_protect_test"
11434 [(match_operand 0 "memory_operand" "")
11435 (match_operand 1 "memory_operand" "")
11436 (match_operand 2 "" "")]
11439 rtx test, op0, op1;
11440 #ifdef TARGET_THREAD_SSP_OFFSET
11441 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
11442 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
11443 operands[1] = gen_rtx_MEM (Pmode, addr);
11446 op1 = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, operands[1]), UNSPEC_SP_TEST);
11447 test = gen_rtx_EQ (VOIDmode, op0, op1);
11448 emit_jump_insn (gen_cbranchsi4 (test, op0, op1, operands[2]));
11452 (define_insn "stack_protect_testsi"
11453 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
11454 (unspec:CCEQ [(match_operand:SI 1 "memory_operand" "m,m")
11455 (match_operand:SI 2 "memory_operand" "m,m")]
11457 (set (match_scratch:SI 4 "=r,r") (const_int 0))
11458 (clobber (match_scratch:SI 3 "=&r,&r"))]
11461 lwz%U1%X1 %3,%1\;lwz%U2%X2 %4,%2\;xor. %3,%3,%4\;li %4,0
11462 lwz%U1%X1 %3,%1\;lwz%U2%X2 %4,%2\;cmplw %0,%3,%4\;li %3,0\;li %4,0"
11463 [(set_attr "length" "16,20")])
11465 (define_insn "stack_protect_testdi"
11466 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
11467 (unspec:CCEQ [(match_operand:DI 1 "memory_operand" "Y,Y")
11468 (match_operand:DI 2 "memory_operand" "Y,Y")]
11470 (set (match_scratch:DI 4 "=r,r") (const_int 0))
11471 (clobber (match_scratch:DI 3 "=&r,&r"))]
11474 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;xor. %3,%3,%4\;li %4,0
11475 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;cmpld %0,%3,%4\;li %3,0\;li %4,0"
11476 [(set_attr "length" "16,20")])
11479 ;; Here are the actual compare insns.
11480 (define_insn "*cmp<mode>_internal1"
11481 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
11482 (compare:CC (match_operand:GPR 1 "gpc_reg_operand" "r")
11483 (match_operand:GPR 2 "reg_or_short_operand" "rI")))]
11485 "cmp<wd>%I2 %0,%1,%2"
11486 [(set_attr "type" "cmp")])
11488 ;; If we are comparing a register for equality with a large constant,
11489 ;; we can do this with an XOR followed by a compare. But this is profitable
11490 ;; only if the large constant is only used for the comparison (and in this
11491 ;; case we already have a register to reuse as scratch).
11493 ;; For 64-bit registers, we could only do so if the constant's bit 15 is clear:
11494 ;; otherwise we'd need to XOR with FFFFFFFF????0000 which is not available.
11497 [(set (match_operand:SI 0 "register_operand")
11498 (match_operand:SI 1 "logical_const_operand" ""))
11499 (set (match_dup 0) (match_operator:SI 3 "boolean_or_operator"
11501 (match_operand:SI 2 "logical_const_operand" "")]))
11502 (set (match_operand:CC 4 "cc_reg_operand" "")
11503 (compare:CC (match_operand:SI 5 "gpc_reg_operand" "")
11506 (if_then_else (match_operator 6 "equality_operator"
11507 [(match_dup 4) (const_int 0)])
11508 (match_operand 7 "" "")
11509 (match_operand 8 "" "")))]
11510 "peep2_reg_dead_p (3, operands[0])
11511 && peep2_reg_dead_p (4, operands[4])"
11512 [(set (match_dup 0) (xor:SI (match_dup 5) (match_dup 9)))
11513 (set (match_dup 4) (compare:CC (match_dup 0) (match_dup 10)))
11514 (set (pc) (if_then_else (match_dup 6) (match_dup 7) (match_dup 8)))]
11517 /* Get the constant we are comparing against, and see what it looks like
11518 when sign-extended from 16 to 32 bits. Then see what constant we could
11519 XOR with SEXTC to get the sign-extended value. */
11520 rtx cnst = simplify_const_binary_operation (GET_CODE (operands[3]),
11522 operands[1], operands[2]);
11523 HOST_WIDE_INT c = INTVAL (cnst);
11524 HOST_WIDE_INT sextc = ((c & 0xffff) ^ 0x8000) - 0x8000;
11525 HOST_WIDE_INT xorv = c ^ sextc;
11527 operands[9] = GEN_INT (xorv);
11528 operands[10] = GEN_INT (sextc);
11531 (define_insn "*cmpsi_internal2"
11532 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
11533 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
11534 (match_operand:SI 2 "reg_or_u_short_operand" "rK")))]
11536 "cmplw%I2 %0,%1,%b2"
11537 [(set_attr "type" "cmp")])
11539 (define_insn "*cmpdi_internal2"
11540 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
11541 (compare:CCUNS (match_operand:DI 1 "gpc_reg_operand" "r")
11542 (match_operand:DI 2 "reg_or_u_short_operand" "rK")))]
11544 "cmpld%I2 %0,%1,%b2"
11545 [(set_attr "type" "cmp")])
11547 ;; The following two insns don't exist as single insns, but if we provide
11548 ;; them, we can swap an add and compare, which will enable us to overlap more
11549 ;; of the required delay between a compare and branch. We generate code for
11550 ;; them by splitting.
11553 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
11554 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
11555 (match_operand:SI 2 "short_cint_operand" "i")))
11556 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
11557 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
11560 [(set_attr "length" "8")])
11563 [(set (match_operand:CCUNS 3 "cc_reg_operand" "=y")
11564 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
11565 (match_operand:SI 2 "u_short_cint_operand" "i")))
11566 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
11567 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
11570 [(set_attr "length" "8")])
11573 [(set (match_operand:CC 3 "cc_reg_operand" "")
11574 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
11575 (match_operand:SI 2 "short_cint_operand" "")))
11576 (set (match_operand:SI 0 "gpc_reg_operand" "")
11577 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
11579 [(set (match_dup 3) (compare:CC (match_dup 1) (match_dup 2)))
11580 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
11583 [(set (match_operand:CCUNS 3 "cc_reg_operand" "")
11584 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "")
11585 (match_operand:SI 2 "u_short_cint_operand" "")))
11586 (set (match_operand:SI 0 "gpc_reg_operand" "")
11587 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
11589 [(set (match_dup 3) (compare:CCUNS (match_dup 1) (match_dup 2)))
11590 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
11592 (define_insn "*cmpsf_internal1"
11593 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11594 (compare:CCFP (match_operand:SF 1 "gpc_reg_operand" "f")
11595 (match_operand:SF 2 "gpc_reg_operand" "f")))]
11596 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
11598 [(set_attr "type" "fpcompare")])
11600 (define_insn "*cmpdf_internal1"
11601 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11602 (compare:CCFP (match_operand:DF 1 "gpc_reg_operand" "d")
11603 (match_operand:DF 2 "gpc_reg_operand" "d")))]
11604 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
11605 && !VECTOR_UNIT_VSX_P (DFmode)"
11607 [(set_attr "type" "fpcompare")])
11609 ;; Only need to compare second words if first words equal
11610 (define_insn "*cmptf_internal1"
11611 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11612 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "d")
11613 (match_operand:TF 2 "gpc_reg_operand" "d")))]
11614 "!TARGET_IEEEQUAD && !TARGET_XL_COMPAT
11615 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LONG_DOUBLE_128"
11616 "fcmpu %0,%1,%2\;bne %0,$+8\;fcmpu %0,%L1,%L2"
11617 [(set_attr "type" "fpcompare")
11618 (set_attr "length" "12")])
11620 (define_insn_and_split "*cmptf_internal2"
11621 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11622 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "d")
11623 (match_operand:TF 2 "gpc_reg_operand" "d")))
11624 (clobber (match_scratch:DF 3 "=d"))
11625 (clobber (match_scratch:DF 4 "=d"))
11626 (clobber (match_scratch:DF 5 "=d"))
11627 (clobber (match_scratch:DF 6 "=d"))
11628 (clobber (match_scratch:DF 7 "=d"))
11629 (clobber (match_scratch:DF 8 "=d"))
11630 (clobber (match_scratch:DF 9 "=d"))
11631 (clobber (match_scratch:DF 10 "=d"))
11632 (clobber (match_scratch:GPR 11 "=b"))]
11633 "!TARGET_IEEEQUAD && TARGET_XL_COMPAT
11634 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LONG_DOUBLE_128"
11636 "&& reload_completed"
11637 [(set (match_dup 3) (match_dup 14))
11638 (set (match_dup 4) (match_dup 15))
11639 (set (match_dup 9) (abs:DF (match_dup 5)))
11640 (set (match_dup 0) (compare:CCFP (match_dup 9) (match_dup 3)))
11641 (set (pc) (if_then_else (ne (match_dup 0) (const_int 0))
11642 (label_ref (match_dup 12))
11644 (set (match_dup 0) (compare:CCFP (match_dup 5) (match_dup 7)))
11645 (set (pc) (label_ref (match_dup 13)))
11647 (set (match_dup 10) (minus:DF (match_dup 5) (match_dup 7)))
11648 (set (match_dup 9) (minus:DF (match_dup 6) (match_dup 8)))
11649 (set (match_dup 9) (plus:DF (match_dup 10) (match_dup 9)))
11650 (set (match_dup 0) (compare:CCFP (match_dup 9) (match_dup 4)))
11653 REAL_VALUE_TYPE rv;
11654 const int lo_word = LONG_DOUBLE_LARGE_FIRST ? GET_MODE_SIZE (DFmode) : 0;
11655 const int hi_word = LONG_DOUBLE_LARGE_FIRST ? 0 : GET_MODE_SIZE (DFmode);
11657 operands[5] = simplify_gen_subreg (DFmode, operands[1], TFmode, hi_word);
11658 operands[6] = simplify_gen_subreg (DFmode, operands[1], TFmode, lo_word);
11659 operands[7] = simplify_gen_subreg (DFmode, operands[2], TFmode, hi_word);
11660 operands[8] = simplify_gen_subreg (DFmode, operands[2], TFmode, lo_word);
11661 operands[12] = gen_label_rtx ();
11662 operands[13] = gen_label_rtx ();
11664 operands[14] = force_const_mem (DFmode,
11665 CONST_DOUBLE_FROM_REAL_VALUE (rv, DFmode));
11666 operands[15] = force_const_mem (DFmode,
11667 CONST_DOUBLE_FROM_REAL_VALUE (dconst0,
11672 tocref = create_TOC_reference (XEXP (operands[14], 0), operands[11]);
11673 operands[14] = gen_const_mem (DFmode, tocref);
11674 tocref = create_TOC_reference (XEXP (operands[15], 0), operands[11]);
11675 operands[15] = gen_const_mem (DFmode, tocref);
11676 set_mem_alias_set (operands[14], get_TOC_alias_set ());
11677 set_mem_alias_set (operands[15], get_TOC_alias_set ());
11681 ;; Now we have the scc insns. We can do some combinations because of the
11682 ;; way the machine works.
11684 ;; Note that this is probably faster if we can put an insn between the
11685 ;; mfcr and rlinm, but this is tricky. Let's leave it for now. In most
11686 ;; cases the insns below which don't use an intermediate CR field will
11687 ;; be used instead.
11689 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11690 (match_operator:SI 1 "scc_comparison_operator"
11691 [(match_operand 2 "cc_reg_operand" "y")
11694 "mfcr %0%Q2\;rlwinm %0,%0,%J1,1"
11695 [(set (attr "type")
11696 (cond [(match_test "TARGET_MFCRF")
11697 (const_string "mfcrf")
11699 (const_string "mfcr")))
11700 (set_attr "length" "8")])
11702 ;; Same as above, but get the GT bit.
11703 (define_insn "move_from_CR_gt_bit"
11704 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11705 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_GT))]
11706 "TARGET_HARD_FLOAT && !TARGET_FPRS"
11707 "mfcr %0\;rlwinm %0,%0,%D1,31,31"
11708 [(set_attr "type" "mfcr")
11709 (set_attr "length" "8")])
11711 ;; Same as above, but get the OV/ORDERED bit.
11712 (define_insn "move_from_CR_ov_bit"
11713 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11714 (unspec:SI [(match_operand:CC 1 "cc_reg_operand" "y")]
11717 "mfcr %0\;rlwinm %0,%0,%t1,1"
11718 [(set_attr "type" "mfcr")
11719 (set_attr "length" "8")])
11722 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11723 (match_operator:DI 1 "scc_comparison_operator"
11724 [(match_operand 2 "cc_reg_operand" "y")
11727 "mfcr %0%Q2\;rlwinm %0,%0,%J1,1"
11728 [(set (attr "type")
11729 (cond [(match_test "TARGET_MFCRF")
11730 (const_string "mfcrf")
11732 (const_string "mfcr")))
11733 (set_attr "length" "8")])
11736 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11737 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
11738 [(match_operand 2 "cc_reg_operand" "y,y")
11741 (set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
11742 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
11745 mfcr %3%Q2\;rlwinm. %3,%3,%J1,1
11747 [(set_attr "type" "delayed_compare")
11748 (set_attr "length" "8,16")])
11751 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11752 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
11753 [(match_operand 2 "cc_reg_operand" "")
11756 (set (match_operand:SI 3 "gpc_reg_operand" "")
11757 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
11758 "TARGET_32BIT && reload_completed"
11759 [(set (match_dup 3)
11760 (match_op_dup 1 [(match_dup 2) (const_int 0)]))
11762 (compare:CC (match_dup 3)
11767 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11768 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
11769 [(match_operand 2 "cc_reg_operand" "y")
11771 (match_operand:SI 3 "const_int_operand" "n")))]
11775 int is_bit = ccr_bit (operands[1], 1);
11776 int put_bit = 31 - (INTVAL (operands[3]) & 31);
11779 if (is_bit >= put_bit)
11780 count = is_bit - put_bit;
11782 count = 32 - (put_bit - is_bit);
11784 operands[4] = GEN_INT (count);
11785 operands[5] = GEN_INT (put_bit);
11787 return \"mfcr %0%Q2\;rlwinm %0,%0,%4,%5,%5\";
11789 [(set (attr "type")
11790 (cond [(match_test "TARGET_MFCRF")
11791 (const_string "mfcrf")
11793 (const_string "mfcr")))
11794 (set_attr "length" "8")])
11797 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11799 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
11800 [(match_operand 2 "cc_reg_operand" "y,y")
11802 (match_operand:SI 3 "const_int_operand" "n,n"))
11804 (set (match_operand:SI 4 "gpc_reg_operand" "=r,r")
11805 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
11810 int is_bit = ccr_bit (operands[1], 1);
11811 int put_bit = 31 - (INTVAL (operands[3]) & 31);
11814 /* Force split for non-cc0 compare. */
11815 if (which_alternative == 1)
11818 if (is_bit >= put_bit)
11819 count = is_bit - put_bit;
11821 count = 32 - (put_bit - is_bit);
11823 operands[5] = GEN_INT (count);
11824 operands[6] = GEN_INT (put_bit);
11826 return \"mfcr %4%Q2\;rlwinm. %4,%4,%5,%6,%6\";
11828 [(set_attr "type" "delayed_compare")
11829 (set_attr "length" "8,16")])
11832 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
11834 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
11835 [(match_operand 2 "cc_reg_operand" "")
11837 (match_operand:SI 3 "const_int_operand" ""))
11839 (set (match_operand:SI 4 "gpc_reg_operand" "")
11840 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
11843 [(set (match_dup 4)
11844 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
11847 (compare:CC (match_dup 4)
11851 ;; There is a 3 cycle delay between consecutive mfcr instructions
11852 ;; so it is useful to combine 2 scc instructions to use only one mfcr.
11855 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11856 (match_operator:SI 1 "scc_comparison_operator"
11857 [(match_operand 2 "cc_reg_operand" "y")
11859 (set (match_operand:SI 3 "gpc_reg_operand" "=r")
11860 (match_operator:SI 4 "scc_comparison_operator"
11861 [(match_operand 5 "cc_reg_operand" "y")
11863 "REGNO (operands[2]) != REGNO (operands[5])"
11864 "mfcr %3\;rlwinm %0,%3,%J1,1\;rlwinm %3,%3,%J4,1"
11865 [(set_attr "type" "mfcr")
11866 (set_attr "length" "12")])
11869 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11870 (match_operator:DI 1 "scc_comparison_operator"
11871 [(match_operand 2 "cc_reg_operand" "y")
11873 (set (match_operand:DI 3 "gpc_reg_operand" "=r")
11874 (match_operator:DI 4 "scc_comparison_operator"
11875 [(match_operand 5 "cc_reg_operand" "y")
11877 "TARGET_POWERPC64 && REGNO (operands[2]) != REGNO (operands[5])"
11878 "mfcr %3\;rlwinm %0,%3,%J1,1\;rlwinm %3,%3,%J4,1"
11879 [(set_attr "type" "mfcr")
11880 (set_attr "length" "12")])
11882 ;; There are some scc insns that can be done directly, without a compare.
11883 ;; These are faster because they don't involve the communications between
11884 ;; the FXU and branch units. In fact, we will be replacing all of the
11885 ;; integer scc insns here or in the portable methods in emit_store_flag.
11887 ;; Also support (neg (scc ..)) since that construct is used to replace
11888 ;; branches, (plus (scc ..) ..) since that construct is common and
11889 ;; takes no more insns than scc, and (and (neg (scc ..)) ..) in the
11890 ;; cases where it is no more expensive than (neg (scc ..)).
11892 ;; Have reload force a constant into a register for the simple insns that
11893 ;; otherwise won't accept constants. We do this because it is faster than
11894 ;; the cmp/mfcr sequence we would otherwise generate.
11896 (define_mode_attr scc_eq_op2 [(SI "rKLI")
11899 (define_insn_and_split "*eq<mode>"
11900 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
11901 (eq:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
11902 (match_operand:GPR 2 "scc_eq_operand" "<scc_eq_op2>")))]
11906 [(set (match_dup 0)
11907 (clz:GPR (match_dup 3)))
11909 (lshiftrt:GPR (match_dup 0) (match_dup 4)))]
11911 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
11913 /* Use output operand as intermediate. */
11914 operands[3] = operands[0];
11916 if (logical_operand (operands[2], <MODE>mode))
11917 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
11918 gen_rtx_XOR (<MODE>mode,
11919 operands[1], operands[2])));
11921 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
11922 gen_rtx_PLUS (<MODE>mode, operands[1],
11923 negate_rtx (<MODE>mode,
11927 operands[3] = operands[1];
11929 operands[4] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
11932 (define_insn_and_split "*eq<mode>_compare"
11933 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
11935 (eq:P (match_operand:P 1 "gpc_reg_operand" "=r")
11936 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))
11938 (set (match_operand:P 0 "gpc_reg_operand" "=r")
11939 (eq:P (match_dup 1) (match_dup 2)))]
11943 [(set (match_dup 0)
11944 (clz:P (match_dup 4)))
11945 (parallel [(set (match_dup 3)
11946 (compare:CC (lshiftrt:P (match_dup 0) (match_dup 5))
11949 (lshiftrt:P (match_dup 0) (match_dup 5)))])]
11951 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
11953 /* Use output operand as intermediate. */
11954 operands[4] = operands[0];
11956 if (logical_operand (operands[2], <MODE>mode))
11957 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
11958 gen_rtx_XOR (<MODE>mode,
11959 operands[1], operands[2])));
11961 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
11962 gen_rtx_PLUS (<MODE>mode, operands[1],
11963 negate_rtx (<MODE>mode,
11967 operands[4] = operands[1];
11969 operands[5] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
11972 ;; We have insns of the form shown by the first define_insn below. If
11973 ;; there is something inside the comparison operation, we must split it.
11975 [(set (match_operand:SI 0 "gpc_reg_operand" "")
11976 (plus:SI (match_operator 1 "comparison_operator"
11977 [(match_operand:SI 2 "" "")
11978 (match_operand:SI 3
11979 "reg_or_cint_operand" "")])
11980 (match_operand:SI 4 "gpc_reg_operand" "")))
11981 (clobber (match_operand:SI 5 "register_operand" ""))]
11982 "! gpc_reg_operand (operands[2], SImode)"
11983 [(set (match_dup 5) (match_dup 2))
11984 (set (match_dup 0) (plus:SI (match_op_dup 1 [(match_dup 5) (match_dup 3)])
11987 (define_insn "*plus_eqsi"
11988 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r")
11989 (plus:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
11990 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I"))
11991 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r")))]
11994 xor %0,%1,%2\;subfic %0,%0,0\;addze %0,%3
11995 subfic %0,%1,0\;addze %0,%3
11996 xori %0,%1,%b2\;subfic %0,%0,0\;addze %0,%3
11997 xoris %0,%1,%u2\;subfic %0,%0,0\;addze %0,%3
11998 subfic %0,%1,%2\;subfic %0,%0,0\;addze %0,%3"
11999 [(set_attr "type" "three,two,three,three,three")
12000 (set_attr "length" "12,8,12,12,12")])
12002 (define_insn "*compare_plus_eqsi"
12003 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
12006 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
12007 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
12008 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
12010 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r"))]
12011 "TARGET_32BIT && optimize_size"
12013 xor %4,%1,%2\;subfic %4,%4,0\;addze. %4,%3
12014 subfic %4,%1,0\;addze. %4,%3
12015 xori %4,%1,%b2\;subfic %4,%4,0\;addze. %4,%3
12016 xoris %4,%1,%u2\;subfic %4,%4,0\;addze. %4,%3
12017 subfic %4,%1,%2\;subfic %4,%4,0\;addze. %4,%3
12023 [(set_attr "type" "compare")
12024 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
12027 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12030 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
12031 (match_operand:SI 2 "scc_eq_operand" ""))
12032 (match_operand:SI 3 "gpc_reg_operand" ""))
12034 (clobber (match_scratch:SI 4 ""))]
12035 "TARGET_32BIT && optimize_size && reload_completed"
12036 [(set (match_dup 4)
12037 (plus:SI (eq:SI (match_dup 1)
12041 (compare:CC (match_dup 4)
12045 (define_insn "*plus_eqsi_compare"
12046 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
12049 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
12050 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
12051 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
12053 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r")
12054 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12055 "TARGET_32BIT && optimize_size"
12057 xor %0,%1,%2\;subfic %0,%0,0\;addze. %0,%3
12058 subfic %0,%1,0\;addze. %0,%3
12059 xori %0,%1,%b2\;subfic %0,%0,0\;addze. %0,%3
12060 xoris %0,%1,%u2\;subfic %0,%0,0\;addze. %0,%3
12061 subfic %0,%1,%2\;subfic %0,%0,0\;addze. %0,%3
12067 [(set_attr "type" "compare")
12068 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
12071 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12074 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
12075 (match_operand:SI 2 "scc_eq_operand" ""))
12076 (match_operand:SI 3 "gpc_reg_operand" ""))
12078 (set (match_operand:SI 0 "gpc_reg_operand" "")
12079 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12080 "TARGET_32BIT && optimize_size && reload_completed"
12081 [(set (match_dup 0)
12082 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12084 (compare:CC (match_dup 0)
12088 (define_insn "*neg_eq0<mode>"
12089 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
12090 (neg:P (eq:P (match_operand:P 1 "gpc_reg_operand" "r")
12093 "addic %0,%1,-1\;subfe %0,%0,%0"
12094 [(set_attr "type" "two")
12095 (set_attr "length" "8")])
12097 (define_insn_and_split "*neg_eq<mode>"
12098 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
12099 (neg:P (eq:P (match_operand:P 1 "gpc_reg_operand" "%r")
12100 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))))]
12104 [(set (match_dup 0) (neg:P (eq:P (match_dup 3) (const_int 0))))]
12106 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
12108 /* Use output operand as intermediate. */
12109 operands[3] = operands[0];
12111 if (logical_operand (operands[2], <MODE>mode))
12112 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
12113 gen_rtx_XOR (<MODE>mode,
12114 operands[1], operands[2])));
12116 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
12117 gen_rtx_PLUS (<MODE>mode, operands[1],
12118 negate_rtx (<MODE>mode,
12122 operands[3] = operands[1];
12125 (define_insn "*ne0_<mode>"
12126 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
12127 (ne:P (match_operand:P 1 "gpc_reg_operand" "r")
12129 (clobber (match_scratch:P 2 "=&r"))]
12130 "!(TARGET_32BIT && TARGET_ISEL)"
12131 "addic %2,%1,-1\;subfe %0,%2,%1"
12132 [(set_attr "type" "two")
12133 (set_attr "length" "8")])
12135 (define_insn "*plus_ne0_<mode>"
12136 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
12137 (plus:P (ne:P (match_operand:P 1 "gpc_reg_operand" "r")
12139 (match_operand:P 2 "gpc_reg_operand" "r")))
12140 (clobber (match_scratch:P 3 "=&r"))]
12142 "addic %3,%1,-1\;addze %0,%2"
12143 [(set_attr "type" "two")
12144 (set_attr "length" "8")])
12146 (define_insn "*compare_plus_ne0_<mode>"
12147 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12148 (compare:CC (plus:P (ne:P (match_operand:P 1 "gpc_reg_operand" "r,r")
12150 (match_operand:P 2 "gpc_reg_operand" "r,r"))
12152 (clobber (match_scratch:P 3 "=&r,&r"))
12153 (clobber (match_scratch:P 4 "=X,&r"))]
12156 addic %3,%1,-1\;addze. %3,%2
12158 [(set_attr "type" "compare")
12159 (set_attr "length" "8,12")])
12162 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
12163 (compare:CC (ne:P (match_operand:SI 1 "gpc_reg_operand" "")
12165 (neg:P (match_operand:P 2 "gpc_reg_operand" ""))))
12166 (clobber (match_scratch:P 3 ""))
12167 (clobber (match_scratch:P 4 ""))]
12169 [(parallel [(set (match_dup 3)
12170 (plus:P (ne:P (match_dup 1)
12173 (clobber (match_dup 4))])
12175 (compare:CC (match_dup 3)
12180 (define_insn "*compare_plus_ne0_<mode>_1"
12181 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
12182 (compare:CCEQ (ne:P (match_operand:P 1 "gpc_reg_operand" "r,r")
12184 (neg:P (match_operand:P 2 "gpc_reg_operand" "r,r"))))
12185 (clobber (match_scratch:P 3 "=&r,&r"))
12186 (clobber (match_scratch:P 4 "=X,&r"))]
12189 addic %3,%1,-1\;addze. %3,%2
12191 [(set_attr "type" "compare")
12192 (set_attr "length" "8,12")])
12195 [(set (match_operand:CCEQ 0 "cc_reg_not_micro_cr0_operand" "")
12196 (compare:CCEQ (ne:P (match_operand:SI 1 "gpc_reg_operand" "")
12198 (neg:P (match_operand:P 2 "gpc_reg_operand" ""))))
12199 (clobber (match_scratch:P 3 ""))
12200 (clobber (match_scratch:P 4 ""))]
12202 [(parallel [(set (match_dup 3)
12203 (plus:P (ne:P (match_dup 1)
12206 (clobber (match_dup 4))])
12208 (compare:CC (match_dup 3)
12212 (define_insn "*plus_ne0_<mode>_compare"
12213 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12215 (plus:P (ne:P (match_operand:P 1 "gpc_reg_operand" "r,r")
12217 (match_operand:P 2 "gpc_reg_operand" "r,r"))
12219 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
12220 (plus:P (ne:P (match_dup 1)
12223 (clobber (match_scratch:P 3 "=&r,&r"))]
12226 addic %3,%1,-1\;addze. %0,%2
12228 [(set_attr "type" "compare")
12229 (set_attr "length" "8,12")])
12232 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
12234 (plus:P (ne:P (match_operand:P 1 "gpc_reg_operand" "")
12236 (match_operand:P 2 "gpc_reg_operand" ""))
12238 (set (match_operand:P 0 "gpc_reg_operand" "")
12239 (plus:P (ne:P (match_dup 1)
12242 (clobber (match_scratch:P 3 ""))]
12244 [(parallel [(set (match_dup 0)
12245 (plus:P (ne:P (match_dup 1)
12248 (clobber (match_dup 3))])
12250 (compare:CC (match_dup 0)
12254 (define_insn "*leu<mode>"
12255 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
12256 (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
12257 (match_operand:P 2 "reg_or_short_operand" "rI")))]
12259 "subf%I2c %0,%1,%2\;li %0,0\;adde %0,%0,%0"
12260 [(set_attr "type" "three")
12261 (set_attr "length" "12")])
12263 (define_insn "*leu<mode>_compare"
12264 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12266 (leu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
12267 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
12269 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
12270 (leu:P (match_dup 1) (match_dup 2)))]
12273 subf%I2c %0,%1,%2\;li %0,0\;adde. %0,%0,%0
12275 [(set_attr "type" "compare")
12276 (set_attr "length" "12,16")])
12279 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12281 (leu:P (match_operand:P 1 "gpc_reg_operand" "")
12282 (match_operand:P 2 "reg_or_short_operand" ""))
12284 (set (match_operand:P 0 "gpc_reg_operand" "")
12285 (leu:P (match_dup 1) (match_dup 2)))]
12287 [(set (match_dup 0)
12288 (leu:P (match_dup 1) (match_dup 2)))
12290 (compare:CC (match_dup 0)
12294 (define_insn "*plus_leu<mode>"
12295 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
12296 (plus:P (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
12297 (match_operand:P 2 "reg_or_short_operand" "rI"))
12298 (match_operand:P 3 "gpc_reg_operand" "r")))]
12300 "subf%I2c %0,%1,%2\;addze %0,%3"
12301 [(set_attr "type" "two")
12302 (set_attr "length" "8")])
12305 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12307 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12308 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12309 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12311 (clobber (match_scratch:SI 4 "=&r,&r"))]
12314 subf%I2c %4,%1,%2\;addze. %4,%3
12316 [(set_attr "type" "compare")
12317 (set_attr "length" "8,12")])
12320 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12322 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12323 (match_operand:SI 2 "reg_or_short_operand" ""))
12324 (match_operand:SI 3 "gpc_reg_operand" ""))
12326 (clobber (match_scratch:SI 4 ""))]
12327 "TARGET_32BIT && reload_completed"
12328 [(set (match_dup 4)
12329 (plus:SI (leu:SI (match_dup 1) (match_dup 2))
12332 (compare:CC (match_dup 4)
12337 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12339 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12340 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12341 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12343 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12344 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12347 subf%I2c %0,%1,%2\;addze. %0,%3
12349 [(set_attr "type" "compare")
12350 (set_attr "length" "8,12")])
12353 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12355 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12356 (match_operand:SI 2 "reg_or_short_operand" ""))
12357 (match_operand:SI 3 "gpc_reg_operand" ""))
12359 (set (match_operand:SI 0 "gpc_reg_operand" "")
12360 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12361 "TARGET_32BIT && reload_completed"
12362 [(set (match_dup 0)
12363 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12365 (compare:CC (match_dup 0)
12369 (define_insn "*neg_leu<mode>"
12370 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
12371 (neg:P (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
12372 (match_operand:P 2 "reg_or_short_operand" "rI"))))]
12374 "subf%I2c %0,%1,%2\;subfe %0,%0,%0\;nand %0,%0,%0"
12375 [(set_attr "type" "three")
12376 (set_attr "length" "12")])
12378 (define_insn "*and_neg_leu<mode>"
12379 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
12381 (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
12382 (match_operand:P 2 "reg_or_short_operand" "rI")))
12383 (match_operand:P 3 "gpc_reg_operand" "r")))]
12385 "subf%I2c %0,%1,%2\;subfe %0,%0,%0\;andc %0,%3,%0"
12386 [(set_attr "type" "three")
12387 (set_attr "length" "12")])
12390 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12393 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12394 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
12395 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12397 (clobber (match_scratch:SI 4 "=&r,&r"))]
12400 subf%I2c %4,%1,%2\;subfe %4,%4,%4\;andc. %4,%3,%4
12402 [(set_attr "type" "compare")
12403 (set_attr "length" "12,16")])
12406 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12409 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12410 (match_operand:SI 2 "reg_or_short_operand" "")))
12411 (match_operand:SI 3 "gpc_reg_operand" ""))
12413 (clobber (match_scratch:SI 4 ""))]
12414 "TARGET_32BIT && reload_completed"
12415 [(set (match_dup 4)
12416 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
12419 (compare:CC (match_dup 4)
12424 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12427 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12428 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
12429 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12431 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12432 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12435 subf%I2c %0,%1,%2\;subfe %0,%0,%0\;andc. %0,%3,%0
12437 [(set_attr "type" "compare")
12438 (set_attr "length" "12,16")])
12441 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12444 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12445 (match_operand:SI 2 "reg_or_short_operand" "")))
12446 (match_operand:SI 3 "gpc_reg_operand" ""))
12448 (set (match_operand:SI 0 "gpc_reg_operand" "")
12449 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12450 "TARGET_32BIT && reload_completed"
12451 [(set (match_dup 0)
12452 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
12455 (compare:CC (match_dup 0)
12459 (define_insn_and_split "*ltu<mode>"
12460 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
12461 (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
12462 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))]
12466 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
12467 (set (match_dup 0) (neg:P (match_dup 0)))]
12470 (define_insn_and_split "*ltu<mode>_compare"
12471 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
12473 (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
12474 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
12476 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
12477 (ltu:P (match_dup 1) (match_dup 2)))]
12481 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
12482 (parallel [(set (match_dup 3)
12483 (compare:CC (neg:P (match_dup 0)) (const_int 0)))
12484 (set (match_dup 0) (neg:P (match_dup 0)))])]
12487 (define_insn_and_split "*plus_ltu<mode>"
12488 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,r")
12489 (plus:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
12490 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))
12491 (match_operand:P 3 "reg_or_short_operand" "rI,rI")))]
12494 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
12495 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
12496 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))]
12499 (define_insn_and_split "*plus_ltu<mode>_compare"
12500 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12502 (plus:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
12503 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
12504 (match_operand:P 3 "gpc_reg_operand" "r,r,r,r"))
12506 (set (match_operand:P 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12507 (plus:P (ltu:P (match_dup 1) (match_dup 2)) (match_dup 3)))]
12510 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
12511 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
12512 (parallel [(set (match_dup 4)
12513 (compare:CC (minus:P (match_dup 3) (match_dup 0))
12515 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))])]
12518 (define_insn "*neg_ltu<mode>"
12519 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
12520 (neg:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
12521 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))))]
12524 subfc %0,%2,%1\;subfe %0,%0,%0
12525 addic %0,%1,%n2\;subfe %0,%0,%0"
12526 [(set_attr "type" "two")
12527 (set_attr "length" "8")])
12529 (define_insn "*geu<mode>"
12530 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
12531 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
12532 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))]
12535 subfc %0,%2,%1\;li %0,0\;adde %0,%0,%0
12536 addic %0,%1,%n2\;li %0,0\;adde %0,%0,%0"
12537 [(set_attr "type" "three")
12538 (set_attr "length" "12")])
12540 (define_insn "*geu<mode>_compare"
12541 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
12543 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
12544 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
12546 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
12547 (geu:P (match_dup 1) (match_dup 2)))]
12550 subfc %0,%2,%1\;li %0,0\;adde. %0,%0,%0
12551 addic %0,%1,%n2\;li %0,0\;adde. %0,%0,%0
12554 [(set_attr "type" "compare")
12555 (set_attr "length" "12,12,16,16")])
12558 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
12560 (geu:P (match_operand:P 1 "gpc_reg_operand" "")
12561 (match_operand:P 2 "reg_or_neg_short_operand" ""))
12563 (set (match_operand:P 0 "gpc_reg_operand" "")
12564 (geu:P (match_dup 1) (match_dup 2)))]
12566 [(set (match_dup 0)
12567 (geu:P (match_dup 1) (match_dup 2)))
12569 (compare:CC (match_dup 0)
12573 (define_insn "*plus_geu<mode>"
12574 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,&r")
12575 (plus:P (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
12576 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))
12577 (match_operand:P 3 "gpc_reg_operand" "r,r")))]
12580 subfc %0,%2,%1\;addze %0,%3
12581 addic %0,%1,%n2\;addze %0,%3"
12582 [(set_attr "type" "two")
12583 (set_attr "length" "8")])
12586 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12588 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12589 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12590 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12592 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12595 subfc %4,%2,%1\;addze. %4,%3
12596 addic %4,%1,%n2\;addze. %4,%3
12599 [(set_attr "type" "compare")
12600 (set_attr "length" "8,8,12,12")])
12603 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12605 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12606 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12607 (match_operand:SI 3 "gpc_reg_operand" ""))
12609 (clobber (match_scratch:SI 4 ""))]
12610 "TARGET_32BIT && reload_completed"
12611 [(set (match_dup 4)
12612 (plus:SI (geu:SI (match_dup 1) (match_dup 2))
12615 (compare:CC (match_dup 4)
12620 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12622 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12623 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12624 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12626 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12627 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12630 subfc %0,%2,%1\;addze. %0,%3
12631 addic %0,%1,%n2\;addze. %0,%3
12634 [(set_attr "type" "compare")
12635 (set_attr "length" "8,8,12,12")])
12638 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12640 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12641 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12642 (match_operand:SI 3 "gpc_reg_operand" ""))
12644 (set (match_operand:SI 0 "gpc_reg_operand" "")
12645 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12646 "TARGET_32BIT && reload_completed"
12647 [(set (match_dup 0)
12648 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12650 (compare:CC (match_dup 0)
12654 (define_insn "*neg_geu<mode>"
12655 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
12656 (neg:P (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
12657 (match_operand:P 2 "reg_or_short_operand" "r,I"))))]
12660 subfc %0,%2,%1\;subfe %0,%0,%0\;nand %0,%0,%0
12661 subfic %0,%1,-1\;add%I2c %0,%0,%2\;subfe %0,%0,%0"
12662 [(set_attr "type" "three")
12663 (set_attr "length" "12")])
12665 (define_insn "*and_neg_geu<mode>"
12666 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,&r")
12668 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
12669 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))
12670 (match_operand:P 3 "gpc_reg_operand" "r,r")))]
12673 subfc %0,%2,%1\;subfe %0,%0,%0\;andc %0,%3,%0
12674 addic %0,%1,%n2\;subfe %0,%0,%0\;andc %0,%3,%0"
12675 [(set_attr "type" "three")
12676 (set_attr "length" "12")])
12679 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12682 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12683 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
12684 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12686 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12689 subfc %4,%2,%1\;subfe %4,%4,%4\;andc. %4,%3,%4
12690 addic %4,%1,%n2\;subfe %4,%4,%4\;andc. %4,%3,%4
12693 [(set_attr "type" "compare")
12694 (set_attr "length" "12,12,16,16")])
12697 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12700 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12701 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
12702 (match_operand:SI 3 "gpc_reg_operand" ""))
12704 (clobber (match_scratch:SI 4 ""))]
12705 "TARGET_32BIT && reload_completed"
12706 [(set (match_dup 4)
12707 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2)))
12710 (compare:CC (match_dup 4)
12715 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12718 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12719 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
12720 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12722 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12723 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12726 subfc %0,%2,%1\;subfe %0,%0,%0\;andc. %0,%3,%0
12727 addic %0,%1,%n2\;subfe %0,%0,%0\;andc. %0,%3,%0
12730 [(set_attr "type" "compare")
12731 (set_attr "length" "12,12,16,16")])
12734 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12737 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12738 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
12739 (match_operand:SI 3 "gpc_reg_operand" ""))
12741 (set (match_operand:SI 0 "gpc_reg_operand" "")
12742 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12743 "TARGET_32BIT && reload_completed"
12744 [(set (match_dup 0)
12745 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
12747 (compare:CC (match_dup 0)
12751 (define_insn "*plus_gt0<mode>"
12752 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
12753 (plus:P (gt:P (match_operand:P 1 "gpc_reg_operand" "r")
12755 (match_operand:P 2 "gpc_reg_operand" "r")))]
12757 "addc %0,%1,%1\;subfe %0,%1,%0\;addze %0,%2"
12758 [(set_attr "type" "three")
12759 (set_attr "length" "12")])
12762 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12764 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12766 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
12768 (clobber (match_scratch:SI 3 "=&r,&r"))]
12771 addc %3,%1,%1\;subfe %3,%1,%3\;addze. %3,%2
12773 [(set_attr "type" "compare")
12774 (set_attr "length" "12,16")])
12777 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12779 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12781 (match_operand:SI 2 "gpc_reg_operand" ""))
12783 (clobber (match_scratch:SI 3 ""))]
12784 "TARGET_32BIT && reload_completed"
12785 [(set (match_dup 3)
12786 (plus:SI (gt:SI (match_dup 1) (const_int 0))
12789 (compare:CC (match_dup 3)
12794 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12796 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12798 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
12800 (clobber (match_scratch:DI 3 "=&r,&r"))]
12803 addc %3,%1,%1\;subfe %3,%1,%3\;addze. %3,%2
12805 [(set_attr "type" "compare")
12806 (set_attr "length" "12,16")])
12809 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
12811 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
12813 (match_operand:DI 2 "gpc_reg_operand" ""))
12815 (clobber (match_scratch:DI 3 ""))]
12816 "TARGET_64BIT && reload_completed"
12817 [(set (match_dup 3)
12818 (plus:DI (gt:DI (match_dup 1) (const_int 0))
12821 (compare:CC (match_dup 3)
12826 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12828 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12830 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
12832 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12833 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
12836 addc %0,%1,%1\;subfe %0,%1,%0\;addze. %0,%2
12838 [(set_attr "type" "compare")
12839 (set_attr "length" "12,16")])
12842 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12844 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12846 (match_operand:SI 2 "gpc_reg_operand" ""))
12848 (set (match_operand:SI 0 "gpc_reg_operand" "")
12849 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
12850 "TARGET_32BIT && reload_completed"
12851 [(set (match_dup 0)
12852 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))
12854 (compare:CC (match_dup 0)
12859 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12861 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12863 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
12865 (set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
12866 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
12869 addc %0,%1,%1\;subfe %0,%1,%0\;addze. %0,%2
12871 [(set_attr "type" "compare")
12872 (set_attr "length" "12,16")])
12875 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
12877 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
12879 (match_operand:DI 2 "gpc_reg_operand" ""))
12881 (set (match_operand:DI 0 "gpc_reg_operand" "")
12882 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
12883 "TARGET_64BIT && reload_completed"
12884 [(set (match_dup 0)
12885 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))
12887 (compare:CC (match_dup 0)
12891 (define_insn_and_split "*gtu<mode>"
12892 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
12893 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
12894 (match_operand:P 2 "reg_or_short_operand" "rI")))]
12898 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
12899 (set (match_dup 0) (neg:P (match_dup 0)))]
12902 (define_insn_and_split "*gtu<mode>_compare"
12903 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12905 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
12906 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
12908 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
12909 (gtu:P (match_dup 1) (match_dup 2)))]
12913 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
12914 (parallel [(set (match_dup 3)
12915 (compare:CC (neg:P (match_dup 0)) (const_int 0)))
12916 (set (match_dup 0) (neg:P (match_dup 0)))])]
12919 (define_insn_and_split "*plus_gtu<mode>"
12920 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
12921 (plus:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
12922 (match_operand:P 2 "reg_or_short_operand" "rI"))
12923 (match_operand:P 3 "reg_or_short_operand" "rI")))]
12926 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
12927 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
12928 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))]
12931 (define_insn_and_split "*plus_gtu<mode>_compare"
12932 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12934 (plus:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
12935 (match_operand:P 2 "reg_or_short_operand" "I,r,I,r"))
12936 (match_operand:P 3 "gpc_reg_operand" "r,r,r,r"))
12938 (set (match_operand:P 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12939 (plus:P (gtu:P (match_dup 1) (match_dup 2)) (match_dup 3)))]
12942 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
12943 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
12944 (parallel [(set (match_dup 4)
12945 (compare:CC (minus:P (match_dup 3) (match_dup 0))
12947 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))])]
12950 (define_insn "*neg_gtu<mode>"
12951 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
12952 (neg:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
12953 (match_operand:P 2 "reg_or_short_operand" "rI"))))]
12955 "subf%I2c %0,%1,%2\;subfe %0,%0,%0"
12956 [(set_attr "type" "two")
12957 (set_attr "length" "8")])
12960 ;; Define both directions of branch and return. If we need a reload
12961 ;; register, we'd rather use CR0 since it is much easier to copy a
12962 ;; register CC value to there.
12966 (if_then_else (match_operator 1 "branch_comparison_operator"
12968 "cc_reg_operand" "y")
12970 (label_ref (match_operand 0 "" ""))
12975 return output_cbranch (operands[1], \"%l0\", 0, insn);
12977 [(set_attr "type" "branch")])
12981 (if_then_else (match_operator 0 "branch_comparison_operator"
12983 "cc_reg_operand" "y")
12990 return output_cbranch (operands[0], NULL, 0, insn);
12992 [(set_attr "type" "jmpreg")
12993 (set_attr "length" "4")])
12997 (if_then_else (match_operator 1 "branch_comparison_operator"
12999 "cc_reg_operand" "y")
13002 (label_ref (match_operand 0 "" ""))))]
13006 return output_cbranch (operands[1], \"%l0\", 1, insn);
13008 [(set_attr "type" "branch")])
13012 (if_then_else (match_operator 0 "branch_comparison_operator"
13014 "cc_reg_operand" "y")
13021 return output_cbranch (operands[0], NULL, 1, insn);
13023 [(set_attr "type" "jmpreg")
13024 (set_attr "length" "4")])
13026 ;; Logic on condition register values.
13028 ; This pattern matches things like
13029 ; (set (reg:CCEQ 68) (compare:CCEQ (ior:SI (gt:SI (reg:CCFP 68) (const_int 0))
13030 ; (eq:SI (reg:CCFP 68) (const_int 0)))
13032 ; which are generated by the branch logic.
13033 ; Prefer destructive operations where BT = BB (for crXX BT,BA,BB)
13035 (define_insn "*cceq_ior_compare"
13036 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13037 (compare:CCEQ (match_operator:SI 1 "boolean_operator"
13038 [(match_operator:SI 2
13039 "branch_positive_comparison_operator"
13041 "cc_reg_operand" "y,y")
13043 (match_operator:SI 4
13044 "branch_positive_comparison_operator"
13046 "cc_reg_operand" "0,y")
13050 "cr%q1 %E0,%j2,%j4"
13051 [(set_attr "type" "cr_logical,delayed_cr")])
13053 ; Why is the constant -1 here, but 1 in the previous pattern?
13054 ; Because ~1 has all but the low bit set.
13056 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13057 (compare:CCEQ (match_operator:SI 1 "boolean_or_operator"
13058 [(not:SI (match_operator:SI 2
13059 "branch_positive_comparison_operator"
13061 "cc_reg_operand" "y,y")
13063 (match_operator:SI 4
13064 "branch_positive_comparison_operator"
13066 "cc_reg_operand" "0,y")
13070 "cr%q1 %E0,%j2,%j4"
13071 [(set_attr "type" "cr_logical,delayed_cr")])
13073 (define_insn "*cceq_rev_compare"
13074 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13075 (compare:CCEQ (match_operator:SI 1
13076 "branch_positive_comparison_operator"
13078 "cc_reg_operand" "0,y")
13083 [(set_attr "type" "cr_logical,delayed_cr")])
13085 ;; If we are comparing the result of two comparisons, this can be done
13086 ;; using creqv or crxor.
13088 (define_insn_and_split ""
13089 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
13090 (compare:CCEQ (match_operator 1 "branch_comparison_operator"
13091 [(match_operand 2 "cc_reg_operand" "y")
13093 (match_operator 3 "branch_comparison_operator"
13094 [(match_operand 4 "cc_reg_operand" "y")
13099 [(set (match_dup 0) (compare:CCEQ (xor:SI (match_dup 1) (match_dup 3))
13103 int positive_1, positive_2;
13105 positive_1 = branch_positive_comparison_operator (operands[1],
13106 GET_MODE (operands[1]));
13107 positive_2 = branch_positive_comparison_operator (operands[3],
13108 GET_MODE (operands[3]));
13111 operands[1] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[2]),
13112 GET_CODE (operands[1])),
13114 operands[2], const0_rtx);
13115 else if (GET_MODE (operands[1]) != SImode)
13116 operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]), SImode,
13117 operands[2], const0_rtx);
13120 operands[3] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[4]),
13121 GET_CODE (operands[3])),
13123 operands[4], const0_rtx);
13124 else if (GET_MODE (operands[3]) != SImode)
13125 operands[3] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
13126 operands[4], const0_rtx);
13128 if (positive_1 == positive_2)
13130 operands[1] = gen_rtx_NOT (SImode, operands[1]);
13131 operands[5] = constm1_rtx;
13135 operands[5] = const1_rtx;
13139 ;; Unconditional branch and return.
13141 (define_insn "jump"
13143 (label_ref (match_operand 0 "" "")))]
13146 [(set_attr "type" "branch")])
13148 (define_insn "<return_str>return"
13152 [(set_attr "type" "jmpreg")])
13154 (define_expand "indirect_jump"
13155 [(set (pc) (match_operand 0 "register_operand" ""))])
13157 (define_insn "*indirect_jump<mode>"
13158 [(set (pc) (match_operand:P 0 "register_operand" "c,*l"))]
13163 [(set_attr "type" "jmpreg")])
13165 ;; Table jump for switch statements:
13166 (define_expand "tablejump"
13167 [(use (match_operand 0 "" ""))
13168 (use (label_ref (match_operand 1 "" "")))]
13173 emit_jump_insn (gen_tablejumpsi (operands[0], operands[1]));
13175 emit_jump_insn (gen_tablejumpdi (operands[0], operands[1]));
13179 (define_expand "tablejumpsi"
13180 [(set (match_dup 3)
13181 (plus:SI (match_operand:SI 0 "" "")
13183 (parallel [(set (pc) (match_dup 3))
13184 (use (label_ref (match_operand 1 "" "")))])]
13187 { operands[0] = force_reg (SImode, operands[0]);
13188 operands[2] = force_reg (SImode, gen_rtx_LABEL_REF (SImode, operands[1]));
13189 operands[3] = gen_reg_rtx (SImode);
13192 (define_expand "tablejumpdi"
13193 [(set (match_dup 4)
13194 (sign_extend:DI (match_operand:SI 0 "lwa_operand" "")))
13196 (plus:DI (match_dup 4)
13198 (parallel [(set (pc) (match_dup 3))
13199 (use (label_ref (match_operand 1 "" "")))])]
13202 { operands[2] = force_reg (DImode, gen_rtx_LABEL_REF (DImode, operands[1]));
13203 operands[3] = gen_reg_rtx (DImode);
13204 operands[4] = gen_reg_rtx (DImode);
13207 (define_insn "*tablejump<mode>_internal1"
13209 (match_operand:P 0 "register_operand" "c,*l"))
13210 (use (label_ref (match_operand 1 "" "")))]
13215 [(set_attr "type" "jmpreg")])
13222 (define_insn "group_ending_nop"
13223 [(unspec [(const_int 0)] UNSPEC_GRP_END_NOP)]
13227 if (rs6000_cpu_attr == CPU_POWER6)
13228 return \"ori 1,1,0\";
13229 return \"ori 2,2,0\";
13232 ;; Define the subtract-one-and-jump insns, starting with the template
13233 ;; so loop.c knows what to generate.
13235 (define_expand "doloop_end"
13236 [(use (match_operand 0 "" "")) ; loop pseudo
13237 (use (match_operand 1 "" "")) ; iterations; zero if unknown
13238 (use (match_operand 2 "" "")) ; max iterations
13239 (use (match_operand 3 "" "")) ; loop level
13240 (use (match_operand 4 "" "")) ; label
13241 (use (match_operand 5 "" ""))] ; flag: 1 if loop entered at top, else 0
13245 /* Only use this on innermost loops. */
13246 if (INTVAL (operands[3]) > 1)
13250 if (GET_MODE (operands[0]) != DImode)
13252 emit_jump_insn (gen_ctrdi (operands[0], operands[4]));
13256 if (GET_MODE (operands[0]) != SImode)
13258 emit_jump_insn (gen_ctrsi (operands[0], operands[4]));
13263 (define_expand "ctr<mode>"
13264 [(parallel [(set (pc)
13265 (if_then_else (ne (match_operand:P 0 "register_operand" "")
13267 (label_ref (match_operand 1 "" ""))
13270 (plus:P (match_dup 0)
13272 (clobber (match_scratch:CC 2 ""))
13273 (clobber (match_scratch:P 3 ""))])]
13277 ;; We need to be able to do this for any operand, including MEM, or we
13278 ;; will cause reload to blow up since we don't allow output reloads on
13280 ;; For the length attribute to be calculated correctly, the
13281 ;; label MUST be operand 0.
13283 (define_insn "*ctr<mode>_internal1"
13285 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
13287 (label_ref (match_operand 0 "" ""))
13289 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*c*l")
13290 (plus:P (match_dup 1)
13292 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
13293 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
13297 if (which_alternative != 0)
13299 else if (get_attr_length (insn) == 4)
13300 return \"bdnz %l0\";
13302 return \"bdz $+8\;b %l0\";
13304 [(set_attr "type" "branch")
13305 (set_attr "length" "*,12,16,16")])
13307 (define_insn "*ctr<mode>_internal2"
13309 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
13312 (label_ref (match_operand 0 "" ""))))
13313 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*c*l")
13314 (plus:P (match_dup 1)
13316 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
13317 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
13321 if (which_alternative != 0)
13323 else if (get_attr_length (insn) == 4)
13324 return \"bdz %l0\";
13326 return \"bdnz $+8\;b %l0\";
13328 [(set_attr "type" "branch")
13329 (set_attr "length" "*,12,16,16")])
13331 ;; Similar but use EQ
13333 (define_insn "*ctr<mode>_internal5"
13335 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
13337 (label_ref (match_operand 0 "" ""))
13339 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*c*l")
13340 (plus:P (match_dup 1)
13342 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
13343 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
13347 if (which_alternative != 0)
13349 else if (get_attr_length (insn) == 4)
13350 return \"bdz %l0\";
13352 return \"bdnz $+8\;b %l0\";
13354 [(set_attr "type" "branch")
13355 (set_attr "length" "*,12,16,16")])
13357 (define_insn "*ctr<mode>_internal6"
13359 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
13362 (label_ref (match_operand 0 "" ""))))
13363 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*c*l")
13364 (plus:P (match_dup 1)
13366 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
13367 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
13371 if (which_alternative != 0)
13373 else if (get_attr_length (insn) == 4)
13374 return \"bdnz %l0\";
13376 return \"bdz $+8\;b %l0\";
13378 [(set_attr "type" "branch")
13379 (set_attr "length" "*,12,16,16")])
13381 ;; Now the splitters if we could not allocate the CTR register
13385 (if_then_else (match_operator 2 "comparison_operator"
13386 [(match_operand:P 1 "gpc_reg_operand" "")
13388 (match_operand 5 "" "")
13389 (match_operand 6 "" "")))
13390 (set (match_operand:P 0 "gpc_reg_operand" "")
13391 (plus:P (match_dup 1) (const_int -1)))
13392 (clobber (match_scratch:CC 3 ""))
13393 (clobber (match_scratch:P 4 ""))]
13395 [(parallel [(set (match_dup 3)
13396 (compare:CC (plus:P (match_dup 1)
13400 (plus:P (match_dup 1)
13402 (set (pc) (if_then_else (match_dup 7)
13406 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
13407 operands[3], const0_rtx); }")
13411 (if_then_else (match_operator 2 "comparison_operator"
13412 [(match_operand:P 1 "gpc_reg_operand" "")
13414 (match_operand 5 "" "")
13415 (match_operand 6 "" "")))
13416 (set (match_operand:P 0 "nonimmediate_operand" "")
13417 (plus:P (match_dup 1) (const_int -1)))
13418 (clobber (match_scratch:CC 3 ""))
13419 (clobber (match_scratch:P 4 ""))]
13420 "reload_completed && ! gpc_reg_operand (operands[0], SImode)"
13421 [(parallel [(set (match_dup 3)
13422 (compare:CC (plus:P (match_dup 1)
13426 (plus:P (match_dup 1)
13430 (set (pc) (if_then_else (match_dup 7)
13434 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
13435 operands[3], const0_rtx); }")
13437 (define_insn "trap"
13438 [(trap_if (const_int 1) (const_int 0))]
13441 [(set_attr "type" "trap")])
13443 (define_expand "ctrap<mode>4"
13444 [(trap_if (match_operator 0 "ordered_comparison_operator"
13445 [(match_operand:GPR 1 "register_operand")
13446 (match_operand:GPR 2 "reg_or_short_operand")])
13447 (match_operand 3 "zero_constant" ""))]
13452 [(trap_if (match_operator 0 "ordered_comparison_operator"
13453 [(match_operand:GPR 1 "register_operand" "r")
13454 (match_operand:GPR 2 "reg_or_short_operand" "rI")])
13457 "t<wd>%V0%I2 %1,%2"
13458 [(set_attr "type" "trap")])
13460 ;; Insns related to generating the function prologue and epilogue.
13462 (define_expand "prologue"
13463 [(use (const_int 0))]
13466 rs6000_emit_prologue ();
13467 if (!TARGET_SCHED_PROLOG)
13468 emit_insn (gen_blockage ());
13472 (define_insn "*movesi_from_cr_one"
13473 [(match_parallel 0 "mfcr_operation"
13474 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
13475 (unspec:SI [(match_operand:CC 2 "cc_reg_operand" "y")
13476 (match_operand 3 "immediate_operand" "n")]
13477 UNSPEC_MOVESI_FROM_CR))])]
13483 for (i = 0; i < XVECLEN (operands[0], 0); i++)
13485 mask = INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
13486 operands[4] = GEN_INT (mask);
13487 output_asm_insn (\"mfcr %1,%4\", operands);
13491 [(set_attr "type" "mfcrf")])
13493 (define_insn "movesi_from_cr"
13494 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13495 (unspec:SI [(reg:CC CR0_REGNO) (reg:CC CR1_REGNO)
13496 (reg:CC CR2_REGNO) (reg:CC CR3_REGNO)
13497 (reg:CC CR4_REGNO) (reg:CC CR5_REGNO)
13498 (reg:CC CR6_REGNO) (reg:CC CR7_REGNO)]
13499 UNSPEC_MOVESI_FROM_CR))]
13502 [(set_attr "type" "mfcr")])
13504 (define_insn "*stmw"
13505 [(match_parallel 0 "stmw_operation"
13506 [(set (match_operand:SI 1 "memory_operand" "=m")
13507 (match_operand:SI 2 "gpc_reg_operand" "r"))])]
13510 [(set_attr "type" "store_ux")])
13512 ; The following comment applies to:
13516 ; return_and_restore_gpregs*
13517 ; return_and_restore_fpregs*
13518 ; return_and_restore_fpregs_aix*
13520 ; The out-of-line save / restore functions expects one input argument.
13521 ; Since those are not standard call_insn's, we must avoid using
13522 ; MATCH_OPERAND for that argument. That way the register rename
13523 ; optimization will not try to rename this register.
13524 ; Each pattern is repeated for each possible register number used in
13525 ; various ABIs (r11, r1, and for some functions r12)
13527 (define_insn "*save_gpregs_<mode>_r11"
13528 [(match_parallel 0 "any_parallel_operand"
13529 [(clobber (reg:P 65))
13530 (use (match_operand:P 1 "symbol_ref_operand" "s"))
13532 (set (match_operand:P 2 "memory_operand" "=m")
13533 (match_operand:P 3 "gpc_reg_operand" "r"))])]
13536 [(set_attr "type" "branch")
13537 (set_attr "length" "4")])
13539 (define_insn "*save_gpregs_<mode>_r12"
13540 [(match_parallel 0 "any_parallel_operand"
13541 [(clobber (reg:P 65))
13542 (use (match_operand:P 1 "symbol_ref_operand" "s"))
13544 (set (match_operand:P 2 "memory_operand" "=m")
13545 (match_operand:P 3 "gpc_reg_operand" "r"))])]
13548 [(set_attr "type" "branch")
13549 (set_attr "length" "4")])
13551 (define_insn "*save_gpregs_<mode>_r1"
13552 [(match_parallel 0 "any_parallel_operand"
13553 [(clobber (reg:P 65))
13554 (use (match_operand:P 1 "symbol_ref_operand" "s"))
13556 (set (match_operand:P 2 "memory_operand" "=m")
13557 (match_operand:P 3 "gpc_reg_operand" "r"))])]
13560 [(set_attr "type" "branch")
13561 (set_attr "length" "4")])
13563 (define_insn "*save_fpregs_<mode>_r11"
13564 [(match_parallel 0 "any_parallel_operand"
13565 [(clobber (reg:P 65))
13566 (use (match_operand:P 1 "symbol_ref_operand" "s"))
13568 (set (match_operand:DF 2 "memory_operand" "=m")
13569 (match_operand:DF 3 "gpc_reg_operand" "d"))])]
13572 [(set_attr "type" "branch")
13573 (set_attr "length" "4")])
13575 (define_insn "*save_fpregs_<mode>_r12"
13576 [(match_parallel 0 "any_parallel_operand"
13577 [(clobber (reg:P 65))
13578 (use (match_operand:P 1 "symbol_ref_operand" "s"))
13580 (set (match_operand:DF 2 "memory_operand" "=m")
13581 (match_operand:DF 3 "gpc_reg_operand" "d"))])]
13584 [(set_attr "type" "branch")
13585 (set_attr "length" "4")])
13587 (define_insn "*save_fpregs_<mode>_r1"
13588 [(match_parallel 0 "any_parallel_operand"
13589 [(clobber (reg:P 65))
13590 (use (match_operand:P 1 "symbol_ref_operand" "s"))
13592 (set (match_operand:DF 2 "memory_operand" "=m")
13593 (match_operand:DF 3 "gpc_reg_operand" "d"))])]
13596 [(set_attr "type" "branch")
13597 (set_attr "length" "4")])
13599 ; This is to explain that changes to the stack pointer should
13600 ; not be moved over loads from or stores to stack memory.
13601 (define_insn "stack_tie"
13602 [(match_parallel 0 "tie_operand"
13603 [(set (mem:BLK (reg 1)) (const_int 0))])]
13606 [(set_attr "length" "0")])
13608 (define_expand "epilogue"
13609 [(use (const_int 0))]
13612 if (!TARGET_SCHED_PROLOG)
13613 emit_insn (gen_blockage ());
13614 rs6000_emit_epilogue (FALSE);
13618 ; On some processors, doing the mtcrf one CC register at a time is
13619 ; faster (like on the 604e). On others, doing them all at once is
13620 ; faster; for instance, on the 601 and 750.
13622 (define_expand "movsi_to_cr_one"
13623 [(set (match_operand:CC 0 "cc_reg_operand" "")
13624 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "")
13625 (match_dup 2)] UNSPEC_MOVESI_TO_CR))]
13627 "operands[2] = GEN_INT (1 << (75 - REGNO (operands[0])));")
13629 (define_insn "*movsi_to_cr"
13630 [(match_parallel 0 "mtcrf_operation"
13631 [(set (match_operand:CC 1 "cc_reg_operand" "=y")
13632 (unspec:CC [(match_operand:SI 2 "gpc_reg_operand" "r")
13633 (match_operand 3 "immediate_operand" "n")]
13634 UNSPEC_MOVESI_TO_CR))])]
13640 for (i = 0; i < XVECLEN (operands[0], 0); i++)
13641 mask |= INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
13642 operands[4] = GEN_INT (mask);
13643 return \"mtcrf %4,%2\";
13645 [(set_attr "type" "mtcr")])
13647 (define_insn "*mtcrfsi"
13648 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
13649 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
13650 (match_operand 2 "immediate_operand" "n")]
13651 UNSPEC_MOVESI_TO_CR))]
13652 "GET_CODE (operands[0]) == REG
13653 && CR_REGNO_P (REGNO (operands[0]))
13654 && GET_CODE (operands[2]) == CONST_INT
13655 && INTVAL (operands[2]) == 1 << (75 - REGNO (operands[0]))"
13657 [(set_attr "type" "mtcr")])
13659 ; The load-multiple instructions have similar properties.
13660 ; Note that "load_multiple" is a name known to the machine-independent
13661 ; code that actually corresponds to the PowerPC load-string.
13663 (define_insn "*lmw"
13664 [(match_parallel 0 "lmw_operation"
13665 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
13666 (match_operand:SI 2 "memory_operand" "m"))])]
13669 [(set_attr "type" "load_ux")
13670 (set_attr "cell_micro" "always")])
13672 (define_insn "*return_internal_<mode>"
13674 (use (match_operand:P 0 "register_operand" "lc"))]
13677 [(set_attr "type" "jmpreg")])
13679 ; FIXME: This would probably be somewhat simpler if the Cygnus sibcall
13680 ; stuff was in GCC. Oh, and "any_parallel_operand" is a bit flexible...
13682 ; The following comment applies to:
13686 ; return_and_restore_gpregs*
13687 ; return_and_restore_fpregs*
13688 ; return_and_restore_fpregs_aix*
13690 ; The out-of-line save / restore functions expects one input argument.
13691 ; Since those are not standard call_insn's, we must avoid using
13692 ; MATCH_OPERAND for that argument. That way the register rename
13693 ; optimization will not try to rename this register.
13694 ; Each pattern is repeated for each possible register number used in
13695 ; various ABIs (r11, r1, and for some functions r12)
13697 (define_insn "*restore_gpregs_<mode>_r11"
13698 [(match_parallel 0 "any_parallel_operand"
13699 [(clobber (match_operand:P 1 "register_operand" "=l"))
13700 (use (match_operand:P 2 "symbol_ref_operand" "s"))
13702 (set (match_operand:P 3 "gpc_reg_operand" "=r")
13703 (match_operand:P 4 "memory_operand" "m"))])]
13706 [(set_attr "type" "branch")
13707 (set_attr "length" "4")])
13709 (define_insn "*restore_gpregs_<mode>_r12"
13710 [(match_parallel 0 "any_parallel_operand"
13711 [(clobber (match_operand:P 1 "register_operand" "=l"))
13712 (use (match_operand:P 2 "symbol_ref_operand" "s"))
13714 (set (match_operand:P 3 "gpc_reg_operand" "=r")
13715 (match_operand:P 4 "memory_operand" "m"))])]
13718 [(set_attr "type" "branch")
13719 (set_attr "length" "4")])
13721 (define_insn "*restore_gpregs_<mode>_r1"
13722 [(match_parallel 0 "any_parallel_operand"
13723 [(clobber (match_operand:P 1 "register_operand" "=l"))
13724 (use (match_operand:P 2 "symbol_ref_operand" "s"))
13726 (set (match_operand:P 3 "gpc_reg_operand" "=r")
13727 (match_operand:P 4 "memory_operand" "m"))])]
13730 [(set_attr "type" "branch")
13731 (set_attr "length" "4")])
13733 (define_insn "*return_and_restore_gpregs_<mode>_r11"
13734 [(match_parallel 0 "any_parallel_operand"
13736 (clobber (match_operand:P 1 "register_operand" "=l"))
13737 (use (match_operand:P 2 "symbol_ref_operand" "s"))
13739 (set (match_operand:P 3 "gpc_reg_operand" "=r")
13740 (match_operand:P 4 "memory_operand" "m"))])]
13743 [(set_attr "type" "branch")
13744 (set_attr "length" "4")])
13746 (define_insn "*return_and_restore_gpregs_<mode>_r12"
13747 [(match_parallel 0 "any_parallel_operand"
13749 (clobber (match_operand:P 1 "register_operand" "=l"))
13750 (use (match_operand:P 2 "symbol_ref_operand" "s"))
13752 (set (match_operand:P 3 "gpc_reg_operand" "=r")
13753 (match_operand:P 4 "memory_operand" "m"))])]
13756 [(set_attr "type" "branch")
13757 (set_attr "length" "4")])
13759 (define_insn "*return_and_restore_gpregs_<mode>_r1"
13760 [(match_parallel 0 "any_parallel_operand"
13762 (clobber (match_operand:P 1 "register_operand" "=l"))
13763 (use (match_operand:P 2 "symbol_ref_operand" "s"))
13765 (set (match_operand:P 3 "gpc_reg_operand" "=r")
13766 (match_operand:P 4 "memory_operand" "m"))])]
13769 [(set_attr "type" "branch")
13770 (set_attr "length" "4")])
13772 (define_insn "*return_and_restore_fpregs_<mode>_r11"
13773 [(match_parallel 0 "any_parallel_operand"
13775 (clobber (match_operand:P 1 "register_operand" "=l"))
13776 (use (match_operand:P 2 "symbol_ref_operand" "s"))
13778 (set (match_operand:DF 3 "gpc_reg_operand" "=d")
13779 (match_operand:DF 4 "memory_operand" "m"))])]
13782 [(set_attr "type" "branch")
13783 (set_attr "length" "4")])
13785 (define_insn "*return_and_restore_fpregs_<mode>_r12"
13786 [(match_parallel 0 "any_parallel_operand"
13788 (clobber (match_operand:P 1 "register_operand" "=l"))
13789 (use (match_operand:P 2 "symbol_ref_operand" "s"))
13791 (set (match_operand:DF 3 "gpc_reg_operand" "=d")
13792 (match_operand:DF 4 "memory_operand" "m"))])]
13795 [(set_attr "type" "branch")
13796 (set_attr "length" "4")])
13798 (define_insn "*return_and_restore_fpregs_<mode>_r1"
13799 [(match_parallel 0 "any_parallel_operand"
13801 (clobber (match_operand:P 1 "register_operand" "=l"))
13802 (use (match_operand:P 2 "symbol_ref_operand" "s"))
13804 (set (match_operand:DF 3 "gpc_reg_operand" "=d")
13805 (match_operand:DF 4 "memory_operand" "m"))])]
13808 [(set_attr "type" "branch")
13809 (set_attr "length" "4")])
13811 (define_insn "*return_and_restore_fpregs_aix_<mode>_r11"
13812 [(match_parallel 0 "any_parallel_operand"
13814 (use (match_operand:P 1 "register_operand" "l"))
13815 (use (match_operand:P 2 "symbol_ref_operand" "s"))
13817 (set (match_operand:DF 3 "gpc_reg_operand" "=d")
13818 (match_operand:DF 4 "memory_operand" "m"))])]
13821 [(set_attr "type" "branch")
13822 (set_attr "length" "4")])
13824 (define_insn "*return_and_restore_fpregs_aix_<mode>_r1"
13825 [(match_parallel 0 "any_parallel_operand"
13827 (use (match_operand:P 1 "register_operand" "l"))
13828 (use (match_operand:P 2 "symbol_ref_operand" "s"))
13830 (set (match_operand:DF 3 "gpc_reg_operand" "=d")
13831 (match_operand:DF 4 "memory_operand" "m"))])]
13834 [(set_attr "type" "branch")
13835 (set_attr "length" "4")])
13837 ; This is used in compiling the unwind routines.
13838 (define_expand "eh_return"
13839 [(use (match_operand 0 "general_operand" ""))]
13844 emit_insn (gen_eh_set_lr_si (operands[0]));
13846 emit_insn (gen_eh_set_lr_di (operands[0]));
13850 ; We can't expand this before we know where the link register is stored.
13851 (define_insn "eh_set_lr_<mode>"
13852 [(unspec_volatile [(match_operand:P 0 "register_operand" "r")]
13854 (clobber (match_scratch:P 1 "=&b"))]
13859 [(unspec_volatile [(match_operand 0 "register_operand" "")] UNSPECV_EH_RR)
13860 (clobber (match_scratch 1 ""))]
13865 rs6000_emit_eh_reg_restore (operands[0], operands[1]);
13869 (define_insn "prefetch"
13870 [(prefetch (match_operand 0 "indexed_or_indirect_address" "a")
13871 (match_operand:SI 1 "const_int_operand" "n")
13872 (match_operand:SI 2 "const_int_operand" "n"))]
13876 if (GET_CODE (operands[0]) == REG)
13877 return INTVAL (operands[1]) ? \"dcbtst 0,%0\" : \"dcbt 0,%0\";
13878 return INTVAL (operands[1]) ? \"dcbtst %a0\" : \"dcbt %a0\";
13880 [(set_attr "type" "load")])
13882 (define_insn "bpermd_<mode>"
13883 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13884 (unspec:P [(match_operand:P 1 "gpc_reg_operand" "r")
13885 (match_operand:P 2 "gpc_reg_operand" "r")] UNSPEC_BPERM))]
13888 [(set_attr "type" "integer")])
13891 ;; Builtin fma support. Handle
13892 ;; Note that the conditions for expansion are in the FMA_F iterator.
13894 (define_expand "fma<mode>4"
13895 [(set (match_operand:FMA_F 0 "register_operand" "")
13897 (match_operand:FMA_F 1 "register_operand" "")
13898 (match_operand:FMA_F 2 "register_operand" "")
13899 (match_operand:FMA_F 3 "register_operand" "")))]
13903 ; Altivec only has fma and nfms.
13904 (define_expand "fms<mode>4"
13905 [(set (match_operand:FMA_F 0 "register_operand" "")
13907 (match_operand:FMA_F 1 "register_operand" "")
13908 (match_operand:FMA_F 2 "register_operand" "")
13909 (neg:FMA_F (match_operand:FMA_F 3 "register_operand" ""))))]
13910 "!VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
13913 ;; If signed zeros are ignored, -(a * b - c) = -a * b + c.
13914 (define_expand "fnma<mode>4"
13915 [(set (match_operand:FMA_F 0 "register_operand" "")
13918 (match_operand:FMA_F 1 "register_operand" "")
13919 (match_operand:FMA_F 2 "register_operand" "")
13920 (neg:FMA_F (match_operand:FMA_F 3 "register_operand" "")))))]
13921 "!HONOR_SIGNED_ZEROS (<MODE>mode)"
13924 ;; If signed zeros are ignored, -(a * b + c) = -a * b - c.
13925 (define_expand "fnms<mode>4"
13926 [(set (match_operand:FMA_F 0 "register_operand" "")
13929 (match_operand:FMA_F 1 "register_operand" "")
13930 (match_operand:FMA_F 2 "register_operand" "")
13931 (match_operand:FMA_F 3 "register_operand" ""))))]
13932 "!HONOR_SIGNED_ZEROS (<MODE>mode) && !VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
13935 ; Not an official optab name, but used from builtins.
13936 (define_expand "nfma<mode>4"
13937 [(set (match_operand:FMA_F 0 "register_operand" "")
13940 (match_operand:FMA_F 1 "register_operand" "")
13941 (match_operand:FMA_F 2 "register_operand" "")
13942 (match_operand:FMA_F 3 "register_operand" ""))))]
13943 "!VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
13946 ; Not an official optab name, but used from builtins.
13947 (define_expand "nfms<mode>4"
13948 [(set (match_operand:FMA_F 0 "register_operand" "")
13951 (match_operand:FMA_F 1 "register_operand" "")
13952 (match_operand:FMA_F 2 "register_operand" "")
13953 (neg:FMA_F (match_operand:FMA_F 3 "register_operand" "")))))]
13957 (define_expand "rs6000_get_timebase"
13958 [(use (match_operand:DI 0 "gpc_reg_operand" ""))]
13961 if (TARGET_POWERPC64)
13962 emit_insn (gen_rs6000_mftb_di (operands[0]));
13964 emit_insn (gen_rs6000_get_timebase_ppc32 (operands[0]));
13968 (define_insn "rs6000_get_timebase_ppc32"
13969 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13970 (unspec_volatile:DI [(const_int 0)] UNSPECV_MFTB))
13971 (clobber (match_scratch:SI 1 "=r"))
13972 (clobber (match_scratch:CC 2 "=y"))]
13973 "!TARGET_POWERPC64"
13975 if (WORDS_BIG_ENDIAN)
13978 return "mfspr %0,269\;"
13986 return "mftbu %0\;"
13995 return "mfspr %L0,269\;"
14003 return "mftbu %L0\;"
14011 (define_insn "rs6000_mftb_<mode>"
14012 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
14013 (unspec_volatile:P [(const_int 0)] UNSPECV_MFTB))]
14017 return "mfspr %0,268";
14024 (include "sync.md")
14025 (include "vector.md")
14027 (include "altivec.md")
14030 (include "paired.md")