1 ;; Machine description for IBM RISC System 6000 (POWER) for GNU C compiler
2 ;; Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
3 ;; 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
4 ;; Free Software Foundation, Inc.
5 ;; Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
7 ;; This file is part of GCC.
9 ;; GCC is free software; you can redistribute it and/or modify it
10 ;; under the terms of the GNU General Public License as published
11 ;; by the Free Software Foundation; either version 3, or (at your
12 ;; option) any later version.
14 ;; GCC is distributed in the hope that it will be useful, but WITHOUT
15 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
17 ;; License for more details.
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GCC; see the file COPYING3. If not see
21 ;; <http://www.gnu.org/licenses/>.
23 ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
30 [(STACK_POINTER_REGNUM 1)
32 (STATIC_CHAIN_REGNUM 11)
33 (HARD_FRAME_POINTER_REGNUM 31)
37 (ARG_POINTER_REGNUM 67)
48 (FIRST_ALTIVEC_REGNO 77)
49 (LAST_ALTIVEC_REGNO 108)
54 (FRAME_POINTER_REGNUM 113)
56 ; ABI defined stack offsets for storing the TOC pointer with AIX calls.
57 (TOC_SAVE_OFFSET_32BIT 20)
58 (TOC_SAVE_OFFSET_64BIT 40)
60 ; Function TOC offset in the AIX function descriptor.
61 (AIX_FUNC_DESC_TOC_32BIT 4)
62 (AIX_FUNC_DESC_TOC_64BIT 8)
64 ; Static chain offset in the AIX function descriptor.
65 (AIX_FUNC_DESC_SC_32BIT 8)
66 (AIX_FUNC_DESC_SC_64BIT 16)
73 (define_c_enum "unspec"
74 [UNSPEC_FRSP ; frsp for POWER machines
75 UNSPEC_PROBE_STACK ; probe stack memory reference
76 UNSPEC_TIE ; tie stack contents and stack pointer
77 UNSPEC_TOCPTR ; address of a word pointing to the TOC
78 UNSPEC_TOC ; address of the TOC (more-or-less)
80 UNSPEC_MV_CR_OV ; move_from_CR_ov_bit
86 UNSPEC_LD_MPIC ; load_macho_picbase
87 UNSPEC_MPIC_CORRECT ; macho_correct_pic
101 UNSPEC_FIX_TRUNC_TF ; fadd, rounding towards zero
102 UNSPEC_MV_CR_GT ; move_from_CR_gt_bit
120 UNSPEC_MACHOPIC_OFFSET
133 ;; UNSPEC_VOLATILE usage
136 (define_c_enum "unspecv"
138 UNSPECV_LL ; load-locked
139 UNSPECV_SC ; store-conditional
140 UNSPECV_PROBE_STACK_RANGE ; probe range of stack addresses
141 UNSPECV_EH_RR ; eh_reg_restore
142 UNSPECV_ISYNC ; isync instruction
146 ;; Define an insn type attribute. This is used in function unit delay
148 (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"
149 (const_string "integer"))
151 ;; Define floating point instruction sub-types for use with Xfpu.md
152 (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"))
154 ;; Length (in bytes).
155 ; '(pc)' in the following doesn't include the instruction itself; it is
156 ; calculated as if the instruction had zero size.
157 (define_attr "length" ""
158 (if_then_else (eq_attr "type" "branch")
159 (if_then_else (and (ge (minus (match_dup 0) (pc))
161 (lt (minus (match_dup 0) (pc))
167 ;; Processor type -- this attribute must exactly match the processor_type
168 ;; enumeration in rs6000.h.
170 (define_attr "cpu" "rios1,rios2,rs64a,mpccore,ppc403,ppc405,ppc440,ppc476,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630,ppc750,ppc7400,ppc7450,ppc8540,ppce300c2,ppce300c3,ppce500mc,ppce500mc64,power4,power5,power6,power7,cell,ppca2,titan"
171 (const (symbol_ref "rs6000_cpu_attr")))
174 ;; If this instruction is microcoded on the CELL processor
175 ; The default for load extended, the recorded instructions and rotate/shifts by a variable is always microcoded
176 (define_attr "cell_micro" "not,conditional,always"
177 (if_then_else (eq_attr "type" "compare,delayed_compare,imul_compare,lmul_compare,load_ext,load_ext_ux,var_shift_rotate,var_delayed_compare")
178 (const_string "always")
179 (const_string "not")))
181 (automata_option "ndfa")
195 (include "e300c2c3.md")
196 (include "e500mc.md")
197 (include "e500mc64.md")
198 (include "power4.md")
199 (include "power5.md")
200 (include "power6.md")
201 (include "power7.md")
207 (include "predicates.md")
208 (include "constraints.md")
210 (include "darwin.md")
215 ; This mode iterator allows :GPR to be used to indicate the allowable size
216 ; of whole values in GPRs.
217 (define_mode_iterator GPR [SI (DI "TARGET_POWERPC64")])
219 ; Any supported integer mode.
220 (define_mode_iterator INT [QI HI SI DI TI])
222 ; Any supported integer mode that fits in one register.
223 (define_mode_iterator INT1 [QI HI SI (DI "TARGET_POWERPC64")])
225 ; extend modes for DImode
226 (define_mode_iterator QHSI [QI HI SI])
228 ; SImode or DImode, even if DImode doesn't fit in GPRs.
229 (define_mode_iterator SDI [SI DI])
231 ; The size of a pointer. Also, the size of the value that a record-condition
232 ; (one with a '.') will compare; and the size used for arithmetic carries.
233 (define_mode_iterator P [(SI "TARGET_32BIT") (DI "TARGET_64BIT")])
235 ; Any hardware-supported floating-point mode
236 (define_mode_iterator FP [
237 (SF "TARGET_HARD_FLOAT
238 && ((TARGET_FPRS && TARGET_SINGLE_FLOAT) || TARGET_E500_SINGLE)")
239 (DF "TARGET_HARD_FLOAT
240 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)")
241 (TF "!TARGET_IEEEQUAD
243 && (TARGET_FPRS || TARGET_E500_DOUBLE)
244 && TARGET_LONG_DOUBLE_128")
248 ; Any fma capable floating-point mode.
249 (define_mode_iterator FMA_F [
250 (SF "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT")
251 (DF "(TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT)
252 || VECTOR_UNIT_VSX_P (DFmode)")
253 (V2SF "TARGET_PAIRED_FLOAT")
254 (V4SF "VECTOR_UNIT_ALTIVEC_OR_VSX_P (V4SFmode)")
255 (V2DF "VECTOR_UNIT_ALTIVEC_OR_VSX_P (V2DFmode)")
258 ; These modes do not fit in integer registers in 32-bit mode.
259 ; but on e500v2, the gpr are 64 bit registers
260 (define_mode_iterator DIFD [DI (DF "!TARGET_E500_DOUBLE") DD])
262 ; Iterator for reciprocal estimate instructions
263 (define_mode_iterator RECIPF [SF DF V4SF V2DF])
265 ; Iterator for just SF/DF
266 (define_mode_iterator SFDF [SF DF])
268 ; Conditional returns.
269 (define_code_iterator any_return [return simple_return])
270 (define_code_attr return_pred [(return "direct_return ()")
272 (define_code_attr return_str [(return "") (simple_return "simple_")])
274 ; Various instructions that come in SI and DI forms.
275 ; A generic w/d attribute, for things like cmpw/cmpd.
276 (define_mode_attr wd [(QI "b") (HI "h") (SI "w") (DI "d")])
279 (define_mode_attr dbits [(QI "56") (HI "48") (SI "32")])
281 ;; ISEL/ISEL64 target selection
282 (define_mode_attr sel [(SI "") (DI "64")])
284 ;; Suffix for reload patterns
285 (define_mode_attr ptrsize [(SI "32bit")
288 (define_mode_attr tptrsize [(SI "TARGET_32BIT")
289 (DI "TARGET_64BIT")])
291 (define_mode_attr mptrsize [(SI "si")
294 (define_mode_attr ptrload [(SI "{l|lwz}")
297 (define_mode_attr rreg [(SF "f")
302 (define_mode_attr rreg2 [(SF "f")
305 (define_mode_attr SI_CONVERT_FP [(SF "TARGET_FCFIDS")
306 (DF "TARGET_FCFID")])
308 (define_mode_attr E500_CONVERT [(SF "!TARGET_FPRS")
309 (DF "TARGET_E500_DOUBLE")])
311 (define_mode_attr TARGET_FLOAT [(SF "TARGET_SINGLE_FLOAT")
312 (DF "TARGET_DOUBLE_FLOAT")])
314 ;; Start with fixed-point load and store insns. Here we put only the more
315 ;; complex forms. Basic data transfer is done later.
317 (define_expand "zero_extend<mode>di2"
318 [(set (match_operand:DI 0 "gpc_reg_operand" "")
319 (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "")))]
323 (define_insn "*zero_extend<mode>di2_internal1"
324 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
325 (zero_extend:DI (match_operand:QHSI 1 "reg_or_mem_operand" "m,r")))]
329 rldicl %0,%1,0,<dbits>"
330 [(set_attr "type" "load,*")])
332 (define_insn "*zero_extend<mode>di2_internal2"
333 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
334 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "r,r"))
336 (clobber (match_scratch:DI 2 "=r,r"))]
339 rldicl. %2,%1,0,<dbits>
341 [(set_attr "type" "compare")
342 (set_attr "length" "4,8")])
345 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
346 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" ""))
348 (clobber (match_scratch:DI 2 ""))]
349 "TARGET_POWERPC64 && reload_completed"
351 (zero_extend:DI (match_dup 1)))
353 (compare:CC (match_dup 2)
357 (define_insn "*zero_extend<mode>di2_internal3"
358 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
359 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "r,r"))
361 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
362 (zero_extend:DI (match_dup 1)))]
365 rldicl. %0,%1,0,<dbits>
367 [(set_attr "type" "compare")
368 (set_attr "length" "4,8")])
371 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
372 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" ""))
374 (set (match_operand:DI 0 "gpc_reg_operand" "")
375 (zero_extend:DI (match_dup 1)))]
376 "TARGET_POWERPC64 && reload_completed"
378 (zero_extend:DI (match_dup 1)))
380 (compare:CC (match_dup 0)
384 (define_insn "extendqidi2"
385 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
386 (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r")))]
389 [(set_attr "type" "exts")])
392 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
393 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
395 (clobber (match_scratch:DI 2 "=r,r"))]
400 [(set_attr "type" "compare")
401 (set_attr "length" "4,8")])
404 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
405 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
407 (clobber (match_scratch:DI 2 ""))]
408 "TARGET_POWERPC64 && reload_completed"
410 (sign_extend:DI (match_dup 1)))
412 (compare:CC (match_dup 2)
417 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
418 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
420 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
421 (sign_extend:DI (match_dup 1)))]
426 [(set_attr "type" "compare")
427 (set_attr "length" "4,8")])
430 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
431 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
433 (set (match_operand:DI 0 "gpc_reg_operand" "")
434 (sign_extend:DI (match_dup 1)))]
435 "TARGET_POWERPC64 && reload_completed"
437 (sign_extend:DI (match_dup 1)))
439 (compare:CC (match_dup 0)
443 (define_expand "extendhidi2"
444 [(set (match_operand:DI 0 "gpc_reg_operand" "")
445 (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "")))]
450 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
451 (sign_extend:DI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
452 "TARGET_POWERPC64 && rs6000_gen_cell_microcode"
456 [(set_attr "type" "load_ext,exts")])
459 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
460 (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r")))]
461 "TARGET_POWERPC64 && !rs6000_gen_cell_microcode"
463 [(set_attr "type" "exts")])
466 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
467 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
469 (clobber (match_scratch:DI 2 "=r,r"))]
474 [(set_attr "type" "compare")
475 (set_attr "length" "4,8")])
478 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
479 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
481 (clobber (match_scratch:DI 2 ""))]
482 "TARGET_POWERPC64 && reload_completed"
484 (sign_extend:DI (match_dup 1)))
486 (compare:CC (match_dup 2)
491 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
492 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
494 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
495 (sign_extend:DI (match_dup 1)))]
500 [(set_attr "type" "compare")
501 (set_attr "length" "4,8")])
504 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
505 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
507 (set (match_operand:DI 0 "gpc_reg_operand" "")
508 (sign_extend:DI (match_dup 1)))]
509 "TARGET_POWERPC64 && reload_completed"
511 (sign_extend:DI (match_dup 1)))
513 (compare:CC (match_dup 0)
517 (define_expand "extendsidi2"
518 [(set (match_operand:DI 0 "gpc_reg_operand" "")
519 (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")))]
524 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
525 (sign_extend:DI (match_operand:SI 1 "lwa_operand" "m,r")))]
526 "TARGET_POWERPC64 && rs6000_gen_cell_microcode"
530 [(set_attr "type" "load_ext,exts")])
533 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
534 (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r")))]
535 "TARGET_POWERPC64 && !rs6000_gen_cell_microcode"
537 [(set_attr "type" "exts")])
540 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
541 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
543 (clobber (match_scratch:DI 2 "=r,r"))]
548 [(set_attr "type" "compare")
549 (set_attr "length" "4,8")])
552 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
553 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
555 (clobber (match_scratch:DI 2 ""))]
556 "TARGET_POWERPC64 && reload_completed"
558 (sign_extend:DI (match_dup 1)))
560 (compare:CC (match_dup 2)
565 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
566 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
568 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
569 (sign_extend:DI (match_dup 1)))]
574 [(set_attr "type" "compare")
575 (set_attr "length" "4,8")])
578 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
579 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
581 (set (match_operand:DI 0 "gpc_reg_operand" "")
582 (sign_extend:DI (match_dup 1)))]
583 "TARGET_POWERPC64 && reload_completed"
585 (sign_extend:DI (match_dup 1)))
587 (compare:CC (match_dup 0)
591 (define_expand "zero_extendqisi2"
592 [(set (match_operand:SI 0 "gpc_reg_operand" "")
593 (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "")))]
598 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
599 (zero_extend:SI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
603 {rlinm|rlwinm} %0,%1,0,0xff"
604 [(set_attr "type" "load,*")])
607 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
608 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
610 (clobber (match_scratch:SI 2 "=r,r"))]
613 {andil.|andi.} %2,%1,0xff
615 [(set_attr "type" "fast_compare,compare")
616 (set_attr "length" "4,8")])
619 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
620 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
622 (clobber (match_scratch:SI 2 ""))]
625 (zero_extend:SI (match_dup 1)))
627 (compare:CC (match_dup 2)
632 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
633 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
635 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
636 (zero_extend:SI (match_dup 1)))]
639 {andil.|andi.} %0,%1,0xff
641 [(set_attr "type" "fast_compare,compare")
642 (set_attr "length" "4,8")])
645 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
646 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
648 (set (match_operand:SI 0 "gpc_reg_operand" "")
649 (zero_extend:SI (match_dup 1)))]
652 (zero_extend:SI (match_dup 1)))
654 (compare:CC (match_dup 0)
658 (define_expand "extendqisi2"
659 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
660 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
665 emit_insn (gen_extendqisi2_ppc (operands[0], operands[1]));
666 else if (TARGET_POWER)
667 emit_insn (gen_extendqisi2_power (operands[0], operands[1]));
669 emit_insn (gen_extendqisi2_no_power (operands[0], operands[1]));
673 (define_insn "extendqisi2_ppc"
674 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
675 (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r")))]
678 [(set_attr "type" "exts")])
681 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
682 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
684 (clobber (match_scratch:SI 2 "=r,r"))]
689 [(set_attr "type" "compare")
690 (set_attr "length" "4,8")])
693 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
694 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
696 (clobber (match_scratch:SI 2 ""))]
697 "TARGET_POWERPC && reload_completed"
699 (sign_extend:SI (match_dup 1)))
701 (compare:CC (match_dup 2)
706 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
707 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
709 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
710 (sign_extend:SI (match_dup 1)))]
715 [(set_attr "type" "compare")
716 (set_attr "length" "4,8")])
719 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
720 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
722 (set (match_operand:SI 0 "gpc_reg_operand" "")
723 (sign_extend:SI (match_dup 1)))]
724 "TARGET_POWERPC && reload_completed"
726 (sign_extend:SI (match_dup 1)))
728 (compare:CC (match_dup 0)
732 (define_expand "extendqisi2_power"
733 [(parallel [(set (match_dup 2)
734 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
736 (clobber (scratch:SI))])
737 (parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
738 (ashiftrt:SI (match_dup 2)
740 (clobber (scratch:SI))])]
743 { operands[1] = gen_lowpart (SImode, operands[1]);
744 operands[2] = gen_reg_rtx (SImode); }")
746 (define_expand "extendqisi2_no_power"
748 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
750 (set (match_operand:SI 0 "gpc_reg_operand" "")
751 (ashiftrt:SI (match_dup 2)
753 "! TARGET_POWER && ! TARGET_POWERPC"
755 { operands[1] = gen_lowpart (SImode, operands[1]);
756 operands[2] = gen_reg_rtx (SImode); }")
758 (define_expand "zero_extendqihi2"
759 [(set (match_operand:HI 0 "gpc_reg_operand" "")
760 (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "")))]
765 [(set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
766 (zero_extend:HI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
770 {rlinm|rlwinm} %0,%1,0,0xff"
771 [(set_attr "type" "load,*")])
774 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
775 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
777 (clobber (match_scratch:HI 2 "=r,r"))]
780 {andil.|andi.} %2,%1,0xff
782 [(set_attr "type" "fast_compare,compare")
783 (set_attr "length" "4,8")])
786 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
787 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
789 (clobber (match_scratch:HI 2 ""))]
792 (zero_extend:HI (match_dup 1)))
794 (compare:CC (match_dup 2)
799 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
800 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
802 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
803 (zero_extend:HI (match_dup 1)))]
806 {andil.|andi.} %0,%1,0xff
808 [(set_attr "type" "fast_compare,compare")
809 (set_attr "length" "4,8")])
812 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
813 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
815 (set (match_operand:HI 0 "gpc_reg_operand" "")
816 (zero_extend:HI (match_dup 1)))]
819 (zero_extend:HI (match_dup 1)))
821 (compare:CC (match_dup 0)
825 (define_expand "extendqihi2"
826 [(use (match_operand:HI 0 "gpc_reg_operand" ""))
827 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
832 emit_insn (gen_extendqihi2_ppc (operands[0], operands[1]));
833 else if (TARGET_POWER)
834 emit_insn (gen_extendqihi2_power (operands[0], operands[1]));
836 emit_insn (gen_extendqihi2_no_power (operands[0], operands[1]));
840 (define_insn "extendqihi2_ppc"
841 [(set (match_operand:HI 0 "gpc_reg_operand" "=r")
842 (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r")))]
845 [(set_attr "type" "exts")])
848 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
849 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
851 (clobber (match_scratch:HI 2 "=r,r"))]
856 [(set_attr "type" "compare")
857 (set_attr "length" "4,8")])
860 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
861 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
863 (clobber (match_scratch:HI 2 ""))]
864 "TARGET_POWERPC && reload_completed"
866 (sign_extend:HI (match_dup 1)))
868 (compare:CC (match_dup 2)
873 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
874 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
876 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
877 (sign_extend:HI (match_dup 1)))]
882 [(set_attr "type" "compare")
883 (set_attr "length" "4,8")])
886 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
887 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
889 (set (match_operand:HI 0 "gpc_reg_operand" "")
890 (sign_extend:HI (match_dup 1)))]
891 "TARGET_POWERPC && reload_completed"
893 (sign_extend:HI (match_dup 1)))
895 (compare:CC (match_dup 0)
899 (define_expand "extendqihi2_power"
900 [(parallel [(set (match_dup 2)
901 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
903 (clobber (scratch:SI))])
904 (parallel [(set (match_operand:HI 0 "gpc_reg_operand" "")
905 (ashiftrt:SI (match_dup 2)
907 (clobber (scratch:SI))])]
910 { operands[0] = gen_lowpart (SImode, operands[0]);
911 operands[1] = gen_lowpart (SImode, operands[1]);
912 operands[2] = gen_reg_rtx (SImode); }")
914 (define_expand "extendqihi2_no_power"
916 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
918 (set (match_operand:HI 0 "gpc_reg_operand" "")
919 (ashiftrt:SI (match_dup 2)
921 "! TARGET_POWER && ! TARGET_POWERPC"
923 { operands[0] = gen_lowpart (SImode, operands[0]);
924 operands[1] = gen_lowpart (SImode, operands[1]);
925 operands[2] = gen_reg_rtx (SImode); }")
927 (define_expand "zero_extendhisi2"
928 [(set (match_operand:SI 0 "gpc_reg_operand" "")
929 (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
934 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
935 (zero_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
939 {rlinm|rlwinm} %0,%1,0,0xffff"
940 [(set_attr "type" "load,*")])
943 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
944 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
946 (clobber (match_scratch:SI 2 "=r,r"))]
949 {andil.|andi.} %2,%1,0xffff
951 [(set_attr "type" "fast_compare,compare")
952 (set_attr "length" "4,8")])
955 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
956 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
958 (clobber (match_scratch:SI 2 ""))]
961 (zero_extend:SI (match_dup 1)))
963 (compare:CC (match_dup 2)
968 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
969 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
971 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
972 (zero_extend:SI (match_dup 1)))]
975 {andil.|andi.} %0,%1,0xffff
977 [(set_attr "type" "fast_compare,compare")
978 (set_attr "length" "4,8")])
981 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
982 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
984 (set (match_operand:SI 0 "gpc_reg_operand" "")
985 (zero_extend:SI (match_dup 1)))]
988 (zero_extend:SI (match_dup 1)))
990 (compare:CC (match_dup 0)
994 (define_expand "extendhisi2"
995 [(set (match_operand:SI 0 "gpc_reg_operand" "")
996 (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
1001 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1002 (sign_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
1003 "rs6000_gen_cell_microcode"
1007 [(set_attr "type" "load_ext,exts")])
1010 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1011 (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r")))]
1012 "!rs6000_gen_cell_microcode"
1013 "{exts|extsh} %0,%1"
1014 [(set_attr "type" "exts")])
1017 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1018 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
1020 (clobber (match_scratch:SI 2 "=r,r"))]
1023 {exts.|extsh.} %2,%1
1025 [(set_attr "type" "compare")
1026 (set_attr "length" "4,8")])
1029 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
1030 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1032 (clobber (match_scratch:SI 2 ""))]
1035 (sign_extend:SI (match_dup 1)))
1037 (compare:CC (match_dup 2)
1042 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1043 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
1045 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1046 (sign_extend:SI (match_dup 1)))]
1049 {exts.|extsh.} %0,%1
1051 [(set_attr "type" "compare")
1052 (set_attr "length" "4,8")])
1054 ;; IBM 405, 440, 464 and 476 half-word multiplication operations.
1056 (define_insn "*macchwc"
1057 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1058 (compare:CC (plus:SI (mult:SI (ashiftrt:SI
1059 (match_operand:SI 2 "gpc_reg_operand" "r")
1062 (match_operand:HI 1 "gpc_reg_operand" "r")))
1063 (match_operand:SI 4 "gpc_reg_operand" "0"))
1065 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1066 (plus:SI (mult:SI (ashiftrt:SI
1073 "macchw. %0, %1, %2"
1074 [(set_attr "type" "imul3")])
1076 (define_insn "*macchw"
1077 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1078 (plus:SI (mult:SI (ashiftrt:SI
1079 (match_operand:SI 2 "gpc_reg_operand" "r")
1082 (match_operand:HI 1 "gpc_reg_operand" "r")))
1083 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1086 [(set_attr "type" "imul3")])
1088 (define_insn "*macchwuc"
1089 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1090 (compare:CC (plus:SI (mult:SI (lshiftrt:SI
1091 (match_operand:SI 2 "gpc_reg_operand" "r")
1094 (match_operand:HI 1 "gpc_reg_operand" "r")))
1095 (match_operand:SI 4 "gpc_reg_operand" "0"))
1097 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1098 (plus:SI (mult:SI (lshiftrt:SI
1105 "macchwu. %0, %1, %2"
1106 [(set_attr "type" "imul3")])
1108 (define_insn "*macchwu"
1109 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1110 (plus:SI (mult:SI (lshiftrt:SI
1111 (match_operand:SI 2 "gpc_reg_operand" "r")
1114 (match_operand:HI 1 "gpc_reg_operand" "r")))
1115 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1117 "macchwu %0, %1, %2"
1118 [(set_attr "type" "imul3")])
1120 (define_insn "*machhwc"
1121 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1122 (compare:CC (plus:SI (mult:SI (ashiftrt:SI
1123 (match_operand:SI 1 "gpc_reg_operand" "%r")
1126 (match_operand:SI 2 "gpc_reg_operand" "r")
1128 (match_operand:SI 4 "gpc_reg_operand" "0"))
1130 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1131 (plus:SI (mult:SI (ashiftrt:SI
1139 "machhw. %0, %1, %2"
1140 [(set_attr "type" "imul3")])
1142 (define_insn "*machhw"
1143 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1144 (plus:SI (mult:SI (ashiftrt:SI
1145 (match_operand:SI 1 "gpc_reg_operand" "%r")
1148 (match_operand:SI 2 "gpc_reg_operand" "r")
1150 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1153 [(set_attr "type" "imul3")])
1155 (define_insn "*machhwuc"
1156 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1157 (compare:CC (plus:SI (mult:SI (lshiftrt:SI
1158 (match_operand:SI 1 "gpc_reg_operand" "%r")
1161 (match_operand:SI 2 "gpc_reg_operand" "r")
1163 (match_operand:SI 4 "gpc_reg_operand" "0"))
1165 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1166 (plus:SI (mult:SI (lshiftrt:SI
1174 "machhwu. %0, %1, %2"
1175 [(set_attr "type" "imul3")])
1177 (define_insn "*machhwu"
1178 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1179 (plus:SI (mult:SI (lshiftrt:SI
1180 (match_operand:SI 1 "gpc_reg_operand" "%r")
1183 (match_operand:SI 2 "gpc_reg_operand" "r")
1185 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1187 "machhwu %0, %1, %2"
1188 [(set_attr "type" "imul3")])
1190 (define_insn "*maclhwc"
1191 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1192 (compare:CC (plus:SI (mult:SI (sign_extend:SI
1193 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1195 (match_operand:HI 2 "gpc_reg_operand" "r")))
1196 (match_operand:SI 4 "gpc_reg_operand" "0"))
1198 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1199 (plus:SI (mult:SI (sign_extend:SI
1205 "maclhw. %0, %1, %2"
1206 [(set_attr "type" "imul3")])
1208 (define_insn "*maclhw"
1209 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1210 (plus:SI (mult:SI (sign_extend:SI
1211 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1213 (match_operand:HI 2 "gpc_reg_operand" "r")))
1214 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1217 [(set_attr "type" "imul3")])
1219 (define_insn "*maclhwuc"
1220 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1221 (compare:CC (plus:SI (mult:SI (zero_extend:SI
1222 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1224 (match_operand:HI 2 "gpc_reg_operand" "r")))
1225 (match_operand:SI 4 "gpc_reg_operand" "0"))
1227 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1228 (plus:SI (mult:SI (zero_extend:SI
1234 "maclhwu. %0, %1, %2"
1235 [(set_attr "type" "imul3")])
1237 (define_insn "*maclhwu"
1238 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1239 (plus:SI (mult:SI (zero_extend:SI
1240 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1242 (match_operand:HI 2 "gpc_reg_operand" "r")))
1243 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1245 "maclhwu %0, %1, %2"
1246 [(set_attr "type" "imul3")])
1248 (define_insn "*nmacchwc"
1249 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1250 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1251 (mult:SI (ashiftrt:SI
1252 (match_operand:SI 2 "gpc_reg_operand" "r")
1255 (match_operand:HI 1 "gpc_reg_operand" "r"))))
1257 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1258 (minus:SI (match_dup 4)
1259 (mult:SI (ashiftrt:SI
1265 "nmacchw. %0, %1, %2"
1266 [(set_attr "type" "imul3")])
1268 (define_insn "*nmacchw"
1269 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1270 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1271 (mult:SI (ashiftrt:SI
1272 (match_operand:SI 2 "gpc_reg_operand" "r")
1275 (match_operand:HI 1 "gpc_reg_operand" "r")))))]
1277 "nmacchw %0, %1, %2"
1278 [(set_attr "type" "imul3")])
1280 (define_insn "*nmachhwc"
1281 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1282 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1283 (mult:SI (ashiftrt:SI
1284 (match_operand:SI 1 "gpc_reg_operand" "%r")
1287 (match_operand:SI 2 "gpc_reg_operand" "r")
1290 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1291 (minus:SI (match_dup 4)
1292 (mult:SI (ashiftrt:SI
1299 "nmachhw. %0, %1, %2"
1300 [(set_attr "type" "imul3")])
1302 (define_insn "*nmachhw"
1303 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1304 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1305 (mult:SI (ashiftrt:SI
1306 (match_operand:SI 1 "gpc_reg_operand" "%r")
1309 (match_operand:SI 2 "gpc_reg_operand" "r")
1312 "nmachhw %0, %1, %2"
1313 [(set_attr "type" "imul3")])
1315 (define_insn "*nmaclhwc"
1316 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1317 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1318 (mult:SI (sign_extend:SI
1319 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1321 (match_operand:HI 2 "gpc_reg_operand" "r"))))
1323 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1324 (minus:SI (match_dup 4)
1325 (mult:SI (sign_extend:SI
1330 "nmaclhw. %0, %1, %2"
1331 [(set_attr "type" "imul3")])
1333 (define_insn "*nmaclhw"
1334 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1335 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1336 (mult:SI (sign_extend:SI
1337 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1339 (match_operand:HI 2 "gpc_reg_operand" "r")))))]
1341 "nmaclhw %0, %1, %2"
1342 [(set_attr "type" "imul3")])
1344 (define_insn "*mulchwc"
1345 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1346 (compare:CC (mult:SI (ashiftrt:SI
1347 (match_operand:SI 2 "gpc_reg_operand" "r")
1350 (match_operand:HI 1 "gpc_reg_operand" "r")))
1352 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1353 (mult:SI (ashiftrt:SI
1359 "mulchw. %0, %1, %2"
1360 [(set_attr "type" "imul3")])
1362 (define_insn "*mulchw"
1363 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1364 (mult:SI (ashiftrt:SI
1365 (match_operand:SI 2 "gpc_reg_operand" "r")
1368 (match_operand:HI 1 "gpc_reg_operand" "r"))))]
1371 [(set_attr "type" "imul3")])
1373 (define_insn "*mulchwuc"
1374 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1375 (compare:CC (mult:SI (lshiftrt:SI
1376 (match_operand:SI 2 "gpc_reg_operand" "r")
1379 (match_operand:HI 1 "gpc_reg_operand" "r")))
1381 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1382 (mult:SI (lshiftrt:SI
1388 "mulchwu. %0, %1, %2"
1389 [(set_attr "type" "imul3")])
1391 (define_insn "*mulchwu"
1392 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1393 (mult:SI (lshiftrt:SI
1394 (match_operand:SI 2 "gpc_reg_operand" "r")
1397 (match_operand:HI 1 "gpc_reg_operand" "r"))))]
1399 "mulchwu %0, %1, %2"
1400 [(set_attr "type" "imul3")])
1402 (define_insn "*mulhhwc"
1403 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1404 (compare:CC (mult:SI (ashiftrt:SI
1405 (match_operand:SI 1 "gpc_reg_operand" "%r")
1408 (match_operand:SI 2 "gpc_reg_operand" "r")
1411 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1412 (mult:SI (ashiftrt:SI
1419 "mulhhw. %0, %1, %2"
1420 [(set_attr "type" "imul3")])
1422 (define_insn "*mulhhw"
1423 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1424 (mult:SI (ashiftrt:SI
1425 (match_operand:SI 1 "gpc_reg_operand" "%r")
1428 (match_operand:SI 2 "gpc_reg_operand" "r")
1432 [(set_attr "type" "imul3")])
1434 (define_insn "*mulhhwuc"
1435 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1436 (compare:CC (mult:SI (lshiftrt:SI
1437 (match_operand:SI 1 "gpc_reg_operand" "%r")
1440 (match_operand:SI 2 "gpc_reg_operand" "r")
1443 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1444 (mult:SI (lshiftrt:SI
1451 "mulhhwu. %0, %1, %2"
1452 [(set_attr "type" "imul3")])
1454 (define_insn "*mulhhwu"
1455 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1456 (mult:SI (lshiftrt:SI
1457 (match_operand:SI 1 "gpc_reg_operand" "%r")
1460 (match_operand:SI 2 "gpc_reg_operand" "r")
1463 "mulhhwu %0, %1, %2"
1464 [(set_attr "type" "imul3")])
1466 (define_insn "*mullhwc"
1467 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1468 (compare:CC (mult:SI (sign_extend:SI
1469 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1471 (match_operand:HI 2 "gpc_reg_operand" "r")))
1473 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1474 (mult:SI (sign_extend:SI
1479 "mullhw. %0, %1, %2"
1480 [(set_attr "type" "imul3")])
1482 (define_insn "*mullhw"
1483 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1484 (mult:SI (sign_extend:SI
1485 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1487 (match_operand:HI 2 "gpc_reg_operand" "r"))))]
1490 [(set_attr "type" "imul3")])
1492 (define_insn "*mullhwuc"
1493 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1494 (compare:CC (mult:SI (zero_extend:SI
1495 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1497 (match_operand:HI 2 "gpc_reg_operand" "r")))
1499 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1500 (mult:SI (zero_extend:SI
1505 "mullhwu. %0, %1, %2"
1506 [(set_attr "type" "imul3")])
1508 (define_insn "*mullhwu"
1509 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1510 (mult:SI (zero_extend:SI
1511 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1513 (match_operand:HI 2 "gpc_reg_operand" "r"))))]
1515 "mullhwu %0, %1, %2"
1516 [(set_attr "type" "imul3")])
1518 ;; IBM 405, 440, 464 and 476 string-search dlmzb instruction support.
1519 (define_insn "dlmzb"
1520 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1521 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
1522 (match_operand:SI 2 "gpc_reg_operand" "r")]
1524 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1525 (unspec:SI [(match_dup 1)
1529 "dlmzb. %0, %1, %2")
1531 (define_expand "strlensi"
1532 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1533 (unspec:SI [(match_operand:BLK 1 "general_operand" "")
1534 (match_operand:QI 2 "const_int_operand" "")
1535 (match_operand 3 "const_int_operand" "")]
1536 UNSPEC_DLMZB_STRLEN))
1537 (clobber (match_scratch:CC 4 "=x"))]
1538 "TARGET_DLMZB && WORDS_BIG_ENDIAN && !optimize_size"
1540 rtx result = operands[0];
1541 rtx src = operands[1];
1542 rtx search_char = operands[2];
1543 rtx align = operands[3];
1544 rtx addr, scratch_string, word1, word2, scratch_dlmzb;
1545 rtx loop_label, end_label, mem, cr0, cond;
1546 if (search_char != const0_rtx
1547 || GET_CODE (align) != CONST_INT
1548 || INTVAL (align) < 8)
1550 word1 = gen_reg_rtx (SImode);
1551 word2 = gen_reg_rtx (SImode);
1552 scratch_dlmzb = gen_reg_rtx (SImode);
1553 scratch_string = gen_reg_rtx (Pmode);
1554 loop_label = gen_label_rtx ();
1555 end_label = gen_label_rtx ();
1556 addr = force_reg (Pmode, XEXP (src, 0));
1557 emit_move_insn (scratch_string, addr);
1558 emit_label (loop_label);
1559 mem = change_address (src, SImode, scratch_string);
1560 emit_move_insn (word1, mem);
1561 emit_move_insn (word2, adjust_address (mem, SImode, 4));
1562 cr0 = gen_rtx_REG (CCmode, CR0_REGNO);
1563 emit_insn (gen_dlmzb (scratch_dlmzb, word1, word2, cr0));
1564 cond = gen_rtx_NE (VOIDmode, cr0, const0_rtx);
1565 emit_jump_insn (gen_rtx_SET (VOIDmode,
1567 gen_rtx_IF_THEN_ELSE (VOIDmode,
1573 emit_insn (gen_addsi3 (scratch_string, scratch_string, GEN_INT (8)));
1574 emit_jump_insn (gen_rtx_SET (VOIDmode,
1576 gen_rtx_LABEL_REF (VOIDmode, loop_label)));
1578 emit_label (end_label);
1579 emit_insn (gen_addsi3 (scratch_string, scratch_string, scratch_dlmzb));
1580 emit_insn (gen_subsi3 (result, scratch_string, addr));
1581 emit_insn (gen_subsi3 (result, result, const1_rtx));
1586 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
1587 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1589 (set (match_operand:SI 0 "gpc_reg_operand" "")
1590 (sign_extend:SI (match_dup 1)))]
1593 (sign_extend:SI (match_dup 1)))
1595 (compare:CC (match_dup 0)
1599 ;; Fixed-point arithmetic insns.
1601 (define_expand "add<mode>3"
1602 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1603 (plus:SDI (match_operand:SDI 1 "gpc_reg_operand" "")
1604 (match_operand:SDI 2 "reg_or_add_cint_operand" "")))]
1607 if (<MODE>mode == DImode && ! TARGET_POWERPC64)
1609 if (non_short_cint_operand (operands[2], DImode))
1612 else if (GET_CODE (operands[2]) == CONST_INT
1613 && ! add_operand (operands[2], <MODE>mode))
1615 rtx tmp = ((!can_create_pseudo_p ()
1616 || rtx_equal_p (operands[0], operands[1]))
1617 ? operands[0] : gen_reg_rtx (<MODE>mode));
1619 HOST_WIDE_INT val = INTVAL (operands[2]);
1620 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1621 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, <MODE>mode);
1623 if (<MODE>mode == DImode && !satisfies_constraint_L (GEN_INT (rest)))
1626 /* The ordering here is important for the prolog expander.
1627 When space is allocated from the stack, adding 'low' first may
1628 produce a temporary deallocation (which would be bad). */
1629 emit_insn (gen_add<mode>3 (tmp, operands[1], GEN_INT (rest)));
1630 emit_insn (gen_add<mode>3 (operands[0], tmp, GEN_INT (low)));
1635 ;; Discourage ai/addic because of carry but provide it in an alternative
1636 ;; allowing register zero as source.
1637 (define_insn "*add<mode>3_internal1"
1638 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r,?r,r")
1639 (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "%r,b,r,b")
1640 (match_operand:GPR 2 "add_operand" "r,I,I,L")))]
1641 "!DECIMAL_FLOAT_MODE_P (GET_MODE (operands[0])) && !DECIMAL_FLOAT_MODE_P (GET_MODE (operands[1]))"
1644 {cal %0,%2(%1)|addi %0,%1,%2}
1646 {cau|addis} %0,%1,%v2"
1647 [(set_attr "length" "4,4,4,4")])
1649 (define_insn "addsi3_high"
1650 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
1651 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
1652 (high:SI (match_operand 2 "" ""))))]
1653 "TARGET_MACHO && !TARGET_64BIT"
1654 "{cau|addis} %0,%1,ha16(%2)"
1655 [(set_attr "length" "4")])
1657 (define_insn "*add<mode>3_internal2"
1658 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
1659 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "%r,r,r,r")
1660 (match_operand:P 2 "reg_or_short_operand" "r,I,r,I"))
1662 (clobber (match_scratch:P 3 "=r,r,r,r"))]
1665 {cax.|add.} %3,%1,%2
1666 {ai.|addic.} %3,%1,%2
1669 [(set_attr "type" "fast_compare,compare,compare,compare")
1670 (set_attr "length" "4,4,8,8")])
1673 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1674 (compare:CC (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1675 (match_operand:GPR 2 "reg_or_short_operand" ""))
1677 (clobber (match_scratch:GPR 3 ""))]
1680 (plus:GPR (match_dup 1)
1683 (compare:CC (match_dup 3)
1687 (define_insn "*add<mode>3_internal3"
1688 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
1689 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "%r,r,r,r")
1690 (match_operand:P 2 "reg_or_short_operand" "r,I,r,I"))
1692 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
1693 (plus:P (match_dup 1)
1697 {cax.|add.} %0,%1,%2
1698 {ai.|addic.} %0,%1,%2
1701 [(set_attr "type" "fast_compare,compare,compare,compare")
1702 (set_attr "length" "4,4,8,8")])
1705 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1706 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "")
1707 (match_operand:P 2 "reg_or_short_operand" ""))
1709 (set (match_operand:P 0 "gpc_reg_operand" "")
1710 (plus:P (match_dup 1) (match_dup 2)))]
1713 (plus:P (match_dup 1)
1716 (compare:CC (match_dup 0)
1720 ;; Split an add that we can't do in one insn into two insns, each of which
1721 ;; does one 16-bit part. This is used by combine. Note that the low-order
1722 ;; add should be last in case the result gets used in an address.
1725 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
1726 (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1727 (match_operand:GPR 2 "non_add_cint_operand" "")))]
1729 [(set (match_dup 0) (plus:GPR (match_dup 1) (match_dup 3)))
1730 (set (match_dup 0) (plus:GPR (match_dup 0) (match_dup 4)))]
1732 HOST_WIDE_INT val = INTVAL (operands[2]);
1733 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1734 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, <MODE>mode);
1736 operands[4] = GEN_INT (low);
1737 if (<MODE>mode == SImode || satisfies_constraint_L (GEN_INT (rest)))
1738 operands[3] = GEN_INT (rest);
1739 else if (can_create_pseudo_p ())
1741 operands[3] = gen_reg_rtx (DImode);
1742 emit_move_insn (operands[3], operands[2]);
1743 emit_insn (gen_adddi3 (operands[0], operands[1], operands[3]));
1750 (define_insn "one_cmpl<mode>2"
1751 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1752 (not:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
1757 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1758 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1760 (clobber (match_scratch:P 2 "=r,r"))]
1765 [(set_attr "type" "fast_compare,compare")
1766 (set_attr "length" "4,8")])
1769 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
1770 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" ""))
1772 (clobber (match_scratch:P 2 ""))]
1775 (not:P (match_dup 1)))
1777 (compare:CC (match_dup 2)
1782 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1783 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1785 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
1786 (not:P (match_dup 1)))]
1791 [(set_attr "type" "fast_compare,compare")
1792 (set_attr "length" "4,8")])
1795 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
1796 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" ""))
1798 (set (match_operand:P 0 "gpc_reg_operand" "")
1799 (not:P (match_dup 1)))]
1802 (not:P (match_dup 1)))
1804 (compare:CC (match_dup 0)
1809 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1810 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "rI")
1811 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1813 "{sf%I1|subf%I1c} %0,%2,%1")
1816 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
1817 (minus:GPR (match_operand:GPR 1 "reg_or_short_operand" "r,I")
1818 (match_operand:GPR 2 "gpc_reg_operand" "r,r")))]
1825 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1826 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1827 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1829 (clobber (match_scratch:SI 3 "=r,r"))]
1832 {sf.|subfc.} %3,%2,%1
1834 [(set_attr "type" "compare")
1835 (set_attr "length" "4,8")])
1838 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1839 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "r,r")
1840 (match_operand:P 2 "gpc_reg_operand" "r,r"))
1842 (clobber (match_scratch:P 3 "=r,r"))]
1847 [(set_attr "type" "fast_compare")
1848 (set_attr "length" "4,8")])
1851 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1852 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "")
1853 (match_operand:P 2 "gpc_reg_operand" ""))
1855 (clobber (match_scratch:P 3 ""))]
1858 (minus:P (match_dup 1)
1861 (compare:CC (match_dup 3)
1866 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1867 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1868 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1870 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1871 (minus:SI (match_dup 1) (match_dup 2)))]
1874 {sf.|subfc.} %0,%2,%1
1876 [(set_attr "type" "compare")
1877 (set_attr "length" "4,8")])
1880 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1881 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "r,r")
1882 (match_operand:P 2 "gpc_reg_operand" "r,r"))
1884 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
1885 (minus:P (match_dup 1)
1891 [(set_attr "type" "fast_compare")
1892 (set_attr "length" "4,8")])
1895 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1896 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "")
1897 (match_operand:P 2 "gpc_reg_operand" ""))
1899 (set (match_operand:P 0 "gpc_reg_operand" "")
1900 (minus:P (match_dup 1)
1904 (minus:P (match_dup 1)
1907 (compare:CC (match_dup 0)
1911 (define_expand "sub<mode>3"
1912 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1913 (minus:SDI (match_operand:SDI 1 "reg_or_short_operand" "")
1914 (match_operand:SDI 2 "reg_or_sub_cint_operand" "")))]
1918 if (GET_CODE (operands[2]) == CONST_INT)
1920 emit_insn (gen_add<mode>3 (operands[0], operands[1],
1921 negate_rtx (<MODE>mode, operands[2])));
1926 ;; For SMIN, SMAX, UMIN, and UMAX, we use DEFINE_EXPAND's that involve a doz[i]
1927 ;; instruction and some auxiliary computations. Then we just have a single
1928 ;; DEFINE_INSN for doz[i] and the define_splits to make them if made by
1931 (define_expand "sminsi3"
1933 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1934 (match_operand:SI 2 "reg_or_short_operand" ""))
1936 (minus:SI (match_dup 2) (match_dup 1))))
1937 (set (match_operand:SI 0 "gpc_reg_operand" "")
1938 (minus:SI (match_dup 2) (match_dup 3)))]
1939 "TARGET_POWER || TARGET_ISEL"
1944 operands[2] = force_reg (SImode, operands[2]);
1945 rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]);
1949 operands[3] = gen_reg_rtx (SImode);
1953 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1954 (smin:SI (match_operand:SI 1 "gpc_reg_operand" "")
1955 (match_operand:SI 2 "reg_or_short_operand" "")))
1956 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1959 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1961 (minus:SI (match_dup 2) (match_dup 1))))
1962 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 3)))]
1965 (define_expand "smaxsi3"
1967 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1968 (match_operand:SI 2 "reg_or_short_operand" ""))
1970 (minus:SI (match_dup 2) (match_dup 1))))
1971 (set (match_operand:SI 0 "gpc_reg_operand" "")
1972 (plus:SI (match_dup 3) (match_dup 1)))]
1973 "TARGET_POWER || TARGET_ISEL"
1978 operands[2] = force_reg (SImode, operands[2]);
1979 rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]);
1982 operands[3] = gen_reg_rtx (SImode);
1986 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1987 (smax:SI (match_operand:SI 1 "gpc_reg_operand" "")
1988 (match_operand:SI 2 "reg_or_short_operand" "")))
1989 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1992 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1994 (minus:SI (match_dup 2) (match_dup 1))))
1995 (set (match_dup 0) (plus:SI (match_dup 3) (match_dup 1)))]
1998 (define_expand "uminsi3"
1999 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
2001 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
2003 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
2005 (minus:SI (match_dup 4) (match_dup 3))))
2006 (set (match_operand:SI 0 "gpc_reg_operand" "")
2007 (minus:SI (match_dup 2) (match_dup 3)))]
2008 "TARGET_POWER || TARGET_ISEL"
2013 rs6000_emit_minmax (operands[0], UMIN, operands[1], operands[2]);
2016 operands[3] = gen_reg_rtx (SImode);
2017 operands[4] = gen_reg_rtx (SImode);
2018 operands[5] = GEN_INT (-2147483647 - 1);
2021 (define_expand "umaxsi3"
2022 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
2024 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
2026 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
2028 (minus:SI (match_dup 4) (match_dup 3))))
2029 (set (match_operand:SI 0 "gpc_reg_operand" "")
2030 (plus:SI (match_dup 3) (match_dup 1)))]
2031 "TARGET_POWER || TARGET_ISEL"
2036 rs6000_emit_minmax (operands[0], UMAX, operands[1], operands[2]);
2039 operands[3] = gen_reg_rtx (SImode);
2040 operands[4] = gen_reg_rtx (SImode);
2041 operands[5] = GEN_INT (-2147483647 - 1);
2045 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2046 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r")
2047 (match_operand:SI 2 "reg_or_short_operand" "rI"))
2049 (minus:SI (match_dup 2) (match_dup 1))))]
2054 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2056 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
2057 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
2059 (minus:SI (match_dup 2) (match_dup 1)))
2061 (clobber (match_scratch:SI 3 "=r,r"))]
2066 [(set_attr "type" "delayed_compare")
2067 (set_attr "length" "4,8")])
2070 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2072 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "")
2073 (match_operand:SI 2 "reg_or_short_operand" ""))
2075 (minus:SI (match_dup 2) (match_dup 1)))
2077 (clobber (match_scratch:SI 3 ""))]
2078 "TARGET_POWER && reload_completed"
2080 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
2082 (minus:SI (match_dup 2) (match_dup 1))))
2084 (compare:CC (match_dup 3)
2089 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2091 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
2092 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
2094 (minus:SI (match_dup 2) (match_dup 1)))
2096 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2097 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
2099 (minus:SI (match_dup 2) (match_dup 1))))]
2104 [(set_attr "type" "delayed_compare")
2105 (set_attr "length" "4,8")])
2108 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2110 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "")
2111 (match_operand:SI 2 "reg_or_short_operand" ""))
2113 (minus:SI (match_dup 2) (match_dup 1)))
2115 (set (match_operand:SI 0 "gpc_reg_operand" "")
2116 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
2118 (minus:SI (match_dup 2) (match_dup 1))))]
2119 "TARGET_POWER && reload_completed"
2121 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
2123 (minus:SI (match_dup 2) (match_dup 1))))
2125 (compare:CC (match_dup 0)
2129 ;; We don't need abs with condition code because such comparisons should
2131 (define_expand "abssi2"
2132 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2133 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))]
2139 emit_insn (gen_abssi2_isel (operands[0], operands[1]));
2142 else if (! TARGET_POWER)
2144 emit_insn (gen_abssi2_nopower (operands[0], operands[1]));
2149 (define_insn "*abssi2_power"
2150 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2151 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
2155 (define_insn_and_split "abs<mode>2_isel"
2156 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2157 (abs:GPR (match_operand:GPR 1 "gpc_reg_operand" "b")))
2158 (clobber (match_scratch:GPR 2 "=&b"))
2159 (clobber (match_scratch:CC 3 "=y"))]
2162 "&& reload_completed"
2163 [(set (match_dup 2) (neg:GPR (match_dup 1)))
2165 (compare:CC (match_dup 1)
2168 (if_then_else:GPR (lt (match_dup 3)
2174 (define_insn_and_split "nabs<mode>2_isel"
2175 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2176 (neg:GPR (abs:GPR (match_operand:GPR 1 "gpc_reg_operand" "b"))))
2177 (clobber (match_scratch:GPR 2 "=&b"))
2178 (clobber (match_scratch:CC 3 "=y"))]
2181 "&& reload_completed"
2182 [(set (match_dup 2) (neg:GPR (match_dup 1)))
2184 (compare:CC (match_dup 1)
2187 (if_then_else:GPR (lt (match_dup 3)
2193 (define_insn_and_split "abssi2_nopower"
2194 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
2195 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0")))
2196 (clobber (match_scratch:SI 2 "=&r,&r"))]
2197 "! TARGET_POWER && ! TARGET_ISEL"
2199 "&& reload_completed"
2200 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
2201 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
2202 (set (match_dup 0) (minus:SI (match_dup 0) (match_dup 2)))]
2205 (define_insn "*nabs_power"
2206 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2207 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r"))))]
2211 (define_insn_and_split "*nabs_nopower"
2212 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
2213 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0"))))
2214 (clobber (match_scratch:SI 2 "=&r,&r"))]
2217 "&& reload_completed"
2218 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
2219 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
2220 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 0)))]
2223 (define_expand "neg<mode>2"
2224 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
2225 (neg:SDI (match_operand:SDI 1 "gpc_reg_operand" "")))]
2229 (define_insn "*neg<mode>2_internal"
2230 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2231 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
2236 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2237 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
2239 (clobber (match_scratch:P 2 "=r,r"))]
2244 [(set_attr "type" "fast_compare")
2245 (set_attr "length" "4,8")])
2248 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2249 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" ""))
2251 (clobber (match_scratch:P 2 ""))]
2254 (neg:P (match_dup 1)))
2256 (compare:CC (match_dup 2)
2261 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
2262 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
2264 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
2265 (neg:P (match_dup 1)))]
2270 [(set_attr "type" "fast_compare")
2271 (set_attr "length" "4,8")])
2274 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
2275 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" ""))
2277 (set (match_operand:P 0 "gpc_reg_operand" "")
2278 (neg:P (match_dup 1)))]
2281 (neg:P (match_dup 1)))
2283 (compare:CC (match_dup 0)
2287 (define_insn "clz<mode>2"
2288 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2289 (clz:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
2291 "{cntlz|cntlz<wd>} %0,%1"
2292 [(set_attr "type" "cntlz")])
2294 (define_expand "ctz<mode>2"
2296 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))
2297 (parallel [(set (match_dup 3) (and:GPR (match_dup 1)
2299 (clobber (scratch:CC))])
2300 (set (match_dup 4) (clz:GPR (match_dup 3)))
2301 (set (match_operand:GPR 0 "gpc_reg_operand" "")
2302 (minus:GPR (match_dup 5) (match_dup 4)))]
2305 operands[2] = gen_reg_rtx (<MODE>mode);
2306 operands[3] = gen_reg_rtx (<MODE>mode);
2307 operands[4] = gen_reg_rtx (<MODE>mode);
2308 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode) - 1);
2311 (define_expand "ffs<mode>2"
2313 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))
2314 (parallel [(set (match_dup 3) (and:GPR (match_dup 1)
2316 (clobber (scratch:CC))])
2317 (set (match_dup 4) (clz:GPR (match_dup 3)))
2318 (set (match_operand:GPR 0 "gpc_reg_operand" "")
2319 (minus:GPR (match_dup 5) (match_dup 4)))]
2322 operands[2] = gen_reg_rtx (<MODE>mode);
2323 operands[3] = gen_reg_rtx (<MODE>mode);
2324 operands[4] = gen_reg_rtx (<MODE>mode);
2325 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode));
2328 (define_insn "popcntb<mode>2"
2329 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2330 (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")]
2335 (define_insn "popcntd<mode>2"
2336 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2337 (popcount:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
2341 (define_expand "popcount<mode>2"
2342 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2343 (popcount:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))]
2344 "TARGET_POPCNTB || TARGET_POPCNTD"
2346 rs6000_emit_popcount (operands[0], operands[1]);
2350 (define_insn "parity<mode>2_cmpb"
2351 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2352 (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")] UNSPEC_PARITY))]
2353 "TARGET_CMPB && TARGET_POPCNTB"
2356 (define_expand "parity<mode>2"
2357 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2358 (parity:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))]
2361 rs6000_emit_parity (operands[0], operands[1]);
2365 ;; Since the hardware zeros the upper part of the register, save generating the
2366 ;; AND immediate if we are converting to unsigned
2367 (define_insn "*bswaphi2_extenddi"
2368 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
2370 (bswap:HI (match_operand:HI 1 "memory_operand" "Z"))))]
2373 [(set_attr "length" "4")
2374 (set_attr "type" "load")])
2376 (define_insn "*bswaphi2_extendsi"
2377 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2379 (bswap:HI (match_operand:HI 1 "memory_operand" "Z"))))]
2382 [(set_attr "length" "4")
2383 (set_attr "type" "load")])
2385 (define_expand "bswaphi2"
2386 [(parallel [(set (match_operand:HI 0 "reg_or_mem_operand" "")
2388 (match_operand:HI 1 "reg_or_mem_operand" "")))
2389 (clobber (match_scratch:SI 2 ""))])]
2392 if (!REG_P (operands[0]) && !REG_P (operands[1]))
2393 operands[1] = force_reg (HImode, operands[1]);
2396 (define_insn "bswaphi2_internal"
2397 [(set (match_operand:HI 0 "reg_or_mem_operand" "=r,Z,&r")
2399 (match_operand:HI 1 "reg_or_mem_operand" "Z,r,r")))
2400 (clobber (match_scratch:SI 2 "=X,X,&r"))]
2406 [(set_attr "length" "4,4,12")
2407 (set_attr "type" "load,store,*")])
2410 [(set (match_operand:HI 0 "gpc_reg_operand" "")
2411 (bswap:HI (match_operand:HI 1 "gpc_reg_operand" "")))
2412 (clobber (match_operand:SI 2 "gpc_reg_operand" ""))]
2413 "TARGET_POWERPC && reload_completed"
2415 (zero_extract:SI (match_dup 4)
2419 (and:SI (ashift:SI (match_dup 4)
2421 (const_int 65280))) ;; 0xff00
2423 (ior:SI (match_dup 3)
2427 operands[3] = simplify_gen_subreg (SImode, operands[0], HImode, 0);
2428 operands[4] = simplify_gen_subreg (SImode, operands[1], HImode, 0);
2431 (define_insn "*bswapsi2_extenddi"
2432 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
2434 (bswap:SI (match_operand:SI 1 "memory_operand" "Z"))))]
2437 [(set_attr "length" "4")
2438 (set_attr "type" "load")])
2440 (define_expand "bswapsi2"
2441 [(set (match_operand:SI 0 "reg_or_mem_operand" "")
2443 (match_operand:SI 1 "reg_or_mem_operand" "")))]
2446 if (!REG_P (operands[0]) && !REG_P (operands[1]))
2447 operands[1] = force_reg (SImode, operands[1]);
2450 (define_insn "*bswapsi2_internal"
2451 [(set (match_operand:SI 0 "reg_or_mem_operand" "=r,Z,&r")
2453 (match_operand:SI 1 "reg_or_mem_operand" "Z,r,r")))]
2457 {stbrx|stwbrx} %1,%y0
2459 [(set_attr "length" "4,4,12")
2460 (set_attr "type" "load,store,*")])
2463 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2464 (bswap:SI (match_operand:SI 1 "gpc_reg_operand" "")))]
2467 (rotate:SI (match_dup 1) (const_int 8)))
2468 (set (zero_extract:SI (match_dup 0)
2472 (set (zero_extract:SI (match_dup 0)
2475 (rotate:SI (match_dup 1)
2479 (define_expand "bswapdi2"
2480 [(parallel [(set (match_operand:DI 0 "reg_or_mem_operand" "")
2482 (match_operand:DI 1 "reg_or_mem_operand" "")))
2483 (clobber (match_scratch:DI 2 ""))
2484 (clobber (match_scratch:DI 3 ""))
2485 (clobber (match_scratch:DI 4 ""))])]
2488 if (!REG_P (operands[0]) && !REG_P (operands[1]))
2489 operands[1] = force_reg (DImode, operands[1]);
2491 if (!TARGET_POWERPC64)
2493 /* 32-bit mode needs fewer scratch registers, but 32-bit addressing mode
2494 that uses 64-bit registers needs the same scratch registers as 64-bit
2496 emit_insn (gen_bswapdi2_32bit (operands[0], operands[1]));
2501 ;; Power7/cell has ldbrx/stdbrx, so use it directly
2502 (define_insn "*bswapdi2_ldbrx"
2503 [(set (match_operand:DI 0 "reg_or_mem_operand" "=&r,Z,??&r")
2504 (bswap:DI (match_operand:DI 1 "reg_or_mem_operand" "Z,r,r")))
2505 (clobber (match_scratch:DI 2 "=X,X,&r"))
2506 (clobber (match_scratch:DI 3 "=X,X,&r"))
2507 (clobber (match_scratch:DI 4 "=X,X,&r"))]
2508 "TARGET_POWERPC64 && TARGET_LDBRX
2509 && (REG_P (operands[0]) || REG_P (operands[1]))"
2514 [(set_attr "length" "4,4,36")
2515 (set_attr "type" "load,store,*")])
2517 ;; Non-power7/cell, fall back to use lwbrx/stwbrx
2518 (define_insn "*bswapdi2_64bit"
2519 [(set (match_operand:DI 0 "reg_or_mem_operand" "=&r,Z,??&r")
2520 (bswap:DI (match_operand:DI 1 "reg_or_mem_operand" "Z,r,r")))
2521 (clobber (match_scratch:DI 2 "=&b,&b,&r"))
2522 (clobber (match_scratch:DI 3 "=&r,&r,&r"))
2523 (clobber (match_scratch:DI 4 "=&r,X,&r"))]
2524 "TARGET_POWERPC64 && !TARGET_LDBRX
2525 && (REG_P (operands[0]) || REG_P (operands[1]))"
2527 [(set_attr "length" "16,12,36")])
2530 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2531 (bswap:DI (match_operand:DI 1 "indexed_or_indirect_operand" "")))
2532 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
2533 (clobber (match_operand:DI 3 "gpc_reg_operand" ""))
2534 (clobber (match_operand:DI 4 "gpc_reg_operand" ""))]
2535 "TARGET_POWERPC64 && !TARGET_LDBRX && reload_completed"
2539 rtx dest = operands[0];
2540 rtx src = operands[1];
2541 rtx op2 = operands[2];
2542 rtx op3 = operands[3];
2543 rtx op4 = operands[4];
2544 rtx op3_32 = simplify_gen_subreg (SImode, op3, DImode, 4);
2545 rtx op4_32 = simplify_gen_subreg (SImode, op4, DImode, 4);
2551 addr1 = XEXP (src, 0);
2552 if (GET_CODE (addr1) == PLUS)
2554 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2555 if (TARGET_AVOID_XFORM)
2557 emit_insn (gen_add3_insn (op2, XEXP (addr1, 1), op2));
2561 addr2 = gen_rtx_PLUS (Pmode, op2, XEXP (addr1, 1));
2563 else if (TARGET_AVOID_XFORM)
2565 emit_insn (gen_add3_insn (op2, addr1, GEN_INT (4)));
2570 emit_move_insn (op2, GEN_INT (4));
2571 addr2 = gen_rtx_PLUS (Pmode, op2, addr1);
2574 if (BYTES_BIG_ENDIAN)
2576 word_high = change_address (src, SImode, addr1);
2577 word_low = change_address (src, SImode, addr2);
2581 word_high = change_address (src, SImode, addr2);
2582 word_low = change_address (src, SImode, addr1);
2585 emit_insn (gen_bswapsi2 (op3_32, word_low));
2586 emit_insn (gen_bswapsi2 (op4_32, word_high));
2587 emit_insn (gen_ashldi3 (dest, op3, GEN_INT (32)));
2588 emit_insn (gen_iordi3 (dest, dest, op4));
2592 [(set (match_operand:DI 0 "indexed_or_indirect_operand" "")
2593 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2594 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
2595 (clobber (match_operand:DI 3 "gpc_reg_operand" ""))
2596 (clobber (match_operand:DI 4 "" ""))]
2597 "TARGET_POWERPC64 && !TARGET_LDBRX && reload_completed"
2601 rtx dest = operands[0];
2602 rtx src = operands[1];
2603 rtx op2 = operands[2];
2604 rtx op3 = operands[3];
2605 rtx src_si = simplify_gen_subreg (SImode, src, DImode, 4);
2606 rtx op3_si = simplify_gen_subreg (SImode, op3, DImode, 4);
2612 addr1 = XEXP (dest, 0);
2613 if (GET_CODE (addr1) == PLUS)
2615 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2616 if (TARGET_AVOID_XFORM)
2618 emit_insn (gen_add3_insn (op2, XEXP (addr1, 1), op2));
2622 addr2 = gen_rtx_PLUS (Pmode, op2, XEXP (addr1, 1));
2624 else if (TARGET_AVOID_XFORM)
2626 emit_insn (gen_add3_insn (op2, addr1, GEN_INT (4)));
2631 emit_move_insn (op2, GEN_INT (4));
2632 addr2 = gen_rtx_PLUS (Pmode, op2, addr1);
2635 emit_insn (gen_lshrdi3 (op3, src, GEN_INT (32)));
2636 if (BYTES_BIG_ENDIAN)
2638 word_high = change_address (dest, SImode, addr1);
2639 word_low = change_address (dest, SImode, addr2);
2640 emit_insn (gen_bswapsi2 (word_high, src_si));
2641 emit_insn (gen_bswapsi2 (word_low, op3_si));
2645 word_high = change_address (dest, SImode, addr2);
2646 word_low = change_address (dest, SImode, addr1);
2647 emit_insn (gen_bswapsi2 (word_low, src_si));
2648 emit_insn (gen_bswapsi2 (word_high, op3_si));
2653 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2654 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2655 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
2656 (clobber (match_operand:DI 3 "gpc_reg_operand" ""))
2657 (clobber (match_operand:DI 4 "" ""))]
2658 "TARGET_POWERPC64 && reload_completed"
2662 rtx dest = operands[0];
2663 rtx src = operands[1];
2664 rtx op2 = operands[2];
2665 rtx op3 = operands[3];
2666 rtx dest_si = simplify_gen_subreg (SImode, dest, DImode, 4);
2667 rtx src_si = simplify_gen_subreg (SImode, src, DImode, 4);
2668 rtx op2_si = simplify_gen_subreg (SImode, op2, DImode, 4);
2669 rtx op3_si = simplify_gen_subreg (SImode, op3, DImode, 4);
2671 emit_insn (gen_lshrdi3 (op2, src, GEN_INT (32)));
2672 emit_insn (gen_bswapsi2 (dest_si, src_si));
2673 emit_insn (gen_bswapsi2 (op3_si, op2_si));
2674 emit_insn (gen_ashldi3 (dest, dest, GEN_INT (32)));
2675 emit_insn (gen_iordi3 (dest, dest, op3));
2678 (define_insn "bswapdi2_32bit"
2679 [(set (match_operand:DI 0 "reg_or_mem_operand" "=&r,Z,??&r")
2680 (bswap:DI (match_operand:DI 1 "reg_or_mem_operand" "Z,r,r")))
2681 (clobber (match_scratch:SI 2 "=&b,&b,X"))]
2682 "!TARGET_POWERPC64 && (REG_P (operands[0]) || REG_P (operands[1]))"
2684 [(set_attr "length" "16,12,36")])
2687 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2688 (bswap:DI (match_operand:DI 1 "indexed_or_indirect_operand" "")))
2689 (clobber (match_operand:SI 2 "gpc_reg_operand" ""))]
2690 "!TARGET_POWERPC64 && reload_completed"
2694 rtx dest = operands[0];
2695 rtx src = operands[1];
2696 rtx op2 = operands[2];
2697 rtx dest_hi = simplify_gen_subreg (SImode, dest, DImode, 0);
2698 rtx dest_lo = simplify_gen_subreg (SImode, dest, DImode, 4);
2704 addr1 = XEXP (src, 0);
2705 if (GET_CODE (addr1) == PLUS)
2707 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2708 if (TARGET_AVOID_XFORM)
2710 emit_insn (gen_add3_insn (op2, XEXP (addr1, 1), op2));
2714 addr2 = gen_rtx_PLUS (SImode, op2, XEXP (addr1, 1));
2716 else if (TARGET_AVOID_XFORM)
2718 emit_insn (gen_add3_insn (op2, addr1, GEN_INT (4)));
2723 emit_move_insn (op2, GEN_INT (4));
2724 addr2 = gen_rtx_PLUS (SImode, op2, addr1);
2727 if (BYTES_BIG_ENDIAN)
2729 word_high = change_address (src, SImode, addr1);
2730 word_low = change_address (src, SImode, addr2);
2734 word_high = change_address (src, SImode, addr2);
2735 word_low = change_address (src, SImode, addr1);
2738 emit_insn (gen_bswapsi2 (dest_hi, word_low));
2739 emit_insn (gen_bswapsi2 (dest_lo, word_high));
2743 [(set (match_operand:DI 0 "indexed_or_indirect_operand" "")
2744 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2745 (clobber (match_operand:SI 2 "gpc_reg_operand" ""))]
2746 "!TARGET_POWERPC64 && reload_completed"
2750 rtx dest = operands[0];
2751 rtx src = operands[1];
2752 rtx op2 = operands[2];
2753 rtx src_high = simplify_gen_subreg (SImode, src, DImode, 0);
2754 rtx src_low = simplify_gen_subreg (SImode, src, DImode, 4);
2760 addr1 = XEXP (dest, 0);
2761 if (GET_CODE (addr1) == PLUS)
2763 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2764 if (TARGET_AVOID_XFORM)
2766 emit_insn (gen_add3_insn (op2, XEXP (addr1, 1), op2));
2770 addr2 = gen_rtx_PLUS (SImode, op2, XEXP (addr1, 1));
2772 else if (TARGET_AVOID_XFORM)
2774 emit_insn (gen_add3_insn (op2, addr1, GEN_INT (4)));
2779 emit_move_insn (op2, GEN_INT (4));
2780 addr2 = gen_rtx_PLUS (SImode, op2, addr1);
2783 if (BYTES_BIG_ENDIAN)
2785 word_high = change_address (dest, SImode, addr1);
2786 word_low = change_address (dest, SImode, addr2);
2790 word_high = change_address (dest, SImode, addr2);
2791 word_low = change_address (dest, SImode, addr1);
2794 emit_insn (gen_bswapsi2 (word_high, src_low));
2795 emit_insn (gen_bswapsi2 (word_low, src_high));
2799 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2800 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2801 (clobber (match_operand:SI 2 "" ""))]
2802 "!TARGET_POWERPC64 && reload_completed"
2806 rtx dest = operands[0];
2807 rtx src = operands[1];
2808 rtx src_high = simplify_gen_subreg (SImode, src, DImode, 0);
2809 rtx src_low = simplify_gen_subreg (SImode, src, DImode, 4);
2810 rtx dest_high = simplify_gen_subreg (SImode, dest, DImode, 0);
2811 rtx dest_low = simplify_gen_subreg (SImode, dest, DImode, 4);
2813 emit_insn (gen_bswapsi2 (dest_high, src_low));
2814 emit_insn (gen_bswapsi2 (dest_low, src_high));
2817 (define_expand "mulsi3"
2818 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
2819 (use (match_operand:SI 1 "gpc_reg_operand" ""))
2820 (use (match_operand:SI 2 "reg_or_short_operand" ""))]
2825 emit_insn (gen_mulsi3_mq (operands[0], operands[1], operands[2]));
2827 emit_insn (gen_mulsi3_no_mq (operands[0], operands[1], operands[2]));
2831 (define_insn "mulsi3_mq"
2832 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2833 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2834 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
2835 (clobber (match_scratch:SI 3 "=q,q"))]
2838 {muls|mullw} %0,%1,%2
2839 {muli|mulli} %0,%1,%2"
2841 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
2842 (const_string "imul3")
2843 (match_operand:SI 2 "short_cint_operand" "")
2844 (const_string "imul2")]
2845 (const_string "imul")))])
2847 (define_insn "mulsi3_no_mq"
2848 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2849 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2850 (match_operand:SI 2 "reg_or_short_operand" "r,I")))]
2853 {muls|mullw} %0,%1,%2
2854 {muli|mulli} %0,%1,%2"
2856 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
2857 (const_string "imul3")
2858 (match_operand:SI 2 "short_cint_operand" "")
2859 (const_string "imul2")]
2860 (const_string "imul")))])
2862 (define_insn "*mulsi3_mq_internal1"
2863 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2864 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2865 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2867 (clobber (match_scratch:SI 3 "=r,r"))
2868 (clobber (match_scratch:SI 4 "=q,q"))]
2871 {muls.|mullw.} %3,%1,%2
2873 [(set_attr "type" "imul_compare")
2874 (set_attr "length" "4,8")])
2877 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2878 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2879 (match_operand:SI 2 "gpc_reg_operand" ""))
2881 (clobber (match_scratch:SI 3 ""))
2882 (clobber (match_scratch:SI 4 ""))]
2883 "TARGET_POWER && reload_completed"
2884 [(parallel [(set (match_dup 3)
2885 (mult:SI (match_dup 1) (match_dup 2)))
2886 (clobber (match_dup 4))])
2888 (compare:CC (match_dup 3)
2892 (define_insn "*mulsi3_no_mq_internal1"
2893 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2894 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2895 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2897 (clobber (match_scratch:SI 3 "=r,r"))]
2900 {muls.|mullw.} %3,%1,%2
2902 [(set_attr "type" "imul_compare")
2903 (set_attr "length" "4,8")])
2906 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
2907 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2908 (match_operand:SI 2 "gpc_reg_operand" ""))
2910 (clobber (match_scratch:SI 3 ""))]
2911 "! TARGET_POWER && reload_completed"
2913 (mult:SI (match_dup 1) (match_dup 2)))
2915 (compare:CC (match_dup 3)
2919 (define_insn "*mulsi3_mq_internal2"
2920 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2921 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2922 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2924 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2925 (mult:SI (match_dup 1) (match_dup 2)))
2926 (clobber (match_scratch:SI 4 "=q,q"))]
2929 {muls.|mullw.} %0,%1,%2
2931 [(set_attr "type" "imul_compare")
2932 (set_attr "length" "4,8")])
2935 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2936 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2937 (match_operand:SI 2 "gpc_reg_operand" ""))
2939 (set (match_operand:SI 0 "gpc_reg_operand" "")
2940 (mult:SI (match_dup 1) (match_dup 2)))
2941 (clobber (match_scratch:SI 4 ""))]
2942 "TARGET_POWER && reload_completed"
2943 [(parallel [(set (match_dup 0)
2944 (mult:SI (match_dup 1) (match_dup 2)))
2945 (clobber (match_dup 4))])
2947 (compare:CC (match_dup 0)
2951 (define_insn "*mulsi3_no_mq_internal2"
2952 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2953 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2954 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2956 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2957 (mult:SI (match_dup 1) (match_dup 2)))]
2960 {muls.|mullw.} %0,%1,%2
2962 [(set_attr "type" "imul_compare")
2963 (set_attr "length" "4,8")])
2966 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
2967 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2968 (match_operand:SI 2 "gpc_reg_operand" ""))
2970 (set (match_operand:SI 0 "gpc_reg_operand" "")
2971 (mult:SI (match_dup 1) (match_dup 2)))]
2972 "! TARGET_POWER && reload_completed"
2974 (mult:SI (match_dup 1) (match_dup 2)))
2976 (compare:CC (match_dup 0)
2980 ;; Operand 1 is divided by operand 2; quotient goes to operand
2981 ;; 0 and remainder to operand 3.
2982 ;; ??? At some point, see what, if anything, we can do about if (x % y == 0).
2984 (define_expand "divmodsi4"
2985 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
2986 (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
2987 (match_operand:SI 2 "gpc_reg_operand" "")))
2988 (set (match_operand:SI 3 "register_operand" "")
2989 (mod:SI (match_dup 1) (match_dup 2)))])]
2990 "TARGET_POWER || (! TARGET_POWER && ! TARGET_POWERPC)"
2993 if (! TARGET_POWER && ! TARGET_POWERPC)
2995 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2996 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2997 emit_insn (gen_divss_call ());
2998 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2999 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
3004 (define_insn "*divmodsi4_internal"
3005 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3006 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3007 (match_operand:SI 2 "gpc_reg_operand" "r")))
3008 (set (match_operand:SI 3 "register_operand" "=q")
3009 (mod:SI (match_dup 1) (match_dup 2)))]
3012 [(set_attr "type" "idiv")])
3014 (define_expand "udiv<mode>3"
3015 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
3016 (udiv:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
3017 (match_operand:GPR 2 "gpc_reg_operand" "")))]
3018 "TARGET_POWERPC || (! TARGET_POWER && ! TARGET_POWERPC)"
3021 if (! TARGET_POWER && ! TARGET_POWERPC)
3023 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
3024 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
3025 emit_insn (gen_quous_call ());
3026 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
3029 else if (TARGET_POWER)
3031 emit_insn (gen_udivsi3_mq (operands[0], operands[1], operands[2]));
3036 (define_insn "udivsi3_mq"
3037 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3038 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3039 (match_operand:SI 2 "gpc_reg_operand" "r")))
3040 (clobber (match_scratch:SI 3 "=q"))]
3041 "TARGET_POWERPC && TARGET_POWER"
3043 [(set_attr "type" "idiv")])
3045 (define_insn "*udivsi3_no_mq"
3046 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
3047 (udiv:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
3048 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
3049 "TARGET_POWERPC && ! TARGET_POWER"
3052 (cond [(match_operand:SI 0 "" "")
3053 (const_string "idiv")]
3054 (const_string "ldiv")))])
3057 ;; For powers of two we can do srai/aze for divide and then adjust for
3058 ;; modulus. If it isn't a power of two, FAIL on POWER so divmodsi4 will be
3059 ;; used; for PowerPC, force operands into register and do a normal divide;
3060 ;; for AIX common-mode, use quoss call on register operands.
3061 (define_expand "div<mode>3"
3062 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
3063 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
3064 (match_operand:GPR 2 "reg_or_cint_operand" "")))]
3068 if (GET_CODE (operands[2]) == CONST_INT
3069 && INTVAL (operands[2]) > 0
3070 && exact_log2 (INTVAL (operands[2])) >= 0)
3072 else if (TARGET_POWERPC)
3074 operands[2] = force_reg (<MODE>mode, operands[2]);
3077 emit_insn (gen_divsi3_mq (operands[0], operands[1], operands[2]));
3081 else if (TARGET_POWER)
3085 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
3086 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
3087 emit_insn (gen_quoss_call ());
3088 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
3093 (define_insn "divsi3_mq"
3094 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3095 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3096 (match_operand:SI 2 "gpc_reg_operand" "r")))
3097 (clobber (match_scratch:SI 3 "=q"))]
3098 "TARGET_POWERPC && TARGET_POWER"
3100 [(set_attr "type" "idiv")])
3102 (define_insn "*div<mode>3_no_mq"
3103 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
3104 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
3105 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
3106 "TARGET_POWERPC && ! TARGET_POWER"
3109 (cond [(match_operand:SI 0 "" "")
3110 (const_string "idiv")]
3111 (const_string "ldiv")))])
3113 (define_expand "mod<mode>3"
3114 [(use (match_operand:GPR 0 "gpc_reg_operand" ""))
3115 (use (match_operand:GPR 1 "gpc_reg_operand" ""))
3116 (use (match_operand:GPR 2 "reg_or_cint_operand" ""))]
3124 if (GET_CODE (operands[2]) != CONST_INT
3125 || INTVAL (operands[2]) <= 0
3126 || (i = exact_log2 (INTVAL (operands[2]))) < 0)
3129 temp1 = gen_reg_rtx (<MODE>mode);
3130 temp2 = gen_reg_rtx (<MODE>mode);
3132 emit_insn (gen_div<mode>3 (temp1, operands[1], operands[2]));
3133 emit_insn (gen_ashl<mode>3 (temp2, temp1, GEN_INT (i)));
3134 emit_insn (gen_sub<mode>3 (operands[0], operands[1], temp2));
3139 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
3140 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
3141 (match_operand:GPR 2 "exact_log2_cint_operand" "N")))]
3143 "{srai|sra<wd>i} %0,%1,%p2\;{aze|addze} %0,%0"
3144 [(set_attr "type" "two")
3145 (set_attr "length" "8")])
3148 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3149 (compare:CC (div:P (match_operand:P 1 "gpc_reg_operand" "r,r")
3150 (match_operand:P 2 "exact_log2_cint_operand" "N,N"))
3152 (clobber (match_scratch:P 3 "=r,r"))]
3155 {srai|sra<wd>i} %3,%1,%p2\;{aze.|addze.} %3,%3
3157 [(set_attr "type" "compare")
3158 (set_attr "length" "8,12")
3159 (set_attr "cell_micro" "not")])
3162 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3163 (compare:CC (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
3164 (match_operand:GPR 2 "exact_log2_cint_operand"
3167 (clobber (match_scratch:GPR 3 ""))]
3170 (div:<MODE> (match_dup 1) (match_dup 2)))
3172 (compare:CC (match_dup 3)
3177 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3178 (compare:CC (div:P (match_operand:P 1 "gpc_reg_operand" "r,r")
3179 (match_operand:P 2 "exact_log2_cint_operand" "N,N"))
3181 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
3182 (div:P (match_dup 1) (match_dup 2)))]
3185 {srai|sra<wd>i} %0,%1,%p2\;{aze.|addze.} %0,%0
3187 [(set_attr "type" "compare")
3188 (set_attr "length" "8,12")
3189 (set_attr "cell_micro" "not")])
3192 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3193 (compare:CC (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
3194 (match_operand:GPR 2 "exact_log2_cint_operand"
3197 (set (match_operand:GPR 0 "gpc_reg_operand" "")
3198 (div:GPR (match_dup 1) (match_dup 2)))]
3201 (div:<MODE> (match_dup 1) (match_dup 2)))
3203 (compare:CC (match_dup 0)
3208 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3211 (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
3213 (zero_extend:DI (match_operand:SI 4 "register_operand" "2")))
3214 (match_operand:SI 3 "gpc_reg_operand" "r")))
3215 (set (match_operand:SI 2 "register_operand" "=*q")
3218 (zero_extend:DI (match_dup 1)) (const_int 32))
3219 (zero_extend:DI (match_dup 4)))
3223 [(set_attr "type" "idiv")])
3225 ;; To do unsigned divide we handle the cases of the divisor looking like a
3226 ;; negative number. If it is a constant that is less than 2**31, we don't
3227 ;; have to worry about the branches. So make a few subroutines here.
3229 ;; First comes the normal case.
3230 (define_expand "udivmodsi4_normal"
3231 [(set (match_dup 4) (const_int 0))
3232 (parallel [(set (match_operand:SI 0 "" "")
3233 (udiv:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
3235 (zero_extend:DI (match_operand:SI 1 "" "")))
3236 (match_operand:SI 2 "" "")))
3237 (set (match_operand:SI 3 "" "")
3238 (umod:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
3240 (zero_extend:DI (match_dup 1)))
3244 { operands[4] = gen_reg_rtx (SImode); }")
3246 ;; This handles the branches.
3247 (define_expand "udivmodsi4_tests"
3248 [(set (match_operand:SI 0 "" "") (const_int 0))
3249 (set (match_operand:SI 3 "" "") (match_operand:SI 1 "" ""))
3250 (set (match_dup 5) (compare:CCUNS (match_dup 1) (match_operand:SI 2 "" "")))
3251 (set (pc) (if_then_else (ltu (match_dup 5) (const_int 0))
3252 (label_ref (match_operand:SI 4 "" "")) (pc)))
3253 (set (match_dup 0) (const_int 1))
3254 (set (match_dup 3) (minus:SI (match_dup 1) (match_dup 2)))
3255 (set (match_dup 6) (compare:CC (match_dup 2) (const_int 0)))
3256 (set (pc) (if_then_else (lt (match_dup 6) (const_int 0))
3257 (label_ref (match_dup 4)) (pc)))]
3260 { operands[5] = gen_reg_rtx (CCUNSmode);
3261 operands[6] = gen_reg_rtx (CCmode);
3264 (define_expand "udivmodsi4"
3265 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
3266 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "")
3267 (match_operand:SI 2 "reg_or_cint_operand" "")))
3268 (set (match_operand:SI 3 "gpc_reg_operand" "")
3269 (umod:SI (match_dup 1) (match_dup 2)))])]
3277 if (! TARGET_POWERPC)
3279 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
3280 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
3281 emit_insn (gen_divus_call ());
3282 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
3283 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
3290 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) < 0)
3292 operands[2] = force_reg (SImode, operands[2]);
3293 label = gen_label_rtx ();
3294 emit (gen_udivmodsi4_tests (operands[0], operands[1], operands[2],
3295 operands[3], label));
3298 operands[2] = force_reg (SImode, operands[2]);
3300 emit (gen_udivmodsi4_normal (operands[0], operands[1], operands[2],
3308 ;; AIX architecture-independent common-mode multiply (DImode),
3309 ;; divide/modulus, and quotient subroutine calls. Input operands in R3 and
3310 ;; R4; results in R3 and sometimes R4; link register always clobbered by bla
3311 ;; instruction; R0 sometimes clobbered; also, MQ sometimes clobbered but
3312 ;; assumed unused if generating common-mode, so ignore.
3313 (define_insn "mulh_call"
3316 (lshiftrt:DI (mult:DI (sign_extend:DI (reg:SI 3))
3317 (sign_extend:DI (reg:SI 4)))
3319 (clobber (reg:SI LR_REGNO))]
3320 "! TARGET_POWER && ! TARGET_POWERPC"
3322 [(set_attr "type" "imul")])
3324 (define_insn "mull_call"
3326 (mult:DI (sign_extend:DI (reg:SI 3))
3327 (sign_extend:DI (reg:SI 4))))
3328 (clobber (reg:SI LR_REGNO))
3329 (clobber (reg:SI 0))]
3330 "! TARGET_POWER && ! TARGET_POWERPC"
3332 [(set_attr "type" "imul")])
3334 (define_insn "divss_call"
3336 (div:SI (reg:SI 3) (reg:SI 4)))
3338 (mod:SI (reg:SI 3) (reg:SI 4)))
3339 (clobber (reg:SI LR_REGNO))
3340 (clobber (reg:SI 0))]
3341 "! TARGET_POWER && ! TARGET_POWERPC"
3343 [(set_attr "type" "idiv")])
3345 (define_insn "divus_call"
3347 (udiv:SI (reg:SI 3) (reg:SI 4)))
3349 (umod:SI (reg:SI 3) (reg:SI 4)))
3350 (clobber (reg:SI LR_REGNO))
3351 (clobber (reg:SI 0))
3352 (clobber (match_scratch:CC 0 "=x"))
3353 (clobber (reg:CC CR1_REGNO))]
3354 "! TARGET_POWER && ! TARGET_POWERPC"
3356 [(set_attr "type" "idiv")])
3358 (define_insn "quoss_call"
3360 (div:SI (reg:SI 3) (reg:SI 4)))
3361 (clobber (reg:SI LR_REGNO))]
3362 "! TARGET_POWER && ! TARGET_POWERPC"
3364 [(set_attr "type" "idiv")])
3366 (define_insn "quous_call"
3368 (udiv:SI (reg:SI 3) (reg:SI 4)))
3369 (clobber (reg:SI LR_REGNO))
3370 (clobber (reg:SI 0))
3371 (clobber (match_scratch:CC 0 "=x"))
3372 (clobber (reg:CC CR1_REGNO))]
3373 "! TARGET_POWER && ! TARGET_POWERPC"
3375 [(set_attr "type" "idiv")])
3377 ;; Logical instructions
3378 ;; The logical instructions are mostly combined by using match_operator,
3379 ;; but the plain AND insns are somewhat different because there is no
3380 ;; plain 'andi' (only 'andi.'), no plain 'andis', and there are all
3381 ;; those rotate-and-mask operations. Thus, the AND insns come first.
3383 (define_expand "andsi3"
3385 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3386 (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
3387 (match_operand:SI 2 "and_operand" "")))
3388 (clobber (match_scratch:CC 3 ""))])]
3392 (define_insn "andsi3_mc"
3393 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
3394 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
3395 (match_operand:SI 2 "and_operand" "?r,T,K,L")))
3396 (clobber (match_scratch:CC 3 "=X,X,x,x"))]
3397 "rs6000_gen_cell_microcode"
3400 {rlinm|rlwinm} %0,%1,0,%m2,%M2
3401 {andil.|andi.} %0,%1,%b2
3402 {andiu.|andis.} %0,%1,%u2"
3403 [(set_attr "type" "*,*,fast_compare,fast_compare")])
3405 (define_insn "andsi3_nomc"
3406 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3407 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
3408 (match_operand:SI 2 "and_operand" "?r,T")))
3409 (clobber (match_scratch:CC 3 "=X,X"))]
3410 "!rs6000_gen_cell_microcode"
3413 {rlinm|rlwinm} %0,%1,0,%m2,%M2")
3415 (define_insn "andsi3_internal0_nomc"
3416 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3417 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
3418 (match_operand:SI 2 "and_operand" "?r,T")))]
3419 "!rs6000_gen_cell_microcode"
3422 {rlinm|rlwinm} %0,%1,0,%m2,%M2")
3425 ;; Note to set cr's other than cr0 we do the and immediate and then
3426 ;; the test again -- this avoids a mfcr which on the higher end
3427 ;; machines causes an execution serialization
3429 (define_insn "*andsi3_internal2_mc"
3430 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
3431 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
3432 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
3434 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
3435 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
3436 "TARGET_32BIT && rs6000_gen_cell_microcode"
3439 {andil.|andi.} %3,%1,%b2
3440 {andiu.|andis.} %3,%1,%u2
3441 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
3446 [(set_attr "type" "fast_compare,fast_compare,fast_compare,delayed_compare,\
3447 compare,compare,compare,compare")
3448 (set_attr "length" "4,4,4,4,8,8,8,8")])
3450 (define_insn "*andsi3_internal3_mc"
3451 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
3452 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
3453 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
3455 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
3456 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
3457 "TARGET_64BIT && rs6000_gen_cell_microcode"
3460 {andil.|andi.} %3,%1,%b2
3461 {andiu.|andis.} %3,%1,%u2
3462 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
3467 [(set_attr "type" "compare,fast_compare,fast_compare,delayed_compare,compare,\
3468 compare,compare,compare")
3469 (set_attr "length" "8,4,4,4,8,8,8,8")])
3472 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3473 (compare:CC (and:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
3474 (match_operand:GPR 2 "and_operand" ""))
3476 (clobber (match_scratch:GPR 3 ""))
3477 (clobber (match_scratch:CC 4 ""))]
3479 [(parallel [(set (match_dup 3)
3480 (and:<MODE> (match_dup 1)
3482 (clobber (match_dup 4))])
3484 (compare:CC (match_dup 3)
3488 ;; We don't have a 32 bit "and. rt,ra,rb" for ppc64. cr is set from the
3489 ;; whole 64 bit reg, and we don't know what is in the high 32 bits.
3492 [(set (match_operand:CC 0 "cc_reg_operand" "")
3493 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
3494 (match_operand:SI 2 "gpc_reg_operand" ""))
3496 (clobber (match_scratch:SI 3 ""))
3497 (clobber (match_scratch:CC 4 ""))]
3498 "TARGET_POWERPC64 && reload_completed"
3499 [(parallel [(set (match_dup 3)
3500 (and:SI (match_dup 1)
3502 (clobber (match_dup 4))])
3504 (compare:CC (match_dup 3)
3508 (define_insn "*andsi3_internal4"
3509 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
3510 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
3511 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
3513 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
3514 (and:SI (match_dup 1)
3516 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
3517 "TARGET_32BIT && rs6000_gen_cell_microcode"
3520 {andil.|andi.} %0,%1,%b2
3521 {andiu.|andis.} %0,%1,%u2
3522 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
3527 [(set_attr "type" "fast_compare,fast_compare,fast_compare,delayed_compare,\
3528 compare,compare,compare,compare")
3529 (set_attr "length" "4,4,4,4,8,8,8,8")])
3531 (define_insn "*andsi3_internal5_mc"
3532 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
3533 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
3534 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
3536 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
3537 (and:SI (match_dup 1)
3539 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
3540 "TARGET_64BIT && rs6000_gen_cell_microcode"
3543 {andil.|andi.} %0,%1,%b2
3544 {andiu.|andis.} %0,%1,%u2
3545 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
3550 [(set_attr "type" "compare,fast_compare,fast_compare,delayed_compare,compare,\
3551 compare,compare,compare")
3552 (set_attr "length" "8,4,4,4,8,8,8,8")])
3555 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3556 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
3557 (match_operand:SI 2 "and_operand" ""))
3559 (set (match_operand:SI 0 "gpc_reg_operand" "")
3560 (and:SI (match_dup 1)
3562 (clobber (match_scratch:CC 4 ""))]
3564 [(parallel [(set (match_dup 0)
3565 (and:SI (match_dup 1)
3567 (clobber (match_dup 4))])
3569 (compare:CC (match_dup 0)
3574 [(set (match_operand:CC 3 "cc_reg_operand" "")
3575 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
3576 (match_operand:SI 2 "gpc_reg_operand" ""))
3578 (set (match_operand:SI 0 "gpc_reg_operand" "")
3579 (and:SI (match_dup 1)
3581 (clobber (match_scratch:CC 4 ""))]
3582 "TARGET_POWERPC64 && reload_completed"
3583 [(parallel [(set (match_dup 0)
3584 (and:SI (match_dup 1)
3586 (clobber (match_dup 4))])
3588 (compare:CC (match_dup 0)
3592 ;; Handle the PowerPC64 rlwinm corner case
3594 (define_insn_and_split "*andsi3_internal6"
3595 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3596 (and:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3597 (match_operand:SI 2 "mask_operand_wrap" "i")))]
3602 (and:SI (rotate:SI (match_dup 1) (match_dup 3))
3605 (rotate:SI (match_dup 0) (match_dup 5)))]
3608 int mb = extract_MB (operands[2]);
3609 int me = extract_ME (operands[2]);
3610 operands[3] = GEN_INT (me + 1);
3611 operands[5] = GEN_INT (32 - (me + 1));
3612 operands[4] = GEN_INT (~((HOST_WIDE_INT) -1 << (33 + me - mb)));
3614 [(set_attr "length" "8")])
3616 (define_expand "iorsi3"
3617 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3618 (ior:SI (match_operand:SI 1 "gpc_reg_operand" "")
3619 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
3623 if (GET_CODE (operands[2]) == CONST_INT
3624 && ! logical_operand (operands[2], SImode))
3626 HOST_WIDE_INT value = INTVAL (operands[2]);
3627 rtx tmp = ((!can_create_pseudo_p ()
3628 || rtx_equal_p (operands[0], operands[1]))
3629 ? operands[0] : gen_reg_rtx (SImode));
3631 emit_insn (gen_iorsi3 (tmp, operands[1],
3632 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
3633 emit_insn (gen_iorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
3638 (define_expand "xorsi3"
3639 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3640 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
3641 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
3645 if (GET_CODE (operands[2]) == CONST_INT
3646 && ! logical_operand (operands[2], SImode))
3648 HOST_WIDE_INT value = INTVAL (operands[2]);
3649 rtx tmp = ((!can_create_pseudo_p ()
3650 || rtx_equal_p (operands[0], operands[1]))
3651 ? operands[0] : gen_reg_rtx (SImode));
3653 emit_insn (gen_xorsi3 (tmp, operands[1],
3654 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
3655 emit_insn (gen_xorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
3660 (define_insn "*boolsi3_internal1"
3661 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
3662 (match_operator:SI 3 "boolean_or_operator"
3663 [(match_operand:SI 1 "gpc_reg_operand" "%r,r,r")
3664 (match_operand:SI 2 "logical_operand" "r,K,L")]))]
3668 {%q3il|%q3i} %0,%1,%b2
3669 {%q3iu|%q3is} %0,%1,%u2")
3671 (define_insn "*boolsi3_internal2"
3672 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3673 (compare:CC (match_operator:SI 4 "boolean_or_operator"
3674 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
3675 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3677 (clobber (match_scratch:SI 3 "=r,r"))]
3682 [(set_attr "type" "fast_compare,compare")
3683 (set_attr "length" "4,8")])
3686 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3687 (compare:CC (match_operator:SI 4 "boolean_operator"
3688 [(match_operand:SI 1 "gpc_reg_operand" "")
3689 (match_operand:SI 2 "gpc_reg_operand" "")])
3691 (clobber (match_scratch:SI 3 ""))]
3692 "TARGET_32BIT && reload_completed"
3693 [(set (match_dup 3) (match_dup 4))
3695 (compare:CC (match_dup 3)
3699 (define_insn "*boolsi3_internal3"
3700 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3701 (compare:CC (match_operator:SI 4 "boolean_operator"
3702 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
3703 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3705 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3711 [(set_attr "type" "fast_compare,compare")
3712 (set_attr "length" "4,8")])
3715 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3716 (compare:CC (match_operator:SI 4 "boolean_operator"
3717 [(match_operand:SI 1 "gpc_reg_operand" "")
3718 (match_operand:SI 2 "gpc_reg_operand" "")])
3720 (set (match_operand:SI 0 "gpc_reg_operand" "")
3722 "TARGET_32BIT && reload_completed"
3723 [(set (match_dup 0) (match_dup 4))
3725 (compare:CC (match_dup 0)
3729 ;; Split a logical operation that we can't do in one insn into two insns,
3730 ;; each of which does one 16-bit part. This is used by combine.
3733 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3734 (match_operator:SI 3 "boolean_or_operator"
3735 [(match_operand:SI 1 "gpc_reg_operand" "")
3736 (match_operand:SI 2 "non_logical_cint_operand" "")]))]
3738 [(set (match_dup 0) (match_dup 4))
3739 (set (match_dup 0) (match_dup 5))]
3743 i = GEN_INT (INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff));
3744 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
3746 i = GEN_INT (INTVAL (operands[2]) & 0xffff);
3747 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
3751 (define_insn "*boolcsi3_internal1"
3752 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3753 (match_operator:SI 3 "boolean_operator"
3754 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
3755 (match_operand:SI 2 "gpc_reg_operand" "r")]))]
3759 (define_insn "*boolcsi3_internal2"
3760 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3761 (compare:CC (match_operator:SI 4 "boolean_operator"
3762 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
3763 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3765 (clobber (match_scratch:SI 3 "=r,r"))]
3770 [(set_attr "type" "compare")
3771 (set_attr "length" "4,8")])
3774 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3775 (compare:CC (match_operator:SI 4 "boolean_operator"
3776 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3777 (match_operand:SI 2 "gpc_reg_operand" "")])
3779 (clobber (match_scratch:SI 3 ""))]
3780 "TARGET_32BIT && reload_completed"
3781 [(set (match_dup 3) (match_dup 4))
3783 (compare:CC (match_dup 3)
3787 (define_insn "*boolcsi3_internal3"
3788 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3789 (compare:CC (match_operator:SI 4 "boolean_operator"
3790 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
3791 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3793 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3799 [(set_attr "type" "compare")
3800 (set_attr "length" "4,8")])
3803 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3804 (compare:CC (match_operator:SI 4 "boolean_operator"
3805 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3806 (match_operand:SI 2 "gpc_reg_operand" "")])
3808 (set (match_operand:SI 0 "gpc_reg_operand" "")
3810 "TARGET_32BIT && reload_completed"
3811 [(set (match_dup 0) (match_dup 4))
3813 (compare:CC (match_dup 0)
3817 (define_insn "*boolccsi3_internal1"
3818 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3819 (match_operator:SI 3 "boolean_operator"
3820 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
3821 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))]))]
3825 (define_insn "*boolccsi3_internal2"
3826 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3827 (compare:CC (match_operator:SI 4 "boolean_operator"
3828 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
3829 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
3831 (clobber (match_scratch:SI 3 "=r,r"))]
3836 [(set_attr "type" "fast_compare,compare")
3837 (set_attr "length" "4,8")])
3840 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3841 (compare:CC (match_operator:SI 4 "boolean_operator"
3842 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3843 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
3845 (clobber (match_scratch:SI 3 ""))]
3846 "TARGET_32BIT && reload_completed"
3847 [(set (match_dup 3) (match_dup 4))
3849 (compare:CC (match_dup 3)
3853 (define_insn "*boolccsi3_internal3"
3854 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3855 (compare:CC (match_operator:SI 4 "boolean_operator"
3856 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
3857 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
3859 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3865 [(set_attr "type" "fast_compare,compare")
3866 (set_attr "length" "4,8")])
3869 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3870 (compare:CC (match_operator:SI 4 "boolean_operator"
3871 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3872 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
3874 (set (match_operand:SI 0 "gpc_reg_operand" "")
3876 "TARGET_32BIT && reload_completed"
3877 [(set (match_dup 0) (match_dup 4))
3879 (compare:CC (match_dup 0)
3883 ;; maskir insn. We need four forms because things might be in arbitrary
3884 ;; orders. Don't define forms that only set CR fields because these
3885 ;; would modify an input register.
3887 (define_insn "*maskir_internal1"
3888 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3889 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
3890 (match_operand:SI 1 "gpc_reg_operand" "0"))
3891 (and:SI (match_dup 2)
3892 (match_operand:SI 3 "gpc_reg_operand" "r"))))]
3896 (define_insn "*maskir_internal2"
3897 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3898 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
3899 (match_operand:SI 1 "gpc_reg_operand" "0"))
3900 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3905 (define_insn "*maskir_internal3"
3906 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3907 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r")
3908 (match_operand:SI 3 "gpc_reg_operand" "r"))
3909 (and:SI (not:SI (match_dup 2))
3910 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
3914 (define_insn "*maskir_internal4"
3915 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3916 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3917 (match_operand:SI 2 "gpc_reg_operand" "r"))
3918 (and:SI (not:SI (match_dup 2))
3919 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
3923 (define_insn "*maskir_internal5"
3924 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3926 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3927 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
3928 (and:SI (match_dup 2)
3929 (match_operand:SI 3 "gpc_reg_operand" "r,r")))
3931 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3932 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3933 (and:SI (match_dup 2) (match_dup 3))))]
3938 [(set_attr "type" "compare")
3939 (set_attr "length" "4,8")])
3942 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3944 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
3945 (match_operand:SI 1 "gpc_reg_operand" ""))
3946 (and:SI (match_dup 2)
3947 (match_operand:SI 3 "gpc_reg_operand" "")))
3949 (set (match_operand:SI 0 "gpc_reg_operand" "")
3950 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3951 (and:SI (match_dup 2) (match_dup 3))))]
3952 "TARGET_POWER && reload_completed"
3954 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3955 (and:SI (match_dup 2) (match_dup 3))))
3957 (compare:CC (match_dup 0)
3961 (define_insn "*maskir_internal6"
3962 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3964 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3965 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
3966 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
3969 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3970 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3971 (and:SI (match_dup 3) (match_dup 2))))]
3976 [(set_attr "type" "compare")
3977 (set_attr "length" "4,8")])
3980 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3982 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
3983 (match_operand:SI 1 "gpc_reg_operand" ""))
3984 (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
3987 (set (match_operand:SI 0 "gpc_reg_operand" "")
3988 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3989 (and:SI (match_dup 3) (match_dup 2))))]
3990 "TARGET_POWER && reload_completed"
3992 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3993 (and:SI (match_dup 3) (match_dup 2))))
3995 (compare:CC (match_dup 0)
3999 (define_insn "*maskir_internal7"
4000 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4002 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r,r")
4003 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
4004 (and:SI (not:SI (match_dup 2))
4005 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
4007 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4008 (ior:SI (and:SI (match_dup 2) (match_dup 3))
4009 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
4014 [(set_attr "type" "compare")
4015 (set_attr "length" "4,8")])
4018 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
4020 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "")
4021 (match_operand:SI 3 "gpc_reg_operand" ""))
4022 (and:SI (not:SI (match_dup 2))
4023 (match_operand:SI 1 "gpc_reg_operand" "")))
4025 (set (match_operand:SI 0 "gpc_reg_operand" "")
4026 (ior:SI (and:SI (match_dup 2) (match_dup 3))
4027 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
4028 "TARGET_POWER && reload_completed"
4030 (ior:SI (and:SI (match_dup 2) (match_dup 3))
4031 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
4033 (compare:CC (match_dup 0)
4037 (define_insn "*maskir_internal8"
4038 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4040 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
4041 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
4042 (and:SI (not:SI (match_dup 2))
4043 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
4045 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4046 (ior:SI (and:SI (match_dup 3) (match_dup 2))
4047 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
4052 [(set_attr "type" "compare")
4053 (set_attr "length" "4,8")])
4056 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
4058 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
4059 (match_operand:SI 2 "gpc_reg_operand" ""))
4060 (and:SI (not:SI (match_dup 2))
4061 (match_operand:SI 1 "gpc_reg_operand" "")))
4063 (set (match_operand:SI 0 "gpc_reg_operand" "")
4064 (ior:SI (and:SI (match_dup 3) (match_dup 2))
4065 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
4066 "TARGET_POWER && reload_completed"
4068 (ior:SI (and:SI (match_dup 3) (match_dup 2))
4069 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
4071 (compare:CC (match_dup 0)
4075 ;; Rotate and shift insns, in all their variants. These support shifts,
4076 ;; field inserts and extracts, and various combinations thereof.
4077 (define_expand "insv"
4078 [(set (zero_extract (match_operand 0 "gpc_reg_operand" "")
4079 (match_operand:SI 1 "const_int_operand" "")
4080 (match_operand:SI 2 "const_int_operand" ""))
4081 (match_operand 3 "gpc_reg_operand" ""))]
4085 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
4086 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
4087 compiler if the address of the structure is taken later. Likewise, do
4088 not handle invalid E500 subregs. */
4089 if (GET_CODE (operands[0]) == SUBREG
4090 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD
4091 || ((TARGET_E500_DOUBLE || TARGET_SPE)
4092 && invalid_e500_subreg (operands[0], GET_MODE (operands[0])))))
4095 if (TARGET_POWERPC64 && GET_MODE (operands[0]) == DImode)
4096 emit_insn (gen_insvdi (operands[0], operands[1], operands[2], operands[3]));
4098 emit_insn (gen_insvsi (operands[0], operands[1], operands[2], operands[3]));
4102 (define_insn "insvsi"
4103 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4104 (match_operand:SI 1 "const_int_operand" "i")
4105 (match_operand:SI 2 "const_int_operand" "i"))
4106 (match_operand:SI 3 "gpc_reg_operand" "r"))]
4110 int start = INTVAL (operands[2]) & 31;
4111 int size = INTVAL (operands[1]) & 31;
4113 operands[4] = GEN_INT (32 - start - size);
4114 operands[1] = GEN_INT (start + size - 1);
4115 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
4117 [(set_attr "type" "insert_word")])
4119 (define_insn "*insvsi_internal1"
4120 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4121 (match_operand:SI 1 "const_int_operand" "i")
4122 (match_operand:SI 2 "const_int_operand" "i"))
4123 (rotate:SI (match_operand:SI 3 "gpc_reg_operand" "r")
4124 (match_operand:SI 4 "const_int_operand" "i")))]
4125 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
4128 int shift = INTVAL (operands[4]) & 31;
4129 int start = INTVAL (operands[2]) & 31;
4130 int size = INTVAL (operands[1]) & 31;
4132 operands[4] = GEN_INT (shift - start - size);
4133 operands[1] = GEN_INT (start + size - 1);
4134 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
4136 [(set_attr "type" "insert_word")])
4138 (define_insn "*insvsi_internal2"
4139 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4140 (match_operand:SI 1 "const_int_operand" "i")
4141 (match_operand:SI 2 "const_int_operand" "i"))
4142 (ashiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
4143 (match_operand:SI 4 "const_int_operand" "i")))]
4144 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
4147 int shift = INTVAL (operands[4]) & 31;
4148 int start = INTVAL (operands[2]) & 31;
4149 int size = INTVAL (operands[1]) & 31;
4151 operands[4] = GEN_INT (32 - shift - start - size);
4152 operands[1] = GEN_INT (start + size - 1);
4153 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
4155 [(set_attr "type" "insert_word")])
4157 (define_insn "*insvsi_internal3"
4158 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4159 (match_operand:SI 1 "const_int_operand" "i")
4160 (match_operand:SI 2 "const_int_operand" "i"))
4161 (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
4162 (match_operand:SI 4 "const_int_operand" "i")))]
4163 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
4166 int shift = INTVAL (operands[4]) & 31;
4167 int start = INTVAL (operands[2]) & 31;
4168 int size = INTVAL (operands[1]) & 31;
4170 operands[4] = GEN_INT (32 - shift - start - size);
4171 operands[1] = GEN_INT (start + size - 1);
4172 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
4174 [(set_attr "type" "insert_word")])
4176 (define_insn "*insvsi_internal4"
4177 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4178 (match_operand:SI 1 "const_int_operand" "i")
4179 (match_operand:SI 2 "const_int_operand" "i"))
4180 (zero_extract:SI (match_operand:SI 3 "gpc_reg_operand" "r")
4181 (match_operand:SI 4 "const_int_operand" "i")
4182 (match_operand:SI 5 "const_int_operand" "i")))]
4183 "INTVAL (operands[4]) >= INTVAL (operands[1])"
4186 int extract_start = INTVAL (operands[5]) & 31;
4187 int extract_size = INTVAL (operands[4]) & 31;
4188 int insert_start = INTVAL (operands[2]) & 31;
4189 int insert_size = INTVAL (operands[1]) & 31;
4191 /* Align extract field with insert field */
4192 operands[5] = GEN_INT (extract_start + extract_size - insert_start - insert_size);
4193 operands[1] = GEN_INT (insert_start + insert_size - 1);
4194 return \"{rlimi|rlwimi} %0,%3,%h5,%h2,%h1\";
4196 [(set_attr "type" "insert_word")])
4198 ;; combine patterns for rlwimi
4199 (define_insn "*insvsi_internal5"
4200 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4201 (ior:SI (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
4202 (match_operand:SI 1 "mask_operand" "i"))
4203 (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
4204 (match_operand:SI 2 "const_int_operand" "i"))
4205 (match_operand:SI 5 "mask_operand" "i"))))]
4206 "TARGET_POWERPC && INTVAL(operands[1]) == ~INTVAL(operands[5])"
4209 int me = extract_ME(operands[5]);
4210 int mb = extract_MB(operands[5]);
4211 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
4212 operands[2] = GEN_INT(mb);
4213 operands[1] = GEN_INT(me);
4214 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
4216 [(set_attr "type" "insert_word")])
4218 (define_insn "*insvsi_internal6"
4219 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4220 (ior:SI (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
4221 (match_operand:SI 2 "const_int_operand" "i"))
4222 (match_operand:SI 5 "mask_operand" "i"))
4223 (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
4224 (match_operand:SI 1 "mask_operand" "i"))))]
4225 "TARGET_POWERPC && INTVAL(operands[1]) == ~INTVAL(operands[5])"
4228 int me = extract_ME(operands[5]);
4229 int mb = extract_MB(operands[5]);
4230 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
4231 operands[2] = GEN_INT(mb);
4232 operands[1] = GEN_INT(me);
4233 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
4235 [(set_attr "type" "insert_word")])
4237 (define_insn "insvdi"
4238 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
4239 (match_operand:SI 1 "const_int_operand" "i")
4240 (match_operand:SI 2 "const_int_operand" "i"))
4241 (match_operand:DI 3 "gpc_reg_operand" "r"))]
4245 int start = INTVAL (operands[2]) & 63;
4246 int size = INTVAL (operands[1]) & 63;
4248 operands[1] = GEN_INT (64 - start - size);
4249 return \"rldimi %0,%3,%H1,%H2\";
4251 [(set_attr "type" "insert_dword")])
4253 (define_insn "*insvdi_internal2"
4254 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
4255 (match_operand:SI 1 "const_int_operand" "i")
4256 (match_operand:SI 2 "const_int_operand" "i"))
4257 (ashiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
4258 (match_operand:SI 4 "const_int_operand" "i")))]
4260 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
4263 int shift = INTVAL (operands[4]) & 63;
4264 int start = (INTVAL (operands[2]) & 63) - 32;
4265 int size = INTVAL (operands[1]) & 63;
4267 operands[4] = GEN_INT (64 - shift - start - size);
4268 operands[2] = GEN_INT (start);
4269 operands[1] = GEN_INT (start + size - 1);
4270 return \"rlwimi %0,%3,%h4,%h2,%h1\";
4273 (define_insn "*insvdi_internal3"
4274 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
4275 (match_operand:SI 1 "const_int_operand" "i")
4276 (match_operand:SI 2 "const_int_operand" "i"))
4277 (lshiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
4278 (match_operand:SI 4 "const_int_operand" "i")))]
4280 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
4283 int shift = INTVAL (operands[4]) & 63;
4284 int start = (INTVAL (operands[2]) & 63) - 32;
4285 int size = INTVAL (operands[1]) & 63;
4287 operands[4] = GEN_INT (64 - shift - start - size);
4288 operands[2] = GEN_INT (start);
4289 operands[1] = GEN_INT (start + size - 1);
4290 return \"rlwimi %0,%3,%h4,%h2,%h1\";
4293 (define_expand "extzv"
4294 [(set (match_operand 0 "gpc_reg_operand" "")
4295 (zero_extract (match_operand 1 "gpc_reg_operand" "")
4296 (match_operand:SI 2 "const_int_operand" "")
4297 (match_operand:SI 3 "const_int_operand" "")))]
4301 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
4302 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
4303 compiler if the address of the structure is taken later. */
4304 if (GET_CODE (operands[0]) == SUBREG
4305 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
4308 if (TARGET_POWERPC64 && GET_MODE (operands[1]) == DImode)
4309 emit_insn (gen_extzvdi (operands[0], operands[1], operands[2], operands[3]));
4311 emit_insn (gen_extzvsi (operands[0], operands[1], operands[2], operands[3]));
4315 (define_insn "extzvsi"
4316 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4317 (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4318 (match_operand:SI 2 "const_int_operand" "i")
4319 (match_operand:SI 3 "const_int_operand" "i")))]
4323 int start = INTVAL (operands[3]) & 31;
4324 int size = INTVAL (operands[2]) & 31;
4326 if (start + size >= 32)
4327 operands[3] = const0_rtx;
4329 operands[3] = GEN_INT (start + size);
4330 return \"{rlinm|rlwinm} %0,%1,%3,%s2,31\";
4333 (define_insn "*extzvsi_internal1"
4334 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4335 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4336 (match_operand:SI 2 "const_int_operand" "i,i")
4337 (match_operand:SI 3 "const_int_operand" "i,i"))
4339 (clobber (match_scratch:SI 4 "=r,r"))]
4343 int start = INTVAL (operands[3]) & 31;
4344 int size = INTVAL (operands[2]) & 31;
4346 /* Force split for non-cc0 compare. */
4347 if (which_alternative == 1)
4350 /* If the bit-field being tested fits in the upper or lower half of a
4351 word, it is possible to use andiu. or andil. to test it. This is
4352 useful because the condition register set-use delay is smaller for
4353 andi[ul]. than for rlinm. This doesn't work when the starting bit
4354 position is 0 because the LT and GT bits may be set wrong. */
4356 if ((start > 0 && start + size <= 16) || start >= 16)
4358 operands[3] = GEN_INT (((1 << (16 - (start & 15)))
4359 - (1 << (16 - (start & 15) - size))));
4361 return \"{andiu.|andis.} %4,%1,%3\";
4363 return \"{andil.|andi.} %4,%1,%3\";
4366 if (start + size >= 32)
4367 operands[3] = const0_rtx;
4369 operands[3] = GEN_INT (start + size);
4370 return \"{rlinm.|rlwinm.} %4,%1,%3,%s2,31\";
4372 [(set_attr "type" "delayed_compare")
4373 (set_attr "length" "4,8")])
4376 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4377 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
4378 (match_operand:SI 2 "const_int_operand" "")
4379 (match_operand:SI 3 "const_int_operand" ""))
4381 (clobber (match_scratch:SI 4 ""))]
4384 (zero_extract:SI (match_dup 1) (match_dup 2)
4387 (compare:CC (match_dup 4)
4391 (define_insn "*extzvsi_internal2"
4392 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4393 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4394 (match_operand:SI 2 "const_int_operand" "i,i")
4395 (match_operand:SI 3 "const_int_operand" "i,i"))
4397 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4398 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
4402 int start = INTVAL (operands[3]) & 31;
4403 int size = INTVAL (operands[2]) & 31;
4405 /* Force split for non-cc0 compare. */
4406 if (which_alternative == 1)
4409 /* Since we are using the output value, we can't ignore any need for
4410 a shift. The bit-field must end at the LSB. */
4411 if (start >= 16 && start + size == 32)
4413 operands[3] = GEN_INT ((1 << size) - 1);
4414 return \"{andil.|andi.} %0,%1,%3\";
4417 if (start + size >= 32)
4418 operands[3] = const0_rtx;
4420 operands[3] = GEN_INT (start + size);
4421 return \"{rlinm.|rlwinm.} %0,%1,%3,%s2,31\";
4423 [(set_attr "type" "delayed_compare")
4424 (set_attr "length" "4,8")])
4427 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
4428 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
4429 (match_operand:SI 2 "const_int_operand" "")
4430 (match_operand:SI 3 "const_int_operand" ""))
4432 (set (match_operand:SI 0 "gpc_reg_operand" "")
4433 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
4436 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))
4438 (compare:CC (match_dup 0)
4442 (define_insn "extzvdi"
4443 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4444 (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4445 (match_operand:SI 2 "const_int_operand" "i")
4446 (match_operand:SI 3 "const_int_operand" "i")))]
4450 int start = INTVAL (operands[3]) & 63;
4451 int size = INTVAL (operands[2]) & 63;
4453 if (start + size >= 64)
4454 operands[3] = const0_rtx;
4456 operands[3] = GEN_INT (start + size);
4457 operands[2] = GEN_INT (64 - size);
4458 return \"rldicl %0,%1,%3,%2\";
4461 (define_insn "*extzvdi_internal1"
4462 [(set (match_operand:CC 0 "gpc_reg_operand" "=x")
4463 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4464 (match_operand:SI 2 "const_int_operand" "i")
4465 (match_operand:SI 3 "const_int_operand" "i"))
4467 (clobber (match_scratch:DI 4 "=r"))]
4468 "TARGET_64BIT && rs6000_gen_cell_microcode"
4471 int start = INTVAL (operands[3]) & 63;
4472 int size = INTVAL (operands[2]) & 63;
4474 if (start + size >= 64)
4475 operands[3] = const0_rtx;
4477 operands[3] = GEN_INT (start + size);
4478 operands[2] = GEN_INT (64 - size);
4479 return \"rldicl. %4,%1,%3,%2\";
4481 [(set_attr "type" "compare")])
4483 (define_insn "*extzvdi_internal2"
4484 [(set (match_operand:CC 4 "gpc_reg_operand" "=x")
4485 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4486 (match_operand:SI 2 "const_int_operand" "i")
4487 (match_operand:SI 3 "const_int_operand" "i"))
4489 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
4490 (zero_extract:DI (match_dup 1) (match_dup 2) (match_dup 3)))]
4491 "TARGET_64BIT && rs6000_gen_cell_microcode"
4494 int start = INTVAL (operands[3]) & 63;
4495 int size = INTVAL (operands[2]) & 63;
4497 if (start + size >= 64)
4498 operands[3] = const0_rtx;
4500 operands[3] = GEN_INT (start + size);
4501 operands[2] = GEN_INT (64 - size);
4502 return \"rldicl. %0,%1,%3,%2\";
4504 [(set_attr "type" "compare")])
4506 (define_insn "rotlsi3"
4507 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4508 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4509 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
4512 {rlnm|rlwnm} %0,%1,%2,0xffffffff
4513 {rlinm|rlwinm} %0,%1,%h2,0xffffffff"
4514 [(set_attr "type" "var_shift_rotate,integer")])
4516 (define_insn "*rotlsi3_64"
4517 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
4519 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4520 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))))]
4523 {rlnm|rlwnm} %0,%1,%2,0xffffffff
4524 {rlinm|rlwinm} %0,%1,%h2,0xffffffff"
4525 [(set_attr "type" "var_shift_rotate,integer")])
4527 (define_insn "*rotlsi3_internal2"
4528 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4529 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4530 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4532 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4535 {rlnm.|rlwnm.} %3,%1,%2,0xffffffff
4536 {rlinm.|rlwinm.} %3,%1,%h2,0xffffffff
4539 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4540 (set_attr "length" "4,4,8,8")])
4543 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4544 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4545 (match_operand:SI 2 "reg_or_cint_operand" ""))
4547 (clobber (match_scratch:SI 3 ""))]
4550 (rotate:SI (match_dup 1) (match_dup 2)))
4552 (compare:CC (match_dup 3)
4556 (define_insn "*rotlsi3_internal3"
4557 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4558 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4559 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4561 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4562 (rotate:SI (match_dup 1) (match_dup 2)))]
4565 {rlnm.|rlwnm.} %0,%1,%2,0xffffffff
4566 {rlinm.|rlwinm.} %0,%1,%h2,0xffffffff
4569 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4570 (set_attr "length" "4,4,8,8")])
4573 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4574 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4575 (match_operand:SI 2 "reg_or_cint_operand" ""))
4577 (set (match_operand:SI 0 "gpc_reg_operand" "")
4578 (rotate:SI (match_dup 1) (match_dup 2)))]
4581 (rotate:SI (match_dup 1) (match_dup 2)))
4583 (compare:CC (match_dup 0)
4587 (define_insn "*rotlsi3_internal4"
4588 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4589 (and:SI (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4590 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
4591 (match_operand:SI 3 "mask_operand" "n,n")))]
4594 {rlnm|rlwnm} %0,%1,%2,%m3,%M3
4595 {rlinm|rlwinm} %0,%1,%h2,%m3,%M3"
4596 [(set_attr "type" "var_shift_rotate,integer")])
4598 (define_insn "*rotlsi3_internal5"
4599 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4601 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4602 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4603 (match_operand:SI 3 "mask_operand" "n,n,n,n"))
4605 (clobber (match_scratch:SI 4 "=r,r,r,r"))]
4608 {rlnm.|rlwnm.} %4,%1,%2,%m3,%M3
4609 {rlinm.|rlwinm.} %4,%1,%h2,%m3,%M3
4612 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4613 (set_attr "length" "4,4,8,8")])
4616 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4618 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4619 (match_operand:SI 2 "reg_or_cint_operand" ""))
4620 (match_operand:SI 3 "mask_operand" ""))
4622 (clobber (match_scratch:SI 4 ""))]
4625 (and:SI (rotate:SI (match_dup 1)
4629 (compare:CC (match_dup 4)
4633 (define_insn "*rotlsi3_internal6"
4634 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
4636 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4637 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4638 (match_operand:SI 3 "mask_operand" "n,n,n,n"))
4640 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4641 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4644 {rlnm.|rlwnm.} %0,%1,%2,%m3,%M3
4645 {rlinm.|rlwinm.} %0,%1,%h2,%m3,%M3
4648 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4649 (set_attr "length" "4,4,8,8")])
4652 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
4654 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4655 (match_operand:SI 2 "reg_or_cint_operand" ""))
4656 (match_operand:SI 3 "mask_operand" ""))
4658 (set (match_operand:SI 0 "gpc_reg_operand" "")
4659 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4662 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4664 (compare:CC (match_dup 0)
4668 (define_insn "*rotlsi3_internal7"
4669 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4672 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4673 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
4675 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xff"
4676 [(set (attr "cell_micro")
4677 (if_then_else (match_operand:SI 2 "const_int_operand" "")
4678 (const_string "not")
4679 (const_string "always")))])
4681 (define_insn "*rotlsi3_internal8"
4682 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4683 (compare:CC (zero_extend:SI
4685 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4686 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4688 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4691 {rlnm.|rlwnm.} %3,%1,%2,0xff
4692 {rlinm.|rlwinm.} %3,%1,%h2,0xff
4695 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4696 (set_attr "length" "4,4,8,8")])
4699 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4700 (compare:CC (zero_extend:SI
4702 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4703 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4705 (clobber (match_scratch:SI 3 ""))]
4708 (zero_extend:SI (subreg:QI
4709 (rotate:SI (match_dup 1)
4712 (compare:CC (match_dup 3)
4716 (define_insn "*rotlsi3_internal9"
4717 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4718 (compare:CC (zero_extend:SI
4720 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4721 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4723 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4724 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4727 {rlnm.|rlwnm.} %0,%1,%2,0xff
4728 {rlinm.|rlwinm.} %0,%1,%h2,0xff
4731 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4732 (set_attr "length" "4,4,8,8")])
4735 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4736 (compare:CC (zero_extend:SI
4738 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4739 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4741 (set (match_operand:SI 0 "gpc_reg_operand" "")
4742 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4745 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
4747 (compare:CC (match_dup 0)
4751 (define_insn "*rotlsi3_internal10"
4752 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4755 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4756 (match_operand:SI 2 "reg_or_cint_operand" "r,i")) 0)))]
4759 {rlnm|rlwnm} %0,%1,%2,0xffff
4760 {rlinm|rlwinm} %0,%1,%h2,0xffff"
4761 [(set_attr "type" "var_shift_rotate,integer")])
4764 (define_insn "*rotlsi3_internal11"
4765 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4766 (compare:CC (zero_extend:SI
4768 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4769 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4771 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4774 {rlnm.|rlwnm.} %3,%1,%2,0xffff
4775 {rlinm.|rlwinm.} %3,%1,%h2,0xffff
4778 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4779 (set_attr "length" "4,4,8,8")])
4782 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4783 (compare:CC (zero_extend:SI
4785 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4786 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4788 (clobber (match_scratch:SI 3 ""))]
4791 (zero_extend:SI (subreg:HI
4792 (rotate:SI (match_dup 1)
4795 (compare:CC (match_dup 3)
4799 (define_insn "*rotlsi3_internal12"
4800 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4801 (compare:CC (zero_extend:SI
4803 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4804 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4806 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4807 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4810 {rlnm.|rlwnm.} %0,%1,%2,0xffff
4811 {rlinm.|rlwinm.} %0,%1,%h2,0xffff
4814 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4815 (set_attr "length" "4,4,8,8")])
4818 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4819 (compare:CC (zero_extend:SI
4821 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4822 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4824 (set (match_operand:SI 0 "gpc_reg_operand" "")
4825 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4828 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
4830 (compare:CC (match_dup 0)
4834 ;; Note that we use "sle." instead of "sl." so that we can set
4835 ;; SHIFT_COUNT_TRUNCATED.
4837 (define_expand "ashlsi3"
4838 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
4839 (use (match_operand:SI 1 "gpc_reg_operand" ""))
4840 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
4845 emit_insn (gen_ashlsi3_power (operands[0], operands[1], operands[2]));
4847 emit_insn (gen_ashlsi3_no_power (operands[0], operands[1], operands[2]));
4851 (define_insn "ashlsi3_power"
4852 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4853 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4854 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
4855 (clobber (match_scratch:SI 3 "=q,X"))]
4859 {sli|slwi} %0,%1,%h2")
4861 (define_insn "ashlsi3_no_power"
4862 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4863 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4864 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
4868 {sli|slwi} %0,%1,%h2"
4869 [(set_attr "type" "var_shift_rotate,shift")])
4871 (define_insn "*ashlsi3_64"
4872 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
4874 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4875 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))))]
4879 {sli|slwi} %0,%1,%h2"
4880 [(set_attr "type" "var_shift_rotate,shift")])
4883 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4884 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4885 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4887 (clobber (match_scratch:SI 3 "=r,r,r,r"))
4888 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4892 {sli.|slwi.} %3,%1,%h2
4895 [(set_attr "type" "delayed_compare")
4896 (set_attr "length" "4,4,8,8")])
4899 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4900 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4901 (match_operand:SI 2 "reg_or_cint_operand" ""))
4903 (clobber (match_scratch:SI 3 ""))
4904 (clobber (match_scratch:SI 4 ""))]
4905 "TARGET_POWER && reload_completed"
4906 [(parallel [(set (match_dup 3)
4907 (ashift:SI (match_dup 1) (match_dup 2)))
4908 (clobber (match_dup 4))])
4910 (compare:CC (match_dup 3)
4915 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4916 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4917 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4919 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4920 "! TARGET_POWER && TARGET_32BIT"
4923 {sli.|slwi.} %3,%1,%h2
4926 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4927 (set_attr "length" "4,4,8,8")])
4930 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4931 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4932 (match_operand:SI 2 "reg_or_cint_operand" ""))
4934 (clobber (match_scratch:SI 3 ""))]
4935 "! TARGET_POWER && TARGET_32BIT && reload_completed"
4937 (ashift:SI (match_dup 1) (match_dup 2)))
4939 (compare:CC (match_dup 3)
4944 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4945 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4946 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4948 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4949 (ashift:SI (match_dup 1) (match_dup 2)))
4950 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4954 {sli.|slwi.} %0,%1,%h2
4957 [(set_attr "type" "delayed_compare")
4958 (set_attr "length" "4,4,8,8")])
4961 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4962 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4963 (match_operand:SI 2 "reg_or_cint_operand" ""))
4965 (set (match_operand:SI 0 "gpc_reg_operand" "")
4966 (ashift:SI (match_dup 1) (match_dup 2)))
4967 (clobber (match_scratch:SI 4 ""))]
4968 "TARGET_POWER && reload_completed"
4969 [(parallel [(set (match_dup 0)
4970 (ashift:SI (match_dup 1) (match_dup 2)))
4971 (clobber (match_dup 4))])
4973 (compare:CC (match_dup 0)
4978 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4979 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4980 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4982 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4983 (ashift:SI (match_dup 1) (match_dup 2)))]
4984 "! TARGET_POWER && TARGET_32BIT"
4987 {sli.|slwi.} %0,%1,%h2
4990 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4991 (set_attr "length" "4,4,8,8")])
4994 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4995 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4996 (match_operand:SI 2 "reg_or_cint_operand" ""))
4998 (set (match_operand:SI 0 "gpc_reg_operand" "")
4999 (ashift:SI (match_dup 1) (match_dup 2)))]
5000 "! TARGET_POWER && TARGET_32BIT && reload_completed"
5002 (ashift:SI (match_dup 1) (match_dup 2)))
5004 (compare:CC (match_dup 0)
5008 (define_insn "rlwinm"
5009 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5010 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
5011 (match_operand:SI 2 "const_int_operand" "i"))
5012 (match_operand:SI 3 "mask_operand" "n")))]
5013 "includes_lshift_p (operands[2], operands[3])"
5014 "{rlinm|rlwinm} %0,%1,%h2,%m3,%M3")
5017 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
5019 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5020 (match_operand:SI 2 "const_int_operand" "i,i"))
5021 (match_operand:SI 3 "mask_operand" "n,n"))
5023 (clobber (match_scratch:SI 4 "=r,r"))]
5024 "includes_lshift_p (operands[2], operands[3])"
5026 {rlinm.|rlwinm.} %4,%1,%h2,%m3,%M3
5028 [(set_attr "type" "delayed_compare")
5029 (set_attr "length" "4,8")])
5032 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
5034 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
5035 (match_operand:SI 2 "const_int_operand" ""))
5036 (match_operand:SI 3 "mask_operand" ""))
5038 (clobber (match_scratch:SI 4 ""))]
5039 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
5041 (and:SI (ashift:SI (match_dup 1) (match_dup 2))
5044 (compare:CC (match_dup 4)
5049 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
5051 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5052 (match_operand:SI 2 "const_int_operand" "i,i"))
5053 (match_operand:SI 3 "mask_operand" "n,n"))
5055 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
5056 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
5057 "includes_lshift_p (operands[2], operands[3])"
5059 {rlinm.|rlwinm.} %0,%1,%h2,%m3,%M3
5061 [(set_attr "type" "delayed_compare")
5062 (set_attr "length" "4,8")])
5065 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
5067 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
5068 (match_operand:SI 2 "const_int_operand" ""))
5069 (match_operand:SI 3 "mask_operand" ""))
5071 (set (match_operand:SI 0 "gpc_reg_operand" "")
5072 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
5073 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
5075 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
5077 (compare:CC (match_dup 0)
5081 ;; The AIX assembler mis-handles "sri x,x,0", so write that case as
5083 (define_expand "lshrsi3"
5084 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
5085 (use (match_operand:SI 1 "gpc_reg_operand" ""))
5086 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
5091 emit_insn (gen_lshrsi3_power (operands[0], operands[1], operands[2]));
5093 emit_insn (gen_lshrsi3_no_power (operands[0], operands[1], operands[2]));
5097 (define_insn "lshrsi3_power"
5098 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
5099 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
5100 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i")))
5101 (clobber (match_scratch:SI 3 "=q,X,X"))]
5106 {s%A2i|s%A2wi} %0,%1,%h2")
5108 (define_insn "lshrsi3_no_power"
5109 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
5110 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
5111 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i")))]
5116 {sri|srwi} %0,%1,%h2"
5117 [(set_attr "type" "integer,var_shift_rotate,shift")])
5119 (define_insn "*lshrsi3_64"
5120 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
5122 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5123 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))))]
5127 {sri|srwi} %0,%1,%h2"
5128 [(set_attr "type" "var_shift_rotate,shift")])
5131 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,?y,?y,?y")
5132 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
5133 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
5135 (clobber (match_scratch:SI 3 "=r,X,r,r,X,r"))
5136 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
5141 {s%A2i.|s%A2wi.} %3,%1,%h2
5145 [(set_attr "type" "delayed_compare")
5146 (set_attr "length" "4,4,4,8,8,8")])
5149 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
5150 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5151 (match_operand:SI 2 "reg_or_cint_operand" ""))
5153 (clobber (match_scratch:SI 3 ""))
5154 (clobber (match_scratch:SI 4 ""))]
5155 "TARGET_POWER && reload_completed"
5156 [(parallel [(set (match_dup 3)
5157 (lshiftrt:SI (match_dup 1) (match_dup 2)))
5158 (clobber (match_dup 4))])
5160 (compare:CC (match_dup 3)
5165 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,?y,?y,?y")
5166 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
5167 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i,O,r,i"))
5169 (clobber (match_scratch:SI 3 "=X,r,r,X,r,r"))]
5170 "! TARGET_POWER && TARGET_32BIT"
5174 {sri.|srwi.} %3,%1,%h2
5178 [(set_attr "type" "delayed_compare,var_delayed_compare,delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
5179 (set_attr "length" "4,4,4,8,8,8")])
5182 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
5183 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5184 (match_operand:SI 2 "reg_or_cint_operand" ""))
5186 (clobber (match_scratch:SI 3 ""))]
5187 "! TARGET_POWER && TARGET_32BIT && reload_completed"
5189 (lshiftrt:SI (match_dup 1) (match_dup 2)))
5191 (compare:CC (match_dup 3)
5196 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,?y,?y,?y")
5197 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
5198 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
5200 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
5201 (lshiftrt:SI (match_dup 1) (match_dup 2)))
5202 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
5207 {s%A2i.|s%A2wi.} %0,%1,%h2
5211 [(set_attr "type" "delayed_compare")
5212 (set_attr "length" "4,4,4,8,8,8")])
5215 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
5216 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5217 (match_operand:SI 2 "reg_or_cint_operand" ""))
5219 (set (match_operand:SI 0 "gpc_reg_operand" "")
5220 (lshiftrt:SI (match_dup 1) (match_dup 2)))
5221 (clobber (match_scratch:SI 4 ""))]
5222 "TARGET_POWER && reload_completed"
5223 [(parallel [(set (match_dup 0)
5224 (lshiftrt:SI (match_dup 1) (match_dup 2)))
5225 (clobber (match_dup 4))])
5227 (compare:CC (match_dup 0)
5232 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,?y,?y,?y")
5233 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
5234 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i,O,r,i"))
5236 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
5237 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
5238 "! TARGET_POWER && TARGET_32BIT"
5242 {sri.|srwi.} %0,%1,%h2
5246 [(set_attr "type" "delayed_compare,var_delayed_compare,delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
5247 (set_attr "length" "4,4,4,8,8,8")])
5250 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
5251 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5252 (match_operand:SI 2 "reg_or_cint_operand" ""))
5254 (set (match_operand:SI 0 "gpc_reg_operand" "")
5255 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
5256 "! TARGET_POWER && TARGET_32BIT && reload_completed"
5258 (lshiftrt:SI (match_dup 1) (match_dup 2)))
5260 (compare:CC (match_dup 0)
5265 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5266 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
5267 (match_operand:SI 2 "const_int_operand" "i"))
5268 (match_operand:SI 3 "mask_operand" "n")))]
5269 "includes_rshift_p (operands[2], operands[3])"
5270 "{rlinm|rlwinm} %0,%1,%s2,%m3,%M3")
5273 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
5275 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5276 (match_operand:SI 2 "const_int_operand" "i,i"))
5277 (match_operand:SI 3 "mask_operand" "n,n"))
5279 (clobber (match_scratch:SI 4 "=r,r"))]
5280 "includes_rshift_p (operands[2], operands[3])"
5282 {rlinm.|rlwinm.} %4,%1,%s2,%m3,%M3
5284 [(set_attr "type" "delayed_compare")
5285 (set_attr "length" "4,8")])
5288 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
5290 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5291 (match_operand:SI 2 "const_int_operand" ""))
5292 (match_operand:SI 3 "mask_operand" ""))
5294 (clobber (match_scratch:SI 4 ""))]
5295 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
5297 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2))
5300 (compare:CC (match_dup 4)
5305 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
5307 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5308 (match_operand:SI 2 "const_int_operand" "i,i"))
5309 (match_operand:SI 3 "mask_operand" "n,n"))
5311 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
5312 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
5313 "includes_rshift_p (operands[2], operands[3])"
5315 {rlinm.|rlwinm.} %0,%1,%s2,%m3,%M3
5317 [(set_attr "type" "delayed_compare")
5318 (set_attr "length" "4,8")])
5321 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
5323 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5324 (match_operand:SI 2 "const_int_operand" ""))
5325 (match_operand:SI 3 "mask_operand" ""))
5327 (set (match_operand:SI 0 "gpc_reg_operand" "")
5328 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
5329 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
5331 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
5333 (compare:CC (match_dup 0)
5338 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5341 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
5342 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
5343 "includes_rshift_p (operands[2], GEN_INT (255))"
5344 "{rlinm|rlwinm} %0,%1,%s2,0xff")
5347 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
5351 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5352 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
5354 (clobber (match_scratch:SI 3 "=r,r"))]
5355 "includes_rshift_p (operands[2], GEN_INT (255))"
5357 {rlinm.|rlwinm.} %3,%1,%s2,0xff
5359 [(set_attr "type" "delayed_compare")
5360 (set_attr "length" "4,8")])
5363 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
5367 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5368 (match_operand:SI 2 "const_int_operand" "")) 0))
5370 (clobber (match_scratch:SI 3 ""))]
5371 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
5373 (zero_extend:SI (subreg:QI
5374 (lshiftrt:SI (match_dup 1)
5377 (compare:CC (match_dup 3)
5382 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
5386 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5387 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
5389 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
5390 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
5391 "includes_rshift_p (operands[2], GEN_INT (255))"
5393 {rlinm.|rlwinm.} %0,%1,%s2,0xff
5395 [(set_attr "type" "delayed_compare")
5396 (set_attr "length" "4,8")])
5399 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
5403 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5404 (match_operand:SI 2 "const_int_operand" "")) 0))
5406 (set (match_operand:SI 0 "gpc_reg_operand" "")
5407 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
5408 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
5410 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
5412 (compare:CC (match_dup 0)
5417 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5420 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
5421 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
5422 "includes_rshift_p (operands[2], GEN_INT (65535))"
5423 "{rlinm|rlwinm} %0,%1,%s2,0xffff")
5426 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
5430 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5431 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
5433 (clobber (match_scratch:SI 3 "=r,r"))]
5434 "includes_rshift_p (operands[2], GEN_INT (65535))"
5436 {rlinm.|rlwinm.} %3,%1,%s2,0xffff
5438 [(set_attr "type" "delayed_compare")
5439 (set_attr "length" "4,8")])
5442 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
5446 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5447 (match_operand:SI 2 "const_int_operand" "")) 0))
5449 (clobber (match_scratch:SI 3 ""))]
5450 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
5452 (zero_extend:SI (subreg:HI
5453 (lshiftrt:SI (match_dup 1)
5456 (compare:CC (match_dup 3)
5461 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
5465 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5466 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
5468 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
5469 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
5470 "includes_rshift_p (operands[2], GEN_INT (65535))"
5472 {rlinm.|rlwinm.} %0,%1,%s2,0xffff
5474 [(set_attr "type" "delayed_compare")
5475 (set_attr "length" "4,8")])
5478 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
5482 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5483 (match_operand:SI 2 "const_int_operand" "")) 0))
5485 (set (match_operand:SI 0 "gpc_reg_operand" "")
5486 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
5487 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
5489 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
5491 (compare:CC (match_dup 0)
5496 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
5498 (match_operand:SI 1 "gpc_reg_operand" "r"))
5499 (ashiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
5505 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
5507 (match_operand:SI 1 "gpc_reg_operand" "r"))
5508 (lshiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
5514 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
5516 (match_operand:SI 1 "gpc_reg_operand" "r"))
5517 (zero_extract:SI (match_operand:SI 2 "gpc_reg_operand" "r")
5523 (define_expand "ashrsi3"
5524 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5525 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5526 (match_operand:SI 2 "reg_or_cint_operand" "")))]
5531 emit_insn (gen_ashrsi3_power (operands[0], operands[1], operands[2]));
5533 emit_insn (gen_ashrsi3_no_power (operands[0], operands[1], operands[2]));
5537 (define_insn "ashrsi3_power"
5538 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
5539 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5540 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
5541 (clobber (match_scratch:SI 3 "=q,X"))]
5545 {srai|srawi} %0,%1,%h2"
5546 [(set_attr "type" "shift")])
5548 (define_insn "ashrsi3_no_power"
5549 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
5550 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5551 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
5555 {srai|srawi} %0,%1,%h2"
5556 [(set_attr "type" "var_shift_rotate,shift")])
5558 (define_insn "*ashrsi3_64"
5559 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
5561 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5562 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))))]
5566 {srai|srawi} %0,%1,%h2"
5567 [(set_attr "type" "var_shift_rotate,shift")])
5570 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
5571 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
5572 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
5574 (clobber (match_scratch:SI 3 "=r,r,r,r"))
5575 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
5579 {srai.|srawi.} %3,%1,%h2
5582 [(set_attr "type" "delayed_compare")
5583 (set_attr "length" "4,4,8,8")])
5586 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
5587 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5588 (match_operand:SI 2 "reg_or_cint_operand" ""))
5590 (clobber (match_scratch:SI 3 ""))
5591 (clobber (match_scratch:SI 4 ""))]
5592 "TARGET_POWER && reload_completed"
5593 [(parallel [(set (match_dup 3)
5594 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5595 (clobber (match_dup 4))])
5597 (compare:CC (match_dup 3)
5602 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
5603 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
5604 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
5606 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
5609 {sra.|sraw.} %3,%1,%2
5610 {srai.|srawi.} %3,%1,%h2
5613 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
5614 (set_attr "length" "4,4,8,8")])
5617 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
5618 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5619 (match_operand:SI 2 "reg_or_cint_operand" ""))
5621 (clobber (match_scratch:SI 3 ""))]
5622 "! TARGET_POWER && reload_completed"
5624 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5626 (compare:CC (match_dup 3)
5631 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
5632 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
5633 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
5635 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
5636 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5637 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
5641 {srai.|srawi.} %0,%1,%h2
5644 [(set_attr "type" "delayed_compare")
5645 (set_attr "length" "4,4,8,8")])
5648 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
5649 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5650 (match_operand:SI 2 "reg_or_cint_operand" ""))
5652 (set (match_operand:SI 0 "gpc_reg_operand" "")
5653 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5654 (clobber (match_scratch:SI 4 ""))]
5655 "TARGET_POWER && reload_completed"
5656 [(parallel [(set (match_dup 0)
5657 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5658 (clobber (match_dup 4))])
5660 (compare:CC (match_dup 0)
5665 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
5666 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
5667 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
5669 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
5670 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
5673 {sra.|sraw.} %0,%1,%2
5674 {srai.|srawi.} %0,%1,%h2
5677 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
5678 (set_attr "length" "4,4,8,8")])
5680 ;; Builtins to replace a division to generate FRE reciprocal estimate
5681 ;; instructions and the necessary fixup instructions
5682 (define_expand "recip<mode>3"
5683 [(match_operand:RECIPF 0 "gpc_reg_operand" "")
5684 (match_operand:RECIPF 1 "gpc_reg_operand" "")
5685 (match_operand:RECIPF 2 "gpc_reg_operand" "")]
5686 "RS6000_RECIP_HAVE_RE_P (<MODE>mode)"
5688 rs6000_emit_swdiv (operands[0], operands[1], operands[2], false);
5692 ;; Split to create division from FRE/FRES/etc. and fixup instead of the normal
5693 ;; hardware division. This is only done before register allocation and with
5694 ;; -ffast-math. This must appear before the divsf3/divdf3 insns.
5696 [(set (match_operand:RECIPF 0 "gpc_reg_operand" "")
5697 (div:RECIPF (match_operand 1 "gpc_reg_operand" "")
5698 (match_operand 2 "gpc_reg_operand" "")))]
5699 "RS6000_RECIP_AUTO_RE_P (<MODE>mode)
5700 && can_create_pseudo_p () && optimize_insn_for_speed_p ()
5701 && flag_finite_math_only && !flag_trapping_math && flag_reciprocal_math"
5704 rs6000_emit_swdiv (operands[0], operands[1], operands[2], true);
5708 ;; Builtins to replace 1/sqrt(x) with instructions using RSQRTE and the
5709 ;; appropriate fixup.
5710 (define_expand "rsqrt<mode>2"
5711 [(match_operand:RECIPF 0 "gpc_reg_operand" "")
5712 (match_operand:RECIPF 1 "gpc_reg_operand" "")]
5713 "RS6000_RECIP_HAVE_RSQRTE_P (<MODE>mode)"
5715 rs6000_emit_swrsqrt (operands[0], operands[1]);
5720 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
5721 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5722 (match_operand:SI 2 "reg_or_cint_operand" ""))
5724 (set (match_operand:SI 0 "gpc_reg_operand" "")
5725 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
5726 "! TARGET_POWER && reload_completed"
5728 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5730 (compare:CC (match_dup 0)
5734 ;; Floating-point insns, excluding normal data motion.
5736 ;; PowerPC has a full set of single-precision floating point instructions.
5738 ;; For the POWER architecture, we pretend that we have both SFmode and
5739 ;; DFmode insns, while, in fact, all fp insns are actually done in double.
5740 ;; The only conversions we will do will be when storing to memory. In that
5741 ;; case, we will use the "frsp" instruction before storing.
5743 ;; Note that when we store into a single-precision memory location, we need to
5744 ;; use the frsp insn first. If the register being stored isn't dead, we
5745 ;; need a scratch register for the frsp. But this is difficult when the store
5746 ;; is done by reload. It is not incorrect to do the frsp on the register in
5747 ;; this case, we just lose precision that we would have otherwise gotten but
5748 ;; is not guaranteed. Perhaps this should be tightened up at some point.
5750 (define_expand "extendsfdf2"
5751 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5752 (float_extend:DF (match_operand:SF 1 "reg_or_none500mem_operand" "")))]
5753 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5756 (define_insn_and_split "*extendsfdf2_fpr"
5757 [(set (match_operand:DF 0 "gpc_reg_operand" "=d,?d,d")
5758 (float_extend:DF (match_operand:SF 1 "reg_or_mem_operand" "0,f,m")))]
5759 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5764 "&& reload_completed && REG_P (operands[1]) && REGNO (operands[0]) == REGNO (operands[1])"
5767 emit_note (NOTE_INSN_DELETED);
5770 [(set_attr "type" "fp,fp,fpload")])
5772 (define_expand "truncdfsf2"
5773 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5774 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "")))]
5775 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5778 (define_insn "*truncdfsf2_fpr"
5779 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5780 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "d")))]
5781 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5783 [(set_attr "type" "fp")])
5785 (define_insn "aux_truncdfsf2"
5786 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5787 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRSP))]
5788 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5790 [(set_attr "type" "fp")])
5792 (define_expand "negsf2"
5793 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5794 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
5795 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
5798 (define_insn "*negsf2"
5799 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5800 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5801 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5803 [(set_attr "type" "fp")])
5805 (define_expand "abssf2"
5806 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5807 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
5808 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
5811 (define_insn "*abssf2"
5812 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5813 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5814 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5816 [(set_attr "type" "fp")])
5819 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5820 (neg:SF (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f"))))]
5821 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5823 [(set_attr "type" "fp")])
5825 (define_expand "addsf3"
5826 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5827 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "")
5828 (match_operand:SF 2 "gpc_reg_operand" "")))]
5829 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
5833 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5834 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5835 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5836 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5838 [(set_attr "type" "fp")
5839 (set_attr "fp_type" "fp_addsub_s")])
5842 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5843 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5844 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5845 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5846 "{fa|fadd} %0,%1,%2"
5847 [(set_attr "type" "fp")])
5849 (define_expand "subsf3"
5850 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5851 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "")
5852 (match_operand:SF 2 "gpc_reg_operand" "")))]
5853 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
5857 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5858 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5859 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5860 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5862 [(set_attr "type" "fp")
5863 (set_attr "fp_type" "fp_addsub_s")])
5866 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5867 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5868 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5869 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5870 "{fs|fsub} %0,%1,%2"
5871 [(set_attr "type" "fp")])
5873 (define_expand "mulsf3"
5874 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5875 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "")
5876 (match_operand:SF 2 "gpc_reg_operand" "")))]
5877 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
5881 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5882 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5883 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5884 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5886 [(set_attr "type" "fp")
5887 (set_attr "fp_type" "fp_mul_s")])
5890 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5891 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5892 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5893 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5894 "{fm|fmul} %0,%1,%2"
5895 [(set_attr "type" "dmul")])
5897 (define_expand "divsf3"
5898 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5899 (div:SF (match_operand:SF 1 "gpc_reg_operand" "")
5900 (match_operand:SF 2 "gpc_reg_operand" "")))]
5901 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
5905 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5906 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5907 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5908 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS
5909 && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
5911 [(set_attr "type" "sdiv")])
5914 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5915 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5916 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5917 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS
5918 && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
5919 "{fd|fdiv} %0,%1,%2"
5920 [(set_attr "type" "ddiv")])
5923 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5924 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))]
5927 [(set_attr "type" "fp")])
5929 ; builtin fmaf support
5930 (define_insn "*fmasf4_fpr"
5931 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5932 (fma:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5933 (match_operand:SF 2 "gpc_reg_operand" "f")
5934 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5935 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5937 return (TARGET_POWERPC
5938 ? "fmadds %0,%1,%2,%3"
5939 : "{fma|fmadd} %0,%1,%2,%3");
5941 [(set_attr "type" "fp")
5942 (set_attr "fp_type" "fp_maddsub_s")])
5944 (define_insn "*fmssf4_fpr"
5945 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5946 (fma:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5947 (match_operand:SF 2 "gpc_reg_operand" "f")
5948 (neg:SF (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5949 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5951 return (TARGET_POWERPC
5952 ? "fmsubs %0,%1,%2,%3"
5953 : "{fms|fmsub} %0,%1,%2,%3");
5955 [(set_attr "type" "fp")
5956 (set_attr "fp_type" "fp_maddsub_s")])
5958 (define_insn "*nfmasf4_fpr"
5959 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5960 (neg:SF (fma:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5961 (match_operand:SF 2 "gpc_reg_operand" "f")
5962 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5963 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5965 return (TARGET_POWERPC
5966 ? "fnmadds %0,%1,%2,%3"
5967 : "{fnma|fnmadd} %0,%1,%2,%3");
5969 [(set_attr "type" "fp")
5970 (set_attr "fp_type" "fp_maddsub_s")])
5972 (define_insn "*nfmssf4_fpr"
5973 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5974 (neg:SF (fma:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5975 (match_operand:SF 2 "gpc_reg_operand" "f")
5976 (neg:SF (match_operand:SF 3 "gpc_reg_operand" "f")))))]
5977 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5979 return (TARGET_POWERPC
5980 ? "fnmsubs %0,%1,%2,%3"
5981 : "{fnms|fnmsub} %0,%1,%2,%3");
5983 [(set_attr "type" "fp")
5984 (set_attr "fp_type" "fp_maddsub_s")])
5986 (define_expand "sqrtsf2"
5987 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5988 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
5989 "(TARGET_PPC_GPOPT || TARGET_POWER2 || TARGET_XILINX_FPU)
5990 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
5991 && !TARGET_SIMPLE_FPU"
5995 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5996 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5997 "(TARGET_PPC_GPOPT || TARGET_XILINX_FPU) && TARGET_HARD_FLOAT
5998 && TARGET_FPRS && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
6000 [(set_attr "type" "ssqrt")])
6003 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6004 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
6005 "TARGET_POWER2 && TARGET_HARD_FLOAT && TARGET_FPRS
6006 && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
6008 [(set_attr "type" "dsqrt")])
6010 (define_insn "*rsqrtsf_internal1"
6011 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6012 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")]
6016 [(set_attr "type" "fp")])
6018 (define_expand "copysign<mode>3"
6020 (abs:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")))
6022 (neg:SFDF (abs:SFDF (match_dup 1))))
6023 (set (match_operand:SFDF 0 "gpc_reg_operand" "")
6024 (if_then_else:SFDF (ge (match_operand:SFDF 2 "gpc_reg_operand" "")
6028 "TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>
6029 && ((TARGET_PPC_GFXOPT
6030 && !HONOR_NANS (<MODE>mode)
6031 && !HONOR_SIGNED_ZEROS (<MODE>mode))
6033 || VECTOR_UNIT_VSX_P (<MODE>mode))"
6035 if (TARGET_CMPB || VECTOR_UNIT_VSX_P (<MODE>mode))
6037 emit_insn (gen_copysign<mode>3_fcpsgn (operands[0], operands[1],
6042 operands[3] = gen_reg_rtx (<MODE>mode);
6043 operands[4] = gen_reg_rtx (<MODE>mode);
6044 operands[5] = CONST0_RTX (<MODE>mode);
6047 ;; Use an unspec rather providing an if-then-else in RTL, to prevent the
6048 ;; compiler from optimizing -0.0
6049 (define_insn "copysign<mode>3_fcpsgn"
6050 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
6051 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")
6052 (match_operand:SFDF 2 "gpc_reg_operand" "<rreg2>")]
6054 "TARGET_CMPB && !VECTOR_UNIT_VSX_P (<MODE>mode)"
6056 [(set_attr "type" "fp")])
6058 ;; For MIN, MAX, and conditional move, we use DEFINE_EXPAND's that involve a
6059 ;; fsel instruction and some auxiliary computations. Then we just have a
6060 ;; single DEFINE_INSN for fsel and the define_splits to make them if made by
6062 (define_expand "smaxsf3"
6063 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6064 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
6065 (match_operand:SF 2 "gpc_reg_operand" ""))
6068 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
6069 && TARGET_SINGLE_FLOAT && !flag_trapping_math"
6070 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
6072 (define_expand "sminsf3"
6073 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6074 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
6075 (match_operand:SF 2 "gpc_reg_operand" ""))
6078 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
6079 && TARGET_SINGLE_FLOAT && !flag_trapping_math"
6080 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
6083 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6084 (match_operator:SF 3 "min_max_operator"
6085 [(match_operand:SF 1 "gpc_reg_operand" "")
6086 (match_operand:SF 2 "gpc_reg_operand" "")]))]
6087 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
6088 && TARGET_SINGLE_FLOAT && !flag_trapping_math"
6091 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
6092 operands[1], operands[2]);
6096 (define_expand "mov<mode>cc"
6097 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
6098 (if_then_else:GPR (match_operand 1 "comparison_operator" "")
6099 (match_operand:GPR 2 "gpc_reg_operand" "")
6100 (match_operand:GPR 3 "gpc_reg_operand" "")))]
6104 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
6110 ;; We use the BASE_REGS for the isel input operands because, if rA is
6111 ;; 0, the value of 0 is placed in rD upon truth. Similarly for rB
6112 ;; because we may switch the operands and rB may end up being rA.
6114 ;; We need 2 patterns: an unsigned and a signed pattern. We could
6115 ;; leave out the mode in operand 4 and use one pattern, but reload can
6116 ;; change the mode underneath our feet and then gets confused trying
6117 ;; to reload the value.
6118 (define_insn "isel_signed_<mode>"
6119 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
6121 (match_operator 1 "scc_comparison_operator"
6122 [(match_operand:CC 4 "cc_reg_operand" "y,y")
6124 (match_operand:GPR 2 "reg_or_cint_operand" "O,b")
6125 (match_operand:GPR 3 "gpc_reg_operand" "r,r")))]
6128 { return output_isel (operands); }"
6129 [(set_attr "type" "isel")
6130 (set_attr "length" "4")])
6132 (define_insn "isel_unsigned_<mode>"
6133 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
6135 (match_operator 1 "scc_comparison_operator"
6136 [(match_operand:CCUNS 4 "cc_reg_operand" "y,y")
6138 (match_operand:GPR 2 "reg_or_cint_operand" "O,b")
6139 (match_operand:GPR 3 "gpc_reg_operand" "r,r")))]
6142 { return output_isel (operands); }"
6143 [(set_attr "type" "isel")
6144 (set_attr "length" "4")])
6146 ;; These patterns can be useful for combine; they let combine know that
6147 ;; isel can handle reversed comparisons so long as the operands are
6150 (define_insn "*isel_reversed_signed_<mode>"
6151 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
6153 (match_operator 1 "scc_rev_comparison_operator"
6154 [(match_operand:CC 4 "cc_reg_operand" "y")
6156 (match_operand:GPR 2 "gpc_reg_operand" "b")
6157 (match_operand:GPR 3 "gpc_reg_operand" "b")))]
6160 { return output_isel (operands); }"
6161 [(set_attr "type" "isel")
6162 (set_attr "length" "4")])
6164 (define_insn "*isel_reversed_unsigned_<mode>"
6165 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
6167 (match_operator 1 "scc_rev_comparison_operator"
6168 [(match_operand:CCUNS 4 "cc_reg_operand" "y")
6170 (match_operand:GPR 2 "gpc_reg_operand" "b")
6171 (match_operand:GPR 3 "gpc_reg_operand" "b")))]
6174 { return output_isel (operands); }"
6175 [(set_attr "type" "isel")
6176 (set_attr "length" "4")])
6178 (define_expand "movsfcc"
6179 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6180 (if_then_else:SF (match_operand 1 "comparison_operator" "")
6181 (match_operand:SF 2 "gpc_reg_operand" "")
6182 (match_operand:SF 3 "gpc_reg_operand" "")))]
6183 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
6186 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
6192 (define_insn "*fselsfsf4"
6193 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6194 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
6195 (match_operand:SF 4 "zero_fp_constant" "F"))
6196 (match_operand:SF 2 "gpc_reg_operand" "f")
6197 (match_operand:SF 3 "gpc_reg_operand" "f")))]
6198 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
6200 [(set_attr "type" "fp")])
6202 (define_insn "*fseldfsf4"
6203 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6204 (if_then_else:SF (ge (match_operand:DF 1 "gpc_reg_operand" "d")
6205 (match_operand:DF 4 "zero_fp_constant" "F"))
6206 (match_operand:SF 2 "gpc_reg_operand" "f")
6207 (match_operand:SF 3 "gpc_reg_operand" "f")))]
6208 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_SINGLE_FLOAT"
6210 [(set_attr "type" "fp")])
6212 (define_expand "negdf2"
6213 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6214 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
6215 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6218 (define_insn "*negdf2_fpr"
6219 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6220 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "d")))]
6221 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6222 && !VECTOR_UNIT_VSX_P (DFmode)"
6224 [(set_attr "type" "fp")])
6226 (define_expand "absdf2"
6227 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6228 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
6229 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6232 (define_insn "*absdf2_fpr"
6233 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6234 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "d")))]
6235 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6236 && !VECTOR_UNIT_VSX_P (DFmode)"
6238 [(set_attr "type" "fp")])
6240 (define_insn "*nabsdf2_fpr"
6241 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6242 (neg:DF (abs:DF (match_operand:DF 1 "gpc_reg_operand" "d"))))]
6243 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6244 && !VECTOR_UNIT_VSX_P (DFmode)"
6246 [(set_attr "type" "fp")])
6248 (define_expand "adddf3"
6249 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6250 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "")
6251 (match_operand:DF 2 "gpc_reg_operand" "")))]
6252 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6255 (define_insn "*adddf3_fpr"
6256 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6257 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
6258 (match_operand:DF 2 "gpc_reg_operand" "d")))]
6259 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6260 && !VECTOR_UNIT_VSX_P (DFmode)"
6261 "{fa|fadd} %0,%1,%2"
6262 [(set_attr "type" "fp")
6263 (set_attr "fp_type" "fp_addsub_d")])
6265 (define_expand "subdf3"
6266 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6267 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "")
6268 (match_operand:DF 2 "gpc_reg_operand" "")))]
6269 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6272 (define_insn "*subdf3_fpr"
6273 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6274 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "d")
6275 (match_operand:DF 2 "gpc_reg_operand" "d")))]
6276 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6277 && !VECTOR_UNIT_VSX_P (DFmode)"
6278 "{fs|fsub} %0,%1,%2"
6279 [(set_attr "type" "fp")
6280 (set_attr "fp_type" "fp_addsub_d")])
6282 (define_expand "muldf3"
6283 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6284 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "")
6285 (match_operand:DF 2 "gpc_reg_operand" "")))]
6286 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6289 (define_insn "*muldf3_fpr"
6290 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6291 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
6292 (match_operand:DF 2 "gpc_reg_operand" "d")))]
6293 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6294 && !VECTOR_UNIT_VSX_P (DFmode)"
6295 "{fm|fmul} %0,%1,%2"
6296 [(set_attr "type" "dmul")
6297 (set_attr "fp_type" "fp_mul_d")])
6299 (define_expand "divdf3"
6300 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6301 (div:DF (match_operand:DF 1 "gpc_reg_operand" "")
6302 (match_operand:DF 2 "gpc_reg_operand" "")))]
6304 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)
6305 && !TARGET_SIMPLE_FPU"
6308 (define_insn "*divdf3_fpr"
6309 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6310 (div:DF (match_operand:DF 1 "gpc_reg_operand" "d")
6311 (match_operand:DF 2 "gpc_reg_operand" "d")))]
6312 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && !TARGET_SIMPLE_FPU
6313 && !VECTOR_UNIT_VSX_P (DFmode)"
6314 "{fd|fdiv} %0,%1,%2"
6315 [(set_attr "type" "ddiv")])
6317 (define_insn "*fred_fpr"
6318 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6319 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))]
6320 "TARGET_FRE && !VECTOR_UNIT_VSX_P (DFmode)"
6322 [(set_attr "type" "fp")])
6324 (define_insn "*rsqrtdf_internal1"
6325 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6326 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "d")]
6328 "TARGET_FRSQRTE && !VECTOR_UNIT_VSX_P (DFmode)"
6330 [(set_attr "type" "fp")])
6332 ; builtin fma support
6333 (define_insn "*fmadf4_fpr"
6334 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6335 (fma:DF (match_operand:DF 1 "gpc_reg_operand" "f")
6336 (match_operand:DF 2 "gpc_reg_operand" "f")
6337 (match_operand:DF 3 "gpc_reg_operand" "f")))]
6338 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6339 && VECTOR_UNIT_NONE_P (DFmode)"
6340 "{fma|fmadd} %0,%1,%2,%3"
6341 [(set_attr "type" "fp")
6342 (set_attr "fp_type" "fp_maddsub_d")])
6344 (define_insn "*fmsdf4_fpr"
6345 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6346 (fma:DF (match_operand:DF 1 "gpc_reg_operand" "f")
6347 (match_operand:DF 2 "gpc_reg_operand" "f")
6348 (neg:DF (match_operand:DF 3 "gpc_reg_operand" "f"))))]
6349 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6350 && VECTOR_UNIT_NONE_P (DFmode)"
6351 "{fms|fmsub} %0,%1,%2,%3"
6352 [(set_attr "type" "fp")
6353 (set_attr "fp_type" "fp_maddsub_d")])
6355 (define_insn "*nfmadf4_fpr"
6356 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6357 (neg:DF (fma:DF (match_operand:DF 1 "gpc_reg_operand" "f")
6358 (match_operand:DF 2 "gpc_reg_operand" "f")
6359 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
6360 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6361 && VECTOR_UNIT_NONE_P (DFmode)"
6362 "{fnma|fnmadd} %0,%1,%2,%3"
6363 [(set_attr "type" "fp")
6364 (set_attr "fp_type" "fp_maddsub_d")])
6366 (define_insn "*nfmsdf4_fpr"
6367 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6368 (neg:DF (fma:DF (match_operand:DF 1 "gpc_reg_operand" "f")
6369 (match_operand:DF 2 "gpc_reg_operand" "f")
6370 (neg:DF (match_operand:DF 3 "gpc_reg_operand" "f")))))]
6371 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6372 && VECTOR_UNIT_NONE_P (DFmode)"
6373 "{fnms|fnmsub} %0,%1,%2,%3"
6374 [(set_attr "type" "fp")
6375 (set_attr "fp_type" "fp_maddsub_d")])
6377 (define_expand "sqrtdf2"
6378 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6379 (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
6380 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS
6381 && TARGET_DOUBLE_FLOAT"
6384 (define_insn "*sqrtdf2_fpr"
6385 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6386 (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "d")))]
6387 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS
6388 && TARGET_DOUBLE_FLOAT
6389 && !VECTOR_UNIT_VSX_P (DFmode)"
6391 [(set_attr "type" "dsqrt")])
6393 ;; The conditional move instructions allow us to perform max and min
6394 ;; operations even when
6396 (define_expand "smaxdf3"
6397 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6398 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
6399 (match_operand:DF 2 "gpc_reg_operand" ""))
6402 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6403 && !flag_trapping_math"
6404 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
6406 (define_expand "smindf3"
6407 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6408 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
6409 (match_operand:DF 2 "gpc_reg_operand" ""))
6412 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6413 && !flag_trapping_math"
6414 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
6417 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6418 (match_operator:DF 3 "min_max_operator"
6419 [(match_operand:DF 1 "gpc_reg_operand" "")
6420 (match_operand:DF 2 "gpc_reg_operand" "")]))]
6421 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6422 && !flag_trapping_math"
6425 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
6426 operands[1], operands[2]);
6430 (define_expand "movdfcc"
6431 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6432 (if_then_else:DF (match_operand 1 "comparison_operator" "")
6433 (match_operand:DF 2 "gpc_reg_operand" "")
6434 (match_operand:DF 3 "gpc_reg_operand" "")))]
6435 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6438 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
6444 (define_insn "*fseldfdf4"
6445 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6446 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "d")
6447 (match_operand:DF 4 "zero_fp_constant" "F"))
6448 (match_operand:DF 2 "gpc_reg_operand" "d")
6449 (match_operand:DF 3 "gpc_reg_operand" "d")))]
6450 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6452 [(set_attr "type" "fp")])
6454 (define_insn "*fselsfdf4"
6455 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6456 (if_then_else:DF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
6457 (match_operand:SF 4 "zero_fp_constant" "F"))
6458 (match_operand:DF 2 "gpc_reg_operand" "d")
6459 (match_operand:DF 3 "gpc_reg_operand" "d")))]
6460 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_SINGLE_FLOAT"
6462 [(set_attr "type" "fp")])
6464 ;; Conversions to and from floating-point.
6466 ; We don't define lfiwax/lfiwzx with the normal definition, because we
6467 ; don't want to support putting SImode in FPR registers.
6468 (define_insn "lfiwax"
6469 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6470 (unspec:DI [(match_operand:SI 1 "indexed_or_indirect_operand" "Z")]
6472 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWAX"
6474 [(set_attr "type" "fpload")])
6476 ; This split must be run before register allocation because it allocates the
6477 ; memory slot that is needed to move values to/from the FPR. We don't allocate
6478 ; it earlier to allow for the combiner to merge insns together where it might
6479 ; not be needed and also in case the insns are deleted as dead code.
6481 (define_insn_and_split "floatsi<mode>2_lfiwax"
6482 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d")
6483 (float:SFDF (match_operand:SI 1 "nonimmediate_operand" "r")))
6484 (clobber (match_scratch:DI 2 "=d"))]
6485 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWAX
6486 && <SI_CONVERT_FP> && can_create_pseudo_p ()"
6492 rtx dest = operands[0];
6493 rtx src = operands[1];
6496 if (!MEM_P (src) && TARGET_MFPGPR && TARGET_POWERPC64)
6497 tmp = convert_to_mode (DImode, src, false);
6501 if (GET_CODE (tmp) == SCRATCH)
6502 tmp = gen_reg_rtx (DImode);
6505 src = rs6000_address_for_fpconvert (src);
6506 emit_insn (gen_lfiwax (tmp, src));
6510 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
6511 emit_move_insn (stack, src);
6512 emit_insn (gen_lfiwax (tmp, stack));
6515 emit_insn (gen_floatdi<mode>2 (dest, tmp));
6518 [(set_attr "length" "12")
6519 (set_attr "type" "fpload")])
6521 (define_insn_and_split "floatsi<mode>2_lfiwax_mem"
6522 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d,<rreg2>")
6525 (match_operand:SI 1 "memory_operand" "Z,Z"))))
6526 (clobber (match_scratch:DI 2 "=0,d"))]
6527 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWAX
6534 operands[1] = rs6000_address_for_fpconvert (operands[1]);
6535 if (GET_CODE (operands[2]) == SCRATCH)
6536 operands[2] = gen_reg_rtx (DImode);
6537 emit_insn (gen_lfiwax (operands[2], operands[1]));
6538 emit_insn (gen_floatdi<mode>2 (operands[0], operands[2]));
6541 [(set_attr "length" "8")
6542 (set_attr "type" "fpload")])
6544 (define_insn "lfiwzx"
6545 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6546 (unspec:DI [(match_operand:SI 1 "indexed_or_indirect_operand" "Z")]
6548 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWZX"
6550 [(set_attr "type" "fpload")])
6552 (define_insn_and_split "floatunssi<mode>2_lfiwzx"
6553 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d")
6554 (unsigned_float:SFDF (match_operand:SI 1 "nonimmediate_operand" "r")))
6555 (clobber (match_scratch:DI 2 "=d"))]
6556 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWZX
6563 rtx dest = operands[0];
6564 rtx src = operands[1];
6567 if (!MEM_P (src) && TARGET_MFPGPR && TARGET_POWERPC64)
6568 tmp = convert_to_mode (DImode, src, true);
6572 if (GET_CODE (tmp) == SCRATCH)
6573 tmp = gen_reg_rtx (DImode);
6576 src = rs6000_address_for_fpconvert (src);
6577 emit_insn (gen_lfiwzx (tmp, src));
6581 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
6582 emit_move_insn (stack, src);
6583 emit_insn (gen_lfiwzx (tmp, stack));
6586 emit_insn (gen_floatdi<mode>2 (dest, tmp));
6589 [(set_attr "length" "12")
6590 (set_attr "type" "fpload")])
6592 (define_insn_and_split "floatunssi<mode>2_lfiwzx_mem"
6593 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d,<rreg2>")
6594 (unsigned_float:SFDF
6596 (match_operand:SI 1 "memory_operand" "Z,Z"))))
6597 (clobber (match_scratch:DI 2 "=0,d"))]
6598 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWZX
6605 operands[1] = rs6000_address_for_fpconvert (operands[1]);
6606 if (GET_CODE (operands[2]) == SCRATCH)
6607 operands[2] = gen_reg_rtx (DImode);
6608 emit_insn (gen_lfiwzx (operands[2], operands[1]));
6609 emit_insn (gen_floatdi<mode>2 (operands[0], operands[2]));
6612 [(set_attr "length" "8")
6613 (set_attr "type" "fpload")])
6615 ; For each of these conversions, there is a define_expand, a define_insn
6616 ; with a '#' template, and a define_split (with C code). The idea is
6617 ; to allow constant folding with the template of the define_insn,
6618 ; then to have the insns split later (between sched1 and final).
6620 (define_expand "floatsidf2"
6621 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
6622 (float:DF (match_operand:SI 1 "nonimmediate_operand" "")))
6625 (clobber (match_dup 4))
6626 (clobber (match_dup 5))
6627 (clobber (match_dup 6))])]
6629 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6632 if (TARGET_E500_DOUBLE)
6634 if (!REG_P (operands[1]))
6635 operands[1] = force_reg (SImode, operands[1]);
6636 emit_insn (gen_spe_floatsidf2 (operands[0], operands[1]));
6639 else if (TARGET_LFIWAX && TARGET_FCFID)
6641 emit_insn (gen_floatsidf2_lfiwax (operands[0], operands[1]));
6644 else if (TARGET_FCFID)
6646 rtx dreg = operands[1];
6648 dreg = force_reg (SImode, dreg);
6649 dreg = convert_to_mode (DImode, dreg, false);
6650 emit_insn (gen_floatdidf2 (operands[0], dreg));
6654 if (!REG_P (operands[1]))
6655 operands[1] = force_reg (SImode, operands[1]);
6656 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
6657 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503601774854144\", DFmode));
6658 operands[4] = rs6000_allocate_stack_temp (DFmode, true, false);
6659 operands[5] = gen_reg_rtx (DFmode);
6660 operands[6] = gen_reg_rtx (SImode);
6663 (define_insn_and_split "*floatsidf2_internal"
6664 [(set (match_operand:DF 0 "gpc_reg_operand" "=&d")
6665 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
6666 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
6667 (use (match_operand:DF 3 "gpc_reg_operand" "d"))
6668 (clobber (match_operand:DF 4 "offsettable_mem_operand" "=o"))
6669 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&d"))
6670 (clobber (match_operand:SI 6 "gpc_reg_operand" "=&r"))]
6671 "! TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6677 rtx lowword, highword;
6678 gcc_assert (MEM_P (operands[4]));
6679 highword = adjust_address (operands[4], SImode, 0);
6680 lowword = adjust_address (operands[4], SImode, 4);
6681 if (! WORDS_BIG_ENDIAN)
6684 tmp = highword; highword = lowword; lowword = tmp;
6687 emit_insn (gen_xorsi3 (operands[6], operands[1],
6688 GEN_INT (~ (HOST_WIDE_INT) 0x7fffffff)));
6689 emit_move_insn (lowword, operands[6]);
6690 emit_move_insn (highword, operands[2]);
6691 emit_move_insn (operands[5], operands[4]);
6692 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
6695 [(set_attr "length" "24")
6696 (set_attr "type" "fp")])
6698 ;; If we don't have a direct conversion to single precision, don't enable this
6699 ;; conversion for 32-bit without fast math, because we don't have the insn to
6700 ;; generate the fixup swizzle to avoid double rounding problems.
6701 (define_expand "floatunssisf2"
6702 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6703 (unsigned_float:SF (match_operand:SI 1 "nonimmediate_operand" "")))]
6704 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT
6707 && ((TARGET_FCFIDUS && TARGET_LFIWZX)
6708 || (TARGET_DOUBLE_FLOAT && TARGET_FCFID
6709 && (TARGET_POWERPC64 || flag_unsafe_math_optimizations)))))"
6714 if (!REG_P (operands[1]))
6715 operands[1] = force_reg (SImode, operands[1]);
6717 else if (TARGET_LFIWZX && TARGET_FCFIDUS)
6719 emit_insn (gen_floatunssisf2_lfiwzx (operands[0], operands[1]));
6724 rtx dreg = operands[1];
6726 dreg = force_reg (SImode, dreg);
6727 dreg = convert_to_mode (DImode, dreg, true);
6728 emit_insn (gen_floatdisf2 (operands[0], dreg));
6733 (define_expand "floatunssidf2"
6734 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
6735 (unsigned_float:DF (match_operand:SI 1 "nonimmediate_operand" "")))
6738 (clobber (match_dup 4))
6739 (clobber (match_dup 5))])]
6741 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6744 if (TARGET_E500_DOUBLE)
6746 if (!REG_P (operands[1]))
6747 operands[1] = force_reg (SImode, operands[1]);
6748 emit_insn (gen_spe_floatunssidf2 (operands[0], operands[1]));
6751 else if (TARGET_LFIWZX && TARGET_FCFID)
6753 emit_insn (gen_floatunssidf2_lfiwzx (operands[0], operands[1]));
6756 else if (TARGET_FCFID)
6758 rtx dreg = operands[1];
6760 dreg = force_reg (SImode, dreg);
6761 dreg = convert_to_mode (DImode, dreg, true);
6762 emit_insn (gen_floatdidf2 (operands[0], dreg));
6766 if (!REG_P (operands[1]))
6767 operands[1] = force_reg (SImode, operands[1]);
6768 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
6769 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503599627370496\", DFmode));
6770 operands[4] = rs6000_allocate_stack_temp (DFmode, true, false);
6771 operands[5] = gen_reg_rtx (DFmode);
6774 (define_insn_and_split "*floatunssidf2_internal"
6775 [(set (match_operand:DF 0 "gpc_reg_operand" "=&d")
6776 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
6777 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
6778 (use (match_operand:DF 3 "gpc_reg_operand" "d"))
6779 (clobber (match_operand:DF 4 "offsettable_mem_operand" "=o"))
6780 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&d"))]
6781 "! TARGET_FCFIDU && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6782 && !(TARGET_FCFID && TARGET_POWERPC64)"
6788 rtx lowword, highword;
6789 gcc_assert (MEM_P (operands[4]));
6790 highword = adjust_address (operands[4], SImode, 0);
6791 lowword = adjust_address (operands[4], SImode, 4);
6792 if (! WORDS_BIG_ENDIAN)
6795 tmp = highword; highword = lowword; lowword = tmp;
6798 emit_move_insn (lowword, operands[1]);
6799 emit_move_insn (highword, operands[2]);
6800 emit_move_insn (operands[5], operands[4]);
6801 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
6804 [(set_attr "length" "20")
6805 (set_attr "type" "fp")])
6807 (define_expand "fix_trunc<mode>si2"
6808 [(set (match_operand:SI 0 "gpc_reg_operand" "")
6809 (fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "")))]
6810 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT
6811 && ((TARGET_FPRS && <TARGET_FLOAT>) || <E500_CONVERT>)"
6814 if (!<E500_CONVERT>)
6819 emit_insn (gen_fix_trunc<mode>si2_stfiwx (operands[0], operands[1]));
6822 tmp = gen_reg_rtx (DImode);
6823 stack = rs6000_allocate_stack_temp (DImode, true, false);
6824 emit_insn (gen_fix_trunc<mode>si2_internal (operands[0], operands[1],
6831 ; Like the convert to float patterns, this insn must be split before
6832 ; register allocation so that it can allocate the memory slot if it
6834 (define_insn_and_split "fix_trunc<mode>si2_stfiwx"
6835 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
6836 (fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d")))
6837 (clobber (match_scratch:DI 2 "=d"))]
6838 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6839 && (<MODE>mode != SFmode || TARGET_SINGLE_FLOAT)
6840 && TARGET_STFIWX && can_create_pseudo_p ()"
6845 rtx dest = operands[0];
6846 rtx src = operands[1];
6847 rtx tmp = operands[2];
6849 if (GET_CODE (tmp) == SCRATCH)
6850 tmp = gen_reg_rtx (DImode);
6852 emit_insn (gen_fctiwz_<mode> (tmp, src));
6855 dest = rs6000_address_for_fpconvert (dest);
6856 emit_insn (gen_stfiwx (dest, tmp));
6859 else if (TARGET_MFPGPR && TARGET_POWERPC64)
6861 dest = gen_lowpart (DImode, dest);
6862 emit_move_insn (dest, tmp);
6867 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
6868 emit_insn (gen_stfiwx (stack, tmp));
6869 emit_move_insn (dest, stack);
6873 [(set_attr "length" "12")
6874 (set_attr "type" "fp")])
6876 (define_insn_and_split "fix_trunc<mode>si2_internal"
6877 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,?r")
6878 (fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d,<rreg>")))
6879 (clobber (match_operand:DI 2 "gpc_reg_operand" "=1,d"))
6880 (clobber (match_operand:DI 3 "offsettable_mem_operand" "=o,o"))]
6881 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS
6882 && TARGET_DOUBLE_FLOAT"
6889 gcc_assert (MEM_P (operands[3]));
6890 lowword = adjust_address (operands[3], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
6892 emit_insn (gen_fctiwz_<mode> (operands[2], operands[1]));
6893 emit_move_insn (operands[3], operands[2]);
6894 emit_move_insn (operands[0], lowword);
6897 [(set_attr "length" "16")
6898 (set_attr "type" "fp")])
6900 (define_expand "fix_trunc<mode>di2"
6901 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6902 (fix:DI (match_operand:SFDF 1 "gpc_reg_operand" "")))]
6903 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
6907 (define_insn "*fix_trunc<mode>di2_fctidz"
6908 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6909 (fix:DI (match_operand:SFDF 1 "gpc_reg_operand" "d")))]
6910 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
6911 && TARGET_FCFID && !VECTOR_UNIT_VSX_P (<MODE>mode)"
6913 [(set_attr "type" "fp")])
6915 (define_expand "fixuns_trunc<mode>si2"
6916 [(set (match_operand:SI 0 "gpc_reg_operand" "")
6917 (unsigned_fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "")))]
6919 && ((TARGET_FPRS && <TARGET_FLOAT> && TARGET_FCTIWUZ && TARGET_STFIWX)
6923 if (!<E500_CONVERT>)
6925 emit_insn (gen_fixuns_trunc<mode>si2_stfiwx (operands[0], operands[1]));
6930 (define_insn_and_split "fixuns_trunc<mode>si2_stfiwx"
6931 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
6932 (unsigned_fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d")))
6933 (clobber (match_scratch:DI 2 "=d"))]
6934 "TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT> && TARGET_FCTIWUZ
6935 && TARGET_STFIWX && can_create_pseudo_p ()"
6940 rtx dest = operands[0];
6941 rtx src = operands[1];
6942 rtx tmp = operands[2];
6944 if (GET_CODE (tmp) == SCRATCH)
6945 tmp = gen_reg_rtx (DImode);
6947 emit_insn (gen_fctiwuz_<mode> (tmp, src));
6950 dest = rs6000_address_for_fpconvert (dest);
6951 emit_insn (gen_stfiwx (dest, tmp));
6954 else if (TARGET_MFPGPR && TARGET_POWERPC64)
6956 dest = gen_lowpart (DImode, dest);
6957 emit_move_insn (dest, tmp);
6962 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
6963 emit_insn (gen_stfiwx (stack, tmp));
6964 emit_move_insn (dest, stack);
6968 [(set_attr "length" "12")
6969 (set_attr "type" "fp")])
6971 (define_expand "fixuns_trunc<mode>di2"
6972 [(set (match_operand:DI 0 "register_operand" "")
6973 (unsigned_fix:DI (match_operand:SFDF 1 "register_operand" "")))]
6974 "TARGET_HARD_FLOAT && (TARGET_FCTIDUZ || VECTOR_UNIT_VSX_P (<MODE>mode))"
6977 (define_insn "*fixuns_trunc<mode>di2_fctiduz"
6978 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6979 (unsigned_fix:DI (match_operand:SFDF 1 "gpc_reg_operand" "d")))]
6980 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
6981 && TARGET_FCTIDUZ && !VECTOR_UNIT_VSX_P (<MODE>mode)"
6983 [(set_attr "type" "fp")])
6985 ; Here, we use (set (reg) (unspec:DI [(fix:SI ...)] UNSPEC_FCTIWZ))
6986 ; rather than (set (subreg:SI (reg)) (fix:SI ...))
6987 ; because the first makes it clear that operand 0 is not live
6988 ; before the instruction.
6989 (define_insn "fctiwz_<mode>"
6990 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6991 (unspec:DI [(fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d"))]
6993 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS
6994 && TARGET_DOUBLE_FLOAT"
6995 "{fcirz|fctiwz} %0,%1"
6996 [(set_attr "type" "fp")])
6998 (define_insn "fctiwuz_<mode>"
6999 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
7000 (unspec:DI [(unsigned_fix:SI
7001 (match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>"))]
7003 "TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT> && TARGET_FCTIWUZ"
7005 [(set_attr "type" "fp")])
7007 ;; Only optimize (float (fix x)) -> frz if we are in fast-math mode, since
7008 ;; since the friz instruction does not truncate the value if the floating
7009 ;; point value is < LONG_MIN or > LONG_MAX.
7010 (define_insn "*friz"
7011 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
7012 (float:DF (fix:DI (match_operand:DF 1 "gpc_reg_operand" "d"))))]
7013 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_FPRND
7014 && !VECTOR_UNIT_VSX_P (DFmode) && flag_unsafe_math_optimizations
7015 && !flag_trapping_math && TARGET_FRIZ"
7017 [(set_attr "type" "fp")])
7019 ;; Since FCTIWZ doesn't sign extend the upper bits, we have to do a store and a
7020 ;; load to properly sign extend the value, but at least doing a store, load
7021 ;; into a GPR to sign extend, a store from the GPR and a load back into the FPR
7022 ;; if we have 32-bit memory ops
7023 (define_insn_and_split "*round32<mode>2_fprs"
7024 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d")
7026 (fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d"))))
7027 (clobber (match_scratch:DI 2 "=d"))
7028 (clobber (match_scratch:DI 3 "=d"))]
7029 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
7030 && <SI_CONVERT_FP> && TARGET_LFIWAX && TARGET_STFIWX && TARGET_FCFID
7031 && can_create_pseudo_p ()"
7036 rtx dest = operands[0];
7037 rtx src = operands[1];
7038 rtx tmp1 = operands[2];
7039 rtx tmp2 = operands[3];
7040 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
7042 if (GET_CODE (tmp1) == SCRATCH)
7043 tmp1 = gen_reg_rtx (DImode);
7044 if (GET_CODE (tmp2) == SCRATCH)
7045 tmp2 = gen_reg_rtx (DImode);
7047 emit_insn (gen_fctiwz_<mode> (tmp1, src));
7048 emit_insn (gen_stfiwx (stack, tmp1));
7049 emit_insn (gen_lfiwax (tmp2, stack));
7050 emit_insn (gen_floatdi<mode>2 (dest, tmp2));
7053 [(set_attr "type" "fpload")
7054 (set_attr "length" "16")])
7056 (define_insn_and_split "*roundu32<mode>2_fprs"
7057 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d")
7058 (unsigned_float:SFDF
7059 (unsigned_fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d"))))
7060 (clobber (match_scratch:DI 2 "=d"))
7061 (clobber (match_scratch:DI 3 "=d"))]
7062 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
7063 && TARGET_LFIWZX && TARGET_STFIWX && TARGET_FCFIDU
7064 && can_create_pseudo_p ()"
7069 rtx dest = operands[0];
7070 rtx src = operands[1];
7071 rtx tmp1 = operands[2];
7072 rtx tmp2 = operands[3];
7073 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
7075 if (GET_CODE (tmp1) == SCRATCH)
7076 tmp1 = gen_reg_rtx (DImode);
7077 if (GET_CODE (tmp2) == SCRATCH)
7078 tmp2 = gen_reg_rtx (DImode);
7080 emit_insn (gen_fctiwuz_<mode> (tmp1, src));
7081 emit_insn (gen_stfiwx (stack, tmp1));
7082 emit_insn (gen_lfiwzx (tmp2, stack));
7083 emit_insn (gen_floatdi<mode>2 (dest, tmp2));
7086 [(set_attr "type" "fpload")
7087 (set_attr "length" "16")])
7089 ;; No VSX equivalent to fctid
7090 (define_insn "lrint<mode>di2"
7091 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
7092 (unspec:DI [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
7094 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
7096 [(set_attr "type" "fp")])
7098 (define_expand "btrunc<mode>2"
7099 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
7100 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "")]
7102 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
7105 (define_insn "*btrunc<mode>2_fpr"
7106 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
7107 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
7109 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>
7110 && !VECTOR_UNIT_VSX_P (<MODE>mode)"
7112 [(set_attr "type" "fp")])
7114 (define_expand "ceil<mode>2"
7115 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
7116 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "")]
7118 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
7121 (define_insn "*ceil<mode>2_fpr"
7122 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
7123 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
7125 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>
7126 && !VECTOR_UNIT_VSX_P (<MODE>mode)"
7128 [(set_attr "type" "fp")])
7130 (define_expand "floor<mode>2"
7131 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
7132 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "")]
7134 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
7137 (define_insn "*floor<mode>2_fpr"
7138 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
7139 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
7141 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>
7142 && !VECTOR_UNIT_VSX_P (<MODE>mode)"
7144 [(set_attr "type" "fp")])
7146 ;; No VSX equivalent to frin
7147 (define_insn "round<mode>2"
7148 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
7149 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
7151 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
7153 [(set_attr "type" "fp")])
7155 ; An UNSPEC is used so we don't have to support SImode in FP registers.
7156 (define_insn "stfiwx"
7157 [(set (match_operand:SI 0 "memory_operand" "=Z")
7158 (unspec:SI [(match_operand:DI 1 "gpc_reg_operand" "d")]
7162 [(set_attr "type" "fpstore")])
7164 ;; If we don't have a direct conversion to single precision, don't enable this
7165 ;; conversion for 32-bit without fast math, because we don't have the insn to
7166 ;; generate the fixup swizzle to avoid double rounding problems.
7167 (define_expand "floatsisf2"
7168 [(set (match_operand:SF 0 "gpc_reg_operand" "")
7169 (float:SF (match_operand:SI 1 "nonimmediate_operand" "")))]
7170 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT
7173 && ((TARGET_FCFIDS && TARGET_LFIWAX)
7174 || (TARGET_DOUBLE_FLOAT && TARGET_FCFID
7175 && (TARGET_POWERPC64 || flag_unsafe_math_optimizations)))))"
7180 if (!REG_P (operands[1]))
7181 operands[1] = force_reg (SImode, operands[1]);
7183 else if (TARGET_FCFIDS && TARGET_LFIWAX)
7185 emit_insn (gen_floatsisf2_lfiwax (operands[0], operands[1]));
7188 else if (TARGET_FCFID && TARGET_LFIWAX)
7190 rtx dfreg = gen_reg_rtx (DFmode);
7191 emit_insn (gen_floatsidf2_lfiwax (dfreg, operands[1]));
7192 emit_insn (gen_truncdfsf2 (operands[0], dfreg));
7197 rtx dreg = operands[1];
7199 dreg = force_reg (SImode, dreg);
7200 dreg = convert_to_mode (DImode, dreg, false);
7201 emit_insn (gen_floatdisf2 (operands[0], dreg));
7206 (define_expand "floatdidf2"
7207 [(set (match_operand:DF 0 "gpc_reg_operand" "")
7208 (float:DF (match_operand:DI 1 "gpc_reg_operand" "")))]
7209 "TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS"
7212 (define_insn "*floatdidf2_fpr"
7213 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
7214 (float:DF (match_operand:DI 1 "gpc_reg_operand" "d")))]
7215 "TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
7216 && !VECTOR_UNIT_VSX_P (DFmode)"
7218 [(set_attr "type" "fp")])
7220 ; Allow the combiner to merge source memory operands to the conversion so that
7221 ; the optimizer/register allocator doesn't try to load the value too early in a
7222 ; GPR and then use store/load to move it to a FPR and suffer from a store-load
7223 ; hit. We will split after reload to avoid the trip through the GPRs
7225 (define_insn_and_split "*floatdidf2_mem"
7226 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
7227 (float:DF (match_operand:DI 1 "memory_operand" "m")))
7228 (clobber (match_scratch:DI 2 "=d"))]
7229 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS && TARGET_FCFID"
7231 "&& reload_completed"
7232 [(set (match_dup 2) (match_dup 1))
7233 (set (match_dup 0) (float:DF (match_dup 2)))]
7235 [(set_attr "length" "8")
7236 (set_attr "type" "fpload")])
7238 (define_expand "floatunsdidf2"
7239 [(set (match_operand:DF 0 "gpc_reg_operand" "")
7241 (match_operand:DI 1 "gpc_reg_operand" "")))]
7242 "TARGET_HARD_FLOAT && (TARGET_FCFIDU || VECTOR_UNIT_VSX_P (DFmode))"
7245 (define_insn "*floatunsdidf2_fcfidu"
7246 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
7247 (unsigned_float:DF (match_operand:DI 1 "gpc_reg_operand" "d")))]
7248 "TARGET_HARD_FLOAT && TARGET_FCFIDU && !VECTOR_UNIT_VSX_P (DFmode)"
7250 [(set_attr "type" "fp")
7251 (set_attr "length" "4")])
7253 (define_insn_and_split "*floatunsdidf2_mem"
7254 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
7255 (unsigned_float:DF (match_operand:DI 1 "memory_operand" "m")))
7256 (clobber (match_scratch:DI 2 "=d"))]
7257 "TARGET_HARD_FLOAT && (TARGET_FCFIDU || VECTOR_UNIT_VSX_P (DFmode))"
7259 "&& reload_completed"
7260 [(set (match_dup 2) (match_dup 1))
7261 (set (match_dup 0) (unsigned_float:DF (match_dup 2)))]
7263 [(set_attr "length" "8")
7264 (set_attr "type" "fpload")])
7266 (define_expand "floatdisf2"
7267 [(set (match_operand:SF 0 "gpc_reg_operand" "")
7268 (float:SF (match_operand:DI 1 "gpc_reg_operand" "")))]
7269 "TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
7270 && (TARGET_FCFIDS || TARGET_POWERPC64 || flag_unsafe_math_optimizations)"
7275 rtx val = operands[1];
7276 if (!flag_unsafe_math_optimizations)
7278 rtx label = gen_label_rtx ();
7279 val = gen_reg_rtx (DImode);
7280 emit_insn (gen_floatdisf2_internal2 (val, operands[1], label));
7283 emit_insn (gen_floatdisf2_internal1 (operands[0], val));
7288 (define_insn "floatdisf2_fcfids"
7289 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
7290 (float:SF (match_operand:DI 1 "gpc_reg_operand" "d")))]
7291 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
7292 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDS"
7294 [(set_attr "type" "fp")])
7296 (define_insn_and_split "*floatdisf2_mem"
7297 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
7298 (float:SF (match_operand:DI 1 "memory_operand" "m")))
7299 (clobber (match_scratch:DI 2 "=f"))]
7300 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
7301 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDS"
7303 "&& reload_completed"
7307 emit_move_insn (operands[2], operands[1]);
7308 emit_insn (gen_floatdisf2_fcfids (operands[0], operands[2]));
7311 [(set_attr "length" "8")])
7313 ;; This is not IEEE compliant if rounding mode is "round to nearest".
7314 ;; If the DI->DF conversion is inexact, then it's possible to suffer
7315 ;; from double rounding.
7316 ;; Instead of creating a new cpu type for two FP operations, just use fp
7317 (define_insn_and_split "floatdisf2_internal1"
7318 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
7319 (float:SF (match_operand:DI 1 "gpc_reg_operand" "d")))
7320 (clobber (match_scratch:DF 2 "=d"))]
7321 "TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
7323 "&& reload_completed"
7325 (float:DF (match_dup 1)))
7327 (float_truncate:SF (match_dup 2)))]
7329 [(set_attr "length" "8")
7330 (set_attr "type" "fp")])
7332 ;; Twiddles bits to avoid double rounding.
7333 ;; Bits that might be truncated when converting to DFmode are replaced
7334 ;; by a bit that won't be lost at that stage, but is below the SFmode
7335 ;; rounding position.
7336 (define_expand "floatdisf2_internal2"
7337 [(set (match_dup 3) (ashiftrt:DI (match_operand:DI 1 "" "")
7339 (parallel [(set (match_operand:DI 0 "" "") (and:DI (match_dup 1)
7341 (clobber (scratch:CC))])
7342 (set (match_dup 3) (plus:DI (match_dup 3)
7344 (set (match_dup 0) (plus:DI (match_dup 0)
7346 (set (match_dup 4) (compare:CCUNS (match_dup 3)
7348 (set (match_dup 0) (ior:DI (match_dup 0)
7350 (parallel [(set (match_dup 0) (and:DI (match_dup 0)
7352 (clobber (scratch:CC))])
7353 (set (pc) (if_then_else (geu (match_dup 4) (const_int 0))
7354 (label_ref (match_operand:DI 2 "" ""))
7356 (set (match_dup 0) (match_dup 1))]
7357 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
7360 operands[3] = gen_reg_rtx (DImode);
7361 operands[4] = gen_reg_rtx (CCUNSmode);
7364 (define_expand "floatunsdisf2"
7365 [(set (match_operand:SF 0 "gpc_reg_operand" "")
7366 (unsigned_float:SF (match_operand:DI 1 "gpc_reg_operand" "")))]
7367 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
7368 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDUS"
7371 (define_insn "floatunsdisf2_fcfidus"
7372 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
7373 (unsigned_float:SF (match_operand:DI 1 "gpc_reg_operand" "d")))]
7374 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
7375 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDUS"
7377 [(set_attr "type" "fp")])
7379 (define_insn_and_split "*floatunsdisf2_mem"
7380 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
7381 (unsigned_float:SF (match_operand:DI 1 "memory_operand" "m")))
7382 (clobber (match_scratch:DI 2 "=f"))]
7383 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
7384 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDUS"
7386 "&& reload_completed"
7390 emit_move_insn (operands[2], operands[1]);
7391 emit_insn (gen_floatunsdisf2_fcfidus (operands[0], operands[2]));
7394 [(set_attr "length" "8")
7395 (set_attr "type" "fpload")])
7397 ;; Define the DImode operations that can be done in a small number
7398 ;; of instructions. The & constraints are to prevent the register
7399 ;; allocator from allocating registers that overlap with the inputs
7400 ;; (for example, having an input in 7,8 and an output in 6,7). We
7401 ;; also allow for the output being the same as one of the inputs.
7403 (define_insn "*adddi3_noppc64"
7404 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r")
7405 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,0,0")
7406 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I")))]
7407 "! TARGET_POWERPC64"
7410 if (WORDS_BIG_ENDIAN)
7411 return (GET_CODE (operands[2])) != CONST_INT
7412 ? \"{a|addc} %L0,%L1,%L2\;{ae|adde} %0,%1,%2\"
7413 : \"{ai|addic} %L0,%L1,%2\;{a%G2e|add%G2e} %0,%1\";
7415 return (GET_CODE (operands[2])) != CONST_INT
7416 ? \"{a|addc} %0,%1,%2\;{ae|adde} %L0,%L1,%L2\"
7417 : \"{ai|addic} %0,%1,%2\;{a%G2e|add%G2e} %L0,%L1\";
7419 [(set_attr "type" "two")
7420 (set_attr "length" "8")])
7422 (define_insn "*subdi3_noppc64"
7423 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r,r")
7424 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I,0,r,I")
7425 (match_operand:DI 2 "gpc_reg_operand" "r,r,r,0,0")))]
7426 "! TARGET_POWERPC64"
7429 if (WORDS_BIG_ENDIAN)
7430 return (GET_CODE (operands[1]) != CONST_INT)
7431 ? \"{sf|subfc} %L0,%L2,%L1\;{sfe|subfe} %0,%2,%1\"
7432 : \"{sfi|subfic} %L0,%L2,%1\;{sf%G1e|subf%G1e} %0,%2\";
7434 return (GET_CODE (operands[1]) != CONST_INT)
7435 ? \"{sf|subfc} %0,%2,%1\;{sfe|subfe} %L0,%L2,%L1\"
7436 : \"{sfi|subfic} %0,%2,%1\;{sf%G1e|subf%G1e} %L0,%L2\";
7438 [(set_attr "type" "two")
7439 (set_attr "length" "8")])
7441 (define_insn "*negdi2_noppc64"
7442 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
7443 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))]
7444 "! TARGET_POWERPC64"
7447 return (WORDS_BIG_ENDIAN)
7448 ? \"{sfi|subfic} %L0,%L1,0\;{sfze|subfze} %0,%1\"
7449 : \"{sfi|subfic} %0,%1,0\;{sfze|subfze} %L0,%L1\";
7451 [(set_attr "type" "two")
7452 (set_attr "length" "8")])
7454 (define_expand "mulsidi3"
7455 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7456 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
7457 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
7458 "! TARGET_POWERPC64"
7461 if (! TARGET_POWER && ! TARGET_POWERPC)
7463 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
7464 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
7465 emit_insn (gen_mull_call ());
7466 if (WORDS_BIG_ENDIAN)
7467 emit_move_insn (operands[0], gen_rtx_REG (DImode, 3));
7470 emit_move_insn (operand_subword (operands[0], 0, 0, DImode),
7471 gen_rtx_REG (SImode, 3));
7472 emit_move_insn (operand_subword (operands[0], 1, 0, DImode),
7473 gen_rtx_REG (SImode, 4));
7477 else if (TARGET_POWER)
7479 emit_insn (gen_mulsidi3_mq (operands[0], operands[1], operands[2]));
7484 (define_insn "mulsidi3_mq"
7485 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7486 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
7487 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
7488 (clobber (match_scratch:SI 3 "=q"))]
7490 "mul %0,%1,%2\;mfmq %L0"
7491 [(set_attr "type" "imul")
7492 (set_attr "length" "8")])
7494 (define_insn "*mulsidi3_no_mq"
7495 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
7496 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
7497 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
7498 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
7501 return (WORDS_BIG_ENDIAN)
7502 ? \"mulhw %0,%1,%2\;mullw %L0,%1,%2\"
7503 : \"mulhw %L0,%1,%2\;mullw %0,%1,%2\";
7505 [(set_attr "type" "imul")
7506 (set_attr "length" "8")])
7509 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7510 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
7511 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
7512 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
7515 (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
7516 (sign_extend:DI (match_dup 2)))
7519 (mult:SI (match_dup 1)
7523 int endian = (WORDS_BIG_ENDIAN == 0);
7524 operands[3] = operand_subword (operands[0], endian, 0, DImode);
7525 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
7528 (define_expand "umulsidi3"
7529 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7530 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
7531 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
7532 "TARGET_POWERPC && ! TARGET_POWERPC64"
7537 emit_insn (gen_umulsidi3_mq (operands[0], operands[1], operands[2]));
7542 (define_insn "umulsidi3_mq"
7543 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
7544 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
7545 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
7546 (clobber (match_scratch:SI 3 "=q"))]
7547 "TARGET_POWERPC && TARGET_POWER"
7550 return (WORDS_BIG_ENDIAN)
7551 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
7552 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
7554 [(set_attr "type" "imul")
7555 (set_attr "length" "8")])
7557 (define_insn "*umulsidi3_no_mq"
7558 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
7559 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
7560 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
7561 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
7564 return (WORDS_BIG_ENDIAN)
7565 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
7566 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
7568 [(set_attr "type" "imul")
7569 (set_attr "length" "8")])
7572 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7573 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
7574 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
7575 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
7578 (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
7579 (zero_extend:DI (match_dup 2)))
7582 (mult:SI (match_dup 1)
7586 int endian = (WORDS_BIG_ENDIAN == 0);
7587 operands[3] = operand_subword (operands[0], endian, 0, DImode);
7588 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
7591 (define_expand "smulsi3_highpart"
7592 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7594 (lshiftrt:DI (mult:DI (sign_extend:DI
7595 (match_operand:SI 1 "gpc_reg_operand" ""))
7597 (match_operand:SI 2 "gpc_reg_operand" "")))
7602 if (! TARGET_POWER && ! TARGET_POWERPC)
7604 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
7605 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
7606 emit_insn (gen_mulh_call ());
7607 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
7610 else if (TARGET_POWER)
7612 emit_insn (gen_smulsi3_highpart_mq (operands[0], operands[1], operands[2]));
7617 (define_insn "smulsi3_highpart_mq"
7618 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7620 (lshiftrt:DI (mult:DI (sign_extend:DI
7621 (match_operand:SI 1 "gpc_reg_operand" "%r"))
7623 (match_operand:SI 2 "gpc_reg_operand" "r")))
7625 (clobber (match_scratch:SI 3 "=q"))]
7628 [(set_attr "type" "imul")])
7630 (define_insn "*smulsi3_highpart_no_mq"
7631 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7633 (lshiftrt:DI (mult:DI (sign_extend:DI
7634 (match_operand:SI 1 "gpc_reg_operand" "%r"))
7636 (match_operand:SI 2 "gpc_reg_operand" "r")))
7638 "TARGET_POWERPC && ! TARGET_POWER"
7640 [(set_attr "type" "imul")])
7642 (define_expand "umulsi3_highpart"
7643 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7645 (lshiftrt:DI (mult:DI (zero_extend:DI
7646 (match_operand:SI 1 "gpc_reg_operand" ""))
7648 (match_operand:SI 2 "gpc_reg_operand" "")))
7655 emit_insn (gen_umulsi3_highpart_mq (operands[0], operands[1], operands[2]));
7660 (define_insn "umulsi3_highpart_mq"
7661 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7663 (lshiftrt:DI (mult:DI (zero_extend:DI
7664 (match_operand:SI 1 "gpc_reg_operand" "%r"))
7666 (match_operand:SI 2 "gpc_reg_operand" "r")))
7668 (clobber (match_scratch:SI 3 "=q"))]
7669 "TARGET_POWERPC && TARGET_POWER"
7671 [(set_attr "type" "imul")])
7673 (define_insn "*umulsi3_highpart_no_mq"
7674 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7676 (lshiftrt:DI (mult:DI (zero_extend:DI
7677 (match_operand:SI 1 "gpc_reg_operand" "%r"))
7679 (match_operand:SI 2 "gpc_reg_operand" "r")))
7681 "TARGET_POWERPC && ! TARGET_POWER"
7683 [(set_attr "type" "imul")])
7685 ;; If operands 0 and 2 are in the same register, we have a problem. But
7686 ;; operands 0 and 1 (the usual case) can be in the same register. That's
7687 ;; why we have the strange constraints below.
7688 (define_insn "ashldi3_power"
7689 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
7690 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
7691 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
7692 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
7695 {sli|slwi} %0,%L1,%h2\;{cal %L0,0(0)|li %L0,0}
7696 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
7697 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
7698 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2"
7699 [(set_attr "length" "8")])
7701 (define_insn "lshrdi3_power"
7702 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
7703 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
7704 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
7705 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
7708 {s%A2i|s%A2wi} %L0,%1,%h2\;{cal %0,0(0)|li %0,0}
7709 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
7710 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
7711 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2"
7712 [(set_attr "length" "8")])
7714 ;; Shift by a variable amount is too complex to be worth open-coding. We
7715 ;; just handle shifts by constants.
7716 (define_insn "ashrdi3_power"
7717 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
7718 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7719 (match_operand:SI 2 "const_int_operand" "M,i")))
7720 (clobber (match_scratch:SI 3 "=X,q"))]
7723 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
7724 sraiq %0,%1,%h2\;srliq %L0,%L1,%h2"
7725 [(set_attr "type" "shift")
7726 (set_attr "length" "8")])
7728 (define_insn "ashrdi3_no_power"
7729 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
7730 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7731 (match_operand:SI 2 "const_int_operand" "M,i")))]
7732 "TARGET_32BIT && !TARGET_POWERPC64 && !TARGET_POWER && WORDS_BIG_ENDIAN"
7734 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
7735 {sri|srwi} %L0,%L1,%h2\;insrwi %L0,%1,%h2,0\;{srai|srawi} %0,%1,%h2"
7736 [(set_attr "type" "two,three")
7737 (set_attr "length" "8,12")])
7739 (define_insn "*ashrdisi3_noppc64"
7740 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7741 (subreg:SI (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7742 (const_int 32)) 4))]
7743 "TARGET_32BIT && !TARGET_POWERPC64"
7746 if (REGNO (operands[0]) == REGNO (operands[1]))
7749 return \"mr %0,%1\";
7751 [(set_attr "length" "4")])
7754 ;; PowerPC64 DImode operations.
7756 (define_expand "absdi2"
7757 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7758 (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))]
7763 emit_insn (gen_absdi2_isel (operands[0], operands[1]));
7765 emit_insn (gen_absdi2_internal (operands[0], operands[1]));
7769 (define_insn_and_split "absdi2_internal"
7770 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
7771 (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))
7772 (clobber (match_scratch:DI 2 "=&r,&r"))]
7773 "TARGET_POWERPC64 && !TARGET_ISEL"
7775 "&& reload_completed"
7776 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
7777 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
7778 (set (match_dup 0) (minus:DI (match_dup 0) (match_dup 2)))]
7781 (define_insn_and_split "*nabsdi2"
7782 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
7783 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0"))))
7784 (clobber (match_scratch:DI 2 "=&r,&r"))]
7785 "TARGET_POWERPC64 && !TARGET_ISEL"
7787 "&& reload_completed"
7788 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
7789 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
7790 (set (match_dup 0) (minus:DI (match_dup 2) (match_dup 0)))]
7793 (define_insn "muldi3"
7794 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7795 (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
7796 (match_operand:DI 2 "reg_or_short_operand" "r,I")))]
7802 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
7803 (const_string "imul3")
7804 (match_operand:SI 2 "short_cint_operand" "")
7805 (const_string "imul2")]
7806 (const_string "lmul")))])
7808 (define_insn "*muldi3_internal1"
7809 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7810 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
7811 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
7813 (clobber (match_scratch:DI 3 "=r,r"))]
7818 [(set_attr "type" "lmul_compare")
7819 (set_attr "length" "4,8")])
7822 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7823 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
7824 (match_operand:DI 2 "gpc_reg_operand" ""))
7826 (clobber (match_scratch:DI 3 ""))]
7827 "TARGET_POWERPC64 && reload_completed"
7829 (mult:DI (match_dup 1) (match_dup 2)))
7831 (compare:CC (match_dup 3)
7835 (define_insn "*muldi3_internal2"
7836 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7837 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
7838 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
7840 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7841 (mult:DI (match_dup 1) (match_dup 2)))]
7846 [(set_attr "type" "lmul_compare")
7847 (set_attr "length" "4,8")])
7850 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7851 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
7852 (match_operand:DI 2 "gpc_reg_operand" ""))
7854 (set (match_operand:DI 0 "gpc_reg_operand" "")
7855 (mult:DI (match_dup 1) (match_dup 2)))]
7856 "TARGET_POWERPC64 && reload_completed"
7858 (mult:DI (match_dup 1) (match_dup 2)))
7860 (compare:CC (match_dup 0)
7864 (define_insn "smuldi3_highpart"
7865 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7867 (lshiftrt:TI (mult:TI (sign_extend:TI
7868 (match_operand:DI 1 "gpc_reg_operand" "%r"))
7870 (match_operand:DI 2 "gpc_reg_operand" "r")))
7874 [(set_attr "type" "lmul")])
7876 (define_insn "umuldi3_highpart"
7877 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7879 (lshiftrt:TI (mult:TI (zero_extend:TI
7880 (match_operand:DI 1 "gpc_reg_operand" "%r"))
7882 (match_operand:DI 2 "gpc_reg_operand" "r")))
7886 [(set_attr "type" "lmul")])
7888 (define_insn "rotldi3"
7889 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7890 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7891 (match_operand:DI 2 "reg_or_cint_operand" "r,i")))]
7896 [(set_attr "type" "var_shift_rotate,integer")])
7898 (define_insn "*rotldi3_internal2"
7899 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7900 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7901 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
7903 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7910 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7911 (set_attr "length" "4,4,8,8")])
7914 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7915 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7916 (match_operand:DI 2 "reg_or_cint_operand" ""))
7918 (clobber (match_scratch:DI 3 ""))]
7919 "TARGET_POWERPC64 && reload_completed"
7921 (rotate:DI (match_dup 1) (match_dup 2)))
7923 (compare:CC (match_dup 3)
7927 (define_insn "*rotldi3_internal3"
7928 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7929 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7930 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
7932 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7933 (rotate:DI (match_dup 1) (match_dup 2)))]
7940 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7941 (set_attr "length" "4,4,8,8")])
7944 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7945 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7946 (match_operand:DI 2 "reg_or_cint_operand" ""))
7948 (set (match_operand:DI 0 "gpc_reg_operand" "")
7949 (rotate:DI (match_dup 1) (match_dup 2)))]
7950 "TARGET_POWERPC64 && reload_completed"
7952 (rotate:DI (match_dup 1) (match_dup 2)))
7954 (compare:CC (match_dup 0)
7958 (define_insn "*rotldi3_internal4"
7959 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7960 (and:DI (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7961 (match_operand:DI 2 "reg_or_cint_operand" "r,i"))
7962 (match_operand:DI 3 "mask64_operand" "n,n")))]
7965 rldc%B3 %0,%1,%2,%S3
7966 rldic%B3 %0,%1,%H2,%S3"
7967 [(set_attr "type" "var_shift_rotate,integer")])
7969 (define_insn "*rotldi3_internal5"
7970 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7972 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7973 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
7974 (match_operand:DI 3 "mask64_operand" "n,n,n,n"))
7976 (clobber (match_scratch:DI 4 "=r,r,r,r"))]
7979 rldc%B3. %4,%1,%2,%S3
7980 rldic%B3. %4,%1,%H2,%S3
7983 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7984 (set_attr "length" "4,4,8,8")])
7987 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7989 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7990 (match_operand:DI 2 "reg_or_cint_operand" ""))
7991 (match_operand:DI 3 "mask64_operand" ""))
7993 (clobber (match_scratch:DI 4 ""))]
7994 "TARGET_POWERPC64 && reload_completed"
7996 (and:DI (rotate:DI (match_dup 1)
8000 (compare:CC (match_dup 4)
8004 (define_insn "*rotldi3_internal6"
8005 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
8007 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8008 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
8009 (match_operand:DI 3 "mask64_operand" "n,n,n,n"))
8011 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
8012 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
8015 rldc%B3. %0,%1,%2,%S3
8016 rldic%B3. %0,%1,%H2,%S3
8019 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8020 (set_attr "length" "4,4,8,8")])
8023 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
8025 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
8026 (match_operand:DI 2 "reg_or_cint_operand" ""))
8027 (match_operand:DI 3 "mask64_operand" ""))
8029 (set (match_operand:DI 0 "gpc_reg_operand" "")
8030 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
8031 "TARGET_POWERPC64 && reload_completed"
8033 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
8035 (compare:CC (match_dup 0)
8039 (define_insn "*rotldi3_internal7"
8040 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8043 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
8044 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
8048 rldicl %0,%1,%H2,56"
8049 [(set_attr "type" "var_shift_rotate,integer")])
8051 (define_insn "*rotldi3_internal8"
8052 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
8053 (compare:CC (zero_extend:DI
8055 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8056 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
8058 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
8062 rldicl. %3,%1,%H2,56
8065 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8066 (set_attr "length" "4,4,8,8")])
8069 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8070 (compare:CC (zero_extend:DI
8072 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
8073 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
8075 (clobber (match_scratch:DI 3 ""))]
8076 "TARGET_POWERPC64 && reload_completed"
8078 (zero_extend:DI (subreg:QI
8079 (rotate:DI (match_dup 1)
8082 (compare:CC (match_dup 3)
8086 (define_insn "*rotldi3_internal9"
8087 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
8088 (compare:CC (zero_extend:DI
8090 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8091 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
8093 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
8094 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
8098 rldicl. %0,%1,%H2,56
8101 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8102 (set_attr "length" "4,4,8,8")])
8105 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8106 (compare:CC (zero_extend:DI
8108 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
8109 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
8111 (set (match_operand:DI 0 "gpc_reg_operand" "")
8112 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
8113 "TARGET_POWERPC64 && reload_completed"
8115 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
8117 (compare:CC (match_dup 0)
8121 (define_insn "*rotldi3_internal10"
8122 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8125 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
8126 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
8130 rldicl %0,%1,%H2,48"
8131 [(set_attr "type" "var_shift_rotate,integer")])
8133 (define_insn "*rotldi3_internal11"
8134 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
8135 (compare:CC (zero_extend:DI
8137 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8138 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
8140 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
8144 rldicl. %3,%1,%H2,48
8147 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8148 (set_attr "length" "4,4,8,8")])
8151 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8152 (compare:CC (zero_extend:DI
8154 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
8155 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
8157 (clobber (match_scratch:DI 3 ""))]
8158 "TARGET_POWERPC64 && reload_completed"
8160 (zero_extend:DI (subreg:HI
8161 (rotate:DI (match_dup 1)
8164 (compare:CC (match_dup 3)
8168 (define_insn "*rotldi3_internal12"
8169 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
8170 (compare:CC (zero_extend:DI
8172 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8173 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
8175 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
8176 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
8180 rldicl. %0,%1,%H2,48
8183 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8184 (set_attr "length" "4,4,8,8")])
8187 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8188 (compare:CC (zero_extend:DI
8190 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
8191 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
8193 (set (match_operand:DI 0 "gpc_reg_operand" "")
8194 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
8195 "TARGET_POWERPC64 && reload_completed"
8197 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
8199 (compare:CC (match_dup 0)
8203 (define_insn "*rotldi3_internal13"
8204 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8207 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
8208 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
8212 rldicl %0,%1,%H2,32"
8213 [(set_attr "type" "var_shift_rotate,integer")])
8215 (define_insn "*rotldi3_internal14"
8216 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
8217 (compare:CC (zero_extend:DI
8219 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8220 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
8222 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
8226 rldicl. %3,%1,%H2,32
8229 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8230 (set_attr "length" "4,4,8,8")])
8233 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8234 (compare:CC (zero_extend:DI
8236 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
8237 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
8239 (clobber (match_scratch:DI 3 ""))]
8240 "TARGET_POWERPC64 && reload_completed"
8242 (zero_extend:DI (subreg:SI
8243 (rotate:DI (match_dup 1)
8246 (compare:CC (match_dup 3)
8250 (define_insn "*rotldi3_internal15"
8251 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
8252 (compare:CC (zero_extend:DI
8254 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8255 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
8257 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
8258 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
8262 rldicl. %0,%1,%H2,32
8265 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8266 (set_attr "length" "4,4,8,8")])
8269 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8270 (compare:CC (zero_extend:DI
8272 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
8273 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
8275 (set (match_operand:DI 0 "gpc_reg_operand" "")
8276 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
8277 "TARGET_POWERPC64 && reload_completed"
8279 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
8281 (compare:CC (match_dup 0)
8285 (define_expand "ashldi3"
8286 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8287 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
8288 (match_operand:SI 2 "reg_or_cint_operand" "")))]
8289 "TARGET_POWERPC64 || TARGET_POWER"
8292 if (TARGET_POWERPC64)
8294 else if (TARGET_POWER)
8296 emit_insn (gen_ashldi3_power (operands[0], operands[1], operands[2]));
8303 (define_insn "*ashldi3_internal1"
8304 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8305 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
8306 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
8311 [(set_attr "type" "var_shift_rotate,shift")])
8313 (define_insn "*ashldi3_internal2"
8314 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
8315 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8316 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
8318 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
8325 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8326 (set_attr "length" "4,4,8,8")])
8329 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
8330 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
8331 (match_operand:SI 2 "reg_or_cint_operand" ""))
8333 (clobber (match_scratch:DI 3 ""))]
8334 "TARGET_POWERPC64 && reload_completed"
8336 (ashift:DI (match_dup 1) (match_dup 2)))
8338 (compare:CC (match_dup 3)
8342 (define_insn "*ashldi3_internal3"
8343 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
8344 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8345 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
8347 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
8348 (ashift:DI (match_dup 1) (match_dup 2)))]
8355 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8356 (set_attr "length" "4,4,8,8")])
8359 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
8360 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
8361 (match_operand:SI 2 "reg_or_cint_operand" ""))
8363 (set (match_operand:DI 0 "gpc_reg_operand" "")
8364 (ashift:DI (match_dup 1) (match_dup 2)))]
8365 "TARGET_POWERPC64 && reload_completed"
8367 (ashift:DI (match_dup 1) (match_dup 2)))
8369 (compare:CC (match_dup 0)
8373 (define_insn "*ashldi3_internal4"
8374 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
8375 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
8376 (match_operand:SI 2 "const_int_operand" "i"))
8377 (match_operand:DI 3 "const_int_operand" "n")))]
8378 "TARGET_POWERPC64 && includes_rldic_lshift_p (operands[2], operands[3])"
8379 "rldic %0,%1,%H2,%W3")
8381 (define_insn "ashldi3_internal5"
8382 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
8384 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
8385 (match_operand:SI 2 "const_int_operand" "i,i"))
8386 (match_operand:DI 3 "const_int_operand" "n,n"))
8388 (clobber (match_scratch:DI 4 "=r,r"))]
8389 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
8391 rldic. %4,%1,%H2,%W3
8393 [(set_attr "type" "compare")
8394 (set_attr "length" "4,8")])
8397 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8399 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
8400 (match_operand:SI 2 "const_int_operand" ""))
8401 (match_operand:DI 3 "const_int_operand" ""))
8403 (clobber (match_scratch:DI 4 ""))]
8404 "TARGET_POWERPC64 && reload_completed
8405 && includes_rldic_lshift_p (operands[2], operands[3])"
8407 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
8410 (compare:CC (match_dup 4)
8414 (define_insn "*ashldi3_internal6"
8415 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
8417 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
8418 (match_operand:SI 2 "const_int_operand" "i,i"))
8419 (match_operand:DI 3 "const_int_operand" "n,n"))
8421 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8422 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
8423 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
8425 rldic. %0,%1,%H2,%W3
8427 [(set_attr "type" "compare")
8428 (set_attr "length" "4,8")])
8431 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
8433 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
8434 (match_operand:SI 2 "const_int_operand" ""))
8435 (match_operand:DI 3 "const_int_operand" ""))
8437 (set (match_operand:DI 0 "gpc_reg_operand" "")
8438 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
8439 "TARGET_POWERPC64 && reload_completed
8440 && includes_rldic_lshift_p (operands[2], operands[3])"
8442 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
8445 (compare:CC (match_dup 0)
8449 (define_insn "*ashldi3_internal7"
8450 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
8451 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
8452 (match_operand:SI 2 "const_int_operand" "i"))
8453 (match_operand:DI 3 "mask64_operand" "n")))]
8454 "TARGET_POWERPC64 && includes_rldicr_lshift_p (operands[2], operands[3])"
8455 "rldicr %0,%1,%H2,%S3")
8457 (define_insn "ashldi3_internal8"
8458 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
8460 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
8461 (match_operand:SI 2 "const_int_operand" "i,i"))
8462 (match_operand:DI 3 "mask64_operand" "n,n"))
8464 (clobber (match_scratch:DI 4 "=r,r"))]
8465 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
8467 rldicr. %4,%1,%H2,%S3
8469 [(set_attr "type" "compare")
8470 (set_attr "length" "4,8")])
8473 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8475 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
8476 (match_operand:SI 2 "const_int_operand" ""))
8477 (match_operand:DI 3 "mask64_operand" ""))
8479 (clobber (match_scratch:DI 4 ""))]
8480 "TARGET_POWERPC64 && reload_completed
8481 && includes_rldicr_lshift_p (operands[2], operands[3])"
8483 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
8486 (compare:CC (match_dup 4)
8490 (define_insn "*ashldi3_internal9"
8491 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
8493 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
8494 (match_operand:SI 2 "const_int_operand" "i,i"))
8495 (match_operand:DI 3 "mask64_operand" "n,n"))
8497 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8498 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
8499 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
8501 rldicr. %0,%1,%H2,%S3
8503 [(set_attr "type" "compare")
8504 (set_attr "length" "4,8")])
8507 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
8509 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
8510 (match_operand:SI 2 "const_int_operand" ""))
8511 (match_operand:DI 3 "mask64_operand" ""))
8513 (set (match_operand:DI 0 "gpc_reg_operand" "")
8514 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
8515 "TARGET_POWERPC64 && reload_completed
8516 && includes_rldicr_lshift_p (operands[2], operands[3])"
8518 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
8521 (compare:CC (match_dup 0)
8525 (define_expand "lshrdi3"
8526 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8527 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
8528 (match_operand:SI 2 "reg_or_cint_operand" "")))]
8529 "TARGET_POWERPC64 || TARGET_POWER"
8532 if (TARGET_POWERPC64)
8534 else if (TARGET_POWER)
8536 emit_insn (gen_lshrdi3_power (operands[0], operands[1], operands[2]));
8543 (define_insn "*lshrdi3_internal1"
8544 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8545 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
8546 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
8551 [(set_attr "type" "var_shift_rotate,shift")])
8553 (define_insn "*lshrdi3_internal2"
8554 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
8555 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8556 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
8558 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
8565 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8566 (set_attr "length" "4,4,8,8")])
8569 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8570 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
8571 (match_operand:SI 2 "reg_or_cint_operand" ""))
8573 (clobber (match_scratch:DI 3 ""))]
8574 "TARGET_POWERPC64 && reload_completed"
8576 (lshiftrt:DI (match_dup 1) (match_dup 2)))
8578 (compare:CC (match_dup 3)
8582 (define_insn "*lshrdi3_internal3"
8583 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
8584 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8585 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
8587 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
8588 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
8595 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8596 (set_attr "length" "4,4,8,8")])
8599 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8600 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
8601 (match_operand:SI 2 "reg_or_cint_operand" ""))
8603 (set (match_operand:DI 0 "gpc_reg_operand" "")
8604 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
8605 "TARGET_POWERPC64 && reload_completed"
8607 (lshiftrt:DI (match_dup 1) (match_dup 2)))
8609 (compare:CC (match_dup 0)
8613 (define_expand "ashrdi3"
8614 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8615 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
8616 (match_operand:SI 2 "reg_or_cint_operand" "")))]
8620 if (TARGET_POWERPC64)
8622 else if (TARGET_POWER && GET_CODE (operands[2]) == CONST_INT)
8624 emit_insn (gen_ashrdi3_power (operands[0], operands[1], operands[2]));
8627 else if (TARGET_32BIT && GET_CODE (operands[2]) == CONST_INT
8628 && WORDS_BIG_ENDIAN)
8630 emit_insn (gen_ashrdi3_no_power (operands[0], operands[1], operands[2]));
8637 (define_insn "*ashrdi3_internal1"
8638 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8639 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
8640 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
8645 [(set_attr "type" "var_shift_rotate,shift")])
8647 (define_insn "*ashrdi3_internal2"
8648 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
8649 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8650 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
8652 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
8659 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8660 (set_attr "length" "4,4,8,8")])
8663 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
8664 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
8665 (match_operand:SI 2 "reg_or_cint_operand" ""))
8667 (clobber (match_scratch:DI 3 ""))]
8668 "TARGET_POWERPC64 && reload_completed"
8670 (ashiftrt:DI (match_dup 1) (match_dup 2)))
8672 (compare:CC (match_dup 3)
8676 (define_insn "*ashrdi3_internal3"
8677 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
8678 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8679 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
8681 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
8682 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
8689 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8690 (set_attr "length" "4,4,8,8")])
8693 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
8694 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
8695 (match_operand:SI 2 "reg_or_cint_operand" ""))
8697 (set (match_operand:DI 0 "gpc_reg_operand" "")
8698 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
8699 "TARGET_POWERPC64 && reload_completed"
8701 (ashiftrt:DI (match_dup 1) (match_dup 2)))
8703 (compare:CC (match_dup 0)
8707 (define_expand "anddi3"
8709 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8710 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8711 (match_operand:DI 2 "and64_2_operand" "")))
8712 (clobber (match_scratch:CC 3 ""))])]
8716 (define_insn "anddi3_mc"
8717 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
8718 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r")
8719 (match_operand:DI 2 "and64_2_operand" "?r,S,T,K,J,t")))
8720 (clobber (match_scratch:CC 3 "=X,X,X,x,x,X"))]
8721 "TARGET_POWERPC64 && rs6000_gen_cell_microcode"
8724 rldic%B2 %0,%1,0,%S2
8725 rlwinm %0,%1,0,%m2,%M2
8729 [(set_attr "type" "*,*,*,fast_compare,fast_compare,*")
8730 (set_attr "length" "4,4,4,4,4,8")])
8732 (define_insn "anddi3_nomc"
8733 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
8734 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r")
8735 (match_operand:DI 2 "and64_2_operand" "?r,S,T,t")))
8736 (clobber (match_scratch:CC 3 "=X,X,X,X"))]
8737 "TARGET_POWERPC64 && !rs6000_gen_cell_microcode"
8740 rldic%B2 %0,%1,0,%S2
8741 rlwinm %0,%1,0,%m2,%M2
8743 [(set_attr "length" "4,4,4,8")])
8746 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8747 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8748 (match_operand:DI 2 "mask64_2_operand" "")))
8749 (clobber (match_scratch:CC 3 ""))]
8751 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
8752 && !mask_operand (operands[2], DImode)
8753 && !mask64_operand (operands[2], DImode)"
8755 (and:DI (rotate:DI (match_dup 1)
8759 (and:DI (rotate:DI (match_dup 0)
8763 build_mask64_2_operands (operands[2], &operands[4]);
8766 (define_insn "*anddi3_internal2_mc"
8767 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,x,?y,?y,?y,??y,??y,?y")
8768 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r,r,r")
8769 (match_operand:DI 2 "and64_2_operand" "r,S,T,K,J,t,r,S,T,K,J,t"))
8771 (clobber (match_scratch:DI 3 "=r,r,r,r,r,r,r,r,r,r,r,r"))
8772 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,X,X,x,x,X"))]
8773 "TARGET_64BIT && rs6000_gen_cell_microcode"
8776 rldic%B2. %3,%1,0,%S2
8777 rlwinm. %3,%1,0,%m2,%M2
8787 [(set_attr "type" "fast_compare,compare,delayed_compare,fast_compare,\
8788 fast_compare,compare,compare,compare,compare,compare,\
8790 (set_attr "length" "4,4,4,4,4,8,8,8,8,8,8,12")])
8793 [(set (match_operand:CC 0 "cc_reg_operand" "")
8794 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8795 (match_operand:DI 2 "mask64_2_operand" ""))
8797 (clobber (match_scratch:DI 3 ""))
8798 (clobber (match_scratch:CC 4 ""))]
8799 "TARGET_64BIT && reload_completed
8800 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
8801 && !mask_operand (operands[2], DImode)
8802 && !mask64_operand (operands[2], DImode)"
8804 (and:DI (rotate:DI (match_dup 1)
8807 (parallel [(set (match_dup 0)
8808 (compare:CC (and:DI (rotate:DI (match_dup 3)
8812 (clobber (match_dup 3))])]
8815 build_mask64_2_operands (operands[2], &operands[5]);
8818 (define_insn "*anddi3_internal3_mc"
8819 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,x,x,?y,?y,?y,??y,??y,?y")
8820 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r,r,r")
8821 (match_operand:DI 2 "and64_2_operand" "r,S,T,K,J,t,r,S,T,K,J,t"))
8823 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r,r,r")
8824 (and:DI (match_dup 1) (match_dup 2)))
8825 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,X,X,x,x,X"))]
8826 "TARGET_64BIT && rs6000_gen_cell_microcode"
8829 rldic%B2. %0,%1,0,%S2
8830 rlwinm. %0,%1,0,%m2,%M2
8840 [(set_attr "type" "fast_compare,compare,delayed_compare,fast_compare,\
8841 fast_compare,compare,compare,compare,compare,compare,\
8843 (set_attr "length" "4,4,4,4,4,8,8,8,8,8,8,12")])
8846 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8847 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8848 (match_operand:DI 2 "and64_2_operand" ""))
8850 (set (match_operand:DI 0 "gpc_reg_operand" "")
8851 (and:DI (match_dup 1) (match_dup 2)))
8852 (clobber (match_scratch:CC 4 ""))]
8853 "TARGET_64BIT && reload_completed"
8854 [(parallel [(set (match_dup 0)
8855 (and:DI (match_dup 1) (match_dup 2)))
8856 (clobber (match_dup 4))])
8858 (compare:CC (match_dup 0)
8863 [(set (match_operand:CC 3 "cc_reg_operand" "")
8864 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8865 (match_operand:DI 2 "mask64_2_operand" ""))
8867 (set (match_operand:DI 0 "gpc_reg_operand" "")
8868 (and:DI (match_dup 1) (match_dup 2)))
8869 (clobber (match_scratch:CC 4 ""))]
8870 "TARGET_64BIT && reload_completed
8871 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
8872 && !mask_operand (operands[2], DImode)
8873 && !mask64_operand (operands[2], DImode)"
8875 (and:DI (rotate:DI (match_dup 1)
8878 (parallel [(set (match_dup 3)
8879 (compare:CC (and:DI (rotate:DI (match_dup 0)
8884 (and:DI (rotate:DI (match_dup 0)
8889 build_mask64_2_operands (operands[2], &operands[5]);
8892 (define_expand "iordi3"
8893 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8894 (ior:DI (match_operand:DI 1 "gpc_reg_operand" "")
8895 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
8899 if (non_logical_cint_operand (operands[2], DImode))
8901 HOST_WIDE_INT value;
8902 rtx tmp = ((!can_create_pseudo_p ()
8903 || rtx_equal_p (operands[0], operands[1]))
8904 ? operands[0] : gen_reg_rtx (DImode));
8906 if (GET_CODE (operands[2]) == CONST_INT)
8908 value = INTVAL (operands[2]);
8909 emit_insn (gen_iordi3 (tmp, operands[1],
8910 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
8914 value = CONST_DOUBLE_LOW (operands[2]);
8915 emit_insn (gen_iordi3 (tmp, operands[1],
8916 immed_double_const (value
8917 & (~ (HOST_WIDE_INT) 0xffff),
8921 emit_insn (gen_iordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
8926 (define_expand "xordi3"
8927 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8928 (xor:DI (match_operand:DI 1 "gpc_reg_operand" "")
8929 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
8933 if (non_logical_cint_operand (operands[2], DImode))
8935 HOST_WIDE_INT value;
8936 rtx tmp = ((!can_create_pseudo_p ()
8937 || rtx_equal_p (operands[0], operands[1]))
8938 ? operands[0] : gen_reg_rtx (DImode));
8940 if (GET_CODE (operands[2]) == CONST_INT)
8942 value = INTVAL (operands[2]);
8943 emit_insn (gen_xordi3 (tmp, operands[1],
8944 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
8948 value = CONST_DOUBLE_LOW (operands[2]);
8949 emit_insn (gen_xordi3 (tmp, operands[1],
8950 immed_double_const (value
8951 & (~ (HOST_WIDE_INT) 0xffff),
8955 emit_insn (gen_xordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
8960 (define_insn "*booldi3_internal1"
8961 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
8962 (match_operator:DI 3 "boolean_or_operator"
8963 [(match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
8964 (match_operand:DI 2 "logical_operand" "r,K,JF")]))]
8971 (define_insn "*booldi3_internal2"
8972 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
8973 (compare:CC (match_operator:DI 4 "boolean_or_operator"
8974 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
8975 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
8977 (clobber (match_scratch:DI 3 "=r,r"))]
8982 [(set_attr "type" "fast_compare,compare")
8983 (set_attr "length" "4,8")])
8986 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8987 (compare:CC (match_operator:DI 4 "boolean_operator"
8988 [(match_operand:DI 1 "gpc_reg_operand" "")
8989 (match_operand:DI 2 "gpc_reg_operand" "")])
8991 (clobber (match_scratch:DI 3 ""))]
8992 "TARGET_POWERPC64 && reload_completed"
8993 [(set (match_dup 3) (match_dup 4))
8995 (compare:CC (match_dup 3)
8999 (define_insn "*booldi3_internal3"
9000 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
9001 (compare:CC (match_operator:DI 4 "boolean_or_operator"
9002 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
9003 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
9005 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
9011 [(set_attr "type" "fast_compare,compare")
9012 (set_attr "length" "4,8")])
9015 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
9016 (compare:CC (match_operator:DI 4 "boolean_operator"
9017 [(match_operand:DI 1 "gpc_reg_operand" "")
9018 (match_operand:DI 2 "gpc_reg_operand" "")])
9020 (set (match_operand:DI 0 "gpc_reg_operand" "")
9022 "TARGET_POWERPC64 && reload_completed"
9023 [(set (match_dup 0) (match_dup 4))
9025 (compare:CC (match_dup 0)
9029 ;; Split a logical operation that we can't do in one insn into two insns,
9030 ;; each of which does one 16-bit part. This is used by combine.
9033 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9034 (match_operator:DI 3 "boolean_or_operator"
9035 [(match_operand:DI 1 "gpc_reg_operand" "")
9036 (match_operand:DI 2 "non_logical_cint_operand" "")]))]
9038 [(set (match_dup 0) (match_dup 4))
9039 (set (match_dup 0) (match_dup 5))]
9044 if (GET_CODE (operands[2]) == CONST_DOUBLE)
9046 HOST_WIDE_INT value = CONST_DOUBLE_LOW (operands[2]);
9047 i3 = immed_double_const (value & (~ (HOST_WIDE_INT) 0xffff),
9049 i4 = GEN_INT (value & 0xffff);
9053 i3 = GEN_INT (INTVAL (operands[2])
9054 & (~ (HOST_WIDE_INT) 0xffff));
9055 i4 = GEN_INT (INTVAL (operands[2]) & 0xffff);
9057 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
9059 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
9063 (define_insn "*boolcdi3_internal1"
9064 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9065 (match_operator:DI 3 "boolean_operator"
9066 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
9067 (match_operand:DI 2 "gpc_reg_operand" "r")]))]
9071 (define_insn "*boolcdi3_internal2"
9072 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
9073 (compare:CC (match_operator:DI 4 "boolean_operator"
9074 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
9075 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
9077 (clobber (match_scratch:DI 3 "=r,r"))]
9082 [(set_attr "type" "fast_compare,compare")
9083 (set_attr "length" "4,8")])
9086 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
9087 (compare:CC (match_operator:DI 4 "boolean_operator"
9088 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
9089 (match_operand:DI 2 "gpc_reg_operand" "")])
9091 (clobber (match_scratch:DI 3 ""))]
9092 "TARGET_POWERPC64 && reload_completed"
9093 [(set (match_dup 3) (match_dup 4))
9095 (compare:CC (match_dup 3)
9099 (define_insn "*boolcdi3_internal3"
9100 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
9101 (compare:CC (match_operator:DI 4 "boolean_operator"
9102 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
9103 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
9105 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
9111 [(set_attr "type" "fast_compare,compare")
9112 (set_attr "length" "4,8")])
9115 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
9116 (compare:CC (match_operator:DI 4 "boolean_operator"
9117 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
9118 (match_operand:DI 2 "gpc_reg_operand" "")])
9120 (set (match_operand:DI 0 "gpc_reg_operand" "")
9122 "TARGET_POWERPC64 && reload_completed"
9123 [(set (match_dup 0) (match_dup 4))
9125 (compare:CC (match_dup 0)
9129 (define_insn "*boolccdi3_internal1"
9130 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9131 (match_operator:DI 3 "boolean_operator"
9132 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
9133 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r"))]))]
9137 (define_insn "*boolccdi3_internal2"
9138 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
9139 (compare:CC (match_operator:DI 4 "boolean_operator"
9140 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
9141 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
9143 (clobber (match_scratch:DI 3 "=r,r"))]
9148 [(set_attr "type" "fast_compare,compare")
9149 (set_attr "length" "4,8")])
9152 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
9153 (compare:CC (match_operator:DI 4 "boolean_operator"
9154 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
9155 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
9157 (clobber (match_scratch:DI 3 ""))]
9158 "TARGET_POWERPC64 && reload_completed"
9159 [(set (match_dup 3) (match_dup 4))
9161 (compare:CC (match_dup 3)
9165 (define_insn "*boolccdi3_internal3"
9166 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
9167 (compare:CC (match_operator:DI 4 "boolean_operator"
9168 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
9169 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
9171 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
9177 [(set_attr "type" "fast_compare,compare")
9178 (set_attr "length" "4,8")])
9181 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
9182 (compare:CC (match_operator:DI 4 "boolean_operator"
9183 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
9184 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
9186 (set (match_operand:DI 0 "gpc_reg_operand" "")
9188 "TARGET_POWERPC64 && reload_completed"
9189 [(set (match_dup 0) (match_dup 4))
9191 (compare:CC (match_dup 0)
9195 (define_expand "smindi3"
9196 [(match_operand:DI 0 "gpc_reg_operand" "")
9197 (match_operand:DI 1 "gpc_reg_operand" "")
9198 (match_operand:DI 2 "gpc_reg_operand" "")]
9202 rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]);
9206 (define_expand "smaxdi3"
9207 [(match_operand:DI 0 "gpc_reg_operand" "")
9208 (match_operand:DI 1 "gpc_reg_operand" "")
9209 (match_operand:DI 2 "gpc_reg_operand" "")]
9213 rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]);
9217 (define_expand "umindi3"
9218 [(match_operand:DI 0 "gpc_reg_operand" "")
9219 (match_operand:DI 1 "gpc_reg_operand" "")
9220 (match_operand:DI 2 "gpc_reg_operand" "")]
9224 rs6000_emit_minmax (operands[0], UMIN, operands[1], operands[2]);
9228 (define_expand "umaxdi3"
9229 [(match_operand:DI 0 "gpc_reg_operand" "")
9230 (match_operand:DI 1 "gpc_reg_operand" "")
9231 (match_operand:DI 2 "gpc_reg_operand" "")]
9235 rs6000_emit_minmax (operands[0], UMAX, operands[1], operands[2]);
9240 ;; Now define ways of moving data around.
9242 ;; Set up a register with a value from the GOT table
9244 (define_expand "movsi_got"
9245 [(set (match_operand:SI 0 "gpc_reg_operand" "")
9246 (unspec:SI [(match_operand:SI 1 "got_operand" "")
9247 (match_dup 2)] UNSPEC_MOVSI_GOT))]
9248 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
9251 if (GET_CODE (operands[1]) == CONST)
9253 rtx offset = const0_rtx;
9254 HOST_WIDE_INT value;
9256 operands[1] = eliminate_constant_term (XEXP (operands[1], 0), &offset);
9257 value = INTVAL (offset);
9260 rtx tmp = (!can_create_pseudo_p ()
9262 : gen_reg_rtx (Pmode));
9263 emit_insn (gen_movsi_got (tmp, operands[1]));
9264 emit_insn (gen_addsi3 (operands[0], tmp, offset));
9269 operands[2] = rs6000_got_register (operands[1]);
9272 (define_insn "*movsi_got_internal"
9273 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9274 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
9275 (match_operand:SI 2 "gpc_reg_operand" "b")]
9277 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
9278 "{l|lwz} %0,%a1@got(%2)"
9279 [(set_attr "type" "load")])
9281 ;; Used by sched, shorten_branches and final when the GOT pseudo reg
9282 ;; didn't get allocated to a hard register.
9284 [(set (match_operand:SI 0 "gpc_reg_operand" "")
9285 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
9286 (match_operand:SI 2 "memory_operand" "")]
9288 "DEFAULT_ABI == ABI_V4
9290 && (reload_in_progress || reload_completed)"
9291 [(set (match_dup 0) (match_dup 2))
9292 (set (match_dup 0) (unspec:SI [(match_dup 1)(match_dup 0)]
9296 ;; For SI, we special-case integers that can't be loaded in one insn. We
9297 ;; do the load 16-bits at a time. We could do this by loading from memory,
9298 ;; and this is even supposed to be faster, but it is simpler not to get
9299 ;; integers in the TOC.
9300 (define_insn "movsi_low"
9301 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9302 (mem:SI (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
9303 (match_operand 2 "" ""))))]
9304 "TARGET_MACHO && ! TARGET_64BIT"
9305 "{l|lwz} %0,lo16(%2)(%1)"
9306 [(set_attr "type" "load")
9307 (set_attr "length" "4")])
9309 (define_insn "*movsi_internal1"
9310 [(set (match_operand:SI 0 "rs6000_nonimmediate_operand" "=r,r,r,m,r,r,r,r,r,*q,*c*l,*h,*h")
9311 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,R,*h,r,r,r,0"))]
9312 "!TARGET_SINGLE_FPU &&
9313 (gpc_reg_operand (operands[0], SImode) || gpc_reg_operand (operands[1], SImode))"
9317 {l%U1%X1|lwz%U1%X1} %0,%1
9318 {st%U0%X0|stw%U0%X0} %1,%0
9328 [(set_attr "type" "*,*,load,store,*,*,*,*,mfjmpr,*,mtjmpr,*,*")
9329 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4,4,4")])
9331 (define_insn "*movsi_internal1_single"
9332 [(set (match_operand:SI 0 "rs6000_nonimmediate_operand" "=r,r,r,m,r,r,r,r,r,*q,*c*l,*h,*h,m,*f")
9333 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,R,*h,r,r,r,0,f,m"))]
9334 "TARGET_SINGLE_FPU &&
9335 (gpc_reg_operand (operands[0], SImode) || gpc_reg_operand (operands[1], SImode))"
9339 {l%U1%X1|lwz%U1%X1} %0,%1
9340 {st%U0%X0|stw%U0%X0} %1,%0
9352 [(set_attr "type" "*,*,load,store,*,*,*,*,mfjmpr,*,mtjmpr,*,*,*,*")
9353 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4,4,4,4,4")])
9355 ;; Split a load of a large constant into the appropriate two-insn
9359 [(set (match_operand:SI 0 "gpc_reg_operand" "")
9360 (match_operand:SI 1 "const_int_operand" ""))]
9361 "(unsigned HOST_WIDE_INT) (INTVAL (operands[1]) + 0x8000) >= 0x10000
9362 && (INTVAL (operands[1]) & 0xffff) != 0"
9366 (ior:SI (match_dup 0)
9369 { rtx tem = rs6000_emit_set_const (operands[0], SImode, operands[1], 2);
9371 if (tem == operands[0])
9377 (define_insn "*mov<mode>_internal2"
9378 [(set (match_operand:CC 2 "cc_reg_operand" "=y,x,?y")
9379 (compare:CC (match_operand:P 1 "gpc_reg_operand" "0,r,r")
9381 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r") (match_dup 1))]
9384 {cmpi|cmp<wd>i} %2,%0,0
9387 [(set_attr "type" "cmp,compare,cmp")
9388 (set_attr "length" "4,4,8")])
9391 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
9392 (compare:CC (match_operand:P 1 "gpc_reg_operand" "")
9394 (set (match_operand:P 0 "gpc_reg_operand" "") (match_dup 1))]
9396 [(set (match_dup 0) (match_dup 1))
9398 (compare:CC (match_dup 0)
9402 (define_insn "*movhi_internal"
9403 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
9404 (match_operand:HI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
9405 "gpc_reg_operand (operands[0], HImode)
9406 || gpc_reg_operand (operands[1], HImode)"
9416 [(set_attr "type" "*,load,store,*,mfjmpr,*,mtjmpr,*")])
9418 (define_expand "mov<mode>"
9419 [(set (match_operand:INT 0 "general_operand" "")
9420 (match_operand:INT 1 "any_operand" ""))]
9422 "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
9424 (define_insn "*movqi_internal"
9425 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
9426 (match_operand:QI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
9427 "gpc_reg_operand (operands[0], QImode)
9428 || gpc_reg_operand (operands[1], QImode)"
9438 [(set_attr "type" "*,load,store,*,mfjmpr,*,mtjmpr,*")])
9440 ;; Here is how to move condition codes around. When we store CC data in
9441 ;; an integer register or memory, we store just the high-order 4 bits.
9442 ;; This lets us not shift in the most common case of CR0.
9443 (define_expand "movcc"
9444 [(set (match_operand:CC 0 "nonimmediate_operand" "")
9445 (match_operand:CC 1 "nonimmediate_operand" ""))]
9449 (define_insn "*movcc_internal1"
9450 [(set (match_operand:CC 0 "nonimmediate_operand" "=y,x,?y,y,r,r,r,r,r,q,cl,r,m")
9451 (match_operand:CC 1 "general_operand" "y,r,r,O,x,y,r,I,h,r,r,m,r"))]
9452 "register_operand (operands[0], CCmode)
9453 || register_operand (operands[1], CCmode)"
9457 {rlinm|rlwinm} %1,%1,%F0,0xffffffff\;mtcrf %R0,%1\;{rlinm|rlwinm} %1,%1,%f0,0xffffffff
9460 mfcr %0%Q1\;{rlinm|rlwinm} %0,%0,%f1,0xf0000000
9466 {l%U1%X1|lwz%U1%X1} %0,%1
9467 {st%U0%U1|stw%U0%U1} %1,%0"
9469 (cond [(eq_attr "alternative" "0,3")
9470 (const_string "cr_logical")
9471 (eq_attr "alternative" "1,2")
9472 (const_string "mtcr")
9473 (eq_attr "alternative" "6,7,9")
9474 (const_string "integer")
9475 (eq_attr "alternative" "8")
9476 (const_string "mfjmpr")
9477 (eq_attr "alternative" "10")
9478 (const_string "mtjmpr")
9479 (eq_attr "alternative" "11")
9480 (const_string "load")
9481 (eq_attr "alternative" "12")
9482 (const_string "store")
9483 (match_test "TARGET_MFCRF")
9484 (const_string "mfcrf")
9486 (const_string "mfcr")))
9487 (set_attr "length" "4,4,12,4,4,8,4,4,4,4,4,4,4")])
9489 ;; For floating-point, we normally deal with the floating-point registers
9490 ;; unless -msoft-float is used. The sole exception is that parameter passing
9491 ;; can produce floating-point values in fixed-point registers. Unless the
9492 ;; value is a simple constant or already in memory, we deal with this by
9493 ;; allocating memory and copying the value explicitly via that memory location.
9494 (define_expand "movsf"
9495 [(set (match_operand:SF 0 "nonimmediate_operand" "")
9496 (match_operand:SF 1 "any_operand" ""))]
9498 "{ rs6000_emit_move (operands[0], operands[1], SFmode); DONE; }")
9501 [(set (match_operand:SF 0 "gpc_reg_operand" "")
9502 (match_operand:SF 1 "const_double_operand" ""))]
9504 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
9505 || (GET_CODE (operands[0]) == SUBREG
9506 && GET_CODE (SUBREG_REG (operands[0])) == REG
9507 && REGNO (SUBREG_REG (operands[0])) <= 31))"
9508 [(set (match_dup 2) (match_dup 3))]
9514 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
9515 REAL_VALUE_TO_TARGET_SINGLE (rv, l);
9517 if (! TARGET_POWERPC64)
9518 operands[2] = operand_subword (operands[0], 0, 0, SFmode);
9520 operands[2] = gen_lowpart (SImode, operands[0]);
9522 operands[3] = gen_int_mode (l, SImode);
9525 (define_insn "*movsf_hardfloat"
9526 [(set (match_operand:SF 0 "nonimmediate_operand" "=!r,!r,m,f,f,m,*c*l,*q,!r,*h,!r,!r")
9527 (match_operand:SF 1 "input_operand" "r,m,r,f,m,f,r,r,h,0,G,Fn"))]
9528 "(gpc_reg_operand (operands[0], SFmode)
9529 || gpc_reg_operand (operands[1], SFmode))
9530 && (TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT)"
9533 {l%U1%X1|lwz%U1%X1} %0,%1
9534 {st%U0%X0|stw%U0%X0} %1,%0
9544 [(set_attr "type" "*,load,store,fp,fpload,fpstore,mtjmpr,*,mfjmpr,*,*,*")
9545 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,8")])
9547 (define_insn "*movsf_softfloat"
9548 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,cl,q,r,r,m,r,r,r,r,r,*h")
9549 (match_operand:SF 1 "input_operand" "r,r,r,h,m,r,I,L,R,G,Fn,0"))]
9550 "(gpc_reg_operand (operands[0], SFmode)
9551 || gpc_reg_operand (operands[1], SFmode))
9552 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)"
9558 {l%U1%X1|lwz%U1%X1} %0,%1
9559 {st%U0%X0|stw%U0%X0} %1,%0
9566 [(set_attr "type" "*,mtjmpr,*,mfjmpr,load,store,*,*,*,*,*,*")
9567 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,8,4")])
9570 (define_expand "movdf"
9571 [(set (match_operand:DF 0 "nonimmediate_operand" "")
9572 (match_operand:DF 1 "any_operand" ""))]
9574 "{ rs6000_emit_move (operands[0], operands[1], DFmode); DONE; }")
9577 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9578 (match_operand:DF 1 "const_int_operand" ""))]
9579 "! TARGET_POWERPC64 && reload_completed
9580 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
9581 || (GET_CODE (operands[0]) == SUBREG
9582 && GET_CODE (SUBREG_REG (operands[0])) == REG
9583 && REGNO (SUBREG_REG (operands[0])) <= 31))"
9584 [(set (match_dup 2) (match_dup 4))
9585 (set (match_dup 3) (match_dup 1))]
9588 int endian = (WORDS_BIG_ENDIAN == 0);
9589 HOST_WIDE_INT value = INTVAL (operands[1]);
9591 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
9592 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
9593 #if HOST_BITS_PER_WIDE_INT == 32
9594 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
9596 operands[4] = GEN_INT (value >> 32);
9597 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
9602 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9603 (match_operand:DF 1 "const_double_operand" ""))]
9604 "! TARGET_POWERPC64 && reload_completed
9605 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
9606 || (GET_CODE (operands[0]) == SUBREG
9607 && GET_CODE (SUBREG_REG (operands[0])) == REG
9608 && REGNO (SUBREG_REG (operands[0])) <= 31))"
9609 [(set (match_dup 2) (match_dup 4))
9610 (set (match_dup 3) (match_dup 5))]
9613 int endian = (WORDS_BIG_ENDIAN == 0);
9617 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
9618 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
9620 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
9621 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
9622 operands[4] = gen_int_mode (l[endian], SImode);
9623 operands[5] = gen_int_mode (l[1 - endian], SImode);
9627 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9628 (match_operand:DF 1 "const_double_operand" ""))]
9629 "TARGET_POWERPC64 && reload_completed
9630 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
9631 || (GET_CODE (operands[0]) == SUBREG
9632 && GET_CODE (SUBREG_REG (operands[0])) == REG
9633 && REGNO (SUBREG_REG (operands[0])) <= 31))"
9634 [(set (match_dup 2) (match_dup 3))]
9637 int endian = (WORDS_BIG_ENDIAN == 0);
9640 #if HOST_BITS_PER_WIDE_INT >= 64
9644 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
9645 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
9647 operands[2] = gen_lowpart (DImode, operands[0]);
9648 /* HIGHPART is lower memory address when WORDS_BIG_ENDIAN. */
9649 #if HOST_BITS_PER_WIDE_INT >= 64
9650 val = ((HOST_WIDE_INT)(unsigned long)l[endian] << 32
9651 | ((HOST_WIDE_INT)(unsigned long)l[1 - endian]));
9653 operands[3] = gen_int_mode (val, DImode);
9655 operands[3] = immed_double_const (l[1 - endian], l[endian], DImode);
9659 ;; Don't have reload use general registers to load a constant. First,
9660 ;; it might not work if the output operand is the equivalent of
9661 ;; a non-offsettable memref, but also it is less efficient than loading
9662 ;; the constant into an FP register, since it will probably be used there.
9663 ;; The "??" is a kludge until we can figure out a more reasonable way
9664 ;; of handling these non-offsettable values.
9665 (define_insn "*movdf_hardfloat32"
9666 [(set (match_operand:DF 0 "nonimmediate_operand" "=!r,??r,m,ws,?wa,ws,?wa,Z,?Z,d,d,m,wa,!r,!r,!r")
9667 (match_operand:DF 1 "input_operand" "r,m,r,ws,wa,Z,Z,ws,wa,d,m,d,j,G,H,F"))]
9668 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9669 && (gpc_reg_operand (operands[0], DFmode)
9670 || gpc_reg_operand (operands[1], DFmode))"
9673 switch (which_alternative)
9683 return \"xxlor %x0,%x1,%x1\";
9686 return \"lxsd%U1x %x0,%y1\";
9689 return \"stxsd%U0x %x1,%y0\";
9691 return \"fmr %0,%1\";
9693 return \"lfd%U1%X1 %0,%1\";
9695 return \"stfd%U0%X0 %1,%0\";
9697 return \"xxlxor %x0,%x0,%x0\";
9704 [(set_attr "type" "two,load,store,fp,fp,fpload,fpload,fpstore,fpstore,fp,fpload,fpstore,vecsimple,*,*,*")
9705 (set_attr "length" "8,16,16,4,4,4,4,4,4,4,4,4,4,8,12,16")])
9707 (define_insn "*movdf_softfloat32"
9708 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,m,r,r,r")
9709 (match_operand:DF 1 "input_operand" "r,m,r,G,H,F"))]
9711 && ((TARGET_FPRS && TARGET_SINGLE_FLOAT)
9712 || TARGET_SOFT_FLOAT || TARGET_E500_SINGLE)
9713 && (gpc_reg_operand (operands[0], DFmode)
9714 || gpc_reg_operand (operands[1], DFmode))"
9716 [(set_attr "type" "two,load,store,*,*,*")
9717 (set_attr "length" "8,8,8,8,12,16")])
9719 ;; Reload patterns to support gpr load/store with misaligned mem.
9720 (define_expand "reload_di_store"
9721 [(parallel [(match_operand 0 "memory_operand" "=m")
9722 (match_operand 1 "gpc_reg_operand" "r")
9723 (match_operand:DI 2 "register_operand" "=&b")])]
9726 rs6000_secondary_reload_ppc64 (operands[1], operands[0], operands[2], true);
9730 (define_expand "reload_di_load"
9731 [(parallel [(match_operand 0 "gpc_reg_operand" "=r")
9732 (match_operand 1 "memory_operand" "m")
9733 (match_operand:DI 2 "register_operand" "=b")])]
9736 rs6000_secondary_reload_ppc64 (operands[0], operands[1], operands[2], false);
9740 ; ld/std require word-aligned displacements -> 'Y' constraint.
9741 ; List Y->r and r->Y before r->r for reload.
9742 (define_insn "*movdf_hardfloat64_mfpgpr"
9743 [(set (match_operand:DF 0 "nonimmediate_operand" "=Y,r,!r,ws,?wa,ws,?wa,Z,?Z,d,d,m,wa,*c*l,!r,*h,!r,!r,!r,r,d")
9744 (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"))]
9745 "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
9746 && TARGET_DOUBLE_FLOAT
9747 && (gpc_reg_operand (operands[0], DFmode)
9748 || gpc_reg_operand (operands[1], DFmode))"
9771 [(set_attr "type" "store,load,*,fp,fp,fpload,fpload,fpstore,fpstore,fp,fpload,fpstore,vecsimple,mtjmpr,mfjmpr,*,*,*,*,mftgpr,mffgpr")
9772 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,8,12,16,4,4")])
9774 ; ld/std require word-aligned displacements -> 'Y' constraint.
9775 ; List Y->r and r->Y before r->r for reload.
9776 (define_insn "*movdf_hardfloat64"
9777 [(set (match_operand:DF 0 "nonimmediate_operand" "=Y,r,!r,ws,?wa,ws,?wa,Z,?Z,d,d,m,wa,*c*l,!r,*h,!r,!r,!r")
9778 (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"))]
9779 "TARGET_POWERPC64 && !TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
9780 && TARGET_DOUBLE_FLOAT
9781 && (gpc_reg_operand (operands[0], DFmode)
9782 || gpc_reg_operand (operands[1], DFmode))"
9803 [(set_attr "type" "store,load,*,fp,fp,fpload,fpload,fpstore,fpstore,fp,fpload,fpstore,vecsimple,mtjmpr,mfjmpr,*,*,*,*")
9804 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,8,12,16")])
9806 (define_insn "*movdf_softfloat64"
9807 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,Y,r,cl,r,r,r,r,*h")
9808 (match_operand:DF 1 "input_operand" "Y,r,r,r,h,G,H,F,0"))]
9809 "TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)
9810 && (gpc_reg_operand (operands[0], DFmode)
9811 || gpc_reg_operand (operands[1], DFmode))"
9822 [(set_attr "type" "load,store,*,mtjmpr,mfjmpr,*,*,*,*")
9823 (set_attr "length" "4,4,4,4,4,8,12,16,4")])
9825 (define_expand "movtf"
9826 [(set (match_operand:TF 0 "general_operand" "")
9827 (match_operand:TF 1 "any_operand" ""))]
9828 "!TARGET_IEEEQUAD && TARGET_LONG_DOUBLE_128"
9829 "{ rs6000_emit_move (operands[0], operands[1], TFmode); DONE; }")
9831 ; It's important to list the o->f and f->o moves before f->f because
9832 ; otherwise reload, given m->f, will try to pick f->f and reload it,
9833 ; which doesn't make progress. Likewise r->Y must be before r->r.
9834 (define_insn_and_split "*movtf_internal"
9835 [(set (match_operand:TF 0 "nonimmediate_operand" "=o,d,d,r,Y,r")
9836 (match_operand:TF 1 "input_operand" "d,o,d,YGHF,r,r"))]
9838 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128
9839 && (gpc_reg_operand (operands[0], TFmode)
9840 || gpc_reg_operand (operands[1], TFmode))"
9842 "&& reload_completed"
9844 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
9845 [(set_attr "length" "8,8,8,20,20,16")])
9847 (define_insn_and_split "*movtf_softfloat"
9848 [(set (match_operand:TF 0 "rs6000_nonimmediate_operand" "=r,Y,r")
9849 (match_operand:TF 1 "input_operand" "YGHF,r,r"))]
9851 && (TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_LONG_DOUBLE_128
9852 && (gpc_reg_operand (operands[0], TFmode)
9853 || gpc_reg_operand (operands[1], TFmode))"
9855 "&& reload_completed"
9857 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
9858 [(set_attr "length" "20,20,16")])
9860 (define_expand "extenddftf2"
9861 [(set (match_operand:TF 0 "nonimmediate_operand" "")
9862 (float_extend:TF (match_operand:DF 1 "input_operand" "")))]
9864 && TARGET_HARD_FLOAT
9865 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9866 && TARGET_LONG_DOUBLE_128"
9868 if (TARGET_E500_DOUBLE)
9869 emit_insn (gen_spe_extenddftf2 (operands[0], operands[1]));
9871 emit_insn (gen_extenddftf2_fprs (operands[0], operands[1]));
9875 (define_expand "extenddftf2_fprs"
9876 [(parallel [(set (match_operand:TF 0 "nonimmediate_operand" "")
9877 (float_extend:TF (match_operand:DF 1 "input_operand" "")))
9878 (use (match_dup 2))])]
9880 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9881 && TARGET_LONG_DOUBLE_128"
9883 operands[2] = CONST0_RTX (DFmode);
9884 /* Generate GOT reference early for SVR4 PIC. */
9885 if (DEFAULT_ABI == ABI_V4 && flag_pic)
9886 operands[2] = validize_mem (force_const_mem (DFmode, operands[2]));
9889 (define_insn_and_split "*extenddftf2_internal"
9890 [(set (match_operand:TF 0 "nonimmediate_operand" "=o,d,&d,r")
9891 (float_extend:TF (match_operand:DF 1 "input_operand" "dr,md,md,rmGHF")))
9892 (use (match_operand:DF 2 "zero_reg_mem_operand" "rd,m,d,n"))]
9894 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9895 && TARGET_LONG_DOUBLE_128"
9897 "&& reload_completed"
9900 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
9901 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
9902 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word),
9904 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word),
9909 (define_expand "extendsftf2"
9910 [(set (match_operand:TF 0 "nonimmediate_operand" "")
9911 (float_extend:TF (match_operand:SF 1 "gpc_reg_operand" "")))]
9913 && TARGET_HARD_FLOAT
9914 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9915 && TARGET_LONG_DOUBLE_128"
9917 rtx tmp = gen_reg_rtx (DFmode);
9918 emit_insn (gen_extendsfdf2 (tmp, operands[1]));
9919 emit_insn (gen_extenddftf2 (operands[0], tmp));
9923 (define_expand "trunctfdf2"
9924 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9925 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "")))]
9927 && TARGET_HARD_FLOAT
9928 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9929 && TARGET_LONG_DOUBLE_128"
9932 (define_insn_and_split "trunctfdf2_internal1"
9933 [(set (match_operand:DF 0 "gpc_reg_operand" "=d,?d")
9934 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "0,d")))]
9935 "!TARGET_IEEEQUAD && !TARGET_XL_COMPAT
9936 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9940 "&& reload_completed && REGNO (operands[0]) == REGNO (operands[1])"
9943 emit_note (NOTE_INSN_DELETED);
9946 [(set_attr "type" "fp")])
9948 (define_insn "trunctfdf2_internal2"
9949 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
9950 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "d")))]
9951 "!TARGET_IEEEQUAD && TARGET_XL_COMPAT
9952 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9953 && TARGET_LONG_DOUBLE_128"
9955 [(set_attr "type" "fp")
9956 (set_attr "fp_type" "fp_addsub_d")])
9958 (define_expand "trunctfsf2"
9959 [(set (match_operand:SF 0 "gpc_reg_operand" "")
9960 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "")))]
9962 && TARGET_HARD_FLOAT
9963 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9964 && TARGET_LONG_DOUBLE_128"
9966 if (TARGET_E500_DOUBLE)
9967 emit_insn (gen_spe_trunctfsf2 (operands[0], operands[1]));
9969 emit_insn (gen_trunctfsf2_fprs (operands[0], operands[1]));
9973 (define_insn_and_split "trunctfsf2_fprs"
9974 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
9975 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "d")))
9976 (clobber (match_scratch:DF 2 "=d"))]
9978 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
9979 && TARGET_LONG_DOUBLE_128"
9981 "&& reload_completed"
9983 (float_truncate:DF (match_dup 1)))
9985 (float_truncate:SF (match_dup 2)))]
9988 (define_expand "floatsitf2"
9989 [(set (match_operand:TF 0 "gpc_reg_operand" "")
9990 (float:TF (match_operand:SI 1 "gpc_reg_operand" "")))]
9992 && TARGET_HARD_FLOAT
9993 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9994 && TARGET_LONG_DOUBLE_128"
9996 rtx tmp = gen_reg_rtx (DFmode);
9997 expand_float (tmp, operands[1], false);
9998 emit_insn (gen_extenddftf2 (operands[0], tmp));
10002 ; fadd, but rounding towards zero.
10003 ; This is probably not the optimal code sequence.
10004 (define_insn "fix_trunc_helper"
10005 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
10006 (unspec:DF [(match_operand:TF 1 "gpc_reg_operand" "d")]
10007 UNSPEC_FIX_TRUNC_TF))
10008 (clobber (match_operand:DF 2 "gpc_reg_operand" "=&d"))]
10009 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
10010 "mffs %2\n\tmtfsb1 31\n\tmtfsb0 30\n\tfadd %0,%1,%L1\n\tmtfsf 1,%2"
10011 [(set_attr "type" "fp")
10012 (set_attr "length" "20")])
10014 (define_expand "fix_trunctfsi2"
10015 [(set (match_operand:SI 0 "gpc_reg_operand" "")
10016 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))]
10018 && (TARGET_POWER2 || TARGET_POWERPC)
10019 && TARGET_HARD_FLOAT
10020 && (TARGET_FPRS || TARGET_E500_DOUBLE)
10021 && TARGET_LONG_DOUBLE_128"
10023 if (TARGET_E500_DOUBLE)
10024 emit_insn (gen_spe_fix_trunctfsi2 (operands[0], operands[1]));
10026 emit_insn (gen_fix_trunctfsi2_fprs (operands[0], operands[1]));
10030 (define_expand "fix_trunctfsi2_fprs"
10031 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
10032 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))
10033 (clobber (match_dup 2))
10034 (clobber (match_dup 3))
10035 (clobber (match_dup 4))
10036 (clobber (match_dup 5))])]
10038 && (TARGET_POWER2 || TARGET_POWERPC)
10039 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
10041 operands[2] = gen_reg_rtx (DFmode);
10042 operands[3] = gen_reg_rtx (DFmode);
10043 operands[4] = gen_reg_rtx (DImode);
10044 operands[5] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
10047 (define_insn_and_split "*fix_trunctfsi2_internal"
10048 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10049 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "d")))
10050 (clobber (match_operand:DF 2 "gpc_reg_operand" "=d"))
10051 (clobber (match_operand:DF 3 "gpc_reg_operand" "=&d"))
10052 (clobber (match_operand:DI 4 "gpc_reg_operand" "=d"))
10053 (clobber (match_operand:DI 5 "offsettable_mem_operand" "=o"))]
10055 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
10061 emit_insn (gen_fix_trunc_helper (operands[2], operands[1], operands[3]));
10063 gcc_assert (MEM_P (operands[5]));
10064 lowword = adjust_address (operands[5], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
10066 emit_insn (gen_fctiwz_df (operands[4], operands[2]));
10067 emit_move_insn (operands[5], operands[4]);
10068 emit_move_insn (operands[0], lowword);
10072 (define_expand "negtf2"
10073 [(set (match_operand:TF 0 "gpc_reg_operand" "")
10074 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "")))]
10076 && TARGET_HARD_FLOAT
10077 && (TARGET_FPRS || TARGET_E500_DOUBLE)
10078 && TARGET_LONG_DOUBLE_128"
10081 (define_insn "negtf2_internal"
10082 [(set (match_operand:TF 0 "gpc_reg_operand" "=d")
10083 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "d")))]
10085 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
10088 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
10089 return \"fneg %L0,%L1\;fneg %0,%1\";
10091 return \"fneg %0,%1\;fneg %L0,%L1\";
10093 [(set_attr "type" "fp")
10094 (set_attr "length" "8")])
10096 (define_expand "abstf2"
10097 [(set (match_operand:TF 0 "gpc_reg_operand" "")
10098 (abs:TF (match_operand:TF 1 "gpc_reg_operand" "")))]
10100 && TARGET_HARD_FLOAT
10101 && (TARGET_FPRS || TARGET_E500_DOUBLE)
10102 && TARGET_LONG_DOUBLE_128"
10105 rtx label = gen_label_rtx ();
10106 if (TARGET_E500_DOUBLE)
10108 if (flag_finite_math_only && !flag_trapping_math)
10109 emit_insn (gen_spe_abstf2_tst (operands[0], operands[1], label));
10111 emit_insn (gen_spe_abstf2_cmp (operands[0], operands[1], label));
10114 emit_insn (gen_abstf2_internal (operands[0], operands[1], label));
10115 emit_label (label);
10119 (define_expand "abstf2_internal"
10120 [(set (match_operand:TF 0 "gpc_reg_operand" "")
10121 (match_operand:TF 1 "gpc_reg_operand" ""))
10122 (set (match_dup 3) (match_dup 5))
10123 (set (match_dup 5) (abs:DF (match_dup 5)))
10124 (set (match_dup 4) (compare:CCFP (match_dup 3) (match_dup 5)))
10125 (set (pc) (if_then_else (eq (match_dup 4) (const_int 0))
10126 (label_ref (match_operand 2 "" ""))
10128 (set (match_dup 6) (neg:DF (match_dup 6)))]
10130 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
10131 && TARGET_LONG_DOUBLE_128"
10134 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
10135 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
10136 operands[3] = gen_reg_rtx (DFmode);
10137 operands[4] = gen_reg_rtx (CCFPmode);
10138 operands[5] = simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word);
10139 operands[6] = simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word);
10142 ;; Next come the multi-word integer load and store and the load and store
10145 ; List r->r after r->"o<>", otherwise reload will try to reload a
10146 ; non-offsettable address by using r->r which won't make progress.
10147 (define_insn "*movdi_internal32"
10148 [(set (match_operand:DI 0 "rs6000_nonimmediate_operand" "=o<>,r,r,*d,*d,m,r,?wa")
10149 (match_operand:DI 1 "input_operand" "r,r,m,d,m,d,IJKnGHF,O"))]
10150 "! TARGET_POWERPC64
10151 && (gpc_reg_operand (operands[0], DImode)
10152 || gpc_reg_operand (operands[1], DImode))"
10161 xxlxor %x0,%x0,%x0"
10162 [(set_attr "type" "load,*,store,fp,fpload,fpstore,*,vecsimple")])
10165 [(set (match_operand:DI 0 "gpc_reg_operand" "")
10166 (match_operand:DI 1 "const_int_operand" ""))]
10167 "! TARGET_POWERPC64 && reload_completed
10168 && gpr_or_gpr_p (operands[0], operands[1])"
10169 [(set (match_dup 2) (match_dup 4))
10170 (set (match_dup 3) (match_dup 1))]
10173 HOST_WIDE_INT value = INTVAL (operands[1]);
10174 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
10176 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
10178 #if HOST_BITS_PER_WIDE_INT == 32
10179 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
10181 operands[4] = GEN_INT (value >> 32);
10182 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
10187 [(set (match_operand:DIFD 0 "rs6000_nonimmediate_operand" "")
10188 (match_operand:DIFD 1 "input_operand" ""))]
10189 "reload_completed && !TARGET_POWERPC64
10190 && gpr_or_gpr_p (operands[0], operands[1])"
10192 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
10194 (define_insn "*movdi_mfpgpr"
10195 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,*d,*d,m,r,*h,*h,r,*d")
10196 (match_operand:DI 1 "input_operand" "r,m,r,I,L,nF,R,d,m,d,*h,r,0,*d,r"))]
10197 "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
10198 && (gpc_reg_operand (operands[0], DImode)
10199 || gpc_reg_operand (operands[1], DImode))"
10216 [(set_attr "type" "*,load,store,*,*,*,*,fp,fpload,fpstore,mfjmpr,mtjmpr,*,mftgpr,mffgpr")
10217 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4,4,4")])
10219 (define_insn "*movdi_internal64"
10220 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,*d,*d,m,r,*h,*h,?wa")
10221 (match_operand:DI 1 "input_operand" "r,m,r,I,L,nF,R,d,m,d,*h,r,0,O"))]
10222 "TARGET_POWERPC64 && (!TARGET_MFPGPR || !TARGET_HARD_FLOAT || !TARGET_FPRS)
10223 && (gpc_reg_operand (operands[0], DImode)
10224 || gpc_reg_operand (operands[1], DImode))"
10239 xxlxor %x0,%x0,%x0"
10240 [(set_attr "type" "*,load,store,*,*,*,*,fp,fpload,fpstore,mfjmpr,mtjmpr,*,vecsimple")
10241 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4,4")])
10243 ;; immediate value valid for a single instruction hiding in a const_double
10245 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10246 (match_operand:DI 1 "const_double_operand" "F"))]
10247 "HOST_BITS_PER_WIDE_INT == 32 && TARGET_POWERPC64
10248 && GET_CODE (operands[1]) == CONST_DOUBLE
10249 && num_insns_constant (operands[1], DImode) == 1"
10252 return ((unsigned HOST_WIDE_INT)
10253 (CONST_DOUBLE_LOW (operands[1]) + 0x8000) < 0x10000)
10254 ? \"li %0,%1\" : \"lis %0,%v1\";
10257 ;; Generate all one-bits and clear left or right.
10258 ;; Use (and:DI (rotate:DI ...)) to avoid anddi3 unnecessary clobber.
10260 [(set (match_operand:DI 0 "gpc_reg_operand" "")
10261 (match_operand:DI 1 "mask64_operand" ""))]
10262 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
10263 [(set (match_dup 0) (const_int -1))
10265 (and:DI (rotate:DI (match_dup 0)
10270 ;; Split a load of a large constant into the appropriate five-instruction
10271 ;; sequence. Handle anything in a constant number of insns.
10272 ;; When non-easy constants can go in the TOC, this should use
10273 ;; easy_fp_constant predicate.
10275 [(set (match_operand:DI 0 "gpc_reg_operand" "")
10276 (match_operand:DI 1 "const_int_operand" ""))]
10277 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
10278 [(set (match_dup 0) (match_dup 2))
10279 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
10281 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
10283 if (tem == operands[0])
10290 [(set (match_operand:DI 0 "gpc_reg_operand" "")
10291 (match_operand:DI 1 "const_double_operand" ""))]
10292 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
10293 [(set (match_dup 0) (match_dup 2))
10294 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
10296 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
10298 if (tem == operands[0])
10304 ;; TImode is similar, except that we usually want to compute the address into
10305 ;; a register and use lsi/stsi (the exception is during reload). MQ is also
10306 ;; clobbered in stsi for POWER, so we need a SCRATCH for it.
10308 ;; We say that MQ is clobbered in the last alternative because the first
10309 ;; alternative would never get used otherwise since it would need a reload
10310 ;; while the 2nd alternative would not. We put memory cases first so they
10311 ;; are preferred. Otherwise, we'd try to reload the output instead of
10312 ;; giving the SCRATCH mq.
10314 (define_insn "*movti_power"
10315 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,m,????r,????r,????r,r")
10316 (match_operand:TI 1 "input_operand" "r,r,r,Q,m,n"))
10317 (clobber (match_scratch:SI 2 "=q,q#X,X,X,X,X"))]
10318 "TARGET_POWER && ! TARGET_POWERPC64
10319 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
10322 switch (which_alternative)
10325 gcc_unreachable ();
10329 return \"{stsi|stswi} %1,%P0,16\";
10334 /* If the address is not used in the output, we can use lsi. Otherwise,
10335 fall through to generating four loads. */
10337 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
10338 return \"{lsi|lswi} %0,%P1,16\";
10339 /* ... fall through ... */
10345 [(set_attr "type" "store,store,*,load,load,*")])
10347 (define_insn "*movti_string"
10348 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,o<>,????r,????r,????r,r")
10349 (match_operand:TI 1 "input_operand" "r,r,r,Q,m,n"))]
10350 "! TARGET_POWER && ! TARGET_POWERPC64
10351 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
10354 switch (which_alternative)
10357 gcc_unreachable ();
10360 return \"{stsi|stswi} %1,%P0,16\";
10365 /* If the address is not used in the output, we can use lsi. Otherwise,
10366 fall through to generating four loads. */
10368 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
10369 return \"{lsi|lswi} %0,%P1,16\";
10370 /* ... fall through ... */
10376 [(set_attr "type" "store_ux,store_ux,*,load_ux,load_ux,*")
10377 (set (attr "cell_micro") (if_then_else (match_test "TARGET_STRING")
10378 (const_string "always")
10379 (const_string "conditional")))])
10381 (define_insn "*movti_ppc64"
10382 [(set (match_operand:TI 0 "nonimmediate_operand" "=r,o<>,r")
10383 (match_operand:TI 1 "input_operand" "r,r,m"))]
10384 "(TARGET_POWERPC64 && (gpc_reg_operand (operands[0], TImode)
10385 || gpc_reg_operand (operands[1], TImode)))
10386 && VECTOR_MEM_NONE_P (TImode)"
10388 [(set_attr "type" "*,store,load")])
10391 [(set (match_operand:TI 0 "gpc_reg_operand" "")
10392 (match_operand:TI 1 "const_double_operand" ""))]
10393 "TARGET_POWERPC64 && VECTOR_MEM_NONE_P (TImode)"
10394 [(set (match_dup 2) (match_dup 4))
10395 (set (match_dup 3) (match_dup 5))]
10398 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
10400 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
10402 if (GET_CODE (operands[1]) == CONST_DOUBLE)
10404 operands[4] = GEN_INT (CONST_DOUBLE_HIGH (operands[1]));
10405 operands[5] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
10407 else if (GET_CODE (operands[1]) == CONST_INT)
10409 operands[4] = GEN_INT (- (INTVAL (operands[1]) < 0));
10410 operands[5] = operands[1];
10417 [(set (match_operand:TI 0 "nonimmediate_operand" "")
10418 (match_operand:TI 1 "input_operand" ""))]
10419 "reload_completed && VECTOR_MEM_NONE_P (TImode)
10420 && gpr_or_gpr_p (operands[0], operands[1])"
10422 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
10424 (define_expand "load_multiple"
10425 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
10426 (match_operand:SI 1 "" ""))
10427 (use (match_operand:SI 2 "" ""))])]
10428 "TARGET_STRING && !TARGET_POWERPC64"
10436 /* Support only loading a constant number of fixed-point registers from
10437 memory and only bother with this if more than two; the machine
10438 doesn't support more than eight. */
10439 if (GET_CODE (operands[2]) != CONST_INT
10440 || INTVAL (operands[2]) <= 2
10441 || INTVAL (operands[2]) > 8
10442 || GET_CODE (operands[1]) != MEM
10443 || GET_CODE (operands[0]) != REG
10444 || REGNO (operands[0]) >= 32)
10447 count = INTVAL (operands[2]);
10448 regno = REGNO (operands[0]);
10450 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
10451 op1 = replace_equiv_address (operands[1],
10452 force_reg (SImode, XEXP (operands[1], 0)));
10454 for (i = 0; i < count; i++)
10455 XVECEXP (operands[3], 0, i)
10456 = gen_rtx_SET (VOIDmode, gen_rtx_REG (SImode, regno + i),
10457 adjust_address_nv (op1, SImode, i * 4));
10460 (define_insn "*ldmsi8"
10461 [(match_parallel 0 "load_multiple_operation"
10462 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10463 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10464 (set (match_operand:SI 3 "gpc_reg_operand" "")
10465 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10466 (set (match_operand:SI 4 "gpc_reg_operand" "")
10467 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
10468 (set (match_operand:SI 5 "gpc_reg_operand" "")
10469 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
10470 (set (match_operand:SI 6 "gpc_reg_operand" "")
10471 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
10472 (set (match_operand:SI 7 "gpc_reg_operand" "")
10473 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
10474 (set (match_operand:SI 8 "gpc_reg_operand" "")
10475 (mem:SI (plus:SI (match_dup 1) (const_int 24))))
10476 (set (match_operand:SI 9 "gpc_reg_operand" "")
10477 (mem:SI (plus:SI (match_dup 1) (const_int 28))))])]
10478 "TARGET_STRING && XVECLEN (operands[0], 0) == 8"
10480 { return rs6000_output_load_multiple (operands); }"
10481 [(set_attr "type" "load_ux")
10482 (set_attr "length" "32")])
10484 (define_insn "*ldmsi7"
10485 [(match_parallel 0 "load_multiple_operation"
10486 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10487 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10488 (set (match_operand:SI 3 "gpc_reg_operand" "")
10489 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10490 (set (match_operand:SI 4 "gpc_reg_operand" "")
10491 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
10492 (set (match_operand:SI 5 "gpc_reg_operand" "")
10493 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
10494 (set (match_operand:SI 6 "gpc_reg_operand" "")
10495 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
10496 (set (match_operand:SI 7 "gpc_reg_operand" "")
10497 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
10498 (set (match_operand:SI 8 "gpc_reg_operand" "")
10499 (mem:SI (plus:SI (match_dup 1) (const_int 24))))])]
10500 "TARGET_STRING && XVECLEN (operands[0], 0) == 7"
10502 { return rs6000_output_load_multiple (operands); }"
10503 [(set_attr "type" "load_ux")
10504 (set_attr "length" "32")])
10506 (define_insn "*ldmsi6"
10507 [(match_parallel 0 "load_multiple_operation"
10508 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10509 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10510 (set (match_operand:SI 3 "gpc_reg_operand" "")
10511 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10512 (set (match_operand:SI 4 "gpc_reg_operand" "")
10513 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
10514 (set (match_operand:SI 5 "gpc_reg_operand" "")
10515 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
10516 (set (match_operand:SI 6 "gpc_reg_operand" "")
10517 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
10518 (set (match_operand:SI 7 "gpc_reg_operand" "")
10519 (mem:SI (plus:SI (match_dup 1) (const_int 20))))])]
10520 "TARGET_STRING && XVECLEN (operands[0], 0) == 6"
10522 { return rs6000_output_load_multiple (operands); }"
10523 [(set_attr "type" "load_ux")
10524 (set_attr "length" "32")])
10526 (define_insn "*ldmsi5"
10527 [(match_parallel 0 "load_multiple_operation"
10528 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10529 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10530 (set (match_operand:SI 3 "gpc_reg_operand" "")
10531 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10532 (set (match_operand:SI 4 "gpc_reg_operand" "")
10533 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
10534 (set (match_operand:SI 5 "gpc_reg_operand" "")
10535 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
10536 (set (match_operand:SI 6 "gpc_reg_operand" "")
10537 (mem:SI (plus:SI (match_dup 1) (const_int 16))))])]
10538 "TARGET_STRING && XVECLEN (operands[0], 0) == 5"
10540 { return rs6000_output_load_multiple (operands); }"
10541 [(set_attr "type" "load_ux")
10542 (set_attr "length" "32")])
10544 (define_insn "*ldmsi4"
10545 [(match_parallel 0 "load_multiple_operation"
10546 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10547 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10548 (set (match_operand:SI 3 "gpc_reg_operand" "")
10549 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10550 (set (match_operand:SI 4 "gpc_reg_operand" "")
10551 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
10552 (set (match_operand:SI 5 "gpc_reg_operand" "")
10553 (mem:SI (plus:SI (match_dup 1) (const_int 12))))])]
10554 "TARGET_STRING && XVECLEN (operands[0], 0) == 4"
10556 { return rs6000_output_load_multiple (operands); }"
10557 [(set_attr "type" "load_ux")
10558 (set_attr "length" "32")])
10560 (define_insn "*ldmsi3"
10561 [(match_parallel 0 "load_multiple_operation"
10562 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10563 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10564 (set (match_operand:SI 3 "gpc_reg_operand" "")
10565 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10566 (set (match_operand:SI 4 "gpc_reg_operand" "")
10567 (mem:SI (plus:SI (match_dup 1) (const_int 8))))])]
10568 "TARGET_STRING && XVECLEN (operands[0], 0) == 3"
10570 { return rs6000_output_load_multiple (operands); }"
10571 [(set_attr "type" "load_ux")
10572 (set_attr "length" "32")])
10574 (define_expand "store_multiple"
10575 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
10576 (match_operand:SI 1 "" ""))
10577 (clobber (scratch:SI))
10578 (use (match_operand:SI 2 "" ""))])]
10579 "TARGET_STRING && !TARGET_POWERPC64"
10588 /* Support only storing a constant number of fixed-point registers to
10589 memory and only bother with this if more than two; the machine
10590 doesn't support more than eight. */
10591 if (GET_CODE (operands[2]) != CONST_INT
10592 || INTVAL (operands[2]) <= 2
10593 || INTVAL (operands[2]) > 8
10594 || GET_CODE (operands[0]) != MEM
10595 || GET_CODE (operands[1]) != REG
10596 || REGNO (operands[1]) >= 32)
10599 count = INTVAL (operands[2]);
10600 regno = REGNO (operands[1]);
10602 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count + 1));
10603 to = force_reg (SImode, XEXP (operands[0], 0));
10604 op0 = replace_equiv_address (operands[0], to);
10606 XVECEXP (operands[3], 0, 0)
10607 = gen_rtx_SET (VOIDmode, adjust_address_nv (op0, SImode, 0), operands[1]);
10608 XVECEXP (operands[3], 0, 1) = gen_rtx_CLOBBER (VOIDmode,
10609 gen_rtx_SCRATCH (SImode));
10611 for (i = 1; i < count; i++)
10612 XVECEXP (operands[3], 0, i + 1)
10613 = gen_rtx_SET (VOIDmode,
10614 adjust_address_nv (op0, SImode, i * 4),
10615 gen_rtx_REG (SImode, regno + i));
10618 (define_insn "*stmsi8"
10619 [(match_parallel 0 "store_multiple_operation"
10620 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10621 (match_operand:SI 2 "gpc_reg_operand" "r"))
10622 (clobber (match_scratch:SI 3 "=X"))
10623 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10624 (match_operand:SI 4 "gpc_reg_operand" "r"))
10625 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10626 (match_operand:SI 5 "gpc_reg_operand" "r"))
10627 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10628 (match_operand:SI 6 "gpc_reg_operand" "r"))
10629 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10630 (match_operand:SI 7 "gpc_reg_operand" "r"))
10631 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10632 (match_operand:SI 8 "gpc_reg_operand" "r"))
10633 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
10634 (match_operand:SI 9 "gpc_reg_operand" "r"))
10635 (set (mem:SI (plus:SI (match_dup 1) (const_int 28)))
10636 (match_operand:SI 10 "gpc_reg_operand" "r"))])]
10637 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 9"
10638 "{stsi|stswi} %2,%1,%O0"
10639 [(set_attr "type" "store_ux")
10640 (set_attr "cell_micro" "always")])
10642 (define_insn "*stmsi7"
10643 [(match_parallel 0 "store_multiple_operation"
10644 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10645 (match_operand:SI 2 "gpc_reg_operand" "r"))
10646 (clobber (match_scratch:SI 3 "=X"))
10647 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10648 (match_operand:SI 4 "gpc_reg_operand" "r"))
10649 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10650 (match_operand:SI 5 "gpc_reg_operand" "r"))
10651 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10652 (match_operand:SI 6 "gpc_reg_operand" "r"))
10653 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10654 (match_operand:SI 7 "gpc_reg_operand" "r"))
10655 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10656 (match_operand:SI 8 "gpc_reg_operand" "r"))
10657 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
10658 (match_operand:SI 9 "gpc_reg_operand" "r"))])]
10659 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 8"
10660 "{stsi|stswi} %2,%1,%O0"
10661 [(set_attr "type" "store_ux")
10662 (set_attr "cell_micro" "always")])
10664 (define_insn "*stmsi6"
10665 [(match_parallel 0 "store_multiple_operation"
10666 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10667 (match_operand:SI 2 "gpc_reg_operand" "r"))
10668 (clobber (match_scratch:SI 3 "=X"))
10669 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10670 (match_operand:SI 4 "gpc_reg_operand" "r"))
10671 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10672 (match_operand:SI 5 "gpc_reg_operand" "r"))
10673 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10674 (match_operand:SI 6 "gpc_reg_operand" "r"))
10675 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10676 (match_operand:SI 7 "gpc_reg_operand" "r"))
10677 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10678 (match_operand:SI 8 "gpc_reg_operand" "r"))])]
10679 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 7"
10680 "{stsi|stswi} %2,%1,%O0"
10681 [(set_attr "type" "store_ux")
10682 (set_attr "cell_micro" "always")])
10684 (define_insn "*stmsi5"
10685 [(match_parallel 0 "store_multiple_operation"
10686 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10687 (match_operand:SI 2 "gpc_reg_operand" "r"))
10688 (clobber (match_scratch:SI 3 "=X"))
10689 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10690 (match_operand:SI 4 "gpc_reg_operand" "r"))
10691 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10692 (match_operand:SI 5 "gpc_reg_operand" "r"))
10693 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10694 (match_operand:SI 6 "gpc_reg_operand" "r"))
10695 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10696 (match_operand:SI 7 "gpc_reg_operand" "r"))])]
10697 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 6"
10698 "{stsi|stswi} %2,%1,%O0"
10699 [(set_attr "type" "store_ux")
10700 (set_attr "cell_micro" "always")])
10702 (define_insn "*stmsi4"
10703 [(match_parallel 0 "store_multiple_operation"
10704 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10705 (match_operand:SI 2 "gpc_reg_operand" "r"))
10706 (clobber (match_scratch:SI 3 "=X"))
10707 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10708 (match_operand:SI 4 "gpc_reg_operand" "r"))
10709 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10710 (match_operand:SI 5 "gpc_reg_operand" "r"))
10711 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10712 (match_operand:SI 6 "gpc_reg_operand" "r"))])]
10713 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 5"
10714 "{stsi|stswi} %2,%1,%O0"
10715 [(set_attr "type" "store_ux")
10716 (set_attr "cell_micro" "always")])
10718 (define_insn "*stmsi3"
10719 [(match_parallel 0 "store_multiple_operation"
10720 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10721 (match_operand:SI 2 "gpc_reg_operand" "r"))
10722 (clobber (match_scratch:SI 3 "=X"))
10723 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10724 (match_operand:SI 4 "gpc_reg_operand" "r"))
10725 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10726 (match_operand:SI 5 "gpc_reg_operand" "r"))])]
10727 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 4"
10728 "{stsi|stswi} %2,%1,%O0"
10729 [(set_attr "type" "store_ux")
10730 (set_attr "cell_micro" "always")])
10732 (define_insn "*stmsi8_power"
10733 [(match_parallel 0 "store_multiple_operation"
10734 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10735 (match_operand:SI 2 "gpc_reg_operand" "r"))
10736 (clobber (match_scratch:SI 3 "=q"))
10737 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10738 (match_operand:SI 4 "gpc_reg_operand" "r"))
10739 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10740 (match_operand:SI 5 "gpc_reg_operand" "r"))
10741 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10742 (match_operand:SI 6 "gpc_reg_operand" "r"))
10743 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10744 (match_operand:SI 7 "gpc_reg_operand" "r"))
10745 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10746 (match_operand:SI 8 "gpc_reg_operand" "r"))
10747 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
10748 (match_operand:SI 9 "gpc_reg_operand" "r"))
10749 (set (mem:SI (plus:SI (match_dup 1) (const_int 28)))
10750 (match_operand:SI 10 "gpc_reg_operand" "r"))])]
10751 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 9"
10752 "{stsi|stswi} %2,%1,%O0"
10753 [(set_attr "type" "store_ux")
10754 (set_attr "cell_micro" "always")])
10756 (define_insn "*stmsi7_power"
10757 [(match_parallel 0 "store_multiple_operation"
10758 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10759 (match_operand:SI 2 "gpc_reg_operand" "r"))
10760 (clobber (match_scratch:SI 3 "=q"))
10761 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10762 (match_operand:SI 4 "gpc_reg_operand" "r"))
10763 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10764 (match_operand:SI 5 "gpc_reg_operand" "r"))
10765 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10766 (match_operand:SI 6 "gpc_reg_operand" "r"))
10767 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10768 (match_operand:SI 7 "gpc_reg_operand" "r"))
10769 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10770 (match_operand:SI 8 "gpc_reg_operand" "r"))
10771 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
10772 (match_operand:SI 9 "gpc_reg_operand" "r"))])]
10773 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 8"
10774 "{stsi|stswi} %2,%1,%O0"
10775 [(set_attr "type" "store_ux")
10776 (set_attr "cell_micro" "always")])
10778 (define_insn "*stmsi6_power"
10779 [(match_parallel 0 "store_multiple_operation"
10780 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10781 (match_operand:SI 2 "gpc_reg_operand" "r"))
10782 (clobber (match_scratch:SI 3 "=q"))
10783 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10784 (match_operand:SI 4 "gpc_reg_operand" "r"))
10785 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10786 (match_operand:SI 5 "gpc_reg_operand" "r"))
10787 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10788 (match_operand:SI 6 "gpc_reg_operand" "r"))
10789 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10790 (match_operand:SI 7 "gpc_reg_operand" "r"))
10791 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10792 (match_operand:SI 8 "gpc_reg_operand" "r"))])]
10793 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 7"
10794 "{stsi|stswi} %2,%1,%O0"
10795 [(set_attr "type" "store_ux")
10796 (set_attr "cell_micro" "always")])
10798 (define_insn "*stmsi5_power"
10799 [(match_parallel 0 "store_multiple_operation"
10800 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10801 (match_operand:SI 2 "gpc_reg_operand" "r"))
10802 (clobber (match_scratch:SI 3 "=q"))
10803 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10804 (match_operand:SI 4 "gpc_reg_operand" "r"))
10805 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10806 (match_operand:SI 5 "gpc_reg_operand" "r"))
10807 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10808 (match_operand:SI 6 "gpc_reg_operand" "r"))
10809 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10810 (match_operand:SI 7 "gpc_reg_operand" "r"))])]
10811 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 6"
10812 "{stsi|stswi} %2,%1,%O0"
10813 [(set_attr "type" "store_ux")
10814 (set_attr "cell_micro" "always")])
10816 (define_insn "*stmsi4_power"
10817 [(match_parallel 0 "store_multiple_operation"
10818 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10819 (match_operand:SI 2 "gpc_reg_operand" "r"))
10820 (clobber (match_scratch:SI 3 "=q"))
10821 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10822 (match_operand:SI 4 "gpc_reg_operand" "r"))
10823 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10824 (match_operand:SI 5 "gpc_reg_operand" "r"))
10825 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10826 (match_operand:SI 6 "gpc_reg_operand" "r"))])]
10827 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 5"
10828 "{stsi|stswi} %2,%1,%O0"
10829 [(set_attr "type" "store_ux")
10830 (set_attr "cell_micro" "always")])
10832 (define_insn "*stmsi3_power"
10833 [(match_parallel 0 "store_multiple_operation"
10834 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10835 (match_operand:SI 2 "gpc_reg_operand" "r"))
10836 (clobber (match_scratch:SI 3 "=q"))
10837 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10838 (match_operand:SI 4 "gpc_reg_operand" "r"))
10839 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10840 (match_operand:SI 5 "gpc_reg_operand" "r"))])]
10841 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 4"
10842 "{stsi|stswi} %2,%1,%O0"
10843 [(set_attr "type" "store_ux")
10844 (set_attr "cell_micro" "always")])
10846 (define_expand "setmemsi"
10847 [(parallel [(set (match_operand:BLK 0 "" "")
10848 (match_operand 2 "const_int_operand" ""))
10849 (use (match_operand:SI 1 "" ""))
10850 (use (match_operand:SI 3 "" ""))])]
10854 /* If value to set is not zero, use the library routine. */
10855 if (operands[2] != const0_rtx)
10858 if (expand_block_clear (operands))
10864 ;; String/block move insn.
10865 ;; Argument 0 is the destination
10866 ;; Argument 1 is the source
10867 ;; Argument 2 is the length
10868 ;; Argument 3 is the alignment
10870 (define_expand "movmemsi"
10871 [(parallel [(set (match_operand:BLK 0 "" "")
10872 (match_operand:BLK 1 "" ""))
10873 (use (match_operand:SI 2 "" ""))
10874 (use (match_operand:SI 3 "" ""))])]
10878 if (expand_block_move (operands))
10884 ;; Move up to 32 bytes at a time. The fixed registers are needed because the
10885 ;; register allocator doesn't have a clue about allocating 8 word registers.
10886 ;; rD/rS = r5 is preferred, efficient form.
10887 (define_expand "movmemsi_8reg"
10888 [(parallel [(set (match_operand 0 "" "")
10889 (match_operand 1 "" ""))
10890 (use (match_operand 2 "" ""))
10891 (use (match_operand 3 "" ""))
10892 (clobber (reg:SI 5))
10893 (clobber (reg:SI 6))
10894 (clobber (reg:SI 7))
10895 (clobber (reg:SI 8))
10896 (clobber (reg:SI 9))
10897 (clobber (reg:SI 10))
10898 (clobber (reg:SI 11))
10899 (clobber (reg:SI 12))
10900 (clobber (match_scratch:SI 4 ""))])]
10905 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
10906 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
10907 (use (match_operand:SI 2 "immediate_operand" "i"))
10908 (use (match_operand:SI 3 "immediate_operand" "i"))
10909 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10910 (clobber (reg:SI 6))
10911 (clobber (reg:SI 7))
10912 (clobber (reg:SI 8))
10913 (clobber (reg:SI 9))
10914 (clobber (reg:SI 10))
10915 (clobber (reg:SI 11))
10916 (clobber (reg:SI 12))
10917 (clobber (match_scratch:SI 5 "=q"))]
10918 "TARGET_STRING && TARGET_POWER
10919 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
10920 || INTVAL (operands[2]) == 0)
10921 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
10922 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
10923 && REGNO (operands[4]) == 5"
10924 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10925 [(set_attr "type" "store_ux")
10926 (set_attr "cell_micro" "always")
10927 (set_attr "length" "8")])
10930 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
10931 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
10932 (use (match_operand:SI 2 "immediate_operand" "i"))
10933 (use (match_operand:SI 3 "immediate_operand" "i"))
10934 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10935 (clobber (reg:SI 6))
10936 (clobber (reg:SI 7))
10937 (clobber (reg:SI 8))
10938 (clobber (reg:SI 9))
10939 (clobber (reg:SI 10))
10940 (clobber (reg:SI 11))
10941 (clobber (reg:SI 12))
10942 (clobber (match_scratch:SI 5 "=X"))]
10943 "TARGET_STRING && ! TARGET_POWER
10944 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
10945 || INTVAL (operands[2]) == 0)
10946 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
10947 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
10948 && REGNO (operands[4]) == 5"
10949 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10950 [(set_attr "type" "store_ux")
10951 (set_attr "cell_micro" "always")
10952 (set_attr "length" "8")])
10954 ;; Move up to 24 bytes at a time. The fixed registers are needed because the
10955 ;; register allocator doesn't have a clue about allocating 6 word registers.
10956 ;; rD/rS = r5 is preferred, efficient form.
10957 (define_expand "movmemsi_6reg"
10958 [(parallel [(set (match_operand 0 "" "")
10959 (match_operand 1 "" ""))
10960 (use (match_operand 2 "" ""))
10961 (use (match_operand 3 "" ""))
10962 (clobber (reg:SI 5))
10963 (clobber (reg:SI 6))
10964 (clobber (reg:SI 7))
10965 (clobber (reg:SI 8))
10966 (clobber (reg:SI 9))
10967 (clobber (reg:SI 10))
10968 (clobber (match_scratch:SI 4 ""))])]
10973 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
10974 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
10975 (use (match_operand:SI 2 "immediate_operand" "i"))
10976 (use (match_operand:SI 3 "immediate_operand" "i"))
10977 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10978 (clobber (reg:SI 6))
10979 (clobber (reg:SI 7))
10980 (clobber (reg:SI 8))
10981 (clobber (reg:SI 9))
10982 (clobber (reg:SI 10))
10983 (clobber (match_scratch:SI 5 "=q"))]
10984 "TARGET_STRING && TARGET_POWER
10985 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 24
10986 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
10987 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
10988 && REGNO (operands[4]) == 5"
10989 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10990 [(set_attr "type" "store_ux")
10991 (set_attr "cell_micro" "always")
10992 (set_attr "length" "8")])
10995 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
10996 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
10997 (use (match_operand:SI 2 "immediate_operand" "i"))
10998 (use (match_operand:SI 3 "immediate_operand" "i"))
10999 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
11000 (clobber (reg:SI 6))
11001 (clobber (reg:SI 7))
11002 (clobber (reg:SI 8))
11003 (clobber (reg:SI 9))
11004 (clobber (reg:SI 10))
11005 (clobber (match_scratch:SI 5 "=X"))]
11006 "TARGET_STRING && ! TARGET_POWER
11007 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
11008 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
11009 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
11010 && REGNO (operands[4]) == 5"
11011 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
11012 [(set_attr "type" "store_ux")
11013 (set_attr "cell_micro" "always")
11014 (set_attr "length" "8")])
11016 ;; Move up to 16 bytes at a time, using 4 fixed registers to avoid spill
11017 ;; problems with TImode.
11018 ;; rD/rS = r5 is preferred, efficient form.
11019 (define_expand "movmemsi_4reg"
11020 [(parallel [(set (match_operand 0 "" "")
11021 (match_operand 1 "" ""))
11022 (use (match_operand 2 "" ""))
11023 (use (match_operand 3 "" ""))
11024 (clobber (reg:SI 5))
11025 (clobber (reg:SI 6))
11026 (clobber (reg:SI 7))
11027 (clobber (reg:SI 8))
11028 (clobber (match_scratch:SI 4 ""))])]
11033 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
11034 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
11035 (use (match_operand:SI 2 "immediate_operand" "i"))
11036 (use (match_operand:SI 3 "immediate_operand" "i"))
11037 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
11038 (clobber (reg:SI 6))
11039 (clobber (reg:SI 7))
11040 (clobber (reg:SI 8))
11041 (clobber (match_scratch:SI 5 "=q"))]
11042 "TARGET_STRING && TARGET_POWER
11043 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
11044 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
11045 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
11046 && REGNO (operands[4]) == 5"
11047 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
11048 [(set_attr "type" "store_ux")
11049 (set_attr "cell_micro" "always")
11050 (set_attr "length" "8")])
11053 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
11054 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
11055 (use (match_operand:SI 2 "immediate_operand" "i"))
11056 (use (match_operand:SI 3 "immediate_operand" "i"))
11057 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
11058 (clobber (reg:SI 6))
11059 (clobber (reg:SI 7))
11060 (clobber (reg:SI 8))
11061 (clobber (match_scratch:SI 5 "=X"))]
11062 "TARGET_STRING && ! TARGET_POWER
11063 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
11064 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
11065 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
11066 && REGNO (operands[4]) == 5"
11067 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
11068 [(set_attr "type" "store_ux")
11069 (set_attr "cell_micro" "always")
11070 (set_attr "length" "8")])
11072 ;; Move up to 8 bytes at a time.
11073 (define_expand "movmemsi_2reg"
11074 [(parallel [(set (match_operand 0 "" "")
11075 (match_operand 1 "" ""))
11076 (use (match_operand 2 "" ""))
11077 (use (match_operand 3 "" ""))
11078 (clobber (match_scratch:DI 4 ""))
11079 (clobber (match_scratch:SI 5 ""))])]
11080 "TARGET_STRING && ! TARGET_POWERPC64"
11084 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
11085 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
11086 (use (match_operand:SI 2 "immediate_operand" "i"))
11087 (use (match_operand:SI 3 "immediate_operand" "i"))
11088 (clobber (match_scratch:DI 4 "=&r"))
11089 (clobber (match_scratch:SI 5 "=q"))]
11090 "TARGET_STRING && TARGET_POWER && ! TARGET_POWERPC64
11091 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
11092 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
11093 [(set_attr "type" "store_ux")
11094 (set_attr "cell_micro" "always")
11095 (set_attr "length" "8")])
11098 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
11099 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
11100 (use (match_operand:SI 2 "immediate_operand" "i"))
11101 (use (match_operand:SI 3 "immediate_operand" "i"))
11102 (clobber (match_scratch:DI 4 "=&r"))
11103 (clobber (match_scratch:SI 5 "=X"))]
11104 "TARGET_STRING && ! TARGET_POWER && ! TARGET_POWERPC64
11105 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
11106 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
11107 [(set_attr "type" "store_ux")
11108 (set_attr "cell_micro" "always")
11109 (set_attr "length" "8")])
11111 ;; Move up to 4 bytes at a time.
11112 (define_expand "movmemsi_1reg"
11113 [(parallel [(set (match_operand 0 "" "")
11114 (match_operand 1 "" ""))
11115 (use (match_operand 2 "" ""))
11116 (use (match_operand 3 "" ""))
11117 (clobber (match_scratch:SI 4 ""))
11118 (clobber (match_scratch:SI 5 ""))])]
11123 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
11124 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
11125 (use (match_operand:SI 2 "immediate_operand" "i"))
11126 (use (match_operand:SI 3 "immediate_operand" "i"))
11127 (clobber (match_scratch:SI 4 "=&r"))
11128 (clobber (match_scratch:SI 5 "=q"))]
11129 "TARGET_STRING && TARGET_POWER
11130 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
11131 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
11132 [(set_attr "type" "store_ux")
11133 (set_attr "cell_micro" "always")
11134 (set_attr "length" "8")])
11137 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
11138 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
11139 (use (match_operand:SI 2 "immediate_operand" "i"))
11140 (use (match_operand:SI 3 "immediate_operand" "i"))
11141 (clobber (match_scratch:SI 4 "=&r"))
11142 (clobber (match_scratch:SI 5 "=X"))]
11143 "TARGET_STRING && ! TARGET_POWER
11144 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
11145 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
11146 [(set_attr "type" "store_ux")
11147 (set_attr "cell_micro" "always")
11148 (set_attr "length" "8")])
11150 ;; Define insns that do load or store with update. Some of these we can
11151 ;; get by using pre-decrement or pre-increment, but the hardware can also
11152 ;; do cases where the increment is not the size of the object.
11154 ;; In all these cases, we use operands 0 and 1 for the register being
11155 ;; incremented because those are the operands that local-alloc will
11156 ;; tie and these are the pair most likely to be tieable (and the ones
11157 ;; that will benefit the most).
11159 (define_insn "*movdi_update1"
11160 [(set (match_operand:DI 3 "gpc_reg_operand" "=r,r")
11161 (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
11162 (match_operand:DI 2 "reg_or_aligned_short_operand" "r,I"))))
11163 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
11164 (plus:DI (match_dup 1) (match_dup 2)))]
11165 "TARGET_POWERPC64 && TARGET_UPDATE
11166 && (!avoiding_indexed_address_p (DImode)
11167 || !gpc_reg_operand (operands[2], DImode))"
11171 [(set_attr "type" "load_ux,load_u")])
11173 (define_insn "movdi_<mode>_update"
11174 [(set (mem:DI (plus:P (match_operand:P 1 "gpc_reg_operand" "0,0")
11175 (match_operand:P 2 "reg_or_aligned_short_operand" "r,I")))
11176 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
11177 (set (match_operand:P 0 "gpc_reg_operand" "=b,b")
11178 (plus:P (match_dup 1) (match_dup 2)))]
11179 "TARGET_POWERPC64 && TARGET_UPDATE
11180 && (!avoiding_indexed_address_p (Pmode)
11181 || !gpc_reg_operand (operands[2], Pmode)
11182 || (REG_P (operands[0])
11183 && REGNO (operands[0]) == STACK_POINTER_REGNUM))"
11187 [(set_attr "type" "store_ux,store_u")])
11189 ;; This pattern is only conditional on TARGET_POWERPC64, as it is
11190 ;; needed for stack allocation, even if the user passes -mno-update.
11191 (define_insn "movdi_<mode>_update_stack"
11192 [(set (mem:DI (plus:P (match_operand:P 1 "gpc_reg_operand" "0,0")
11193 (match_operand:P 2 "reg_or_aligned_short_operand" "r,I")))
11194 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
11195 (set (match_operand:P 0 "gpc_reg_operand" "=b,b")
11196 (plus:P (match_dup 1) (match_dup 2)))]
11201 [(set_attr "type" "store_ux,store_u")])
11203 (define_insn "*movsi_update1"
11204 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
11205 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11206 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
11207 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11208 (plus:SI (match_dup 1) (match_dup 2)))]
11210 && (!avoiding_indexed_address_p (SImode)
11211 || !gpc_reg_operand (operands[2], SImode))"
11213 {lux|lwzux} %3,%0,%2
11214 {lu|lwzu} %3,%2(%0)"
11215 [(set_attr "type" "load_ux,load_u")])
11217 (define_insn "*movsi_update2"
11218 [(set (match_operand:DI 3 "gpc_reg_operand" "=r")
11220 (mem:SI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0")
11221 (match_operand:DI 2 "gpc_reg_operand" "r")))))
11222 (set (match_operand:DI 0 "gpc_reg_operand" "=b")
11223 (plus:DI (match_dup 1) (match_dup 2)))]
11224 "TARGET_POWERPC64 && rs6000_gen_cell_microcode
11225 && !avoiding_indexed_address_p (DImode)"
11227 [(set_attr "type" "load_ext_ux")])
11229 (define_insn "movsi_update"
11230 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11231 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
11232 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
11233 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11234 (plus:SI (match_dup 1) (match_dup 2)))]
11236 && (!avoiding_indexed_address_p (SImode)
11237 || !gpc_reg_operand (operands[2], SImode)
11238 || (REG_P (operands[0])
11239 && REGNO (operands[0]) == STACK_POINTER_REGNUM))"
11241 {stux|stwux} %3,%0,%2
11242 {stu|stwu} %3,%2(%0)"
11243 [(set_attr "type" "store_ux,store_u")])
11245 ;; This is an unconditional pattern; needed for stack allocation, even
11246 ;; if the user passes -mno-update.
11247 (define_insn "movsi_update_stack"
11248 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11249 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
11250 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
11251 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11252 (plus:SI (match_dup 1) (match_dup 2)))]
11255 {stux|stwux} %3,%0,%2
11256 {stu|stwu} %3,%2(%0)"
11257 [(set_attr "type" "store_ux,store_u")])
11259 (define_insn "*movhi_update1"
11260 [(set (match_operand:HI 3 "gpc_reg_operand" "=r,r")
11261 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11262 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
11263 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11264 (plus:SI (match_dup 1) (match_dup 2)))]
11266 && (!avoiding_indexed_address_p (SImode)
11267 || !gpc_reg_operand (operands[2], SImode))"
11271 [(set_attr "type" "load_ux,load_u")])
11273 (define_insn "*movhi_update2"
11274 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
11276 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11277 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
11278 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11279 (plus:SI (match_dup 1) (match_dup 2)))]
11281 && (!avoiding_indexed_address_p (SImode)
11282 || !gpc_reg_operand (operands[2], SImode))"
11286 [(set_attr "type" "load_ux,load_u")])
11288 (define_insn "*movhi_update3"
11289 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
11291 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11292 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
11293 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11294 (plus:SI (match_dup 1) (match_dup 2)))]
11295 "TARGET_UPDATE && rs6000_gen_cell_microcode
11296 && (!avoiding_indexed_address_p (SImode)
11297 || !gpc_reg_operand (operands[2], SImode))"
11301 [(set_attr "type" "load_ext_ux,load_ext_u")])
11303 (define_insn "*movhi_update4"
11304 [(set (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11305 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
11306 (match_operand:HI 3 "gpc_reg_operand" "r,r"))
11307 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11308 (plus:SI (match_dup 1) (match_dup 2)))]
11310 && (!avoiding_indexed_address_p (SImode)
11311 || !gpc_reg_operand (operands[2], SImode))"
11315 [(set_attr "type" "store_ux,store_u")])
11317 (define_insn "*movqi_update1"
11318 [(set (match_operand:QI 3 "gpc_reg_operand" "=r,r")
11319 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11320 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
11321 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11322 (plus:SI (match_dup 1) (match_dup 2)))]
11324 && (!avoiding_indexed_address_p (SImode)
11325 || !gpc_reg_operand (operands[2], SImode))"
11329 [(set_attr "type" "load_ux,load_u")])
11331 (define_insn "*movqi_update2"
11332 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
11334 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11335 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
11336 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11337 (plus:SI (match_dup 1) (match_dup 2)))]
11339 && (!avoiding_indexed_address_p (SImode)
11340 || !gpc_reg_operand (operands[2], SImode))"
11344 [(set_attr "type" "load_ux,load_u")])
11346 (define_insn "*movqi_update3"
11347 [(set (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11348 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
11349 (match_operand:QI 3 "gpc_reg_operand" "r,r"))
11350 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11351 (plus:SI (match_dup 1) (match_dup 2)))]
11353 && (!avoiding_indexed_address_p (SImode)
11354 || !gpc_reg_operand (operands[2], SImode))"
11358 [(set_attr "type" "store_ux,store_u")])
11360 (define_insn "*movsf_update1"
11361 [(set (match_operand:SF 3 "gpc_reg_operand" "=f,f")
11362 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11363 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
11364 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11365 (plus:SI (match_dup 1) (match_dup 2)))]
11366 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT && TARGET_UPDATE
11367 && (!avoiding_indexed_address_p (SImode)
11368 || !gpc_reg_operand (operands[2], SImode))"
11372 [(set_attr "type" "fpload_ux,fpload_u")])
11374 (define_insn "*movsf_update2"
11375 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11376 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
11377 (match_operand:SF 3 "gpc_reg_operand" "f,f"))
11378 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11379 (plus:SI (match_dup 1) (match_dup 2)))]
11380 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT && TARGET_UPDATE
11381 && (!avoiding_indexed_address_p (SImode)
11382 || !gpc_reg_operand (operands[2], SImode))"
11386 [(set_attr "type" "fpstore_ux,fpstore_u")])
11388 (define_insn "*movsf_update3"
11389 [(set (match_operand:SF 3 "gpc_reg_operand" "=r,r")
11390 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11391 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
11392 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11393 (plus:SI (match_dup 1) (match_dup 2)))]
11394 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE
11395 && (!avoiding_indexed_address_p (SImode)
11396 || !gpc_reg_operand (operands[2], SImode))"
11398 {lux|lwzux} %3,%0,%2
11399 {lu|lwzu} %3,%2(%0)"
11400 [(set_attr "type" "load_ux,load_u")])
11402 (define_insn "*movsf_update4"
11403 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11404 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
11405 (match_operand:SF 3 "gpc_reg_operand" "r,r"))
11406 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11407 (plus:SI (match_dup 1) (match_dup 2)))]
11408 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE
11409 && (!avoiding_indexed_address_p (SImode)
11410 || !gpc_reg_operand (operands[2], SImode))"
11412 {stux|stwux} %3,%0,%2
11413 {stu|stwu} %3,%2(%0)"
11414 [(set_attr "type" "store_ux,store_u")])
11416 (define_insn "*movdf_update1"
11417 [(set (match_operand:DF 3 "gpc_reg_operand" "=d,d")
11418 (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11419 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
11420 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11421 (plus:SI (match_dup 1) (match_dup 2)))]
11422 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_UPDATE
11423 && (!avoiding_indexed_address_p (SImode)
11424 || !gpc_reg_operand (operands[2], SImode))"
11428 [(set_attr "type" "fpload_ux,fpload_u")])
11430 (define_insn "*movdf_update2"
11431 [(set (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11432 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
11433 (match_operand:DF 3 "gpc_reg_operand" "d,d"))
11434 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11435 (plus:SI (match_dup 1) (match_dup 2)))]
11436 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_UPDATE
11437 && (!avoiding_indexed_address_p (SImode)
11438 || !gpc_reg_operand (operands[2], SImode))"
11442 [(set_attr "type" "fpstore_ux,fpstore_u")])
11444 ;; Peephole to convert two consecutive FP loads or stores into lfq/stfq.
11446 (define_insn "*lfq_power2"
11447 [(set (match_operand:V2DF 0 "gpc_reg_operand" "=f")
11448 (match_operand:V2DF 1 "memory_operand" ""))]
11450 && TARGET_HARD_FLOAT && TARGET_FPRS"
11454 [(set (match_operand:DF 0 "gpc_reg_operand" "")
11455 (match_operand:DF 1 "memory_operand" ""))
11456 (set (match_operand:DF 2 "gpc_reg_operand" "")
11457 (match_operand:DF 3 "memory_operand" ""))]
11459 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
11460 && registers_ok_for_quad_peep (operands[0], operands[2])
11461 && mems_ok_for_quad_peep (operands[1], operands[3])"
11462 [(set (match_dup 0)
11464 "operands[1] = widen_memory_access (operands[1], V2DFmode, 0);
11465 operands[0] = gen_rtx_REG (V2DFmode, REGNO (operands[0]));")
11467 (define_insn "*stfq_power2"
11468 [(set (match_operand:V2DF 0 "memory_operand" "")
11469 (match_operand:V2DF 1 "gpc_reg_operand" "f"))]
11471 && TARGET_HARD_FLOAT && TARGET_FPRS"
11472 "stfq%U0%X0 %1,%0")
11476 [(set (match_operand:DF 0 "memory_operand" "")
11477 (match_operand:DF 1 "gpc_reg_operand" ""))
11478 (set (match_operand:DF 2 "memory_operand" "")
11479 (match_operand:DF 3 "gpc_reg_operand" ""))]
11481 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
11482 && registers_ok_for_quad_peep (operands[1], operands[3])
11483 && mems_ok_for_quad_peep (operands[0], operands[2])"
11484 [(set (match_dup 0)
11486 "operands[0] = widen_memory_access (operands[0], V2DFmode, 0);
11487 operands[1] = gen_rtx_REG (V2DFmode, REGNO (operands[1]));")
11489 ;; After inserting conditional returns we can sometimes have
11490 ;; unnecessary register moves. Unfortunately we cannot have a
11491 ;; modeless peephole here, because some single SImode sets have early
11492 ;; clobber outputs. Although those sets expand to multi-ppc-insn
11493 ;; sequences, using get_attr_length here will smash the operands
11494 ;; array. Neither is there an early_cobbler_p predicate.
11495 ;; Disallow subregs for E500 so we don't munge frob_di_df_2.
11497 [(set (match_operand:DF 0 "gpc_reg_operand" "")
11498 (match_operand:DF 1 "any_operand" ""))
11499 (set (match_operand:DF 2 "gpc_reg_operand" "")
11501 "!(TARGET_E500_DOUBLE && GET_CODE (operands[2]) == SUBREG)
11502 && peep2_reg_dead_p (2, operands[0])"
11503 [(set (match_dup 2) (match_dup 1))])
11506 [(set (match_operand:SF 0 "gpc_reg_operand" "")
11507 (match_operand:SF 1 "any_operand" ""))
11508 (set (match_operand:SF 2 "gpc_reg_operand" "")
11510 "peep2_reg_dead_p (2, operands[0])"
11511 [(set (match_dup 2) (match_dup 1))])
11516 ;; Mode attributes for different ABIs.
11517 (define_mode_iterator TLSmode [(SI "! TARGET_64BIT") (DI "TARGET_64BIT")])
11518 (define_mode_attr tls_abi_suffix [(SI "32") (DI "64")])
11519 (define_mode_attr tls_sysv_suffix [(SI "si") (DI "di")])
11520 (define_mode_attr tls_insn_suffix [(SI "wz") (DI "d")])
11522 (define_insn_and_split "tls_gd_aix<TLSmode:tls_abi_suffix>"
11523 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11524 (call (mem:TLSmode (match_operand:TLSmode 3 "symbol_ref_operand" "s"))
11525 (match_operand 4 "" "g")))
11526 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11527 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11529 (clobber (reg:SI LR_REGNO))]
11530 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX"
11532 if (TARGET_CMODEL != CMODEL_SMALL)
11533 return "addis %0,%1,%2@got@tlsgd@ha\;addi %0,%0,%2@got@tlsgd@l\;bl %z3\;%.";
11535 return "addi %0,%1,%2@got@tlsgd\;bl %z3\;%.";
11537 "&& TARGET_TLS_MARKERS"
11538 [(set (match_dup 0)
11539 (unspec:TLSmode [(match_dup 1)
11542 (parallel [(set (match_dup 0)
11543 (call (mem:TLSmode (match_dup 3))
11545 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD)
11546 (clobber (reg:SI LR_REGNO))])]
11548 [(set_attr "type" "two")
11549 (set (attr "length")
11550 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
11554 (define_insn_and_split "tls_gd_sysv<TLSmode:tls_sysv_suffix>"
11555 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11556 (call (mem:TLSmode (match_operand:TLSmode 3 "symbol_ref_operand" "s"))
11557 (match_operand 4 "" "g")))
11558 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11559 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11561 (clobber (reg:SI LR_REGNO))]
11562 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4"
11566 if (TARGET_SECURE_PLT && flag_pic == 2)
11567 return "addi %0,%1,%2@got@tlsgd\;bl %z3+32768@plt";
11569 return "addi %0,%1,%2@got@tlsgd\;bl %z3@plt";
11572 return "addi %0,%1,%2@got@tlsgd\;bl %z3";
11574 "&& TARGET_TLS_MARKERS"
11575 [(set (match_dup 0)
11576 (unspec:TLSmode [(match_dup 1)
11579 (parallel [(set (match_dup 0)
11580 (call (mem:TLSmode (match_dup 3))
11582 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD)
11583 (clobber (reg:SI LR_REGNO))])]
11585 [(set_attr "type" "two")
11586 (set_attr "length" "8")])
11588 (define_insn_and_split "*tls_gd<TLSmode:tls_abi_suffix>"
11589 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11590 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11591 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11593 "HAVE_AS_TLS && TARGET_TLS_MARKERS"
11594 "addi %0,%1,%2@got@tlsgd"
11595 "&& TARGET_CMODEL != CMODEL_SMALL"
11596 [(set (match_dup 3)
11598 (plus:TLSmode (match_dup 1)
11600 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD)))))
11602 (lo_sum:TLSmode (match_dup 3)
11603 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD)))]
11606 operands[3] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
11608 [(set (attr "length")
11609 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
11613 (define_insn "*tls_gd_high<TLSmode:tls_abi_suffix>"
11614 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11616 (plus:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11618 (unspec:TLSmode [(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11620 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
11621 "addis %0,%1,%2@got@tlsgd@ha"
11622 [(set_attr "length" "4")])
11624 (define_insn "*tls_gd_low<TLSmode:tls_abi_suffix>"
11625 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11626 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11627 (unspec:TLSmode [(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11629 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
11630 "addi %0,%1,%2@got@tlsgd@l"
11631 [(set_attr "length" "4")])
11633 (define_insn "*tls_gd_call_aix<TLSmode:tls_abi_suffix>"
11634 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11635 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
11636 (match_operand 2 "" "g")))
11637 (unspec:TLSmode [(match_operand:TLSmode 3 "rs6000_tls_symbol_ref" "")]
11639 (clobber (reg:SI LR_REGNO))]
11640 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX && TARGET_TLS_MARKERS"
11641 "bl %z1(%3@tlsgd)\;%."
11642 [(set_attr "type" "branch")
11643 (set_attr "length" "8")])
11645 (define_insn "*tls_gd_call_sysv<TLSmode:tls_abi_suffix>"
11646 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11647 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
11648 (match_operand 2 "" "g")))
11649 (unspec:TLSmode [(match_operand:TLSmode 3 "rs6000_tls_symbol_ref" "")]
11651 (clobber (reg:SI LR_REGNO))]
11652 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4 && TARGET_TLS_MARKERS"
11656 if (TARGET_SECURE_PLT && flag_pic == 2)
11657 return "bl %z1+32768(%3@tlsgd)@plt";
11658 return "bl %z1(%3@tlsgd)@plt";
11660 return "bl %z1(%3@tlsgd)";
11662 [(set_attr "type" "branch")
11663 (set_attr "length" "4")])
11665 (define_insn_and_split "tls_ld_aix<TLSmode:tls_abi_suffix>"
11666 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11667 (call (mem:TLSmode (match_operand:TLSmode 2 "symbol_ref_operand" "s"))
11668 (match_operand 3 "" "g")))
11669 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
11671 (clobber (reg:SI LR_REGNO))]
11672 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX"
11674 if (TARGET_CMODEL != CMODEL_SMALL)
11675 return "addis %0,%1,%&@got@tlsld@ha\;addi %0,%0,%&@got@tlsld@l\;bl %z2\;%.";
11677 return "addi %0,%1,%&@got@tlsld\;bl %z2\;%.";
11679 "&& TARGET_TLS_MARKERS"
11680 [(set (match_dup 0)
11681 (unspec:TLSmode [(match_dup 1)]
11683 (parallel [(set (match_dup 0)
11684 (call (mem:TLSmode (match_dup 2))
11686 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
11687 (clobber (reg:SI LR_REGNO))])]
11689 [(set_attr "type" "two")
11690 (set (attr "length")
11691 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
11695 (define_insn_and_split "tls_ld_sysv<TLSmode:tls_sysv_suffix>"
11696 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11697 (call (mem:TLSmode (match_operand:TLSmode 2 "symbol_ref_operand" "s"))
11698 (match_operand 3 "" "g")))
11699 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
11701 (clobber (reg:SI LR_REGNO))]
11702 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4"
11706 if (TARGET_SECURE_PLT && flag_pic == 2)
11707 return "addi %0,%1,%&@got@tlsld\;bl %z2+32768@plt";
11709 return "addi %0,%1,%&@got@tlsld\;bl %z2@plt";
11712 return "addi %0,%1,%&@got@tlsld\;bl %z2";
11714 "&& TARGET_TLS_MARKERS"
11715 [(set (match_dup 0)
11716 (unspec:TLSmode [(match_dup 1)]
11718 (parallel [(set (match_dup 0)
11719 (call (mem:TLSmode (match_dup 2))
11721 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
11722 (clobber (reg:SI LR_REGNO))])]
11724 [(set_attr "length" "8")])
11726 (define_insn_and_split "*tls_ld<TLSmode:tls_abi_suffix>"
11727 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11728 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
11730 "HAVE_AS_TLS && TARGET_TLS_MARKERS"
11731 "addi %0,%1,%&@got@tlsld"
11732 "&& TARGET_CMODEL != CMODEL_SMALL"
11733 [(set (match_dup 2)
11735 (plus:TLSmode (match_dup 1)
11737 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)))))
11739 (lo_sum:TLSmode (match_dup 2)
11740 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)))]
11743 operands[2] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
11745 [(set (attr "length")
11746 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
11750 (define_insn "*tls_ld_high<TLSmode:tls_abi_suffix>"
11751 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11753 (plus:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11755 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)))))]
11756 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
11757 "addis %0,%1,%&@got@tlsld@ha"
11758 [(set_attr "length" "4")])
11760 (define_insn "*tls_ld_low<TLSmode:tls_abi_suffix>"
11761 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11762 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11763 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)))]
11764 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
11765 "addi %0,%1,%&@got@tlsld@l"
11766 [(set_attr "length" "4")])
11768 (define_insn "*tls_ld_call_aix<TLSmode:tls_abi_suffix>"
11769 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11770 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
11771 (match_operand 2 "" "g")))
11772 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
11773 (clobber (reg:SI LR_REGNO))]
11774 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX && TARGET_TLS_MARKERS"
11775 "bl %z1(%&@tlsld)\;%."
11776 [(set_attr "type" "branch")
11777 (set_attr "length" "8")])
11779 (define_insn "*tls_ld_call_sysv<TLSmode:tls_abi_suffix>"
11780 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11781 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
11782 (match_operand 2 "" "g")))
11783 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
11784 (clobber (reg:SI LR_REGNO))]
11785 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4 && TARGET_TLS_MARKERS"
11789 if (TARGET_SECURE_PLT && flag_pic == 2)
11790 return "bl %z1+32768(%&@tlsld)@plt";
11791 return "bl %z1(%&@tlsld)@plt";
11793 return "bl %z1(%&@tlsld)";
11795 [(set_attr "type" "branch")
11796 (set_attr "length" "4")])
11798 (define_insn "tls_dtprel_<TLSmode:tls_abi_suffix>"
11799 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11800 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11801 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11802 UNSPEC_TLSDTPREL))]
11804 "addi %0,%1,%2@dtprel")
11806 (define_insn "tls_dtprel_ha_<TLSmode:tls_abi_suffix>"
11807 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11808 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11809 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11810 UNSPEC_TLSDTPRELHA))]
11812 "addis %0,%1,%2@dtprel@ha")
11814 (define_insn "tls_dtprel_lo_<TLSmode:tls_abi_suffix>"
11815 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11816 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11817 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11818 UNSPEC_TLSDTPRELLO))]
11820 "addi %0,%1,%2@dtprel@l")
11822 (define_insn_and_split "tls_got_dtprel_<TLSmode:tls_abi_suffix>"
11823 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11824 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11825 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11826 UNSPEC_TLSGOTDTPREL))]
11828 "l<TLSmode:tls_insn_suffix> %0,%2@got@dtprel(%1)"
11829 "&& TARGET_CMODEL != CMODEL_SMALL"
11830 [(set (match_dup 3)
11832 (plus:TLSmode (match_dup 1)
11834 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGOTDTPREL)))))
11836 (lo_sum:TLSmode (match_dup 3)
11837 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGOTDTPREL)))]
11840 operands[3] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
11842 [(set (attr "length")
11843 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
11847 (define_insn "*tls_got_dtprel_high<TLSmode:tls_abi_suffix>"
11848 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11850 (plus:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11852 (unspec:TLSmode [(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11853 UNSPEC_TLSGOTDTPREL)))))]
11854 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
11855 "addis %0,%1,%2@got@dtprel@ha"
11856 [(set_attr "length" "4")])
11858 (define_insn "*tls_got_dtprel_low<TLSmode:tls_abi_suffix>"
11859 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11860 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11861 (unspec:TLSmode [(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11862 UNSPEC_TLSGOTDTPREL)))]
11863 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
11864 "l<TLSmode:tls_insn_suffix> %0,%2@got@dtprel@l(%1)"
11865 [(set_attr "length" "4")])
11867 (define_insn "tls_tprel_<TLSmode:tls_abi_suffix>"
11868 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11869 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11870 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11873 "addi %0,%1,%2@tprel")
11875 (define_insn "tls_tprel_ha_<TLSmode:tls_abi_suffix>"
11876 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11877 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11878 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11879 UNSPEC_TLSTPRELHA))]
11881 "addis %0,%1,%2@tprel@ha")
11883 (define_insn "tls_tprel_lo_<TLSmode:tls_abi_suffix>"
11884 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11885 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11886 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11887 UNSPEC_TLSTPRELLO))]
11889 "addi %0,%1,%2@tprel@l")
11891 ;; "b" output constraint here and on tls_tls input to support linker tls
11892 ;; optimization. The linker may edit the instructions emitted by a
11893 ;; tls_got_tprel/tls_tls pair to addis,addi.
11894 (define_insn_and_split "tls_got_tprel_<TLSmode:tls_abi_suffix>"
11895 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11896 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11897 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11898 UNSPEC_TLSGOTTPREL))]
11900 "l<TLSmode:tls_insn_suffix> %0,%2@got@tprel(%1)"
11901 "&& TARGET_CMODEL != CMODEL_SMALL"
11902 [(set (match_dup 3)
11904 (plus:TLSmode (match_dup 1)
11906 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGOTTPREL)))))
11908 (lo_sum:TLSmode (match_dup 3)
11909 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGOTTPREL)))]
11912 operands[3] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
11914 [(set (attr "length")
11915 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
11919 (define_insn "*tls_got_tprel_high<TLSmode:tls_abi_suffix>"
11920 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11922 (plus:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11924 (unspec:TLSmode [(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11925 UNSPEC_TLSGOTTPREL)))))]
11926 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
11927 "addis %0,%1,%2@got@tprel@ha"
11928 [(set_attr "length" "4")])
11930 (define_insn "*tls_got_tprel_low<TLSmode:tls_abi_suffix>"
11931 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11932 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11933 (unspec:TLSmode [(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11934 UNSPEC_TLSGOTTPREL)))]
11935 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
11936 "l<TLSmode:tls_insn_suffix> %0,%2@got@tprel@l(%1)"
11937 [(set_attr "length" "4")])
11939 (define_insn "tls_tls_<TLSmode:tls_abi_suffix>"
11940 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11941 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11942 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11945 "add %0,%1,%2@tls")
11947 ;; Next come insns related to the calling sequence.
11949 ;; First, an insn to allocate new stack space for dynamic use (e.g., alloca).
11950 ;; We move the back-chain and decrement the stack pointer.
11952 (define_expand "allocate_stack"
11953 [(set (match_operand 0 "gpc_reg_operand" "")
11954 (minus (reg 1) (match_operand 1 "reg_or_short_operand" "")))
11956 (minus (reg 1) (match_dup 1)))]
11959 { rtx chain = gen_reg_rtx (Pmode);
11960 rtx stack_bot = gen_rtx_MEM (Pmode, stack_pointer_rtx);
11962 rtx insn, par, set, mem;
11964 emit_move_insn (chain, stack_bot);
11966 /* Check stack bounds if necessary. */
11967 if (crtl->limit_stack)
11970 available = expand_binop (Pmode, sub_optab,
11971 stack_pointer_rtx, stack_limit_rtx,
11972 NULL_RTX, 1, OPTAB_WIDEN);
11973 emit_insn (gen_cond_trap (LTU, available, operands[1], const0_rtx));
11976 if (GET_CODE (operands[1]) != CONST_INT
11977 || INTVAL (operands[1]) < -32767
11978 || INTVAL (operands[1]) > 32768)
11980 neg_op0 = gen_reg_rtx (Pmode);
11982 emit_insn (gen_negsi2 (neg_op0, operands[1]));
11984 emit_insn (gen_negdi2 (neg_op0, operands[1]));
11987 neg_op0 = GEN_INT (- INTVAL (operands[1]));
11989 insn = emit_insn ((* ((TARGET_32BIT) ? gen_movsi_update_stack
11990 : gen_movdi_di_update_stack))
11991 (stack_pointer_rtx, stack_pointer_rtx, neg_op0,
11993 /* Since we didn't use gen_frame_mem to generate the MEM, grab
11994 it now and set the alias set/attributes. The above gen_*_update
11995 calls will generate a PARALLEL with the MEM set being the first
11997 par = PATTERN (insn);
11998 gcc_assert (GET_CODE (par) == PARALLEL);
11999 set = XVECEXP (par, 0, 0);
12000 gcc_assert (GET_CODE (set) == SET);
12001 mem = SET_DEST (set);
12002 gcc_assert (MEM_P (mem));
12003 MEM_NOTRAP_P (mem) = 1;
12004 set_mem_alias_set (mem, get_frame_alias_set ());
12006 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
12010 ;; These patterns say how to save and restore the stack pointer. We need not
12011 ;; save the stack pointer at function level since we are careful to
12012 ;; preserve the backchain. At block level, we have to restore the backchain
12013 ;; when we restore the stack pointer.
12015 ;; For nonlocal gotos, we must save both the stack pointer and its
12016 ;; backchain and restore both. Note that in the nonlocal case, the
12017 ;; save area is a memory location.
12019 (define_expand "save_stack_function"
12020 [(match_operand 0 "any_operand" "")
12021 (match_operand 1 "any_operand" "")]
12025 (define_expand "restore_stack_function"
12026 [(match_operand 0 "any_operand" "")
12027 (match_operand 1 "any_operand" "")]
12031 ;; Adjust stack pointer (op0) to a new value (op1).
12032 ;; First copy old stack backchain to new location, and ensure that the
12033 ;; scheduler won't reorder the sp assignment before the backchain write.
12034 (define_expand "restore_stack_block"
12035 [(set (match_dup 2) (match_dup 3))
12036 (set (match_dup 4) (match_dup 2))
12037 (set (match_dup 5) (unspec:BLK [(match_dup 5)] UNSPEC_TIE))
12038 (set (match_operand 0 "register_operand" "")
12039 (match_operand 1 "register_operand" ""))]
12043 operands[1] = force_reg (Pmode, operands[1]);
12044 operands[2] = gen_reg_rtx (Pmode);
12045 operands[3] = gen_frame_mem (Pmode, operands[0]);
12046 operands[4] = gen_frame_mem (Pmode, operands[1]);
12047 operands[5] = gen_frame_mem (BLKmode, operands[0]);
12050 (define_expand "save_stack_nonlocal"
12051 [(set (match_dup 3) (match_dup 4))
12052 (set (match_operand 0 "memory_operand" "") (match_dup 3))
12053 (set (match_dup 2) (match_operand 1 "register_operand" ""))]
12057 int units_per_word = (TARGET_32BIT) ? 4 : 8;
12059 /* Copy the backchain to the first word, sp to the second. */
12060 operands[0] = adjust_address_nv (operands[0], Pmode, 0);
12061 operands[2] = adjust_address_nv (operands[0], Pmode, units_per_word);
12062 operands[3] = gen_reg_rtx (Pmode);
12063 operands[4] = gen_frame_mem (Pmode, operands[1]);
12066 (define_expand "restore_stack_nonlocal"
12067 [(set (match_dup 2) (match_operand 1 "memory_operand" ""))
12068 (set (match_dup 3) (match_dup 4))
12069 (set (match_dup 5) (match_dup 2))
12070 (set (match_dup 6) (unspec:BLK [(match_dup 6)] UNSPEC_TIE))
12071 (set (match_operand 0 "register_operand" "") (match_dup 3))]
12075 int units_per_word = (TARGET_32BIT) ? 4 : 8;
12077 /* Restore the backchain from the first word, sp from the second. */
12078 operands[2] = gen_reg_rtx (Pmode);
12079 operands[3] = gen_reg_rtx (Pmode);
12080 operands[1] = adjust_address_nv (operands[1], Pmode, 0);
12081 operands[4] = adjust_address_nv (operands[1], Pmode, units_per_word);
12082 operands[5] = gen_frame_mem (Pmode, operands[3]);
12083 operands[6] = gen_frame_mem (BLKmode, operands[0]);
12086 ;; TOC register handling.
12088 ;; Code to initialize the TOC register...
12090 (define_insn "load_toc_aix_si"
12091 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12092 (unspec:SI [(const_int 0)] UNSPEC_TOC))
12093 (use (reg:SI 2))])]
12094 "DEFAULT_ABI == ABI_AIX && TARGET_32BIT"
12098 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
12099 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
12100 operands[2] = gen_rtx_REG (Pmode, 2);
12101 return \"{l|lwz} %0,%1(%2)\";
12103 [(set_attr "type" "load")])
12105 (define_insn "load_toc_aix_di"
12106 [(parallel [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12107 (unspec:DI [(const_int 0)] UNSPEC_TOC))
12108 (use (reg:DI 2))])]
12109 "DEFAULT_ABI == ABI_AIX && TARGET_64BIT"
12113 #ifdef TARGET_RELOCATABLE
12114 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\",
12115 !TARGET_MINIMAL_TOC || TARGET_RELOCATABLE);
12117 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
12120 strcat (buf, \"@toc\");
12121 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
12122 operands[2] = gen_rtx_REG (Pmode, 2);
12123 return \"ld %0,%1(%2)\";
12125 [(set_attr "type" "load")])
12127 (define_insn "load_toc_v4_pic_si"
12128 [(set (reg:SI LR_REGNO)
12129 (unspec:SI [(const_int 0)] UNSPEC_TOC))]
12130 "DEFAULT_ABI == ABI_V4 && flag_pic == 1 && TARGET_32BIT"
12131 "bl _GLOBAL_OFFSET_TABLE_@local-4"
12132 [(set_attr "type" "branch")
12133 (set_attr "length" "4")])
12135 (define_expand "load_toc_v4_PIC_1"
12136 [(parallel [(set (reg:SI LR_REGNO)
12137 (match_operand:SI 0 "immediate_operand" "s"))
12138 (use (unspec [(match_dup 0)] UNSPEC_TOC))])]
12139 "TARGET_ELF && DEFAULT_ABI != ABI_AIX
12140 && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
12143 (define_insn "load_toc_v4_PIC_1_normal"
12144 [(set (reg:SI LR_REGNO)
12145 (match_operand:SI 0 "immediate_operand" "s"))
12146 (use (unspec [(match_dup 0)] UNSPEC_TOC))]
12147 "!TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI != ABI_AIX
12148 && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
12149 "bcl 20,31,%0\\n%0:"
12150 [(set_attr "type" "branch")
12151 (set_attr "length" "4")])
12153 (define_insn "load_toc_v4_PIC_1_476"
12154 [(set (reg:SI LR_REGNO)
12155 (match_operand:SI 0 "immediate_operand" "s"))
12156 (use (unspec [(match_dup 0)] UNSPEC_TOC))]
12157 "TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI != ABI_AIX
12158 && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
12162 static char templ[32];
12164 get_ppc476_thunk_name (name);
12165 sprintf (templ, \"bl %s\\n%%0:\", name);
12168 [(set_attr "type" "branch")
12169 (set_attr "length" "4")])
12171 (define_expand "load_toc_v4_PIC_1b"
12172 [(parallel [(set (reg:SI LR_REGNO)
12173 (unspec:SI [(match_operand:SI 0 "immediate_operand" "s")
12174 (label_ref (match_operand 1 "" ""))]
12177 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
12180 (define_insn "load_toc_v4_PIC_1b_normal"
12181 [(set (reg:SI LR_REGNO)
12182 (unspec:SI [(match_operand:SI 0 "immediate_operand" "s")
12183 (label_ref (match_operand 1 "" ""))]
12186 "!TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
12187 "bcl 20,31,$+8\;.long %0-$"
12188 [(set_attr "type" "branch")
12189 (set_attr "length" "8")])
12191 (define_insn "load_toc_v4_PIC_1b_476"
12192 [(set (reg:SI LR_REGNO)
12193 (unspec:SI [(match_operand:SI 0 "immediate_operand" "s")
12194 (label_ref (match_operand 1 "" ""))]
12197 "TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
12201 static char templ[32];
12203 get_ppc476_thunk_name (name);
12204 sprintf (templ, \"bl %s\\n\\tb $+8\\n\\t.long %%0-$\", name);
12207 [(set_attr "type" "branch")
12208 (set_attr "length" "16")])
12210 (define_insn "load_toc_v4_PIC_2"
12211 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12212 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
12213 (minus:SI (match_operand:SI 2 "immediate_operand" "s")
12214 (match_operand:SI 3 "immediate_operand" "s")))))]
12215 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
12216 "{l|lwz} %0,%2-%3(%1)"
12217 [(set_attr "type" "load")])
12219 (define_insn "load_toc_v4_PIC_3b"
12220 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12221 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
12223 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
12224 (match_operand:SI 3 "symbol_ref_operand" "s")))))]
12225 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
12226 "{cau|addis} %0,%1,%2-%3@ha")
12228 (define_insn "load_toc_v4_PIC_3c"
12229 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12230 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
12231 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
12232 (match_operand:SI 3 "symbol_ref_operand" "s"))))]
12233 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
12234 "{cal %0,%2-%3@l(%1)|addi %0,%1,%2-%3@l}")
12236 ;; If the TOC is shared over a translation unit, as happens with all
12237 ;; the kinds of PIC that we support, we need to restore the TOC
12238 ;; pointer only when jumping over units of translation.
12239 ;; On Darwin, we need to reload the picbase.
12241 (define_expand "builtin_setjmp_receiver"
12242 [(use (label_ref (match_operand 0 "" "")))]
12243 "(DEFAULT_ABI == ABI_V4 && flag_pic == 1)
12244 || (TARGET_TOC && TARGET_MINIMAL_TOC)
12245 || (DEFAULT_ABI == ABI_DARWIN && flag_pic)"
12249 if (DEFAULT_ABI == ABI_DARWIN)
12251 rtx picrtx = gen_rtx_SYMBOL_REF (Pmode, MACHOPIC_FUNCTION_BASE_NAME);
12252 rtx picreg = gen_rtx_REG (Pmode, RS6000_PIC_OFFSET_TABLE_REGNUM);
12256 crtl->uses_pic_offset_table = 1;
12257 ASM_GENERATE_INTERNAL_LABEL(tmplab, \"LSJR\",
12258 CODE_LABEL_NUMBER (operands[0]));
12259 tmplabrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (tmplab));
12261 emit_insn (gen_load_macho_picbase (tmplabrtx));
12262 emit_move_insn (picreg, gen_rtx_REG (Pmode, LR_REGNO));
12263 emit_insn (gen_macho_correct_pic (picreg, picreg, picrtx, tmplabrtx));
12267 rs6000_emit_load_toc_table (FALSE);
12271 ;; Elf specific ways of loading addresses for non-PIC code.
12272 ;; The output of this could be r0, but we make a very strong
12273 ;; preference for a base register because it will usually
12274 ;; be needed there.
12275 (define_insn "elf_high"
12276 [(set (match_operand:SI 0 "gpc_reg_operand" "=b*r")
12277 (high:SI (match_operand 1 "" "")))]
12278 "TARGET_ELF && ! TARGET_64BIT"
12279 "{liu|lis} %0,%1@ha")
12281 (define_insn "elf_low"
12282 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12283 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,!*r")
12284 (match_operand 2 "" "")))]
12285 "TARGET_ELF && ! TARGET_64BIT"
12287 {cal|la} %0,%2@l(%1)
12288 {ai|addic} %0,%1,%K2")
12290 ;; Largetoc support
12291 (define_insn "largetoc_high"
12292 [(set (match_operand:DI 0 "gpc_reg_operand" "=b")
12294 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "b")
12295 (high:DI (match_operand:DI 2 "" "")))))]
12296 "TARGET_ELF && TARGET_CMODEL != CMODEL_SMALL"
12297 "{cau|addis} %0,%1,%2@ha")
12299 (define_insn "largetoc_low"
12300 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12301 (lo_sum:DI (match_operand:DI 1 "gpc_reg_operand" "b")
12302 (match_operand:DI 2 "" "")))]
12303 "TARGET_ELF && TARGET_CMODEL != CMODEL_SMALL"
12304 "{cal %0,%2@l(%1)|addi %0,%1,%2@l}")
12306 ;; A function pointer under AIX is a pointer to a data area whose first word
12307 ;; contains the actual address of the function, whose second word contains a
12308 ;; pointer to its TOC, and whose third word contains a value to place in the
12309 ;; static chain register (r11). Note that if we load the static chain, our
12310 ;; "trampoline" need not have any executable code.
12312 (define_expand "call_indirect_aix32"
12313 [(set (match_dup 2)
12314 (mem:SI (match_operand:SI 0 "gpc_reg_operand" "")))
12318 (mem:SI (plus:SI (match_dup 0)
12320 (parallel [(call (mem:SI (match_dup 2))
12321 (match_operand 1 "" ""))
12322 (use (match_dup 4))
12323 (set (reg:SI 2) (match_dup 3))
12325 (clobber (reg:SI LR_REGNO))])]
12329 operands[2] = gen_reg_rtx (SImode);
12330 operands[3] = gen_rtx_MEM (SImode,
12331 gen_rtx_PLUS (SImode, stack_pointer_rtx,
12334 operands[4] = gen_rtx_MEM (SImode,
12335 gen_rtx_PLUS (SImode, operands[0],
12338 /* Make sure the compiler does not optimize away the store of the TOC. */
12339 MEM_VOLATILE_P (operands[3]) = 1;
12342 (define_expand "call_indirect_aix64"
12343 [(set (match_dup 2)
12344 (mem:DI (match_operand:DI 0 "gpc_reg_operand" "")))
12348 (mem:DI (plus:DI (match_dup 0)
12350 (parallel [(call (mem:SI (match_dup 2))
12351 (match_operand 1 "" ""))
12352 (use (match_dup 4))
12353 (set (reg:DI 2) (match_dup 3))
12355 (clobber (reg:DI LR_REGNO))])]
12359 operands[2] = gen_reg_rtx (DImode);
12360 operands[3] = gen_rtx_MEM (DImode,
12361 gen_rtx_PLUS (DImode, stack_pointer_rtx,
12364 operands[4] = gen_rtx_MEM (DImode,
12365 gen_rtx_PLUS (DImode, operands[0],
12368 /* Make sure the compiler does not optimize away the store of the TOC. */
12369 MEM_VOLATILE_P (operands[3]) = 1;
12372 (define_expand "call_value_indirect_aix32"
12373 [(set (match_dup 3)
12374 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "")))
12378 (mem:SI (plus:SI (match_dup 1)
12380 (parallel [(set (match_operand 0 "" "")
12381 (call (mem:SI (match_dup 3))
12382 (match_operand 2 "" "")))
12383 (use (match_dup 5))
12384 (set (reg:SI 2) (match_dup 4))
12386 (clobber (reg:SI LR_REGNO))])]
12390 operands[3] = gen_reg_rtx (SImode);
12391 operands[4] = gen_rtx_MEM (SImode,
12392 gen_rtx_PLUS (SImode, stack_pointer_rtx,
12395 operands[5] = gen_rtx_MEM (SImode,
12396 gen_rtx_PLUS (SImode, operands[1],
12399 /* Make sure the compiler does not optimize away the store of the TOC. */
12400 MEM_VOLATILE_P (operands[4]) = 1;
12403 (define_expand "call_value_indirect_aix64"
12404 [(set (match_dup 3)
12405 (mem:DI (match_operand:DI 1 "gpc_reg_operand" "")))
12409 (mem:DI (plus:DI (match_dup 1)
12411 (parallel [(set (match_operand 0 "" "")
12412 (call (mem:SI (match_dup 3))
12413 (match_operand 2 "" "")))
12414 (use (match_dup 5))
12415 (set (reg:DI 2) (match_dup 4))
12417 (clobber (reg:DI LR_REGNO))])]
12421 operands[3] = gen_reg_rtx (DImode);
12422 operands[4] = gen_rtx_MEM (DImode,
12423 gen_rtx_PLUS (DImode, stack_pointer_rtx,
12426 operands[5] = gen_rtx_MEM (DImode,
12427 gen_rtx_PLUS (DImode, operands[1],
12430 /* Make sure the compiler does not optimize away the store of the TOC. */
12431 MEM_VOLATILE_P (operands[4]) = 1;
12434 ;; Now the definitions for the call and call_value insns
12435 (define_expand "call"
12436 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
12437 (match_operand 1 "" ""))
12438 (use (match_operand 2 "" ""))
12439 (clobber (reg:SI LR_REGNO))])]
12444 if (MACHOPIC_INDIRECT)
12445 operands[0] = machopic_indirect_call_target (operands[0]);
12448 gcc_assert (GET_CODE (operands[0]) == MEM);
12449 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
12451 operands[0] = XEXP (operands[0], 0);
12453 if (GET_CODE (operands[0]) != SYMBOL_REF
12454 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[0]))
12455 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[2]) & CALL_LONG) != 0))
12457 if (INTVAL (operands[2]) & CALL_LONG)
12458 operands[0] = rs6000_longcall_ref (operands[0]);
12460 switch (DEFAULT_ABI)
12464 operands[0] = force_reg (Pmode, operands[0]);
12468 /* AIX function pointers are really pointers to a three word
12470 rs6000_call_indirect_aix (NULL_RTX, operands[0], operands[1]);
12474 gcc_unreachable ();
12479 (define_expand "call_value"
12480 [(parallel [(set (match_operand 0 "" "")
12481 (call (mem:SI (match_operand 1 "address_operand" ""))
12482 (match_operand 2 "" "")))
12483 (use (match_operand 3 "" ""))
12484 (clobber (reg:SI LR_REGNO))])]
12489 if (MACHOPIC_INDIRECT)
12490 operands[1] = machopic_indirect_call_target (operands[1]);
12493 gcc_assert (GET_CODE (operands[1]) == MEM);
12494 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
12496 operands[1] = XEXP (operands[1], 0);
12498 if (GET_CODE (operands[1]) != SYMBOL_REF
12499 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[1]))
12500 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[3]) & CALL_LONG) != 0))
12502 if (INTVAL (operands[3]) & CALL_LONG)
12503 operands[1] = rs6000_longcall_ref (operands[1]);
12505 switch (DEFAULT_ABI)
12509 operands[1] = force_reg (Pmode, operands[1]);
12513 /* AIX function pointers are really pointers to a three word
12515 rs6000_call_indirect_aix (operands[0], operands[1], operands[2]);
12519 gcc_unreachable ();
12524 ;; Call to function in current module. No TOC pointer reload needed.
12525 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
12526 ;; either the function was not prototyped, or it was prototyped as a
12527 ;; variable argument function. It is > 0 if FP registers were passed
12528 ;; and < 0 if they were not.
12530 (define_insn "*call_local32"
12531 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
12532 (match_operand 1 "" "g,g"))
12533 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12534 (clobber (reg:SI LR_REGNO))]
12535 "(INTVAL (operands[2]) & CALL_LONG) == 0"
12538 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12539 output_asm_insn (\"crxor 6,6,6\", operands);
12541 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12542 output_asm_insn (\"creqv 6,6,6\", operands);
12544 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
12546 [(set_attr "type" "branch")
12547 (set_attr "length" "4,8")])
12549 (define_insn "*call_local64"
12550 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
12551 (match_operand 1 "" "g,g"))
12552 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12553 (clobber (reg:SI LR_REGNO))]
12554 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
12557 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12558 output_asm_insn (\"crxor 6,6,6\", operands);
12560 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12561 output_asm_insn (\"creqv 6,6,6\", operands);
12563 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
12565 [(set_attr "type" "branch")
12566 (set_attr "length" "4,8")])
12568 (define_insn "*call_value_local32"
12569 [(set (match_operand 0 "" "")
12570 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
12571 (match_operand 2 "" "g,g")))
12572 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12573 (clobber (reg:SI LR_REGNO))]
12574 "(INTVAL (operands[3]) & CALL_LONG) == 0"
12577 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12578 output_asm_insn (\"crxor 6,6,6\", operands);
12580 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12581 output_asm_insn (\"creqv 6,6,6\", operands);
12583 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
12585 [(set_attr "type" "branch")
12586 (set_attr "length" "4,8")])
12589 (define_insn "*call_value_local64"
12590 [(set (match_operand 0 "" "")
12591 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
12592 (match_operand 2 "" "g,g")))
12593 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12594 (clobber (reg:SI LR_REGNO))]
12595 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
12598 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12599 output_asm_insn (\"crxor 6,6,6\", operands);
12601 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12602 output_asm_insn (\"creqv 6,6,6\", operands);
12604 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
12606 [(set_attr "type" "branch")
12607 (set_attr "length" "4,8")])
12609 ;; Call to indirect functions with the AIX abi using a 3 word descriptor.
12610 ;; Operand0 is the addresss of the function to call
12611 ;; Operand1 is the flag for System V.4 for unprototyped or FP registers
12612 ;; Operand2 is the location in the function descriptor to load r2 from
12613 ;; Operand3 is the stack location to hold the current TOC pointer
12615 (define_insn "call_indirect_aix<ptrsize>"
12616 [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l"))
12617 (match_operand 1 "" "g,g"))
12618 (use (match_operand:P 2 "memory_operand" "m,m"))
12619 (set (reg:P TOC_REGNUM) (match_operand:P 3 "memory_operand" "m,m"))
12620 (use (reg:P STATIC_CHAIN_REGNUM))
12621 (clobber (reg:P LR_REGNO))]
12622 "DEFAULT_ABI == ABI_AIX && TARGET_POINTERS_TO_NESTED_FUNCTIONS"
12623 "<ptrload> 2,%2\;b%T0l\;<ptrload> 2,%3"
12624 [(set_attr "type" "jmpreg")
12625 (set_attr "length" "12")])
12627 ;; Like call_indirect_aix<ptrsize>, but no use of the static chain
12628 ;; Operand0 is the addresss of the function to call
12629 ;; Operand1 is the flag for System V.4 for unprototyped or FP registers
12630 ;; Operand2 is the location in the function descriptor to load r2 from
12631 ;; Operand3 is the stack location to hold the current TOC pointer
12633 (define_insn "call_indirect_aix<ptrsize>_nor11"
12634 [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l"))
12635 (match_operand 1 "" "g,g"))
12636 (use (match_operand:P 2 "memory_operand" "m,m"))
12637 (set (reg:P TOC_REGNUM) (match_operand:P 3 "memory_operand" "m,m"))
12638 (clobber (reg:P LR_REGNO))]
12639 "DEFAULT_ABI == ABI_AIX && !TARGET_POINTERS_TO_NESTED_FUNCTIONS"
12640 "<ptrload> 2,%2\;b%T0l\;<ptrload> 2,%3"
12641 [(set_attr "type" "jmpreg")
12642 (set_attr "length" "12")])
12644 ;; Operand0 is the return result of the function
12645 ;; Operand1 is the addresss of the function to call
12646 ;; Operand2 is the flag for System V.4 for unprototyped or FP registers
12647 ;; Operand3 is the location in the function descriptor to load r2 from
12648 ;; Operand4 is the stack location to hold the current TOC pointer
12650 (define_insn "call_value_indirect_aix<ptrsize>"
12651 [(set (match_operand 0 "" "")
12652 (call (mem:SI (match_operand:P 1 "register_operand" "c,*l"))
12653 (match_operand 2 "" "g,g")))
12654 (use (match_operand:P 3 "memory_operand" "m,m"))
12655 (set (reg:P TOC_REGNUM) (match_operand:P 4 "memory_operand" "m,m"))
12656 (use (reg:P STATIC_CHAIN_REGNUM))
12657 (clobber (reg:P LR_REGNO))]
12658 "DEFAULT_ABI == ABI_AIX && TARGET_POINTERS_TO_NESTED_FUNCTIONS"
12659 "<ptrload> 2,%3\;b%T1l\;<ptrload> 2,%4"
12660 [(set_attr "type" "jmpreg")
12661 (set_attr "length" "12")])
12663 ;; Like call_value_indirect_aix<ptrsize>, but no use of the static chain
12664 ;; Operand0 is the return result of the function
12665 ;; Operand1 is the addresss of the function to call
12666 ;; Operand2 is the flag for System V.4 for unprototyped or FP registers
12667 ;; Operand3 is the location in the function descriptor to load r2 from
12668 ;; Operand4 is the stack location to hold the current TOC pointer
12670 (define_insn "call_value_indirect_aix<ptrsize>_nor11"
12671 [(set (match_operand 0 "" "")
12672 (call (mem:SI (match_operand:P 1 "register_operand" "c,*l"))
12673 (match_operand 2 "" "g,g")))
12674 (use (match_operand:P 3 "memory_operand" "m,m"))
12675 (set (reg:P TOC_REGNUM) (match_operand:P 4 "memory_operand" "m,m"))
12676 (clobber (reg:P LR_REGNO))]
12677 "DEFAULT_ABI == ABI_AIX && !TARGET_POINTERS_TO_NESTED_FUNCTIONS"
12678 "<ptrload> 2,%3\;b%T1l\;<ptrload> 2,%4"
12679 [(set_attr "type" "jmpreg")
12680 (set_attr "length" "12")])
12682 ;; Call to function which may be in another module. Restore the TOC
12683 ;; pointer (r2) after the call unless this is System V.
12684 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
12685 ;; either the function was not prototyped, or it was prototyped as a
12686 ;; variable argument function. It is > 0 if FP registers were passed
12687 ;; and < 0 if they were not.
12689 (define_insn "*call_nonlocal_aix32"
12690 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
12691 (match_operand 1 "" "g"))
12692 (use (match_operand:SI 2 "immediate_operand" "O"))
12693 (clobber (reg:SI LR_REGNO))]
12695 && DEFAULT_ABI == ABI_AIX
12696 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12698 [(set_attr "type" "branch")
12699 (set_attr "length" "8")])
12701 (define_insn "*call_nonlocal_aix64"
12702 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
12703 (match_operand 1 "" "g"))
12704 (use (match_operand:SI 2 "immediate_operand" "O"))
12705 (clobber (reg:SI LR_REGNO))]
12707 && DEFAULT_ABI == ABI_AIX
12708 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12710 [(set_attr "type" "branch")
12711 (set_attr "length" "8")])
12713 (define_insn "*call_value_nonlocal_aix32"
12714 [(set (match_operand 0 "" "")
12715 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
12716 (match_operand 2 "" "g")))
12717 (use (match_operand:SI 3 "immediate_operand" "O"))
12718 (clobber (reg:SI LR_REGNO))]
12720 && DEFAULT_ABI == ABI_AIX
12721 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12723 [(set_attr "type" "branch")
12724 (set_attr "length" "8")])
12726 (define_insn "*call_value_nonlocal_aix64"
12727 [(set (match_operand 0 "" "")
12728 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
12729 (match_operand 2 "" "g")))
12730 (use (match_operand:SI 3 "immediate_operand" "O"))
12731 (clobber (reg:SI LR_REGNO))]
12733 && DEFAULT_ABI == ABI_AIX
12734 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12736 [(set_attr "type" "branch")
12737 (set_attr "length" "8")])
12739 ;; A function pointer under System V is just a normal pointer
12740 ;; operands[0] is the function pointer
12741 ;; operands[1] is the stack size to clean up
12742 ;; operands[2] is the value FUNCTION_ARG returns for the VOID argument
12743 ;; which indicates how to set cr1
12745 (define_insn "*call_indirect_nonlocal_sysv<mode>"
12746 [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l,c,*l"))
12747 (match_operand 1 "" "g,g,g,g"))
12748 (use (match_operand:SI 2 "immediate_operand" "O,O,n,n"))
12749 (clobber (reg:SI LR_REGNO))]
12750 "DEFAULT_ABI == ABI_V4
12751 || DEFAULT_ABI == ABI_DARWIN"
12753 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12754 output_asm_insn ("crxor 6,6,6", operands);
12756 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12757 output_asm_insn ("creqv 6,6,6", operands);
12761 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
12762 (set_attr "length" "4,4,8,8")])
12764 (define_insn_and_split "*call_nonlocal_sysv<mode>"
12765 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
12766 (match_operand 1 "" "g,g"))
12767 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12768 (clobber (reg:SI LR_REGNO))]
12769 "(DEFAULT_ABI == ABI_DARWIN
12770 || (DEFAULT_ABI == ABI_V4
12771 && (INTVAL (operands[2]) & CALL_LONG) == 0))"
12773 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12774 output_asm_insn ("crxor 6,6,6", operands);
12776 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12777 output_asm_insn ("creqv 6,6,6", operands);
12780 return output_call(insn, operands, 0, 2);
12782 if (DEFAULT_ABI == ABI_V4 && flag_pic)
12784 gcc_assert (!TARGET_SECURE_PLT);
12785 return "bl %z0@plt";
12791 "DEFAULT_ABI == ABI_V4
12792 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[0])
12793 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12794 [(parallel [(call (mem:SI (match_dup 0))
12796 (use (match_dup 2))
12797 (use (match_dup 3))
12798 (clobber (reg:SI LR_REGNO))])]
12800 operands[3] = pic_offset_table_rtx;
12802 [(set_attr "type" "branch,branch")
12803 (set_attr "length" "4,8")])
12805 (define_insn "*call_nonlocal_sysv_secure<mode>"
12806 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
12807 (match_operand 1 "" "g,g"))
12808 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12809 (use (match_operand:SI 3 "register_operand" "r,r"))
12810 (clobber (reg:SI LR_REGNO))]
12811 "(DEFAULT_ABI == ABI_V4
12812 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[0])
12813 && (INTVAL (operands[2]) & CALL_LONG) == 0)"
12815 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12816 output_asm_insn ("crxor 6,6,6", operands);
12818 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12819 output_asm_insn ("creqv 6,6,6", operands);
12822 /* The magic 32768 offset here and in the other sysv call insns
12823 corresponds to the offset of r30 in .got2, as given by LCTOC1.
12824 See sysv4.h:toc_section. */
12825 return "bl %z0+32768@plt";
12827 return "bl %z0@plt";
12829 [(set_attr "type" "branch,branch")
12830 (set_attr "length" "4,8")])
12832 (define_insn "*call_value_indirect_nonlocal_sysv<mode>"
12833 [(set (match_operand 0 "" "")
12834 (call (mem:SI (match_operand:P 1 "register_operand" "c,*l,c,*l"))
12835 (match_operand 2 "" "g,g,g,g")))
12836 (use (match_operand:SI 3 "immediate_operand" "O,O,n,n"))
12837 (clobber (reg:SI LR_REGNO))]
12838 "DEFAULT_ABI == ABI_V4
12839 || DEFAULT_ABI == ABI_DARWIN"
12841 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12842 output_asm_insn ("crxor 6,6,6", operands);
12844 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12845 output_asm_insn ("creqv 6,6,6", operands);
12849 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
12850 (set_attr "length" "4,4,8,8")])
12852 (define_insn_and_split "*call_value_nonlocal_sysv<mode>"
12853 [(set (match_operand 0 "" "")
12854 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
12855 (match_operand 2 "" "g,g")))
12856 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12857 (clobber (reg:SI LR_REGNO))]
12858 "(DEFAULT_ABI == ABI_DARWIN
12859 || (DEFAULT_ABI == ABI_V4
12860 && (INTVAL (operands[3]) & CALL_LONG) == 0))"
12862 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12863 output_asm_insn ("crxor 6,6,6", operands);
12865 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12866 output_asm_insn ("creqv 6,6,6", operands);
12869 return output_call(insn, operands, 1, 3);
12871 if (DEFAULT_ABI == ABI_V4 && flag_pic)
12873 gcc_assert (!TARGET_SECURE_PLT);
12874 return "bl %z1@plt";
12880 "DEFAULT_ABI == ABI_V4
12881 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[1])
12882 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12883 [(parallel [(set (match_dup 0)
12884 (call (mem:SI (match_dup 1))
12886 (use (match_dup 3))
12887 (use (match_dup 4))
12888 (clobber (reg:SI LR_REGNO))])]
12890 operands[4] = pic_offset_table_rtx;
12892 [(set_attr "type" "branch,branch")
12893 (set_attr "length" "4,8")])
12895 (define_insn "*call_value_nonlocal_sysv_secure<mode>"
12896 [(set (match_operand 0 "" "")
12897 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
12898 (match_operand 2 "" "g,g")))
12899 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12900 (use (match_operand:SI 4 "register_operand" "r,r"))
12901 (clobber (reg:SI LR_REGNO))]
12902 "(DEFAULT_ABI == ABI_V4
12903 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[1])
12904 && (INTVAL (operands[3]) & CALL_LONG) == 0)"
12906 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12907 output_asm_insn ("crxor 6,6,6", operands);
12909 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12910 output_asm_insn ("creqv 6,6,6", operands);
12913 return "bl %z1+32768@plt";
12915 return "bl %z1@plt";
12917 [(set_attr "type" "branch,branch")
12918 (set_attr "length" "4,8")])
12920 ;; Call subroutine returning any type.
12921 (define_expand "untyped_call"
12922 [(parallel [(call (match_operand 0 "" "")
12924 (match_operand 1 "" "")
12925 (match_operand 2 "" "")])]
12931 emit_call_insn (GEN_CALL (operands[0], const0_rtx, const0_rtx, const0_rtx));
12933 for (i = 0; i < XVECLEN (operands[2], 0); i++)
12935 rtx set = XVECEXP (operands[2], 0, i);
12936 emit_move_insn (SET_DEST (set), SET_SRC (set));
12939 /* The optimizer does not know that the call sets the function value
12940 registers we stored in the result block. We avoid problems by
12941 claiming that all hard registers are used and clobbered at this
12943 emit_insn (gen_blockage ());
12948 ;; sibling call patterns
12949 (define_expand "sibcall"
12950 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
12951 (match_operand 1 "" ""))
12952 (use (match_operand 2 "" ""))
12953 (use (reg:SI LR_REGNO))
12959 if (MACHOPIC_INDIRECT)
12960 operands[0] = machopic_indirect_call_target (operands[0]);
12963 gcc_assert (GET_CODE (operands[0]) == MEM);
12964 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
12966 operands[0] = XEXP (operands[0], 0);
12969 ;; this and similar patterns must be marked as using LR, otherwise
12970 ;; dataflow will try to delete the store into it. This is true
12971 ;; even when the actual reg to jump to is in CTR, when LR was
12972 ;; saved and restored around the PIC-setting BCL.
12973 (define_insn "*sibcall_local32"
12974 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
12975 (match_operand 1 "" "g,g"))
12976 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12977 (use (reg:SI LR_REGNO))
12979 "(INTVAL (operands[2]) & CALL_LONG) == 0"
12982 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12983 output_asm_insn (\"crxor 6,6,6\", operands);
12985 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12986 output_asm_insn (\"creqv 6,6,6\", operands);
12988 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
12990 [(set_attr "type" "branch")
12991 (set_attr "length" "4,8")])
12993 (define_insn "*sibcall_local64"
12994 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
12995 (match_operand 1 "" "g,g"))
12996 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12997 (use (reg:SI LR_REGNO))
12999 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
13002 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
13003 output_asm_insn (\"crxor 6,6,6\", operands);
13005 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
13006 output_asm_insn (\"creqv 6,6,6\", operands);
13008 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
13010 [(set_attr "type" "branch")
13011 (set_attr "length" "4,8")])
13013 (define_insn "*sibcall_value_local32"
13014 [(set (match_operand 0 "" "")
13015 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
13016 (match_operand 2 "" "g,g")))
13017 (use (match_operand:SI 3 "immediate_operand" "O,n"))
13018 (use (reg:SI LR_REGNO))
13020 "(INTVAL (operands[3]) & CALL_LONG) == 0"
13023 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
13024 output_asm_insn (\"crxor 6,6,6\", operands);
13026 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
13027 output_asm_insn (\"creqv 6,6,6\", operands);
13029 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
13031 [(set_attr "type" "branch")
13032 (set_attr "length" "4,8")])
13035 (define_insn "*sibcall_value_local64"
13036 [(set (match_operand 0 "" "")
13037 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
13038 (match_operand 2 "" "g,g")))
13039 (use (match_operand:SI 3 "immediate_operand" "O,n"))
13040 (use (reg:SI LR_REGNO))
13042 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
13045 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
13046 output_asm_insn (\"crxor 6,6,6\", operands);
13048 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
13049 output_asm_insn (\"creqv 6,6,6\", operands);
13051 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
13053 [(set_attr "type" "branch")
13054 (set_attr "length" "4,8")])
13056 (define_insn "*sibcall_nonlocal_aix<mode>"
13057 [(call (mem:SI (match_operand:P 0 "call_operand" "s,c"))
13058 (match_operand 1 "" "g,g"))
13059 (use (match_operand:SI 2 "immediate_operand" "O,O"))
13060 (use (reg:SI LR_REGNO))
13062 "DEFAULT_ABI == ABI_AIX
13063 && (INTVAL (operands[2]) & CALL_LONG) == 0"
13067 [(set_attr "type" "branch")
13068 (set_attr "length" "4")])
13070 (define_insn "*sibcall_value_nonlocal_aix<mode>"
13071 [(set (match_operand 0 "" "")
13072 (call (mem:SI (match_operand:P 1 "call_operand" "s,c"))
13073 (match_operand 2 "" "g,g")))
13074 (use (match_operand:SI 3 "immediate_operand" "O,O"))
13075 (use (reg:SI LR_REGNO))
13077 "DEFAULT_ABI == ABI_AIX
13078 && (INTVAL (operands[3]) & CALL_LONG) == 0"
13082 [(set_attr "type" "branch")
13083 (set_attr "length" "4")])
13085 (define_insn "*sibcall_nonlocal_sysv<mode>"
13086 [(call (mem:SI (match_operand:P 0 "call_operand" "s,s,c,c"))
13087 (match_operand 1 "" ""))
13088 (use (match_operand 2 "immediate_operand" "O,n,O,n"))
13089 (use (reg:SI LR_REGNO))
13091 "(DEFAULT_ABI == ABI_DARWIN
13092 || DEFAULT_ABI == ABI_V4)
13093 && (INTVAL (operands[2]) & CALL_LONG) == 0"
13096 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
13097 output_asm_insn (\"crxor 6,6,6\", operands);
13099 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
13100 output_asm_insn (\"creqv 6,6,6\", operands);
13102 if (which_alternative >= 2)
13104 else if (DEFAULT_ABI == ABI_V4 && flag_pic)
13106 gcc_assert (!TARGET_SECURE_PLT);
13107 return \"b %z0@plt\";
13112 [(set_attr "type" "branch")
13113 (set_attr "length" "4,8,4,8")])
13115 (define_expand "sibcall_value"
13116 [(parallel [(set (match_operand 0 "register_operand" "")
13117 (call (mem:SI (match_operand 1 "address_operand" ""))
13118 (match_operand 2 "" "")))
13119 (use (match_operand 3 "" ""))
13120 (use (reg:SI LR_REGNO))
13126 if (MACHOPIC_INDIRECT)
13127 operands[1] = machopic_indirect_call_target (operands[1]);
13130 gcc_assert (GET_CODE (operands[1]) == MEM);
13131 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
13133 operands[1] = XEXP (operands[1], 0);
13136 (define_insn "*sibcall_value_nonlocal_sysv<mode>"
13137 [(set (match_operand 0 "" "")
13138 (call (mem:SI (match_operand:P 1 "call_operand" "s,s,c,c"))
13139 (match_operand 2 "" "")))
13140 (use (match_operand:SI 3 "immediate_operand" "O,n,O,n"))
13141 (use (reg:SI LR_REGNO))
13143 "(DEFAULT_ABI == ABI_DARWIN
13144 || DEFAULT_ABI == ABI_V4)
13145 && (INTVAL (operands[3]) & CALL_LONG) == 0"
13148 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
13149 output_asm_insn (\"crxor 6,6,6\", operands);
13151 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
13152 output_asm_insn (\"creqv 6,6,6\", operands);
13154 if (which_alternative >= 2)
13156 else if (DEFAULT_ABI == ABI_V4 && flag_pic)
13158 gcc_assert (!TARGET_SECURE_PLT);
13159 return \"b %z1@plt\";
13164 [(set_attr "type" "branch")
13165 (set_attr "length" "4,8,4,8")])
13167 (define_expand "sibcall_epilogue"
13168 [(use (const_int 0))]
13171 if (!TARGET_SCHED_PROLOG)
13172 emit_insn (gen_blockage ());
13173 rs6000_emit_epilogue (TRUE);
13177 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
13178 ;; all of memory. This blocks insns from being moved across this point.
13180 (define_insn "blockage"
13181 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCK)]
13185 (define_insn "probe_stack"
13186 [(set (match_operand 0 "memory_operand" "=m")
13187 (unspec [(const_int 0)] UNSPEC_PROBE_STACK))]
13191 operands[1] = gen_rtx_REG (Pmode, 0);
13192 return \"{st%U0%X0|stw%U0%X0} %1,%0\";
13194 [(set_attr "type" "store")
13195 (set_attr "length" "4")])
13197 (define_insn "probe_stack_range<P:mode>"
13198 [(set (match_operand:P 0 "register_operand" "=r")
13199 (unspec_volatile:P [(match_operand:P 1 "register_operand" "0")
13200 (match_operand:P 2 "register_operand" "r")]
13201 UNSPECV_PROBE_STACK_RANGE))]
13203 "* return output_probe_stack_range (operands[0], operands[2]);"
13204 [(set_attr "type" "three")])
13206 ;; Compare insns are next. Note that the RS/6000 has two types of compares,
13207 ;; signed & unsigned, and one type of branch.
13209 ;; Start with the DEFINE_EXPANDs to generate the rtl for compares, scc
13210 ;; insns, and branches.
13212 (define_expand "cbranch<mode>4"
13213 [(use (match_operator 0 "rs6000_cbranch_operator"
13214 [(match_operand:GPR 1 "gpc_reg_operand" "")
13215 (match_operand:GPR 2 "reg_or_short_operand" "")]))
13216 (use (match_operand 3 ""))]
13220 /* Take care of the possibility that operands[2] might be negative but
13221 this might be a logical operation. That insn doesn't exist. */
13222 if (GET_CODE (operands[2]) == CONST_INT
13223 && INTVAL (operands[2]) < 0)
13225 operands[2] = force_reg (<MODE>mode, operands[2]);
13226 operands[0] = gen_rtx_fmt_ee (GET_CODE (operands[0]),
13227 GET_MODE (operands[0]),
13228 operands[1], operands[2]);
13231 rs6000_emit_cbranch (<MODE>mode, operands);
13235 (define_expand "cbranch<mode>4"
13236 [(use (match_operator 0 "rs6000_cbranch_operator"
13237 [(match_operand:FP 1 "gpc_reg_operand" "")
13238 (match_operand:FP 2 "gpc_reg_operand" "")]))
13239 (use (match_operand 3 ""))]
13243 rs6000_emit_cbranch (<MODE>mode, operands);
13247 (define_expand "cstore<mode>4"
13248 [(use (match_operator 1 "rs6000_cbranch_operator"
13249 [(match_operand:GPR 2 "gpc_reg_operand" "")
13250 (match_operand:GPR 3 "reg_or_short_operand" "")]))
13251 (clobber (match_operand:SI 0 "register_operand"))]
13255 /* Take care of the possibility that operands[3] might be negative but
13256 this might be a logical operation. That insn doesn't exist. */
13257 if (GET_CODE (operands[3]) == CONST_INT
13258 && INTVAL (operands[3]) < 0)
13260 operands[3] = force_reg (<MODE>mode, operands[3]);
13261 operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]),
13262 GET_MODE (operands[1]),
13263 operands[2], operands[3]);
13266 /* For SNE, we would prefer that the xor/abs sequence be used for integers.
13267 For SEQ, likewise, except that comparisons with zero should be done
13268 with an scc insns. However, due to the order that combine see the
13269 resulting insns, we must, in fact, allow SEQ for integers. Fail in
13270 the cases we don't want to handle or are best handled by portable
13272 if (GET_CODE (operands[1]) == NE)
13274 if ((GET_CODE (operands[1]) == LT || GET_CODE (operands[1]) == LE
13275 || GET_CODE (operands[1]) == GT || GET_CODE (operands[1]) == GE)
13276 && operands[3] == const0_rtx)
13278 rs6000_emit_sCOND (<MODE>mode, operands);
13282 (define_expand "cstore<mode>4"
13283 [(use (match_operator 1 "rs6000_cbranch_operator"
13284 [(match_operand:FP 2 "gpc_reg_operand" "")
13285 (match_operand:FP 3 "gpc_reg_operand" "")]))
13286 (clobber (match_operand:SI 0 "register_operand"))]
13290 rs6000_emit_sCOND (<MODE>mode, operands);
13295 (define_expand "stack_protect_set"
13296 [(match_operand 0 "memory_operand" "")
13297 (match_operand 1 "memory_operand" "")]
13300 #ifdef TARGET_THREAD_SSP_OFFSET
13301 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
13302 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
13303 operands[1] = gen_rtx_MEM (Pmode, addr);
13306 emit_insn (gen_stack_protect_setdi (operands[0], operands[1]));
13308 emit_insn (gen_stack_protect_setsi (operands[0], operands[1]));
13312 (define_insn "stack_protect_setsi"
13313 [(set (match_operand:SI 0 "memory_operand" "=m")
13314 (unspec:SI [(match_operand:SI 1 "memory_operand" "m")] UNSPEC_SP_SET))
13315 (set (match_scratch:SI 2 "=&r") (const_int 0))]
13317 "{l%U1%X1|lwz%U1%X1} %2,%1\;{st%U0%X0|stw%U0%X0} %2,%0\;{lil|li} %2,0"
13318 [(set_attr "type" "three")
13319 (set_attr "length" "12")])
13321 (define_insn "stack_protect_setdi"
13322 [(set (match_operand:DI 0 "memory_operand" "=m")
13323 (unspec:DI [(match_operand:DI 1 "memory_operand" "m")] UNSPEC_SP_SET))
13324 (set (match_scratch:DI 2 "=&r") (const_int 0))]
13326 "ld%U1%X1 %2,%1\;std%U0%X0 %2,%0\;{lil|li} %2,0"
13327 [(set_attr "type" "three")
13328 (set_attr "length" "12")])
13330 (define_expand "stack_protect_test"
13331 [(match_operand 0 "memory_operand" "")
13332 (match_operand 1 "memory_operand" "")
13333 (match_operand 2 "" "")]
13336 rtx test, op0, op1;
13337 #ifdef TARGET_THREAD_SSP_OFFSET
13338 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
13339 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
13340 operands[1] = gen_rtx_MEM (Pmode, addr);
13343 op1 = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, operands[1]), UNSPEC_SP_TEST);
13344 test = gen_rtx_EQ (VOIDmode, op0, op1);
13345 emit_jump_insn (gen_cbranchsi4 (test, op0, op1, operands[2]));
13349 (define_insn "stack_protect_testsi"
13350 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
13351 (unspec:CCEQ [(match_operand:SI 1 "memory_operand" "m,m")
13352 (match_operand:SI 2 "memory_operand" "m,m")]
13354 (set (match_scratch:SI 4 "=r,r") (const_int 0))
13355 (clobber (match_scratch:SI 3 "=&r,&r"))]
13358 {l%U1%X1|lwz%U1%X1} %3,%1\;{l%U2%X2|lwz%U2%X2} %4,%2\;xor. %3,%3,%4\;{lil|li} %4,0
13359 {l%U1%X1|lwz%U1%X1} %3,%1\;{l%U2%X2|lwz%U2%X2} %4,%2\;{cmpl|cmplw} %0,%3,%4\;{lil|li} %3,0\;{lil|li} %4,0"
13360 [(set_attr "length" "16,20")])
13362 (define_insn "stack_protect_testdi"
13363 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
13364 (unspec:CCEQ [(match_operand:DI 1 "memory_operand" "m,m")
13365 (match_operand:DI 2 "memory_operand" "m,m")]
13367 (set (match_scratch:DI 4 "=r,r") (const_int 0))
13368 (clobber (match_scratch:DI 3 "=&r,&r"))]
13371 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;xor. %3,%3,%4\;{lil|li} %4,0
13372 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;cmpld %0,%3,%4\;{lil|li} %3,0\;{lil|li} %4,0"
13373 [(set_attr "length" "16,20")])
13376 ;; Here are the actual compare insns.
13377 (define_insn "*cmp<mode>_internal1"
13378 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
13379 (compare:CC (match_operand:GPR 1 "gpc_reg_operand" "r")
13380 (match_operand:GPR 2 "reg_or_short_operand" "rI")))]
13382 "{cmp%I2|cmp<wd>%I2} %0,%1,%2"
13383 [(set_attr "type" "cmp")])
13385 ;; If we are comparing a register for equality with a large constant,
13386 ;; we can do this with an XOR followed by a compare. But this is profitable
13387 ;; only if the large constant is only used for the comparison (and in this
13388 ;; case we already have a register to reuse as scratch).
13390 ;; For 64-bit registers, we could only do so if the constant's bit 15 is clear:
13391 ;; otherwise we'd need to XOR with FFFFFFFF????0000 which is not available.
13394 [(set (match_operand:SI 0 "register_operand")
13395 (match_operand:SI 1 "logical_const_operand" ""))
13396 (set (match_dup 0) (match_operator:SI 3 "boolean_or_operator"
13398 (match_operand:SI 2 "logical_const_operand" "")]))
13399 (set (match_operand:CC 4 "cc_reg_operand" "")
13400 (compare:CC (match_operand:SI 5 "gpc_reg_operand" "")
13403 (if_then_else (match_operator 6 "equality_operator"
13404 [(match_dup 4) (const_int 0)])
13405 (match_operand 7 "" "")
13406 (match_operand 8 "" "")))]
13407 "peep2_reg_dead_p (3, operands[0])
13408 && peep2_reg_dead_p (4, operands[4])"
13409 [(set (match_dup 0) (xor:SI (match_dup 5) (match_dup 9)))
13410 (set (match_dup 4) (compare:CC (match_dup 0) (match_dup 10)))
13411 (set (pc) (if_then_else (match_dup 6) (match_dup 7) (match_dup 8)))]
13414 /* Get the constant we are comparing against, and see what it looks like
13415 when sign-extended from 16 to 32 bits. Then see what constant we could
13416 XOR with SEXTC to get the sign-extended value. */
13417 rtx cnst = simplify_const_binary_operation (GET_CODE (operands[3]),
13419 operands[1], operands[2]);
13420 HOST_WIDE_INT c = INTVAL (cnst);
13421 HOST_WIDE_INT sextc = ((c & 0xffff) ^ 0x8000) - 0x8000;
13422 HOST_WIDE_INT xorv = c ^ sextc;
13424 operands[9] = GEN_INT (xorv);
13425 operands[10] = GEN_INT (sextc);
13428 (define_insn "*cmpsi_internal2"
13429 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
13430 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
13431 (match_operand:SI 2 "reg_or_u_short_operand" "rK")))]
13433 "{cmpl%I2|cmplw%I2} %0,%1,%b2"
13434 [(set_attr "type" "cmp")])
13436 (define_insn "*cmpdi_internal2"
13437 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
13438 (compare:CCUNS (match_operand:DI 1 "gpc_reg_operand" "r")
13439 (match_operand:DI 2 "reg_or_u_short_operand" "rK")))]
13441 "cmpld%I2 %0,%1,%b2"
13442 [(set_attr "type" "cmp")])
13444 ;; The following two insns don't exist as single insns, but if we provide
13445 ;; them, we can swap an add and compare, which will enable us to overlap more
13446 ;; of the required delay between a compare and branch. We generate code for
13447 ;; them by splitting.
13450 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
13451 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
13452 (match_operand:SI 2 "short_cint_operand" "i")))
13453 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
13454 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
13457 [(set_attr "length" "8")])
13460 [(set (match_operand:CCUNS 3 "cc_reg_operand" "=y")
13461 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
13462 (match_operand:SI 2 "u_short_cint_operand" "i")))
13463 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
13464 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
13467 [(set_attr "length" "8")])
13470 [(set (match_operand:CC 3 "cc_reg_operand" "")
13471 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
13472 (match_operand:SI 2 "short_cint_operand" "")))
13473 (set (match_operand:SI 0 "gpc_reg_operand" "")
13474 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
13476 [(set (match_dup 3) (compare:CC (match_dup 1) (match_dup 2)))
13477 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
13480 [(set (match_operand:CCUNS 3 "cc_reg_operand" "")
13481 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "")
13482 (match_operand:SI 2 "u_short_cint_operand" "")))
13483 (set (match_operand:SI 0 "gpc_reg_operand" "")
13484 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
13486 [(set (match_dup 3) (compare:CCUNS (match_dup 1) (match_dup 2)))
13487 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
13489 (define_insn "*cmpsf_internal1"
13490 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
13491 (compare:CCFP (match_operand:SF 1 "gpc_reg_operand" "f")
13492 (match_operand:SF 2 "gpc_reg_operand" "f")))]
13493 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
13495 [(set_attr "type" "fpcompare")])
13497 (define_insn "*cmpdf_internal1"
13498 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
13499 (compare:CCFP (match_operand:DF 1 "gpc_reg_operand" "d")
13500 (match_operand:DF 2 "gpc_reg_operand" "d")))]
13501 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
13502 && !VECTOR_UNIT_VSX_P (DFmode)"
13504 [(set_attr "type" "fpcompare")])
13506 ;; Only need to compare second words if first words equal
13507 (define_insn "*cmptf_internal1"
13508 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
13509 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "d")
13510 (match_operand:TF 2 "gpc_reg_operand" "d")))]
13511 "!TARGET_IEEEQUAD && !TARGET_XL_COMPAT
13512 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LONG_DOUBLE_128"
13513 "fcmpu %0,%1,%2\;bne %0,$+8\;fcmpu %0,%L1,%L2"
13514 [(set_attr "type" "fpcompare")
13515 (set_attr "length" "12")])
13517 (define_insn_and_split "*cmptf_internal2"
13518 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
13519 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "d")
13520 (match_operand:TF 2 "gpc_reg_operand" "d")))
13521 (clobber (match_scratch:DF 3 "=d"))
13522 (clobber (match_scratch:DF 4 "=d"))
13523 (clobber (match_scratch:DF 5 "=d"))
13524 (clobber (match_scratch:DF 6 "=d"))
13525 (clobber (match_scratch:DF 7 "=d"))
13526 (clobber (match_scratch:DF 8 "=d"))
13527 (clobber (match_scratch:DF 9 "=d"))
13528 (clobber (match_scratch:DF 10 "=d"))
13529 (clobber (match_scratch:GPR 11 "=b"))]
13530 "!TARGET_IEEEQUAD && TARGET_XL_COMPAT
13531 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LONG_DOUBLE_128"
13533 "&& reload_completed"
13534 [(set (match_dup 3) (match_dup 14))
13535 (set (match_dup 4) (match_dup 15))
13536 (set (match_dup 9) (abs:DF (match_dup 5)))
13537 (set (match_dup 0) (compare:CCFP (match_dup 9) (match_dup 3)))
13538 (set (pc) (if_then_else (ne (match_dup 0) (const_int 0))
13539 (label_ref (match_dup 12))
13541 (set (match_dup 0) (compare:CCFP (match_dup 5) (match_dup 7)))
13542 (set (pc) (label_ref (match_dup 13)))
13544 (set (match_dup 10) (minus:DF (match_dup 5) (match_dup 7)))
13545 (set (match_dup 9) (minus:DF (match_dup 6) (match_dup 8)))
13546 (set (match_dup 9) (plus:DF (match_dup 10) (match_dup 9)))
13547 (set (match_dup 0) (compare:CCFP (match_dup 9) (match_dup 4)))
13550 REAL_VALUE_TYPE rv;
13551 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
13552 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
13554 operands[5] = simplify_gen_subreg (DFmode, operands[1], TFmode, hi_word);
13555 operands[6] = simplify_gen_subreg (DFmode, operands[1], TFmode, lo_word);
13556 operands[7] = simplify_gen_subreg (DFmode, operands[2], TFmode, hi_word);
13557 operands[8] = simplify_gen_subreg (DFmode, operands[2], TFmode, lo_word);
13558 operands[12] = gen_label_rtx ();
13559 operands[13] = gen_label_rtx ();
13561 operands[14] = force_const_mem (DFmode,
13562 CONST_DOUBLE_FROM_REAL_VALUE (rv, DFmode));
13563 operands[15] = force_const_mem (DFmode,
13564 CONST_DOUBLE_FROM_REAL_VALUE (dconst0,
13569 tocref = create_TOC_reference (XEXP (operands[14], 0), operands[11]);
13570 operands[14] = gen_const_mem (DFmode, tocref);
13571 tocref = create_TOC_reference (XEXP (operands[15], 0), operands[11]);
13572 operands[15] = gen_const_mem (DFmode, tocref);
13573 set_mem_alias_set (operands[14], get_TOC_alias_set ());
13574 set_mem_alias_set (operands[15], get_TOC_alias_set ());
13578 ;; Now we have the scc insns. We can do some combinations because of the
13579 ;; way the machine works.
13581 ;; Note that this is probably faster if we can put an insn between the
13582 ;; mfcr and rlinm, but this is tricky. Let's leave it for now. In most
13583 ;; cases the insns below which don't use an intermediate CR field will
13584 ;; be used instead.
13586 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13587 (match_operator:SI 1 "scc_comparison_operator"
13588 [(match_operand 2 "cc_reg_operand" "y")
13591 "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1"
13592 [(set (attr "type")
13593 (cond [(match_test "TARGET_MFCRF")
13594 (const_string "mfcrf")
13596 (const_string "mfcr")))
13597 (set_attr "length" "8")])
13599 ;; Same as above, but get the GT bit.
13600 (define_insn "move_from_CR_gt_bit"
13601 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13602 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_GT))]
13603 "TARGET_HARD_FLOAT && !TARGET_FPRS"
13604 "mfcr %0\;{rlinm|rlwinm} %0,%0,%D1,31,31"
13605 [(set_attr "type" "mfcr")
13606 (set_attr "length" "8")])
13608 ;; Same as above, but get the OV/ORDERED bit.
13609 (define_insn "move_from_CR_ov_bit"
13610 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13611 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_OV))]
13613 "mfcr %0\;{rlinm|rlwinm} %0,%0,%t1,1"
13614 [(set_attr "type" "mfcr")
13615 (set_attr "length" "8")])
13618 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13619 (match_operator:DI 1 "scc_comparison_operator"
13620 [(match_operand 2 "cc_reg_operand" "y")
13623 "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1"
13624 [(set (attr "type")
13625 (cond [(match_test "TARGET_MFCRF")
13626 (const_string "mfcrf")
13628 (const_string "mfcr")))
13629 (set_attr "length" "8")])
13632 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13633 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
13634 [(match_operand 2 "cc_reg_operand" "y,y")
13637 (set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
13638 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
13641 mfcr %3%Q2\;{rlinm.|rlwinm.} %3,%3,%J1,1
13643 [(set_attr "type" "delayed_compare")
13644 (set_attr "length" "8,16")])
13647 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13648 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
13649 [(match_operand 2 "cc_reg_operand" "")
13652 (set (match_operand:SI 3 "gpc_reg_operand" "")
13653 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
13654 "TARGET_32BIT && reload_completed"
13655 [(set (match_dup 3)
13656 (match_op_dup 1 [(match_dup 2) (const_int 0)]))
13658 (compare:CC (match_dup 3)
13663 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13664 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
13665 [(match_operand 2 "cc_reg_operand" "y")
13667 (match_operand:SI 3 "const_int_operand" "n")))]
13671 int is_bit = ccr_bit (operands[1], 1);
13672 int put_bit = 31 - (INTVAL (operands[3]) & 31);
13675 if (is_bit >= put_bit)
13676 count = is_bit - put_bit;
13678 count = 32 - (put_bit - is_bit);
13680 operands[4] = GEN_INT (count);
13681 operands[5] = GEN_INT (put_bit);
13683 return \"mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%4,%5,%5\";
13685 [(set (attr "type")
13686 (cond [(match_test "TARGET_MFCRF")
13687 (const_string "mfcrf")
13689 (const_string "mfcr")))
13690 (set_attr "length" "8")])
13693 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13695 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
13696 [(match_operand 2 "cc_reg_operand" "y,y")
13698 (match_operand:SI 3 "const_int_operand" "n,n"))
13700 (set (match_operand:SI 4 "gpc_reg_operand" "=r,r")
13701 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
13706 int is_bit = ccr_bit (operands[1], 1);
13707 int put_bit = 31 - (INTVAL (operands[3]) & 31);
13710 /* Force split for non-cc0 compare. */
13711 if (which_alternative == 1)
13714 if (is_bit >= put_bit)
13715 count = is_bit - put_bit;
13717 count = 32 - (put_bit - is_bit);
13719 operands[5] = GEN_INT (count);
13720 operands[6] = GEN_INT (put_bit);
13722 return \"mfcr %4%Q2\;{rlinm.|rlwinm.} %4,%4,%5,%6,%6\";
13724 [(set_attr "type" "delayed_compare")
13725 (set_attr "length" "8,16")])
13728 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
13730 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
13731 [(match_operand 2 "cc_reg_operand" "")
13733 (match_operand:SI 3 "const_int_operand" ""))
13735 (set (match_operand:SI 4 "gpc_reg_operand" "")
13736 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
13739 [(set (match_dup 4)
13740 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
13743 (compare:CC (match_dup 4)
13747 ;; There is a 3 cycle delay between consecutive mfcr instructions
13748 ;; so it is useful to combine 2 scc instructions to use only one mfcr.
13751 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13752 (match_operator:SI 1 "scc_comparison_operator"
13753 [(match_operand 2 "cc_reg_operand" "y")
13755 (set (match_operand:SI 3 "gpc_reg_operand" "=r")
13756 (match_operator:SI 4 "scc_comparison_operator"
13757 [(match_operand 5 "cc_reg_operand" "y")
13759 "REGNO (operands[2]) != REGNO (operands[5])"
13760 "mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
13761 [(set_attr "type" "mfcr")
13762 (set_attr "length" "12")])
13765 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13766 (match_operator:DI 1 "scc_comparison_operator"
13767 [(match_operand 2 "cc_reg_operand" "y")
13769 (set (match_operand:DI 3 "gpc_reg_operand" "=r")
13770 (match_operator:DI 4 "scc_comparison_operator"
13771 [(match_operand 5 "cc_reg_operand" "y")
13773 "TARGET_POWERPC64 && REGNO (operands[2]) != REGNO (operands[5])"
13774 "mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
13775 [(set_attr "type" "mfcr")
13776 (set_attr "length" "12")])
13778 ;; There are some scc insns that can be done directly, without a compare.
13779 ;; These are faster because they don't involve the communications between
13780 ;; the FXU and branch units. In fact, we will be replacing all of the
13781 ;; integer scc insns here or in the portable methods in emit_store_flag.
13783 ;; Also support (neg (scc ..)) since that construct is used to replace
13784 ;; branches, (plus (scc ..) ..) since that construct is common and
13785 ;; takes no more insns than scc, and (and (neg (scc ..)) ..) in the
13786 ;; cases where it is no more expensive than (neg (scc ..)).
13788 ;; Have reload force a constant into a register for the simple insns that
13789 ;; otherwise won't accept constants. We do this because it is faster than
13790 ;; the cmp/mfcr sequence we would otherwise generate.
13792 (define_mode_attr scc_eq_op2 [(SI "rKLI")
13795 (define_insn_and_split "*eq<mode>"
13796 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
13797 (eq:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
13798 (match_operand:GPR 2 "scc_eq_operand" "<scc_eq_op2>")))]
13802 [(set (match_dup 0)
13803 (clz:GPR (match_dup 3)))
13805 (lshiftrt:GPR (match_dup 0) (match_dup 4)))]
13807 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
13809 /* Use output operand as intermediate. */
13810 operands[3] = operands[0];
13812 if (logical_operand (operands[2], <MODE>mode))
13813 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13814 gen_rtx_XOR (<MODE>mode,
13815 operands[1], operands[2])));
13817 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13818 gen_rtx_PLUS (<MODE>mode, operands[1],
13819 negate_rtx (<MODE>mode,
13823 operands[3] = operands[1];
13825 operands[4] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
13828 (define_insn_and_split "*eq<mode>_compare"
13829 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
13831 (eq:P (match_operand:P 1 "gpc_reg_operand" "=r")
13832 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))
13834 (set (match_operand:P 0 "gpc_reg_operand" "=r")
13835 (eq:P (match_dup 1) (match_dup 2)))]
13836 "!TARGET_POWER && optimize_size"
13838 "!TARGET_POWER && optimize_size"
13839 [(set (match_dup 0)
13840 (clz:P (match_dup 4)))
13841 (parallel [(set (match_dup 3)
13842 (compare:CC (lshiftrt:P (match_dup 0) (match_dup 5))
13845 (lshiftrt:P (match_dup 0) (match_dup 5)))])]
13847 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
13849 /* Use output operand as intermediate. */
13850 operands[4] = operands[0];
13852 if (logical_operand (operands[2], <MODE>mode))
13853 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
13854 gen_rtx_XOR (<MODE>mode,
13855 operands[1], operands[2])));
13857 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
13858 gen_rtx_PLUS (<MODE>mode, operands[1],
13859 negate_rtx (<MODE>mode,
13863 operands[4] = operands[1];
13865 operands[5] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
13868 (define_insn "*eqsi_power"
13869 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
13870 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
13871 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I")))
13872 (clobber (match_scratch:SI 3 "=r,&r,r,r,r"))]
13875 xor %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
13876 {sfi|subfic} %3,%1,0\;{ae|adde} %0,%3,%1
13877 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
13878 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
13879 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0"
13880 [(set_attr "type" "three,two,three,three,three")
13881 (set_attr "length" "12,8,12,12,12")])
13883 ;; We have insns of the form shown by the first define_insn below. If
13884 ;; there is something inside the comparison operation, we must split it.
13886 [(set (match_operand:SI 0 "gpc_reg_operand" "")
13887 (plus:SI (match_operator 1 "comparison_operator"
13888 [(match_operand:SI 2 "" "")
13889 (match_operand:SI 3
13890 "reg_or_cint_operand" "")])
13891 (match_operand:SI 4 "gpc_reg_operand" "")))
13892 (clobber (match_operand:SI 5 "register_operand" ""))]
13893 "! gpc_reg_operand (operands[2], SImode)"
13894 [(set (match_dup 5) (match_dup 2))
13895 (set (match_dup 2) (plus:SI (match_op_dup 1 [(match_dup 2) (match_dup 3)])
13898 (define_insn "*plus_eqsi"
13899 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r")
13900 (plus:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
13901 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I"))
13902 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r")))]
13905 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
13906 {sfi|subfic} %0,%1,0\;{aze|addze} %0,%3
13907 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
13908 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
13909 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
13910 [(set_attr "type" "three,two,three,three,three")
13911 (set_attr "length" "12,8,12,12,12")])
13913 (define_insn "*compare_plus_eqsi"
13914 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
13917 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
13918 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
13919 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
13921 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r"))]
13922 "TARGET_32BIT && optimize_size"
13924 xor %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
13925 {sfi|subfic} %4,%1,0\;{aze.|addze.} %4,%3
13926 {xoril|xori} %4,%1,%b2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
13927 {xoriu|xoris} %4,%1,%u2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
13928 {sfi|subfic} %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
13934 [(set_attr "type" "compare")
13935 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
13938 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13941 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
13942 (match_operand:SI 2 "scc_eq_operand" ""))
13943 (match_operand:SI 3 "gpc_reg_operand" ""))
13945 (clobber (match_scratch:SI 4 ""))]
13946 "TARGET_32BIT && optimize_size && reload_completed"
13947 [(set (match_dup 4)
13948 (plus:SI (eq:SI (match_dup 1)
13952 (compare:CC (match_dup 4)
13956 (define_insn "*plus_eqsi_compare"
13957 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
13960 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
13961 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
13962 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
13964 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r")
13965 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13966 "TARGET_32BIT && optimize_size"
13968 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
13969 {sfi|subfic} %0,%1,0\;{aze.|addze.} %0,%3
13970 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
13971 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
13972 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
13978 [(set_attr "type" "compare")
13979 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
13982 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13985 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
13986 (match_operand:SI 2 "scc_eq_operand" ""))
13987 (match_operand:SI 3 "gpc_reg_operand" ""))
13989 (set (match_operand:SI 0 "gpc_reg_operand" "")
13990 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13991 "TARGET_32BIT && optimize_size && reload_completed"
13992 [(set (match_dup 0)
13993 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13995 (compare:CC (match_dup 0)
13999 (define_insn "*neg_eq0<mode>"
14000 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
14001 (neg:P (eq:P (match_operand:P 1 "gpc_reg_operand" "r")
14004 "{ai|addic} %0,%1,-1\;{sfe|subfe} %0,%0,%0"
14005 [(set_attr "type" "two")
14006 (set_attr "length" "8")])
14008 (define_insn_and_split "*neg_eq<mode>"
14009 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
14010 (neg:P (eq:P (match_operand:P 1 "gpc_reg_operand" "%r")
14011 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))))]
14015 [(set (match_dup 0) (neg:P (eq:P (match_dup 3) (const_int 0))))]
14017 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
14019 /* Use output operand as intermediate. */
14020 operands[3] = operands[0];
14022 if (logical_operand (operands[2], <MODE>mode))
14023 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
14024 gen_rtx_XOR (<MODE>mode,
14025 operands[1], operands[2])));
14027 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
14028 gen_rtx_PLUS (<MODE>mode, operands[1],
14029 negate_rtx (<MODE>mode,
14033 operands[3] = operands[1];
14036 ;; Simplify (ne X (const_int 0)) on the PowerPC. No need to on the Power,
14037 ;; since it nabs/sr is just as fast.
14038 (define_insn "*ne0si"
14039 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
14040 (lshiftrt:SI (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
14042 (clobber (match_scratch:SI 2 "=&r"))]
14043 "! TARGET_POWER && TARGET_32BIT && !TARGET_ISEL"
14044 "{ai|addic} %2,%1,-1\;{sfe|subfe} %0,%2,%1"
14045 [(set_attr "type" "two")
14046 (set_attr "length" "8")])
14048 (define_insn "*ne0di"
14049 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
14050 (lshiftrt:DI (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
14052 (clobber (match_scratch:DI 2 "=&r"))]
14054 "addic %2,%1,-1\;subfe %0,%2,%1"
14055 [(set_attr "type" "two")
14056 (set_attr "length" "8")])
14058 ;; This is what (plus (ne X (const_int 0)) Y) looks like.
14059 (define_insn "*plus_ne0si"
14060 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14061 (plus:SI (lshiftrt:SI
14062 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
14064 (match_operand:SI 2 "gpc_reg_operand" "r")))
14065 (clobber (match_scratch:SI 3 "=&r"))]
14067 "{ai|addic} %3,%1,-1\;{aze|addze} %0,%2"
14068 [(set_attr "type" "two")
14069 (set_attr "length" "8")])
14071 (define_insn "*plus_ne0di"
14072 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
14073 (plus:DI (lshiftrt:DI
14074 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
14076 (match_operand:DI 2 "gpc_reg_operand" "r")))
14077 (clobber (match_scratch:DI 3 "=&r"))]
14079 "addic %3,%1,-1\;addze %0,%2"
14080 [(set_attr "type" "two")
14081 (set_attr "length" "8")])
14083 (define_insn "*compare_plus_ne0si"
14084 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
14086 (plus:SI (lshiftrt:SI
14087 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
14089 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
14091 (clobber (match_scratch:SI 3 "=&r,&r"))
14092 (clobber (match_scratch:SI 4 "=X,&r"))]
14095 {ai|addic} %3,%1,-1\;{aze.|addze.} %3,%2
14097 [(set_attr "type" "compare")
14098 (set_attr "length" "8,12")])
14101 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14103 (plus:SI (lshiftrt:SI
14104 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
14106 (match_operand:SI 2 "gpc_reg_operand" ""))
14108 (clobber (match_scratch:SI 3 ""))
14109 (clobber (match_scratch:SI 4 ""))]
14110 "TARGET_32BIT && reload_completed"
14111 [(parallel [(set (match_dup 3)
14112 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1)))
14115 (clobber (match_dup 4))])
14117 (compare:CC (match_dup 3)
14121 (define_insn "*compare_plus_ne0di"
14122 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
14124 (plus:DI (lshiftrt:DI
14125 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
14127 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
14129 (clobber (match_scratch:DI 3 "=&r,&r"))]
14132 addic %3,%1,-1\;addze. %3,%2
14134 [(set_attr "type" "compare")
14135 (set_attr "length" "8,12")])
14138 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
14140 (plus:DI (lshiftrt:DI
14141 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
14143 (match_operand:DI 2 "gpc_reg_operand" ""))
14145 (clobber (match_scratch:DI 3 ""))]
14146 "TARGET_64BIT && reload_completed"
14147 [(set (match_dup 3)
14148 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1)))
14152 (compare:CC (match_dup 3)
14156 (define_insn "*plus_ne0si_compare"
14157 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
14159 (plus:SI (lshiftrt:SI
14160 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
14162 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
14164 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
14165 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
14167 (clobber (match_scratch:SI 3 "=&r,&r"))]
14170 {ai|addic} %3,%1,-1\;{aze.|addze.} %0,%2
14172 [(set_attr "type" "compare")
14173 (set_attr "length" "8,12")])
14176 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14178 (plus:SI (lshiftrt:SI
14179 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
14181 (match_operand:SI 2 "gpc_reg_operand" ""))
14183 (set (match_operand:SI 0 "gpc_reg_operand" "")
14184 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
14186 (clobber (match_scratch:SI 3 ""))]
14187 "TARGET_32BIT && reload_completed"
14188 [(parallel [(set (match_dup 0)
14189 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
14191 (clobber (match_dup 3))])
14193 (compare:CC (match_dup 0)
14197 (define_insn "*plus_ne0di_compare"
14198 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
14200 (plus:DI (lshiftrt:DI
14201 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
14203 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
14205 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
14206 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
14208 (clobber (match_scratch:DI 3 "=&r,&r"))]
14211 addic %3,%1,-1\;addze. %0,%2
14213 [(set_attr "type" "compare")
14214 (set_attr "length" "8,12")])
14217 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
14219 (plus:DI (lshiftrt:DI
14220 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
14222 (match_operand:DI 2 "gpc_reg_operand" ""))
14224 (set (match_operand:DI 0 "gpc_reg_operand" "")
14225 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
14227 (clobber (match_scratch:DI 3 ""))]
14228 "TARGET_64BIT && reload_completed"
14229 [(parallel [(set (match_dup 0)
14230 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
14232 (clobber (match_dup 3))])
14234 (compare:CC (match_dup 0)
14239 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
14240 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14241 (match_operand:SI 2 "reg_or_short_operand" "r,O")))
14242 (clobber (match_scratch:SI 3 "=r,X"))]
14245 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3
14246 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri|srwi} %0,%0,31"
14247 [(set_attr "length" "12")])
14250 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
14252 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14253 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
14255 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
14256 (le:SI (match_dup 1) (match_dup 2)))
14257 (clobber (match_scratch:SI 3 "=r,X,r,X"))]
14260 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
14261 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri.|srwi.} %0,%0,31
14264 [(set_attr "type" "compare,delayed_compare,compare,delayed_compare")
14265 (set_attr "length" "12,12,16,16")])
14268 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14270 (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
14271 (match_operand:SI 2 "reg_or_short_operand" ""))
14273 (set (match_operand:SI 0 "gpc_reg_operand" "")
14274 (le:SI (match_dup 1) (match_dup 2)))
14275 (clobber (match_scratch:SI 3 ""))]
14276 "TARGET_POWER && reload_completed"
14277 [(parallel [(set (match_dup 0)
14278 (le:SI (match_dup 1) (match_dup 2)))
14279 (clobber (match_dup 3))])
14281 (compare:CC (match_dup 0)
14286 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
14287 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14288 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
14289 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
14292 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
14293 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze|addze} %0,%3"
14294 [(set_attr "length" "12")])
14297 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
14299 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14300 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
14301 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
14303 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
14306 doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
14307 {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze.|addze.} %4,%3
14310 [(set_attr "type" "compare")
14311 (set_attr "length" "12,12,16,16")])
14314 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14316 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
14317 (match_operand:SI 2 "reg_or_short_operand" ""))
14318 (match_operand:SI 3 "gpc_reg_operand" ""))
14320 (clobber (match_scratch:SI 4 ""))]
14321 "TARGET_POWER && reload_completed"
14322 [(set (match_dup 4)
14323 (plus:SI (le:SI (match_dup 1) (match_dup 2))
14326 (compare:CC (match_dup 4)
14331 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
14333 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14334 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
14335 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
14337 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
14338 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14341 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
14342 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze.|addze.} %0,%3
14345 [(set_attr "type" "compare")
14346 (set_attr "length" "12,12,16,16")])
14349 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14351 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
14352 (match_operand:SI 2 "reg_or_short_operand" ""))
14353 (match_operand:SI 3 "gpc_reg_operand" ""))
14355 (set (match_operand:SI 0 "gpc_reg_operand" "")
14356 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14357 "TARGET_POWER && reload_completed"
14358 [(set (match_dup 0)
14359 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
14361 (compare:CC (match_dup 0)
14366 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
14367 (neg:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14368 (match_operand:SI 2 "reg_or_short_operand" "r,O"))))]
14371 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
14372 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{srai|srawi} %0,%0,31"
14373 [(set_attr "length" "12")])
14375 (define_insn "*leu<mode>"
14376 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
14377 (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
14378 (match_operand:P 2 "reg_or_short_operand" "rI")))]
14380 "{sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
14381 [(set_attr "type" "three")
14382 (set_attr "length" "12")])
14384 (define_insn "*leu<mode>_compare"
14385 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
14387 (leu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14388 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
14390 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
14391 (leu:P (match_dup 1) (match_dup 2)))]
14394 {sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
14396 [(set_attr "type" "compare")
14397 (set_attr "length" "12,16")])
14400 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
14402 (leu:P (match_operand:P 1 "gpc_reg_operand" "")
14403 (match_operand:P 2 "reg_or_short_operand" ""))
14405 (set (match_operand:P 0 "gpc_reg_operand" "")
14406 (leu:P (match_dup 1) (match_dup 2)))]
14408 [(set (match_dup 0)
14409 (leu:P (match_dup 1) (match_dup 2)))
14411 (compare:CC (match_dup 0)
14415 (define_insn "*plus_leu<mode>"
14416 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
14417 (plus:P (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
14418 (match_operand:P 2 "reg_or_short_operand" "rI"))
14419 (match_operand:P 3 "gpc_reg_operand" "r")))]
14421 "{sf%I2|subf%I2c} %0,%1,%2\;{aze|addze} %0,%3"
14422 [(set_attr "type" "two")
14423 (set_attr "length" "8")])
14426 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
14428 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14429 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14430 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14432 (clobber (match_scratch:SI 4 "=&r,&r"))]
14435 {sf%I2|subf%I2c} %4,%1,%2\;{aze.|addze.} %4,%3
14437 [(set_attr "type" "compare")
14438 (set_attr "length" "8,12")])
14441 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14443 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14444 (match_operand:SI 2 "reg_or_short_operand" ""))
14445 (match_operand:SI 3 "gpc_reg_operand" ""))
14447 (clobber (match_scratch:SI 4 ""))]
14448 "TARGET_32BIT && reload_completed"
14449 [(set (match_dup 4)
14450 (plus:SI (leu:SI (match_dup 1) (match_dup 2))
14453 (compare:CC (match_dup 4)
14458 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
14460 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14461 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14462 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14464 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
14465 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14468 {sf%I2|subf%I2c} %0,%1,%2\;{aze.|addze.} %0,%3
14470 [(set_attr "type" "compare")
14471 (set_attr "length" "8,12")])
14474 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14476 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14477 (match_operand:SI 2 "reg_or_short_operand" ""))
14478 (match_operand:SI 3 "gpc_reg_operand" ""))
14480 (set (match_operand:SI 0 "gpc_reg_operand" "")
14481 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14482 "TARGET_32BIT && reload_completed"
14483 [(set (match_dup 0)
14484 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
14486 (compare:CC (match_dup 0)
14490 (define_insn "*neg_leu<mode>"
14491 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
14492 (neg:P (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
14493 (match_operand:P 2 "reg_or_short_operand" "rI"))))]
14495 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0"
14496 [(set_attr "type" "three")
14497 (set_attr "length" "12")])
14499 (define_insn "*and_neg_leu<mode>"
14500 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
14502 (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
14503 (match_operand:P 2 "reg_or_short_operand" "rI")))
14504 (match_operand:P 3 "gpc_reg_operand" "r")))]
14506 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
14507 [(set_attr "type" "three")
14508 (set_attr "length" "12")])
14511 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
14514 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14515 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
14516 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14518 (clobber (match_scratch:SI 4 "=&r,&r"))]
14521 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
14523 [(set_attr "type" "compare")
14524 (set_attr "length" "12,16")])
14527 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14530 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14531 (match_operand:SI 2 "reg_or_short_operand" "")))
14532 (match_operand:SI 3 "gpc_reg_operand" ""))
14534 (clobber (match_scratch:SI 4 ""))]
14535 "TARGET_32BIT && reload_completed"
14536 [(set (match_dup 4)
14537 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
14540 (compare:CC (match_dup 4)
14545 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
14548 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14549 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
14550 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14552 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
14553 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
14556 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
14558 [(set_attr "type" "compare")
14559 (set_attr "length" "12,16")])
14562 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14565 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14566 (match_operand:SI 2 "reg_or_short_operand" "")))
14567 (match_operand:SI 3 "gpc_reg_operand" ""))
14569 (set (match_operand:SI 0 "gpc_reg_operand" "")
14570 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
14571 "TARGET_32BIT && reload_completed"
14572 [(set (match_dup 0)
14573 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
14576 (compare:CC (match_dup 0)
14581 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14582 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14583 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
14585 "doz%I2 %0,%1,%2\;nabs %0,%0\;{sri|srwi} %0,%0,31"
14586 [(set_attr "length" "12")])
14589 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
14591 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14592 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14594 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
14595 (lt:SI (match_dup 1) (match_dup 2)))]
14598 doz%I2 %0,%1,%2\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
14600 [(set_attr "type" "delayed_compare")
14601 (set_attr "length" "12,16")])
14604 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
14606 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14607 (match_operand:SI 2 "reg_or_short_operand" ""))
14609 (set (match_operand:SI 0 "gpc_reg_operand" "")
14610 (lt:SI (match_dup 1) (match_dup 2)))]
14611 "TARGET_POWER && reload_completed"
14612 [(set (match_dup 0)
14613 (lt:SI (match_dup 1) (match_dup 2)))
14615 (compare:CC (match_dup 0)
14620 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
14621 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14622 (match_operand:SI 2 "reg_or_short_operand" "rI"))
14623 (match_operand:SI 3 "gpc_reg_operand" "r")))]
14625 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
14626 [(set_attr "length" "12")])
14629 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
14631 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14632 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14633 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14635 (clobber (match_scratch:SI 4 "=&r,&r"))]
14638 doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
14640 [(set_attr "type" "compare")
14641 (set_attr "length" "12,16")])
14644 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14646 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14647 (match_operand:SI 2 "reg_or_short_operand" ""))
14648 (match_operand:SI 3 "gpc_reg_operand" ""))
14650 (clobber (match_scratch:SI 4 ""))]
14651 "TARGET_POWER && reload_completed"
14652 [(set (match_dup 4)
14653 (plus:SI (lt:SI (match_dup 1) (match_dup 2))
14656 (compare:CC (match_dup 4)
14661 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
14663 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14664 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14665 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14667 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
14668 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14671 doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
14673 [(set_attr "type" "compare")
14674 (set_attr "length" "12,16")])
14677 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14679 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14680 (match_operand:SI 2 "reg_or_short_operand" ""))
14681 (match_operand:SI 3 "gpc_reg_operand" ""))
14683 (set (match_operand:SI 0 "gpc_reg_operand" "")
14684 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14685 "TARGET_POWER && reload_completed"
14686 [(set (match_dup 0)
14687 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
14689 (compare:CC (match_dup 0)
14694 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14695 (neg:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14696 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
14698 "doz%I2 %0,%1,%2\;nabs %0,%0\;{srai|srawi} %0,%0,31"
14699 [(set_attr "length" "12")])
14701 (define_insn_and_split "*ltu<mode>"
14702 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
14703 (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14704 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))]
14708 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
14709 (set (match_dup 0) (neg:P (match_dup 0)))]
14712 (define_insn_and_split "*ltu<mode>_compare"
14713 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
14715 (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
14716 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
14718 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
14719 (ltu:P (match_dup 1) (match_dup 2)))]
14723 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
14724 (parallel [(set (match_dup 3)
14725 (compare:CC (neg:P (match_dup 0)) (const_int 0)))
14726 (set (match_dup 0) (neg:P (match_dup 0)))])]
14729 (define_insn_and_split "*plus_ltu<mode>"
14730 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,r")
14731 (plus:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14732 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))
14733 (match_operand:P 3 "reg_or_short_operand" "rI,rI")))]
14736 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
14737 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
14738 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))]
14741 (define_insn_and_split "*plus_ltu<mode>_compare"
14742 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
14744 (plus:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
14745 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
14746 (match_operand:P 3 "gpc_reg_operand" "r,r,r,r"))
14748 (set (match_operand:P 0 "gpc_reg_operand" "=&r,&r,&r,&r")
14749 (plus:P (ltu:P (match_dup 1) (match_dup 2)) (match_dup 3)))]
14752 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
14753 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
14754 (parallel [(set (match_dup 4)
14755 (compare:CC (minus:P (match_dup 3) (match_dup 0))
14757 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))])]
14760 (define_insn "*neg_ltu<mode>"
14761 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
14762 (neg:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14763 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))))]
14766 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0
14767 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0"
14768 [(set_attr "type" "two")
14769 (set_attr "length" "8")])
14772 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14773 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14774 (match_operand:SI 2 "reg_or_short_operand" "rI")))
14775 (clobber (match_scratch:SI 3 "=r"))]
14777 "doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3"
14778 [(set_attr "length" "12")])
14781 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
14783 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14784 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14786 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
14787 (ge:SI (match_dup 1) (match_dup 2)))
14788 (clobber (match_scratch:SI 3 "=r,r"))]
14791 doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
14793 [(set_attr "type" "compare")
14794 (set_attr "length" "12,16")])
14797 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14799 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
14800 (match_operand:SI 2 "reg_or_short_operand" ""))
14802 (set (match_operand:SI 0 "gpc_reg_operand" "")
14803 (ge:SI (match_dup 1) (match_dup 2)))
14804 (clobber (match_scratch:SI 3 ""))]
14805 "TARGET_POWER && reload_completed"
14806 [(parallel [(set (match_dup 0)
14807 (ge:SI (match_dup 1) (match_dup 2)))
14808 (clobber (match_dup 3))])
14810 (compare:CC (match_dup 0)
14815 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
14816 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14817 (match_operand:SI 2 "reg_or_short_operand" "rI"))
14818 (match_operand:SI 3 "gpc_reg_operand" "r")))]
14820 "doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
14821 [(set_attr "length" "12")])
14824 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
14826 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14827 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14828 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14830 (clobber (match_scratch:SI 4 "=&r,&r"))]
14833 doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
14835 [(set_attr "type" "compare")
14836 (set_attr "length" "12,16")])
14839 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14841 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
14842 (match_operand:SI 2 "reg_or_short_operand" ""))
14843 (match_operand:SI 3 "gpc_reg_operand" ""))
14845 (clobber (match_scratch:SI 4 ""))]
14846 "TARGET_POWER && reload_completed"
14847 [(set (match_dup 4)
14848 (plus:SI (ge:SI (match_dup 1) (match_dup 2))
14851 (compare:CC (match_dup 4)
14856 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
14858 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14859 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14860 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14862 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
14863 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14866 doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
14868 [(set_attr "type" "compare")
14869 (set_attr "length" "12,16")])
14872 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14874 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
14875 (match_operand:SI 2 "reg_or_short_operand" ""))
14876 (match_operand:SI 3 "gpc_reg_operand" ""))
14878 (set (match_operand:SI 0 "gpc_reg_operand" "")
14879 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14880 "TARGET_POWER && reload_completed"
14881 [(set (match_dup 0)
14882 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
14884 (compare:CC (match_dup 0)
14889 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14890 (neg:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14891 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
14893 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
14894 [(set_attr "length" "12")])
14896 (define_insn "*geu<mode>"
14897 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
14898 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14899 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))]
14902 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0
14903 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
14904 [(set_attr "type" "three")
14905 (set_attr "length" "12")])
14907 (define_insn "*geu<mode>_compare"
14908 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
14910 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
14911 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
14913 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
14914 (geu:P (match_dup 1) (match_dup 2)))]
14917 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
14918 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
14921 [(set_attr "type" "compare")
14922 (set_attr "length" "12,12,16,16")])
14925 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
14927 (geu:P (match_operand:P 1 "gpc_reg_operand" "")
14928 (match_operand:P 2 "reg_or_neg_short_operand" ""))
14930 (set (match_operand:P 0 "gpc_reg_operand" "")
14931 (geu:P (match_dup 1) (match_dup 2)))]
14933 [(set (match_dup 0)
14934 (geu:P (match_dup 1) (match_dup 2)))
14936 (compare:CC (match_dup 0)
14940 (define_insn "*plus_geu<mode>"
14941 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,&r")
14942 (plus:P (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14943 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))
14944 (match_operand:P 3 "gpc_reg_operand" "r,r")))]
14947 {sf|subfc} %0,%2,%1\;{aze|addze} %0,%3
14948 {ai|addic} %0,%1,%n2\;{aze|addze} %0,%3"
14949 [(set_attr "type" "two")
14950 (set_attr "length" "8")])
14953 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
14955 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14956 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
14957 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
14959 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
14962 {sf|subfc} %4,%2,%1\;{aze.|addze.} %4,%3
14963 {ai|addic} %4,%1,%n2\;{aze.|addze.} %4,%3
14966 [(set_attr "type" "compare")
14967 (set_attr "length" "8,8,12,12")])
14970 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14972 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14973 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
14974 (match_operand:SI 3 "gpc_reg_operand" ""))
14976 (clobber (match_scratch:SI 4 ""))]
14977 "TARGET_32BIT && reload_completed"
14978 [(set (match_dup 4)
14979 (plus:SI (geu:SI (match_dup 1) (match_dup 2))
14982 (compare:CC (match_dup 4)
14987 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
14989 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14990 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
14991 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
14993 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
14994 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14997 {sf|subfc} %0,%2,%1\;{aze.|addze.} %0,%3
14998 {ai|addic} %0,%1,%n2\;{aze.|addze.} %0,%3
15001 [(set_attr "type" "compare")
15002 (set_attr "length" "8,8,12,12")])
15005 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
15007 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
15008 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
15009 (match_operand:SI 3 "gpc_reg_operand" ""))
15011 (set (match_operand:SI 0 "gpc_reg_operand" "")
15012 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
15013 "TARGET_32BIT && reload_completed"
15014 [(set (match_dup 0)
15015 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
15017 (compare:CC (match_dup 0)
15021 (define_insn "*neg_geu<mode>"
15022 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
15023 (neg:P (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
15024 (match_operand:P 2 "reg_or_short_operand" "r,I"))))]
15027 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0
15028 {sfi|subfic} %0,%1,-1\;{a%I2|add%I2c} %0,%0,%2\;{sfe|subfe} %0,%0,%0"
15029 [(set_attr "type" "three")
15030 (set_attr "length" "12")])
15032 (define_insn "*and_neg_geu<mode>"
15033 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,&r")
15035 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
15036 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))
15037 (match_operand:P 3 "gpc_reg_operand" "r,r")))]
15040 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0
15041 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
15042 [(set_attr "type" "three")
15043 (set_attr "length" "12")])
15046 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
15049 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
15050 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
15051 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
15053 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
15056 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
15057 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
15060 [(set_attr "type" "compare")
15061 (set_attr "length" "12,12,16,16")])
15064 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
15067 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
15068 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
15069 (match_operand:SI 3 "gpc_reg_operand" ""))
15071 (clobber (match_scratch:SI 4 ""))]
15072 "TARGET_32BIT && reload_completed"
15073 [(set (match_dup 4)
15074 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2)))
15077 (compare:CC (match_dup 4)
15082 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
15085 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
15086 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
15087 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
15089 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
15090 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
15093 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
15094 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
15097 [(set_attr "type" "compare")
15098 (set_attr "length" "12,12,16,16")])
15101 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
15104 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
15105 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
15106 (match_operand:SI 3 "gpc_reg_operand" ""))
15108 (set (match_operand:SI 0 "gpc_reg_operand" "")
15109 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
15110 "TARGET_32BIT && reload_completed"
15111 [(set (match_dup 0)
15112 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
15114 (compare:CC (match_dup 0)
15119 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
15120 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
15121 (match_operand:SI 2 "reg_or_short_operand" "r")))]
15123 "doz %0,%2,%1\;nabs %0,%0\;{sri|srwi} %0,%0,31"
15124 [(set_attr "length" "12")])
15127 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
15129 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
15130 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
15132 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
15133 (gt:SI (match_dup 1) (match_dup 2)))]
15136 doz %0,%2,%1\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
15138 [(set_attr "type" "delayed_compare")
15139 (set_attr "length" "12,16")])
15142 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
15144 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
15145 (match_operand:SI 2 "reg_or_short_operand" ""))
15147 (set (match_operand:SI 0 "gpc_reg_operand" "")
15148 (gt:SI (match_dup 1) (match_dup 2)))]
15149 "TARGET_POWER && reload_completed"
15150 [(set (match_dup 0)
15151 (gt:SI (match_dup 1) (match_dup 2)))
15153 (compare:CC (match_dup 0)
15157 (define_insn "*plus_gt0<mode>"
15158 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
15159 (plus:P (gt:P (match_operand:P 1 "gpc_reg_operand" "r")
15161 (match_operand:P 2 "gpc_reg_operand" "r")))]
15163 "{a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze|addze} %0,%2"
15164 [(set_attr "type" "three")
15165 (set_attr "length" "12")])
15168 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
15170 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
15172 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
15174 (clobber (match_scratch:SI 3 "=&r,&r"))]
15177 {a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze.|addze.} %3,%2
15179 [(set_attr "type" "compare")
15180 (set_attr "length" "12,16")])
15183 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
15185 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
15187 (match_operand:SI 2 "gpc_reg_operand" ""))
15189 (clobber (match_scratch:SI 3 ""))]
15190 "TARGET_32BIT && reload_completed"
15191 [(set (match_dup 3)
15192 (plus:SI (gt:SI (match_dup 1) (const_int 0))
15195 (compare:CC (match_dup 3)
15200 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
15202 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
15204 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
15206 (clobber (match_scratch:DI 3 "=&r,&r"))]
15209 addc %3,%1,%1\;subfe %3,%1,%3\;addze. %3,%2
15211 [(set_attr "type" "compare")
15212 (set_attr "length" "12,16")])
15215 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
15217 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
15219 (match_operand:DI 2 "gpc_reg_operand" ""))
15221 (clobber (match_scratch:DI 3 ""))]
15222 "TARGET_64BIT && reload_completed"
15223 [(set (match_dup 3)
15224 (plus:DI (gt:DI (match_dup 1) (const_int 0))
15227 (compare:CC (match_dup 3)
15232 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
15234 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
15236 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
15238 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
15239 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
15242 {a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze.|addze.} %0,%2
15244 [(set_attr "type" "compare")
15245 (set_attr "length" "12,16")])
15248 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
15250 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
15252 (match_operand:SI 2 "gpc_reg_operand" ""))
15254 (set (match_operand:SI 0 "gpc_reg_operand" "")
15255 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
15256 "TARGET_32BIT && reload_completed"
15257 [(set (match_dup 0)
15258 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))
15260 (compare:CC (match_dup 0)
15265 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
15267 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
15269 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
15271 (set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
15272 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
15275 addc %0,%1,%1\;subfe %0,%1,%0\;addze. %0,%2
15277 [(set_attr "type" "compare")
15278 (set_attr "length" "12,16")])
15281 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
15283 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
15285 (match_operand:DI 2 "gpc_reg_operand" ""))
15287 (set (match_operand:DI 0 "gpc_reg_operand" "")
15288 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
15289 "TARGET_64BIT && reload_completed"
15290 [(set (match_dup 0)
15291 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))
15293 (compare:CC (match_dup 0)
15298 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
15299 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
15300 (match_operand:SI 2 "reg_or_short_operand" "r"))
15301 (match_operand:SI 3 "gpc_reg_operand" "r")))]
15303 "doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
15304 [(set_attr "length" "12")])
15307 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
15309 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
15310 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
15311 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
15313 (clobber (match_scratch:SI 4 "=&r,&r"))]
15316 doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
15318 [(set_attr "type" "compare")
15319 (set_attr "length" "12,16")])
15322 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
15324 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
15325 (match_operand:SI 2 "reg_or_short_operand" ""))
15326 (match_operand:SI 3 "gpc_reg_operand" ""))
15328 (clobber (match_scratch:SI 4 ""))]
15329 "TARGET_POWER && reload_completed"
15330 [(set (match_dup 4)
15331 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
15333 (compare:CC (match_dup 4)
15338 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
15340 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
15341 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
15342 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
15344 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
15345 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
15348 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
15350 [(set_attr "type" "compare")
15351 (set_attr "length" "12,16")])
15354 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
15356 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
15357 (match_operand:SI 2 "reg_or_short_operand" ""))
15358 (match_operand:SI 3 "gpc_reg_operand" ""))
15360 (set (match_operand:SI 0 "gpc_reg_operand" "")
15361 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
15362 "TARGET_POWER && reload_completed"
15363 [(set (match_dup 0)
15364 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
15366 (compare:CC (match_dup 0)
15371 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
15372 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
15373 (match_operand:SI 2 "reg_or_short_operand" "r"))))]
15375 "doz %0,%2,%1\;nabs %0,%0\;{srai|srawi} %0,%0,31"
15376 [(set_attr "length" "12")])
15378 (define_insn_and_split "*gtu<mode>"
15379 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
15380 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
15381 (match_operand:P 2 "reg_or_short_operand" "rI")))]
15385 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
15386 (set (match_dup 0) (neg:P (match_dup 0)))]
15389 (define_insn_and_split "*gtu<mode>_compare"
15390 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
15392 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
15393 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
15395 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
15396 (gtu:P (match_dup 1) (match_dup 2)))]
15400 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
15401 (parallel [(set (match_dup 3)
15402 (compare:CC (neg:P (match_dup 0)) (const_int 0)))
15403 (set (match_dup 0) (neg:P (match_dup 0)))])]
15406 (define_insn_and_split "*plus_gtu<mode>"
15407 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
15408 (plus:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
15409 (match_operand:P 2 "reg_or_short_operand" "rI"))
15410 (match_operand:P 3 "reg_or_short_operand" "rI")))]
15413 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
15414 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
15415 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))]
15418 (define_insn_and_split "*plus_gtu<mode>_compare"
15419 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
15421 (plus:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
15422 (match_operand:P 2 "reg_or_short_operand" "I,r,I,r"))
15423 (match_operand:P 3 "gpc_reg_operand" "r,r,r,r"))
15425 (set (match_operand:P 0 "gpc_reg_operand" "=&r,&r,&r,&r")
15426 (plus:P (gtu:P (match_dup 1) (match_dup 2)) (match_dup 3)))]
15429 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
15430 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
15431 (parallel [(set (match_dup 4)
15432 (compare:CC (minus:P (match_dup 3) (match_dup 0))
15434 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))])]
15437 (define_insn "*neg_gtu<mode>"
15438 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
15439 (neg:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
15440 (match_operand:P 2 "reg_or_short_operand" "rI"))))]
15442 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0"
15443 [(set_attr "type" "two")
15444 (set_attr "length" "8")])
15447 ;; Define both directions of branch and return. If we need a reload
15448 ;; register, we'd rather use CR0 since it is much easier to copy a
15449 ;; register CC value to there.
15453 (if_then_else (match_operator 1 "branch_comparison_operator"
15455 "cc_reg_operand" "y")
15457 (label_ref (match_operand 0 "" ""))
15462 return output_cbranch (operands[1], \"%l0\", 0, insn);
15464 [(set_attr "type" "branch")])
15468 (if_then_else (match_operator 0 "branch_comparison_operator"
15470 "cc_reg_operand" "y")
15477 return output_cbranch (operands[0], NULL, 0, insn);
15479 [(set_attr "type" "jmpreg")
15480 (set_attr "length" "4")])
15484 (if_then_else (match_operator 1 "branch_comparison_operator"
15486 "cc_reg_operand" "y")
15489 (label_ref (match_operand 0 "" ""))))]
15493 return output_cbranch (operands[1], \"%l0\", 1, insn);
15495 [(set_attr "type" "branch")])
15499 (if_then_else (match_operator 0 "branch_comparison_operator"
15501 "cc_reg_operand" "y")
15508 return output_cbranch (operands[0], NULL, 1, insn);
15510 [(set_attr "type" "jmpreg")
15511 (set_attr "length" "4")])
15513 ;; Logic on condition register values.
15515 ; This pattern matches things like
15516 ; (set (reg:CCEQ 68) (compare:CCEQ (ior:SI (gt:SI (reg:CCFP 68) (const_int 0))
15517 ; (eq:SI (reg:CCFP 68) (const_int 0)))
15519 ; which are generated by the branch logic.
15520 ; Prefer destructive operations where BT = BB (for crXX BT,BA,BB)
15522 (define_insn "*cceq_ior_compare"
15523 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
15524 (compare:CCEQ (match_operator:SI 1 "boolean_operator"
15525 [(match_operator:SI 2
15526 "branch_positive_comparison_operator"
15528 "cc_reg_operand" "y,y")
15530 (match_operator:SI 4
15531 "branch_positive_comparison_operator"
15533 "cc_reg_operand" "0,y")
15537 "cr%q1 %E0,%j2,%j4"
15538 [(set_attr "type" "cr_logical,delayed_cr")])
15540 ; Why is the constant -1 here, but 1 in the previous pattern?
15541 ; Because ~1 has all but the low bit set.
15543 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
15544 (compare:CCEQ (match_operator:SI 1 "boolean_or_operator"
15545 [(not:SI (match_operator:SI 2
15546 "branch_positive_comparison_operator"
15548 "cc_reg_operand" "y,y")
15550 (match_operator:SI 4
15551 "branch_positive_comparison_operator"
15553 "cc_reg_operand" "0,y")
15557 "cr%q1 %E0,%j2,%j4"
15558 [(set_attr "type" "cr_logical,delayed_cr")])
15560 (define_insn "*cceq_rev_compare"
15561 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
15562 (compare:CCEQ (match_operator:SI 1
15563 "branch_positive_comparison_operator"
15565 "cc_reg_operand" "0,y")
15569 "{crnor %E0,%j1,%j1|crnot %E0,%j1}"
15570 [(set_attr "type" "cr_logical,delayed_cr")])
15572 ;; If we are comparing the result of two comparisons, this can be done
15573 ;; using creqv or crxor.
15575 (define_insn_and_split ""
15576 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
15577 (compare:CCEQ (match_operator 1 "branch_comparison_operator"
15578 [(match_operand 2 "cc_reg_operand" "y")
15580 (match_operator 3 "branch_comparison_operator"
15581 [(match_operand 4 "cc_reg_operand" "y")
15586 [(set (match_dup 0) (compare:CCEQ (xor:SI (match_dup 1) (match_dup 3))
15590 int positive_1, positive_2;
15592 positive_1 = branch_positive_comparison_operator (operands[1],
15593 GET_MODE (operands[1]));
15594 positive_2 = branch_positive_comparison_operator (operands[3],
15595 GET_MODE (operands[3]));
15598 operands[1] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[2]),
15599 GET_CODE (operands[1])),
15601 operands[2], const0_rtx);
15602 else if (GET_MODE (operands[1]) != SImode)
15603 operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]), SImode,
15604 operands[2], const0_rtx);
15607 operands[3] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[4]),
15608 GET_CODE (operands[3])),
15610 operands[4], const0_rtx);
15611 else if (GET_MODE (operands[3]) != SImode)
15612 operands[3] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
15613 operands[4], const0_rtx);
15615 if (positive_1 == positive_2)
15617 operands[1] = gen_rtx_NOT (SImode, operands[1]);
15618 operands[5] = constm1_rtx;
15622 operands[5] = const1_rtx;
15626 ;; Unconditional branch and return.
15628 (define_insn "jump"
15630 (label_ref (match_operand 0 "" "")))]
15633 [(set_attr "type" "branch")])
15635 (define_insn "<return_str>return"
15639 [(set_attr "type" "jmpreg")])
15641 (define_expand "indirect_jump"
15642 [(set (pc) (match_operand 0 "register_operand" ""))])
15644 (define_insn "*indirect_jump<mode>"
15645 [(set (pc) (match_operand:P 0 "register_operand" "c,*l"))]
15650 [(set_attr "type" "jmpreg")])
15652 ;; Table jump for switch statements:
15653 (define_expand "tablejump"
15654 [(use (match_operand 0 "" ""))
15655 (use (label_ref (match_operand 1 "" "")))]
15660 emit_jump_insn (gen_tablejumpsi (operands[0], operands[1]));
15662 emit_jump_insn (gen_tablejumpdi (operands[0], operands[1]));
15666 (define_expand "tablejumpsi"
15667 [(set (match_dup 3)
15668 (plus:SI (match_operand:SI 0 "" "")
15670 (parallel [(set (pc) (match_dup 3))
15671 (use (label_ref (match_operand 1 "" "")))])]
15674 { operands[0] = force_reg (SImode, operands[0]);
15675 operands[2] = force_reg (SImode, gen_rtx_LABEL_REF (SImode, operands[1]));
15676 operands[3] = gen_reg_rtx (SImode);
15679 (define_expand "tablejumpdi"
15680 [(set (match_dup 4)
15681 (sign_extend:DI (match_operand:SI 0 "lwa_operand" "")))
15683 (plus:DI (match_dup 4)
15685 (parallel [(set (pc) (match_dup 3))
15686 (use (label_ref (match_operand 1 "" "")))])]
15689 { operands[2] = force_reg (DImode, gen_rtx_LABEL_REF (DImode, operands[1]));
15690 operands[3] = gen_reg_rtx (DImode);
15691 operands[4] = gen_reg_rtx (DImode);
15694 (define_insn "*tablejump<mode>_internal1"
15696 (match_operand:P 0 "register_operand" "c,*l"))
15697 (use (label_ref (match_operand 1 "" "")))]
15702 [(set_attr "type" "jmpreg")])
15707 "{cror 0,0,0|nop}")
15709 (define_insn "group_ending_nop"
15710 [(unspec [(const_int 0)] UNSPEC_GRP_END_NOP)]
15714 if (rs6000_cpu_attr == CPU_POWER6)
15715 return \"ori 1,1,0\";
15716 return \"ori 2,2,0\";
15719 ;; Define the subtract-one-and-jump insns, starting with the template
15720 ;; so loop.c knows what to generate.
15722 (define_expand "doloop_end"
15723 [(use (match_operand 0 "" "")) ; loop pseudo
15724 (use (match_operand 1 "" "")) ; iterations; zero if unknown
15725 (use (match_operand 2 "" "")) ; max iterations
15726 (use (match_operand 3 "" "")) ; loop level
15727 (use (match_operand 4 "" ""))] ; label
15731 /* Only use this on innermost loops. */
15732 if (INTVAL (operands[3]) > 1)
15736 if (GET_MODE (operands[0]) != DImode)
15738 emit_jump_insn (gen_ctrdi (operands[0], operands[4]));
15742 if (GET_MODE (operands[0]) != SImode)
15744 emit_jump_insn (gen_ctrsi (operands[0], operands[4]));
15749 (define_expand "ctr<mode>"
15750 [(parallel [(set (pc)
15751 (if_then_else (ne (match_operand:P 0 "register_operand" "")
15753 (label_ref (match_operand 1 "" ""))
15756 (plus:P (match_dup 0)
15758 (clobber (match_scratch:CC 2 ""))
15759 (clobber (match_scratch:P 3 ""))])]
15763 ;; We need to be able to do this for any operand, including MEM, or we
15764 ;; will cause reload to blow up since we don't allow output reloads on
15766 ;; For the length attribute to be calculated correctly, the
15767 ;; label MUST be operand 0.
15769 (define_insn "*ctr<mode>_internal1"
15771 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
15773 (label_ref (match_operand 0 "" ""))
15775 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
15776 (plus:P (match_dup 1)
15778 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
15779 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
15783 if (which_alternative != 0)
15785 else if (get_attr_length (insn) == 4)
15786 return \"{bdn|bdnz} %l0\";
15788 return \"bdz $+8\;b %l0\";
15790 [(set_attr "type" "branch")
15791 (set_attr "length" "*,12,16,16")])
15793 (define_insn "*ctr<mode>_internal2"
15795 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
15798 (label_ref (match_operand 0 "" ""))))
15799 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
15800 (plus:P (match_dup 1)
15802 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
15803 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
15807 if (which_alternative != 0)
15809 else if (get_attr_length (insn) == 4)
15810 return \"bdz %l0\";
15812 return \"{bdn|bdnz} $+8\;b %l0\";
15814 [(set_attr "type" "branch")
15815 (set_attr "length" "*,12,16,16")])
15817 ;; Similar but use EQ
15819 (define_insn "*ctr<mode>_internal5"
15821 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
15823 (label_ref (match_operand 0 "" ""))
15825 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
15826 (plus:P (match_dup 1)
15828 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
15829 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
15833 if (which_alternative != 0)
15835 else if (get_attr_length (insn) == 4)
15836 return \"bdz %l0\";
15838 return \"{bdn|bdnz} $+8\;b %l0\";
15840 [(set_attr "type" "branch")
15841 (set_attr "length" "*,12,16,16")])
15843 (define_insn "*ctr<mode>_internal6"
15845 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
15848 (label_ref (match_operand 0 "" ""))))
15849 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
15850 (plus:P (match_dup 1)
15852 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
15853 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
15857 if (which_alternative != 0)
15859 else if (get_attr_length (insn) == 4)
15860 return \"{bdn|bdnz} %l0\";
15862 return \"bdz $+8\;b %l0\";
15864 [(set_attr "type" "branch")
15865 (set_attr "length" "*,12,16,16")])
15867 ;; Now the splitters if we could not allocate the CTR register
15871 (if_then_else (match_operator 2 "comparison_operator"
15872 [(match_operand:P 1 "gpc_reg_operand" "")
15874 (match_operand 5 "" "")
15875 (match_operand 6 "" "")))
15876 (set (match_operand:P 0 "gpc_reg_operand" "")
15877 (plus:P (match_dup 1) (const_int -1)))
15878 (clobber (match_scratch:CC 3 ""))
15879 (clobber (match_scratch:P 4 ""))]
15881 [(parallel [(set (match_dup 3)
15882 (compare:CC (plus:P (match_dup 1)
15886 (plus:P (match_dup 1)
15888 (set (pc) (if_then_else (match_dup 7)
15892 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
15893 operands[3], const0_rtx); }")
15897 (if_then_else (match_operator 2 "comparison_operator"
15898 [(match_operand:P 1 "gpc_reg_operand" "")
15900 (match_operand 5 "" "")
15901 (match_operand 6 "" "")))
15902 (set (match_operand:P 0 "nonimmediate_operand" "")
15903 (plus:P (match_dup 1) (const_int -1)))
15904 (clobber (match_scratch:CC 3 ""))
15905 (clobber (match_scratch:P 4 ""))]
15906 "reload_completed && ! gpc_reg_operand (operands[0], SImode)"
15907 [(parallel [(set (match_dup 3)
15908 (compare:CC (plus:P (match_dup 1)
15912 (plus:P (match_dup 1)
15916 (set (pc) (if_then_else (match_dup 7)
15920 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
15921 operands[3], const0_rtx); }")
15923 (define_insn "trap"
15924 [(trap_if (const_int 1) (const_int 0))]
15927 [(set_attr "type" "trap")])
15929 (define_expand "ctrap<mode>4"
15930 [(trap_if (match_operator 0 "ordered_comparison_operator"
15931 [(match_operand:GPR 1 "register_operand")
15932 (match_operand:GPR 2 "reg_or_short_operand")])
15933 (match_operand 3 "zero_constant" ""))]
15938 [(trap_if (match_operator 0 "ordered_comparison_operator"
15939 [(match_operand:GPR 1 "register_operand" "r")
15940 (match_operand:GPR 2 "reg_or_short_operand" "rI")])
15943 "{t|t<wd>}%V0%I2 %1,%2"
15944 [(set_attr "type" "trap")])
15946 ;; Insns related to generating the function prologue and epilogue.
15948 (define_expand "prologue"
15949 [(use (const_int 0))]
15952 rs6000_emit_prologue ();
15953 if (!TARGET_SCHED_PROLOG)
15954 emit_insn (gen_blockage ());
15958 (define_insn "*movesi_from_cr_one"
15959 [(match_parallel 0 "mfcr_operation"
15960 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
15961 (unspec:SI [(match_operand:CC 2 "cc_reg_operand" "y")
15962 (match_operand 3 "immediate_operand" "n")]
15963 UNSPEC_MOVESI_FROM_CR))])]
15969 for (i = 0; i < XVECLEN (operands[0], 0); i++)
15971 mask = INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
15972 operands[4] = GEN_INT (mask);
15973 output_asm_insn (\"mfcr %1,%4\", operands);
15977 [(set_attr "type" "mfcrf")])
15979 (define_insn "movesi_from_cr"
15980 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
15981 (unspec:SI [(reg:CC CR0_REGNO) (reg:CC CR1_REGNO)
15982 (reg:CC CR2_REGNO) (reg:CC CR3_REGNO)
15983 (reg:CC CR4_REGNO) (reg:CC CR5_REGNO)
15984 (reg:CC CR6_REGNO) (reg:CC CR7_REGNO)]
15985 UNSPEC_MOVESI_FROM_CR))]
15988 [(set_attr "type" "mfcr")])
15990 (define_insn "*stmw"
15991 [(match_parallel 0 "stmw_operation"
15992 [(set (match_operand:SI 1 "memory_operand" "=m")
15993 (match_operand:SI 2 "gpc_reg_operand" "r"))])]
15996 [(set_attr "type" "store_ux")])
15998 ; The following comment applies to:
16002 ; return_and_restore_gpregs*
16003 ; return_and_restore_fpregs*
16004 ; return_and_restore_fpregs_aix*
16006 ; The out-of-line save / restore functions expects one input argument.
16007 ; Since those are not standard call_insn's, we must avoid using
16008 ; MATCH_OPERAND for that argument. That way the register rename
16009 ; optimization will not try to rename this register.
16010 ; Each pattern is repeated for each possible register number used in
16011 ; various ABIs (r11, r1, and for some functions r12)
16013 (define_insn "*save_gpregs_<mode>_r11"
16014 [(match_parallel 0 "any_parallel_operand"
16015 [(clobber (reg:P 65))
16016 (use (match_operand:P 1 "symbol_ref_operand" "s"))
16018 (set (match_operand:P 2 "memory_operand" "=m")
16019 (match_operand:P 3 "gpc_reg_operand" "r"))])]
16022 [(set_attr "type" "branch")
16023 (set_attr "length" "4")])
16025 (define_insn "*save_gpregs_<mode>_r12"
16026 [(match_parallel 0 "any_parallel_operand"
16027 [(clobber (reg:P 65))
16028 (use (match_operand:P 1 "symbol_ref_operand" "s"))
16030 (set (match_operand:P 2 "memory_operand" "=m")
16031 (match_operand:P 3 "gpc_reg_operand" "r"))])]
16034 [(set_attr "type" "branch")
16035 (set_attr "length" "4")])
16037 (define_insn "*save_gpregs_<mode>_r1"
16038 [(match_parallel 0 "any_parallel_operand"
16039 [(clobber (reg:P 65))
16040 (use (match_operand:P 1 "symbol_ref_operand" "s"))
16042 (set (match_operand:P 2 "memory_operand" "=m")
16043 (match_operand:P 3 "gpc_reg_operand" "r"))])]
16046 [(set_attr "type" "branch")
16047 (set_attr "length" "4")])
16049 (define_insn "*save_fpregs_<mode>_r11"
16050 [(match_parallel 0 "any_parallel_operand"
16051 [(clobber (reg:P 65))
16052 (use (match_operand:P 1 "symbol_ref_operand" "s"))
16054 (set (match_operand:DF 2 "memory_operand" "=m")
16055 (match_operand:DF 3 "gpc_reg_operand" "d"))])]
16058 [(set_attr "type" "branch")
16059 (set_attr "length" "4")])
16061 (define_insn "*save_fpregs_<mode>_r12"
16062 [(match_parallel 0 "any_parallel_operand"
16063 [(clobber (reg:P 65))
16064 (use (match_operand:P 1 "symbol_ref_operand" "s"))
16066 (set (match_operand:DF 2 "memory_operand" "=m")
16067 (match_operand:DF 3 "gpc_reg_operand" "d"))])]
16070 [(set_attr "type" "branch")
16071 (set_attr "length" "4")])
16073 (define_insn "*save_fpregs_<mode>_r1"
16074 [(match_parallel 0 "any_parallel_operand"
16075 [(clobber (reg:P 65))
16076 (use (match_operand:P 1 "symbol_ref_operand" "s"))
16078 (set (match_operand:DF 2 "memory_operand" "=m")
16079 (match_operand:DF 3 "gpc_reg_operand" "d"))])]
16082 [(set_attr "type" "branch")
16083 (set_attr "length" "4")])
16085 ; These are to explain that changes to the stack pointer should
16086 ; not be moved over stores to stack memory.
16087 (define_insn "stack_tie"
16088 [(set (match_operand:BLK 0 "memory_operand" "+m")
16089 (unspec:BLK [(match_dup 0)] UNSPEC_TIE))]
16092 [(set_attr "length" "0")])
16094 ; Like stack_tie, but depend on both fp and sp based memory.
16095 (define_insn "frame_tie"
16096 [(set (match_operand:BLK 0 "memory_operand" "+m")
16097 (unspec:BLK [(match_dup 0)
16098 (match_operand:BLK 1 "memory_operand" "m")] UNSPEC_TIE))]
16101 [(set_attr "length" "0")])
16104 (define_expand "epilogue"
16105 [(use (const_int 0))]
16108 if (!TARGET_SCHED_PROLOG)
16109 emit_insn (gen_blockage ());
16110 rs6000_emit_epilogue (FALSE);
16114 ; On some processors, doing the mtcrf one CC register at a time is
16115 ; faster (like on the 604e). On others, doing them all at once is
16116 ; faster; for instance, on the 601 and 750.
16118 (define_expand "movsi_to_cr_one"
16119 [(set (match_operand:CC 0 "cc_reg_operand" "")
16120 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "")
16121 (match_dup 2)] UNSPEC_MOVESI_TO_CR))]
16123 "operands[2] = GEN_INT (1 << (75 - REGNO (operands[0])));")
16125 (define_insn "*movsi_to_cr"
16126 [(match_parallel 0 "mtcrf_operation"
16127 [(set (match_operand:CC 1 "cc_reg_operand" "=y")
16128 (unspec:CC [(match_operand:SI 2 "gpc_reg_operand" "r")
16129 (match_operand 3 "immediate_operand" "n")]
16130 UNSPEC_MOVESI_TO_CR))])]
16136 for (i = 0; i < XVECLEN (operands[0], 0); i++)
16137 mask |= INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
16138 operands[4] = GEN_INT (mask);
16139 return \"mtcrf %4,%2\";
16141 [(set_attr "type" "mtcr")])
16143 (define_insn "*mtcrfsi"
16144 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
16145 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
16146 (match_operand 2 "immediate_operand" "n")]
16147 UNSPEC_MOVESI_TO_CR))]
16148 "GET_CODE (operands[0]) == REG
16149 && CR_REGNO_P (REGNO (operands[0]))
16150 && GET_CODE (operands[2]) == CONST_INT
16151 && INTVAL (operands[2]) == 1 << (75 - REGNO (operands[0]))"
16153 [(set_attr "type" "mtcr")])
16155 ; The load-multiple instructions have similar properties.
16156 ; Note that "load_multiple" is a name known to the machine-independent
16157 ; code that actually corresponds to the PowerPC load-string.
16159 (define_insn "*lmw"
16160 [(match_parallel 0 "lmw_operation"
16161 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
16162 (match_operand:SI 2 "memory_operand" "m"))])]
16165 [(set_attr "type" "load_ux")
16166 (set_attr "cell_micro" "always")])
16168 (define_insn "*return_internal_<mode>"
16170 (use (match_operand:P 0 "register_operand" "lc"))]
16173 [(set_attr "type" "jmpreg")])
16175 ; FIXME: This would probably be somewhat simpler if the Cygnus sibcall
16176 ; stuff was in GCC. Oh, and "any_parallel_operand" is a bit flexible...
16178 ; The following comment applies to:
16182 ; return_and_restore_gpregs*
16183 ; return_and_restore_fpregs*
16184 ; return_and_restore_fpregs_aix*
16186 ; The out-of-line save / restore functions expects one input argument.
16187 ; Since those are not standard call_insn's, we must avoid using
16188 ; MATCH_OPERAND for that argument. That way the register rename
16189 ; optimization will not try to rename this register.
16190 ; Each pattern is repeated for each possible register number used in
16191 ; various ABIs (r11, r1, and for some functions r12)
16193 (define_insn "*restore_gpregs_<mode>_r11"
16194 [(match_parallel 0 "any_parallel_operand"
16195 [(clobber (match_operand:P 1 "register_operand" "=l"))
16196 (use (match_operand:P 2 "symbol_ref_operand" "s"))
16198 (set (match_operand:P 3 "gpc_reg_operand" "=r")
16199 (match_operand:P 4 "memory_operand" "m"))])]
16202 [(set_attr "type" "branch")
16203 (set_attr "length" "4")])
16205 (define_insn "*restore_gpregs_<mode>_r12"
16206 [(match_parallel 0 "any_parallel_operand"
16207 [(clobber (match_operand:P 1 "register_operand" "=l"))
16208 (use (match_operand:P 2 "symbol_ref_operand" "s"))
16210 (set (match_operand:P 3 "gpc_reg_operand" "=r")
16211 (match_operand:P 4 "memory_operand" "m"))])]
16214 [(set_attr "type" "branch")
16215 (set_attr "length" "4")])
16217 (define_insn "*restore_gpregs_<mode>_r1"
16218 [(match_parallel 0 "any_parallel_operand"
16219 [(clobber (match_operand:P 1 "register_operand" "=l"))
16220 (use (match_operand:P 2 "symbol_ref_operand" "s"))
16222 (set (match_operand:P 3 "gpc_reg_operand" "=r")
16223 (match_operand:P 4 "memory_operand" "m"))])]
16226 [(set_attr "type" "branch")
16227 (set_attr "length" "4")])
16229 (define_insn "*return_and_restore_gpregs_<mode>_r11"
16230 [(match_parallel 0 "any_parallel_operand"
16232 (clobber (match_operand:P 1 "register_operand" "=l"))
16233 (use (match_operand:P 2 "symbol_ref_operand" "s"))
16235 (set (match_operand:P 3 "gpc_reg_operand" "=r")
16236 (match_operand:P 4 "memory_operand" "m"))])]
16239 [(set_attr "type" "branch")
16240 (set_attr "length" "4")])
16242 (define_insn "*return_and_restore_gpregs_<mode>_r12"
16243 [(match_parallel 0 "any_parallel_operand"
16245 (clobber (match_operand:P 1 "register_operand" "=l"))
16246 (use (match_operand:P 2 "symbol_ref_operand" "s"))
16248 (set (match_operand:P 3 "gpc_reg_operand" "=r")
16249 (match_operand:P 4 "memory_operand" "m"))])]
16252 [(set_attr "type" "branch")
16253 (set_attr "length" "4")])
16255 (define_insn "*return_and_restore_gpregs_<mode>_r1"
16256 [(match_parallel 0 "any_parallel_operand"
16258 (clobber (match_operand:P 1 "register_operand" "=l"))
16259 (use (match_operand:P 2 "symbol_ref_operand" "s"))
16261 (set (match_operand:P 3 "gpc_reg_operand" "=r")
16262 (match_operand:P 4 "memory_operand" "m"))])]
16265 [(set_attr "type" "branch")
16266 (set_attr "length" "4")])
16268 (define_insn "*return_and_restore_fpregs_<mode>_r11"
16269 [(match_parallel 0 "any_parallel_operand"
16271 (clobber (match_operand:P 1 "register_operand" "=l"))
16272 (use (match_operand:P 2 "symbol_ref_operand" "s"))
16274 (set (match_operand:DF 3 "gpc_reg_operand" "=d")
16275 (match_operand:DF 4 "memory_operand" "m"))])]
16278 [(set_attr "type" "branch")
16279 (set_attr "length" "4")])
16281 (define_insn "*return_and_restore_fpregs_<mode>_r12"
16282 [(match_parallel 0 "any_parallel_operand"
16284 (clobber (match_operand:P 1 "register_operand" "=l"))
16285 (use (match_operand:P 2 "symbol_ref_operand" "s"))
16287 (set (match_operand:DF 3 "gpc_reg_operand" "=d")
16288 (match_operand:DF 4 "memory_operand" "m"))])]
16291 [(set_attr "type" "branch")
16292 (set_attr "length" "4")])
16294 (define_insn "*return_and_restore_fpregs_<mode>_r1"
16295 [(match_parallel 0 "any_parallel_operand"
16297 (clobber (match_operand:P 1 "register_operand" "=l"))
16298 (use (match_operand:P 2 "symbol_ref_operand" "s"))
16300 (set (match_operand:DF 3 "gpc_reg_operand" "=d")
16301 (match_operand:DF 4 "memory_operand" "m"))])]
16304 [(set_attr "type" "branch")
16305 (set_attr "length" "4")])
16307 (define_insn "*return_and_restore_fpregs_aix_<mode>_r11"
16308 [(match_parallel 0 "any_parallel_operand"
16310 (use (match_operand:P 1 "register_operand" "l"))
16311 (use (match_operand:P 2 "symbol_ref_operand" "s"))
16313 (set (match_operand:DF 3 "gpc_reg_operand" "=d")
16314 (match_operand:DF 4 "memory_operand" "m"))])]
16317 [(set_attr "type" "branch")
16318 (set_attr "length" "4")])
16320 (define_insn "*return_and_restore_fpregs_aix_<mode>_r1"
16321 [(match_parallel 0 "any_parallel_operand"
16323 (use (match_operand:P 1 "register_operand" "l"))
16324 (use (match_operand:P 2 "symbol_ref_operand" "s"))
16326 (set (match_operand:DF 3 "gpc_reg_operand" "=d")
16327 (match_operand:DF 4 "memory_operand" "m"))])]
16330 [(set_attr "type" "branch")
16331 (set_attr "length" "4")])
16333 ; This is used in compiling the unwind routines.
16334 (define_expand "eh_return"
16335 [(use (match_operand 0 "general_operand" ""))]
16340 emit_insn (gen_eh_set_lr_si (operands[0]));
16342 emit_insn (gen_eh_set_lr_di (operands[0]));
16346 ; We can't expand this before we know where the link register is stored.
16347 (define_insn "eh_set_lr_<mode>"
16348 [(unspec_volatile [(match_operand:P 0 "register_operand" "r")]
16350 (clobber (match_scratch:P 1 "=&b"))]
16355 [(unspec_volatile [(match_operand 0 "register_operand" "")] UNSPECV_EH_RR)
16356 (clobber (match_scratch 1 ""))]
16361 rs6000_emit_eh_reg_restore (operands[0], operands[1]);
16365 (define_insn "prefetch"
16366 [(prefetch (match_operand 0 "indexed_or_indirect_address" "a")
16367 (match_operand:SI 1 "const_int_operand" "n")
16368 (match_operand:SI 2 "const_int_operand" "n"))]
16372 if (GET_CODE (operands[0]) == REG)
16373 return INTVAL (operands[1]) ? \"dcbtst 0,%0\" : \"dcbt 0,%0\";
16374 return INTVAL (operands[1]) ? \"dcbtst %a0\" : \"dcbt %a0\";
16376 [(set_attr "type" "load")])
16378 (define_insn "bpermd_<mode>"
16379 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
16380 (unspec:P [(match_operand:P 1 "gpc_reg_operand" "r")
16381 (match_operand:P 2 "gpc_reg_operand" "r")] UNSPEC_BPERM))]
16384 [(set_attr "type" "integer")])
16387 ;; Builtin fma support. Handle
16388 ;; Note that the conditions for expansion are in the FMA_F iterator.
16390 (define_expand "fma<mode>4"
16391 [(set (match_operand:FMA_F 0 "register_operand" "")
16393 (match_operand:FMA_F 1 "register_operand" "")
16394 (match_operand:FMA_F 2 "register_operand" "")
16395 (match_operand:FMA_F 3 "register_operand" "")))]
16399 ; Altivec only has fma and nfms.
16400 (define_expand "fms<mode>4"
16401 [(set (match_operand:FMA_F 0 "register_operand" "")
16403 (match_operand:FMA_F 1 "register_operand" "")
16404 (match_operand:FMA_F 2 "register_operand" "")
16405 (neg:FMA_F (match_operand:FMA_F 3 "register_operand" ""))))]
16406 "!VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
16409 ;; If signed zeros are ignored, -(a * b - c) = -a * b + c.
16410 (define_expand "fnma<mode>4"
16411 [(set (match_operand:FMA_F 0 "register_operand" "")
16414 (match_operand:FMA_F 1 "register_operand" "")
16415 (match_operand:FMA_F 2 "register_operand" "")
16416 (neg:FMA_F (match_operand:FMA_F 3 "register_operand" "")))))]
16417 "!HONOR_SIGNED_ZEROS (<MODE>mode)"
16420 ;; If signed zeros are ignored, -(a * b + c) = -a * b - c.
16421 (define_expand "fnms<mode>4"
16422 [(set (match_operand:FMA_F 0 "register_operand" "")
16425 (match_operand:FMA_F 1 "register_operand" "")
16426 (match_operand:FMA_F 2 "register_operand" "")
16427 (match_operand:FMA_F 3 "register_operand" ""))))]
16428 "!HONOR_SIGNED_ZEROS (<MODE>mode) && !VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
16431 ; Not an official optab name, but used from builtins.
16432 (define_expand "nfma<mode>4"
16433 [(set (match_operand:FMA_F 0 "register_operand" "")
16436 (match_operand:FMA_F 1 "register_operand" "")
16437 (match_operand:FMA_F 2 "register_operand" "")
16438 (match_operand:FMA_F 3 "register_operand" ""))))]
16439 "!VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
16442 ; Not an official optab name, but used from builtins.
16443 (define_expand "nfms<mode>4"
16444 [(set (match_operand:FMA_F 0 "register_operand" "")
16447 (match_operand:FMA_F 1 "register_operand" "")
16448 (match_operand:FMA_F 2 "register_operand" "")
16449 (neg:FMA_F (match_operand:FMA_F 3 "register_operand" "")))))]
16455 (include "sync.md")
16456 (include "vector.md")
16458 (include "altivec.md")
16461 (include "paired.md")