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
119 UNSPEC_MACHOPIC_OFFSET
131 ;; UNSPEC_VOLATILE usage
134 (define_c_enum "unspecv"
136 UNSPECV_LL ; load-locked
137 UNSPECV_SC ; store-conditional
138 UNSPECV_PROBE_STACK_RANGE ; probe range of stack addresses
139 UNSPECV_EH_RR ; eh_reg_restore
140 UNSPECV_ISYNC ; isync instruction
141 UNSPECV_LWSYNC ; lwsync
145 ;; Define an insn type attribute. This is used in function unit delay
147 (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,isync,sync,load_l,store_c,shift,trap,insert_dword,var_shift_rotate,cntlz,exts,mffgpr,mftgpr,isel"
148 (const_string "integer"))
150 ;; Define floating point instruction sub-types for use with Xfpu.md
151 (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"))
153 ;; Length (in bytes).
154 ; '(pc)' in the following doesn't include the instruction itself; it is
155 ; calculated as if the instruction had zero size.
156 (define_attr "length" ""
157 (if_then_else (eq_attr "type" "branch")
158 (if_then_else (and (ge (minus (match_dup 0) (pc))
160 (lt (minus (match_dup 0) (pc))
166 ;; Processor type -- this attribute must exactly match the processor_type
167 ;; enumeration in rs6000.h.
169 (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"
170 (const (symbol_ref "rs6000_cpu_attr")))
173 ;; If this instruction is microcoded on the CELL processor
174 ; The default for load extended, the recorded instructions and rotate/shifts by a variable is always microcoded
175 (define_attr "cell_micro" "not,conditional,always"
176 (if_then_else (eq_attr "type" "compare,delayed_compare,imul_compare,lmul_compare,load_ext,load_ext_ux,var_shift_rotate,var_delayed_compare")
177 (const_string "always")
178 (const_string "not")))
180 (automata_option "ndfa")
194 (include "e300c2c3.md")
195 (include "e500mc.md")
196 (include "e500mc64.md")
197 (include "power4.md")
198 (include "power5.md")
199 (include "power6.md")
200 (include "power7.md")
206 (include "predicates.md")
207 (include "constraints.md")
209 (include "darwin.md")
214 ; This mode iterator allows :GPR to be used to indicate the allowable size
215 ; of whole values in GPRs.
216 (define_mode_iterator GPR [SI (DI "TARGET_POWERPC64")])
218 ; Any supported integer mode.
219 (define_mode_iterator INT [QI HI SI DI TI])
221 ; Any supported integer mode that fits in one register.
222 (define_mode_iterator INT1 [QI HI SI (DI "TARGET_POWERPC64")])
224 ; extend modes for DImode
225 (define_mode_iterator QHSI [QI HI SI])
227 ; SImode or DImode, even if DImode doesn't fit in GPRs.
228 (define_mode_iterator SDI [SI DI])
230 ; The size of a pointer. Also, the size of the value that a record-condition
231 ; (one with a '.') will compare; and the size used for arithmetic carries.
232 (define_mode_iterator P [(SI "TARGET_32BIT") (DI "TARGET_64BIT")])
234 ; Any hardware-supported floating-point mode
235 (define_mode_iterator FP [
236 (SF "TARGET_HARD_FLOAT
237 && ((TARGET_FPRS && TARGET_SINGLE_FLOAT) || TARGET_E500_SINGLE)")
238 (DF "TARGET_HARD_FLOAT
239 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)")
240 (TF "!TARGET_IEEEQUAD
242 && (TARGET_FPRS || TARGET_E500_DOUBLE)
243 && TARGET_LONG_DOUBLE_128")
247 ; Any fma capable floating-point mode.
248 (define_mode_iterator FMA_F [
249 (SF "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT")
250 (DF "(TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT)
251 || VECTOR_UNIT_VSX_P (DFmode)")
252 (V2SF "TARGET_PAIRED_FLOAT")
253 (V4SF "VECTOR_UNIT_ALTIVEC_OR_VSX_P (V4SFmode)")
254 (V2DF "VECTOR_UNIT_ALTIVEC_OR_VSX_P (V2DFmode)")
257 ; These modes do not fit in integer registers in 32-bit mode.
258 ; but on e500v2, the gpr are 64 bit registers
259 (define_mode_iterator DIFD [DI (DF "!TARGET_E500_DOUBLE") DD])
261 ; Iterator for reciprocal estimate instructions
262 (define_mode_iterator RECIPF [SF DF V4SF V2DF])
264 ; Iterator for just SF/DF
265 (define_mode_iterator SFDF [SF DF])
267 ; Conditional returns.
268 (define_code_iterator any_return [return simple_return])
269 (define_code_attr return_pred [(return "direct_return ()")
271 (define_code_attr return_str [(return "") (simple_return "simple_")])
273 ; Various instructions that come in SI and DI forms.
274 ; A generic w/d attribute, for things like cmpw/cmpd.
275 (define_mode_attr wd [(QI "b") (HI "h") (SI "w") (DI "d")])
278 (define_mode_attr dbits [(QI "56") (HI "48") (SI "32")])
280 ;; ISEL/ISEL64 target selection
281 (define_mode_attr sel [(SI "") (DI "64")])
283 ;; Suffix for reload patterns
284 (define_mode_attr ptrsize [(SI "32bit")
287 (define_mode_attr tptrsize [(SI "TARGET_32BIT")
288 (DI "TARGET_64BIT")])
290 (define_mode_attr mptrsize [(SI "si")
293 (define_mode_attr ptrload [(SI "{l|lwz}")
296 (define_mode_attr rreg [(SF "f")
301 (define_mode_attr rreg2 [(SF "f")
304 (define_mode_attr SI_CONVERT_FP [(SF "TARGET_FCFIDS")
305 (DF "TARGET_FCFID")])
307 (define_mode_attr E500_CONVERT [(SF "!TARGET_FPRS")
308 (DF "TARGET_E500_DOUBLE")])
310 (define_mode_attr TARGET_FLOAT [(SF "TARGET_SINGLE_FLOAT")
311 (DF "TARGET_DOUBLE_FLOAT")])
313 ;; Start with fixed-point load and store insns. Here we put only the more
314 ;; complex forms. Basic data transfer is done later.
316 (define_expand "zero_extend<mode>di2"
317 [(set (match_operand:DI 0 "gpc_reg_operand" "")
318 (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "")))]
322 (define_insn "*zero_extend<mode>di2_internal1"
323 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
324 (zero_extend:DI (match_operand:QHSI 1 "reg_or_mem_operand" "m,r")))]
328 rldicl %0,%1,0,<dbits>"
329 [(set_attr "type" "load,*")])
331 (define_insn "*zero_extend<mode>di2_internal2"
332 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
333 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "r,r"))
335 (clobber (match_scratch:DI 2 "=r,r"))]
338 rldicl. %2,%1,0,<dbits>
340 [(set_attr "type" "compare")
341 (set_attr "length" "4,8")])
344 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
345 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" ""))
347 (clobber (match_scratch:DI 2 ""))]
348 "TARGET_POWERPC64 && reload_completed"
350 (zero_extend:DI (match_dup 1)))
352 (compare:CC (match_dup 2)
356 (define_insn "*zero_extend<mode>di2_internal3"
357 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
358 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "r,r"))
360 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
361 (zero_extend:DI (match_dup 1)))]
364 rldicl. %0,%1,0,<dbits>
366 [(set_attr "type" "compare")
367 (set_attr "length" "4,8")])
370 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
371 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" ""))
373 (set (match_operand:DI 0 "gpc_reg_operand" "")
374 (zero_extend:DI (match_dup 1)))]
375 "TARGET_POWERPC64 && reload_completed"
377 (zero_extend:DI (match_dup 1)))
379 (compare:CC (match_dup 0)
383 (define_insn "extendqidi2"
384 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
385 (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r")))]
388 [(set_attr "type" "exts")])
391 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
392 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
394 (clobber (match_scratch:DI 2 "=r,r"))]
399 [(set_attr "type" "compare")
400 (set_attr "length" "4,8")])
403 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
404 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
406 (clobber (match_scratch:DI 2 ""))]
407 "TARGET_POWERPC64 && reload_completed"
409 (sign_extend:DI (match_dup 1)))
411 (compare:CC (match_dup 2)
416 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
417 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
419 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
420 (sign_extend:DI (match_dup 1)))]
425 [(set_attr "type" "compare")
426 (set_attr "length" "4,8")])
429 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
430 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
432 (set (match_operand:DI 0 "gpc_reg_operand" "")
433 (sign_extend:DI (match_dup 1)))]
434 "TARGET_POWERPC64 && reload_completed"
436 (sign_extend:DI (match_dup 1)))
438 (compare:CC (match_dup 0)
442 (define_expand "extendhidi2"
443 [(set (match_operand:DI 0 "gpc_reg_operand" "")
444 (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "")))]
449 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
450 (sign_extend:DI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
451 "TARGET_POWERPC64 && rs6000_gen_cell_microcode"
455 [(set_attr "type" "load_ext,exts")])
458 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
459 (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r")))]
460 "TARGET_POWERPC64 && !rs6000_gen_cell_microcode"
462 [(set_attr "type" "exts")])
465 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
466 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
468 (clobber (match_scratch:DI 2 "=r,r"))]
473 [(set_attr "type" "compare")
474 (set_attr "length" "4,8")])
477 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
478 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
480 (clobber (match_scratch:DI 2 ""))]
481 "TARGET_POWERPC64 && reload_completed"
483 (sign_extend:DI (match_dup 1)))
485 (compare:CC (match_dup 2)
490 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
491 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
493 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
494 (sign_extend:DI (match_dup 1)))]
499 [(set_attr "type" "compare")
500 (set_attr "length" "4,8")])
503 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
504 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
506 (set (match_operand:DI 0 "gpc_reg_operand" "")
507 (sign_extend:DI (match_dup 1)))]
508 "TARGET_POWERPC64 && reload_completed"
510 (sign_extend:DI (match_dup 1)))
512 (compare:CC (match_dup 0)
516 (define_expand "extendsidi2"
517 [(set (match_operand:DI 0 "gpc_reg_operand" "")
518 (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")))]
523 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
524 (sign_extend:DI (match_operand:SI 1 "lwa_operand" "m,r")))]
525 "TARGET_POWERPC64 && rs6000_gen_cell_microcode"
529 [(set_attr "type" "load_ext,exts")])
532 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
533 (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r")))]
534 "TARGET_POWERPC64 && !rs6000_gen_cell_microcode"
536 [(set_attr "type" "exts")])
539 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
540 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
542 (clobber (match_scratch:DI 2 "=r,r"))]
547 [(set_attr "type" "compare")
548 (set_attr "length" "4,8")])
551 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
552 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
554 (clobber (match_scratch:DI 2 ""))]
555 "TARGET_POWERPC64 && reload_completed"
557 (sign_extend:DI (match_dup 1)))
559 (compare:CC (match_dup 2)
564 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
565 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
567 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
568 (sign_extend:DI (match_dup 1)))]
573 [(set_attr "type" "compare")
574 (set_attr "length" "4,8")])
577 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
578 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
580 (set (match_operand:DI 0 "gpc_reg_operand" "")
581 (sign_extend:DI (match_dup 1)))]
582 "TARGET_POWERPC64 && reload_completed"
584 (sign_extend:DI (match_dup 1)))
586 (compare:CC (match_dup 0)
590 (define_expand "zero_extendqisi2"
591 [(set (match_operand:SI 0 "gpc_reg_operand" "")
592 (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "")))]
597 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
598 (zero_extend:SI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
602 {rlinm|rlwinm} %0,%1,0,0xff"
603 [(set_attr "type" "load,*")])
606 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
607 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
609 (clobber (match_scratch:SI 2 "=r,r"))]
612 {andil.|andi.} %2,%1,0xff
614 [(set_attr "type" "fast_compare,compare")
615 (set_attr "length" "4,8")])
618 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
619 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
621 (clobber (match_scratch:SI 2 ""))]
624 (zero_extend:SI (match_dup 1)))
626 (compare:CC (match_dup 2)
631 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
632 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
634 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
635 (zero_extend:SI (match_dup 1)))]
638 {andil.|andi.} %0,%1,0xff
640 [(set_attr "type" "fast_compare,compare")
641 (set_attr "length" "4,8")])
644 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
645 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
647 (set (match_operand:SI 0 "gpc_reg_operand" "")
648 (zero_extend:SI (match_dup 1)))]
651 (zero_extend:SI (match_dup 1)))
653 (compare:CC (match_dup 0)
657 (define_expand "extendqisi2"
658 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
659 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
664 emit_insn (gen_extendqisi2_ppc (operands[0], operands[1]));
665 else if (TARGET_POWER)
666 emit_insn (gen_extendqisi2_power (operands[0], operands[1]));
668 emit_insn (gen_extendqisi2_no_power (operands[0], operands[1]));
672 (define_insn "extendqisi2_ppc"
673 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
674 (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r")))]
677 [(set_attr "type" "exts")])
680 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
681 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
683 (clobber (match_scratch:SI 2 "=r,r"))]
688 [(set_attr "type" "compare")
689 (set_attr "length" "4,8")])
692 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
693 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
695 (clobber (match_scratch:SI 2 ""))]
696 "TARGET_POWERPC && reload_completed"
698 (sign_extend:SI (match_dup 1)))
700 (compare:CC (match_dup 2)
705 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
706 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
708 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
709 (sign_extend:SI (match_dup 1)))]
714 [(set_attr "type" "compare")
715 (set_attr "length" "4,8")])
718 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
719 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
721 (set (match_operand:SI 0 "gpc_reg_operand" "")
722 (sign_extend:SI (match_dup 1)))]
723 "TARGET_POWERPC && reload_completed"
725 (sign_extend:SI (match_dup 1)))
727 (compare:CC (match_dup 0)
731 (define_expand "extendqisi2_power"
732 [(parallel [(set (match_dup 2)
733 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
735 (clobber (scratch:SI))])
736 (parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
737 (ashiftrt:SI (match_dup 2)
739 (clobber (scratch:SI))])]
742 { operands[1] = gen_lowpart (SImode, operands[1]);
743 operands[2] = gen_reg_rtx (SImode); }")
745 (define_expand "extendqisi2_no_power"
747 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
749 (set (match_operand:SI 0 "gpc_reg_operand" "")
750 (ashiftrt:SI (match_dup 2)
752 "! TARGET_POWER && ! TARGET_POWERPC"
754 { operands[1] = gen_lowpart (SImode, operands[1]);
755 operands[2] = gen_reg_rtx (SImode); }")
757 (define_expand "zero_extendqihi2"
758 [(set (match_operand:HI 0 "gpc_reg_operand" "")
759 (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "")))]
764 [(set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
765 (zero_extend:HI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
769 {rlinm|rlwinm} %0,%1,0,0xff"
770 [(set_attr "type" "load,*")])
773 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
774 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
776 (clobber (match_scratch:HI 2 "=r,r"))]
779 {andil.|andi.} %2,%1,0xff
781 [(set_attr "type" "fast_compare,compare")
782 (set_attr "length" "4,8")])
785 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
786 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
788 (clobber (match_scratch:HI 2 ""))]
791 (zero_extend:HI (match_dup 1)))
793 (compare:CC (match_dup 2)
798 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
799 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
801 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
802 (zero_extend:HI (match_dup 1)))]
805 {andil.|andi.} %0,%1,0xff
807 [(set_attr "type" "fast_compare,compare")
808 (set_attr "length" "4,8")])
811 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
812 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
814 (set (match_operand:HI 0 "gpc_reg_operand" "")
815 (zero_extend:HI (match_dup 1)))]
818 (zero_extend:HI (match_dup 1)))
820 (compare:CC (match_dup 0)
824 (define_expand "extendqihi2"
825 [(use (match_operand:HI 0 "gpc_reg_operand" ""))
826 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
831 emit_insn (gen_extendqihi2_ppc (operands[0], operands[1]));
832 else if (TARGET_POWER)
833 emit_insn (gen_extendqihi2_power (operands[0], operands[1]));
835 emit_insn (gen_extendqihi2_no_power (operands[0], operands[1]));
839 (define_insn "extendqihi2_ppc"
840 [(set (match_operand:HI 0 "gpc_reg_operand" "=r")
841 (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r")))]
844 [(set_attr "type" "exts")])
847 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
848 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
850 (clobber (match_scratch:HI 2 "=r,r"))]
855 [(set_attr "type" "compare")
856 (set_attr "length" "4,8")])
859 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
860 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
862 (clobber (match_scratch:HI 2 ""))]
863 "TARGET_POWERPC && reload_completed"
865 (sign_extend:HI (match_dup 1)))
867 (compare:CC (match_dup 2)
872 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
873 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
875 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
876 (sign_extend:HI (match_dup 1)))]
881 [(set_attr "type" "compare")
882 (set_attr "length" "4,8")])
885 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
886 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
888 (set (match_operand:HI 0 "gpc_reg_operand" "")
889 (sign_extend:HI (match_dup 1)))]
890 "TARGET_POWERPC && reload_completed"
892 (sign_extend:HI (match_dup 1)))
894 (compare:CC (match_dup 0)
898 (define_expand "extendqihi2_power"
899 [(parallel [(set (match_dup 2)
900 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
902 (clobber (scratch:SI))])
903 (parallel [(set (match_operand:HI 0 "gpc_reg_operand" "")
904 (ashiftrt:SI (match_dup 2)
906 (clobber (scratch:SI))])]
909 { operands[0] = gen_lowpart (SImode, operands[0]);
910 operands[1] = gen_lowpart (SImode, operands[1]);
911 operands[2] = gen_reg_rtx (SImode); }")
913 (define_expand "extendqihi2_no_power"
915 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
917 (set (match_operand:HI 0 "gpc_reg_operand" "")
918 (ashiftrt:SI (match_dup 2)
920 "! TARGET_POWER && ! TARGET_POWERPC"
922 { operands[0] = gen_lowpart (SImode, operands[0]);
923 operands[1] = gen_lowpart (SImode, operands[1]);
924 operands[2] = gen_reg_rtx (SImode); }")
926 (define_expand "zero_extendhisi2"
927 [(set (match_operand:SI 0 "gpc_reg_operand" "")
928 (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
933 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
934 (zero_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
938 {rlinm|rlwinm} %0,%1,0,0xffff"
939 [(set_attr "type" "load,*")])
942 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
943 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
945 (clobber (match_scratch:SI 2 "=r,r"))]
948 {andil.|andi.} %2,%1,0xffff
950 [(set_attr "type" "fast_compare,compare")
951 (set_attr "length" "4,8")])
954 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
955 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
957 (clobber (match_scratch:SI 2 ""))]
960 (zero_extend:SI (match_dup 1)))
962 (compare:CC (match_dup 2)
967 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
968 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
970 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
971 (zero_extend:SI (match_dup 1)))]
974 {andil.|andi.} %0,%1,0xffff
976 [(set_attr "type" "fast_compare,compare")
977 (set_attr "length" "4,8")])
980 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
981 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
983 (set (match_operand:SI 0 "gpc_reg_operand" "")
984 (zero_extend:SI (match_dup 1)))]
987 (zero_extend:SI (match_dup 1)))
989 (compare:CC (match_dup 0)
993 (define_expand "extendhisi2"
994 [(set (match_operand:SI 0 "gpc_reg_operand" "")
995 (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
1000 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1001 (sign_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
1002 "rs6000_gen_cell_microcode"
1006 [(set_attr "type" "load_ext,exts")])
1009 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1010 (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r")))]
1011 "!rs6000_gen_cell_microcode"
1012 "{exts|extsh} %0,%1"
1013 [(set_attr "type" "exts")])
1016 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1017 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
1019 (clobber (match_scratch:SI 2 "=r,r"))]
1022 {exts.|extsh.} %2,%1
1024 [(set_attr "type" "compare")
1025 (set_attr "length" "4,8")])
1028 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
1029 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1031 (clobber (match_scratch:SI 2 ""))]
1034 (sign_extend:SI (match_dup 1)))
1036 (compare:CC (match_dup 2)
1041 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1042 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
1044 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1045 (sign_extend:SI (match_dup 1)))]
1048 {exts.|extsh.} %0,%1
1050 [(set_attr "type" "compare")
1051 (set_attr "length" "4,8")])
1053 ;; IBM 405, 440, 464 and 476 half-word multiplication operations.
1055 (define_insn "*macchwc"
1056 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1057 (compare:CC (plus:SI (mult:SI (ashiftrt:SI
1058 (match_operand:SI 2 "gpc_reg_operand" "r")
1061 (match_operand:HI 1 "gpc_reg_operand" "r")))
1062 (match_operand:SI 4 "gpc_reg_operand" "0"))
1064 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1065 (plus:SI (mult:SI (ashiftrt:SI
1072 "macchw. %0, %1, %2"
1073 [(set_attr "type" "imul3")])
1075 (define_insn "*macchw"
1076 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1077 (plus:SI (mult:SI (ashiftrt:SI
1078 (match_operand:SI 2 "gpc_reg_operand" "r")
1081 (match_operand:HI 1 "gpc_reg_operand" "r")))
1082 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1085 [(set_attr "type" "imul3")])
1087 (define_insn "*macchwuc"
1088 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1089 (compare:CC (plus:SI (mult:SI (lshiftrt:SI
1090 (match_operand:SI 2 "gpc_reg_operand" "r")
1093 (match_operand:HI 1 "gpc_reg_operand" "r")))
1094 (match_operand:SI 4 "gpc_reg_operand" "0"))
1096 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1097 (plus:SI (mult:SI (lshiftrt:SI
1104 "macchwu. %0, %1, %2"
1105 [(set_attr "type" "imul3")])
1107 (define_insn "*macchwu"
1108 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1109 (plus:SI (mult:SI (lshiftrt:SI
1110 (match_operand:SI 2 "gpc_reg_operand" "r")
1113 (match_operand:HI 1 "gpc_reg_operand" "r")))
1114 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1116 "macchwu %0, %1, %2"
1117 [(set_attr "type" "imul3")])
1119 (define_insn "*machhwc"
1120 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1121 (compare:CC (plus:SI (mult:SI (ashiftrt:SI
1122 (match_operand:SI 1 "gpc_reg_operand" "%r")
1125 (match_operand:SI 2 "gpc_reg_operand" "r")
1127 (match_operand:SI 4 "gpc_reg_operand" "0"))
1129 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1130 (plus:SI (mult:SI (ashiftrt:SI
1138 "machhw. %0, %1, %2"
1139 [(set_attr "type" "imul3")])
1141 (define_insn "*machhw"
1142 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1143 (plus:SI (mult:SI (ashiftrt:SI
1144 (match_operand:SI 1 "gpc_reg_operand" "%r")
1147 (match_operand:SI 2 "gpc_reg_operand" "r")
1149 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1152 [(set_attr "type" "imul3")])
1154 (define_insn "*machhwuc"
1155 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1156 (compare:CC (plus:SI (mult:SI (lshiftrt:SI
1157 (match_operand:SI 1 "gpc_reg_operand" "%r")
1160 (match_operand:SI 2 "gpc_reg_operand" "r")
1162 (match_operand:SI 4 "gpc_reg_operand" "0"))
1164 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1165 (plus:SI (mult:SI (lshiftrt:SI
1173 "machhwu. %0, %1, %2"
1174 [(set_attr "type" "imul3")])
1176 (define_insn "*machhwu"
1177 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1178 (plus:SI (mult:SI (lshiftrt:SI
1179 (match_operand:SI 1 "gpc_reg_operand" "%r")
1182 (match_operand:SI 2 "gpc_reg_operand" "r")
1184 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1186 "machhwu %0, %1, %2"
1187 [(set_attr "type" "imul3")])
1189 (define_insn "*maclhwc"
1190 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1191 (compare:CC (plus:SI (mult:SI (sign_extend:SI
1192 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1194 (match_operand:HI 2 "gpc_reg_operand" "r")))
1195 (match_operand:SI 4 "gpc_reg_operand" "0"))
1197 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1198 (plus:SI (mult:SI (sign_extend:SI
1204 "maclhw. %0, %1, %2"
1205 [(set_attr "type" "imul3")])
1207 (define_insn "*maclhw"
1208 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1209 (plus:SI (mult:SI (sign_extend:SI
1210 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1212 (match_operand:HI 2 "gpc_reg_operand" "r")))
1213 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1216 [(set_attr "type" "imul3")])
1218 (define_insn "*maclhwuc"
1219 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1220 (compare:CC (plus:SI (mult:SI (zero_extend:SI
1221 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1223 (match_operand:HI 2 "gpc_reg_operand" "r")))
1224 (match_operand:SI 4 "gpc_reg_operand" "0"))
1226 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1227 (plus:SI (mult:SI (zero_extend:SI
1233 "maclhwu. %0, %1, %2"
1234 [(set_attr "type" "imul3")])
1236 (define_insn "*maclhwu"
1237 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1238 (plus:SI (mult:SI (zero_extend:SI
1239 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1241 (match_operand:HI 2 "gpc_reg_operand" "r")))
1242 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1244 "maclhwu %0, %1, %2"
1245 [(set_attr "type" "imul3")])
1247 (define_insn "*nmacchwc"
1248 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1249 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1250 (mult:SI (ashiftrt:SI
1251 (match_operand:SI 2 "gpc_reg_operand" "r")
1254 (match_operand:HI 1 "gpc_reg_operand" "r"))))
1256 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1257 (minus:SI (match_dup 4)
1258 (mult:SI (ashiftrt:SI
1264 "nmacchw. %0, %1, %2"
1265 [(set_attr "type" "imul3")])
1267 (define_insn "*nmacchw"
1268 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1269 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1270 (mult:SI (ashiftrt:SI
1271 (match_operand:SI 2 "gpc_reg_operand" "r")
1274 (match_operand:HI 1 "gpc_reg_operand" "r")))))]
1276 "nmacchw %0, %1, %2"
1277 [(set_attr "type" "imul3")])
1279 (define_insn "*nmachhwc"
1280 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1281 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1282 (mult:SI (ashiftrt:SI
1283 (match_operand:SI 1 "gpc_reg_operand" "%r")
1286 (match_operand:SI 2 "gpc_reg_operand" "r")
1289 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1290 (minus:SI (match_dup 4)
1291 (mult:SI (ashiftrt:SI
1298 "nmachhw. %0, %1, %2"
1299 [(set_attr "type" "imul3")])
1301 (define_insn "*nmachhw"
1302 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1303 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1304 (mult:SI (ashiftrt:SI
1305 (match_operand:SI 1 "gpc_reg_operand" "%r")
1308 (match_operand:SI 2 "gpc_reg_operand" "r")
1311 "nmachhw %0, %1, %2"
1312 [(set_attr "type" "imul3")])
1314 (define_insn "*nmaclhwc"
1315 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1316 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1317 (mult:SI (sign_extend:SI
1318 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1320 (match_operand:HI 2 "gpc_reg_operand" "r"))))
1322 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1323 (minus:SI (match_dup 4)
1324 (mult:SI (sign_extend:SI
1329 "nmaclhw. %0, %1, %2"
1330 [(set_attr "type" "imul3")])
1332 (define_insn "*nmaclhw"
1333 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1334 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1335 (mult:SI (sign_extend:SI
1336 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1338 (match_operand:HI 2 "gpc_reg_operand" "r")))))]
1340 "nmaclhw %0, %1, %2"
1341 [(set_attr "type" "imul3")])
1343 (define_insn "*mulchwc"
1344 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1345 (compare:CC (mult:SI (ashiftrt:SI
1346 (match_operand:SI 2 "gpc_reg_operand" "r")
1349 (match_operand:HI 1 "gpc_reg_operand" "r")))
1351 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1352 (mult:SI (ashiftrt:SI
1358 "mulchw. %0, %1, %2"
1359 [(set_attr "type" "imul3")])
1361 (define_insn "*mulchw"
1362 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1363 (mult:SI (ashiftrt:SI
1364 (match_operand:SI 2 "gpc_reg_operand" "r")
1367 (match_operand:HI 1 "gpc_reg_operand" "r"))))]
1370 [(set_attr "type" "imul3")])
1372 (define_insn "*mulchwuc"
1373 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1374 (compare:CC (mult:SI (lshiftrt:SI
1375 (match_operand:SI 2 "gpc_reg_operand" "r")
1378 (match_operand:HI 1 "gpc_reg_operand" "r")))
1380 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1381 (mult:SI (lshiftrt:SI
1387 "mulchwu. %0, %1, %2"
1388 [(set_attr "type" "imul3")])
1390 (define_insn "*mulchwu"
1391 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1392 (mult:SI (lshiftrt:SI
1393 (match_operand:SI 2 "gpc_reg_operand" "r")
1396 (match_operand:HI 1 "gpc_reg_operand" "r"))))]
1398 "mulchwu %0, %1, %2"
1399 [(set_attr "type" "imul3")])
1401 (define_insn "*mulhhwc"
1402 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1403 (compare:CC (mult:SI (ashiftrt:SI
1404 (match_operand:SI 1 "gpc_reg_operand" "%r")
1407 (match_operand:SI 2 "gpc_reg_operand" "r")
1410 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1411 (mult:SI (ashiftrt:SI
1418 "mulhhw. %0, %1, %2"
1419 [(set_attr "type" "imul3")])
1421 (define_insn "*mulhhw"
1422 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1423 (mult:SI (ashiftrt:SI
1424 (match_operand:SI 1 "gpc_reg_operand" "%r")
1427 (match_operand:SI 2 "gpc_reg_operand" "r")
1431 [(set_attr "type" "imul3")])
1433 (define_insn "*mulhhwuc"
1434 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1435 (compare:CC (mult:SI (lshiftrt:SI
1436 (match_operand:SI 1 "gpc_reg_operand" "%r")
1439 (match_operand:SI 2 "gpc_reg_operand" "r")
1442 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1443 (mult:SI (lshiftrt:SI
1450 "mulhhwu. %0, %1, %2"
1451 [(set_attr "type" "imul3")])
1453 (define_insn "*mulhhwu"
1454 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1455 (mult:SI (lshiftrt:SI
1456 (match_operand:SI 1 "gpc_reg_operand" "%r")
1459 (match_operand:SI 2 "gpc_reg_operand" "r")
1462 "mulhhwu %0, %1, %2"
1463 [(set_attr "type" "imul3")])
1465 (define_insn "*mullhwc"
1466 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1467 (compare:CC (mult:SI (sign_extend:SI
1468 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1470 (match_operand:HI 2 "gpc_reg_operand" "r")))
1472 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1473 (mult:SI (sign_extend:SI
1478 "mullhw. %0, %1, %2"
1479 [(set_attr "type" "imul3")])
1481 (define_insn "*mullhw"
1482 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1483 (mult:SI (sign_extend:SI
1484 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1486 (match_operand:HI 2 "gpc_reg_operand" "r"))))]
1489 [(set_attr "type" "imul3")])
1491 (define_insn "*mullhwuc"
1492 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1493 (compare:CC (mult:SI (zero_extend:SI
1494 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1496 (match_operand:HI 2 "gpc_reg_operand" "r")))
1498 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1499 (mult:SI (zero_extend:SI
1504 "mullhwu. %0, %1, %2"
1505 [(set_attr "type" "imul3")])
1507 (define_insn "*mullhwu"
1508 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1509 (mult:SI (zero_extend:SI
1510 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1512 (match_operand:HI 2 "gpc_reg_operand" "r"))))]
1514 "mullhwu %0, %1, %2"
1515 [(set_attr "type" "imul3")])
1517 ;; IBM 405, 440, 464 and 476 string-search dlmzb instruction support.
1518 (define_insn "dlmzb"
1519 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1520 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
1521 (match_operand:SI 2 "gpc_reg_operand" "r")]
1523 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1524 (unspec:SI [(match_dup 1)
1528 "dlmzb. %0, %1, %2")
1530 (define_expand "strlensi"
1531 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1532 (unspec:SI [(match_operand:BLK 1 "general_operand" "")
1533 (match_operand:QI 2 "const_int_operand" "")
1534 (match_operand 3 "const_int_operand" "")]
1535 UNSPEC_DLMZB_STRLEN))
1536 (clobber (match_scratch:CC 4 "=x"))]
1537 "TARGET_DLMZB && WORDS_BIG_ENDIAN && !optimize_size"
1539 rtx result = operands[0];
1540 rtx src = operands[1];
1541 rtx search_char = operands[2];
1542 rtx align = operands[3];
1543 rtx addr, scratch_string, word1, word2, scratch_dlmzb;
1544 rtx loop_label, end_label, mem, cr0, cond;
1545 if (search_char != const0_rtx
1546 || GET_CODE (align) != CONST_INT
1547 || INTVAL (align) < 8)
1549 word1 = gen_reg_rtx (SImode);
1550 word2 = gen_reg_rtx (SImode);
1551 scratch_dlmzb = gen_reg_rtx (SImode);
1552 scratch_string = gen_reg_rtx (Pmode);
1553 loop_label = gen_label_rtx ();
1554 end_label = gen_label_rtx ();
1555 addr = force_reg (Pmode, XEXP (src, 0));
1556 emit_move_insn (scratch_string, addr);
1557 emit_label (loop_label);
1558 mem = change_address (src, SImode, scratch_string);
1559 emit_move_insn (word1, mem);
1560 emit_move_insn (word2, adjust_address (mem, SImode, 4));
1561 cr0 = gen_rtx_REG (CCmode, CR0_REGNO);
1562 emit_insn (gen_dlmzb (scratch_dlmzb, word1, word2, cr0));
1563 cond = gen_rtx_NE (VOIDmode, cr0, const0_rtx);
1564 emit_jump_insn (gen_rtx_SET (VOIDmode,
1566 gen_rtx_IF_THEN_ELSE (VOIDmode,
1572 emit_insn (gen_addsi3 (scratch_string, scratch_string, GEN_INT (8)));
1573 emit_jump_insn (gen_rtx_SET (VOIDmode,
1575 gen_rtx_LABEL_REF (VOIDmode, loop_label)));
1577 emit_label (end_label);
1578 emit_insn (gen_addsi3 (scratch_string, scratch_string, scratch_dlmzb));
1579 emit_insn (gen_subsi3 (result, scratch_string, addr));
1580 emit_insn (gen_subsi3 (result, result, const1_rtx));
1585 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
1586 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1588 (set (match_operand:SI 0 "gpc_reg_operand" "")
1589 (sign_extend:SI (match_dup 1)))]
1592 (sign_extend:SI (match_dup 1)))
1594 (compare:CC (match_dup 0)
1598 ;; Fixed-point arithmetic insns.
1600 (define_expand "add<mode>3"
1601 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1602 (plus:SDI (match_operand:SDI 1 "gpc_reg_operand" "")
1603 (match_operand:SDI 2 "reg_or_add_cint_operand" "")))]
1606 if (<MODE>mode == DImode && ! TARGET_POWERPC64)
1608 if (non_short_cint_operand (operands[2], DImode))
1611 else if (GET_CODE (operands[2]) == CONST_INT
1612 && ! add_operand (operands[2], <MODE>mode))
1614 rtx tmp = ((!can_create_pseudo_p ()
1615 || rtx_equal_p (operands[0], operands[1]))
1616 ? operands[0] : gen_reg_rtx (<MODE>mode));
1618 HOST_WIDE_INT val = INTVAL (operands[2]);
1619 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1620 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, <MODE>mode);
1622 if (<MODE>mode == DImode && !satisfies_constraint_L (GEN_INT (rest)))
1625 /* The ordering here is important for the prolog expander.
1626 When space is allocated from the stack, adding 'low' first may
1627 produce a temporary deallocation (which would be bad). */
1628 emit_insn (gen_add<mode>3 (tmp, operands[1], GEN_INT (rest)));
1629 emit_insn (gen_add<mode>3 (operands[0], tmp, GEN_INT (low)));
1634 ;; Discourage ai/addic because of carry but provide it in an alternative
1635 ;; allowing register zero as source.
1636 (define_insn "*add<mode>3_internal1"
1637 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r,?r,r")
1638 (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "%r,b,r,b")
1639 (match_operand:GPR 2 "add_operand" "r,I,I,L")))]
1640 "!DECIMAL_FLOAT_MODE_P (GET_MODE (operands[0])) && !DECIMAL_FLOAT_MODE_P (GET_MODE (operands[1]))"
1643 {cal %0,%2(%1)|addi %0,%1,%2}
1645 {cau|addis} %0,%1,%v2"
1646 [(set_attr "length" "4,4,4,4")])
1648 (define_insn "addsi3_high"
1649 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
1650 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
1651 (high:SI (match_operand 2 "" ""))))]
1652 "TARGET_MACHO && !TARGET_64BIT"
1653 "{cau|addis} %0,%1,ha16(%2)"
1654 [(set_attr "length" "4")])
1656 (define_insn "*add<mode>3_internal2"
1657 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
1658 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "%r,r,r,r")
1659 (match_operand:P 2 "reg_or_short_operand" "r,I,r,I"))
1661 (clobber (match_scratch:P 3 "=r,r,r,r"))]
1664 {cax.|add.} %3,%1,%2
1665 {ai.|addic.} %3,%1,%2
1668 [(set_attr "type" "fast_compare,compare,compare,compare")
1669 (set_attr "length" "4,4,8,8")])
1672 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1673 (compare:CC (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1674 (match_operand:GPR 2 "reg_or_short_operand" ""))
1676 (clobber (match_scratch:GPR 3 ""))]
1679 (plus:GPR (match_dup 1)
1682 (compare:CC (match_dup 3)
1686 (define_insn "*add<mode>3_internal3"
1687 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
1688 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "%r,r,r,r")
1689 (match_operand:P 2 "reg_or_short_operand" "r,I,r,I"))
1691 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
1692 (plus:P (match_dup 1)
1696 {cax.|add.} %0,%1,%2
1697 {ai.|addic.} %0,%1,%2
1700 [(set_attr "type" "fast_compare,compare,compare,compare")
1701 (set_attr "length" "4,4,8,8")])
1704 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1705 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "")
1706 (match_operand:P 2 "reg_or_short_operand" ""))
1708 (set (match_operand:P 0 "gpc_reg_operand" "")
1709 (plus:P (match_dup 1) (match_dup 2)))]
1712 (plus:P (match_dup 1)
1715 (compare:CC (match_dup 0)
1719 ;; Split an add that we can't do in one insn into two insns, each of which
1720 ;; does one 16-bit part. This is used by combine. Note that the low-order
1721 ;; add should be last in case the result gets used in an address.
1724 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
1725 (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1726 (match_operand:GPR 2 "non_add_cint_operand" "")))]
1728 [(set (match_dup 0) (plus:GPR (match_dup 1) (match_dup 3)))
1729 (set (match_dup 0) (plus:GPR (match_dup 0) (match_dup 4)))]
1731 HOST_WIDE_INT val = INTVAL (operands[2]);
1732 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1733 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, <MODE>mode);
1735 operands[4] = GEN_INT (low);
1736 if (<MODE>mode == SImode || satisfies_constraint_L (GEN_INT (rest)))
1737 operands[3] = GEN_INT (rest);
1738 else if (can_create_pseudo_p ())
1740 operands[3] = gen_reg_rtx (DImode);
1741 emit_move_insn (operands[3], operands[2]);
1742 emit_insn (gen_adddi3 (operands[0], operands[1], operands[3]));
1749 (define_insn "one_cmpl<mode>2"
1750 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1751 (not:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
1756 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1757 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1759 (clobber (match_scratch:P 2 "=r,r"))]
1764 [(set_attr "type" "fast_compare,compare")
1765 (set_attr "length" "4,8")])
1768 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
1769 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" ""))
1771 (clobber (match_scratch:P 2 ""))]
1774 (not:P (match_dup 1)))
1776 (compare:CC (match_dup 2)
1781 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1782 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1784 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
1785 (not:P (match_dup 1)))]
1790 [(set_attr "type" "fast_compare,compare")
1791 (set_attr "length" "4,8")])
1794 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
1795 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" ""))
1797 (set (match_operand:P 0 "gpc_reg_operand" "")
1798 (not:P (match_dup 1)))]
1801 (not:P (match_dup 1)))
1803 (compare:CC (match_dup 0)
1808 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1809 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "rI")
1810 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1812 "{sf%I1|subf%I1c} %0,%2,%1")
1815 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
1816 (minus:GPR (match_operand:GPR 1 "reg_or_short_operand" "r,I")
1817 (match_operand:GPR 2 "gpc_reg_operand" "r,r")))]
1824 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1825 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1826 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1828 (clobber (match_scratch:SI 3 "=r,r"))]
1831 {sf.|subfc.} %3,%2,%1
1833 [(set_attr "type" "compare")
1834 (set_attr "length" "4,8")])
1837 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1838 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "r,r")
1839 (match_operand:P 2 "gpc_reg_operand" "r,r"))
1841 (clobber (match_scratch:P 3 "=r,r"))]
1846 [(set_attr "type" "fast_compare")
1847 (set_attr "length" "4,8")])
1850 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1851 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "")
1852 (match_operand:P 2 "gpc_reg_operand" ""))
1854 (clobber (match_scratch:P 3 ""))]
1857 (minus:P (match_dup 1)
1860 (compare:CC (match_dup 3)
1865 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1866 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1867 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1869 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1870 (minus:SI (match_dup 1) (match_dup 2)))]
1873 {sf.|subfc.} %0,%2,%1
1875 [(set_attr "type" "compare")
1876 (set_attr "length" "4,8")])
1879 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1880 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "r,r")
1881 (match_operand:P 2 "gpc_reg_operand" "r,r"))
1883 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
1884 (minus:P (match_dup 1)
1890 [(set_attr "type" "fast_compare")
1891 (set_attr "length" "4,8")])
1894 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1895 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "")
1896 (match_operand:P 2 "gpc_reg_operand" ""))
1898 (set (match_operand:P 0 "gpc_reg_operand" "")
1899 (minus:P (match_dup 1)
1903 (minus:P (match_dup 1)
1906 (compare:CC (match_dup 0)
1910 (define_expand "sub<mode>3"
1911 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1912 (minus:SDI (match_operand:SDI 1 "reg_or_short_operand" "")
1913 (match_operand:SDI 2 "reg_or_sub_cint_operand" "")))]
1917 if (GET_CODE (operands[2]) == CONST_INT)
1919 emit_insn (gen_add<mode>3 (operands[0], operands[1],
1920 negate_rtx (<MODE>mode, operands[2])));
1925 ;; For SMIN, SMAX, UMIN, and UMAX, we use DEFINE_EXPAND's that involve a doz[i]
1926 ;; instruction and some auxiliary computations. Then we just have a single
1927 ;; DEFINE_INSN for doz[i] and the define_splits to make them if made by
1930 (define_expand "sminsi3"
1932 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1933 (match_operand:SI 2 "reg_or_short_operand" ""))
1935 (minus:SI (match_dup 2) (match_dup 1))))
1936 (set (match_operand:SI 0 "gpc_reg_operand" "")
1937 (minus:SI (match_dup 2) (match_dup 3)))]
1938 "TARGET_POWER || TARGET_ISEL"
1943 operands[2] = force_reg (SImode, operands[2]);
1944 rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]);
1948 operands[3] = gen_reg_rtx (SImode);
1952 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1953 (smin:SI (match_operand:SI 1 "gpc_reg_operand" "")
1954 (match_operand:SI 2 "reg_or_short_operand" "")))
1955 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1958 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1960 (minus:SI (match_dup 2) (match_dup 1))))
1961 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 3)))]
1964 (define_expand "smaxsi3"
1966 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1967 (match_operand:SI 2 "reg_or_short_operand" ""))
1969 (minus:SI (match_dup 2) (match_dup 1))))
1970 (set (match_operand:SI 0 "gpc_reg_operand" "")
1971 (plus:SI (match_dup 3) (match_dup 1)))]
1972 "TARGET_POWER || TARGET_ISEL"
1977 operands[2] = force_reg (SImode, operands[2]);
1978 rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]);
1981 operands[3] = gen_reg_rtx (SImode);
1985 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1986 (smax:SI (match_operand:SI 1 "gpc_reg_operand" "")
1987 (match_operand:SI 2 "reg_or_short_operand" "")))
1988 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1991 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1993 (minus:SI (match_dup 2) (match_dup 1))))
1994 (set (match_dup 0) (plus:SI (match_dup 3) (match_dup 1)))]
1997 (define_expand "uminsi3"
1998 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
2000 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
2002 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
2004 (minus:SI (match_dup 4) (match_dup 3))))
2005 (set (match_operand:SI 0 "gpc_reg_operand" "")
2006 (minus:SI (match_dup 2) (match_dup 3)))]
2007 "TARGET_POWER || TARGET_ISEL"
2012 rs6000_emit_minmax (operands[0], UMIN, operands[1], operands[2]);
2015 operands[3] = gen_reg_rtx (SImode);
2016 operands[4] = gen_reg_rtx (SImode);
2017 operands[5] = GEN_INT (-2147483647 - 1);
2020 (define_expand "umaxsi3"
2021 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
2023 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
2025 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
2027 (minus:SI (match_dup 4) (match_dup 3))))
2028 (set (match_operand:SI 0 "gpc_reg_operand" "")
2029 (plus:SI (match_dup 3) (match_dup 1)))]
2030 "TARGET_POWER || TARGET_ISEL"
2035 rs6000_emit_minmax (operands[0], UMAX, operands[1], operands[2]);
2038 operands[3] = gen_reg_rtx (SImode);
2039 operands[4] = gen_reg_rtx (SImode);
2040 operands[5] = GEN_INT (-2147483647 - 1);
2044 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2045 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r")
2046 (match_operand:SI 2 "reg_or_short_operand" "rI"))
2048 (minus:SI (match_dup 2) (match_dup 1))))]
2053 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2055 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
2056 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
2058 (minus:SI (match_dup 2) (match_dup 1)))
2060 (clobber (match_scratch:SI 3 "=r,r"))]
2065 [(set_attr "type" "delayed_compare")
2066 (set_attr "length" "4,8")])
2069 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2071 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "")
2072 (match_operand:SI 2 "reg_or_short_operand" ""))
2074 (minus:SI (match_dup 2) (match_dup 1)))
2076 (clobber (match_scratch:SI 3 ""))]
2077 "TARGET_POWER && reload_completed"
2079 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
2081 (minus:SI (match_dup 2) (match_dup 1))))
2083 (compare:CC (match_dup 3)
2088 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2090 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
2091 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
2093 (minus:SI (match_dup 2) (match_dup 1)))
2095 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2096 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
2098 (minus:SI (match_dup 2) (match_dup 1))))]
2103 [(set_attr "type" "delayed_compare")
2104 (set_attr "length" "4,8")])
2107 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2109 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "")
2110 (match_operand:SI 2 "reg_or_short_operand" ""))
2112 (minus:SI (match_dup 2) (match_dup 1)))
2114 (set (match_operand:SI 0 "gpc_reg_operand" "")
2115 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
2117 (minus:SI (match_dup 2) (match_dup 1))))]
2118 "TARGET_POWER && reload_completed"
2120 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
2122 (minus:SI (match_dup 2) (match_dup 1))))
2124 (compare:CC (match_dup 0)
2128 ;; We don't need abs with condition code because such comparisons should
2130 (define_expand "abssi2"
2131 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2132 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))]
2138 emit_insn (gen_abssi2_isel (operands[0], operands[1]));
2141 else if (! TARGET_POWER)
2143 emit_insn (gen_abssi2_nopower (operands[0], operands[1]));
2148 (define_insn "*abssi2_power"
2149 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2150 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
2154 (define_insn_and_split "abs<mode>2_isel"
2155 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2156 (abs:GPR (match_operand:GPR 1 "gpc_reg_operand" "b")))
2157 (clobber (match_scratch:GPR 2 "=&b"))
2158 (clobber (match_scratch:CC 3 "=y"))]
2161 "&& reload_completed"
2162 [(set (match_dup 2) (neg:GPR (match_dup 1)))
2164 (compare:CC (match_dup 1)
2167 (if_then_else:GPR (lt (match_dup 3)
2173 (define_insn_and_split "nabs<mode>2_isel"
2174 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2175 (neg:GPR (abs:GPR (match_operand:GPR 1 "gpc_reg_operand" "b"))))
2176 (clobber (match_scratch:GPR 2 "=&b"))
2177 (clobber (match_scratch:CC 3 "=y"))]
2180 "&& reload_completed"
2181 [(set (match_dup 2) (neg:GPR (match_dup 1)))
2183 (compare:CC (match_dup 1)
2186 (if_then_else:GPR (lt (match_dup 3)
2192 (define_insn_and_split "abssi2_nopower"
2193 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
2194 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0")))
2195 (clobber (match_scratch:SI 2 "=&r,&r"))]
2196 "! TARGET_POWER && ! TARGET_ISEL"
2198 "&& reload_completed"
2199 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
2200 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
2201 (set (match_dup 0) (minus:SI (match_dup 0) (match_dup 2)))]
2204 (define_insn "*nabs_power"
2205 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2206 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r"))))]
2210 (define_insn_and_split "*nabs_nopower"
2211 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
2212 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0"))))
2213 (clobber (match_scratch:SI 2 "=&r,&r"))]
2216 "&& reload_completed"
2217 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
2218 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
2219 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 0)))]
2222 (define_expand "neg<mode>2"
2223 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
2224 (neg:SDI (match_operand:SDI 1 "gpc_reg_operand" "")))]
2228 (define_insn "*neg<mode>2_internal"
2229 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2230 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
2235 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2236 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
2238 (clobber (match_scratch:P 2 "=r,r"))]
2243 [(set_attr "type" "fast_compare")
2244 (set_attr "length" "4,8")])
2247 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2248 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" ""))
2250 (clobber (match_scratch:P 2 ""))]
2253 (neg:P (match_dup 1)))
2255 (compare:CC (match_dup 2)
2260 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
2261 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
2263 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
2264 (neg:P (match_dup 1)))]
2269 [(set_attr "type" "fast_compare")
2270 (set_attr "length" "4,8")])
2273 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
2274 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" ""))
2276 (set (match_operand:P 0 "gpc_reg_operand" "")
2277 (neg:P (match_dup 1)))]
2280 (neg:P (match_dup 1)))
2282 (compare:CC (match_dup 0)
2286 (define_insn "clz<mode>2"
2287 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2288 (clz:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
2290 "{cntlz|cntlz<wd>} %0,%1"
2291 [(set_attr "type" "cntlz")])
2293 (define_expand "ctz<mode>2"
2295 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))
2296 (parallel [(set (match_dup 3) (and:GPR (match_dup 1)
2298 (clobber (scratch:CC))])
2299 (set (match_dup 4) (clz:GPR (match_dup 3)))
2300 (set (match_operand:GPR 0 "gpc_reg_operand" "")
2301 (minus:GPR (match_dup 5) (match_dup 4)))]
2304 operands[2] = gen_reg_rtx (<MODE>mode);
2305 operands[3] = gen_reg_rtx (<MODE>mode);
2306 operands[4] = gen_reg_rtx (<MODE>mode);
2307 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode) - 1);
2310 (define_expand "ffs<mode>2"
2312 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))
2313 (parallel [(set (match_dup 3) (and:GPR (match_dup 1)
2315 (clobber (scratch:CC))])
2316 (set (match_dup 4) (clz:GPR (match_dup 3)))
2317 (set (match_operand:GPR 0 "gpc_reg_operand" "")
2318 (minus:GPR (match_dup 5) (match_dup 4)))]
2321 operands[2] = gen_reg_rtx (<MODE>mode);
2322 operands[3] = gen_reg_rtx (<MODE>mode);
2323 operands[4] = gen_reg_rtx (<MODE>mode);
2324 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode));
2327 (define_insn "popcntb<mode>2"
2328 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2329 (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")]
2334 (define_insn "popcntd<mode>2"
2335 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2336 (popcount:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
2340 (define_expand "popcount<mode>2"
2341 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2342 (popcount:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))]
2343 "TARGET_POPCNTB || TARGET_POPCNTD"
2345 rs6000_emit_popcount (operands[0], operands[1]);
2349 (define_insn "parity<mode>2_cmpb"
2350 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2351 (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")] UNSPEC_PARITY))]
2352 "TARGET_CMPB && TARGET_POPCNTB"
2355 (define_expand "parity<mode>2"
2356 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2357 (parity:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))]
2360 rs6000_emit_parity (operands[0], operands[1]);
2364 ;; Since the hardware zeros the upper part of the register, save generating the
2365 ;; AND immediate if we are converting to unsigned
2366 (define_insn "*bswaphi2_extenddi"
2367 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
2369 (bswap:HI (match_operand:HI 1 "memory_operand" "Z"))))]
2372 [(set_attr "length" "4")
2373 (set_attr "type" "load")])
2375 (define_insn "*bswaphi2_extendsi"
2376 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2378 (bswap:HI (match_operand:HI 1 "memory_operand" "Z"))))]
2381 [(set_attr "length" "4")
2382 (set_attr "type" "load")])
2384 (define_expand "bswaphi2"
2385 [(parallel [(set (match_operand:HI 0 "reg_or_mem_operand" "")
2387 (match_operand:HI 1 "reg_or_mem_operand" "")))
2388 (clobber (match_scratch:SI 2 ""))])]
2391 if (!REG_P (operands[0]) && !REG_P (operands[1]))
2392 operands[1] = force_reg (HImode, operands[1]);
2395 (define_insn "bswaphi2_internal"
2396 [(set (match_operand:HI 0 "reg_or_mem_operand" "=r,Z,&r")
2398 (match_operand:HI 1 "reg_or_mem_operand" "Z,r,r")))
2399 (clobber (match_scratch:SI 2 "=X,X,&r"))]
2405 [(set_attr "length" "4,4,12")
2406 (set_attr "type" "load,store,*")])
2409 [(set (match_operand:HI 0 "gpc_reg_operand" "")
2410 (bswap:HI (match_operand:HI 1 "gpc_reg_operand" "")))
2411 (clobber (match_operand:SI 2 "gpc_reg_operand" ""))]
2412 "TARGET_POWERPC && reload_completed"
2414 (zero_extract:SI (match_dup 4)
2418 (and:SI (ashift:SI (match_dup 4)
2420 (const_int 65280))) ;; 0xff00
2422 (ior:SI (match_dup 3)
2426 operands[3] = simplify_gen_subreg (SImode, operands[0], HImode, 0);
2427 operands[4] = simplify_gen_subreg (SImode, operands[1], HImode, 0);
2430 (define_insn "*bswapsi2_extenddi"
2431 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
2433 (bswap:SI (match_operand:SI 1 "memory_operand" "Z"))))]
2436 [(set_attr "length" "4")
2437 (set_attr "type" "load")])
2439 (define_expand "bswapsi2"
2440 [(set (match_operand:SI 0 "reg_or_mem_operand" "")
2442 (match_operand:SI 1 "reg_or_mem_operand" "")))]
2445 if (!REG_P (operands[0]) && !REG_P (operands[1]))
2446 operands[1] = force_reg (SImode, operands[1]);
2449 (define_insn "*bswapsi2_internal"
2450 [(set (match_operand:SI 0 "reg_or_mem_operand" "=r,Z,&r")
2452 (match_operand:SI 1 "reg_or_mem_operand" "Z,r,r")))]
2456 {stbrx|stwbrx} %1,%y0
2458 [(set_attr "length" "4,4,12")
2459 (set_attr "type" "load,store,*")])
2462 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2463 (bswap:SI (match_operand:SI 1 "gpc_reg_operand" "")))]
2466 (rotate:SI (match_dup 1) (const_int 8)))
2467 (set (zero_extract:SI (match_dup 0)
2471 (set (zero_extract:SI (match_dup 0)
2474 (rotate:SI (match_dup 1)
2478 (define_expand "bswapdi2"
2479 [(parallel [(set (match_operand:DI 0 "reg_or_mem_operand" "")
2481 (match_operand:DI 1 "reg_or_mem_operand" "")))
2482 (clobber (match_scratch:DI 2 ""))
2483 (clobber (match_scratch:DI 3 ""))
2484 (clobber (match_scratch:DI 4 ""))])]
2487 if (!REG_P (operands[0]) && !REG_P (operands[1]))
2488 operands[1] = force_reg (DImode, operands[1]);
2490 if (!TARGET_POWERPC64)
2492 /* 32-bit mode needs fewer scratch registers, but 32-bit addressing mode
2493 that uses 64-bit registers needs the same scratch registers as 64-bit
2495 emit_insn (gen_bswapdi2_32bit (operands[0], operands[1]));
2500 ;; Power7/cell has ldbrx/stdbrx, so use it directly
2501 (define_insn "*bswapdi2_ldbrx"
2502 [(set (match_operand:DI 0 "reg_or_mem_operand" "=&r,Z,??&r")
2503 (bswap:DI (match_operand:DI 1 "reg_or_mem_operand" "Z,r,r")))
2504 (clobber (match_scratch:DI 2 "=X,X,&r"))
2505 (clobber (match_scratch:DI 3 "=X,X,&r"))
2506 (clobber (match_scratch:DI 4 "=X,X,&r"))]
2507 "TARGET_POWERPC64 && TARGET_LDBRX
2508 && (REG_P (operands[0]) || REG_P (operands[1]))"
2513 [(set_attr "length" "4,4,36")
2514 (set_attr "type" "load,store,*")])
2516 ;; Non-power7/cell, fall back to use lwbrx/stwbrx
2517 (define_insn "*bswapdi2_64bit"
2518 [(set (match_operand:DI 0 "reg_or_mem_operand" "=&r,Z,??&r")
2519 (bswap:DI (match_operand:DI 1 "reg_or_mem_operand" "Z,r,r")))
2520 (clobber (match_scratch:DI 2 "=&b,&b,&r"))
2521 (clobber (match_scratch:DI 3 "=&r,&r,&r"))
2522 (clobber (match_scratch:DI 4 "=&r,X,&r"))]
2523 "TARGET_POWERPC64 && !TARGET_LDBRX
2524 && (REG_P (operands[0]) || REG_P (operands[1]))"
2526 [(set_attr "length" "16,12,36")])
2529 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2530 (bswap:DI (match_operand:DI 1 "indexed_or_indirect_operand" "")))
2531 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
2532 (clobber (match_operand:DI 3 "gpc_reg_operand" ""))
2533 (clobber (match_operand:DI 4 "gpc_reg_operand" ""))]
2534 "TARGET_POWERPC64 && !TARGET_LDBRX && reload_completed"
2538 rtx dest = operands[0];
2539 rtx src = operands[1];
2540 rtx op2 = operands[2];
2541 rtx op3 = operands[3];
2542 rtx op4 = operands[4];
2543 rtx op3_32 = simplify_gen_subreg (SImode, op3, DImode, 4);
2544 rtx op4_32 = simplify_gen_subreg (SImode, op4, DImode, 4);
2550 addr1 = XEXP (src, 0);
2551 if (GET_CODE (addr1) == PLUS)
2553 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2554 addr2 = gen_rtx_PLUS (Pmode, op2, XEXP (addr1, 1));
2558 emit_move_insn (op2, GEN_INT (4));
2559 addr2 = gen_rtx_PLUS (Pmode, op2, addr1);
2562 if (BYTES_BIG_ENDIAN)
2564 word_high = change_address (src, SImode, addr1);
2565 word_low = change_address (src, SImode, addr2);
2569 word_high = change_address (src, SImode, addr2);
2570 word_low = change_address (src, SImode, addr1);
2573 emit_insn (gen_bswapsi2 (op3_32, word_low));
2574 emit_insn (gen_bswapsi2 (op4_32, word_high));
2575 emit_insn (gen_ashldi3 (dest, op3, GEN_INT (32)));
2576 emit_insn (gen_iordi3 (dest, dest, op4));
2580 [(set (match_operand:DI 0 "indexed_or_indirect_operand" "")
2581 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2582 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
2583 (clobber (match_operand:DI 3 "gpc_reg_operand" ""))
2584 (clobber (match_operand:DI 4 "" ""))]
2585 "TARGET_POWERPC64 && !TARGET_LDBRX && reload_completed"
2589 rtx dest = operands[0];
2590 rtx src = operands[1];
2591 rtx op2 = operands[2];
2592 rtx op3 = operands[3];
2593 rtx src_si = simplify_gen_subreg (SImode, src, DImode, 4);
2594 rtx op3_si = simplify_gen_subreg (SImode, op3, DImode, 4);
2600 addr1 = XEXP (dest, 0);
2601 if (GET_CODE (addr1) == PLUS)
2603 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2604 addr2 = gen_rtx_PLUS (Pmode, op2, XEXP (addr1, 1));
2608 emit_move_insn (op2, GEN_INT (4));
2609 addr2 = gen_rtx_PLUS (Pmode, op2, addr1);
2612 emit_insn (gen_lshrdi3 (op3, src, GEN_INT (32)));
2613 if (BYTES_BIG_ENDIAN)
2615 word_high = change_address (dest, SImode, addr1);
2616 word_low = change_address (dest, SImode, addr2);
2617 emit_insn (gen_bswapsi2 (word_high, src_si));
2618 emit_insn (gen_bswapsi2 (word_low, op3_si));
2622 word_high = change_address (dest, SImode, addr2);
2623 word_low = change_address (dest, SImode, addr1);
2624 emit_insn (gen_bswapsi2 (word_low, src_si));
2625 emit_insn (gen_bswapsi2 (word_high, op3_si));
2630 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2631 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2632 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
2633 (clobber (match_operand:DI 3 "gpc_reg_operand" ""))
2634 (clobber (match_operand:DI 4 "" ""))]
2635 "TARGET_POWERPC64 && reload_completed"
2639 rtx dest = operands[0];
2640 rtx src = operands[1];
2641 rtx op2 = operands[2];
2642 rtx op3 = operands[3];
2643 rtx dest_si = simplify_gen_subreg (SImode, dest, DImode, 4);
2644 rtx src_si = simplify_gen_subreg (SImode, src, DImode, 4);
2645 rtx op2_si = simplify_gen_subreg (SImode, op2, DImode, 4);
2646 rtx op3_si = simplify_gen_subreg (SImode, op3, DImode, 4);
2648 emit_insn (gen_lshrdi3 (op2, src, GEN_INT (32)));
2649 emit_insn (gen_bswapsi2 (dest_si, src_si));
2650 emit_insn (gen_bswapsi2 (op3_si, op2_si));
2651 emit_insn (gen_ashldi3 (dest, dest, GEN_INT (32)));
2652 emit_insn (gen_iordi3 (dest, dest, op3));
2655 (define_insn "bswapdi2_32bit"
2656 [(set (match_operand:DI 0 "reg_or_mem_operand" "=&r,Z,??&r")
2657 (bswap:DI (match_operand:DI 1 "reg_or_mem_operand" "Z,r,r")))
2658 (clobber (match_scratch:SI 2 "=&b,&b,X"))]
2659 "!TARGET_POWERPC64 && (REG_P (operands[0]) || REG_P (operands[1]))"
2661 [(set_attr "length" "16,12,36")])
2664 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2665 (bswap:DI (match_operand:DI 1 "indexed_or_indirect_operand" "")))
2666 (clobber (match_operand:SI 2 "gpc_reg_operand" ""))]
2667 "!TARGET_POWERPC64 && reload_completed"
2671 rtx dest = operands[0];
2672 rtx src = operands[1];
2673 rtx op2 = operands[2];
2674 rtx dest_hi = simplify_gen_subreg (SImode, dest, DImode, 0);
2675 rtx dest_lo = simplify_gen_subreg (SImode, dest, DImode, 4);
2681 addr1 = XEXP (src, 0);
2682 if (GET_CODE (addr1) == PLUS)
2684 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2685 addr2 = gen_rtx_PLUS (SImode, op2, XEXP (addr1, 1));
2689 emit_move_insn (op2, GEN_INT (4));
2690 addr2 = gen_rtx_PLUS (SImode, op2, addr1);
2693 if (BYTES_BIG_ENDIAN)
2695 word_high = change_address (src, SImode, addr1);
2696 word_low = change_address (src, SImode, addr2);
2700 word_high = change_address (src, SImode, addr2);
2701 word_low = change_address (src, SImode, addr1);
2704 emit_insn (gen_bswapsi2 (dest_hi, word_low));
2705 emit_insn (gen_bswapsi2 (dest_lo, word_high));
2709 [(set (match_operand:DI 0 "indexed_or_indirect_operand" "")
2710 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2711 (clobber (match_operand:SI 2 "gpc_reg_operand" ""))]
2712 "!TARGET_POWERPC64 && reload_completed"
2716 rtx dest = operands[0];
2717 rtx src = operands[1];
2718 rtx op2 = operands[2];
2719 rtx src_high = simplify_gen_subreg (SImode, src, DImode, 0);
2720 rtx src_low = simplify_gen_subreg (SImode, src, DImode, 4);
2726 addr1 = XEXP (dest, 0);
2727 if (GET_CODE (addr1) == PLUS)
2729 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2730 addr2 = gen_rtx_PLUS (SImode, op2, XEXP (addr1, 1));
2734 emit_move_insn (op2, GEN_INT (4));
2735 addr2 = gen_rtx_PLUS (SImode, op2, addr1);
2738 if (BYTES_BIG_ENDIAN)
2740 word_high = change_address (dest, SImode, addr1);
2741 word_low = change_address (dest, SImode, addr2);
2745 word_high = change_address (dest, SImode, addr2);
2746 word_low = change_address (dest, SImode, addr1);
2749 emit_insn (gen_bswapsi2 (word_high, src_low));
2750 emit_insn (gen_bswapsi2 (word_low, src_high));
2754 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2755 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2756 (clobber (match_operand:SI 2 "" ""))]
2757 "!TARGET_POWERPC64 && reload_completed"
2761 rtx dest = operands[0];
2762 rtx src = operands[1];
2763 rtx src_high = simplify_gen_subreg (SImode, src, DImode, 0);
2764 rtx src_low = simplify_gen_subreg (SImode, src, DImode, 4);
2765 rtx dest_high = simplify_gen_subreg (SImode, dest, DImode, 0);
2766 rtx dest_low = simplify_gen_subreg (SImode, dest, DImode, 4);
2768 emit_insn (gen_bswapsi2 (dest_high, src_low));
2769 emit_insn (gen_bswapsi2 (dest_low, src_high));
2772 (define_expand "mulsi3"
2773 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
2774 (use (match_operand:SI 1 "gpc_reg_operand" ""))
2775 (use (match_operand:SI 2 "reg_or_short_operand" ""))]
2780 emit_insn (gen_mulsi3_mq (operands[0], operands[1], operands[2]));
2782 emit_insn (gen_mulsi3_no_mq (operands[0], operands[1], operands[2]));
2786 (define_insn "mulsi3_mq"
2787 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2788 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2789 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
2790 (clobber (match_scratch:SI 3 "=q,q"))]
2793 {muls|mullw} %0,%1,%2
2794 {muli|mulli} %0,%1,%2"
2796 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
2797 (const_string "imul3")
2798 (match_operand:SI 2 "short_cint_operand" "")
2799 (const_string "imul2")]
2800 (const_string "imul")))])
2802 (define_insn "mulsi3_no_mq"
2803 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2804 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2805 (match_operand:SI 2 "reg_or_short_operand" "r,I")))]
2808 {muls|mullw} %0,%1,%2
2809 {muli|mulli} %0,%1,%2"
2811 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
2812 (const_string "imul3")
2813 (match_operand:SI 2 "short_cint_operand" "")
2814 (const_string "imul2")]
2815 (const_string "imul")))])
2817 (define_insn "*mulsi3_mq_internal1"
2818 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2819 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2820 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2822 (clobber (match_scratch:SI 3 "=r,r"))
2823 (clobber (match_scratch:SI 4 "=q,q"))]
2826 {muls.|mullw.} %3,%1,%2
2828 [(set_attr "type" "imul_compare")
2829 (set_attr "length" "4,8")])
2832 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2833 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2834 (match_operand:SI 2 "gpc_reg_operand" ""))
2836 (clobber (match_scratch:SI 3 ""))
2837 (clobber (match_scratch:SI 4 ""))]
2838 "TARGET_POWER && reload_completed"
2839 [(parallel [(set (match_dup 3)
2840 (mult:SI (match_dup 1) (match_dup 2)))
2841 (clobber (match_dup 4))])
2843 (compare:CC (match_dup 3)
2847 (define_insn "*mulsi3_no_mq_internal1"
2848 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2849 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2850 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2852 (clobber (match_scratch:SI 3 "=r,r"))]
2855 {muls.|mullw.} %3,%1,%2
2857 [(set_attr "type" "imul_compare")
2858 (set_attr "length" "4,8")])
2861 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
2862 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2863 (match_operand:SI 2 "gpc_reg_operand" ""))
2865 (clobber (match_scratch:SI 3 ""))]
2866 "! TARGET_POWER && reload_completed"
2868 (mult:SI (match_dup 1) (match_dup 2)))
2870 (compare:CC (match_dup 3)
2874 (define_insn "*mulsi3_mq_internal2"
2875 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2876 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2877 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2879 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2880 (mult:SI (match_dup 1) (match_dup 2)))
2881 (clobber (match_scratch:SI 4 "=q,q"))]
2884 {muls.|mullw.} %0,%1,%2
2886 [(set_attr "type" "imul_compare")
2887 (set_attr "length" "4,8")])
2890 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2891 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2892 (match_operand:SI 2 "gpc_reg_operand" ""))
2894 (set (match_operand:SI 0 "gpc_reg_operand" "")
2895 (mult:SI (match_dup 1) (match_dup 2)))
2896 (clobber (match_scratch:SI 4 ""))]
2897 "TARGET_POWER && reload_completed"
2898 [(parallel [(set (match_dup 0)
2899 (mult:SI (match_dup 1) (match_dup 2)))
2900 (clobber (match_dup 4))])
2902 (compare:CC (match_dup 0)
2906 (define_insn "*mulsi3_no_mq_internal2"
2907 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2908 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2909 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2911 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2912 (mult:SI (match_dup 1) (match_dup 2)))]
2915 {muls.|mullw.} %0,%1,%2
2917 [(set_attr "type" "imul_compare")
2918 (set_attr "length" "4,8")])
2921 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
2922 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2923 (match_operand:SI 2 "gpc_reg_operand" ""))
2925 (set (match_operand:SI 0 "gpc_reg_operand" "")
2926 (mult:SI (match_dup 1) (match_dup 2)))]
2927 "! TARGET_POWER && reload_completed"
2929 (mult:SI (match_dup 1) (match_dup 2)))
2931 (compare:CC (match_dup 0)
2935 ;; Operand 1 is divided by operand 2; quotient goes to operand
2936 ;; 0 and remainder to operand 3.
2937 ;; ??? At some point, see what, if anything, we can do about if (x % y == 0).
2939 (define_expand "divmodsi4"
2940 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
2941 (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
2942 (match_operand:SI 2 "gpc_reg_operand" "")))
2943 (set (match_operand:SI 3 "register_operand" "")
2944 (mod:SI (match_dup 1) (match_dup 2)))])]
2945 "TARGET_POWER || (! TARGET_POWER && ! TARGET_POWERPC)"
2948 if (! TARGET_POWER && ! TARGET_POWERPC)
2950 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2951 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2952 emit_insn (gen_divss_call ());
2953 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2954 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
2959 (define_insn "*divmodsi4_internal"
2960 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2961 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2962 (match_operand:SI 2 "gpc_reg_operand" "r")))
2963 (set (match_operand:SI 3 "register_operand" "=q")
2964 (mod:SI (match_dup 1) (match_dup 2)))]
2967 [(set_attr "type" "idiv")])
2969 (define_expand "udiv<mode>3"
2970 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2971 (udiv:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2972 (match_operand:GPR 2 "gpc_reg_operand" "")))]
2973 "TARGET_POWERPC || (! TARGET_POWER && ! TARGET_POWERPC)"
2976 if (! TARGET_POWER && ! TARGET_POWERPC)
2978 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2979 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2980 emit_insn (gen_quous_call ());
2981 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2984 else if (TARGET_POWER)
2986 emit_insn (gen_udivsi3_mq (operands[0], operands[1], operands[2]));
2991 (define_insn "udivsi3_mq"
2992 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2993 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2994 (match_operand:SI 2 "gpc_reg_operand" "r")))
2995 (clobber (match_scratch:SI 3 "=q"))]
2996 "TARGET_POWERPC && TARGET_POWER"
2998 [(set_attr "type" "idiv")])
3000 (define_insn "*udivsi3_no_mq"
3001 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
3002 (udiv:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
3003 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
3004 "TARGET_POWERPC && ! TARGET_POWER"
3007 (cond [(match_operand:SI 0 "" "")
3008 (const_string "idiv")]
3009 (const_string "ldiv")))])
3012 ;; For powers of two we can do srai/aze for divide and then adjust for
3013 ;; modulus. If it isn't a power of two, FAIL on POWER so divmodsi4 will be
3014 ;; used; for PowerPC, force operands into register and do a normal divide;
3015 ;; for AIX common-mode, use quoss call on register operands.
3016 (define_expand "div<mode>3"
3017 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
3018 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
3019 (match_operand:GPR 2 "reg_or_cint_operand" "")))]
3023 if (GET_CODE (operands[2]) == CONST_INT
3024 && INTVAL (operands[2]) > 0
3025 && exact_log2 (INTVAL (operands[2])) >= 0)
3027 else if (TARGET_POWERPC)
3029 operands[2] = force_reg (<MODE>mode, operands[2]);
3032 emit_insn (gen_divsi3_mq (operands[0], operands[1], operands[2]));
3036 else if (TARGET_POWER)
3040 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
3041 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
3042 emit_insn (gen_quoss_call ());
3043 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
3048 (define_insn "divsi3_mq"
3049 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3050 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3051 (match_operand:SI 2 "gpc_reg_operand" "r")))
3052 (clobber (match_scratch:SI 3 "=q"))]
3053 "TARGET_POWERPC && TARGET_POWER"
3055 [(set_attr "type" "idiv")])
3057 (define_insn "*div<mode>3_no_mq"
3058 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
3059 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
3060 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
3061 "TARGET_POWERPC && ! TARGET_POWER"
3064 (cond [(match_operand:SI 0 "" "")
3065 (const_string "idiv")]
3066 (const_string "ldiv")))])
3068 (define_expand "mod<mode>3"
3069 [(use (match_operand:GPR 0 "gpc_reg_operand" ""))
3070 (use (match_operand:GPR 1 "gpc_reg_operand" ""))
3071 (use (match_operand:GPR 2 "reg_or_cint_operand" ""))]
3079 if (GET_CODE (operands[2]) != CONST_INT
3080 || INTVAL (operands[2]) <= 0
3081 || (i = exact_log2 (INTVAL (operands[2]))) < 0)
3084 temp1 = gen_reg_rtx (<MODE>mode);
3085 temp2 = gen_reg_rtx (<MODE>mode);
3087 emit_insn (gen_div<mode>3 (temp1, operands[1], operands[2]));
3088 emit_insn (gen_ashl<mode>3 (temp2, temp1, GEN_INT (i)));
3089 emit_insn (gen_sub<mode>3 (operands[0], operands[1], temp2));
3094 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
3095 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
3096 (match_operand:GPR 2 "exact_log2_cint_operand" "N")))]
3098 "{srai|sra<wd>i} %0,%1,%p2\;{aze|addze} %0,%0"
3099 [(set_attr "type" "two")
3100 (set_attr "length" "8")])
3103 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3104 (compare:CC (div:P (match_operand:P 1 "gpc_reg_operand" "r,r")
3105 (match_operand:P 2 "exact_log2_cint_operand" "N,N"))
3107 (clobber (match_scratch:P 3 "=r,r"))]
3110 {srai|sra<wd>i} %3,%1,%p2\;{aze.|addze.} %3,%3
3112 [(set_attr "type" "compare")
3113 (set_attr "length" "8,12")
3114 (set_attr "cell_micro" "not")])
3117 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3118 (compare:CC (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
3119 (match_operand:GPR 2 "exact_log2_cint_operand"
3122 (clobber (match_scratch:GPR 3 ""))]
3125 (div:<MODE> (match_dup 1) (match_dup 2)))
3127 (compare:CC (match_dup 3)
3132 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3133 (compare:CC (div:P (match_operand:P 1 "gpc_reg_operand" "r,r")
3134 (match_operand:P 2 "exact_log2_cint_operand" "N,N"))
3136 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
3137 (div:P (match_dup 1) (match_dup 2)))]
3140 {srai|sra<wd>i} %0,%1,%p2\;{aze.|addze.} %0,%0
3142 [(set_attr "type" "compare")
3143 (set_attr "length" "8,12")
3144 (set_attr "cell_micro" "not")])
3147 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3148 (compare:CC (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
3149 (match_operand:GPR 2 "exact_log2_cint_operand"
3152 (set (match_operand:GPR 0 "gpc_reg_operand" "")
3153 (div:GPR (match_dup 1) (match_dup 2)))]
3156 (div:<MODE> (match_dup 1) (match_dup 2)))
3158 (compare:CC (match_dup 0)
3163 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3166 (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
3168 (zero_extend:DI (match_operand:SI 4 "register_operand" "2")))
3169 (match_operand:SI 3 "gpc_reg_operand" "r")))
3170 (set (match_operand:SI 2 "register_operand" "=*q")
3173 (zero_extend:DI (match_dup 1)) (const_int 32))
3174 (zero_extend:DI (match_dup 4)))
3178 [(set_attr "type" "idiv")])
3180 ;; To do unsigned divide we handle the cases of the divisor looking like a
3181 ;; negative number. If it is a constant that is less than 2**31, we don't
3182 ;; have to worry about the branches. So make a few subroutines here.
3184 ;; First comes the normal case.
3185 (define_expand "udivmodsi4_normal"
3186 [(set (match_dup 4) (const_int 0))
3187 (parallel [(set (match_operand:SI 0 "" "")
3188 (udiv:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
3190 (zero_extend:DI (match_operand:SI 1 "" "")))
3191 (match_operand:SI 2 "" "")))
3192 (set (match_operand:SI 3 "" "")
3193 (umod:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
3195 (zero_extend:DI (match_dup 1)))
3199 { operands[4] = gen_reg_rtx (SImode); }")
3201 ;; This handles the branches.
3202 (define_expand "udivmodsi4_tests"
3203 [(set (match_operand:SI 0 "" "") (const_int 0))
3204 (set (match_operand:SI 3 "" "") (match_operand:SI 1 "" ""))
3205 (set (match_dup 5) (compare:CCUNS (match_dup 1) (match_operand:SI 2 "" "")))
3206 (set (pc) (if_then_else (ltu (match_dup 5) (const_int 0))
3207 (label_ref (match_operand:SI 4 "" "")) (pc)))
3208 (set (match_dup 0) (const_int 1))
3209 (set (match_dup 3) (minus:SI (match_dup 1) (match_dup 2)))
3210 (set (match_dup 6) (compare:CC (match_dup 2) (const_int 0)))
3211 (set (pc) (if_then_else (lt (match_dup 6) (const_int 0))
3212 (label_ref (match_dup 4)) (pc)))]
3215 { operands[5] = gen_reg_rtx (CCUNSmode);
3216 operands[6] = gen_reg_rtx (CCmode);
3219 (define_expand "udivmodsi4"
3220 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
3221 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "")
3222 (match_operand:SI 2 "reg_or_cint_operand" "")))
3223 (set (match_operand:SI 3 "gpc_reg_operand" "")
3224 (umod:SI (match_dup 1) (match_dup 2)))])]
3232 if (! TARGET_POWERPC)
3234 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
3235 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
3236 emit_insn (gen_divus_call ());
3237 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
3238 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
3245 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) < 0)
3247 operands[2] = force_reg (SImode, operands[2]);
3248 label = gen_label_rtx ();
3249 emit (gen_udivmodsi4_tests (operands[0], operands[1], operands[2],
3250 operands[3], label));
3253 operands[2] = force_reg (SImode, operands[2]);
3255 emit (gen_udivmodsi4_normal (operands[0], operands[1], operands[2],
3263 ;; AIX architecture-independent common-mode multiply (DImode),
3264 ;; divide/modulus, and quotient subroutine calls. Input operands in R3 and
3265 ;; R4; results in R3 and sometimes R4; link register always clobbered by bla
3266 ;; instruction; R0 sometimes clobbered; also, MQ sometimes clobbered but
3267 ;; assumed unused if generating common-mode, so ignore.
3268 (define_insn "mulh_call"
3271 (lshiftrt:DI (mult:DI (sign_extend:DI (reg:SI 3))
3272 (sign_extend:DI (reg:SI 4)))
3274 (clobber (reg:SI LR_REGNO))]
3275 "! TARGET_POWER && ! TARGET_POWERPC"
3277 [(set_attr "type" "imul")])
3279 (define_insn "mull_call"
3281 (mult:DI (sign_extend:DI (reg:SI 3))
3282 (sign_extend:DI (reg:SI 4))))
3283 (clobber (reg:SI LR_REGNO))
3284 (clobber (reg:SI 0))]
3285 "! TARGET_POWER && ! TARGET_POWERPC"
3287 [(set_attr "type" "imul")])
3289 (define_insn "divss_call"
3291 (div:SI (reg:SI 3) (reg:SI 4)))
3293 (mod:SI (reg:SI 3) (reg:SI 4)))
3294 (clobber (reg:SI LR_REGNO))
3295 (clobber (reg:SI 0))]
3296 "! TARGET_POWER && ! TARGET_POWERPC"
3298 [(set_attr "type" "idiv")])
3300 (define_insn "divus_call"
3302 (udiv:SI (reg:SI 3) (reg:SI 4)))
3304 (umod:SI (reg:SI 3) (reg:SI 4)))
3305 (clobber (reg:SI LR_REGNO))
3306 (clobber (reg:SI 0))
3307 (clobber (match_scratch:CC 0 "=x"))
3308 (clobber (reg:CC CR1_REGNO))]
3309 "! TARGET_POWER && ! TARGET_POWERPC"
3311 [(set_attr "type" "idiv")])
3313 (define_insn "quoss_call"
3315 (div:SI (reg:SI 3) (reg:SI 4)))
3316 (clobber (reg:SI LR_REGNO))]
3317 "! TARGET_POWER && ! TARGET_POWERPC"
3319 [(set_attr "type" "idiv")])
3321 (define_insn "quous_call"
3323 (udiv:SI (reg:SI 3) (reg:SI 4)))
3324 (clobber (reg:SI LR_REGNO))
3325 (clobber (reg:SI 0))
3326 (clobber (match_scratch:CC 0 "=x"))
3327 (clobber (reg:CC CR1_REGNO))]
3328 "! TARGET_POWER && ! TARGET_POWERPC"
3330 [(set_attr "type" "idiv")])
3332 ;; Logical instructions
3333 ;; The logical instructions are mostly combined by using match_operator,
3334 ;; but the plain AND insns are somewhat different because there is no
3335 ;; plain 'andi' (only 'andi.'), no plain 'andis', and there are all
3336 ;; those rotate-and-mask operations. Thus, the AND insns come first.
3338 (define_expand "andsi3"
3340 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3341 (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
3342 (match_operand:SI 2 "and_operand" "")))
3343 (clobber (match_scratch:CC 3 ""))])]
3347 (define_insn "andsi3_mc"
3348 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
3349 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
3350 (match_operand:SI 2 "and_operand" "?r,T,K,L")))
3351 (clobber (match_scratch:CC 3 "=X,X,x,x"))]
3352 "rs6000_gen_cell_microcode"
3355 {rlinm|rlwinm} %0,%1,0,%m2,%M2
3356 {andil.|andi.} %0,%1,%b2
3357 {andiu.|andis.} %0,%1,%u2"
3358 [(set_attr "type" "*,*,fast_compare,fast_compare")])
3360 (define_insn "andsi3_nomc"
3361 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3362 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
3363 (match_operand:SI 2 "and_operand" "?r,T")))
3364 (clobber (match_scratch:CC 3 "=X,X"))]
3365 "!rs6000_gen_cell_microcode"
3368 {rlinm|rlwinm} %0,%1,0,%m2,%M2")
3370 (define_insn "andsi3_internal0_nomc"
3371 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3372 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
3373 (match_operand:SI 2 "and_operand" "?r,T")))]
3374 "!rs6000_gen_cell_microcode"
3377 {rlinm|rlwinm} %0,%1,0,%m2,%M2")
3380 ;; Note to set cr's other than cr0 we do the and immediate and then
3381 ;; the test again -- this avoids a mfcr which on the higher end
3382 ;; machines causes an execution serialization
3384 (define_insn "*andsi3_internal2_mc"
3385 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
3386 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
3387 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
3389 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
3390 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
3391 "TARGET_32BIT && rs6000_gen_cell_microcode"
3394 {andil.|andi.} %3,%1,%b2
3395 {andiu.|andis.} %3,%1,%u2
3396 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
3401 [(set_attr "type" "fast_compare,fast_compare,fast_compare,delayed_compare,\
3402 compare,compare,compare,compare")
3403 (set_attr "length" "4,4,4,4,8,8,8,8")])
3405 (define_insn "*andsi3_internal3_mc"
3406 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
3407 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
3408 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
3410 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
3411 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
3412 "TARGET_64BIT && rs6000_gen_cell_microcode"
3415 {andil.|andi.} %3,%1,%b2
3416 {andiu.|andis.} %3,%1,%u2
3417 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
3422 [(set_attr "type" "compare,fast_compare,fast_compare,delayed_compare,compare,\
3423 compare,compare,compare")
3424 (set_attr "length" "8,4,4,4,8,8,8,8")])
3427 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3428 (compare:CC (and:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
3429 (match_operand:GPR 2 "and_operand" ""))
3431 (clobber (match_scratch:GPR 3 ""))
3432 (clobber (match_scratch:CC 4 ""))]
3434 [(parallel [(set (match_dup 3)
3435 (and:<MODE> (match_dup 1)
3437 (clobber (match_dup 4))])
3439 (compare:CC (match_dup 3)
3443 ;; We don't have a 32 bit "and. rt,ra,rb" for ppc64. cr is set from the
3444 ;; whole 64 bit reg, and we don't know what is in the high 32 bits.
3447 [(set (match_operand:CC 0 "cc_reg_operand" "")
3448 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
3449 (match_operand:SI 2 "gpc_reg_operand" ""))
3451 (clobber (match_scratch:SI 3 ""))
3452 (clobber (match_scratch:CC 4 ""))]
3453 "TARGET_POWERPC64 && reload_completed"
3454 [(parallel [(set (match_dup 3)
3455 (and:SI (match_dup 1)
3457 (clobber (match_dup 4))])
3459 (compare:CC (match_dup 3)
3463 (define_insn "*andsi3_internal4"
3464 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
3465 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
3466 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
3468 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
3469 (and:SI (match_dup 1)
3471 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
3472 "TARGET_32BIT && rs6000_gen_cell_microcode"
3475 {andil.|andi.} %0,%1,%b2
3476 {andiu.|andis.} %0,%1,%u2
3477 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
3482 [(set_attr "type" "fast_compare,fast_compare,fast_compare,delayed_compare,\
3483 compare,compare,compare,compare")
3484 (set_attr "length" "4,4,4,4,8,8,8,8")])
3486 (define_insn "*andsi3_internal5_mc"
3487 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
3488 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
3489 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
3491 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
3492 (and:SI (match_dup 1)
3494 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
3495 "TARGET_64BIT && rs6000_gen_cell_microcode"
3498 {andil.|andi.} %0,%1,%b2
3499 {andiu.|andis.} %0,%1,%u2
3500 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
3505 [(set_attr "type" "compare,fast_compare,fast_compare,delayed_compare,compare,\
3506 compare,compare,compare")
3507 (set_attr "length" "8,4,4,4,8,8,8,8")])
3510 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3511 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
3512 (match_operand:SI 2 "and_operand" ""))
3514 (set (match_operand:SI 0 "gpc_reg_operand" "")
3515 (and:SI (match_dup 1)
3517 (clobber (match_scratch:CC 4 ""))]
3519 [(parallel [(set (match_dup 0)
3520 (and:SI (match_dup 1)
3522 (clobber (match_dup 4))])
3524 (compare:CC (match_dup 0)
3529 [(set (match_operand:CC 3 "cc_reg_operand" "")
3530 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
3531 (match_operand:SI 2 "gpc_reg_operand" ""))
3533 (set (match_operand:SI 0 "gpc_reg_operand" "")
3534 (and:SI (match_dup 1)
3536 (clobber (match_scratch:CC 4 ""))]
3537 "TARGET_POWERPC64 && reload_completed"
3538 [(parallel [(set (match_dup 0)
3539 (and:SI (match_dup 1)
3541 (clobber (match_dup 4))])
3543 (compare:CC (match_dup 0)
3547 ;; Handle the PowerPC64 rlwinm corner case
3549 (define_insn_and_split "*andsi3_internal6"
3550 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3551 (and:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3552 (match_operand:SI 2 "mask_operand_wrap" "i")))]
3557 (and:SI (rotate:SI (match_dup 1) (match_dup 3))
3560 (rotate:SI (match_dup 0) (match_dup 5)))]
3563 int mb = extract_MB (operands[2]);
3564 int me = extract_ME (operands[2]);
3565 operands[3] = GEN_INT (me + 1);
3566 operands[5] = GEN_INT (32 - (me + 1));
3567 operands[4] = GEN_INT (~((HOST_WIDE_INT) -1 << (33 + me - mb)));
3569 [(set_attr "length" "8")])
3571 (define_expand "iorsi3"
3572 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3573 (ior:SI (match_operand:SI 1 "gpc_reg_operand" "")
3574 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
3578 if (GET_CODE (operands[2]) == CONST_INT
3579 && ! logical_operand (operands[2], SImode))
3581 HOST_WIDE_INT value = INTVAL (operands[2]);
3582 rtx tmp = ((!can_create_pseudo_p ()
3583 || rtx_equal_p (operands[0], operands[1]))
3584 ? operands[0] : gen_reg_rtx (SImode));
3586 emit_insn (gen_iorsi3 (tmp, operands[1],
3587 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
3588 emit_insn (gen_iorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
3593 (define_expand "xorsi3"
3594 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3595 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
3596 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
3600 if (GET_CODE (operands[2]) == CONST_INT
3601 && ! logical_operand (operands[2], SImode))
3603 HOST_WIDE_INT value = INTVAL (operands[2]);
3604 rtx tmp = ((!can_create_pseudo_p ()
3605 || rtx_equal_p (operands[0], operands[1]))
3606 ? operands[0] : gen_reg_rtx (SImode));
3608 emit_insn (gen_xorsi3 (tmp, operands[1],
3609 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
3610 emit_insn (gen_xorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
3615 (define_insn "*boolsi3_internal1"
3616 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
3617 (match_operator:SI 3 "boolean_or_operator"
3618 [(match_operand:SI 1 "gpc_reg_operand" "%r,r,r")
3619 (match_operand:SI 2 "logical_operand" "r,K,L")]))]
3623 {%q3il|%q3i} %0,%1,%b2
3624 {%q3iu|%q3is} %0,%1,%u2")
3626 (define_insn "*boolsi3_internal2"
3627 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3628 (compare:CC (match_operator:SI 4 "boolean_or_operator"
3629 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
3630 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3632 (clobber (match_scratch:SI 3 "=r,r"))]
3637 [(set_attr "type" "fast_compare,compare")
3638 (set_attr "length" "4,8")])
3641 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3642 (compare:CC (match_operator:SI 4 "boolean_operator"
3643 [(match_operand:SI 1 "gpc_reg_operand" "")
3644 (match_operand:SI 2 "gpc_reg_operand" "")])
3646 (clobber (match_scratch:SI 3 ""))]
3647 "TARGET_32BIT && reload_completed"
3648 [(set (match_dup 3) (match_dup 4))
3650 (compare:CC (match_dup 3)
3654 (define_insn "*boolsi3_internal3"
3655 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3656 (compare:CC (match_operator:SI 4 "boolean_operator"
3657 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
3658 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3660 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3666 [(set_attr "type" "fast_compare,compare")
3667 (set_attr "length" "4,8")])
3670 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3671 (compare:CC (match_operator:SI 4 "boolean_operator"
3672 [(match_operand:SI 1 "gpc_reg_operand" "")
3673 (match_operand:SI 2 "gpc_reg_operand" "")])
3675 (set (match_operand:SI 0 "gpc_reg_operand" "")
3677 "TARGET_32BIT && reload_completed"
3678 [(set (match_dup 0) (match_dup 4))
3680 (compare:CC (match_dup 0)
3684 ;; Split a logical operation that we can't do in one insn into two insns,
3685 ;; each of which does one 16-bit part. This is used by combine.
3688 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3689 (match_operator:SI 3 "boolean_or_operator"
3690 [(match_operand:SI 1 "gpc_reg_operand" "")
3691 (match_operand:SI 2 "non_logical_cint_operand" "")]))]
3693 [(set (match_dup 0) (match_dup 4))
3694 (set (match_dup 0) (match_dup 5))]
3698 i = GEN_INT (INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff));
3699 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
3701 i = GEN_INT (INTVAL (operands[2]) & 0xffff);
3702 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
3706 (define_insn "*boolcsi3_internal1"
3707 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3708 (match_operator:SI 3 "boolean_operator"
3709 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
3710 (match_operand:SI 2 "gpc_reg_operand" "r")]))]
3714 (define_insn "*boolcsi3_internal2"
3715 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3716 (compare:CC (match_operator:SI 4 "boolean_operator"
3717 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
3718 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3720 (clobber (match_scratch:SI 3 "=r,r"))]
3725 [(set_attr "type" "compare")
3726 (set_attr "length" "4,8")])
3729 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3730 (compare:CC (match_operator:SI 4 "boolean_operator"
3731 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3732 (match_operand:SI 2 "gpc_reg_operand" "")])
3734 (clobber (match_scratch:SI 3 ""))]
3735 "TARGET_32BIT && reload_completed"
3736 [(set (match_dup 3) (match_dup 4))
3738 (compare:CC (match_dup 3)
3742 (define_insn "*boolcsi3_internal3"
3743 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3744 (compare:CC (match_operator:SI 4 "boolean_operator"
3745 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
3746 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3748 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3754 [(set_attr "type" "compare")
3755 (set_attr "length" "4,8")])
3758 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3759 (compare:CC (match_operator:SI 4 "boolean_operator"
3760 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3761 (match_operand:SI 2 "gpc_reg_operand" "")])
3763 (set (match_operand:SI 0 "gpc_reg_operand" "")
3765 "TARGET_32BIT && reload_completed"
3766 [(set (match_dup 0) (match_dup 4))
3768 (compare:CC (match_dup 0)
3772 (define_insn "*boolccsi3_internal1"
3773 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3774 (match_operator:SI 3 "boolean_operator"
3775 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
3776 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))]))]
3780 (define_insn "*boolccsi3_internal2"
3781 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3782 (compare:CC (match_operator:SI 4 "boolean_operator"
3783 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
3784 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
3786 (clobber (match_scratch:SI 3 "=r,r"))]
3791 [(set_attr "type" "fast_compare,compare")
3792 (set_attr "length" "4,8")])
3795 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3796 (compare:CC (match_operator:SI 4 "boolean_operator"
3797 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3798 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
3800 (clobber (match_scratch:SI 3 ""))]
3801 "TARGET_32BIT && reload_completed"
3802 [(set (match_dup 3) (match_dup 4))
3804 (compare:CC (match_dup 3)
3808 (define_insn "*boolccsi3_internal3"
3809 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3810 (compare:CC (match_operator:SI 4 "boolean_operator"
3811 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
3812 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
3814 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3820 [(set_attr "type" "fast_compare,compare")
3821 (set_attr "length" "4,8")])
3824 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3825 (compare:CC (match_operator:SI 4 "boolean_operator"
3826 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3827 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
3829 (set (match_operand:SI 0 "gpc_reg_operand" "")
3831 "TARGET_32BIT && reload_completed"
3832 [(set (match_dup 0) (match_dup 4))
3834 (compare:CC (match_dup 0)
3838 ;; maskir insn. We need four forms because things might be in arbitrary
3839 ;; orders. Don't define forms that only set CR fields because these
3840 ;; would modify an input register.
3842 (define_insn "*maskir_internal1"
3843 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3844 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
3845 (match_operand:SI 1 "gpc_reg_operand" "0"))
3846 (and:SI (match_dup 2)
3847 (match_operand:SI 3 "gpc_reg_operand" "r"))))]
3851 (define_insn "*maskir_internal2"
3852 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3853 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
3854 (match_operand:SI 1 "gpc_reg_operand" "0"))
3855 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3860 (define_insn "*maskir_internal3"
3861 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3862 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r")
3863 (match_operand:SI 3 "gpc_reg_operand" "r"))
3864 (and:SI (not:SI (match_dup 2))
3865 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
3869 (define_insn "*maskir_internal4"
3870 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3871 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3872 (match_operand:SI 2 "gpc_reg_operand" "r"))
3873 (and:SI (not:SI (match_dup 2))
3874 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
3878 (define_insn "*maskir_internal5"
3879 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3881 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3882 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
3883 (and:SI (match_dup 2)
3884 (match_operand:SI 3 "gpc_reg_operand" "r,r")))
3886 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3887 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3888 (and:SI (match_dup 2) (match_dup 3))))]
3893 [(set_attr "type" "compare")
3894 (set_attr "length" "4,8")])
3897 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3899 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
3900 (match_operand:SI 1 "gpc_reg_operand" ""))
3901 (and:SI (match_dup 2)
3902 (match_operand:SI 3 "gpc_reg_operand" "")))
3904 (set (match_operand:SI 0 "gpc_reg_operand" "")
3905 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3906 (and:SI (match_dup 2) (match_dup 3))))]
3907 "TARGET_POWER && reload_completed"
3909 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3910 (and:SI (match_dup 2) (match_dup 3))))
3912 (compare:CC (match_dup 0)
3916 (define_insn "*maskir_internal6"
3917 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3919 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3920 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
3921 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
3924 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3925 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3926 (and:SI (match_dup 3) (match_dup 2))))]
3931 [(set_attr "type" "compare")
3932 (set_attr "length" "4,8")])
3935 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3937 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
3938 (match_operand:SI 1 "gpc_reg_operand" ""))
3939 (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
3942 (set (match_operand:SI 0 "gpc_reg_operand" "")
3943 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3944 (and:SI (match_dup 3) (match_dup 2))))]
3945 "TARGET_POWER && reload_completed"
3947 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3948 (and:SI (match_dup 3) (match_dup 2))))
3950 (compare:CC (match_dup 0)
3954 (define_insn "*maskir_internal7"
3955 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3957 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r,r")
3958 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
3959 (and:SI (not:SI (match_dup 2))
3960 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
3962 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3963 (ior:SI (and:SI (match_dup 2) (match_dup 3))
3964 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3969 [(set_attr "type" "compare")
3970 (set_attr "length" "4,8")])
3973 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3975 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "")
3976 (match_operand:SI 3 "gpc_reg_operand" ""))
3977 (and:SI (not:SI (match_dup 2))
3978 (match_operand:SI 1 "gpc_reg_operand" "")))
3980 (set (match_operand:SI 0 "gpc_reg_operand" "")
3981 (ior:SI (and:SI (match_dup 2) (match_dup 3))
3982 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3983 "TARGET_POWER && reload_completed"
3985 (ior:SI (and:SI (match_dup 2) (match_dup 3))
3986 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
3988 (compare:CC (match_dup 0)
3992 (define_insn "*maskir_internal8"
3993 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3995 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
3996 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3997 (and:SI (not:SI (match_dup 2))
3998 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
4000 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4001 (ior:SI (and:SI (match_dup 3) (match_dup 2))
4002 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
4007 [(set_attr "type" "compare")
4008 (set_attr "length" "4,8")])
4011 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
4013 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
4014 (match_operand:SI 2 "gpc_reg_operand" ""))
4015 (and:SI (not:SI (match_dup 2))
4016 (match_operand:SI 1 "gpc_reg_operand" "")))
4018 (set (match_operand:SI 0 "gpc_reg_operand" "")
4019 (ior:SI (and:SI (match_dup 3) (match_dup 2))
4020 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
4021 "TARGET_POWER && reload_completed"
4023 (ior:SI (and:SI (match_dup 3) (match_dup 2))
4024 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
4026 (compare:CC (match_dup 0)
4030 ;; Rotate and shift insns, in all their variants. These support shifts,
4031 ;; field inserts and extracts, and various combinations thereof.
4032 (define_expand "insv"
4033 [(set (zero_extract (match_operand 0 "gpc_reg_operand" "")
4034 (match_operand:SI 1 "const_int_operand" "")
4035 (match_operand:SI 2 "const_int_operand" ""))
4036 (match_operand 3 "gpc_reg_operand" ""))]
4040 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
4041 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
4042 compiler if the address of the structure is taken later. Likewise, do
4043 not handle invalid E500 subregs. */
4044 if (GET_CODE (operands[0]) == SUBREG
4045 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD
4046 || ((TARGET_E500_DOUBLE || TARGET_SPE)
4047 && invalid_e500_subreg (operands[0], GET_MODE (operands[0])))))
4050 if (TARGET_POWERPC64 && GET_MODE (operands[0]) == DImode)
4051 emit_insn (gen_insvdi (operands[0], operands[1], operands[2], operands[3]));
4053 emit_insn (gen_insvsi (operands[0], operands[1], operands[2], operands[3]));
4057 (define_insn "insvsi"
4058 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4059 (match_operand:SI 1 "const_int_operand" "i")
4060 (match_operand:SI 2 "const_int_operand" "i"))
4061 (match_operand:SI 3 "gpc_reg_operand" "r"))]
4065 int start = INTVAL (operands[2]) & 31;
4066 int size = INTVAL (operands[1]) & 31;
4068 operands[4] = GEN_INT (32 - start - size);
4069 operands[1] = GEN_INT (start + size - 1);
4070 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
4072 [(set_attr "type" "insert_word")])
4074 (define_insn "*insvsi_internal1"
4075 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4076 (match_operand:SI 1 "const_int_operand" "i")
4077 (match_operand:SI 2 "const_int_operand" "i"))
4078 (rotate:SI (match_operand:SI 3 "gpc_reg_operand" "r")
4079 (match_operand:SI 4 "const_int_operand" "i")))]
4080 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
4083 int shift = INTVAL (operands[4]) & 31;
4084 int start = INTVAL (operands[2]) & 31;
4085 int size = INTVAL (operands[1]) & 31;
4087 operands[4] = GEN_INT (shift - start - size);
4088 operands[1] = GEN_INT (start + size - 1);
4089 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
4091 [(set_attr "type" "insert_word")])
4093 (define_insn "*insvsi_internal2"
4094 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4095 (match_operand:SI 1 "const_int_operand" "i")
4096 (match_operand:SI 2 "const_int_operand" "i"))
4097 (ashiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
4098 (match_operand:SI 4 "const_int_operand" "i")))]
4099 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
4102 int shift = INTVAL (operands[4]) & 31;
4103 int start = INTVAL (operands[2]) & 31;
4104 int size = INTVAL (operands[1]) & 31;
4106 operands[4] = GEN_INT (32 - shift - start - size);
4107 operands[1] = GEN_INT (start + size - 1);
4108 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
4110 [(set_attr "type" "insert_word")])
4112 (define_insn "*insvsi_internal3"
4113 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4114 (match_operand:SI 1 "const_int_operand" "i")
4115 (match_operand:SI 2 "const_int_operand" "i"))
4116 (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
4117 (match_operand:SI 4 "const_int_operand" "i")))]
4118 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
4121 int shift = INTVAL (operands[4]) & 31;
4122 int start = INTVAL (operands[2]) & 31;
4123 int size = INTVAL (operands[1]) & 31;
4125 operands[4] = GEN_INT (32 - shift - start - size);
4126 operands[1] = GEN_INT (start + size - 1);
4127 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
4129 [(set_attr "type" "insert_word")])
4131 (define_insn "*insvsi_internal4"
4132 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4133 (match_operand:SI 1 "const_int_operand" "i")
4134 (match_operand:SI 2 "const_int_operand" "i"))
4135 (zero_extract:SI (match_operand:SI 3 "gpc_reg_operand" "r")
4136 (match_operand:SI 4 "const_int_operand" "i")
4137 (match_operand:SI 5 "const_int_operand" "i")))]
4138 "INTVAL (operands[4]) >= INTVAL (operands[1])"
4141 int extract_start = INTVAL (operands[5]) & 31;
4142 int extract_size = INTVAL (operands[4]) & 31;
4143 int insert_start = INTVAL (operands[2]) & 31;
4144 int insert_size = INTVAL (operands[1]) & 31;
4146 /* Align extract field with insert field */
4147 operands[5] = GEN_INT (extract_start + extract_size - insert_start - insert_size);
4148 operands[1] = GEN_INT (insert_start + insert_size - 1);
4149 return \"{rlimi|rlwimi} %0,%3,%h5,%h2,%h1\";
4151 [(set_attr "type" "insert_word")])
4153 ;; combine patterns for rlwimi
4154 (define_insn "*insvsi_internal5"
4155 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4156 (ior:SI (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
4157 (match_operand:SI 1 "mask_operand" "i"))
4158 (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
4159 (match_operand:SI 2 "const_int_operand" "i"))
4160 (match_operand:SI 5 "mask_operand" "i"))))]
4161 "TARGET_POWERPC && INTVAL(operands[1]) == ~INTVAL(operands[5])"
4164 int me = extract_ME(operands[5]);
4165 int mb = extract_MB(operands[5]);
4166 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
4167 operands[2] = GEN_INT(mb);
4168 operands[1] = GEN_INT(me);
4169 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
4171 [(set_attr "type" "insert_word")])
4173 (define_insn "*insvsi_internal6"
4174 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4175 (ior:SI (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
4176 (match_operand:SI 2 "const_int_operand" "i"))
4177 (match_operand:SI 5 "mask_operand" "i"))
4178 (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
4179 (match_operand:SI 1 "mask_operand" "i"))))]
4180 "TARGET_POWERPC && INTVAL(operands[1]) == ~INTVAL(operands[5])"
4183 int me = extract_ME(operands[5]);
4184 int mb = extract_MB(operands[5]);
4185 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
4186 operands[2] = GEN_INT(mb);
4187 operands[1] = GEN_INT(me);
4188 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
4190 [(set_attr "type" "insert_word")])
4192 (define_insn "insvdi"
4193 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
4194 (match_operand:SI 1 "const_int_operand" "i")
4195 (match_operand:SI 2 "const_int_operand" "i"))
4196 (match_operand:DI 3 "gpc_reg_operand" "r"))]
4200 int start = INTVAL (operands[2]) & 63;
4201 int size = INTVAL (operands[1]) & 63;
4203 operands[1] = GEN_INT (64 - start - size);
4204 return \"rldimi %0,%3,%H1,%H2\";
4206 [(set_attr "type" "insert_dword")])
4208 (define_insn "*insvdi_internal2"
4209 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
4210 (match_operand:SI 1 "const_int_operand" "i")
4211 (match_operand:SI 2 "const_int_operand" "i"))
4212 (ashiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
4213 (match_operand:SI 4 "const_int_operand" "i")))]
4215 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
4218 int shift = INTVAL (operands[4]) & 63;
4219 int start = (INTVAL (operands[2]) & 63) - 32;
4220 int size = INTVAL (operands[1]) & 63;
4222 operands[4] = GEN_INT (64 - shift - start - size);
4223 operands[2] = GEN_INT (start);
4224 operands[1] = GEN_INT (start + size - 1);
4225 return \"rlwimi %0,%3,%h4,%h2,%h1\";
4228 (define_insn "*insvdi_internal3"
4229 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
4230 (match_operand:SI 1 "const_int_operand" "i")
4231 (match_operand:SI 2 "const_int_operand" "i"))
4232 (lshiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
4233 (match_operand:SI 4 "const_int_operand" "i")))]
4235 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
4238 int shift = INTVAL (operands[4]) & 63;
4239 int start = (INTVAL (operands[2]) & 63) - 32;
4240 int size = INTVAL (operands[1]) & 63;
4242 operands[4] = GEN_INT (64 - shift - start - size);
4243 operands[2] = GEN_INT (start);
4244 operands[1] = GEN_INT (start + size - 1);
4245 return \"rlwimi %0,%3,%h4,%h2,%h1\";
4248 (define_expand "extzv"
4249 [(set (match_operand 0 "gpc_reg_operand" "")
4250 (zero_extract (match_operand 1 "gpc_reg_operand" "")
4251 (match_operand:SI 2 "const_int_operand" "")
4252 (match_operand:SI 3 "const_int_operand" "")))]
4256 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
4257 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
4258 compiler if the address of the structure is taken later. */
4259 if (GET_CODE (operands[0]) == SUBREG
4260 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
4263 if (TARGET_POWERPC64 && GET_MODE (operands[1]) == DImode)
4264 emit_insn (gen_extzvdi (operands[0], operands[1], operands[2], operands[3]));
4266 emit_insn (gen_extzvsi (operands[0], operands[1], operands[2], operands[3]));
4270 (define_insn "extzvsi"
4271 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4272 (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4273 (match_operand:SI 2 "const_int_operand" "i")
4274 (match_operand:SI 3 "const_int_operand" "i")))]
4278 int start = INTVAL (operands[3]) & 31;
4279 int size = INTVAL (operands[2]) & 31;
4281 if (start + size >= 32)
4282 operands[3] = const0_rtx;
4284 operands[3] = GEN_INT (start + size);
4285 return \"{rlinm|rlwinm} %0,%1,%3,%s2,31\";
4288 (define_insn "*extzvsi_internal1"
4289 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4290 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4291 (match_operand:SI 2 "const_int_operand" "i,i")
4292 (match_operand:SI 3 "const_int_operand" "i,i"))
4294 (clobber (match_scratch:SI 4 "=r,r"))]
4298 int start = INTVAL (operands[3]) & 31;
4299 int size = INTVAL (operands[2]) & 31;
4301 /* Force split for non-cc0 compare. */
4302 if (which_alternative == 1)
4305 /* If the bit-field being tested fits in the upper or lower half of a
4306 word, it is possible to use andiu. or andil. to test it. This is
4307 useful because the condition register set-use delay is smaller for
4308 andi[ul]. than for rlinm. This doesn't work when the starting bit
4309 position is 0 because the LT and GT bits may be set wrong. */
4311 if ((start > 0 && start + size <= 16) || start >= 16)
4313 operands[3] = GEN_INT (((1 << (16 - (start & 15)))
4314 - (1 << (16 - (start & 15) - size))));
4316 return \"{andiu.|andis.} %4,%1,%3\";
4318 return \"{andil.|andi.} %4,%1,%3\";
4321 if (start + size >= 32)
4322 operands[3] = const0_rtx;
4324 operands[3] = GEN_INT (start + size);
4325 return \"{rlinm.|rlwinm.} %4,%1,%3,%s2,31\";
4327 [(set_attr "type" "delayed_compare")
4328 (set_attr "length" "4,8")])
4331 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4332 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
4333 (match_operand:SI 2 "const_int_operand" "")
4334 (match_operand:SI 3 "const_int_operand" ""))
4336 (clobber (match_scratch:SI 4 ""))]
4339 (zero_extract:SI (match_dup 1) (match_dup 2)
4342 (compare:CC (match_dup 4)
4346 (define_insn "*extzvsi_internal2"
4347 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4348 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4349 (match_operand:SI 2 "const_int_operand" "i,i")
4350 (match_operand:SI 3 "const_int_operand" "i,i"))
4352 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4353 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
4357 int start = INTVAL (operands[3]) & 31;
4358 int size = INTVAL (operands[2]) & 31;
4360 /* Force split for non-cc0 compare. */
4361 if (which_alternative == 1)
4364 /* Since we are using the output value, we can't ignore any need for
4365 a shift. The bit-field must end at the LSB. */
4366 if (start >= 16 && start + size == 32)
4368 operands[3] = GEN_INT ((1 << size) - 1);
4369 return \"{andil.|andi.} %0,%1,%3\";
4372 if (start + size >= 32)
4373 operands[3] = const0_rtx;
4375 operands[3] = GEN_INT (start + size);
4376 return \"{rlinm.|rlwinm.} %0,%1,%3,%s2,31\";
4378 [(set_attr "type" "delayed_compare")
4379 (set_attr "length" "4,8")])
4382 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
4383 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
4384 (match_operand:SI 2 "const_int_operand" "")
4385 (match_operand:SI 3 "const_int_operand" ""))
4387 (set (match_operand:SI 0 "gpc_reg_operand" "")
4388 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
4391 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))
4393 (compare:CC (match_dup 0)
4397 (define_insn "extzvdi"
4398 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4399 (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4400 (match_operand:SI 2 "const_int_operand" "i")
4401 (match_operand:SI 3 "const_int_operand" "i")))]
4405 int start = INTVAL (operands[3]) & 63;
4406 int size = INTVAL (operands[2]) & 63;
4408 if (start + size >= 64)
4409 operands[3] = const0_rtx;
4411 operands[3] = GEN_INT (start + size);
4412 operands[2] = GEN_INT (64 - size);
4413 return \"rldicl %0,%1,%3,%2\";
4416 (define_insn "*extzvdi_internal1"
4417 [(set (match_operand:CC 0 "gpc_reg_operand" "=x")
4418 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4419 (match_operand:SI 2 "const_int_operand" "i")
4420 (match_operand:SI 3 "const_int_operand" "i"))
4422 (clobber (match_scratch:DI 4 "=r"))]
4423 "TARGET_64BIT && rs6000_gen_cell_microcode"
4426 int start = INTVAL (operands[3]) & 63;
4427 int size = INTVAL (operands[2]) & 63;
4429 if (start + size >= 64)
4430 operands[3] = const0_rtx;
4432 operands[3] = GEN_INT (start + size);
4433 operands[2] = GEN_INT (64 - size);
4434 return \"rldicl. %4,%1,%3,%2\";
4436 [(set_attr "type" "compare")])
4438 (define_insn "*extzvdi_internal2"
4439 [(set (match_operand:CC 4 "gpc_reg_operand" "=x")
4440 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4441 (match_operand:SI 2 "const_int_operand" "i")
4442 (match_operand:SI 3 "const_int_operand" "i"))
4444 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
4445 (zero_extract:DI (match_dup 1) (match_dup 2) (match_dup 3)))]
4446 "TARGET_64BIT && rs6000_gen_cell_microcode"
4449 int start = INTVAL (operands[3]) & 63;
4450 int size = INTVAL (operands[2]) & 63;
4452 if (start + size >= 64)
4453 operands[3] = const0_rtx;
4455 operands[3] = GEN_INT (start + size);
4456 operands[2] = GEN_INT (64 - size);
4457 return \"rldicl. %0,%1,%3,%2\";
4459 [(set_attr "type" "compare")])
4461 (define_insn "rotlsi3"
4462 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4463 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4464 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
4467 {rlnm|rlwnm} %0,%1,%2,0xffffffff
4468 {rlinm|rlwinm} %0,%1,%h2,0xffffffff"
4469 [(set_attr "type" "var_shift_rotate,integer")])
4471 (define_insn "*rotlsi3_64"
4472 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
4474 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4475 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))))]
4478 {rlnm|rlwnm} %0,%1,%2,0xffffffff
4479 {rlinm|rlwinm} %0,%1,%h2,0xffffffff"
4480 [(set_attr "type" "var_shift_rotate,integer")])
4482 (define_insn "*rotlsi3_internal2"
4483 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4484 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4485 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4487 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4490 {rlnm.|rlwnm.} %3,%1,%2,0xffffffff
4491 {rlinm.|rlwinm.} %3,%1,%h2,0xffffffff
4494 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4495 (set_attr "length" "4,4,8,8")])
4498 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4499 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4500 (match_operand:SI 2 "reg_or_cint_operand" ""))
4502 (clobber (match_scratch:SI 3 ""))]
4505 (rotate:SI (match_dup 1) (match_dup 2)))
4507 (compare:CC (match_dup 3)
4511 (define_insn "*rotlsi3_internal3"
4512 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4513 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4514 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4516 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4517 (rotate:SI (match_dup 1) (match_dup 2)))]
4520 {rlnm.|rlwnm.} %0,%1,%2,0xffffffff
4521 {rlinm.|rlwinm.} %0,%1,%h2,0xffffffff
4524 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4525 (set_attr "length" "4,4,8,8")])
4528 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4529 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4530 (match_operand:SI 2 "reg_or_cint_operand" ""))
4532 (set (match_operand:SI 0 "gpc_reg_operand" "")
4533 (rotate:SI (match_dup 1) (match_dup 2)))]
4536 (rotate:SI (match_dup 1) (match_dup 2)))
4538 (compare:CC (match_dup 0)
4542 (define_insn "*rotlsi3_internal4"
4543 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4544 (and:SI (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4545 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
4546 (match_operand:SI 3 "mask_operand" "n,n")))]
4549 {rlnm|rlwnm} %0,%1,%2,%m3,%M3
4550 {rlinm|rlwinm} %0,%1,%h2,%m3,%M3"
4551 [(set_attr "type" "var_shift_rotate,integer")])
4553 (define_insn "*rotlsi3_internal5"
4554 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4556 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4557 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4558 (match_operand:SI 3 "mask_operand" "n,n,n,n"))
4560 (clobber (match_scratch:SI 4 "=r,r,r,r"))]
4563 {rlnm.|rlwnm.} %4,%1,%2,%m3,%M3
4564 {rlinm.|rlwinm.} %4,%1,%h2,%m3,%M3
4567 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4568 (set_attr "length" "4,4,8,8")])
4571 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4573 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4574 (match_operand:SI 2 "reg_or_cint_operand" ""))
4575 (match_operand:SI 3 "mask_operand" ""))
4577 (clobber (match_scratch:SI 4 ""))]
4580 (and:SI (rotate:SI (match_dup 1)
4584 (compare:CC (match_dup 4)
4588 (define_insn "*rotlsi3_internal6"
4589 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
4591 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4592 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4593 (match_operand:SI 3 "mask_operand" "n,n,n,n"))
4595 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4596 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4599 {rlnm.|rlwnm.} %0,%1,%2,%m3,%M3
4600 {rlinm.|rlwinm.} %0,%1,%h2,%m3,%M3
4603 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4604 (set_attr "length" "4,4,8,8")])
4607 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
4609 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4610 (match_operand:SI 2 "reg_or_cint_operand" ""))
4611 (match_operand:SI 3 "mask_operand" ""))
4613 (set (match_operand:SI 0 "gpc_reg_operand" "")
4614 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4617 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4619 (compare:CC (match_dup 0)
4623 (define_insn "*rotlsi3_internal7"
4624 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4627 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4628 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
4630 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xff"
4631 [(set (attr "cell_micro")
4632 (if_then_else (match_operand:SI 2 "const_int_operand" "")
4633 (const_string "not")
4634 (const_string "always")))])
4636 (define_insn "*rotlsi3_internal8"
4637 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4638 (compare:CC (zero_extend:SI
4640 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4641 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4643 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4646 {rlnm.|rlwnm.} %3,%1,%2,0xff
4647 {rlinm.|rlwinm.} %3,%1,%h2,0xff
4650 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4651 (set_attr "length" "4,4,8,8")])
4654 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4655 (compare:CC (zero_extend:SI
4657 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4658 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4660 (clobber (match_scratch:SI 3 ""))]
4663 (zero_extend:SI (subreg:QI
4664 (rotate:SI (match_dup 1)
4667 (compare:CC (match_dup 3)
4671 (define_insn "*rotlsi3_internal9"
4672 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4673 (compare:CC (zero_extend:SI
4675 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4676 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4678 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4679 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4682 {rlnm.|rlwnm.} %0,%1,%2,0xff
4683 {rlinm.|rlwinm.} %0,%1,%h2,0xff
4686 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4687 (set_attr "length" "4,4,8,8")])
4690 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4691 (compare:CC (zero_extend:SI
4693 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4694 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4696 (set (match_operand:SI 0 "gpc_reg_operand" "")
4697 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4700 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
4702 (compare:CC (match_dup 0)
4706 (define_insn "*rotlsi3_internal10"
4707 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4710 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4711 (match_operand:SI 2 "reg_or_cint_operand" "r,i")) 0)))]
4714 {rlnm|rlwnm} %0,%1,%2,0xffff
4715 {rlinm|rlwinm} %0,%1,%h2,0xffff"
4716 [(set_attr "type" "var_shift_rotate,integer")])
4719 (define_insn "*rotlsi3_internal11"
4720 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4721 (compare:CC (zero_extend:SI
4723 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4724 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4726 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4729 {rlnm.|rlwnm.} %3,%1,%2,0xffff
4730 {rlinm.|rlwinm.} %3,%1,%h2,0xffff
4733 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4734 (set_attr "length" "4,4,8,8")])
4737 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4738 (compare:CC (zero_extend:SI
4740 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4741 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4743 (clobber (match_scratch:SI 3 ""))]
4746 (zero_extend:SI (subreg:HI
4747 (rotate:SI (match_dup 1)
4750 (compare:CC (match_dup 3)
4754 (define_insn "*rotlsi3_internal12"
4755 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4756 (compare:CC (zero_extend:SI
4758 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4759 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4761 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4762 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4765 {rlnm.|rlwnm.} %0,%1,%2,0xffff
4766 {rlinm.|rlwinm.} %0,%1,%h2,0xffff
4769 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4770 (set_attr "length" "4,4,8,8")])
4773 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4774 (compare:CC (zero_extend:SI
4776 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4777 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4779 (set (match_operand:SI 0 "gpc_reg_operand" "")
4780 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4783 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
4785 (compare:CC (match_dup 0)
4789 ;; Note that we use "sle." instead of "sl." so that we can set
4790 ;; SHIFT_COUNT_TRUNCATED.
4792 (define_expand "ashlsi3"
4793 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
4794 (use (match_operand:SI 1 "gpc_reg_operand" ""))
4795 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
4800 emit_insn (gen_ashlsi3_power (operands[0], operands[1], operands[2]));
4802 emit_insn (gen_ashlsi3_no_power (operands[0], operands[1], operands[2]));
4806 (define_insn "ashlsi3_power"
4807 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4808 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4809 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
4810 (clobber (match_scratch:SI 3 "=q,X"))]
4814 {sli|slwi} %0,%1,%h2")
4816 (define_insn "ashlsi3_no_power"
4817 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4818 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4819 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
4823 {sli|slwi} %0,%1,%h2"
4824 [(set_attr "type" "var_shift_rotate,shift")])
4826 (define_insn "*ashlsi3_64"
4827 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
4829 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4830 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))))]
4834 {sli|slwi} %0,%1,%h2"
4835 [(set_attr "type" "var_shift_rotate,shift")])
4838 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4839 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4840 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4842 (clobber (match_scratch:SI 3 "=r,r,r,r"))
4843 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4847 {sli.|slwi.} %3,%1,%h2
4850 [(set_attr "type" "delayed_compare")
4851 (set_attr "length" "4,4,8,8")])
4854 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4855 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4856 (match_operand:SI 2 "reg_or_cint_operand" ""))
4858 (clobber (match_scratch:SI 3 ""))
4859 (clobber (match_scratch:SI 4 ""))]
4860 "TARGET_POWER && reload_completed"
4861 [(parallel [(set (match_dup 3)
4862 (ashift:SI (match_dup 1) (match_dup 2)))
4863 (clobber (match_dup 4))])
4865 (compare:CC (match_dup 3)
4870 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4871 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4872 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4874 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4875 "! TARGET_POWER && TARGET_32BIT"
4878 {sli.|slwi.} %3,%1,%h2
4881 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4882 (set_attr "length" "4,4,8,8")])
4885 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4886 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4887 (match_operand:SI 2 "reg_or_cint_operand" ""))
4889 (clobber (match_scratch:SI 3 ""))]
4890 "! TARGET_POWER && TARGET_32BIT && reload_completed"
4892 (ashift:SI (match_dup 1) (match_dup 2)))
4894 (compare:CC (match_dup 3)
4899 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4900 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4901 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4903 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4904 (ashift:SI (match_dup 1) (match_dup 2)))
4905 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4909 {sli.|slwi.} %0,%1,%h2
4912 [(set_attr "type" "delayed_compare")
4913 (set_attr "length" "4,4,8,8")])
4916 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4917 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4918 (match_operand:SI 2 "reg_or_cint_operand" ""))
4920 (set (match_operand:SI 0 "gpc_reg_operand" "")
4921 (ashift:SI (match_dup 1) (match_dup 2)))
4922 (clobber (match_scratch:SI 4 ""))]
4923 "TARGET_POWER && reload_completed"
4924 [(parallel [(set (match_dup 0)
4925 (ashift:SI (match_dup 1) (match_dup 2)))
4926 (clobber (match_dup 4))])
4928 (compare:CC (match_dup 0)
4933 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4934 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4935 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4937 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4938 (ashift:SI (match_dup 1) (match_dup 2)))]
4939 "! TARGET_POWER && TARGET_32BIT"
4942 {sli.|slwi.} %0,%1,%h2
4945 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4946 (set_attr "length" "4,4,8,8")])
4949 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4950 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4951 (match_operand:SI 2 "reg_or_cint_operand" ""))
4953 (set (match_operand:SI 0 "gpc_reg_operand" "")
4954 (ashift:SI (match_dup 1) (match_dup 2)))]
4955 "! TARGET_POWER && TARGET_32BIT && reload_completed"
4957 (ashift:SI (match_dup 1) (match_dup 2)))
4959 (compare:CC (match_dup 0)
4963 (define_insn "rlwinm"
4964 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4965 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4966 (match_operand:SI 2 "const_int_operand" "i"))
4967 (match_operand:SI 3 "mask_operand" "n")))]
4968 "includes_lshift_p (operands[2], operands[3])"
4969 "{rlinm|rlwinm} %0,%1,%h2,%m3,%M3")
4972 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4974 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4975 (match_operand:SI 2 "const_int_operand" "i,i"))
4976 (match_operand:SI 3 "mask_operand" "n,n"))
4978 (clobber (match_scratch:SI 4 "=r,r"))]
4979 "includes_lshift_p (operands[2], operands[3])"
4981 {rlinm.|rlwinm.} %4,%1,%h2,%m3,%M3
4983 [(set_attr "type" "delayed_compare")
4984 (set_attr "length" "4,8")])
4987 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4989 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4990 (match_operand:SI 2 "const_int_operand" ""))
4991 (match_operand:SI 3 "mask_operand" ""))
4993 (clobber (match_scratch:SI 4 ""))]
4994 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
4996 (and:SI (ashift:SI (match_dup 1) (match_dup 2))
4999 (compare:CC (match_dup 4)
5004 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
5006 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5007 (match_operand:SI 2 "const_int_operand" "i,i"))
5008 (match_operand:SI 3 "mask_operand" "n,n"))
5010 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
5011 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
5012 "includes_lshift_p (operands[2], operands[3])"
5014 {rlinm.|rlwinm.} %0,%1,%h2,%m3,%M3
5016 [(set_attr "type" "delayed_compare")
5017 (set_attr "length" "4,8")])
5020 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
5022 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
5023 (match_operand:SI 2 "const_int_operand" ""))
5024 (match_operand:SI 3 "mask_operand" ""))
5026 (set (match_operand:SI 0 "gpc_reg_operand" "")
5027 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
5028 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
5030 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
5032 (compare:CC (match_dup 0)
5036 ;; The AIX assembler mis-handles "sri x,x,0", so write that case as
5038 (define_expand "lshrsi3"
5039 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
5040 (use (match_operand:SI 1 "gpc_reg_operand" ""))
5041 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
5046 emit_insn (gen_lshrsi3_power (operands[0], operands[1], operands[2]));
5048 emit_insn (gen_lshrsi3_no_power (operands[0], operands[1], operands[2]));
5052 (define_insn "lshrsi3_power"
5053 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
5054 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
5055 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i")))
5056 (clobber (match_scratch:SI 3 "=q,X,X"))]
5061 {s%A2i|s%A2wi} %0,%1,%h2")
5063 (define_insn "lshrsi3_no_power"
5064 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
5065 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
5066 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i")))]
5071 {sri|srwi} %0,%1,%h2"
5072 [(set_attr "type" "integer,var_shift_rotate,shift")])
5074 (define_insn "*lshrsi3_64"
5075 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
5077 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5078 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))))]
5082 {sri|srwi} %0,%1,%h2"
5083 [(set_attr "type" "var_shift_rotate,shift")])
5086 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,?y,?y,?y")
5087 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
5088 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
5090 (clobber (match_scratch:SI 3 "=r,X,r,r,X,r"))
5091 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
5096 {s%A2i.|s%A2wi.} %3,%1,%h2
5100 [(set_attr "type" "delayed_compare")
5101 (set_attr "length" "4,4,4,8,8,8")])
5104 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
5105 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5106 (match_operand:SI 2 "reg_or_cint_operand" ""))
5108 (clobber (match_scratch:SI 3 ""))
5109 (clobber (match_scratch:SI 4 ""))]
5110 "TARGET_POWER && reload_completed"
5111 [(parallel [(set (match_dup 3)
5112 (lshiftrt:SI (match_dup 1) (match_dup 2)))
5113 (clobber (match_dup 4))])
5115 (compare:CC (match_dup 3)
5120 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,?y,?y,?y")
5121 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
5122 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i,O,r,i"))
5124 (clobber (match_scratch:SI 3 "=X,r,r,X,r,r"))]
5125 "! TARGET_POWER && TARGET_32BIT"
5129 {sri.|srwi.} %3,%1,%h2
5133 [(set_attr "type" "delayed_compare,var_delayed_compare,delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
5134 (set_attr "length" "4,4,4,8,8,8")])
5137 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
5138 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5139 (match_operand:SI 2 "reg_or_cint_operand" ""))
5141 (clobber (match_scratch:SI 3 ""))]
5142 "! TARGET_POWER && TARGET_32BIT && reload_completed"
5144 (lshiftrt:SI (match_dup 1) (match_dup 2)))
5146 (compare:CC (match_dup 3)
5151 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,?y,?y,?y")
5152 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
5153 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
5155 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
5156 (lshiftrt:SI (match_dup 1) (match_dup 2)))
5157 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
5162 {s%A2i.|s%A2wi.} %0,%1,%h2
5166 [(set_attr "type" "delayed_compare")
5167 (set_attr "length" "4,4,4,8,8,8")])
5170 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
5171 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5172 (match_operand:SI 2 "reg_or_cint_operand" ""))
5174 (set (match_operand:SI 0 "gpc_reg_operand" "")
5175 (lshiftrt:SI (match_dup 1) (match_dup 2)))
5176 (clobber (match_scratch:SI 4 ""))]
5177 "TARGET_POWER && reload_completed"
5178 [(parallel [(set (match_dup 0)
5179 (lshiftrt:SI (match_dup 1) (match_dup 2)))
5180 (clobber (match_dup 4))])
5182 (compare:CC (match_dup 0)
5187 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,?y,?y,?y")
5188 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
5189 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i,O,r,i"))
5191 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
5192 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
5193 "! TARGET_POWER && TARGET_32BIT"
5197 {sri.|srwi.} %0,%1,%h2
5201 [(set_attr "type" "delayed_compare,var_delayed_compare,delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
5202 (set_attr "length" "4,4,4,8,8,8")])
5205 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
5206 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5207 (match_operand:SI 2 "reg_or_cint_operand" ""))
5209 (set (match_operand:SI 0 "gpc_reg_operand" "")
5210 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
5211 "! TARGET_POWER && TARGET_32BIT && reload_completed"
5213 (lshiftrt:SI (match_dup 1) (match_dup 2)))
5215 (compare:CC (match_dup 0)
5220 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5221 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
5222 (match_operand:SI 2 "const_int_operand" "i"))
5223 (match_operand:SI 3 "mask_operand" "n")))]
5224 "includes_rshift_p (operands[2], operands[3])"
5225 "{rlinm|rlwinm} %0,%1,%s2,%m3,%M3")
5228 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
5230 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5231 (match_operand:SI 2 "const_int_operand" "i,i"))
5232 (match_operand:SI 3 "mask_operand" "n,n"))
5234 (clobber (match_scratch:SI 4 "=r,r"))]
5235 "includes_rshift_p (operands[2], operands[3])"
5237 {rlinm.|rlwinm.} %4,%1,%s2,%m3,%M3
5239 [(set_attr "type" "delayed_compare")
5240 (set_attr "length" "4,8")])
5243 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
5245 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5246 (match_operand:SI 2 "const_int_operand" ""))
5247 (match_operand:SI 3 "mask_operand" ""))
5249 (clobber (match_scratch:SI 4 ""))]
5250 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
5252 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2))
5255 (compare:CC (match_dup 4)
5260 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
5262 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5263 (match_operand:SI 2 "const_int_operand" "i,i"))
5264 (match_operand:SI 3 "mask_operand" "n,n"))
5266 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
5267 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
5268 "includes_rshift_p (operands[2], operands[3])"
5270 {rlinm.|rlwinm.} %0,%1,%s2,%m3,%M3
5272 [(set_attr "type" "delayed_compare")
5273 (set_attr "length" "4,8")])
5276 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
5278 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5279 (match_operand:SI 2 "const_int_operand" ""))
5280 (match_operand:SI 3 "mask_operand" ""))
5282 (set (match_operand:SI 0 "gpc_reg_operand" "")
5283 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
5284 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
5286 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
5288 (compare:CC (match_dup 0)
5293 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5296 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
5297 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
5298 "includes_rshift_p (operands[2], GEN_INT (255))"
5299 "{rlinm|rlwinm} %0,%1,%s2,0xff")
5302 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
5306 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5307 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
5309 (clobber (match_scratch:SI 3 "=r,r"))]
5310 "includes_rshift_p (operands[2], GEN_INT (255))"
5312 {rlinm.|rlwinm.} %3,%1,%s2,0xff
5314 [(set_attr "type" "delayed_compare")
5315 (set_attr "length" "4,8")])
5318 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
5322 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5323 (match_operand:SI 2 "const_int_operand" "")) 0))
5325 (clobber (match_scratch:SI 3 ""))]
5326 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
5328 (zero_extend:SI (subreg:QI
5329 (lshiftrt:SI (match_dup 1)
5332 (compare:CC (match_dup 3)
5337 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
5341 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5342 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
5344 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
5345 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
5346 "includes_rshift_p (operands[2], GEN_INT (255))"
5348 {rlinm.|rlwinm.} %0,%1,%s2,0xff
5350 [(set_attr "type" "delayed_compare")
5351 (set_attr "length" "4,8")])
5354 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
5358 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5359 (match_operand:SI 2 "const_int_operand" "")) 0))
5361 (set (match_operand:SI 0 "gpc_reg_operand" "")
5362 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
5363 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
5365 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
5367 (compare:CC (match_dup 0)
5372 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5375 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
5376 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
5377 "includes_rshift_p (operands[2], GEN_INT (65535))"
5378 "{rlinm|rlwinm} %0,%1,%s2,0xffff")
5381 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
5385 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5386 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
5388 (clobber (match_scratch:SI 3 "=r,r"))]
5389 "includes_rshift_p (operands[2], GEN_INT (65535))"
5391 {rlinm.|rlwinm.} %3,%1,%s2,0xffff
5393 [(set_attr "type" "delayed_compare")
5394 (set_attr "length" "4,8")])
5397 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
5401 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5402 (match_operand:SI 2 "const_int_operand" "")) 0))
5404 (clobber (match_scratch:SI 3 ""))]
5405 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
5407 (zero_extend:SI (subreg:HI
5408 (lshiftrt:SI (match_dup 1)
5411 (compare:CC (match_dup 3)
5416 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
5420 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5421 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
5423 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
5424 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
5425 "includes_rshift_p (operands[2], GEN_INT (65535))"
5427 {rlinm.|rlwinm.} %0,%1,%s2,0xffff
5429 [(set_attr "type" "delayed_compare")
5430 (set_attr "length" "4,8")])
5433 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
5437 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5438 (match_operand:SI 2 "const_int_operand" "")) 0))
5440 (set (match_operand:SI 0 "gpc_reg_operand" "")
5441 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
5442 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
5444 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
5446 (compare:CC (match_dup 0)
5451 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
5453 (match_operand:SI 1 "gpc_reg_operand" "r"))
5454 (ashiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
5460 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
5462 (match_operand:SI 1 "gpc_reg_operand" "r"))
5463 (lshiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
5469 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
5471 (match_operand:SI 1 "gpc_reg_operand" "r"))
5472 (zero_extract:SI (match_operand:SI 2 "gpc_reg_operand" "r")
5478 (define_expand "ashrsi3"
5479 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5480 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5481 (match_operand:SI 2 "reg_or_cint_operand" "")))]
5486 emit_insn (gen_ashrsi3_power (operands[0], operands[1], operands[2]));
5488 emit_insn (gen_ashrsi3_no_power (operands[0], operands[1], operands[2]));
5492 (define_insn "ashrsi3_power"
5493 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
5494 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5495 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
5496 (clobber (match_scratch:SI 3 "=q,X"))]
5500 {srai|srawi} %0,%1,%h2"
5501 [(set_attr "type" "shift")])
5503 (define_insn "ashrsi3_no_power"
5504 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
5505 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5506 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
5510 {srai|srawi} %0,%1,%h2"
5511 [(set_attr "type" "var_shift_rotate,shift")])
5513 (define_insn "*ashrsi3_64"
5514 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
5516 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5517 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))))]
5521 {srai|srawi} %0,%1,%h2"
5522 [(set_attr "type" "var_shift_rotate,shift")])
5525 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
5526 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
5527 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
5529 (clobber (match_scratch:SI 3 "=r,r,r,r"))
5530 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
5534 {srai.|srawi.} %3,%1,%h2
5537 [(set_attr "type" "delayed_compare")
5538 (set_attr "length" "4,4,8,8")])
5541 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
5542 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5543 (match_operand:SI 2 "reg_or_cint_operand" ""))
5545 (clobber (match_scratch:SI 3 ""))
5546 (clobber (match_scratch:SI 4 ""))]
5547 "TARGET_POWER && reload_completed"
5548 [(parallel [(set (match_dup 3)
5549 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5550 (clobber (match_dup 4))])
5552 (compare:CC (match_dup 3)
5557 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
5558 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
5559 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
5561 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
5564 {sra.|sraw.} %3,%1,%2
5565 {srai.|srawi.} %3,%1,%h2
5568 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
5569 (set_attr "length" "4,4,8,8")])
5572 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
5573 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5574 (match_operand:SI 2 "reg_or_cint_operand" ""))
5576 (clobber (match_scratch:SI 3 ""))]
5577 "! TARGET_POWER && reload_completed"
5579 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5581 (compare:CC (match_dup 3)
5586 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
5587 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
5588 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
5590 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
5591 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5592 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
5596 {srai.|srawi.} %0,%1,%h2
5599 [(set_attr "type" "delayed_compare")
5600 (set_attr "length" "4,4,8,8")])
5603 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
5604 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5605 (match_operand:SI 2 "reg_or_cint_operand" ""))
5607 (set (match_operand:SI 0 "gpc_reg_operand" "")
5608 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5609 (clobber (match_scratch:SI 4 ""))]
5610 "TARGET_POWER && reload_completed"
5611 [(parallel [(set (match_dup 0)
5612 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5613 (clobber (match_dup 4))])
5615 (compare:CC (match_dup 0)
5620 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
5621 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
5622 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
5624 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
5625 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
5628 {sra.|sraw.} %0,%1,%2
5629 {srai.|srawi.} %0,%1,%h2
5632 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
5633 (set_attr "length" "4,4,8,8")])
5635 ;; Builtins to replace a division to generate FRE reciprocal estimate
5636 ;; instructions and the necessary fixup instructions
5637 (define_expand "recip<mode>3"
5638 [(match_operand:RECIPF 0 "gpc_reg_operand" "")
5639 (match_operand:RECIPF 1 "gpc_reg_operand" "")
5640 (match_operand:RECIPF 2 "gpc_reg_operand" "")]
5641 "RS6000_RECIP_HAVE_RE_P (<MODE>mode)"
5643 rs6000_emit_swdiv (operands[0], operands[1], operands[2], false);
5647 ;; Split to create division from FRE/FRES/etc. and fixup instead of the normal
5648 ;; hardware division. This is only done before register allocation and with
5649 ;; -ffast-math. This must appear before the divsf3/divdf3 insns.
5651 [(set (match_operand:RECIPF 0 "gpc_reg_operand" "")
5652 (div:RECIPF (match_operand 1 "gpc_reg_operand" "")
5653 (match_operand 2 "gpc_reg_operand" "")))]
5654 "RS6000_RECIP_AUTO_RE_P (<MODE>mode)
5655 && can_create_pseudo_p () && optimize_insn_for_speed_p ()
5656 && flag_finite_math_only && !flag_trapping_math && flag_reciprocal_math"
5659 rs6000_emit_swdiv (operands[0], operands[1], operands[2], true);
5663 ;; Builtins to replace 1/sqrt(x) with instructions using RSQRTE and the
5664 ;; appropriate fixup.
5665 (define_expand "rsqrt<mode>2"
5666 [(match_operand:RECIPF 0 "gpc_reg_operand" "")
5667 (match_operand:RECIPF 1 "gpc_reg_operand" "")]
5668 "RS6000_RECIP_HAVE_RSQRTE_P (<MODE>mode)"
5670 rs6000_emit_swrsqrt (operands[0], operands[1]);
5675 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
5676 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5677 (match_operand:SI 2 "reg_or_cint_operand" ""))
5679 (set (match_operand:SI 0 "gpc_reg_operand" "")
5680 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
5681 "! TARGET_POWER && reload_completed"
5683 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5685 (compare:CC (match_dup 0)
5689 ;; Floating-point insns, excluding normal data motion.
5691 ;; PowerPC has a full set of single-precision floating point instructions.
5693 ;; For the POWER architecture, we pretend that we have both SFmode and
5694 ;; DFmode insns, while, in fact, all fp insns are actually done in double.
5695 ;; The only conversions we will do will be when storing to memory. In that
5696 ;; case, we will use the "frsp" instruction before storing.
5698 ;; Note that when we store into a single-precision memory location, we need to
5699 ;; use the frsp insn first. If the register being stored isn't dead, we
5700 ;; need a scratch register for the frsp. But this is difficult when the store
5701 ;; is done by reload. It is not incorrect to do the frsp on the register in
5702 ;; this case, we just lose precision that we would have otherwise gotten but
5703 ;; is not guaranteed. Perhaps this should be tightened up at some point.
5705 (define_expand "extendsfdf2"
5706 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5707 (float_extend:DF (match_operand:SF 1 "reg_or_none500mem_operand" "")))]
5708 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5711 (define_insn_and_split "*extendsfdf2_fpr"
5712 [(set (match_operand:DF 0 "gpc_reg_operand" "=d,?d,d")
5713 (float_extend:DF (match_operand:SF 1 "reg_or_mem_operand" "0,f,m")))]
5714 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5719 "&& reload_completed && REG_P (operands[1]) && REGNO (operands[0]) == REGNO (operands[1])"
5722 emit_note (NOTE_INSN_DELETED);
5725 [(set_attr "type" "fp,fp,fpload")])
5727 (define_expand "truncdfsf2"
5728 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5729 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "")))]
5730 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5733 (define_insn "*truncdfsf2_fpr"
5734 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5735 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "d")))]
5736 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5738 [(set_attr "type" "fp")])
5740 (define_insn "aux_truncdfsf2"
5741 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5742 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRSP))]
5743 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5745 [(set_attr "type" "fp")])
5747 (define_expand "negsf2"
5748 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5749 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
5750 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
5753 (define_insn "*negsf2"
5754 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5755 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5756 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5758 [(set_attr "type" "fp")])
5760 (define_expand "abssf2"
5761 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5762 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
5763 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
5766 (define_insn "*abssf2"
5767 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5768 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5769 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5771 [(set_attr "type" "fp")])
5774 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5775 (neg:SF (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f"))))]
5776 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5778 [(set_attr "type" "fp")])
5780 (define_expand "addsf3"
5781 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5782 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "")
5783 (match_operand:SF 2 "gpc_reg_operand" "")))]
5784 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
5788 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5789 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5790 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5791 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5793 [(set_attr "type" "fp")
5794 (set_attr "fp_type" "fp_addsub_s")])
5797 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5798 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5799 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5800 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5801 "{fa|fadd} %0,%1,%2"
5802 [(set_attr "type" "fp")])
5804 (define_expand "subsf3"
5805 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5806 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "")
5807 (match_operand:SF 2 "gpc_reg_operand" "")))]
5808 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
5812 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5813 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5814 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5815 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5817 [(set_attr "type" "fp")
5818 (set_attr "fp_type" "fp_addsub_s")])
5821 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5822 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5823 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5824 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5825 "{fs|fsub} %0,%1,%2"
5826 [(set_attr "type" "fp")])
5828 (define_expand "mulsf3"
5829 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5830 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "")
5831 (match_operand:SF 2 "gpc_reg_operand" "")))]
5832 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
5836 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5837 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5838 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5839 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5841 [(set_attr "type" "fp")
5842 (set_attr "fp_type" "fp_mul_s")])
5845 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5846 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5847 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5848 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5849 "{fm|fmul} %0,%1,%2"
5850 [(set_attr "type" "dmul")])
5852 (define_expand "divsf3"
5853 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5854 (div:SF (match_operand:SF 1 "gpc_reg_operand" "")
5855 (match_operand:SF 2 "gpc_reg_operand" "")))]
5856 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
5860 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5861 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5862 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5863 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS
5864 && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
5866 [(set_attr "type" "sdiv")])
5869 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5870 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5871 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5872 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS
5873 && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
5874 "{fd|fdiv} %0,%1,%2"
5875 [(set_attr "type" "ddiv")])
5878 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5879 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))]
5882 [(set_attr "type" "fp")])
5884 ; builtin fmaf support
5885 (define_insn "*fmasf4_fpr"
5886 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5887 (fma:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5888 (match_operand:SF 2 "gpc_reg_operand" "f")
5889 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5890 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5892 return (TARGET_POWERPC
5893 ? "fmadds %0,%1,%2,%3"
5894 : "{fma|fmadd} %0,%1,%2,%3");
5896 [(set_attr "type" "fp")
5897 (set_attr "fp_type" "fp_maddsub_s")])
5899 (define_insn "*fmssf4_fpr"
5900 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5901 (fma:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5902 (match_operand:SF 2 "gpc_reg_operand" "f")
5903 (neg:SF (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5904 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5906 return (TARGET_POWERPC
5907 ? "fmsubs %0,%1,%2,%3"
5908 : "{fms|fmsub} %0,%1,%2,%3");
5910 [(set_attr "type" "fp")
5911 (set_attr "fp_type" "fp_maddsub_s")])
5913 (define_insn "*nfmasf4_fpr"
5914 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5915 (neg:SF (fma:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5916 (match_operand:SF 2 "gpc_reg_operand" "f")
5917 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5918 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5920 return (TARGET_POWERPC
5921 ? "fnmadds %0,%1,%2,%3"
5922 : "{fnma|fnmadd} %0,%1,%2,%3");
5924 [(set_attr "type" "fp")
5925 (set_attr "fp_type" "fp_maddsub_s")])
5927 (define_insn "*nfmssf4_fpr"
5928 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5929 (neg:SF (fma:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5930 (match_operand:SF 2 "gpc_reg_operand" "f")
5931 (neg:SF (match_operand:SF 3 "gpc_reg_operand" "f")))))]
5932 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5934 return (TARGET_POWERPC
5935 ? "fnmsubs %0,%1,%2,%3"
5936 : "{fnms|fnmsub} %0,%1,%2,%3");
5938 [(set_attr "type" "fp")
5939 (set_attr "fp_type" "fp_maddsub_s")])
5941 (define_expand "sqrtsf2"
5942 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5943 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
5944 "(TARGET_PPC_GPOPT || TARGET_POWER2 || TARGET_XILINX_FPU)
5945 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
5946 && !TARGET_SIMPLE_FPU"
5950 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5951 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5952 "(TARGET_PPC_GPOPT || TARGET_XILINX_FPU) && TARGET_HARD_FLOAT
5953 && TARGET_FPRS && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
5955 [(set_attr "type" "ssqrt")])
5958 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5959 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5960 "TARGET_POWER2 && TARGET_HARD_FLOAT && TARGET_FPRS
5961 && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
5963 [(set_attr "type" "dsqrt")])
5965 (define_insn "*rsqrtsf_internal1"
5966 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5967 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")]
5971 [(set_attr "type" "fp")])
5973 (define_expand "copysign<mode>3"
5975 (abs:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")))
5977 (neg:SFDF (abs:SFDF (match_dup 1))))
5978 (set (match_operand:SFDF 0 "gpc_reg_operand" "")
5979 (if_then_else:SFDF (ge (match_operand:SFDF 2 "gpc_reg_operand" "")
5983 "TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>
5984 && ((TARGET_PPC_GFXOPT
5985 && !HONOR_NANS (<MODE>mode)
5986 && !HONOR_SIGNED_ZEROS (<MODE>mode))
5988 || VECTOR_UNIT_VSX_P (<MODE>mode))"
5990 if (TARGET_CMPB || VECTOR_UNIT_VSX_P (<MODE>mode))
5992 emit_insn (gen_copysign<mode>3_fcpsgn (operands[0], operands[1],
5997 operands[3] = gen_reg_rtx (<MODE>mode);
5998 operands[4] = gen_reg_rtx (<MODE>mode);
5999 operands[5] = CONST0_RTX (<MODE>mode);
6002 ;; Use an unspec rather providing an if-then-else in RTL, to prevent the
6003 ;; compiler from optimizing -0.0
6004 (define_insn "copysign<mode>3_fcpsgn"
6005 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
6006 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")
6007 (match_operand:SFDF 2 "gpc_reg_operand" "<rreg2>")]
6009 "TARGET_CMPB && !VECTOR_UNIT_VSX_P (<MODE>mode)"
6011 [(set_attr "type" "fp")])
6013 ;; For MIN, MAX, and conditional move, we use DEFINE_EXPAND's that involve a
6014 ;; fsel instruction and some auxiliary computations. Then we just have a
6015 ;; single DEFINE_INSN for fsel and the define_splits to make them if made by
6017 (define_expand "smaxsf3"
6018 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6019 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
6020 (match_operand:SF 2 "gpc_reg_operand" ""))
6023 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
6024 && TARGET_SINGLE_FLOAT && !flag_trapping_math"
6025 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
6027 (define_expand "sminsf3"
6028 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6029 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
6030 (match_operand:SF 2 "gpc_reg_operand" ""))
6033 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
6034 && TARGET_SINGLE_FLOAT && !flag_trapping_math"
6035 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
6038 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6039 (match_operator:SF 3 "min_max_operator"
6040 [(match_operand:SF 1 "gpc_reg_operand" "")
6041 (match_operand:SF 2 "gpc_reg_operand" "")]))]
6042 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
6043 && TARGET_SINGLE_FLOAT && !flag_trapping_math"
6046 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
6047 operands[1], operands[2]);
6051 (define_expand "mov<mode>cc"
6052 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
6053 (if_then_else:GPR (match_operand 1 "comparison_operator" "")
6054 (match_operand:GPR 2 "gpc_reg_operand" "")
6055 (match_operand:GPR 3 "gpc_reg_operand" "")))]
6059 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
6065 ;; We use the BASE_REGS for the isel input operands because, if rA is
6066 ;; 0, the value of 0 is placed in rD upon truth. Similarly for rB
6067 ;; because we may switch the operands and rB may end up being rA.
6069 ;; We need 2 patterns: an unsigned and a signed pattern. We could
6070 ;; leave out the mode in operand 4 and use one pattern, but reload can
6071 ;; change the mode underneath our feet and then gets confused trying
6072 ;; to reload the value.
6073 (define_insn "isel_signed_<mode>"
6074 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
6076 (match_operator 1 "scc_comparison_operator"
6077 [(match_operand:CC 4 "cc_reg_operand" "y,y")
6079 (match_operand:GPR 2 "reg_or_cint_operand" "O,b")
6080 (match_operand:GPR 3 "gpc_reg_operand" "r,r")))]
6083 { return output_isel (operands); }"
6084 [(set_attr "type" "isel")
6085 (set_attr "length" "4")])
6087 (define_insn "isel_unsigned_<mode>"
6088 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
6090 (match_operator 1 "scc_comparison_operator"
6091 [(match_operand:CCUNS 4 "cc_reg_operand" "y,y")
6093 (match_operand:GPR 2 "reg_or_cint_operand" "O,b")
6094 (match_operand:GPR 3 "gpc_reg_operand" "r,r")))]
6097 { return output_isel (operands); }"
6098 [(set_attr "type" "isel")
6099 (set_attr "length" "4")])
6101 ;; These patterns can be useful for combine; they let combine know that
6102 ;; isel can handle reversed comparisons so long as the operands are
6105 (define_insn "*isel_reversed_signed_<mode>"
6106 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
6108 (match_operator 1 "scc_rev_comparison_operator"
6109 [(match_operand:CC 4 "cc_reg_operand" "y")
6111 (match_operand:GPR 2 "gpc_reg_operand" "b")
6112 (match_operand:GPR 3 "gpc_reg_operand" "b")))]
6115 { return output_isel (operands); }"
6116 [(set_attr "type" "isel")
6117 (set_attr "length" "4")])
6119 (define_insn "*isel_reversed_unsigned_<mode>"
6120 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
6122 (match_operator 1 "scc_rev_comparison_operator"
6123 [(match_operand:CCUNS 4 "cc_reg_operand" "y")
6125 (match_operand:GPR 2 "gpc_reg_operand" "b")
6126 (match_operand:GPR 3 "gpc_reg_operand" "b")))]
6129 { return output_isel (operands); }"
6130 [(set_attr "type" "isel")
6131 (set_attr "length" "4")])
6133 (define_expand "movsfcc"
6134 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6135 (if_then_else:SF (match_operand 1 "comparison_operator" "")
6136 (match_operand:SF 2 "gpc_reg_operand" "")
6137 (match_operand:SF 3 "gpc_reg_operand" "")))]
6138 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
6141 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
6147 (define_insn "*fselsfsf4"
6148 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6149 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
6150 (match_operand:SF 4 "zero_fp_constant" "F"))
6151 (match_operand:SF 2 "gpc_reg_operand" "f")
6152 (match_operand:SF 3 "gpc_reg_operand" "f")))]
6153 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
6155 [(set_attr "type" "fp")])
6157 (define_insn "*fseldfsf4"
6158 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6159 (if_then_else:SF (ge (match_operand:DF 1 "gpc_reg_operand" "d")
6160 (match_operand:DF 4 "zero_fp_constant" "F"))
6161 (match_operand:SF 2 "gpc_reg_operand" "f")
6162 (match_operand:SF 3 "gpc_reg_operand" "f")))]
6163 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_SINGLE_FLOAT"
6165 [(set_attr "type" "fp")])
6167 (define_expand "negdf2"
6168 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6169 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
6170 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6173 (define_insn "*negdf2_fpr"
6174 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6175 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "d")))]
6176 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6177 && !VECTOR_UNIT_VSX_P (DFmode)"
6179 [(set_attr "type" "fp")])
6181 (define_expand "absdf2"
6182 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6183 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
6184 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6187 (define_insn "*absdf2_fpr"
6188 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6189 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "d")))]
6190 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6191 && !VECTOR_UNIT_VSX_P (DFmode)"
6193 [(set_attr "type" "fp")])
6195 (define_insn "*nabsdf2_fpr"
6196 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6197 (neg:DF (abs:DF (match_operand:DF 1 "gpc_reg_operand" "d"))))]
6198 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6199 && !VECTOR_UNIT_VSX_P (DFmode)"
6201 [(set_attr "type" "fp")])
6203 (define_expand "adddf3"
6204 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6205 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "")
6206 (match_operand:DF 2 "gpc_reg_operand" "")))]
6207 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6210 (define_insn "*adddf3_fpr"
6211 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6212 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
6213 (match_operand:DF 2 "gpc_reg_operand" "d")))]
6214 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6215 && !VECTOR_UNIT_VSX_P (DFmode)"
6216 "{fa|fadd} %0,%1,%2"
6217 [(set_attr "type" "fp")
6218 (set_attr "fp_type" "fp_addsub_d")])
6220 (define_expand "subdf3"
6221 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6222 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "")
6223 (match_operand:DF 2 "gpc_reg_operand" "")))]
6224 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6227 (define_insn "*subdf3_fpr"
6228 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6229 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "d")
6230 (match_operand:DF 2 "gpc_reg_operand" "d")))]
6231 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6232 && !VECTOR_UNIT_VSX_P (DFmode)"
6233 "{fs|fsub} %0,%1,%2"
6234 [(set_attr "type" "fp")
6235 (set_attr "fp_type" "fp_addsub_d")])
6237 (define_expand "muldf3"
6238 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6239 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "")
6240 (match_operand:DF 2 "gpc_reg_operand" "")))]
6241 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6244 (define_insn "*muldf3_fpr"
6245 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6246 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
6247 (match_operand:DF 2 "gpc_reg_operand" "d")))]
6248 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6249 && !VECTOR_UNIT_VSX_P (DFmode)"
6250 "{fm|fmul} %0,%1,%2"
6251 [(set_attr "type" "dmul")
6252 (set_attr "fp_type" "fp_mul_d")])
6254 (define_expand "divdf3"
6255 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6256 (div:DF (match_operand:DF 1 "gpc_reg_operand" "")
6257 (match_operand:DF 2 "gpc_reg_operand" "")))]
6259 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)
6260 && !TARGET_SIMPLE_FPU"
6263 (define_insn "*divdf3_fpr"
6264 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6265 (div:DF (match_operand:DF 1 "gpc_reg_operand" "d")
6266 (match_operand:DF 2 "gpc_reg_operand" "d")))]
6267 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && !TARGET_SIMPLE_FPU
6268 && !VECTOR_UNIT_VSX_P (DFmode)"
6269 "{fd|fdiv} %0,%1,%2"
6270 [(set_attr "type" "ddiv")])
6272 (define_insn "*fred_fpr"
6273 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6274 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))]
6275 "TARGET_FRE && !VECTOR_UNIT_VSX_P (DFmode)"
6277 [(set_attr "type" "fp")])
6279 (define_insn "*rsqrtdf_internal1"
6280 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6281 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "d")]
6283 "TARGET_FRSQRTE && !VECTOR_UNIT_VSX_P (DFmode)"
6285 [(set_attr "type" "fp")])
6287 ; builtin fma support
6288 (define_insn "*fmadf4_fpr"
6289 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6290 (fma:DF (match_operand:DF 1 "gpc_reg_operand" "f")
6291 (match_operand:DF 2 "gpc_reg_operand" "f")
6292 (match_operand:DF 3 "gpc_reg_operand" "f")))]
6293 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6294 && VECTOR_UNIT_NONE_P (DFmode)"
6295 "{fma|fmadd} %0,%1,%2,%3"
6296 [(set_attr "type" "fp")
6297 (set_attr "fp_type" "fp_maddsub_d")])
6299 (define_insn "*fmsdf4_fpr"
6300 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6301 (fma:DF (match_operand:DF 1 "gpc_reg_operand" "f")
6302 (match_operand:DF 2 "gpc_reg_operand" "f")
6303 (neg:DF (match_operand:DF 3 "gpc_reg_operand" "f"))))]
6304 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6305 && VECTOR_UNIT_NONE_P (DFmode)"
6306 "{fms|fmsub} %0,%1,%2,%3"
6307 [(set_attr "type" "fp")
6308 (set_attr "fp_type" "fp_maddsub_d")])
6310 (define_insn "*nfmadf4_fpr"
6311 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6312 (neg:DF (fma:DF (match_operand:DF 1 "gpc_reg_operand" "f")
6313 (match_operand:DF 2 "gpc_reg_operand" "f")
6314 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
6315 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6316 && VECTOR_UNIT_NONE_P (DFmode)"
6317 "{fnma|fnmadd} %0,%1,%2,%3"
6318 [(set_attr "type" "fp")
6319 (set_attr "fp_type" "fp_maddsub_d")])
6321 (define_insn "*nfmsdf4_fpr"
6322 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6323 (neg:DF (fma:DF (match_operand:DF 1 "gpc_reg_operand" "f")
6324 (match_operand:DF 2 "gpc_reg_operand" "f")
6325 (neg:DF (match_operand:DF 3 "gpc_reg_operand" "f")))))]
6326 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6327 && VECTOR_UNIT_NONE_P (DFmode)"
6328 "{fnms|fnmsub} %0,%1,%2,%3"
6329 [(set_attr "type" "fp")
6330 (set_attr "fp_type" "fp_maddsub_d")])
6332 (define_expand "sqrtdf2"
6333 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6334 (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
6335 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS
6336 && TARGET_DOUBLE_FLOAT"
6339 (define_insn "*sqrtdf2_fpr"
6340 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6341 (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "d")))]
6342 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS
6343 && TARGET_DOUBLE_FLOAT
6344 && !VECTOR_UNIT_VSX_P (DFmode)"
6346 [(set_attr "type" "dsqrt")])
6348 ;; The conditional move instructions allow us to perform max and min
6349 ;; operations even when
6351 (define_expand "smaxdf3"
6352 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6353 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
6354 (match_operand:DF 2 "gpc_reg_operand" ""))
6357 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6358 && !flag_trapping_math"
6359 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
6361 (define_expand "smindf3"
6362 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6363 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
6364 (match_operand:DF 2 "gpc_reg_operand" ""))
6367 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6368 && !flag_trapping_math"
6369 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
6372 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6373 (match_operator:DF 3 "min_max_operator"
6374 [(match_operand:DF 1 "gpc_reg_operand" "")
6375 (match_operand:DF 2 "gpc_reg_operand" "")]))]
6376 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6377 && !flag_trapping_math"
6380 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
6381 operands[1], operands[2]);
6385 (define_expand "movdfcc"
6386 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6387 (if_then_else:DF (match_operand 1 "comparison_operator" "")
6388 (match_operand:DF 2 "gpc_reg_operand" "")
6389 (match_operand:DF 3 "gpc_reg_operand" "")))]
6390 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6393 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
6399 (define_insn "*fseldfdf4"
6400 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6401 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "d")
6402 (match_operand:DF 4 "zero_fp_constant" "F"))
6403 (match_operand:DF 2 "gpc_reg_operand" "d")
6404 (match_operand:DF 3 "gpc_reg_operand" "d")))]
6405 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6407 [(set_attr "type" "fp")])
6409 (define_insn "*fselsfdf4"
6410 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6411 (if_then_else:DF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
6412 (match_operand:SF 4 "zero_fp_constant" "F"))
6413 (match_operand:DF 2 "gpc_reg_operand" "d")
6414 (match_operand:DF 3 "gpc_reg_operand" "d")))]
6415 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_SINGLE_FLOAT"
6417 [(set_attr "type" "fp")])
6419 ;; Conversions to and from floating-point.
6421 ; We don't define lfiwax/lfiwzx with the normal definition, because we
6422 ; don't want to support putting SImode in FPR registers.
6423 (define_insn "lfiwax"
6424 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6425 (unspec:DI [(match_operand:SI 1 "indexed_or_indirect_operand" "Z")]
6427 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWAX"
6429 [(set_attr "type" "fpload")])
6431 ; This split must be run before register allocation because it allocates the
6432 ; memory slot that is needed to move values to/from the FPR. We don't allocate
6433 ; it earlier to allow for the combiner to merge insns together where it might
6434 ; not be needed and also in case the insns are deleted as dead code.
6436 (define_insn_and_split "floatsi<mode>2_lfiwax"
6437 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d")
6438 (float:SFDF (match_operand:SI 1 "nonimmediate_operand" "r")))
6439 (clobber (match_scratch:DI 2 "=d"))]
6440 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWAX
6441 && <SI_CONVERT_FP> && can_create_pseudo_p ()"
6447 rtx dest = operands[0];
6448 rtx src = operands[1];
6451 if (!MEM_P (src) && TARGET_MFPGPR && TARGET_POWERPC64)
6452 tmp = convert_to_mode (DImode, src, false);
6456 if (GET_CODE (tmp) == SCRATCH)
6457 tmp = gen_reg_rtx (DImode);
6460 src = rs6000_address_for_fpconvert (src);
6461 emit_insn (gen_lfiwax (tmp, src));
6465 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
6466 emit_move_insn (stack, src);
6467 emit_insn (gen_lfiwax (tmp, stack));
6470 emit_insn (gen_floatdi<mode>2 (dest, tmp));
6473 [(set_attr "length" "12")
6474 (set_attr "type" "fpload")])
6476 (define_insn_and_split "floatsi<mode>2_lfiwax_mem"
6477 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d,<rreg2>")
6480 (match_operand:SI 1 "memory_operand" "Z,Z"))))
6481 (clobber (match_scratch:DI 2 "=0,d"))]
6482 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWAX
6489 operands[1] = rs6000_address_for_fpconvert (operands[1]);
6490 if (GET_CODE (operands[2]) == SCRATCH)
6491 operands[2] = gen_reg_rtx (DImode);
6492 emit_insn (gen_lfiwax (operands[2], operands[1]));
6493 emit_insn (gen_floatdi<mode>2 (operands[0], operands[2]));
6496 [(set_attr "length" "8")
6497 (set_attr "type" "fpload")])
6499 (define_insn "lfiwzx"
6500 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6501 (unspec:DI [(match_operand:SI 1 "indexed_or_indirect_operand" "Z")]
6503 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWZX"
6505 [(set_attr "type" "fpload")])
6507 (define_insn_and_split "floatunssi<mode>2_lfiwzx"
6508 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d")
6509 (unsigned_float:SFDF (match_operand:SI 1 "nonimmediate_operand" "r")))
6510 (clobber (match_scratch:DI 2 "=d"))]
6511 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWZX
6518 rtx dest = operands[0];
6519 rtx src = operands[1];
6522 if (!MEM_P (src) && TARGET_MFPGPR && TARGET_POWERPC64)
6523 tmp = convert_to_mode (DImode, src, true);
6527 if (GET_CODE (tmp) == SCRATCH)
6528 tmp = gen_reg_rtx (DImode);
6531 src = rs6000_address_for_fpconvert (src);
6532 emit_insn (gen_lfiwzx (tmp, src));
6536 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
6537 emit_move_insn (stack, src);
6538 emit_insn (gen_lfiwzx (tmp, stack));
6541 emit_insn (gen_floatdi<mode>2 (dest, tmp));
6544 [(set_attr "length" "12")
6545 (set_attr "type" "fpload")])
6547 (define_insn_and_split "floatunssi<mode>2_lfiwzx_mem"
6548 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d,<rreg2>")
6549 (unsigned_float:SFDF
6551 (match_operand:SI 1 "memory_operand" "Z,Z"))))
6552 (clobber (match_scratch:DI 2 "=0,d"))]
6553 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWZX
6560 operands[1] = rs6000_address_for_fpconvert (operands[1]);
6561 if (GET_CODE (operands[2]) == SCRATCH)
6562 operands[2] = gen_reg_rtx (DImode);
6563 emit_insn (gen_lfiwzx (operands[2], operands[1]));
6564 emit_insn (gen_floatdi<mode>2 (operands[0], operands[2]));
6567 [(set_attr "length" "8")
6568 (set_attr "type" "fpload")])
6570 ; For each of these conversions, there is a define_expand, a define_insn
6571 ; with a '#' template, and a define_split (with C code). The idea is
6572 ; to allow constant folding with the template of the define_insn,
6573 ; then to have the insns split later (between sched1 and final).
6575 (define_expand "floatsidf2"
6576 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
6577 (float:DF (match_operand:SI 1 "nonimmediate_operand" "")))
6580 (clobber (match_dup 4))
6581 (clobber (match_dup 5))
6582 (clobber (match_dup 6))])]
6584 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6587 if (TARGET_E500_DOUBLE)
6589 if (!REG_P (operands[1]))
6590 operands[1] = force_reg (SImode, operands[1]);
6591 emit_insn (gen_spe_floatsidf2 (operands[0], operands[1]));
6594 else if (TARGET_LFIWAX && TARGET_FCFID)
6596 emit_insn (gen_floatsidf2_lfiwax (operands[0], operands[1]));
6599 else if (TARGET_FCFID)
6601 rtx dreg = operands[1];
6603 dreg = force_reg (SImode, dreg);
6604 dreg = convert_to_mode (DImode, dreg, false);
6605 emit_insn (gen_floatdidf2 (operands[0], dreg));
6609 if (!REG_P (operands[1]))
6610 operands[1] = force_reg (SImode, operands[1]);
6611 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
6612 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503601774854144\", DFmode));
6613 operands[4] = rs6000_allocate_stack_temp (DFmode, true, false);
6614 operands[5] = gen_reg_rtx (DFmode);
6615 operands[6] = gen_reg_rtx (SImode);
6618 (define_insn_and_split "*floatsidf2_internal"
6619 [(set (match_operand:DF 0 "gpc_reg_operand" "=&d")
6620 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
6621 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
6622 (use (match_operand:DF 3 "gpc_reg_operand" "d"))
6623 (clobber (match_operand:DF 4 "offsettable_mem_operand" "=o"))
6624 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&d"))
6625 (clobber (match_operand:SI 6 "gpc_reg_operand" "=&r"))]
6626 "! TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6632 rtx lowword, highword;
6633 gcc_assert (MEM_P (operands[4]));
6634 highword = adjust_address (operands[4], SImode, 0);
6635 lowword = adjust_address (operands[4], SImode, 4);
6636 if (! WORDS_BIG_ENDIAN)
6639 tmp = highword; highword = lowword; lowword = tmp;
6642 emit_insn (gen_xorsi3 (operands[6], operands[1],
6643 GEN_INT (~ (HOST_WIDE_INT) 0x7fffffff)));
6644 emit_move_insn (lowword, operands[6]);
6645 emit_move_insn (highword, operands[2]);
6646 emit_move_insn (operands[5], operands[4]);
6647 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
6650 [(set_attr "length" "24")
6651 (set_attr "type" "fp")])
6653 ;; If we don't have a direct conversion to single precision, don't enable this
6654 ;; conversion for 32-bit without fast math, because we don't have the insn to
6655 ;; generate the fixup swizzle to avoid double rounding problems.
6656 (define_expand "floatunssisf2"
6657 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6658 (unsigned_float:SF (match_operand:SI 1 "nonimmediate_operand" "")))]
6659 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT
6662 && ((TARGET_FCFIDUS && TARGET_LFIWZX)
6663 || (TARGET_DOUBLE_FLOAT && TARGET_FCFID
6664 && (TARGET_POWERPC64 || flag_unsafe_math_optimizations)))))"
6669 if (!REG_P (operands[1]))
6670 operands[1] = force_reg (SImode, operands[1]);
6672 else if (TARGET_LFIWZX && TARGET_FCFIDUS)
6674 emit_insn (gen_floatunssisf2_lfiwzx (operands[0], operands[1]));
6679 rtx dreg = operands[1];
6681 dreg = force_reg (SImode, dreg);
6682 dreg = convert_to_mode (DImode, dreg, true);
6683 emit_insn (gen_floatdisf2 (operands[0], dreg));
6688 (define_expand "floatunssidf2"
6689 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
6690 (unsigned_float:DF (match_operand:SI 1 "nonimmediate_operand" "")))
6693 (clobber (match_dup 4))
6694 (clobber (match_dup 5))])]
6696 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6699 if (TARGET_E500_DOUBLE)
6701 if (!REG_P (operands[1]))
6702 operands[1] = force_reg (SImode, operands[1]);
6703 emit_insn (gen_spe_floatunssidf2 (operands[0], operands[1]));
6706 else if (TARGET_LFIWZX && TARGET_FCFID)
6708 emit_insn (gen_floatunssidf2_lfiwzx (operands[0], operands[1]));
6711 else if (TARGET_FCFID)
6713 rtx dreg = operands[1];
6715 dreg = force_reg (SImode, dreg);
6716 dreg = convert_to_mode (DImode, dreg, true);
6717 emit_insn (gen_floatdidf2 (operands[0], dreg));
6721 if (!REG_P (operands[1]))
6722 operands[1] = force_reg (SImode, operands[1]);
6723 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
6724 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503599627370496\", DFmode));
6725 operands[4] = rs6000_allocate_stack_temp (DFmode, true, false);
6726 operands[5] = gen_reg_rtx (DFmode);
6729 (define_insn_and_split "*floatunssidf2_internal"
6730 [(set (match_operand:DF 0 "gpc_reg_operand" "=&d")
6731 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
6732 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
6733 (use (match_operand:DF 3 "gpc_reg_operand" "d"))
6734 (clobber (match_operand:DF 4 "offsettable_mem_operand" "=o"))
6735 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&d"))]
6736 "! TARGET_FCFIDU && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6737 && !(TARGET_FCFID && TARGET_POWERPC64)"
6743 rtx lowword, highword;
6744 gcc_assert (MEM_P (operands[4]));
6745 highword = adjust_address (operands[4], SImode, 0);
6746 lowword = adjust_address (operands[4], SImode, 4);
6747 if (! WORDS_BIG_ENDIAN)
6750 tmp = highword; highword = lowword; lowword = tmp;
6753 emit_move_insn (lowword, operands[1]);
6754 emit_move_insn (highword, operands[2]);
6755 emit_move_insn (operands[5], operands[4]);
6756 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
6759 [(set_attr "length" "20")
6760 (set_attr "type" "fp")])
6762 (define_expand "fix_trunc<mode>si2"
6763 [(set (match_operand:SI 0 "gpc_reg_operand" "")
6764 (fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "")))]
6765 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT
6766 && ((TARGET_FPRS && <TARGET_FLOAT>) || <E500_CONVERT>)"
6769 if (!<E500_CONVERT>)
6774 emit_insn (gen_fix_trunc<mode>si2_stfiwx (operands[0], operands[1]));
6777 tmp = gen_reg_rtx (DImode);
6778 stack = rs6000_allocate_stack_temp (DImode, true, false);
6779 emit_insn (gen_fix_trunc<mode>si2_internal (operands[0], operands[1],
6786 ; Like the convert to float patterns, this insn must be split before
6787 ; register allocation so that it can allocate the memory slot if it
6789 (define_insn_and_split "fix_trunc<mode>si2_stfiwx"
6790 [(set (match_operand:SI 0 "general_operand" "=rm")
6791 (fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d")))
6792 (clobber (match_scratch:DI 2 "=d"))]
6793 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6794 && (<MODE>mode != SFmode || TARGET_SINGLE_FLOAT)
6795 && TARGET_STFIWX && can_create_pseudo_p ()"
6800 rtx dest = operands[0];
6801 rtx src = operands[1];
6802 rtx tmp = operands[2];
6804 if (GET_CODE (tmp) == SCRATCH)
6805 tmp = gen_reg_rtx (DImode);
6807 emit_insn (gen_fctiwz_<mode> (tmp, src));
6810 dest = rs6000_address_for_fpconvert (dest);
6811 emit_insn (gen_stfiwx (dest, tmp));
6814 else if (TARGET_MFPGPR && TARGET_POWERPC64)
6816 dest = gen_lowpart (DImode, dest);
6817 emit_move_insn (dest, tmp);
6822 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
6823 emit_insn (gen_stfiwx (stack, tmp));
6824 emit_move_insn (dest, stack);
6828 [(set_attr "length" "12")
6829 (set_attr "type" "fp")])
6831 (define_insn_and_split "fix_trunc<mode>si2_internal"
6832 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,?r")
6833 (fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d,<rreg>")))
6834 (clobber (match_operand:DI 2 "gpc_reg_operand" "=1,d"))
6835 (clobber (match_operand:DI 3 "offsettable_mem_operand" "=o,o"))]
6836 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS
6837 && TARGET_DOUBLE_FLOAT"
6844 gcc_assert (MEM_P (operands[3]));
6845 lowword = adjust_address (operands[3], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
6847 emit_insn (gen_fctiwz_<mode> (operands[2], operands[1]));
6848 emit_move_insn (operands[3], operands[2]);
6849 emit_move_insn (operands[0], lowword);
6852 [(set_attr "length" "16")
6853 (set_attr "type" "fp")])
6855 (define_expand "fix_trunc<mode>di2"
6856 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6857 (fix:DI (match_operand:SFDF 1 "gpc_reg_operand" "")))]
6858 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
6862 (define_insn "*fix_trunc<mode>di2_fctidz"
6863 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6864 (fix:DI (match_operand:SFDF 1 "gpc_reg_operand" "d")))]
6865 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
6866 && TARGET_FCFID && !VECTOR_UNIT_VSX_P (<MODE>mode)"
6868 [(set_attr "type" "fp")])
6870 (define_expand "fixuns_trunc<mode>si2"
6871 [(set (match_operand:SI 0 "gpc_reg_operand" "")
6872 (unsigned_fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "")))]
6874 && ((TARGET_FPRS && <TARGET_FLOAT> && TARGET_FCTIWUZ && TARGET_STFIWX)
6878 if (!<E500_CONVERT>)
6880 emit_insn (gen_fixuns_trunc<mode>si2_stfiwx (operands[0], operands[1]));
6885 (define_insn_and_split "fixuns_trunc<mode>si2_stfiwx"
6886 [(set (match_operand:SI 0 "general_operand" "=rm")
6887 (unsigned_fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d")))
6888 (clobber (match_scratch:DI 2 "=d"))]
6889 "TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT> && TARGET_FCTIWUZ
6890 && TARGET_STFIWX && can_create_pseudo_p ()"
6895 rtx dest = operands[0];
6896 rtx src = operands[1];
6897 rtx tmp = operands[2];
6899 if (GET_CODE (tmp) == SCRATCH)
6900 tmp = gen_reg_rtx (DImode);
6902 emit_insn (gen_fctiwuz_<mode> (tmp, src));
6905 dest = rs6000_address_for_fpconvert (dest);
6906 emit_insn (gen_stfiwx (dest, tmp));
6909 else if (TARGET_MFPGPR && TARGET_POWERPC64)
6911 dest = gen_lowpart (DImode, dest);
6912 emit_move_insn (dest, tmp);
6917 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
6918 emit_insn (gen_stfiwx (stack, tmp));
6919 emit_move_insn (dest, stack);
6923 [(set_attr "length" "12")
6924 (set_attr "type" "fp")])
6926 (define_expand "fixuns_trunc<mode>di2"
6927 [(set (match_operand:DI 0 "register_operand" "")
6928 (unsigned_fix:DI (match_operand:SFDF 1 "register_operand" "")))]
6929 "TARGET_HARD_FLOAT && (TARGET_FCTIDUZ || VECTOR_UNIT_VSX_P (<MODE>mode))"
6932 (define_insn "*fixuns_trunc<mode>di2_fctiduz"
6933 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6934 (unsigned_fix:DI (match_operand:SFDF 1 "gpc_reg_operand" "d")))]
6935 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
6936 && TARGET_FCTIDUZ && !VECTOR_UNIT_VSX_P (<MODE>mode)"
6938 [(set_attr "type" "fp")])
6940 ; Here, we use (set (reg) (unspec:DI [(fix:SI ...)] UNSPEC_FCTIWZ))
6941 ; rather than (set (subreg:SI (reg)) (fix:SI ...))
6942 ; because the first makes it clear that operand 0 is not live
6943 ; before the instruction.
6944 (define_insn "fctiwz_<mode>"
6945 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6946 (unspec:DI [(fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d"))]
6948 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS
6949 && TARGET_DOUBLE_FLOAT"
6950 "{fcirz|fctiwz} %0,%1"
6951 [(set_attr "type" "fp")])
6953 (define_insn "fctiwuz_<mode>"
6954 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6955 (unspec:DI [(unsigned_fix:SI
6956 (match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>"))]
6958 "TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT> && TARGET_FCTIWUZ"
6960 [(set_attr "type" "fp")])
6962 ;; Only optimize (float (fix x)) -> frz if we are in fast-math mode, since
6963 ;; since the friz instruction does not truncate the value if the floating
6964 ;; point value is < LONG_MIN or > LONG_MAX.
6965 (define_insn "*friz"
6966 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6967 (float:DF (fix:DI (match_operand:DF 1 "gpc_reg_operand" "d"))))]
6968 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_FPRND
6969 && !VECTOR_UNIT_VSX_P (DFmode) && flag_unsafe_math_optimizations
6970 && !flag_trapping_math && TARGET_FRIZ"
6972 [(set_attr "type" "fp")])
6974 ;; Since FCTIWZ doesn't sign extend the upper bits, we have to do a store and a
6975 ;; load to properly sign extend the value, but at least doing a store, load
6976 ;; into a GPR to sign extend, a store from the GPR and a load back into the FPR
6977 ;; if we have 32-bit memory ops
6978 (define_insn_and_split "*round32<mode>2_fprs"
6979 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d")
6981 (fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d"))))
6982 (clobber (match_scratch:DI 2 "=d"))
6983 (clobber (match_scratch:DI 3 "=d"))]
6984 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6985 && <SI_CONVERT_FP> && TARGET_LFIWAX && TARGET_STFIWX && TARGET_FCFID
6986 && can_create_pseudo_p ()"
6991 rtx dest = operands[0];
6992 rtx src = operands[1];
6993 rtx tmp1 = operands[2];
6994 rtx tmp2 = operands[3];
6995 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
6997 if (GET_CODE (tmp1) == SCRATCH)
6998 tmp1 = gen_reg_rtx (DImode);
6999 if (GET_CODE (tmp2) == SCRATCH)
7000 tmp2 = gen_reg_rtx (DImode);
7002 emit_insn (gen_fctiwz_<mode> (tmp1, src));
7003 emit_insn (gen_stfiwx (stack, tmp1));
7004 emit_insn (gen_lfiwax (tmp2, stack));
7005 emit_insn (gen_floatdi<mode>2 (dest, tmp2));
7008 [(set_attr "type" "fpload")
7009 (set_attr "length" "16")])
7011 (define_insn_and_split "*roundu32<mode>2_fprs"
7012 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d")
7013 (unsigned_float:SFDF
7014 (unsigned_fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d"))))
7015 (clobber (match_scratch:DI 2 "=d"))
7016 (clobber (match_scratch:DI 3 "=d"))]
7017 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
7018 && TARGET_LFIWZX && TARGET_STFIWX && TARGET_FCFIDU
7019 && can_create_pseudo_p ()"
7024 rtx dest = operands[0];
7025 rtx src = operands[1];
7026 rtx tmp1 = operands[2];
7027 rtx tmp2 = operands[3];
7028 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
7030 if (GET_CODE (tmp1) == SCRATCH)
7031 tmp1 = gen_reg_rtx (DImode);
7032 if (GET_CODE (tmp2) == SCRATCH)
7033 tmp2 = gen_reg_rtx (DImode);
7035 emit_insn (gen_fctiwuz_<mode> (tmp1, src));
7036 emit_insn (gen_stfiwx (stack, tmp1));
7037 emit_insn (gen_lfiwzx (tmp2, stack));
7038 emit_insn (gen_floatdi<mode>2 (dest, tmp2));
7041 [(set_attr "type" "fpload")
7042 (set_attr "length" "16")])
7044 ;; No VSX equivalent to fctid
7045 (define_insn "lrint<mode>di2"
7046 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
7047 (unspec:DI [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
7049 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
7051 [(set_attr "type" "fp")])
7053 (define_expand "btrunc<mode>2"
7054 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
7055 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "")]
7057 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
7060 (define_insn "*btrunc<mode>2_fpr"
7061 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
7062 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
7064 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>
7065 && !VECTOR_UNIT_VSX_P (<MODE>mode)"
7067 [(set_attr "type" "fp")])
7069 (define_expand "ceil<mode>2"
7070 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
7071 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "")]
7073 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
7076 (define_insn "*ceil<mode>2_fpr"
7077 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
7078 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
7080 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>
7081 && !VECTOR_UNIT_VSX_P (<MODE>mode)"
7083 [(set_attr "type" "fp")])
7085 (define_expand "floor<mode>2"
7086 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
7087 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "")]
7089 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
7092 (define_insn "*floor<mode>2_fpr"
7093 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
7094 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
7096 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>
7097 && !VECTOR_UNIT_VSX_P (<MODE>mode)"
7099 [(set_attr "type" "fp")])
7101 ;; No VSX equivalent to frin
7102 (define_insn "round<mode>2"
7103 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
7104 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
7106 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
7108 [(set_attr "type" "fp")])
7110 ; An UNSPEC is used so we don't have to support SImode in FP registers.
7111 (define_insn "stfiwx"
7112 [(set (match_operand:SI 0 "memory_operand" "=Z")
7113 (unspec:SI [(match_operand:DI 1 "gpc_reg_operand" "d")]
7117 [(set_attr "type" "fpstore")])
7119 ;; If we don't have a direct conversion to single precision, don't enable this
7120 ;; conversion for 32-bit without fast math, because we don't have the insn to
7121 ;; generate the fixup swizzle to avoid double rounding problems.
7122 (define_expand "floatsisf2"
7123 [(set (match_operand:SF 0 "gpc_reg_operand" "")
7124 (float:SF (match_operand:SI 1 "nonimmediate_operand" "")))]
7125 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT
7128 && ((TARGET_FCFIDS && TARGET_LFIWAX)
7129 || (TARGET_DOUBLE_FLOAT && TARGET_FCFID
7130 && (TARGET_POWERPC64 || flag_unsafe_math_optimizations)))))"
7135 if (!REG_P (operands[1]))
7136 operands[1] = force_reg (SImode, operands[1]);
7138 else if (TARGET_FCFIDS && TARGET_LFIWAX)
7140 emit_insn (gen_floatsisf2_lfiwax (operands[0], operands[1]));
7143 else if (TARGET_FCFID && TARGET_LFIWAX)
7145 rtx dfreg = gen_reg_rtx (DFmode);
7146 emit_insn (gen_floatsidf2_lfiwax (dfreg, operands[1]));
7147 emit_insn (gen_truncdfsf2 (operands[0], dfreg));
7152 rtx dreg = operands[1];
7154 dreg = force_reg (SImode, dreg);
7155 dreg = convert_to_mode (DImode, dreg, false);
7156 emit_insn (gen_floatdisf2 (operands[0], dreg));
7161 (define_expand "floatdidf2"
7162 [(set (match_operand:DF 0 "gpc_reg_operand" "")
7163 (float:DF (match_operand:DI 1 "gpc_reg_operand" "")))]
7164 "TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS"
7167 (define_insn "*floatdidf2_fpr"
7168 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
7169 (float:DF (match_operand:DI 1 "gpc_reg_operand" "d")))]
7170 "TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
7171 && !VECTOR_UNIT_VSX_P (DFmode)"
7173 [(set_attr "type" "fp")])
7175 ; Allow the combiner to merge source memory operands to the conversion so that
7176 ; the optimizer/register allocator doesn't try to load the value too early in a
7177 ; GPR and then use store/load to move it to a FPR and suffer from a store-load
7178 ; hit. We will split after reload to avoid the trip through the GPRs
7180 (define_insn_and_split "*floatdidf2_mem"
7181 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
7182 (float:DF (match_operand:DI 1 "memory_operand" "m")))
7183 (clobber (match_scratch:DI 2 "=d"))]
7184 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS && TARGET_FCFID"
7186 "&& reload_completed"
7187 [(set (match_dup 2) (match_dup 1))
7188 (set (match_dup 0) (float:DF (match_dup 2)))]
7190 [(set_attr "length" "8")
7191 (set_attr "type" "fpload")])
7193 (define_expand "floatunsdidf2"
7194 [(set (match_operand:DF 0 "gpc_reg_operand" "")
7196 (match_operand:DI 1 "gpc_reg_operand" "")))]
7197 "TARGET_HARD_FLOAT && (TARGET_FCFIDU || VECTOR_UNIT_VSX_P (DFmode))"
7200 (define_insn "*floatunsdidf2_fcfidu"
7201 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
7202 (unsigned_float:DF (match_operand:DI 1 "gpc_reg_operand" "d")))]
7203 "TARGET_HARD_FLOAT && TARGET_FCFIDU && !VECTOR_UNIT_VSX_P (DFmode)"
7205 [(set_attr "type" "fp")
7206 (set_attr "length" "4")])
7208 (define_insn_and_split "*floatunsdidf2_mem"
7209 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
7210 (unsigned_float:DF (match_operand:DI 1 "memory_operand" "m")))
7211 (clobber (match_scratch:DI 2 "=d"))]
7212 "TARGET_HARD_FLOAT && (TARGET_FCFIDU || VECTOR_UNIT_VSX_P (DFmode))"
7214 "&& reload_completed"
7215 [(set (match_dup 2) (match_dup 1))
7216 (set (match_dup 0) (unsigned_float:DF (match_dup 2)))]
7218 [(set_attr "length" "8")
7219 (set_attr "type" "fpload")])
7221 (define_expand "floatdisf2"
7222 [(set (match_operand:SF 0 "gpc_reg_operand" "")
7223 (float:SF (match_operand:DI 1 "gpc_reg_operand" "")))]
7224 "TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
7225 && (TARGET_FCFIDS || TARGET_POWERPC64 || flag_unsafe_math_optimizations)"
7230 rtx val = operands[1];
7231 if (!flag_unsafe_math_optimizations)
7233 rtx label = gen_label_rtx ();
7234 val = gen_reg_rtx (DImode);
7235 emit_insn (gen_floatdisf2_internal2 (val, operands[1], label));
7238 emit_insn (gen_floatdisf2_internal1 (operands[0], val));
7243 (define_insn "floatdisf2_fcfids"
7244 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
7245 (float:SF (match_operand:DI 1 "gpc_reg_operand" "d")))]
7246 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
7247 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDS"
7249 [(set_attr "type" "fp")])
7251 (define_insn_and_split "*floatdisf2_mem"
7252 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
7253 (float:SF (match_operand:DI 1 "memory_operand" "m")))
7254 (clobber (match_scratch:DI 2 "=f"))]
7255 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
7256 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDS"
7258 "&& reload_completed"
7262 emit_move_insn (operands[2], operands[1]);
7263 emit_insn (gen_floatdisf2_fcfids (operands[0], operands[2]));
7266 [(set_attr "length" "8")])
7268 ;; This is not IEEE compliant if rounding mode is "round to nearest".
7269 ;; If the DI->DF conversion is inexact, then it's possible to suffer
7270 ;; from double rounding.
7271 ;; Instead of creating a new cpu type for two FP operations, just use fp
7272 (define_insn_and_split "floatdisf2_internal1"
7273 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
7274 (float:SF (match_operand:DI 1 "gpc_reg_operand" "d")))
7275 (clobber (match_scratch:DF 2 "=d"))]
7276 "TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
7278 "&& reload_completed"
7280 (float:DF (match_dup 1)))
7282 (float_truncate:SF (match_dup 2)))]
7284 [(set_attr "length" "8")
7285 (set_attr "type" "fp")])
7287 ;; Twiddles bits to avoid double rounding.
7288 ;; Bits that might be truncated when converting to DFmode are replaced
7289 ;; by a bit that won't be lost at that stage, but is below the SFmode
7290 ;; rounding position.
7291 (define_expand "floatdisf2_internal2"
7292 [(set (match_dup 3) (ashiftrt:DI (match_operand:DI 1 "" "")
7294 (parallel [(set (match_operand:DI 0 "" "") (and:DI (match_dup 1)
7296 (clobber (scratch:CC))])
7297 (set (match_dup 3) (plus:DI (match_dup 3)
7299 (set (match_dup 0) (plus:DI (match_dup 0)
7301 (set (match_dup 4) (compare:CCUNS (match_dup 3)
7303 (set (match_dup 0) (ior:DI (match_dup 0)
7305 (parallel [(set (match_dup 0) (and:DI (match_dup 0)
7307 (clobber (scratch:CC))])
7308 (set (pc) (if_then_else (geu (match_dup 4) (const_int 0))
7309 (label_ref (match_operand:DI 2 "" ""))
7311 (set (match_dup 0) (match_dup 1))]
7312 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
7315 operands[3] = gen_reg_rtx (DImode);
7316 operands[4] = gen_reg_rtx (CCUNSmode);
7319 (define_expand "floatunsdisf2"
7320 [(set (match_operand:SF 0 "gpc_reg_operand" "")
7321 (unsigned_float:SF (match_operand:DI 1 "gpc_reg_operand" "")))]
7322 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
7323 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDUS"
7326 (define_insn "floatunsdisf2_fcfidus"
7327 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
7328 (unsigned_float:SF (match_operand:DI 1 "gpc_reg_operand" "d")))]
7329 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
7330 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDUS"
7332 [(set_attr "type" "fp")])
7334 (define_insn_and_split "*floatunsdisf2_mem"
7335 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
7336 (unsigned_float:SF (match_operand:DI 1 "memory_operand" "m")))
7337 (clobber (match_scratch:DI 2 "=f"))]
7338 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
7339 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDUS"
7341 "&& reload_completed"
7345 emit_move_insn (operands[2], operands[1]);
7346 emit_insn (gen_floatunsdisf2_fcfidus (operands[0], operands[2]));
7349 [(set_attr "length" "8")
7350 (set_attr "type" "fpload")])
7352 ;; Define the DImode operations that can be done in a small number
7353 ;; of instructions. The & constraints are to prevent the register
7354 ;; allocator from allocating registers that overlap with the inputs
7355 ;; (for example, having an input in 7,8 and an output in 6,7). We
7356 ;; also allow for the output being the same as one of the inputs.
7358 (define_insn "*adddi3_noppc64"
7359 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r")
7360 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,0,0")
7361 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I")))]
7362 "! TARGET_POWERPC64"
7365 if (WORDS_BIG_ENDIAN)
7366 return (GET_CODE (operands[2])) != CONST_INT
7367 ? \"{a|addc} %L0,%L1,%L2\;{ae|adde} %0,%1,%2\"
7368 : \"{ai|addic} %L0,%L1,%2\;{a%G2e|add%G2e} %0,%1\";
7370 return (GET_CODE (operands[2])) != CONST_INT
7371 ? \"{a|addc} %0,%1,%2\;{ae|adde} %L0,%L1,%L2\"
7372 : \"{ai|addic} %0,%1,%2\;{a%G2e|add%G2e} %L0,%L1\";
7374 [(set_attr "type" "two")
7375 (set_attr "length" "8")])
7377 (define_insn "*subdi3_noppc64"
7378 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r,r")
7379 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I,0,r,I")
7380 (match_operand:DI 2 "gpc_reg_operand" "r,r,r,0,0")))]
7381 "! TARGET_POWERPC64"
7384 if (WORDS_BIG_ENDIAN)
7385 return (GET_CODE (operands[1]) != CONST_INT)
7386 ? \"{sf|subfc} %L0,%L2,%L1\;{sfe|subfe} %0,%2,%1\"
7387 : \"{sfi|subfic} %L0,%L2,%1\;{sf%G1e|subf%G1e} %0,%2\";
7389 return (GET_CODE (operands[1]) != CONST_INT)
7390 ? \"{sf|subfc} %0,%2,%1\;{sfe|subfe} %L0,%L2,%L1\"
7391 : \"{sfi|subfic} %0,%2,%1\;{sf%G1e|subf%G1e} %L0,%L2\";
7393 [(set_attr "type" "two")
7394 (set_attr "length" "8")])
7396 (define_insn "*negdi2_noppc64"
7397 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
7398 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))]
7399 "! TARGET_POWERPC64"
7402 return (WORDS_BIG_ENDIAN)
7403 ? \"{sfi|subfic} %L0,%L1,0\;{sfze|subfze} %0,%1\"
7404 : \"{sfi|subfic} %0,%1,0\;{sfze|subfze} %L0,%L1\";
7406 [(set_attr "type" "two")
7407 (set_attr "length" "8")])
7409 (define_expand "mulsidi3"
7410 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7411 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
7412 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
7413 "! TARGET_POWERPC64"
7416 if (! TARGET_POWER && ! TARGET_POWERPC)
7418 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
7419 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
7420 emit_insn (gen_mull_call ());
7421 if (WORDS_BIG_ENDIAN)
7422 emit_move_insn (operands[0], gen_rtx_REG (DImode, 3));
7425 emit_move_insn (operand_subword (operands[0], 0, 0, DImode),
7426 gen_rtx_REG (SImode, 3));
7427 emit_move_insn (operand_subword (operands[0], 1, 0, DImode),
7428 gen_rtx_REG (SImode, 4));
7432 else if (TARGET_POWER)
7434 emit_insn (gen_mulsidi3_mq (operands[0], operands[1], operands[2]));
7439 (define_insn "mulsidi3_mq"
7440 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7441 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
7442 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
7443 (clobber (match_scratch:SI 3 "=q"))]
7445 "mul %0,%1,%2\;mfmq %L0"
7446 [(set_attr "type" "imul")
7447 (set_attr "length" "8")])
7449 (define_insn "*mulsidi3_no_mq"
7450 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
7451 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
7452 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
7453 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
7456 return (WORDS_BIG_ENDIAN)
7457 ? \"mulhw %0,%1,%2\;mullw %L0,%1,%2\"
7458 : \"mulhw %L0,%1,%2\;mullw %0,%1,%2\";
7460 [(set_attr "type" "imul")
7461 (set_attr "length" "8")])
7464 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7465 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
7466 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
7467 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
7470 (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
7471 (sign_extend:DI (match_dup 2)))
7474 (mult:SI (match_dup 1)
7478 int endian = (WORDS_BIG_ENDIAN == 0);
7479 operands[3] = operand_subword (operands[0], endian, 0, DImode);
7480 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
7483 (define_expand "umulsidi3"
7484 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7485 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
7486 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
7487 "TARGET_POWERPC && ! TARGET_POWERPC64"
7492 emit_insn (gen_umulsidi3_mq (operands[0], operands[1], operands[2]));
7497 (define_insn "umulsidi3_mq"
7498 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
7499 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
7500 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
7501 (clobber (match_scratch:SI 3 "=q"))]
7502 "TARGET_POWERPC && TARGET_POWER"
7505 return (WORDS_BIG_ENDIAN)
7506 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
7507 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
7509 [(set_attr "type" "imul")
7510 (set_attr "length" "8")])
7512 (define_insn "*umulsidi3_no_mq"
7513 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
7514 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
7515 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
7516 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
7519 return (WORDS_BIG_ENDIAN)
7520 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
7521 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
7523 [(set_attr "type" "imul")
7524 (set_attr "length" "8")])
7527 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7528 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
7529 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
7530 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
7533 (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
7534 (zero_extend:DI (match_dup 2)))
7537 (mult:SI (match_dup 1)
7541 int endian = (WORDS_BIG_ENDIAN == 0);
7542 operands[3] = operand_subword (operands[0], endian, 0, DImode);
7543 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
7546 (define_expand "smulsi3_highpart"
7547 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7549 (lshiftrt:DI (mult:DI (sign_extend:DI
7550 (match_operand:SI 1 "gpc_reg_operand" ""))
7552 (match_operand:SI 2 "gpc_reg_operand" "")))
7557 if (! TARGET_POWER && ! TARGET_POWERPC)
7559 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
7560 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
7561 emit_insn (gen_mulh_call ());
7562 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
7565 else if (TARGET_POWER)
7567 emit_insn (gen_smulsi3_highpart_mq (operands[0], operands[1], operands[2]));
7572 (define_insn "smulsi3_highpart_mq"
7573 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7575 (lshiftrt:DI (mult:DI (sign_extend:DI
7576 (match_operand:SI 1 "gpc_reg_operand" "%r"))
7578 (match_operand:SI 2 "gpc_reg_operand" "r")))
7580 (clobber (match_scratch:SI 3 "=q"))]
7583 [(set_attr "type" "imul")])
7585 (define_insn "*smulsi3_highpart_no_mq"
7586 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7588 (lshiftrt:DI (mult:DI (sign_extend:DI
7589 (match_operand:SI 1 "gpc_reg_operand" "%r"))
7591 (match_operand:SI 2 "gpc_reg_operand" "r")))
7593 "TARGET_POWERPC && ! TARGET_POWER"
7595 [(set_attr "type" "imul")])
7597 (define_expand "umulsi3_highpart"
7598 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7600 (lshiftrt:DI (mult:DI (zero_extend:DI
7601 (match_operand:SI 1 "gpc_reg_operand" ""))
7603 (match_operand:SI 2 "gpc_reg_operand" "")))
7610 emit_insn (gen_umulsi3_highpart_mq (operands[0], operands[1], operands[2]));
7615 (define_insn "umulsi3_highpart_mq"
7616 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7618 (lshiftrt:DI (mult:DI (zero_extend:DI
7619 (match_operand:SI 1 "gpc_reg_operand" "%r"))
7621 (match_operand:SI 2 "gpc_reg_operand" "r")))
7623 (clobber (match_scratch:SI 3 "=q"))]
7624 "TARGET_POWERPC && TARGET_POWER"
7626 [(set_attr "type" "imul")])
7628 (define_insn "*umulsi3_highpart_no_mq"
7629 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7631 (lshiftrt:DI (mult:DI (zero_extend:DI
7632 (match_operand:SI 1 "gpc_reg_operand" "%r"))
7634 (match_operand:SI 2 "gpc_reg_operand" "r")))
7636 "TARGET_POWERPC && ! TARGET_POWER"
7638 [(set_attr "type" "imul")])
7640 ;; If operands 0 and 2 are in the same register, we have a problem. But
7641 ;; operands 0 and 1 (the usual case) can be in the same register. That's
7642 ;; why we have the strange constraints below.
7643 (define_insn "ashldi3_power"
7644 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
7645 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
7646 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
7647 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
7650 {sli|slwi} %0,%L1,%h2\;{cal %L0,0(0)|li %L0,0}
7651 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
7652 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
7653 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2"
7654 [(set_attr "length" "8")])
7656 (define_insn "lshrdi3_power"
7657 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
7658 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
7659 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
7660 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
7663 {s%A2i|s%A2wi} %L0,%1,%h2\;{cal %0,0(0)|li %0,0}
7664 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
7665 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
7666 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2"
7667 [(set_attr "length" "8")])
7669 ;; Shift by a variable amount is too complex to be worth open-coding. We
7670 ;; just handle shifts by constants.
7671 (define_insn "ashrdi3_power"
7672 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
7673 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7674 (match_operand:SI 2 "const_int_operand" "M,i")))
7675 (clobber (match_scratch:SI 3 "=X,q"))]
7678 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
7679 sraiq %0,%1,%h2\;srliq %L0,%L1,%h2"
7680 [(set_attr "type" "shift")
7681 (set_attr "length" "8")])
7683 (define_insn "ashrdi3_no_power"
7684 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
7685 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7686 (match_operand:SI 2 "const_int_operand" "M,i")))]
7687 "TARGET_32BIT && !TARGET_POWERPC64 && !TARGET_POWER && WORDS_BIG_ENDIAN"
7689 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
7690 {sri|srwi} %L0,%L1,%h2\;insrwi %L0,%1,%h2,0\;{srai|srawi} %0,%1,%h2"
7691 [(set_attr "type" "two,three")
7692 (set_attr "length" "8,12")])
7694 (define_insn "*ashrdisi3_noppc64"
7695 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7696 (subreg:SI (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7697 (const_int 32)) 4))]
7698 "TARGET_32BIT && !TARGET_POWERPC64"
7701 if (REGNO (operands[0]) == REGNO (operands[1]))
7704 return \"mr %0,%1\";
7706 [(set_attr "length" "4")])
7709 ;; PowerPC64 DImode operations.
7711 (define_expand "absdi2"
7712 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7713 (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))]
7718 emit_insn (gen_absdi2_isel (operands[0], operands[1]));
7720 emit_insn (gen_absdi2_internal (operands[0], operands[1]));
7724 (define_insn_and_split "absdi2_internal"
7725 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
7726 (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))
7727 (clobber (match_scratch:DI 2 "=&r,&r"))]
7728 "TARGET_POWERPC64 && !TARGET_ISEL"
7730 "&& reload_completed"
7731 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
7732 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
7733 (set (match_dup 0) (minus:DI (match_dup 0) (match_dup 2)))]
7736 (define_insn_and_split "*nabsdi2"
7737 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
7738 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0"))))
7739 (clobber (match_scratch:DI 2 "=&r,&r"))]
7740 "TARGET_POWERPC64 && !TARGET_ISEL"
7742 "&& reload_completed"
7743 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
7744 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
7745 (set (match_dup 0) (minus:DI (match_dup 2) (match_dup 0)))]
7748 (define_insn "muldi3"
7749 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7750 (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
7751 (match_operand:DI 2 "reg_or_short_operand" "r,I")))]
7757 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
7758 (const_string "imul3")
7759 (match_operand:SI 2 "short_cint_operand" "")
7760 (const_string "imul2")]
7761 (const_string "lmul")))])
7763 (define_insn "*muldi3_internal1"
7764 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7765 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
7766 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
7768 (clobber (match_scratch:DI 3 "=r,r"))]
7773 [(set_attr "type" "lmul_compare")
7774 (set_attr "length" "4,8")])
7777 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7778 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
7779 (match_operand:DI 2 "gpc_reg_operand" ""))
7781 (clobber (match_scratch:DI 3 ""))]
7782 "TARGET_POWERPC64 && reload_completed"
7784 (mult:DI (match_dup 1) (match_dup 2)))
7786 (compare:CC (match_dup 3)
7790 (define_insn "*muldi3_internal2"
7791 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7792 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
7793 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
7795 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7796 (mult:DI (match_dup 1) (match_dup 2)))]
7801 [(set_attr "type" "lmul_compare")
7802 (set_attr "length" "4,8")])
7805 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7806 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
7807 (match_operand:DI 2 "gpc_reg_operand" ""))
7809 (set (match_operand:DI 0 "gpc_reg_operand" "")
7810 (mult:DI (match_dup 1) (match_dup 2)))]
7811 "TARGET_POWERPC64 && reload_completed"
7813 (mult:DI (match_dup 1) (match_dup 2)))
7815 (compare:CC (match_dup 0)
7819 (define_insn "smuldi3_highpart"
7820 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7822 (lshiftrt:TI (mult:TI (sign_extend:TI
7823 (match_operand:DI 1 "gpc_reg_operand" "%r"))
7825 (match_operand:DI 2 "gpc_reg_operand" "r")))
7829 [(set_attr "type" "lmul")])
7831 (define_insn "umuldi3_highpart"
7832 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7834 (lshiftrt:TI (mult:TI (zero_extend:TI
7835 (match_operand:DI 1 "gpc_reg_operand" "%r"))
7837 (match_operand:DI 2 "gpc_reg_operand" "r")))
7841 [(set_attr "type" "lmul")])
7843 (define_insn "rotldi3"
7844 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7845 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7846 (match_operand:DI 2 "reg_or_cint_operand" "r,i")))]
7851 [(set_attr "type" "var_shift_rotate,integer")])
7853 (define_insn "*rotldi3_internal2"
7854 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7855 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7856 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
7858 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7865 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7866 (set_attr "length" "4,4,8,8")])
7869 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7870 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7871 (match_operand:DI 2 "reg_or_cint_operand" ""))
7873 (clobber (match_scratch:DI 3 ""))]
7874 "TARGET_POWERPC64 && reload_completed"
7876 (rotate:DI (match_dup 1) (match_dup 2)))
7878 (compare:CC (match_dup 3)
7882 (define_insn "*rotldi3_internal3"
7883 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7884 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7885 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
7887 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7888 (rotate:DI (match_dup 1) (match_dup 2)))]
7895 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7896 (set_attr "length" "4,4,8,8")])
7899 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7900 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7901 (match_operand:DI 2 "reg_or_cint_operand" ""))
7903 (set (match_operand:DI 0 "gpc_reg_operand" "")
7904 (rotate:DI (match_dup 1) (match_dup 2)))]
7905 "TARGET_POWERPC64 && reload_completed"
7907 (rotate:DI (match_dup 1) (match_dup 2)))
7909 (compare:CC (match_dup 0)
7913 (define_insn "*rotldi3_internal4"
7914 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7915 (and:DI (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7916 (match_operand:DI 2 "reg_or_cint_operand" "r,i"))
7917 (match_operand:DI 3 "mask64_operand" "n,n")))]
7920 rldc%B3 %0,%1,%2,%S3
7921 rldic%B3 %0,%1,%H2,%S3"
7922 [(set_attr "type" "var_shift_rotate,integer")])
7924 (define_insn "*rotldi3_internal5"
7925 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7927 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7928 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
7929 (match_operand:DI 3 "mask64_operand" "n,n,n,n"))
7931 (clobber (match_scratch:DI 4 "=r,r,r,r"))]
7934 rldc%B3. %4,%1,%2,%S3
7935 rldic%B3. %4,%1,%H2,%S3
7938 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7939 (set_attr "length" "4,4,8,8")])
7942 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7944 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7945 (match_operand:DI 2 "reg_or_cint_operand" ""))
7946 (match_operand:DI 3 "mask64_operand" ""))
7948 (clobber (match_scratch:DI 4 ""))]
7949 "TARGET_POWERPC64 && reload_completed"
7951 (and:DI (rotate:DI (match_dup 1)
7955 (compare:CC (match_dup 4)
7959 (define_insn "*rotldi3_internal6"
7960 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
7962 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7963 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
7964 (match_operand:DI 3 "mask64_operand" "n,n,n,n"))
7966 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7967 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7970 rldc%B3. %0,%1,%2,%S3
7971 rldic%B3. %0,%1,%H2,%S3
7974 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7975 (set_attr "length" "4,4,8,8")])
7978 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
7980 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7981 (match_operand:DI 2 "reg_or_cint_operand" ""))
7982 (match_operand:DI 3 "mask64_operand" ""))
7984 (set (match_operand:DI 0 "gpc_reg_operand" "")
7985 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7986 "TARGET_POWERPC64 && reload_completed"
7988 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
7990 (compare:CC (match_dup 0)
7994 (define_insn "*rotldi3_internal7"
7995 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7998 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7999 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
8003 rldicl %0,%1,%H2,56"
8004 [(set_attr "type" "var_shift_rotate,integer")])
8006 (define_insn "*rotldi3_internal8"
8007 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
8008 (compare:CC (zero_extend:DI
8010 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8011 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
8013 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
8017 rldicl. %3,%1,%H2,56
8020 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8021 (set_attr "length" "4,4,8,8")])
8024 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8025 (compare:CC (zero_extend:DI
8027 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
8028 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
8030 (clobber (match_scratch:DI 3 ""))]
8031 "TARGET_POWERPC64 && reload_completed"
8033 (zero_extend:DI (subreg:QI
8034 (rotate:DI (match_dup 1)
8037 (compare:CC (match_dup 3)
8041 (define_insn "*rotldi3_internal9"
8042 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
8043 (compare:CC (zero_extend:DI
8045 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8046 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
8048 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
8049 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
8053 rldicl. %0,%1,%H2,56
8056 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8057 (set_attr "length" "4,4,8,8")])
8060 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8061 (compare:CC (zero_extend:DI
8063 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
8064 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
8066 (set (match_operand:DI 0 "gpc_reg_operand" "")
8067 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
8068 "TARGET_POWERPC64 && reload_completed"
8070 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
8072 (compare:CC (match_dup 0)
8076 (define_insn "*rotldi3_internal10"
8077 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8080 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
8081 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
8085 rldicl %0,%1,%H2,48"
8086 [(set_attr "type" "var_shift_rotate,integer")])
8088 (define_insn "*rotldi3_internal11"
8089 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
8090 (compare:CC (zero_extend:DI
8092 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8093 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
8095 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
8099 rldicl. %3,%1,%H2,48
8102 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8103 (set_attr "length" "4,4,8,8")])
8106 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8107 (compare:CC (zero_extend:DI
8109 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
8110 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
8112 (clobber (match_scratch:DI 3 ""))]
8113 "TARGET_POWERPC64 && reload_completed"
8115 (zero_extend:DI (subreg:HI
8116 (rotate:DI (match_dup 1)
8119 (compare:CC (match_dup 3)
8123 (define_insn "*rotldi3_internal12"
8124 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
8125 (compare:CC (zero_extend:DI
8127 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8128 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
8130 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
8131 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
8135 rldicl. %0,%1,%H2,48
8138 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8139 (set_attr "length" "4,4,8,8")])
8142 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8143 (compare:CC (zero_extend:DI
8145 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
8146 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
8148 (set (match_operand:DI 0 "gpc_reg_operand" "")
8149 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
8150 "TARGET_POWERPC64 && reload_completed"
8152 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
8154 (compare:CC (match_dup 0)
8158 (define_insn "*rotldi3_internal13"
8159 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8162 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
8163 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
8167 rldicl %0,%1,%H2,32"
8168 [(set_attr "type" "var_shift_rotate,integer")])
8170 (define_insn "*rotldi3_internal14"
8171 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
8172 (compare:CC (zero_extend:DI
8174 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8175 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
8177 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
8181 rldicl. %3,%1,%H2,32
8184 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8185 (set_attr "length" "4,4,8,8")])
8188 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8189 (compare:CC (zero_extend:DI
8191 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
8192 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
8194 (clobber (match_scratch:DI 3 ""))]
8195 "TARGET_POWERPC64 && reload_completed"
8197 (zero_extend:DI (subreg:SI
8198 (rotate:DI (match_dup 1)
8201 (compare:CC (match_dup 3)
8205 (define_insn "*rotldi3_internal15"
8206 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
8207 (compare:CC (zero_extend:DI
8209 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8210 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
8212 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
8213 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
8217 rldicl. %0,%1,%H2,32
8220 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8221 (set_attr "length" "4,4,8,8")])
8224 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8225 (compare:CC (zero_extend:DI
8227 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
8228 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
8230 (set (match_operand:DI 0 "gpc_reg_operand" "")
8231 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
8232 "TARGET_POWERPC64 && reload_completed"
8234 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
8236 (compare:CC (match_dup 0)
8240 (define_expand "ashldi3"
8241 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8242 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
8243 (match_operand:SI 2 "reg_or_cint_operand" "")))]
8244 "TARGET_POWERPC64 || TARGET_POWER"
8247 if (TARGET_POWERPC64)
8249 else if (TARGET_POWER)
8251 emit_insn (gen_ashldi3_power (operands[0], operands[1], operands[2]));
8258 (define_insn "*ashldi3_internal1"
8259 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8260 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
8261 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
8266 [(set_attr "type" "var_shift_rotate,shift")])
8268 (define_insn "*ashldi3_internal2"
8269 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
8270 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8271 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
8273 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
8280 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8281 (set_attr "length" "4,4,8,8")])
8284 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
8285 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
8286 (match_operand:SI 2 "reg_or_cint_operand" ""))
8288 (clobber (match_scratch:DI 3 ""))]
8289 "TARGET_POWERPC64 && reload_completed"
8291 (ashift:DI (match_dup 1) (match_dup 2)))
8293 (compare:CC (match_dup 3)
8297 (define_insn "*ashldi3_internal3"
8298 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
8299 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8300 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
8302 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
8303 (ashift:DI (match_dup 1) (match_dup 2)))]
8310 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8311 (set_attr "length" "4,4,8,8")])
8314 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
8315 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
8316 (match_operand:SI 2 "reg_or_cint_operand" ""))
8318 (set (match_operand:DI 0 "gpc_reg_operand" "")
8319 (ashift:DI (match_dup 1) (match_dup 2)))]
8320 "TARGET_POWERPC64 && reload_completed"
8322 (ashift:DI (match_dup 1) (match_dup 2)))
8324 (compare:CC (match_dup 0)
8328 (define_insn "*ashldi3_internal4"
8329 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
8330 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
8331 (match_operand:SI 2 "const_int_operand" "i"))
8332 (match_operand:DI 3 "const_int_operand" "n")))]
8333 "TARGET_POWERPC64 && includes_rldic_lshift_p (operands[2], operands[3])"
8334 "rldic %0,%1,%H2,%W3")
8336 (define_insn "ashldi3_internal5"
8337 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
8339 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
8340 (match_operand:SI 2 "const_int_operand" "i,i"))
8341 (match_operand:DI 3 "const_int_operand" "n,n"))
8343 (clobber (match_scratch:DI 4 "=r,r"))]
8344 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
8346 rldic. %4,%1,%H2,%W3
8348 [(set_attr "type" "compare")
8349 (set_attr "length" "4,8")])
8352 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8354 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
8355 (match_operand:SI 2 "const_int_operand" ""))
8356 (match_operand:DI 3 "const_int_operand" ""))
8358 (clobber (match_scratch:DI 4 ""))]
8359 "TARGET_POWERPC64 && reload_completed
8360 && includes_rldic_lshift_p (operands[2], operands[3])"
8362 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
8365 (compare:CC (match_dup 4)
8369 (define_insn "*ashldi3_internal6"
8370 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
8372 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
8373 (match_operand:SI 2 "const_int_operand" "i,i"))
8374 (match_operand:DI 3 "const_int_operand" "n,n"))
8376 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8377 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
8378 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
8380 rldic. %0,%1,%H2,%W3
8382 [(set_attr "type" "compare")
8383 (set_attr "length" "4,8")])
8386 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
8388 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
8389 (match_operand:SI 2 "const_int_operand" ""))
8390 (match_operand:DI 3 "const_int_operand" ""))
8392 (set (match_operand:DI 0 "gpc_reg_operand" "")
8393 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
8394 "TARGET_POWERPC64 && reload_completed
8395 && includes_rldic_lshift_p (operands[2], operands[3])"
8397 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
8400 (compare:CC (match_dup 0)
8404 (define_insn "*ashldi3_internal7"
8405 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
8406 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
8407 (match_operand:SI 2 "const_int_operand" "i"))
8408 (match_operand:DI 3 "mask64_operand" "n")))]
8409 "TARGET_POWERPC64 && includes_rldicr_lshift_p (operands[2], operands[3])"
8410 "rldicr %0,%1,%H2,%S3")
8412 (define_insn "ashldi3_internal8"
8413 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
8415 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
8416 (match_operand:SI 2 "const_int_operand" "i,i"))
8417 (match_operand:DI 3 "mask64_operand" "n,n"))
8419 (clobber (match_scratch:DI 4 "=r,r"))]
8420 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
8422 rldicr. %4,%1,%H2,%S3
8424 [(set_attr "type" "compare")
8425 (set_attr "length" "4,8")])
8428 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8430 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
8431 (match_operand:SI 2 "const_int_operand" ""))
8432 (match_operand:DI 3 "mask64_operand" ""))
8434 (clobber (match_scratch:DI 4 ""))]
8435 "TARGET_POWERPC64 && reload_completed
8436 && includes_rldicr_lshift_p (operands[2], operands[3])"
8438 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
8441 (compare:CC (match_dup 4)
8445 (define_insn "*ashldi3_internal9"
8446 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
8448 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
8449 (match_operand:SI 2 "const_int_operand" "i,i"))
8450 (match_operand:DI 3 "mask64_operand" "n,n"))
8452 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8453 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
8454 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
8456 rldicr. %0,%1,%H2,%S3
8458 [(set_attr "type" "compare")
8459 (set_attr "length" "4,8")])
8462 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
8464 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
8465 (match_operand:SI 2 "const_int_operand" ""))
8466 (match_operand:DI 3 "mask64_operand" ""))
8468 (set (match_operand:DI 0 "gpc_reg_operand" "")
8469 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
8470 "TARGET_POWERPC64 && reload_completed
8471 && includes_rldicr_lshift_p (operands[2], operands[3])"
8473 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
8476 (compare:CC (match_dup 0)
8480 (define_expand "lshrdi3"
8481 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8482 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
8483 (match_operand:SI 2 "reg_or_cint_operand" "")))]
8484 "TARGET_POWERPC64 || TARGET_POWER"
8487 if (TARGET_POWERPC64)
8489 else if (TARGET_POWER)
8491 emit_insn (gen_lshrdi3_power (operands[0], operands[1], operands[2]));
8498 (define_insn "*lshrdi3_internal1"
8499 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8500 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
8501 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
8506 [(set_attr "type" "var_shift_rotate,shift")])
8508 (define_insn "*lshrdi3_internal2"
8509 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
8510 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8511 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
8513 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
8520 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8521 (set_attr "length" "4,4,8,8")])
8524 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8525 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
8526 (match_operand:SI 2 "reg_or_cint_operand" ""))
8528 (clobber (match_scratch:DI 3 ""))]
8529 "TARGET_POWERPC64 && reload_completed"
8531 (lshiftrt:DI (match_dup 1) (match_dup 2)))
8533 (compare:CC (match_dup 3)
8537 (define_insn "*lshrdi3_internal3"
8538 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
8539 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8540 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
8542 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
8543 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
8550 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8551 (set_attr "length" "4,4,8,8")])
8554 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8555 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
8556 (match_operand:SI 2 "reg_or_cint_operand" ""))
8558 (set (match_operand:DI 0 "gpc_reg_operand" "")
8559 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
8560 "TARGET_POWERPC64 && reload_completed"
8562 (lshiftrt:DI (match_dup 1) (match_dup 2)))
8564 (compare:CC (match_dup 0)
8568 (define_expand "ashrdi3"
8569 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8570 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
8571 (match_operand:SI 2 "reg_or_cint_operand" "")))]
8575 if (TARGET_POWERPC64)
8577 else if (TARGET_POWER && GET_CODE (operands[2]) == CONST_INT)
8579 emit_insn (gen_ashrdi3_power (operands[0], operands[1], operands[2]));
8582 else if (TARGET_32BIT && GET_CODE (operands[2]) == CONST_INT
8583 && WORDS_BIG_ENDIAN)
8585 emit_insn (gen_ashrdi3_no_power (operands[0], operands[1], operands[2]));
8592 (define_insn "*ashrdi3_internal1"
8593 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8594 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
8595 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
8600 [(set_attr "type" "var_shift_rotate,shift")])
8602 (define_insn "*ashrdi3_internal2"
8603 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
8604 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8605 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
8607 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
8614 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8615 (set_attr "length" "4,4,8,8")])
8618 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
8619 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
8620 (match_operand:SI 2 "reg_or_cint_operand" ""))
8622 (clobber (match_scratch:DI 3 ""))]
8623 "TARGET_POWERPC64 && reload_completed"
8625 (ashiftrt:DI (match_dup 1) (match_dup 2)))
8627 (compare:CC (match_dup 3)
8631 (define_insn "*ashrdi3_internal3"
8632 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
8633 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8634 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
8636 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
8637 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
8644 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8645 (set_attr "length" "4,4,8,8")])
8648 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
8649 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
8650 (match_operand:SI 2 "reg_or_cint_operand" ""))
8652 (set (match_operand:DI 0 "gpc_reg_operand" "")
8653 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
8654 "TARGET_POWERPC64 && reload_completed"
8656 (ashiftrt:DI (match_dup 1) (match_dup 2)))
8658 (compare:CC (match_dup 0)
8662 (define_expand "anddi3"
8664 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8665 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8666 (match_operand:DI 2 "and64_2_operand" "")))
8667 (clobber (match_scratch:CC 3 ""))])]
8671 (define_insn "anddi3_mc"
8672 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
8673 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r")
8674 (match_operand:DI 2 "and64_2_operand" "?r,S,T,K,J,t")))
8675 (clobber (match_scratch:CC 3 "=X,X,X,x,x,X"))]
8676 "TARGET_POWERPC64 && rs6000_gen_cell_microcode"
8679 rldic%B2 %0,%1,0,%S2
8680 rlwinm %0,%1,0,%m2,%M2
8684 [(set_attr "type" "*,*,*,fast_compare,fast_compare,*")
8685 (set_attr "length" "4,4,4,4,4,8")])
8687 (define_insn "anddi3_nomc"
8688 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
8689 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r")
8690 (match_operand:DI 2 "and64_2_operand" "?r,S,T,t")))
8691 (clobber (match_scratch:CC 3 "=X,X,X,X"))]
8692 "TARGET_POWERPC64 && !rs6000_gen_cell_microcode"
8695 rldic%B2 %0,%1,0,%S2
8696 rlwinm %0,%1,0,%m2,%M2
8698 [(set_attr "length" "4,4,4,8")])
8701 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8702 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8703 (match_operand:DI 2 "mask64_2_operand" "")))
8704 (clobber (match_scratch:CC 3 ""))]
8706 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
8707 && !mask_operand (operands[2], DImode)
8708 && !mask64_operand (operands[2], DImode)"
8710 (and:DI (rotate:DI (match_dup 1)
8714 (and:DI (rotate:DI (match_dup 0)
8718 build_mask64_2_operands (operands[2], &operands[4]);
8721 (define_insn "*anddi3_internal2_mc"
8722 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,x,?y,?y,?y,??y,??y,?y")
8723 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r,r,r")
8724 (match_operand:DI 2 "and64_2_operand" "r,S,T,K,J,t,r,S,T,K,J,t"))
8726 (clobber (match_scratch:DI 3 "=r,r,r,r,r,r,r,r,r,r,r,r"))
8727 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,X,X,x,x,X"))]
8728 "TARGET_64BIT && rs6000_gen_cell_microcode"
8731 rldic%B2. %3,%1,0,%S2
8732 rlwinm. %3,%1,0,%m2,%M2
8742 [(set_attr "type" "fast_compare,compare,delayed_compare,fast_compare,\
8743 fast_compare,compare,compare,compare,compare,compare,\
8745 (set_attr "length" "4,4,4,4,4,8,8,8,8,8,8,12")])
8748 [(set (match_operand:CC 0 "cc_reg_operand" "")
8749 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8750 (match_operand:DI 2 "mask64_2_operand" ""))
8752 (clobber (match_scratch:DI 3 ""))
8753 (clobber (match_scratch:CC 4 ""))]
8754 "TARGET_64BIT && reload_completed
8755 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
8756 && !mask_operand (operands[2], DImode)
8757 && !mask64_operand (operands[2], DImode)"
8759 (and:DI (rotate:DI (match_dup 1)
8762 (parallel [(set (match_dup 0)
8763 (compare:CC (and:DI (rotate:DI (match_dup 3)
8767 (clobber (match_dup 3))])]
8770 build_mask64_2_operands (operands[2], &operands[5]);
8773 (define_insn "*anddi3_internal3_mc"
8774 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,x,x,?y,?y,?y,??y,??y,?y")
8775 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r,r,r")
8776 (match_operand:DI 2 "and64_2_operand" "r,S,T,K,J,t,r,S,T,K,J,t"))
8778 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r,r,r")
8779 (and:DI (match_dup 1) (match_dup 2)))
8780 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,X,X,x,x,X"))]
8781 "TARGET_64BIT && rs6000_gen_cell_microcode"
8784 rldic%B2. %0,%1,0,%S2
8785 rlwinm. %0,%1,0,%m2,%M2
8795 [(set_attr "type" "fast_compare,compare,delayed_compare,fast_compare,\
8796 fast_compare,compare,compare,compare,compare,compare,\
8798 (set_attr "length" "4,4,4,4,4,8,8,8,8,8,8,12")])
8801 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8802 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8803 (match_operand:DI 2 "and64_2_operand" ""))
8805 (set (match_operand:DI 0 "gpc_reg_operand" "")
8806 (and:DI (match_dup 1) (match_dup 2)))
8807 (clobber (match_scratch:CC 4 ""))]
8808 "TARGET_64BIT && reload_completed"
8809 [(parallel [(set (match_dup 0)
8810 (and:DI (match_dup 1) (match_dup 2)))
8811 (clobber (match_dup 4))])
8813 (compare:CC (match_dup 0)
8818 [(set (match_operand:CC 3 "cc_reg_operand" "")
8819 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8820 (match_operand:DI 2 "mask64_2_operand" ""))
8822 (set (match_operand:DI 0 "gpc_reg_operand" "")
8823 (and:DI (match_dup 1) (match_dup 2)))
8824 (clobber (match_scratch:CC 4 ""))]
8825 "TARGET_64BIT && reload_completed
8826 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
8827 && !mask_operand (operands[2], DImode)
8828 && !mask64_operand (operands[2], DImode)"
8830 (and:DI (rotate:DI (match_dup 1)
8833 (parallel [(set (match_dup 3)
8834 (compare:CC (and:DI (rotate:DI (match_dup 0)
8839 (and:DI (rotate:DI (match_dup 0)
8844 build_mask64_2_operands (operands[2], &operands[5]);
8847 (define_expand "iordi3"
8848 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8849 (ior:DI (match_operand:DI 1 "gpc_reg_operand" "")
8850 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
8854 if (non_logical_cint_operand (operands[2], DImode))
8856 HOST_WIDE_INT value;
8857 rtx tmp = ((!can_create_pseudo_p ()
8858 || rtx_equal_p (operands[0], operands[1]))
8859 ? operands[0] : gen_reg_rtx (DImode));
8861 if (GET_CODE (operands[2]) == CONST_INT)
8863 value = INTVAL (operands[2]);
8864 emit_insn (gen_iordi3 (tmp, operands[1],
8865 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
8869 value = CONST_DOUBLE_LOW (operands[2]);
8870 emit_insn (gen_iordi3 (tmp, operands[1],
8871 immed_double_const (value
8872 & (~ (HOST_WIDE_INT) 0xffff),
8876 emit_insn (gen_iordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
8881 (define_expand "xordi3"
8882 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8883 (xor:DI (match_operand:DI 1 "gpc_reg_operand" "")
8884 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
8888 if (non_logical_cint_operand (operands[2], DImode))
8890 HOST_WIDE_INT value;
8891 rtx tmp = ((!can_create_pseudo_p ()
8892 || rtx_equal_p (operands[0], operands[1]))
8893 ? operands[0] : gen_reg_rtx (DImode));
8895 if (GET_CODE (operands[2]) == CONST_INT)
8897 value = INTVAL (operands[2]);
8898 emit_insn (gen_xordi3 (tmp, operands[1],
8899 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
8903 value = CONST_DOUBLE_LOW (operands[2]);
8904 emit_insn (gen_xordi3 (tmp, operands[1],
8905 immed_double_const (value
8906 & (~ (HOST_WIDE_INT) 0xffff),
8910 emit_insn (gen_xordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
8915 (define_insn "*booldi3_internal1"
8916 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
8917 (match_operator:DI 3 "boolean_or_operator"
8918 [(match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
8919 (match_operand:DI 2 "logical_operand" "r,K,JF")]))]
8926 (define_insn "*booldi3_internal2"
8927 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
8928 (compare:CC (match_operator:DI 4 "boolean_or_operator"
8929 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
8930 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
8932 (clobber (match_scratch:DI 3 "=r,r"))]
8937 [(set_attr "type" "fast_compare,compare")
8938 (set_attr "length" "4,8")])
8941 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8942 (compare:CC (match_operator:DI 4 "boolean_operator"
8943 [(match_operand:DI 1 "gpc_reg_operand" "")
8944 (match_operand:DI 2 "gpc_reg_operand" "")])
8946 (clobber (match_scratch:DI 3 ""))]
8947 "TARGET_POWERPC64 && reload_completed"
8948 [(set (match_dup 3) (match_dup 4))
8950 (compare:CC (match_dup 3)
8954 (define_insn "*booldi3_internal3"
8955 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
8956 (compare:CC (match_operator:DI 4 "boolean_or_operator"
8957 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
8958 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
8960 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8966 [(set_attr "type" "fast_compare,compare")
8967 (set_attr "length" "4,8")])
8970 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8971 (compare:CC (match_operator:DI 4 "boolean_operator"
8972 [(match_operand:DI 1 "gpc_reg_operand" "")
8973 (match_operand:DI 2 "gpc_reg_operand" "")])
8975 (set (match_operand:DI 0 "gpc_reg_operand" "")
8977 "TARGET_POWERPC64 && reload_completed"
8978 [(set (match_dup 0) (match_dup 4))
8980 (compare:CC (match_dup 0)
8984 ;; Split a logical operation that we can't do in one insn into two insns,
8985 ;; each of which does one 16-bit part. This is used by combine.
8988 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8989 (match_operator:DI 3 "boolean_or_operator"
8990 [(match_operand:DI 1 "gpc_reg_operand" "")
8991 (match_operand:DI 2 "non_logical_cint_operand" "")]))]
8993 [(set (match_dup 0) (match_dup 4))
8994 (set (match_dup 0) (match_dup 5))]
8999 if (GET_CODE (operands[2]) == CONST_DOUBLE)
9001 HOST_WIDE_INT value = CONST_DOUBLE_LOW (operands[2]);
9002 i3 = immed_double_const (value & (~ (HOST_WIDE_INT) 0xffff),
9004 i4 = GEN_INT (value & 0xffff);
9008 i3 = GEN_INT (INTVAL (operands[2])
9009 & (~ (HOST_WIDE_INT) 0xffff));
9010 i4 = GEN_INT (INTVAL (operands[2]) & 0xffff);
9012 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
9014 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
9018 (define_insn "*boolcdi3_internal1"
9019 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9020 (match_operator:DI 3 "boolean_operator"
9021 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
9022 (match_operand:DI 2 "gpc_reg_operand" "r")]))]
9026 (define_insn "*boolcdi3_internal2"
9027 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
9028 (compare:CC (match_operator:DI 4 "boolean_operator"
9029 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
9030 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
9032 (clobber (match_scratch:DI 3 "=r,r"))]
9037 [(set_attr "type" "fast_compare,compare")
9038 (set_attr "length" "4,8")])
9041 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
9042 (compare:CC (match_operator:DI 4 "boolean_operator"
9043 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
9044 (match_operand:DI 2 "gpc_reg_operand" "")])
9046 (clobber (match_scratch:DI 3 ""))]
9047 "TARGET_POWERPC64 && reload_completed"
9048 [(set (match_dup 3) (match_dup 4))
9050 (compare:CC (match_dup 3)
9054 (define_insn "*boolcdi3_internal3"
9055 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
9056 (compare:CC (match_operator:DI 4 "boolean_operator"
9057 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
9058 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
9060 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
9066 [(set_attr "type" "fast_compare,compare")
9067 (set_attr "length" "4,8")])
9070 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
9071 (compare:CC (match_operator:DI 4 "boolean_operator"
9072 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
9073 (match_operand:DI 2 "gpc_reg_operand" "")])
9075 (set (match_operand:DI 0 "gpc_reg_operand" "")
9077 "TARGET_POWERPC64 && reload_completed"
9078 [(set (match_dup 0) (match_dup 4))
9080 (compare:CC (match_dup 0)
9084 (define_insn "*boolccdi3_internal1"
9085 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9086 (match_operator:DI 3 "boolean_operator"
9087 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
9088 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r"))]))]
9092 (define_insn "*boolccdi3_internal2"
9093 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
9094 (compare:CC (match_operator:DI 4 "boolean_operator"
9095 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
9096 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
9098 (clobber (match_scratch:DI 3 "=r,r"))]
9103 [(set_attr "type" "fast_compare,compare")
9104 (set_attr "length" "4,8")])
9107 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
9108 (compare:CC (match_operator:DI 4 "boolean_operator"
9109 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
9110 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
9112 (clobber (match_scratch:DI 3 ""))]
9113 "TARGET_POWERPC64 && reload_completed"
9114 [(set (match_dup 3) (match_dup 4))
9116 (compare:CC (match_dup 3)
9120 (define_insn "*boolccdi3_internal3"
9121 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
9122 (compare:CC (match_operator:DI 4 "boolean_operator"
9123 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
9124 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
9126 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
9132 [(set_attr "type" "fast_compare,compare")
9133 (set_attr "length" "4,8")])
9136 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
9137 (compare:CC (match_operator:DI 4 "boolean_operator"
9138 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
9139 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
9141 (set (match_operand:DI 0 "gpc_reg_operand" "")
9143 "TARGET_POWERPC64 && reload_completed"
9144 [(set (match_dup 0) (match_dup 4))
9146 (compare:CC (match_dup 0)
9150 (define_expand "smindi3"
9151 [(match_operand:DI 0 "gpc_reg_operand" "")
9152 (match_operand:DI 1 "gpc_reg_operand" "")
9153 (match_operand:DI 2 "gpc_reg_operand" "")]
9157 rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]);
9161 (define_expand "smaxdi3"
9162 [(match_operand:DI 0 "gpc_reg_operand" "")
9163 (match_operand:DI 1 "gpc_reg_operand" "")
9164 (match_operand:DI 2 "gpc_reg_operand" "")]
9168 rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]);
9172 (define_expand "umindi3"
9173 [(match_operand:DI 0 "gpc_reg_operand" "")
9174 (match_operand:DI 1 "gpc_reg_operand" "")
9175 (match_operand:DI 2 "gpc_reg_operand" "")]
9179 rs6000_emit_minmax (operands[0], UMIN, operands[1], operands[2]);
9183 (define_expand "umaxdi3"
9184 [(match_operand:DI 0 "gpc_reg_operand" "")
9185 (match_operand:DI 1 "gpc_reg_operand" "")
9186 (match_operand:DI 2 "gpc_reg_operand" "")]
9190 rs6000_emit_minmax (operands[0], UMAX, operands[1], operands[2]);
9195 ;; Now define ways of moving data around.
9197 ;; Set up a register with a value from the GOT table
9199 (define_expand "movsi_got"
9200 [(set (match_operand:SI 0 "gpc_reg_operand" "")
9201 (unspec:SI [(match_operand:SI 1 "got_operand" "")
9202 (match_dup 2)] UNSPEC_MOVSI_GOT))]
9203 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
9206 if (GET_CODE (operands[1]) == CONST)
9208 rtx offset = const0_rtx;
9209 HOST_WIDE_INT value;
9211 operands[1] = eliminate_constant_term (XEXP (operands[1], 0), &offset);
9212 value = INTVAL (offset);
9215 rtx tmp = (!can_create_pseudo_p ()
9217 : gen_reg_rtx (Pmode));
9218 emit_insn (gen_movsi_got (tmp, operands[1]));
9219 emit_insn (gen_addsi3 (operands[0], tmp, offset));
9224 operands[2] = rs6000_got_register (operands[1]);
9227 (define_insn "*movsi_got_internal"
9228 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9229 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
9230 (match_operand:SI 2 "gpc_reg_operand" "b")]
9232 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
9233 "{l|lwz} %0,%a1@got(%2)"
9234 [(set_attr "type" "load")])
9236 ;; Used by sched, shorten_branches and final when the GOT pseudo reg
9237 ;; didn't get allocated to a hard register.
9239 [(set (match_operand:SI 0 "gpc_reg_operand" "")
9240 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
9241 (match_operand:SI 2 "memory_operand" "")]
9243 "DEFAULT_ABI == ABI_V4
9245 && (reload_in_progress || reload_completed)"
9246 [(set (match_dup 0) (match_dup 2))
9247 (set (match_dup 0) (unspec:SI [(match_dup 1)(match_dup 0)]
9251 ;; For SI, we special-case integers that can't be loaded in one insn. We
9252 ;; do the load 16-bits at a time. We could do this by loading from memory,
9253 ;; and this is even supposed to be faster, but it is simpler not to get
9254 ;; integers in the TOC.
9255 (define_insn "movsi_low"
9256 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9257 (mem:SI (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
9258 (match_operand 2 "" ""))))]
9259 "TARGET_MACHO && ! TARGET_64BIT"
9260 "{l|lwz} %0,lo16(%2)(%1)"
9261 [(set_attr "type" "load")
9262 (set_attr "length" "4")])
9264 (define_insn "*movsi_internal1"
9265 [(set (match_operand:SI 0 "rs6000_nonimmediate_operand" "=r,r,r,m,r,r,r,r,r,*q,*c*l,*h,*h")
9266 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,R,*h,r,r,r,0"))]
9267 "!TARGET_SINGLE_FPU &&
9268 (gpc_reg_operand (operands[0], SImode) || gpc_reg_operand (operands[1], SImode))"
9272 {l%U1%X1|lwz%U1%X1} %0,%1
9273 {st%U0%X0|stw%U0%X0} %1,%0
9283 [(set_attr "type" "*,*,load,store,*,*,*,*,mfjmpr,*,mtjmpr,*,*")
9284 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4,4,4")])
9286 (define_insn "*movsi_internal1_single"
9287 [(set (match_operand:SI 0 "rs6000_nonimmediate_operand" "=r,r,r,m,r,r,r,r,r,*q,*c*l,*h,*h,m,*f")
9288 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,R,*h,r,r,r,0,f,m"))]
9289 "TARGET_SINGLE_FPU &&
9290 (gpc_reg_operand (operands[0], SImode) || gpc_reg_operand (operands[1], SImode))"
9294 {l%U1%X1|lwz%U1%X1} %0,%1
9295 {st%U0%X0|stw%U0%X0} %1,%0
9307 [(set_attr "type" "*,*,load,store,*,*,*,*,mfjmpr,*,mtjmpr,*,*,*,*")
9308 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4,4,4,4,4")])
9310 ;; Split a load of a large constant into the appropriate two-insn
9314 [(set (match_operand:SI 0 "gpc_reg_operand" "")
9315 (match_operand:SI 1 "const_int_operand" ""))]
9316 "(unsigned HOST_WIDE_INT) (INTVAL (operands[1]) + 0x8000) >= 0x10000
9317 && (INTVAL (operands[1]) & 0xffff) != 0"
9321 (ior:SI (match_dup 0)
9324 { rtx tem = rs6000_emit_set_const (operands[0], SImode, operands[1], 2);
9326 if (tem == operands[0])
9332 (define_insn "*mov<mode>_internal2"
9333 [(set (match_operand:CC 2 "cc_reg_operand" "=y,x,?y")
9334 (compare:CC (match_operand:P 1 "gpc_reg_operand" "0,r,r")
9336 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r") (match_dup 1))]
9339 {cmpi|cmp<wd>i} %2,%0,0
9342 [(set_attr "type" "cmp,compare,cmp")
9343 (set_attr "length" "4,4,8")])
9346 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
9347 (compare:CC (match_operand:P 1 "gpc_reg_operand" "")
9349 (set (match_operand:P 0 "gpc_reg_operand" "") (match_dup 1))]
9351 [(set (match_dup 0) (match_dup 1))
9353 (compare:CC (match_dup 0)
9357 (define_insn "*movhi_internal"
9358 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
9359 (match_operand:HI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
9360 "gpc_reg_operand (operands[0], HImode)
9361 || gpc_reg_operand (operands[1], HImode)"
9371 [(set_attr "type" "*,load,store,*,mfjmpr,*,mtjmpr,*")])
9373 (define_expand "mov<mode>"
9374 [(set (match_operand:INT 0 "general_operand" "")
9375 (match_operand:INT 1 "any_operand" ""))]
9377 "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
9379 (define_insn "*movqi_internal"
9380 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
9381 (match_operand:QI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
9382 "gpc_reg_operand (operands[0], QImode)
9383 || gpc_reg_operand (operands[1], QImode)"
9393 [(set_attr "type" "*,load,store,*,mfjmpr,*,mtjmpr,*")])
9395 ;; Here is how to move condition codes around. When we store CC data in
9396 ;; an integer register or memory, we store just the high-order 4 bits.
9397 ;; This lets us not shift in the most common case of CR0.
9398 (define_expand "movcc"
9399 [(set (match_operand:CC 0 "nonimmediate_operand" "")
9400 (match_operand:CC 1 "nonimmediate_operand" ""))]
9404 (define_insn "*movcc_internal1"
9405 [(set (match_operand:CC 0 "nonimmediate_operand" "=y,x,?y,y,r,r,r,r,r,q,cl,r,m")
9406 (match_operand:CC 1 "general_operand" "y,r,r,O,x,y,r,I,h,r,r,m,r"))]
9407 "register_operand (operands[0], CCmode)
9408 || register_operand (operands[1], CCmode)"
9412 {rlinm|rlwinm} %1,%1,%F0,0xffffffff\;mtcrf %R0,%1\;{rlinm|rlwinm} %1,%1,%f0,0xffffffff
9415 mfcr %0%Q1\;{rlinm|rlwinm} %0,%0,%f1,0xf0000000
9421 {l%U1%X1|lwz%U1%X1} %0,%1
9422 {st%U0%U1|stw%U0%U1} %1,%0"
9424 (cond [(eq_attr "alternative" "0,3")
9425 (const_string "cr_logical")
9426 (eq_attr "alternative" "1,2")
9427 (const_string "mtcr")
9428 (eq_attr "alternative" "6,7,9")
9429 (const_string "integer")
9430 (eq_attr "alternative" "8")
9431 (const_string "mfjmpr")
9432 (eq_attr "alternative" "10")
9433 (const_string "mtjmpr")
9434 (eq_attr "alternative" "11")
9435 (const_string "load")
9436 (eq_attr "alternative" "12")
9437 (const_string "store")
9438 (match_test "TARGET_MFCRF")
9439 (const_string "mfcrf")
9441 (const_string "mfcr")))
9442 (set_attr "length" "4,4,12,4,4,8,4,4,4,4,4,4,4")])
9444 ;; For floating-point, we normally deal with the floating-point registers
9445 ;; unless -msoft-float is used. The sole exception is that parameter passing
9446 ;; can produce floating-point values in fixed-point registers. Unless the
9447 ;; value is a simple constant or already in memory, we deal with this by
9448 ;; allocating memory and copying the value explicitly via that memory location.
9449 (define_expand "movsf"
9450 [(set (match_operand:SF 0 "nonimmediate_operand" "")
9451 (match_operand:SF 1 "any_operand" ""))]
9453 "{ rs6000_emit_move (operands[0], operands[1], SFmode); DONE; }")
9456 [(set (match_operand:SF 0 "gpc_reg_operand" "")
9457 (match_operand:SF 1 "const_double_operand" ""))]
9459 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
9460 || (GET_CODE (operands[0]) == SUBREG
9461 && GET_CODE (SUBREG_REG (operands[0])) == REG
9462 && REGNO (SUBREG_REG (operands[0])) <= 31))"
9463 [(set (match_dup 2) (match_dup 3))]
9469 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
9470 REAL_VALUE_TO_TARGET_SINGLE (rv, l);
9472 if (! TARGET_POWERPC64)
9473 operands[2] = operand_subword (operands[0], 0, 0, SFmode);
9475 operands[2] = gen_lowpart (SImode, operands[0]);
9477 operands[3] = gen_int_mode (l, SImode);
9480 (define_insn "*movsf_hardfloat"
9481 [(set (match_operand:SF 0 "nonimmediate_operand" "=!r,!r,m,f,f,m,*c*l,*q,!r,*h,!r,!r")
9482 (match_operand:SF 1 "input_operand" "r,m,r,f,m,f,r,r,h,0,G,Fn"))]
9483 "(gpc_reg_operand (operands[0], SFmode)
9484 || gpc_reg_operand (operands[1], SFmode))
9485 && (TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT)"
9488 {l%U1%X1|lwz%U1%X1} %0,%1
9489 {st%U0%X0|stw%U0%X0} %1,%0
9499 [(set_attr "type" "*,load,store,fp,fpload,fpstore,mtjmpr,*,mfjmpr,*,*,*")
9500 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,8")])
9502 (define_insn "*movsf_softfloat"
9503 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,cl,q,r,r,m,r,r,r,r,r,*h")
9504 (match_operand:SF 1 "input_operand" "r,r,r,h,m,r,I,L,R,G,Fn,0"))]
9505 "(gpc_reg_operand (operands[0], SFmode)
9506 || gpc_reg_operand (operands[1], SFmode))
9507 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)"
9513 {l%U1%X1|lwz%U1%X1} %0,%1
9514 {st%U0%X0|stw%U0%X0} %1,%0
9521 [(set_attr "type" "*,mtjmpr,*,mfjmpr,load,store,*,*,*,*,*,*")
9522 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,8,4")])
9525 (define_expand "movdf"
9526 [(set (match_operand:DF 0 "nonimmediate_operand" "")
9527 (match_operand:DF 1 "any_operand" ""))]
9529 "{ rs6000_emit_move (operands[0], operands[1], DFmode); DONE; }")
9532 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9533 (match_operand:DF 1 "const_int_operand" ""))]
9534 "! TARGET_POWERPC64 && reload_completed
9535 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
9536 || (GET_CODE (operands[0]) == SUBREG
9537 && GET_CODE (SUBREG_REG (operands[0])) == REG
9538 && REGNO (SUBREG_REG (operands[0])) <= 31))"
9539 [(set (match_dup 2) (match_dup 4))
9540 (set (match_dup 3) (match_dup 1))]
9543 int endian = (WORDS_BIG_ENDIAN == 0);
9544 HOST_WIDE_INT value = INTVAL (operands[1]);
9546 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
9547 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
9548 #if HOST_BITS_PER_WIDE_INT == 32
9549 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
9551 operands[4] = GEN_INT (value >> 32);
9552 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
9557 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9558 (match_operand:DF 1 "const_double_operand" ""))]
9559 "! TARGET_POWERPC64 && reload_completed
9560 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
9561 || (GET_CODE (operands[0]) == SUBREG
9562 && GET_CODE (SUBREG_REG (operands[0])) == REG
9563 && REGNO (SUBREG_REG (operands[0])) <= 31))"
9564 [(set (match_dup 2) (match_dup 4))
9565 (set (match_dup 3) (match_dup 5))]
9568 int endian = (WORDS_BIG_ENDIAN == 0);
9572 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
9573 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
9575 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
9576 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
9577 operands[4] = gen_int_mode (l[endian], SImode);
9578 operands[5] = gen_int_mode (l[1 - endian], SImode);
9582 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9583 (match_operand:DF 1 "const_double_operand" ""))]
9584 "TARGET_POWERPC64 && reload_completed
9585 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
9586 || (GET_CODE (operands[0]) == SUBREG
9587 && GET_CODE (SUBREG_REG (operands[0])) == REG
9588 && REGNO (SUBREG_REG (operands[0])) <= 31))"
9589 [(set (match_dup 2) (match_dup 3))]
9592 int endian = (WORDS_BIG_ENDIAN == 0);
9595 #if HOST_BITS_PER_WIDE_INT >= 64
9599 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
9600 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
9602 operands[2] = gen_lowpart (DImode, operands[0]);
9603 /* HIGHPART is lower memory address when WORDS_BIG_ENDIAN. */
9604 #if HOST_BITS_PER_WIDE_INT >= 64
9605 val = ((HOST_WIDE_INT)(unsigned long)l[endian] << 32
9606 | ((HOST_WIDE_INT)(unsigned long)l[1 - endian]));
9608 operands[3] = gen_int_mode (val, DImode);
9610 operands[3] = immed_double_const (l[1 - endian], l[endian], DImode);
9614 ;; Don't have reload use general registers to load a constant. First,
9615 ;; it might not work if the output operand is the equivalent of
9616 ;; a non-offsettable memref, but also it is less efficient than loading
9617 ;; the constant into an FP register, since it will probably be used there.
9618 ;; The "??" is a kludge until we can figure out a more reasonable way
9619 ;; of handling these non-offsettable values.
9620 (define_insn "*movdf_hardfloat32"
9621 [(set (match_operand:DF 0 "nonimmediate_operand" "=!r,??r,m,ws,?wa,ws,?wa,Z,?Z,d,d,m,wa,!r,!r,!r")
9622 (match_operand:DF 1 "input_operand" "r,m,r,ws,wa,Z,Z,ws,wa,d,m,d,j,G,H,F"))]
9623 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9624 && (gpc_reg_operand (operands[0], DFmode)
9625 || gpc_reg_operand (operands[1], DFmode))"
9628 switch (which_alternative)
9638 return \"xxlor %x0,%x1,%x1\";
9641 return \"lxsd%U1x %x0,%y1\";
9644 return \"stxsd%U0x %x1,%y0\";
9646 return \"fmr %0,%1\";
9648 return \"lfd%U1%X1 %0,%1\";
9650 return \"stfd%U0%X0 %1,%0\";
9652 return \"xxlxor %x0,%x0,%x0\";
9659 [(set_attr "type" "two,load,store,fp,fp,fpload,fpload,fpstore,fpstore,fp,fpload,fpstore,vecsimple,*,*,*")
9660 (set_attr "length" "8,16,16,4,4,4,4,4,4,4,4,4,4,8,12,16")])
9662 (define_insn "*movdf_softfloat32"
9663 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,m,r,r,r")
9664 (match_operand:DF 1 "input_operand" "r,m,r,G,H,F"))]
9666 && ((TARGET_FPRS && TARGET_SINGLE_FLOAT)
9667 || TARGET_SOFT_FLOAT || TARGET_E500_SINGLE)
9668 && (gpc_reg_operand (operands[0], DFmode)
9669 || gpc_reg_operand (operands[1], DFmode))"
9671 [(set_attr "type" "two,load,store,*,*,*")
9672 (set_attr "length" "8,8,8,8,12,16")])
9674 ;; Reload patterns to support gpr load/store with misaligned mem.
9675 (define_expand "reload_di_store"
9676 [(parallel [(match_operand 0 "memory_operand" "=m")
9677 (match_operand 1 "gpc_reg_operand" "r")
9678 (match_operand:DI 2 "register_operand" "=&b")])]
9681 rs6000_secondary_reload_ppc64 (operands[1], operands[0], operands[2], true);
9685 (define_expand "reload_di_load"
9686 [(parallel [(match_operand 0 "gpc_reg_operand" "=r")
9687 (match_operand 1 "memory_operand" "m")
9688 (match_operand:DI 2 "register_operand" "=b")])]
9691 rs6000_secondary_reload_ppc64 (operands[0], operands[1], operands[2], false);
9695 ; ld/std require word-aligned displacements -> 'Y' constraint.
9696 ; List Y->r and r->Y before r->r for reload.
9697 (define_insn "*movdf_hardfloat64_mfpgpr"
9698 [(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")
9699 (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"))]
9700 "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
9701 && TARGET_DOUBLE_FLOAT
9702 && (gpc_reg_operand (operands[0], DFmode)
9703 || gpc_reg_operand (operands[1], DFmode))"
9726 [(set_attr "type" "store,load,*,fp,fp,fpload,fpload,fpstore,fpstore,fp,fpload,fpstore,vecsimple,mtjmpr,mfjmpr,*,*,*,*,mftgpr,mffgpr")
9727 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,8,12,16,4,4")])
9729 ; ld/std require word-aligned displacements -> 'Y' constraint.
9730 ; List Y->r and r->Y before r->r for reload.
9731 (define_insn "*movdf_hardfloat64"
9732 [(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")
9733 (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"))]
9734 "TARGET_POWERPC64 && !TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
9735 && TARGET_DOUBLE_FLOAT
9736 && (gpc_reg_operand (operands[0], DFmode)
9737 || gpc_reg_operand (operands[1], DFmode))"
9758 [(set_attr "type" "store,load,*,fp,fp,fpload,fpload,fpstore,fpstore,fp,fpload,fpstore,vecsimple,mtjmpr,mfjmpr,*,*,*,*")
9759 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,8,12,16")])
9761 (define_insn "*movdf_softfloat64"
9762 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,Y,r,cl,r,r,r,r,*h")
9763 (match_operand:DF 1 "input_operand" "Y,r,r,r,h,G,H,F,0"))]
9764 "TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)
9765 && (gpc_reg_operand (operands[0], DFmode)
9766 || gpc_reg_operand (operands[1], DFmode))"
9777 [(set_attr "type" "load,store,*,mtjmpr,mfjmpr,*,*,*,*")
9778 (set_attr "length" "4,4,4,4,4,8,12,16,4")])
9780 (define_expand "movtf"
9781 [(set (match_operand:TF 0 "general_operand" "")
9782 (match_operand:TF 1 "any_operand" ""))]
9783 "!TARGET_IEEEQUAD && TARGET_LONG_DOUBLE_128"
9784 "{ rs6000_emit_move (operands[0], operands[1], TFmode); DONE; }")
9786 ; It's important to list the o->f and f->o moves before f->f because
9787 ; otherwise reload, given m->f, will try to pick f->f and reload it,
9788 ; which doesn't make progress. Likewise r->Y must be before r->r.
9789 (define_insn_and_split "*movtf_internal"
9790 [(set (match_operand:TF 0 "nonimmediate_operand" "=o,d,d,r,Y,r")
9791 (match_operand:TF 1 "input_operand" "d,o,d,YGHF,r,r"))]
9793 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128
9794 && (gpc_reg_operand (operands[0], TFmode)
9795 || gpc_reg_operand (operands[1], TFmode))"
9797 "&& reload_completed"
9799 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
9800 [(set_attr "length" "8,8,8,20,20,16")])
9802 (define_insn_and_split "*movtf_softfloat"
9803 [(set (match_operand:TF 0 "rs6000_nonimmediate_operand" "=r,Y,r")
9804 (match_operand:TF 1 "input_operand" "YGHF,r,r"))]
9806 && (TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_LONG_DOUBLE_128
9807 && (gpc_reg_operand (operands[0], TFmode)
9808 || gpc_reg_operand (operands[1], TFmode))"
9810 "&& reload_completed"
9812 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
9813 [(set_attr "length" "20,20,16")])
9815 (define_expand "extenddftf2"
9816 [(set (match_operand:TF 0 "nonimmediate_operand" "")
9817 (float_extend:TF (match_operand:DF 1 "input_operand" "")))]
9819 && TARGET_HARD_FLOAT
9820 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9821 && TARGET_LONG_DOUBLE_128"
9823 if (TARGET_E500_DOUBLE)
9824 emit_insn (gen_spe_extenddftf2 (operands[0], operands[1]));
9826 emit_insn (gen_extenddftf2_fprs (operands[0], operands[1]));
9830 (define_expand "extenddftf2_fprs"
9831 [(parallel [(set (match_operand:TF 0 "nonimmediate_operand" "")
9832 (float_extend:TF (match_operand:DF 1 "input_operand" "")))
9833 (use (match_dup 2))])]
9835 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9836 && TARGET_LONG_DOUBLE_128"
9838 operands[2] = CONST0_RTX (DFmode);
9839 /* Generate GOT reference early for SVR4 PIC. */
9840 if (DEFAULT_ABI == ABI_V4 && flag_pic)
9841 operands[2] = validize_mem (force_const_mem (DFmode, operands[2]));
9844 (define_insn_and_split "*extenddftf2_internal"
9845 [(set (match_operand:TF 0 "nonimmediate_operand" "=o,d,&d,r")
9846 (float_extend:TF (match_operand:DF 1 "input_operand" "dr,md,md,rmGHF")))
9847 (use (match_operand:DF 2 "zero_reg_mem_operand" "rd,m,d,n"))]
9849 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9850 && TARGET_LONG_DOUBLE_128"
9852 "&& reload_completed"
9855 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
9856 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
9857 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word),
9859 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word),
9864 (define_expand "extendsftf2"
9865 [(set (match_operand:TF 0 "nonimmediate_operand" "")
9866 (float_extend:TF (match_operand:SF 1 "gpc_reg_operand" "")))]
9868 && TARGET_HARD_FLOAT
9869 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9870 && TARGET_LONG_DOUBLE_128"
9872 rtx tmp = gen_reg_rtx (DFmode);
9873 emit_insn (gen_extendsfdf2 (tmp, operands[1]));
9874 emit_insn (gen_extenddftf2 (operands[0], tmp));
9878 (define_expand "trunctfdf2"
9879 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9880 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "")))]
9882 && TARGET_HARD_FLOAT
9883 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9884 && TARGET_LONG_DOUBLE_128"
9887 (define_insn_and_split "trunctfdf2_internal1"
9888 [(set (match_operand:DF 0 "gpc_reg_operand" "=d,?d")
9889 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "0,d")))]
9890 "!TARGET_IEEEQUAD && !TARGET_XL_COMPAT
9891 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9895 "&& reload_completed && REGNO (operands[0]) == REGNO (operands[1])"
9898 emit_note (NOTE_INSN_DELETED);
9901 [(set_attr "type" "fp")])
9903 (define_insn "trunctfdf2_internal2"
9904 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
9905 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "d")))]
9906 "!TARGET_IEEEQUAD && TARGET_XL_COMPAT
9907 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9908 && TARGET_LONG_DOUBLE_128"
9910 [(set_attr "type" "fp")
9911 (set_attr "fp_type" "fp_addsub_d")])
9913 (define_expand "trunctfsf2"
9914 [(set (match_operand:SF 0 "gpc_reg_operand" "")
9915 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "")))]
9917 && TARGET_HARD_FLOAT
9918 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9919 && TARGET_LONG_DOUBLE_128"
9921 if (TARGET_E500_DOUBLE)
9922 emit_insn (gen_spe_trunctfsf2 (operands[0], operands[1]));
9924 emit_insn (gen_trunctfsf2_fprs (operands[0], operands[1]));
9928 (define_insn_and_split "trunctfsf2_fprs"
9929 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
9930 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "d")))
9931 (clobber (match_scratch:DF 2 "=d"))]
9933 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
9934 && TARGET_LONG_DOUBLE_128"
9936 "&& reload_completed"
9938 (float_truncate:DF (match_dup 1)))
9940 (float_truncate:SF (match_dup 2)))]
9943 (define_expand "floatsitf2"
9944 [(set (match_operand:TF 0 "gpc_reg_operand" "")
9945 (float:TF (match_operand:SI 1 "gpc_reg_operand" "")))]
9947 && TARGET_HARD_FLOAT
9948 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9949 && TARGET_LONG_DOUBLE_128"
9951 rtx tmp = gen_reg_rtx (DFmode);
9952 expand_float (tmp, operands[1], false);
9953 emit_insn (gen_extenddftf2 (operands[0], tmp));
9957 ; fadd, but rounding towards zero.
9958 ; This is probably not the optimal code sequence.
9959 (define_insn "fix_trunc_helper"
9960 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
9961 (unspec:DF [(match_operand:TF 1 "gpc_reg_operand" "d")]
9962 UNSPEC_FIX_TRUNC_TF))
9963 (clobber (match_operand:DF 2 "gpc_reg_operand" "=&d"))]
9964 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
9965 "mffs %2\n\tmtfsb1 31\n\tmtfsb0 30\n\tfadd %0,%1,%L1\n\tmtfsf 1,%2"
9966 [(set_attr "type" "fp")
9967 (set_attr "length" "20")])
9969 (define_expand "fix_trunctfsi2"
9970 [(set (match_operand:SI 0 "gpc_reg_operand" "")
9971 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))]
9973 && (TARGET_POWER2 || TARGET_POWERPC)
9974 && TARGET_HARD_FLOAT
9975 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9976 && TARGET_LONG_DOUBLE_128"
9978 if (TARGET_E500_DOUBLE)
9979 emit_insn (gen_spe_fix_trunctfsi2 (operands[0], operands[1]));
9981 emit_insn (gen_fix_trunctfsi2_fprs (operands[0], operands[1]));
9985 (define_expand "fix_trunctfsi2_fprs"
9986 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
9987 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))
9988 (clobber (match_dup 2))
9989 (clobber (match_dup 3))
9990 (clobber (match_dup 4))
9991 (clobber (match_dup 5))])]
9993 && (TARGET_POWER2 || TARGET_POWERPC)
9994 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9996 operands[2] = gen_reg_rtx (DFmode);
9997 operands[3] = gen_reg_rtx (DFmode);
9998 operands[4] = gen_reg_rtx (DImode);
9999 operands[5] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
10002 (define_insn_and_split "*fix_trunctfsi2_internal"
10003 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10004 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "d")))
10005 (clobber (match_operand:DF 2 "gpc_reg_operand" "=d"))
10006 (clobber (match_operand:DF 3 "gpc_reg_operand" "=&d"))
10007 (clobber (match_operand:DI 4 "gpc_reg_operand" "=d"))
10008 (clobber (match_operand:DI 5 "offsettable_mem_operand" "=o"))]
10010 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
10016 emit_insn (gen_fix_trunc_helper (operands[2], operands[1], operands[3]));
10018 gcc_assert (MEM_P (operands[5]));
10019 lowword = adjust_address (operands[5], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
10021 emit_insn (gen_fctiwz_df (operands[4], operands[2]));
10022 emit_move_insn (operands[5], operands[4]);
10023 emit_move_insn (operands[0], lowword);
10027 (define_expand "negtf2"
10028 [(set (match_operand:TF 0 "gpc_reg_operand" "")
10029 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "")))]
10031 && TARGET_HARD_FLOAT
10032 && (TARGET_FPRS || TARGET_E500_DOUBLE)
10033 && TARGET_LONG_DOUBLE_128"
10036 (define_insn "negtf2_internal"
10037 [(set (match_operand:TF 0 "gpc_reg_operand" "=d")
10038 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "d")))]
10040 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
10043 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
10044 return \"fneg %L0,%L1\;fneg %0,%1\";
10046 return \"fneg %0,%1\;fneg %L0,%L1\";
10048 [(set_attr "type" "fp")
10049 (set_attr "length" "8")])
10051 (define_expand "abstf2"
10052 [(set (match_operand:TF 0 "gpc_reg_operand" "")
10053 (abs:TF (match_operand:TF 1 "gpc_reg_operand" "")))]
10055 && TARGET_HARD_FLOAT
10056 && (TARGET_FPRS || TARGET_E500_DOUBLE)
10057 && TARGET_LONG_DOUBLE_128"
10060 rtx label = gen_label_rtx ();
10061 if (TARGET_E500_DOUBLE)
10063 if (flag_finite_math_only && !flag_trapping_math)
10064 emit_insn (gen_spe_abstf2_tst (operands[0], operands[1], label));
10066 emit_insn (gen_spe_abstf2_cmp (operands[0], operands[1], label));
10069 emit_insn (gen_abstf2_internal (operands[0], operands[1], label));
10070 emit_label (label);
10074 (define_expand "abstf2_internal"
10075 [(set (match_operand:TF 0 "gpc_reg_operand" "")
10076 (match_operand:TF 1 "gpc_reg_operand" ""))
10077 (set (match_dup 3) (match_dup 5))
10078 (set (match_dup 5) (abs:DF (match_dup 5)))
10079 (set (match_dup 4) (compare:CCFP (match_dup 3) (match_dup 5)))
10080 (set (pc) (if_then_else (eq (match_dup 4) (const_int 0))
10081 (label_ref (match_operand 2 "" ""))
10083 (set (match_dup 6) (neg:DF (match_dup 6)))]
10085 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
10086 && TARGET_LONG_DOUBLE_128"
10089 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
10090 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
10091 operands[3] = gen_reg_rtx (DFmode);
10092 operands[4] = gen_reg_rtx (CCFPmode);
10093 operands[5] = simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word);
10094 operands[6] = simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word);
10097 ;; Next come the multi-word integer load and store and the load and store
10100 ; List r->r after r->"o<>", otherwise reload will try to reload a
10101 ; non-offsettable address by using r->r which won't make progress.
10102 (define_insn "*movdi_internal32"
10103 [(set (match_operand:DI 0 "rs6000_nonimmediate_operand" "=o<>,r,r,*d,*d,m,r,?wa")
10104 (match_operand:DI 1 "input_operand" "r,r,m,d,m,d,IJKnGHF,O"))]
10105 "! TARGET_POWERPC64
10106 && (gpc_reg_operand (operands[0], DImode)
10107 || gpc_reg_operand (operands[1], DImode))"
10116 xxlxor %x0,%x0,%x0"
10117 [(set_attr "type" "load,*,store,fp,fpload,fpstore,*,vecsimple")])
10120 [(set (match_operand:DI 0 "gpc_reg_operand" "")
10121 (match_operand:DI 1 "const_int_operand" ""))]
10122 "! TARGET_POWERPC64 && reload_completed
10123 && gpr_or_gpr_p (operands[0], operands[1])"
10124 [(set (match_dup 2) (match_dup 4))
10125 (set (match_dup 3) (match_dup 1))]
10128 HOST_WIDE_INT value = INTVAL (operands[1]);
10129 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
10131 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
10133 #if HOST_BITS_PER_WIDE_INT == 32
10134 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
10136 operands[4] = GEN_INT (value >> 32);
10137 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
10142 [(set (match_operand:DIFD 0 "rs6000_nonimmediate_operand" "")
10143 (match_operand:DIFD 1 "input_operand" ""))]
10144 "reload_completed && !TARGET_POWERPC64
10145 && gpr_or_gpr_p (operands[0], operands[1])"
10147 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
10149 (define_insn "*movdi_mfpgpr"
10150 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,*d,*d,m,r,*h,*h,r,*d")
10151 (match_operand:DI 1 "input_operand" "r,m,r,I,L,nF,R,d,m,d,*h,r,0,*d,r"))]
10152 "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
10153 && (gpc_reg_operand (operands[0], DImode)
10154 || gpc_reg_operand (operands[1], DImode))"
10171 [(set_attr "type" "*,load,store,*,*,*,*,fp,fpload,fpstore,mfjmpr,mtjmpr,*,mftgpr,mffgpr")
10172 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4,4,4")])
10174 (define_insn "*movdi_internal64"
10175 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,*d,*d,m,r,*h,*h,?wa")
10176 (match_operand:DI 1 "input_operand" "r,m,r,I,L,nF,R,d,m,d,*h,r,0,O"))]
10177 "TARGET_POWERPC64 && (!TARGET_MFPGPR || !TARGET_HARD_FLOAT || !TARGET_FPRS)
10178 && (gpc_reg_operand (operands[0], DImode)
10179 || gpc_reg_operand (operands[1], DImode))"
10194 xxlxor %x0,%x0,%x0"
10195 [(set_attr "type" "*,load,store,*,*,*,*,fp,fpload,fpstore,mfjmpr,mtjmpr,*,vecsimple")
10196 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4,4")])
10198 ;; immediate value valid for a single instruction hiding in a const_double
10200 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10201 (match_operand:DI 1 "const_double_operand" "F"))]
10202 "HOST_BITS_PER_WIDE_INT == 32 && TARGET_POWERPC64
10203 && GET_CODE (operands[1]) == CONST_DOUBLE
10204 && num_insns_constant (operands[1], DImode) == 1"
10207 return ((unsigned HOST_WIDE_INT)
10208 (CONST_DOUBLE_LOW (operands[1]) + 0x8000) < 0x10000)
10209 ? \"li %0,%1\" : \"lis %0,%v1\";
10212 ;; Generate all one-bits and clear left or right.
10213 ;; Use (and:DI (rotate:DI ...)) to avoid anddi3 unnecessary clobber.
10215 [(set (match_operand:DI 0 "gpc_reg_operand" "")
10216 (match_operand:DI 1 "mask64_operand" ""))]
10217 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
10218 [(set (match_dup 0) (const_int -1))
10220 (and:DI (rotate:DI (match_dup 0)
10225 ;; Split a load of a large constant into the appropriate five-instruction
10226 ;; sequence. Handle anything in a constant number of insns.
10227 ;; When non-easy constants can go in the TOC, this should use
10228 ;; easy_fp_constant predicate.
10230 [(set (match_operand:DI 0 "gpc_reg_operand" "")
10231 (match_operand:DI 1 "const_int_operand" ""))]
10232 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
10233 [(set (match_dup 0) (match_dup 2))
10234 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
10236 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
10238 if (tem == operands[0])
10245 [(set (match_operand:DI 0 "gpc_reg_operand" "")
10246 (match_operand:DI 1 "const_double_operand" ""))]
10247 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
10248 [(set (match_dup 0) (match_dup 2))
10249 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
10251 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
10253 if (tem == operands[0])
10259 ;; TImode is similar, except that we usually want to compute the address into
10260 ;; a register and use lsi/stsi (the exception is during reload). MQ is also
10261 ;; clobbered in stsi for POWER, so we need a SCRATCH for it.
10263 ;; We say that MQ is clobbered in the last alternative because the first
10264 ;; alternative would never get used otherwise since it would need a reload
10265 ;; while the 2nd alternative would not. We put memory cases first so they
10266 ;; are preferred. Otherwise, we'd try to reload the output instead of
10267 ;; giving the SCRATCH mq.
10269 (define_insn "*movti_power"
10270 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,m,????r,????r,????r,r")
10271 (match_operand:TI 1 "input_operand" "r,r,r,Q,m,n"))
10272 (clobber (match_scratch:SI 2 "=q,q#X,X,X,X,X"))]
10273 "TARGET_POWER && ! TARGET_POWERPC64
10274 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
10277 switch (which_alternative)
10280 gcc_unreachable ();
10284 return \"{stsi|stswi} %1,%P0,16\";
10289 /* If the address is not used in the output, we can use lsi. Otherwise,
10290 fall through to generating four loads. */
10292 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
10293 return \"{lsi|lswi} %0,%P1,16\";
10294 /* ... fall through ... */
10300 [(set_attr "type" "store,store,*,load,load,*")])
10302 (define_insn "*movti_string"
10303 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,o<>,????r,????r,????r,r")
10304 (match_operand:TI 1 "input_operand" "r,r,r,Q,m,n"))]
10305 "! TARGET_POWER && ! TARGET_POWERPC64
10306 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
10309 switch (which_alternative)
10312 gcc_unreachable ();
10315 return \"{stsi|stswi} %1,%P0,16\";
10320 /* If the address is not used in the output, we can use lsi. Otherwise,
10321 fall through to generating four loads. */
10323 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
10324 return \"{lsi|lswi} %0,%P1,16\";
10325 /* ... fall through ... */
10331 [(set_attr "type" "store_ux,store_ux,*,load_ux,load_ux,*")
10332 (set (attr "cell_micro") (if_then_else (match_test "TARGET_STRING")
10333 (const_string "always")
10334 (const_string "conditional")))])
10336 (define_insn "*movti_ppc64"
10337 [(set (match_operand:TI 0 "nonimmediate_operand" "=r,o<>,r")
10338 (match_operand:TI 1 "input_operand" "r,r,m"))]
10339 "(TARGET_POWERPC64 && (gpc_reg_operand (operands[0], TImode)
10340 || gpc_reg_operand (operands[1], TImode)))
10341 && VECTOR_MEM_NONE_P (TImode)"
10343 [(set_attr "type" "*,store,load")])
10346 [(set (match_operand:TI 0 "gpc_reg_operand" "")
10347 (match_operand:TI 1 "const_double_operand" ""))]
10348 "TARGET_POWERPC64 && VECTOR_MEM_NONE_P (TImode)"
10349 [(set (match_dup 2) (match_dup 4))
10350 (set (match_dup 3) (match_dup 5))]
10353 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
10355 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
10357 if (GET_CODE (operands[1]) == CONST_DOUBLE)
10359 operands[4] = GEN_INT (CONST_DOUBLE_HIGH (operands[1]));
10360 operands[5] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
10362 else if (GET_CODE (operands[1]) == CONST_INT)
10364 operands[4] = GEN_INT (- (INTVAL (operands[1]) < 0));
10365 operands[5] = operands[1];
10372 [(set (match_operand:TI 0 "nonimmediate_operand" "")
10373 (match_operand:TI 1 "input_operand" ""))]
10374 "reload_completed && VECTOR_MEM_NONE_P (TImode)
10375 && gpr_or_gpr_p (operands[0], operands[1])"
10377 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
10379 (define_expand "load_multiple"
10380 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
10381 (match_operand:SI 1 "" ""))
10382 (use (match_operand:SI 2 "" ""))])]
10383 "TARGET_STRING && !TARGET_POWERPC64"
10391 /* Support only loading a constant number of fixed-point registers from
10392 memory and only bother with this if more than two; the machine
10393 doesn't support more than eight. */
10394 if (GET_CODE (operands[2]) != CONST_INT
10395 || INTVAL (operands[2]) <= 2
10396 || INTVAL (operands[2]) > 8
10397 || GET_CODE (operands[1]) != MEM
10398 || GET_CODE (operands[0]) != REG
10399 || REGNO (operands[0]) >= 32)
10402 count = INTVAL (operands[2]);
10403 regno = REGNO (operands[0]);
10405 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
10406 op1 = replace_equiv_address (operands[1],
10407 force_reg (SImode, XEXP (operands[1], 0)));
10409 for (i = 0; i < count; i++)
10410 XVECEXP (operands[3], 0, i)
10411 = gen_rtx_SET (VOIDmode, gen_rtx_REG (SImode, regno + i),
10412 adjust_address_nv (op1, SImode, i * 4));
10415 (define_insn "*ldmsi8"
10416 [(match_parallel 0 "load_multiple_operation"
10417 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10418 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10419 (set (match_operand:SI 3 "gpc_reg_operand" "")
10420 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10421 (set (match_operand:SI 4 "gpc_reg_operand" "")
10422 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
10423 (set (match_operand:SI 5 "gpc_reg_operand" "")
10424 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
10425 (set (match_operand:SI 6 "gpc_reg_operand" "")
10426 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
10427 (set (match_operand:SI 7 "gpc_reg_operand" "")
10428 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
10429 (set (match_operand:SI 8 "gpc_reg_operand" "")
10430 (mem:SI (plus:SI (match_dup 1) (const_int 24))))
10431 (set (match_operand:SI 9 "gpc_reg_operand" "")
10432 (mem:SI (plus:SI (match_dup 1) (const_int 28))))])]
10433 "TARGET_STRING && XVECLEN (operands[0], 0) == 8"
10435 { return rs6000_output_load_multiple (operands); }"
10436 [(set_attr "type" "load_ux")
10437 (set_attr "length" "32")])
10439 (define_insn "*ldmsi7"
10440 [(match_parallel 0 "load_multiple_operation"
10441 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10442 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10443 (set (match_operand:SI 3 "gpc_reg_operand" "")
10444 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10445 (set (match_operand:SI 4 "gpc_reg_operand" "")
10446 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
10447 (set (match_operand:SI 5 "gpc_reg_operand" "")
10448 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
10449 (set (match_operand:SI 6 "gpc_reg_operand" "")
10450 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
10451 (set (match_operand:SI 7 "gpc_reg_operand" "")
10452 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
10453 (set (match_operand:SI 8 "gpc_reg_operand" "")
10454 (mem:SI (plus:SI (match_dup 1) (const_int 24))))])]
10455 "TARGET_STRING && XVECLEN (operands[0], 0) == 7"
10457 { return rs6000_output_load_multiple (operands); }"
10458 [(set_attr "type" "load_ux")
10459 (set_attr "length" "32")])
10461 (define_insn "*ldmsi6"
10462 [(match_parallel 0 "load_multiple_operation"
10463 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10464 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10465 (set (match_operand:SI 3 "gpc_reg_operand" "")
10466 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10467 (set (match_operand:SI 4 "gpc_reg_operand" "")
10468 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
10469 (set (match_operand:SI 5 "gpc_reg_operand" "")
10470 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
10471 (set (match_operand:SI 6 "gpc_reg_operand" "")
10472 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
10473 (set (match_operand:SI 7 "gpc_reg_operand" "")
10474 (mem:SI (plus:SI (match_dup 1) (const_int 20))))])]
10475 "TARGET_STRING && XVECLEN (operands[0], 0) == 6"
10477 { return rs6000_output_load_multiple (operands); }"
10478 [(set_attr "type" "load_ux")
10479 (set_attr "length" "32")])
10481 (define_insn "*ldmsi5"
10482 [(match_parallel 0 "load_multiple_operation"
10483 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10484 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10485 (set (match_operand:SI 3 "gpc_reg_operand" "")
10486 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10487 (set (match_operand:SI 4 "gpc_reg_operand" "")
10488 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
10489 (set (match_operand:SI 5 "gpc_reg_operand" "")
10490 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
10491 (set (match_operand:SI 6 "gpc_reg_operand" "")
10492 (mem:SI (plus:SI (match_dup 1) (const_int 16))))])]
10493 "TARGET_STRING && XVECLEN (operands[0], 0) == 5"
10495 { return rs6000_output_load_multiple (operands); }"
10496 [(set_attr "type" "load_ux")
10497 (set_attr "length" "32")])
10499 (define_insn "*ldmsi4"
10500 [(match_parallel 0 "load_multiple_operation"
10501 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10502 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10503 (set (match_operand:SI 3 "gpc_reg_operand" "")
10504 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10505 (set (match_operand:SI 4 "gpc_reg_operand" "")
10506 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
10507 (set (match_operand:SI 5 "gpc_reg_operand" "")
10508 (mem:SI (plus:SI (match_dup 1) (const_int 12))))])]
10509 "TARGET_STRING && XVECLEN (operands[0], 0) == 4"
10511 { return rs6000_output_load_multiple (operands); }"
10512 [(set_attr "type" "load_ux")
10513 (set_attr "length" "32")])
10515 (define_insn "*ldmsi3"
10516 [(match_parallel 0 "load_multiple_operation"
10517 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10518 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10519 (set (match_operand:SI 3 "gpc_reg_operand" "")
10520 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10521 (set (match_operand:SI 4 "gpc_reg_operand" "")
10522 (mem:SI (plus:SI (match_dup 1) (const_int 8))))])]
10523 "TARGET_STRING && XVECLEN (operands[0], 0) == 3"
10525 { return rs6000_output_load_multiple (operands); }"
10526 [(set_attr "type" "load_ux")
10527 (set_attr "length" "32")])
10529 (define_expand "store_multiple"
10530 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
10531 (match_operand:SI 1 "" ""))
10532 (clobber (scratch:SI))
10533 (use (match_operand:SI 2 "" ""))])]
10534 "TARGET_STRING && !TARGET_POWERPC64"
10543 /* Support only storing a constant number of fixed-point registers to
10544 memory and only bother with this if more than two; the machine
10545 doesn't support more than eight. */
10546 if (GET_CODE (operands[2]) != CONST_INT
10547 || INTVAL (operands[2]) <= 2
10548 || INTVAL (operands[2]) > 8
10549 || GET_CODE (operands[0]) != MEM
10550 || GET_CODE (operands[1]) != REG
10551 || REGNO (operands[1]) >= 32)
10554 count = INTVAL (operands[2]);
10555 regno = REGNO (operands[1]);
10557 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count + 1));
10558 to = force_reg (SImode, XEXP (operands[0], 0));
10559 op0 = replace_equiv_address (operands[0], to);
10561 XVECEXP (operands[3], 0, 0)
10562 = gen_rtx_SET (VOIDmode, adjust_address_nv (op0, SImode, 0), operands[1]);
10563 XVECEXP (operands[3], 0, 1) = gen_rtx_CLOBBER (VOIDmode,
10564 gen_rtx_SCRATCH (SImode));
10566 for (i = 1; i < count; i++)
10567 XVECEXP (operands[3], 0, i + 1)
10568 = gen_rtx_SET (VOIDmode,
10569 adjust_address_nv (op0, SImode, i * 4),
10570 gen_rtx_REG (SImode, regno + i));
10573 (define_insn "*stmsi8"
10574 [(match_parallel 0 "store_multiple_operation"
10575 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10576 (match_operand:SI 2 "gpc_reg_operand" "r"))
10577 (clobber (match_scratch:SI 3 "=X"))
10578 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10579 (match_operand:SI 4 "gpc_reg_operand" "r"))
10580 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10581 (match_operand:SI 5 "gpc_reg_operand" "r"))
10582 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10583 (match_operand:SI 6 "gpc_reg_operand" "r"))
10584 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10585 (match_operand:SI 7 "gpc_reg_operand" "r"))
10586 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10587 (match_operand:SI 8 "gpc_reg_operand" "r"))
10588 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
10589 (match_operand:SI 9 "gpc_reg_operand" "r"))
10590 (set (mem:SI (plus:SI (match_dup 1) (const_int 28)))
10591 (match_operand:SI 10 "gpc_reg_operand" "r"))])]
10592 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 9"
10593 "{stsi|stswi} %2,%1,%O0"
10594 [(set_attr "type" "store_ux")
10595 (set_attr "cell_micro" "always")])
10597 (define_insn "*stmsi7"
10598 [(match_parallel 0 "store_multiple_operation"
10599 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10600 (match_operand:SI 2 "gpc_reg_operand" "r"))
10601 (clobber (match_scratch:SI 3 "=X"))
10602 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10603 (match_operand:SI 4 "gpc_reg_operand" "r"))
10604 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10605 (match_operand:SI 5 "gpc_reg_operand" "r"))
10606 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10607 (match_operand:SI 6 "gpc_reg_operand" "r"))
10608 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10609 (match_operand:SI 7 "gpc_reg_operand" "r"))
10610 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10611 (match_operand:SI 8 "gpc_reg_operand" "r"))
10612 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
10613 (match_operand:SI 9 "gpc_reg_operand" "r"))])]
10614 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 8"
10615 "{stsi|stswi} %2,%1,%O0"
10616 [(set_attr "type" "store_ux")
10617 (set_attr "cell_micro" "always")])
10619 (define_insn "*stmsi6"
10620 [(match_parallel 0 "store_multiple_operation"
10621 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10622 (match_operand:SI 2 "gpc_reg_operand" "r"))
10623 (clobber (match_scratch:SI 3 "=X"))
10624 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10625 (match_operand:SI 4 "gpc_reg_operand" "r"))
10626 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10627 (match_operand:SI 5 "gpc_reg_operand" "r"))
10628 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10629 (match_operand:SI 6 "gpc_reg_operand" "r"))
10630 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10631 (match_operand:SI 7 "gpc_reg_operand" "r"))
10632 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10633 (match_operand:SI 8 "gpc_reg_operand" "r"))])]
10634 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 7"
10635 "{stsi|stswi} %2,%1,%O0"
10636 [(set_attr "type" "store_ux")
10637 (set_attr "cell_micro" "always")])
10639 (define_insn "*stmsi5"
10640 [(match_parallel 0 "store_multiple_operation"
10641 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10642 (match_operand:SI 2 "gpc_reg_operand" "r"))
10643 (clobber (match_scratch:SI 3 "=X"))
10644 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10645 (match_operand:SI 4 "gpc_reg_operand" "r"))
10646 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10647 (match_operand:SI 5 "gpc_reg_operand" "r"))
10648 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10649 (match_operand:SI 6 "gpc_reg_operand" "r"))
10650 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10651 (match_operand:SI 7 "gpc_reg_operand" "r"))])]
10652 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 6"
10653 "{stsi|stswi} %2,%1,%O0"
10654 [(set_attr "type" "store_ux")
10655 (set_attr "cell_micro" "always")])
10657 (define_insn "*stmsi4"
10658 [(match_parallel 0 "store_multiple_operation"
10659 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10660 (match_operand:SI 2 "gpc_reg_operand" "r"))
10661 (clobber (match_scratch:SI 3 "=X"))
10662 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10663 (match_operand:SI 4 "gpc_reg_operand" "r"))
10664 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10665 (match_operand:SI 5 "gpc_reg_operand" "r"))
10666 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10667 (match_operand:SI 6 "gpc_reg_operand" "r"))])]
10668 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 5"
10669 "{stsi|stswi} %2,%1,%O0"
10670 [(set_attr "type" "store_ux")
10671 (set_attr "cell_micro" "always")])
10673 (define_insn "*stmsi3"
10674 [(match_parallel 0 "store_multiple_operation"
10675 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10676 (match_operand:SI 2 "gpc_reg_operand" "r"))
10677 (clobber (match_scratch:SI 3 "=X"))
10678 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10679 (match_operand:SI 4 "gpc_reg_operand" "r"))
10680 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10681 (match_operand:SI 5 "gpc_reg_operand" "r"))])]
10682 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 4"
10683 "{stsi|stswi} %2,%1,%O0"
10684 [(set_attr "type" "store_ux")
10685 (set_attr "cell_micro" "always")])
10687 (define_insn "*stmsi8_power"
10688 [(match_parallel 0 "store_multiple_operation"
10689 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10690 (match_operand:SI 2 "gpc_reg_operand" "r"))
10691 (clobber (match_scratch:SI 3 "=q"))
10692 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10693 (match_operand:SI 4 "gpc_reg_operand" "r"))
10694 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10695 (match_operand:SI 5 "gpc_reg_operand" "r"))
10696 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10697 (match_operand:SI 6 "gpc_reg_operand" "r"))
10698 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10699 (match_operand:SI 7 "gpc_reg_operand" "r"))
10700 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10701 (match_operand:SI 8 "gpc_reg_operand" "r"))
10702 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
10703 (match_operand:SI 9 "gpc_reg_operand" "r"))
10704 (set (mem:SI (plus:SI (match_dup 1) (const_int 28)))
10705 (match_operand:SI 10 "gpc_reg_operand" "r"))])]
10706 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 9"
10707 "{stsi|stswi} %2,%1,%O0"
10708 [(set_attr "type" "store_ux")
10709 (set_attr "cell_micro" "always")])
10711 (define_insn "*stmsi7_power"
10712 [(match_parallel 0 "store_multiple_operation"
10713 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10714 (match_operand:SI 2 "gpc_reg_operand" "r"))
10715 (clobber (match_scratch:SI 3 "=q"))
10716 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10717 (match_operand:SI 4 "gpc_reg_operand" "r"))
10718 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10719 (match_operand:SI 5 "gpc_reg_operand" "r"))
10720 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10721 (match_operand:SI 6 "gpc_reg_operand" "r"))
10722 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10723 (match_operand:SI 7 "gpc_reg_operand" "r"))
10724 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10725 (match_operand:SI 8 "gpc_reg_operand" "r"))
10726 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
10727 (match_operand:SI 9 "gpc_reg_operand" "r"))])]
10728 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 8"
10729 "{stsi|stswi} %2,%1,%O0"
10730 [(set_attr "type" "store_ux")
10731 (set_attr "cell_micro" "always")])
10733 (define_insn "*stmsi6_power"
10734 [(match_parallel 0 "store_multiple_operation"
10735 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10736 (match_operand:SI 2 "gpc_reg_operand" "r"))
10737 (clobber (match_scratch:SI 3 "=q"))
10738 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10739 (match_operand:SI 4 "gpc_reg_operand" "r"))
10740 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10741 (match_operand:SI 5 "gpc_reg_operand" "r"))
10742 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10743 (match_operand:SI 6 "gpc_reg_operand" "r"))
10744 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10745 (match_operand:SI 7 "gpc_reg_operand" "r"))
10746 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10747 (match_operand:SI 8 "gpc_reg_operand" "r"))])]
10748 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 7"
10749 "{stsi|stswi} %2,%1,%O0"
10750 [(set_attr "type" "store_ux")
10751 (set_attr "cell_micro" "always")])
10753 (define_insn "*stmsi5_power"
10754 [(match_parallel 0 "store_multiple_operation"
10755 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10756 (match_operand:SI 2 "gpc_reg_operand" "r"))
10757 (clobber (match_scratch:SI 3 "=q"))
10758 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10759 (match_operand:SI 4 "gpc_reg_operand" "r"))
10760 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10761 (match_operand:SI 5 "gpc_reg_operand" "r"))
10762 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10763 (match_operand:SI 6 "gpc_reg_operand" "r"))
10764 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10765 (match_operand:SI 7 "gpc_reg_operand" "r"))])]
10766 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 6"
10767 "{stsi|stswi} %2,%1,%O0"
10768 [(set_attr "type" "store_ux")
10769 (set_attr "cell_micro" "always")])
10771 (define_insn "*stmsi4_power"
10772 [(match_parallel 0 "store_multiple_operation"
10773 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10774 (match_operand:SI 2 "gpc_reg_operand" "r"))
10775 (clobber (match_scratch:SI 3 "=q"))
10776 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10777 (match_operand:SI 4 "gpc_reg_operand" "r"))
10778 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10779 (match_operand:SI 5 "gpc_reg_operand" "r"))
10780 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10781 (match_operand:SI 6 "gpc_reg_operand" "r"))])]
10782 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 5"
10783 "{stsi|stswi} %2,%1,%O0"
10784 [(set_attr "type" "store_ux")
10785 (set_attr "cell_micro" "always")])
10787 (define_insn "*stmsi3_power"
10788 [(match_parallel 0 "store_multiple_operation"
10789 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10790 (match_operand:SI 2 "gpc_reg_operand" "r"))
10791 (clobber (match_scratch:SI 3 "=q"))
10792 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10793 (match_operand:SI 4 "gpc_reg_operand" "r"))
10794 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10795 (match_operand:SI 5 "gpc_reg_operand" "r"))])]
10796 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 4"
10797 "{stsi|stswi} %2,%1,%O0"
10798 [(set_attr "type" "store_ux")
10799 (set_attr "cell_micro" "always")])
10801 (define_expand "setmemsi"
10802 [(parallel [(set (match_operand:BLK 0 "" "")
10803 (match_operand 2 "const_int_operand" ""))
10804 (use (match_operand:SI 1 "" ""))
10805 (use (match_operand:SI 3 "" ""))])]
10809 /* If value to set is not zero, use the library routine. */
10810 if (operands[2] != const0_rtx)
10813 if (expand_block_clear (operands))
10819 ;; String/block move insn.
10820 ;; Argument 0 is the destination
10821 ;; Argument 1 is the source
10822 ;; Argument 2 is the length
10823 ;; Argument 3 is the alignment
10825 (define_expand "movmemsi"
10826 [(parallel [(set (match_operand:BLK 0 "" "")
10827 (match_operand:BLK 1 "" ""))
10828 (use (match_operand:SI 2 "" ""))
10829 (use (match_operand:SI 3 "" ""))])]
10833 if (expand_block_move (operands))
10839 ;; Move up to 32 bytes at a time. The fixed registers are needed because the
10840 ;; register allocator doesn't have a clue about allocating 8 word registers.
10841 ;; rD/rS = r5 is preferred, efficient form.
10842 (define_expand "movmemsi_8reg"
10843 [(parallel [(set (match_operand 0 "" "")
10844 (match_operand 1 "" ""))
10845 (use (match_operand 2 "" ""))
10846 (use (match_operand 3 "" ""))
10847 (clobber (reg:SI 5))
10848 (clobber (reg:SI 6))
10849 (clobber (reg:SI 7))
10850 (clobber (reg:SI 8))
10851 (clobber (reg:SI 9))
10852 (clobber (reg:SI 10))
10853 (clobber (reg:SI 11))
10854 (clobber (reg:SI 12))
10855 (clobber (match_scratch:SI 4 ""))])]
10860 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
10861 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
10862 (use (match_operand:SI 2 "immediate_operand" "i"))
10863 (use (match_operand:SI 3 "immediate_operand" "i"))
10864 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10865 (clobber (reg:SI 6))
10866 (clobber (reg:SI 7))
10867 (clobber (reg:SI 8))
10868 (clobber (reg:SI 9))
10869 (clobber (reg:SI 10))
10870 (clobber (reg:SI 11))
10871 (clobber (reg:SI 12))
10872 (clobber (match_scratch:SI 5 "=q"))]
10873 "TARGET_STRING && TARGET_POWER
10874 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
10875 || INTVAL (operands[2]) == 0)
10876 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
10877 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
10878 && REGNO (operands[4]) == 5"
10879 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10880 [(set_attr "type" "store_ux")
10881 (set_attr "cell_micro" "always")
10882 (set_attr "length" "8")])
10885 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
10886 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
10887 (use (match_operand:SI 2 "immediate_operand" "i"))
10888 (use (match_operand:SI 3 "immediate_operand" "i"))
10889 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10890 (clobber (reg:SI 6))
10891 (clobber (reg:SI 7))
10892 (clobber (reg:SI 8))
10893 (clobber (reg:SI 9))
10894 (clobber (reg:SI 10))
10895 (clobber (reg:SI 11))
10896 (clobber (reg:SI 12))
10897 (clobber (match_scratch:SI 5 "=X"))]
10898 "TARGET_STRING && ! TARGET_POWER
10899 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
10900 || INTVAL (operands[2]) == 0)
10901 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
10902 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
10903 && REGNO (operands[4]) == 5"
10904 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10905 [(set_attr "type" "store_ux")
10906 (set_attr "cell_micro" "always")
10907 (set_attr "length" "8")])
10909 ;; Move up to 24 bytes at a time. The fixed registers are needed because the
10910 ;; register allocator doesn't have a clue about allocating 6 word registers.
10911 ;; rD/rS = r5 is preferred, efficient form.
10912 (define_expand "movmemsi_6reg"
10913 [(parallel [(set (match_operand 0 "" "")
10914 (match_operand 1 "" ""))
10915 (use (match_operand 2 "" ""))
10916 (use (match_operand 3 "" ""))
10917 (clobber (reg:SI 5))
10918 (clobber (reg:SI 6))
10919 (clobber (reg:SI 7))
10920 (clobber (reg:SI 8))
10921 (clobber (reg:SI 9))
10922 (clobber (reg:SI 10))
10923 (clobber (match_scratch:SI 4 ""))])]
10928 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
10929 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
10930 (use (match_operand:SI 2 "immediate_operand" "i"))
10931 (use (match_operand:SI 3 "immediate_operand" "i"))
10932 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10933 (clobber (reg:SI 6))
10934 (clobber (reg:SI 7))
10935 (clobber (reg:SI 8))
10936 (clobber (reg:SI 9))
10937 (clobber (reg:SI 10))
10938 (clobber (match_scratch:SI 5 "=q"))]
10939 "TARGET_STRING && TARGET_POWER
10940 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 24
10941 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
10942 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
10943 && REGNO (operands[4]) == 5"
10944 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10945 [(set_attr "type" "store_ux")
10946 (set_attr "cell_micro" "always")
10947 (set_attr "length" "8")])
10950 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
10951 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
10952 (use (match_operand:SI 2 "immediate_operand" "i"))
10953 (use (match_operand:SI 3 "immediate_operand" "i"))
10954 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10955 (clobber (reg:SI 6))
10956 (clobber (reg:SI 7))
10957 (clobber (reg:SI 8))
10958 (clobber (reg:SI 9))
10959 (clobber (reg:SI 10))
10960 (clobber (match_scratch:SI 5 "=X"))]
10961 "TARGET_STRING && ! TARGET_POWER
10962 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
10963 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
10964 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
10965 && REGNO (operands[4]) == 5"
10966 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10967 [(set_attr "type" "store_ux")
10968 (set_attr "cell_micro" "always")
10969 (set_attr "length" "8")])
10971 ;; Move up to 16 bytes at a time, using 4 fixed registers to avoid spill
10972 ;; problems with TImode.
10973 ;; rD/rS = r5 is preferred, efficient form.
10974 (define_expand "movmemsi_4reg"
10975 [(parallel [(set (match_operand 0 "" "")
10976 (match_operand 1 "" ""))
10977 (use (match_operand 2 "" ""))
10978 (use (match_operand 3 "" ""))
10979 (clobber (reg:SI 5))
10980 (clobber (reg:SI 6))
10981 (clobber (reg:SI 7))
10982 (clobber (reg:SI 8))
10983 (clobber (match_scratch:SI 4 ""))])]
10988 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
10989 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
10990 (use (match_operand:SI 2 "immediate_operand" "i"))
10991 (use (match_operand:SI 3 "immediate_operand" "i"))
10992 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10993 (clobber (reg:SI 6))
10994 (clobber (reg:SI 7))
10995 (clobber (reg:SI 8))
10996 (clobber (match_scratch:SI 5 "=q"))]
10997 "TARGET_STRING && TARGET_POWER
10998 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
10999 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
11000 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
11001 && REGNO (operands[4]) == 5"
11002 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
11003 [(set_attr "type" "store_ux")
11004 (set_attr "cell_micro" "always")
11005 (set_attr "length" "8")])
11008 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
11009 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
11010 (use (match_operand:SI 2 "immediate_operand" "i"))
11011 (use (match_operand:SI 3 "immediate_operand" "i"))
11012 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
11013 (clobber (reg:SI 6))
11014 (clobber (reg:SI 7))
11015 (clobber (reg:SI 8))
11016 (clobber (match_scratch:SI 5 "=X"))]
11017 "TARGET_STRING && ! TARGET_POWER
11018 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
11019 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
11020 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
11021 && REGNO (operands[4]) == 5"
11022 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
11023 [(set_attr "type" "store_ux")
11024 (set_attr "cell_micro" "always")
11025 (set_attr "length" "8")])
11027 ;; Move up to 8 bytes at a time.
11028 (define_expand "movmemsi_2reg"
11029 [(parallel [(set (match_operand 0 "" "")
11030 (match_operand 1 "" ""))
11031 (use (match_operand 2 "" ""))
11032 (use (match_operand 3 "" ""))
11033 (clobber (match_scratch:DI 4 ""))
11034 (clobber (match_scratch:SI 5 ""))])]
11035 "TARGET_STRING && ! TARGET_POWERPC64"
11039 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
11040 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
11041 (use (match_operand:SI 2 "immediate_operand" "i"))
11042 (use (match_operand:SI 3 "immediate_operand" "i"))
11043 (clobber (match_scratch:DI 4 "=&r"))
11044 (clobber (match_scratch:SI 5 "=q"))]
11045 "TARGET_STRING && TARGET_POWER && ! TARGET_POWERPC64
11046 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
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:SI 0 "gpc_reg_operand" "b"))
11054 (mem:BLK (match_operand:SI 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_scratch:DI 4 "=&r"))
11058 (clobber (match_scratch:SI 5 "=X"))]
11059 "TARGET_STRING && ! TARGET_POWER && ! TARGET_POWERPC64
11060 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
11061 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
11062 [(set_attr "type" "store_ux")
11063 (set_attr "cell_micro" "always")
11064 (set_attr "length" "8")])
11066 ;; Move up to 4 bytes at a time.
11067 (define_expand "movmemsi_1reg"
11068 [(parallel [(set (match_operand 0 "" "")
11069 (match_operand 1 "" ""))
11070 (use (match_operand 2 "" ""))
11071 (use (match_operand 3 "" ""))
11072 (clobber (match_scratch:SI 4 ""))
11073 (clobber (match_scratch:SI 5 ""))])]
11078 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
11079 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
11080 (use (match_operand:SI 2 "immediate_operand" "i"))
11081 (use (match_operand:SI 3 "immediate_operand" "i"))
11082 (clobber (match_scratch:SI 4 "=&r"))
11083 (clobber (match_scratch:SI 5 "=q"))]
11084 "TARGET_STRING && TARGET_POWER
11085 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
11086 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
11087 [(set_attr "type" "store_ux")
11088 (set_attr "cell_micro" "always")
11089 (set_attr "length" "8")])
11092 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
11093 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
11094 (use (match_operand:SI 2 "immediate_operand" "i"))
11095 (use (match_operand:SI 3 "immediate_operand" "i"))
11096 (clobber (match_scratch:SI 4 "=&r"))
11097 (clobber (match_scratch:SI 5 "=X"))]
11098 "TARGET_STRING && ! TARGET_POWER
11099 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
11100 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
11101 [(set_attr "type" "store_ux")
11102 (set_attr "cell_micro" "always")
11103 (set_attr "length" "8")])
11105 ;; Define insns that do load or store with update. Some of these we can
11106 ;; get by using pre-decrement or pre-increment, but the hardware can also
11107 ;; do cases where the increment is not the size of the object.
11109 ;; In all these cases, we use operands 0 and 1 for the register being
11110 ;; incremented because those are the operands that local-alloc will
11111 ;; tie and these are the pair most likely to be tieable (and the ones
11112 ;; that will benefit the most).
11114 (define_insn "*movdi_update1"
11115 [(set (match_operand:DI 3 "gpc_reg_operand" "=r,r")
11116 (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
11117 (match_operand:DI 2 "reg_or_aligned_short_operand" "r,I"))))
11118 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
11119 (plus:DI (match_dup 1) (match_dup 2)))]
11120 "TARGET_POWERPC64 && TARGET_UPDATE
11121 && (!avoiding_indexed_address_p (DImode)
11122 || !gpc_reg_operand (operands[2], DImode))"
11126 [(set_attr "type" "load_ux,load_u")])
11128 (define_insn "movdi_<mode>_update"
11129 [(set (mem:DI (plus:P (match_operand:P 1 "gpc_reg_operand" "0,0")
11130 (match_operand:P 2 "reg_or_aligned_short_operand" "r,I")))
11131 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
11132 (set (match_operand:P 0 "gpc_reg_operand" "=b,b")
11133 (plus:P (match_dup 1) (match_dup 2)))]
11134 "TARGET_POWERPC64 && TARGET_UPDATE
11135 && (!avoiding_indexed_address_p (Pmode)
11136 || !gpc_reg_operand (operands[2], Pmode)
11137 || (REG_P (operands[0])
11138 && REGNO (operands[0]) == STACK_POINTER_REGNUM))"
11142 [(set_attr "type" "store_ux,store_u")])
11144 ;; This pattern is only conditional on TARGET_POWERPC64, as it is
11145 ;; needed for stack allocation, even if the user passes -mno-update.
11146 (define_insn "movdi_<mode>_update_stack"
11147 [(set (mem:DI (plus:P (match_operand:P 1 "gpc_reg_operand" "0,0")
11148 (match_operand:P 2 "reg_or_aligned_short_operand" "r,I")))
11149 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
11150 (set (match_operand:P 0 "gpc_reg_operand" "=b,b")
11151 (plus:P (match_dup 1) (match_dup 2)))]
11156 [(set_attr "type" "store_ux,store_u")])
11158 (define_insn "*movsi_update1"
11159 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
11160 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11161 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
11162 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11163 (plus:SI (match_dup 1) (match_dup 2)))]
11165 && (!avoiding_indexed_address_p (SImode)
11166 || !gpc_reg_operand (operands[2], SImode))"
11168 {lux|lwzux} %3,%0,%2
11169 {lu|lwzu} %3,%2(%0)"
11170 [(set_attr "type" "load_ux,load_u")])
11172 (define_insn "*movsi_update2"
11173 [(set (match_operand:DI 3 "gpc_reg_operand" "=r")
11175 (mem:SI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0")
11176 (match_operand:DI 2 "gpc_reg_operand" "r")))))
11177 (set (match_operand:DI 0 "gpc_reg_operand" "=b")
11178 (plus:DI (match_dup 1) (match_dup 2)))]
11179 "TARGET_POWERPC64 && rs6000_gen_cell_microcode
11180 && !avoiding_indexed_address_p (DImode)"
11182 [(set_attr "type" "load_ext_ux")])
11184 (define_insn "movsi_update"
11185 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11186 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
11187 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
11188 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11189 (plus:SI (match_dup 1) (match_dup 2)))]
11191 && (!avoiding_indexed_address_p (SImode)
11192 || !gpc_reg_operand (operands[2], SImode)
11193 || (REG_P (operands[0])
11194 && REGNO (operands[0]) == STACK_POINTER_REGNUM))"
11196 {stux|stwux} %3,%0,%2
11197 {stu|stwu} %3,%2(%0)"
11198 [(set_attr "type" "store_ux,store_u")])
11200 ;; This is an unconditional pattern; needed for stack allocation, even
11201 ;; if the user passes -mno-update.
11202 (define_insn "movsi_update_stack"
11203 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11204 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
11205 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
11206 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11207 (plus:SI (match_dup 1) (match_dup 2)))]
11210 {stux|stwux} %3,%0,%2
11211 {stu|stwu} %3,%2(%0)"
11212 [(set_attr "type" "store_ux,store_u")])
11214 (define_insn "*movhi_update1"
11215 [(set (match_operand:HI 3 "gpc_reg_operand" "=r,r")
11216 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11217 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
11218 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11219 (plus:SI (match_dup 1) (match_dup 2)))]
11221 && (!avoiding_indexed_address_p (SImode)
11222 || !gpc_reg_operand (operands[2], SImode))"
11226 [(set_attr "type" "load_ux,load_u")])
11228 (define_insn "*movhi_update2"
11229 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
11231 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11232 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
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))"
11241 [(set_attr "type" "load_ux,load_u")])
11243 (define_insn "*movhi_update3"
11244 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
11246 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11247 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
11248 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11249 (plus:SI (match_dup 1) (match_dup 2)))]
11250 "TARGET_UPDATE && rs6000_gen_cell_microcode
11251 && (!avoiding_indexed_address_p (SImode)
11252 || !gpc_reg_operand (operands[2], SImode))"
11256 [(set_attr "type" "load_ext_ux,load_ext_u")])
11258 (define_insn "*movhi_update4"
11259 [(set (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11260 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
11261 (match_operand:HI 3 "gpc_reg_operand" "r,r"))
11262 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11263 (plus:SI (match_dup 1) (match_dup 2)))]
11265 && (!avoiding_indexed_address_p (SImode)
11266 || !gpc_reg_operand (operands[2], SImode))"
11270 [(set_attr "type" "store_ux,store_u")])
11272 (define_insn "*movqi_update1"
11273 [(set (match_operand:QI 3 "gpc_reg_operand" "=r,r")
11274 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11275 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
11276 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11277 (plus:SI (match_dup 1) (match_dup 2)))]
11279 && (!avoiding_indexed_address_p (SImode)
11280 || !gpc_reg_operand (operands[2], SImode))"
11284 [(set_attr "type" "load_ux,load_u")])
11286 (define_insn "*movqi_update2"
11287 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
11289 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11290 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
11291 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11292 (plus:SI (match_dup 1) (match_dup 2)))]
11294 && (!avoiding_indexed_address_p (SImode)
11295 || !gpc_reg_operand (operands[2], SImode))"
11299 [(set_attr "type" "load_ux,load_u")])
11301 (define_insn "*movqi_update3"
11302 [(set (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11303 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
11304 (match_operand:QI 3 "gpc_reg_operand" "r,r"))
11305 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11306 (plus:SI (match_dup 1) (match_dup 2)))]
11308 && (!avoiding_indexed_address_p (SImode)
11309 || !gpc_reg_operand (operands[2], SImode))"
11313 [(set_attr "type" "store_ux,store_u")])
11315 (define_insn "*movsf_update1"
11316 [(set (match_operand:SF 3 "gpc_reg_operand" "=f,f")
11317 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11318 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
11319 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11320 (plus:SI (match_dup 1) (match_dup 2)))]
11321 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT && TARGET_UPDATE
11322 && (!avoiding_indexed_address_p (SImode)
11323 || !gpc_reg_operand (operands[2], SImode))"
11327 [(set_attr "type" "fpload_ux,fpload_u")])
11329 (define_insn "*movsf_update2"
11330 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11331 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
11332 (match_operand:SF 3 "gpc_reg_operand" "f,f"))
11333 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11334 (plus:SI (match_dup 1) (match_dup 2)))]
11335 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT && TARGET_UPDATE
11336 && (!avoiding_indexed_address_p (SImode)
11337 || !gpc_reg_operand (operands[2], SImode))"
11341 [(set_attr "type" "fpstore_ux,fpstore_u")])
11343 (define_insn "*movsf_update3"
11344 [(set (match_operand:SF 3 "gpc_reg_operand" "=r,r")
11345 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11346 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
11347 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11348 (plus:SI (match_dup 1) (match_dup 2)))]
11349 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE
11350 && (!avoiding_indexed_address_p (SImode)
11351 || !gpc_reg_operand (operands[2], SImode))"
11353 {lux|lwzux} %3,%0,%2
11354 {lu|lwzu} %3,%2(%0)"
11355 [(set_attr "type" "load_ux,load_u")])
11357 (define_insn "*movsf_update4"
11358 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11359 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
11360 (match_operand:SF 3 "gpc_reg_operand" "r,r"))
11361 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11362 (plus:SI (match_dup 1) (match_dup 2)))]
11363 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE
11364 && (!avoiding_indexed_address_p (SImode)
11365 || !gpc_reg_operand (operands[2], SImode))"
11367 {stux|stwux} %3,%0,%2
11368 {stu|stwu} %3,%2(%0)"
11369 [(set_attr "type" "store_ux,store_u")])
11371 (define_insn "*movdf_update1"
11372 [(set (match_operand:DF 3 "gpc_reg_operand" "=d,d")
11373 (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11374 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
11375 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11376 (plus:SI (match_dup 1) (match_dup 2)))]
11377 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_UPDATE
11378 && (!avoiding_indexed_address_p (SImode)
11379 || !gpc_reg_operand (operands[2], SImode))"
11383 [(set_attr "type" "fpload_ux,fpload_u")])
11385 (define_insn "*movdf_update2"
11386 [(set (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11387 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
11388 (match_operand:DF 3 "gpc_reg_operand" "d,d"))
11389 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11390 (plus:SI (match_dup 1) (match_dup 2)))]
11391 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_UPDATE
11392 && (!avoiding_indexed_address_p (SImode)
11393 || !gpc_reg_operand (operands[2], SImode))"
11397 [(set_attr "type" "fpstore_ux,fpstore_u")])
11399 ;; Peephole to convert two consecutive FP loads or stores into lfq/stfq.
11401 (define_insn "*lfq_power2"
11402 [(set (match_operand:V2DF 0 "gpc_reg_operand" "=f")
11403 (match_operand:V2DF 1 "memory_operand" ""))]
11405 && TARGET_HARD_FLOAT && TARGET_FPRS"
11409 [(set (match_operand:DF 0 "gpc_reg_operand" "")
11410 (match_operand:DF 1 "memory_operand" ""))
11411 (set (match_operand:DF 2 "gpc_reg_operand" "")
11412 (match_operand:DF 3 "memory_operand" ""))]
11414 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
11415 && registers_ok_for_quad_peep (operands[0], operands[2])
11416 && mems_ok_for_quad_peep (operands[1], operands[3])"
11417 [(set (match_dup 0)
11419 "operands[1] = widen_memory_access (operands[1], V2DFmode, 0);
11420 operands[0] = gen_rtx_REG (V2DFmode, REGNO (operands[0]));")
11422 (define_insn "*stfq_power2"
11423 [(set (match_operand:V2DF 0 "memory_operand" "")
11424 (match_operand:V2DF 1 "gpc_reg_operand" "f"))]
11426 && TARGET_HARD_FLOAT && TARGET_FPRS"
11427 "stfq%U0%X0 %1,%0")
11431 [(set (match_operand:DF 0 "memory_operand" "")
11432 (match_operand:DF 1 "gpc_reg_operand" ""))
11433 (set (match_operand:DF 2 "memory_operand" "")
11434 (match_operand:DF 3 "gpc_reg_operand" ""))]
11436 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
11437 && registers_ok_for_quad_peep (operands[1], operands[3])
11438 && mems_ok_for_quad_peep (operands[0], operands[2])"
11439 [(set (match_dup 0)
11441 "operands[0] = widen_memory_access (operands[0], V2DFmode, 0);
11442 operands[1] = gen_rtx_REG (V2DFmode, REGNO (operands[1]));")
11444 ;; After inserting conditional returns we can sometimes have
11445 ;; unnecessary register moves. Unfortunately we cannot have a
11446 ;; modeless peephole here, because some single SImode sets have early
11447 ;; clobber outputs. Although those sets expand to multi-ppc-insn
11448 ;; sequences, using get_attr_length here will smash the operands
11449 ;; array. Neither is there an early_cobbler_p predicate.
11450 ;; Disallow subregs for E500 so we don't munge frob_di_df_2.
11452 [(set (match_operand:DF 0 "gpc_reg_operand" "")
11453 (match_operand:DF 1 "any_operand" ""))
11454 (set (match_operand:DF 2 "gpc_reg_operand" "")
11456 "!(TARGET_E500_DOUBLE && GET_CODE (operands[2]) == SUBREG)
11457 && peep2_reg_dead_p (2, operands[0])"
11458 [(set (match_dup 2) (match_dup 1))])
11461 [(set (match_operand:SF 0 "gpc_reg_operand" "")
11462 (match_operand:SF 1 "any_operand" ""))
11463 (set (match_operand:SF 2 "gpc_reg_operand" "")
11465 "peep2_reg_dead_p (2, operands[0])"
11466 [(set (match_dup 2) (match_dup 1))])
11471 ;; Mode attributes for different ABIs.
11472 (define_mode_iterator TLSmode [(SI "! TARGET_64BIT") (DI "TARGET_64BIT")])
11473 (define_mode_attr tls_abi_suffix [(SI "32") (DI "64")])
11474 (define_mode_attr tls_sysv_suffix [(SI "si") (DI "di")])
11475 (define_mode_attr tls_insn_suffix [(SI "wz") (DI "d")])
11477 (define_insn_and_split "tls_gd_aix<TLSmode:tls_abi_suffix>"
11478 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11479 (call (mem:TLSmode (match_operand:TLSmode 3 "symbol_ref_operand" "s"))
11480 (match_operand 4 "" "g")))
11481 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11482 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11484 (clobber (reg:SI LR_REGNO))]
11485 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX"
11487 if (TARGET_CMODEL != CMODEL_SMALL)
11488 return "addis %0,%1,%2@got@tlsgd@ha\;addi %0,%0,%2@got@tlsgd@l\;bl %z3\;%.";
11490 return "addi %0,%1,%2@got@tlsgd\;bl %z3\;%.";
11492 "&& TARGET_TLS_MARKERS"
11493 [(set (match_dup 0)
11494 (unspec:TLSmode [(match_dup 1)
11497 (parallel [(set (match_dup 0)
11498 (call (mem:TLSmode (match_dup 3))
11500 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD)
11501 (clobber (reg:SI LR_REGNO))])]
11503 [(set_attr "type" "two")
11504 (set (attr "length")
11505 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
11509 (define_insn_and_split "tls_gd_sysv<TLSmode:tls_sysv_suffix>"
11510 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11511 (call (mem:TLSmode (match_operand:TLSmode 3 "symbol_ref_operand" "s"))
11512 (match_operand 4 "" "g")))
11513 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11514 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11516 (clobber (reg:SI LR_REGNO))]
11517 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4"
11521 if (TARGET_SECURE_PLT && flag_pic == 2)
11522 return "addi %0,%1,%2@got@tlsgd\;bl %z3+32768@plt";
11524 return "addi %0,%1,%2@got@tlsgd\;bl %z3@plt";
11527 return "addi %0,%1,%2@got@tlsgd\;bl %z3";
11529 "&& TARGET_TLS_MARKERS"
11530 [(set (match_dup 0)
11531 (unspec:TLSmode [(match_dup 1)
11534 (parallel [(set (match_dup 0)
11535 (call (mem:TLSmode (match_dup 3))
11537 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD)
11538 (clobber (reg:SI LR_REGNO))])]
11540 [(set_attr "type" "two")
11541 (set_attr "length" "8")])
11543 (define_insn_and_split "*tls_gd<TLSmode:tls_abi_suffix>"
11544 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11545 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11546 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11548 "HAVE_AS_TLS && TARGET_TLS_MARKERS"
11549 "addi %0,%1,%2@got@tlsgd"
11550 "&& TARGET_CMODEL != CMODEL_SMALL"
11551 [(set (match_dup 3)
11553 (plus:TLSmode (match_dup 1)
11555 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD)))))
11557 (lo_sum:TLSmode (match_dup 3)
11558 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD)))]
11561 operands[3] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
11563 [(set (attr "length")
11564 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
11568 (define_insn "*tls_gd_high<TLSmode:tls_abi_suffix>"
11569 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11571 (plus:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11573 (unspec:TLSmode [(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11575 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
11576 "addis %0,%1,%2@got@tlsgd@ha"
11577 [(set_attr "length" "4")])
11579 (define_insn "*tls_gd_low<TLSmode:tls_abi_suffix>"
11580 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11581 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11582 (unspec:TLSmode [(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11584 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
11585 "addi %0,%1,%2@got@tlsgd@l"
11586 [(set_attr "length" "4")])
11588 (define_insn "*tls_gd_call_aix<TLSmode:tls_abi_suffix>"
11589 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11590 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
11591 (match_operand 2 "" "g")))
11592 (unspec:TLSmode [(match_operand:TLSmode 3 "rs6000_tls_symbol_ref" "")]
11594 (clobber (reg:SI LR_REGNO))]
11595 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX && TARGET_TLS_MARKERS"
11596 "bl %z1(%3@tlsgd)\;%."
11597 [(set_attr "type" "branch")
11598 (set_attr "length" "8")])
11600 (define_insn "*tls_gd_call_sysv<TLSmode:tls_abi_suffix>"
11601 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11602 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
11603 (match_operand 2 "" "g")))
11604 (unspec:TLSmode [(match_operand:TLSmode 3 "rs6000_tls_symbol_ref" "")]
11606 (clobber (reg:SI LR_REGNO))]
11607 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4 && TARGET_TLS_MARKERS"
11611 if (TARGET_SECURE_PLT && flag_pic == 2)
11612 return "bl %z1+32768(%3@tlsgd)@plt";
11613 return "bl %z1(%3@tlsgd)@plt";
11615 return "bl %z1(%3@tlsgd)";
11617 [(set_attr "type" "branch")
11618 (set_attr "length" "4")])
11620 (define_insn_and_split "tls_ld_aix<TLSmode:tls_abi_suffix>"
11621 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11622 (call (mem:TLSmode (match_operand:TLSmode 2 "symbol_ref_operand" "s"))
11623 (match_operand 3 "" "g")))
11624 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
11626 (clobber (reg:SI LR_REGNO))]
11627 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX"
11629 if (TARGET_CMODEL != CMODEL_SMALL)
11630 return "addis %0,%1,%&@got@tlsld@ha\;addi %0,%0,%&@got@tlsld@l\;bl %z2\;%.";
11632 return "addi %0,%1,%&@got@tlsld\;bl %z2\;%.";
11634 "&& TARGET_TLS_MARKERS"
11635 [(set (match_dup 0)
11636 (unspec:TLSmode [(match_dup 1)]
11638 (parallel [(set (match_dup 0)
11639 (call (mem:TLSmode (match_dup 2))
11641 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
11642 (clobber (reg:SI LR_REGNO))])]
11644 [(set_attr "type" "two")
11645 (set (attr "length")
11646 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
11650 (define_insn_and_split "tls_ld_sysv<TLSmode:tls_sysv_suffix>"
11651 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11652 (call (mem:TLSmode (match_operand:TLSmode 2 "symbol_ref_operand" "s"))
11653 (match_operand 3 "" "g")))
11654 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
11656 (clobber (reg:SI LR_REGNO))]
11657 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4"
11661 if (TARGET_SECURE_PLT && flag_pic == 2)
11662 return "addi %0,%1,%&@got@tlsld\;bl %z2+32768@plt";
11664 return "addi %0,%1,%&@got@tlsld\;bl %z2@plt";
11667 return "addi %0,%1,%&@got@tlsld\;bl %z2";
11669 "&& TARGET_TLS_MARKERS"
11670 [(set (match_dup 0)
11671 (unspec:TLSmode [(match_dup 1)]
11673 (parallel [(set (match_dup 0)
11674 (call (mem:TLSmode (match_dup 2))
11676 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
11677 (clobber (reg:SI LR_REGNO))])]
11679 [(set_attr "length" "8")])
11681 (define_insn_and_split "*tls_ld<TLSmode:tls_abi_suffix>"
11682 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11683 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
11685 "HAVE_AS_TLS && TARGET_TLS_MARKERS"
11686 "addi %0,%1,%&@got@tlsld"
11687 "&& TARGET_CMODEL != CMODEL_SMALL"
11688 [(set (match_dup 2)
11690 (plus:TLSmode (match_dup 1)
11692 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)))))
11694 (lo_sum:TLSmode (match_dup 2)
11695 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)))]
11698 operands[2] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
11700 [(set (attr "length")
11701 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
11705 (define_insn "*tls_ld_high<TLSmode:tls_abi_suffix>"
11706 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11708 (plus:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11710 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)))))]
11711 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
11712 "addis %0,%1,%&@got@tlsld@ha"
11713 [(set_attr "length" "4")])
11715 (define_insn "*tls_ld_low<TLSmode:tls_abi_suffix>"
11716 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11717 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11718 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)))]
11719 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
11720 "addi %0,%1,%&@got@tlsld@l"
11721 [(set_attr "length" "4")])
11723 (define_insn "*tls_ld_call_aix<TLSmode:tls_abi_suffix>"
11724 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11725 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
11726 (match_operand 2 "" "g")))
11727 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
11728 (clobber (reg:SI LR_REGNO))]
11729 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX && TARGET_TLS_MARKERS"
11730 "bl %z1(%&@tlsld)\;%."
11731 [(set_attr "type" "branch")
11732 (set_attr "length" "8")])
11734 (define_insn "*tls_ld_call_sysv<TLSmode:tls_abi_suffix>"
11735 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11736 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
11737 (match_operand 2 "" "g")))
11738 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
11739 (clobber (reg:SI LR_REGNO))]
11740 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4 && TARGET_TLS_MARKERS"
11744 if (TARGET_SECURE_PLT && flag_pic == 2)
11745 return "bl %z1+32768(%&@tlsld)@plt";
11746 return "bl %z1(%&@tlsld)@plt";
11748 return "bl %z1(%&@tlsld)";
11750 [(set_attr "type" "branch")
11751 (set_attr "length" "4")])
11753 (define_insn "tls_dtprel_<TLSmode:tls_abi_suffix>"
11754 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11755 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11756 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11757 UNSPEC_TLSDTPREL))]
11759 "addi %0,%1,%2@dtprel")
11761 (define_insn "tls_dtprel_ha_<TLSmode:tls_abi_suffix>"
11762 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11763 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11764 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11765 UNSPEC_TLSDTPRELHA))]
11767 "addis %0,%1,%2@dtprel@ha")
11769 (define_insn "tls_dtprel_lo_<TLSmode:tls_abi_suffix>"
11770 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11771 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11772 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11773 UNSPEC_TLSDTPRELLO))]
11775 "addi %0,%1,%2@dtprel@l")
11777 (define_insn_and_split "tls_got_dtprel_<TLSmode:tls_abi_suffix>"
11778 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11779 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11780 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11781 UNSPEC_TLSGOTDTPREL))]
11783 "l<TLSmode:tls_insn_suffix> %0,%2@got@dtprel(%1)"
11784 "&& TARGET_CMODEL != CMODEL_SMALL"
11785 [(set (match_dup 3)
11787 (plus:TLSmode (match_dup 1)
11789 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGOTDTPREL)))))
11791 (lo_sum:TLSmode (match_dup 3)
11792 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGOTDTPREL)))]
11795 operands[3] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
11797 [(set (attr "length")
11798 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
11802 (define_insn "*tls_got_dtprel_high<TLSmode:tls_abi_suffix>"
11803 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11805 (plus:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11807 (unspec:TLSmode [(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11808 UNSPEC_TLSGOTDTPREL)))))]
11809 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
11810 "addis %0,%1,%2@got@dtprel@ha"
11811 [(set_attr "length" "4")])
11813 (define_insn "*tls_got_dtprel_low<TLSmode:tls_abi_suffix>"
11814 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11815 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11816 (unspec:TLSmode [(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11817 UNSPEC_TLSGOTDTPREL)))]
11818 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
11819 "l<TLSmode:tls_insn_suffix> %0,%2@got@dtprel@l(%1)"
11820 [(set_attr "length" "4")])
11822 (define_insn "tls_tprel_<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" "")]
11828 "addi %0,%1,%2@tprel")
11830 (define_insn "tls_tprel_ha_<TLSmode:tls_abi_suffix>"
11831 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11832 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11833 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11834 UNSPEC_TLSTPRELHA))]
11836 "addis %0,%1,%2@tprel@ha")
11838 (define_insn "tls_tprel_lo_<TLSmode:tls_abi_suffix>"
11839 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11840 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11841 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11842 UNSPEC_TLSTPRELLO))]
11844 "addi %0,%1,%2@tprel@l")
11846 ;; "b" output constraint here and on tls_tls input to support linker tls
11847 ;; optimization. The linker may edit the instructions emitted by a
11848 ;; tls_got_tprel/tls_tls pair to addis,addi.
11849 (define_insn_and_split "tls_got_tprel_<TLSmode:tls_abi_suffix>"
11850 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11851 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11852 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11853 UNSPEC_TLSGOTTPREL))]
11855 "l<TLSmode:tls_insn_suffix> %0,%2@got@tprel(%1)"
11856 "&& TARGET_CMODEL != CMODEL_SMALL"
11857 [(set (match_dup 3)
11859 (plus:TLSmode (match_dup 1)
11861 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGOTTPREL)))))
11863 (lo_sum:TLSmode (match_dup 3)
11864 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGOTTPREL)))]
11867 operands[3] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
11869 [(set (attr "length")
11870 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
11874 (define_insn "*tls_got_tprel_high<TLSmode:tls_abi_suffix>"
11875 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11877 (plus:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11879 (unspec:TLSmode [(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11880 UNSPEC_TLSGOTTPREL)))))]
11881 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
11882 "addis %0,%1,%2@got@tprel@ha"
11883 [(set_attr "length" "4")])
11885 (define_insn "*tls_got_tprel_low<TLSmode:tls_abi_suffix>"
11886 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11887 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11888 (unspec:TLSmode [(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11889 UNSPEC_TLSGOTTPREL)))]
11890 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
11891 "l<TLSmode:tls_insn_suffix> %0,%2@got@tprel@l(%1)"
11892 [(set_attr "length" "4")])
11894 (define_insn "tls_tls_<TLSmode:tls_abi_suffix>"
11895 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11896 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11897 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11900 "add %0,%1,%2@tls")
11902 ;; Next come insns related to the calling sequence.
11904 ;; First, an insn to allocate new stack space for dynamic use (e.g., alloca).
11905 ;; We move the back-chain and decrement the stack pointer.
11907 (define_expand "allocate_stack"
11908 [(set (match_operand 0 "gpc_reg_operand" "")
11909 (minus (reg 1) (match_operand 1 "reg_or_short_operand" "")))
11911 (minus (reg 1) (match_dup 1)))]
11914 { rtx chain = gen_reg_rtx (Pmode);
11915 rtx stack_bot = gen_rtx_MEM (Pmode, stack_pointer_rtx);
11917 rtx insn, par, set, mem;
11919 emit_move_insn (chain, stack_bot);
11921 /* Check stack bounds if necessary. */
11922 if (crtl->limit_stack)
11925 available = expand_binop (Pmode, sub_optab,
11926 stack_pointer_rtx, stack_limit_rtx,
11927 NULL_RTX, 1, OPTAB_WIDEN);
11928 emit_insn (gen_cond_trap (LTU, available, operands[1], const0_rtx));
11931 if (GET_CODE (operands[1]) != CONST_INT
11932 || INTVAL (operands[1]) < -32767
11933 || INTVAL (operands[1]) > 32768)
11935 neg_op0 = gen_reg_rtx (Pmode);
11937 emit_insn (gen_negsi2 (neg_op0, operands[1]));
11939 emit_insn (gen_negdi2 (neg_op0, operands[1]));
11942 neg_op0 = GEN_INT (- INTVAL (operands[1]));
11944 insn = emit_insn ((* ((TARGET_32BIT) ? gen_movsi_update_stack
11945 : gen_movdi_di_update_stack))
11946 (stack_pointer_rtx, stack_pointer_rtx, neg_op0,
11948 /* Since we didn't use gen_frame_mem to generate the MEM, grab
11949 it now and set the alias set/attributes. The above gen_*_update
11950 calls will generate a PARALLEL with the MEM set being the first
11952 par = PATTERN (insn);
11953 gcc_assert (GET_CODE (par) == PARALLEL);
11954 set = XVECEXP (par, 0, 0);
11955 gcc_assert (GET_CODE (set) == SET);
11956 mem = SET_DEST (set);
11957 gcc_assert (MEM_P (mem));
11958 MEM_NOTRAP_P (mem) = 1;
11959 set_mem_alias_set (mem, get_frame_alias_set ());
11961 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
11965 ;; These patterns say how to save and restore the stack pointer. We need not
11966 ;; save the stack pointer at function level since we are careful to
11967 ;; preserve the backchain. At block level, we have to restore the backchain
11968 ;; when we restore the stack pointer.
11970 ;; For nonlocal gotos, we must save both the stack pointer and its
11971 ;; backchain and restore both. Note that in the nonlocal case, the
11972 ;; save area is a memory location.
11974 (define_expand "save_stack_function"
11975 [(match_operand 0 "any_operand" "")
11976 (match_operand 1 "any_operand" "")]
11980 (define_expand "restore_stack_function"
11981 [(match_operand 0 "any_operand" "")
11982 (match_operand 1 "any_operand" "")]
11986 ;; Adjust stack pointer (op0) to a new value (op1).
11987 ;; First copy old stack backchain to new location, and ensure that the
11988 ;; scheduler won't reorder the sp assignment before the backchain write.
11989 (define_expand "restore_stack_block"
11990 [(set (match_dup 2) (match_dup 3))
11991 (set (match_dup 4) (match_dup 2))
11992 (set (match_dup 5) (unspec:BLK [(match_dup 5)] UNSPEC_TIE))
11993 (set (match_operand 0 "register_operand" "")
11994 (match_operand 1 "register_operand" ""))]
11998 operands[1] = force_reg (Pmode, operands[1]);
11999 operands[2] = gen_reg_rtx (Pmode);
12000 operands[3] = gen_frame_mem (Pmode, operands[0]);
12001 operands[4] = gen_frame_mem (Pmode, operands[1]);
12002 operands[5] = gen_frame_mem (BLKmode, operands[0]);
12005 (define_expand "save_stack_nonlocal"
12006 [(set (match_dup 3) (match_dup 4))
12007 (set (match_operand 0 "memory_operand" "") (match_dup 3))
12008 (set (match_dup 2) (match_operand 1 "register_operand" ""))]
12012 int units_per_word = (TARGET_32BIT) ? 4 : 8;
12014 /* Copy the backchain to the first word, sp to the second. */
12015 operands[0] = adjust_address_nv (operands[0], Pmode, 0);
12016 operands[2] = adjust_address_nv (operands[0], Pmode, units_per_word);
12017 operands[3] = gen_reg_rtx (Pmode);
12018 operands[4] = gen_frame_mem (Pmode, operands[1]);
12021 (define_expand "restore_stack_nonlocal"
12022 [(set (match_dup 2) (match_operand 1 "memory_operand" ""))
12023 (set (match_dup 3) (match_dup 4))
12024 (set (match_dup 5) (match_dup 2))
12025 (set (match_dup 6) (unspec:BLK [(match_dup 6)] UNSPEC_TIE))
12026 (set (match_operand 0 "register_operand" "") (match_dup 3))]
12030 int units_per_word = (TARGET_32BIT) ? 4 : 8;
12032 /* Restore the backchain from the first word, sp from the second. */
12033 operands[2] = gen_reg_rtx (Pmode);
12034 operands[3] = gen_reg_rtx (Pmode);
12035 operands[1] = adjust_address_nv (operands[1], Pmode, 0);
12036 operands[4] = adjust_address_nv (operands[1], Pmode, units_per_word);
12037 operands[5] = gen_frame_mem (Pmode, operands[3]);
12038 operands[6] = gen_frame_mem (BLKmode, operands[0]);
12041 ;; TOC register handling.
12043 ;; Code to initialize the TOC register...
12045 (define_insn "load_toc_aix_si"
12046 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12047 (unspec:SI [(const_int 0)] UNSPEC_TOC))
12048 (use (reg:SI 2))])]
12049 "DEFAULT_ABI == ABI_AIX && TARGET_32BIT"
12053 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
12054 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
12055 operands[2] = gen_rtx_REG (Pmode, 2);
12056 return \"{l|lwz} %0,%1(%2)\";
12058 [(set_attr "type" "load")])
12060 (define_insn "load_toc_aix_di"
12061 [(parallel [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12062 (unspec:DI [(const_int 0)] UNSPEC_TOC))
12063 (use (reg:DI 2))])]
12064 "DEFAULT_ABI == ABI_AIX && TARGET_64BIT"
12068 #ifdef TARGET_RELOCATABLE
12069 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\",
12070 !TARGET_MINIMAL_TOC || TARGET_RELOCATABLE);
12072 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
12075 strcat (buf, \"@toc\");
12076 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
12077 operands[2] = gen_rtx_REG (Pmode, 2);
12078 return \"ld %0,%1(%2)\";
12080 [(set_attr "type" "load")])
12082 (define_insn "load_toc_v4_pic_si"
12083 [(set (reg:SI LR_REGNO)
12084 (unspec:SI [(const_int 0)] UNSPEC_TOC))]
12085 "DEFAULT_ABI == ABI_V4 && flag_pic == 1 && TARGET_32BIT"
12086 "bl _GLOBAL_OFFSET_TABLE_@local-4"
12087 [(set_attr "type" "branch")
12088 (set_attr "length" "4")])
12090 (define_insn "load_toc_v4_PIC_1"
12091 [(set (reg:SI LR_REGNO)
12092 (match_operand:SI 0 "immediate_operand" "s"))
12093 (use (unspec [(match_dup 0)] UNSPEC_TOC))]
12094 "TARGET_ELF && DEFAULT_ABI != ABI_AIX
12095 && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
12096 "bcl 20,31,%0\\n%0:"
12097 [(set_attr "type" "branch")
12098 (set_attr "length" "4")])
12100 (define_insn "load_toc_v4_PIC_1b"
12101 [(set (reg:SI LR_REGNO)
12102 (unspec:SI [(match_operand:SI 0 "immediate_operand" "s")
12103 (label_ref (match_operand 1 "" ""))]
12106 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
12107 "bcl 20,31,$+8\;.long %0-$"
12108 [(set_attr "type" "branch")
12109 (set_attr "length" "8")])
12111 (define_insn "load_toc_v4_PIC_2"
12112 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12113 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
12114 (minus:SI (match_operand:SI 2 "immediate_operand" "s")
12115 (match_operand:SI 3 "immediate_operand" "s")))))]
12116 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
12117 "{l|lwz} %0,%2-%3(%1)"
12118 [(set_attr "type" "load")])
12120 (define_insn "load_toc_v4_PIC_3b"
12121 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12122 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
12124 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
12125 (match_operand:SI 3 "symbol_ref_operand" "s")))))]
12126 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
12127 "{cau|addis} %0,%1,%2-%3@ha")
12129 (define_insn "load_toc_v4_PIC_3c"
12130 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12131 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
12132 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
12133 (match_operand:SI 3 "symbol_ref_operand" "s"))))]
12134 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
12135 "{cal %0,%2-%3@l(%1)|addi %0,%1,%2-%3@l}")
12137 ;; If the TOC is shared over a translation unit, as happens with all
12138 ;; the kinds of PIC that we support, we need to restore the TOC
12139 ;; pointer only when jumping over units of translation.
12140 ;; On Darwin, we need to reload the picbase.
12142 (define_expand "builtin_setjmp_receiver"
12143 [(use (label_ref (match_operand 0 "" "")))]
12144 "(DEFAULT_ABI == ABI_V4 && flag_pic == 1)
12145 || (TARGET_TOC && TARGET_MINIMAL_TOC)
12146 || (DEFAULT_ABI == ABI_DARWIN && flag_pic)"
12150 if (DEFAULT_ABI == ABI_DARWIN)
12152 rtx picrtx = gen_rtx_SYMBOL_REF (Pmode, MACHOPIC_FUNCTION_BASE_NAME);
12153 rtx picreg = gen_rtx_REG (Pmode, RS6000_PIC_OFFSET_TABLE_REGNUM);
12157 crtl->uses_pic_offset_table = 1;
12158 ASM_GENERATE_INTERNAL_LABEL(tmplab, \"LSJR\",
12159 CODE_LABEL_NUMBER (operands[0]));
12160 tmplabrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (tmplab));
12162 emit_insn (gen_load_macho_picbase (tmplabrtx));
12163 emit_move_insn (picreg, gen_rtx_REG (Pmode, LR_REGNO));
12164 emit_insn (gen_macho_correct_pic (picreg, picreg, picrtx, tmplabrtx));
12168 rs6000_emit_load_toc_table (FALSE);
12172 ;; Elf specific ways of loading addresses for non-PIC code.
12173 ;; The output of this could be r0, but we make a very strong
12174 ;; preference for a base register because it will usually
12175 ;; be needed there.
12176 (define_insn "elf_high"
12177 [(set (match_operand:SI 0 "gpc_reg_operand" "=b*r")
12178 (high:SI (match_operand 1 "" "")))]
12179 "TARGET_ELF && ! TARGET_64BIT"
12180 "{liu|lis} %0,%1@ha")
12182 (define_insn "elf_low"
12183 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12184 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,!*r")
12185 (match_operand 2 "" "")))]
12186 "TARGET_ELF && ! TARGET_64BIT"
12188 {cal|la} %0,%2@l(%1)
12189 {ai|addic} %0,%1,%K2")
12191 ;; Largetoc support
12192 (define_insn "largetoc_high"
12193 [(set (match_operand:DI 0 "gpc_reg_operand" "=b")
12195 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "b")
12196 (high:DI (match_operand:DI 2 "" "")))))]
12197 "TARGET_ELF && TARGET_CMODEL != CMODEL_SMALL"
12198 "{cau|addis} %0,%1,%2@ha")
12200 (define_insn "largetoc_low"
12201 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12202 (lo_sum:DI (match_operand:DI 1 "gpc_reg_operand" "b")
12203 (match_operand:DI 2 "" "")))]
12204 "TARGET_ELF && TARGET_CMODEL != CMODEL_SMALL"
12205 "{cal %0,%2@l(%1)|addi %0,%1,%2@l}")
12207 ;; Call and call_value insns
12208 (define_expand "call"
12209 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
12210 (match_operand 1 "" ""))
12211 (use (match_operand 2 "" ""))
12212 (clobber (reg:SI LR_REGNO))])]
12217 if (MACHOPIC_INDIRECT)
12218 operands[0] = machopic_indirect_call_target (operands[0]);
12221 gcc_assert (GET_CODE (operands[0]) == MEM);
12222 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
12224 operands[0] = XEXP (operands[0], 0);
12226 if (GET_CODE (operands[0]) != SYMBOL_REF
12227 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[0]))
12228 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[2]) & CALL_LONG) != 0))
12230 if (INTVAL (operands[2]) & CALL_LONG)
12231 operands[0] = rs6000_longcall_ref (operands[0]);
12233 switch (DEFAULT_ABI)
12237 operands[0] = force_reg (Pmode, operands[0]);
12241 /* AIX function pointers are really pointers to a three word
12243 rs6000_call_indirect_aix (NULL_RTX, operands[0], operands[1]);
12247 gcc_unreachable ();
12252 (define_expand "call_value"
12253 [(parallel [(set (match_operand 0 "" "")
12254 (call (mem:SI (match_operand 1 "address_operand" ""))
12255 (match_operand 2 "" "")))
12256 (use (match_operand 3 "" ""))
12257 (clobber (reg:SI LR_REGNO))])]
12262 if (MACHOPIC_INDIRECT)
12263 operands[1] = machopic_indirect_call_target (operands[1]);
12266 gcc_assert (GET_CODE (operands[1]) == MEM);
12267 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
12269 operands[1] = XEXP (operands[1], 0);
12271 if (GET_CODE (operands[1]) != SYMBOL_REF
12272 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[1]))
12273 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[3]) & CALL_LONG) != 0))
12275 if (INTVAL (operands[3]) & CALL_LONG)
12276 operands[1] = rs6000_longcall_ref (operands[1]);
12278 switch (DEFAULT_ABI)
12282 operands[1] = force_reg (Pmode, operands[1]);
12286 /* AIX function pointers are really pointers to a three word
12288 rs6000_call_indirect_aix (operands[0], operands[1], operands[2]);
12292 gcc_unreachable ();
12297 ;; Call to function in current module. No TOC pointer reload needed.
12298 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
12299 ;; either the function was not prototyped, or it was prototyped as a
12300 ;; variable argument function. It is > 0 if FP registers were passed
12301 ;; and < 0 if they were not.
12303 (define_insn "*call_local32"
12304 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
12305 (match_operand 1 "" "g,g"))
12306 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12307 (clobber (reg:SI LR_REGNO))]
12308 "(INTVAL (operands[2]) & CALL_LONG) == 0"
12311 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12312 output_asm_insn (\"crxor 6,6,6\", operands);
12314 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12315 output_asm_insn (\"creqv 6,6,6\", operands);
12317 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
12319 [(set_attr "type" "branch")
12320 (set_attr "length" "4,8")])
12322 (define_insn "*call_local64"
12323 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
12324 (match_operand 1 "" "g,g"))
12325 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12326 (clobber (reg:SI LR_REGNO))]
12327 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
12330 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12331 output_asm_insn (\"crxor 6,6,6\", operands);
12333 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12334 output_asm_insn (\"creqv 6,6,6\", operands);
12336 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
12338 [(set_attr "type" "branch")
12339 (set_attr "length" "4,8")])
12341 (define_insn "*call_value_local32"
12342 [(set (match_operand 0 "" "")
12343 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
12344 (match_operand 2 "" "g,g")))
12345 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12346 (clobber (reg:SI LR_REGNO))]
12347 "(INTVAL (operands[3]) & CALL_LONG) == 0"
12350 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12351 output_asm_insn (\"crxor 6,6,6\", operands);
12353 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12354 output_asm_insn (\"creqv 6,6,6\", operands);
12356 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
12358 [(set_attr "type" "branch")
12359 (set_attr "length" "4,8")])
12362 (define_insn "*call_value_local64"
12363 [(set (match_operand 0 "" "")
12364 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
12365 (match_operand 2 "" "g,g")))
12366 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12367 (clobber (reg:SI LR_REGNO))]
12368 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
12371 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12372 output_asm_insn (\"crxor 6,6,6\", operands);
12374 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12375 output_asm_insn (\"creqv 6,6,6\", operands);
12377 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
12379 [(set_attr "type" "branch")
12380 (set_attr "length" "4,8")])
12382 ;; Call to indirect functions with the AIX abi using a 3 word descriptor.
12383 ;; Operand0 is the addresss of the function to call
12384 ;; Operand1 is the flag for System V.4 for unprototyped or FP registers
12385 ;; Operand2 is the location in the function descriptor to load r2 from
12386 ;; Operand3 is the stack location to hold the current TOC pointer
12388 (define_insn "call_indirect_aix<ptrsize>"
12389 [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l"))
12390 (match_operand 1 "" "g,g"))
12391 (use (match_operand:P 2 "memory_operand" "m,m"))
12392 (set (reg:P TOC_REGNUM) (match_operand:P 3 "memory_operand" "m,m"))
12393 (use (reg:P STATIC_CHAIN_REGNUM))
12394 (clobber (reg:P LR_REGNO))]
12395 "DEFAULT_ABI == ABI_AIX && TARGET_POINTERS_TO_NESTED_FUNCTIONS"
12396 "<ptrload> 2,%2\;b%T0l\;<ptrload> 2,%3"
12397 [(set_attr "type" "jmpreg")
12398 (set_attr "length" "12")])
12400 ;; Like call_indirect_aix<ptrsize>, but no use of the static chain
12401 ;; Operand0 is the addresss of the function to call
12402 ;; Operand1 is the flag for System V.4 for unprototyped or FP registers
12403 ;; Operand2 is the location in the function descriptor to load r2 from
12404 ;; Operand3 is the stack location to hold the current TOC pointer
12406 (define_insn "call_indirect_aix<ptrsize>_nor11"
12407 [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l"))
12408 (match_operand 1 "" "g,g"))
12409 (use (match_operand:P 2 "memory_operand" "m,m"))
12410 (set (reg:P TOC_REGNUM) (match_operand:P 3 "memory_operand" "m,m"))
12411 (clobber (reg:P LR_REGNO))]
12412 "DEFAULT_ABI == ABI_AIX && !TARGET_POINTERS_TO_NESTED_FUNCTIONS"
12413 "<ptrload> 2,%2\;b%T0l\;<ptrload> 2,%3"
12414 [(set_attr "type" "jmpreg")
12415 (set_attr "length" "12")])
12417 ;; Operand0 is the return result of the function
12418 ;; Operand1 is the addresss of the function to call
12419 ;; Operand2 is the flag for System V.4 for unprototyped or FP registers
12420 ;; Operand3 is the location in the function descriptor to load r2 from
12421 ;; Operand4 is the stack location to hold the current TOC pointer
12423 (define_insn "call_value_indirect_aix<ptrsize>"
12424 [(set (match_operand 0 "" "")
12425 (call (mem:SI (match_operand:P 1 "register_operand" "c,*l"))
12426 (match_operand 2 "" "g,g")))
12427 (use (match_operand:P 3 "memory_operand" "m,m"))
12428 (set (reg:P TOC_REGNUM) (match_operand:P 4 "memory_operand" "m,m"))
12429 (use (reg:P STATIC_CHAIN_REGNUM))
12430 (clobber (reg:P LR_REGNO))]
12431 "DEFAULT_ABI == ABI_AIX && TARGET_POINTERS_TO_NESTED_FUNCTIONS"
12432 "<ptrload> 2,%3\;b%T1l\;<ptrload> 2,%4"
12433 [(set_attr "type" "jmpreg")
12434 (set_attr "length" "12")])
12436 ;; Like call_value_indirect_aix<ptrsize>, but no use of the static chain
12437 ;; Operand0 is the return result of the function
12438 ;; Operand1 is the addresss of the function to call
12439 ;; Operand2 is the flag for System V.4 for unprototyped or FP registers
12440 ;; Operand3 is the location in the function descriptor to load r2 from
12441 ;; Operand4 is the stack location to hold the current TOC pointer
12443 (define_insn "call_value_indirect_aix<ptrsize>_nor11"
12444 [(set (match_operand 0 "" "")
12445 (call (mem:SI (match_operand:P 1 "register_operand" "c,*l"))
12446 (match_operand 2 "" "g,g")))
12447 (use (match_operand:P 3 "memory_operand" "m,m"))
12448 (set (reg:P TOC_REGNUM) (match_operand:P 4 "memory_operand" "m,m"))
12449 (clobber (reg:P LR_REGNO))]
12450 "DEFAULT_ABI == ABI_AIX && !TARGET_POINTERS_TO_NESTED_FUNCTIONS"
12451 "<ptrload> 2,%3\;b%T1l\;<ptrload> 2,%4"
12452 [(set_attr "type" "jmpreg")
12453 (set_attr "length" "12")])
12455 ;; Call to function which may be in another module. Restore the TOC
12456 ;; pointer (r2) after the call unless this is System V.
12457 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
12458 ;; either the function was not prototyped, or it was prototyped as a
12459 ;; variable argument function. It is > 0 if FP registers were passed
12460 ;; and < 0 if they were not.
12462 (define_insn "*call_nonlocal_aix32"
12463 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
12464 (match_operand 1 "" "g"))
12465 (use (match_operand:SI 2 "immediate_operand" "O"))
12466 (clobber (reg:SI LR_REGNO))]
12468 && DEFAULT_ABI == ABI_AIX
12469 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12471 [(set_attr "type" "branch")
12472 (set_attr "length" "8")])
12474 (define_insn "*call_nonlocal_aix64"
12475 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
12476 (match_operand 1 "" "g"))
12477 (use (match_operand:SI 2 "immediate_operand" "O"))
12478 (clobber (reg:SI LR_REGNO))]
12480 && DEFAULT_ABI == ABI_AIX
12481 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12483 [(set_attr "type" "branch")
12484 (set_attr "length" "8")])
12486 (define_insn "*call_value_nonlocal_aix32"
12487 [(set (match_operand 0 "" "")
12488 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
12489 (match_operand 2 "" "g")))
12490 (use (match_operand:SI 3 "immediate_operand" "O"))
12491 (clobber (reg:SI LR_REGNO))]
12493 && DEFAULT_ABI == ABI_AIX
12494 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12496 [(set_attr "type" "branch")
12497 (set_attr "length" "8")])
12499 (define_insn "*call_value_nonlocal_aix64"
12500 [(set (match_operand 0 "" "")
12501 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
12502 (match_operand 2 "" "g")))
12503 (use (match_operand:SI 3 "immediate_operand" "O"))
12504 (clobber (reg:SI LR_REGNO))]
12506 && DEFAULT_ABI == ABI_AIX
12507 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12509 [(set_attr "type" "branch")
12510 (set_attr "length" "8")])
12512 ;; A function pointer under System V is just a normal pointer
12513 ;; operands[0] is the function pointer
12514 ;; operands[1] is the stack size to clean up
12515 ;; operands[2] is the value FUNCTION_ARG returns for the VOID argument
12516 ;; which indicates how to set cr1
12518 (define_insn "*call_indirect_nonlocal_sysv<mode>"
12519 [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l,c,*l"))
12520 (match_operand 1 "" "g,g,g,g"))
12521 (use (match_operand:SI 2 "immediate_operand" "O,O,n,n"))
12522 (clobber (reg:SI LR_REGNO))]
12523 "DEFAULT_ABI == ABI_V4
12524 || DEFAULT_ABI == ABI_DARWIN"
12526 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12527 output_asm_insn ("crxor 6,6,6", operands);
12529 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12530 output_asm_insn ("creqv 6,6,6", operands);
12534 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
12535 (set_attr "length" "4,4,8,8")])
12537 (define_insn_and_split "*call_nonlocal_sysv<mode>"
12538 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
12539 (match_operand 1 "" "g,g"))
12540 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12541 (clobber (reg:SI LR_REGNO))]
12542 "(DEFAULT_ABI == ABI_DARWIN
12543 || (DEFAULT_ABI == ABI_V4
12544 && (INTVAL (operands[2]) & CALL_LONG) == 0))"
12546 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12547 output_asm_insn ("crxor 6,6,6", operands);
12549 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12550 output_asm_insn ("creqv 6,6,6", operands);
12553 return output_call(insn, operands, 0, 2);
12555 if (DEFAULT_ABI == ABI_V4 && flag_pic)
12557 gcc_assert (!TARGET_SECURE_PLT);
12558 return "bl %z0@plt";
12564 "DEFAULT_ABI == ABI_V4
12565 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[0])
12566 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12567 [(parallel [(call (mem:SI (match_dup 0))
12569 (use (match_dup 2))
12570 (use (match_dup 3))
12571 (clobber (reg:SI LR_REGNO))])]
12573 operands[3] = pic_offset_table_rtx;
12575 [(set_attr "type" "branch,branch")
12576 (set_attr "length" "4,8")])
12578 (define_insn "*call_nonlocal_sysv_secure<mode>"
12579 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
12580 (match_operand 1 "" "g,g"))
12581 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12582 (use (match_operand:SI 3 "register_operand" "r,r"))
12583 (clobber (reg:SI LR_REGNO))]
12584 "(DEFAULT_ABI == ABI_V4
12585 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[0])
12586 && (INTVAL (operands[2]) & CALL_LONG) == 0)"
12588 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12589 output_asm_insn ("crxor 6,6,6", operands);
12591 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12592 output_asm_insn ("creqv 6,6,6", operands);
12595 /* The magic 32768 offset here and in the other sysv call insns
12596 corresponds to the offset of r30 in .got2, as given by LCTOC1.
12597 See sysv4.h:toc_section. */
12598 return "bl %z0+32768@plt";
12600 return "bl %z0@plt";
12602 [(set_attr "type" "branch,branch")
12603 (set_attr "length" "4,8")])
12605 (define_insn "*call_value_indirect_nonlocal_sysv<mode>"
12606 [(set (match_operand 0 "" "")
12607 (call (mem:SI (match_operand:P 1 "register_operand" "c,*l,c,*l"))
12608 (match_operand 2 "" "g,g,g,g")))
12609 (use (match_operand:SI 3 "immediate_operand" "O,O,n,n"))
12610 (clobber (reg:SI LR_REGNO))]
12611 "DEFAULT_ABI == ABI_V4
12612 || DEFAULT_ABI == ABI_DARWIN"
12614 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12615 output_asm_insn ("crxor 6,6,6", operands);
12617 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12618 output_asm_insn ("creqv 6,6,6", operands);
12622 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
12623 (set_attr "length" "4,4,8,8")])
12625 (define_insn_and_split "*call_value_nonlocal_sysv<mode>"
12626 [(set (match_operand 0 "" "")
12627 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
12628 (match_operand 2 "" "g,g")))
12629 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12630 (clobber (reg:SI LR_REGNO))]
12631 "(DEFAULT_ABI == ABI_DARWIN
12632 || (DEFAULT_ABI == ABI_V4
12633 && (INTVAL (operands[3]) & CALL_LONG) == 0))"
12635 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12636 output_asm_insn ("crxor 6,6,6", operands);
12638 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12639 output_asm_insn ("creqv 6,6,6", operands);
12642 return output_call(insn, operands, 1, 3);
12644 if (DEFAULT_ABI == ABI_V4 && flag_pic)
12646 gcc_assert (!TARGET_SECURE_PLT);
12647 return "bl %z1@plt";
12653 "DEFAULT_ABI == ABI_V4
12654 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[1])
12655 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12656 [(parallel [(set (match_dup 0)
12657 (call (mem:SI (match_dup 1))
12659 (use (match_dup 3))
12660 (use (match_dup 4))
12661 (clobber (reg:SI LR_REGNO))])]
12663 operands[4] = pic_offset_table_rtx;
12665 [(set_attr "type" "branch,branch")
12666 (set_attr "length" "4,8")])
12668 (define_insn "*call_value_nonlocal_sysv_secure<mode>"
12669 [(set (match_operand 0 "" "")
12670 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
12671 (match_operand 2 "" "g,g")))
12672 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12673 (use (match_operand:SI 4 "register_operand" "r,r"))
12674 (clobber (reg:SI LR_REGNO))]
12675 "(DEFAULT_ABI == ABI_V4
12676 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[1])
12677 && (INTVAL (operands[3]) & CALL_LONG) == 0)"
12679 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12680 output_asm_insn ("crxor 6,6,6", operands);
12682 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12683 output_asm_insn ("creqv 6,6,6", operands);
12686 return "bl %z1+32768@plt";
12688 return "bl %z1@plt";
12690 [(set_attr "type" "branch,branch")
12691 (set_attr "length" "4,8")])
12693 ;; Call subroutine returning any type.
12694 (define_expand "untyped_call"
12695 [(parallel [(call (match_operand 0 "" "")
12697 (match_operand 1 "" "")
12698 (match_operand 2 "" "")])]
12704 emit_call_insn (GEN_CALL (operands[0], const0_rtx, const0_rtx, const0_rtx));
12706 for (i = 0; i < XVECLEN (operands[2], 0); i++)
12708 rtx set = XVECEXP (operands[2], 0, i);
12709 emit_move_insn (SET_DEST (set), SET_SRC (set));
12712 /* The optimizer does not know that the call sets the function value
12713 registers we stored in the result block. We avoid problems by
12714 claiming that all hard registers are used and clobbered at this
12716 emit_insn (gen_blockage ());
12721 ;; sibling call patterns
12722 (define_expand "sibcall"
12723 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
12724 (match_operand 1 "" ""))
12725 (use (match_operand 2 "" ""))
12726 (use (reg:SI LR_REGNO))
12732 if (MACHOPIC_INDIRECT)
12733 operands[0] = machopic_indirect_call_target (operands[0]);
12736 gcc_assert (GET_CODE (operands[0]) == MEM);
12737 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
12739 operands[0] = XEXP (operands[0], 0);
12742 ;; this and similar patterns must be marked as using LR, otherwise
12743 ;; dataflow will try to delete the store into it. This is true
12744 ;; even when the actual reg to jump to is in CTR, when LR was
12745 ;; saved and restored around the PIC-setting BCL.
12746 (define_insn "*sibcall_local32"
12747 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
12748 (match_operand 1 "" "g,g"))
12749 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12750 (use (reg:SI LR_REGNO))
12752 "(INTVAL (operands[2]) & CALL_LONG) == 0"
12755 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12756 output_asm_insn (\"crxor 6,6,6\", operands);
12758 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12759 output_asm_insn (\"creqv 6,6,6\", operands);
12761 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
12763 [(set_attr "type" "branch")
12764 (set_attr "length" "4,8")])
12766 (define_insn "*sibcall_local64"
12767 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
12768 (match_operand 1 "" "g,g"))
12769 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12770 (use (reg:SI LR_REGNO))
12772 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
12775 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12776 output_asm_insn (\"crxor 6,6,6\", operands);
12778 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12779 output_asm_insn (\"creqv 6,6,6\", operands);
12781 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
12783 [(set_attr "type" "branch")
12784 (set_attr "length" "4,8")])
12786 (define_insn "*sibcall_value_local32"
12787 [(set (match_operand 0 "" "")
12788 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
12789 (match_operand 2 "" "g,g")))
12790 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12791 (use (reg:SI LR_REGNO))
12793 "(INTVAL (operands[3]) & CALL_LONG) == 0"
12796 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12797 output_asm_insn (\"crxor 6,6,6\", operands);
12799 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12800 output_asm_insn (\"creqv 6,6,6\", operands);
12802 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
12804 [(set_attr "type" "branch")
12805 (set_attr "length" "4,8")])
12808 (define_insn "*sibcall_value_local64"
12809 [(set (match_operand 0 "" "")
12810 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
12811 (match_operand 2 "" "g,g")))
12812 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12813 (use (reg:SI LR_REGNO))
12815 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
12818 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12819 output_asm_insn (\"crxor 6,6,6\", operands);
12821 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12822 output_asm_insn (\"creqv 6,6,6\", operands);
12824 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
12826 [(set_attr "type" "branch")
12827 (set_attr "length" "4,8")])
12829 (define_insn "*sibcall_nonlocal_aix<mode>"
12830 [(call (mem:SI (match_operand:P 0 "call_operand" "s,c"))
12831 (match_operand 1 "" "g,g"))
12832 (use (match_operand:SI 2 "immediate_operand" "O,O"))
12833 (use (reg:SI LR_REGNO))
12835 "DEFAULT_ABI == ABI_AIX
12836 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12840 [(set_attr "type" "branch")
12841 (set_attr "length" "4")])
12843 (define_insn "*sibcall_value_nonlocal_aix<mode>"
12844 [(set (match_operand 0 "" "")
12845 (call (mem:SI (match_operand:P 1 "call_operand" "s,c"))
12846 (match_operand 2 "" "g,g")))
12847 (use (match_operand:SI 3 "immediate_operand" "O,O"))
12848 (use (reg:SI LR_REGNO))
12850 "DEFAULT_ABI == ABI_AIX
12851 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12855 [(set_attr "type" "branch")
12856 (set_attr "length" "4")])
12858 (define_insn "*sibcall_nonlocal_sysv<mode>"
12859 [(call (mem:SI (match_operand:P 0 "call_operand" "s,s,c,c"))
12860 (match_operand 1 "" ""))
12861 (use (match_operand 2 "immediate_operand" "O,n,O,n"))
12862 (use (reg:SI LR_REGNO))
12864 "(DEFAULT_ABI == ABI_DARWIN
12865 || DEFAULT_ABI == ABI_V4)
12866 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12869 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12870 output_asm_insn (\"crxor 6,6,6\", operands);
12872 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12873 output_asm_insn (\"creqv 6,6,6\", operands);
12875 if (which_alternative >= 2)
12877 else if (DEFAULT_ABI == ABI_V4 && flag_pic)
12879 gcc_assert (!TARGET_SECURE_PLT);
12880 return \"b %z0@plt\";
12885 [(set_attr "type" "branch")
12886 (set_attr "length" "4,8,4,8")])
12888 (define_expand "sibcall_value"
12889 [(parallel [(set (match_operand 0 "register_operand" "")
12890 (call (mem:SI (match_operand 1 "address_operand" ""))
12891 (match_operand 2 "" "")))
12892 (use (match_operand 3 "" ""))
12893 (use (reg:SI LR_REGNO))
12899 if (MACHOPIC_INDIRECT)
12900 operands[1] = machopic_indirect_call_target (operands[1]);
12903 gcc_assert (GET_CODE (operands[1]) == MEM);
12904 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
12906 operands[1] = XEXP (operands[1], 0);
12909 (define_insn "*sibcall_value_nonlocal_sysv<mode>"
12910 [(set (match_operand 0 "" "")
12911 (call (mem:SI (match_operand:P 1 "call_operand" "s,s,c,c"))
12912 (match_operand 2 "" "")))
12913 (use (match_operand:SI 3 "immediate_operand" "O,n,O,n"))
12914 (use (reg:SI LR_REGNO))
12916 "(DEFAULT_ABI == ABI_DARWIN
12917 || DEFAULT_ABI == ABI_V4)
12918 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12921 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12922 output_asm_insn (\"crxor 6,6,6\", operands);
12924 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12925 output_asm_insn (\"creqv 6,6,6\", operands);
12927 if (which_alternative >= 2)
12929 else if (DEFAULT_ABI == ABI_V4 && flag_pic)
12931 gcc_assert (!TARGET_SECURE_PLT);
12932 return \"b %z1@plt\";
12937 [(set_attr "type" "branch")
12938 (set_attr "length" "4,8,4,8")])
12940 (define_expand "sibcall_epilogue"
12941 [(use (const_int 0))]
12944 if (!TARGET_SCHED_PROLOG)
12945 emit_insn (gen_blockage ());
12946 rs6000_emit_epilogue (TRUE);
12950 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
12951 ;; all of memory. This blocks insns from being moved across this point.
12953 (define_insn "blockage"
12954 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCK)]
12958 (define_insn "probe_stack"
12959 [(set (match_operand 0 "memory_operand" "=m")
12960 (unspec [(const_int 0)] UNSPEC_PROBE_STACK))]
12964 operands[1] = gen_rtx_REG (Pmode, 0);
12965 return \"{st%U0%X0|stw%U0%X0} %1,%0\";
12967 [(set_attr "type" "store")
12968 (set_attr "length" "4")])
12970 (define_insn "probe_stack_range<P:mode>"
12971 [(set (match_operand:P 0 "register_operand" "=r")
12972 (unspec_volatile:P [(match_operand:P 1 "register_operand" "0")
12973 (match_operand:P 2 "register_operand" "r")]
12974 UNSPECV_PROBE_STACK_RANGE))]
12976 "* return output_probe_stack_range (operands[0], operands[2]);"
12977 [(set_attr "type" "three")])
12979 ;; Compare insns are next. Note that the RS/6000 has two types of compares,
12980 ;; signed & unsigned, and one type of branch.
12982 ;; Start with the DEFINE_EXPANDs to generate the rtl for compares, scc
12983 ;; insns, and branches.
12985 (define_expand "cbranch<mode>4"
12986 [(use (match_operator 0 "rs6000_cbranch_operator"
12987 [(match_operand:GPR 1 "gpc_reg_operand" "")
12988 (match_operand:GPR 2 "reg_or_short_operand" "")]))
12989 (use (match_operand 3 ""))]
12993 /* Take care of the possibility that operands[2] might be negative but
12994 this might be a logical operation. That insn doesn't exist. */
12995 if (GET_CODE (operands[2]) == CONST_INT
12996 && INTVAL (operands[2]) < 0)
12998 operands[2] = force_reg (<MODE>mode, operands[2]);
12999 operands[0] = gen_rtx_fmt_ee (GET_CODE (operands[0]),
13000 GET_MODE (operands[0]),
13001 operands[1], operands[2]);
13004 rs6000_emit_cbranch (<MODE>mode, operands);
13008 (define_expand "cbranch<mode>4"
13009 [(use (match_operator 0 "rs6000_cbranch_operator"
13010 [(match_operand:FP 1 "gpc_reg_operand" "")
13011 (match_operand:FP 2 "gpc_reg_operand" "")]))
13012 (use (match_operand 3 ""))]
13016 rs6000_emit_cbranch (<MODE>mode, operands);
13020 (define_expand "cstore<mode>4"
13021 [(use (match_operator 1 "rs6000_cbranch_operator"
13022 [(match_operand:GPR 2 "gpc_reg_operand" "")
13023 (match_operand:GPR 3 "reg_or_short_operand" "")]))
13024 (clobber (match_operand:SI 0 "register_operand"))]
13028 /* Take care of the possibility that operands[3] might be negative but
13029 this might be a logical operation. That insn doesn't exist. */
13030 if (GET_CODE (operands[3]) == CONST_INT
13031 && INTVAL (operands[3]) < 0)
13033 operands[3] = force_reg (<MODE>mode, operands[3]);
13034 operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]),
13035 GET_MODE (operands[1]),
13036 operands[2], operands[3]);
13039 /* For SNE, we would prefer that the xor/abs sequence be used for integers.
13040 For SEQ, likewise, except that comparisons with zero should be done
13041 with an scc insns. However, due to the order that combine see the
13042 resulting insns, we must, in fact, allow SEQ for integers. Fail in
13043 the cases we don't want to handle or are best handled by portable
13045 if (GET_CODE (operands[1]) == NE)
13047 if ((GET_CODE (operands[1]) == LT || GET_CODE (operands[1]) == LE
13048 || GET_CODE (operands[1]) == GT || GET_CODE (operands[1]) == GE)
13049 && operands[3] == const0_rtx)
13051 rs6000_emit_sCOND (<MODE>mode, operands);
13055 (define_expand "cstore<mode>4"
13056 [(use (match_operator 1 "rs6000_cbranch_operator"
13057 [(match_operand:FP 2 "gpc_reg_operand" "")
13058 (match_operand:FP 3 "gpc_reg_operand" "")]))
13059 (clobber (match_operand:SI 0 "register_operand"))]
13063 rs6000_emit_sCOND (<MODE>mode, operands);
13068 (define_expand "stack_protect_set"
13069 [(match_operand 0 "memory_operand" "")
13070 (match_operand 1 "memory_operand" "")]
13073 #ifdef TARGET_THREAD_SSP_OFFSET
13074 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
13075 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
13076 operands[1] = gen_rtx_MEM (Pmode, addr);
13079 emit_insn (gen_stack_protect_setdi (operands[0], operands[1]));
13081 emit_insn (gen_stack_protect_setsi (operands[0], operands[1]));
13085 (define_insn "stack_protect_setsi"
13086 [(set (match_operand:SI 0 "memory_operand" "=m")
13087 (unspec:SI [(match_operand:SI 1 "memory_operand" "m")] UNSPEC_SP_SET))
13088 (set (match_scratch:SI 2 "=&r") (const_int 0))]
13090 "{l%U1%X1|lwz%U1%X1} %2,%1\;{st%U0%X0|stw%U0%X0} %2,%0\;{lil|li} %2,0"
13091 [(set_attr "type" "three")
13092 (set_attr "length" "12")])
13094 (define_insn "stack_protect_setdi"
13095 [(set (match_operand:DI 0 "memory_operand" "=m")
13096 (unspec:DI [(match_operand:DI 1 "memory_operand" "m")] UNSPEC_SP_SET))
13097 (set (match_scratch:DI 2 "=&r") (const_int 0))]
13099 "ld%U1%X1 %2,%1\;std%U0%X0 %2,%0\;{lil|li} %2,0"
13100 [(set_attr "type" "three")
13101 (set_attr "length" "12")])
13103 (define_expand "stack_protect_test"
13104 [(match_operand 0 "memory_operand" "")
13105 (match_operand 1 "memory_operand" "")
13106 (match_operand 2 "" "")]
13109 rtx test, op0, op1;
13110 #ifdef TARGET_THREAD_SSP_OFFSET
13111 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
13112 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
13113 operands[1] = gen_rtx_MEM (Pmode, addr);
13116 op1 = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, operands[1]), UNSPEC_SP_TEST);
13117 test = gen_rtx_EQ (VOIDmode, op0, op1);
13118 emit_jump_insn (gen_cbranchsi4 (test, op0, op1, operands[2]));
13122 (define_insn "stack_protect_testsi"
13123 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
13124 (unspec:CCEQ [(match_operand:SI 1 "memory_operand" "m,m")
13125 (match_operand:SI 2 "memory_operand" "m,m")]
13127 (set (match_scratch:SI 4 "=r,r") (const_int 0))
13128 (clobber (match_scratch:SI 3 "=&r,&r"))]
13131 {l%U1%X1|lwz%U1%X1} %3,%1\;{l%U2%X2|lwz%U2%X2} %4,%2\;xor. %3,%3,%4\;{lil|li} %4,0
13132 {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"
13133 [(set_attr "length" "16,20")])
13135 (define_insn "stack_protect_testdi"
13136 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
13137 (unspec:CCEQ [(match_operand:DI 1 "memory_operand" "m,m")
13138 (match_operand:DI 2 "memory_operand" "m,m")]
13140 (set (match_scratch:DI 4 "=r,r") (const_int 0))
13141 (clobber (match_scratch:DI 3 "=&r,&r"))]
13144 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;xor. %3,%3,%4\;{lil|li} %4,0
13145 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;cmpld %0,%3,%4\;{lil|li} %3,0\;{lil|li} %4,0"
13146 [(set_attr "length" "16,20")])
13149 ;; Here are the actual compare insns.
13150 (define_insn "*cmp<mode>_internal1"
13151 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
13152 (compare:CC (match_operand:GPR 1 "gpc_reg_operand" "r")
13153 (match_operand:GPR 2 "reg_or_short_operand" "rI")))]
13155 "{cmp%I2|cmp<wd>%I2} %0,%1,%2"
13156 [(set_attr "type" "cmp")])
13158 ;; If we are comparing a register for equality with a large constant,
13159 ;; we can do this with an XOR followed by a compare. But this is profitable
13160 ;; only if the large constant is only used for the comparison (and in this
13161 ;; case we already have a register to reuse as scratch).
13163 ;; For 64-bit registers, we could only do so if the constant's bit 15 is clear:
13164 ;; otherwise we'd need to XOR with FFFFFFFF????0000 which is not available.
13167 [(set (match_operand:SI 0 "register_operand")
13168 (match_operand:SI 1 "logical_const_operand" ""))
13169 (set (match_dup 0) (match_operator:SI 3 "boolean_or_operator"
13171 (match_operand:SI 2 "logical_const_operand" "")]))
13172 (set (match_operand:CC 4 "cc_reg_operand" "")
13173 (compare:CC (match_operand:SI 5 "gpc_reg_operand" "")
13176 (if_then_else (match_operator 6 "equality_operator"
13177 [(match_dup 4) (const_int 0)])
13178 (match_operand 7 "" "")
13179 (match_operand 8 "" "")))]
13180 "peep2_reg_dead_p (3, operands[0])
13181 && peep2_reg_dead_p (4, operands[4])"
13182 [(set (match_dup 0) (xor:SI (match_dup 5) (match_dup 9)))
13183 (set (match_dup 4) (compare:CC (match_dup 0) (match_dup 10)))
13184 (set (pc) (if_then_else (match_dup 6) (match_dup 7) (match_dup 8)))]
13187 /* Get the constant we are comparing against, and see what it looks like
13188 when sign-extended from 16 to 32 bits. Then see what constant we could
13189 XOR with SEXTC to get the sign-extended value. */
13190 rtx cnst = simplify_const_binary_operation (GET_CODE (operands[3]),
13192 operands[1], operands[2]);
13193 HOST_WIDE_INT c = INTVAL (cnst);
13194 HOST_WIDE_INT sextc = ((c & 0xffff) ^ 0x8000) - 0x8000;
13195 HOST_WIDE_INT xorv = c ^ sextc;
13197 operands[9] = GEN_INT (xorv);
13198 operands[10] = GEN_INT (sextc);
13201 (define_insn "*cmpsi_internal2"
13202 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
13203 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
13204 (match_operand:SI 2 "reg_or_u_short_operand" "rK")))]
13206 "{cmpl%I2|cmplw%I2} %0,%1,%b2"
13207 [(set_attr "type" "cmp")])
13209 (define_insn "*cmpdi_internal2"
13210 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
13211 (compare:CCUNS (match_operand:DI 1 "gpc_reg_operand" "r")
13212 (match_operand:DI 2 "reg_or_u_short_operand" "rK")))]
13214 "cmpld%I2 %0,%1,%b2"
13215 [(set_attr "type" "cmp")])
13217 ;; The following two insns don't exist as single insns, but if we provide
13218 ;; them, we can swap an add and compare, which will enable us to overlap more
13219 ;; of the required delay between a compare and branch. We generate code for
13220 ;; them by splitting.
13223 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
13224 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
13225 (match_operand:SI 2 "short_cint_operand" "i")))
13226 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
13227 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
13230 [(set_attr "length" "8")])
13233 [(set (match_operand:CCUNS 3 "cc_reg_operand" "=y")
13234 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
13235 (match_operand:SI 2 "u_short_cint_operand" "i")))
13236 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
13237 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
13240 [(set_attr "length" "8")])
13243 [(set (match_operand:CC 3 "cc_reg_operand" "")
13244 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
13245 (match_operand:SI 2 "short_cint_operand" "")))
13246 (set (match_operand:SI 0 "gpc_reg_operand" "")
13247 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
13249 [(set (match_dup 3) (compare:CC (match_dup 1) (match_dup 2)))
13250 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
13253 [(set (match_operand:CCUNS 3 "cc_reg_operand" "")
13254 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "")
13255 (match_operand:SI 2 "u_short_cint_operand" "")))
13256 (set (match_operand:SI 0 "gpc_reg_operand" "")
13257 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
13259 [(set (match_dup 3) (compare:CCUNS (match_dup 1) (match_dup 2)))
13260 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
13262 (define_insn "*cmpsf_internal1"
13263 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
13264 (compare:CCFP (match_operand:SF 1 "gpc_reg_operand" "f")
13265 (match_operand:SF 2 "gpc_reg_operand" "f")))]
13266 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
13268 [(set_attr "type" "fpcompare")])
13270 (define_insn "*cmpdf_internal1"
13271 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
13272 (compare:CCFP (match_operand:DF 1 "gpc_reg_operand" "d")
13273 (match_operand:DF 2 "gpc_reg_operand" "d")))]
13274 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
13275 && !VECTOR_UNIT_VSX_P (DFmode)"
13277 [(set_attr "type" "fpcompare")])
13279 ;; Only need to compare second words if first words equal
13280 (define_insn "*cmptf_internal1"
13281 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
13282 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "d")
13283 (match_operand:TF 2 "gpc_reg_operand" "d")))]
13284 "!TARGET_IEEEQUAD && !TARGET_XL_COMPAT
13285 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LONG_DOUBLE_128"
13286 "fcmpu %0,%1,%2\;bne %0,$+8\;fcmpu %0,%L1,%L2"
13287 [(set_attr "type" "fpcompare")
13288 (set_attr "length" "12")])
13290 (define_insn_and_split "*cmptf_internal2"
13291 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
13292 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "d")
13293 (match_operand:TF 2 "gpc_reg_operand" "d")))
13294 (clobber (match_scratch:DF 3 "=d"))
13295 (clobber (match_scratch:DF 4 "=d"))
13296 (clobber (match_scratch:DF 5 "=d"))
13297 (clobber (match_scratch:DF 6 "=d"))
13298 (clobber (match_scratch:DF 7 "=d"))
13299 (clobber (match_scratch:DF 8 "=d"))
13300 (clobber (match_scratch:DF 9 "=d"))
13301 (clobber (match_scratch:DF 10 "=d"))
13302 (clobber (match_scratch:GPR 11 "=b"))]
13303 "!TARGET_IEEEQUAD && TARGET_XL_COMPAT
13304 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LONG_DOUBLE_128"
13306 "&& reload_completed"
13307 [(set (match_dup 3) (match_dup 14))
13308 (set (match_dup 4) (match_dup 15))
13309 (set (match_dup 9) (abs:DF (match_dup 5)))
13310 (set (match_dup 0) (compare:CCFP (match_dup 9) (match_dup 3)))
13311 (set (pc) (if_then_else (ne (match_dup 0) (const_int 0))
13312 (label_ref (match_dup 12))
13314 (set (match_dup 0) (compare:CCFP (match_dup 5) (match_dup 7)))
13315 (set (pc) (label_ref (match_dup 13)))
13317 (set (match_dup 10) (minus:DF (match_dup 5) (match_dup 7)))
13318 (set (match_dup 9) (minus:DF (match_dup 6) (match_dup 8)))
13319 (set (match_dup 9) (plus:DF (match_dup 10) (match_dup 9)))
13320 (set (match_dup 0) (compare:CCFP (match_dup 9) (match_dup 4)))
13323 REAL_VALUE_TYPE rv;
13324 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
13325 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
13327 operands[5] = simplify_gen_subreg (DFmode, operands[1], TFmode, hi_word);
13328 operands[6] = simplify_gen_subreg (DFmode, operands[1], TFmode, lo_word);
13329 operands[7] = simplify_gen_subreg (DFmode, operands[2], TFmode, hi_word);
13330 operands[8] = simplify_gen_subreg (DFmode, operands[2], TFmode, lo_word);
13331 operands[12] = gen_label_rtx ();
13332 operands[13] = gen_label_rtx ();
13334 operands[14] = force_const_mem (DFmode,
13335 CONST_DOUBLE_FROM_REAL_VALUE (rv, DFmode));
13336 operands[15] = force_const_mem (DFmode,
13337 CONST_DOUBLE_FROM_REAL_VALUE (dconst0,
13342 tocref = create_TOC_reference (XEXP (operands[14], 0), operands[11]);
13343 operands[14] = gen_const_mem (DFmode, tocref);
13344 tocref = create_TOC_reference (XEXP (operands[15], 0), operands[11]);
13345 operands[15] = gen_const_mem (DFmode, tocref);
13346 set_mem_alias_set (operands[14], get_TOC_alias_set ());
13347 set_mem_alias_set (operands[15], get_TOC_alias_set ());
13351 ;; Now we have the scc insns. We can do some combinations because of the
13352 ;; way the machine works.
13354 ;; Note that this is probably faster if we can put an insn between the
13355 ;; mfcr and rlinm, but this is tricky. Let's leave it for now. In most
13356 ;; cases the insns below which don't use an intermediate CR field will
13357 ;; be used instead.
13359 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13360 (match_operator:SI 1 "scc_comparison_operator"
13361 [(match_operand 2 "cc_reg_operand" "y")
13364 "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1"
13365 [(set (attr "type")
13366 (cond [(match_test "TARGET_MFCRF")
13367 (const_string "mfcrf")
13369 (const_string "mfcr")))
13370 (set_attr "length" "8")])
13372 ;; Same as above, but get the GT bit.
13373 (define_insn "move_from_CR_gt_bit"
13374 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13375 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_GT))]
13376 "TARGET_HARD_FLOAT && !TARGET_FPRS"
13377 "mfcr %0\;{rlinm|rlwinm} %0,%0,%D1,31,31"
13378 [(set_attr "type" "mfcr")
13379 (set_attr "length" "8")])
13381 ;; Same as above, but get the OV/ORDERED bit.
13382 (define_insn "move_from_CR_ov_bit"
13383 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13384 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_OV))]
13386 "mfcr %0\;{rlinm|rlwinm} %0,%0,%t1,1"
13387 [(set_attr "type" "mfcr")
13388 (set_attr "length" "8")])
13391 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13392 (match_operator:DI 1 "scc_comparison_operator"
13393 [(match_operand 2 "cc_reg_operand" "y")
13396 "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1"
13397 [(set (attr "type")
13398 (cond [(match_test "TARGET_MFCRF")
13399 (const_string "mfcrf")
13401 (const_string "mfcr")))
13402 (set_attr "length" "8")])
13405 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13406 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
13407 [(match_operand 2 "cc_reg_operand" "y,y")
13410 (set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
13411 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
13414 mfcr %3%Q2\;{rlinm.|rlwinm.} %3,%3,%J1,1
13416 [(set_attr "type" "delayed_compare")
13417 (set_attr "length" "8,16")])
13420 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13421 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
13422 [(match_operand 2 "cc_reg_operand" "")
13425 (set (match_operand:SI 3 "gpc_reg_operand" "")
13426 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
13427 "TARGET_32BIT && reload_completed"
13428 [(set (match_dup 3)
13429 (match_op_dup 1 [(match_dup 2) (const_int 0)]))
13431 (compare:CC (match_dup 3)
13436 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13437 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
13438 [(match_operand 2 "cc_reg_operand" "y")
13440 (match_operand:SI 3 "const_int_operand" "n")))]
13444 int is_bit = ccr_bit (operands[1], 1);
13445 int put_bit = 31 - (INTVAL (operands[3]) & 31);
13448 if (is_bit >= put_bit)
13449 count = is_bit - put_bit;
13451 count = 32 - (put_bit - is_bit);
13453 operands[4] = GEN_INT (count);
13454 operands[5] = GEN_INT (put_bit);
13456 return \"mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%4,%5,%5\";
13458 [(set (attr "type")
13459 (cond [(match_test "TARGET_MFCRF")
13460 (const_string "mfcrf")
13462 (const_string "mfcr")))
13463 (set_attr "length" "8")])
13466 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13468 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
13469 [(match_operand 2 "cc_reg_operand" "y,y")
13471 (match_operand:SI 3 "const_int_operand" "n,n"))
13473 (set (match_operand:SI 4 "gpc_reg_operand" "=r,r")
13474 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
13479 int is_bit = ccr_bit (operands[1], 1);
13480 int put_bit = 31 - (INTVAL (operands[3]) & 31);
13483 /* Force split for non-cc0 compare. */
13484 if (which_alternative == 1)
13487 if (is_bit >= put_bit)
13488 count = is_bit - put_bit;
13490 count = 32 - (put_bit - is_bit);
13492 operands[5] = GEN_INT (count);
13493 operands[6] = GEN_INT (put_bit);
13495 return \"mfcr %4%Q2\;{rlinm.|rlwinm.} %4,%4,%5,%6,%6\";
13497 [(set_attr "type" "delayed_compare")
13498 (set_attr "length" "8,16")])
13501 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
13503 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
13504 [(match_operand 2 "cc_reg_operand" "")
13506 (match_operand:SI 3 "const_int_operand" ""))
13508 (set (match_operand:SI 4 "gpc_reg_operand" "")
13509 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
13512 [(set (match_dup 4)
13513 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
13516 (compare:CC (match_dup 4)
13520 ;; There is a 3 cycle delay between consecutive mfcr instructions
13521 ;; so it is useful to combine 2 scc instructions to use only one mfcr.
13524 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13525 (match_operator:SI 1 "scc_comparison_operator"
13526 [(match_operand 2 "cc_reg_operand" "y")
13528 (set (match_operand:SI 3 "gpc_reg_operand" "=r")
13529 (match_operator:SI 4 "scc_comparison_operator"
13530 [(match_operand 5 "cc_reg_operand" "y")
13532 "REGNO (operands[2]) != REGNO (operands[5])"
13533 "mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
13534 [(set_attr "type" "mfcr")
13535 (set_attr "length" "12")])
13538 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13539 (match_operator:DI 1 "scc_comparison_operator"
13540 [(match_operand 2 "cc_reg_operand" "y")
13542 (set (match_operand:DI 3 "gpc_reg_operand" "=r")
13543 (match_operator:DI 4 "scc_comparison_operator"
13544 [(match_operand 5 "cc_reg_operand" "y")
13546 "TARGET_POWERPC64 && REGNO (operands[2]) != REGNO (operands[5])"
13547 "mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
13548 [(set_attr "type" "mfcr")
13549 (set_attr "length" "12")])
13551 ;; There are some scc insns that can be done directly, without a compare.
13552 ;; These are faster because they don't involve the communications between
13553 ;; the FXU and branch units. In fact, we will be replacing all of the
13554 ;; integer scc insns here or in the portable methods in emit_store_flag.
13556 ;; Also support (neg (scc ..)) since that construct is used to replace
13557 ;; branches, (plus (scc ..) ..) since that construct is common and
13558 ;; takes no more insns than scc, and (and (neg (scc ..)) ..) in the
13559 ;; cases where it is no more expensive than (neg (scc ..)).
13561 ;; Have reload force a constant into a register for the simple insns that
13562 ;; otherwise won't accept constants. We do this because it is faster than
13563 ;; the cmp/mfcr sequence we would otherwise generate.
13565 (define_mode_attr scc_eq_op2 [(SI "rKLI")
13568 (define_insn_and_split "*eq<mode>"
13569 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
13570 (eq:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
13571 (match_operand:GPR 2 "scc_eq_operand" "<scc_eq_op2>")))]
13575 [(set (match_dup 0)
13576 (clz:GPR (match_dup 3)))
13578 (lshiftrt:GPR (match_dup 0) (match_dup 4)))]
13580 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
13582 /* Use output operand as intermediate. */
13583 operands[3] = operands[0];
13585 if (logical_operand (operands[2], <MODE>mode))
13586 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13587 gen_rtx_XOR (<MODE>mode,
13588 operands[1], operands[2])));
13590 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13591 gen_rtx_PLUS (<MODE>mode, operands[1],
13592 negate_rtx (<MODE>mode,
13596 operands[3] = operands[1];
13598 operands[4] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
13601 (define_insn_and_split "*eq<mode>_compare"
13602 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
13604 (eq:P (match_operand:P 1 "gpc_reg_operand" "=r")
13605 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))
13607 (set (match_operand:P 0 "gpc_reg_operand" "=r")
13608 (eq:P (match_dup 1) (match_dup 2)))]
13609 "!TARGET_POWER && optimize_size"
13611 "!TARGET_POWER && optimize_size"
13612 [(set (match_dup 0)
13613 (clz:P (match_dup 4)))
13614 (parallel [(set (match_dup 3)
13615 (compare:CC (lshiftrt:P (match_dup 0) (match_dup 5))
13618 (lshiftrt:P (match_dup 0) (match_dup 5)))])]
13620 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
13622 /* Use output operand as intermediate. */
13623 operands[4] = operands[0];
13625 if (logical_operand (operands[2], <MODE>mode))
13626 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
13627 gen_rtx_XOR (<MODE>mode,
13628 operands[1], operands[2])));
13630 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
13631 gen_rtx_PLUS (<MODE>mode, operands[1],
13632 negate_rtx (<MODE>mode,
13636 operands[4] = operands[1];
13638 operands[5] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
13641 (define_insn "*eqsi_power"
13642 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
13643 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
13644 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I")))
13645 (clobber (match_scratch:SI 3 "=r,&r,r,r,r"))]
13648 xor %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
13649 {sfi|subfic} %3,%1,0\;{ae|adde} %0,%3,%1
13650 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
13651 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
13652 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0"
13653 [(set_attr "type" "three,two,three,three,three")
13654 (set_attr "length" "12,8,12,12,12")])
13656 ;; We have insns of the form shown by the first define_insn below. If
13657 ;; there is something inside the comparison operation, we must split it.
13659 [(set (match_operand:SI 0 "gpc_reg_operand" "")
13660 (plus:SI (match_operator 1 "comparison_operator"
13661 [(match_operand:SI 2 "" "")
13662 (match_operand:SI 3
13663 "reg_or_cint_operand" "")])
13664 (match_operand:SI 4 "gpc_reg_operand" "")))
13665 (clobber (match_operand:SI 5 "register_operand" ""))]
13666 "! gpc_reg_operand (operands[2], SImode)"
13667 [(set (match_dup 5) (match_dup 2))
13668 (set (match_dup 2) (plus:SI (match_op_dup 1 [(match_dup 2) (match_dup 3)])
13671 (define_insn "*plus_eqsi"
13672 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r")
13673 (plus:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
13674 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I"))
13675 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r")))]
13678 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
13679 {sfi|subfic} %0,%1,0\;{aze|addze} %0,%3
13680 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
13681 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
13682 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
13683 [(set_attr "type" "three,two,three,three,three")
13684 (set_attr "length" "12,8,12,12,12")])
13686 (define_insn "*compare_plus_eqsi"
13687 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
13690 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
13691 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
13692 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
13694 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r"))]
13695 "TARGET_32BIT && optimize_size"
13697 xor %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
13698 {sfi|subfic} %4,%1,0\;{aze.|addze.} %4,%3
13699 {xoril|xori} %4,%1,%b2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
13700 {xoriu|xoris} %4,%1,%u2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
13701 {sfi|subfic} %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
13707 [(set_attr "type" "compare")
13708 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
13711 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13714 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
13715 (match_operand:SI 2 "scc_eq_operand" ""))
13716 (match_operand:SI 3 "gpc_reg_operand" ""))
13718 (clobber (match_scratch:SI 4 ""))]
13719 "TARGET_32BIT && optimize_size && reload_completed"
13720 [(set (match_dup 4)
13721 (plus:SI (eq:SI (match_dup 1)
13725 (compare:CC (match_dup 4)
13729 (define_insn "*plus_eqsi_compare"
13730 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
13733 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
13734 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
13735 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
13737 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r")
13738 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13739 "TARGET_32BIT && optimize_size"
13741 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
13742 {sfi|subfic} %0,%1,0\;{aze.|addze.} %0,%3
13743 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
13744 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
13745 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
13751 [(set_attr "type" "compare")
13752 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
13755 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13758 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
13759 (match_operand:SI 2 "scc_eq_operand" ""))
13760 (match_operand:SI 3 "gpc_reg_operand" ""))
13762 (set (match_operand:SI 0 "gpc_reg_operand" "")
13763 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13764 "TARGET_32BIT && optimize_size && reload_completed"
13765 [(set (match_dup 0)
13766 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13768 (compare:CC (match_dup 0)
13772 (define_insn "*neg_eq0<mode>"
13773 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13774 (neg:P (eq:P (match_operand:P 1 "gpc_reg_operand" "r")
13777 "{ai|addic} %0,%1,-1\;{sfe|subfe} %0,%0,%0"
13778 [(set_attr "type" "two")
13779 (set_attr "length" "8")])
13781 (define_insn_and_split "*neg_eq<mode>"
13782 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13783 (neg:P (eq:P (match_operand:P 1 "gpc_reg_operand" "%r")
13784 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))))]
13788 [(set (match_dup 0) (neg:P (eq:P (match_dup 3) (const_int 0))))]
13790 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
13792 /* Use output operand as intermediate. */
13793 operands[3] = operands[0];
13795 if (logical_operand (operands[2], <MODE>mode))
13796 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13797 gen_rtx_XOR (<MODE>mode,
13798 operands[1], operands[2])));
13800 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13801 gen_rtx_PLUS (<MODE>mode, operands[1],
13802 negate_rtx (<MODE>mode,
13806 operands[3] = operands[1];
13809 ;; Simplify (ne X (const_int 0)) on the PowerPC. No need to on the Power,
13810 ;; since it nabs/sr is just as fast.
13811 (define_insn "*ne0si"
13812 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
13813 (lshiftrt:SI (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
13815 (clobber (match_scratch:SI 2 "=&r"))]
13816 "! TARGET_POWER && TARGET_32BIT && !TARGET_ISEL"
13817 "{ai|addic} %2,%1,-1\;{sfe|subfe} %0,%2,%1"
13818 [(set_attr "type" "two")
13819 (set_attr "length" "8")])
13821 (define_insn "*ne0di"
13822 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13823 (lshiftrt:DI (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
13825 (clobber (match_scratch:DI 2 "=&r"))]
13827 "addic %2,%1,-1\;subfe %0,%2,%1"
13828 [(set_attr "type" "two")
13829 (set_attr "length" "8")])
13831 ;; This is what (plus (ne X (const_int 0)) Y) looks like.
13832 (define_insn "*plus_ne0si"
13833 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13834 (plus:SI (lshiftrt:SI
13835 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
13837 (match_operand:SI 2 "gpc_reg_operand" "r")))
13838 (clobber (match_scratch:SI 3 "=&r"))]
13840 "{ai|addic} %3,%1,-1\;{aze|addze} %0,%2"
13841 [(set_attr "type" "two")
13842 (set_attr "length" "8")])
13844 (define_insn "*plus_ne0di"
13845 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13846 (plus:DI (lshiftrt:DI
13847 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
13849 (match_operand:DI 2 "gpc_reg_operand" "r")))
13850 (clobber (match_scratch:DI 3 "=&r"))]
13852 "addic %3,%1,-1\;addze %0,%2"
13853 [(set_attr "type" "two")
13854 (set_attr "length" "8")])
13856 (define_insn "*compare_plus_ne0si"
13857 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13859 (plus:SI (lshiftrt:SI
13860 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
13862 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
13864 (clobber (match_scratch:SI 3 "=&r,&r"))
13865 (clobber (match_scratch:SI 4 "=X,&r"))]
13868 {ai|addic} %3,%1,-1\;{aze.|addze.} %3,%2
13870 [(set_attr "type" "compare")
13871 (set_attr "length" "8,12")])
13874 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13876 (plus:SI (lshiftrt:SI
13877 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
13879 (match_operand:SI 2 "gpc_reg_operand" ""))
13881 (clobber (match_scratch:SI 3 ""))
13882 (clobber (match_scratch:SI 4 ""))]
13883 "TARGET_32BIT && reload_completed"
13884 [(parallel [(set (match_dup 3)
13885 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1)))
13888 (clobber (match_dup 4))])
13890 (compare:CC (match_dup 3)
13894 (define_insn "*compare_plus_ne0di"
13895 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13897 (plus:DI (lshiftrt:DI
13898 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
13900 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
13902 (clobber (match_scratch:DI 3 "=&r,&r"))]
13905 addic %3,%1,-1\;addze. %3,%2
13907 [(set_attr "type" "compare")
13908 (set_attr "length" "8,12")])
13911 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
13913 (plus:DI (lshiftrt:DI
13914 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
13916 (match_operand:DI 2 "gpc_reg_operand" ""))
13918 (clobber (match_scratch:DI 3 ""))]
13919 "TARGET_64BIT && reload_completed"
13920 [(set (match_dup 3)
13921 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1)))
13925 (compare:CC (match_dup 3)
13929 (define_insn "*plus_ne0si_compare"
13930 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13932 (plus:SI (lshiftrt:SI
13933 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
13935 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
13937 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13938 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
13940 (clobber (match_scratch:SI 3 "=&r,&r"))]
13943 {ai|addic} %3,%1,-1\;{aze.|addze.} %0,%2
13945 [(set_attr "type" "compare")
13946 (set_attr "length" "8,12")])
13949 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13951 (plus:SI (lshiftrt:SI
13952 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
13954 (match_operand:SI 2 "gpc_reg_operand" ""))
13956 (set (match_operand:SI 0 "gpc_reg_operand" "")
13957 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
13959 (clobber (match_scratch:SI 3 ""))]
13960 "TARGET_32BIT && reload_completed"
13961 [(parallel [(set (match_dup 0)
13962 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
13964 (clobber (match_dup 3))])
13966 (compare:CC (match_dup 0)
13970 (define_insn "*plus_ne0di_compare"
13971 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13973 (plus:DI (lshiftrt:DI
13974 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
13976 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
13978 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
13979 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
13981 (clobber (match_scratch:DI 3 "=&r,&r"))]
13984 addic %3,%1,-1\;addze. %0,%2
13986 [(set_attr "type" "compare")
13987 (set_attr "length" "8,12")])
13990 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
13992 (plus:DI (lshiftrt:DI
13993 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
13995 (match_operand:DI 2 "gpc_reg_operand" ""))
13997 (set (match_operand:DI 0 "gpc_reg_operand" "")
13998 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
14000 (clobber (match_scratch:DI 3 ""))]
14001 "TARGET_64BIT && reload_completed"
14002 [(parallel [(set (match_dup 0)
14003 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
14005 (clobber (match_dup 3))])
14007 (compare:CC (match_dup 0)
14012 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
14013 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14014 (match_operand:SI 2 "reg_or_short_operand" "r,O")))
14015 (clobber (match_scratch:SI 3 "=r,X"))]
14018 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3
14019 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri|srwi} %0,%0,31"
14020 [(set_attr "length" "12")])
14023 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
14025 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14026 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
14028 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
14029 (le:SI (match_dup 1) (match_dup 2)))
14030 (clobber (match_scratch:SI 3 "=r,X,r,X"))]
14033 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
14034 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri.|srwi.} %0,%0,31
14037 [(set_attr "type" "compare,delayed_compare,compare,delayed_compare")
14038 (set_attr "length" "12,12,16,16")])
14041 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14043 (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
14044 (match_operand:SI 2 "reg_or_short_operand" ""))
14046 (set (match_operand:SI 0 "gpc_reg_operand" "")
14047 (le:SI (match_dup 1) (match_dup 2)))
14048 (clobber (match_scratch:SI 3 ""))]
14049 "TARGET_POWER && reload_completed"
14050 [(parallel [(set (match_dup 0)
14051 (le:SI (match_dup 1) (match_dup 2)))
14052 (clobber (match_dup 3))])
14054 (compare:CC (match_dup 0)
14059 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
14060 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14061 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
14062 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
14065 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
14066 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze|addze} %0,%3"
14067 [(set_attr "length" "12")])
14070 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
14072 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14073 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
14074 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
14076 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
14079 doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
14080 {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze.|addze.} %4,%3
14083 [(set_attr "type" "compare")
14084 (set_attr "length" "12,12,16,16")])
14087 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14089 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
14090 (match_operand:SI 2 "reg_or_short_operand" ""))
14091 (match_operand:SI 3 "gpc_reg_operand" ""))
14093 (clobber (match_scratch:SI 4 ""))]
14094 "TARGET_POWER && reload_completed"
14095 [(set (match_dup 4)
14096 (plus:SI (le:SI (match_dup 1) (match_dup 2))
14099 (compare:CC (match_dup 4)
14104 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
14106 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14107 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
14108 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
14110 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
14111 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14114 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
14115 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze.|addze.} %0,%3
14118 [(set_attr "type" "compare")
14119 (set_attr "length" "12,12,16,16")])
14122 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14124 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
14125 (match_operand:SI 2 "reg_or_short_operand" ""))
14126 (match_operand:SI 3 "gpc_reg_operand" ""))
14128 (set (match_operand:SI 0 "gpc_reg_operand" "")
14129 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14130 "TARGET_POWER && reload_completed"
14131 [(set (match_dup 0)
14132 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
14134 (compare:CC (match_dup 0)
14139 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
14140 (neg:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14141 (match_operand:SI 2 "reg_or_short_operand" "r,O"))))]
14144 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
14145 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{srai|srawi} %0,%0,31"
14146 [(set_attr "length" "12")])
14148 (define_insn "*leu<mode>"
14149 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
14150 (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
14151 (match_operand:P 2 "reg_or_short_operand" "rI")))]
14153 "{sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
14154 [(set_attr "type" "three")
14155 (set_attr "length" "12")])
14157 (define_insn "*leu<mode>_compare"
14158 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
14160 (leu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14161 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
14163 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
14164 (leu:P (match_dup 1) (match_dup 2)))]
14167 {sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
14169 [(set_attr "type" "compare")
14170 (set_attr "length" "12,16")])
14173 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
14175 (leu:P (match_operand:P 1 "gpc_reg_operand" "")
14176 (match_operand:P 2 "reg_or_short_operand" ""))
14178 (set (match_operand:P 0 "gpc_reg_operand" "")
14179 (leu:P (match_dup 1) (match_dup 2)))]
14181 [(set (match_dup 0)
14182 (leu:P (match_dup 1) (match_dup 2)))
14184 (compare:CC (match_dup 0)
14188 (define_insn "*plus_leu<mode>"
14189 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
14190 (plus:P (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
14191 (match_operand:P 2 "reg_or_short_operand" "rI"))
14192 (match_operand:P 3 "gpc_reg_operand" "r")))]
14194 "{sf%I2|subf%I2c} %0,%1,%2\;{aze|addze} %0,%3"
14195 [(set_attr "type" "two")
14196 (set_attr "length" "8")])
14199 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
14201 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14202 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14203 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14205 (clobber (match_scratch:SI 4 "=&r,&r"))]
14208 {sf%I2|subf%I2c} %4,%1,%2\;{aze.|addze.} %4,%3
14210 [(set_attr "type" "compare")
14211 (set_attr "length" "8,12")])
14214 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14216 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14217 (match_operand:SI 2 "reg_or_short_operand" ""))
14218 (match_operand:SI 3 "gpc_reg_operand" ""))
14220 (clobber (match_scratch:SI 4 ""))]
14221 "TARGET_32BIT && reload_completed"
14222 [(set (match_dup 4)
14223 (plus:SI (leu:SI (match_dup 1) (match_dup 2))
14226 (compare:CC (match_dup 4)
14231 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
14233 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14234 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14235 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14237 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
14238 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14241 {sf%I2|subf%I2c} %0,%1,%2\;{aze.|addze.} %0,%3
14243 [(set_attr "type" "compare")
14244 (set_attr "length" "8,12")])
14247 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14249 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14250 (match_operand:SI 2 "reg_or_short_operand" ""))
14251 (match_operand:SI 3 "gpc_reg_operand" ""))
14253 (set (match_operand:SI 0 "gpc_reg_operand" "")
14254 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14255 "TARGET_32BIT && reload_completed"
14256 [(set (match_dup 0)
14257 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
14259 (compare:CC (match_dup 0)
14263 (define_insn "*neg_leu<mode>"
14264 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
14265 (neg:P (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
14266 (match_operand:P 2 "reg_or_short_operand" "rI"))))]
14268 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0"
14269 [(set_attr "type" "three")
14270 (set_attr "length" "12")])
14272 (define_insn "*and_neg_leu<mode>"
14273 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
14275 (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
14276 (match_operand:P 2 "reg_or_short_operand" "rI")))
14277 (match_operand:P 3 "gpc_reg_operand" "r")))]
14279 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
14280 [(set_attr "type" "three")
14281 (set_attr "length" "12")])
14284 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
14287 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14288 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
14289 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14291 (clobber (match_scratch:SI 4 "=&r,&r"))]
14294 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
14296 [(set_attr "type" "compare")
14297 (set_attr "length" "12,16")])
14300 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14303 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14304 (match_operand:SI 2 "reg_or_short_operand" "")))
14305 (match_operand:SI 3 "gpc_reg_operand" ""))
14307 (clobber (match_scratch:SI 4 ""))]
14308 "TARGET_32BIT && reload_completed"
14309 [(set (match_dup 4)
14310 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
14313 (compare:CC (match_dup 4)
14318 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
14321 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14322 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
14323 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14325 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
14326 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
14329 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
14331 [(set_attr "type" "compare")
14332 (set_attr "length" "12,16")])
14335 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14338 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14339 (match_operand:SI 2 "reg_or_short_operand" "")))
14340 (match_operand:SI 3 "gpc_reg_operand" ""))
14342 (set (match_operand:SI 0 "gpc_reg_operand" "")
14343 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
14344 "TARGET_32BIT && reload_completed"
14345 [(set (match_dup 0)
14346 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
14349 (compare:CC (match_dup 0)
14354 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14355 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14356 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
14358 "doz%I2 %0,%1,%2\;nabs %0,%0\;{sri|srwi} %0,%0,31"
14359 [(set_attr "length" "12")])
14362 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
14364 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14365 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14367 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
14368 (lt:SI (match_dup 1) (match_dup 2)))]
14371 doz%I2 %0,%1,%2\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
14373 [(set_attr "type" "delayed_compare")
14374 (set_attr "length" "12,16")])
14377 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
14379 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14380 (match_operand:SI 2 "reg_or_short_operand" ""))
14382 (set (match_operand:SI 0 "gpc_reg_operand" "")
14383 (lt:SI (match_dup 1) (match_dup 2)))]
14384 "TARGET_POWER && reload_completed"
14385 [(set (match_dup 0)
14386 (lt:SI (match_dup 1) (match_dup 2)))
14388 (compare:CC (match_dup 0)
14393 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
14394 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14395 (match_operand:SI 2 "reg_or_short_operand" "rI"))
14396 (match_operand:SI 3 "gpc_reg_operand" "r")))]
14398 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
14399 [(set_attr "length" "12")])
14402 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
14404 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14405 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14406 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14408 (clobber (match_scratch:SI 4 "=&r,&r"))]
14411 doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
14413 [(set_attr "type" "compare")
14414 (set_attr "length" "12,16")])
14417 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14419 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14420 (match_operand:SI 2 "reg_or_short_operand" ""))
14421 (match_operand:SI 3 "gpc_reg_operand" ""))
14423 (clobber (match_scratch:SI 4 ""))]
14424 "TARGET_POWER && reload_completed"
14425 [(set (match_dup 4)
14426 (plus:SI (lt:SI (match_dup 1) (match_dup 2))
14429 (compare:CC (match_dup 4)
14434 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
14436 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14437 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14438 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14440 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
14441 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14444 doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
14446 [(set_attr "type" "compare")
14447 (set_attr "length" "12,16")])
14450 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14452 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14453 (match_operand:SI 2 "reg_or_short_operand" ""))
14454 (match_operand:SI 3 "gpc_reg_operand" ""))
14456 (set (match_operand:SI 0 "gpc_reg_operand" "")
14457 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14458 "TARGET_POWER && reload_completed"
14459 [(set (match_dup 0)
14460 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
14462 (compare:CC (match_dup 0)
14467 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14468 (neg:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14469 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
14471 "doz%I2 %0,%1,%2\;nabs %0,%0\;{srai|srawi} %0,%0,31"
14472 [(set_attr "length" "12")])
14474 (define_insn_and_split "*ltu<mode>"
14475 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
14476 (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14477 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))]
14481 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
14482 (set (match_dup 0) (neg:P (match_dup 0)))]
14485 (define_insn_and_split "*ltu<mode>_compare"
14486 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
14488 (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
14489 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
14491 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
14492 (ltu:P (match_dup 1) (match_dup 2)))]
14496 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
14497 (parallel [(set (match_dup 3)
14498 (compare:CC (neg:P (match_dup 0)) (const_int 0)))
14499 (set (match_dup 0) (neg:P (match_dup 0)))])]
14502 (define_insn_and_split "*plus_ltu<mode>"
14503 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,r")
14504 (plus:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14505 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))
14506 (match_operand:P 3 "reg_or_short_operand" "rI,rI")))]
14509 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
14510 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
14511 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))]
14514 (define_insn_and_split "*plus_ltu<mode>_compare"
14515 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
14517 (plus:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
14518 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
14519 (match_operand:P 3 "gpc_reg_operand" "r,r,r,r"))
14521 (set (match_operand:P 0 "gpc_reg_operand" "=&r,&r,&r,&r")
14522 (plus:P (ltu:P (match_dup 1) (match_dup 2)) (match_dup 3)))]
14525 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
14526 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
14527 (parallel [(set (match_dup 4)
14528 (compare:CC (minus:P (match_dup 3) (match_dup 0))
14530 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))])]
14533 (define_insn "*neg_ltu<mode>"
14534 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
14535 (neg:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14536 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))))]
14539 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0
14540 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0"
14541 [(set_attr "type" "two")
14542 (set_attr "length" "8")])
14545 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14546 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14547 (match_operand:SI 2 "reg_or_short_operand" "rI")))
14548 (clobber (match_scratch:SI 3 "=r"))]
14550 "doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3"
14551 [(set_attr "length" "12")])
14554 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
14556 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14557 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14559 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
14560 (ge:SI (match_dup 1) (match_dup 2)))
14561 (clobber (match_scratch:SI 3 "=r,r"))]
14564 doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
14566 [(set_attr "type" "compare")
14567 (set_attr "length" "12,16")])
14570 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14572 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
14573 (match_operand:SI 2 "reg_or_short_operand" ""))
14575 (set (match_operand:SI 0 "gpc_reg_operand" "")
14576 (ge:SI (match_dup 1) (match_dup 2)))
14577 (clobber (match_scratch:SI 3 ""))]
14578 "TARGET_POWER && reload_completed"
14579 [(parallel [(set (match_dup 0)
14580 (ge:SI (match_dup 1) (match_dup 2)))
14581 (clobber (match_dup 3))])
14583 (compare:CC (match_dup 0)
14588 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
14589 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14590 (match_operand:SI 2 "reg_or_short_operand" "rI"))
14591 (match_operand:SI 3 "gpc_reg_operand" "r")))]
14593 "doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
14594 [(set_attr "length" "12")])
14597 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
14599 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14600 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14601 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14603 (clobber (match_scratch:SI 4 "=&r,&r"))]
14606 doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
14608 [(set_attr "type" "compare")
14609 (set_attr "length" "12,16")])
14612 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14614 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
14615 (match_operand:SI 2 "reg_or_short_operand" ""))
14616 (match_operand:SI 3 "gpc_reg_operand" ""))
14618 (clobber (match_scratch:SI 4 ""))]
14619 "TARGET_POWER && reload_completed"
14620 [(set (match_dup 4)
14621 (plus:SI (ge:SI (match_dup 1) (match_dup 2))
14624 (compare:CC (match_dup 4)
14629 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
14631 (plus:SI (ge: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 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
14636 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14639 doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
14641 [(set_attr "type" "compare")
14642 (set_attr "length" "12,16")])
14645 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14647 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
14648 (match_operand:SI 2 "reg_or_short_operand" ""))
14649 (match_operand:SI 3 "gpc_reg_operand" ""))
14651 (set (match_operand:SI 0 "gpc_reg_operand" "")
14652 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14653 "TARGET_POWER && reload_completed"
14654 [(set (match_dup 0)
14655 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
14657 (compare:CC (match_dup 0)
14662 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14663 (neg:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14664 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
14666 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
14667 [(set_attr "length" "12")])
14669 (define_insn "*geu<mode>"
14670 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
14671 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14672 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))]
14675 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0
14676 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
14677 [(set_attr "type" "three")
14678 (set_attr "length" "12")])
14680 (define_insn "*geu<mode>_compare"
14681 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
14683 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
14684 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
14686 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
14687 (geu:P (match_dup 1) (match_dup 2)))]
14690 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
14691 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
14694 [(set_attr "type" "compare")
14695 (set_attr "length" "12,12,16,16")])
14698 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
14700 (geu:P (match_operand:P 1 "gpc_reg_operand" "")
14701 (match_operand:P 2 "reg_or_neg_short_operand" ""))
14703 (set (match_operand:P 0 "gpc_reg_operand" "")
14704 (geu:P (match_dup 1) (match_dup 2)))]
14706 [(set (match_dup 0)
14707 (geu:P (match_dup 1) (match_dup 2)))
14709 (compare:CC (match_dup 0)
14713 (define_insn "*plus_geu<mode>"
14714 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,&r")
14715 (plus:P (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14716 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))
14717 (match_operand:P 3 "gpc_reg_operand" "r,r")))]
14720 {sf|subfc} %0,%2,%1\;{aze|addze} %0,%3
14721 {ai|addic} %0,%1,%n2\;{aze|addze} %0,%3"
14722 [(set_attr "type" "two")
14723 (set_attr "length" "8")])
14726 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
14728 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14729 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
14730 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
14732 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
14735 {sf|subfc} %4,%2,%1\;{aze.|addze.} %4,%3
14736 {ai|addic} %4,%1,%n2\;{aze.|addze.} %4,%3
14739 [(set_attr "type" "compare")
14740 (set_attr "length" "8,8,12,12")])
14743 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14745 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14746 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
14747 (match_operand:SI 3 "gpc_reg_operand" ""))
14749 (clobber (match_scratch:SI 4 ""))]
14750 "TARGET_32BIT && reload_completed"
14751 [(set (match_dup 4)
14752 (plus:SI (geu:SI (match_dup 1) (match_dup 2))
14755 (compare:CC (match_dup 4)
14760 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
14762 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14763 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
14764 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
14766 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
14767 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14770 {sf|subfc} %0,%2,%1\;{aze.|addze.} %0,%3
14771 {ai|addic} %0,%1,%n2\;{aze.|addze.} %0,%3
14774 [(set_attr "type" "compare")
14775 (set_attr "length" "8,8,12,12")])
14778 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14780 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14781 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
14782 (match_operand:SI 3 "gpc_reg_operand" ""))
14784 (set (match_operand:SI 0 "gpc_reg_operand" "")
14785 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14786 "TARGET_32BIT && reload_completed"
14787 [(set (match_dup 0)
14788 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
14790 (compare:CC (match_dup 0)
14794 (define_insn "*neg_geu<mode>"
14795 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
14796 (neg:P (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14797 (match_operand:P 2 "reg_or_short_operand" "r,I"))))]
14800 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0
14801 {sfi|subfic} %0,%1,-1\;{a%I2|add%I2c} %0,%0,%2\;{sfe|subfe} %0,%0,%0"
14802 [(set_attr "type" "three")
14803 (set_attr "length" "12")])
14805 (define_insn "*and_neg_geu<mode>"
14806 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,&r")
14808 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14809 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))
14810 (match_operand:P 3 "gpc_reg_operand" "r,r")))]
14813 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0
14814 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
14815 [(set_attr "type" "three")
14816 (set_attr "length" "12")])
14819 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
14822 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14823 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
14824 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
14826 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
14829 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
14830 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
14833 [(set_attr "type" "compare")
14834 (set_attr "length" "12,12,16,16")])
14837 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14840 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14841 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
14842 (match_operand:SI 3 "gpc_reg_operand" ""))
14844 (clobber (match_scratch:SI 4 ""))]
14845 "TARGET_32BIT && reload_completed"
14846 [(set (match_dup 4)
14847 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2)))
14850 (compare:CC (match_dup 4)
14855 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
14858 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14859 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
14860 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
14862 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
14863 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
14866 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
14867 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
14870 [(set_attr "type" "compare")
14871 (set_attr "length" "12,12,16,16")])
14874 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14877 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14878 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
14879 (match_operand:SI 3 "gpc_reg_operand" ""))
14881 (set (match_operand:SI 0 "gpc_reg_operand" "")
14882 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
14883 "TARGET_32BIT && reload_completed"
14884 [(set (match_dup 0)
14885 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
14887 (compare:CC (match_dup 0)
14892 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14893 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14894 (match_operand:SI 2 "reg_or_short_operand" "r")))]
14896 "doz %0,%2,%1\;nabs %0,%0\;{sri|srwi} %0,%0,31"
14897 [(set_attr "length" "12")])
14900 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
14902 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14903 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
14905 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
14906 (gt:SI (match_dup 1) (match_dup 2)))]
14909 doz %0,%2,%1\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
14911 [(set_attr "type" "delayed_compare")
14912 (set_attr "length" "12,16")])
14915 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
14917 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14918 (match_operand:SI 2 "reg_or_short_operand" ""))
14920 (set (match_operand:SI 0 "gpc_reg_operand" "")
14921 (gt:SI (match_dup 1) (match_dup 2)))]
14922 "TARGET_POWER && reload_completed"
14923 [(set (match_dup 0)
14924 (gt:SI (match_dup 1) (match_dup 2)))
14926 (compare:CC (match_dup 0)
14930 (define_insn "*plus_gt0<mode>"
14931 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
14932 (plus:P (gt:P (match_operand:P 1 "gpc_reg_operand" "r")
14934 (match_operand:P 2 "gpc_reg_operand" "r")))]
14936 "{a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze|addze} %0,%2"
14937 [(set_attr "type" "three")
14938 (set_attr "length" "12")])
14941 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
14943 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14945 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
14947 (clobber (match_scratch:SI 3 "=&r,&r"))]
14950 {a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze.|addze.} %3,%2
14952 [(set_attr "type" "compare")
14953 (set_attr "length" "12,16")])
14956 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14958 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14960 (match_operand:SI 2 "gpc_reg_operand" ""))
14962 (clobber (match_scratch:SI 3 ""))]
14963 "TARGET_32BIT && reload_completed"
14964 [(set (match_dup 3)
14965 (plus:SI (gt:SI (match_dup 1) (const_int 0))
14968 (compare:CC (match_dup 3)
14973 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
14975 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
14977 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
14979 (clobber (match_scratch:DI 3 "=&r,&r"))]
14982 addc %3,%1,%1\;subfe %3,%1,%3\;addze. %3,%2
14984 [(set_attr "type" "compare")
14985 (set_attr "length" "12,16")])
14988 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
14990 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
14992 (match_operand:DI 2 "gpc_reg_operand" ""))
14994 (clobber (match_scratch:DI 3 ""))]
14995 "TARGET_64BIT && reload_completed"
14996 [(set (match_dup 3)
14997 (plus:DI (gt:DI (match_dup 1) (const_int 0))
15000 (compare:CC (match_dup 3)
15005 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
15007 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
15009 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
15011 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
15012 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
15015 {a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze.|addze.} %0,%2
15017 [(set_attr "type" "compare")
15018 (set_attr "length" "12,16")])
15021 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
15023 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
15025 (match_operand:SI 2 "gpc_reg_operand" ""))
15027 (set (match_operand:SI 0 "gpc_reg_operand" "")
15028 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
15029 "TARGET_32BIT && reload_completed"
15030 [(set (match_dup 0)
15031 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))
15033 (compare:CC (match_dup 0)
15038 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
15040 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
15042 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
15044 (set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
15045 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
15048 addc %0,%1,%1\;subfe %0,%1,%0\;addze. %0,%2
15050 [(set_attr "type" "compare")
15051 (set_attr "length" "12,16")])
15054 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
15056 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
15058 (match_operand:DI 2 "gpc_reg_operand" ""))
15060 (set (match_operand:DI 0 "gpc_reg_operand" "")
15061 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
15062 "TARGET_64BIT && reload_completed"
15063 [(set (match_dup 0)
15064 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))
15066 (compare:CC (match_dup 0)
15071 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
15072 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
15073 (match_operand:SI 2 "reg_or_short_operand" "r"))
15074 (match_operand:SI 3 "gpc_reg_operand" "r")))]
15076 "doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
15077 [(set_attr "length" "12")])
15080 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
15082 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
15083 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
15084 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
15086 (clobber (match_scratch:SI 4 "=&r,&r"))]
15089 doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
15091 [(set_attr "type" "compare")
15092 (set_attr "length" "12,16")])
15095 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
15097 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
15098 (match_operand:SI 2 "reg_or_short_operand" ""))
15099 (match_operand:SI 3 "gpc_reg_operand" ""))
15101 (clobber (match_scratch:SI 4 ""))]
15102 "TARGET_POWER && reload_completed"
15103 [(set (match_dup 4)
15104 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
15106 (compare:CC (match_dup 4)
15111 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
15113 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
15114 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
15115 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
15117 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
15118 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
15121 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
15123 [(set_attr "type" "compare")
15124 (set_attr "length" "12,16")])
15127 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
15129 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
15130 (match_operand:SI 2 "reg_or_short_operand" ""))
15131 (match_operand:SI 3 "gpc_reg_operand" ""))
15133 (set (match_operand:SI 0 "gpc_reg_operand" "")
15134 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
15135 "TARGET_POWER && reload_completed"
15136 [(set (match_dup 0)
15137 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
15139 (compare:CC (match_dup 0)
15144 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
15145 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
15146 (match_operand:SI 2 "reg_or_short_operand" "r"))))]
15148 "doz %0,%2,%1\;nabs %0,%0\;{srai|srawi} %0,%0,31"
15149 [(set_attr "length" "12")])
15151 (define_insn_and_split "*gtu<mode>"
15152 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
15153 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
15154 (match_operand:P 2 "reg_or_short_operand" "rI")))]
15158 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
15159 (set (match_dup 0) (neg:P (match_dup 0)))]
15162 (define_insn_and_split "*gtu<mode>_compare"
15163 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
15165 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
15166 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
15168 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
15169 (gtu:P (match_dup 1) (match_dup 2)))]
15173 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
15174 (parallel [(set (match_dup 3)
15175 (compare:CC (neg:P (match_dup 0)) (const_int 0)))
15176 (set (match_dup 0) (neg:P (match_dup 0)))])]
15179 (define_insn_and_split "*plus_gtu<mode>"
15180 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
15181 (plus:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
15182 (match_operand:P 2 "reg_or_short_operand" "rI"))
15183 (match_operand:P 3 "reg_or_short_operand" "rI")))]
15186 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
15187 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
15188 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))]
15191 (define_insn_and_split "*plus_gtu<mode>_compare"
15192 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
15194 (plus:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
15195 (match_operand:P 2 "reg_or_short_operand" "I,r,I,r"))
15196 (match_operand:P 3 "gpc_reg_operand" "r,r,r,r"))
15198 (set (match_operand:P 0 "gpc_reg_operand" "=&r,&r,&r,&r")
15199 (plus:P (gtu:P (match_dup 1) (match_dup 2)) (match_dup 3)))]
15202 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
15203 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
15204 (parallel [(set (match_dup 4)
15205 (compare:CC (minus:P (match_dup 3) (match_dup 0))
15207 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))])]
15210 (define_insn "*neg_gtu<mode>"
15211 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
15212 (neg:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
15213 (match_operand:P 2 "reg_or_short_operand" "rI"))))]
15215 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0"
15216 [(set_attr "type" "two")
15217 (set_attr "length" "8")])
15220 ;; Define both directions of branch and return. If we need a reload
15221 ;; register, we'd rather use CR0 since it is much easier to copy a
15222 ;; register CC value to there.
15226 (if_then_else (match_operator 1 "branch_comparison_operator"
15228 "cc_reg_operand" "y")
15230 (label_ref (match_operand 0 "" ""))
15235 return output_cbranch (operands[1], \"%l0\", 0, insn);
15237 [(set_attr "type" "branch")])
15241 (if_then_else (match_operator 0 "branch_comparison_operator"
15243 "cc_reg_operand" "y")
15250 return output_cbranch (operands[0], NULL, 0, insn);
15252 [(set_attr "type" "jmpreg")
15253 (set_attr "length" "4")])
15257 (if_then_else (match_operator 1 "branch_comparison_operator"
15259 "cc_reg_operand" "y")
15262 (label_ref (match_operand 0 "" ""))))]
15266 return output_cbranch (operands[1], \"%l0\", 1, insn);
15268 [(set_attr "type" "branch")])
15272 (if_then_else (match_operator 0 "branch_comparison_operator"
15274 "cc_reg_operand" "y")
15281 return output_cbranch (operands[0], NULL, 1, insn);
15283 [(set_attr "type" "jmpreg")
15284 (set_attr "length" "4")])
15286 ;; Logic on condition register values.
15288 ; This pattern matches things like
15289 ; (set (reg:CCEQ 68) (compare:CCEQ (ior:SI (gt:SI (reg:CCFP 68) (const_int 0))
15290 ; (eq:SI (reg:CCFP 68) (const_int 0)))
15292 ; which are generated by the branch logic.
15293 ; Prefer destructive operations where BT = BB (for crXX BT,BA,BB)
15295 (define_insn "*cceq_ior_compare"
15296 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
15297 (compare:CCEQ (match_operator:SI 1 "boolean_operator"
15298 [(match_operator:SI 2
15299 "branch_positive_comparison_operator"
15301 "cc_reg_operand" "y,y")
15303 (match_operator:SI 4
15304 "branch_positive_comparison_operator"
15306 "cc_reg_operand" "0,y")
15310 "cr%q1 %E0,%j2,%j4"
15311 [(set_attr "type" "cr_logical,delayed_cr")])
15313 ; Why is the constant -1 here, but 1 in the previous pattern?
15314 ; Because ~1 has all but the low bit set.
15316 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
15317 (compare:CCEQ (match_operator:SI 1 "boolean_or_operator"
15318 [(not:SI (match_operator:SI 2
15319 "branch_positive_comparison_operator"
15321 "cc_reg_operand" "y,y")
15323 (match_operator:SI 4
15324 "branch_positive_comparison_operator"
15326 "cc_reg_operand" "0,y")
15330 "cr%q1 %E0,%j2,%j4"
15331 [(set_attr "type" "cr_logical,delayed_cr")])
15333 (define_insn "*cceq_rev_compare"
15334 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
15335 (compare:CCEQ (match_operator:SI 1
15336 "branch_positive_comparison_operator"
15338 "cc_reg_operand" "0,y")
15342 "{crnor %E0,%j1,%j1|crnot %E0,%j1}"
15343 [(set_attr "type" "cr_logical,delayed_cr")])
15345 ;; If we are comparing the result of two comparisons, this can be done
15346 ;; using creqv or crxor.
15348 (define_insn_and_split ""
15349 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
15350 (compare:CCEQ (match_operator 1 "branch_comparison_operator"
15351 [(match_operand 2 "cc_reg_operand" "y")
15353 (match_operator 3 "branch_comparison_operator"
15354 [(match_operand 4 "cc_reg_operand" "y")
15359 [(set (match_dup 0) (compare:CCEQ (xor:SI (match_dup 1) (match_dup 3))
15363 int positive_1, positive_2;
15365 positive_1 = branch_positive_comparison_operator (operands[1],
15366 GET_MODE (operands[1]));
15367 positive_2 = branch_positive_comparison_operator (operands[3],
15368 GET_MODE (operands[3]));
15371 operands[1] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[2]),
15372 GET_CODE (operands[1])),
15374 operands[2], const0_rtx);
15375 else if (GET_MODE (operands[1]) != SImode)
15376 operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]), SImode,
15377 operands[2], const0_rtx);
15380 operands[3] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[4]),
15381 GET_CODE (operands[3])),
15383 operands[4], const0_rtx);
15384 else if (GET_MODE (operands[3]) != SImode)
15385 operands[3] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
15386 operands[4], const0_rtx);
15388 if (positive_1 == positive_2)
15390 operands[1] = gen_rtx_NOT (SImode, operands[1]);
15391 operands[5] = constm1_rtx;
15395 operands[5] = const1_rtx;
15399 ;; Unconditional branch and return.
15401 (define_insn "jump"
15403 (label_ref (match_operand 0 "" "")))]
15406 [(set_attr "type" "branch")])
15408 (define_insn "<return_str>return"
15412 [(set_attr "type" "jmpreg")])
15414 (define_expand "indirect_jump"
15415 [(set (pc) (match_operand 0 "register_operand" ""))])
15417 (define_insn "*indirect_jump<mode>"
15418 [(set (pc) (match_operand:P 0 "register_operand" "c,*l"))]
15423 [(set_attr "type" "jmpreg")])
15425 ;; Table jump for switch statements:
15426 (define_expand "tablejump"
15427 [(use (match_operand 0 "" ""))
15428 (use (label_ref (match_operand 1 "" "")))]
15433 emit_jump_insn (gen_tablejumpsi (operands[0], operands[1]));
15435 emit_jump_insn (gen_tablejumpdi (operands[0], operands[1]));
15439 (define_expand "tablejumpsi"
15440 [(set (match_dup 3)
15441 (plus:SI (match_operand:SI 0 "" "")
15443 (parallel [(set (pc) (match_dup 3))
15444 (use (label_ref (match_operand 1 "" "")))])]
15447 { operands[0] = force_reg (SImode, operands[0]);
15448 operands[2] = force_reg (SImode, gen_rtx_LABEL_REF (SImode, operands[1]));
15449 operands[3] = gen_reg_rtx (SImode);
15452 (define_expand "tablejumpdi"
15453 [(set (match_dup 4)
15454 (sign_extend:DI (match_operand:SI 0 "lwa_operand" "")))
15456 (plus:DI (match_dup 4)
15458 (parallel [(set (pc) (match_dup 3))
15459 (use (label_ref (match_operand 1 "" "")))])]
15462 { operands[2] = force_reg (DImode, gen_rtx_LABEL_REF (DImode, operands[1]));
15463 operands[3] = gen_reg_rtx (DImode);
15464 operands[4] = gen_reg_rtx (DImode);
15467 (define_insn "*tablejump<mode>_internal1"
15469 (match_operand:P 0 "register_operand" "c,*l"))
15470 (use (label_ref (match_operand 1 "" "")))]
15475 [(set_attr "type" "jmpreg")])
15480 "{cror 0,0,0|nop}")
15482 ;; Define the subtract-one-and-jump insns, starting with the template
15483 ;; so loop.c knows what to generate.
15485 (define_expand "doloop_end"
15486 [(use (match_operand 0 "" "")) ; loop pseudo
15487 (use (match_operand 1 "" "")) ; iterations; zero if unknown
15488 (use (match_operand 2 "" "")) ; max iterations
15489 (use (match_operand 3 "" "")) ; loop level
15490 (use (match_operand 4 "" ""))] ; label
15494 /* Only use this on innermost loops. */
15495 if (INTVAL (operands[3]) > 1)
15499 if (GET_MODE (operands[0]) != DImode)
15501 emit_jump_insn (gen_ctrdi (operands[0], operands[4]));
15505 if (GET_MODE (operands[0]) != SImode)
15507 emit_jump_insn (gen_ctrsi (operands[0], operands[4]));
15512 (define_expand "ctr<mode>"
15513 [(parallel [(set (pc)
15514 (if_then_else (ne (match_operand:P 0 "register_operand" "")
15516 (label_ref (match_operand 1 "" ""))
15519 (plus:P (match_dup 0)
15521 (clobber (match_scratch:CC 2 ""))
15522 (clobber (match_scratch:P 3 ""))])]
15526 ;; We need to be able to do this for any operand, including MEM, or we
15527 ;; will cause reload to blow up since we don't allow output reloads on
15529 ;; For the length attribute to be calculated correctly, the
15530 ;; label MUST be operand 0.
15532 (define_insn "*ctr<mode>_internal1"
15534 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
15536 (label_ref (match_operand 0 "" ""))
15538 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
15539 (plus:P (match_dup 1)
15541 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
15542 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
15546 if (which_alternative != 0)
15548 else if (get_attr_length (insn) == 4)
15549 return \"{bdn|bdnz} %l0\";
15551 return \"bdz $+8\;b %l0\";
15553 [(set_attr "type" "branch")
15554 (set_attr "length" "*,12,16,16")])
15556 (define_insn "*ctr<mode>_internal2"
15558 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
15561 (label_ref (match_operand 0 "" ""))))
15562 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
15563 (plus:P (match_dup 1)
15565 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
15566 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
15570 if (which_alternative != 0)
15572 else if (get_attr_length (insn) == 4)
15573 return \"bdz %l0\";
15575 return \"{bdn|bdnz} $+8\;b %l0\";
15577 [(set_attr "type" "branch")
15578 (set_attr "length" "*,12,16,16")])
15580 ;; Similar but use EQ
15582 (define_insn "*ctr<mode>_internal5"
15584 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
15586 (label_ref (match_operand 0 "" ""))
15588 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
15589 (plus:P (match_dup 1)
15591 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
15592 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
15596 if (which_alternative != 0)
15598 else if (get_attr_length (insn) == 4)
15599 return \"bdz %l0\";
15601 return \"{bdn|bdnz} $+8\;b %l0\";
15603 [(set_attr "type" "branch")
15604 (set_attr "length" "*,12,16,16")])
15606 (define_insn "*ctr<mode>_internal6"
15608 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
15611 (label_ref (match_operand 0 "" ""))))
15612 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
15613 (plus:P (match_dup 1)
15615 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
15616 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
15620 if (which_alternative != 0)
15622 else if (get_attr_length (insn) == 4)
15623 return \"{bdn|bdnz} %l0\";
15625 return \"bdz $+8\;b %l0\";
15627 [(set_attr "type" "branch")
15628 (set_attr "length" "*,12,16,16")])
15630 ;; Now the splitters if we could not allocate the CTR register
15634 (if_then_else (match_operator 2 "comparison_operator"
15635 [(match_operand:P 1 "gpc_reg_operand" "")
15637 (match_operand 5 "" "")
15638 (match_operand 6 "" "")))
15639 (set (match_operand:P 0 "gpc_reg_operand" "")
15640 (plus:P (match_dup 1) (const_int -1)))
15641 (clobber (match_scratch:CC 3 ""))
15642 (clobber (match_scratch:P 4 ""))]
15644 [(parallel [(set (match_dup 3)
15645 (compare:CC (plus:P (match_dup 1)
15649 (plus:P (match_dup 1)
15651 (set (pc) (if_then_else (match_dup 7)
15655 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
15656 operands[3], const0_rtx); }")
15660 (if_then_else (match_operator 2 "comparison_operator"
15661 [(match_operand:P 1 "gpc_reg_operand" "")
15663 (match_operand 5 "" "")
15664 (match_operand 6 "" "")))
15665 (set (match_operand:P 0 "nonimmediate_operand" "")
15666 (plus:P (match_dup 1) (const_int -1)))
15667 (clobber (match_scratch:CC 3 ""))
15668 (clobber (match_scratch:P 4 ""))]
15669 "reload_completed && ! gpc_reg_operand (operands[0], SImode)"
15670 [(parallel [(set (match_dup 3)
15671 (compare:CC (plus:P (match_dup 1)
15675 (plus:P (match_dup 1)
15679 (set (pc) (if_then_else (match_dup 7)
15683 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
15684 operands[3], const0_rtx); }")
15686 (define_insn "trap"
15687 [(trap_if (const_int 1) (const_int 0))]
15690 [(set_attr "type" "trap")])
15692 (define_expand "ctrap<mode>4"
15693 [(trap_if (match_operator 0 "ordered_comparison_operator"
15694 [(match_operand:GPR 1 "register_operand")
15695 (match_operand:GPR 2 "reg_or_short_operand")])
15696 (match_operand 3 "zero_constant" ""))]
15701 [(trap_if (match_operator 0 "ordered_comparison_operator"
15702 [(match_operand:GPR 1 "register_operand" "r")
15703 (match_operand:GPR 2 "reg_or_short_operand" "rI")])
15706 "{t|t<wd>}%V0%I2 %1,%2"
15707 [(set_attr "type" "trap")])
15709 ;; Insns related to generating the function prologue and epilogue.
15711 (define_expand "prologue"
15712 [(use (const_int 0))]
15715 rs6000_emit_prologue ();
15716 if (!TARGET_SCHED_PROLOG)
15717 emit_insn (gen_blockage ());
15721 (define_insn "*movesi_from_cr_one"
15722 [(match_parallel 0 "mfcr_operation"
15723 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
15724 (unspec:SI [(match_operand:CC 2 "cc_reg_operand" "y")
15725 (match_operand 3 "immediate_operand" "n")]
15726 UNSPEC_MOVESI_FROM_CR))])]
15732 for (i = 0; i < XVECLEN (operands[0], 0); i++)
15734 mask = INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
15735 operands[4] = GEN_INT (mask);
15736 output_asm_insn (\"mfcr %1,%4\", operands);
15740 [(set_attr "type" "mfcrf")])
15742 (define_insn "movesi_from_cr"
15743 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
15744 (unspec:SI [(reg:CC CR0_REGNO) (reg:CC CR1_REGNO)
15745 (reg:CC CR2_REGNO) (reg:CC CR3_REGNO)
15746 (reg:CC CR4_REGNO) (reg:CC CR5_REGNO)
15747 (reg:CC CR6_REGNO) (reg:CC CR7_REGNO)]
15748 UNSPEC_MOVESI_FROM_CR))]
15751 [(set_attr "type" "mfcr")])
15753 (define_insn "*stmw"
15754 [(match_parallel 0 "stmw_operation"
15755 [(set (match_operand:SI 1 "memory_operand" "=m")
15756 (match_operand:SI 2 "gpc_reg_operand" "r"))])]
15759 [(set_attr "type" "store_ux")])
15761 ; The following comment applies to:
15765 ; return_and_restore_gpregs*
15766 ; return_and_restore_fpregs*
15767 ; return_and_restore_fpregs_aix*
15769 ; The out-of-line save / restore functions expects one input argument.
15770 ; Since those are not standard call_insn's, we must avoid using
15771 ; MATCH_OPERAND for that argument. That way the register rename
15772 ; optimization will not try to rename this register.
15773 ; Each pattern is repeated for each possible register number used in
15774 ; various ABIs (r11, r1, and for some functions r12)
15776 (define_insn "*save_gpregs_<mode>_r11"
15777 [(match_parallel 0 "any_parallel_operand"
15778 [(clobber (reg:P 65))
15779 (use (match_operand:P 1 "symbol_ref_operand" "s"))
15781 (set (match_operand:P 2 "memory_operand" "=m")
15782 (match_operand:P 3 "gpc_reg_operand" "r"))])]
15785 [(set_attr "type" "branch")
15786 (set_attr "length" "4")])
15788 (define_insn "*save_gpregs_<mode>_r12"
15789 [(match_parallel 0 "any_parallel_operand"
15790 [(clobber (reg:P 65))
15791 (use (match_operand:P 1 "symbol_ref_operand" "s"))
15793 (set (match_operand:P 2 "memory_operand" "=m")
15794 (match_operand:P 3 "gpc_reg_operand" "r"))])]
15797 [(set_attr "type" "branch")
15798 (set_attr "length" "4")])
15800 (define_insn "*save_gpregs_<mode>_r1"
15801 [(match_parallel 0 "any_parallel_operand"
15802 [(clobber (reg:P 65))
15803 (use (match_operand:P 1 "symbol_ref_operand" "s"))
15805 (set (match_operand:P 2 "memory_operand" "=m")
15806 (match_operand:P 3 "gpc_reg_operand" "r"))])]
15809 [(set_attr "type" "branch")
15810 (set_attr "length" "4")])
15812 (define_insn "*save_fpregs_<mode>_r11"
15813 [(match_parallel 0 "any_parallel_operand"
15814 [(clobber (reg:P 65))
15815 (use (match_operand:P 1 "symbol_ref_operand" "s"))
15817 (set (match_operand:DF 2 "memory_operand" "=m")
15818 (match_operand:DF 3 "gpc_reg_operand" "d"))])]
15821 [(set_attr "type" "branch")
15822 (set_attr "length" "4")])
15824 (define_insn "*save_fpregs_<mode>_r12"
15825 [(match_parallel 0 "any_parallel_operand"
15826 [(clobber (reg:P 65))
15827 (use (match_operand:P 1 "symbol_ref_operand" "s"))
15829 (set (match_operand:DF 2 "memory_operand" "=m")
15830 (match_operand:DF 3 "gpc_reg_operand" "d"))])]
15833 [(set_attr "type" "branch")
15834 (set_attr "length" "4")])
15836 (define_insn "*save_fpregs_<mode>_r1"
15837 [(match_parallel 0 "any_parallel_operand"
15838 [(clobber (reg:P 65))
15839 (use (match_operand:P 1 "symbol_ref_operand" "s"))
15841 (set (match_operand:DF 2 "memory_operand" "=m")
15842 (match_operand:DF 3 "gpc_reg_operand" "d"))])]
15845 [(set_attr "type" "branch")
15846 (set_attr "length" "4")])
15848 ; These are to explain that changes to the stack pointer should
15849 ; not be moved over stores to stack memory.
15850 (define_insn "stack_tie"
15851 [(set (match_operand:BLK 0 "memory_operand" "+m")
15852 (unspec:BLK [(match_dup 0)] UNSPEC_TIE))]
15855 [(set_attr "length" "0")])
15857 ; Like stack_tie, but depend on both fp and sp based memory.
15858 (define_insn "frame_tie"
15859 [(set (match_operand:BLK 0 "memory_operand" "+m")
15860 (unspec:BLK [(match_dup 0)
15861 (match_operand:BLK 1 "memory_operand" "m")] UNSPEC_TIE))]
15864 [(set_attr "length" "0")])
15867 (define_expand "epilogue"
15868 [(use (const_int 0))]
15871 if (!TARGET_SCHED_PROLOG)
15872 emit_insn (gen_blockage ());
15873 rs6000_emit_epilogue (FALSE);
15877 ; On some processors, doing the mtcrf one CC register at a time is
15878 ; faster (like on the 604e). On others, doing them all at once is
15879 ; faster; for instance, on the 601 and 750.
15881 (define_expand "movsi_to_cr_one"
15882 [(set (match_operand:CC 0 "cc_reg_operand" "")
15883 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "")
15884 (match_dup 2)] UNSPEC_MOVESI_TO_CR))]
15886 "operands[2] = GEN_INT (1 << (75 - REGNO (operands[0])));")
15888 (define_insn "*movsi_to_cr"
15889 [(match_parallel 0 "mtcrf_operation"
15890 [(set (match_operand:CC 1 "cc_reg_operand" "=y")
15891 (unspec:CC [(match_operand:SI 2 "gpc_reg_operand" "r")
15892 (match_operand 3 "immediate_operand" "n")]
15893 UNSPEC_MOVESI_TO_CR))])]
15899 for (i = 0; i < XVECLEN (operands[0], 0); i++)
15900 mask |= INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
15901 operands[4] = GEN_INT (mask);
15902 return \"mtcrf %4,%2\";
15904 [(set_attr "type" "mtcr")])
15906 (define_insn "*mtcrfsi"
15907 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
15908 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
15909 (match_operand 2 "immediate_operand" "n")]
15910 UNSPEC_MOVESI_TO_CR))]
15911 "GET_CODE (operands[0]) == REG
15912 && CR_REGNO_P (REGNO (operands[0]))
15913 && GET_CODE (operands[2]) == CONST_INT
15914 && INTVAL (operands[2]) == 1 << (75 - REGNO (operands[0]))"
15916 [(set_attr "type" "mtcr")])
15918 ; The load-multiple instructions have similar properties.
15919 ; Note that "load_multiple" is a name known to the machine-independent
15920 ; code that actually corresponds to the PowerPC load-string.
15922 (define_insn "*lmw"
15923 [(match_parallel 0 "lmw_operation"
15924 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
15925 (match_operand:SI 2 "memory_operand" "m"))])]
15928 [(set_attr "type" "load_ux")
15929 (set_attr "cell_micro" "always")])
15931 (define_insn "*return_internal_<mode>"
15933 (use (match_operand:P 0 "register_operand" "lc"))]
15936 [(set_attr "type" "jmpreg")])
15938 ; FIXME: This would probably be somewhat simpler if the Cygnus sibcall
15939 ; stuff was in GCC. Oh, and "any_parallel_operand" is a bit flexible...
15941 ; The following comment applies to:
15945 ; return_and_restore_gpregs*
15946 ; return_and_restore_fpregs*
15947 ; return_and_restore_fpregs_aix*
15949 ; The out-of-line save / restore functions expects one input argument.
15950 ; Since those are not standard call_insn's, we must avoid using
15951 ; MATCH_OPERAND for that argument. That way the register rename
15952 ; optimization will not try to rename this register.
15953 ; Each pattern is repeated for each possible register number used in
15954 ; various ABIs (r11, r1, and for some functions r12)
15956 (define_insn "*restore_gpregs_<mode>_r11"
15957 [(match_parallel 0 "any_parallel_operand"
15958 [(clobber (match_operand:P 1 "register_operand" "=l"))
15959 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15961 (set (match_operand:P 3 "gpc_reg_operand" "=r")
15962 (match_operand:P 4 "memory_operand" "m"))])]
15965 [(set_attr "type" "branch")
15966 (set_attr "length" "4")])
15968 (define_insn "*restore_gpregs_<mode>_r12"
15969 [(match_parallel 0 "any_parallel_operand"
15970 [(clobber (match_operand:P 1 "register_operand" "=l"))
15971 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15973 (set (match_operand:P 3 "gpc_reg_operand" "=r")
15974 (match_operand:P 4 "memory_operand" "m"))])]
15977 [(set_attr "type" "branch")
15978 (set_attr "length" "4")])
15980 (define_insn "*restore_gpregs_<mode>_r1"
15981 [(match_parallel 0 "any_parallel_operand"
15982 [(clobber (match_operand:P 1 "register_operand" "=l"))
15983 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15985 (set (match_operand:P 3 "gpc_reg_operand" "=r")
15986 (match_operand:P 4 "memory_operand" "m"))])]
15989 [(set_attr "type" "branch")
15990 (set_attr "length" "4")])
15992 (define_insn "*return_and_restore_gpregs_<mode>_r11"
15993 [(match_parallel 0 "any_parallel_operand"
15995 (clobber (match_operand:P 1 "register_operand" "=l"))
15996 (use (match_operand:P 2 "symbol_ref_operand" "s"))
15998 (set (match_operand:P 3 "gpc_reg_operand" "=r")
15999 (match_operand:P 4 "memory_operand" "m"))])]
16002 [(set_attr "type" "branch")
16003 (set_attr "length" "4")])
16005 (define_insn "*return_and_restore_gpregs_<mode>_r12"
16006 [(match_parallel 0 "any_parallel_operand"
16008 (clobber (match_operand:P 1 "register_operand" "=l"))
16009 (use (match_operand:P 2 "symbol_ref_operand" "s"))
16011 (set (match_operand:P 3 "gpc_reg_operand" "=r")
16012 (match_operand:P 4 "memory_operand" "m"))])]
16015 [(set_attr "type" "branch")
16016 (set_attr "length" "4")])
16018 (define_insn "*return_and_restore_gpregs_<mode>_r1"
16019 [(match_parallel 0 "any_parallel_operand"
16021 (clobber (match_operand:P 1 "register_operand" "=l"))
16022 (use (match_operand:P 2 "symbol_ref_operand" "s"))
16024 (set (match_operand:P 3 "gpc_reg_operand" "=r")
16025 (match_operand:P 4 "memory_operand" "m"))])]
16028 [(set_attr "type" "branch")
16029 (set_attr "length" "4")])
16031 (define_insn "*return_and_restore_fpregs_<mode>_r11"
16032 [(match_parallel 0 "any_parallel_operand"
16034 (clobber (match_operand:P 1 "register_operand" "=l"))
16035 (use (match_operand:P 2 "symbol_ref_operand" "s"))
16037 (set (match_operand:DF 3 "gpc_reg_operand" "=d")
16038 (match_operand:DF 4 "memory_operand" "m"))])]
16041 [(set_attr "type" "branch")
16042 (set_attr "length" "4")])
16044 (define_insn "*return_and_restore_fpregs_<mode>_r12"
16045 [(match_parallel 0 "any_parallel_operand"
16047 (clobber (match_operand:P 1 "register_operand" "=l"))
16048 (use (match_operand:P 2 "symbol_ref_operand" "s"))
16050 (set (match_operand:DF 3 "gpc_reg_operand" "=d")
16051 (match_operand:DF 4 "memory_operand" "m"))])]
16054 [(set_attr "type" "branch")
16055 (set_attr "length" "4")])
16057 (define_insn "*return_and_restore_fpregs_<mode>_r1"
16058 [(match_parallel 0 "any_parallel_operand"
16060 (clobber (match_operand:P 1 "register_operand" "=l"))
16061 (use (match_operand:P 2 "symbol_ref_operand" "s"))
16063 (set (match_operand:DF 3 "gpc_reg_operand" "=d")
16064 (match_operand:DF 4 "memory_operand" "m"))])]
16067 [(set_attr "type" "branch")
16068 (set_attr "length" "4")])
16070 (define_insn "*return_and_restore_fpregs_aix_<mode>_r11"
16071 [(match_parallel 0 "any_parallel_operand"
16073 (use (match_operand:P 1 "register_operand" "l"))
16074 (use (match_operand:P 2 "symbol_ref_operand" "s"))
16076 (set (match_operand:DF 3 "gpc_reg_operand" "=d")
16077 (match_operand:DF 4 "memory_operand" "m"))])]
16080 [(set_attr "type" "branch")
16081 (set_attr "length" "4")])
16083 (define_insn "*return_and_restore_fpregs_aix_<mode>_r1"
16084 [(match_parallel 0 "any_parallel_operand"
16086 (use (match_operand:P 1 "register_operand" "l"))
16087 (use (match_operand:P 2 "symbol_ref_operand" "s"))
16089 (set (match_operand:DF 3 "gpc_reg_operand" "=d")
16090 (match_operand:DF 4 "memory_operand" "m"))])]
16093 [(set_attr "type" "branch")
16094 (set_attr "length" "4")])
16096 ; This is used in compiling the unwind routines.
16097 (define_expand "eh_return"
16098 [(use (match_operand 0 "general_operand" ""))]
16103 emit_insn (gen_eh_set_lr_si (operands[0]));
16105 emit_insn (gen_eh_set_lr_di (operands[0]));
16109 ; We can't expand this before we know where the link register is stored.
16110 (define_insn "eh_set_lr_<mode>"
16111 [(unspec_volatile [(match_operand:P 0 "register_operand" "r")]
16113 (clobber (match_scratch:P 1 "=&b"))]
16118 [(unspec_volatile [(match_operand 0 "register_operand" "")] UNSPECV_EH_RR)
16119 (clobber (match_scratch 1 ""))]
16124 rs6000_emit_eh_reg_restore (operands[0], operands[1]);
16128 (define_insn "prefetch"
16129 [(prefetch (match_operand 0 "indexed_or_indirect_address" "a")
16130 (match_operand:SI 1 "const_int_operand" "n")
16131 (match_operand:SI 2 "const_int_operand" "n"))]
16135 if (GET_CODE (operands[0]) == REG)
16136 return INTVAL (operands[1]) ? \"dcbtst 0,%0\" : \"dcbt 0,%0\";
16137 return INTVAL (operands[1]) ? \"dcbtst %a0\" : \"dcbt %a0\";
16139 [(set_attr "type" "load")])
16141 (define_insn "bpermd_<mode>"
16142 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
16143 (unspec:P [(match_operand:P 1 "gpc_reg_operand" "r")
16144 (match_operand:P 2 "gpc_reg_operand" "r")] UNSPEC_BPERM))]
16147 [(set_attr "type" "integer")])
16150 ;; Builtin fma support. Handle
16151 ;; Note that the conditions for expansion are in the FMA_F iterator.
16153 (define_expand "fma<mode>4"
16154 [(set (match_operand:FMA_F 0 "register_operand" "")
16156 (match_operand:FMA_F 1 "register_operand" "")
16157 (match_operand:FMA_F 2 "register_operand" "")
16158 (match_operand:FMA_F 3 "register_operand" "")))]
16162 ; Altivec only has fma and nfms.
16163 (define_expand "fms<mode>4"
16164 [(set (match_operand:FMA_F 0 "register_operand" "")
16166 (match_operand:FMA_F 1 "register_operand" "")
16167 (match_operand:FMA_F 2 "register_operand" "")
16168 (neg:FMA_F (match_operand:FMA_F 3 "register_operand" ""))))]
16169 "!VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
16172 ;; If signed zeros are ignored, -(a * b - c) = -a * b + c.
16173 (define_expand "fnma<mode>4"
16174 [(set (match_operand:FMA_F 0 "register_operand" "")
16177 (match_operand:FMA_F 1 "register_operand" "")
16178 (match_operand:FMA_F 2 "register_operand" "")
16179 (neg:FMA_F (match_operand:FMA_F 3 "register_operand" "")))))]
16180 "!HONOR_SIGNED_ZEROS (<MODE>mode)"
16183 ;; If signed zeros are ignored, -(a * b + c) = -a * b - c.
16184 (define_expand "fnms<mode>4"
16185 [(set (match_operand:FMA_F 0 "register_operand" "")
16188 (match_operand:FMA_F 1 "register_operand" "")
16189 (match_operand:FMA_F 2 "register_operand" "")
16190 (match_operand:FMA_F 3 "register_operand" ""))))]
16191 "!HONOR_SIGNED_ZEROS (<MODE>mode) && !VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
16194 ; Not an official optab name, but used from builtins.
16195 (define_expand "nfma<mode>4"
16196 [(set (match_operand:FMA_F 0 "register_operand" "")
16199 (match_operand:FMA_F 1 "register_operand" "")
16200 (match_operand:FMA_F 2 "register_operand" "")
16201 (match_operand:FMA_F 3 "register_operand" ""))))]
16202 "!VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
16205 ; Not an official optab name, but used from builtins.
16206 (define_expand "nfms<mode>4"
16207 [(set (match_operand:FMA_F 0 "register_operand" "")
16210 (match_operand:FMA_F 1 "register_operand" "")
16211 (match_operand:FMA_F 2 "register_operand" "")
16212 (neg:FMA_F (match_operand:FMA_F 3 "register_operand" "")))))]
16218 (include "sync.md")
16219 (include "vector.md")
16221 (include "altivec.md")
16224 (include "paired.md")